code wiki / (root) / nx_wasmcube.nx

nx_wasmcube.nx

buildroot/runtime/nx_wasmcube.nx

6361 B152 linesdepth 1pulls 1 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_wasmcube.nx -- the f32 renderer in the WASM/BROWSER memory model: a rotated shaded 3D cube drawn to a framebuffer in fixed linear-memory offsets (NO sys_mmap -- wasm has no syscalls). f32 mat4 camera (the now- wasm-capable __f32_*), painter-sorted faces, integer fill. JS passes cos/sin (it owns trig), reads the fb, blits to <canvas>. Compiles via the SOVEREIGN nx_compile_wat -> nx_wat_compiler -> .wasm. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_f32_hw.nx nx_wasmcube.nx

imports: nx_f32_hw.nx

imported by: nobody (leaf or entry point)

structs

none

consts

6const O_MAGIC_65536: i64 = 65536
7const O_MAGIC_16777216: i64 = 16777216
9const W: i64 = 128
10const H: i64 = 128
11const HWc: i64 = 64
12const HHc: i64 = 64
13const SCALE: i64 = 34
14const O_FB: i64 = 0
15const O_RY: i64 = 131072
16const O_RX: i64 = 131200
17const O_R: i64 = 131328
18const O_SX: i64 = 131456
19const O_SY: i64 = 131520
20const O_TZ: i64 = 131584
21const O_F: i64 = 131648
22const O_DRAWN: i64 = 132128
23const O_VTMP: i64 = 132176
24const O_OTMP: i64 = 132208

functions

26func imin(a: i64, b: i64) -> i64 { if a < b { return a } return b }
called by 2: min3fill_tri
27func imax(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 2: max3fill_tri
28func min3(a: i64, b: i64, c: i64) -> i64 { return imin(a, imin(b, c)) }
called by 1: fill_tri calls 1: imin
29func max3(a: i64, b: i64, c: i64) -> i64 { return imax(a, imax(b, c)) }
called by 1: fill_tri calls 1: imax
30func same_sign3(a: i64, b: i64, c: i64) -> i64
called by 1: fill_tri
35func fbp() -> *i64 { return (O_FB as i64) as *i64 }
called by 2: fill_trirender
36func fratio(num: i64, den: i64) -> i64 { return f32_div(f32_of(num), f32_of(den)) }
called by 1: render calls 2: f32_divf32_of
37func fill_tri(x0: i64, y0: i64, x1: i64, y1: i64, x2: i64, y2: i64, col: i64) -> i64
59func rot_nz(R: *i64, lx: i64, ly: i64, lz: i64) -> i64
called by 1: render calls 2: f32_ofm4_vec4
66func shade(nz: i64) -> i64
called by 1: render calls 3: f32_off32_intf32_mul
71func packc(r: i64, g: i64, b: i64, br: i64) -> i64
called by 1: render
78func render(ycos: i64, ysin: i64, xcos: i64, xsin: i64) -> i64
149func fb_off() -> i64 { return O_FB }
150func ww() -> i64 { return W }
151func hh() -> i64 { return H }
152func main() -> i64 { return 0 }