From c6d612233cde9a55488e953ba46bf48e2c29e23a Mon Sep 17 00:00:00 2001 From: VReaperV Date: Sun, 12 Jan 2025 02:57:29 +0300 Subject: [PATCH] Change r_ambientScale to a new-style cvar --- src/engine/renderer/gl_shader.cpp | 2 +- src/engine/renderer/tr_bsp.cpp | 2 +- src/engine/renderer/tr_init.cpp | 4 ++-- src/engine/renderer/tr_local.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/engine/renderer/gl_shader.cpp b/src/engine/renderer/gl_shader.cpp index 0c4b21bd45..d37926ffdb 100644 --- a/src/engine/renderer/gl_shader.cpp +++ b/src/engine/renderer/gl_shader.cpp @@ -599,7 +599,7 @@ static std::string GenEngineConstants() { // Engine constants std::string str; - AddDefine( str, "r_AmbientScale", r_ambientScale->value ); + AddDefine( str, "r_AmbientScale", r_ambientScale.Get() ); AddDefine( str, "r_SpecularScale", r_specularScale->value ); AddDefine( str, "r_zNear", r_znear->value ); diff --git a/src/engine/renderer/tr_bsp.cpp b/src/engine/renderer/tr_bsp.cpp index d0c9a062e8..94ef1e982f 100644 --- a/src/engine/renderer/tr_bsp.cpp +++ b/src/engine/renderer/tr_bsp.cpp @@ -4356,7 +4356,7 @@ void R_LoadEntities( lump_t *l, std::string &externalEntities ) sscanf( value, "%f %f %f", &tr.ambientLight[0], &tr.ambientLight[1], &tr.ambientLight[2] ); - VectorScale( tr.ambientLight, r_ambientScale->value, tr.ambientLight ); + VectorScale( tr.ambientLight, r_ambientScale.Get(), tr.ambientLight ); tr.ambientLightSet = true; } } diff --git a/src/engine/renderer/tr_init.cpp b/src/engine/renderer/tr_init.cpp index 7bf2283a9b..686592e4e0 100644 --- a/src/engine/renderer/tr_init.cpp +++ b/src/engine/renderer/tr_init.cpp @@ -218,7 +218,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Cvar::Range> r_forceAmbient( "r_forceAmbient", "Minimal light amount in lightGrid", Cvar::NONE, 0.125f, 0.0f, 0.3f ); - cvar_t *r_ambientScale; + Cvar::Cvar r_ambientScale( "r_ambientScale", "Scale lightGrid produced by ambientColor keyword by this much", Cvar::CHEAT, 1.0 ); cvar_t *r_lightScale; cvar_t *r_debugSort; cvar_t *r_printShaders; @@ -1192,7 +1192,7 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p r_gamma = Cvar_Get( "r_gamma", "1.0", CVAR_ARCHIVE ); r_facePlaneCull = Cvar_Get( "r_facePlaneCull", "1", 0 ); - r_ambientScale = Cvar_Get( "r_ambientScale", "1.0", CVAR_CHEAT | CVAR_LATCH ); + Cvar::Latch( r_ambientScale ); r_lightScale = Cvar_Get( "r_lightScale", "2", CVAR_CHEAT ); r_vboFaces = Cvar_Get( "r_vboFaces", "1", CVAR_CHEAT ); diff --git a/src/engine/renderer/tr_local.h b/src/engine/renderer/tr_local.h index 313e9bcc55..d25fe86f70 100644 --- a/src/engine/renderer/tr_local.h +++ b/src/engine/renderer/tr_local.h @@ -2891,7 +2891,7 @@ enum class shaderProfilerRenderSubGroupsMode { extern cvar_t *r_noFog; extern Cvar::Range> r_forceAmbient; - extern cvar_t *r_ambientScale; + extern Cvar::Cvar r_ambientScale; extern cvar_t *r_lightScale; extern Cvar::Cvar r_drawSky; // Controls whether sky should be drawn or cleared.