nx_nxa_pect.nx
buildroot/runtime/nx_nxa_pect.nx
about
nx_nxa_pect.nx -- GIVE THE SOFT TISSUE ITS BONES: append the lateral pectoral pair to an NXA
and re-bind the bust vertices to it.
WHY THIS EXISTS. The reference-figure rig carries lPectoral/rPectoral as first-class bones
(measured 2026-08-03 from morph formula targets across three independent packages); our rig has
104 joints and ZERO off-midline at chest height, which is the root cause behind the vertex-band
soft-tissue workaround (debt 1785798366). The DYNA section already declares MEASURED lateral
anchors (nx_nxa_dyna derives them from the mesh's own bust-band centroids); this organ promotes
those declared anchors into actual SKEL bones with skinning weights, so the engine can drive a
bone instead of faking one at the vertices.
★THE TRAP THIS DESIGN AVOIDS (found by reading the consumer BEFORE building): the page runtime
has NO joint hierarchy -- every joint poses from its OWN absolute ANIM track, and a joint with
no track renders the IDENTITY transform. Bones appended naively would leave a FROZEN CHEST PATCH
on an animating body. So each new bone receives a byte-copy of its donor chest joint's track(s)
with the header jointIdx rewritten: copied (R, dt) applied at the new bone's OWN bind position is
exactly rigid attachment under the consumer's dual-quat T = b + dt - D*b.
FAIL-CLOSED MEASUREMENTS, NEVER ASSUMPTIONS:
- the SKIN weight layout (planar [i,i,i,i,w,w,w,w] vs interleaved [i,w,i,w..]) and the weight
basis (the constant per-vertex sum) are DETECTED from the data and REFUSED if ambiguous;
- every ANIM track must be chn==2 (the one layout the consumer parses) or we refuse;
- a rig that already carries an off-midline bust-band joint is REFUSED (idempotence: run twice
and the second run tells you it is done rather than doubling bones);
- all checksums are RECOMPUTED, never copied (nx_nxa_dyna's law: a copied checksum would
validate its own copy bug).
nx_nxa_pect <in.nxa> <out.nxa> (input never modified)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_nxa.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 33 | const PT_MAGIC_4096: i64 = 4096 |
| 35 | const PT_HDR: i64 = 32 |
| 36 | const PT_TOCE: i64 = 32 |
| 37 | const PT_MAXSEC: i64 = 64 |
| 38 | const PT_MODE: i64 = 0x1a4 |
| 39 | const PT_EXIT_USAGE: i64 = 2 |
| 40 | const PT_EXIT_BAD: i64 = 3 |
| 41 | const PT_EXIT_IO: i64 = 1 |
| 42 | const PT_EXIT_DONE: i64 = 4 |
| 45 | const PT_MIDLINE: i64 = 3000 |
| 50 | const PT_FRONT_Y: i64 = 0 - 1200 |
| 53 | const PT_NIP_PERMIL: i64 = 744 |
| 54 | const PT_BAND_PERMIL: i64 = 40 |
| 58 | const PT_FMAX_PERMIL: i64 = 400 |
| 59 | const PT_SKELREC: i64 = 64 |
| 60 | const PT_SKIN_WPV: i64 = 8 |
functions
| 62 | func pt_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 63 | func pt_werr(s: *u8) -> i64 { sys_write(2, s, pt_slen(s)); return 0 } |
| 64 | func pt_out(s: *u8) -> i64 { sys_write(1, s, pt_slen(s)); return 0 } |
| 65 | func pt_num(v: i64) -> i64 |
| 78 | func pt_rd64(b: *u8, off: i64) -> i64 called by 1: main |
| 84 | func pt_wr64(b: *u8, off: i64, v: i64) -> i64 called by 1: main |
| 90 | func pt_tageq(b: *u8, off: i64, t: *u8) -> i64 called by 1: main |
| 95 | func pt_isqrt(v: i64) -> i64 called by 1: main |
| 102 | func pt_die(msg: *u8, code: i64) -> i64 |
| 108 | func main(argc: i64, argv: *i64) -> i64 |