Browse Source

ref: gl: remove unused scale (remnants of r_lightmap_modulate), use integer values for non-interpolated lightstyles

pull/2/head
Alibek Omarov 12 months ago
parent
commit
87b204c661
  1. 24
      ref/gl/gl_rlight.c

24
ref/gl/gl_rlight.c

@ -37,23 +37,23 @@ void CL_RunLightStyles( void )
int i, k, flight, clight; int i, k, flight, clight;
float l, lerpfrac, backlerp; float l, lerpfrac, backlerp;
float frametime = (gp_cl->time - gp_cl->oldtime); float frametime = (gp_cl->time - gp_cl->oldtime);
float scale;
lightstyle_t *ls; lightstyle_t *ls;
if( !WORLDMODEL ) return; if( !WORLDMODEL )
return;
scale = 1.0f; if( !WORLDMODEL->lightdata )
{
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
tr.lightstylevalue[i] = 256 * 256;
return;
}
// light animations // light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright // 'm' is normal light, 'a' is no light, 'z' is double bright
for( i = 0; i < MAX_LIGHTSTYLES; i++ ) for( i = 0; i < MAX_LIGHTSTYLES; i++ )
{ {
ls = gEngfuncs.GetLightStyle( i ); ls = gEngfuncs.GetLightStyle( i );
if( !WORLDMODEL->lightdata )
{
tr.lightstylevalue[i] = 256 * 256;
continue;
}
if( !gp_cl->paused && frametime <= 0.1f ) if( !gp_cl->paused && frametime <= 0.1f )
ls->time += frametime; // evaluate local time ls->time += frametime; // evaluate local time
@ -65,18 +65,18 @@ void CL_RunLightStyles( void )
if( !ls->length ) if( !ls->length )
{ {
tr.lightstylevalue[i] = 256 * scale; tr.lightstylevalue[i] = 256;
continue; continue;
} }
else if( ls->length == 1 ) else if( ls->length == 1 )
{ {
// single length style so don't bother interpolating // single length style so don't bother interpolating
tr.lightstylevalue[i] = ls->map[0] * 22 * scale; tr.lightstylevalue[i] = ( ls->pattern[0] - 'a' ) * 22;
continue; continue;
} }
else if( !ls->interp || !cl_lightstyle_lerping->flags ) else if( !ls->interp || !cl_lightstyle_lerping->flags )
{ {
tr.lightstylevalue[i] = ls->map[flight%ls->length] * 22 * scale; tr.lightstylevalue[i] = ( ls->pattern[flight%ls->length] - 'a' ) * 22;
continue; continue;
} }
@ -89,7 +89,7 @@ void CL_RunLightStyles( void )
k = ls->map[clight % ls->length]; k = ls->map[clight % ls->length];
l += (float)( k * 22.0f ) * lerpfrac; l += (float)( k * 22.0f ) * lerpfrac;
tr.lightstylevalue[i] = (int)l * scale; tr.lightstylevalue[i] = (int)l;
} }
} }

Loading…
Cancel
Save