@needle-tools/engine 6.0.0-alpha.6 → 6.0.0-alpha.7

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 (81) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/gltf-progressive-CRdzVlSY.umd.cjs +10 -0
  3. package/dist/gltf-progressive-OBdIERAY.min.js +10 -0
  4. package/dist/{gltf-progressive-B7lOWdLe.js → gltf-progressive-ZuAsp3FE.js} +237 -231
  5. package/dist/{materialx-x1m4IJd1.min.js → materialx-Bd0NThHa.min.js} +1 -1
  6. package/dist/{materialx-CzRx9AGf.umd.cjs → materialx-Clep-Dc8.umd.cjs} +2 -2
  7. package/dist/{materialx-Bd9BE6LR.js → materialx-m9EM4lhZ.js} +1 -1
  8. package/dist/{needle-engine.bundle-D6mZl1dR.min.js → needle-engine.bundle-B2_-yVCX.min.js} +148 -148
  9. package/dist/{needle-engine.bundle-DOHf03pR.umd.cjs → needle-engine.bundle-BOs3iHUC.umd.cjs} +147 -147
  10. package/dist/{needle-engine.bundle-Hu7ZAxEI.js → needle-engine.bundle-hBHg3HuX.js} +7015 -6941
  11. package/dist/needle-engine.d.ts +41 -20
  12. package/dist/needle-engine.js +335 -334
  13. package/dist/needle-engine.min.js +1 -1
  14. package/dist/needle-engine.umd.cjs +1 -1
  15. package/dist/{vendor-CDN1hirK.umd.cjs → vendor-Bb_SUKxZ.umd.cjs} +92 -92
  16. package/dist/{vendor-T07c_9f_.min.js → vendor-D1vc0sOe.min.js} +100 -100
  17. package/dist/{vendor-BatPc34p.js → vendor-ipoLrKAE.js} +3461 -3324
  18. package/lib/engine/api.d.ts +2 -1
  19. package/lib/engine/api.js +2 -1
  20. package/lib/engine/api.js.map +1 -1
  21. package/lib/engine/engine_context.d.ts +2 -0
  22. package/lib/engine/engine_context.js +14 -0
  23. package/lib/engine/engine_context.js.map +1 -1
  24. package/lib/engine/engine_init.js +2 -2
  25. package/lib/engine/engine_init.js.map +1 -1
  26. package/lib/engine/engine_license.d.ts +7 -7
  27. package/lib/engine/engine_license.js +73 -73
  28. package/lib/engine/engine_license.js.map +1 -1
  29. package/lib/engine/engine_loaders.gltf.d.ts +3 -1
  30. package/lib/engine/engine_loaders.gltf.js +6 -1
  31. package/lib/engine/engine_loaders.gltf.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_physics.d.ts +2 -0
  35. package/lib/engine/engine_physics.js +23 -1
  36. package/lib/engine/engine_physics.js.map +1 -1
  37. package/lib/engine/engine_utils_qrcode.js +2 -2
  38. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  39. package/lib/engine/project-document/engine_document_extensions.d.ts +16 -0
  40. package/lib/engine/project-document/engine_document_extensions.js +29 -0
  41. package/lib/engine/project-document/engine_document_extensions.js.map +1 -0
  42. package/lib/engine/project-document/engine_document_runtime.js +1 -1
  43. package/lib/engine/project-document/engine_document_runtime.js.map +1 -1
  44. package/lib/engine/project-document/engine_project_document.js +39 -3
  45. package/lib/engine/project-document/engine_project_document.js.map +1 -1
  46. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  47. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  48. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  49. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  50. package/lib/engine/webcomponents/needle-engine.js +2 -2
  51. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  52. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  53. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  54. package/lib/engine/xr/TempXRContext.js +2 -2
  55. package/lib/engine/xr/TempXRContext.js.map +1 -1
  56. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  57. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  58. package/package.json +3 -3
  59. package/plugins/common/license.js +4 -4
  60. package/plugins/vite/build-pipeline.js +6 -1
  61. package/plugins/vite/license.js +4 -4
  62. package/plugins/vite/logger.client.js +21 -8
  63. package/src/engine/api.ts +2 -1
  64. package/src/engine/engine_context.ts +11 -0
  65. package/src/engine/engine_init.ts +2 -2
  66. package/src/engine/engine_license.ts +70 -70
  67. package/src/engine/engine_loaders.gltf.ts +8 -2
  68. package/src/engine/engine_networking_blob.ts +3 -3
  69. package/src/engine/engine_physics.ts +22 -1
  70. package/src/engine/engine_utils_qrcode.ts +2 -2
  71. package/src/engine/project-document/engine_document_extensions.ts +39 -0
  72. package/src/engine/project-document/engine_document_runtime.ts +1 -1
  73. package/src/engine/project-document/engine_project_document.ts +46 -3
  74. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  75. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  76. package/src/engine/webcomponents/needle-engine.loading.ts +2 -2
  77. package/src/engine/webcomponents/needle-engine.ts +2 -2
  78. package/src/engine/xr/TempXRContext.ts +2 -2
  79. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  80. package/dist/gltf-progressive-BpT9M5Mt.umd.cjs +0 -10
  81. package/dist/gltf-progressive-D0rzvhNG.min.js +0 -10
@@ -1,62 +1,68 @@
1
- import { RedFormat as Xe, RedIntegerFormat as je, RGFormat as He, RGIntegerFormat as Ke, RGBFormat as Ye, RGBAFormat as Qe, RGBAIntegerFormat as Je, BufferGeometry as K, Mesh as Y, Box3 as de, Vector3 as A, Sphere as $e, CompressedTexture as Ze, Texture as q, Matrix3 as et, InterleavedBuffer as tt, InterleavedBufferAttribute as st, BufferAttribute as rt, TextureLoader as nt, Matrix4 as Ge, THREE as it, Color as Be } from "./three-core.js";
2
- import { DRACOLoader as ot, KTX2Loader as at, MeshoptDecoder as lt, GLTFLoader as _e } from "./three-examples.js";
3
- const ut = "";
4
- globalThis.GLTF_PROGRESSIVE_VERSION = ut;
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 K, Mesh as Y, Box3 as de, Vector3 as A, Sphere as Be, CompressedTexture as et, Texture as q, Matrix3 as tt, InterleavedBuffer as st, InterleavedBufferAttribute as rt, BufferAttribute as nt, TextureLoader as it, Matrix4 as qe, THREE as ot, Color as We } from "./three-core.js";
2
+ import { DRACOLoader as at, KTX2Loader as lt, MeshoptDecoder as ut, GLTFLoader as _e } from "./three-examples.js";
3
+ const ct = "";
4
+ globalThis.GLTF_PROGRESSIVE_VERSION = ct;
5
5
  console.debug("[gltf-progressive] version -");
6
- let G = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", Q = "https://cdn.needle.tools/static/three/0.179.1/basis2/";
7
- const ct = G, ft = Q;
6
+ let B = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", Q = "https://cdn.needle.tools/static/three/0.179.1/basis2/";
7
+ const dt = B, ft = Q;
8
8
  if (typeof window < "u") {
9
- const i = new URL(G + "draco_decoder.js");
9
+ const i = new URL(B + "draco_decoder.js");
10
10
  i.searchParams.append("range", "true"), fetch(i, {
11
11
  method: "GET",
12
12
  headers: {
13
13
  Range: "bytes=0-1"
14
14
  }
15
15
  }).catch((t) => {
16
- console.debug(`Failed to fetch remote Draco decoder from ${G} (offline: ${navigator.onLine})`), G === ct && ht("./include/draco/"), Q === ft && gt("./include/ktx2/");
16
+ console.debug(`Failed to fetch remote Draco decoder from ${B} (offline: ${navigator.onLine})`), B === dt && gt("./include/draco/"), Q === ft && pt("./include/ktx2/");
17
17
  }).finally(() => {
18
- We();
18
+ be && Te();
19
19
  });
20
20
  }
21
- const dt = () => ({
22
- dracoDecoderPath: G,
21
+ const ht = () => ({
22
+ dracoDecoderPath: B,
23
23
  ktx2TranscoderPath: Q
24
24
  });
25
- function ht(i) {
26
- G = i, k && k[Le] != G ? (console.debug("Updating Draco decoder path to " + i), k[Le] = G, k.setDecoderPath(G), k.preload()) : console.debug("Setting Draco decoder path to " + i);
27
- }
28
25
  function gt(i) {
29
- Q = i, B && B.transcoderPath != Q ? (console.debug("Updating KTX2 transcoder path to " + i), B.setTranscoderPath(Q), B.init()) : console.debug("Setting KTX2 transcoder path to " + i);
26
+ B = i, P && P[Le] != B ? (console.debug("Updating Draco decoder path to " + i), P[Le] = B, P.setDecoderPath(B), P.preload()) : console.debug("Setting Draco decoder path to " + i);
27
+ }
28
+ function pt(i) {
29
+ Q = i, G && G.transcoderPath != Q ? (console.debug("Updating KTX2 transcoder path to " + i), G.setTranscoderPath(Q), G.init()) : console.debug("Setting KTX2 transcoder path to " + i);
30
30
  }
31
- function be(i) {
32
- return We(), i ? B.detectSupport(i) : i !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: k, ktx2Loader: B, meshoptDecoder: ce };
31
+ function Oe(i) {
32
+ be = !0;
33
+ const t = Te();
34
+ return i ? t.ktx2Loader.detectSupport(i) : i !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), t;
33
35
  }
34
- function qe(i) {
35
- i.dracoLoader || i.setDRACOLoader(k), i.ktx2Loader || i.setKTX2Loader(B), i.meshoptDecoder || i.setMeshoptDecoder(ce);
36
+ function Qt() {
37
+ be = !1, P?.dispose(), G?.dispose(), P = void 0, G = void 0;
38
+ }
39
+ function Fe(i) {
40
+ const { dracoLoader: t, ktx2Loader: e, meshoptDecoder: s } = Te();
41
+ i.dracoLoader || i.setDRACOLoader(t), i.ktx2Loader || i.setKTX2Loader(e), i.meshoptDecoder || i.setMeshoptDecoder(s);
36
42
  }
37
43
  const Le = /* @__PURE__ */ Symbol("dracoDecoderPath");
38
- let k, ce, B;
39
- function We() {
40
- k || (k = new ot(), k[Le] = G, k.setDecoderPath(G), k.preload()), B || (B = new at(), B.setTranscoderPath(Q), B.init()), ce || (ce = lt);
44
+ let be = !0, P, fe, G;
45
+ function Te() {
46
+ return P || (P = new at(), P[Le] = B, P.setDecoderPath(B), P.preload()), G || (G = new lt(), G.setTranscoderPath(Q), G.init()), fe || (fe = ut), { dracoLoader: P, ktx2Loader: G, meshoptDecoder: fe };
41
47
  }
42
48
  const we = /* @__PURE__ */ new WeakMap();
43
- function Fe(i, t) {
49
+ function Ue(i, t) {
44
50
  let e = we.get(i);
45
51
  e ? e = Object.assign(e, t) : e = t, we.set(i, e);
46
52
  }
47
- const pt = _e.prototype.load;
48
- function mt(...i) {
53
+ const mt = _e.prototype.load;
54
+ function yt(...i) {
49
55
  const t = we.get(this);
50
56
  let e = i[0];
51
- const s = yt(e);
57
+ const s = xt(e);
52
58
  if (s?.hostname.endsWith("needle.tools")) {
53
59
  const n = t?.progressive !== void 0 ? t.progressive : !0, o = t?.usecase ? t.usecase : "default";
54
60
  n ? this.requestHeader.Accept = `*/*;progressive=allowed;usecase=${o}` : this.requestHeader.Accept = `*/*;usecase=${o}`, e = s.toString();
55
61
  }
56
- return i[0] = e, pt?.call(this, ...i);
62
+ return i[0] = e, mt?.call(this, ...i);
57
63
  }
58
- _e.prototype.load = mt;
59
- function yt(i) {
64
+ _e.prototype.load = yt;
65
+ function xt(i) {
60
66
  try {
61
67
  if (i instanceof URL)
62
68
  return i;
@@ -66,19 +72,19 @@ function yt(i) {
66
72
  return null;
67
73
  }
68
74
  }
69
- function Se(i) {
75
+ function Pe(i) {
70
76
  return i != null && i.data != null;
71
77
  }
72
78
  function ve(i) {
73
79
  const t = i.source?.data;
74
80
  return t != null && typeof t == "object" ? t : null;
75
81
  }
76
- function xt(i) {
82
+ function Lt(i) {
77
83
  const t = i.image;
78
84
  return t != null && typeof t == "object" ? t : null;
79
85
  }
80
86
  function De(i) {
81
- const t = xt(i), e = ve(i);
87
+ const t = Lt(i), e = ve(i);
82
88
  return {
83
89
  width: t?.width || e?.width || 0,
84
90
  height: t?.height || e?.height || 0
@@ -91,7 +97,7 @@ function V(i) {
91
97
  const s = new URL(t).searchParams.get(i);
92
98
  return s == null || s === "0" || s === "false" ? !1 : s === "" ? !0 : s;
93
99
  }
94
- function Lt(i, t) {
100
+ function wt(i, t) {
95
101
  if (t === void 0 || i === void 0 || t.startsWith("./") || t.startsWith("http") || t.startsWith("data:") || t.startsWith("blob:"))
96
102
  return t;
97
103
  const e = i.lastIndexOf("/");
@@ -102,21 +108,21 @@ function Lt(i, t) {
102
108
  }
103
109
  return t;
104
110
  }
105
- function Oe() {
111
+ function Se() {
106
112
  if (se !== void 0) return se;
107
113
  const i = globalThis.navigator?.userAgent || "";
108
114
  return se = /iPhone|iPad|iPod|Android|IEMobile/i.test(i), V("debugprogressive") && console.log("[glTF Progressive]: isMobileDevice", se), se;
109
115
  }
110
116
  let se;
111
- function Ue() {
117
+ function ze() {
112
118
  const i = globalThis.location?.href;
113
119
  if (!i) return !1;
114
120
  const t = new URL(i), e = t.hostname === "localhost" || /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t.hostname);
115
121
  return t.hostname === "127.0.0.1" || e;
116
122
  }
117
- class wt {
123
+ class vt {
118
124
  constructor(t, e = {}) {
119
- this.maxConcurrent = t, this.debug = e.debug ?? !1, typeof globalThis.requestAnimationFrame == "function" ? globalThis.requestAnimationFrame(this.tick) : setTimeout(this.tick, 0);
125
+ this.maxConcurrent = t, this.debug = e.debug ?? !1, setTimeout(this.tick, 0);
120
126
  }
121
127
  maxConcurrent;
122
128
  _running = /* @__PURE__ */ new Map();
@@ -149,25 +155,25 @@ class wt {
149
155
  }
150
156
  }
151
157
  }
152
- function vt(i) {
153
- 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 = Dt(i);
158
+ function Dt(i) {
159
+ 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);
154
160
  return e * s * r * o * (1 - Math.pow(0.25, n)) / (1 - 0.25);
155
161
  }
156
- function Dt(i) {
162
+ function Mt(i) {
157
163
  let t = 4;
158
164
  const e = i.format;
159
- e === Xe || e === je ? t = 1 : e === He || e === Ke ? t = 2 : e === Ye || e === 1029 ? t = 3 : (e === Qe || e === Je) && (t = 4);
165
+ e === je || e === He ? t = 1 : e === Ke || e === Ye ? t = 2 : e === Qe || e === 1029 ? t = 3 : (e === Je || e === Ze) && (t = 4);
160
166
  let s = 1;
161
167
  const r = i.type;
162
168
  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;
163
169
  }
164
- const Mt = typeof window > "u" && typeof document > "u", Me = /* @__PURE__ */ Symbol("needle:raycast-mesh");
170
+ const _t = typeof window > "u" && typeof document > "u", Me = /* @__PURE__ */ Symbol("needle:raycast-mesh");
165
171
  function ae(i) {
166
172
  return i?.[Me] instanceof K ? i[Me] : null;
167
173
  }
168
- function _t(i, t) {
174
+ function Ot(i, t) {
169
175
  if ((i.type === "Mesh" || i.type === "SkinnedMesh") && !ae(i)) {
170
- const s = Ot(t);
176
+ const s = Tt(t);
171
177
  s.userData = { isRaycastMesh: !0 }, i[Me] = s;
172
178
  }
173
179
  }
@@ -186,7 +192,7 @@ function bt(i = !0) {
186
192
  }
187
193
  }
188
194
  let re = null;
189
- function Ot(i) {
195
+ function Tt(i) {
190
196
  const t = new K();
191
197
  for (const e in i.attributes)
192
198
  t.setAttribute(e, i.getAttribute(e));
@@ -205,27 +211,27 @@ if (g && typeof window < "u") {
205
211
  !isNaN(s) && s >= 0 && (j = s, console.log(`Set LOD level to [${j}]`));
206
212
  });
207
213
  }
208
- function ze(i) {
214
+ function Ee(i) {
209
215
  if (g && oe !== void 0)
210
216
  if (Array.isArray(i))
211
217
  for (const t of i)
212
- ze(t);
218
+ Ee(t);
213
219
  else i && "wireframe" in i && (i.wireframe = oe === !0);
214
220
  }
215
221
  const ne = new Array();
216
- let Tt = 0;
217
- const St = Oe() ? 2 : 10;
218
- function Rt(i) {
219
- if (ne.length < St) {
222
+ let St = 0;
223
+ const Rt = Se() ? 2 : 10;
224
+ function Pt(i) {
225
+ if (ne.length < Rt) {
220
226
  const s = ne.length;
221
227
  g && console.warn(`[Worker] Creating new worker #${s}`);
222
- const r = Te.createWorker(i || {});
228
+ const r = Re.createWorker(i || {});
223
229
  return ne.push(r), r;
224
230
  }
225
- const t = Tt++ % ne.length;
231
+ const t = St++ % ne.length;
226
232
  return ne[t];
227
233
  }
228
- class Te {
234
+ class Re {
229
235
  constructor(t, e) {
230
236
  this.worker = t, this._debug = e.debug ?? !1, t.onmessage = (s) => {
231
237
  const r = s.data;
@@ -233,7 +239,7 @@ class Te {
233
239
  case "loaded-gltf":
234
240
  for (const n of this._running)
235
241
  if (n.url === r.result.url) {
236
- Pt(r.result), n.resolve(r.result);
242
+ Ct(r.result), n.resolve(r.result);
237
243
  const o = n.url;
238
244
  o.startsWith("blob:") && URL.revokeObjectURL(o);
239
245
  }
@@ -249,18 +255,18 @@ class Te {
249
255
  const e = /* new-worker */ new Worker(URL.createObjectURL(new Blob(["import '" + `${new URL('./gltf-progressive.worker-DvoMaVdx.js', import.meta.url).toString()}` + "';"], { type: 'text/javascript' })), {
250
256
  type: "module"
251
257
  });
252
- return new Te(e, t);
258
+ return new Re(e, t);
253
259
  }
254
260
  _running = [];
255
261
  _webglRenderer = null;
256
262
  async load(t, e) {
257
- const s = dt();
263
+ const s = ht();
258
264
  let r = e?.renderer;
259
265
  r || (this._webglRenderer ??= (async () => {
260
- const { WebGLRenderer: u } = await import("./three-core.js").then((d) => d.THREE);
266
+ const { WebGLRenderer: u } = await import("./three-core.js").then((f) => f.THREE);
261
267
  return new u();
262
268
  })(), r = await this._webglRenderer);
263
- const l = be(r).ktx2Loader.workerConfig;
269
+ const l = Oe(r).ktx2Loader.workerConfig;
264
270
  if (t instanceof URL)
265
271
  t = t.toString();
266
272
  else if (t.startsWith("file:"))
@@ -285,7 +291,7 @@ class Te {
285
291
  }
286
292
  _debug = !1;
287
293
  }
288
- function Pt(i) {
294
+ function Ct(i) {
289
295
  for (const t of i.geometries) {
290
296
  const e = t.geometry, s = new K();
291
297
  if (s.name = e.name || "", e.index) {
@@ -309,7 +315,7 @@ function Pt(i) {
309
315
  e.boundingBox?.max.x,
310
316
  e.boundingBox?.max.y,
311
317
  e.boundingBox?.max.z
312
- ), s.boundingSphere = new $e(
318
+ ), s.boundingSphere = new Be(
313
319
  new A(
314
320
  e.boundingSphere?.center.x,
315
321
  e.boundingSphere?.center.y,
@@ -326,7 +332,7 @@ function Pt(i) {
326
332
  let s = null;
327
333
  if (e.isCompressedTexture) {
328
334
  const r = e.mipmaps, { width: n, height: o } = De(e);
329
- s = new Ze(
335
+ s = new et(
330
336
  r,
331
337
  n,
332
338
  o,
@@ -352,7 +358,7 @@ function Pt(i) {
352
358
  e.type,
353
359
  e.anisotropy,
354
360
  e.colorSpace
355
- ), 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 et(...e.matrix.elements);
361
+ ), 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);
356
362
  if (!s) {
357
363
  console.error("[Worker] Failed to create new texture from received data. Texture is not a CompressedTexture or Texture.");
358
364
  continue;
@@ -364,12 +370,12 @@ function Pt(i) {
364
370
  function he(i) {
365
371
  let t = i;
366
372
  if ("isInterleavedBufferAttribute" in i && i.isInterleavedBufferAttribute) {
367
- const e = i.data, s = e.array, r = new tt(s, e.stride);
368
- t = new st(r, i.itemSize, s.byteOffset, i.normalized), t.offset = i.offset;
369
- } else "isBufferAttribute" in i && i.isBufferAttribute && (t = new rt(i.array, i.itemSize, i.normalized), t.usage = i.usage, t.gpuType = i.gpuType, t.updateRanges = i.updateRanges);
373
+ const e = i.data, s = e.array, r = new st(s, e.stride);
374
+ t = new rt(r, i.itemSize, s.byteOffset, i.normalized), t.offset = i.offset;
375
+ } 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);
370
376
  return t;
371
377
  }
372
- const Ct = V("gltf-progressive-worker");
378
+ const kt = V("gltf-progressive-worker");
373
379
  V("gltf-progressive-reduce-mipmaps");
374
380
  const ie = V("gltf-progressive-gc"), ge = /* @__PURE__ */ Symbol("needle-progressive-texture"), U = "NEEDLE_progressive";
375
381
  class p {
@@ -438,12 +444,12 @@ class p {
438
444
  function o(l, a) {
439
445
  const u = s.getAssignedLODInformation(l);
440
446
  if (u) {
441
- const d = s.lodInfos.get(u.key);
442
- if (d && d.lods) {
443
- a.min_count = Math.min(a.min_count, d.lods.length), a.max_count = Math.max(a.max_count, d.lods.length);
444
- for (let c = 0; c < d.lods.length; c++) {
445
- const f = d.lods[c];
446
- f.width && (a.lods[c] = a.lods[c] || { min_height: 1 / 0, max_height: 0 }, a.lods[c].min_height = Math.min(a.lods[c].min_height, f.height), a.lods[c].max_height = Math.max(a.lods[c].max_height, f.height));
447
+ const f = s.lodInfos.get(u.key);
448
+ if (f && f.lods) {
449
+ a.min_count = Math.min(a.min_count, f.lods.length), a.max_count = Math.max(a.max_count, f.lods.length);
450
+ for (let c = 0; c < f.lods.length; c++) {
451
+ const d = f.lods[c];
452
+ d.width && (a.lods[c] = a.lods[c] || { min_height: 1 / 0, max_height: 0 }, a.lods[c].min_height = Math.min(a.lods[c].min_height, d.height), a.lods[c].max_height = Math.max(a.lods[c].max_height, d.height));
447
453
  }
448
454
  }
449
455
  }
@@ -543,9 +549,9 @@ class p {
543
549
  if (this.trackCurrentMaterialTextureSlots(n), n.uniforms && (n.isRawShaderMaterial || n.isShaderMaterial === !0)) {
544
550
  const a = n;
545
551
  for (const u of Object.keys(a.uniforms)) {
546
- const d = a.uniforms[u].value;
547
- if (d?.isTexture === !0) {
548
- const c = this.assignTextureLODForSlot(d, e, n, u, r).then((f) => (f && a.uniforms[u].value != f && (a.uniforms[u].value = f, a.uniformsNeedUpdate = !0), f));
552
+ const f = a.uniforms[u].value;
553
+ if (f?.isTexture === !0) {
554
+ const c = this.assignTextureLODForSlot(f, e, n, u, r).then((d) => (d && a.uniforms[u].value != d && (a.uniforms[u].value = d, a.uniformsNeedUpdate = !0), d));
549
555
  o.push(c), l.push(u);
550
556
  }
551
557
  }
@@ -553,15 +559,15 @@ class p {
553
559
  for (const a of Object.keys(n)) {
554
560
  const u = n[a];
555
561
  if (u?.isTexture === !0) {
556
- const d = this.assignTextureLODForSlot(u, e, n, a, r);
557
- o.push(d), l.push(a);
562
+ const f = this.assignTextureLODForSlot(u, e, n, a, r);
563
+ o.push(f), l.push(a);
558
564
  }
559
565
  }
560
566
  return Promise.all(o).then((a) => {
561
567
  const u = new Array();
562
- for (let d = 0; d < a.length; d++) {
563
- const c = a[d], f = l[d];
564
- c && c.isTexture === !0 ? u.push({ material: n, slot: f, texture: c, level: e }) : u.push({ material: n, slot: f, texture: null, level: e });
568
+ for (let f = 0; f < a.length; f++) {
569
+ const c = a[f], d = l[f];
570
+ c && c.isTexture === !0 ? u.push({ material: n, slot: d, texture: c, level: e }) : u.push({ material: n, slot: d, texture: null, level: e });
565
571
  }
566
572
  return u;
567
573
  });
@@ -596,7 +602,7 @@ class p {
596
602
  if (c && c.level === e && c.force === n)
597
603
  return c.promise;
598
604
  }
599
- const l = s && r ? this.nextTextureSlotRequestId(s, r, e, n) : 0, a = () => !s || !r || this.getLatestTextureSlotRequest(s, r)?.id === l, u = () => a() || this.shouldApplyStaleTextureSlotLOD(s, r, e, n), d = p.getOrLoadLOD(t, e, {
605
+ const l = s && r ? this.nextTextureSlotRequestId(s, r, e, n) : 0, a = () => !s || !r || this.getLatestTextureSlotRequest(s, r)?.id === l, u = () => a() || this.shouldApplyStaleTextureSlotLOD(s, r, e, n), f = p.getOrLoadLOD(t, e, {
600
606
  isCurrent: u
601
607
  }).then((c) => {
602
608
  if (!a() && !this.shouldApplyStaleTextureSlotLOD(s, r, e, n)) return null;
@@ -604,11 +610,11 @@ class p {
604
610
  return console.warn("Progressive: Got an array of textures for a texture slot, this should not happen..."), null;
605
611
  if (c?.isTexture === !0) {
606
612
  if (c != t && s && r) {
607
- const f = this.getMaterialTextureSlot(s, r) ?? t;
608
- if (f && !n) {
609
- const h = this.getAssignedLODInformation(f);
613
+ const d = this.getMaterialTextureSlot(s, r) ?? t;
614
+ if (d && !n) {
615
+ const h = this.getAssignedLODInformation(d);
610
616
  if (h && h?.level < e)
611
- return g === "verbose" && console.warn("Assigned texture level is already higher: ", h.level, e, s, f, c), null;
617
+ return g === "verbose" && console.warn("Assigned texture level is already higher: ", h.level, e, s, d, c), null;
612
618
  }
613
619
  this.assignTrackedTextureSlot(s, r, c);
614
620
  }
@@ -616,7 +622,7 @@ class p {
616
622
  } else g == "verbose" && console.warn("No LOD found for", t, e);
617
623
  return null;
618
624
  }).catch((c) => (console.error("Error loading LOD", t, c), null));
619
- return s && r && this.setPendingTextureSlotRequest(s, r, e, n, l, d), d;
625
+ return s && r && this.setPendingTextureSlotRequest(s, r, e, n, l, f), f;
620
626
  }
621
627
  // Track material slots, not just texture objects. A shared fallback texture can be
622
628
  // referenced by many slots and should only be disposed after every slot moved away.
@@ -805,9 +811,9 @@ class p {
805
811
  }
806
812
  l.userData || (l.userData = {}), g && console.log("> Progressive: register mesh " + s.name, { index: n, uuid: s.uuid }, o, s), p.assignLODInformation(t, l, e, r, n), p.lodInfos.set(e, o);
807
813
  let u = p.lowresCache.get(e)?.deref();
808
- u ? u.push(s.geometry) : u = [s.geometry], p.lowresCache.set(e, new WeakRef(u)), r > 0 && !ae(s) && _t(s, l);
809
- for (const d of F)
810
- d.onRegisteredNewMesh?.(s, o);
814
+ u ? u.push(s.geometry) : u = [s.geometry], p.lowresCache.set(e, new WeakRef(u)), r > 0 && !ae(s) && Ot(s, l);
815
+ for (const f of F)
816
+ f.onRegisteredNewMesh?.(s, o);
811
817
  };
812
818
  /**
813
819
  * Dispose cached resources to free memory.
@@ -905,10 +911,9 @@ ${t}`), e instanceof WeakRef && (e.deref() || (p.cache.delete(t), (g || ie) && c
905
911
  return this.textureRefCounts.delete(e), (g || ie) && n("[gltf-progressive] Memory: Dispose texture", r), t.dispose(), !0;
906
912
  return this.textureRefCounts.set(e, r), g === "verbose" && n("[gltf-progressive] Memory: Untrack texture", r), !1;
907
913
  function n(o, l) {
908
- let { width: a, height: u } = De(t);
909
- const d = a && u ? `${a}x${u}` : "N/A";
914
+ const { width: a, height: u } = De(t), f = a && u ? `${a}x${u}` : "N/A";
910
915
  let c = "N/A";
911
- a && u && (c = `~${(vt(t) / (1024 * 1024)).toFixed(2)} MB`), console.log(`${o} — ${t.name} ${d} (${c}), refCount: ${s} → ${l}
916
+ a && u && (c = `~${(Dt(t) / (1024 * 1024)).toFixed(2)} MB`), console.log(`${o} — ${t.name} ${f} (${c}), refCount: ${s} → ${l}
912
917
  ${e}`);
913
918
  }
914
919
  }
@@ -923,16 +928,16 @@ ${e}`);
923
928
  const l = o?.key;
924
929
  let a;
925
930
  if (t.isTexture === !0) {
926
- const d = t;
927
- d.source && d.source[ge] && (a = d.source[ge]);
931
+ const f = t;
932
+ f.source && f.source[ge] && (a = f.source[ge]);
928
933
  }
929
934
  if (a || (a = p.lodInfos.get(l)), !a)
930
935
  g && console.warn(`Can not load LOD ${e}: no LOD info found for "${l}" ${t.name}`, t.type, p.lodInfos);
931
936
  else {
932
937
  if (e > 0) {
933
- let f = !1;
938
+ let d = !1;
934
939
  const h = Array.isArray(a.lods);
935
- if (h && e >= a.lods.length ? f = !0 : h || (f = !0), f) {
940
+ if (h && e >= a.lods.length ? d = !0 : h || (d = !0), d) {
936
941
  const D = this.lowresCache.get(l);
937
942
  if (D) {
938
943
  const L = D.deref();
@@ -942,14 +947,14 @@ ${e}`);
942
947
  return null;
943
948
  }
944
949
  }
945
- const d = Array.isArray(a.lods) ? a.lods[e]?.path : a.lods;
946
- if (!d)
950
+ const f = Array.isArray(a.lods) ? a.lods[e]?.path : a.lods;
951
+ if (!f)
947
952
  return g && !a["missing:uri"] && (a["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + e, a)), null;
948
- const c = Lt(o.url, d);
953
+ const c = wt(o.url, f);
949
954
  if (c.endsWith(".glb") || c.endsWith(".gltf")) {
950
955
  if (!a.guid)
951
956
  return console.warn("missing pointer for glb/gltf texture", a), null;
952
- const f = c + "_" + a.guid, h = await this.tryResolveLODCacheEntry(this.cache.get(f), f, c, t, e, n);
957
+ const d = c + "_" + a.guid, h = await this.tryResolveLODCacheEntry(this.cache.get(d), d, c, t, e, n);
953
958
  if (r !== this.cacheGeneration) return null;
954
959
  if (h.found) return h.value;
955
960
  if (s?.isCurrent?.() === !1)
@@ -958,20 +963,20 @@ ${e}`);
958
963
  if (r !== this.cacheGeneration) return null;
959
964
  if (s?.isCurrent?.() === !1)
960
965
  return n && console.log(`Skipping stale LOD ${e} request after queue: ${c}`), null;
961
- const L = await this.tryResolveLODCacheEntry(this.cache.get(f), f, c, t, e, n);
966
+ const L = await this.tryResolveLODCacheEntry(this.cache.get(d), d, c, t, e, n);
962
967
  if (r !== this.cacheGeneration) return null;
963
968
  if (L.found) return L.value;
964
- const x = this.cache.get(f);
969
+ const x = this.cache.get(d);
965
970
  if (x !== void 0) {
966
- const y = await this.tryResolveLODCacheEntry(x, f, c, t, e, n);
971
+ const y = await this.tryResolveLODCacheEntry(x, d, c, t, e, n);
967
972
  if (r !== this.cacheGeneration) return null;
968
973
  if (y.found) return y.value;
969
974
  }
970
975
  if (!D.use)
971
976
  return g && console.log(`LOD ${e} was aborted: ${c}`), null;
972
977
  const w = a, M = new Promise(async (y, T) => {
973
- if (Ct) {
974
- const m = await (await Rt({})).load(c);
978
+ if (kt) {
979
+ const m = await (await Pt({})).load(c);
975
980
  if (m.textures.length > 0)
976
981
  for (const v of m.textures) {
977
982
  let S = v.texture;
@@ -988,51 +993,51 @@ ${e}`);
988
993
  return y(null);
989
994
  }
990
995
  const I = new _e();
991
- qe(I), g && (await new Promise((b) => setTimeout(b, 1e3)), n && console.warn("Start loading (delayed) " + c, w.guid));
992
- let P = c;
996
+ Fe(I), g && (await new Promise((O) => setTimeout(O, 1e3)), n && console.warn("Start loading (delayed) " + c, w.guid));
997
+ let C = c;
993
998
  if (w && Array.isArray(w.lods)) {
994
- const b = w.lods[e];
995
- b.hash && (P += "?v=" + b.hash);
999
+ const O = w.lods[e];
1000
+ O.hash && (C += "?v=" + O.hash);
996
1001
  }
997
- const _ = await I.loadAsync(P).catch((b) => (console.error(`Error loading LOD ${e} from ${c}
998
- `, b), y(null)));
1002
+ const _ = await I.loadAsync(C).catch((O) => (console.error(`Error loading LOD ${e} from ${c}
1003
+ `, O), y(null)));
999
1004
  if (!_)
1000
1005
  return y(null);
1001
1006
  const z = _.parser;
1002
1007
  n && console.log("Loading finished " + c, w.guid);
1003
- let C = 0;
1008
+ let k = 0;
1004
1009
  if (_.parser.json.textures) {
1005
- let b = !1;
1010
+ let O = !1;
1006
1011
  for (const m of _.parser.json.textures) {
1007
1012
  if (m?.extensions) {
1008
1013
  const v = m?.extensions[U];
1009
1014
  if (v?.guid && v.guid === w.guid) {
1010
- b = !0;
1015
+ O = !0;
1011
1016
  break;
1012
1017
  }
1013
1018
  }
1014
- C++;
1019
+ k++;
1015
1020
  }
1016
- if (b) {
1017
- let m = await z.getDependency("texture", C);
1018
- return m && p.assignLODInformation(o.url, m, l, e, void 0), n && console.log('change "' + t.name + '" → "' + m.name + '"', c, C, m, f), t instanceof q && (m = this.copySettings(t, m)), m && (m.guid = w.guid), y(m);
1021
+ if (O) {
1022
+ let m = await z.getDependency("texture", k);
1023
+ return m && p.assignLODInformation(o.url, m, l, e, void 0), n && console.log('change "' + t.name + '" → "' + m.name + '"', c, k, m, d), t instanceof q && (m = this.copySettings(t, m)), m && (m.guid = w.guid), y(m);
1019
1024
  } else g && console.warn("Could not find texture with guid", w.guid, _.parser.json);
1020
1025
  }
1021
- if (C = 0, _.parser.json.meshes) {
1022
- let b = !1;
1026
+ if (k = 0, _.parser.json.meshes) {
1027
+ let O = !1;
1023
1028
  for (const m of _.parser.json.meshes) {
1024
1029
  if (m?.extensions) {
1025
1030
  const v = m?.extensions[U];
1026
1031
  if (v?.guid && v.guid === w.guid) {
1027
- b = !0;
1032
+ O = !0;
1028
1033
  break;
1029
1034
  }
1030
1035
  }
1031
- C++;
1036
+ k++;
1032
1037
  }
1033
- if (b) {
1034
- const m = await z.getDependency("mesh", C);
1035
- if (n && console.log(`Loaded Mesh "${m.name}"`, c, C, m, f), m.isMesh === !0) {
1038
+ if (O) {
1039
+ const m = await z.getDependency("mesh", k);
1040
+ if (n && console.log(`Loaded Mesh "${m.name}"`, c, k, m, d), m.isMesh === !0) {
1036
1041
  const v = m.geometry;
1037
1042
  return p.assignLODInformation(o.url, v, l, e, 0), y(v);
1038
1043
  } else {
@@ -1050,14 +1055,14 @@ ${e}`);
1050
1055
  }
1051
1056
  return y(null);
1052
1057
  });
1053
- this.cache.set(f, M), D.use(M);
1054
- const O = await M;
1055
- return r !== this.cacheGeneration || this.cache.get(f) !== M ? null : (O != null ? O instanceof q ? (this.cache.set(f, new WeakRef(O)), p._resourceRegistry.register(O, f)) : Array.isArray(O) ? this.cache.set(f, Promise.resolve(O)) : this.cache.set(f, Promise.resolve(O)) : this.cache.set(f, Promise.resolve(null)), O);
1058
+ this.cache.set(d, M), D.use(M);
1059
+ const b = await M;
1060
+ return r !== this.cacheGeneration || this.cache.get(d) !== M ? null : (b != null ? b instanceof q ? (this.cache.set(d, new WeakRef(b)), p._resourceRegistry.register(b, d)) : Array.isArray(b) ? this.cache.set(d, Promise.resolve(b)) : this.cache.set(d, Promise.resolve(b)) : this.cache.set(d, Promise.resolve(null)), b);
1056
1061
  } else if (t instanceof q) {
1057
1062
  if (s?.isCurrent?.() === !1)
1058
1063
  return n && console.log(`Skipping stale texture LOD ${e} request: ${c}`), null;
1059
1064
  n && console.log("Load texture from uri: " + c);
1060
- const h = await new nt().loadAsync(c);
1065
+ const h = await new it().loadAsync(c);
1061
1066
  return r !== this.cacheGeneration || s?.isCurrent?.() === !1 ? (h?.dispose(), null) : (h ? (h.guid = a.guid, h.flipY = !1, h.needsUpdate = !0, h.colorSpace = t.colorSpace, n && console.log(a, h)) : g && console.warn("failed loading", c), h);
1062
1067
  }
1063
1068
  }
@@ -1069,9 +1074,9 @@ ${e}`);
1069
1074
  if (o && console.log(`LOD ${n} was already loading/loaded: ${e}`), t instanceof WeakRef) {
1070
1075
  const u = t.deref();
1071
1076
  if (u) {
1072
- let d = u, c = !1;
1073
- if (d instanceof q && r instanceof q ? Se(d.image) || ve(d) ? d = this.copySettings(r, d) : c = !0 : d instanceof K && r instanceof K && (d.attributes.position?.array || (c = !0)), !c)
1074
- return { found: !0, value: d };
1077
+ let f = u, c = !1;
1078
+ if (f instanceof q && r instanceof q ? Pe(f.image) || ve(f) ? f = this.copySettings(r, f) : c = !0 : f instanceof K && r instanceof K && (f.attributes.position?.array || (c = !0)), !c)
1079
+ return { found: !0, value: f };
1075
1080
  }
1076
1081
  return this.cache.delete(e), g && console.log(`[gltf-progressive] Re-loading GC'd/disposed resource: ${e}`), { found: !1 };
1077
1082
  }
@@ -1079,16 +1084,16 @@ ${e}`);
1079
1084
  `, u), null));
1080
1085
  if (this.disposedRequests.has(t)) return { found: !0, value: null };
1081
1086
  let a = !1;
1082
- return l == null || (l instanceof q && r instanceof q ? Se(l.image) || ve(l) ? l = this.copySettings(r, l) : (a = !0, this.cache.delete(e)) : l instanceof K && r instanceof K && (l.attributes.position?.array || (a = !0, this.cache.delete(e)))), a ? { found: !1 } : { found: !0, value: l };
1087
+ return l == null || (l instanceof q && r instanceof q ? Pe(l.image) || ve(l) ? l = this.copySettings(r, l) : (a = !0, this.cache.delete(e)) : l instanceof K && r instanceof K && (l.attributes.position?.array || (a = !0, this.cache.delete(e)))), a ? { found: !1 } : { found: !0, value: l };
1083
1088
  }
1084
1089
  static _queue;
1085
1090
  static get queue() {
1086
- return this._queue ??= new wt(Oe() ? 20 : 50, { debug: g != !1 });
1091
+ return this._queue ??= new vt(Se() ? 20 : 50, { debug: g != !1 });
1087
1092
  }
1088
1093
  static assignLODInformation(t, e, s, r, n) {
1089
1094
  if (!e) return;
1090
1095
  e.userData || (e.userData = {});
1091
- const o = new kt(t, s, r, n);
1096
+ const o = new At(t, s, r, n);
1092
1097
  e.userData.LODS = o, "source" in e && typeof e.source == "object" && (e.source.LODS = o);
1093
1098
  }
1094
1099
  static getAssignedLODInformation(t) {
@@ -1101,7 +1106,7 @@ ${e}`);
1101
1106
  `, 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;
1102
1107
  }
1103
1108
  }
1104
- class kt {
1109
+ class At {
1105
1110
  url;
1106
1111
  /** the key to lookup the LOD information */
1107
1112
  key;
@@ -1188,7 +1193,7 @@ class le {
1188
1193
  });
1189
1194
  }
1190
1195
  }
1191
- const $ = V("debugprogressive"), At = $ === "colors", It = V("noprogressive"), pe = /* @__PURE__ */ Symbol("Needle:LODSManager"), me = /* @__PURE__ */ Symbol("Needle:LODState"), E = /* @__PURE__ */ Symbol("Needle:CurrentLOD"), Re = it, R = { mesh_lod: -1, texture_lod: -1 }, $t = new Be(), Pe = [
1196
+ const $ = V("debugprogressive"), It = $ === "colors", $t = V("noprogressive"), pe = /* @__PURE__ */ Symbol("Needle:LODSManager"), me = /* @__PURE__ */ Symbol("Needle:LODState"), E = /* @__PURE__ */ Symbol("Needle:CurrentLOD"), Ce = ot, R = { mesh_lod: -1, texture_lod: -1 }, Gt = new We(), ke = [
1192
1197
  3526751,
1193
1198
  11065402,
1194
1199
  15978811,
@@ -1222,16 +1227,16 @@ const $ = V("debugprogressive"), At = $ === "colors", It = V("noprogressive"), p
1222
1227
  5083278,
1223
1228
  5592405
1224
1229
  ];
1225
- function Gt() {
1226
- const i = Re.Timer || Re.Clock;
1230
+ function Bt() {
1231
+ const i = Ce.Timer || Ce.Clock;
1227
1232
  return new i();
1228
1233
  }
1229
- const ye = new de(), N = new de(), Ce = new de(), Bt = new A(), qt = new A(), Wt = new Ge(), W = new A(), Z = new A(), ee = new A(), te = new A();
1230
- function Ft(i, t) {
1234
+ const ye = new de(), N = new de(), Ae = new de(), qt = new A(), Wt = new A(), Ft = new qe(), W = new A(), Z = new A(), ee = new A(), te = new A();
1235
+ function Ut(i, t) {
1231
1236
  const e = i.min, s = i.max, r = (e.x + s.x) * 0.5, n = (e.y + s.y) * 0.5;
1232
1237
  return W.set(r, n, e.z).applyMatrix4(t).z < 0;
1233
1238
  }
1234
- function Ut(i) {
1239
+ function zt(i) {
1235
1240
  const {
1236
1241
  geometry: t,
1237
1242
  matrixWorld: e,
@@ -1242,50 +1247,50 @@ function Ut(i) {
1242
1247
  currentLevel: l = -1,
1243
1248
  xrEnabled: a = !1,
1244
1249
  debugDrawLine: u,
1245
- warnMissingPrimitiveDensities: d = !1
1246
- } = i, c = p.getMeshLODExtension(t)?.lods, f = p.getPrimitiveIndex(t), h = i.target ?? {
1250
+ warnMissingPrimitiveDensities: f = !1
1251
+ } = i, c = p.getMeshLODExtension(t)?.lods, d = p.getPrimitiveIndex(t), h = i.target ?? {
1247
1252
  level: l,
1248
- primitiveIndex: f,
1253
+ primitiveIndex: d,
1249
1254
  screenCoverage: 0,
1250
1255
  screenspaceVolume: new A(),
1251
1256
  centrality: 1
1252
1257
  };
1253
- h.level = l, h.primitiveIndex = f, h.screenCoverage = 0, h.screenspaceVolume.set(0, 0, 0), h.centrality = 1;
1258
+ h.level = l, h.primitiveIndex = d, h.screenCoverage = 0, h.screenspaceVolume.set(0, 0, 0), h.centrality = 1;
1254
1259
  let D = i.boundingBox ?? t.boundingBox;
1255
1260
  if (D || (t.computeBoundingBox(), D = t.boundingBox), !D) return h;
1256
- if (ye.copy(D).applyMatrix4(e), s.isPerspectiveCamera && Ft(ye, r))
1261
+ if (ye.copy(D).applyMatrix4(e), s.isPerspectiveCamera && Ut(ye, r))
1257
1262
  return h.level = 0, h.screenCoverage = 1 / 0, h.screenspaceVolume.set(1 / 0, 1 / 0, 1 / 0), h;
1258
1263
  if (N.copy(ye).applyMatrix4(r), a && s.isPerspectiveCamera && s.fov > 70) {
1259
1264
  const y = N.min, T = N.max;
1260
- let I = y.x, P = y.y, _ = T.x, z = T.y;
1261
- const C = 2, b = 1.5, m = (y.x + T.x) * 0.5, v = (y.y + T.y) * 0.5;
1262
- I = (I - m) * C + m, P = (P - v) * C + v, _ = (_ - m) * C + m, z = (z - v) * C + v;
1263
- const S = I < 0 && _ > 0 ? 0 : Math.min(Math.abs(y.x), Math.abs(T.x)), X = P < 0 && z > 0 ? 0 : Math.min(Math.abs(y.y), Math.abs(T.y)), J = Math.max(S, X);
1264
- h.centrality = (b - J) * (b - J) * (b - J);
1265
- }
1266
- const L = N.getSize(Bt);
1267
- L.multiplyScalar(0.5), globalThis.screen?.availHeight > 0 && o > 0 && L.multiplyScalar(o / globalThis.screen.availHeight), s.isPerspectiveCamera && (L.x *= s.aspect), Ce.copy(D).applyMatrix4(e).applyMatrix4(s.matrixWorldInverse);
1268
- const x = Ce.getSize(qt), w = Math.max(L.x, L.y), M = Math.max(x.x, x.y);
1265
+ let I = y.x, C = y.y, _ = T.x, z = T.y;
1266
+ const k = 2, O = 1.5, m = (y.x + T.x) * 0.5, v = (y.y + T.y) * 0.5;
1267
+ I = (I - m) * k + m, C = (C - v) * k + v, _ = (_ - m) * k + m, z = (z - v) * k + v;
1268
+ const S = I < 0 && _ > 0 ? 0 : Math.min(Math.abs(y.x), Math.abs(T.x)), X = C < 0 && z > 0 ? 0 : Math.min(Math.abs(y.y), Math.abs(T.y)), J = Math.max(S, X);
1269
+ h.centrality = (O - J) * (O - J) * (O - J);
1270
+ }
1271
+ const L = N.getSize(qt);
1272
+ L.multiplyScalar(0.5), globalThis.screen?.availHeight > 0 && o > 0 && L.multiplyScalar(o / globalThis.screen.availHeight), s.isPerspectiveCamera && (L.x *= s.aspect), Ae.copy(D).applyMatrix4(e).applyMatrix4(s.matrixWorldInverse);
1273
+ const x = Ae.getSize(Wt), w = Math.max(L.x, L.y), M = Math.max(x.x, x.y);
1269
1274
  w !== 0 && M !== 0 && (L.z = x.z / M * w);
1270
- const O = Math.max(L.x, L.y, L.z) * h.centrality;
1271
- if (h.screenCoverage = O, h.screenspaceVolume.copy(L), O <= 0) return h;
1275
+ const b = Math.max(L.x, L.y, L.z) * h.centrality;
1276
+ if (h.screenCoverage = b, h.screenspaceVolume.copy(L), b <= 0) return h;
1272
1277
  if (u) {
1273
- const y = Wt.copy(r);
1278
+ const y = Ft.copy(r);
1274
1279
  y.invert(), W.copy(N.min), Z.copy(N.max), Z.x = W.x, ee.copy(N.max), ee.y = W.y, te.copy(N.max);
1275
1280
  const T = (W.z + te.z) * 0.5;
1276
1281
  W.z = Z.z = ee.z = te.z = T, W.applyMatrix4(y), Z.applyMatrix4(y), ee.applyMatrix4(y), te.applyMatrix4(y), u(W, Z, 255), u(W, ee, 255), u(Z, te, 255), u(ee, te, 255);
1277
1282
  }
1278
1283
  if (c?.length)
1279
1284
  for (let y = 0; y < c.length; y++) {
1280
- const T = c[y], I = T.densities?.[f] || T.density || 1e-5;
1281
- if (f > 0 && d && Ue() && !T.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.")), I / O < n) {
1285
+ const T = c[y], I = T.densities?.[d] || T.density || 1e-5;
1286
+ if (d > 0 && f && ze() && !T.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.")), I / b < n) {
1282
1287
  h.level = y;
1283
1288
  break;
1284
1289
  }
1285
1290
  }
1286
1291
  return h;
1287
1292
  }
1288
- let fe = class H {
1293
+ let ce = class H {
1289
1294
  /**
1290
1295
  * Assign a function to draw debug lines for the LODs. This function will be called with the start and end position of the line and the color of the line when the `debugprogressive` query parameter is set.
1291
1296
  */
@@ -1321,7 +1326,7 @@ let fe = class H {
1321
1326
  }
1322
1327
  renderer;
1323
1328
  context;
1324
- projectionScreenMatrix = new Ge();
1329
+ projectionScreenMatrix = new qe();
1325
1330
  /** @deprecated use static `LODsManager.addPlugin()` method. This getter will be removed in later versions */
1326
1331
  get plugins() {
1327
1332
  return F;
@@ -1394,7 +1399,7 @@ let fe = class H {
1394
1399
  const r = performance.now();
1395
1400
  return s.ready.finally(() => {
1396
1401
  const n = this._newPromiseGroups.indexOf(s);
1397
- n >= 0 && (this._newPromiseGroups.splice(n, 1), Ue() && performance.measure("LODsManager:awaitLoading", {
1402
+ n >= 0 && (this._newPromiseGroups.splice(n, 1), ze() && performance.measure("LODsManager:awaitLoading", {
1398
1403
  start: r,
1399
1404
  detail: { id: e, name: t?.name, awaited: s.awaitedCount, resolved: s.resolvedCount }
1400
1405
  }));
@@ -1454,7 +1459,7 @@ let fe = class H {
1454
1459
  #n = 0;
1455
1460
  #o = 0;
1456
1461
  #s = 0;
1457
- #i = Gt();
1462
+ #i = Bt();
1458
1463
  _fpsBuffer = [60, 60, 60, 60, 60];
1459
1464
  /**
1460
1465
  * Enable the LODsManager. This will replace the render method of the renderer with a method that updates the LODs.
@@ -1465,7 +1470,7 @@ let fe = class H {
1465
1470
  let t = 0;
1466
1471
  this.#t = this.renderer.render;
1467
1472
  const e = this;
1468
- be(this.renderer), this.renderer.render = function(s, r) {
1473
+ Oe(this.renderer), this.renderer.render = function(s, r) {
1469
1474
  const n = e.renderer.getRenderTarget();
1470
1475
  (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((l, a) => l + a) / e._fpsBuffer.length, $ && e.#r % 200 === 0 && console.log("FPS", Math.round(e.#s), "Interval:", e.#e));
1471
1476
  const o = t++;
@@ -1504,7 +1509,7 @@ let fe = class H {
1504
1509
  (l.name === "EffectMaterial" || l.name === "CopyShader") && (o = !1);
1505
1510
  }
1506
1511
  if ((e.parent && e.parent.type === "CubeCamera" || s >= 1 && e.type === "OrthographicCamera") && (o = !1), o) {
1507
- if (It || (this.updateInterval === "auto" ? this.#s < 40 && this.#e < 10 ? (this.#e += 1, $ && console.warn("↓ Reducing LOD updates", this.#e, this.#s.toFixed(0))) : this.#s >= 60 && this.#e > 1 && (this.#e -= 1, $ && console.warn("↑ Increasing LOD updates", this.#e, this.#s.toFixed(0))) : this.#e = this.updateInterval, this.#e > 0 && this.#r % this.#e != 0))
1512
+ if ($t || (this.updateInterval === "auto" ? this.#s < 40 && this.#e < 10 ? (this.#e += 1, $ && console.warn("↓ Reducing LOD updates", this.#e, this.#s.toFixed(0))) : this.#s >= 60 && this.#e > 1 && (this.#e -= 1, $ && console.warn("↑ Increasing LOD updates", this.#e, this.#s.toFixed(0))) : this.#e = this.updateInterval, this.#e > 0 && this.#r % this.#e != 0))
1508
1513
  return;
1509
1514
  this.internalUpdate(t, e), this._postprocessPromiseGroups();
1510
1515
  }
@@ -1569,12 +1574,12 @@ let fe = class H {
1569
1574
  updateLODs(t, e, s, r) {
1570
1575
  s.userData || (s.userData = {});
1571
1576
  let n = s[me];
1572
- if (n || (n = new zt(), s[me] = n), n.frames++ < 2)
1577
+ if (n || (n = new Et(), s[me] = n), n.frames++ < 2)
1573
1578
  return;
1574
1579
  for (const l of F)
1575
1580
  l.onBeforeUpdateLOD?.(this.renderer, t, e, s);
1576
1581
  const o = this.overrideLodLevel !== void 0 ? this.overrideLodLevel : j;
1577
- 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), g && s.material && !s.isGizmo && ze(s.material), At && s.material && !s.isGizmo && !s.isBatchedMesh && Ee(s.material, R.mesh_lod);
1582
+ 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), g && s.material && !s.isGizmo && Ee(s.material), It && s.material && !s.isGizmo && !s.isBatchedMesh && Ne(s.material, R.mesh_lod);
1578
1583
  for (const l of F)
1579
1584
  l.onAfterUpdatedLOD?.(this.renderer, t, e, s, R);
1580
1585
  n.lastLodLevel_Mesh = R.mesh_lod, n.lastLodLevel_Texture = R.texture_lod;
@@ -1620,7 +1625,7 @@ let fe = class H {
1620
1625
  return Promise.resolve(null);
1621
1626
  }
1622
1627
  // private testIfLODLevelsAreAvailable() {
1623
- _sphere = new $e();
1628
+ _sphere = new Be();
1624
1629
  _tempWorldPosition = new A();
1625
1630
  static skinnedMeshBoundsFrameOffsetCounter = 0;
1626
1631
  static $skinnedMeshBoundsOffset = /* @__PURE__ */ Symbol("gltf-progressive-skinnedMeshBoundsOffset");
@@ -1637,7 +1642,7 @@ let fe = class H {
1637
1642
  let l = 10 + 1, a = !1;
1638
1643
  if ($ && e["DEBUG:LOD"] != null)
1639
1644
  return e["DEBUG:LOD"];
1640
- const u = p.getMeshLODExtension(e.geometry)?.lods, d = p.getPrimitiveIndex(e.geometry), c = u && u.length > 0, f = p.getMaterialMinMaxLODsCount(e.material), h = f.min_count !== 1 / 0 && f.min_count >= 0 && f.max_count >= 0;
1645
+ const u = p.getMeshLODExtension(e.geometry)?.lods, f = p.getPrimitiveIndex(e.geometry), c = u && u.length > 0, d = p.getMaterialMinMaxLODsCount(e.material), h = d.min_count !== 1 / 0 && d.min_count >= 0 && d.max_count >= 0;
1641
1646
  if (!c && !h) {
1642
1647
  n.mesh_lod = 0, n.texture_lod = 0;
1643
1648
  return;
@@ -1656,8 +1661,8 @@ let fe = class H {
1656
1661
  }
1657
1662
  const w = x[H.$skinnedMeshBoundsOffset];
1658
1663
  if ((s.frames + w) % this.skinnedMeshAutoUpdateBoundsInterval === 0) {
1659
- const M = ae(x), O = x.geometry;
1660
- M && (x.geometry = M), x.computeBoundingBox(), x.geometry = O;
1664
+ const M = ae(x), b = x.geometry;
1665
+ M && (x.geometry = M), x.computeBoundingBox(), x.geometry = b;
1661
1666
  }
1662
1667
  }
1663
1668
  L = x.boundingBox;
@@ -1671,7 +1676,7 @@ let fe = class H {
1671
1676
  return;
1672
1677
  }
1673
1678
  }
1674
- const x = Ut({
1679
+ const x = zt({
1675
1680
  geometry: e.geometry,
1676
1681
  matrixWorld: e.matrixWorld,
1677
1682
  camera: t,
@@ -1692,25 +1697,25 @@ let fe = class H {
1692
1697
  }
1693
1698
  if (a ? n.mesh_lod = l : n.mesh_lod = s.lastLodLevel_Mesh, $ && n.mesh_lod != s.lastLodLevel_Mesh) {
1694
1699
  const w = u?.[n.mesh_lod];
1695
- w && console.log(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${n.mesh_lod} (density: ${w.densities?.[d].toFixed(0)}) | ${e.name}`);
1700
+ w && console.log(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${n.mesh_lod} (density: ${w.densities?.[f].toFixed(0)}) | ${e.name}`);
1696
1701
  }
1697
1702
  if (h) {
1698
1703
  const x = "saveData" in globalThis.navigator && globalThis.navigator.saveData === !0;
1699
1704
  if (s.lastLodLevel_Texture < 0) {
1700
- if (n.texture_lod = f.max_count - 1, $) {
1701
- const w = f.lods[f.max_count - 1];
1705
+ if (n.texture_lod = d.max_count - 1, $) {
1706
+ const w = d.lods[d.max_count - 1];
1702
1707
  $ && console.log(`First Texture LOD ${n.texture_lod} (${w.max_height}px) - ${e.name}`);
1703
1708
  }
1704
1709
  } else {
1705
1710
  const w = s.lastScreenspaceVolume.x + s.lastScreenspaceVolume.y + s.lastScreenspaceVolume.z;
1706
1711
  let M = s.lastScreenCoverage * 4;
1707
1712
  this.context?.engine === "model-viewer" && (M *= 1.5);
1708
- const O = this.renderer.getPixelRatio?.() || globalThis.devicePixelRatio || 1, T = D / O * M;
1713
+ const b = this.renderer.getPixelRatio?.() || globalThis.devicePixelRatio || 1, T = D / b * M;
1709
1714
  let I = !1;
1710
- for (let P = f.lods.length - 1; P >= 0; P--) {
1711
- const _ = f.lods[P];
1712
- if (!(x && _.max_height >= 2048) && !(Oe() && _.max_height > 4096) && (_.max_height > T || !I && P === 0)) {
1713
- if (I = !0, n.texture_lod = P, $ && n.texture_lod < s.lastLodLevel_Texture) {
1715
+ for (let C = d.lods.length - 1; C >= 0; C--) {
1716
+ const _ = d.lods[C];
1717
+ if (!(x && _.max_height >= 2048) && !(Se() && _.max_height > 4096) && (_.max_height > T || !I && C === 0)) {
1718
+ if (I = !0, n.texture_lod = C, $ && n.texture_lod < s.lastLodLevel_Texture) {
1714
1719
  const z = _.max_height;
1715
1720
  console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${n.texture_lod} = ${z}px
1716
1721
  Screensize: ${T.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${w.toFixed(1)}
@@ -1724,7 +1729,7 @@ ${e.name}`);
1724
1729
  n.texture_lod = 0;
1725
1730
  }
1726
1731
  };
1727
- class zt {
1732
+ class Et {
1728
1733
  frames = 0;
1729
1734
  lastLodLevel_Mesh = -1;
1730
1735
  lastLodLevel_Texture = -1;
@@ -1732,53 +1737,53 @@ class zt {
1732
1737
  lastScreenspaceVolume = new A();
1733
1738
  lastCentrality = 0;
1734
1739
  }
1735
- function Ee(i, t) {
1740
+ function Ne(i, t) {
1736
1741
  if (!(t < 0)) {
1737
1742
  if (Array.isArray(i)) {
1738
1743
  for (const e of i)
1739
- Ee(e, t);
1744
+ Ne(e, t);
1740
1745
  return;
1741
1746
  }
1742
- "color" in i && i.color instanceof Be && (i.color.copy(Et(t, $t)), i.needsUpdate = !0);
1747
+ "color" in i && i.color instanceof We && (i.color.copy(Nt(t, Gt)), i.needsUpdate = !0);
1743
1748
  }
1744
1749
  }
1745
- function Et(i, t) {
1746
- const e = Math.max(0, Math.min(Pe.length - 1, Math.floor(i)));
1747
- return t.setHex(Pe[e]);
1750
+ function Nt(i, t) {
1751
+ const e = Math.max(0, Math.min(ke.length - 1, Math.floor(i)));
1752
+ return t.setHex(ke[e]);
1748
1753
  }
1749
- const ke = /* @__PURE__ */ Symbol("NEEDLE_mesh_lod"), ue = /* @__PURE__ */ Symbol("NEEDLE_texture_lod");
1754
+ const Ie = /* @__PURE__ */ Symbol("NEEDLE_mesh_lod"), ue = /* @__PURE__ */ Symbol("NEEDLE_texture_lod");
1750
1755
  let xe = null;
1751
- function Ne() {
1752
- const i = Nt();
1756
+ function Ve() {
1757
+ const i = Vt();
1753
1758
  i && (i.mapURLs(function(t) {
1754
- return Ae(), t;
1755
- }), Ae(), xe?.disconnect(), xe = new MutationObserver((t) => {
1759
+ return $e(), t;
1760
+ }), $e(), xe?.disconnect(), xe = new MutationObserver((t) => {
1756
1761
  t.forEach((e) => {
1757
1762
  e.addedNodes.forEach((s) => {
1758
- s instanceof HTMLElement && s.tagName.toLowerCase() === "model-viewer" && Ve(s);
1763
+ s instanceof HTMLElement && s.tagName.toLowerCase() === "model-viewer" && Xe(s);
1759
1764
  });
1760
1765
  });
1761
1766
  }), xe.observe(document, { childList: !0, subtree: !0 }));
1762
1767
  }
1763
- function Nt() {
1768
+ function Vt() {
1764
1769
  if (typeof customElements > "u") return null;
1765
1770
  const i = customElements.get("model-viewer");
1766
1771
  return i || (customElements.whenDefined("model-viewer").then(() => {
1767
- console.debug("[gltf-progressive] model-viewer defined"), Ne();
1772
+ console.debug("[gltf-progressive] model-viewer defined"), Ve();
1768
1773
  }), null);
1769
1774
  }
1770
- function Ae() {
1775
+ function $e() {
1771
1776
  if (typeof document > "u") return;
1772
1777
  document.querySelectorAll("model-viewer").forEach((t) => {
1773
- Ve(t);
1778
+ Xe(t);
1774
1779
  });
1775
1780
  }
1776
- const Ie = /* @__PURE__ */ new WeakSet();
1777
- let Vt = 0;
1778
- function Ve(i) {
1779
- if (!i || Ie.has(i))
1781
+ const Ge = /* @__PURE__ */ new WeakSet();
1782
+ let Xt = 0;
1783
+ function Xe(i) {
1784
+ if (!i || Ge.has(i))
1780
1785
  return null;
1781
- Ie.add(i), console.debug("[gltf-progressive] found new model-viewer..." + ++Vt + `
1786
+ Ge.add(i), console.debug("[gltf-progressive] found new model-viewer..." + ++Xt + `
1782
1787
  `, i.getAttribute("src"));
1783
1788
  let t = null, e = null, s = null;
1784
1789
  for (let r = i; r != null; r = Object.getPrototypeOf(r)) {
@@ -1799,8 +1804,8 @@ function Ve(i) {
1799
1804
  }
1800
1805
  };
1801
1806
  console.debug("[gltf-progressive] setup model-viewer");
1802
- const n = fe.get(t, { engine: "model-viewer" });
1803
- return fe.addPlugin(new Xt()), n.enable(), n.addEventListener("changed", () => {
1807
+ const n = ce.get(t, { engine: "model-viewer" });
1808
+ return ce.addPlugin(new jt()), n.enable(), n.addEventListener("changed", () => {
1804
1809
  s?.call(i);
1805
1810
  }), i.addEventListener("model-visibility", (o) => {
1806
1811
  o.detail.visible && s?.call(i);
@@ -1812,7 +1817,7 @@ function Ve(i) {
1812
1817
  }
1813
1818
  return null;
1814
1819
  }
1815
- class Xt {
1820
+ class jt {
1816
1821
  _didWarnAboutMissingUrl = !1;
1817
1822
  onBeforeUpdateLOD(t, e, s, r) {
1818
1823
  this.tryParseMeshLOD(e, r), this.tryParseTextureLOD(e, r);
@@ -1838,10 +1843,10 @@ class Xt {
1838
1843
  if (a[ue] == !0) return;
1839
1844
  a[ue] = !0, a.userData && (a.userData.LOD = -1);
1840
1845
  const u = Object.keys(a);
1841
- for (let d = 0; d < u.length; d++) {
1842
- const c = u[d], f = a[c];
1843
- if (f?.isTexture === !0) {
1844
- const h = f.userData?.associations?.textures;
1846
+ for (let f = 0; f < u.length; f++) {
1847
+ const c = u[f], d = a[c];
1848
+ if (d?.isTexture === !0) {
1849
+ const h = d.userData?.associations?.textures;
1845
1850
  if (h == null) continue;
1846
1851
  const D = s.parser.json.textures[h];
1847
1852
  if (!D) {
@@ -1850,7 +1855,7 @@ class Xt {
1850
1855
  }
1851
1856
  if (D?.extensions?.[U]) {
1852
1857
  const L = D.extensions[U];
1853
- L && n && p.registerTexture(n, f, L.lods.length, h, L);
1858
+ L && n && p.registerTexture(n, d, L.lods.length, h, L);
1854
1859
  }
1855
1860
  }
1856
1861
  }
@@ -1861,8 +1866,8 @@ class Xt {
1861
1866
  }
1862
1867
  }
1863
1868
  tryParseMeshLOD(t, e) {
1864
- if (e[ke] == !0) return;
1865
- e[ke] = !0;
1869
+ if (e[Ie] == !0) return;
1870
+ e[Ie] = !0;
1866
1871
  const s = this.tryGetCurrentModelViewer(t), r = this.getUrl(s);
1867
1872
  if (!r)
1868
1873
  return;
@@ -1873,7 +1878,7 @@ class Xt {
1873
1878
  }
1874
1879
  }
1875
1880
  }
1876
- function jt(...i) {
1881
+ function Ht(...i) {
1877
1882
  let t, e, s, r;
1878
1883
  switch (i.length) {
1879
1884
  case 2:
@@ -1888,20 +1893,20 @@ function jt(...i) {
1888
1893
  default:
1889
1894
  throw new Error("Invalid arguments");
1890
1895
  }
1891
- be(e), qe(s), Fe(s, {
1896
+ Oe(e), Fe(s), Ue(s, {
1892
1897
  progressive: !0,
1893
1898
  ...r?.hints
1894
1899
  }), s.register((o) => new p(o));
1895
- const n = fe.get(e);
1900
+ const n = ce.get(e);
1896
1901
  return r?.enableLODsManager !== !1 && n.enable(), n;
1897
1902
  }
1898
- Ne();
1899
- if (!Mt) {
1903
+ Ve();
1904
+ if (!_t) {
1900
1905
  const i = {
1901
1906
  gltfProgressive: {
1902
- useNeedleProgressive: jt,
1903
- LODsManager: fe,
1904
- configureLoader: Fe,
1907
+ useNeedleProgressive: Ht,
1908
+ LODsManager: ce,
1909
+ configureLoader: Ue,
1905
1910
  getRaycastMesh: ae,
1906
1911
  useRaycastMeshes: bt
1907
1912
  }
@@ -1913,14 +1918,15 @@ if (!Mt) {
1913
1918
  globalThis.Needle[t] = i[t];
1914
1919
  }
1915
1920
  export {
1916
- fe as LODsManager,
1921
+ ce as LODsManager,
1917
1922
  p as NEEDLE_progressive,
1918
- qe as addDracoAndKTX2Loaders,
1919
- Ut as calculateMeshLODLevel,
1920
- Fe as configureLoader,
1921
- be as createLoaders,
1922
- Et as getLODColor,
1923
+ Fe as addDracoAndKTX2Loaders,
1924
+ zt as calculateMeshLODLevel,
1925
+ Ue as configureLoader,
1926
+ Oe as createLoaders,
1927
+ Qt as disposeLoaders,
1928
+ Nt as getLODColor,
1923
1929
  ae as getRaycastMesh,
1924
- ht as setDracoDecoderLocation,
1925
- gt as setKTX2TranscoderLocation
1930
+ gt as setDracoDecoderLocation,
1931
+ pt as setKTX2TranscoderLocation
1926
1932
  };