@relu-interactives/spatial-ecs 0.2.7 → 0.2.9
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-CIiWteft.d.cts → System-AV2_87Zr.d.cts} +1 -1
- package/dist/{System-CIiWteft.d.ts → System-AV2_87Zr.d.ts} +1 -1
- package/dist/{Video-Dj4KBqQ1.d.cts → Video-Bn93p6XV.d.cts} +27 -5
- package/dist/{Video-B-qMljTn.d.ts → Video-D6mObK_5.d.ts} +27 -5
- package/dist/{chunk-R5D5PWXV.js → chunk-AZR6SLQN.js} +16 -4
- package/dist/chunk-AZR6SLQN.js.map +1 -0
- package/dist/{chunk-EIC5B3A7.js → chunk-LE6ARNYQ.js} +84 -13
- package/dist/chunk-LE6ARNYQ.js.map +1 -0
- package/dist/{chunk-FDWNCXU3.js → chunk-ODCWJHPS.js} +3 -3
- package/dist/{chunk-FDWNCXU3.js.map → chunk-ODCWJHPS.js.map} +1 -1
- package/dist/{chunk-G2DUXNTQ.js → chunk-PHIEXEKJ.js} +10 -3
- package/dist/chunk-PHIEXEKJ.js.map +1 -0
- package/dist/{chunk-2F6T3BVO.js → chunk-SABZQFSA.js} +47 -29
- package/dist/chunk-SABZQFSA.js.map +1 -0
- package/dist/components/index.cjs +13 -1
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +1 -1
- package/dist/factories/index.cjs +92 -9
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +7 -4
- package/dist/factories/index.d.ts +7 -4
- package/dist/factories/index.js +3 -3
- package/dist/{index-Cf-PaKyN.d.ts → index-B4-ABchF.d.cts} +4 -3
- package/dist/{index-B12sx9yF.d.cts → index-BO49V8aS.d.ts} +4 -3
- package/dist/index.cjs +187 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +52 -14
- package/dist/index.js.map +1 -1
- package/dist/systems/index.cjs +44 -31
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -2
- package/dist/systems/index.d.ts +2 -2
- package/dist/systems/index.js +3 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/worldSnapshotUtils.cjs +8 -1
- package/dist/worldSnapshotUtils.cjs.map +1 -1
- package/dist/worldSnapshotUtils.d.cts +1 -1
- package/dist/worldSnapshotUtils.d.ts +1 -1
- package/dist/worldSnapshotUtils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2F6T3BVO.js.map +0 -1
- package/dist/chunk-EIC5B3A7.js.map +0 -1
- package/dist/chunk-G2DUXNTQ.js.map +0 -1
- package/dist/chunk-R5D5PWXV.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnimationComponent, a as AnimationComponentOptions, b as AudioComponent, C as CameraComponent, c as CameraComponentOptions, d as CameraProjection, e as CameraRuntimeType, f as ColliderShape, g as ColliderState, h as CubeMeshParameters, D as DEFAULT_COLLIDER_STATE, i as DEFAULT_ENVIRONMENT_STATE, j as DEFAULT_INSTANCED_MESH_PARAMETERS, k as DEFAULT_INSTANCE_TRANSFORM, l as DEFAULT_MESH_GEOMETRY_PARAMETERS, m as DEFAULT_PHYSICS_STATE, n as DEFAULT_POSTPROCESSING_STATE, o as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, p as EntityType, q as Environment, r as EnvironmentFogState, s as EnvironmentFogType, t as EnvironmentGradientEffect, u as EnvironmentSkyboxState, v as EnvironmentSkyboxType, w as EnvironmentState, I as ImageComponent, x as ImageTarget, y as ImageTargetAnchor, z as ImageTargetAnchorOptions, B as ImageTargetReference, F as
|
|
2
|
-
export { P as ParentId, T as TransformComponent, a as TransformData, V as Vec3 } from '../System-
|
|
1
|
+
export { A as AnimationComponent, a as AnimationComponentOptions, b as AudioComponent, C as CameraComponent, c as CameraComponentOptions, d as CameraProjection, e as CameraRuntimeType, f as ColliderShape, g as ColliderState, h as CubeMeshParameters, D as DEFAULT_COLLIDER_STATE, i as DEFAULT_ENVIRONMENT_STATE, j as DEFAULT_INSTANCED_MESH_PARAMETERS, k as DEFAULT_INSTANCE_TRANSFORM, l as DEFAULT_MESH_GEOMETRY_PARAMETERS, m as DEFAULT_PHYSICS_STATE, n as DEFAULT_POSTPROCESSING_STATE, o as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, p as EntityType, q as Environment, r as EnvironmentFogState, s as EnvironmentFogType, t as EnvironmentGradientEffect, u as EnvironmentSkyboxState, v as EnvironmentSkyboxType, w as EnvironmentState, I as ImageComponent, x as ImageTarget, y as ImageTargetAnchor, z as ImageTargetAnchorOptions, B as ImageTargetReference, F as InstanceSlotComponent, G as InstanceTransform, H as InstancedMeshComponent, J as InstancedMeshKind, L as LightComponent, K as LightValueState, M as MaterialComponent, N as MaterialTypeValue, O as MaterialValueState, P as MeshComponent, Q as MeshGeometryComponent, R as MeshGeometryParameters, S as MeshGeometryParametersByKind, T as ModelComponent, U as Name, V as Object3DRef, W as PhysicsComponent, X as PhysicsState, Y as PlaneMeshParameters, Z as Postprocessing, _ as PostprocessingState, $ as RadiusHeightMeshParameters, a0 as RadiusMeshParameters, a1 as RigidbodyState, a2 as RigidbodyType, a3 as ScriptComponent, a4 as ScriptEntry, a5 as Selectable, a6 as SelectionTransformState, a7 as SpriteComponent, a8 as TextureFilteringValue, a9 as TransformModeValue, aa as TransformSpaceValue, ab as VideoComponent, ac as normalizePhysicsState } from '../Video-Bn93p6XV.cjs';
|
|
2
|
+
export { P as ParentId, T as TransformComponent, a as TransformData, V as Vec3 } from '../System-AV2_87Zr.cjs';
|
|
3
3
|
import 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnimationComponent, a as AnimationComponentOptions, b as AudioComponent, C as CameraComponent, c as CameraComponentOptions, d as CameraProjection, e as CameraRuntimeType, f as ColliderShape, g as ColliderState, h as CubeMeshParameters, D as DEFAULT_COLLIDER_STATE, i as DEFAULT_ENVIRONMENT_STATE, j as DEFAULT_INSTANCED_MESH_PARAMETERS, k as DEFAULT_INSTANCE_TRANSFORM, l as DEFAULT_MESH_GEOMETRY_PARAMETERS, m as DEFAULT_PHYSICS_STATE, n as DEFAULT_POSTPROCESSING_STATE, o as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, p as EntityType, q as Environment, r as EnvironmentFogState, s as EnvironmentFogType, t as EnvironmentGradientEffect, u as EnvironmentSkyboxState, v as EnvironmentSkyboxType, w as EnvironmentState, I as ImageComponent, x as ImageTarget, y as ImageTargetAnchor, z as ImageTargetAnchorOptions, B as ImageTargetReference, F as
|
|
2
|
-
export { P as ParentId, T as TransformComponent, a as TransformData, V as Vec3 } from '../System-
|
|
1
|
+
export { A as AnimationComponent, a as AnimationComponentOptions, b as AudioComponent, C as CameraComponent, c as CameraComponentOptions, d as CameraProjection, e as CameraRuntimeType, f as ColliderShape, g as ColliderState, h as CubeMeshParameters, D as DEFAULT_COLLIDER_STATE, i as DEFAULT_ENVIRONMENT_STATE, j as DEFAULT_INSTANCED_MESH_PARAMETERS, k as DEFAULT_INSTANCE_TRANSFORM, l as DEFAULT_MESH_GEOMETRY_PARAMETERS, m as DEFAULT_PHYSICS_STATE, n as DEFAULT_POSTPROCESSING_STATE, o as DEFAULT_RIGIDBODY_STATE, E as EditableMeshObjectKind, p as EntityType, q as Environment, r as EnvironmentFogState, s as EnvironmentFogType, t as EnvironmentGradientEffect, u as EnvironmentSkyboxState, v as EnvironmentSkyboxType, w as EnvironmentState, I as ImageComponent, x as ImageTarget, y as ImageTargetAnchor, z as ImageTargetAnchorOptions, B as ImageTargetReference, F as InstanceSlotComponent, G as InstanceTransform, H as InstancedMeshComponent, J as InstancedMeshKind, L as LightComponent, K as LightValueState, M as MaterialComponent, N as MaterialTypeValue, O as MaterialValueState, P as MeshComponent, Q as MeshGeometryComponent, R as MeshGeometryParameters, S as MeshGeometryParametersByKind, T as ModelComponent, U as Name, V as Object3DRef, W as PhysicsComponent, X as PhysicsState, Y as PlaneMeshParameters, Z as Postprocessing, _ as PostprocessingState, $ as RadiusHeightMeshParameters, a0 as RadiusMeshParameters, a1 as RigidbodyState, a2 as RigidbodyType, a3 as ScriptComponent, a4 as ScriptEntry, a5 as Selectable, a6 as SelectionTransformState, a7 as SpriteComponent, a8 as TextureFilteringValue, a9 as TransformModeValue, aa as TransformSpaceValue, ab as VideoComponent, ac as normalizePhysicsState } from '../Video-D6mObK_5.js';
|
|
2
|
+
export { P as ParentId, T as TransformComponent, a as TransformData, V as Vec3 } from '../System-AV2_87Zr.js';
|
|
3
3
|
import 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnimationComponent, AudioComponent, CameraComponent, DEFAULT_COLLIDER_STATE, DEFAULT_ENVIRONMENT_STATE, DEFAULT_INSTANCED_MESH_PARAMETERS, DEFAULT_INSTANCE_TRANSFORM, DEFAULT_MESH_GEOMETRY_PARAMETERS, DEFAULT_PHYSICS_STATE, DEFAULT_POSTPROCESSING_STATE, DEFAULT_RIGIDBODY_STATE, EntityType, Environment, ImageComponent, ImageTarget, ImageTargetAnchor, InstancedMeshComponent, LightComponent, MaterialComponent, MeshComponent, MeshGeometryComponent, ModelComponent, Name, Object3DRef, ParentId, PhysicsComponent, Postprocessing, ScriptComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, VideoComponent, normalizePhysicsState } from '../chunk-
|
|
1
|
+
export { AnimationComponent, AudioComponent, CameraComponent, DEFAULT_COLLIDER_STATE, DEFAULT_ENVIRONMENT_STATE, DEFAULT_INSTANCED_MESH_PARAMETERS, DEFAULT_INSTANCE_TRANSFORM, DEFAULT_MESH_GEOMETRY_PARAMETERS, DEFAULT_PHYSICS_STATE, DEFAULT_POSTPROCESSING_STATE, DEFAULT_RIGIDBODY_STATE, EntityType, Environment, ImageComponent, ImageTarget, ImageTargetAnchor, InstanceSlotComponent, InstancedMeshComponent, LightComponent, MaterialComponent, MeshComponent, MeshGeometryComponent, ModelComponent, Name, Object3DRef, ParentId, PhysicsComponent, Postprocessing, ScriptComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, VideoComponent, normalizePhysicsState } from '../chunk-AZR6SLQN.js';
|
|
2
2
|
import '../chunk-OY7ZODZP.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/factories/index.cjs
CHANGED
|
@@ -1943,7 +1943,7 @@ var _InstancedMeshComponent = class _InstancedMeshComponent extends Component {
|
|
|
1943
1943
|
};
|
|
1944
1944
|
this.castShadow = options?.castShadow ?? false;
|
|
1945
1945
|
this.receiveShadow = options?.receiveShadow ?? false;
|
|
1946
|
-
this.
|
|
1946
|
+
this.instanceEntityIds = options?.instanceEntityIds ?? [];
|
|
1947
1947
|
this.instancedMesh = null;
|
|
1948
1948
|
}
|
|
1949
1949
|
/** Sanitize and return a copy of the current mesh parameters with valid values. */
|
|
@@ -1995,6 +1995,25 @@ function createInstancedMeshComponent(world, entityId, meshKind, meshParameters,
|
|
|
1995
1995
|
}
|
|
1996
1996
|
__name(createInstancedMeshComponent, "createInstancedMeshComponent");
|
|
1997
1997
|
|
|
1998
|
+
// core/components/InstanceSlotComponent.ts
|
|
1999
|
+
var _InstanceSlotComponent = class _InstanceSlotComponent extends Component {
|
|
2000
|
+
constructor(groupEntityId, slotIndex) {
|
|
2001
|
+
super();
|
|
2002
|
+
this.groupEntityId = groupEntityId;
|
|
2003
|
+
this.slotIndex = slotIndex;
|
|
2004
|
+
}
|
|
2005
|
+
};
|
|
2006
|
+
__name(_InstanceSlotComponent, "InstanceSlotComponent");
|
|
2007
|
+
var InstanceSlotComponent = _InstanceSlotComponent;
|
|
2008
|
+
|
|
2009
|
+
// core/factories/components/InstanceSlotComponentFactory.ts
|
|
2010
|
+
function createInstanceSlotComponent(world, entityId, groupEntityId, slotIndex) {
|
|
2011
|
+
const component = new InstanceSlotComponent(groupEntityId, slotIndex);
|
|
2012
|
+
world.addComponent(entityId, component);
|
|
2013
|
+
return component;
|
|
2014
|
+
}
|
|
2015
|
+
__name(createInstanceSlotComponent, "createInstanceSlotComponent");
|
|
2016
|
+
|
|
1998
2017
|
// core/components/Video.ts
|
|
1999
2018
|
var DEFAULT_VIDEO_OPTIONS = {
|
|
2000
2019
|
autoplay: false,
|
|
@@ -2583,13 +2602,32 @@ function createImageTarget({
|
|
|
2583
2602
|
}
|
|
2584
2603
|
__name(createImageTarget, "createImageTarget");
|
|
2585
2604
|
function isInstancedMeshKind(value) {
|
|
2586
|
-
return value === "cube" || value === "sphere" || value === "plane" || value === "cylinder" || value === "capsule";
|
|
2605
|
+
return value === "cube" || value === "sphere" || value === "plane" || value === "cylinder" || value === "capsule" || value === "model";
|
|
2587
2606
|
}
|
|
2588
2607
|
__name(isInstancedMeshKind, "isInstancedMeshKind");
|
|
2589
|
-
function
|
|
2590
|
-
|
|
2608
|
+
function createInstanceSlotEntity(world, groupEntityId, slotIndex, label, transform) {
|
|
2609
|
+
const instanceEntityId = world.createEntity();
|
|
2610
|
+
world.addComponent(instanceEntityId, new Name(label));
|
|
2611
|
+
world.addComponent(
|
|
2612
|
+
instanceEntityId,
|
|
2613
|
+
createTransform(
|
|
2614
|
+
transform ? {
|
|
2615
|
+
position: transform.position,
|
|
2616
|
+
rotation: transform.rotation,
|
|
2617
|
+
scale: transform.scale
|
|
2618
|
+
} : void 0
|
|
2619
|
+
)
|
|
2620
|
+
);
|
|
2621
|
+
world.addComponent(
|
|
2622
|
+
instanceEntityId,
|
|
2623
|
+
new InstanceSlotComponent(groupEntityId, slotIndex)
|
|
2624
|
+
);
|
|
2625
|
+
world.addComponent(instanceEntityId, new EntityType("instanceSlot"));
|
|
2626
|
+
world.addComponent(instanceEntityId, new Selectable(true));
|
|
2627
|
+
world.addComponent(instanceEntityId, new ParentId(groupEntityId));
|
|
2628
|
+
return instanceEntityId;
|
|
2591
2629
|
}
|
|
2592
|
-
__name(
|
|
2630
|
+
__name(createInstanceSlotEntity, "createInstanceSlotEntity");
|
|
2593
2631
|
function createInstancedMesh({
|
|
2594
2632
|
world,
|
|
2595
2633
|
scene,
|
|
@@ -2599,25 +2637,68 @@ function createInstancedMesh({
|
|
|
2599
2637
|
const opts = payload.options ?? {};
|
|
2600
2638
|
const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
|
|
2601
2639
|
const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
|
|
2602
|
-
const instances = isInstanceTransformArray(
|
|
2603
|
-
opts.instances
|
|
2604
|
-
) ? opts.instances : void 0;
|
|
2605
2640
|
const castShadow = typeof opts.castShadow === "boolean" ? opts.castShadow : false;
|
|
2606
2641
|
const receiveShadow = typeof opts.receiveShadow === "boolean" ? opts.receiveShadow : false;
|
|
2642
|
+
const modelPath = typeof opts.modelPath === "string" ? opts.modelPath : void 0;
|
|
2607
2643
|
const entityId = createBaseEntity(world, anchor, {
|
|
2608
2644
|
label: payload.name ?? "Instanced Mesh",
|
|
2609
2645
|
entityType: "instancedMesh",
|
|
2610
2646
|
transformInput: payload.transform
|
|
2611
2647
|
});
|
|
2648
|
+
let instanceEntityIds = [];
|
|
2649
|
+
if (Array.isArray(opts.instanceEntityIds)) {
|
|
2650
|
+
instanceEntityIds = [];
|
|
2651
|
+
} else if (Array.isArray(opts.instances) && opts.instances.length > 0) {
|
|
2652
|
+
const legacyInstances = opts.instances;
|
|
2653
|
+
for (let i = 0; i < legacyInstances.length; i++) {
|
|
2654
|
+
const slotId = createInstanceSlotEntity(
|
|
2655
|
+
world,
|
|
2656
|
+
entityId,
|
|
2657
|
+
i,
|
|
2658
|
+
`Instance ${i + 1}`,
|
|
2659
|
+
legacyInstances[i]
|
|
2660
|
+
);
|
|
2661
|
+
instanceEntityIds.push(slotId);
|
|
2662
|
+
}
|
|
2663
|
+
} else {
|
|
2664
|
+
const slotId = createInstanceSlotEntity(
|
|
2665
|
+
world,
|
|
2666
|
+
entityId,
|
|
2667
|
+
0,
|
|
2668
|
+
"Instance 1",
|
|
2669
|
+
{ ...DEFAULT_INSTANCE_TRANSFORM }
|
|
2670
|
+
);
|
|
2671
|
+
instanceEntityIds = [slotId];
|
|
2672
|
+
}
|
|
2612
2673
|
createInstancedMeshComponent(world, entityId, meshKind, meshParameters, {
|
|
2613
2674
|
castShadow,
|
|
2614
2675
|
receiveShadow,
|
|
2615
|
-
|
|
2676
|
+
instanceEntityIds,
|
|
2677
|
+
modelPath
|
|
2616
2678
|
});
|
|
2617
2679
|
scene.add(anchor);
|
|
2618
2680
|
return entityId;
|
|
2619
2681
|
}
|
|
2620
2682
|
__name(createInstancedMesh, "createInstancedMesh");
|
|
2683
|
+
|
|
2684
|
+
// core/factories/objects/InstanceSlotFactory.ts
|
|
2685
|
+
function createInstanceSlot({ world, payload }) {
|
|
2686
|
+
const opts = payload.options ?? {};
|
|
2687
|
+
const groupEntityId = typeof opts.groupEntityId === "number" ? opts.groupEntityId : -1;
|
|
2688
|
+
const slotIndex = typeof opts.slotIndex === "number" ? opts.slotIndex : 0;
|
|
2689
|
+
const entityId = world.createEntity();
|
|
2690
|
+
world.addComponent(
|
|
2691
|
+
entityId,
|
|
2692
|
+
new Name(payload.name ?? `Instance ${slotIndex + 1}`)
|
|
2693
|
+
);
|
|
2694
|
+
world.addComponent(entityId, createTransform(payload.transform));
|
|
2695
|
+
world.addComponent(entityId, new InstanceSlotComponent(groupEntityId, slotIndex));
|
|
2696
|
+
world.addComponent(entityId, new EntityType("instanceSlot"));
|
|
2697
|
+
world.addComponent(entityId, new Selectable(true));
|
|
2698
|
+
world.addComponent(entityId, new ParentId(groupEntityId !== -1 ? groupEntityId : null));
|
|
2699
|
+
return entityId;
|
|
2700
|
+
}
|
|
2701
|
+
__name(createInstanceSlot, "createInstanceSlot");
|
|
2621
2702
|
function createAmbientLight({
|
|
2622
2703
|
world,
|
|
2623
2704
|
scene,
|
|
@@ -3149,6 +3230,7 @@ function registerDefaultFactories(objectManagementSystem) {
|
|
|
3149
3230
|
objectManagementSystem.register("image", createImage);
|
|
3150
3231
|
objectManagementSystem.register("imageTarget", createImageTarget);
|
|
3151
3232
|
objectManagementSystem.register("instancedMesh", createInstancedMesh);
|
|
3233
|
+
objectManagementSystem.register("instanceSlot", createInstanceSlot);
|
|
3152
3234
|
objectManagementSystem.register("sprite", createSprite);
|
|
3153
3235
|
objectManagementSystem.register("audio", createAudio);
|
|
3154
3236
|
objectManagementSystem.register("camera", createCamera);
|
|
@@ -3170,6 +3252,7 @@ exports.createEnvironmentComponent = createEnvironmentComponent;
|
|
|
3170
3252
|
exports.createImageComponent = createImageComponent;
|
|
3171
3253
|
exports.createImageTargetAnchorComponent = createImageTargetAnchorComponent;
|
|
3172
3254
|
exports.createImageTargetComponent = createImageTargetComponent;
|
|
3255
|
+
exports.createInstanceSlotComponent = createInstanceSlotComponent;
|
|
3173
3256
|
exports.createInstancedMeshComponent = createInstancedMeshComponent;
|
|
3174
3257
|
exports.createLightComponent = createLightComponent;
|
|
3175
3258
|
exports.createMaterialComponent = createMaterialComponent;
|