- fbx: read node hierarchy and assign model material indices. Cache already converted materials and meshes to make FBX instancing work as intended.

This commit is contained in:
Alexander Gessler
2012-07-04 16:33:21 +02:00
parent 17629f1ff1
commit bf79c83bf2
5 changed files with 1579 additions and 1464 deletions

View File

@@ -156,8 +156,6 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
FBXImporter::LogWarn("ignoring additional geometry layers");
}
}
ResolveMaterialLinks(element,doc);
}
@@ -168,36 +166,6 @@ MeshGeometry::~MeshGeometry()
}
// ------------------------------------------------------------------------------------------------
void MeshGeometry::ResolveMaterialLinks(const Element& element, const Document& doc)
{
// resolve material
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
materials_resolved.reserve(conns.size());
BOOST_FOREACH(const Connection* con, conns) {
// material links should be Object-Object connections
if (con->PropertyName().length()) {
continue;
}
const Object* const ob = con->SourceObject();
if(!ob) {
DOMWarning("failed to read source object for material link, ignoring",&element);
continue;
}
const Material* const mat = dynamic_cast<const Material*>(ob);
if(!mat) {
DOMWarning("source object for material link is not a material, ignoring",&element);
continue;
}
materials_resolved.push_back(mat);
}
}
// ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadLayer(const Scope& layer)