code wiki / (root) / nx_softbind.nx

nx_softbind.nx

buildroot/runtime/nx_softbind.nx

18187 B285 linesdepth 3pulls 5 transitivereach 308 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_softbind.nx -- LIB: BINDS nx_softdyn to character geometry (roadmap rung A4, 2026-08-01). The solver was proven 7/7 in isolation but bound to NOTHING -- no body part consumed it, so nothing in the game visibly jiggled. This lib is the missing joint-anchor contract: each mob owns SB_PTS spring points (hair / chest / skirt class), each seated at a fixed local offset from the mob ROOT, stepped once per sim tick from root motion ONLY (organ truth -- the same source as the mobdx/mobdz/mobdy doors), yielding signed Q8 offsets a renderer ADDS to its designated joints on top of the animated pose (spring-decomposed-skinning pattern: helper offsets over the animation, never replacing it). Pure function of the root trajectory => bit-deterministic, so replay / netsync / save-transparency hold by construction. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 85 importers

nx_syscalls.nx nx_softdyn.nx nx_softbind.nx nx_cg_restprobe.nx nx_craft_affine_emit_t342.nx nx_craft_before_placement_t316.nx nx_craft_body_affine_alpha_emit_t3 nx_craft_body_driver_t138.nx nx_craft_body_emit_t138.nx nx_craft_body_semantic_alpha_emit_ nx_craft_body_winding_alpha_emit_t nx_craft_combined_emit_t28.nx nx_craft_combined_emit_t29.nx

diagram shows first 10 each side; +0 more imports, +75 more importers in the complete lists below.

imports: nx_syscalls.nxnx_softdyn.nx

imported by: nx_cg_restprobe.nxnx_craft_affine_emit_t342.nxnx_craft_before_placement_t316.nxnx_craft_body_affine_alpha_emit_t361.nxnx_craft_body_driver_t138.nxnx_craft_body_emit_t138.nxnx_craft_body_semantic_alpha_emit_t345.nxnx_craft_body_winding_alpha_emit_t365.nxnx_craft_combined_emit_t28.nxnx_craft_combined_emit_t29.nxnx_craft_emit.nxnx_craft_eye_emit_t138.nxnx_craft_feedback_emit_t28.nxnx_craft_gait_emit_t139.nxnx_craft_garment_emit_t132.nxnx_craft_hair_attachment_emit_t263.nxnx_craft_hair_attachment_emit_t283.nxnx_craft_hair_probe_emit_t280.nxnx_craft_imported_emit_t262.nxnx_craft_inspection_alpha_emit_t342.nxnx_craft_inspection_distance_emit_t235.nxnx_craft_inspection_emit_t142.nxnx_craft_integrated_emit_t73.nxnx_craft_knight_emit_t25.nxnx_craft_length_emit_t140.nxnx_craft_material_body_emit_t61.nxnx_craft_material_emit_t55.nxnx_craft_mip_emit_t241.nxnx_craft_motion_emit_t328.nxnx_craft_move_emit_t72.nxnx_craft_person_alpha_emit_t343.nxnx_craft_pipeline_emit_t64.nxnx_craft_procedural_review_emit_candidate_t333.nxnx_craft_recovery_emit_t23.nxnx_craft_rig_comparison_emit_t332.nxnx_craft_rig_inspection_emit_t230.nxnx_craft_rig_observation_emit_t331.nxnx_craft_rigview_host_emit_t341.nxnx_craft_rigview_workbench_emit_t342.nxnx_craft_scene_light_alpha_emit_t364.nxnx_craft_search_emit_t53.nxnx_craft_skin_emit_t138.nxnx_craft_static_emit_t338.nxnx_craft_support_emit_t31.nxnx_craft_toon_region_emit_t143.nxnx_craft_visitors_canonical_emit_t142.nxnx_craft_visitors_emit_t140.nxnx_craft_visitors_inspection_emit_t142.nxnx_craft_visitors_material_emit_t181.nxnx_craft_workspace_emit_t48.nxnx_hairbake_probe.nxnx_hairdyn_lib.nxnx_movement_base_engine_t139.nxnx_mr_lagprobe.nxnx_softbind_gate.nxnx_softtissue_conserve_gate.nxnx_softtissue_mr_gate.nxnx_tissuebudget.nxnx_wasm_craft.nxnx_wasm_craft_body_t137.nxnx_wasm_craft_contact_candidate.nxnx_wasm_craft_dunes_t70.nxnx_wasm_craft_gait_candidate.nxnx_wasm_craft_gait_candidate_t139.nxnx_wasm_craft_imported_body_t41.nxnx_wasm_craft_imported_body_t42.nxnx_wasm_craft_imported_body_t49.nxnx_wasm_craft_imported_t262.nxnx_wasm_craft_inspection_bounds_t181.nxnx_wasm_craft_inspection_distance_t218.nxnx_wasm_craft_inspection_t142.nxnx_wasm_craft_journal_index_t21.nxnx_wasm_craft_journal_index_t21_before_t44.nxnx_wasm_craft_lookup_candidate.nxnx_wasm_craft_move_t72.nxnx_wasm_craft_pre_inspection_t142.nxnx_wasm_craft_recovery_t20.nxnx_wasm_craft_relief_adopt_t143.nxnx_wasm_craft_relief_save_t143.nxnx_wasm_craft_relief_t143.nxnx_wasm_craft_residency_t44.nxnx_wasm_craft_turn_candidate_t139.nxnx_wasm_craft_visitors_canonical_t142.nxnx_wasm_craft_visitors_inspection_t142.nxnx_wasm_craft_visitors_t140.nx

structs

none

consts

13const SB_MAGIC_5381: i64 = 5381
14const SB_MAGIC_1000000007: i64 = 1000000007
16const SB_PTS: i64 = 6
17const SB_HAIR: i64 = 0
18const SB_CHEST: i64 = 1
19const SB_SKIRT: i64 = 2
23const SB_BELLY: i64 = 3
24const SB_GLUTE: i64 = 4
25const SB_THIGH: i64 = 5
56const SB_HAIR_FN_MHZ: i64 = 4221 // == sb_k_sym -> SB_K_HAIR exactly (gate-pinned)
57const SB_HAIR_ZETA_PERMIL: i64 = 67 // == sb_c_for_zeta -> SB_C_HAIR exactly (gate-pinned)
58const SB_K_HAIR: i64 = 200
59const SB_C_HAIR: i64 = 60
60const SB_K_SKIRT: i64 = 300
61const SB_C_SKIRT: i64 = 80
82const SB_FN_LO_MHZ: i64 = 4000 // conf tissue_fn_mhz lo
83const SB_FN_HI_MHZ: i64 = 5200 // conf tissue_fn_mhz hi
84const SB_ZETA_PERMIL: i64 = 480 // MEASURED: our XPBD plant at the linear limit
85const SB_KUP_REF: i64 = 74 // conf tissue_k_up_n_per_m midband (cai2018 k_a 73.5)
86const SB_KDN_REF: i64 = 660 // conf tissue_k_down_n_per_m midband (cai2018 k_b 658)
87const SB_ANISO_AP_PERMIL: i64 = 610 // conf tissue_aniso_ap_permil (mills2025 AP/SI)
88const SB_ANISO_ML_PERMIL: i64 = 600 // conf tissue_aniso_ml_permil (mills2025 ML/SI)
89const SB_FIRM_MAX: i64 = 3 // genome bits 16-17 span four bred firmness levels
92const SB_K4PI2_Q10: i64 = 40426
93const SB_KPI2_Q10: i64 = 10106
94const SB_MHZ_TICK_SQ: i64 = 3600000000
144const SB_MAGIC_2654435761: i64 = 2654435761
145const SB_MAGIC_1013904223: i64 = 1013904223
146const SB_MAGIC_1442695040888963407: i64 = 1442695040888963407
147const SB_MAGIC_2246822519: i64 = 2246822519
148const SB_MAGIC_288230376151711743: i64 = 288230376151711743
149const SB_FULL_N: i64 = 1001 // fullness axis 0..1000, the axis st_profile_seeded uses
150const SB_FULL_SALT: i64 = 101 // st_profile_seeded's own fullness salt -- do not diverge
166const SB_MAXD_HAIR: i64 = 6
167const SB_MAXD_CHEST: i64 = 2 // +-3.1cm: tissue-vs-bone p2p <= 6.2cm, the cited band
168const SB_MAXD_SKIRT: i64 = 5
170const SB_OFFY_HAIR: i64 = 17
171const SB_OFFY_CHEST: i64 = 12
172const SB_OFFY_SKIRT: i64 = 7

functions

98func sb_fn_mhz(firm: i64) -> i64
102func sb_k_sym(fn_mhz: i64) -> i64 { return SB_K4PI2_Q10*fn_mhz*fn_mhz/SB_MHZ_TICK_SQ }
106func sb_branch_permil() -> i64
called by 1: sb_k_up calls 1: sd_isqrt
111func sb_k_up(fn_mhz: i64) -> i64
118func sb_k_dn(fn_mhz: i64) -> i64 { return sb_k_up(fn_mhz)*SB_KDN_REF/SB_KUP_REF }
122func sb_k_lat(fn_mhz: i64) -> i64 { return sb_k_sym(fn_mhz)*1000/SB_ANISO_ML_PERMIL }
called by 1: sb_tick_fn calls 1: sb_k_sym
123func sb_k_ant(fn_mhz: i64) -> i64 { return sb_k_sym(fn_mhz)*1000/SB_ANISO_AP_PERMIL }
called by 1: sb_tick_fn calls 1: sb_k_sym
130func sb_c_for_zeta(K: i64, zeta_permil: i64) -> i64 { return zeta_permil*2*sd_isqrt(SD_G*K)/1000 }
called by 3: mainhd_csb_c_for calls 1: sd_isqrt
131func sb_c_for(K: i64) -> i64 { return sb_c_for_zeta(K, SB_ZETA_PERMIL) }
152func sb_hash(seed: i64, salt: i64) -> i64
called by 1: sb_full_from_gene
161func sb_full_from_gene(gene: i64) -> i64 { return sb_hash(gene, SB_FULL_SALT) % SB_FULL_N }
called by 1: sb_fn_mhz_gene calls 1: sb_hash
162func sb_fn_mhz_gene(gene: i64) -> i64
called by 1: sb_tick_mob_gene calls 1: sb_full_from_gene
176func sb_k(kind: i64) -> i64 { if kind == SB_HAIR { return SB_K_HAIR } if kind == SB_CHEST { return sb_k_up(sb_fn_mhz(0)) } return SB_K_SKIRT }
177func sb_c(kind: i64) -> i64 { if kind == SB_HAIR { return SB_C_HAIR } if kind == SB_CHEST { return sb_c_for(sb_k_up(sb_fn_mhz(0))) } return SB_C_SKIRT }
178func sb_maxd(kind: i64) -> i64 { if kind == SB_HAIR { return SB_MAXD_HAIR } if kind == SB_CHEST { return SB_MAXD_CHEST } return SB_MAXD_SKIRT }
181func sb_offy(kind: i64) -> i64 { if kind == SB_HAIR { return SB_OFFY_HAIR } if kind == SB_CHEST { return SB_OFFY_CHEST } return SB_OFFY_SKIRT }
184func sb_alloc(nmobs: i64) -> *i64 { return sd_alloc(nmobs*SB_PTS) }
187func sb_seat_mob(st: *i64, mobi: i64, rx: i64, ry: i64, rz: i64) -> i64
196func sb_tick_mob(st: *i64, mobi: i64, rx: i64, ry: i64, rz: i64) -> i64
called by 1: main calls 1: sb_tick_mob_firm
200func sb_tick_pt(st: *i64, mobi: i64, kind: i64, rx: i64, ry: i64, rz: i64, K: i64, C: i64, maxd: i64) -> i64
205func sb_tick_mob_firm(st: *i64, mobi: i64, rx: i64, ry: i64, rz: i64, firm: i64) -> i64
called by 1: sb_tick_mob calls 2: sb_tick_fnsb_fn_mhz
212func sb_tick_mob_gene(st: *i64, mobi: i64, rx: i64, ry: i64, rz: i64, gene: i64) -> i64
217func sb_tick_fn(st: *i64, mobi: i64, rx: i64, ry: i64, rz: i64, fn_mhz: i64) -> i64
238func dyna_bind_skin(st: *i64, mobi: i64, rx: i64, ry: i64, rz: i64) -> i64
248func sb_impulse_mob(st: *i64, mobi: i64, ix: i64, iy: i64, iz: i64) -> i64
257func sb_off_x_q8(st: *i64, mobi: i64, kind: i64, rx: i64) -> i64
called by 1: main
260func sb_off_y_q8(st: *i64, mobi: i64, kind: i64, ry: i64) -> i64
called by 2: mainmain calls 1: sb_offy
263func sb_off_z_q8(st: *i64, mobi: i64, kind: i64, rz: i64) -> i64
267func sb_disp_q8(st: *i64, mobi: i64, kind: i64, rx: i64, ry: i64, rz: i64) -> i64
called by 1: main calls 2: sd_disp_q8sb_offy
271func sb_energy(st: *i64, mobi: i64, kind: i64) -> i64 { return sd_energy(st, mobi*SB_PTS + kind) }
called by 2: mainmain calls 1: sd_energy
274func sb_ck(st: *i64, nmobs: i64) -> i64
called by 1: main