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

Method addMeshRequirements

Engine/source/ts/tsMesh.cpp:3429–3462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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