luft/voxel-light.lisp
Pack three local-light levels in the range 0..15 as RGB4.
Join two RGB4 values without allowing carry between color lanes.
X/Y have at most 17 bits and Z has 8. After the 8-cell page shift, 14 + 14 + 5 bits fit comfortably in a fixnum on supported hosts.
Return field's RGB4 value at an in-domain cell, or zero outside it.
Sample light at a cubical lattice point by joining its incident cells.
This canonical point-owned value is shared by every bevel primitive meeting there, so independently emitted face, band, and fan instances remain lit continuously.
Z lattice coordinates need nine bits and a maximum-size horizontal domain's far boundary is the inclusive coordinate 2^17, so each horizontal lane reserves eighteen bits.
Trilinearly sample field at an exact luft mesh-tick position.
The result remains RGB4. Sampling is a pure function of world position, so
separate face, band, fan, and attachment instances agree at shared vertices,
including the width-four medial limit where distinct site owners coincide.
When supplied, lattice-cache memoizes canonical cubical-corner readings across
many mesh points in one derived render population.
Compute immutable colored local light with a packed brightest-first frontier.
material-cells maps positive cell sites to dense material indices.
opacity-table maps those indices to entered-cell loss in 0..15. Every ordinary
step additionally costs one level. sources are values from
make-voxel-light-source; a source illuminates its own cell regardless of that
cell's opacity. Concurrent colors and sources meet by componentwise maximum.
rgb joins can retain an old bright lane while improving a dim one.
That may re-admit a value to a bucket brighter than the source being
drained, so CURRENT-PRIORITY is dynamic rather than a one-way scan.
Multiplication and scalar scaling.
Largest bounded page directory retained directly by a light field.
(red green blue)(light)(light)(light)(light)One inspectable environment light, packed into raw per-frame GPU lanes.
Extract the unsigned bit field (BYTE SIZE POSITION) of one unsigned scalar.
The maximum of compatible quantities.
(&key (horizontal-bits 6)
(x-bits horizontal-bits)
(y-bits horizontal-bits))(x y z)(x-pages y-pages x y z)(pages direct-p x-pages y-pages x y z)(pages direct-p x-pages y-pages x y z)Subtraction or unary negation.
Addition over compatible quantities.
(&optional (text *page*) (name "test"))(domain)(domain)Test whether one compatible scalar is at most another.
(field x y z)Logical conjunction of tests and raw truth values.
Test whether one compatible scalar is less than another.
(field cell)(domain site)Test whether two compatible scalars are equal.
(site)(site)(site)(site)(field x y z)Sample light at a cubical lattice point by joining its incident cells. This canonical point-owned value is shared by every bevel primitive meeting there, so independently emitted face, band, and fan instances remain lit continuously.
Headings, paragraphs, figures and their IDs, mentions, marks.
(field tick-x tick-y tick-z &optional lattice-cache)Trilinearly sample FIELD at an exact LUFT mesh-tick position. The result remains RGB4. Sampling is a pure function of world position, so separate face, band, fan, and attachment instances agree at shared vertices, including the width-four medial limit where distinct site owners coincide. When supplied, LATTICE-CACHE…
The minimum of compatible quantities.
Raise a dimensionless value to a dimensionless power.
(cell light)(&key (code t))(site)(source)(source)(light loss)(material-cells opacity-table cell)(domain material-cells opacity-table sources &key (revision 0))Compute immutable colored local light with a packed brightest-first frontier. MATERIAL-CELLS maps positive cell sites to dense material indices. OPACITY-TABLE maps those indices to entered-cell loss in 0..15. Every ordinary step additionally costs one level. SOURCES are values from MAKE-VOXEL-LIGHT-SOURCE; a source…
Logical disjunction of tests and raw truth values.
(domain x y z &optional (extent +vertex-extent+) (polarity 1))Pack a canonical site inside DOMAIN's box. No coordinate wraps: anchors range over [0, limit] per horizontal axis, and a site extending along an axis cannot begin on that axis's far boundary.
luft-- sparse colored voxel lightLocal light is an immutable derived field over cells. Its semantic boundary is RGB4, while its physical storage is a sparse set of 8^3 u16 pages. A brightest-first packed frontier computes the componentwise-max fixpoint without allocating coordinate objects in the hot loop.