From 8033e2da23472217a363fec6536aac3d6f297d69 Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Wed, 21 Dec 2016 18:31:46 +0100 Subject: [PATCH 1/2] QuadricT: implement Q+Q and Q*scalar operators for convenience. --- src/OpenMesh/Core/Geometry/QuadricT.hh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/OpenMesh/Core/Geometry/QuadricT.hh b/src/OpenMesh/Core/Geometry/QuadricT.hh index b211cc49..fdec0c9c 100644 --- a/src/OpenMesh/Core/Geometry/QuadricT.hh +++ b/src/OpenMesh/Core/Geometry/QuadricT.hh @@ -180,6 +180,12 @@ public: return *this; } + QuadricT operator+(const QuadricT& _other ) const + { + QuadricT result = *this; + return result += _other; + } + /// multiply by scalar QuadricT& operator*=( Scalar _s) @@ -191,6 +197,11 @@ public: return *this; } + QuadricT operator*(Scalar _s) const + { + QuadricT result = *this; + return result *= _s; + } /// multiply 4D vector from right: Q*v template From da1ec03c6efc48373d8301694e1ad21f906feeca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 27 Dec 2016 08:10:10 +0100 Subject: [PATCH 2/2] OM Writer: Added Mark to the format header to identify end of stream correctly (Thanks to Jamie Kydd for the patch) --- Doc/changelog.docu | 1 + src/OpenMesh/Core/IO/OMFormat.hh | 3 ++- src/OpenMesh/Core/IO/reader/OMReader.cc | 2 ++ src/OpenMesh/Core/IO/writer/OMWriter.cc | 5 +++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index e61521f9..48b0730b 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -22,6 +22,7 @@
  • OBJ Loader: range check for vertex colors and normals in OBJ loader
  • OBJ Loader: fixed handling of negative indices in OBJ loader
  • OM Writer: Fixed OMWriter when no faces are available (Thanks to Jamie Kydd for the patch)
  • +
  • OM Writer: Added Mark to the format header to identify end of stream correctly (Thanks to Jamie Kydd for the patch)
  • Unittests diff --git a/src/OpenMesh/Core/IO/OMFormat.hh b/src/OpenMesh/Core/IO/OMFormat.hh index dd098929..13228e84 100644 --- a/src/OpenMesh/Core/IO/OMFormat.hh +++ b/src/OpenMesh/Core/IO/OMFormat.hh @@ -179,7 +179,8 @@ namespace OMFormat { Entity_Mesh = 0x01, Entity_Face = 0x02, Entity_Edge = 0x04, - Entity_Halfedge = 0x06 + Entity_Halfedge = 0x06, + Entity_Sentinel = 0x07 }; enum Dim { diff --git a/src/OpenMesh/Core/IO/reader/OMReader.cc b/src/OpenMesh/Core/IO/reader/OMReader.cc index 031d85e8..b66684eb 100644 --- a/src/OpenMesh/Core/IO/reader/OMReader.cc +++ b/src/OpenMesh/Core/IO/reader/OMReader.cc @@ -211,6 +211,8 @@ bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt if (!read_binary_mesh_chunk(_is, _bi, _opt, swap)) return false; break; + case OMFormat::Chunk::Entity_Sentinel: + return true; default: return false; } diff --git a/src/OpenMesh/Core/IO/writer/OMWriter.cc b/src/OpenMesh/Core/IO/writer/OMWriter.cc index 9d234ccd..964a5ebc 100644 --- a/src/OpenMesh/Core/IO/writer/OMWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OMWriter.cc @@ -430,6 +430,11 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be, OMFormat::Chunk::Entity_Mesh, swap ); } + memset(&chunk_header, 0, sizeof(chunk_header)); + chunk_header.name_ = false; + chunk_header.entity_ = OMFormat::Chunk::Entity_Sentinel; + bytes += store(_os, chunk_header, swap); + std::clog << "#bytes written: " << bytes << std::endl; return true;