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_DECKin WGSL), just past theFOG_MAX_DECKSband pairs (9 + 2*4). - FOG_
HEADER_ WORDS - Header word count before the packed cells (
FOG_CELLS_BASEin WGSL). - FOG_
MAX_ DECKS - Max decks the shader’s
fog_maskdeck 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 whenFrameParams::fowclears. - pack_
fog_ mask - FW.3 — pack a fog mask into
fog_maskstorage-buffer words.