frame allocs (25.2): ludic.anim's pose scratch made with its state (pose_part, the name no longer taken for udp_ip's part), a model's clips read at its load declared

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:29:15 +03:00
parent cd71da9330
commit 384324c85a
3 changed files with 15 additions and 14 deletions

View file

@ -22,7 +22,7 @@ export state AnimState {
q_a: floats = floats(4)
q_b: floats = floats(4)
q_cur: floats = floats(4)
parts: []floats = null
parts: []floats = pose_parts_new()
rot_s: floats = null
pos_s: floats = null
hit_s: words = null

View file

@ -2,22 +2,22 @@
# skin_pose folds a delta D in as local = (G_p^-1 . D . G_p) . R_rest, and a channel gives the
# absolute local L, so D = G_p . (L . R_rest^-1) . G_p^-1 (a root: D = L . R_rest^-1)
function part(anim_st: mut AnimState, i: int) -> floats {
if anim_st.parts == null {
anim_st.parts = new []floats
for k in 0 .. 8 { push(anim_st.parts, floats(4)) }
}
return anim_st.parts[i]
# eight quaternions of scratch, made with the state
function pose_parts_new() -> []floats {
let l = new []floats
for k in 0 .. 8 { push(l, floats(4)) }
return l
}
function pose_part(anim_st: AnimState, i: int) -> floats { return anim_st.parts[i] }
export function anim_to_pose(anim_st: mut AnimState, sk: Skin, rot: floats, pos: floats, hit: words) -> void {
let l = part(anim_st, 0)
let rinv = part(anim_st, 1)
let gp = part(anim_st, 2)
let gpi = part(anim_st, 3)
let tmp = part(anim_st, 4)
let d = part(anim_st, 5)
let v = part(anim_st, 6)
let l = pose_part(anim_st, 0)
let rinv = pose_part(anim_st, 1)
let gp = pose_part(anim_st, 2)
let gpi = pose_part(anim_st, 3)
let tmp = pose_part(anim_st, 4)
let d = pose_part(anim_st, 5)
let v = pose_part(anim_st, 6)
for i in 0 .. sk.n_nodes {
let p = sk.par[i]
if (hit[i] & 1) != 0 {

View file

@ -3,6 +3,7 @@
# Call it straight after a load and before the next one: `gltf_doc` and `gltf_bin` point at
# whichever file was read last, so a clip that is not taken now cannot be taken later.
@alloc_ok("a model's clips read as it loads, once per file")
export function anim_read_doc(anim_st: mut AnimState, render3d_st: mut Render3dState, dir: string) -> int {
clips_init()
if render3d_st.gltf_doc == null { return 0 }