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

Method addMeshRequirements

Engine/source/ts/tsMesh.cpp:3434–3467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3432}
3433
3434void TSBasicVertexFormat::addMeshRequirements(TSMesh *mesh)
3435{
3436 bool hasColors = false;
3437 bool hasTexcoord2 = false;
3438 bool hasSkin = false;
3439
3440 hasColors = mesh->getHasColor() || (colorOffset != -1);
3441 hasTexcoord2 = mesh->getHasTVert2() || (texCoordOffset != -1);
3442 hasSkin = (mesh->getMeshType() == TSMesh::SkinMeshType) || (boneOffset != -1);
3443
3444 S32 offset = sizeof(TSMesh::__TSMeshVertexBase);
3445
3446 if ((hasTexcoord2 || hasColors))
3447 {
3448 if (texCoordOffset == -1 || colorOffset == -1)
3449 {
3450 texCoordOffset = offset;
3451 colorOffset = offset + (sizeof(float) * 2);
3452 }
3453
3454 offset += sizeof(TSMesh::__TSMeshVertex_3xUVColor);
3455 }
3456
3457 if (hasSkin)
3458 {
3459 boneOffset = offset;
3460
3461 U32 numMeshBones = mesh->getMaxBonesPerVert();
3462 U32 boneBlocks = numMeshBones / 4;
3463 U32 extraBlocks = numMeshBones % 4 != 0 ? 1 : 0;
3464 U32 neededBones = boneBlocks + extraBlocks;
3465 numBones = MAX(neededBones, numBones);
3466 }
3467}
3468
3469void TSSkinMesh::printVerts()
3470{

Callers 1

initVertexFeaturesMethod · 0.80

Calls 4

getHasColorMethod · 0.80
getHasTVert2Method · 0.80
getMeshTypeMethod · 0.80
getMaxBonesPerVertMethod · 0.45

Tested by

no test coverage detected