Skip to content

Commit 61cc149

Browse files
committed
Set lightGrid point colour to r_forceAmbient after overbright shift
Avoid overflow and incorrect results due to the overbright shift.
1 parent bc7361c commit 61cc149

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/engine/renderer/tr_bsp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4124,19 +4124,19 @@ void R_LoadLightGrid( lump_t *l )
41244124
tmpDirected[ 2 ] = in->directed[ 2 ];
41254125
tmpDirected[ 3 ] = 255;
41264126

4127+
if ( tr.legacyOverBrightClamping )
4128+
{
4129+
R_ColorShiftLightingBytes( tmpAmbient );
4130+
R_ColorShiftLightingBytes( tmpDirected );
4131+
}
4132+
41274133
const byte forceAmbientNormalised = floatToUnorm8( r_forceAmbient.Get() );
41284134
if ( tmpAmbient[0] < forceAmbientNormalised &&
41294135
tmpAmbient[1] < forceAmbientNormalised &&
41304136
tmpAmbient[2] < forceAmbientNormalised ) {
41314137
VectorSet( tmpAmbient, forceAmbientNormalised, forceAmbientNormalised, forceAmbientNormalised );
41324138
}
41334139

4134-
if ( tr.legacyOverBrightClamping )
4135-
{
4136-
R_ColorShiftLightingBytes( tmpAmbient );
4137-
R_ColorShiftLightingBytes( tmpDirected );
4138-
}
4139-
41404140
for ( j = 0; j < 3; j++ )
41414141
{
41424142
ambientColor[ j ] = tmpAmbient[ j ] * ( 1.0f / 255.0f );

0 commit comments

Comments
 (0)