ref_soft: Restore lightmap gamma calculation

This commit is contained in:
mittorn 2019-03-30 21:16:14 +07:00
parent 0c62967d8a
commit c52d4b7998
3 changed files with 10 additions and 8 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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( )
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;