Merge pull request #3607 from contriteobserver/ColladaSubmeshFix

ColladaLoader now assigns individual material indices to submeshes as needed
pull/3625/head^2
Kim Kulling 2021-01-30 08:19:13 +01:00 committed by GitHub
commit 754b2ba434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -557,7 +557,12 @@ void ColladaLoader::BuildMeshesForNode(const ColladaParser &pParser, const Colla
faceStart += submesh.mNumFaces; faceStart += submesh.mNumFaces;
// assign the material index // assign the material index
dstMesh->mMaterialIndex = matIdx; std::map<std::string, size_t>::const_iterator subMatIt = mMaterialIndexByName.find(submesh.mMaterial);
if (subMatIt != mMaterialIndexByName.end()) {
dstMesh->mMaterialIndex = static_cast<unsigned int>(subMatIt->second);
} else {
dstMesh->mMaterialIndex = matIdx;
}
if (dstMesh->mName.length == 0) { if (dstMesh->mName.length == 0) {
dstMesh->mName = mid.mMeshOrController; dstMesh->mName = mid.mMeshOrController;
} }