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:
parent
cd71da9330
commit
384324c85a
3 changed files with 15 additions and 14 deletions
|
|
@ -22,7 +22,7 @@ export state AnimState {
|
||||||
q_a: floats = floats(4)
|
q_a: floats = floats(4)
|
||||||
q_b: floats = floats(4)
|
q_b: floats = floats(4)
|
||||||
q_cur: floats = floats(4)
|
q_cur: floats = floats(4)
|
||||||
parts: []floats = null
|
parts: []floats = pose_parts_new()
|
||||||
rot_s: floats = null
|
rot_s: floats = null
|
||||||
pos_s: floats = null
|
pos_s: floats = null
|
||||||
hit_s: words = null
|
hit_s: words = null
|
||||||
|
|
|
||||||
|
|
@ -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
|
# 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)
|
# 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 {
|
# eight quaternions of scratch, made with the state
|
||||||
if anim_st.parts == null {
|
function pose_parts_new() -> []floats {
|
||||||
anim_st.parts = new []floats
|
let l = new []floats
|
||||||
for k in 0 .. 8 { push(anim_st.parts, floats(4)) }
|
for k in 0 .. 8 { push(l, floats(4)) }
|
||||||
}
|
return l
|
||||||
return anim_st.parts[i]
|
|
||||||
}
|
}
|
||||||
|
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 {
|
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 l = pose_part(anim_st, 0)
|
||||||
let rinv = part(anim_st, 1)
|
let rinv = pose_part(anim_st, 1)
|
||||||
let gp = part(anim_st, 2)
|
let gp = pose_part(anim_st, 2)
|
||||||
let gpi = part(anim_st, 3)
|
let gpi = pose_part(anim_st, 3)
|
||||||
let tmp = part(anim_st, 4)
|
let tmp = pose_part(anim_st, 4)
|
||||||
let d = part(anim_st, 5)
|
let d = pose_part(anim_st, 5)
|
||||||
let v = part(anim_st, 6)
|
let v = pose_part(anim_st, 6)
|
||||||
for i in 0 .. sk.n_nodes {
|
for i in 0 .. sk.n_nodes {
|
||||||
let p = sk.par[i]
|
let p = sk.par[i]
|
||||||
if (hit[i] & 1) != 0 {
|
if (hit[i] & 1) != 0 {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
# Call it straight after a load and before the next one: `gltf_doc` and `gltf_bin` point at
|
# 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.
|
# 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 {
|
export function anim_read_doc(anim_st: mut AnimState, render3d_st: mut Render3dState, dir: string) -> int {
|
||||||
clips_init()
|
clips_init()
|
||||||
if render3d_st.gltf_doc == null { return 0 }
|
if render3d_st.gltf_doc == null { return 0 }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue