diff --git a/thirdparty/nodemesh/nodemesh/combiner.cpp b/thirdparty/nodemesh/nodemesh/combiner.cpp index dff8883b..7b70a5e8 100644 --- a/thirdparty/nodemesh/nodemesh/combiner.cpp +++ b/thirdparty/nodemesh/nodemesh/combiner.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -17,28 +18,34 @@ Combiner::Mesh::Mesh(const std::vector &vertices, const std::vector> triangles; - triangulate(vertices, faces, triangles); - cgalMesh = buildCgalMesh(vertices, triangles); + cgalMesh = buildCgalMesh(vertices, faces); if (!CGAL::is_valid_polygon_mesh(*cgalMesh)) { - //qDebug() << "Mesh is not valid polygon"; + qDebug() << "Mesh is not valid polygon"; delete cgalMesh; cgalMesh = nullptr; - } else if (CGAL::Polygon_mesh_processing::does_self_intersect(*cgalMesh)) { - //nodemesh::exportMeshAsObj(vertices, triangles, "/Users/jeremy/Desktop/test.obj"); - m_isSelfIntersected = true; - if (removeSelfIntersects) { - if (!CGAL::Polygon_mesh_processing::remove_self_intersections(*cgalMesh)) { - //qDebug() << "Mesh does self intersect and cann't remove intersections"; - delete cgalMesh; - cgalMesh = nullptr; - } else { - //qDebug() << "Mesh does self intersect but intersections got removed"; + } else { + if (CGAL::Polygon_mesh_processing::triangulate_faces(*cgalMesh)) { + if (CGAL::Polygon_mesh_processing::does_self_intersect(*cgalMesh)) { + //nodemesh::exportMeshAsObj(vertices, triangles, "/Users/jeremy/Desktop/test.obj"); + m_isSelfIntersected = true; + if (removeSelfIntersects) { + if (!CGAL::Polygon_mesh_processing::remove_self_intersections(*cgalMesh)) { + //qDebug() << "Mesh does self intersect and cann't remove intersections"; + delete cgalMesh; + cgalMesh = nullptr; + } else { + //qDebug() << "Mesh does self intersect but intersections got removed"; + } + } else { + delete cgalMesh; + cgalMesh = nullptr; + //qDebug() << "Mesh does self intersect"; + } } } else { + qDebug() << "Mesh triangulate failed"; delete cgalMesh; cgalMesh = nullptr; - //qDebug() << "Mesh does self intersect"; } } } diff --git a/thirdparty/simpleuv/simpleuv/chartpacker.h b/thirdparty/simpleuv/simpleuv/chartpacker.h index 86fb95df..732a86e2 100644 --- a/thirdparty/simpleuv/simpleuv/chartpacker.h +++ b/thirdparty/simpleuv/simpleuv/chartpacker.h @@ -24,7 +24,7 @@ private: float m_floatToIntFactor = 10000; size_t m_tryNum = 0; float m_textureSizeFactor = 1.0; - size_t m_maxTryNum = 10000; + size_t m_maxTryNum = 100; }; }