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