wip(0.S2): migrate - a var nothing writes becomes a let; a state is keyed by its module, directory or program, so every program's plan agrees; paths normalized; program states named SceneDemoState / scene_demo_st; the LSP reads state, mut and entry/handler parameters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3eda72e8c2
commit
5ffe50ed02
463 changed files with 72045 additions and 67421 deletions
|
|
@ -1,21 +1,23 @@
|
|||
# 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(lab_st: mut LabState) -> string {
|
||||
if lab_st.lb_plate_dir != "" { return lab_st.lb_plate_dir }
|
||||
lab_st.lb_plate_dir = "packages/ludic.lab/plate"
|
||||
if not Fs.exists(`{lab_st.lb_plate_dir}/plate.gltf`) { lab_st.lb_plate_dir = `{r3d_home()}/packages/ludic.lab/plate` }
|
||||
return lab_st.lb_plate_dir
|
||||
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(lab_st: mut LabState, render3d_st: mut Render3dState) -> void {
|
||||
let m = gltf_load(render3d_st, lab_plate_dir(lab_st), "plate.gltf", "plate")
|
||||
function lab_plate_load() -> void {
|
||||
let m = gltf_load(lab_plate_dir(), "plate.gltf", "plate")
|
||||
if m == null { return }
|
||||
lab_st.lb_plate = actor_new(render3d_st, m)
|
||||
lab_st.lb_plate.casts = false
|
||||
lab_st.lb_plate.cull = 0.0
|
||||
lab_st.lb_plate.radius = 0.0
|
||||
actor_place(lab_st.lb_plate, 0.0, 0.0, 0.0, 0.0)
|
||||
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 }
|
||||
|
|
@ -25,10 +27,10 @@ export function lab_stand(a: Actor, x: float, z: float, yaw: float) -> void {
|
|||
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(render3d_st: mut Render3dState, dir: string, file: string, node: string, x: float, z: float, yaw: float) -> Actor {
|
||||
let m = gltf_load(render3d_st, dir, file, node)
|
||||
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(render3d_st, m)
|
||||
let a = actor_new(m)
|
||||
lab_stand(a, x, z, yaw)
|
||||
return a
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue