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

Method IsCastingShadow

trinity/Eve/SpaceObject/EveSpaceObject2.cpp:1940–1961  ·  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

1938// Check if the object is casting a shadow in the camera/shadow frustums
1939// --------------------------------------------------------------------------------
1940bool EveSpaceObject2::IsCastingShadow( const TriFrustum& cameraFrustum, const IEveShadowFrustum& shadowFrustum, Tr2RenderReason renderReason, float& sizeInShadow ) const
1941{
1942 if( !m_display || m_boundingSphereWorldRadius <= 0.0 )
1943 {
1944 return false;
1945 }
1946
1947 if( renderReason == TR2RENDERREASON_REFLECTION && !EntityComponents::ShouldReflect( m_reflectionMode ) )
1948 {
1949 return false;
1950 }
1951
1952 Vector4 bs = Vector4( m_boundingSphereWorldCenter, m_boundingSphereWorldRadius );
1953
1954 sizeInShadow = 0;
1955
1956 if( shadowFrustum.IsVisible( cameraFrustum, bs ) )
1957 {
1958 sizeInShadow = shadowFrustum.GetSizeInShadow( bs );
1959 }
1960 return sizeInShadow > 15.f;
1961}
1962
1963void EveSpaceObject2::SetMesh( Tr2MeshBase* mesh )
1964{

Callers

nothing calls this directly

Calls 4

ShouldReflectFunction · 0.85
Vector4Class · 0.50
IsVisibleMethod · 0.45
GetSizeInShadowMethod · 0.45

Tested by

no test coverage detected