threedog 0.7.0 → 0.8.0
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/CHANGELOG.md +196 -1
- package/README.md +6 -9
- package/core/{Animator.js → assets/Animator.js} +28 -18
- package/core/{Assets.js → assets/Assets.js} +98 -54
- package/core/{Baked.js → assets/Baked.js} +4 -4
- package/core/assets/assetEntry.js +237 -0
- package/core/{assetHot.js → assets/assetHot.js} +7 -6
- package/core/{assetLoad.js → assets/assetLoad.js} +55 -16
- package/core/assets/assetLod.js +113 -0
- package/core/{assetManifest.js → assets/assetManifest.js} +19 -11
- package/core/{assetReport.js → assets/assetReport.js} +6 -12
- package/core/{namedModel.js → assets/namedModel.js} +17 -13
- package/core/{Audio.js → audio/Audio.js} +26 -23
- package/core/{audioRules.js → audio/audioRules.js} +8 -5
- package/core/{audioVoice.js → audio/audioVoice.js} +17 -30
- package/core/{Events.js → base/Events.js} +3 -3
- package/core/{I18n.js → base/I18n.js} +10 -10
- package/core/{Random.js → base/Random.js} +5 -4
- package/core/{easing.js → base/easing.js} +1 -1
- package/core/{errorCodes.js → base/errorCodes.js} +98 -110
- package/core/{errorHints.js → base/errorHints.js} +5 -9
- package/core/{errors.js → base/errors.js} +6 -6
- package/core/{events.generated.js → base/events.generated.js} +1 -0
- package/core/{math.js → base/math.js} +15 -4
- package/core/{params.js → base/params.js} +3 -4
- package/core/base/util.js +32 -0
- package/core/{validate.js → base/validate.js} +28 -7
- package/core/{Engine.js → engine/Engine.js} +80 -77
- package/core/{Loading.js → engine/Loading.js} +4 -2
- package/core/{copies.js → engine/copies.js} +4 -4
- package/core/{headlessLoad.js → engine/headlessLoad.js} +4 -4
- package/core/{lifecycle.js → engine/lifecycle.js} +14 -12
- package/core/{loop.js → engine/loop.js} +68 -47
- package/core/{moduleSlots.js → engine/moduleSlots.js} +6 -6
- package/core/{moduleTypes.js → engine/moduleTypes.js} +13 -14
- package/core/{modules.js → engine/modules.js} +14 -11
- package/core/{page.js → engine/page.js} +36 -23
- package/core/{plugins.js → engine/plugins.js} +6 -9
- package/core/{services.js → engine/services.js} +47 -40
- package/core/{startup.js → engine/startup.js} +26 -24
- package/core/{Input.js → input/Input.js} +30 -22
- package/core/{inputContext.js → input/inputContext.js} +14 -5
- package/core/{inputPad.js → input/inputPad.js} +1 -1
- package/core/{inputPointer.js → input/inputPointer.js} +8 -2
- package/core/{inputTouch.js → input/inputTouch.js} +1 -1
- package/core/{Budget.js → inspect/Budget.js} +21 -20
- package/core/{DebugOverrides.js → inspect/DebugOverrides.js} +30 -16
- package/core/{Describe.js → inspect/Describe.js} +26 -22
- package/core/{Inspect.js → inspect/Inspect.js} +9 -7
- package/core/{InspectMaterials.js → inspect/InspectMaterials.js} +7 -8
- package/core/{InspectPerf.js → inspect/InspectPerf.js} +19 -13
- package/core/{InspectScene.js → inspect/InspectScene.js} +8 -5
- package/core/{MaterialInfo.js → inspect/MaterialInfo.js} +3 -2
- package/core/{UrlState.js → inspect/UrlState.js} +52 -20
- package/core/{catalog.js → inspect/catalog.js} +3 -3
- package/core/{checks.js → inspect/checks.js} +7 -5
- package/core/{debugView.js → inspect/debugView.js} +4 -4
- package/core/{describeRender.js → inspect/describeRender.js} +21 -20
- package/core/{describeText.js → inspect/describeText.js} +11 -6
- package/core/inspect/geometryWatch.js +38 -0
- package/core/{lightWatch.js → inspect/lightWatch.js} +8 -8
- package/core/{pictureWriters.js → inspect/pictureWriters.js} +15 -16
- package/core/{shaderCost.js → inspect/shaderCost.js} +1 -1
- package/core/{Ops.js → ops/Ops.js} +16 -11
- package/core/{control.js → ops/control.js} +13 -12
- package/core/ops/holds.js +139 -0
- package/core/{opsAtomic.js → ops/opsAtomic.js} +2 -1
- package/core/{opsCheck.js → ops/opsCheck.js} +4 -5
- package/core/{opsGuard.js → ops/opsGuard.js} +3 -3
- package/core/{opsRun.js → ops/opsRun.js} +7 -4
- package/core/{owned.js → ops/owned.js} +14 -17
- package/core/{sharedPoint.js → ops/sharedPoint.js} +8 -8
- package/core/{stackFrames.js → ops/stackFrames.js} +2 -2
- package/core/{stacks.js → ops/stacks.js} +12 -14
- package/core/{wrap.js → ops/wrap.js} +8 -6
- package/core/{SaveStore.js → saves/SaveStore.js} +1 -1
- package/core/{Saves.js → saves/Saves.js} +58 -36
- package/core/{saveApply.js → saves/saveApply.js} +13 -9
- package/core/{saveFiles.js → saves/saveFiles.js} +17 -15
- package/core/{saveValues.js → saves/saveValues.js} +20 -3
- package/core/{saveVersions.js → saves/saveVersions.js} +4 -17
- package/core/{session.js → saves/session.js} +31 -17
- package/core/{Rays.js → scene/Rays.js} +23 -25
- package/core/{Views.js → scene/Views.js} +14 -6
- package/core/{adaptive.js → scene/adaptive.js} +15 -8
- package/core/{canvasBox.js → scene/canvasBox.js} +2 -3
- package/core/{engineCamera.js → scene/engineCamera.js} +1 -1
- package/core/{gameLights.js → scene/gameLights.js} +17 -7
- package/core/{grayMap.js → scene/grayMap.js} +8 -2
- package/core/{grid.js → scene/grid.js} +4 -4
- package/core/{gridLoad.js → scene/gridLoad.js} +1 -1
- package/core/{ground.js → scene/ground.js} +9 -9
- package/core/{movement.js → scene/movement.js} +3 -3
- package/core/{pictureSlots.js → scene/pictureSlots.js} +2 -2
- package/core/{sceneDelta.js → scene/sceneDelta.js} +2 -2
- package/core/{sceneMethods.js → scene/sceneMethods.js} +36 -13
- package/core/scene/stepPoses.js +55 -0
- package/core/{targeting.js → scene/targeting.js} +4 -5
- package/core/{thingExplain.js → scene/thingExplain.js} +6 -5
- package/core/{thingOps.js → scene/thingOps.js} +4 -3
- package/core/{things.js → scene/things.js} +18 -5
- package/core/{threePatches.js → scene/threePatches.js} +1 -1
- package/core/{view.js → scene/view.js} +17 -16
- package/core/{Batching.js → stream/Batching.js} +85 -27
- package/core/{Stream.js → stream/Stream.js} +60 -30
- package/core/{batchGroups.js → stream/batchGroups.js} +10 -9
- package/core/{chunkStream.js → stream/chunkStream.js} +40 -0
- package/core/{scatter.js → stream/scatter.js} +2 -2
- package/core/{streamSources.js → stream/streamSources.js} +12 -7
- package/core/{Commits.js → threads/Commits.js} +6 -5
- package/core/{Jobs.js → threads/Jobs.js} +12 -10
- package/core/{Threads.js → threads/Threads.js} +16 -16
- package/core/{threadPure.js → threads/threadPure.js} +7 -5
- package/core/{threadServe.js → threads/threadServe.js} +3 -3
- package/core/{Clock.js → time/Clock.js} +17 -10
- package/core/{dayTime.js → time/dayTime.js} +5 -1
- package/core/{skip.js → time/skip.js} +18 -17
- package/core/{time.js → time/time.js} +18 -12
- package/core/{uiClock.js → time/uiClock.js} +4 -4
- package/docs/AI.md +22 -19
- package/docs/API.md +24 -23
- package/docs/CODEMAP.md +76 -183
- package/docs/COMMANDS.md +66 -58
- package/docs/CONVENTIONS.md +54 -14
- package/docs/MIGRATING-0.8.md +169 -0
- package/docs/THREE.md +78 -29
- package/docs/api/assets.md +12 -13
- package/docs/api/audio.md +6 -5
- package/docs/api/budget.md +4 -4
- package/docs/api/calendar.md +10 -11
- package/docs/api/cameraRig.md +29 -29
- package/docs/api/characters.md +23 -18
- package/docs/api/clock.md +1 -1
- package/docs/api/collision.md +12 -9
- package/docs/api/content.md +6 -6
- package/docs/api/dialogue.md +3 -3
- package/docs/api/engine.md +45 -43
- package/docs/api/events.md +3 -2
- package/docs/api/flow.md +1 -1
- package/docs/api/grids.md +1 -1
- package/docs/api/ground.md +4 -5
- package/docs/api/hud.md +2 -2
- package/docs/api/i18n.md +6 -6
- package/docs/api/input.md +7 -7
- package/docs/api/interactions.md +4 -4
- package/docs/api/inventory.md +9 -9
- package/docs/api/jobs.md +5 -5
- package/docs/api/level.md +7 -7
- package/docs/api/lightPool.md +1 -6
- package/docs/api/music.md +3 -3
- package/docs/api/nav.md +10 -10
- package/docs/api/openWorld.md +1 -1
- package/docs/api/particles.md +2 -2
- package/docs/api/photo.md +4 -2
- package/docs/api/pickups.md +2 -2
- package/docs/api/post.md +20 -3
- package/docs/api/quests.md +3 -3
- package/docs/api/rays.md +5 -7
- package/docs/api/rigid.md +27 -18
- package/docs/api/saves.md +8 -7
- package/docs/api/settings.md +9 -8
- package/docs/api/sky.md +8 -7
- package/docs/api/stream.md +7 -7
- package/docs/api/swarm.md +34 -0
- package/docs/api/terrain.md +7 -8
- package/docs/api/terrainDraw.md +1 -1
- package/docs/api/timeline.md +2 -2
- package/docs/api/tools.md +25 -22
- package/docs/api/vars.md +1 -1
- package/docs/api/vegetation.md +4 -3
- package/docs/api/vegetationDraw.md +1 -1
- package/docs/api/water.md +1 -1
- package/docs/api/weather.md +9 -9
- package/docs/api/weatherDraw.md +3 -3
- package/docs/api/world.md +5 -5
- package/docs/recipes/01-new-game.md +25 -40
- package/docs/recipes/02-npc.md +19 -20
- package/docs/recipes/03-items-pickups.md +27 -43
- package/docs/recipes/04-quests.md +3 -4
- package/docs/recipes/05-props-bake.md +29 -39
- package/docs/recipes/06-clock-events.md +27 -18
- package/docs/recipes/07-flow-scenes-pause.md +12 -17
- package/docs/recipes/08-weather-sky.md +88 -34
- package/docs/recipes/09-materials-lights-models.md +22 -36
- package/docs/recipes/10-blender-level.md +6 -7
- package/docs/recipes/11-vehicles.md +30 -22
- package/docs/recipes/12-navmesh.md +9 -8
- package/docs/recipes/13-animation.md +39 -17
- package/docs/recipes/14-custom-module.md +14 -13
- package/docs/recipes/15-perf.md +49 -26
- package/docs/recipes/16-dev-bridge.md +32 -52
- package/docs/recipes/18-world.md +36 -23
- package/docs/recipes/19-shooting-picking.md +4 -2
- package/docs/recipes/20-content-actions-save.md +30 -35
- package/docs/recipes/21-camera.md +33 -5
- package/docs/recipes/22-shop-gold.md +0 -4
- package/docs/recipes/23-ops.md +10 -10
- package/docs/recipes/26-ui-parts.md +22 -12
- package/docs/recipes/27-net.md +0 -2
- package/docs/recipes/28-terrain.md +117 -21
- package/docs/recipes/29-grid.md +2 -2
- package/docs/recipes/30-templates.md +55 -19
- package/docs/recipes/31-audio.md +5 -5
- package/docs/recipes/32-action-game.md +15 -6
- package/docs/recipes/33-stream-sources.md +2 -2
- package/docs/recipes/34-environment-lighting.md +67 -19
- package/docs/recipes/35-picture-from-reference.md +10 -17
- package/docs/recipes/36-ground-plants.md +105 -0
- package/docs/recipes/40-scene.md +7 -11
- package/docs/recipes/43-shader-patches-surfaces.md +20 -41
- package/docs/recipes/44-water-weather-hooks.md +48 -43
- package/docs/recipes/45-cascaded-shadows.md +39 -17
- package/docs/recipes/46-blender-art-route.md +7 -8
- package/docs/recipes/49-game-module-contract.md +5 -5
- package/docs/recipes/50-own-renderer.md +2 -2
- package/docs/recipes/52-around-the-picture.md +54 -98
- package/docs/recipes/53-ground-up-close.md +61 -24
- package/docs/recipes/55-mods-time-wrap.md +12 -16
- package/docs/recipes/56-webgpu-tsl.md +16 -14
- package/docs/recipes/57-control.md +9 -2
- package/docs/recipes/58-input.md +2 -2
- package/docs/recipes/59-depth-post-effects.md +1 -1
- package/docs/recipes/60-judge-the-picture.md +29 -24
- package/docs/recipes/62-picture-code.md +49 -17
- package/docs/recipes/63-third-person-start.md +17 -4
- package/docs/recipes/64-particles.md +1 -1
- package/docs/recipes/65-swarm.md +140 -0
- package/examples/action/.threedog/content-index.json +1 -1
- package/examples/action/GAMEMAP.md +2 -2
- package/examples/{sheepisland → perf-island}/.threedog/content-index.json +1 -1
- package/examples/{sheepisland → perf-island}/GAMEMAP.md +12 -11
- package/examples/{sheepisland → perf-island}/assets.js +1 -1
- package/examples/{sheepisland → perf-island}/main.js +8 -8
- package/examples/{sheepisland → perf-island}/models.js +1 -1
- package/examples/{sheepisland → perf-island}/params.js +1 -1
- package/examples/{sheepisland → perf-island}/picture/index.js +1 -1
- package/examples/{sheepisland → perf-island}/picture/palette.js +2 -2
- package/examples/{sheepisland → perf-island}/views.js +1 -1
- package/examples/plain-picture/GAMEMAP.md +1 -0
- package/examples/rc2d/GAMEMAP.md +3 -2
- package/examples/rc2d/main.js +1 -3
- package/examples/styletest/.threedog/content-index.json +1 -1
- package/examples/styletest/GAMEMAP.md +3 -2
- package/examples/techniques/contact-shadows/contactShadows.js +1 -1
- package/examples/techniques/contact-shadows/main.js +1 -1
- package/examples/techniques/interior-light/main.js +1 -1
- package/examples/techniques/modular-building/README.md +7 -6
- package/examples/techniques/outlines-and-rim/picture/post.js +1 -1
- package/examples/techniques/procedural-animation/README.md +1 -1
- package/examples/webgpu-tsl/GAMEMAP.md +1 -0
- package/examples/world/.threedog/content-index.json +1 -1
- package/examples/world/GAMEMAP.md +4 -3
- package/examples/world/picture/sky.js +1 -1
- package/index.d.ts +8 -7
- package/index.js +31 -31
- package/llms.txt +9 -13
- package/modules/ambience/Ambience.js +11 -8
- package/modules/calendar/Calendar.js +19 -19
- package/modules/calendar/index.js +13 -13
- package/modules/calendar/schedule.js +11 -6
- package/modules/calendar/seasons.js +7 -7
- package/modules/camera/FirstPersonCamera.js +2 -2
- package/modules/camera/FixedCamera.js +14 -15
- package/modules/camera/FollowCamera.js +4 -4
- package/modules/camera/RtsCamera.js +11 -11
- package/modules/camera/common.js +48 -24
- package/modules/camera/contract.js +1 -0
- package/modules/camera/projection.js +2 -2
- package/modules/characters/Character.js +33 -30
- package/modules/characters/NPC.js +27 -19
- package/modules/characters/assetModel.js +14 -10
- package/modules/characters/astar.js +7 -5
- package/modules/characters/behaviors.js +4 -5
- package/modules/characters/contract.js +2 -2
- package/modules/characters/index.js +168 -214
- package/modules/characters/moveHelpers.js +14 -3
- package/modules/characters/movers/common.js +16 -14
- package/modules/characters/movers/manual.js +1 -1
- package/modules/characters/movers/rapier.js +7 -6
- package/modules/characters/movers/simple.js +3 -3
- package/modules/characters/movers/support.js +8 -8
- package/modules/characters/npcAvoid.js +4 -4
- package/modules/characters/npcSim.js +23 -17
- package/modules/characters/npcView.js +6 -5
- package/modules/characters/pathAsync.js +12 -10
- package/modules/characters/pathWorker.js +1 -1
- package/modules/characters/player.js +108 -0
- package/modules/characters/playerStrings.js +2 -2
- package/modules/characters/proceduralRig.js +2 -2
- package/modules/characters/useModel.js +3 -3
- package/modules/characters/walkTo.js +11 -17
- package/modules/collision/Collision.js +26 -20
- package/modules/collision/contract.js +15 -0
- package/modules/content/explain.js +1 -2
- package/modules/content/fields.js +24 -3
- package/modules/content/ids.js +2 -2
- package/modules/content/index.js +61 -99
- package/modules/content/loader.js +14 -17
- package/modules/content/markers.js +25 -0
- package/modules/content/models.js +10 -7
- package/modules/content/packs.js +3 -3
- package/modules/content/parts.js +2 -2
- package/modules/content/places.js +35 -0
- package/modules/content/props.js +17 -14
- package/modules/content/rules.js +25 -21
- package/modules/content/stages.js +7 -7
- package/modules/content/templates.js +20 -20
- package/modules/content/words.js +34 -0
- package/modules/debug/DebugPanel.js +10 -43
- package/modules/flow/contract.js +1 -1
- package/modules/flow/index.js +11 -7
- package/modules/gameplay/Container.js +12 -11
- package/modules/gameplay/Containers.js +14 -5
- package/modules/gameplay/Dialogue.js +13 -11
- package/modules/gameplay/Interactions.js +37 -24
- package/modules/gameplay/Inventory.js +8 -9
- package/modules/gameplay/Quests.js +16 -9
- package/modules/gameplay/boxOps.js +1 -1
- package/modules/gameplay/dialogueBubbles.js +3 -4
- package/modules/gameplay/inventoryOps.js +0 -1
- package/modules/gameplay/pickups.js +22 -23
- package/modules/gameplay/questSave.js +3 -3
- package/modules/grid/Grid.js +1 -1
- package/modules/grid/Layer.js +4 -4
- package/modules/grid/index.js +7 -8
- package/modules/grid/preview.js +7 -7
- package/modules/grid/tiles.js +6 -6
- package/modules/hlod/index.js +37 -55
- package/modules/hud/index.js +17 -11
- package/modules/hud/parts.js +4 -4
- package/modules/level/contract.js +16 -0
- package/modules/level/heightfield.js +12 -10
- package/modules/level/index.js +47 -152
- package/modules/level/load.js +79 -0
- package/modules/level/meshes.js +65 -0
- package/modules/level/nodes.js +6 -7
- package/modules/lights/index.js +28 -181
- package/modules/lights/slots.js +93 -0
- package/modules/lights/sources.js +88 -0
- package/modules/music/Music.js +30 -26
- package/modules/music/rules.js +1 -1
- package/modules/nav/contract.js +14 -0
- package/modules/nav/index.js +11 -10
- package/modules/net/Client.js +7 -7
- package/modules/net/Host.js +7 -7
- package/modules/net/Net.js +1 -1
- package/modules/net/index.js +5 -4
- package/modules/net/sync.js +2 -2
- package/modules/net/transports.js +2 -2
- package/modules/particles/Particles.js +11 -8
- package/modules/particles/effect.js +7 -5
- package/modules/particles/shaders.js +2 -1
- package/modules/photo/Photo.js +15 -17
- package/modules/rigid/RigidBodies.js +66 -43
- package/modules/rigid/Vehicles.js +2 -3
- package/modules/rigid/ragdoll.js +287 -0
- package/modules/rigid/ragdollBones.js +159 -0
- package/modules/rigid/sync.js +6 -6
- package/modules/settings/Settings.js +108 -39
- package/modules/settings/apply.js +6 -6
- package/modules/settings/sections.js +16 -14
- package/modules/settings/view.js +3 -3
- package/modules/sky/Sky.js +29 -22
- package/modules/sky/clouds.js +7 -7
- package/modules/sky/dome.js +33 -20
- package/modules/sky/domeLayers.js +9 -9
- package/modules/sky/environment.js +6 -6
- package/modules/sky/frame.js +19 -10
- package/modules/sky/season.js +7 -1
- package/modules/sky/shader.js +24 -25
- package/modules/sky/skyModule.js +14 -27
- package/modules/sky/tint.js +1 -1
- package/modules/swarm/Swarm.js +346 -0
- package/modules/swarm/draw.js +68 -0
- package/modules/swarm/grid.js +63 -0
- package/modules/terrain/ChunkManager.js +70 -52
- package/modules/terrain/chunkQueries.js +7 -24
- package/modules/terrain/chunkWorker.js +1 -1
- package/modules/terrain/draw.js +14 -11
- package/modules/terrain/index.js +28 -34
- package/modules/terrain/terrainColorMap.js +6 -3
- package/modules/terrain/terrainDefaults.js +2 -1
- package/modules/terrain/terrainEdit.js +32 -27
- package/modules/terrain/terrainGen.js +17 -12
- package/modules/terrain/terrainIsland.js +2 -2
- package/modules/terrain/terrainMesh.js +7 -6
- package/modules/terrain/terrainShape.js +8 -10
- package/modules/terrain/terrainShapeMain.js +3 -3
- package/modules/timeline/Timeline.js +27 -19
- package/modules/timeline/Tween.js +6 -6
- package/modules/timeline/shots.js +5 -7
- package/modules/triggers/index.js +9 -9
- package/modules/vegetation/Vegetation.js +30 -23
- package/modules/vegetation/densityMap.js +4 -7
- package/modules/vegetation/draw.js +23 -18
- package/modules/vegetation/groundChunks.js +11 -31
- package/modules/vegetation/index.js +8 -6
- package/modules/vegetation/modelGeometry.js +3 -6
- package/modules/vegetation/nearFade.js +1 -1
- package/modules/water/Water.js +16 -16
- package/modules/water/surface.js +3 -3
- package/modules/weather/Weather.js +41 -30
- package/modules/weather/particles.js +8 -8
- package/modules/weather/weatherDraw.js +22 -18
- package/modules/world/World.js +8 -8
- package/modules/world/explain.js +1 -1
- package/modules/world/index.js +18 -12
- package/modules/world/persist.js +73 -25
- package/modules/world/pos.js +4 -4
- package/modules/world/records.js +28 -8
- package/modules/world/sim.js +4 -4
- package/modules/world/state.js +12 -5
- package/modules/world/thingSource.js +4 -2
- package/modules/world/views.js +11 -9
- package/package.json +42 -7
- package/presets.js +1 -3
- package/render/PostFX.js +39 -27
- package/render/backend.js +26 -32
- package/render/cascades.js +17 -12
- package/render/cascades.tsl.js +5 -8
- package/render/daylight.js +20 -3
- package/render/detail.js +8 -7
- package/render/effects.js +28 -25
- package/render/fuse.js +3 -3
- package/render/fx/cloudShadow.tsl.js +3 -3
- package/render/fx/detail.tsl.js +1 -1
- package/render/fx/index.js +5 -10
- package/render/fx/library.tsl.js +11 -0
- package/render/fx/lighting.tsl.js +2 -1
- package/render/fx/nodeErrors.tsl.js +2 -2
- package/render/fx/objectOrigin.tsl.js +1 -2
- package/render/fx/patchNodes.tsl.js +5 -15
- package/render/fx/postWebGPU.tsl.js +27 -23
- package/render/fx/sky.tsl.js +15 -17
- package/render/fx/uniforms.tsl.js +4 -4
- package/render/fx/wind.tsl.js +1 -1
- package/render/fxNumbers.js +3 -0
- package/render/layers.js +1 -1
- package/render/lighting.js +5 -3
- package/render/lightmap.js +20 -20
- package/render/lights.js +6 -6
- package/render/lit.js +24 -0
- package/render/materials.js +8 -7
- package/render/mergeCommon.js +22 -0
- package/render/modeling.js +2 -2
- package/render/occlusion.js +20 -4
- package/render/ownFrame.js +4 -4
- package/render/patches.js +13 -13
- package/render/postWebGL.js +12 -10
- package/render/probes.js +16 -19
- package/render/recordSweep.js +117 -0
- package/render/shaderErrors.js +10 -9
- package/render/shadowCache.tsl.js +107 -0
- package/render/shadowTypes.js +9 -0
- package/{core → render}/shadows.js +57 -11
- package/render/slots.js +7 -7
- package/render/terms.js +22 -24
- package/render/uniformDecl.js +1 -1
- package/types/core.d.ts +200 -153
- package/types/gameplay.d.ts +163 -91
- package/types/generated/core/{Audio.d.ts → audio/Audio.d.ts} +22 -7
- package/types/generated/core/{audioVoice.d.ts → audio/audioVoice.d.ts} +2 -2
- package/types/generated/core/{Events.d.ts → base/Events.d.ts} +4 -4
- package/types/generated/core/{I18n.d.ts → base/I18n.d.ts} +7 -15
- package/types/generated/core/{Random.d.ts → base/Random.d.ts} +4 -3
- package/types/generated/core/{page.d.ts → engine/page.d.ts} +8 -9
- package/types/generated/core/{Input.d.ts → input/Input.d.ts} +12 -8
- package/types/generated/core/{Budget.d.ts → inspect/Budget.d.ts} +36 -26
- package/types/generated/core/{DebugOverrides.d.ts → inspect/DebugOverrides.d.ts} +2 -2
- package/types/generated/core/{Ops.d.ts → ops/Ops.d.ts} +4 -3
- package/types/generated/core/{control.d.ts → ops/control.d.ts} +4 -10
- package/types/generated/core/{Saves.d.ts → saves/Saves.d.ts} +37 -13
- package/types/generated/core/{session.d.ts → saves/session.d.ts} +2 -1
- package/types/generated/core/{Rays.d.ts → scene/Rays.d.ts} +8 -27
- package/types/generated/core/{Views.d.ts → scene/Views.d.ts} +1 -1
- package/types/generated/core/{Batching.d.ts → stream/Batching.d.ts} +7 -7
- package/types/generated/core/{Stream.d.ts → stream/Stream.d.ts} +18 -16
- package/types/generated/core/{Commits.d.ts → threads/Commits.d.ts} +1 -1
- package/types/generated/core/{Jobs.d.ts → threads/Jobs.d.ts} +6 -6
- package/types/generated/core/{Threads.d.ts → threads/Threads.d.ts} +4 -4
- package/types/generated/modules/calendar/Calendar.d.ts +10 -11
- package/types/generated/modules/debug/DebugPanel.d.ts +1 -9
- package/types/generated/modules/grid/Layer.d.ts +1 -1
- package/types/generated/modules/grid/index.d.ts +3 -3
- package/types/generated/modules/music/Music.d.ts +7 -5
- package/types/generated/modules/particles/Particles.d.ts +1 -1
- package/types/generated/modules/sky/Sky.d.ts +21 -10
- package/types/generated/modules/swarm/Swarm.d.ts +80 -0
- package/types/generated/modules/timeline/Timeline.d.ts +2 -1
- package/types/generated/modules/water/Water.d.ts +1 -0
- package/types/generated/modules/weather/Weather.d.ts +16 -12
- package/types/generated/modules/weather/weatherDraw.d.ts +3 -3
- package/types/generated/modules/world/World.d.ts +5 -3
- package/types/generated/render/PostFX.d.ts +17 -11
- package/types/generated/render/materials.d.ts +1 -0
- package/types/generated/render/occlusion.d.ts +9 -0
- package/types/generated/render/patches.d.ts +1 -0
- package/types/generated/ui/Focus.d.ts +1 -0
- package/types/generated/ui/UI.d.ts +1 -0
- package/types/nav.d.ts +11 -11
- package/types/physics.d.ts +99 -70
- package/types/tsl.d.ts +37 -4
- package/types/world.d.ts +38 -71
- package/ui/Focus.js +10 -9
- package/ui/Parts.js +4 -3
- package/ui/UI.js +7 -7
- package/ui/defaults.js +3 -2
- package/ui/theme.js +5 -3
- package/core/assetEntry.js +0 -109
- package/core/holds.js +0 -134
- package/core/shadowTypes.js +0 -16
- package/core/util.js +0 -17
- package/docs/MIGRATING-0.3.md +0 -248
- package/docs/MIGRATING-0.4.md +0 -320
- package/docs/MIGRATING-0.5.md +0 -68
- package/docs/MIGRATING-0.6.md +0 -126
- package/docs/PERF.md +0 -245
- package/docs/recipes/36-sky-ground-plants.md +0 -158
- package/docs/recipes/37-terrain-hooks.md +0 -115
- package/docs/recipes/38-environment-hooks.md +0 -67
- package/docs/recipes/42-terrain-shape.md +0 -64
- package/docs/recipes/47-island-snow-backdrop.md +0 -43
- package/docs/recipes/54-three-idioms.md +0 -88
- package/examples/plain-picture/FINDINGS.md +0 -53
- /package/core/{Vars.js → base/Vars.js} +0 -0
- /package/core/{mulberry32.js → base/mulberry32.js} +0 -0
- /package/core/{inputDefaults.js → input/inputDefaults.js} +0 -0
- /package/core/{textureBytes.js → inspect/textureBytes.js} +0 -0
- /package/core/{actor.js → ops/actor.js} +0 -0
- /package/core/{opsFail.js → ops/opsFail.js} +0 -0
- /package/core/{opsHistory.js → ops/opsHistory.js} +0 -0
- /package/core/{saveIds.js → saves/saveIds.js} +0 -0
- /package/core/{screenToGround.js → scene/screenToGround.js} +0 -0
- /package/core/{tier.js → scene/tier.js} +0 -0
- /package/core/{cells.js → stream/cells.js} +0 -0
- /package/core/{streamCells.js → stream/streamCells.js} +0 -0
- /package/core/{pureWorker.js → threads/pureWorker.js} +0 -0
- /package/examples/{sheepisland → perf-island}/content/index.js +0 -0
- /package/examples/{sheepisland → perf-island}/content/props.js +0 -0
- /package/examples/{sheepisland → perf-island}/content/templates.js +0 -0
- /package/examples/{sheepisland → perf-island}/content/vegetation.js +0 -0
- /package/examples/{sheepisland → perf-island}/picture/lights.js +0 -0
- /package/examples/{sheepisland → perf-island}/picture/materials.js +0 -0
- /package/examples/{sheepisland → perf-island}/picture/sky.js +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/render/PostFX.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
export class PostFX {
|
|
3
|
+
set antialias(on: boolean);
|
|
3
4
|
/**
|
|
4
|
-
* MSAA on
|
|
5
|
-
* @
|
|
5
|
+
* MSAA on. Writing it takes effect like setAntialias.
|
|
6
|
+
* @type {boolean}
|
|
7
|
+
* @experimental
|
|
6
8
|
*/
|
|
7
9
|
get antialias(): boolean;
|
|
8
10
|
/**
|
|
@@ -12,22 +14,24 @@ export class PostFX {
|
|
|
12
14
|
*/
|
|
13
15
|
get active(): boolean;
|
|
14
16
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* the engine owns it, rebuilds
|
|
17
|
+
* What the chain runs in, for reading, or null while no post work has run yet (built the first time an effect or MSAA is on; it is not built here, so asking never costs a
|
|
18
|
+
* render target). WebGLRenderer: the three.js EffectComposer (pass list, sizes, its targets). WebGPURenderer: { pipeline, scenePass }, three's RenderPipeline and the scene's pass() node. Read-only by rule, not by lock:
|
|
19
|
+
* the engine owns it, rebuilds the chain whenever the list changes and disposes it with the engine. To add a pass use post.add,
|
|
18
20
|
* to own the whole chain post.own() (recipe 52). Why public: a game reading the chain had to dig into an internal field (review 2026-11-03)
|
|
19
21
|
* @returns {any}
|
|
22
|
+
* @experimental
|
|
20
23
|
*/
|
|
21
24
|
object(): any;
|
|
22
25
|
/**
|
|
23
26
|
* The composer's render targets, for reading (sample the last frame's color or depth in a game pass, check formats / samples), or null while
|
|
24
|
-
* there is no composer. renderTarget1 / renderTarget2 are the ping-pong pair. During the chain readBuffer is a pass's input and writeBuffer its
|
|
27
|
+
* there is no composer, and always on WebGPURenderer (its pass nodes own their targets: post.object().scenePass). renderTarget1 / renderTarget2 are the ping-pong pair. During the chain readBuffer is a pass's input and writeBuffer its
|
|
25
28
|
* output; EffectComposer swaps them after every pass with needsSwap (most passes; the scene RenderPass does not). The last pass draws to the
|
|
26
29
|
* canvas and still swaps, so after the frame (engine.onRender(fn, { when: 'after' })) neither target holds the final picture: writeBuffer holds
|
|
27
30
|
* the input of that last pass (readBuffer when the last pass does not swap) and readBuffer is stale. For the final image, render into a target of your own.
|
|
28
31
|
* Owned by the engine like object(): it resizes them, changes samples on setAntialias and adds a depth texture when an effect needs depth;
|
|
29
|
-
* do not dispose them or swap their textures. A target of your own: new THREE.WebGLRenderTarget in onRender (
|
|
32
|
+
* do not dispose them or swap their textures. A target of your own: new THREE.WebGLRenderTarget in onRender (THREE.md)
|
|
30
33
|
* @returns {{ renderTarget1: any, renderTarget2: any, readBuffer: any, writeBuffer: any } | null}
|
|
34
|
+
* @experimental
|
|
31
35
|
*/
|
|
32
36
|
targets(): {
|
|
33
37
|
renderTarget1: any;
|
|
@@ -121,7 +125,7 @@ export type PostContext = {
|
|
|
121
125
|
* values(params) returns their current values. reads: true when the snippet samples tDiffuse at other uvs (blur, color fringe):
|
|
122
126
|
* it then starts a new group, so it sees the real input.
|
|
123
127
|
* tsl (WebGPURenderer): (color, uv, t) => color, the same snippet as a TSL expression on the vec4 color node; t holds tsl (three/tsl),
|
|
124
|
-
* p (a uniform node per number / color param, live: set() changes .value, no rebuild), input (the image so far, sample it at other uvs with
|
|
128
|
+
* p (a uniform node per number, boolean (0 / 1), color and vector param, live: set() changes .value, no rebuild), input (the image so far, sample it at other uvs with
|
|
125
129
|
* t.input.sample(uv)), time (s), resolution (device px). Neighbors are chained into one node, so three draws them in one pass.
|
|
126
130
|
*/
|
|
127
131
|
export type PostFuse = {
|
|
@@ -135,7 +139,8 @@ export type PostFuse = {
|
|
|
135
139
|
* when an effect that is on says so in needsBuffers); tsl: three/tsl; display: three's display nodes (bloom, ao from three/addons/tsl/display) plus
|
|
136
140
|
* pass (an extra scene render), texture (the color so far as a texture to sample at other uvs) and own (a node the effect made itself, disposed with the chain),
|
|
137
141
|
* handed in so the main entry of an effect package never imports three/webgpu (its /tsl subpath may, a WebGL game never loads that) and so the nodes they make are disposed with the chain;
|
|
138
|
-
*
|
|
142
|
+
* fx: the threedog/tsl functions (noise, hash ...), handed in for the same reason;
|
|
143
|
+
* p: live uniform nodes of the number, boolean (0 / 1), color and vector params (as in PostFuse tsl), so set() of those never rebuilds the pipeline; a param read from
|
|
139
144
|
* ctx.params while node() runs is a constant in the graph, so set() of it rebuilds the chain (as WebGL rebuilds an effect without update()).
|
|
140
145
|
*/
|
|
141
146
|
export type PostNodeContext = {
|
|
@@ -147,12 +152,13 @@ export type PostNodeContext = {
|
|
|
147
152
|
params: Record<string, any>;
|
|
148
153
|
scenePass: any;
|
|
149
154
|
tsl: any;
|
|
155
|
+
fx: Record<string, Function>;
|
|
150
156
|
display: Record<string, Function>;
|
|
151
157
|
p: Record<string, any>;
|
|
152
158
|
};
|
|
153
159
|
/**
|
|
154
|
-
* node (WebGPURenderer): returns the effect's output color node built on input (the color node so far); called again only when a param
|
|
155
|
-
* that is not a number
|
|
160
|
+
* An effect as data, the form post.add() takes. node (WebGPURenderer): returns the effect's output color node built on input (the color node so far); called again only when a param
|
|
161
|
+
* that is not a number, boolean, color or vector changes (those are live in ctx.p). An effect with only create cannot run on WebGPURenderer (it throws by name).
|
|
156
162
|
* create: builds the implementation the first time the effect is on (WebGL: a three.js postprocessing Pass); optional when fuse is given.
|
|
157
163
|
* fuse: see PostFuse; effects with a fuse in the same slot next to each other are merged (never in slot 'scene'), their params
|
|
158
164
|
* update in place (no update() needed).
|
|
@@ -56,6 +56,7 @@ export function applyEffects(material: THREE.Material, { wind, clouds, season, d
|
|
|
56
56
|
* @param {{ assets: any }} [engine]
|
|
57
57
|
* @param {{ effects?: boolean, detail?: import('../../../render/detail').DetailOptions | null }} [o]
|
|
58
58
|
* @returns {Material}
|
|
59
|
+
* @experimental
|
|
59
60
|
*/
|
|
60
61
|
export function terrainMaterial(base?: THREE.Material | null, engine?: {
|
|
61
62
|
assets: any;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/render/occlusion.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* The mask a mesh goes back to after the engine hid it on one layer. A game's write while hidden stands (hard rule 4): layers.set took the hidden layer
|
|
4
|
+
* away, so the mask is the game's; layers.enable added to it, so the game's bit joins what was there before.
|
|
5
|
+
* @param {number} now the mask now @param {number} bit the hiding layer's bit @param {number} before the mask before hiding @returns {number}
|
|
6
|
+
*/
|
|
7
|
+
export function unhideMask(now: number, bit: number, before: number): number;
|
|
8
|
+
/** The mask bit of the batch layer, where a far original waits (hlod, assets.lod); three keeps layer masks unsigned */
|
|
9
|
+
export const FAR_BIT: number;
|
|
10
|
+
export function noRaycast(): void;
|
|
2
11
|
export class Occlusion {
|
|
3
12
|
set enabled(v: boolean);
|
|
4
13
|
/** Occlusion culling of hlod cells and batched groups; describe().render.occlusion says what it saved @returns {boolean} */
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/** @import { UIFocus } from '../../gameplay' */
|
|
4
4
|
/**
|
|
5
5
|
* UI focus stack: windows, dialogue and cutscenes push in open order; the back key (Esc) goes to the top only; an empty stack hands it to the settings menu
|
|
6
|
+
* @experimental the stable route for a screen of your own is engine.input.push (recipes/07-flow-scenes-pause.md)
|
|
6
7
|
* @param {Engine} engine
|
|
7
8
|
* @returns {UIFocus}
|
|
8
9
|
*/
|
|
@@ -26,6 +26,7 @@ export function makeWindow(engine: Engine, opts: WindowOptions): UIWindow;
|
|
|
26
26
|
* @param {{ open: boolean, toggle(on?: boolean): void }} win a makeWindow window or any handle with open / toggle
|
|
27
27
|
* @param {string} action
|
|
28
28
|
* @returns {void}
|
|
29
|
+
* @experimental
|
|
29
30
|
*/
|
|
30
31
|
export function toggleOnKey(engine: Engine, win: {
|
|
31
32
|
open: boolean;
|
package/types/nav.d.ts
CHANGED
|
@@ -13,15 +13,15 @@ export interface NavOptions {
|
|
|
13
13
|
maxClimb?: number;
|
|
14
14
|
/** Max walkable slope (degrees), default reads engine.movement.maxSlope */
|
|
15
15
|
maxSlope?: number;
|
|
16
|
-
/** Tile size (in cells), default 32 */
|
|
16
|
+
/** Tile size (in cells), default 32 @experimental */
|
|
17
17
|
tileSize?: number;
|
|
18
18
|
/** NPCs use Recast crowd avoidance, default false */
|
|
19
19
|
crowd?: boolean;
|
|
20
20
|
/** Show the navmesh (debug), default false */
|
|
21
21
|
debug?: boolean;
|
|
22
|
-
/** Most TileCache obstacles (collision boxes are cut into several), default 1024 */
|
|
22
|
+
/** Most TileCache obstacles (collision boxes are cut into several), default 1024 @experimental */
|
|
23
23
|
maxObstacles?: number;
|
|
24
|
-
/** Most crowd agents (with crowd: true), default 128 */
|
|
24
|
+
/** Most crowd agents (with crowd: true), default 128 @experimental */
|
|
25
25
|
maxAgents?: number;
|
|
26
26
|
/** Meters past the character's radius a path may end short of its goal and still count as arrived, default 0.6 */
|
|
27
27
|
arrive?: number;
|
|
@@ -29,29 +29,29 @@ export interface NavOptions {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* engine.nav: navmesh. Usually not called directly; engine.characters.findPath uses it automatically once ready.
|
|
32
|
-
* The mesh comes from the ground API's
|
|
32
|
+
* The mesh comes from the ground API's staticTrimeshes() (the level's walkable mesh);
|
|
33
33
|
* collision boxes / circles (level col_ walls, those added by collision.addBox) all become dynamic obstacles and update automatically when added or removed.
|
|
34
34
|
*/
|
|
35
35
|
export interface Nav {
|
|
36
36
|
/** The navmesh has been generated */
|
|
37
37
|
readonly ready: boolean;
|
|
38
|
-
/** Native Recast NavMesh (null until ready) */
|
|
38
|
+
/** Native Recast NavMesh (null until ready) @experimental */
|
|
39
39
|
navMesh: any;
|
|
40
|
-
/** Native Recast NavMeshQuery */
|
|
40
|
+
/** Native Recast NavMeshQuery @experimental */
|
|
41
41
|
query: any;
|
|
42
|
-
/** Native Recast TileCache (for dynamic obstacles) */
|
|
42
|
+
/** Native Recast TileCache (for dynamic obstacles) @experimental */
|
|
43
43
|
tileCache: any;
|
|
44
|
-
/** Native Recast Crowd (only when crowd: true) */
|
|
44
|
+
/** Native Recast Crowd (only when crowd: true) @experimental */
|
|
45
45
|
crowd: any;
|
|
46
|
-
/** three.js object for the debug display (only when debug: true) */
|
|
46
|
+
/** three.js object for the debug display (only when debug: true) @experimental */
|
|
47
47
|
helper: any;
|
|
48
|
-
/** +1 on rebuild / unload: code that cached native objects (crowd agents etc.) must recreate them when it changes */
|
|
48
|
+
/** +1 on rebuild / unload: code that cached native objects (crowd agents etc.) must recreate them when it changes @experimental */
|
|
49
49
|
readonly version: number;
|
|
50
50
|
/** Path from from to to [{ x, z }…] (meters); null if not ready or unreachable. Usually use engine.characters.findPath */
|
|
51
51
|
findPath(from: PositionLike, to: PositionLike, opts?: { radius?: number; detailed?: false }): XZ[] | null;
|
|
52
52
|
/** Pass detailed: true: returns { status: 'ok' | 'noPath' | 'notReady', path }, telling "unreachable" from "mesh not generated yet" */
|
|
53
53
|
findPath(from: PositionLike, to: PositionLike, opts: { radius?: number; detailed: true }): { status: 'ok' | 'noPath' | 'notReady'; path: XZ[] | null };
|
|
54
|
-
/** Character size actually in effect (from engine.movement, or the override in nav()) */
|
|
54
|
+
/** Character size actually in effect (from engine.movement, or the override in nav()) @experimental */
|
|
55
55
|
readonly agent: { radius: number; height: number; maxClimb: number; maxSlope: number } | null;
|
|
56
56
|
/** Unload the navmesh (frees native objects); characters.findPath then falls back to A* */
|
|
57
57
|
dispose(): void;
|
package/types/physics.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Collision, real physics, camera.
|
|
2
2
|
import type { Object3D, Vector3, DirXZ, Vec3Like, Ease, Handle, PositionLike } from './common';
|
|
3
3
|
import type { Engine, ModuleDef } from './core';
|
|
4
|
-
import type { Input } from './generated/core/Input';
|
|
4
|
+
import type { Input } from './generated/core/input/Input';
|
|
5
5
|
import type { Character } from './gameplay';
|
|
6
6
|
|
|
7
7
|
// ======================================================================
|
|
@@ -13,11 +13,11 @@ export interface CollisionOptions {
|
|
|
13
13
|
maxClimb?: number;
|
|
14
14
|
/** A camera above this height (meters) is not considered blocked by trees, default 5 */
|
|
15
15
|
canopyHeight?: number;
|
|
16
|
-
/** Margin between the camera and obstacles (meters), default 0.5 */
|
|
16
|
+
/** Margin between the camera and obstacles (meters), default 0.5 @experimental */
|
|
17
17
|
cameraPad?: number;
|
|
18
18
|
/** Nearest camera distance (meters), default 1.5 */
|
|
19
19
|
cameraMin?: number;
|
|
20
|
-
/** Height above the water surface (meters) at which it counts as walkable, default 0.2 */
|
|
20
|
+
/** Height above the water surface (meters) at which it counts as walkable, default 0.2 @experimental */
|
|
21
21
|
walkableWaterMargin?: number;
|
|
22
22
|
/** What camera occlusion checks: 'both' (default) | 'colliders' | 'meshes' = static meshes registered with engine.rays.addStatic(mesh, { occluder: true }) */
|
|
23
23
|
cameraOcclusion?: 'colliders' | 'meshes' | 'both';
|
|
@@ -54,18 +54,14 @@ export interface BoxColliderOptions {
|
|
|
54
54
|
|
|
55
55
|
/** engine.collision (lightweight collision: no walking through things, the camera is not blocked). Real physics is a separate module, engine.rigid */
|
|
56
56
|
export interface Collision {
|
|
57
|
-
maxClimb: number;
|
|
58
|
-
canopyHeight: number;
|
|
59
|
-
cameraPad: number;
|
|
60
|
-
cameraMin: number;
|
|
61
|
-
walkableWaterMargin: number;
|
|
62
|
-
/** What camera occlusion checks (see CollisionOptions.cameraOcclusion) */
|
|
57
|
+
/** @experimental */ maxClimb: number;
|
|
58
|
+
/** @experimental */ canopyHeight: number;
|
|
59
|
+
/** @experimental */ cameraPad: number;
|
|
60
|
+
/** @experimental */ cameraMin: number;
|
|
61
|
+
/** @experimental */ walkableWaterMargin: number;
|
|
62
|
+
/** What camera occlusion checks (see CollisionOptions.cameraOcclusion) @experimental */
|
|
63
63
|
cameraOcclusion: 'colliders' | 'meshes' | 'both';
|
|
64
|
-
/**
|
|
65
|
-
circles: Set<CircleCollider>;
|
|
66
|
-
/** Box colliders added by hand */
|
|
67
|
-
boxes: Set<BoxCollider>;
|
|
68
|
-
/** +1 each time a static collider is added or removed */
|
|
64
|
+
/** +1 each time a static collider is added or removed @experimental */
|
|
69
65
|
version: number;
|
|
70
66
|
/** Add a circle collider (pillar, campfire): position is the center, e.g. addCircle(mesh, { radius: 1 }). Returns a handle { remove() } */
|
|
71
67
|
addCircle(position: PositionLike, opts?: CircleColliderOptions): Handle;
|
|
@@ -75,13 +71,13 @@ export interface Collision {
|
|
|
75
71
|
addSegment(a: PositionLike, b: PositionLike, opts?: { thickness?: number; height?: number; y?: number; occluder?: boolean }): Handle;
|
|
76
72
|
/** Mark ground impassable where fn(x, z) is true (river, lava); fn must be pure (no side effects, same answer for the same (x, z)); reading engine.ground in it is fine. findPathAsync caches the answers, so after the ground or your own state changes, remove() and add the field again. bounds { minX, maxX, minZ, maxZ } (world metres, the field's x / z extent) skips fn outside it; give it to keep findPathAsync's ground sampling cheap. Returns a handle { remove() } */
|
|
77
73
|
addBlocked(fn: (x: number, z: number) => boolean, opts?: { bounds?: { minX: number; maxX: number; minZ: number; maxZ: number } }): Handle;
|
|
78
|
-
/** Is a character of this radius touching addBlocked ground at (x, z) */
|
|
74
|
+
/** Is a character of this radius touching addBlocked ground at (x, z) @experimental */
|
|
79
75
|
blockedAt(x: number, z: number, radius?: number): boolean;
|
|
80
76
|
/** Add a collider from an object's bounding box, pad expands outward (meters), occluder as in addBox. Returns a handle { remove() } */
|
|
81
77
|
addObject(obj: Object3D, opts?: { pad?: number; occluder?: boolean }): Handle;
|
|
82
|
-
/** Iterate all static colliders added by hand */
|
|
78
|
+
/** Iterate all static colliders added by hand @experimental */
|
|
83
79
|
forEachStatic(fn: (type: 'box' | 'circle', data: any) => void): void;
|
|
84
|
-
/** Keep an outside copy of the static colliders in step (physics colliders, navmesh obstacles): add builds one piece, remove drops one; sync() diffs only when colliders changed and returns whether it compared; clear() forgets every piece without remove (the outside world was thrown away) */
|
|
80
|
+
/** Keep an outside copy of the static colliders in step (physics colliders, navmesh obstacles): add builds one piece, remove drops one; sync() diffs only when colliders changed and returns whether it compared; clear() forgets every piece without remove (the outside world was thrown away) @experimental */
|
|
85
81
|
mirror<P>(fns: { add(type: 'box' | 'circle', data: any): P; remove(piece: P, data: any): void }): { sync(): boolean; clear(): void; readonly size: number };
|
|
86
82
|
/** Whether someone can stand at this position (for pathfinding): not in water, not too steep, not inside an obstacle. radius is the character radius (meters, default engine.movement.radius) */
|
|
87
83
|
walkable(position: PositionLike, opts?: { radius?: number }): boolean;
|
|
@@ -98,23 +94,23 @@ export interface Collision {
|
|
|
98
94
|
export interface RigidOptions {
|
|
99
95
|
/** Gravity (m/s², negative points down), default -9.81 */
|
|
100
96
|
gravity?: number;
|
|
101
|
-
/** How many rings of chunks around the player get terrain colliders, default 1 */
|
|
97
|
+
/** How many rings of chunks around the player get terrain colliders, default 1. A body outside them freezes until the player comes near (entry.enabled false, describe().rigid.frozen), because it would fall through the ground: raise this for a car or ball that must keep moving far away */
|
|
102
98
|
terrainRing?: number;
|
|
103
99
|
/** Whether there is buoyancy, default true */
|
|
104
100
|
buoyancy?: boolean;
|
|
105
|
-
/** Buoyancy strength (1 = just floats), default 1.6 */
|
|
101
|
+
/** Buoyancy strength (1 = just floats), default 1.6 @experimental */
|
|
106
102
|
buoyancyForce?: number;
|
|
107
|
-
/** Drag in water, default 2.5 */
|
|
103
|
+
/** Drag in water, default 2.5 @experimental */
|
|
108
104
|
waterDrag?: number;
|
|
109
|
-
/** Buoyancy "waterline": an object starts floating when its center is this many meters below the water surface, default 0.3 */
|
|
105
|
+
/** Buoyancy "waterline": an object starts floating when its center is this many meters below the water surface, default 0.3 @experimental */
|
|
110
106
|
floatLine?: number;
|
|
111
|
-
/** Buoyancy reaches its maximum this many meters further down, default 0.8 */
|
|
107
|
+
/** Buoyancy reaches its maximum this many meters further down, default 0.8 @experimental */
|
|
112
108
|
floatDepth?: number;
|
|
113
|
-
/** Height (meters) of vegetation collision pillars (tree trunks), default 6 */
|
|
109
|
+
/** Height (meters) of vegetation collision pillars (tree trunks), default 6 @experimental */
|
|
114
110
|
treeColliderHeight?: number;
|
|
115
|
-
/** Trunks get collision cylinders only in chunks within this many meters of the player or a moving rigid body (the rest are covered by engine.collision for characters), default 16 */
|
|
111
|
+
/** Trunks get collision cylinders only in chunks within this many meters of the player or a moving rigid body (the rest are covered by engine.collision for characters), default 16 @experimental */
|
|
116
112
|
treeRadius?: number;
|
|
117
|
-
/** Player capsule size (meters), default computed from engine.movement radius / height */
|
|
113
|
+
/** Player capsule size (meters), default computed from engine.movement radius / height @experimental */
|
|
118
114
|
playerCapsule?: { halfHeight: number; radius: number };
|
|
119
115
|
}
|
|
120
116
|
/** Parameters for adding a physics body */
|
|
@@ -154,9 +150,9 @@ export interface RigidEntry extends Handle {
|
|
|
154
150
|
collider: any;
|
|
155
151
|
/** The matching three.js model (position is written by physics every step) */
|
|
156
152
|
mesh: Object3D;
|
|
157
|
-
/** Same as mesh
|
|
153
|
+
/** Same as mesh */
|
|
158
154
|
object: Object3D;
|
|
159
|
-
/** Whether it is being simulated
|
|
155
|
+
/** Whether it is being simulated: false while it is outside the terrain colliders (rigid({ terrainRing })), where it would fall through the ground */
|
|
160
156
|
enabled: boolean;
|
|
161
157
|
/** Volume (cubic meters, used for buoyancy) */
|
|
162
158
|
volume: number;
|
|
@@ -167,6 +163,30 @@ export interface RigidEntry extends Handle {
|
|
|
167
163
|
remove(): void;
|
|
168
164
|
}
|
|
169
165
|
|
|
166
|
+
/** Options of engine.rigid.ragdoll @experimental */
|
|
167
|
+
export interface RagdollOptions {
|
|
168
|
+
/** A push (kg*m/s) on the part nearest position, else on hips. A hit stronger than the part can take spreads to the whole body, total momentum unchanged */
|
|
169
|
+
impulse?: Vec3Like;
|
|
170
|
+
/** Where the push lands (world) */
|
|
171
|
+
position?: PositionLike;
|
|
172
|
+
/** Part -> bone name or bone, over the auto-detection. Parts: hips, chest, head, upperArmL, lowerArmL, upperArmR, lowerArmR, upperLegL, lowerLegL, upperLegR, lowerLegR */
|
|
173
|
+
bones?: Record<string, string | Object3D>;
|
|
174
|
+
/** Part or kind ('lowerLeg', 'upperArm', 'chest', 'head'...) -> [min, max] radians from the bind pose: bend forward (a knee: backward), side, twist along the bone */
|
|
175
|
+
limits?: Record<string, { bend?: [number, number]; side?: [number, number]; twist?: [number, number] }>;
|
|
176
|
+
/** Whole body, kg (default 70) */
|
|
177
|
+
mass?: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** What engine.rigid.ragdoll returns. remove() gives the character back; safe to call twice @experimental */
|
|
181
|
+
export interface Ragdoll extends Handle {
|
|
182
|
+
/** False once removed (remove(), a load, the character deleted) */
|
|
183
|
+
readonly active: boolean;
|
|
184
|
+
/** Every part is at rest (asleep or frozen). Nothing is written to the bones then, so a game's own bone write stays */
|
|
185
|
+
readonly settled: boolean;
|
|
186
|
+
/** Part name -> its rigid entry: entry.body for forces, entry.object is the bone; engine.raycast hits carry the same entry. The bones stay plain three.js */
|
|
187
|
+
readonly parts: Record<string, RigidEntry>;
|
|
188
|
+
}
|
|
189
|
+
|
|
170
190
|
/** engine.rigid (real physics; bodies can only be added after start(), or in the engine:ready event) */
|
|
171
191
|
export interface RigidBodies {
|
|
172
192
|
/** Is the physics engine ready (downloaded and initialized at start()) */
|
|
@@ -174,33 +194,41 @@ export interface RigidBodies {
|
|
|
174
194
|
/** All physics bodies */
|
|
175
195
|
bodies: RigidEntry[];
|
|
176
196
|
gravity: number;
|
|
177
|
-
terrainRing: number;
|
|
178
|
-
buoyancy: boolean;
|
|
179
|
-
buoyancyForce: number;
|
|
180
|
-
waterDrag: number;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
/**
|
|
197
|
+
/** @experimental */ terrainRing: number;
|
|
198
|
+
/** @experimental */ buoyancy: boolean;
|
|
199
|
+
/** @experimental */ buoyancyForce: number;
|
|
200
|
+
/** @experimental */ waterDrag: number;
|
|
201
|
+
/** @experimental */ floatLine: number;
|
|
202
|
+
/** @experimental */ floatDepth: number;
|
|
203
|
+
/** @experimental */ treeColliderHeight: number;
|
|
204
|
+
/** @experimental */ treeRadius: number;
|
|
205
|
+
/** The Rapier library itself: its shape follows the Rapier version @experimental */
|
|
206
|
+
rapier: any;
|
|
207
|
+
/** The Rapier world: its shape follows the Rapier version @experimental */
|
|
185
208
|
world: any;
|
|
186
209
|
/** Add a box (crate). Physics is ready after engine.start() (or on engine:ready): called before, it throws in development, a release build warns once and returns null */
|
|
187
210
|
addBox(mesh: Object3D, opts?: RigidBoxOptions): RigidEntry | null;
|
|
188
|
-
/** Add a ball */
|
|
211
|
+
/** Add a ball; null only as in addBox: a release build, called before physics is ready @experimental */
|
|
189
212
|
addBall(mesh: Object3D, opts?: RigidBallOptions): RigidEntry | null;
|
|
190
|
-
/** Add a convex hull (irregular objects such as rocks and barrels) */
|
|
213
|
+
/** Add a convex hull (irregular objects such as rocks and barrels); null only as in addBox: a release build, called before physics is ready @experimental */
|
|
191
214
|
addHull(mesh: Object3D, opts?: RigidBodyOptions): RigidEntry | null;
|
|
215
|
+
/**
|
|
216
|
+
* Turn a skinned character limp in one call; rd.remove() returns it to animation. who: a Character, an NPC handle, a character id or a skinned Object3D.
|
|
217
|
+
* Its mover, animator, capsule and camera yield until then; calling again on the same one pushes it again and returns the same ragdoll.
|
|
218
|
+
* Not saved: any load ends it. A skeleton it cannot read throws, naming the missing parts. @experimental
|
|
219
|
+
*/
|
|
220
|
+
ragdoll(who: any, opts?: RagdollOptions): Ragdoll | null;
|
|
192
221
|
/** Give it a push: impulse vector impulse (Vector3 / [x, y, z] / { x, y, z }), e.g. impulse(ball, [0, 3, 5]) */
|
|
193
222
|
impulse(entry: RigidEntry, impulse: Vec3Like): void;
|
|
194
223
|
/** Teleport to position (velocity is zeroed) */
|
|
195
224
|
setPosition(entry: RigidEntry, position: PositionLike): void;
|
|
196
|
-
/** The player's Rapier kinematic body and capsule collider (follow the player position every step; used for collision when mover: 'rapier'; the capsule is off while driving) */
|
|
225
|
+
/** The player's Rapier kinematic body and capsule collider (follow the player position every step; used for collision when mover: 'rapier'; the capsule is off while driving) @experimental */
|
|
197
226
|
playerBody: any;
|
|
227
|
+
/** The capsule collider on playerBody @experimental */
|
|
198
228
|
playerCollider: any;
|
|
199
|
-
/** Player capsule size (meters) */
|
|
229
|
+
/** Player capsule size (meters) @experimental */
|
|
200
230
|
playerCapsule: { halfHeight: number; radius: number };
|
|
201
|
-
/**
|
|
202
|
-
groundReady(position: PositionLike): boolean;
|
|
203
|
-
/** All vehicles */
|
|
231
|
+
/** All vehicles @experimental */
|
|
204
232
|
vehicles: Vehicle[];
|
|
205
233
|
/**
|
|
206
234
|
* Turn a model into a wheeled vehicle (Rapier ray-cast vehicle controller: cars, karts, carts); remove it with vehicle.remove() (anyone inside gets out
|
|
@@ -421,7 +449,7 @@ export interface FollowCameraOptions {
|
|
|
421
449
|
size?: number;
|
|
422
450
|
/** Which side of the focus the camera sits on (radians), default 0.8: camera = focus + (sin yaw, cos yaw) × distance, it looks along forward() = -(sin yaw, cos yaw). Behind a character facing f: yaw = f + PI */
|
|
423
451
|
yaw?: number;
|
|
424
|
-
/** Pitch angle (radians), default 0.42 */
|
|
452
|
+
/** Pitch angle (radians), default 0.42. Positive = camera above the look point, looking down: the opposite of firstPersonCamera's pitch */
|
|
425
453
|
pitch?: number;
|
|
426
454
|
/** Distance (meters), default 13 */
|
|
427
455
|
distance?: number;
|
|
@@ -430,18 +458,18 @@ export interface FollowCameraOptions {
|
|
|
430
458
|
maxDistance?: number;
|
|
431
459
|
/** How high above the character to look at (meters), default 1.4 */
|
|
432
460
|
height?: number;
|
|
433
|
-
/** Follow smoothing, default 10 */
|
|
461
|
+
/** Follow smoothing, default 10 @experimental */
|
|
434
462
|
smoothing?: number;
|
|
435
463
|
/** Drag sensitivity, default 1 */
|
|
436
464
|
sensitivity?: number;
|
|
437
465
|
/** Pitch range (radians) */
|
|
438
466
|
minPitch?: number;
|
|
439
|
-
maxPitch?: number;
|
|
440
|
-
/** Zoom ratio per wheel notch, default 0.1 */
|
|
467
|
+
/** @experimental */ maxPitch?: number;
|
|
468
|
+
/** Zoom ratio per wheel notch, default 0.1 @experimental */
|
|
441
469
|
zoomStep?: number;
|
|
442
|
-
/** Minimum camera height above the ground (meters), default 1.2 */
|
|
470
|
+
/** Minimum camera height above the ground (meters), default 1.2 @experimental */
|
|
443
471
|
groundClearance?: number;
|
|
444
|
-
/** Invert vertical */
|
|
472
|
+
/** Invert vertical @experimental */
|
|
445
473
|
invertY?: boolean;
|
|
446
474
|
/** Lock the pitch angle (top-down games) */
|
|
447
475
|
lockPitch?: boolean;
|
|
@@ -521,9 +549,9 @@ export interface FirstPersonCameraOptions {
|
|
|
521
549
|
fov?: number | null;
|
|
522
550
|
/** Walking bob amplitude (meters), 0 off, default 0.04 */
|
|
523
551
|
headBob?: number;
|
|
524
|
-
/** Bobs per meter */
|
|
552
|
+
/** Bobs per meter @experimental */
|
|
525
553
|
bobFrequency?: number;
|
|
526
|
-
/** Hide the character itself (its shadow remains), default true */
|
|
554
|
+
/** Hide the character itself (its shadow remains), default true @experimental */
|
|
527
555
|
hideTarget?: boolean;
|
|
528
556
|
/** Layer number used for hiding 0–31 */
|
|
529
557
|
hideLayer?: number;
|
|
@@ -533,15 +561,16 @@ export interface FirstPersonCameraOptions {
|
|
|
533
561
|
swallowLockClick?: boolean;
|
|
534
562
|
/** Initial heading (radians) */
|
|
535
563
|
yaw?: number;
|
|
564
|
+
/** Initial look angle (radians), default 0 = level. Positive looks up, negative down: the opposite of followCamera's pitch */
|
|
536
565
|
pitch?: number;
|
|
537
|
-
/** Look down / up limit (radians) */
|
|
566
|
+
/** Look down / up limit (radians), default -1.45 / 1.45 */
|
|
538
567
|
minPitch?: number;
|
|
539
|
-
maxPitch?: number;
|
|
540
|
-
/** Turn range left / right [min, max] (radians), unlimited by default */
|
|
568
|
+
/** @experimental */ maxPitch?: number;
|
|
569
|
+
/** Turn range left / right [min, max] (radians), unlimited by default @experimental */
|
|
541
570
|
yawLimits?: number[] | null;
|
|
542
|
-
/** Smoothing of the camera following the body */
|
|
571
|
+
/** Smoothing of the camera following the body @experimental */
|
|
543
572
|
smoothing?: number;
|
|
544
|
-
/** Invert vertical */
|
|
573
|
+
/** Invert vertical @experimental */
|
|
545
574
|
invertY?: boolean;
|
|
546
575
|
}
|
|
547
576
|
/** First-person camera */
|
|
@@ -579,24 +608,24 @@ export interface FixedCameraOptions extends Partial<CameraShot> {
|
|
|
579
608
|
start?: string | null;
|
|
580
609
|
/** Automatic switching: false | 'nearest' (pick the one nearest to the player) */
|
|
581
610
|
auto?: false | 'nearest';
|
|
582
|
-
/** Check interval for automatic switching (seconds) */
|
|
611
|
+
/** Check interval for automatic switching (seconds) @experimental */
|
|
583
612
|
autoInterval?: number;
|
|
584
613
|
/** How many meters closer a new shot must be to switch (prevents flipping back and forth) */
|
|
585
614
|
hysteresis?: number;
|
|
586
|
-
/** Transition seconds for trigger-zone switches (0 = hard cut) */
|
|
615
|
+
/** Transition seconds for trigger-zone switches (0 = hard cut) @experimental */
|
|
587
616
|
triggerBlend?: number;
|
|
588
|
-
/** How high above the character a track shot looks (meters) */
|
|
617
|
+
/** How high above the character a track shot looks (meters) @experimental */
|
|
589
618
|
trackHeight?: number;
|
|
590
|
-
/** Head-follow smoothing */
|
|
619
|
+
/** Head-follow smoothing @experimental */
|
|
591
620
|
trackSmoothing?: number;
|
|
592
|
-
/** Keep the direction when switching shots until the direction key is released */
|
|
621
|
+
/** Keep the direction when switching shots until the direction key is released @experimental */
|
|
593
622
|
holdDirection?: boolean;
|
|
594
623
|
/** Transition easing */
|
|
595
624
|
ease?: Ease;
|
|
596
625
|
}
|
|
597
626
|
/** Fixed-shot camera */
|
|
598
627
|
export interface FixedCamera extends CameraRigBase {
|
|
599
|
-
/** All shots */
|
|
628
|
+
/** All shots. A shot stays where it was placed: for a view that pans at a fixed angle use followCamera({ mouseLook: false }) (recipe 21 section 6) */
|
|
600
629
|
shots: Record<string, any>;
|
|
601
630
|
/** Current shot name */
|
|
602
631
|
current: string | null;
|
|
@@ -625,30 +654,30 @@ export interface RtsCameraOptions {
|
|
|
625
654
|
minHeight?: number;
|
|
626
655
|
maxHeight?: number;
|
|
627
656
|
/** Pitch down angle (radians, π/2 = straight down), default 0.95 */
|
|
628
|
-
|
|
657
|
+
pitch?: number;
|
|
629
658
|
/** Initial horizontal heading (radians) */
|
|
630
659
|
yaw?: number;
|
|
631
|
-
/** Pan speed multiplier */
|
|
660
|
+
/** Pan speed multiplier @experimental */
|
|
632
661
|
panSpeed?: number;
|
|
633
|
-
/** Drag with the mouse to pan, default true */
|
|
662
|
+
/** Drag with the mouse to pan, default true @experimental */
|
|
634
663
|
dragPan?: boolean;
|
|
635
|
-
/** Pan at the screen edge, default false */
|
|
664
|
+
/** Pan at the screen edge, default false @experimental */
|
|
636
665
|
edgePan?: boolean;
|
|
637
|
-
/** Edge width (fraction of the screen) */
|
|
666
|
+
/** Edge width (fraction of the screen) @experimental */
|
|
638
667
|
edgeSize?: number;
|
|
639
668
|
/** Focus range (meters) */
|
|
640
669
|
bounds?: { minX?: number; maxX?: number; minZ?: number; maxZ?: number } | null;
|
|
641
670
|
/** false: no turning. Default true: declares the actions rotateLeft / rotateRight (no keys; presets.bindings.rtsRotate binds Q / R) */
|
|
642
671
|
rotate?: boolean;
|
|
643
|
-
/** Rotation speed (radians/second) */
|
|
672
|
+
/** Rotation speed (radians/second) @experimental */
|
|
644
673
|
rotateSpeed?: number;
|
|
645
|
-
/** Zoom ratio per wheel notch */
|
|
674
|
+
/** Zoom ratio per wheel notch @experimental */
|
|
646
675
|
zoomStep?: number;
|
|
647
|
-
/** Smoothing */
|
|
676
|
+
/** Smoothing @experimental */
|
|
648
677
|
smoothing?: number;
|
|
649
678
|
/** Field of view (degrees); unchanged if omitted */
|
|
650
679
|
fov?: number | null;
|
|
651
|
-
/** Manual panning is not allowed while following */
|
|
680
|
+
/** Manual panning is not allowed while following @experimental */
|
|
652
681
|
followLock?: boolean;
|
|
653
682
|
/** Initial focus (position) */
|
|
654
683
|
start?: PositionLike | null;
|