Merge pull request #4901 from AdamCichocki/JoinVerticesProcessUsedVerticesMask
Optimized usedVertexIndices in JoinVerticesProcess by using bitmask instead of unordered_setpull/4899/head^2
commit
b55e29b915
|
@ -264,12 +264,12 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
|
|||
// We should care only about used vertices, not all of them
|
||||
// (this can happen due to original file vertices buffer being used by
|
||||
// multiple meshes)
|
||||
std::unordered_set<unsigned int> usedVertexIndices;
|
||||
usedVertexIndices.reserve(pMesh->mNumVertices);
|
||||
for( unsigned int a = 0; a < pMesh->mNumFaces; a++) {
|
||||
std::vector<bool> usedVertexIndicesMask;
|
||||
usedVertexIndicesMask.resize(pMesh->mNumVertices, false);
|
||||
for (unsigned int a = 0; a < pMesh->mNumFaces; a++) {
|
||||
aiFace& face = pMesh->mFaces[a];
|
||||
for( unsigned int b = 0; b < face.mNumIndices; b++) {
|
||||
usedVertexIndices.insert(face.mIndices[b]);
|
||||
for (unsigned int b = 0; b < face.mNumIndices; b++) {
|
||||
usedVertexIndicesMask[face.mIndices[b]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
|
|||
int newIndex = 0;
|
||||
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
||||
// if the vertex is unused Do nothing
|
||||
if (usedVertexIndices.find(a) == usedVertexIndices.end()) {
|
||||
if (!usedVertexIndicesMask[a]) {
|
||||
continue;
|
||||
}
|
||||
// collect the vertex data
|
||||
|
|
Loading…
Reference in New Issue