Add a hack to fix normals on Makehuman exports.

This commit is contained in:
Andrzej Kapolka 2014-05-02 17:46:11 -07:00
parent b458cd1297
commit c08dfc90c3

View file

@ -760,6 +760,7 @@ ExtractedMesh extractMesh(const FBXNode& object) {
} else if (child.name == "LayerElementNormal") {
data.normalsByVertex = false;
bool indexToDirect = false;
foreach (const FBXNode& subdata, child.children) {
if (subdata.name == "Normals") {
data.normals = createVec3Vector(getDoubleVector(subdata));
@ -767,11 +768,17 @@ ExtractedMesh extractMesh(const FBXNode& object) {
} else if (subdata.name == "NormalsIndex") {
data.normalIndices = getIntVector(subdata);
} else if (subdata.name == "MappingInformationType" &&
subdata.properties.at(0) == "ByVertice") {
} else if (subdata.name == "MappingInformationType" && subdata.properties.at(0) == "ByVertice") {
data.normalsByVertex = true;
} else if (subdata.name == "ReferenceInformationType" && subdata.properties.at(0) == "IndexToDirect") {
indexToDirect = true;
}
}
if (indexToDirect && data.normalIndices.isEmpty()) {
// hack to work around wacky Makehuman exports
data.normalsByVertex = true;
}
} else if (child.name == "LayerElementUV" && child.properties.at(0).toInt() == 0) {
foreach (const FBXNode& subdata, child.children) {
if (subdata.name == "UV") {