code wiki / (root) / nx_nxa_texbake_decode_t279.nx

nx_nxa_texbake_decode_t279.nx

buildroot/runtime/nx_nxa_texbake_decode_t279.nx

25908 B562 linesdepth 5pulls 13 transitivereach 0 importersview sourcekind orphan librarytopic nxa
docsdependenciesstructsconstsfunctions

about

nx_nxa_texbake_lib.nx -- ★TEXTURE LADDER rungs 2b+3+4 (debt 1786546859, successor of the TEXC format rung): (2b) REGION GROUPING: every joint classified Face|Torso|Limbs|Gens from its OWN bind anatomy (permil of the vertex z-span + laterality -- the same normalization basis nx_nxa_dyna uses, joint ladder is shorter than the mesh so the VERTEX span is the ruler). (3) ALBEDO BAKE: fills the TEXC atlas (grid g read FROM the TEXC section -- the wire format is the SSOT, two copies of one capacity are two capacities) with per-region skin albedo + a WHISPER of fine grain. Real skin is EVEN -- the coarse-blotch regression is banked (HONEST_vs_REAL_PEOPLE); grain is +-3. (4) SAMPLER VIEW: binds the baked atlas to the trimesh renderer's EXISTING per-fragment image-texture path (tm_set_image + tm_vuv + smooth=2 -- it was already there; this wires TEXC into it) and renders a lit, z-buffered, textured turntable of the asset. check-before-build: NO new rasterizer. Output atlas format == TM_IMG contract: res*res*3 u8 RGB row-major. FAIL-CLOSED: no TEXC -> refuse (run nx_nxa_texc first); counts mismatch -> refuse. Deterministic by seed. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_nxa.nx nx_nxa_texc_lib.nx nx_trimesh.nx nx_png.nx nx_skin_ita.nx nx_relief_lib.nx nx_nxa_texbake_decode_t279.nx

imports: nx_syscalls.nxnx_nxa.nxnx_nxa_texc_lib.nxnx_trimesh.nxnx_png.nxnx_skin_ita.nxnx_relief_lib.nx

imported by: nobody (leaf or entry point)

structs

none

consts

21const NTB_MAGIC_4096: i64 = 4096
22const NTB_MAGIC_4095: i64 = 4095
23const NTB_MAGIC_65536: i64 = 65536
24const NTB_MAGIC_1400: i64 = 1400
25const NTB_MAGIC_3200: i64 = 3200
26const NTB_MAGIC_5600: i64 = 5600
27const NTB_MAGIC_2600: i64 = 2600
30const NTB_FACE: i64 = 0
31const NTB_TORSO: i64 = 1
32const NTB_LIMBS: i64 = 2
33const NTB_GENS: i64 = 3
35const NTB_FACE_PERMIL: i64 = 860
36const NTB_GENS_LO: i64 = 540
37const NTB_GENS_HI: i64 = 620
38const NTB_LAT_DIV: i64 = 12
39const NTB_MID_DIV: i64 = 40
40const NTB_LEG_PERMIL: i64 = 500
46const NTB_DEFAULT_HUE: i64 = 500 // the genome midpoint, used only when a caller supplies no genome
48const NTB_VOID_R: i64 = 118
49const NTB_VOID_G: i64 = 118
50const NTB_VOID_B: i64 = 124
52const NTB_HASH_A: i64 = 374761393
53const NTB_HASH_B: i64 = 668265263
54const NTB_HASH_C: i64 = 1274126177
56const NTB_W: i64 = 300
57const NTB_H: i64 = 460
58const NTB_BG: i64 = 24 + 26*256 + 34*65536
59const NTB_FLESH: i64 = 222 + 184*256 + 158*65536
60const NTB_MODEL_H: i64 = 1900
62const NTB_E_BAD: i64 = 3
63const NTB_E_NOSEC: i64 = 4
64const NTB_E_MISMATCH: i64 = 5
224const NTB_MAP_ALBEDO: i64 = 0
225const NTB_MAP_SPEC: i64 = 1
226const NTB_MAP_GLOSS: i64 = 2
227const NTB_MAP_NORMAL: i64 = 3
228const NTB_NMAP: i64 = 4
232const NTB_IOR_SKIN: i64 = 1400 // x1000
233const NTB_ONE: i64 = 1000
236const NTB_ROUGH_BASE: i64 = 500
237const NTB_ROUGH_FACE: i64 = 0 - 80
238const NTB_ROUGH_TORSO: i64 = 0
239const NTB_ROUGH_LIMBS: i64 = 60
240const NTB_ROUGH_GENS: i64 = 20
251const NTB_N_MID: i64 = 128
252const NTB_N_SCALE: i64 = 127
253const NTB_GREY_MAX: i64 = 255
259const NTB_NORMAL_ENCODING_NATIVE_MID_SCALE: i64 = 1
260const NTB_NORMAL_ENCODING_GLTF_UNORM: i64 = 2

functions

67func ntb_idx3(a: i64, b: i64, c: i64, nv: i64) -> i64
called by 1: ntb_view
84func ntb_axspan(w: *i64, vwo: i64, nv: i64, ax: i64) -> i64
called by 1: ntb_up_axis
96func ntb_up_axis(w: *i64, vwo: i64, nv: i64) -> i64
called by 2: ntb_regionsntb_view calls 1: ntb_axspan
103func ntb_region(permil: i64, absx: i64, spanz: i64) -> i64
called by 1: ntb_regions
113func ntb_regions(b: *u8, flen: i64, regout: *i64, permout: *i64) -> i64
151func ntb_albedo_genome(hue: i64, reg: i64, out3: *i64) -> i64
157func ntb_bake_gene(b: *u8, flen: i64, res: i64, seed: i64, hue: i64, out: *u8) -> i64
261func ntb_normal_decode_rgb8(encoding:i64,r:i64,g:i64,b:i64,out3:*i64)->i64
274func ntb_f0_skin() -> i64
called by 1: ntb_bake_pbr
280func ntb_rough_of_region(reg: i64) -> i64
called by 1: ntb_bake_pbr
289func ntb_texel_um(res: i64) -> i64 { return rlf_texel_um(res) }
calls 1: rlf_texel_um
290func ntb_relief_h(x: i64, y: i64, res: i64, seed: i64) -> i64 { return rlf_relief_h(x, y, res, seed) }
299func ntb_encode_normal_um(dzx_um: i64, dzy_um: i64, run_um: i64, out3: *i64) -> i64
called by 1: ntb_encode_normal calls 1: tm_isqrt
310func ntb_encode_normal(dhx: i64, dhy: i64, res: i64, out3: *i64) -> i64
314func ntb_normal_at(x: i64, y: i64, res: i64, seed: i64, out3: *i64) -> i64
322func ntb_fill_row(hb: *i64, base: i64, y: i64, res: i64, seed: i64) -> i64
called by 1: ntb_bake_pbr calls 1: ntb_relief_h
330func ntb_bake_pbr(b: *u8, flen: i64, res: i64, seed: i64, hue: i64, map_id: i64, out: *u8) -> i64
437func ntb_bake(b: *u8, flen: i64, res: i64, seed: i64, out: *u8) -> i64
called by 1: ntb_view calls 1: ntb_bake_gene
442func ntb_write_atlas_png(atlas: *u8, res: i64, path: *u8) -> i64
455func ntb_view(b: *u8, flen: i64, res: i64, seed: i64, outpng: *u8) -> i64