create-threenative 0.2.7 → 0.2.9
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/README.md +3 -1
- package/agent-docs/references/assertion-reference.md +87 -35
- package/agent-docs/references/auto-exposure.md +57 -0
- package/agent-docs/references/capability-reference.md +1306 -62
- package/agent-docs/references/debug-surface.md +6 -0
- package/agent-docs/references/finding-assets.md +46 -10
- package/agent-docs/references/performance-basics.md +5 -4
- package/agent-docs/references/terrain-authoring.md +140 -0
- package/agent-files/.agents/skills/threenative-assets/SKILL.md +2 -1
- package/capabilities.json +1505 -79
- package/dist/index.d.ts +28 -3
- package/dist/index.js +402 -167
- package/dist/threenative.js +989 -237
- package/dist/web-engine-buffer-geometry-utils.js +281 -0
- package/dist/web-engine-decal-geometry.js +184 -0
- package/dist/web-engine-gltf-loader.js +196 -0
- package/dist/web-engine-hdr-loader.js +190 -0
- package/dist/web-engine-lut-cube-loader.js +122 -0
- package/dist/web-engine-mesh-bvh-webgpu.js +29 -0
- package/dist/web-engine-mesh-bvh.js +32 -0
- package/dist/web-engine-post-effects.js +168 -0
- package/dist/web-engine-runtime.js +42506 -0
- package/package.json +11 -8
- package/template-assets/autoExposure.ts +225 -0
- package/template-assets/exposure.ts +111 -0
- package/template-assets/exposureGraph.ts +178 -0
- package/template-assets/exposureReadback.ts +79 -0
- package/template-assets/patches/@tailwindcss__node@4.3.3.patch +22 -0
- package/template-assets/patches/three@0.185.1.patch +6594 -700
- package/template-assets/patches/vite@8.2.0.patch +422 -0
- package/template-assets/worldEnvironment.ts +433 -30
- package/templates/action-rpg/AGENTS.md +11 -10
- package/templates/action-rpg/CLAUDE.md +11 -10
- package/templates/action-rpg/package.json +11 -9
- package/templates/action-rpg/playtests/performance.playtest.json +7 -1
- package/templates/action-rpg/src/progress.ts +0 -4
- package/templates/action-rpg/src/render/autoExposure.ts +225 -0
- package/templates/action-rpg/src/render/backlightControls.ts +66 -0
- package/templates/action-rpg/src/render/backlightMaterial.ts +147 -0
- package/templates/action-rpg/src/render/environmentContribution.ts +188 -0
- package/templates/action-rpg/src/render/environmentRadiance.ts +36 -0
- package/templates/action-rpg/src/render/environmentSampleCache.ts +43 -0
- package/templates/action-rpg/src/render/environmentSampling.ts +193 -0
- package/templates/action-rpg/src/render/environmentSnapshot.ts +53 -0
- package/templates/action-rpg/src/render/exposure.ts +111 -0
- package/templates/action-rpg/src/render/exposureGraph.ts +178 -0
- package/templates/action-rpg/src/render/exposureReadback.ts +79 -0
- package/templates/action-rpg/src/render/heightFog.ts +118 -0
- package/templates/action-rpg/src/render/lighting.ts +26 -1
- package/templates/action-rpg/src/render/materialAssignments.ts +160 -0
- package/templates/action-rpg/src/render/materialLighting.ts +155 -0
- package/templates/action-rpg/src/render/postprocessing.ts +17 -2
- package/templates/action-rpg/src/render/quality.ts +61 -2
- package/templates/action-rpg/src/render/sky.ts +21 -1
- package/templates/action-rpg/src/render/vfx.ts +133 -58
- package/templates/action-rpg/src/render/worldEnvironment.ts +433 -30
- package/templates/action-rpg/src/scenes/Play.ts +81 -16
- package/templates/action-rpg/threenative.config.ts +3 -0
- package/templates/action-rpg/vite.config.ts +10 -2
- package/templates/minimal/AGENTS.md +9 -10
- package/templates/minimal/CLAUDE.md +9 -10
- package/templates/minimal/package.json +9 -8
- package/templates/minimal/playtests/play.playtest.json +7 -1
- package/templates/minimal/playtests/sky.playtest.json +10 -1
- package/templates/minimal/src/render/autoExposure.ts +225 -0
- package/templates/minimal/src/render/backlightControls.ts +66 -0
- package/templates/minimal/src/render/backlightMaterial.ts +147 -0
- package/templates/minimal/src/render/environmentContribution.ts +188 -0
- package/templates/minimal/src/render/environmentRadiance.ts +36 -0
- package/templates/minimal/src/render/environmentSampleCache.ts +43 -0
- package/templates/minimal/src/render/environmentSampling.ts +193 -0
- package/templates/minimal/src/render/environmentSnapshot.ts +53 -0
- package/templates/minimal/src/render/exposure.ts +111 -0
- package/templates/minimal/src/render/exposureGraph.ts +178 -0
- package/templates/minimal/src/render/exposureReadback.ts +79 -0
- package/templates/minimal/src/render/heightFog.ts +118 -0
- package/templates/minimal/src/render/lighting.ts +25 -1
- package/templates/minimal/src/render/materialAssignments.ts +102 -0
- package/templates/minimal/src/render/materialLighting.ts +146 -0
- package/templates/minimal/src/render/postprocessing.ts +16 -2
- package/templates/minimal/src/render/quality.ts +60 -2
- package/templates/minimal/src/render/sky.ts +21 -1
- package/templates/minimal/src/render/worldEnvironment.ts +433 -30
- package/templates/minimal/src/scenes/Play.ts +50 -1
- package/templates/minimal/vite.config.ts +10 -2
- package/templates/platformer/AGENTS.md +7 -5
- package/templates/platformer/CLAUDE.md +7 -5
- package/templates/platformer/package.json +11 -9
- package/templates/platformer/playtests/performance.playtest.json +7 -1
- package/templates/platformer/src/render/autoExposure.ts +225 -0
- package/templates/platformer/src/render/backlightControls.ts +66 -0
- package/templates/platformer/src/render/backlightMaterial.ts +147 -0
- package/templates/platformer/src/render/environmentContribution.ts +188 -0
- package/templates/platformer/src/render/environmentRadiance.ts +36 -0
- package/templates/platformer/src/render/environmentSampleCache.ts +43 -0
- package/templates/platformer/src/render/environmentSampling.ts +193 -0
- package/templates/platformer/src/render/environmentSnapshot.ts +53 -0
- package/templates/platformer/src/render/exposure.ts +111 -0
- package/templates/platformer/src/render/exposureGraph.ts +178 -0
- package/templates/platformer/src/render/exposureReadback.ts +79 -0
- package/templates/platformer/src/render/heightFog.ts +118 -0
- package/templates/platformer/src/render/lighting.ts +26 -1
- package/templates/platformer/src/render/materialAssignments.ts +160 -0
- package/templates/platformer/src/render/materialLighting.ts +155 -0
- package/templates/platformer/src/render/materials.ts +7 -2
- package/templates/platformer/src/render/palette.ts +3 -3
- package/templates/platformer/src/render/postprocessing.ts +17 -2
- package/templates/platformer/src/render/quality.ts +61 -2
- package/templates/platformer/src/render/sky.ts +72 -23
- package/templates/platformer/src/render/skyEnvironment.ts +50 -0
- package/templates/platformer/src/render/worldEnvironment.ts +433 -30
- package/templates/platformer/src/scenes/Play.ts +70 -6
- package/templates/platformer/vite.config.ts +10 -2
- package/templates/puzzle/AGENTS.md +10 -9
- package/templates/puzzle/CLAUDE.md +10 -9
- package/templates/puzzle/package.json +11 -9
- package/templates/puzzle/playtests/boot-failure.playtest.json +2 -2
- package/templates/puzzle/playtests/lit.playtest.json +7 -1
- package/templates/puzzle/playtests/performance.playtest.json +7 -1
- package/templates/puzzle/src/render/autoExposure.ts +225 -0
- package/templates/puzzle/src/render/backlightControls.ts +66 -0
- package/templates/puzzle/src/render/backlightMaterial.ts +147 -0
- package/templates/puzzle/src/render/environmentContribution.ts +188 -0
- package/templates/puzzle/src/render/environmentRadiance.ts +36 -0
- package/templates/puzzle/src/render/environmentSampleCache.ts +43 -0
- package/templates/puzzle/src/render/environmentSampling.ts +193 -0
- package/templates/puzzle/src/render/environmentSnapshot.ts +53 -0
- package/templates/puzzle/src/render/exposure.ts +111 -0
- package/templates/puzzle/src/render/exposureGraph.ts +178 -0
- package/templates/puzzle/src/render/exposureReadback.ts +79 -0
- package/templates/puzzle/src/render/heightFog.ts +118 -0
- package/templates/puzzle/src/render/lighting.ts +33 -1
- package/templates/puzzle/src/render/materialAssignments.ts +160 -0
- package/templates/puzzle/src/render/materialLighting.ts +155 -0
- package/templates/puzzle/src/render/materials.ts +1 -1
- package/templates/puzzle/src/render/postprocessing.ts +8 -2
- package/templates/puzzle/src/render/quality.ts +62 -1
- package/templates/puzzle/src/render/sky.ts +20 -1
- package/templates/puzzle/src/render/worldEnvironment.ts +433 -30
- package/templates/puzzle/src/scenes/Play.ts +51 -2
- package/templates/puzzle/vite.config.ts +10 -2
- package/templates/racing/AGENTS.md +8 -7
- package/templates/racing/CLAUDE.md +8 -7
- package/templates/racing/package.json +11 -9
- package/templates/racing/playtests/performance.playtest.json +7 -1
- package/templates/racing/playtests/survives.playtest.json +6 -0
- package/templates/racing/src/render/autoExposure.ts +225 -0
- package/templates/racing/src/render/backlightControls.ts +66 -0
- package/templates/racing/src/render/backlightMaterial.ts +147 -0
- package/templates/racing/src/render/environmentContribution.ts +188 -0
- package/templates/racing/src/render/environmentRadiance.ts +36 -0
- package/templates/racing/src/render/environmentSampleCache.ts +43 -0
- package/templates/racing/src/render/environmentSampling.ts +193 -0
- package/templates/racing/src/render/environmentSnapshot.ts +53 -0
- package/templates/racing/src/render/exposure.ts +111 -0
- package/templates/racing/src/render/exposureGraph.ts +178 -0
- package/templates/racing/src/render/exposureReadback.ts +79 -0
- package/templates/racing/src/render/heightFog.ts +118 -0
- package/templates/racing/src/render/lighting.ts +29 -1
- package/templates/racing/src/render/materialAssignments.ts +160 -0
- package/templates/racing/src/render/materialLighting.ts +155 -0
- package/templates/racing/src/render/palette.ts +1 -10
- package/templates/racing/src/render/postprocessing.ts +17 -2
- package/templates/racing/src/render/quality.ts +61 -2
- package/templates/racing/src/render/shapes.ts +0 -25
- package/templates/racing/src/render/sky.ts +21 -1
- package/templates/racing/src/render/worldEnvironment.ts +433 -30
- package/templates/racing/src/scenes/Race.ts +91 -3
- package/templates/racing/src/track/circuit.ts +0 -9
- package/templates/racing/vite.config.ts +10 -2
- package/templates/rain/.codex/config.toml +19 -0
- package/templates/rain/.cursor/mcp.json +32 -0
- package/templates/rain/.gemini/settings.json +32 -0
- package/templates/rain/.mcp.json +32 -0
- package/templates/rain/.vscode/mcp.json +36 -0
- package/templates/rain/.zed/settings.json +36 -0
- package/templates/rain/AGENTS.md +95 -0
- package/templates/rain/CLAUDE.md +97 -0
- package/templates/rain/assets/rain-loop.wav +0 -0
- package/templates/rain/assets/thunder.wav +0 -0
- package/templates/rain/assets/wind-loop.wav +0 -0
- package/templates/rain/index.html +18 -0
- package/templates/rain/kit.json +7 -0
- package/templates/rain/native-playtests/boot.playtest.json +23 -0
- package/templates/rain/native-playtests/lightning.playtest.json +173 -0
- package/templates/rain/opencode.json +41 -0
- package/templates/rain/package.json +59 -0
- package/templates/rain/playtests/auto-lightning-clear.playtest.json +66 -0
- package/templates/rain/playtests/auto-lightning.playtest.json +26 -0
- package/templates/rain/playtests/automation.playtest.json +133 -0
- package/templates/rain/playtests/cinematic.playtest.json +59 -0
- package/templates/rain/playtests/flash.playtest.json +27 -0
- package/templates/rain/playtests/fly.playtest.json +54 -0
- package/templates/rain/playtests/lightning.playtest.json +220 -0
- package/templates/rain/playtests/loading.playtest.json +57 -0
- package/templates/rain/playtests/paused.playtest.json +59 -0
- package/templates/rain/playtests/performance.playtest.json +32 -0
- package/templates/rain/playtests/reduced-motion.playtest.json +87 -0
- package/templates/rain/playtests/simulation.playtest.json +20 -0
- package/templates/rain/playtests/storm.playtest.json +150 -0
- package/templates/rain/playtests/survives.playtest.json +58 -0
- package/templates/rain/playtests/tiers.playtest.json +194 -0
- package/templates/rain/playtests/weather.playtest.json +77 -0
- package/templates/rain/public/favicon.svg +5 -0
- package/templates/rain/src/audio/storm.ts +314 -0
- package/templates/rain/src/game.ts +81 -0
- package/templates/rain/src/main.ts +15 -0
- package/templates/rain/src/render/autoExposure.ts +225 -0
- package/templates/rain/src/render/bloom-shader.ts +65 -0
- package/templates/rain/src/render/camera.ts +160 -0
- package/templates/rain/src/render/clouds-shader.ts +242 -0
- package/templates/rain/src/render/clouds.ts +142 -0
- package/templates/rain/src/render/exposure.ts +111 -0
- package/templates/rain/src/render/exposureGraph.ts +178 -0
- package/templates/rain/src/render/exposureReadback.ts +79 -0
- package/templates/rain/src/render/lighting.ts +39 -0
- package/templates/rain/src/render/lightning.ts +360 -0
- package/templates/rain/src/render/loading.ts +327 -0
- package/templates/rain/src/render/materials.ts +19 -0
- package/templates/rain/src/render/noise-volume.ts +159 -0
- package/templates/rain/src/render/palette.ts +18 -0
- package/templates/rain/src/render/post-shader.ts +178 -0
- package/templates/rain/src/render/postprocessing.ts +229 -0
- package/templates/rain/src/render/quality.ts +161 -0
- package/templates/rain/src/render/rain.ts +299 -0
- package/templates/rain/src/render/sky.ts +28 -0
- package/templates/rain/src/render/world-shader.ts +680 -0
- package/templates/rain/src/render/world.ts +146 -0
- package/templates/rain/src/render/worldEnvironment.ts +1212 -0
- package/templates/rain/src/scenes/Boot.ts +348 -0
- package/templates/rain/src/state.ts +261 -0
- package/templates/rain/src/style.css +1160 -0
- package/templates/rain/src/ui/App.tsx +29 -0
- package/templates/rain/src/ui/GameUi.tsx +187 -0
- package/templates/rain/src/ui/Hud.tsx +327 -0
- package/templates/rain/src/ui/LoadingOverlay.tsx +46 -0
- package/templates/rain/src/ui/Menu.tsx +370 -0
- package/templates/rain/src/ui/automation.ts +60 -0
- package/templates/rain/src/ui/main.tsx +7 -0
- package/templates/rain/src/ui/tempest.ts +149 -0
- package/templates/rain/tailwind.config.ts +2 -0
- package/templates/rain/threenative.config.ts +66 -0
- package/templates/rain/tools/generate-shaders.mjs +656 -0
- package/templates/rain/tools/make-storm-audio.mjs +387 -0
- package/templates/rain/tools/storm-dsp.mjs +177 -0
- package/templates/rain/tools/tempest-bloom.frag +10 -0
- package/templates/rain/tools/tempest-clouds.frag +86 -0
- package/templates/rain/tools/tempest-post.frag +47 -0
- package/templates/rain/tools/tempest-world.frag +210 -0
- package/templates/rain/tools/verify-noise-volume.mjs +61 -0
- package/templates/rain/tsconfig.json +17 -0
- package/templates/rain/vite.config.ts +45 -0
- package/templates/rts/AGENTS.md +10 -11
- package/templates/rts/CLAUDE.md +10 -11
- package/templates/rts/package.json +10 -8
- package/templates/rts/playtests/performance.playtest.json +7 -1
- package/templates/rts/playtests/rts-ai-attack.playtest.json +10 -1
- package/templates/rts/playtests/rts-attack.playtest.json +10 -1
- package/templates/rts/playtests/rts-build.playtest.json +10 -1
- package/templates/rts/playtests/rts-orders.playtest.json +7 -1
- package/templates/rts/playtests/rts-train.playtest.json +10 -1
- package/templates/rts/src/render/army.ts +10 -2
- package/templates/rts/src/render/autoExposure.ts +225 -0
- package/templates/rts/src/render/backlightControls.ts +66 -0
- package/templates/rts/src/render/backlightMaterial.ts +147 -0
- package/templates/rts/src/render/environmentContribution.ts +188 -0
- package/templates/rts/src/render/environmentRadiance.ts +36 -0
- package/templates/rts/src/render/environmentSampleCache.ts +43 -0
- package/templates/rts/src/render/environmentSampling.ts +193 -0
- package/templates/rts/src/render/environmentSnapshot.ts +53 -0
- package/templates/rts/src/render/exposure.ts +111 -0
- package/templates/rts/src/render/exposureGraph.ts +178 -0
- package/templates/rts/src/render/exposureReadback.ts +79 -0
- package/templates/rts/src/render/heightFog.ts +118 -0
- package/templates/rts/src/render/lighting.ts +26 -1
- package/templates/rts/src/render/materialAssignments.ts +160 -0
- package/templates/rts/src/render/materialLighting.ts +155 -0
- package/templates/rts/src/render/postprocessing.ts +8 -2
- package/templates/rts/src/render/quality.ts +61 -2
- package/templates/rts/src/render/sky.ts +21 -1
- package/templates/rts/src/render/worldEnvironment.ts +433 -30
- package/templates/rts/src/scenes/Play.ts +54 -3
- package/templates/rts/src/sim/ai.ts +0 -1
- package/templates/rts/src/sim/terrain.ts +0 -4
- package/templates/rts/vite.config.ts +10 -2
- package/templates/runner/AGENTS.md +10 -8
- package/templates/runner/CLAUDE.md +10 -8
- package/templates/runner/package.json +11 -9
- package/templates/runner/playtests/performance.playtest.json +10 -1
- package/templates/runner/src/physics.ts +0 -1
- package/templates/runner/src/render/autoExposure.ts +225 -0
- package/templates/runner/src/render/backlightControls.ts +66 -0
- package/templates/runner/src/render/backlightMaterial.ts +147 -0
- package/templates/runner/src/render/environmentContribution.ts +188 -0
- package/templates/runner/src/render/environmentRadiance.ts +36 -0
- package/templates/runner/src/render/environmentSampleCache.ts +43 -0
- package/templates/runner/src/render/environmentSampling.ts +193 -0
- package/templates/runner/src/render/environmentSnapshot.ts +53 -0
- package/templates/runner/src/render/exposure.ts +111 -0
- package/templates/runner/src/render/exposureGraph.ts +178 -0
- package/templates/runner/src/render/exposureReadback.ts +79 -0
- package/templates/runner/src/render/heightFog.ts +118 -0
- package/templates/runner/src/render/lighting.ts +26 -1
- package/templates/runner/src/render/materialAssignments.ts +160 -0
- package/templates/runner/src/render/materialLighting.ts +155 -0
- package/templates/runner/src/render/postprocessing.ts +17 -2
- package/templates/runner/src/render/quality.ts +61 -2
- package/templates/runner/src/render/sky.ts +21 -1
- package/templates/runner/src/render/worldEnvironment.ts +433 -30
- package/templates/runner/src/scenes/Run.ts +67 -2
- package/templates/runner/threenative.config.ts +3 -0
- package/templates/runner/vite.config.ts +10 -2
- package/templates/sailing/AGENTS.md +14 -13
- package/templates/sailing/CLAUDE.md +14 -13
- package/templates/sailing/native-playtests/survives.playtest.json +7 -0
- package/templates/sailing/package.json +11 -9
- package/templates/sailing/playtests/live/render-motion.playtest.json +30 -0
- package/templates/sailing/src/entities/Ship.ts +38 -18
- package/templates/sailing/src/render/autoExposure.ts +225 -0
- package/templates/sailing/src/render/backlightControls.ts +66 -0
- package/templates/sailing/src/render/backlightMaterial.ts +147 -0
- package/templates/sailing/src/render/camera.ts +12 -4
- package/templates/sailing/src/render/environmentContribution.ts +188 -0
- package/templates/sailing/src/render/environmentRadiance.ts +36 -0
- package/templates/sailing/src/render/environmentSampleCache.ts +43 -0
- package/templates/sailing/src/render/environmentSampling.ts +193 -0
- package/templates/sailing/src/render/environmentSetup.ts +24 -0
- package/templates/sailing/src/render/environmentSnapshot.ts +53 -0
- package/templates/sailing/src/render/exposure.ts +111 -0
- package/templates/sailing/src/render/exposureGraph.ts +178 -0
- package/templates/sailing/src/render/exposureReadback.ts +79 -0
- package/templates/sailing/src/render/heightFog.ts +118 -0
- package/templates/sailing/src/render/lighting.ts +26 -1
- package/templates/sailing/src/render/materialAssignments.ts +160 -0
- package/templates/sailing/src/render/materialLighting.ts +155 -0
- package/templates/sailing/src/render/ocean.ts +71 -53
- package/templates/sailing/src/render/postprocessing.ts +16 -2
- package/templates/sailing/src/render/props.ts +0 -45
- package/templates/sailing/src/render/quality.ts +61 -1
- package/templates/sailing/src/render/sky.ts +21 -1
- package/templates/sailing/src/render/worldEnvironment.ts +433 -30
- package/templates/sailing/src/scenes/Boot.ts +12 -1
- package/templates/sailing/src/scenes/Sailing.ts +87 -2
- package/templates/sailing/src/scenes/ocean-readiness.ts +68 -0
- package/templates/sailing/threenative.config.ts +3 -0
- package/templates/sailing/vite.config.ts +10 -2
- package/templates/shooter/AGENTS.md +8 -6
- package/templates/shooter/CLAUDE.md +8 -6
- package/templates/shooter/package.json +11 -9
- package/templates/shooter/playtests/performance.playtest.json +7 -1
- package/templates/shooter/src/entities/Enemy.ts +0 -15
- package/templates/shooter/src/entities/Rifle.ts +38 -1
- package/templates/shooter/src/render/autoExposure.ts +225 -0
- package/templates/shooter/src/render/backlightControls.ts +66 -0
- package/templates/shooter/src/render/backlightMaterial.ts +147 -0
- package/templates/shooter/src/render/camera.ts +1 -12
- package/templates/shooter/src/render/decals.ts +299 -5
- package/templates/shooter/src/render/environmentContribution.ts +188 -0
- package/templates/shooter/src/render/environmentRadiance.ts +36 -0
- package/templates/shooter/src/render/environmentSampleCache.ts +43 -0
- package/templates/shooter/src/render/environmentSampling.ts +193 -0
- package/templates/shooter/src/render/environmentSnapshot.ts +53 -0
- package/templates/shooter/src/render/exposure.ts +111 -0
- package/templates/shooter/src/render/exposureGraph.ts +178 -0
- package/templates/shooter/src/render/exposureReadback.ts +79 -0
- package/templates/shooter/src/render/gunfx.ts +0 -1
- package/templates/shooter/src/render/heightFog.ts +118 -0
- package/templates/shooter/src/render/lighting.ts +26 -1
- package/templates/shooter/src/render/materialAssignments.ts +160 -0
- package/templates/shooter/src/render/materialLighting.ts +155 -0
- package/templates/shooter/src/render/postprocessing.ts +17 -2
- package/templates/shooter/src/render/quality.ts +61 -2
- package/templates/shooter/src/render/scale.ts +2 -93
- package/templates/shooter/src/render/sky.ts +21 -1
- package/templates/shooter/src/render/vehicles.ts +0 -17
- package/templates/shooter/src/render/worldEnvironment.ts +433 -30
- package/templates/shooter/src/scenes/Play.ts +64 -2
- package/templates/shooter/vite.config.ts +10 -2
- package/templates/snow/.codex/config.toml +19 -0
- package/templates/snow/.cursor/mcp.json +32 -0
- package/templates/snow/.gemini/settings.json +32 -0
- package/templates/snow/.mcp.json +32 -0
- package/templates/snow/.vscode/mcp.json +36 -0
- package/templates/snow/.zed/settings.json +36 -0
- package/templates/snow/AGENTS.md +90 -0
- package/templates/snow/CLAUDE.md +92 -0
- package/templates/snow/README.md +26 -0
- package/templates/snow/assets/crunch.wav +0 -0
- package/templates/snow/assets/wind.wav +0 -0
- package/templates/snow/index.html +12 -0
- package/templates/snow/kit.json +7 -0
- package/templates/snow/native-playtests/snow-physics.playtest.json +150 -0
- package/templates/snow/native-playtests/survives.playtest.json +47 -0
- package/templates/snow/opencode.json +41 -0
- package/templates/snow/package.json +60 -0
- package/templates/snow/playtests/footsteps.playtest.json +95 -0
- package/templates/snow/playtests/performance.playtest.json +36 -0
- package/templates/snow/playtests/snow-physics.playtest.json +154 -0
- package/templates/snow/playtests/survives.playtest.json +56 -0
- package/templates/snow/playtests/touch-controls.playtest.json +71 -0
- package/templates/snow/playtests/weather.playtest.json +119 -0
- package/templates/snow/public/favicon.svg +5 -0
- package/templates/snow/src/audio.ts +58 -0
- package/templates/snow/src/commands.ts +8 -0
- package/templates/snow/src/entities/Explorer.ts +279 -0
- package/templates/snow/src/game.ts +69 -0
- package/templates/snow/src/main.ts +15 -0
- package/templates/snow/src/render/autoExposure.ts +225 -0
- package/templates/snow/src/render/backlightControls.ts +66 -0
- package/templates/snow/src/render/backlightMaterial.ts +147 -0
- package/templates/snow/src/render/bootPrint.ts +50 -0
- package/templates/snow/src/render/camera.ts +84 -0
- package/templates/snow/src/render/environmentContribution.ts +188 -0
- package/templates/snow/src/render/environmentRadiance.ts +36 -0
- package/templates/snow/src/render/environmentSampleCache.ts +43 -0
- package/templates/snow/src/render/environmentSampling.ts +193 -0
- package/templates/snow/src/render/environmentSnapshot.ts +53 -0
- package/templates/snow/src/render/explorer.ts +321 -0
- package/templates/snow/src/render/exposure.ts +111 -0
- package/templates/snow/src/render/exposureGraph.ts +178 -0
- package/templates/snow/src/render/exposureReadback.ts +79 -0
- package/templates/snow/src/render/heightFog.ts +118 -0
- package/templates/snow/src/render/lighting.ts +82 -0
- package/templates/snow/src/render/loading.ts +325 -0
- package/templates/snow/src/render/materialAssignments.ts +160 -0
- package/templates/snow/src/render/materialLighting.ts +155 -0
- package/templates/snow/src/render/materials.ts +36 -0
- package/templates/snow/src/render/palette.ts +17 -0
- package/templates/snow/src/render/postprocessing.ts +58 -0
- package/templates/snow/src/render/props.ts +42 -0
- package/templates/snow/src/render/quality.ts +193 -0
- package/templates/snow/src/render/scenery.ts +244 -0
- package/templates/snow/src/render/sky.ts +76 -0
- package/templates/snow/src/render/snowSurface.ts +259 -0
- package/templates/snow/src/render/touch-controls.ts +143 -0
- package/templates/snow/src/render/weather.ts +279 -0
- package/templates/snow/src/render/worldEnvironment.ts +1212 -0
- package/templates/snow/src/scenes/Boot.ts +12 -0
- package/templates/snow/src/scenes/Snow.ts +663 -0
- package/templates/snow/src/state.ts +46 -0
- package/templates/snow/src/style.css +143 -0
- package/templates/snow/src/terrain.ts +64 -0
- package/templates/snow/src/ui/App.tsx +15 -0
- package/templates/snow/src/ui/Controls.tsx +322 -0
- package/templates/snow/src/ui/GameUi.tsx +354 -0
- package/templates/snow/src/ui/icons.tsx +54 -0
- package/templates/snow/src/ui/main.tsx +7 -0
- package/templates/snow/tailwind.config.ts +2 -0
- package/templates/snow/threenative.config.ts +54 -0
- package/templates/snow/tsconfig.json +17 -0
- package/templates/snow/vite.config.ts +45 -0
- package/templates/starter/AGENTS.md +11 -16
- package/templates/starter/CLAUDE.md +11 -16
- package/templates/starter/native-playtests/react-hud.playtest.json +1 -1
- package/templates/starter/native-playtests/render-chain.playtest.json +51 -8
- package/templates/starter/native-playtests/smooth-motion.playtest.json +64 -0
- package/templates/starter/package.json +11 -9
- package/templates/starter/playtests/live/smooth-motion.playtest.json +63 -0
- package/templates/starter/playtests/movement.playtest.json +192 -0
- package/templates/starter/playtests/play.playtest.json +18 -2
- package/templates/starter/playtests/production-readiness.playtest.json +1 -1
- package/templates/starter/public/grade.cube +735 -0
- package/templates/starter/src/entities/Crate.ts +4 -0
- package/templates/starter/src/entities/Player.ts +79 -18
- package/templates/starter/src/game.ts +1 -0
- package/templates/starter/src/render/adaptiveQuality.ts +28 -41
- package/templates/starter/src/render/autoExposure.ts +225 -0
- package/templates/starter/src/render/backlightControls.ts +66 -0
- package/templates/starter/src/render/backlightMaterial.ts +147 -0
- package/templates/starter/src/render/environmentContribution.ts +188 -0
- package/templates/starter/src/render/environmentRadiance.ts +36 -0
- package/templates/starter/src/render/environmentSampleCache.ts +43 -0
- package/templates/starter/src/render/environmentSampling.ts +193 -0
- package/templates/starter/src/render/environmentSnapshot.ts +53 -0
- package/templates/starter/src/render/exposure.ts +111 -0
- package/templates/starter/src/render/exposureGraph.ts +178 -0
- package/templates/starter/src/render/exposureReadback.ts +79 -0
- package/templates/starter/src/render/grade.ts +157 -0
- package/templates/starter/src/render/heightFog.ts +118 -0
- package/templates/starter/src/render/lighting.ts +26 -1
- package/templates/starter/src/render/materialAssignments.ts +160 -0
- package/templates/starter/src/render/materialLighting.ts +155 -0
- package/templates/starter/src/render/postprocessing.ts +84 -4
- package/templates/starter/src/render/quality.ts +80 -8
- package/templates/starter/src/render/qualityPolicy.ts +54 -0
- package/templates/starter/src/render/rendererGate.ts +36 -0
- package/templates/starter/src/render/sky.ts +23 -1
- package/templates/starter/src/render/temporalAA.ts +197 -0
- package/templates/starter/src/render/temporalAAFrame.ts +179 -0
- package/templates/starter/src/render/temporalAAHooks.ts +101 -0
- package/templates/starter/src/render/temporalAAInput.ts +56 -0
- package/templates/starter/src/render/temporalAAResolve.ts +65 -0
- package/templates/starter/src/render/temporalAAStage.ts +76 -0
- package/templates/starter/src/render/temporalCurrentArea.ts +31 -0
- package/templates/starter/src/render/temporalCurrentFootprint.ts +198 -0
- package/templates/starter/src/render/temporalCurrentFootprintMath.ts +41 -0
- package/templates/starter/src/render/temporalCurrentProducer.ts +161 -0
- package/templates/starter/src/render/temporalCurrentReplay.ts +160 -0
- package/templates/starter/src/render/temporalCurrentSelection.ts +89 -0
- package/templates/starter/src/render/temporalCurrentVisibility.ts +170 -0
- package/templates/starter/src/render/temporalDepthSamples.ts +34 -0
- package/templates/starter/src/render/temporalRejectionCounter.ts +179 -0
- package/templates/starter/src/render/temporalResolve.ts +139 -0
- package/templates/starter/src/render/temporalResolveDepth.ts +193 -0
- package/templates/starter/src/render/temporalResolveMath.ts +196 -0
- package/templates/starter/src/render/volumetricFog.ts +124 -0
- package/templates/starter/src/render/volumetricFogOptions.ts +96 -0
- package/templates/starter/src/render/volumetricFogTransport.ts +176 -0
- package/templates/starter/src/render/volumetricFogVolume.ts +139 -0
- package/templates/starter/src/render/worldEnvironment.ts +433 -30
- package/templates/starter/src/scenes/Play.ts +110 -1
- package/templates/starter/src/state.ts +1 -0
- package/templates/starter/src/ui/Hud.tsx +1 -1
- package/templates/starter/src/ui/Menu.tsx +1 -1
- package/templates/starter/tools/make-grade-lut.mjs +101 -0
- package/templates/starter/vite.config.ts +10 -2
- package/templates/tower-defense/AGENTS.md +10 -9
- package/templates/tower-defense/CLAUDE.md +10 -9
- package/templates/tower-defense/package.json +11 -9
- package/templates/tower-defense/playtests/performance.playtest.json +7 -1
- package/templates/tower-defense/src/render/autoExposure.ts +225 -0
- package/templates/tower-defense/src/render/backlightControls.ts +66 -0
- package/templates/tower-defense/src/render/backlightMaterial.ts +147 -0
- package/templates/tower-defense/src/render/environmentContribution.ts +188 -0
- package/templates/tower-defense/src/render/environmentRadiance.ts +36 -0
- package/templates/tower-defense/src/render/environmentSampleCache.ts +43 -0
- package/templates/tower-defense/src/render/environmentSampling.ts +193 -0
- package/templates/tower-defense/src/render/environmentSnapshot.ts +53 -0
- package/templates/tower-defense/src/render/exposure.ts +111 -0
- package/templates/tower-defense/src/render/exposureGraph.ts +178 -0
- package/templates/tower-defense/src/render/exposureReadback.ts +79 -0
- package/templates/tower-defense/src/render/lighting.ts +33 -1
- package/templates/tower-defense/src/render/materialAssignments.ts +160 -0
- package/templates/tower-defense/src/render/materialLighting.ts +155 -0
- package/templates/tower-defense/src/render/postprocessing.ts +8 -2
- package/templates/tower-defense/src/render/quality.ts +61 -2
- package/templates/tower-defense/src/render/shapes.ts +0 -3
- package/templates/tower-defense/src/render/worldEnvironment.ts +433 -30
- package/templates/tower-defense/src/scenes/Battle.ts +65 -2
- package/templates/tower-defense/vite.config.ts +10 -2
- package/templates/minimal/src/scenes/Boot.ts +0 -5
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { UiLayer, useUiIntent, useUiState } from "@threenative/ui";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { type GameState, PROBE_COLUMNS } from "../state.js";
|
|
4
|
+
import { BallActions, Controls } from "./Controls.js";
|
|
5
|
+
import { Icon, Mark } from "./icons.js";
|
|
6
|
+
|
|
7
|
+
const VIEW_LABELS: Record<GameState["view"], string> = {
|
|
8
|
+
follow: "Follow view",
|
|
9
|
+
overhead: "Overhead view",
|
|
10
|
+
surface: "Surface view",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function IconButton({
|
|
14
|
+
icon,
|
|
15
|
+
label,
|
|
16
|
+
onClick,
|
|
17
|
+
pressed,
|
|
18
|
+
className = "",
|
|
19
|
+
}: {
|
|
20
|
+
readonly icon: Parameters<typeof Icon>[0]["name"];
|
|
21
|
+
readonly label: string;
|
|
22
|
+
readonly onClick: () => void;
|
|
23
|
+
readonly pressed?: boolean;
|
|
24
|
+
readonly className?: string;
|
|
25
|
+
}) {
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
aria-label={label}
|
|
29
|
+
aria-pressed={pressed}
|
|
30
|
+
className={`grid h-11 w-11 place-items-center rounded-full border backdrop-blur-md transition hover:brightness-110 ${
|
|
31
|
+
pressed ? "border-aqua text-aqua" : "border-[rgb(233_247_252/0.22)] text-text"
|
|
32
|
+
} bg-[rgb(21_41_54/0.37)] ${className}`}
|
|
33
|
+
data-tn-interactive
|
|
34
|
+
onClick={onClick}
|
|
35
|
+
title={label}
|
|
36
|
+
type="button"
|
|
37
|
+
>
|
|
38
|
+
<Icon name={icon} />
|
|
39
|
+
</button>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The last footprint's floor, drawn as a small depth map: darker blue is deeper. */
|
|
44
|
+
function Probe({ values }: { readonly values: readonly number[] }) {
|
|
45
|
+
const rows = Math.max(1, Math.ceil(values.length / PROBE_COLUMNS));
|
|
46
|
+
return (
|
|
47
|
+
<svg
|
|
48
|
+
aria-label="Depth map of the last footprint"
|
|
49
|
+
className="h-[113px] w-[89px] shrink-0 overflow-hidden rounded-[7px] border border-[#d5e2e955] bg-[#cbdce6]"
|
|
50
|
+
preserveAspectRatio="none"
|
|
51
|
+
role="img"
|
|
52
|
+
viewBox={`0 0 ${PROBE_COLUMNS} ${rows}`}
|
|
53
|
+
>
|
|
54
|
+
<defs>
|
|
55
|
+
{/* The grid is coarse; a slight blur reads as a pressed surface rather than pixels. */}
|
|
56
|
+
<filter id="probe-soften">
|
|
57
|
+
<feGaussianBlur stdDeviation="0.22" />
|
|
58
|
+
</filter>
|
|
59
|
+
</defs>
|
|
60
|
+
<g filter="url(#probe-soften)">
|
|
61
|
+
{values.map((value, index) => {
|
|
62
|
+
const shade = Math.max(0, Math.min(1, value / 0.18));
|
|
63
|
+
const bank = Math.max(0, Math.min(1, -value / 0.045));
|
|
64
|
+
const r = Math.round(214 - shade * 109 + bank * 33);
|
|
65
|
+
const g = Math.round(230 - shade * 92 + bank * 21);
|
|
66
|
+
const b = Math.round(240 - shade * 64 + bank * 15);
|
|
67
|
+
return (
|
|
68
|
+
<rect
|
|
69
|
+
fill={`rgb(${r} ${g} ${b})`}
|
|
70
|
+
height={1.02}
|
|
71
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a fixed grid whose cells never reorder.
|
|
72
|
+
key={index}
|
|
73
|
+
width={1.02}
|
|
74
|
+
x={index % PROBE_COLUMNS}
|
|
75
|
+
y={Math.floor(index / PROBE_COLUMNS)}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</g>
|
|
80
|
+
</svg>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function Metric({
|
|
85
|
+
label,
|
|
86
|
+
value,
|
|
87
|
+
unit,
|
|
88
|
+
}: { readonly label: string; readonly value: string; readonly unit?: string }) {
|
|
89
|
+
return (
|
|
90
|
+
<div>
|
|
91
|
+
<div className="mb-1 text-[9px] uppercase tracking-[0.14em] text-[#9cb7c4]">{label}</div>
|
|
92
|
+
<div className="text-[22px] font-[450] leading-none tracking-tight tabular-nums">
|
|
93
|
+
{value}
|
|
94
|
+
{unit === undefined ? null : (
|
|
95
|
+
<em className="ml-1 text-[10px] not-italic text-[#99b8c6]">{unit}</em>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function Help({ onClose }: { readonly onClose: () => void }) {
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
const close = (event: KeyboardEvent) => {
|
|
105
|
+
if (event.key === "Escape") onClose();
|
|
106
|
+
};
|
|
107
|
+
window.addEventListener("keydown", close);
|
|
108
|
+
return () => window.removeEventListener("keydown", close);
|
|
109
|
+
}, [onClose]);
|
|
110
|
+
return (
|
|
111
|
+
<div className="pointer-events-auto fixed inset-0 z-30 grid place-items-center bg-[#05182677] p-4 backdrop-blur-sm">
|
|
112
|
+
<dialog
|
|
113
|
+
aria-labelledby="help-title"
|
|
114
|
+
aria-modal="true"
|
|
115
|
+
className="static m-0 w-[420px] max-w-full rounded-[15px] border border-[#647f8e] bg-[#172f3d] p-7 text-[#dbe9ed] shadow-[0_35px_90px_#04121daa]"
|
|
116
|
+
open
|
|
117
|
+
>
|
|
118
|
+
<h2 className="m-0 mb-2 text-[23px] font-[450]" id="help-title">
|
|
119
|
+
Leave a little trace.
|
|
120
|
+
</h2>
|
|
121
|
+
<p className="text-[12px] leading-relaxed text-[#a9c0cd]">
|
|
122
|
+
Walk the glade, push the ball through the powder, or switch on the blizzard and watch the
|
|
123
|
+
tracks fill.
|
|
124
|
+
</p>
|
|
125
|
+
<table className="my-5 w-full border-collapse text-[12px]">
|
|
126
|
+
<tbody>
|
|
127
|
+
{[
|
|
128
|
+
["Walk / run", "WASD or arrows / Shift"],
|
|
129
|
+
["Orbit / zoom", "Drag / scroll"],
|
|
130
|
+
["Drop / push the ball", "F / G"],
|
|
131
|
+
["Blizzard / camera", "B / C"],
|
|
132
|
+
["Auto-explore / compaction", "P / V"],
|
|
133
|
+
["Clear footprints / sound", "R / M"],
|
|
134
|
+
].map(([action, keys]) => (
|
|
135
|
+
<tr className="border-b border-white/10" key={action}>
|
|
136
|
+
<td className="py-2">{action}</td>
|
|
137
|
+
<td className="py-2 text-right text-[#b5dbd5]">{keys}</td>
|
|
138
|
+
</tr>
|
|
139
|
+
))}
|
|
140
|
+
</tbody>
|
|
141
|
+
</table>
|
|
142
|
+
<p className="text-[11px] leading-relaxed text-[#a9c0cd]">
|
|
143
|
+
The snow is a deformable heightfield with approximate compaction and deposition, not a
|
|
144
|
+
granular solver.
|
|
145
|
+
</p>
|
|
146
|
+
<button
|
|
147
|
+
className="mt-2 min-h-11 w-full rounded-[7px] bg-aqua text-[12px] text-aqua-ink"
|
|
148
|
+
data-tn-interactive
|
|
149
|
+
// biome-ignore lint/a11y/noAutofocus: a modal moves focus to its one action.
|
|
150
|
+
autoFocus
|
|
151
|
+
onClick={onClose}
|
|
152
|
+
type="button"
|
|
153
|
+
>
|
|
154
|
+
Back to the snow
|
|
155
|
+
</button>
|
|
156
|
+
</dialog>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function Toast({ state }: { readonly state: GameState }) {
|
|
162
|
+
const [shown, setShown] = useState(false);
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (state.toastId === 0) return;
|
|
165
|
+
setShown(true);
|
|
166
|
+
const timer = setTimeout(() => setShown(false), 2800);
|
|
167
|
+
return () => clearTimeout(timer);
|
|
168
|
+
}, [state.toastId]);
|
|
169
|
+
return (
|
|
170
|
+
<output
|
|
171
|
+
aria-live="polite"
|
|
172
|
+
className={`fixed bottom-[100px] left-1/2 z-20 max-w-[85vw] -translate-x-1/2 rounded-[9px] border border-line bg-[rgb(16_35_46/0.88)] px-4 py-3 text-center text-[12px] backdrop-blur-lg transition-opacity max-[850px]:bottom-[250px] ${
|
|
173
|
+
shown ? "opacity-100" : "opacity-0"
|
|
174
|
+
}`}
|
|
175
|
+
>
|
|
176
|
+
{state.toast}
|
|
177
|
+
</output>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function Hud() {
|
|
182
|
+
const state = useUiState<GameState>();
|
|
183
|
+
const send = useUiIntent();
|
|
184
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
185
|
+
const [helpOpen, setHelpOpen] = useState(false);
|
|
186
|
+
if (state === undefined) return null;
|
|
187
|
+
const weatherWords = state.blizzard ? "Incoming gusts · spindrift" : "Light air · dry powder";
|
|
188
|
+
return (
|
|
189
|
+
<div className="pointer-events-none absolute inset-0 select-none text-text">
|
|
190
|
+
{/* Vignette and storm veil: atmosphere only, never in the way of a click. */}
|
|
191
|
+
<div className="absolute inset-0 bg-[linear-gradient(90deg,rgb(5_20_31/0.24),transparent_42%),linear-gradient(0deg,rgb(9_24_35/0.46),transparent_18%,transparent_80%,rgb(7_22_32/0.18))]" />
|
|
192
|
+
{/* A soft scrim under the header and readouts keeps small light text legible over snow. */}
|
|
193
|
+
<div className="absolute inset-x-0 top-0 h-[210px] bg-[linear-gradient(180deg,rgb(10_26_36/0.42),transparent)]" />
|
|
194
|
+
<div
|
|
195
|
+
className="absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_30%,rgb(224_239_246/0.23))]"
|
|
196
|
+
style={{ opacity: state.storm * 0.8 }}
|
|
197
|
+
/>
|
|
198
|
+
|
|
199
|
+
<header className="absolute left-5 right-5 top-5 flex items-center justify-between gap-3 min-[851px]:left-[34px] min-[851px]:right-[34px] min-[851px]:top-[25px]">
|
|
200
|
+
<div className="flex min-w-0 items-center gap-3">
|
|
201
|
+
<div className="grid h-[38px] w-[38px] shrink-0 place-items-center rounded-[11px] border border-[rgb(238_246_250/0.55)] bg-[rgb(28_50_61/0.16)]">
|
|
202
|
+
<Mark />
|
|
203
|
+
</div>
|
|
204
|
+
<div className="min-w-0">
|
|
205
|
+
<div className="truncate text-[15px] font-semibold tracking-[0.26em]">SNOW GLADE</div>
|
|
206
|
+
<div className="mt-1 truncate text-[9px] tracking-[0.2em] opacity-80">
|
|
207
|
+
DEFORMABLE SNOW STUDY
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
<div className="flex shrink-0 items-center gap-2">
|
|
212
|
+
<div className="mr-1 hidden items-center gap-2 rounded-full border border-[rgb(222_242_249/0.25)] bg-[rgb(20_39_51/0.24)] px-4 py-2.5 text-[10px] tracking-[0.13em] backdrop-blur-md min-[560px]:flex">
|
|
213
|
+
<span
|
|
214
|
+
className={`h-[5px] w-[5px] rounded-full ${state.paused ? "bg-[#c4c6c0]" : "bg-aqua shadow-[0_0_9px_rgb(159_226_204/0.5)]"}`}
|
|
215
|
+
/>
|
|
216
|
+
<span>{state.paused ? "SIMULATION PAUSED" : "LIVE SIMULATION"}</span>
|
|
217
|
+
</div>
|
|
218
|
+
<IconButton
|
|
219
|
+
icon={state.muted ? "muted" : "sound"}
|
|
220
|
+
label={state.muted ? "Turn sound on" : "Turn sound off"}
|
|
221
|
+
onClick={() => send("mute")}
|
|
222
|
+
pressed={!state.muted}
|
|
223
|
+
/>
|
|
224
|
+
<IconButton
|
|
225
|
+
className="max-[850px]:hidden"
|
|
226
|
+
icon="help"
|
|
227
|
+
label="Controls and notes"
|
|
228
|
+
onClick={() => setHelpOpen(true)}
|
|
229
|
+
/>
|
|
230
|
+
<IconButton
|
|
231
|
+
className="min-[851px]:hidden"
|
|
232
|
+
icon={menuOpen ? "close" : "menu"}
|
|
233
|
+
label={menuOpen ? "Close settings" : "Open settings"}
|
|
234
|
+
onClick={() => setMenuOpen(!menuOpen)}
|
|
235
|
+
pressed={menuOpen}
|
|
236
|
+
/>
|
|
237
|
+
</div>
|
|
238
|
+
</header>
|
|
239
|
+
|
|
240
|
+
{/* Left column: title, then the controls. On a phone the controls live behind the menu. */}
|
|
241
|
+
<section className="absolute bottom-[98px] left-[34px] top-[120px] w-[285px] [@media(max-height:800px)]:top-[92px] [@media(max-height:800px)]:bottom-[84px] overflow-y-auto [scrollbar-width:none] max-[1100px]:w-[264px] max-[850px]:left-4 max-[850px]:right-4 max-[850px]:top-[84px] max-[850px]:w-auto max-[850px]:bottom-[88px]">
|
|
242
|
+
<div
|
|
243
|
+
className={`mb-6 [text-shadow:0_1px_10px_rgb(16_40_54/0.35)] max-[850px]:mb-3 [@media(max-height:800px)]:mb-5 ${menuOpen ? "max-[850px]:hidden" : ""}`}
|
|
244
|
+
>
|
|
245
|
+
<div className="text-[9px] font-medium tracking-[0.28em] text-[#dfedf2]">
|
|
246
|
+
A STUDY IN WINTER
|
|
247
|
+
</div>
|
|
248
|
+
<h1 className="mb-3 mt-3 text-[46px] font-[450] leading-[1.04] tracking-[-0.05em] max-[1100px]:text-[40px] max-[850px]:text-[32px] [@media(max-height:800px)]:mb-0 [@media(max-height:800px)]:mt-2 [@media(max-height:800px)]:text-[30px]">
|
|
249
|
+
Snow,
|
|
250
|
+
<br className="[@media(max-height:800px)]:hidden" />{" "}
|
|
251
|
+
<span className="font-light text-[#e2eef1]">in motion.</span>
|
|
252
|
+
</h1>
|
|
253
|
+
<p className="m-0 max-w-[250px] text-[12px] leading-[1.7] opacity-90 max-[850px]:hidden [@media(max-height:800px)]:hidden">
|
|
254
|
+
Fresh powder. Every step remembered. A ball that carves its own track.
|
|
255
|
+
</p>
|
|
256
|
+
</div>
|
|
257
|
+
<div className={`pointer-events-auto ${menuOpen ? "" : "max-[850px]:hidden"}`}>
|
|
258
|
+
<Controls send={send} state={state} />
|
|
259
|
+
<p className="mt-3 text-[10px] tracking-[0.05em] text-[#e2ecf0] opacity-90 [text-shadow:0_1px_5px_#264452] max-[850px]:hidden">
|
|
260
|
+
Take over at any time with WASD.
|
|
261
|
+
</p>
|
|
262
|
+
</div>
|
|
263
|
+
</section>
|
|
264
|
+
|
|
265
|
+
<div
|
|
266
|
+
className={`absolute right-[34px] top-[103px] text-right [text-shadow:0_1px_3px_rgb(10_30_40/0.55),0_0_12px_rgb(16_40_54/0.35)] max-[850px]:right-4 max-[850px]:top-[84px] ${menuOpen ? "max-[850px]:hidden" : ""}`}
|
|
267
|
+
>
|
|
268
|
+
<div className="text-[28px] font-light leading-none tabular-nums">
|
|
269
|
+
{state.windNow.toFixed(1)}
|
|
270
|
+
<small className="ml-0.5 text-[10px] opacity-80">m/s</small>
|
|
271
|
+
</div>
|
|
272
|
+
<div className="mt-2 text-[9px] font-medium tracking-[0.2em]">WIND AT SNOWFIELD</div>
|
|
273
|
+
<div className="mt-1.5 text-[9px] font-medium uppercase tracking-[0.18em] opacity-90">
|
|
274
|
+
{weatherWords}
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<aside
|
|
279
|
+
aria-label="Snow readouts"
|
|
280
|
+
className="pointer-events-auto absolute bottom-[115px] right-[31px] w-[236px] rounded-[15px] border border-line bg-panel p-4 backdrop-blur-xl max-[1100px]:w-[216px] max-[850px]:hidden"
|
|
281
|
+
>
|
|
282
|
+
<div className="mb-3 flex items-center justify-between text-[9px] tracking-[0.2em] text-[#c2d6e0]">
|
|
283
|
+
<span>LAST FOOTFALL</span>
|
|
284
|
+
<i className="h-[5px] w-[5px] rounded-full bg-aqua" />
|
|
285
|
+
</div>
|
|
286
|
+
<div className="flex items-center gap-4">
|
|
287
|
+
<Probe values={state.probe} />
|
|
288
|
+
<div className="flex flex-col gap-3">
|
|
289
|
+
<Metric label="Boot sink" unit="cm" value={(state.lastSink * 100).toFixed(1)} />
|
|
290
|
+
<Metric label="Contacts" value={state.contacts.toLocaleString("en-US")} />
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
<div className="mt-3 flex justify-between border-t border-line pt-3 text-[10px] text-[#9ebac8]">
|
|
294
|
+
<span>Ground speed</span>
|
|
295
|
+
<span className="tabular-nums text-[#d0e7e7]">{state.speed.toFixed(2)} m/s</span>
|
|
296
|
+
</div>
|
|
297
|
+
<div className="mt-4 flex items-center justify-between border-t border-line pt-3 text-[9px] tracking-[0.2em] text-[#c2d6e0]">
|
|
298
|
+
<span>BALL</span>
|
|
299
|
+
<span className="text-[10px] tracking-normal tabular-nums text-[#d0e7e7]">
|
|
300
|
+
{(state.ballSink * 100).toFixed(1)} cm · {Math.round(state.ballLoad)} N
|
|
301
|
+
</span>
|
|
302
|
+
</div>
|
|
303
|
+
<div className="mt-3">
|
|
304
|
+
<BallActions send={send} />
|
|
305
|
+
</div>
|
|
306
|
+
</aside>
|
|
307
|
+
|
|
308
|
+
<footer className="absolute bottom-[26px] left-[34px] right-[34px] flex items-center justify-between gap-4 max-[850px]:bottom-4 max-[850px]:left-4 max-[850px]:right-4">
|
|
309
|
+
<div className="min-w-[200px] text-[9px] tracking-[0.2em] text-[#e0ecf1] opacity-80 [text-shadow:0_1px_5px_#264452] max-[1100px]:invisible max-[850px]:hidden">
|
|
310
|
+
THREENATIVE <span className="text-[#b9d8de]">/</span> SNOW STUDY
|
|
311
|
+
</div>
|
|
312
|
+
<div className="flex items-center gap-4 rounded-full border border-[rgb(210_233_244/0.18)] bg-[rgb(17_35_46/0.59)] px-[18px] py-[11px] text-[11px] text-[#d8e5eb] backdrop-blur-xl max-[850px]:hidden">
|
|
313
|
+
{[
|
|
314
|
+
["W A S D", "Walk"],
|
|
315
|
+
["SHIFT", "Run"],
|
|
316
|
+
["F / G", "Ball"],
|
|
317
|
+
["B", "Blizzard"],
|
|
318
|
+
["DRAG", "Orbit"],
|
|
319
|
+
].map(([key, action]) => (
|
|
320
|
+
<span className="flex items-center gap-1.5 whitespace-nowrap" key={action}>
|
|
321
|
+
<kbd className="rounded border border-[rgb(206_232_244/0.35)] px-1 py-0.5 font-sans text-[9px] text-[#e6f1f5]">
|
|
322
|
+
{key}
|
|
323
|
+
</kbd>
|
|
324
|
+
{action}
|
|
325
|
+
</span>
|
|
326
|
+
))}
|
|
327
|
+
</div>
|
|
328
|
+
<div className="flex min-w-[150px] justify-end max-[850px]:w-full">
|
|
329
|
+
<button
|
|
330
|
+
className="pointer-events-auto flex min-h-11 items-center gap-2 rounded-[9px] border border-line bg-[rgb(20_39_50/0.75)] px-3.5 text-[11px] backdrop-blur-md transition hover:brightness-110"
|
|
331
|
+
data-tn-interactive
|
|
332
|
+
onClick={() => send("view")}
|
|
333
|
+
title="Cycle camera view (C)"
|
|
334
|
+
type="button"
|
|
335
|
+
>
|
|
336
|
+
<Icon name="camera" />
|
|
337
|
+
{VIEW_LABELS[state.view]}
|
|
338
|
+
</button>
|
|
339
|
+
</div>
|
|
340
|
+
</footer>
|
|
341
|
+
|
|
342
|
+
<Toast state={state} />
|
|
343
|
+
{helpOpen ? <Help onClose={() => setHelpOpen(false)} /> : null}
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export function GameUi() {
|
|
349
|
+
return (
|
|
350
|
+
<UiLayer>
|
|
351
|
+
<Hud />
|
|
352
|
+
</UiLayer>
|
|
353
|
+
);
|
|
354
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Stroke icons drawn at 24 px; colour follows the text around them.
|
|
2
|
+
const PATHS = {
|
|
3
|
+
blizzard: "M3 8h13a3 3 0 1 0-3-3M2 12h17a3 3 0 1 1-3 3M4 17h6",
|
|
4
|
+
camera: "M3 8h4l2-3h6l2 3h4v12H3V8zM12 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
|
|
5
|
+
drop: "M12 3v12M7 10l5 5 5-5M5 20h14",
|
|
6
|
+
help: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9.5 9a2.5 2.5 0 1 1 4.5 1.5c-1.4 1-2 1-2 3M12 17h.01",
|
|
7
|
+
menu: "M4 6h16M4 12h16M4 18h16",
|
|
8
|
+
muted: "M11 5L6 9H3v6h3l5 4V5zM16 9l5 6m0-6l-5 6",
|
|
9
|
+
pause: "M8 5v14M16 5v14",
|
|
10
|
+
play: "M8 5l11 7-11 7V5z",
|
|
11
|
+
push: "M4 12h12M12 7l5 5-5 5M20 5v14",
|
|
12
|
+
reset: "M3 10a9 9 0 1 1 2 8M3 4v6h6",
|
|
13
|
+
snow: "M12 3v18M4.2 7.5l15.6 9M4.2 16.5l15.6-9M9 5l3 3 3-3m-6 14l3-3 3 3",
|
|
14
|
+
sound: "M11 5L6 9H3v6h3l5 4V5zM15 8a6 6 0 0 1 0 8m3-11a10 10 0 0 1 0 14",
|
|
15
|
+
close: "M6 6l12 12M18 6L6 18",
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
export type IconName = keyof typeof PATHS;
|
|
19
|
+
|
|
20
|
+
export function Icon({
|
|
21
|
+
name,
|
|
22
|
+
className = "h-[17px] w-[17px]",
|
|
23
|
+
}: { name: IconName; className?: string }) {
|
|
24
|
+
return (
|
|
25
|
+
<svg
|
|
26
|
+
aria-hidden="true"
|
|
27
|
+
className={`shrink-0 ${className}`}
|
|
28
|
+
fill="none"
|
|
29
|
+
stroke="currentColor"
|
|
30
|
+
strokeLinecap="round"
|
|
31
|
+
strokeLinejoin="round"
|
|
32
|
+
strokeWidth={1.6}
|
|
33
|
+
viewBox="0 0 24 24"
|
|
34
|
+
>
|
|
35
|
+
<path d={PATHS[name]} />
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The snowflake mark beside the title. */
|
|
41
|
+
export function Mark() {
|
|
42
|
+
return (
|
|
43
|
+
<svg
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
className="h-[25px] w-[25px]"
|
|
46
|
+
fill="none"
|
|
47
|
+
stroke="#f0f7f8"
|
|
48
|
+
strokeWidth={1.25}
|
|
49
|
+
viewBox="0 0 32 32"
|
|
50
|
+
>
|
|
51
|
+
<path d="M16 3v26M4.7 9.5l22.6 13M4.7 22.5l22.6-13M12 6l4 4 4-4M12 26l4-4 4 4M6 14l5-1-1-5M26 18l-5 1 1 5M6 18l5 1-1 5M26 14l-5-1 1-5" />
|
|
52
|
+
</svg>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { IThreeNativeConfig } from "@threenative/core";
|
|
2
|
+
|
|
3
|
+
const config: IThreeNativeConfig = {
|
|
4
|
+
// Pinned to the legacy engine: the native engine does not bind three BufferGeometryUtils.mergeGeometries, three/tsl Return, atomicAdd, atomicLoad, deltaTime and log 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
|
+
app: {
|
|
8
|
+
id: "com.threenative.__PROJECT_ID__",
|
|
9
|
+
name: "__PROJECT_NAME__",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
build: 1,
|
|
12
|
+
icon: "public/icon.png",
|
|
13
|
+
icons: { web: { favicon: "public/favicon.svg" } },
|
|
14
|
+
},
|
|
15
|
+
display: {
|
|
16
|
+
orientation: "landscape",
|
|
17
|
+
fullscreen: true,
|
|
18
|
+
keepScreenOn: true,
|
|
19
|
+
maxFps: 60,
|
|
20
|
+
},
|
|
21
|
+
window: {
|
|
22
|
+
title: "__PROJECT_NAME__",
|
|
23
|
+
width: 1280,
|
|
24
|
+
height: 720,
|
|
25
|
+
maximized: false,
|
|
26
|
+
resizable: true,
|
|
27
|
+
},
|
|
28
|
+
bootSplash: { backgroundColor: "#0c1c28" },
|
|
29
|
+
nativeEntry: "src/game.ts",
|
|
30
|
+
renderer: {
|
|
31
|
+
preferWebGPU: true,
|
|
32
|
+
resolutionScale: "auto",
|
|
33
|
+
// Multisampling resolves triangle edges. A cutout silhouette — foliage, a fence, hair — is
|
|
34
|
+
// carved inside the triangle by an alpha test, so it resolves through the coverage mask or
|
|
35
|
+
// not at all, which is what this spends the samples above on. It costs no target and no
|
|
36
|
+
// extra pass; set it false for a deliberately hard-edged look. `TN_ALPHA_ANTIALIASING`
|
|
37
|
+
// reports what it did, and says so when a single-sampled surface leaves it nothing to do.
|
|
38
|
+
alphaAntialiasing: true,
|
|
39
|
+
},
|
|
40
|
+
ui: { renderer: "web" },
|
|
41
|
+
// One asset tree, one compiler, one representation per artifact. Uncomment, then cook:
|
|
42
|
+
// threenative build --target android # cooks defaults.android; --profile <name> beats it
|
|
43
|
+
// buildProfiles: {
|
|
44
|
+
// defaults: { android: "compact" },
|
|
45
|
+
// profiles: {
|
|
46
|
+
// compact: {
|
|
47
|
+
// assets: { textures: { maxSize: 1024 }, models: { textures: { maxSize: 1024 } } },
|
|
48
|
+
// } },
|
|
49
|
+
// },
|
|
50
|
+
// Contract, byte definitions, the build report:
|
|
51
|
+
// node_modules/create-threenative/agent-docs/references/build-profiles.md
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noUncheckedIndexedAccess": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"isolatedModules": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "*.ts"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
2
|
+
import { watchAssets } from "@threenative/assets";
|
|
3
|
+
import react from "@vitejs/plugin-react";
|
|
4
|
+
import {
|
|
5
|
+
createEngineFreshnessPlugin,
|
|
6
|
+
createWebBrandPlugin,
|
|
7
|
+
webRuntimeDecoders,
|
|
8
|
+
} from "create-threenative";
|
|
9
|
+
import { defineConfig } from "vite";
|
|
10
|
+
import type { Plugin } from "vite";
|
|
11
|
+
import config from "./threenative.config.js";
|
|
12
|
+
|
|
13
|
+
function assetsWatchPlugin(): Plugin {
|
|
14
|
+
return {
|
|
15
|
+
name: "threenative-assets-watch",
|
|
16
|
+
apply: "serve",
|
|
17
|
+
async configureServer(server) {
|
|
18
|
+
const handle = watchAssets({
|
|
19
|
+
config: config.assets,
|
|
20
|
+
cwd: server.config.root,
|
|
21
|
+
runtimeDecoders: webRuntimeDecoders(config),
|
|
22
|
+
});
|
|
23
|
+
server.httpServer?.once("close", () => handle.close());
|
|
24
|
+
// Nothing is served before the first cook settles: until it does, `public/` has no
|
|
25
|
+
// `assets.manifest.json` and every asset answers from its source fallback.
|
|
26
|
+
await handle.ready;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
plugins: [
|
|
33
|
+
createEngineFreshnessPlugin(),
|
|
34
|
+
createWebBrandPlugin(),
|
|
35
|
+
react(),
|
|
36
|
+
tailwindcss(),
|
|
37
|
+
assetsWatchPlugin(),
|
|
38
|
+
],
|
|
39
|
+
server: {
|
|
40
|
+
watch: {
|
|
41
|
+
ignored: ["**/artifacts/**", "**/screenshots/**", "**/playtests/**"],
|
|
42
|
+
usePolling: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|