rigComponent 0.1.1
RigKit pack API - rigComponent
Loading...
Searching...
No Matches
MeshFaces.h File Reference

Reads, welds, and tessellates the authored n-gon faces of a CMesh. More...

#include <cstdint>
#include "CMesh.h"
Include dependency graph for MeshFaces.h:

Functions

uint32_t rigkit::ecs::meshFaceCount (const CMesh &mesh)
 Authored face count (loopSizes, else triangle count).
bool rigkit::ecs::meshFaceRange (const CMesh &mesh, uint32_t face, uint32_t &begin, uint32_t &count)
 Range of one authored face in loops, or implicit triangle indices.
uint32_t rigkit::ecs::meshFaceCorner (const CMesh &mesh, uint32_t face, uint32_t corner)
 Vertex index corner of an authored face (0 .
glm::vec3 rigkit::ecs::meshFaceNormal (const CMesh &mesh, uint32_t face)
 Newell normal of an authored face (unit length).
void rigkit::ecs::meshTriangulate (CMesh &mesh)
 Fan-tessellate loops into indices.
uint32_t rigkit::ecs::meshTriangleToFace (const CMesh &mesh, uint32_t triangle)
 Map a tessellated triangle index to its authored face.
void rigkit::ecs::meshEnsureLoops (CMesh &mesh)
 If loops empty, each triangle becomes a 3-vert face (no coplanar weld).
void rigkit::ecs::meshFinishFaces (CMesh &mesh)
 Merge coincident positions, weld coplanar triangle islands into n-gons, then tessellate.
uint32_t rigkit::ecs::meshFaceEdgeCount (const CMesh &mesh, uint32_t face)
 Authored edge count of one face (same as corner count).
bool rigkit::ecs::meshFaceEdge (const CMesh &mesh, uint32_t face, uint32_t edge, uint32_t &a, uint32_t &b)
 Undirected vertex pair for one authored face edge (consecutive corners, plus close).

Detailed Description

Reads, welds, and tessellates the authored n-gon faces of a CMesh.

loops and loopSizes carry the authored faces; indices is the triangle list the renderer draws. Call meshFinishFaces after create or import so the two stay in step.

Function Documentation

◆ meshFaceCorner()

uint32_t rigkit::ecs::meshFaceCorner ( const CMesh & mesh,
uint32_t face,
uint32_t corner )

Vertex index corner of an authored face (0 .

. count-1).

◆ meshFaceEdge()

bool rigkit::ecs::meshFaceEdge ( const CMesh & mesh,
uint32_t face,
uint32_t edge,
uint32_t & a,
uint32_t & b )

Undirected vertex pair for one authored face edge (consecutive corners, plus close).

Returns
false when face / edge is out of range.

◆ meshFaceRange()

bool rigkit::ecs::meshFaceRange ( const CMesh & mesh,
uint32_t face,
uint32_t & begin,
uint32_t & count )

Range of one authored face in loops, or implicit triangle indices.

Returns
false when face is out of range.

◆ meshFinishFaces()

void rigkit::ecs::meshFinishFaces ( CMesh & mesh)

Merge coincident positions, weld coplanar triangle islands into n-gons, then tessellate.

No-op for line modes. When loops already exist, only tessellates. A cube's 12 triangles become 6 quads. Call after create / OBJ / classic import.

◆ meshTriangleToFace()

uint32_t rigkit::ecs::meshTriangleToFace ( const CMesh & mesh,
uint32_t triangle )

Map a tessellated triangle index to its authored face.

Identity when loops are empty.

◆ meshTriangulate()

void rigkit::ecs::meshTriangulate ( CMesh & mesh)

Fan-tessellate loops into indices.

No-op when loops empty.