From 532f64464a0e3e850450afbda63bea0f902d54ac Mon Sep 17 00:00:00 2001 From: Max Limper Date: Wed, 6 Apr 2016 17:28:41 +0200 Subject: [PATCH 1/2] Not collecting failed faces but directly processing them --- src/OpenMesh/Core/IO/importer/ImporterT.hh | 83 +++++++++------------- 1 file changed, 33 insertions(+), 50 deletions(-) diff --git a/src/OpenMesh/Core/IO/importer/ImporterT.hh b/src/OpenMesh/Core/IO/importer/ImporterT.hh index aed9a909..5657e42f 100644 --- a/src/OpenMesh/Core/IO/importer/ImporterT.hh +++ b/src/OpenMesh/Core/IO/importer/ImporterT.hh @@ -131,17 +131,45 @@ public: if (*it == *it2) { omerr() << "ImporterT: Face has equal vertices\n"; - failed_faces_.push_back(_indices); return fh; } // try to add face fh = mesh_.add_face(_indices); + // separate non-manifold faces and mark them if (!fh.is_valid()) { - failed_faces_.push_back(_indices); - return fh; + VHandles vhandles(_indices.size()); + + // double vertices + for (unsigned int j=0; j<_indices.size(); ++j) + { + // DO STORE p, reference may not work since vertex array + // may be relocated after adding a new vertex ! + Point p = mesh_.point(_indices[j]); + vhandles[j] = mesh_.add_vertex(p); + + // Mark vertices of failed face as non-manifold + if (mesh_.has_vertex_status()) { + mesh_.status(vhandles[j]).set_fixed_nonmanifold(true); + } + } + + // add face + FaceHandle fh = mesh_.add_face(vhandles); + + // Mark failed face as non-manifold + if (mesh_.has_face_status()) + mesh_.status(fh).set_fixed_nonmanifold(true); + + // Mark edges of failed face as non-two-manifold + if (mesh_.has_edge_status()) { + typename Mesh::FaceEdgeIter fe_it = mesh_.fe_iter(fh); + for(; fe_it.is_valid(); ++fe_it) { + mesh_.status(*fe_it).set_fixed_nonmanifold(true); + } + } } //write the half edge normals @@ -358,60 +386,15 @@ public: size_t n_edges() const { return mesh_.n_edges(); } - void prepare() { failed_faces_.clear(); } + void prepare() { } - void finish() - { - if (!failed_faces_.empty()) - { - omerr() << failed_faces_.size() - << " faces failed, adding them as isolated faces\n"; - - for (unsigned int i=0; i failed_faces_; // stores normals for halfedges of the next face std::map halfedgeNormals_; }; From 4918d2f3539571ea58029669363d3fbfa88419ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 14 Apr 2016 10:36:10 +0200 Subject: [PATCH 2/2] Updated changelog --- Doc/changelog.docu | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 91c1aca7..4039580a 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -17,6 +17,7 @@ IO
  • Obj reader: added texCoord3d functions to objloader
  • +
  • Importer: Integrate non-manifold faces while importing and not at the end. Fixes missing properties on non-manifolds. (Thanks to Max Limper for the patch, Merge Request 51)
VectorT