#pragma once #include "typedefs.h" namespace mt { class Face { friend class Mesh; public: Face(); Face(Vertex* a, Vertex* b, Vertex* c, Vertex* d = nullptr); Face(const VertexList& vertices); ~Face(); vec3 GetNormal() const; Plane GetPlane() const; bool IsTriangle() const; void FlipNormal(); void FlipNormal(const vec3& dir); FaceList Triangulate(); void FlipEdge(); bool IsDegenerated() const; bool RegainIntegrity(); const VertexList& GetVertices() const; FaceList GetFaces() const; const EdgeList& GetEdges() const; bool HasTag(int tag) const; bool HasTagsAny(const List& tagsToCheck) const; bool HasTagsAll(const List& tagsToCheck) const; void AddTag(int tag); void RemoveTag(int tag); List GetTags() const; void SetMaterialId(int materialId); int GetMaterialId() const; //void SetUVGenerator(UVGeneratorBase* generator); //UVGeneratorBase* GetUVGenerator() const; List GetIndices(bool allowQuads) const; void CopyProperties(Face* other, bool merge = false); Mesh* GetMesh() const; operator FaceList() { FaceList result; result.Add(const_cast(this)); return result; } private: List GetTriangles() const; List GetMetaIndices() const; List tags; //UVGeneratorBase* uvGenerator; VertexList vertices; EdgeList edges; int materialId; Mesh* mesh; }; }