| TGX 1.1.0 A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.

Loading...
Searching...
No Matches
Public Attributes | List of all members
tgx::Meshlet3Dv2 Struct Reference

Header for a single meshlet inside a Mesh3Dv2 object. More...

`#include <Mesh3Dv2.h>`

## Public Attributes
int16_t | sphere_center [3]
| Quantized bounding sphere center relative to the global bounding-box center.
int16_t | cone_dir [3]
| Signed-normalized quantized visibility cone direction.
uint16_t | sphere_radius
| Quantized bounding sphere radius.
int16_t | cone_cos
| Signed-normalized cone cosine. Values <= -32767 disable meshlet cone culling.
uint32_t | payload_offset32
| Offset of this meshlet payload in Mesh3Dv2::payload, in 32-bit words.
uint8_t | nb_vertices
| Number of local vertices. With the uint8_t face stream format, this must be <= 128.
uint8_t | nb_normals
| Number of local normals.
uint8_t | nb_texcoords
| Number of local texture coordinates.
uint8_t | material_index
| Index in Mesh3Dv2::materials.

## Detailed Description

Header for a single meshlet inside a Mesh3Dv2 object.

Meshlet headers are stored in a compact linear array and are read before touching the meshlet payload. This makes it possible to reject invisible meshlets quickly using the bounding sphere and visibility cone.

The sphere and cone metadata are quantized relative to the mesh global bounding box. The renderer reconstructs this metadata before it touches the meshlet payload:

bbox_center = 0.5 * (mesh.bounding_box.min + mesh.bounding_box.max)
bbox_extent = max(mesh.bounding_box size on x/y/z)
decoded_sphere_center = bbox_center + sphere_center[i] * (bbox_extent / 65534)
decoded_sphere_radius = sphere_radius * (bbox_extent / 65535)
decoded_cone_dir = cone_dir[i] * (1 / 32767)
decoded_cone_cos = cone_cos * (1 / 32767)
tgx::max
TGX_INLINE T max(const T &a, const T &b)
Don't know why but much faster than fmaxf() for floats.
Definition: Misc.h:153
tgx::Meshlet3Dv2::sphere_radius
uint16_t sphere_radius
Quantized bounding sphere radius.
Definition: Mesh3Dv2.h:101
tgx::Meshlet3Dv2::sphere_center
int16_t sphere_center[3]
Quantized bounding sphere center relative to the global bounding-box center.
Definition: Mesh3Dv2.h:98
tgx::Meshlet3Dv2::cone_cos
int16_t cone_cos
Signed-normalized cone cosine. Values <= -32767 disable meshlet cone culling.
Definition: Mesh3Dv2.h:102
tgx::Meshlet3Dv2::cone_dir
int16_t cone_dir[3]
Signed-normalized quantized visibility cone direction.
Definition: Mesh3Dv2.h:99

A `cone_cos` value below or equal to -1 disables meshlet cone culling. The payload offset is expressed in 32-bit words into Mesh3Dv2::payload. This guarantees that every meshlet payload starts on a 4-byte boundary when Mesh3Dv2::payload points to a uint32_t array. The payload generator must also pad each meshlet payload to a multiple of 4 bytes.

The documentation for this struct was generated from the following file:

- src/Mesh3Dv2.h