23static_assert(
sizeof(
FVertex) == 48);
32 static void UnpackTBN(uint32_t packed,
float3& outNormal,
float3& outTangent,
float& outBitangentSign);
37static_assert(
sizeof(
FQVertex) == 16);
80static_assert(
sizeof(
FMeshlet) == 68);
#define GLOBAL_ALLOC
Definition Allocator.hpp:240
float3 UnpackUnitOctahedralSnorm(float2 v)
Definition Mesh.cpp:35
float PackUnitCircleSnorm(float2 v)
Definition Mesh.cpp:42
float2 UnpackUnitCircleSnorm(float v)
Definition Mesh.cpp:47
void RecomputeNormals(Span< FVertex > verts, Span< const uint32_t > indices)
Recomputes smooth per-vertex normals from positions over an indexed triangle list.
Definition Mesh.cpp:53
float2 PackUnitOctahedralSnorm(float3 v)
Definition Mesh.cpp:28
constexpr uint32_t kMeshletMaxTriangles
Definition Mesh.hpp:12
void CoordinateSystem(float3 n, float3 &b1, float3 &b2)
Definition Mesh.cpp:13
constexpr uint32_t kMeshletMaxVertices
Definition Mesh.hpp:11
Allocator interface (noexcept)
Definition Allocator.hpp:29
std::vector< T, StlAllocator< T > > Vector
std::vector with explicit Foundation::Core::StlAllocator constructor
Definition Container.hpp:149
std::span< T > Span
Alias for std::span
Definition Container.hpp:62
vec2 float2
Definition Math.hpp:27
vec3 float3
Definition Math.hpp:26
vec4 float4
Definition Math.hpp:25
Definition Allocator.hpp:6
Definition Serialization.hpp:27
float radius
Definition Mesh.hpp:89
float3 center
Definition Mesh.hpp:88
uint32_t aliasOffset
Definition Mesh.hpp:85
uint32_t meshletIndex
Definition Mesh.hpp:84
float area
Definition Mesh.hpp:87
uint32_t triCount
Definition Mesh.hpp:86
Vector< GSAlias > emissiveAliases
Definition Mesh.hpp:137
DAG(Allocator *alloc)
Definition Mesh.hpp:139
Vector< FEmissiveMeshlet > emissiveMeshlets
Definition Mesh.hpp:136
Vector< FMeshlet > meshlets
Definition Mesh.hpp:133
Vector< uint32_t > emissivePrimitiveMap
Definition Mesh.hpp:138
Vector< uint32_t > meshletVtx
Definition Mesh.hpp:135
Vector< FLODGroup > groups
Definition Mesh.hpp:132
Vector< uint8_t > meshletTri
Definition Mesh.hpp:134
LOD(Allocator *alloc)
Definition Mesh.hpp:127
Vector< uint32_t > indices
Definition Mesh.hpp:126
void Optimize()
Optimize vertex reuse with meshoptimizer.
Definition Mesh.cpp:439
struct FImportedMesh::DAG dag
bool EnsureRaw()
Prepares full-precision data for CPU access.
Definition Mesh.cpp:426
void Dequantize()
Dequantizes quantized vertex back into full precision representation Fills rawVertices with dequantiz...
Definition Mesh.cpp:139
bool IsQuantized() const
Definition Mesh.hpp:175
Vector< FQVertex > verticesQuantized
Definition Mesh.hpp:123
size_t CalculateQuantizedBound(bool lod, bool dag) const
Returns a lower bound estimate of the size of the quantized mesh data. The size is conservative in th...
Definition Mesh.cpp:399
Vector< FVertex > vertices
Definition Mesh.hpp:122
void SimplifyLOD(int levels, float scale)
Creates N LOD levels, iteratively scaling down by 'scale' factor and populates lods index data.
Definition Mesh.cpp:223
Vector< LOD > lods
Definition Mesh.hpp:129
bool EnsureQuantized()
Prepares quantized GPU data buffers from possibly full-precision, or compressed data.
Definition Mesh.cpp:414
bool IsRaw() const
Definition Mesh.hpp:180
void ClusterizeDAG()
Partitions the clusters of LOD levels into a DAG.
Definition Mesh.cpp:241
void Quantize()
Quantizes vertex data into more compact representation Fills quantizedVertices with quantized data fr...
Definition Mesh.cpp:133
float radius
Definition Mesh.hpp:49
float error
Definition Mesh.hpp:53
float3 center
Definition Mesh.hpp:48
int depth
Definition Mesh.hpp:45
uint32_t refined
Definition Mesh.hpp:64
uint32_t triOffset
Definition Mesh.hpp:69
uint32_t vtxCount
Definition Mesh.hpp:72
float3 coneApex
Definition Mesh.hpp:78
uint32_t vtxOffset
Definition Mesh.hpp:68
uint32_t group
Definition Mesh.hpp:61
float4 coneAxisAngle
Definition Mesh.hpp:77
float4 centerRadius
Definition Mesh.hpp:76
uint32_t triCount
Definition Mesh.hpp:73
static FVertex Unpack(FQVertex const &vertex)
Definition Mesh.cpp:122
uint32_t tbn32
Definition Mesh.hpp:28
static void UnpackTBN(uint32_t packed, float3 &outNormal, float3 &outTangent, float &outBitangentSign)
Definition Mesh.cpp:96
static uint32_t PackTBN(const float3 &normal, const float3 &tangent, float bitangentSign)
Definition Mesh.cpp:79
uint16_t uv[2]
Definition Mesh.hpp:29
uint16_t position[4]
Definition Mesh.hpp:27
static FQVertex Pack(FVertex const &vertex)
Definition Mesh.cpp:111
Definition Metadata.hpp:14
uint32_t indexCount
Definition Mesh.hpp:96
FBlobRef indices
Definition Mesh.hpp:95
FBlobRef emissivePrimitiveMap
Definition Mesh.hpp:112
FSerializedBounds bounds
Definition Mesh.hpp:102
uint32_t vertexCount
Definition Mesh.hpp:104
FSerializedMesh(Allocator *alloc=GLOBAL_ALLOC)
Definition Mesh.hpp:114
FBlobRef emissiveMeshlets
Definition Mesh.hpp:110
FBlobRef dagMeshlets
Definition Mesh.hpp:107
Vector< FSerializedMeshLOD > lods
Definition Mesh.hpp:105
FBlobRef dagMeshletVtx
Definition Mesh.hpp:109
FBlobRef vertices
Definition Mesh.hpp:103
FBlobRef emissiveAliases
Definition Mesh.hpp:111
FBlobRef dagGroups
Definition Mesh.hpp:106
FBlobRef dagMeshletTri
Definition Mesh.hpp:108
float3 tangent
Definition Mesh.hpp:19
float2 uv
Definition Mesh.hpp:21
float3 position
Definition Mesh.hpp:17
float bitangentSign
Definition Mesh.hpp:20
float3 normal
Definition Mesh.hpp:18
128-bit identifier. Two flavors, both well-formed per RFC 9562:
Definition UUID.hpp:35