ludic/tools/lab/run.sh
Orkuncakilkaya b401f7acc1 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>
2026-09-25 07:48:43 +03:00

20 lines
1 KiB
Bash
Executable file

#!/bin/sh
# run.sh <lab.ludic> [<scene> ...]: build a ludic.lab program headless, render every shot of each
# scene to build/lab/<scene>/<shot>.png and make build/lab/<scene>/sheet.png of them.
# LAB_NOBUILD=1 reuse build/lab_headless as it is LUDIC=<ludic> the CLI to build with
# With no scene it lists the program's scenes.
set -e
prog=$1
[ -n "$prog" ] || { echo "usage: run.sh <lab.ludic> [scene ...]" >&2; exit 2; }
shift
here=$(cd "$(dirname "$0")" && pwd)
LUDIC=${LUDIC:-ludic}
if [ -z "$LAB_NOBUILD" ]; then "$LUDIC" build "$prog" --headless -o build/lab_headless >/dev/null; fi
if [ $# -eq 0 ]; then echo q | R3D_SCENE=__list__ ./build/lab_headless 2>/dev/null | grep "no scene" || true; exit 0; fi
for scene in "$@"; do
out=build/lab/$scene
mkdir -p "$out"; rm -f "$out"/*.png "$out"/*.ppm
# one line of stdin per frame: the headless loop ends when it runs dry
yes '' | head -n 20000 | R3D_SCENE=$scene R3D_TEST_ROOT=lab_$scene ./build/lab_headless > "$out/run.log" 2>&1 || true
python3 "$here/sheet.py" "$out"
done