usedVertexIndicesMask is now based on vector<boo> instead of vector<uint>

pull/4901/head
AdamCichocki 2023-01-23 16:39:06 +01:00
parent 72b178b9fc
commit 5ed09b7ab6
1 changed files with 4 additions and 5 deletions

View File

@ -264,13 +264,12 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
// We should care only about used vertices, not all of them // We should care only about used vertices, not all of them
// (this can happen due to original file vertices buffer being used by // (this can happen due to original file vertices buffer being used by
// multiple meshes) // multiple meshes)
std::vector<unsigned int> usedVertexIndicesMask; std::vector<bool> usedVertexIndicesMask;
usedVertexIndicesMask.resize((pMesh->mNumVertices + 31) / 32, 0); usedVertexIndicesMask.resize(pMesh->mNumVertices, false);
for (unsigned int a = 0; a < pMesh->mNumFaces; a++) { for (unsigned int a = 0; a < pMesh->mNumFaces; a++) {
aiFace& face = pMesh->mFaces[a]; aiFace& face = pMesh->mFaces[a];
for (unsigned int b = 0; b < face.mNumIndices; b++) { for (unsigned int b = 0; b < face.mNumIndices; b++) {
const unsigned int currIndex = face.mIndices[b]; usedVertexIndicesMask[face.mIndices[b]] = true;
usedVertexIndicesMask[currIndex / 32] |= 1u << (currIndex % 32);
} }
} }
@ -336,7 +335,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
int newIndex = 0; int newIndex = 0;
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) { for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
// if the vertex is unused Do nothing // if the vertex is unused Do nothing
if (0 == (usedVertexIndicesMask[a / 32] & (1u << (a % 32)))) { if (!usedVertexIndicesMask[a]) {
continue; continue;
} }
// collect the vertex data // collect the vertex data