code wiki / _hdl_build / nx_skullgen.nx

nx_skullgen.nx

buildroot/runtime/_hdl_build/nx_skullgen.nx

33918 B541 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_skullgen.nx -- F1108/seq900 KEYSTONE: THE SKULL, GENERATED. Inside-out, from the first byte up. OPERATOR, and he was right: "you arent building from the inside out aka a skull to give it structure ... take the skull and bones those should have all been generatable by now then you just layer on top." Every facial feature this program fought with is a property of BONE -- the brow ridge is the supraorbital margin of the frontal bone, the chin is the mental protuberance of the mandible, the cheekbones are the zygomatic arches, the eye sockets are the orbits. We had been sticking those onto a smooth SKIN ovoid, which is why three tuned chin attempts all rendered as lobes stacked under a mouth: pieces stuck on a blob look like pieces stuck on a blob. The structure has to exist first and the surface layers onto it. This organ does NOT store a skull -- it stores the RULES that make one, and emits them as a canon of P/R/F rows that the proven emitter turns into geometry. So the skull inherits spline lofting, true central-difference normals, capped tubes, per-part placement and rotation about Z for free, and it is data generated by anatomy rather than a modelled asset. The oracle it is scored against is the BodyParts3D skull (171,248 real scanned triangles, CC BY-SA 2.1 Japan) -- a RULER, never the product. nx_skullgen <out.dat> [sex 0-1000] [seed] [robust 0-1000] nx_skullgen selftest license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_gate_verdict.nx nx_itoa_lib.nx nx_skullgen.nx

imports: nx_gate_verdict.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sk_streq sk_gate gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ sk_write sk_emit skP sk_wint skR sk_wint ↻ sk_pm sk_step skF sk_wint ↻ skO sk_wint ↻ gv_check gv_puts ↻ sk_count skP ↻ skR ↻ sk_ycheck

structs

none

consts

23const SK_BUF: i64 = 65536
24const SK_MODE: i64 = 420
25const SK_MINP: i64 = 7
26const SK_MINR: i64 = 30
41const SK_BROW_BASE: i64 = 12 // supraorbital margin: heavy male, light female
42const SK_BROW_SEXF: i64 = 5
43const SK_BROW_ROBUST: i64 = 6
44const SK_JAW_BASE: i64 = 46 // mandible breadth: square male, tapered female
45const SK_JAW_SEXF: i64 = 6
46const SK_JAW_ROBUST: i64 = 5
47const SK_VAULT_BASE: i64 = 52 // cranial vault half-breadth
48const SK_VAULT_SEXF: i64 = 2
49const SK_ZYG_BASE: i64 = 50 // zygomatic (cheekbone) projection
50const SK_ZYG_SEXF: i64 = 3
51const SK_ZYG_ROBUST: i64 = 4
52const SK_ASCII_SP: i64 = 32
53const SK_ASCII_NL: i64 = 10
54const SK_TAG_P: i64 = 80
55const SK_TAG_R: i64 = 82
56const SK_TAG_F: i64 = 70
63const SK_PERCENT: i64 = 100
64const SK_PERMILLE: i64 = 1000
68const SK_SEED_GOLDEN32: i64 = 2654435761 // 0x9E3779B1 = floor(2^32 / phi), Knuth's multiplicative-hash constant
69const SK_SEED_ODD_ADD: i64 = 12345 // odd addend so seed 0 cannot produce the degenerate state 0
72const SK_EXTENT_SENTINEL: i64 = 999999
74const SK_FIXTURE_BUF: i64 = 4096
79const SK_T6_SEED: i64 = 12345
345const SK_VAULT_FLOOR: i64 = 40 // braincase confined to the upper 60 percent of skull height (seq908)

functions

86func sk_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main
91func sk_pn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
92func sk_step(st: *i64) -> i64
called by 1: sk_pm
99func sk_pm(st: *i64, amp: i64) -> i64 { if amp <= 0 { return 0 } let r: i64 = sk_step(st) % (2*amp+1); return r - amp }
called by 1: sk_emit calls 1: sk_step
100func sk_streq(a: *u8, b: *u8) -> i64
called by 1: main
105func sk_atoi(s: *u8) -> i64
called by 1: main
111func sk_wint(b: *u8, pos: *i64, v: i64, c: i64) -> i64
called by 4: skRskPskFskO
123func skR(b: *u8, pos: *i64, y: i64, xoff: i64, zoff: i64, ra: i64, rb: i64) -> i64
called by 2: sk_emitsk_gate calls 1: sk_wint
132func skP(b: *u8, pos: *i64, mir: i64, rot: i64, ox: i64, oy: i64, oz: i64, mat: i64, rotz: i64) -> i64
called by 2: sk_emitsk_gate calls 1: sk_wint
139func skF(b: *u8, pos: *i64, part: i64, y: i64, yw: i64, th: i64, tw: i64, amp: i64) -> i64
called by 1: sk_emit calls 1: sk_wint
147func skO(b: *u8, pos: *i64, part: i64, y: i64, yw: i64, th: i64, tw: i64) -> i64
called by 1: sk_emit calls 1: sk_wint
156func sk_emit(b: *u8, pos: *i64, st: *i64, sexf: i64, robust: i64, noise: i64) -> i64
called by 1: sk_write calls 5: skPskRsk_pmskFskO
292func sk_write(path: *u8, sexf: i64, seed: i64, robust: i64, noise: i64) -> i64
called by 2: sk_gatemain calls 1: sk_emit
306func sk_count(path: *u8, ch: i64) -> i64
called by 2: sk_gatemain
346func sk_tokn(d: *u8, n: i64, p: *i64, out: *i64) -> i64
called by 1: sk_ycheck
372func sk_ycheck(path: *u8, out: *i64) -> i64
called by 1: sk_gate calls 1: sk_tokn
434func sk_gate() -> i64
507func main(argc: i64, argv: *i64) -> i64