@relu-interactives/spatial-ecs 0.3.0 → 0.3.2
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/{System-CYWZ_Zx5.d.cts → System-vrU46Vuw.d.cts} +16 -2
- package/dist/{System-CYWZ_Zx5.d.ts → System-vrU46Vuw.d.ts} +16 -2
- package/dist/{Video-AIQYTAAr.d.cts → XRRig-CAmf04NX.d.ts} +131 -4
- package/dist/{Video-DlZ4G9ig.d.ts → XRRig-Cu-EyliG.d.cts} +131 -4
- package/dist/{chunk-PZ4CAALA.js → chunk-67WGASUJ.js} +3 -3
- package/dist/{chunk-PZ4CAALA.js.map → chunk-67WGASUJ.js.map} +1 -1
- package/dist/{chunk-AT5SPSPM.js → chunk-JWTRFJBL.js} +168 -83
- package/dist/chunk-JWTRFJBL.js.map +1 -0
- package/dist/{chunk-7JFSEV7A.js → chunk-SALBG747.js} +757 -6
- package/dist/chunk-SALBG747.js.map +1 -0
- package/dist/{chunk-7BPHZWQ6.js → chunk-U3MDYKPV.js} +47 -3
- package/dist/chunk-U3MDYKPV.js.map +1 -0
- package/dist/components/index.cjs +44 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1 -1
- package/dist/factories/index.cjs +236 -107
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +9 -3
- package/dist/factories/index.d.ts +9 -3
- package/dist/factories/index.js +3 -3
- package/dist/index-Bc0YCz1A.d.cts +514 -0
- package/dist/index-CRmfSYdj.d.ts +514 -0
- package/dist/{index-Gr8aCPRM.d.cts → index-CUFd71ri.d.cts} +12 -3
- package/dist/{index-BwiRJNIT.d.ts → index-w1oqWl_M.d.ts} +12 -3
- package/dist/index.cjs +1107 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -8
- package/dist/index.d.ts +42 -8
- package/dist/index.js +26 -8
- package/dist/index.js.map +1 -1
- package/dist/systems/index.cjs +799 -1
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +3 -278
- package/dist/systems/index.d.ts +3 -278
- package/dist/systems/index.js +3 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/worldSnapshotUtils.d.cts +1 -1
- package/dist/worldSnapshotUtils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-7BPHZWQ6.js.map +0 -1
- package/dist/chunk-7JFSEV7A.js.map +0 -1
- package/dist/chunk-AT5SPSPM.js.map +0 -1
package/dist/systems/index.d.cts
CHANGED
|
@@ -1,279 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import
|
|
1
|
+
export { v as ComponentFactory, B as EcsComponentFactoryKind, I as InputSystem, K as KeyboardKey, L as KeyboardKeys, M as MouseButton, O as ObjectManagementSystem, X as RenderSystem, a0 as TransformSyncSystem } from '../System-vrU46Vuw.cjs';
|
|
2
|
+
export { A as AnimationSystem, b as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, c as MeshGeometrySystem, d as ModuleLoader, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, e as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, f as ScriptBehaviourSystem, g as ScriptObjectSystem, h as SelectionContext, V as VRTeleportAreaSystem, i as VideoSystem, j as XRControllerVisualSystem, k as XRInputSystem, l as XRInteractionSystem, m as XRLocomotionSystem, n as XRSessionSystem } from '../index-Bc0YCz1A.cjs';
|
|
3
|
+
import 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
|
5
|
-
|
|
6
|
-
declare class AnimationSystem implements EcsSystem {
|
|
7
|
-
private readonly runtimeByEntity;
|
|
8
|
-
private readonly gltfLoader;
|
|
9
|
-
private readonly fbxLoader;
|
|
10
|
-
private loadClipsFromSource;
|
|
11
|
-
private refreshExternalClipSources;
|
|
12
|
-
private release;
|
|
13
|
-
update(world: World, deltaTime: number): void;
|
|
14
|
-
dispose(): void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare class CameraSyncSystem implements EcsSystem {
|
|
18
|
-
private readonly signatures;
|
|
19
|
-
update(world: World): void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare class ObjectVisibilitySystem implements EcsSystem {
|
|
23
|
-
update(world: World): void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare class EnvironmentSyncSystem implements EcsSystem {
|
|
27
|
-
private readonly scene;
|
|
28
|
-
private readonly textureLoader;
|
|
29
|
-
private signature;
|
|
30
|
-
private activeTexture;
|
|
31
|
-
private pendingImageUrl;
|
|
32
|
-
constructor(scene: THREE.Scene);
|
|
33
|
-
private disposeActiveTexture;
|
|
34
|
-
private applySkybox;
|
|
35
|
-
private applyFog;
|
|
36
|
-
update(world: World): void;
|
|
37
|
-
dispose(): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare class PostprocessingSyncSystem implements EcsSystem {
|
|
41
|
-
private readonly renderer;
|
|
42
|
-
private readonly scene;
|
|
43
|
-
private readonly camera;
|
|
44
|
-
private signature;
|
|
45
|
-
private composer;
|
|
46
|
-
private composerEnabled;
|
|
47
|
-
constructor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.PerspectiveCamera);
|
|
48
|
-
private setComposerEnabled;
|
|
49
|
-
private disposeComposer;
|
|
50
|
-
private buildComposer;
|
|
51
|
-
update(world: World): void;
|
|
52
|
-
dispose(): void;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
declare class PhysicsSyncSystem implements EcsSystem {
|
|
56
|
-
private readonly rigidBodyHandles;
|
|
57
|
-
private readonly colliderHandles;
|
|
58
|
-
private readonly rigidBodySignatures;
|
|
59
|
-
private readonly colliderSignatures;
|
|
60
|
-
private readonly isEditorMode;
|
|
61
|
-
private rapier;
|
|
62
|
-
private isBootstrappingWorld;
|
|
63
|
-
private accumulator;
|
|
64
|
-
constructor(options?: {
|
|
65
|
-
isEditor?: boolean;
|
|
66
|
-
});
|
|
67
|
-
private ensurePhysicsWorld;
|
|
68
|
-
private removeEntityPhysics;
|
|
69
|
-
update(world: World, deltaTime: number): void;
|
|
70
|
-
dispose(world: World): void;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
declare class LightSyncSystem implements EcsSystem {
|
|
74
|
-
private readonly signatures;
|
|
75
|
-
update(world: World): void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare class MaterialSyncSystem implements EcsSystem {
|
|
79
|
-
private readonly signatures;
|
|
80
|
-
private readonly textureCache;
|
|
81
|
-
update(world: World): void;
|
|
82
|
-
dispose(): void;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
declare class MeshGeometrySystem implements EcsSystem {
|
|
86
|
-
private readonly geometrySignatures;
|
|
87
|
-
private readonly shadowSignatures;
|
|
88
|
-
update(world: World): void;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Maintains the runtime geometry for entities with an {@link InstancedMeshComponent}.
|
|
93
|
-
*
|
|
94
|
-
* - **Primitive kinds** (`cube`, `sphere`, `plane`, `cylinder`, `capsule`): creates a single
|
|
95
|
-
* `THREE.InstancedMesh` on the anchor and writes per-instance matrices every frame.
|
|
96
|
-
* - **Model kind** (`model`): asynchronously loads the GLTF/GLB at `comp.modelPath`, traverses
|
|
97
|
-
* the scene to collect all `THREE.Mesh` nodes, and creates one `THREE.InstancedMesh` per mesh
|
|
98
|
-
* (preserving the mesh's local transform and original materials). All sub-meshes are grouped
|
|
99
|
-
* under a `THREE.Group` stored in `comp.instancedMesh`. Per-instance matrices are composed as
|
|
100
|
-
* `instanceTransform × meshLocalMatrix` every frame.
|
|
101
|
-
*
|
|
102
|
-
* Geometry is rebuilt whenever the signature (`meshKind:parameters:instanceCount` for primitives,
|
|
103
|
-
* `model:path:instanceCount` for model kind) changes.
|
|
104
|
-
*/
|
|
105
|
-
declare class InstancedMeshSystem implements EcsSystem {
|
|
106
|
-
/** Signature tracking for geometry + instance count changes. */
|
|
107
|
-
private readonly geometrySignatures;
|
|
108
|
-
/** Signature being loaded per entity. Maps entityId → geometrySignature in-flight.
|
|
109
|
-
* Prevents re-dispatching a load every frame while comp.instancedMesh is still null. */
|
|
110
|
-
private readonly loadingSignatures;
|
|
111
|
-
/** Per-mesh data for model kind, populated after GLTF load. */
|
|
112
|
-
private readonly modelMeshEntries;
|
|
113
|
-
/**
|
|
114
|
-
* System-internal ref to the Three.js mesh/group most recently placed on
|
|
115
|
-
* the anchor by this system. Used for cleanup on rebuild instead of
|
|
116
|
-
* `comp.instancedMesh`, which can be stale (pointing to a disposed mesh)
|
|
117
|
-
* after an undo/redo restores a history snapshot captured at an earlier
|
|
118
|
-
* geometry configuration. Relying on the stale comp ref would skip removal
|
|
119
|
-
* of the current live mesh → ghost mesh in the scene.
|
|
120
|
-
*/
|
|
121
|
-
private readonly trackedMeshes;
|
|
122
|
-
update(world: World): void;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Shared infrastructure for the script-hosting systems (`ScriptBehaviourSystem`
|
|
127
|
-
* and `ScriptObjectSystem`): module loading, class resolution, data-envelope
|
|
128
|
-
* merge/resolve/serialize. Extracted verbatim from `ScriptBehaviourSystem` so
|
|
129
|
-
* both systems stay behaviourally identical for the parts they share.
|
|
130
|
-
*/
|
|
131
|
-
/** Resolves a script URL to its ES module namespace. */
|
|
132
|
-
type ModuleLoader = (scriptUrl: string) => Promise<Record<string, unknown>>;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Optional context that enables raycast-based onSelect / onDeselect dispatch.
|
|
136
|
-
* When provided, pointer/touch taps on the canvas fire a raycast against the
|
|
137
|
-
* scene. If the hit object (or any ancestor) carries userData.entityId, every
|
|
138
|
-
* Behaviour instance for that entity receives onSelect(); the previously
|
|
139
|
-
* selected entity's instances receive onDeselect().
|
|
140
|
-
*/
|
|
141
|
-
type SelectionContext = {
|
|
142
|
-
camera: THREE.Camera;
|
|
143
|
-
scene: THREE.Scene;
|
|
144
|
-
domElement: HTMLElement;
|
|
145
|
-
};
|
|
146
|
-
declare class ScriptBehaviourSystem implements EcsSystem {
|
|
147
|
-
private instances;
|
|
148
|
-
private loading;
|
|
149
|
-
private readonly moduleLoader;
|
|
150
|
-
private readonly selectionCtx;
|
|
151
|
-
private readonly raycaster;
|
|
152
|
-
private readonly ndcPointer;
|
|
153
|
-
private selectedEntityId;
|
|
154
|
-
private pendingEntityId;
|
|
155
|
-
private pointerDownPos;
|
|
156
|
-
private static readonly CLICK_THRESHOLD;
|
|
157
|
-
constructor(moduleLoader?: ModuleLoader, selectionContext?: SelectionContext);
|
|
158
|
-
/** Walk up the object hierarchy to find the nearest userData.entityId. */
|
|
159
|
-
private resolveEntityId;
|
|
160
|
-
/** Convert client (screen) coordinates to normalised device coordinates. */
|
|
161
|
-
private toNdc;
|
|
162
|
-
/** Fire raycast and queue the result to be dispatched in the next update(). */
|
|
163
|
-
private queueRaycast;
|
|
164
|
-
private onPointerDown;
|
|
165
|
-
private onPointerUp;
|
|
166
|
-
/**
|
|
167
|
-
* Apply a queued selection change.
|
|
168
|
-
* Calls onDeselect() on all behaviours of the previous entity and
|
|
169
|
-
* onSelect() on all behaviours of the newly selected entity.
|
|
170
|
-
*/
|
|
171
|
-
private applySelection;
|
|
172
|
-
update(world: World, deltaTime: number): void;
|
|
173
|
-
dispose(world: World): void;
|
|
174
|
-
private loadBehaviour;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/** Tags the Object3D a script's `build()` returned, so reloads can find/remove it. */
|
|
178
|
-
declare const SCRIPT_OBJECT_ROOT_FLAG = "__scriptObjectRoot";
|
|
179
|
-
/**
|
|
180
|
-
* Builds, ticks, and disposes {@link ScriptObject} scripts. Unlike
|
|
181
|
-
* `ScriptBehaviourSystem`, this runs in the editor AND at runtime — there is NO
|
|
182
|
-
* `isEditorMode` gating anywhere here. A script's `build()` output is attached
|
|
183
|
-
* under the entity's `Object3DRef.object` (so it inherits transform, selection
|
|
184
|
-
* and visibility). `runtimeState` is written on transitions only (never every
|
|
185
|
-
* frame).
|
|
186
|
-
*
|
|
187
|
-
* Construct it and pass it to `World.setup({ systems })`.
|
|
188
|
-
*
|
|
189
|
-
* @category Systems
|
|
190
|
-
*/
|
|
191
|
-
declare class ScriptObjectSystem implements EcsSystem {
|
|
192
|
-
private readonly moduleLoader;
|
|
193
|
-
private instances;
|
|
194
|
-
private loading;
|
|
195
|
-
/** Bumped by invalidate*() so in-flight loads that predate it are discarded. */
|
|
196
|
-
private epoch;
|
|
197
|
-
constructor(moduleLoader?: ModuleLoader);
|
|
198
|
-
update(world: World, deltaTime: number): void;
|
|
199
|
-
private loadScriptObject;
|
|
200
|
-
/** Dispose a record's instance + built subtree. `keepTombstone` leaves an error marker. */
|
|
201
|
-
private teardownRecord;
|
|
202
|
-
private markError;
|
|
203
|
-
/** Dispose all live instances so the next update() reloads with fresh modules. */
|
|
204
|
-
invalidateAll(): void;
|
|
205
|
-
/** Invalidate only the entities whose script matches `scriptUrl`. */
|
|
206
|
-
invalidate(scriptUrl: string): void;
|
|
207
|
-
dispose(world: World): void;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Reconciles `AudioComponent` state with the underlying THREE.js audio objects
|
|
212
|
-
* each frame.
|
|
213
|
-
*
|
|
214
|
-
* **Playback** — drives `play()`, `pause()`, and `stop()` on the THREE.js
|
|
215
|
-
* audio node based on the `isPlaying` / `isPaused` flags set by
|
|
216
|
-
* `AudioComponent.play()`, `.pause()`, and `.stop()`.
|
|
217
|
-
*
|
|
218
|
-
* **Option sync** — detects changes to `loop`, `pitch`, `volume`,
|
|
219
|
-
* `refDistance`, `distanceModel`, and `rolloffFactor` and applies them live.
|
|
220
|
-
* Changes take effect on the next frame, so scripts and inspector edits during
|
|
221
|
-
* runtime are reflected without reloading the scene.
|
|
222
|
-
*
|
|
223
|
-
* Only active in **preview** mode (`isEditor: true` makes every update a
|
|
224
|
-
* no-op so the editor is unaffected).
|
|
225
|
-
*
|
|
226
|
-
* @category Systems
|
|
227
|
-
*/
|
|
228
|
-
declare class AudioSystem implements EcsSystem {
|
|
229
|
-
private readonly isEditor;
|
|
230
|
-
/** THREE.js `isPlaying` state captured at the end of the previous frame. */
|
|
231
|
-
private readonly prevPlayingState;
|
|
232
|
-
/** Snapshot of options applied in the previous frame, for change detection. */
|
|
233
|
-
private readonly prevOptions;
|
|
234
|
-
/** Tracks entities that were stopped due to invisibility. */
|
|
235
|
-
private readonly stoppedDueToInvisibility;
|
|
236
|
-
constructor({ isEditor }?: {
|
|
237
|
-
isEditor?: boolean;
|
|
238
|
-
});
|
|
239
|
-
update(world: World, _deltaTime: number): void;
|
|
240
|
-
/** Apply any changed options from the component to the THREE.js audio node. */
|
|
241
|
-
private _syncOptions;
|
|
242
|
-
dispose(_world: World): void;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Reconciles `VideoComponent` state with the underlying HTML video element
|
|
247
|
-
* and THREE.js mesh/material each frame.
|
|
248
|
-
*
|
|
249
|
-
* **Playback** — drives `play()`, `pause()`, and stop (pause + seek to 0) on
|
|
250
|
-
* the HTML `<video>` element based on the `isPlaying` / `isPaused` flags set
|
|
251
|
-
* by `VideoComponent.play()`, `.pause()`, and `.stop()`.
|
|
252
|
-
*
|
|
253
|
-
* **Option sync** — detects changes to `loop`, `volume`, `width`, `height`,
|
|
254
|
-
* and green-screen shader uniforms (`backgroundColor`, `similarity`,
|
|
255
|
-
* `smoothness`, `spill`) and applies them live without a scene reload.
|
|
256
|
-
*
|
|
257
|
-
* Only active in **preview** mode (`isEditor: true` makes every update a
|
|
258
|
-
* no-op so the editor is unaffected).
|
|
259
|
-
*
|
|
260
|
-
* @category Systems
|
|
261
|
-
*/
|
|
262
|
-
declare class VideoSystem implements EcsSystem {
|
|
263
|
-
private readonly isEditor;
|
|
264
|
-
/** Playback intent captured at the end of the previous frame. */
|
|
265
|
-
private readonly prevIntent;
|
|
266
|
-
/** Snapshot of options applied in the previous frame, for change detection. */
|
|
267
|
-
private readonly prevOptions;
|
|
268
|
-
/** Tracks entities that were manually paused due to invisibility. */
|
|
269
|
-
private readonly pausedDueToInvisibility;
|
|
270
|
-
constructor({ isEditor }?: {
|
|
271
|
-
isEditor?: boolean;
|
|
272
|
-
});
|
|
273
|
-
update(world: World, _deltaTime: number): void;
|
|
274
|
-
/** Apply any changed options from the component to the video element and mesh. */
|
|
275
|
-
private _syncOptions;
|
|
276
|
-
dispose(_world: World): void;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export { AnimationSystem, AudioSystem, CameraSyncSystem, EnvironmentSyncSystem, InstancedMeshSystem, LightSyncSystem, MaterialSyncSystem, MeshGeometrySystem, type ModuleLoader, ObjectVisibilitySystem, PhysicsSyncSystem, PostprocessingSyncSystem, SCRIPT_OBJECT_ROOT_FLAG, ScriptBehaviourSystem, ScriptObjectSystem, type SelectionContext, VideoSystem };
|
package/dist/systems/index.d.ts
CHANGED
|
@@ -1,279 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import
|
|
1
|
+
export { v as ComponentFactory, B as EcsComponentFactoryKind, I as InputSystem, K as KeyboardKey, L as KeyboardKeys, M as MouseButton, O as ObjectManagementSystem, X as RenderSystem, a0 as TransformSyncSystem } from '../System-vrU46Vuw.js';
|
|
2
|
+
export { A as AnimationSystem, b as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, c as MeshGeometrySystem, d as ModuleLoader, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, e as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, f as ScriptBehaviourSystem, g as ScriptObjectSystem, h as SelectionContext, V as VRTeleportAreaSystem, i as VideoSystem, j as XRControllerVisualSystem, k as XRInputSystem, l as XRInteractionSystem, m as XRLocomotionSystem, n as XRSessionSystem } from '../index-CRmfSYdj.js';
|
|
3
|
+
import 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
|
5
|
-
|
|
6
|
-
declare class AnimationSystem implements EcsSystem {
|
|
7
|
-
private readonly runtimeByEntity;
|
|
8
|
-
private readonly gltfLoader;
|
|
9
|
-
private readonly fbxLoader;
|
|
10
|
-
private loadClipsFromSource;
|
|
11
|
-
private refreshExternalClipSources;
|
|
12
|
-
private release;
|
|
13
|
-
update(world: World, deltaTime: number): void;
|
|
14
|
-
dispose(): void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare class CameraSyncSystem implements EcsSystem {
|
|
18
|
-
private readonly signatures;
|
|
19
|
-
update(world: World): void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare class ObjectVisibilitySystem implements EcsSystem {
|
|
23
|
-
update(world: World): void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare class EnvironmentSyncSystem implements EcsSystem {
|
|
27
|
-
private readonly scene;
|
|
28
|
-
private readonly textureLoader;
|
|
29
|
-
private signature;
|
|
30
|
-
private activeTexture;
|
|
31
|
-
private pendingImageUrl;
|
|
32
|
-
constructor(scene: THREE.Scene);
|
|
33
|
-
private disposeActiveTexture;
|
|
34
|
-
private applySkybox;
|
|
35
|
-
private applyFog;
|
|
36
|
-
update(world: World): void;
|
|
37
|
-
dispose(): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare class PostprocessingSyncSystem implements EcsSystem {
|
|
41
|
-
private readonly renderer;
|
|
42
|
-
private readonly scene;
|
|
43
|
-
private readonly camera;
|
|
44
|
-
private signature;
|
|
45
|
-
private composer;
|
|
46
|
-
private composerEnabled;
|
|
47
|
-
constructor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.PerspectiveCamera);
|
|
48
|
-
private setComposerEnabled;
|
|
49
|
-
private disposeComposer;
|
|
50
|
-
private buildComposer;
|
|
51
|
-
update(world: World): void;
|
|
52
|
-
dispose(): void;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
declare class PhysicsSyncSystem implements EcsSystem {
|
|
56
|
-
private readonly rigidBodyHandles;
|
|
57
|
-
private readonly colliderHandles;
|
|
58
|
-
private readonly rigidBodySignatures;
|
|
59
|
-
private readonly colliderSignatures;
|
|
60
|
-
private readonly isEditorMode;
|
|
61
|
-
private rapier;
|
|
62
|
-
private isBootstrappingWorld;
|
|
63
|
-
private accumulator;
|
|
64
|
-
constructor(options?: {
|
|
65
|
-
isEditor?: boolean;
|
|
66
|
-
});
|
|
67
|
-
private ensurePhysicsWorld;
|
|
68
|
-
private removeEntityPhysics;
|
|
69
|
-
update(world: World, deltaTime: number): void;
|
|
70
|
-
dispose(world: World): void;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
declare class LightSyncSystem implements EcsSystem {
|
|
74
|
-
private readonly signatures;
|
|
75
|
-
update(world: World): void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare class MaterialSyncSystem implements EcsSystem {
|
|
79
|
-
private readonly signatures;
|
|
80
|
-
private readonly textureCache;
|
|
81
|
-
update(world: World): void;
|
|
82
|
-
dispose(): void;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
declare class MeshGeometrySystem implements EcsSystem {
|
|
86
|
-
private readonly geometrySignatures;
|
|
87
|
-
private readonly shadowSignatures;
|
|
88
|
-
update(world: World): void;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Maintains the runtime geometry for entities with an {@link InstancedMeshComponent}.
|
|
93
|
-
*
|
|
94
|
-
* - **Primitive kinds** (`cube`, `sphere`, `plane`, `cylinder`, `capsule`): creates a single
|
|
95
|
-
* `THREE.InstancedMesh` on the anchor and writes per-instance matrices every frame.
|
|
96
|
-
* - **Model kind** (`model`): asynchronously loads the GLTF/GLB at `comp.modelPath`, traverses
|
|
97
|
-
* the scene to collect all `THREE.Mesh` nodes, and creates one `THREE.InstancedMesh` per mesh
|
|
98
|
-
* (preserving the mesh's local transform and original materials). All sub-meshes are grouped
|
|
99
|
-
* under a `THREE.Group` stored in `comp.instancedMesh`. Per-instance matrices are composed as
|
|
100
|
-
* `instanceTransform × meshLocalMatrix` every frame.
|
|
101
|
-
*
|
|
102
|
-
* Geometry is rebuilt whenever the signature (`meshKind:parameters:instanceCount` for primitives,
|
|
103
|
-
* `model:path:instanceCount` for model kind) changes.
|
|
104
|
-
*/
|
|
105
|
-
declare class InstancedMeshSystem implements EcsSystem {
|
|
106
|
-
/** Signature tracking for geometry + instance count changes. */
|
|
107
|
-
private readonly geometrySignatures;
|
|
108
|
-
/** Signature being loaded per entity. Maps entityId → geometrySignature in-flight.
|
|
109
|
-
* Prevents re-dispatching a load every frame while comp.instancedMesh is still null. */
|
|
110
|
-
private readonly loadingSignatures;
|
|
111
|
-
/** Per-mesh data for model kind, populated after GLTF load. */
|
|
112
|
-
private readonly modelMeshEntries;
|
|
113
|
-
/**
|
|
114
|
-
* System-internal ref to the Three.js mesh/group most recently placed on
|
|
115
|
-
* the anchor by this system. Used for cleanup on rebuild instead of
|
|
116
|
-
* `comp.instancedMesh`, which can be stale (pointing to a disposed mesh)
|
|
117
|
-
* after an undo/redo restores a history snapshot captured at an earlier
|
|
118
|
-
* geometry configuration. Relying on the stale comp ref would skip removal
|
|
119
|
-
* of the current live mesh → ghost mesh in the scene.
|
|
120
|
-
*/
|
|
121
|
-
private readonly trackedMeshes;
|
|
122
|
-
update(world: World): void;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Shared infrastructure for the script-hosting systems (`ScriptBehaviourSystem`
|
|
127
|
-
* and `ScriptObjectSystem`): module loading, class resolution, data-envelope
|
|
128
|
-
* merge/resolve/serialize. Extracted verbatim from `ScriptBehaviourSystem` so
|
|
129
|
-
* both systems stay behaviourally identical for the parts they share.
|
|
130
|
-
*/
|
|
131
|
-
/** Resolves a script URL to its ES module namespace. */
|
|
132
|
-
type ModuleLoader = (scriptUrl: string) => Promise<Record<string, unknown>>;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Optional context that enables raycast-based onSelect / onDeselect dispatch.
|
|
136
|
-
* When provided, pointer/touch taps on the canvas fire a raycast against the
|
|
137
|
-
* scene. If the hit object (or any ancestor) carries userData.entityId, every
|
|
138
|
-
* Behaviour instance for that entity receives onSelect(); the previously
|
|
139
|
-
* selected entity's instances receive onDeselect().
|
|
140
|
-
*/
|
|
141
|
-
type SelectionContext = {
|
|
142
|
-
camera: THREE.Camera;
|
|
143
|
-
scene: THREE.Scene;
|
|
144
|
-
domElement: HTMLElement;
|
|
145
|
-
};
|
|
146
|
-
declare class ScriptBehaviourSystem implements EcsSystem {
|
|
147
|
-
private instances;
|
|
148
|
-
private loading;
|
|
149
|
-
private readonly moduleLoader;
|
|
150
|
-
private readonly selectionCtx;
|
|
151
|
-
private readonly raycaster;
|
|
152
|
-
private readonly ndcPointer;
|
|
153
|
-
private selectedEntityId;
|
|
154
|
-
private pendingEntityId;
|
|
155
|
-
private pointerDownPos;
|
|
156
|
-
private static readonly CLICK_THRESHOLD;
|
|
157
|
-
constructor(moduleLoader?: ModuleLoader, selectionContext?: SelectionContext);
|
|
158
|
-
/** Walk up the object hierarchy to find the nearest userData.entityId. */
|
|
159
|
-
private resolveEntityId;
|
|
160
|
-
/** Convert client (screen) coordinates to normalised device coordinates. */
|
|
161
|
-
private toNdc;
|
|
162
|
-
/** Fire raycast and queue the result to be dispatched in the next update(). */
|
|
163
|
-
private queueRaycast;
|
|
164
|
-
private onPointerDown;
|
|
165
|
-
private onPointerUp;
|
|
166
|
-
/**
|
|
167
|
-
* Apply a queued selection change.
|
|
168
|
-
* Calls onDeselect() on all behaviours of the previous entity and
|
|
169
|
-
* onSelect() on all behaviours of the newly selected entity.
|
|
170
|
-
*/
|
|
171
|
-
private applySelection;
|
|
172
|
-
update(world: World, deltaTime: number): void;
|
|
173
|
-
dispose(world: World): void;
|
|
174
|
-
private loadBehaviour;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/** Tags the Object3D a script's `build()` returned, so reloads can find/remove it. */
|
|
178
|
-
declare const SCRIPT_OBJECT_ROOT_FLAG = "__scriptObjectRoot";
|
|
179
|
-
/**
|
|
180
|
-
* Builds, ticks, and disposes {@link ScriptObject} scripts. Unlike
|
|
181
|
-
* `ScriptBehaviourSystem`, this runs in the editor AND at runtime — there is NO
|
|
182
|
-
* `isEditorMode` gating anywhere here. A script's `build()` output is attached
|
|
183
|
-
* under the entity's `Object3DRef.object` (so it inherits transform, selection
|
|
184
|
-
* and visibility). `runtimeState` is written on transitions only (never every
|
|
185
|
-
* frame).
|
|
186
|
-
*
|
|
187
|
-
* Construct it and pass it to `World.setup({ systems })`.
|
|
188
|
-
*
|
|
189
|
-
* @category Systems
|
|
190
|
-
*/
|
|
191
|
-
declare class ScriptObjectSystem implements EcsSystem {
|
|
192
|
-
private readonly moduleLoader;
|
|
193
|
-
private instances;
|
|
194
|
-
private loading;
|
|
195
|
-
/** Bumped by invalidate*() so in-flight loads that predate it are discarded. */
|
|
196
|
-
private epoch;
|
|
197
|
-
constructor(moduleLoader?: ModuleLoader);
|
|
198
|
-
update(world: World, deltaTime: number): void;
|
|
199
|
-
private loadScriptObject;
|
|
200
|
-
/** Dispose a record's instance + built subtree. `keepTombstone` leaves an error marker. */
|
|
201
|
-
private teardownRecord;
|
|
202
|
-
private markError;
|
|
203
|
-
/** Dispose all live instances so the next update() reloads with fresh modules. */
|
|
204
|
-
invalidateAll(): void;
|
|
205
|
-
/** Invalidate only the entities whose script matches `scriptUrl`. */
|
|
206
|
-
invalidate(scriptUrl: string): void;
|
|
207
|
-
dispose(world: World): void;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Reconciles `AudioComponent` state with the underlying THREE.js audio objects
|
|
212
|
-
* each frame.
|
|
213
|
-
*
|
|
214
|
-
* **Playback** — drives `play()`, `pause()`, and `stop()` on the THREE.js
|
|
215
|
-
* audio node based on the `isPlaying` / `isPaused` flags set by
|
|
216
|
-
* `AudioComponent.play()`, `.pause()`, and `.stop()`.
|
|
217
|
-
*
|
|
218
|
-
* **Option sync** — detects changes to `loop`, `pitch`, `volume`,
|
|
219
|
-
* `refDistance`, `distanceModel`, and `rolloffFactor` and applies them live.
|
|
220
|
-
* Changes take effect on the next frame, so scripts and inspector edits during
|
|
221
|
-
* runtime are reflected without reloading the scene.
|
|
222
|
-
*
|
|
223
|
-
* Only active in **preview** mode (`isEditor: true` makes every update a
|
|
224
|
-
* no-op so the editor is unaffected).
|
|
225
|
-
*
|
|
226
|
-
* @category Systems
|
|
227
|
-
*/
|
|
228
|
-
declare class AudioSystem implements EcsSystem {
|
|
229
|
-
private readonly isEditor;
|
|
230
|
-
/** THREE.js `isPlaying` state captured at the end of the previous frame. */
|
|
231
|
-
private readonly prevPlayingState;
|
|
232
|
-
/** Snapshot of options applied in the previous frame, for change detection. */
|
|
233
|
-
private readonly prevOptions;
|
|
234
|
-
/** Tracks entities that were stopped due to invisibility. */
|
|
235
|
-
private readonly stoppedDueToInvisibility;
|
|
236
|
-
constructor({ isEditor }?: {
|
|
237
|
-
isEditor?: boolean;
|
|
238
|
-
});
|
|
239
|
-
update(world: World, _deltaTime: number): void;
|
|
240
|
-
/** Apply any changed options from the component to the THREE.js audio node. */
|
|
241
|
-
private _syncOptions;
|
|
242
|
-
dispose(_world: World): void;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Reconciles `VideoComponent` state with the underlying HTML video element
|
|
247
|
-
* and THREE.js mesh/material each frame.
|
|
248
|
-
*
|
|
249
|
-
* **Playback** — drives `play()`, `pause()`, and stop (pause + seek to 0) on
|
|
250
|
-
* the HTML `<video>` element based on the `isPlaying` / `isPaused` flags set
|
|
251
|
-
* by `VideoComponent.play()`, `.pause()`, and `.stop()`.
|
|
252
|
-
*
|
|
253
|
-
* **Option sync** — detects changes to `loop`, `volume`, `width`, `height`,
|
|
254
|
-
* and green-screen shader uniforms (`backgroundColor`, `similarity`,
|
|
255
|
-
* `smoothness`, `spill`) and applies them live without a scene reload.
|
|
256
|
-
*
|
|
257
|
-
* Only active in **preview** mode (`isEditor: true` makes every update a
|
|
258
|
-
* no-op so the editor is unaffected).
|
|
259
|
-
*
|
|
260
|
-
* @category Systems
|
|
261
|
-
*/
|
|
262
|
-
declare class VideoSystem implements EcsSystem {
|
|
263
|
-
private readonly isEditor;
|
|
264
|
-
/** Playback intent captured at the end of the previous frame. */
|
|
265
|
-
private readonly prevIntent;
|
|
266
|
-
/** Snapshot of options applied in the previous frame, for change detection. */
|
|
267
|
-
private readonly prevOptions;
|
|
268
|
-
/** Tracks entities that were manually paused due to invisibility. */
|
|
269
|
-
private readonly pausedDueToInvisibility;
|
|
270
|
-
constructor({ isEditor }?: {
|
|
271
|
-
isEditor?: boolean;
|
|
272
|
-
});
|
|
273
|
-
update(world: World, _deltaTime: number): void;
|
|
274
|
-
/** Apply any changed options from the component to the video element and mesh. */
|
|
275
|
-
private _syncOptions;
|
|
276
|
-
dispose(_world: World): void;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export { AnimationSystem, AudioSystem, CameraSyncSystem, EnvironmentSyncSystem, InstancedMeshSystem, LightSyncSystem, MaterialSyncSystem, MeshGeometrySystem, type ModuleLoader, ObjectVisibilitySystem, PhysicsSyncSystem, PostprocessingSyncSystem, SCRIPT_OBJECT_ROOT_FLAG, ScriptBehaviourSystem, ScriptObjectSystem, type SelectionContext, VideoSystem };
|
package/dist/systems/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { AnimationSystem, AudioSystem, CameraSyncSystem, EnvironmentSyncSystem, InputSystem, InstancedMeshSystem, KeyboardKeys, LightSyncSystem, MaterialSyncSystem, MeshGeometrySystem, ObjectVisibilitySystem, PhysicsSyncSystem, PostprocessingSyncSystem, RenderSystem, SCRIPT_OBJECT_ROOT_FLAG, ScriptBehaviourSystem, ScriptObjectSystem, TransformSyncSystem, VideoSystem } from '../chunk-
|
|
2
|
-
export { ObjectManagementSystem } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { AnimationSystem, AudioSystem, CameraSyncSystem, EnvironmentSyncSystem, InputSystem, InstancedMeshSystem, KeyboardKeys, LightSyncSystem, MaterialSyncSystem, MeshGeometrySystem, ObjectVisibilitySystem, PhysicsSyncSystem, PostprocessingSyncSystem, RenderSystem, SCRIPT_OBJECT_ROOT_FLAG, ScriptBehaviourSystem, ScriptObjectSystem, TransformSyncSystem, VRTeleportAreaSystem, VideoSystem, XRControllerVisualSystem, XRInputSystem, XRInteractionSystem, XRLocomotionSystem, XRSessionSystem } from '../chunk-SALBG747.js';
|
|
2
|
+
export { ObjectManagementSystem } from '../chunk-67WGASUJ.js';
|
|
3
|
+
import '../chunk-U3MDYKPV.js';
|
|
4
4
|
import '../chunk-OY7ZODZP.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/types.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'three';
|
|
2
|
-
export { A as AssetInput, t as CheckboxInput, u as ColorInput, w as ComponentInput, x as ComponentKind, y as DropdownInput, z as DropdownOption, F as EcsEntityEditorKind, p as EcsEntityKind, r as EntityId, G as EntityInput, H as FloatInput, J as IntersectionResult, o as ParentLookup, Y as SelectionListener, Z as SliderInput, _ as TextInput, $ as ToggleInput, a1 as Vec3, a2 as Vector2Input, a3 as Vector3Input, W as WorldEntityView } from './System-
|
|
2
|
+
export { A as AssetInput, t as CheckboxInput, u as ColorInput, w as ComponentInput, x as ComponentKind, y as DropdownInput, z as DropdownOption, F as EcsEntityEditorKind, p as EcsEntityKind, r as EntityId, G as EntityInput, H as FloatInput, J as IntersectionResult, o as ParentLookup, Y as SelectionListener, Z as SliderInput, _ as TextInput, $ as ToggleInput, a1 as Vec3, a2 as Vector2Input, a3 as Vector3Input, W as WorldEntityView } from './System-vrU46Vuw.cjs';
|
|
3
3
|
import '@dimforge/rapier3d-compat';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'three';
|
|
2
|
-
export { A as AssetInput, t as CheckboxInput, u as ColorInput, w as ComponentInput, x as ComponentKind, y as DropdownInput, z as DropdownOption, F as EcsEntityEditorKind, p as EcsEntityKind, r as EntityId, G as EntityInput, H as FloatInput, J as IntersectionResult, o as ParentLookup, Y as SelectionListener, Z as SliderInput, _ as TextInput, $ as ToggleInput, a1 as Vec3, a2 as Vector2Input, a3 as Vector3Input, W as WorldEntityView } from './System-
|
|
2
|
+
export { A as AssetInput, t as CheckboxInput, u as ColorInput, w as ComponentInput, x as ComponentKind, y as DropdownInput, z as DropdownOption, F as EcsEntityEditorKind, p as EcsEntityKind, r as EntityId, G as EntityInput, H as FloatInput, J as IntersectionResult, o as ParentLookup, Y as SelectionListener, Z as SliderInput, _ as TextInput, $ as ToggleInput, a1 as Vec3, a2 as Vector2Input, a3 as Vector3Input, W as WorldEntityView } from './System-vrU46Vuw.js';
|
|
3
3
|
import '@dimforge/rapier3d-compat';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ac as AnyComponent, n as ComponentClass, ad as DEBUG_CHANGE_IGNORED_SYSTEMS, ae as WorldHistorySnapshot, af as cloneHistoryValue, ag as normalizeDebugValue } from './System-
|
|
1
|
+
export { ac as AnyComponent, n as ComponentClass, ad as DEBUG_CHANGE_IGNORED_SYSTEMS, ae as WorldHistorySnapshot, af as cloneHistoryValue, ag as normalizeDebugValue } from './System-vrU46Vuw.cjs';
|
|
2
2
|
import 'three';
|
|
3
3
|
import '@dimforge/rapier3d-compat';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ac as AnyComponent, n as ComponentClass, ad as DEBUG_CHANGE_IGNORED_SYSTEMS, ae as WorldHistorySnapshot, af as cloneHistoryValue, ag as normalizeDebugValue } from './System-
|
|
1
|
+
export { ac as AnyComponent, n as ComponentClass, ad as DEBUG_CHANGE_IGNORED_SYSTEMS, ae as WorldHistorySnapshot, af as cloneHistoryValue, ag as normalizeDebugValue } from './System-vrU46Vuw.js';
|
|
2
2
|
import 'three';
|
|
3
3
|
import '@dimforge/rapier3d-compat';
|