From e4c63563e3c8ca562a26f0856b85769d1ce5c4e3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 1 Jan 2017 00:16:00 +0100 Subject: [PATCH] - 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. --- src/gl/renderer/gl_colormap.h | 1 + src/gl/scene/gl_sprite.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gl/renderer/gl_colormap.h b/src/gl/renderer/gl_colormap.h index 37a7629708..8bee402c9e 100644 --- a/src/gl/renderer/gl_colormap.h +++ b/src/gl/renderer/gl_colormap.h @@ -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; diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 4479cb3ebf..102337eccc 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -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(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) {