- fixed: The 3D floor light splitting code for sprites did not copy the sector's fog density.

- fixed: fog calculations for fuzz effects were wrong.
This commit is contained in:
Christoph Oelckers 2017-01-01 00:16:00 +01:00
parent 6b943043d1
commit e4c63563e3
2 changed files with 4 additions and 3 deletions

View File

@ -56,6 +56,7 @@ struct FColormap
LightColor = from->Color;
desaturation = from->Desaturate;
FadeColor = from->Fade;
FadeColor.a = 0;
blendfactor = from->Color.a;
fogdensity = from->Fade.a*2;
return * this;

View File

@ -296,11 +296,10 @@ void GLSprite::Draw(int pass)
if (!gl_isBlack(Colormap.FadeColor))
{
float dist=Dist2(ViewPos.X, ViewPos.Y, x,y);
if (!Colormap.FadeColor.a) Colormap.FadeColor.a=clamp<int>(255-lightlevel,60,255);
int fogd = gl_GetFogDensity(lightlevel, Colormap.FadeColor, Colormap.fogdensity);
// this value was determined by trial and error and is scale dependent!
float factor=0.05f+exp(-Colormap.FadeColor.a*dist/62500.f);
float factor = 0.05f + exp(-fogd*dist / 62500.f);
fuzzalpha*=factor;
minalpha*=factor;
}
@ -387,6 +386,7 @@ void GLSprite::Draw(int pass)
FColormap thiscm;
thiscm.FadeColor = Colormap.FadeColor;
thiscm.fogdensity = Colormap.fogdensity;
thiscm.CopyFrom3DLight(&(*lightlist)[i]);
if (glset.nocoloredspritelighting)
{