code wiki / (root) / nx_nxa_texbake_lib.nx

nx_nxa_texbake_lib.nx

buildroot/runtime/nx_nxa_texbake_lib.nx

24890 B540 linesdepth 5pulls 14 transitivereach 30 importersview sourcekind 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 8 imports · 13 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_normal_encoding_contract.nx nx_nxa_texbake_lib.nx nx_char_asset.nx nx_char_asset_material_candidate_t nx_gltf_skin_recipe_candidate_t340 nx_normal_decode_candidate_t279.nx nx_normal_decode_gate_t279.nx nx_nxa_texbake.nx nx_nxa_texbake_gate.nx nx_nxa_texbake_region_capacity_t27 nx_nxa_texbake_region_edge_t278.nx nx_nxa_texbake_region_lib.nx

diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.

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

imported by: nx_char_asset.nxnx_char_asset_material_candidate_t340.nxnx_gltf_skin_recipe_candidate_t340.nxnx_normal_decode_candidate_t279.nxnx_normal_decode_gate_t279.nxnx_nxa_texbake.nxnx_nxa_texbake_gate.nxnx_nxa_texbake_region_capacity_t278.nxnx_nxa_texbake_region_edge_t278.nxnx_nxa_texbake_region_lib.nxnx_nxa_texm.nxnx_sdfrender_sss_gate.nxnx_skin_pbr_gate.nx

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

functions

67func ntb_idx3(a: i64, b: i64, c: i64, nv: i64) -> i64
84func ntb_axspan(w: *i64, vwo: i64, nv: i64, ax: i64) -> i64
96func ntb_up_axis(w: *i64, vwo: i64, nv: i64) -> i64
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
252func ntb_f0_skin() -> i64
called by 2: ntb_bake_pbrmain
258func ntb_rough_of_region(reg: i64) -> i64
267func ntb_texel_um(res: i64) -> i64 { return rlf_texel_um(res) }
calls 1: rlf_texel_um
268func ntb_relief_h(x: i64, y: i64, res: i64, seed: i64) -> i64 { return rlf_relief_h(x, y, res, seed) }
277func ntb_encode_normal_um(dzx_um: i64, dzy_um: i64, run_um: i64, out3: *i64) -> i64
288func ntb_encode_normal(dhx: i64, dhy: i64, res: i64, out3: *i64) -> i64
292func ntb_normal_at(x: i64, y: i64, res: i64, seed: i64, out3: *i64) -> i64
300func 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
308func ntb_bake_pbr(b: *u8, flen: i64, res: i64, seed: i64, hue: i64, map_id: i64, out: *u8) -> i64
415func ntb_bake(b: *u8, flen: i64, res: i64, seed: i64, out: *u8) -> i64
called by 3: mainmainntb_view calls 1: ntb_bake_gene
420func ntb_write_atlas_png(atlas: *u8, res: i64, path: *u8) -> i64
called by 2: mainmain calls 2: sys_mmapwrite_png
433func ntb_view(b: *u8, flen: i64, res: i64, seed: i64, outpng: *u8) -> i64