luvcraft/frontier-light.lisp
The local law of voxel light. LEVEL is the relaxed best-known field,
bound to the sky or block lane at realization; opacity is the entered
cell's attenuation. A relation transfers the source level minus the
propagation loss, admits a strict improvement, and schedules it at its
own brightness. Those three are the monotone family's meaning; only the
transfer needs stating.
Field bindings close the program over the light region's storage: each role names the lanes it borrows from a materialization (a light region entry) and how one offset is read or written through them.
Return the current realization of the light program over field-name.
The compiled solver. Seeds and drains both go through the realization: a sky boundary is a virtual source at full brightness whose loss follows the same law, and an emitter is a value joined into the block field.
Relate open sky into every open face of region's entries, or of entry.
Open sky is a virtual source at full brightness beyond the face; the relation into the entry runs the other way. The program's own transfer law decides the level and admission. #581ZQP
Solve region from scratch with the compiled voxel-light realization. #PJY6E1
Invalidation. Removing a source, an occluder's disappearance being an addition, or a departed neighbour can leave levels that no surviving source justifies. The removal program clears every level the removed site fed--strictly dimmer, or equal for direct sky continuing down--and re-admits the cleared site at the level it had; a lit neighbour it did not feed is handed to the addition frontier as a surviving source. The cleared set is the execution's retained admissions. #K3WRD3 #DURBKN
The frontiers and executions of one compiled incremental relight.
Clear both fields at ENTRY/OFFSET and admit them for removal.
Clear and admit for removal every lit site on entry's direction face.
Run both removal programs; survivors land in the addition frontiers.
Call function with ENTRY and OFFSET for every site execution cleared.
Join ENTRY/OFFSET's own emission back into the block field.
Relate open sky back into ENTRY/OFFSET if it sits on an open face.
Seed a newly resident chunk and reschedule its neighbours' facing sites.
Settle state's dirty cells, departures, and arrivals over candidate region
with the compiled removal and addition programs. Return the executions and
the total visits. #K3WRD3
(name &rest options
&key family frontier-layout neighborhood fields constants predicates
transfer admission priority retain-admissions)Subtraction or unary negation.
Assert that a raw or foreign value is measured in a program field's quantity.
(field-name)(entry)(name &key declaration lanes read write lazy)Multiplication and scalar scaling.
(slot-name)(field-name)Logical conjunction of tests and raw truth values.
(realization)(program &key bindings site-domain (compile t))Close PROGRAM over field BINDINGS and emit its scalar realization. SITE-DOMAIN is a form over MATERIALIZATION yielding the chunk domain that gives a site's dense offset spatial meaning. Each field role of the program must have one FRONTIER-FIELD-BINDING. The laws are parsed and quantity checked against the bound…
(name)Notify retained realizations that program NAME changed.
(realization region frontier execution &key key entry)Logical negation of one test or raw truth value.
(region coordinate direction)(region key direction)(direction)(entry direction function)Call FUNCTION with OFFSET and borrowed LOCAL for one face of ENTRY. LOCAL has dynamic extent and must be copied before FUNCTION retains it.
(realization window frontier execution materialization offset direction
&rest arguments)Expose one relation into MATERIALIZATION/OFFSET from a virtual source. ARGUMENTS supply the program's constants and, keyed by role name, the source field values the transfer reads; DIRECTION is the relation's direction as seen from that source. The target is tested, committed, and admitted by the same law as an…
(realization region frontier execution)((offset local domain &optional result) &body body)Execute BODY for every site in DOMAIN, in dense storage order. LOCAL is a DYNAMIC-EXTENT LOCAL-COORDINATE and must not be retained after BODY returns. This gives dense algorithms a nominal coordinate without one heap allocation per site. See #B3UEVE.
(realization window frontier execution materialization offset value
&rest constants)Seed one site through the program's admission and commit law. For a monotone program VALUE joins the relaxed field; for a discover-once program VALUE is ignored. Return whether the site was admitted.
(realization &key (initial-capacity 256))(realization input frontier)((name &key (tracy-value nil tracy-value-supplied-p)) &body body)Measure BODY as nested zone NAME for whichever measurement is watching. TRACY-VALUE, when supplied, is attached to the Tracy zone at exit. It does not affect the bounded CPU trace, whose zones retain time and runtime costs. Two independent things may be: a Tracy viewer attached to this image, and an opt-in…
(realization window frontier execution &rest arguments)Run the compiled program until FRONTIER is empty; return EXECUTION. ARGUMENTS are the program's constants as keywords. A program whose family hands sites to a companion frontier, such as invalidation's surviving sources, takes that frontier as the first argument before the keywords.
Addition over compatible quantities.
(solver region &key &allow-other-keys)Solve captured REGION with the explicitly implemented voxel-light SOLVER. There is deliberately no default method: unsupported solver names signal instead of silently selecting another implementation.
Logical disjunction of tests and raw truth values.
Test whether one compatible scalar is less than another.
Test whether two compatible scalars are equal.
(field-name)(reconciliation entry offset)(reconciliation entry direction)(reconciliation)(function execution)(reconciliation entry offset)(domain x y z)Test whether one compatible scalar is at most another.
(reconciliation entry offset)(domain offset)(reconciliation key)(world coordinate)(region chunk &key from-field-p copy-content-p)(coordinate direction)(realization frontier execution materialization offset priority)Push MATERIALIZATION/OFFSET at PRIORITY for reconsideration, without law. This is the frontier word for a site whose value already stands but whose relations must be exposed again, such as a resident chunk's face when a neighbour arrives. It is not an admission and is not retained.
(reconciliation)(solver state region)Settle STATE's dirty cells, departures, and arrivals over candidate REGION with the explicitly implemented incremental relighter named by SOLVER. There is deliberately no default method: unsupported names signal rather than falling back to a different algorithm. #K3WRD3
(state region)Settle STATE's dirty cells, departures, and arrivals over candidate REGION with the compiled removal and addition programs. Return the executions and the total visits. #K3WRD3
(queue swapchain image-index
&key (wait-semaphores #()) present-id present-stage time-domain-id
target-time target-time-domain-present-stage)(region coordinate)Intent: let the realization admit a virtual open-sky source through the program's own transfer law, so seeding stops restating the loss arithmetic in client code and a boundary is just a relation whose source is not a site. Evidence: every realization now also emits a relate entry (relate-frontier-realization-site):…
Intent: turn the manually staged frontier-light proof into the smallest real compiler path described by #53Q1II. Reify the local transfer, join, admission, and priority arithmetic with checked field meanings; make the program definition drive a scalar execution plan; and emit one closed Lisp loop over bound raw…
The workloads fall into at least three algorithmic families. – Discover once. Connected components and terminal-wall assembly usually assign each reachable site once for one source revision. A visited bit or component memo prevents repeated work. – Relax monotonically. Distances, influence, and light addition keep…
Intent: state removal and incremental reconsideration in the same compiled vocabulary after the monotone kernel establishes its source and lowering boundary. Evidence: #ZEENY3. voxel-light-removal is an :invalidation program whose compiled drain reads like unlight-light-region but is emitted from the family and the…
Production voxel light stated and lowered as frontier programs.