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,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Audio.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/audio/Audio.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.audio: buses, sounds by name, ducking. Sfx play by name from the game's audio.sounds (file, variants or synth). */
|
|
3
3
|
export class Audio {
|
|
4
4
|
/** The browser AudioContext (exists only after the first click) @type {any} */
|
|
@@ -11,7 +11,7 @@ export class Audio {
|
|
|
11
11
|
music: any;
|
|
12
12
|
footsteps: any;
|
|
13
13
|
};
|
|
14
|
-
/** Bus input GainNodes by name (connect your own nodes here); empty until audio unlocks @type {Record<string, any>} */
|
|
14
|
+
/** Bus input GainNodes by name, 'master' included (connect your own nodes here); empty until audio unlocks. A name that is no bus warns and gives master: node.connect(undefined) would throw, and in dev a throw freezes gameplay @type {Record<string, any>} */
|
|
15
15
|
buses: Record<string, any>;
|
|
16
16
|
/** The game's current mode for rule lists, e.g. 'combat' / 'explore' (condition `state` in music and ambience rules) @type {string | null} */
|
|
17
17
|
state: string | null;
|
|
@@ -19,7 +19,7 @@ export class Audio {
|
|
|
19
19
|
master: any;
|
|
20
20
|
/** 2 s of white noise, reused by synthesized sounds @type {any} */
|
|
21
21
|
noise: any;
|
|
22
|
-
/** Is audio usable (the player has clicked/pressed a key)? @returns {boolean} */
|
|
22
|
+
/** Is audio usable (the player has clicked/pressed a key)? @returns {boolean} @experimental */
|
|
23
23
|
get running(): boolean;
|
|
24
24
|
/**
|
|
25
25
|
* Add a bus of your own (routed to master). It gets a settings slider like the others (label key settings.vol.<name>)
|
|
@@ -94,6 +94,7 @@ export class Audio {
|
|
|
94
94
|
* @param {...any} extra
|
|
95
95
|
* @returns {boolean}
|
|
96
96
|
* @example engine.audio.matches({ time: 'night', zone: 'forest', rain: { lt: 0.2 } });
|
|
97
|
+
* @experimental
|
|
97
98
|
*/
|
|
98
99
|
matches(when: AudioCondition | undefined, ...extra: any[]): boolean;
|
|
99
100
|
/**
|
|
@@ -102,6 +103,7 @@ export class Audio {
|
|
|
102
103
|
* @param {...any} extra
|
|
103
104
|
* @returns {number}
|
|
104
105
|
* @example engine.audio.volumeOf({ base: 0, add: { rain: 0.22 } }); // 0.22 in full rain
|
|
106
|
+
* @experimental
|
|
105
107
|
*/
|
|
106
108
|
volumeOf(volume: AudioVolume | undefined, ...extra: any[]): number;
|
|
107
109
|
/**
|
|
@@ -123,6 +125,19 @@ export class Audio {
|
|
|
123
125
|
params?: Record<string, any>;
|
|
124
126
|
fadeIn?: number;
|
|
125
127
|
}): SoundHandle | null;
|
|
128
|
+
/**
|
|
129
|
+
* What is playing (describe().audio shows it while something is ducked or playing): bus levels, the duck multiplier per bus, live voices per sound name.
|
|
130
|
+
* ducks is the level the active ducks ask for (1 = not lowered), read at once even while a fade is still ramping or the audio clock does not run (headless page).
|
|
131
|
+
* @returns {{ running: boolean, state: string | null, levels: Record<string, number>, ducks: Record<string, number>, voices: Record<string, number> }}
|
|
132
|
+
* @example engine.audio.duck({ music: 0.3 }); engine.audio.info.ducks.music // 0.3
|
|
133
|
+
*/
|
|
134
|
+
get info(): {
|
|
135
|
+
running: boolean;
|
|
136
|
+
state: string | null;
|
|
137
|
+
levels: Record<string, number>;
|
|
138
|
+
ducks: Record<string, number>;
|
|
139
|
+
voices: Record<string, number>;
|
|
140
|
+
};
|
|
126
141
|
/**
|
|
127
142
|
* Synth building block: a burst of filtered noise (footsteps, shutter, rain, thunder). dur seconds, freq Hz, vol 0-1; out: the node to
|
|
128
143
|
* connect to (a synth's `out`), else the named bus
|
|
@@ -157,8 +172,8 @@ export class Audio {
|
|
|
157
172
|
pan?: number;
|
|
158
173
|
}): void;
|
|
159
174
|
/**
|
|
160
|
-
* Download and decode an audio file
|
|
161
|
-
* engine.
|
|
175
|
+
* Download and decode an audio file, as an engine.loading task: a path or a sound name from an asset pack (manifest sounds), so sounds entries and music
|
|
176
|
+
* tracks may name assets instead of paths. engine.assets caches it: short effects stay; long sounds go with assets.release / trim or over a memory budget, and load again on next use
|
|
162
177
|
* @param {string} url a file path or an asset pack sound name
|
|
163
178
|
* @returns {Promise<any>}
|
|
164
179
|
*/
|
|
@@ -179,6 +194,6 @@ export class Audio {
|
|
|
179
194
|
at?: any;
|
|
180
195
|
}): Promise<SoundHandle | null>;
|
|
181
196
|
}
|
|
182
|
-
import type { AudioCondition } from '
|
|
183
|
-
import type { AudioVolume } from '
|
|
197
|
+
import type { AudioCondition } from '../../../core';
|
|
198
|
+
import type { AudioVolume } from '../../../core';
|
|
184
199
|
import { SoundHandle } from './audioVoice.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/audioVoice.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/audio/audioVoice.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
|
|
3
3
|
/** Point the Web Audio listener where the camera is (only called while positional voices exist: zero cost otherwise) */
|
|
4
4
|
export function placeListener(ctx: any, camera: any): void;
|
|
@@ -6,7 +6,7 @@ export function placeListener(ctx: any, camera: any): void;
|
|
|
6
6
|
export function synthNoise(audio: any, opts: any): void;
|
|
7
7
|
/** Synth building block behind audio.tone: a short enveloped tone */
|
|
8
8
|
export function synthTone(audio: any, opts: any): void;
|
|
9
|
-
/** audio.load body:
|
|
9
|
+
/** audio.load body: a file sound is an engine.assets entry, by name or by path (a path gets an entry of its own, like a model path), so release, trim and dispose reach it */
|
|
10
10
|
export function loadSound(audio: any, url: any): Promise<any>;
|
|
11
11
|
/** audio.play body: a file by path or asset name, no sounds entry needed */
|
|
12
12
|
export function playFile(audio: any, url: any, opts: any): Promise<SoundHandle>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Events.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/base/Events.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.events: the event bus; modules "shout" and whoever cares listens */
|
|
3
3
|
export class Events {
|
|
4
4
|
/** How many history entries to keep, default 200; 0 records nothing */
|
|
@@ -84,6 +84,6 @@ export class Events {
|
|
|
84
84
|
*/
|
|
85
85
|
emit<K extends EventName>(name: K, ...args: EventArgs<K & string>): void;
|
|
86
86
|
}
|
|
87
|
-
import type { EventName } from '
|
|
88
|
-
import type { EventArgs } from '
|
|
89
|
-
import type { Handle } from '
|
|
87
|
+
import type { EventName } from '../../../core';
|
|
88
|
+
import type { EventArgs } from '../../../core';
|
|
89
|
+
import type { Handle } from '../../../common';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/I18n.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
-
/** engine.i18n: string tables; t(key, params) fetches text and replaces {name} with params */
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/base/I18n.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.i18n: string tables; engine.t(key, params) fetches text and replaces {name} with params */
|
|
3
3
|
export class I18n {
|
|
4
|
-
/** Language used when a key is missing in the current one (default 'en') */
|
|
4
|
+
/** Language used when a key is missing in the current one (default 'en') @experimental */
|
|
5
5
|
fallback: string;
|
|
6
|
-
/** Current language, e.g. 'zh-CN' ('zh' and 'zh-Hans' resolve to it, 'en-US' to 'en') */
|
|
6
|
+
/** Current language, e.g. 'zh-CN' ('zh' and 'zh-Hans' resolve to it, 'en-US' to 'en') @experimental */
|
|
7
7
|
locale: any;
|
|
8
8
|
/**
|
|
9
9
|
* Register string tables (never overrides text the game gave)
|
|
@@ -12,19 +12,11 @@ export class I18n {
|
|
|
12
12
|
* @example engine.i18n.add({ 'zh-CN': { 'shop.buy': '购买 {name}' }, en: { 'shop.buy': 'Buy {name}' } });
|
|
13
13
|
*/
|
|
14
14
|
add(tables: StringTables): this;
|
|
15
|
-
/** Switch language ('auto' picks from the browser like createEngine) @param {string} l */
|
|
15
|
+
/** Switch language ('auto' picks from the browser like createEngine) @param {string} l @experimental */
|
|
16
16
|
setLocale(l: string): void;
|
|
17
|
-
/** All available languages @returns {string[]} */
|
|
17
|
+
/** All available languages @returns {string[]} @experimental */
|
|
18
18
|
get languages(): string[];
|
|
19
19
|
/** Whether the key exists @param {string} key @returns {boolean} */
|
|
20
20
|
has(key: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Fetch text; params replace {name}, {key:action} shows the key label
|
|
23
|
-
* @param {string} key
|
|
24
|
-
* @param {Record<string, any>} [params]
|
|
25
|
-
* @returns {string}
|
|
26
|
-
* @example engine.i18n.t('shop.buy', { name: '鱼' });
|
|
27
|
-
*/
|
|
28
|
-
t(key: string, params?: Record<string, any>): string;
|
|
29
21
|
}
|
|
30
|
-
import type { StringTables } from '
|
|
22
|
+
import type { StringTables } from '../../../core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Random.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/base/Random.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.random is the seeded random generator. Gameplay randomness (auto weather, lightning, drops, spawning) uses it so step / tests are reproducible and the state is saved with the save. */
|
|
3
3
|
export class Random {
|
|
4
4
|
/** @param {number} [seed] Seed, default 1 */
|
|
@@ -8,6 +8,7 @@ export class Random {
|
|
|
8
8
|
* @param {number} seed
|
|
9
9
|
* @returns {this}
|
|
10
10
|
* @example engine.random.setSeed(42);
|
|
11
|
+
* @experimental
|
|
11
12
|
*/
|
|
12
13
|
setSeed(seed: number): this;
|
|
13
14
|
seed: any;
|
|
@@ -16,7 +17,7 @@ export class Random {
|
|
|
16
17
|
next(): number;
|
|
17
18
|
/** A decimal between a and b @param {number} a @param {number} b @returns {number} */
|
|
18
19
|
range(a: number, b: number): number;
|
|
19
|
-
/** An integer between a and b (inclusive) @param {number} a @param {number} b @returns {number} @example const dice = engine.random.int(1, 6); */
|
|
20
|
+
/** An integer between a and b (inclusive) @param {number} a @param {number} b @returns {number} @example const dice = engine.random.int(1, 6); @experimental */
|
|
20
21
|
int(a: number, b: number): number;
|
|
21
22
|
/**
|
|
22
23
|
* Pick one element of the array at random (undefined for an empty array).
|
|
@@ -41,7 +42,7 @@ export class Random {
|
|
|
41
42
|
seed: number;
|
|
42
43
|
state: number;
|
|
43
44
|
};
|
|
44
|
-
/** For loading @param {{ seed: number, state: number } | null | undefined} d */
|
|
45
|
+
/** For loading @param {{ seed: number, state: number } | null | undefined} d @experimental */
|
|
45
46
|
fromJSON(d: {
|
|
46
47
|
seed: number;
|
|
47
48
|
state: number;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/page.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/engine/page.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.page: window focus, tab visibility, mouse lock and WebGL context, all handled here. */
|
|
3
3
|
export class Page {
|
|
4
|
-
/**
|
|
5
|
-
pauseOnBlur: boolean;
|
|
6
|
-
/** The window has keyboard focus @type {boolean} */
|
|
4
|
+
/** The window has keyboard focus @type {boolean} @experimental */
|
|
7
5
|
focused: boolean;
|
|
8
6
|
/** The tab is visible @type {boolean} */
|
|
9
7
|
visible: boolean;
|
|
10
|
-
/** The mouse is locked to the canvas (first-person / shoulder cameras lock on click) @type {boolean} */
|
|
8
|
+
/** The mouse is locked to the canvas (first-person / shoulder cameras lock on click) @type {boolean} @experimental */
|
|
11
9
|
pointerLocked: boolean;
|
|
12
|
-
/** The WebGL context is lost and not yet restored, or the WebGPU device is lost @type {boolean} */
|
|
10
|
+
/** The WebGL context is lost and not yet restored, or the WebGPU device is lost @type {boolean} @experimental */
|
|
13
11
|
contextLost: boolean;
|
|
14
|
-
|
|
12
|
+
set pauseOnBlur(v: boolean);
|
|
13
|
+
/** Freeze gameplay while the page is away; default true. Settable at runtime @type {boolean} */
|
|
14
|
+
get pauseOnBlur(): boolean;
|
|
15
|
+
/** The page is away: the window lost focus or the tab is hidden @type {boolean} @experimental */
|
|
15
16
|
get away(): boolean;
|
|
16
|
-
/** The real-time loop holds gameplay now (away with pauseOnBlur, or the WebGL context / WebGPU device is lost) @type {boolean} */
|
|
17
|
-
get held(): boolean;
|
|
18
17
|
/**
|
|
19
18
|
* Let go of the mouse (a game's own screen, a click-driven moment). Not read as the player's Esc, so the pause menu stays shut. Does nothing without a lock; the next
|
|
20
19
|
* click on the view locks again.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Input.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/input/Input.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** Input: read by "action", not by "key". Key names are the browser's KeyboardEvent.code, e.g. 'KeyE', 'Space', 'ShiftLeft'; gamepad keys are 'PadA' etc. */
|
|
3
3
|
export class Input {
|
|
4
4
|
/** This frame's look-drag amount (pixels) and wheel notches */
|
|
@@ -9,7 +9,7 @@ export class Input {
|
|
|
9
9
|
};
|
|
10
10
|
/** Mouse/touch pointer @type {Pointer} */
|
|
11
11
|
pointer: Pointer;
|
|
12
|
-
/** On-screen stick (touch) */
|
|
12
|
+
/** On-screen stick (touch) @experimental */
|
|
13
13
|
stick: {
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
@@ -24,9 +24,9 @@ export class Input {
|
|
|
24
24
|
optional: boolean;
|
|
25
25
|
by: string | null;
|
|
26
26
|
}>;
|
|
27
|
-
/** Most recently used device: UI key hints follow it @type {'keyboard' | 'pad' | 'touch'} */
|
|
27
|
+
/** Most recently used device: UI key hints follow it @type {'keyboard' | 'pad' | 'touch'} @experimental */
|
|
28
28
|
lastDevice: "keyboard" | "pad" | "touch";
|
|
29
|
-
/** Is this a touch device? */
|
|
29
|
+
/** Is this a touch device? @experimental */
|
|
30
30
|
touch: boolean;
|
|
31
31
|
/**
|
|
32
32
|
* Declare an action: its context and display name, never its keys (the game binds those). Modules call ctx.input.action (owned by the module,
|
|
@@ -93,6 +93,7 @@ export class Input {
|
|
|
93
93
|
/**
|
|
94
94
|
* All keys bound to an action: the player's rebinding, else the game's bind, else the default preset (basics only); plus its touch button
|
|
95
95
|
* @param {string} action @returns {readonly string[]}
|
|
96
|
+
* @experimental
|
|
96
97
|
*/
|
|
97
98
|
keysOf(action: string): readonly string[];
|
|
98
99
|
/**
|
|
@@ -117,6 +118,7 @@ export class Input {
|
|
|
117
118
|
/**
|
|
118
119
|
* Just released (which copy is read is the same as pressed; for things like release-to-fire after charging) @param {string} action @returns {boolean}
|
|
119
120
|
* @example if (engine.input.released('fire')) shoot(charge);
|
|
121
|
+
* @experimental
|
|
120
122
|
*/
|
|
121
123
|
released(action: string): boolean;
|
|
122
124
|
/**
|
|
@@ -152,11 +154,13 @@ export class Input {
|
|
|
152
154
|
unbound: string[];
|
|
153
155
|
rebound: Record<string, string[]>;
|
|
154
156
|
};
|
|
155
|
-
/** Names of the active contexts, bottom to top (pending switches apply at the next fixed step) @returns {string[]} */
|
|
157
|
+
/** Names of the active contexts, bottom to top (pending switches apply at the next fixed step) @returns {string[]} @experimental */
|
|
156
158
|
get contexts(): string[];
|
|
157
159
|
/**
|
|
158
|
-
* Who holds input, bottom to top above the base context: [{ context, owner, pass }] (pass: unrelated gameplay actions still read)
|
|
160
|
+
* Who holds input, bottom to top above the base context: [{ context, owner, pass }] (pass: unrelated gameplay actions still read).
|
|
161
|
+
* Pushes and removes count at once, before the next fixed step applies them: on a halted page a closed window is not a holder any more
|
|
159
162
|
* @returns {{ context: string, owner: string, pass: boolean }[]}
|
|
163
|
+
* @experimental
|
|
160
164
|
*/
|
|
161
165
|
get holders(): {
|
|
162
166
|
context: string;
|
|
@@ -192,5 +196,5 @@ export class Input {
|
|
|
192
196
|
y: number;
|
|
193
197
|
};
|
|
194
198
|
}
|
|
195
|
-
import type { Pointer } from '
|
|
196
|
-
import type { Autopilot } from '
|
|
199
|
+
import type { Pointer } from '../../../core';
|
|
200
|
+
import type { Autopilot } from '../../../core';
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Budget.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
-
export class ApplyCost {
|
|
3
|
-
/** Frames in which three.js compiled new shader programs (the last COMPILES_KEPT): { at (page time s), programs (new), ms (render ms of that frame over the usual) } */
|
|
4
|
-
compiles: any[];
|
|
5
|
-
/**
|
|
6
|
-
* Per stage: n results, totalMs, maxMs of one result, frameMs (smoothed ms per frame), bytes (transit only)
|
|
7
|
-
* @returns {Record<string, { n: number, totalMs: number, maxMs: number, frameMs: number, bytes: number }>}
|
|
8
|
-
* @example engine.budget.cost.report().build // { n: 12, totalMs: 9.4, maxMs: 1.8, frameMs: 0.2, bytes: 0 }
|
|
9
|
-
*/
|
|
10
|
-
report(): Record<string, {
|
|
11
|
-
n: number;
|
|
12
|
-
totalMs: number;
|
|
13
|
-
maxMs: number;
|
|
14
|
-
frameMs: number;
|
|
15
|
-
bytes: number;
|
|
16
|
-
}>;
|
|
17
|
-
/** Forget what was counted so far (to measure one scene on its own) */
|
|
18
|
-
reset(): void;
|
|
19
|
-
}
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/inspect/Budget.js (edit the JSDoc in the source, then run npm run map)
|
|
20
2
|
/** engine.budget: performance budget (turned on by createEngine({ budget }) or enable(); off by default, costs nothing). */
|
|
21
3
|
export class Budget {
|
|
22
4
|
/** Is it on? */
|
|
23
5
|
enabled: boolean;
|
|
24
|
-
/** Current limits @type {BudgetLimits} */
|
|
6
|
+
/** Current limits @type {BudgetLimits} @experimental */
|
|
25
7
|
limits: BudgetLimits;
|
|
26
8
|
/** Cost of applying background results, split in stages (see ApplyCost) */
|
|
27
9
|
cost: ApplyCost;
|
|
@@ -32,7 +14,7 @@ export class Budget {
|
|
|
32
14
|
* @example engine.budget.enable({ drawCalls: 250, fps: 55 });
|
|
33
15
|
*/
|
|
34
16
|
enable(limits?: BudgetLimits): this;
|
|
35
|
-
/** Turn off */
|
|
17
|
+
/** Turn off @experimental */
|
|
36
18
|
disable(): void;
|
|
37
19
|
/**
|
|
38
20
|
* Module-defined category: read() returns the current value, opts.limit is the limit (the game's enable() takes precedence). Returns a handle { remove() }
|
|
@@ -44,7 +26,7 @@ export class Budget {
|
|
|
44
26
|
metric(name: string, read: () => number, opts?: {
|
|
45
27
|
limit?: number;
|
|
46
28
|
}): Handle;
|
|
47
|
-
/** Limit of a category; undefined if none was given (not checked) @param {string} name @returns {number | undefined} */
|
|
29
|
+
/** Limit of a category; undefined if none was given (not checked) @param {string} name @returns {number | undefined} @experimental */
|
|
48
30
|
limitOf(name: string): number | undefined;
|
|
49
31
|
/** Budget report; null when off. In the real-time loop it returns the last second's result; in step() mode it is computed on demand @returns {BudgetReport | null} */
|
|
50
32
|
report(): BudgetReport | null;
|
|
@@ -52,6 +34,7 @@ export class Budget {
|
|
|
52
34
|
* Called by the engine when startup finishes: warns if startupMs / moduleMs is exceeded and returns the offenders (empty array if none)
|
|
53
35
|
* @param {{ totalMs: number, modules: Record<string, { init?: number, ready?: number }> }} s
|
|
54
36
|
* @returns {{ category: 'startupMs' | 'moduleMs', value: number, limit: number, top: { tag: string, ms: number }[] }[]}
|
|
37
|
+
* @experimental
|
|
55
38
|
*/
|
|
56
39
|
checkStartup(s: {
|
|
57
40
|
totalMs: number;
|
|
@@ -77,8 +60,35 @@ export class Budget {
|
|
|
77
60
|
*/
|
|
78
61
|
byTag(): BudgetTagStat[];
|
|
79
62
|
}
|
|
80
|
-
import type { BudgetLimits } from '
|
|
63
|
+
import type { BudgetLimits } from '../../../world';
|
|
64
|
+
/**
|
|
65
|
+
* engine.budget.cost: where the main thread pays for background results (terrain chunks, vegetation, colliders, stream builds), split in stages.
|
|
66
|
+
* Always on (a few performance.now() calls per applied result). Stages: transit = worker round trip minus the worker's own compute (queueing,
|
|
67
|
+
* structured clone, waiting for a busy main thread: an async wait, not main-thread blocking, so it is an approximation); build = creating the
|
|
68
|
+
* three.js objects (geometry, meshes, instanced meshes); collider = physics colliders; upload = GPU upload and shader compile, approximated as the
|
|
69
|
+
* extra render time of frames that first draw new objects over the average render time of other frames; stream = the synchronous part of a stream
|
|
70
|
+
* build() callback.
|
|
71
|
+
*/
|
|
72
|
+
declare class ApplyCost {
|
|
73
|
+
/** Frames in which three.js compiled new shader programs (the last COMPILES_KEPT): { at (page time s), programs (new), ms (render ms of that frame over the usual) } */
|
|
74
|
+
compiles: any[];
|
|
75
|
+
/**
|
|
76
|
+
* Per stage: n results, totalMs, maxMs of one result, frameMs (smoothed ms per frame), bytes (transit only)
|
|
77
|
+
* @returns {Record<string, { n: number, totalMs: number, maxMs: number, frameMs: number, bytes: number }>}
|
|
78
|
+
* @example engine.budget.cost.report().build // { n: 12, totalMs: 9.4, maxMs: 1.8, frameMs: 0.2, bytes: 0 }
|
|
79
|
+
*/
|
|
80
|
+
report(): Record<string, {
|
|
81
|
+
n: number;
|
|
82
|
+
totalMs: number;
|
|
83
|
+
maxMs: number;
|
|
84
|
+
frameMs: number;
|
|
85
|
+
bytes: number;
|
|
86
|
+
}>;
|
|
87
|
+
/** Forget what was counted so far (to measure one scene on its own) */
|
|
88
|
+
reset(): void;
|
|
89
|
+
}
|
|
81
90
|
import * as THREE from 'three';
|
|
82
|
-
import type { Handle } from '
|
|
83
|
-
import type { BudgetReport } from '
|
|
84
|
-
import type { BudgetTagStat } from '
|
|
91
|
+
import type { Handle } from '../../../common';
|
|
92
|
+
import type { BudgetReport } from '../../../world';
|
|
93
|
+
import type { BudgetTagStat } from '../../../world';
|
|
94
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/DebugOverrides.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/inspect/DebugOverrides.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
export class DebugOverrides {
|
|
3
3
|
/** The F3 debug panel (the debug() module), or null when it is not installed @type {any} */
|
|
4
4
|
panel: any;
|
|
@@ -50,7 +50,7 @@ export class DebugOverrides {
|
|
|
50
50
|
* Asset hot swap: register the asset packs again (the new module of an edited assets.js) and build what changed (a new generator function,
|
|
51
51
|
* url or params schema); every live copy swaps geometry and material in place, the page, player, clock and world state stay. The vite preset
|
|
52
52
|
* calls it when an art module imported by the game's assets.js is saved; returns what was swapped (also in describe().assetSwaps).
|
|
53
|
-
* @example import packs from '
|
|
53
|
+
* @example import packs from '../../../../core/assets'; if (import.meta.hot) import.meta.hot.accept('./assets.js', m => engine.debug.reloadAssets(m.default));
|
|
54
54
|
* @param {any} packs @returns {Promise<{ why: string, names: string[], copies: Record<string, number>, ms: number, partsChanged?: string[] }>}
|
|
55
55
|
*/
|
|
56
56
|
reloadAssets(packs: any): Promise<{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Ops.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/ops/Ops.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/**
|
|
3
3
|
* engine.ops: one entry point for the discrete things players and NPCs decide to do. define registers, run executes (sync, logged), can only asks, list says what exists / what is possible now, recent reads the log.
|
|
4
4
|
* Inside an op use ctx.actor (world record id, default engine.actor = 'player'), never engine.player: NPCs and network peers run the same op as themselves.
|
|
5
5
|
*/
|
|
6
6
|
export class Ops {
|
|
7
|
-
/** Counter
|
|
7
|
+
/** Counter that only goes up: each committed op, undo, load and rollback bumps it (a failed op that changed nothing does not); every run result carries it, so "did anything change since I looked" is one compare */
|
|
8
8
|
revision: number;
|
|
9
9
|
set historySize(n: number);
|
|
10
10
|
/** History entries kept (ring, default 256); setting it clears the history */
|
|
@@ -77,7 +77,7 @@ export class Ops {
|
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* Run an op now (synchronously): checks args (dev), calls can, then run, and logs it. Returns { ok: true, value, revision } or { ok: false, code, facts, nextActions, revision } (revision = ops.revision, counts committed ops); can may also return { code, facts?, nextActions? }.
|
|
80
|
-
* Pass a fresh args object each call (it is kept in the history; in dev it is frozen). opts.source: 'player' | 'game' | 'bridge' | 'test' | 'replay' | 'net'
|
|
80
|
+
* Pass a fresh args object each call (it is kept in the history; in dev it is frozen). opts.source: 'player' | 'game' | 'bridge' | 'test' | 'replay' | 'net' | 'editor'
|
|
81
81
|
* (default: 'game' inside a fixed step, 'player' between steps); opts.actor: who does it (world record id, default engine.actor, which is 'player' unless the game hands control elsewhere).
|
|
82
82
|
* @param {string} name
|
|
83
83
|
* @param {object} [args]
|
|
@@ -210,6 +210,7 @@ export class Ops {
|
|
|
210
210
|
* @param {any} args
|
|
211
211
|
* @param {{ reason: string, actor?: string, source?: string }} why source defaults to 'net'
|
|
212
212
|
* @returns {void}
|
|
213
|
+
* @experimental
|
|
213
214
|
*/
|
|
214
215
|
refused(name: string, args: any, { reason, actor, source }: {
|
|
215
216
|
reason: string;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/control.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
-
export namespace CONTROL_LAYERS {
|
|
3
|
-
let base: number;
|
|
4
|
-
let script: number;
|
|
5
|
-
let cutscene: number;
|
|
6
|
-
let net: number;
|
|
7
|
-
}
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/ops/control.js (edit the JSDoc in the source, then run npm run map)
|
|
8
2
|
/** engine.control (made for every engine in services.js; the characters module tells it how to find a character by id) */
|
|
9
3
|
export class Control {
|
|
10
4
|
constructor(engine: any);
|
|
@@ -13,13 +7,13 @@ export class Control {
|
|
|
13
7
|
* charge (dt on the character's time channel): a direction moves it, null stands still (gravity and the idle pose go on), false skips the
|
|
14
8
|
* move this step (you placed it yourself). Without step, move it with handle.move(x, z, run, dt), which does nothing while paused.
|
|
15
9
|
* @param {any} who a Character, an NPC handle or a character id ('player', an NPC id)
|
|
16
|
-
* @param {{ owner: string, layer?: 'base' | 'script' | 'cutscene' | 'net', step?: (dt: number, ch: any) => ({ x: number, z: number, run?: boolean } | null | false | void) }} o
|
|
10
|
+
* @param {{ owner: string, layer?: 'base' | 'script' | 'cutscene' | 'physics' | 'net', step?: (dt: number, ch: any) => ({ x: number, z: number, run?: boolean } | null | false | void) }} o
|
|
17
11
|
* @returns {{ owner: string, layer: string, id: string, readonly active: boolean, move(x: number, z: number, run?: boolean, dt?: number): boolean, remove(): void }}
|
|
18
12
|
* @example const h = engine.control.take(player, { owner: 'tutorial', layer: 'script', step: () => ({ x: 0, z: 1 }) }); ... h.remove();
|
|
19
13
|
*/
|
|
20
14
|
take(who: any, o?: {
|
|
21
15
|
owner: string;
|
|
22
|
-
layer?: "base" | "script" | "cutscene" | "net";
|
|
16
|
+
layer?: "base" | "script" | "cutscene" | "physics" | "net";
|
|
23
17
|
step?: (dt: number, ch: any) => ({
|
|
24
18
|
x: number;
|
|
25
19
|
z: number;
|
|
@@ -50,6 +44,6 @@ export class Control {
|
|
|
50
44
|
has(who: any, owner: string): boolean;
|
|
51
45
|
/** describe().control: every held character by id, as of() */
|
|
52
46
|
describe(): {};
|
|
53
|
-
/** Drop every hold on a character (its record left the world, or a record-less character was disposed) @param {string} id */
|
|
47
|
+
/** Drop every hold on a character (its record left the world, or a record-less character was disposed) @param {string} id @experimental */
|
|
54
48
|
forget(id: string): void;
|
|
55
49
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Saves.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/saves/Saves.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.saves handles saving. Each module registers "how to save and load"; supports multiple slots, autosave and export / import. */
|
|
3
3
|
export class Saves {
|
|
4
|
-
/** Save name prefix (start of the key names in the localStorage fallback, and of the IndexedDB database name) */
|
|
5
|
-
prefix: string;
|
|
6
4
|
/**
|
|
7
5
|
* Storage layer: saves in the IndexedDB slots store, attachments (by group, e.g. 'photo') in the blobs store; mode 'localStorage' without IndexedDB.
|
|
8
6
|
* @type {{ mode: 'idb' | 'localStorage', blobs(group?: string): Promise<{ group: string, id: string, at: number, blob: Blob, meta: any }[]>,
|
|
9
7
|
* putBlob(group: string, id: string, blob: Blob, meta?: any, at?: number): Promise<void>, deleteBlob(group: string, id: string): Promise<void> }}
|
|
8
|
+
* @experimental
|
|
10
9
|
*/
|
|
11
10
|
store: {
|
|
12
11
|
mode: "idb" | "localStorage";
|
|
@@ -31,9 +30,6 @@ export class Saves {
|
|
|
31
30
|
* shape.
|
|
32
31
|
* A save whose part is newer than this build's version is refused as a whole (load returns false, the save is kept).
|
|
33
32
|
* A part registered after a save was loaded (a module installed later) is handed its data from that save at once.
|
|
34
|
-
* movedFrom: { oldPart: data => newData } when this part's data used to be saved under another part's name (a module split in two: the calendar's
|
|
35
|
-
* time and day were part 'sky'); an old save without this part but with oldPart hands that data, converted, to this part, and oldPart is dropped
|
|
36
|
-
* (unless a registered part still owns that name).
|
|
37
33
|
* atomic: true joins this part to atomic ops: it is copied before an atomic op runs and put back if the op fails (plain data only; afterLoad does not run on rollback).
|
|
38
34
|
* checkNewGame(data): dev only, called once start() finished with this part's data in the new-game state, to warn about what should not be there yet
|
|
39
35
|
* (world: records placed by code instead of content). The part knows its own format; core only hands the data over.
|
|
@@ -51,12 +47,39 @@ export class Saves {
|
|
|
51
47
|
*/
|
|
52
48
|
get versions(): Record<string, number>;
|
|
53
49
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
57
|
-
* @
|
|
50
|
+
* Store a binary attachment outside the world save (a photo, a replay). It rides in the queue of save writes, so flush() waits for it, and exportFile() carries it.
|
|
51
|
+
* Pass a function to make the bytes when the write runs: flush() then waits for that too. Without IndexedDB it is not kept.
|
|
52
|
+
* @example await engine.saves.putAttachment('replay', 'run-1', blob, { score: 12 });
|
|
53
|
+
* @param {string} group what the attachment is for
|
|
54
|
+
* @param {string} id unique inside the group; the same id replaces
|
|
55
|
+
* @param {Blob | (() => Promise<Blob>)} blob
|
|
56
|
+
* @param {any} [meta] plain data kept with it
|
|
57
|
+
* @returns {Promise<void>}
|
|
58
|
+
* @experimental
|
|
58
59
|
*/
|
|
59
|
-
|
|
60
|
+
putAttachment(group: string, id: string, blob: Blob | (() => Promise<Blob>), meta?: any): Promise<void>;
|
|
61
|
+
/** Delete an attachment; no such id is fine @param {string} group @param {string} id @returns {Promise<void>} @experimental */
|
|
62
|
+
removeAttachment(group: string, id: string): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* The attachments of a group, once storage is ready. Empty without IndexedDB.
|
|
65
|
+
* @param {string} group
|
|
66
|
+
* @returns {Promise<{ group: string, id: string, at: number, blob: Blob, meta: any }[]>}
|
|
67
|
+
* @experimental
|
|
68
|
+
*/
|
|
69
|
+
attachments(group: string): Promise<{
|
|
70
|
+
group: string;
|
|
71
|
+
id: string;
|
|
72
|
+
at: number;
|
|
73
|
+
blob: Blob;
|
|
74
|
+
meta: any;
|
|
75
|
+
}[]>;
|
|
76
|
+
/**
|
|
77
|
+
* A localStorage key for what belongs to this game but is not a save (settings, a last-used tab): it shares the game's name, so two games on one site stay apart, and stays out of list().
|
|
78
|
+
* @example localStorage.setItem(engine.saves.storageKey('lastTab'), 'map');
|
|
79
|
+
* @param {string} name
|
|
80
|
+
* @returns {string}
|
|
81
|
+
*/
|
|
82
|
+
storageKey(name: string): string;
|
|
60
83
|
/** Wait for all queued disk writes to finish (for tests and before the page closes) @returns {Promise<void>} */
|
|
61
84
|
flush(): Promise<void>;
|
|
62
85
|
/**
|
|
@@ -123,7 +146,7 @@ export class Saves {
|
|
|
123
146
|
}[];
|
|
124
147
|
/** Delete a slot. Returns a Promise (disk write done); awaiting is optional @param {string} slot @returns {Promise<void>} */
|
|
125
148
|
remove(slot: string): Promise<void>;
|
|
126
|
-
/** Export as a piece of text (can be copied as a backup; synchronous, without binary attachments) @param {string} [slot] @returns {string} */
|
|
149
|
+
/** Export as a piece of text (can be copied as a backup; synchronous, without binary attachments) @param {string} [slot] @returns {string} @experimental */
|
|
127
150
|
export(slot?: string): string;
|
|
128
151
|
/**
|
|
129
152
|
* Import text from export() into a slot (default 'imported'); checked like importFile and written before it resolves.
|
|
@@ -140,6 +163,7 @@ export class Saves {
|
|
|
140
163
|
* @param {{ files?: boolean }} [opts]
|
|
141
164
|
* @returns {Promise<boolean>}
|
|
142
165
|
* @example engine.saves.exportFile('slot1');
|
|
166
|
+
* @experimental
|
|
143
167
|
*/
|
|
144
168
|
exportFile(slot?: string, opts?: {
|
|
145
169
|
files?: boolean;
|
|
@@ -167,4 +191,4 @@ export class Saves {
|
|
|
167
191
|
remove(): void;
|
|
168
192
|
};
|
|
169
193
|
}
|
|
170
|
-
import type { SaveProvider } from '
|
|
194
|
+
import type { SaveProvider } from '../../../core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/session.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/saves/session.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
|
|
3
3
|
/** engine.session: new game / continue / back to title, each from a clean slate. */
|
|
4
4
|
export class Session {
|
|
@@ -6,6 +6,7 @@ export class Session {
|
|
|
6
6
|
* True while a playthrough runs: start() has finished, no newGame / load / quit is replacing the state, and the title screen is not up.
|
|
7
7
|
* Autosave and other "only during play" work check it.
|
|
8
8
|
* @type {boolean}
|
|
9
|
+
* @experimental
|
|
9
10
|
*/
|
|
10
11
|
get playing(): boolean;
|
|
11
12
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Rays.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/scene/Rays.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.rays is the ray registry (engine.raycast hits whatever is registered here). */
|
|
3
3
|
export class Rays {
|
|
4
|
-
/** Registered mesh -> { refs: registration count, occ: camera-blocker registration count } @type {Map<THREE.Object3D, { refs: number, occ: number }>} */
|
|
4
|
+
/** Registered mesh -> { refs: registration count, occ: camera-blocker registration count } @type {Map<THREE.Object3D, { refs: number, occ: number }>} @experimental */
|
|
5
5
|
statics: Map<THREE.Object3D, {
|
|
6
6
|
refs: number;
|
|
7
7
|
occ: number;
|
|
8
8
|
}>;
|
|
9
|
-
/** The three.js Raycaster (firstHitOnly is on) @type {any} */
|
|
9
|
+
/** The three.js Raycaster (firstHitOnly is on) @type {any} @experimental */
|
|
10
10
|
ray: any;
|
|
11
11
|
/**
|
|
12
12
|
* Register a static object and every mesh under it (an array also works; meshes over 256 triangles get a BVH); occluder: true also blocks the camera. Returns a handle { remove() }.
|
|
13
|
-
* Only visible objects are hit
|
|
13
|
+
* Only visible objects are hit. Something that is merely not drawn is still hit: batched originals, far hlod originals and the full model of a far assets.lod sit on a reserved layer, with their visible true.
|
|
14
14
|
* Unregisters automatically on geometry dispose or engine.remove.
|
|
15
15
|
* @param {THREE.Object3D | THREE.Object3D[]} obj
|
|
16
16
|
* @param {{ occluder?: boolean }} [opts]
|
|
@@ -20,30 +20,11 @@ export class Rays {
|
|
|
20
20
|
addStatic(obj: THREE.Object3D | THREE.Object3D[], opts?: {
|
|
21
21
|
occluder?: boolean;
|
|
22
22
|
}): Handle;
|
|
23
|
-
/** Unregister every mesh under the object (engine.remove calls this automatically) @param {THREE.Object3D} obj */
|
|
23
|
+
/** Unregister every mesh under the object (engine.remove calls this automatically) @param {THREE.Object3D} obj @experimental */
|
|
24
24
|
forget(obj: THREE.Object3D): void;
|
|
25
|
-
/** A module merges its own hits (rigid adds rigid bodies; asked only when targets is 'all'). Returns a handle { remove() } @param {RayProvider} fn @returns {Handle} */
|
|
25
|
+
/** A module merges its own hits (rigid adds rigid bodies; asked only when targets is 'all'). Returns a handle { remove() } @param {RayProvider} fn @returns {Handle} @experimental */
|
|
26
26
|
addProvider(fn: RayProvider): Handle;
|
|
27
|
-
/**
|
|
28
|
-
* Cast a ray from origin along dir and return the nearest hit or null (same as engine.raycast).
|
|
29
|
-
* @param {Vec3Like} origin
|
|
30
|
-
* @param {Vec3Like} dir
|
|
31
|
-
* @param {RaycastOptions} [opts]
|
|
32
|
-
* @returns {RayHit | null}
|
|
33
|
-
*/
|
|
34
|
-
cast(origin: Vec3Like, dir: Vec3Like, opts?: RaycastOptions): RayHit | null;
|
|
35
|
-
/**
|
|
36
|
-
* Cast from screen coordinates (-1..1) through the camera (same as engine.pick).
|
|
37
|
-
* @param {number} ndcX
|
|
38
|
-
* @param {number} ndcY
|
|
39
|
-
* @param {RaycastOptions} [opts]
|
|
40
|
-
* @returns {RayHit | null}
|
|
41
|
-
*/
|
|
42
|
-
pick(ndcX: number, ndcY: number, opts?: RaycastOptions): RayHit | null;
|
|
43
27
|
}
|
|
44
28
|
import * as THREE from 'three';
|
|
45
|
-
import type { Handle } from '
|
|
46
|
-
import type { RayProvider } from '
|
|
47
|
-
import type { Vec3Like } from '../../common';
|
|
48
|
-
import type { RaycastOptions } from '../../core';
|
|
49
|
-
import type { RayHit } from '../../core';
|
|
29
|
+
import type { Handle } from '../../../common';
|
|
30
|
+
import type { RayProvider } from '../../../core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Views.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/scene/Views.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
export class Views {
|
|
3
3
|
/** @param {any} engine */
|
|
4
4
|
constructor(engine: any);
|