code wiki / (root) / nx_cornell.nx

nx_cornell.nx

buildroot/runtime/nx_cornell.nx

16818 B332 linesdepth 3pulls 4 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_cornell.nx -- ★THE CORNELL BOX on the sovereign stack (field-evidence rung 3: the measured GI reference). A real PATCH RADIOSITY solver -- Goral/Torrance/Greenberg/Battaile's own SIGGRAPH'84 method, for the very box they built: red left wall, green right wall, white floor/ceiling/back, ceiling area light, two blocks. Patches gather B = E + rho*Sum(F_ij*B_j) with point-to-patch form factors + BLOCK OCCLUSION (soft shadows); COLOR BLEEDING emerges from the bounce, never painted. Axis-aligned block variant; coords shifted so the box centre is the origin (camera z=-camz). All integer: F in Q16, radiosity B in milli, reflectance fx1024. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_trimesh.nx nx_cornell.nx nx_cornell_dyn_gate.nx nx_cornell_gate.nx

imports: nx_syscalls.nxnx_trimesh.nx

imported by: nx_cornell_dyn_gate.nxnx_cornell_gate.nx

structs

none

consts

9const COR_MAGIC_100000: i64 = 100000
10const COR_MAGIC_1024: i64 = 1024
11const COR_MAGIC_51472: i64 = 51472
12const COR_MAGIC_16384: i64 = 16384
13const COR_MAGIC_65536: i64 = 65536
14const COR_MAGIC_4096: i64 = 4096
16const COR_CAP: i64 = 700

functions

45func cor_isqrt(v: i64) -> i64 { if v <= 0 { return 0 } var x: i64 = v; var y: i64 = (x+1)/2; while y < x { x=y; y=(x+v/x)/2 } return x }
46func cor_alloc() -> i64
called by 1: cornell_build calls 1: sys_mmap
62func cor_addgrid(P: *i64) -> i64
called by 1: cornell_build calls 1: cor_isqrt
98func cornell_build() -> i64
158func cor_seg_box(x0: i64, y0: i64, z0: i64, x1: i64, y1: i64, z1: i64, B: *i64) -> i64
called by 1: cor_occluded
184func cor_boxes_init() -> i64
called by 1: cornell_build calls 1: sys_mmap
193func cor_occluded(x0: i64, y0: i64, z0: i64, x1: i64, y1: i64, z1: i64) -> i64
called by 1: cor_ff_pair calls 1: cor_seg_box
200func cornell_move_light(dx: i64, dz: i64) -> i64
called by 1: main
207func cornell_move_tall(dx: i64) -> i64
called by 1: main
217func cor_ff_pair(i: i64, j: i64) -> i64
240func cornell_formfactors() -> i64
called by 2: mainmain calls 1: cor_ff_pair
253func cornell_ff_partial(from: i64, to: i64) -> i64
called by 1: main calls 1: cor_ff_pair
271func cornell_solve(iters: i64) -> i64
called by 2: mainmain
304func cor_np() -> i64 { return COR_NP }
305func cor_b(i: i64, out: *i64) -> i64 { let BR: *i64=COR_BR as *i64; let BG: *i64=COR_BG2 as *i64; let BB: *i64=COR_BB as *i64; out[0]=BR[i]; out[1]=BG[i]; out[2]=BB[i]; return 0 }
called by 4: col_rglumcol_rglum
306func cor_center(i: i64, out: *i64) -> i64 { let CXp: *i64=COR_CX as *i64; let CYp: *i64=COR_CY as *i64; let CZp: *i64=COR_CZ as *i64; out[0]=CXp[i]; out[1]=CYp[i]; out[2]=CZp[i]; return 0 }
308func cornell_tomesh(gain: i64) -> i64