@needle-tools/engine 5.1.0-next.1780579670.dramatic-pierogi.b8fa941 → 5.1.1

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 (131) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/components.needle.json +1 -1
  3. package/dist/gltf-progressive-BGQ-cjly.umd.cjs +10 -0
  4. package/dist/gltf-progressive-BvQHrERj.min.js +10 -0
  5. package/dist/{gltf-progressive-CH7aqHHr.js → gltf-progressive-CtYnVfLc.js} +420 -351
  6. package/dist/{materialx-B85WjP7E.min.js → materialx-B5gKeM65.min.js} +1 -1
  7. package/dist/{materialx-B47Bz-xs.umd.cjs → materialx-CFRcCYWy.umd.cjs} +1 -1
  8. package/dist/{materialx-jkHmVPez.js → materialx-DqGmteNO.js} +1 -1
  9. package/dist/{needle-engine.bundle-BSPk6RkD.min.js → needle-engine.bundle-BUT4ua7U.min.js} +162 -150
  10. package/dist/{needle-engine.bundle-DCPHDPAd.umd.cjs → needle-engine.bundle-Cb39lTJn.umd.cjs} +158 -146
  11. package/dist/{needle-engine.bundle-WQeWxmZD.js → needle-engine.bundle-Dv-p5m4z.js} +6956 -6782
  12. package/dist/needle-engine.d.ts +111 -43
  13. package/dist/needle-engine.js +611 -609
  14. package/dist/needle-engine.min.js +1 -1
  15. package/dist/needle-engine.umd.cjs +1 -1
  16. package/dist/three.js +3 -0
  17. package/dist/three.min.js +22 -22
  18. package/dist/three.umd.cjs +24 -24
  19. package/dist/{vendor-BQ2Vuntm.min.js → vendor-2--bD1c9.min.js} +19 -19
  20. package/dist/{vendor-BslSKZPo.js → vendor-BNtcIZkv.js} +1141 -1138
  21. package/dist/{vendor-1UvpPPSB.umd.cjs → vendor-vbe9sv1t.umd.cjs} +20 -20
  22. package/lib/engine/api.d.ts +1 -1
  23. package/lib/engine/api.js +1 -1
  24. package/lib/engine/api.js.map +1 -1
  25. package/lib/engine/engine_context.js +16 -3
  26. package/lib/engine/engine_context.js.map +1 -1
  27. package/lib/engine/engine_init.js +2 -2
  28. package/lib/engine/engine_init.js.map +1 -1
  29. package/lib/engine/engine_license.d.ts +7 -7
  30. package/lib/engine/engine_license.js +72 -72
  31. package/lib/engine/engine_license.js.map +1 -1
  32. package/lib/engine/engine_networking_blob.js +3 -3
  33. package/lib/engine/engine_networking_blob.js.map +1 -1
  34. package/lib/engine/engine_networking_peer.js +19 -13
  35. package/lib/engine/engine_networking_peer.js.map +1 -1
  36. package/lib/engine/engine_utils_qrcode.js +2 -2
  37. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  38. package/lib/engine/postprocessing/postprocessing.d.ts +2 -1
  39. package/lib/engine/postprocessing/postprocessing.js +3 -2
  40. package/lib/engine/postprocessing/postprocessing.js.map +1 -1
  41. package/lib/engine/webcomponents/WebXRButtons.js +5 -6
  42. package/lib/engine/webcomponents/WebXRButtons.js.map +1 -1
  43. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  44. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  45. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +2 -2
  46. package/lib/engine/webcomponents/needle menu/needle-menu.js +9 -9
  47. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  48. package/lib/engine/webcomponents/needle-engine.js +2 -2
  49. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  50. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  51. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  52. package/lib/engine/xr/NeedleXRSession.d.ts +30 -0
  53. package/lib/engine/xr/NeedleXRSession.js +121 -17
  54. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  55. package/lib/engine/xr/TempXRContext.js +2 -2
  56. package/lib/engine/xr/TempXRContext.js.map +1 -1
  57. package/lib/engine/xr/init.js +2 -3
  58. package/lib/engine/xr/init.js.map +1 -1
  59. package/lib/engine-components/Component.js +14 -1
  60. package/lib/engine-components/Component.js.map +1 -1
  61. package/lib/engine-components/ContactShadows.d.ts +7 -2
  62. package/lib/engine-components/ContactShadows.js +65 -45
  63. package/lib/engine-components/ContactShadows.js.map +1 -1
  64. package/lib/engine-components/GroundProjection.d.ts +6 -0
  65. package/lib/engine-components/GroundProjection.js +69 -7
  66. package/lib/engine-components/GroundProjection.js.map +1 -1
  67. package/lib/engine-components/NeedleMenu.d.ts +1 -1
  68. package/lib/engine-components/NeedleMenu.js +5 -2
  69. package/lib/engine-components/NeedleMenu.js.map +1 -1
  70. package/lib/engine-components/SceneSwitcher.d.ts +2 -0
  71. package/lib/engine-components/SceneSwitcher.js +26 -14
  72. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  73. package/lib/engine-components/SeeThrough.d.ts +39 -0
  74. package/lib/engine-components/SeeThrough.js +69 -1
  75. package/lib/engine-components/SeeThrough.js.map +1 -1
  76. package/lib/engine-components/Skybox.js +9 -0
  77. package/lib/engine-components/Skybox.js.map +1 -1
  78. package/lib/engine-components/api.d.ts +1 -0
  79. package/lib/engine-components/api.js +1 -0
  80. package/lib/engine-components/api.js.map +1 -1
  81. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  82. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +9 -5
  83. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  84. package/lib/engine-components/particlesystem/ParticleSystem.js +4 -0
  85. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  86. package/lib/engine-components/postprocessing/Volume.d.ts +1 -9
  87. package/lib/engine-components/postprocessing/Volume.js +2 -14
  88. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  89. package/lib/engine-components/webxr/WebXR.js +25 -14
  90. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  91. package/lib/engine-components/webxr/WebXRImageTracking.js +3 -0
  92. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  93. package/package.json +4 -4
  94. package/plugins/common/license.js +4 -4
  95. package/plugins/types/userconfig.d.ts +10 -0
  96. package/plugins/vite/build-pipeline.d.ts +19 -0
  97. package/plugins/vite/build-pipeline.js +67 -5
  98. package/plugins/vite/license.js +4 -4
  99. package/src/engine/api.ts +1 -1
  100. package/src/engine/engine_context.ts +15 -2
  101. package/src/engine/engine_gameobject.ts +1 -1
  102. package/src/engine/engine_init.ts +2 -2
  103. package/src/engine/engine_license.ts +69 -69
  104. package/src/engine/engine_networking_blob.ts +3 -3
  105. package/src/engine/engine_networking_peer.ts +12 -13
  106. package/src/engine/engine_utils_qrcode.ts +2 -2
  107. package/src/engine/postprocessing/postprocessing.ts +3 -2
  108. package/src/engine/webcomponents/WebXRButtons.ts +5 -6
  109. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  110. package/src/engine/webcomponents/needle menu/needle-menu.ts +10 -10
  111. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  112. package/src/engine/webcomponents/needle-engine.ts +2 -2
  113. package/src/engine/xr/NeedleXRSession.ts +124 -20
  114. package/src/engine/xr/TempXRContext.ts +2 -2
  115. package/src/engine/xr/init.ts +2 -3
  116. package/src/engine-components/Component.ts +13 -1
  117. package/src/engine-components/ContactShadows.ts +75 -49
  118. package/src/engine-components/GroundProjection.ts +71 -7
  119. package/src/engine-components/NeedleMenu.ts +6 -3
  120. package/src/engine-components/SceneSwitcher.ts +23 -13
  121. package/src/engine-components/SeeThrough.ts +75 -1
  122. package/src/engine-components/Skybox.ts +8 -0
  123. package/src/engine-components/api.ts +1 -0
  124. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  125. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +12 -5
  126. package/src/engine-components/particlesystem/ParticleSystem.ts +4 -0
  127. package/src/engine-components/postprocessing/Volume.ts +2 -13
  128. package/src/engine-components/webxr/WebXR.ts +23 -15
  129. package/src/engine-components/webxr/WebXRImageTracking.ts +1 -0
  130. package/dist/gltf-progressive-9tlS5iCx.umd.cjs +0 -10
  131. package/dist/gltf-progressive-CVg80COO.min.js +0 -10
@@ -1,66 +1,95 @@
1
- import { BufferGeometry as j, Mesh as K, Box3 as ce, Vector3 as k, Sphere as Pe, CompressedTexture as Ee, Texture as G, Matrix3 as Ne, InterleavedBuffer as Ve, InterleavedBufferAttribute as Xe, BufferAttribute as je, TextureLoader as Ke, Matrix4 as ke, Clock as He, Color as Re } from "./three.js";
2
- import { DRACOLoader as Ye, KTX2Loader as Qe, MeshoptDecoder as Je, GLTFLoader as ve } from "./three-examples.js";
3
- const Ze = "";
4
- globalThis.GLTF_PROGRESSIVE_VERSION = Ze;
1
+ import { RedFormat as je, RedIntegerFormat as He, RGFormat as Ke, RGIntegerFormat as Ye, RGBFormat as Qe, RGBAFormat as Je, RGBAIntegerFormat as Ze, BufferGeometry as j, Mesh as H, Box3 as ce, Vector3 as k, Sphere as Ie, CompressedTexture as et, Texture as G, Matrix3 as tt, InterleavedBuffer as st, InterleavedBufferAttribute as rt, BufferAttribute as nt, TextureLoader as it, Matrix4 as $e, THREE as ot, Color as Be } from "./three.js";
2
+ import { DRACOLoader as at, KTX2Loader as lt, MeshoptDecoder as ut, GLTFLoader as Me } from "./three-examples.js";
3
+ const ct = "";
4
+ globalThis.GLTF_PROGRESSIVE_VERSION = ct;
5
5
  console.debug("[gltf-progressive] version -");
6
- let I = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", H = "https://cdn.needle.tools/static/three/0.179.1/basis2/";
7
- const et = I, tt = H, Ae = new URL(I + "draco_decoder.js");
8
- Ae.searchParams.append("range", "true");
9
- fetch(Ae, {
6
+ let I = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", K = "https://cdn.needle.tools/static/three/0.179.1/basis2/";
7
+ const ft = I, dt = K, Ge = new URL(I + "draco_decoder.js");
8
+ Ge.searchParams.append("range", "true");
9
+ fetch(Ge, {
10
10
  method: "GET",
11
11
  headers: {
12
12
  Range: "bytes=0-1"
13
13
  }
14
14
  }).catch((i) => {
15
- console.debug(`Failed to fetch remote Draco decoder from ${I} (offline: ${typeof navigator < "u" ? navigator.onLine : "unknown"})`), I === et && rt("./include/draco/"), H === tt && nt("./include/ktx2/");
15
+ console.debug(`Failed to fetch remote Draco decoder from ${I} (offline: ${typeof navigator < "u" ? navigator.onLine : "unknown"})`), I === ft && gt("./include/draco/"), K === dt && pt("./include/ktx2/");
16
16
  }).finally(() => {
17
- $e();
17
+ We();
18
18
  });
19
- const st = () => ({
19
+ const ht = () => ({
20
20
  dracoDecoderPath: I,
21
- ktx2TranscoderPath: H
21
+ ktx2TranscoderPath: K
22
22
  });
23
- function rt(i) {
23
+ function gt(i) {
24
24
  I = i, P && P[xe] != I ? (console.debug("Updating Draco decoder path to " + i), P[xe] = I, P.setDecoderPath(I), P.preload()) : console.debug("Setting Draco decoder path to " + i);
25
25
  }
26
- function nt(i) {
27
- H = i, $ && $.transcoderPath != H ? (console.debug("Updating KTX2 transcoder path to " + i), $.setTranscoderPath(H), $.init()) : console.debug("Setting KTX2 transcoder path to " + i);
26
+ function pt(i) {
27
+ K = i, $ && $.transcoderPath != K ? (console.debug("Updating KTX2 transcoder path to " + i), $.setTranscoderPath(K), $.init()) : console.debug("Setting KTX2 transcoder path to " + i);
28
28
  }
29
- function De(i) {
30
- return $e(), i ? $.detectSupport(i) : i !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: P, ktx2Loader: $, meshoptDecoder: le };
29
+ function _e(i) {
30
+ return We(), i ? $.detectSupport(i) : i !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: P, ktx2Loader: $, meshoptDecoder: le };
31
31
  }
32
- function Ie(i) {
32
+ function qe(i) {
33
33
  i.dracoLoader || i.setDRACOLoader(P), i.ktx2Loader || i.setKTX2Loader($), i.meshoptDecoder || i.setMeshoptDecoder(le);
34
34
  }
35
35
  const xe = /* @__PURE__ */ Symbol("dracoDecoderPath");
36
36
  let P, le, $;
37
- function $e() {
38
- P || (P = new Ye(), P[xe] = I, P.setDecoderPath(I), P.setDecoderConfig({ type: "js" }), P.preload()), $ || ($ = new Qe(), $.setTranscoderPath(H), $.init()), le || (le = Je);
37
+ function We() {
38
+ P || (P = new at(), P[xe] = I, P.setDecoderPath(I), P.setDecoderConfig({ type: "js" }), P.preload()), $ || ($ = new lt(), $.setTranscoderPath(K), $.init()), le || (le = ut);
39
39
  }
40
- const we = /* @__PURE__ */ new WeakMap();
41
- function Be(i, t) {
42
- let e = we.get(i);
43
- e ? e = Object.assign(e, t) : e = t, we.set(i, e);
40
+ const Le = /* @__PURE__ */ new WeakMap();
41
+ function Fe(i, t) {
42
+ let e = Le.get(i);
43
+ e ? e = Object.assign(e, t) : e = t, Le.set(i, e);
44
44
  }
45
- const it = ve.prototype.load;
46
- function ot(...i) {
47
- const t = we.get(this);
45
+ const mt = Me.prototype.load;
46
+ function yt(...i) {
47
+ const t = Le.get(this);
48
48
  let e = i[0];
49
- const s = new URL(e, window.location.href);
50
- if (s.hostname.endsWith("needle.tools")) {
49
+ const s = xt(e);
50
+ if (s?.hostname.endsWith("needle.tools")) {
51
51
  const n = t?.progressive !== void 0 ? t.progressive : !0, o = t?.usecase ? t.usecase : "default";
52
52
  n ? this.requestHeader.Accept = `*/*;progressive=allowed;usecase=${o}` : this.requestHeader.Accept = `*/*;usecase=${o}`, e = s.toString();
53
53
  }
54
- return i[0] = e, it?.call(this, ...i);
54
+ return i[0] = e, mt?.call(this, ...i);
55
+ }
56
+ Me.prototype.load = yt;
57
+ function xt(i) {
58
+ try {
59
+ if (i instanceof URL)
60
+ return i;
61
+ const t = globalThis.location?.href;
62
+ return t ? new URL(i, t) : new URL(i);
63
+ } catch {
64
+ return null;
65
+ }
66
+ }
67
+ function Te(i) {
68
+ return i != null && i.data != null;
55
69
  }
56
- ve.prototype.load = ot;
57
- E("debugprogressive");
58
- function E(i) {
59
- if (typeof window > "u") return !1;
60
- const e = new URL(window.location.href).searchParams.get(i);
61
- return e == null || e === "0" || e === "false" ? !1 : e === "" ? !0 : e;
70
+ function we(i) {
71
+ const t = i.source?.data;
72
+ return t != null && typeof t == "object" ? t : null;
62
73
  }
63
- function at(i, t) {
74
+ function Lt(i) {
75
+ const t = i.image;
76
+ return t != null && typeof t == "object" ? t : null;
77
+ }
78
+ function De(i) {
79
+ const t = Lt(i), e = we(i);
80
+ return {
81
+ width: t?.width || e?.width || 0,
82
+ height: t?.height || e?.height || 0
83
+ };
84
+ }
85
+ N("debugprogressive");
86
+ function N(i) {
87
+ const t = globalThis.location?.href;
88
+ if (!t) return !1;
89
+ const s = new URL(t).searchParams.get(i);
90
+ return s == null || s === "0" || s === "false" ? !1 : s === "" ? !0 : s;
91
+ }
92
+ function wt(i, t) {
64
93
  if (t === void 0 || i === void 0 || t.startsWith("./") || t.startsWith("http") || t.startsWith("data:") || t.startsWith("blob:"))
65
94
  return t;
66
95
  const e = i.lastIndexOf("/");
@@ -71,18 +100,21 @@ function at(i, t) {
71
100
  }
72
101
  return t;
73
102
  }
74
- function Me() {
75
- return Z !== void 0 || (Z = /iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent), E("debugprogressive") && console.log("[glTF Progressive]: isMobileDevice", Z)), Z;
103
+ function be() {
104
+ if (Z !== void 0) return Z;
105
+ const i = globalThis.navigator?.userAgent || "";
106
+ return Z = /iPhone|iPad|iPod|Android|IEMobile/i.test(i), N("debugprogressive") && console.log("[glTF Progressive]: isMobileDevice", Z), Z;
76
107
  }
77
108
  let Z;
78
- function Ge() {
79
- if (typeof window > "u") return !1;
80
- const i = new URL(window.location.href), t = i.hostname === "localhost" || /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(i.hostname);
81
- return i.hostname === "127.0.0.1" || t;
109
+ function Ue() {
110
+ const i = globalThis.location?.href;
111
+ if (!i) return !1;
112
+ const t = new URL(i), e = t.hostname === "localhost" || /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t.hostname);
113
+ return t.hostname === "127.0.0.1" || e;
82
114
  }
83
- class lt {
115
+ class Dt {
84
116
  constructor(t, e = {}) {
85
- this.maxConcurrent = t, this.debug = e.debug ?? !1, typeof window < "u" && window.requestAnimationFrame(this.tick);
117
+ this.maxConcurrent = t, this.debug = e.debug ?? !1, typeof globalThis.requestAnimationFrame == "function" ? globalThis.requestAnimationFrame(this.tick) : setTimeout(this.tick, 0);
86
118
  }
87
119
  _running = /* @__PURE__ */ new Map();
88
120
  _queue = [];
@@ -114,52 +146,52 @@ class lt {
114
146
  }
115
147
  }
116
148
  }
117
- function ut(i) {
118
- const t = i.image?.width ?? 0, e = i.image?.height ?? 0, s = i.image?.depth ?? 1, r = Math.floor(Math.log2(Math.max(t, e, s))) + 1, n = ct(i);
119
- return t * e * s * n * (1 - Math.pow(0.25, r)) / (1 - 0.25);
149
+ function vt(i) {
150
+ const t = i.image, e = t?.width ?? 0, s = t?.height ?? 0, r = t?.depth ?? 1, n = Math.floor(Math.log2(Math.max(e, s, r))) + 1, o = Mt(i);
151
+ return e * s * r * o * (1 - Math.pow(0.25, n)) / (1 - 0.25);
120
152
  }
121
- function ct(i) {
153
+ function Mt(i) {
122
154
  let t = 4;
123
155
  const e = i.format;
124
- e === 1024 || e === 1025 ? t = 1 : e === 1026 || e === 1027 ? t = 2 : e === 1022 || e === 1029 ? t = 3 : (e === 1023 || e === 1033) && (t = 4);
156
+ e === je || e === He ? t = 1 : e === Ke || e === Ye ? t = 2 : e === Qe || e === 1029 ? t = 3 : (e === Je || e === Ze) && (t = 4);
125
157
  let s = 1;
126
158
  const r = i.type;
127
159
  return r === 1009 || r === 1010 ? s = 1 : r === 1011 || r === 1012 ? s = 2 : r === 1013 || r === 1014 || r === 1015 ? s = 4 : r === 1016 && (s = 2), t * s;
128
160
  }
129
- const dt = typeof window > "u" && typeof document > "u", Le = /* @__PURE__ */ Symbol("needle:raycast-mesh");
161
+ const _t = typeof window > "u" && typeof document > "u", ve = /* @__PURE__ */ Symbol("needle:raycast-mesh");
130
162
  function ne(i) {
131
- return i?.[Le] instanceof j ? i[Le] : null;
163
+ return i?.[ve] instanceof j ? i[ve] : null;
132
164
  }
133
- function ft(i, t) {
165
+ function bt(i, t) {
134
166
  if ((i.type === "Mesh" || i.type === "SkinnedMesh") && !ne(i)) {
135
- const s = gt(t);
136
- s.userData = { isRaycastMesh: !0 }, i[Le] = s;
167
+ const s = Tt(t);
168
+ s.userData = { isRaycastMesh: !0 }, i[ve] = s;
137
169
  }
138
170
  }
139
- function ht(i = !0) {
171
+ function Ot(i = !0) {
140
172
  if (i) {
141
173
  if (ee) return;
142
- const t = ee = K.prototype.raycast;
143
- K.prototype.raycast = function(e, s) {
174
+ const t = ee = H.prototype.raycast;
175
+ H.prototype.raycast = function(e, s) {
144
176
  const r = this, n = ne(r);
145
177
  let o;
146
178
  n && r.isMesh && (o = r.geometry, r.geometry = n), t.call(this, e, s), o && (r.geometry = o);
147
179
  };
148
180
  } else {
149
181
  if (!ee) return;
150
- K.prototype.raycast = ee, ee = null;
182
+ H.prototype.raycast = ee, ee = null;
151
183
  }
152
184
  }
153
185
  let ee = null;
154
- function gt(i) {
186
+ function Tt(i) {
155
187
  const t = new j();
156
188
  for (const e in i.attributes)
157
189
  t.setAttribute(e, i.getAttribute(e));
158
190
  return t.setIndex(i.getIndex()), t;
159
191
  }
160
- const W = new Array(), h = E("debugprogressive");
192
+ const W = new Array(), h = N("debugprogressive");
161
193
  let re, V = -1;
162
- if (h) {
194
+ if (h && typeof window < "u") {
163
195
  let i = function() {
164
196
  V += 1, V >= t && (V = -1), console.log(`Toggle LOD level [${V}]`);
165
197
  };
@@ -170,27 +202,27 @@ if (h) {
170
202
  !isNaN(s) && s >= 0 && (V = s, console.log(`Set LOD level to [${V}]`));
171
203
  });
172
204
  }
173
- function qe(i) {
205
+ function ze(i) {
174
206
  if (h && re !== void 0)
175
207
  if (Array.isArray(i))
176
208
  for (const t of i)
177
- qe(t);
209
+ ze(t);
178
210
  else i && "wireframe" in i && (i.wireframe = re === !0);
179
211
  }
180
212
  const te = new Array();
181
- let pt = 0;
182
- const mt = Me() ? 2 : 10;
183
- function yt(i) {
184
- if (te.length < mt) {
213
+ let St = 0;
214
+ const Rt = be() ? 2 : 10;
215
+ function Pt(i) {
216
+ if (te.length < Rt) {
185
217
  const s = te.length;
186
218
  h && console.warn(`[Worker] Creating new worker #${s}`);
187
- const r = _e.createWorker(i || {});
219
+ const r = Oe.createWorker(i || {});
188
220
  return te.push(r), r;
189
221
  }
190
- const t = pt++ % te.length;
222
+ const t = St++ % te.length;
191
223
  return te[t];
192
224
  }
193
- class _e {
225
+ class Oe {
194
226
  constructor(t, e) {
195
227
  this.worker = t, this._debug = e.debug ?? !1, t.onmessage = (s) => {
196
228
  const r = s.data;
@@ -198,7 +230,7 @@ class _e {
198
230
  case "loaded-gltf":
199
231
  for (const n of this._running)
200
232
  if (n.url === r.result.url) {
201
- xt(r.result), n.resolve(r.result);
233
+ Ct(r.result), n.resolve(r.result);
202
234
  const o = n.url;
203
235
  o.startsWith("blob:") && URL.revokeObjectURL(o);
204
236
  }
@@ -213,19 +245,26 @@ class _e {
213
245
  const e = /* new-worker */ new Worker(URL.createObjectURL(new Blob(["import '" + `${new URL('./gltf-progressive.worker-BqODMeeW.js', import.meta.url).toString()}` + "';"], { type: 'text/javascript' })), {
214
246
  type: "module"
215
247
  });
216
- return new _e(e, t);
248
+ return new Oe(e, t);
217
249
  }
218
250
  _running = [];
219
251
  _webglRenderer = null;
220
252
  async load(t, e) {
221
- const s = st();
253
+ const s = ht();
222
254
  let r = e?.renderer;
223
255
  r || (this._webglRenderer ??= (async () => {
224
256
  const { WebGLRenderer: u } = await import("./three.js").then((c) => c.THREE);
225
257
  return new u();
226
258
  })(), r = await this._webglRenderer);
227
- const a = De(r).ktx2Loader.workerConfig;
228
- t instanceof URL ? t = t.toString() : t.startsWith("file:") ? t = URL.createObjectURL(new Blob([t])) : !t.startsWith("blob:") && !t.startsWith("http:") && !t.startsWith("https:") && (t = new URL(t, window.location.href).toString());
259
+ const a = _e(r).ktx2Loader.workerConfig;
260
+ if (t instanceof URL)
261
+ t = t.toString();
262
+ else if (t.startsWith("file:"))
263
+ t = URL.createObjectURL(new Blob([t]));
264
+ else if (!t.startsWith("blob:") && !t.startsWith("http:") && !t.startsWith("https:")) {
265
+ const u = globalThis.location?.href;
266
+ u && (t = new URL(t, u).toString());
267
+ }
229
268
  const l = {
230
269
  type: "load",
231
270
  url: t,
@@ -242,20 +281,20 @@ class _e {
242
281
  }
243
282
  _debug = !1;
244
283
  }
245
- function xt(i) {
284
+ function Ct(i) {
246
285
  for (const t of i.geometries) {
247
286
  const e = t.geometry, s = new j();
248
287
  if (s.name = e.name || "", e.index) {
249
288
  const r = e.index;
250
- s.setIndex(fe(r));
289
+ s.setIndex(de(r));
251
290
  }
252
291
  for (const r in e.attributes) {
253
- const n = e.attributes[r], o = fe(n);
292
+ const n = e.attributes[r], o = de(n);
254
293
  s.setAttribute(r, o);
255
294
  }
256
295
  if (e.morphAttributes)
257
296
  for (const r in e.morphAttributes) {
258
- const o = e.morphAttributes[r].map((a) => fe(a));
297
+ const o = e.morphAttributes[r].map((a) => de(a));
259
298
  s.morphAttributes[r] = o;
260
299
  }
261
300
  if (s.morphTargetsRelative = e.morphTargetsRelative ?? !1, s.boundingBox = new ce(), s.boundingBox.min = new k(
@@ -266,7 +305,7 @@ function xt(i) {
266
305
  e.boundingBox?.max.x,
267
306
  e.boundingBox?.max.y,
268
307
  e.boundingBox?.max.z
269
- ), s.boundingSphere = new Pe(
308
+ ), s.boundingSphere = new Ie(
270
309
  new k(
271
310
  e.boundingSphere?.center.x,
272
311
  e.boundingSphere?.center.y,
@@ -282,8 +321,8 @@ function xt(i) {
282
321
  const e = t.texture;
283
322
  let s = null;
284
323
  if (e.isCompressedTexture) {
285
- const r = e.mipmaps, n = e.image?.width || e.source?.data?.width || -1, o = e.image?.height || e.source?.data?.height || -1;
286
- s = new Ee(
324
+ const r = e.mipmaps, { width: n, height: o } = De(e);
325
+ s = new et(
287
326
  r,
288
327
  n,
289
328
  o,
@@ -309,7 +348,7 @@ function xt(i) {
309
348
  e.type,
310
349
  e.anisotropy,
311
350
  e.colorSpace
312
- ), s.mipmaps = e.mipmaps, s.channel = e.channel, s.source.data = e.source.data, s.flipY = e.flipY, s.premultiplyAlpha = e.premultiplyAlpha, s.unpackAlignment = e.unpackAlignment, s.matrix = new Ne(...e.matrix.elements);
351
+ ), s.mipmaps = e.mipmaps, s.channel = e.channel, s.source.data = e.source.data, s.flipY = e.flipY, s.premultiplyAlpha = e.premultiplyAlpha, s.unpackAlignment = e.unpackAlignment, s.matrix = new tt(...e.matrix.elements);
313
352
  if (!s) {
314
353
  console.error("[Worker] Failed to create new texture from received data. Texture is not a CompressedTexture or Texture.");
315
354
  continue;
@@ -318,21 +357,21 @@ function xt(i) {
318
357
  }
319
358
  return i;
320
359
  }
321
- function fe(i) {
360
+ function de(i) {
322
361
  let t = i;
323
362
  if ("isInterleavedBufferAttribute" in i && i.isInterleavedBufferAttribute) {
324
- const e = i.data, s = e.array, r = new Ve(s, e.stride);
325
- t = new Xe(r, i.itemSize, s.byteOffset, i.normalized), t.offset = i.offset;
326
- } else "isBufferAttribute" in i && i.isBufferAttribute && (t = new je(i.array, i.itemSize, i.normalized), t.usage = i.usage, t.gpuType = i.gpuType, t.updateRanges = i.updateRanges);
363
+ const e = i.data, s = e.array, r = new st(s, e.stride);
364
+ t = new rt(r, i.itemSize, s.byteOffset, i.normalized), t.offset = i.offset;
365
+ } else "isBufferAttribute" in i && i.isBufferAttribute && (t = new nt(i.array, i.itemSize, i.normalized), t.usage = i.usage, t.gpuType = i.gpuType, t.updateRanges = i.updateRanges);
327
366
  return t;
328
367
  }
329
- const wt = E("gltf-progressive-worker");
330
- E("gltf-progressive-reduce-mipmaps");
331
- const se = E("gltf-progressive-gc"), he = /* @__PURE__ */ Symbol("needle-progressive-texture"), U = "NEEDLE_progressive";
332
- class p {
368
+ const kt = N("gltf-progressive-worker");
369
+ N("gltf-progressive-reduce-mipmaps");
370
+ const se = N("gltf-progressive-gc"), he = /* @__PURE__ */ Symbol("needle-progressive-texture"), F = "NEEDLE_progressive";
371
+ class g {
333
372
  /** The name of the extension */
334
373
  get name() {
335
- return U;
374
+ return F;
336
375
  }
337
376
  // #region PUBLIC API
338
377
  /**
@@ -398,9 +437,9 @@ class p {
398
437
  const c = s.lodInfos.get(u.key);
399
438
  if (c && c.lods) {
400
439
  l.min_count = Math.min(l.min_count, c.lods.length), l.max_count = Math.max(l.max_count, c.lods.length);
401
- for (let d = 0; d < c.lods.length; d++) {
402
- const f = c.lods[d];
403
- f.width && (l.lods[d] = l.lods[d] || { min_height: 1 / 0, max_height: 0 }, l.lods[d].min_height = Math.min(l.lods[d].min_height, f.height), l.lods[d].max_height = Math.max(l.lods[d].max_height, f.height));
440
+ for (let f = 0; f < c.lods.length; f++) {
441
+ const d = c.lods[f];
442
+ d.width && (l.lods[f] = l.lods[f] || { min_height: 1 / 0, max_height: 0 }, l.lods[f].min_height = Math.min(l.lods[f].min_height, d.height), l.lods[f].max_height = Math.max(l.lods[f].max_height, d.height));
404
443
  }
405
444
  }
406
445
  }
@@ -454,7 +493,7 @@ class p {
454
493
  */
455
494
  static assignMeshLOD(t, e, s) {
456
495
  if (!t) return Promise.resolve(null);
457
- if (t instanceof K || t.isMesh === !0) {
496
+ if (t instanceof H || t.isMesh === !0) {
458
497
  const r = t.geometry, n = this.getAssignedLODInformation(r);
459
498
  if (!n)
460
499
  return Promise.resolve(null);
@@ -462,7 +501,7 @@ class p {
462
501
  a.onBeforeGetLODMesh?.(t, e);
463
502
  t["LOD:requested level"] = e;
464
503
  const o = () => t["LOD:requested level"] === e || this.shouldApplyStaleMeshLOD(t, e);
465
- return p.getOrLoadLOD(r, e, {
504
+ return g.getOrLoadLOD(r, e, {
466
505
  isCurrent: o
467
506
  }).then((a) => {
468
507
  if (Array.isArray(a)) {
@@ -502,8 +541,8 @@ class p {
502
541
  for (const u of Object.keys(l.uniforms)) {
503
542
  const c = l.uniforms[u].value;
504
543
  if (c?.isTexture === !0) {
505
- const d = this.assignTextureLODForSlot(c, e, n, u, r).then((f) => (f && l.uniforms[u].value != f && (l.uniforms[u].value = f, l.uniformsNeedUpdate = !0), f));
506
- o.push(d), a.push(u);
544
+ const f = this.assignTextureLODForSlot(c, e, n, u, r).then((d) => (d && l.uniforms[u].value != d && (l.uniforms[u].value = d, l.uniformsNeedUpdate = !0), d));
545
+ o.push(f), a.push(u);
507
546
  }
508
547
  }
509
548
  } else
@@ -517,8 +556,8 @@ class p {
517
556
  return Promise.all(o).then((l) => {
518
557
  const u = new Array();
519
558
  for (let c = 0; c < l.length; c++) {
520
- const d = l[c], f = a[c];
521
- d && d.isTexture === !0 ? u.push({ material: n, slot: f, texture: d, level: e }) : u.push({ material: n, slot: f, texture: null, level: e });
559
+ const f = l[c], d = a[c];
560
+ f && f.isTexture === !0 ? u.push({ material: n, slot: d, texture: f, level: e }) : u.push({ material: n, slot: d, texture: null, level: e });
522
561
  }
523
562
  return u;
524
563
  });
@@ -534,10 +573,10 @@ class p {
534
573
  * @default 50 on desktop, 20 on mobile devices
535
574
  */
536
575
  static set maxConcurrentLoadingTasks(t) {
537
- p.queue.maxConcurrent = t;
576
+ g.queue.maxConcurrent = t;
538
577
  }
539
578
  static get maxConcurrentLoadingTasks() {
540
- return p.queue.maxConcurrent;
579
+ return g.queue.maxConcurrent;
541
580
  }
542
581
  // #region INTERNAL
543
582
  static assignTextureLODForSlot(t, e, s, r, n) {
@@ -549,30 +588,30 @@ class p {
549
588
  if (o && (o.level === e || !n && o.level < e))
550
589
  return Promise.resolve(t);
551
590
  if (s && r) {
552
- const d = this.getPendingTextureSlotRequest(s, r);
553
- if (d && d.level === e && d.force === n)
554
- return d.promise;
591
+ const f = this.getPendingTextureSlotRequest(s, r);
592
+ if (f && f.level === e && f.force === n)
593
+ return f.promise;
555
594
  }
556
- const a = s && r ? this.nextTextureSlotRequestId(s, r, e, n) : 0, l = () => !s || !r || this.getLatestTextureSlotRequest(s, r)?.id === a, u = () => l() || this.shouldApplyStaleTextureSlotLOD(s, r, e, n), c = p.getOrLoadLOD(t, e, {
595
+ const a = s && r ? this.nextTextureSlotRequestId(s, r, e, n) : 0, l = () => !s || !r || this.getLatestTextureSlotRequest(s, r)?.id === a, u = () => l() || this.shouldApplyStaleTextureSlotLOD(s, r, e, n), c = g.getOrLoadLOD(t, e, {
557
596
  isCurrent: u
558
- }).then((d) => {
597
+ }).then((f) => {
559
598
  if (!l() && !this.shouldApplyStaleTextureSlotLOD(s, r, e, n)) return null;
560
- if (Array.isArray(d))
599
+ if (Array.isArray(f))
561
600
  return console.warn("Progressive: Got an array of textures for a texture slot, this should not happen..."), null;
562
- if (d?.isTexture === !0) {
563
- if (d != t && s && r) {
564
- const f = this.getMaterialTextureSlot(s, r) ?? t;
565
- if (f && !n) {
566
- const g = this.getAssignedLODInformation(f);
567
- if (g && g?.level < e)
568
- return h === "verbose" && console.warn("Assigned texture level is already higher: ", g.level, e, s, f, d), null;
601
+ if (f?.isTexture === !0) {
602
+ if (f != t && s && r) {
603
+ const d = this.getMaterialTextureSlot(s, r) ?? t;
604
+ if (d && !n) {
605
+ const p = this.getAssignedLODInformation(d);
606
+ if (p && p?.level < e)
607
+ return h === "verbose" && console.warn("Assigned texture level is already higher: ", p.level, e, s, d, f), null;
569
608
  }
570
- this.assignTrackedTextureSlot(s, r, d);
609
+ this.assignTrackedTextureSlot(s, r, f);
571
610
  }
572
- return d;
611
+ return f;
573
612
  } else h == "verbose" && console.warn("No LOD found for", t, e);
574
613
  return null;
575
- }).catch((d) => (console.error("Error loading LOD", t, d), null));
614
+ }).catch((f) => (console.error("Error loading LOD", t, f), null));
576
615
  return s && r && this.setPendingTextureSlotRequest(s, r, e, n, a, c), c;
577
616
  }
578
617
  // Track material slots, not just texture objects. A shared fallback texture can be
@@ -670,8 +709,8 @@ class p {
670
709
  _isLoadingMesh;
671
710
  loadMesh = (t) => {
672
711
  if (this._isLoadingMesh) return null;
673
- const e = this.parser.json.meshes[t]?.extensions?.[U];
674
- return e ? (this._isLoadingMesh = !0, this.parser.getDependency("mesh", t).then((s) => (this._isLoadingMesh = !1, s && p.registerMesh(this.url, e.guid, s, e.lods?.length, 0, e), s))) : null;
712
+ const e = this.parser.json.meshes[t]?.extensions?.[F];
713
+ return e ? (this._isLoadingMesh = !0, this.parser.getDependency("mesh", t).then((s) => (this._isLoadingMesh = !1, s && g.registerMesh(this.url, e.guid, s, e.lods?.length, 0, e), s))) : null;
675
714
  };
676
715
  // private _isLoadingTexture;
677
716
  // loadTexture = (textureIndex: number) => {
@@ -690,7 +729,7 @@ class p {
690
729
  afterRoot(t) {
691
730
  return h && console.log("AFTER", this.url, t), this.parser.json.textures?.forEach((e, s) => {
692
731
  if (e?.extensions) {
693
- const r = e?.extensions[U];
732
+ const r = e?.extensions[F];
694
733
  if (r) {
695
734
  if (!r.lods) {
696
735
  h && console.warn("Texture has no LODs", r);
@@ -698,20 +737,20 @@ class p {
698
737
  }
699
738
  let n = !1;
700
739
  for (const o of this.parser.associations.keys())
701
- o.isTexture === !0 && this.parser.associations.get(o)?.textures === s && (n = !0, p.registerTexture(this.url, o, r.lods?.length, s, r));
740
+ o.isTexture === !0 && this.parser.associations.get(o)?.textures === s && (n = !0, g.registerTexture(this.url, o, r.lods?.length, s, r));
702
741
  n || this.parser.getDependency("texture", s).then((o) => {
703
- o && p.registerTexture(this.url, o, r.lods?.length, s, r);
742
+ o && g.registerTexture(this.url, o, r.lods?.length, s, r);
704
743
  });
705
744
  }
706
745
  }
707
746
  }), this.parser.json.meshes?.forEach((e, s) => {
708
747
  if (e?.extensions) {
709
- const r = e?.extensions[U];
748
+ const r = e?.extensions[F];
710
749
  if (r && r.lods) {
711
750
  for (const n of this.parser.associations.keys())
712
751
  if (n.isMesh) {
713
752
  const o = this.parser.associations.get(n);
714
- o?.meshes === s && p.registerMesh(this.url, r.guid, n, r.lods.length, o.primitives, r);
753
+ o?.meshes === s && g.registerMesh(this.url, r.guid, n, r.lods.length, o.primitives, r);
715
754
  }
716
755
  }
717
756
  }
@@ -734,12 +773,12 @@ class p {
734
773
  return;
735
774
  }
736
775
  if (h) {
737
- const a = e.image?.width || e.source?.data?.width || 0, l = e.image?.height || e.source?.data?.height || 0;
776
+ const { width: a, height: l } = De(e);
738
777
  console.log(`> gltf-progressive: register texture[${r}] "${e.name || e.uuid}", Current: ${a}x${l}, Max: ${n.lods[0]?.width}x${n.lods[0]?.height}, uuid: ${e.uuid}`, n, e);
739
778
  }
740
779
  e.source && (e.source[he] = n);
741
780
  const o = n.guid;
742
- p.assignLODInformation(t, e, o, s, r), p.lodInfos.set(o, n), p.lowresCache.set(o, new WeakRef(e));
781
+ g.assignLODInformation(t, e, o, s, r), g.lodInfos.set(o, n), g.lowresCache.set(o, new WeakRef(e));
743
782
  };
744
783
  /**
745
784
  * Register a mesh with progressive LOD information. This associates the mesh geometry with its LOD extension data
@@ -760,9 +799,9 @@ class p {
760
799
  h && console.warn("gltf-progressive: Register mesh without geometry");
761
800
  return;
762
801
  }
763
- a.userData || (a.userData = {}), h && console.log("> Progressive: register mesh " + s.name, { index: n, uuid: s.uuid }, o, s), p.assignLODInformation(t, a, e, r, n), p.lodInfos.set(e, o);
764
- let u = p.lowresCache.get(e)?.deref();
765
- u ? u.push(s.geometry) : u = [s.geometry], p.lowresCache.set(e, new WeakRef(u)), r > 0 && !ne(s) && ft(s, a);
802
+ a.userData || (a.userData = {}), h && console.log("> Progressive: register mesh " + s.name, { index: n, uuid: s.uuid }, o, s), g.assignLODInformation(t, a, e, r, n), g.lodInfos.set(e, o);
803
+ let u = g.lowresCache.get(e)?.deref();
804
+ u ? u.push(s.geometry) : u = [s.geometry], g.lowresCache.set(e, new WeakRef(u)), r > 0 && !ne(s) && bt(s, a);
766
805
  for (const c of W)
767
806
  c.onRegisteredNewMesh?.(s, o);
768
807
  };
@@ -837,9 +876,9 @@ class p {
837
876
  * The held value is the cache key string used in `previouslyLoaded`.
838
877
  */
839
878
  static _resourceRegistry = new FinalizationRegistry((t) => {
840
- const e = p.cache.get(t);
879
+ const e = g.cache.get(t);
841
880
  (h || se) && console.debug(`[gltf-progressive] Memory: Resource GC'd
842
- ${t}`), e instanceof WeakRef && (e.deref() || (p.cache.delete(t), (h || se) && console.log("[gltf-progressive] ↪ Cache entry deleted (GC)")));
881
+ ${t}`), e instanceof WeakRef && (e.deref() || (g.cache.delete(t), (h || se) && console.log("[gltf-progressive] ↪ Cache entry deleted (GC)")));
843
882
  });
844
883
  /**
845
884
  * Track texture usage by incrementing reference count
@@ -862,9 +901,10 @@ ${t}`), e instanceof WeakRef && (e.deref() || (p.cache.delete(t), (h || se) && c
862
901
  return this.textureRefCounts.delete(e), (h || se) && n("[gltf-progressive] Memory: Dispose texture", r), t.dispose(), !0;
863
902
  return this.textureRefCounts.set(e, r), h === "verbose" && n("[gltf-progressive] Memory: Untrack texture", r), !1;
864
903
  function n(o, a) {
865
- const l = t.image?.width || t.source?.data?.width || 0, u = t.image?.height || t.source?.data?.height || 0, c = l && u ? `${l}x${u}` : "N/A";
866
- let d = "N/A";
867
- l && u && (d = `~${(ut(t) / (1024 * 1024)).toFixed(2)} MB`), console.log(`${o} — ${t.name} ${c} (${d}), refCount: ${s} → ${a}
904
+ let { width: l, height: u } = De(t);
905
+ const c = l && u ? `${l}x${u}` : "N/A";
906
+ let f = "N/A";
907
+ l && u && (f = `~${(vt(t) / (1024 * 1024)).toFixed(2)} MB`), console.log(`${o} — ${t.name} ${c} (${f}), refCount: ${s} → ${a}
868
908
  ${e}`);
869
909
  }
870
910
  }
@@ -880,17 +920,17 @@ ${e}`);
880
920
  const u = t;
881
921
  u.source && u.source[he] && (a = u.source[he]);
882
922
  }
883
- if (a || (a = p.lodInfos.get(o)), !a)
884
- h && console.warn(`Can not load LOD ${e}: no LOD info found for "${o}" ${t.name}`, t.type, p.lodInfos);
923
+ if (a || (a = g.lodInfos.get(o)), !a)
924
+ h && console.warn(`Can not load LOD ${e}: no LOD info found for "${o}" ${t.name}`, t.type, g.lodInfos);
885
925
  else {
886
926
  if (e > 0) {
887
- let d = !1;
888
- const f = Array.isArray(a.lods);
889
- if (f && e >= a.lods.length ? d = !0 : f || (d = !0), d) {
890
- const g = this.lowresCache.get(o);
891
- if (g) {
892
- const O = g.deref();
893
- if (O) return O;
927
+ let f = !1;
928
+ const d = Array.isArray(a.lods);
929
+ if (d && e >= a.lods.length ? f = !0 : d || (f = !0), f) {
930
+ const p = this.lowresCache.get(o);
931
+ if (p) {
932
+ const b = p.deref();
933
+ if (b) return b;
894
934
  this.lowresCache.delete(o), h && console.log(`[gltf-progressive] Lowres cache entry was GC'd: ${o}`);
895
935
  }
896
936
  return null;
@@ -899,111 +939,111 @@ ${e}`);
899
939
  const u = Array.isArray(a.lods) ? a.lods[e]?.path : a.lods;
900
940
  if (!u)
901
941
  return h && !a["missing:uri"] && (a["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + e, a)), null;
902
- const c = at(n.url, u);
942
+ const c = wt(n.url, u);
903
943
  if (c.endsWith(".glb") || c.endsWith(".gltf")) {
904
944
  if (!a.guid)
905
945
  return console.warn("missing pointer for glb/gltf texture", a), null;
906
- const d = c + "_" + a.guid, f = await this.tryResolveLODCacheEntry(this.cache.get(d), d, c, t, e, r);
907
- if (f.found) return f.value;
946
+ const f = c + "_" + a.guid, d = await this.tryResolveLODCacheEntry(this.cache.get(f), f, c, t, e, r);
947
+ if (d.found) return d.value;
908
948
  if (s?.isCurrent?.() === !1)
909
949
  return r && console.log(`Skipping stale LOD ${e} request before queue: ${c}`), null;
910
- const g = await this.queue.slot(c);
950
+ const p = await this.queue.slot(c);
911
951
  if (s?.isCurrent?.() === !1)
912
952
  return r && console.log(`Skipping stale LOD ${e} request after queue: ${c}`), null;
913
- const O = await this.tryResolveLODCacheEntry(this.cache.get(d), d, c, t, e, r);
914
- if (O.found) return O.value;
915
- if (!g.use)
953
+ const b = await this.tryResolveLODCacheEntry(this.cache.get(f), f, c, t, e, r);
954
+ if (b.found) return b.value;
955
+ if (!p.use)
916
956
  return h && console.log(`LOD ${e} was aborted: ${c}`), null;
917
- const y = a, x = new Promise(async (L, N) => {
918
- if (wt) {
919
- const m = await (await yt({})).load(c);
957
+ const y = a, x = new Promise(async (L, U) => {
958
+ if (kt) {
959
+ const m = await (await Pt({})).load(c);
920
960
  if (m.textures.length > 0)
921
- for (const M of m.textures) {
922
- let _ = M.texture;
923
- return p.assignLODInformation(n.url, _, o, e, void 0), t instanceof G && (_ = this.copySettings(t, _)), _ && (_.guid = y.guid), L(_);
961
+ for (const v of m.textures) {
962
+ let _ = v.texture;
963
+ return g.assignLODInformation(n.url, _, o, e, void 0), t instanceof G && (_ = this.copySettings(t, _)), _ && (_.guid = y.guid), L(_);
924
964
  }
925
965
  if (m.geometries.length > 0) {
926
- const M = new Array();
966
+ const v = new Array();
927
967
  for (const _ of m.geometries) {
928
968
  const B = _.geometry;
929
- p.assignLODInformation(n.url, B, o, e, _.primitiveIndex), M.push(B);
969
+ g.assignLODInformation(n.url, B, o, e, _.primitiveIndex), v.push(B);
930
970
  }
931
- return L(M);
971
+ return L(v);
932
972
  }
933
973
  return L(null);
934
974
  }
935
- const w = new ve();
936
- Ie(w), h && (await new Promise((b) => setTimeout(b, 1e3)), r && console.warn("Start loading (delayed) " + c, y.guid));
937
- let S = c;
975
+ const D = new Me();
976
+ qe(D), h && (await new Promise((M) => setTimeout(M, 1e3)), r && console.warn("Start loading (delayed) " + c, y.guid));
977
+ let O = c;
938
978
  if (y && Array.isArray(y.lods)) {
939
- const b = y.lods[e];
940
- b.hash && (S += "?v=" + b.hash);
979
+ const M = y.lods[e];
980
+ M.hash && (O += "?v=" + M.hash);
941
981
  }
942
- const D = await w.loadAsync(S).catch((b) => (console.error(`Error loading LOD ${e} from ${c}
943
- `, b), L(null)));
944
- if (!D)
982
+ const T = await D.loadAsync(O).catch((M) => (console.error(`Error loading LOD ${e} from ${c}
983
+ `, M), L(null)));
984
+ if (!T)
945
985
  return L(null);
946
- const R = D.parser;
986
+ const C = T.parser;
947
987
  r && console.log("Loading finished " + c, y.guid);
948
- let C = 0;
949
- if (D.parser.json.textures) {
950
- let b = !1;
951
- for (const m of D.parser.json.textures) {
988
+ let S = 0;
989
+ if (T.parser.json.textures) {
990
+ let M = !1;
991
+ for (const m of T.parser.json.textures) {
952
992
  if (m?.extensions) {
953
- const M = m?.extensions[U];
954
- if (M?.guid && M.guid === y.guid) {
955
- b = !0;
993
+ const v = m?.extensions[F];
994
+ if (v?.guid && v.guid === y.guid) {
995
+ M = !0;
956
996
  break;
957
997
  }
958
998
  }
959
- C++;
999
+ S++;
960
1000
  }
961
- if (b) {
962
- let m = await R.getDependency("texture", C);
963
- return m && p.assignLODInformation(n.url, m, o, e, void 0), r && console.log('change "' + t.name + '" → "' + m.name + '"', c, C, m, d), t instanceof G && (m = this.copySettings(t, m)), m && (m.guid = y.guid), L(m);
964
- } else h && console.warn("Could not find texture with guid", y.guid, D.parser.json);
1001
+ if (M) {
1002
+ let m = await C.getDependency("texture", S);
1003
+ return m && g.assignLODInformation(n.url, m, o, e, void 0), r && console.log('change "' + t.name + '" → "' + m.name + '"', c, S, m, f), t instanceof G && (m = this.copySettings(t, m)), m && (m.guid = y.guid), L(m);
1004
+ } else h && console.warn("Could not find texture with guid", y.guid, T.parser.json);
965
1005
  }
966
- if (C = 0, D.parser.json.meshes) {
967
- let b = !1;
968
- for (const m of D.parser.json.meshes) {
1006
+ if (S = 0, T.parser.json.meshes) {
1007
+ let M = !1;
1008
+ for (const m of T.parser.json.meshes) {
969
1009
  if (m?.extensions) {
970
- const M = m?.extensions[U];
971
- if (M?.guid && M.guid === y.guid) {
972
- b = !0;
1010
+ const v = m?.extensions[F];
1011
+ if (v?.guid && v.guid === y.guid) {
1012
+ M = !0;
973
1013
  break;
974
1014
  }
975
1015
  }
976
- C++;
1016
+ S++;
977
1017
  }
978
- if (b) {
979
- const m = await R.getDependency("mesh", C);
980
- if (r && console.log(`Loaded Mesh "${m.name}"`, c, C, m, d), m.isMesh === !0) {
981
- const M = m.geometry;
982
- return p.assignLODInformation(n.url, M, o, e, 0), L(M);
1018
+ if (M) {
1019
+ const m = await C.getDependency("mesh", S);
1020
+ if (r && console.log(`Loaded Mesh "${m.name}"`, c, S, m, f), m.isMesh === !0) {
1021
+ const v = m.geometry;
1022
+ return g.assignLODInformation(n.url, v, o, e, 0), L(v);
983
1023
  } else {
984
- const M = new Array();
1024
+ const v = new Array();
985
1025
  for (let _ = 0; _ < m.children.length; _++) {
986
1026
  const B = m.children[_];
987
1027
  if (B.isMesh === !0) {
988
1028
  const ie = B.geometry;
989
- p.assignLODInformation(n.url, ie, o, e, _), M.push(ie);
1029
+ g.assignLODInformation(n.url, ie, o, e, _), v.push(ie);
990
1030
  }
991
1031
  }
992
- return L(M);
1032
+ return L(v);
993
1033
  }
994
- } else h && console.warn("Could not find mesh with guid", y.guid, D.parser.json);
1034
+ } else h && console.warn("Could not find mesh with guid", y.guid, T.parser.json);
995
1035
  }
996
1036
  return L(null);
997
1037
  });
998
- this.cache.set(d, x), g.use(x);
999
- const v = await x;
1000
- return v != null ? v instanceof G ? (this.cache.set(d, new WeakRef(v)), p._resourceRegistry.register(v, d)) : Array.isArray(v) ? this.cache.set(d, Promise.resolve(v)) : this.cache.set(d, Promise.resolve(v)) : this.cache.set(d, Promise.resolve(null)), v;
1038
+ this.cache.set(f, x), p.use(x);
1039
+ const w = await x;
1040
+ return w != null ? w instanceof G ? (this.cache.set(f, new WeakRef(w)), g._resourceRegistry.register(w, f)) : Array.isArray(w) ? this.cache.set(f, Promise.resolve(w)) : this.cache.set(f, Promise.resolve(w)) : this.cache.set(f, Promise.resolve(null)), w;
1001
1041
  } else if (t instanceof G) {
1002
1042
  if (s?.isCurrent?.() === !1)
1003
1043
  return r && console.log(`Skipping stale texture LOD ${e} request: ${c}`), null;
1004
1044
  r && console.log("Load texture from uri: " + c);
1005
- const f = await new Ke().loadAsync(c);
1006
- return s?.isCurrent?.() === !1 ? (f?.dispose(), null) : (f ? (f.guid = a.guid, f.flipY = !1, f.needsUpdate = !0, f.colorSpace = t.colorSpace, r && console.log(a, f)) : h && console.warn("failed loading", c), f);
1045
+ const d = await new it().loadAsync(c);
1046
+ return s?.isCurrent?.() === !1 ? (d?.dispose(), null) : (d ? (d.guid = a.guid, d.flipY = !1, d.needsUpdate = !0, d.colorSpace = t.colorSpace, r && console.log(a, d)) : h && console.warn("failed loading", c), d);
1007
1047
  }
1008
1048
  }
1009
1049
  return null;
@@ -1014,24 +1054,24 @@ ${e}`);
1014
1054
  if (o && console.log(`LOD ${n} was already loading/loaded: ${e}`), t instanceof WeakRef) {
1015
1055
  const u = t.deref();
1016
1056
  if (u) {
1017
- let c = u, d = !1;
1018
- if (c instanceof G && r instanceof G ? c.image?.data || c.source?.data ? c = this.copySettings(r, c) : d = !0 : c instanceof j && r instanceof j && (c.attributes.position?.array || (d = !0)), !d)
1057
+ let c = u, f = !1;
1058
+ if (c instanceof G && r instanceof G ? Te(c.image) || we(c) ? c = this.copySettings(r, c) : f = !0 : c instanceof j && r instanceof j && (c.attributes.position?.array || (f = !0)), !f)
1019
1059
  return { found: !0, value: c };
1020
1060
  }
1021
1061
  return this.cache.delete(e), h && console.log(`[gltf-progressive] Re-loading GC'd/disposed resource: ${e}`), { found: !1 };
1022
1062
  }
1023
1063
  let a = await t.catch((u) => (console.error(`Error loading LOD ${n} from ${s}
1024
1064
  `, u), null)), l = !1;
1025
- return a == null || (a instanceof G && r instanceof G ? a.image?.data || a.source?.data ? a = this.copySettings(r, a) : (l = !0, this.cache.delete(e)) : a instanceof j && r instanceof j && (a.attributes.position?.array || (l = !0, this.cache.delete(e)))), l ? { found: !1 } : { found: !0, value: a };
1065
+ return a == null || (a instanceof G && r instanceof G ? Te(a.image) || we(a) ? a = this.copySettings(r, a) : (l = !0, this.cache.delete(e)) : a instanceof j && r instanceof j && (a.attributes.position?.array || (l = !0, this.cache.delete(e)))), l ? { found: !1 } : { found: !0, value: a };
1026
1066
  }
1027
1067
  static _queue;
1028
1068
  static get queue() {
1029
- return this._queue ??= new lt(Me() ? 20 : 50, { debug: h != !1 });
1069
+ return this._queue ??= new Dt(be() ? 20 : 50, { debug: h != !1 });
1030
1070
  }
1031
1071
  static assignLODInformation(t, e, s, r, n) {
1032
1072
  if (!e) return;
1033
1073
  e.userData || (e.userData = {});
1034
- const o = new Lt(t, s, r, n);
1074
+ const o = new At(t, s, r, n);
1035
1075
  e.userData.LODS = o, "source" in e && typeof e.source == "object" && (e.source.LODS = o);
1036
1076
  }
1037
1077
  static getAssignedLODInformation(t) {
@@ -1044,7 +1084,7 @@ ${e}`);
1044
1084
  `, e.uuid), e = e.clone(), e.offset = t.offset, e.repeat = t.repeat, e.colorSpace = t.colorSpace, e.magFilter = t.magFilter, e.minFilter = t.minFilter, e.wrapS = t.wrapS, e.wrapT = t.wrapT, e.flipY = t.flipY, e.anisotropy = t.anisotropy, e.mipmaps || (e.generateMipmaps = t.generateMipmaps), e) : t;
1045
1085
  }
1046
1086
  }
1047
- class Lt {
1087
+ class At {
1048
1088
  url;
1049
1089
  /** the key to lookup the LOD information */
1050
1090
  key;
@@ -1131,7 +1171,7 @@ class oe {
1131
1171
  });
1132
1172
  }
1133
1173
  }
1134
- const A = E("debugprogressive"), vt = A === "colors", Dt = E("noprogressive"), ge = /* @__PURE__ */ Symbol("Needle:LODSManager"), pe = /* @__PURE__ */ Symbol("Needle:LODState"), F = /* @__PURE__ */ Symbol("Needle:CurrentLOD"), T = { mesh_lod: -1, texture_lod: -1 }, Mt = new Re(), Oe = [
1174
+ const A = N("debugprogressive"), It = A === "colors", $t = N("noprogressive"), ge = /* @__PURE__ */ Symbol("Needle:LODSManager"), pe = /* @__PURE__ */ Symbol("Needle:LODState"), z = /* @__PURE__ */ Symbol("Needle:CurrentLOD"), Se = ot, R = { mesh_lod: -1, texture_lod: -1 }, Bt = new Be(), Re = [
1135
1175
  3526751,
1136
1176
  11065402,
1137
1177
  15978811,
@@ -1164,12 +1204,17 @@ const A = E("debugprogressive"), vt = A === "colors", Dt = E("noprogressive"), g
1164
1204
  15817653,
1165
1205
  5083278,
1166
1206
  5592405
1167
- ], me = new ce(), z = new ce(), Se = new ce(), _t = new k(), Ot = new k(), St = new ke(), q = new k(), Y = new k(), Q = new k(), J = new k();
1168
- function bt(i, t) {
1207
+ ];
1208
+ function Gt() {
1209
+ const i = Se.Timer || Se.Clock;
1210
+ return new i();
1211
+ }
1212
+ const me = new ce(), E = new ce(), Pe = new ce(), qt = new k(), Wt = new k(), Ft = new $e(), q = new k(), Y = new k(), Q = new k(), J = new k();
1213
+ function Ut(i, t) {
1169
1214
  const e = i.min, s = i.max, r = (e.x + s.x) * 0.5, n = (e.y + s.y) * 0.5;
1170
1215
  return q.set(r, n, e.z).applyMatrix4(t).z < 0;
1171
1216
  }
1172
- function Tt(i) {
1217
+ function zt(i) {
1173
1218
  const {
1174
1219
  geometry: t,
1175
1220
  matrixWorld: e,
@@ -1181,46 +1226,47 @@ function Tt(i) {
1181
1226
  xrEnabled: l = !1,
1182
1227
  debugDrawLine: u,
1183
1228
  warnMissingPrimitiveDensities: c = !1
1184
- } = i, d = p.getMeshLODExtension(t)?.lods, f = p.getPrimitiveIndex(t), g = i.target ?? {
1229
+ } = i, f = g.getMeshLODExtension(t)?.lods, d = g.getPrimitiveIndex(t), p = i.target ?? {
1185
1230
  level: a,
1186
- primitiveIndex: f,
1231
+ primitiveIndex: d,
1187
1232
  screenCoverage: 0,
1188
1233
  screenspaceVolume: new k(),
1189
1234
  centrality: 1
1190
1235
  };
1191
- if (g.level = a, g.primitiveIndex = f, g.screenCoverage = 0, g.screenspaceVolume.set(0, 0, 0), g.centrality = 1, !d?.length) return g;
1192
- let O = i.boundingBox ?? t.boundingBox;
1193
- if (O || (t.computeBoundingBox(), O = t.boundingBox), !O) return g;
1194
- if (me.copy(O).applyMatrix4(e), s.isPerspectiveCamera && bt(me, r))
1195
- return g.level = 0, g.screenCoverage = 1 / 0, g.screenspaceVolume.set(1 / 0, 1 / 0, 1 / 0), g;
1196
- if (z.copy(me).applyMatrix4(r), l && s.isPerspectiveCamera && s.fov > 70) {
1197
- const w = z.min, S = z.max;
1198
- let D = w.x, R = w.y, C = S.x, b = S.y;
1199
- const m = 2, M = 1.5, _ = (w.x + S.x) * 0.5, B = (w.y + S.y) * 0.5;
1200
- D = (D - _) * m + _, R = (R - B) * m + B, C = (C - _) * m + _, b = (b - B) * m + B;
1201
- const ie = D < 0 && C > 0 ? 0 : Math.min(Math.abs(w.x), Math.abs(S.x)), ze = R < 0 && b > 0 ? 0 : Math.min(Math.abs(w.y), Math.abs(S.y)), de = Math.max(ie, ze);
1202
- g.centrality = (M - de) * (M - de) * (M - de);
1203
- }
1204
- const y = z.getSize(_t);
1205
- y.multiplyScalar(0.5), globalThis.screen?.availHeight > 0 && o > 0 && y.multiplyScalar(o / globalThis.screen.availHeight), s.isPerspectiveCamera && (y.x *= s.aspect), Se.copy(O).applyMatrix4(e).applyMatrix4(s.matrixWorldInverse);
1206
- const x = Se.getSize(Ot), v = Math.max(y.x, y.y), L = Math.max(x.x, x.y);
1207
- v !== 0 && L !== 0 && (y.z = x.z / L * v);
1208
- const N = Math.max(y.x, y.y, y.z) * g.centrality;
1209
- if (g.screenCoverage = N, g.screenspaceVolume.copy(y), N <= 0) return g;
1236
+ p.level = a, p.primitiveIndex = d, p.screenCoverage = 0, p.screenspaceVolume.set(0, 0, 0), p.centrality = 1;
1237
+ let b = i.boundingBox ?? t.boundingBox;
1238
+ if (b || (t.computeBoundingBox(), b = t.boundingBox), !b) return p;
1239
+ if (me.copy(b).applyMatrix4(e), s.isPerspectiveCamera && Ut(me, r))
1240
+ return p.level = 0, p.screenCoverage = 1 / 0, p.screenspaceVolume.set(1 / 0, 1 / 0, 1 / 0), p;
1241
+ if (E.copy(me).applyMatrix4(r), l && s.isPerspectiveCamera && s.fov > 70) {
1242
+ const D = E.min, O = E.max;
1243
+ let T = D.x, C = D.y, S = O.x, M = O.y;
1244
+ const m = 2, v = 1.5, _ = (D.x + O.x) * 0.5, B = (D.y + O.y) * 0.5;
1245
+ T = (T - _) * m + _, C = (C - B) * m + B, S = (S - _) * m + _, M = (M - B) * m + B;
1246
+ const ie = T < 0 && S > 0 ? 0 : Math.min(Math.abs(D.x), Math.abs(O.x)), Xe = C < 0 && M > 0 ? 0 : Math.min(Math.abs(D.y), Math.abs(O.y)), fe = Math.max(ie, Xe);
1247
+ p.centrality = (v - fe) * (v - fe) * (v - fe);
1248
+ }
1249
+ const y = E.getSize(qt);
1250
+ y.multiplyScalar(0.5), globalThis.screen?.availHeight > 0 && o > 0 && y.multiplyScalar(o / globalThis.screen.availHeight), s.isPerspectiveCamera && (y.x *= s.aspect), Pe.copy(b).applyMatrix4(e).applyMatrix4(s.matrixWorldInverse);
1251
+ const x = Pe.getSize(Wt), w = Math.max(y.x, y.y), L = Math.max(x.x, x.y);
1252
+ w !== 0 && L !== 0 && (y.z = x.z / L * w);
1253
+ const U = Math.max(y.x, y.y, y.z) * p.centrality;
1254
+ if (p.screenCoverage = U, p.screenspaceVolume.copy(y), U <= 0) return p;
1210
1255
  if (u) {
1211
- const w = St.copy(r);
1212
- w.invert(), q.copy(z.min), Y.copy(z.max), Y.x = q.x, Q.copy(z.max), Q.y = q.y, J.copy(z.max);
1213
- const S = (q.z + J.z) * 0.5;
1214
- q.z = Y.z = Q.z = J.z = S, q.applyMatrix4(w), Y.applyMatrix4(w), Q.applyMatrix4(w), J.applyMatrix4(w), u(q, Y, 255), u(q, Q, 255), u(Y, J, 255), u(Q, J, 255);
1215
- }
1216
- for (let w = 0; w < d.length; w++) {
1217
- const S = d[w], D = S.densities?.[f] || S.density || 1e-5;
1218
- if (f > 0 && c && Ge() && !S.densities && !globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"] && (globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"] = !0, console.warn("[Needle Progressive] Detected usage of mesh without primitive densities. This might cause incorrect LOD level selection: Consider re-optimizing your model by updating your Needle Integration, Needle glTF Pipeline or running optimization again on Needle Cloud.")), D / N < n) {
1219
- g.level = w;
1220
- break;
1256
+ const D = Ft.copy(r);
1257
+ D.invert(), q.copy(E.min), Y.copy(E.max), Y.x = q.x, Q.copy(E.max), Q.y = q.y, J.copy(E.max);
1258
+ const O = (q.z + J.z) * 0.5;
1259
+ q.z = Y.z = Q.z = J.z = O, q.applyMatrix4(D), Y.applyMatrix4(D), Q.applyMatrix4(D), J.applyMatrix4(D), u(q, Y, 255), u(q, Q, 255), u(Y, J, 255), u(Q, J, 255);
1260
+ }
1261
+ if (f?.length)
1262
+ for (let D = 0; D < f.length; D++) {
1263
+ const O = f[D], T = O.densities?.[d] || O.density || 1e-5;
1264
+ if (d > 0 && c && Ue() && !O.densities && !globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"] && (globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"] = !0, console.warn("[Needle Progressive] Detected usage of mesh without primitive densities. This might cause incorrect LOD level selection: Consider re-optimizing your model by updating your Needle Integration, Needle glTF Pipeline or running optimization again on Needle Cloud.")), T / U < n) {
1265
+ p.level = D;
1266
+ break;
1267
+ }
1221
1268
  }
1222
- }
1223
- return g;
1269
+ return p;
1224
1270
  }
1225
1271
  let ue = class X {
1226
1272
  /**
@@ -1258,7 +1304,7 @@ let ue = class X {
1258
1304
  }
1259
1305
  renderer;
1260
1306
  context;
1261
- projectionScreenMatrix = new ke();
1307
+ projectionScreenMatrix = new $e();
1262
1308
  /** @deprecated use static `LODsManager.addPlugin()` method. This getter will be removed in later versions */
1263
1309
  get plugins() {
1264
1310
  return W;
@@ -1331,7 +1377,7 @@ let ue = class X {
1331
1377
  const r = performance.now();
1332
1378
  return s.ready.finally(() => {
1333
1379
  const n = this._newPromiseGroups.indexOf(s);
1334
- n >= 0 && (this._newPromiseGroups.splice(n, 1), Ge() && performance.measure("LODsManager:awaitLoading", {
1380
+ n >= 0 && (this._newPromiseGroups.splice(n, 1), Ue() && performance.measure("LODsManager:awaitLoading", {
1335
1381
  start: r,
1336
1382
  detail: { id: e, name: t?.name, awaited: s.awaitedCount, resolved: s.resolvedCount }
1337
1383
  }));
@@ -1387,11 +1433,11 @@ let ue = class X {
1387
1433
  this.renderer = t, this.context = { ...e };
1388
1434
  }
1389
1435
  #t;
1390
- #i = new He();
1391
1436
  #r = 0;
1392
1437
  #n = 0;
1393
1438
  #o = 0;
1394
1439
  #s = 0;
1440
+ #i = Gt();
1395
1441
  _fpsBuffer = [60, 60, 60, 60, 60];
1396
1442
  /**
1397
1443
  * Enable the LODsManager. This will replace the render method of the renderer with a method that updates the LODs.
@@ -1402,9 +1448,9 @@ let ue = class X {
1402
1448
  let t = 0;
1403
1449
  this.#t = this.renderer.render;
1404
1450
  const e = this;
1405
- De(this.renderer), this.renderer.render = function(s, r) {
1451
+ _e(this.renderer), this.renderer.render = function(s, r) {
1406
1452
  const n = e.renderer.getRenderTarget();
1407
- (n == null || "isXRRenderTarget" in n && n.isXRRenderTarget) && (t = 0, e.#r += 1, e.#n = e.#i.getDelta(), e.#o += e.#n, e._fpsBuffer.shift(), e._fpsBuffer.push(1 / e.#n), e.#s = e._fpsBuffer.reduce((a, l) => a + l) / e._fpsBuffer.length, A && e.#r % 200 === 0 && console.log("FPS", Math.round(e.#s), "Interval:", e.#e));
1453
+ (n == null || "isXRRenderTarget" in n && n.isXRRenderTarget) && (t = 0, e.#r += 1, e.#i.update?.(), e.#n = Math.max(e.#i.getDelta(), 1 / 1e3), e.#o += e.#n, e._fpsBuffer.shift(), e._fpsBuffer.push(1 / e.#n), e.#s = e._fpsBuffer.reduce((a, l) => a + l) / e._fpsBuffer.length, A && e.#r % 200 === 0 && console.log("FPS", Math.round(e.#s), "Interval:", e.#e));
1408
1454
  const o = t++;
1409
1455
  e.#t.call(this, s, r), e.onAfterRender(s, r, o);
1410
1456
  };
@@ -1432,14 +1478,16 @@ let ue = class X {
1432
1478
  }
1433
1479
  onAfterRender(t, e, s) {
1434
1480
  if (this.pause) return;
1435
- const n = this.renderer.renderLists.get(t, 0).opaque;
1481
+ const r = this.getRenderList(t, e, s);
1482
+ if (!r) return;
1483
+ const n = r.opaque;
1436
1484
  let o = !0;
1437
1485
  if (n.length === 1) {
1438
1486
  const a = n[0].material;
1439
1487
  (a.name === "EffectMaterial" || a.name === "CopyShader") && (o = !1);
1440
1488
  }
1441
1489
  if ((e.parent && e.parent.type === "CubeCamera" || s >= 1 && e.type === "OrthographicCamera") && (o = !1), o) {
1442
- if (Dt || (this.updateInterval === "auto" ? this.#s < 40 && this.#e < 10 ? (this.#e += 1, A && console.warn("↓ Reducing LOD updates", this.#e, this.#s.toFixed(0))) : this.#s >= 60 && this.#e > 1 && (this.#e -= 1, A && console.warn("↑ Increasing LOD updates", this.#e, this.#s.toFixed(0))) : this.#e = this.updateInterval, this.#e > 0 && this.#r % this.#e != 0))
1490
+ if ($t || (this.updateInterval === "auto" ? this.#s < 40 && this.#e < 10 ? (this.#e += 1, A && console.warn("↓ Reducing LOD updates", this.#e, this.#s.toFixed(0))) : this.#s >= 60 && this.#e > 1 && (this.#e -= 1, A && console.warn("↑ Increasing LOD updates", this.#e, this.#s.toFixed(0))) : this.#e = this.updateInterval, this.#e > 0 && this.#r % this.#e != 0))
1443
1491
  return;
1444
1492
  this.internalUpdate(t, e), this._postprocessPromiseGroups();
1445
1493
  }
@@ -1448,7 +1496,9 @@ let ue = class X {
1448
1496
  * Update LODs in a scene
1449
1497
  */
1450
1498
  internalUpdate(t, e) {
1451
- const s = this.renderer.renderLists.get(t, 0), r = s.opaque;
1499
+ const s = this.getRenderList(t, e, 0);
1500
+ if (!s) return;
1501
+ const r = s.opaque;
1452
1502
  this.projectionScreenMatrix.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse);
1453
1503
  const n = this.targetTriangleDensity;
1454
1504
  for (const l of r) {
@@ -1466,32 +1516,51 @@ let ue = class X {
1466
1516
  continue;
1467
1517
  }
1468
1518
  const u = l.object;
1469
- (u instanceof K || u.isMesh) && this.updateLODs(t, e, u, n);
1519
+ (u instanceof H || u.isMesh) && this.updateLODs(t, e, u, n);
1470
1520
  }
1471
1521
  const o = s.transparent;
1472
1522
  for (const l of o) {
1473
1523
  const u = l.object;
1474
- (u instanceof K || u.isMesh) && this.updateLODs(t, e, u, n);
1524
+ (u instanceof H || u.isMesh) && this.updateLODs(t, e, u, n);
1475
1525
  }
1476
1526
  const a = s.transmissive;
1477
1527
  for (const l of a) {
1478
1528
  const u = l.object;
1479
- (u instanceof K || u.isMesh) && this.updateLODs(t, e, u, n);
1529
+ (u instanceof H || u.isMesh) && this.updateLODs(t, e, u, n);
1480
1530
  }
1481
1531
  }
1532
+ getRenderList(t, e, s) {
1533
+ const r = this.renderer;
1534
+ let n = null;
1535
+ if (r.isWebGPURenderer === !0) {
1536
+ const o = r._renderLists;
1537
+ if (!o) return null;
1538
+ n = o.get(t, e);
1539
+ } else if (r.isWebGLRenderer === !0) {
1540
+ const o = r.renderLists;
1541
+ if (!o) return null;
1542
+ n = o.get(t, s);
1543
+ }
1544
+ return n ? {
1545
+ opaque: n.opaque || [],
1546
+ transparent: n.transparent || [],
1547
+ transmissive: n.transmissive || n.transparentDoublePass || [],
1548
+ transparentDoublePass: n.transparentDoublePass || []
1549
+ } : null;
1550
+ }
1482
1551
  /** Update the LOD levels for the renderer. */
1483
1552
  updateLODs(t, e, s, r) {
1484
1553
  s.userData || (s.userData = {});
1485
1554
  let n = s[pe];
1486
- if (n || (n = new Ct(), s[pe] = n), n.frames++ < 2)
1555
+ if (n || (n = new Et(), s[pe] = n), n.frames++ < 2)
1487
1556
  return;
1488
1557
  for (const a of W)
1489
1558
  a.onBeforeUpdateLOD?.(this.renderer, t, e, s);
1490
1559
  const o = this.overrideLodLevel !== void 0 ? this.overrideLodLevel : V;
1491
- o >= 0 ? (T.mesh_lod = o, T.texture_lod = o) : (this.calculateLodLevel(e, s, n, r, T), T.mesh_lod = Math.round(T.mesh_lod), T.texture_lod = Math.round(T.texture_lod)), T.mesh_lod >= 0 && this.loadProgressiveMeshes(s, T.mesh_lod), s.material && T.texture_lod >= 0 && this.loadProgressiveTextures(s.material, T.texture_lod, o), h && s.material && !s.isGizmo && qe(s.material), vt && s.material && !s.isGizmo && !s.isBatchedMesh && We(s.material, T.mesh_lod);
1560
+ o >= 0 ? (R.mesh_lod = o, R.texture_lod = o) : (this.calculateLodLevel(e, s, n, r, R), R.mesh_lod = Math.round(R.mesh_lod), R.texture_lod = Math.round(R.texture_lod)), R.mesh_lod >= 0 && this.loadProgressiveMeshes(s, R.mesh_lod), s.material && R.texture_lod >= 0 && this.loadProgressiveTextures(s.material, R.texture_lod, o), h && s.material && !s.isGizmo && ze(s.material), It && s.material && !s.isGizmo && !s.isBatchedMesh && Ee(s.material, R.mesh_lod);
1492
1561
  for (const a of W)
1493
- a.onAfterUpdatedLOD?.(this.renderer, t, e, s, T);
1494
- n.lastLodLevel_Mesh = T.mesh_lod, n.lastLodLevel_Texture = T.texture_lod;
1562
+ a.onAfterUpdatedLOD?.(this.renderer, t, e, s, R);
1563
+ n.lastLodLevel_Mesh = R.mesh_lod, n.lastLodLevel_Texture = R.texture_lod;
1495
1564
  }
1496
1565
  /** Load progressive textures for the given material
1497
1566
  * @param material the material to load the textures for
@@ -1506,11 +1575,11 @@ let ue = class X {
1506
1575
  return;
1507
1576
  }
1508
1577
  let r = !1;
1509
- (t[F] === void 0 || e < t[F]) && (r = !0);
1578
+ (t[z] === void 0 || e < t[z]) && (r = !0);
1510
1579
  const n = s !== void 0 && s >= 0;
1511
- if (n && (r = t[F] != s, e = s), r) {
1512
- t[F] = e;
1513
- const o = n ? { force: !0 } : void 0, a = p.assignTextureLOD(t, e, o).then((l) => {
1580
+ if (n && (r = t[z] != s, e = s), r) {
1581
+ t[z] = e;
1582
+ const o = n ? { force: !0 } : void 0, a = g.assignTextureLOD(t, e, o).then((l) => {
1514
1583
  this._lodchangedlisteners.forEach((u) => u({ type: "texture", level: e, object: t }));
1515
1584
  });
1516
1585
  oe.addPromise("texture", t, a, this._newPromiseGroups);
@@ -1524,17 +1593,17 @@ let ue = class X {
1524
1593
  */
1525
1594
  loadProgressiveMeshes(t, e) {
1526
1595
  if (!t) return Promise.resolve(null);
1527
- let s = t[F] !== e;
1596
+ let s = t[z] !== e;
1528
1597
  const r = t["DEBUG:LOD"];
1529
- if (r != null && (s = t[F] != r, e = r), s) {
1530
- t[F] = e;
1531
- const n = t.geometry, o = p.assignMeshLOD(t, e).then((a) => (a && t[F] == e && n != t.geometry && this._lodchangedlisteners.forEach((l) => l({ type: "mesh", level: e, object: t })), a));
1598
+ if (r != null && (s = t[z] != r, e = r), s) {
1599
+ t[z] = e;
1600
+ const n = t.geometry, o = g.assignMeshLOD(t, e).then((a) => (a && t[z] == e && n != t.geometry && this._lodchangedlisteners.forEach((l) => l({ type: "mesh", level: e, object: t })), a));
1532
1601
  return oe.addPromise("mesh", t, o, this._newPromiseGroups), o;
1533
1602
  }
1534
1603
  return Promise.resolve(null);
1535
1604
  }
1536
1605
  // private testIfLODLevelsAreAvailable() {
1537
- _sphere = new Pe();
1606
+ _sphere = new Ie();
1538
1607
  _tempWorldPosition = new k();
1539
1608
  static skinnedMeshBoundsFrameOffsetCounter = 0;
1540
1609
  static $skinnedMeshBoundsOffset = /* @__PURE__ */ Symbol("gltf-progressive-skinnedMeshBoundsOffset");
@@ -1551,13 +1620,13 @@ let ue = class X {
1551
1620
  let a = 10 + 1, l = !1;
1552
1621
  if (A && e["DEBUG:LOD"] != null)
1553
1622
  return e["DEBUG:LOD"];
1554
- const u = p.getMeshLODExtension(e.geometry)?.lods, c = p.getPrimitiveIndex(e.geometry), d = u && u.length > 0, f = p.getMaterialMinMaxLODsCount(e.material), g = f.min_count !== 1 / 0 && f.min_count >= 0 && f.max_count >= 0;
1555
- if (!d && !g) {
1623
+ const u = g.getMeshLODExtension(e.geometry)?.lods, c = g.getPrimitiveIndex(e.geometry), f = u && u.length > 0, d = g.getMaterialMinMaxLODsCount(e.material), p = d.min_count !== 1 / 0 && d.min_count >= 0 && d.max_count >= 0;
1624
+ if (!f && !p) {
1556
1625
  n.mesh_lod = 0, n.texture_lod = 0;
1557
1626
  return;
1558
1627
  }
1559
- d || (l = !0, a = 0);
1560
- const O = this.renderer.domElement.clientHeight || this.renderer.domElement.height;
1628
+ f || (l = !0, a = 0);
1629
+ const b = this.renderer.domElement.clientHeight || this.renderer.domElement.height;
1561
1630
  let y = e.geometry.boundingBox;
1562
1631
  if (e.type === "SkinnedMesh") {
1563
1632
  const x = e;
@@ -1568,10 +1637,10 @@ let ue = class X {
1568
1637
  const L = X.skinnedMeshBoundsFrameOffsetCounter++;
1569
1638
  x[X.$skinnedMeshBoundsOffset] = L;
1570
1639
  }
1571
- const v = x[X.$skinnedMeshBoundsOffset];
1572
- if ((s.frames + v) % this.skinnedMeshAutoUpdateBoundsInterval === 0) {
1573
- const L = ne(x), N = x.geometry;
1574
- L && (x.geometry = L), x.computeBoundingBox(), x.geometry = N;
1640
+ const w = x[X.$skinnedMeshBoundsOffset];
1641
+ if ((s.frames + w) % this.skinnedMeshAutoUpdateBoundsInterval === 0) {
1642
+ const L = ne(x), U = x.geometry;
1643
+ L && (x.geometry = L), x.computeBoundingBox(), x.geometry = U;
1575
1644
  }
1576
1645
  }
1577
1646
  y = x.boundingBox;
@@ -1585,13 +1654,13 @@ let ue = class X {
1585
1654
  return;
1586
1655
  }
1587
1656
  }
1588
- const x = Tt({
1657
+ const x = zt({
1589
1658
  geometry: e.geometry,
1590
1659
  matrixWorld: e.matrixWorld,
1591
1660
  camera: t,
1592
1661
  projectionScreenMatrix: this.projectionScreenMatrix,
1593
1662
  desiredDensity: r,
1594
- canvasHeight: O,
1663
+ canvasHeight: b,
1595
1664
  currentLevel: s.lastLodLevel_Mesh,
1596
1665
  boundingBox: y,
1597
1666
  xrEnabled: this.renderer.xr.enabled,
@@ -1605,29 +1674,29 @@ let ue = class X {
1605
1674
  x.level >= 0 && x.level < a && (a = x.level, l = !0);
1606
1675
  }
1607
1676
  if (l ? n.mesh_lod = a : n.mesh_lod = s.lastLodLevel_Mesh, A && n.mesh_lod != s.lastLodLevel_Mesh) {
1608
- const v = u?.[n.mesh_lod];
1609
- v && console.log(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${n.mesh_lod} (density: ${v.densities?.[c].toFixed(0)}) | ${e.name}`);
1677
+ const w = u?.[n.mesh_lod];
1678
+ w && console.log(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${n.mesh_lod} (density: ${w.densities?.[c].toFixed(0)}) | ${e.name}`);
1610
1679
  }
1611
- if (g) {
1680
+ if (p) {
1612
1681
  const x = "saveData" in globalThis.navigator && globalThis.navigator.saveData === !0;
1613
1682
  if (s.lastLodLevel_Texture < 0) {
1614
- if (n.texture_lod = f.max_count - 1, A) {
1615
- const v = f.lods[f.max_count - 1];
1616
- A && console.log(`First Texture LOD ${n.texture_lod} (${v.max_height}px) - ${e.name}`);
1683
+ if (n.texture_lod = d.max_count - 1, A) {
1684
+ const w = d.lods[d.max_count - 1];
1685
+ A && console.log(`First Texture LOD ${n.texture_lod} (${w.max_height}px) - ${e.name}`);
1617
1686
  }
1618
1687
  } else {
1619
- const v = s.lastScreenspaceVolume.x + s.lastScreenspaceVolume.y + s.lastScreenspaceVolume.z;
1688
+ const w = s.lastScreenspaceVolume.x + s.lastScreenspaceVolume.y + s.lastScreenspaceVolume.z;
1620
1689
  let L = s.lastScreenCoverage * 4;
1621
1690
  this.context?.engine === "model-viewer" && (L *= 1.5);
1622
- const w = O / window.devicePixelRatio * L;
1623
- let S = !1;
1624
- for (let D = f.lods.length - 1; D >= 0; D--) {
1625
- const R = f.lods[D];
1626
- if (!(x && R.max_height >= 2048) && !(Me() && R.max_height > 4096) && (R.max_height > w || !S && D === 0)) {
1627
- if (S = !0, n.texture_lod = D, A && n.texture_lod < s.lastLodLevel_Texture) {
1628
- const C = R.max_height;
1629
- console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${n.texture_lod} = ${C}px
1630
- Screensize: ${w.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${v.toFixed(1)}
1691
+ const U = this.renderer.getPixelRatio?.() || globalThis.devicePixelRatio || 1, O = b / U * L;
1692
+ let T = !1;
1693
+ for (let C = d.lods.length - 1; C >= 0; C--) {
1694
+ const S = d.lods[C];
1695
+ if (!(x && S.max_height >= 2048) && !(be() && S.max_height > 4096) && (S.max_height > O || !T && C === 0)) {
1696
+ if (T = !0, n.texture_lod = C, A && n.texture_lod < s.lastLodLevel_Texture) {
1697
+ const M = S.max_height;
1698
+ console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${n.texture_lod} = ${M}px
1699
+ Screensize: ${O.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${w.toFixed(1)}
1631
1700
  ${e.name}`);
1632
1701
  }
1633
1702
  break;
@@ -1638,7 +1707,7 @@ ${e.name}`);
1638
1707
  n.texture_lod = 0;
1639
1708
  }
1640
1709
  };
1641
- class Ct {
1710
+ class Et {
1642
1711
  frames = 0;
1643
1712
  lastLodLevel_Mesh = -1;
1644
1713
  lastLodLevel_Texture = -1;
@@ -1646,53 +1715,53 @@ class Ct {
1646
1715
  lastScreenspaceVolume = new k();
1647
1716
  lastCentrality = 0;
1648
1717
  }
1649
- function We(i, t) {
1718
+ function Ee(i, t) {
1650
1719
  if (!(t < 0)) {
1651
1720
  if (Array.isArray(i)) {
1652
1721
  for (const e of i)
1653
- We(e, t);
1722
+ Ee(e, t);
1654
1723
  return;
1655
1724
  }
1656
- "color" in i && i.color instanceof Re && (i.color.copy(Pt(t, Mt)), i.needsUpdate = !0);
1725
+ "color" in i && i.color instanceof Be && (i.color.copy(Nt(t, Bt)), i.needsUpdate = !0);
1657
1726
  }
1658
1727
  }
1659
- function Pt(i, t) {
1660
- const e = Math.max(0, Math.min(Oe.length - 1, Math.floor(i)));
1661
- return t.setHex(Oe[e]);
1728
+ function Nt(i, t) {
1729
+ const e = Math.max(0, Math.min(Re.length - 1, Math.floor(i)));
1730
+ return t.setHex(Re[e]);
1662
1731
  }
1663
- const be = /* @__PURE__ */ Symbol("NEEDLE_mesh_lod"), ae = /* @__PURE__ */ Symbol("NEEDLE_texture_lod");
1732
+ const Ce = /* @__PURE__ */ Symbol("NEEDLE_mesh_lod"), ae = /* @__PURE__ */ Symbol("NEEDLE_texture_lod");
1664
1733
  let ye = null;
1665
- function Ue() {
1666
- const i = kt();
1734
+ function Ne() {
1735
+ const i = Vt();
1667
1736
  i && (i.mapURLs(function(t) {
1668
- return Te(), t;
1669
- }), Te(), ye?.disconnect(), ye = new MutationObserver((t) => {
1737
+ return ke(), t;
1738
+ }), ke(), ye?.disconnect(), ye = new MutationObserver((t) => {
1670
1739
  t.forEach((e) => {
1671
1740
  e.addedNodes.forEach((s) => {
1672
- s instanceof HTMLElement && s.tagName.toLowerCase() === "model-viewer" && Fe(s);
1741
+ s instanceof HTMLElement && s.tagName.toLowerCase() === "model-viewer" && Ve(s);
1673
1742
  });
1674
1743
  });
1675
1744
  }), ye.observe(document, { childList: !0, subtree: !0 }));
1676
1745
  }
1677
- function kt() {
1746
+ function Vt() {
1678
1747
  if (typeof customElements > "u") return null;
1679
1748
  const i = customElements.get("model-viewer");
1680
1749
  return i || (customElements.whenDefined("model-viewer").then(() => {
1681
- console.debug("[gltf-progressive] model-viewer defined"), Ue();
1750
+ console.debug("[gltf-progressive] model-viewer defined"), Ne();
1682
1751
  }), null);
1683
1752
  }
1684
- function Te() {
1753
+ function ke() {
1685
1754
  if (typeof document > "u") return;
1686
1755
  document.querySelectorAll("model-viewer").forEach((t) => {
1687
- Fe(t);
1756
+ Ve(t);
1688
1757
  });
1689
1758
  }
1690
- const Ce = /* @__PURE__ */ new WeakSet();
1691
- let Rt = 0;
1692
- function Fe(i) {
1693
- if (!i || Ce.has(i))
1759
+ const Ae = /* @__PURE__ */ new WeakSet();
1760
+ let Xt = 0;
1761
+ function Ve(i) {
1762
+ if (!i || Ae.has(i))
1694
1763
  return null;
1695
- Ce.add(i), console.debug("[gltf-progressive] found new model-viewer..." + ++Rt + `
1764
+ Ae.add(i), console.debug("[gltf-progressive] found new model-viewer..." + ++Xt + `
1696
1765
  `, i.getAttribute("src"));
1697
1766
  let t = null, e = null, s = null;
1698
1767
  for (let r = i; r != null; r = Object.getPrototypeOf(r)) {
@@ -1714,7 +1783,7 @@ function Fe(i) {
1714
1783
  };
1715
1784
  console.debug("[gltf-progressive] setup model-viewer");
1716
1785
  const n = ue.get(t, { engine: "model-viewer" });
1717
- return ue.addPlugin(new At()), n.enable(), n.addEventListener("changed", () => {
1786
+ return ue.addPlugin(new jt()), n.enable(), n.addEventListener("changed", () => {
1718
1787
  s?.call(i);
1719
1788
  }), i.addEventListener("model-visibility", (o) => {
1720
1789
  o.detail.visible && s?.call(i);
@@ -1726,7 +1795,7 @@ function Fe(i) {
1726
1795
  }
1727
1796
  return null;
1728
1797
  }
1729
- class At {
1798
+ class jt {
1730
1799
  _didWarnAboutMissingUrl = !1;
1731
1800
  onBeforeUpdateLOD(t, e, s, r) {
1732
1801
  this.tryParseMeshLOD(e, r), this.tryParseTextureLOD(e, r);
@@ -1753,18 +1822,18 @@ class At {
1753
1822
  l[ae] = !0, l.userData && (l.userData.LOD = -1);
1754
1823
  const u = Object.keys(l);
1755
1824
  for (let c = 0; c < u.length; c++) {
1756
- const d = u[c], f = l[d];
1757
- if (f?.isTexture === !0) {
1758
- const g = f.userData?.associations?.textures;
1759
- if (g == null) continue;
1760
- const O = s.parser.json.textures[g];
1761
- if (!O) {
1762
- console.warn("Texture data not found for texture index " + g);
1825
+ const f = u[c], d = l[f];
1826
+ if (d?.isTexture === !0) {
1827
+ const p = d.userData?.associations?.textures;
1828
+ if (p == null) continue;
1829
+ const b = s.parser.json.textures[p];
1830
+ if (!b) {
1831
+ console.warn("Texture data not found for texture index " + p);
1763
1832
  continue;
1764
1833
  }
1765
- if (O?.extensions?.[U]) {
1766
- const y = O.extensions[U];
1767
- y && n && p.registerTexture(n, f, y.lods.length, g, y);
1834
+ if (b?.extensions?.[F]) {
1835
+ const y = b.extensions[F];
1836
+ y && n && g.registerTexture(n, d, y.lods.length, p, y);
1768
1837
  }
1769
1838
  }
1770
1839
  }
@@ -1775,19 +1844,19 @@ class At {
1775
1844
  }
1776
1845
  }
1777
1846
  tryParseMeshLOD(t, e) {
1778
- if (e[be] == !0) return;
1779
- e[be] = !0;
1847
+ if (e[Ce] == !0) return;
1848
+ e[Ce] = !0;
1780
1849
  const s = this.tryGetCurrentModelViewer(t), r = this.getUrl(s);
1781
1850
  if (!r)
1782
1851
  return;
1783
- const n = e.userData?.gltfExtensions?.[U];
1852
+ const n = e.userData?.gltfExtensions?.[F];
1784
1853
  if (n && r) {
1785
1854
  const o = e.uuid;
1786
- p.registerMesh(r, o, e, 0, n.lods.length, n);
1855
+ g.registerMesh(r, o, e, 0, n.lods.length, n);
1787
1856
  }
1788
1857
  }
1789
1858
  }
1790
- function It(...i) {
1859
+ function Ht(...i) {
1791
1860
  let t, e, s, r;
1792
1861
  switch (i.length) {
1793
1862
  case 2:
@@ -1802,22 +1871,22 @@ function It(...i) {
1802
1871
  default:
1803
1872
  throw new Error("Invalid arguments");
1804
1873
  }
1805
- De(e), Ie(s), Be(s, {
1874
+ _e(e), qe(s), Fe(s, {
1806
1875
  progressive: !0,
1807
1876
  ...r?.hints
1808
- }), s.register((o) => new p(o));
1877
+ }), s.register((o) => new g(o));
1809
1878
  const n = ue.get(e);
1810
1879
  return r?.enableLODsManager !== !1 && n.enable(), n;
1811
1880
  }
1812
- Ue();
1813
- if (!dt) {
1881
+ Ne();
1882
+ if (!_t) {
1814
1883
  const i = {
1815
1884
  gltfProgressive: {
1816
- useNeedleProgressive: It,
1885
+ useNeedleProgressive: Ht,
1817
1886
  LODsManager: ue,
1818
- configureLoader: Be,
1887
+ configureLoader: Fe,
1819
1888
  getRaycastMesh: ne,
1820
- useRaycastMeshes: ht
1889
+ useRaycastMeshes: Ot
1821
1890
  }
1822
1891
  };
1823
1892
  if (!globalThis.Needle)
@@ -1828,13 +1897,13 @@ if (!dt) {
1828
1897
  }
1829
1898
  export {
1830
1899
  ue as LODsManager,
1831
- p as NEEDLE_progressive,
1832
- Ie as addDracoAndKTX2Loaders,
1833
- Tt as calculateMeshLODLevel,
1834
- Be as configureLoader,
1835
- De as createLoaders,
1836
- Pt as getLODColor,
1900
+ g as NEEDLE_progressive,
1901
+ qe as addDracoAndKTX2Loaders,
1902
+ zt as calculateMeshLODLevel,
1903
+ Fe as configureLoader,
1904
+ _e as createLoaders,
1905
+ Nt as getLODColor,
1837
1906
  ne as getRaycastMesh,
1838
- rt as setDracoDecoderLocation,
1839
- nt as setKTX2TranscoderLocation
1907
+ gt as setDracoDecoderLocation,
1908
+ pt as setKTX2TranscoderLocation
1840
1909
  };