8 #ifndef META_OCEAN_RENDERING_TRINAGLE_FACE_H
9 #define META_OCEAN_RENDERING_TRINAGLE_FACE_H
79 [[nodiscard]]
inline VertexIndex index(
const unsigned int index)
const;
87 [[nodiscard]]
inline VertexIndex& index(
const unsigned int index);
95 [[nodiscard]]
inline VertexIndex operator[](
const unsigned int index)
const;
103 [[nodiscard]]
inline VertexIndex& operator[](
const unsigned int index);
109 [[nodiscard]]
inline const VertexIndex* operator()()
const;
122 inline bool operator==(
const TriangleFace& triangleFace)
const;
129 inline bool operator!=(
const TriangleFace& triangleFace)
const;
215 ocean_assert(
index < 3);
221 ocean_assert(
index < 3);
227 ocean_assert(
index < 3);
233 ocean_assert(
index < 3);
254 return !(*
this == triangleFace);
259 size_t seed = std::hash<Index32>{}(triangleFace[0]);
260 seed ^= std::hash<Index32>{}(triangleFace[1]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
261 seed ^= std::hash<Index32>{}(triangleFace[2]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
268 ocean_assert(indices !=
nullptr);
269 ocean_assert(size >= 3 && size % 3 == 0);
272 triangleFaces.reserve(size / 3);
274 for (
size_t n = 0; n < size; n += 3)
276 triangleFaces.emplace_back(indices[n + 0], indices[n + 1], indices[n + 2]);
279 return triangleFaces;
Definition of a triangle face with three vertex indices.
Definition: TriangleFace.h:37
static TriangleFaces indices2triangleFaces(const Index32 *indices, const size_t size)
Convertes indices of triangles to triangle faces.
Definition: TriangleFace.h:266
bool operator!=(const TriangleFace &triangleFace) const
Returns whether two triangle face objects are not identical.
Definition: TriangleFace.h:252
std::map< Vertex, VertexIndices > VertexMap
Definition of a map mapping vertices to their corresponding face indices.
Definition: TriangleFace.h:43
VertexIndex operator[](const unsigned int index) const
Returns a specific vertex index specified by it's index inside the face.
Definition: TriangleFace.h:225
VertexIndex indices_[3]
The three vertex indices.
Definition: TriangleFace.h:185
const VertexIndex * operator()() const
Returns the pointer to the first element of the vertex indices.
Definition: TriangleFace.h:237
static Vectors3 calculateSmoothedPerVertexNormals(const TriangleFaces &faces, const Vectors3 &vertices)
Calculates smoothed per-vertexnormals for a given set of triangles.
static Vectors3 calculatePerFaceNormals(const TriangleFaces &faces, const Vertices &vertices, const bool counterClockWise=true)
Calculates per-face normals for a given set of triangles.
static bool calculateSmoothedPerVertexNormals(const TriangleFaces &faces, const Vectors3 &vertices, Vectors3 &normals, const Scalar creaseAngle)
Recalculates smoothed per-vertex normals for a given set of triangles with per vertex normals.
TriangleFace()
Creates a new triangle face object with undefined indices.
Definition: TriangleFace.h:188
static Vectors3 calculateSmoothedPerVertexNormals(const TriangleFaces &faces, const Vertices &vertices, const Vectors3 &perFaceNormals)
Calculates smoothed per-vertex normals for a given set of triangles and per-face normals.
bool operator==(const TriangleFace &triangleFace) const
Returns whether two triangle face objects are identical.
Definition: TriangleFace.h:247
VertexIndex index(const unsigned int index) const
Returns a specific vertex index specified by it's index inside the face.
Definition: TriangleFace.h:213
uint32_t Index32
Definition of a 32 bit index value.
Definition: Base.h:84
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
std::vector< Vertex > Vertices
Definition of a vector holding vertices.
Definition: rendering/Rendering.h:119
std::vector< TriangleFace > TriangleFaces
Definition of a vector holding triangle faces.
Definition: TriangleFace.h:23
unsigned int VertexIndex
Definition of a vertex index.
Definition: rendering/Rendering.h:71
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15