Skip to content

Commit

Permalink
Change r_ambientScale to a new-style cvar
Browse files Browse the repository at this point in the history
  • Loading branch information
VReaperV committed Jan 20, 2025
1 parent beccd92 commit c6d6122
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/engine/renderer/gl_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/engine/renderer/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Cvar::Range<Cvar::Cvar<float>> r_forceAmbient( "r_forceAmbient", "Minimal light amount in lightGrid", Cvar::NONE,
0.125f, 0.0f, 0.3f );
cvar_t *r_ambientScale;
Cvar::Cvar<float> 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;
Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ enum class shaderProfilerRenderSubGroupsMode {
extern cvar_t *r_noFog;

extern Cvar::Range<Cvar::Cvar<float>> r_forceAmbient;
extern cvar_t *r_ambientScale;
extern Cvar::Cvar<float> r_ambientScale;
extern cvar_t *r_lightScale;

extern Cvar::Cvar<bool> r_drawSky; // Controls whether sky should be drawn or cleared.
Expand Down

0 comments on commit c6d6122

Please sign in to comment.