code wiki / (root) / nx_garment_boundary_candidate_t128.nx

nx_garment_boundary_candidate_t128.nx

buildroot/runtime/nx_garment_boundary_candidate_t128.nx

71681 B1555 linesdepth 2pulls 3 transitivereach 3 importersview sourcekind librarytopic garment
docsdependenciesstructsconstsfunctions

about

nx_garment_gen_lib.nx -- CONFORMING GARMENT MESHES GENERATED FROM THE BODY SURFACE (2026-08-30, gameengine gpe_garment_draw paint->mesh; operator: "the clothes are paint not objects"). WHAT IT BUILDS. For every garment id of the engine's table (1 bikini top . 2 bikini bottom . 3 one-piece . 4 sarong knot . 5 sundress bodice . 6 tee . 7 shorts . 8 skirt waistband . 9 evening bodice) a SHELL: the body triangles the garment covers, offset along the body's own smooth vertex normals by fabric thickness + wearing ease, its open boundary CLOSED by a hem strip (the fabric's edge face, so the cloth has a visible thickness), a raised binding band one ring inside every opening (the elastic / folded hem), a PUSH-OUT pass that walks any vertex the offset dropped into a fold back out until no body vertex sits inside the fabric, and RIBBON STRAPS between anatomical anchors for the strapped ids. Every garment vertex records the BODY VERTEX it was grown from, so the page skins it with that vertex's own joint weights and it rides pose, gait and the soft-tissue fields exactly as the skin under it does (layering by construction: a layer that rides its underlayer's field cannot be pierced by it). UNITS. Mesh units: 171530 per 1.78 m (the page's own pairing) => 96.37 units per mm. Heights are in DECIMIL of the mesh's own measured stature ((z - zmin) * 10000 / H). Normals and blend weights are Q12. Thickness and ease are DERIVED from micrometres in gmg_mat, with the source of each number beside it. SECTION EMITTED: "GARM" (one tag, one checksum) = header [ver=20260830, nkinds, vstride=5, tstride=3, units_per_mm_x1000, dirstride=8, total_words, 0] dir nkinds x [id, nverts, ntris, voff(words from section start), toff, thickness_units, ease_units, class] verts [x, y, z, src_body_vertex, flag] flag 0 shell . 1 hem . 2 strap tris [a, b, c] local to the kind Normals are NOT shipped: the page already accumulates area-weighted smooth normals for the skirt mesh and does the same here (hem strips and straps carry their own copies of the shared vertices, so their faces get their own normals). license_tier: ORIGINAL. No hw writes (Rule 26).

dependencies 2 imports · 3 importers

nx_syscalls.nx nx_nxa.nx nx_garment_boundary_candidate_ nx_garment_attachment_gate_t131.nx nx_garment_boundary_gate_t128.nx nx_garment_polygon_gate_t129.nx

imports: nx_syscalls.nxnx_nxa.nx

imported by: nx_garment_attachment_gate_t131.nxnx_garment_boundary_gate_t128.nxnx_garment_polygon_gate_t129.nx

structs

none

consts

30const GMG_Q: i64 = 4096
31const GMG_DM: i64 = 10000
32const GMG_UNITS_178: i64 = 171530
33const GMG_MM_178: i64 = 1780
34const GMG_UM_PER_MM: i64 = 1000
35const GMG_TWO_PI_MILLI: i64 = 6283
36const GMG_KINDS: i64 = 9
37const GMG_VSTRIDE: i64 = 5
38const GMG_TSTRIDE: i64 = 3
39const GMG_DIRSTRIDE: i64 = 8
40const GMG_HDR: i64 = 8
41const GMG_GARM_VER: i64 = 20260830
42const GMG_NBR_CAP: i64 = 32
43const GMG_BADJ_CAP: i64 = 4
44const GMG_OV_CAP: i64 = 16384
45const GMG_OT_CAP: i64 = 32768
46const GMG_SEC_CAP: i64 = 262144
47const GMG_STAT_N: i64 = 32
48const GMG_PUSH_PASSES: i64 = 8
49const GMG_SKEL_STRIDE: i64 = 8
50const GMG_SKIN_STRIDE: i64 = 8
51const GMG_DYN_FIELDS: i64 = 8
52const GMG_STRAP_K: i64 = 9
53const GMG_STRAP_CAP: i64 = 24
54const GMG_BIG: i64 = 4611686018427387903
55const GMG_ISQRT_HI: i64 = 3037000499
56const GMG_CROSS_SHIFT: i64 = 64
57const GMG_NRM_CAP: i64 = 1000000
60const GMG_F_SHELL: i64 = 0
61const GMG_F_HEM: i64 = 1
62const GMG_F_STRAP: i64 = 2
64const GMG_M_SWIM: i64 = 1
65const GMG_M_WOVEN: i64 = 2
66const GMG_M_JERSEY: i64 = 3
67const GMG_M_SATIN: i64 = 4
69const GMG_ERR_BADNXA: i64 = 0 - 5
70const GMG_ERR_REFUSED_THICK: i64 = 0 - 4
71const GMG_ERR_EMPTY: i64 = 0 - 6
72const GMG_ERR_CAP: i64 = 0 - 7
75const GMG_TORSO_HALFW: i64 = 15000 // the page shader's own torso gate (|bind x| < 15000)
76const GMG_ARM_BIND_X: i64 = 12000 // a dominant joint this far off the midline is an arm joint
77const GMG_HEAD_DM: i64 = 8600 // above the chin line (.885 H) a dominant joint is a head joint
78const GMG_FRONT_Y: i64 = 0 - 1200 // the page's bust-side convention: front is y < -1200
79const GMG_YBLEND: i64 = 1200 // front/back blend half-width (units) for the leg/neck lines
80const GMG_HIP_DM: i64 = 5450 // hip band top (.545 H), the incumbent paint band's own edge
81const GMG_CROTCH_DM: i64 = 4750 // crotch .475 H (Drillis-Contini 1966)
82const GMG_KNEE_DM: i64 = 2850 // knee .285 H (Drillis-Contini 1966, the page's own gdJn(.285))
83const GMG_HIPJ_DM: i64 = 5200 // hip joint .52 H (Drillis-Contini) -- the anchor the page maps NIP through
84const GMG_EYE_DM: i64 = 9300 // eye line .93 H, the second anchor
85const GMG_NIP_RATIO_DM: i64 = 7200 // published nipple ratio .72 H before the per-mesh anchor mapping
86const GMG_HEADJ_PROBE_DM: i64 = 9500
87const GMG_BUST_HALF_DM: i64 = 550 // the nipple detail's own half-width (.055 H)
88const GMG_EASE_FADE_LO: i64 = 7400 // ease fades to zero over the bust->shoulder band so necklines hug
89const GMG_EASE_FADE_HI: i64 = 8000
90const GMG_MIDTHIGH_DM: i64 = 4025 // (hip .52 + knee .285) / 2 -- Drillis-Contini mid-thigh, the shorts hem
91const GMG_SHORTS_TOP_DM: i64 = 5600
92const GMG_TEE_NECK_DM: i64 = 8350 // crew neck front: .835 H (acromion .818 + a finger)
93const GMG_TEE_NECK_RISE: i64 = 300
94const GMG_SLEEVE_TOP_DM: i64 = 7400
95const GMG_SLEEVE_HALFW: i64 = 19000 // short-sleeve cap reach off the midline (units)
96const GMG_SLEEVE_BAND_LO: i64 = 7800
97const GMG_SLEEVE_BAND_HI: i64 = 8700
98const GMG_SLEEVE_X_LO: i64 = 12000
99const GMG_ONEPIECE_NECK_F: i64 = 7700 // one-piece scoop front .77 H
100const GMG_ONEPIECE_NECK_B: i64 = 7000 // one-piece back .70 H
101const GMG_STRAP_SHOULDER_DM: i64 = 8580
102const GMG_STRAP_BAND_TOL_DM: i64 = 120 // bikini back band half-height
103const GMG_SARONG_X: i64 = 13500 // the knot sits on the hip side
104const GMG_SARONG_DM: i64 = 6150
105const GMG_SARONG_R: i64 = 5000
106const GMG_WAIST_BAND_DM: i64 = 150 // skirt waistband half-height around the skirt's own top ring
107const GMG_SKIRT_TOP_TOL_DM: i64 = 300
108const GMG_STRAP_SEARCH_DM: i64 = 700
109const GMG_STRAP_AX_MAX: i64 = 14500
110const GMG_STRAP_AX_FRONT: i64 = 9000
111const GMG_STRAP_Y_FRONT: i64 = 0 - 9000
112const GMG_STRAP_AX_SHOULDER: i64 = 11400
113const GMG_STRAP_Y_SHOULDER: i64 = 2000
114const GMG_STRAP_AX_BACK: i64 = 8000
115const GMG_STRAP_Y_BACK: i64 = 9000
116const GMG_STRAP_HALFW_BIKINI_UM: i64 = 6000 // 12 mm bikini strap
117const GMG_STRAP_HALFW_DRESS_UM: i64 = 10000 // 20 mm dress / one-piece strap
118const GMG_SWIM_INNER_UM: i64 = 200 // a swim hem's inner edge is pressed to the skin (0.2 mm)
119const GMG_PUSH_MARGIN: i64 = 2
120const GMG_CLEAR_PERMIL: i64 = 900 // the clearance tooth's bar: 0.9 t (vertex-to-vertex is an
122const GMG_CLEAR_REPORT_MULT: i64 = 4
132const GMG_T_SWIM_UM: i64 = 550
133const GMG_T_JERSEY_UM: i64 = 700
134const GMG_T_WOVEN_UM: i64 = 350
135const GMG_T_SARONG_UM: i64 = 300
136const GMG_T_SATIN_UM: i64 = 250
137const GMG_ELASTIC_UM: i64 = 1000
138const GMG_EASE_TEE_UM: i64 = 75000
139const GMG_EASE_SHORTS_UM: i64 = 76200
140const GMG_EASE_DRESS_UM: i64 = 75000
141const GMG_EASE_EVENING_UM: i64 = 63500
142const GMG_EASE_KNOT_RADIAL_UM: i64 = 30000
145const GMG_C_B: i64 = 0
146const GMG_C_FLEN: i64 = 1
147const GMG_C_POS: i64 = 2
148const GMG_C_NV: i64 = 3
149const GMG_C_IDX: i64 = 4
150const GMG_C_NT: i64 = 5
151const GMG_C_NRM: i64 = 6
152const GMG_C_ZMN: i64 = 7
153const GMG_C_H: i64 = 8
154const GMG_C_HH: i64 = 9
155const GMG_C_AX: i64 = 10
156const GMG_C_VF: i64 = 11
157const GMG_C_NIP: i64 = 12
158const GMG_C_DYN: i64 = 13
159const GMG_C_ND: i64 = 14
160const GMG_C_GTH: i64 = 15
161const GMG_C_GAP: i64 = 16
162const GMG_C_YMID: i64 = 17
163const GMG_C_BIND: i64 = 18
164const GMG_C_NJ: i64 = 19
165const GMG_C_VMAP: i64 = 20
166const GMG_C_INNER: i64 = 21
167const GMG_C_SEL: i64 = 22
168const GMG_C_NBR: i64 = 23
169const GMG_C_NBC: i64 = 24
170const GMG_C_DEG: i64 = 25
171const GMG_C_OV: i64 = 26
172const GMG_C_ONV: i64 = 27
173const GMG_C_OT: i64 = 28
174const GMG_C_ONT: i64 = 29
175const GMG_C_CAND: i64 = 30
176const GMG_C_NCAND: i64 = 31
177const GMG_C_TRIS: i64 = 32
178const GMG_C_NTRIS: i64 = 33
179const GMG_C_THICK_PERMIL: i64 = 34
180const GMG_C_UPMK: i64 = 35
181const GMG_C_BSET: i64 = 36
182const GMG_C_RING: i64 = 37
183const GMG_C_BADJ: i64 = 38
184const GMG_C_BDEG: i64 = 39
185const GMG_C_STACK: i64 = 40
186const GMG_C_SEEN: i64 = 41
187const GMG_C_NOPUSH: i64 = 42
188const GMG_C_NBROVER: i64 = 43
189const GMG_C_AJ: i64 = 44
190const GMG_C_AW: i64 = 45
191const GMG_C_DST: i64 = 46 // the asset's own DYNA row stride (ref9d ships 12 words, not the 8 the
193const GMG_C_DIL: i64 = 47 // per-vertex pinch-dilation flags (see gmg_build steps 1-3)
194const GMG_C_SLOTS: i64 = 48
195const GMG_PINCH_PASSES: i64 = 4
197const GMG_VF_TOR: i64 = 1
198const GMG_VF_ARM: i64 = 2
199const GMG_VF_HEAD: i64 = 4
201const GMG_S_NV: i64 = 0
202const GMG_S_NT: i64 = 1
203const GMG_S_SHELL: i64 = 2
204const GMG_S_HEM: i64 = 3
205const GMG_S_BEDGES: i64 = 4
206const GMG_S_PUSHED: i64 = 5
207const GMG_S_STRAPS: i64 = 6
208const GMG_S_MINCLEAR: i64 = 7
209const GMG_S_LOOPS: i64 = 8
210const GMG_S_OPEN: i64 = 9
211const GMG_S_SEL: i64 = 10
212const GMG_S_T: i64 = 11
213const GMG_S_TH: i64 = 12
214const GMG_S_EASE: i64 = 13
215const GMG_S_CLASS: i64 = 14
216const GMG_S_WITHIN: i64 = 15
217const GMG_S_SLF: i64 = 16
218const GMG_S_SLB: i64 = 17
219const GMG_S_SRF: i64 = 18
220const GMG_S_SRB: i64 = 19
221const GMG_S_NBROVER: i64 = 20
222const GMG_S_VOFF: i64 = 21
223const GMG_S_TOFF: i64 = 22
224const GMG_S_ID: i64 = 23
225const GMG_S_PINCHPASS: i64 = 24 // selection passes taken by the pinch dilation (1 = no pinch found)
1347const GMG_CLIP_RECORD_WORDS:i64=4
1348const GMG_CLIP_CAP_WORDS:i64=16
1349const GMG_CLIP_DISTANCE_MAX:i64=2147483647
1350const GMG_CLIP_E_INPUT:i64=0-30
1351const GMG_CLIP_E_CAP:i64=0-31
1385const GMG_CLIP_E_RANGE:i64=0-32
1386const GMG_CLIP_I64_MAX:i64=9223372036854775807
1454const GMG_ATTACH_HDR:i64=12
1455const GMG_ATTACH_REC:i64=8
1456const GMG_ATTACH_COORD_MAX:i64=16777216
1457const GMG_ATTACH_E_SOURCE:i64=-40
1458const GMG_ATTACH_E_SHAPE:i64=-41
1459const GMG_ATTACH_E_GEOMETRY:i64=-42

functions

227func gmg_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
228func gmg_pn(v: i64) -> i64
242func gmg_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
243func gmg_min(a: i64, b: i64) -> i64 { if a < b { return a } return b }
244func gmg_max(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 1: gmg_load
246func gmg_isqrt(v: i64) -> i64
265func gmg_sst(a: i64, b: i64, x: i64) -> i64
273func gmg_um2u(um: i64) -> i64 { return um * GMG_UNITS_178 / (GMG_MM_178 * GMG_UM_PER_MM) }
called by 2: gmg_matgmg_build
274func gmg_circ2radial_um(circ_um: i64) -> i64 { return circ_um * 1000 / GMG_TWO_PI_MILLI }
called by 1: gmg_mat
279func gmg_mat(G: *i64, kind: i64, out: *i64) -> i64
304func gmg_pos(G: *i64) -> *i64 { return G[GMG_C_POS] as *i64 }
305func gmg_nrm(G: *i64) -> *i64 { return G[GMG_C_NRM] as *i64 }
306func gmg_hh(G: *i64) -> *i64 { return G[GMG_C_HH] as *i64 }
307func gmg_ax(G: *i64) -> *i64 { return G[GMG_C_AX] as *i64 }
308func gmg_vf(G: *i64) -> *u8 { return G[GMG_C_VF] as *u8 }
309func gmg_has(G: *i64, v: i64, bit: i64) -> i64
316func gmg_near_joint(G: *i64, fdm: i64) -> i64
called by 1: gmg_load calls 1: gmg_abs
333func gmg_load(b: *u8, flen: i64) -> *i64
547func gmg_near_body(G: *i64, x: i64, y: i64, z: i64, hlo: i64, hhi: i64, axmax: i64) -> i64
called by 1: gmg_strap calls 4: gmg_posgmg_hhgmg_axgmg_vf
576func gmg_hleg(G: *i64, v: i64) -> i64
587func gmg_hneck(G: *i64, v: i64) -> i64
598func gmg_hneck_tee(G: *i64, v: i64) -> i64
called by 1: gmg_region calls 1: gmg_ax
605func gmg_dyn_side(G: *i64, side: i64) -> i64
called by 1: gmg_region
618func gmg_in_dyn(G: *i64, v: i64, d: i64) -> i64
called by 1: gmg_region calls 1: gmg_pos
632func gmg_region(G: *i64, kind: i64, v: i64) -> i64
682func gmg_ease_at(G: *i64, kind: i64, mat: *i64, v: i64) -> i64
called by 1: gmg_build calls 2: gmg_hhgmg_sst
692func gmg_addv(G: *i64, src: i64, d: i64, flag: i64) -> i64
called by 1: gmg_build calls 2: gmg_posgmg_nrm
707func gmg_addv_at(G: *i64, x: i64, y: i64, z: i64, src: i64, flag: i64) -> i64
called by 2: gmg_strapgmg_build
716func gmg_addt(G: *i64, a: i64, b: i64, c: i64) -> i64
called by 2: gmg_strapgmg_build
726func gmg_nbr_add(G: *i64, u0: i64, v0: i64) -> i64
called by 1: gmg_build
744func gmg_nbr_count(G: *i64, u0: i64, v0: i64) -> i64
called by 1: gmg_build
762func gmg_strap(G: *i64, mat: *i64, sx: i64, hF: i64, hB: i64, halfw: i64, ends: *i64) -> i64
849func gmg_build(G: *i64, kind: i64, stat: *i64) -> i64
1221func gmg_gen_all(G: *i64, sec: *i64, stats: *i64) -> i64
1267func gmg_print_stat(st: *i64) -> i64
calls 2: gmg_putsgmg_pn
1293func gmg_write_nxa(b: *u8, flen: i64, sec: *i64, nwords: i64, outpath: *u8) -> i64
1352func gmg_clip_distance(a:i64,b:i64,c:i64,k:i64)->i64
1355func gmg_clip_vertex(out:*i64,n:i64,k:i64)->i64
1358func gmg_clip_crossing(out:*i64,n:i64,s:i64,e:i64,ds:i64,de:i64)->i64
called by 1: gmg_clip_triangle_bary_v1 calls 1: gmg_abs
1363func gmg_clip_triangle_bary_v1(distance:*i64,out:*i64,cap_words:i64)->i64
1387func gmg_clip_product(a:i64,b:i64)->i64
1390func gmg_clip_gcd(a:i64,b:i64)->i64 {var x:i64=a;var y:i64=b;while y>0{let z:i64=x%y;x=y;y=z};return x}
1391func gmg_clip_scalar(d:*i64,r:*i64,result:*i64)->i64
1404func gmg_clip_polygon_bary_v1(d:*i64,input:*i64,n:i64,out:*i64,scratch:*i64,cap_words:i64)->i64
1436func gmg_clip_area_ratio_v1(poly:*i64,n:i64,result:*i64)->i64
1461func gmg_attach_source_v1(b:*u8,n:i64)->i64
1469func gmg_attach_face_v1(pos:*i64,idx:*i64,face:i64)->i64
1477func gmg_attach_validate_v1(b:*u8,n:i64,s:*i64,nw:i64,work:*i64,work_words:i64)->i64
1507func gmg_attach_onepiece_into_v1(G:*i64,out:*i64,cap:i64,scratch:*i64,sw:i64)->i64
1539func gmg_attach_compose_into_v1(b:*u8,n:i64,s:*i64,nw:i64,out:*u8,cap:i64,work:*i64,ww:i64)->i64