threedog 0.5.0 → 0.7.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 +81 -1
- package/README.md +21 -13
- package/core/Assets.js +23 -12
- package/core/Audio.js +1 -1
- package/core/Baked.js +14 -23
- package/core/Budget.js +2 -2
- package/core/DebugOverrides.js +33 -18
- package/core/Describe.js +10 -11
- package/core/Engine.js +50 -46
- package/core/I18n.js +2 -2
- package/core/Input.js +11 -5
- package/core/Inspect.js +6 -3
- package/core/InspectMaterials.js +2 -3
- package/core/InspectPerf.js +11 -4
- package/core/MaterialInfo.js +7 -5
- package/core/Rays.js +7 -2
- package/core/Stream.js +2 -3
- package/core/UrlState.js +49 -9
- package/core/Views.js +1 -0
- package/core/adaptive.js +2 -2
- package/core/assetEntry.js +5 -2
- package/core/assetLoad.js +13 -15
- package/core/assetManifest.js +6 -3
- package/core/assetReport.js +4 -4
- package/core/batchGroups.js +9 -1
- package/core/catalog.js +16 -3
- package/core/chunkStream.js +1 -1
- package/core/copies.js +1 -1
- package/core/debugView.js +4 -4
- package/core/describeRender.js +104 -28
- package/core/describeText.js +6 -6
- package/core/errorCodes.js +72 -45
- package/core/errorHints.js +4 -1
- package/core/errors.js +4 -4
- package/core/events.generated.js +1 -0
- package/core/gameLights.js +9 -2
- package/core/lifecycle.js +2 -4
- package/core/lightWatch.js +5 -3
- package/core/loop.js +18 -11
- package/core/math.js +7 -0
- package/core/moduleSlots.js +32 -7
- package/core/moduleTypes.js +20 -7
- package/core/modules.js +7 -7
- package/core/namedModel.js +8 -4
- package/core/owned.js +33 -30
- package/core/page.js +43 -10
- package/core/pictureSlots.js +33 -0
- package/core/pictureWriters.js +343 -0
- package/core/plugins.js +64 -96
- package/core/sceneDelta.js +12 -4
- package/core/sceneMethods.js +2 -9
- package/core/services.js +1 -1
- package/core/shadowTypes.js +1 -1
- package/core/shadows.js +405 -0
- package/core/sharedPoint.js +5 -19
- package/core/stackFrames.js +16 -5
- package/core/stacks.js +6 -6
- package/core/startup.js +9 -11
- package/core/thingExplain.js +1 -1
- package/core/things.js +1 -1
- package/core/tier.js +1 -1
- package/core/util.js +1 -1
- package/core/validate.js +1 -1
- package/core/view.js +43 -0
- package/docs/AI.md +62 -58
- package/docs/API.md +15 -15
- package/docs/CODEMAP.md +36 -54
- package/docs/COMMANDS.md +28 -25
- package/docs/CONVENTIONS.md +36 -30
- package/docs/MIGRATING-0.4.md +93 -1
- package/docs/MIGRATING-0.6.md +126 -0
- package/docs/MIGRATING-0.7.md +39 -0
- package/docs/THREE.md +24 -22
- package/docs/api/assets.md +5 -3
- package/docs/api/audio.md +2 -2
- package/docs/api/budget.md +4 -0
- package/docs/api/characters.md +3 -1
- package/docs/api/collision.md +2 -2
- package/docs/api/engine.md +47 -20
- package/docs/api/events.md +2 -1
- package/docs/api/grids.md +8 -1
- package/docs/api/ground.md +1 -1
- package/docs/api/hud.md +3 -0
- package/docs/api/input.md +3 -2
- package/docs/api/interactions.md +3 -1
- package/docs/api/inventory.md +1 -2
- package/docs/api/level.md +0 -1
- package/docs/api/lightPool.md +1 -1
- package/docs/api/occlusion.md +5 -0
- package/docs/api/particles.md +6 -3
- package/docs/api/pickups.md +6 -0
- package/docs/api/post.md +5 -3
- package/docs/api/sky.md +12 -10
- package/docs/api/terrain.md +12 -6
- package/docs/api/terrainDraw.md +12 -0
- package/docs/api/tools.md +8 -7
- package/docs/api/triggers.md +2 -0
- package/docs/api/vegetation.md +7 -2
- package/docs/api/vegetationDraw.md +10 -0
- package/docs/api/water.md +6 -2
- package/docs/api/weather.md +5 -0
- package/docs/api/weatherDraw.md +10 -0
- package/docs/api/world.md +1 -1
- package/docs/recipes/01-new-game.md +19 -23
- package/docs/recipes/03-items-pickups.md +25 -4
- package/docs/recipes/05-props-bake.md +53 -37
- package/docs/recipes/06-clock-events.md +3 -3
- package/docs/recipes/07-flow-scenes-pause.md +12 -3
- package/docs/recipes/08-weather-sky.md +45 -57
- package/docs/recipes/09-materials-lights-models.md +185 -0
- package/docs/recipes/10-blender-level.md +2 -2
- package/docs/recipes/11-vehicles.md +3 -3
- package/docs/recipes/13-animation.md +13 -7
- package/docs/recipes/14-custom-module.md +7 -5
- package/docs/recipes/15-perf.md +3 -3
- package/docs/recipes/16-dev-bridge.md +22 -12
- package/docs/recipes/18-world.md +10 -8
- package/docs/recipes/19-shooting-picking.md +7 -5
- package/docs/recipes/20-content-actions-save.md +6 -2
- package/docs/recipes/21-camera.md +8 -3
- package/docs/recipes/23-ops.md +1 -1
- package/docs/recipes/26-ui-parts.md +35 -11
- package/docs/recipes/28-terrain.md +12 -12
- package/docs/recipes/29-grid.md +14 -5
- package/docs/recipes/30-templates.md +8 -3
- package/docs/recipes/31-audio.md +4 -4
- package/docs/recipes/32-action-game.md +18 -4
- package/docs/recipes/34-environment-lighting.md +102 -38
- package/docs/recipes/35-picture-from-reference.md +147 -0
- package/docs/recipes/36-sky-ground-plants.md +158 -0
- package/docs/recipes/{37-terrain-look-hooks.md → 37-terrain-hooks.md} +9 -13
- package/docs/recipes/38-environment-hooks.md +67 -0
- package/docs/recipes/40-scene.md +106 -27
- package/docs/recipes/42-terrain-shape.md +1 -1
- package/docs/recipes/{43-shader-patches-surface-looks.md → 43-shader-patches-surfaces.md} +66 -77
- package/docs/recipes/44-water-weather-hooks.md +191 -0
- package/docs/recipes/45-cascaded-shadows.md +121 -23
- package/docs/recipes/46-blender-art-route.md +17 -20
- package/docs/recipes/47-island-snow-backdrop.md +10 -12
- package/docs/recipes/49-game-module-contract.md +1 -1
- package/docs/recipes/50-own-renderer.md +3 -3
- package/docs/recipes/52-around-the-picture.md +181 -0
- package/docs/recipes/53-ground-up-close.md +12 -12
- package/docs/recipes/54-three-idioms.md +18 -18
- package/docs/recipes/55-mods-time-wrap.md +17 -5
- package/docs/recipes/56-webgpu-tsl.md +66 -23
- package/docs/recipes/57-control.md +39 -0
- package/docs/recipes/58-input.md +3 -0
- package/docs/recipes/59-depth-post-effects.md +5 -5
- package/docs/recipes/60-judge-the-picture.md +39 -24
- package/docs/recipes/61-deploy.md +27 -0
- package/docs/recipes/62-picture-code.md +244 -0
- package/docs/recipes/63-third-person-start.md +77 -0
- package/docs/recipes/64-particles.md +35 -0
- package/examples/action/.threedog/content-index.json +1 -1
- package/examples/action/GAMEMAP.md +7 -5
- package/examples/action/main.js +5 -4
- package/examples/action/models.js +12 -14
- package/examples/action/picture/index.js +13 -0
- package/examples/action/picture/lights.js +35 -0
- package/examples/action/picture/materials.js +8 -0
- package/examples/action/picture/palette.js +33 -0
- package/examples/plain-picture/.threedog/content-index.json +1 -0
- package/examples/plain-picture/FINDINGS.md +53 -0
- package/examples/plain-picture/GAMEMAP.md +90 -0
- package/examples/plain-picture/main.js +48 -0
- package/examples/plain-picture/picture/index.js +21 -0
- package/examples/plain-picture/picture/lights.js +54 -0
- package/examples/plain-picture/picture/materials.js +24 -0
- package/examples/plain-picture/picture/palette.js +16 -0
- package/examples/plain-picture/picture/sky.js +37 -0
- package/examples/pullable.json +31 -9
- package/examples/rc2d/GAMEMAP.md +8 -3
- package/examples/rc2d/README.md +11 -6
- package/examples/rc2d/main.js +25 -33
- package/examples/rc2d/picture/index.js +18 -0
- package/examples/rc2d/picture/lights.js +11 -0
- package/examples/rc2d/picture/materials.js +18 -0
- package/examples/rc2d/picture/palette.js +15 -0
- package/examples/rc2d/picture/post.js +11 -0
- package/examples/rc2d/rc2d.js +18 -28
- package/examples/sheepisland/.threedog/content-index.json +1 -1
- package/examples/sheepisland/GAMEMAP.md +13 -10
- package/examples/sheepisland/assets.js +2 -2
- package/examples/sheepisland/content/templates.js +1 -1
- package/examples/sheepisland/content/vegetation.js +3 -1
- package/examples/sheepisland/main.js +15 -9
- package/examples/sheepisland/{style/models.js → models.js} +13 -24
- package/examples/sheepisland/picture/index.js +20 -0
- package/examples/sheepisland/picture/lights.js +34 -0
- package/examples/sheepisland/picture/materials.js +61 -0
- package/examples/sheepisland/picture/palette.js +60 -0
- package/examples/sheepisland/picture/sky.js +20 -0
- package/examples/sheepisland/views.js +1 -1
- package/examples/styletest/.threedog/content-index.json +1 -1
- package/examples/styletest/GAMEMAP.md +15 -11
- package/examples/styletest/main.js +20 -30
- package/examples/styletest/models.js +29 -29
- package/examples/styletest/params.js +1 -4
- package/examples/styletest/picture/env.js +38 -0
- package/examples/styletest/picture/index.js +16 -0
- package/examples/styletest/picture/lights.js +9 -0
- package/examples/styletest/picture/materials.js +28 -0
- package/examples/styletest/picture/palette.js +22 -0
- package/examples/techniques/contact-shadows/README.md +22 -23
- package/examples/techniques/contact-shadows/contactShadows.js +32 -16
- package/examples/techniques/contact-shadows/main.js +20 -18
- package/examples/techniques/contact-shadows/picture/index.js +14 -0
- package/examples/techniques/contact-shadows/picture/lights.js +34 -0
- package/examples/techniques/contact-shadows/picture/materials.js +12 -0
- package/examples/techniques/contact-shadows/picture/palette.js +17 -0
- package/examples/techniques/day-night-grade/README.md +13 -16
- package/examples/techniques/day-night-grade/main.js +15 -25
- package/examples/techniques/day-night-grade/picture/index.js +20 -0
- package/examples/techniques/day-night-grade/picture/lights.js +45 -0
- package/examples/techniques/day-night-grade/picture/materials.js +15 -0
- package/examples/techniques/day-night-grade/picture/palette.js +59 -0
- package/examples/techniques/day-night-grade/picture/post.js +25 -0
- package/examples/techniques/day-night-grade/picture/sky.js +33 -0
- package/examples/techniques/interior-light/README.md +16 -13
- package/examples/techniques/interior-light/interiorLight.js +19 -17
- package/examples/techniques/interior-light/main.js +30 -67
- package/examples/techniques/interior-light/picture/index.js +24 -0
- package/examples/techniques/interior-light/picture/lights.js +52 -0
- package/examples/techniques/interior-light/picture/materials.js +13 -0
- package/examples/techniques/interior-light/picture/palette.js +32 -0
- package/examples/techniques/interior-light/picture/sky.js +40 -0
- package/examples/techniques/modular-building/README.md +4 -3
- package/examples/techniques/modular-building/kit.js +2 -2
- package/examples/techniques/modular-building/main.js +9 -17
- package/examples/techniques/modular-building/picture/index.js +17 -0
- package/examples/techniques/modular-building/picture/lights.js +26 -0
- package/examples/techniques/modular-building/picture/materials.js +13 -0
- package/examples/techniques/modular-building/picture/palette.js +23 -0
- package/examples/techniques/night-lights/README.md +15 -14
- package/examples/techniques/night-lights/main.js +20 -43
- package/examples/techniques/night-lights/nightLights.js +25 -21
- package/examples/techniques/night-lights/picture/index.js +18 -0
- package/examples/techniques/night-lights/picture/lights.js +44 -0
- package/examples/techniques/night-lights/picture/materials.js +15 -0
- package/examples/techniques/night-lights/picture/palette.js +34 -0
- package/examples/techniques/night-lights/picture/post.js +9 -0
- package/examples/techniques/night-lights/picture/sky.js +36 -0
- package/examples/techniques/outlines-and-rim/README.md +2 -2
- package/examples/techniques/outlines-and-rim/main.js +15 -38
- package/examples/techniques/outlines-and-rim/outlines.js +3 -3
- package/examples/techniques/outlines-and-rim/picture/index.js +16 -0
- package/examples/techniques/outlines-and-rim/picture/lights.js +18 -0
- package/examples/techniques/outlines-and-rim/picture/materials.js +11 -0
- package/examples/techniques/outlines-and-rim/picture/palette.js +16 -0
- package/examples/techniques/outlines-and-rim/picture/post.js +10 -0
- package/examples/techniques/procedural-animation/README.md +5 -3
- package/examples/techniques/procedural-animation/main.js +9 -7
- package/examples/techniques/procedural-animation/picture/index.js +15 -0
- package/examples/techniques/procedural-animation/picture/lights.js +35 -0
- package/examples/techniques/procedural-animation/picture/materials.js +10 -0
- package/examples/techniques/procedural-animation/picture/palette.js +16 -0
- package/examples/techniques/procedural-animation/picture/sky.js +31 -0
- package/examples/techniques/procedural-animation/proceduralAnim.js +1 -1
- package/examples/techniques/procedural-surface/README.md +2 -0
- package/examples/techniques/procedural-surface/main.js +17 -55
- package/examples/techniques/procedural-surface/picture/index.js +14 -0
- package/examples/techniques/procedural-surface/picture/lights.js +18 -0
- package/examples/techniques/procedural-surface/picture/materials.js +34 -0
- package/examples/techniques/procedural-surface/picture/palette.js +15 -0
- package/examples/techniques/stylized-shading/README.md +13 -14
- package/examples/techniques/stylized-shading/main.js +11 -42
- package/examples/techniques/stylized-shading/picture/index.js +14 -0
- package/examples/techniques/stylized-shading/picture/lights.js +23 -0
- package/examples/techniques/stylized-shading/picture/materials.js +18 -0
- package/examples/techniques/stylized-shading/picture/palette.js +19 -0
- package/examples/techniques/stylized-shading/shading.js +2 -2
- package/examples/techniques/sun-and-key-light/README.md +20 -22
- package/examples/techniques/sun-and-key-light/keyLight.js +47 -29
- package/examples/techniques/sun-and-key-light/main.js +19 -63
- package/examples/techniques/sun-and-key-light/picture/index.js +13 -0
- package/examples/techniques/sun-and-key-light/picture/lights.js +33 -0
- package/examples/techniques/sun-and-key-light/picture/materials.js +9 -0
- package/examples/techniques/sun-and-key-light/picture/palette.js +29 -0
- package/examples/techniques/sun-and-key-light/picture/sky.js +16 -0
- package/examples/techniques/three-looks/README.md +21 -0
- package/examples/techniques/three-looks/main.js +58 -0
- package/examples/techniques/three-looks/picture/cartoon.js +23 -0
- package/examples/techniques/three-looks/picture/cinematic.js +27 -0
- package/examples/techniques/three-looks/picture/comic.js +27 -0
- package/examples/techniques/three-looks/picture/index.js +14 -0
- package/examples/techniques/three-looks/picture/sun.js +23 -0
- package/examples/techniques/wet-road/README.md +7 -4
- package/examples/techniques/wet-road/main.js +18 -38
- package/examples/techniques/wet-road/picture/index.js +17 -0
- package/examples/techniques/wet-road/picture/lights.js +57 -0
- package/examples/techniques/wet-road/picture/materials.js +16 -0
- package/examples/techniques/wet-road/picture/palette.js +24 -0
- package/examples/techniques/wet-road/picture/sky.js +46 -0
- package/examples/webgpu-tsl/GAMEMAP.md +9 -4
- package/examples/webgpu-tsl/README.md +13 -10
- package/examples/webgpu-tsl/main.js +30 -7
- package/examples/webgpu-tsl/picture/index.js +18 -0
- package/examples/webgpu-tsl/picture/lights.js +25 -0
- package/examples/webgpu-tsl/picture/materials.js +36 -0
- package/examples/webgpu-tsl/picture/palette.js +23 -0
- package/examples/webgpu-tsl/picture/post.js +16 -0
- package/examples/webgpu-tsl/picture/sky.js +30 -0
- package/examples/world/.threedog/content-index.json +1 -1
- package/examples/world/GAMEMAP.md +15 -12
- package/examples/world/art/humanoid.js +9 -13
- package/examples/world/art/index.js +2 -2
- package/examples/world/art/models.js +3 -4
- package/examples/world/art/shapes.js +2 -2
- package/examples/world/assets.js +2 -2
- package/examples/world/content/audio.js +1 -1
- package/examples/world/content/items.js +1 -1
- package/examples/world/content/props.js +1 -1
- package/examples/world/content/templates.js +1 -1
- package/examples/world/content/vegetation.js +1 -1
- package/examples/world/main.js +10 -10
- package/examples/world/models.js +17 -7
- package/examples/world/picture/index.js +20 -0
- package/examples/world/picture/lights.js +41 -0
- package/examples/world/picture/materials.js +34 -0
- package/examples/world/picture/palette.js +74 -0
- package/examples/world/picture/post.js +9 -0
- package/examples/world/picture/sky.js +39 -0
- package/index.d.ts +7 -16
- package/index.js +7 -7
- package/llms.txt +15 -13
- package/modules/ambience/Ambience.js +1 -1
- package/modules/calendar/Calendar.js +1 -1
- package/modules/calendar/index.js +1 -0
- package/modules/camera/FirstPersonCamera.js +1 -1
- package/modules/camera/FixedCamera.js +2 -2
- package/modules/camera/RtsCamera.js +1 -1
- package/modules/camera/common.js +7 -5
- package/modules/characters/Character.js +15 -10
- package/modules/characters/NPC.js +5 -5
- package/modules/characters/assetModel.js +5 -4
- package/modules/characters/index.js +28 -3
- package/modules/characters/movers/common.js +6 -1
- package/modules/characters/movers/manual.js +3 -0
- package/modules/characters/movers/support.js +25 -11
- package/modules/characters/npcSim.js +5 -1
- package/modules/characters/proceduralRig.js +18 -4
- package/modules/characters/useModel.js +2 -2
- package/modules/collision/Collision.js +4 -2
- package/modules/content/index.js +8 -0
- package/modules/content/models.js +56 -11
- package/modules/content/props.js +5 -3
- package/modules/content/rules.js +12 -4
- package/modules/content/templates.js +5 -3
- package/modules/gameplay/Interactions.js +91 -16
- package/modules/gameplay/Inventory.js +3 -3
- package/modules/gameplay/dialogueBox.js +1 -1
- package/modules/gameplay/dialogueBubbles.js +1 -1
- package/modules/gameplay/interactionPrompt.js +1 -1
- package/modules/gameplay/interactions.contract.js +1 -1
- package/modules/gameplay/inventoryOps.js +2 -2
- package/modules/gameplay/pickups.js +62 -24
- package/modules/gameplay/questLog.js +2 -2
- package/modules/grid/Layer.js +13 -0
- package/modules/grid/index.js +40 -11
- package/modules/grid/preview.js +24 -15
- package/modules/grid/tiles.js +15 -19
- package/modules/hlod/index.js +3 -2
- package/modules/hud/index.js +13 -0
- package/modules/hud/parts.js +9 -7
- package/modules/level/index.js +5 -4
- package/modules/lights/index.js +12 -8
- package/modules/music/Music.js +1 -1
- package/modules/particles/Particles.js +41 -20
- package/modules/particles/effect.js +21 -6
- package/modules/photo/Photo.js +11 -10
- package/modules/settings/Settings.js +7 -7
- package/modules/settings/apply.js +5 -5
- package/modules/settings/sections.js +2 -2
- package/modules/settings/strings.js +1 -1
- package/modules/sky/Sky.js +104 -89
- package/modules/sky/clouds.js +16 -17
- package/modules/sky/dome.js +100 -0
- package/modules/sky/domeLayers.js +5 -5
- package/modules/sky/environment.js +45 -169
- package/modules/sky/fog.js +5 -180
- package/modules/sky/frame.js +26 -90
- package/modules/sky/season.js +3 -3
- package/modules/sky/shader.js +35 -29
- package/modules/sky/skyModule.js +25 -22
- package/modules/sky/tint.js +9 -11
- package/modules/terrain/ChunkManager.js +29 -12
- package/modules/terrain/draw.js +154 -0
- package/modules/terrain/index.js +44 -66
- package/modules/terrain/terrainDefaults.js +2 -2
- package/modules/terrain/terrainEdit.js +1 -1
- package/modules/terrain/terrainGen.js +2 -2
- package/modules/triggers/index.js +10 -6
- package/modules/vegetation/Vegetation.js +58 -17
- package/modules/vegetation/draw.js +191 -0
- package/modules/vegetation/groundChunks.js +1 -1
- package/modules/vegetation/index.js +10 -10
- package/modules/water/Water.js +135 -88
- package/modules/water/surface.js +53 -53
- package/modules/weather/Weather.js +52 -17
- package/modules/weather/particles.js +13 -5
- package/modules/weather/shaders.js +1 -1
- package/modules/weather/weatherDraw.js +141 -0
- package/modules/world/World.js +2 -2
- package/modules/world/views.js +1 -1
- package/package.json +3 -2
- package/presets.js +2 -2
- package/render/PostFX.js +199 -41
- package/render/backend.js +52 -6
- package/render/cascades.js +195 -0
- package/render/cascades.tsl.js +96 -0
- package/render/daylight.js +39 -0
- package/render/detail.js +5 -5
- package/render/effects.js +41 -26
- package/render/fx/cel.tsl.js +42 -0
- package/render/fx/index.js +7 -5
- package/render/fx/patchNodes.tsl.js +1 -1
- package/render/fx/postWebGPU.tsl.js +30 -7
- package/render/fx/sky.tsl.js +19 -92
- package/render/fx/water.tsl.js +1 -1
- package/render/layers.js +14 -0
- package/render/lighting.js +6 -5
- package/render/lightmap.js +142 -0
- package/render/lights.js +23 -201
- package/render/materials.js +44 -160
- package/render/neutral.js +23 -0
- package/render/occlusion.js +184 -0
- package/render/ownFrame.js +1 -1
- package/render/patches.js +34 -29
- package/render/postWebGL.js +11 -3
- package/render/probes.js +179 -122
- package/render/slots.js +4 -4
- package/render/terms.js +53 -101
- package/render/uniformDecl.js +1 -1
- package/types/core.d.ts +333 -296
- package/types/gameplay.d.ts +65 -26
- package/types/generated/core/Audio.d.ts +1 -1
- package/types/generated/core/DebugOverrides.d.ts +14 -6
- package/types/generated/core/Input.d.ts +9 -2
- package/types/generated/core/page.d.ts +9 -2
- package/types/generated/modules/grid/Layer.d.ts +8 -0
- package/types/generated/modules/grid/index.d.ts +29 -5
- package/types/generated/modules/particles/Particles.d.ts +13 -6
- package/types/generated/modules/sky/Sky.d.ts +85 -18
- package/types/generated/modules/sky/skyModule.d.ts +1 -1
- package/types/generated/modules/water/Water.d.ts +50 -3
- package/types/generated/modules/weather/Weather.d.ts +33 -3
- package/types/generated/modules/weather/weatherDraw.d.ts +11 -0
- package/types/generated/modules/world/World.d.ts +2 -2
- package/types/generated/render/PostFX.d.ts +53 -10
- package/types/generated/render/lighting.d.ts +29 -0
- package/types/generated/render/materials.d.ts +19 -44
- package/types/generated/render/occlusion.d.ts +13 -0
- package/types/physics.d.ts +5 -3
- package/types/tsl.d.ts +8 -0
- package/types/world.d.ts +376 -57
- package/ui/Focus.js +12 -2
- package/ui/LoadingScreen.js +2 -2
- package/ui/Parts.js +8 -4
- package/ui/UI.js +10 -10
- package/ui/cursor.js +1 -1
- package/ui/theme.js +33 -27
- package/ui/touchPart.js +1 -1
- package/core/look/coreParts.js +0 -219
- package/core/look/part.js +0 -253
- package/core/look/points.js +0 -255
- package/core/look/report.js +0 -96
- package/core/look/shadowPart.js +0 -63
- package/core/look/state.js +0 -45
- package/core/look/write.js +0 -70
- package/core/styleParts.js +0 -114
- package/docs/api/style.md +0 -136
- package/docs/api/terrainLook.md +0 -10
- package/docs/api/vegetationLook.md +0 -10
- package/docs/api/weatherLook.md +0 -10
- package/docs/recipes/09-style.md +0 -218
- package/docs/recipes/35-style-from-reference.md +0 -153
- package/docs/recipes/36-sky-ground-plant-looks.md +0 -118
- package/docs/recipes/38-environment-look-hooks.md +0 -99
- package/docs/recipes/41-thing-registry.md +0 -97
- package/docs/recipes/44-water-weather-look-hooks.md +0 -144
- package/docs/recipes/48-make-material.md +0 -75
- package/docs/recipes/52-look.md +0 -282
- package/examples/action/look.js +0 -5
- package/examples/sheepisland/style/index.js +0 -79
- package/examples/styletest/look.js +0 -11
- package/examples/techniques/day-night-grade/dayNightGrade.js +0 -76
- package/examples/webgpu-tsl/tslScene.js +0 -75
- package/examples/world/style/index.js +0 -61
- package/examples/world/style/plugins/10-bloom.js +0 -5
- package/modules/sky/cascades.js +0 -186
- package/modules/sky/cascades.tsl.js +0 -82
- package/modules/sky/look.js +0 -54
- package/modules/sky/lookFog.js +0 -76
- package/modules/sky/lookShadow.js +0 -62
- package/modules/sky/lookSky.js +0 -169
- package/modules/sky/shadow.js +0 -98
- package/modules/terrain/look.js +0 -83
- package/modules/terrain/lookGround.js +0 -66
- package/modules/vegetation/look.js +0 -119
- package/modules/vegetation/lookWind.js +0 -98
- package/modules/water/look.js +0 -91
- package/modules/water/surfaceDefaults.js +0 -3
- package/modules/weather/look.js +0 -74
- package/modules/weather/weatherLook.js +0 -135
- package/render/lookGlow.js +0 -139
- package/render/lookSurface.js +0 -224
- package/render/postLook.js +0 -164
- package/render/surface.js +0 -105
- package/types/generated/modules/weather/weatherLook.d.ts +0 -12
- package/types/style.d.ts +0 -671
package/types/gameplay.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Gameplay modules: timeline, level, triggers, world changes, particles, settings, music, characters/NPCs, interactions, dialogue, inventory,
|
|
2
2
|
// quests, photo mode, ambience, debug.
|
|
3
|
-
import type { Object3D, Vector3, Vector2, Quaternion, Texture, ColorLike, Vec3Like, Ease, Handle, Range, XZ, Loose, PositionLike } from './common';
|
|
3
|
+
import type { Object3D, Vector3, Vector2, Quaternion, Texture, ColorLike, Vec3Like, Ease, Handle, Range, XZ, Loose, PositionLike, Material } from './common';
|
|
4
4
|
import type { Engine } from './core';
|
|
5
5
|
import type { Input } from './generated/core/Input';
|
|
6
6
|
import type { Animator, AnimatorOptions, Rideable } from './physics';
|
|
@@ -112,8 +112,6 @@ export interface LevelLoadedEvent { root: Object3D; markers: Record<string, Leve
|
|
|
112
112
|
export interface Level {
|
|
113
113
|
/** Scene root node */
|
|
114
114
|
root: Object3D | null;
|
|
115
|
-
/** Same as root (the name consistent with player.object and ent.object) */
|
|
116
|
-
readonly object: Object3D | null;
|
|
117
115
|
/** All markers: name -> marker */
|
|
118
116
|
markers: Record<string, LevelMarker>;
|
|
119
117
|
/** Spawn point position */
|
|
@@ -213,13 +211,16 @@ export interface TriggerEvent { tag: string; trigger: Trigger; who: Vector3 | nu
|
|
|
213
211
|
export interface TriggersOptions {
|
|
214
212
|
/** Action name that toggles the debug view 'triggers' (engine.debug.view), default 'triggersDebug' */
|
|
215
213
|
action?: string;
|
|
214
|
+
/** Line color of the debug view 'triggers', default neutral gray */
|
|
215
|
+
debugColor?: ColorLike;
|
|
216
|
+
/** Line opacity of the debug view 'triggers', default 0.8 */
|
|
217
|
+
debugOpacity?: number;
|
|
216
218
|
}
|
|
217
219
|
|
|
218
220
|
/** engine.triggers */
|
|
219
221
|
export interface Triggers {
|
|
220
222
|
/** All trigger zones (a new array) */
|
|
221
223
|
list(): Trigger[];
|
|
222
|
-
action: string;
|
|
223
224
|
/** Add a trigger zone */
|
|
224
225
|
add(opts?: TriggerOptions): Trigger;
|
|
225
226
|
/** Delete all (delete a single one with trigger.remove()) */
|
|
@@ -234,7 +235,7 @@ export interface Triggers {
|
|
|
234
235
|
// Particles particles()
|
|
235
236
|
// ======================================================================
|
|
236
237
|
|
|
237
|
-
/** Particle effect parameters (
|
|
238
|
+
/** Particle effect parameters (define(), and each entry of particles({ effects, default })). All optional */
|
|
238
239
|
export interface ParticleOptions {
|
|
239
240
|
/** Maximum alive at once, default 120 (halved on low-end devices) */
|
|
240
241
|
max?: number;
|
|
@@ -288,7 +289,21 @@ export interface ParticleEmitter extends Handle {
|
|
|
288
289
|
[key: string]: any;
|
|
289
290
|
}
|
|
290
291
|
/** A particle effect */
|
|
291
|
-
export interface ParticleEffect {
|
|
292
|
+
export interface ParticleEffect {
|
|
293
|
+
name: string; o: ParticleOptions; max: number; alive: number; points: Object3D;
|
|
294
|
+
/** The plain three.js material drawn; set yours and it is drawn as given, null gives the engine's back */
|
|
295
|
+
material: Material | null;
|
|
296
|
+
/** The engine material's { value } objects (uMap, uHasMap, uScale, uMaxPx), written whichever material is drawn; a ShaderMaterial of yours can share them */
|
|
297
|
+
readonly uniforms: Record<string, { value: any }>;
|
|
298
|
+
[key: string]: any;
|
|
299
|
+
}
|
|
300
|
+
/** particles() options */
|
|
301
|
+
export interface ParticlesOptions {
|
|
302
|
+
/** Effect params by name: under what define() gives, and defined on the first emit / attach when define() never ran */
|
|
303
|
+
effects?: Record<string, ParticleOptions>;
|
|
304
|
+
/** Params every effect starts from */
|
|
305
|
+
default?: ParticleOptions;
|
|
306
|
+
}
|
|
292
307
|
|
|
293
308
|
// Particles (engine.particles) is generated from the JSDoc in modules/particles/Particles.js (npm run map); only the type is re-exported here
|
|
294
309
|
import type { Particles } from './generated/modules/particles/Particles';
|
|
@@ -354,7 +369,6 @@ export interface SettingsOptions {
|
|
|
354
369
|
|
|
355
370
|
/** engine.settings */
|
|
356
371
|
export interface Settings {
|
|
357
|
-
action: string;
|
|
358
372
|
/** All current setting values */
|
|
359
373
|
values: Record<string, any>;
|
|
360
374
|
/** Graphics presets */
|
|
@@ -445,7 +459,7 @@ export interface CharacterFacts { base: string; speed: number; grounded: boolean
|
|
|
445
459
|
export type CharacterStates = (character: Character, facts: CharacterFacts) => string | null | undefined;
|
|
446
460
|
/** Character parameters (shared by the player and NPCs) */
|
|
447
461
|
export interface CharacterOptions {
|
|
448
|
-
/** Per-character part colors: recolor the body's meshes marked userData.part (a humanoid rig: body, skin, legs, hair)
|
|
462
|
+
/** Per-character part colors: recolor the body's meshes marked userData.part (a humanoid rig: body, skin, legs, hair) */
|
|
449
463
|
colors?: { body?: ColorLike; skin?: ColorLike; legs?: ColorLike; hair?: ColorLike };
|
|
450
464
|
/** Walking speed (m/s), default 4.5 */
|
|
451
465
|
speed?: number;
|
|
@@ -843,6 +857,12 @@ export interface NPCManager {
|
|
|
843
857
|
}
|
|
844
858
|
/** engine.characters */
|
|
845
859
|
export interface CharactersApi {
|
|
860
|
+
/**
|
|
861
|
+
* The three.js material of every placeholder capsule. Set it to swap the look of all of them at once; used as given, with no patches added. A character
|
|
862
|
+
* with colors.body draws with a copy of it in that color. A model's own materials are the model's.
|
|
863
|
+
* @example engine.characters.material = new THREE.MeshToonMaterial({ color: 0xd9a066 });
|
|
864
|
+
*/
|
|
865
|
+
material: Material;
|
|
846
866
|
/**
|
|
847
867
|
* Find a spawn point: searches outward from position (default origin) for walkable (not steep, no obstacle), non-water ground, without assuming
|
|
848
868
|
* terrain height; e.g. findSpawn(v, { minH: 3, maxH: 20 }). Returns a Vector3 (y is the ground height)
|
|
@@ -903,6 +923,8 @@ export interface CharactersOptions {
|
|
|
903
923
|
npcs?: boolean;
|
|
904
924
|
/** Near tiers for large NPC crowds, off by default (every near NPC walks every fixed step); same as engine.npcs.tiers(opts) */
|
|
905
925
|
npcTiers?: { fullRadius: number; nearEvery: number };
|
|
926
|
+
/** What every character's Animator starts from, e.g. { fade: 0.15 }; a model's manifest mapping and the character's own animation win over it */
|
|
927
|
+
animation?: AnimatorOptions;
|
|
906
928
|
}
|
|
907
929
|
/**
|
|
908
930
|
* Pathfinding options: step is the grid size (meters, A*), maxNodes the maximum cells searched (A*), radius the character radius (meters,
|
|
@@ -919,7 +941,7 @@ export interface InteractionOptions {
|
|
|
919
941
|
id?: string;
|
|
920
942
|
/** Prompt text, or a function (object, { actor }) returning text; actor = world record id of who looks at it */
|
|
921
943
|
label?: string | ((object: Object3D, ctx: { actor: string }) => string);
|
|
922
|
-
/** How close the actor must be (meters),
|
|
944
|
+
/** How close the actor must be (meters), measured from the object's origin in 3D, not its edge, so a large object (a boat, a house) needs a larger radius or a small marker object at the spot to use. Default interactions({ radius }) = 2.5 */
|
|
923
945
|
radius?: number;
|
|
924
946
|
/** Key action name, default 'interact' (E key). Give one object a second verb by adding another interaction with another action */
|
|
925
947
|
action?: string;
|
|
@@ -942,10 +964,13 @@ export interface InteractionOptions {
|
|
|
942
964
|
hold?: number;
|
|
943
965
|
/** Walk the player there first (walkTo, stops 1.2 m away), then use it; with radius: Infinity it can be used from anywhere (point-and-click) */
|
|
944
966
|
approach?: boolean;
|
|
967
|
+
/** Hide the object after a use and allow no second one (onUse returning { ok: false } leaves it). Saved under id, else the object's name; development throws when it has neither */
|
|
968
|
+
once?: boolean;
|
|
969
|
+
/** Name of a HUD counter each use adds 1 to (hud.add; nothing without hud()). Saved; read the total with hud.value(name) */
|
|
970
|
+
counter?: string;
|
|
945
971
|
}
|
|
946
972
|
/** engine.interactions */
|
|
947
973
|
export interface Interactions {
|
|
948
|
-
action: string;
|
|
949
974
|
/** How high the prompt floats (meters) */
|
|
950
975
|
promptHeight: number;
|
|
951
976
|
/** All interactions in the order added (a fresh array each read; get(id) finds one without it) */
|
|
@@ -976,10 +1001,10 @@ export interface Interactions {
|
|
|
976
1001
|
export interface PromptView {
|
|
977
1002
|
/** Interaction id */
|
|
978
1003
|
id: string;
|
|
979
|
-
/** Action that uses it ('interact') and its key label ('E') */
|
|
1004
|
+
/** Action that uses it ('interact') and its key label ('E'; 'No key' when the action needs one and has none, '' when it has none on purpose) */
|
|
980
1005
|
action: string;
|
|
981
1006
|
key: string;
|
|
982
|
-
/** The interaction's label, and the default text 'E · label' */
|
|
1007
|
+
/** The interaction's label, and the default text 'E · label' ('label' alone with an empty key) */
|
|
983
1008
|
label: string;
|
|
984
1009
|
text: string;
|
|
985
1010
|
/** Screen pixels above the target */
|
|
@@ -1230,7 +1255,7 @@ export interface PickupOptions {
|
|
|
1230
1255
|
name?: string;
|
|
1231
1256
|
/** Shape on the ground: a model name from an asset pack (default the item's model, else 'pickup:<item>', else 'pickup', else a gray box) */
|
|
1232
1257
|
model?: string;
|
|
1233
|
-
/** Color of the gray placeholder / a geometry-only model (default the item's color, else
|
|
1258
|
+
/** Color of the gray placeholder / a geometry-only model (default the item's color, else pickups({ color })) */
|
|
1234
1259
|
color?: ColorLike;
|
|
1235
1260
|
/** Reach in meters, default pickups({ radius }) (2) */
|
|
1236
1261
|
radius?: number;
|
|
@@ -1256,6 +1281,16 @@ export interface Pickups {
|
|
|
1256
1281
|
radius: number;
|
|
1257
1282
|
/** Who walks into auto pickups: default engine.actor plus net peers on a host, none on a client */
|
|
1258
1283
|
takers: (e: Engine) => string[];
|
|
1284
|
+
/**
|
|
1285
|
+
* The three.js material of every placeholder box and geometry-only model. Set it to swap all of them at once; used as given. A pickup with its own color or a
|
|
1286
|
+
* vertex-colored geometry draws with a copy of it carrying that color
|
|
1287
|
+
* @example engine.pickups.material = new THREE.MeshStandardMaterial({ color: 0xffd24a, metalness: 0.8 })
|
|
1288
|
+
*/
|
|
1289
|
+
material: Material;
|
|
1290
|
+
/** Edge of the placeholder box (meters), read when one is built */
|
|
1291
|
+
size: number;
|
|
1292
|
+
/** Height above the ground new pickups float at (meters) */
|
|
1293
|
+
lift: number;
|
|
1259
1294
|
/**
|
|
1260
1295
|
* Place a pickup on the ground at position; its y, if any, is the reference height on multi-layer ground (needs the interactions module unless auto):
|
|
1261
1296
|
* spawn(v, { give: 'berry', count: 2 }). Returns a handle, remove() deletes it
|
|
@@ -1271,6 +1306,12 @@ export interface PickupsOptions {
|
|
|
1271
1306
|
showDistance?: number;
|
|
1272
1307
|
/** Who walks into auto pickups (actor ids); default engine.actor, plus net peers on a host */
|
|
1273
1308
|
takers?: (e: Engine) => string[];
|
|
1309
|
+
/** Color of the placeholder box and geometry-only models when the pickup and its item set none, default 0xcccccc */
|
|
1310
|
+
color?: ColorLike;
|
|
1311
|
+
/** Edge of the placeholder box (meters), default 0.25 */
|
|
1312
|
+
size?: number;
|
|
1313
|
+
/** Height above the ground a pickup floats at (meters), default 0.4 */
|
|
1314
|
+
lift?: number;
|
|
1274
1315
|
}
|
|
1275
1316
|
|
|
1276
1317
|
/**
|
|
@@ -1319,8 +1360,6 @@ export interface Container {
|
|
|
1319
1360
|
export interface Inventory {
|
|
1320
1361
|
/** true: gameplay freezes while the inventory window is open (set from inventory({ pauseGame }) or at runtime) */
|
|
1321
1362
|
pauseGame: boolean;
|
|
1322
|
-
/** Item definitions */
|
|
1323
|
-
defs: Map<string, ItemDef>;
|
|
1324
1363
|
/** Slot limit of the player inventory */
|
|
1325
1364
|
capacity: number;
|
|
1326
1365
|
/** Player inventory: the bag of engine.actor (= of()) */
|
|
@@ -1426,7 +1465,6 @@ export interface QuestDef {
|
|
|
1426
1465
|
}
|
|
1427
1466
|
/** engine.quests */
|
|
1428
1467
|
export interface Quests {
|
|
1429
|
-
defs: Map<string, QuestDef>;
|
|
1430
1468
|
/** The quest log (UI part 'questLog'): open, toggle(on?), refresh() */
|
|
1431
1469
|
win: { readonly open: boolean; toggle(on?: boolean): void; refresh(): void };
|
|
1432
1470
|
/** Define a quest (chainable) */
|
|
@@ -1568,6 +1606,8 @@ export interface WindowOptions {
|
|
|
1568
1606
|
data?: () => any;
|
|
1569
1607
|
/** What to do on the back key (Esc), default closes the window (an open window is on the UI focus stack, and Esc goes only to the topmost) */
|
|
1570
1608
|
onCancel?: () => void;
|
|
1609
|
+
/** false: no close button and Esc does nothing, so only the game's own buttons end it (a win or lose window must not drop the player back into the game). Default true */
|
|
1610
|
+
closable?: boolean;
|
|
1571
1611
|
}
|
|
1572
1612
|
/** An entry of the UI focus stack (returned by uiFocus(engine).push) */
|
|
1573
1613
|
export interface FocusHandle extends Handle {
|
|
@@ -1644,7 +1684,7 @@ export interface ModHandle {
|
|
|
1644
1684
|
change(value: any): boolean;
|
|
1645
1685
|
}
|
|
1646
1686
|
/** Shared-point layers, lowest first. Most code never passes one: game code and game modules are 'game'; effects (weather, bullet time) pass 'effect' */
|
|
1647
|
-
export type SharedLayer = 'engine' | '
|
|
1687
|
+
export type SharedLayer = 'engine' | 'game' | 'effect' | 'system' | 'settings' | 'debug';
|
|
1648
1688
|
/**
|
|
1649
1689
|
* engine.mod options: exactly one of set / add / mul / clamp on a number point (set on a value point); none on a hold ('freeze') or a slot;
|
|
1650
1690
|
* value on a 'top' point. Inside a layer: set, then add, then mul, then clamp; a higher layer's set hides what is below. Two owners setting one
|
|
@@ -1672,11 +1712,6 @@ export interface Stack {
|
|
|
1672
1712
|
readonly name: string; readonly kind: 'number' | 'value' | 'any' | 'top' | 'one';
|
|
1673
1713
|
/** The describe().shared row */
|
|
1674
1714
|
row(id?: string): SharedRow;
|
|
1675
|
-
/** Whoever applies this point to a three.js property saw an outside write: stop applying it (check yielded); describe says writer three */
|
|
1676
|
-
yieldToThree(at?: string | null): void;
|
|
1677
|
-
/** Hand a yielded point back to the layers */
|
|
1678
|
-
reclaim(): void;
|
|
1679
|
-
readonly yielded: boolean;
|
|
1680
1715
|
/** The current value, always recomputed from base + the entries now present (a slot: the holder's name or null) */
|
|
1681
1716
|
value(id?: string): any;
|
|
1682
1717
|
holders(id?: string): ModHolder[];
|
|
@@ -1773,8 +1808,8 @@ export interface PropDef {
|
|
|
1773
1808
|
/** Rotation about the Y axis (radians) */
|
|
1774
1809
|
rot?: number;
|
|
1775
1810
|
scale?: number;
|
|
1776
|
-
/** Collision: 'box' cuboid, 'circle' cylinder, false none (default) */
|
|
1777
|
-
collide?: 'box' | 'circle' | false;
|
|
1811
|
+
/** Collision: 'box' cuboid of the bounds, 'circle' cylinder on the model's base, { circle, occluder } the same with its radius in model meters (scales with the prop) and occluder: false so the follow camera passes it; false none (default) */
|
|
1812
|
+
collide?: 'box' | 'circle' | false | { circle: number; occluder?: boolean };
|
|
1778
1813
|
/** Register for ray acceleration (engine.raycast can hit it), default true */
|
|
1779
1814
|
static?: boolean;
|
|
1780
1815
|
/** false: never drawn through engine.batching (default: repeated props batch automatically) */
|
|
@@ -1849,8 +1884,8 @@ export interface ContentField {
|
|
|
1849
1884
|
export interface ContentTemplate {
|
|
1850
1885
|
/** Model name (style generator or assets name); every instance clones one shared prototype */
|
|
1851
1886
|
model: string | any[];
|
|
1852
|
-
/** Collision box
|
|
1853
|
-
collide?: 'box' | 'circle';
|
|
1887
|
+
/** Collision: 'box' cuboid of the bounds, 'circle' cylinder on the model's base, { circle, occluder } the same with its radius in model meters (scales with the instance) and occluder: false so the follow camera passes it; omitted or false = does not block */
|
|
1888
|
+
collide?: 'box' | 'circle' | false | { circle: number; occluder?: boolean };
|
|
1854
1889
|
/** false = not registered for rays */
|
|
1855
1890
|
static?: boolean;
|
|
1856
1891
|
/** Interaction: using an instance runs op with { id } */
|
|
@@ -1985,6 +2020,10 @@ export interface Hud {
|
|
|
1985
2020
|
marker(target: HudTarget, opts?: HudMarkerOptions): HudMarker;
|
|
1986
2021
|
/** Counter or text status (calling again with the same id = update; calling every frame is fine): counter('fish', { label: '鱼', value: 2, max: 5 }), counter('clock', { value: '08:30' }); no value = the label alone */
|
|
1987
2022
|
counter(id: string, opts: { label?: string; icon?: string; value?: number | string; max?: number; anchor?: HudAnchor }): void;
|
|
2023
|
+
/** Add n (default 1) to a number counter, return the new value; one not declared yet starts at 0 with its id as the label */
|
|
2024
|
+
add(id: string, n?: number): number;
|
|
2025
|
+
/** Current value of a counter or bar (number or text), undefined when there is none; reads what interactions.add({ counter }) has added up */
|
|
2026
|
+
value(id: string): number | string | undefined;
|
|
1988
2027
|
/** Progress bar (calling again with the same id = update; calling every frame is fine, the DOM is untouched when the value is unchanged),
|
|
1989
2028
|
* value/max 0–max */
|
|
1990
2029
|
bar(id: string, opts: { value: number; max?: number; label?: string; anchor?: HudAnchor }): void;
|
|
@@ -75,7 +75,7 @@ export class Audio {
|
|
|
75
75
|
* @param {(e: any) => number} fn
|
|
76
76
|
* @returns {{ remove(): void }}
|
|
77
77
|
* @example engine.audio.measure('danger', e => e.vars.counter('alarm') / 10); // data: when: { danger: { gt: 0.5 } }
|
|
78
|
-
* Measures are not only for sound: render/
|
|
78
|
+
* Measures are not only for sound: render/daylight.js reads 'daylight' for night glow, so the calendar (or the sky without one) registers it once
|
|
79
79
|
* and nothing else has to know which module tells day from night. remove() drops only this registration (a later one under the name stays).
|
|
80
80
|
*/
|
|
81
81
|
measure(name: string, fn: (e: any) => number): {
|
|
@@ -6,7 +6,7 @@ export class DebugOverrides {
|
|
|
6
6
|
* Diagnostic view: 'albedo' | 'lighting' | 'shadow' | 'normals' to look at one part of the render, 'overdraw' (bright = many layers on a pixel),
|
|
7
7
|
* 'shaderCost' (materials green -> red by compiled program cost, approximate), 'off' to restore; modules add their own (triggers: 'triggers' draws
|
|
8
8
|
* the trigger zones), viewModes() lists them all. Temporary and owner-scoped; never saved
|
|
9
|
-
* (describe().render says which view is active, so it is not mistaken for the real
|
|
9
|
+
* (describe().render says which view is active, so it is not mistaken for the real picture). While one owner's view is on, another owner can neither switch it
|
|
10
10
|
* nor turn it off without force: true; engine.debug.clear(owner) turns that owner's view off too.
|
|
11
11
|
* @example engine.debug.view('normals'); // look at the screenshot, then engine.debug.view('off')
|
|
12
12
|
* @param {'albedo' | 'lighting' | 'shadow' | 'normals' | 'overdraw' | 'shaderCost' | 'off' | string} mode @param {{ owner?: string, force?: boolean }} [opts]
|
|
@@ -69,18 +69,26 @@ export class DebugOverrides {
|
|
|
69
69
|
/**
|
|
70
70
|
* Change how an object looks for diagnosis, owned by `owner`. Returns { remove() }. Never saved, never part of the game state; listed in
|
|
71
71
|
* describe().scene.overrides while active. A thing id is remembered as the id: when that thing is removed, or a load replaces it, the override is dropped.
|
|
72
|
+
* Any three.js value: override(owner, object, key, value) writes object[key] and keeps it there every frame, above picture code that writes it in
|
|
73
|
+
* onRender, so "show me this with exposure 3" holds; remove() puts the old value back.
|
|
72
74
|
* @param {string} owner who sets it (a tool or session name); engine.debug.clear(owner) removes all of that owner's overrides
|
|
73
|
-
* @param {
|
|
74
|
-
* @param {{ visible?: boolean, material?: 'flat' | 'wire', apply?: (obj: any) => (() => void) | void }} patch flat = unlit base colour, wire = wireframe, apply = your own change (return its undo)
|
|
75
|
+
* @param {any} target a thing id (engine.thing), an object name or any Object3D; with a key, any three.js object (renderer, scene, a light, a material) is that part's set() values, written on its debug layer above every game owner
|
|
76
|
+
* @param {string | { visible?: boolean, material?: 'flat' | 'wire', apply?: (obj: any) => (() => void) | void }} patch flat = unlit base colour, wire = wireframe, apply = your own change (return its undo); a string: the property to write
|
|
77
|
+
* @param {any} [value] with a property name: its value, of the type the property holds (null works: scene.fog off)
|
|
75
78
|
* @example const h = engine.debug.override('ai-session', 'windmill', { material: 'flat' }); h.remove(); // or engine.debug.clear('ai-session')
|
|
79
|
+
* @example engine.debug.override('ai-session', engine.renderer, 'toneMappingExposure', 3);
|
|
80
|
+
* engine.debug.override('ai-session', engine.scene, 'fog', null); // the same picture with no fog
|
|
81
|
+
* @returns {{ remove(): void }}
|
|
76
82
|
*/
|
|
77
|
-
override(owner: string, target:
|
|
83
|
+
override(owner: string, target: any, patch: string | {
|
|
78
84
|
visible?: boolean;
|
|
79
85
|
material?: "flat" | "wire";
|
|
80
86
|
apply?: (obj: any) => (() => void) | void;
|
|
81
|
-
}):
|
|
87
|
+
}, value?: any): {
|
|
88
|
+
remove(): void;
|
|
89
|
+
};
|
|
82
90
|
/**
|
|
83
|
-
* Remove every override of one owner (nothing else),
|
|
91
|
+
* Remove every override of one owner (nothing else), and its view; returns how many were removed
|
|
84
92
|
* @param {string} owner
|
|
85
93
|
*/
|
|
86
94
|
clear(owner: string): number;
|
|
@@ -95,6 +95,13 @@ export class Input {
|
|
|
95
95
|
* @param {string} action @returns {readonly string[]}
|
|
96
96
|
*/
|
|
97
97
|
keysOf(action: string): readonly string[];
|
|
98
|
+
/**
|
|
99
|
+
* True when an action needs a key and has none, so no player input can fire it. Not for an optional action, and not for one bound to [] on purpose
|
|
100
|
+
* (a mouse-only game): "no key at all" is the fault, whichever key the game or the player chose is not.
|
|
101
|
+
* @param {string} action @returns {boolean}
|
|
102
|
+
* @example if (engine.input.isUnbound('interact')) engine.input.bind(presets.bindings.interact);
|
|
103
|
+
*/
|
|
104
|
+
isUnbound(action: string): boolean;
|
|
98
105
|
/** Key name shown in the UI, e.g. "E" @param {string} action @returns {string} */
|
|
99
106
|
label(action: string): string;
|
|
100
107
|
/** Held (a snapshot of this step in fixed, the latest state in frame) @param {string} action @returns {boolean} */
|
|
@@ -137,7 +144,7 @@ export class Input {
|
|
|
137
144
|
remove(): void;
|
|
138
145
|
};
|
|
139
146
|
/**
|
|
140
|
-
* describe().input: the context stack, declared actions nobody bound (unbound
|
|
147
|
+
* describe().input: the context stack, declared actions nobody bound (unbound: isUnbound) and the player's rebindings
|
|
141
148
|
* @returns {{ stack: string[], unbound: string[], rebound: Record<string, string[]> }}
|
|
142
149
|
*/
|
|
143
150
|
describe(): {
|
|
@@ -173,7 +180,7 @@ export class Input {
|
|
|
173
180
|
remove(): void;
|
|
174
181
|
};
|
|
175
182
|
/**
|
|
176
|
-
* False while an opaque context (menu, dialogue, cutscene...) covers gameplay: no game action can be read, and cameras ignore
|
|
183
|
+
* False while an opaque context (menu, dialogue, cutscene...) covers gameplay: no game action can be read, and cameras ignore picture/zoom @returns {boolean}
|
|
177
184
|
*/
|
|
178
185
|
get enabled(): boolean;
|
|
179
186
|
/**
|
|
@@ -9,10 +9,17 @@ export class Page {
|
|
|
9
9
|
visible: boolean;
|
|
10
10
|
/** The mouse is locked to the canvas (first-person / shoulder cameras lock on click) @type {boolean} */
|
|
11
11
|
pointerLocked: boolean;
|
|
12
|
-
/** The WebGL context is lost and not yet restored @type {boolean} */
|
|
12
|
+
/** The WebGL context is lost and not yet restored, or the WebGPU device is lost @type {boolean} */
|
|
13
13
|
contextLost: boolean;
|
|
14
14
|
/** The page is away: the window lost focus or the tab is hidden @type {boolean} */
|
|
15
15
|
get away(): boolean;
|
|
16
|
-
/** The real-time loop holds gameplay now (away with pauseOnBlur, or the WebGL context is lost) @type {boolean} */
|
|
16
|
+
/** The real-time loop holds gameplay now (away with pauseOnBlur, or the WebGL context / WebGPU device is lost) @type {boolean} */
|
|
17
17
|
get held(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 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
|
+
* click on the view locks again.
|
|
21
|
+
* @returns {void}
|
|
22
|
+
* @example engine.page.releaseLock(); showMyMap();
|
|
23
|
+
*/
|
|
24
|
+
releaseLock(): void;
|
|
18
25
|
}
|
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
export class Layer {
|
|
4
4
|
/** Layer name @type {string} */
|
|
5
5
|
name: string;
|
|
6
|
+
set material(m: import("three").Material | null);
|
|
7
|
+
/**
|
|
8
|
+
* The three.js material of this layer's tiles (null when it draws none: a data layer, tiles: false or your own part). Set it to swap the picture, used as given.
|
|
9
|
+
* Tile colors are vertex colors, so a material with vertexColors: true shows them; without it, its own color covers every tile.
|
|
10
|
+
* @example field.layer('soil').material = new THREE.MeshStandardMaterial({ vertexColors: true, roughness: 1 });
|
|
11
|
+
* @type {import('three').Material | null}
|
|
12
|
+
*/
|
|
13
|
+
get material(): import("three").Material | null;
|
|
6
14
|
/**
|
|
7
15
|
* Data of a cell, or undefined. Read only (frozen in dev builds): change it with set / clear / updateAll
|
|
8
16
|
* @example field.layer('zone').get([3, 5])?.buildable
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/grid/index.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* Options of grids()
|
|
4
|
+
* @typedef {{ ok?: any, bad?: any, previewOpacity?: number, previewHeight?: number, tiles?: Record<string, Record<string, any>>, tileLift?: number }} GridsOptions
|
|
5
|
+
*/
|
|
2
6
|
/**
|
|
3
7
|
* Grid placement module: installed as engine.grids. Needs world(). Adds the ops grid.place / grid.remove / grid.move and the save key 'grids' (layers).
|
|
8
|
+
* Options: ok, bad, previewOpacity, previewHeight (the preview box), tiles, tileLift (layer tiles). The materials are pv.material and layer.material.
|
|
4
9
|
* @example engine.use(world(), grids())
|
|
10
|
+
* @example engine.use(world(), grids({ ok: 0x66dd88, bad: 0xdd5544, tiles: { soil: { watered: 0x5b3d2a, tilled: 0x8a6243 } } }))
|
|
11
|
+
* @param {GridsOptions} [opts]
|
|
5
12
|
* @returns {import('../../../core').ModuleDef<Grids>}
|
|
6
13
|
* @experimental
|
|
7
14
|
*/
|
|
8
|
-
export function grids(): import("../../../core").ModuleDef<Grids>;
|
|
15
|
+
export function grids(opts?: GridsOptions): import("../../../core").ModuleDef<Grids>;
|
|
9
16
|
/**
|
|
10
17
|
* engine.grids: every placement grid, the item rules, previews and the occupancy index
|
|
11
18
|
* @example
|
|
@@ -15,6 +22,12 @@ export function grids(): import("../../../core").ModuleDef<Grids>;
|
|
|
15
22
|
* @experimental
|
|
16
23
|
*/
|
|
17
24
|
export class Grids {
|
|
25
|
+
/** Preview color where it can be placed, read when a preview is made @type {any} */ ok: any;
|
|
26
|
+
/** Preview color where it cannot be placed, read when a preview is made @type {any} */ bad: any;
|
|
27
|
+
/** Opacity of the preview box, read when a preview is made */ previewOpacity: number;
|
|
28
|
+
/** Height of the preview box (meters), read when a preview is made */ previewHeight: number;
|
|
29
|
+
/** Tile colors by layer name, { layer: { field: color } } (first truthy field of a cell wins), read when a layer is made @type {Record<string, Record<string, any>>} */ tiles: Record<string, Record<string, any>>;
|
|
30
|
+
/** Height of tiles above the ground (meters), read when a layer is made */ tileLift: number;
|
|
18
31
|
/**
|
|
19
32
|
* Create a grid. cell: edge length (m, default 1); origin: world [x, z] of the min corner of cell [0, 0]; size: [cells wide, cells deep] (omit = unbounded);
|
|
20
33
|
* zone: level name (tiles only show there); flat: max height difference under a footprint (m, default 0.5);
|
|
@@ -66,12 +79,12 @@ export class Grids {
|
|
|
66
79
|
define(name: string, rule: import("./Grid.js").GridRule): void;
|
|
67
80
|
/**
|
|
68
81
|
* Show where an item would go: the target cell under the pointer ('pointer', default), in front of the player ('front') or from your
|
|
69
|
-
* function, turned by the input action rotate (default name 'rotate'; the game binds it, e.g. presets.bindings.gridRotate; the engine binds no key itself), light when can() passes, dark otherwise (neutral tool colors;
|
|
70
|
-
*
|
|
82
|
+
* function, turned by the input action rotate (default name 'rotate'; the game binds it, e.g. presets.bindings.gridRotate; the engine binds no key itself), light when can() passes, dark otherwise (neutral tool colors; grids({ ok, bad }) override them).
|
|
83
|
+
* draw: false = no visual; (engine) => ({ update(view), hide(), dispose() }) = your own; pv.material is the default box's three.js material. place() runs grid.place with what is shown
|
|
71
84
|
* @example engine.input.bind({ place: ['Mouse0'], ...presets.bindings.gridRotate }); // the game's own bindings
|
|
72
85
|
* const pv = engine.grids.preview({ grid: 'field', item: 'tower' });
|
|
73
86
|
* engine.onFrame(() => { if (engine.input.pressed('place')) { const r = pv.place(); if (!r.ok) toast(engine, engine.t('grid.' + r.code)); } });
|
|
74
|
-
* @param {{ grid: string, item: string, from?: 'pointer' | 'front' | ((e: any) => any), rotate?: string | false, rotation?: number,
|
|
87
|
+
* @param {{ grid: string, item: string, from?: 'pointer' | 'front' | ((e: any) => any), rotate?: string | false, rotation?: number, draw?: false | ((e: any) => any) }} opts
|
|
75
88
|
* @returns {{ cell: [number, number] | null, rotation: number, ok: boolean, code: string | null, rotate(n?: number): void, place(fields?: object): { ok: boolean, value?: any, code?: string }, remove(): void }}
|
|
76
89
|
*/
|
|
77
90
|
preview(opts: {
|
|
@@ -80,7 +93,7 @@ export class Grids {
|
|
|
80
93
|
from?: "pointer" | "front" | ((e: any) => any);
|
|
81
94
|
rotate?: string | false;
|
|
82
95
|
rotation?: number;
|
|
83
|
-
|
|
96
|
+
draw?: false | ((e: any) => any);
|
|
84
97
|
}): {
|
|
85
98
|
cell: [number, number] | null;
|
|
86
99
|
rotation: number;
|
|
@@ -95,4 +108,15 @@ export class Grids {
|
|
|
95
108
|
remove(): void;
|
|
96
109
|
};
|
|
97
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Options of grids()
|
|
113
|
+
*/
|
|
114
|
+
export type GridsOptions = {
|
|
115
|
+
ok?: any;
|
|
116
|
+
bad?: any;
|
|
117
|
+
previewOpacity?: number;
|
|
118
|
+
previewHeight?: number;
|
|
119
|
+
tiles?: Record<string, Record<string, any>>;
|
|
120
|
+
tileLift?: number;
|
|
121
|
+
};
|
|
98
122
|
import { Grid } from './Grid.js';
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/particles/Particles.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/**
|
|
3
|
-
* Particles -> engine.particles
|
|
3
|
+
* Particles -> engine.particles. effects: params by name, under what define() gives; a name define() never saw is defined on its first emit / attach.
|
|
4
|
+
* default: params every effect starts from
|
|
5
|
+
* @param {ParticlesOptions} [opts]
|
|
4
6
|
* @returns {ModuleDef<Particles>}
|
|
7
|
+
* @example engine.use(particles({ default: { color: 0xc8b89a }, effects: { dust: { max: 300, size: [0.3, 0.8] } } }));
|
|
5
8
|
*/
|
|
6
|
-
export function particles(): ModuleDef<Particles>;
|
|
9
|
+
export function particles(opts?: ParticlesOptions): ModuleDef<Particles>;
|
|
7
10
|
/** @import { ModuleDef } from '../../../core' */
|
|
8
11
|
/** @import { Object3D, PositionLike } from '../../../common' */
|
|
9
|
-
/** @import { ParticleEffect, ParticleEmitter, ParticleOptions } from '../../../gameplay' */
|
|
12
|
+
/** @import { ParticleEffect, ParticleEmitter, ParticleOptions, ParticlesOptions } from '../../../gameplay' */
|
|
10
13
|
/** engine.particles */
|
|
11
14
|
export class Particles {
|
|
12
15
|
/** Defined effects @type {Map<string, ParticleEffect>} */
|
|
13
16
|
effects: Map<string, ParticleEffect>;
|
|
14
17
|
/**
|
|
15
|
-
* Define an effect (same name replaces it, and emitters attached to it move to the new definition); params sit on top of
|
|
16
|
-
*
|
|
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,
|
|
19
|
+
* default }). Returns the effect object: .points is its THREE.Points (a Sprite on WebGPURenderer); .material is its plain three.js material (set
|
|
20
|
+
* your own and it is drawn as given, null gives the engine's back); .uniforms are the engine material's { value } objects (uMap, uHasMap, uScale,
|
|
21
|
+
* uMaxPx), which a ShaderMaterial of yours can share. A material of yours lasts until the effect is defined again
|
|
22
|
+
* @example engine.particles.define('sparks', { blending: 'additive' }).material = myMaterial;
|
|
17
23
|
* @param {string} name
|
|
18
24
|
* @param {ParticleOptions} [opts]
|
|
19
25
|
* @returns {ParticleEffect}
|
|
@@ -61,9 +67,10 @@ export class Particles {
|
|
|
61
67
|
*/
|
|
62
68
|
clear(name?: string): void;
|
|
63
69
|
}
|
|
70
|
+
import type { ParticlesOptions } from '../../../gameplay';
|
|
64
71
|
import type { ModuleDef } from '../../../core';
|
|
72
|
+
import type { ParticleOptions } from '../../../gameplay';
|
|
65
73
|
import type { ParticleEffect } from '../../../gameplay';
|
|
66
74
|
import * as THREE from 'three';
|
|
67
|
-
import type { ParticleOptions } from '../../../gameplay';
|
|
68
75
|
import type { PositionLike } from '../../../common';
|
|
69
76
|
import type { ParticleEmitter } from '../../../gameplay';
|
|
@@ -1,8 +1,7 @@
|
|
|
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
|
|
3
|
+
/** @import { SkyOptions } from '../../../world' */
|
|
4
4
|
/** @import { Handle } from '../../../common' */
|
|
5
|
-
/** @import { SkyShadowParams } from '../../../style' */
|
|
6
5
|
/** engine.sky */
|
|
7
6
|
export class Sky {
|
|
8
7
|
/**
|
|
@@ -10,6 +9,23 @@ export class Sky {
|
|
|
10
9
|
* draws the calendar's time and this is unused @type {number}
|
|
11
10
|
*/
|
|
12
11
|
fixedTime: number;
|
|
12
|
+
/**
|
|
13
|
+
* What each calendar season tints the plants and ground, read every frame, or null for no tint: plain data the game's picture/ code writes
|
|
14
|
+
* @type {import('../../../world').SeasonTints | null}
|
|
15
|
+
*/
|
|
16
|
+
seasonTints: import("../../../world").SeasonTints | null;
|
|
17
|
+
/**
|
|
18
|
+
* What the sky dims for every game, plain fields read each frame (a fantasy sky can stay bright at night, keep its stars through clouds):
|
|
19
|
+
* tint false keeps a sky.tint color at full strength at any hour, stars false keeps the stars through the weather's cover @type {{ tint: boolean, stars: boolean }}
|
|
20
|
+
*/
|
|
21
|
+
dim: {
|
|
22
|
+
tint: boolean;
|
|
23
|
+
stars: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** Zenith color over the keyframes, any THREE.Color input (null = the keyframes); read each frame @type {any} */
|
|
26
|
+
top: any;
|
|
27
|
+
/** Horizon color over the keyframes, any THREE.Color input (null = the keyframes); read each frame. The color drawn: engine.uniforms.uSkyHorizon @type {any} */
|
|
28
|
+
horizon: any;
|
|
13
29
|
/** Dome mesh @type {Object3D} */
|
|
14
30
|
dome: THREE.Object3D;
|
|
15
31
|
/** Sun direction (unit vector toward the sun) @type {Vector3} */
|
|
@@ -22,32 +38,83 @@ export class Sky {
|
|
|
22
38
|
sway: number;
|
|
23
39
|
distance: number;
|
|
24
40
|
};
|
|
25
|
-
/** Current shadow params (change via look.shadow.set) @readonly @type {SkyShadowParams} */
|
|
26
|
-
readonly shadow: SkyShadowParams;
|
|
27
|
-
/** three's CSM (addons/csm) while shadow.cascades > 1, else null; its lights[0] is sun (recipes/45) @type {any} */
|
|
28
|
-
csm: any;
|
|
29
41
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
42
|
+
* The day's colors, live: rows [time, zenith, horizon, sunColor, ambient] sorted from 0 to 1 (the same rows as sky({ keyframes })).
|
|
43
|
+
* Throws, changing nothing, on rows that are not sorted from 0 to 1.
|
|
44
|
+
* @example engine.sky.keyframes([[0, 0x101828, 0x202838, 0x8090b0, 0.3], [0.5, 0x4080c0, 0xc0d8e8, 0xffffff, 1.2], [1, 0x101828, 0x202838, 0x8090b0, 0.3]]);
|
|
45
|
+
* @param {any[][]} rows
|
|
46
|
+
* @returns {void}
|
|
32
47
|
*/
|
|
33
|
-
|
|
48
|
+
keyframes(rows: any[][]): void;
|
|
49
|
+
/**
|
|
50
|
+
* 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
|
+
* 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.
|
|
52
|
+
* Recompiles the dome once: a scene change, not every frame.
|
|
53
|
+
* @example engine.sky.clouds({ glsl: 'vec4 threedogClouds(vec3 d, float t, vec3 s, float night, vec3 lit, vec3 shade, float cover){ return vec4(lit, step(0.5, threedogNoise(d.xz * 4.0)) * cover); }' });
|
|
54
|
+
* @param {string | { glsl?: string, tsl?: Function, uniforms?: object } | null} spec
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
clouds(spec: string | {
|
|
58
|
+
glsl?: string;
|
|
59
|
+
tsl?: Function;
|
|
60
|
+
uniforms?: object;
|
|
61
|
+
} | null): void;
|
|
62
|
+
/**
|
|
63
|
+
* Add, change or remove (null) a named dome layer drawn after the clouds and stars: glsl defines `vec4 threedogSkyLayer(vec3 dir, float time, vec3 sunDir, float night)`
|
|
64
|
+
* returning (rgb, amount), tsl is its WebGPURenderer form (modules/sky/domeLayers.js). Recompiles the dome once.
|
|
65
|
+
* @example engine.sky.layer('aurora', { glsl: 'vec4 threedogSkyLayer(vec3 d, float t, vec3 s, float n){ return vec4(0.2, 1.0, 0.5, n * smoothstep(0.1, 0.6, d.y) * 0.4); }', blend: 'add' });
|
|
66
|
+
* @param {string} name
|
|
67
|
+
* @param {string | { glsl?: string, tsl?: Function, uniforms?: object, order?: number, blend?: 'mix' | 'add' } | null} spec
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
layer(name: string, spec: string | {
|
|
71
|
+
glsl?: string;
|
|
72
|
+
tsl?: Function;
|
|
73
|
+
uniforms?: object;
|
|
74
|
+
order?: number;
|
|
75
|
+
blend?: "mix" | "add";
|
|
76
|
+
} | null): void;
|
|
77
|
+
/**
|
|
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.
|
|
79
|
+
* 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
|
+
* mapping on a clone, and keeps feeding engine.uniforms (uSunDir, uWind ...).
|
|
81
|
+
* @example engine.sky.replace(new SkyMesh());
|
|
82
|
+
* @example engine.sky.replace(null);
|
|
83
|
+
* @param {string | import('three').Texture | Object3D | null} sky
|
|
84
|
+
* @returns {void}
|
|
85
|
+
*/
|
|
86
|
+
replace(sky: string | import("three").Texture | THREE.Object3D | null): void;
|
|
87
|
+
set backdrop(v: any);
|
|
88
|
+
/**
|
|
89
|
+
* 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
|
+
* @type {any}
|
|
91
|
+
*/
|
|
92
|
+
get backdrop(): any;
|
|
34
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 */
|
|
35
94
|
get drawnTime(): any;
|
|
36
95
|
/** Sun elevation -1 (midnight) ... 0 (horizon) ... 1 (noon) of the drawn sun (the calendar's daylight is the gameplay value) */
|
|
37
96
|
get sunHeight(): number;
|
|
38
|
-
/** Whether the drawn sun is above the horizon (
|
|
97
|
+
/** Whether the drawn sun is above the horizon (picture functions: ({ sky }) => sky.isDay ? ...; gameplay reads engine.calendar.isDay) */
|
|
39
98
|
get isDay(): boolean;
|
|
40
99
|
/** Daylight of the drawn sun 0-1 (0 at night, 1 at noon) */
|
|
41
100
|
get daylight(): number;
|
|
42
101
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
102
|
+
* 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 times longer 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
|
+
* 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
|
+
* @example const env = engine.sky.environment({ into: engine.scene });
|
|
106
|
+
* @example env.remove();
|
|
107
|
+
* @param {{ into?: { environment: any }, interval?: number }} [options]
|
|
108
|
+
* @returns {{ readonly texture: import('three').Texture | null, remove(): void }}
|
|
46
109
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
110
|
+
environment(options?: {
|
|
111
|
+
into?: {
|
|
112
|
+
environment: any;
|
|
113
|
+
};
|
|
114
|
+
interval?: number;
|
|
115
|
+
}): {
|
|
116
|
+
readonly texture: import("three").Texture | null;
|
|
117
|
+
remove(): void;
|
|
118
|
+
};
|
|
50
119
|
}
|
|
51
120
|
import * as THREE from 'three';
|
|
52
|
-
import type { SkyShadowParams } from '../../../style';
|
|
53
|
-
import type { SkyEnvironmentInfo } from '../../../world';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/sky/skyModule.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/**
|
|
3
|
-
* Sky dome
|
|
3
|
+
* Sky dome and the sun / daylight / sky-color signals, from the time of day (engine.calendar; without one a fixed time) -> engine.sky
|
|
4
4
|
* @param {SkyOptions} [opts]
|
|
5
5
|
* @returns {ModuleDef<Sky>}
|
|
6
6
|
*/
|