| 3432 | } |
| 3433 | |
| 3434 | void 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 | |
| 3469 | void TSSkinMesh::printVerts() |
| 3470 | { |
no test coverage detected