Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/game/client/clientshadowmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,31 @@ void CClientShadowMgr::ComputeExtraClipPlanes( IClientRenderable* pRenderable,
}
}

class CTraceFilterShadowReceiversOnly : public CTraceFilter
{
virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int fContentsMask )
{
if ( !StandardFilterRules( pHandleEntity, fContentsMask ) )
return false;

C_BaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );
if ( pEntity && !pEntity->ShouldReceiveProjectedTextures( SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK ) )
return false;

return true;
}
};

// Do a trace to the bbox corner origin. If it hits a shadow receiving brush
// move the corner to be outside it so shadows won't poke-thru thin walls
CTraceFilterShadowReceiversOnly traceFilter;
trace_t tr;
UTIL_TraceLine( pRenderable->GetRenderOrigin(), origin, MASK_SOLID_BRUSHONLY, &traceFilter, &tr );
if ( tr.fraction < 1.f )
{
VectorAdd( tr.endpos, tr.plane.normal, origin );
}

// Now that we have it, create 3 planes...
Vector normal;
ClearExtraClipPlanes(handle);
Expand Down