nx_wasmcube.nx
buildroot/runtime/nx_wasmcube.nx
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
imports: nx_f32_hw.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 6 | const O_MAGIC_65536: i64 = 65536 |
| 7 | const O_MAGIC_16777216: i64 = 16777216 |
| 9 | const W: i64 = 128 |
| 10 | const H: i64 = 128 |
| 11 | const HWc: i64 = 64 |
| 12 | const HHc: i64 = 64 |
| 13 | const SCALE: i64 = 34 |
| 14 | const O_FB: i64 = 0 |
| 15 | const O_RY: i64 = 131072 |
| 16 | const O_RX: i64 = 131200 |
| 17 | const O_R: i64 = 131328 |
| 18 | const O_SX: i64 = 131456 |
| 19 | const O_SY: i64 = 131520 |
| 20 | const O_TZ: i64 = 131584 |
| 21 | const O_F: i64 = 131648 |
| 22 | const O_DRAWN: i64 = 132128 |
| 23 | const O_VTMP: i64 = 132176 |
| 24 | const O_OTMP: i64 = 132208 |
functions
| 26 | func imin(a: i64, b: i64) -> i64 { if a < b { return a } return b } |
| 27 | func imax(a: i64, b: i64) -> i64 { if a > b { return a } return b } |
| 28 | func min3(a: i64, b: i64, c: i64) -> i64 { return imin(a, imin(b, c)) } |
| 29 | func max3(a: i64, b: i64, c: i64) -> i64 { return imax(a, imax(b, c)) } |
| 30 | func same_sign3(a: i64, b: i64, c: i64) -> i64 called by 1: fill_tri |
| 35 | func fbp() -> *i64 { return (O_FB as i64) as *i64 } |
| 36 | func fratio(num: i64, den: i64) -> i64 { return f32_div(f32_of(num), f32_of(den)) } |
| 37 | func fill_tri(x0: i64, y0: i64, x1: i64, y1: i64, x2: i64, y2: i64, col: i64) -> i64 |
| 59 | func rot_nz(R: *i64, lx: i64, ly: i64, lz: i64) -> i64 |
| 66 | func shade(nz: i64) -> i64 |
| 71 | func packc(r: i64, g: i64, b: i64, br: i64) -> i64 called by 1: render |
| 78 | func render(ycos: i64, ysin: i64, xcos: i64, xsin: i64) -> i64 |
| 149 | func fb_off() -> i64 { return O_FB } |
| 150 | func ww() -> i64 { return W } |
| 151 | func hh() -> i64 { return H } |
| 152 | func main() -> i64 { return 0 } |