@relu-interactives/spatial-ecs 0.2.13 → 0.2.15
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-CTTwEGn1.d.cts → System-BeuJ1xt5.d.cts} +2 -0
- package/dist/{System-CTTwEGn1.d.ts → System-BeuJ1xt5.d.ts} +2 -0
- package/dist/{Video-CV1-u6hL.d.ts → Video-Cym2C52L.d.ts} +1 -1
- package/dist/{Video-BMWPYc3q.d.cts → Video-D4B-z74P.d.cts} +1 -1
- package/dist/{chunk-KDZ6VBRO.js → chunk-D3AKP6QQ.js} +33 -6
- package/dist/chunk-D3AKP6QQ.js.map +1 -0
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/docs/api/Behaviour/classes/Behaviour.md +29 -29
- package/dist/docs/api/Component/classes/Component.md +1 -1
- package/dist/docs/api/components/classes/AnimationComponent.md +26 -26
- package/dist/docs/api/components/classes/AudioComponent.md +19 -19
- package/dist/docs/api/components/classes/CameraComponent.md +14 -14
- package/dist/docs/api/components/classes/EntityType.md +3 -3
- package/dist/docs/api/components/classes/Environment.md +3 -3
- package/dist/docs/api/components/classes/ImageComponent.md +7 -7
- package/dist/docs/api/components/classes/ImageTarget.md +7 -7
- package/dist/docs/api/components/classes/ImageTargetAnchor.md +4 -4
- package/dist/docs/api/components/classes/InstanceSlotComponent.md +4 -4
- package/dist/docs/api/components/classes/InstancedMeshComponent.md +10 -10
- package/dist/docs/api/components/classes/LightComponent.md +6 -6
- package/dist/docs/api/components/classes/MaterialComponent.md +11 -11
- package/dist/docs/api/components/classes/MeshComponent.md +3 -3
- package/dist/docs/api/components/classes/MeshGeometryComponent.md +9 -9
- package/dist/docs/api/components/classes/ModelComponent.md +4 -4
- package/dist/docs/api/components/classes/Name.md +3 -3
- package/dist/docs/api/components/classes/Object3DRef.md +4 -4
- package/dist/docs/api/components/classes/ParentId.md +3 -3
- package/dist/docs/api/components/classes/PhysicsComponent.md +6 -6
- package/dist/docs/api/components/classes/Postprocessing.md +3 -3
- package/dist/docs/api/components/classes/ScriptComponent.md +5 -5
- package/dist/docs/api/components/classes/Selectable.md +3 -3
- package/dist/docs/api/components/classes/SelectionTransformState.md +5 -5
- package/dist/docs/api/components/classes/SpriteComponent.md +7 -7
- package/dist/docs/api/components/classes/TransformComponent.md +12 -12
- package/dist/docs/api/components/classes/VideoComponent.md +28 -28
- package/dist/docs/api/components/functions/normalizePhysicsState.md +1 -1
- package/dist/docs/api/components/type-aliases/AnimationComponentOptions.md +9 -9
- package/dist/docs/api/components/type-aliases/CameraComponentOptions.md +13 -13
- package/dist/docs/api/components/type-aliases/CameraProjection.md +1 -1
- package/dist/docs/api/components/type-aliases/CameraRuntimeType.md +1 -1
- package/dist/docs/api/components/type-aliases/ColliderShape.md +1 -1
- package/dist/docs/api/components/type-aliases/ColliderState.md +20 -20
- package/dist/docs/api/components/type-aliases/CubeMeshParameters.md +4 -4
- package/dist/docs/api/components/type-aliases/EditableMeshObjectKind.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentFogState.md +8 -8
- package/dist/docs/api/components/type-aliases/EnvironmentFogType.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentGradientEffect.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxState.md +7 -7
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxType.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentState.md +5 -5
- package/dist/docs/api/components/type-aliases/ImageTargetAnchorOptions.md +3 -3
- package/dist/docs/api/components/type-aliases/ImageTargetReference.md +7 -7
- package/dist/docs/api/components/type-aliases/InstanceTransform.md +13 -13
- package/dist/docs/api/components/type-aliases/InstancedMeshKind.md +1 -1
- package/dist/docs/api/components/type-aliases/LightValueState.md +11 -11
- package/dist/docs/api/components/type-aliases/MaterialTypeValue.md +1 -1
- package/dist/docs/api/components/type-aliases/MaterialValueState.md +28 -28
- package/dist/docs/api/components/type-aliases/MeshGeometryParameters.md +1 -1
- package/dist/docs/api/components/type-aliases/MeshGeometryParametersByKind.md +7 -7
- package/dist/docs/api/components/type-aliases/PhysicsState.md +3 -3
- package/dist/docs/api/components/type-aliases/PlaneMeshParameters.md +3 -3
- package/dist/docs/api/components/type-aliases/PostprocessingState.md +62 -62
- package/dist/docs/api/components/type-aliases/RadiusHeightMeshParameters.md +3 -3
- package/dist/docs/api/components/type-aliases/RadiusMeshParameters.md +2 -2
- package/dist/docs/api/components/type-aliases/RigidbodyState.md +17 -17
- package/dist/docs/api/components/type-aliases/RigidbodyType.md +1 -1
- package/dist/docs/api/components/type-aliases/ScriptEntry.md +9 -9
- package/dist/docs/api/components/type-aliases/TextureFilteringValue.md +1 -1
- package/dist/docs/api/components/type-aliases/TransformData.md +4 -4
- package/dist/docs/api/components/type-aliases/TransformModeValue.md +1 -1
- package/dist/docs/api/components/type-aliases/TransformSpaceValue.md +1 -1
- package/dist/docs/api/components/type-aliases/Vec3.md +4 -4
- package/dist/docs/api/components/variables/DEFAULT_COLLIDER_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_INSTANCED_MESH_PARAMETERS.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_INSTANCE_TRANSFORM.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_MESH_GEOMETRY_PARAMETERS.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_PHYSICS_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_POSTPROCESSING_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_RIGIDBODY_STATE.md +1 -1
- package/dist/docs/api/index/classes/AnimationStateMachine.md +16 -16
- package/dist/docs/api/index/classes/AnimationStateManager.md +13 -13
- package/dist/docs/api/index/classes/AnimationSystem.md +3 -3
- package/dist/docs/api/index/classes/AudioSystem.md +4 -4
- package/dist/docs/api/index/classes/CameraSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/EnvironmentSyncSystem.md +4 -4
- package/dist/docs/api/index/classes/InputSystem.md +33 -33
- package/dist/docs/api/index/classes/InstancedMeshSystem.md +2 -2
- package/dist/docs/api/index/classes/LightSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/MaterialSyncSystem.md +3 -3
- package/dist/docs/api/index/classes/MeshGeometrySystem.md +2 -2
- package/dist/docs/api/index/classes/ObjectManagementSystem.md +14 -14
- package/dist/docs/api/index/classes/ObjectVisibilitySystem.md +2 -2
- package/dist/docs/api/index/classes/PhysicsSyncSystem.md +4 -4
- package/dist/docs/api/index/classes/PostprocessingSyncSystem.md +4 -4
- package/dist/docs/api/index/classes/RenderSystem.md +3 -3
- package/dist/docs/api/index/classes/ScriptBehaviourSystem.md +4 -4
- package/dist/docs/api/index/classes/TransformSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/VideoSystem.md +4 -4
- package/dist/docs/api/index/classes/World.md +124 -84
- package/dist/docs/api/index/functions/createAnimationComponent.md +1 -1
- package/dist/docs/api/index/functions/createAudioComponent.md +1 -1
- package/dist/docs/api/index/functions/createCameraComponent.md +1 -1
- package/dist/docs/api/index/functions/createEntityTypeComponent.md +1 -1
- package/dist/docs/api/index/functions/createEnvironmentComponent.md +1 -1
- package/dist/docs/api/index/functions/createImageComponent.md +1 -1
- package/dist/docs/api/index/functions/createImageTargetAnchorComponent.md +1 -1
- package/dist/docs/api/index/functions/createImageTargetComponent.md +1 -1
- package/dist/docs/api/index/functions/createInstanceSlotComponent.md +1 -1
- package/dist/docs/api/index/functions/createInstancedMeshComponent.md +1 -1
- package/dist/docs/api/index/functions/createLightComponent.md +1 -1
- package/dist/docs/api/index/functions/createMaterialComponent.md +1 -1
- package/dist/docs/api/index/functions/createMeshComponent.md +1 -1
- package/dist/docs/api/index/functions/createMeshGeometryComponent.md +1 -1
- package/dist/docs/api/index/functions/createModelComponent.md +1 -1
- package/dist/docs/api/index/functions/createNameComponent.md +1 -1
- package/dist/docs/api/index/functions/createObject3DRefComponent.md +1 -1
- package/dist/docs/api/index/functions/createParentIdComponent.md +1 -1
- package/dist/docs/api/index/functions/createPhysicsComponent.md +1 -1
- package/dist/docs/api/index/functions/createPostprocessingComponent.md +1 -1
- package/dist/docs/api/index/functions/createScriptComponent.md +1 -1
- package/dist/docs/api/index/functions/createSelectableComponent.md +1 -1
- package/dist/docs/api/index/functions/createSelectionTransformStateComponent.md +1 -1
- package/dist/docs/api/index/functions/createSpriteComponent.md +1 -1
- package/dist/docs/api/index/functions/createTransformComponent.md +1 -1
- package/dist/docs/api/index/functions/createVideoComponent.md +1 -1
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshot.md +1 -1
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshotDetailed.md +1 -1
- package/dist/docs/api/index/functions/registerDefaultComponentFactories.md +1 -1
- package/dist/docs/api/index/functions/registerDefaultFactories.md +1 -1
- package/dist/docs/api/index/interfaces/EcsSystem.md +3 -3
- package/dist/docs/api/index/interfaces/StateMachine.md +13 -13
- package/dist/docs/api/index/type-aliases/AnimationStateCallbacks.md +4 -4
- package/dist/docs/api/index/type-aliases/ComponentFactory.md +1 -1
- package/dist/docs/api/index/type-aliases/EcsComponentFactoryKind.md +1 -1
- package/dist/docs/api/index/type-aliases/EcsWorldComponentSnapshot.md +3 -3
- package/dist/docs/api/index/type-aliases/EcsWorldStateSnapshotLike.md +4 -4
- package/dist/docs/api/index/type-aliases/HydrateWorldFromSnapshotResult.md +3 -3
- package/dist/docs/api/index/type-aliases/KeyboardKey.md +1 -1
- package/dist/docs/api/index/type-aliases/MouseButton.md +1 -1
- package/dist/docs/api/index/type-aliases/SelectionContext.md +4 -4
- package/dist/docs/api/index/variables/HYDRATABLE_ENTITY_KINDS.md +1 -1
- package/dist/docs/api/index/variables/KeyboardKeys.md +89 -89
- package/dist/docs/api/types/type-aliases/AssetInput.md +3 -3
- package/dist/docs/api/types/type-aliases/CheckboxInput.md +3 -3
- package/dist/docs/api/types/type-aliases/ColorInput.md +1 -1
- package/dist/docs/api/types/type-aliases/ComponentInput.md +4 -4
- package/dist/docs/api/types/type-aliases/ComponentKind.md +1 -1
- package/dist/docs/api/types/type-aliases/DropdownInput.md +3 -3
- package/dist/docs/api/types/type-aliases/DropdownOption.md +3 -3
- package/dist/docs/api/types/type-aliases/EcsEntityEditorKind.md +1 -1
- package/dist/docs/api/types/type-aliases/EcsEntityKind.md +1 -1
- package/dist/docs/api/types/type-aliases/EntityId.md +1 -1
- package/dist/docs/api/types/type-aliases/EntityInput.md +3 -3
- package/dist/docs/api/types/type-aliases/FloatInput.md +1 -1
- package/dist/docs/api/types/type-aliases/IntersectionResult.md +3 -3
- package/dist/docs/api/types/type-aliases/ParentLookup.md +3 -3
- package/dist/docs/api/types/type-aliases/SelectionListener.md +1 -1
- package/dist/docs/api/types/type-aliases/SliderInput.md +5 -5
- package/dist/docs/api/types/type-aliases/TextInput.md +1 -1
- package/dist/docs/api/types/type-aliases/ToggleInput.md +1 -1
- package/dist/docs/api/types/type-aliases/Vec3.md +1 -1
- package/dist/docs/api/types/type-aliases/Vector2Input.md +3 -3
- package/dist/docs/api/types/type-aliases/Vector3Input.md +4 -4
- package/dist/docs/api/types/type-aliases/WorldEntityView.md +1 -1
- package/dist/docs/guide/components/parent-id.md +25 -0
- package/dist/docs/guide/world-api.md +34 -0
- package/dist/factories/index.d.cts +2 -2
- package/dist/factories/index.d.ts +2 -2
- package/dist/{index-D7q4SRCp.d.cts → index-BfoOC2CG.d.cts} +2 -2
- package/dist/{index-ByX7502C.d.ts → index-BoJ3_6a3.d.ts} +2 -2
- package/dist/index.cjs +49 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/systems/index.cjs +31 -4
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +6 -2
- package/dist/systems/index.d.ts +6 -2
- package/dist/systems/index.js +1 -1
- 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-KDZ6VBRO.js.map +0 -1
package/dist/systems/index.cjs
CHANGED
|
@@ -5317,6 +5317,8 @@ var _AudioSystem = class _AudioSystem {
|
|
|
5317
5317
|
this.prevPlayingState = /* @__PURE__ */ new Map();
|
|
5318
5318
|
/** Snapshot of options applied in the previous frame, for change detection. */
|
|
5319
5319
|
this.prevOptions = /* @__PURE__ */ new Map();
|
|
5320
|
+
/** Tracks entities that were stopped due to invisibility. */
|
|
5321
|
+
this.stoppedDueToInvisibility = /* @__PURE__ */ new Set();
|
|
5320
5322
|
this.isEditor = isEditor;
|
|
5321
5323
|
}
|
|
5322
5324
|
update(world, _deltaTime) {
|
|
@@ -5328,12 +5330,21 @@ var _AudioSystem = class _AudioSystem {
|
|
|
5328
5330
|
if (!component?.audio) continue;
|
|
5329
5331
|
const sound = component.audio;
|
|
5330
5332
|
if (!world.isEntityVisible(entityId)) {
|
|
5331
|
-
if (sound.isPlaying)
|
|
5333
|
+
if (sound.isPlaying) {
|
|
5334
|
+
sound.stop();
|
|
5335
|
+
this.stoppedDueToInvisibility.add(entityId);
|
|
5336
|
+
}
|
|
5332
5337
|
continue;
|
|
5333
5338
|
}
|
|
5339
|
+
if (this.stoppedDueToInvisibility.has(entityId)) {
|
|
5340
|
+
this.stoppedDueToInvisibility.delete(entityId);
|
|
5341
|
+
if (component.isPlaying && !sound.isPlaying && sound.buffer) {
|
|
5342
|
+
sound.play();
|
|
5343
|
+
}
|
|
5344
|
+
}
|
|
5334
5345
|
this._syncOptions(entityId, component, sound);
|
|
5335
5346
|
const prevWasPlaying = this.prevPlayingState.get(entityId) ?? false;
|
|
5336
|
-
if (prevWasPlaying && !sound.isPlaying && component.isPlaying && !component.isPaused) {
|
|
5347
|
+
if (prevWasPlaying && !sound.isPlaying && component.isPlaying && !component.isPaused && !this.stoppedDueToInvisibility.has(entityId)) {
|
|
5337
5348
|
component.isPlaying = false;
|
|
5338
5349
|
}
|
|
5339
5350
|
if (component.isPlaying && !sound.isPlaying) {
|
|
@@ -5353,6 +5364,7 @@ var _AudioSystem = class _AudioSystem {
|
|
|
5353
5364
|
if (!liveEntityIds.has(entityId)) {
|
|
5354
5365
|
this.prevPlayingState.delete(entityId);
|
|
5355
5366
|
this.prevOptions.delete(entityId);
|
|
5367
|
+
this.stoppedDueToInvisibility.delete(entityId);
|
|
5356
5368
|
}
|
|
5357
5369
|
}
|
|
5358
5370
|
}
|
|
@@ -5385,6 +5397,7 @@ var _AudioSystem = class _AudioSystem {
|
|
|
5385
5397
|
dispose(_world) {
|
|
5386
5398
|
this.prevPlayingState.clear();
|
|
5387
5399
|
this.prevOptions.clear();
|
|
5400
|
+
this.stoppedDueToInvisibility.clear();
|
|
5388
5401
|
}
|
|
5389
5402
|
};
|
|
5390
5403
|
__name(_AudioSystem, "AudioSystem");
|
|
@@ -5412,6 +5425,8 @@ var _VideoSystem = class _VideoSystem {
|
|
|
5412
5425
|
this.prevIntent = /* @__PURE__ */ new Map();
|
|
5413
5426
|
/** Snapshot of options applied in the previous frame, for change detection. */
|
|
5414
5427
|
this.prevOptions = /* @__PURE__ */ new Map();
|
|
5428
|
+
/** Tracks entities that were manually paused due to invisibility. */
|
|
5429
|
+
this.pausedDueToInvisibility = /* @__PURE__ */ new Set();
|
|
5415
5430
|
this.isEditor = isEditor;
|
|
5416
5431
|
}
|
|
5417
5432
|
update(world, _deltaTime) {
|
|
@@ -5423,12 +5438,22 @@ var _VideoSystem = class _VideoSystem {
|
|
|
5423
5438
|
if (!component?.videoElement) continue;
|
|
5424
5439
|
const video = component.videoElement;
|
|
5425
5440
|
if (!world.isEntityVisible(entityId)) {
|
|
5426
|
-
if (!video.paused)
|
|
5441
|
+
if (!video.paused) {
|
|
5442
|
+
video.pause();
|
|
5443
|
+
this.pausedDueToInvisibility.add(entityId);
|
|
5444
|
+
}
|
|
5427
5445
|
continue;
|
|
5428
5446
|
}
|
|
5447
|
+
if (this.pausedDueToInvisibility.has(entityId)) {
|
|
5448
|
+
this.pausedDueToInvisibility.delete(entityId);
|
|
5449
|
+
if (component.isPlaying && video.paused) {
|
|
5450
|
+
video.play().catch(() => {
|
|
5451
|
+
});
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5429
5454
|
this._syncOptions(entityId, component, video);
|
|
5430
5455
|
const prev = this.prevIntent.get(entityId) ?? { isPlaying: false, isPaused: false };
|
|
5431
|
-
if (prev.isPlaying && video.paused && !video.seeking && component.isPlaying && !component.isPaused) {
|
|
5456
|
+
if (prev.isPlaying && video.paused && !video.seeking && component.isPlaying && !component.isPaused && !this.pausedDueToInvisibility.has(entityId)) {
|
|
5432
5457
|
component.isPlaying = false;
|
|
5433
5458
|
}
|
|
5434
5459
|
const isStoppedNow = !component.isPlaying && !component.isPaused;
|
|
@@ -5460,6 +5485,7 @@ var _VideoSystem = class _VideoSystem {
|
|
|
5460
5485
|
if (!liveEntityIds.has(entityId)) {
|
|
5461
5486
|
this.prevIntent.delete(entityId);
|
|
5462
5487
|
this.prevOptions.delete(entityId);
|
|
5488
|
+
this.pausedDueToInvisibility.delete(entityId);
|
|
5463
5489
|
}
|
|
5464
5490
|
}
|
|
5465
5491
|
}
|
|
@@ -5512,6 +5538,7 @@ var _VideoSystem = class _VideoSystem {
|
|
|
5512
5538
|
dispose(_world) {
|
|
5513
5539
|
this.prevIntent.clear();
|
|
5514
5540
|
this.prevOptions.clear();
|
|
5541
|
+
this.pausedDueToInvisibility.clear();
|
|
5515
5542
|
}
|
|
5516
5543
|
};
|
|
5517
5544
|
__name(_VideoSystem, "VideoSystem");
|