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

Method GetIntensity

trinity/Eve/Volume/EveBoxVolume.cpp:58–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58float EveBoxVolume::GetIntensity( Vector3 position )
59{
60 Vector3 axisAlignedPosition = TransformCoord( position, m_inverseBoxTransform );
61
62 // Are we outside the outer box?
63 if( !BoundingBoxIsInside( MIN_AABB, MAX_AABB, axisAlignedPosition ) )
64 {
65 return 0.0f;
66 }
67
68 Vector3 axisAlignedInnerPosition = TransformCoord( position, m_inverseInnerBoxTransform );
69
70 // Are we inside the inner box?
71 if( BoundingBoxIsInside( MIN_AABB, MAX_AABB, axisAlignedInnerPosition ) )
72 {
73 return 1.0f;
74 }
75
76 Vector3 rayDir = Normalize( -axisAlignedPosition );
77
78 // we are somewhere in between
79 IntersectAxisAlignedBoxRay( MIN_AABB, MAX_AABB, axisAlignedPosition, rayDir, m_outerIntersection );
80 IntersectAxisAlignedBoxRay( MIN_AABB, MAX_AABB, axisAlignedInnerPosition, rayDir, m_innerIntersection );
81
82 // move the inner intersection to the outer box space
83 m_innerIntersection = TransformCoord( m_innerIntersection, m_innerBoxTransform * m_inverseBoxTransform );
84
85 return LengthSq( axisAlignedPosition - m_outerIntersection ) / LengthSq( m_innerIntersection - m_outerIntersection );
86}
87
88uint32_t EveBoxVolume::RegisterForChanges( const std::function<void()>& callBack )
89{

Callers 6

GetBoosterIntensityMethod · 0.45
UpdateAsyncronousMethod · 0.45
UpdateAsyncronousMethod · 0.45
UpdateAsyncronousMethod · 0.45
CalculateBehaviorMethod · 0.45
CalculateBehaviorMethod · 0.45

Calls 3

BoundingBoxIsInsideFunction · 0.85
LengthSqFunction · 0.85

Tested by

no test coverage detected