@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,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;
|
|
@@ -6063,6 +6153,10 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6063
6153
|
this.loadingSignatures.delete(entityId);
|
|
6064
6154
|
this.modelMeshEntries.delete(entityId);
|
|
6065
6155
|
}
|
|
6156
|
+
if (instanceCount === 0) {
|
|
6157
|
+
this.geometrySignatures.set(entityId, geometrySignature);
|
|
6158
|
+
continue;
|
|
6159
|
+
}
|
|
6066
6160
|
if (comp.meshKind === "model") {
|
|
6067
6161
|
if (comp.modelPath && !this.loadingSignatures.has(entityId)) {
|
|
6068
6162
|
this.loadingSignatures.set(entityId, geometrySignature);
|
|
@@ -6081,7 +6175,7 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6081
6175
|
this.loadingSignatures.delete(targetEntityId);
|
|
6082
6176
|
return;
|
|
6083
6177
|
}
|
|
6084
|
-
const currentSig = `model:${currentComp.modelPath}:${currentComp.
|
|
6178
|
+
const currentSig = `model:${currentComp.modelPath}:${currentComp.instanceEntityIds.length}`;
|
|
6085
6179
|
if (currentSig !== targetSignature) {
|
|
6086
6180
|
this.loadingSignatures.delete(targetEntityId);
|
|
6087
6181
|
return;
|
|
@@ -6097,7 +6191,7 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6097
6191
|
disposeModelGroup(currentComp.instancedMesh);
|
|
6098
6192
|
currentComp.instancedMesh = null;
|
|
6099
6193
|
}
|
|
6100
|
-
const count2 = Math.max(1, currentComp.
|
|
6194
|
+
const count2 = Math.max(1, currentComp.instanceEntityIds.length);
|
|
6101
6195
|
const entries = [];
|
|
6102
6196
|
gltf.scene.updateWorldMatrix(true, true);
|
|
6103
6197
|
gltf.scene.traverse((child) => {
|
|
@@ -6115,12 +6209,13 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6115
6209
|
instancedMesh2.castShadow = currentComp.castShadow;
|
|
6116
6210
|
instancedMesh2.receiveShadow = currentComp.receiveShadow;
|
|
6117
6211
|
for (let i = 0; i < count2; i++) {
|
|
6118
|
-
const
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
}
|
|
6123
|
-
|
|
6212
|
+
const instanceEntityId = currentComp.instanceEntityIds[i];
|
|
6213
|
+
const instTransform = instanceEntityId !== void 0 ? world.getComponent(instanceEntityId, TransformComponent) ?? null : null;
|
|
6214
|
+
if (instTransform) {
|
|
6215
|
+
instanceTransformFromComponent(instTransform, _matrix);
|
|
6216
|
+
} else {
|
|
6217
|
+
_matrix.identity();
|
|
6218
|
+
}
|
|
6124
6219
|
_modelMatrix.multiplyMatrices(_matrix, localMatrix);
|
|
6125
6220
|
instancedMesh2.setMatrixAt(i, _modelMatrix);
|
|
6126
6221
|
}
|
|
@@ -6146,19 +6241,20 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6146
6241
|
}
|
|
6147
6242
|
continue;
|
|
6148
6243
|
}
|
|
6149
|
-
const count =
|
|
6244
|
+
const count = instanceCount;
|
|
6150
6245
|
const geometry = buildGeometry(comp);
|
|
6151
6246
|
const material = new THREE34__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
6152
6247
|
const instancedMesh = new THREE34__namespace.InstancedMesh(geometry, material, count);
|
|
6153
6248
|
instancedMesh.castShadow = comp.castShadow;
|
|
6154
6249
|
instancedMesh.receiveShadow = comp.receiveShadow;
|
|
6155
6250
|
for (let i = 0; i < count; i++) {
|
|
6156
|
-
const
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
}
|
|
6161
|
-
|
|
6251
|
+
const instanceEntityId = comp.instanceEntityIds[i];
|
|
6252
|
+
const instTransform = instanceEntityId !== void 0 ? world.getComponent(instanceEntityId, TransformComponent) ?? null : null;
|
|
6253
|
+
if (instTransform) {
|
|
6254
|
+
instanceTransformFromComponent(instTransform, _matrix);
|
|
6255
|
+
} else {
|
|
6256
|
+
_matrix.identity();
|
|
6257
|
+
}
|
|
6162
6258
|
instancedMesh.setMatrixAt(i, _matrix);
|
|
6163
6259
|
}
|
|
6164
6260
|
instancedMesh.instanceMatrix.needsUpdate = true;
|
|
@@ -6169,10 +6265,16 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6169
6265
|
if (comp.meshKind === "model") {
|
|
6170
6266
|
const entries = this.modelMeshEntries.get(entityId);
|
|
6171
6267
|
if (entries) {
|
|
6172
|
-
const count = comp.
|
|
6268
|
+
const count = comp.instanceEntityIds.length;
|
|
6173
6269
|
for (const entry of entries) {
|
|
6174
6270
|
for (let i = 0; i < count; i++) {
|
|
6175
|
-
|
|
6271
|
+
const instanceEntityId = comp.instanceEntityIds[i];
|
|
6272
|
+
const instTransform = instanceEntityId !== void 0 ? world.getComponent(instanceEntityId, TransformComponent) ?? null : null;
|
|
6273
|
+
if (instTransform) {
|
|
6274
|
+
instanceTransformFromComponent(instTransform, _matrix);
|
|
6275
|
+
} else {
|
|
6276
|
+
_matrix.identity();
|
|
6277
|
+
}
|
|
6176
6278
|
_modelMatrix.multiplyMatrices(_matrix, entry.localMatrix);
|
|
6177
6279
|
entry.instancedMesh.setMatrixAt(i, _modelMatrix);
|
|
6178
6280
|
}
|
|
@@ -6183,9 +6285,15 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
|
|
|
6183
6285
|
}
|
|
6184
6286
|
} else {
|
|
6185
6287
|
const im = comp.instancedMesh;
|
|
6186
|
-
const count = comp.
|
|
6288
|
+
const count = comp.instanceEntityIds.length;
|
|
6187
6289
|
for (let i = 0; i < count; i++) {
|
|
6188
|
-
|
|
6290
|
+
const instanceEntityId = comp.instanceEntityIds[i];
|
|
6291
|
+
const instTransform = instanceEntityId !== void 0 ? world.getComponent(instanceEntityId, TransformComponent) ?? null : null;
|
|
6292
|
+
if (instTransform) {
|
|
6293
|
+
instanceTransformFromComponent(instTransform, _matrix);
|
|
6294
|
+
} else {
|
|
6295
|
+
_matrix.identity();
|
|
6296
|
+
}
|
|
6189
6297
|
im.setMatrixAt(i, _matrix);
|
|
6190
6298
|
}
|
|
6191
6299
|
im.instanceMatrix.needsUpdate = true;
|
|
@@ -8147,7 +8255,8 @@ function buildComponentValueMaps(snapshot) {
|
|
|
8147
8255
|
animationValues: readByComponent(snapshot.components, "AnimationComponent"),
|
|
8148
8256
|
imageTargetAnchorValues: readByComponent(snapshot.components, "ImageTargetAnchor"),
|
|
8149
8257
|
scriptValues: readByComponent(snapshot.components, "ScriptComponent"),
|
|
8150
|
-
instancedMeshValues: readByComponent(snapshot.components, "InstancedMeshComponent")
|
|
8258
|
+
instancedMeshValues: readByComponent(snapshot.components, "InstancedMeshComponent"),
|
|
8259
|
+
instanceSlotValues: readByComponent(snapshot.components, "InstanceSlotComponent")
|
|
8151
8260
|
};
|
|
8152
8261
|
}
|
|
8153
8262
|
__name(buildComponentValueMaps, "buildComponentValueMaps");
|
|
@@ -8261,6 +8370,20 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
8261
8370
|
new ScriptComponent(entries)
|
|
8262
8371
|
);
|
|
8263
8372
|
}
|
|
8373
|
+
{
|
|
8374
|
+
const imComponent = world.getComponent(targetEntityId, InstancedMeshComponent);
|
|
8375
|
+
if (imComponent && imComponent.instanceEntityIds.length > 0) {
|
|
8376
|
+
imComponent.instanceEntityIds = imComponent.instanceEntityIds.map(
|
|
8377
|
+
(oldId) => idMap.get(oldId) ?? oldId
|
|
8378
|
+
);
|
|
8379
|
+
}
|
|
8380
|
+
}
|
|
8381
|
+
{
|
|
8382
|
+
const slotComponent = world.getComponent(targetEntityId, InstanceSlotComponent);
|
|
8383
|
+
if (slotComponent && slotComponent.groupEntityId !== -1) {
|
|
8384
|
+
slotComponent.groupEntityId = idMap.get(slotComponent.groupEntityId) ?? slotComponent.groupEntityId;
|
|
8385
|
+
}
|
|
8386
|
+
}
|
|
8264
8387
|
}
|
|
8265
8388
|
__name(restorePostCreateComponents, "restorePostCreateComponents");
|
|
8266
8389
|
|
|
@@ -8764,12 +8887,21 @@ function restoreComponentState(world, objectManagementSystem, targetEntityId, so
|
|
|
8764
8887
|
if (typeof sourceInstancedMesh.receiveShadow === "boolean") {
|
|
8765
8888
|
imComponent.receiveShadow = sourceInstancedMesh.receiveShadow;
|
|
8766
8889
|
}
|
|
8767
|
-
if (Array.isArray(sourceInstancedMesh.
|
|
8768
|
-
imComponent.
|
|
8890
|
+
if (Array.isArray(sourceInstancedMesh.instanceEntityIds)) {
|
|
8891
|
+
imComponent.instanceEntityIds = sourceInstancedMesh.instanceEntityIds;
|
|
8769
8892
|
}
|
|
8770
8893
|
imComponent.instancedMesh = null;
|
|
8771
8894
|
}
|
|
8772
8895
|
}
|
|
8896
|
+
const sourceInstanceSlot = asRecord3(values.instanceSlotValues.get(sourceEntityId));
|
|
8897
|
+
if (sourceInstanceSlot) {
|
|
8898
|
+
const slotComponent = world.getComponent(targetEntityId, InstanceSlotComponent);
|
|
8899
|
+
if (slotComponent) {
|
|
8900
|
+
if (typeof sourceInstanceSlot.slotIndex === "number") {
|
|
8901
|
+
slotComponent.slotIndex = sourceInstanceSlot.slotIndex;
|
|
8902
|
+
}
|
|
8903
|
+
}
|
|
8904
|
+
}
|
|
8773
8905
|
}
|
|
8774
8906
|
__name(restoreComponentState, "restoreComponentState");
|
|
8775
8907
|
|
|
@@ -8793,7 +8925,8 @@ var HYDRATABLE_ENTITY_KINDS = /* @__PURE__ */ new Set([
|
|
|
8793
8925
|
"pointLight",
|
|
8794
8926
|
"spotLight",
|
|
8795
8927
|
"areaLight",
|
|
8796
|
-
"instancedMesh"
|
|
8928
|
+
"instancedMesh",
|
|
8929
|
+
"instanceSlot"
|
|
8797
8930
|
]);
|
|
8798
8931
|
|
|
8799
8932
|
// core/hydration/hydrateWorld.ts
|
|
@@ -8875,10 +9008,23 @@ function buildEntityCreationPayload(sourceEntityId, kind, componentValues) {
|
|
|
8875
9008
|
if (im) {
|
|
8876
9009
|
payload.options = {
|
|
8877
9010
|
meshKind: typeof im.meshKind === "string" ? im.meshKind : "cube",
|
|
9011
|
+
modelPath: typeof im.modelPath === "string" ? im.modelPath : void 0,
|
|
8878
9012
|
meshParameters: asRecord3(im.meshParameters) ?? void 0,
|
|
8879
9013
|
castShadow: typeof im.castShadow === "boolean" ? im.castShadow : false,
|
|
8880
9014
|
receiveShadow: typeof im.receiveShadow === "boolean" ? im.receiveShadow : false,
|
|
8881
|
-
|
|
9015
|
+
// New format: signal the factory to skip child entity creation.
|
|
9016
|
+
// Old format (instances[]): pass through for migration — factory will
|
|
9017
|
+
// create slot entities from the legacy InstanceTransform array.
|
|
9018
|
+
...Array.isArray(im.instanceEntityIds) ? { instanceEntityIds: im.instanceEntityIds } : Array.isArray(im.instances) ? { instances: im.instances } : {}
|
|
9019
|
+
};
|
|
9020
|
+
}
|
|
9021
|
+
}
|
|
9022
|
+
if (kind === "instanceSlot") {
|
|
9023
|
+
const slot = asRecord3(componentValues.instanceSlotValues.get(sourceEntityId));
|
|
9024
|
+
if (slot) {
|
|
9025
|
+
payload.options = {
|
|
9026
|
+
groupEntityId: typeof slot.groupEntityId === "number" ? slot.groupEntityId : -1,
|
|
9027
|
+
slotIndex: typeof slot.slotIndex === "number" ? slot.slotIndex : 0
|
|
8882
9028
|
};
|
|
8883
9029
|
}
|
|
8884
9030
|
}
|
|
@@ -9026,6 +9172,7 @@ exports.createEnvironmentComponent = createEnvironmentComponent;
|
|
|
9026
9172
|
exports.createImageComponent = createImageComponent;
|
|
9027
9173
|
exports.createImageTargetAnchorComponent = createImageTargetAnchorComponent;
|
|
9028
9174
|
exports.createImageTargetComponent = createImageTargetComponent;
|
|
9175
|
+
exports.createInstanceSlotComponent = createInstanceSlotComponent;
|
|
9029
9176
|
exports.createInstancedMeshComponent = createInstancedMeshComponent;
|
|
9030
9177
|
exports.createLightComponent = createLightComponent;
|
|
9031
9178
|
exports.createMaterialComponent = createMaterialComponent;
|