nx_garment_twin.nx
buildroot/runtime/nx_garment_twin.nx
about
nx_garment_twin.nx -- THE GARMENT PREVIEW: a print placed on a lit, procedurally knitted cotton front (2026-08-24,
/compare/phototwin PT5: gt_print_place). license_tier: ORIGINAL No hw writes (Rule 26).
nx_garment_twin place <print.img> <out.png> [conf] -> the flat-front preview PNG + a stats line + verdict=PLACED
EXIT: 0 PLACED | 2 usage | 3 UNOBSERVABLE (undecodable print, unreadable conf, unwritable output)
WHAT IT IS, HONESTLY. A FLAT-FRONT preview: the print is multiplied onto the fabric albedo (ink is subtractive: it can
only darken cotton, never brighten it) and the whole front is shaded by a procedural jersey-knit relief (wale and
course pitch, relief depth, ambient floor -- all conf rows) under an upper-left light, so the print reads as ink on
a knitted surface rather than a flat composite. It is NOT a mesh drape: a body-on-mesh render is the next rung
(gt_drape_mesh), declared, not implied. Every number is in knowledge/garment_twin.conf, and the fabric albedo rows
are DECLARED until the bench swatch (PT7) measures the real blank -- the conf says so.
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_colorsci_lib.nxnx_img_to_rgb.nxnx_png_write.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 18 | const GT_EXIT_OK: i64 = 0 |
| 19 | const GT_EXIT_USAGE: i64 = 2 |
| 20 | const GT_EXIT_UNOBSERVABLE: i64 = 3 |
| 21 | const GT_CONF_DEFAULT: *u8 = "knowledge/garment_twin.conf" |
| 22 | const GT_CHANNELS: i64 = 3 |
| 23 | const GT_BYTE_MAX: i64 = 255 |
| 24 | const GT_PERMIL: i64 = 1000 |
| 25 | const GT_SLOT: i64 = 8 |
| 26 | const GT_LINE_CAP: i64 = 1024 |
| 27 | const GT_LUMA_R_MILLI: i64 = 2126 // Rec. 709 luma weights, milli-units (the photometric mean used for the stats line) |
| 28 | const GT_LUMA_G_MILLI: i64 = 7152 |
| 29 | const GT_LUMA_B_MILLI: i64 = 722 |
| 30 | const GT_LUMA_DEN: i64 = 10000 |
functions
| 32 | func gt_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 33 | func gt_wn(v: i64) -> i64 |
| 46 | func gt_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } called by 1: main |
| 47 | func gt_conf(path: *u8, key: *u8, missing: *i64) -> i64 |
| 52 | func gt_clamp8(v: i64) -> i64 { if v < 0 { return 0 } if v > GT_BYTE_MAX { return GT_BYTE_MAX } return v } called by 1: gt_print_place |
| 57 | func gt_shade_table(fq: *i64, wale: i64, course: i64, relief_permil: i64, ambient_permil: i64) -> *i64 |
| 86 | func gt_print_place(canvas: *u8, W: i64, H: i64, print: *u8, pw: i64, ph: i64, fab_r: i64, fab_g: i64, fab_b: i64, shade: *i64, wale: i64, course: i64, bx: i64, by: i64, bw: i64, out: *i64) -> i64 |
| 134 | func gt_usage() -> i64 { gt_w("usage: nx_garment_twin place <print.img> <out.png> [conf]\n" as *u8); return GT_EXIT_USAGE } |
| 136 | func main(argc: i64, argv: *i64) -> i64 |