luv

Workshop wiki

fields.lisp

luvcraft/fields.lisp

system luvcraft/core · 16 definitions · on GitHub

Luvcraft's dense voxel fields and packed product declarations.

in-package#:luvcraft
luvcraft.world.fields:define-voxel-field:sky-light:site-kind:voxel-cell:value-type
unsigned-byte8
:quantity
:quantity:sky-propagation-level:unit:one
:missing-value:unavailable:legal-values
integer015
:representation:u8-levels
luvcraft.world.fields:define-voxel-field:block-light:site-kind:voxel-cell:value-type
unsigned-byte8
:quantity
:quantity:block-propagation-level:unit:one
:missing-value:unavailable:legal-values
integer015
:representation:u8-levels
defunmake-block-mesh-vertex-product-layout
flet
luv.arithmetic:make-quantity-layout14
list
projection'
012
'
:quantity:world-position:unit:cell:tensor-order1
projection'
34
'
:quantity:tile-local-uv:unit:one:tensor-order1
projection'
5
'
:quantity:ambient-occlusion:unit:one
projection'
678
'
:quantity:world-direction:unit:one:tensor-order1
projection'
9
'
:quantity:sky-light-level:unit:one
projection'
10
'
:quantity:block-light-level:unit:one
projection'
11
'
:quantity:material-emission:unit:one
projection'
12
'
:quantity:atlas-tile-offset:unit:one
projection'
13
'
:quantity:packed-edge-shaping:unit:one
defmethodluv.arithmetic:value-declaration-for
name
eql:block-mesh-vertices
declare
ignorename
defunmake-frame-uniform-product-layout

Describe the semantic lanes in luvcraft's fixed 76-float frame block.

flet
luv.arithmetic:make-quantity-layout76
list
projection'
012
'
:quantity:world-position:unit:cell:tensor-order1
projection'
456
'
:quantity:world-direction:unit:one:tensor-order1
projection'
8910
'
:quantity:world-direction:unit:one:tensor-order1
projection'
121314
'
:quantity:world-direction:unit:one:tensor-order1
projection'
16
'
:quantity:projection-scale:unit:one
projection'
17
'
:quantity:projection-scale:unit:one
projection'
18
'
:quantity:projection-scale:unit:one
projection'
19
'
:quantity:view-distance:unit:cell
projection'
20
'
:quantity:view-distance:unit:cell
projection'
21
'
:quantity:view-distance:unit:cell
projection'
22
'
:quantity:sky-time:unit:second
projection'
23
'
:quantity:cloudiness:unit:one
projection'
242526
'
:quantity:world-direction:unit:one:tensor-order1
projection'
27
'
:quantity:day-factor:unit:one
projection'
282930
'
:quantity:linear-rgb:unit:one:tensor-order1
projection'
31
'
:quantity:sun-disc-coordinate:unit:one
projection'
323334
'
:quantity:linear-rgb:unit:one:tensor-order1
projection'
35
'
:quantity:target-pixel-extent:unit:one
projection'
363738
'
:quantity:linear-rgb:unit:one:tensor-order1
projection'
39
'
:quantity:target-pixel-extent:unit:one
projection'
404142
'
:quantity:linear-rgb:unit:one:tensor-order1
projection'
444546
'
:quantity:linear-rgb:unit:one:tensor-order1
projection'
47
'
:quantity:shadow-diagnostic:unit:one
projection'
4849
'
:quantity:shadow-uv:unit:one:tensor-order1:character:difference
projection'
50
'
:quantity:shadow-depth:unit:one:character:difference
projection'
51
'
:quantity:shadow-depth:unit:one:character:difference
projection'
52
'
:quantity:world-distance:unit:cell
projection'
53
'
:quantity:world-distance:unit:cell
projection'
54
'
:quantity:shadow-filter-radius:unit:one
projection'
55
'
:quantity:shadow-filter-radius:unit:one
projection'
56
'
:quantity:atlas-texel-width:unit:one
defunmake-camera-uniform-product-layout

Return the five-vec4 camera prefix of the full frame product.

let
luv.arithmetic:make-quantity-layout20
remove-if
lambda
projection
some
luv.arithmetic:quantity-projection-positionsprojection
luv.arithmetic:quantity-layout-projectionsframe
defmethodluv.arithmetic:value-declaration-for
name
eql:camera-uniform-data
declare
ignorename
load-time-value
luv.arithmetic:make-represented-value-declaration:representation-type'
simple-arraysingle-float
20
:quantity-layout:source-form'
camera-uniform-data:type
simple-arraysingle-float
20
:prefix-of:frame-uniform-data
defmethodluv.arithmetic:value-declaration-for
name
eql:frame-uniform-data
declare
ignorename
load-time-value
luv.arithmetic:make-represented-value-declaration:representation-type'
simple-arraysingle-float
76
:quantity-layout:source-form'
frame-uniform-data:type
simple-arraysingle-float
76
:product
012
world-position
456
right-direction
8910
up-direction
121314
forward-direction
161718
projection-scales
192021
view-distances
22
sky-time
23
cloudiness
242526
sun-direction
27
day-factor
282930
sun-color
31
sun-disc-coordinate
323334
zenith-color
35
target-pixel-height
363738
horizon-color
39
target-pixel-width
404142
ambient-color
444546
fog-color
47
shadow-diagnostic
4849
shadow-uv
5051
shadow-depth
5253
shadow-world-distances
5455
shadow-filter-radii
56
atlas-texel-width
60616263646566676869707172737475
representation-only-shadow-rows
defunshader-input-product-layout
specification

Flatten location-ordered shader inputs into one packed product layout.

let
offset0
projectionsnil
dolist
input
sort
copy-list
shader:shader-specification-inputsspecification
#'<:key#'shader:shader-interface-location
let*
whenwhole
pushprojections
whenlayout
dolist
projection
luv.arithmetic:quantity-layout-projectionslayout
push
luv.arithmetic:make-quantity-projection
mapcar
lambda
+offsetposition
luv.arithmetic:quantity-projection-positionsprojection
luv.arithmetic:quantity-projection-specificationprojection
projections
incfoffsetwidth
luv.arithmetic:make-quantity-layoutoffset
nreverseprojections
defunmake-cursor-vertex-product-layout

Describe a clip position and its cursor-local offset as one packed vertex.

defmethodluv.arithmetic:value-declaration-for
name
eql:sky-vertices
declare
ignorename
load-time-value
luv.arithmetic:make-represented-value-declaration:representation-type'
simple-arraysingle-float
9
:quantity-layout:source-form'
sky-vertices:type
simple-arraysingle-float
9
:repeated-product:stride3
defmethodluv.arithmetic:value-declaration-for
name
eql:crosshair-vertices
declare
ignorename
load-time-value
luv.arithmetic:make-represented-value-declaration:representation-type'
vectorsingle-float
:quantity-layout:source-form'
crosshair-vertices:type
vectorsingle-float
:repeated-product
012
clip-coordinate
345
absolute-linear-rgb
:stride6
defmethodluv.arithmetic:value-declaration-for
name
eql:cursor-vertices
declare
ignorename
load-time-value
luv.arithmetic:make-represented-value-declaration:representation-type'
vectorsingle-float
:quantity-layout:source-form'
cursor-vertices:type
vectorsingle-float
:repeated-product:stride5
defunensure-vertex-product-contract
verticesdeclaration-namevertex-countshader-specification

Validate raw vertices against one declared CPU and shader input product.

let*
declaration
or
error"No vertex product declaration is published for ~S."declaration-name
unless
error"Vertex data ~S does not satisfy ~S for ~S."
type-ofvertices
declaration-name
unless
error"Vertex declaration ~S is not a repeated product."declaration-name
let
stride
luv.arithmetic:repeated-quantity-layout-stridelayout
unless
=
lengthvertices
*vertex-countstride
error"Vertex data ~S has ~D lanes for ~D vertices at stride ~D."declaration-name
lengthvertices
vertex-countstride
unless
error"Vertex semantic ABI mismatch for ~S against shader ~S."declaration-name
vertices