Skip to content

Commit 7b0a4e4

Browse files
committed
bikeshedding
1 parent 74a54c9 commit 7b0a4e4

File tree

2 files changed

+54
-53
lines changed

2 files changed

+54
-53
lines changed

src/engine/renderer/tr_bsp.cpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5179,6 +5179,60 @@ void RE_LoadWorldMap( const char *name )
51795179
tr.worldLinearizeTexture = false;
51805180
tr.worldLinearizeLightMap = false;
51815181

5182+
/* These are the values expected by the renderer, used for
5183+
"gamma correction of the map". Both were set to 0 if we had neither
5184+
COMPAT_ET nor COMPAT_Q3, it may be interesting to remember.
5185+
5186+
Quake 3 and Tremulous values:
5187+
5188+
tr.overbrightBits = 1;
5189+
tr.mapOverBrightBits = 2;
5190+
tr.identityLight = 1.0f / ( 1 << tr.overbrightBits );
5191+
5192+
Wolfenstein: Enemy Territory values:
5193+
5194+
tr.overbrightBits = 0;
5195+
tr.mapOverBrightBits = 2;
5196+
tr.identityLight = 1.0f / ( 1 << tr.overbrightBits );
5197+
5198+
Games like Quake 3 and Tremulous require tr.mapOverBrightBits
5199+
to be set to 2. Because this engine is primarily maintained for
5200+
Unvanquished and needs to keep compatibility with legacy Tremulous
5201+
maps, this value is set to 2.
5202+
5203+
Games like True Combat: Elite (Wolf:ET mod) or Urban Terror 4
5204+
(Quake 3 mod) require tr.mapOverBrightBits to be set to 0.
5205+
5206+
The mapOverBrightBits value will be read as map entity key
5207+
by R_LoadEntities(), making possible to override the default
5208+
value and properly render a map with another value than the
5209+
default one.
5210+
5211+
If this key is missing in map entity lump, there is no way
5212+
to know the required value for mapOverBrightBits when loading
5213+
a BSP, one may rely on arena files to do some guessing when
5214+
loading foreign maps and games ported to the Dæmon engine may
5215+
require to set a different default than what Unvanquished
5216+
requires.
5217+
5218+
Using a non-zero value for tr.mapOverBrightBits turns light
5219+
non-linear and makes deluxe mapping buggy though.
5220+
5221+
Mappers may port maps by multiplying the lights by 2.5 and set
5222+
the mapOverBrightBits key to 0 in map entities lump.
5223+
5224+
In legacy engines, tr.overbrightBits was non-zero when
5225+
hardware overbright bits were enabled, zero when disabled.
5226+
This engine do not implement hardware overbright bit, so
5227+
this is always zero, and we can remove it and simplify all
5228+
the computations making use of it.
5229+
5230+
Because tr.overbrightBits is always 0, tr.identityLight is
5231+
always 1.0f, so we entirely removed it. */
5232+
5233+
tr.mapOverBrightBits = r_overbrightDefaultExponent.Get();
5234+
tr.legacyOverBrightClamping = r_overbrightDefaultClamp.Get();
5235+
51825236
s_worldData = {};
51835237
Q_strncpyz( s_worldData.name, name, sizeof( s_worldData.name ) );
51845238

src/engine/renderer/tr_image.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,59 +3054,6 @@ void R_InitImages()
30543054
tr.lightmaps.reserve( 128 );
30553055
tr.deluxemaps.reserve( 128 );
30563056

3057-
/* These are the values expected by the rest of the renderer
3058-
(esp. tr_bsp), used for "gamma correction of the map".
3059-
Both were set to 0 if we had neither COMPAT_ET nor COMPAT_Q3,
3060-
it may be interesting to remember.
3061-
3062-
Quake 3 and Tremulous values:
3063-
3064-
tr.overbrightBits = 0; // Software implementation.
3065-
tr.mapOverBrightBits = 2; // Quake 3 default.
3066-
tr.identityLight = 1.0f / ( 1 << tr.overbrightBits );
3067-
3068-
Games like Quake 3 and Tremulous require tr.mapOverBrightBits
3069-
to be set to 2. Because this engine is primarily maintained for
3070-
Unvanquished and needs to keep compatibility with legacy Tremulous
3071-
maps, this value is set to 2.
3072-
3073-
Games like True Combat: Elite (Wolf:ET mod) or Urban Terror 4
3074-
(Quake 3 mod) require tr.mapOverBrightBits to be set to 0.
3075-
3076-
For some reasons the Wolf:ET engine sets this to 0 by default
3077-
but the game sets it to 2 (and requires it to be 2 for maps
3078-
looking as expected).
3079-
3080-
The mapOverBrightBits value will be read as map entity key
3081-
by R_LoadEntities() in tr_bsp, making possible to override
3082-
the default value and properly render a map with another
3083-
value than the default one.
3084-
3085-
If this key is missing in map entity lump, there is no way
3086-
to know the required value for mapOverBrightBits when loading
3087-
a BSP, one may rely on arena files to do some guessing when
3088-
loading foreign maps and games ported to the Dæmon engine may
3089-
require to set a different default than what Unvanquished
3090-
requires.
3091-
3092-
Using a non-zero value for tr.mapOverBrightBits turns light
3093-
non-linear and makes deluxe mapping buggy though.
3094-
3095-
Mappers may port and fix maps by multiplying the lights by 2.5
3096-
and set the mapOverBrightBits key to 0 in map entities lump.
3097-
3098-
In legacy engines, tr.overbrightBits was non-zero when
3099-
hardware overbright bits were enabled, zero when disabled.
3100-
This engine do not implement hardware overbright bit, so
3101-
this is always zero, and we can remove it and simplify all
3102-
the computations making use of it.
3103-
3104-
Because tr.overbrightBits is always 0, tr.identityLight is
3105-
always 1.0f. We can entirely remove it. */
3106-
3107-
tr.mapOverBrightBits = r_overbrightDefaultExponent.Get();
3108-
tr.legacyOverBrightClamping = r_overbrightDefaultClamp.Get();
3109-
31103057
// create default texture and white texture
31113058
R_CreateBuiltinImages();
31123059
}

0 commit comments

Comments
 (0)