code wiki / _hdl_build / nx_mesh_terrain_gate.nx

nx_mesh_terrain_gate.nx

buildroot/runtime/_hdl_build/nx_mesh_terrain_gate.nx

7941 B202 linesdepth 2pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic mesh
docsdependenciesstructsconstsfunctions

about

nx_mesh_terrain_gate.nx -- proves the renderer is NOT voxel-bound: a smooth TRIANGULATED heightfield mesh (not cubes) on the same sovereign f32 raster path. Same value-noise terrain as the voxel world, but rendered as a continuous low-poly surface: per-grid-point f32 height, 2 triangles per cell, slope-based flat shading, height biomes, perspective + z-buffer. exit 0 = rendered. Writes mesh_terrain.bmp. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_f32_hw.nx nx_mesh_terrain_gate.nx

imports: nx_syscalls.nxnx_f32_hw.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap m4_roty m4_identity f32_of f32_neg fratio f32_div f32_of ↻ m4_rotx m4_identity ↻ f32_neg ↻ f32_neg ↻ m4_mul f32_of ↻ f32_add f32_mul hcenti vlat projh sys_mmap ↻ f32_sub f32_neg ↻ f32_of ↻ fratio ↻ f32_div ↻ m4_vec4 f32_of ↻ f32_add ↻ f32_mul ↻ f32_add ↻ f32_int f32_mul ↻ tri_color max3 imax min3 imin clamp255 fill_flat

structs

none

consts

8const W: i64 = 320
9const H: i64 = 240
10const HW: i64 = 160
11const HH: i64 = 120
12const GRID: i64 = 22
13const FOCAL: i64 = 340
14const PUSH: i64 = 40
15const ZFAR: i64 = 1073741824

functions

17func imin(a: i64, b: i64) -> i64 { if a < b { return a } return b }
called by 2: min3fill_flat
18func imax(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 2: max3fill_flat
19func min3(a: i64, b: i64, c: i64) -> i64 { return imin(a, imin(b, c)) }
called by 2: fill_flattri_color calls 1: imin
20func max3(a: i64, b: i64, c: i64) -> i64 { return imax(a, imax(b, c)) }
called by 2: fill_flattri_color calls 1: imax
21func clamp255(v: i64) -> i64 { if v < 0 { return 0 } if v > 255 { return 255 } return v }
called by 1: tri_color
22func same_sign3(a: i64, b: i64, c: i64) -> i64
called by 1: fill_flat
27func fratio(num: i64, den: i64) -> i64 { return f32_div(f32_of(num), f32_of(den)) }
called by 2: projhmain calls 2: f32_divf32_of
30func vlat(ix: i64, iz: i64) -> i64 { var n: i64 = (ix * 131 + iz * 197 + ix * iz * 13 + 1290) % 256; if n < 0 { n = n + 256 } return n }
called by 1: hcenti
31func hcenti(i: i64, j: i64) -> i64
called by 1: main calls 1: vlat
48func fill_flat(fb: *i64, zb: *i64, x0: i64, y0: i64, d0: i64, x1: i64, y1: i64, d1: i64, x2: i64, y2: i64, d2: i64, col: i64) -> i64
called by 1: main calls 5: imaxmin3iminmax3same_sign3
74func projh(R: *i64, i: i64, hy: i64, j: i64, out: *i64) -> i64
93func tri_color(ha: i64, hb: i64, hc: i64) -> i64
called by 1: main calls 3: max3min3clamp255
103func put_u32le(b: *u8, o: i64, v: i64) -> i64
called by 1: write_bmp
110func write_bmp(fb: *i64, path: *u8) -> i64
146func main() -> i64