@relu-interactives/spatial-ecs 0.2.4 → 0.2.5

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.
Files changed (50) hide show
  1. package/dist/{System-BTyYvKVH.d.cts → System-CIiWteft.d.cts} +2 -2
  2. package/dist/{System-BTyYvKVH.d.ts → System-CIiWteft.d.ts} +2 -2
  3. package/dist/{Video-D2H5H-K3.d.cts → Video-ChVFs9Tl.d.cts} +139 -75
  4. package/dist/{Video-BWhbvVPg.d.ts → Video-DCMCLInA.d.ts} +139 -75
  5. package/dist/{chunk-XWIEEJ7Z.js → chunk-4A66FSFT.js} +128 -82
  6. package/dist/chunk-4A66FSFT.js.map +1 -0
  7. package/dist/{chunk-AYEF3X2P.js → chunk-CRP3W2GK.js} +3 -3
  8. package/dist/chunk-CRP3W2GK.js.map +1 -0
  9. package/dist/{chunk-MAWBTMCG.js → chunk-KRZLEPRI.js} +156 -88
  10. package/dist/chunk-KRZLEPRI.js.map +1 -0
  11. package/dist/{chunk-NFDTIYR4.js → chunk-NB6I5JJN.js} +17 -2
  12. package/dist/chunk-NB6I5JJN.js.map +1 -0
  13. package/dist/{chunk-P2YDX5DB.js → chunk-RXCUHGRB.js} +124 -5
  14. package/dist/chunk-RXCUHGRB.js.map +1 -0
  15. package/dist/components/index.cjs +161 -93
  16. package/dist/components/index.cjs.map +1 -1
  17. package/dist/components/index.d.cts +2 -2
  18. package/dist/components/index.d.ts +2 -2
  19. package/dist/components/index.js +1 -1
  20. package/dist/factories/index.cjs +217 -105
  21. package/dist/factories/index.cjs.map +1 -1
  22. package/dist/factories/index.d.cts +9 -3
  23. package/dist/factories/index.d.ts +9 -3
  24. package/dist/factories/index.js +3 -3
  25. package/dist/{index-KdEzEZox.d.cts → index-D1I5L7bA.d.cts} +8 -3
  26. package/dist/{index-Dm6zF1MY.d.ts → index-DGZDgt3p.d.ts} +8 -3
  27. package/dist/index.cjs +468 -179
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +7 -7
  30. package/dist/index.d.ts +7 -7
  31. package/dist/index.js +51 -12
  32. package/dist/index.js.map +1 -1
  33. package/dist/systems/index.cjs +248 -63
  34. package/dist/systems/index.cjs.map +1 -1
  35. package/dist/systems/index.d.cts +15 -3
  36. package/dist/systems/index.d.ts +15 -3
  37. package/dist/systems/index.js +3 -3
  38. package/dist/types.d.cts +1 -1
  39. package/dist/types.d.ts +1 -1
  40. package/dist/worldSnapshotUtils.cjs +15 -0
  41. package/dist/worldSnapshotUtils.cjs.map +1 -1
  42. package/dist/worldSnapshotUtils.d.cts +1 -1
  43. package/dist/worldSnapshotUtils.d.ts +1 -1
  44. package/dist/worldSnapshotUtils.js +1 -1
  45. package/package.json +1 -1
  46. package/dist/chunk-AYEF3X2P.js.map +0 -1
  47. package/dist/chunk-MAWBTMCG.js.map +0 -1
  48. package/dist/chunk-NFDTIYR4.js.map +0 -1
  49. package/dist/chunk-P2YDX5DB.js.map +0 -1
  50. package/dist/chunk-XWIEEJ7Z.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { resolveDracoDecoderPath, createTransform, applyTransform } from './chunk-AYEF3X2P.js';
2
- import { AnimationComponent, AudioComponent, Object3DRef, CameraComponent, PhysicsComponent, Environment, EntityType, ImageComponent, ImageTargetAnchor, ImageTarget, LightComponent, MaterialComponent, MeshComponent, MeshGeometryComponent, ModelComponent, Name, ParentId, Postprocessing, ScriptComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, VideoComponent } from './chunk-MAWBTMCG.js';
1
+ import { resolveDracoDecoderPath, createTransform, applyTransform } from './chunk-CRP3W2GK.js';
2
+ import { AnimationComponent, AudioComponent, Object3DRef, CameraComponent, PhysicsComponent, Environment, EntityType, ImageComponent, ImageTargetAnchor, ImageTarget, LightComponent, MaterialComponent, MeshComponent, MeshGeometryComponent, ModelComponent, Name, ParentId, Postprocessing, ScriptComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, InstancedMeshComponent, VideoComponent } from './chunk-KRZLEPRI.js';
3
3
  import { __name } from './chunk-OY7ZODZP.js';
4
- import * as THREE20 from 'three';
4
+ import * as THREE21 from 'three';
5
5
  import { RectAreaLightHelper } from 'three/examples/jsm/helpers/RectAreaLightHelper.js';
6
6
  import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
7
7
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
@@ -22,11 +22,11 @@ function normalizeDistanceModel(distanceModel) {
22
22
  }
23
23
  __name(normalizeDistanceModel, "normalizeDistanceModel");
24
24
  function createConfiguredAudio(listener, options) {
25
- const sound = options.positional ? new THREE20.PositionalAudio(listener) : new THREE20.Audio(listener);
25
+ const sound = options.positional ? new THREE21.PositionalAudio(listener) : new THREE21.Audio(listener);
26
26
  sound.setLoop(options.loop);
27
27
  sound.setVolume(options.volume);
28
28
  sound.setPlaybackRate(options.pitch);
29
- if (sound instanceof THREE20.PositionalAudio) {
29
+ if (sound instanceof THREE21.PositionalAudio) {
30
30
  sound.setRefDistance(options.refDistance);
31
31
  sound.setDistanceModel(normalizeDistanceModel(options.distanceModel));
32
32
  sound.setRolloffFactor(options.rolloffFactor);
@@ -36,16 +36,16 @@ function createConfiguredAudio(listener, options) {
36
36
  __name(createConfiguredAudio, "createConfiguredAudio");
37
37
  function createAudioEditorHelper() {
38
38
  if (typeof document === "undefined") {
39
- const geometry = new THREE20.EdgesGeometry(
40
- new THREE20.OctahedronGeometry(0.22, 0)
39
+ const geometry = new THREE21.EdgesGeometry(
40
+ new THREE21.OctahedronGeometry(0.22, 0)
41
41
  );
42
- const material2 = new THREE20.LineBasicMaterial({
42
+ const material2 = new THREE21.LineBasicMaterial({
43
43
  color: "#8bc8ff",
44
44
  transparent: true,
45
45
  opacity: 0.95,
46
46
  depthTest: false
47
47
  });
48
- const fallback = new THREE20.LineSegments(geometry, material2);
48
+ const fallback = new THREE21.LineSegments(geometry, material2);
49
49
  fallback.renderOrder = 10;
50
50
  fallback.userData.ecsHelper = true;
51
51
  fallback.visible = false;
@@ -57,7 +57,7 @@ function createAudioEditorHelper() {
57
57
  canvas.height = size;
58
58
  const ctx = canvas.getContext("2d");
59
59
  if (!ctx) {
60
- return new THREE20.Object3D();
60
+ return new THREE21.Object3D();
61
61
  }
62
62
  ctx.clearRect(0, 0, size, size);
63
63
  ctx.fillStyle = "rgba(27, 35, 52, 0.9)";
@@ -88,14 +88,14 @@ function createAudioEditorHelper() {
88
88
  ctx.beginPath();
89
89
  ctx.arc(56, 48, 16, -0.8, 0.8);
90
90
  ctx.stroke();
91
- const texture = new THREE20.CanvasTexture(canvas);
91
+ const texture = new THREE21.CanvasTexture(canvas);
92
92
  texture.needsUpdate = true;
93
- const material = new THREE20.SpriteMaterial({
93
+ const material = new THREE21.SpriteMaterial({
94
94
  map: texture,
95
95
  transparent: true,
96
96
  depthTest: false
97
97
  });
98
- const helper = new THREE20.Sprite(material);
98
+ const helper = new THREE21.Sprite(material);
99
99
  helper.scale.set(0.68, 0.68, 0.68);
100
100
  helper.renderOrder = 10;
101
101
  helper.userData.ecsHelper = true;
@@ -122,7 +122,7 @@ function createAudioComponent(world, entityId, path = "", options = {}, context)
122
122
  __name(createAudioComponent, "createAudioComponent");
123
123
  function createCameraComponent(world, entityId, payload = {}) {
124
124
  const object = world.getComponent(entityId, Object3DRef)?.object;
125
- const objectCamera = object instanceof THREE20.Camera ? object : void 0;
125
+ const objectCamera = object instanceof THREE21.Camera ? object : void 0;
126
126
  const component = new CameraComponent({
127
127
  ...payload,
128
128
  camera: payload.camera ?? objectCamera
@@ -301,6 +301,14 @@ function createTransformComponent(world, entityId, ...args) {
301
301
  }
302
302
  __name(createTransformComponent, "createTransformComponent");
303
303
 
304
+ // core/factories/components/InstancedMeshComponentFactory.ts
305
+ function createInstancedMeshComponent(world, entityId, meshKind, meshParameters, options) {
306
+ const component = new InstancedMeshComponent(meshKind, meshParameters, options);
307
+ world.addComponent(entityId, component);
308
+ return component;
309
+ }
310
+ __name(createInstancedMeshComponent, "createInstancedMeshComponent");
311
+
304
312
  // core/factories/components/VideoFactory.ts
305
313
  function createVideoComponent(world, entityId, ...args) {
306
314
  const component = new VideoComponent(...args);
@@ -350,6 +358,7 @@ function registerDefaultComponentFactories(objectManagementSystem) {
350
358
  objectManagementSystem.registerComponentFactory("sprite", createSpriteComponent);
351
359
  objectManagementSystem.registerComponentFactory("transform", createTransformComponent);
352
360
  objectManagementSystem.registerComponentFactory("video", createVideoComponent);
361
+ objectManagementSystem.registerComponentFactory("instancedMesh", createInstancedMeshComponent);
353
362
  }
354
363
  __name(registerDefaultComponentFactories, "registerDefaultComponentFactories");
355
364
 
@@ -372,10 +381,10 @@ __name(createBaseEntity, "createBaseEntity");
372
381
  // core/factories/objects/AudioFactory.ts
373
382
  function getOrCreateListener(camera) {
374
383
  const existing = camera.userData.ecsAudioListener;
375
- if (existing instanceof THREE20.AudioListener) {
384
+ if (existing instanceof THREE21.AudioListener) {
376
385
  return existing;
377
386
  }
378
- const listener = new THREE20.AudioListener();
387
+ const listener = new THREE21.AudioListener();
379
388
  camera.add(listener);
380
389
  camera.userData.ecsAudioListener = listener;
381
390
  return listener;
@@ -388,7 +397,7 @@ function createAudio({
388
397
  payload,
389
398
  isEditor
390
399
  }) {
391
- const anchor = new THREE20.Object3D();
400
+ const anchor = new THREE21.Object3D();
392
401
  const entityId = createBaseEntity(world, anchor, {
393
402
  label: payload.name ?? "Audio",
394
403
  entityType: "audio",
@@ -410,7 +419,7 @@ function createAudio({
410
419
  return entityId;
411
420
  }
412
421
  if (!isEditor) {
413
- const loader = new THREE20.AudioLoader();
422
+ const loader = new THREE21.AudioLoader();
414
423
  loader.load(
415
424
  audio.path,
416
425
  (buffer) => {
@@ -485,7 +494,7 @@ function applyCameraSettings(camera, options) {
485
494
  const near = typeof options.near === "number" ? options.near : DEFAULT_NEAR;
486
495
  const far = typeof options.far === "number" ? options.far : DEFAULT_FAR;
487
496
  const projection = options.projection;
488
- if (camera instanceof THREE20.PerspectiveCamera) {
497
+ if (camera instanceof THREE21.PerspectiveCamera) {
489
498
  if (!projection || projection === "perspective") {
490
499
  camera.fov = typeof options.fov === "number" ? options.fov : DEFAULT_FOV;
491
500
  }
@@ -495,7 +504,7 @@ function applyCameraSettings(camera, options) {
495
504
  camera.updateProjectionMatrix();
496
505
  return;
497
506
  }
498
- if (camera instanceof THREE20.OrthographicCamera) {
507
+ if (camera instanceof THREE21.OrthographicCamera) {
499
508
  camera.left = typeof options.left === "number" ? options.left : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
500
509
  camera.right = typeof options.right === "number" ? options.right : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
501
510
  camera.top = typeof options.top === "number" ? options.top : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
@@ -516,7 +525,7 @@ function createCameraObject(options) {
516
525
  const bottom = options.bottom ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
517
526
  const left = options.left ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
518
527
  const right = options.right ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
519
- const camera = new THREE20.OrthographicCamera(
528
+ const camera = new THREE21.OrthographicCamera(
520
529
  left,
521
530
  right,
522
531
  top,
@@ -528,7 +537,7 @@ function createCameraObject(options) {
528
537
  camera.updateProjectionMatrix();
529
538
  return camera;
530
539
  }
531
- return new THREE20.PerspectiveCamera(
540
+ return new THREE21.PerspectiveCamera(
532
541
  options.fov ?? DEFAULT_FOV,
533
542
  readViewportAspect(),
534
543
  near,
@@ -546,7 +555,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
546
555
  transformInput: payload.transform
547
556
  });
548
557
  const objectRef = world.getComponent(entityId, Object3DRef);
549
- if (objectRef?.object instanceof THREE20.Camera) {
558
+ if (objectRef?.object instanceof THREE21.Camera) {
550
559
  objectRef.object.userData.entityId = entityId;
551
560
  }
552
561
  const componentOptions = {
@@ -569,7 +578,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
569
578
  } else {
570
579
  applyCameraSettings(object, options);
571
580
  if (isEditor && component.isDefault) {
572
- const helper = new THREE20.CameraHelper(object);
581
+ const helper = new THREE21.CameraHelper(object);
573
582
  helper.onBeforeRender = () => {
574
583
  helper.update();
575
584
  };
@@ -587,9 +596,9 @@ function createCapsule({
587
596
  scene,
588
597
  payload
589
598
  }) {
590
- const geometry = new THREE20.CapsuleGeometry(0.5, 1, 4, 8);
591
- const material = new THREE20.MeshStandardMaterial({ color: "#ffffff" });
592
- const mesh = new THREE20.Mesh(geometry, material);
599
+ const geometry = new THREE21.CapsuleGeometry(0.5, 1, 4, 8);
600
+ const material = new THREE21.MeshStandardMaterial({ color: "#ffffff" });
601
+ const mesh = new THREE21.Mesh(geometry, material);
593
602
  const entityId = createBaseEntity(world, mesh, {
594
603
  label: payload.name ?? "Capsule",
595
604
  entityType: "capsule",
@@ -609,9 +618,9 @@ function createCapsule({
609
618
  }
610
619
  __name(createCapsule, "createCapsule");
611
620
  function createCube({ world, scene, payload }) {
612
- const geometry = new THREE20.BoxGeometry(1, 1, 1);
613
- const material = new THREE20.MeshStandardMaterial({ color: "#ffffff" });
614
- const mesh = new THREE20.Mesh(geometry, material);
621
+ const geometry = new THREE21.BoxGeometry(1, 1, 1);
622
+ const material = new THREE21.MeshStandardMaterial({ color: "#ffffff" });
623
+ const mesh = new THREE21.Mesh(geometry, material);
615
624
  const entityId = createBaseEntity(world, mesh, {
616
625
  label: payload.name ?? "Cube",
617
626
  entityType: "cube",
@@ -636,9 +645,9 @@ function createCylinder({
636
645
  scene,
637
646
  payload
638
647
  }) {
639
- const geometry = new THREE20.CylinderGeometry(0.5, 0.5, 1, 20);
640
- const material = new THREE20.MeshStandardMaterial({ color: "#ffffff" });
641
- const mesh = new THREE20.Mesh(geometry, material);
648
+ const geometry = new THREE21.CylinderGeometry(0.5, 0.5, 1, 20);
649
+ const material = new THREE21.MeshStandardMaterial({ color: "#ffffff" });
650
+ const mesh = new THREE21.Mesh(geometry, material);
642
651
  const entityId = createBaseEntity(world, mesh, {
643
652
  label: payload.name ?? "Cylinder",
644
653
  entityType: "cylinder",
@@ -658,7 +667,7 @@ function createCylinder({
658
667
  }
659
668
  __name(createCylinder, "createCylinder");
660
669
  function createEmpty({ world, scene, payload, isEditor }) {
661
- const object = new THREE20.Group();
670
+ const object = new THREE21.Group();
662
671
  const entityId = createBaseEntity(world, object, {
663
672
  label: payload.name ?? "Empty",
664
673
  entityType: "empty",
@@ -669,7 +678,7 @@ function createEmpty({ world, scene, payload, isEditor }) {
669
678
  }
670
679
  __name(createEmpty, "createEmpty");
671
680
  function createImage({ world, scene, payload }) {
672
- const anchor = new THREE20.Object3D();
681
+ const anchor = new THREE21.Object3D();
673
682
  const imagePath = payload.path ?? "";
674
683
  const entityId = createBaseEntity(world, anchor, {
675
684
  label: payload.name ?? "Image",
@@ -682,7 +691,7 @@ function createImage({ world, scene, payload }) {
682
691
  if (!imagePath) {
683
692
  return entityId;
684
693
  }
685
- const loader = new THREE20.TextureLoader();
694
+ const loader = new THREE21.TextureLoader();
686
695
  loader.load(
687
696
  imagePath,
688
697
  (texture) => {
@@ -690,13 +699,13 @@ function createImage({ world, scene, payload }) {
690
699
  texture.dispose();
691
700
  return;
692
701
  }
693
- const material = new THREE20.MeshBasicMaterial({
702
+ const material = new THREE21.MeshBasicMaterial({
694
703
  map: texture,
695
704
  transparent: true,
696
- side: THREE20.DoubleSide
705
+ side: THREE21.DoubleSide
697
706
  });
698
- const geometry = new THREE20.PlaneGeometry(1, 1);
699
- const plane = new THREE20.Mesh(geometry, material);
707
+ const geometry = new THREE21.PlaneGeometry(1, 1);
708
+ const plane = new THREE21.Mesh(geometry, material);
700
709
  plane.userData.entityId = entityId;
701
710
  const textureImage = texture.image;
702
711
  const width = textureImage?.width ?? 1;
@@ -742,7 +751,7 @@ function createImageTarget({
742
751
  payload,
743
752
  isEditor
744
753
  }) {
745
- const anchor = new THREE20.Object3D();
754
+ const anchor = new THREE21.Object3D();
746
755
  const imagePath = payload.path ?? "";
747
756
  const entityId = createBaseEntity(world, anchor, {
748
757
  label: payload.name ?? "Image Target",
@@ -759,7 +768,7 @@ function createImageTarget({
759
768
  if (!isEditor || !imagePath) {
760
769
  return entityId;
761
770
  }
762
- const loader = new THREE20.TextureLoader();
771
+ const loader = new THREE21.TextureLoader();
763
772
  loader.load(
764
773
  imagePath,
765
774
  (texture) => {
@@ -767,13 +776,13 @@ function createImageTarget({
767
776
  texture.dispose();
768
777
  return;
769
778
  }
770
- const material = new THREE20.MeshBasicMaterial({
779
+ const material = new THREE21.MeshBasicMaterial({
771
780
  map: texture,
772
781
  transparent: true,
773
- side: THREE20.DoubleSide
782
+ side: THREE21.DoubleSide
774
783
  });
775
- const geometry = new THREE20.PlaneGeometry(1, 1);
776
- const plane = new THREE20.Mesh(geometry, material);
784
+ const geometry = new THREE21.PlaneGeometry(1, 1);
785
+ const plane = new THREE21.Mesh(geometry, material);
777
786
  plane.userData.entityId = entityId;
778
787
  const textureImage = texture.image;
779
788
  const width = textureImage?.width ?? 1;
@@ -792,12 +801,48 @@ function createImageTarget({
792
801
  return entityId;
793
802
  }
794
803
  __name(createImageTarget, "createImageTarget");
804
+ function isInstancedMeshKind(value) {
805
+ return value === "cube" || value === "sphere" || value === "plane" || value === "cylinder" || value === "capsule";
806
+ }
807
+ __name(isInstancedMeshKind, "isInstancedMeshKind");
808
+ function isInstanceTransformArray(value) {
809
+ return Array.isArray(value);
810
+ }
811
+ __name(isInstanceTransformArray, "isInstanceTransformArray");
812
+ function createInstancedMesh({
813
+ world,
814
+ scene,
815
+ payload
816
+ }) {
817
+ const anchor = new THREE21.Object3D();
818
+ const opts = payload.options ?? {};
819
+ const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
820
+ const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
821
+ const instances = isInstanceTransformArray(
822
+ opts.instances
823
+ ) ? opts.instances : void 0;
824
+ const castShadow = typeof opts.castShadow === "boolean" ? opts.castShadow : false;
825
+ const receiveShadow = typeof opts.receiveShadow === "boolean" ? opts.receiveShadow : false;
826
+ const entityId = createBaseEntity(world, anchor, {
827
+ label: payload.name ?? "Instanced Mesh",
828
+ entityType: "instancedMesh",
829
+ transformInput: payload.transform
830
+ });
831
+ createInstancedMeshComponent(world, entityId, meshKind, meshParameters, {
832
+ castShadow,
833
+ receiveShadow,
834
+ instances
835
+ });
836
+ scene.add(anchor);
837
+ return entityId;
838
+ }
839
+ __name(createInstancedMesh, "createInstancedMesh");
795
840
  function createAmbientLight({
796
841
  world,
797
842
  scene,
798
843
  payload
799
844
  }) {
800
- const light = new THREE20.AmbientLight("#ffffff", 0.6);
845
+ const light = new THREE21.AmbientLight("#ffffff", 0.6);
801
846
  const entityId = createBaseEntity(world, light, {
802
847
  label: payload.name ?? "Ambient Light",
803
848
  entityType: "ambientLight",
@@ -814,7 +859,7 @@ function createAreaLight({
814
859
  payload,
815
860
  isEditor
816
861
  }) {
817
- const light = new THREE20.RectAreaLight("#ffffff", 5, 4, 4);
862
+ const light = new THREE21.RectAreaLight("#ffffff", 5, 4, 4);
818
863
  light.lookAt(0, 0, 0);
819
864
  const entityId = createBaseEntity(world, light, {
820
865
  label: payload.name ?? "Area Light",
@@ -843,7 +888,7 @@ function createDirectionalLight({
843
888
  payload,
844
889
  isEditor
845
890
  }) {
846
- const light = new THREE20.DirectionalLight("#ffffff", 1.5);
891
+ const light = new THREE21.DirectionalLight("#ffffff", 1.5);
847
892
  light.castShadow = true;
848
893
  const entityId = createBaseEntity(world, light, {
849
894
  label: payload.name ?? "Directional Light",
@@ -854,7 +899,7 @@ function createDirectionalLight({
854
899
  });
855
900
  createLightComponent(world, entityId, light);
856
901
  if (isEditor) {
857
- const helper = new THREE20.DirectionalLightHelper(light, 1.8, "#38bdf8");
902
+ const helper = new THREE21.DirectionalLightHelper(light, 1.8, "#38bdf8");
858
903
  helper.onBeforeRender = () => {
859
904
  helper.update();
860
905
  };
@@ -872,7 +917,7 @@ function createPointLight({
872
917
  payload,
873
918
  isEditor
874
919
  }) {
875
- const light = new THREE20.PointLight("#ffffff", 1, 10);
920
+ const light = new THREE21.PointLight("#ffffff", 1, 10);
876
921
  const entityId = createBaseEntity(world, light, {
877
922
  label: payload.name ?? "Point Light",
878
923
  entityType: "pointLight",
@@ -882,7 +927,7 @@ function createPointLight({
882
927
  });
883
928
  createLightComponent(world, entityId, light);
884
929
  if (isEditor) {
885
- const helper = new THREE20.PointLightHelper(light, 0.35, "#fbbf24");
930
+ const helper = new THREE21.PointLightHelper(light, 0.35, "#fbbf24");
886
931
  helper.onBeforeRender = () => {
887
932
  helper.update();
888
933
  };
@@ -900,7 +945,7 @@ function createSpotLight({
900
945
  payload,
901
946
  isEditor
902
947
  }) {
903
- const light = new THREE20.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
948
+ const light = new THREE21.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
904
949
  const entityId = createBaseEntity(world, light, {
905
950
  label: payload.name ?? "Spot Light",
906
951
  entityType: "spotLight",
@@ -910,7 +955,7 @@ function createSpotLight({
910
955
  });
911
956
  createLightComponent(world, entityId, light);
912
957
  if (isEditor) {
913
- const helper = new THREE20.SpotLightHelper(light, "#f59e0b");
958
+ const helper = new THREE21.SpotLightHelper(light, "#f59e0b");
914
959
  helper.onBeforeRender = () => {
915
960
  helper.update();
916
961
  };
@@ -941,7 +986,7 @@ function createModelLoader() {
941
986
  }
942
987
  __name(createModelLoader, "createModelLoader");
943
988
  function createModel({ world, scene, payload }) {
944
- const anchor = new THREE20.Object3D();
989
+ const anchor = new THREE21.Object3D();
945
990
  const modelPath = payload.path ?? "";
946
991
  const entityId = createBaseEntity(world, anchor, {
947
992
  label: payload.name ?? "Model",
@@ -998,12 +1043,12 @@ function createModel({ world, scene, payload }) {
998
1043
  }
999
1044
  __name(createModel, "createModel");
1000
1045
  function createPlane({ world, scene, payload }) {
1001
- const geometry = new THREE20.PlaneGeometry(100, 100);
1002
- const material = new THREE20.MeshStandardMaterial({
1046
+ const geometry = new THREE21.PlaneGeometry(100, 100);
1047
+ const material = new THREE21.MeshStandardMaterial({
1003
1048
  color: "#ffffff",
1004
- side: THREE20.DoubleSide
1049
+ side: THREE21.DoubleSide
1005
1050
  });
1006
- const mesh = new THREE20.Mesh(geometry, material);
1051
+ const mesh = new THREE21.Mesh(geometry, material);
1007
1052
  const entityId = createBaseEntity(
1008
1053
  world,
1009
1054
  mesh,
@@ -1035,7 +1080,7 @@ function createPlane({ world, scene, payload }) {
1035
1080
  }
1036
1081
  __name(createPlane, "createPlane");
1037
1082
  function createSprite({ world, scene, payload }) {
1038
- const anchor = new THREE20.Object3D();
1083
+ const anchor = new THREE21.Object3D();
1039
1084
  const imagePath = payload.path ?? "";
1040
1085
  const entityId = createBaseEntity(world, anchor, {
1041
1086
  label: payload.name ?? "Sprite",
@@ -1047,7 +1092,7 @@ function createSprite({ world, scene, payload }) {
1047
1092
  if (!imagePath) {
1048
1093
  return entityId;
1049
1094
  }
1050
- const loader = new THREE20.TextureLoader();
1095
+ const loader = new THREE21.TextureLoader();
1051
1096
  loader.load(
1052
1097
  imagePath,
1053
1098
  (texture) => {
@@ -1055,11 +1100,11 @@ function createSprite({ world, scene, payload }) {
1055
1100
  texture.dispose();
1056
1101
  return;
1057
1102
  }
1058
- const material = new THREE20.SpriteMaterial({
1103
+ const material = new THREE21.SpriteMaterial({
1059
1104
  map: texture,
1060
1105
  transparent: true
1061
1106
  });
1062
- const sprite = new THREE20.Sprite(material);
1107
+ const sprite = new THREE21.Sprite(material);
1063
1108
  sprite.userData.entityId = entityId;
1064
1109
  const textureImage = texture.image;
1065
1110
  spriteComponent.width = textureImage?.width ?? 1;
@@ -1077,9 +1122,9 @@ function createSprite({ world, scene, payload }) {
1077
1122
  }
1078
1123
  __name(createSprite, "createSprite");
1079
1124
  function createSphere({ world, scene, payload }) {
1080
- const geometry = new THREE20.SphereGeometry(0.5, 24, 24);
1081
- const material = new THREE20.MeshStandardMaterial({ color: "#ffffff" });
1082
- const mesh = new THREE20.Mesh(geometry, material);
1125
+ const geometry = new THREE21.SphereGeometry(0.5, 24, 24);
1126
+ const material = new THREE21.MeshStandardMaterial({ color: "#ffffff" });
1127
+ const mesh = new THREE21.Mesh(geometry, material);
1083
1128
  const entityId = createBaseEntity(world, mesh, {
1084
1129
  label: payload.name ?? "Sphere",
1085
1130
  entityType: "sphere",
@@ -1099,10 +1144,10 @@ function createSphere({ world, scene, payload }) {
1099
1144
  __name(createSphere, "createSphere");
1100
1145
  function getOrCreateListener2(camera) {
1101
1146
  const existing = camera.userData.ecsAudioListener;
1102
- if (existing instanceof THREE20.AudioListener) {
1147
+ if (existing instanceof THREE21.AudioListener) {
1103
1148
  return existing;
1104
1149
  }
1105
- const listener = new THREE20.AudioListener();
1150
+ const listener = new THREE21.AudioListener();
1106
1151
  camera.add(listener);
1107
1152
  camera.userData.ecsAudioListener = listener;
1108
1153
  return listener;
@@ -1152,10 +1197,10 @@ function normalizeOptions(input) {
1152
1197
  }
1153
1198
  __name(normalizeOptions, "normalizeOptions");
1154
1199
  function createChromaMaterial(texture, options) {
1155
- return new THREE20.ShaderMaterial({
1200
+ return new THREE21.ShaderMaterial({
1156
1201
  uniforms: {
1157
1202
  tex: { value: texture },
1158
- keyColor: { value: new THREE20.Color(options.backgroundColor) },
1203
+ keyColor: { value: new THREE21.Color(options.backgroundColor) },
1159
1204
  similarity: { value: options.similarity },
1160
1205
  smoothness: { value: options.smoothness },
1161
1206
  spill: { value: options.spill }
@@ -1187,22 +1232,22 @@ function createChromaMaterial(texture, options) {
1187
1232
  }
1188
1233
  `,
1189
1234
  transparent: true,
1190
- side: THREE20.DoubleSide
1235
+ side: THREE21.DoubleSide
1191
1236
  });
1192
1237
  }
1193
1238
  __name(createChromaMaterial, "createChromaMaterial");
1194
1239
  function createStandardMaterial(texture) {
1195
- return new THREE20.MeshBasicMaterial({
1240
+ return new THREE21.MeshBasicMaterial({
1196
1241
  map: texture,
1197
1242
  transparent: true,
1198
- side: THREE20.DoubleSide
1243
+ side: THREE21.DoubleSide
1199
1244
  });
1200
1245
  }
1201
1246
  __name(createStandardMaterial, "createStandardMaterial");
1202
1247
  function createVideoMesh(entityId, texture, options) {
1203
- const geometry = new THREE20.PlaneGeometry(1, 1);
1248
+ const geometry = new THREE21.PlaneGeometry(1, 1);
1204
1249
  const material = options.isGreenScreen ? createChromaMaterial(texture, options) : createStandardMaterial(texture);
1205
- const mesh = new THREE20.Mesh(geometry, material);
1250
+ const mesh = new THREE21.Mesh(geometry, material);
1206
1251
  mesh.userData.entityId = entityId;
1207
1252
  mesh.scale.set(options.width, options.height, 1);
1208
1253
  return { mesh, material };
@@ -1237,7 +1282,7 @@ function createVideo({
1237
1282
  payload,
1238
1283
  isEditor
1239
1284
  }) {
1240
- const anchor = new THREE20.Object3D();
1285
+ const anchor = new THREE21.Object3D();
1241
1286
  const path = payload.path ?? "";
1242
1287
  const options = normalizeOptions(payload.options);
1243
1288
  const entityId = createBaseEntity(world, anchor, {
@@ -1252,8 +1297,8 @@ function createVideo({
1252
1297
  return entityId;
1253
1298
  }
1254
1299
  const video = createVideoElement(path, options);
1255
- const texture = new THREE20.VideoTexture(video);
1256
- texture.colorSpace = THREE20.SRGBColorSpace;
1300
+ const texture = new THREE21.VideoTexture(video);
1301
+ texture.colorSpace = THREE21.SRGBColorSpace;
1257
1302
  texture.needsUpdate = true;
1258
1303
  const { mesh, material } = createVideoMesh(entityId, texture, options);
1259
1304
  anchor.add(mesh);
@@ -1269,7 +1314,7 @@ function createVideo({
1269
1314
  });
1270
1315
  if (!isEditor && options.positional) {
1271
1316
  const listener = getOrCreateListener2(camera);
1272
- const audioNode = new THREE20.PositionalAudio(listener);
1317
+ const audioNode = new THREE21.PositionalAudio(listener);
1273
1318
  audioNode.setVolume(options.volume);
1274
1319
  audioNode.setRefDistance(options.refDistance);
1275
1320
  audioNode.setDistanceModel(normalizeDistanceModel2(options.distanceModel));
@@ -1297,6 +1342,7 @@ function registerDefaultFactories(objectManagementSystem) {
1297
1342
  objectManagementSystem.register("model", createModel);
1298
1343
  objectManagementSystem.register("image", createImage);
1299
1344
  objectManagementSystem.register("imageTarget", createImageTarget);
1345
+ objectManagementSystem.register("instancedMesh", createInstancedMesh);
1300
1346
  objectManagementSystem.register("sprite", createSprite);
1301
1347
  objectManagementSystem.register("audio", createAudio);
1302
1348
  objectManagementSystem.register("camera", createCamera);
@@ -1310,6 +1356,6 @@ function registerDefaultFactories(objectManagementSystem) {
1310
1356
  }
1311
1357
  __name(registerDefaultFactories, "registerDefaultFactories");
1312
1358
 
1313
- export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVideoComponent, registerDefaultComponentFactories, registerDefaultFactories };
1314
- //# sourceMappingURL=chunk-XWIEEJ7Z.js.map
1315
- //# sourceMappingURL=chunk-XWIEEJ7Z.js.map
1359
+ 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 };
1360
+ //# sourceMappingURL=chunk-4A66FSFT.js.map
1361
+ //# sourceMappingURL=chunk-4A66FSFT.js.map