code wiki / (root) / nx_wasm_explodelab.nx

nx_wasm_explodelab.nx

buildroot/runtime/nx_wasm_explodelab.nx

16882 B400 linesdepth 4pulls 7 transitivereach 2 importersview sourcekind tooltopic wasm
docsdependenciesstructsconstsfunctions

about

nx_wasm_explodelab.nx -- EXPLODELAB: the interactive exploded-view surface (cadtwin R2b = the explodeview benchmark's viewer half). The REAL as1-oc-214 STEP assembly (baked by nx_explodelab_treegen from the R1a parse) explodes/assembles in staged 3D (nx_explode3d) through the sovereign mesh renderer (nx_meshrender z-buffer raster) -- ALL INTEGER, so the whole surface vets byte-for-byte VM vs native. ALL logic lives here (the no-JS-logic law): JS passes raw mouse+key bits and blits the framebuffer. CONTROLS (bits): drag = orbit; short click = cycle part highlight; bit1(R) = reset; bit2(E) = explode; bit3(D) = assemble. Until touched, the explosion auto-oscillates and the view slowly orbits (demo mode). license_tier: ORIGINAL

dependencies 6 imports · 2 importers

nx_syscalls.nx nx_explode3d.nx nx_mechparts.nx nx_render_core.nx nx_explodelab_tree.nx nx_explodelab_meshes.nx nx_wasm_explodelab.nx nx_explodelab_wasm_vet.nx nx_wasm_explodelab_gate.nx

imports: nx_syscalls.nxnx_explode3d.nxnx_mechparts.nxnx_render_core.nxnx_explodelab_tree.nxnx_explodelab_meshes.nx

imported by: nx_explodelab_wasm_vet.nxnx_wasm_explodelab_gate.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main start start_at world_init e_ptr ex3_init exl_n exl_kind exl_hx exl_hy exl_hz ex3_part_begin ex3_isqrt exl_dx exl_dy exl_dz exl_depth exm_load exm_k1 exm_k1_v0 exm_k1_t0 exm_k2 exm_k2_v0 exm_k2_v1 exm_k2_t0 exm_k2_t1 exm_k3 exm_k3_v0 exm_k3_t0 exm_k4 exm_k4_v0 exm_k4_v1 exm_k4_v2 exm_k4_v3 exm_k4_t0 exm_k4_t1 exm_k4_t2 exm_k4_t3 exm_k5 exm_k5_v0

structs

none

consts

15const O_MAGIC_4096: i64 = 4096
16const O_MAGIC_8192: i64 = 8192
17const O_MAGIC_4280860390: i64 = 4280860390
18const O_MAGIC_4280824550: i64 = 4280824550
19const O_MAGIC_4284139580: i64 = 4284139580
20const O_MAGIC_4288714390: i64 = 4288714390
21const O_MAGIC_4293294150: i64 = 4293294150
22const O_MAGIC_4292006610: i64 = 4292006610
23const O_MAGIC_1024: i64 = 1024
24const O_MAGIC_65536: i64 = 65536
25const O_MAGIC_16777216: i64 = 16777216
26const O_MAGIC_4278190080: i64 = 4278190080
37const W: i64 = 960
38const H: i64 = 720
39const O_FB: i64 = 0
40const O_ZB: i64 = 5529600
41const O_LV: i64 = 11059200
42const O_WV: i64 = 11190272
43const O_IDX: i64 = 11321344
44const O_HOME: i64 = 11517952
45const O_DIR: i64 = 11519488
46const O_DEP: i64 = 11521024
47const O_VST: i64 = 11521536
48const O_VCT: i64 = 11522048
49const O_E: i64 = 11522560
50const O_SC: i64 = 11522816
51const O_PROJ: i64 = 11522832
52const O_ROTY: i64 = 11522960
53const O_MV: i64 = 11523088
54const O_TRANS: i64 = 11523216
55const O_MVP: i64 = 11523344
56const O_VBUF: i64 = 11523472
57const O_CLIP: i64 = 11523536
58const O_SCR: i64 = 11523600 // PER-VERTEX scratch: 4096 verts * 4 i64 = 131072 B (mr_render writes scr[vi*4])
59const O_TRI: i64 = 11654672
60const O_ST: i64 = 11654800
63const DIST: i64 = 40000
64const FOVH: i64 = 30
65const BG: i64 = 4280293912
66const EXL_NEAR: i64 = 16384 // = nx_meshrender MR_NEAR (1.0 Q14 near plane)
67const EXL_FAR: i64 = 16384000 // = nx_meshrender MR_FAR (1000.0 Q14 far plane)
68const O_ROTX: i64 = 11654928 // pitch matrix scratch (past O_ST+128)
69const O_YP: i64 = 11655056 // yaw*pitch product scratch
70const PITCH: i64 = 26 // fixed camera elevation (deg) -> the 3/4 CAD view that reveals 3D form

functions

72func st_ptr(base: i64) -> *i64 { return (base + O_ST) as *i64 }
73func mem_bytes() -> i64 { return O_YP + 128 }
called by 2: mainmain
74func e_ptr(base: i64) -> *i64 { return (base + O_E) as *i64 }
76func world_init(base: i64) -> i64
113func start_at(base: i64) -> i64 { return world_init(base) }
called by 3: mainstartmain calls 1: world_init
115func tick_at(base: i64, mx: i64, my: i64, buttons: i64) -> i64
called by 3: maintickmain calls 3: st_ptrworld_initexl_n
169func exl_roty(deg: i64, out: *i64) -> i64
called by 1: exr_render calls 2: rc_cos_q14rc_sin_q14
183func exl_rotx(deg: i64, out: *i64) -> i64
called by 1: exr_render calls 2: rc_cos_q14rc_sin_q14
197func exl_project(mvp: *i64, vx: i64, vy: i64, vz: i64, w: i64, h: i64, vbuf: *i64, clipbuf: *i64, scr: *i64, base: i64) -> i64
called by 1: exr_render calls 1: rc_mat4_vec4
219func exl_shade(col: i64, li: i64, sp: i64) -> i64
called by 1: exr_render
230func exl_spec(cosq: i64) -> i64
called by 1: exr_render
239func exl_lambert(verts: *i64, a: i64, b: i64, c: i64) -> i64
called by 1: exr_render calls 1: rc_isqrt
262func exl_aa(fb: *i64, w: i64, h: i64) -> i64
called by 1: exr_render
292func exr_render(base: i64) -> i64
352func render_at(base: i64) -> i64
384func part_count_at(base: i64) -> i64 { return exl_n() }
called by 1: part_count calls 1: exl_n
385func selected_at(base: i64) -> i64 { let st: *i64 = st_ptr(base); return st[4] }
called by 1: selected calls 1: st_ptr
386func explode_t_at(base: i64) -> i64 { let st: *i64 = st_ptr(base); return st[2] }
called by 1: explode_t calls 1: st_ptr
387func angle_at(base: i64) -> i64 { let st: *i64 = st_ptr(base); return st[3] }
called by 1: angle calls 1: st_ptr
390func start() -> i64 { return start_at(0) }
called by 1: main calls 1: start_at
391func tick(mx: i64, my: i64, buttons: i64) -> i64 { return tick_at(0, mx, my, buttons) }
calls 1: tick_at
392func render() -> i64 { return render_at(0) }
calls 1: render_at
393func part_count() -> i64 { return part_count_at(0) }
calls 1: part_count_at
394func selected() -> i64 { return selected_at(0) }
calls 1: selected_at
395func explode_t() -> i64 { return explode_t_at(0) }
calls 1: explode_t_at
396func angle() -> i64 { return angle_at(0) }
calls 1: angle_at
397func fb_off() -> i64 { return O_FB }
called by 1: main
398func ww() -> i64 { return W }
called by 1: main
399func hh() -> i64 { return H }
called by 1: main
400func main() -> i64 { start(); return 0 }
calls 1: start