@vgai/engine 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +35 -0
- package/package.json +55 -0
- package/src/adapter/authoring.ts +402 -0
- package/src/adapter/colyseus-networking-adapter.ts +72 -0
- package/src/adapter/first-party-systems.ts +103 -0
- package/src/adapter/game-adapter.ts +151 -0
- package/src/adapter/host-context.ts +77 -0
- package/src/adapter/index.ts +85 -0
- package/src/adapter/ingest/game-contract.ts +59 -0
- package/src/adapter/ingest/overlay-applier.ts +207 -0
- package/src/adapter/ingest/overlay-apply.ts +124 -0
- package/src/adapter/ingest/overlay-file.ts +126 -0
- package/src/adapter/ingest/overlay-report.ts +176 -0
- package/src/adapter/ingest/scene-capture.ts +307 -0
- package/src/adapter/ingest/upstream-pin.ts +52 -0
- package/src/adapter/loop-gate-report.ts +54 -0
- package/src/adapter/rapier-physics-adapter.ts +56 -0
- package/src/adapter/system-adapter.ts +154 -0
- package/src/adapter/transform.ts +18 -0
- package/src/adapter/vgai-scene-game-adapter.ts +886 -0
- package/src/adapter/world-kind.ts +34 -0
- package/src/ai/navigation.ts +164 -0
- package/src/animation/anim-graph-types.ts +56 -0
- package/src/animation/anim-graph.ts +406 -0
- package/src/animation/anim-system.ts +28 -0
- package/src/animation/blend-node.ts +119 -0
- package/src/animation/property-track.ts +178 -0
- package/src/animation/schema.ts +204 -0
- package/src/assets.ts +80 -0
- package/src/audio/ambient.ts +300 -0
- package/src/audio/impacts.ts +212 -0
- package/src/audio/index.ts +7 -0
- package/src/audio/movement.ts +140 -0
- package/src/audio/musical.ts +200 -0
- package/src/audio/ui-sounds.ts +171 -0
- package/src/audio/vehicle.ts +235 -0
- package/src/audio/weapons.ts +152 -0
- package/src/core/game-loop.ts +127 -0
- package/src/core/system-runner.ts +298 -0
- package/src/core/types.ts +58 -0
- package/src/dev/console-bridge.ts +83 -0
- package/src/dev/debug-draw.ts +80 -0
- package/src/dev/logger.ts +119 -0
- package/src/ecs/component-manager.ts +748 -0
- package/src/ecs/game-component.ts +147 -0
- package/src/ecs/hmr-swap-report.ts +65 -0
- package/src/input/input-manager.ts +439 -0
- package/src/input/input-types.ts +19 -0
- package/src/input/schema.ts +129 -0
- package/src/loader.ts +70 -0
- package/src/manifest/index.ts +24 -0
- package/src/manifest/load-file.ts +16 -0
- package/src/manifest/load.ts +378 -0
- package/src/manifest/schema.ts +375 -0
- package/src/physics/collision-system.ts +76 -0
- package/src/physics/physics-registry.ts +83 -0
- package/src/physics/transform-writer.ts +41 -0
- package/src/physics/trigger-dispatch.ts +97 -0
- package/src/react/game-state.tsx +172 -0
- package/src/render/auto-batcher.ts +169 -0
- package/src/render/render-batch-system.ts +268 -0
- package/src/render/render-features.ts +146 -0
- package/src/render/render-settings.ts +72 -0
- package/src/runtime/create-runtime.ts +1152 -0
- package/src/runtime/frame-selector-cache.ts +81 -0
- package/src/runtime/game.ts +1003 -0
- package/src/runtime/input-router.ts +213 -0
- package/src/runtime/mount-game.ts +269 -0
- package/src/runtime/mount-manifest.ts +361 -0
- package/src/runtime/scene-ui-bridge.ts +86 -0
- package/src/runtime/scene-ui-data.ts +119 -0
- package/src/runtime/state-bridge.ts +79 -0
- package/src/runtime/types.ts +196 -0
- package/src/scene/asset-loaders.ts +195 -0
- package/src/scene/asset-paths.ts +123 -0
- package/src/scene/asset-registry.ts +67 -0
- package/src/scene/collider-dimensions.ts +125 -0
- package/src/scene/component-registry.ts +40 -0
- package/src/scene/defaults.ts +164 -0
- package/src/scene/geometries/index.ts +7 -0
- package/src/scene/geometries/terrain.ts +42 -0
- package/src/scene/geometry-registry.ts +42 -0
- package/src/scene/instance-registry.ts +84 -0
- package/src/scene/instancers/grid.ts +38 -0
- package/src/scene/instancers/index.ts +7 -0
- package/src/scene/light-camera-factory.ts +97 -0
- package/src/scene/material-factory.ts +211 -0
- package/src/scene/material-registry.ts +73 -0
- package/src/scene/materials/index.ts +7 -0
- package/src/scene/materials/water.ts +56 -0
- package/src/scene/parse.ts +71 -0
- package/src/scene/particles-factory.ts +383 -0
- package/src/scene/scene-apply.ts +356 -0
- package/src/scene/scene-diff-schema.ts +115 -0
- package/src/scene/scene-diff-types.ts +29 -0
- package/src/scene/scene-loader.ts +1533 -0
- package/src/scene/scene-query.ts +63 -0
- package/src/scene/scene-types.ts +34 -0
- package/src/scene/scene-version.ts +40 -0
- package/src/scene/schema/animation.ts +95 -0
- package/src/scene/schema/audio.ts +25 -0
- package/src/scene/schema/camera.ts +21 -0
- package/src/scene/schema/collider.ts +69 -0
- package/src/scene/schema/entity-ref.ts +78 -0
- package/src/scene/schema/entity.ts +169 -0
- package/src/scene/schema/environment.ts +384 -0
- package/src/scene/schema/index.ts +95 -0
- package/src/scene/schema/instances.ts +35 -0
- package/src/scene/schema/joint.ts +26 -0
- package/src/scene/schema/light.ts +38 -0
- package/src/scene/schema/material.ts +113 -0
- package/src/scene/schema/mesh.ts +108 -0
- package/src/scene/schema/particles.ts +398 -0
- package/src/scene/schema/physics.ts +49 -0
- package/src/scene/schema/scene-file.ts +299 -0
- package/src/scene/schema/shadow.ts +24 -0
- package/src/scene/schema/spline.ts +21 -0
- package/src/scene/schema/tuples.ts +21 -0
- package/src/scene/schema/ui.ts +602 -0
- package/src/scene/user-data.ts +203 -0
- package/src/setup/setup-audio.ts +60 -0
- package/src/setup/setup-particles.ts +23 -0
- package/src/setup/setup-physics.ts +67 -0
- package/src/setup/setup-renderer.ts +529 -0
- package/src/types-n8ao.d.ts +37 -0
- package/src/types-realism-effects.d.ts +61 -0
- package/src/world2d/authoring-2d.ts +208 -0
- package/src/world2d/capture-to-scene2d.ts +52 -0
- package/src/world2d/collision-2d.ts +106 -0
- package/src/world2d/components-2d.ts +86 -0
- package/src/world2d/index.ts +66 -0
- package/src/world2d/ingest-iframe-2d.ts +255 -0
- package/src/world2d/ingest2d.ts +131 -0
- package/src/world2d/physics2d-registry.ts +49 -0
- package/src/world2d/pixi-game-adapter.ts +325 -0
- package/src/world2d/pixi-surface.ts +78 -0
- package/src/world2d/scene-capture-2d.ts +117 -0
- package/src/world2d/scene2d-loader.ts +308 -0
- package/src/world2d/schema/entity2d.ts +145 -0
- package/src/world2d/schema/physics2d.ts +53 -0
- package/src/world2d/schema/sprite.ts +71 -0
- package/src/world2d/schema/tilemap.ts +22 -0
- package/src/world2d/schema/tuples2d.ts +25 -0
- package/src/world2d/system-adapters-2d.ts +49 -0
- package/src/world2d/transform-writer-2d.ts +24 -0
- package/src/world2d/types.ts +55 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scene capture — the core primitive of unmodified-game ingestion.
|
|
3
|
+
*
|
|
4
|
+
* An external three.js game owns its own `WebGLRenderer`, `Scene`, camera, and
|
|
5
|
+
* render loop. To let the editor inspect/edit that live scene WITHOUT touching
|
|
6
|
+
* the game's code, we need a handle to the game's `Scene`+camera the moment it
|
|
7
|
+
* first renders. The robust way to obtain it is an **accessor trap** on
|
|
8
|
+
* `WebGLRenderer.prototype.render`:
|
|
9
|
+
*
|
|
10
|
+
* - `WebGLRenderer` assigns `this.render` as an OWN instance property inside
|
|
11
|
+
* its constructor (not on the prototype), and `THREE.WebGLRenderer` is a
|
|
12
|
+
* read-only module export (can't subclass-swap it). A naive "wrap render"
|
|
13
|
+
* hook therefore captures nothing.
|
|
14
|
+
* - Installing a getter/setter for `render` on the PROTOTYPE means the
|
|
15
|
+
* constructor's `this.render = realFn` hits our setter (the instance has no
|
|
16
|
+
* own `render` yet), we stash the real fn, and our getter returns a wrapper
|
|
17
|
+
* that captures `(scene, camera, renderer)` on the first real frame.
|
|
18
|
+
*
|
|
19
|
+
* This is the hardened, typed form of the `ingest-study` spike
|
|
20
|
+
* (`docs/ingest-study-spike/vgai-ingest-adapter.js`), proven against an
|
|
21
|
+
* unmodified `three.js/examples/games_fps` game.
|
|
22
|
+
*
|
|
23
|
+
* CRITICAL: the trap must be installed on the SAME `three` module instance the
|
|
24
|
+
* game uses. In a bundler/dev-server that dedupes `three` (one `node_modules/
|
|
25
|
+
* three`), an external ESM game's `import 'three'` resolves to that one instance,
|
|
26
|
+
* so passing the host's `THREE` here traps the game's renderer too. A game that
|
|
27
|
+
* bundles its own copy of `three` cannot be captured this way (see
|
|
28
|
+
* `docs/UNMODIFIED-GAME-INGESTION-STUDY.md` §4A — the module-identity gatekeeper).
|
|
29
|
+
*
|
|
30
|
+
* Wave 17 (`docs/WAVE17-F13-COMPOSER-RESIZE-FIX-DESIGN.md`) adds an OPTIONAL,
|
|
31
|
+
* ADDITIVE composer capture: a game rendering through its own three.js addon
|
|
32
|
+
* `EffectComposer` (`three/examples/jsm/postprocessing/EffectComposer.js`)
|
|
33
|
+
* still trips the `render` trap above (its `RenderPass` calls
|
|
34
|
+
* `renderer.render(scene,camera)` internally), but the renderer holds no
|
|
35
|
+
* reference back to the composer, so the host previously could not resize the
|
|
36
|
+
* composer's own (intentionally non-1:1, progressively-downsampled — see
|
|
37
|
+
* `UnrealBloomPass`) render targets when the host resizes the game's pane.
|
|
38
|
+
* Unlike `WebGLRenderer`, `EffectComposer` is a plain ES class whose methods
|
|
39
|
+
* (including `render`) live on the PROTOTYPE, not assigned as own instance
|
|
40
|
+
* properties in the constructor — so a direct method-wrapper (no getter/
|
|
41
|
+
* setter indirection) on `EffectComposer.prototype.render` is sufficient: it
|
|
42
|
+
* calls through to the real `render`, then — AFTER that call, so any nested
|
|
43
|
+
* `renderer.render()` the pass makes has already hit the trap above and set
|
|
44
|
+
* `captured` — records `this` (the composer instance) if its `.renderer` is
|
|
45
|
+
* the captured one. This is deduped/shared-trappable for the same reason
|
|
46
|
+
* `WebGLRenderer` is: `EffectComposer.js` is a FILE inside the same `three`
|
|
47
|
+
* package tree Vite's `resolve.dedupe: ['three', …]` already collapses to one
|
|
48
|
+
* instance — not a separate package with its own dedupe question. Proven
|
|
49
|
+
* live against the `bloom-composer` fixture
|
|
50
|
+
* (`docs/f13-bloom-composer-proof/record-fixed.mjs`).
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
import type * as THREE from 'three';
|
|
54
|
+
|
|
55
|
+
/** A live runtime captured from an external game on its first rendered frame. */
|
|
56
|
+
export interface CapturedRuntime {
|
|
57
|
+
scene: THREE.Scene;
|
|
58
|
+
camera: THREE.Camera;
|
|
59
|
+
renderer: THREE.WebGLRenderer;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Handle returned by {@link installSceneCapture}. */
|
|
63
|
+
export interface SceneCaptureHandle {
|
|
64
|
+
/** The captured runtime, or null until the game renders its first frame. */
|
|
65
|
+
readonly captured: CapturedRuntime | null;
|
|
66
|
+
/** Resolve once a scene+camera is captured (rejects on timeout). */
|
|
67
|
+
waitForCapture(timeoutMs?: number): Promise<CapturedRuntime>;
|
|
68
|
+
/** Total `render()` calls observed through the trap (a liveness signal). */
|
|
69
|
+
getDrawCount(): number;
|
|
70
|
+
/** The game's last (non-null) `setAnimationLoop` callback for a renderer, so the
|
|
71
|
+
* host can pause (set null) and resume (re-set it) the game's own loop. */
|
|
72
|
+
getAnimationLoop(renderer: THREE.WebGLRenderer): ((time: number) => void) | null;
|
|
73
|
+
/**
|
|
74
|
+
* Wave 17 (D-C3): resize every captured `EffectComposer` that renders
|
|
75
|
+
* through the captured renderer to `w`×`h`, matching its pixel ratio to
|
|
76
|
+
* `renderer.getPixelRatio()` — the composer tracks whatever DPR policy the
|
|
77
|
+
* host already applies to the renderer; no separate knob. A no-op when no
|
|
78
|
+
* `effectComposerCtor` was passed to {@link installSceneCapture} (or no
|
|
79
|
+
* composer of that ctor has rendered through the captured renderer yet) —
|
|
80
|
+
* a non-composer game is unaffected.
|
|
81
|
+
*/
|
|
82
|
+
resizeComposers(w: number, h: number): void;
|
|
83
|
+
/** Remove the trap and restore the captured renderer's real `render`. */
|
|
84
|
+
uninstall(): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Minimal structural type for the bits of the THREE namespace we touch, so this
|
|
88
|
+
// module never imports a concrete `three` (it must trap the CALLER's instance).
|
|
89
|
+
interface ThreeLike {
|
|
90
|
+
WebGLRenderer: { prototype: Record<string, unknown> };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Minimal structural type for the bits of an `EffectComposer` instance we
|
|
94
|
+
// touch. This module never imports a concrete `three/examples/jsm/…` addon
|
|
95
|
+
// either — the caller passes the SAME class its ingested game imports, so the
|
|
96
|
+
// trap lands on the instance the game actually constructs.
|
|
97
|
+
interface ComposerLike {
|
|
98
|
+
renderer?: unknown;
|
|
99
|
+
setSize(width: number, height: number): void;
|
|
100
|
+
setPixelRatio(pixelRatio: number): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface EffectComposerCtorLike {
|
|
104
|
+
prototype: { render?: (...args: unknown[]) => unknown };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Install the render accessor trap on `threeNamespace.WebGLRenderer.prototype`.
|
|
109
|
+
* Pass the host's `three` module so the game (which shares it) is trapped.
|
|
110
|
+
*
|
|
111
|
+
* `effectComposerCtor` is OPTIONAL (Wave 17, D-C2): pass the host's
|
|
112
|
+
* `EffectComposer` class (`three/examples/jsm/postprocessing/EffectComposer.js`)
|
|
113
|
+
* to also trap composer construction/rendering on that shared addon, so
|
|
114
|
+
* `resizeComposers()` can reach it. Omitting it (or a game never constructing
|
|
115
|
+
* one) leaves capture byte-identical to before this wave.
|
|
116
|
+
*
|
|
117
|
+
* Idempotent per call site is NOT guaranteed — install once per ingest session
|
|
118
|
+
* and `uninstall()` on teardown.
|
|
119
|
+
*/
|
|
120
|
+
export function installSceneCapture(
|
|
121
|
+
threeNamespace: unknown,
|
|
122
|
+
effectComposerCtor?: unknown,
|
|
123
|
+
): SceneCaptureHandle {
|
|
124
|
+
const THREE_NS = threeNamespace as ThreeLike;
|
|
125
|
+
const proto = THREE_NS.WebGLRenderer.prototype;
|
|
126
|
+
|
|
127
|
+
// Stash the real render fn per-instance under a unique symbol so multiple
|
|
128
|
+
// renderers (editor's + game's) never collide.
|
|
129
|
+
const REAL = Symbol('vgai.realRender');
|
|
130
|
+
|
|
131
|
+
let captured: CapturedRuntime | null = null;
|
|
132
|
+
let drawCount = 0;
|
|
133
|
+
const waiters: Array<(rt: CapturedRuntime) => void> = [];
|
|
134
|
+
|
|
135
|
+
// Preserve any descriptor already on the prototype so uninstall can restore it.
|
|
136
|
+
const priorDescriptor = Object.getOwnPropertyDescriptor(proto, 'render');
|
|
137
|
+
|
|
138
|
+
// Trap setAnimationLoop to record each renderer's game loop callback, so the host
|
|
139
|
+
// can freeze (set null) and resume (re-set) the game's own rAF for stable editing.
|
|
140
|
+
// CRITICAL: like `render`, WebGLRenderer assigns `this.setAnimationLoop` as an OWN
|
|
141
|
+
// instance property in its constructor — NOT on the prototype. A naive value-wrapper
|
|
142
|
+
// on the prototype is therefore shadowed by the instance's own property and never
|
|
143
|
+
// runs (resume could never recover the callback). So we mirror the `render` trap: a
|
|
144
|
+
// prototype getter/setter. The constructor's `this.setAnimationLoop = realFn` hits
|
|
145
|
+
// our SETTER (the instance has no own property yet) and we stash realFn per-instance;
|
|
146
|
+
// the GETTER returns a wrapper that records each non-null callback before forwarding.
|
|
147
|
+
const REAL_SAL = Symbol('vgai.realSetAnimationLoop');
|
|
148
|
+
const loopCallbacks = new WeakMap<object, (time: number) => void>();
|
|
149
|
+
const priorSAL = Object.getOwnPropertyDescriptor(proto, 'setAnimationLoop');
|
|
150
|
+
Object.defineProperty(proto, 'setAnimationLoop', {
|
|
151
|
+
configurable: true,
|
|
152
|
+
set(this: Record<symbol, unknown>, fn: unknown) {
|
|
153
|
+
this[REAL_SAL] = fn;
|
|
154
|
+
},
|
|
155
|
+
get(this: Record<symbol, unknown>) {
|
|
156
|
+
const self = this;
|
|
157
|
+
return function setAnimationLoop(this: unknown, cb: unknown) {
|
|
158
|
+
if (cb) loopCallbacks.set(self as object, cb as (time: number) => void);
|
|
159
|
+
const real = self[REAL_SAL];
|
|
160
|
+
return typeof real === 'function'
|
|
161
|
+
? (real as (...a: unknown[]) => unknown).call(self, cb)
|
|
162
|
+
: undefined;
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
Object.defineProperty(proto, 'render', {
|
|
168
|
+
configurable: true,
|
|
169
|
+
set(this: Record<symbol, unknown>, fn: unknown) {
|
|
170
|
+
this[REAL] = fn;
|
|
171
|
+
},
|
|
172
|
+
get(this: Record<symbol, unknown>) {
|
|
173
|
+
const self = this;
|
|
174
|
+
return function render(this: unknown, ...args: unknown[]) {
|
|
175
|
+
const [scene, camera] = args;
|
|
176
|
+
drawCount++;
|
|
177
|
+
if (!captured && scene && (scene as { isScene?: boolean }).isScene) {
|
|
178
|
+
captured = {
|
|
179
|
+
scene: scene as THREE.Scene,
|
|
180
|
+
camera: camera as THREE.Camera,
|
|
181
|
+
renderer: self as unknown as THREE.WebGLRenderer,
|
|
182
|
+
};
|
|
183
|
+
for (const resolve of waiters.splice(0)) resolve(captured);
|
|
184
|
+
}
|
|
185
|
+
// Forward to the renderer's real render with the original args.
|
|
186
|
+
return (self[REAL] as (...a: unknown[]) => unknown).apply(self, args);
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// ---- Wave 17 (D-C2): additive composer capture, only when a composer ctor
|
|
192
|
+
// was passed. `EffectComposer` methods (including `render`) live on the
|
|
193
|
+
// PROTOTYPE (a plain ES class — the constructor never does `this.render =
|
|
194
|
+
// …`), so a direct method-wrapper suffices — no getter/setter indirection
|
|
195
|
+
// like the `render`/`setAnimationLoop` traps above need. ----
|
|
196
|
+
const composers = new Set<ComposerLike>();
|
|
197
|
+
let composerProto: Record<string, unknown> | undefined;
|
|
198
|
+
let priorComposerRender: ((...a: unknown[]) => unknown) | undefined;
|
|
199
|
+
if (effectComposerCtor) {
|
|
200
|
+
const EC = effectComposerCtor as EffectComposerCtorLike;
|
|
201
|
+
composerProto = EC.prototype as unknown as Record<string, unknown>;
|
|
202
|
+
priorComposerRender = composerProto['render'] as (...a: unknown[]) => unknown;
|
|
203
|
+
composerProto['render'] = function (this: ComposerLike, ...args: unknown[]) {
|
|
204
|
+
// Call the real render FIRST: a composer's RenderPass calls
|
|
205
|
+
// `renderer.render(scene,camera)` internally, which is what actually
|
|
206
|
+
// sets `captured` (above) on the game's first frame. Checking after
|
|
207
|
+
// ensures a composer's very first render is still collected.
|
|
208
|
+
const result = priorComposerRender?.apply(this, args);
|
|
209
|
+
if (captured && this.renderer === captured.renderer) {
|
|
210
|
+
composers.add(this);
|
|
211
|
+
}
|
|
212
|
+
return result;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Extracted so `uninstall()`'s own cognitive complexity doesn't grow with
|
|
217
|
+
// this additive Wave-17 restore step (biome's noExcessiveCognitiveComplexity).
|
|
218
|
+
function restoreComposerTrap() {
|
|
219
|
+
if (!composerProto) return;
|
|
220
|
+
if (priorComposerRender) composerProto['render'] = priorComposerRender;
|
|
221
|
+
else delete composerProto['render'];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
get captured() {
|
|
226
|
+
return captured;
|
|
227
|
+
},
|
|
228
|
+
getDrawCount() {
|
|
229
|
+
return drawCount;
|
|
230
|
+
},
|
|
231
|
+
getAnimationLoop(renderer: THREE.WebGLRenderer) {
|
|
232
|
+
return loopCallbacks.get(renderer as unknown as object) ?? null;
|
|
233
|
+
},
|
|
234
|
+
resizeComposers(w: number, h: number) {
|
|
235
|
+
// No composer ctor passed (or none constructed yet) → no-op, and never
|
|
236
|
+
// touches `renderer.getPixelRatio()` — a non-composer game's captured
|
|
237
|
+
// renderer need not even expose that method for this to stay a no-op.
|
|
238
|
+
if (!captured || composers.size === 0) return;
|
|
239
|
+
const pixelRatio = captured.renderer.getPixelRatio();
|
|
240
|
+
for (const composer of composers) {
|
|
241
|
+
composer.setSize(w, h);
|
|
242
|
+
composer.setPixelRatio(pixelRatio);
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
waitForCapture(timeoutMs = 10_000) {
|
|
246
|
+
if (captured) return Promise.resolve(captured);
|
|
247
|
+
return new Promise<CapturedRuntime>((resolve, reject) => {
|
|
248
|
+
const timer = setTimeout(() => {
|
|
249
|
+
const i = waiters.indexOf(wrapped);
|
|
250
|
+
if (i >= 0) waiters.splice(i, 1);
|
|
251
|
+
reject(
|
|
252
|
+
new Error(
|
|
253
|
+
`Scene capture timed out after ${timeoutMs}ms — the game never rendered, ` +
|
|
254
|
+
`or it bundles its own (un-shared) copy of three.`,
|
|
255
|
+
),
|
|
256
|
+
);
|
|
257
|
+
}, timeoutMs);
|
|
258
|
+
const wrapped = (rt: CapturedRuntime) => {
|
|
259
|
+
clearTimeout(timer);
|
|
260
|
+
resolve(rt);
|
|
261
|
+
};
|
|
262
|
+
waiters.push(wrapped);
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
uninstall() {
|
|
266
|
+
// Restore the captured renderer's real render as an OWN property so its
|
|
267
|
+
// loop keeps working after the prototype trap is removed.
|
|
268
|
+
if (captured) {
|
|
269
|
+
const r = captured.renderer as unknown as Record<symbol, unknown>;
|
|
270
|
+
const real = r[REAL];
|
|
271
|
+
if (typeof real === 'function') {
|
|
272
|
+
Object.defineProperty(captured.renderer, 'render', {
|
|
273
|
+
configurable: true,
|
|
274
|
+
writable: true,
|
|
275
|
+
value: real,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (priorDescriptor) {
|
|
280
|
+
Object.defineProperty(proto, 'render', priorDescriptor);
|
|
281
|
+
} else {
|
|
282
|
+
delete proto['render'];
|
|
283
|
+
}
|
|
284
|
+
// Restore the captured renderer's real setAnimationLoop as an OWN property (the
|
|
285
|
+
// prototype getter/setter intercepted the constructor's assignment, so the
|
|
286
|
+
// instance has none) — else removing the prototype trap would leave it without
|
|
287
|
+
// setAnimationLoop and freeze its loop.
|
|
288
|
+
if (captured) {
|
|
289
|
+
const r = captured.renderer as unknown as Record<symbol, unknown>;
|
|
290
|
+
const realSal = r[REAL_SAL];
|
|
291
|
+
if (typeof realSal === 'function') {
|
|
292
|
+
Object.defineProperty(captured.renderer, 'setAnimationLoop', {
|
|
293
|
+
configurable: true,
|
|
294
|
+
writable: true,
|
|
295
|
+
value: realSal,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (priorSAL) Object.defineProperty(proto, 'setAnimationLoop', priorSAL);
|
|
300
|
+
else delete proto['setAnimationLoop'];
|
|
301
|
+
// Wave 17: fully restore the composer addon's `render` (a plain
|
|
302
|
+
// prototype method — no per-instance own-property to restore, unlike
|
|
303
|
+
// the renderer/loop traps above).
|
|
304
|
+
restoreComposerTrap();
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upstream-pin extraction — R5 (docs/MASTER-ARCHITECTURE-REVIEW.md §4(c)/
|
|
3
|
+
* §7.1 item 9): the fix for the overlay identity gap the structural-id +
|
|
4
|
+
* `authoredAgainst.gameVersion` scheme (T7.7/D9) does not close. A re-vendor
|
|
5
|
+
* of a vendored upstream game that keeps a slot's shape (index + three.js
|
|
6
|
+
* type + name unchanged) reapplies a saved overlay onto a semantically
|
|
7
|
+
* different object with `applied: 1, orphanedIds: []` — silent wrong-meaning
|
|
8
|
+
* success — because `authoredAgainst.gameVersion` is the MANIFEST's own
|
|
9
|
+
* `version` (hand-set by whoever wrote `vgai.game.json`, e.g. every
|
|
10
|
+
* `public/ingest/*` vendored game ships `"version": "0.1.0"` regardless of
|
|
11
|
+
* which upstream commit it vendors — see `public/ingest/{tanks,racing-game,
|
|
12
|
+
* simcity}/vgai.game.json`), never tied to the thing that actually changes on
|
|
13
|
+
* a re-vendor: the `UPSTREAM.md` pin.
|
|
14
|
+
*
|
|
15
|
+
* This module is the pure, dependency-free half (parse text -> pin, or
|
|
16
|
+
* `null`): NO file I/O here, so it is usable from any context (editor
|
|
17
|
+
* save/apply-time hooks over a fetched `/UPSTREAM.md`, a future Node-side
|
|
18
|
+
* CLI check, tests). READ-ONLY by construction — it has no writer; this
|
|
19
|
+
* codebase never generates or edits an `UPSTREAM.md` (the anti-shim rule:
|
|
20
|
+
* adapters never fabricate first-party data, and a game's own vendoring
|
|
21
|
+
* provenance is exactly that).
|
|
22
|
+
*
|
|
23
|
+
* Format (established convention, not invented here — see every
|
|
24
|
+
* `public/ingest/*\/UPSTREAM.md`'s `## Upstream` section, e.g.
|
|
25
|
+
* `public/ingest/tanks/UPSTREAM.md`):
|
|
26
|
+
*
|
|
27
|
+
* ## Upstream
|
|
28
|
+
*
|
|
29
|
+
* - Repo: https://github.com/colyseus/realtime-tanks-demo
|
|
30
|
+
* - Commit: **`6339493130b4b1d4d28f0f52d17b2fba738c7d47`**
|
|
31
|
+
*
|
|
32
|
+
* i.e. a Markdown bullet whose label is `Commit:` and whose value is a bold,
|
|
33
|
+
* backtick-code full (or abbreviated) git SHA. Every vendored game in this
|
|
34
|
+
* repo (`tanks`, `racing-game`, `simcity`) follows this exact shape.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/** Matches `- Commit: **\`<sha>\`**` (any amount of internal whitespace, case-insensitive hex). */
|
|
38
|
+
const COMMIT_BULLET_RE = /-\s*Commit:\s*\*\*`([0-9a-fA-F]{7,40})`\*\*/;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Extract the pinned upstream commit hash from a vendored game's
|
|
42
|
+
* `UPSTREAM.md` prose, or `null` if the file doesn't follow the convention
|
|
43
|
+
* (or wasn't found — the caller decides what a missing file means; this
|
|
44
|
+
* function only parses text it's handed). Never throws — an unparseable
|
|
45
|
+
* document is an honest `null`, not an error (anti-shim: no guessing, no
|
|
46
|
+
* fabricating a pin from a game folder that doesn't declare one, e.g. an
|
|
47
|
+
* externally-authored non-vendored project opened via the CLI-on-folder
|
|
48
|
+
* route).
|
|
49
|
+
*/
|
|
50
|
+
export function extractUpstreamPin(markdown: string): string | null {
|
|
51
|
+
return COMMIT_BULLET_RE.exec(markdown)?.[1] ?? null;
|
|
52
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability-gate shortfall reporting (D10, T7.6) — the honesty half of the
|
|
3
|
+
* play-control contract. `docs/CAPABILITY-TIERS.md` §(d) draws the `loop` axis
|
|
4
|
+
* (`gated | self-driven`) as independent of capability tier: a `self-driven`
|
|
5
|
+
* world (an ingested game driving its own rAF/ticker) pauses for real ONLY if
|
|
6
|
+
* its adapter implements an explicit loop-gate capability
|
|
7
|
+
* (`MountedWorldBase.setPaused`/`step`) — otherwise it "honestly reports so"
|
|
8
|
+
* rather than a silent no-op (the D5/COMPOSITION-DESIGN.md §5.2 finding: gating
|
|
9
|
+
* a raw-rAF loop from outside was demonstrated and REJECTED). The audio seam
|
|
10
|
+
* (`SystemAdapters.AudioAdapter`) has the identical shape: absent or unable to
|
|
11
|
+
* silence a world's audio on pause must report, not pretend.
|
|
12
|
+
*
|
|
13
|
+
* Pure compute + message-formatting, same split as `achieved-tier.ts`
|
|
14
|
+
* (`packages/editor/src/achieved-tier.ts`) — callers own the actual
|
|
15
|
+
* `console.warn`/`editorConsole.warn` call; this module never logs.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Greppable prefix for a loop-gate shortfall (pause requested, world's loop
|
|
19
|
+
* could not actually be gated). */
|
|
20
|
+
export const LOOP_GATE_PREFIX = 'loop-gate';
|
|
21
|
+
|
|
22
|
+
/** Greppable prefix for an audio-gate shortfall (pause requested, world's
|
|
23
|
+
* audio could not actually be silenced). */
|
|
24
|
+
export const AUDIO_GATE_PREFIX = 'audio-gate';
|
|
25
|
+
|
|
26
|
+
/** One shortfall instance: which world, and why the capability wasn't there. */
|
|
27
|
+
export interface CapabilityGateReport {
|
|
28
|
+
readonly worldId: string;
|
|
29
|
+
readonly reason: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function formatGateMessage(
|
|
33
|
+
prefix: string,
|
|
34
|
+
capability: string,
|
|
35
|
+
report: CapabilityGateReport,
|
|
36
|
+
): string {
|
|
37
|
+
return (
|
|
38
|
+
`${prefix} world "${report.worldId}": pause requested but ${capability} cannot be gated ` +
|
|
39
|
+
`(${report.reason}) — reporting honestly instead of silently no-op-ing ` +
|
|
40
|
+
`(docs/CAPABILITY-TIERS.md §d). ${prefix} ${JSON.stringify(report)}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Format a loop-gate shortfall message (a `self-driven` world with no
|
|
45
|
+
* working pause capability). */
|
|
46
|
+
export function formatLoopGateMessage(report: CapabilityGateReport): string {
|
|
47
|
+
return formatGateMessage(LOOP_GATE_PREFIX, "this world's loop", report);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Format an audio-gate shortfall message (a world with no `AudioAdapter`, or
|
|
51
|
+
* whose adapter cannot actually silence it). */
|
|
52
|
+
export function formatAudioGateMessage(report: CapabilityGateReport): string {
|
|
53
|
+
return formatGateMessage(AUDIO_GATE_PREFIX, "this world's audio", report);
|
|
54
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RapierPhysicsAdapter — the first-party `PhysicsAdapter` over the existing
|
|
3
|
+
* `PhysicsRegistry` (Object3D ↔ Rapier body/collider). This is the generalized,
|
|
4
|
+
* behind-the-interface form of the old `setEcsSyncTransform` teleport: it lets
|
|
5
|
+
* the editor freeze a body, apply a gizmo edit, and resume — without the editor
|
|
6
|
+
* knowing Rapier exists.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type RAPIER from '@dimforge/rapier3d-compat';
|
|
10
|
+
import type * as THREE from 'three';
|
|
11
|
+
import type { PhysicsRegistry } from '../physics/physics-registry';
|
|
12
|
+
import type { PhysicsAdapter } from './system-adapter';
|
|
13
|
+
import type { Transform, TransformOwner } from './transform';
|
|
14
|
+
|
|
15
|
+
export function createRapierPhysicsAdapter(
|
|
16
|
+
registry: PhysicsRegistry,
|
|
17
|
+
debugMesh?: THREE.Object3D | null,
|
|
18
|
+
): PhysicsAdapter {
|
|
19
|
+
/** Saved body types while frozen, so unfreeze can restore them. */
|
|
20
|
+
const frozen = new Map<RAPIER.RigidBody, number>();
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
ownerOf(o: THREE.Object3D): TransformOwner {
|
|
24
|
+
const body = registry.get(o)?.body;
|
|
25
|
+
if (!body) return 'editor';
|
|
26
|
+
// A fixed body never moves on its own → the editor owns its transform.
|
|
27
|
+
return body.isFixed() ? 'editor' : 'physics';
|
|
28
|
+
},
|
|
29
|
+
freeze(o: THREE.Object3D): void {
|
|
30
|
+
const body = registry.get(o)?.body;
|
|
31
|
+
if (!body || frozen.has(body)) return;
|
|
32
|
+
frozen.set(body, body.bodyType());
|
|
33
|
+
// Kinematic-position: the body stops simulating but tracks the pose we set.
|
|
34
|
+
body.setBodyType(2 /* KinematicPositionBased */, true);
|
|
35
|
+
},
|
|
36
|
+
commit(o: THREE.Object3D, t: Transform): void {
|
|
37
|
+
const body = registry.get(o)?.body;
|
|
38
|
+
if (!body) return;
|
|
39
|
+
body.setTranslation({ x: t.position[0], y: t.position[1], z: t.position[2] }, true);
|
|
40
|
+
body.setRotation(
|
|
41
|
+
{ x: t.rotation[0], y: t.rotation[1], z: t.rotation[2], w: t.rotation[3] },
|
|
42
|
+
true,
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
unfreeze(o: THREE.Object3D): void {
|
|
46
|
+
const body = registry.get(o)?.body;
|
|
47
|
+
if (!body) return;
|
|
48
|
+
const prev = frozen.get(body);
|
|
49
|
+
if (prev !== undefined) {
|
|
50
|
+
body.setBodyType(prev, true);
|
|
51
|
+
frozen.delete(body);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
debugDraw: () => debugMesh ?? null,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System adapters — optional subsystem capability providers hung off a mounted
|
|
3
|
+
* game (`MountedGame.systems`). Each is a thin capability boundary the editor can
|
|
4
|
+
* coordinate with WITHOUT owning the implementation. The first-party
|
|
5
|
+
* implementers wrap Rapier / Colyseus / the InputManager; an external game
|
|
6
|
+
* supplies its own or none, and the editor degrades per `capabilities`.
|
|
7
|
+
*
|
|
8
|
+
* These are introspection/coordination boundaries, NOT re-implementations: e.g.
|
|
9
|
+
* `NetworkingAdapter` is not a transport, and `PhysicsAdapter` does not replace
|
|
10
|
+
* Rapier — it lets the editor ask "who owns this object" and "freeze it while I
|
|
11
|
+
* edit it".
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type * as THREE from 'three';
|
|
15
|
+
import type { Transform, TransformOwner } from './transform';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Physics coordination so the editor can stably edit an object a simulation
|
|
19
|
+
* would otherwise overwrite every frame: `freeze → apply → unfreeze`.
|
|
20
|
+
*/
|
|
21
|
+
export interface PhysicsAdapter {
|
|
22
|
+
/** Returns `'physics'` when a body drives this object, else another owner. */
|
|
23
|
+
ownerOf(o: THREE.Object3D): TransformOwner;
|
|
24
|
+
/** Pause the body driving `o` (kinematic / sleep / detach) for editing. */
|
|
25
|
+
freeze(o: THREE.Object3D): void;
|
|
26
|
+
/** Teleport the body to the edited pose (so the sim continues from there). */
|
|
27
|
+
commit(o: THREE.Object3D, t: Transform): void;
|
|
28
|
+
/** Resume simulation of `o`. */
|
|
29
|
+
unfreeze(o: THREE.Object3D): void;
|
|
30
|
+
/** Optional debug-draw object (collider wireframes). */
|
|
31
|
+
debugDraw?(): THREE.Object3D | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface NetPeer {
|
|
35
|
+
id: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The live connection lifecycle, for the editor's network inspector. */
|
|
40
|
+
export type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
41
|
+
|
|
42
|
+
/** Identity of the room the local peer is currently in, or `null` when not connected. */
|
|
43
|
+
export interface RoomInfo {
|
|
44
|
+
roomId: string;
|
|
45
|
+
sessionId: string;
|
|
46
|
+
roomName: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Lightweight replication counters for the editor's network inspector. */
|
|
50
|
+
export interface ReplicationStats {
|
|
51
|
+
/** Number of replicated entities currently known (e.g. players + NPCs). */
|
|
52
|
+
entities: number;
|
|
53
|
+
/** Approximate inbound replication activity (state changes observed per second). */
|
|
54
|
+
msgsInPerSec: number;
|
|
55
|
+
/** Approximate outbound message rate (client → server sends per second). */
|
|
56
|
+
msgsOutPerSec: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type Unsubscribe = () => void;
|
|
60
|
+
|
|
61
|
+
/** INTROSPECTION over replication state — NOT a networking transport. */
|
|
62
|
+
export interface NetworkingAdapter {
|
|
63
|
+
peers(): NetPeer[];
|
|
64
|
+
networkId(o: THREE.Object3D): string | null;
|
|
65
|
+
authority(o: THREE.Object3D): 'local' | 'remote' | 'server';
|
|
66
|
+
/** Remote/server-authoritative objects → inspect-only in the editor. */
|
|
67
|
+
editable(o: THREE.Object3D): boolean;
|
|
68
|
+
/** Current connection lifecycle state. */
|
|
69
|
+
getConnectionState(): ConnectionState;
|
|
70
|
+
/** The active room's identity, or `null` when not connected to a room. */
|
|
71
|
+
getRoomInfo(): RoomInfo | null;
|
|
72
|
+
/** Replication activity snapshot, for a live network inspector panel. */
|
|
73
|
+
getReplicationStats(): ReplicationStats;
|
|
74
|
+
/** Subscribe to changes in connection state / room / replication stats. */
|
|
75
|
+
subscribe(cb: () => void): Unsubscribe;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface InputAdapter {
|
|
79
|
+
poll(): void;
|
|
80
|
+
/** Current value of every named action (1 = pressed, 0 = not), for inspection. */
|
|
81
|
+
actions(): Readonly<Record<string, number>>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** URL remap so an ingested game's relative asset paths resolve under the host. */
|
|
85
|
+
export interface AssetAdapter {
|
|
86
|
+
resolve(url: string): string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** A snapshot of one object's animation graph (state + parameter values). */
|
|
90
|
+
export interface AnimationGraphInfo {
|
|
91
|
+
object: THREE.Object3D;
|
|
92
|
+
state: string;
|
|
93
|
+
parameters: Record<string, number | boolean>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Inspect + drive a game's animation graphs (state machines / blend params). The
|
|
98
|
+
* editor uses this to list animated objects, read their current state, and scrub
|
|
99
|
+
* parameters — without owning the animation system.
|
|
100
|
+
*/
|
|
101
|
+
export interface AnimationAdapter {
|
|
102
|
+
graphs(): AnimationGraphInfo[];
|
|
103
|
+
state(o: THREE.Object3D): string | null;
|
|
104
|
+
getParameter(o: THREE.Object3D, name: string): number | boolean | undefined;
|
|
105
|
+
setParameter(o: THREE.Object3D, name: string, value: number | boolean): void;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface NavPoint {
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
z: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Inspect a game's navigation mesh: whether one is built, query a path, and get a
|
|
116
|
+
* debug overlay. Coordination/introspection only — the editor doesn't own the build.
|
|
117
|
+
*/
|
|
118
|
+
export interface NavigationAdapter {
|
|
119
|
+
hasNavMesh(): boolean;
|
|
120
|
+
findPath(start: NavPoint, end: NavPoint): NavPoint[];
|
|
121
|
+
debugMesh(scene: THREE.Scene): THREE.Object3D | null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Silence/restore a world's own audio (D10, T7.6) — NOT a mixer/bus API. This
|
|
126
|
+
* is the seam `Game.play.pause()` calls so a paused world's audio goes quiet
|
|
127
|
+
* too (`docs/DECISIONS-PENDING.md` §D10: "an audio seam in `SystemAdapters` so
|
|
128
|
+
* pause can silence game audio (howler et al.) or explicitly report it
|
|
129
|
+
* cannot"). Absence on a world's `mounted.systems` means exactly that:
|
|
130
|
+
* `Game.play.pause()` reports it loudly once per world rather than silently
|
|
131
|
+
* leaving that world's audio playing under a "paused" game.
|
|
132
|
+
*/
|
|
133
|
+
export interface AudioAdapter {
|
|
134
|
+
/** `true` silences this world's audio; `false` restores it to whatever
|
|
135
|
+
* level it was at before silencing (an implementer's own concern — the
|
|
136
|
+
* first-party adapter restores its master-gain value, not a hardcoded 1). */
|
|
137
|
+
setMuted(muted: boolean): void;
|
|
138
|
+
/** Current muted state, for inspection (editor mute UI, proofs). */
|
|
139
|
+
isMuted(): boolean;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The set of optional subsystem providers a mounted game may expose. Absence of
|
|
144
|
+
* a provider means "capability not supported" — the editor degrades gracefully.
|
|
145
|
+
*/
|
|
146
|
+
export interface SystemAdapters {
|
|
147
|
+
physics?: PhysicsAdapter;
|
|
148
|
+
networking?: NetworkingAdapter;
|
|
149
|
+
input?: InputAdapter;
|
|
150
|
+
assets?: AssetAdapter;
|
|
151
|
+
animation?: AnimationAdapter;
|
|
152
|
+
navigation?: NavigationAdapter;
|
|
153
|
+
audio?: AudioAdapter;
|
|
154
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The neutral transform value used across adapter interfaces. Position + scale
|
|
3
|
+
* are xyz; rotation is a quaternion (xyzw) — matching `Object3D.quaternion`, so
|
|
4
|
+
* adapters never have to agree on an Euler convention.
|
|
5
|
+
*/
|
|
6
|
+
export interface Transform {
|
|
7
|
+
position: [number, number, number];
|
|
8
|
+
rotation: [number, number, number, number];
|
|
9
|
+
scale: [number, number, number];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Who currently owns an object's transform — i.e. what writes it each frame.
|
|
14
|
+
* The editor uses this to decide whether a gizmo edit is durable (`editor`),
|
|
15
|
+
* needs simulation coordination (`physics`), or is best-effort/inspect-only
|
|
16
|
+
* (`script`/`network`/`external`).
|
|
17
|
+
*/
|
|
18
|
+
export type TransformOwner = 'editor' | 'physics' | 'animation' | 'script' | 'network' | 'external';
|