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

Method CalculateAABB

trinity/Tr2ShadowMap.cpp:120–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120AxisAlignedBoundingBox Tr2ShadowMap::CalculateAABB( Matrix projection, Matrix invViewTransform, Matrix lightView, Vector3 ( &corners )[8] )
121{
122 AxisAlignedBoundingBox aabb;
123 for( unsigned int i = 0; i < 8; ++i )
124 {
125 Vector3 vertex = DX_UNIT_CUBE[i];
126 // view space
127 Vector4 transformedVertex = Transform( Vector4( vertex, 1.0 ), Inverse( projection ) );
128
129 transformedVertex /= transformedVertex.w;
130
131 // world space
132 transformedVertex = Transform( transformedVertex, invViewTransform );
133 corners[i] = TransformCoord( transformedVertex.GetXYZ(), ( lightView ) );
134 // light view space
135 aabb.IncludePoint( TransformCoord( transformedVertex.GetXYZ(), ( lightView ) ) );
136 }
137 return aabb;
138}
139// --------------------------------------------------------------------------------
140// Description:
141// Go through all i count of frustum splits. Calculate the corresponding

Callers

nothing calls this directly

Calls 1

Vector4Class · 0.50

Tested by

no test coverage detected