Showing the changes to libraries/render-utils/src/Model.cpp (1 of 5 files). Show all
Unified · Split
| @@ -756,7 +756,16 @@ scriptable::ScriptableModelBase Model::getScriptableModel() { · 755 unmodified lines | ||
| 756 | 756 | |
| 757 | 757 | int numParts = (int)mesh->getNumParts(); |
| 758 | 758 | for (int partIndex = 0; partIndex < numParts; partIndex++) { |
| 759 | − result.appendMaterial(graphics::MaterialLayer(getGeometry()->getShapeMaterial(shapeID), 0), shapeID, _modelMeshMaterialNames[shapeID]); | |
| 759 | + auto& materialName = _modelMeshMaterialNames[shapeID]; | |
| 760 | + result.appendMaterial(graphics::MaterialLayer(getGeometry()->getShapeMaterial(shapeID), 0), shapeID, materialName); | |
| 761 | + | |
| 762 | + auto mappedMaterialIter = _materialMapping.find(shapeID); | |
| 763 | + if (mappedMaterialIter != _materialMapping.end()) { | |
| 764 | + auto mappedMaterials = mappedMaterialIter->second; | |
| 765 | + for (auto& mappedMaterial : mappedMaterials) { | |
| 766 | + result.appendMaterial(mappedMaterial, shapeID, materialName); | |
| 767 | + } | |
| 768 | + } | |
| 760 | 769 | shapeID++; |
| 761 | 770 | } |
| 762 | 771 | } |
| @@ -1546,6 +1555,7 @@ void Model::applyMaterialMapping() { · 783 unmodified lines | ||
| 1546 | 1555 | auto meshIndex = _modelMeshRenderItemShapes[shapeID].meshIndex; |
| 1547 | 1556 | bool invalidatePayloadShapeKey = shouldInvalidatePayloadShapeKey(meshIndex); |
| 1548 | 1557 | graphics::MaterialLayer material = graphics::MaterialLayer(networkMaterial, ++_priorityMap[shapeID]); |
| 1558 | + _materialMapping[shapeID].push_back(material); | |
| 1549 | 1559 | transaction.updateItem<ModelMeshPartPayload>(itemID, [material, renderItemsKey, |
| 1550 | 1560 | invalidatePayloadShapeKey, primitiveMode, useDualQuaternionSkinning](ModelMeshPartPayload& data) { |
| 1551 | 1561 | data.addMaterial(material); |