create-threenative 0.2.6 → 0.2.7
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 +2 -2
- package/agent-docs/references/build-profiles.md +126 -0
- package/agent-docs/references/capability-reference.md +431 -20
- package/agent-docs/references/performance-basics.md +8 -5
- package/agent-docs/references/sculpt-from-a-reference.md +1 -1
- package/agent-docs/references/trace-a-slow-frame.md +1 -1
- package/agent-docs/references/visual-baseline.md +8 -4
- package/agent-files/.agents/skills/file-engine-bug/SKILL.md +15 -4
- package/agent-files/.agents/skills/threenative-assets/SKILL.md +5 -5
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +1 -1
- package/agent-files/.agents/skills/threenative-context/SKILL.md +1 -1
- package/agent-files/.agents/skills/threenative-performance/SKILL.md +3 -3
- package/agent-files/.agents/skills/threenative-playtest/SKILL.md +1 -1
- package/agent-files/.agents/skills/threenative-ui/SKILL.md +1 -1
- package/agent-files/.agents/skills/threenative-visuals/SKILL.md +4 -4
- package/capabilities.json +555 -21
- package/dist/index.d.ts +30 -1
- package/dist/index.js +294 -55
- package/dist/threenative.js +714 -154
- package/package.json +6 -6
- package/template-assets/assets/mannequin-combat.glb +0 -0
- package/template-assets/assets/mannequin.glb +0 -0
- package/template-assets/assets/player-viewmodel.glb +0 -0
- package/template-assets/assets/sky.jpg +0 -0
- package/template-assets/clearwater/README.md +141 -0
- package/template-assets/clearwater/install.mjs +50 -0
- package/template-assets/clearwater/src/clearwater.ts +180 -0
- package/template-assets/clearwater/src/clearwaterDemo.ts +28 -0
- package/template-assets/clearwater/src/clearwaterLifetime.ts +28 -0
- package/{LICENSE → template-assets/clearwater/src/render/CLEARWATER-LICENSE.txt} +4 -1
- package/template-assets/clearwater/src/render/clearwater.ts +278 -0
- package/template-assets/clearwater/src/render/clearwaterCaustics.ts +138 -0
- package/template-assets/clearwater/src/render/clearwaterDemo.ts +65 -0
- package/template-assets/clearwater/src/render/clearwaterOptics.ts +33 -0
- package/template-assets/clearwater/src/render/clearwaterOptions.ts +177 -0
- package/template-assets/clearwater/src/render/clearwaterPass.ts +51 -0
- package/template-assets/patches/three@0.185.1.patch +2101 -138
- package/template-assets/worldEnvironment.ts +52 -1
- package/templates/action-rpg/AGENTS.md +42 -42
- package/templates/action-rpg/CLAUDE.md +42 -42
- package/templates/action-rpg/kit.json +1 -1
- package/templates/action-rpg/package.json +13 -7
- package/templates/action-rpg/playtests/combat.playtest.json +162 -23
- package/templates/action-rpg/playtests/performance.playtest.json +4 -3
- package/templates/action-rpg/playtests/survives.playtest.json +25 -8
- package/templates/action-rpg/src/conventions.ts +24 -18
- package/templates/action-rpg/src/entities/Enemy.ts +74 -24
- package/templates/action-rpg/src/entities/Fighter.ts +127 -0
- package/templates/action-rpg/src/entities/Player.ts +102 -32
- package/templates/action-rpg/src/game.ts +3 -3
- package/templates/action-rpg/src/render/camera.ts +18 -16
- package/templates/action-rpg/src/render/dungeon.ts +192 -0
- package/templates/action-rpg/src/render/lighting.ts +45 -28
- package/templates/action-rpg/src/render/loading.ts +4 -4
- package/templates/action-rpg/src/render/materials.ts +191 -47
- package/templates/action-rpg/src/render/palette.ts +14 -13
- package/templates/action-rpg/src/render/postprocessing.ts +12 -2
- package/templates/action-rpg/src/render/props.ts +117 -0
- package/templates/action-rpg/src/render/quality.ts +40 -82
- package/templates/action-rpg/src/render/sky.ts +36 -13
- package/templates/action-rpg/src/render/touch-controls.ts +1 -1
- package/templates/action-rpg/src/render/worldEnvironment.ts +52 -1
- package/templates/action-rpg/src/scenes/Play.ts +61 -39
- package/templates/action-rpg/src/style.css +9 -7
- package/templates/action-rpg/src/ui/AbilityBar.tsx +3 -1
- package/templates/action-rpg/src/ui/Hud.tsx +3 -3
- package/templates/action-rpg/threenative.config.ts +14 -1
- package/templates/action-rpg/vite.config.ts +4 -1
- package/templates/minimal/AGENTS.md +10 -10
- package/templates/minimal/CLAUDE.md +10 -10
- package/templates/minimal/package.json +12 -6
- package/templates/minimal/playtests/play.playtest.json +6 -5
- package/templates/minimal/playtests/sky.playtest.json +27 -0
- package/templates/minimal/src/conventions.ts +6 -3
- package/templates/minimal/src/entities/Player.ts +73 -27
- package/templates/minimal/src/main.ts +2 -3
- package/templates/minimal/src/render/camera.ts +22 -4
- package/templates/minimal/src/render/lighting.ts +24 -48
- package/templates/minimal/src/render/materials.ts +158 -13
- package/templates/minimal/src/render/palette.ts +10 -7
- package/templates/minimal/src/render/postprocessing.ts +12 -25
- package/templates/minimal/src/render/quality.ts +35 -69
- package/templates/minimal/src/render/sky.ts +35 -54
- package/templates/minimal/src/render/touch-controls.ts +1 -1
- package/templates/minimal/src/render/worldEnvironment.ts +52 -1
- package/templates/minimal/src/scenes/Play.ts +121 -111
- package/templates/minimal/src/state.ts +0 -4
- package/templates/minimal/src/style.css +0 -10
- package/templates/minimal/threenative.config.ts +14 -1
- package/templates/minimal/vite.config.ts +4 -1
- package/templates/platformer/AGENTS.md +18 -56
- package/templates/platformer/CLAUDE.md +18 -56
- package/templates/platformer/kit.json +2 -2
- package/templates/platformer/package.json +13 -9
- package/templates/platformer/playtests/buffer.playtest.json +15 -5
- package/templates/platformer/playtests/collect.playtest.json +8 -34
- package/templates/platformer/playtests/coyote.playtest.json +12 -34
- package/templates/platformer/playtests/damage.playtest.json +40 -15
- package/templates/platformer/playtests/hud.playtest.json +34 -0
- package/templates/platformer/playtests/move.playtest.json +24 -0
- package/templates/platformer/playtests/performance.playtest.json +24 -7
- package/templates/platformer/playtests/respawn.playtest.json +46 -11
- package/templates/platformer/playtests/stomp.playtest.json +49 -12
- package/templates/platformer/playtests/survives.playtest.json +3 -19
- package/templates/platformer/playtests/world.playtest.json +26 -0
- package/templates/platformer/src/entities/Fox.ts +273 -0
- package/templates/platformer/src/entities/Pickup.ts +43 -60
- package/templates/platformer/src/entities/Walker.ts +88 -0
- package/templates/platformer/src/game.ts +11 -8
- package/templates/platformer/src/level/Checkpoints.ts +29 -16
- package/templates/platformer/src/level/Stage.ts +469 -0
- package/templates/platformer/src/render/blocks.ts +94 -0
- package/templates/platformer/src/render/camera.ts +28 -3
- package/templates/platformer/src/render/fox.ts +196 -0
- package/templates/platformer/src/render/lighting.ts +42 -33
- package/templates/platformer/src/render/materials.ts +115 -5
- package/templates/platformer/src/render/palette.ts +68 -53
- package/templates/platformer/src/render/pickups.ts +142 -0
- package/templates/platformer/src/render/postprocessing.ts +12 -2
- package/templates/platformer/src/render/props.ts +147 -0
- package/templates/platformer/src/render/quality.ts +47 -99
- package/templates/platformer/src/render/scenery.ts +172 -0
- package/templates/platformer/src/render/sky.ts +120 -31
- package/templates/platformer/src/render/touch-controls.ts +5 -2
- package/templates/platformer/src/render/walkers.ts +96 -0
- package/templates/platformer/src/render/waterfall.ts +85 -0
- package/templates/platformer/src/render/worldEnvironment.ts +52 -1
- package/templates/platformer/src/scenes/Boot.ts +3 -4
- package/templates/platformer/src/scenes/Play.ts +362 -0
- package/templates/platformer/src/state.ts +16 -14
- package/templates/platformer/src/style.css +9 -8
- package/templates/platformer/src/ui/Hud.tsx +62 -29
- package/templates/platformer/src/ui/Menu.tsx +2 -2
- package/templates/platformer/threenative.config.ts +14 -1
- package/templates/platformer/vite.config.ts +4 -1
- package/templates/puzzle/AGENTS.md +19 -20
- package/templates/puzzle/CLAUDE.md +19 -20
- package/templates/puzzle/assets/native-proof.glb +0 -0
- package/templates/puzzle/assets/native-proof.png +0 -0
- package/templates/puzzle/kit.json +1 -1
- package/templates/puzzle/package.json +13 -7
- package/templates/puzzle/playtests/axis.playtest.json +20 -0
- package/templates/puzzle/playtests/blocked.playtest.json +73 -0
- package/templates/puzzle/playtests/caused.playtest.json +65 -0
- package/templates/puzzle/playtests/lit.playtest.json +74 -0
- package/templates/puzzle/playtests/performance.playtest.json +24 -7
- package/templates/{starter/playtests/respawn.playtest.json → puzzle/playtests/push.playtest.json} +24 -19
- package/templates/puzzle/playtests/replay.playtest.json +81 -0
- package/templates/puzzle/playtests/restart.playtest.json +108 -0
- package/templates/puzzle/playtests/seal.playtest.json +98 -0
- package/templates/puzzle/playtests/settle.playtest.json +100 -0
- package/templates/puzzle/playtests/survives.playtest.json +6 -29
- package/templates/{starter/playtests/hot-reload.playtest.json → puzzle/playtests/travel.playtest.json} +6 -5
- package/templates/puzzle/src/entities/Crate.ts +99 -42
- package/templates/puzzle/src/entities/Seal.ts +69 -0
- package/templates/puzzle/src/entities/Warden.ts +135 -0
- package/templates/puzzle/src/game.ts +15 -11
- package/templates/puzzle/src/render/camera.ts +66 -31
- package/templates/puzzle/src/render/crateShape.ts +70 -0
- package/templates/puzzle/src/render/lighting.ts +41 -41
- package/templates/puzzle/src/render/loading.ts +4 -4
- package/templates/puzzle/src/render/materials.ts +131 -27
- package/templates/puzzle/src/render/palette.ts +19 -29
- package/templates/puzzle/src/render/postprocessing.ts +15 -3
- package/templates/puzzle/src/render/quality.ts +71 -80
- package/templates/puzzle/src/render/shapes.ts +109 -108
- package/templates/puzzle/src/render/sky.ts +18 -10
- package/templates/puzzle/src/render/touch-controls.ts +8 -51
- package/templates/puzzle/src/render/vault.ts +315 -0
- package/templates/puzzle/src/render/warden.ts +46 -0
- package/templates/puzzle/src/render/worldEnvironment.ts +52 -1
- package/templates/puzzle/src/scenes/Play.ts +793 -0
- package/templates/puzzle/src/state.ts +55 -24
- package/templates/puzzle/src/style.css +7 -8
- package/templates/puzzle/src/ui/App.tsx +2 -2
- package/templates/puzzle/src/ui/Hud.tsx +92 -40
- package/templates/puzzle/src/ui/Menu.tsx +40 -2
- package/templates/puzzle/threenative.config.ts +14 -1
- package/templates/puzzle/vite.config.ts +4 -1
- package/templates/racing/AGENTS.md +19 -20
- package/templates/racing/CLAUDE.md +19 -20
- package/templates/racing/package.json +13 -7
- package/templates/racing/playtests/boost.playtest.json +33 -12
- package/templates/racing/playtests/outcome.playtest.json +32 -50
- package/templates/racing/playtests/performance.playtest.json +2 -1
- package/templates/racing/playtests/ranking.playtest.json +5 -14
- package/templates/racing/playtests/rescue.playtest.json +2 -2
- package/templates/racing/playtests/reverse.playtest.json +30 -8
- package/templates/racing/playtests/shortcut.playtest.json +54 -9
- package/templates/racing/playtests/touch-controls.playtest.json +32 -5
- package/templates/racing/src/entities/CarBody.ts +327 -0
- package/templates/racing/src/entities/LineDriver.ts +220 -0
- package/templates/racing/src/entities/RacingCar.ts +150 -89
- package/templates/racing/src/entities/Rival.ts +61 -24
- package/templates/racing/src/game.ts +5 -0
- package/templates/racing/src/render/camera.ts +49 -7
- package/templates/racing/src/render/lighting.ts +36 -37
- package/templates/racing/src/render/materials.ts +239 -19
- package/templates/racing/src/render/palette.ts +19 -21
- package/templates/racing/src/render/postprocessing.ts +12 -2
- package/templates/racing/src/render/quality.ts +43 -82
- package/templates/racing/src/render/shapes.ts +20 -6
- package/templates/racing/src/render/sky.ts +47 -39
- package/templates/racing/src/render/touch-controls.ts +1 -1
- package/templates/racing/src/render/worldEnvironment.ts +52 -1
- package/templates/racing/src/scenes/Race.ts +107 -54
- package/templates/racing/src/state.ts +2 -0
- package/templates/racing/src/track/Checkline.ts +22 -7
- package/templates/racing/src/track/Lap.ts +64 -36
- package/templates/racing/src/track/Ranking.ts +20 -11
- package/templates/racing/src/track/Track.ts +809 -361
- package/templates/racing/src/track/TrackSector.ts +40 -11
- package/templates/racing/src/track/circuit.ts +477 -0
- package/templates/racing/src/track/rescue.ts +16 -4
- package/templates/racing/threenative.config.ts +14 -1
- package/templates/racing/vite.config.ts +4 -1
- package/templates/rts/AGENTS.md +96 -0
- package/templates/rts/CLAUDE.md +98 -0
- package/templates/rts/kit.json +7 -0
- package/templates/{defense → rts}/package.json +13 -7
- package/templates/{defense → rts}/playtests/performance.playtest.json +28 -26
- package/templates/rts/playtests/rts-ai-attack.playtest.json +24 -0
- package/templates/rts/playtests/rts-attack.playtest.json +75 -0
- package/templates/rts/playtests/rts-build.playtest.json +68 -0
- package/templates/rts/playtests/rts-orders.playtest.json +150 -0
- package/templates/rts/playtests/rts-train.playtest.json +62 -0
- package/templates/rts/playtests/survives.playtest.json +58 -0
- package/templates/rts/public/favicon.svg +4 -0
- package/templates/rts/src/game.ts +64 -0
- package/templates/rts/src/orders.ts +22 -0
- package/templates/rts/src/render/army.ts +346 -0
- package/templates/rts/src/render/camera.ts +123 -0
- package/templates/rts/src/render/lighting.ts +61 -0
- package/templates/rts/src/render/loading.ts +33 -0
- package/templates/rts/src/render/materials.ts +152 -0
- package/templates/rts/src/render/models.ts +705 -0
- package/templates/rts/src/render/palette.ts +17 -0
- package/templates/rts/src/render/picking.ts +93 -0
- package/templates/{defense → rts}/src/render/postprocessing.ts +15 -3
- package/templates/rts/src/render/quality.ts +128 -0
- package/templates/rts/src/render/resources.ts +141 -0
- package/templates/rts/src/render/sky.ts +44 -0
- package/templates/rts/src/render/terrain.ts +116 -0
- package/templates/{defense → rts}/src/render/worldEnvironment.ts +52 -1
- package/templates/rts/src/scenes/Play.ts +650 -0
- package/templates/rts/src/sim/ai.ts +1140 -0
- package/templates/rts/src/sim/combat.ts +416 -0
- package/templates/rts/src/sim/construction.ts +374 -0
- package/templates/rts/src/sim/economy.ts +167 -0
- package/templates/rts/src/sim/game.ts +1082 -0
- package/templates/rts/src/sim/movement.ts +371 -0
- package/templates/rts/src/sim/nav.ts +276 -0
- package/templates/rts/src/sim/production.ts +180 -0
- package/templates/rts/src/sim/terrain.ts +170 -0
- package/templates/rts/src/sim/types.ts +647 -0
- package/templates/rts/src/sim/vision.ts +46 -0
- package/templates/rts/src/state.ts +100 -0
- package/templates/{defense → rts}/src/style.css +21 -8
- package/templates/rts/src/ui/App.tsx +21 -0
- package/templates/rts/src/ui/Commands.tsx +129 -0
- package/templates/rts/src/ui/GameUi.tsx +22 -0
- package/templates/rts/src/ui/Hud.tsx +165 -0
- package/templates/rts/src/ui/Minimap.tsx +84 -0
- package/templates/rts/tailwind.config.ts +2 -0
- package/templates/rts/threenative.config.ts +56 -0
- package/templates/rts/tsconfig.json +17 -0
- package/templates/{defense → rts}/vite.config.ts +4 -1
- package/templates/runner/AGENTS.md +6 -10
- package/templates/runner/CLAUDE.md +6 -10
- package/templates/runner/README.md +3 -3
- package/templates/runner/package.json +13 -7
- package/templates/runner/playtests/performance.playtest.json +2 -2
- package/templates/runner/src/conventions.ts +4 -3
- package/templates/runner/src/entities/Runner.ts +54 -7
- package/templates/runner/src/game.ts +2 -0
- package/templates/runner/src/render/camera.ts +4 -2
- package/templates/runner/src/render/dust.ts +5 -2
- package/templates/runner/src/render/lighting.ts +41 -45
- package/templates/runner/src/render/loading.ts +2 -2
- package/templates/runner/src/render/materials.ts +165 -25
- package/templates/runner/src/render/palette.ts +17 -28
- package/templates/runner/src/render/postprocessing.ts +12 -2
- package/templates/runner/src/render/quality.ts +42 -96
- package/templates/runner/src/render/shapes.ts +59 -37
- package/templates/runner/src/render/sky.ts +32 -41
- package/templates/runner/src/render/touch-controls.ts +1 -1
- package/templates/runner/src/render/worldEnvironment.ts +52 -1
- package/templates/runner/src/scenes/Run.ts +26 -6
- package/templates/runner/src/track.ts +6 -1
- package/templates/runner/threenative.config.ts +14 -1
- package/templates/runner/vite.config.ts +4 -1
- package/templates/sailing/AGENTS.md +12 -12
- package/templates/sailing/CLAUDE.md +12 -12
- package/templates/sailing/assets/ship.glb +0 -0
- package/templates/sailing/package.json +13 -7
- package/templates/sailing/playtests/float-after-the-run-ends.playtest.json +10 -6
- package/templates/sailing/playtests/sails.playtest.json +33 -0
- package/templates/sailing/playtests/win.playtest.json +156 -8
- package/templates/sailing/src/conventions.ts +29 -2
- package/templates/sailing/src/entities/Ship.ts +381 -57
- package/templates/sailing/src/game.ts +14 -0
- package/templates/sailing/src/render/camera.ts +63 -9
- package/templates/sailing/src/render/lighting.ts +49 -27
- package/templates/sailing/src/render/materials.ts +50 -15
- package/templates/sailing/src/render/ocean.ts +647 -60
- package/templates/sailing/src/render/palette.ts +16 -12
- package/templates/sailing/src/render/postprocessing.ts +12 -2
- package/templates/sailing/src/render/props.ts +316 -442
- package/templates/sailing/src/render/quality.ts +14 -4
- package/templates/sailing/src/render/sky.ts +116 -23
- package/templates/sailing/src/render/worldEnvironment.ts +52 -1
- package/templates/sailing/src/scenes/Boot.ts +21 -0
- package/templates/sailing/src/scenes/Sailing.ts +173 -39
- package/templates/sailing/src/state.ts +6 -0
- package/templates/sailing/src/ui/Hud.tsx +41 -9
- package/templates/sailing/threenative.config.ts +14 -1
- package/templates/sailing/vite.config.ts +4 -1
- package/templates/shooter/AGENTS.md +27 -42
- package/templates/shooter/CLAUDE.md +27 -42
- package/templates/shooter/index.html +1 -0
- package/templates/shooter/package.json +13 -7
- package/templates/shooter/playtests/aim-alignment.playtest.json +58 -0
- package/templates/shooter/playtests/breakable-shatters.playtest.json +62 -0
- package/templates/shooter/playtests/bullet-holes.playtest.json +56 -0
- package/templates/shooter/playtests/camera-tracks-body-vertically.playtest.json +61 -0
- package/templates/shooter/playtests/crouch-lowers-the-eye.playtest.json +41 -0
- package/templates/shooter/playtests/death-no-snap.playtest.json +77 -0
- package/templates/shooter/playtests/debug-ads.playtest.json +58 -0
- package/templates/shooter/playtests/debug-clear.playtest.json +383 -0
- package/templates/shooter/playtests/debug-endurance.playtest.json +61 -0
- package/templates/shooter/playtests/debug-fire.playtest.json +119 -0
- package/templates/shooter/playtests/debug-restart.playtest.json +24 -0
- package/templates/shooter/playtests/enemy-body-is-a-body.playtest.json +79 -0
- package/templates/shooter/playtests/enemy-death-settles.playtest.json +64 -0
- package/templates/shooter/playtests/enemy-flinches-when-hit.playtest.json +75 -0
- package/templates/shooter/playtests/enemy-foot-contact.playtest.json +41 -0
- package/templates/shooter/playtests/enemy-material-is-not-shared.playtest.json +59 -0
- package/templates/shooter/playtests/enemy-reaches-walkway.playtest.json +80 -0
- package/templates/shooter/playtests/enemy-rifle-grip.playtest.json +101 -0
- package/templates/shooter/playtests/enemy-scale.playtest.json +56 -0
- package/templates/shooter/playtests/enemy-stops-without-snapping.playtest.json +486 -0
- package/templates/shooter/playtests/enemy-stride-matches-speed.playtest.json +198 -0
- package/templates/shooter/playtests/enemy-stride-under-crouch.playtest.json +87 -0
- package/templates/shooter/playtests/enemy-uses-crouch-clips.playtest.json +74 -0
- package/templates/shooter/playtests/five-soldiers.playtest.json +83 -0
- package/templates/shooter/playtests/flash-retires.playtest.json +62 -0
- package/templates/shooter/playtests/headshot-hits-head.playtest.json +132 -0
- package/templates/shooter/playtests/hold-to-fire.playtest.json +45 -0
- package/templates/shooter/playtests/input-control.playtest.json +43 -98
- package/templates/shooter/playtests/minimap-state.playtest.json +75 -0
- package/templates/shooter/playtests/performance.playtest.json +62 -26
- package/templates/{starter/playtests/forward.playtest.json → shooter/playtests/round-clock.playtest.json} +11 -16
- package/templates/shooter/playtests/shot-tracks-crosshair.playtest.json +79 -0
- package/templates/shooter/playtests/survives.playtest.json +36 -30
- package/templates/shooter/playtests/walkway-reachable.playtest.json +67 -0
- package/templates/shooter/src/entities/Breakables.ts +412 -0
- package/templates/shooter/src/entities/Enemy.ts +2095 -0
- package/templates/shooter/src/entities/FpsPlayer.ts +283 -0
- package/templates/shooter/src/entities/Rifle.ts +442 -0
- package/templates/shooter/src/entities/Target.ts +199 -83
- package/templates/shooter/src/entities/TouchControls.ts +276 -0
- package/templates/shooter/src/game.ts +75 -41
- package/templates/shooter/src/main.ts +0 -1
- package/templates/shooter/src/postPhysics.ts +36 -0
- package/templates/shooter/src/render/camera.ts +78 -74
- package/templates/shooter/src/render/decals.ts +142 -82
- package/templates/shooter/src/render/facade.ts +1373 -0
- package/templates/shooter/src/render/gunfx.ts +704 -0
- package/templates/shooter/src/render/lighting.ts +52 -38
- package/templates/shooter/src/render/loading.ts +2 -2
- package/templates/shooter/src/render/materials.ts +100 -88
- package/templates/shooter/src/render/occlusion.ts +108 -0
- package/templates/shooter/src/render/palette.ts +10 -10
- package/templates/shooter/src/render/palm.ts +455 -0
- package/templates/shooter/src/render/pooled-billboards.ts +144 -0
- package/templates/shooter/src/render/postprocessing.ts +15 -3
- package/templates/shooter/src/render/quality.ts +40 -82
- package/templates/shooter/src/render/scale.ts +148 -15
- package/templates/shooter/src/render/shapes.ts +138 -613
- package/templates/shooter/src/render/sky.ts +35 -35
- package/templates/shooter/src/render/town-schematic.ts +120 -0
- package/templates/shooter/src/render/town.ts +986 -0
- package/templates/shooter/src/render/townMaterials.ts +160 -0
- package/templates/shooter/src/render/vehicles.ts +741 -0
- package/templates/shooter/src/render/worldEnvironment.ts +52 -1
- package/templates/shooter/src/scenes/Play.ts +727 -650
- package/templates/shooter/src/state.ts +26 -41
- package/templates/shooter/src/style.css +207 -11
- package/templates/shooter/src/surfaces.ts +131 -0
- package/templates/shooter/src/ui/App.tsx +9 -10
- package/templates/shooter/src/ui/Crosshair.tsx +25 -18
- package/templates/shooter/src/ui/GameUi.tsx +6 -9
- package/templates/shooter/src/ui/Hud.tsx +428 -39
- package/templates/shooter/src/ui/Minimap.tsx +164 -0
- package/templates/shooter/src/ui/TouchOverlay.tsx +54 -0
- package/templates/shooter/src/ui/main.tsx +2 -3
- package/templates/shooter/threenative.config.ts +14 -1
- package/templates/shooter/vite.config.ts +4 -1
- package/templates/starter/AGENTS.md +17 -17
- package/templates/starter/CLAUDE.md +17 -17
- package/templates/starter/native-playtests/render-chain.playtest.json +13 -45
- package/templates/starter/package.json +13 -7
- package/templates/starter/playtests/play.playtest.json +2 -1
- package/templates/starter/playtests/survives.playtest.json +1 -1
- package/templates/starter/src/conventions.ts +6 -3
- package/templates/starter/src/entities/Goal.ts +35 -42
- package/templates/starter/src/entities/Player.ts +99 -16
- package/templates/starter/src/render/arena.ts +131 -0
- package/templates/starter/src/render/lighting.ts +27 -44
- package/templates/starter/src/render/materials.ts +164 -35
- package/templates/starter/src/render/palette.ts +16 -16
- package/templates/starter/src/render/postprocessing.ts +6 -7
- package/templates/starter/src/render/quality.ts +43 -101
- package/templates/starter/src/render/shapes.ts +1 -1
- package/templates/starter/src/render/sky.ts +39 -45
- package/templates/starter/src/render/touch-controls.ts +3 -1
- package/templates/starter/src/render/worldEnvironment.ts +52 -1
- package/templates/starter/src/scenes/Play.ts +82 -81
- package/templates/starter/threenative.config.ts +14 -1
- package/templates/starter/vite.config.ts +4 -1
- package/templates/tower-defense/.codex/config.toml +19 -0
- package/templates/tower-defense/.cursor/mcp.json +32 -0
- package/templates/tower-defense/.gemini/settings.json +32 -0
- package/templates/tower-defense/.mcp.json +32 -0
- package/templates/tower-defense/.vscode/mcp.json +36 -0
- package/templates/tower-defense/.zed/settings.json +36 -0
- package/templates/{defense → tower-defense}/AGENTS.md +14 -12
- package/templates/{defense → tower-defense}/CLAUDE.md +14 -12
- package/templates/tower-defense/README.md +16 -0
- package/templates/tower-defense/index.html +12 -0
- package/templates/tower-defense/kit.json +7 -0
- package/templates/tower-defense/opencode.json +41 -0
- package/templates/tower-defense/package.json +56 -0
- package/templates/tower-defense/playtests/arsenal.playtest.json +214 -0
- package/templates/tower-defense/playtests/defeat.playtest.json +85 -0
- package/templates/tower-defense/playtests/look.playtest.json +130 -0
- package/templates/tower-defense/playtests/performance.playtest.json +77 -0
- package/templates/tower-defense/playtests/placement.playtest.json +115 -0
- package/templates/{defense → tower-defense}/playtests/pointer-placement.playtest.json +21 -49
- package/templates/tower-defense/playtests/strike.playtest.json +98 -0
- package/templates/tower-defense/playtests/survives.playtest.json +85 -0
- package/templates/tower-defense/playtests/target-priority.playtest.json +177 -0
- package/templates/tower-defense/playtests/upgrade-recycle.playtest.json +124 -0
- package/templates/tower-defense/playtests/victory.playtest.json +810 -0
- package/templates/tower-defense/src/balance.ts +187 -0
- package/templates/tower-defense/src/board/Board.ts +100 -0
- package/templates/tower-defense/src/board/Route.ts +84 -0
- package/templates/tower-defense/src/camera-rig.ts +62 -0
- package/templates/tower-defense/src/economy.ts +64 -0
- package/templates/tower-defense/src/effects/Effects.ts +284 -0
- package/templates/tower-defense/src/enemies/Enemy.ts +198 -0
- package/templates/tower-defense/src/game.ts +72 -0
- package/templates/tower-defense/src/intents.ts +21 -0
- package/templates/tower-defense/src/main.ts +15 -0
- package/templates/tower-defense/src/physics.ts +6 -0
- package/templates/tower-defense/src/render/camera.ts +38 -0
- package/templates/tower-defense/src/render/lighting.ts +42 -0
- package/templates/{defense → tower-defense}/src/render/loading.ts +3 -3
- package/templates/tower-defense/src/render/materials.ts +103 -0
- package/templates/tower-defense/src/render/palette.ts +58 -0
- package/templates/tower-defense/src/render/postprocessing.ts +46 -0
- package/templates/tower-defense/src/render/quality.ts +128 -0
- package/templates/tower-defense/src/render/shapes.ts +550 -0
- package/templates/tower-defense/src/render/sky.ts +27 -0
- package/templates/tower-defense/src/render/worldEnvironment.ts +809 -0
- package/templates/tower-defense/src/scenes/Battle.ts +539 -0
- package/templates/{shooter → tower-defense}/src/scenes/Boot.ts +3 -3
- package/templates/tower-defense/src/state.ts +88 -0
- package/templates/tower-defense/src/style.css +137 -0
- package/templates/tower-defense/src/towers/Tower.ts +230 -0
- package/templates/tower-defense/src/towers/targeting.ts +97 -0
- package/templates/tower-defense/src/ui/Hud.tsx +270 -0
- package/templates/tower-defense/src/ui/Menu.tsx +134 -0
- package/templates/tower-defense/src/ui/icons.tsx +54 -0
- package/templates/tower-defense/src/ui/main.tsx +14 -0
- package/templates/tower-defense/src/waves.ts +90 -0
- package/templates/{defense → tower-defense}/threenative.config.ts +14 -1
- package/templates/tower-defense/vite.config.ts +41 -0
- package/agent-files/.claude/skills/file-engine-bug/SKILL.md +0 -59
- package/agent-files/.claude/skills/ponytail/SKILL.md +0 -68
- package/agent-files/.claude/skills/prd-creator/SKILL.md +0 -40
- package/agent-files/.claude/skills/threenative-assets/SKILL.md +0 -53
- package/agent-files/.claude/skills/threenative-capabilities/SKILL.md +0 -27
- package/agent-files/.claude/skills/threenative-context/SKILL.md +0 -65
- package/agent-files/.claude/skills/threenative-performance/SKILL.md +0 -58
- package/agent-files/.claude/skills/threenative-playtest/SKILL.md +0 -44
- package/agent-files/.claude/skills/threenative-ui/SKILL.md +0 -20
- package/agent-files/.claude/skills/threenative-visuals/SKILL.md +0 -41
- package/agent-files/AGENT-ROLES.md +0 -26
- package/templates/action-rpg/src/render/shapes.ts +0 -269
- package/templates/action-rpg/src/render/types.ts +0 -3
- package/templates/action-rpg/src/scenes/Boot.ts +0 -12
- package/templates/defense/README.md +0 -10
- package/templates/defense/kit.json +0 -7
- package/templates/defense/playtests/leak.playtest.json +0 -23
- package/templates/defense/playtests/placement.playtest.json +0 -40
- package/templates/defense/playtests/scan.playtest.json +0 -20
- package/templates/defense/playtests/survive.playtest.json +0 -45
- package/templates/defense/playtests/survives.playtest.json +0 -36
- package/templates/defense/src/attackers/Attacker.ts +0 -120
- package/templates/defense/src/board/Route.ts +0 -94
- package/templates/defense/src/conventions.ts +0 -18
- package/templates/defense/src/economy.ts +0 -36
- package/templates/defense/src/entities/Player.ts +0 -52
- package/templates/defense/src/game.ts +0 -51
- package/templates/defense/src/physics.ts +0 -13
- package/templates/defense/src/placement/Buildable.ts +0 -49
- package/templates/defense/src/render/camera.ts +0 -16
- package/templates/defense/src/render/lighting.ts +0 -37
- package/templates/defense/src/render/materials.ts +0 -22
- package/templates/defense/src/render/palette.ts +0 -28
- package/templates/defense/src/render/quality.ts +0 -170
- package/templates/defense/src/render/shapes.ts +0 -246
- package/templates/defense/src/render/sky.ts +0 -45
- package/templates/defense/src/scenes/Boot.ts +0 -12
- package/templates/defense/src/scenes/Defense.ts +0 -231
- package/templates/defense/src/state.ts +0 -56
- package/templates/defense/src/towers/Tower.ts +0 -95
- package/templates/defense/src/towers/targeting.ts +0 -53
- package/templates/defense/src/ui/Hud.tsx +0 -62
- package/templates/defense/src/ui/Menu.tsx +0 -7
- package/templates/defense/src/waves.ts +0 -40
- package/templates/minimal/playtests/atmosphere.playtest.json +0 -32
- package/templates/minimal/src/render/hud.ts +0 -69
- package/templates/platformer/playtests/avoidance.playtest.json +0 -28
- package/templates/platformer/playtests/chase.playtest.json +0 -21
- package/templates/platformer/playtests/collision-layers.playtest.json +0 -36
- package/templates/platformer/playtests/oneway.playtest.json +0 -44
- package/templates/platformer/playtests/patrol.playtest.json +0 -13
- package/templates/platformer/playtests/physics.playtest.json +0 -14
- package/templates/platformer/playtests/stomp-rise.playtest.json +0 -55
- package/templates/platformer/playtests/terminal-loop-fail.playtest.json +0 -41
- package/templates/platformer/playtests/terminal-loop-win.playtest.json +0 -52
- package/templates/platformer/src/conventions.ts +0 -18
- package/templates/platformer/src/entities/Character.ts +0 -286
- package/templates/platformer/src/entities/Chaser.ts +0 -118
- package/templates/platformer/src/entities/Patrol.ts +0 -93
- package/templates/platformer/src/level/Platform.ts +0 -46
- package/templates/platformer/src/render/rig.ts +0 -60
- package/templates/platformer/src/render/terrain.ts +0 -31
- package/templates/platformer/src/scenes/Level.ts +0 -241
- package/templates/puzzle/README.md +0 -43
- package/templates/puzzle/playtests/carry.playtest.json +0 -71
- package/templates/puzzle/playtests/swing.playtest.json +0 -38
- package/templates/puzzle/src/conventions.ts +0 -25
- package/templates/puzzle/src/entities/Ball.ts +0 -70
- package/templates/puzzle/src/entities/Gripper.ts +0 -69
- package/templates/puzzle/src/entities/Pendulum.ts +0 -89
- package/templates/puzzle/src/physics.ts +0 -19
- package/templates/puzzle/src/room.ts +0 -83
- package/templates/puzzle/src/scenes/Boot.ts +0 -12
- package/templates/puzzle/src/scenes/Puzzle.ts +0 -158
- package/templates/shooter/playtests/combat.playtest.json +0 -48
- package/templates/shooter/playtests/fail.playtest.json +0 -31
- package/templates/shooter/playtests/per-item.playtest.json +0 -59
- package/templates/shooter/playtests/shooter.playtest.json +0 -99
- package/templates/shooter/playtests/touch-controls.playtest.json +0 -42
- package/templates/shooter/playtests/weapon-cycle.playtest.json +0 -164
- package/templates/shooter/src/combat/damage.ts +0 -40
- package/templates/shooter/src/conventions.ts +0 -51
- package/templates/shooter/src/entities/Pickup.ts +0 -70
- package/templates/shooter/src/entities/Player.ts +0 -310
- package/templates/shooter/src/level/SpawnPoints.ts +0 -28
- package/templates/shooter/src/playtest-events.ts +0 -15
- package/templates/shooter/src/render/touch-controls.ts +0 -305
- package/templates/shooter/src/render/types.ts +0 -3
- package/templates/shooter/src/render/ui.css +0 -330
- package/templates/shooter/src/render/ui.ts +0 -75
- package/templates/shooter/src/render/vfx.ts +0 -215
- package/templates/shooter/src/ui/Menu.tsx +0 -41
- package/templates/shooter/src/waves.ts +0 -50
- package/templates/shooter/src/weapons/Hitscan.ts +0 -42
- package/templates/shooter/src/weapons/Projectile.ts +0 -92
- package/templates/shooter/src/weapons/Viewmodel.ts +0 -275
- package/templates/starter/playtests/assets.playtest.json +0 -65
- package/templates/starter/playtests/buffer.playtest.json +0 -79
- package/templates/starter/playtests/cloth.playtest.json +0 -113
- package/templates/starter/playtests/coyote.playtest.json +0 -87
- package/templates/starter/playtests/gameover.playtest.json +0 -66
- package/templates/starter/playtests/goal.playtest.json +0 -67
- package/templates/starter/playtests/look.playtest.json +0 -175
- package/templates/starter/playtests/models-baseline.png +0 -0
- package/templates/starter/playtests/models.playtest.json +0 -74
- package/templates/starter/playtests/monitoring.playtest.json +0 -72
- package/templates/starter/playtests/odometer.playtest.json +0 -54
- package/templates/starter/playtests/restart.playtest.json +0 -91
- package/templates/starter/playtests/seed.playtest.json +0 -54
- package/templates/starter/playtests/textures-baseline.png +0 -0
- package/templates/starter/playtests/textures.playtest.json +0 -74
- package/templates/starter/playtests/touch-controls.playtest.json +0 -42
- package/templates/starter/playtests/zoom-pinch.playtest.json +0 -86
- package/templates/starter/playtests/zoom-wheel.playtest.json +0 -59
- package/templates/starter/src/render/coast.ts +0 -199
- package/templates/starter/src/render/hero.ts +0 -88
- package/templates/starter/src/render/implicitSurface.ts +0 -199
- package/templates/starter/src/render/kuwahara.ts +0 -174
- package/templates/starter/src/render/outline.ts +0 -141
- package/templates/starter/src/render/painterly.ts +0 -86
- package/templates/starter/src/render/rockRidge.ts +0 -198
- package/templates/starter/src/render/rockRidge.worker.ts +0 -77
- package/templates/starter/src/render/scenery.ts +0 -40
- package/templates/starter/src/render/textureLifetime.ts +0 -53
- package/templates/starter/src/render/water.ts +0 -38
- package/templates/starter/src/render/watercolor.ts +0 -85
- /package/templates/{starter → puzzle}/playtests/boot-failure.playtest.json +0 -0
- /package/templates/{starter → puzzle}/playtests/pause.playtest.json +0 -0
- /package/templates/{defense → rts}/.codex/config.toml +0 -0
- /package/templates/{defense → rts}/.cursor/mcp.json +0 -0
- /package/templates/{defense → rts}/.gemini/settings.json +0 -0
- /package/templates/{defense → rts}/.mcp.json +0 -0
- /package/templates/{defense → rts}/.vscode/mcp.json +0 -0
- /package/templates/{defense → rts}/.zed/settings.json +0 -0
- /package/templates/{defense → rts}/index.html +0 -0
- /package/templates/{defense → rts}/opencode.json +0 -0
- /package/templates/{defense → rts}/src/main.ts +0 -0
- /package/templates/{defense → rts}/src/ui/main.tsx +0 -0
- /package/templates/{defense → tower-defense}/public/favicon.svg +0 -0
- /package/templates/{defense → tower-defense}/src/playtest-events.ts +0 -0
- /package/templates/{defense → tower-defense}/src/ui/App.tsx +0 -0
- /package/templates/{defense → tower-defense}/src/ui/GameUi.tsx +0 -0
- /package/templates/{defense → tower-defense}/tailwind.config.ts +0 -0
- /package/templates/{defense → tower-defense}/tsconfig.json +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# Capability reference
|
|
5
5
|
|
|
6
|
-
Every public class and function export represented by this manifest across `@threenative/assets`, `@threenative/core`, `@threenative/physics`, `@threenative/playtest`, `@threenative/raw-unreal`, `@threenative/ueformat`, `@threenative/ui`, `template:starter`, and `three`,
|
|
6
|
+
Every public class and function export represented by this manifest across `@threenative/assets`, `@threenative/core`, `@threenative/metahuman`, `@threenative/physics`, `@threenative/playtest`, `@threenative/raw-unreal`, `@threenative/ueformat`, `@threenative/ui`, `template:starter`, and `three`,
|
|
7
7
|
generated from the doc tags the engine itself compiles, so this page cannot disagree with
|
|
8
8
|
the code. Look here before writing a replacement; ask `engine_search_capabilities` when an
|
|
9
9
|
MCP server is available.
|
|
@@ -720,6 +720,21 @@ import { boneLengths } from "@threenative/core";
|
|
|
720
720
|
const baseline = boneLengths(character);
|
|
721
721
|
```
|
|
722
722
|
|
|
723
|
+
### `bvhIntersectFirstHit`
|
|
724
|
+
|
|
725
|
+
`function` — Pack a selected static scene into TSL storage nodes for an upstream BVH ray query.
|
|
726
|
+
|
|
727
|
+
```ts
|
|
728
|
+
bvhIntersectFirstHit = upstream.bvhIntersectFirstHit
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
- **Use when:** trace thousands of scene rays inside a TSL kernel · build a contact-occlusion or visibility query over loaded meshes
|
|
732
|
+
- **Constraints:** call rebuild() after a scene transform or geometry change; the snapshot is static by default · rebuild() is an explicit CPU SAH build proportional to selected triangles; process() is a no-op, and the game pays upstream traversal per shader ray
|
|
733
|
+
|
|
734
|
+
```ts
|
|
735
|
+
const bvh = ctx.add(new GPUSceneBVH(ctx.scene, { include: (object) => object.userData.traceable === true }));
|
|
736
|
+
```
|
|
737
|
+
|
|
723
738
|
### `CameraShake`
|
|
724
739
|
|
|
725
740
|
`class` — Produce a game-authored camera shake offset for a template-owned camera rig.
|
|
@@ -749,6 +764,21 @@ export class CanvasLayer { … }
|
|
|
749
764
|
const hud = new CanvasLayer(ctx.viewport);
|
|
750
765
|
```
|
|
751
766
|
|
|
767
|
+
### `captureMouse`
|
|
768
|
+
|
|
769
|
+
`function` — Lock the pointer to the game's surface: the capture every first-person mouse look needs. A browser grants capture only from a user gesture, so call it from a click or a pointerdown handler. A relative binding such as `look: { pointerRelative: true }` already requests capture on the first canvas click; this is the same request for a game that starts capture from another named gesture, and `ctx.input.captureMouse()` is the map's own way to ask.
|
|
770
|
+
|
|
771
|
+
```ts
|
|
772
|
+
export function captureMouse(target: EventTarget): Promise<void> | undefined { … }
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
- **Use when:** lock the mouse pointer so first-person mouse look keeps the cursor out of the way · stop the cursor leaving the window in the middle of a turn
|
|
776
|
+
- **Constraints:** the browser grants capture only from a user gesture and a refusal is reported, never swallowed · a relative binding requests capture on canvas click unless `captureOnClick: false` opts out
|
|
777
|
+
|
|
778
|
+
```ts
|
|
779
|
+
canvas.addEventListener("click", () => captureMouse(canvas));
|
|
780
|
+
```
|
|
781
|
+
|
|
752
782
|
### `clipBoneCoverage`
|
|
753
783
|
|
|
754
784
|
`function` — Report which bones of a character a clip does not drive.
|
|
@@ -907,7 +937,7 @@ const capture = game.runtime.pipelineCensus?.();
|
|
|
907
937
|
export function createRandom(seed?: number): IRandom { … }
|
|
908
938
|
```
|
|
909
939
|
|
|
910
|
-
- **Use when:** seed enemy patrol choices · reproduce the same procedural level in a playtest
|
|
940
|
+
- **Use when:** get a seeded deterministic random number generator — the same mulberry32 a game would hand-roll · seed enemy patrol choices · reproduce the same procedural level in a playtest
|
|
911
941
|
- **Constraints:** use the returned source instead of Math.random for replayable behavior
|
|
912
942
|
- **Supersedes (writing this fails `pnpm budgets`):** Math.random(
|
|
913
943
|
|
|
@@ -930,6 +960,39 @@ export function createReplayDriver( recording: Recording, target: EventTarget, p
|
|
|
930
960
|
const driver = createReplayDriver(recording, ctx.renderer.domElement);
|
|
931
961
|
```
|
|
932
962
|
|
|
963
|
+
### `Daylight`
|
|
964
|
+
|
|
965
|
+
`class` — An outdoor daylight rig: physical sky, one sun with open-world shadows that follow the eye, hemisphere fill, sky-coloured haze and the AgX tone curve. Every value is the game's.
|
|
966
|
+
|
|
967
|
+
```ts
|
|
968
|
+
export class Daylight extends Group implements IComputeDriven { … }
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
- **Use when:** daytime sky, sun and shadows for a large outdoor map · distant terrain should fade into the sky instead of a coloured wall · match a Blender look-dev scene's sun, sky and exposure in the game
|
|
972
|
+
- **Constraints:** every value is required; there is no default sun, sky, haze or exposure · `skySize` must keep the sky box's corners inside the camera's far plane · shadowExtents follow `VirtualShadowNode`: half-widths, finest first, strictly increasing
|
|
973
|
+
- **Overrides:** sky uniforms stay live on `daylight.sky`; the light and fill are `daylight.sun` and `daylight.fill`
|
|
974
|
+
|
|
975
|
+
```ts
|
|
976
|
+
const daylight = new Daylight({ follow: ctx.camera, sunDirection, sunColor, sunIntensity: 4, shadowExtents: [24, 96, 320], sky: { turbidity: 3, rayleigh: 1.4, mieCoefficient: 0.004, mieDirectionalG: 0.8 }, fill: { sky, ground, intensity: 1.1 }, haze: { color: horizon, density: 0.0011 }, exposure: 2 ** -0.6, skySize: 1600 });
|
|
977
|
+
ctx.add(daylight);
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
### `debugFlag`
|
|
981
|
+
|
|
982
|
+
`function` — Read a debug switch from the URL, or from `TN_DEBUG_*` in the environment on a native launch.
|
|
983
|
+
|
|
984
|
+
```ts
|
|
985
|
+
export function debugFlag(name: string): boolean { … }
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
- **Use when:** read a debug toggle from the URL or an environment variable
|
|
989
|
+
- **Constraints:** a name in camelCase becomes UPPER_SNAKE: `debugFlag("freeCam")` reads `?freeCam` or `TN_DEBUG_FREE_CAM` · `0` and `false` are off, so a saved URL cannot turn a switch back on
|
|
990
|
+
|
|
991
|
+
```ts
|
|
992
|
+
import { debugFlag } from "@threenative/core";
|
|
993
|
+
if (debugFlag("freeCam")) camera.flyMode = true;
|
|
994
|
+
```
|
|
995
|
+
|
|
933
996
|
### `defineGame`
|
|
934
997
|
|
|
935
998
|
`function` — Define the portable game entry shared by web and native.
|
|
@@ -1056,6 +1119,23 @@ renderer.render(scene, camera);
|
|
|
1056
1119
|
tracker.commit(scene);
|
|
1057
1120
|
```
|
|
1058
1121
|
|
|
1122
|
+
### `exposeDebug`
|
|
1123
|
+
|
|
1124
|
+
`function` — Publish one game object under `__THREENATIVE__.debug` for a capture script or the console.
|
|
1125
|
+
|
|
1126
|
+
```ts
|
|
1127
|
+
export function exposeDebug(name: string, value: unknown): void { … }
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
- **Use when:** expose a game object to a capture script or the console in dev builds
|
|
1131
|
+
- **Constraints:** development builds only; a production build publishes nothing
|
|
1132
|
+
|
|
1133
|
+
```ts
|
|
1134
|
+
import { exposeDebug } from "@threenative/core";
|
|
1135
|
+
exposeDebug("player", player);
|
|
1136
|
+
// then from the console: __THREENATIVE__.debug.player
|
|
1137
|
+
```
|
|
1138
|
+
|
|
1059
1139
|
### `FlightModel`
|
|
1060
1140
|
|
|
1061
1141
|
`class` — Fly a fixed-wing aircraft with a real force balance instead of a steered velocity.
|
|
@@ -1143,7 +1223,7 @@ if (renderListValidationRequested()) console.log(formatValidationReport(report))
|
|
|
1143
1223
|
export class FrameBudget { … }
|
|
1144
1224
|
```
|
|
1145
1225
|
|
|
1146
|
-
- **Use when:** find out why a game runs slowly on a phone · attribute a frame to present wait, simulation, three.js render, or overlay · tell whether the GPU is the frame's constraint from a per-frame series, not one lagged timestamp · split a frame's draw calls and triangles per render pass (main, shadow, reflection) · tell a shadow or reflection pass's cost from the main colour pass
|
|
1226
|
+
- **Use when:** show an on-screen frame time meter with p50, p95 and p99 percentiles · find out why a game runs slowly on a phone · attribute a frame to present wait, simulation, three.js render, or overlay · tell whether the GPU is the frame's constraint from a per-frame series, not one lagged timestamp · split a frame's draw calls and triangles per render pass (main, shadow, reflection) · tell a shadow or reflection pass's cost from the main colour pass
|
|
1147
1227
|
- **Constraints:** on by default and printed as TN_FRAME_BUDGET; defineGame({ frameBudget: false }) silences the marker, not the measurement · per-pass numbers are attributed to the innermost active render call, so nested shadow and reflection passes do not read as main · GPU is a mean/p50/p95/max series over resolved frames (`gpu`) with `gpuStale` counting frames that had no fresh reading; absent means no timestamps, never zero
|
|
1148
1228
|
|
|
1149
1229
|
```ts
|
|
@@ -1258,6 +1338,22 @@ import { GroundSnap } from "@threenative/core";
|
|
|
1258
1338
|
const snap = new GroundSnap(character, { enabled: true });
|
|
1259
1339
|
```
|
|
1260
1340
|
|
|
1341
|
+
### `InputMap`
|
|
1342
|
+
|
|
1343
|
+
`class` — The map a game reads input through: named actions, 2D vectors and scalar axes resolved from keyboard, gamepad, mouse, wheel, pinch and touch. `defineGame({ input })` builds one and hands it to the running game as `ctx.input`, so the usual route is a binding in the config and `ctx.input.axis("move")` in the update. Construct one directly to drive a menu, a replay or a test outside a running game.
|
|
1344
|
+
|
|
1345
|
+
```ts
|
|
1346
|
+
export class InputMap { … }
|
|
1347
|
+
```
|
|
1348
|
+
|
|
1349
|
+
- **Use when:** map WASD keys to a movement axis instead of reading the held key set in the update loop · read a jump, a fire or a reload as one named action bound to key, gamepad button and mouse button together · read mouse look, wheel zoom or a two-finger pinch as an axis the frame loop already ticks
|
|
1350
|
+
- **Constraints:** `buttons` is the gamepad and `mouseButtons` the mouse; `up`/`down`/`left`/`right` are the directions of `vector(name)`, not the keys that press it · scroll, pinch and pointer-relative sources are declared on the binding and read through `axis(name)`; a game adds no window listener of its own
|
|
1351
|
+
|
|
1352
|
+
```ts
|
|
1353
|
+
const game = defineGame({ input: { move: { up: ["KeyW"], down: ["KeyS"], left: ["KeyA"], right: ["KeyD"] } }, scenes: { Play } });
|
|
1354
|
+
// inside the scene, per frame: ctx.input.axis("move") is 0 at rest and 1 at full tilt
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1261
1357
|
### `installSpanProbes`
|
|
1262
1358
|
|
|
1263
1359
|
`function` — Attach the span probes to a renderer: three's `render`, `_projectObject`, the render list's `sort`, the per-draw submission, and the scene-graph walk. Installed for you when `TN_FRAME_SPANS` asks; exported so a harness can wrap a renderer it owns.
|
|
@@ -1303,7 +1399,7 @@ export function invalidateStatic(object: Object3D): number | undefined { … }
|
|
|
1303
1399
|
- **Constraints:** staticness is authored, never guessed; no heuristic watches gameplay and decides for you · it deletes the local and world matrix composes, not the walk itself — three 0.185 recurses into every child regardless · a write deeper inside a frozen subtree must call `invalidateStatic`; `TN_RENDERLIST_VALIDATE=1` is what proves it happened
|
|
1304
1400
|
|
|
1305
1401
|
```ts
|
|
1306
|
-
|
|
1402
|
+
invalidateStatic(drawbridge);
|
|
1307
1403
|
```
|
|
1308
1404
|
|
|
1309
1405
|
### `isMobile`
|
|
@@ -1348,7 +1444,7 @@ export function isStatic(root: Object3D): boolean { … }
|
|
|
1348
1444
|
- **Constraints:** staticness is authored, never guessed; no heuristic watches gameplay and decides for you · it deletes the local and world matrix composes, not the walk itself — three 0.185 recurses into every child regardless · a write deeper inside a frozen subtree must call `invalidateStatic`; `TN_RENDERLIST_VALIDATE=1` is what proves it happened
|
|
1349
1445
|
|
|
1350
1446
|
```ts
|
|
1351
|
-
|
|
1447
|
+
invalidateStatic(drawbridge);
|
|
1352
1448
|
```
|
|
1353
1449
|
|
|
1354
1450
|
### `isTouchscreenAvailable`
|
|
@@ -1397,16 +1493,31 @@ export async function loadAll<TIn, TOut>( items: readonly TIn[], load: (item: TI
|
|
|
1397
1493
|
const species = await loadAll(names, (name) => ctx.assets.model(`flora/${name}.glb`));
|
|
1398
1494
|
```
|
|
1399
1495
|
|
|
1496
|
+
### `lodPixelScale`
|
|
1497
|
+
|
|
1498
|
+
`function` — The screen pixels one world unit covers at `depth` for this camera and viewport. Perspective divides the projected scale by the depth; orthographic has no depth term and uses the frustum height instead. This is the number a level of detail is chosen against: multiply a level's world-space error by it and you have the on-screen error a player can see, which is the comparison `updateModelLods` makes from the baked chain.
|
|
1499
|
+
|
|
1500
|
+
```ts
|
|
1501
|
+
export function lodPixelScale(camera: Camera, viewportHeight: number, depth: number): number { … }
|
|
1502
|
+
```
|
|
1503
|
+
|
|
1504
|
+
- **Use when:** pick a level of detail from an object's projected size in pixels on screen · know how many screen pixels a world-space error covers at a given distance
|
|
1505
|
+
- **Constraints:** a non-positive viewport height, a non-positive frustum height or an unprojectable camera throws · a non-positive depth has no projected scale and returns Infinity
|
|
1506
|
+
|
|
1507
|
+
```ts
|
|
1508
|
+
const pixels = lodPixelScale(camera, canvas.clientHeight, mesh.position.distanceTo(camera.position));
|
|
1509
|
+
```
|
|
1510
|
+
|
|
1400
1511
|
### `markStatic`
|
|
1401
1512
|
|
|
1402
|
-
`function` —
|
|
1513
|
+
`function` — Freeze a subtree nobody moves: `markStatic(root)` composes its transforms once and stops the per-frame recompose. It is the call a game makes on scenery, terrain, buildings and props. The engine re-arms a root whose own transform the game changes; a write deeper inside a frozen subtree is announced with `invalidateStatic(object)`.
|
|
1403
1514
|
|
|
1404
1515
|
```ts
|
|
1405
1516
|
export function markStatic(root: Object3D): number { … }
|
|
1406
1517
|
```
|
|
1407
1518
|
|
|
1408
|
-
- **Use when:**
|
|
1409
|
-
- **Constraints:** staticness is authored, never guessed; no heuristic watches gameplay and decides for you ·
|
|
1519
|
+
- **Use when:** freeze a static mesh or subtree so its matrices are not recomputed every frame · stop the engine recomposing the transforms of props, terrain and buildings each frame
|
|
1520
|
+
- **Constraints:** staticness is authored, never guessed; no heuristic watches gameplay and decides for you · a write deeper inside a frozen subtree must call `invalidateStatic`; `TN_RENDERLIST_VALIDATE=1` is what proves it happened
|
|
1410
1521
|
|
|
1411
1522
|
```ts
|
|
1412
1523
|
markStatic(island); invalidateStatic(drawbridge);
|
|
@@ -1420,7 +1531,7 @@ markStatic(island); invalidateStatic(drawbridge);
|
|
|
1420
1531
|
export class MatrixWorldPass { … }
|
|
1421
1532
|
```
|
|
1422
1533
|
|
|
1423
|
-
- **Use when:** the per-frame world matrix walk is hot in a profile · stop multiplying matrices for hidden models, LOD levels and merged stand-ins · a game needs every node walked, exactly as three's own updateMatrixWorld does
|
|
1534
|
+
- **Use when:** update the world matrices of the visible objects each frame instead of the whole scene · the per-frame world matrix walk is hot in a profile · stop multiplying matrices for hidden models, LOD levels and merged stand-ins · a game needs every node walked, exactly as three's own updateMatrixWorld does
|
|
1424
1535
|
- **Constraints:** a game that reads a hidden object's matrixWorld directly must use getWorldPosition or updateWorldMatrix(true, false) first · `renderer.matrixWorld: "all"` visits every node; `TN_PROJECTION` reports the visited count either way
|
|
1425
1536
|
- **Overrides:** renderer.matrixWorld: "all" runs three's full walk instead of the visible-only default
|
|
1426
1537
|
|
|
@@ -1444,6 +1555,24 @@ export function measureThreePose( object: Object3D, options: IMeasureThreePoseOp
|
|
|
1444
1555
|
const measurement = measureThreePose(model);
|
|
1445
1556
|
```
|
|
1446
1557
|
|
|
1558
|
+
### `mergeByMaterial`
|
|
1559
|
+
|
|
1560
|
+
`function` — Bake a hierarchy's static meshes into one mesh per material, with their transforms baked in. already made; nothing here decides appearance tree: add them to root and remove the sources yourself, or both draw vertices are not its own to bake texture mapping; a missing normal is recomputed
|
|
1561
|
+
|
|
1562
|
+
```ts
|
|
1563
|
+
export function mergeByMaterial(root: Object3D, options: IMergeByMaterialOptions): Mesh[] { … }
|
|
1564
|
+
```
|
|
1565
|
+
|
|
1566
|
+
- **Use when:** collapse a building or ship of dozens of boxes into one draw call per material · consolidate the static parts of a group before adding it to the scene
|
|
1567
|
+
- **Constraints:** the material is the game's own instance and the split follows the materials the game · the meshes come back in root's local space and unparented, with the originals still in the · a skinned or instanced mesh, and a mesh with several materials, is left out — its · a group where only some meshes carry uv throws naming the label rather than losing the
|
|
1568
|
+
- **Overrides:** skip leaves one mesh out of its group and out of the result
|
|
1569
|
+
|
|
1570
|
+
```ts
|
|
1571
|
+
const [hull, deck] = mergeByMaterial(ship, { label: "ship" });
|
|
1572
|
+
// a piece that must keep moving at run time:
|
|
1573
|
+
const [steady] = mergeByMaterial(ship, { label: "ship", skip: (mesh) => mesh.name === "radar" });
|
|
1574
|
+
```
|
|
1575
|
+
|
|
1447
1576
|
### `mergeParts`
|
|
1448
1577
|
|
|
1449
1578
|
`function` — Merge pieces a game authored out of primitives into one buffer, keeping each piece's own look. `InstancedBatch` collapses many copies of one shape; this collapses many *different* shapes that never move relative to each other — a building, a ship, a character built from boxes, or the static parts of an imported glTF model. Two things go wrong every time and neither is about how any of it looks. `mergeGeometries` hands back `null` on mismatched inputs instead of throwing, and the usual mismatch is invisible: one `ExtrudeGeometry` is non-indexed while every other primitive is indexed, so the merge fails at the first piece and the scene never loads. And a merged buffer draws with one surface, so per-piece colour is gone unless every piece carries a flat `color` attribute written before the merge. Both are mechanical. By default every part is stripped to position and the normals are recomputed from the merged buffer; pass `preserve` to keep authored normals and texture UVs while baking each part's object transform. Geometry, placement, colour and the surface it draws with all stay the game's.
|
|
@@ -1754,7 +1883,7 @@ export function refreshStaticTransforms(): void { … }
|
|
|
1754
1883
|
- **Constraints:** staticness is authored, never guessed; no heuristic watches gameplay and decides for you · it deletes the local and world matrix composes, not the walk itself — three 0.185 recurses into every child regardless · a write deeper inside a frozen subtree must call `invalidateStatic`; `TN_RENDERLIST_VALIDATE=1` is what proves it happened
|
|
1755
1884
|
|
|
1756
1885
|
```ts
|
|
1757
|
-
|
|
1886
|
+
invalidateStatic(drawbridge);
|
|
1758
1887
|
```
|
|
1759
1888
|
|
|
1760
1889
|
### `RenderChain`
|
|
@@ -1843,7 +1972,7 @@ export function resetStaticTransforms(): void { … }
|
|
|
1843
1972
|
- **Constraints:** staticness is authored, never guessed; no heuristic watches gameplay and decides for you · it deletes the local and world matrix composes, not the walk itself — three 0.185 recurses into every child regardless · a write deeper inside a frozen subtree must call `invalidateStatic`; `TN_RENDERLIST_VALIDATE=1` is what proves it happened
|
|
1844
1973
|
|
|
1845
1974
|
```ts
|
|
1846
|
-
|
|
1975
|
+
invalidateStatic(drawbridge);
|
|
1847
1976
|
```
|
|
1848
1977
|
|
|
1849
1978
|
### `resolveAtmosphereLutResolutions`
|
|
@@ -1876,6 +2005,21 @@ export function resolveAtmosphereParameters( options: IAtmosphereParameters, ):
|
|
|
1876
2005
|
const parameters = resolveAtmosphereParameters({ rayleigh, mie, ozone, planetRadius, atmosphereRadius });
|
|
1877
2006
|
```
|
|
1878
2007
|
|
|
2008
|
+
### `resolveTargetFps`
|
|
2009
|
+
|
|
2010
|
+
`function` — Read what frame rate a game gets when its config does not say, and why. `display.maxFps` follows the display — capped at 120 on desktop and web, 60 on mobile — rather than the 60 every template used to ship, and an explicit number still wins with `0` still uncapping. The engine calls this itself; a game calls it when it needs the same number for its own frame-rate-dependent work, and `TN_FRAME_BUDGET` reports the resolved target and its source on every window.
|
|
2011
|
+
|
|
2012
|
+
```ts
|
|
2013
|
+
export function resolveTargetFps( config: ITargetFpsConfig | undefined, platform: ITargetFpsPlatform | undefined, measuredRefreshHz?: number, ): ITargetFps { … }
|
|
2014
|
+
```
|
|
2015
|
+
|
|
2016
|
+
- **Use when:** my game does frame-rate-dependent work and must not hardcode 60
|
|
2017
|
+
- **Constraints:** pass the measured display rate when you have one; without it the answer is the 60 fallback and says so
|
|
2018
|
+
|
|
2019
|
+
```ts
|
|
2020
|
+
resolveTargetFps(config, getPlatform()).targetFps;
|
|
2021
|
+
```
|
|
2022
|
+
|
|
1879
2023
|
### `RippleField`
|
|
1880
2024
|
|
|
1881
2025
|
`class` — Propagate a disturbance across a patch of water surface and let it fade. step is 1/60s or the CFL stability limit for the given resolution and speed, whichever is smaller
|
|
@@ -2025,6 +2169,21 @@ import { skeletonBones } from "@threenative/core";
|
|
|
2025
2169
|
const bones = skeletonBones(character);
|
|
2026
2170
|
```
|
|
2027
2171
|
|
|
2172
|
+
### `snapRefreshRate`
|
|
2173
|
+
|
|
2174
|
+
`function` — Read what frame rate a game gets when its config does not say, and why. `display.maxFps` follows the display — capped at 120 on desktop and web, 60 on mobile — rather than the 60 every template used to ship, and an explicit number still wins with `0` still uncapping. The engine calls this itself; a game calls it when it needs the same number for its own frame-rate-dependent work, and `TN_FRAME_BUDGET` reports the resolved target and its source on every window.
|
|
2175
|
+
|
|
2176
|
+
```ts
|
|
2177
|
+
export function snapRefreshRate(refreshHz: number): number { … }
|
|
2178
|
+
```
|
|
2179
|
+
|
|
2180
|
+
- **Use when:** my game does frame-rate-dependent work and must not hardcode 60
|
|
2181
|
+
- **Constraints:** pass the measured display rate when you have one; without it the answer is the 60 fallback and says so
|
|
2182
|
+
|
|
2183
|
+
```ts
|
|
2184
|
+
resolveTargetFps(config, getPlatform()).targetFps;
|
|
2185
|
+
```
|
|
2186
|
+
|
|
2028
2187
|
### `SoftBody3D`
|
|
2029
2188
|
|
|
2030
2189
|
`class` — Simulate an ordinary game-authored triangle mesh as cloth on the existing fixed-step GPU lane. The mesh supplies every visible choice. This class welds exporter duplicates, owns spring and position buffers, and replaces only the cloned material's position node. It adds no material, colour, texture, wind, stiffness, damping, or pinning default.
|
|
@@ -2188,7 +2347,7 @@ export function staticTransformCensus(): IStaticTransformCensus { … }
|
|
|
2188
2347
|
- **Constraints:** staticness is authored, never guessed; no heuristic watches gameplay and decides for you · it deletes the local and world matrix composes, not the walk itself — three 0.185 recurses into every child regardless · a write deeper inside a frozen subtree must call `invalidateStatic`; `TN_RENDERLIST_VALIDATE=1` is what proves it happened
|
|
2189
2348
|
|
|
2190
2349
|
```ts
|
|
2191
|
-
|
|
2350
|
+
invalidateStatic(drawbridge);
|
|
2192
2351
|
```
|
|
2193
2352
|
|
|
2194
2353
|
### `TracerPool3D`
|
|
@@ -2219,7 +2378,7 @@ export function unmarkStatic(root: Object3D): void { … }
|
|
|
2219
2378
|
- **Constraints:** staticness is authored, never guessed; no heuristic watches gameplay and decides for you · it deletes the local and world matrix composes, not the walk itself — three 0.185 recurses into every child regardless · a write deeper inside a frozen subtree must call `invalidateStatic`; `TN_RENDERLIST_VALIDATE=1` is what proves it happened
|
|
2220
2379
|
|
|
2221
2380
|
```ts
|
|
2222
|
-
|
|
2381
|
+
invalidateStatic(drawbridge);
|
|
2223
2382
|
```
|
|
2224
2383
|
|
|
2225
2384
|
### `updateAtmosphereParameters`
|
|
@@ -2335,7 +2494,7 @@ export class VirtualShadowNode extends ShadowBaseNode { … }
|
|
|
2335
2494
|
```
|
|
2336
2495
|
|
|
2337
2496
|
- **Use when:** crisp shadows close to the player across a large outdoor level · shadow map too coarse over a big terrain · one directional light shadow for a whole open world · shadows shimmer when the camera moves
|
|
2338
|
-
- **Constraints:** the light must be a DirectionalLight with `castShadow` and a target in the scene · clipExtents are half-widths in world units, finest first, strictly increasing · call `trackCaster(object)` for movers; it enables layer `VIRTUAL_SHADOW_MOVER_LAYER` on the object and its descendants, tracking or untracking refreshes cached levels once, and subsequent mover movement refreshes only when a window moves
|
|
2497
|
+
- **Constraints:** the light must be a DirectionalLight with `castShadow` and a target in the scene · clipExtents are half-widths in world units, finest first, strictly increasing · call `trackCaster(object)` for movers; it enables layer `VIRTUAL_SHADOW_MOVER_LAYER` on the object and its descendants, tracking or untracking refreshes cached levels once, and subsequent mover movement refreshes only when a window moves · call `object.layers.set(VIRTUAL_SHADOW_CASTER_LAYER)` for a mesh that exists only to cast; the level cameras already render that layer and the main camera never does
|
|
2339
2498
|
- **Overrides:** bias, biasNode, normalBias, intensity, radius, blurSamples, mapType and filterNode stay on `light.shadow`; mapSize and the other options here have defaults, and `marker: false` silences the TN_VIRTUAL_SHADOW line, not the measurement · bias, biasNode, normalBias, intensity, radius, blurSamples, mapType and filterNode stay on `light.shadow`; mapSize and the other options here have defaults
|
|
2340
2499
|
|
|
2341
2500
|
```ts
|
|
@@ -2676,6 +2835,21 @@ const mirror = subscribeUiState(bridge);
|
|
|
2676
2835
|
|
|
2677
2836
|
## `@threenative/core/world`
|
|
2678
2837
|
|
|
2838
|
+
### `cellPlacements`
|
|
2839
|
+
|
|
2840
|
+
`function` — Borrow the run's placement records as a live view over the placement buffer.
|
|
2841
|
+
|
|
2842
|
+
```ts
|
|
2843
|
+
export function cellPlacements(placements: ArrayBuffer, run: IWorldRun): Float32Array { … }
|
|
2844
|
+
```
|
|
2845
|
+
|
|
2846
|
+
- **Use when:** feed one cell's instance transforms into a batch without copying
|
|
2847
|
+
- **Constraints:** the returned view aliases the caller's buffer; writing to it mutates the source
|
|
2848
|
+
|
|
2849
|
+
```ts
|
|
2850
|
+
const records = cellPlacements(buffer, { asset: "tree", offset: 0, count: 120 });
|
|
2851
|
+
```
|
|
2852
|
+
|
|
2679
2853
|
### `getWorldCapabilities`
|
|
2680
2854
|
|
|
2681
2855
|
`function` — Resolve the active world-generation path from host capability facts. The function accepts the adapter facts instead of reaching through a renderer-specific global, so browser and native hosts can report the same object. Missing limits are not treated as infinite: a host must either provide a valid GPU limit report or explicitly choose CPU fallback. GPU generation remains unavailable until a GPU readback can own the canonical field; a host adapter report therefore never upgrades a CPU fallback into a GPU generation claim.
|
|
@@ -2708,6 +2882,53 @@ export class Heightfield extends Group implements IComputeDriven { … }
|
|
|
2708
2882
|
const field = Heightfield.fromSampler({ rows: 65, columns: 65, width: 64, depth: 64, origin: { x: 0, z: 0 }, sampleHeight: terrainHeight });
|
|
2709
2883
|
```
|
|
2710
2884
|
|
|
2885
|
+
### `heightSamplerFromHeightmap`
|
|
2886
|
+
|
|
2887
|
+
`function` — Build a game-usable `sampleHeight` from a raw v1 heightmap. The returned function interpolates bilinearly in world units and clamps to the map edges, so it plugs straight into `Heightfield.fromSampler` and `TerrainTiles`. Height is `heightMin + v / 65535 * (heightMax - heightMin)` at vertex `(column, row)`.
|
|
2888
|
+
|
|
2889
|
+
```ts
|
|
2890
|
+
export function heightSamplerFromHeightmap( terrain: IWorldTerrain, extent: IWorldExtent, data: Uint16Array, ): (x: number, z: number) => number { … }
|
|
2891
|
+
```
|
|
2892
|
+
|
|
2893
|
+
- **Use when:** turn an exported raw heightmap into terrain collision and rendering · query ground height from a Blender-authored world package
|
|
2894
|
+
- **Constraints:** the sampler reads the game's data; the framework never selects a terrain shape
|
|
2895
|
+
|
|
2896
|
+
```ts
|
|
2897
|
+
const sampleHeight = heightSamplerFromHeightmap(terrain, extent, await loadWorldHeightmap(url));
|
|
2898
|
+
```
|
|
2899
|
+
|
|
2900
|
+
### `loadTerrainSplat`
|
|
2901
|
+
|
|
2902
|
+
`function` — The splat terrain surface a world package describes, for `WorldCells.load({ surface })`. Layers blend over a base by mask channels read as linear data (the masks ship raw, beside the heightmap, so no cook moves a blend threshold), with noise-broken edges and macro brightness variation. Texture sets tile in world metres on the package's ground plane (x, -z: a Z-up authoring tool's x and y), cliffs can be triplanar, and the base plus any layer that asks carries a normal map. Nothing here is a look choice: textures, tiles, tints, thresholds and noise scales all come from the package's table, which the game authors once and its DCC shares.
|
|
2903
|
+
|
|
2904
|
+
```ts
|
|
2905
|
+
export async function loadTerrainSplat(options: ILoadTerrainSplatOptions): Promise<Material> { … }
|
|
2906
|
+
```
|
|
2907
|
+
|
|
2908
|
+
- **Use when:** terrain textured by splat masks exported from Blender with the world package · the game's terrain should match the DCC's terrain material without a second copy
|
|
2909
|
+
- **Constraints:** the package's world.json must carry `terrain.layers.table` and `terrain.layers.splat`, written by the `export_terrain_layers.py` recipe · WebGPU allows 16 sampled textures per stage: planes + diffuse maps + normal maps must fit
|
|
2910
|
+
- **Overrides:** every value comes from the package's table; the returned material is the game's to adjust
|
|
2911
|
+
|
|
2912
|
+
```ts
|
|
2913
|
+
const surface = await loadTerrainSplat({ assets: ctx.assets, url: "world/world.json" });
|
|
2914
|
+
const world = await WorldCells.load({ assets: ctx.assets, url: "world/world.json", surface, follow, ring: 2 });
|
|
2915
|
+
```
|
|
2916
|
+
|
|
2917
|
+
### `loadWorldHeightmap`
|
|
2918
|
+
|
|
2919
|
+
`function` — Fetch a raw little-endian uint16 heightmap and expose it as samples.
|
|
2920
|
+
|
|
2921
|
+
```ts
|
|
2922
|
+
export async function loadWorldHeightmap(url: string): Promise<Uint16Array> { … }
|
|
2923
|
+
```
|
|
2924
|
+
|
|
2925
|
+
- **Use when:** load a world package's heightmap once before building terrain
|
|
2926
|
+
- **Constraints:** a non-OK response throws; bytes are byte-swapped only on a big-endian host
|
|
2927
|
+
|
|
2928
|
+
```ts
|
|
2929
|
+
const data = await loadWorldHeightmap("/world/terrain/heightmap.u16");
|
|
2930
|
+
```
|
|
2931
|
+
|
|
2711
2932
|
### `TerrainTiles`
|
|
2712
2933
|
|
|
2713
2934
|
`class` — Stream a bounded square of game-authored heightfields and keep their render and physics units together. The class composes ordinary THREE.LOD objects and leaves frustum/projection culling to the renderer's existing scene path.
|
|
@@ -2717,13 +2938,150 @@ export class TerrainTiles extends Object3D implements IComputeDriven { … }
|
|
|
2717
2938
|
```
|
|
2718
2939
|
|
|
2719
2940
|
- **Use when:** stream terrain without cracks · keep generated terrain resident around a moving player · put a generated terrain tile into a game-owned physics world
|
|
2720
|
-
- **Constraints:** sampleHeight and surface are required game choices; no landform or surface preset is installed · residentTileBudget and residentByteBudget are hard caps; a tile that cannot fit throws
|
|
2721
|
-
- **Overrides:** tileSize, tileResolution, lodFactors, lodDistances, skirtDepth, streamRadius, and budgets
|
|
2941
|
+
- **Constraints:** sampleHeight and surface are required game choices; no landform or surface preset is installed · residentTileBudget and residentByteBudget are hard caps; a tile that cannot fit throws · seam gap, LOD pop and the rendered-vertex finiteness scan are measurements that are off by default; TN_TERRAIN_VALIDATE=1, ?tnTerrainValidate=1 or validate: true runs them, and maxSeamGap, maxVisualSeamGap and maxLodPop report undefined while they are off
|
|
2942
|
+
- **Overrides:** tileSize, tileResolution, lodFactors, lodDistances, skirtDepth, streamRadius, colliderRadius, validate, and budgets
|
|
2722
2943
|
|
|
2723
2944
|
```ts
|
|
2724
2945
|
const tiles = new TerrainTiles({ sampleHeight, surface: gameSurface(), tileSize: 256, tileResolution: 129, residentTileBudget: 25, residentByteBudget: 32_000_000 });
|
|
2725
2946
|
```
|
|
2726
2947
|
|
|
2948
|
+
### `terrainValidationRequested`
|
|
2949
|
+
|
|
2950
|
+
`function` — Whether `TN_TERRAIN_VALIDATE` asks for terrain validation on this launch.
|
|
2951
|
+
|
|
2952
|
+
```ts
|
|
2953
|
+
export function terrainValidationRequested(): boolean { … }
|
|
2954
|
+
```
|
|
2955
|
+
|
|
2956
|
+
- **Use when:** turn terrain's per-frame seam, LOD pop and vertex checks on for one run · assert the terrain geometry a game streams before it ships
|
|
2957
|
+
- **Constraints:** off by default: it is the work it checks, every frame
|
|
2958
|
+
|
|
2959
|
+
```ts
|
|
2960
|
+
// Reads its own the way `renderListValidationRequested` does: a native launch sets the
|
|
2961
|
+
// environment variable, a browser asks with the query string, a test or harness sets the
|
|
2962
|
+
// global. `0` and `false` are off, so a saved URL that enabled it still says "off".
|
|
2963
|
+
const tiles = new TerrainTiles({ ...options, validate: terrainValidationRequested() });
|
|
2964
|
+
```
|
|
2965
|
+
|
|
2966
|
+
### `validateWorldPackage`
|
|
2967
|
+
|
|
2968
|
+
`function` — Validate a `world.json` manifest against the v1 contract. Never throws on garbage input: a non-object manifest is `WORLD_MALFORMED`. Every problem is collected, so an exporter sees the complete list at once.
|
|
2969
|
+
|
|
2970
|
+
```ts
|
|
2971
|
+
export function validateWorldPackage( manifest: unknown, options: IWorldPackageValidationOptions, ): { … }
|
|
2972
|
+
```
|
|
2973
|
+
|
|
2974
|
+
- **Use when:** check a Blender-exported world package before the runtime attaches anything · report why a world package cannot be streamed
|
|
2975
|
+
- **Constraints:** validation only checks structure and ranges; it never fetches the heightmap or GLBs
|
|
2976
|
+
|
|
2977
|
+
```ts
|
|
2978
|
+
const { ok, errors } = validateWorldPackage(json, { placementsByteLength: buffer.byteLength });
|
|
2979
|
+
```
|
|
2980
|
+
|
|
2981
|
+
### `WorldCells`
|
|
2982
|
+
|
|
2983
|
+
`class` — Stream a Blender-authored world package by cell and keep it resident around a followed point. The class composes `TerrainTiles` for the package's heightmap, builds one `InstancedBatch` per resident cell asset run, distance level and mesh part, and loads hand-placed chunk GLBs through `loadAll` + `addInSlices`. Ring residency, per-asset `maxDistance` filtering, the per-asset `lods` levels, hard budgets and generation-tokened cancellation all live here; every geometry, material and surface still comes from the package's GLBs and the game. An asset is drawn per part, not per model: a GLB with several primitives is one `InstancedBatch` each, and a scattered part whose own material is transparent draws as an alpha cutout unless the game asks for blending, because an `InstancedMesh` cannot sort its instances. An asset whose package entry names no `lods` is drawn at the levels its own model carries a baked AutoLOD chain for: the levels an instanced draw cannot reach by itself, switched at the distance their error projects over the `autoLod` viewport. Authored `lods` win; a chain is only a fallback.
|
|
2984
|
+
|
|
2985
|
+
```ts
|
|
2986
|
+
export class WorldCells extends Group implements IComputeDriven { … }
|
|
2987
|
+
```
|
|
2988
|
+
|
|
2989
|
+
- **Use when:** stream a large Blender-authored world by cell instead of one huge GLB · keep scattered props and hand-placed chunks resident around a moving player · honour per-asset draw distances and hard streaming budgets without a mid-frame throw
|
|
2990
|
+
- **Constraints:** surface is the game's; this class creates no material, colour or geometry · budgets are hard caps that report pressure instead of over-committing · model loads are bounded by `concurrency` (default 12) across every resident cell, not per cell · refilters are bounded by `rebuildsPerUpdate` (default 16) per update, nearest cell first · admission is bounded by `admissionBudgetMs` (default 2) per update across every path, plus at most one unit each for terrain and props; while props are queued terrain takes at most half, so neither starves the other, and a deferred cell keeps drawing what it has · SkinnedMesh parts are skipped; an instanced copy would draw one rest pose · a baked chain's switch distances are measured against `autoLod` (default 4 px of error over 60° and 1080 raster rows), because an instanced draw cannot select a level per instance; an asset with authored `lods` never consults it · `prewarmed` resolves once every prewarmed shared batch has been drawn; a game with a loading screen waits on it, and `stats().pendingPrewarm` is the same gate as a number · every `asset:level:part` is one InstancedMesh for the main pass, plus one caster InstancedMesh per world-grid square of `clusterSize` on the shadow caster layer, so the main pass draws one mesh per key and a shadow level submits only the squares it covers · two definitions the asset loader resolves to one model — the same cooked `glb`, the same `lods` at the same distances, the same `maxDistance` and bounds — are one asset under the lexicographically smallest id: one model load, one set of `asset:level:part` keys, one prewarm and one refcount, released when the last cell holding any member of the group leaves the ring; `TN_WORLD_ASSET_ALIAS` reports how many of the package's assets are really distinct · the main pass mesh draws only the squares the render camera's frustum covers — on by default, narrowed once per frame for every main batch by the engine's render-cadence dispatch, never for an orthographic camera — a batch with nothing to draw is hidden rather than submitted at `count 0`, and `TN_WORLD_MAIN_CULL` reports both every five seconds · a loaded chunk is merged by material before it is added, so it submits one draw per material rather than one per node; a skinned, multi-material or morph-target mesh, one carrying a baked AutoLOD chain, and an instanced mesh past `chunkMergeMaxTriangles` (default 43,690 triangles) or with a shape over 2,048 triangles, all keep their own geometry; a material group crossing 131,072 vertices (4 MiB of position + normal + uv) is split into several meshes in traversal order instead of one giant upload, indexed parts keep their index, and `TN_WORLD_CHUNK_MERGE` reports what the merge did and the bytes it left · `shadows.castDistance` is accepted and ignored (clusters replaced it); `shadows.invalidate` is called at most once a second after streamed records changed
|
|
2991
|
+
- **Overrides:** ring, budgets, terrain tile size/resolution, terrain stream and collider radius, `transparentScatter`, `clusterSize` and `shadows.invalidate`, load `concurrency`, `rebuildsPerUpdate`, `admissionBudgetMs` and the package's per-asset maxDistance
|
|
2992
|
+
|
|
2993
|
+
```ts
|
|
2994
|
+
const world = await WorldCells.load({ url: "/world/world.json", surface, follow, ring: 1, budgets: { residentCells: 25, instances: 20000, bytes: 8000000 } });
|
|
2995
|
+
scene.add(world);
|
|
2996
|
+
world.update();
|
|
2997
|
+
```
|
|
2998
|
+
|
|
2999
|
+
## `@threenative/metahuman`
|
|
3000
|
+
|
|
3001
|
+
### `assertAssetPath`
|
|
3002
|
+
|
|
3003
|
+
`function` — Keeps a caller-supplied asset path inside the asset directory.
|
|
3004
|
+
|
|
3005
|
+
```ts
|
|
3006
|
+
export function assertAssetPath(path: string): string { … }
|
|
3007
|
+
```
|
|
3008
|
+
|
|
3009
|
+
- **Use when:** reject a MetaHuman asset path that would read outside the game's asset root
|
|
3010
|
+
- **Constraints:** absolute paths, Windows drive letters, backslashes and any `..` segment throw MetaHumanAssetError with TN_MH_PATH_ESCAPE before the path is joined onto a root
|
|
3011
|
+
- **Requires:** npm i @threenative/metahuman
|
|
3012
|
+
|
|
3013
|
+
```ts
|
|
3014
|
+
assertAssetPath("metahuman/specimen.glb");
|
|
3015
|
+
```
|
|
3016
|
+
|
|
3017
|
+
### `loadMetaHuman`
|
|
3018
|
+
|
|
3019
|
+
`function` — Load a prepared MetaHuman head and drive its expression from the browser's WASM evaluator: declared faceboard controls in, joint deltas and morph weights out, applied to an ordinary Three.js object graph. two characters never write each other's face and nothing is disposed that `ctx.assets` still owns switch re-evaluates the current controls before the replacement mesh is shown `dispose()` throw, each with a stable `code`; nothing is clamped or coerced `diagnostics().backend` reads "native"; the game code does not change
|
|
3020
|
+
|
|
3021
|
+
```ts
|
|
3022
|
+
loadMetaHuman = (options: ILoadMetaHumanOptions): Promise<IMetaHuman> => createMetaHuman( { … }
|
|
3023
|
+
```
|
|
3024
|
+
|
|
3025
|
+
- **Use when:** put a MetaHuman head in a browser game without an Unreal import or a baked clip
|
|
3026
|
+
- **Constraints:** the model is loaded through the game's own asset loader and cloned per instance, so · the rig's own GUI-to-raw mapping runs; the adapter never re-derives it, and a LOD · an undeclared control, an out-of-domain value, an undeclared LOD and any call after · in a native host that installed the MetaHuman resident the C++ evaluator runs and
|
|
3027
|
+
- **Requires:** npm i @threenative/metahuman
|
|
3028
|
+
|
|
3029
|
+
```ts
|
|
3030
|
+
const human = await loadMetaHuman({ assets: ctx.assets, model: "metahuman/head.glb",
|
|
3031
|
+
dna: "metahuman/head.dna", bindings: "metahuman/bindings.json" });
|
|
3032
|
+
human.setControls({ jawOpen: 0.4 });
|
|
3033
|
+
// in the scene update, after any body animation
|
|
3034
|
+
human.update();
|
|
3035
|
+
```
|
|
3036
|
+
|
|
3037
|
+
### `MetaHumanAssetError`
|
|
3038
|
+
|
|
3039
|
+
`class` — The rejection every check in this package raises, carrying a stable machine-readable code.
|
|
3040
|
+
|
|
3041
|
+
```ts
|
|
3042
|
+
export class MetaHumanAssetError extends Error { … }
|
|
3043
|
+
```
|
|
3044
|
+
|
|
3045
|
+
- **Use when:** branch on why a MetaHuman asset or evaluator call was refused
|
|
3046
|
+
- **Constraints:** `code` is part of the public surface; renaming one is a breaking change
|
|
3047
|
+
- **Requires:** npm i @threenative/metahuman
|
|
3048
|
+
|
|
3049
|
+
```ts
|
|
3050
|
+
if (error instanceof MetaHumanAssetError && error.code === "TN_MH_HASH_MISMATCH") refetch();
|
|
3051
|
+
```
|
|
3052
|
+
|
|
3053
|
+
### `RigEvaluator`
|
|
3054
|
+
|
|
3055
|
+
`class` — One MetaHuman head rig over the checksum-verified browser WASM build of the shared OpenRigLogic ABI: faceboard GUI controls in, joint deltas, blend shape weights and animated map weights out. instantiated, and nothing is fetched from a CDN evaluator throws instead of reading freed memory `create` and the WASM is never fetched; `RigEvaluator.backend()` says which one runs
|
|
3056
|
+
|
|
3057
|
+
```ts
|
|
3058
|
+
export class RigEvaluator implements IRigEvaluator { … }
|
|
3059
|
+
```
|
|
3060
|
+
|
|
3061
|
+
- **Use when:** drive a prepared MetaHuman head's expression from the browser without an Unreal import
|
|
3062
|
+
- **Constraints:** the binary's SHA-256 is checked against the shipped manifest before it is · every returned array is a copy, so no view survives a memory growth; a disposed · a native host that installed the MetaHuman resident gets its C++ evaluator from
|
|
3063
|
+
- **Requires:** npm i @threenative/metahuman
|
|
3064
|
+
|
|
3065
|
+
```ts
|
|
3066
|
+
const rig = await RigEvaluator.create(dna); rig.setGuiControls(gui); rig.evaluate(true); rig.jointOutputs();
|
|
3067
|
+
```
|
|
3068
|
+
|
|
3069
|
+
### `validateMetaHumanAssets`
|
|
3070
|
+
|
|
3071
|
+
`function` — Checks one prepared specimen — bindings sidecar, DNA and GLB — against the rig it claims to drive, and returns the bindings only when every name, index, domain and hash holds up. channels, morph targets or LODs the loaded files do not contain disk and an index past the end of its array are rejections, each with a stable code cannot pass a hand-written sidecar the rig cannot drive
|
|
3072
|
+
|
|
3073
|
+
```ts
|
|
3074
|
+
export function validateMetaHumanAssets(input: IMetaHumanAssetInput): IMetaHumanBindings { … }
|
|
3075
|
+
```
|
|
3076
|
+
|
|
3077
|
+
- **Use when:** refuse a MetaHuman specimen whose bindings point at joints, nodes, blend shape
|
|
3078
|
+
- **Constraints:** fails closed: a missing key, a wrong type, a hash that differs from the bytes on · reads the rig's real names and the GLB's real node, mesh and target counts, so it
|
|
3079
|
+
- **Requires:** npm i @threenative/metahuman
|
|
3080
|
+
|
|
3081
|
+
```ts
|
|
3082
|
+
const bindings = validateMetaHumanAssets({ bindings: parsed, dnaSha256, glbSha256, rig, gltf });
|
|
3083
|
+
```
|
|
3084
|
+
|
|
2727
3085
|
## `@threenative/physics`
|
|
2728
3086
|
|
|
2729
3087
|
### `Area3D`
|
|
@@ -2736,6 +3094,7 @@ export class Area3D { … }
|
|
|
2736
3094
|
|
|
2737
3095
|
- **Use when:** detect when an enemy enters a trigger area · react to a player entering a zone
|
|
2738
3096
|
- **Constraints:** add the area to the physics context before stepping the world
|
|
3097
|
+
- **Deprecated:** Constructor option `world` is deprecated; pass an IPhysicsContext as `physics` instead. Area3D itself is not deprecated.
|
|
2739
3098
|
|
|
2740
3099
|
```ts
|
|
2741
3100
|
const goal = new Area3D({ physics: ctx.physics, shape: CollisionShape3D.sphere(1.2), position: { x: 0, y: 0.5, z: -8 } });
|
|
@@ -2782,6 +3141,7 @@ export class CharacterBody3D { … }
|
|
|
2782
3141
|
|
|
2783
3142
|
- **Use when:** move an enemy or player through a level · keep a character from walking through walls
|
|
2784
3143
|
- **Constraints:** use moveAndSlide inside the physics update
|
|
3144
|
+
- **Deprecated:** Constructor option `world` is deprecated; pass an IPhysicsContext as `physics` instead. CharacterBody3D itself is not deprecated.
|
|
2785
3145
|
|
|
2786
3146
|
```ts
|
|
2787
3147
|
const body = new CharacterBody3D({ object: hero, physics: ctx.physics, shape: CollisionShape3D.capsule(0.5, 0.35) });
|
|
@@ -2826,6 +3186,7 @@ export class Joint3D { … }
|
|
|
2826
3186
|
|
|
2827
3187
|
- **Use when:** constrain a rigid body to another body · build a hinge or pin mechanism · swing a pendulum, wrecking ball, or hinged door on a joint
|
|
2828
3188
|
- **Constraints:** both bodies must belong to the same physics context
|
|
3189
|
+
- **Deprecated:** Constructor option `world` is deprecated; pass an IPhysicsContext as `physics` instead. Joint3D itself is not deprecated.
|
|
2829
3190
|
|
|
2830
3191
|
```ts
|
|
2831
3192
|
const hinge = Joint3D.hinge({ physics: ctx.physics, bodyA: beam, bodyB: bob, anchorA: { x: 0, y: 0, z: 0 }, anchorB: { x: 0, y: 2.4, z: 0 }, axis: { x: 1, y: 0, z: 0 } });
|
|
@@ -2872,6 +3233,7 @@ export class RigidBody3D { … }
|
|
|
2872
3233
|
- **Use when:** give a crate or prop physical motion · create a body that collides with a character · fire physical cannonballs that collide with ships or scenery · fire a cannonball projectile with cannon smoke particles · a bullet passes through a wall
|
|
2873
3234
|
- **Constraints:** register rapier() in the game plugin list before using bodies
|
|
2874
3235
|
- **Overrides:** continuousCollision: false opts one body out while body.continuousCollision still reports the effective setting
|
|
3236
|
+
- **Deprecated:** Constructor option `world` is deprecated; pass an IPhysicsContext as `physics` instead. RigidBody3D itself is not deprecated.
|
|
2875
3237
|
|
|
2876
3238
|
```ts
|
|
2877
3239
|
const crate = new RigidBody3D({ object, physics: ctx.physics, shape: CollisionShape3D.box(1, 1, 1), mass: 8 });
|
|
@@ -2892,6 +3254,22 @@ export function softBodyCollision(...bodies: readonly RigidBody3D[]): ISoftBodyC
|
|
|
2892
3254
|
const cloth = new SoftBody3D(mesh, { ...options, collision: softBodyCollision(wall) });
|
|
2893
3255
|
```
|
|
2894
3256
|
|
|
3257
|
+
### `VehicleBody3D`
|
|
3258
|
+
|
|
3259
|
+
`class` — Drive a car on ray-cast suspension instead of faking speed and heading.
|
|
3260
|
+
|
|
3261
|
+
```ts
|
|
3262
|
+
export class VehicleBody3D extends RigidBody3D { … }
|
|
3263
|
+
```
|
|
3264
|
+
|
|
3265
|
+
- **Use when:** drive a car, truck or bike around a track · make a vehicle roll over kerbs, brake into a corner or stop at a wall
|
|
3266
|
+
- **Constraints:** write engineForce, brake and steering every physics update; a car with no input does not move · suspensionStiffness is a frequency squared, not newtons per metre; 100 is a road car and 20 bottoms out
|
|
3267
|
+
- **Overrides:** a wheel ray never hits the chassis it hangs from, and it honours the chassis collision mask · continuousCollision is on for the chassis, so a fast car cannot tunnel through a wall
|
|
3268
|
+
|
|
3269
|
+
```ts
|
|
3270
|
+
const car = new VehicleBody3D({ object: chassis, physics: ctx.physics, shape: CollisionShape3D.box(1.6, 0.5, 3.6), mass: 900, wheels: [{ position: { x: 0.8, y: -0.15, z: -1.2 }, wheelRadius: 0.34, suspensionRestLength: 0.3, suspensionStiffness: 100, dampingCompression: 2.3, dampingRelaxation: 4.4, wheelFrictionSlip: 10.5, maxSuspensionTravel: 0.3, useAsSteering: true, useAsTraction: false }] });
|
|
3271
|
+
```
|
|
3272
|
+
|
|
2895
3273
|
## `@threenative/physics/navigation`
|
|
2896
3274
|
|
|
2897
3275
|
### `NavigationAgent3D`
|
|
@@ -3296,6 +3674,21 @@ export function assertCaptureNotBlank(png: Buffer, label: string): ICaptureFrame
|
|
|
3296
3674
|
assertCaptureNotBlank(png, "first frame");
|
|
3297
3675
|
```
|
|
3298
3676
|
|
|
3677
|
+
### `assertFrameShowsSomething`
|
|
3678
|
+
|
|
3679
|
+
`function` — Fail closed when a screenshot is blank or uniform.
|
|
3680
|
+
|
|
3681
|
+
```ts
|
|
3682
|
+
assertFrameShowsSomething = assertCaptureNotBlank
|
|
3683
|
+
```
|
|
3684
|
+
|
|
3685
|
+
- **Use when:** guard a visual playtest against a blank frame · prove a screenshot contains more than a loading surface
|
|
3686
|
+
- **Constraints:** the assertion throws instead of returning a false pass
|
|
3687
|
+
|
|
3688
|
+
```ts
|
|
3689
|
+
assertFrameShowsSomething(png, "first frame");
|
|
3690
|
+
```
|
|
3691
|
+
|
|
3299
3692
|
### `CaptureGuardError`
|
|
3300
3693
|
|
|
3301
3694
|
`class` — Explain why a captured frame failed the non-blank guard.
|
|
@@ -3537,6 +3930,23 @@ export async function connectPlaytestBridgeTransport( transport: IBridgeTranspor
|
|
|
3537
3930
|
const bridge = await connectPlaytestBridge(page, scenario);
|
|
3538
3931
|
```
|
|
3539
3932
|
|
|
3933
|
+
### `decideDisplayStrategy`
|
|
3934
|
+
|
|
3935
|
+
`function` — Decide which display a pixel-producing run paints on, the same decision the runner makes.
|
|
3936
|
+
|
|
3937
|
+
```ts
|
|
3938
|
+
export function decideDisplayStrategy(input: IDisplayDecisionInput): IDisplayStrategy { … }
|
|
3939
|
+
```
|
|
3940
|
+
|
|
3941
|
+
- **Use when:** judge whether a measured frame rate came from a display that can carry one
|
|
3942
|
+
- **Constraints:** a private Xvfb is software, so a rate read there measures the X server
|
|
3943
|
+
|
|
3944
|
+
```ts
|
|
3945
|
+
import { decideDisplayStrategy } from "@threenative/playtest/runner";
|
|
3946
|
+
const lane = decideDisplayStrategy({ env: process.env, platform: "linux" });
|
|
3947
|
+
if (lane.kind === "private-xvfb") throw new Error("refuse to judge this frame rate");
|
|
3948
|
+
```
|
|
3949
|
+
|
|
3540
3950
|
### `DesktopPlaytestDriver`
|
|
3541
3951
|
|
|
3542
3952
|
`class` — Drive a local desktop playtest mailbox.
|
|
@@ -5074,14 +5484,15 @@ renderer: { minimumProjectedPixels: 2 } // in threenative.config.ts
|
|
|
5074
5484
|
|
|
5075
5485
|
### `renderer.projection`
|
|
5076
5486
|
|
|
5077
|
-
`function` — The engine's scene-render projection — an internal mirror that collapses repeated draws — on by default. Set `renderer.projection: false` to decline it.
|
|
5487
|
+
`function` — The engine's scene-render projection — an internal mirror that collapses repeated draws, including animated skinned rigs that share a geometry and material into one palette draw per pass — on by default. Set `renderer.projection: false` to decline it, or `projection: { materialChecks: 'everyFrame' }` to keep it and pay for a per-material check on every frame.
|
|
5078
5488
|
|
|
5079
5489
|
```ts
|
|
5080
|
-
renderer.projection?: boolean
|
|
5490
|
+
renderer.projection?: boolean | { materialChecks?: 'spread' | 'everyFrame' }
|
|
5081
5491
|
```
|
|
5082
5492
|
|
|
5083
|
-
- **Use when:** the game got slower after the projection engaged · turn off the render projection, batching, or the instanced mirror · draw count fell but frame time did not · a multi-second freeze when the mirror first engages · opt out of an engine render optimizer
|
|
5084
|
-
- **Constraints:** Unset is the shipping behaviour: the projection runs. Only an explicit `false` declines it. · An opted-out game builds no mirror and runs no eligibility scan; the authored scene is what renders, so declining costs nothing rather than being re-judged each frame. · TN_RENDER_PROJECTION still reports the verdict, with reasonCode `disabled` rather than one of the measured declines.
|
|
5493
|
+
- **Use when:** a crowd of animated characters draws slowly · many SkinnedMesh copies of one rig, each its own draw call · the game got slower after the projection engaged · turn off the render projection, batching, or the instanced mirror · draw count fell but frame time did not · a multi-second freeze when the mirror first engages · opt out of an engine render optimizer · thousands of props each with their own material, one colour apart · a material edit takes a few frames to show up · check every batched material every frame anyway
|
|
5494
|
+
- **Constraints:** Unset is the shipping behaviour: the projection runs. Only an explicit `false` declines it. · An opted-out game builds no mirror and runs no eligibility scan; the authored scene is what renders, so declining costs nothing rather than being re-judged each frame. · TN_RENDER_PROJECTION still reports the verdict, with reasonCode `disabled` rather than one of the measured declines. · `materialChecks: 'spread'` is the default: a bounded slice of the batched materials is proved per frame instead of all of them, so a frame of 4,096 colour-only materials costs 512 checks rather than 4,096. A base-colour edit is never delayed — that write is O(1) per member. · The price of `spread` is staleness on every other material edit: a material that gains a roughness, a map or a define still leaves its group and is drawn exactly, up to `materialCheckStaleFrames` frames later. TN_RENDER_PROJECTION reports that bound; `materialChecks: 'everyFrame'` sets it to 0 and restores the per-member, per-frame check. · Any other `materialChecks` value throws at startup rather than falling back to a default.
|
|
5495
|
+
- **Overrides:** renderer.projection: false declines the whole mirror and costs nothing to decline · renderer: { projection: { materialChecks: 'everyFrame' } } proves every batched material every frame instead of the default bounded slice
|
|
5085
5496
|
|
|
5086
5497
|
```ts
|
|
5087
5498
|
renderer: { projection: false } // in threenative.config.ts
|