|
|
@@ -214,6 +214,8 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
void PlyExporter::WriteMeshVerts(const aiMesh* m, unsigned int components)
|
|
|
{
|
|
|
+ static const float inf = std::numeric_limits<float>::infinity();
|
|
|
+
|
|
|
// If a component (for instance normal vectors) is present in at least one mesh in the scene,
|
|
|
// then default values are written for meshes that do not contain this component.
|
|
|
for (unsigned int i = 0; i < m->mNumVertices; ++i) {
|
|
|
@@ -223,11 +225,11 @@ void PlyExporter::WriteMeshVerts(const aiMesh* m, unsigned int components)
|
|
|
m->mVertices[i].z
|
|
|
;
|
|
|
if(components & PLY_EXPORT_HAS_NORMALS) {
|
|
|
- if (m->HasNormals() && is_not_qnan(m->mNormals[i].x)) {
|
|
|
+ if (m->HasNormals() && is_not_qnan(m->mNormals[i].x) && std::absf(m->mNormals[i].x) != inf) {
|
|
|
mOutput <<
|
|
|
- " " << m->mNormals[i].x <<
|
|
|
- " " << m->mNormals[i].y <<
|
|
|
- " " << m->mNormals[i].z;
|
|
|
+ " " << m->mNormals[i].x <<
|
|
|
+ " " << m->mNormals[i].y <<
|
|
|
+ " " << m->mNormals[i].z;
|
|
|
}
|
|
|
else {
|
|
|
mOutput << " 0.0 0.0 0.0";
|