Merge pull request #4339 from Esri/jere9309/read_collada_materials

Collada: Read all instance_material child nodes
pull/4346/head
Kim Kulling 2022-01-18 20:28:39 +01:00 committed by GitHub
commit 141c6ca270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 13 deletions

View File

@ -2251,20 +2251,26 @@ void ColladaParser::ReadNodeGeometry(XmlNode &node, Node *pNode) {
if (currentName == "bind_material") { if (currentName == "bind_material") {
XmlNode techNode = currentNode.child("technique_common"); XmlNode techNode = currentNode.child("technique_common");
if (techNode) { if (techNode) {
XmlNode instanceMatNode = techNode.child("instance_material"); for (XmlNode instanceMatNode = techNode.child("instance_material"); instanceMatNode; instanceMatNode = instanceMatNode.next_sibling())
// read ID of the geometry subgroup and the target material {
std::string group; const std::string &instance_name = instanceMatNode.name();
XmlParser::getStdStrAttribute(instanceMatNode, "symbol", group); if (instance_name == "instance_material")
XmlParser::getStdStrAttribute(instanceMatNode, "target", url); {
const char *urlMat = url.c_str(); // read ID of the geometry subgroup and the target material
Collada::SemanticMappingTable s; std::string group;
if (urlMat[0] == '#') XmlParser::getStdStrAttribute(instanceMatNode, "symbol", group);
urlMat++; XmlParser::getStdStrAttribute(instanceMatNode, "target", url);
const char *urlMat = url.c_str();
Collada::SemanticMappingTable s;
if (urlMat[0] == '#')
urlMat++;
s.mMatName = urlMat; s.mMatName = urlMat;
// store the association // store the association
instance.mMaterials[group] = s; instance.mMaterials[group] = s;
ReadMaterialVertexInputBinding(instanceMatNode, s); ReadMaterialVertexInputBinding(instanceMatNode, s);
}
}
} }
} }
} }