wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic 1804 vars into 126 states, 64 into lets; 23498 edits in 460 files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5ffe50ed02
commit
19fcf60599
459 changed files with 17862 additions and 17603 deletions
|
|
@ -1,20 +1,20 @@
|
|||
# shots.ludic - a scene names its cameras; the loop takes them in order
|
||||
function lab_shots_reset() -> void {
|
||||
lb_shot_names = new []string
|
||||
lb_shot_pose = new []float
|
||||
function lab_shots_reset(lab_st: mut LabState) -> void {
|
||||
lab_st.lb_shot_names = new []string
|
||||
lab_st.lb_shot_pose = new []float
|
||||
}
|
||||
# a camera at (x, y, z) looking along yaw / pitch, both in DEGREES (cam_set's units)
|
||||
export function lab_shot(name: string, x: float, y: float, z: float, yaw_deg: float, pitch_deg: float) -> void {
|
||||
push(lb_shot_names, name)
|
||||
push(lb_shot_pose, x)
|
||||
push(lb_shot_pose, y)
|
||||
push(lb_shot_pose, z)
|
||||
push(lb_shot_pose, yaw_deg)
|
||||
push(lb_shot_pose, pitch_deg)
|
||||
export function lab_shot(lab_st: mut LabState, name: string, x: float, y: float, z: float, yaw_deg: float, pitch_deg: float) -> void {
|
||||
push(lab_st.lb_shot_names, name)
|
||||
push(lab_st.lb_shot_pose, x)
|
||||
push(lab_st.lb_shot_pose, y)
|
||||
push(lab_st.lb_shot_pose, z)
|
||||
push(lab_st.lb_shot_pose, yaw_deg)
|
||||
push(lab_st.lb_shot_pose, pitch_deg)
|
||||
}
|
||||
# a camera `dist` metres from the point (tx, ty, tz), from bearing `from_deg` (0 = from +z),
|
||||
# `up_deg` above the horizontal, looking at the point
|
||||
export function lab_shot_at(name: string, tx: float, ty: float, tz: float, dist: float, from_deg: float, up_deg: float) -> void {
|
||||
export function lab_shot_at(lab_st: mut LabState, name: string, tx: float, ty: float, tz: float, dist: float, from_deg: float, up_deg: float) -> void {
|
||||
let b = Math.deg_to_rad(from_deg)
|
||||
let e = Math.deg_to_rad(up_deg)
|
||||
let hd = dist * Math.cos(e)
|
||||
|
|
@ -22,14 +22,14 @@ export function lab_shot_at(name: string, tx: float, ty: float, tz: float, dist:
|
|||
let cz = tz + Math.cos(b) * hd
|
||||
let cy = ty + dist * Math.sin(e)
|
||||
let yaw = Math.atan2(cx - tx, cz - tz) * (180.0 / PI)
|
||||
lab_shot(name, cx, cy, cz, yaw, -up_deg)
|
||||
lab_shot(lab_st, name, cx, cy, cz, yaw, -up_deg)
|
||||
}
|
||||
export function lab_shot_count() -> int {
|
||||
if lb_shot_names == null { return 0 }
|
||||
return len(lb_shot_names)
|
||||
export function lab_shot_count(lab_st: LabState) -> int {
|
||||
if lab_st.lb_shot_names == null { return 0 }
|
||||
return len(lab_st.lb_shot_names)
|
||||
}
|
||||
function lab_shot_apply(i: int) -> void {
|
||||
if i < 0 or i >= lab_shot_count() { return }
|
||||
function lab_shot_apply(lab_st: LabState, render3d_st: mut Render3dState, i: int) -> void {
|
||||
if i < 0 or i >= lab_shot_count(lab_st) { return }
|
||||
let o = i * 5
|
||||
cam_set(lb_shot_pose[o], lb_shot_pose[o + 1], lb_shot_pose[o + 2], lb_shot_pose[o + 3], lb_shot_pose[o + 4])
|
||||
cam_set(render3d_st, lab_st.lb_shot_pose[o], lab_st.lb_shot_pose[o + 1], lab_st.lb_shot_pose[o + 2], lab_st.lb_shot_pose[o + 3], lab_st.lb_shot_pose[o + 4])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue