diff --git a/src/client/refresh/gl/header/local.h b/src/client/refresh/gl/header/local.h index 420a99ed..a0eaee0d 100644 --- a/src/client/refresh/gl/header/local.h +++ b/src/client/refresh/gl/header/local.h @@ -175,7 +175,7 @@ extern cvar_t *r_novis; extern cvar_t *r_lerpmodels; extern cvar_t *r_lightlevel; -extern cvar_t *gl_overbrightbits; +extern cvar_t *gl1_overbrightbits; extern cvar_t *gl_palettedtexture; extern cvar_t *gl_pointparameters; diff --git a/src/client/refresh/gl/r_main.c b/src/client/refresh/gl/r_main.c index b55dbcbd..22e2eec2 100644 --- a/src/client/refresh/gl/r_main.c +++ b/src/client/refresh/gl/r_main.c @@ -80,7 +80,7 @@ cvar_t *gl_lefthand; cvar_t *r_farsee; cvar_t *r_lightlevel; -cvar_t *gl_overbrightbits; +cvar_t *gl1_overbrightbits; cvar_t *gl_particle_min_size; cvar_t *gl_particle_max_size; @@ -1209,7 +1209,7 @@ R_Register(void) r_speeds = ri.Cvar_Get("r_speeds", "0", 0); r_lightlevel = ri.Cvar_Get("r_lightlevel", "0", 0); - gl_overbrightbits = ri.Cvar_Get("gl_overbrightbits", "0", CVAR_ARCHIVE); + gl1_overbrightbits = ri.Cvar_Get("gl1_overbrightbits", "0", CVAR_ARCHIVE); gl_particle_min_size = ri.Cvar_Get("gl_particle_min_size", "2", CVAR_ARCHIVE); gl_particle_max_size = ri.Cvar_Get("gl_particle_max_size", "40", CVAR_ARCHIVE); @@ -1631,18 +1631,18 @@ RI_BeginFrame(float camera_separation) } // Clamp overbrightbits - if (gl_overbrightbits->modified) + if (gl1_overbrightbits->modified) { - if (gl_overbrightbits->value > 2 && gl_overbrightbits->value < 4) + if (gl1_overbrightbits->value > 2 && gl1_overbrightbits->value < 4) { - ri.Cvar_Set("gl_overbrightbits", "2"); + ri.Cvar_Set("r_overbrightbits", "2"); } - else if (gl_overbrightbits->value > 4) + else if (gl1_overbrightbits->value > 4) { - ri.Cvar_Set("gl_overbrightbits", "4"); + ri.Cvar_Set("r_overbrightbits", "4"); } - gl_overbrightbits->modified = false; + gl1_overbrightbits->modified = false; } /* go into 2D mode */ diff --git a/src/client/refresh/gl/r_mesh.c b/src/client/refresh/gl/r_mesh.c index 38c507ef..df385dae 100644 --- a/src/client/refresh/gl/r_mesh.c +++ b/src/client/refresh/gl/r_mesh.c @@ -624,12 +624,12 @@ R_DrawAliasModel(entity_t *e) } - // Apply gl_overbrightbits to the mesh. If we don't do this they will appear slightly dimmer relative to walls. - if (gl_overbrightbits->value) + // Apply gl1_overbrightbits to the mesh. If we don't do this they will appear slightly dimmer relative to walls. + if (gl1_overbrightbits->value) { for (i = 0; i < 3; ++i) { - shadelight[i] *= gl_overbrightbits->value; + shadelight[i] *= gl1_overbrightbits->value; } } diff --git a/src/client/refresh/gl/r_surf.c b/src/client/refresh/gl/r_surf.c index 854eb9b1..2cf1f672 100644 --- a/src/client/refresh/gl/r_surf.c +++ b/src/client/refresh/gl/r_surf.c @@ -304,10 +304,10 @@ R_BlendLightmaps(void) if (surf->polys) { // Apply overbright bits to the static lightmaps - if (gl_overbrightbits->value) + if (gl1_overbrightbits->value) { R_TexEnv(GL_COMBINE_EXT); - glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl_overbrightbits->value); + glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl1_overbrightbits->value); } R_DrawGLPolyChain(surf->polys, 0, 0); @@ -363,10 +363,10 @@ R_BlendLightmaps(void) if (drawsurf->polys) { // Apply overbright bits to the dynamic lightmaps - if (gl_overbrightbits->value) + if (gl1_overbrightbits->value) { R_TexEnv(GL_COMBINE_EXT); - glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl_overbrightbits->value); + glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl1_overbrightbits->value); } R_DrawGLPolyChain(drawsurf->polys, @@ -407,10 +407,10 @@ R_BlendLightmaps(void) if (surf->polys) { // Apply overbright bits to the remainder lightmaps - if (gl_overbrightbits->value) + if (gl1_overbrightbits->value) { R_TexEnv(GL_COMBINE_EXT); - glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl_overbrightbits->value); + glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl1_overbrightbits->value); } R_DrawGLPolyChain(surf->polys, @@ -447,14 +447,14 @@ R_RenderBrushPoly(msurface_t *fa) would show up much too bright. When we implemented overbright bits this hack modified the global GL state in an incompatible way. So implement a new hack, based on overbright bits... Depending on the value set to - gl_overbrightbits the result is different: + gl1_overbrightbits the result is different: 0: Old behaviour. 1: No overbright bits on the global scene but correct lightning on warping surfaces. 2: Overbright bits on the global scene but not on warping surfaces. They oversaturate otherwise. */ - if (gl_overbrightbits->value) + if (gl1_overbrightbits->value) { R_TexEnv(GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1); diff --git a/src/client/refresh/gl3/gl3_main.c b/src/client/refresh/gl3/gl3_main.c index 15980bc9..f4732980 100644 --- a/src/client/refresh/gl3/gl3_main.c +++ b/src/client/refresh/gl3/gl3_main.c @@ -1648,7 +1648,7 @@ GL3_BeginFrame(float camera_separation) if(gl3_overbrightbits->value < 0.0f) { - ri.Cvar_Set("gl_overbrightbits", "0"); + ri.Cvar_Set("gl3_overbrightbits", "0"); } gl3state.uni3DData.overbrightbits = (gl3_overbrightbits->value <= 0.0f) ? 1.0f : gl3_overbrightbits->value; diff --git a/src/client/refresh/gl3/gl3_shaders.c b/src/client/refresh/gl3/gl3_shaders.c index 9e034426..b87e12d4 100644 --- a/src/client/refresh/gl3/gl3_shaders.c +++ b/src/client/refresh/gl3/gl3_shaders.c @@ -972,7 +972,7 @@ static void initUBOs(void) gl3state.uni3DData.scroll = 0.0f; gl3state.uni3DData.time = 0.0f; gl3state.uni3DData.alpha = 1.0f; - // gl_overbrightbits 0 means "no scaling" which is equivalent to multiplying with 1 + // gl3_overbrightbits 0 means "no scaling" which is equivalent to multiplying with 1 gl3state.uni3DData.overbrightbits = (gl3_overbrightbits->value <= 0.0f) ? 1.0f : gl3_overbrightbits->value; gl3state.uni3DData.particleFadeFactor = gl3_particle_fade_factor->value; diff --git a/src/common/cvar.c b/src/common/cvar.c index 1dbcc7a8..a87c624d 100644 --- a/src/common/cvar.c +++ b/src/common/cvar.c @@ -58,7 +58,8 @@ replacement_t replacements[] = { {"gl_lockpvs", "r_lockpvs"}, {"gl_maxfps", "vid_maxfps"}, {"gl_mode", "r_mode"}, - {"gl_modulate", "r_modulate"} + {"gl_modulate", "r_modulate"}, + {"gl_overbrightbits", "gl1_overbrightbits"} }; diff --git a/stuff/cvarlist.md b/stuff/cvarlist.md index 1170c196..f657e267 100644 --- a/stuff/cvarlist.md +++ b/stuff/cvarlist.md @@ -157,7 +157,7 @@ Graphics (GL1 only): Must be a floating point value, at least `1.0` - default is `2.0`. Applied when textures are loaded, so it needs a `vid_restart`! -* **gl_overbrightbits**: Enables overbright bits, brightness scaling of +* **gl1_overbrightbits**: Enables overbright bits, brightness scaling of lightmaps and models. Higher values make shadows less dark. Possible values are `0` (no overbright bits), `1` (correct lighting for water), `2` (scale by factor 2) and `3` (scale by factor 3). @@ -184,7 +184,7 @@ Graphics (GL3 only): * **gl3_overbrightbits**: Enables overbright bits, brightness scaling of lightmaps and models. Higher values make shadows less dark. - Similar to GL1's `gl_overbrightbits`, but allows any floating point number. + Similar to GL1's `gl1_overbrightbits`, but allows any floating point number. Default is `1.3`. In the OpenGL3.2 renderer, no lighting fixes for water are needed, so `1.0` has no special meaning.