- 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.
This commit is contained in:
Christoph Oelckers 2021-07-02 08:47:58 +02:00 committed by Emile Belanger
parent 3302a12da6
commit 58e7e5093a

View file

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