From 55c4be043dff48e8b2845942e558cde87f4cce9b Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 24 Mar 2022 16:12:20 +0100 Subject: [PATCH 1/4] Redundant SDL call removed --- android/app/src/main/cpp/code/sdl/sdl_glimp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/cpp/code/sdl/sdl_glimp.c b/android/app/src/main/cpp/code/sdl/sdl_glimp.c index a78efbaf..3cf74ffd 100644 --- a/android/app/src/main/cpp/code/sdl/sdl_glimp.c +++ b/android/app/src/main/cpp/code/sdl/sdl_glimp.c @@ -1105,10 +1105,10 @@ Responsible for doing a swapbuffers */ void GLimp_EndFrame( void ) { - // don't flip if drawing to front buffer + //swap window is implemented in VR API, no need to do it here if ( Q_stricmp( r_drawBuffer->string, "GL_FRONT" ) != 0 ) { - SDL_GL_SwapWindow( SDL_window ); + //SDL_GL_SwapWindow( SDL_window ); } if( r_fullscreen->modified ) From ad5ea81eeb5933c973d1f8323208eaf55aea09f1 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 24 Mar 2022 16:39:03 +0100 Subject: [PATCH 2/4] Replace LOD computation to better fit VR needs --- android/app/src/main/cpp/code/renderergl2/tr_mesh.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/android/app/src/main/cpp/code/renderergl2/tr_mesh.c b/android/app/src/main/cpp/code/renderergl2/tr_mesh.c index 160be73d..7ae71f3c 100644 --- a/android/app/src/main/cpp/code/renderergl2/tr_mesh.c +++ b/android/app/src/main/cpp/code/renderergl2/tr_mesh.c @@ -164,6 +164,17 @@ R_ComputeLOD ================= */ int R_ComputeLOD( trRefEntity_t *ent ) { + + //HACK: force specific LOD (for VR it fits better) + if (1) + { + //high -> 0, medium -> 2, low -> 4 + int lod = r_lodbias->integer + r_lodbias->integer; + if (lod >= tr.currentModel->numLods) + lod = tr.currentModel->numLods - 1; + return lod; + } + float radius; float flod, lodscale; float projectedRadius; From 0a22991ff3fd36b65bd0bd4950ccd2d5d189f764 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 24 Mar 2022 16:39:26 +0100 Subject: [PATCH 3/4] Modify the low geometry detail settings --- android/app/src/main/cpp/code/q3_ui/ui_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/cpp/code/q3_ui/ui_video.c b/android/app/src/main/cpp/code/q3_ui/ui_video.c index 5091782e..f2deb4fe 100644 --- a/android/app/src/main/cpp/code/q3_ui/ui_video.c +++ b/android/app/src/main/cpp/code/q3_ui/ui_video.c @@ -741,8 +741,8 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification ) } else { - trap_Cvar_SetValue( "r_lodBias", 1 ); - trap_Cvar_SetValue( "r_subdivisions", 20 ); + trap_Cvar_SetValue( "r_lodBias", 2 ); + trap_Cvar_SetValue( "r_subdivisions", 80 ); } if ( s_graphicsoptions.filter.curvalue ) From 0441ba1ab068d239a4360c20a55be284d9a9e4f5 Mon Sep 17 00:00:00 2001 From: Lubos Date: Tue, 29 Mar 2022 12:58:09 +0200 Subject: [PATCH 4/4] Do not crash on undefined LOD --- android/app/src/main/cpp/code/renderergl2/tr_mesh.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/app/src/main/cpp/code/renderergl2/tr_mesh.c b/android/app/src/main/cpp/code/renderergl2/tr_mesh.c index 7ae71f3c..967199d0 100644 --- a/android/app/src/main/cpp/code/renderergl2/tr_mesh.c +++ b/android/app/src/main/cpp/code/renderergl2/tr_mesh.c @@ -172,6 +172,8 @@ int R_ComputeLOD( trRefEntity_t *ent ) { int lod = r_lodbias->integer + r_lodbias->integer; if (lod >= tr.currentModel->numLods) lod = tr.currentModel->numLods - 1; + if (lod < 0) + lod = 0; return lod; }