@relu-interactives/spatial-ecs 0.2.15 → 0.2.16

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/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var THREE34 = require('three');
3
+ var THREE35 = require('three');
4
+ var SkeletonUtils_js = require('three/examples/jsm/utils/SkeletonUtils.js');
4
5
  var RectAreaLightHelper_js = require('three/examples/jsm/helpers/RectAreaLightHelper.js');
5
6
  var DRACOLoader_js = require('three/examples/jsm/loaders/DRACOLoader.js');
6
7
  var GLTFLoader_js = require('three/examples/jsm/loaders/GLTFLoader.js');
@@ -38,7 +39,7 @@ function _interopNamespace(e) {
38
39
  return Object.freeze(n);
39
40
  }
40
41
 
41
- var THREE34__namespace = /*#__PURE__*/_interopNamespace(THREE34);
42
+ var THREE35__namespace = /*#__PURE__*/_interopNamespace(THREE35);
42
43
 
43
44
  var __defProp = Object.defineProperty;
44
45
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
@@ -590,14 +591,14 @@ var _AnimationComponent = class _AnimationComponent extends Component {
590
591
  return;
591
592
  }
592
593
  this.importedClips = clips.map((entry) => {
593
- if (entry instanceof THREE34__namespace.AnimationClip) {
594
+ if (entry instanceof THREE35__namespace.AnimationClip) {
594
595
  return { clip: entry, sourceUrl: null };
595
596
  }
596
597
  if (!entry || typeof entry !== "object") {
597
598
  return null;
598
599
  }
599
600
  const candidate = entry;
600
- if (!(candidate.clip instanceof THREE34__namespace.AnimationClip)) {
601
+ if (!(candidate.clip instanceof THREE35__namespace.AnimationClip)) {
601
602
  return null;
602
603
  }
603
604
  return {
@@ -805,11 +806,11 @@ function normalizeDistanceModel(distanceModel) {
805
806
  }
806
807
  __name(normalizeDistanceModel, "normalizeDistanceModel");
807
808
  function createConfiguredAudio(listener, options) {
808
- const sound = options.positional ? new THREE34__namespace.PositionalAudio(listener) : new THREE34__namespace.Audio(listener);
809
+ const sound = options.positional ? new THREE35__namespace.PositionalAudio(listener) : new THREE35__namespace.Audio(listener);
809
810
  sound.setLoop(options.loop);
810
811
  sound.setVolume(options.volume);
811
812
  sound.setPlaybackRate(options.pitch);
812
- if (sound instanceof THREE34__namespace.PositionalAudio) {
813
+ if (sound instanceof THREE35__namespace.PositionalAudio) {
813
814
  sound.setRefDistance(options.refDistance);
814
815
  sound.setDistanceModel(normalizeDistanceModel(options.distanceModel));
815
816
  sound.setRolloffFactor(options.rolloffFactor);
@@ -819,16 +820,16 @@ function createConfiguredAudio(listener, options) {
819
820
  __name(createConfiguredAudio, "createConfiguredAudio");
820
821
  function createAudioEditorHelper() {
821
822
  if (typeof document === "undefined") {
822
- const geometry = new THREE34__namespace.EdgesGeometry(
823
- new THREE34__namespace.OctahedronGeometry(0.22, 0)
823
+ const geometry = new THREE35__namespace.EdgesGeometry(
824
+ new THREE35__namespace.OctahedronGeometry(0.22, 0)
824
825
  );
825
- const material2 = new THREE34__namespace.LineBasicMaterial({
826
+ const material2 = new THREE35__namespace.LineBasicMaterial({
826
827
  color: "#8bc8ff",
827
828
  transparent: true,
828
829
  opacity: 0.95,
829
830
  depthTest: false
830
831
  });
831
- const fallback = new THREE34__namespace.LineSegments(geometry, material2);
832
+ const fallback = new THREE35__namespace.LineSegments(geometry, material2);
832
833
  fallback.renderOrder = 10;
833
834
  fallback.userData.ecsHelper = true;
834
835
  fallback.visible = false;
@@ -840,7 +841,7 @@ function createAudioEditorHelper() {
840
841
  canvas.height = size;
841
842
  const ctx = canvas.getContext("2d");
842
843
  if (!ctx) {
843
- return new THREE34__namespace.Object3D();
844
+ return new THREE35__namespace.Object3D();
844
845
  }
845
846
  ctx.clearRect(0, 0, size, size);
846
847
  ctx.fillStyle = "rgba(27, 35, 52, 0.9)";
@@ -871,14 +872,14 @@ function createAudioEditorHelper() {
871
872
  ctx.beginPath();
872
873
  ctx.arc(56, 48, 16, -0.8, 0.8);
873
874
  ctx.stroke();
874
- const texture = new THREE34__namespace.CanvasTexture(canvas);
875
+ const texture = new THREE35__namespace.CanvasTexture(canvas);
875
876
  texture.needsUpdate = true;
876
- const material = new THREE34__namespace.SpriteMaterial({
877
+ const material = new THREE35__namespace.SpriteMaterial({
877
878
  map: texture,
878
879
  transparent: true,
879
880
  depthTest: false
880
881
  });
881
- const helper = new THREE34__namespace.Sprite(material);
882
+ const helper = new THREE35__namespace.Sprite(material);
882
883
  helper.scale.set(0.68, 0.68, 0.68);
883
884
  helper.renderOrder = 10;
884
885
  helper.userData.ecsHelper = true;
@@ -912,7 +913,7 @@ var DEFAULT_ORTHO_TOP = 5;
912
913
  var DEFAULT_ORTHO_BOTTOM = -5;
913
914
  var DEFAULT_ZOOM = 1;
914
915
  function inferProjection(camera) {
915
- if (camera instanceof THREE34__namespace.OrthographicCamera) {
916
+ if (camera instanceof THREE35__namespace.OrthographicCamera) {
916
917
  return "orthographic";
917
918
  }
918
919
  return "perspective";
@@ -933,7 +934,7 @@ function readCameraFar(camera) {
933
934
  }
934
935
  __name(readCameraFar, "readCameraFar");
935
936
  function inferFov(camera) {
936
- if (camera instanceof THREE34__namespace.PerspectiveCamera && Number.isFinite(camera.fov)) {
937
+ if (camera instanceof THREE35__namespace.PerspectiveCamera && Number.isFinite(camera.fov)) {
937
938
  return camera.fov;
938
939
  }
939
940
  return DEFAULT_FOV;
@@ -956,28 +957,28 @@ function inferFar(camera) {
956
957
  }
957
958
  __name(inferFar, "inferFar");
958
959
  function inferOrthoLeft(camera) {
959
- if (camera instanceof THREE34__namespace.OrthographicCamera && Number.isFinite(camera.left)) {
960
+ if (camera instanceof THREE35__namespace.OrthographicCamera && Number.isFinite(camera.left)) {
960
961
  return camera.left;
961
962
  }
962
963
  return DEFAULT_ORTHO_LEFT;
963
964
  }
964
965
  __name(inferOrthoLeft, "inferOrthoLeft");
965
966
  function inferOrthoRight(camera) {
966
- if (camera instanceof THREE34__namespace.OrthographicCamera && Number.isFinite(camera.right)) {
967
+ if (camera instanceof THREE35__namespace.OrthographicCamera && Number.isFinite(camera.right)) {
967
968
  return camera.right;
968
969
  }
969
970
  return DEFAULT_ORTHO_RIGHT;
970
971
  }
971
972
  __name(inferOrthoRight, "inferOrthoRight");
972
973
  function inferOrthoTop(camera) {
973
- if (camera instanceof THREE34__namespace.OrthographicCamera && Number.isFinite(camera.top)) {
974
+ if (camera instanceof THREE35__namespace.OrthographicCamera && Number.isFinite(camera.top)) {
974
975
  return camera.top;
975
976
  }
976
977
  return DEFAULT_ORTHO_TOP;
977
978
  }
978
979
  __name(inferOrthoTop, "inferOrthoTop");
979
980
  function inferOrthoBottom(camera) {
980
- if (camera instanceof THREE34__namespace.OrthographicCamera && Number.isFinite(camera.bottom)) {
981
+ if (camera instanceof THREE35__namespace.OrthographicCamera && Number.isFinite(camera.bottom)) {
981
982
  return camera.bottom;
982
983
  }
983
984
  return DEFAULT_ORTHO_BOTTOM;
@@ -993,7 +994,7 @@ __name(inferZoom, "inferZoom");
993
994
  var _CameraComponent = class _CameraComponent extends Component {
994
995
  constructor(payload = {}) {
995
996
  super();
996
- this.camera = payload.camera ?? new THREE34__namespace.PerspectiveCamera();
997
+ this.camera = payload.camera ?? new THREE35__namespace.PerspectiveCamera();
997
998
  this.type = payload.type ?? "3d";
998
999
  this.isDefault = typeof payload.isDefault === "boolean" ? payload.isDefault : false;
999
1000
  this.projection = payload.projection ?? inferProjection(payload.camera);
@@ -1024,7 +1025,7 @@ var Object3DRef = _Object3DRef;
1024
1025
  // core/factories/components/CameraFactory.ts
1025
1026
  function createCameraComponent(world, entityId, payload = {}) {
1026
1027
  const object = world.getComponent(entityId, Object3DRef)?.object;
1027
- const objectCamera = object instanceof THREE34__namespace.Camera ? object : void 0;
1028
+ const objectCamera = object instanceof THREE35__namespace.Camera ? object : void 0;
1028
1029
  const component = new CameraComponent({
1029
1030
  ...payload,
1030
1031
  camera: payload.camera ?? objectCamera
@@ -1464,15 +1465,15 @@ function createValueState(light) {
1464
1465
  castShadow: light.castShadow ?? false,
1465
1466
  frustumCulling: light.frustumCulled
1466
1467
  };
1467
- if (light instanceof THREE34__namespace.PointLight) {
1468
+ if (light instanceof THREE35__namespace.PointLight) {
1468
1469
  base.distance = light.distance;
1469
1470
  base.decay = light.decay;
1470
- } else if (light instanceof THREE34__namespace.SpotLight) {
1471
+ } else if (light instanceof THREE35__namespace.SpotLight) {
1471
1472
  base.distance = light.distance;
1472
1473
  base.decay = light.decay;
1473
1474
  base.angle = light.angle;
1474
1475
  base.penumbra = light.penumbra;
1475
- } else if (light instanceof THREE34__namespace.RectAreaLight) {
1476
+ } else if (light instanceof THREE35__namespace.RectAreaLight) {
1476
1477
  base.width = light.width;
1477
1478
  base.height = light.height;
1478
1479
  }
@@ -1515,13 +1516,13 @@ function toHexColor2(value, fallback) {
1515
1516
  }
1516
1517
  __name(toHexColor2, "toHexColor");
1517
1518
  function getMaterialType(material) {
1518
- if (material instanceof THREE34__namespace.MeshPhysicalMaterial) {
1519
+ if (material instanceof THREE35__namespace.MeshPhysicalMaterial) {
1519
1520
  return "physical";
1520
1521
  }
1521
- if (material instanceof THREE34__namespace.MeshPhongMaterial) {
1522
+ if (material instanceof THREE35__namespace.MeshPhongMaterial) {
1522
1523
  return "phong";
1523
1524
  }
1524
- if (material instanceof THREE34__namespace.MeshBasicMaterial) {
1525
+ if (material instanceof THREE35__namespace.MeshBasicMaterial) {
1525
1526
  return "basic";
1526
1527
  }
1527
1528
  return "standard";
@@ -1540,8 +1541,8 @@ function createMaterialValue(material) {
1540
1541
  opacity: typeof materialRecord.opacity === "number" ? materialRecord.opacity : 1,
1541
1542
  emissive: toHexColor2(materialRecord.emissive, "#000000"),
1542
1543
  emissiveIntensity: typeof materialRecord.emissiveIntensity === "number" ? materialRecord.emissiveIntensity : 0,
1543
- side: typeof materialRecord.side === "number" ? materialRecord.side : THREE34__namespace.FrontSide,
1544
- blending: typeof materialRecord.blending === "number" ? materialRecord.blending : THREE34__namespace.NormalBlending,
1544
+ side: typeof materialRecord.side === "number" ? materialRecord.side : THREE35__namespace.FrontSide,
1545
+ blending: typeof materialRecord.blending === "number" ? materialRecord.blending : THREE35__namespace.NormalBlending,
1545
1546
  depthTest: materialRecord.depthTest !== false,
1546
1547
  depthWrite: materialRecord.depthWrite !== false,
1547
1548
  wireframe: Boolean(materialRecord.wireframe),
@@ -1557,7 +1558,7 @@ function createMaterialValue(material) {
1557
1558
  displacementMap: materialRecord.displacementMap?.image?.src,
1558
1559
  lightMap: materialRecord.lightMap?.image?.src,
1559
1560
  envMap: materialRecord.envMap?.image?.src,
1560
- textureFiltering: map?.magFilter === THREE34__namespace.NearestFilter ? "sharp" : "smooth",
1561
+ textureFiltering: map?.magFilter === THREE35__namespace.NearestFilter ? "sharp" : "smooth",
1561
1562
  useMipmaps: map?.generateMipmaps !== false
1562
1563
  };
1563
1564
  }
@@ -1572,8 +1573,8 @@ function defaultMaterialValue() {
1572
1573
  opacity: 1,
1573
1574
  emissive: "#000000",
1574
1575
  emissiveIntensity: 0,
1575
- side: THREE34__namespace.FrontSide,
1576
- blending: THREE34__namespace.NormalBlending,
1576
+ side: THREE35__namespace.FrontSide,
1577
+ blending: THREE35__namespace.NormalBlending,
1577
1578
  depthTest: true,
1578
1579
  depthWrite: true,
1579
1580
  wireframe: false,
@@ -2171,14 +2172,14 @@ var _TransformComponent = class _TransformComponent extends Component {
2171
2172
  z: scale.z ?? 1
2172
2173
  };
2173
2174
  }
2174
- toPositionVector3(target = new THREE34.Vector3()) {
2175
+ toPositionVector3(target = new THREE35.Vector3()) {
2175
2176
  return target.set(this.position.x, this.position.y, this.position.z);
2176
2177
  }
2177
- toRotationEuler(target = new THREE34.Euler(), order = "XYZ") {
2178
+ toRotationEuler(target = new THREE35.Euler(), order = "XYZ") {
2178
2179
  return target.set(this.rotation.x, this.rotation.y, this.rotation.z, order);
2179
2180
  }
2180
- toRotationQuaternion(target = new THREE34.Quaternion(), order = "XYZ") {
2181
- const euler = new THREE34.Euler(
2181
+ toRotationQuaternion(target = new THREE35.Quaternion(), order = "XYZ") {
2182
+ const euler = new THREE35.Euler(
2182
2183
  this.rotation.x,
2183
2184
  this.rotation.y,
2184
2185
  this.rotation.z,
@@ -2186,7 +2187,7 @@ var _TransformComponent = class _TransformComponent extends Component {
2186
2187
  );
2187
2188
  return target.setFromEuler(euler);
2188
2189
  }
2189
- toScaleVector3(target = new THREE34.Vector3()) {
2190
+ toScaleVector3(target = new THREE35.Vector3()) {
2190
2191
  return target.set(this.scale.x, this.scale.y, this.scale.z);
2191
2192
  }
2192
2193
  setPosition(input) {
@@ -2204,8 +2205,8 @@ var _TransformComponent = class _TransformComponent extends Component {
2204
2205
  return this;
2205
2206
  }
2206
2207
  setRotation(input, order = "XYZ") {
2207
- if (input instanceof THREE34.Quaternion) {
2208
- const euler = new THREE34.Euler().setFromQuaternion(input, order);
2208
+ if (input instanceof THREE35.Quaternion) {
2209
+ const euler = new THREE35.Euler().setFromQuaternion(input, order);
2209
2210
  this.rotation.x = euler.x;
2210
2211
  this.rotation.y = euler.y;
2211
2212
  this.rotation.z = euler.z;
@@ -2454,6 +2455,54 @@ function registerDefaultComponentFactories(objectManagementSystem) {
2454
2455
  objectManagementSystem.registerComponentFactory("instancedMesh", createInstancedMeshComponent);
2455
2456
  }
2456
2457
  __name(registerDefaultComponentFactories, "registerDefaultComponentFactories");
2458
+ var SHARED_MODEL_RESOURCE_FLAG = "spatialEcsSharedModelResource";
2459
+ var modelCache = /* @__PURE__ */ new Map();
2460
+ function markSharedResources(root) {
2461
+ root.traverse((child) => {
2462
+ if (!(child instanceof THREE35__namespace.Mesh)) {
2463
+ return;
2464
+ }
2465
+ if (child.geometry) {
2466
+ child.geometry.userData[SHARED_MODEL_RESOURCE_FLAG] = true;
2467
+ }
2468
+ const materials = Array.isArray(child.material) ? child.material : [child.material];
2469
+ for (const material of materials) {
2470
+ if (material) {
2471
+ material.userData[SHARED_MODEL_RESOURCE_FLAG] = true;
2472
+ }
2473
+ }
2474
+ });
2475
+ }
2476
+ __name(markSharedResources, "markSharedResources");
2477
+ function loadSharedGltf(url, load) {
2478
+ let pending = modelCache.get(url);
2479
+ if (!pending) {
2480
+ pending = load().then((gltf) => {
2481
+ markSharedResources(gltf.scene);
2482
+ return gltf;
2483
+ });
2484
+ pending.catch(() => {
2485
+ modelCache.delete(url);
2486
+ });
2487
+ modelCache.set(url, pending);
2488
+ }
2489
+ return pending;
2490
+ }
2491
+ __name(loadSharedGltf, "loadSharedGltf");
2492
+ function cloneModelScene(scene) {
2493
+ return SkeletonUtils_js.clone(scene);
2494
+ }
2495
+ __name(cloneModelScene, "cloneModelScene");
2496
+ function clearModelCache(url) {
2497
+ if (typeof url === "string") {
2498
+ modelCache.delete(url);
2499
+ return;
2500
+ }
2501
+ modelCache.clear();
2502
+ }
2503
+ __name(clearModelCache, "clearModelCache");
2504
+
2505
+ // core/systems/ObjectManagementSystem.ts
2457
2506
  function createTransform(input) {
2458
2507
  return new TransformComponent(input);
2459
2508
  }
@@ -2489,10 +2538,10 @@ var _ObjectManagementSystem = class _ObjectManagementSystem {
2489
2538
  }
2490
2539
  getOrCreateAudioListener() {
2491
2540
  const existing = this.camera.userData.ecsAudioListener;
2492
- if (existing instanceof THREE34__namespace.AudioListener) {
2541
+ if (existing instanceof THREE35__namespace.AudioListener) {
2493
2542
  return existing;
2494
2543
  }
2495
- const listener = new THREE34__namespace.AudioListener();
2544
+ const listener = new THREE35__namespace.AudioListener();
2496
2545
  this.camera.add(listener);
2497
2546
  this.camera.userData.ecsAudioListener = listener;
2498
2547
  return listener;
@@ -2566,14 +2615,15 @@ var _ObjectManagementSystem = class _ObjectManagementSystem {
2566
2615
  }
2567
2616
  if (dispose && object3d) {
2568
2617
  object3d.traverse((child) => {
2569
- if (child instanceof THREE34__namespace.Mesh) {
2570
- child.geometry?.dispose();
2571
- if (Array.isArray(child.material)) {
2572
- for (const mat of child.material) {
2618
+ if (child instanceof THREE35__namespace.Mesh) {
2619
+ if (!child.geometry?.userData?.[SHARED_MODEL_RESOURCE_FLAG]) {
2620
+ child.geometry?.dispose();
2621
+ }
2622
+ const materials = Array.isArray(child.material) ? child.material : [child.material];
2623
+ for (const mat of materials) {
2624
+ if (mat && !mat.userData?.[SHARED_MODEL_RESOURCE_FLAG]) {
2573
2625
  mat.dispose();
2574
2626
  }
2575
- } else {
2576
- child.material?.dispose();
2577
2627
  }
2578
2628
  }
2579
2629
  });
@@ -2702,10 +2752,10 @@ __name(createBaseEntity, "createBaseEntity");
2702
2752
  // core/factories/objects/AudioFactory.ts
2703
2753
  function getOrCreateListener(camera) {
2704
2754
  const existing = camera.userData.ecsAudioListener;
2705
- if (existing instanceof THREE34__namespace.AudioListener) {
2755
+ if (existing instanceof THREE35__namespace.AudioListener) {
2706
2756
  return existing;
2707
2757
  }
2708
- const listener = new THREE34__namespace.AudioListener();
2758
+ const listener = new THREE35__namespace.AudioListener();
2709
2759
  camera.add(listener);
2710
2760
  camera.userData.ecsAudioListener = listener;
2711
2761
  return listener;
@@ -2718,7 +2768,7 @@ function createAudio({
2718
2768
  payload,
2719
2769
  isEditor
2720
2770
  }) {
2721
- const anchor = new THREE34__namespace.Object3D();
2771
+ const anchor = new THREE35__namespace.Object3D();
2722
2772
  const entityId = createBaseEntity(world, anchor, {
2723
2773
  label: payload.name ?? "Audio",
2724
2774
  entityType: "audio",
@@ -2740,7 +2790,7 @@ function createAudio({
2740
2790
  return entityId;
2741
2791
  }
2742
2792
  if (!isEditor) {
2743
- const loader = new THREE34__namespace.AudioLoader();
2793
+ const loader = new THREE35__namespace.AudioLoader();
2744
2794
  loader.load(
2745
2795
  audio.path,
2746
2796
  (buffer) => {
@@ -2815,7 +2865,7 @@ function applyCameraSettings(camera, options) {
2815
2865
  const near = typeof options.near === "number" ? options.near : DEFAULT_NEAR2;
2816
2866
  const far = typeof options.far === "number" ? options.far : DEFAULT_FAR2;
2817
2867
  const projection = options.projection;
2818
- if (camera instanceof THREE34__namespace.PerspectiveCamera) {
2868
+ if (camera instanceof THREE35__namespace.PerspectiveCamera) {
2819
2869
  if (!projection || projection === "perspective") {
2820
2870
  camera.fov = typeof options.fov === "number" ? options.fov : DEFAULT_FOV2;
2821
2871
  }
@@ -2825,7 +2875,7 @@ function applyCameraSettings(camera, options) {
2825
2875
  camera.updateProjectionMatrix();
2826
2876
  return;
2827
2877
  }
2828
- if (camera instanceof THREE34__namespace.OrthographicCamera) {
2878
+ if (camera instanceof THREE35__namespace.OrthographicCamera) {
2829
2879
  camera.left = typeof options.left === "number" ? options.left : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
2830
2880
  camera.right = typeof options.right === "number" ? options.right : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
2831
2881
  camera.top = typeof options.top === "number" ? options.top : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
@@ -2846,7 +2896,7 @@ function createCameraObject(options) {
2846
2896
  const bottom = options.bottom ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
2847
2897
  const left = options.left ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
2848
2898
  const right = options.right ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
2849
- const camera = new THREE34__namespace.OrthographicCamera(
2899
+ const camera = new THREE35__namespace.OrthographicCamera(
2850
2900
  left,
2851
2901
  right,
2852
2902
  top,
@@ -2858,7 +2908,7 @@ function createCameraObject(options) {
2858
2908
  camera.updateProjectionMatrix();
2859
2909
  return camera;
2860
2910
  }
2861
- return new THREE34__namespace.PerspectiveCamera(
2911
+ return new THREE35__namespace.PerspectiveCamera(
2862
2912
  options.fov ?? DEFAULT_FOV2,
2863
2913
  readViewportAspect(),
2864
2914
  near,
@@ -2876,7 +2926,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
2876
2926
  transformInput: payload.transform
2877
2927
  });
2878
2928
  const objectRef = world.getComponent(entityId, Object3DRef);
2879
- if (objectRef?.object instanceof THREE34__namespace.Camera) {
2929
+ if (objectRef?.object instanceof THREE35__namespace.Camera) {
2880
2930
  objectRef.object.userData.entityId = entityId;
2881
2931
  }
2882
2932
  const componentOptions = {
@@ -2899,7 +2949,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
2899
2949
  } else {
2900
2950
  applyCameraSettings(object, options);
2901
2951
  if (isEditor && component.isDefault) {
2902
- const helper = new THREE34__namespace.CameraHelper(object);
2952
+ const helper = new THREE35__namespace.CameraHelper(object);
2903
2953
  helper.onBeforeRender = () => {
2904
2954
  helper.update();
2905
2955
  };
@@ -2917,9 +2967,9 @@ function createCapsule({
2917
2967
  scene,
2918
2968
  payload
2919
2969
  }) {
2920
- const geometry = new THREE34__namespace.CapsuleGeometry(0.5, 1, 4, 8);
2921
- const material = new THREE34__namespace.MeshStandardMaterial({ color: "#ffffff" });
2922
- const mesh = new THREE34__namespace.Mesh(geometry, material);
2970
+ const geometry = new THREE35__namespace.CapsuleGeometry(0.5, 1, 4, 8);
2971
+ const material = new THREE35__namespace.MeshStandardMaterial({ color: "#ffffff" });
2972
+ const mesh = new THREE35__namespace.Mesh(geometry, material);
2923
2973
  const entityId = createBaseEntity(world, mesh, {
2924
2974
  label: payload.name ?? "Capsule",
2925
2975
  entityType: "capsule",
@@ -2939,9 +2989,9 @@ function createCapsule({
2939
2989
  }
2940
2990
  __name(createCapsule, "createCapsule");
2941
2991
  function createCube({ world, scene, payload }) {
2942
- const geometry = new THREE34__namespace.BoxGeometry(1, 1, 1);
2943
- const material = new THREE34__namespace.MeshStandardMaterial({ color: "#ffffff" });
2944
- const mesh = new THREE34__namespace.Mesh(geometry, material);
2992
+ const geometry = new THREE35__namespace.BoxGeometry(1, 1, 1);
2993
+ const material = new THREE35__namespace.MeshStandardMaterial({ color: "#ffffff" });
2994
+ const mesh = new THREE35__namespace.Mesh(geometry, material);
2945
2995
  const entityId = createBaseEntity(world, mesh, {
2946
2996
  label: payload.name ?? "Cube",
2947
2997
  entityType: "cube",
@@ -2966,9 +3016,9 @@ function createCylinder({
2966
3016
  scene,
2967
3017
  payload
2968
3018
  }) {
2969
- const geometry = new THREE34__namespace.CylinderGeometry(0.5, 0.5, 1, 20);
2970
- const material = new THREE34__namespace.MeshStandardMaterial({ color: "#ffffff" });
2971
- const mesh = new THREE34__namespace.Mesh(geometry, material);
3019
+ const geometry = new THREE35__namespace.CylinderGeometry(0.5, 0.5, 1, 20);
3020
+ const material = new THREE35__namespace.MeshStandardMaterial({ color: "#ffffff" });
3021
+ const mesh = new THREE35__namespace.Mesh(geometry, material);
2972
3022
  const entityId = createBaseEntity(world, mesh, {
2973
3023
  label: payload.name ?? "Cylinder",
2974
3024
  entityType: "cylinder",
@@ -2988,7 +3038,7 @@ function createCylinder({
2988
3038
  }
2989
3039
  __name(createCylinder, "createCylinder");
2990
3040
  function createEmpty({ world, scene, payload, isEditor }) {
2991
- const object = new THREE34__namespace.Group();
3041
+ const object = new THREE35__namespace.Group();
2992
3042
  const entityId = createBaseEntity(world, object, {
2993
3043
  label: payload.name ?? "Empty",
2994
3044
  entityType: "empty",
@@ -2999,7 +3049,7 @@ function createEmpty({ world, scene, payload, isEditor }) {
2999
3049
  }
3000
3050
  __name(createEmpty, "createEmpty");
3001
3051
  function createImage({ world, scene, payload }) {
3002
- const anchor = new THREE34__namespace.Object3D();
3052
+ const anchor = new THREE35__namespace.Object3D();
3003
3053
  const imagePath = payload.path ?? "";
3004
3054
  const entityId = createBaseEntity(world, anchor, {
3005
3055
  label: payload.name ?? "Image",
@@ -3012,7 +3062,7 @@ function createImage({ world, scene, payload }) {
3012
3062
  if (!imagePath) {
3013
3063
  return entityId;
3014
3064
  }
3015
- const loader = new THREE34__namespace.TextureLoader();
3065
+ const loader = new THREE35__namespace.TextureLoader();
3016
3066
  loader.load(
3017
3067
  imagePath,
3018
3068
  (texture) => {
@@ -3020,13 +3070,13 @@ function createImage({ world, scene, payload }) {
3020
3070
  texture.dispose();
3021
3071
  return;
3022
3072
  }
3023
- const material = new THREE34__namespace.MeshBasicMaterial({
3073
+ const material = new THREE35__namespace.MeshBasicMaterial({
3024
3074
  map: texture,
3025
3075
  transparent: true,
3026
- side: THREE34__namespace.DoubleSide
3076
+ side: THREE35__namespace.DoubleSide
3027
3077
  });
3028
- const geometry = new THREE34__namespace.PlaneGeometry(1, 1);
3029
- const plane = new THREE34__namespace.Mesh(geometry, material);
3078
+ const geometry = new THREE35__namespace.PlaneGeometry(1, 1);
3079
+ const plane = new THREE35__namespace.Mesh(geometry, material);
3030
3080
  plane.userData.entityId = entityId;
3031
3081
  const textureImage = texture.image;
3032
3082
  const width = textureImage?.width ?? 1;
@@ -3072,7 +3122,7 @@ function createImageTarget({
3072
3122
  payload,
3073
3123
  isEditor
3074
3124
  }) {
3075
- const anchor = new THREE34__namespace.Object3D();
3125
+ const anchor = new THREE35__namespace.Object3D();
3076
3126
  const imagePath = payload.path ?? "";
3077
3127
  const entityId = createBaseEntity(world, anchor, {
3078
3128
  label: payload.name ?? "Image Target",
@@ -3089,7 +3139,7 @@ function createImageTarget({
3089
3139
  if (!isEditor || !imagePath) {
3090
3140
  return entityId;
3091
3141
  }
3092
- const loader = new THREE34__namespace.TextureLoader();
3142
+ const loader = new THREE35__namespace.TextureLoader();
3093
3143
  loader.load(
3094
3144
  imagePath,
3095
3145
  (texture) => {
@@ -3097,13 +3147,13 @@ function createImageTarget({
3097
3147
  texture.dispose();
3098
3148
  return;
3099
3149
  }
3100
- const material = new THREE34__namespace.MeshBasicMaterial({
3150
+ const material = new THREE35__namespace.MeshBasicMaterial({
3101
3151
  map: texture,
3102
3152
  transparent: true,
3103
- side: THREE34__namespace.DoubleSide
3153
+ side: THREE35__namespace.DoubleSide
3104
3154
  });
3105
- const geometry = new THREE34__namespace.PlaneGeometry(1, 1);
3106
- const plane = new THREE34__namespace.Mesh(geometry, material);
3155
+ const geometry = new THREE35__namespace.PlaneGeometry(1, 1);
3156
+ const plane = new THREE35__namespace.Mesh(geometry, material);
3107
3157
  plane.userData.entityId = entityId;
3108
3158
  const textureImage = texture.image;
3109
3159
  const width = textureImage?.width ?? 1;
@@ -3154,7 +3204,7 @@ function createInstancedMesh({
3154
3204
  scene,
3155
3205
  payload
3156
3206
  }) {
3157
- const anchor = new THREE34__namespace.Object3D();
3207
+ const anchor = new THREE35__namespace.Object3D();
3158
3208
  const opts = payload.options ?? {};
3159
3209
  const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
3160
3210
  const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
@@ -3225,7 +3275,7 @@ function createAmbientLight({
3225
3275
  scene,
3226
3276
  payload
3227
3277
  }) {
3228
- const light = new THREE34__namespace.AmbientLight("#ffffff", 0.6);
3278
+ const light = new THREE35__namespace.AmbientLight("#ffffff", 0.6);
3229
3279
  const entityId = createBaseEntity(world, light, {
3230
3280
  label: payload.name ?? "Ambient Light",
3231
3281
  entityType: "ambientLight",
@@ -3242,7 +3292,7 @@ function createAreaLight({
3242
3292
  payload,
3243
3293
  isEditor
3244
3294
  }) {
3245
- const light = new THREE34__namespace.RectAreaLight("#ffffff", 5, 4, 4);
3295
+ const light = new THREE35__namespace.RectAreaLight("#ffffff", 5, 4, 4);
3246
3296
  light.lookAt(0, 0, 0);
3247
3297
  const entityId = createBaseEntity(world, light, {
3248
3298
  label: payload.name ?? "Area Light",
@@ -3271,7 +3321,7 @@ function createDirectionalLight({
3271
3321
  payload,
3272
3322
  isEditor
3273
3323
  }) {
3274
- const light = new THREE34__namespace.DirectionalLight("#ffffff", 1.5);
3324
+ const light = new THREE35__namespace.DirectionalLight("#ffffff", 1.5);
3275
3325
  light.castShadow = true;
3276
3326
  const entityId = createBaseEntity(world, light, {
3277
3327
  label: payload.name ?? "Directional Light",
@@ -3282,7 +3332,7 @@ function createDirectionalLight({
3282
3332
  });
3283
3333
  createLightComponent(world, entityId, light);
3284
3334
  if (isEditor) {
3285
- const helper = new THREE34__namespace.DirectionalLightHelper(light, 1.8, "#38bdf8");
3335
+ const helper = new THREE35__namespace.DirectionalLightHelper(light, 1.8, "#38bdf8");
3286
3336
  helper.onBeforeRender = () => {
3287
3337
  helper.update();
3288
3338
  };
@@ -3300,7 +3350,7 @@ function createPointLight({
3300
3350
  payload,
3301
3351
  isEditor
3302
3352
  }) {
3303
- const light = new THREE34__namespace.PointLight("#ffffff", 1, 10);
3353
+ const light = new THREE35__namespace.PointLight("#ffffff", 1, 10);
3304
3354
  const entityId = createBaseEntity(world, light, {
3305
3355
  label: payload.name ?? "Point Light",
3306
3356
  entityType: "pointLight",
@@ -3310,7 +3360,7 @@ function createPointLight({
3310
3360
  });
3311
3361
  createLightComponent(world, entityId, light);
3312
3362
  if (isEditor) {
3313
- const helper = new THREE34__namespace.PointLightHelper(light, 0.35, "#fbbf24");
3363
+ const helper = new THREE35__namespace.PointLightHelper(light, 0.35, "#fbbf24");
3314
3364
  helper.onBeforeRender = () => {
3315
3365
  helper.update();
3316
3366
  };
@@ -3328,7 +3378,7 @@ function createSpotLight({
3328
3378
  payload,
3329
3379
  isEditor
3330
3380
  }) {
3331
- const light = new THREE34__namespace.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
3381
+ const light = new THREE35__namespace.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
3332
3382
  const entityId = createBaseEntity(world, light, {
3333
3383
  label: payload.name ?? "Spot Light",
3334
3384
  entityType: "spotLight",
@@ -3338,7 +3388,7 @@ function createSpotLight({
3338
3388
  });
3339
3389
  createLightComponent(world, entityId, light);
3340
3390
  if (isEditor) {
3341
- const helper = new THREE34__namespace.SpotLightHelper(light, "#f59e0b");
3391
+ const helper = new THREE35__namespace.SpotLightHelper(light, "#f59e0b");
3342
3392
  helper.onBeforeRender = () => {
3343
3393
  helper.update();
3344
3394
  };
@@ -3354,11 +3404,19 @@ __name(createSpotLight, "createSpotLight");
3354
3404
  // core/utils/dracoDecoderPath.ts
3355
3405
  var LOCAL_DRACO_DECODER_RELATIVE_PATH = "./assets/draco/";
3356
3406
  var DRACO_DECODER_CDN_PATH = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/";
3407
+ var dracoDecoderPathOverride = null;
3408
+ function setDracoDecoderPath(path) {
3409
+ dracoDecoderPathOverride = path;
3410
+ }
3411
+ __name(setDracoDecoderPath, "setDracoDecoderPath");
3357
3412
  function isBlockedBrowserFileUrl(url) {
3358
3413
  return url.startsWith("file://");
3359
3414
  }
3360
3415
  __name(isBlockedBrowserFileUrl, "isBlockedBrowserFileUrl");
3361
3416
  function resolveDracoDecoderPath() {
3417
+ if (dracoDecoderPathOverride) {
3418
+ return dracoDecoderPathOverride;
3419
+ }
3362
3420
  try {
3363
3421
  const resolvedPath = new URL(
3364
3422
  LOCAL_DRACO_DECODER_RELATIVE_PATH,
@@ -3415,7 +3473,6 @@ __export(components_exports, {
3415
3473
  });
3416
3474
 
3417
3475
  // core/factories/objects/ModelFactory.ts
3418
- var DEFAULT_DRACO_DECODER_PATH = resolveDracoDecoderPath();
3419
3476
  function getModelFileName(path) {
3420
3477
  const segments = path.split(/[\\/]/).filter(Boolean);
3421
3478
  return segments[segments.length - 1] ?? "";
@@ -3425,7 +3482,7 @@ function createModelLoader() {
3425
3482
  const loader = new GLTFLoader_js.GLTFLoader();
3426
3483
  try {
3427
3484
  const dracoLoader = new DRACOLoader_js.DRACOLoader();
3428
- dracoLoader.setDecoderPath(DEFAULT_DRACO_DECODER_PATH);
3485
+ dracoLoader.setDecoderPath(resolveDracoDecoderPath());
3429
3486
  loader.setDRACOLoader(dracoLoader);
3430
3487
  } catch (error) {
3431
3488
  console.warn("DRACOLoader could not be configured. Loading non-Draco models only.", error);
@@ -3433,8 +3490,13 @@ function createModelLoader() {
3433
3490
  return loader;
3434
3491
  }
3435
3492
  __name(createModelLoader, "createModelLoader");
3436
- function createModel({ world, scene, payload }) {
3437
- const anchor = new THREE34__namespace.Object3D();
3493
+ function createModel({
3494
+ world,
3495
+ scene,
3496
+ payload,
3497
+ isEditor
3498
+ }) {
3499
+ const anchor = new THREE35__namespace.Object3D();
3438
3500
  const modelPath = payload.path ?? "";
3439
3501
  const entityId = createBaseEntity(world, anchor, {
3440
3502
  label: payload.name ?? "Model",
@@ -3452,51 +3514,60 @@ function createModel({ world, scene, payload }) {
3452
3514
  if (!modelPath) {
3453
3515
  return entityId;
3454
3516
  }
3455
- const loader = createModelLoader();
3456
- loader.load(
3457
- modelPath,
3458
- (gltf) => {
3459
- if (!world.hasEntity(entityId)) {
3460
- return;
3461
- }
3462
- const object = gltf.scene;
3463
- object.userData.entityId = entityId;
3464
- object.traverse((child) => {
3465
- child.userData.entityId = entityId;
3466
- });
3467
- anchor.add(object);
3468
- model.object = object;
3469
- meshGeometry.object = object;
3470
- if (gltf.animations.length > 0) {
3471
- let animation = world.getComponent(entityId, AnimationComponent);
3472
- if (!animation) {
3473
- animation = createAnimationComponent(world, entityId, {
3474
- clips: gltf.animations,
3475
- externalClipSources: [],
3476
- paused: false,
3477
- reverse: false,
3478
- timeScale: 1,
3479
- crossFadeDuration: 0
3480
- });
3481
- }
3482
- animation.setModelClips(gltf.animations);
3517
+ const attachLoadedModel = /* @__PURE__ */ __name((gltf, object) => {
3518
+ if (!world.hasEntity(entityId)) {
3519
+ return;
3520
+ }
3521
+ object.userData.entityId = entityId;
3522
+ object.traverse((child) => {
3523
+ child.userData.entityId = entityId;
3524
+ });
3525
+ anchor.add(object);
3526
+ model.object = object;
3527
+ meshGeometry.object = object;
3528
+ if (gltf.animations.length > 0) {
3529
+ let animation = world.getComponent(entityId, AnimationComponent);
3530
+ if (!animation) {
3531
+ animation = createAnimationComponent(world, entityId, {
3532
+ clips: gltf.animations,
3533
+ externalClipSources: [],
3534
+ paused: false,
3535
+ reverse: false,
3536
+ timeScale: 1,
3537
+ crossFadeDuration: 0
3538
+ });
3483
3539
  }
3484
- },
3485
- void 0,
3486
- (error) => {
3487
- console.error(`Failed to load model: ${modelPath}`, error);
3540
+ animation.setModelClips(gltf.animations);
3488
3541
  }
3489
- );
3542
+ }, "attachLoadedModel");
3543
+ const onLoadError = /* @__PURE__ */ __name((error) => {
3544
+ console.error(`Failed to load model: ${modelPath}`, error);
3545
+ }, "onLoadError");
3546
+ if (isEditor) {
3547
+ createModelLoader().load(
3548
+ modelPath,
3549
+ (gltf) => attachLoadedModel(gltf, gltf.scene),
3550
+ void 0,
3551
+ onLoadError
3552
+ );
3553
+ } else {
3554
+ loadSharedGltf(
3555
+ modelPath,
3556
+ () => new Promise((resolve, reject) => {
3557
+ createModelLoader().load(modelPath, resolve, void 0, reject);
3558
+ })
3559
+ ).then((gltf) => attachLoadedModel(gltf, cloneModelScene(gltf.scene))).catch(onLoadError);
3560
+ }
3490
3561
  return entityId;
3491
3562
  }
3492
3563
  __name(createModel, "createModel");
3493
3564
  function createPlane({ world, scene, payload }) {
3494
- const geometry = new THREE34__namespace.PlaneGeometry(100, 100);
3495
- const material = new THREE34__namespace.MeshStandardMaterial({
3565
+ const geometry = new THREE35__namespace.PlaneGeometry(100, 100);
3566
+ const material = new THREE35__namespace.MeshStandardMaterial({
3496
3567
  color: "#ffffff",
3497
- side: THREE34__namespace.DoubleSide
3568
+ side: THREE35__namespace.DoubleSide
3498
3569
  });
3499
- const mesh = new THREE34__namespace.Mesh(geometry, material);
3570
+ const mesh = new THREE35__namespace.Mesh(geometry, material);
3500
3571
  const entityId = createBaseEntity(
3501
3572
  world,
3502
3573
  mesh,
@@ -3528,7 +3599,7 @@ function createPlane({ world, scene, payload }) {
3528
3599
  }
3529
3600
  __name(createPlane, "createPlane");
3530
3601
  function createSprite({ world, scene, payload }) {
3531
- const anchor = new THREE34__namespace.Object3D();
3602
+ const anchor = new THREE35__namespace.Object3D();
3532
3603
  const imagePath = payload.path ?? "";
3533
3604
  const entityId = createBaseEntity(world, anchor, {
3534
3605
  label: payload.name ?? "Sprite",
@@ -3540,7 +3611,7 @@ function createSprite({ world, scene, payload }) {
3540
3611
  if (!imagePath) {
3541
3612
  return entityId;
3542
3613
  }
3543
- const loader = new THREE34__namespace.TextureLoader();
3614
+ const loader = new THREE35__namespace.TextureLoader();
3544
3615
  loader.load(
3545
3616
  imagePath,
3546
3617
  (texture) => {
@@ -3548,11 +3619,11 @@ function createSprite({ world, scene, payload }) {
3548
3619
  texture.dispose();
3549
3620
  return;
3550
3621
  }
3551
- const material = new THREE34__namespace.SpriteMaterial({
3622
+ const material = new THREE35__namespace.SpriteMaterial({
3552
3623
  map: texture,
3553
3624
  transparent: true
3554
3625
  });
3555
- const sprite = new THREE34__namespace.Sprite(material);
3626
+ const sprite = new THREE35__namespace.Sprite(material);
3556
3627
  sprite.userData.entityId = entityId;
3557
3628
  const textureImage = texture.image;
3558
3629
  spriteComponent.width = textureImage?.width ?? 1;
@@ -3570,9 +3641,9 @@ function createSprite({ world, scene, payload }) {
3570
3641
  }
3571
3642
  __name(createSprite, "createSprite");
3572
3643
  function createSphere({ world, scene, payload }) {
3573
- const geometry = new THREE34__namespace.SphereGeometry(0.5, 24, 24);
3574
- const material = new THREE34__namespace.MeshStandardMaterial({ color: "#ffffff" });
3575
- const mesh = new THREE34__namespace.Mesh(geometry, material);
3644
+ const geometry = new THREE35__namespace.SphereGeometry(0.5, 24, 24);
3645
+ const material = new THREE35__namespace.MeshStandardMaterial({ color: "#ffffff" });
3646
+ const mesh = new THREE35__namespace.Mesh(geometry, material);
3576
3647
  const entityId = createBaseEntity(world, mesh, {
3577
3648
  label: payload.name ?? "Sphere",
3578
3649
  entityType: "sphere",
@@ -3592,10 +3663,10 @@ function createSphere({ world, scene, payload }) {
3592
3663
  __name(createSphere, "createSphere");
3593
3664
  function getOrCreateListener2(camera) {
3594
3665
  const existing = camera.userData.ecsAudioListener;
3595
- if (existing instanceof THREE34__namespace.AudioListener) {
3666
+ if (existing instanceof THREE35__namespace.AudioListener) {
3596
3667
  return existing;
3597
3668
  }
3598
- const listener = new THREE34__namespace.AudioListener();
3669
+ const listener = new THREE35__namespace.AudioListener();
3599
3670
  camera.add(listener);
3600
3671
  camera.userData.ecsAudioListener = listener;
3601
3672
  return listener;
@@ -3645,10 +3716,10 @@ function normalizeOptions(input) {
3645
3716
  }
3646
3717
  __name(normalizeOptions, "normalizeOptions");
3647
3718
  function createChromaMaterial(texture, options) {
3648
- return new THREE34__namespace.ShaderMaterial({
3719
+ return new THREE35__namespace.ShaderMaterial({
3649
3720
  uniforms: {
3650
3721
  tex: { value: texture },
3651
- keyColor: { value: new THREE34__namespace.Color(options.backgroundColor) },
3722
+ keyColor: { value: new THREE35__namespace.Color(options.backgroundColor) },
3652
3723
  similarity: { value: options.similarity },
3653
3724
  smoothness: { value: options.smoothness },
3654
3725
  spill: { value: options.spill }
@@ -3680,22 +3751,22 @@ function createChromaMaterial(texture, options) {
3680
3751
  }
3681
3752
  `,
3682
3753
  transparent: true,
3683
- side: THREE34__namespace.DoubleSide
3754
+ side: THREE35__namespace.DoubleSide
3684
3755
  });
3685
3756
  }
3686
3757
  __name(createChromaMaterial, "createChromaMaterial");
3687
3758
  function createStandardMaterial(texture) {
3688
- return new THREE34__namespace.MeshBasicMaterial({
3759
+ return new THREE35__namespace.MeshBasicMaterial({
3689
3760
  map: texture,
3690
3761
  transparent: true,
3691
- side: THREE34__namespace.DoubleSide
3762
+ side: THREE35__namespace.DoubleSide
3692
3763
  });
3693
3764
  }
3694
3765
  __name(createStandardMaterial, "createStandardMaterial");
3695
3766
  function createVideoMesh(entityId, texture, options) {
3696
- const geometry = new THREE34__namespace.PlaneGeometry(1, 1);
3767
+ const geometry = new THREE35__namespace.PlaneGeometry(1, 1);
3697
3768
  const material = options.isGreenScreen ? createChromaMaterial(texture, options) : createStandardMaterial(texture);
3698
- const mesh = new THREE34__namespace.Mesh(geometry, material);
3769
+ const mesh = new THREE35__namespace.Mesh(geometry, material);
3699
3770
  mesh.userData.entityId = entityId;
3700
3771
  mesh.scale.set(options.width, options.height, 1);
3701
3772
  return { mesh, material };
@@ -3730,7 +3801,7 @@ function createVideo({
3730
3801
  payload,
3731
3802
  isEditor
3732
3803
  }) {
3733
- const anchor = new THREE34__namespace.Object3D();
3804
+ const anchor = new THREE35__namespace.Object3D();
3734
3805
  const path = payload.path ?? "";
3735
3806
  const options = normalizeOptions(payload.options);
3736
3807
  const entityId = createBaseEntity(world, anchor, {
@@ -3745,8 +3816,8 @@ function createVideo({
3745
3816
  return entityId;
3746
3817
  }
3747
3818
  const video = createVideoElement(path, options);
3748
- const texture = new THREE34__namespace.VideoTexture(video);
3749
- texture.colorSpace = THREE34__namespace.SRGBColorSpace;
3819
+ const texture = new THREE35__namespace.VideoTexture(video);
3820
+ texture.colorSpace = THREE35__namespace.SRGBColorSpace;
3750
3821
  texture.needsUpdate = true;
3751
3822
  const { mesh, material } = createVideoMesh(entityId, texture, options);
3752
3823
  anchor.add(mesh);
@@ -3762,7 +3833,7 @@ function createVideo({
3762
3833
  });
3763
3834
  if (!isEditor && options.positional) {
3764
3835
  const listener = getOrCreateListener2(camera);
3765
- const audioNode = new THREE34__namespace.PositionalAudio(listener);
3836
+ const audioNode = new THREE35__namespace.PositionalAudio(listener);
3766
3837
  audioNode.setVolume(options.volume);
3767
3838
  audioNode.setRefDistance(options.refDistance);
3768
3839
  audioNode.setDistanceModel(normalizeDistanceModel2(options.distanceModel));
@@ -3943,7 +4014,7 @@ function transitionToClip(runtime, nextClipId, crossFadeDuration) {
3943
4014
  }
3944
4015
  __name(transitionToClip, "transitionToClip");
3945
4016
  function applyActionState(action, component, paused, shouldLoop) {
3946
- const loopMode = shouldLoop ? THREE34__namespace.LoopRepeat : THREE34__namespace.LoopOnce;
4017
+ const loopMode = shouldLoop ? THREE35__namespace.LoopRepeat : THREE35__namespace.LoopOnce;
3947
4018
  const repetitions = shouldLoop ? Infinity : 1;
3948
4019
  action.setLoop(loopMode, repetitions);
3949
4020
  action.clampWhenFinished = !shouldLoop;
@@ -4116,7 +4187,7 @@ var _AnimationSystem = class _AnimationSystem {
4116
4187
  if (runtime) {
4117
4188
  stopAllActions(runtime);
4118
4189
  }
4119
- const mixer = new THREE34__namespace.AnimationMixer(root);
4190
+ const mixer = new THREE35__namespace.AnimationMixer(root);
4120
4191
  const entries2 = readRuntimeClipEntries(animation);
4121
4192
  const indexedActions = createActions(mixer, entries2);
4122
4193
  runtime = {
@@ -4242,11 +4313,11 @@ function normalizeOrthoBounds(component) {
4242
4313
  }
4243
4314
  __name(normalizeOrthoBounds, "normalizeOrthoBounds");
4244
4315
  function isPerspectiveCamera(camera) {
4245
- return camera instanceof THREE34__namespace.PerspectiveCamera;
4316
+ return camera instanceof THREE35__namespace.PerspectiveCamera;
4246
4317
  }
4247
4318
  __name(isPerspectiveCamera, "isPerspectiveCamera");
4248
4319
  function isOrthographicCamera(camera) {
4249
- return camera instanceof THREE34__namespace.OrthographicCamera;
4320
+ return camera instanceof THREE35__namespace.OrthographicCamera;
4250
4321
  }
4251
4322
  __name(isOrthographicCamera, "isOrthographicCamera");
4252
4323
  function readWindowAspect() {
@@ -4299,7 +4370,7 @@ var _CameraSyncSystem = class _CameraSyncSystem {
4299
4370
  continue;
4300
4371
  }
4301
4372
  const camera = objectRef.object;
4302
- if (!(camera instanceof THREE34__namespace.Camera)) {
4373
+ if (!(camera instanceof THREE35__namespace.Camera)) {
4303
4374
  continue;
4304
4375
  }
4305
4376
  const nextSignature = buildSignature(component, camera, windowAspect);
@@ -4363,7 +4434,7 @@ var MIN_DENSITY = 0;
4363
4434
  function createGradientTexture(effect, colors) {
4364
4435
  if (typeof document === "undefined") {
4365
4436
  const pixel = new Uint8Array([30, 30, 30, 255]);
4366
- const fallback = new THREE34__namespace.DataTexture(pixel, 1, 1, THREE34__namespace.RGBAFormat);
4437
+ const fallback = new THREE35__namespace.DataTexture(pixel, 1, 1, THREE35__namespace.RGBAFormat);
4367
4438
  fallback.needsUpdate = true;
4368
4439
  return fallback;
4369
4440
  }
@@ -4372,7 +4443,7 @@ function createGradientTexture(effect, colors) {
4372
4443
  canvas.height = 512;
4373
4444
  const context = canvas.getContext("2d");
4374
4445
  if (!context) {
4375
- const fallback = new THREE34__namespace.CanvasTexture(canvas);
4446
+ const fallback = new THREE35__namespace.CanvasTexture(canvas);
4376
4447
  fallback.needsUpdate = true;
4377
4448
  return fallback;
4378
4449
  }
@@ -4400,15 +4471,15 @@ function createGradientTexture(effect, colors) {
4400
4471
  context.fillRect(0, 0, 512, 512);
4401
4472
  context.globalCompositeOperation = "source-over";
4402
4473
  }
4403
- const texture = new THREE34__namespace.CanvasTexture(canvas);
4404
- texture.colorSpace = THREE34__namespace.SRGBColorSpace;
4474
+ const texture = new THREE35__namespace.CanvasTexture(canvas);
4475
+ texture.colorSpace = THREE35__namespace.SRGBColorSpace;
4405
4476
  texture.needsUpdate = true;
4406
4477
  return texture;
4407
4478
  }
4408
4479
  __name(createGradientTexture, "createGradientTexture");
4409
4480
  var _EnvironmentSyncSystem = class _EnvironmentSyncSystem {
4410
4481
  constructor(scene) {
4411
- this.textureLoader = new THREE34__namespace.TextureLoader();
4482
+ this.textureLoader = new THREE35__namespace.TextureLoader();
4412
4483
  this.signature = null;
4413
4484
  this.activeTexture = null;
4414
4485
  this.pendingImageUrl = null;
@@ -4431,7 +4502,7 @@ var _EnvironmentSyncSystem = class _EnvironmentSyncSystem {
4431
4502
  if (skybox.type === "color") {
4432
4503
  this.disposeActiveTexture();
4433
4504
  this.pendingImageUrl = null;
4434
- this.scene.background = new THREE34__namespace.Color(skybox.color || "#1e1e1e");
4505
+ this.scene.background = new THREE35__namespace.Color(skybox.color || "#1e1e1e");
4435
4506
  return;
4436
4507
  }
4437
4508
  if (skybox.type === "gradient") {
@@ -4465,7 +4536,7 @@ var _EnvironmentSyncSystem = class _EnvironmentSyncSystem {
4465
4536
  texture.dispose();
4466
4537
  return;
4467
4538
  }
4468
- texture.colorSpace = THREE34__namespace.SRGBColorSpace;
4539
+ texture.colorSpace = THREE35__namespace.SRGBColorSpace;
4469
4540
  this.activeTexture = texture;
4470
4541
  this.scene.background = texture;
4471
4542
  },
@@ -4484,16 +4555,16 @@ var _EnvironmentSyncSystem = class _EnvironmentSyncSystem {
4484
4555
  this.scene.fog = null;
4485
4556
  return;
4486
4557
  }
4487
- const fogColor = new THREE34__namespace.Color(fog.color || "#1e1e1e");
4558
+ const fogColor = new THREE35__namespace.Color(fog.color || "#1e1e1e");
4488
4559
  if (fog.type === "linear") {
4489
4560
  const near = Number.isFinite(fog.linear.near) ? fog.linear.near : 1;
4490
4561
  const farCandidate = Number.isFinite(fog.linear.far) ? fog.linear.far : near + 10;
4491
4562
  const far = Math.max(near + MIN_FOG_DELTA, farCandidate);
4492
- this.scene.fog = new THREE34__namespace.Fog(fogColor, near, far);
4563
+ this.scene.fog = new THREE35__namespace.Fog(fogColor, near, far);
4493
4564
  return;
4494
4565
  }
4495
4566
  const density = Number.isFinite(fog.exponential.density) ? Math.max(MIN_DENSITY, fog.exponential.density) : 2e-3;
4496
- this.scene.fog = new THREE34__namespace.FogExp2(fogColor, density);
4567
+ this.scene.fog = new THREE35__namespace.FogExp2(fogColor, density);
4497
4568
  }
4498
4569
  update(world) {
4499
4570
  const entityIds = world.query(Environment);
@@ -4575,10 +4646,10 @@ var _PostprocessingSyncSystem = class _PostprocessingSyncSystem {
4575
4646
  );
4576
4647
  }
4577
4648
  if (values.bloom.enabled) {
4578
- const size = this.renderer.getSize(new THREE34__namespace.Vector2());
4649
+ const size = this.renderer.getSize(new THREE35__namespace.Vector2());
4579
4650
  composer.addPass(
4580
4651
  new UnrealBloomPass_js.UnrealBloomPass(
4581
- new THREE34__namespace.Vector2(size.width, size.height),
4652
+ new THREE35__namespace.Vector2(size.width, size.height),
4582
4653
  values.bloom.intensity,
4583
4654
  values.bloom.radius,
4584
4655
  values.bloom.threshold
@@ -4623,7 +4694,7 @@ var _PostprocessingSyncSystem = class _PostprocessingSyncSystem {
4623
4694
  if (values.dotScreen.enabled) {
4624
4695
  composer.addPass(
4625
4696
  new DotScreenPass_js.DotScreenPass(
4626
- new THREE34__namespace.Vector2(0, 0),
4697
+ new THREE35__namespace.Vector2(0, 0),
4627
4698
  values.dotScreen.angle ?? values.dotScreen.dotScreenAngle,
4628
4699
  values.dotScreen.scale ?? values.dotScreen.dotScreenScale
4629
4700
  )
@@ -4697,7 +4768,7 @@ function computeColliderState(colliderValues, object) {
4697
4768
  if (!object) {
4698
4769
  return colliderValues;
4699
4770
  }
4700
- const scale = new THREE34__namespace.Vector3();
4771
+ const scale = new THREE35__namespace.Vector3();
4701
4772
  object.getWorldScale(scale);
4702
4773
  return {
4703
4774
  ...colliderValues,
@@ -4748,8 +4819,8 @@ function createColliderDesc(RAPIER, values, triMeshData) {
4748
4819
  values.offsetPosition.y,
4749
4820
  values.offsetPosition.z
4750
4821
  );
4751
- const offsetQuaternion = new THREE34__namespace.Quaternion().setFromEuler(
4752
- new THREE34__namespace.Euler(
4822
+ const offsetQuaternion = new THREE35__namespace.Quaternion().setFromEuler(
4823
+ new THREE35__namespace.Euler(
4753
4824
  values.offsetRotation.x,
4754
4825
  values.offsetRotation.y,
4755
4826
  values.offsetRotation.z
@@ -4760,7 +4831,7 @@ function createColliderDesc(RAPIER, values, triMeshData) {
4760
4831
  }
4761
4832
  __name(createColliderDesc, "createColliderDesc");
4762
4833
  function findFirstMeshWithGeometry(object) {
4763
- if (object instanceof THREE34__namespace.Mesh && object.geometry) {
4834
+ if (object instanceof THREE35__namespace.Mesh && object.geometry) {
4764
4835
  return object;
4765
4836
  }
4766
4837
  let found = null;
@@ -4768,7 +4839,7 @@ function findFirstMeshWithGeometry(object) {
4768
4839
  if (found) {
4769
4840
  return;
4770
4841
  }
4771
- if (child instanceof THREE34__namespace.Mesh && child.geometry) {
4842
+ if (child instanceof THREE35__namespace.Mesh && child.geometry) {
4772
4843
  found = child;
4773
4844
  }
4774
4845
  });
@@ -4794,13 +4865,13 @@ function createTriMeshData(object) {
4794
4865
  }
4795
4866
  object.updateWorldMatrix(true, true);
4796
4867
  mesh.updateWorldMatrix(true, true);
4797
- const worldToObject = new THREE34__namespace.Matrix4().copy(object.matrixWorld).invert();
4798
- const relativeMatrix = new THREE34__namespace.Matrix4().multiplyMatrices(
4868
+ const worldToObject = new THREE35__namespace.Matrix4().copy(object.matrixWorld).invert();
4869
+ const relativeMatrix = new THREE35__namespace.Matrix4().multiplyMatrices(
4799
4870
  worldToObject,
4800
4871
  mesh.matrixWorld
4801
4872
  );
4802
4873
  const vertices = new Float32Array(positionCount * 3);
4803
- const point = new THREE34__namespace.Vector3();
4874
+ const point = new THREE35__namespace.Vector3();
4804
4875
  for (let index = 0; index < positionCount; index += 1) {
4805
4876
  point.set(
4806
4877
  positionAttribute.getX(index),
@@ -4838,8 +4909,8 @@ function createTriMeshData(object) {
4838
4909
  }
4839
4910
  __name(createTriMeshData, "createTriMeshData");
4840
4911
  function syncBodyFromTransform(body, transform) {
4841
- const quaternion = new THREE34__namespace.Quaternion().setFromEuler(
4842
- new THREE34__namespace.Euler(transform.rotation.x, transform.rotation.y, transform.rotation.z)
4912
+ const quaternion = new THREE35__namespace.Quaternion().setFromEuler(
4913
+ new THREE35__namespace.Euler(transform.rotation.x, transform.rotation.y, transform.rotation.z)
4843
4914
  );
4844
4915
  body.setTranslation(
4845
4916
  {
@@ -4866,8 +4937,8 @@ function syncTransformFromBody(transform, body) {
4866
4937
  transform.position.x = position.x;
4867
4938
  transform.position.y = position.y;
4868
4939
  transform.position.z = position.z;
4869
- const euler = new THREE34__namespace.Euler().setFromQuaternion(
4870
- new THREE34__namespace.Quaternion(rotation.x, rotation.y, rotation.z, rotation.w)
4940
+ const euler = new THREE35__namespace.Euler().setFromQuaternion(
4941
+ new THREE35__namespace.Quaternion(rotation.x, rotation.y, rotation.z, rotation.w)
4871
4942
  );
4872
4943
  transform.rotation.x = euler.x;
4873
4944
  transform.rotation.y = euler.y;
@@ -4979,8 +5050,8 @@ var _PhysicsSyncSystem = class _PhysicsSyncSystem {
4979
5050
  transform.position.y,
4980
5051
  transform.position.z
4981
5052
  );
4982
- const quaternion = new THREE34__namespace.Quaternion().setFromEuler(
4983
- new THREE34__namespace.Euler(
5053
+ const quaternion = new THREE35__namespace.Quaternion().setFromEuler(
5054
+ new THREE35__namespace.Euler(
4984
5055
  transform.rotation.x,
4985
5056
  transform.rotation.y,
4986
5057
  transform.rotation.z
@@ -5555,7 +5626,7 @@ function applyLightValues(lightComponent) {
5555
5626
  values.castShadow
5556
5627
  );
5557
5628
  }
5558
- if (light instanceof THREE34__namespace.PointLight) {
5629
+ if (light instanceof THREE35__namespace.PointLight) {
5559
5630
  if (typeof values.distance === "number" && Number.isFinite(values.distance)) {
5560
5631
  light.distance = Math.max(MIN_LIGHT_DISTANCE, values.distance);
5561
5632
  }
@@ -5563,7 +5634,7 @@ function applyLightValues(lightComponent) {
5563
5634
  light.decay = Math.max(0, values.decay);
5564
5635
  }
5565
5636
  }
5566
- if (light instanceof THREE34__namespace.SpotLight) {
5637
+ if (light instanceof THREE35__namespace.SpotLight) {
5567
5638
  if (typeof values.distance === "number" && Number.isFinite(values.distance)) {
5568
5639
  light.distance = Math.max(MIN_LIGHT_DISTANCE, values.distance);
5569
5640
  }
@@ -5577,7 +5648,7 @@ function applyLightValues(lightComponent) {
5577
5648
  light.penumbra = Math.max(0, Math.min(1, values.penumbra));
5578
5649
  }
5579
5650
  }
5580
- if (light instanceof THREE34__namespace.RectAreaLight) {
5651
+ if (light instanceof THREE35__namespace.RectAreaLight) {
5581
5652
  if (typeof values.width === "number" && Number.isFinite(values.width)) {
5582
5653
  light.width = Math.max(MIN_AREA_SIZE, values.width);
5583
5654
  }
@@ -5638,15 +5709,15 @@ function resolveMaterialPropertyKey(key) {
5638
5709
  __name(resolveMaterialPropertyKey, "resolveMaterialPropertyKey");
5639
5710
  function createMaterialByType(type) {
5640
5711
  if (type === "basic") {
5641
- return new THREE34__namespace.MeshBasicMaterial();
5712
+ return new THREE35__namespace.MeshBasicMaterial();
5642
5713
  }
5643
5714
  if (type === "phong") {
5644
- return new THREE34__namespace.MeshPhongMaterial();
5715
+ return new THREE35__namespace.MeshPhongMaterial();
5645
5716
  }
5646
5717
  if (type === "physical") {
5647
- return new THREE34__namespace.MeshPhysicalMaterial();
5718
+ return new THREE35__namespace.MeshPhysicalMaterial();
5648
5719
  }
5649
- return new THREE34__namespace.MeshStandardMaterial();
5720
+ return new THREE35__namespace.MeshStandardMaterial();
5650
5721
  }
5651
5722
  __name(createMaterialByType, "createMaterialByType");
5652
5723
  function replaceMaterialAcrossObject(object, previous, next) {
@@ -5705,12 +5776,12 @@ function applyTextureFiltering(material, filtering) {
5705
5776
  const target = material;
5706
5777
  for (const slot of materialTextureSlots) {
5707
5778
  const texture = target[slot];
5708
- if (!texture || !(texture instanceof THREE34__namespace.Texture)) {
5779
+ if (!texture || !(texture instanceof THREE35__namespace.Texture)) {
5709
5780
  continue;
5710
5781
  }
5711
5782
  const useMipmaps = texture.generateMipmaps !== false;
5712
- texture.magFilter = sharp ? THREE34__namespace.NearestFilter : THREE34__namespace.LinearFilter;
5713
- texture.minFilter = useMipmaps ? sharp ? THREE34__namespace.NearestMipmapNearestFilter : THREE34__namespace.LinearMipmapLinearFilter : sharp ? THREE34__namespace.NearestFilter : THREE34__namespace.LinearFilter;
5783
+ texture.magFilter = sharp ? THREE35__namespace.NearestFilter : THREE35__namespace.LinearFilter;
5784
+ texture.minFilter = useMipmaps ? sharp ? THREE35__namespace.NearestMipmapNearestFilter : THREE35__namespace.LinearMipmapLinearFilter : sharp ? THREE35__namespace.NearestFilter : THREE35__namespace.LinearFilter;
5714
5785
  texture.needsUpdate = true;
5715
5786
  }
5716
5787
  material.needsUpdate = true;
@@ -5720,12 +5791,12 @@ function setTextureMipmaps(material, enabled) {
5720
5791
  const target = material;
5721
5792
  for (const slot of materialTextureSlots) {
5722
5793
  const texture = target[slot];
5723
- if (!texture || !(texture instanceof THREE34__namespace.Texture)) {
5794
+ if (!texture || !(texture instanceof THREE35__namespace.Texture)) {
5724
5795
  continue;
5725
5796
  }
5726
5797
  texture.generateMipmaps = enabled;
5727
- const sharp = texture.magFilter === THREE34__namespace.NearestFilter;
5728
- texture.minFilter = enabled ? sharp ? THREE34__namespace.NearestMipmapNearestFilter : THREE34__namespace.LinearMipmapLinearFilter : sharp ? THREE34__namespace.NearestFilter : THREE34__namespace.LinearFilter;
5798
+ const sharp = texture.magFilter === THREE35__namespace.NearestFilter;
5799
+ texture.minFilter = enabled ? sharp ? THREE35__namespace.NearestMipmapNearestFilter : THREE35__namespace.LinearMipmapLinearFilter : sharp ? THREE35__namespace.NearestFilter : THREE35__namespace.LinearFilter;
5729
5800
  texture.needsUpdate = true;
5730
5801
  }
5731
5802
  material.needsUpdate = true;
@@ -5736,7 +5807,7 @@ function assignMaterialTexture(material, rawKey, url, textureCache) {
5736
5807
  const key = resolveMaterialPropertyKey(rawKey);
5737
5808
  let texture = textureCache.get(url);
5738
5809
  if (!texture) {
5739
- texture = new THREE34__namespace.TextureLoader().load(url);
5810
+ texture = new THREE35__namespace.TextureLoader().load(url);
5740
5811
  textureCache.set(url, texture);
5741
5812
  }
5742
5813
  target[key] = texture;
@@ -5934,12 +6005,12 @@ function resolvePrimaryMesh(object) {
5934
6005
  if (!object) {
5935
6006
  return null;
5936
6007
  }
5937
- if (object instanceof THREE34__namespace.Mesh) {
6008
+ if (object instanceof THREE35__namespace.Mesh) {
5938
6009
  return object;
5939
6010
  }
5940
6011
  let found = null;
5941
6012
  object.traverse((child) => {
5942
- if (!found && child instanceof THREE34__namespace.Mesh) {
6013
+ if (!found && child instanceof THREE35__namespace.Mesh) {
5943
6014
  found = child;
5944
6015
  }
5945
6016
  });
@@ -5960,22 +6031,22 @@ function applyGeometry(component) {
5960
6031
  switch (component.kind) {
5961
6032
  case "cube": {
5962
6033
  const params = sanitized;
5963
- nextGeometry = new THREE34__namespace.BoxGeometry(params.width, params.height, params.depth);
6034
+ nextGeometry = new THREE35__namespace.BoxGeometry(params.width, params.height, params.depth);
5964
6035
  break;
5965
6036
  }
5966
6037
  case "plane": {
5967
6038
  const params = sanitized;
5968
- nextGeometry = new THREE34__namespace.PlaneGeometry(params.width, params.height);
6039
+ nextGeometry = new THREE35__namespace.PlaneGeometry(params.width, params.height);
5969
6040
  break;
5970
6041
  }
5971
6042
  case "sphere": {
5972
6043
  const params = sanitized;
5973
- nextGeometry = new THREE34__namespace.SphereGeometry(params.radius, 24, 24);
6044
+ nextGeometry = new THREE35__namespace.SphereGeometry(params.radius, 24, 24);
5974
6045
  break;
5975
6046
  }
5976
6047
  case "cylinder": {
5977
6048
  const params = sanitized;
5978
- nextGeometry = new THREE34__namespace.CylinderGeometry(
6049
+ nextGeometry = new THREE35__namespace.CylinderGeometry(
5979
6050
  params.radius,
5980
6051
  params.radius,
5981
6052
  params.height,
@@ -5985,7 +6056,7 @@ function applyGeometry(component) {
5985
6056
  }
5986
6057
  case "capsule": {
5987
6058
  const params = sanitized;
5988
- nextGeometry = new THREE34__namespace.CapsuleGeometry(params.radius, params.height, 4, 8);
6059
+ nextGeometry = new THREE35__namespace.CapsuleGeometry(params.radius, params.height, 4, 8);
5989
6060
  break;
5990
6061
  }
5991
6062
  default:
@@ -6001,7 +6072,7 @@ function applyShadowFlags(component) {
6001
6072
  return;
6002
6073
  }
6003
6074
  component.object.traverse((child) => {
6004
- if (child instanceof THREE34__namespace.Mesh) {
6075
+ if (child instanceof THREE35__namespace.Mesh) {
6005
6076
  child.castShadow = component.castShadow;
6006
6077
  child.receiveShadow = component.receiveShadow;
6007
6078
  }
@@ -6054,13 +6125,12 @@ var _MeshGeometrySystem = class _MeshGeometrySystem {
6054
6125
  };
6055
6126
  __name(_MeshGeometrySystem, "MeshGeometrySystem");
6056
6127
  var MeshGeometrySystem = _MeshGeometrySystem;
6057
- var DRACO_DECODER_PATH = resolveDracoDecoderPath();
6058
6128
  var loadGLTF = /* @__PURE__ */ __name((path) => {
6059
6129
  return new Promise((resolve, reject) => {
6060
6130
  const loader = new GLTFLoader_js.GLTFLoader();
6061
6131
  try {
6062
6132
  const dracoLoader = new DRACOLoader_js.DRACOLoader();
6063
- dracoLoader.setDecoderPath(DRACO_DECODER_PATH);
6133
+ dracoLoader.setDecoderPath(resolveDracoDecoderPath());
6064
6134
  loader.setDRACOLoader(dracoLoader);
6065
6135
  } catch (error) {
6066
6136
  console.debug("DRACOLoader setup failed or unavailable", error);
@@ -6085,35 +6155,35 @@ function buildGeometry(component) {
6085
6155
  switch (component.meshKind) {
6086
6156
  case "cube": {
6087
6157
  const params = p;
6088
- return new THREE34__namespace.BoxGeometry(params.width, params.height, params.depth);
6158
+ return new THREE35__namespace.BoxGeometry(params.width, params.height, params.depth);
6089
6159
  }
6090
6160
  case "plane": {
6091
6161
  const params = p;
6092
- return new THREE34__namespace.PlaneGeometry(params.width, params.height);
6162
+ return new THREE35__namespace.PlaneGeometry(params.width, params.height);
6093
6163
  }
6094
6164
  case "sphere": {
6095
6165
  const params = p;
6096
- return new THREE34__namespace.SphereGeometry(params.radius, 24, 24);
6166
+ return new THREE35__namespace.SphereGeometry(params.radius, 24, 24);
6097
6167
  }
6098
6168
  case "cylinder": {
6099
6169
  const params = p;
6100
- return new THREE34__namespace.CylinderGeometry(params.radius, params.radius, params.height, 20);
6170
+ return new THREE35__namespace.CylinderGeometry(params.radius, params.radius, params.height, 20);
6101
6171
  }
6102
6172
  case "capsule": {
6103
6173
  const params = p;
6104
- return new THREE34__namespace.CapsuleGeometry(params.radius, params.height, 4, 8);
6174
+ return new THREE35__namespace.CapsuleGeometry(params.radius, params.height, 4, 8);
6105
6175
  }
6106
6176
  default:
6107
- return new THREE34__namespace.BoxGeometry(1, 1, 1);
6177
+ return new THREE35__namespace.BoxGeometry(1, 1, 1);
6108
6178
  }
6109
6179
  }
6110
6180
  __name(buildGeometry, "buildGeometry");
6111
- var _position = new THREE34__namespace.Vector3();
6112
- var _quaternion = new THREE34__namespace.Quaternion();
6113
- var _euler = new THREE34__namespace.Euler();
6114
- var _scale = new THREE34__namespace.Vector3();
6115
- var _matrix = new THREE34__namespace.Matrix4();
6116
- var _modelMatrix = new THREE34__namespace.Matrix4();
6181
+ var _position = new THREE35__namespace.Vector3();
6182
+ var _quaternion = new THREE35__namespace.Quaternion();
6183
+ var _euler = new THREE35__namespace.Euler();
6184
+ var _scale = new THREE35__namespace.Vector3();
6185
+ var _matrix = new THREE35__namespace.Matrix4();
6186
+ var _modelMatrix = new THREE35__namespace.Matrix4();
6117
6187
  function instanceTransformFromComponent(transform, out) {
6118
6188
  _position.set(transform.position.x, transform.position.y, transform.position.z);
6119
6189
  _euler.set(transform.rotation.x, transform.rotation.y, transform.rotation.z, "XYZ");
@@ -6266,7 +6336,7 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
6266
6336
  const sourceMaterial = Array.isArray(meshChild.material) ? meshChild.material.map((m) => m.clone()) : meshChild.material.clone();
6267
6337
  meshChild.updateWorldMatrix(true, false);
6268
6338
  const localMatrix = meshChild.matrixWorld.clone();
6269
- const instancedMesh2 = new THREE34__namespace.InstancedMesh(
6339
+ const instancedMesh2 = new THREE35__namespace.InstancedMesh(
6270
6340
  geometry2,
6271
6341
  Array.isArray(sourceMaterial) ? sourceMaterial : sourceMaterial,
6272
6342
  count2
@@ -6291,7 +6361,7 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
6291
6361
  this.loadingSignatures.delete(targetEntityId);
6292
6362
  return;
6293
6363
  }
6294
- const group = new THREE34__namespace.Group();
6364
+ const group = new THREE35__namespace.Group();
6295
6365
  for (const entry of entries) {
6296
6366
  group.add(entry.instancedMesh);
6297
6367
  }
@@ -6309,8 +6379,8 @@ var _InstancedMeshSystem = class _InstancedMeshSystem {
6309
6379
  }
6310
6380
  const count = instanceCount;
6311
6381
  const geometry = buildGeometry(comp);
6312
- const material = new THREE34__namespace.MeshStandardMaterial({ color: "#ffffff" });
6313
- const instancedMesh = new THREE34__namespace.InstancedMesh(geometry, material, count);
6382
+ const material = new THREE35__namespace.MeshStandardMaterial({ color: "#ffffff" });
6383
+ const instancedMesh = new THREE35__namespace.InstancedMesh(geometry, material, count);
6314
6384
  instancedMesh.castShadow = comp.castShadow;
6315
6385
  instancedMesh.receiveShadow = comp.receiveShadow;
6316
6386
  for (let i = 0; i < count; i++) {
@@ -6464,7 +6534,7 @@ var _Behaviour = class _Behaviour {
6464
6534
  if (!this.threeRef) {
6465
6535
  return null;
6466
6536
  }
6467
- const position = new THREE34__namespace.Vector3();
6537
+ const position = new THREE35__namespace.Vector3();
6468
6538
  this.threeRef.object.getWorldPosition(position);
6469
6539
  return position;
6470
6540
  }
@@ -6476,7 +6546,7 @@ var _Behaviour = class _Behaviour {
6476
6546
  if (!this.threeRef) {
6477
6547
  return null;
6478
6548
  }
6479
- const target = new THREE34__namespace.Vector3();
6549
+ const target = new THREE35__namespace.Vector3();
6480
6550
  this.threeRef.object.getWorldDirection(target);
6481
6551
  return target;
6482
6552
  }
@@ -6538,7 +6608,7 @@ var _Behaviour = class _Behaviour {
6538
6608
  if (!this.threeRef) {
6539
6609
  return;
6540
6610
  }
6541
- const rotation = new THREE34__namespace.Quaternion();
6611
+ const rotation = new THREE35__namespace.Quaternion();
6542
6612
  this.threeRef.object.getWorldQuaternion(rotation);
6543
6613
  rotation.slerp(targetRotation, alpha);
6544
6614
  this.transform.setRotation(rotation);
@@ -6555,7 +6625,7 @@ var _Behaviour = class _Behaviour {
6555
6625
  return;
6556
6626
  }
6557
6627
  const clone = this.threeRef.object.clone();
6558
- const rotation = new THREE34__namespace.Quaternion();
6628
+ const rotation = new THREE35__namespace.Quaternion();
6559
6629
  clone.lookAt(targetPosition);
6560
6630
  clone.getWorldQuaternion(rotation);
6561
6631
  this.transform.setRotation(rotation);
@@ -6856,8 +6926,8 @@ var _ScriptBehaviourSystem = class _ScriptBehaviourSystem {
6856
6926
  }, "onPointerUp");
6857
6927
  this.moduleLoader = moduleLoader ?? defaultModuleLoader;
6858
6928
  this.selectionCtx = selectionContext ?? null;
6859
- this.raycaster = new THREE34__namespace.Raycaster();
6860
- this.ndcPointer = new THREE34__namespace.Vector2();
6929
+ this.raycaster = new THREE35__namespace.Raycaster();
6930
+ this.ndcPointer = new THREE35__namespace.Vector2();
6861
6931
  if (this.selectionCtx) {
6862
6932
  this.selectionCtx.domElement.addEventListener("pointerdown", this.onPointerDown);
6863
6933
  this.selectionCtx.domElement.addEventListener("pointerup", this.onPointerUp);
@@ -7267,7 +7337,7 @@ var _AudioSystem = class _AudioSystem {
7267
7337
  if (!prev || prev.volume !== opts.volume) {
7268
7338
  sound.setVolume(opts.volume);
7269
7339
  }
7270
- if (opts.positional && sound instanceof THREE34__namespace.PositionalAudio) {
7340
+ if (opts.positional && sound instanceof THREE35__namespace.PositionalAudio) {
7271
7341
  if (!prev || prev.refDistance !== opts.refDistance) {
7272
7342
  sound.setRefDistance(opts.refDistance);
7273
7343
  }
@@ -7393,7 +7463,7 @@ var _VideoSystem = class _VideoSystem {
7393
7463
  component.object.scale.set(opts.width, opts.height, 1);
7394
7464
  }
7395
7465
  const material = component.material;
7396
- if (material instanceof THREE34__namespace.ShaderMaterial) {
7466
+ if (material instanceof THREE35__namespace.ShaderMaterial) {
7397
7467
  if (!prev || prev.backgroundColor !== opts.backgroundColor) {
7398
7468
  material.uniforms.keyColor.value.set(opts.backgroundColor);
7399
7469
  }
@@ -7407,7 +7477,7 @@ var _VideoSystem = class _VideoSystem {
7407
7477
  material.uniforms.spill.value = opts.spill;
7408
7478
  }
7409
7479
  }
7410
- if (opts.positional && component.audioNode instanceof THREE34__namespace.PositionalAudio) {
7480
+ if (opts.positional && component.audioNode instanceof THREE35__namespace.PositionalAudio) {
7411
7481
  const posAudio = component.audioNode;
7412
7482
  if (!prev || prev.refDistance !== opts.refDistance) {
7413
7483
  posAudio.setRefDistance(opts.refDistance);
@@ -8069,8 +8139,8 @@ var _World = class _World {
8069
8139
  * ```
8070
8140
  */
8071
8141
  raycast(origin, direction, near = 0, far = Infinity) {
8072
- const rayOrigin = new THREE34__namespace.Vector3(origin.x, origin.y, origin.z);
8073
- const rayDirection = new THREE34__namespace.Vector3(
8142
+ const rayOrigin = new THREE35__namespace.Vector3(origin.x, origin.y, origin.z);
8143
+ const rayDirection = new THREE35__namespace.Vector3(
8074
8144
  direction.x,
8075
8145
  direction.y,
8076
8146
  direction.z
@@ -8079,7 +8149,7 @@ var _World = class _World {
8079
8149
  return [];
8080
8150
  }
8081
8151
  rayDirection.normalize();
8082
- const raycaster = new THREE34__namespace.Raycaster(rayOrigin, rayDirection, near, far);
8152
+ const raycaster = new THREE35__namespace.Raycaster(rayOrigin, rayDirection, near, far);
8083
8153
  const intersections = raycaster.intersectObjects(
8084
8154
  this.scene.children,
8085
8155
  true
@@ -8113,14 +8183,14 @@ var _World = class _World {
8113
8183
  if (!sourceObject) {
8114
8184
  return [];
8115
8185
  }
8116
- const rayOrigin = new THREE34__namespace.Vector3();
8117
- const rayDirection = new THREE34__namespace.Vector3();
8186
+ const rayOrigin = new THREE35__namespace.Vector3();
8187
+ const rayDirection = new THREE35__namespace.Vector3();
8118
8188
  sourceObject.getWorldPosition(rayOrigin);
8119
8189
  sourceObject.getWorldDirection(rayDirection);
8120
8190
  if (rayDirection.lengthSq() === 0) {
8121
8191
  return [];
8122
8192
  }
8123
- const raycaster = new THREE34__namespace.Raycaster(rayOrigin, rayDirection, near, far);
8193
+ const raycaster = new THREE35__namespace.Raycaster(rayOrigin, rayDirection, near, far);
8124
8194
  const intersections = raycaster.intersectObjects(
8125
8195
  this.scene.children,
8126
8196
  true
@@ -9319,10 +9389,12 @@ exports.ObjectVisibilitySystem = ObjectVisibilitySystem;
9319
9389
  exports.PhysicsSyncSystem = PhysicsSyncSystem;
9320
9390
  exports.PostprocessingSyncSystem = PostprocessingSyncSystem;
9321
9391
  exports.RenderSystem = RenderSystem;
9392
+ exports.SHARED_MODEL_RESOURCE_FLAG = SHARED_MODEL_RESOURCE_FLAG;
9322
9393
  exports.ScriptBehaviourSystem = ScriptBehaviourSystem;
9323
9394
  exports.TransformSyncSystem = TransformSyncSystem;
9324
9395
  exports.VideoSystem = VideoSystem;
9325
9396
  exports.World = World;
9397
+ exports.clearModelCache = clearModelCache;
9326
9398
  exports.createAnimationComponent = createAnimationComponent;
9327
9399
  exports.createAudioComponent = createAudioComponent;
9328
9400
  exports.createCameraComponent = createCameraComponent;
@@ -9351,7 +9423,10 @@ exports.createTransformComponent = createTransformComponent;
9351
9423
  exports.createVideoComponent = createVideoComponent;
9352
9424
  exports.hydrateWorldFromSnapshot = hydrateWorldFromSnapshot;
9353
9425
  exports.hydrateWorldFromSnapshotDetailed = hydrateWorldFromSnapshotDetailed;
9426
+ exports.loadSharedGltf = loadSharedGltf;
9354
9427
  exports.registerDefaultComponentFactories = registerDefaultComponentFactories;
9355
9428
  exports.registerDefaultFactories = registerDefaultFactories;
9429
+ exports.resolveDracoDecoderPath = resolveDracoDecoderPath;
9430
+ exports.setDracoDecoderPath = setDracoDecoderPath;
9356
9431
  //# sourceMappingURL=index.cjs.map
9357
9432
  //# sourceMappingURL=index.cjs.map