@wildshard/sdk 0.0.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GUIDE.md +790 -0
- package/README.md +14 -4
- package/bin/wildshard.mjs +38 -0
- package/lint/declaration-config.d.mts +2 -0
- package/lint/declaration-config.mjs +19 -0
- package/lint/engine-plugin.d.mts +2 -0
- package/lint/engine-plugin.mjs +40 -0
- package/lint/host-callbacks.d.mts +6 -0
- package/lint/host-callbacks.mjs +123 -0
- package/lint/host-files.d.mts +1 -0
- package/lint/host-files.mjs +7 -0
- package/lint/layer-exports.d.mts +2 -0
- package/lint/layer-exports.mjs +21 -0
- package/lint/legacy-line-basis.json +995 -0
- package/lint/nine-tiling-baseline.json +35 -0
- package/lint/ratchet.json +11 -0
- package/lint/runtime-files.d.mts +12 -0
- package/lint/runtime-files.json +16 -0
- package/lint/runtime-files.mjs +69 -0
- package/lint/runtime-performance.d.mts +6 -0
- package/lint/runtime-performance.mjs +184 -0
- package/lint/sdk-plugin.d.mts +4 -0
- package/lint/sdk-plugin.mjs +134 -0
- package/lint/shardfile-boundaries.d.mts +10 -0
- package/lint/shardfile-boundaries.mjs +122 -0
- package/lint/tile-bake-debt.json +556 -0
- package/package.json +371 -4
- package/scripts/agent-parity.mjs +1524 -0
- package/scripts/agent-sync.mjs +518 -0
- package/scripts/apfs-clone.mjs +67 -0
- package/scripts/assert-store-layout.mjs +23 -0
- package/scripts/astc6-phone-cap.d.mts +3 -0
- package/scripts/astc6-phone-cap.mjs +137 -0
- package/scripts/audit-assets.d.mts +10 -0
- package/scripts/audit-assets.mjs +151 -0
- package/scripts/bake/coatFiles.d.mts +6 -0
- package/scripts/bake/coatFiles.mjs +37 -0
- package/scripts/bake/environment.d.mts +2 -0
- package/scripts/bake/environment.mjs +58 -0
- package/scripts/bake/far-proxies.mjs +45 -0
- package/scripts/bake/keyed-sky.d.mts +4 -0
- package/scripts/bake/keyed-sky.mjs +34 -0
- package/scripts/bake/movers.mjs +56 -0
- package/scripts/bake/nativeWorld.d.mts +6 -0
- package/scripts/bake/nativeWorld.mjs +43 -0
- package/scripts/bake/navmeshGround.ts +22 -0
- package/scripts/bake/near-placeholder.mjs +331 -0
- package/scripts/bake/placeholderShards.mjs +41 -0
- package/scripts/bake/skins.mjs +15 -0
- package/scripts/bake/template-skins.mjs +33 -0
- package/scripts/bake/viewmodelBytes.ts +26 -0
- package/scripts/bake/viewmodelPage.ts +11 -0
- package/scripts/bake/worldHost.d.mts +35 -0
- package/scripts/bake/worldHost.mjs +110 -0
- package/scripts/bake-astc6.cache.json +80 -0
- package/scripts/bake-astc6.far-reach.cache.json +23 -0
- package/scripts/bake-astc6.list.json +111 -0
- package/scripts/bake-astc6.mjs +279 -0
- package/scripts/bake-astc6.nalati-grasslands.cache.json +42 -0
- package/scripts/bake-catalogue.mjs +44 -0
- package/scripts/bake-check.mjs +54 -0
- package/scripts/bake-chunk.mjs +124 -0
- package/scripts/bake-cloud-field.mjs +24 -0
- package/scripts/bake-coats.mjs +110 -0
- package/scripts/bake-data-maps.d.mts +24 -0
- package/scripts/bake-data-maps.mjs +72 -0
- package/scripts/bake-entry-programs.mjs +117 -0
- package/scripts/bake-geometry.mjs +106 -0
- package/scripts/bake-hybrid-tiles.mjs +28 -0
- package/scripts/bake-ktx2.cache.json +276 -0
- package/scripts/bake-ktx2.list.json +365 -0
- package/scripts/bake-ktx2.mjs +477 -0
- package/scripts/bake-map-glb.mjs +127 -0
- package/scripts/bake-map-rest.d.mts +7 -0
- package/scripts/bake-map-rest.mjs +50 -0
- package/scripts/bake-maps.mjs +200 -0
- package/scripts/bake-navmesh.mjs +259 -0
- package/scripts/bake-packs.mjs +129 -0
- package/scripts/bake-pickups.mjs +102 -0
- package/scripts/bake-query-terrain.mjs +64 -0
- package/scripts/bake-recurve-pool.mjs +16 -0
- package/scripts/bake-section-schemas.d.mts +3 -0
- package/scripts/bake-template-shardfile.mjs +32 -0
- package/scripts/bake-textures.mjs +80 -0
- package/scripts/bake-viewmodel-sets.json +45 -0
- package/scripts/bake-viewmodel-sets.mjs +137 -0
- package/scripts/bake-voxel-ao.mjs +119 -0
- package/scripts/bake-water-ripples.mjs +25 -0
- package/scripts/blender/README.md +129 -0
- package/scripts/blender/build.sh +166 -0
- package/scripts/blender/lib/export-scene.mjs +129 -0
- package/scripts/blender/lib/glb-digest.mjs +188 -0
- package/scripts/blender/lib/glb.py +68 -0
- package/scripts/blender/lib/save_blend.py +17 -0
- package/scripts/blender/lib/world_fixture.py +55 -0
- package/scripts/blender/targets.json +591 -0
- package/scripts/build-sdk.mjs +95 -0
- package/scripts/build-shardfiles.d.mts +7 -0
- package/scripts/build-shardfiles.mjs +206 -0
- package/scripts/capture-hero.mjs +137 -0
- package/scripts/check-lift-review.mjs +23 -0
- package/scripts/chromium-keychain-check.mjs +139 -0
- package/scripts/chromium-keychain.d.mts +1 -0
- package/scripts/chromium-keychain.mjs +5 -0
- package/scripts/compile-script.d.mts +3 -0
- package/scripts/compile-script.mjs +8 -0
- package/scripts/creature-color.mjs +255 -0
- package/scripts/decide/calibrate.py +127 -0
- package/scripts/decide/calibration/2026-10-03/labels-s1.tsv +281 -0
- package/scripts/decide/calibration/2026-10-03/labels-s2.tsv +97 -0
- package/scripts/decide/calibration/2026-10-03/labels-s3.tsv +48 -0
- package/scripts/decide/calibration/2026-10-03/labels-s3b.tsv +26 -0
- package/scripts/decide/calibration/2026-10-03/res-capture-status-v1.jsonl +376 -0
- package/scripts/decide/calibration/2026-10-03/res-text-garbled-strings.jsonl +48 -0
- package/scripts/decide/calibration/2026-10-03/res-text-garbled-v1.jsonl +73 -0
- package/scripts/decide/decide.py +262 -0
- package/scripts/decide/decide.sh +50 -0
- package/scripts/decide/layer-purity-pilot.mjs +41 -0
- package/scripts/decide/sets/capture-status.json +46 -0
- package/scripts/decide/sets/layer-purity.json +28 -0
- package/scripts/decide/sets/text-garbled.json +17 -0
- package/scripts/decide/test_decide.py +37 -0
- package/scripts/docs.mjs +15 -0
- package/scripts/entry-reads/crawl.ts +152 -0
- package/scripts/entry-reads/tsconfig.json +25 -0
- package/scripts/gen-format-schema.d.mts +2 -0
- package/scripts/gen-format-schema.mjs +21 -0
- package/scripts/gen-host-catalogue.d.mts +14 -0
- package/scripts/gen-host-catalogue.mjs +108 -0
- package/scripts/gen-shard-layout-doc.d.mts +4 -0
- package/scripts/gen-shard-layout-doc.mjs +55 -0
- package/scripts/gen-shards.d.mts +17 -0
- package/scripts/gen-shards.mjs +311 -0
- package/scripts/goldens/capture-inputs.d.mts +4 -0
- package/scripts/goldens/capture-inputs.mjs +34 -0
- package/scripts/goldens/colour_shift.py +27 -0
- package/scripts/goldens/native-residency.d.mts +10 -0
- package/scripts/goldens/native-residency.mjs +104 -0
- package/scripts/goldens/plot-inputs.d.mts +12 -0
- package/scripts/goldens/plot-inputs.mjs +46 -0
- package/scripts/gpu-texmem.mjs +98 -0
- package/scripts/horizon-matte/config.py +24 -0
- package/scripts/horizon-matte/encode.py +91 -0
- package/scripts/horizon-matte/key.py +141 -0
- package/scripts/horizon-matte/mkjobs.py +33 -0
- package/scripts/horizon-matte/mkjobs_day2.py +11 -0
- package/scripts/horizon-matte/overlap.py +80 -0
- package/scripts/horizon-matte/run_codex.py +57 -0
- package/scripts/horizon-matte/stitch.py +133 -0
- package/scripts/img2mesh/CC0.md +105 -0
- package/scripts/img2mesh/README.md +209 -0
- package/scripts/img2mesh/ab_board.py +102 -0
- package/scripts/img2mesh/birds/birds.json +255 -0
- package/scripts/img2mesh/birds/birds_atlas.py +150 -0
- package/scripts/img2mesh/birds/birds_fix_preview.mjs +103 -0
- package/scripts/img2mesh/birds/birds_fix_render.py +75 -0
- package/scripts/img2mesh/birds/birds_pack.py +110 -0
- package/scripts/img2mesh/birds/birds_phone_b.py +112 -0
- package/scripts/img2mesh/birds/birds_post.py +550 -0
- package/scripts/img2mesh/birds/birds_render.py +125 -0
- package/scripts/img2mesh/birds/birds_sheet.py +33 -0
- package/scripts/img2mesh/birds/birds_view.py +60 -0
- package/scripts/img2mesh/board.py +100 -0
- package/scripts/img2mesh/build_cc0.sh +52 -0
- package/scripts/img2mesh/build_driftwood.sh +12 -0
- package/scripts/img2mesh/build_faces.sh +53 -0
- package/scripts/img2mesh/build_props.py +81 -0
- package/scripts/img2mesh/cc0_export.py +186 -0
- package/scripts/img2mesh/driftwood_post.py +571 -0
- package/scripts/img2mesh/e304_faces.sh +67 -0
- package/scripts/img2mesh/face_remaster.py +911 -0
- package/scripts/img2mesh/face_views.py +95 -0
- package/scripts/img2mesh/faces-e304.json +9 -0
- package/scripts/img2mesh/faces.json +30 -0
- package/scripts/img2mesh/head_cut.py +100 -0
- package/scripts/img2mesh/hi3d_paint.py +94 -0
- package/scripts/img2mesh/hi3d_refine.py +161 -0
- package/scripts/img2mesh/hunyuan_cpu_rasterizer.sh +42 -0
- package/scripts/img2mesh/pine_hollow_phone.sh +13 -0
- package/scripts/img2mesh/props/coral-arch.json +32 -0
- package/scripts/img2mesh/props/ember-furnace.json +30 -0
- package/scripts/img2mesh/props/night-market-gate.json +10 -0
- package/scripts/img2mesh/render_still.py +86 -0
- package/scripts/img2mesh/rig_strip.mjs +46 -0
- package/scripts/img2mesh/rig_transfer.mjs +104 -0
- package/scripts/img2mesh/split_sheet.py +48 -0
- package/scripts/img2mesh/trellis_batch.py +110 -0
- package/scripts/img2mesh/versus_board.py +114 -0
- package/scripts/import-bundle.d.mts +2 -0
- package/scripts/import-bundle.mjs +20 -0
- package/scripts/ktx2-ab-board.py +133 -0
- package/scripts/ktx2-ab.mjs +111 -0
- package/scripts/ktx2-settings.mjs +18 -0
- package/scripts/land.d.mts +14 -0
- package/scripts/land.mjs +809 -0
- package/scripts/lint-dispatch.mjs +14 -0
- package/scripts/map-bake-frames.d.mts +4 -0
- package/scripts/map-bake-frames.mjs +23 -0
- package/scripts/map-geometry.d.mts +9 -0
- package/scripts/map-geometry.mjs +29 -0
- package/scripts/map-world.mjs +162 -0
- package/scripts/mockup-local.sh +46 -0
- package/scripts/music/export-midi.mjs +68 -0
- package/scripts/music/gen/analyze.py +308 -0
- package/scripts/music/gen/audio_jobs.py +46 -0
- package/scripts/music/gen/briefs.json +51 -0
- package/scripts/music/gen/build_page.py +334 -0
- package/scripts/music/gen/folk.json +3187 -0
- package/scripts/music/gen/gen_ace_step.py +156 -0
- package/scripts/music/gen/gen_heartmula.py +187 -0
- package/scripts/music/gen/gen_minimax.py +143 -0
- package/scripts/music/gen/gen_sao.py +122 -0
- package/scripts/music/gen/gen_sao_small.py +104 -0
- package/scripts/music/gen/gen_sfx.py +98 -0
- package/scripts/music/gen/gen_sfx_ezaudio.py +112 -0
- package/scripts/music/gen/gen_sfx_moss.py +112 -0
- package/scripts/music/gen/models.json +61 -0
- package/scripts/music/gen/nalati-jobs.json +104 -0
- package/scripts/music/gen/nalati-score-build.json +119 -0
- package/scripts/music/gen/nalati-score.json +3448 -0
- package/scripts/music/gen/ob7-fit-decisions.json +38 -0
- package/scripts/music/gen/ob7-score-jobs.json +152 -0
- package/scripts/music/gen/ob7-sfx-jobs.json +897 -0
- package/scripts/music/gen/ob7_build.py +469 -0
- package/scripts/music/gen/ob7_generate.py +67 -0
- package/scripts/music/gen/ob7_run.sh +42 -0
- package/scripts/music/gen/orchestral.json +3187 -0
- package/scripts/music/gen/own_score.py +486 -0
- package/scripts/music/gen/ph-jobs.json +27 -0
- package/scripts/music/gen/ph_page.py +222 -0
- package/scripts/music/gen/piano.json +3175 -0
- package/scripts/music/gen/rank_v3.py +248 -0
- package/scripts/music/gen/sfx-best.json +2486 -0
- package/scripts/music/gen/sfx-ezaudio.json +4082 -0
- package/scripts/music/gen/sfx-jobs.json +57 -0
- package/scripts/music/gen/sfx-minimax-jobs.json +16 -0
- package/scripts/music/gen/sfx-minimax.json +289 -0
- package/scripts/music/gen/sfx-moss.json +4082 -0
- package/scripts/music/gen/sfx-nalati-b3-jobs.json +17 -0
- package/scripts/music/gen/sfx-nalati-jobs.json +338 -0
- package/scripts/music/gen/sfx-nalati.json +11202 -0
- package/scripts/music/gen/sfx-nd-jobs.json +57 -0
- package/scripts/music/gen/sfx-nd-moss.json +2097 -0
- package/scripts/music/gen/sfx-nd-sa3-medium.json +2097 -0
- package/scripts/music/gen/sfx-nd-summary.json +38 -0
- package/scripts/music/gen/sfx-peaks.json +7 -0
- package/scripts/music/gen/sfx-ph-jobs.json +169 -0
- package/scripts/music/gen/sfx-ph-moss.json +6564 -0
- package/scripts/music/gen/sfx-ph-sa3-medium.json +7239 -0
- package/scripts/music/gen/sfx-ph-summary.json +63 -0
- package/scripts/music/gen/sfx-sa3-medium.json +4082 -0
- package/scripts/music/gen/sfx-sa3.json +4082 -0
- package/scripts/music/gen/sfx-summary.json +107 -0
- package/scripts/music/gen/sfx_build.py +332 -0
- package/scripts/music/gen/sfx_merge.py +255 -0
- package/scripts/music/gen/sfx_minimax.py +61 -0
- package/scripts/music/gen/sfx_nalati.py +331 -0
- package/scripts/music/gen/sfx_sprite.py +424 -0
- package/scripts/music/gen/stems.py +539 -0
- package/scripts/music/gen/test_loop_meter.py +29 -0
- package/scripts/music/gen/test_ob7_provenance.py +77 -0
- package/scripts/music/gen/v3-folk-build.json +148 -0
- package/scripts/music/gen/v3-folk.json +1818 -0
- package/scripts/music/gen/v3-jobs.json +145 -0
- package/scripts/music/gen/v3-orchestral-build.json +148 -0
- package/scripts/music/gen/v3-orchestral.json +1813 -0
- package/scripts/music/gen/v3-ph-folk-build.json +94 -0
- package/scripts/music/gen/v3-ph-folk.json +1806 -0
- package/scripts/music/gen/v3-ph-orchestral-build.json +94 -0
- package/scripts/music/gen/v3-ph-orchestral.json +1824 -0
- package/scripts/music/gen/v3-ph-piano-build.json +94 -0
- package/scripts/music/gen/v3-ph-piano.json +1818 -0
- package/scripts/music/gen/v3-piano-build.json +148 -0
- package/scripts/music/gen/v3-piano.json +1813 -0
- package/scripts/music/wildshard-theme.mid +0 -0
- package/scripts/music/wildshard-trailer30.mid +0 -0
- package/scripts/named-blob-output.d.mts +8 -0
- package/scripts/named-blob-output.mjs +48 -0
- package/scripts/pack-all.mjs +15 -0
- package/scripts/pid-lock.d.mts +1 -0
- package/scripts/pid-lock.mjs +63 -0
- package/scripts/practice/bake_dummy.py +53 -0
- package/scripts/practice/build_dummies.sh +43 -0
- package/scripts/practice/dummy_parts.py +568 -0
- package/scripts/practice/dummy_rig_gate.py +139 -0
- package/scripts/practice/gate_sheet.py +36 -0
- package/scripts/practice/generate_dummy_unimate.py +132 -0
- package/scripts/practice/pack_dummy.mjs +59 -0
- package/scripts/practice/repair_dummy_weights.mjs +68 -0
- package/scripts/practice/rig_dummy.py +828 -0
- package/scripts/practice/verify_unimate_skin.mjs +356 -0
- package/scripts/preparation-seed.mjs +15 -0
- package/scripts/prepare-basis-tool.mjs +6 -0
- package/scripts/prepare-product.d.mts +14 -0
- package/scripts/prepare-product.mjs +101 -0
- package/scripts/product-build-tools.d.mts +3 -0
- package/scripts/product-build-tools.json +3 -0
- package/scripts/product-build-tools.mjs +31 -0
- package/scripts/publish-public.mjs +7 -0
- package/scripts/push-tables.d.mts +1 -0
- package/scripts/push-tables.mjs +28 -0
- package/scripts/record-shard-mounts.mjs +133 -0
- package/scripts/sdk-externals.d.mts +2 -0
- package/scripts/sdk-externals.mjs +2 -0
- package/scripts/section-inventory.ts +209 -0
- package/scripts/select-candidate.mjs +15 -0
- package/scripts/shard-build-pool.d.mts +4 -0
- package/scripts/shard-build-pool.mjs +53 -0
- package/scripts/shard-line-baseline.json +17 -0
- package/scripts/shard-milestones.d.mts +15 -0
- package/scripts/shard-milestones.mjs +105 -0
- package/scripts/shard-output-report.d.mts +9 -0
- package/scripts/shard-output-report.mjs +85 -0
- package/scripts/shard-platform-cli.mjs +93 -0
- package/scripts/shard-progress.mjs +212 -0
- package/scripts/shard-timelapse.py +102 -0
- package/scripts/shardfile-cold-boot.mjs +79 -0
- package/scripts/shardfile-vite.d.mts +4 -0
- package/scripts/shardfile-vite.mjs +20 -0
- package/scripts/simplify-models.mjs +24 -0
- package/scripts/site-facts.mjs +88 -0
- package/scripts/test-template-gate.mjs +44 -0
- package/scripts/test_golden_compare.py +68 -0
- package/scripts/tex-tiers.cache.json +181 -0
- package/scripts/tex-tiers.mjs +240 -0
- package/scripts/texmem-probe.mjs +184 -0
- package/scripts/unused-assets.mjs +173 -0
- package/scripts/vite-tmp.d.mts +23 -0
- package/scripts/vite-tmp.mjs +157 -0
- package/scripts/wave-line-baselines.json +32 -0
- package/scripts/wildshard.d.mts +4 -0
- package/scripts/wildshard.mjs +105 -0
- package/scripts/witness-checkpoints.d.mts +10 -0
- package/scripts/witness-checkpoints.mjs +84 -0
- package/scripts/witness-generation.d.mts +10 -0
- package/scripts/witness-generation.mjs +45 -0
- package/scripts/witness-manifests.d.mts +8 -0
- package/scripts/witness-manifests.mjs +157 -0
- package/scripts/worktree-ignore.d.mts +4 -0
- package/scripts/worktree-ignore.mjs +36 -0
- package/scripts/worktree-reap.mjs +214 -0
- package/scripts/worktree.mjs +396 -0
- package/scripts/worldclaw/capture-front.sh +28 -0
- package/scripts/worldclaw/design-template.md +62 -0
- package/scripts/worldclaw/spec-map.py +92 -0
- package/scripts/worldclaw/spec.ts +96 -0
- package/skills/wildshard/SKILL.md +50 -0
- package/skills/wildshard-goldens/SKILL.md +54 -0
- package/skills/wildshard-mockup-to-model/SKILL.md +56 -0
- package/skills/wildshard-upgrade/SKILL.md +46 -0
- package/src/.oxfmtrc.json +50 -0
- package/src/.oxlintrc.json +173 -0
- package/src/cli/account/account.ts +199 -0
- package/src/cli/account/command.ts +193 -0
- package/src/cli/account/key.ts +154 -0
- package/src/cli/args.ts +97 -0
- package/src/cli/audio/audio.ts +24 -0
- package/src/cli/bin.mjs +8 -0
- package/src/cli/delete/delete.ts +258 -0
- package/src/cli/help.ts +196 -0
- package/src/cli/hero/adopt.ts +103 -0
- package/src/cli/hero/hero.ts +112 -0
- package/src/cli/hero/stamp.ts +298 -0
- package/src/cli/main.ts +292 -0
- package/src/cli/report.ts +16 -0
- package/src/cli/shardfile/command.ts +50 -0
- package/src/cli/shardfile/shardfile.ts +192 -0
- package/src/cli/upload/api.ts +246 -0
- package/src/cli/upload/compress.ts +55 -0
- package/src/cli/upload/hero.ts +62 -0
- package/src/cli/upload/placement.ts +115 -0
- package/src/cli/upload/provenance.ts +192 -0
- package/src/cli/upload/signature.ts +30 -0
- package/src/cli/upload/upload.ts +269 -0
- package/src/cli/upload/validate.ts +74 -0
- package/src/cli/upload/wire.ts +147 -0
- package/src/cli/version.ts +63 -0
- package/src/commons/bake/portableMath.ts +187 -0
- package/src/commons/catalogue.ts +10 -0
- package/src/commons/courseProgram.ts +32 -0
- package/src/commons/practiceCourse.ts +16 -0
- package/src/commons/scripts/abi.as +14 -0
- package/src/commons/scripts/bridge.as +14 -0
- package/src/commons/scripts/course.as +63 -0
- package/src/scripts/ask-new.sh +29 -0
- package/src/scripts/asks.mjs +141 -0
- package/src/scripts/herdr-prompt.sh +34 -0
- package/src/scripts/herdr-question-open.sh +67 -0
- package/src/scripts/md-wrap.mjs +229 -0
- package/src/server/app.ts +19 -0
- package/src/server/serve.ts +49 -0
- package/src/sharddev/admission.ts +7 -0
- package/src/sharddev/arenaView.ts +15 -0
- package/src/sharddev/as/groupBankV2.ts +36 -0
- package/src/sharddev/as/groupStepV2.ts +13 -0
- package/src/sharddev/as/ws.ts +30 -0
- package/src/sharddev/as/wsV2.ts +180 -0
- package/src/sharddev/assemblyscriptCompiler.d.mts +5 -0
- package/src/sharddev/assemblyscriptCompiler.mjs +14 -0
- package/src/sharddev/assetHandle.ts +84 -0
- package/src/sharddev/assetOwner.ts +70 -0
- package/src/sharddev/assetScope.ts +30 -0
- package/src/sharddev/assets.ts +21 -0
- package/src/sharddev/audio.ts +9 -0
- package/src/sharddev/audioEncode.ts +211 -0
- package/src/sharddev/author.ts +3 -0
- package/src/sharddev/authorError.ts +28 -0
- package/src/sharddev/authorManifest.ts +39 -0
- package/src/sharddev/bake/annulus.ts +19 -0
- package/src/sharddev/bake/assemblyscriptMemo.ts +76 -0
- package/src/sharddev/bake/assemblyscriptMemoPort.ts +4 -0
- package/src/sharddev/bake/authoredWorld.ts +201 -0
- package/src/sharddev/bake/basisEncoder.ts +95 -0
- package/src/sharddev/bake/basisGlb.ts +85 -0
- package/src/sharddev/bake/basisTool.ts +74 -0
- package/src/sharddev/bake/basisToolInputs.ts +476 -0
- package/src/sharddev/bake/byteCodec.ts +33 -0
- package/src/sharddev/bake/canvasAtlas.ts +406 -0
- package/src/sharddev/bake/coarseCopy.ts +59 -0
- package/src/sharddev/bake/colliders.ts +87 -0
- package/src/sharddev/bake/compactGlb.ts +224 -0
- package/src/sharddev/bake/compileScript.ts +119 -0
- package/src/sharddev/bake/compileScriptV2.ts +75 -0
- package/src/sharddev/bake/contactRows.ts +84 -0
- package/src/sharddev/bake/creaturePlacement.ts +117 -0
- package/src/sharddev/bake/export.ts +67 -0
- package/src/sharddev/bake/facetedGeometry.ts +379 -0
- package/src/sharddev/bake/farImpostor.ts +120 -0
- package/src/sharddev/bake/forest.ts +100 -0
- package/src/sharddev/bake/format-hook.mjs +2 -0
- package/src/sharddev/bake/generatorGlb.ts +23 -0
- package/src/sharddev/bake/geometryBounds.ts +77 -0
- package/src/sharddev/bake/geometryError.ts +48 -0
- package/src/sharddev/bake/glb.ts +355 -0
- package/src/sharddev/bake/glbCompression.ts +143 -0
- package/src/sharddev/bake/gltfSource.ts +59 -0
- package/src/sharddev/bake/groundMap.ts +142 -0
- package/src/sharddev/bake/image.ts +20 -0
- package/src/sharddev/bake/isleMap.ts +64 -0
- package/src/sharddev/bake/json.mjs +84 -0
- package/src/sharddev/bake/keyedSky.ts +47 -0
- package/src/sharddev/bake/keyedSkyMemo.ts +39 -0
- package/src/sharddev/bake/kinds.ts +137 -0
- package/src/sharddev/bake/lightSources.ts +31 -0
- package/src/sharddev/bake/mapAssembly.ts +84 -0
- package/src/sharddev/bake/mapRaster.ts +173 -0
- package/src/sharddev/bake/mapRest.ts +57 -0
- package/src/sharddev/bake/mapScenes.ts +234 -0
- package/src/sharddev/bake/materialGraph.ts +32 -0
- package/src/sharddev/bake/meadow.ts +27 -0
- package/src/sharddev/bake/meshoptChoiceMemo.ts +34 -0
- package/src/sharddev/bake/nativeInteractionFacts.ts +5 -0
- package/src/sharddev/bake/nativeLattice.ts +178 -0
- package/src/sharddev/bake/nativeRaster.ts +106 -0
- package/src/sharddev/bake/nativeTerrainField.ts +11 -0
- package/src/sharddev/bake/navigation-json.mjs +38 -0
- package/src/sharddev/bake/navigation.ts +113 -0
- package/src/sharddev/bake/navigationAsset.ts +18 -0
- package/src/sharddev/bake/nearPlaceholder.ts +206 -0
- package/src/sharddev/bake/normalizeRig.ts +80 -0
- package/src/sharddev/bake/phoneAstc.ts +93 -0
- package/src/sharddev/bake/placeholders.ts +581 -0
- package/src/sharddev/bake/placement.ts +80 -0
- package/src/sharddev/bake/portableBytes.ts +18 -0
- package/src/sharddev/bake/portableBytesMemo.ts +50 -0
- package/src/sharddev/bake/practiceCourse.ts +49 -0
- package/src/sharddev/bake/primitives.ts +96 -0
- package/src/sharddev/bake/props.ts +443 -0
- package/src/sharddev/bake/questPlacement.ts +98 -0
- package/src/sharddev/bake/rawTexture.ts +26 -0
- package/src/sharddev/bake/riderArms.ts +97 -0
- package/src/sharddev/bake/rig.ts +95 -0
- package/src/sharddev/bake/riggedHullRecipes.ts +40 -0
- package/src/sharddev/bake/signPlacements.ts +25 -0
- package/src/sharddev/bake/simplifier.ts +52 -0
- package/src/sharddev/bake/skinned.ts +312 -0
- package/src/sharddev/bake/slabChunks.ts +149 -0
- package/src/sharddev/bake/slabs.ts +263 -0
- package/src/sharddev/bake/source-loader.mjs +55 -0
- package/src/sharddev/bake/sourceMetadata.ts +54 -0
- package/src/sharddev/bake/species.ts +368 -0
- package/src/sharddev/bake/specimenCatalogue.ts +47 -0
- package/src/sharddev/bake/splatGround.ts +141 -0
- package/src/sharddev/bake/staticMaterials.ts +171 -0
- package/src/sharddev/bake/terrain.ts +195 -0
- package/src/sharddev/bake/texture.ts +33 -0
- package/src/sharddev/bake/textureWasm.ts +81 -0
- package/src/sharddev/bake/tileEncoder.ts +11 -0
- package/src/sharddev/bake/tileGrid.ts +62 -0
- package/src/sharddev/bake/v2Finite.ts +160 -0
- package/src/sharddev/bake/v2Fuel.ts +71 -0
- package/src/sharddev/bake/wholePartition.ts +74 -0
- package/src/sharddev/bake/wholePieceJoin.ts +147 -0
- package/src/sharddev/bake/world.ts +173 -0
- package/src/sharddev/bake/worldCollision.ts +128 -0
- package/src/sharddev/bake/worldGeometry.ts +237 -0
- package/src/sharddev/bake/worldGlb.ts +123 -0
- package/src/sharddev/bake/worldImage.ts +12 -0
- package/src/sharddev/bake/worldLod.ts +128 -0
- package/src/sharddev/bake/worldRows.ts +102 -0
- package/src/sharddev/bake/worldTextureMemo.ts +63 -0
- package/src/sharddev/bake/zstdBytesMemo.ts +52 -0
- package/src/sharddev/bake.ts +193 -0
- package/src/sharddev/bakePublication.ts +31 -0
- package/src/sharddev/behaviourSource.ts +94 -0
- package/src/sharddev/bin/wildshard.mjs +7 -0
- package/src/sharddev/blobBytes.ts +65 -0
- package/src/sharddev/blobs.ts +138 -0
- package/src/sharddev/bootInventory.ts +129 -0
- package/src/sharddev/bossProfiles.ts +18 -0
- package/src/sharddev/buildBehaviour.ts +77 -0
- package/src/sharddev/buildCacheMetrics.ts +17 -0
- package/src/sharddev/buildDecisionScripts.ts +122 -0
- package/src/sharddev/check.ts +117 -0
- package/src/sharddev/checkProject.ts +126 -0
- package/src/sharddev/cli.ts +191 -0
- package/src/sharddev/clientChannels.ts +169 -0
- package/src/sharddev/clientScripts.ts +10 -0
- package/src/sharddev/commons.ts +77 -0
- package/src/sharddev/commonsCosts.ts +11 -0
- package/src/sharddev/compileMovers.ts +11 -0
- package/src/sharddev/configBoundary.ts +6 -0
- package/src/sharddev/cookInput.ts +40 -0
- package/src/sharddev/crowds.ts +6 -0
- package/src/sharddev/decisionBindingMap.ts +11 -0
- package/src/sharddev/decisionScriptBindings.ts +117 -0
- package/src/sharddev/decisionScripts.ts +28 -0
- package/src/sharddev/decisionSource.ts +51 -0
- package/src/sharddev/dev.ts +113 -0
- package/src/sharddev/director.ts +26 -0
- package/src/sharddev/directorAbi.ts +77 -0
- package/src/sharddev/discoveryDocument.ts +97 -0
- package/src/sharddev/draft.ts +11 -0
- package/src/sharddev/eliteEntryRows.ts +29 -0
- package/src/sharddev/entries.ts +76 -0
- package/src/sharddev/entryReads.ts +73 -0
- package/src/sharddev/executeBundle.ts +55 -0
- package/src/sharddev/finds.ts +5 -0
- package/src/sharddev/formatJsonSchema.ts +3 -0
- package/src/sharddev/generationCache.ts +257 -0
- package/src/sharddev/generationRecipe.ts +94 -0
- package/src/sharddev/handwritten.ts +110 -0
- package/src/sharddev/immutable.ts +14 -0
- package/src/sharddev/interactions.ts +38 -0
- package/src/sharddev/kit/bakedGeometry.ts +16 -0
- package/src/sharddev/kit/geometryPack.ts +110 -0
- package/src/sharddev/ledger.ts +13 -0
- package/src/sharddev/looks/tileField.ts +67 -0
- package/src/sharddev/materialGraphFiles.ts +57 -0
- package/src/sharddev/materials.ts +574 -0
- package/src/sharddev/measure.ts +18 -0
- package/src/sharddev/modes.ts +115 -0
- package/src/sharddev/moverPrograms.ts +213 -0
- package/src/sharddev/movers.ts +75 -0
- package/src/sharddev/nativePopulationRows.ts +46 -0
- package/src/sharddev/newProject.ts +247 -0
- package/src/sharddev/noise.ts +54 -0
- package/src/sharddev/outputProduct.ts +188 -0
- package/src/sharddev/outputRuntime.ts +66 -0
- package/src/sharddev/performancePolicy.ts +18 -0
- package/src/sharddev/phasedBoss.ts +34 -0
- package/src/sharddev/physics.ts +194 -0
- package/src/sharddev/platformSections.ts +42 -0
- package/src/sharddev/plumbing.ts +8 -0
- package/src/sharddev/productOutput.ts +128 -0
- package/src/sharddev/project.ts +337 -0
- package/src/sharddev/projectCompilerIdentity.ts +94 -0
- package/src/sharddev/projectDecisions.ts +66 -0
- package/src/sharddev/projectEntryProof.ts +32 -0
- package/src/sharddev/projectGeneration.ts +219 -0
- package/src/sharddev/projectInputFiles.ts +47 -0
- package/src/sharddev/projectManifest.ts +108 -0
- package/src/sharddev/projectMap.ts +35 -0
- package/src/sharddev/projectOutput.ts +242 -0
- package/src/sharddev/projectPolicy.ts +17 -0
- package/src/sharddev/projectSections.ts +27 -0
- package/src/sharddev/questGraph.ts +25 -0
- package/src/sharddev/quests.ts +65 -0
- package/src/sharddev/random.ts +61 -0
- package/src/sharddev/refusals.ts +234 -0
- package/src/sharddev/reportCard.ts +13 -0
- package/src/sharddev/returnProjectionV2.ts +81 -0
- package/src/sharddev/rows.ts +192 -0
- package/src/sharddev/runtimeImports.ts +38 -0
- package/src/sharddev/runtimeMirrors.ts +39 -0
- package/src/sharddev/runtimePerformance.ts +38 -0
- package/src/sharddev/scene.ts +321 -0
- package/src/sharddev/sceneAnimation.ts +54 -0
- package/src/sharddev/sceneAudio.ts +64 -0
- package/src/sharddev/sceneDeclarations.ts +100 -0
- package/src/sharddev/sceneGraph.ts +139 -0
- package/src/sharddev/sceneTransform.ts +12 -0
- package/src/sharddev/schemaValidation.ts +61 -0
- package/src/sharddev/sections.ts +47 -0
- package/src/sharddev/shardSource.ts +59 -0
- package/src/sharddev/sourceReader.ts +26 -0
- package/src/sharddev/spawns.ts +38 -0
- package/src/sharddev/species/clips.ts +24 -0
- package/src/sharddev/species.ts +29 -0
- package/src/sharddev/speciesBrains.ts +19 -0
- package/src/sharddev/synth.ts +66 -0
- package/src/sharddev/test/compileDualScriptV2.ts +71 -0
- package/src/sharddev/test/compileSimV2.ts +21 -0
- package/src/sharddev/test/diskScriptScenario.ts +86 -0
- package/src/sharddev/test/scriptScenario.ts +249 -0
- package/src/sharddev/test/scriptSource.ts +12 -0
- package/src/sharddev/version.ts +4 -0
- package/src/sharddev/weapons/bowProfile.ts +20 -0
- package/src/sharddev/weapons/firearmRows.ts +11 -0
- package/src/sharddev/weapons/meleeProfile.ts +71 -0
- package/src/sharddev/weapons/thrownProfile.ts +10 -0
- package/src/sharddev/worldScenes.ts +308 -0
- package/src/sharddev/worldSource.ts +82 -0
- package/src/shards/_template/README.md +78 -0
- package/src/shards/_template/assets/2bf489fdb15f1734ddb4c4f32d500ec6da85c765ec7a4eb28dc6781160e7ec8c +0 -0
- package/src/shards/_template/assets/97ec4d8f75f5fa6239ee919444d6dc19fd35896bb305930c1f050ac6e0e0e6a6 +1 -0
- package/src/shards/_template/assets/a6a587a31327f936b1b04c05ade818c73fc8964260918662db43539465e27586 +0 -0
- package/src/shards/_template/assets/b4fbde0422e125b498c3dc8b9a5cc2516c8598f09e9d0e5f6b639b32f98179e6 +0 -0
- package/src/shards/_template/assets/bfa4dfc9c18979f904557ee8deab0058b8a399be10266f5fb1578b403f482fd4 +1 -0
- package/src/shards/_template/assets/ef3b7ff4fd22715771cb7d68a3977a903c5e7c3dc293542687d04b3ef3ace2cb +0 -0
- package/src/shards/_template/assets/f2db05998615ce1cb79ea96be32c168842eb6a2b34ec01feb86d36404603ee54 +0 -0
- package/src/shards/_template/assets/fef98ebb7fce6f66b26e78ac699e5c90f9bdcfaf8cabeb2b58125347eea8b4ab +0 -0
- package/src/shards/_template/behaviour/boss.as +39 -0
- package/src/shards/_template/behaviour/door.as +32 -0
- package/src/shards/_template/behaviour/hooks.json +129 -0
- package/src/shards/_template/behaviour/idle.as +75 -0
- package/src/shards/_template/behaviour/items.as +22 -0
- package/src/shards/_template/card/landscape.jpg +0 -0
- package/src/shards/_template/card/portrait.jpg +0 -0
- package/src/shards/_template/card/thumb.jpg +0 -0
- package/src/shards/_template/data/audio.json +45 -0
- package/src/shards/_template/data/bossDecision.json +83 -0
- package/src/shards/_template/data/budgets.json +70 -0
- package/src/shards/_template/data/card.json +281 -0
- package/src/shards/_template/data/clientScripts.json +987 -0
- package/src/shards/_template/data/creatures.json +65 -0
- package/src/shards/_template/data/director.json +39 -0
- package/src/shards/_template/data/encounters.json +96 -0
- package/src/shards/_template/data/items.json +172 -0
- package/src/shards/_template/data/layout.json +66 -0
- package/src/shards/_template/data/ledger.json +32 -0
- package/src/shards/_template/data/look.json +521 -0
- package/src/shards/_template/data/map.json +64 -0
- package/src/shards/_template/data/moves.json +16 -0
- package/src/shards/_template/data/placeholder.json +8 -0
- package/src/shards/_template/data/plumbing.json +32 -0
- package/src/shards/_template/data/quests.json +223 -0
- package/src/shards/_template/data/rows.json +423 -0
- package/src/shards/_template/data/skins.json +66 -0
- package/src/shards/_template/data/spawn.json +6 -0
- package/src/shards/_template/data/targets.json +150 -0
- package/src/shards/_template/data/text.json +12 -0
- package/src/shards/_template/data/ui.json +33 -0
- package/src/shards/_template/data/water.json +13 -0
- package/src/shards/_template/generators/behaviour.ts +34 -0
- package/src/shards/_template/generators/boss.ts +29 -0
- package/src/shards/_template/generators/buildOptions.ts +2 -0
- package/src/shards/_template/generators/cell.ts +224 -0
- package/src/shards/_template/generators/districts.ts +215 -0
- package/src/shards/_template/generators/farLook.ts +15 -0
- package/src/shards/_template/generators/generate.ts +27 -0
- package/src/shards/_template/generators/ground.ts +15 -0
- package/src/shards/_template/generators/kit.ts +69 -0
- package/src/shards/_template/generators/landscape.ts +59 -0
- package/src/shards/_template/generators/landscapeNoise.ts +62 -0
- package/src/shards/_template/generators/mapInputs.ts +10 -0
- package/src/shards/_template/generators/product.ts +100 -0
- package/src/shards/_template/generators/productOutput.ts +18 -0
- package/src/shards/_template/generators/props.ts +9 -0
- package/src/shards/_template/generators/templatePropsSource.ts +58 -0
- package/src/shards/_template/generators/terrain.ts +17 -0
- package/src/shards/_template/generators/world.ts +630 -0
- package/src/shards/_template/hero.json +10 -0
- package/src/shards/_template/look/entry-reads.json +20 -0
- package/src/shards/_template/manifest.json +281 -0
- package/src/shards/_template/shard.config.ts +10 -0
- package/src/shared/health.ts +10 -0
- package/src/tools/build-web.ts +59 -0
- package/src/tsconfig.json +30 -0
- package/src/web/app.tsx +53 -0
- package/src/web/index.html +12 -0
- package/src/web/main.tsx +10 -0
- package/src/web/tsconfig.json +13 -0
- package/tsconfig.author.json +23 -0
- package/tsconfig.commons.json +21 -0
- package/tsconfig.json +47 -0
- package/tsconfig.sharddev.json +20 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// glb-digest.mjs — a GLB's geometry digest, and the comparison `scripts/blender/build.sh --check` makes (M10, E315).
|
|
3
|
+
//
|
|
4
|
+
// node scripts/blender/lib/glb-digest.mjs <a.glb> the digest as JSON
|
|
5
|
+
// node scripts/blender/lib/glb-digest.mjs <rebuilt.glb> <committed.glb> [--json <out.json>]
|
|
6
|
+
//
|
|
7
|
+
// Bytes are not compared: the glTF exporter and meshopt are not byte-stable across versions, a Cycles bake is noisy,
|
|
8
|
+
// and some builders emit their vertices in a different order run to run. The digest holds the structure (meshes,
|
|
9
|
+
// primitives, vertex / triangle counts, attribute sets, materials, textures, nodes, skins, animations), the scene
|
|
10
|
+
// bounds, and a hash of each primitive's positions quantised to 0.1 mm, in any order.
|
|
11
|
+
// IDENTICAL the same structure and counts, and the same vertices (maybe in another order).
|
|
12
|
+
// EQUIVALENT the same structure and counts, bounds within 1 mm (or 0.1 % of the extent). It also reports the
|
|
13
|
+
// Hausdorff distance between the two vertex sets (the worst primitive): float noise vs a changed shape.
|
|
14
|
+
// DIFFERENT anything else. The exit code is 1.
|
|
15
|
+
import { createHash } from 'node:crypto';
|
|
16
|
+
import { writeFileSync } from 'node:fs';
|
|
17
|
+
import { NodeIO, getBounds } from '@gltf-transform/core';
|
|
18
|
+
import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
|
|
19
|
+
import { MeshoptDecoder } from 'meshoptimizer';
|
|
20
|
+
|
|
21
|
+
await MeshoptDecoder.ready;
|
|
22
|
+
const io = new NodeIO().registerExtensions(ALL_EXTENSIONS).registerDependencies({ 'meshopt.decoder': MeshoptDecoder });
|
|
23
|
+
|
|
24
|
+
const round = (x) => Math.round(x * 1000) / 1000;
|
|
25
|
+
|
|
26
|
+
/** a primitive's positions as a flat Float64Array */
|
|
27
|
+
function positions(attr) {
|
|
28
|
+
const n = attr.getCount();
|
|
29
|
+
const out = new Float64Array(n * 3);
|
|
30
|
+
const el = [];
|
|
31
|
+
for (let i = 0; i < n; i++) {
|
|
32
|
+
attr.getElement(i, el);
|
|
33
|
+
out[i * 3] = el[0];
|
|
34
|
+
out[i * 3 + 1] = el[1];
|
|
35
|
+
out[i * 3 + 2] = el[2];
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** the largest distance from a point of A to its nearest point of B (a uniform grid over B) */
|
|
41
|
+
function directed(A, B) {
|
|
42
|
+
const lo = [Infinity, Infinity, Infinity];
|
|
43
|
+
const hi = [-Infinity, -Infinity, -Infinity];
|
|
44
|
+
for (let i = 0; i < B.length; i += 3) {
|
|
45
|
+
for (let k = 0; k < 3; k++) {
|
|
46
|
+
lo[k] = Math.min(lo[k], B[i + k]);
|
|
47
|
+
hi[k] = Math.max(hi[k], B[i + k]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const n = B.length / 3;
|
|
51
|
+
const volume = (hi[0] - lo[0] + 1e-6) * (hi[1] - lo[1] + 1e-6) * (hi[2] - lo[2] + 1e-6);
|
|
52
|
+
const cell = Math.max(1e-4, Math.cbrt(volume / Math.max(1, n)) * 2);
|
|
53
|
+
const cellOf = (v, k) => Math.floor((v - lo[k]) / cell);
|
|
54
|
+
const grid = new Map();
|
|
55
|
+
for (let i = 0; i < n; i++) {
|
|
56
|
+
const key = `${cellOf(B[i * 3], 0)},${cellOf(B[i * 3 + 1], 1)},${cellOf(B[i * 3 + 2], 2)}`;
|
|
57
|
+
const list = grid.get(key);
|
|
58
|
+
if (list === undefined) grid.set(key, [i]);
|
|
59
|
+
else list.push(i);
|
|
60
|
+
}
|
|
61
|
+
let worst = 0;
|
|
62
|
+
for (let j = 0; j < A.length; j += 3) {
|
|
63
|
+
const c = [cellOf(A[j], 0), cellOf(A[j + 1], 1), cellOf(A[j + 2], 2)];
|
|
64
|
+
let best = Infinity;
|
|
65
|
+
// grow a shell of cells until no closer point can be outside it
|
|
66
|
+
for (let r = 0; r < 256 && best > (r - 1) * cell; r++) {
|
|
67
|
+
for (let x = c[0] - r; x <= c[0] + r; x++) {
|
|
68
|
+
for (let y = c[1] - r; y <= c[1] + r; y++) {
|
|
69
|
+
for (let z = c[2] - r; z <= c[2] + r; z++) {
|
|
70
|
+
if (Math.max(Math.abs(x - c[0]), Math.abs(y - c[1]), Math.abs(z - c[2])) !== r) continue;
|
|
71
|
+
for (const i of grid.get(`${x},${y},${z}`) ?? []) {
|
|
72
|
+
best = Math.min(best, Math.hypot(A[j] - B[i * 3], A[j + 1] - B[i * 3 + 1], A[j + 2] - B[i * 3 + 2]));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
worst = Math.max(worst, best);
|
|
79
|
+
}
|
|
80
|
+
return worst;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** the symmetric Hausdorff distance (m) between the vertex sets of corresponding primitives, the worst primitive */
|
|
84
|
+
export async function maxVertexDelta(pathA, pathB) {
|
|
85
|
+
const prims = async (f) => (await io.read(f)).getRoot().listMeshes().flatMap((m) => m.listPrimitives().map((p) => p.getAttribute('POSITION')));
|
|
86
|
+
const [pa, pb] = await Promise.all([prims(pathA), prims(pathB)]);
|
|
87
|
+
let worst = 0;
|
|
88
|
+
pa.forEach((a, k) => {
|
|
89
|
+
if (k >= pb.length) return;
|
|
90
|
+
const b = pb[k];
|
|
91
|
+
if (a === null || b === null || a.getCount() === 0 || b.getCount() === 0) return;
|
|
92
|
+
const A = positions(a);
|
|
93
|
+
const B = positions(b);
|
|
94
|
+
worst = Math.max(worst, directed(A, B), directed(B, A));
|
|
95
|
+
});
|
|
96
|
+
return worst;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export async function digest(path) {
|
|
100
|
+
const doc = await io.read(path);
|
|
101
|
+
const root = doc.getRoot();
|
|
102
|
+
const hash = createHash('sha1');
|
|
103
|
+
let vertices = 0;
|
|
104
|
+
let triangles = 0;
|
|
105
|
+
const meshes = root.listMeshes().map((m) => ({
|
|
106
|
+
name: m.getName(),
|
|
107
|
+
primitives: m.listPrimitives().map((p) => {
|
|
108
|
+
const pos = p.getAttribute('POSITION');
|
|
109
|
+
const n = pos?.getCount() ?? 0;
|
|
110
|
+
const idx = p.getIndices();
|
|
111
|
+
const tris = Math.floor((idx?.getCount() ?? n) / 3);
|
|
112
|
+
vertices += n;
|
|
113
|
+
triangles += tris;
|
|
114
|
+
const el = [];
|
|
115
|
+
const keys = [];
|
|
116
|
+
for (let i = 0; i < n; i++) {
|
|
117
|
+
pos.getElement(i, el);
|
|
118
|
+
keys.push(`${Math.round(el[0] * 1e4)},${Math.round(el[1] * 1e4)},${Math.round(el[2] * 1e4)}`);
|
|
119
|
+
}
|
|
120
|
+
hash.update(`${keys.sort().join(';')}|`);
|
|
121
|
+
return {
|
|
122
|
+
mode: p.getMode(),
|
|
123
|
+
vertices: n,
|
|
124
|
+
triangles: tris,
|
|
125
|
+
attributes: p.listSemantics().sort(),
|
|
126
|
+
material: p.getMaterial()?.getName() ?? null,
|
|
127
|
+
targets: p.listTargets().length,
|
|
128
|
+
};
|
|
129
|
+
}),
|
|
130
|
+
}));
|
|
131
|
+
const scenes = root.listScenes();
|
|
132
|
+
const bounds = scenes.length > 0 ? getBounds(scenes[0]) : { min: [0, 0, 0], max: [0, 0, 0] };
|
|
133
|
+
return {
|
|
134
|
+
file: path,
|
|
135
|
+
totals: { meshes: meshes.length, primitives: meshes.reduce((s, m) => s + m.primitives.length, 0), vertices, triangles },
|
|
136
|
+
materials: root.listMaterials().map((m) => m.getName()),
|
|
137
|
+
textures: root.listTextures().length,
|
|
138
|
+
nodes: root.listNodes().length,
|
|
139
|
+
skins: root.listSkins().map((s) => s.listJoints().length),
|
|
140
|
+
animations: root.listAnimations().map((a) => ({ name: a.getName(), channels: a.listChannels().length })),
|
|
141
|
+
bounds: { min: bounds.min.map(round), max: bounds.max.map(round) },
|
|
142
|
+
meshes,
|
|
143
|
+
positionHash: hash.digest('hex').slice(0, 16),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** the structure without the file name, the bounds or the hash: what must match exactly */
|
|
148
|
+
const shape = (d) => JSON.stringify({ ...d, file: undefined, bounds: undefined, positionHash: undefined });
|
|
149
|
+
|
|
150
|
+
export function compare(a, b) {
|
|
151
|
+
const notes = [];
|
|
152
|
+
if (shape(a) !== shape(b)) {
|
|
153
|
+
for (const k of ['totals', 'materials', 'textures', 'nodes', 'skins', 'animations']) {
|
|
154
|
+
if (JSON.stringify(a[k]) !== JSON.stringify(b[k])) notes.push(`${k}: ${JSON.stringify(a[k])} vs ${JSON.stringify(b[k])}`);
|
|
155
|
+
}
|
|
156
|
+
if (notes.length === 0) notes.push('per-mesh primitives differ (names, attributes or counts)');
|
|
157
|
+
return { verdict: 'DIFFERENT', notes };
|
|
158
|
+
}
|
|
159
|
+
const extent = Math.max(...b.bounds.max.map((x, i) => x - b.bounds.min[i]), 1);
|
|
160
|
+
const tol = Math.max(1e-3, extent * 1e-3);
|
|
161
|
+
const drift = Math.max(...a.bounds.min.map((x, i) => Math.abs(x - b.bounds.min[i])), ...a.bounds.max.map((x, i) => Math.abs(x - b.bounds.max[i])));
|
|
162
|
+
if (drift > tol) return { verdict: 'DIFFERENT', notes: [`bounds drift ${drift.toFixed(4)} m > ${tol.toFixed(4)} m`] };
|
|
163
|
+
if (a.positionHash === b.positionHash) return { verdict: 'IDENTICAL', notes: [] };
|
|
164
|
+
return { verdict: 'EQUIVALENT', notes: [`same structure and counts, bounds within ${drift.toFixed(4)} m`] };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (import.meta.main) {
|
|
168
|
+
const args = process.argv.slice(2);
|
|
169
|
+
const ji = args.indexOf('--json');
|
|
170
|
+
const out = ji === -1 ? null : args[ji + 1];
|
|
171
|
+
const files = args.filter((a, i) => a !== '--json' && (ji === -1 || i !== ji + 1));
|
|
172
|
+
const [a, b] = await Promise.all(files.map((f) => digest(f)));
|
|
173
|
+
if (files.length < 2) {
|
|
174
|
+
console.log(JSON.stringify(a, null, 1));
|
|
175
|
+
} else {
|
|
176
|
+
const r = compare(a, b);
|
|
177
|
+
if (r.verdict === 'EQUIVALENT') {
|
|
178
|
+
r.hausdorff = await maxVertexDelta(files[0], files[1]);
|
|
179
|
+
r.notes.push(`the vertex sets are within ${r.hausdorff.toExponential(2)} m of each other (Hausdorff, the worst primitive)`);
|
|
180
|
+
}
|
|
181
|
+
const t = (d) => `${d.totals.meshes} meshes / ${d.totals.primitives} prims / ${d.totals.vertices} v / ${d.totals.triangles} tris / ${d.materials.length} mats / ${d.textures} tex / ${d.animations.length} anims`;
|
|
182
|
+
console.log(`[check] ${r.verdict} rebuilt ${t(a)}`);
|
|
183
|
+
console.log(`[check] ${' '.repeat(r.verdict.length)} committed ${t(b)}`);
|
|
184
|
+
for (const n of r.notes) console.log(`[check] ${n}`);
|
|
185
|
+
if (out !== null) writeFileSync(out, JSON.stringify({ ...r, rebuilt: a, committed: b }, null, 1));
|
|
186
|
+
process.exitCode = r.verdict === 'DIFFERENT' ? 1 : 0;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""glb.py — a minimal glTF 2.0 binary writer for the tree set (numpy arrays in, one node + mesh per part)."""
|
|
2
|
+
import json
|
|
3
|
+
import struct
|
|
4
|
+
import numpy as np
|
|
5
|
+
|
|
6
|
+
FLOAT, UINT, USHORT = 5126, 5125, 5123
|
|
7
|
+
ARRAY, ELEMENT = 34962, 34963
|
|
8
|
+
TYPES = {1: 'SCALAR', 2: 'VEC2', 3: 'VEC3', 4: 'VEC4'}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def write_glb(path, meshes, extras=None, materials=None):
|
|
12
|
+
"""meshes: [(name, {'POSITION': (n,3) f32, 'NORMAL', 'TEXCOORD_0', 'TEXCOORD_1', 'COLOR_0', 'indices': (m,) u32,
|
|
13
|
+
'material': index into `materials`})]; materials: plain white, rough, non-metal materials by name"""
|
|
14
|
+
blob = bytearray()
|
|
15
|
+
views, accessors, gmeshes, nodes = [], [], [], []
|
|
16
|
+
|
|
17
|
+
def push(arr, target, comp, minmax=False):
|
|
18
|
+
while len(blob) % 4:
|
|
19
|
+
blob.append(0)
|
|
20
|
+
off = len(blob)
|
|
21
|
+
blob.extend(arr.tobytes())
|
|
22
|
+
views.append({'buffer': 0, 'byteOffset': off, 'byteLength': int(arr.nbytes), 'target': target})
|
|
23
|
+
width = 1 if arr.ndim == 1 else arr.shape[1]
|
|
24
|
+
acc = {'bufferView': len(views) - 1, 'componentType': comp, 'count': int(arr.shape[0]), 'type': TYPES[width]}
|
|
25
|
+
if minmax:
|
|
26
|
+
# + 0.0 turns -0.0 into 0.0: the world reader refuses a negative zero in GLB JSON
|
|
27
|
+
acc['min'] = [float(x) + 0.0 for x in arr.min(axis=0)]
|
|
28
|
+
acc['max'] = [float(x) + 0.0 for x in arr.max(axis=0)]
|
|
29
|
+
accessors.append(acc)
|
|
30
|
+
return len(accessors) - 1
|
|
31
|
+
|
|
32
|
+
for name, a in meshes:
|
|
33
|
+
attrs = {}
|
|
34
|
+
for key in ('POSITION', 'NORMAL', 'TEXCOORD_0', 'TEXCOORD_1', 'COLOR_0'):
|
|
35
|
+
if key in a:
|
|
36
|
+
attrs[key] = push(np.ascontiguousarray(a[key], dtype=np.float32), ARRAY, FLOAT, minmax=key == 'POSITION')
|
|
37
|
+
idx = a['indices']
|
|
38
|
+
if int(idx.max()) < 65535:
|
|
39
|
+
ind = push(np.ascontiguousarray(idx, dtype=np.uint16), ELEMENT, USHORT)
|
|
40
|
+
else:
|
|
41
|
+
ind = push(np.ascontiguousarray(idx, dtype=np.uint32), ELEMENT, UINT)
|
|
42
|
+
primitive = {'attributes': attrs, 'indices': ind, 'mode': 4}
|
|
43
|
+
if 'material' in a:
|
|
44
|
+
primitive['material'] = a['material']
|
|
45
|
+
gmeshes.append({'name': name, 'primitives': [primitive]})
|
|
46
|
+
nodes.append({'name': name, 'mesh': len(gmeshes) - 1})
|
|
47
|
+
|
|
48
|
+
while len(blob) % 4:
|
|
49
|
+
blob.append(0)
|
|
50
|
+
doc = {
|
|
51
|
+
'asset': {'version': '2.0', 'generator': 'wildshard scripts/blender/lib/glb.py'},
|
|
52
|
+
'scene': 0, 'scenes': [{'nodes': list(range(len(nodes)))}],
|
|
53
|
+
'nodes': nodes, 'meshes': gmeshes, 'accessors': accessors, 'bufferViews': views,
|
|
54
|
+
'buffers': [{'byteLength': len(blob)}],
|
|
55
|
+
}
|
|
56
|
+
if materials:
|
|
57
|
+
doc['materials'] = [{'name': m, 'pbrMetallicRoughness': {'baseColorFactor': [1, 1, 1, 1], 'metallicFactor': 0,
|
|
58
|
+
'roughnessFactor': 1}} for m in materials]
|
|
59
|
+
if extras:
|
|
60
|
+
doc['extras'] = extras
|
|
61
|
+
js = json.dumps(doc, separators=(',', ':')).encode()
|
|
62
|
+
while len(js) % 4:
|
|
63
|
+
js += b' '
|
|
64
|
+
total = 12 + 8 + len(js) + 8 + len(blob)
|
|
65
|
+
with open(path, 'wb') as f:
|
|
66
|
+
f.write(struct.pack('<III', 0x46546C67, 2, total))
|
|
67
|
+
f.write(struct.pack('<II', len(js), 0x4E4F534A)); f.write(js)
|
|
68
|
+
f.write(struct.pack('<II', len(blob), 0x004E4942)); f.write(bytes(blob))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""save_blend.py — build.sh --save-blend: save the scene a builder left behind as an inspection .blend (M10, E315).
|
|
2
|
+
|
|
3
|
+
build.sh runs it as a second -P after the target's script and points WILDSHARD_SAVE_BLEND at the target's cache
|
|
4
|
+
(~/.cache/wildshard-blender/<target>/<name>.blend). The file is for a person or an agent to open and look at; it is
|
|
5
|
+
never a source and never committed (.gitignore and .githooks/pre-commit refuse *.blend).
|
|
6
|
+
"""
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
import bpy
|
|
10
|
+
|
|
11
|
+
path = os.environ.get('WILDSHARD_SAVE_BLEND', '')
|
|
12
|
+
if path:
|
|
13
|
+
if not path.endswith('.blend'):
|
|
14
|
+
raise SystemExit(f'save_blend: {path} is not a .blend path')
|
|
15
|
+
os.makedirs(os.path.dirname(path), exist_ok=True)
|
|
16
|
+
bpy.ops.wm.save_as_mainfile(filepath=path, check_existing=False, compress=True)
|
|
17
|
+
print(f'[build] saved the inspection file {path}')
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""SF55a portable intake fixture: Blender geometry, embedded PNGs and a separate door."""
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
import bpy
|
|
5
|
+
|
|
6
|
+
bpy.ops.object.select_all(action='SELECT')
|
|
7
|
+
bpy.ops.object.delete(use_global=False)
|
|
8
|
+
out = sys.argv[sys.argv.index('--') + 1]
|
|
9
|
+
os.makedirs(out, exist_ok=True)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def surface(name, colour, textured=False):
|
|
13
|
+
material = bpy.data.materials.new(name)
|
|
14
|
+
material.use_nodes = True
|
|
15
|
+
shader = material.node_tree.nodes.get('Principled BSDF')
|
|
16
|
+
shader.inputs['Base Color'].default_value = (*colour, 1)
|
|
17
|
+
shader.inputs['Roughness'].default_value = 1
|
|
18
|
+
if textured:
|
|
19
|
+
image = bpy.data.images.new(name, width=8, height=8)
|
|
20
|
+
image.pixels = [value for y in range(8) for x in range(8)
|
|
21
|
+
for value in (*[c * (0.7 if (x + y) % 2 else 1) for c in colour], 1)]
|
|
22
|
+
image.filepath_raw = os.path.join(out, name + '.png')
|
|
23
|
+
image.file_format = 'PNG'
|
|
24
|
+
image.save()
|
|
25
|
+
image.pack()
|
|
26
|
+
texture = material.node_tree.nodes.new('ShaderNodeTexImage')
|
|
27
|
+
texture.image = image
|
|
28
|
+
material.node_tree.links.new(texture.outputs['Color'], shader.inputs['Base Color'])
|
|
29
|
+
shader.inputs['Base Color'].default_value = (1, 1, 1, 1)
|
|
30
|
+
return material
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def box(name, location, dimensions, material):
|
|
34
|
+
bpy.ops.mesh.primitive_cube_add(size=1, location=location)
|
|
35
|
+
obj = bpy.context.object
|
|
36
|
+
obj.name = name
|
|
37
|
+
obj.dimensions = dimensions
|
|
38
|
+
obj.data.materials.append(material)
|
|
39
|
+
return obj
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
clay = surface('Clay', (0.6, 0.58, 0.54))
|
|
43
|
+
paint = surface('Paint', (0.25, 0.6, 0.5), True)
|
|
44
|
+
wood = surface('Door wood', (0.4, 0.22, 0.1), True)
|
|
45
|
+
box('ws_terrain_ground', (0, 0, -0.5), (500, 500, 1), clay)
|
|
46
|
+
bridge = box('Bridge', (0, -30, 4), (12, 8, 1), paint)
|
|
47
|
+
bridge.rotation_euler.z = 0.2
|
|
48
|
+
box('Overhang', (16, -30, 7), (12, 8, 1), clay)
|
|
49
|
+
box('Support', (16, -30, 3), (2, 2, 6), clay)
|
|
50
|
+
box('Door', (10, -15, 1.5), (2, 0.25, 3), wood)
|
|
51
|
+
bpy.ops.export_scene.gltf(filepath=os.path.join(out, 'world.glb'), export_format='GLB',
|
|
52
|
+
export_yup=True, export_apply=True, export_materials='EXPORT',
|
|
53
|
+
export_animations=False, export_cameras=False, export_lights=False,
|
|
54
|
+
export_extras=False, export_image_format='AUTO')
|
|
55
|
+
print('[world-fixture] exported ordinary Blender GLB')
|