From c15822f375d287fcb10f2d06559720993ce9142b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 7 Jan 2024 02:21:07 +0300 Subject: [PATCH] ref: soft: don't depend on light gamma in recursive light point --- ref/soft/r_light.c | 22 +++++++--------------- ref/soft/r_local.h | 1 - ref/soft/r_studio.c | 2 -- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/ref/soft/r_light.c b/ref/soft/r_light.c index 3952e248..387e3924 100644 --- a/ref/soft/r_light.c +++ b/ref/soft/r_light.c @@ -323,18 +323,10 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, { uint scale = tr.lightstylevalue[surf->styles[map]]; - if( tr.ignore_lightgamma ) - { - cv->r += lm->r * scale * 2.5; // scale; - cv->g += lm->g * scale * 2.5; // scale; - cv->b += lm->b * scale * 2.5; // scale; - } - else - { - cv->r += gEngfuncs.LightToTexGamma( lm->r ) * scale; - cv->g += gEngfuncs.LightToTexGamma( lm->g ) * scale; - cv->b += gEngfuncs.LightToTexGamma( lm->b ) * scale; - } + cv->r += lm->r * scale; + cv->g += lm->g * scale; + cv->b += lm->b * scale; + lm += size; // skip to next lightmap if( dm != NULL ) @@ -421,9 +413,9 @@ colorVec R_LightVecInternal( const vec3_t start, const vec3_t end, vec3_t lspot, { if( lspot ) VectorCopy( g_trace_lightspot, lspot ); if( lvec ) VectorNormalize2( g_trace_lightvec, lvec ); - light.r = Q_min(( cv.r >> 7 ), 255 ); - light.g = Q_min(( cv.g >> 7 ), 255 ); - light.b = Q_min(( cv.b >> 7 ), 255 ); + light.r = Q_min(( cv.r >> 8 ), 255 ); + light.g = Q_min(( cv.g >> 8 ), 255 ); + light.b = Q_min(( cv.b >> 8 ), 255 ); last_fraction = g_trace_fraction; if(( light.r + light.g + light.b ) != 0 ) diff --git a/ref/soft/r_local.h b/ref/soft/r_local.h index 74ffb6b4..2c8e1b34 100644 --- a/ref/soft/r_local.h +++ b/ref/soft/r_local.h @@ -270,7 +270,6 @@ typedef struct int realframecount; // not including viewpasses int framecount; - qboolean ignore_lightgamma; qboolean fCustomRendering; qboolean fResetVis; qboolean fFlipViewModel; diff --git a/ref/soft/r_studio.c b/ref/soft/r_studio.c index 92bc4b6c..77e7b36e 100644 --- a/ref/soft/r_studio.c +++ b/ref/soft/r_studio.c @@ -3412,9 +3412,7 @@ void R_GatherPlayerLight( void ) cl_entity_t *view = tr.viewent; colorVec c; - tr.ignore_lightgamma = true; c = R_LightPoint( view->origin ); - tr.ignore_lightgamma = false; gEngfuncs.SetLocalLightLevel( ( c.r + c.g + c.b ) / 3 ); }