From eb573bea234bb69b0b16750035de64741062472f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 21 Apr 2021 22:48:55 +0200 Subject: [PATCH] - removed all compensation for the clamped shades. None of this is needed, the shader can work with out of range shades to produce proper lighting. --- source/core/rendering/scene/hw_drawstructs.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/core/rendering/scene/hw_drawstructs.h b/source/core/rendering/scene/hw_drawstructs.h index a166cfdc3..d68fec358 100644 --- a/source/core/rendering/scene/hw_drawstructs.h +++ b/source/core/rendering/scene/hw_drawstructs.h @@ -402,15 +402,14 @@ inline void SetSpriteTranslucency(const spritetype* sprite, float& alpha, FRende extern PalEntry GlobalMapFog; extern float GlobalFogDensity; -__forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palette, int orgshade, float visibility, float alpha, bool setcolor = true) +__forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palette, int shade, float visibility, float alpha, bool setcolor = true) { // Fog must be done before the texture so that the texture selector can override it. bool foggy = (GlobalMapFog || (fade & 0xffffff)); auto ShadeDiv = lookups.tables[palette].ShadeFactor; - bool shadow = orgshade >= numshades; - int shade = clamp(orgshade, 0, numshades - 1); + bool shadow = shade >= numshades; - if (shadow) state.SetObjectColor(0xff000000); + if (shadow) state.SetObjectColor(0xff000000); // make sure that nothing lights this up again. else state.SetObjectColor(0xffffffff); // Disable brightmaps if non-black fog is used. @@ -427,7 +426,7 @@ __forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palett state.EnableFog(0); state.SetFog(0, 0); state.SetSoftLightLevel(gl_fogmode != 0 && ShadeDiv >= 1 / 1000.f ? 255 - Scale(shade, 255, numshades) : 255); - state.SetLightParms(visibility, orgshade < -numshades / 2 ? 1 / 1000.f : ShadeDiv / (numshades - 2)); + state.SetLightParms(visibility, ShadeDiv / (numshades - 2)); } // The shade rgb from the tint is ignored here.