nx_worldpipe_render.nx
buildroot/runtime/nx_worldpipe_render.nx
about
nx_worldpipe_render.nx -- THE PRODUCER OF THE PUBLISHED WORLD IMAGE, WITH STAGE 3.5 EROSION APPLIED.
WHY THIS ORGAN EXISTS. The picture published at https://nishifamily.com/world/foundation had exactly
ONE producer in the whole tree: nx_worldpipe_gate's T8 EVIDENCE emit. Measured, not assumed --
nx_shelltool grep over 23,207 sources returned coverage_complete=1 corpus_complete=1 and named that
one write_png call as the only writer of knowledge/nx_worldpipe.png. A gate is a RULER; making it
also the FACTORY means the shipped picture only refreshes when somebody runs the test, and it means
the picture can never be given a parameter the test does not itself want. The factory is separated
out here and the gate is left untouched.
WHAT IS NEW IN THE PICTURE. PG20 shipped erosion as a PROCESS on this heightfield (wp_erode_bake /
wp_erode, proven by nx_worldpipe_erode_gate 21/21 GREEN over the full 102,400-cell population) and
it was INERT IN PRODUCTION BY CONSTRUCTION: WP_ERODE is armed by default, but wp_erode returns 0
until a bake has run and NO consumer anywhere called wp_erode_bake. A capability that never reaches
a surface is not shipped, however green its gate is. This organ is the consumer that opts in.
SCOPING, AND WHY NOBODY ELSE MOVES. The opt-in is the BAKE, not a flag. A consumer that never calls
wp_erode_bake still has WP_ERG == 0, so wp_erode returns 0 and wp_height is byte-identical.
Opting in HERE therefore cannot move nx_worldpipe_gate, nx_m2d_engine, nx_authorgen or any other
importer -- and that is a property of the code, not a promise made in a comment.
PARAMETERS -- NAMED OR DERIVED, NONE TASTED. wp_erode_bake_derived takes a tick BUDGET and derives
everything else from the terrain it is about to erode (talus from the ground's own mean neighbour
drop; rain and flux are the erosion library's unit rate Q). The budget below is NOT a taste
constant: it is the exact budget nx_worldpipe_erode_gate exercises and proves -- at that budget
material demonstrably MOVES, leaves steep ground for flat ground, conserves mass, and two bakes
agree cell-for-cell. Adopting a budget already proven to do work is the declared basis.
argv[2] overrides it so an A/B costs no rebuild.
THE RENDER COMPOSITION IS COPIED, AND THAT IS DECLARED RATHER THAN HIDDEN. The block below
reproduces nx_worldpipe_gate's T8 composition (biome map + spawn cross + 3D hero + biome features)
because that composition is inline in the gate's main() and is therefore not callable. This is a
second copy of a COMPOSITION, not of a RULER -- no judgement is duplicated -- and the real fix is to
extract it into a shared wpv_render(). That is filed as debt, not forgotten.
usage: nx_worldpipe_render [out.png] [ticks]
exit: 0 written and read-back-verified | 2 usage | 5 png-write-or-readback-fail | 6 bake-refused
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_png.nxnx_trimesh.nxnx_worldpipe.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 46 | const WR_MAPW: i64 = 360 |
| 47 | const WR_HERW: i64 = 560 |
| 48 | const WR_GH: i64 = 360 |
| 49 | const WR_SHIFT16: i64 = 65536 |
| 51 | const WR_SEED: i64 = 1 |
| 54 | const WR_TICKS: i64 = 8 |
| 56 | const WR_CAM_D: i64 = 5900 |
| 59 | const WR_PNG_MIN: i64 = 45 |
| 60 | const WR_OUT_DEFAULT: *u8 = "knowledge/nx_worldpipe_eroded.png" |
functions
| 62 | func wr_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 63 | func wr_puts(s: *u8) -> i64 { sys_write(1, s, wr_slen(s)); return 0 } |
| 64 | func wr_pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 } |
| 65 | func wr_clearfb(fb: *i64, n: i64, c: i64) -> i64 { var i: i64=0; while i<n { fb[i]=c; i=i+1 } return 0 } |
| 66 | func wr_int(s: *u8) -> i64 |
| 77 | func main(argc: i64, argv: *i64) -> i64 |