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

Method createSkinBatchData

Engine/source/ts/tsMesh.cpp:1293–1430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1291}
1292
1293void TSSkinMesh::createSkinBatchData()
1294{
1295 if(batchData.initialized)
1296 return;
1297
1298 batchData.initialized = true;
1299 S32 * curVtx = vertexIndex.begin();
1300 S32 * curBone = boneIndex.begin();
1301 F32 * curWeight = weight.begin();
1302 const S32 * endVtx = vertexIndex.end();
1303
1304 AssertFatal(batchData.nodeIndex.size() <= TSShape::smMaxSkinBones, "Too many bones are here!!!");
1305
1306 // Temp vector to build batch operations
1307 Vector<BatchData::BatchedVertex> batchOperations;
1308
1309 bool issuedWeightWarning = false;
1310
1311 if (mVertexData.isReady())
1312 {
1313 batchData.initialVerts.setSize(mNumVerts);
1314 batchData.initialNorms.setSize(mNumVerts);
1315
1316 // Fill arrays
1317 for (U32 i = 0; i < mNumVerts; i++)
1318 {
1319 const __TSMeshVertexBase &cv = mVertexData.getBase(i);
1320 batchData.initialVerts[i] = cv.vert();
1321 batchData.initialNorms[i] = cv.normal();
1322 }
1323
1324 addWeightsFromVertexBuffer();
1325
1326 curVtx = vertexIndex.begin();
1327 curBone = boneIndex.begin();
1328 curWeight = weight.begin();
1329 endVtx = vertexIndex.end();
1330 }
1331 else
1332 {
1333 batchData.initialNorms = norms;
1334 batchData.initialVerts = verts;
1335 }
1336
1337 // Build the batch operations
1338 while( curVtx != endVtx )
1339 {
1340 const S32 vidx = *curVtx;
1341 ++curVtx;
1342
1343 const S32 midx = *curBone;
1344 ++curBone;
1345
1346 const F32 w = *curWeight;
1347 ++curWeight;
1348
1349 // Ignore empty weights
1350 if ( vidx < 0 || midx < 0 || w == 0 )

Callers 1

initVertexFeaturesMethod · 0.80

Calls 13

warnfFunction · 0.85
vertMethod · 0.80
normalMethod · 0.80
lastMethod · 0.80
incrementMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
isReadyMethod · 0.45
setSizeMethod · 0.45
emptyMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected