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,16 +1,16 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Batching.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
-
/** engine.batching: draws repeated static models as InstancedMesh batches (see the top of core/Batching.js). */
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/stream/Batching.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.batching: draws repeated static models as InstancedMesh batches (see the top of core/stream/Batching.js). */
|
|
3
3
|
export class Batching {
|
|
4
|
-
/** Same model at least this many times in one cell becomes a batch (default 8) @type {number} */
|
|
4
|
+
/** Same model at least this many times in one cell becomes a batch (default 8) @type {number} @experimental */
|
|
5
5
|
minCount: number;
|
|
6
|
-
/** Geometries and materials a live batch draws (engine.remove does not dispose these) @type {Map<any, number>} */ held: Map<any, number>;
|
|
6
|
+
/** Geometries and materials a live batch draws (engine.remove does not dispose these) @type {Map<any, number>} @experimental */ held: Map<any, number>;
|
|
7
7
|
/** Parent of every batch InstancedMesh (in the scene) @type {THREE.Group} */
|
|
8
8
|
root: THREE.Group;
|
|
9
9
|
set enabled(on: boolean);
|
|
10
10
|
/** Global switch: false dissolves every batch and stops watching; true starts again (scans what is already in the scene) @type {boolean} */
|
|
11
11
|
get enabled(): boolean;
|
|
12
12
|
set cell(v: number);
|
|
13
|
-
/** Cell edge in meters (default engine.stream
|
|
13
|
+
/** Cell edge in meters (default four engine.stream cells, 256 m) @type {number} */
|
|
14
14
|
get cell(): number;
|
|
15
15
|
/** Every batch: { mesh: InstancedMesh, cell, count, items } (items[i] is the placed object drawn by instance i) @returns {BatchInfo[]} */
|
|
16
16
|
get batches(): BatchInfo[];
|
|
@@ -47,5 +47,5 @@ export class Batching {
|
|
|
47
47
|
refresh(obj: THREE.Object3D): void;
|
|
48
48
|
}
|
|
49
49
|
import * as THREE from 'three';
|
|
50
|
-
import type { BatchInfo } from '
|
|
51
|
-
import type { BatchingStats } from '
|
|
50
|
+
import type { BatchInfo } from '../../../core';
|
|
51
|
+
import type { BatchingStats } from '../../../core';
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Stream.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/stream/Stream.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.stream builds on demand by space: only entries near the focus get built. */
|
|
3
3
|
export class Stream {
|
|
4
|
-
/**
|
|
5
|
-
* Build radius in meters around each full-detail stream source (a source radius caps it); null = follow the terrain view distance (the fog distance
|
|
6
|
-
* the fog distance without terrain) @type {number | null}
|
|
7
|
-
*/
|
|
8
|
-
radius: number | null;
|
|
9
4
|
/** Grid cell edge in meters, shared with hlod, default 64 */
|
|
10
5
|
cellSize: number;
|
|
11
|
-
/** Unload only beyond radius x this (walking back and forth does not rebuild), default 1.25 */
|
|
6
|
+
/** Unload only beyond radius x this (walking back and forth does not rebuild), default 1.25 @experimental */
|
|
12
7
|
unloadFactor: number;
|
|
13
|
-
/** Built-in source at the
|
|
8
|
+
/** Built-in source at the player (engine.focus without one): full detail and physics @type {StreamSource} */
|
|
14
9
|
player: StreamSource;
|
|
15
10
|
/** Built-in source at the camera focus engine.focus: full detail, no physics @type {StreamSource} */
|
|
16
11
|
camera: StreamSource;
|
|
17
|
-
/** The build radius actually in use, in meters @returns {number} */
|
|
12
|
+
/** The build radius actually in use, in meters @returns {number} @experimental */
|
|
18
13
|
get activeRadius(): number;
|
|
19
14
|
/**
|
|
20
15
|
* Register something to stream in (not built at once); an object returned by build with no parent is added to the scene automatically.
|
|
@@ -23,7 +18,14 @@ export class Stream {
|
|
|
23
18
|
* @example engine.stream.add({ position: [40, 0, 12], radius: 6, build: () => makeHouse() });
|
|
24
19
|
*/
|
|
25
20
|
add(def: StreamEntryOptions): StreamHandle;
|
|
26
|
-
|
|
21
|
+
set radius(m: number | null);
|
|
22
|
+
/**
|
|
23
|
+
* Build radius in meters around each full-detail stream source (a source radius caps it); null = follow the terrain view distance (the uViewDistance signal
|
|
24
|
+
* without terrain). Writing it takes effect like setRadius.
|
|
25
|
+
* @type {number | null}
|
|
26
|
+
*/
|
|
27
|
+
get radius(): number | null;
|
|
28
|
+
/** Set the build radius in meters @param {number} m @experimental */
|
|
27
29
|
setRadius(m: number): void;
|
|
28
30
|
/** Everything registered within radius is built (start() waits for it before the loading screen goes away) @returns {boolean} */
|
|
29
31
|
get ready(): boolean;
|
|
@@ -67,13 +69,13 @@ export class Stream {
|
|
|
67
69
|
/**
|
|
68
70
|
* Register a readiness check for loaders: fn(source) returns whether this loader finished what that source asks for.
|
|
69
71
|
* For module authors whose loader reads stream sources; games only read source.ready.
|
|
70
|
-
* @example engine.stream.
|
|
72
|
+
* @example engine.stream.addReadyCheck('props', s => s.detail !== 'full' || props.queued === 0)
|
|
71
73
|
* @param {string} name
|
|
72
74
|
* @param {(source: StreamSource) => boolean} fn
|
|
73
75
|
* @returns {{ remove(): void }}
|
|
74
76
|
* @experimental
|
|
75
77
|
*/
|
|
76
|
-
|
|
78
|
+
addReadyCheck(name: string, fn: (source: StreamSource) => boolean): {
|
|
77
79
|
remove(): void;
|
|
78
80
|
};
|
|
79
81
|
/**
|
|
@@ -87,7 +89,7 @@ export class Stream {
|
|
|
87
89
|
physics?: boolean;
|
|
88
90
|
}): StreamSource[];
|
|
89
91
|
}
|
|
90
|
-
import type { StreamSource } from '
|
|
91
|
-
import type { StreamEntryOptions } from '
|
|
92
|
-
import type { StreamHandle } from '
|
|
93
|
-
import type { StreamSourceOptions } from '
|
|
92
|
+
import type { StreamSource } from '../../../core';
|
|
93
|
+
import type { StreamEntryOptions } from '../../../core';
|
|
94
|
+
import type { StreamHandle } from '../../../core';
|
|
95
|
+
import type { StreamSourceOptions } from '../../../core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Commits.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/threads/Commits.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
export class Commits {
|
|
3
3
|
/** Default delay (fixed steps); 30 = 0.5 s */
|
|
4
4
|
lag: number;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Jobs.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/threads/Jobs.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/**
|
|
3
3
|
* engine.jobs queues build work in a binary heap (higher priority first, FIFO within a priority).
|
|
4
4
|
* In the real-time loop each frame spends at most budgetMs; engine.step() and headless loading ignore real time and drain the queue each frame (reproducible results).
|
|
5
5
|
*/
|
|
6
6
|
export class Jobs {
|
|
7
|
-
/** Milliseconds allowed per frame, default 3 */
|
|
7
|
+
/** Milliseconds allowed per frame, default 3 @experimental */
|
|
8
8
|
budgetMs: number;
|
|
9
|
-
/** Milliseconds allowed per frame while the loading screen is up, default 12 */
|
|
9
|
+
/** Milliseconds allowed per frame while the loading screen is up, default 12 @experimental */
|
|
10
10
|
loadingMs: number;
|
|
11
|
-
/** Max steps per deterministic run (stops jobs that keep adding jobs from hanging), default 100000 */
|
|
11
|
+
/** Max steps per deterministic run (stops jobs that keep adding jobs from hanging), default 100000 @experimental */
|
|
12
12
|
maxSteps: number;
|
|
13
|
-
/** A step slower than this many ms warns in dev (default 8) */
|
|
13
|
+
/** A step slower than this many ms warns in dev (default 8) @experimental */
|
|
14
14
|
slowStepMs: number;
|
|
15
|
-
/** Number of jobs not yet finished @returns {number} */
|
|
15
|
+
/** Number of jobs not yet finished @returns {number} @experimental */
|
|
16
16
|
get pending(): number;
|
|
17
17
|
/**
|
|
18
18
|
* Add a job: a plain function runs in one go, a generator may pause at each yield until the next frame; higher priority runs first; returns the job's result.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Threads.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/threads/Threads.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/**
|
|
3
3
|
* engine.threads: worker pool behind createEngine({ threads }). Lanes start their workers lazily; size 0 means everything runs on the main thread.
|
|
4
4
|
* @experimental
|
|
@@ -9,13 +9,13 @@ export class Threads {
|
|
|
9
9
|
/** True when SharedArrayBuffer can be shared with workers (page is cross-origin isolated) */
|
|
10
10
|
shared: boolean;
|
|
11
11
|
/**
|
|
12
|
-
* A lane of workers running one script. create must contain the literal new Worker(new URL('
|
|
12
|
+
* A lane of workers running one script. create must contain the literal new Worker(new URL('../file.js', import.meta.url), { type: 'module' }) so bundlers find the file.
|
|
13
13
|
* local builds the same handler on the main thread (used when there are no workers).
|
|
14
14
|
* timeout (ms, default 20000, 0 = never): a busy worker silent that long counts as crashed and its open tasks finish on the main thread (one warning, code threads-crash).
|
|
15
15
|
* @param {{ create: () => Worker, local: () => (msg: any) => any, max?: number, timeout?: number }} opts
|
|
16
16
|
* @returns {Lane}
|
|
17
17
|
* @example
|
|
18
|
-
* const lane = engine.threads.lane({ create: () => new Worker(new URL('
|
|
18
|
+
* const lane = engine.threads.lane({ create: () => new Worker(new URL('../chunkWorker.js', import.meta.url), { type: 'module' }), local: chunkHandler });
|
|
19
19
|
* lane.run({ cx: 0, cz: 0 }).then(r => engine.commits ...);
|
|
20
20
|
*/
|
|
21
21
|
lane(opts: {
|
|
@@ -35,7 +35,7 @@ export class Threads {
|
|
|
35
35
|
array<T extends Float32ArrayConstructor | Int32ArrayConstructor | Uint8ArrayConstructor | Uint16ArrayConstructor | Float64ArrayConstructor>(Type: T, length: number): InstanceType<T>;
|
|
36
36
|
/**
|
|
37
37
|
* Turn a self-contained function into one that can run in a worker. It is recompiled from its source text, so it sees only its parameters and globals like Math:
|
|
38
|
-
* a closure variable fails with a
|
|
38
|
+
* a closure variable fails here with a pure-function error naming it (threads on or off behave the same). Used by world.simulate(kind, { far, worker: true }).
|
|
39
39
|
* @param {Function} fn
|
|
40
40
|
* @param {string} label where it came from, used in error messages
|
|
41
41
|
* @returns {{ fn: Function, src: string, label: string }}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/calendar/Calendar.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.calendar */
|
|
3
3
|
export class Calendar {
|
|
4
|
-
/** Hours per day (clock notation 'HH:MM', schedules, at / between) @type {number} */
|
|
4
|
+
/** Hours per day (clock notation 'HH:MM', schedules, at / between) @type {number} @experimental */
|
|
5
5
|
hoursPerDay: number;
|
|
6
|
-
/**
|
|
7
|
-
daysPerSeason: number;
|
|
8
|
-
/** Season names, [] when the game has no seasons (the default) @type {string[]} */
|
|
6
|
+
/** Season names, [] when the game has no seasons (the default) @type {string[]} @experimental */
|
|
9
7
|
seasons: string[];
|
|
10
8
|
set timeOfDay(v: number);
|
|
11
9
|
/**
|
|
12
|
-
* Time of day: 0-1 (0 midnight, 0.25 6am, 0.5 noon, 0.75 6pm); one day = dayLength
|
|
10
|
+
* Time of day: 0-1 (0 midnight, 0.25 6am, 0.5 noon, 0.75 6pm); one day = dayLength calendar seconds (the unit of engine.clock.now). Writing it later
|
|
13
11
|
* in the day counts as time passing (at timers crossed fire); writing it earlier only resets the timers' baseline @type {number}
|
|
14
12
|
*/
|
|
15
13
|
get timeOfDay(): number;
|
|
@@ -18,7 +16,7 @@ export class Calendar {
|
|
|
18
16
|
get day(): number;
|
|
19
17
|
set dayLength(v: number);
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
19
|
+
* Calendar seconds per day (1 hour = dayLength / hoursPerDay calendar seconds; at clock.rate 1 calendar seconds equal real seconds); Infinity = the time of
|
|
22
20
|
* day never moves. Changing it keeps the current time of day @type {number}
|
|
23
21
|
*/
|
|
24
22
|
get dayLength(): number;
|
|
@@ -28,15 +26,15 @@ export class Calendar {
|
|
|
28
26
|
get daylight(): number;
|
|
29
27
|
/** Whether it is daytime by the clock (06:00-18:00 of the day's hours) */
|
|
30
28
|
get isDay(): boolean;
|
|
31
|
-
/** Current season index, -1 without seasons */
|
|
29
|
+
/** Current season index, -1 without seasons @experimental */
|
|
32
30
|
get seasonIndex(): number;
|
|
33
31
|
/** Current season name, e.g. 'spring'; null without seasons @type {string | null} */
|
|
34
32
|
get season(): string | null;
|
|
35
|
-
/** Day within the season (1-based); 0 without seasons */
|
|
33
|
+
/** Day within the season (1-based); 0 without seasons @experimental */
|
|
36
34
|
get dayOfSeason(): number;
|
|
37
|
-
/** Fraction of the season elapsed, 0-1 (includes time of day); 0 without seasons */
|
|
35
|
+
/** Fraction of the season elapsed, 0-1 (includes time of day); 0 without seasons @experimental */
|
|
38
36
|
get seasonProgress(): number;
|
|
39
|
-
/** Total game time in days (fractional), for growth, cooldowns and the like */
|
|
37
|
+
/** Total game time in days (fractional), for growth, cooldowns and the like @experimental */
|
|
40
38
|
get totalDays(): number;
|
|
41
39
|
/**
|
|
42
40
|
* Call fn every day at a clock time: at('18:00', fn) or at(0.75, fn).
|
|
@@ -74,8 +72,9 @@ export class Calendar {
|
|
|
74
72
|
*/
|
|
75
73
|
onSeason(name: string, fn: (season: string) => void): Handle;
|
|
76
74
|
/**
|
|
77
|
-
*
|
|
75
|
+
* Calendar seconds until the next clock mark (midnight, at times, between edges); engine.skip ends a segment there; Infinity when the time of day never moves
|
|
78
76
|
* @returns {number}
|
|
77
|
+
* @experimental
|
|
79
78
|
*/
|
|
80
79
|
untilMark(): number;
|
|
81
80
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/debug/DebugPanel.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/**
|
|
3
|
-
* Debug panel -> engine.debug.panel: performance panel,
|
|
3
|
+
* Debug panel -> engine.debug.panel: performance panel, time and weather debugging. Collapsed by default; the action 'debugPanel' shows/hides it (presets.bindings.debug: F3); open: true shows it at start. Just do not install it in a release
|
|
4
4
|
* @param {{ open?: boolean }} [opts]
|
|
5
5
|
* @returns {ModuleDef<DebugPanel>}
|
|
6
6
|
*/
|
|
@@ -10,15 +10,7 @@ export function debug(opts?: {
|
|
|
10
10
|
/** @import { ModuleDef } from '../../../core' */
|
|
11
11
|
/** engine.debug.panel (the debug panel) */
|
|
12
12
|
export class DebugPanel {
|
|
13
|
-
/** Stress test running (player auto-runs fast) @type {boolean} */
|
|
14
|
-
benchmarking: boolean;
|
|
15
13
|
/** Panel root element @type {HTMLElement} */
|
|
16
14
|
el: HTMLElement;
|
|
17
|
-
/**
|
|
18
|
-
* Start the stress test (seconds, default 20): the character auto-runs fast, continuously loading new chunks, and a report is shown in the panel at the end
|
|
19
|
-
* @param {number} [seconds]
|
|
20
|
-
* @returns {void}
|
|
21
|
-
*/
|
|
22
|
-
startBench(seconds?: number): void;
|
|
23
15
|
}
|
|
24
16
|
import type { ModuleDef } from '../../../core';
|
|
@@ -60,7 +60,7 @@ export class Layer {
|
|
|
60
60
|
*/
|
|
61
61
|
export type LayerOptions = {
|
|
62
62
|
tiles?: boolean | {
|
|
63
|
-
|
|
63
|
+
color?: (data: Record<string, any>, cell: [number, number]) => any;
|
|
64
64
|
colors?: Record<string, number | string>;
|
|
65
65
|
lift?: number;
|
|
66
66
|
} | ((engine: any, layer: Layer) => {
|
|
@@ -57,11 +57,11 @@ export class Grids {
|
|
|
57
57
|
layers?: Record<string, [number, number, Record<string, any>][]>;
|
|
58
58
|
}): Grid;
|
|
59
59
|
/**
|
|
60
|
-
* A grid by name, or
|
|
60
|
+
* A grid by name, or undefined when there is none
|
|
61
61
|
* @param {string} name
|
|
62
|
-
* @returns {Grid |
|
|
62
|
+
* @returns {Grid | undefined}
|
|
63
63
|
*/
|
|
64
|
-
get(name: string): Grid |
|
|
64
|
+
get(name: string): Grid | undefined;
|
|
65
65
|
/** All grids (a new array) @returns {Grid[]} */
|
|
66
66
|
list(): Grid[];
|
|
67
67
|
/**
|
|
@@ -25,17 +25,19 @@ export class Music {
|
|
|
25
25
|
/** 0-1: how loud each stem of the playing track is (see the stems `at` range); fades in about half a second @type {number} */
|
|
26
26
|
intensity: number;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
30
|
-
* @
|
|
28
|
+
* Define a track: a url, or { url, volume, loop, stems }. The same name again replaces it
|
|
29
|
+
* @example engine.music.define('town', '/music/town.ogg')
|
|
30
|
+
* @param {string} name
|
|
31
|
+
* @param {MusicTrack} track
|
|
32
|
+
* @returns {void}
|
|
31
33
|
*/
|
|
32
|
-
|
|
34
|
+
define(name: string, track: MusicTrack): void;
|
|
33
35
|
/**
|
|
34
36
|
* Whether audio is usable
|
|
35
37
|
* @returns {boolean}
|
|
36
38
|
*/
|
|
37
39
|
get ready(): boolean;
|
|
38
|
-
/** Auto track rules are in use */
|
|
40
|
+
/** Auto track rules are in use @experimental */
|
|
39
41
|
get ruled(): boolean;
|
|
40
42
|
/**
|
|
41
43
|
* State (for debugging and tests): gain is the playing track's fade level, stems each stem's level
|
|
@@ -12,7 +12,7 @@ export function particles(opts?: ParticlesOptions): ModuleDef<Particles>;
|
|
|
12
12
|
/** @import { ParticleEffect, ParticleEmitter, ParticleOptions, ParticlesOptions } from '../../../gameplay' */
|
|
13
13
|
/** engine.particles */
|
|
14
14
|
export class Particles {
|
|
15
|
-
/** Defined effects @type {Map<string, ParticleEffect>} */
|
|
15
|
+
/** Defined effects @type {Map<string, ParticleEffect>} @experimental */
|
|
16
16
|
effects: Map<string, ParticleEffect>;
|
|
17
17
|
/**
|
|
18
18
|
* Define an effect (same name replaces it, and emitters attached to it move to the new definition); params sit on top of particles({ effects,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/sky/Sky.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** @import { Object3D, Vector3 } from '../../../common' */
|
|
3
|
-
/** @import { SkyOptions } from '../../../world' */
|
|
4
|
-
/** @import { Handle } from '../../../common' */
|
|
5
3
|
/** engine.sky */
|
|
6
4
|
export class Sky {
|
|
7
5
|
/**
|
|
@@ -26,10 +24,15 @@ export class Sky {
|
|
|
26
24
|
top: any;
|
|
27
25
|
/** Horizon color over the keyframes, any THREE.Color input (null = the keyframes); read each frame. The color drawn: engine.uniforms.uSkyHorizon @type {any} */
|
|
28
26
|
horizon: any;
|
|
27
|
+
/**
|
|
28
|
+
* The dome's { value } objects, live on both renderers: the built-in ones (the same objects as engine.uniforms where the names match) and the uniforms
|
|
29
|
+
* given to engine.sky.clouds() and engine.sky.layer(), which join here once the call has run @type {Record<string, { value: any }>}
|
|
30
|
+
*/
|
|
31
|
+
uniforms: Record<string, {
|
|
32
|
+
value: any;
|
|
33
|
+
}>;
|
|
29
34
|
/** Dome mesh @type {Object3D} */
|
|
30
35
|
dome: THREE.Object3D;
|
|
31
|
-
/** Sun direction (unit vector toward the sun) @type {Vector3} */
|
|
32
|
-
sunDir: THREE.Vector3;
|
|
33
36
|
/**
|
|
34
37
|
* Sun orbit: tilt = north-south tilt, sway = east-west swing, distance = light distance (meters) @type {{ tilt: number, sway: number, distance: number }}
|
|
35
38
|
*/
|
|
@@ -46,6 +49,13 @@ export class Sky {
|
|
|
46
49
|
* @returns {void}
|
|
47
50
|
*/
|
|
48
51
|
keyframes(rows: any[][]): void;
|
|
52
|
+
set sunDir(v: THREE.Vector3);
|
|
53
|
+
/**
|
|
54
|
+
* Sun direction (unit vector toward the sun): the same vector as engine.uniforms.uSunDir. Computed each frame from the time and orbit until a game writes either,
|
|
55
|
+
* then the value is the game's (the sun at a compass direction of your choice); engine.autoView.manual('sunDir', false) gives it back.
|
|
56
|
+
* @type {Vector3}
|
|
57
|
+
*/
|
|
58
|
+
get sunDir(): THREE.Vector3;
|
|
49
59
|
/**
|
|
50
60
|
* Your own cloud function on the dome: glsl defines `vec4 threedogClouds(vec3 dir, float time, vec3 sunDir, float night, vec3 lit, vec3 shade, float cover)`,
|
|
51
61
|
* tsl is its WebGPURenderer form (ctx) => vec4 node; each renderer needs its own form (modules/sky/clouds.js). null gives the built-in kind back.
|
|
@@ -75,24 +85,25 @@ export class Sky {
|
|
|
75
85
|
blend?: "mix" | "add";
|
|
76
86
|
} | null): void;
|
|
77
87
|
/**
|
|
78
|
-
* Replace or hide the dome: a skybox asset name (equirectangular panorama), a THREE.Texture / CubeTexture, or your own THREE.Object3D sky; null gives the dome back
|
|
88
|
+
* Replace or hide the dome: a skybox asset name (equirectangular panorama), a THREE.Texture / CubeTexture, or your own THREE.Object3D sky; null gives the dome back,
|
|
89
|
+
* false draws no sky (the scene shows its base background, the signals keep running).
|
|
79
90
|
* The engine never writes your object: it hides the dome, adds your object to the scene only when it has no parent, puts a plain texture's panorama
|
|
80
91
|
* mapping on a clone, and keeps feeding engine.uniforms (uSunDir, uWind ...).
|
|
81
92
|
* @example engine.sky.replace(new SkyMesh());
|
|
82
93
|
* @example engine.sky.replace(null);
|
|
83
|
-
* @param {string | import('three').Texture | Object3D | null} sky
|
|
94
|
+
* @param {string | import('three').Texture | Object3D | null | false} sky
|
|
84
95
|
* @returns {void}
|
|
85
96
|
*/
|
|
86
|
-
replace(sky: string | import("three").Texture | THREE.Object3D | null): void;
|
|
97
|
+
replace(sky: string | import("three").Texture | THREE.Object3D | null | false): void;
|
|
87
98
|
set backdrop(v: any);
|
|
88
99
|
/**
|
|
89
100
|
* One flat color in place of the dome, a THREE.Color while on, else null (sky({ backdrop }) starts with one). Set any THREE.Color input, null gives the dome back.
|
|
90
101
|
* @type {any}
|
|
91
102
|
*/
|
|
92
103
|
get backdrop(): any;
|
|
93
|
-
/** Time of day being drawn, 0-1: engine.calendar.timeOfDay, or fixedTime without a calendar. Read-only: the time itself is the calendar's */
|
|
104
|
+
/** Time of day being drawn, 0-1: engine.calendar.timeOfDay, or fixedTime without a calendar. Read-only: the time itself is the calendar's @experimental */
|
|
94
105
|
get drawnTime(): any;
|
|
95
|
-
/** Sun elevation -1 (midnight) ... 0 (horizon) ... 1 (noon) of the drawn sun (the calendar's daylight is the gameplay value) */
|
|
106
|
+
/** Sun elevation -1 (midnight) ... 0 (horizon) ... 1 (noon) of the drawn sun (the calendar's daylight is the gameplay value) @experimental */
|
|
96
107
|
get sunHeight(): number;
|
|
97
108
|
/** Whether the drawn sun is above the horizon (picture functions: ({ sky }) => sky.isDay ? ...; gameplay reads engine.calendar.isDay) */
|
|
98
109
|
get isDay(): boolean;
|
|
@@ -100,7 +111,7 @@ export class Sky {
|
|
|
100
111
|
get daylight(): number;
|
|
101
112
|
/**
|
|
102
113
|
* Render the sky into an environment map. Only after this call is anything built: a PMREM target, rebuilt when the sky changed and interval seconds passed
|
|
103
|
-
* (default 1, 4
|
|
114
|
+
* (default 1, 4 on a low-tier device). With into, that object's .environment gets the map at each rebuild (a map you wrote there yourself stays); without it nothing
|
|
104
115
|
* is written anywhere and you read handle.texture. handle.remove() takes the map off and frees it. One at a time. Intensity and rotation are three.js: scene.environmentIntensity.
|
|
105
116
|
* @example const env = engine.sky.environment({ into: engine.scene });
|
|
106
117
|
* @example env.remove();
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/swarm/Swarm.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* Module: many same-kind gameplay objects in typed arrays, drawn as one InstancedMesh each. After engine.use(swarm()), engine.swarm(options) makes one and returns a Swarm.
|
|
4
|
+
* Bullets, enemy crowds, pickups, debris. See recipes/65-swarm.md
|
|
5
|
+
* @example engine.use(swarm());
|
|
6
|
+
* const coins = engine.swarm({ name: 'coins', capacity: 500, geometry, material, fields: ['yaw'], save: true });
|
|
7
|
+
* @returns {import('../../../core').ModuleDef}
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
export function swarm(): import("../../../core").ModuleDef;
|
|
11
|
+
/** One swarm: what engine.swarm(options) returns. See the top of modules/swarm/Swarm.js for the handle / row rule */
|
|
12
|
+
export class Swarm {
|
|
13
|
+
/** Name given to engine.swarm @type {string} */ name: string;
|
|
14
|
+
/** Most objects alive at once @type {number} */ capacity: number;
|
|
15
|
+
/** Time channel of the onStep dt @type {string} */ channel: string;
|
|
16
|
+
/** Whether this swarm is kept in saves @type {boolean} */ saved: boolean;
|
|
17
|
+
/** Spawns refused because the swarm was full, since it was made @type {number} */ dropped: number;
|
|
18
|
+
/**
|
|
19
|
+
* The columns: data.x[row], data.y[row], data.z[row] (Float32Array), one Float64Array per field, so a field can hold a handle, and data.id[row], the handle of that row (Float64Array).
|
|
20
|
+
* Rows 0 to count - 1 are live. The same object onStep and near pass as d
|
|
21
|
+
* @type {SwarmData}
|
|
22
|
+
*/
|
|
23
|
+
data: SwarmData;
|
|
24
|
+
/** The swarm's plain THREE.InstancedMesh (null when made without geometry and material); instance index = row. castShadow, layers and the rest are yours @type {THREE.InstancedMesh | null} */
|
|
25
|
+
mesh: THREE.InstancedMesh | null;
|
|
26
|
+
/** Objects alive now @type {number} */
|
|
27
|
+
get count(): number;
|
|
28
|
+
/**
|
|
29
|
+
* Add one object. Fields left out start at 0 (scale at 1, colour at white). Returns its handle, or -1 when the swarm is full: the object is not added,
|
|
30
|
+
* dropped goes up, and one [swarm-full] warning is printed. May be called from onStep and near callbacks; an object spawned there first moves in the next step
|
|
31
|
+
* @example const h = bullets.spawn({ x: 0, y: 1, z: 0, vx: 8, life: 2 });
|
|
32
|
+
* @param {Record<string, number>} [o] x, y, z, the fields, and color (a hex colour, with { color: true })
|
|
33
|
+
* @returns {number}
|
|
34
|
+
*/
|
|
35
|
+
spawn(o?: Record<string, number>): number;
|
|
36
|
+
/**
|
|
37
|
+
* Where a handle's object sits now, or -1 if it is gone. A row is good until the next removal outside a callback: read it, use it, drop it
|
|
38
|
+
* @example const i = enemies.row(target); if (i >= 0) aim(enemies.data.x[i], enemies.data.z[i]);
|
|
39
|
+
* @param {number} handle
|
|
40
|
+
* @returns {number}
|
|
41
|
+
*/
|
|
42
|
+
row(handle: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Remove an object by handle: d.id[i] inside a callback. False if it was already gone (safe to call twice; -1 from a full spawn too). A row passed
|
|
45
|
+
* by mistake throws [swarm-handle]. Inside onStep and near the object counts as gone at once (near and row skip it) and rows only move when the walk ends
|
|
46
|
+
* @example enemies.near(x, z, 2, (d, i) => { enemies.free(d.id[i]); });
|
|
47
|
+
* @param {number} handle
|
|
48
|
+
* @returns {boolean}
|
|
49
|
+
*/
|
|
50
|
+
free(handle: number): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Set the one function that moves this swarm: fn(d, i, dt) for each live row, every fixed step, dt on the swarm's channel. Return false to remove the object;
|
|
53
|
+
* anything else keeps it. Returns a handle: h.remove() takes it off. Set it once at setup, not every step (a second one while one is set throws [swarm-step])
|
|
54
|
+
* @example bullets.onStep((d, i, dt) => { d.x[i] += d.vx[i] * dt; return (d.life[i] -= dt) > 0; });
|
|
55
|
+
* @param {SwarmRowFn} fn
|
|
56
|
+
* @returns {{ remove(): void }}
|
|
57
|
+
*/
|
|
58
|
+
onStep(fn: SwarmRowFn): {
|
|
59
|
+
remove(): void;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Visit the live objects within r meters of (x, z), height ignored: cb(d, i, dist2) with the row and the squared distance; cb returning false stops early. Returns
|
|
63
|
+
* how many were visited. The grid is built on the first query after things moved, so a swarm nobody queries pays nothing. Order is the same every run. Inside onStep it stays the
|
|
64
|
+
* grid of that step's first query: distances are exact, but a row that crossed a cell line since then can be missed for one step
|
|
65
|
+
* @example const hit = enemies.near(px, pz, 0.5, (d, i) => { enemies.free(d.id[i]); return false; });
|
|
66
|
+
* @param {number} x
|
|
67
|
+
* @param {number} z
|
|
68
|
+
* @param {number} r
|
|
69
|
+
* @param {(d: SwarmData, i: number, dist2: number) => (boolean | void)} cb
|
|
70
|
+
* @returns {number}
|
|
71
|
+
*/
|
|
72
|
+
near(x: number, z: number, r: number, cb: (d: SwarmData, i: number, dist2: number) => (boolean | void)): number;
|
|
73
|
+
/** Remove every object (their handles die for good). Inside a callback it applies when the walk ends */
|
|
74
|
+
clear(): void;
|
|
75
|
+
/** Remove this swarm: its mesh leaves the scene and its GPU buffers go. Geometry and material stay, they are the game's. The name is free again */
|
|
76
|
+
dispose(): void;
|
|
77
|
+
}
|
|
78
|
+
import type { SwarmData } from '../../../gameplay';
|
|
79
|
+
import type { SwarmRowFn } from '../../../gameplay';
|
|
80
|
+
import * as THREE from 'three';
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
export function timeline(opts?: TimelineOptions): ModuleDef<Timeline>;
|
|
10
10
|
/** engine.timeline */
|
|
11
11
|
export class Timeline {
|
|
12
|
-
/** Skip every cutscene immediately (set by scenario param cutscene=skip) @type {boolean} */
|
|
12
|
+
/** Skip every cutscene immediately (set by scenario param cutscene=skip) @type {boolean} @experimental */
|
|
13
13
|
skipAll: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Whether a cutscene is playing
|
|
16
16
|
* @returns {boolean}
|
|
17
|
+
* @experimental
|
|
17
18
|
*/
|
|
18
19
|
get playing(): boolean;
|
|
19
20
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/weather/Weather.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/**
|
|
3
|
-
* Weather: two modules for one engine.use: the state (engine.weather, type 'world') and its picture (engine.weatherDraw, type 'picture';
|
|
3
|
+
* Weather: two modules for one engine.use: the state (engine.weather, type 'world') and its picture (engine.weatherDraw, type 'picture'; sky optional)
|
|
4
4
|
* @param {WeatherOptions} [opts]
|
|
5
5
|
* @returns {[ModuleDef<Weather>, ModuleDef<import('./weatherDraw.js').WeatherDraw>]}
|
|
6
6
|
* @example engine.use(sky(), weather({ types: presets.weather.temperate.types, start: 'clear' }))
|
|
@@ -17,26 +17,24 @@ export class Weather {
|
|
|
17
17
|
current: WeatherPreset;
|
|
18
18
|
/** Current weather name @type {string} */
|
|
19
19
|
name: string;
|
|
20
|
-
/**
|
|
21
|
-
auto: boolean;
|
|
22
|
-
/** Candidates for automatic weather (repeat a name to make it likelier) @type {string[]} */
|
|
20
|
+
/** Candidates for automatic weather (repeat a name to make it likelier) @type {string[]} @experimental */
|
|
23
21
|
autoPool: string[];
|
|
24
|
-
/** Automatic weather interval [min, max] seconds @type {number[]} */
|
|
22
|
+
/** Automatic weather interval [min, max] seconds @type {number[]} @experimental */
|
|
25
23
|
autoInterval: number[];
|
|
26
|
-
/** Transition seconds for automatic weather @type {number} */
|
|
24
|
+
/** Transition seconds for automatic weather @type {number} @experimental */
|
|
27
25
|
autoTransition: number;
|
|
28
|
-
/** Seconds to the first bolt (also after a load without a saved timer) @type {number} */
|
|
26
|
+
/** Seconds to the first bolt (also after a load without a saved timer) @type {number} @experimental */
|
|
29
27
|
lightningFirst: number;
|
|
30
|
-
/** [min, max] seconds between bolts while a type with lightning > 0.5 holds @type {number[]} */
|
|
28
|
+
/** [min, max] seconds between bolts while a type with lightning > 0.5 holds @type {number[]} @experimental */
|
|
31
29
|
lightningInterval: number[];
|
|
32
|
-
/** Strike picture: flash (1 at the strike, fading in a third of a second) -> sky flash amount. Write it at any time @type {(flash: number, engine: any) => number} */
|
|
30
|
+
/** Strike picture: flash (1 at the strike, fading in a third of a second) -> sky flash amount. Write it at any time @type {(flash: number, engine: any) => number} @experimental */
|
|
33
31
|
lightning: (flash: number, engine: any) => number;
|
|
34
32
|
/** Multiplies the sky flash of every strike; write it at any time @type {number} */
|
|
35
33
|
lightningBrightness: number;
|
|
36
34
|
/** Color the sky turns as a weather type raises grey: a THREE.Color, overcastColor.set(0x667788) changes it live @type {THREE.Color} */
|
|
37
35
|
overcastColor: THREE.Color;
|
|
38
36
|
/**
|
|
39
|
-
* The particle systems drawn now, by field: rain and snow when the table has them, plus what
|
|
37
|
+
* The particle systems drawn now, by field: rain and snow when the table has them, plus what defineField() added. Each has material (the plain three.js
|
|
40
38
|
* material: read it, or set your own, drawn as given; null gives the engine's back), uniforms ({ value } objects the engine writes each frame, a
|
|
41
39
|
* ShaderMaterial of yours shares them; uColor, uLen, uPx, uMaxPx, uSwayAmp are yours to write), spec (opacity, speed, slant, density are read each
|
|
42
40
|
* frame, plain writes), object (the three.js object). Empty when a game replaced the weather drawing
|
|
@@ -50,12 +48,18 @@ export class Weather {
|
|
|
50
48
|
* frame is weather.current[field], so they fade with the weather. spec takes the keys of weather({ rain }), or
|
|
51
49
|
* { create(engine, { area, count }) => { object, update?(amount, { camera, time, wind }) } } for a system of your own; null gives rain / snow back
|
|
52
50
|
* to weather({ rain, snow }) and removes any other field. Defining a field again replaces it. A field no type has throws with the table's fields
|
|
53
|
-
* @example engine.weather.
|
|
51
|
+
* @example engine.weather.defineField('ash', { shape: 'soft', color: 0x555555, size: 14, speed: 0.8, sway: 3 });
|
|
54
52
|
* @param {string} field
|
|
55
53
|
* @param {WeatherParticles | null} spec
|
|
56
54
|
* @returns {WeatherParticleSystem | null}
|
|
57
55
|
*/
|
|
58
|
-
|
|
56
|
+
defineField(field: string, spec: WeatherParticles | null): WeatherParticleSystem | null;
|
|
57
|
+
set auto(on: boolean);
|
|
58
|
+
/**
|
|
59
|
+
* Automatic weather on/off. Writing it takes effect like setAuto.
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
*/
|
|
62
|
+
get auto(): boolean;
|
|
59
63
|
/**
|
|
60
64
|
* Automatic weather on/off
|
|
61
65
|
* @param {boolean} on
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/weather/weatherDraw.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
|
|
3
|
-
/** engine.weatherDraw: particles and picture effects of the current weather */
|
|
3
|
+
/** engine.weatherDraw: particles and picture effects of the current weather @experimental */
|
|
4
4
|
export class WeatherDraw {
|
|
5
5
|
/** Sky flash now, 1 at a strike (the weather:lightning event) fading to 0 @type {number} */
|
|
6
6
|
flash: number;
|
|
7
|
-
/** Default particle count per system (
|
|
7
|
+
/** Default particle count per system: weather({ particles }), else 6000 (3000 on low-tier devices) @type {number} */
|
|
8
8
|
particles: number;
|
|
9
|
-
/** Particle systems drawn now: field -> { field, object, material, uniforms, spec } (rain / snow when the table has them, plus fields engine.weather.
|
|
9
|
+
/** Particle systems drawn now: field -> { field, object, material, uniforms, spec } (rain / snow when the table has them, plus fields engine.weather.defineField adds) @type {Map<string, any>} */
|
|
10
10
|
systems: Map<string, any>;
|
|
11
11
|
}
|
|
@@ -12,7 +12,7 @@ export class World {
|
|
|
12
12
|
farMaxPerTick?: number;
|
|
13
13
|
buildPerFrame?: number;
|
|
14
14
|
});
|
|
15
|
-
/** All records: id → record (read-only; use set to change fields, move to change position) @type {Map<string, WorldRecord>} */
|
|
15
|
+
/** All records: id → record (read-only; use set to change fields, move to change position) @type {Map<string, WorldRecord>} @experimental */
|
|
16
16
|
records: Map<string, WorldRecord>;
|
|
17
17
|
/**
|
|
18
18
|
* Default distance (meters) for building models and counting as near; present / simulate can override it. Changing it at runtime affects those without
|
|
@@ -48,7 +48,7 @@ export class World {
|
|
|
48
48
|
* Add a record and return it (a plain object). kind is required; without id one is numbered automatically (kind#1, kind#2…, saved; `#` never appears in an
|
|
49
49
|
* authored id, so the two can never collide).
|
|
50
50
|
* opts.initial: initial record written in content (needs an id); saves only keep its changes and removal; if the id already exists the existing one is
|
|
51
|
-
* returned (content may load twice);
|
|
51
|
+
* returned (content may load twice), after taking a new position / rot from the content unless play moved it;
|
|
52
52
|
* returns null if the save removed it (it is not added back). opts.save: false: not saved (temporary things).
|
|
53
53
|
* @example engine.world.add({ id: 'shop_owner', kind: 'npc', position: [12, 0, -30], name: '店主', mood: 'calm' }, { initial: true })
|
|
54
54
|
* @param {{ kind: string, id?: string, position?: any, [field: string]: any }} def
|
|
@@ -88,6 +88,7 @@ export class World {
|
|
|
88
88
|
* @example const h = engine.pick(0, 0); const id = h && engine.world.idOf(h.object);
|
|
89
89
|
* @param {any} obj a THREE.Object3D (a mesh of the model is fine)
|
|
90
90
|
* @returns {string | null}
|
|
91
|
+
* @experimental
|
|
91
92
|
*/
|
|
92
93
|
idOf(obj: any): string | null;
|
|
93
94
|
/**
|
|
@@ -235,11 +236,12 @@ export class World {
|
|
|
235
236
|
* Stop running simulate() handlers on this machine until remove(): a multiplayer client lets the host simulate and only receives the records.
|
|
236
237
|
* Public so net() needs no world internals.
|
|
237
238
|
* @returns {{ remove(): void }}
|
|
239
|
+
* @experimental
|
|
238
240
|
*/
|
|
239
241
|
pauseSimulation(): {
|
|
240
242
|
remove(): void;
|
|
241
243
|
};
|
|
242
|
-
/** Number of fixed steps simulated */ get steps(): number;
|
|
244
|
+
/** Number of fixed steps simulated @experimental */ get steps(): number;
|
|
243
245
|
}
|
|
244
246
|
/**
|
|
245
247
|
* One world record: id, kind and position are fixed fields, the rest are yours (plain values only)
|