Foundation
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
Mesh.cpp File Reference
#include <meshoptimizer.h>
#include <clusterlod.h>
#include <Math/Quantize.hpp>
#include "Mesh.hpp"
#include <cmath>

Classes

struct  DAGCluster
 

Macros

#define CLUSTERLOD_IMPLEMENTATION
 

Functions

void CoordinateSystem (float3 n, float3 &b1, float3 &b2)
 
float2 PackUnitOctahedralSnorm (float3 v)
 
float3 UnpackUnitOctahedralSnorm (float2 v)
 
float PackUnitCircleSnorm (float2 v)
 
float2 UnpackUnitCircleSnorm (float v)
 
void RecomputeNormals (Span< FVertex > verts, Span< const uint32_t > indices)
 Recomputes smooth per-vertex normals from positions over an indexed triangle list.
 
template<typename Vertex , typename Index >
void OptimizeVertexIndex (Vector< Vertex > &vertices, Vector< Index > &indices)
 
template<typename Vertex , typename Index >
float GenerateLOD (Vector< Index > &outIndices, Span< const Vertex > vertices, Span< const Index > indices, const float lodScale)
 
template<typename Vertex , typename Index >
void BuildMeshlets (Vector< FMeshlet > &outMeshlet, Vector< Index > &outMeshletVertices, Vector< uint8_t > &outMeshletTriangles, Span< const Vertex > vertices, Span< const Index > indices)
 

Variables

constexpr float EPS = 1e-6
 

Macro Definition Documentation

◆ CLUSTERLOD_IMPLEMENTATION

#define CLUSTERLOD_IMPLEMENTATION

Function Documentation

◆ BuildMeshlets()

template<typename Vertex , typename Index >
void BuildMeshlets ( Vector< FMeshlet > &  outMeshlet,
Vector< Index > &  outMeshletVertices,
Vector< uint8_t > &  outMeshletTriangles,
Span< const Vertex >  vertices,
Span< const Index >  indices 
)

◆ CoordinateSystem()

void CoordinateSystem ( float3  n,
float3 b1,
float3 b2 
)

◆ GenerateLOD()

template<typename Vertex , typename Index >
float GenerateLOD ( Vector< Index > &  outIndices,
Span< const Vertex >  vertices,
Span< const Index >  indices,
const float  lodScale 
)

◆ OptimizeVertexIndex()

template<typename Vertex , typename Index >
void OptimizeVertexIndex ( Vector< Vertex > &  vertices,
Vector< Index > &  indices 
)

◆ PackUnitCircleSnorm()

float PackUnitCircleSnorm ( float2  v)

◆ PackUnitOctahedralSnorm()

float2 PackUnitOctahedralSnorm ( float3  v)

◆ RecomputeNormals()

void RecomputeNormals ( Span< FVertex verts,
Span< const uint32_t >  indices 
)

Recomputes smooth per-vertex normals from positions over an indexed triangle list.

Area-weighted face-normal accumulation, then normalize. Needed after POSITION-only morph deformation (which moves vertices without supplying normals); run it on the morphed vertices before packing/skinning so shading matches the deformed surface. Tangents are left as-is (re-projected onto the new normal frame by FQVertex::PackTBN).

◆ UnpackUnitCircleSnorm()

float2 UnpackUnitCircleSnorm ( float  v)

◆ UnpackUnitOctahedralSnorm()

float3 UnpackUnitOctahedralSnorm ( float2  v)

Variable Documentation

◆ EPS

constexpr float EPS = 1e-6
constexpr