mirror of
https://github.com/DrBeef/JKXR.git
synced 2025-05-31 09:00:49 +00:00
Use calculated projection matrix
sorts out weird warping on the Pico. Allows for FOV to be overridden still for some effects (force speed)
This commit is contained in:
parent
7d99f83ae9
commit
4b1e010ca0
15 changed files with 40 additions and 7 deletions
|
@ -1317,6 +1317,7 @@ qboolean CG_CalcFOVFromX( float fov_x )
|
|||
}
|
||||
|
||||
// set it
|
||||
cg.refdef.override_fov = true;
|
||||
cg.refdef.fov_x = fov_x;
|
||||
cg.refdef.fov_y = fov_y;
|
||||
|
||||
|
|
|
@ -1612,6 +1612,7 @@ static void CIN_AddTextCrawl()
|
|||
refdef.rdflags = RDF_NOWORLDMODEL;
|
||||
AxisClear( refdef.viewaxis );
|
||||
|
||||
refdef.override_fov = true;
|
||||
refdef.fov_x = 130;
|
||||
refdef.fov_y = 130;
|
||||
|
||||
|
@ -2035,6 +2036,7 @@ void SCR_AddCreditTextCrawl()
|
|||
refdef.rdflags = RDF_NOWORLDMODEL;
|
||||
AxisClear( refdef.viewaxis );
|
||||
|
||||
refdef.override_fov = true;
|
||||
refdef.fov_x = 150;
|
||||
refdef.fov_y = 150;
|
||||
|
||||
|
|
|
@ -1192,6 +1192,7 @@ void CL_InitRef( void ) {
|
|||
rit.saved_game = &ojk::SavedGame::get_instance();
|
||||
|
||||
rit.JKVR_useScreenLayer = JKVR_useScreenLayer;
|
||||
rit.JKVR_GetVRProjection = JKVR_GetVRProjection;
|
||||
|
||||
ret = GetRefAPI( REF_API_VERSION, &rit );
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ typedef struct {
|
|||
|
||||
//JKVR Functions
|
||||
bool (*JKVR_useScreenLayer) ( void );
|
||||
bool (*JKVR_GetVRProjection) (int eye, float zNear, float zFar, float* projection);
|
||||
|
||||
} refimport_t;
|
||||
|
||||
|
|
|
@ -195,6 +195,7 @@ typedef enum {
|
|||
|
||||
typedef struct {
|
||||
int x, y, width, height;
|
||||
bool override_fov;
|
||||
float fov_x, fov_y;
|
||||
vec3_t vieworg;
|
||||
vec3_t viewaxis[3]; // transformation matrix
|
||||
|
|
|
@ -1430,11 +1430,9 @@ const void *RB_DrawBuffer( const void *data ) {
|
|||
const drawBufferCommand_t *cmd;
|
||||
|
||||
cmd = (const drawBufferCommand_t *)data;
|
||||
/*
|
||||
#ifndef HAVE_GLES
|
||||
qglDrawBuffer( cmd->buffer );
|
||||
#endif
|
||||
*/
|
||||
|
||||
tr.stereoFrame = (stereoFrame_t )cmd->buffer;
|
||||
|
||||
// clear screen for debugging
|
||||
if ( r_clear->integer ) {
|
||||
qglClearColor( 0, 0, 0, 1 );
|
||||
|
|
|
@ -79,6 +79,7 @@ typedef struct {
|
|||
// as well as the locally generated scene information
|
||||
typedef struct {
|
||||
int x, y, width, height;
|
||||
bool override_fov;
|
||||
float fov_x, fov_y;
|
||||
vec3_t vieworg;
|
||||
vec3_t viewaxis[3]; // transformation matrix
|
||||
|
@ -1017,6 +1018,7 @@ typedef struct {
|
|||
model_t *currentModel;
|
||||
|
||||
viewParms_t viewParms;
|
||||
stereoFrame_t stereoFrame;
|
||||
|
||||
float identityLight; // 1.0 / ( 1 << overbrightBits )
|
||||
int identityLightByte; // identityLight * 255
|
||||
|
|
|
@ -539,6 +539,13 @@ void R_SetupProjection( void ) {
|
|||
zNear = r_znear->value;
|
||||
zFar = tr.viewParms.zFar;
|
||||
|
||||
if (!tr.refdef.override_fov &&
|
||||
ri.JKVR_GetVRProjection((int)tr.stereoFrame, zNear, zFar, tr.viewParms.projectionMatrix))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ymax = zNear * tan( tr.refdef.fov_y * M_PI / 360.0f );
|
||||
ymin = -ymax;
|
||||
|
||||
|
|
|
@ -295,6 +295,7 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
tr.refdef.y = fd->y;
|
||||
tr.refdef.width = fd->width;
|
||||
tr.refdef.height = fd->height;
|
||||
tr.refdef.override_fov = fd->override_fov;
|
||||
tr.refdef.fov_x = fd->fov_x;
|
||||
tr.refdef.fov_y = fd->fov_y;
|
||||
|
||||
|
|
|
@ -7164,6 +7164,7 @@ void Item_Model_Paint(itemDef_t *item)
|
|||
//refdef.fov_x = (modelPtr->fov_x) ? modelPtr->fov_x : w;
|
||||
//refdef.fov_y = (modelPtr->fov_y) ? modelPtr->fov_y : h;
|
||||
|
||||
refdef.override_fov = true;
|
||||
refdef.fov_x = 45;
|
||||
refdef.fov_y = 45;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue