code wiki / (root) / nx_meshtex.nx

nx_meshtex.nx

buildroot/runtime/nx_meshtex.nx

9244 B172 linesdepth 4pulls 6 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 4 imports · 1 importers

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

imports: nx_syscalls.nxnx_itrig.nxnx_sdfrender.nxnx_vecmath.nx

imported by: nx_genloop_gate.nx

structs

none

consts

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

functions

22func mt_isqrt(v: i64) -> i64 { return vm_isqrt(v) }
called by 2: mt_sdf_normalsmt_render calls 1: vm_isqrt
23func mt_min(a: i64, b: i64) -> i64 { if a < b { return a } return b }
called by 1: mt_render
24func mt_max(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 1: mt_render
27func mt_sdf_normals(base: i64, vb: *i64, nv: i64, nbuf: *i64) -> i64
called by 1: main calls 2: sdf_evalmt_isqrt
47func 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