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

Method addMeshToObject

Engine/source/ts/tsShapeEdit.cpp:692–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690}
691
692void TSShape::addMeshToObject(S32 objIndex, S32 meshIndex, TSMesh* mesh)
693{
694 TSShape::Object& obj = objects[objIndex];
695
696 // Pad with NULLs if required
697 S32 oldNumMeshes = obj.numMeshes;
698 if (mesh)
699 {
700 for (S32 i = obj.numMeshes; i < meshIndex; i++)
701 {
702 meshes.insert(obj.startMeshIndex + i, NULL);
703 obj.numMeshes++;
704 }
705 }
706
707 // Insert the new mesh
708 meshes.insert(obj.startMeshIndex + meshIndex, mesh);
709 obj.numMeshes++;
710
711 // Skinned meshes are not attached to any node
712 if (mesh && (mesh->getMeshType() == TSMesh::SkinMeshType))
713 obj.nodeIndex = -1;
714
715 // Fixup mesh indices for other objects
716 for (S32 i = 0; i < objects.size(); i++)
717 {
718 if ((i != objIndex) && (objects[i].startMeshIndex >= obj.startMeshIndex))
719 objects[i].startMeshIndex += (obj.numMeshes - oldNumMeshes);
720 }
721}
722
723void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex)
724{

Callers

nothing calls this directly

Calls 3

getMeshTypeMethod · 0.80
insertMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected