| 1234 | } |
| 1235 | |
| 1236 | void TSShapeLoader::computeBounds(Box3F& bounds) |
| 1237 | { |
| 1238 | // Compute the box that encloses the model geometry |
| 1239 | bounds = Box3F::Invalid; |
| 1240 | |
| 1241 | // Use bounds node geometry if present |
| 1242 | if ( boundsNode && boundsNode->getNumMesh() ) |
| 1243 | { |
| 1244 | for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) |
| 1245 | { |
| 1246 | AppMesh* mesh = boundsNode->getMesh( iMesh ); |
| 1247 | if ( !mesh ) |
| 1248 | continue; |
| 1249 | |
| 1250 | Box3F meshBounds; |
| 1251 | mesh->computeBounds( meshBounds ); |
| 1252 | if ( meshBounds.isValidBox() ) |
| 1253 | bounds.intersect( meshBounds ); |
| 1254 | } |
| 1255 | } |
| 1256 | else |
| 1257 | { |
| 1258 | // Compute bounds based on all geometry in the model |
| 1259 | for (S32 iMesh = 0; iMesh < appMeshes.size(); iMesh++) |
| 1260 | { |
| 1261 | AppMesh* mesh = appMeshes[iMesh]; |
| 1262 | if ( !mesh ) |
| 1263 | continue; |
| 1264 | |
| 1265 | Box3F meshBounds; |
| 1266 | mesh->computeBounds( meshBounds ); |
| 1267 | if ( meshBounds.isValidBox() ) |
| 1268 | bounds.intersect( meshBounds ); |
| 1269 | } |
| 1270 | } |
| 1271 | } |
| 1272 | |
| 1273 | TSShapeLoader::~TSShapeLoader() |
| 1274 | { |
nothing calls this directly
no test coverage detected