sourceextensions/scene/demos/cube.xtl

1⍝# A wireframe cube turning in a native 3D window: its corners and edges 2⍝# are X_eTaL arrays; Rust draws them. 3⍝# Run: just demo scene cube (drag to turn it; q or close: quit) 4 5ˢᶜ⁼u̲se< "Scene" 6 7⍝# the 8 corners: every sign combination of -1 1 in x, y and z 8c ← 8 3 r̲eshape -1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 9 10⍝# the 12 edges join corners that differ in one coordinate: pairs (from 1) 11e ← 12 2 r̲eshape 1 2 3 4 5 6 7 8 1 3 2 4 5 7 6 8 1 5 2 6 3 7 4 8 12 13w ← "Cube -- X_eTaL" ˢᶜo̲pen! 480 480 14k ← w ˢᶜc̲amera! 0.6 0.45 5.0 0.8 15x ← ((f̲loat w c̲at 1) c̲at 0.4 0.8 1.0) ˢᶜs̲egments! (r̲avel e) s̲elect c 16y ← ((f̲loat w c̲at 2) c̲at 1.0 0.6 0.2) ˢᶜd̲ots! c 17 18ᵘq̲uit ← { n → 19 z ← ˢᶜc̲lose! w 20 0 21} 22ᵘf̲rame ← { n → 23 n = 0 ? 0 24 v ← ˢᶜn̲ext! w 25 ((v m̲atch "close") + v m̲atch "key q") > 0 ? ᵘq̲uit n 26 n 27} 28last ← 100000 'ᵘf̲rame p̲ower 1 29"bye"