ColladaLoader now assigns individual materials to submeshes as needed

Optional assignment of individual materials to submeshes, addresses #3606
This commit is contained in:
contriteobserver
2021-01-23 02:20:58 -08:00
parent 28c9bccbef
commit 338abded12

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;
}