threedog 0.5.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 +276 -1
- package/README.md +18 -13
- package/core/{Animator.js → assets/Animator.js} +28 -18
- package/core/{Assets.js → assets/Assets.js} +116 -61
- package/core/{Baked.js → assets/Baked.js} +16 -25
- package/core/assets/assetEntry.js +237 -0
- package/core/{assetHot.js → assets/assetHot.js} +7 -6
- package/core/{assetLoad.js → assets/assetLoad.js} +66 -29
- package/core/assets/assetLod.js +113 -0
- package/core/{assetManifest.js → assets/assetManifest.js} +23 -12
- package/core/{assetReport.js → assets/assetReport.js} +9 -15
- package/core/{namedModel.js → assets/namedModel.js} +24 -16
- package/core/{Audio.js → audio/Audio.js} +27 -24
- 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} +154 -139
- package/core/{errorHints.js → base/errorHints.js} +9 -10
- package/core/{errors.js → base/errors.js} +9 -9
- package/core/{events.generated.js → base/events.generated.js} +2 -0
- package/core/{math.js → base/math.js} +22 -4
- package/core/{params.js → base/params.js} +3 -4
- package/core/base/util.js +32 -0
- package/core/{validate.js → base/validate.js} +29 -8
- package/core/{Engine.js → engine/Engine.js} +112 -105
- 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} +16 -16
- package/core/{loop.js → engine/loop.js} +80 -52
- package/core/{moduleSlots.js → engine/moduleSlots.js} +35 -10
- package/core/{moduleTypes.js → engine/moduleTypes.js} +30 -18
- package/core/{modules.js → engine/modules.js} +20 -17
- package/core/engine/page.js +125 -0
- package/core/{plugins.js → engine/plugins.js} +68 -103
- package/core/{services.js → engine/services.js} +47 -40
- package/core/{startup.js → engine/startup.js} +35 -35
- package/core/{Input.js → input/Input.js} +41 -27
- 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} +23 -22
- package/core/{DebugOverrides.js → inspect/DebugOverrides.js} +60 -31
- package/core/{Describe.js → inspect/Describe.js} +33 -30
- package/core/{Inspect.js → inspect/Inspect.js} +14 -9
- package/core/{InspectMaterials.js → inspect/InspectMaterials.js} +8 -10
- package/core/{InspectPerf.js → inspect/InspectPerf.js} +29 -16
- package/core/{InspectScene.js → inspect/InspectScene.js} +8 -5
- package/core/{MaterialInfo.js → inspect/MaterialInfo.js} +9 -6
- package/core/inspect/UrlState.js +182 -0
- package/core/{catalog.js → inspect/catalog.js} +18 -5
- package/core/{checks.js → inspect/checks.js} +7 -5
- package/core/{debugView.js → inspect/debugView.js} +8 -8
- package/core/inspect/describeRender.js +148 -0
- package/core/{describeText.js → inspect/describeText.js} +17 -12
- package/core/inspect/geometryWatch.js +38 -0
- package/core/{lightWatch.js → inspect/lightWatch.js} +11 -9
- package/core/inspect/pictureWriters.js +342 -0
- 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} +37 -37
- package/core/{sharedPoint.js → ops/sharedPoint.js} +13 -27
- package/core/{stackFrames.js → ops/stackFrames.js} +17 -6
- package/core/{stacks.js → ops/stacks.js} +18 -20
- 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} +27 -24
- package/core/{Views.js → scene/Views.js} +15 -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} +24 -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/scene/pictureSlots.js +33 -0
- package/core/{sceneDelta.js → scene/sceneDelta.js} +14 -6
- package/core/{sceneMethods.js → scene/sceneMethods.js} +36 -20
- package/core/scene/stepPoses.js +55 -0
- package/core/{targeting.js → scene/targeting.js} +4 -5
- package/core/{thingExplain.js → scene/thingExplain.js} +7 -6
- package/core/{thingOps.js → scene/thingOps.js} +4 -3
- package/core/{things.js → scene/things.js} +19 -6
- package/core/{threePatches.js → scene/threePatches.js} +1 -1
- package/core/{tier.js → scene/tier.js} +1 -1
- package/core/scene/view.js +44 -0
- package/core/{Batching.js → stream/Batching.js} +85 -27
- package/core/{Stream.js → stream/Stream.js} +62 -33
- package/core/{batchGroups.js → stream/batchGroups.js} +18 -9
- package/core/{chunkStream.js → stream/chunkStream.js} +41 -1
- 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 +70 -63
- package/docs/API.md +30 -29
- package/docs/CODEMAP.md +98 -223
- package/docs/COMMANDS.md +80 -69
- package/docs/CONVENTIONS.md +87 -41
- package/docs/MIGRATING-0.7.md +39 -0
- package/docs/MIGRATING-0.8.md +169 -0
- package/docs/THREE.md +100 -49
- package/docs/api/assets.md +17 -16
- package/docs/api/audio.md +8 -7
- package/docs/api/budget.md +8 -4
- package/docs/api/calendar.md +10 -11
- package/docs/api/cameraRig.md +29 -29
- package/docs/api/characters.md +26 -19
- package/docs/api/clock.md +1 -1
- package/docs/api/collision.md +14 -11
- package/docs/api/content.md +6 -6
- package/docs/api/dialogue.md +3 -3
- package/docs/api/engine.md +82 -53
- package/docs/api/events.md +5 -3
- package/docs/api/flow.md +1 -1
- package/docs/api/grids.md +9 -2
- package/docs/api/ground.md +4 -5
- package/docs/api/hud.md +4 -1
- package/docs/api/i18n.md +6 -6
- package/docs/api/input.md +10 -9
- package/docs/api/interactions.md +6 -4
- package/docs/api/inventory.md +10 -11
- package/docs/api/jobs.md +5 -5
- package/docs/api/level.md +7 -8
- package/docs/api/lightPool.md +2 -7
- package/docs/api/music.md +3 -3
- package/docs/api/nav.md +10 -10
- package/docs/api/occlusion.md +5 -0
- package/docs/api/openWorld.md +1 -1
- package/docs/api/particles.md +8 -5
- package/docs/api/photo.md +4 -2
- package/docs/api/pickups.md +7 -1
- package/docs/api/post.md +24 -5
- 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 +17 -14
- package/docs/api/stream.md +7 -7
- package/docs/api/swarm.md +34 -0
- package/docs/api/terrain.md +17 -12
- package/docs/api/terrainDraw.md +12 -0
- package/docs/api/timeline.md +2 -2
- package/docs/api/tools.md +30 -26
- package/docs/api/triggers.md +2 -0
- package/docs/api/vars.md +1 -1
- package/docs/api/vegetation.md +11 -5
- package/docs/api/vegetationDraw.md +10 -0
- package/docs/api/water.md +7 -3
- package/docs/api/weather.md +11 -6
- package/docs/api/weatherDraw.md +10 -0
- package/docs/api/world.md +6 -6
- package/docs/recipes/01-new-game.md +38 -57
- package/docs/recipes/02-npc.md +19 -20
- package/docs/recipes/03-items-pickups.md +47 -42
- package/docs/recipes/04-quests.md +3 -4
- package/docs/recipes/05-props-bake.md +72 -66
- package/docs/recipes/06-clock-events.md +30 -21
- package/docs/recipes/07-flow-scenes-pause.md +21 -17
- package/docs/recipes/08-weather-sky.md +117 -75
- package/docs/recipes/09-materials-lights-models.md +171 -0
- package/docs/recipes/10-blender-level.md +6 -7
- package/docs/recipes/11-vehicles.md +33 -25
- package/docs/recipes/12-navmesh.md +9 -8
- package/docs/recipes/13-animation.md +50 -22
- package/docs/recipes/14-custom-module.md +20 -17
- package/docs/recipes/15-perf.md +52 -29
- package/docs/recipes/16-dev-bridge.md +47 -57
- package/docs/recipes/18-world.md +45 -30
- package/docs/recipes/19-shooting-picking.md +11 -7
- package/docs/recipes/20-content-actions-save.md +36 -37
- package/docs/recipes/21-camera.md +41 -8
- package/docs/recipes/22-shop-gold.md +0 -4
- package/docs/recipes/23-ops.md +11 -11
- package/docs/recipes/26-ui-parts.md +56 -22
- package/docs/recipes/27-net.md +0 -2
- package/docs/recipes/28-terrain.md +126 -30
- package/docs/recipes/29-grid.md +16 -7
- package/docs/recipes/30-templates.md +62 -21
- package/docs/recipes/31-audio.md +9 -9
- package/docs/recipes/32-action-game.md +32 -9
- package/docs/recipes/33-stream-sources.md +2 -2
- package/docs/recipes/34-environment-lighting.md +164 -52
- package/docs/recipes/35-picture-from-reference.md +140 -0
- package/docs/recipes/36-ground-plants.md +105 -0
- package/docs/recipes/40-scene.md +105 -30
- package/docs/recipes/{43-shader-patches-surface-looks.md → 43-shader-patches-surfaces.md} +74 -106
- package/docs/recipes/44-water-weather-hooks.md +196 -0
- package/docs/recipes/45-cascaded-shadows.md +145 -25
- package/docs/recipes/46-blender-art-route.md +21 -25
- package/docs/recipes/49-game-module-contract.md +5 -5
- package/docs/recipes/50-own-renderer.md +3 -3
- package/docs/recipes/52-around-the-picture.md +137 -0
- package/docs/recipes/53-ground-up-close.md +65 -28
- package/docs/recipes/55-mods-time-wrap.md +25 -17
- package/docs/recipes/56-webgpu-tsl.md +73 -28
- package/docs/recipes/57-control.md +47 -1
- 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 +47 -27
- package/docs/recipes/61-deploy.md +27 -0
- package/docs/recipes/62-picture-code.md +276 -0
- package/docs/recipes/63-third-person-start.md +90 -0
- package/docs/recipes/64-particles.md +35 -0
- package/docs/recipes/65-swarm.md +140 -0
- package/examples/action/.threedog/content-index.json +1 -1
- package/examples/action/GAMEMAP.md +9 -7
- 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/perf-island/.threedog/content-index.json +1 -0
- package/examples/{sheepisland → perf-island}/GAMEMAP.md +18 -14
- package/examples/{sheepisland → perf-island}/assets.js +2 -2
- package/examples/{sheepisland → perf-island}/content/templates.js +1 -1
- package/examples/{sheepisland → perf-island}/content/vegetation.js +3 -1
- package/examples/{sheepisland → perf-island}/main.js +22 -16
- package/examples/{sheepisland/style → perf-island}/models.js +13 -24
- package/examples/{sheepisland → perf-island}/params.js +1 -1
- package/examples/perf-island/picture/index.js +20 -0
- package/examples/perf-island/picture/lights.js +34 -0
- package/examples/perf-island/picture/materials.js +61 -0
- package/examples/perf-island/picture/palette.js +60 -0
- package/examples/perf-island/picture/sky.js +20 -0
- package/examples/{sheepisland → perf-island}/views.js +1 -1
- package/examples/plain-picture/.threedog/content-index.json +1 -0
- package/examples/plain-picture/GAMEMAP.md +91 -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 +10 -4
- package/examples/rc2d/README.md +11 -6
- package/examples/rc2d/main.js +26 -36
- 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/styletest/.threedog/content-index.json +1 -1
- package/examples/styletest/GAMEMAP.md +15 -10
- 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 +31 -68
- 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 +8 -6
- 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 +6 -4
- 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 +10 -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 +16 -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 +14 -22
- package/index.js +36 -36
- package/llms.txt +19 -21
- package/modules/ambience/Ambience.js +12 -9
- package/modules/calendar/Calendar.js +20 -20
- package/modules/calendar/index.js +14 -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 +51 -25
- package/modules/camera/contract.js +1 -0
- package/modules/camera/projection.js +2 -2
- package/modules/characters/Character.js +47 -39
- package/modules/characters/NPC.js +30 -22
- package/modules/characters/assetModel.js +18 -13
- 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 +172 -193
- package/modules/characters/moveHelpers.js +14 -3
- package/modules/characters/movers/common.js +22 -15
- package/modules/characters/movers/manual.js +4 -1
- package/modules/characters/movers/rapier.js +7 -6
- package/modules/characters/movers/simple.js +3 -3
- package/modules/characters/movers/support.js +32 -18
- package/modules/characters/npcAvoid.js +4 -4
- package/modules/characters/npcSim.js +28 -18
- 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 +19 -5
- package/modules/characters/useModel.js +5 -5
- package/modules/characters/walkTo.js +11 -17
- package/modules/collision/Collision.js +30 -22
- 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 +68 -98
- package/modules/content/loader.js +14 -17
- package/modules/content/markers.js +25 -0
- package/modules/content/models.js +66 -18
- 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 +19 -14
- package/modules/content/rules.js +34 -22
- package/modules/content/stages.js +7 -7
- package/modules/content/templates.js +24 -22
- 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 +115 -27
- package/modules/gameplay/Inventory.js +11 -12
- package/modules/gameplay/Quests.js +16 -9
- package/modules/gameplay/boxOps.js +1 -1
- package/modules/gameplay/dialogueBox.js +1 -1
- package/modules/gameplay/dialogueBubbles.js +4 -5
- package/modules/gameplay/interactionPrompt.js +1 -1
- package/modules/gameplay/interactions.contract.js +1 -1
- package/modules/gameplay/inventoryOps.js +2 -3
- package/modules/gameplay/pickups.js +81 -44
- package/modules/gameplay/questLog.js +2 -2
- package/modules/gameplay/questSave.js +3 -3
- package/modules/grid/Grid.js +1 -1
- package/modules/grid/Layer.js +16 -3
- package/modules/grid/index.js +47 -19
- package/modules/grid/preview.js +29 -20
- package/modules/grid/tiles.js +19 -23
- package/modules/hlod/index.js +38 -55
- package/modules/hud/index.js +27 -8
- package/modules/hud/parts.js +13 -11
- package/modules/level/contract.js +16 -0
- package/modules/level/heightfield.js +12 -10
- package/modules/level/index.js +48 -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 +34 -183
- package/modules/lights/slots.js +93 -0
- package/modules/lights/sources.js +88 -0
- package/modules/music/Music.js +31 -27
- 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 +49 -25
- package/modules/particles/effect.js +27 -10
- package/modules/particles/shaders.js +2 -1
- package/modules/photo/Photo.js +26 -27
- 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 +114 -45
- package/modules/settings/apply.js +10 -10
- package/modules/settings/sections.js +16 -14
- package/modules/settings/strings.js +1 -1
- package/modules/settings/view.js +3 -3
- package/modules/sky/Sky.js +125 -103
- package/modules/sky/clouds.js +22 -23
- package/modules/sky/dome.js +113 -0
- package/modules/sky/domeLayers.js +13 -13
- package/modules/sky/environment.js +47 -171
- package/modules/sky/fog.js +5 -180
- package/modules/sky/frame.js +42 -97
- package/modules/sky/season.js +9 -3
- package/modules/sky/shader.js +49 -44
- package/modules/sky/skyModule.js +25 -35
- package/modules/sky/tint.js +9 -11
- 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 +97 -62
- package/modules/terrain/chunkQueries.js +7 -24
- package/modules/terrain/chunkWorker.js +1 -1
- package/modules/terrain/draw.js +157 -0
- package/modules/terrain/index.js +60 -88
- package/modules/terrain/terrainColorMap.js +6 -3
- package/modules/terrain/terrainDefaults.js +4 -3
- package/modules/terrain/terrainEdit.js +32 -27
- package/modules/terrain/terrainGen.js +19 -14
- 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 +19 -15
- package/modules/vegetation/Vegetation.js +87 -39
- package/modules/vegetation/densityMap.js +4 -7
- package/modules/vegetation/draw.js +196 -0
- package/modules/vegetation/groundChunks.js +11 -31
- package/modules/vegetation/index.js +18 -16
- package/modules/vegetation/modelGeometry.js +3 -6
- package/modules/vegetation/nearFade.js +1 -1
- package/modules/water/Water.js +140 -93
- package/modules/water/surface.js +56 -56
- package/modules/weather/Weather.js +84 -38
- package/modules/weather/particles.js +18 -10
- package/modules/weather/shaders.js +1 -1
- package/modules/weather/weatherDraw.js +145 -0
- package/modules/world/World.js +10 -10
- 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 +12 -10
- package/package.json +44 -8
- package/presets.js +3 -5
- package/render/PostFX.js +233 -63
- package/render/backend.js +72 -32
- package/render/cascades.js +200 -0
- package/render/cascades.tsl.js +93 -0
- package/render/daylight.js +56 -0
- package/render/detail.js +13 -12
- package/render/effects.js +60 -42
- package/render/fuse.js +3 -3
- package/render/fx/cel.tsl.js +42 -0
- package/render/fx/cloudShadow.tsl.js +3 -3
- package/render/fx/detail.tsl.js +1 -1
- package/render/fx/index.js +10 -13
- 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 +6 -16
- package/render/fx/postWebGPU.tsl.js +55 -28
- package/render/fx/sky.tsl.js +34 -109
- package/render/fx/uniforms.tsl.js +4 -4
- package/render/fx/water.tsl.js +1 -1
- package/render/fx/wind.tsl.js +1 -1
- package/render/fxNumbers.js +3 -0
- package/render/layers.js +14 -0
- package/render/lighting.js +11 -8
- package/render/lightmap.js +142 -0
- package/render/lights.js +26 -204
- package/render/lit.js +24 -0
- package/render/materials.js +47 -162
- package/render/mergeCommon.js +22 -0
- package/render/modeling.js +2 -2
- package/render/neutral.js +23 -0
- package/render/occlusion.js +200 -0
- package/render/ownFrame.js +5 -5
- package/render/patches.js +46 -41
- package/render/postWebGL.js +19 -9
- package/render/probes.js +182 -128
- 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/render/shadows.js +451 -0
- package/render/slots.js +11 -11
- package/render/terms.js +63 -113
- package/render/uniformDecl.js +2 -2
- package/types/core.d.ts +489 -405
- package/types/gameplay.d.ts +225 -114
- package/types/generated/core/{Audio.d.ts → audio/Audio.d.ts} +23 -8
- 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/engine/page.d.ts +24 -0
- package/types/generated/core/{Input.d.ts → input/Input.d.ts} +21 -10
- package/types/generated/core/{Budget.d.ts → inspect/Budget.d.ts} +36 -26
- package/types/generated/core/{DebugOverrides.d.ts → inspect/DebugOverrides.d.ts} +16 -8
- 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 +9 -1
- package/types/generated/modules/grid/index.d.ts +32 -8
- package/types/generated/modules/music/Music.d.ts +7 -5
- package/types/generated/modules/particles/Particles.d.ts +14 -7
- package/types/generated/modules/sky/Sky.d.ts +101 -23
- package/types/generated/modules/sky/skyModule.d.ts +1 -1
- 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 +51 -3
- package/types/generated/modules/weather/Weather.d.ts +44 -10
- package/types/generated/modules/weather/weatherDraw.d.ts +11 -0
- package/types/generated/modules/world/World.d.ts +7 -5
- package/types/generated/render/PostFX.d.ts +69 -20
- package/types/generated/render/lighting.d.ts +29 -0
- package/types/generated/render/materials.d.ts +20 -44
- package/types/generated/render/occlusion.d.ts +22 -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 +104 -73
- package/types/tsl.d.ts +45 -4
- package/types/world.d.ts +372 -86
- package/ui/Focus.js +21 -10
- package/ui/LoadingScreen.js +2 -2
- package/ui/Parts.js +12 -7
- package/ui/UI.js +17 -17
- package/ui/cursor.js +1 -1
- package/ui/defaults.js +3 -2
- package/ui/theme.js +36 -28
- package/ui/touchPart.js +1 -1
- package/core/UrlState.js +0 -110
- package/core/assetEntry.js +0 -106
- package/core/describeRender.js +0 -71
- package/core/holds.js +0 -134
- 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/page.js +0 -79
- package/core/shadowTypes.js +0 -16
- package/core/styleParts.js +0 -114
- package/core/util.js +0 -17
- package/docs/MIGRATING-0.3.md +0 -248
- package/docs/MIGRATING-0.4.md +0 -228
- package/docs/MIGRATING-0.5.md +0 -68
- package/docs/PERF.md +0 -245
- 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/37-terrain-look-hooks.md +0 -119
- package/docs/recipes/38-environment-look-hooks.md +0 -99
- package/docs/recipes/41-thing-registry.md +0 -97
- package/docs/recipes/42-terrain-shape.md +0 -64
- package/docs/recipes/44-water-weather-look-hooks.md +0 -144
- package/docs/recipes/47-island-snow-backdrop.md +0 -45
- package/docs/recipes/48-make-material.md +0 -75
- package/docs/recipes/52-look.md +0 -282
- package/docs/recipes/54-three-idioms.md +0 -88
- package/examples/action/look.js +0 -5
- package/examples/sheepisland/.threedog/content-index.json +0 -1
- 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/core/page.d.ts +0 -18
- package/types/generated/modules/weather/weatherLook.d.ts +0 -12
- package/types/style.d.ts +0 -671
- /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/{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/types/physics.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Collision, real physics, camera.
|
|
2
2
|
import type { Object3D, Vector3, DirXZ, Vec3Like, Ease, Handle, PositionLike } from './common';
|
|
3
3
|
import type { Engine, ModuleDef } from './core';
|
|
4
|
-
import type { Input } from './generated/core/Input';
|
|
4
|
+
import type { Input } from './generated/core/input/Input';
|
|
5
5
|
import type { Character } from './gameplay';
|
|
6
6
|
|
|
7
7
|
// ======================================================================
|
|
@@ -13,13 +13,13 @@ export interface CollisionOptions {
|
|
|
13
13
|
maxClimb?: number;
|
|
14
14
|
/** A camera above this height (meters) is not considered blocked by trees, default 5 */
|
|
15
15
|
canopyHeight?: number;
|
|
16
|
-
/** Margin between the camera and obstacles (meters), default 0.5 */
|
|
16
|
+
/** Margin between the camera and obstacles (meters), default 0.5 @experimental */
|
|
17
17
|
cameraPad?: number;
|
|
18
18
|
/** Nearest camera distance (meters), default 1.5 */
|
|
19
19
|
cameraMin?: number;
|
|
20
|
-
/** Height above the water surface (meters) at which it counts as walkable, default 0.2 */
|
|
20
|
+
/** Height above the water surface (meters) at which it counts as walkable, default 0.2 @experimental */
|
|
21
21
|
walkableWaterMargin?: number;
|
|
22
|
-
/** What camera occlusion checks: '
|
|
22
|
+
/** What camera occlusion checks: 'both' (default) | 'colliders' | 'meshes' = static meshes registered with engine.rays.addStatic(mesh, { occluder: true }) */
|
|
23
23
|
cameraOcclusion?: 'colliders' | 'meshes' | 'both';
|
|
24
24
|
}
|
|
25
25
|
/** Circle collider: center x/z, radius r, height h (meters), occ false when added with occluder: false */
|
|
@@ -54,18 +54,14 @@ export interface BoxColliderOptions {
|
|
|
54
54
|
|
|
55
55
|
/** engine.collision (lightweight collision: no walking through things, the camera is not blocked). Real physics is a separate module, engine.rigid */
|
|
56
56
|
export interface Collision {
|
|
57
|
-
maxClimb: number;
|
|
58
|
-
canopyHeight: number;
|
|
59
|
-
cameraPad: number;
|
|
60
|
-
cameraMin: number;
|
|
61
|
-
walkableWaterMargin: number;
|
|
62
|
-
/** What camera occlusion checks (see CollisionOptions.cameraOcclusion) */
|
|
57
|
+
/** @experimental */ maxClimb: number;
|
|
58
|
+
/** @experimental */ canopyHeight: number;
|
|
59
|
+
/** @experimental */ cameraPad: number;
|
|
60
|
+
/** @experimental */ cameraMin: number;
|
|
61
|
+
/** @experimental */ walkableWaterMargin: number;
|
|
62
|
+
/** What camera occlusion checks (see CollisionOptions.cameraOcclusion) @experimental */
|
|
63
63
|
cameraOcclusion: 'colliders' | 'meshes' | 'both';
|
|
64
|
-
/**
|
|
65
|
-
circles: Set<CircleCollider>;
|
|
66
|
-
/** Box colliders added by hand */
|
|
67
|
-
boxes: Set<BoxCollider>;
|
|
68
|
-
/** +1 each time a static collider is added or removed */
|
|
64
|
+
/** +1 each time a static collider is added or removed @experimental */
|
|
69
65
|
version: number;
|
|
70
66
|
/** Add a circle collider (pillar, campfire): position is the center, e.g. addCircle(mesh, { radius: 1 }). Returns a handle { remove() } */
|
|
71
67
|
addCircle(position: PositionLike, opts?: CircleColliderOptions): Handle;
|
|
@@ -73,15 +69,15 @@ export interface Collision {
|
|
|
73
69
|
addBox(position: PositionLike, opts?: BoxColliderOptions): Handle;
|
|
74
70
|
/** Add a thin wall along a -> b (fence). Options: thickness (default 0.3), height, y, occluder (as in addBox). A gap between segments is a gate. Returns a handle { remove() } */
|
|
75
71
|
addSegment(a: PositionLike, b: PositionLike, opts?: { thickness?: number; height?: number; y?: number; occluder?: boolean }): Handle;
|
|
76
|
-
/** Mark ground impassable where fn(x, z) is true (river, lava); fn must be pure. bounds { minX, maxX, minZ, maxZ } (world metres, the field's x / z extent) skips fn outside it; give it to keep findPathAsync's ground sampling cheap. Returns a handle { remove() } */
|
|
72
|
+
/** Mark ground impassable where fn(x, z) is true (river, lava); fn must be pure (no side effects, same answer for the same (x, z)); reading engine.ground in it is fine. findPathAsync caches the answers, so after the ground or your own state changes, remove() and add the field again. bounds { minX, maxX, minZ, maxZ } (world metres, the field's x / z extent) skips fn outside it; give it to keep findPathAsync's ground sampling cheap. Returns a handle { remove() } */
|
|
77
73
|
addBlocked(fn: (x: number, z: number) => boolean, opts?: { bounds?: { minX: number; maxX: number; minZ: number; maxZ: number } }): Handle;
|
|
78
|
-
/** Is a character of this radius touching addBlocked ground at (x, z) */
|
|
74
|
+
/** Is a character of this radius touching addBlocked ground at (x, z) @experimental */
|
|
79
75
|
blockedAt(x: number, z: number, radius?: number): boolean;
|
|
80
76
|
/** Add a collider from an object's bounding box, pad expands outward (meters), occluder as in addBox. Returns a handle { remove() } */
|
|
81
77
|
addObject(obj: Object3D, opts?: { pad?: number; occluder?: boolean }): Handle;
|
|
82
|
-
/** Iterate all static colliders added by hand */
|
|
78
|
+
/** Iterate all static colliders added by hand @experimental */
|
|
83
79
|
forEachStatic(fn: (type: 'box' | 'circle', data: any) => void): void;
|
|
84
|
-
/** Keep an outside copy of the static colliders in step (physics colliders, navmesh obstacles): add builds one piece, remove drops one; sync() diffs only when colliders changed and returns whether it compared; clear() forgets every piece without remove (the outside world was thrown away) */
|
|
80
|
+
/** Keep an outside copy of the static colliders in step (physics colliders, navmesh obstacles): add builds one piece, remove drops one; sync() diffs only when colliders changed and returns whether it compared; clear() forgets every piece without remove (the outside world was thrown away) @experimental */
|
|
85
81
|
mirror<P>(fns: { add(type: 'box' | 'circle', data: any): P; remove(piece: P, data: any): void }): { sync(): boolean; clear(): void; readonly size: number };
|
|
86
82
|
/** Whether someone can stand at this position (for pathfinding): not in water, not too steep, not inside an obstacle. radius is the character radius (meters, default engine.movement.radius) */
|
|
87
83
|
walkable(position: PositionLike, opts?: { radius?: number }): boolean;
|
|
@@ -98,23 +94,23 @@ export interface Collision {
|
|
|
98
94
|
export interface RigidOptions {
|
|
99
95
|
/** Gravity (m/s², negative points down), default -9.81 */
|
|
100
96
|
gravity?: number;
|
|
101
|
-
/** How many rings of chunks around the player get terrain colliders, default 1 */
|
|
97
|
+
/** How many rings of chunks around the player get terrain colliders, default 1. A body outside them freezes until the player comes near (entry.enabled false, describe().rigid.frozen), because it would fall through the ground: raise this for a car or ball that must keep moving far away */
|
|
102
98
|
terrainRing?: number;
|
|
103
99
|
/** Whether there is buoyancy, default true */
|
|
104
100
|
buoyancy?: boolean;
|
|
105
|
-
/** Buoyancy strength (1 = just floats), default 1.6 */
|
|
101
|
+
/** Buoyancy strength (1 = just floats), default 1.6 @experimental */
|
|
106
102
|
buoyancyForce?: number;
|
|
107
|
-
/** Drag in water, default 2.5 */
|
|
103
|
+
/** Drag in water, default 2.5 @experimental */
|
|
108
104
|
waterDrag?: number;
|
|
109
|
-
/** Buoyancy "waterline": an object starts floating when its center is this many meters below the water surface, default 0.3 */
|
|
105
|
+
/** Buoyancy "waterline": an object starts floating when its center is this many meters below the water surface, default 0.3 @experimental */
|
|
110
106
|
floatLine?: number;
|
|
111
|
-
/** Buoyancy reaches its maximum this many meters further down, default 0.8 */
|
|
107
|
+
/** Buoyancy reaches its maximum this many meters further down, default 0.8 @experimental */
|
|
112
108
|
floatDepth?: number;
|
|
113
|
-
/** Height (meters) of vegetation collision pillars (tree trunks), default 6 */
|
|
109
|
+
/** Height (meters) of vegetation collision pillars (tree trunks), default 6 @experimental */
|
|
114
110
|
treeColliderHeight?: number;
|
|
115
|
-
/** Trunks get collision cylinders only in chunks within this many meters of the player or a moving rigid body (the rest are covered by engine.collision for characters), default 16 */
|
|
111
|
+
/** Trunks get collision cylinders only in chunks within this many meters of the player or a moving rigid body (the rest are covered by engine.collision for characters), default 16 @experimental */
|
|
116
112
|
treeRadius?: number;
|
|
117
|
-
/** Player capsule size (meters), default computed from engine.movement radius / height */
|
|
113
|
+
/** Player capsule size (meters), default computed from engine.movement radius / height @experimental */
|
|
118
114
|
playerCapsule?: { halfHeight: number; radius: number };
|
|
119
115
|
}
|
|
120
116
|
/** Parameters for adding a physics body */
|
|
@@ -154,9 +150,9 @@ export interface RigidEntry extends Handle {
|
|
|
154
150
|
collider: any;
|
|
155
151
|
/** The matching three.js model (position is written by physics every step) */
|
|
156
152
|
mesh: Object3D;
|
|
157
|
-
/** Same as mesh
|
|
153
|
+
/** Same as mesh */
|
|
158
154
|
object: Object3D;
|
|
159
|
-
/** Whether it is being simulated
|
|
155
|
+
/** Whether it is being simulated: false while it is outside the terrain colliders (rigid({ terrainRing })), where it would fall through the ground */
|
|
160
156
|
enabled: boolean;
|
|
161
157
|
/** Volume (cubic meters, used for buoyancy) */
|
|
162
158
|
volume: number;
|
|
@@ -167,6 +163,30 @@ export interface RigidEntry extends Handle {
|
|
|
167
163
|
remove(): void;
|
|
168
164
|
}
|
|
169
165
|
|
|
166
|
+
/** Options of engine.rigid.ragdoll @experimental */
|
|
167
|
+
export interface RagdollOptions {
|
|
168
|
+
/** A push (kg*m/s) on the part nearest position, else on hips. A hit stronger than the part can take spreads to the whole body, total momentum unchanged */
|
|
169
|
+
impulse?: Vec3Like;
|
|
170
|
+
/** Where the push lands (world) */
|
|
171
|
+
position?: PositionLike;
|
|
172
|
+
/** Part -> bone name or bone, over the auto-detection. Parts: hips, chest, head, upperArmL, lowerArmL, upperArmR, lowerArmR, upperLegL, lowerLegL, upperLegR, lowerLegR */
|
|
173
|
+
bones?: Record<string, string | Object3D>;
|
|
174
|
+
/** Part or kind ('lowerLeg', 'upperArm', 'chest', 'head'...) -> [min, max] radians from the bind pose: bend forward (a knee: backward), side, twist along the bone */
|
|
175
|
+
limits?: Record<string, { bend?: [number, number]; side?: [number, number]; twist?: [number, number] }>;
|
|
176
|
+
/** Whole body, kg (default 70) */
|
|
177
|
+
mass?: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** What engine.rigid.ragdoll returns. remove() gives the character back; safe to call twice @experimental */
|
|
181
|
+
export interface Ragdoll extends Handle {
|
|
182
|
+
/** False once removed (remove(), a load, the character deleted) */
|
|
183
|
+
readonly active: boolean;
|
|
184
|
+
/** Every part is at rest (asleep or frozen). Nothing is written to the bones then, so a game's own bone write stays */
|
|
185
|
+
readonly settled: boolean;
|
|
186
|
+
/** Part name -> its rigid entry: entry.body for forces, entry.object is the bone; engine.raycast hits carry the same entry. The bones stay plain three.js */
|
|
187
|
+
readonly parts: Record<string, RigidEntry>;
|
|
188
|
+
}
|
|
189
|
+
|
|
170
190
|
/** engine.rigid (real physics; bodies can only be added after start(), or in the engine:ready event) */
|
|
171
191
|
export interface RigidBodies {
|
|
172
192
|
/** Is the physics engine ready (downloaded and initialized at start()) */
|
|
@@ -174,33 +194,41 @@ export interface RigidBodies {
|
|
|
174
194
|
/** All physics bodies */
|
|
175
195
|
bodies: RigidEntry[];
|
|
176
196
|
gravity: number;
|
|
177
|
-
terrainRing: number;
|
|
178
|
-
buoyancy: boolean;
|
|
179
|
-
buoyancyForce: number;
|
|
180
|
-
waterDrag: number;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
/**
|
|
197
|
+
/** @experimental */ terrainRing: number;
|
|
198
|
+
/** @experimental */ buoyancy: boolean;
|
|
199
|
+
/** @experimental */ buoyancyForce: number;
|
|
200
|
+
/** @experimental */ waterDrag: number;
|
|
201
|
+
/** @experimental */ floatLine: number;
|
|
202
|
+
/** @experimental */ floatDepth: number;
|
|
203
|
+
/** @experimental */ treeColliderHeight: number;
|
|
204
|
+
/** @experimental */ treeRadius: number;
|
|
205
|
+
/** The Rapier library itself: its shape follows the Rapier version @experimental */
|
|
206
|
+
rapier: any;
|
|
207
|
+
/** The Rapier world: its shape follows the Rapier version @experimental */
|
|
185
208
|
world: any;
|
|
186
209
|
/** Add a box (crate). Physics is ready after engine.start() (or on engine:ready): called before, it throws in development, a release build warns once and returns null */
|
|
187
210
|
addBox(mesh: Object3D, opts?: RigidBoxOptions): RigidEntry | null;
|
|
188
|
-
/** Add a ball */
|
|
211
|
+
/** Add a ball; null only as in addBox: a release build, called before physics is ready @experimental */
|
|
189
212
|
addBall(mesh: Object3D, opts?: RigidBallOptions): RigidEntry | null;
|
|
190
|
-
/** Add a convex hull (irregular objects such as rocks and barrels) */
|
|
213
|
+
/** Add a convex hull (irregular objects such as rocks and barrels); null only as in addBox: a release build, called before physics is ready @experimental */
|
|
191
214
|
addHull(mesh: Object3D, opts?: RigidBodyOptions): RigidEntry | null;
|
|
215
|
+
/**
|
|
216
|
+
* Turn a skinned character limp in one call; rd.remove() returns it to animation. who: a Character, an NPC handle, a character id or a skinned Object3D.
|
|
217
|
+
* Its mover, animator, capsule and camera yield until then; calling again on the same one pushes it again and returns the same ragdoll.
|
|
218
|
+
* Not saved: any load ends it. A skeleton it cannot read throws, naming the missing parts. @experimental
|
|
219
|
+
*/
|
|
220
|
+
ragdoll(who: any, opts?: RagdollOptions): Ragdoll | null;
|
|
192
221
|
/** Give it a push: impulse vector impulse (Vector3 / [x, y, z] / { x, y, z }), e.g. impulse(ball, [0, 3, 5]) */
|
|
193
222
|
impulse(entry: RigidEntry, impulse: Vec3Like): void;
|
|
194
223
|
/** Teleport to position (velocity is zeroed) */
|
|
195
224
|
setPosition(entry: RigidEntry, position: PositionLike): void;
|
|
196
|
-
/** The player's Rapier kinematic body and capsule collider (follow the player position every step; used for collision when mover: 'rapier'; the capsule is off while driving) */
|
|
225
|
+
/** The player's Rapier kinematic body and capsule collider (follow the player position every step; used for collision when mover: 'rapier'; the capsule is off while driving) @experimental */
|
|
197
226
|
playerBody: any;
|
|
227
|
+
/** The capsule collider on playerBody @experimental */
|
|
198
228
|
playerCollider: any;
|
|
199
|
-
/** Player capsule size (meters) */
|
|
229
|
+
/** Player capsule size (meters) @experimental */
|
|
200
230
|
playerCapsule: { halfHeight: number; radius: number };
|
|
201
|
-
/**
|
|
202
|
-
groundReady(position: PositionLike): boolean;
|
|
203
|
-
/** All vehicles */
|
|
231
|
+
/** All vehicles @experimental */
|
|
204
232
|
vehicles: Vehicle[];
|
|
205
233
|
/**
|
|
206
234
|
* Turn a model into a wheeled vehicle (Rapier ray-cast vehicle controller: cars, karts, carts); remove it with vehicle.remove() (anyone inside gets out
|
|
@@ -335,7 +363,7 @@ export interface AnimatorInfo {
|
|
|
335
363
|
}
|
|
336
364
|
/** Animation state machine parameters */
|
|
337
365
|
export interface AnimatorOptions {
|
|
338
|
-
/** Default transition seconds, default 0.25 (
|
|
366
|
+
/** Default transition seconds, default 0.25 (characters({ animation: { fade } }) for every character) */
|
|
339
367
|
fade?: number;
|
|
340
368
|
/** States: name → state */
|
|
341
369
|
states?: Record<string, AnimatorState>;
|
|
@@ -347,6 +375,8 @@ export interface AnimatorOptions {
|
|
|
347
375
|
/** Skeletal animation state machine (returned by engine.assets.animate(model, config)) */
|
|
348
376
|
export declare class Animator {
|
|
349
377
|
constructor(engine: Engine, root: Object3D, opts?: AnimatorOptions);
|
|
378
|
+
/** The animated object */
|
|
379
|
+
root: Object3D;
|
|
350
380
|
/** three.js AnimationMixer */
|
|
351
381
|
mixer: any;
|
|
352
382
|
/** clip name → three.js AnimationAction */
|
|
@@ -419,7 +449,7 @@ export interface FollowCameraOptions {
|
|
|
419
449
|
size?: number;
|
|
420
450
|
/** Which side of the focus the camera sits on (radians), default 0.8: camera = focus + (sin yaw, cos yaw) × distance, it looks along forward() = -(sin yaw, cos yaw). Behind a character facing f: yaw = f + PI */
|
|
421
451
|
yaw?: number;
|
|
422
|
-
/** Pitch angle (radians), default 0.42 */
|
|
452
|
+
/** Pitch angle (radians), default 0.42. Positive = camera above the look point, looking down: the opposite of firstPersonCamera's pitch */
|
|
423
453
|
pitch?: number;
|
|
424
454
|
/** Distance (meters), default 13 */
|
|
425
455
|
distance?: number;
|
|
@@ -428,18 +458,18 @@ export interface FollowCameraOptions {
|
|
|
428
458
|
maxDistance?: number;
|
|
429
459
|
/** How high above the character to look at (meters), default 1.4 */
|
|
430
460
|
height?: number;
|
|
431
|
-
/** Follow smoothing, default 10 */
|
|
461
|
+
/** Follow smoothing, default 10 @experimental */
|
|
432
462
|
smoothing?: number;
|
|
433
463
|
/** Drag sensitivity, default 1 */
|
|
434
464
|
sensitivity?: number;
|
|
435
465
|
/** Pitch range (radians) */
|
|
436
466
|
minPitch?: number;
|
|
437
|
-
maxPitch?: number;
|
|
438
|
-
/** Zoom ratio per wheel notch, default 0.1 */
|
|
467
|
+
/** @experimental */ maxPitch?: number;
|
|
468
|
+
/** Zoom ratio per wheel notch, default 0.1 @experimental */
|
|
439
469
|
zoomStep?: number;
|
|
440
|
-
/** Minimum camera height above the ground (meters), default 1.2 */
|
|
470
|
+
/** Minimum camera height above the ground (meters), default 1.2 @experimental */
|
|
441
471
|
groundClearance?: number;
|
|
442
|
-
/** Invert vertical */
|
|
472
|
+
/** Invert vertical @experimental */
|
|
443
473
|
invertY?: boolean;
|
|
444
474
|
/** Lock the pitch angle (top-down games) */
|
|
445
475
|
lockPitch?: boolean;
|
|
@@ -519,9 +549,9 @@ export interface FirstPersonCameraOptions {
|
|
|
519
549
|
fov?: number | null;
|
|
520
550
|
/** Walking bob amplitude (meters), 0 off, default 0.04 */
|
|
521
551
|
headBob?: number;
|
|
522
|
-
/** Bobs per meter */
|
|
552
|
+
/** Bobs per meter @experimental */
|
|
523
553
|
bobFrequency?: number;
|
|
524
|
-
/** Hide the character itself (its shadow remains), default true */
|
|
554
|
+
/** Hide the character itself (its shadow remains), default true @experimental */
|
|
525
555
|
hideTarget?: boolean;
|
|
526
556
|
/** Layer number used for hiding 0–31 */
|
|
527
557
|
hideLayer?: number;
|
|
@@ -531,15 +561,16 @@ export interface FirstPersonCameraOptions {
|
|
|
531
561
|
swallowLockClick?: boolean;
|
|
532
562
|
/** Initial heading (radians) */
|
|
533
563
|
yaw?: number;
|
|
564
|
+
/** Initial look angle (radians), default 0 = level. Positive looks up, negative down: the opposite of followCamera's pitch */
|
|
534
565
|
pitch?: number;
|
|
535
|
-
/** Look down / up limit (radians) */
|
|
566
|
+
/** Look down / up limit (radians), default -1.45 / 1.45 */
|
|
536
567
|
minPitch?: number;
|
|
537
|
-
maxPitch?: number;
|
|
538
|
-
/** Turn range left / right [min, max] (radians), unlimited by default */
|
|
568
|
+
/** @experimental */ maxPitch?: number;
|
|
569
|
+
/** Turn range left / right [min, max] (radians), unlimited by default @experimental */
|
|
539
570
|
yawLimits?: number[] | null;
|
|
540
|
-
/** Smoothing of the camera following the body */
|
|
571
|
+
/** Smoothing of the camera following the body @experimental */
|
|
541
572
|
smoothing?: number;
|
|
542
|
-
/** Invert vertical */
|
|
573
|
+
/** Invert vertical @experimental */
|
|
543
574
|
invertY?: boolean;
|
|
544
575
|
}
|
|
545
576
|
/** First-person camera */
|
|
@@ -577,24 +608,24 @@ export interface FixedCameraOptions extends Partial<CameraShot> {
|
|
|
577
608
|
start?: string | null;
|
|
578
609
|
/** Automatic switching: false | 'nearest' (pick the one nearest to the player) */
|
|
579
610
|
auto?: false | 'nearest';
|
|
580
|
-
/** Check interval for automatic switching (seconds) */
|
|
611
|
+
/** Check interval for automatic switching (seconds) @experimental */
|
|
581
612
|
autoInterval?: number;
|
|
582
613
|
/** How many meters closer a new shot must be to switch (prevents flipping back and forth) */
|
|
583
614
|
hysteresis?: number;
|
|
584
|
-
/** Transition seconds for trigger-zone switches (0 = hard cut) */
|
|
615
|
+
/** Transition seconds for trigger-zone switches (0 = hard cut) @experimental */
|
|
585
616
|
triggerBlend?: number;
|
|
586
|
-
/** How high above the character a track shot looks (meters) */
|
|
617
|
+
/** How high above the character a track shot looks (meters) @experimental */
|
|
587
618
|
trackHeight?: number;
|
|
588
|
-
/** Head-follow smoothing */
|
|
619
|
+
/** Head-follow smoothing @experimental */
|
|
589
620
|
trackSmoothing?: number;
|
|
590
|
-
/** Keep the direction when switching shots until the direction key is released */
|
|
621
|
+
/** Keep the direction when switching shots until the direction key is released @experimental */
|
|
591
622
|
holdDirection?: boolean;
|
|
592
623
|
/** Transition easing */
|
|
593
624
|
ease?: Ease;
|
|
594
625
|
}
|
|
595
626
|
/** Fixed-shot camera */
|
|
596
627
|
export interface FixedCamera extends CameraRigBase {
|
|
597
|
-
/** All shots */
|
|
628
|
+
/** All shots. A shot stays where it was placed: for a view that pans at a fixed angle use followCamera({ mouseLook: false }) (recipe 21 section 6) */
|
|
598
629
|
shots: Record<string, any>;
|
|
599
630
|
/** Current shot name */
|
|
600
631
|
current: string | null;
|
|
@@ -623,30 +654,30 @@ export interface RtsCameraOptions {
|
|
|
623
654
|
minHeight?: number;
|
|
624
655
|
maxHeight?: number;
|
|
625
656
|
/** Pitch down angle (radians, π/2 = straight down), default 0.95 */
|
|
626
|
-
|
|
657
|
+
pitch?: number;
|
|
627
658
|
/** Initial horizontal heading (radians) */
|
|
628
659
|
yaw?: number;
|
|
629
|
-
/** Pan speed multiplier */
|
|
660
|
+
/** Pan speed multiplier @experimental */
|
|
630
661
|
panSpeed?: number;
|
|
631
|
-
/** Drag with the mouse to pan, default true */
|
|
662
|
+
/** Drag with the mouse to pan, default true @experimental */
|
|
632
663
|
dragPan?: boolean;
|
|
633
|
-
/** Pan at the screen edge, default false */
|
|
664
|
+
/** Pan at the screen edge, default false @experimental */
|
|
634
665
|
edgePan?: boolean;
|
|
635
|
-
/** Edge width (fraction of the screen) */
|
|
666
|
+
/** Edge width (fraction of the screen) @experimental */
|
|
636
667
|
edgeSize?: number;
|
|
637
668
|
/** Focus range (meters) */
|
|
638
669
|
bounds?: { minX?: number; maxX?: number; minZ?: number; maxZ?: number } | null;
|
|
639
670
|
/** false: no turning. Default true: declares the actions rotateLeft / rotateRight (no keys; presets.bindings.rtsRotate binds Q / R) */
|
|
640
671
|
rotate?: boolean;
|
|
641
|
-
/** Rotation speed (radians/second) */
|
|
672
|
+
/** Rotation speed (radians/second) @experimental */
|
|
642
673
|
rotateSpeed?: number;
|
|
643
|
-
/** Zoom ratio per wheel notch */
|
|
674
|
+
/** Zoom ratio per wheel notch @experimental */
|
|
644
675
|
zoomStep?: number;
|
|
645
|
-
/** Smoothing */
|
|
676
|
+
/** Smoothing @experimental */
|
|
646
677
|
smoothing?: number;
|
|
647
678
|
/** Field of view (degrees); unchanged if omitted */
|
|
648
679
|
fov?: number | null;
|
|
649
|
-
/** Manual panning is not allowed while following */
|
|
680
|
+
/** Manual panning is not allowed while following @experimental */
|
|
650
681
|
followLock?: boolean;
|
|
651
682
|
/** Initial focus (position) */
|
|
652
683
|
start?: PositionLike | null;
|
package/types/tsl.d.ts
CHANGED
|
@@ -10,13 +10,15 @@ type Node = any;
|
|
|
10
10
|
* position: object space before the instance transform (positionGeometry); origin: the object's world origin (objectOrigin());
|
|
11
11
|
* amplitude: metres per metre of height. Reads uTime, uWind, uWindFreq.
|
|
12
12
|
* @example
|
|
13
|
-
* mat.positionNode = positionLocal.add(wind(positionGeometry, objectOrigin(), float(0.3))); // plain Mesh (InstancedMesh:
|
|
13
|
+
* mat.positionNode = positionLocal.add(wind(positionGeometry, objectOrigin(), float(0.3))); // plain Mesh (InstancedMesh: wrap the offset in instanceOffset())
|
|
14
|
+
* @experimental
|
|
14
15
|
*/
|
|
15
16
|
export function wind(position: Node, origin: Node, amplitude: Node | number): Node;
|
|
16
17
|
/**
|
|
17
|
-
* GLSL float threedogCloudShadow(vec3 worldPos): light factor 0-1 under the drifting clouds (1 = no shadow). Reads uTime,
|
|
18
|
+
* GLSL float threedogCloudShadow(vec3 worldPos): light factor 0-1 under the drifting clouds (1 = no shadow). Reads uTime, uWeatherCloud, uCloudShadow*, uCloudShadowSpeed.
|
|
18
19
|
* @example
|
|
19
20
|
* mat.colorNode = color(0x88aa66).mul(cloudShadow(positionWorld));
|
|
21
|
+
* @experimental
|
|
20
22
|
*/
|
|
21
23
|
export function cloudShadow(worldPos: Node): Node;
|
|
22
24
|
/**
|
|
@@ -24,19 +26,42 @@ export function cloudShadow(worldPos: Node): Node;
|
|
|
24
26
|
* A vec4 color is read as its rgb.
|
|
25
27
|
* @example
|
|
26
28
|
* mat.colorNode = season(texture(map), 0);
|
|
29
|
+
* @experimental
|
|
27
30
|
*/
|
|
28
31
|
export function season(color: Node, kind: Node | 0 | 1): Node;
|
|
29
32
|
/**
|
|
30
33
|
* World position of the drawn object's origin (an InstancedMesh: of each instance), vec3. Works for any Mesh / InstancedMesh sharing the material;
|
|
31
34
|
* BatchedMesh throws [tsl-misuse].
|
|
35
|
+
* @experimental
|
|
32
36
|
*/
|
|
33
37
|
export function objectOrigin(): Node;
|
|
34
38
|
/**
|
|
35
|
-
*
|
|
39
|
+
* An object-space offset carried through the drawn instance's rotation and scale (a plain Mesh: the offset as it is). A positionNode runs after the instance transform, so an
|
|
40
|
+
* offset meant for before it, like wind()'s, goes through this. BatchedMesh throws [tsl-misuse].
|
|
41
|
+
* @example
|
|
42
|
+
* mat.positionNode = positionLocal.add(instanceOffset(wind(positionGeometry, objectOrigin(), float(0.3))));
|
|
43
|
+
* @experimental
|
|
44
|
+
*/
|
|
45
|
+
export function instanceOffset(offset: Node): Node;
|
|
46
|
+
/**
|
|
47
|
+
* GLSL float threedogHash(vec2 p): a repeatable random number 0-1 from a 2D position.
|
|
48
|
+
* @experimental
|
|
49
|
+
*/
|
|
50
|
+
export function hash(p: Node): Node;
|
|
51
|
+
/**
|
|
52
|
+
* GLSL float threedogNoise(vec2 p): smooth value noise 0-1, the one behind the engine's clouds and cloud shadows. No uniforms.
|
|
53
|
+
* @example
|
|
54
|
+
* mat.colorNode = color(0x88aa66).mul(noise(positionWorld.xz.mul(0.5)).mul(0.4).add(0.8));
|
|
55
|
+
* @experimental
|
|
56
|
+
*/
|
|
57
|
+
export function noise(p: Node): Node;
|
|
58
|
+
/**
|
|
59
|
+
* engine.uniforms as TSL uniform nodes (uTime, uWind, uWeatherCloud, uFoliageTint, uSunDir, uDaylight ...), cached per engine. They read the same
|
|
36
60
|
* { value } objects, so engine.uniforms.uWind.value = 2 changes GLSL and TSL materials alike.
|
|
37
61
|
* @example
|
|
38
62
|
* const u = uniforms(engine);
|
|
39
63
|
* mat.emissiveNode = color(0xffcc66).mul(float(1).sub(u.uDaylight));
|
|
64
|
+
* @experimental
|
|
40
65
|
*/
|
|
41
66
|
export function uniforms(engine: { uniforms: object }): Record<string, Node>;
|
|
42
67
|
/**
|
|
@@ -44,6 +69,7 @@ export function uniforms(engine: { uniforms: object }): Record<string, Node>;
|
|
|
44
69
|
* No uniforms: p is any 2D pattern position you choose (world xz times a scale, a uv...). octaves: up to 4 (dabs: 3).
|
|
45
70
|
* @example
|
|
46
71
|
* mat.colorNode = color(0xb09070).mul(detailNoise(positionWorld.xz.mul(4), 1, 2).rgb.mul(2));
|
|
72
|
+
* @experimental
|
|
47
73
|
*/
|
|
48
74
|
export function detailNoise(p: Node, kind: Node | 0 | 1 | 2 | 3, octaves: Node | number): Node;
|
|
49
75
|
/**
|
|
@@ -51,36 +77,51 @@ export function detailNoise(p: Node, kind: Node | 0 | 1 | 2 | 3, octaves: Node |
|
|
|
51
77
|
* View space; the result is a normal for material.normalNode.
|
|
52
78
|
* @example
|
|
53
79
|
* mat.normalNode = detailBump(positionView, normalView, detailNoise(positionWorld.xz.mul(4), 0, 2).a, 1, faceDirection);
|
|
80
|
+
* @experimental
|
|
54
81
|
*/
|
|
55
82
|
export function detailBump(surfPos: Node, surfNorm: Node, h: Node, k: Node | number, faceDir: Node | number): Node;
|
|
56
83
|
/**
|
|
57
84
|
* GLSL vec3 threedogWrapDiffuse(float nl, float wrap, vec3 lightColor, float shadow, vec3 albedo): the half-lambert light beyond plain Lambert,
|
|
58
85
|
* to add to directDiffuse. nl = dot(normal, sunDir). Call it from your LightingModel's direct() (lightColor there already carries the shadow: pass shadow 1).
|
|
86
|
+
* @experimental
|
|
59
87
|
*/
|
|
60
88
|
export function wrapDiffuse(nl: Node, wrap: Node | number, lightColor: Node, shadow: Node | number, albedo: Node): Node;
|
|
61
89
|
/**
|
|
62
90
|
* GLSL vec3 threedogShadowTint(vec3 ambient, vec3 tint, float strength, float soft, float nl, float shadow): the ambient with the shaded side's hue moved
|
|
63
91
|
* toward tint (brightness kept). shadow: 1 lit / 0 shadowed (the sun's lightNode.shadowNode); soft: terminator width in n.l.
|
|
92
|
+
* @experimental
|
|
64
93
|
*/
|
|
65
94
|
export function shadowTint(ambient: Node, tint: Node, strength: Node | number, soft: Node | number, nl: Node, shadow: Node | number): Node;
|
|
66
95
|
/**
|
|
67
96
|
* GLSL vec3 threedogRim(vec3 normal, vec3 viewDir, vec3 color, float strength, float power, float shadowSide, float nl): edge light to add
|
|
68
97
|
* (viewDir from the surface to the eye, e.g. normalView and positionViewDirection); shadowSide 1 = only on the side facing away from the sun.
|
|
98
|
+
* @experimental
|
|
69
99
|
*/
|
|
70
100
|
export function rim(normal: Node, viewDir: Node, color: Node, strength: Node | number, power: Node | number, shadowSide: Node | number, nl: Node): Node;
|
|
101
|
+
/**
|
|
102
|
+
* The lighting model for cel bands with colored ramps: assign it to a MeshToonNodeMaterial, whose gradientMap holds the ramp (rampTexture). A shadowed pixel reads the
|
|
103
|
+
* dark end of the ramp, so a cast shadow takes the same flat band and color as the side turned away. Without a gradientMap: two levels, as three's toon.
|
|
104
|
+
* @example
|
|
105
|
+
* const mat = new MeshToonNodeMaterial({ color: 0xe08050, gradientMap: rampTexture([0x4a5a9a, 0xc0c8e0, 0xffffff]) });
|
|
106
|
+
* mat.setupLightingModel = celLighting;
|
|
107
|
+
* @experimental
|
|
108
|
+
*/
|
|
109
|
+
export function celLighting(): import('three/webgpu').LightingModel;
|
|
71
110
|
/**
|
|
72
111
|
* GLSL float threedogWaterWave(vec3 p, float t): the built-in wave sum (height before waveHeight). p = world position * waveScale, t = time * waveSpeed.
|
|
73
112
|
* @example
|
|
74
113
|
* const h = waterWave(modelWorldMatrix.mul(vec4(positionGeometry, 1)).xyz, uniforms(engine).uTime).toVarying();
|
|
75
114
|
* mat.positionNode = positionLocal.add(vec3(0, h, 0));
|
|
115
|
+
* @experimental
|
|
76
116
|
*/
|
|
77
117
|
export function waterWave(p: Node, t: Node | number): Node;
|
|
78
118
|
/**
|
|
79
119
|
* The built-in water surface as TSL: returns a function with the GLSL signature threedogWaterSurface(base, wave, facing, worldPos, time) -> vec4 (rgb, opacity).
|
|
80
120
|
* Only the parts given exist (depth: shallow / deep by viewing angle or wave height; foam on crests); values are numbers / colors or nodes.
|
|
81
121
|
* wave is waterWave's height, facing = 1 looking straight down.
|
|
122
|
+
* @experimental
|
|
82
123
|
*/
|
|
83
124
|
export function waterSurface(spec?: { depth?: { shallow?: any, deep?: any, curve?: any, by?: 'view' | 'wave' }, foam?: { color?: any, start?: any, end?: any, opacity?: any }, waveMax?: number }):
|
|
84
125
|
(base: Node, wave: Node, facing: Node, worldPos: Node, time: Node) => Node;
|
|
85
|
-
/** The water's fresnel blend: color mixed toward `towards` (the engine uses the fog color) by pow(1 - |viewDir . normal|, 3) * strength, view space */
|
|
126
|
+
/** The water's fresnel blend: color mixed toward `towards` (the engine uses the fog color) by pow(1 - |viewDir . normal|, 3) * strength, view space @experimental */
|
|
86
127
|
export function waterFresnel(color: Node, normal: Node, viewDir: Node, strength: Node | number, towards: Node): Node;
|