| 3427 | } |
| 3428 | |
| 3429 | void 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 | |
| 3464 | void TSSkinMesh::printVerts() |
| 3465 | { |
no test coverage detected