summaryrefslogtreecommitdiff
path: root/thirdparty/thekla_atlas/nvmesh/QuadTriMesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/thekla_atlas/nvmesh/QuadTriMesh.cpp')
-rw-r--r--thirdparty/thekla_atlas/nvmesh/QuadTriMesh.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/thirdparty/thekla_atlas/nvmesh/QuadTriMesh.cpp b/thirdparty/thekla_atlas/nvmesh/QuadTriMesh.cpp
new file mode 100644
index 0000000000..64a071abe9
--- /dev/null
+++ b/thirdparty/thekla_atlas/nvmesh/QuadTriMesh.cpp
@@ -0,0 +1,36 @@
+// This code is in the public domain -- Ignacio Castaņo <castano@gmail.com>
+
+#include "QuadTriMesh.h"
+#include "Stream.h"
+
+using namespace nv;
+
+
+bool QuadTriMesh::isQuadFace(uint i) const
+{
+ return m_faceArray[i].isQuadFace();
+}
+
+const QuadTriMesh::Vertex & QuadTriMesh::faceVertex(uint f, uint v) const
+{
+ if (isQuadFace(f)) nvDebugCheck(v < 4);
+ else nvDebugCheck(v < 3);
+
+ const Face & face = this->faceAt(f);
+ return this->vertexAt(face.v[v]);
+}
+
+
+namespace nv
+{
+ static Stream & operator<< (Stream & s, QuadTriMesh::Face & face)
+ {
+ return s << face.id << face.v[0] << face.v[1] << face.v[2] << face.v[3];
+ }
+
+ Stream & operator<< (Stream & s, QuadTriMesh & mesh)
+ {
+ return s << mesh.m_faceArray << (BaseMesh &) mesh;
+ }
+}
+