programextensions/scene/demos/voxels-solid.xtl
Voxels, 3: the chunk drawn solid. The same faces as voxels-faces, each now a filled quad -- its four corners from a 6 by 4 table by direction -- one object per kind of block; scene shades each by how it faces the light and hides the farther ones behind the nearer (a depth buffer), with a little fog. All the array work is X_eTaL's; Rust only draws. Run: just demo scene voxels-solid (drag to turn it; q or close: quit)
k : Int
k ← w ˢᶜc̲amera! 0.7 0.5 3.4 0.35
ᵘp̲ut : Int -> Int
each kind of block as one object of quads, in its color
ᵘp̲ut ← { t → sel ← (5 s̲elect₂ f) = t 0 = '+ r̲/ sel ? t + 1 head ← (f̲loat w c̲at t) c̲at (t + 1) s̲elect ᵛˣcolors x ← head ˢᶜq̲uads! ᵛˣq̲uads sel r̲eplicate f t + 1 }
Used in: put