code wiki / _hdl_build / nx_companion_wardrobe.nx
nx_companion_wardrobe.nx source
↩ module page · 93 lines · 6012 B
1// nx_companion_wardrobe.nx -- the CompanionWardrobe object: the occlusion-aware photo-prompt compiler (the Z-Image
2// "painter not compositor" fix). Resolves a scene into per-zone clothing-OR-bare with a POSITIVE occlusion assertion
3// (fabric obscures when clothed; bare only when the scene asks) so clothed shots stay clothed + nude only on request
4// = the controllable wardrobe layer. Composes the anatomy-neutral identity from CompanionIdentity. Extracted from
5// nx_gen_orchestrator (monolith -> objects); behaviour-preserving (body byte-identical except private cw_* helpers).
6// ⚠this is where ER-8 negatives + ControlNet pose/structure control will compose. Object model: companion_arch.md.
7// license_tier: ORIGINAL
8import "nx_syscalls.nx"
9import "nx_companion_identity.nx"
10
11func cw_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i]; o=o+1; i=i+1} return o }
12func cw_catb(dst: *u8, off: i64, src: *u8, n: i64) -> i64 { var o: i64=off; var i: i64=0; while i<n {dst[o]=src[i]; o=o+1; i=i+1} return o }
13func cw_contains_ci(hay: *u8, hlen: i64, needle: *u8) -> i64 {
14 var nl: i64 = 0; while needle[nl]!=(0 as u8) { nl=nl+1 }
15 if nl==0 { return 0 }
16 var i: i64 = 0
17 while i + nl <= hlen {
18 var j: i64 = 0; var ok: i64 = 1
19 while j < nl {
20 var a: i64 = hay[i+j]&0xff; var b2: i64 = needle[j]&0xff
21 if a>=65 { if a<=90 { a=a+32 } }
22 if b2>=65 { if b2<=90 { b2=b2+32 } }
23 if a!=b2 { ok=0; j=nl } else { j=j+1 }
24 }
25 if ok==1 { return 1 }
26 i=i+1
27 }
28 return 0
29}
30
31func go_build_photo_prompt(scene: *u8, slen: i64, expr: *u8, out: *u8) -> i64 {
32 let ident: *u8 = sys_mmap(2048); go_load_appearance(ident, 2048)
33 var o: i64 = cw_cat(out, 0, ident)
34 // --- exposure state from the scene (nudity intent) ---
35 var tex: i64 = 0; var hex: i64 = 0
36 if cw_contains_ci(scene, slen, "naked" as *u8)==1 { tex=1; hex=1 }
37 if cw_contains_ci(scene, slen, "nude" as *u8)==1 { tex=1; hex=1 }
38 if cw_contains_ci(scene, slen, "shower" as *u8)==1 { tex=1; hex=1 }
39 if cw_contains_ci(scene, slen, "in the bath" as *u8)==1 { tex=1; hex=1 }
40 if cw_contains_ci(scene, slen, "topless" as *u8)==1 { tex=1 }
41 if cw_contains_ci(scene, slen, "tits" as *u8)==1 { tex=1 }
42 if cw_contains_ci(scene, slen, "boobs out" as *u8)==1 { tex=1 }
43 if cw_contains_ci(scene, slen, "bare breast" as *u8)==1 { tex=1 }
44 if cw_contains_ci(scene, slen, "flash" as *u8)==1 { tex=1 }
45 if cw_contains_ci(scene, slen, "bottomless" as *u8)==1 { hex=1 }
46 if cw_contains_ci(scene, slen, "pussy" as *u8)==1 { hex=1 }
47 if cw_contains_ci(scene, slen, "no panties" as *u8)==1 { hex=1 }
48 // --- did the user name a garment? ---
49 var cloth: i64 = 0
50 if cw_contains_ci(scene, slen, "bikini" as *u8)==1 { cloth=1 }
51 if cw_contains_ci(scene, slen, "swimsuit" as *u8)==1 { cloth=1 }
52 if cw_contains_ci(scene, slen, "dress" as *u8)==1 { cloth=1 }
53 if cw_contains_ci(scene, slen, "lingerie" as *u8)==1 { cloth=1 }
54 if cw_contains_ci(scene, slen, "shirt" as *u8)==1 { cloth=1 }
55 if cw_contains_ci(scene, slen, "blouse" as *u8)==1 { cloth=1 }
56 if cw_contains_ci(scene, slen, "top" as *u8)==1 { cloth=1 }
57 if cw_contains_ci(scene, slen, "bra" as *u8)==1 { cloth=1 }
58 if cw_contains_ci(scene, slen, "sweater" as *u8)==1 { cloth=1 }
59 if cw_contains_ci(scene, slen, "hoodie" as *u8)==1 { cloth=1 }
60 if cw_contains_ci(scene, slen, "tank" as *u8)==1 { cloth=1 }
61 if cw_contains_ci(scene, slen, "shorts" as *u8)==1 { cloth=1 }
62 if cw_contains_ci(scene, slen, "skirt" as *u8)==1 { cloth=1 }
63 if cw_contains_ci(scene, slen, "jeans" as *u8)==1 { cloth=1 }
64 if cw_contains_ci(scene, slen, "pants" as *u8)==1 { cloth=1 }
65 if cw_contains_ci(scene, slen, "leggings" as *u8)==1 { cloth=1 }
66 if cw_contains_ci(scene, slen, "nightgown" as *u8)==1 { cloth=1 }
67 if cw_contains_ci(scene, slen, "robe" as *u8)==1 { cloth=1 }
68 if cw_contains_ci(scene, slen, "uniform" as *u8)==1 { cloth=1 }
69 if cw_contains_ci(scene, slen, "outfit" as *u8)==1 { cloth=1 }
70 if cw_contains_ci(scene, slen, "wearing" as *u8)==1 { cloth=1 }
71 if cw_contains_ci(scene, slen, "sundress" as *u8)==1 { cloth=1 }
72 // --- emit the scene (setting + whatever garment the user named) ---
73 o = cw_cat(out, o, ", " as *u8)
74 o = cw_catb(out, o, scene, slen)
75 // --- default outfit when nothing named + not exposed (setting-aware; never leave a zone undefined) ---
76 if tex==0 { if cloth==0 {
77 if cw_contains_ci(scene, slen, "beach" as *u8)==1 { o = cw_cat(out, o, ", wearing a cute string bikini" as *u8) }
78 else { if cw_contains_ci(scene, slen, "pool" as *u8)==1 { o = cw_cat(out, o, ", wearing a cute bikini" as *u8) }
79 else { if cw_contains_ci(scene, slen, "gym" as *u8)==1 { o = cw_cat(out, o, ", wearing a fitted sports bra and leggings" as *u8) }
80 else { if cw_contains_ci(scene, slen, "bed" as *u8)==1 { o = cw_cat(out, o, ", wearing a soft silky camisole and shorts" as *u8) }
81 else { o = cw_cat(out, o, ", wearing a cute fitted summer sundress" as *u8) } } } }
82 } }
83 // --- TORSO occlusion resolution (positive assertion; the load-bearing fix) ---
84 if tex==1 { o = cw_cat(out, o, ". Her breasts are completely bare and fully exposed, pale ghost areolas with small pert pale pink nipples, her nipples are clearly visible" as *u8) }
85 else { o = cw_cat(out, o, ". The opaque fabric completely covers and obscures her breasts, a solid smooth surface with zero nipple visibility through the material" as *u8) }
86 // --- HIPS (only when exposed; otherwise the outfit/default covers it) ---
87 if hex==1 { o = cw_cat(out, o, ". She is nude below the waist, bare and exposed" as *u8) }
88 // --- expression (from her mood) + quality ---
89 o = cw_cat(out, o, expr)
90 o = cw_cat(out, o, ", photorealistic, natural lighting, sharp focus, high detail, 8k" as *u8)
91 out[o]=0 as u8
92 return o
93}