@vgai/engine 0.5.21 → 0.5.23
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/README.md +6 -3
- package/dist/adapter/adapter-module.d.ts.map +1 -1
- package/dist/adapter/adapter-module.js +2 -4
- package/dist/adapter/adapter-surface.d.ts +1 -1
- package/dist/adapter/adapter-surface.js +1 -1
- package/dist/adapter/authoring.d.ts +19 -21
- package/dist/adapter/authoring.d.ts.map +1 -1
- package/dist/adapter/authoring.js +2 -2
- package/dist/adapter/binding.d.ts +341 -0
- package/dist/adapter/binding.d.ts.map +1 -0
- package/dist/adapter/binding.js +148 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -1
- package/dist/adapter/colyseus-networking-adapter.js +23 -4
- package/dist/adapter/entrypoint-selection-readers.d.ts +24 -0
- package/dist/adapter/entrypoint-selection-readers.d.ts.map +1 -0
- package/dist/adapter/entrypoint-selection-readers.js +63 -0
- package/dist/adapter/entrypoint-selection-source.d.ts.map +1 -1
- package/dist/adapter/entrypoint-selection-source.js +1 -44
- package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts.map +1 -1
- package/dist/adapter/finders/scenes-from-entrypoint-selection.js +1 -52
- package/dist/adapter/host-context.d.ts +46 -15
- package/dist/adapter/host-context.d.ts.map +1 -1
- package/dist/adapter/host-context.js +2 -9
- package/dist/adapter/index.d.ts +11 -12
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +9 -10
- package/dist/adapter/ingest/game-contract.d.ts +0 -3
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -1
- package/dist/adapter/ingest/game-contract.js +0 -3
- package/dist/adapter/ingest/scene-capture.d.ts +19 -23
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
- package/dist/adapter/ingest/scene-capture.js +143 -17
- package/dist/adapter/ingest/visible-capture-window.d.ts +34 -0
- package/dist/adapter/ingest/visible-capture-window.d.ts.map +1 -1
- package/dist/adapter/manifest-interpreter.d.ts +59 -0
- package/dist/adapter/manifest-interpreter.d.ts.map +1 -0
- package/dist/adapter/manifest-interpreter.js +50 -0
- package/dist/adapter/native-debug-module.d.ts +71 -3
- package/dist/adapter/native-debug-module.d.ts.map +1 -1
- package/dist/adapter/native-debug-module.js +146 -10
- package/dist/adapter/rapier-physics-adapter.d.ts +31 -1
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -1
- package/dist/adapter/rapier-physics-adapter.js +50 -36
- package/dist/adapter/renderer-config.d.ts +3 -3
- package/dist/adapter/renderer-config.js +3 -3
- package/dist/adapter/root-adapter.d.ts +7 -7
- package/dist/adapter/root-adapter.js +4 -4
- package/dist/adapter/system-adapter.d.ts +45 -7
- package/dist/adapter/system-adapter.d.ts.map +1 -1
- package/dist/adapter/system-seam-contract.d.ts +3 -3
- package/dist/adapter/system-seam-contract.js +3 -3
- package/dist/adapter/system-slot.d.ts +168 -0
- package/dist/adapter/system-slot.d.ts.map +1 -0
- package/dist/adapter/system-slot.js +229 -0
- package/dist/adapter/transform.d.ts +11 -1
- package/dist/adapter/transform.d.ts.map +1 -1
- package/dist/ai/navigation.d.ts +17 -1
- package/dist/ai/navigation.d.ts.map +1 -1
- package/dist/ai/navigation.js +26 -5
- package/dist/animation/anim-graph-types.d.ts +11 -3
- package/dist/animation/anim-graph-types.d.ts.map +1 -1
- package/dist/animation/theatre-clock-binding.d.ts +4 -4
- package/dist/animation/theatre-clock-binding.js +4 -4
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -1
- package/dist/animation/xstate-animation-binding.js +2 -2
- package/dist/animation/xstate-animation-meta.d.ts +13 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -1
- package/dist/animation/xstate-animation-meta.js +14 -0
- package/dist/asset-formats/index.d.ts +4 -7
- package/dist/asset-formats/index.d.ts.map +1 -1
- package/dist/asset-formats/index.js +4 -7
- package/dist/asset-formats/render-env.d.ts +5 -8
- package/dist/asset-formats/render-env.d.ts.map +1 -1
- package/dist/asset-formats/render-env.js +3 -6
- package/dist/asset-parse-error.d.ts +2 -5
- package/dist/asset-parse-error.d.ts.map +1 -1
- package/dist/asset-parse-error.js +2 -5
- package/dist/audio/bus-mixer.d.ts +101 -0
- package/dist/audio/bus-mixer.d.ts.map +1 -0
- package/dist/audio/bus-mixer.js +115 -0
- package/dist/canvas-react/index.d.ts +5 -12
- package/dist/canvas-react/index.d.ts.map +1 -1
- package/dist/canvas-react/index.js +5 -12
- package/dist/canvas-react/pixi-react-root-factory.d.ts +34 -21
- package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -1
- package/dist/canvas-react/pixi-react-root-factory.js +274 -36
- package/dist/core/countdown-timer.d.ts +118 -0
- package/dist/core/countdown-timer.d.ts.map +1 -0
- package/dist/core/countdown-timer.js +137 -0
- package/dist/core/deferred-commands.d.ts +127 -0
- package/dist/core/deferred-commands.d.ts.map +1 -0
- package/dist/core/deferred-commands.js +132 -0
- package/dist/core/frame-pacing.d.ts +1 -1
- package/dist/core/frame-pacing.js +2 -2
- package/dist/core/game-loop.d.ts +1 -3
- package/dist/core/game-loop.d.ts.map +1 -1
- package/dist/core/game-loop.js +1 -3
- package/dist/core/seeded-random.d.ts +1 -1
- package/dist/core/sim-clock.d.ts +19 -8
- package/dist/core/sim-clock.d.ts.map +1 -1
- package/dist/core/sim-clock.js +18 -7
- package/dist/core/types.d.ts +1 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/defaults.d.ts +6 -14
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +6 -14
- package/dist/dev/instruments.d.ts +38 -11
- package/dist/dev/instruments.d.ts.map +1 -1
- package/dist/dev/instruments.js +81 -11
- package/dist/dev/register-render-vitals.d.ts +1 -4
- package/dist/dev/register-render-vitals.d.ts.map +1 -1
- package/dist/dev/register-render-vitals.js +1 -4
- package/dist/dev/render-debug-adapter.d.ts +2 -3
- package/dist/dev/render-debug-adapter.d.ts.map +1 -1
- package/dist/dev/render-debug-adapter.js +2 -3
- package/dist/dev/render-vitals.d.ts +3 -3
- package/dist/dev/render-vitals.js +3 -3
- package/dist/dev/webgl-frame-capture.d.ts +1 -1
- package/dist/dev/webgl-frame-capture.js +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/input/host-pointer.d.ts +122 -0
- package/dist/input/host-pointer.d.ts.map +1 -0
- package/dist/input/host-pointer.js +160 -0
- package/dist/input/input-manager.d.ts +33 -5
- package/dist/input/input-manager.d.ts.map +1 -1
- package/dist/input/input-manager.js +48 -13
- package/dist/input/rebind-controller.d.ts.map +1 -1
- package/dist/input/rebind-controller.js +6 -8
- package/dist/input/schema.d.ts.map +1 -1
- package/dist/input/schema.js +56 -28
- package/dist/manifest/filename.d.ts.map +1 -1
- package/dist/manifest/filename.js +8 -12
- package/dist/manifest/load.d.ts +10 -10
- package/dist/manifest/load.d.ts.map +1 -1
- package/dist/manifest/load.js +9 -6
- package/dist/manifest/schema.d.ts +17 -21
- package/dist/manifest/schema.d.ts.map +1 -1
- package/dist/manifest/schema.js +45 -35
- package/dist/physics/collider-dimensions.d.ts +8 -12
- package/dist/physics/collider-dimensions.d.ts.map +1 -1
- package/dist/physics/collider-dimensions.js +8 -12
- package/dist/pixi/scene-capture.d.ts +11 -13
- package/dist/pixi/scene-capture.d.ts.map +1 -1
- package/dist/react/world-state.d.ts +1 -1
- package/dist/react/world-state.d.ts.map +1 -1
- package/dist/render/directional-shadow-fit.d.ts +88 -0
- package/dist/render/directional-shadow-fit.d.ts.map +1 -0
- package/dist/render/directional-shadow-fit.js +133 -0
- package/dist/render/environment-capture.d.ts +68 -0
- package/dist/render/environment-capture.d.ts.map +1 -0
- package/dist/render/environment-capture.js +90 -0
- package/dist/render/ibl-override-material.d.ts +97 -0
- package/dist/render/ibl-override-material.d.ts.map +1 -0
- package/dist/render/ibl-override-material.js +114 -0
- package/dist/render/light-camera-factory.d.ts +5 -7
- package/dist/render/light-camera-factory.d.ts.map +1 -1
- package/dist/render/light-camera-factory.js +8 -11
- package/dist/render/material-factory.js +1 -1
- package/dist/render/render-batch-system.d.ts.map +1 -1
- package/dist/render/render-features.d.ts +17 -6
- package/dist/render/render-features.d.ts.map +1 -1
- package/dist/render/render-features.js +0 -28
- package/dist/runtime/create-runtime.d.ts +34 -25
- package/dist/runtime/create-runtime.d.ts.map +1 -1
- package/dist/runtime/create-runtime.js +218 -93
- package/dist/runtime/debug-registry.d.ts +77 -8
- package/dist/runtime/debug-registry.d.ts.map +1 -1
- package/dist/runtime/debug-registry.js +3 -3
- package/dist/runtime/dev-build.d.ts +2 -2
- package/dist/runtime/dev-build.js +2 -2
- package/dist/runtime/game-input-seams.d.ts +51 -0
- package/dist/runtime/game-input-seams.d.ts.map +1 -0
- package/dist/runtime/game-input-seams.js +86 -0
- package/dist/runtime/game.d.ts +104 -40
- package/dist/runtime/game.d.ts.map +1 -1
- package/dist/runtime/game.js +119 -61
- package/dist/runtime/mount-game.d.ts +0 -16
- package/dist/runtime/mount-game.d.ts.map +1 -1
- package/dist/runtime/mount-game.js +26 -41
- package/dist/runtime/mount-manifest.d.ts +22 -14
- package/dist/runtime/mount-manifest.d.ts.map +1 -1
- package/dist/runtime/mount-manifest.js +22 -20
- package/dist/runtime/playtest.d.ts +22 -0
- package/dist/runtime/playtest.d.ts.map +1 -0
- package/dist/runtime/playtest.js +12 -0
- package/dist/runtime/state-bridge.d.ts +2 -3
- package/dist/runtime/state-bridge.d.ts.map +1 -1
- package/dist/runtime/state-bridge.js +1 -0
- package/dist/setup/setup-audio.d.ts +12 -0
- package/dist/setup/setup-audio.d.ts.map +1 -1
- package/dist/setup/setup-audio.js +9 -10
- package/dist/setup/setup-renderer.d.ts +2 -25
- package/dist/setup/setup-renderer.d.ts.map +1 -1
- package/dist/setup/setup-renderer.js +2 -31
- package/dist/world3d-react/index.d.ts +15 -25
- package/dist/world3d-react/index.d.ts.map +1 -1
- package/dist/world3d-react/index.js +15 -25
- package/dist/world3d-react/r3f-root-factory.d.ts +28 -34
- package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -1
- package/dist/world3d-react/r3f-root-factory.js +403 -57
- package/dist/world3d-react/rapier-physics-bridge.d.ts +30 -17
- package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -1
- package/dist/world3d-react/rapier-physics-bridge.js +143 -58
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +16 -14
- package/schemas/vgai-project.schema.json +35 -26
- package/src/adapter/adapter-module.ts +2 -4
- package/src/adapter/adapter-surface.ts +1 -1
- package/src/adapter/authoring.ts +19 -21
- package/src/adapter/binding.ts +468 -0
- package/src/adapter/colyseus-networking-adapter.ts +20 -5
- package/src/adapter/entrypoint-selection-readers.ts +66 -0
- package/src/adapter/entrypoint-selection-source.ts +1 -40
- package/src/adapter/finders/scenes-from-entrypoint-selection.ts +1 -48
- package/src/adapter/host-context.ts +45 -15
- package/src/adapter/index.ts +23 -11
- package/src/adapter/ingest/game-contract.ts +0 -3
- package/src/adapter/ingest/scene-capture.ts +190 -39
- package/src/adapter/ingest/visible-capture-window.ts +35 -0
- package/src/adapter/manifest-interpreter.ts +64 -0
- package/src/adapter/native-debug-module.ts +248 -15
- package/src/adapter/rapier-physics-adapter.ts +76 -20
- package/src/adapter/renderer-config.ts +3 -3
- package/src/adapter/root-adapter.ts +7 -7
- package/src/adapter/system-adapter.ts +43 -8
- package/src/adapter/system-seam-contract.ts +3 -3
- package/src/adapter/system-slot.ts +291 -0
- package/src/adapter/transform.ts +18 -1
- package/src/ai/navigation.ts +30 -3
- package/src/animation/anim-graph-types.ts +11 -3
- package/src/animation/theatre-clock-binding.ts +4 -4
- package/src/animation/xstate-animation-binding.ts +2 -2
- package/src/animation/xstate-animation-meta.ts +16 -0
- package/src/asset-formats/index.ts +4 -7
- package/src/asset-formats/render-env.ts +3 -6
- package/src/asset-parse-error.ts +2 -5
- package/src/audio/bus-mixer.ts +161 -0
- package/src/canvas-react/index.ts +5 -21
- package/src/canvas-react/pixi-react-root-factory.tsx +301 -39
- package/src/core/countdown-timer.ts +188 -0
- package/src/core/deferred-commands.ts +174 -0
- package/src/core/frame-pacing.ts +2 -2
- package/src/core/game-loop.ts +1 -3
- package/src/core/seeded-random.ts +1 -1
- package/src/core/sim-clock.ts +19 -8
- package/src/core/types.ts +1 -3
- package/src/defaults.ts +6 -14
- package/src/dev/instruments.ts +108 -11
- package/src/dev/register-render-vitals.ts +1 -4
- package/src/dev/render-debug-adapter.ts +2 -3
- package/src/dev/render-vitals.ts +3 -3
- package/src/dev/webgl-frame-capture.ts +1 -1
- package/src/index.ts +2 -5
- package/src/input/host-pointer.ts +230 -0
- package/src/input/input-manager.ts +49 -13
- package/src/input/input-types.ts +1 -1
- package/src/input/rebind-controller.ts +6 -8
- package/src/input/schema.ts +216 -188
- package/src/manifest/filename.ts +8 -12
- package/src/manifest/load.ts +17 -13
- package/src/manifest/schema.ts +55 -47
- package/src/physics/collider-dimensions.ts +8 -12
- package/src/pixi/scene-capture.ts +12 -15
- package/src/react/world-state.tsx +1 -1
- package/src/render/directional-shadow-fit.ts +156 -0
- package/src/render/environment-capture.ts +102 -0
- package/src/render/ibl-override-material.ts +170 -0
- package/src/render/light-camera-factory.ts +8 -11
- package/src/render/material-factory.ts +1 -1
- package/src/render/render-batch-system.ts +14 -6
- package/src/render/render-features.ts +17 -35
- package/src/runtime/create-runtime.ts +270 -108
- package/src/runtime/debug-registry.ts +84 -8
- package/src/runtime/dev-build.ts +2 -2
- package/src/runtime/game-input-seams.ts +108 -0
- package/src/runtime/game.ts +231 -85
- package/src/runtime/mount-game.ts +31 -57
- package/src/runtime/mount-manifest.ts +47 -36
- package/src/runtime/playtest.ts +22 -0
- package/src/runtime/state-bridge.ts +3 -3
- package/src/setup/setup-audio.ts +21 -11
- package/src/setup/setup-renderer.ts +2 -61
- package/src/world3d-react/index.ts +15 -31
- package/src/world3d-react/r3f-root-factory.tsx +451 -60
- package/src/world3d-react/rapier-physics-bridge.tsx +154 -58
- package/dist/adapter/setup-three-root-adapter.d.ts +0 -86
- package/dist/adapter/setup-three-root-adapter.d.ts.map +0 -1
- package/dist/adapter/setup-three-root-adapter.js +0 -908
- package/dist/animation/clip-map.d.ts +0 -12
- package/dist/animation/clip-map.d.ts.map +0 -1
- package/dist/animation/clip-map.js +0 -31
- package/dist/asset-registry.d.ts +0 -38
- package/dist/asset-registry.d.ts.map +0 -1
- package/dist/asset-registry.js +0 -66
- package/dist/canvas-react/engine-bridge.d.ts +0 -45
- package/dist/canvas-react/engine-bridge.d.ts.map +0 -1
- package/dist/canvas-react/engine-bridge.js +0 -45
- package/dist/canvas-react/pixi-react-adapter.d.ts +0 -77
- package/dist/canvas-react/pixi-react-adapter.d.ts.map +0 -1
- package/dist/canvas-react/pixi-react-adapter.js +0 -294
- package/dist/canvas-react/world-context.d.ts +0 -98
- package/dist/canvas-react/world-context.d.ts.map +0 -1
- package/dist/canvas-react/world-context.js +0 -173
- package/dist/dev/debug-draw.d.ts +0 -24
- package/dist/dev/debug-draw.d.ts.map +0 -1
- package/dist/dev/debug-draw.js +0 -73
- package/dist/render/auto-batcher.d.ts +0 -34
- package/dist/render/auto-batcher.d.ts.map +0 -1
- package/dist/render/auto-batcher.js +0 -140
- package/dist/render/lod.d.ts +0 -13
- package/dist/render/lod.d.ts.map +0 -1
- package/dist/render/lod.js +0 -16
- package/dist/runtime/types.d.ts +0 -303
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- package/dist/world3d-react/engine-bridge.d.ts +0 -47
- package/dist/world3d-react/engine-bridge.d.ts.map +0 -1
- package/dist/world3d-react/engine-bridge.js +0 -73
- package/dist/world3d-react/r3f-adapter.d.ts +0 -58
- package/dist/world3d-react/r3f-adapter.d.ts.map +0 -1
- package/dist/world3d-react/r3f-adapter.js +0 -634
- package/dist/world3d-react/world-context.d.ts +0 -182
- package/dist/world3d-react/world-context.d.ts.map +0 -1
- package/dist/world3d-react/world-context.js +0 -235
- package/src/adapter/setup-three-root-adapter.ts +0 -1032
- package/src/animation/clip-map.ts +0 -34
- package/src/asset-registry.ts +0 -89
- package/src/canvas-react/engine-bridge.ts +0 -59
- package/src/canvas-react/pixi-react-adapter.tsx +0 -356
- package/src/canvas-react/world-context.ts +0 -253
- package/src/dev/debug-draw.ts +0 -80
- package/src/render/auto-batcher.ts +0 -168
- package/src/render/lod.ts +0 -17
- package/src/runtime/types.ts +0 -328
- package/src/world3d-react/engine-bridge.ts +0 -86
- package/src/world3d-react/r3f-adapter.tsx +0 -717
- package/src/world3d-react/world-context.ts +0 -358
package/dist/defaults.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Single source of truth for default values the engine's factories read.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* — wire the group to the factory that reads it, or delete it if truly unused —
|
|
11
|
-
* and there is no surviving factory to wire these to: `transform` restated
|
|
12
|
-
* THREE's own Object3D constructor values, `entity.locked`/ `pivot` were
|
|
13
|
-
* descriptor-only fields, and `fog`/`environment.envMapIntensity`/ `shadow` were
|
|
14
|
-
* the `.vscn` `environment` block that `render-env.ts` explicitly did NOT carry
|
|
15
|
-
* forward. Keeping them would have been exactly the dead documentation T1.13
|
|
16
|
-
* created this guard to prevent.
|
|
17
|
-
*
|
|
4
|
+
* A group belongs here only while a FACTORY reads it. A default with no
|
|
5
|
+
* reader is dead documentation: it looks authoritative, nothing consults it,
|
|
6
|
+
* and it drifts from the value the code actually uses. Restating a library's
|
|
7
|
+
* own constructor values (THREE's `Object3D` transform, say) is the same
|
|
8
|
+
* mistake in a different shape — the library is already the source of truth.
|
|
9
|
+
* So when a factory goes, its group goes with it.
|
|
18
10
|
*/
|
|
19
11
|
export const DEFAULTS = {
|
|
20
12
|
material: {
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
* game registry.
|
|
26
26
|
*
|
|
27
27
|
* ── THE DOOR ────────────────────────────────────────────────────────────────
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
28
|
+
* The HOST publishes these itself ({@link publishDevInstruments}, called by
|
|
29
|
+
* the mount install paths): one provider per reading
|
|
30
|
+
* (`instrument.timescale`), one command per action
|
|
31
|
+
* (`instrument.timescale.set`), plus the `instruments` index provider. The
|
|
32
|
+
* registry IS the product, so every reader of an instrument reaches the SAME
|
|
33
|
+
* registration — and a game writes zero lines and mounts nothing to have
|
|
34
|
+
* them.
|
|
35
35
|
*
|
|
36
36
|
* ── DEGRADING ───────────────────────────────────────────────────────────────
|
|
37
37
|
* An instrument whose subject this game does not have (no physics adapter ⇒ no
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
*
|
|
43
43
|
* ── RESOURCE OWNERSHIP, STATED ONCE ─────────────────────────────────────────
|
|
44
44
|
* {@link createDevInstruments} owns everything it allocates: the frame-time
|
|
45
|
-
* ring buffer and its ONE `game.onRenderStep` subscription. SHARER: the
|
|
46
|
-
*
|
|
47
|
-
* game. TEARDOWN: the returned {@link DevInstrumentSet.dispose} — the
|
|
48
|
-
* that ends it. Nothing else here holds a resource; the time-scale, pause and
|
|
45
|
+
* ring buffer and its ONE `game.onRenderStep` subscription. SHARER: the host
|
|
46
|
+
* install path ({@link publishDevInstruments}), which creates one set per
|
|
47
|
+
* mounted game. TEARDOWN: the returned {@link DevInstrumentSet.dispose} — the
|
|
48
|
+
* ONE path that ends it. Nothing else here holds a resource; the time-scale, pause and
|
|
49
49
|
* collider instruments only drive state that `Game` already owns.
|
|
50
50
|
*/
|
|
51
51
|
import { z } from 'zod';
|
|
@@ -130,4 +130,31 @@ export declare function summarizeFrameTimes(samples: readonly number[]): FrameTi
|
|
|
130
130
|
* caller owns the returned {@link DevInstrumentSet.dispose}.
|
|
131
131
|
*/
|
|
132
132
|
export declare function createDevInstruments(game: Game): DevInstrumentSet;
|
|
133
|
+
/** The index provider's name. */
|
|
134
|
+
export declare const INSTRUMENTS_PROVIDER = "instruments";
|
|
135
|
+
/** One instrument in the index: descriptor plus this instant's value. A
|
|
136
|
+
* throwing read is reported as itself, never swallowed. */
|
|
137
|
+
export interface PublishedInstrumentReading {
|
|
138
|
+
readonly name: string;
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly label: string;
|
|
141
|
+
readonly hint: string;
|
|
142
|
+
readonly unit?: string;
|
|
143
|
+
readonly control: DevInstrumentControl;
|
|
144
|
+
readonly actions: readonly {
|
|
145
|
+
readonly name: string;
|
|
146
|
+
readonly id: string;
|
|
147
|
+
readonly label: string;
|
|
148
|
+
readonly hint: string;
|
|
149
|
+
}[];
|
|
150
|
+
readonly value: unknown;
|
|
151
|
+
readonly error?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create this game's instrument set and register every door on its debug
|
|
155
|
+
* registry. Called once per mounted Game by the host install path; the
|
|
156
|
+
* returned disposer ends the set's one resource (the frame-time
|
|
157
|
+
* subscription) — the registrations die with the Game itself.
|
|
158
|
+
*/
|
|
159
|
+
export declare function publishDevInstruments(game: Game): () => void;
|
|
133
160
|
//# sourceMappingURL=instruments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruments.d.ts","sourceRoot":"","sources":["../../src/dev/instruments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"instruments.d.ts","sourceRoot":"","sources":["../../src/dev/instruments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE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,MAAM,CAAC;QACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB,EAAE,CAAC;IACJ,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAwBD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,IAAI,CA2B5D"}
|
package/dist/dev/instruments.js
CHANGED
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
* game registry.
|
|
26
26
|
*
|
|
27
27
|
* ── THE DOOR ────────────────────────────────────────────────────────────────
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
28
|
+
* The HOST publishes these itself ({@link publishDevInstruments}, called by
|
|
29
|
+
* the mount install paths): one provider per reading
|
|
30
|
+
* (`instrument.timescale`), one command per action
|
|
31
|
+
* (`instrument.timescale.set`), plus the `instruments` index provider. The
|
|
32
|
+
* registry IS the product, so every reader of an instrument reaches the SAME
|
|
33
|
+
* registration — and a game writes zero lines and mounts nothing to have
|
|
34
|
+
* them.
|
|
35
35
|
*
|
|
36
36
|
* ── DEGRADING ───────────────────────────────────────────────────────────────
|
|
37
37
|
* An instrument whose subject this game does not have (no physics adapter ⇒ no
|
|
@@ -42,15 +42,16 @@
|
|
|
42
42
|
*
|
|
43
43
|
* ── RESOURCE OWNERSHIP, STATED ONCE ─────────────────────────────────────────
|
|
44
44
|
* {@link createDevInstruments} owns everything it allocates: the frame-time
|
|
45
|
-
* ring buffer and its ONE `game.onRenderStep` subscription. SHARER: the
|
|
46
|
-
*
|
|
47
|
-
* game. TEARDOWN: the returned {@link DevInstrumentSet.dispose} — the
|
|
48
|
-
* that ends it. Nothing else here holds a resource; the time-scale, pause and
|
|
45
|
+
* ring buffer and its ONE `game.onRenderStep` subscription. SHARER: the host
|
|
46
|
+
* install path ({@link publishDevInstruments}), which creates one set per
|
|
47
|
+
* mounted game. TEARDOWN: the returned {@link DevInstrumentSet.dispose} — the
|
|
48
|
+
* ONE path that ends it. Nothing else here holds a resource; the time-scale, pause and
|
|
49
49
|
* collider instruments only drive state that `Game` already owns.
|
|
50
50
|
*/
|
|
51
51
|
import { z } from 'zod';
|
|
52
52
|
import { nodeKeyedPhysics } from '../adapter/system-adapter';
|
|
53
53
|
import { clampTimeScale, TIME_SCALE_RANGE } from '../core/frame-pacing';
|
|
54
|
+
import { getDebugRegistry } from '../runtime/debug-registry';
|
|
54
55
|
/**
|
|
55
56
|
* How many display frames the frame-time reading keeps. ~1 second at 60 Hz —
|
|
56
57
|
* long enough that a hitch is still in the window when you look, short enough
|
|
@@ -233,3 +234,72 @@ export function createDevInstruments(game) {
|
|
|
233
234
|
function now() {
|
|
234
235
|
return typeof performance === 'undefined' ? Date.now() : performance.now();
|
|
235
236
|
}
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
// Host publication — the instruments' OWN door
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
//
|
|
241
|
+
// The HOST publishes these (the editor's mount install path), so every game
|
|
242
|
+
// gets them for literally zero lines — no capability, no bridge component, no
|
|
243
|
+
// mount. One provider per reading (`instrument.timescale`), one command per
|
|
244
|
+
// action (`instrument.timescale.set`), plus ONE index provider
|
|
245
|
+
// (`instruments`) carrying every descriptor with this instant's values, so an
|
|
246
|
+
// outside reader gets the whole panel in one round trip. Naming is unchanged
|
|
247
|
+
// from when the dev-tools capability published them, so every existing reader
|
|
248
|
+
// keeps working; only the publisher moved realms.
|
|
249
|
+
/** The index provider's name. */
|
|
250
|
+
export const INSTRUMENTS_PROVIDER = 'instruments';
|
|
251
|
+
/** The registry scope the host publishes under. Not a mounted world —
|
|
252
|
+
* instruments are game-scoped host furniture, like the hooks' `__react__`. */
|
|
253
|
+
const INSTRUMENTS_WORLD_ID = '__instruments__';
|
|
254
|
+
function readingOf(instrument) {
|
|
255
|
+
const base = {
|
|
256
|
+
name: `instrument.${instrument.id}`,
|
|
257
|
+
id: instrument.id,
|
|
258
|
+
label: instrument.label,
|
|
259
|
+
hint: instrument.hint,
|
|
260
|
+
...(instrument.unit === undefined ? {} : { unit: instrument.unit }),
|
|
261
|
+
control: instrument.control,
|
|
262
|
+
actions: instrument.actions.map((action) => ({
|
|
263
|
+
name: `instrument.${instrument.id}.${action.id}`,
|
|
264
|
+
id: action.id,
|
|
265
|
+
label: action.label,
|
|
266
|
+
hint: action.hint,
|
|
267
|
+
})),
|
|
268
|
+
};
|
|
269
|
+
try {
|
|
270
|
+
return { ...base, value: instrument.read() };
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
return { ...base, value: null, error: error instanceof Error ? error.message : String(error) };
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Create this game's instrument set and register every door on its debug
|
|
278
|
+
* registry. Called once per mounted Game by the host install path; the
|
|
279
|
+
* returned disposer ends the set's one resource (the frame-time
|
|
280
|
+
* subscription) — the registrations die with the Game itself.
|
|
281
|
+
*/
|
|
282
|
+
export function publishDevInstruments(game) {
|
|
283
|
+
const registry = getDebugRegistry(game);
|
|
284
|
+
if (!registry) {
|
|
285
|
+
throw new Error('Cannot publish dev instruments: mounted Game has no debug registry.');
|
|
286
|
+
}
|
|
287
|
+
const set = createDevInstruments(game);
|
|
288
|
+
const scope = registry.forRoot(INSTRUMENTS_WORLD_ID);
|
|
289
|
+
for (const instrument of set.instruments) {
|
|
290
|
+
scope.registerStateProvider(`instrument.${instrument.id}`, () => instrument.read(), {
|
|
291
|
+
tier: 'assisted',
|
|
292
|
+
});
|
|
293
|
+
for (const action of instrument.actions) {
|
|
294
|
+
scope.registerCommand(`instrument.${instrument.id}.${action.id}`, {
|
|
295
|
+
description: `${instrument.label}: ${action.label} — ${action.hint}`,
|
|
296
|
+
locus: 'client',
|
|
297
|
+
args: action.args,
|
|
298
|
+
}, (...values) => action.run(values));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
scope.registerStateProvider(INSTRUMENTS_PROVIDER, () => set.instruments.map(readingOf), {
|
|
302
|
+
tier: 'assisted',
|
|
303
|
+
});
|
|
304
|
+
return () => set.dispose();
|
|
305
|
+
}
|
|
@@ -8,10 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Engine-owned and first-party, seeded by BOTH three-root mount paths — a game
|
|
10
10
|
* writes nothing to get these, and there is no capability to install:
|
|
11
|
-
* - `
|
|
12
|
-
* `setup(ctx)` world), at the same spot it seeds
|
|
13
|
-
* `systemAdapters.renderDebug`;
|
|
14
|
-
* - `world3d-react/r3f-adapter.tsx` (a TSX/R3F world — the shape EVERY
|
|
11
|
+
* - `world3d-react/r3f-root-factory.tsx` (a TSX/R3F world — the shape EVERY
|
|
15
12
|
* scaffolded project's three root has), right after fiber's first commit
|
|
16
13
|
* resolves the scene.
|
|
17
14
|
* Both is the whole point and not redundancy: they are two independent mounts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-render-vitals.d.ts","sourceRoot":"","sources":["../../src/dev/register-render-vitals.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"register-render-vitals.d.ts","sourceRoot":"","sources":["../../src/dev/register-render-vitals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAOxE,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AACtD,eAAO,MAA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eded by BOTH three-root mount paths — a game
|
|
10
10
|
* writes nothing to get these, and there is no capability to install:
|
|
11
|
-
* - `
|
|
12
|
-
* `setup(ctx)` world), at the same spot it seeds
|
|
13
|
-
* `systemAdapters.renderDebug`;
|
|
14
|
-
* - `world3d-react/r3f-adapter.tsx` (a TSX/R3F world — the shape EVERY
|
|
11
|
+
* - `world3d-react/r3f-root-factory.tsx` (a TSX/R3F world — the shape EVERY
|
|
15
12
|
* scaffolded project's three root has), right after fiber's first commit
|
|
16
13
|
* resolves the scene.
|
|
17
14
|
* Both is the whole point and not redundancy: they are two independent mounts
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* the WebGL2 frame capture (`webgl-frame-capture.ts`), a live three.js scene,
|
|
4
4
|
* and the render adapter's per-frame render pass.
|
|
5
5
|
*
|
|
6
|
-
* Split OUT of `
|
|
6
|
+
* Split OUT of `world3d-react/r3f-root-factory.tsx` so the capture/attribution/restore
|
|
7
7
|
* flow is unit-testable in a headless Node test with a mock GL context and a
|
|
8
8
|
* plain scene — a real non-headless GPU mount (EffectComposer + WebGLRenderer)
|
|
9
|
-
* cannot run under vitest here
|
|
10
|
-
* `setup(ctx)` only through hotReload on a data scene. `mount()` owns the
|
|
9
|
+
* cannot run under vitest here. `mount()` owns the
|
|
11
10
|
* DECISION to construct this (only under a real WebGL2 context, never
|
|
12
11
|
* headless — see `frameCaptureContextFor`); this module owns the BEHAVIOR.
|
|
13
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-debug-adapter.d.ts","sourceRoot":"","sources":["../../src/dev/render-debug-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"render-debug-adapter.d.ts","sourceRoot":"","sources":["../../src/dev/render-debug-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE7F;;;2DAG2D;AAC3D,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,OAAO,EACjB,eAAe,EAAE,OAAO,GACvB,sBAAsB,GAAG,IAAI,CAO/B;AAED,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,OAAO,EAAE,iBAAiB,CAAC;IAC3B;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IACvB;gFAC4E;IAC5E,MAAM,CAAC,EAAE,MAAM,oBAAoB,CAAC;IACpC;yDACqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;0BACsB;IACtB,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACvD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,+DAA+D;IAC/D,YAAY,IAAI,IAAI,CAAC;IACrB,6EAA6E;IAC7E,WAAW,IAAI,IAAI,CAAC;IACpB,6EAA6E;IAC7E,OAAO,IAAI,IAAI,CAAC;CACjB;AAkDD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,GAAG,iBAAiB,CAmFxF"}
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* the WebGL2 frame capture (`webgl-frame-capture.ts`), a live three.js scene,
|
|
4
4
|
* and the render adapter's per-frame render pass.
|
|
5
5
|
*
|
|
6
|
-
* Split OUT of `
|
|
6
|
+
* Split OUT of `world3d-react/r3f-root-factory.tsx` so the capture/attribution/restore
|
|
7
7
|
* flow is unit-testable in a headless Node test with a mock GL context and a
|
|
8
8
|
* plain scene — a real non-headless GPU mount (EffectComposer + WebGLRenderer)
|
|
9
|
-
* cannot run under vitest here
|
|
10
|
-
* `setup(ctx)` only through hotReload on a data scene. `mount()` owns the
|
|
9
|
+
* cannot run under vitest here. `mount()` owns the
|
|
11
10
|
* DECISION to construct this (only under a real WebGL2 context, never
|
|
12
11
|
* headless — see `frameCaptureContextFor`); this module owns the BEHAVIOR.
|
|
13
12
|
*
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
* OWNER: the caller of {@link createRenderVitals}, which allocates one state
|
|
44
44
|
* object and one `profiler.subscribe` registration. SHARER: none — the state
|
|
45
45
|
* is private to that call. TEARDOWN: the returned `dispose()`, the ONE path
|
|
46
|
-
* that ends the subscription (`
|
|
47
|
-
* `
|
|
46
|
+
* that ends the subscription (`world3d-react/r3f-root-factory.tsx` calls it
|
|
47
|
+
* from the mounted root's own `dispose()`).
|
|
48
48
|
*/
|
|
49
49
|
import type { PerformanceFrame, PerformanceProfiler } from './performance-profiler';
|
|
50
50
|
/**
|
|
51
51
|
* The profiler phase name the three adapter brackets its CPU render
|
|
52
52
|
* submission with — spelled HERE and nowhere else, so the producer
|
|
53
|
-
* (`
|
|
53
|
+
* (`world3d-react/r3f-root-factory.tsx`) and the consumer ({@link foldProfilerFrame})
|
|
54
54
|
* cannot drift apart. Dotted, so it reads as a decomposition of the enclosing
|
|
55
55
|
* `render` phase rather than a ninth peer of `SystemPhase`.
|
|
56
56
|
*/
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
* OWNER: the caller of {@link createRenderVitals}, which allocates one state
|
|
44
44
|
* object and one `profiler.subscribe` registration. SHARER: none — the state
|
|
45
45
|
* is private to that call. TEARDOWN: the returned `dispose()`, the ONE path
|
|
46
|
-
* that ends the subscription (`
|
|
47
|
-
* `
|
|
46
|
+
* that ends the subscription (`world3d-react/r3f-root-factory.tsx` calls it
|
|
47
|
+
* from the mounted root's own `dispose()`).
|
|
48
48
|
*/
|
|
49
49
|
/**
|
|
50
50
|
* The profiler phase name the three adapter brackets its CPU render
|
|
51
51
|
* submission with — spelled HERE and nowhere else, so the producer
|
|
52
|
-
* (`
|
|
52
|
+
* (`world3d-react/r3f-root-factory.tsx`) and the consumer ({@link foldProfilerFrame})
|
|
53
53
|
* cannot drift apart. Dotted, so it reads as a decomposition of the enclosing
|
|
54
54
|
* `render` phase rather than a ninth peer of `SystemPhase`.
|
|
55
55
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* WHY FIRST-PARTY, NOT spectorjs (recorded per the "use libraries directly, no
|
|
5
5
|
* wrappers" rule): the capture seam we need is the WebGL2 context this engine
|
|
6
6
|
* ALREADY owns end-to-end (`renderer.getContext()` in
|
|
7
|
-
* `
|
|
7
|
+
* `world3d-react/r3f-root-factory.tsx`). spectorjs is absent from node_modules, and its
|
|
8
8
|
* actual value is a bundled inspector UI we would discard — adopting it imports
|
|
9
9
|
* ~2MB of library to keep ~10% of it, and it wraps the context with its own
|
|
10
10
|
* global patching model rather than the instance-shadow-and-restore discipline
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* WHY FIRST-PARTY, NOT spectorjs (recorded per the "use libraries directly, no
|
|
5
5
|
* wrappers" rule): the capture seam we need is the WebGL2 context this engine
|
|
6
6
|
* ALREADY owns end-to-end (`renderer.getContext()` in
|
|
7
|
-
* `
|
|
7
|
+
* `world3d-react/r3f-root-factory.tsx`). spectorjs is absent from node_modules, and its
|
|
8
8
|
* actual value is a bundled inspector UI we would discard — adopting it imports
|
|
9
9
|
* ~2MB of library to keep ~10% of it, and it wraps the context with its own
|
|
10
10
|
* global patching model rather than the instance-shadow-and-restore discipline
|
package/dist/index.d.ts
CHANGED
|
@@ -10,25 +10,22 @@
|
|
|
10
10
|
* remain the primary way to reach engine internals — reach for a subpath
|
|
11
11
|
* first. This barrel exists only so the package's bare-name entry point is
|
|
12
12
|
* HONEST (resolves to something real and useful) instead of dangling; it
|
|
13
|
-
* covers just the handful of symbols a
|
|
14
|
-
*
|
|
13
|
+
* covers just the handful of symbols a consumer needs to mount a game
|
|
14
|
+
* from its manifest, plus the manifest file
|
|
15
15
|
* entry points. Keep it small when extending it — prefer a new subpath
|
|
16
16
|
* export over growing this file into a firehose.
|
|
17
17
|
*
|
|
18
18
|
* Groups (import order below is alphabetical-by-specifier, per the repo's
|
|
19
19
|
* biome `organizeImports` rule, not by group — see this list instead):
|
|
20
|
-
* - game setup contract: `GameContext`/`GameCleanup`/`GameSetupFn`, `fromSetup`
|
|
21
20
|
* - surface vocabulary: `AdapterSurface`
|
|
22
21
|
* - manifest-driven mount: `mountManifestRoots` + its option/result types
|
|
23
22
|
* - game manifest (vgai.project.json) entry point: `loadGameManifest`
|
|
24
23
|
*/
|
|
25
24
|
export type { AdapterSurface } from './adapter/adapter-surface';
|
|
26
|
-
export { fromSetup } from './adapter/setup-three-root-adapter';
|
|
27
25
|
export { AssetParseError } from './asset-parse-error';
|
|
28
26
|
export type { AdapterRoot, GameManifest, ResolvedAdapter, ResolvedAdapterRoot, ResolvedGameManifest, RootAdapter, } from './manifest';
|
|
29
27
|
export { DEFAULT_SERVER_MODULE, loadGameManifest } from './manifest';
|
|
30
28
|
export type { GameSession } from './runtime/create-runtime';
|
|
31
29
|
export type { MountEntry, MountedManifestSession, MountManifestOptions, } from './runtime/mount-manifest';
|
|
32
30
|
export { mountManifestRoots } from './runtime/mount-manifest';
|
|
33
|
-
export type { GameCleanup, GameContext, GameSetupFn } from './runtime/types';
|
|
34
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EACV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,YAAY,EACV,UAAU,EACV,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,19 +10,17 @@
|
|
|
10
10
|
* remain the primary way to reach engine internals — reach for a subpath
|
|
11
11
|
* first. This barrel exists only so the package's bare-name entry point is
|
|
12
12
|
* HONEST (resolves to something real and useful) instead of dangling; it
|
|
13
|
-
* covers just the handful of symbols a
|
|
14
|
-
*
|
|
13
|
+
* covers just the handful of symbols a consumer needs to mount a game
|
|
14
|
+
* from its manifest, plus the manifest file
|
|
15
15
|
* entry points. Keep it small when extending it — prefer a new subpath
|
|
16
16
|
* export over growing this file into a firehose.
|
|
17
17
|
*
|
|
18
18
|
* Groups (import order below is alphabetical-by-specifier, per the repo's
|
|
19
19
|
* biome `organizeImports` rule, not by group — see this list instead):
|
|
20
|
-
* - game setup contract: `GameContext`/`GameCleanup`/`GameSetupFn`, `fromSetup`
|
|
21
20
|
* - surface vocabulary: `AdapterSurface`
|
|
22
21
|
* - manifest-driven mount: `mountManifestRoots` + its option/result types
|
|
23
22
|
* - game manifest (vgai.project.json) entry point: `loadGameManifest`
|
|
24
23
|
*/
|
|
25
|
-
export { fromSetup } from './adapter/setup-three-root-adapter';
|
|
26
24
|
export { AssetParseError } from './asset-parse-error';
|
|
27
25
|
export { DEFAULT_SERVER_MODULE, loadGameManifest } from './manifest';
|
|
28
26
|
export { mountManifestRoots } from './runtime/mount-manifest';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host POINTER stream, in the game's own coordinate space — the DOM edge
|
|
3
|
+
* `InputManager`'s touch backends (`setTouchButton` / `setTouchStick`) and any
|
|
4
|
+
* pointer-position read need, and which the manager itself deliberately does
|
|
5
|
+
* not own.
|
|
6
|
+
*
|
|
7
|
+
* `InputManager` listens on `window` for keyboard, mouse and focus, in CLIENT
|
|
8
|
+
* pixels, because an action map is surface-agnostic. A pointer is not: a tap is
|
|
9
|
+
* only meaningful relative to the surface it landed on, and a game's own
|
|
10
|
+
* coordinate space is usually NOT that surface's CSS pixels — a fixed design
|
|
11
|
+
* resolution presented by uniformly scaling and letterboxing is the common
|
|
12
|
+
* case, and a hit-test against a UI rect authored in design pixels has to
|
|
13
|
+
* happen in one space with the pointer. That mapping needs a surface and a
|
|
14
|
+
* design size the manager has no way to know, so it lives here, beside it.
|
|
15
|
+
*
|
|
16
|
+
* What this owns, and nothing more:
|
|
17
|
+
*
|
|
18
|
+
* - **Position** — the last pointer position over the surface, mapped into the
|
|
19
|
+
* design space. `setPosition` is the headless door (a harness or a game
|
|
20
|
+
* command driving the game with no DOM), the same shape as
|
|
21
|
+
* `InputManager.addMouseDelta`: inject through the accumulator the reader
|
|
22
|
+
* already reads, never a synthetic `pointermove`.
|
|
23
|
+
* - **Touches** — a per-frame queue of {@link HostPointerTouch} records with
|
|
24
|
+
* DENSE finger indices, drained by the game's own frame. `pointerId` is the
|
|
25
|
+
* browser's opaque, monotonically growing handle; a touch API that reports
|
|
26
|
+
* "finger 0 and finger 1" wants the lowest free slot, reused the moment a
|
|
27
|
+
* finger lifts, which is what {@link HostPointerTouch.index} is.
|
|
28
|
+
* - **Cursor** — the CSS cursor applied to the surface, because the surface is
|
|
29
|
+
* resolved here and nowhere else.
|
|
30
|
+
*
|
|
31
|
+
* **Gating.** Every listener returns early unless
|
|
32
|
+
* `InputManager.isInputActive()` — the SAME predicate the manager's own
|
|
33
|
+
* `keydown`/`mousemove` listeners pass, so play-mode isolation and window
|
|
34
|
+
* blur suppress pointer position and touches exactly as they suppress a key.
|
|
35
|
+
* The predicate is read from the manager rather than recomposed here
|
|
36
|
+
* (`isEnabled() && isFocused()` written out a second time is how a looser gate
|
|
37
|
+
* drifts in: a blurred or typing tab kept updating a pointer position under
|
|
38
|
+
* exactly that duplication). Text-entry focus is deliberately NOT part of it,
|
|
39
|
+
* matching `onMouseMove` rather than `onKeyDown` — moving a finger is not
|
|
40
|
+
* typing.
|
|
41
|
+
*
|
|
42
|
+
* **Ownership.** Owns its four pointer listeners on the resolved owner, the
|
|
43
|
+
* touch queue and the finger-index table. Shares the `InputManager`, which is
|
|
44
|
+
* the game's and is never mutated here — this reports; what a control DOES
|
|
45
|
+
* with a finger (which rect owns it, whether that becomes a `setTouchButton`)
|
|
46
|
+
* belongs to the UI that draws the control. Teardown is {@link
|
|
47
|
+
* HostPointer.dispose}, and only that: `InputManager.dispose` does not reach
|
|
48
|
+
* these listeners.
|
|
49
|
+
*
|
|
50
|
+
* Headless (no `window`): construction succeeds and binds nothing. Position is
|
|
51
|
+
* whatever {@link HostPointer.setPosition} last wrote, and the touch queue
|
|
52
|
+
* stays empty.
|
|
53
|
+
*/
|
|
54
|
+
import type { InputManager } from './input-manager';
|
|
55
|
+
import type { Vector2 } from './input-types';
|
|
56
|
+
/** One finger edge the host pointer stream produced. */
|
|
57
|
+
export interface HostPointerTouch {
|
|
58
|
+
/**
|
|
59
|
+
* `'start'` when the finger went down on the surface, `'move'` while it
|
|
60
|
+
* drags, `'end'` when it lifted or the browser cancelled it. A cancel is an
|
|
61
|
+
* end: the finger is gone either way, and a control that treats them
|
|
62
|
+
* differently is holding a button nothing will ever release.
|
|
63
|
+
*/
|
|
64
|
+
readonly phase: 'start' | 'move' | 'end';
|
|
65
|
+
/**
|
|
66
|
+
* DENSE finger index — the lowest slot free when this finger went down, and
|
|
67
|
+
* free again the moment it lifts. NOT the browser's `pointerId`, which never
|
|
68
|
+
* reuses a value and is therefore useless as "which finger is this".
|
|
69
|
+
*/
|
|
70
|
+
readonly index: number;
|
|
71
|
+
/** Position in the design space (see {@link HostPointerOptions.designSize}). */
|
|
72
|
+
readonly position: Vector2;
|
|
73
|
+
}
|
|
74
|
+
/** What {@link createHostPointer} needs. */
|
|
75
|
+
export interface HostPointerOptions {
|
|
76
|
+
/** The game's own manager — read for its gate, never written. */
|
|
77
|
+
readonly input: InputManager;
|
|
78
|
+
/**
|
|
79
|
+
* The render surface pointer positions are relative to.
|
|
80
|
+
*
|
|
81
|
+
* A GETTER rather than an element because a renderer usually mints its
|
|
82
|
+
* canvas after the game's services exist. Absent (or returning `null`) falls
|
|
83
|
+
* back to the event's own target element, and listening falls back to
|
|
84
|
+
* `window` — which is what makes a finger that starts on the canvas and
|
|
85
|
+
* drags over a DOM overlay keep reporting.
|
|
86
|
+
*/
|
|
87
|
+
readonly surface?: (() => HTMLElement | null) | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The game's own logical resolution, if it has one. Surface CSS pixels are
|
|
90
|
+
* mapped into it, so a pointer and a UI rect authored at this size share one
|
|
91
|
+
* space regardless of how the host scaled and letterboxed the surface.
|
|
92
|
+
*
|
|
93
|
+
* Absent: positions are reported in the surface's own CSS pixels, and the
|
|
94
|
+
* position before any event is `{x: 0, y: 0}`. Present: the position before
|
|
95
|
+
* any event is the CENTRE of the design space — a pointer that has never
|
|
96
|
+
* moved is better described as the middle of the view than as a corner it
|
|
97
|
+
* was never at.
|
|
98
|
+
*/
|
|
99
|
+
readonly designSize?: Vector2 | undefined;
|
|
100
|
+
}
|
|
101
|
+
/** The host pointer stream bound to one surface. One per mounted game. */
|
|
102
|
+
export interface HostPointer {
|
|
103
|
+
/** The last pointer position, in the design space. */
|
|
104
|
+
getPosition(): Vector2;
|
|
105
|
+
/** Headless / harness door onto {@link getPosition}'s value. */
|
|
106
|
+
setPosition(position: Vector2): void;
|
|
107
|
+
/**
|
|
108
|
+
* Drain the touch records queued since the last call. Returns them in
|
|
109
|
+
* arrival order and empties the queue, so a frame that drains sees each
|
|
110
|
+
* finger edge exactly once.
|
|
111
|
+
*/
|
|
112
|
+
takeTouches(): readonly HostPointerTouch[];
|
|
113
|
+
/**
|
|
114
|
+
* Set the CSS `cursor` applied to the surface. Applied on the next pointer
|
|
115
|
+
* move over it, which is also when the surface is known.
|
|
116
|
+
*/
|
|
117
|
+
setCursor(cursor: string): void;
|
|
118
|
+
/** Remove the listeners this owns. */
|
|
119
|
+
dispose(): void;
|
|
120
|
+
}
|
|
121
|
+
export declare function createHostPointer(options: HostPointerOptions): HostPointer;
|
|
122
|
+
//# sourceMappingURL=host-pointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-pointer.d.ts","sourceRoot":"","sources":["../../src/input/host-pointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAU7C,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,4CAA4C;AAC5C,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1D;;;;;;;;;;OAUG;IACH,Q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