#ifndef VHACD_MANIFOLD_MESH_H #define VHACD_MANIFOLD_MESH_H /* Copyright (c) 2011 Khaled Mamou (kmamou at gmail dot com) All rights reserved. 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. The names of the contributors may not 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. */ #pragma once #include "vhacdCircularList.h" #include "vhacdSArray.h" #include "vhacdVector.h" // -- GODOT start -- #include // -- GODOT end -- namespace VHACD { class TMMTriangle; class TMMEdge; class TMMesh; class ICHull; //! Vertex data structure used in a triangular manifold mesh (TMM). class TMMVertex { public: void Initialize(); TMMVertex(void); ~TMMVertex(void); private: Vec3 m_pos; int32_t m_name; size_t m_id; CircularListElement* m_duplicate; // pointer to incident cone edge (or NULL) bool m_onHull; bool m_tag; TMMVertex(const TMMVertex& rhs); friend class ICHull; friend class TMMesh; friend class TMMTriangle; friend class TMMEdge; }; //! Edge data structure used in a triangular manifold mesh (TMM). class TMMEdge { public: void Initialize(); TMMEdge(void); ~TMMEdge(void); private: size_t m_id; CircularListElement* m_triangles[2]; CircularListElement* m_vertices[2]; CircularListElement* m_newFace; TMMEdge(const TMMEdge& rhs); friend class ICHull; friend class TMMTriangle; friend class TMMVertex; friend class TMMesh; }; //! Triangle data structure used in a triangular manifold mesh (TMM). class TMMTriangle { public: void Initialize(); TMMTriangle(void); ~TMMTriangle(void); private: size_t m_id; CircularListElement* m_edges[3]; CircularListElement* m_vertices[3]; bool m_visible; TMMTriangle(const TMMTriangle& rhs); friend class ICHull; friend class TMMesh; friend class TMMVertex; friend class TMMEdge; }; //! triangular manifold mesh data structure. class TMMesh { public: //! Returns the number of vertices> inline size_t GetNVertices() const { return m_vertices.GetSize(); } //! Returns the number of edges inline size_t GetNEdges() const { return m_edges.GetSize(); } //! Returns the number of triangles inline size_t GetNTriangles() const { return m_triangles.GetSize(); } //! Returns the vertices circular list inline const CircularList& GetVertices() const { return m_vertices; } //! Returns the edges circular list inline const CircularList& GetEdges() const { return m_edges; } //! Returns the triangles circular list inline const CircularList& GetTriangles() const { return m_triangles; } //! Returns the vertices circular list inline CircularList& GetVertices() { return m_vertices; } //! Returns the edges circular list inline CircularList& GetEdges() { return m_edges; } //! Returns the triangles circular list inline CircularList& GetTriangles() { return m_triangles; } //! Add vertex to the mesh CircularListElement* AddVertex() { return m_vertices.Add(); } //! Add vertex to the mesh CircularListElement* AddEdge() { return m_edges.Add(); } //! Add vertex to the mesh CircularListElement* AddTriangle() { return m_triangles.Add(); } //! Print mesh information void Print(); //! void GetIFS(Vec3* const points, Vec3* const triangles); //! void Clear(); //! void Copy(TMMesh& mesh); //! bool CheckConsistancy(); //! bool Normalize(); //! bool Denormalize(); //! Constructor TMMesh(); //! Destructor virtual ~TMMesh(void); private: CircularList m_vertices; CircularList m_edges; CircularList m_triangles; // not defined TMMesh(const TMMesh& rhs); friend class ICHull; }; } #endif // VHACD_MANIFOLD_MESH_H