luv

Workshop wiki

tests.lisp

luft/render/tests.lisp

system luft/render/test · 73 definitions · on GitHub

defpackage#:luft.render.tests
:use#:cl#:rove
:local-nicknames
#:clim#:clim
#:climi#:clim-internals
#:luv#:luv
#:production#:luv.production
#:render#:luft.render
in-package#:luft.render.tests
defunmake-two-chunk-streaming-scene
let
builder

These cells share a face across the X chunk boundary.

deftesta-streaming-mesh-request-owns-an-immutable-residency-snapshot
let*
setf
gethashleft
luft.render::streaming-scene-loadedscene
t
let*
request
make-instance'luft.render::streaming-mesh-request:keyleft:snapshotsnapshot
before
luft.render::prepared-render-mesh-mesh
setf
gethashright
luft.render::streaming-scene-loadedscene
t

The old request remains independently executable, while a current oracle observes and closes the newly resident cross-chunk seam.

ok
equalp
luft:surface-mesh-face-instance-wordsbefore
luft:surface-mesh-face-instance-words
luft.render::prepared-render-mesh-mesh
ok
not
equalp
luft:surface-mesh-face-instance-wordsbefore
luft:surface-mesh-face-instance-words
deftesta-streaming-residency-cohort-publishes-only-when-complete
let*
setf
gethashleft
luft.render::streaming-scene-loadedscene
t
gethashright
luft.render::streaming-scene-loadedscene
t
luft.render::streaming-scene-cohortscene
listleftright
flet
request
keyticket
let
setf
production:production-request-ticketrequest
ticket
gethashkey
luft.render::streaming-scene-outstandingscene
ticket
request
let
left-request
requestleft1
right-request
requestright2
ok
equal
list
consleft:left-mesh
consright:right-mesh
deftesta-streaming-window-uses-detail-medial-and-merged-medial-rings
let
builder
dotimes
chunk-x7
let*
scene
render:make-streaming-scene:residency-radius3:lod-radius1:merge-radius2
system
unwind-protect
progn
ok
=49
hash-table-count
luft.render::streaming-scene-loadedscene
ok
=9
loopforwidthbeingthehash-valuesof
luft.render::streaming-scene-loadedscene
count
ok
=40
loopforwidthbeingthehash-valuesof
luft.render::streaming-scene-loadedscene
count
ok
=24
loopformerge-pbeingthehash-valuesof
luft.render::streaming-scene-mergedscene
countmerge-p
let*
request
make-instance'luft.render::streaming-mesh-request:keykey:snapshotsnapshot
setf
gethashkey
luft.render::streaming-scene-loadedscene
4
deftesta-planar-chunk-merges-a-four-by-four-slab-into-six-rectangles
let
builder
loopforyfrom4below8do
loopforxfrom4below8do
let*
chunks
make-hash-table:test#'eql
luft:map-chain-chunks
lambda
setf
gethashchunk-keychunks
chain
luft.render::scene-solidscene
handler-bind
luft:missing-chunk
lambda
condition
declare
ignorecondition
invoke-restart'luft:treat-as-air
luft:outside-domain
lambda
condition
declare
ignorecondition
invoke-restart'luft:treat-as-air
deftesta-planar-chunk-keeps-a-tall-cliff-in-one-rectangle
let
builder
let*
luft:map-chain-chunks
lambda
when
setfchunkchain
luft.render::scene-solidscene
handler-bind
luft:missing-chunk
lambda
condition
declare
ignorecondition
invoke-restart'luft:treat-as-air
luft:outside-domain
lambda
condition
declare
ignorecondition
invoke-restart'luft:treat-as-air
let
mesh
luft:mesh-chunkchunkkey:planar-merge-pt
ok
find
luft:surface-mesh-template-vertex-wordsmesh
deftestcoplanar-compression-keeps-the-medial-chunk-surface-exact
let
builder
loopforxfrom4below12do
loopforyfrom4below12do
let*
luft:map-chain-chunks
lambda
when
setfchunkchain
luft.render::scene-solidscene
handler-bind
luft:missing-chunk
lambda
condition
declare
ignorecondition
invoke-restart'luft:treat-as-air
luft:outside-domain
lambda
condition
declare
ignorecondition
invoke-restart'luft:treat-as-air
deftesta-pure-lod-shift-remeshes-only-chunks-whose-tier-changed
let
builder
dotimes
chunk-x4
let*
unwind-protect
progn

Model completion of the initial cohort; tickets already in the worker are harmless because the second scheduling supersedes every changed key with a newer ticket.

setf
luft.render::streaming-scene-cohortscene
nil
luft.render::streaming-scene-removalsscene
nil
clrhash
luft.render::streaming-scene-outstandingscene
ok
=6
length
luft.render::streaming-scene-cohortscene
ok
=9
loopforwidthbeingthehash-valuesof
luft.render::streaming-scene-loadedscene
count
ok
=7
loopforwidthbeingthehash-valuesof
luft.render::streaming-scene-loadedscene
count
deftesthighland-landscape-is-deterministic-and-regionally-varied
let*
size256
heights
loopforxbelowsizeby8append
loopforybelowsizeby8collect
again
loopforxbelowsizeby8append
loopforybelowsizeby8collect
ok
equalheightsagain
ok
>=
-
reduce#'maxheights
reduce#'minheights
24
ok
>=
length
remove-duplicatesheights
20
ok
not
equalheights
loopforxbelowsizeby8append
loopforybelowsizeby8collect
deftesthighland-landscape-streams-by-default
let
ok
=3
luft.render::streaming-scene-residency-radiusscene
ok
=1
luft.render::streaming-scene-lod-radiusscene
ok
=2
luft.render::streaming-scene-merge-radiusscene
ok
=1
hash-table-count
luft.render::streaming-scene-storescene
deftestretargeting-replaces-one-complete-residency-window
let*
setf
luft.render::streaming-scene-residency-radiusscene
0
gethashleft
luft.render::streaming-scene-loadedscene
t
unwind-protect
progn
ok
null
gethashleft
luft.render::streaming-scene-loadedscene
ok
gethashright
luft.render::streaming-scene-loadedscene
ok
equal
listright
luft.render::streaming-scene-cohortscene
ok
equal
listleft
luft.render::streaming-scene-removalsscene
ok
=1
hash-table-count
luft.render::streaming-scene-outstandingscene
defunkey-event
classkey-name&keycharactermodifiersrepeat-p
make-instanceclass:timestamp0:key-namekey-name:charactercharacter:unshifted-charactercharacter:modifiersmodifiers:repeat-prepeat-p
defunkey-press
key-name&keycharactermodifiersrepeat-p
key-event'luv:canvas-key-press-eventkey-name:charactercharacter:modifiersmodifiers:repeat-prepeat-p
defunkey-release
key-name&keycharactermodifiers
key-event'luv:canvas-key-release-eventkey-name:charactercharacter:modifiersmodifiers
deftestthe-viewer-is-the-mcclim-application
let
viewer
clim:make-application-frame'render:viewer
ok
typepviewer'clim:application-frame
ok
null
climi::frame-processviewer
ok
not
luft.render::viewer-inspector-pviewer
ok
luft.render::viewer-inspector-p
clim:make-application-frame'render:viewer:inspector-pt
ok
equal'
luft.render::com-start-moving:forward
ok
equal'
luft.render::com-toggle-fullscreen
ok
equal'
luft.render::com-release-pointer
setf
luft.render::viewer-pointer-captured-pviewer
t
ok
equal'
luft.render::com-start-moving:forward
ok
equal'
luft.render::com-stop-moving:forward
ok
equal'
luft.render::com-reset-view
ok
equal'
luft.render::com-toggle-construction-lines
ok
equal'
luft.render::com-toggle-bevel-width
ok
equal'
luft.render::com-toggle-fullscreen
ok
equal'
luft.render::com-toggle-viewer-mode
ok
equal'
luft.render::com-quit
luft.render::viewer-key-commandviewer
key-press:q:character#\q:modifiers'
:control
deftestclick-to-walk-routes-around-a-character-high-wall
let*

The direct row is blocked. The only short way around the north end crosses Y=5, proving the click produced a route rather than a velocity.

loopforyfrom0to4do
loopforzfrom1to4do
let*
ok
eq:running
render:walking-route-statusroute
ok
find5
render:walking-route-cellsroute
:key#'luft:site-y
ok
>
length
render:walking-route-cellsroute
4
ok
plusp
render:walking-route-visitsroute
looprepeat1200while
eq:running
render:walking-route-statusroute
do
multiple-value-bind
forwardrightmaximum-distance
luft.render::advance-walking-playerplayerscene
orforward0.0
orright0.0
/1.0120.0
:maximum-distancemaximum-distance
ok
eq:arrived
render:walking-route-statusroute
ok
<
abs
-5.5
luv.arithmetic.lisp.vec3:vec3-x
render:walking-player-positionplayer
0.12
ok
<
abs
-2.5
luv.arithmetic.lisp.vec3:vec3-y
render:walking-player-positionplayer
0.12
deftestclick-to-walk-authors-straight-diagonal-waypoints
let*
let*
cells
render:walking-route-cellsroute
ok
=5
lengthcells
loopforcellincellsforcoordinatefrom2do
deftestorthographic-walk-moves-on-the-ground-without-zooming
let*
viewer
clim:make-application-frame'render:viewer
camera
render:viewer-cameraviewer
player
render:viewer-playerviewer
before-player-x
luv.arithmetic.lisp.vec3:vec3-x
render:walking-player-positionplayer
before-player-y
luv.arithmetic.lisp.vec3:vec3-y
render:walking-player-positionplayer
let
before-camera-z
luv.arithmetic.lisp.vec3:vec3-z
render:camera-positioncamera
let
after
render:walking-player-positionplayer
ok
or
/=before-player-x
luv.arithmetic.lisp.vec3:vec3-xafter
/=before-player-y
luv.arithmetic.lisp.vec3:vec3-yafter

A same-height walking step translates the following camera without changing its orbit height.

ok
=before-camera-z
luv.arithmetic.lisp.vec3:vec3-z
render:camera-positioncamera
deftestfollowing-camera-ignores-small-relief-and-catches-large-jumps
let*
let*
camera-position
render:camera-positioncamera
settled-z
luv.arithmetic.lisp.vec3:vec3-zcamera-position

A stair-sized vertical discrepancy belongs to the traveler, not the composition, and remains inside the camera's quiet zone.

incf
luv.arithmetic.lisp.vec3:vec3-z
render:walking-player-positionplayer
0.75
luft.render::follow-walking-playercameraplayer:seconds0.1
ok
=settled-z
luv.arithmetic.lisp.vec3:vec3-zcamera-position

A fall or teleport is well outside that zone and closes most of its error promptly instead of inheriting the gentle local response.

incf
luv.arithmetic.lisp.vec3:vec3-z
render:walking-player-positionplayer
12.0
let
before-error
abs
-
-
+
luv.arithmetic.lisp.vec3:vec3-z
render:walking-player-positionplayer
1.45
*18.0
sin-0.5
luv.arithmetic.lisp.vec3:vec3-zcamera-position
luft.render::follow-walking-playercameraplayer:seconds0.1
let
after-error
abs
-
-
+
luv.arithmetic.lisp.vec3:vec3-z
render:walking-player-positionplayer
1.45
*18.0
sin-0.5
luv.arithmetic.lisp.vec3:vec3-zcamera-position
ok
<after-error
*0.45before-error
deftestwalking-player-climbs-one-step-but-not-a-character-high-wall
let*
let
ok
=2.0
luv.arithmetic.lisp.vec3:vec3-z
render:walking-player-positionplayer
ok
>
luft.render::walking-player-gaitplayer
0.0
let
step-coordinate
/
luft.render::walking-player-gaitplayer
pi
ok
<
abs
-step-coordinate
roundstep-coordinate
1e-5

The next column is filled through the character's head. Axis separation leaves the player at the near edge instead of climbing or teleporting to its remote roof.

loopforzfrom1to4do
let*
blocked-scene
before-x
luv.arithmetic.lisp.vec3:vec3-x
render:walking-player-positionplayer
luft.render::advance-walking-playerplayerblocked-scenecamera100.2
ok
=before-x
luv.arithmetic.lisp.vec3:vec3-x
render:walking-player-positionplayer
deftestgameplay-treats-the-finite-world-domain-as-a-wall
let*
let
let
before
luv.arithmetic.lisp.vec3:vec3-x
render:walking-player-positionplayer
ok
=before
luv.arithmetic.lisp.vec3:vec3-x
render:walking-player-positionplayer
setf
luft.render::walking-player-grounded-pplayer
nil
ok
=before
luv.arithmetic.lisp.vec3:vec3-x
render:walking-player-positionplayer
deftestclick-thrown-ball-has-motion-and-render-state
let*
ok
luvcraft:physics-body-alive-p
luft.render::walking-player-physicsplayer
luft.render::walking-player-ball-handleplayer
let
before
luv.arithmetic.lisp.vec3:vec3-x
luft.render::walking-player-ball-positionplayer
ok
plusp
luvcraft:physics-world-step-count
luft.render::walking-player-physicsplayer
ok
>
luv.arithmetic.lisp.vec3:vec3-x
luft.render::walking-player-ball-positionplayer
before
multiple-value-bind
characterpreviousdirection-laneballprevious-ball
declare
ignorecharacterpreviousdirection-laneprevious-ball
deftesta-thrown-ball-bounces-off-the-finite-world-domain
let*
let*
physics
luft.render::walking-player-physicsplayer
handle
luft.render::walking-player-ball-handleplayer
x
luv.arithmetic.lisp.vec3:vec3-x
luft.render::walking-player-ball-positionplayer
multiple-value-bind
vxvyvz
declare
ignorevyvz
ok
<x16.0
ok
minuspvx
deftestthe-spike-scene-is-three-site-instance-streams
let*
templates
luft:surface-mesh-template-vertex-wordsmesh
ok
plusp
luft:surface-mesh-face-triangle-countmesh
ok
plusp
luft:surface-mesh-band-triangle-countmesh
ok
plusp
luft:surface-mesh-fan-triangle-countmesh
ok
plusp
luft:surface-mesh-singular-star-countmesh
deftestthe-sanctuary-curtain-is-bedded-into-the-mountain
let*
flet
occupied-p
xyz
architecture-p
xyz
eq:architecture

The front curtain and both round keeps have continuous stone shoes where the procedural ridge can otherwise fall below their fixed base.

dolist
point'
2045
4045
1541
4541
destructuring-bind
xy
point
ok
occupied-pxy17
ok
occupied-pxy18
ok
architecture-pxy17
ok
architecture-pxy18

The stair arrives at a supported masonry threshold, while the gate opening itself remains clear at the sanctuary floor.

let
ok
occupied-pxy18
ok
architecture-pxy18
ok
not
occupied-pxy19

Terrain and inhabited architecture now continue well beyond the old 64-cell diorama, including the remote back-ridge beacon.

deftestscene-cells-store-vocabulary-closed-material-offsets
let*
ok
every
lambda
offset
typepoffset'
unsigned-byte16
loopforoffsetbeingthehash-valuesof
luft.render::scene-material-cellsscene
collectoffset
deftestsemantic-surface-assemblies-retain-the-legacy-render-oracle
ok
equal
subseq
loopforassemblyacross
luv.domains:identity-vocabulary-membersluft.render::*surface-assembly-vocabulary*
collect
luft.render::surface-assembly-nameassembly
09
'
:grass:soil:subsoil:limestone:turf-set-limestone:soil-set-limestone:deep-set-limestone:turf-edge:foundation-limestone
deftestsemantic-material-migration-is-byte-identical-to-the-stock-oracle
labels
same-mesh-p
leftright
every#'identity
list
equalp
luft:surface-mesh-template-vertex-wordsleft
luft:surface-mesh-template-vertex-wordsright
equalp
luft:surface-mesh-template-rangesleft
luft:surface-mesh-template-rangesright
equalp
luft:surface-mesh-face-instance-wordsleft
luft:surface-mesh-face-instance-wordsright
equalp
luft:surface-mesh-band-instance-wordsleft
luft:surface-mesh-band-instance-wordsright
equalp
luft:surface-mesh-fan-instance-wordsleft
luft:surface-mesh-fan-instance-wordsright
dolist
ok
same-mesh-p
render:make-render-meshscene:stock-function
lambda
face
legacy-face-stocksceneface
:chamfer-stock-function#'legacy-chamfer-stock
deftestmaterial-semantics-compile-once-before-dense-meshing
let
let*
placement-count
length
luv.domains:identity-vocabulary-members
luft.render::scene-material-vocabularyscene
program
luft.render::scene-material-programscene
ok
=placement-countcompilations
ok
typep
luft.render::material-program-placement-face-stocksprogram
'
simple-array
unsigned-byte16
ok
typep
luft.render::material-program-placement-flagsprogram
'
simple-array
unsigned-byte8
deftestcompiled-placement-local-materials-match-the-semantic-oracle
labels
same-mesh-p
leftright
every#'equalp
list
luft:surface-mesh-template-vertex-wordsleft
luft:surface-mesh-template-rangesleft
luft:surface-mesh-face-instance-wordsleft
luft:surface-mesh-band-instance-wordsleft
luft:surface-mesh-fan-instance-wordsleft
list
luft:surface-mesh-template-vertex-wordsright
luft:surface-mesh-template-rangesright
luft:surface-mesh-face-instance-wordsright
luft:surface-mesh-band-instance-wordsright
luft:surface-mesh-fan-instance-wordsright
deftestcompiled-contacts-retain-both-authored-placement-frames
let*
earth-frame
make-instance'luft.render::material-frame:name:test-earth:origin'
442
:axes'
100
010
001
stone-frame
make-instance'luft.render::material-frame:name:test-stone:origin'
553
:axes'
010
-100
001
earth
make-instance'luft.render::material-placement:name:test-earth:kindluft.render::*earth-material*:finish:living:frameearth-frame:role:terrain
stone
make-instance'luft.render::material-placement:name:test-stone:kindluft.render::*limestone-material*:finish:dressed:framestone-frame:role:architecture
builder
ok
every#'equalp
list
luft:surface-mesh-face-instance-wordscompiled
luft:surface-mesh-band-instance-wordscompiled
luft:surface-mesh-fan-instance-wordscompiled
list
luft:surface-mesh-face-instance-wordssemantic
luft:surface-mesh-band-instance-wordssemantic
luft:surface-mesh-fan-instance-wordssemantic
ok
find-if
lambda
assembly
and
eq:contact
luft.render::surface-assembly-relationassembly
eqstone-frame
luft.render::surface-reading-frame
luft.render::surface-assembly-primaryassembly
eqearth-frame
luft.render::surface-reading-frame
luft.render::surface-assembly-secondaryassembly
luv.domains:identity-vocabulary-membersluft.render::*surface-assembly-vocabulary*
deftestsurface-assembly-descriptors-compile-semantic-material-data
let
ok
equalp
0.180.310.1057.0
subseqwords04
let
ok
equalp
0.530.490.391.0
subseqwordscontact
+contact4
ok
equalp
0.180.310.1050.0
subseqwords
+contact4
+contact8
deftestsurface-assembly-ids-use-the-widened-instance-field
let*
assembly-id#xabc
mesh
render:make-render-mesh:stock-function
lambda
face
declare
ignoreface
assembly-id
:chamfer-stock-function
lambda
stocks
declare
ignorestocks
assembly-id
dolist
words
list
luft:surface-mesh-face-instance-wordsmesh
luft:surface-mesh-band-instance-wordsmesh
luft:surface-mesh-fan-instance-wordsmesh
ok
plusp
lengthwords
ok
loopforoffsetfrom3below
lengthwords
by4always
=assembly-id
ok
handler-case
error
t
deftestplayer-gait-anchors-stance-feet-and-rises-over-support
let
step-length0.75
leg-length1.07737
hip-height1.01
labels
foot-sample
step-coordinateparity
let*
cycle
*0.5
-step-coordinateparity
cycle-index
floorcycle
phase
-cyclecycle-index
swing-time
min1.0
max0.0
*2.0
-phase0.5
swing-weight
*swing-timeswing-timeswing-time
+10.0
*swing-time
+-15.0
*6.0swing-time
values
*step-length
+parity
*2.0cycle-index
0.5
*2.0swing-weight
*0.19
sin
*piswing-time
pelvis-height
step-coordinate
let*
phase
-step-coordinate
floorstep-coordinate
offset
*step-length
-0.5phase
sqrt
-
*leg-lengthleg-length
*offsetoffset

Each alternating stance interval holds one foot at one exact world coordinate while the root advances by a complete half-step.

multiple-value-bind
left-aleft-a-lift
foot-sample0.10.0
multiple-value-bind
left-bleft-b-lift
foot-sample0.90.0
ok
=left-aleft-b
*step-length0.5
ok
zeropleft-a-lift
ok
zeropleft-b-lift
multiple-value-bind
right-aright-a-lift
foot-sample1.11.0
multiple-value-bind
right-bright-b-lift
foot-sample1.91.0
ok
=right-aright-b
*step-length1.5
ok
zeropright-a-lift
ok
zeropright-b-lift

The other foot clears the deck during transfer and lands at zero height; fourteen half-steps span the bridge's 10.5-cell half-route.

multiple-value-bind
mid-swingmid-lift
foot-sample0.51.0
declare
ignoremid-swing
ok
>mid-lift0.18
ok
=10.5
*14step-length

A fixed leg is shortest at double support and tallest over the planted foot at mid-stance, giving the body its non-arbitrary bob.

ok
=
pelvis-height0.0
pelvis-height1.0
ok
>
pelvis-height0.5
pelvis-height0.0

The height equation now uses the same hip and ankle centres as the rendered SDF. Its stance-leg reach is constant at the endpoints and over the support contact, rather than only looking approximately so.

let*
half-step
*step-length0.5
contact-height
pelvis-height0.0
mid-height
pelvis-height0.5
stance-reach
sqrt
+
*contact-heightcontact-height
*half-stephalf-step
ok
<
abs
-contact-heighthip-height
1e-4
ok
<
abs
-stance-reachleg-length
1e-6
ok
<
abs
-mid-heightleg-length
1e-6
deftestplayer-motion-channels-preserve-key-poses-and-foot-rockers
labels
ease
amount
let
time
min1.0
max0.0amount
*timetimetime
+10.0
*time
+-15.0
*6.0time
segment
phasebeginningendbeginning-valueend-value
+beginning-value
*
-end-valuebeginning-value
ease
/
-phasebeginning
-endbeginning
channel
phasecontactdownpassingupnext-contact
cond
<phase0.16
segmentphase0.00.16contactdown
<phase0.50
segmentphase0.160.50downpassing
<phase0.72
segmentphase0.500.72passingup
t
segmentphase0.721.0upnext-contact
rocker
cycle-phase
if
<cycle-phase0.5
let
stance-time
*cycle-phase2.0
cond
<stance-time0.18
segmentstance-time0.00.180.170.0
<stance-time0.72
0.0
t
segmentstance-time0.721.00.0-0.30
let
swing-time
*
-cycle-phase0.5
2.0
cond
<swing-time0.32
segmentswing-time0.00.32-0.300.10
<swing-time0.78
0.10
t
segmentswing-time0.781.00.100.17

Authored values survive exactly at semantic pose boundaries.

ok
=0.20
channel0.00.20-0.100.300.400.50
ok
=-0.10
channel0.160.20-0.100.300.400.50
ok
=0.30
channel0.500.20-0.100.300.400.50
ok
=0.40
channel0.720.20-0.100.300.400.50
ok
=0.50
channel1.00.20-0.100.300.400.50

The planted boot accepts weight from heel to flat, stays flat through the ankle rocker, then rolls over its toe. Swing dorsiflexion clears the ground and returns continuously to the next heel contact.

ok
>
rocker0.0
0.16
ok
zerop
rocker0.15
ok
<
rocker0.48
-0.25
ok
<
abs
-
rocker0.49999
rocker0.5
1e-4
ok
>
rocker0.70
0.09
ok
<
abs
-
rocker0.99999
rocker0.0
1e-4
defuninstance-signature
base-xbase-ybase-zpackedverticesstartcount
let
signature
make-array:element-type'
unsigned-byte32
setf
arefsignature0
base-x
arefsignature1
base-y
arefsignature2
base-z
arefsignature3
logandpacked#xffff0000
arefsignature4
count
replacesignaturevertices:start15:start2:end2
signature
defunword-vector<
leftright
loopforaacrossleftforbacrossrightwhen
/=ab
return
<ab
finally
defunmesh-instance-signatures
mesh
let
ranges
luft:surface-mesh-template-rangesmesh
vertices
luft:surface-mesh-template-vertex-wordsmesh
signaturesnil
dolist
words
list
luft:surface-mesh-face-instance-wordsmesh
luft:surface-mesh-band-instance-wordsmesh
luft:surface-mesh-fan-instance-wordsmesh
loopforoffsetfrom0below
lengthwords
by4forpacked=
arefwords
+offset3
fortemplate-id=
ldb
byte160
packed
forstart=
arefranges
*2template-id
forcount=
arefranges
1+
*2template-id
do
push
instance-signature
arefwordsoffset
arefwords
+offset1
arefwords
+offset2
packedverticesstartcount
signatures
signatures
defunpopulation-instance-signatures
population
let*
words
luft.render::render-population-instance-wordspopulation
vertices
luft.render::render-population-template-wordspopulation
triangle-count
luft.render::render-population-triangle-instance-countpopulation
signaturesnil
loopforoffsetfrom0below
lengthwords
by4forinstance-indexfrom0forpacked=
arefwords
+offset3
fortemplate-id=
ldb
byte160
packed
forcount=
if
<instance-indextriangle-count
36
forstart=do
push
instance-signature
arefwordsoffset
arefwords
+offset1
arefwords
+offset2
packedverticesstartcount
signatures
signatures
deftestresident-meshes-form-one-exact-two-draw-population
let*
meshes
listmiterspike
source-signatures
population-signatures
triangle-count
luft.render::render-population-triangle-instance-countpopulation
quad-count
luft.render::render-population-quad-instance-countpopulation
ok
equalp
sortsource-signatures#'word-vector<
sortpopulation-signatures#'word-vector<
ok
<=
+
if
plusptriangle-count
10
if
pluspquad-count
10
2
deftestcanonical-templates-are-shared-between-resident-meshes
let*
ok
=
/
length
luft.render::render-population-template-wordssingle
stride
/
length
luft.render::render-population-template-wordsdouble
stride
ok
=
*2
length
luft.render::render-population-instance-wordssingle
length
luft.render::render-population-instance-wordsdouble
deftestthe-connected-miter-study-uses-the-site-stream-abi
dolist
bevel-width'
124
let
ok
=bevel-width
luft:surface-mesh-bevel-widthmesh
if
=bevel-width4
progn
ok
zerop
luft:surface-mesh-face-triangle-countmesh
ok
zerop
luft:surface-mesh-band-triangle-countmesh
progn
ok
plusp
luft:surface-mesh-face-triangle-countmesh
ok
plusp
luft:surface-mesh-band-triangle-countmesh
ok
plusp
luft:surface-mesh-fan-triangle-countmesh
ok
zerop
luft:surface-mesh-singular-star-countmesh
let
ok
loopforoffsetfrom3below
lengthlattice
by4thereis
zerop
areflatticeoffset
ok
loopforoffsetfrom3below
lengthlattice
by4thereis
=1
areflatticeoffset
ok
loopforoffsetfrom3below
lengthlattice
by4thereis
=2
areflatticeoffset
ok
loopforoffsetfrom0below
lengthlattice
by4always
or
/=2
areflattice
+offset3
and
zerop
mod
areflatticeoffset
luft:+mesh-cell-size+
zerop
mod
areflattice
+offset1
luft:+mesh-cell-size+
zerop
mod
areflattice
+offset2
luft:+mesh-cell-size+
deftestmaterial-bevel-policy-builds-one-closed-site-local-surface
let*
multiple-value-bind
meshwidth-census
ok
=4
luft:surface-mesh-bevel-widthmesh
ok
plusp
arefwidth-census1
ok
plusp
arefwidth-census2
ok
zerop
arefwidth-census3
ok
plusp
arefwidth-census4
ok
=1
lengthmeshes
ok
=0
caarmeshes
defunmesh-triangle-quality
mesh

Return minimum angle, maximum longest-edge/altitude ratio, and sliver count.

let
minimum-angle180.0d0
maximum-aspect0.0d0
aspect-over-five0
labels
distance-squared
leftright
loopforlinleftforrinrightsum
angle
left-squaredright-squaredopposite-squared
*
/180.0d0pi
acos
max-1.0d0
min1.0d0
/
-
+left-squaredright-squared
opposite-squared
*2.0d0
sqrt
*left-squaredright-squared
luft::%map-mesh-triangles
lambda
kindabc
declare
ignorekind
let*
ab2
distance-squaredab
bc2
distance-squaredbc
ca2
distance-squaredca
cross2
loopforcomponentincrosssum
*componentcomponent
aspect
/
float
maxab2bc2ca2
1.0d0
sqrtcross2
setfminimum-angle
minminimum-angle
angleab2ca2bc2
angleab2bc2ca2
anglebc2ca2ab2
maximum-aspect
maxmaximum-aspectaspect
when
>aspect5.0d0
incfaspect-over-five
mesh
valuesminimum-anglemaximum-aspectaspect-over-five
deftestmaterial-bevel-transition-contracts-the-medial-t-junction
let*
multiple-value-bind
meshwidth-censusdiagnostics
ok
plusp
arefwidth-census1
ok
plusp
arefwidth-census2
ok
plusp
arefwidth-census4
ok
=3
getfdiagnostics:unmatched-edge-count
ok
=1
getfdiagnostics:repaired-edge-count
ok
zerop
getfdiagnostics:residual-edge-count

Contracting the medial T-junction may subdivide a neighbour, but it must not make triangle quality worse than the width-one topology witness from which the mixed surface was evaluated.

multiple-value-bind
minimum-anglemaximum-aspectsliver-count
multiple-value-bind
witness-minimum-anglewitness-maximum-aspectwitness-sliver-count
ok
>=minimum-angle
-witness-minimum-angle1.0d-9
ok
<=maximum-aspect
+witness-maximum-aspect1.0d-9
ok
<=sliver-countwitness-sliver-count
deftestmaterial-bevel-transition-can-exhibit-the-uncontracted-t-junction
multiple-value-bind
meshwidth-censusdiagnostics
declare
ignorewidth-census
ok
=3
getfdiagnostics:unmatched-edge-count
ok
zerop
getfdiagnostics:repaired-edge-count
ok
=3
getfdiagnostics:residual-edge-count

The diagnostic mesh omits zero-area triangles. Its defect is solely the long-edge/short-edge connectivity mismatch exposed by construction ink, not a retained degenerate primitive.

defuncheck-authored-stair-boundary
boundary
multiple-value-bind
meshwidth-censusdiagnostics
declare
ignorediagnostics
ok
plusp
arefwidth-census1
ok
plusp
arefwidth-census2
ok
plusp
arefwidth-census4
deftestterrain-chamfers-distinguish-the-living-top-edge
let*
flet
instance-stocks
words
loopforoffsetfrom3below
lengthwords
by4collect
let
stocks
mapcan#'instance-stocks
list
luft:surface-mesh-band-instance-wordsmesh
luft:surface-mesh-fan-instance-wordsmesh
ok
plusp
lengthstocks
deftestflat-terrain-closures-retain-a-living-edge-reading
let*
flet
contains-turf-edge-p
words
loopforoffsetfrom3below
lengthwords
by4thereis
ok
contains-turf-edge-p
luft:surface-mesh-band-instance-wordsmesh
ok
contains-turf-edge-p
luft:surface-mesh-fan-instance-wordsmesh
deftestmiter-study-chamfers-do-not-use-the-terrain-top-stock
let
dolist
words
list
luft:surface-mesh-band-instance-wordsmesh
luft:surface-mesh-fan-instance-wordsmesh
ok
notany
lambda
stock
zeropstock
loopforoffsetfrom3below
lengthwords
by4collect
deftestearth-set-readings-are-confined-to-stone-terrain-chamfers
let*
flet
stocks
words
loopforoffsetfrom3below
lengthwords
by4collect
ok
notany
stocks
luft:surface-mesh-face-instance-wordsmesh
ok
some
append
stocks
luft:surface-mesh-band-instance-wordsmesh
stocks
luft:surface-mesh-fan-instance-wordsmesh
deftestterrain-borne-architecture-marks-only-its-lowest-face-course
let*
builder
face-stocks
loopwithwords=
luft:surface-mesh-face-instance-wordsmesh
foroffsetfrom3below
lengthwords
by4collect
ok
deftesttopology-ao-is-confined-to-bevels-and-junctions
let
flet
levels
words
loopforoffsetfrom3below
lengthwords
by4collect
ldb
byte228
arefwordsoffset
ok
every#'zerop
levels
luft:surface-mesh-face-instance-wordsmesh
ok
some#'plusp
append
levels
luft:surface-mesh-band-instance-wordsmesh
levels
luft:surface-mesh-fan-instance-wordsmesh
deftestmesh-and-presentation-shaders-lower-through-both-conventional-backends
let*
ok
search"[[vertex_id]]"vertex-msl
ok
search"[[instance_id]]"vertex-msl
ok
search"const device uint4* instances"vertex-msl
ok
search"const device uint4* template_vertices"vertex-msl
ok
search"const device float4* material_descriptors"fragment-msl
ok
search"depth2d<float> shadow_map"fragment-msl
ok
search"sampler shadow_sampler"fragment-msl
ok
search"barycentric"fragment-msl
ok
search"motion_output"fragment-msl
ok
search"depth2d<float> scene_depth"present-fragment-msl
ok
search"highlight_energy"present-fragment-msl
ok
search"paper_grade"present-fragment-msl
ok
search"[[instance_id]]"
luv.msl:msl-document-source
luv.msl:compile-msllattice-vertex
ok
luv.msl:compile-msllattice-fragment
ok
luv.msl:compile-mslshadow-vertex
ok
luv.msl:compile-mslplayer-vertex
ok
luv.msl:compile-mslplayer-fragment
ok
ok
luv.msl:compile-mslsky-temporal-fragment
ok
luv.msl:compile-mslexposure-probe-fragment
deftestexposure-probes-decode-and-adapt-with-moppes-asymmetric-rates
let*
luminance0.16d0
encoded
round
*255d0
/
+
logluminance
9.21034d0
11.98293d0
bytes
make-arrayrender::+exposure-probe-byte-count+:element-type'
unsigned-byte8
:initial-element0
loopforindexfrom0below
lengthbytes
by4do
setf
arefbytesindex
encoded

Looking into more light closes down quickly; opening into darkness is deliberately slower, matching Moppe's eye-adaptation architecture.

ok
<1.0e-6
ok
<1.0e-6
ok
<1.9f0
ok
>0.55f0
deftestthe-camera-block-packs-both-projections
let
flet
lane
projection
let
let
view
luft.render::camera-uniform-dataviewview
0.50.50.0010.001
1.0player
let
perspective
lane:perspective
isometric
lane:isometric
eighth
let
let
view
luft.render::camera-uniform-dataviewview
0.50.50.0010.001
1.0player1
ok
=108
lengthperspective
ok
typepperspective'
simple-arraysingle-float
108
ok
=1.0
arefperspective22
ok
=0.0
arefisometric22
flet
depth
dataview-z
let
clip
+
*view-z
arefdata18
arefdata19
if
zerop
arefdata22
clip
/clipview-z
ok
<
abs
depthperspective0.1
1d-4
ok
<
abs
-
depthperspective600.0
1.0
1d-4
ok
=
arefperspective20
0.25
ok
=
arefeighth20
0.125
ok
=
arefperspective21
render:*wireframe*
ok
equalp
0.50.50.0010.001
subseqperspective4852
ok
equalp
61.548.515.480.0
subseqperspective5256
ok
equalp
luft.render::light-sun-colorluft.render:*light*
subseqperspective6064
ok
equalp
luft.render::light-sky-colorluft.render:*light*
subseqperspective6468
ok
equalp
luft.render::light-ground-colorluft.render:*light*
subseqperspective6872
ok
=
luft.render::light-shadow-filter-radiusluft.render:*light*
arefperspective91
ok
equalp
61.548.515.480.0
subseqperspective9296
ok
equalp
0.01.00.00.0
subseqperspective96100
deftestan-off-centre-pointer-ray-inverts-the-rendered-projection
let*
canvas
make-instance'luv:sdl-canvas:width1000:height800
camera
viewer
clim:make-application-frame'render:viewer:canvascanvas:cameracamera

At yaw and pitch zero camera UP is world +Z. A pointer one quarter of the viewport below centre must therefore start five cells below the camera, not at the vertically mirrored point five cells above it.

setf
luft.render::viewer-pointer-xviewer
500.0
luft.render::viewer-pointer-yviewer
600.0
multiple-value-bind
origindirection
ok
<
abs
-5.0
luv.arithmetic.lisp.vec3:vec3-zorigin
1.0e-6
ok
<
abs
-1.0
luv.arithmetic.lisp.vec3:vec3-xdirection
1.0e-6
deftestthe-light-frame-is-texel-stable-under-subtexel-camera-motion
let*
texel
/
*2.0
luft.render::light-shadow-half-extentlight
luft.render::+shadow-map-size+
nearby
luv.arithmetic.lisp.vec3:make-vec3
+
luv.arithmetic.lisp.vec3:vec3-xcenter
*texel0.1
luv.arithmetic.lisp.vec3:vec3-ycenter
luv.arithmetic.lisp.vec3:vec3-zcenter
ok
=16
lengthrows

Snapping is in the light plane: a tiny arbitrary world translation may cross no light-space texel boundary, and therefore leaves X/Y rows exact.

ok
equalp
subseqrows08
subseqnearby-rows08
deftesta-pointer-ray-retains-the-semantic-boundary-site
let*
domain
luft:make-world-domain:horizontal-bits4
let*
site
luft.render::site-inspection-siteinspection
cell
luft.render::site-inspection-cellinspection
okinspection
ok
=3.0
luft.render::site-inspection-distanceinspection
ok
=#x80
render:site-inspection-star-maskinspection
ok
not
luft:star-singular-p
render:site-inspection-star-maskinspection
deftestfilm-cleanup-cannot-resurrect-a-shutting-down-viewer
flet
make-probe
clim:make-application-frame'render:viewer:canvas
make-instance'luv:canvas
let*
viewer
make-probe
capture
make-instance'luv:application-capture:applicationviewer:kind:film
setf
luv:capture-client-statecapture
'
:running-pt
render::viewer-running-pviewer
nil
ok
render::viewer-running-pviewer
let*
viewer
make-probe
capture
make-instance'luv:application-capture:applicationviewer:kind:film
setf
luv:capture-client-statecapture
'
:running-pt
render::viewer-running-pviewer
nil
ok
not
render::viewer-running-pviewer