nx_creaturegen.nx
buildroot/runtime/nx_creaturegen.nx
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
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
| 8 | const K_MAGIC_6364136223846793005: i64 = 6364136223846793005 |
| 9 | const K_MAGIC_1442695040888963407: i64 = 1442695040888963407 |
| 10 | const K_MAGIC_2147483647: i64 = 2147483647 |
| 11 | const K_MAGIC_4096: i64 = 4096 |
| 12 | const K_MAGIC_65536: i64 = 65536 |
| 13 | const K_MAGIC_2654435761: i64 = 2654435761 |
| 14 | const K_MAGIC_40503: i64 = 40503 |
| 15 | const K_MAGIC_90001: i64 = 90001 |
| 16 | const K_MAGIC_1013904223: i64 = 1013904223 |
| 17 | const CGB_ROWS: i64 = 2 |
| 18 | const CGB_KIND_SONGBIRD: i64 = 1 |
| 19 | const CG_PLAN_GULL: i64 = 3 |
| 131 | const CGB_F: i64 = 24 |
| 132 | const CGB_KIND: i64 = 0 |
| 133 | const CGB_BODYL_LO: i64 = 1 |
| 134 | const CGB_BODYL_HI: i64 = 2 |
| 135 | const CGB_BODYR_LO: i64 = 3 |
| 136 | const CGB_BODYR_HI: i64 = 4 |
| 137 | const CGB_LEGL_LO: i64 = 5 |
| 138 | const CGB_LEGL_HI: i64 = 6 |
| 139 | const CGB_HEADR_LO: i64 = 7 |
| 140 | const CGB_HEADR_HI: i64 = 8 |
| 141 | const CGB_WING_LEN: i64 = 9 // permil of bodyl (half-length of the folded wing) |
| 142 | const CGB_WING_THICK: i64 = 10 // permil of bodyr |
| 143 | const CGB_WING_H: i64 = 11 // permil of bodyr |
| 144 | const CGB_LEG_R: i64 = 12 |
| 145 | const CGB_BODY_RGB: i64 = 13 |
| 146 | const CGB_WING_RGB: i64 = 14 |
| 147 | const CGB_HEAD_RGB: i64 = 15 |
| 148 | const CGB_BEAK_RGB: i64 = 16 |
| 149 | const CGB_LEG_RGB: i64 = 17 |
| 150 | const CGB_SALT: i64 = 18 |
| 151 | const CGB_TIP_RGB: i64 = 19 // wingtip colour; CGB_RGB_NONE = no tip parts at all |
| 152 | const CGB_FOOT_RX: i64 = 20 |
| 153 | const CGB_FOOT_RY: i64 = 21 |
| 154 | const CGB_FOOT_RZ: i64 = 22 |
| 155 | const CGB_TAIL_LEN: i64 = 23 // permil of bodyl |
| 156 | const CGB_RGB_NONE: i64 = 0 |
| 157 | const CGB_KIND_GULL: i64 = 2 |
| 158 | const CGB_PERMIL: i64 = 1000 |
| 159 | const CGB_SONGBIRD_YELLOW: i64 = 4237536 // 224 + 168*256 + 64*65536, the incumbent's beak and leg yellow |
| 160 | const CGB_EYE: i64 = 921620 // 20 + 16*256 + 14*65536, the incumbent's eye (gloss added at the call) |
| 161 | const CGB_GULL_WHITE: i64 = 15920876 // 236 + 238*256 + 242*65536 |
| 162 | const CGB_GULL_GREY: i64 = 10919576 // 152 + 158*256 + 166*65536 |
| 163 | const CGB_GULL_BLACK: i64 = 2367518 // 30 + 32*256 + 36*65536 |
| 164 | const CGB_GULL_BILL: i64 = 3196136 // 232 + 196*256 + 48*65536 |
| 165 | const CGB_GULL_LEG: i64 = 9871574 // 214 + 160*256 + 150*65536 |
| 166 | const CGB_GULL_SALT: i64 = 77003 |
| 167 | const CGB_TIP_AT: i64 = 850 // permil of the wing half-length behind the wing centre |
| 168 | const CGB_TIP_LEN: i64 = 220 // permil of the wing half-length |
| 169 | const CGB_TIP_H: i64 = 450 // permil of the wing half-height |
| 170 | const CGB_TIP_X: i64 = 900 // permil of bodyr (the wing itself sits at 950) |
| 171 | const CGB_TIB: i64 = 550 // posed leg: tibiotarsus share of hip-to-ground, permil |
| 172 | const CGB_SHIN_R: i64 = 800 // posed leg: lower capsule radius, permil of the upper |
| 173 | const CGB_TOE_Z: i64 = 20 // the incumbent's foot-forward offset |
functions
| 21 | func 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 } |
| 22 | func cg_range(st: *i64, lo: i64, hi: i64) -> i64 { return lo + cg_next(st) % (hi-lo+1) } called by 5: cg_build_birdcg_bird_row_posedcg_build_fishcreaturegen_build_posedcreaturegen_build calls 1: cg_next |
| 28 | func cg_fk_leg(hipx: i64, hipy: i64, hipz: i64, thigh: i64, shin: i64, L1: i64, L2: i64, out: *i64) -> i64 |
| 41 | func cg_leg_posed(P: *i64, i: i64, hipx: i64, hipy: i64, hipz: i64, thigh: i64, shin: i64, L1: i64, L2: i64, r: i64) -> i64 |
| 55 | func cg_leg(P: *i64, i: i64, lx: i64, lz: i64, topY: i64, footY: i64, r: i64) -> i64 |
| 67 | func creaturegen_build_plan(P: *i64, seed: i64, plan: i64) -> i64 |
| 75 | func cg_build_bird(P: *i64, seed: i64) -> i64 |
| 176 | func cgb_set(t: *i64, r: i64, f: i64, v: i64) -> i64 { t[r*CGB_F + f] = v; return 0 } |
| 177 | func cgb_get(t: *i64, r: i64, f: i64) -> i64 { return t[r*CGB_F + f] } |
| 179 | func cgb_fill_songbird(t: *i64, r: i64) -> i64 |
| 197 | func cgb_fill_gull(t: *i64, r: i64) -> i64 |
| 214 | func cg_bird_canon() -> *i64 called by 4: creaturegen_build_plancg_shorebirdcg_shorebird_posedmain calls 2: cgb_fill_songbirdcgb_fill_gull |
| 223 | func cg_bird_canon_rows() -> i64 { return CGB_ROWS } called by 1: main |
| 225 | func cg_bird_canon_find(t: *i64, nrows: i64, kind: i64) -> i64 |
| 232 | func cgb_leg_fk(P: *i64, i: i64, hipx: i64, hipy: i64, thigh: i64, shin: i64, L1: i64, L2: i64, t: *i64, r: i64) -> i64 |
| 249 | func cg_bird_row_posed(P: *i64, seed: i64, t: *i64, nrows: i64, kind: i64, pose: *i64) -> i64 called by 2: cg_bird_rowcg_shorebird_posed calls 10: cg_bird_canon_findcgb_getcg_nextcg_rangeas_ellipas_color_last+4 |
| 331 | func 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) } |
| 336 | func cg_shorebird(P: *i64, seed: i64) -> i64 { return cg_bird_row(P, seed, cg_bird_canon(), CGB_ROWS, CGB_KIND_GULL) } |
| 337 | func 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) } |
| 340 | func cg_build_fish(P: *i64, seed: i64) -> i64 |
| 374 | func creaturegen_build_posed(P: *i64, seed: i64, pose: *i64) -> i64 |
| 407 | func creaturegen_build(P: *i64, seed: i64) -> i64 called by 3: creaturegen_build_planmainmain calls 8: cg_nextcg_rangeas_ellipas_fuzz_lastas_capscg_leg+2 |