23static_assert(
sizeof(
FVertex) == 48);
32 static void UnpackTBN(uint32_t packed,
float3& outNormal,
float3& outTangent,
float& outBitangentSign);
37static_assert(
sizeof(
FQVertex) == 16);
86static_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:95
float3 center
Definition Mesh.hpp:94
uint32_t aliasOffset
Definition Mesh.hpp:91
uint32_t meshletIndex
Definition Mesh.hpp:90
float area
Definition Mesh.hpp:93
uint32_t triCount
Definition Mesh.hpp:92
Vector< GSAlias > emissiveAliases
Definition Mesh.hpp:146
DAG(Allocator *alloc)
Definition Mesh.hpp:148
Vector< FEmissiveMeshlet > emissiveMeshlets
Definition Mesh.hpp:145
Vector< FMeshlet > meshlets
Definition Mesh.hpp:142
Vector< uint32_t > emissivePrimitiveMap
Definition Mesh.hpp:147
Vector< uint32_t > meshletVtx
Definition Mesh.hpp:144
Vector< FLODGroup > groups
Definition Mesh.hpp:141
Vector< uint8_t > meshletTri
Definition Mesh.hpp:143
LOD(Allocator *alloc)
Definition Mesh.hpp:136
Vector< uint32_t > indices
Definition Mesh.hpp:135
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:184
Vector< FQVertex > verticesQuantized
Definition Mesh.hpp:131
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:130
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:138
bool EnsureQuantized()
Prepares quantized GPU data buffers from possibly full-precision, or compressed data.
Definition Mesh.cpp:414
Vector< FSkinBinding > skin
Definition Mesh.hpp:132
bool IsRaw() const
Definition Mesh.hpp:189
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:55
float error
Definition Mesh.hpp:59
float3 center
Definition Mesh.hpp:54
int depth
Definition Mesh.hpp:51
uint32_t refined
Definition Mesh.hpp:70
uint32_t triOffset
Definition Mesh.hpp:75
uint32_t vtxCount
Definition Mesh.hpp:78
float3 coneApex
Definition Mesh.hpp:84
uint32_t vtxOffset
Definition Mesh.hpp:74
uint32_t group
Definition Mesh.hpp:67
float4 coneAxisAngle
Definition Mesh.hpp:83
float4 centerRadius
Definition Mesh.hpp:82
uint32_t triCount
Definition Mesh.hpp:79
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:102
FBlobRef indices
Definition Mesh.hpp:101
FBlobRef emissivePrimitiveMap
Definition Mesh.hpp:118
FSerializedBounds bounds
Definition Mesh.hpp:108
FBlobRef skinBinding
Definition Mesh.hpp:119
FUUID skeleton
Definition Mesh.hpp:120
uint32_t vertexCount
Definition Mesh.hpp:110
FSerializedMesh(Allocator *alloc=GLOBAL_ALLOC)
Definition Mesh.hpp:122
FBlobRef emissiveMeshlets
Definition Mesh.hpp:116
FBlobRef dagMeshlets
Definition Mesh.hpp:113
Vector< FSerializedMeshLOD > lods
Definition Mesh.hpp:111
FBlobRef dagMeshletVtx
Definition Mesh.hpp:115
FBlobRef vertices
Definition Mesh.hpp:109
FBlobRef emissiveAliases
Definition Mesh.hpp:117
FBlobRef dagGroups
Definition Mesh.hpp:112
FBlobRef dagMeshletTri
Definition Mesh.hpp:114
uint16_t joints[4]
Definition Mesh.hpp:43
float weights[4]
Definition Mesh.hpp:44
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