threedog 0.0.0-stage → 0.2.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 +5 -0
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/core/Animator.js +268 -0
- package/core/Assets.js +256 -0
- package/core/Audio.js +267 -0
- package/core/Baked.js +72 -0
- package/core/Batching.js +247 -0
- package/core/Budget.js +221 -0
- package/core/Clock.js +94 -0
- package/core/Commits.js +77 -0
- package/core/DebugOverrides.js +143 -0
- package/core/Describe.js +145 -0
- package/core/Engine.js +184 -0
- package/core/Events.js +153 -0
- package/core/I18n.js +94 -0
- package/core/Input.js +245 -0
- package/core/Inspect.js +77 -0
- package/core/InspectScene.js +191 -0
- package/core/Jobs.js +146 -0
- package/core/Loading.js +149 -0
- package/core/MaterialInfo.js +32 -0
- package/core/Ops.js +256 -0
- package/core/Random.js +52 -0
- package/core/Rays.js +160 -0
- package/core/SaveStore.js +85 -0
- package/core/Saves.js +254 -0
- package/core/Stream.js +279 -0
- package/core/Threads.js +158 -0
- package/core/UrlState.js +94 -0
- package/core/Vars.js +35 -0
- package/core/Views.js +49 -0
- package/core/actor.js +23 -0
- package/core/assetEntry.js +89 -0
- package/core/assetLoad.js +190 -0
- package/core/assetManifest.js +35 -0
- package/core/assetReport.js +83 -0
- package/core/audioRules.js +121 -0
- package/core/audioVoice.js +225 -0
- package/core/batchGroups.js +116 -0
- package/core/canvasBox.js +63 -0
- package/core/catalog.js +169 -0
- package/core/checks.js +67 -0
- package/core/claims.js +51 -0
- package/core/dayTime.js +15 -0
- package/core/debugView.js +76 -0
- package/core/describeRender.js +45 -0
- package/core/describeText.js +143 -0
- package/core/easing.js +34 -0
- package/core/errorCodes.js +205 -0
- package/core/errorHints.js +208 -0
- package/core/errors.js +40 -0
- package/core/events.generated.js +84 -0
- package/core/ground.js +102 -0
- package/core/holds.js +106 -0
- package/core/inputContext.js +69 -0
- package/core/inputDefaults.js +22 -0
- package/core/inputPad.js +35 -0
- package/core/inputPointer.js +48 -0
- package/core/inputTouch.js +48 -0
- package/core/lifecycle.js +69 -0
- package/core/lightWatch.js +56 -0
- package/core/look/coreParts.js +112 -0
- package/core/look/layers.js +136 -0
- package/core/look/part.js +173 -0
- package/core/look/report.js +79 -0
- package/core/look/write.js +86 -0
- package/core/loop.js +200 -0
- package/core/math.js +33 -0
- package/core/modules.js +196 -0
- package/core/movement.js +19 -0
- package/core/mulberry32.js +14 -0
- package/core/opsAtomic.js +31 -0
- package/core/opsCheck.js +97 -0
- package/core/opsFail.js +20 -0
- package/core/opsGuard.js +26 -0
- package/core/opsHistory.js +27 -0
- package/core/opsRun.js +77 -0
- package/core/page.js +78 -0
- package/core/params.js +132 -0
- package/core/pureWorker.js +5 -0
- package/core/renamed.js +21 -0
- package/core/saveApply.js +128 -0
- package/core/saveFiles.js +139 -0
- package/core/saveIds.js +53 -0
- package/core/saveVersions.js +97 -0
- package/core/scatter.js +92 -0
- package/core/sceneMethods.js +100 -0
- package/core/screenToGround.js +39 -0
- package/core/services.js +73 -0
- package/core/session.js +171 -0
- package/core/shadowTypes.js +15 -0
- package/core/skip.js +104 -0
- package/core/startup.js +135 -0
- package/core/streamCells.js +24 -0
- package/core/streamSources.js +73 -0
- package/core/styleParts.js +96 -0
- package/core/targeting.js +64 -0
- package/core/thingExplain.js +68 -0
- package/core/thingOps.js +168 -0
- package/core/things.js +212 -0
- package/core/threadPure.js +120 -0
- package/core/threadServe.js +25 -0
- package/core/tier.js +11 -0
- package/core/util.js +11 -0
- package/core/validate.js +204 -0
- package/docs/AI.md +123 -0
- package/docs/API.md +83 -0
- package/docs/CODEMAP.md +347 -0
- package/docs/COMMANDS.md +108 -0
- package/docs/CONVENTIONS.md +145 -0
- package/docs/PERF.md +217 -0
- package/docs/THREE.md +86 -0
- package/docs/api/ambience.md +15 -0
- package/docs/api/assets.md +62 -0
- package/docs/api/audio.md +53 -0
- package/docs/api/budget.md +40 -0
- package/docs/api/cameraRig.md +120 -0
- package/docs/api/characters.md +144 -0
- package/docs/api/clock.md +7 -0
- package/docs/api/collision.md +39 -0
- package/docs/api/content.md +64 -0
- package/docs/api/dialogue.md +39 -0
- package/docs/api/engine.md +199 -0
- package/docs/api/entities.md +61 -0
- package/docs/api/events.md +95 -0
- package/docs/api/flow.md +27 -0
- package/docs/api/grids.md +11 -0
- package/docs/api/ground.md +16 -0
- package/docs/api/hlod.md +34 -0
- package/docs/api/hud.md +31 -0
- package/docs/api/i18n.md +10 -0
- package/docs/api/input.md +24 -0
- package/docs/api/interactions.md +31 -0
- package/docs/api/inventory.md +66 -0
- package/docs/api/jobs.md +10 -0
- package/docs/api/level.md +41 -0
- package/docs/api/lightPool.md +56 -0
- package/docs/api/music.md +34 -0
- package/docs/api/nav.md +26 -0
- package/docs/api/net.md +14 -0
- package/docs/api/openWorld.md +24 -0
- package/docs/api/particles.md +41 -0
- package/docs/api/photo.md +15 -0
- package/docs/api/post.md +10 -0
- package/docs/api/quests.md +36 -0
- package/docs/api/rays.md +26 -0
- package/docs/api/rigid.md +84 -0
- package/docs/api/saves.md +32 -0
- package/docs/api/settings.md +36 -0
- package/docs/api/sky.md +58 -0
- package/docs/api/stream.md +31 -0
- package/docs/api/style.md +134 -0
- package/docs/api/terrain.md +34 -0
- package/docs/api/timeline.md +39 -0
- package/docs/api/tools.md +57 -0
- package/docs/api/triggers.md +56 -0
- package/docs/api/vars.md +9 -0
- package/docs/api/vegetation.md +52 -0
- package/docs/api/water.md +48 -0
- package/docs/api/weather.md +29 -0
- package/docs/api/world.md +30 -0
- package/docs/recipes/01-new-game.md +148 -0
- package/docs/recipes/02-npc.md +167 -0
- package/docs/recipes/03-items-pickups.md +158 -0
- package/docs/recipes/04-quests.md +83 -0
- package/docs/recipes/05-props-bake.md +159 -0
- package/docs/recipes/06-clock-events.md +117 -0
- package/docs/recipes/07-flow-scenes-pause.md +132 -0
- package/docs/recipes/08-weather-sky.md +74 -0
- package/docs/recipes/09-style-pack.md +234 -0
- package/docs/recipes/10-blender-level.md +67 -0
- package/docs/recipes/11-vehicles.md +55 -0
- package/docs/recipes/12-navmesh.md +79 -0
- package/docs/recipes/13-animation.md +149 -0
- package/docs/recipes/14-custom-module.md +91 -0
- package/docs/recipes/15-perf.md +78 -0
- package/docs/recipes/16-dev-bridge.md +180 -0
- package/docs/recipes/18-world.md +185 -0
- package/docs/recipes/19-shooting-picking.md +76 -0
- package/docs/recipes/20-content-actions-save.md +176 -0
- package/docs/recipes/21-camera.md +153 -0
- package/docs/recipes/22-shop-gold.md +107 -0
- package/docs/recipes/23-ops.md +175 -0
- package/docs/recipes/26-ui-parts.md +138 -0
- package/docs/recipes/27-net.md +96 -0
- package/docs/recipes/28-terrain.md +80 -0
- package/docs/recipes/29-grid.md +87 -0
- package/docs/recipes/30-templates.md +131 -0
- package/docs/recipes/31-audio.md +126 -0
- package/docs/recipes/32-action-game.md +33 -0
- package/docs/recipes/33-stream-sources.md +37 -0
- package/docs/recipes/34-environment-lighting.md +36 -0
- package/docs/recipes/35-style-from-reference.md +89 -0
- package/docs/recipes/36-sky-ground-plant-looks.md +116 -0
- package/docs/recipes/37-terrain-look-hooks.md +97 -0
- package/docs/recipes/38-environment-look-hooks.md +83 -0
- package/docs/recipes/40-scene.md +108 -0
- package/docs/recipes/41-thing-registry.md +93 -0
- package/docs/recipes/42-terrain-shape.md +64 -0
- package/docs/recipes/43-shader-patches-surface-looks.md +120 -0
- package/docs/recipes/44-water-weather-look-hooks.md +135 -0
- package/docs/recipes/45-cascaded-shadows.md +51 -0
- package/docs/recipes/46-blender-art-route.md +114 -0
- package/docs/recipes/47-island-snow-backdrop.md +44 -0
- package/docs/recipes/48-make-material.md +70 -0
- package/docs/recipes/49-game-module-contract.md +71 -0
- package/docs/recipes/50-own-renderer.md +12 -0
- package/docs/recipes/51-capability-catalog.md +63 -0
- package/docs/recipes/52-look.md +108 -0
- package/examples/action/DESIGN.md +3 -0
- package/examples/action/GAMEMAP.md +127 -0
- package/examples/action/content/actions.js +8 -0
- package/examples/action/content/audio.js +9 -0
- package/examples/action/content/index.js +10 -0
- package/examples/action/content/items.js +4 -0
- package/examples/action/content/places.js +4 -0
- package/examples/action/content/props.js +11 -0
- package/examples/action/content/templates.js +10 -0
- package/examples/action/content/views.js +6 -0
- package/examples/action/look.js +5 -0
- package/examples/action/main.js +137 -0
- package/examples/action/models.js +25 -0
- package/examples/sheepisland/GAMEMAP.md +107 -0
- package/examples/sheepisland/content/index.js +6 -0
- package/examples/sheepisland/content/props.js +19 -0
- package/examples/sheepisland/content/templates.js +5 -0
- package/examples/sheepisland/content/vegetation.js +8 -0
- package/examples/sheepisland/main.js +71 -0
- package/examples/sheepisland/params.js +25 -0
- package/examples/sheepisland/style/index.js +79 -0
- package/examples/sheepisland/style/models.js +59 -0
- package/examples/sheepisland/views.js +9 -0
- package/examples/styletest/GAMEMAP.md +135 -0
- package/examples/styletest/content/index.js +9 -0
- package/examples/styletest/content/items.js +8 -0
- package/examples/styletest/content/npcs.js +8 -0
- package/examples/styletest/content/places.js +5 -0
- package/examples/styletest/content/props.js +16 -0
- package/examples/styletest/content/templates.js +9 -0
- package/examples/styletest/content/vegetation.js +31 -0
- package/examples/styletest/look.js +11 -0
- package/examples/styletest/main.js +95 -0
- package/examples/styletest/models.js +87 -0
- package/examples/styletest/overrides.js +33 -0
- package/examples/styletest/panel.js +135 -0
- package/examples/styletest/params.js +32 -0
- package/examples/styletest/views.js +31 -0
- package/examples/world/DESIGN.md +5 -0
- package/examples/world/GAMEMAP.md +171 -0
- package/examples/world/content/actions.js +8 -0
- package/examples/world/content/audio.js +25 -0
- package/examples/world/content/bodies.js +12 -0
- package/examples/world/content/containers.js +4 -0
- package/examples/world/content/dialogues.js +33 -0
- package/examples/world/content/index.js +17 -0
- package/examples/world/content/items.js +10 -0
- package/examples/world/content/npcs.js +14 -0
- package/examples/world/content/pickups.js +11 -0
- package/examples/world/content/places.js +6 -0
- package/examples/world/content/props.js +12 -0
- package/examples/world/content/quests.js +15 -0
- package/examples/world/content/rules.js +23 -0
- package/examples/world/content/templates.js +5 -0
- package/examples/world/content/vegetation.js +32 -0
- package/examples/world/main.js +168 -0
- package/examples/world/models.js +28 -0
- package/index.d.ts +306 -0
- package/index.js +122 -0
- package/llms.txt +61 -0
- package/modules/ambience/Ambience.js +186 -0
- package/modules/camera/FirstPersonCamera.js +131 -0
- package/modules/camera/FixedCamera.js +162 -0
- package/modules/camera/FollowCamera.js +91 -0
- package/modules/camera/RtsCamera.js +132 -0
- package/modules/camera/common.js +182 -0
- package/modules/camera/index.js +11 -0
- package/modules/camera/projection.js +34 -0
- package/modules/characters/Character.js +235 -0
- package/modules/characters/NPC.js +242 -0
- package/modules/characters/assetModel.js +42 -0
- package/modules/characters/astar.js +66 -0
- package/modules/characters/behaviors.js +72 -0
- package/modules/characters/footsteps.js +13 -0
- package/modules/characters/index.js +215 -0
- package/modules/characters/moveHelpers.js +29 -0
- package/modules/characters/movers/common.js +62 -0
- package/modules/characters/movers/rapier.js +74 -0
- package/modules/characters/movers/simple.js +43 -0
- package/modules/characters/npcAvoid.js +129 -0
- package/modules/characters/npcSim.js +150 -0
- package/modules/characters/npcView.js +42 -0
- package/modules/characters/pathAsync.js +113 -0
- package/modules/characters/pathJob.js +62 -0
- package/modules/characters/pathWorker.js +7 -0
- package/modules/characters/playerStrings.js +12 -0
- package/modules/characters/proceduralRig.js +58 -0
- package/modules/characters/useModel.js +22 -0
- package/modules/characters/walkTo.js +58 -0
- package/modules/collision/Collision.js +274 -0
- package/modules/collision/grid.js +63 -0
- package/modules/content/explain.js +13 -0
- package/modules/content/ids.js +95 -0
- package/modules/content/index.js +154 -0
- package/modules/content/loader.js +190 -0
- package/modules/content/models.js +69 -0
- package/modules/content/packs.js +69 -0
- package/modules/content/props.js +89 -0
- package/modules/content/rules.js +134 -0
- package/modules/content/templates.js +189 -0
- package/modules/debug/DebugPanel.js +174 -0
- package/modules/entities/Entities.js +243 -0
- package/modules/entities/build.js +25 -0
- package/modules/entities/index.js +4 -0
- package/modules/flow/index.js +101 -0
- package/modules/gameplay/Container.js +227 -0
- package/modules/gameplay/Containers.js +89 -0
- package/modules/gameplay/Dialogue.js +219 -0
- package/modules/gameplay/Interactions.js +253 -0
- package/modules/gameplay/Inventory.js +224 -0
- package/modules/gameplay/Quests.js +205 -0
- package/modules/gameplay/boxOps.js +60 -0
- package/modules/gameplay/dialogueBox.js +48 -0
- package/modules/gameplay/interactionPrompt.js +28 -0
- package/modules/gameplay/inventoryOps.js +137 -0
- package/modules/gameplay/pickups.js +115 -0
- package/modules/gameplay/questLog.js +54 -0
- package/modules/gameplay/questSave.js +71 -0
- package/modules/grid/Grid.js +184 -0
- package/modules/grid/Layer.js +142 -0
- package/modules/grid/index.js +236 -0
- package/modules/grid/ops.js +73 -0
- package/modules/grid/preview.js +85 -0
- package/modules/grid/tiles.js +79 -0
- package/modules/hlod/index.js +167 -0
- package/modules/hud/index.js +167 -0
- package/modules/hud/parts.js +80 -0
- package/modules/level/geometry.js +46 -0
- package/modules/level/heightfield.js +160 -0
- package/modules/level/index.js +233 -0
- package/modules/level/nodes.js +84 -0
- package/modules/lights/index.js +227 -0
- package/modules/music/Music.js +294 -0
- package/modules/music/index.js +2 -0
- package/modules/music/rules.js +28 -0
- package/modules/nav/index.js +156 -0
- package/modules/nav/navPath.js +17 -0
- package/modules/net/Client.js +137 -0
- package/modules/net/Host.js +117 -0
- package/modules/net/Net.js +49 -0
- package/modules/net/index.js +77 -0
- package/modules/net/sync.js +114 -0
- package/modules/net/transports.js +118 -0
- package/modules/particles/Particles.js +179 -0
- package/modules/particles/effect.js +112 -0
- package/modules/particles/shaders.js +28 -0
- package/modules/photo/Photo.js +146 -0
- package/modules/rigid/RigidBodies.js +265 -0
- package/modules/rigid/Vehicles.js +97 -0
- package/modules/rigid/sync.js +158 -0
- package/modules/settings/Settings.js +297 -0
- package/modules/settings/apply.js +21 -0
- package/modules/settings/index.js +3 -0
- package/modules/settings/sections.js +156 -0
- package/modules/settings/strings.js +53 -0
- package/modules/settings/view.js +65 -0
- package/modules/sky/Sky.js +259 -0
- package/modules/sky/calendar.js +80 -0
- package/modules/sky/cascades.js +125 -0
- package/modules/sky/clouds.js +79 -0
- package/modules/sky/domeLayers.js +33 -0
- package/modules/sky/environment.js +141 -0
- package/modules/sky/fog.js +139 -0
- package/modules/sky/frame.js +77 -0
- package/modules/sky/layers.js +69 -0
- package/modules/sky/look.js +51 -0
- package/modules/sky/lookFog.js +80 -0
- package/modules/sky/lookShadow.js +50 -0
- package/modules/sky/lookSky.js +108 -0
- package/modules/sky/schedule.js +80 -0
- package/modules/sky/shader.js +96 -0
- package/modules/sky/shadow.js +74 -0
- package/modules/sky/skyModule.js +60 -0
- package/modules/terrain/ChunkManager.js +260 -0
- package/modules/terrain/chunkJob.js +19 -0
- package/modules/terrain/chunkLevels.js +40 -0
- package/modules/terrain/chunkQueries.js +42 -0
- package/modules/terrain/chunkWorker.js +5 -0
- package/modules/terrain/index.js +118 -0
- package/modules/terrain/lookGround.js +61 -0
- package/modules/terrain/mountTerrain.js +32 -0
- package/modules/terrain/terrainColorMap.js +41 -0
- package/modules/terrain/terrainDefaults.js +39 -0
- package/modules/terrain/terrainEdit.js +139 -0
- package/modules/terrain/terrainGen.js +155 -0
- package/modules/terrain/terrainIsland.js +131 -0
- package/modules/terrain/terrainMesh.js +92 -0
- package/modules/terrain/terrainShape.js +108 -0
- package/modules/terrain/terrainShapeMain.js +41 -0
- package/modules/terrain/terrainTexture.js +44 -0
- package/modules/timeline/Timeline.js +253 -0
- package/modules/timeline/Tween.js +114 -0
- package/modules/timeline/letterbox.js +24 -0
- package/modules/timeline/shots.js +90 -0
- package/modules/triggers/index.js +268 -0
- package/modules/vegetation/Vegetation.js +256 -0
- package/modules/vegetation/groundChunks.js +177 -0
- package/modules/vegetation/index.js +43 -0
- package/modules/vegetation/lookWind.js +37 -0
- package/modules/vegetation/modelGeometry.js +21 -0
- package/modules/water/Water.js +160 -0
- package/modules/water/look.js +80 -0
- package/modules/water/surface.js +88 -0
- package/modules/weather/Weather.js +242 -0
- package/modules/weather/look.js +75 -0
- package/modules/weather/particles.js +92 -0
- package/modules/weather/shaders.js +49 -0
- package/modules/weather/strings.js +15 -0
- package/modules/world/World.js +231 -0
- package/modules/world/cells.js +42 -0
- package/modules/world/explain.js +11 -0
- package/modules/world/index.js +71 -0
- package/modules/world/persist.js +107 -0
- package/modules/world/pos.js +20 -0
- package/modules/world/records.js +89 -0
- package/modules/world/sim.js +175 -0
- package/modules/world/simFar.js +82 -0
- package/modules/world/state.js +115 -0
- package/modules/world/thingSource.js +44 -0
- package/modules/world/views.js +182 -0
- package/package.json +66 -4
- package/presets.js +96 -0
- package/render/PostFX.js +240 -0
- package/render/detail.js +105 -0
- package/render/effects.js +144 -0
- package/render/engineUniforms.js +23 -0
- package/render/fuse.js +84 -0
- package/render/lighting.js +100 -0
- package/render/lights.js +18 -0
- package/render/lookSurface.js +161 -0
- package/render/materials.js +220 -0
- package/render/patches.js +252 -0
- package/render/postLook.js +86 -0
- package/render/surface.js +69 -0
- package/render/uniformDecl.js +29 -0
- package/types/common.d.ts +34 -0
- package/types/core.d.ts +1965 -0
- package/types/gameplay.d.ts +1822 -0
- package/types/generated/core/Audio.d.ts +200 -0
- package/types/generated/core/Batching.d.ts +47 -0
- package/types/generated/core/Budget.d.ts +90 -0
- package/types/generated/core/Commits.d.ts +31 -0
- package/types/generated/core/DebugOverrides.d.ts +52 -0
- package/types/generated/core/Events.d.ts +89 -0
- package/types/generated/core/I18n.d.ts +30 -0
- package/types/generated/core/Input.d.ts +118 -0
- package/types/generated/core/Jobs.d.ts +41 -0
- package/types/generated/core/Ops.d.ts +203 -0
- package/types/generated/core/Random.d.ts +49 -0
- package/types/generated/core/Rays.d.ts +49 -0
- package/types/generated/core/Saves.d.ts +162 -0
- package/types/generated/core/Stream.d.ts +93 -0
- package/types/generated/core/Threads.d.ts +82 -0
- package/types/generated/core/Views.d.ts +33 -0
- package/types/generated/core/audioVoice.d.ts +47 -0
- package/types/generated/core/page.d.ts +18 -0
- package/types/generated/core/session.d.ts +48 -0
- package/types/generated/modules/ambience/Ambience.d.ts +48 -0
- package/types/generated/modules/debug/DebugPanel.d.ts +24 -0
- package/types/generated/modules/flow/index.d.ts +10 -0
- package/types/generated/modules/grid/Grid.d.ts +151 -0
- package/types/generated/modules/grid/Layer.d.ts +65 -0
- package/types/generated/modules/grid/index.d.ts +86 -0
- package/types/generated/modules/hlod/index.d.ts +11 -0
- package/types/generated/modules/hud/index.d.ts +10 -0
- package/types/generated/modules/lights/index.d.ts +13 -0
- package/types/generated/modules/music/Music.d.ts +111 -0
- package/types/generated/modules/net/Net.d.ts +34 -0
- package/types/generated/modules/net/index.d.ts +53 -0
- package/types/generated/modules/net/transports.d.ts +58 -0
- package/types/generated/modules/particles/Particles.d.ts +69 -0
- package/types/generated/modules/sky/Sky.d.ts +145 -0
- package/types/generated/modules/sky/skyModule.d.ts +10 -0
- package/types/generated/modules/timeline/Timeline.d.ts +51 -0
- package/types/generated/modules/water/Water.d.ts +29 -0
- package/types/generated/modules/weather/Weather.d.ts +62 -0
- package/types/generated/modules/world/World.d.ts +242 -0
- package/types/generated/modules/world/index.d.ts +15 -0
- package/types/generated/render/PostFX.d.ts +125 -0
- package/types/generated/render/materials.d.ts +100 -0
- package/types/generated/render/patches.d.ts +41 -0
- package/types/generated/ui/Focus.d.ts +11 -0
- package/types/generated/ui/LoadingScreen.d.ts +2 -0
- package/types/generated/ui/UI.d.ts +57 -0
- package/types/nav.d.ts +52 -0
- package/types/physics.d.ts +592 -0
- package/types/style.d.ts +638 -0
- package/types/worker.d.ts +11 -0
- package/types/world.d.ts +772 -0
- package/ui/Focus.js +51 -0
- package/ui/LoadingScreen.js +42 -0
- package/ui/Parts.js +199 -0
- package/ui/UI.js +167 -0
- package/ui/defaults.js +85 -0
- package/ui/theme.js +124 -0
- package/ui/touchPart.js +49 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// engine.look.<part>: set / patch / replace and the layers.
|
|
2
|
+
// Parts: tone, lights, cloudShadow (core), env (sky); fog / sky / water / post ... come from their modules.
|
|
3
|
+
// set(params, { owner }) change parameters (shallow merge into that owner's layer; null drops a key so the layer below shows again)
|
|
4
|
+
// patch(name, glsl, { owner }) swap one named GLSL hook the part registered (null gives the default back)
|
|
5
|
+
// replace(impl, { owner }) take the whole part over (null gives it back to the engine / style)
|
|
6
|
+
// Why one helper and not per-part code: layering, owner records, validation, catalog and describe were written differently in every module
|
|
7
|
+
// (sky.modify had owners, engine.look.tone.set had none, describeRender guessed the source by comparing against start values). A part author writes only
|
|
8
|
+
// apply / applyHook / applyReplace; everything a reader (describe, catalog, debug.override) needs comes from the same records.
|
|
9
|
+
// Layers per key, the upper one wins: engine default < style < game (each owner; the last one written wins) < debug (engine.debug.override).
|
|
10
|
+
// Hooks and the replace slot are keys too ('hook:<name>', '@replace'), so they get the same layering and records for free.
|
|
11
|
+
// A part author never touches `_` fields: write / ownerValue / extend / retract / has / resolved are the public author methods (review r2 #2).
|
|
12
|
+
import { closest } from '../validate.js';
|
|
13
|
+
import { codedError } from '../errorHints.js';
|
|
14
|
+
import { REPLACE, HOOK, addParams, topOf, allKeys, sourceOf, refresh, quietRefresh, commit, retractKeys, aliased } from './layers.js';
|
|
15
|
+
import { setOn, setStyle, writeLayer, dropLayer, takeVerb, example } from './write.js';
|
|
16
|
+
|
|
17
|
+
export { REPLACE };
|
|
18
|
+
export { disposeLooksOf } from './layers.js';
|
|
19
|
+
const SPEC_FIELDS = ['id', 'group', 'module', 'object', 'params', 'style', 'read', 'apply', 'applyAtStart', 'hooks', 'applyHook', 'noPatch',
|
|
20
|
+
'replace', 'applyReplace', 'noReplace', 'docs', 'normalize', 'validate', 'verbs', 'appliesTo', 'extraSignatures'];
|
|
21
|
+
const SIG = { set: 'set(params, { owner })', patch: 'patch(name, glsl, { owner })', replace: 'replace(impl, { owner })' };
|
|
22
|
+
|
|
23
|
+
class LookPart {
|
|
24
|
+
/** @param {any} e @param {any} spec see defineLookPart */
|
|
25
|
+
constructor(e, spec) {
|
|
26
|
+
this._e = e; this._spec = spec; this._seq = 0;
|
|
27
|
+
this._params = {}; this._meta = {};
|
|
28
|
+
addParams(this, spec.params);
|
|
29
|
+
this._style = new Map();
|
|
30
|
+
this._owners = { game: new Map(), debug: new Map() }; // owner -> { values: Map, seq, at }
|
|
31
|
+
this._resolved = new Map();
|
|
32
|
+
this._driven = new Map(); // key -> who writes it every frame from the style (sky keyframes drive the sun)
|
|
33
|
+
}
|
|
34
|
+
/** Catalog / override id: 'look.<part>' */
|
|
35
|
+
get id() { return `look.${this._spec.id}`; }
|
|
36
|
+
/** The three.js object(s) behind this part (renderer, lights ...); changing them directly works but is tagged 'three' in describe().look */
|
|
37
|
+
get object() { return this._spec.object?.(); }
|
|
38
|
+
/** Each verb's call shape (spec.verbs overrides a default); the catalog lists it and verb errors quote it */
|
|
39
|
+
get signatures() {
|
|
40
|
+
const s = this._spec, out = { set: SIG.set };
|
|
41
|
+
if (s.hooks) out.patch = s.verbs?.patch?.signature ?? SIG.patch;
|
|
42
|
+
if (s.replace) out.replace = s.verbs?.replace?.signature ?? SIG.replace;
|
|
43
|
+
return Object.assign(out, s.extraSignatures); // a part's own verb (look.post.add), listed so the catalog shows it
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Change parameters for one owner. Nested objects flatten to the part's dotted keys ({ sun: { intensity: 3 } } -> 'sun.intensity').
|
|
48
|
+
* @param {Record<string, any>} params null drops a key from this owner's layer
|
|
49
|
+
* @param {{ owner?: string }} [o]
|
|
50
|
+
* @returns {{ remove(): void }} removes this owner's whole layer on this part
|
|
51
|
+
*/
|
|
52
|
+
set(params, { owner = 'game' } = {}) { return this._setOn('game', owner, params); }
|
|
53
|
+
/**
|
|
54
|
+
* Swap one named GLSL hook. Names and signatures: engine.catalog('look.<part>').hooks
|
|
55
|
+
* @param {string} name @param {any} glsl a GLSL string (or the part's hook spec); null gives the default back
|
|
56
|
+
* @param {{ owner?: string }} [o]
|
|
57
|
+
*/
|
|
58
|
+
patch(name, glsl, o) {
|
|
59
|
+
const hooks = this._spec.hooks;
|
|
60
|
+
if (!hooks) throw codedError('look-verb', `${this.id}.patch(): this part has no GLSL hooks. ${this._spec.noPatch ?? `Change it with ${this.id}.set(${example(this)})`}`);
|
|
61
|
+
if (this._spec.verbs?.patch?.take) return this._take('patch', [...arguments]);
|
|
62
|
+
if (!(name in hooks) && !hooks['*']) { // hooks['*'] = any name the game picks (post: patch(name, fuse) makes an effect)
|
|
63
|
+
const c = closest(name, Object.keys(hooks)); throw codedError('look-verb', `${this.id}.patch('${name}'): unknown hook${c ? ` (did you mean '${c}'?)` : ''}; hooks: ${Object.keys(hooks).join(', ')}`);
|
|
64
|
+
}
|
|
65
|
+
return this.write(o?.owner ?? 'game', { [HOOK + name]: glsl });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Take the whole part over (what it accepts and what is lost: engine.catalog('look.<part>').replace); null gives it back
|
|
69
|
+
* @param {any} impl @param {{ owner?: string }} [o]
|
|
70
|
+
*/
|
|
71
|
+
replace(impl, o) {
|
|
72
|
+
if (!this._spec.replace) throw codedError('look-verb', `${this.id}.replace(): this part cannot be swapped whole. ${this._spec.noReplace ?? `Change it with ${this.id}.set(${example(this)})`}`);
|
|
73
|
+
if (this._spec.verbs?.replace?.take) return this._take('replace', [...arguments]);
|
|
74
|
+
return this.write(o?.owner ?? 'game', { [REPLACE]: impl });
|
|
75
|
+
}
|
|
76
|
+
/** Remove every layer `owner` wrote on this part (game and debug); returns how many layers were removed (the same count shape as engine.debug.clear) */
|
|
77
|
+
clear(owner) { let n = 0; for (const l of ['game', 'debug']) if (this._drop(l, owner)) n++; return n; }
|
|
78
|
+
/** The value in effect for a key (after all layers) */
|
|
79
|
+
value(key) { return this._resolved.get(key); }
|
|
80
|
+
/** Only what the game or a debug override set for a key, else undefined (a driver writes its own value, then this one over it) */
|
|
81
|
+
top(key) { const t = topOf(this, key); return t ? t.value : undefined; }
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Declare keys a style-driven system writes every frame (the sky drives sun and hemisphere from style.sky.keyframes). Those keys then read
|
|
85
|
+
* as by: 'style' in describe with the live value, and apply() gets undefined for them unless a game or debug layer set one (that system
|
|
86
|
+
* should write top(key) over its own value). drive(keys, null) hands them back to the layers.
|
|
87
|
+
* @param {string[]} keys @param {string | null} by the driver's name, e.g. 'sky' (a module name: disposing that module releases them)
|
|
88
|
+
*/
|
|
89
|
+
drive(keys, by) {
|
|
90
|
+
for (const k of keys) by ? this._driven.set(k, by) : this._driven.delete(k);
|
|
91
|
+
this._refresh();
|
|
92
|
+
}
|
|
93
|
+
/** For a driver, after it wrote its keys this frame: re-apply the driven keys a game or debug layer set, so those layers win (cheap: a few keys) */
|
|
94
|
+
applyTop() {
|
|
95
|
+
let v = null, changed = null;
|
|
96
|
+
for (const k of this._driven.keys()) { const t = topOf(this, k); if (t) { (v ??= {})[k] = t.value; (changed ??= new Set()).add(k); } }
|
|
97
|
+
if (changed) this._spec.apply?.(v, changed);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ---- for part authors (render/postLook.js, terrain, weather ...): public so no author reaches into `_` fields ------------------------------
|
|
101
|
+
|
|
102
|
+
/** Write raw keys (params, 'hook:<name>', '@replace', a part's own slot keys) for an owner on the game layer, no normalize; null drops a key */
|
|
103
|
+
write(owner, values, { layer = 'game' } = {}) { return this._write(layer, owner, values); }
|
|
104
|
+
/** What one owner holds for a key (undefined when it holds nothing): look.weather.replace adds to the object its owner put in the replace slot */
|
|
105
|
+
ownerValue(owner, key, { layer = 'game' } = {}) { return this._owners[layer].get(owner)?.values.get(key); }
|
|
106
|
+
/** Add declared keys to a started part (same spec fields as params; a known key is left alone). Values recompute without calling apply */
|
|
107
|
+
extend(params) { addParams(this, params, { skipKnown: true }); quietRefresh(this); }
|
|
108
|
+
/** Remove every key starting with prefix (e.g. 'bloom.'), with the values any layer holds for them */
|
|
109
|
+
retract(prefix) { retractKeys(this, prefix); }
|
|
110
|
+
/** Replace the style layer (post: a replaced effect chain brings its own defaults) */
|
|
111
|
+
restyle(values) { this._setStyle(values); }
|
|
112
|
+
/** Is key a declared param of this part */
|
|
113
|
+
has(key) { return key in this._params; }
|
|
114
|
+
/** [key, value] pairs in effect whose key starts with prefix ('hook:' lists the patches set) */
|
|
115
|
+
resolved(prefix = '') { return [...this._resolved].filter(([k]) => k.startsWith(prefix)); }
|
|
116
|
+
/** Unregister the part (its module is disposed, or its install failed): engine.look.<id> goes away and nothing drives its keys any more */
|
|
117
|
+
dispose() {
|
|
118
|
+
const look = this._e.look;
|
|
119
|
+
if (look?.[this._spec.id] === this) delete look[this._spec.id];
|
|
120
|
+
this._driven.clear(); this._started = false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ---- internal (layering: layers.js) ------------------------------------------------------------------------------------------------------
|
|
124
|
+
|
|
125
|
+
/** @internal set() and engine.debug.override share this (write.js: normalize, flatten, check, write) */
|
|
126
|
+
_setOn(layer, owner, params) { return setOn(this, layer, owner, params); }
|
|
127
|
+
/** @internal Replace the style layer (start, or a style swap); game and debug layers stay */
|
|
128
|
+
_setStyle(values) { setStyle(this, values); }
|
|
129
|
+
_write(layer, owner, values) { return writeLayer(this, layer, owner, values); }
|
|
130
|
+
_drop(layer, owner) { return dropLayer(this, layer, owner); }
|
|
131
|
+
/** @internal recompute (force: every key to apply again); _keys / _source: report.js */
|
|
132
|
+
_refresh(force = false) { refresh(this, force); }
|
|
133
|
+
_keys() { return allKeys(this); }
|
|
134
|
+
_source(key) { return sourceOf(this, key); }
|
|
135
|
+
/** @internal Resolved params as a plain object */
|
|
136
|
+
values() { const o = {}; for (const k in this._params) o[k] = this._resolved.get(k); return o; }
|
|
137
|
+
/** A verb with its own call shape (spec.verbs[verb].take) */
|
|
138
|
+
_take(verb, args) { return takeVerb(this, verb, args); }
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Register a look part: engine.look.<id> gets set / patch / replace (the verbs the spec supports; the others throw and say which verb to use),
|
|
143
|
+
* engine.catalog('look.<id>') lists its params, hooks, replace contract and verb signatures, describe().look shows every key's value and who
|
|
144
|
+
* set it, and engine.debug.override(owner, 'look.<id>', values) writes its debug layer. Every param needs a default; a default that changes the
|
|
145
|
+
* picture needs why (what it is for) and off (how to turn it off), or neutral: true (checked by `npm run check`, rule R35).
|
|
146
|
+
* Its module's failed install drops it again (disposeLooksOf).
|
|
147
|
+
* @param {any} engine @param {{ id: string, group?: string, module?: string, object?: () => any, params?: Record<string, any>, style?: () => object,
|
|
148
|
+
* read?: () => object, apply?: (values: object, changed: Set<string>) => void, applyAtStart?: boolean,
|
|
149
|
+
* hooks?: Record<string, { signature?: string, scope?: string[], example?: string }>, applyHook?: (name: string, glsl: any) => void, noPatch?: string,
|
|
150
|
+
* replace?: { accepts: string, loses?: string[] }, applyReplace?: (impl: any) => void, noReplace?: string, docs?: string[],
|
|
151
|
+
* validate?: (key: string, value: any) => string | null | undefined,
|
|
152
|
+
* verbs?: Record<'patch' | 'replace', { signature: string, take: (bad: (msg: string) => never, ...args: any[]) => [Record<string, any>, string?] }>,
|
|
153
|
+
* appliesTo?: string }} spec validate: why a value is wrong (checked before anything is written); verbs: a verb with its own call shape
|
|
154
|
+
* (materials.replace(role, impl)); appliesTo: what a change reaches when not everything ('new materials')
|
|
155
|
+
* @returns {LookPart}
|
|
156
|
+
* @example
|
|
157
|
+
* defineLookPart(engine, { id: 'glow', group: 'screen', module: 'myGlow', object: () => glowPass,
|
|
158
|
+
* params: { strength: { type: 'number', default: 0, min: 0, neutral: true, desc: 'bloom strength' } },
|
|
159
|
+
* apply(v, changed) { glowPass.strength = v.strength; } });
|
|
160
|
+
* engine.look.glow.set({ strength: 0.6 }, { owner: 'night' });
|
|
161
|
+
*/
|
|
162
|
+
export function defineLookPart(engine, spec) {
|
|
163
|
+
for (const k of Object.keys(spec ?? {})) if (!SPEC_FIELDS.includes(k)) { const c = closest(k, SPEC_FIELDS); throw codedError('look-param', `defineLookPart: unknown spec field ${k}${c ? ` (did you mean ${c}?)` : ''}; fields: ${SPEC_FIELDS.join(', ')}`); }
|
|
164
|
+
if (!/^[a-z][\w]*$/i.test(spec?.id ?? '')) throw codedError('look-param', `defineLookPart: id is the part name, e.g. 'fog' (engine.look.fog, catalog id 'look.fog'); got ${JSON.stringify(spec?.id)}`);
|
|
165
|
+
const look = aliased(engine.look ??= {});
|
|
166
|
+
if (look[spec.id] && look[spec.id]._spec.module !== spec.module) throw codedError('look-param', `defineLookPart('${spec.id}'): engine.look.${spec.id} is already registered (by ${look[spec.id]._spec.module ?? 'core'})`);
|
|
167
|
+
const part = new LookPart(engine, spec);
|
|
168
|
+
part._setStyle(spec.style?.());
|
|
169
|
+
part._started = true;
|
|
170
|
+
if (spec.applyAtStart !== false) part._refresh(true);
|
|
171
|
+
look[spec.id] = part;
|
|
172
|
+
return part;
|
|
173
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// describe().look, catalog('look.*').
|
|
2
|
+
// Both read the same layer records (part.js), so "who set this"
|
|
3
|
+
// in describe and "what can I set" in the catalog cannot disagree. Values set straight on the three.js object (renderer.toneMappingExposure = 2)
|
|
4
|
+
// show up as by: 'three': the part's read() returns the live value and it no longer matches what the layers say.
|
|
5
|
+
import { schemaInfo } from '../params.js';
|
|
6
|
+
import { r1 } from '../math.js';
|
|
7
|
+
|
|
8
|
+
const shown = v => (typeof v === 'number' ? r1(v) : typeof v === 'function' ? '<function>' : Array.isArray(v) && v.length > 4 ? `<array of ${v.length}>` : v?.isObject3D || v?.isTexture || v?.isMaterial ? `<${v.type}>` : v);
|
|
9
|
+
/**
|
|
10
|
+
* Same value for the 'three' check: numbers within a small tolerance, arrays / Colors / vectors element by element. Why: the live read
|
|
11
|
+
* (a Color, a Vector2) is a different object from the layer value ([0.012, 0.006], '#fff'), and !== tagged it 'three' (review L5)
|
|
12
|
+
*/
|
|
13
|
+
function same(a, b) {
|
|
14
|
+
if (a === b) return true;
|
|
15
|
+
if (typeof a === 'number' && typeof b === 'number') return Math.abs(a - b) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(b));
|
|
16
|
+
const arr = v => (Array.isArray(v) ? v : v?.isColor ? [v.r, v.g, v.b] : typeof v?.toArray === 'function' ? v.toArray() : null);
|
|
17
|
+
const x = arr(a), y = arr(b);
|
|
18
|
+
if (x && y) return x.length === y.length && x.every((v, i) => same(v, y[i]));
|
|
19
|
+
const c = a?.isColor ? a : b?.isColor ? b : null, other = c === a ? b : a;
|
|
20
|
+
if (c && (typeof other === 'number' || /^(#|rgb|hsl)/i.test(other ?? ''))) // 'horizon' and the like are not colors: three would warn return c.clone().set(other).equals(c);
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
/** by: 'game' | 'style' | 'engine' | '<layer>:<owner>' (layer game or debug, owner as given to set / debug.override), or 'three' */
|
|
24
|
+
const tag = (s) => (s.layer === 'game' && s.owner === 'game') || s.layer === 'style' || s.layer === 'engine' ? s.layer : `${s.layer}:${s.owner}`;
|
|
25
|
+
|
|
26
|
+
/** One part's keys: { key: { value, by, at?, under? } }; under lists the layers this value covers (top first) */
|
|
27
|
+
function partInfo(p) {
|
|
28
|
+
const live = p._spec.read?.() ?? {}, out = {};
|
|
29
|
+
for (const k of p._keys()) {
|
|
30
|
+
const s = p._source(k);
|
|
31
|
+
if (!s) continue;
|
|
32
|
+
const o = { value: shown(s.value), by: tag(s) };
|
|
33
|
+
if (s.driven) Object.assign(o, { value: shown(live[k]), driver: s.owner }); // written every frame from the style: the live value is the value
|
|
34
|
+
else if (k in live && live[k] !== undefined && !same(live[k], s.value)) Object.assign(o, { value: shown(live[k]), by: 'three', layers: tag(s) });
|
|
35
|
+
if (s.at) o.at = s.at;
|
|
36
|
+
if (s.under.length && s.layer !== 'engine') o.under = s.under.map(tag);
|
|
37
|
+
out[k] = o;
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** describe().look: { <part>: { key: { value, by } }, text } (undefined when no part is registered) @param {any} e */
|
|
43
|
+
export function describeLook(e) {
|
|
44
|
+
const parts = Object.values(e.look ?? {});
|
|
45
|
+
if (!parts.length) return undefined;
|
|
46
|
+
const out = {}, lines = [];
|
|
47
|
+
for (const p of parts) {
|
|
48
|
+
const info = out[p._spec.id] = partInfo(p);
|
|
49
|
+
lines.push(`${p._spec.id}${p._spec.appliesTo ? ` (applies to ${p._spec.appliesTo})` : ''}:${Object.entries(info).map(([k, v]) => `${k}=${typeof v.value === 'object' && v.value ? JSON.stringify(v.value) : v.value} (${v.by})`).join(' ')}`);
|
|
50
|
+
}
|
|
51
|
+
return { ...out, text: lines.join('\n') };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** One part as catalog data: params (schema + why / off / cost + value in use and its source), hooks, replace contract, verbs */
|
|
55
|
+
function lookEntry(e, p) {
|
|
56
|
+
const s = p._spec, schema = schemaInfo(p._params), info = partInfo(p);
|
|
57
|
+
for (const k in schema) {
|
|
58
|
+
const m = p._meta[k];
|
|
59
|
+
for (const f of ['why', 'off', 'cost']) if (m[f] !== undefined) schema[k][f] = m[f];
|
|
60
|
+
if (m.neutral) schema[k].neutral = true;
|
|
61
|
+
if (info[k]) Object.assign(schema[k], { value: info[k].value, by: info[k].by });
|
|
62
|
+
}
|
|
63
|
+
return { id: p.id, kind: 'look', group: s.group ?? null, module: s.module ?? 'core', verbs: verbsOf(p), signatures: p.signatures, params: schema,
|
|
64
|
+
...(s.appliesTo ? { appliesTo: s.appliesTo } : {}),
|
|
65
|
+
hooks: s.hooks ?? null, replace: s.replace ?? null, ...(s.docs ? { docs: s.docs } : {}), problems: [] };
|
|
66
|
+
}
|
|
67
|
+
const verbsOf = p => ['set', ...(p._spec.hooks ? ['patch'] : []), ...(p._spec.replace ? ['replace'] : [])];
|
|
68
|
+
|
|
69
|
+
/** Short list rows for engine.catalog() (same row shape as modules: ops / saves stay empty) @param {any} e */
|
|
70
|
+
export function lookSummaries(e) {
|
|
71
|
+
return Object.values(e.look ?? {}).map(p => ({ id: p.id, kind: 'look', group: p._spec.group ?? null, module: p._spec.module ?? 'core', verbs: verbsOf(p), ops: [], saves: [] }));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** engine.catalog('look') -> every part expanded; 'look.<part>' -> that part; else null @param {any} e @param {string} id */
|
|
75
|
+
export function lookCatalog(e, id) {
|
|
76
|
+
if (id === 'look') return Object.values(e.look ?? {}).map(p => lookEntry(e, p));
|
|
77
|
+
const p = e.look?.[id.slice(5)];
|
|
78
|
+
return p ? lookEntry(e, p) : null;
|
|
79
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// How a value gets into a LookPart: normalize, flatten, check, then write one owner's layer (part.js has the verbs a game and a part author call).
|
|
2
|
+
// Why a file of its own: this is the one path set(), engine.debug.override and a style swap share, and it is the part that grows with every new
|
|
3
|
+
// kind of check; the verbs in part.js stay short and the file-size cap holds. Functions take the part as `p`; LookPart methods delegate here.
|
|
4
|
+
import { closest, warnOnce } from '../validate.js';
|
|
5
|
+
import { whyBad } from '../params.js';
|
|
6
|
+
import { codedError, coded } from '../errorHints.js';
|
|
7
|
+
import { isPlainObject } from '../util.js';
|
|
8
|
+
import { REPLACE, HOOK, callerAt, commit } from './layers.js';
|
|
9
|
+
|
|
10
|
+
/** A sample call for error texts: { <first key>: <its default> } */
|
|
11
|
+
export function example(p) { const k = Object.keys(p._params)[0]; return k ? `{ ${k}: ${JSON.stringify(p._params[k].default)} }` : '{...}'; }
|
|
12
|
+
|
|
13
|
+
/** { sun: { intensity } } -> { 'sun.intensity' } for keys the part declares dotted */
|
|
14
|
+
export function flat(p, params) {
|
|
15
|
+
const out = {}, keys = Object.keys(p._params);
|
|
16
|
+
for (const [k, v] of Object.entries(params)) {
|
|
17
|
+
if (!(k in p._params) && isPlainObject(v) && keys.some(q => q.startsWith(k + '.'))) for (const [s, sv] of Object.entries(v)) out[`${k}.${s}`] = sv;
|
|
18
|
+
else out[k] = v;
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Unknown keys and wrong values throw with the fix (same schema and wording as module params, params.js) */
|
|
24
|
+
export function check(p, values) {
|
|
25
|
+
const keys = Object.keys(p._params);
|
|
26
|
+
for (const [k, v] of Object.entries(values)) {
|
|
27
|
+
if (!(k in p._params)) { const c = closest(k, keys); throw codedError('look-param', `${p.id}.set(): unknown key ${k}${c ? ` (did you mean ${c}?)` : ''}; keys: ${keys.join(', ')}`); }
|
|
28
|
+
if (v === null) continue;
|
|
29
|
+
const why = whyBad(p._params[k], v) ?? p._meta[k].check?.(v);
|
|
30
|
+
if (why) throw codedError('look-param', `${p.id}.set(): ${k} ${why}`);
|
|
31
|
+
}
|
|
32
|
+
return values;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** set() and engine.debug.override share this, so both normalize, flatten and check the same way (review M8) */
|
|
36
|
+
export function setOn(p, layer, owner, params) {
|
|
37
|
+
if (!isPlainObject(params)) throw codedError('look-param', `${p.id}.set(params): params is an object of keys to change, e.g. ${example(p)}; got ${JSON.stringify(params)}`);
|
|
38
|
+
const values = check(p, flat(p, p._spec.normalize?.(params) ?? params)); // normalize: a part's shorthand (post: { bloom: false })
|
|
39
|
+
const to = p._spec.appliesTo;
|
|
40
|
+
if (layer === 'debug' && to) warnOnce(coded('look-param', `${p.id}: a debug override changes only ${to}; what was made before keeps its look`));
|
|
41
|
+
return writeLayer(p, layer, owner, values);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Replace the style layer (start, or a style swap); game and debug layers stay */
|
|
45
|
+
export function setStyle(p, values) {
|
|
46
|
+
const given = Object.fromEntries(Object.entries(flat(p, values ?? {})).filter(([, v]) => v != null));
|
|
47
|
+
const params = Object.fromEntries(Object.entries(given).filter(([k]) => k !== REPLACE && !k.startsWith(HOOK))); // a style may also fill the replace slot / hooks
|
|
48
|
+
check(p, params); // a style pack value of the wrong type throws at start, with the key
|
|
49
|
+
const old = p._style;
|
|
50
|
+
p._style = new Map(Object.entries(given));
|
|
51
|
+
commit(p, () => { p._style = old; });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Where spec.validate's answer is quoted: the verb that carried the bad value, so the fix reads as a call */
|
|
55
|
+
const quoteVerb = (p, k) => k === REPLACE ? `${p.id}.replace(impl): impl` : k.startsWith(HOOK) ? `${p.id}.patch('${k.slice(HOOK.length)}', glsl):` : `${p.id}: ${k}`;
|
|
56
|
+
|
|
57
|
+
/** Write one owner's keys on the game or debug layer. All or nothing: if apply throws, the layer and the picture go back (review H1) */
|
|
58
|
+
export function writeLayer(p, layer, owner, values) {
|
|
59
|
+
if (!owner || typeof owner !== 'string') throw codedError('look-param', `${p.id}: owner is a non-empty string naming who changes it, e.g. { owner: 'cave' }`);
|
|
60
|
+
for (const [k, v] of Object.entries(values)) { // spec.validate stops a bad hook / replace value (or any key) before anything is written
|
|
61
|
+
const why = v === null ? null : p._spec.validate?.(k, v);
|
|
62
|
+
if (why) throw codedError(k === REPLACE || k.startsWith(HOOK) ? 'look-verb' : 'look-param', `${quoteVerb(p, k)} ${why}`);
|
|
63
|
+
}
|
|
64
|
+
const map = p._owners[layer], old = map.get(owner);
|
|
65
|
+
// `at` = the owner's first write: one stack capture per owner, not per set (#14)
|
|
66
|
+
const rec = { values: new Map(old?.values), seq: ++p._seq, at: old ? old.at : callerAt() };
|
|
67
|
+
for (const [k, v] of Object.entries(values)) v === null ? rec.values.delete(k) : rec.values.set(k, v);
|
|
68
|
+
map.delete(owner); if (rec.values.size) map.set(owner, rec);
|
|
69
|
+
commit(p, () => { map.delete(owner); if (old) map.set(owner, old); });
|
|
70
|
+
return { remove: () => dropLayer(p, layer, owner) };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function dropLayer(p, layer, owner) {
|
|
74
|
+
const map = p._owners[layer], old = map.get(owner);
|
|
75
|
+
if (!old) return false;
|
|
76
|
+
map.delete(owner);
|
|
77
|
+
commit(p, () => map.set(owner, old));
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A verb with its own call shape (spec.verbs[verb].take): take(bad, ...args) -> [values, owner]; bad(msg) throws quoting the signature */
|
|
82
|
+
export function takeVerb(p, verb, args) {
|
|
83
|
+
const sig = p.signatures[verb], bad = msg => { throw codedError('look-verb', `${p.id}.${verb}: ${msg}. Call it as ${p.id.slice(5)}.${sig}`); };
|
|
84
|
+
const [values, owner = 'game'] = p._spec.verbs[verb].take(bad, ...args);
|
|
85
|
+
return p.write(owner, values);
|
|
86
|
+
}
|
package/core/loop.js
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Main loop (part of Engine, mixed into Engine.prototype): fixed step + per-frame hooks + render, deterministic step(), hook timing profile(),
|
|
2
|
+
// adaptive resolution.
|
|
3
|
+
//
|
|
4
|
+
// Hook errors: onFixed / onFrame callbacks and module fixed / frame / afterRender hooks each run in try/catch and are handled by error tier (errors.js):
|
|
5
|
+
// presentation modules are disabled, gameplay errors freeze gameplay in dev / tests and are recorded in engine.error, core steps such as render
|
|
6
|
+
// report only once; input.endFrame() sits in finally so "just pressed" always clears.
|
|
7
|
+
//
|
|
8
|
+
// What freezing (engine.freeze) stops: the whole fixed step is skipped (onFixed, module fixed, the game clock and engine.elapsed all stop);
|
|
9
|
+
// frame hooks, stream / jobs and render keep going (the picture and UI stay usable). So gameplay logic (movement, timers, quest checks, cutscene
|
|
10
|
+
// waits) belongs in fixed,
|
|
11
|
+
// or must check engine.frozen first inside frame.
|
|
12
|
+
//
|
|
13
|
+
// Determinism: in engine.step() and headless loading frames, jobs ignore the real-time budget and drain the queue (see Jobs.js),
|
|
14
|
+
// and stream's synchronous builds are attached to the scene before step returns: same input and same seed (engine.random) give the same result.
|
|
15
|
+
import { reportError } from './errors.js';
|
|
16
|
+
import { DEV } from './validate.js';
|
|
17
|
+
import { codedError } from './errorHints.js';
|
|
18
|
+
import { watchLights } from './lightWatch.js';
|
|
19
|
+
|
|
20
|
+
const STEP = 1 / 60; // fixed step length: 60 per second
|
|
21
|
+
// Most real time one frame may turn into fixed steps (6 steps). A longer hitch slows the game for that frame
|
|
22
|
+
// instead of replaying it in a burst (no spiral of death, no jump after a stall).
|
|
23
|
+
const MAX_CATCHUP = 0.1;
|
|
24
|
+
// Dev message (console): which hook failed
|
|
25
|
+
const STRINGS = {
|
|
26
|
+
onFixed: 'onFixed callback', commits: 'background result apply (commits)', onFrame: 'onFrame callback', clock: 'clock timer', render: 'render',
|
|
27
|
+
hook: '{kind} hook of module {name}',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const SOFT = { soft: true }; // core steps (render, stream): report once only
|
|
31
|
+
/** Call a hook fn.call(self, a, b); errors go to reportError for tiering.
|
|
32
|
+
* opts: { module } the failing module / SOFT / null (game callback, counts as gameplay).
|
|
33
|
+
* Takes no ...args and needs no caller closure: the main loop calls this many times a frame, so it must not allocate each time. */
|
|
34
|
+
function safe(engine, key, fn, opts, self, a, b) {
|
|
35
|
+
try { fn.call(self, a, b); } catch (err) { reportError(engine, err, key, opts ?? undefined); }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const loopMethods = {
|
|
39
|
+
_fixedStep() {
|
|
40
|
+
// input snapshot for this step: keys read in fixed depend only on the step count, not on how many steps a frame ran
|
|
41
|
+
this.input.beginFixed();
|
|
42
|
+
try {
|
|
43
|
+
if (this._freezers.size) return; // gameplay frozen: fixed seconds and game seconds stop (frame hooks and render continue)
|
|
44
|
+
this.tick++;
|
|
45
|
+
this._inFixed = true; // ops log phase 'fixed' and the dev guard lets gameplay writes through
|
|
46
|
+
// due background results apply first so this step's gameplay sees them; not advanced while loading (start() rebases when it finishes)
|
|
47
|
+
if (this.ready) safe(this, STRINGS.commits, this.commits.tick, null, this.commits, this.tick);
|
|
48
|
+
for (const f of this._fixed) safe(this, STRINGS.onFixed, f, null, undefined, STEP);
|
|
49
|
+
this._runHooks('fixed', STEP);
|
|
50
|
+
safe(this, STRINGS.clock, this.clock.tick, null, this.clock, STEP);
|
|
51
|
+
this._elapsed += STEP; this.uniforms.uTime.value = this._elapsed;
|
|
52
|
+
} finally { this._inFixed = false; this.input.endFixed(); }
|
|
53
|
+
},
|
|
54
|
+
/** Per frame: onFrame callbacks, module frame, stream, jobs. With deterministic true (step, headless loading) jobs ignore real time. */
|
|
55
|
+
_frameHooks(dt, deterministic = false) {
|
|
56
|
+
// one profile frame = one frame-hook cycle (the real loop: one per rendered frame; step(): one per frameEvery fixed steps). Counting rendered frames
|
|
57
|
+
// instead made step(render: false) divide by zero frames and report the whole run's milliseconds as one frame's
|
|
58
|
+
if (this._prof) this._prof.frames++;
|
|
59
|
+
for (const f of this._frame) safe(this, STRINGS.onFrame, f, null, undefined, dt);
|
|
60
|
+
this._runHooks('frame', dt);
|
|
61
|
+
safe(this, 'stream.update', this.stream._update, SOFT, this.stream);
|
|
62
|
+
this.jobs.run({ deterministic });
|
|
63
|
+
safe(this, 'stream.settle', this.stream._settle, SOFT, this.stream); // after every loader ran: readiness of stream sources
|
|
64
|
+
safe(this, 'batching.update', this.batching.update, SOFT, this.batching); // last before rendering: picks up everything built this frame
|
|
65
|
+
safe(this, 'audio.tick', this.audio._tick, SOFT, this.audio); // positional sounds follow their objects (returns at once when there are none)
|
|
66
|
+
},
|
|
67
|
+
_render(dt) {
|
|
68
|
+
this.renderer.info.reset();
|
|
69
|
+
const t0 = performance.now(); // measure
|
|
70
|
+
this.post.render(dt);
|
|
71
|
+
// frames that first draw new objects pay their GPU upload here (Budget.js ApplyCost)
|
|
72
|
+
this.budget.cost.rendered(performance.now() - t0); // measure
|
|
73
|
+
if (DEV && this.ready) watchLights(this); // dev: a light added / removed mid-play compiled new shaders (one long frame): say so (lightWatch.js)
|
|
74
|
+
},
|
|
75
|
+
_runHooks(kind, dt) {
|
|
76
|
+
const p = this._prof;
|
|
77
|
+
for (const h of this._hooks[kind]) {
|
|
78
|
+
const key = h.key ??= STRINGS.hook.replace('{name}', h.name).replace('{kind}', kind); // build the key once
|
|
79
|
+
const opts = h.opts ??= { module: h.mod };
|
|
80
|
+
if (!p) { safe(this, key, h.fn, opts, undefined, dt, this); continue; }
|
|
81
|
+
const t0 = performance.now(); // measure
|
|
82
|
+
safe(this, key, h.fn, opts, undefined, dt, this);
|
|
83
|
+
p.t[h.name] = (p.t[h.name] || 0) + performance.now() - t0; // measure
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/** Time module hooks: profile(true) starts, profile(false) stops; profile() returns { moduleName: average ms per frame } and resets (null when off). */
|
|
87
|
+
profile(on) {
|
|
88
|
+
if (on !== undefined) { this._prof = on ? { frames: 0, t: {} } : null; return this; }
|
|
89
|
+
const p = this._prof;
|
|
90
|
+
if (!p) return null;
|
|
91
|
+
const r = {};
|
|
92
|
+
for (const k in p.t) r[k] = Math.round(p.t[k] / Math.max(1, p.frames) * 100) / 100;
|
|
93
|
+
p.frames = 0; p.t = {};
|
|
94
|
+
return r;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
// ---------- nextFixed (pause / freeze / runState live in holds.js; step() below is the deterministic way to advance) ----------
|
|
98
|
+
/**
|
|
99
|
+
* Run fn at the start of the next fixed step (before that step's fixed hooks), from any callback (UI click, promise, worker result): gameplay state is safe to write there.
|
|
100
|
+
* Returns a Promise of fn's value (rejects if fn throws). Waits while frozen or loading. Built on engine.commits: applies in request order and survives save loads.
|
|
101
|
+
* @template T
|
|
102
|
+
* @param {() => T} fn
|
|
103
|
+
* @returns {Promise<T>}
|
|
104
|
+
* @example engine.nextFixed(() => engine.ops.run('door.open', { id: 'gate' }));
|
|
105
|
+
*/
|
|
106
|
+
nextFixed(fn) {
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
const t = this.commits.request({ lag: 1, valid: () => true, fallback: () => undefined, apply: () => { try { resolve(fn()); } catch (err) { reject(err); } } });
|
|
109
|
+
t.resolve(undefined); // nothing to wait for: otherwise the fallback would count as late
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
_loop() {
|
|
114
|
+
if (this._looping) return;
|
|
115
|
+
this._looping = true;
|
|
116
|
+
let acc = 0, last = performance.now(); // main-loop
|
|
117
|
+
const tick = now => {
|
|
118
|
+
if (this.disposed) return;
|
|
119
|
+
this._raf = requestAnimationFrame(tick);
|
|
120
|
+
const dt = Math.min(0.25, (now - last) / 1000); last = now;
|
|
121
|
+
if (this.paused) { acc = 0; return; } // paused: no advance, no render
|
|
122
|
+
// CPU time of one frame = main-thread work from here to the end of the afterRender hooks, in four phases (engine.cpuPhases):
|
|
123
|
+
// fixed (input poll + fixed steps), frame (onFrame + module frame hooks + stream / jobs / batching), render (submitting the draw
|
|
124
|
+
// calls: three.js CPU work, upload of new objects, shader compiles; not GPU time), afterRender (module hooks). Adaptive resolution
|
|
125
|
+
// and the startup readiness check run after and are not counted. Budget is sampled last so it sees this frame, not the previous one.
|
|
126
|
+
const c0 = performance.now(); // measure
|
|
127
|
+
let c1, c2, c3;
|
|
128
|
+
try {
|
|
129
|
+
this.input.poll(dt);
|
|
130
|
+
// page away / WebGL lost: gameplay waits; coming back drops the time spent away, so play resumes without a burst of steps (page.js)
|
|
131
|
+
if (this.page.held || this.page.consumeResync()) acc = 0;
|
|
132
|
+
else { acc = Math.min(acc + dt, MAX_CATCHUP); while (acc >= STEP) { this._fixedStep(); acc -= STEP; } }
|
|
133
|
+
c1 = performance.now(); // measure
|
|
134
|
+
this._frameHooks(dt);
|
|
135
|
+
c2 = performance.now(); // measure
|
|
136
|
+
safe(this, STRINGS.render, this._render, SOFT, this, dt);
|
|
137
|
+
c3 = performance.now(); // measure
|
|
138
|
+
} finally { this.input.endFrame(); }
|
|
139
|
+
this._runHooks('afterRender', dt);
|
|
140
|
+
const c4 = performance.now(), P = this.cpuPhases; // measure
|
|
141
|
+
P.fixed = c1 - c0; P.frame = c2 - c1; P.render = c3 - c2; P.afterRender = c4 - c3;
|
|
142
|
+
this.cpuMs = c4 - c0;
|
|
143
|
+
this.budget.sample(dt);
|
|
144
|
+
this.fps += (1 / Math.max(dt, 1e-3) - this.fps) * 0.05;
|
|
145
|
+
this._adapt(dt);
|
|
146
|
+
this._afterTick?.();
|
|
147
|
+
};
|
|
148
|
+
this._raf = requestAnimationFrame(tick);
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Advance synchronously by seconds of fixed-step time (game seconds clock.now advance by seconds x clock.timeScale): fixed hooks run at 60 Hz;
|
|
153
|
+
* frame hooks run once per frameEvery fixed steps (default 2, i.e. 30 Hz, dt = 1/30),
|
|
154
|
+
* so fast-forwarding 600 seconds runs only 18000 frame-hook calls with no rendering and finishes in seconds. Renders one frame at the end when
|
|
155
|
+
* render is true.
|
|
156
|
+
* Input is read as usual: set engine.input.autopilot = { x, y, speed } to make the player walk by itself.
|
|
157
|
+
* Jobs ignore real time inside step and drain the queue each frame; stream's synchronous builds are attached before it returns (stream.ready and
|
|
158
|
+
* handle built are correct immediately).
|
|
159
|
+
* Note: step is synchronous, so Promise continuations (the next timeline segment, await, async build) resume only after step returns; split a long
|
|
160
|
+
* cutscene across several step calls.
|
|
161
|
+
* seconds must be a finite number >= 0: step(0) advances nothing (no fixed step, no render), a negative or non-finite value throws; any positive
|
|
162
|
+
* value runs at least one fixed step.
|
|
163
|
+
* Returns the result of describe() (null with { describe: false }, which callers that ignore it pass to skip the work).
|
|
164
|
+
*/
|
|
165
|
+
step(seconds, { render = true, frameEvery = 2, describe = true } = {}) {
|
|
166
|
+
if (this.disposed) return null; // nothing advances after dispose
|
|
167
|
+
if (typeof seconds !== 'number' || !Number.isFinite(seconds) || seconds < 0)
|
|
168
|
+
throw codedError('step-seconds',
|
|
169
|
+
`engine.step(${String(seconds)}): seconds must be a finite number >= 0, e.g. engine.step(0.5) (game seconds; 1 / 60 is one fixed step)`);
|
|
170
|
+
if (seconds === 0) return describe ? this.describe() : null; // 0 advances nothing (a tiny positive value still runs one fixed step)
|
|
171
|
+
const n = Math.max(1, Math.round(seconds / STEP));
|
|
172
|
+
let since = 0;
|
|
173
|
+
for (let i = 0; i < n; i++) {
|
|
174
|
+
this._fixedStep();
|
|
175
|
+
if (++since >= frameEvery || i === n - 1) {
|
|
176
|
+
try { this._frameHooks(since * STEP, true); } finally { this.input.endFrame(); }
|
|
177
|
+
since = 0;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (render) {
|
|
181
|
+
safe(this, STRINGS.render, this._render, SOFT, this, STEP);
|
|
182
|
+
this._runHooks('afterRender', STEP);
|
|
183
|
+
}
|
|
184
|
+
return describe ? this.describe() : null; // describe: false for internal loops that ignore the result (describe() walks every module)
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
// Adaptive resolution: lower render quality when frame rate stays under target for 1 s; raise it slowly after 4 s of headroom
|
|
188
|
+
_adapt(dt) {
|
|
189
|
+
const a = this.adaptive;
|
|
190
|
+
if (!a.on || !this.ready || a.paused) return;
|
|
191
|
+
a.t += dt; a.n++; a.cooldown -= dt;
|
|
192
|
+
if (a.t < 1) return;
|
|
193
|
+
const fps = a.n / a.t; a.t = 0; a.n = 0;
|
|
194
|
+
const pr = this.renderer.getPixelRatio();
|
|
195
|
+
if (fps < a.target - 5 && pr > a.min + 0.01) { this.setPixelRatio(Math.max(a.min, +(pr - 0.1).toFixed(2))); a.good = 0; a.cooldown = 5; }
|
|
196
|
+
else if (fps >= a.target + 3 && pr < a.max - 0.01 && a.cooldown <= 0) {
|
|
197
|
+
if (++a.good >= 4) { this.setPixelRatio(Math.min(a.max, +(pr + 0.05).toFixed(2))); a.good = 0; }
|
|
198
|
+
} else a.good = 0;
|
|
199
|
+
},
|
|
200
|
+
};
|
package/core/math.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Small shared helpers (used by several modules)
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { codedError } from './errorHints.js';
|
|
4
|
+
|
|
5
|
+
// API convention: a position is one argument. The old (x, z, ...) form arrives as a number; throw with the fix (otherwise it silently becomes the origin)
|
|
6
|
+
const STRINGS = { position: 'A position must be passed as one argument: Vector3 / object / [x, y, z] / { x, z } (see the API conventions); got ' };
|
|
7
|
+
const POS_ERR = STRINGS.position;
|
|
8
|
+
// A horizontal position missing x or z (a 2-element [x, z] array reads z as undefined; { x, y } has no z) used to become 0 silently, so
|
|
9
|
+
// player.placeAt([10, 20]) quietly placed the player at z = 0. Say which part is missing and how to write it
|
|
10
|
+
const XZ_ERR = 'A horizontal position needs finite x and z: pass [x, y, z] (a 2-element [x, z] array does not work) or { x, z }; got ';
|
|
11
|
+
|
|
12
|
+
/** Round to one decimal (describe, budget reports) @param {number} v @returns {number} */
|
|
13
|
+
export const r1 = v => Math.round(v * 10) / 10;
|
|
14
|
+
|
|
15
|
+
/** Normalize a Vector3 / Object3D / [x, y, z] / { x, y, z } into a Vector3 */
|
|
16
|
+
export function vec3(v, out = new THREE.Vector3()) {
|
|
17
|
+
if (!v) return out;
|
|
18
|
+
if (typeof v !== 'object') throw codedError('options-object', POS_ERR + JSON.stringify(v), TypeError);
|
|
19
|
+
if (v.isVector3) return out.copy(v);
|
|
20
|
+
if (v.isObject3D) return out.copy(v.position);
|
|
21
|
+
if (Array.isArray(v)) return out.set(v[0] ?? 0, v[1] ?? 0, v[2] ?? 0);
|
|
22
|
+
return out.set(v.x ?? 0, v.y ?? 0, v.z ?? 0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Get the horizontal coordinates [x, z] from a Vector3 / Object3D / [x, y, z] / { x, z } */
|
|
26
|
+
export function xzOf(v) {
|
|
27
|
+
if (!v || typeof v !== 'object') throw codedError('options-object', POS_ERR + JSON.stringify(v), TypeError);
|
|
28
|
+
if (v.isObject3D) v = v.position;
|
|
29
|
+
const x = Array.isArray(v) ? v[0] : v.x, z = Array.isArray(v) ? v[2] : v.z;
|
|
30
|
+
if (!Number.isFinite(x) || !Number.isFinite(z)) throw codedError('options-object', XZ_ERR + JSON.stringify(v), TypeError);
|
|
31
|
+
return [x, z];
|
|
32
|
+
}
|
|
33
|
+
|