pub fn pack_fog_mask(
grid_index: u32,
origin_cell: [i32; 2],
width: u32,
height: u32,
decks: &[[i32; 2]],
active_deck: usize,
memory_dim: f32,
memory_desaturate: f32,
cells: &[u8],
) -> Vec<u32>Expand description
FW.3 — pack a fog mask into fog_mask storage-buffer words.
grid_index— the per-grid camera slot the shader gates on (FOG_GRID).origin_cell— grid-local cell of the buffer’s(0, 0).width/height— buffer size in cells.decks—(z_top, z_bottom)inclusive bands. Truncated toFOG_MAX_DECKS(with adebug_assert+ one-time warn): the shader only scans that many, so a taller deck stack would silently drop its top floors — the truncation is now loud.active_deck— the observer’s deck; every rendered voxel is classified against this layer regardless of its own z (so stairs and sub-floor seen through a hole read on the deck you stand on). Clamped to the deck count.cells— deck-major, row-major mask bytes (d*w*h + y*w + x).
Returns FOG_HEADER_WORDS + ceil(cells.len()/4) words.