MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / computeBounds

Method computeBounds

Engine/source/ts/loader/tsShapeLoader.cpp:1236–1271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1234}
1235
1236void 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
1273TSShapeLoader::~TSShapeLoader()
1274{

Callers

nothing calls this directly

Calls 5

getNumMeshMethod · 0.80
getMeshMethod · 0.45
isValidBoxMethod · 0.45
intersectMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected