code wiki / (root) / nx_meshtex.nx

nx_meshtex.nx

buildroot/runtime/nx_meshtex.nx

9319 B171 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_meshtex.nx -- R4: TEXTURED emitted-mesh renderer. Two fidelity moves the critic's pinned axes need: (1) EXACT normals -- an SDF-derived mesh's true outward normal is the FIELD GRADIENT (central differences on sdf_eval), smooth + consistent, unlike winding-dependent face normals (kills the patchy Gouraud); (2) per-PIXEL procedural SKIN -- pore micro-bump (high-freq) + tone MOTTLE (low-freq), keyed on the fixed MODEL position (rotation-invariant -> detail sticks to the surface). Per-pixel shading in fx256 (like nx_swgpu, deterministic). Composes sdf_eval + it_sin4096; own raster loop. NOTE: SDF-gradient normals need the analytic field (t2mesh objects have it); i2mesh (image-inflation) meshes would use an F-grid gradient -- a later unify, disclosed. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_itrig.nx nx_sdfrender.nx nx_meshtex.nx nx_genloop_gate.nx

imports: nx_syscalls.nxnx_itrig.nxnx_sdfrender.nx

imported by: nx_genloop_gate.nx

structs

none

consts

12const MT_MAGIC_65536: i64 = 65536
13const MT_MAGIC_1024: i64 = 1024
14const MT_MAGIC_4096: i64 = 4096
15const MT_MAGIC_92821: i64 = 92821
16const MT_MAGIC_68917: i64 = 68917
17const MT_MAGIC_40503: i64 = 40503
19const MT_ZFAR: i64 = 1073741824

functions

21func mt_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 }
22func mt_min(a: i64, b: i64) -> i64 { if a < b { return a } return b }
called by 1: mt_render
23func mt_max(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 1: mt_render
26func mt_sdf_normals(base: i64, vb: *i64, nv: i64, nbuf: *i64) -> i64
called by 1: main calls 2: sdf_evalmt_isqrt
46func mt_render(vb: *i64, tb: *i64, nbuf: *i64, nv: i64, nf: i64, fb: *i64, zb: *i64, w: i64, h: i64, yaw: i64, camu: i64, focal: i64, skin_r: i64, skin_g: i64, scratch: *i64) -> i64