Expand description
Per-voxel world queries against a .vxl column-slab world.
Port of voxlap’s getcube (voxlap5.c:937-962) — the engine’s
random-access voxel lookup. Used by sphere/region edits
(meltsphere, setrect, etc.) and any logic that needs to ask
“what’s at (x, y, z)?” without going through a ray cast.
Voxlap’s slab format (mirroring roxlap-formats::vxl):
slab record:
byte 0 nextptr — advance to next slab in dwords (== 0 last slab)
byte 1 z1 — top z of floor-colour list
byte 2 z1c — bottom z of floor-colour list MINUS 1
byte 3 z0 — ceiling z (additional slabs); dummy in first
<floor colours> (z1c - z1 + 1) × 4 bytes (BGRA each)
<ceil colours> n_ceil × 4 bytes — ceiling colours of the *next*
slab (i.e. visible bottom of *this* slab's
solid mass, observed from inside the air pocket
between this slab and the next).The ceiling colours sit between this slab’s floor colours and the
next slab’s header — so they’re addressed at negative offsets
from the next slab’s header, which is what voxlap’s getcube
exploits via &v[(z - v[3]) * 4] with z < v[3].
n_ceil is derived as n_ceil = nextptr - 2 - (z1c - z1). Voxlap
stores the negative of this as ceilnum = z1c - z1 - nextptr + 2
and uses it as a signed comparison threshold.
Enums§
Functions§
- getcube
- Look up the voxel at
(x, y, z)in a column-slab world.