nx_wasmvoxel.nx
buildroot/runtime/nx_wasmvoxel.nx
about
nx_wasmvoxel.nx -- a VOXEL TERRAIN in the WASM/BROWSER memory model: an 8x8 heightmap (two procedural hills,
height-banded grass/rock/snow) of f32-projected voxel columns, painter-sorted far->near, integer-filled to a
fixed-offset framebuffer. Same sovereign chain as the cube (nx_compile_wat -> nx_wat_compiler -> .wasm). JS owns
trig + blits the fb to <canvas>; wasm owns the world + the hardware f32 math. 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 = 9 |
| 14 | const N: i64 = 8 |
| 15 | const O_FB: i64 = 0 |
| 16 | const O_RY: i64 = 131072 |
| 17 | const O_RX: i64 = 131200 |
| 18 | const O_R: i64 = 131328 |
| 19 | const O_VTMP: i64 = 131456 |
| 20 | const O_OTMP: i64 = 131488 |
| 21 | const O_SX: i64 = 131520 |
| 22 | const O_SY: i64 = 131584 |
| 23 | const O_CIDX: i64 = 131648 |
| 24 | const O_CZ: i64 = 132160 |
| 25 | const O_CX: i64 = 132672 |
| 26 | const O_CZW: i64 = 133184 |
| 27 | const O_CH: i64 = 133696 |
| 28 | const O_FACES: i64 = 134208 |
functions
| 30 | func imin(a: i64, b: i64) -> i64 { if a < b { return a } return b } |
| 31 | func imax(a: i64, b: i64) -> i64 { if a > b { return a } return b } |
| 32 | func min3(a: i64, b: i64, c: i64) -> i64 { return imin(a, imin(b, c)) } |
| 33 | func max3(a: i64, b: i64, c: i64) -> i64 { return imax(a, imax(b, c)) } |
| 34 | func same_sign3(a: i64, b: i64, c: i64) -> i64 called by 1: fill_tri |
| 39 | func fbp() -> *i64 { return (O_FB as i64) as *i64 } |
| 40 | func fratio(num: i64, den: i64) -> i64 { return f32_div(f32_of(num), f32_of(den)) } |
| 41 | func fill_tri(x0: i64, y0: i64, x1: i64, y1: i64, x2: i64, y2: i64, col: i64) -> i64 |
| 63 | func rot_nz(R: *i64, lx: i64, ly: i64, lz: i64) -> i64 |
| 70 | func shade(nz: i64) -> i64 |
| 75 | func packc(r: i64, g: i64, b: i64, br: i64) -> i64 called by 1: render |
| 82 | func hcol(gx: i64, gz: i64) -> i64 called by 1: render |
| 92 | func face_nz(R: *i64, fidx: i64) -> i64 |
| 100 | func basergb(hh: i64, top: i64) -> i64 called by 1: render |
| 111 | func render(ycos: i64, ysin: i64, xcos: i64, xsin: i64) -> i64 |
| 219 | func fb_off() -> i64 { return O_FB } |
| 220 | func ww() -> i64 { return W } |
| 221 | func hh() -> i64 { return H } |
| 222 | func main() -> i64 { return 0 } |