@relu-interactives/spatial-ecs 0.2.7 → 0.2.8
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-TVBWYIGY.js} +42 -28
- package/dist/chunk-TVBWYIGY.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 +182 -39
- 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 +39 -30
- 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,5 +1,5 @@
|
|
|
1
|
-
import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent,
|
|
2
|
-
import { b as World, P as ParentId, T as TransformComponent, O as ObjectManagementSystem } from '../System-
|
|
1
|
+
import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, a1 as RigidbodyState, g as ColliderState, W as PhysicsComponent, w as EnvironmentState, q as Environment, p as EntityType, I as ImageComponent, y as ImageTargetAnchor, x as ImageTarget, L as LightComponent, M as MaterialComponent, P as MeshComponent, Q as MeshGeometryComponent, T as ModelComponent, U as Name, V as Object3DRef, _ as PostprocessingState, Z as Postprocessing, a4 as ScriptEntry, a3 as ScriptComponent, a5 as Selectable, a6 as SelectionTransformState, a7 as SpriteComponent, J as InstancedMeshKind, R as MeshGeometryParameters, H as InstancedMeshComponent, F as InstanceSlotComponent, ab as VideoComponent } from '../Video-Bn93p6XV.cjs';
|
|
2
|
+
import { b as World, P as ParentId, T as TransformComponent, O as ObjectManagementSystem } from '../System-AV2_87Zr.cjs';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
|
5
5
|
|
|
@@ -63,13 +63,16 @@ declare function createTransformComponent(world: World, entityId: number, ...arg
|
|
|
63
63
|
declare function createInstancedMeshComponent(world: World, entityId: number, meshKind: InstancedMeshKind, meshParameters?: Partial<MeshGeometryParameters>, options?: {
|
|
64
64
|
castShadow?: boolean;
|
|
65
65
|
receiveShadow?: boolean;
|
|
66
|
-
|
|
66
|
+
instanceEntityIds?: number[];
|
|
67
|
+
modelPath?: string;
|
|
67
68
|
}): InstancedMeshComponent;
|
|
68
69
|
|
|
70
|
+
declare function createInstanceSlotComponent(world: World, entityId: number, groupEntityId: number, slotIndex: number): InstanceSlotComponent;
|
|
71
|
+
|
|
69
72
|
declare function createVideoComponent(world: World, entityId: number, ...args: ConstructorParameters<typeof VideoComponent>): VideoComponent;
|
|
70
73
|
|
|
71
74
|
declare function registerDefaultComponentFactories(objectManagementSystem: ObjectManagementSystem): void;
|
|
72
75
|
|
|
73
76
|
declare function registerDefaultFactories(objectManagementSystem: ObjectManagementSystem): void;
|
|
74
77
|
|
|
75
|
-
export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVideoComponent, registerDefaultComponentFactories, registerDefaultFactories };
|
|
78
|
+
export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVideoComponent, registerDefaultComponentFactories, registerDefaultFactories };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent,
|
|
2
|
-
import { b as World, P as ParentId, T as TransformComponent, O as ObjectManagementSystem } from '../System-
|
|
1
|
+
import { A as AnimationComponent, b as AudioComponent, c as CameraComponentOptions, C as CameraComponent, a1 as RigidbodyState, g as ColliderState, W as PhysicsComponent, w as EnvironmentState, q as Environment, p as EntityType, I as ImageComponent, y as ImageTargetAnchor, x as ImageTarget, L as LightComponent, M as MaterialComponent, P as MeshComponent, Q as MeshGeometryComponent, T as ModelComponent, U as Name, V as Object3DRef, _ as PostprocessingState, Z as Postprocessing, a4 as ScriptEntry, a3 as ScriptComponent, a5 as Selectable, a6 as SelectionTransformState, a7 as SpriteComponent, J as InstancedMeshKind, R as MeshGeometryParameters, H as InstancedMeshComponent, F as InstanceSlotComponent, ab as VideoComponent } from '../Video-D6mObK_5.js';
|
|
2
|
+
import { b as World, P as ParentId, T as TransformComponent, O as ObjectManagementSystem } from '../System-AV2_87Zr.js';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
|
5
5
|
|
|
@@ -63,13 +63,16 @@ declare function createTransformComponent(world: World, entityId: number, ...arg
|
|
|
63
63
|
declare function createInstancedMeshComponent(world: World, entityId: number, meshKind: InstancedMeshKind, meshParameters?: Partial<MeshGeometryParameters>, options?: {
|
|
64
64
|
castShadow?: boolean;
|
|
65
65
|
receiveShadow?: boolean;
|
|
66
|
-
|
|
66
|
+
instanceEntityIds?: number[];
|
|
67
|
+
modelPath?: string;
|
|
67
68
|
}): InstancedMeshComponent;
|
|
68
69
|
|
|
70
|
+
declare function createInstanceSlotComponent(world: World, entityId: number, groupEntityId: number, slotIndex: number): InstanceSlotComponent;
|
|
71
|
+
|
|
69
72
|
declare function createVideoComponent(world: World, entityId: number, ...args: ConstructorParameters<typeof VideoComponent>): VideoComponent;
|
|
70
73
|
|
|
71
74
|
declare function registerDefaultComponentFactories(objectManagementSystem: ObjectManagementSystem): void;
|
|
72
75
|
|
|
73
76
|
declare function registerDefaultFactories(objectManagementSystem: ObjectManagementSystem): void;
|
|
74
77
|
|
|
75
|
-
export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVideoComponent, registerDefaultComponentFactories, registerDefaultFactories };
|
|
78
|
+
export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVideoComponent, registerDefaultComponentFactories, registerDefaultFactories };
|
package/dist/factories/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVideoComponent, registerDefaultComponentFactories, registerDefaultFactories } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVideoComponent, registerDefaultComponentFactories, registerDefaultFactories } from '../chunk-LE6ARNYQ.js';
|
|
2
|
+
import '../chunk-ODCWJHPS.js';
|
|
3
|
+
import '../chunk-AZR6SLQN.js';
|
|
4
4
|
import '../chunk-OY7ZODZP.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { 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
|
-
import { P as ParentId, T as TransformComponent, a as TransformData, V as Vec3 } from './System-
|
|
1
|
+
import { 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
|
+
import { P as ParentId, T as TransformComponent, a as TransformData, V as Vec3 } from './System-AV2_87Zr.cjs';
|
|
3
3
|
|
|
4
4
|
declare const index_AnimationComponent: typeof AnimationComponent;
|
|
5
5
|
declare const index_AnimationComponentOptions: typeof AnimationComponentOptions;
|
|
@@ -33,6 +33,7 @@ declare const index_ImageTarget: typeof ImageTarget;
|
|
|
33
33
|
declare const index_ImageTargetAnchor: typeof ImageTargetAnchor;
|
|
34
34
|
declare const index_ImageTargetAnchorOptions: typeof ImageTargetAnchorOptions;
|
|
35
35
|
declare const index_ImageTargetReference: typeof ImageTargetReference;
|
|
36
|
+
declare const index_InstanceSlotComponent: typeof InstanceSlotComponent;
|
|
36
37
|
declare const index_InstanceTransform: typeof InstanceTransform;
|
|
37
38
|
declare const index_InstancedMeshComponent: typeof InstancedMeshComponent;
|
|
38
39
|
declare const index_InstancedMeshKind: typeof InstancedMeshKind;
|
|
@@ -72,7 +73,7 @@ declare const index_Vec3: typeof Vec3;
|
|
|
72
73
|
declare const index_VideoComponent: typeof VideoComponent;
|
|
73
74
|
declare const index_normalizePhysicsState: typeof normalizePhysicsState;
|
|
74
75
|
declare namespace index {
|
|
75
|
-
export { index_AnimationComponent as AnimationComponent, index_AnimationComponentOptions as AnimationComponentOptions, index_AudioComponent as AudioComponent, index_CameraComponent as CameraComponent, index_CameraComponentOptions as CameraComponentOptions, index_CameraProjection as CameraProjection, index_CameraRuntimeType as CameraRuntimeType, index_ColliderShape as ColliderShape, index_ColliderState as ColliderState, index_CubeMeshParameters as CubeMeshParameters, index_DEFAULT_COLLIDER_STATE as DEFAULT_COLLIDER_STATE, index_DEFAULT_ENVIRONMENT_STATE as DEFAULT_ENVIRONMENT_STATE, index_DEFAULT_INSTANCED_MESH_PARAMETERS as DEFAULT_INSTANCED_MESH_PARAMETERS, index_DEFAULT_INSTANCE_TRANSFORM as DEFAULT_INSTANCE_TRANSFORM, index_DEFAULT_MESH_GEOMETRY_PARAMETERS as DEFAULT_MESH_GEOMETRY_PARAMETERS, index_DEFAULT_PHYSICS_STATE as DEFAULT_PHYSICS_STATE, index_DEFAULT_POSTPROCESSING_STATE as DEFAULT_POSTPROCESSING_STATE, index_DEFAULT_RIGIDBODY_STATE as DEFAULT_RIGIDBODY_STATE, index_EditableMeshObjectKind as EditableMeshObjectKind, index_EntityType as EntityType, index_Environment as Environment, index_EnvironmentFogState as EnvironmentFogState, index_EnvironmentFogType as EnvironmentFogType, index_EnvironmentGradientEffect as EnvironmentGradientEffect, index_EnvironmentSkyboxState as EnvironmentSkyboxState, index_EnvironmentSkyboxType as EnvironmentSkyboxType, index_EnvironmentState as EnvironmentState, index_ImageComponent as ImageComponent, index_ImageTarget as ImageTarget, index_ImageTargetAnchor as ImageTargetAnchor, index_ImageTargetAnchorOptions as ImageTargetAnchorOptions, index_ImageTargetReference as ImageTargetReference, index_InstanceTransform as InstanceTransform, index_InstancedMeshComponent as InstancedMeshComponent, index_InstancedMeshKind as InstancedMeshKind, index_LightComponent as LightComponent, index_LightValueState as LightValueState, index_MaterialComponent as MaterialComponent, index_MaterialTypeValue as MaterialTypeValue, index_MaterialValueState as MaterialValueState, index_MeshComponent as MeshComponent, index_MeshGeometryComponent as MeshGeometryComponent, index_MeshGeometryParameters as MeshGeometryParameters, index_MeshGeometryParametersByKind as MeshGeometryParametersByKind, index_ModelComponent as ModelComponent, index_Name as Name, index_Object3DRef as Object3DRef, index_ParentId as ParentId, index_PhysicsComponent as PhysicsComponent, index_PhysicsState as PhysicsState, index_PlaneMeshParameters as PlaneMeshParameters, index_Postprocessing as Postprocessing, index_PostprocessingState as PostprocessingState, index_RadiusHeightMeshParameters as RadiusHeightMeshParameters, index_RadiusMeshParameters as RadiusMeshParameters, index_RigidbodyState as RigidbodyState, index_RigidbodyType as RigidbodyType, index_ScriptComponent as ScriptComponent, index_ScriptEntry as ScriptEntry, index_Selectable as Selectable, index_SelectionTransformState as SelectionTransformState, index_SpriteComponent as SpriteComponent, index_TextureFilteringValue as TextureFilteringValue, index_TransformComponent as TransformComponent, index_TransformData as TransformData, index_TransformModeValue as TransformModeValue, index_TransformSpaceValue as TransformSpaceValue, index_Vec3 as Vec3, index_VideoComponent as VideoComponent, index_normalizePhysicsState as normalizePhysicsState };
|
|
76
|
+
export { index_AnimationComponent as AnimationComponent, index_AnimationComponentOptions as AnimationComponentOptions, index_AudioComponent as AudioComponent, index_CameraComponent as CameraComponent, index_CameraComponentOptions as CameraComponentOptions, index_CameraProjection as CameraProjection, index_CameraRuntimeType as CameraRuntimeType, index_ColliderShape as ColliderShape, index_ColliderState as ColliderState, index_CubeMeshParameters as CubeMeshParameters, index_DEFAULT_COLLIDER_STATE as DEFAULT_COLLIDER_STATE, index_DEFAULT_ENVIRONMENT_STATE as DEFAULT_ENVIRONMENT_STATE, index_DEFAULT_INSTANCED_MESH_PARAMETERS as DEFAULT_INSTANCED_MESH_PARAMETERS, index_DEFAULT_INSTANCE_TRANSFORM as DEFAULT_INSTANCE_TRANSFORM, index_DEFAULT_MESH_GEOMETRY_PARAMETERS as DEFAULT_MESH_GEOMETRY_PARAMETERS, index_DEFAULT_PHYSICS_STATE as DEFAULT_PHYSICS_STATE, index_DEFAULT_POSTPROCESSING_STATE as DEFAULT_POSTPROCESSING_STATE, index_DEFAULT_RIGIDBODY_STATE as DEFAULT_RIGIDBODY_STATE, index_EditableMeshObjectKind as EditableMeshObjectKind, index_EntityType as EntityType, index_Environment as Environment, index_EnvironmentFogState as EnvironmentFogState, index_EnvironmentFogType as EnvironmentFogType, index_EnvironmentGradientEffect as EnvironmentGradientEffect, index_EnvironmentSkyboxState as EnvironmentSkyboxState, index_EnvironmentSkyboxType as EnvironmentSkyboxType, index_EnvironmentState as EnvironmentState, index_ImageComponent as ImageComponent, index_ImageTarget as ImageTarget, index_ImageTargetAnchor as ImageTargetAnchor, index_ImageTargetAnchorOptions as ImageTargetAnchorOptions, index_ImageTargetReference as ImageTargetReference, index_InstanceSlotComponent as InstanceSlotComponent, index_InstanceTransform as InstanceTransform, index_InstancedMeshComponent as InstancedMeshComponent, index_InstancedMeshKind as InstancedMeshKind, index_LightComponent as LightComponent, index_LightValueState as LightValueState, index_MaterialComponent as MaterialComponent, index_MaterialTypeValue as MaterialTypeValue, index_MaterialValueState as MaterialValueState, index_MeshComponent as MeshComponent, index_MeshGeometryComponent as MeshGeometryComponent, index_MeshGeometryParameters as MeshGeometryParameters, index_MeshGeometryParametersByKind as MeshGeometryParametersByKind, index_ModelComponent as ModelComponent, index_Name as Name, index_Object3DRef as Object3DRef, index_ParentId as ParentId, index_PhysicsComponent as PhysicsComponent, index_PhysicsState as PhysicsState, index_PlaneMeshParameters as PlaneMeshParameters, index_Postprocessing as Postprocessing, index_PostprocessingState as PostprocessingState, index_RadiusHeightMeshParameters as RadiusHeightMeshParameters, index_RadiusMeshParameters as RadiusMeshParameters, index_RigidbodyState as RigidbodyState, index_RigidbodyType as RigidbodyType, index_ScriptComponent as ScriptComponent, index_ScriptEntry as ScriptEntry, index_Selectable as Selectable, index_SelectionTransformState as SelectionTransformState, index_SpriteComponent as SpriteComponent, index_TextureFilteringValue as TextureFilteringValue, index_TransformComponent as TransformComponent, index_TransformData as TransformData, index_TransformModeValue as TransformModeValue, index_TransformSpaceValue as TransformSpaceValue, index_Vec3 as Vec3, index_VideoComponent as VideoComponent, index_normalizePhysicsState as normalizePhysicsState };
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
export { index as i };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { 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
|
-
import { P as ParentId, T as TransformComponent, a as TransformData, V as Vec3 } from './System-
|
|
1
|
+
import { 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
|
+
import { P as ParentId, T as TransformComponent, a as TransformData, V as Vec3 } from './System-AV2_87Zr.js';
|
|
3
3
|
|
|
4
4
|
declare const index_AnimationComponent: typeof AnimationComponent;
|
|
5
5
|
declare const index_AnimationComponentOptions: typeof AnimationComponentOptions;
|
|
@@ -33,6 +33,7 @@ declare const index_ImageTarget: typeof ImageTarget;
|
|
|
33
33
|
declare const index_ImageTargetAnchor: typeof ImageTargetAnchor;
|
|
34
34
|
declare const index_ImageTargetAnchorOptions: typeof ImageTargetAnchorOptions;
|
|
35
35
|
declare const index_ImageTargetReference: typeof ImageTargetReference;
|
|
36
|
+
declare const index_InstanceSlotComponent: typeof InstanceSlotComponent;
|
|
36
37
|
declare const index_InstanceTransform: typeof InstanceTransform;
|
|
37
38
|
declare const index_InstancedMeshComponent: typeof InstancedMeshComponent;
|
|
38
39
|
declare const index_InstancedMeshKind: typeof InstancedMeshKind;
|
|
@@ -72,7 +73,7 @@ declare const index_Vec3: typeof Vec3;
|
|
|
72
73
|
declare const index_VideoComponent: typeof VideoComponent;
|
|
73
74
|
declare const index_normalizePhysicsState: typeof normalizePhysicsState;
|
|
74
75
|
declare namespace index {
|
|
75
|
-
export { index_AnimationComponent as AnimationComponent, index_AnimationComponentOptions as AnimationComponentOptions, index_AudioComponent as AudioComponent, index_CameraComponent as CameraComponent, index_CameraComponentOptions as CameraComponentOptions, index_CameraProjection as CameraProjection, index_CameraRuntimeType as CameraRuntimeType, index_ColliderShape as ColliderShape, index_ColliderState as ColliderState, index_CubeMeshParameters as CubeMeshParameters, index_DEFAULT_COLLIDER_STATE as DEFAULT_COLLIDER_STATE, index_DEFAULT_ENVIRONMENT_STATE as DEFAULT_ENVIRONMENT_STATE, index_DEFAULT_INSTANCED_MESH_PARAMETERS as DEFAULT_INSTANCED_MESH_PARAMETERS, index_DEFAULT_INSTANCE_TRANSFORM as DEFAULT_INSTANCE_TRANSFORM, index_DEFAULT_MESH_GEOMETRY_PARAMETERS as DEFAULT_MESH_GEOMETRY_PARAMETERS, index_DEFAULT_PHYSICS_STATE as DEFAULT_PHYSICS_STATE, index_DEFAULT_POSTPROCESSING_STATE as DEFAULT_POSTPROCESSING_STATE, index_DEFAULT_RIGIDBODY_STATE as DEFAULT_RIGIDBODY_STATE, index_EditableMeshObjectKind as EditableMeshObjectKind, index_EntityType as EntityType, index_Environment as Environment, index_EnvironmentFogState as EnvironmentFogState, index_EnvironmentFogType as EnvironmentFogType, index_EnvironmentGradientEffect as EnvironmentGradientEffect, index_EnvironmentSkyboxState as EnvironmentSkyboxState, index_EnvironmentSkyboxType as EnvironmentSkyboxType, index_EnvironmentState as EnvironmentState, index_ImageComponent as ImageComponent, index_ImageTarget as ImageTarget, index_ImageTargetAnchor as ImageTargetAnchor, index_ImageTargetAnchorOptions as ImageTargetAnchorOptions, index_ImageTargetReference as ImageTargetReference, index_InstanceTransform as InstanceTransform, index_InstancedMeshComponent as InstancedMeshComponent, index_InstancedMeshKind as InstancedMeshKind, index_LightComponent as LightComponent, index_LightValueState as LightValueState, index_MaterialComponent as MaterialComponent, index_MaterialTypeValue as MaterialTypeValue, index_MaterialValueState as MaterialValueState, index_MeshComponent as MeshComponent, index_MeshGeometryComponent as MeshGeometryComponent, index_MeshGeometryParameters as MeshGeometryParameters, index_MeshGeometryParametersByKind as MeshGeometryParametersByKind, index_ModelComponent as ModelComponent, index_Name as Name, index_Object3DRef as Object3DRef, index_ParentId as ParentId, index_PhysicsComponent as PhysicsComponent, index_PhysicsState as PhysicsState, index_PlaneMeshParameters as PlaneMeshParameters, index_Postprocessing as Postprocessing, index_PostprocessingState as PostprocessingState, index_RadiusHeightMeshParameters as RadiusHeightMeshParameters, index_RadiusMeshParameters as RadiusMeshParameters, index_RigidbodyState as RigidbodyState, index_RigidbodyType as RigidbodyType, index_ScriptComponent as ScriptComponent, index_ScriptEntry as ScriptEntry, index_Selectable as Selectable, index_SelectionTransformState as SelectionTransformState, index_SpriteComponent as SpriteComponent, index_TextureFilteringValue as TextureFilteringValue, index_TransformComponent as TransformComponent, index_TransformData as TransformData, index_TransformModeValue as TransformModeValue, index_TransformSpaceValue as TransformSpaceValue, index_Vec3 as Vec3, index_VideoComponent as VideoComponent, index_normalizePhysicsState as normalizePhysicsState };
|
|
76
|
+
export { index_AnimationComponent as AnimationComponent, index_AnimationComponentOptions as AnimationComponentOptions, index_AudioComponent as AudioComponent, index_CameraComponent as CameraComponent, index_CameraComponentOptions as CameraComponentOptions, index_CameraProjection as CameraProjection, index_CameraRuntimeType as CameraRuntimeType, index_ColliderShape as ColliderShape, index_ColliderState as ColliderState, index_CubeMeshParameters as CubeMeshParameters, index_DEFAULT_COLLIDER_STATE as DEFAULT_COLLIDER_STATE, index_DEFAULT_ENVIRONMENT_STATE as DEFAULT_ENVIRONMENT_STATE, index_DEFAULT_INSTANCED_MESH_PARAMETERS as DEFAULT_INSTANCED_MESH_PARAMETERS, index_DEFAULT_INSTANCE_TRANSFORM as DEFAULT_INSTANCE_TRANSFORM, index_DEFAULT_MESH_GEOMETRY_PARAMETERS as DEFAULT_MESH_GEOMETRY_PARAMETERS, index_DEFAULT_PHYSICS_STATE as DEFAULT_PHYSICS_STATE, index_DEFAULT_POSTPROCESSING_STATE as DEFAULT_POSTPROCESSING_STATE, index_DEFAULT_RIGIDBODY_STATE as DEFAULT_RIGIDBODY_STATE, index_EditableMeshObjectKind as EditableMeshObjectKind, index_EntityType as EntityType, index_Environment as Environment, index_EnvironmentFogState as EnvironmentFogState, index_EnvironmentFogType as EnvironmentFogType, index_EnvironmentGradientEffect as EnvironmentGradientEffect, index_EnvironmentSkyboxState as EnvironmentSkyboxState, index_EnvironmentSkyboxType as EnvironmentSkyboxType, index_EnvironmentState as EnvironmentState, index_ImageComponent as ImageComponent, index_ImageTarget as ImageTarget, index_ImageTargetAnchor as ImageTargetAnchor, index_ImageTargetAnchorOptions as ImageTargetAnchorOptions, index_ImageTargetReference as ImageTargetReference, index_InstanceSlotComponent as InstanceSlotComponent, index_InstanceTransform as InstanceTransform, index_InstancedMeshComponent as InstancedMeshComponent, index_InstancedMeshKind as InstancedMeshKind, index_LightComponent as LightComponent, index_LightValueState as LightValueState, index_MaterialComponent as MaterialComponent, index_MaterialTypeValue as MaterialTypeValue, index_MaterialValueState as MaterialValueState, index_MeshComponent as MeshComponent, index_MeshGeometryComponent as MeshGeometryComponent, index_MeshGeometryParameters as MeshGeometryParameters, index_MeshGeometryParametersByKind as MeshGeometryParametersByKind, index_ModelComponent as ModelComponent, index_Name as Name, index_Object3DRef as Object3DRef, index_ParentId as ParentId, index_PhysicsComponent as PhysicsComponent, index_PhysicsState as PhysicsState, index_PlaneMeshParameters as PlaneMeshParameters, index_Postprocessing as Postprocessing, index_PostprocessingState as PostprocessingState, index_RadiusHeightMeshParameters as RadiusHeightMeshParameters, index_RadiusMeshParameters as RadiusMeshParameters, index_RigidbodyState as RigidbodyState, index_RigidbodyType as RigidbodyType, index_ScriptComponent as ScriptComponent, index_ScriptEntry as ScriptEntry, index_Selectable as Selectable, index_SelectionTransformState as SelectionTransformState, index_SpriteComponent as SpriteComponent, index_TextureFilteringValue as TextureFilteringValue, index_TransformComponent as TransformComponent, index_TransformData as TransformData, index_TransformModeValue as TransformModeValue, index_TransformSpaceValue as TransformSpaceValue, index_Vec3 as Vec3, index_VideoComponent as VideoComponent, index_normalizePhysicsState as normalizePhysicsState };
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
export { index as i };
|
package/dist/index.cjs
CHANGED
|
@@ -150,6 +150,13 @@ function normalizeDebugValue(value, ctx) {
|
|
|
150
150
|
crossFadeDuration: typeof objectValue.crossFadeDuration === "number" && Number.isFinite(objectValue.crossFadeDuration) ? Math.max(0, objectValue.crossFadeDuration) : 0
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
+
if (constructorName === "InstanceSlotComponent") {
|
|
154
|
+
return {
|
|
155
|
+
__type: "InstanceSlotComponent",
|
|
156
|
+
groupEntityId: typeof objectValue.groupEntityId === "number" ? objectValue.groupEntityId : -1,
|
|
157
|
+
slotIndex: typeof objectValue.slotIndex === "number" ? objectValue.slotIndex : 0
|
|
158
|
+
};
|
|
159
|
+
}
|
|
153
160
|
if (constructorName === "InstancedMeshComponent") {
|
|
154
161
|
const imCtx = {
|
|
155
162
|
seen: ctx.seen,
|
|
@@ -163,7 +170,7 @@ function normalizeDebugValue(value, ctx) {
|
|
|
163
170
|
meshParameters: normalizeDebugValue(objectValue.meshParameters, imCtx),
|
|
164
171
|
castShadow: Boolean(objectValue.castShadow),
|
|
165
172
|
receiveShadow: Boolean(objectValue.receiveShadow),
|
|
166
|
-
|
|
173
|
+
instanceEntityIds: Array.isArray(objectValue.instanceEntityIds) ? [...objectValue.instanceEntityIds] : []
|
|
167
174
|
};
|
|
168
175
|
}
|
|
169
176
|
if (constructorName === "PhysicsComponent") {
|
|
@@ -2238,7 +2245,7 @@ var _InstancedMeshComponent = class _InstancedMeshComponent extends Component {
|
|
|
2238
2245
|
};
|
|
2239
2246
|
this.castShadow = options?.castShadow ?? false;
|
|
2240
2247
|
this.receiveShadow = options?.receiveShadow ?? false;
|
|
2241
|
-
this.
|
|
2248
|
+
this.instanceEntityIds = options?.instanceEntityIds ?? [];
|
|
2242
2249
|
this.instancedMesh = null;
|
|
2243
2250
|
}
|
|
2244
2251
|
/** Sanitize and return a copy of the current mesh parameters with valid values. */
|
|
@@ -2290,6 +2297,25 @@ function createInstancedMeshComponent(world, entityId, meshKind, meshParameters,
|
|
|
2290
2297
|
}
|
|
2291
2298
|
__name(createInstancedMeshComponent, "createInstancedMeshComponent");
|
|
2292
2299
|
|
|
2300
|
+
// core/components/InstanceSlotComponent.ts
|
|
2301
|
+
var _InstanceSlotComponent = class _InstanceSlotComponent extends Component {
|
|
2302
|
+
constructor(groupEntityId, slotIndex) {
|
|
2303
|
+
super();
|
|
2304
|
+
this.groupEntityId = groupEntityId;
|
|
2305
|
+
this.slotIndex = slotIndex;
|
|
2306
|
+
}
|
|
2307
|
+
};
|
|
2308
|
+
__name(_InstanceSlotComponent, "InstanceSlotComponent");
|
|
2309
|
+
var InstanceSlotComponent = _InstanceSlotComponent;
|
|
2310
|
+
|
|
2311
|
+
// core/factories/components/InstanceSlotComponentFactory.ts
|
|
2312
|
+
function createInstanceSlotComponent(world, entityId, groupEntityId, slotIndex) {
|
|
2313
|
+
const component = new InstanceSlotComponent(groupEntityId, slotIndex);
|
|
2314
|
+
world.addComponent(entityId, component);
|
|
2315
|
+
return component;
|
|
2316
|
+
}
|
|
2317
|
+
__name(createInstanceSlotComponent, "createInstanceSlotComponent");
|
|
2318
|
+
|
|
2293
2319
|
// core/components/Video.ts
|
|
2294
2320
|
var DEFAULT_VIDEO_OPTIONS = {
|
|
2295
2321
|
autoplay: false,
|
|
@@ -3052,13 +3078,32 @@ function createImageTarget({
|
|
|
3052
3078
|
}
|
|
3053
3079
|
__name(createImageTarget, "createImageTarget");
|
|
3054
3080
|
function isInstancedMeshKind(value) {
|
|
3055
|
-
return value === "cube" || value === "sphere" || value === "plane" || value === "cylinder" || value === "capsule";
|
|
3081
|
+
return value === "cube" || value === "sphere" || value === "plane" || value === "cylinder" || value === "capsule" || value === "model";
|
|
3056
3082
|
}
|
|
3057
3083
|
__name(isInstancedMeshKind, "isInstancedMeshKind");
|
|
3058
|
-
function
|
|
3059
|
-
|
|
3084
|
+
function createInstanceSlotEntity(world, groupEntityId, slotIndex, label, transform) {
|
|
3085
|
+
const instanceEntityId = world.createEntity();
|
|
3086
|
+
world.addComponent(instanceEntityId, new Name(label));
|
|
3087
|
+
world.addComponent(
|
|
3088
|
+
instanceEntityId,
|
|
3089
|
+
createTransform(
|
|
3090
|
+
transform ? {
|
|
3091
|
+
position: transform.position,
|
|
3092
|
+
rotation: transform.rotation,
|
|
3093
|
+
scale: transform.scale
|
|
3094
|
+
} : void 0
|
|
3095
|
+
)
|
|
3096
|
+
);
|
|
3097
|
+
world.addComponent(
|
|
3098
|
+
instanceEntityId,
|
|
3099
|
+
new InstanceSlotComponent(groupEntityId, slotIndex)
|
|
3100
|
+
);
|
|
3101
|
+
world.addComponent(instanceEntityId, new EntityType("instanceSlot"));
|
|
3102
|
+
world.addComponent(instanceEntityId, new Selectable(true));
|
|
3103
|
+
world.addComponent(instanceEntityId, new ParentId(groupEntityId));
|
|
3104
|
+
return instanceEntityId;
|
|
3060
3105
|
}
|
|
3061
|
-
__name(
|
|
3106
|
+
__name(createInstanceSlotEntity, "createInstanceSlotEntity");
|
|
3062
3107
|
function createInstancedMesh({
|
|
3063
3108
|
world,
|
|
3064
3109
|
scene,
|
|
@@ -3068,25 +3113,68 @@ function createInstancedMesh({
|
|
|
3068
3113
|
const opts = payload.options ?? {};
|
|
3069
3114
|
const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
|
|
3070
3115
|
const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
|
|
3071
|
-
const instances = isInstanceTransformArray(
|
|
3072
|
-
opts.instances
|
|
3073
|
-
) ? opts.instances : void 0;
|
|
3074
3116
|
const castShadow = typeof opts.castShadow === "boolean" ? opts.castShadow : false;
|
|
3075
3117
|
const receiveShadow = typeof opts.receiveShadow === "boolean" ? opts.receiveShadow : false;
|
|
3118
|
+
const modelPath = typeof opts.modelPath === "string" ? opts.modelPath : void 0;
|
|
3076
3119
|
const entityId = createBaseEntity(world, anchor, {
|
|
3077
3120
|
label: payload.name ?? "Instanced Mesh",
|
|
3078
3121
|
entityType: "instancedMesh",
|
|
3079
3122
|
transformInput: payload.transform
|
|
3080
3123
|
});
|
|
3124
|
+
let instanceEntityIds = [];
|
|
3125
|
+
if (Array.isArray(opts.instanceEntityIds)) {
|
|
3126
|
+
instanceEntityIds = [];
|
|
3127
|
+
} else if (Array.isArray(opts.instances) && opts.instances.length > 0) {
|
|
3128
|
+
const legacyInstances = opts.instances;
|
|
3129
|
+
for (let i = 0; i < legacyInstances.length; i++) {
|
|
3130
|
+
const slotId = createInstanceSlotEntity(
|
|
3131
|
+
world,
|
|
3132
|
+
entityId,
|
|
3133
|
+
i,
|
|
3134
|
+
`Instance ${i + 1}`,
|
|
3135
|
+
legacyInstances[i]
|
|
3136
|
+
);
|
|
3137
|
+
instanceEntityIds.push(slotId);
|
|
3138
|
+
}
|
|
3139
|
+
} else {
|
|
3140
|
+
const slotId = createInstanceSlotEntity(
|
|
3141
|
+
world,
|
|
3142
|
+
entityId,
|
|
3143
|
+
0,
|
|
3144
|
+
"Instance 1",
|
|
3145
|
+
{ ...DEFAULT_INSTANCE_TRANSFORM }
|
|
3146
|
+
);
|
|
3147
|
+
instanceEntityIds = [slotId];
|
|
3148
|
+
}
|
|
3081
3149
|
createInstancedMeshComponent(world, entityId, meshKind, meshParameters, {
|
|
3082
3150
|
castShadow,
|
|
3083
3151
|
receiveShadow,
|
|
3084
|
-
|
|
3152
|
+
instanceEntityIds,
|
|
3153
|
+
modelPath
|
|
3085
3154
|
});
|
|
3086
3155
|
scene.add(anchor);
|
|
3087
3156
|
return entityId;
|
|
3088
3157
|
}
|
|
3089
3158
|
__name(createInstancedMesh, "createInstancedMesh");
|
|
3159
|
+
|
|
3160
|
+
// core/factories/objects/InstanceSlotFactory.ts
|
|
3161
|
+
function createInstanceSlot({ world, payload }) {
|
|
3162
|
+
const opts = payload.options ?? {};
|
|
3163
|
+
const groupEntityId = typeof opts.groupEntityId === "number" ? opts.groupEntityId : -1;
|
|
3164
|
+
const slotIndex = typeof opts.slotIndex === "number" ? opts.slotIndex : 0;
|
|
3165
|
+
const entityId = world.createEntity();
|
|
3166
|
+
world.addComponent(
|
|
3167
|
+
entityId,
|
|
3168
|
+
new Name(payload.name ?? `Instance ${slotIndex + 1}`)
|
|
3169
|
+
);
|
|
3170
|
+
world.addComponent(entityId, createTransform(payload.transform));
|
|
3171
|
+
world.addComponent(entityId, new InstanceSlotComponent(groupEntityId, slotIndex));
|
|
3172
|
+
world.addComponent(entityId, new EntityType("instanceSlot"));
|
|
3173
|
+
world.addComponent(entityId, new Selectable(true));
|
|
3174
|
+
world.addComponent(entityId, new ParentId(groupEntityId !== -1 ? groupEntityId : null));
|
|
3175
|
+
return entityId;
|
|
3176
|
+
}
|
|
3177
|
+
__name(createInstanceSlot, "createInstanceSlot");
|
|
3090
3178
|
function createAmbientLight({
|
|
3091
3179
|
world,
|
|
3092
3180
|
scene,
|
|
@@ -3260,6 +3348,7 @@ __export(components_exports, {
|
|
|
3260
3348
|
ImageComponent: () => ImageComponent,
|
|
3261
3349
|
ImageTarget: () => ImageTarget,
|
|
3262
3350
|
ImageTargetAnchor: () => ImageTargetAnchor,
|
|
3351
|
+
InstanceSlotComponent: () => InstanceSlotComponent,
|
|
3263
3352
|
InstancedMeshComponent: () => InstancedMeshComponent,
|
|
3264
3353
|
LightComponent: () => LightComponent,
|
|
3265
3354
|
MaterialComponent: () => MaterialComponent,
|
|
@@ -3657,6 +3746,7 @@ function registerDefaultFactories(objectManagementSystem) {
|
|
|
3657
3746
|
objectManagementSystem.register("image", createImage);
|
|
3658
3747
|
objectManagementSystem.register("imageTarget", createImageTarget);
|
|
3659
3748
|
objectManagementSystem.register("instancedMesh", createInstancedMesh);
|
|
3749
|
+
objectManagementSystem.register("instanceSlot", createInstanceSlot);
|
|
3660
3750
|
objectManagementSystem.register("sprite", createSprite);
|
|
3661
3751
|
objectManagementSystem.register("audio", createAudio);
|
|
3662
3752
|
objectManagementSystem.register("camera", createCamera);
|
|
@@ -5979,14 +6069,14 @@ var _euler = new THREE34__namespace.Euler();
|
|
|
5979
6069
|
var _scale = new THREE34__namespace.Vector3();
|
|
5980
6070
|
var _matrix = new THREE34__namespace.Matrix4();
|
|
5981
6071
|
var _modelMatrix = new THREE34__namespace.Matrix4();
|
|
5982
|
-
function
|
|
5983
|
-
_position.set(
|
|
5984
|
-
_euler.set(
|
|
6072
|
+
function instanceTransformFromComponent(transform, out) {
|
|
6073
|
+
_position.set(transform.position.x, transform.position.y, transform.position.z);
|
|
6074
|
+
_euler.set(transform.rotation.x, transform.rotation.y, transform.rotation.z, "XYZ");
|
|
5985
6075
|
_quaternion.setFromEuler(_euler);
|
|
5986
|
-
_scale.set(
|
|
6076
|
+
_scale.set(transform.scale.x, transform.scale.y, transform.scale.z);
|
|
5987
6077
|
out.compose(_position, _quaternion, _scale);
|
|
5988
6078
|
}
|
|
5989
|
-
__name(
|
|
6079
|
+
__name(instanceTransformFromComponent, "instanceTransformFromComponent");
|
|
5990
6080
|
function disposePrimitiveInstancedMesh(mesh) {
|
|
5991
6081
|
mesh.geometry.dispose();
|
|
5992
6082
|
if (Array.isArray(mesh.material)) {
|
|
@@ -6045,7 +6135,7 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6045
6135
|
const objectRef = world.getComponent(entityId, Object3DRef);
|
|
6046
6136
|
const anchor = objectRef?.object ?? null;
|
|
6047
6137
|
if (!anchor) continue;
|
|
6048
|
-
const instanceCount = comp.
|
|
6138
|
+
const instanceCount = comp.instanceEntityIds.length;
|
|
6049
6139
|
const geometrySignature = comp.meshKind === "model" ? `model:${comp.modelPath}:${instanceCount}` : `${comp.meshKind}:${JSON.stringify(comp.meshParameters)}:${instanceCount}`;
|
|
6050
6140
|
const pendingLoadSignature = this.loadingSignatures.get(entityId);
|
|
6051
6141
|
const needsRebuild = (comp.instancedMesh === null || this.geometrySignatures.get(entityId) !== geometrySignature) && pendingLoadSignature !== geometrySignature;
|
|
@@ -6081,7 +6171,7 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6081
6171
|
this.loadingSignatures.delete(targetEntityId);
|
|
6082
6172
|
return;
|
|
6083
6173
|
}
|
|
6084
|
-
const currentSig = `model:${currentComp.modelPath}:${currentComp.
|
|
6174
|
+
const currentSig = `model:${currentComp.modelPath}:${currentComp.instanceEntityIds.length}`;
|
|
6085
6175
|
if (currentSig !== targetSignature) {
|
|
6086
6176
|
this.loadingSignatures.delete(targetEntityId);
|
|
6087
6177
|
return;
|
|
@@ -6097,7 +6187,7 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6097
6187
|
disposeModelGroup(currentComp.instancedMesh);
|
|
6098
6188
|
currentComp.instancedMesh = null;
|
|
6099
6189
|
}
|
|
6100
|
-
const count2 = Math.max(1, currentComp.
|
|
6190
|
+
const count2 = Math.max(1, currentComp.instanceEntityIds.length);
|
|
6101
6191
|
const entries = [];
|
|
6102
6192
|
gltf.scene.updateWorldMatrix(true, true);
|
|
6103
6193
|
gltf.scene.traverse((child) => {
|
|
@@ -6115,12 +6205,13 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6115
6205
|
instancedMesh2.castShadow = currentComp.castShadow;
|
|
6116
6206
|
instancedMesh2.receiveShadow = currentComp.receiveShadow;
|
|
6117
6207
|
for (let i = 0; i < count2; i++) {
|
|
6118
|
-
const
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
}
|
|
6123
|
-
|
|
6208
|
+
const instanceEntityId = currentComp.instanceEntityIds[i];
|
|
6209
|
+
const instTransform = instanceEntityId !== void 0 ? world.getComponent(instanceEntityId, TransformComponent) ?? null : null;
|
|
6210
|
+
if (instTransform) {
|
|
6211
|
+
instanceTransformFromComponent(instTransform, _matrix);
|
|
6212
|
+
} else {
|
|
6213
|
+
_matrix.identity();
|
|
6214
|
+
}
|
|
6124
6215
|
_modelMatrix.multiplyMatrices(_matrix, localMatrix);
|
|
6125
6216
|
instancedMesh2.setMatrixAt(i, _modelMatrix);
|
|
6126
6217
|
}
|
|
@@ -6153,12 +6244,13 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6153
6244
|
instancedMesh.castShadow = comp.castShadow;
|
|
6154
6245
|
instancedMesh.receiveShadow = comp.receiveShadow;
|
|
6155
6246
|
for (let i = 0; i < count; i++) {
|
|
6156
|
-
const
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
}
|
|
6161
|
-
|
|
6247
|
+
const instanceEntityId = comp.instanceEntityIds[i];
|
|
6248
|
+
const instTransform = instanceEntityId !== void 0 ? world.getComponent(instanceEntityId, TransformComponent) ?? null : null;
|
|
6249
|
+
if (instTransform) {
|
|
6250
|
+
instanceTransformFromComponent(instTransform, _matrix);
|
|
6251
|
+
} else {
|
|
6252
|
+
_matrix.identity();
|
|
6253
|
+
}
|
|
6162
6254
|
instancedMesh.setMatrixAt(i, _matrix);
|
|
6163
6255
|
}
|
|
6164
6256
|
instancedMesh.instanceMatrix.needsUpdate = true;
|
|
@@ -6169,10 +6261,16 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6169
6261
|
if (comp.meshKind === "model") {
|
|
6170
6262
|
const entries = this.modelMeshEntries.get(entityId);
|
|
6171
6263
|
if (entries) {
|
|
6172
|
-
const count = comp.
|
|
6264
|
+
const count = comp.instanceEntityIds.length;
|
|
6173
6265
|
for (const entry of entries) {
|
|
6174
6266
|
for (let i = 0; i < count; i++) {
|
|
6175
|
-
|
|
6267
|
+
const instanceEntityId = comp.instanceEntityIds[i];
|
|
6268
|
+
const instTransform = instanceEntityId !== void 0 ? world.getComponent(instanceEntityId, TransformComponent) ?? null : null;
|
|
6269
|
+
if (instTransform) {
|
|
6270
|
+
instanceTransformFromComponent(instTransform, _matrix);
|
|
6271
|
+
} else {
|
|
6272
|
+
_matrix.identity();
|
|
6273
|
+
}
|
|
6176
6274
|
_modelMatrix.multiplyMatrices(_matrix, entry.localMatrix);
|
|
6177
6275
|
entry.instancedMesh.setMatrixAt(i, _modelMatrix);
|
|
6178
6276
|
}
|
|
@@ -6183,9 +6281,15 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6183
6281
|
}
|
|
6184
6282
|
} else {
|
|
6185
6283
|
const im = comp.instancedMesh;
|
|
6186
|
-
const count = comp.
|
|
6284
|
+
const count = comp.instanceEntityIds.length;
|
|
6187
6285
|
for (let i = 0; i < count; i++) {
|
|
6188
|
-
|
|
6286
|
+
const instanceEntityId = comp.instanceEntityIds[i];
|
|
6287
|
+
const instTransform = instanceEntityId !== void 0 ? world.getComponent(instanceEntityId, TransformComponent) ?? null : null;
|
|
6288
|
+
if (instTransform) {
|
|
6289
|
+
instanceTransformFromComponent(instTransform, _matrix);
|
|
6290
|
+
} else {
|
|
6291
|
+
_matrix.identity();
|
|
6292
|
+
}
|
|
6189
6293
|
im.setMatrixAt(i, _matrix);
|
|
6190
6294
|
}
|
|
6191
6295
|
im.instanceMatrix.needsUpdate = true;
|
|
@@ -8147,7 +8251,8 @@ function buildComponentValueMaps(snapshot) {
|
|
|
8147
8251
|
animationValues: readByComponent(snapshot.components, "AnimationComponent"),
|
|
8148
8252
|
imageTargetAnchorValues: readByComponent(snapshot.components, "ImageTargetAnchor"),
|
|
8149
8253
|
scriptValues: readByComponent(snapshot.components, "ScriptComponent"),
|
|
8150
|
-
instancedMeshValues: readByComponent(snapshot.components, "InstancedMeshComponent")
|
|
8254
|
+
instancedMeshValues: readByComponent(snapshot.components, "InstancedMeshComponent"),
|
|
8255
|
+
instanceSlotValues: readByComponent(snapshot.components, "InstanceSlotComponent")
|
|
8151
8256
|
};
|
|
8152
8257
|
}
|
|
8153
8258
|
__name(buildComponentValueMaps, "buildComponentValueMaps");
|
|
@@ -8261,6 +8366,20 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
8261
8366
|
new ScriptComponent(entries)
|
|
8262
8367
|
);
|
|
8263
8368
|
}
|
|
8369
|
+
{
|
|
8370
|
+
const imComponent = world.getComponent(targetEntityId, InstancedMeshComponent);
|
|
8371
|
+
if (imComponent && imComponent.instanceEntityIds.length > 0) {
|
|
8372
|
+
imComponent.instanceEntityIds = imComponent.instanceEntityIds.map(
|
|
8373
|
+
(oldId) => idMap.get(oldId) ?? oldId
|
|
8374
|
+
);
|
|
8375
|
+
}
|
|
8376
|
+
}
|
|
8377
|
+
{
|
|
8378
|
+
const slotComponent = world.getComponent(targetEntityId, InstanceSlotComponent);
|
|
8379
|
+
if (slotComponent && slotComponent.groupEntityId !== -1) {
|
|
8380
|
+
slotComponent.groupEntityId = idMap.get(slotComponent.groupEntityId) ?? slotComponent.groupEntityId;
|
|
8381
|
+
}
|
|
8382
|
+
}
|
|
8264
8383
|
}
|
|
8265
8384
|
__name(restorePostCreateComponents, "restorePostCreateComponents");
|
|
8266
8385
|
|
|
@@ -8764,12 +8883,21 @@ function restoreComponentState(world, objectManagementSystem, targetEntityId, so
|
|
|
8764
8883
|
if (typeof sourceInstancedMesh.receiveShadow === "boolean") {
|
|
8765
8884
|
imComponent.receiveShadow = sourceInstancedMesh.receiveShadow;
|
|
8766
8885
|
}
|
|
8767
|
-
if (Array.isArray(sourceInstancedMesh.
|
|
8768
|
-
imComponent.
|
|
8886
|
+
if (Array.isArray(sourceInstancedMesh.instanceEntityIds)) {
|
|
8887
|
+
imComponent.instanceEntityIds = sourceInstancedMesh.instanceEntityIds;
|
|
8769
8888
|
}
|
|
8770
8889
|
imComponent.instancedMesh = null;
|
|
8771
8890
|
}
|
|
8772
8891
|
}
|
|
8892
|
+
const sourceInstanceSlot = asRecord3(values.instanceSlotValues.get(sourceEntityId));
|
|
8893
|
+
if (sourceInstanceSlot) {
|
|
8894
|
+
const slotComponent = world.getComponent(targetEntityId, InstanceSlotComponent);
|
|
8895
|
+
if (slotComponent) {
|
|
8896
|
+
if (typeof sourceInstanceSlot.slotIndex === "number") {
|
|
8897
|
+
slotComponent.slotIndex = sourceInstanceSlot.slotIndex;
|
|
8898
|
+
}
|
|
8899
|
+
}
|
|
8900
|
+
}
|
|
8773
8901
|
}
|
|
8774
8902
|
__name(restoreComponentState, "restoreComponentState");
|
|
8775
8903
|
|
|
@@ -8793,7 +8921,8 @@ var HYDRATABLE_ENTITY_KINDS = /* @__PURE__ */ new Set([
|
|
|
8793
8921
|
"pointLight",
|
|
8794
8922
|
"spotLight",
|
|
8795
8923
|
"areaLight",
|
|
8796
|
-
"instancedMesh"
|
|
8924
|
+
"instancedMesh",
|
|
8925
|
+
"instanceSlot"
|
|
8797
8926
|
]);
|
|
8798
8927
|
|
|
8799
8928
|
// core/hydration/hydrateWorld.ts
|
|
@@ -8875,10 +9004,23 @@ function buildEntityCreationPayload(sourceEntityId, kind, componentValues) {
|
|
|
8875
9004
|
if (im) {
|
|
8876
9005
|
payload.options = {
|
|
8877
9006
|
meshKind: typeof im.meshKind === "string" ? im.meshKind : "cube",
|
|
9007
|
+
modelPath: typeof im.modelPath === "string" ? im.modelPath : void 0,
|
|
8878
9008
|
meshParameters: asRecord3(im.meshParameters) ?? void 0,
|
|
8879
9009
|
castShadow: typeof im.castShadow === "boolean" ? im.castShadow : false,
|
|
8880
9010
|
receiveShadow: typeof im.receiveShadow === "boolean" ? im.receiveShadow : false,
|
|
8881
|
-
|
|
9011
|
+
// New format: signal the factory to skip child entity creation.
|
|
9012
|
+
// Old format (instances[]): pass through for migration — factory will
|
|
9013
|
+
// create slot entities from the legacy InstanceTransform array.
|
|
9014
|
+
...Array.isArray(im.instanceEntityIds) ? { instanceEntityIds: im.instanceEntityIds } : Array.isArray(im.instances) ? { instances: im.instances } : {}
|
|
9015
|
+
};
|
|
9016
|
+
}
|
|
9017
|
+
}
|
|
9018
|
+
if (kind === "instanceSlot") {
|
|
9019
|
+
const slot = asRecord3(componentValues.instanceSlotValues.get(sourceEntityId));
|
|
9020
|
+
if (slot) {
|
|
9021
|
+
payload.options = {
|
|
9022
|
+
groupEntityId: typeof slot.groupEntityId === "number" ? slot.groupEntityId : -1,
|
|
9023
|
+
slotIndex: typeof slot.slotIndex === "number" ? slot.slotIndex : 0
|
|
8882
9024
|
};
|
|
8883
9025
|
}
|
|
8884
9026
|
}
|
|
@@ -9026,6 +9168,7 @@ exports.createEnvironmentComponent = createEnvironmentComponent;
|
|
|
9026
9168
|
exports.createImageComponent = createImageComponent;
|
|
9027
9169
|
exports.createImageTargetAnchorComponent = createImageTargetAnchorComponent;
|
|
9028
9170
|
exports.createImageTargetComponent = createImageTargetComponent;
|
|
9171
|
+
exports.createInstanceSlotComponent = createInstanceSlotComponent;
|
|
9029
9172
|
exports.createInstancedMeshComponent = createInstancedMeshComponent;
|
|
9030
9173
|
exports.createLightComponent = createLightComponent;
|
|
9031
9174
|
exports.createMaterialComponent = createMaterialComponent;
|