mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 22:11:18 +00:00
More changes...
- cvar for HUD depth - restored non-SDK project matrix to avoid hard to see HUD models - Prevent drawing sky during death cam (looks much better)
This commit is contained in:
parent
71c6a19806
commit
bd28df0c91
11 changed files with 31 additions and 26 deletions
|
@ -199,8 +199,6 @@ void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text
|
|||
|
||||
#endif
|
||||
|
||||
float trap_Cvar_VariableValue( const char *var_name );
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_DrawField
|
||||
|
|
|
@ -60,8 +60,9 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
|||
float screenXScale = cgs.screenXScale / 2.75f;
|
||||
float screenYScale = cgs.screenYScale / 2.25f;
|
||||
|
||||
int xoffset = -120;
|
||||
if (hudStereoView == STEREO_LEFT) {
|
||||
const auto depth = (int)trap_Cvar_VariableValue( "vr_hudDepth" );
|
||||
int xoffset = 120 - (depth * 20);
|
||||
if (hudStereoView == STEREO_RIGHT) {
|
||||
xoffset *= -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -699,6 +699,10 @@ static int CG_CalcViewValues( void ) {
|
|||
CG_OffsetFirstPersonView();
|
||||
}
|
||||
|
||||
//HACK!! - should change this to a renderer function call
|
||||
//Indicate to renderer whether we are in deathcam mode, We don't want sky in death cam mode
|
||||
trap_Cvar_Set( "r_deathCam", (cg.snap->ps.stats[STAT_HEALTH] <= 0) ? "1" : "0" );
|
||||
|
||||
// position eye relative to origin
|
||||
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ typedef struct {
|
|||
void (*EndFrame)( int *frontEndMsec, int *backEndMsec );
|
||||
|
||||
#if __ANDROID__
|
||||
void (*SetVRHeadsetParms)( const ovrMatrix4f *projectionMatrixLeft, const ovrMatrix4f *projectionMatrixRight,
|
||||
void (*SetVRHeadsetParms)( const ovrMatrix4f *projectionMatrix,
|
||||
int renderBufferL, int renderBufferR );
|
||||
#endif
|
||||
|
||||
|
|
|
@ -584,10 +584,9 @@ void R_Mat4Transpose( const float in[4][4], float* out ) {
|
|||
}
|
||||
|
||||
|
||||
void RE_SetVRHeadsetParms( const ovrMatrix4f *projectionMatrixLeft, const ovrMatrix4f *projectionMatrixRight,
|
||||
void RE_SetVRHeadsetParms( const ovrMatrix4f *projectionMatrix,
|
||||
int renderBufferL, int renderBufferR ) {
|
||||
R_Mat4Transpose(projectionMatrixLeft->M, tr.vrParms.projectionL);
|
||||
R_Mat4Transpose(projectionMatrixRight->M, tr.vrParms.projectionR);
|
||||
R_Mat4Transpose(projectionMatrix->M, tr.vrParms.projection);
|
||||
tr.vrParms.renderBufferL = renderBufferL;
|
||||
tr.vrParms.renderBufferR = renderBufferR;
|
||||
tr.vrParms.valid = qtrue;
|
||||
|
|
|
@ -72,6 +72,7 @@ cvar_t *r_measureOverdraw;
|
|||
|
||||
cvar_t *r_inGameVideo;
|
||||
cvar_t *r_fastsky;
|
||||
cvar_t *r_deathCam;
|
||||
cvar_t *r_drawSun;
|
||||
cvar_t *r_dynamiclight;
|
||||
cvar_t *r_dlightBacks;
|
||||
|
@ -1305,6 +1306,7 @@ void R_Register( void )
|
|||
r_stereoSeparation = ri.Cvar_Get( "r_stereoSeparation", "64", CVAR_ARCHIVE );
|
||||
r_ignoreGLErrors = ri.Cvar_Get( "r_ignoreGLErrors", "1", CVAR_ARCHIVE );
|
||||
r_fastsky = ri.Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE );
|
||||
r_deathCam = ri.Cvar_Get( "r_deathCam", "0", CVAR_ARCHIVE );
|
||||
r_inGameVideo = ri.Cvar_Get( "r_inGameVideo", "1", CVAR_ARCHIVE );
|
||||
r_drawSun = ri.Cvar_Get( "r_drawSun", "0", CVAR_ARCHIVE );
|
||||
r_dynamiclight = ri.Cvar_Get( "r_dynamiclight", "0", CVAR_ARCHIVE );
|
||||
|
|
|
@ -841,8 +841,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
qboolean valid;
|
||||
float projectionL[16];
|
||||
float projectionR[16];
|
||||
float projection[16];
|
||||
int renderBufferL;
|
||||
int renderBufferR;
|
||||
int renderBufferOriginal;
|
||||
|
@ -1700,6 +1699,7 @@ extern cvar_t *r_lodscale;
|
|||
|
||||
extern cvar_t *r_inGameVideo; // controls whether in game video should be draw
|
||||
extern cvar_t *r_fastsky; // controls whether sky should be cleared or drawn
|
||||
extern cvar_t *r_deathCam; //
|
||||
extern cvar_t *r_drawSun; // controls drawing of sun quad
|
||||
extern cvar_t *r_dynamiclight; // dynamic lights enabled/disabled
|
||||
extern cvar_t *r_dlightBacks; // dlight non-facing surfaces for continuity
|
||||
|
@ -2505,7 +2505,7 @@ void RE_StretchPic ( float x, float y, float w, float h,
|
|||
void RE_BeginFrame( stereoFrame_t stereoFrame );
|
||||
void RE_EndFrame( int *frontEndMsec, int *backEndMsec );
|
||||
#if __ANDROID__
|
||||
void RE_SetVRHeadsetParms( const ovrMatrix4f *projectionMatrixLeft, const ovrMatrix4f *projectionMatrixRight,
|
||||
void RE_SetVRHeadsetParms( const ovrMatrix4f *projectionMatrix,
|
||||
int renderBufferL, int renderBufferR );
|
||||
#endif
|
||||
void RE_SaveJPG(char * filename, int quality, int image_width, int image_height,
|
||||
|
|
|
@ -765,11 +765,12 @@ void R_SetupProjection(viewParms_t *dest, float zProj, float zFar, qboolean comp
|
|||
height = ymax - ymin;
|
||||
|
||||
if (tr.vrParms.valid) {
|
||||
if (dest->stereoFrame == STEREO_LEFT) {
|
||||
/* if (dest->stereoFrame == STEREO_LEFT) {
|
||||
memcpy(&dest->projectionMatrix, &tr.vrParms.projectionL, sizeof(dest->projectionMatrix));
|
||||
}
|
||||
else {
|
||||
memcpy(&dest->projectionMatrix, &tr.vrParms.projectionR, sizeof(dest->projectionMatrix));
|
||||
else */
|
||||
{
|
||||
memcpy(&dest->projectionMatrix, &tr.vrParms.projection, sizeof(dest->projectionMatrix));
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
|
|
@ -843,7 +843,7 @@ Other things could be stuck in here, like birds in the sky, etc
|
|||
================
|
||||
*/
|
||||
void RB_StageIteratorSky( void ) {
|
||||
if ( r_fastsky->integer ) {
|
||||
if ( r_fastsky->integer || r_deathCam->integer ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
static engine_t vr_engine;
|
||||
|
||||
cvar_t *vr_worldscale = NULL;
|
||||
cvar_t *vr_hudDepth = NULL;
|
||||
|
||||
engine_t* VR_Init( ovrJava java )
|
||||
{
|
||||
|
@ -39,6 +40,7 @@ engine_t* VR_Init( ovrJava java )
|
|||
void VR_InitCvars( void )
|
||||
{
|
||||
vr_worldscale = Cvar_Get ("vr_worldscale", "32.0", CVAR_ARCHIVE);
|
||||
vr_hudDepth = Cvar_Get ("vr_hudDepth", "3", CVAR_ARCHIVE);
|
||||
|
||||
// Values are: scale,right,up,forward,pitch,yaw,roll
|
||||
// VALUES PROVIDED BY SkillFur - Thank-you!
|
||||
|
|
|
@ -208,7 +208,7 @@ void VR_ClearFrameBuffer( GLuint frameBuffer, int width, int height)
|
|||
glEnable( GL_SCISSOR_TEST );
|
||||
glViewport( 0, 0, width, height );
|
||||
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
glClearColor( 0.2f, 0.0f, 0.05f, 1.0f );
|
||||
glScissor( 0, 0, width, height );
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
@ -229,6 +229,11 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
engine->predictedDisplayTime = vrapi_GetPredictedDisplayTime(engine->ovr, engine->frameIndex);
|
||||
engine->tracking = vrapi_GetPredictedTracking2(engine->ovr, engine->predictedDisplayTime);
|
||||
|
||||
float fov_y = vrapi_GetSystemPropertyInt( engine->ovr, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_Y);
|
||||
float fov_x = vrapi_GetSystemPropertyInt( engine->ovr, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
|
||||
const ovrMatrix4f projectionMatrix = ovrMatrix4f_CreateProjectionFov(
|
||||
fov_x, fov_y, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
|
||||
static int playerYaw = 0;
|
||||
|
||||
int eyeW, eyeH;
|
||||
|
@ -258,14 +263,7 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
|
||||
const framebuffer_t* framebuffers = engine->framebuffers;
|
||||
|
||||
//Now using a symmetrical render target, based on the horizontal FOV
|
||||
//float fov = vrapi_GetSystemPropertyInt( engine->ovr, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_Y);
|
||||
|
||||
// Setup the projection matrix.
|
||||
const ovrMatrix4f projectionMatrix = ovrMatrix4f_CreateProjectionFov(
|
||||
90, 90, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
|
||||
re.SetVRHeadsetParms(&projectionMatrix, &projectionMatrix,
|
||||
re.SetVRHeadsetParms(&projectionMatrix,
|
||||
framebuffers[0].framebuffers[framebuffers[0].swapchainIndex],
|
||||
framebuffers[1].framebuffers[framebuffers[1].swapchainIndex]);
|
||||
|
||||
|
@ -289,7 +287,7 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
for (int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; ++eye) {
|
||||
layer.Textures[eye].ColorSwapChain = engine->framebuffers[eye].colorTexture;
|
||||
layer.Textures[eye].SwapChainIndex = engine->framebuffers[eye].swapchainIndex;
|
||||
layer.Textures[eye].TexCoordsFromTanAngles = ovrMatrix4f_TanAngleMatrixFromProjection(&engine->tracking.Eye[eye].ProjectionMatrix);
|
||||
layer.Textures[eye].TexCoordsFromTanAngles = ovrMatrix4f_TanAngleMatrixFromProjection(&projectionMatrix);
|
||||
}
|
||||
|
||||
|
||||
|
@ -298,7 +296,7 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
VR_ClearFrameBuffer(framebuffers[0].framebuffers[framebuffers[0].swapchainIndex], eyeW, eyeH);
|
||||
VR_ClearFrameBuffer(framebuffers[1].framebuffers[framebuffers[1].swapchainIndex], eyeW, eyeH);
|
||||
|
||||
re.SetVRHeadsetParms(&engine->tracking.Eye[0].ProjectionMatrix, &engine->tracking.Eye[1].ProjectionMatrix,
|
||||
re.SetVRHeadsetParms(&projectionMatrix,
|
||||
framebuffers[0].framebuffers[framebuffers[0].swapchainIndex],
|
||||
framebuffers[1].framebuffers[framebuffers[1].swapchainIndex]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue