libraryextensions/three/lib/Three.xtl

Three.xtl -- the facade of the three extension: interactive 3D in a browser. A scene is the calls of a player -- the text Cycles.xtl's functions write (cy:s_tage, cy:f_acade, cy:b_oxes, cy:f_leet, cy:f_ly and the rest) without cy:head, Blender's player. Here the player is written with Three.js and draws the same calls in real time: ride the camera's flight, fly or walk. A scene whose first call is view is a game's board (view, camera, tiles, piece: a camera without perspective, instanced tiles, each piece a model with its clip, moved between a program's ticks), drawn by a second player and changed in place when it is shown again. th:s_how! draws a scene in the page the program runs in (X_eTaL as WebAssembly); th:p_age! writes a directory to serve, from the command line. Import: "th:" u_se< "Three" Run with xetal-x (xetal-x --ext DIR puts this directory on XETAL_PATH). Each signature line is written out by the binding macro (lib/Ffi.xtlm).

source · imports ffi: lib/Ffi.xtlm

ˡa̲bout : Unit -> Char

function · line 20

th:a_bout @: the extension's name and version.

"a_bout : unit -> text"          ᶠᶠⁱb̲ind< "three/about"
ᶠᶠⁱb̲ind< expands to
ˡa̲bout ← { @ →
  ⎕N̲GET "ext:three/about"
}

ˡs̲how! : Char -> Int

function · line 24

th:s_how! scene: draws the scene in the page, in place of the one shown before; how many calls it holds. From the command line there is no page and nothing is drawn (the count is still given).

"s_how! : text -> int"           ᶠᶠⁱb̲ind< "three/show"
ᶠᶠⁱb̲ind< expands to
ˡs̲how! ← { a →
  pa ← a ⎕N̲PUT "ext:three/show?text"
  f̲loor f̲irst n̲umbers ⎕N̲GET "ext:three/show"
}

ˡp̲age! : Char -> Char -> Int

function · line 28

dir th:p_age! scene: writes a directory to serve (under the working directory, or XETAL_THREE_ROOT) -- index.html, the players, Three.js and the scene's calls -- made whole each time; how many files.

"p_age! : text text -> int"      ᶠᶠⁱb̲ind< "three/page"
ᶠᶠⁱb̲ind< expands to
ˡp̲age! ← { a b →
  pa ← a ⎕N̲PUT "ext:three/page?text"
  pb ← b ⎕N̲PUT "ext:three/page?text"
  f̲loor f̲irst n̲umbers ⎕N̲GET "ext:three/page"
}

ˡpackage : Char

value · line 31

The native package behind these functions.

ˡpackage ← "three"