fix regression in join vertices post process.

pull/4940/head
sunjc 2023-02-07 20:05:39 +08:00
parent 487c03f547
commit 647f1e47fa
1 changed files with 3 additions and 11 deletions

View File

@ -357,7 +357,8 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
} }
} else{ } else{
// if the vertex is already there just find the replace index that is appropriate to it // if the vertex is already there just find the replace index that is appropriate to it
replaceIndex[a] = it->second; // mark it with '0x80000000'
replaceIndex[a] = it->second | 0x80000000;
} }
} }
@ -400,17 +401,8 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
for ( unsigned int b = 0; b < bone->mNumWeights; b++ ) { for ( unsigned int b = 0; b < bone->mNumWeights; b++ ) {
const aiVertexWeight& ow = bone->mWeights[ b ]; const aiVertexWeight& ow = bone->mWeights[ b ];
// if the vertex is a unique one, translate it // if the vertex is a unique one, translate it
// filter out joined vertices by mrak.
if ( !( replaceIndex[ ow.mVertexId ] & 0x80000000 ) ) { if ( !( replaceIndex[ ow.mVertexId ] & 0x80000000 ) ) {
bool weightAlreadyExists = false;
for (std::vector<aiVertexWeight>::iterator vit = newWeights.begin(); vit != newWeights.end(); ++vit) {
if (vit->mVertexId == replaceIndex[ow.mVertexId]) {
weightAlreadyExists = true;
break;
}
}
if (weightAlreadyExists) {
continue;
}
aiVertexWeight nw; aiVertexWeight nw;
nw.mVertexId = replaceIndex[ ow.mVertexId ]; nw.mVertexId = replaceIndex[ ow.mVertexId ];
nw.mWeight = ow.mWeight; nw.mWeight = ow.mWeight;