nx_wasm_charlab.nx
buildroot/runtime/nx_wasm_charlab.nx
about
nx_wasm_charlab.nx -- CHARLAB: the COMPOSED character surface (Elara bar E2+E3+E4+E5 in ONE interactive
page, the physlab pattern). A torso skeleton BREATHES (chest elevation sine); TWO soft-body regions with
DIFFERENT data profiles ride the chest bone (nx_bodybind); a 2-bone IK ARM chases the MOUSE (nx_ik CCD);
the arm's HAND is a live capsule collider in both regions -- push it into the flesh and the contact side
DENTS while the far side BULGES (the occlusion law, interactive). ALL logic in-wasm (JS = mouse + blit);
ALL INTEGER => the entire surface VM-vets byte-for-byte. Neutral tech demo; the anatomy-detailed content
rides the gated membership surfaces. license_tier: ORIGINAL
dependencies 8 imports · 2 importers
imports: nx_syscalls.nxnx_itrig.nxnx_skeleton.nxnx_softbody_region.nxnx_bodybind.nxnx_ik.nxnx_scene.nxnx_character.nx
imported by: nx_charlab_wasm_vet.nxnx_wasm_charlab_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 16 | const O_MAGIC_2600: i64 = 2600 |
| 17 | const O_MAGIC_1400: i64 = 1400 |
| 18 | const O_MAGIC_1200: i64 = 1200 |
| 19 | const O_MAGIC_2050: i64 = 2050 |
| 20 | const O_MAGIC_99999: i64 = 99999 |
| 21 | const O_MAGIC_65536: i64 = 65536 |
| 23 | const W: i64 = 320 |
| 24 | const H: i64 = 240 |
| 25 | const HW: i64 = 160 |
| 26 | const GROUNDY: i64 = 225 |
| 27 | const SCALE: i64 = 18 |
| 28 | const O_FB: i64 = 0 |
| 29 | const O_SK: i64 = 614400 // sk_bytes 188736 |
| 30 | const O_SRL: i64 = 803200 // sr_bytes 6848 |
| 31 | const O_SRR: i64 = 810112 |
| 32 | const O_BB: i64 = 817024 // bb_bytes 1088 |
| 33 | const O_SC: i64 = 818176 // scene arena (sc_bytes ~132k) |
| 34 | const O_ST: i64 = 950272 // [0]=tick [1]=btn [2]=mx [3]=my [4]=breathe [5]=scene-play [6]=scene-t [7]=preset |
| 36 | const CH_ARM_X: i64 = 100 |
| 37 | const CH_ARM_Y: i64 = 101 |
| 38 | const CH_SOFT_R: i64 = 300 |
functions
| 39 | func st_ptr(base: i64) -> *i64 { return (base + O_ST) as *i64 } |
| 40 | func chr_ptr(base: i64) -> *i64 { return (base + O_ST + 64) as *i64 } // char record in st slots [8..23] |
| 41 | func mem_bytes() -> i64 { return O_ST + 256 } |
| 44 | func scene_build(base: i64) -> i64 |
| 65 | func world_init(base: i64) -> i64 |
| 104 | func start_at(base: i64) -> i64 { let st: *i64 = st_ptr(base); st[7] = 0; return world_init(base) } |
| 106 | func tick_at(base: i64, mx: i64, my: i64, buttons: i64) -> i64 |
| 148 | func px(base: i64, x: i64, y: i64, col: i64) -> i64 |
| 157 | func rgbp(r: i64, g: i64, b: i64) -> i64 { return r + g * 256 + b * O_MAGIC_65536 } called by 1: render_at |
| 158 | func shade(col: i64, num: i64, den: i64) -> i64 |
| 170 | func sxof(wx: i64) -> i64 { return HW + wx / SCALE } |
| 171 | func syof(wy: i64) -> i64 { return GROUNDY - wy / SCALE } |
| 172 | func chl_isqrt(v: i64) -> i64 { if v <= 0 { return 0 } var x: i64 = v; var y: i64 = (x + 1) / 2; while y < x { x = y; y = (x + v / x) / 2 } return x } called by 1: limb |
| 173 | func chl_min3(a: i64, b: i64, c: i64) -> i64 { var m: i64 = a; if b < m { m = b } if c < m { m = c } return m } called by 1: fill_tri |
| 174 | func chl_max3(a: i64, b: i64, c: i64) -> i64 { var m: i64 = a; if b > m { m = b } if c > m { m = c } return m } called by 1: fill_tri |
| 177 | func fill_tri(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, x2: i64, y2: i64, col: i64) -> i64 |
| 205 | func fill_disk(base: i64, cx: i64, cy: i64, r: i64, col: i64) -> i64 |
| 222 | func limb(base: i64, x0: i64, y0: i64, w0: i64, x1: i64, y1: i64, w1: i64, col: i64) -> i64 |
| 245 | func fill_region(base: i64, reg: i64, col: i64) -> i64 |
| 269 | func render_at(base: i64) -> i64 |
| 340 | func region_area(base: i64, which: i64) -> i64 |
| 346 | func start() -> i64 { return start_at(0) } |
| 347 | func tick(mx: i64, my: i64, buttons: i64) -> i64 { return tick_at(0, mx, my, buttons) } calls 1: tick_at |
| 348 | func render() -> i64 { return render_at(0) } calls 1: render_at |
| 349 | func area_l() -> i64 { return region_area(0, 0) } calls 1: region_area |
| 350 | func area_r() -> i64 { return region_area(0, 1) } calls 1: region_area |
| 351 | func fb_off() -> i64 { return O_FB } |
| 352 | func ww() -> i64 { return W } |
| 353 | func hh() -> i64 { return H } |
| 354 | func main() -> i64 { start(); return 0 } calls 1: start |