Skip to main content

Module fow

Module fow 

Source
Expand description

FW.3 — the fog-of-war fog_mask storage-buffer packer, owned here (the crate that owns the WGSL FOG_* constants) so the header layout has ONE source. roxlap-render and the headless tests both call pack_fog_mask instead of hand-rolling the header — a layout change lands in one place, not three.

Buffer layout (mirrors scene_dda.wgsl’s FOG_* consts): word 0 FOG_ENABLED (0 = off) · 1 FOG_GRID (per-grid slot) · 2 FOG_DECKS_N · 3–4 origin cell (i32) · 5 width · 6 height · 7–8 memory_dim/memory_desaturate (f32 bits) · 9.. up to FOG_MAX_DECKS (z_top, z_bottom) i32 pairs · then FOG_ACTIVE_DECK (the observer’s deck — every voxel is classified against it, not its own z) · FOG_HEADER_WORDS.. deck-major, row-major mask bytes packed 4 cells / u32.

Constants§

FOG_ACTIVE_DECK
Word index of the observer’s active deck (FOG_ACTIVE_DECK in WGSL), just past the FOG_MAX_DECKS band pairs (9 + 2*4).
FOG_HEADER_WORDS
Header word count before the packed cells (FOG_CELLS_BASE in WGSL).
FOG_MAX_DECKS
Max decks the shader’s fog_mask deck loop scans (FOG_MAX_DECKS).

Functions§

disabled_fog_mask
FW.3 — the disabled fog buffer (FOG_ENABLED == 0): the shader reads one word and skips, so a scene with no fog is byte-identical. Bound as the dummy at build and written when FrameParams::fow clears.
pack_fog_mask
FW.3 — pack a fog mask into fog_mask storage-buffer words.