From f4046e4d5877375578d30fb10eaf0c121f378bb7 Mon Sep 17 00:00:00 2001 From: Janis Born Date: Thu, 17 Dec 2015 14:31:42 +0100 Subject: [PATCH 01/17] fix some uses of const begin and end iterators --- src/OpenMesh/Core/Geometry/Vector11T.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenMesh/Core/Geometry/Vector11T.hh b/src/OpenMesh/Core/Geometry/Vector11T.hh index acd0e11a..88464e67 100644 --- a/src/OpenMesh/Core/Geometry/Vector11T.hh +++ b/src/OpenMesh/Core/Geometry/Vector11T.hh @@ -473,7 +473,7 @@ class VectorT { /// compute L1 (Manhattan) norm Scalar l1_norm() const { return std::accumulate( - values_.cbegin() + 1, values_.end(), values_[0]); + values_.cbegin() + 1, values_.cend(), values_[0]); } /// compute l8_norm @@ -523,7 +523,7 @@ class VectorT { /// return absolute arithmetic mean Scalar mean_abs() const { - return std::accumulate(values_.cbegin() + 1, values_.end(), + return std::accumulate(values_.cbegin() + 1, values_.cend(), std::abs(values_[0]), [](const Scalar &l, const Scalar &r) { return l + std::abs(r); From 781063a3c66ac1727dca9c44725231d348b6f058 Mon Sep 17 00:00:00 2001 From: Martin Schultz Date: Tue, 5 Jan 2016 14:21:46 +0100 Subject: [PATCH 02/17] * added texCoord3d functions to objloader * added unittest for texcoords3d * added texcoord3d support to baseimporter --- src/OpenMesh/Core/IO/importer/BaseImporter.hh | 9 ++++ src/OpenMesh/Core/IO/importer/ImporterT.hh | 31 +++++++++++++ src/OpenMesh/Core/IO/reader/OBJReader.cc | 29 +++++++++--- .../TestFiles/cube-minimal-texCoords3d.obj | 39 ++++++++++++++++ src/Unittests/unittests_read_write_OBJ.cc | 45 +++++++++++++++++++ 5 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 src/Unittests/TestFiles/cube-minimal-texCoords3d.obj diff --git a/src/OpenMesh/Core/IO/importer/BaseImporter.hh b/src/OpenMesh/Core/IO/importer/BaseImporter.hh index 300accfc..afcfd6ca 100644 --- a/src/OpenMesh/Core/IO/importer/BaseImporter.hh +++ b/src/OpenMesh/Core/IO/importer/BaseImporter.hh @@ -106,6 +106,9 @@ public: // add texture coordinates per face, _vh references the first texcoord virtual void add_face_texcoords( FaceHandle _fh, VertexHandle _vh, const std::vector& _face_texcoords) = 0; + // add texture 3d coordinates per face, _vh references the first texcoord + virtual void add_face_texcoords( FaceHandle _fh, VertexHandle _vh, const std::vector& _face_texcoords) = 0; + // Set the texture index for a face virtual void set_face_texindex( FaceHandle _fh, int _texId ) = 0; @@ -133,6 +136,12 @@ public: // set vertex texture coordinate virtual void set_texcoord(HalfedgeHandle _heh, const Vec2f& _texcoord) = 0; + // set 3d vertex texture coordinate + virtual void set_texcoord(VertexHandle _vh, const Vec3f& _texcoord) = 0; + + // set 3d vertex texture coordinate + virtual void set_texcoord(HalfedgeHandle _heh, const Vec3f& _texcoord) = 0; + // set edge color virtual void set_color(EdgeHandle _eh, const Vec3uc& _color) = 0; diff --git a/src/OpenMesh/Core/IO/importer/ImporterT.hh b/src/OpenMesh/Core/IO/importer/ImporterT.hh index f3c1f655..aed9a909 100644 --- a/src/OpenMesh/Core/IO/importer/ImporterT.hh +++ b/src/OpenMesh/Core/IO/importer/ImporterT.hh @@ -90,6 +90,7 @@ public: typedef typename Mesh::Normal Normal; typedef typename Mesh::Color Color; typedef typename Mesh::TexCoord2D TexCoord2D; + typedef typename Mesh::TexCoord3D TexCoord3D; typedef std::vector VHandles; @@ -217,6 +218,19 @@ public: mesh_.set_texcoord2D(_heh, vector_cast(_texcoord)); } + virtual void set_texcoord(VertexHandle _vh, const Vec3f& _texcoord) + { + if (mesh_.has_vertex_texcoords3D()) + mesh_.set_texcoord3D(_vh, vector_cast(_texcoord)); + } + + virtual void set_texcoord(HalfedgeHandle _heh, const Vec3f& _texcoord) + { + if (mesh_.has_halfedge_texcoords3D()) + mesh_.set_texcoord3D(_heh, vector_cast(_texcoord)); + } + + // edge attributes virtual void set_color(EdgeHandle _eh, const Vec4uc& _color) @@ -292,6 +306,23 @@ public: } } + virtual void add_face_texcoords( FaceHandle _fh, VertexHandle _vh, const std::vector& _face_texcoords) + { + // get first halfedge handle + HalfedgeHandle cur_heh = mesh_.halfedge_handle(_fh); + HalfedgeHandle end_heh = mesh_.prev_halfedge_handle(cur_heh); + + // find start heh + while( mesh_.to_vertex_handle(cur_heh) != _vh && cur_heh != end_heh ) + cur_heh = mesh_.next_halfedge_handle( cur_heh); + + for(unsigned int i=0; i<_face_texcoords.size(); ++i) + { + set_texcoord( cur_heh, _face_texcoords[i]); + cur_heh = mesh_.next_halfedge_handle( cur_heh); + } + } + virtual void set_face_texindex( FaceHandle _fh, int _texId ) { if ( mesh_.has_face_texture_index() ) { mesh_.set_texture_index(_fh , _texId); diff --git a/src/OpenMesh/Core/IO/reader/OBJReader.cc b/src/OpenMesh/Core/IO/reader/OBJReader.cc index a9247c35..4d1698ca 100644 --- a/src/OpenMesh/Core/IO/reader/OBJReader.cc +++ b/src/OpenMesh/Core/IO/reader/OBJReader.cc @@ -290,13 +290,13 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) std::string line; std::string keyWrd; - float x, y, z, u, v; + float x, y, z, u, v, w; float r, g, b; BaseImporter::VHandles vhandles; std::vector normals; std::vector colors; - std::vector texcoords; - std::vector face_texcoords; + std::vector texcoords3d, face_texcoords3d; + std::vector texcoords, face_texcoords; std::vector vertexHandles; std::string matname; @@ -406,7 +406,6 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) stream >> u; stream >> v; if ( !stream.fail() ){ - if ( userOptions.vertex_has_texcoord() || userOptions.face_has_texcoord() ) { texcoords.push_back(OpenMesh::Vec2f(u, v)); @@ -415,9 +414,20 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) fileOptions += Options::FaceTexCoord; } - }else{ + //try to read the w component as it is optional + stream >> w; + if ( !stream.fail() ){ + if ( userOptions.vertex_has_texcoord() || userOptions.face_has_texcoord() ) { + texcoords3d.push_back(OpenMesh::Vec3f(u, v, w)); - omerr() << "Only single 2D texture coordinate per vertex" + // Can be used for both! + fileOptions += Options::VertexTexCoord; + fileOptions += Options::FaceTexCoord; + } + } + + }else{ + omerr() << "Only single 2D or 3D texture coordinate per vertex" << "allowed!" << std::endl; return false; } @@ -553,6 +563,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) if (!texcoords.empty() && (unsigned int) (value - 1) < texcoords.size()) { // Obj counts from 1 and not zero .. array counts from zero therefore -1 _bi.set_texcoord(vhandles.back(), texcoords[value - 1]); + if(!texcoords3d.empty() && (unsigned int) (value -1) < texcoords3d.size()) + _bi.set_texcoord(vhandles.back(), texcoords3d[value - 1]); } else { omerr() << "Error setting Texture coordinates" << std::endl; } @@ -563,6 +575,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) if (!texcoords.empty() && (unsigned int) (value - 1) < texcoords.size()) { face_texcoords.push_back( texcoords[value-1] ); + if(!texcoords3d.empty() && (unsigned int) (value -1) < texcoords3d.size()) + face_texcoords3d.push_back( texcoords3d[value-1] ); } else { omerr() << "Error setting Texture coordinates" << std::endl; } @@ -609,7 +623,10 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) fh = _bi.add_face(faceVertices); if (!vhandles.empty() && fh.is_valid() ) + { _bi.add_face_texcoords(fh, vhandles[0], face_texcoords); + _bi.add_face_texcoords(fh, vhandles[0], face_texcoords3d); + } if ( !matname.empty() ) { diff --git a/src/Unittests/TestFiles/cube-minimal-texCoords3d.obj b/src/Unittests/TestFiles/cube-minimal-texCoords3d.obj new file mode 100644 index 00000000..54f42a35 --- /dev/null +++ b/src/Unittests/TestFiles/cube-minimal-texCoords3d.obj @@ -0,0 +1,39 @@ +g cube +v 0.0 0.0 0.0 +v 0.0 0.0 1.0 +v 0.0 1.0 0.0 +v 0.0 1.0 1.0 +v 1.0 0.0 0.0 +v 1.0 0.0 1.0 +v 1.0 1.0 0.0 +v 1.0 1.0 1.0 +vn 0.0 0.0 1.0 +vn 0.0 0.0 -1.0 +vn 0.0 1.0 0.0 +vn 0.0 -1.0 0.0 +vn 1.0 0.0 0.0 +vn -1.0 0.0 0.0 +vt 1.0 1.0 1.0 +vt 2.0 2.0 2.0 +vt 3.0 3.0 3.0 +vt 4.0 4.0 4.0 +vt 5.0 5.0 5.0 +vt 6.0 6.0 6.0 +vt 7.0 7.0 7.0 +vt 8.0 8.0 8.0 +vt 9.0 9.0 9.0 +vt 10.0 10.0 10.0 +vt 11.0 11.0 11.0 +vt 12.0 12.0 12.0 +f 1/1/2 7/1/2 5/1/2 +f 1/2/2 3/2/2 7/2/2 +f 1/3/6 4/3/6 3/3/6 +f 1/4/6 2/4/6 4/4/6 +f 3/5/3 8/5/3 7/5/3 +f 3/6/3 4/6/3 8/6/3 +f 5/7/5 7/7/5 8/7/5 +f 5/8/5 8/8/5 6/8/5 +f 1/9/4 5/9/4 6/9/4 +f 1/10/4 6/10/4 2/10/4 +f 2/11/1 6/11/1 8/11/1 +f 2/12/1 8/12/1 4/12/1 diff --git a/src/Unittests/unittests_read_write_OBJ.cc b/src/Unittests/unittests_read_write_OBJ.cc index a1416f8e..2b502d0f 100644 --- a/src/Unittests/unittests_read_write_OBJ.cc +++ b/src/Unittests/unittests_read_write_OBJ.cc @@ -202,6 +202,51 @@ TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJCheckTexCoords) { mesh_.release_halfedge_texcoords2D(); } +/* + * Just load a obj file of a cube and checks the 3d halfedge texCoords + */ +TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJCheckTexCoords3d) { + + mesh_.clear(); + + mesh_.request_halfedge_texcoords3D(); + + OpenMesh::IO::Options options; + options += OpenMesh::IO::Options::FaceTexCoord; + + std::string file_name = "cube-minimal-texCoords3d.obj"; + + bool ok = OpenMesh::IO::read_mesh(mesh_, file_name,options); + + EXPECT_TRUE(ok) << file_name; + + EXPECT_EQ(1, mesh_.texcoord3D(mesh_.halfedge_handle(0))[0] ) << "Wrong texCoord at halfedge 0 component 0"; + EXPECT_EQ(1, mesh_.texcoord3D(mesh_.halfedge_handle(0))[1] ) << "Wrong texCoord at halfedge 0 component 1"; + EXPECT_EQ(1, mesh_.texcoord3D(mesh_.halfedge_handle(0))[2] ) << "Wrong texCoord at halfedge 0 component 2"; + + EXPECT_EQ(3, mesh_.texcoord3D(mesh_.halfedge_handle(10))[0] ) << "Wrong texCoord at halfedge 1 component 0"; + EXPECT_EQ(3, mesh_.texcoord3D(mesh_.halfedge_handle(10))[1] ) << "Wrong texCoord at halfedge 1 component 1"; + EXPECT_EQ(3, mesh_.texcoord3D(mesh_.halfedge_handle(10))[2] ) << "Wrong texCoord at halfedge 1 component 2"; + + EXPECT_EQ(6, mesh_.texcoord3D(mesh_.halfedge_handle(19))[0] ) << "Wrong texCoord at halfedge 4 component 0"; + EXPECT_EQ(6, mesh_.texcoord3D(mesh_.halfedge_handle(19))[1] ) << "Wrong texCoord at halfedge 4 component 1"; + EXPECT_EQ(6, mesh_.texcoord3D(mesh_.halfedge_handle(19))[2] ) << "Wrong texCoord at halfedge 4 component 2"; + + EXPECT_EQ(7, mesh_.texcoord3D(mesh_.halfedge_handle(24))[0] ) << "Wrong texCoord at halfedge 7 component 0"; + EXPECT_EQ(7, mesh_.texcoord3D(mesh_.halfedge_handle(24))[1] ) << "Wrong texCoord at halfedge 7 component 1"; + EXPECT_EQ(7, mesh_.texcoord3D(mesh_.halfedge_handle(24))[2] ) << "Wrong texCoord at halfedge 7 component 2"; + + EXPECT_EQ(9, mesh_.texcoord3D(mesh_.halfedge_handle(30))[0] ) << "Wrong texCoord at halfedge 9 component 0"; + EXPECT_EQ(9, mesh_.texcoord3D(mesh_.halfedge_handle(30))[1] ) << "Wrong texCoord at halfedge 9 component 1"; + EXPECT_EQ(9, mesh_.texcoord3D(mesh_.halfedge_handle(30))[2] ) << "Wrong texCoord at halfedge 9 component 2"; + + EXPECT_EQ(12, mesh_.texcoord3D(mesh_.halfedge_handle(35))[0] ) << "Wrong texCoord at halfedge 11 component 0"; + EXPECT_EQ(12, mesh_.texcoord3D(mesh_.halfedge_handle(35))[1] ) << "Wrong texCoord at halfedge 11 component 1"; + EXPECT_EQ(12, mesh_.texcoord3D(mesh_.halfedge_handle(35))[2] ) << "Wrong texCoord at halfedge 11 component 2"; + + mesh_.request_halfedge_texcoords3D(); +} + /* * Just load a obj file of a square with a material */ From 13904a15161e84c726315b206d02b49db7706301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 6 Jan 2016 14:26:06 +0100 Subject: [PATCH 03/17] Simplify reader --- src/OpenMesh/Core/IO/reader/OBJReader.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/OpenMesh/Core/IO/reader/OBJReader.cc b/src/OpenMesh/Core/IO/reader/OBJReader.cc index 4d1698ca..3e8f8e39 100644 --- a/src/OpenMesh/Core/IO/reader/OBJReader.cc +++ b/src/OpenMesh/Core/IO/reader/OBJReader.cc @@ -406,24 +406,19 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) stream >> u; stream >> v; if ( !stream.fail() ){ + if ( userOptions.vertex_has_texcoord() || userOptions.face_has_texcoord() ) { texcoords.push_back(OpenMesh::Vec2f(u, v)); // Can be used for both! fileOptions += Options::VertexTexCoord; fileOptions += Options::FaceTexCoord; - } - //try to read the w component as it is optional - stream >> w; - if ( !stream.fail() ){ - if ( userOptions.vertex_has_texcoord() || userOptions.face_has_texcoord() ) { - texcoords3d.push_back(OpenMesh::Vec3f(u, v, w)); + // try to read the w component as it is optional + stream >> w; + if ( !stream.fail() ) + texcoords3d.push_back(OpenMesh::Vec3f(u, v, w)); - // Can be used for both! - fileOptions += Options::VertexTexCoord; - fileOptions += Options::FaceTexCoord; - } } }else{ From 1d043197b19afab0740c1cabd26818a5643ce2f3 Mon Sep 17 00:00:00 2001 From: Alexander Dielen Date: Wed, 13 Jan 2016 13:58:48 +0100 Subject: [PATCH 04/17] fixed dangling pointer --- src/Python/Decimater.hh | 22 ++++++++++++---------- src/Python/PropertyManager.hh | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Python/Decimater.hh b/src/Python/Decimater.hh index 5eb18e61..c0825231 100644 --- a/src/Python/Decimater.hh +++ b/src/Python/Decimater.hh @@ -19,6 +19,8 @@ namespace OpenMesh { namespace Python { +#define INIT_MESH_REF init()[with_custodian_and_ward<1,2>()] + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(decimate_overloads, decimate, 0, 1) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(decimate_to_faces_overloads, decimate_to_faces, 0, 2) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(set_max_err_overloads, set_max_err, 1, 2) @@ -108,7 +110,7 @@ void expose_decimater(const char *_name) { char buffer[64]; snprintf(buffer, sizeof buffer, "%s%s", _name, "Decimater"); - class_(buffer, init()) + class_(buffer, INIT_MESH_REF) .def("decimate", &Decimater::decimate, decimate_overloads()) .def("decimate_to", &Decimater::decimate_to) .def("decimate_to_faces", &Decimater::decimate_to_faces, decimate_to_faces_overloads()) @@ -168,7 +170,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModAspectRatio"); - class_, boost::noncopyable>(buffer, init()) + class_, boost::noncopyable>(buffer, INIT_MESH_REF) .def("aspect_ratio", &ModAspectRatio::aspect_ratio) .def("set_aspect_ratio", &ModAspectRatio::set_aspect_ratio) ; @@ -181,7 +183,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModEdgeLength"); - class_, boost::noncopyable>(buffer, init()) + class_, boost::noncopyable>(buffer, INIT_MESH_REF) .def("edge_length", &ModEdgeLength::edge_length) .def("set_edge_length", &ModEdgeLength::set_edge_length) ; @@ -194,7 +196,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModHausdorff"); - class_, boost::noncopyable>(buffer, init()) + class_, boost::noncopyable>(buffer, INIT_MESH_REF) .def("tolerance", &ModHausdorff::tolerance) .def("set_tolerance", &ModHausdorff::set_tolerance) ; @@ -207,7 +209,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModIndependentSets"); - class_, boost::noncopyable>(buffer, init()); + class_, boost::noncopyable>(buffer, INIT_MESH_REF); snprintf(buffer, sizeof buffer, "%s%s", _name, "ModIndependentSetsHandle"); expose_module_handle(buffer); @@ -217,7 +219,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalDeviation"); - class_, boost::noncopyable>(buffer, init()) + class_, boost::noncopyable>(buffer, INIT_MESH_REF) .def("normal_deviation", &ModNormalDeviation::normal_deviation) .def("set_normal_deviation", &ModNormalDeviation::set_normal_deviation) ; @@ -230,7 +232,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalFlipping"); - class_, boost::noncopyable>(buffer, init()) + class_, boost::noncopyable>(buffer, INIT_MESH_REF) .def("max_normal_deviation", &ModNormalFlipping::max_normal_deviation) .def("set_max_normal_deviation", &ModNormalFlipping::set_max_normal_deviation) ; @@ -250,7 +252,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModProgMesh"); - class_, boost::noncopyable>(buffer, init()) + class_, boost::noncopyable>(buffer, INIT_MESH_REF) .def("pmi", &infolist) .def("infolist", &infolist) .def("write", &ModProgMesh::write) @@ -264,7 +266,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModQuadric"); - class_, boost::noncopyable>(buffer, init()) + class_, boost::noncopyable>(buffer, INIT_MESH_REF) .def("set_max_err", &ModQuadric::set_max_err, set_max_err_overloads()) .def("unset_max_err", &ModQuadric::unset_max_err) .def("max_err", &ModQuadric::max_err) @@ -278,7 +280,7 @@ void expose_decimater(const char *_name) { snprintf(buffer, sizeof buffer, "%s%s", _name, "ModRoundness"); - class_, boost::noncopyable>(buffer, init()) + class_, boost::noncopyable>(buffer, INIT_MESH_REF) .def("set_min_angle", &ModRoundness::set_min_angle) .def("set_min_roundness", &ModRoundness::set_min_roundness, set_min_roundness_overloads()) .def("unset_min_roundness", &ModRoundness::unset_min_roundness) diff --git a/src/Python/PropertyManager.hh b/src/Python/PropertyManager.hh index 515d5cc6..3fe21f02 100644 --- a/src/Python/PropertyManager.hh +++ b/src/Python/PropertyManager.hh @@ -111,8 +111,8 @@ void expose_property_manager(const char *_name) { // Expose property manager class_(_name) - .def(init >()) - .def(init >()) + .def(init >()[with_custodian_and_ward<1,2>()]) + .def(init >()[with_custodian_and_ward<1,2>()]) .def("swap", &PropertyManager::swap) .def("is_valid", &PropertyManager::isValid) From c5cfef87427a793268f9e012856872bbed958d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 29 Jan 2016 08:50:21 +0100 Subject: [PATCH 05/17] Fixed Typo in cmake install for smoother (Thanks to Takashi Michikawa for the fix). --- src/OpenMesh/Tools/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenMesh/Tools/CMakeLists.txt b/src/OpenMesh/Tools/CMakeLists.txt index c1969206..a37785b1 100644 --- a/src/OpenMesh/Tools/CMakeLists.txt +++ b/src/OpenMesh/Tools/CMakeLists.txt @@ -81,7 +81,7 @@ if ( NOT ACG_PROJECT_MACOS_BUNDLE AND APPLE ) FILE(GLOB files_install_Decimater "${CMAKE_CURRENT_SOURCE_DIR}/Decimater/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Decimater/*T.cc" ) FILE(GLOB files_install_Dualizer "${CMAKE_CURRENT_SOURCE_DIR}/Dualizer/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Dualizer/*T.cc" ) FILE(GLOB files_install_KERNEL_OSG "${CMAKE_CURRENT_SOURCE_DIR}/Kernel_OSG/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Kernel_OSG/*T.cc" ) - FILE(GLOB files_install_Smoother "${CMAKE_CURRENT_SOURCE_DIR}/Smoother/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Decimater/*T.cc" ) + FILE(GLOB files_install_Smoother "${CMAKE_CURRENT_SOURCE_DIR}/Smoother/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Smoother/*T.cc" ) FILE(GLOB files_install_Subdivider_Adaptive "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Adaptive/Composite/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Adaptive/Composite/*T.cc" ) FILE(GLOB files_install_Subdivider_Uniform "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/*T.cc" ) FILE(GLOB files_install_Subdivider_Uniform_Composite "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/Composite/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/Composite/*T.cc" ) From cd777c7b6ba3c198a7e6d9eb591c8bdeb43cf8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 29 Jan 2016 09:10:59 +0100 Subject: [PATCH 06/17] Fixed order of smoother parameters in the documentation. (Thanks to Takashi Michikawa for the info). (cherry picked from commit af50ec1e51b981f73efcd23c19b1c9ac762f646f) --- Doc/smoother.docu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/smoother.docu b/Doc/smoother.docu index 216a6983..ea388bee 100644 --- a/Doc/smoother.docu +++ b/Doc/smoother.docu @@ -20,8 +20,8 @@ The smoothers directly work on an OpenMesh. The following example shows how to u // Initialize smoother with input mesh OpenMesh::Smoother::JacobiLaplaceSmootherT smoother(mesh); - smoother.initialize( C0, //Continuity - Tangential_and_Normal) //Smooth direction + smoother.initialize( Tangential_and_Normal, //Smooth direction + C0) //Continuity // Execute 3 smooth steps smoother.smooth(3); From cee7b56f5eb212ae15598c489202297d4b2d7bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 4 Feb 2016 09:40:23 +0100 Subject: [PATCH 07/17] Fixed ugly typo in __decrement function of Basehandle. Seems to be unused in the rest of the code. --- src/OpenMesh/Core/Mesh/Handles.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenMesh/Core/Mesh/Handles.hh b/src/OpenMesh/Core/Mesh/Handles.hh index 89dd9d27..1488ce09 100644 --- a/src/OpenMesh/Core/Mesh/Handles.hh +++ b/src/OpenMesh/Core/Mesh/Handles.hh @@ -99,7 +99,7 @@ public: void __decrement() { --idx_; } void __increment(int amount) { idx_ += amount; } - void __decrement(int amount) { idx_ += amount; } + void __decrement(int amount) { idx_ -= amount; } private: From 74bf0672c6ff257e3afe361efc2ee09e2b3ea83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 4 Feb 2016 09:54:38 +0100 Subject: [PATCH 08/17] Updated changelog for 5.2 (cherry picked from commit 81e091decf29955afb8e118c496fb82e8f93989c) --- Doc/changelog.docu | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index d6dc1bc4..5e64442c 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -31,6 +31,26 @@ +5.2 (?/?/?) + +Core +
    +
  • Fixed ugly typo in __decrement function of Basehandle. Seems to be unused in the rest of the code.
  • +
+ + +Build System +
    +
  • Fixed Typo in cmake install for smoother (Thanks to Takashi Michikawa for the fix).
  • +
+ +Documentation +
    +
  • Fixed order of smoother parameters in the documentation. (Thanks to Takashi Michikawa for the info).
  • +
+ + + 5.1 (2015/17/12) From ea1ee2fd6958ce6c0899adb5c8dbd074012bf813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 4 Feb 2016 10:00:01 +0100 Subject: [PATCH 09/17] Updated cmake finder to include possible OpenMesh-5.2 --- cmake/FindOpenMesh.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/FindOpenMesh.cmake b/cmake/FindOpenMesh.cmake index c69f8779..1a21f716 100644 --- a/cmake/FindOpenMesh.cmake +++ b/cmake/FindOpenMesh.cmake @@ -64,6 +64,7 @@ IF (NOT OPENMESH_FOUND) "${CMAKE_SOURCE_DIR}/libs_required/OpenMesh/src/OpenMesh" "${CMAKE_SOURCE_DIR}/../OpenMesh/src/OpenMesh" "C:/Program Files/OpenMesh 6.0" + "C:/Program Files/OpenMesh 5.2" "C:/Program Files/OpenMesh 5.1" "C:/Program Files/OpenMesh 5.0" "C:/Program Files/OpenMesh 4.2" @@ -78,6 +79,7 @@ IF (NOT OPENMESH_FOUND) "C:/Program Files/OpenMesh 2.4" "C:/Program Files/OpenMesh 2.0/include" "C:/libs/OpenMesh 6.0" + "C:/libs/OpenMesh 5.2" "C:/libs/OpenMesh 5.1" "C:/libs/OpenMesh 5.0" "C:/libs/OpenMesh 4.2" From d43d7d21486cad67aa7a83ae2b99f179adfb665f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 4 Feb 2016 10:00:15 +0100 Subject: [PATCH 10/17] Updated changelog of 6.0 branch --- Doc/changelog.docu | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 5e64442c..c79f81c1 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -9,6 +9,10 @@ 6.0 (?/?/?) +IO +
    +
  • Obj reader: added texCoord3d functions to objloader
  • +
VectorT
    @@ -28,6 +32,11 @@
  • Updated c++11 ifdefs to use c++11 (starting with VS1015)
+Python Interface +
    +
  • Fixed segfault in decimater due to a bad pointer
  • +
+ From 04fc8dac85eac29c5c26e29f103c566868705da6 Mon Sep 17 00:00:00 2001 From: Alexander Dielen Date: Thu, 11 Feb 2016 14:04:52 +0100 Subject: [PATCH 11/17] Fixed CR LF newline handling for binary file headers. --- src/OpenMesh/Core/IO/reader/PLYReader.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/OpenMesh/Core/IO/reader/PLYReader.cc b/src/OpenMesh/Core/IO/reader/PLYReader.cc index 31e590e7..f86caae0 100644 --- a/src/OpenMesh/Core/IO/reader/PLYReader.cc +++ b/src/OpenMesh/Core/IO/reader/PLYReader.cc @@ -1275,7 +1275,19 @@ bool _PLYReader_::can_u_read(std::istream& _is) const { // As the binary data is directy after the end_header keyword // and the stream removes too many bytes, seek back to the right position if (options_.is_binary()) { - _is.seekg(streamPos + 12); + _is.seekg(streamPos); + + char c1 = 0; + char c2 = 0; + _is.get(c1); + _is.get(c2); + + if (c1 == 0x0D && c2 == 0x0A) { + _is.seekg(streamPos + 14); + } + else { + _is.seekg(streamPos + 12); + } } return true; From 44cb2ebc4d6f120adfa720c6cddc5a4fff5d0890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 11 Feb 2016 14:49:44 +0100 Subject: [PATCH 12/17] Fix OBJ material files and face color (Thanks to Sven-Kristofer Pilz for the patch) --- src/OpenMesh/Core/IO/writer/OBJWriter.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenMesh/Core/IO/writer/OBJWriter.cc b/src/OpenMesh/Core/IO/writer/OBJWriter.cc index dc032769..f89e8e0c 100644 --- a/src/OpenMesh/Core/IO/writer/OBJWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OBJWriter.cc @@ -118,7 +118,7 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream dot = _filename.find_last_of("."); if(dot != std::string::npos) - objName_ = objName_.substr(0,dot-1); + objName_ = objName_.substr(0,dot); } bool result = write(out, _be, _opt, _precision); @@ -184,7 +184,7 @@ writeMaterial(std::ostream& _out, BaseExporter& _be, Options _opt) const for (size_t i=0; i < materialA_.size(); i++){ _out << "newmtl " << "mat" << i << '\n'; _out << "Ka 0.5000 0.5000 0.5000" << '\n'; - _out << "Kd " << materialA_[i][0] << materialA_[i][1] << materialA_[i][2] << '\n';; + _out << "Kd " << materialA_[i][0] << ' ' << materialA_[i][1] << ' ' << materialA_[i][2] << '\n'; _out << "Tr " << materialA_[i][3] << '\n'; _out << "illum 1" << '\n'; } @@ -192,7 +192,7 @@ writeMaterial(std::ostream& _out, BaseExporter& _be, Options _opt) const for (size_t i=0; i < material_.size(); i++){ _out << "newmtl " << "mat" << i << '\n'; _out << "Ka 0.5000 0.5000 0.5000" << '\n'; - _out << "Kd " << material_[i][0] << material_[i][1] << material_[i][2] << '\n';; + _out << "Kd " << material_[i][0] << ' ' << material_[i][1] << ' ' << material_[i][2] << '\n'; _out << "illum 1" << '\n'; } From 1518f073b082cb4c8dad93c71e674d157656312e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 12 Feb 2016 12:01:14 +0100 Subject: [PATCH 13/17] Updated 5.2 changelog (cherry picked from commit 0093646b3692474d91c15c66d833a9280faa70f8) --- Doc/changelog.docu | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index c79f81c1..e45a958a 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -48,6 +48,12 @@ +IO +
    +
  • PLY Reader: Fixed CR LF newline handling for binary file headers.
  • +
+ + Build System
  • Fixed Typo in cmake install for smoother (Thanks to Takashi Michikawa for the fix).
  • From b1a7d43a83fd8beb578b854f20e6834fe4a97c93 Mon Sep 17 00:00:00 2001 From: Janis Born Date: Thu, 17 Mar 2016 18:29:55 +0100 Subject: [PATCH 14/17] drop VectorDimensionsT metaprogram in favor of vector_traits (thanks to Marco Centin and Amodio Pesce) --- .../Core/Geometry/VectorDimensionsT.hh | 80 ------------------- src/OpenMesh/Core/Mesh/PolyMeshT.cc | 6 +- 2 files changed, 3 insertions(+), 83 deletions(-) delete mode 100644 src/OpenMesh/Core/Geometry/VectorDimensionsT.hh diff --git a/src/OpenMesh/Core/Geometry/VectorDimensionsT.hh b/src/OpenMesh/Core/Geometry/VectorDimensionsT.hh deleted file mode 100644 index c9148283..00000000 --- a/src/OpenMesh/Core/Geometry/VectorDimensionsT.hh +++ /dev/null @@ -1,80 +0,0 @@ -/* ========================================================================= * - * * - * OpenMesh * - * Copyright (c) 2001-2015, RWTH-Aachen University * - * Department of Computer Graphics and Multimedia * - * All rights reserved. * - * www.openmesh.org * - * * - *---------------------------------------------------------------------------* - * This file is part of OpenMesh. * - *---------------------------------------------------------------------------* - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright notice, * - * this list of conditions and the following disclaimer. * - * * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * * - * 3. Neither the name of the copyright holder nor the names of its * - * contributors may be used to endorse or promote products derived from * - * this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * * - * ========================================================================= */ - -//============================================================================= -// -// CLASS VectorDimensionsT -// -//============================================================================= - -#ifndef DOXYGEN - -#ifndef OPENMESH_VECTOR_DIMENSIONS_HH -#define OPENMESH_VECTOR_DIMENSIONS_HH - -//== INCLUDES ================================================================= - -#include -#include - -//== NAMESPACES =============================================================== - -namespace OpenMesh { - -//== CLASS DEFINITION ========================================================= - -template -struct VectorDimensionsT {}; - -template -struct VectorDimensionsT< OpenMesh::VectorT > { - enum { - value = Dim - }; -}; - -//============================================================================= -} // namespace OpenMesh -//============================================================================= - -#endif // OPENMESH_VECTOR_DIMENSIONS_HH defined -//============================================================================= -#endif // DOXYGEN diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.cc b/src/OpenMesh/Core/Mesh/PolyMeshT.cc index e8509605..3c66808e 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.cc +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.cc @@ -61,9 +61,9 @@ #include #include -#include #include #include +#include #include #include @@ -102,7 +102,7 @@ typename PolyMeshT::Normal PolyMeshT::calc_face_normal(FaceHandle _fh) const { return calc_face_normal_impl(_fh, typename GenProg::IF< - VectorDimensionsT::Point>::value == 3, + vector_traits::Point>::size_ == 3, PointIs3DTag, PointIsNot3DTag >::Result()); @@ -169,7 +169,7 @@ calc_face_normal(const Point& _p0, const Point& _p2) const { return calc_face_normal_impl(_p0, _p1, _p2, typename GenProg::IF< - VectorDimensionsT::Point>::value == 3, + vector_traits::Point>::size_ == 3, PointIs3DTag, PointIsNot3DTag >::Result()); From 30d88d0694bb4df21a4324f21393520a5e10f951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 23 Mar 2016 13:08:54 +0100 Subject: [PATCH 15/17] Updated 5.2 changelog (cherry picked from commit 732bb63748e5a4a6622d3a0826815e393ae081c2) --- Doc/changelog.docu | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index e45a958a..481efb55 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -45,6 +45,7 @@ Core
    • Fixed ugly typo in __decrement function of Basehandle. Seems to be unused in the rest of the code.
    • +
    • drop VectorDimensionsT metaprogram in favor of vector_traits in normal computation function
    From 57c0ec08dfed9ba8c3741668b355350dc1b59407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 23 Mar 2016 13:42:06 +0100 Subject: [PATCH 16/17] Updated 5.2 Docu --- Doc/changelog.docu | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index c79f81c1..b43b8747 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -47,6 +47,11 @@
  • Fixed ugly typo in __decrement function of Basehandle. Seems to be unused in the rest of the code.
+IO +
    +
  • Obj writer: Fix OBJ material files and face color (Thanks to Sven-Kristofer Pilz for the patch)
  • +
+ Build System
    From 7fffd773c8aeb0fdcb06ebc5f80e2c4527569b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 23 Mar 2016 13:46:45 +0100 Subject: [PATCH 17/17] Correctly merge Docs for 5.2 --- Doc/changelog.docu | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 4232f76a..56f07847 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -52,10 +52,6 @@ IO
    • PLY Reader: Fixed CR LF newline handling for binary file headers.
    • -
    - -IO -
    • Obj writer: Fix OBJ material files and face color (Thanks to Sven-Kristofer Pilz for the patch)