Read in the texture coordinates, too.

This commit is contained in:
Andrzej Kapolka 2013-09-25 11:02:56 -07:00
parent 71ec6f75e5
commit 7ff5167bb7
2 changed files with 25 additions and 0 deletions

View file

@ -197,6 +197,16 @@ QVector<glm::vec3> createVec3Vector(const QVector<double>& doubleVector) {
return values;
}
QVector<glm::vec2> createVec2Vector(const QVector<double>& doubleVector) {
QVector<glm::vec2> values;
for (const double* it = doubleVector.constData(), *end = it + doubleVector.size(); it != end; ) {
float s = *it++;
float t = *it++;
values.append(glm::vec2(s, t));
}
return values;
}
const char* FACESHIFT_BLENDSHAPES[] = {
"EyeBlink_L",
"EyeBlink_R",
@ -300,6 +310,20 @@ FBXGeometry extractFBXGeometry(const FBXNode& node) {
normals = createVec3Vector(subdata.properties.at(0).value<QVector<double> >());
}
}
} else if (data.name == "LayerElementUV") {
QVector<glm::vec2> texCoords;
QVector<int> indices;
foreach (const FBXNode& subdata, data.children) {
if (subdata.name == "UV") {
texCoords = createVec2Vector(subdata.properties.at(0).value<QVector<double> >());
} else if (subdata.name == "UVIndex") {
indices = data.properties.at(0).value<QVector<int> >();
}
}
foreach (int index, indices) {
mesh.texCoords.append(texCoords.at(index));
}
}
}

View file

@ -46,6 +46,7 @@ public:
QVector<int> triangleIndices;
QVector<glm::vec3> vertices;
QVector<glm::vec3> normals;
QVector<glm::vec2> texCoords;
glm::vec3 pivot;