create-threenative 0.2.15 → 0.2.18
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 +10 -0
- package/agent-docs/kit-router.md +14 -0
- package/agent-docs/kit-stuck.md +7 -0
- package/agent-docs/references/assertion-reference.md +54 -110
- package/agent-docs/references/capability-reference.md +1740 -254
- package/agent-docs/references/conventions.md +299 -0
- package/agent-docs/references/kit-action-rpg.md +40 -0
- package/agent-docs/references/kit-adventure.md +40 -0
- package/agent-docs/references/kit-collectathon.md +38 -0
- package/agent-docs/references/kit-kart.md +31 -0
- package/agent-docs/references/kit-minimal.md +29 -0
- package/agent-docs/references/kit-platformer.md +34 -0
- package/agent-docs/references/kit-puzzle.md +22 -0
- package/agent-docs/references/kit-racing.md +26 -0
- package/agent-docs/references/kit-rain.md +31 -0
- package/agent-docs/references/kit-rts.md +34 -0
- package/agent-docs/references/kit-runner.md +32 -0
- package/agent-docs/references/kit-sailing.md +41 -0
- package/agent-docs/references/kit-shooter.md +33 -0
- package/agent-docs/references/kit-snow.md +33 -0
- package/agent-docs/references/kit-starter.md +55 -0
- package/agent-docs/references/kit-tower-defense.md +27 -0
- package/agent-docs/references/performance-basics.md +8 -4
- package/agent-docs/references/terrain-authoring.md +2 -1
- package/agent-files/.agents/skills/ponytail/SKILL.md +1 -1
- package/agent-files/.agents/skills/prd-creator/SKILL.md +3 -2
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +84 -59
- package/agent-files/.claude/hooks/discovery-gate.mjs +125 -0
- package/agent-files/.claude/hooks/ponytail-context.mjs +1 -1
- package/agent-files/.claude/settings.json +25 -0
- package/agent-files/.codex/hooks.json +18 -1
- package/dist/index.d.ts +97 -6
- package/dist/index.js +899 -271
- package/dist/terrain-kit.d.ts +7 -0
- package/dist/terrain-kit.js +82 -0
- package/dist/threenative.js +114 -16
- package/dist/web-engine-ccd-ik-solver.js +127 -0
- package/dist/web-engine-gltf-loader.js +71 -20
- package/dist/web-engine-post-effects.js +39 -14
- package/dist/web-engine-runtime.js +10011 -4101
- package/package.json +15 -9
- package/template-assets/clearwater/README.md +1 -1
- package/template-assets/patches/manifest.json +18 -0
- package/template-assets/patches/three@0.187.0.patch +2004 -407
- package/template-assets/terrain/alpine/assets.json +12 -0
- package/template-assets/terrain/alpine/bake.mjs +6 -0
- package/template-assets/terrain/alpine/credits.json +164 -0
- package/template-assets/terrain/alpine/heightmap.r16 +0 -0
- package/template-assets/terrain/alpine/recipe.json +119 -0
- package/template-assets/terrain/alpine/surface.json +53 -0
- package/template-assets/terrain/coastal/assets.json +11 -0
- package/template-assets/terrain/coastal/bake.mjs +6 -0
- package/template-assets/terrain/coastal/credits.json +117 -0
- package/template-assets/terrain/coastal/heightmap.r16 +0 -0
- package/template-assets/terrain/coastal/recipe.json +113 -0
- package/template-assets/terrain/coastal/surface.json +41 -0
- package/template-assets/terrain/desert/assets.json +12 -0
- package/template-assets/terrain/desert/bake.mjs +6 -0
- package/template-assets/terrain/desert/credits.json +164 -0
- package/template-assets/terrain/desert/heightmap.r16 +0 -0
- package/template-assets/terrain/desert/recipe.json +108 -0
- package/template-assets/terrain/desert/surface.json +54 -0
- package/template-assets/terrain/forest/assets.json +65 -0
- package/template-assets/terrain/forest/bake.mjs +8 -0
- package/template-assets/terrain/forest/credits.json +225 -0
- package/template-assets/terrain/forest/heightmap.r16 +0 -0
- package/template-assets/terrain/forest/recipe.json +350 -0
- package/template-assets/terrain/forest/surface.json +79 -0
- package/template-assets/terrain/tundra/assets.json +12 -0
- package/template-assets/terrain/tundra/bake.mjs +6 -0
- package/template-assets/terrain/tundra/credits.json +164 -0
- package/template-assets/terrain/tundra/heightmap.r16 +0 -0
- package/template-assets/terrain/tundra/recipe.json +277 -0
- package/template-assets/terrain/tundra/surface.json +54 -0
- package/templates/action-rpg/AGENTS.md +103 -84
- package/templates/action-rpg/CLAUDE.md +103 -84
- package/templates/action-rpg/kit.json +1 -0
- package/templates/action-rpg/package.json +7 -7
- package/templates/action-rpg/playtests/spells.playtest.json +20 -0
- package/templates/action-rpg/src/game.ts +2 -1
- package/templates/action-rpg/src/render/atmosphere.ts +11 -16
- 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/clouds.ts +13 -0
- package/templates/action-rpg/src/render/gpuSky.ts +4 -7
- package/templates/action-rpg/src/render/materialLighting.ts +5 -5
- package/templates/action-rpg/src/render/quality.ts +10 -33
- package/templates/action-rpg/src/scenes/Play.ts +30 -1
- package/templates/action-rpg/src/style.css +4 -0
- package/templates/action-rpg/src/ui/AbilityBar.tsx +1 -1
- package/templates/action-rpg/threenative.config.ts +0 -3
- package/templates/action-rpg/vite.config.ts +2 -0
- package/templates/adventure/AGENTS.md +92 -44
- package/templates/adventure/CLAUDE.md +92 -44
- package/templates/adventure/kit.json +5 -1
- package/templates/adventure/package.json +7 -7
- package/templates/adventure/src/game.ts +1 -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 +93 -42
- package/templates/collectathon/CLAUDE.md +93 -42
- package/templates/collectathon/package.json +7 -7
- package/templates/collectathon/src/game.ts +1 -1
- package/templates/collectathon/src/level/Course.ts +55 -9
- package/templates/collectathon/src/level/terrain.ts +27 -6
- package/templates/collectathon/src/main.ts +1 -0
- package/templates/collectathon/src/render/foliage.ts +359 -98
- package/templates/collectathon/src/render/sky.ts +76 -12
- 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 +87 -42
- package/templates/kart/CLAUDE.md +87 -42
- package/templates/kart/package.json +6 -6
- package/templates/kart/src/game.ts +1 -1
- package/templates/kart/src/main.ts +1 -0
- package/templates/kart/src/style.css +4 -0
- package/templates/kart/tsconfig.json +1 -1
- package/templates/kart/vite.config.ts +2 -0
- package/templates/minimal/AGENTS.md +105 -84
- package/templates/minimal/CLAUDE.md +105 -84
- 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 +11 -16
- 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 +13 -2
- package/templates/minimal/src/render/clouds.ts +13 -0
- package/templates/minimal/src/render/gpuSky.ts +4 -7
- 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 +10 -0
- package/templates/minimal/src/render/quality.ts +7 -32
- package/templates/minimal/src/scenes/Play.ts +4 -1
- package/templates/minimal/vite.config.ts +7 -1
- package/templates/platformer/AGENTS.md +95 -46
- package/templates/platformer/CLAUDE.md +95 -46
- 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/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/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 +2 -1
- 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 +97 -80
- package/templates/puzzle/CLAUDE.md +97 -80
- package/templates/puzzle/package.json +7 -7
- 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/materialLighting.ts +5 -5
- package/templates/puzzle/src/render/quality.ts +7 -32
- 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 +100 -82
- package/templates/racing/CLAUDE.md +100 -82
- package/templates/racing/package.json +7 -7
- package/templates/racing/src/game.ts +1 -1
- package/templates/racing/src/render/atmosphere.ts +11 -16
- package/templates/racing/src/render/backlightControls.ts +10 -0
- package/templates/racing/src/render/backlightMaterial.ts +4 -4
- package/templates/racing/src/render/clouds.ts +13 -0
- package/templates/racing/src/render/gpuSky.ts +4 -7
- package/templates/racing/src/render/materialLighting.ts +5 -5
- package/templates/racing/src/render/quality.ts +7 -32
- package/templates/racing/src/scenes/Race.ts +4 -1
- package/templates/racing/src/style.css +4 -0
- package/templates/racing/tsconfig.json +1 -1
- package/templates/racing/vite.config.ts +2 -0
- package/templates/rain/AGENTS.md +96 -84
- package/templates/rain/CLAUDE.md +96 -84
- package/templates/rain/native-playtests/lightning.playtest.json +85 -10
- package/templates/rain/package.json +6 -6
- package/templates/rain/playtests/reduced-motion.playtest.json +6 -0
- package/templates/rain/src/game.ts +1 -1
- package/templates/rain/src/scenes/Boot.ts +1 -0
- package/templates/rain/src/state.ts +7 -0
- package/templates/rain/src/ui/GameUi.tsx +7 -1
- package/templates/rain/vite.config.ts +6 -0
- package/templates/rts/AGENTS.md +100 -85
- package/templates/rts/CLAUDE.md +100 -85
- 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/style.css +4 -0
- package/templates/rts/vite.config.ts +2 -0
- package/templates/runner/AGENTS.md +97 -80
- package/templates/runner/CLAUDE.md +97 -80
- package/templates/runner/package.json +7 -7
- package/templates/runner/playtests/performance.playtest.json +1 -1
- package/templates/runner/src/game.ts +1 -1
- package/templates/runner/src/render/atmosphere.ts +11 -16
- 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 +13 -0
- package/templates/runner/src/render/gpuSky.ts +4 -7
- package/templates/runner/src/render/lighting.ts +53 -11
- package/templates/runner/src/render/materialLighting.ts +5 -5
- package/templates/runner/src/render/quality.ts +7 -32
- package/templates/runner/src/scenes/Run.ts +8 -4
- package/templates/runner/src/style.css +4 -0
- package/templates/runner/threenative.config.ts +0 -3
- package/templates/runner/tsconfig.json +1 -1
- package/templates/runner/vite.config.ts +2 -0
- package/templates/sailing/AGENTS.md +96 -79
- package/templates/sailing/CLAUDE.md +96 -79
- package/templates/sailing/package.json +7 -7
- package/templates/sailing/playtests/sails.playtest.json +1 -0
- 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/sky.ts +4 -0
- package/templates/sailing/src/style.css +5 -0
- package/templates/sailing/threenative.config.ts +0 -3
- package/templates/sailing/vite.config.ts +6 -0
- package/templates/shooter/AGENTS.md +97 -68
- package/templates/shooter/CLAUDE.md +97 -68
- package/templates/shooter/package.json +7 -7
- package/templates/shooter/src/game.ts +3 -2
- package/templates/shooter/src/render/atmosphere.ts +11 -16
- 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 +13 -0
- package/templates/shooter/src/render/gpuSky.ts +4 -7
- package/templates/shooter/src/render/materialLighting.ts +5 -5
- package/templates/shooter/src/render/quality.ts +10 -33
- 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 +95 -76
- package/templates/snow/CLAUDE.md +95 -76
- package/templates/snow/package.json +7 -7
- 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/materialLighting.ts +5 -5
- package/templates/snow/src/render/quality.ts +7 -32
- package/templates/snow/src/style.css +5 -0
- package/templates/snow/threenative.config.ts +0 -3
- package/templates/snow/vite.config.ts +6 -0
- package/templates/starter/AGENTS.md +109 -88
- package/templates/starter/CLAUDE.md +109 -88
- package/templates/starter/native-playtests/render-chain.playtest.json +24 -24
- package/templates/starter/native-playtests/smooth-motion.playtest.json +3 -3
- package/templates/starter/package.json +7 -7
- package/templates/starter/src/entities/Crate.ts +5 -2
- package/templates/starter/src/entities/Player.ts +10 -22
- package/templates/starter/src/game.ts +4 -3
- package/templates/starter/src/render/adaptiveQuality.ts +17 -0
- package/templates/starter/src/render/atmosphere.ts +11 -16
- package/templates/starter/src/render/backlightControls.ts +10 -0
- package/templates/starter/src/render/backlightMaterial.ts +4 -4
- package/templates/starter/src/render/clouds.ts +13 -0
- package/templates/starter/src/render/contactShadow.ts +1 -1
- package/templates/starter/src/render/gpuSky.ts +4 -7
- package/templates/starter/src/render/lighting.ts +54 -4
- package/templates/starter/src/render/materialLighting.ts +5 -5
- package/templates/starter/src/render/postprocessing.ts +11 -10
- package/templates/starter/src/render/quality.ts +14 -1
- package/templates/starter/src/render/temporalAA.ts +8 -7
- package/templates/starter/src/render/temporalAAFrame.ts +30 -9
- package/templates/starter/src/render/temporalAAResolve.ts +15 -1
- package/templates/starter/src/render/temporalClampRelease.ts +183 -0
- package/templates/starter/src/render/temporalHistoryResolve.ts +90 -0
- package/templates/starter/src/render/temporalMoire.ts +190 -0
- package/templates/starter/src/render/temporalResolve.ts +75 -16
- package/templates/starter/src/render/temporalResolveDepth.ts +2 -0
- package/templates/starter/src/scenes/Play.ts +53 -32
- 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 +97 -81
- package/templates/tower-defense/CLAUDE.md +97 -81
- 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/scenes/Battle.ts +1 -1
- 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/capabilities.json +0 -9197
- package/templates/AGENTS.md +0 -21
- package/templates/CLAUDE.md +0 -23
- package/templates/action-rpg/.codex/config.toml +0 -23
- package/templates/action-rpg/.cursor/mcp.json +0 -38
- package/templates/action-rpg/.gemini/settings.json +0 -38
- package/templates/action-rpg/.mcp.json +0 -38
- package/templates/action-rpg/.vscode/mcp.json +0 -43
- package/templates/action-rpg/.zed/settings.json +0 -43
- package/templates/action-rpg/opencode.json +0 -49
- 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/adventure/.codex/config.toml +0 -23
- package/templates/adventure/.cursor/mcp.json +0 -38
- package/templates/adventure/.gemini/settings.json +0 -38
- package/templates/adventure/.mcp.json +0 -38
- package/templates/adventure/.vscode/mcp.json +0 -43
- package/templates/adventure/.zed/settings.json +0 -43
- package/templates/adventure/opencode.json +0 -49
- package/templates/collectathon/.codex/config.toml +0 -23
- package/templates/collectathon/.cursor/mcp.json +0 -38
- package/templates/collectathon/.gemini/settings.json +0 -38
- package/templates/collectathon/.mcp.json +0 -38
- package/templates/collectathon/.vscode/mcp.json +0 -43
- package/templates/collectathon/.zed/settings.json +0 -43
- package/templates/collectathon/opencode.json +0 -49
- package/templates/kart/.codex/config.toml +0 -23
- package/templates/kart/.cursor/mcp.json +0 -38
- package/templates/kart/.gemini/settings.json +0 -38
- package/templates/kart/.mcp.json +0 -38
- package/templates/kart/.vscode/mcp.json +0 -43
- package/templates/kart/.zed/settings.json +0 -43
- package/templates/kart/opencode.json +0 -49
- package/templates/minimal/.codex/config.toml +0 -23
- package/templates/minimal/.cursor/mcp.json +0 -38
- package/templates/minimal/.gemini/settings.json +0 -38
- package/templates/minimal/.mcp.json +0 -38
- package/templates/minimal/.vscode/mcp.json +0 -43
- package/templates/minimal/.zed/settings.json +0 -43
- package/templates/minimal/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/platformer/.cursor/mcp.json +0 -38
- package/templates/platformer/.gemini/settings.json +0 -38
- package/templates/platformer/.mcp.json +0 -38
- package/templates/platformer/.vscode/mcp.json +0 -43
- package/templates/platformer/.zed/settings.json +0 -43
- package/templates/platformer/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/puzzle/.cursor/mcp.json +0 -38
- package/templates/puzzle/.gemini/settings.json +0 -38
- package/templates/puzzle/.mcp.json +0 -38
- package/templates/puzzle/.vscode/mcp.json +0 -43
- package/templates/puzzle/.zed/settings.json +0 -43
- package/templates/puzzle/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/racing/.cursor/mcp.json +0 -38
- package/templates/racing/.gemini/settings.json +0 -38
- package/templates/racing/.mcp.json +0 -38
- package/templates/racing/.vscode/mcp.json +0 -43
- package/templates/racing/.zed/settings.json +0 -43
- package/templates/racing/opencode.json +0 -49
- 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/rain/.codex/config.toml +0 -23
- package/templates/rain/.cursor/mcp.json +0 -38
- package/templates/rain/.gemini/settings.json +0 -38
- package/templates/rain/.mcp.json +0 -38
- package/templates/rain/.vscode/mcp.json +0 -43
- package/templates/rain/.zed/settings.json +0 -43
- package/templates/rain/opencode.json +0 -49
- package/templates/rts/.codex/config.toml +0 -23
- package/templates/rts/.cursor/mcp.json +0 -38
- package/templates/rts/.gemini/settings.json +0 -38
- package/templates/rts/.mcp.json +0 -38
- package/templates/rts/.vscode/mcp.json +0 -43
- package/templates/rts/.zed/settings.json +0 -43
- package/templates/rts/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/runner/.cursor/mcp.json +0 -38
- package/templates/runner/.gemini/settings.json +0 -38
- package/templates/runner/.mcp.json +0 -38
- package/templates/runner/.vscode/mcp.json +0 -43
- package/templates/runner/.zed/settings.json +0 -43
- package/templates/runner/README.md +0 -43
- package/templates/runner/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/sailing/.cursor/mcp.json +0 -38
- package/templates/sailing/.gemini/settings.json +0 -38
- package/templates/sailing/.mcp.json +0 -38
- package/templates/sailing/.vscode/mcp.json +0 -43
- package/templates/sailing/.zed/settings.json +0 -43
- package/templates/sailing/README.md +0 -28
- package/templates/sailing/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/shooter/.cursor/mcp.json +0 -38
- package/templates/shooter/.gemini/settings.json +0 -38
- package/templates/shooter/.mcp.json +0 -38
- package/templates/shooter/.vscode/mcp.json +0 -43
- package/templates/shooter/.zed/settings.json +0 -43
- package/templates/shooter/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/snow/.cursor/mcp.json +0 -38
- package/templates/snow/.gemini/settings.json +0 -38
- package/templates/snow/.mcp.json +0 -38
- package/templates/snow/.vscode/mcp.json +0 -43
- package/templates/snow/.zed/settings.json +0 -43
- package/templates/snow/README.md +0 -26
- package/templates/snow/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/starter/.cursor/mcp.json +0 -38
- package/templates/starter/.gemini/settings.json +0 -38
- package/templates/starter/.mcp.json +0 -38
- package/templates/starter/.vscode/mcp.json +0 -43
- package/templates/starter/.zed/settings.json +0 -43
- package/templates/starter/opencode.json +0 -49
- 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/.codex/config.toml +0 -23
- package/templates/tower-defense/.cursor/mcp.json +0 -38
- package/templates/tower-defense/.gemini/settings.json +0 -38
- package/templates/tower-defense/.mcp.json +0 -38
- package/templates/tower-defense/.vscode/mcp.json +0 -43
- package/templates/tower-defense/.zed/settings.json +0 -43
- package/templates/tower-defense/README.md +0 -16
- package/templates/tower-defense/opencode.json +0 -49
- 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
|
@@ -10,6 +10,11 @@ function finiteColor(color: Color) {
|
|
|
10
10
|
color.b >= 0
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Throws when a `IBacklightControls` is missing a light or names a non-finite gain.
|
|
15
|
+
*
|
|
16
|
+
* @situation fail loudly instead of drawing an unlit material when a backlight has no key light
|
|
17
|
+
*/
|
|
13
18
|
export function validateControls(controls: IBacklightControls) {
|
|
14
19
|
if (
|
|
15
20
|
!Number.isFinite(controls.rimGain) ||
|
|
@@ -30,6 +35,11 @@ export function validateControls(controls: IBacklightControls) {
|
|
|
30
35
|
"Backlight controls require finite nonnegative gains, a direction and angular size in (0, 1.5].",
|
|
31
36
|
);
|
|
32
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The light and camera a backlit material reads its key direction from.
|
|
40
|
+
*
|
|
41
|
+
* @situation point the backlight at the sun the scene actually has
|
|
42
|
+
*/
|
|
33
43
|
export function resolveKey(
|
|
34
44
|
controls: IBacklightControls,
|
|
35
45
|
direction: Vector3,
|
|
@@ -48,10 +48,10 @@ export interface IBacklightControls {
|
|
|
48
48
|
const graphs = new WeakMap<IBacklightControls, ReturnType<typeof createGraph>>();
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* The game's material, wrapped in a node twin that adds the backlit sheen it was given.
|
|
52
|
+
*
|
|
53
|
+
* @situation give a material a launcher's glow without editing its colour, texture or roughness
|
|
54
|
+
* @constraint every colour, gain and angular size is the caller's; this copies the game's material and adds light
|
|
55
55
|
*/
|
|
56
56
|
export function backlightMaterial(source: MeshStandardMaterial, controls: IBacklightControls) {
|
|
57
57
|
if (
|
|
@@ -282,6 +282,19 @@ export interface ICloudTextures {
|
|
|
282
282
|
}
|
|
283
283
|
const textureCache = new Map<number, ICloudTextures>();
|
|
284
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Hand back the textures an earlier run generated, so `cloudTextures(seed)` skips ~0.6 s of noise
|
|
287
|
+
* on the main thread. The scene keeps them between runs with `ctx.assets.memo`.
|
|
288
|
+
*/
|
|
289
|
+
export function primeCloudTextures(textures: ICloudTextures, seed = 631): void {
|
|
290
|
+
if (
|
|
291
|
+
textures.pattern.length !== PATTERN_SIZE ** 2 * 4 ||
|
|
292
|
+
textures.volume.length !== VOLUME_SIZE ** 3 * 2
|
|
293
|
+
)
|
|
294
|
+
throw new Error("cloud textures do not match PATTERN_SIZE and VOLUME_SIZE.");
|
|
295
|
+
textureCache.set(seed, textures);
|
|
296
|
+
}
|
|
297
|
+
|
|
285
298
|
export function cloudTextures(seed = 631): ICloudTextures {
|
|
286
299
|
const cached = textureCache.get(seed);
|
|
287
300
|
if (cached) return cached;
|
|
@@ -53,7 +53,6 @@ import {
|
|
|
53
53
|
MIE_SCATTER,
|
|
54
54
|
OZONE,
|
|
55
55
|
RAYLEIGH,
|
|
56
|
-
SKY_TO_SUN,
|
|
57
56
|
SUN_ILLUMINANCE,
|
|
58
57
|
SUN_KELVIN,
|
|
59
58
|
TOP_KM,
|
|
@@ -273,7 +272,7 @@ class GpuSkyNode extends Node<"vec3"> {
|
|
|
273
272
|
readonly #quad = new QuadMesh(new NodeMaterial());
|
|
274
273
|
readonly #noise = cloudNoise();
|
|
275
274
|
readonly #fog = uniform(new Color());
|
|
276
|
-
readonly #scale = vec3(...temperatureColour(SUN_KELVIN)).mul(SUN_ILLUMINANCE
|
|
275
|
+
readonly #scale = vec3(...temperatureColour(SUN_KELVIN)).mul(SUN_ILLUMINANCE);
|
|
277
276
|
readonly #light = uniform(new Vector3());
|
|
278
277
|
readonly #ambient = uniform(new Vector3());
|
|
279
278
|
#last = new Vector3(Number.NaN, 0, 0);
|
|
@@ -587,9 +586,7 @@ class GpuSkyNode extends Node<"vec3"> {
|
|
|
587
586
|
.greaterThanEqual(Math.cos(SUN_RADIUS))
|
|
588
587
|
.and(skyDisc.greaterThan(0.5))
|
|
589
588
|
.select(
|
|
590
|
-
this.#light
|
|
591
|
-
.mul(this.clouds ? cloud.a : float(1))
|
|
592
|
-
.div(PI * Math.sin(SUN_RADIUS) ** 2 * SKY_TO_SUN),
|
|
589
|
+
this.#light.mul(this.clouds ? cloud.a : float(1)).div(PI * Math.sin(SUN_RADIUS) ** 2),
|
|
593
590
|
vec3(0),
|
|
594
591
|
);
|
|
595
592
|
const colour = sky.add(disc).mul(this.#scale);
|
|
@@ -665,7 +662,7 @@ function distantFogColour(sun: Vector3): Color {
|
|
|
665
662
|
const tint = temperatureColour(SUN_KELVIN);
|
|
666
663
|
const light = viewDistanceSkyLight(sun);
|
|
667
664
|
return new Color(
|
|
668
|
-
...([0, 1, 2].map((c) => (light[c] ?? 0) * (tint[c] ?? 1) * SUN_ILLUMINANCE
|
|
665
|
+
...([0, 1, 2].map((c) => (light[c] ?? 0) * (tint[c] ?? 1) * SUN_ILLUMINANCE) as [
|
|
669
666
|
number,
|
|
670
667
|
number,
|
|
671
668
|
number,
|
|
@@ -720,7 +717,7 @@ export function createGpuSky(
|
|
|
720
717
|
const refresh = () => {
|
|
721
718
|
const start = performance.now();
|
|
722
719
|
const data = bakedRadiance(sun, w, h, ground, clouds);
|
|
723
|
-
const scale = temperatureColour(SUN_KELVIN).map((v) => v * SUN_ILLUMINANCE
|
|
720
|
+
const scale = temperatureColour(SUN_KELVIN).map((v) => v * SUN_ILLUMINANCE) as [
|
|
724
721
|
number,
|
|
725
722
|
number,
|
|
726
723
|
number,
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
// sun misses — so there is no hemisphere or ambient light stacked on top to flatten the frame.
|
|
6
6
|
// The rig is returned because `WorldEnvironment`'s godrays stage raymarches against a shadow map,
|
|
7
7
|
// so `setupPost` needs the key light itself; a shadowless one is refused by name.
|
|
8
|
-
|
|
8
|
+
//
|
|
9
|
+
// The sun's shadow box travels with the runner. The track is endless, so a box left at the start
|
|
10
|
+
// line covers the first stretch and nothing after it: past it the runner, the obstacles and the
|
|
11
|
+
// rails cast no shadow at all. `follow` aims the box at the ground the chase camera sees.
|
|
12
|
+
import { Color, DirectionalLight, Matrix4, PCFSoftShadowMap, type Scene, Vector3 } from "three";
|
|
9
13
|
import {
|
|
10
14
|
SUN_ILLUMINANCE,
|
|
11
15
|
SUN_KELVIN,
|
|
@@ -30,13 +34,26 @@ function atmosphereSun(): DirectionalLight {
|
|
|
30
34
|
return key;
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
/** How far up its own ray the sun sits. The shadow camera's depth range starts at that distance. */
|
|
38
|
+
const SUN_DISTANCE = 30;
|
|
39
|
+
/** How far ahead of the runner the shadow box is centred: the ground the chase camera sees. */
|
|
40
|
+
const LEAD = 12;
|
|
41
|
+
const UP = new Vector3(0, 1, 0);
|
|
42
|
+
const ORIGIN = new Vector3();
|
|
43
|
+
|
|
33
44
|
type ShadowRenderer = { shadowMap: { enabled: boolean; type: number } };
|
|
34
45
|
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
export interface ILighting {
|
|
47
|
+
readonly key: DirectionalLight;
|
|
48
|
+
readonly fill: DirectionalLight;
|
|
49
|
+
/**
|
|
50
|
+
* Put the sun's shadow box on the runner, so the ground in frame keeps its shadows all run long.
|
|
51
|
+
* The track runs down -Z, so the box leads the runner there. Call it once per rendered frame.
|
|
52
|
+
*/
|
|
53
|
+
follow(target: Vector3): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function setupLighting(scene: Scene, renderer: ShadowRenderer, mobile = false): ILighting {
|
|
40
57
|
renderer.shadowMap.enabled = true;
|
|
41
58
|
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
42
59
|
|
|
@@ -44,16 +61,17 @@ export function setupLighting(
|
|
|
44
61
|
// down-track so it rakes across the obstacles and throws each one's shadow back toward the
|
|
45
62
|
// The photo sky keeps the warm white matched by eye to its photographed midday sun.
|
|
46
63
|
const key = SKY_OPTIONS.sky === "photo" ? new DirectionalLight(0xfff1e0, 4.5) : atmosphereSun();
|
|
47
|
-
|
|
64
|
+
const offset = SUN_DIRECTION.clone().multiplyScalar(SUN_DISTANCE);
|
|
65
|
+
key.position.copy(offset);
|
|
48
66
|
key.castShadow = true;
|
|
49
|
-
// One map fitted to what the chase camera can see from the runner: 4096² is
|
|
50
|
-
//
|
|
67
|
+
// One map fitted to what the chase camera can see from the runner: 4096² is about a centimetre a
|
|
68
|
+
// texel, so every shadow has the same softness. Phones take 2048².
|
|
51
69
|
const size = mobile ? 2048 : 4096;
|
|
52
70
|
key.shadow.mapSize.set(size, size);
|
|
53
71
|
key.shadow.radius = 2;
|
|
54
72
|
key.shadow.camera.near = 1;
|
|
55
73
|
key.shadow.camera.far = 140;
|
|
56
|
-
const extent =
|
|
74
|
+
const extent = mobile ? 16 : 24;
|
|
57
75
|
key.shadow.camera.left = -extent;
|
|
58
76
|
key.shadow.camera.right = extent;
|
|
59
77
|
key.shadow.camera.top = extent;
|
|
@@ -62,6 +80,9 @@ export function setupLighting(
|
|
|
62
80
|
key.shadow.bias = -0.0002;
|
|
63
81
|
key.shadow.normalBias = 0.005;
|
|
64
82
|
scene.add(key);
|
|
83
|
+
// three reads the target's world matrix, which only a scene traversal refreshes: a target left
|
|
84
|
+
// out of the graph stays at the origin however its position reads.
|
|
85
|
+
scene.add(key.target);
|
|
65
86
|
|
|
66
87
|
// The sky alone leaves every down-track face in its own shade, so the runner reads as a dark
|
|
67
88
|
// silhouette against the obstacle it is about to hit — the one comparison the game asks the
|
|
@@ -71,7 +92,28 @@ export function setupLighting(
|
|
|
71
92
|
fill.position.set(0, 8, 20);
|
|
72
93
|
scene.add(fill);
|
|
73
94
|
|
|
74
|
-
|
|
95
|
+
// A shadow map is a grid in the light's own frame. Slide the box by a fraction of a texel and every
|
|
96
|
+
// sample lands between texels, so the whole map crawls with the runner. Both ends snap to whole
|
|
97
|
+
// texels of that grid instead, which leaves every texel on one fixed cell of the world however the
|
|
98
|
+
// runner moves. The sun never turns, so the frame is built once.
|
|
99
|
+
const texel = (2 * extent) / size;
|
|
100
|
+
const intoLight = new Matrix4().lookAt(offset, ORIGIN, UP).invert();
|
|
101
|
+
const outOfLight = intoLight.clone().invert();
|
|
102
|
+
const centre = new Vector3();
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
key,
|
|
106
|
+
fill,
|
|
107
|
+
follow(target: Vector3): void {
|
|
108
|
+
centre.set(target.x, 0, target.z - LEAD).applyMatrix4(intoLight);
|
|
109
|
+
centre.x = Math.round(centre.x / texel) * texel;
|
|
110
|
+
centre.y = Math.round(centre.y / texel) * texel;
|
|
111
|
+
centre.applyMatrix4(outOfLight);
|
|
112
|
+
key.target.position.copy(centre);
|
|
113
|
+
key.target.updateMatrixWorld();
|
|
114
|
+
key.position.copy(centre).add(offset);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
75
117
|
}
|
|
76
118
|
|
|
77
119
|
/** Material conventions are game-owned; each scene gets independent mutable controls. */
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// Generated for you. Scene-owned material assignments; no engine appearance hooks.
|
|
2
|
-
import type { Camera, DirectionalLight, Object3D, Scene, Texture } from "three";
|
|
3
|
-
import type { IBacklightControls } from "./backlightMaterial.js";
|
|
4
1
|
import {
|
|
5
2
|
type IEnvironmentMeasurement,
|
|
6
3
|
measureEnvironment,
|
|
7
4
|
reportEnvironmentContribution,
|
|
8
|
-
} from "
|
|
5
|
+
} from "@threenative/core/render/environment";
|
|
9
6
|
import {
|
|
10
7
|
type IEnvironmentSourceSnapshot,
|
|
11
8
|
captureEnvironmentSnapshot,
|
|
12
9
|
environmentSnapshotCurrent,
|
|
13
|
-
} from "
|
|
10
|
+
} from "@threenative/core/render/environment";
|
|
11
|
+
// Generated for you. Scene-owned material assignments; no engine appearance hooks.
|
|
12
|
+
import type { Camera, DirectionalLight, Object3D, Scene, Texture } from "three";
|
|
13
|
+
import type { IBacklightControls } from "./backlightMaterial.js";
|
|
14
14
|
import { type ILightingConvention, createLightingConvention } from "./lighting.js";
|
|
15
15
|
import { createMaterialAssignments } from "./materialAssignments.js";
|
|
16
16
|
import { type IMaterialLightingEnvironment, materialLightingEnabled } from "./quality.js";
|
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
} from "@threenative/core";
|
|
26
26
|
import { exposureSettings } from "./exposure.js";
|
|
27
27
|
export type { QualityTier } from "@threenative/core";
|
|
28
|
-
import type { QualityTier } from "@threenative/core";
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* The three names this game's look comes in.
|
|
@@ -54,34 +53,10 @@ export function qualityPreset(tier: string): IWorldEnvironmentOptions {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
/** First admitted material lane: high desktop hardware WebGPU in the browser only. */
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
export function materialLightingEnabled(
|
|
65
|
-
tier: QualityTier,
|
|
66
|
-
environment: IMaterialLightingEnvironment,
|
|
67
|
-
): boolean {
|
|
68
|
-
return (
|
|
69
|
-
tier === "high" &&
|
|
70
|
-
environment.web &&
|
|
71
|
-
environment.rendererKind === "webgpu" &&
|
|
72
|
-
environment.mobile !== true &&
|
|
73
|
-
environment.software !== true &&
|
|
74
|
-
environment.webglFallback !== true
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** A WebGPURenderer wrapper may run an ordinary WebGL fallback backend. */
|
|
79
|
-
export function isWebGLFallbackRenderer(renderer: unknown): boolean {
|
|
80
|
-
if (renderer === null || typeof renderer !== "object") return false;
|
|
81
|
-
const backend = Reflect.get(renderer, "backend");
|
|
82
|
-
return (
|
|
83
|
-
backend !== null &&
|
|
84
|
-
typeof backend === "object" &&
|
|
85
|
-
Reflect.get(backend, "isWebGLBackend") === true
|
|
86
|
-
);
|
|
87
|
-
}
|
|
56
|
+
// The material lane's admission rule and the WebGL-fallback probe are the engine's: twelve kits
|
|
57
|
+
// held a copy each, so a fix to one left eleven admitting what it refused.
|
|
58
|
+
export {
|
|
59
|
+
type IMaterialLightingEnvironment,
|
|
60
|
+
isWebGLFallbackRenderer,
|
|
61
|
+
materialLightingEnabled,
|
|
62
|
+
} from "@threenative/core/render/environment";
|
|
@@ -9,12 +9,13 @@ import {
|
|
|
9
9
|
isMobile,
|
|
10
10
|
isTouchscreenAvailable,
|
|
11
11
|
} from "@threenative/core";
|
|
12
|
+
import { type IEnvironmentSample, sampleEnvironment } from "@threenative/core/render/environment";
|
|
12
13
|
import { type PerspectiveCamera, type Texture, Vector3 } from "three";
|
|
13
14
|
import { HITBOX, type IRunnerModel, Runner } from "../entities/Runner.js";
|
|
14
15
|
import type { RunnerPhysics } from "../physics.js";
|
|
15
16
|
import { chaseRunner, setupCamera } from "../render/camera.js";
|
|
17
|
+
import { cloudTextures, primeCloudTextures } from "../render/clouds.js";
|
|
16
18
|
import { createDustTrail } from "../render/dust.js";
|
|
17
|
-
import { type IEnvironmentSample, sampleEnvironment } from "../render/environmentSampling.js";
|
|
18
19
|
import { setupLighting } from "../render/lighting.js";
|
|
19
20
|
import { createLoadingScreen } from "../render/loading.js";
|
|
20
21
|
import { createMaterialLighting } from "../render/materialLighting.js";
|
|
@@ -55,6 +56,8 @@ export class Run extends Scene<GameState, RunnerPhysics> {
|
|
|
55
56
|
// Only the photo-sky override reads the photograph; the atmosphere sky is computed.
|
|
56
57
|
SKY_OPTIONS.sky === "photo" ? ctx.assets.texture("sky.jpg") : undefined,
|
|
57
58
|
]);
|
|
59
|
+
// The cloud noise is the same every run of this build: generate it once, then read it back.
|
|
60
|
+
primeCloudTextures(await ctx.assets.memo("clouds", () => cloudTextures()));
|
|
58
61
|
setupSky(ctx.scene, this.#sky, ctx.renderer.softwareAdapter !== undefined);
|
|
59
62
|
this.#environmentSample = await sampleEnvironment(ctx.renderer.raw, ctx.scene, {
|
|
60
63
|
web: getPlatform().runtime === "web",
|
|
@@ -69,7 +72,7 @@ export class Run extends Scene<GameState, RunnerPhysics> {
|
|
|
69
72
|
if (this.#model === undefined)
|
|
70
73
|
throw new Error("Run.enter ran before load() loaded mannequin.glb.");
|
|
71
74
|
setupSky(ctx.scene, this.#sky, ctx.renderer.softwareAdapter !== undefined);
|
|
72
|
-
const
|
|
75
|
+
const lighting = setupLighting(
|
|
73
76
|
ctx.scene,
|
|
74
77
|
ctx.renderer.raw as Parameters<typeof setupLighting>[1],
|
|
75
78
|
isMobile(),
|
|
@@ -89,7 +92,7 @@ export class Run extends Scene<GameState, RunnerPhysics> {
|
|
|
89
92
|
materialTier = tier;
|
|
90
93
|
this.#materialLighting?.setEnabled(materialLightingEnabled(tier, materialEnvironment));
|
|
91
94
|
},
|
|
92
|
-
godraysLight: key,
|
|
95
|
+
godraysLight: lighting.key,
|
|
93
96
|
mobile: isMobile(),
|
|
94
97
|
software: ctx.renderer.softwareAdapter !== undefined,
|
|
95
98
|
gpuClass: ctx.renderer.gpuClass?.class,
|
|
@@ -139,13 +142,14 @@ export class Run extends Scene<GameState, RunnerPhysics> {
|
|
|
139
142
|
afterPhysics(ctx, (dt) => {
|
|
140
143
|
const offset = shake.update(dt);
|
|
141
144
|
chaseRunner(camera, runner.mesh.position, dt, offset.position);
|
|
145
|
+
lighting.follow(runner.mesh.position);
|
|
142
146
|
dust.position.set(runner.mesh.position.x, 0.15, runner.mesh.position.z + 0.6);
|
|
143
147
|
});
|
|
144
148
|
|
|
145
149
|
// Collect only after the loaded character and scene receivers are attached.
|
|
146
150
|
this.#materialLighting = ctx.entities.add(
|
|
147
151
|
"material-lighting",
|
|
148
|
-
createMaterialLighting(ctx.scene, ctx.camera, key, {
|
|
152
|
+
createMaterialLighting(ctx.scene, ctx.camera, lighting.key, {
|
|
149
153
|
...materialEnvironment,
|
|
150
154
|
enabled: materialLightingEnabled(materialTier, materialEnvironment),
|
|
151
155
|
overrides: { fillGain: 0 },
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
@source "../index.html";
|
|
4
4
|
@source "./";
|
|
5
|
+
/* `src/render/` is shader and material source: a word in its comments ("blur", "filter",
|
|
6
|
+
"table") became a real utility rule, which is what made a clean HUD look like a native-css
|
|
7
|
+
profile failure. Tailwind scans what it is told to scan. */
|
|
8
|
+
@source not "./render";
|
|
5
9
|
|
|
6
10
|
@theme {
|
|
7
11
|
--color-ink: #07131d;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { IThreeNativeConfig } from "@threenative/core";
|
|
2
2
|
|
|
3
3
|
const config: IThreeNativeConfig = {
|
|
4
|
-
// Pinned to the legacy engine: the native engine does not bind three/tsl deltaTime yet (PRD-573 slice 8).
|
|
5
|
-
// Delete this line when `pnpm build --target desktop` passes without it, and the game runs on the native engine.
|
|
6
|
-
engine: "threejs",
|
|
7
4
|
app: {
|
|
8
5
|
id: "com.threenative.__PROJECT_ID__",
|
|
9
6
|
name: "__PROJECT_NAME__",
|
|
@@ -2,6 +2,7 @@ import tailwindcss from "@tailwindcss/vite";
|
|
|
2
2
|
import { watchAssets } from "@threenative/assets";
|
|
3
3
|
import react from "@vitejs/plugin-react";
|
|
4
4
|
import {
|
|
5
|
+
createEngineCatalogPlugin,
|
|
5
6
|
createEngineFreshnessPlugin,
|
|
6
7
|
createWebBrandPlugin,
|
|
7
8
|
webRuntimeDecoders,
|
|
@@ -36,6 +37,7 @@ export default defineConfig({
|
|
|
36
37
|
plugins: [
|
|
37
38
|
createEngineFreshnessPlugin(),
|
|
38
39
|
createWebBrandPlugin(),
|
|
40
|
+
createEngineCatalogPlugin(),
|
|
39
41
|
react(),
|
|
40
42
|
tailwindcss(),
|
|
41
43
|
assetsWatchPlugin(),
|