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

Method computeBounds

Engine/source/ts/assimp/assimpShapeLoader.cpp:255–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255void AssimpShapeLoader::computeBounds(Box3F& bounds)
256{
257 TSShapeLoader::computeBounds(bounds);
258
259 // Check if the model origin needs adjusting
260 bool adjustCenter = ColladaUtils::getOptions().adjustCenter;
261 bool adjustFloor = ColladaUtils::getOptions().adjustFloor;
262 if (bounds.isValidBox() && (adjustCenter || adjustFloor))
263 {
264 // Compute shape offset
265 Point3F shapeOffset = Point3F::Zero;
266 if (adjustCenter)
267 {
268 bounds.getCenter(&shapeOffset);
269 shapeOffset = -shapeOffset;
270 }
271 if (adjustFloor)
272 shapeOffset.z = -bounds.minExtents.z;
273
274 // Adjust bounds
275 bounds.minExtents += shapeOffset;
276 bounds.maxExtents += shapeOffset;
277
278 // Now adjust all positions for root level nodes (nodes with no parent)
279 for (S32 iNode = 0; iNode < shape->nodes.size(); iNode++)
280 {
281 if (!appNodes[iNode]->isParentRoot())
282 continue;
283
284 // Adjust default translation
285 shape->defaultTranslations[iNode] += shapeOffset;
286
287 // Adjust animated translations
288 for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++)
289 {
290 const TSShape::Sequence& seq = shape->sequences[iSeq];
291 if (seq.translationMatters.test(iNode))
292 {
293 for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
294 {
295 S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame;
296 shape->nodeTranslations[index] += shapeOffset;
297 }
298 }
299 }
300 }
301 }
302}
303
304bool AssimpShapeLoader::fillGuiTreeView(const char* sourceShapePath, GuiTreeViewCtrl* tree)
305{

Callers

nothing calls this directly

Calls 6

isValidBoxMethod · 0.45
getCenterMethod · 0.45
sizeMethod · 0.45
isParentRootMethod · 0.45
testMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected