create-threenative 0.2.2 → 0.2.4
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/LICENSE +21 -0
- package/README.md +61 -2
- package/agent-docs/references/assertion-reference.md +819 -0
- package/agent-docs/references/capability-reference.md +4483 -0
- package/agent-docs/references/capture-the-frame.md +60 -0
- package/agent-docs/references/creating-creatures.md +215 -0
- package/agent-docs/references/ctx-cookbook.md +120 -0
- package/agent-docs/references/debug-surface.md +68 -0
- package/agent-docs/references/dream-loop.md +150 -0
- package/agent-docs/references/finding-assets.md +215 -0
- package/agent-docs/references/gameplay-recipes.md +54 -0
- package/agent-docs/references/menu-screens.md +69 -0
- package/agent-docs/references/mobile-memory-budget.md +87 -0
- package/agent-docs/references/sculpt-from-a-reference.md +40 -0
- package/agent-docs/references/trace-a-slow-frame.md +99 -0
- package/agent-docs/references/visual-baseline.md +174 -0
- package/agent-docs/references/webview-ui.md +113 -0
- package/agent-files/.agents/skills/file-engine-bug/SKILL.md +59 -0
- package/agent-files/.agents/skills/prd-creator/SKILL.md +40 -0
- package/agent-files/.agents/skills/threenative-assets/SKILL.md +45 -0
- package/agent-files/.agents/skills/threenative-builder/SKILL.md +7 -0
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +27 -0
- package/agent-files/.agents/skills/threenative-context/SKILL.md +57 -0
- package/agent-files/.agents/skills/threenative-performance/SKILL.md +42 -0
- package/agent-files/.agents/skills/threenative-playtest/SKILL.md +44 -0
- package/agent-files/.agents/skills/threenative-ui/SKILL.md +20 -0
- package/agent-files/.agents/skills/threenative-verifier/SKILL.md +7 -0
- package/agent-files/.agents/skills/threenative-visuals/SKILL.md +41 -0
- package/agent-files/.claude/agents/threenative-builder.md +7 -0
- package/agent-files/.claude/agents/threenative-verifier.md +7 -0
- package/agent-files/.claude/skills/file-engine-bug/SKILL.md +59 -0
- package/agent-files/.claude/skills/prd-creator/SKILL.md +40 -0
- package/agent-files/.claude/skills/threenative-assets/SKILL.md +45 -0
- package/agent-files/.claude/skills/threenative-capabilities/SKILL.md +27 -0
- package/agent-files/.claude/skills/threenative-context/SKILL.md +57 -0
- package/agent-files/.claude/skills/threenative-performance/SKILL.md +42 -0
- package/agent-files/.claude/skills/threenative-playtest/SKILL.md +44 -0
- package/agent-files/.claude/skills/threenative-ui/SKILL.md +20 -0
- package/agent-files/.claude/skills/threenative-visuals/SKILL.md +41 -0
- package/agent-files/.threenative/agents/builder.md +32 -0
- package/agent-files/.threenative/agents/verifier.md +31 -0
- package/agent-files/AGENT-ROLES.md +26 -0
- package/agent-files/scripts/reference.mjs +705 -0
- package/agent-files/scripts/visual-loop.mjs +382 -0
- package/capabilities.json +5292 -0
- package/dist/index.d.ts +224 -3
- package/dist/index.js +1972 -73
- package/dist/threenative.d.ts +9 -2
- package/dist/threenative.js +2570 -176
- package/package.json +55 -6
- package/template-assets/icon.png +0 -0
- package/template-assets/loading.ts +325 -0
- package/template-assets/patches/three@0.185.1.patch +522 -0
- package/template-assets/worldEnvironment.ts +758 -0
- package/templates/action-rpg/.codex/config.toml +19 -0
- package/templates/action-rpg/.cursor/mcp.json +32 -0
- package/templates/action-rpg/.gemini/settings.json +32 -0
- package/templates/action-rpg/.mcp.json +18 -2
- package/templates/action-rpg/.vscode/mcp.json +36 -0
- package/templates/action-rpg/.zed/settings.json +36 -0
- package/templates/action-rpg/AGENTS.md +84 -29
- package/templates/action-rpg/CLAUDE.md +84 -29
- package/templates/action-rpg/index.html +0 -1
- package/templates/action-rpg/opencode.json +41 -0
- package/templates/action-rpg/package.json +15 -11
- package/templates/action-rpg/playtests/combat.playtest.json +32 -9
- package/templates/action-rpg/playtests/fail.playtest.json +3 -3
- package/templates/action-rpg/playtests/inventory.playtest.json +16 -10
- package/templates/action-rpg/playtests/performance.playtest.json +39 -0
- package/templates/action-rpg/playtests/progress.playtest.json +18 -13
- package/templates/action-rpg/playtests/survives.playtest.json +27 -0
- package/templates/action-rpg/playtests/touch-controls.playtest.json +42 -0
- package/templates/action-rpg/playtests/win.playtest.json +10 -4
- package/templates/action-rpg/src/conventions.ts +35 -0
- package/templates/action-rpg/src/entities/Enemy.ts +16 -7
- package/templates/action-rpg/src/entities/Player.ts +20 -3
- package/templates/action-rpg/src/game.ts +21 -0
- package/templates/action-rpg/src/render/camera.ts +7 -2
- package/templates/action-rpg/src/render/lighting.ts +11 -4
- package/templates/action-rpg/src/render/loading.ts +278 -43
- package/templates/action-rpg/src/render/materials.ts +11 -0
- package/templates/action-rpg/src/render/palette.ts +10 -3
- package/templates/action-rpg/src/render/postprocessing.ts +32 -16
- package/templates/action-rpg/src/render/quality.ts +170 -0
- package/templates/action-rpg/src/render/shapes.ts +185 -26
- package/templates/action-rpg/src/render/touch-controls.ts +185 -0
- package/templates/action-rpg/src/render/vfx.ts +257 -0
- package/templates/action-rpg/src/render/worldEnvironment.ts +758 -0
- package/templates/action-rpg/src/scenes/Play.ts +91 -24
- package/templates/action-rpg/src/state.ts +4 -0
- package/templates/action-rpg/src/style.css +65 -1
- package/templates/action-rpg/src/ui/AbilityBar.tsx +9 -7
- package/templates/action-rpg/src/ui/App.tsx +9 -8
- package/templates/action-rpg/src/ui/CharacterPanel.tsx +10 -8
- package/templates/action-rpg/src/ui/GameUi.tsx +24 -0
- package/templates/action-rpg/src/ui/Hud.tsx +10 -8
- package/templates/action-rpg/src/ui/InventoryPanel.tsx +9 -7
- package/templates/action-rpg/src/ui/main.tsx +14 -0
- package/templates/action-rpg/threenative.config.ts +28 -8
- package/templates/action-rpg/vite.config.ts +32 -2
- package/templates/defense/.codex/config.toml +19 -0
- package/templates/defense/.cursor/mcp.json +32 -0
- package/templates/defense/.gemini/settings.json +32 -0
- package/templates/defense/.mcp.json +18 -2
- package/templates/defense/.vscode/mcp.json +36 -0
- package/templates/defense/.zed/settings.json +36 -0
- package/templates/defense/AGENTS.md +81 -41
- package/templates/defense/CLAUDE.md +81 -41
- package/templates/defense/README.md +2 -1
- package/templates/defense/index.html +0 -1
- package/templates/defense/opencode.json +41 -0
- package/templates/defense/package.json +16 -12
- package/templates/defense/playtests/leak.playtest.json +9 -4
- package/templates/defense/playtests/performance.playtest.json +39 -0
- package/templates/defense/playtests/placement.playtest.json +5 -5
- package/templates/defense/playtests/pointer-placement.playtest.json +156 -0
- package/templates/defense/playtests/scan.playtest.json +4 -4
- package/templates/defense/playtests/survive.playtest.json +25 -6
- package/templates/defense/src/attackers/Attacker.ts +32 -16
- package/templates/defense/src/board/Route.ts +22 -8
- package/templates/defense/src/conventions.ts +18 -0
- package/templates/defense/src/entities/Player.ts +11 -3
- package/templates/defense/src/game.ts +25 -4
- package/templates/defense/src/physics.ts +9 -39
- package/templates/defense/src/placement/Buildable.ts +4 -4
- package/templates/defense/src/render/camera.ts +9 -3
- package/templates/defense/src/render/lighting.ts +6 -1
- package/templates/defense/src/render/loading.ts +274 -38
- package/templates/defense/src/render/materials.ts +9 -0
- package/templates/defense/src/render/palette.ts +12 -5
- package/templates/defense/src/render/postprocessing.ts +32 -12
- package/templates/defense/src/render/quality.ts +170 -0
- package/templates/defense/src/render/shapes.ts +180 -23
- package/templates/defense/src/render/sky.ts +2 -2
- package/templates/defense/src/render/worldEnvironment.ts +758 -0
- package/templates/defense/src/scenes/Boot.ts +2 -2
- package/templates/defense/src/scenes/Defense.ts +122 -56
- package/templates/defense/src/state.ts +6 -0
- package/templates/defense/src/style.css +65 -1
- package/templates/defense/src/towers/Tower.ts +11 -12
- package/templates/defense/src/towers/targeting.ts +1 -1
- package/templates/defense/src/ui/App.tsx +11 -6
- package/templates/defense/src/ui/GameUi.tsx +20 -0
- package/templates/defense/src/ui/Hud.tsx +6 -5
- package/templates/defense/src/ui/main.tsx +14 -0
- package/templates/defense/threenative.config.ts +28 -8
- package/templates/defense/vite.config.ts +34 -1
- package/templates/minimal/.codex/config.toml +19 -0
- package/templates/minimal/.cursor/mcp.json +32 -0
- package/templates/minimal/.gemini/settings.json +32 -0
- package/templates/minimal/.mcp.json +18 -2
- package/templates/minimal/.vscode/mcp.json +36 -0
- package/templates/minimal/.zed/settings.json +36 -0
- package/templates/minimal/AGENTS.md +78 -382
- package/templates/minimal/CLAUDE.md +78 -382
- package/templates/minimal/index.html +0 -1
- package/templates/minimal/opencode.json +41 -0
- package/templates/minimal/package.json +14 -11
- package/templates/minimal/playtests/atmosphere.playtest.json +32 -0
- package/templates/minimal/playtests/play.playtest.json +18 -5
- package/templates/minimal/playtests/survives.playtest.json +48 -4
- package/templates/minimal/playtests/touch-controls.playtest.json +42 -0
- package/templates/minimal/src/conventions.ts +18 -0
- package/templates/minimal/src/entities/Player.ts +39 -6
- package/templates/minimal/src/game.ts +1 -0
- package/templates/minimal/src/main.ts +14 -4
- package/templates/minimal/src/render/camera.ts +1 -1
- package/templates/minimal/src/render/hud.ts +24 -8
- package/templates/minimal/src/render/lighting.ts +23 -2
- package/templates/minimal/src/render/loading.ts +23 -103
- package/templates/minimal/src/render/materials.ts +7 -0
- package/templates/minimal/src/render/palette.ts +3 -3
- package/templates/minimal/src/render/postprocessing.ts +55 -16
- package/templates/minimal/src/render/quality.ts +162 -0
- package/templates/minimal/src/render/sky.ts +51 -32
- package/templates/minimal/src/render/touch-controls.ts +165 -0
- package/templates/minimal/src/render/worldEnvironment.ts +758 -0
- package/templates/minimal/src/scenes/Play.ts +128 -14
- package/templates/minimal/src/state.ts +8 -1
- package/templates/minimal/src/style.css +20 -0
- package/templates/minimal/threenative.config.ts +22 -10
- package/templates/minimal/vite.config.ts +28 -1
- package/templates/platformer/.codex/config.toml +19 -0
- package/templates/platformer/.cursor/mcp.json +32 -0
- package/templates/platformer/.gemini/settings.json +32 -0
- package/templates/platformer/.mcp.json +18 -2
- package/templates/platformer/.vscode/mcp.json +36 -0
- package/templates/platformer/.zed/settings.json +36 -0
- package/templates/platformer/AGENTS.md +81 -186
- package/templates/platformer/CLAUDE.md +81 -186
- package/templates/platformer/index.html +0 -1
- package/templates/platformer/opencode.json +41 -0
- package/templates/platformer/package.json +17 -14
- package/templates/platformer/playtests/avoidance.playtest.json +6 -1
- package/templates/platformer/playtests/branding.playtest.json +29 -0
- package/templates/platformer/playtests/buffer.playtest.json +1 -1
- package/templates/platformer/playtests/collect.playtest.json +1 -1
- package/templates/platformer/playtests/collision-layers.playtest.json +2 -2
- package/templates/platformer/playtests/coyote.playtest.json +42 -8
- package/templates/platformer/playtests/damage.playtest.json +4 -1
- package/templates/platformer/playtests/dash.playtest.json +2 -2
- package/templates/platformer/playtests/jump.playtest.json +2 -3
- package/templates/platformer/playtests/native/touch-controls.playtest.json +33 -0
- package/templates/platformer/playtests/oneway.playtest.json +30 -3
- package/templates/platformer/playtests/performance.playtest.json +7 -5
- package/templates/platformer/playtests/respawn.playtest.json +2 -2
- package/templates/platformer/playtests/stomp-rise.playtest.json +17 -3
- package/templates/platformer/playtests/stomp.playtest.json +11 -3
- package/templates/platformer/playtests/survives.playtest.json +31 -0
- package/templates/platformer/playtests/terminal-loop-fail.playtest.json +16 -4
- package/templates/platformer/playtests/terminal-loop-win.playtest.json +3 -3
- package/templates/platformer/playtests/touch-controls-web.playtest.json +57 -0
- package/templates/platformer/src/conventions.ts +18 -0
- package/templates/platformer/src/entities/Character.ts +79 -11
- package/templates/platformer/src/entities/Patrol.ts +5 -0
- package/templates/platformer/src/game.ts +27 -2
- package/templates/platformer/src/level/Platform.ts +13 -1
- package/templates/platformer/src/render/lighting.ts +13 -5
- package/templates/platformer/src/render/loading.ts +281 -62
- package/templates/platformer/src/render/palette.ts +4 -1
- package/templates/platformer/src/render/postprocessing.ts +42 -14
- package/templates/platformer/src/render/quality.ts +170 -0
- package/templates/platformer/src/render/touch-controls.ts +54 -36
- package/templates/platformer/src/render/worldEnvironment.ts +758 -0
- package/templates/platformer/src/scenes/Level.ts +97 -32
- package/templates/platformer/src/state.ts +4 -0
- package/templates/platformer/src/style.css +65 -1
- package/templates/platformer/src/ui/App.tsx +9 -4
- package/templates/platformer/src/ui/GameUi.tsx +20 -0
- package/templates/platformer/src/ui/Hud.tsx +6 -5
- package/templates/platformer/src/ui/main.tsx +14 -0
- package/templates/platformer/threenative.config.ts +27 -10
- package/templates/platformer/vite.config.ts +34 -1
- package/templates/puzzle/.codex/config.toml +19 -0
- package/templates/puzzle/.cursor/mcp.json +32 -0
- package/templates/puzzle/.gemini/settings.json +32 -0
- package/templates/puzzle/.mcp.json +32 -0
- package/templates/puzzle/.vscode/mcp.json +36 -0
- package/templates/puzzle/.zed/settings.json +36 -0
- package/templates/puzzle/AGENTS.md +96 -0
- package/templates/puzzle/CLAUDE.md +98 -0
- package/templates/puzzle/README.md +43 -0
- package/templates/puzzle/index.html +12 -0
- package/templates/puzzle/kit.json +7 -0
- package/templates/puzzle/opencode.json +41 -0
- package/templates/puzzle/package.json +50 -0
- package/templates/puzzle/playtests/carry.playtest.json +71 -0
- package/templates/puzzle/playtests/performance.playtest.json +23 -0
- package/templates/puzzle/playtests/survives.playtest.json +51 -0
- package/templates/puzzle/playtests/swing.playtest.json +38 -0
- package/templates/puzzle/public/favicon.svg +5 -0
- package/templates/puzzle/src/conventions.ts +25 -0
- package/templates/puzzle/src/entities/Ball.ts +70 -0
- package/templates/puzzle/src/entities/Crate.ts +76 -0
- package/templates/puzzle/src/entities/Gripper.ts +69 -0
- package/templates/puzzle/src/entities/Pendulum.ts +89 -0
- package/templates/puzzle/src/game.ts +48 -0
- package/templates/puzzle/src/main.ts +15 -0
- package/templates/puzzle/src/physics.ts +19 -0
- package/templates/puzzle/src/render/camera.ts +37 -0
- package/templates/puzzle/src/render/lighting.ts +55 -0
- package/templates/puzzle/src/render/loading.ts +325 -0
- package/templates/puzzle/src/render/materials.ts +28 -0
- package/templates/puzzle/src/render/palette.ts +31 -0
- package/templates/puzzle/src/render/postprocessing.ts +34 -0
- package/templates/puzzle/src/render/quality.ts +170 -0
- package/templates/puzzle/src/render/shapes.ts +134 -0
- package/templates/puzzle/src/render/sky.ts +16 -0
- package/templates/puzzle/src/render/touch-controls.ts +185 -0
- package/templates/puzzle/src/render/worldEnvironment.ts +758 -0
- package/templates/puzzle/src/room.ts +83 -0
- package/templates/puzzle/src/scenes/Boot.ts +12 -0
- package/templates/puzzle/src/scenes/Puzzle.ts +158 -0
- package/templates/puzzle/src/state.ts +30 -0
- package/templates/puzzle/src/style.css +96 -0
- package/templates/puzzle/src/ui/App.tsx +22 -0
- package/templates/puzzle/src/ui/GameUi.tsx +20 -0
- package/templates/puzzle/src/ui/Hud.tsx +57 -0
- package/templates/puzzle/src/ui/Menu.tsx +7 -0
- package/templates/puzzle/src/ui/main.tsx +14 -0
- package/templates/puzzle/tailwind.config.ts +1 -0
- package/templates/puzzle/threenative.config.ts +49 -0
- package/templates/puzzle/tsconfig.json +17 -0
- package/templates/puzzle/vite.config.ts +38 -0
- package/templates/racing/.codex/config.toml +19 -0
- package/templates/racing/.cursor/mcp.json +32 -0
- package/templates/racing/.gemini/settings.json +32 -0
- package/templates/racing/.mcp.json +18 -2
- package/templates/racing/.vscode/mcp.json +36 -0
- package/templates/racing/.zed/settings.json +36 -0
- package/templates/racing/AGENTS.md +84 -36
- package/templates/racing/CLAUDE.md +84 -36
- package/templates/racing/index.html +0 -1
- package/templates/racing/native-playtests/survives.playtest.json +43 -0
- package/templates/racing/opencode.json +41 -0
- package/templates/racing/package.json +17 -12
- package/templates/racing/playtests/boost.playtest.json +5 -5
- package/templates/racing/playtests/outcome.playtest.json +14 -4
- package/templates/racing/playtests/performance.playtest.json +39 -0
- package/templates/racing/playtests/ranking.playtest.json +2 -2
- package/templates/racing/playtests/rescue.playtest.json +12 -6
- package/templates/racing/playtests/reverse.playtest.json +3 -3
- package/templates/racing/playtests/shortcut.playtest.json +3 -3
- package/templates/racing/playtests/survives.playtest.json +36 -4
- package/templates/racing/playtests/touch-controls.playtest.json +41 -0
- package/templates/racing/src/conventions.ts +6 -0
- package/templates/racing/src/entities/RacingCar.ts +16 -4
- package/templates/racing/src/entities/Rival.ts +5 -2
- package/templates/racing/src/game.ts +24 -1
- package/templates/racing/src/render/camera.ts +15 -8
- package/templates/racing/src/render/lighting.ts +28 -14
- package/templates/racing/src/render/loading.ts +302 -35
- package/templates/racing/src/render/materials.ts +54 -4
- package/templates/racing/src/render/palette.ts +23 -6
- package/templates/racing/src/render/postprocessing.ts +32 -12
- package/templates/racing/src/render/quality.ts +170 -0
- package/templates/racing/src/render/shapes.ts +537 -26
- package/templates/racing/src/render/sky.ts +5 -2
- package/templates/racing/src/render/touch-controls.ts +185 -0
- package/templates/racing/src/render/worldEnvironment.ts +758 -0
- package/templates/racing/src/scenes/Race.ts +84 -37
- package/templates/racing/src/state.ts +4 -0
- package/templates/racing/src/style.css +65 -1
- package/templates/racing/src/track/Lap.ts +20 -9
- package/templates/racing/src/track/Ranking.ts +53 -14
- package/templates/racing/src/track/Track.ts +284 -32
- package/templates/racing/src/track/TrackSector.ts +14 -4
- package/templates/racing/src/ui/App.tsx +9 -4
- package/templates/racing/src/ui/GameUi.tsx +20 -0
- package/templates/racing/src/ui/Hud.tsx +6 -5
- package/templates/racing/src/ui/main.tsx +14 -0
- package/templates/racing/threenative.config.ts +28 -8
- package/templates/racing/vite.config.ts +34 -1
- package/templates/runner/.codex/config.toml +19 -0
- package/templates/runner/.cursor/mcp.json +32 -0
- package/templates/runner/.gemini/settings.json +32 -0
- package/templates/runner/.mcp.json +32 -0
- package/templates/runner/.vscode/mcp.json +36 -0
- package/templates/runner/.zed/settings.json +36 -0
- package/templates/runner/AGENTS.md +96 -0
- package/templates/runner/CLAUDE.md +98 -0
- package/templates/runner/README.md +43 -0
- package/templates/runner/index.html +12 -0
- package/templates/runner/kit.json +7 -0
- package/templates/runner/opencode.json +41 -0
- package/templates/runner/package.json +50 -0
- package/templates/runner/playtests/performance.playtest.json +23 -0
- package/templates/runner/playtests/streams.playtest.json +38 -0
- package/templates/runner/playtests/survives.playtest.json +51 -0
- package/templates/runner/public/favicon.svg +5 -0
- package/templates/runner/src/conventions.ts +24 -0
- package/templates/runner/src/entities/Runner.ts +135 -0
- package/templates/runner/src/game.ts +50 -0
- package/templates/runner/src/main.ts +15 -0
- package/templates/runner/src/physics.ts +13 -0
- package/templates/runner/src/render/camera.ts +39 -0
- package/templates/runner/src/render/dust.ts +131 -0
- package/templates/runner/src/render/lighting.ts +57 -0
- package/templates/runner/src/render/loading.ts +325 -0
- package/templates/runner/src/render/materials.ts +27 -0
- package/templates/runner/src/render/palette.ts +30 -0
- package/templates/runner/src/render/postprocessing.ts +34 -0
- package/templates/runner/src/render/quality.ts +170 -0
- package/templates/runner/src/render/shapes.ts +68 -0
- package/templates/runner/src/render/sky.ts +51 -0
- package/templates/runner/src/render/touch-controls.ts +185 -0
- package/templates/runner/src/render/worldEnvironment.ts +758 -0
- package/templates/runner/src/scenes/Boot.ts +12 -0
- package/templates/runner/src/scenes/Run.ts +142 -0
- package/templates/runner/src/state.ts +29 -0
- package/templates/runner/src/style.css +96 -0
- package/templates/runner/src/track.ts +176 -0
- package/templates/runner/src/ui/App.tsx +22 -0
- package/templates/runner/src/ui/GameUi.tsx +20 -0
- package/templates/runner/src/ui/Hud.tsx +55 -0
- package/templates/runner/src/ui/Menu.tsx +7 -0
- package/templates/runner/src/ui/main.tsx +14 -0
- package/templates/runner/tailwind.config.ts +1 -0
- package/templates/runner/threenative.config.ts +49 -0
- package/templates/runner/tsconfig.json +17 -0
- package/templates/runner/vite.config.ts +38 -0
- package/templates/sailing/.codex/config.toml +19 -0
- package/templates/sailing/.cursor/mcp.json +32 -0
- package/templates/sailing/.gemini/settings.json +32 -0
- package/templates/sailing/.mcp.json +32 -0
- package/templates/sailing/.vscode/mcp.json +36 -0
- package/templates/sailing/.zed/settings.json +36 -0
- package/templates/sailing/AGENTS.md +95 -0
- package/templates/sailing/CLAUDE.md +97 -0
- package/templates/sailing/README.md +28 -0
- package/templates/sailing/index.html +12 -0
- package/templates/sailing/kit.json +7 -0
- package/templates/sailing/native-playtests/float.playtest.json +55 -0
- package/templates/sailing/native-playtests/survives.playtest.json +38 -0
- package/templates/sailing/opencode.json +41 -0
- package/templates/sailing/package.json +52 -0
- package/templates/sailing/playtests/fail.playtest.json +24 -0
- package/templates/sailing/playtests/float-after-the-run-ends.playtest.json +75 -0
- package/templates/sailing/playtests/float.playtest.json +59 -0
- package/templates/sailing/playtests/performance.playtest.json +36 -0
- package/templates/sailing/playtests/survives.playtest.json +46 -0
- package/templates/sailing/playtests/touch-controls.playtest.json +48 -0
- package/templates/sailing/playtests/win.playtest.json +31 -0
- package/templates/sailing/public/favicon.svg +5 -0
- package/templates/sailing/src/conventions.ts +8 -0
- package/templates/sailing/src/entities/Ship.ts +233 -0
- package/templates/sailing/src/game.ts +40 -0
- package/templates/sailing/src/main.ts +15 -0
- package/templates/sailing/src/render/camera.ts +28 -0
- package/templates/sailing/src/render/lighting.ts +41 -0
- package/templates/sailing/src/render/loading.ts +325 -0
- package/templates/sailing/src/render/materials.ts +44 -0
- package/templates/sailing/src/render/ocean.ts +179 -0
- package/templates/sailing/src/render/palette.ts +17 -0
- package/templates/sailing/src/render/postprocessing.ts +34 -0
- package/templates/sailing/src/render/props.ts +602 -0
- package/templates/sailing/src/render/quality.ts +140 -0
- package/templates/sailing/src/render/sky.ts +37 -0
- package/templates/sailing/src/render/touch-controls.ts +142 -0
- package/templates/sailing/src/render/worldEnvironment.ts +758 -0
- package/templates/sailing/src/scenes/Boot.ts +12 -0
- package/templates/sailing/src/scenes/Sailing.ts +133 -0
- package/templates/sailing/src/state.ts +10 -0
- package/templates/sailing/src/style.css +81 -0
- package/templates/sailing/src/ui/App.tsx +15 -0
- package/templates/sailing/src/ui/GameUi.tsx +12 -0
- package/templates/sailing/src/ui/Hud.tsx +55 -0
- package/templates/sailing/src/ui/Menu.tsx +30 -0
- package/templates/sailing/src/ui/main.tsx +7 -0
- package/templates/sailing/tailwind.config.ts +2 -0
- package/templates/sailing/threenative.config.ts +40 -0
- package/templates/sailing/tsconfig.json +17 -0
- package/templates/sailing/vite.config.ts +34 -0
- package/templates/shooter/.codex/config.toml +19 -0
- package/templates/shooter/.cursor/mcp.json +32 -0
- package/templates/shooter/.gemini/settings.json +32 -0
- package/templates/shooter/.mcp.json +18 -2
- package/templates/shooter/.vscode/mcp.json +36 -0
- package/templates/shooter/.zed/settings.json +36 -0
- package/templates/shooter/AGENTS.md +81 -54
- package/templates/shooter/CLAUDE.md +81 -54
- package/templates/shooter/index.html +0 -1
- package/templates/shooter/kit.json +2 -2
- package/templates/shooter/opencode.json +41 -0
- package/templates/shooter/package.json +16 -11
- package/templates/shooter/playtests/combat.playtest.json +48 -0
- package/templates/shooter/playtests/fail.playtest.json +5 -4
- package/templates/shooter/playtests/input-control.playtest.json +261 -0
- package/templates/shooter/playtests/per-item.playtest.json +59 -0
- package/templates/shooter/playtests/performance.playtest.json +39 -0
- package/templates/shooter/playtests/shooter.playtest.json +31 -21
- package/templates/shooter/playtests/survives.playtest.json +28 -1
- package/templates/shooter/playtests/touch-controls.playtest.json +42 -0
- package/templates/shooter/playtests/weapon-cycle.playtest.json +164 -0
- package/templates/shooter/public/favicon.svg +1 -1
- package/templates/shooter/src/combat/damage.ts +1 -2
- package/templates/shooter/src/conventions.ts +51 -0
- package/templates/shooter/src/entities/Player.ts +235 -18
- package/templates/shooter/src/entities/Target.ts +2 -2
- package/templates/shooter/src/game.ts +35 -3
- package/templates/shooter/src/main.ts +3 -13
- package/templates/shooter/src/render/camera.ts +78 -18
- package/templates/shooter/src/render/decals.ts +211 -0
- package/templates/shooter/src/render/lighting.ts +13 -4
- package/templates/shooter/src/render/loading.ts +274 -35
- package/templates/shooter/src/render/materials.ts +56 -3
- package/templates/shooter/src/render/palette.ts +6 -3
- package/templates/shooter/src/render/postprocessing.ts +32 -17
- package/templates/shooter/src/render/quality.ts +170 -0
- package/templates/shooter/src/render/scale.ts +22 -0
- package/templates/shooter/src/render/shapes.ts +519 -60
- package/templates/shooter/src/render/sky.ts +5 -1
- package/templates/shooter/src/render/touch-controls.ts +305 -0
- package/templates/shooter/src/render/ui.css +119 -1
- package/templates/shooter/src/render/ui.ts +19 -3
- package/templates/shooter/src/render/vfx.ts +215 -0
- package/templates/shooter/src/render/worldEnvironment.ts +758 -0
- package/templates/shooter/src/scenes/Play.ts +385 -97
- package/templates/shooter/src/state.ts +18 -0
- package/templates/shooter/src/style.css +46 -0
- package/templates/shooter/src/ui/App.tsx +10 -12
- package/templates/shooter/src/ui/Crosshair.tsx +25 -0
- package/templates/shooter/src/ui/GameUi.tsx +22 -0
- package/templates/shooter/src/ui/Hud.tsx +14 -10
- package/templates/shooter/src/ui/Menu.tsx +24 -9
- package/templates/shooter/src/ui/main.tsx +15 -0
- package/templates/shooter/src/weapons/Hitscan.ts +3 -4
- package/templates/shooter/src/weapons/Projectile.ts +29 -13
- package/templates/shooter/src/weapons/Viewmodel.ts +275 -0
- package/templates/shooter/threenative.config.ts +28 -8
- package/templates/shooter/vite.config.ts +32 -2
- package/templates/starter/.codex/config.toml +19 -0
- package/templates/starter/.cursor/mcp.json +32 -0
- package/templates/starter/.gemini/settings.json +32 -0
- package/templates/starter/.mcp.json +18 -2
- package/templates/starter/.vscode/mcp.json +36 -0
- package/templates/starter/.zed/settings.json +36 -0
- package/templates/starter/AGENTS.md +72 -426
- package/templates/starter/CLAUDE.md +72 -426
- package/templates/starter/assets/pickup.wav +0 -0
- package/templates/starter/gitignore +4 -0
- package/templates/starter/index.html +0 -1
- package/templates/starter/native-playtests/react-hud.playtest.json +20 -0
- package/templates/starter/native-playtests/render-chain.playtest.json +81 -0
- package/templates/starter/opencode.json +41 -0
- package/templates/starter/package.json +16 -12
- package/templates/starter/playtests/assets.playtest.json +65 -0
- package/templates/starter/playtests/boot-failure.playtest.json +45 -0
- package/templates/starter/playtests/buffer.playtest.json +59 -9
- package/templates/starter/playtests/cloth.playtest.json +113 -0
- package/templates/starter/playtests/coyote.playtest.json +60 -8
- package/templates/starter/playtests/forward.playtest.json +29 -4
- package/templates/starter/playtests/gameover.playtest.json +66 -0
- package/templates/starter/playtests/goal.playtest.json +67 -0
- package/templates/starter/playtests/hot-reload.playtest.json +48 -8
- package/templates/starter/playtests/look.playtest.json +142 -10
- package/templates/starter/playtests/models-baseline.png +0 -0
- package/templates/starter/playtests/models.playtest.json +74 -0
- package/templates/starter/playtests/monitoring.playtest.json +38 -7
- package/templates/starter/playtests/odometer.playtest.json +54 -0
- package/templates/starter/playtests/pause.playtest.json +27 -4
- package/templates/starter/playtests/play.playtest.json +44 -7
- package/templates/starter/playtests/respawn.playtest.json +46 -6
- package/templates/starter/playtests/restart.playtest.json +65 -10
- package/templates/starter/playtests/seed.playtest.json +44 -8
- package/templates/starter/playtests/survives.playtest.json +48 -4
- package/templates/starter/playtests/textures-baseline.png +0 -0
- package/templates/starter/playtests/textures.playtest.json +74 -0
- package/templates/starter/playtests/touch-controls.playtest.json +42 -0
- package/templates/starter/playtests/zoom-pinch.playtest.json +86 -0
- package/templates/starter/playtests/zoom-wheel.playtest.json +59 -0
- package/templates/starter/src/conventions.ts +18 -0
- package/templates/starter/src/entities/Goal.ts +137 -0
- package/templates/starter/src/entities/Player.ts +111 -10
- package/templates/starter/src/game.ts +27 -0
- package/templates/starter/src/render/adaptiveQuality.ts +195 -0
- package/templates/starter/src/render/camera.ts +31 -5
- package/templates/starter/src/render/coast.ts +199 -0
- package/templates/starter/src/render/easing.ts +5 -0
- package/templates/starter/src/render/effects/gradualBackground.ts +48 -0
- package/templates/starter/src/render/effects/lensDistortion.ts +43 -0
- package/templates/starter/src/render/effects/sparkle.ts +49 -0
- package/templates/starter/src/render/hero.ts +88 -0
- package/templates/starter/src/render/implicitSurface.ts +199 -0
- package/templates/starter/src/render/kuwahara.ts +174 -0
- package/templates/starter/src/render/lighting.ts +10 -5
- package/templates/starter/src/render/loading.ts +325 -0
- package/templates/starter/src/render/materials.ts +39 -4
- package/templates/starter/src/render/outline.ts +141 -0
- package/templates/starter/src/render/painterly.ts +86 -0
- package/templates/starter/src/render/palette.ts +15 -6
- package/templates/starter/src/render/pennant.ts +54 -0
- package/templates/starter/src/render/postprocessing.ts +97 -15
- package/templates/starter/src/render/quality.ts +185 -0
- package/templates/starter/src/render/rockRidge.ts +198 -0
- package/templates/starter/src/render/rockRidge.worker.ts +77 -0
- package/templates/starter/src/render/scenery.ts +40 -0
- package/templates/starter/src/render/shapes.ts +9 -21
- package/templates/starter/src/render/textureLifetime.ts +53 -0
- package/templates/starter/src/render/touch-controls.ts +165 -0
- package/templates/starter/src/render/water.ts +38 -0
- package/templates/starter/src/render/watercolor.ts +85 -0
- package/templates/starter/src/render/worldEnvironment.ts +758 -0
- package/templates/starter/src/scenes/Play.ts +243 -46
- package/templates/starter/src/state.ts +12 -0
- package/templates/starter/src/style.css +72 -8
- package/templates/starter/src/ui/App.tsx +9 -6
- package/templates/starter/src/ui/GameUi.tsx +20 -0
- package/templates/starter/src/ui/Hud.tsx +52 -29
- package/templates/starter/src/ui/Menu.tsx +25 -23
- package/templates/starter/src/ui/main.tsx +14 -0
- package/templates/starter/threenative.config.ts +27 -9
- package/templates/starter/tools/look.mjs +109 -0
- package/templates/starter/vite.config.ts +32 -2
- package/templates/action-rpg/src/physics.ts +0 -40
- package/templates/minimal/assets/.gitkeep +0 -0
- package/templates/minimal/public/.gitkeep +0 -0
- package/templates/minimal/public/icon.png +0 -0
- package/templates/platformer/assets/.gitkeep +0 -0
- package/templates/platformer/public/.gitkeep +0 -0
- package/templates/platformer/public/icon.png +0 -0
- package/templates/shooter/src/physics.ts +0 -49
- package/templates/starter/assets/.gitkeep +0 -0
- package/templates/starter/public/.gitkeep +0 -0
- package/templates/starter/public/icon.png +0 -0
- package/templates/starter/public/pickup.ogg +0 -0
- /package/templates/starter/{public → assets}/native-proof.glb +0 -0
- /package/templates/starter/{public → assets}/native-proof.png +0 -0
|
@@ -1,37 +1,548 @@
|
|
|
1
|
-
|
|
1
|
+
// Generated for you: ordinary Three.js. ThreeNative does not read this file, and the look of the
|
|
2
|
+
// race is decided here and in `palette.ts` — nowhere in a package.
|
|
3
|
+
//
|
|
4
|
+
// The car is a **lofted hull**, not a stack of boxes. A box chassis with four cylinders is what
|
|
5
|
+
// this file used to hold, and the first frame read as a brick with wheels: no wedge, no shoulder,
|
|
6
|
+
// no arches, so nothing in the silhouette said "car" except the colour. `loftHull` stitches a
|
|
7
|
+
// series of cross-sections along the car's length instead, which is how a real body is drawn, and
|
|
8
|
+
// it costs about the same number of lines.
|
|
9
|
+
//
|
|
10
|
+
// Every colour, roughness and metalness arrives as an argument. Re-livery the car by editing
|
|
11
|
+
// `materials.ts`; change its shape by moving the numbers in `CAR_STATIONS`. Neither needs the
|
|
12
|
+
// other.
|
|
13
|
+
import {
|
|
14
|
+
BoxGeometry,
|
|
15
|
+
BufferAttribute,
|
|
16
|
+
BufferGeometry,
|
|
17
|
+
CapsuleGeometry,
|
|
18
|
+
CircleGeometry,
|
|
19
|
+
ConeGeometry,
|
|
20
|
+
CylinderGeometry,
|
|
21
|
+
Group,
|
|
22
|
+
LatheGeometry,
|
|
23
|
+
type Material,
|
|
24
|
+
MathUtils,
|
|
25
|
+
Mesh,
|
|
26
|
+
Vector2,
|
|
27
|
+
} from "three";
|
|
28
|
+
import { mergeGeometries } from "three/addons/utils/BufferGeometryUtils.js";
|
|
2
29
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
30
|
+
type Materials = ReturnType<typeof import("./materials.js").createMaterials>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* One cross-section of a lofted body.
|
|
34
|
+
*
|
|
35
|
+
* `topScale` is what makes a car look like a car: below 1 the section narrows towards its roof, so
|
|
36
|
+
* the shoulder above the wheels stays the widest part of the body and the greenhouse sits inboard
|
|
37
|
+
* of it. At 1 the section is a rounded slab and the read is a bus.
|
|
38
|
+
*/
|
|
39
|
+
interface IHullStation {
|
|
40
|
+
readonly bottom: number;
|
|
41
|
+
readonly halfWidth: number;
|
|
42
|
+
readonly top: number;
|
|
43
|
+
readonly topScale: number;
|
|
44
|
+
readonly x: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const RING_SEGMENTS = 20;
|
|
48
|
+
/** Superellipse exponent. 2 is an ellipse, large is a box; 3.4 keeps a crisp shoulder crease. */
|
|
49
|
+
const RING_SHARPNESS = 3.4;
|
|
50
|
+
|
|
51
|
+
function ringPoint(station: IHullStation, index: number): [number, number, number] {
|
|
52
|
+
const theta = (index / RING_SEGMENTS) * Math.PI * 2;
|
|
53
|
+
const cz = Math.cos(theta);
|
|
54
|
+
const cy = Math.sin(theta);
|
|
55
|
+
const exponent = 2 / RING_SHARPNESS;
|
|
56
|
+
const sz = Math.sign(cz) * Math.abs(cz) ** exponent;
|
|
57
|
+
const sy = Math.sign(cy) * Math.abs(cy) ** exponent;
|
|
58
|
+
const halfHeight = (station.top - station.bottom) / 2;
|
|
59
|
+
const centre = (station.top + station.bottom) / 2;
|
|
60
|
+
// Lerp the half-width from full at the sill to `topScale` at the roof.
|
|
61
|
+
const width = station.halfWidth * (1 + (station.topScale - 1) * ((sy + 1) / 2));
|
|
62
|
+
return [station.x, centre + halfHeight * sy, width * sz];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Stitch cross-sections into a closed hull with capped ends.
|
|
67
|
+
*
|
|
68
|
+
* Winding is chosen so the outward normal points away from the length axis; `computeVertexNormals`
|
|
69
|
+
* then gives the smooth shading a hand-built box stack cannot.
|
|
70
|
+
*/
|
|
71
|
+
function loftHull(input: readonly IHullStation[]): BufferGeometry {
|
|
72
|
+
if (input.length < 2) throw new Error("loftHull needs at least two stations.");
|
|
73
|
+
// Sorted, not taken as given. The winding that makes a face point outwards depends on the sign
|
|
74
|
+
// of the step in x, so a station list authored nose-first builds the whole hull inside-out —
|
|
75
|
+
// backface culling then hides the body and shows its interior, and every part mounted on it
|
|
76
|
+
// appears to float in a hollow shell. Sorting here means the profile below can be read in
|
|
77
|
+
// whichever direction is clearer.
|
|
78
|
+
const stations = [...input].sort((a, b) => a.x - b.x);
|
|
79
|
+
const positions: number[] = [];
|
|
80
|
+
const push = (point: readonly [number, number, number]): void => {
|
|
81
|
+
positions.push(point[0], point[1], point[2]);
|
|
82
|
+
};
|
|
83
|
+
for (let s = 0; s < stations.length - 1; s += 1) {
|
|
84
|
+
const near = stations[s];
|
|
85
|
+
const far = stations[s + 1];
|
|
86
|
+
if (near === undefined || far === undefined) continue;
|
|
87
|
+
for (let i = 0; i < RING_SEGMENTS; i += 1) {
|
|
88
|
+
const next = (i + 1) % RING_SEGMENTS;
|
|
89
|
+
const a = ringPoint(near, i);
|
|
90
|
+
const b = ringPoint(far, i);
|
|
91
|
+
const c = ringPoint(far, next);
|
|
92
|
+
const d = ringPoint(near, next);
|
|
93
|
+
push(a);
|
|
94
|
+
push(b);
|
|
95
|
+
push(c);
|
|
96
|
+
push(a);
|
|
97
|
+
push(c);
|
|
98
|
+
push(d);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const cap = (station: IHullStation, outwards: boolean): void => {
|
|
102
|
+
const centre: [number, number, number] = [station.x, (station.top + station.bottom) / 2, 0];
|
|
103
|
+
for (let i = 0; i < RING_SEGMENTS; i += 1) {
|
|
104
|
+
const next = (i + 1) % RING_SEGMENTS;
|
|
105
|
+
push(centre);
|
|
106
|
+
push(ringPoint(station, outwards ? i : next));
|
|
107
|
+
push(ringPoint(station, outwards ? next : i));
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const first = stations[0];
|
|
111
|
+
const last = stations[stations.length - 1];
|
|
112
|
+
if (first !== undefined) cap(first, false);
|
|
113
|
+
if (last !== undefined) cap(last, true);
|
|
114
|
+
const geometry = new BufferGeometry();
|
|
115
|
+
geometry.setAttribute("position", new BufferAttribute(new Float32Array(positions), 3));
|
|
116
|
+
geometry.computeVertexNormals();
|
|
117
|
+
return geometry;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The car's profile, nose (+X) to tail (-X), in metres.
|
|
122
|
+
*
|
|
123
|
+
* Read down the `top` column and you can see the wedge; read down `halfWidth` and you can see the
|
|
124
|
+
* hourglass — narrow over the front axle, waisted at the doors, widest over the rear arches.
|
|
125
|
+
*/
|
|
126
|
+
const CAR_STATIONS: readonly IHullStation[] = [
|
|
127
|
+
{ bottom: 0.2, halfWidth: 0.36, top: 0.44, topScale: 0.82, x: 2.02 },
|
|
128
|
+
{ bottom: 0.15, halfWidth: 0.66, top: 0.5, topScale: 0.8, x: 1.72 },
|
|
129
|
+
{ bottom: 0.13, halfWidth: 0.81, top: 0.56, topScale: 0.78, x: 1.16 },
|
|
130
|
+
{ bottom: 0.13, halfWidth: 0.78, top: 0.6, topScale: 0.8, x: 0.46 },
|
|
131
|
+
{ bottom: 0.14, halfWidth: 0.72, top: 0.62, topScale: 0.84, x: -0.2 },
|
|
132
|
+
{ bottom: 0.14, halfWidth: 0.79, top: 0.64, topScale: 0.82, x: -0.92 },
|
|
133
|
+
{ bottom: 0.16, halfWidth: 0.86, top: 0.66, topScale: 0.82, x: -1.5 },
|
|
134
|
+
{ bottom: 0.22, halfWidth: 0.7, top: 0.58, topScale: 0.86, x: -1.9 },
|
|
135
|
+
{ bottom: 0.3, halfWidth: 0.4, top: 0.5, topScale: 0.9, x: -2.06 },
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The cabin shell, inboard of the body so the shoulder reads as a separate surface.
|
|
140
|
+
*
|
|
141
|
+
* It stops at x = -1.05. Run back to the tail it covered the rear deck as well, and since glass is
|
|
142
|
+
* a very dark material the chase camera then saw a black car with red slivers at the edges: the
|
|
143
|
+
* body was rendering perfectly and almost none of it was in view. Behind the cabin the fastback is
|
|
144
|
+
* **bodywork**, which is both how the class is built and what puts the livery colour where the
|
|
145
|
+
* player is looking.
|
|
146
|
+
*/
|
|
147
|
+
const CABIN_STATIONS: readonly IHullStation[] = [
|
|
148
|
+
{ bottom: 0.5, halfWidth: 0.4, top: 0.58, topScale: 0.72, x: 0.58 },
|
|
149
|
+
{ bottom: 0.52, halfWidth: 0.52, top: 0.86, topScale: 0.66, x: 0.14 },
|
|
150
|
+
{ bottom: 0.54, halfWidth: 0.55, top: 0.95, topScale: 0.74, x: -0.4 },
|
|
151
|
+
{ bottom: 0.54, halfWidth: 0.52, top: 0.9, topScale: 0.74, x: -0.78 },
|
|
152
|
+
{ bottom: 0.52, halfWidth: 0.44, top: 0.74, topScale: 0.7, x: -1.05 },
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
function part(geometry: BufferGeometry, material: Material): Mesh {
|
|
156
|
+
const mesh = new Mesh(geometry, material);
|
|
157
|
+
mesh.castShadow = true;
|
|
158
|
+
mesh.receiveShadow = true;
|
|
159
|
+
return mesh;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Collects the pieces of one rigid assembly and emits **one mesh per material**.
|
|
164
|
+
*
|
|
165
|
+
* A car authored as forty-two little meshes is forty-two draw calls, and with a rival on track and
|
|
166
|
+
* a shadow pass that alone put the production-performance playtest at seven hundred draws against a
|
|
167
|
+
* budget of a hundred and ninety-five. None of these parts ever moves relative to the body, so
|
|
168
|
+
* there is nothing to lose by baking them: the six materials stay separate and separately
|
|
169
|
+
* editable, and the car costs six draws.
|
|
170
|
+
*/
|
|
171
|
+
class RigidAssembly {
|
|
172
|
+
readonly #byMaterial = new Map<Material, Mesh[]>();
|
|
173
|
+
|
|
174
|
+
add(mesh: Mesh): void {
|
|
175
|
+
const bucket = this.#byMaterial.get(mesh.material as Material);
|
|
176
|
+
if (bucket === undefined) this.#byMaterial.set(mesh.material as Material, [mesh]);
|
|
177
|
+
else bucket.push(mesh);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** `castShadow` is taken from the first piece in each bucket, which is how they are authored. */
|
|
181
|
+
attachTo(root: Group): void {
|
|
182
|
+
for (const [material, meshes] of this.#byMaterial) {
|
|
183
|
+
const geometry = mergeGeometries(
|
|
184
|
+
meshes.map((mesh) => {
|
|
185
|
+
mesh.updateMatrix();
|
|
186
|
+
// De-indexed and stripped to position alone. `mergeGeometries` refuses a mix of indexed
|
|
187
|
+
// and non-indexed inputs, and a lofted hull is non-indexed while every Three.js
|
|
188
|
+
// primitive is indexed — the merge failed at the first box and the scene never loaded.
|
|
189
|
+
const placed = mesh.geometry.clone().applyMatrix4(mesh.matrix);
|
|
190
|
+
const cloned = placed.index === null ? placed : placed.toNonIndexed();
|
|
191
|
+
for (const name of Object.keys(cloned.attributes)) {
|
|
192
|
+
if (name !== "position") cloned.deleteAttribute(name);
|
|
193
|
+
}
|
|
194
|
+
return cloned;
|
|
195
|
+
}),
|
|
196
|
+
false,
|
|
197
|
+
);
|
|
198
|
+
if (geometry === null) throw new Error("mergeGeometries returned null for a car part.");
|
|
199
|
+
geometry.computeVertexNormals();
|
|
200
|
+
const merged = new Mesh(geometry, material);
|
|
201
|
+
merged.castShadow = meshes[0]?.castShadow ?? true;
|
|
202
|
+
merged.receiveShadow = true;
|
|
203
|
+
root.add(merged);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* One wheel: a lathed tyre with a rounded shoulder, a dished rim and a five-spoke star.
|
|
210
|
+
*
|
|
211
|
+
* The tyre is lathed rather than a torus because a torus has no flat contact patch and no sidewall,
|
|
212
|
+
* and both of those are what the eye uses to tell a wheel from a doughnut at chase-camera distance.
|
|
213
|
+
*/
|
|
214
|
+
function wheel(materials: Materials, radius: number): Group {
|
|
6
215
|
const root = new Group();
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
216
|
+
const rim = new RigidAssembly();
|
|
217
|
+
const halfWidth = radius * 0.4;
|
|
218
|
+
const rimRadius = radius * 0.66;
|
|
219
|
+
// The profile is **closed**: it starts and ends on the axis, so the lathe produces a solid tyre
|
|
220
|
+
// rather than an open tube whose inside face shows through at the top of every wheel.
|
|
221
|
+
const profile = [
|
|
222
|
+
new Vector2(0.0001, -halfWidth),
|
|
223
|
+
new Vector2(rimRadius, -halfWidth),
|
|
224
|
+
new Vector2(radius * 0.94, -halfWidth * 0.94),
|
|
225
|
+
new Vector2(radius, -halfWidth * 0.5),
|
|
226
|
+
new Vector2(radius, halfWidth * 0.5),
|
|
227
|
+
new Vector2(radius * 0.94, halfWidth * 0.94),
|
|
228
|
+
new Vector2(rimRadius, halfWidth),
|
|
229
|
+
new Vector2(0.0001, halfWidth),
|
|
230
|
+
];
|
|
231
|
+
const tyre = part(new LatheGeometry(profile, 16), materials.tire);
|
|
232
|
+
tyre.rotation.x = Math.PI / 2;
|
|
233
|
+
rim.add(tyre);
|
|
234
|
+
|
|
235
|
+
// One flat alloy face per side, set proud of the sidewall. A cylinder buried inside the tyre is
|
|
236
|
+
// invisible from every angle a player ever sees, which is why the old wheels read as black discs.
|
|
237
|
+
for (const face of [-1, 1]) {
|
|
238
|
+
const disc = part(new CircleGeometry(rimRadius, 20), materials.alloy);
|
|
239
|
+
disc.position.z = face * halfWidth * 1.02;
|
|
240
|
+
disc.rotation.y = face > 0 ? 0 : Math.PI;
|
|
241
|
+
rim.add(disc);
|
|
242
|
+
}
|
|
243
|
+
const hub = part(
|
|
244
|
+
new CylinderGeometry(radius * 0.14, radius * 0.14, halfWidth * 2.3, 8),
|
|
245
|
+
materials.carbon,
|
|
246
|
+
);
|
|
247
|
+
hub.rotation.x = Math.PI / 2;
|
|
248
|
+
rim.add(hub);
|
|
249
|
+
|
|
250
|
+
// Radial array: one spoke authored, five placed. Change the count here and the wheel restyles.
|
|
251
|
+
const spokes = 5;
|
|
252
|
+
for (const face of [-1, 1]) {
|
|
253
|
+
for (let index = 0; index < spokes; index += 1) {
|
|
254
|
+
const spoke = part(
|
|
255
|
+
new BoxGeometry(rimRadius * 1.7, radius * 0.13, radius * 0.05),
|
|
256
|
+
materials.hubDark,
|
|
257
|
+
);
|
|
258
|
+
spoke.rotation.z = (index / spokes) * Math.PI * 2 + 0.31;
|
|
259
|
+
spoke.position.z = face * halfWidth * 1.06;
|
|
260
|
+
rim.add(spoke);
|
|
24
261
|
}
|
|
25
262
|
}
|
|
263
|
+
rim.attachTo(root);
|
|
26
264
|
return root;
|
|
27
265
|
}
|
|
28
266
|
|
|
267
|
+
// There is no separate wheel-arch lip. Seven boxes read as a caterpillar track and a torus arc
|
|
268
|
+
// read as a chrome grab handle standing outboard of the tyre; both were louder than the car. The
|
|
269
|
+
// flare in `CAR_STATIONS` — 0.86 half-width over the rear axle against 0.72 at the doors — is the
|
|
270
|
+
// arch, and it costs no geometry at all.
|
|
271
|
+
|
|
272
|
+
export function vehicle(materials: Materials): Group {
|
|
273
|
+
const root = new Group();
|
|
274
|
+
const shell = new RigidAssembly();
|
|
275
|
+
|
|
276
|
+
// blockout + structural pass: the two lofted shells.
|
|
277
|
+
shell.add(part(loftHull(CAR_STATIONS), materials.body));
|
|
278
|
+
const cabin = part(loftHull(CABIN_STATIONS), materials.glass);
|
|
279
|
+
cabin.castShadow = false;
|
|
280
|
+
shell.add(cabin);
|
|
281
|
+
|
|
282
|
+
// Front aero: splitter blade proud of the nose, and a recessed dark mouth above it.
|
|
283
|
+
const splitter = part(new BoxGeometry(0.5, 0.05, 1.62), materials.carbon);
|
|
284
|
+
splitter.position.set(2.06, 0.11, 0);
|
|
285
|
+
shell.add(splitter);
|
|
286
|
+
for (const side of [-1, 1]) {
|
|
287
|
+
const endPlate = part(new BoxGeometry(0.34, 0.16, 0.05), materials.carbon);
|
|
288
|
+
endPlate.position.set(2.0, 0.18, side * 0.8);
|
|
289
|
+
shell.add(endPlate);
|
|
290
|
+
}
|
|
291
|
+
const intake = part(new BoxGeometry(0.16, 0.2, 1.06), materials.carbon);
|
|
292
|
+
intake.position.set(1.96, 0.3, 0);
|
|
293
|
+
shell.add(intake);
|
|
294
|
+
|
|
295
|
+
// Bonnet crown with a pair of louvre slots, so the flat panel above the front axle has a read.
|
|
296
|
+
const crown = part(new BoxGeometry(0.9, 0.06, 0.6), materials.body);
|
|
297
|
+
crown.position.set(1.2, 0.57, 0);
|
|
298
|
+
shell.add(crown);
|
|
299
|
+
for (const side of [-1, 1]) {
|
|
300
|
+
const louvre = part(new BoxGeometry(0.34, 0.03, 0.12), materials.carbon);
|
|
301
|
+
louvre.position.set(1.1, 0.6, side * 0.2);
|
|
302
|
+
louvre.rotation.z = -0.12;
|
|
303
|
+
shell.add(louvre);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Roll hoop and mirrors: small, but they are most of what says "race car" rather than "coupe".
|
|
307
|
+
const hoop = part(new CapsuleGeometry(0.05, 0.5, 4, 8), materials.alloy);
|
|
308
|
+
hoop.rotation.z = Math.PI / 2;
|
|
309
|
+
hoop.position.set(-0.98, 1.06, 0);
|
|
310
|
+
shell.add(hoop);
|
|
311
|
+
for (const side of [-1, 1]) {
|
|
312
|
+
const stalk = part(new CylinderGeometry(0.015, 0.015, 0.12, 6), materials.alloy);
|
|
313
|
+
stalk.rotation.z = Math.PI / 2.4;
|
|
314
|
+
stalk.position.set(0.52, 0.62, side * 0.6);
|
|
315
|
+
shell.add(stalk);
|
|
316
|
+
const pod = part(new BoxGeometry(0.08, 0.07, 0.04), materials.carbon);
|
|
317
|
+
pod.position.set(0.48, 0.66, side * 0.66);
|
|
318
|
+
shell.add(pod);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Rear wing on swan-neck stays, with a gurney flap and end plates.
|
|
322
|
+
// The wing sits clear of the deck. Held at 0.98 it overlapped the tail in the chase camera and
|
|
323
|
+
// the whole back of the car merged into one dark mass — the single worst read in the frame,
|
|
324
|
+
// because the chase camera never looks at anything else.
|
|
325
|
+
const wing = part(new BoxGeometry(0.32, 0.05, 1.52), materials.wing);
|
|
326
|
+
wing.position.set(-1.94, 1.06, 0);
|
|
327
|
+
wing.rotation.z = 0.16;
|
|
328
|
+
shell.add(wing);
|
|
329
|
+
const gurney = part(new BoxGeometry(0.05, 0.07, 1.52), materials.wing);
|
|
330
|
+
gurney.position.set(-2.08, 1.1, 0);
|
|
331
|
+
shell.add(gurney);
|
|
332
|
+
for (const side of [-1, 1]) {
|
|
333
|
+
const plate = part(new BoxGeometry(0.4, 0.26, 0.04), materials.wing);
|
|
334
|
+
plate.position.set(-1.94, 1.08, side * 0.78);
|
|
335
|
+
shell.add(plate);
|
|
336
|
+
const stay = part(new BoxGeometry(0.06, 0.5, 0.05), materials.alloy);
|
|
337
|
+
stay.position.set(-1.82, 0.95, side * 0.4);
|
|
338
|
+
shell.add(stay);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Diffuser and its strake array.
|
|
342
|
+
const diffuser = part(new BoxGeometry(0.36, 0.14, 1.34), materials.carbon);
|
|
343
|
+
diffuser.position.set(-2.02, 0.17, 0);
|
|
344
|
+
diffuser.rotation.z = -0.34;
|
|
345
|
+
shell.add(diffuser);
|
|
346
|
+
for (let index = 0; index < 3; index += 1) {
|
|
347
|
+
const strake = part(new BoxGeometry(0.32, 0.13, 0.04), materials.alloy);
|
|
348
|
+
strake.position.set(-2.02, 0.16, MathUtils.lerp(-0.44, 0.44, index / 2));
|
|
349
|
+
strake.rotation.z = -0.34;
|
|
350
|
+
shell.add(strake);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Livery: a roundel and two stripes as thin coplanar discs and quads. Decals, not textures, so
|
|
354
|
+
// the template ships no image and the colours stay editable in `materials.ts`.
|
|
355
|
+
for (const side of [-1, 1]) {
|
|
356
|
+
const roundel = part(new CircleGeometry(0.19, 20), materials.livery);
|
|
357
|
+
roundel.position.set(-0.3, 0.5, side * 0.83);
|
|
358
|
+
roundel.rotation.y = side > 0 ? 0 : Math.PI;
|
|
359
|
+
roundel.castShadow = false;
|
|
360
|
+
shell.add(roundel);
|
|
361
|
+
}
|
|
362
|
+
for (const offset of [-0.13, 0.13]) {
|
|
363
|
+
// Bonnet only. Run the length of the car the stripe passes straight through the cabin hull and
|
|
364
|
+
// the buried part surfaces through its roof as stray white tabs; carried onto the rear deck it
|
|
365
|
+
// read as road markings painted on the car.
|
|
366
|
+
const bonnet = part(new BoxGeometry(1.5, 0.012, 0.11), materials.livery);
|
|
367
|
+
bonnet.position.set(1.24, 0.598, offset);
|
|
368
|
+
bonnet.castShadow = false;
|
|
369
|
+
shell.add(bonnet);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// A tail light bar across the full width. The tail is where the wing, the diffuser and the body
|
|
373
|
+
// all meet, and without one bright horizontal the eye finds nothing to hold there — which
|
|
374
|
+
// matters more than any other detail, because the chase camera looks at this face all game.
|
|
375
|
+
// A pale *deck* panel was tried here first and swallowed the whole rear: a light plate that
|
|
376
|
+
// large stops being a highlight and becomes the shape.
|
|
377
|
+
const tailBar = part(new BoxGeometry(0.06, 0.08, 1.06), materials.taillamp);
|
|
378
|
+
tailBar.position.set(-2.02, 0.5, 0);
|
|
379
|
+
tailBar.castShadow = false;
|
|
380
|
+
shell.add(tailBar);
|
|
381
|
+
|
|
382
|
+
// Emissive corner strips, so the car still reads when the sun is low or the tier drops post.
|
|
383
|
+
for (const side of [-1, 1] as const) {
|
|
384
|
+
const lamp = part(new BoxGeometry(0.06, 0.1, 0.3), materials.headlamp);
|
|
385
|
+
lamp.position.set(2.0, 0.44, side * 0.5);
|
|
386
|
+
lamp.castShadow = false;
|
|
387
|
+
shell.add(lamp);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Running gear. Rear tyres are larger, which is both true of the class and the cheapest way to
|
|
391
|
+
// make the tail read as the driven end.
|
|
392
|
+
for (const [x, radius] of [
|
|
393
|
+
[1.28, 0.33],
|
|
394
|
+
[-1.42, 0.37],
|
|
395
|
+
] as const) {
|
|
396
|
+
for (const side of [-1, 1] as const) {
|
|
397
|
+
const group = wheel(materials, radius);
|
|
398
|
+
group.position.set(x, radius, side * 0.72);
|
|
399
|
+
group.scale.z = side;
|
|
400
|
+
group.name = `wheel-${x > 0 ? "front" : "rear"}-${side > 0 ? "left" : "right"}`;
|
|
401
|
+
root.add(group);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
shell.attachTo(root);
|
|
405
|
+
return root;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/** The chequered pennant at the finish line: a pole and a triangular pennant, not two boxes. */
|
|
29
409
|
export function flag(material: Material): Group {
|
|
30
410
|
const root = new Group();
|
|
31
|
-
const pole = new Mesh(new CylinderGeometry(0.
|
|
32
|
-
pole.position.y =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
411
|
+
const pole = new Mesh(new CylinderGeometry(0.04, 0.05, 2.4, 8), material);
|
|
412
|
+
pole.position.y = 1.2;
|
|
413
|
+
pole.castShadow = true;
|
|
414
|
+
const pennant = new Mesh(new ConeGeometry(0.3, 0.9, 3), material);
|
|
415
|
+
pennant.rotation.z = -Math.PI / 2;
|
|
416
|
+
pennant.rotation.y = Math.PI / 2;
|
|
417
|
+
pennant.position.set(0.45, 2.05, 0);
|
|
418
|
+
pennant.castShadow = true;
|
|
419
|
+
root.add(pole, pennant);
|
|
36
420
|
return root;
|
|
37
421
|
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Trackside furniture, authored as **geometry** rather than as groups of meshes.
|
|
425
|
+
*
|
|
426
|
+
* There are sixty-odd trees, twenty-eight hoardings and twenty tyre stacks around this circuit. As
|
|
427
|
+
* `Group`s of meshes that is nineteen hundred draw calls and the performance playtest fails on the
|
|
428
|
+
* spot. Each prop is instead merged into one geometry per material here, and `Track.ts` places
|
|
429
|
+
* every copy into an `InstancedBatch` — the same circuit in a handful of draws.
|
|
430
|
+
*
|
|
431
|
+
* Each function returns the geometry in metres with its base at y = 0, ready to be placed.
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
/** Bake a mesh's own transform into its geometry so a group can be merged into one buffer. */
|
|
435
|
+
function baked(mesh: Mesh): BufferGeometry {
|
|
436
|
+
mesh.updateMatrix();
|
|
437
|
+
return mesh.geometry.clone().applyMatrix4(mesh.matrix);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function merged(meshes: readonly Mesh[]): BufferGeometry {
|
|
441
|
+
const geometry = mergeGeometries(meshes.map(baked), false);
|
|
442
|
+
if (geometry === null) throw new Error("mergeGeometries returned null for a trackside prop.");
|
|
443
|
+
geometry.computeVertexNormals();
|
|
444
|
+
return geometry;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/** A stack of three tyres: the cheapest piece of trackside furniture that reads instantly. */
|
|
448
|
+
export function tyreStackGeometry(height = 3): BufferGeometry {
|
|
449
|
+
// Eight segments and five profile points. Twenty stacks of three at twelve segments each was
|
|
450
|
+
// nine thousand triangles of scenery nobody looks at directly.
|
|
451
|
+
const profile = [
|
|
452
|
+
new Vector2(0.0001, -0.11),
|
|
453
|
+
new Vector2(0.34, -0.11),
|
|
454
|
+
new Vector2(0.38, 0),
|
|
455
|
+
new Vector2(0.34, 0.11),
|
|
456
|
+
new Vector2(0.0001, 0.11),
|
|
457
|
+
];
|
|
458
|
+
const parts: Mesh[] = [];
|
|
459
|
+
for (let index = 0; index < height; index += 1) {
|
|
460
|
+
const tyre = new Mesh(new LatheGeometry(profile, 8));
|
|
461
|
+
tyre.position.y = 0.11 + index * 0.22;
|
|
462
|
+
tyre.rotation.y = index * 0.7;
|
|
463
|
+
parts.push(tyre);
|
|
464
|
+
}
|
|
465
|
+
return merged(parts);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** A conifer, in two pieces: trunk and canopy, so each takes its own material. */
|
|
469
|
+
export function treeGeometry(): { canopy: BufferGeometry; trunk: BufferGeometry } {
|
|
470
|
+
const stem = new Mesh(new CylinderGeometry(0.14, 0.2, 1.6, 6));
|
|
471
|
+
stem.position.y = 0.8;
|
|
472
|
+
const tiers: Mesh[] = [];
|
|
473
|
+
for (let index = 0; index < 3; index += 1) {
|
|
474
|
+
const tier = new Mesh(new ConeGeometry(1.1 - index * 0.26, 1.5 - index * 0.2, 7));
|
|
475
|
+
tier.position.y = 1.5 + index * 0.7;
|
|
476
|
+
tiers.push(tier);
|
|
477
|
+
}
|
|
478
|
+
return { canopy: merged(tiers), trunk: merged([stem]) };
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/** A sponsor hoarding: two posts and a rail in one piece, the board in another. */
|
|
482
|
+
export function hoardingGeometry(width = 5): {
|
|
483
|
+
board: BufferGeometry;
|
|
484
|
+
frame: BufferGeometry;
|
|
485
|
+
} {
|
|
486
|
+
const frame: Mesh[] = [];
|
|
487
|
+
for (const side of [-1, 1]) {
|
|
488
|
+
const post = new Mesh(new CylinderGeometry(0.06, 0.06, 1.1, 5));
|
|
489
|
+
post.position.set(0, 0.55, (side * width) / 2.6);
|
|
490
|
+
frame.push(post);
|
|
491
|
+
}
|
|
492
|
+
const rail = new Mesh(new BoxGeometry(0.12, 0.08, width));
|
|
493
|
+
rail.position.y = 1.32;
|
|
494
|
+
frame.push(rail);
|
|
495
|
+
// Upright, not raked. A tilt looked like a fallen board once the row was rotated to face the
|
|
496
|
+
// road, because the tilt is applied in the board's own frame and turns into a lean.
|
|
497
|
+
const panel = new Mesh(new BoxGeometry(0.08, 0.72, width));
|
|
498
|
+
panel.position.y = 0.94;
|
|
499
|
+
return { board: merged([panel]), frame: merged(frame) };
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** A grandstand: a raked deck on legs with a canopy, and a crowd placed into its own batch. */
|
|
503
|
+
export function grandstand(
|
|
504
|
+
structure: Material,
|
|
505
|
+
seats: Material,
|
|
506
|
+
): {
|
|
507
|
+
crowd: readonly [number, number, number][];
|
|
508
|
+
group: Group;
|
|
509
|
+
} {
|
|
510
|
+
const root = new Group();
|
|
511
|
+
const rows = 5;
|
|
512
|
+
const decks: Mesh[] = [];
|
|
513
|
+
const crowd: [number, number, number][] = [];
|
|
514
|
+
for (let index = 0; index < rows; index += 1) {
|
|
515
|
+
const deck = new Mesh(new BoxGeometry(11, 0.5, 1.5));
|
|
516
|
+
deck.position.set(0, 0.7 + index * 0.6, -index * 1.35);
|
|
517
|
+
decks.push(deck);
|
|
518
|
+
for (let seat = 0; seat < 9; seat += 1) {
|
|
519
|
+
crowd.push([
|
|
520
|
+
MathUtils.lerp(-4.6, 4.6, seat / 8) + (index % 2 === 0 ? 0.3 : -0.3),
|
|
521
|
+
1.24 + index * 0.6,
|
|
522
|
+
-index * 1.35,
|
|
523
|
+
]);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const deckMesh = new Mesh(merged(decks), seats);
|
|
527
|
+
deckMesh.castShadow = true;
|
|
528
|
+
deckMesh.receiveShadow = true;
|
|
529
|
+
root.add(deckMesh);
|
|
530
|
+
|
|
531
|
+
const frame: Mesh[] = [];
|
|
532
|
+
for (const side of [-1, 1]) {
|
|
533
|
+
const leg = new Mesh(new BoxGeometry(0.4, 3.4, 7));
|
|
534
|
+
leg.position.set(side * 5.2, 1.7, -2.7);
|
|
535
|
+
frame.push(leg);
|
|
536
|
+
const post = new Mesh(new CylinderGeometry(0.12, 0.12, 5.2, 6));
|
|
537
|
+
post.position.set(side * 5.2, 2.6, 0.8);
|
|
538
|
+
frame.push(post);
|
|
539
|
+
}
|
|
540
|
+
const canopy = new Mesh(new BoxGeometry(11.6, 0.22, 8));
|
|
541
|
+
canopy.position.set(0, 5.1, -2.6);
|
|
542
|
+
canopy.rotation.x = -0.1;
|
|
543
|
+
frame.push(canopy);
|
|
544
|
+
const frameMesh = new Mesh(merged(frame), structure);
|
|
545
|
+
frameMesh.castShadow = true;
|
|
546
|
+
root.add(frameMesh);
|
|
547
|
+
return { crowd, group: root };
|
|
548
|
+
}
|
|
@@ -15,14 +15,17 @@ export function setupSky(scene: Scene): void {
|
|
|
15
15
|
const top = new Color(palette.skyHigh);
|
|
16
16
|
const bottom = new Color(palette.skyLow);
|
|
17
17
|
scene.background = top;
|
|
18
|
-
|
|
18
|
+
// Fog starts well past the trackside furniture. At the old `36` the grandstands on the far side
|
|
19
|
+
// of the circuit were already half dissolved, which is why the infield read as one flat wash
|
|
20
|
+
// instead of a place with things in it.
|
|
21
|
+
scene.fog = new Fog(bottom, 70, 230);
|
|
19
22
|
|
|
20
23
|
// A vertical gradient, not a flat fill. This dome used to be one solid colour, and a blind score
|
|
21
24
|
// of the first frame read it as exactly that: the sky sampled CEE6EA byte-identical at four
|
|
22
25
|
// different heights.
|
|
23
26
|
// Sky is most of the frame, so a flat one costs more than anything else here. Edit or delete
|
|
24
27
|
// this — it is your file.
|
|
25
|
-
const radius =
|
|
28
|
+
const radius = 260;
|
|
26
29
|
const geometry = new SphereGeometry(radius, 24, 12);
|
|
27
30
|
const positions = geometry.getAttribute("position");
|
|
28
31
|
const colors = new Float32Array(positions.count * 3);
|