Skip to content

Commit

Permalink
- better sprite shadow control
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
coelckers committed Jul 25, 2021
1 parent bf3b3ae commit c2158da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rendering/r_utility.cpp
Expand Up @@ -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:
Expand Down

0 comments on commit c2158da

Please sign in to comment.