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

Method setupVertexTransforms

Engine/source/ts/tsMesh.cpp:1437–1501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1435}
1436
1437void TSSkinMesh::setupVertexTransforms()
1438{
1439 AssertFatal(mVertexData.vertSize() == mVertSize, "vert size mismatch");
1440
1441 // Generate the bone transforms for the verts
1442 for( Vector<BatchData::BatchedVertex>::const_iterator itr = batchData.vertexBatchOperations.begin();
1443 itr != batchData.vertexBatchOperations.end(); itr++ )
1444 {
1445 const BatchData::BatchedVertex &curTransform = *itr;
1446 S32 i=0;
1447 S32 j=0;
1448 S32 transformsLeft = curTransform.transformCount;
1449
1450 // Set weights and indices in batches of 4
1451 for( i = 0, j = 0; i < curTransform.transformCount; i += 4, j += 1 )
1452 {
1453 __TSMeshVertex_BoneData &v = mVertexData.getBone(curTransform.vertexIndex, j);
1454 S32 vertsSet = transformsLeft > 4 ? 4 : transformsLeft;
1455
1456 __TSMeshIndex_List indices;
1457 Point4F weights;
1458 dMemset(&indices, '\0', sizeof(indices));
1459 dMemset(&weights, '\0', sizeof(weights));
1460
1461 switch (vertsSet)
1462 {
1463 case 1:
1464 indices.x = curTransform.transform[i+0].transformIndex;
1465 weights.x = curTransform.transform[i+0].weight;
1466 break;
1467 case 2:
1468 indices.x = curTransform.transform[i+0].transformIndex;
1469 weights.x = curTransform.transform[i+0].weight;
1470 indices.y = curTransform.transform[i+1].transformIndex;
1471 weights.y = curTransform.transform[i+1].weight;
1472 break;
1473 case 3:
1474 indices.x = curTransform.transform[i+0].transformIndex;
1475 weights.x = curTransform.transform[i+0].weight;
1476 indices.y = curTransform.transform[i+1].transformIndex;
1477 weights.y = curTransform.transform[i+1].weight;
1478 indices.z = curTransform.transform[i+2].transformIndex;
1479 weights.z = curTransform.transform[i+2].weight;
1480 break;
1481 case 4:
1482 indices.x = curTransform.transform[i+0].transformIndex;
1483 weights.x = curTransform.transform[i+0].weight;
1484 indices.y = curTransform.transform[i+1].transformIndex;
1485 weights.y = curTransform.transform[i+1].weight;
1486 indices.z = curTransform.transform[i+2].transformIndex;
1487 weights.z = curTransform.transform[i+2].weight;
1488 indices.w = curTransform.transform[i+3].transformIndex;
1489 weights.w = curTransform.transform[i+3].weight;
1490 break;
1491 case 0:
1492 default:
1493 break;
1494 }

Callers

nothing calls this directly

Calls 6

vertSizeMethod · 0.80
weightMethod · 0.80
dMemsetFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected