feat(ludic.lab): the visual lab as a package - a scene on a plate, never a world
A scene is an entry in the open registry LabScenes, shown on a plate: a flat lit disc, the package's own small sky with the sun at one hour, and a frame clock. Headless each camera (lab_shot, lab_shot_at) settles and is written as build/lab/<scene>/<shot>.png (a stored PNG, written here); in a window N and P step through them. tools/lab/run.sh and sheet.py make the contact sheet; tools/lab/plate_build.py makes plate/. ludic.render3d gains r3d_plate_mode (no terrain, grass or water is made) and r3d_sky_path. quit() in a program with no frame loop links. The example takes ~120 MB resident, 417 MiB peak footprint. Reseed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cc930a114f
commit
b401f7acc1
35 changed files with 4184 additions and 2986 deletions
36
packages/ludic.lab/plate.ludic
Normal file
36
packages/ludic.lab/plate.ludic
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# plate.ludic - the stage: a flat disc 40 m across at y = 0 with a line every metre, lit by the
|
||||
# package's own small sky (a sun 40 degrees up), and nothing else. Its files are in plate/.
|
||||
var lb_plate: Actor = null
|
||||
var lb_plate_dir: string = ""
|
||||
|
||||
# the package's plate/ directory: beside the project (a checkout of the toolchain) or installed
|
||||
export function lab_plate_dir() -> string {
|
||||
if lb_plate_dir != "" { return lb_plate_dir }
|
||||
lb_plate_dir = "packages/ludic.lab/plate"
|
||||
if not Fs.exists(`{lb_plate_dir}/plate.gltf`) { lb_plate_dir = `{r3d_home()}/packages/ludic.lab/plate` }
|
||||
return lb_plate_dir
|
||||
}
|
||||
function lab_plate_load() -> void {
|
||||
let m = gltf_load(lab_plate_dir(), "plate.gltf", "plate")
|
||||
if m == null { return }
|
||||
lb_plate = actor_new(m)
|
||||
lb_plate.casts = false
|
||||
lb_plate.cull = 0.0
|
||||
lb_plate.radius = 0.0
|
||||
actor_place(lb_plate, 0.0, 0.0, 0.0, 0.0)
|
||||
}
|
||||
# the ground under (x, z): the plate is flat at 0
|
||||
export function lab_ground_y(x: float, z: float) -> float { return 0.0 }
|
||||
# an actor stood on the plate at (x, z), facing yaw (radians)
|
||||
export function lab_stand(a: Actor, x: float, z: float, yaw: float) -> void {
|
||||
if a == null { return }
|
||||
actor_place(a, x, lab_ground_y(x, z), z, yaw)
|
||||
}
|
||||
# a model from a glTF file stood on the plate: the one call a scene usually needs
|
||||
export function lab_model(dir: string, file: string, node: string, x: float, z: float, yaw: float) -> Actor {
|
||||
let m = gltf_load(dir, file, node)
|
||||
if m == null { return null }
|
||||
let a = actor_new(m)
|
||||
lab_stand(a, x, z, yaw)
|
||||
return a
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue