| 92 | } |
| 93 | |
| 94 | bool 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 | |
| 130 | bool Tr2Model::IsLoading() const |
| 131 | { |
no test coverage detected