@vgai/engine 0.5.15 → 0.5.17
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/dist/adapter/adapter-module.d.ts +229 -33
- package/dist/adapter/adapter-module.d.ts.map +1 -1
- package/dist/adapter/adapter-module.js +222 -50
- package/dist/adapter/authoring-seam-contract.d.ts +530 -0
- package/dist/adapter/authoring-seam-contract.d.ts.map +1 -0
- package/dist/adapter/authoring-seam-contract.js +162 -0
- package/dist/adapter/authoring.d.ts +237 -50
- package/dist/adapter/authoring.d.ts.map +1 -1
- package/dist/adapter/authoring.js +2 -1
- package/dist/adapter/entrypoint-selection-source.d.ts +35 -0
- package/dist/adapter/entrypoint-selection-source.d.ts.map +1 -0
- package/dist/adapter/entrypoint-selection-source.js +151 -0
- package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts +7 -3
- package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts.map +1 -1
- package/dist/adapter/finders/scenes-from-entrypoint-selection.js +145 -27
- package/dist/adapter/first-party-systems.d.ts +13 -3
- package/dist/adapter/first-party-systems.d.ts.map +1 -1
- package/dist/adapter/first-party-systems.js +10 -3
- package/dist/adapter/index.d.ts +7 -2
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +4 -0
- package/dist/adapter/ingest/contract-system-adapters.d.ts +1 -1
- package/dist/adapter/ingest/contract-system-adapters.d.ts.map +1 -1
- package/dist/adapter/ingest/contract-system-adapters.js +13 -25
- package/dist/adapter/ingest/game-contract-seams.d.ts +214 -0
- package/dist/adapter/ingest/game-contract-seams.d.ts.map +1 -0
- package/dist/adapter/ingest/game-contract-seams.js +62 -0
- package/dist/adapter/ingest/game-contract.d.ts +5 -3
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -1
- package/dist/adapter/ingest/game-contract.js +4 -1
- package/dist/adapter/ingest/merge-debug-adapters.d.ts +52 -0
- package/dist/adapter/ingest/merge-debug-adapters.d.ts.map +1 -0
- package/dist/adapter/ingest/merge-debug-adapters.js +141 -0
- package/dist/adapter/ingest/observation-debug-adapter.d.ts +56 -0
- package/dist/adapter/ingest/observation-debug-adapter.d.ts.map +1 -0
- package/dist/adapter/ingest/observation-debug-adapter.js +131 -0
- package/dist/adapter/ingest/scene-capture.d.ts +38 -13
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
- package/dist/adapter/ingest/scene-capture.js +101 -24
- package/dist/adapter/ingest/visible-capture-window.d.ts +22 -5
- package/dist/adapter/ingest/visible-capture-window.d.ts.map +1 -1
- package/dist/adapter/ingest/visible-capture-window.js +46 -7
- package/dist/adapter/native-debug-module.d.ts +43 -0
- package/dist/adapter/native-debug-module.d.ts.map +1 -0
- package/dist/adapter/native-debug-module.js +230 -0
- package/dist/adapter/object3d-authoring-subject.d.ts +32 -0
- package/dist/adapter/object3d-authoring-subject.d.ts.map +1 -0
- package/dist/adapter/object3d-authoring-subject.js +25 -0
- package/dist/adapter/root-adapter.d.ts +25 -56
- package/dist/adapter/root-adapter.d.ts.map +1 -1
- package/dist/adapter/root-adapter.js +4 -20
- package/dist/adapter/root-seam-contract.d.ts +129 -0
- package/dist/adapter/root-seam-contract.d.ts.map +1 -0
- package/dist/adapter/root-seam-contract.js +37 -0
- package/dist/adapter/seam-evidence.d.ts +118 -0
- package/dist/adapter/seam-evidence.d.ts.map +1 -0
- package/dist/adapter/seam-evidence.js +231 -0
- package/dist/adapter/setup-three-root-adapter.d.ts +2 -3
- package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -1
- package/dist/adapter/setup-three-root-adapter.js +11 -12
- package/dist/adapter/system-adapter.d.ts +6 -1
- package/dist/adapter/system-adapter.d.ts.map +1 -1
- package/dist/adapter/system-seam-contract.d.ts +354 -0
- package/dist/adapter/system-seam-contract.d.ts.map +1 -0
- package/dist/adapter/system-seam-contract.js +95 -0
- package/dist/animation/xstate-animation-binding.d.ts +6 -0
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -1
- package/dist/animation/xstate-animation-binding.js +142 -4
- package/dist/asset-formats/collider.d.ts +1 -1
- package/dist/asset-formats/mesh.d.ts +2 -2
- package/dist/asset-formats/particles.d.ts +1 -1
- package/dist/canvas-react/engine-bridge.d.ts +6 -6
- package/dist/canvas-react/engine-bridge.d.ts.map +1 -1
- package/dist/canvas-react/engine-bridge.js +2 -2
- package/dist/canvas-react/index.d.ts +2 -2
- package/dist/canvas-react/index.d.ts.map +1 -1
- package/dist/canvas-react/index.js +1 -1
- package/dist/canvas-react/pixi-react-adapter.d.ts +15 -9
- package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -1
- package/dist/canvas-react/pixi-react-adapter.js +129 -64
- package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -1
- package/dist/canvas-react/pixi-react-root-factory.js +4 -0
- package/dist/canvas-react/world-context.d.ts +22 -12
- package/dist/canvas-react/world-context.d.ts.map +1 -1
- package/dist/canvas-react/world-context.js +12 -51
- package/dist/data/curve.d.ts +1 -1
- package/dist/data/curve.js +2 -2
- package/dist/dev/instruments.d.ts +4 -4
- package/dist/dev/instruments.js +4 -4
- package/dist/dev/register-render-vitals.d.ts +2 -2
- package/dist/dev/register-render-vitals.js +2 -2
- package/dist/dev/static-batch-advisor.d.ts +1 -1
- package/dist/dev/static-batch-advisor.js +2 -2
- package/dist/ecs/user-data.d.ts +5 -0
- package/dist/ecs/user-data.d.ts.map +1 -1
- package/dist/ecs/user-data.js +3 -0
- package/dist/input/input-manager.d.ts +64 -0
- package/dist/input/input-manager.d.ts.map +1 -1
- package/dist/input/input-manager.js +149 -0
- package/dist/manifest/load.d.ts +0 -3
- package/dist/manifest/load.d.ts.map +1 -1
- package/dist/manifest/load.js +0 -4
- package/dist/manifest/schema.d.ts +9 -11
- package/dist/manifest/schema.d.ts.map +1 -1
- package/dist/manifest/schema.js +2 -23
- package/dist/pixi/authoring.d.ts +33 -0
- package/dist/pixi/authoring.d.ts.map +1 -1
- package/dist/pixi/authoring.js +301 -2
- package/dist/pixi/ingest.d.ts +2 -1
- package/dist/pixi/ingest.d.ts.map +1 -1
- package/dist/pixi/ingest.js +4 -2
- package/dist/pixi/scene-capture.d.ts +9 -1
- package/dist/pixi/scene-capture.d.ts.map +1 -1
- package/dist/pixi/scene-capture.js +9 -6
- package/dist/react/world-state.d.ts +12 -0
- package/dist/react/world-state.d.ts.map +1 -1
- package/dist/react/world-state.js +14 -0
- package/dist/render/particles-factory.d.ts +13 -6
- package/dist/render/particles-factory.d.ts.map +1 -1
- package/dist/render/particles-factory.js +6 -3
- package/dist/render/soft-particle-depth.d.ts +3 -3
- package/dist/render/soft-particle-depth.d.ts.map +1 -1
- package/dist/render/soft-particle-depth.js +8 -13
- package/dist/runtime/create-runtime.d.ts +25 -62
- package/dist/runtime/create-runtime.d.ts.map +1 -1
- package/dist/runtime/create-runtime.js +58 -105
- package/dist/runtime/dev-build.d.ts +37 -0
- package/dist/runtime/dev-build.d.ts.map +1 -0
- package/dist/runtime/dev-build.js +49 -0
- package/dist/runtime/game.d.ts +38 -72
- package/dist/runtime/game.d.ts.map +1 -1
- package/dist/runtime/game.js +40 -55
- package/dist/runtime/mount-game.d.ts.map +1 -1
- package/dist/runtime/mount-game.js +12 -1
- package/dist/runtime/mount-manifest.d.ts +0 -13
- package/dist/runtime/mount-manifest.d.ts.map +1 -1
- package/dist/runtime/mount-manifest.js +5 -25
- package/dist/runtime/types.d.ts +18 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/setup/setup-renderer.d.ts +3 -4
- package/dist/setup/setup-renderer.d.ts.map +1 -1
- package/dist/setup/setup-renderer.js +3 -4
- package/dist/world3d-react/engine-bridge.d.ts +1 -1
- package/dist/world3d-react/engine-bridge.d.ts.map +1 -1
- package/dist/world3d-react/engine-bridge.js +29 -4
- package/dist/world3d-react/index.d.ts +1 -1
- package/dist/world3d-react/index.js +1 -1
- package/dist/world3d-react/r3f-adapter.d.ts +7 -0
- package/dist/world3d-react/r3f-adapter.d.ts.map +1 -1
- package/dist/world3d-react/r3f-adapter.js +132 -28
- package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -1
- package/dist/world3d-react/r3f-root-factory.js +14 -0
- package/dist/world3d-react/rapier-physics-bridge.d.ts +4 -4
- package/dist/world3d-react/rapier-physics-bridge.js +3 -3
- package/dist/world3d-react/world-context.d.ts +52 -3
- package/dist/world3d-react/world-context.d.ts.map +1 -1
- package/dist/world3d-react/world-context.js +94 -64
- package/dist-config/config.js.map +1 -1
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +8 -8
- package/schemas/vgai-project.schema.json +1 -6
- package/src/adapter/adapter-module.ts +405 -72
- package/src/adapter/authoring-seam-contract.ts +211 -0
- package/src/adapter/authoring.ts +242 -50
- package/src/adapter/entrypoint-selection-source.ts +159 -0
- package/src/adapter/finders/scenes-from-entrypoint-selection.ts +162 -36
- package/src/adapter/first-party-systems.ts +17 -3
- package/src/adapter/index.ts +51 -1
- package/src/adapter/ingest/contract-system-adapters.ts +26 -30
- package/src/adapter/ingest/game-contract-seams.ts +85 -0
- package/src/adapter/ingest/game-contract.ts +9 -4
- package/src/adapter/ingest/merge-debug-adapters.ts +193 -0
- package/src/adapter/ingest/observation-debug-adapter.ts +158 -0
- package/src/adapter/ingest/scene-capture.ts +126 -23
- package/src/adapter/ingest/visible-capture-window.ts +63 -9
- package/src/adapter/native-debug-module.ts +307 -0
- package/src/adapter/object3d-authoring-subject.ts +50 -0
- package/src/adapter/root-adapter.ts +25 -56
- package/src/adapter/root-seam-contract.ts +57 -0
- package/src/adapter/seam-evidence.ts +336 -0
- package/src/adapter/setup-three-root-adapter.ts +13 -15
- package/src/adapter/system-adapter.ts +6 -1
- package/src/adapter/system-seam-contract.ts +121 -0
- package/src/animation/xstate-animation-binding.ts +151 -4
- package/src/canvas-react/engine-bridge.ts +6 -6
- package/src/canvas-react/index.ts +2 -1
- package/src/canvas-react/pixi-react-adapter.tsx +143 -77
- package/src/canvas-react/pixi-react-root-factory.tsx +4 -0
- package/src/canvas-react/world-context.ts +26 -101
- package/src/data/curve.ts +2 -2
- package/src/dev/instruments.ts +4 -4
- package/src/dev/register-render-vitals.ts +2 -2
- package/src/dev/static-batch-advisor.ts +2 -2
- package/src/ecs/user-data.ts +5 -0
- package/src/input/input-manager.ts +145 -0
- package/src/manifest/load.ts +0 -7
- package/src/manifest/schema.ts +2 -25
- package/src/pixi/authoring.ts +329 -2
- package/src/pixi/ingest.ts +9 -2
- package/src/pixi/scene-capture.ts +20 -5
- package/src/react/world-state.tsx +15 -0
- package/src/render/particles-factory.ts +16 -6
- package/src/render/soft-particle-depth.ts +8 -13
- package/src/runtime/create-runtime.ts +79 -158
- package/src/runtime/dev-build.ts +49 -0
- package/src/runtime/game.ts +72 -113
- package/src/runtime/mount-game.ts +19 -1
- package/src/runtime/mount-manifest.ts +5 -37
- package/src/runtime/types.ts +22 -0
- package/src/setup/setup-renderer.ts +3 -4
- package/src/world3d-react/engine-bridge.ts +29 -4
- package/src/world3d-react/index.ts +1 -1
- package/src/world3d-react/r3f-adapter.tsx +140 -31
- package/src/world3d-react/r3f-root-factory.tsx +14 -0
- package/src/world3d-react/rapier-physics-bridge.tsx +4 -4
- package/src/world3d-react/world-context.ts +111 -87
- package/dist/runtime/dev-layers.d.ts +0 -34
- package/dist/runtime/dev-layers.d.ts.map +0 -1
- package/dist/runtime/dev-layers.js +0 -46
- package/src/runtime/dev-layers.ts +0 -46
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* project guarantees via its Vite `resolve.dedupe: ['three', 'react',
|
|
19
19
|
* 'react-dom']` (see `examples/r3f-first-party/vite.config.ts`).
|
|
20
20
|
*/
|
|
21
|
-
import { advance, createRoot, extend, events as pointerEvents, useFrame, } from '@react-three/fiber';
|
|
21
|
+
import { advance, createRoot, extend, flushSync, events as pointerEvents, useFrame, } from '@react-three/fiber';
|
|
22
22
|
import { createElement, Fragment, useEffect, useMemo } from 'react';
|
|
23
23
|
import { registerRenderVitals } from '../dev/register-render-vitals';
|
|
24
24
|
import { createRenderDebugAdapter, frameCaptureContextFor, } from '../dev/render-debug-adapter';
|
|
@@ -27,10 +27,11 @@ import { RENDER_SUBMIT_PHASE } from '../dev/render-vitals';
|
|
|
27
27
|
import { createWebGLFrameCapture } from '../dev/webgl-frame-capture';
|
|
28
28
|
import { WorldProvider } from '../react/world-state';
|
|
29
29
|
import { createSoftParticleDepthPass } from '../render/soft-particle-depth';
|
|
30
|
-
import {
|
|
30
|
+
import { getDebugRegistry } from '../runtime/debug-registry';
|
|
31
|
+
import { devBuildEnabled } from '../runtime/dev-build';
|
|
31
32
|
import { EngineBridge } from './engine-bridge';
|
|
32
33
|
import { applyWorldRendererConfig } from './renderer-config';
|
|
33
|
-
import { createR3FRootContext } from './world-context';
|
|
34
|
+
import { createR3FRootContext, DEFAULT_INPUT_MAP_PATH, wireGameInputSeams } from './world-context';
|
|
34
35
|
/**
|
|
35
36
|
* Scene depth for any soft-particle system this world mounted, drawn between
|
|
36
37
|
* gameplay and the draw.
|
|
@@ -51,6 +52,11 @@ import { createR3FRootContext } from './world-context';
|
|
|
51
52
|
* sort is stable) — the tie-break among priority-0 callbacks is insertion
|
|
52
53
|
* order.
|
|
53
54
|
*
|
|
55
|
+
* It is mounted only when THIS host carries a real WebGL context. The editor's
|
|
56
|
+
* design-time host deliberately reconciles the scene without one because the
|
|
57
|
+
* editor viewport owns the real renderer and camera; that viewport runs the
|
|
58
|
+
* same generic depth pass immediately before it presents the adopted scene.
|
|
59
|
+
*
|
|
54
60
|
* Costs nothing while no soft-particle system is armed — see
|
|
55
61
|
* `../render/soft-particle-depth.ts` for what "armed" means and what the pass
|
|
56
62
|
* spends when it is.
|
|
@@ -68,7 +74,7 @@ function SoftParticleDepth() {
|
|
|
68
74
|
* second `requestAnimationFrame` loop (design §1.C).
|
|
69
75
|
*/
|
|
70
76
|
export function createR3FAdapter(options) {
|
|
71
|
-
const { id, content, inputMapPath, renderer: rendererConfig } = options;
|
|
77
|
+
const { id, content, inputMapPath, engineRuntime = true, renderer: rendererConfig } = options;
|
|
72
78
|
return {
|
|
73
79
|
id,
|
|
74
80
|
async mount(host) {
|
|
@@ -122,15 +128,36 @@ export function createR3FAdapter(options) {
|
|
|
122
128
|
// for one is a compile error rather than anything that can happen at
|
|
123
129
|
// runtime. `scene`/`camera` are backfilled right after fiber's first
|
|
124
130
|
// commit resolves them, before any tick can run.
|
|
125
|
-
const runtime = createR3FRootContext(host, { id, inputMapPath });
|
|
126
|
-
const { systems } = runtime;
|
|
131
|
+
const runtime = engineRuntime ? createR3FRootContext(host, { id, inputMapPath }) : null;
|
|
127
132
|
// `ctx` rides the bridge so ordinary components can reach engine
|
|
128
133
|
// services through `useGameContext()`.
|
|
129
|
-
const bridge = { ctx: runtime.ctx };
|
|
134
|
+
const bridge = runtime ? { ctx: runtime.ctx } : null;
|
|
135
|
+
const gameDebugRegistry = host.game ? getDebugRegistry(host.game) : null;
|
|
136
|
+
// THE HOST STILL WIRES THIS GAME'S INPUT WHEN THE WORLD TAKES NO CONTEXT.
|
|
137
|
+
//
|
|
138
|
+
// A default-exported world mounts with `engineRuntime: false` — no vgai
|
|
139
|
+
// runtime context enters its React tree, by design. That says nothing
|
|
140
|
+
// about the GAME-scoped input the host owns from the outside: the
|
|
141
|
+
// project's declared map, and this root's `game.input.*` seams on the
|
|
142
|
+
// debug registry. Skipping those made a fresh scaffold's bot/autoplay/
|
|
143
|
+
// `vgai eval` input doors throw `DEBUG_INPUT_UNAVAILABLE` and left the
|
|
144
|
+
// declared actions unloaded — in the ONE world shape `vgai create`
|
|
145
|
+
// produces. Same host-vs-context split as `WorldProvider` below.
|
|
146
|
+
//
|
|
147
|
+
// `inputMapPath` unset (what the default-export factory passes) means
|
|
148
|
+
// "the conventional path, if this project ships one" — quiet when it
|
|
149
|
+
// does not, since a brand-new project declares no actions yet.
|
|
150
|
+
const hostInputReady = runtime || !gameDebugRegistry
|
|
151
|
+
? null
|
|
152
|
+
: wireGameInputSeams(host, gameDebugRegistry, {
|
|
153
|
+
id,
|
|
154
|
+
inputMapPath: inputMapPath ?? DEFAULT_INPUT_MAP_PATH,
|
|
155
|
+
optionalInputMap: inputMapPath === undefined,
|
|
156
|
+
});
|
|
130
157
|
// Actions must exist before any component's init()/first frame reads
|
|
131
158
|
// them — wait for the (never-rejecting) input-map load before the first
|
|
132
159
|
// commit.
|
|
133
|
-
await runtime
|
|
160
|
+
await (runtime?.inputMapReady ?? hostInputReady);
|
|
134
161
|
// The world's own colour pipeline. Applied AFTER `root.configure()` below — see the comment
|
|
135
162
|
// at its call site for why "before" is the version that silently does nothing.
|
|
136
163
|
let restoreRendererConfig = () => { };
|
|
@@ -147,6 +174,19 @@ export function createR3FAdapter(options) {
|
|
|
147
174
|
const statePromise = new Promise((resolve) => {
|
|
148
175
|
resolveState = resolve;
|
|
149
176
|
});
|
|
177
|
+
let resolveEffectsReady;
|
|
178
|
+
const effectsReady = new Promise((resolve) => {
|
|
179
|
+
resolveEffectsReady = resolve;
|
|
180
|
+
});
|
|
181
|
+
// Rendered after the game's content. React runs passive effects in tree
|
|
182
|
+
// order, so when this fires every useDebugProvider/useDebugCommand in
|
|
183
|
+
// the initial tree has registered. A Play acknowledgement is a claim
|
|
184
|
+
// that the mounted game's command surface exists, not merely that Fiber
|
|
185
|
+
// allocated a scene.
|
|
186
|
+
function MountEffectsReady() {
|
|
187
|
+
useEffect(resolveEffectsReady, []);
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
150
190
|
// `root.configure()` is ASYNC in fiber v9 (`Promise<ReconcilerRoot>`)
|
|
151
191
|
// — the design doc's §1.C sketch shows it called synchronously; the
|
|
152
192
|
// real v9 API (verified against
|
|
@@ -244,11 +284,37 @@ export function createR3FAdapter(options) {
|
|
|
244
284
|
// until this landed. `host.game` is genuinely absent in bare/headless
|
|
245
285
|
// hosts, so the provider is conditional and those hooks stay the inert
|
|
246
286
|
// no-ops they already document themselves to be.
|
|
247
|
-
|
|
287
|
+
//
|
|
288
|
+
// READ FROM `host.game`, NEVER FROM `runtime` — the two are not the same
|
|
289
|
+
// question, and conflating them silently dark-ended the seam for every
|
|
290
|
+
// scaffolded game. The IDIOMATIC three world (`export default function
|
|
291
|
+
// World()`) mounts through `resolveR3FEntryAdapter` with
|
|
292
|
+
// `engineRuntime: false` (`r3f-root-factory.tsx`), so it has no
|
|
293
|
+
// `runtime` and no `bridge` — by design, because the vgai runtime
|
|
294
|
+
// CONTEXT (`useGameContext`) must not enter an ecosystem-native tree.
|
|
295
|
+
// `WorldProvider` is not that context: it carries the Game handle the
|
|
296
|
+
// host already holds, and it is the only way a game's own
|
|
297
|
+
// `useDebugProvider('stat', …)` can reach the ONE game-scoped registry
|
|
298
|
+
// the editor/`vgai eval` read. Keyed off `runtime`, every
|
|
299
|
+
// default-exported world's registrations no-opped in silence and
|
|
300
|
+
// `vgai eval 'await game.providers()'` listed only the built-ins.
|
|
301
|
+
// The canvas lane never had the gap (`canvas-react/
|
|
302
|
+
// pixi-react-root-factory.tsx` keeps its entry runtime on).
|
|
303
|
+
const game = host.game;
|
|
248
304
|
// `SoftParticleDepth` trails the world's own tree deliberately — see its
|
|
249
|
-
// docblock for why the subscription must land last.
|
|
250
|
-
|
|
251
|
-
|
|
305
|
+
// docblock for why the subscription must land last. A no-context design
|
|
306
|
+
// mount omits this fiber callback because the adopting editor viewport
|
|
307
|
+
// runs the pass with its own renderer and camera instead.
|
|
308
|
+
const world = createElement(Fragment, null, content, runtime && typeof host.renderer.getContext === 'function'
|
|
309
|
+
? createElement(SoftParticleDepth, { key: 'vgai-soft-particle-depth' })
|
|
310
|
+
: null, createElement(MountEffectsReady, { key: 'vgai-mount-effects-ready' }));
|
|
311
|
+
// The two providers are INDEPENDENT: `EngineBridge` rides `bridge` (the
|
|
312
|
+
// vgai runtime context, absent for a native default-exported world),
|
|
313
|
+
// `WorldProvider` rides `host.game` (the React seam, present whenever a
|
|
314
|
+
// Game hosts this world). Nesting the second inside the first is what
|
|
315
|
+
// made the seam a hostage of the first.
|
|
316
|
+
const provided = game ? createElement(WorldProvider, { game }, world) : world;
|
|
317
|
+
root.render(bridge ? createElement(EngineBridge.Provider, { value: bridge }, provided) : provided);
|
|
252
318
|
// A reconcile-time crash (e.g. a missing `extend` catalogue entry)
|
|
253
319
|
// surfaces as an uncaught window error and `onCreated` never fires —
|
|
254
320
|
// without this guard, `mount()` would await `statePromise` FOREVER and
|
|
@@ -258,7 +324,9 @@ export function createR3FAdapter(options) {
|
|
|
258
324
|
const onError = (event) => {
|
|
259
325
|
cleanup();
|
|
260
326
|
root.unmount();
|
|
261
|
-
runtime
|
|
327
|
+
runtime?.dispose();
|
|
328
|
+
if (!runtime)
|
|
329
|
+
gameDebugRegistry?.strip(id);
|
|
262
330
|
restoreRendererConfig();
|
|
263
331
|
reject(new Error(`r3f-adapter: fiber crashed before its first commit — ${event.message} ` +
|
|
264
332
|
'(mount() fails loudly instead of hanging on onCreated)'));
|
|
@@ -266,7 +334,9 @@ export function createR3FAdapter(options) {
|
|
|
266
334
|
const timer = setTimeout(() => {
|
|
267
335
|
cleanup();
|
|
268
336
|
root.unmount();
|
|
269
|
-
runtime
|
|
337
|
+
runtime?.dispose();
|
|
338
|
+
if (!runtime)
|
|
339
|
+
gameDebugRegistry?.strip(id);
|
|
270
340
|
restoreRendererConfig();
|
|
271
341
|
reject(new Error('r3f-adapter: onCreated did not fire within 10s — the R3F tree never reached ' +
|
|
272
342
|
'its first commit (mount() fails loudly instead of hanging)'));
|
|
@@ -276,7 +346,7 @@ export function createR3FAdapter(options) {
|
|
|
276
346
|
window.removeEventListener('error', onError);
|
|
277
347
|
};
|
|
278
348
|
window.addEventListener('error', onError);
|
|
279
|
-
void statePromise.then((s) => {
|
|
349
|
+
void Promise.all([statePromise, effectsReady]).then(([s]) => {
|
|
280
350
|
cleanup();
|
|
281
351
|
resolve(s);
|
|
282
352
|
});
|
|
@@ -294,7 +364,7 @@ export function createR3FAdapter(options) {
|
|
|
294
364
|
// Backfill the component runtime's ctx with fiber's real scene/camera
|
|
295
365
|
// (W3 — see the HONESTY NOTE above). This happens before the first
|
|
296
366
|
// `update(dt)` tick, so no component ever observes them missing.
|
|
297
|
-
runtime
|
|
367
|
+
runtime?.setSceneCamera(state.scene, state.camera);
|
|
298
368
|
// THE STORE IS THE TRUTH, NOT THE `onCreated` SNAPSHOT.
|
|
299
369
|
//
|
|
300
370
|
// `state` is one immutable zustand snapshot: fiber's store is
|
|
@@ -329,11 +399,11 @@ export function createR3FAdapter(options) {
|
|
|
329
399
|
// world is the only shape a scaffolded project's three root has, so a
|
|
330
400
|
// door wired only into the classic path is a door no scaffolded project
|
|
331
401
|
// ever gets (issue #1518: `game.state('render.vitals')` answered "no
|
|
332
|
-
// state provider registered" in the field while every other
|
|
333
|
-
// the same world worked).
|
|
402
|
+
// state provider registered" in the field while every other debug
|
|
403
|
+
// reading of the same world worked).
|
|
334
404
|
//
|
|
335
405
|
// The gate is the same three conditions, minus the one that cannot
|
|
336
|
-
// arise: `
|
|
406
|
+
// arise: `devBuildEnabled()` (`../runtime/dev-build.ts`, the ONE owner
|
|
337
407
|
// of "is this a dev context" — a ship build registers nothing and pays
|
|
338
408
|
// nothing), and a `Game` shell (the readings are folded out of that
|
|
339
409
|
// game's profiler frames). "Not headless" needs no term here: a headless
|
|
@@ -351,14 +421,17 @@ export function createR3FAdapter(options) {
|
|
|
351
421
|
// (the fold) and `runtime.dispose()`'s scoped `strip(id)` (the
|
|
352
422
|
// registrations) — the same split the classic adapter documents.
|
|
353
423
|
let renderVitals = null;
|
|
354
|
-
if (host.game &&
|
|
424
|
+
if (host.game && devBuildEnabled()) {
|
|
355
425
|
// Same auto-enable as the classic adapter: the readings are folded out
|
|
356
426
|
// of profiler frames, and the profiler is a flag the editor already
|
|
357
427
|
// sets on play — under the dev gate this is the same cost arriving a
|
|
358
428
|
// little earlier, not a new one.
|
|
359
429
|
host.game.profiler.enabled = true;
|
|
430
|
+
if (!gameDebugRegistry) {
|
|
431
|
+
throw new Error('r3f-adapter: mounted Game has no debug registry.');
|
|
432
|
+
}
|
|
360
433
|
renderVitals = registerRenderVitals({
|
|
361
|
-
registry:
|
|
434
|
+
registry: gameDebugRegistry,
|
|
362
435
|
worldId: id,
|
|
363
436
|
profiler: host.game.profiler,
|
|
364
437
|
scene: live().scene,
|
|
@@ -382,8 +455,12 @@ export function createR3FAdapter(options) {
|
|
|
382
455
|
memory: () => collectRenderMemory(live().scene, host.renderer.info),
|
|
383
456
|
})
|
|
384
457
|
: null;
|
|
458
|
+
// The session debug registry is host instrumentation, not component
|
|
459
|
+
// context. Publishing the existing adapter here lets coverage and
|
|
460
|
+
// editor panels see the same door without wrapping the R3F tree.
|
|
461
|
+
const systemAdapters = runtime?.systemAdapters ?? (gameDebugRegistry ? { debug: gameDebugRegistry.adapter } : {});
|
|
385
462
|
if (renderDebugWiring)
|
|
386
|
-
|
|
463
|
+
systemAdapters.renderDebug = renderDebugWiring.adapter;
|
|
387
464
|
// The engine drives every `useFrame` through the mounted world's
|
|
388
465
|
// `update(dt)` hook, never off a raw host-loop callback. That is the
|
|
389
466
|
// whole pause story: `runFrameImpl` (`runtime/game.ts`) calls
|
|
@@ -411,7 +488,7 @@ export function createR3FAdapter(options) {
|
|
|
411
488
|
// resumed frame as one giant `useFrame` delta — the exact "time passed
|
|
412
489
|
// while frozen" illusion acceptance gate 2 forbids.
|
|
413
490
|
let elapsed = 0;
|
|
414
|
-
/** The
|
|
491
|
+
/** The legacy component ctx camera last backfilled by `update()`. */
|
|
415
492
|
let backfilledCamera = state.camera;
|
|
416
493
|
return {
|
|
417
494
|
kind: 'three',
|
|
@@ -444,7 +521,7 @@ export function createR3FAdapter(options) {
|
|
|
444
521
|
// WebGL2 context exists, `renderDebug` are engine-seeded. Game code
|
|
445
522
|
// adds its own capabilities via `ctx.registerSystemAdapter` exactly
|
|
446
523
|
// as in a classic world.
|
|
447
|
-
systems:
|
|
524
|
+
systems: systemAdapters,
|
|
448
525
|
update(dt) {
|
|
449
526
|
elapsed += dt;
|
|
450
527
|
const current = live();
|
|
@@ -453,14 +530,14 @@ export function createR3FAdapter(options) {
|
|
|
453
530
|
// component reading one while the frame uses the other is the
|
|
454
531
|
// silent kind of wrong. Identity-gated, so this is one comparison
|
|
455
532
|
// per frame in the overwhelmingly common no-swap case.
|
|
456
|
-
if (current.camera !== backfilledCamera) {
|
|
533
|
+
if (runtime && current.camera !== backfilledCamera) {
|
|
457
534
|
backfilledCamera = current.camera;
|
|
458
535
|
runtime.setSceneCamera(current.scene, current.camera);
|
|
459
536
|
}
|
|
460
537
|
// Engine phases FIRST (registered systems mutate transforms),
|
|
461
538
|
// then fiber's advance (useFrame callbacks + the actual render see
|
|
462
539
|
// the fresh state). Both are host-gated: neither runs while frozen.
|
|
463
|
-
systems.run(dt);
|
|
540
|
+
runtime?.systems.run(dt);
|
|
464
541
|
renderDebugWiring?.beforeRender();
|
|
465
542
|
try {
|
|
466
543
|
const profiler = host.game?.profiler;
|
|
@@ -513,7 +590,13 @@ export function createR3FAdapter(options) {
|
|
|
513
590
|
// Reject/restore a pending capture while its renderables still
|
|
514
591
|
// exist, then unmount component effects and strip runtime state.
|
|
515
592
|
renderDebugWiring?.dispose();
|
|
516
|
-
|
|
593
|
+
// The editor audits and disposes the mounted game's window/document realm immediately
|
|
594
|
+
// after `session.stop()`. Fiber's ordinary `unmount()` submits a concurrent reconciler
|
|
595
|
+
// update, so component effect cleanups could still be pending at that boundary and the
|
|
596
|
+
// audit would truthfully report/reclaim listeners the world was about to remove itself.
|
|
597
|
+
// Force the unmount COMMIT (not fiber's deliberately delayed renderer/context disposal)
|
|
598
|
+
// to finish here: a stopped root owns no live component lifecycle beyond this method.
|
|
599
|
+
flushSync(() => root.unmount());
|
|
517
600
|
// The vitals fold owns two `profiler.subscribe` registrations, and
|
|
518
601
|
// `runtime.dispose()`'s `strip(id)` removes the REGISTRATIONS only —
|
|
519
602
|
// this is the one path that ends the subscriptions, exactly as the
|
|
@@ -521,7 +604,28 @@ export function createR3FAdapter(options) {
|
|
|
521
604
|
// subscription can never outlive the door it feeds.
|
|
522
605
|
renderVitals?.dispose();
|
|
523
606
|
renderVitals = null;
|
|
524
|
-
runtime
|
|
607
|
+
runtime?.dispose();
|
|
608
|
+
// The no-context path has no `runtime.dispose()` to carry its scoped
|
|
609
|
+
// strip, so it ends its own registrations here — the same
|
|
610
|
+
// `strip(id)`, at the same moment. That is what ends this world's
|
|
611
|
+
// PROVIDERS AND COMMANDS (the render-vitals door above is the one
|
|
612
|
+
// this path actually registers under `id`); sibling roots are
|
|
613
|
+
// untouched.
|
|
614
|
+
//
|
|
615
|
+
// It does NOT end the input seams `wireGameInputSeams` set, and
|
|
616
|
+
// nothing else does either: `strip` walks providers/commands only
|
|
617
|
+
// (`runtime/debug-registry.ts`), so `virtualInputTargets`/
|
|
618
|
+
// `inputActionsSources`/`inputTraceSources` keep this world's id
|
|
619
|
+
// until a remount of the same id overwrites it. The runtime path has
|
|
620
|
+
// always been identical, and the residue is inert rather than
|
|
621
|
+
// hidden: every one of those closures reads GAME-scoped state
|
|
622
|
+
// (`game.input`, `game.loop.fixedDt`, the game's seed), so a stale
|
|
623
|
+
// entry actuates exactly what a live one would. What it can still do
|
|
624
|
+
// is name a dead world in `DEBUG_INPUT_WORLD_NOT_FOUND`'s registered
|
|
625
|
+
// list. Do not write "the strip clears the input seams" here again
|
|
626
|
+
// without changing `strip` to actually do it.
|
|
627
|
+
if (!runtime)
|
|
628
|
+
gameDebugRegistry?.strip(id);
|
|
525
629
|
restoreRendererConfig();
|
|
526
630
|
},
|
|
527
631
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r3f-root-factory.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-root-factory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAUnE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"r3f-root-factory.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-root-factory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAUnE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAwB/F;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,qBAQ5B,CAAC"}
|
|
@@ -59,6 +59,20 @@ export function resolveR3FEntryAdapter(entryModule, rootId) {
|
|
|
59
59
|
return createR3FAdapter({
|
|
60
60
|
id: rootId,
|
|
61
61
|
content: createElement(mod.default),
|
|
62
|
+
// A default-exported R3F component is an ordinary R3F app. The host
|
|
63
|
+
// controls Fiber's native `frameloop: 'never'` scheduler; the vgai
|
|
64
|
+
// runtime CONTEXT (`useGameContext`, `ctx.systems`) never enters its
|
|
65
|
+
// React tree.
|
|
66
|
+
//
|
|
67
|
+
// This flag governs that context and nothing else. It does NOT govern
|
|
68
|
+
// `WorldProvider`: `useDebugProvider`/`useDebugCommand`/`useWorldState`
|
|
69
|
+
// are the documented door a game declares its own state/commands
|
|
70
|
+
// through, and they must work in the idiomatic shape — which is the
|
|
71
|
+
// ONLY shape `vgai create` scaffolds. `r3f-adapter.tsx` therefore keys
|
|
72
|
+
// that provider off `host.game`, not off this flag; see the comment
|
|
73
|
+
// beside `const game = host.game` there for the measured symptom
|
|
74
|
+
// (`vgai eval 'await game.providers()'` listing only built-ins).
|
|
75
|
+
engineRuntime: false,
|
|
62
76
|
});
|
|
63
77
|
}
|
|
64
78
|
return null;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `@react-three/rapier` physics VISIBLE to the engine's editor/dev seams.
|
|
4
4
|
*
|
|
5
5
|
* WHY IT EXISTS. `SystemAdapters.physics` is what the editor's transform
|
|
6
|
-
* coordination (`freeze → apply → unfreeze`) and the
|
|
6
|
+
* coordination (`freeze → apply → unfreeze`) and the universal
|
|
7
7
|
* "Colliders drawn" instrument (`@engine/dev/instruments`) read. The
|
|
8
8
|
* first-party imperative three root registers one from
|
|
9
9
|
* `../adapter/setup-three-root-adapter.ts`; an R3F world builds no first-party
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
* on the R3F root it is mounted in. It allocates nothing else — no timers, no
|
|
45
45
|
* subscriptions, no per-frame work (see the phase note below), and no Rapier
|
|
46
46
|
* objects: the bodies it edits belong to `<Physics>`.
|
|
47
|
-
* SHARERS: every reader of `game.systemAdapters.physics` — the
|
|
47
|
+
* SHARERS: every reader of `game.systemAdapters.physics` — the
|
|
48
48
|
* colliders instrument, the editor's transform coordination. They read; they
|
|
49
49
|
* never dispose.
|
|
50
50
|
* TEARDOWN: the effect's cleanup, and nothing else — it clears the SAME key it
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
*
|
|
56
56
|
* PHASE ORDERING: none to respect — this component registers pull-only
|
|
57
57
|
* callbacks and runs no per-frame work. Every method it exposes is invoked
|
|
58
|
-
* BETWEEN frames, by an editor gesture or
|
|
58
|
+
* BETWEEN frames, by an editor gesture or an instrument command, never from a
|
|
59
59
|
* phase.
|
|
60
60
|
*/
|
|
61
61
|
export interface RapierPhysicsBridgeProps {
|
|
62
62
|
/**
|
|
63
63
|
* Set the `debug` prop of the SAME `<Physics>` this bridge is mounted in.
|
|
64
|
-
* The
|
|
64
|
+
* The "Colliders drawn" instrument calls it; the world's own state is
|
|
65
65
|
* what `<Physics debug={…}>` reads, so the library's debug rendering is the
|
|
66
66
|
* only thing that ever draws a collider.
|
|
67
67
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `@react-three/rapier` physics VISIBLE to the engine's editor/dev seams.
|
|
4
4
|
*
|
|
5
5
|
* WHY IT EXISTS. `SystemAdapters.physics` is what the editor's transform
|
|
6
|
-
* coordination (`freeze → apply → unfreeze`) and the
|
|
6
|
+
* coordination (`freeze → apply → unfreeze`) and the universal
|
|
7
7
|
* "Colliders drawn" instrument (`@engine/dev/instruments`) read. The
|
|
8
8
|
* first-party imperative three root registers one from
|
|
9
9
|
* `../adapter/setup-three-root-adapter.ts`; an R3F world builds no first-party
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
* on the R3F root it is mounted in. It allocates nothing else — no timers, no
|
|
45
45
|
* subscriptions, no per-frame work (see the phase note below), and no Rapier
|
|
46
46
|
* objects: the bodies it edits belong to `<Physics>`.
|
|
47
|
-
* SHARERS: every reader of `game.systemAdapters.physics` — the
|
|
47
|
+
* SHARERS: every reader of `game.systemAdapters.physics` — the
|
|
48
48
|
* colliders instrument, the editor's transform coordination. They read; they
|
|
49
49
|
* never dispose.
|
|
50
50
|
* TEARDOWN: the effect's cleanup, and nothing else — it clears the SAME key it
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
*
|
|
56
56
|
* PHASE ORDERING: none to respect — this component registers pull-only
|
|
57
57
|
* callbacks and runs no per-frame work. Every method it exposes is invoked
|
|
58
|
-
* BETWEEN frames, by an editor gesture or
|
|
58
|
+
* BETWEEN frames, by an editor gesture or an instrument command, never from a
|
|
59
59
|
* phase.
|
|
60
60
|
*/
|
|
61
61
|
import { useRapier } from '@react-three/rapier';
|
|
@@ -13,12 +13,15 @@
|
|
|
13
13
|
* `ctx.debug = registry.forRoot(id)`, so a component's
|
|
14
14
|
* effect can `ctx.debug.registerStateProvider(...)` and be visible
|
|
15
15
|
* to `vgai eval`/the editor's debug panels — previously a silent no-op.
|
|
16
|
-
* 2. **`ctx.input` is the game-owned `InputManager
|
|
16
|
+
* 2. **`ctx.input` is the game-owned `InputManager` when a Game hosts the
|
|
17
|
+
* root** (`host.game.input` —
|
|
17
18
|
* the same instance the classic adapter uses when hosted), and this
|
|
18
19
|
* module registers the SAME per-world debug-registry seams the classic
|
|
19
20
|
* adapter registers (`setVirtualInputTarget`/`setInputActionsSource`/
|
|
20
21
|
* `setInputTraceSource`), which is what makes `game.input.*` (the bot
|
|
21
22
|
* input doctrine) work instead of throwing `DEBUG_INPUT_UNAVAILABLE`.
|
|
23
|
+
* A bare/foreign mount receives `null`, visibly in the type, rather than
|
|
24
|
+
* a getter that throws later inside a frame callback.
|
|
22
25
|
* The project's input map is loaded through `Game.loadInputMap` (the
|
|
23
26
|
* game-owned, load-once path every root shares) with the SAME default
|
|
24
27
|
* path the classic adapter uses. A missing/unparseable map degrades
|
|
@@ -36,7 +39,7 @@ import type { ThreeHostContext } from '../adapter';
|
|
|
36
39
|
import type { SystemAdapters } from '../adapter/system-adapter';
|
|
37
40
|
import { createSystemRunner } from '../core/system-runner';
|
|
38
41
|
import { type DebugRegistry } from '../runtime/debug-registry';
|
|
39
|
-
import type { GameContext } from '../runtime/types';
|
|
42
|
+
import type { ComponentContextBase, GameContext } from '../runtime/types';
|
|
40
43
|
/** The classic adapter's default input-map path — the conventional location
|
|
41
44
|
* every scaffolded project ships (`public/inputmaps/default.inputmap.json`). */
|
|
42
45
|
export declare const DEFAULT_INPUT_MAP_PATH = "/inputmaps/default.inputmap.json";
|
|
@@ -75,7 +78,10 @@ export declare const DEFAULT_INPUT_MAP_PATH = "/inputmaps/default.inputmap.json"
|
|
|
75
78
|
* exporting `setup(ctx): Promise<GameCleanup>`, which `SetupThreeRootAdapter`
|
|
76
79
|
* mounts with the complete {@link GameContext}.
|
|
77
80
|
*/
|
|
78
|
-
export type R3FGameContext = Pick<GameContext, 'scene' | '
|
|
81
|
+
export type R3FGameContext = ComponentContextBase & Pick<GameContext, 'scene' | 'sceneIndex' | 'assets' | 'clock'> & {
|
|
82
|
+
/** Fiber may install either a perspective or orthographic camera. */
|
|
83
|
+
camera: THREE.Camera;
|
|
84
|
+
};
|
|
79
85
|
export interface R3FRootContextOptions {
|
|
80
86
|
/** World id — provenance for every debug-registry registration (matches the
|
|
81
87
|
* manifest root id by the same convention the classic adapter follows). */
|
|
@@ -122,6 +128,49 @@ export interface R3FRootRuntime {
|
|
|
122
128
|
* react-door registrations are untouched when a Game hosts this world). */
|
|
123
129
|
dispose(): void;
|
|
124
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* The GAME-SCOPED input wiring one three root owns — and the half that has
|
|
133
|
+
* nothing to do with the vgai runtime context.
|
|
134
|
+
*
|
|
135
|
+
* Two things happen here, both of them HOST work performed from outside the
|
|
136
|
+
* world's own tree:
|
|
137
|
+
*
|
|
138
|
+
* 1. the project's input map is loaded through `Game.loadInputMap` (game-owned,
|
|
139
|
+
* load-once), so the actions the project declared exist;
|
|
140
|
+
* 2. this root's seams are registered on the game-scoped debug registry
|
|
141
|
+
* (`setVirtualInputTarget`/`setInputActionsSource`/`setInputTraceSource`),
|
|
142
|
+
* which is what makes `game.input.hold/tap/...` (the bot/`vgai eval` input
|
|
143
|
+
* doctrine) and the built-in `input.actions`/`input.trace` providers
|
|
144
|
+
* resolve to this world instead of throwing `DEBUG_INPUT_UNAVAILABLE`.
|
|
145
|
+
*
|
|
146
|
+
* It is called on BOTH three-root paths, and that is the point: a world that
|
|
147
|
+
* mounts as a default-exported component receives no vgai runtime context
|
|
148
|
+
* (`engineRuntime: false` — see `r3f-root-factory.tsx`), but "no context in the
|
|
149
|
+
* tree" was never meant to say "the host does not wire this game's input". It
|
|
150
|
+
* was read that way, and the cost was measured on a fresh scaffold: the
|
|
151
|
+
* declared map never loaded and every `game.input.*` door threw, so the QA
|
|
152
|
+
* bot, autoplay routes and `vgai eval` could not drive the ONE world shape
|
|
153
|
+
* `vgai create` produces. Same split, same reasoning, as `WorldProvider`
|
|
154
|
+
* riding `host.game` rather than the runtime (see `r3f-adapter.tsx`).
|
|
155
|
+
*
|
|
156
|
+
* `optionalInputMap` is the CONVENTIONAL-PATH probe used when the project
|
|
157
|
+
* never named a map: an absent file is the ordinary state of a brand-new
|
|
158
|
+
* project, so it resolves quietly instead of printing an error on every boot.
|
|
159
|
+
* A map that exists and fails to parse is as loud as ever.
|
|
160
|
+
*
|
|
161
|
+
* LIFETIME, honestly: `registry.strip(id)` runs on the mount's dispose (both
|
|
162
|
+
* paths), but it walks providers/commands only — the three seams set here
|
|
163
|
+
* survive it, keyed by this world's id, until a remount of the same id
|
|
164
|
+
* overwrites them. That residue is inert rather than hidden: every closure
|
|
165
|
+
* below reads GAME-scoped state (`game.input`, `game.loop.fixedDt`, the game's
|
|
166
|
+
* seed), so a stale entry actuates exactly what a live one would. See the
|
|
167
|
+
* dispose comment in `r3f-adapter.tsx` for the full accounting.
|
|
168
|
+
*/
|
|
169
|
+
export declare function wireGameInputSeams(host: ThreeHostContext, registry: DebugRegistry, options: {
|
|
170
|
+
readonly id: string;
|
|
171
|
+
readonly inputMapPath?: string | null | undefined;
|
|
172
|
+
readonly optionalInputMap?: boolean | undefined;
|
|
173
|
+
}): Promise<void>;
|
|
125
174
|
/**
|
|
126
175
|
* Build the engine runtime for one R3F world from a `ThreeHostContext` — the same
|
|
127
176
|
* wiring, at the same layer, as the classic `SetupThreeRootAdapter.mount()`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world-context.d.ts","sourceRoot":"","sources":["../../src/world3d-react/world-context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"world-context.d.ts","sourceRoot":"","sources":["../../src/world3d-react/world-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCK;AAEL,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE1E;iFACiF;AACjF,eAAO,MAAM,sBAAsB,qCAAqC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAC/C,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG;IAC/D,qEAAqE;IACrE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;CACtB,CAAC;AAEJ,MAAM,WAAW,qBAAqB;IACpC;gFAC4E;IAC5E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACnD;AAED;+EAC+E;AAC/E,MAAM,WAAW,cAAc;IAC7B;6EACyE;IACzE,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;IACxD;;mFAE+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC;;;;;;yDAMqD;IACrD,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC;qEACiE;IACjE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC;;;4DAGwD;IACxD,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IAC/D;;gFAE4E;IAC5E,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE;IACP,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjD,GACA,OAAO,CAAC,IAAI,CAAC,CAiDf;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,qBAAqB,GAC7B,cAAc,CAqGhB"}
|