- fbx: depending on settings.readAllLayers, the loader now scans through all geometry layers and pulls in all vertex data channels that fit into the output data structure.
parent
05bc8ab684
commit
d61c86081c
|
@ -458,9 +458,10 @@ MeshGeometry::MeshGeometry(const Element& element, const std::string& name, cons
|
||||||
mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor;
|
mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(settings.readAllLayers)
|
// if settings.readAllLayers is true:
|
||||||
|
// * read all layers, try to load as many vertex channels as possible
|
||||||
// ignore all but the first layer, but warn about any further layers
|
// if settings.readAllLayers is false:
|
||||||
|
// * read only the layer with index 0, but warn about any further layers
|
||||||
for (ElementMap::const_iterator it = Layer.first; it != Layer.second; ++it) {
|
for (ElementMap::const_iterator it = Layer.first; it != Layer.second; ++it) {
|
||||||
const TokenList& tokens = (*it).second->Tokens();
|
const TokenList& tokens = (*it).second->Tokens();
|
||||||
|
|
||||||
|
@ -470,7 +471,7 @@ MeshGeometry::MeshGeometry(const Element& element, const std::string& name, cons
|
||||||
DOMError(err,&element);
|
DOMError(err,&element);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(index == 0) {
|
if(settings.readAllLayers || index == 0) {
|
||||||
const Scope& layer = GetRequiredScope(*(*it).second);
|
const Scope& layer = GetRequiredScope(*(*it).second);
|
||||||
ReadLayer(layer);
|
ReadLayer(layer);
|
||||||
}
|
}
|
||||||
|
@ -549,24 +550,44 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (type == "LayerElementMaterial") {
|
else if (type == "LayerElementMaterial") {
|
||||||
|
if (materials.size() > 0) {
|
||||||
|
FBXImporter::LogError("ignoring additional material layer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ReadVertexDataMaterials(materials,source,
|
ReadVertexDataMaterials(materials,source,
|
||||||
MappingInformationType,
|
MappingInformationType,
|
||||||
ReferenceInformationType
|
ReferenceInformationType
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (type == "LayerElementNormal") {
|
else if (type == "LayerElementNormal") {
|
||||||
|
if (normals.size() > 0) {
|
||||||
|
FBXImporter::LogError("ignoring additional normal layer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ReadVertexDataNormals(normals,source,
|
ReadVertexDataNormals(normals,source,
|
||||||
MappingInformationType,
|
MappingInformationType,
|
||||||
ReferenceInformationType
|
ReferenceInformationType
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (type == "LayerElementTangent") {
|
else if (type == "LayerElementTangent") {
|
||||||
|
if (tangents.size() > 0) {
|
||||||
|
FBXImporter::LogError("ignoring additional tangent layer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ReadVertexDataTangents(tangents,source,
|
ReadVertexDataTangents(tangents,source,
|
||||||
MappingInformationType,
|
MappingInformationType,
|
||||||
ReferenceInformationType
|
ReferenceInformationType
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (type == "LayerElementBinormal") {
|
else if (type == "LayerElementBinormal") {
|
||||||
|
if (binormals.size() > 0) {
|
||||||
|
FBXImporter::LogError("ignoring additional binormal layer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ReadVertexDataBinormals(binormals,source,
|
ReadVertexDataBinormals(binormals,source,
|
||||||
MappingInformationType,
|
MappingInformationType,
|
||||||
ReferenceInformationType
|
ReferenceInformationType
|
||||||
|
|
Loading…
Reference in New Issue