| 203 | } |
| 204 | |
| 205 | Be::Result<std::string> Tr2Model::GetBoundingBoxInLocalSpace( std::pair<Vector3, Vector3>& result ) |
| 206 | { |
| 207 | bool bbFound = false; |
| 208 | CcpMath::AxisAlignedBox aabb; |
| 209 | for( unsigned int i = 0, count = GetNumOfMeshes(); i < count; ++i ) |
| 210 | { |
| 211 | auto meshAabb = GetMesh( i )->GetBounds(); |
| 212 | |
| 213 | if( meshAabb ) |
| 214 | { |
| 215 | bbFound = true; |
| 216 | aabb.Include( meshAabb ); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | if( !bbFound ) |
| 221 | { |
| 222 | return Be::Result<std::string>( "No meshes, or meshes aren't loaded yet." ); |
| 223 | } |
| 224 | |
| 225 | result = std::make_pair( aabb.m_min, aabb.m_max ); |
| 226 | return Be::Result<std::string>(); |
| 227 | } |