create-threenative 0.2.17 → 0.2.20
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/agent-docs/kit-mcp.md +1 -1
- package/agent-docs/kit-router.md +1 -1
- package/agent-docs/references/assertion-reference.md +54 -110
- package/agent-docs/references/capability-reference.md +790 -24
- package/agent-docs/references/conventions.md +28 -0
- package/agent-docs/references/kit-racing.md +4 -2
- package/agent-docs/references/performance-basics.md +10 -5
- package/agent-docs/references/terrain-authoring.md +21 -7
- package/agent-files/.agents/skills/ponytail/SKILL.md +1 -1
- package/agent-files/.agents/skills/prd-creator/SKILL.md +24 -0
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +7 -4
- package/agent-files/.claude/hooks/discovery-gate.mjs +2 -2
- package/dist/index.d.ts +97 -6
- package/dist/index.js +1040 -529
- package/dist/quality.d.ts +5 -1
- package/dist/quality.js +75 -6
- package/dist/terrain-kit.js +1 -1
- package/dist/threenative.js +98 -17
- package/dist/web-engine-ccd-ik-solver.js +127 -0
- package/dist/web-engine-gltf-loader.js +52 -14
- package/dist/web-engine-post-effects.js +11 -10
- package/dist/web-engine-runtime.js +3638 -361
- package/package.json +8 -7
- package/template-assets/assets/floor-fern-0.glb +0 -0
- package/template-assets/assets/floor-litter-0.glb +0 -0
- package/template-assets/assets/floor-log-0.glb +0 -0
- package/template-assets/assets/floor-log-1.glb +0 -0
- package/template-assets/assets/floor-stump-0.glb +0 -0
- package/template-assets/assets/floor-twig-0.glb +0 -0
- package/template-assets/clearwater/README.md +1 -1
- package/template-assets/patches/manifest.json +18 -0
- package/template-assets/quality/eslint.config.js +1 -1
- package/templates/action-rpg/AGENTS.md +8 -4
- package/templates/action-rpg/CLAUDE.md +8 -4
- package/templates/action-rpg/package.json +7 -7
- package/templates/action-rpg/src/game.ts +1 -1
- package/templates/action-rpg/src/loot/drops.ts +3 -7
- package/templates/action-rpg/src/render/atmosphere.ts +6 -0
- package/templates/action-rpg/src/render/backlightControls.ts +10 -0
- package/templates/action-rpg/src/render/backlightMaterial.ts +4 -4
- package/templates/action-rpg/src/render/camera.ts +2 -2
- package/templates/action-rpg/src/render/clouds.ts +16 -1
- package/templates/action-rpg/src/render/materialLighting.ts +5 -5
- package/templates/action-rpg/src/render/materials.ts +3 -2
- package/templates/action-rpg/src/render/quality.ts +7 -32
- package/templates/action-rpg/src/render/touch-controls.ts +7 -6
- package/templates/action-rpg/src/scenes/Play.ts +5 -16
- package/templates/action-rpg/src/style.css +4 -0
- package/templates/action-rpg/vite.config.ts +2 -0
- package/templates/adventure/AGENTS.md +10 -5
- package/templates/adventure/CLAUDE.md +10 -5
- package/templates/adventure/kit.json +5 -1
- package/templates/adventure/native-playtests/survives.playtest.json +12 -0
- package/templates/adventure/native-playtests/woodland-floor.playtest.json +61 -0
- package/templates/adventure/package.json +7 -7
- package/templates/adventure/playtests/grass.playtest.json +61 -0
- package/templates/adventure/playtests/performance.playtest.json +1 -1
- package/templates/adventure/playtests/survives.playtest.json +2 -2
- package/templates/adventure/playtests/woodland-floor.playtest.json +61 -0
- package/templates/adventure/src/entities/LockOn.ts +42 -4
- package/templates/adventure/src/entities/Warden.ts +4 -1
- package/templates/adventure/src/game.ts +1 -1
- package/templates/adventure/src/level/Vale.ts +241 -16
- package/templates/adventure/src/render/camera.ts +2 -2
- package/templates/adventure/src/render/foliage.ts +64 -20
- package/templates/adventure/src/render/grass.ts +325 -0
- package/templates/adventure/src/render/materials.ts +3 -2
- package/templates/adventure/src/render/palette.ts +3 -0
- package/templates/adventure/src/render/touch-controls.ts +4 -1
- package/templates/adventure/src/scenes/Play.ts +96 -1
- package/templates/adventure/src/style.css +4 -0
- package/templates/adventure/tsconfig.json +1 -1
- package/templates/adventure/vite.config.ts +2 -0
- package/templates/collectathon/AGENTS.md +7 -2
- package/templates/collectathon/CLAUDE.md +7 -2
- package/templates/collectathon/package.json +7 -7
- package/templates/collectathon/src/game.ts +1 -1
- package/templates/collectathon/src/level/Course.ts +55 -14
- package/templates/collectathon/src/level/terrain.ts +29 -7
- package/templates/collectathon/src/main.ts +1 -0
- package/templates/collectathon/src/render/camera.ts +2 -2
- package/templates/collectathon/src/render/foliage.ts +359 -98
- package/templates/collectathon/src/render/ground.ts +4 -4
- package/templates/collectathon/src/render/hero.ts +1 -1
- package/templates/collectathon/src/render/materials.ts +0 -1
- package/templates/collectathon/src/render/sky.ts +80 -15
- package/templates/collectathon/src/render/water.ts +32 -10
- package/templates/collectathon/src/scenes/Play.ts +18 -5
- package/templates/collectathon/src/style.css +4 -0
- package/templates/collectathon/tsconfig.json +1 -1
- package/templates/collectathon/vite.config.ts +2 -0
- package/templates/kart/AGENTS.md +7 -2
- package/templates/kart/CLAUDE.md +7 -2
- package/templates/kart/package.json +6 -6
- package/templates/kart/src/entities/Kart.ts +2 -1
- package/templates/kart/src/game.ts +1 -1
- package/templates/kart/src/main.ts +1 -0
- package/templates/kart/src/render/course.ts +2 -1
- package/templates/kart/src/style.css +4 -0
- package/templates/kart/src/track/Course.ts +3 -1
- package/templates/kart/tsconfig.json +1 -1
- package/templates/kart/vite.config.ts +2 -0
- package/templates/minimal/AGENTS.md +8 -3
- package/templates/minimal/CLAUDE.md +8 -3
- package/templates/minimal/package.json +6 -6
- package/templates/minimal/playtests/stands-still.playtest.json +30 -0
- package/templates/minimal/src/game.ts +1 -1
- package/templates/minimal/src/render/atmosphere.ts +6 -0
- package/templates/minimal/src/render/backlightControls.ts +10 -0
- package/templates/minimal/src/render/backlightMaterial.ts +4 -4
- package/templates/minimal/src/render/camera.ts +14 -3
- package/templates/minimal/src/render/clouds.ts +16 -1
- package/templates/minimal/src/render/lighting.ts +4 -2
- package/templates/minimal/src/render/materialLighting.ts +5 -5
- package/templates/minimal/src/render/materials.ts +13 -2
- package/templates/minimal/src/render/quality.ts +7 -32
- package/templates/minimal/src/render/touch-controls.ts +7 -6
- package/templates/minimal/src/scenes/Play.ts +4 -1
- package/templates/minimal/vite.config.ts +7 -1
- package/templates/platformer/AGENTS.md +9 -4
- package/templates/platformer/CLAUDE.md +9 -4
- package/templates/platformer/index.html +1 -1
- package/templates/platformer/main.html +12 -0
- package/templates/platformer/package.json +7 -7
- package/templates/platformer/playtests/collect.playtest.json +4 -1
- package/templates/platformer/playtests/gamepad-idle.playtest.json +21 -0
- package/templates/platformer/playtests/gamepad.playtest.json +30 -0
- package/templates/platformer/src/entities/Fox.ts +21 -6
- package/templates/platformer/src/game.ts +1 -1
- package/templates/platformer/src/level/Stage.ts +2 -6
- package/templates/platformer/src/main.ts +1 -0
- package/templates/platformer/src/render/backlightControls.ts +10 -0
- package/templates/platformer/src/render/backlightMaterial.ts +4 -4
- package/templates/platformer/src/render/materialLighting.ts +5 -5
- package/templates/platformer/src/render/quality.ts +7 -32
- package/templates/platformer/src/scenes/Play.ts +4 -2
- package/templates/platformer/src/style.css +4 -0
- package/templates/platformer/src/worker-page.ts +29 -0
- package/templates/platformer/src/worker.ts +5 -0
- package/templates/platformer/tsconfig.json +1 -1
- package/templates/platformer/vite.config.ts +4 -0
- package/templates/puzzle/AGENTS.md +7 -2
- package/templates/puzzle/CLAUDE.md +7 -2
- package/templates/puzzle/package.json +7 -7
- package/templates/puzzle/src/entities/Warden.ts +3 -3
- package/templates/puzzle/src/game.ts +1 -1
- package/templates/puzzle/src/render/backlightControls.ts +10 -0
- package/templates/puzzle/src/render/backlightMaterial.ts +4 -4
- package/templates/puzzle/src/render/camera.ts +2 -2
- package/templates/puzzle/src/render/materialLighting.ts +5 -5
- package/templates/puzzle/src/render/quality.ts +7 -32
- package/templates/puzzle/src/render/touch-controls.ts +7 -6
- package/templates/puzzle/src/scenes/Play.ts +1 -1
- package/templates/puzzle/src/style.css +4 -0
- package/templates/puzzle/tsconfig.json +1 -1
- package/templates/puzzle/vite.config.ts +2 -0
- package/templates/racing/AGENTS.md +9 -4
- package/templates/racing/CLAUDE.md +9 -4
- package/templates/racing/CREDITS.md +29 -0
- package/templates/racing/assets/engine-loop.wav +0 -0
- package/templates/racing/assets/grass/Grass004_color.jpg +0 -0
- package/templates/racing/assets/grass/Grass004_normal.jpg +0 -0
- package/templates/racing/assets/grass/Grass004_roughness.jpg +0 -0
- package/templates/racing/assets/nitro-burst.wav +0 -0
- package/templates/racing/assets/tyre-squeal.wav +0 -0
- package/templates/racing/package.json +7 -7
- package/templates/racing/playtests/drift-natural.playtest.json +68 -0
- package/templates/racing/playtests/drift.playtest.json +100 -0
- package/templates/racing/playtests/hud.playtest.json +117 -0
- package/templates/racing/playtests/launch-pose.playtest.json +34 -0
- package/templates/racing/playtests/nitro.playtest.json +158 -0
- package/templates/racing/playtests/outcome.playtest.json +4 -4
- package/templates/racing/playtests/performance.playtest.json +1 -1
- package/templates/racing/playtests/steady-camera.playtest.json +88 -0
- package/templates/racing/src/audio/engine.ts +138 -0
- package/templates/racing/src/entities/CarBody.ts +83 -10
- package/templates/racing/src/entities/Drift.ts +243 -0
- package/templates/racing/src/entities/LineDriver.ts +2 -2
- package/templates/racing/src/entities/Nitro.ts +72 -0
- package/templates/racing/src/entities/RacingCar.ts +86 -21
- package/templates/racing/src/entities/Rival.ts +35 -21
- package/templates/racing/src/game.ts +7 -1
- package/templates/racing/src/gauges.ts +74 -0
- package/templates/racing/src/render/atmosphere.ts +6 -0
- package/templates/racing/src/render/backlightControls.ts +10 -0
- package/templates/racing/src/render/backlightMaterial.ts +4 -4
- package/templates/racing/src/render/camera.ts +29 -4
- package/templates/racing/src/render/clouds.ts +16 -1
- package/templates/racing/src/render/effects.ts +244 -0
- package/templates/racing/src/render/materialLighting.ts +5 -5
- package/templates/racing/src/render/materials.ts +43 -8
- package/templates/racing/src/render/quality.ts +7 -32
- package/templates/racing/src/render/shapes.ts +37 -0
- package/templates/racing/src/render/skids.ts +84 -0
- package/templates/racing/src/render/touch-controls.ts +10 -10
- package/templates/racing/src/scenes/Race.ts +281 -26
- package/templates/racing/src/state.ts +35 -0
- package/templates/racing/src/style.css +7 -0
- package/templates/racing/src/track/Track.ts +132 -58
- package/templates/racing/src/track/TrackSector.ts +19 -1
- package/templates/racing/src/track/circuit.ts +21 -15
- package/templates/racing/src/ui/GameUi.tsx +0 -2
- package/templates/racing/src/ui/Hud.tsx +417 -50
- package/templates/racing/threenative.config.ts +15 -0
- package/templates/racing/tools/make-racing-audio.mjs +388 -0
- package/templates/racing/tsconfig.json +1 -1
- package/templates/racing/vite.config.ts +2 -0
- package/templates/rain/AGENTS.md +6 -2
- package/templates/rain/CLAUDE.md +6 -2
- package/templates/rain/package.json +6 -6
- package/templates/rain/src/game.ts +1 -1
- package/templates/rain/src/render/noise-volume.ts +2 -1
- package/templates/rain/src/state.ts +3 -1
- package/templates/rain/src/ui/GameUi.tsx +1 -1
- package/templates/rain/src/ui/automation.ts +10 -8
- package/templates/rain/src/ui/tempest.ts +3 -4
- package/templates/rain/vite.config.ts +6 -0
- package/templates/rts/AGENTS.md +6 -2
- package/templates/rts/CLAUDE.md +6 -2
- package/templates/rts/package.json +6 -6
- package/templates/rts/src/game.ts +1 -1
- package/templates/rts/src/render/backlightControls.ts +10 -0
- package/templates/rts/src/render/backlightMaterial.ts +4 -4
- package/templates/rts/src/render/materialLighting.ts +5 -5
- package/templates/rts/src/render/quality.ts +7 -31
- package/templates/rts/src/scenes/Play.ts +1 -1
- package/templates/rts/src/sim/terrain.ts +1 -0
- package/templates/rts/src/sim/types.ts +1 -0
- package/templates/rts/src/style.css +4 -0
- package/templates/rts/vite.config.ts +2 -0
- package/templates/runner/AGENTS.md +7 -2
- package/templates/runner/CLAUDE.md +7 -2
- package/templates/runner/package.json +7 -7
- package/templates/runner/src/game.ts +1 -1
- package/templates/runner/src/render/atmosphere.ts +6 -0
- package/templates/runner/src/render/backlightControls.ts +10 -0
- package/templates/runner/src/render/backlightMaterial.ts +4 -4
- package/templates/runner/src/render/clouds.ts +16 -1
- package/templates/runner/src/render/materialLighting.ts +5 -5
- package/templates/runner/src/render/materials.ts +3 -2
- package/templates/runner/src/render/quality.ts +7 -32
- package/templates/runner/src/render/touch-controls.ts +7 -6
- package/templates/runner/src/scenes/Run.ts +8 -10
- package/templates/runner/src/style.css +4 -0
- package/templates/runner/tsconfig.json +1 -1
- package/templates/runner/vite.config.ts +2 -0
- package/templates/sailing/AGENTS.md +7 -2
- package/templates/sailing/CLAUDE.md +7 -2
- package/templates/sailing/package.json +7 -7
- package/templates/sailing/src/game.ts +1 -1
- package/templates/sailing/src/render/backlightControls.ts +10 -0
- package/templates/sailing/src/render/backlightMaterial.ts +4 -4
- package/templates/sailing/src/render/environmentSetup.ts +1 -1
- package/templates/sailing/src/render/materialLighting.ts +5 -5
- package/templates/sailing/src/render/quality.ts +7 -32
- package/templates/sailing/src/render/touch-controls.ts +7 -6
- package/templates/sailing/src/style.css +5 -0
- package/templates/sailing/vite.config.ts +6 -0
- package/templates/shooter/AGENTS.md +6 -2
- package/templates/shooter/CLAUDE.md +6 -2
- package/templates/shooter/package.json +7 -7
- package/templates/shooter/src/game.ts +3 -2
- package/templates/shooter/src/render/atmosphere.ts +6 -0
- package/templates/shooter/src/render/backlightControls.ts +10 -0
- package/templates/shooter/src/render/backlightMaterial.ts +4 -4
- package/templates/shooter/src/render/clouds.ts +16 -1
- package/templates/shooter/src/render/materialLighting.ts +5 -5
- package/templates/shooter/src/render/quality.ts +7 -32
- package/templates/shooter/src/scenes/Play.ts +4 -1
- package/templates/shooter/src/style.css +4 -0
- package/templates/shooter/vite.config.ts +2 -0
- package/templates/snow/AGENTS.md +7 -2
- package/templates/snow/CLAUDE.md +7 -2
- package/templates/snow/package.json +7 -7
- package/templates/snow/src/entities/Explorer.ts +6 -12
- package/templates/snow/src/game.ts +1 -1
- package/templates/snow/src/render/backlightControls.ts +10 -0
- package/templates/snow/src/render/backlightMaterial.ts +4 -4
- package/templates/snow/src/render/bootPrint.ts +3 -1
- package/templates/snow/src/render/camera.ts +3 -2
- package/templates/snow/src/render/materialLighting.ts +5 -5
- package/templates/snow/src/render/quality.ts +7 -32
- package/templates/snow/src/render/scenery.ts +3 -3
- package/templates/snow/src/render/touch-controls.ts +7 -6
- package/templates/snow/src/render/weather.ts +3 -5
- package/templates/snow/src/style.css +5 -0
- package/templates/snow/src/terrain.ts +2 -1
- package/templates/snow/vite.config.ts +6 -0
- package/templates/starter/AGENTS.md +8 -3
- package/templates/starter/CLAUDE.md +8 -3
- package/templates/starter/native-playtests/render-chain.playtest.json +9 -9
- package/templates/starter/package.json +7 -7
- package/templates/starter/src/entities/Crate.ts +5 -2
- package/templates/starter/src/entities/Player.ts +10 -2
- package/templates/starter/src/game.ts +4 -3
- package/templates/starter/src/render/adaptiveQuality.ts +17 -0
- package/templates/starter/src/render/atmosphere.ts +6 -0
- package/templates/starter/src/render/backlightControls.ts +10 -0
- package/templates/starter/src/render/backlightMaterial.ts +4 -4
- package/templates/starter/src/render/camera.ts +2 -2
- package/templates/starter/src/render/clouds.ts +16 -1
- package/templates/starter/src/render/contactShadow.ts +1 -1
- package/templates/starter/src/render/materialLighting.ts +5 -5
- package/templates/starter/src/render/materials.ts +3 -2
- package/templates/starter/src/render/postprocessing.ts +11 -10
- package/templates/starter/src/render/quality.ts +14 -1
- package/templates/starter/src/render/touch-controls.ts +7 -6
- package/templates/starter/src/scenes/Play.ts +13 -17
- package/templates/starter/src/state.ts +2 -0
- package/templates/starter/src/style.css +4 -0
- package/templates/starter/src/ui/Menu.tsx +5 -1
- package/templates/starter/vite.config.ts +2 -0
- package/templates/tower-defense/AGENTS.md +7 -2
- package/templates/tower-defense/CLAUDE.md +7 -2
- package/templates/tower-defense/package.json +7 -7
- package/templates/tower-defense/src/game.ts +1 -1
- package/templates/tower-defense/src/render/backlightControls.ts +10 -0
- package/templates/tower-defense/src/render/backlightMaterial.ts +4 -4
- package/templates/tower-defense/src/render/materialLighting.ts +5 -5
- package/templates/tower-defense/src/render/quality.ts +7 -32
- package/templates/tower-defense/src/render/shapes.ts +1 -2
- package/templates/tower-defense/src/scenes/Battle.ts +4 -9
- package/templates/tower-defense/src/style.css +4 -0
- package/templates/tower-defense/tsconfig.json +1 -1
- package/templates/tower-defense/vite.config.ts +2 -0
- package/templates/action-rpg/src/render/environmentContribution.ts +0 -188
- package/templates/action-rpg/src/render/environmentRadiance.ts +0 -36
- package/templates/action-rpg/src/render/environmentSampleCache.ts +0 -43
- package/templates/action-rpg/src/render/environmentSampling.ts +0 -193
- package/templates/action-rpg/src/render/environmentSnapshot.ts +0 -53
- package/templates/minimal/src/render/environmentContribution.ts +0 -188
- package/templates/minimal/src/render/environmentRadiance.ts +0 -36
- package/templates/minimal/src/render/environmentSampleCache.ts +0 -43
- package/templates/minimal/src/render/environmentSampling.ts +0 -193
- package/templates/minimal/src/render/environmentSnapshot.ts +0 -53
- package/templates/platformer/src/render/environmentContribution.ts +0 -188
- package/templates/platformer/src/render/environmentRadiance.ts +0 -36
- package/templates/platformer/src/render/environmentSampleCache.ts +0 -43
- package/templates/platformer/src/render/environmentSampling.ts +0 -193
- package/templates/platformer/src/render/environmentSnapshot.ts +0 -53
- package/templates/puzzle/src/render/environmentContribution.ts +0 -188
- package/templates/puzzle/src/render/environmentRadiance.ts +0 -36
- package/templates/puzzle/src/render/environmentSampleCache.ts +0 -43
- package/templates/puzzle/src/render/environmentSampling.ts +0 -193
- package/templates/puzzle/src/render/environmentSnapshot.ts +0 -53
- package/templates/racing/src/render/environmentContribution.ts +0 -188
- package/templates/racing/src/render/environmentRadiance.ts +0 -36
- package/templates/racing/src/render/environmentSampleCache.ts +0 -43
- package/templates/racing/src/render/environmentSampling.ts +0 -193
- package/templates/racing/src/render/environmentSnapshot.ts +0 -53
- package/templates/racing/src/ui/Menu.tsx +0 -7
- package/templates/rts/src/render/environmentContribution.ts +0 -188
- package/templates/rts/src/render/environmentRadiance.ts +0 -36
- package/templates/rts/src/render/environmentSampleCache.ts +0 -43
- package/templates/rts/src/render/environmentSampling.ts +0 -193
- package/templates/rts/src/render/environmentSnapshot.ts +0 -53
- package/templates/runner/src/render/environmentContribution.ts +0 -188
- package/templates/runner/src/render/environmentRadiance.ts +0 -36
- package/templates/runner/src/render/environmentSampleCache.ts +0 -43
- package/templates/runner/src/render/environmentSampling.ts +0 -193
- package/templates/runner/src/render/environmentSnapshot.ts +0 -53
- package/templates/sailing/src/render/environmentContribution.ts +0 -188
- package/templates/sailing/src/render/environmentRadiance.ts +0 -36
- package/templates/sailing/src/render/environmentSampleCache.ts +0 -43
- package/templates/sailing/src/render/environmentSampling.ts +0 -193
- package/templates/sailing/src/render/environmentSnapshot.ts +0 -53
- package/templates/shooter/src/render/environmentContribution.ts +0 -188
- package/templates/shooter/src/render/environmentRadiance.ts +0 -36
- package/templates/shooter/src/render/environmentSampleCache.ts +0 -43
- package/templates/shooter/src/render/environmentSampling.ts +0 -193
- package/templates/shooter/src/render/environmentSnapshot.ts +0 -53
- package/templates/snow/src/render/environmentContribution.ts +0 -188
- package/templates/snow/src/render/environmentRadiance.ts +0 -36
- package/templates/snow/src/render/environmentSampleCache.ts +0 -43
- package/templates/snow/src/render/environmentSampling.ts +0 -193
- package/templates/snow/src/render/environmentSnapshot.ts +0 -53
- package/templates/starter/src/render/environmentContribution.ts +0 -188
- package/templates/starter/src/render/environmentRadiance.ts +0 -36
- package/templates/starter/src/render/environmentSampleCache.ts +0 -43
- package/templates/starter/src/render/environmentSampling.ts +0 -193
- package/templates/starter/src/render/environmentSnapshot.ts +0 -53
- package/templates/starter/src/render/rendererGate.ts +0 -36
- package/templates/tower-defense/src/render/environmentContribution.ts +0 -188
- package/templates/tower-defense/src/render/environmentRadiance.ts +0 -36
- package/templates/tower-defense/src/render/environmentSampleCache.ts +0 -43
- package/templates/tower-defense/src/render/environmentSampling.ts +0 -193
- package/templates/tower-defense/src/render/environmentSnapshot.ts +0 -53
package/dist/quality.d.ts
CHANGED
|
@@ -3,10 +3,14 @@ import { Linter } from 'eslint';
|
|
|
3
3
|
interface IQualityOptions {
|
|
4
4
|
/** The project root: where `tsconfig.json` lives and the typed rules resolve from. */
|
|
5
5
|
readonly root: string;
|
|
6
|
+
/** The reinvention rows (`reinventions.ts`). A scaffolded config turns them on; a game made
|
|
7
|
+
* before they existed passes only `root`, and an upgrade never rewrites that file, so its own
|
|
8
|
+
* code keeps the rules it was made with. */
|
|
9
|
+
readonly reinventions?: boolean;
|
|
6
10
|
}
|
|
7
11
|
/** The default correctness gate for a generated game: TypeScript-aware async rules, React hook
|
|
8
12
|
* rules when React is installed, scoped suppressions, and the ThreeNative game rules (`threenative/*`: frame-callback cost, UI state use).
|
|
9
13
|
* Formatting is Biome's job, not this config's. */
|
|
10
|
-
declare function qualityConfig({ root }: IQualityOptions): Linter.Config[];
|
|
14
|
+
declare function qualityConfig({ root, reinventions }: IQualityOptions): Linter.Config[];
|
|
11
15
|
|
|
12
16
|
export { type IQualityOptions, qualityConfig };
|
package/dist/quality.js
CHANGED
|
@@ -166368,6 +166368,7 @@ var import_parser = __toESM(require_dist9());
|
|
|
166368
166368
|
|
|
166369
166369
|
// src/quality/hotCallbacks.ts
|
|
166370
166370
|
var FRAME_METHODS = /* @__PURE__ */ new Set(["render", "update"]);
|
|
166371
|
+
var ENTITY_FRAME_METHODS = /* @__PURE__ */ new Set(["fixedUpdate", "step", "tick", "update"]);
|
|
166371
166372
|
var FRAME_HOOKS = /* @__PURE__ */ new Map([
|
|
166372
166373
|
["afterPhysics", "ctx.afterPhysics"],
|
|
166373
166374
|
["beforeRender", "ctx.beforeRender"],
|
|
@@ -166402,16 +166403,25 @@ function hookName(parent, node) {
|
|
|
166402
166403
|
const name = calleeMember(parent, node);
|
|
166403
166404
|
return name === void 0 ? void 0 : FRAME_HOOKS.get(name);
|
|
166404
166405
|
}
|
|
166406
|
+
function methodLabel(parent, sceneLocals) {
|
|
166407
|
+
if (parent.type !== "MethodDefinition" || parent.static || parent.key.type !== "Identifier")
|
|
166408
|
+
return void 0;
|
|
166409
|
+
const owner = parent.parent?.parent ?? void 0;
|
|
166410
|
+
const base = owner?.superClass;
|
|
166411
|
+
const isSceneBase = base?.type === "Identifier" && sceneLocals.has(base.name);
|
|
166412
|
+
if (isSceneBase)
|
|
166413
|
+
return FRAME_METHODS.has(parent.key.name) ? `Scene.${parent.key.name}` : void 0;
|
|
166414
|
+
if (!ENTITY_FRAME_METHODS.has(parent.key.name)) return void 0;
|
|
166415
|
+
const className2 = owner?.id?.name;
|
|
166416
|
+
return className2 === void 0 ? parent.key.name : `${className2}.${parent.key.name}`;
|
|
166417
|
+
}
|
|
166405
166418
|
function trackHotCallbacks() {
|
|
166406
166419
|
const sceneLocals = /* @__PURE__ */ new Set();
|
|
166407
166420
|
const frames = [];
|
|
166408
166421
|
const frameName = (node) => {
|
|
166409
166422
|
const parent = node.parent;
|
|
166410
|
-
|
|
166411
|
-
|
|
166412
|
-
const isSceneBase = base?.type === "Identifier" && sceneLocals.has(base.name);
|
|
166413
|
-
if (isSceneBase && FRAME_METHODS.has(parent.key.name)) return `Scene.${parent.key.name}`;
|
|
166414
|
-
}
|
|
166423
|
+
const method = methodLabel(parent, sceneLocals);
|
|
166424
|
+
if (method !== void 0) return method;
|
|
166415
166425
|
const hook = hookName(parent, node);
|
|
166416
166426
|
if (hook !== void 0) return hook;
|
|
166417
166427
|
const member = calleeMember(parent, node);
|
|
@@ -166634,6 +166644,64 @@ var threenativePlugin = {
|
|
|
166634
166644
|
}
|
|
166635
166645
|
};
|
|
166636
166646
|
|
|
166647
|
+
// src/quality/reinventions.ts
|
|
166648
|
+
var PRNG_OUTSIDE = ["src/audio.ts", "src/audio/**", "src/render/**", "src/ui/**"];
|
|
166649
|
+
var REINVENTIONS = [
|
|
166650
|
+
{
|
|
166651
|
+
selector: ':matches(CallExpression[callee.object.name="Math"][callee.property.name="random"], Literal[value=1664525], Literal[value=1013904223], Literal[value=1831565813])',
|
|
166652
|
+
capability: "createRandom",
|
|
166653
|
+
source: "core",
|
|
166654
|
+
outside: PRNG_OUTSIDE,
|
|
166655
|
+
message: "A hand-written PRNG (Math.random or the LCG constants) is a capability the engine ships: use `createRandom(seed)` from `@threenative/core`, or `ctx.random`, so the same seed replays the same game."
|
|
166656
|
+
},
|
|
166657
|
+
{
|
|
166658
|
+
selector: 'BinaryExpression[operator="-"][left.value=1][right.callee.object.name="Math"][right.callee.property.name="exp"]',
|
|
166659
|
+
capability: "MathUtils.damp",
|
|
166660
|
+
source: "three",
|
|
166661
|
+
message: "`1 - Math.exp(-\u2026)` is a damp factor the engine ships: use `MathUtils.damp(current, target, rate, dt)` from `three`, which is the same curve with the rate named."
|
|
166662
|
+
},
|
|
166663
|
+
{
|
|
166664
|
+
selector: ':matches(MemberExpression[object.name="location"][property.name="search"], MemberExpression[object.property.name="location"][property.name="search"])',
|
|
166665
|
+
capability: "debugFlag",
|
|
166666
|
+
source: "core",
|
|
166667
|
+
message: "Reading `location.search` by hand is a launch seam the engine owns: use `debugFlag(name)` or `debugValue(name)` from `@threenative/core` (`?name` on web, `TN_DEBUG_NAME` on native)."
|
|
166668
|
+
},
|
|
166669
|
+
{
|
|
166670
|
+
selector: 'AssignmentExpression[left.property.name="matrixWorldAutoUpdate"][right.value=false]',
|
|
166671
|
+
capability: "renderer.matrixWorld",
|
|
166672
|
+
source: "core",
|
|
166673
|
+
message: "Turning `matrixWorldAutoUpdate` off by hand is the engine's own walk: set `renderer.matrixWorld` in the game config for a whole scene, or `markStatic(node)` for one node that never moves."
|
|
166674
|
+
},
|
|
166675
|
+
{
|
|
166676
|
+
selector: 'BinaryExpression[operator="-"][left.type="ConditionalExpression"][left.consequent.value=1][left.alternate.value=0][right.type="ConditionalExpression"][right.consequent.value=1][right.alternate.value=0]',
|
|
166677
|
+
capability: "InputMap.axis",
|
|
166678
|
+
source: "core",
|
|
166679
|
+
message: "An axis built from raw keys is a binding the engine already reads: declare it in `defineGame({ input })` and use `ctx.input.axis(name)` from `@threenative/core`."
|
|
166680
|
+
},
|
|
166681
|
+
{
|
|
166682
|
+
selector: 'BinaryExpression[operator="*"][right.type="BinaryExpression"][right.operator="-"][right.left.value=3][right.right.type="BinaryExpression"][right.right.operator="*"][right.right.left.value=2]',
|
|
166683
|
+
capability: "MathUtils.smoothstep",
|
|
166684
|
+
source: "three",
|
|
166685
|
+
message: "`x * x * (3 - 2 * x)` is the engine's smoothstep: use `MathUtils.smoothstep(x, 0, 1)` from `three`, which clamps the same way."
|
|
166686
|
+
}
|
|
166687
|
+
];
|
|
166688
|
+
function reinventionRules(rows) {
|
|
166689
|
+
return {
|
|
166690
|
+
"no-restricted-syntax": [
|
|
166691
|
+
"error",
|
|
166692
|
+
...rows.map(({ selector, message }) => ({ selector, message }))
|
|
166693
|
+
]
|
|
166694
|
+
};
|
|
166695
|
+
}
|
|
166696
|
+
function reinventionConfigs(files) {
|
|
166697
|
+
const always = REINVENTIONS.filter((row) => row.outside === void 0);
|
|
166698
|
+
const ignores = [...new Set(REINVENTIONS.flatMap((row) => row.outside ?? []))];
|
|
166699
|
+
return [
|
|
166700
|
+
{ files: [...files], rules: reinventionRules(always) },
|
|
166701
|
+
{ files: [...files], ignores, rules: reinventionRules(REINVENTIONS) }
|
|
166702
|
+
];
|
|
166703
|
+
}
|
|
166704
|
+
|
|
166637
166705
|
// src/quality/index.ts
|
|
166638
166706
|
var asPlugin = (plugin) => plugin;
|
|
166639
166707
|
var SOURCE = ["src/**/*.ts", "src/**/*.tsx"];
|
|
@@ -166641,7 +166709,7 @@ function hasReact(root) {
|
|
|
166641
166709
|
const manifest = JSON.parse(readFileSync(path.join(root, "package.json"), "utf8"));
|
|
166642
166710
|
return ["dependencies", "devDependencies"].some((field) => manifest[field]?.react !== void 0);
|
|
166643
166711
|
}
|
|
166644
|
-
function qualityConfig({ root }) {
|
|
166712
|
+
function qualityConfig({ root, reinventions = false }) {
|
|
166645
166713
|
const config = [
|
|
166646
166714
|
{ ignores: ["**/node_modules/**", "**/dist/**", "**/.threenative/**", "**/dist-native/**"] },
|
|
166647
166715
|
{
|
|
@@ -166675,6 +166743,7 @@ function qualityConfig({ root }) {
|
|
|
166675
166743
|
}
|
|
166676
166744
|
}
|
|
166677
166745
|
];
|
|
166746
|
+
if (reinventions) config.push(...reinventionConfigs(SOURCE));
|
|
166678
166747
|
if (hasReact(root)) {
|
|
166679
166748
|
config.push({
|
|
166680
166749
|
files: ["src/**/*.tsx"],
|
package/dist/terrain-kit.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
|
|
6
6
|
createRequire(import.meta.url);
|
|
7
|
-
var KITS = ["alpine", "coastal", "desert", "
|
|
7
|
+
var KITS = ["alpine", "coastal", "desert", "tundra"];
|
|
8
8
|
var COPIED = [
|
|
9
9
|
"assets.json",
|
|
10
10
|
"bake.mjs",
|
package/dist/threenative.js
CHANGED
|
@@ -13,6 +13,7 @@ import { compileAssets, parsePng, parseAudioConfig } from '@threenative/assets';
|
|
|
13
13
|
import { read, VK_FORMAT_ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK, KHR_SUPERCOMPRESSION_NONE, KHR_DF_MODEL_ASTC, KHR_DF_TRANSFER_SRGB, KHR_DF_TRANSFER_LINEAR } from 'ktx-parse';
|
|
14
14
|
import { brotliCompressSync, constants as constants$1, gzipSync } from 'zlib';
|
|
15
15
|
import { platform, homedir } from 'os';
|
|
16
|
+
import { fixAuthoringLayer, authoringLayerStatus } from './index.js';
|
|
16
17
|
|
|
17
18
|
createRequire(import.meta.url);
|
|
18
19
|
var BUILD_REPORT_SUFFIX = ".build-report.json";
|
|
@@ -184,6 +185,13 @@ function positiveInteger(value, fallback, code, label) {
|
|
|
184
185
|
}
|
|
185
186
|
return value;
|
|
186
187
|
}
|
|
188
|
+
function priorityValue(value) {
|
|
189
|
+
if (value === void 0) return "game";
|
|
190
|
+
if (value !== "game" && value !== "normal") {
|
|
191
|
+
fail("TN_CONFIG_PRIORITY_INVALID", 'display.priority must be "game" or "normal".');
|
|
192
|
+
}
|
|
193
|
+
return value;
|
|
194
|
+
}
|
|
187
195
|
function maxFpsValue(value) {
|
|
188
196
|
if (value === void 0) return 60;
|
|
189
197
|
if (!Number.isSafeInteger(value) || value < 0 || value > 1e3) {
|
|
@@ -285,6 +293,10 @@ function resolveEsbuild(cwd) {
|
|
|
285
293
|
}
|
|
286
294
|
}
|
|
287
295
|
}
|
|
296
|
+
var configLoadSequence = 0;
|
|
297
|
+
function configTempName(cwd, pid, now, sequence) {
|
|
298
|
+
return path5.join(cwd, `.threenative.config.${pid}.${now}.${sequence}.mjs`);
|
|
299
|
+
}
|
|
288
300
|
async function importConfig(cwd) {
|
|
289
301
|
const sourcePath = path5.join(cwd, CONFIG_FILE);
|
|
290
302
|
try {
|
|
@@ -347,7 +359,8 @@ async function importConfig(cwd) {
|
|
|
347
359
|
error instanceof Error ? error.message : String(error)
|
|
348
360
|
);
|
|
349
361
|
}
|
|
350
|
-
|
|
362
|
+
configLoadSequence += 1;
|
|
363
|
+
const compiledPath = configTempName(cwd, process.pid, Date.now(), configLoadSequence);
|
|
351
364
|
try {
|
|
352
365
|
await writeFile(compiledPath, code, "utf8");
|
|
353
366
|
} catch (error) {
|
|
@@ -622,7 +635,13 @@ async function validateIconVariants(raw, cwd) {
|
|
|
622
635
|
}
|
|
623
636
|
function validateDisplay(raw) {
|
|
624
637
|
const display = assertRecord(raw, "display");
|
|
625
|
-
assertKeys(display, "display", [
|
|
638
|
+
assertKeys(display, "display", [
|
|
639
|
+
"orientation",
|
|
640
|
+
"fullscreen",
|
|
641
|
+
"keepScreenOn",
|
|
642
|
+
"priority",
|
|
643
|
+
"maxFps"
|
|
644
|
+
]);
|
|
626
645
|
const orientation = display.orientation === void 0 ? "landscape" : display.orientation;
|
|
627
646
|
if (typeof orientation !== "string" || !ORIENTATIONS.includes(orientation)) {
|
|
628
647
|
fail(
|
|
@@ -644,6 +663,7 @@ function validateDisplay(raw) {
|
|
|
644
663
|
"TN_CONFIG_KEEP_SCREEN_ON_INVALID",
|
|
645
664
|
"display.keepScreenOn"
|
|
646
665
|
),
|
|
666
|
+
priority: priorityValue(display.priority),
|
|
647
667
|
maxFps: maxFpsValue(display.maxFps)
|
|
648
668
|
};
|
|
649
669
|
}
|
|
@@ -1713,8 +1733,8 @@ function describeNativeCssFindings(findings) {
|
|
|
1713
1733
|
(f) => ` ${f.file}:${f.line}:${f.column}${f.authored === void 0 ? "" : ` authored ${f.authored}`} ${f.what} \u2014 ${f.why}`
|
|
1714
1734
|
).join("\n");
|
|
1715
1735
|
}
|
|
1716
|
-
function webRuntimeDecoders(
|
|
1717
|
-
return
|
|
1736
|
+
function webRuntimeDecoders(_config) {
|
|
1737
|
+
return { ktx2: true, meshopt: true };
|
|
1718
1738
|
}
|
|
1719
1739
|
|
|
1720
1740
|
// src/build.ts
|
|
@@ -2371,7 +2391,7 @@ async function buildWeb(cwd, viteArgs = [], profile) {
|
|
|
2371
2391
|
config: config.assets,
|
|
2372
2392
|
cwd,
|
|
2373
2393
|
platform: "web",
|
|
2374
|
-
runtimeDecoders: webRuntimeDecoders(
|
|
2394
|
+
runtimeDecoders: webRuntimeDecoders(),
|
|
2375
2395
|
...config.engine !== "threejs" && { runtimeIdentity: "web:native-engine" }
|
|
2376
2396
|
});
|
|
2377
2397
|
const assets = assetRoot(cwd, config);
|
|
@@ -2686,6 +2706,10 @@ async function buildEngineDesktop(cwd, config, entry) {
|
|
|
2686
2706
|
String(config.window.height),
|
|
2687
2707
|
"--title",
|
|
2688
2708
|
config.window.title,
|
|
2709
|
+
"--priority",
|
|
2710
|
+
config.display.priority,
|
|
2711
|
+
"--fullscreen",
|
|
2712
|
+
String(config.display.fullscreen),
|
|
2689
2713
|
"--output",
|
|
2690
2714
|
output
|
|
2691
2715
|
]);
|
|
@@ -3245,11 +3269,11 @@ var MCP_SERVERS = Object.freeze({
|
|
|
3245
3269
|
})
|
|
3246
3270
|
});
|
|
3247
3271
|
var MCP_PACKAGES = Object.freeze({
|
|
3248
|
-
assets: Object.freeze({ name: "threenative-asset-mcp", version: "0.
|
|
3249
|
-
terrain: Object.freeze({ name: "@threenative/terrain", version: "0.1.
|
|
3272
|
+
assets: Object.freeze({ name: "threenative-asset-mcp", version: "0.16.0" }),
|
|
3273
|
+
terrain: Object.freeze({ name: "@threenative/terrain", version: "0.1.11" }),
|
|
3250
3274
|
sculpt: Object.freeze({ name: "threenative-sculpt-mcp", version: "0.2.2" }),
|
|
3251
|
-
engine: Object.freeze({ name: "threenative-engine-mcp", version: "0.2.
|
|
3252
|
-
animation: Object.freeze({ name: "threenative-animation-mcp", version: "0.1.
|
|
3275
|
+
engine: Object.freeze({ name: "threenative-engine-mcp", version: "0.2.15" }),
|
|
3276
|
+
animation: Object.freeze({ name: "threenative-animation-mcp", version: "0.1.12" }),
|
|
3253
3277
|
// `args` fixes the launch for every host. The Chrome flags are `WEBGPU_BROWSER_ARGS` from
|
|
3254
3278
|
// `@threenative/playtest`, so a DevTools trace profiles the same adapter a playtest does and not
|
|
3255
3279
|
// SwiftShader. An isolated profile keeps the user's own Chrome profile out, and the two opt-outs
|
|
@@ -3362,7 +3386,12 @@ var MCP_HOSTS = Object.freeze([
|
|
|
3362
3386
|
Object.freeze({ id: "zed", label: "Zed", file: ".zed/settings.json", format: "zed" })
|
|
3363
3387
|
]);
|
|
3364
3388
|
|
|
3389
|
+
// ../core/src/version.ts
|
|
3390
|
+
var CORE_VERSION = "0.3.15";
|
|
3391
|
+
|
|
3365
3392
|
// src/mcp-servers.ts
|
|
3393
|
+
var CORE_PACKAGE_NAME = "@threenative/core";
|
|
3394
|
+
var CORE_PACKAGE_VERSION = CORE_VERSION;
|
|
3366
3395
|
function serverEntryPath(server) {
|
|
3367
3396
|
const entry = server.args[0];
|
|
3368
3397
|
if (entry === void 0) {
|
|
@@ -3408,8 +3437,6 @@ function requiredAndroidSdkFromRoot(root) {
|
|
|
3408
3437
|
return DEFAULT_ANDROID_COMPILE_SDK;
|
|
3409
3438
|
}
|
|
3410
3439
|
}
|
|
3411
|
-
var CORE_PACKAGE_NAME = "@threenative/core";
|
|
3412
|
-
var CORE_PACKAGE_VERSION = "0.3.12";
|
|
3413
3440
|
var CORE_RESOLVED_SERVERS = /* @__PURE__ */ new Set([
|
|
3414
3441
|
"threenative-engine",
|
|
3415
3442
|
"threenative-animation"
|
|
@@ -3735,7 +3762,7 @@ function probeMcpServer(projectRoot, spec) {
|
|
|
3735
3762
|
method: "initialize",
|
|
3736
3763
|
params: {
|
|
3737
3764
|
capabilities: {},
|
|
3738
|
-
clientInfo: { name: "threenative-doctor", version:
|
|
3765
|
+
clientInfo: { name: "threenative-doctor", version: CORE_PACKAGE_VERSION },
|
|
3739
3766
|
protocolVersion: "2025-06-18"
|
|
3740
3767
|
}
|
|
3741
3768
|
});
|
|
@@ -4744,6 +4771,7 @@ function diagnoseProject(snapshot, options = {}) {
|
|
|
4744
4771
|
},
|
|
4745
4772
|
sceneShapeCheck(snapshot),
|
|
4746
4773
|
...capabilitySearchChecks(snapshot),
|
|
4774
|
+
...snapshot.authoringLayer === void 0 ? [] : [authoringLayerCheck(snapshot.authoringLayer)],
|
|
4747
4775
|
editorActivationCheck(snapshot),
|
|
4748
4776
|
...blender === void 0 ? [] : [blender]
|
|
4749
4777
|
];
|
|
@@ -4753,6 +4781,22 @@ function diagnoseProject(snapshot, options = {}) {
|
|
|
4753
4781
|
});
|
|
4754
4782
|
return { checks: scoped, pass: scoped.every(({ status }) => status !== "fail") };
|
|
4755
4783
|
}
|
|
4784
|
+
var AUTHORING_LAYER_FIX = "After 'pnpm up --latest create-threenative', run 'pnpm exec threenative doctor --fix'; add --force to overwrite files this game edited.";
|
|
4785
|
+
function authoringLayerCheck(layer) {
|
|
4786
|
+
const name = "authoring layer";
|
|
4787
|
+
if (layer.problem !== void 0)
|
|
4788
|
+
return { detail: layer.problem, fix: AUTHORING_LAYER_FIX, name, status: "warn" };
|
|
4789
|
+
const where = `installed create-threenative ${layer.installed} (${layer.kit} kit)`;
|
|
4790
|
+
if (layer.stamped === layer.installed && layer.stale.length === 0)
|
|
4791
|
+
return { detail: `stamp matches ${where}`, name, status: "ok" };
|
|
4792
|
+
const count = `${layer.stale.length} stale file${layer.stale.length === 1 ? "" : "s"}`;
|
|
4793
|
+
return {
|
|
4794
|
+
detail: `stamp ${layer.stamped ?? "absent"}, ${where}: ${count}`,
|
|
4795
|
+
fix: AUTHORING_LAYER_FIX,
|
|
4796
|
+
name,
|
|
4797
|
+
status: "warn"
|
|
4798
|
+
};
|
|
4799
|
+
}
|
|
4756
4800
|
async function collectFiles(root, relative = "", depth = 0) {
|
|
4757
4801
|
if (depth > 3) return [];
|
|
4758
4802
|
const absolute = path5.join(root, relative);
|
|
@@ -4808,6 +4852,13 @@ async function readProject(root) {
|
|
|
4808
4852
|
const runtimeVersion = installedVersions.get(RUNTIME_PACKAGE);
|
|
4809
4853
|
const runtimeManifestUrl = runtimeRoot === void 0 || runtimeVersion === void 0 ? void 0 : await runtimeReleaseManifestUrl(runtimeRoot, runtimeVersion);
|
|
4810
4854
|
const playtestRunnerPath = resolveBinaryFrom(projectRoot, PLAYTEST_BINARY);
|
|
4855
|
+
const authoringLayer = await authoringLayerStatus(projectRoot).catch(
|
|
4856
|
+
(error) => ({
|
|
4857
|
+
installed: "unknown",
|
|
4858
|
+
problem: error instanceof Error ? error.message : String(error),
|
|
4859
|
+
stale: []
|
|
4860
|
+
})
|
|
4861
|
+
);
|
|
4811
4862
|
const mcpServerHealth = /* @__PURE__ */ new Map();
|
|
4812
4863
|
if (SHAPE_VERIFIABLE_HOSTS.some(({ file }) => files.has(file))) {
|
|
4813
4864
|
for (const spec of MCP_SERVER_SPECS) {
|
|
@@ -4819,6 +4870,7 @@ async function readProject(root) {
|
|
|
4819
4870
|
}
|
|
4820
4871
|
}
|
|
4821
4872
|
return {
|
|
4873
|
+
authoringLayer,
|
|
4822
4874
|
config,
|
|
4823
4875
|
files,
|
|
4824
4876
|
installedVersions,
|
|
@@ -4876,7 +4928,7 @@ async function readTypeScriptConfig(root) {
|
|
|
4876
4928
|
function formatDoctorReport(report) {
|
|
4877
4929
|
const symbols = { fail: "\u2717", ok: "\u2713", warn: "!" };
|
|
4878
4930
|
const isBaseline = (name) => ["package.json", "dependencies", "versions"].includes(name);
|
|
4879
|
-
const isCraft = (name) => name.startsWith("capability search");
|
|
4931
|
+
const isCraft = (name) => name.startsWith("capability search") || name === "authoring layer";
|
|
4880
4932
|
const isTest = (name) => name === "playtest" || name === "playtests";
|
|
4881
4933
|
const groups = [
|
|
4882
4934
|
["Baseline", isBaseline],
|
|
@@ -4900,8 +4952,6 @@ function formatDoctorReport(report) {
|
|
|
4900
4952
|
return `${lines.join("\n")}
|
|
4901
4953
|
`;
|
|
4902
4954
|
}
|
|
4903
|
-
|
|
4904
|
-
// src/threenative.ts
|
|
4905
4955
|
var DOCTOR_TARGETS = ["web", "desktop", "android", "ios"];
|
|
4906
4956
|
var DOCTOR_MODES = ["debug", "release"];
|
|
4907
4957
|
function cliHelp(command) {
|
|
@@ -4909,7 +4959,7 @@ function cliHelp(command) {
|
|
|
4909
4959
|
if (command === "doctor") {
|
|
4910
4960
|
return `${[
|
|
4911
4961
|
"Usage: threenative doctor [--target web|desktop|android|ios] [--mode debug|release]",
|
|
4912
|
-
" [--text] [--capture <path>]",
|
|
4962
|
+
" [--text] [--capture <path>] [--fix [--force]]",
|
|
4913
4963
|
"",
|
|
4914
4964
|
"Checks this project against what the build and the native host assume about it:",
|
|
4915
4965
|
"installed and version-matched @threenative packages, a portable entry that",
|
|
@@ -4926,6 +4976,11 @@ function cliHelp(command) {
|
|
|
4926
4976
|
" need once PRD-212 ships it, so a green report here is a forecast, not a release.",
|
|
4927
4977
|
"Prints JSON by default; --text prints the same report for a person.",
|
|
4928
4978
|
"--capture forwards a browser census JSON or native TN_PIPELINE_EVENT log to the playtest doctor.",
|
|
4979
|
+
"--fix rewrites this game's authoring layer (AGENTS.md, CLAUDE.md, skills, hooks, MCP configs)",
|
|
4980
|
+
" from the installed create-threenative, then checks again. To update an existing game:",
|
|
4981
|
+
" 'pnpm up --latest create-threenative @threenative/*', then 'pnpm exec threenative doctor --fix'.",
|
|
4982
|
+
" A file this game edited is kept and listed, and the run exits 1 (TN_AUTHORING_LAYER_EDITED);",
|
|
4983
|
+
" --force overwrites it. Git is the undo. .threenative/agent-files.json records what was written.",
|
|
4929
4984
|
"Exits 0 when nothing failed, 1 when a check failed."
|
|
4930
4985
|
].join("\n")}
|
|
4931
4986
|
`;
|
|
@@ -4950,6 +5005,8 @@ ${cliHelp()}`);
|
|
|
4950
5005
|
}
|
|
4951
5006
|
async function runDoctorCommand(argv, cwd = process.cwd()) {
|
|
4952
5007
|
let capturePath;
|
|
5008
|
+
let fix = false;
|
|
5009
|
+
let force = false;
|
|
4953
5010
|
let mode;
|
|
4954
5011
|
let target;
|
|
4955
5012
|
const valueFor = (flag, value) => {
|
|
@@ -4960,6 +5017,11 @@ async function runDoctorCommand(argv, cwd = process.cwd()) {
|
|
|
4960
5017
|
for (let index = 0; index < argv.length; index += 1) {
|
|
4961
5018
|
const flag = argv[index];
|
|
4962
5019
|
if (flag === "--text") continue;
|
|
5020
|
+
if (flag === "--fix" || flag === "--force") {
|
|
5021
|
+
if (flag === "--fix") fix = true;
|
|
5022
|
+
else force = true;
|
|
5023
|
+
continue;
|
|
5024
|
+
}
|
|
4963
5025
|
if (flag === "--capture") {
|
|
4964
5026
|
capturePath = valueFor(flag, argv[index + 1]);
|
|
4965
5027
|
index += 1;
|
|
@@ -4985,12 +5047,31 @@ async function runDoctorCommand(argv, cwd = process.cwd()) {
|
|
|
4985
5047
|
}
|
|
4986
5048
|
if (mode !== void 0 && target === void 0)
|
|
4987
5049
|
throw new Error("doctor: '--mode' requires '--target'.");
|
|
5050
|
+
if (force && !fix) throw new Error("doctor: '--force' requires '--fix'.");
|
|
5051
|
+
let kept = 0;
|
|
5052
|
+
if (fix) {
|
|
5053
|
+
const result = await fixAuthoringLayer(cwd, { force });
|
|
5054
|
+
const lines = [
|
|
5055
|
+
...result.written.map((file) => `wrote ${file}`),
|
|
5056
|
+
...result.deleted.map((file) => `deleted ${file}`),
|
|
5057
|
+
...result.kept.map((file) => `kept ${file}`)
|
|
5058
|
+
];
|
|
5059
|
+
kept = result.kept.length;
|
|
5060
|
+
if (kept > 0)
|
|
5061
|
+
lines.push(
|
|
5062
|
+
`TN_AUTHORING_LAYER_EDITED: kept ${kept} file${kept === 1 ? "" : "s"} this game edited; rerun with --force to overwrite (git is the undo).`
|
|
5063
|
+
);
|
|
5064
|
+
process.stderr.write(
|
|
5065
|
+
lines.length === 0 ? "authoring layer already current\n" : `${lines.join("\n")}
|
|
5066
|
+
`
|
|
5067
|
+
);
|
|
5068
|
+
}
|
|
4988
5069
|
const report = diagnoseProject(await readProject(cwd), { capturePath, mode, target });
|
|
4989
5070
|
process.stdout.write(
|
|
4990
5071
|
argv.includes("--text") ? formatDoctorReport(report) : `${JSON.stringify(report, null, 2)}
|
|
4991
5072
|
`
|
|
4992
5073
|
);
|
|
4993
|
-
return report.pass ? 0 : 1;
|
|
5074
|
+
return report.pass && kept === 0 ? 0 : 1;
|
|
4994
5075
|
}
|
|
4995
5076
|
async function main(argv = process.argv.slice(2)) {
|
|
4996
5077
|
if (argv.includes("--help") || argv.includes("-h")) {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from 'three';
|
|
2
|
+
|
|
3
|
+
// ../three-native/src/addons/ccd-ik-solver.ts
|
|
4
|
+
var modulo = (n, m) => (n % m + m) % m;
|
|
5
|
+
var CCDIKSolver = class {
|
|
6
|
+
constructor(mesh, iks = []) {
|
|
7
|
+
this.mesh = mesh;
|
|
8
|
+
this.iks = iks;
|
|
9
|
+
this.#initialQuaternions = iks.map((ik) => ik.links.map(() => new Quaternion()));
|
|
10
|
+
this.#valid();
|
|
11
|
+
}
|
|
12
|
+
mesh;
|
|
13
|
+
iks;
|
|
14
|
+
#quaternion = new Quaternion();
|
|
15
|
+
#targetPos = new Vector3();
|
|
16
|
+
#targetVec = new Vector3();
|
|
17
|
+
#effectorPos = new Vector3();
|
|
18
|
+
#effectorVec = new Vector3();
|
|
19
|
+
#linkPos = new Vector3();
|
|
20
|
+
#invLinkQ = new Quaternion();
|
|
21
|
+
#linkScale = new Vector3();
|
|
22
|
+
#axis = new Vector3();
|
|
23
|
+
#vector = new Vector3();
|
|
24
|
+
#center = new Vector3();
|
|
25
|
+
#workingQuaternion = new Quaternion();
|
|
26
|
+
#initialQuaternions;
|
|
27
|
+
update(globalBlendFactor = 1) {
|
|
28
|
+
for (const ik of this.iks) this.updateOne(ik, globalBlendFactor);
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
updateOne(ik, overrideBlend = 1) {
|
|
32
|
+
const chainBlend = ik.blendFactor ?? overrideBlend;
|
|
33
|
+
const bones = this.mesh.skeleton.bones;
|
|
34
|
+
const initialQuaternions = this.#initialQuaternions[this.iks.indexOf(ik)] ?? [];
|
|
35
|
+
const effector = bones[ik.effector];
|
|
36
|
+
const target = bones[ik.target];
|
|
37
|
+
this.#targetPos.setFromMatrixPosition(target.matrixWorld);
|
|
38
|
+
const links = ik.links;
|
|
39
|
+
if (chainBlend < 1)
|
|
40
|
+
for (const [j, link] of links.entries())
|
|
41
|
+
initialQuaternions[j]?.copy(bones[link.index].quaternion);
|
|
42
|
+
for (let i = 0; i < (ik.iteration ?? 1); i++) if (!this.#iterate(ik, bones, effector)) break;
|
|
43
|
+
if (chainBlend < 1) this.#blend(links, bones, initialQuaternions, chainBlend);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
createHelper() {
|
|
47
|
+
throw new Error(
|
|
48
|
+
"TN_NATIVE_UNSUPPORTED_CCDIKHELPER: CCDIKSolver.createHelper needs three's CCDIKHelper, which the engine does not bind; draw the chain from skeleton.bones instead."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
// One pass over the chain; false when no link turned, which ends the solve.
|
|
52
|
+
#iterate(ik, bones, effector) {
|
|
53
|
+
let rotated = false;
|
|
54
|
+
for (const entry of ik.links) {
|
|
55
|
+
if (entry.enabled === false) break;
|
|
56
|
+
if (this.#rotateLink(ik, entry, bones[entry.index], effector)) rotated = true;
|
|
57
|
+
}
|
|
58
|
+
return rotated;
|
|
59
|
+
}
|
|
60
|
+
// A chain blend under 1 slerps each link from its pose before the solve toward the solved pose.
|
|
61
|
+
#blend(links, bones, initial, chainBlend) {
|
|
62
|
+
for (const [j, entry] of links.entries()) {
|
|
63
|
+
const link = bones[entry.index];
|
|
64
|
+
this.#workingQuaternion.copy(initial[j]).slerp(link.quaternion, chainBlend);
|
|
65
|
+
link.quaternion.copy(this.#workingQuaternion);
|
|
66
|
+
link.updateMatrixWorld(true);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// One CCD step on one link: rotate it so the effector points at the target. False when the angle
|
|
70
|
+
// is too small to turn, which three skips to prevent bone vibration.
|
|
71
|
+
#rotateLink(ik, entry, link, effector) {
|
|
72
|
+
link.matrixWorld.decompose(this.#linkPos, this.#invLinkQ, this.#linkScale);
|
|
73
|
+
this.#invLinkQ.invert();
|
|
74
|
+
this.#effectorPos.setFromMatrixPosition(effector.matrixWorld);
|
|
75
|
+
this.#effectorVec.subVectors(this.#effectorPos, this.#linkPos).applyQuaternion(this.#invLinkQ).normalize();
|
|
76
|
+
this.#targetVec.subVectors(this.#targetPos, this.#linkPos).applyQuaternion(this.#invLinkQ).normalize();
|
|
77
|
+
let angle = Math.acos(Math.min(1, Math.max(-1, this.#targetVec.dot(this.#effectorVec))));
|
|
78
|
+
if (angle < 1e-5) return false;
|
|
79
|
+
if (ik.minAngle !== void 0 && angle < ik.minAngle) angle = ik.minAngle;
|
|
80
|
+
if (ik.maxAngle !== void 0 && angle > ik.maxAngle) angle = ik.maxAngle;
|
|
81
|
+
this.#axis.crossVectors(this.#effectorVec, this.#targetVec).normalize();
|
|
82
|
+
this.#quaternion.setFromAxisAngle(this.#axis, angle);
|
|
83
|
+
link.quaternion.multiply(this.#quaternion);
|
|
84
|
+
this.#limit(entry, link);
|
|
85
|
+
link.updateMatrixWorld(true);
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
// three's link limits: a hinge axis, then Euler angle bounds.
|
|
89
|
+
#limit(entry, link) {
|
|
90
|
+
const { limitation, rotationMin, rotationMax } = entry;
|
|
91
|
+
if (limitation !== void 0) {
|
|
92
|
+
const q = link.quaternion;
|
|
93
|
+
const c = Math.min(q.w, 1);
|
|
94
|
+
const dot = q.x * limitation.x + q.y * limitation.y + q.z * limitation.z;
|
|
95
|
+
const c2 = (dot < 0 ? -1 : 1) * Math.sqrt(1 - c * c);
|
|
96
|
+
q.set(limitation.x * c2, limitation.y * c2, limitation.z * c2, c);
|
|
97
|
+
}
|
|
98
|
+
if (rotationMin !== void 0 || rotationMax !== void 0) {
|
|
99
|
+
const v = this.#vector.setFromEuler(link.rotation);
|
|
100
|
+
if (rotationMin !== void 0 && rotationMax !== void 0) {
|
|
101
|
+
const c = this.#center.addVectors(rotationMin, rotationMax).multiplyScalar(0.5);
|
|
102
|
+
v.x = c.x + modulo(v.x - c.x + Math.PI, 2 * Math.PI) - Math.PI;
|
|
103
|
+
v.y = c.y + modulo(v.y - c.y + Math.PI, 2 * Math.PI) - Math.PI;
|
|
104
|
+
v.z = c.z + modulo(v.z - c.z + Math.PI, 2 * Math.PI) - Math.PI;
|
|
105
|
+
}
|
|
106
|
+
if (rotationMin !== void 0) v.max(rotationMin);
|
|
107
|
+
if (rotationMax !== void 0) v.min(rotationMax);
|
|
108
|
+
link.rotation.setFromVector3(v);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
#valid() {
|
|
112
|
+
const bones = this.mesh.skeleton.bones;
|
|
113
|
+
for (const ik of this.iks) {
|
|
114
|
+
let child = bones[ik.effector];
|
|
115
|
+
for (const entry of ik.links) {
|
|
116
|
+
const parent = bones[entry.index];
|
|
117
|
+
if (child.parent !== parent)
|
|
118
|
+
console.warn(
|
|
119
|
+
`THREE.CCDIKSolver: bone ${child.name} is not the child of bone ${parent.name}`
|
|
120
|
+
);
|
|
121
|
+
child = parent;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export { CCDIKSolver };
|