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

Method addBox

Engine/source/ts/tsMeshFit.cpp:401–435  ·  view source on GitHub ↗

--------------------------- Best-fit oriented bounding box

Source from the content-addressed store, hash-verified

399//---------------------------
400// Best-fit oriented bounding box
401void MeshFit::addBox( const Point3F& sides, const MatrixF& mat )
402{
403 TSMesh* mesh = initMeshFromFile( TSShapeConstructor::getCubeShapePath() );
404 if ( !mesh )
405 return;
406
407 if (mesh->mVerts.size() > 0)
408 {
409 for (S32 i = 0; i < mesh->mVerts.size(); i++)
410 {
411 Point3F v = mesh->mVerts[i];
412 v.convolve(sides);
413 mesh->mVerts[i] = v;
414 }
415
416 mesh->mVertexData.setReady(false);
417 }
418 else
419 {
420 for (S32 i = 0; i < mesh->mVertexData.size(); i++)
421 {
422 TSMesh::__TSMeshVertexBase &vdata = mesh->mVertexData.getBase(i);
423 Point3F v = vdata.vert();
424 v.convolve(sides);
425 vdata.vert(v);
426 }
427 }
428
429 mesh->computeBounds();
430
431 mMeshes.increment();
432 mMeshes.last().type = MeshFit::Box;
433 mMeshes.last().transform = mat;
434 mMeshes.last().tsmesh = mesh;
435}
436
437void MeshFit::fitOBB()
438{

Callers 4

tsMeshFit.cppFile · 0.45
_buildColShapesMethod · 0.45
_updatePhysicsMethod · 0.45
addElementMethod · 0.45

Calls 7

vertMethod · 0.80
incrementMethod · 0.80
sizeMethod · 0.45
convolveMethod · 0.45
setReadyMethod · 0.45
computeBoundsMethod · 0.45
lastMethod · 0.45

Tested by

no test coverage detected