MCPcopy Create free account
hub / github.com/carbonengine/trinity / IsCastingShadow

Method IsCastingShadow

trinity/Eve/Turret/EveTurretSet.cpp:2022–2051  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Check if the object is casting a shadow in the camera/shadow frustums --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2020// Check if the object is casting a shadow in the camera/shadow frustums
2021// --------------------------------------------------------------------------------
2022bool EveTurretSet::IsCastingShadow( const TriFrustum& cameraFrustum, const IEveShadowFrustum& shadowFrustum, Tr2RenderReason renderReason, float& sizeInShadow ) const
2023{
2024 if( !m_display || !m_geometryResource )
2025 {
2026 return false;
2027 }
2028
2029 if( renderReason == TR2RENDERREASON_REFLECTION )
2030 {
2031 return false;
2032 }
2033
2034 sizeInShadow = 0;
2035
2036 for( auto& turret : m_singleTurrets )
2037 {
2038 Vector4 transformedBoundingSphere = m_boundingSphere;
2039 // transform bounding sphere into world space to check against frustum
2040 BoundingSphereTransform( turret.worldMatrix, transformedBoundingSphere );
2041
2042 if( transformedBoundingSphere.w > 0.0f )
2043 {
2044 if( shadowFrustum.IsVisible( cameraFrustum, transformedBoundingSphere ) )
2045 {
2046 sizeInShadow = max( sizeInShadow, shadowFrustum.GetSizeInShadow( transformedBoundingSphere ) );
2047 }
2048 }
2049 }
2050 return sizeInShadow > 5.f;
2051}
2052
2053void EveTurretSet::UpdateVisibility( const EveUpdateContext& updateContext )
2054{

Calls 3

BoundingSphereTransformFunction · 0.85
IsVisibleMethod · 0.45
GetSizeInShadowMethod · 0.45

Tested by

no test coverage detected