Browse Source

ref_soft: Restore lightmap gamma calculation

pull/2/head
mittorn 6 years ago
parent
commit
c52d4b7998
  1. 2
      r_light.c
  2. 8
      r_main.c
  3. 8
      r_surf.c

2
r_light.c

@ -344,7 +344,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, @@ -344,7 +344,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
{
uint scale = tr.lightstylevalue[surf->styles[map]];
if( 1 ) //tr.ignore_lightgamma )
if( tr.ignore_lightgamma )
{
cv->r += lm->r * scale * 2.5; // scale;
cv->g += lm->g * scale * 2.5; // scale;

8
r_main.c

@ -1734,16 +1734,18 @@ void R_BeginFrame( qboolean clearScene ) @@ -1734,16 +1734,18 @@ void R_BeginFrame( qboolean clearScene )
// glConfig.softwareGammaUpdate = true;
// GL_RebuildLightmaps();
// glConfig.softwareGammaUpdate = false;
D_FlushCaches( false );
// next frame will be restored gamma
// SetBits( vid_brightness->flags, FCVAR_CHANGED );
// SetBits( vid_gamma->flags, FCVAR_CHANGED );
SetBits( vid_brightness->flags, FCVAR_CHANGED );
SetBits( vid_gamma->flags, FCVAR_CHANGED );
}
else if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED ))
{
// gEngfuncs.BuildGammaTable( vid_gamma->value, vid_brightness->value );
gEngfuncs.BuildGammaTable( vid_gamma->value, vid_brightness->value );
//glConfig.softwareGammaUpdate = true;
// GL_RebuildLightmaps();
D_FlushCaches( false );
//glConfig.softwareGammaUpdate = false;
}

8
r_surf.c

@ -149,7 +149,7 @@ void R_AddDynamicLights( msurface_t *surf ) @@ -149,7 +149,7 @@ void R_AddDynamicLights( msurface_t *surf )
{
//printf("dlight %f\n", dist);
//*(void**)0 = 0;
bl[0] += ((int)((rad - dist) * 256) * 7.5);
bl[0] += ((int)((rad - dist) * 256) * gEngfuncs.LightToTexGamma( (dl->color.r + dl->color.g + dl->color.b ) / 3) * 3) / 256;
//bl[1] += ((int)((rad - dist) * 256) * 2.5) / 256;
//bl[2] += ((int)((rad - dist) * 256) * 2.5) / 256;
}
@ -206,9 +206,9 @@ static void R_BuildLightMap( ) @@ -206,9 +206,9 @@ static void R_BuildLightMap( )
for( i = 0, bl = blocklights; i < size; i++, bl += 1, lm++ )
{
bl[0] += lm->r * scale * 2.5;
bl[0] += lm->g * scale * 2.5;
bl[0] += lm->b * scale * 2.5;
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;

Loading…
Cancel
Save