From 8547a55677be0d418bd2ec6f63ac4de763b47509 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 2 Jul 2021 08:47:58 +0200 Subject: [PATCH] - better sprite shadow control * exclude sprites which are not either opaque or use regular blended translucency from casting shadows. * exclude wall and flat sprites from casting shadows. In both of these cases the shadow math is unable to produce anything useful that doesn't look off. --- src/rendering/r_utility.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rendering/r_utility.cpp b/src/rendering/r_utility.cpp index 105cc06d3..fc910c279 100644 --- a/src/rendering/r_utility.cpp +++ b/src/rendering/r_utility.cpp @@ -1075,6 +1075,13 @@ CUSTOM_CVAR(Float, maxviewpitch, 90.f, CVAR_ARCHIVE | CVAR_SERVERINFO) bool R_ShouldDrawSpriteShadow(AActor *thing) { + auto rs = thing->RenderStyle; + rs.CheckFuzz(); + // For non-standard render styles, draw no shadows. This will always look weird. + if (rs.BlendOp != STYLEOP_Add && rs.BlendOp != STYLEOP_Shadow) return false; + if (rs.DestAlpha != STYLEALPHA_Zero && rs.DestAlpha != STYLEALPHA_InvSrc) return false; + if (thing->renderflags & (RF_FLATSPRITE | RF_WALLSPRITE)) return false; // for wall and flat sprites the shadow math does not work. + switch (r_actorspriteshadow) { case 1: