code wiki / (root) / nx_creaturegen.nx

nx_creaturegen.nx

buildroot/runtime/nx_creaturegen.nx

28441 B474 linesdepth 3pulls 5 transitivereach 10 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_creaturegen.nx -- ★SOVEREIGN INFINIGEN: procedural ANIMALS. Reuses the SAME layered-anatomy method as the human head (nx_anatstack: skeleton -> muscle -> skin envelope), generalized to a seed-parametric QUADRUPED body plan -- skull+snout, neck, spine, ribcage, pelvis, tail, four (upper+lower+foot) legs, + shoulder/haunch/belly muscles. The skin EMERGES as the smooth-union envelope + dermal offset (not eyeballed). Seeded proportions (body/leg/neck length, head/tail size, build) -> different creatures (dog-ish, deer-ish, ...). Renders via the shared anatstack ray-marcher. No ML, no assets. license_tier: ORIGINAL

dependencies 1 imports · 9 importers

nx_anatstack.nx nx_creaturegen.nx nx_articulate_gate.nx nx_creaturegen_gate.nx nx_diversity_gate.nx nx_diversity_veg_gate.nx nx_gen_content.nx nx_gen_unified.nx nx_gt_annotations_gate.nx nx_livingworld_gate.nx nx_shorebird_gate.nx

imports: nx_anatstack.nx

imported by: nx_articulate_gate.nxnx_creaturegen_gate.nxnx_diversity_gate.nxnx_diversity_veg_gate.nxnx_gen_content.nxnx_gen_unified.nxnx_gt_annotations_gate.nxnx_livingworld_gate.nxnx_shorebird_gate.nx

structs

none

consts

8const K_MAGIC_6364136223846793005: i64 = 6364136223846793005
9const K_MAGIC_1442695040888963407: i64 = 1442695040888963407
10const K_MAGIC_2147483647: i64 = 2147483647
11const K_MAGIC_4096: i64 = 4096
12const K_MAGIC_65536: i64 = 65536
13const K_MAGIC_2654435761: i64 = 2654435761
14const K_MAGIC_40503: i64 = 40503
15const K_MAGIC_90001: i64 = 90001
16const K_MAGIC_1013904223: i64 = 1013904223
17const CGB_ROWS: i64 = 2
18const CGB_KIND_SONGBIRD: i64 = 1
19const CG_PLAN_GULL: i64 = 3
131const CGB_F: i64 = 24
132const CGB_KIND: i64 = 0
133const CGB_BODYL_LO: i64 = 1
134const CGB_BODYL_HI: i64 = 2
135const CGB_BODYR_LO: i64 = 3
136const CGB_BODYR_HI: i64 = 4
137const CGB_LEGL_LO: i64 = 5
138const CGB_LEGL_HI: i64 = 6
139const CGB_HEADR_LO: i64 = 7
140const CGB_HEADR_HI: i64 = 8
141const CGB_WING_LEN: i64 = 9 // permil of bodyl (half-length of the folded wing)
142const CGB_WING_THICK: i64 = 10 // permil of bodyr
143const CGB_WING_H: i64 = 11 // permil of bodyr
144const CGB_LEG_R: i64 = 12
145const CGB_BODY_RGB: i64 = 13
146const CGB_WING_RGB: i64 = 14
147const CGB_HEAD_RGB: i64 = 15
148const CGB_BEAK_RGB: i64 = 16
149const CGB_LEG_RGB: i64 = 17
150const CGB_SALT: i64 = 18
151const CGB_TIP_RGB: i64 = 19 // wingtip colour; CGB_RGB_NONE = no tip parts at all
152const CGB_FOOT_RX: i64 = 20
153const CGB_FOOT_RY: i64 = 21
154const CGB_FOOT_RZ: i64 = 22
155const CGB_TAIL_LEN: i64 = 23 // permil of bodyl
156const CGB_RGB_NONE: i64 = 0
157const CGB_KIND_GULL: i64 = 2
158const CGB_PERMIL: i64 = 1000
159const CGB_SONGBIRD_YELLOW: i64 = 4237536 // 224 + 168*256 + 64*65536, the incumbent's beak and leg yellow
160const CGB_EYE: i64 = 921620 // 20 + 16*256 + 14*65536, the incumbent's eye (gloss added at the call)
161const CGB_GULL_WHITE: i64 = 15920876 // 236 + 238*256 + 242*65536
162const CGB_GULL_GREY: i64 = 10919576 // 152 + 158*256 + 166*65536
163const CGB_GULL_BLACK: i64 = 2367518 // 30 + 32*256 + 36*65536
164const CGB_GULL_BILL: i64 = 3196136 // 232 + 196*256 + 48*65536
165const CGB_GULL_LEG: i64 = 9871574 // 214 + 160*256 + 150*65536
166const CGB_GULL_SALT: i64 = 77003
167const CGB_TIP_AT: i64 = 850 // permil of the wing half-length behind the wing centre
168const CGB_TIP_LEN: i64 = 220 // permil of the wing half-length
169const CGB_TIP_H: i64 = 450 // permil of the wing half-height
170const CGB_TIP_X: i64 = 900 // permil of bodyr (the wing itself sits at 950)
171const CGB_TIB: i64 = 550 // posed leg: tibiotarsus share of hip-to-ground, permil
172const CGB_SHIN_R: i64 = 800 // posed leg: lower capsule radius, permil of the upper
173const CGB_TOE_Z: i64 = 20 // the incumbent's foot-forward offset

functions

21func cg_next(st: *i64) -> i64 { var h: i64=st[0]; h=h*K_MAGIC_6364136223846793005+K_MAGIC_1442695040888963407; st[0]=h; return (h>>33)&K_MAGIC_2147483647 }
22func cg_range(st: *i64, lo: i64, hi: i64) -> i64 { return lo + cg_next(st) % (hi-lo+1) }
28func cg_fk_leg(hipx: i64, hipy: i64, hipz: i64, thigh: i64, shin: i64, L1: i64, L2: i64, out: *i64) -> i64
41func cg_leg_posed(P: *i64, i: i64, hipx: i64, hipy: i64, hipz: i64, thigh: i64, shin: i64, L1: i64, L2: i64, r: i64) -> i64
55func cg_leg(P: *i64, i: i64, lx: i64, lz: i64, topY: i64, footY: i64, r: i64) -> i64
called by 1: creaturegen_build calls 2: as_capsas_ellip
67func creaturegen_build_plan(P: *i64, seed: i64, plan: i64) -> i64
75func cg_build_bird(P: *i64, seed: i64) -> i64
176func cgb_set(t: *i64, r: i64, f: i64, v: i64) -> i64 { t[r*CGB_F + f] = v; return 0 }
177func cgb_get(t: *i64, r: i64, f: i64) -> i64 { return t[r*CGB_F + f] }
179func cgb_fill_songbird(t: *i64, r: i64) -> i64
called by 1: cg_bird_canon calls 1: cgb_set
197func cgb_fill_gull(t: *i64, r: i64) -> i64
called by 1: cg_bird_canon calls 1: cgb_set
214func cg_bird_canon() -> *i64
223func cg_bird_canon_rows() -> i64 { return CGB_ROWS }
called by 1: main
225func cg_bird_canon_find(t: *i64, nrows: i64, kind: i64) -> i64
called by 2: cg_bird_row_posedmain calls 1: cgb_get
232func cgb_leg_fk(P: *i64, i: i64, hipx: i64, hipy: i64, thigh: i64, shin: i64, L1: i64, L2: i64, t: *i64, r: i64) -> i64
249func cg_bird_row_posed(P: *i64, seed: i64, t: *i64, nrows: i64, kind: i64, pose: *i64) -> i64
331func cg_bird_row(P: *i64, seed: i64, t: *i64, nrows: i64, kind: i64) -> i64 { return cg_bird_row_posed(P, seed, t, nrows, kind, 0 as *i64) }
336func cg_shorebird(P: *i64, seed: i64) -> i64 { return cg_bird_row(P, seed, cg_bird_canon(), CGB_ROWS, CGB_KIND_GULL) }
337func cg_shorebird_posed(P: *i64, seed: i64, pose: *i64) -> i64 { return cg_bird_row_posed(P, seed, cg_bird_canon(), CGB_ROWS, CGB_KIND_GULL, pose) }
called by 1: main calls 2: cg_bird_row_posedcg_bird_canon
340func cg_build_fish(P: *i64, seed: i64) -> i64
374func creaturegen_build_posed(P: *i64, seed: i64, pose: *i64) -> i64
407func creaturegen_build(P: *i64, seed: i64) -> i64