From 8e7c1f69a471affe1ce16f1a18f58da977980616 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 6 Aug 2023 17:37:42 +0100 Subject: [PATCH] new cvar r_alwaysmaxlod for PCVR build --- Projects/Android/jni/OpenJK/code/rd-vanilla/G2_API.cpp | 3 ++- Projects/Android/jni/OpenJK/code/rd-vanilla/tr_ghoul2.cpp | 5 +++++ Projects/Android/jni/OpenJK/code/rd-vanilla/tr_init.cpp | 6 ++++++ Projects/Android/jni/OpenJK/code/rd-vanilla/tr_local.h | 1 + Projects/Android/jni/OpenJK/code/rd-vanilla/tr_mesh.cpp | 5 +++++ Projects/Android/jni/OpenJK/code/rd-vanilla/tr_model.cpp | 2 +- Projects/Android/jni/OpenJK/code/rd-vanilla/tr_surface.cpp | 3 ++- 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Projects/Android/jni/OpenJK/code/rd-vanilla/G2_API.cpp b/Projects/Android/jni/OpenJK/code/rd-vanilla/G2_API.cpp index 09bc27e..66c2877 100644 --- a/Projects/Android/jni/OpenJK/code/rd-vanilla/G2_API.cpp +++ b/Projects/Android/jni/OpenJK/code/rd-vanilla/G2_API.cpp @@ -2185,7 +2185,8 @@ void G2API_AddSkinGore(CGhoul2Info_v &ghoul2,SSkinGoreData &gore) int lod; ResetGoreTag(); - const int lodbias=Com_Clamp ( 0, 2,G2_DecideTraceLod(ghoul2[0],r_lodbias->integer)); + const int lodbias= r_alwaysmaxlod->integer ? 0 : + Com_Clamp ( 0, 2,G2_DecideTraceLod(ghoul2[0],r_lodbias->integer)); const int maxLod =Com_Clamp (0,ghoul2[0].currentModel->numLods,3); //limit to the number of lods the main model has for(lod=lodbias;lodinteger) + { + return(0); + } + if (r_lodbias->integer > lodBias) { lodBias = r_lodbias->integer; diff --git a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_init.cpp b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_init.cpp index 5cf5004..f8a75f8 100644 --- a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_init.cpp +++ b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_init.cpp @@ -55,6 +55,7 @@ cvar_t *r_dynamiclight; // rjr - removed for hacking cvar_t *r_dlightBacks; cvar_t *r_lodbias; +cvar_t *r_alwaysmaxlod; cvar_t *r_lodscale; cvar_t *r_norefresh; @@ -1555,6 +1556,11 @@ void R_Register( void ) // r_lodCurveError = ri.Cvar_Get( "r_lodCurveError", "250", CVAR_ARCHIVE_ND ); r_lodbias = ri.Cvar_Get( "r_lodbias", "-2", CVAR_ARCHIVE_ND ); +#ifdef _WIN32 + r_alwaysmaxlod = ri.Cvar_Get( "r_alwaysmaxlod", "1", CVAR_ARCHIVE_ND ); +#else + r_alwaysmaxlod = ri.Cvar_Get("r_alwaysmaxlod", "0", CVAR_ARCHIVE_ND); +#endif r_flares = ri.Cvar_Get ("r_flares", "1", CVAR_ARCHIVE_ND ); r_lodscale = ri.Cvar_Get( "r_lodscale", "10", CVAR_ARCHIVE_ND ); diff --git a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_local.h b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_local.h index d021ccd..5cb58a8 100644 --- a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_local.h +++ b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_local.h @@ -1103,6 +1103,7 @@ extern cvar_t *r_texturebitslm; // number of desired lightmap texture bits extern cvar_t *r_measureOverdraw; // enables stencil buffer overdraw measurement extern cvar_t *r_lodbias; // push/pull LOD transitions +extern cvar_t * r_alwaysmaxlod; // force best LOD extern cvar_t *r_lodscale; extern cvar_t *r_primitives; // "0" = based on compiled vertex array existance diff --git a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_mesh.cpp b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_mesh.cpp index c9aa9fa..4159340 100644 --- a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_mesh.cpp +++ b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_mesh.cpp @@ -197,6 +197,11 @@ static int R_ComputeLOD( trRefEntity_t *ent ) { return(0); } + if (r_alwaysmaxlod->integer) + { + return(0); + } + // multiple LODs exist, so compute projected bounding sphere // and use that as a criteria for selecting LOD // if ( tr.currentModel->md3[0] ) diff --git a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_model.cpp b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_model.cpp index afc6de0..572cbdd 100644 --- a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_model.cpp +++ b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_model.cpp @@ -722,7 +722,7 @@ Ghoul2 Insert End // if we have a valid model and are biased // so that we won't see any higher detail ones, // stop loading them - if ( lod <= r_lodbias->integer ) { + if ( r_alwaysmaxlod->integer || lod <= r_lodbias->integer ) { break; } } diff --git a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_surface.cpp b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_surface.cpp index 1e51e71..706ab23 100644 --- a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_surface.cpp +++ b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_surface.cpp @@ -1612,7 +1612,8 @@ static void RB_SurfaceLathe() VectorSet2( l_oldpt, e->axis[0][0], e->axis[0][1] ); // do scalability stuff...r_lodbias 0-3 - int lod = r_lodbias->integer + 1; + int lod = r_alwaysmaxlod->integer ? 1 : + r_lodbias->integer + 1; if ( lod > 4 ) { lod = 4;