Skip to main content

Module rt_geom

Module rt_geom 

Source
Expand description

GPU-free builders for the ray-tracing geometry table plus the dynamic-update mode ladder, shared by the backends that hardware-ray-trace reflections. Each backend fills its own RtGeomEntry table from the participating draw set; the per-entry packing (index slice, resolved shared-pool texture indices, material, model matrix) is identical across backends and lives here. The per-backend TLAS instance transform (MTLPackedFloat4x3 / VkTransformMatrixKHR / DXR [f32; 12]) is a real hardware type and stays in each backend.

Enums§

RtDynamicMode
How the scene acceleration structure is kept current when props move. Selected once at init from the launch’s --rt-dynamic request; Auto is the shipping behaviour and what an unset request resolves to.

Functions§

cluster_geom_entry
Build the geometry-table entry for one instance of an instanced cluster: the cluster’s shared mesh slice + material, with this instance’s transform. Cluster geometry uses base_vertex 0 (its indices are already absolute).
geom_entry
Build the geometry-table entry for one static draw object.
models_dirty
True when any participating object’s current model matrix differs from the one baked into the live TLAS. Pure (no GPU) so the dirty gate is unit-testable.
skinned_geom_entry
Build the geometry-table entry for one skinned object. The skinned BLAS is baked from the posed (model-space) deformed buffer with absolute u16 indices, so base_vertex is 0 and the model matrix brings the hit to world space. The skinned flag is OR’d into normal_index so the trace fetches from the deformed / u16 buffers. Albedo / normal resolve through the shared pool by the object’s texture_slot / normal_map_slot, so skinned hits shade textured like static ones (the flag bit lives above any valid pool index).
skinned_index_buffer_bytes
Bytes to allocate for the shared u32 skinned index buffer holding index_count indices. One index per word, so the only rounding left is the floor: no backend accepts a zero-length buffer.