ColladaLoader now assigns individual materials to submeshes as needed

Optional assignment of individual materials to submeshes, addresses #3606
pull/3607/head
contriteobserver 2021-01-23 02:20:58 -08:00
parent 28c9bccbef
commit 338abded12
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;
// assign the material index
dstMesh->mMaterialIndex = matIdx;
std::map<std::string, size_t>::const_iterator matIt = mMaterialIndexByName.find(submesh.mMaterial);
if (matIt != mMaterialIndexByName.end()) {
dstMesh->mMaterialIndex = matIt->second;
} else {
dstMesh->mMaterialIndex = matIdx;
}
if (dstMesh->mName.length == 0) {
dstMesh->mName = mid.mMeshOrController;
}