diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-12-08 11:58:37 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-08 11:58:37 -0300 |
commit | 372b79b0d324b1eeb5991eb510726420c7cbb12d (patch) | |
tree | 533b0acfc41971f8d46bdd7139a379a0f2ba39d5 /thirdparty/thekla_atlas/nvmesh/QuadTriMesh.h | |
parent | 8c78ccb027635702a2d69ebb7ad6a6ddfaf5ffa1 (diff) | |
parent | bf05309af734431c3b3cf869a63ed477439a6739 (diff) |
Merge pull request #14409 from hpvb/import-thekla-atlas
Import thekla_atlas
Diffstat (limited to 'thirdparty/thekla_atlas/nvmesh/QuadTriMesh.h')
-rw-r--r-- | thirdparty/thekla_atlas/nvmesh/QuadTriMesh.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/thirdparty/thekla_atlas/nvmesh/QuadTriMesh.h b/thirdparty/thekla_atlas/nvmesh/QuadTriMesh.h new file mode 100644 index 0000000000..b8465f2db0 --- /dev/null +++ b/thirdparty/thekla_atlas/nvmesh/QuadTriMesh.h @@ -0,0 +1,60 @@ +// This code is in the public domain -- Ignacio Castaņo <castano@gmail.com> + +#pragma once +#ifndef NV_MESH_QUADTRIMESH_H +#define NV_MESH_QUADTRIMESH_H + +#include "nvcore/Array.h" +#include "nvmath/Vector.h" +#include "nvmesh/nvmesh.h" +#include "nvmesh/BaseMesh.h" + +namespace nv +{ + class Stream; + + /// Mixed quad/triangle mesh. + class QuadTriMesh : public BaseMesh + { + public: + struct Face; + typedef BaseMesh::Vertex Vertex; + + QuadTriMesh() {}; + QuadTriMesh(uint faceCount, uint vertexCount) : BaseMesh(vertexCount), m_faceArray(faceCount) {} + + // Face methods. + uint faceCount() const { return m_faceArray.count(); } + + const Face & faceAt(uint i) const { return m_faceArray[i]; } + Face & faceAt(uint i) { return m_faceArray[i]; } + + const Array<Face> & faces() const { return m_faceArray; } + Array<Face> & faces() { return m_faceArray; } + + bool isQuadFace(uint i) const; + + const Vertex & faceVertex(uint f, uint v) const; + + friend Stream & operator<< (Stream & s, QuadTriMesh & obj); + + private: + + Array<Face> m_faceArray; + + }; + + + /// QuadTriMesh face. + struct QuadTriMesh::Face + { + uint id; + uint v[4]; + + bool isQuadFace() const { return v[3] != NIL; } + }; + +} // nv namespace + + +#endif // NV_MESH_QUADTRIMESH_H |