code wiki / (root) / nx_wasm_charlab.nx

nx_wasm_charlab.nx

buildroot/runtime/nx_wasm_charlab.nx

15617 B354 linesdepth 4pulls 9 transitivereach 2 importersview sourcekind tooltopic wasm
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_itrig.nx nx_skeleton.nx nx_softbody_region.nx nx_bodybind.nx nx_ik.nx nx_scene.nx nx_character.nx nx_wasm_charlab.nx nx_charlab_wasm_vet.nx nx_wasm_charlab_gate.nx

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

main start start_at st_ptr world_init sk_init sk_hdr sk_add_bone sk_hdr ↻ sk_bone chr_ptr chr_preset chr_set chr_preset ↻ st_ptr ↻ sr_init sr_hdr sr_ring sys_mmap sr_add_node sr_hdr ↻ sr_node sr_hdr ↻ sr_node ↻ sr_isqrt sr_param sr_hdr ↻ sr_add_capsule sr_hdr ↻ sr_cap bb_init bb_hdr bb_add bb_hdr ↻ bb_row scene_build sc_init sc_hdr sc_channel sc_hdr ↻

structs

none

consts

16const O_MAGIC_2600: i64 = 2600
17const O_MAGIC_1400: i64 = 1400
18const O_MAGIC_1200: i64 = 1200
19const O_MAGIC_2050: i64 = 2050
20const O_MAGIC_99999: i64 = 99999
21const O_MAGIC_65536: i64 = 65536
23const W: i64 = 320
24const H: i64 = 240
25const HW: i64 = 160
26const GROUNDY: i64 = 225
27const SCALE: i64 = 18
28const O_FB: i64 = 0
29const O_SK: i64 = 614400 // sk_bytes 188736
30const O_SRL: i64 = 803200 // sr_bytes 6848
31const O_SRR: i64 = 810112
32const O_BB: i64 = 817024 // bb_bytes 1088
33const O_SC: i64 = 818176 // scene arena (sc_bytes ~132k)
34const O_ST: i64 = 950272 // [0]=tick [1]=btn [2]=mx [3]=my [4]=breathe [5]=scene-play [6]=scene-t [7]=preset
36const CH_ARM_X: i64 = 100
37const CH_ARM_Y: i64 = 101
38const CH_SOFT_R: i64 = 300

functions

39func st_ptr(base: i64) -> *i64 { return (base + O_ST) as *i64 }
40func chr_ptr(base: i64) -> *i64 { return (base + O_ST + 64) as *i64 } // char record in st slots [8..23]
41func mem_bytes() -> i64 { return O_ST + 256 }
called by 2: mainmain
44func scene_build(base: i64) -> i64
65func world_init(base: i64) -> i64
104func start_at(base: i64) -> i64 { let st: *i64 = st_ptr(base); st[7] = 0; return world_init(base) }
called by 3: mainstartmain calls 2: st_ptrworld_init
106func tick_at(base: i64, mx: i64, my: i64, buttons: i64) -> i64
148func px(base: i64, x: i64, y: i64, col: i64) -> i64
157func rgbp(r: i64, g: i64, b: i64) -> i64 { return r + g * 256 + b * O_MAGIC_65536 }
called by 1: render_at
158func shade(col: i64, num: i64, den: i64) -> i64
170func sxof(wx: i64) -> i64 { return HW + wx / SCALE }
171func syof(wy: i64) -> i64 { return GROUNDY - wy / SCALE }
172func 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
173func 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
174func 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
177func fill_tri(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, x2: i64, y2: i64, col: i64) -> i64
called by 2: limbfill_region calls 3: chl_min3chl_max3px
205func fill_disk(base: i64, cx: i64, cy: i64, r: i64, col: i64) -> i64
called by 3: limbfill_regionrender_at calls 2: pxshade
222func limb(base: i64, x0: i64, y0: i64, w0: i64, x1: i64, y1: i64, w1: i64, col: i64) -> i64
245func fill_region(base: i64, reg: i64, col: i64) -> i64
269func render_at(base: i64) -> i64
340func region_area(base: i64, which: i64) -> i64
called by 2: area_larea_r calls 1: sr_area
346func start() -> i64 { return start_at(0) }
called by 1: main calls 1: start_at
347func tick(mx: i64, my: i64, buttons: i64) -> i64 { return tick_at(0, mx, my, buttons) }
calls 1: tick_at
348func render() -> i64 { return render_at(0) }
calls 1: render_at
349func area_l() -> i64 { return region_area(0, 0) }
calls 1: region_area
350func area_r() -> i64 { return region_area(0, 1) }
calls 1: region_area
351func fb_off() -> i64 { return O_FB }
called by 2: mainmain
352func ww() -> i64 { return W }
called by 2: mainmain
353func hh() -> i64 { return H }
called by 2: mainmain
354func main() -> i64 { start(); return 0 }
calls 1: start