From 55dfa1bf4430e4c9c540a3c9a85170c3b5e2b669 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 7 Jan 2024 02:47:41 +0300 Subject: [PATCH] ref: soft: reorder applying light gamma --- ref/soft/r_surf.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ref/soft/r_surf.c b/ref/soft/r_surf.c index 3debf716..a2785e21 100644 --- a/ref/soft/r_surf.c +++ b/ref/soft/r_surf.c @@ -211,13 +211,9 @@ static void R_BuildLightMap( void ) for( i = 0, bl = blocklights; i < size; i++, bl += 1, lm++ ) { - bl[0] += gEngfuncs.LightToTexGamma( lm->r ) * scale; - bl[0] += gEngfuncs.LightToTexGamma( lm->g ) * scale; - bl[0] += gEngfuncs.LightToTexGamma( lm->b ) * scale; - - //printf("test\n"); - //bl[1] += gEngfuncs.LightToTexGamma( lm->g ) * scale; - //bl[2] += gEngfuncs.LightToTexGamma( lm->b ) * scale; + bl[0] += lm->r * scale; + bl[1] += lm->g * scale; + bl[2] += lm->b * scale; } } @@ -245,7 +241,10 @@ static void R_BuildLightMap( void ) // bound, invert, and shift for (i=0 ; i> 6 ) << 6; + else t = (int)blocklights[i]; + if (t < 0) t = 0; if( t > 65535 * 3 )