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

Method GetBoundingBox

trinity/Tr2Model.cpp:94–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94bool Tr2Model::GetBoundingBox( Vector3& min, Vector3& max )
95{
96 // if we are still loading, then the bounding box is not yet there...
97 if( IsLoading() )
98 {
99 return false;
100 }
101
102 // if we dont have any meshes, the bounding box is invalid...
103 if( !m_meshes.size() )
104 {
105 return false;
106 }
107
108 CcpMath::AxisAlignedBox aabb;
109
110 for( Tr2MeshVector::iterator meshIt = m_meshes.begin(); meshIt != m_meshes.end(); ++meshIt )
111 {
112 Tr2Mesh* mesh = *meshIt;
113
114 auto meshAabb = mesh->GetBounds();
115
116 if( !meshAabb )
117 {
118 return false;
119 }
120
121 aabb.Include( meshAabb );
122 }
123
124 min = aabb.m_min;
125 max = aabb.m_max;
126
127 return true;
128}
129
130bool Tr2Model::IsLoading() const
131{

Callers 2

GetInstanceBoundsMethod · 0.45
GetLocalBoundingBoxMethod · 0.45

Calls 4

sizeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
GetBoundsMethod · 0.45

Tested by

no test coverage detected