Merge branch 'kimkulling/prepare_version_5.2.6_rc1' of https://github.com/assimp/assimp into kimkulling/prepare_version_5.2.6_rc1

pull/4911/head
Kim Kulling 2023-01-31 21:55:53 +01:00
commit 61d196bc4b
1 changed files with 6 additions and 6 deletions

View File

@ -264,12 +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::unordered_set<unsigned int> usedVertexIndices; std::vector<bool> usedVertexIndicesMask;
usedVertexIndices.reserve(pMesh->mNumVertices); 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++) {
usedVertexIndices.insert(face.mIndices[b]); usedVertexIndicesMask[face.mIndices[b]] = true;
} }
} }
@ -335,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 (usedVertexIndices.find(a) == usedVertexIndices.end()) { if (!usedVertexIndicesMask[a]) {
continue; continue;
} }
// collect the vertex data // collect the vertex data