63 lines
1.4 KiB
C++
63 lines
1.4 KiB
C++
#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<int>& tagsToCheck) const;
|
|
bool HasTagsAll(const List<int>& tagsToCheck) const;
|
|
void AddTag(int tag);
|
|
void RemoveTag(int tag);
|
|
List<int> GetTags() const;
|
|
|
|
void SetMaterialId(int materialId);
|
|
int GetMaterialId() const;
|
|
//void SetUVGenerator(UVGeneratorBase* generator);
|
|
//UVGeneratorBase* GetUVGenerator() const;
|
|
|
|
List<unsigned int> GetIndices(bool allowQuads) const;
|
|
|
|
void CopyProperties(Face* other, bool merge = false);
|
|
Mesh* GetMesh() const;
|
|
|
|
operator FaceList() { FaceList result; result.Add(const_cast<Face*>(this)); return result; }
|
|
|
|
private:
|
|
List<Triangle> GetTriangles() const;
|
|
List<int> GetMetaIndices() const;
|
|
|
|
List<int> tags;
|
|
|
|
//UVGeneratorBase* uvGenerator;
|
|
VertexList vertices;
|
|
EdgeList edges;
|
|
int materialId;
|
|
Mesh* mesh;
|
|
};
|
|
} |