luvcraft/world-tests.lisp
A resident chunk is still world-owned: lower-level writes must also invalidate world-derived products such as meshes.
Interior content changes do not invalidate neighbor-derived products.
A transaction containing only no-op assignments is itself a no-op.
Both chunks are closed by the same vocabulary, so the same block has the same index everywhere and palettes are one shared vector.
A column produced under another world's vocabulary is translated in place when it is installed, and new members are appended, not moved.
do-chunk-site-neighbors validates a site once and steps primitively;
it must expose exactly the offsets, crossings, and window results of the
checked do-chunk-window-neighbors at every site of a small domain,
consulting the window only at crossings. #FGT96H
(name &key site-kind value-type quantity missing-value
legal-values representation)(left right)Logical conjunction of tests and raw truth values.
Test whether two compatible scalars are equal.
(&key (id (gensym "VOXEL-SPACE-"))
(chunk-shape (make-chunk-shape))
(cell-extent 1d0))(&key (width 16) (height 16) (depth 16))(space coordinate)(x y z)(x y z)(space coordinate)Decompose COORDINATE by Euclidean division in SPACE. The local result is always non-negative, including for negative world coordinates.
(space chunk local)(record slot-name)(declaration)Return DECLARATION's homogeneous quantity specification, or NIL.
(left right)Logical negation of one test or raw truth value.
(unit)(&optional designator)Return a canonical unit expression from NIL, a defined unit, or factors. Every symbolic factor must have a semantic unit definition. Exact unit identity remains visible here; conversions are requested separately.
(&key (id (gensym "BLOCK-WORLD-"))
(chunk-width 16)
(chunk-height 16)
(chunk-depth 16)
(cell-extent 1d0)
source)(world x y z)One top-level defining form of a source file.
(materialization field-name)Return the definition object retained by MATERIALIZATION for FIELD-NAME.
(materialization field-name)Return MATERIALIZATION's retained representation for FIELD-NAME.
(representation)Return the finite site domain bound to REPRESENTATION.
(materialization field-name)(space coordinate)(x y z)(domain)(domain local)(x y z)(domain offset)(domain)(domain local)(domain local direction)Step from one local site in a primitive face direction. Return the destination OFFSET and wrapped LOCAL-COORDINATE, followed by DIRECTION when the step crosses into that adjacent chunk or NIL when it stays inside DOMAIN.
((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.
((offset local domain direction &optional result) &body body)Execute BODY for every site on DIRECTION's boundary face in DOMAIN. LOCAL is a DYNAMIC-EXTENT LOCAL-COORDINATE and must not be retained after BODY returns.
(dx dy dz)(world x y z)Return one site as BLOCK and :RESIDENT, or NIL and :ABSENT. This sparse world-coordinate accessor constructs coordinate descriptors and a chunk lookup key. It is appropriate for inspectors, ray hits, collision probes, and sparse interaction. Algorithms over many cells should select a chunk/domain once and use…
(chunk offset)(chunk direction)((domain palette indices) chunk &body body)(scheme)(function chunk)Describe each site to FUNCTION as BLOCK and LOCAL-COORDINATE. This row-shaped convenience protocol is for presentation and irregular local work. Whole-domain algorithms should use WITH-BLOCK-CONTENT-STORAGE.
(chunk x y z)(world x y z)((world) &body body)(world)(world x y z content)Install transferred block-content storage as a newly resident chunk. The caller gives WORLD ownership of CONTENT and must not mutate it afterward. CONTENT is a BLOCK-CONTENT-COLUMN. Installation rebinds that aggregate to the authoritative resident domain and WORLD's vocabulary, translating its indices in place if it…
Test whether one compatible scalar is greater than another.
(vocabulary block &optional (intern-p t))Return BLOCK's dense offset, appending it when INTERN-P and it is new. Return NIL for an unknown block when INTERN-P is false.
(vocabulary)(world origin direction occupied-p &key max-distance)Trace a ray through WORLD's resident lattice. Return a BLOCK-RAY-HIT and :HIT, NIL and :ABSENT when traversal reaches a non-resident chunk, or NIL and :MISS. ORIGIN and DIRECTION are VEC3 values in continuous cell coordinates. The caller owns and must supply the maximum ray distance appropriate to its interaction.
((offset crossing direction materialization availability
window domain site-offset directions &optional result)
&body body)Execute BODY for the DIRECTIONS neighboring the site at SITE-OFFSET. This is the trusted-scope counterpart of DO-CHUNK-WINDOW-NEIGHBORS for a site already proved to belong to DOMAIN, such as one popped from a packed frontier. DOMAIN and SITE-OFFSET are validated once; the shape's dimensions and the site's components…
((offset destination crossing direction materialization availability
window domain local directions &optional result)
&body body)Execute BODY for the DIRECTIONS neighboring LOCAL through WINDOW. DIRECTIONS is the caller's explicit neighborhood policy. DESTINATION has dynamic extent on each iteration and must be copied before BODY retains it. Interior steps remain domain arithmetic; window dispatch occurs only at an actual chunk crossing.…
Intent: preserve checked public domain stepping while avoiding the same bounds and coordinate type validation for each of a trusted worklist site's six neighbors. The packed frontier already proves its entry and offset; adjacency should validate that site once, then keep primitive steps inside the checked scope.…
Retaining
localis valid in this presentation protocol; the dense traversal macro itself instead lends a dynamic-extent value.