From 81dbbe7fd01ee2b8e4eda30cae397b502597176a Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 16 Jun 2022 11:15:41 +0200 Subject: [PATCH] SpaceWarp drawing blurry HUD is better than no HUD --- android/app/src/main/cpp/code/cgame/cg_draw.c | 13 +++++++------ android/app/src/main/cpp/code/client/cl_console.c | 3 +++ android/app/src/main/cpp/code/vr/vr_clientinfo.h | 1 + android/app/src/main/cpp/code/vr/vr_renderer.c | 7 +++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/android/app/src/main/cpp/code/cgame/cg_draw.c b/android/app/src/main/cpp/code/cgame/cg_draw.c index 1f36e13a..56be27bd 100644 --- a/android/app/src/main/cpp/code/cgame/cg_draw.c +++ b/android/app/src/main/cpp/code/cgame/cg_draw.c @@ -767,7 +767,11 @@ static float CG_DrawFPS( float y ) { } fps = 1000 * FPS_FRAMES / total; - s = va( "%ifps", fps ); + if ((int)trap_Cvar_VariableValue( "vr_spaceWarp" )) { + s = va( "%ifps", fps + fps ); + } else { + s = va( "%ifps", fps ); + } w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; CG_DrawBigString( 635 - w, y + 2, s, 1.0F); @@ -2955,7 +2959,7 @@ void CG_DrawActive( void ) { //Now draw the screen 2D stuff CG_DrawScreen2D(); - if (!vr->weapon_zoomed) + if (!vr->weapon_zoomed && !vr->drawingMotionVector) { cg.drawingHUD = qtrue; @@ -2963,10 +2967,7 @@ void CG_DrawActive( void ) { trap_R_HUDBufferStart(qtrue); // draw status bar and other floating elements - if ((int)trap_Cvar_VariableValue( "vr_spaceWarp" ) == 0) - { - CG_DrawHUD2D(); //TODO: move rendering HUD into OpenXR render layer - } + CG_DrawHUD2D(); trap_R_HUDBufferEnd(); diff --git a/android/app/src/main/cpp/code/client/cl_console.c b/android/app/src/main/cpp/code/client/cl_console.c index 574b9d9b..7d992b2e 100644 --- a/android/app/src/main/cpp/code/client/cl_console.c +++ b/android/app/src/main/cpp/code/client/cl_console.c @@ -566,6 +566,9 @@ Draws the last few lines of output transparently over the game top */ void Con_DrawNotify (void) { + if (vr.drawingMotionVector) + return; + int x, v; short *text; int i; diff --git a/android/app/src/main/cpp/code/vr/vr_clientinfo.h b/android/app/src/main/cpp/code/vr/vr_clientinfo.h index 620293cc..566519af 100644 --- a/android/app/src/main/cpp/code/vr/vr_clientinfo.h +++ b/android/app/src/main/cpp/code/vr/vr_clientinfo.h @@ -63,6 +63,7 @@ typedef struct { int *menuCursorX; int *menuCursorY; qboolean menuLeftHanded; + qboolean drawingMotionVector; float recenterYaw; } vr_clientinfo_t; diff --git a/android/app/src/main/cpp/code/vr/vr_renderer.c b/android/app/src/main/cpp/code/vr/vr_renderer.c index b6b1be23..90ee98fa 100644 --- a/android/app/src/main/cpp/code/vr/vr_renderer.c +++ b/android/app/src/main/cpp/code/vr/vr_renderer.c @@ -27,7 +27,6 @@ XrView* projections; XrPosef prevXrSpacePoseInWorld; qboolean fullscreenMode = qfalse; qboolean stageSupported = qfalse; -qboolean renderMotionVector = qfalse; void VR_UpdateStageBounds(ovrApp* pappState) { XrExtent2Df stageBounds = {}; @@ -509,9 +508,9 @@ void VR_DrawFrame( engine_t* engine ) { } if (vr_spacewarp->integer) { - renderMotionVector = qtrue; + vr.drawingMotionVector = qtrue; VR_RenderScene( engine, fov, qtrue ); - renderMotionVector = qfalse; + vr.drawingMotionVector = qfalse; VR_RenderScene( engine, fov, qfalse ); } else { VR_RenderScene( engine, fov, qfalse ); @@ -628,5 +627,5 @@ void VR_DrawFrame( engine_t* engine ) { int VR_RenderMotionVector() { - return renderMotionVector; + return vr.drawingMotionVector; } \ No newline at end of file