Skip to content

Commit 88d541e

Browse files
committed
Clean up w/ initial values of world lighting params
1 parent 8212089 commit 88d541e

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/engine/renderer/tr_bsp.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5060,11 +5060,15 @@ void RE_LoadWorldMap( const char *name )
50605060
// try will not look at the partially loaded version
50615061
tr.world = nullptr;
50625062

5063-
// tr.worldDeluxeMapping will be set by R_LoadLightmaps()
5064-
tr.worldLightMapping = false;
5065-
// tr.worldDeluxeMapping will be set by R_LoadEntities()
5066-
tr.worldDeluxeMapping = false;
5067-
tr.worldHDR_RGBE = false;
5063+
// It's probably a mistake if any of these lighting parameters are actually
5064+
// used before a map is loaded.
5065+
tr.worldLightMapping = false; // set by R_LoadLightmaps
5066+
tr.worldDeluxeMapping = false; // set by R_LoadEntities
5067+
tr.worldHDR_RGBE = false; // set by R_LoadEntities
5068+
tr.mapOverBrightBits = r_overbrightDefaultExponent.Get(); // maybe set by R_LoadEntities
5069+
tr.overbrightBits = std::min( tr.mapOverBrightBits, r_overbrightBits.Get() ); // set by RE_LoadWorldMap
5070+
tr.mapLightFactor = 1.0f; // set by RE_LoadWorldMap
5071+
tr.identityLight = 1.0f; // set by RE_LoadWorldMap
50685072

50695073
s_worldData = {};
50705074
Q_strncpyz( s_worldData.name, name, sizeof( s_worldData.name ) );
@@ -5152,7 +5156,6 @@ void RE_LoadWorldMap( const char *name )
51525156
tr.worldLight = tr.lightMode;
51535157
tr.modelLight = lightMode_t::FULLBRIGHT;
51545158
tr.modelDeluxe = deluxeMode_t::NONE;
5155-
tr.mapLightFactor = tr.identityLight = 1.0f;
51565159

51575160
// Use fullbright lighting for everything if the world is fullbright.
51585161
if ( tr.worldLight != lightMode_t::FULLBRIGHT )

src/engine/renderer/tr_image.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,10 +3120,6 @@ void R_InitImages()
31203120
For even more information, see https://github.com/DaemonEngine/Daemon/issues/1542.
31213121
*/
31223122

3123-
// TODO is there any reason to set these before a map is loaded?
3124-
tr.mapOverBrightBits = r_overbrightDefaultExponent.Get();
3125-
tr.overbrightBits = std::min(tr.mapOverBrightBits, r_overbrightBits.Get());
3126-
31273123
// create default texture and white texture
31283124
R_CreateBuiltinImages();
31293125
}

0 commit comments

Comments
 (0)