nx_gltf_anim.nx
buildroot/runtime/nx_gltf_anim.nx
about
nx_gltf_anim.nx -- ★SKINNED + ANIMATED glTF export: the being as a rigged, WALKING .glb (plays in any glTF viewer).
Reuses our FK rig: each mesh vertex is rigidly bound to its nearest part's deepest bone (joints supplied by the driver).
9 joints (root + L/R shoulder,elbow,hip,knee) in a 2-level hierarchy; inverse-bind = translate(-pivot); a walk-cycle
animation = per-bone quaternion rotation keyframes about X (sagittal). Includes an integer float32 + fixed-point encoder.
GENERALIZED 2026-08-10 (ws=dance-motion): the writer is now gltf_anim_export_qtrack (caller-supplied full-quaternion
track, any key count, any animation name) and gltf_anim_export is the walk-table wrapper over it -- ONE writer,
two callers, so real mocap (nx_dance_emit) and the synthetic walk share every byte of container logic.
license_tier: ORIGINAL
dependencies 5 imports · 3 importers
imports: nx_syscalls.nxnx_trimesh.nxnx_itrig.nxnx_gltf_mesh.nxnx_glbnorm_lib.nx
imported by: nx_dance_emit.nxnx_gltf_anim_gate.nxnx_retarget_emit.nx
structs
| none |
consts
| 14 | const GA_MAGIC_3217: i64 = 3217 |
| 15 | const GA_MAGIC_25736: i64 = 25736 |
| 16 | const GA_MAGIC_4096: i64 = 4096 |
| 17 | const GA_MAGIC_1400: i64 = 1400 |
| 18 | const GA_MAGIC_1700: i64 = 1700 |
| 19 | const GA_MAGIC_2400: i64 = 2400 |
| 20 | const GA_MAGIC_8192: i64 = 8192 |
| 21 | const GA_MAGIC_2000000000: i64 = 2000000000 |
| 22 | const GA_MAGIC_32767: i64 = 32767 |
| 23 | const GA_MAGIC_65535: i64 = 65535 |
| 24 | const GA_MAGIC_65536: i64 = 65536 |
| 29 | const GA_K: i64 = 9 // walk keyframes (dt = 1/8 s -> exact float times, 1.0 s cycle) |
| 30 | const GA_NJ: i64 = 11 // joints: 0 root, 1 Lsh,2 Lel,3 Rsh,4 Rel,5 Lhip,6 Lkn,7 Rhip,8 Rkn, 9 Lank,10 Rank (ankle = the calf landmark, unanimated; debt 1785900993) |
functions
| 27 | func ga_f32fx(n: i64, fb: i64) -> i64 { if n == 0 { return 0 } return gl_f32bits(n) - (fb<<23) } |
| 38 | func ga_piv(j: i64, axis: i64) -> i64 |
| 57 | func ga_angle(j: i64, k: i64) -> i64 |
| 76 | func gltf_anim_export_qtrack(out: *u8, jarr: *i64, qtrk: *i64, nk: i64, aname: *u8) -> i64 |
| 216 | func gltf_anim_export(out: *u8, jarr: *i64) -> i64 |