Commit 11754c5c authored by TheNumbat's avatar TheNumbat
Browse files

fix nan(ind) bug in assimp

parent faf9e4cf
......@@ -269,6 +269,12 @@ const char* fast_atoreal_move(const char* c, Real& out, bool check_comma = true)
++c;
}
if ((c[0] == 'N' || c[0] == 'n') && ASSIMP_strincmp(c, "nan(ind)", 8) == 0) {
out = std::numeric_limits<Real>::quiet_NaN();
c += 8;
return c;
}
if ((c[0] == 'N' || c[0] == 'n') && ASSIMP_strincmp(c, "nan", 3) == 0) {
out = std::numeric_limits<Real>::quiet_NaN();
c += 3;
......
......@@ -324,7 +324,6 @@ static void load_node(Scene &scobj, std::vector<std::string> &errors,
std::vector<std::vector<Halfedge_Mesh::Index>> polys;
for (unsigned int j = 0; j < mesh->mNumFaces; j++) {
const aiFace &face = mesh->mFaces[j];
std::vector<Halfedge_Mesh::Index> poly;
for (unsigned int k = 0; k < face.mNumIndices; k++) {
poly.push_back(face.mIndices[k]);
......@@ -404,12 +403,16 @@ static void load_node(Scene &scobj, std::vector<std::string> &errors,
for (unsigned int j = 0; j < mesh->mNumVertices; j++) {
const aiVector3D &vpos = mesh->mVertices[j];
const aiVector3D &vnorm = mesh->mNormals[j];
aiVector3D vnorm;
if(mesh->HasNormals()) {
vnorm = mesh->mNormals[j];
}
mesh_verts.push_back({aiVec(vpos), aiVec(vnorm), 0});
}
for (unsigned int j = 0; j < mesh->mNumFaces; j++) {
const aiFace &face = mesh->mFaces[j];
if(face.mNumIndices < 3) continue;
unsigned int start = face.mIndices[0];
for (size_t k = 1; k <= face.mNumIndices - 2; k++) {
mesh_inds.push_back(start);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment