nx_wasm_explodelab.nx
buildroot/runtime/nx_wasm_explodelab.nx
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
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
structs
| none |
consts
| 15 | const O_MAGIC_4096: i64 = 4096 |
| 16 | const O_MAGIC_8192: i64 = 8192 |
| 17 | const O_MAGIC_4280860390: i64 = 4280860390 |
| 18 | const O_MAGIC_4280824550: i64 = 4280824550 |
| 19 | const O_MAGIC_4284139580: i64 = 4284139580 |
| 20 | const O_MAGIC_4288714390: i64 = 4288714390 |
| 21 | const O_MAGIC_4293294150: i64 = 4293294150 |
| 22 | const O_MAGIC_4292006610: i64 = 4292006610 |
| 23 | const O_MAGIC_1024: i64 = 1024 |
| 24 | const O_MAGIC_65536: i64 = 65536 |
| 25 | const O_MAGIC_16777216: i64 = 16777216 |
| 26 | const O_MAGIC_4278190080: i64 = 4278190080 |
| 37 | const W: i64 = 960 |
| 38 | const H: i64 = 720 |
| 39 | const O_FB: i64 = 0 |
| 40 | const O_ZB: i64 = 5529600 |
| 41 | const O_LV: i64 = 11059200 |
| 42 | const O_WV: i64 = 11190272 |
| 43 | const O_IDX: i64 = 11321344 |
| 44 | const O_HOME: i64 = 11517952 |
| 45 | const O_DIR: i64 = 11519488 |
| 46 | const O_DEP: i64 = 11521024 |
| 47 | const O_VST: i64 = 11521536 |
| 48 | const O_VCT: i64 = 11522048 |
| 49 | const O_E: i64 = 11522560 |
| 50 | const O_SC: i64 = 11522816 |
| 51 | const O_PROJ: i64 = 11522832 |
| 52 | const O_ROTY: i64 = 11522960 |
| 53 | const O_MV: i64 = 11523088 |
| 54 | const O_TRANS: i64 = 11523216 |
| 55 | const O_MVP: i64 = 11523344 |
| 56 | const O_VBUF: i64 = 11523472 |
| 57 | const O_CLIP: i64 = 11523536 |
| 58 | const O_SCR: i64 = 11523600 // PER-VERTEX scratch: 4096 verts * 4 i64 = 131072 B (mr_render writes scr[vi*4]) |
| 59 | const O_TRI: i64 = 11654672 |
| 60 | const O_ST: i64 = 11654800 |
| 63 | const DIST: i64 = 40000 |
| 64 | const FOVH: i64 = 30 |
| 65 | const BG: i64 = 4280293912 |
| 66 | const EXL_NEAR: i64 = 16384 // = nx_meshrender MR_NEAR (1.0 Q14 near plane) |
| 67 | const EXL_FAR: i64 = 16384000 // = nx_meshrender MR_FAR (1000.0 Q14 far plane) |
| 68 | const O_ROTX: i64 = 11654928 // pitch matrix scratch (past O_ST+128) |
| 69 | const O_YP: i64 = 11655056 // yaw*pitch product scratch |
| 70 | const PITCH: i64 = 26 // fixed camera elevation (deg) -> the 3/4 CAD view that reveals 3D form |
functions
| 72 | func st_ptr(base: i64) -> *i64 { return (base + O_ST) as *i64 } |
| 73 | func mem_bytes() -> i64 { return O_YP + 128 } |
| 74 | func e_ptr(base: i64) -> *i64 { return (base + O_E) as *i64 } |
| 76 | func world_init(base: i64) -> i64 |
| 113 | func start_at(base: i64) -> i64 { return world_init(base) } |
| 115 | func tick_at(base: i64, mx: i64, my: i64, buttons: i64) -> i64 |
| 169 | func exl_roty(deg: i64, out: *i64) -> i64 |
| 183 | func exl_rotx(deg: i64, out: *i64) -> i64 |
| 197 | func exl_project(mvp: *i64, vx: i64, vy: i64, vz: i64, w: i64, h: i64, vbuf: *i64, clipbuf: *i64, scr: *i64, base: i64) -> i64 |
| 219 | func exl_shade(col: i64, li: i64, sp: i64) -> i64 called by 1: exr_render |
| 230 | func exl_spec(cosq: i64) -> i64 called by 1: exr_render |
| 239 | func exl_lambert(verts: *i64, a: i64, b: i64, c: i64) -> i64 |
| 262 | func exl_aa(fb: *i64, w: i64, h: i64) -> i64 called by 1: exr_render |
| 292 | func exr_render(base: i64) -> i64 |
| 352 | func render_at(base: i64) -> i64 |
| 384 | func part_count_at(base: i64) -> i64 { return exl_n() } |
| 385 | func selected_at(base: i64) -> i64 { let st: *i64 = st_ptr(base); return st[4] } |
| 386 | func explode_t_at(base: i64) -> i64 { let st: *i64 = st_ptr(base); return st[2] } |
| 387 | func angle_at(base: i64) -> i64 { let st: *i64 = st_ptr(base); return st[3] } |
| 390 | func start() -> i64 { return start_at(0) } |
| 391 | func tick(mx: i64, my: i64, buttons: i64) -> i64 { return tick_at(0, mx, my, buttons) } calls 1: tick_at |
| 392 | func render() -> i64 { return render_at(0) } calls 1: render_at |
| 393 | func part_count() -> i64 { return part_count_at(0) } calls 1: part_count_at |
| 394 | func selected() -> i64 { return selected_at(0) } calls 1: selected_at |
| 395 | func explode_t() -> i64 { return explode_t_at(0) } calls 1: explode_t_at |
| 396 | func angle() -> i64 { return angle_at(0) } calls 1: angle_at |
| 397 | func fb_off() -> i64 { return O_FB } called by 1: main |
| 398 | func ww() -> i64 { return W } called by 1: main |
| 399 | func hh() -> i64 { return H } called by 1: main |
| 400 | func main() -> i64 { start(); return 0 } calls 1: start |