@needle-tools/gltf-progressive 2.1.5 → 2.1.6-next.8d7f3c1

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.
@@ -1,14 +1,14 @@
1
1
  var Xe = Object.defineProperty;
2
- var qe = (n, e, t) => e in n ? Xe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var d = (n, e, t) => (qe(n, typeof e != "symbol" ? e + "" : e, t), t), Ae = (n, e, t) => {
4
- if (!e.has(n))
2
+ var qe = (i, e, t) => e in i ? Xe(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var d = (i, e, t) => (qe(i, typeof e != "symbol" ? e + "" : e, t), t), Ae = (i, e, t) => {
4
+ if (!e.has(i))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
7
- var m = (n, e, t) => (Ae(n, e, "read from private field"), t ? t.call(n) : e.get(n)), J = (n, e, t) => {
8
- if (e.has(n))
7
+ var m = (i, e, t) => (Ae(i, e, "read from private field"), t ? t.call(i) : e.get(i)), J = (i, e, t) => {
8
+ if (e.has(i))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- e instanceof WeakSet ? e.add(n) : e.set(n, t);
11
- }, z = (n, e, t, s) => (Ae(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
10
+ e instanceof WeakSet ? e.add(i) : e.set(i, t);
11
+ }, z = (i, e, t, s) => (Ae(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t);
12
12
  import { BufferGeometry as ge, Mesh as j, Texture as re, TextureLoader as Ke, Matrix4 as Pe, Clock as Ye, MeshStandardMaterial as He, Sphere as Je, Box3 as Ee, Vector3 as X } from "three";
13
13
  import { GLTFLoader as Te } from "three/examples/jsm/loaders/GLTFLoader.js";
14
14
  import { MeshoptDecoder as Qe } from "three/examples/jsm/libs/meshopt_decoder.module.js";
@@ -18,65 +18,65 @@ const et = "";
18
18
  globalThis.GLTF_PROGRESSIVE_VERSION = et;
19
19
  console.debug("[gltf-progressive] version -");
20
20
  let V = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", ee = "https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";
21
- const tt = V, st = ee, Ie = new URL(V + "draco_decoder.js");
22
- Ie.searchParams.append("range", "true");
23
- fetch(Ie, {
21
+ const tt = V, st = ee, Re = new URL(V + "draco_decoder.js");
22
+ Re.searchParams.append("range", "true");
23
+ fetch(Re, {
24
24
  method: "GET",
25
25
  headers: {
26
26
  Range: "bytes=0-1"
27
27
  }
28
- }).catch((n) => {
28
+ }).catch((i) => {
29
29
  console.debug(`Failed to fetch remote Draco decoder from ${V} (offline: ${typeof navigator < "u" ? navigator.onLine : "unknown"})`), V === tt && rt("./include/draco/"), ee === st && ot("./include/ktx2/");
30
30
  }).finally(() => {
31
31
  Ge();
32
32
  });
33
- function rt(n) {
34
- V = n, B && B[Oe] != V ? (console.debug("Updating Draco decoder path to " + n), B[Oe] = V, B.setDecoderPath(V), B.preload()) : console.debug("Setting Draco decoder path to " + n);
33
+ function rt(i) {
34
+ V = i, B && B[Oe] != V ? (console.debug("Updating Draco decoder path to " + i), B[Oe] = V, B.setDecoderPath(V), B.preload()) : console.debug("Setting Draco decoder path to " + i);
35
35
  }
36
- function ot(n) {
37
- ee = n, U && U.transcoderPath != ee ? (console.debug("Updating KTX2 transcoder path to " + n), U.setTranscoderPath(ee), U.init()) : console.debug("Setting KTX2 transcoder path to " + n);
36
+ function ot(i) {
37
+ ee = i, U && U.transcoderPath != ee ? (console.debug("Updating KTX2 transcoder path to " + i), U.setTranscoderPath(ee), U.init()) : console.debug("Setting KTX2 transcoder path to " + i);
38
38
  }
39
39
  const Oe = Symbol("dracoDecoderPath");
40
40
  let B, pe, U;
41
41
  function Ge() {
42
42
  B || (B = new Ze(), B[Oe] = V, B.setDecoderPath(V), B.setDecoderConfig({ type: "js" }), B.preload()), U || (U = new je(), U.setTranscoderPath(ee), U.init()), pe || (pe = Qe);
43
43
  }
44
- function $e(n) {
45
- return Ge(), n ? U.detectSupport(n) : n !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: B, ktx2Loader: U, meshoptDecoder: pe };
44
+ function $e(i) {
45
+ return Ge(), i ? U.detectSupport(i) : i !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: B, ktx2Loader: U, meshoptDecoder: pe };
46
46
  }
47
- function Ue(n) {
48
- n.dracoLoader || n.setDRACOLoader(B), n.ktx2Loader || n.setKTX2Loader(U), n.meshoptDecoder || n.setMeshoptDecoder(pe);
47
+ function Ue(i) {
48
+ i.dracoLoader || i.setDRACOLoader(B), i.ktx2Loader || i.setKTX2Loader(U), i.meshoptDecoder || i.setMeshoptDecoder(pe);
49
49
  }
50
50
  const _e = /* @__PURE__ */ new WeakMap();
51
- function Fe(n, e) {
52
- let t = _e.get(n);
53
- t ? t = Object.assign(t, e) : t = e, _e.set(n, t);
51
+ function Fe(i, e) {
52
+ let t = _e.get(i);
53
+ t ? t = Object.assign(t, e) : t = e, _e.set(i, t);
54
54
  }
55
55
  const De = Te.prototype.load;
56
- function it(...n) {
56
+ function nt(...i) {
57
57
  const e = _e.get(this);
58
- let t = n[0];
58
+ let t = i[0];
59
59
  const s = new URL(t, window.location.href);
60
60
  if (s.hostname.endsWith("needle.tools")) {
61
61
  const r = (e == null ? void 0 : e.progressive) !== void 0 ? e.progressive : !0, o = e != null && e.usecase ? e.usecase : "default";
62
62
  r ? this.requestHeader.Accept = `*/*;progressive=allowed;usecase=${o}` : this.requestHeader.Accept = `*/*;usecase=${o}`, t = s.toString();
63
63
  }
64
- return n[0] = t, De == null ? void 0 : De.call(this, ...n);
64
+ return i[0] = t, De == null ? void 0 : De.call(this, ...i);
65
65
  }
66
- Te.prototype.load = it;
66
+ Te.prototype.load = nt;
67
67
  le("debugprogressive");
68
- function le(n) {
68
+ function le(i) {
69
69
  if (typeof window > "u")
70
70
  return !1;
71
- const t = new URL(window.location.href).searchParams.get(n);
71
+ const t = new URL(window.location.href).searchParams.get(i);
72
72
  return t == null || t === "0" || t === "false" ? !1 : t === "" ? !0 : t;
73
73
  }
74
- function nt(n, e) {
75
- if (e === void 0 || e.startsWith("./") || e.startsWith("http") || n === void 0)
74
+ function it(i, e) {
75
+ if (e === void 0 || e.startsWith("./") || e.startsWith("http") || i === void 0)
76
76
  return e;
77
- const t = n.lastIndexOf("/");
77
+ const t = i.lastIndexOf("/");
78
78
  if (t >= 0) {
79
- const s = n.substring(0, t + 1);
79
+ const s = i.substring(0, t + 1);
80
80
  for (; s.endsWith("/") && e.startsWith("/"); )
81
81
  e = e.substring(1);
82
82
  return s + e;
@@ -88,43 +88,43 @@ function at() {
88
88
  return oe !== void 0 || (oe = /iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent), le("debugprogressive") && console.log("[glTF Progressive]: isMobileDevice", oe)), oe;
89
89
  }
90
90
  const lt = typeof window > "u" && typeof document > "u", be = Symbol("needle:raycast-mesh");
91
- function ce(n) {
92
- return (n == null ? void 0 : n[be]) instanceof ge ? n[be] : null;
91
+ function ce(i) {
92
+ return (i == null ? void 0 : i[be]) instanceof ge ? i[be] : null;
93
93
  }
94
- function ct(n, e) {
95
- if ((n.type === "Mesh" || n.type === "SkinnedMesh") && !ce(n)) {
94
+ function ct(i, e) {
95
+ if ((i.type === "Mesh" || i.type === "SkinnedMesh") && !ce(i)) {
96
96
  const s = ft(e);
97
- s.userData = { isRaycastMesh: !0 }, n[be] = s;
97
+ s.userData = { isRaycastMesh: !0 }, i[be] = s;
98
98
  }
99
99
  }
100
- function ut(n = !0) {
101
- if (n) {
102
- if (ie)
100
+ function ut(i = !0) {
101
+ if (i) {
102
+ if (ne)
103
103
  return;
104
- const e = ie = j.prototype.raycast;
104
+ const e = ne = j.prototype.raycast;
105
105
  j.prototype.raycast = function(t, s) {
106
- const i = this, r = ce(i);
106
+ const n = this, r = ce(n);
107
107
  let o;
108
- r && i.isMesh && (o = i.geometry, i.geometry = r), e.call(this, t, s), o && (i.geometry = o);
108
+ r && n.isMesh && (o = n.geometry, n.geometry = r), e.call(this, t, s), o && (n.geometry = o);
109
109
  };
110
110
  } else {
111
- if (!ie)
111
+ if (!ne)
112
112
  return;
113
- j.prototype.raycast = ie, ie = null;
113
+ j.prototype.raycast = ne, ne = null;
114
114
  }
115
115
  }
116
- let ie = null;
117
- function ft(n) {
116
+ let ne = null;
117
+ function ft(i) {
118
118
  const e = new ge();
119
- for (const t in n.attributes)
120
- e.setAttribute(t, n.getAttribute(t));
121
- return e.setIndex(n.getIndex()), e;
119
+ for (const t in i.attributes)
120
+ e.setAttribute(t, i.getAttribute(t));
121
+ return e.setIndex(i.getIndex()), e;
122
122
  }
123
123
  const Z = new Array(), q = "NEEDLE_progressive", L = le("debugprogressive"), Me = Symbol("needle-progressive-texture"), ae = /* @__PURE__ */ new Map(), Se = /* @__PURE__ */ new Set();
124
124
  if (L) {
125
- let n = function() {
126
- e += 1, console.log("Toggle LOD level", e, ae), ae.forEach((i, r) => {
127
- for (const o of i.keys) {
125
+ let i = function() {
126
+ e += 1, console.log("Toggle LOD level", e, ae), ae.forEach((n, r) => {
127
+ for (const o of n.keys) {
128
128
  const a = r[o];
129
129
  if (a != null)
130
130
  if (a.isBufferGeometry === !0) {
@@ -135,19 +135,19 @@ if (L) {
135
135
  }
136
136
  }), e >= t && (e = -1);
137
137
  }, e = -1, t = 2, s = !1;
138
- window.addEventListener("keyup", (i) => {
139
- i.key === "p" && n(), i.key === "w" && (s = !s, Se && Se.forEach((r) => {
138
+ window.addEventListener("keyup", (n) => {
139
+ n.key === "p" && i(), n.key === "w" && (s = !s, Se && Se.forEach((r) => {
140
140
  r.name != "BackgroundCubeMaterial" && r.glyphMap == null && "wireframe" in r && (r.wireframe = s);
141
141
  }));
142
142
  });
143
143
  }
144
- function Ce(n, e, t) {
145
- var i;
144
+ function Ce(i, e, t) {
145
+ var n;
146
146
  if (!L)
147
147
  return;
148
- ae.has(n) || ae.set(n, { keys: [], sourceId: t });
149
- const s = ae.get(n);
150
- ((i = s == null ? void 0 : s.keys) == null ? void 0 : i.includes(e)) == !1 && s.keys.push(e);
148
+ ae.has(i) || ae.set(i, { keys: [], sourceId: t });
149
+ const s = ae.get(i);
150
+ ((n = s == null ? void 0 : s.keys) == null ? void 0 : n.includes(e)) == !1 && s.keys.push(e);
151
151
  }
152
152
  const v = class {
153
153
  constructor(e, t) {
@@ -155,10 +155,10 @@ const v = class {
155
155
  d(this, "url");
156
156
  d(this, "_isLoadingMesh");
157
157
  d(this, "loadMesh", (e) => {
158
- var s, i;
158
+ var s, n;
159
159
  if (this._isLoadingMesh)
160
160
  return null;
161
- const t = (i = (s = this.parser.json.meshes[e]) == null ? void 0 : s.extensions) == null ? void 0 : i[q];
161
+ const t = (n = (s = this.parser.json.meshes[e]) == null ? void 0 : s.extensions) == null ? void 0 : n[q];
162
162
  return t ? (this._isLoadingMesh = !0, this.parser.getDependency("mesh", e).then((r) => {
163
163
  var o;
164
164
  return this._isLoadingMesh = !1, r && v.registerMesh(this.url, t.guid, r, (o = t.lods) == null ? void 0 : o.length, void 0, t), r;
@@ -175,7 +175,7 @@ const v = class {
175
175
  return t != null && t.key ? this.lodInfos.get(t.key) : null;
176
176
  }
177
177
  static getMaterialMinMaxLODsCount(e, t) {
178
- const s = this, i = "LODS:minmax", r = e[i];
178
+ const s = this, n = "LODS:minmax", r = e[n];
179
179
  if (r != null)
180
180
  return r;
181
181
  if (t || (t = {
@@ -185,7 +185,7 @@ const v = class {
185
185
  }), Array.isArray(e)) {
186
186
  for (const a of e)
187
187
  this.getMaterialMinMaxLODsCount(a, t);
188
- return e[i] = t, t;
188
+ return e[n] = t, t;
189
189
  }
190
190
  if (L === "verbose" && console.log("getMaterialMinMaxLODsCount", e), e.type === "ShaderMaterial" || e.type === "RawShaderMaterial") {
191
191
  const a = e;
@@ -198,7 +198,7 @@ const v = class {
198
198
  const l = e[a];
199
199
  (l == null ? void 0 : l.isTexture) === !0 && o(l, t);
200
200
  }
201
- return e[i] = t, t;
201
+ return e[n] = t, t;
202
202
  function o(a, l) {
203
203
  const u = s.getAssignedLODInformation(a);
204
204
  if (u) {
@@ -238,13 +238,13 @@ const v = class {
238
238
  if (o.isMesh === !0 && this.hasLODLevelAvailable(o, t))
239
239
  return !0;
240
240
  }
241
- let s, i;
241
+ let s, n;
242
242
  if (e.isMesh ? s = e.geometry : (e.isBufferGeometry || e.isTexture) && (s = e), s && (r = s == null ? void 0 : s.userData) != null && r.LODS) {
243
243
  const o = s.userData.LODS;
244
- if (i = this.lodInfos.get(o.key), t === void 0)
245
- return i != null;
246
- if (i)
247
- return Array.isArray(i.lods) ? t < i.lods.length : t === 0;
244
+ if (n = this.lodInfos.get(o.key), t === void 0)
245
+ return n != null;
246
+ if (n)
247
+ return Array.isArray(n.lods) ? t < n.lods.length : t === 0;
248
248
  }
249
249
  return !1;
250
250
  }
@@ -267,17 +267,17 @@ const v = class {
267
267
  if (!e)
268
268
  return Promise.resolve(null);
269
269
  if (e instanceof j || e.isMesh === !0) {
270
- const i = e.geometry, r = this.getAssignedLODInformation(i);
270
+ const n = e.geometry, r = this.getAssignedLODInformation(n);
271
271
  if (!r)
272
272
  return Promise.resolve(null);
273
273
  for (const o of Z)
274
274
  (s = o.onBeforeGetLODMesh) == null || s.call(o, e, t);
275
- return e["LOD:requested level"] = t, v.getOrLoadLOD(i, t).then((o) => {
275
+ return e["LOD:requested level"] = t, v.getOrLoadLOD(n, t).then((o) => {
276
276
  if (Array.isArray(o)) {
277
277
  const a = r.index || 0;
278
278
  o = o[a];
279
279
  }
280
- return e["LOD:requested level"] === t && (delete e["LOD:requested level"], o && i != o && ((o == null ? void 0 : o.isBufferGeometry) ? (e.geometry = o, L && Ce(e, "geometry", r.url)) : L && console.error("Invalid LOD geometry", o))), o;
280
+ return e["LOD:requested level"] === t && (delete e["LOD:requested level"], o && n != o && ((o == null ? void 0 : o.isBufferGeometry) ? (e.geometry = o, L && Ce(e, "geometry", r.url)) : L && console.error("Invalid LOD geometry", o))), o;
281
281
  }).catch((o) => (console.error("Error loading mesh LOD", e, o), null));
282
282
  } else
283
283
  L && console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh", e);
@@ -289,12 +289,12 @@ const v = class {
289
289
  if (e.isMesh === !0) {
290
290
  const s = e;
291
291
  if (Array.isArray(s.material)) {
292
- const i = new Array();
292
+ const n = new Array();
293
293
  for (const r of s.material) {
294
294
  const o = this.assignTextureLOD(r, t);
295
- i.push(o);
295
+ n.push(o);
296
296
  }
297
- return Promise.all(i).then((r) => {
297
+ return Promise.all(n).then((r) => {
298
298
  const o = new Array();
299
299
  for (const a of r)
300
300
  Array.isArray(a) && o.push(...a);
@@ -304,14 +304,14 @@ const v = class {
304
304
  return this.assignTextureLOD(s.material, t);
305
305
  }
306
306
  if (e.isMaterial === !0) {
307
- const s = e, i = [], r = new Array();
307
+ const s = e, n = [], r = new Array();
308
308
  if (L && Se.add(s), s.uniforms && (s.isRawShaderMaterial || s.isShaderMaterial === !0)) {
309
309
  const o = s;
310
310
  for (const a of Object.keys(o.uniforms)) {
311
311
  const l = o.uniforms[a].value;
312
312
  if ((l == null ? void 0 : l.isTexture) === !0) {
313
313
  const u = this.assignTextureLODForSlot(l, t, s, a).then((c) => (c && o.uniforms[a].value != c && (o.uniforms[a].value = c, o.uniformsNeedUpdate = !0), c));
314
- i.push(u), r.push(a);
314
+ n.push(u), r.push(a);
315
315
  }
316
316
  }
317
317
  } else
@@ -319,10 +319,10 @@ const v = class {
319
319
  const a = s[o];
320
320
  if ((a == null ? void 0 : a.isTexture) === !0) {
321
321
  const l = this.assignTextureLODForSlot(a, t, s, o);
322
- i.push(l), r.push(o);
322
+ n.push(l), r.push(o);
323
323
  }
324
324
  }
325
- return Promise.all(i).then((o) => {
325
+ return Promise.all(n).then((o) => {
326
326
  const a = new Array();
327
327
  for (let l = 0; l < o.length; l++) {
328
328
  const u = o[l], c = r[l];
@@ -337,24 +337,24 @@ const v = class {
337
337
  }
338
338
  return Promise.resolve(null);
339
339
  }
340
- static assignTextureLODForSlot(e, t, s, i) {
341
- return (e == null ? void 0 : e.isTexture) !== !0 ? Promise.resolve(null) : i === "glyphMap" ? Promise.resolve(e) : v.getOrLoadLOD(e, t).then((r) => {
340
+ static assignTextureLODForSlot(e, t, s, n) {
341
+ return (e == null ? void 0 : e.isTexture) !== !0 ? Promise.resolve(null) : n === "glyphMap" ? Promise.resolve(e) : v.getOrLoadLOD(e, t).then((r) => {
342
342
  if (Array.isArray(r))
343
343
  return null;
344
344
  if ((r == null ? void 0 : r.isTexture) === !0) {
345
345
  if (r != e) {
346
- if (s && i) {
347
- const o = s[i];
346
+ if (s && n) {
347
+ const o = s[n];
348
348
  if (o && !L) {
349
349
  const a = this.getAssignedLODInformation(o);
350
350
  if (a && (a == null ? void 0 : a.level) < t)
351
351
  return L === "verbose" && console.warn("Assigned texture level is already higher: ", a.level, t, s, o, r), null;
352
352
  }
353
- s[i] = r;
353
+ s[n] = r;
354
354
  }
355
- if (L && i && s) {
355
+ if (L && n && s) {
356
356
  const o = this.getAssignedLODInformation(e);
357
- o ? Ce(s, i, o.url) : console.warn("No LOD info for texture", e);
357
+ o ? Ce(s, n, o.url) : console.warn("No LOD info for texture", e);
358
358
  }
359
359
  }
360
360
  return r;
@@ -365,10 +365,10 @@ const v = class {
365
365
  }
366
366
  afterRoot(e) {
367
367
  var t, s;
368
- return L && console.log("AFTER", this.url, e), (t = this.parser.json.textures) == null || t.forEach((i, r) => {
368
+ return L && console.log("AFTER", this.url, e), (t = this.parser.json.textures) == null || t.forEach((n, r) => {
369
369
  var o;
370
- if (i != null && i.extensions) {
371
- const a = i == null ? void 0 : i.extensions[q];
370
+ if (n != null && n.extensions) {
371
+ const a = n == null ? void 0 : n.extensions[q];
372
372
  if (a) {
373
373
  if (!a.lods) {
374
374
  L && console.warn("Texture has no LODs", a);
@@ -386,9 +386,9 @@ const v = class {
386
386
  });
387
387
  }
388
388
  }
389
- }), (s = this.parser.json.meshes) == null || s.forEach((i, r) => {
390
- if (i != null && i.extensions) {
391
- const o = i == null ? void 0 : i.extensions[q];
389
+ }), (s = this.parser.json.meshes) == null || s.forEach((n, r) => {
390
+ if (n != null && n.extensions) {
391
+ const o = n == null ? void 0 : n.extensions[q];
392
392
  if (o && o.lods) {
393
393
  for (const a of this.parser.associations.keys())
394
394
  if (a.isMesh) {
@@ -401,10 +401,10 @@ const v = class {
401
401
  }
402
402
  static async getOrLoadLOD(e, t) {
403
403
  var a, l, u, c;
404
- const s = L == "verbose", i = e.userData.LODS;
405
- if (!i)
404
+ const s = L == "verbose", n = e.userData.LODS;
405
+ if (!n)
406
406
  return null;
407
- const r = i == null ? void 0 : i.key;
407
+ const r = n == null ? void 0 : n.key;
408
408
  let o;
409
409
  if (e.isTexture === !0) {
410
410
  const g = e;
@@ -420,7 +420,7 @@ const v = class {
420
420
  const g = Array.isArray(o.lods) ? (a = o.lods[t]) == null ? void 0 : a.path : o.lods;
421
421
  if (!g)
422
422
  return L && !o["missing:uri"] && (o["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + t, o)), null;
423
- const p = nt(i.url, g);
423
+ const p = it(n.url, g);
424
424
  if (p.endsWith(".glb") || p.endsWith(".gltf")) {
425
425
  if (!o.guid)
426
426
  return console.warn("missing pointer for glb/gltf texture", o), null;
@@ -428,19 +428,19 @@ const v = class {
428
428
  if (w !== void 0) {
429
429
  s && console.log(`LOD ${t} was already loading/loaded: ${M}`);
430
430
  let h = await w.catch((N) => (console.error(`Error loading LOD ${t} from ${p}
431
- `, N), null)), k = !1;
432
- if (h == null || (h instanceof re && e instanceof re ? (l = h.image) != null && l.data || (u = h.source) != null && u.data ? h = this.copySettings(e, h) : (k = !0, this.previouslyLoaded.delete(M)) : h instanceof ge && e instanceof ge && ((c = h.attributes.position) != null && c.array || (k = !0, this.previouslyLoaded.delete(M)))), !k)
431
+ `, N), null)), I = !1;
432
+ if (h == null || (h instanceof re && e instanceof re ? (l = h.image) != null && l.data || (u = h.source) != null && u.data ? h = this.copySettings(e, h) : (I = !0, this.previouslyLoaded.delete(M)) : h instanceof ge && e instanceof ge && ((c = h.attributes.position) != null && c.array || (I = !0, this.previouslyLoaded.delete(M)))), !I)
433
433
  return h;
434
434
  }
435
- const x = o, F = new Promise(async (h, k) => {
435
+ const x = o, F = new Promise(async (h, I) => {
436
436
  const N = new Te();
437
437
  Ue(N), L && (await new Promise((b) => setTimeout(b, 1e3)), s && console.warn("Start loading (delayed) " + p, x.guid));
438
- let I = p;
438
+ let R = p;
439
439
  if (x && Array.isArray(x.lods)) {
440
440
  const b = x.lods[t];
441
- b.hash && (I += "?v=" + b.hash);
441
+ b.hash && (R += "?v=" + b.hash);
442
442
  }
443
- const A = await N.loadAsync(I).catch((b) => (console.error(`Error loading LOD ${t} from ${p}
443
+ const A = await N.loadAsync(R).catch((b) => (console.error(`Error loading LOD ${t} from ${p}
444
444
  `, b), null));
445
445
  if (!A)
446
446
  return null;
@@ -461,7 +461,7 @@ const v = class {
461
461
  }
462
462
  if (b) {
463
463
  let f = await W.getDependency("texture", _);
464
- return f && v.assignLODInformation(i.url, f, r, t, void 0, void 0), s && console.log('change "' + e.name + '" → "' + f.name + '"', p, _, f, M), e instanceof re && (f = this.copySettings(e, f)), f && (f.guid = x.guid), h(f);
464
+ return f && v.assignLODInformation(n.url, f, r, t, void 0, void 0), s && console.log('change "' + e.name + '" → "' + f.name + '"', p, _, f, M), e instanceof re && (f = this.copySettings(e, f)), f && (f.guid = x.guid), h(f);
465
465
  } else
466
466
  L && console.warn("Could not find texture with guid", x.guid, A.parser.json);
467
467
  }
@@ -481,14 +481,14 @@ const v = class {
481
481
  const f = await W.getDependency("mesh", _), y = x;
482
482
  if (s && console.log(`Loaded Mesh "${f.name}"`, p, _, f, M), f.isMesh === !0) {
483
483
  const O = f.geometry;
484
- return v.assignLODInformation(i.url, O, r, t, void 0, y.density), h(O);
484
+ return v.assignLODInformation(n.url, O, r, t, void 0, y.density), h(O);
485
485
  } else {
486
486
  const O = new Array();
487
487
  for (let S = 0; S < f.children.length; S++) {
488
488
  const P = f.children[S];
489
489
  if (P.isMesh === !0) {
490
490
  const H = P.geometry;
491
- v.assignLODInformation(i.url, H, r, t, S, y.density), O.push(H);
491
+ v.assignLODInformation(n.url, H, r, t, S, y.density), O.push(H);
492
492
  }
493
493
  }
494
494
  return h(O);
@@ -508,11 +508,11 @@ const v = class {
508
508
  L && console.warn(`Can not load LOD ${t}: no LOD info found for "${r}" ${e.name}`, e.type);
509
509
  return null;
510
510
  }
511
- static assignLODInformation(e, t, s, i, r, o) {
511
+ static assignLODInformation(e, t, s, n, r, o) {
512
512
  if (!t)
513
513
  return;
514
514
  t.userData || (t.userData = {});
515
- const a = new dt(e, s, i, r, o);
515
+ const a = new dt(e, s, n, r, o);
516
516
  t.userData.LODS = a;
517
517
  }
518
518
  static getAssignedLODInformation(e) {
@@ -530,18 +530,18 @@ let T = v;
530
530
  /**
531
531
  * Register a texture with LOD information
532
532
  */
533
- d(T, "registerTexture", (e, t, s, i, r) => {
534
- if (L && console.log("> Progressive: register texture", i, t.name, t.uuid, t, r), !t) {
533
+ d(T, "registerTexture", (e, t, s, n, r) => {
534
+ if (L && console.log("> Progressive: register texture", n, t.name, t.uuid, t, r), !t) {
535
535
  L && console.error("gltf-progressive: Register texture without texture");
536
536
  return;
537
537
  }
538
538
  t.source && (t.source[Me] = r);
539
539
  const o = r.guid;
540
- v.assignLODInformation(e, t, o, s, i, void 0), v.lodInfos.set(o, r), v.lowresCache.set(o, t);
540
+ v.assignLODInformation(e, t, o, s, n, void 0), v.lodInfos.set(o, r), v.lowresCache.set(o, t);
541
541
  }), /**
542
542
  * Register a mesh with LOD information
543
543
  */
544
- d(T, "registerMesh", (e, t, s, i, r, o) => {
544
+ d(T, "registerMesh", (e, t, s, n, r, o) => {
545
545
  var u;
546
546
  L && console.log("> Progressive: register mesh", r, s.name, o, s.uuid, s);
547
547
  const a = s.geometry;
@@ -549,9 +549,9 @@ d(T, "registerMesh", (e, t, s, i, r, o) => {
549
549
  L && console.warn("gltf-progressive: Register mesh without geometry");
550
550
  return;
551
551
  }
552
- a.userData || (a.userData = {}), v.assignLODInformation(e, a, t, i, r, o.density), v.lodInfos.set(t, o);
552
+ a.userData || (a.userData = {}), v.assignLODInformation(e, a, t, n, r, o.density), v.lodInfos.set(t, o);
553
553
  let l = v.lowresCache.get(t);
554
- l ? l.push(s.geometry) : l = [s.geometry], v.lowresCache.set(t, l), i > 0 && !ce(s) && ct(s, a);
554
+ l ? l.push(s.geometry) : l = [s.geometry], v.lowresCache.set(t, l), n > 0 && !ce(s) && ct(s, a);
555
555
  for (const c of Z)
556
556
  (u = c.onRegisteredNewMesh) == null || u.call(c, s, o);
557
557
  }), /** A map of key = asset uuid and value = LOD information */
@@ -559,7 +559,7 @@ d(T, "lodInfos", /* @__PURE__ */ new Map()), /** cache of already loaded mesh lo
559
559
  d(T, "previouslyLoaded", /* @__PURE__ */ new Map()), /** this contains the geometry/textures that were originally loaded */
560
560
  d(T, "lowresCache", /* @__PURE__ */ new Map());
561
561
  class dt {
562
- constructor(e, t, s, i, r) {
562
+ constructor(e, t, s, n, r) {
563
563
  d(this, "url");
564
564
  /** the key to lookup the LOD information */
565
565
  d(this, "key");
@@ -568,7 +568,7 @@ class dt {
568
568
  d(this, "index");
569
569
  /** the mesh density */
570
570
  d(this, "density");
571
- this.url = e, this.key = t, this.level = s, i != null && (this.index = i), r != null && (this.density = r);
571
+ this.url = e, this.key = t, this.level = s, n != null && (this.index = n), r != null && (this.density = r);
572
572
  }
573
573
  }
574
574
  const G = le("debugprogressive"), ht = le("noprogressive"), we = Symbol("Needle:LODSManager"), ve = Symbol("Needle:LODState"), Q = Symbol("Needle:CurrentLOD"), $ = { mesh_lod: -1, texture_lod: -1 };
@@ -584,6 +584,12 @@ const E = class {
584
584
  * @default 200_000
585
585
  */
586
586
  d(this, "targetTriangleDensity", 2e5);
587
+ /**
588
+ * The interval in frames to automatically update the bounds of skinned meshes.
589
+ * Set to 0 or a negative value to disable automatic bounds updates.
590
+ * @default 30
591
+ */
592
+ d(this, "skinnedMeshAutoUpdateBoundsInterval", 30);
587
593
  /**
588
594
  * The update interval in frames. If set to 0, the LODs will be updated every frame. If set to 2, the LODs will be updated every second frame, etc.
589
595
  * @default "auto"
@@ -667,11 +673,11 @@ const E = class {
667
673
  let e = 0;
668
674
  z(this, K, this.renderer.render);
669
675
  const t = this;
670
- $e(this.renderer), this.renderer.render = function(s, i) {
676
+ $e(this.renderer), this.renderer.render = function(s, n) {
671
677
  const r = t.renderer.getRenderTarget();
672
678
  (r == null || "isXRRenderTarget" in r && r.isXRRenderTarget) && (e = 0, z(t, te, m(t, te) + 1), z(t, se, m(t, ye).getDelta()), z(t, me, m(t, me) + m(t, se)), t._fpsBuffer.shift(), t._fpsBuffer.push(1 / m(t, se)), z(t, Y, t._fpsBuffer.reduce((a, l) => a + l) / t._fpsBuffer.length), G && m(t, te) % 200 === 0 && console.log("FPS", Math.round(m(t, Y)), "Interval:", m(t, C)));
673
679
  const o = e++;
674
- m(t, K).call(this, s, i), t.onAfterRender(s, i, o);
680
+ m(t, K).call(this, s, n), t.onAfterRender(s, n, o);
675
681
  };
676
682
  }
677
683
  disable() {
@@ -700,10 +706,10 @@ const E = class {
700
706
  */
701
707
  internalUpdate(e, t) {
702
708
  var l, u;
703
- const s = this.renderer.renderLists.get(e, 0), i = s.opaque;
709
+ const s = this.renderer.renderLists.get(e, 0), n = s.opaque;
704
710
  this.projectionScreenMatrix.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse);
705
711
  const r = this.targetTriangleDensity;
706
- for (const c of i) {
712
+ for (const c of n) {
707
713
  if (c.material && (((l = c.geometry) == null ? void 0 : l.type) === "BoxGeometry" || ((u = c.geometry) == null ? void 0 : u.type) === "BufferGeometry") && (c.material.name === "SphericalGaussianBlur" || c.material.name == "BackgroundCubeMaterial" || c.material.name === "CubemapFromEquirect" || c.material.name === "EquirectangularToCubeUV")) {
708
714
  G && (c.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"] || (c.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"] = !0, console.warn("Ignoring skybox or BLIT object", c, c.material.name, c.material.type)));
709
715
  continue;
@@ -737,7 +743,7 @@ const E = class {
737
743
  }
738
744
  }
739
745
  /** Update the LOD levels for the renderer. */
740
- updateLODs(e, t, s, i) {
746
+ updateLODs(e, t, s, n) {
741
747
  var a, l;
742
748
  s.userData || (s.userData = {});
743
749
  let r = s[ve];
@@ -745,7 +751,7 @@ const E = class {
745
751
  return;
746
752
  for (const u of Z)
747
753
  (a = u.onBeforeUpdateLOD) == null || a.call(u, this.renderer, e, t, s);
748
- this.calculateLodLevel(t, s, r, i, $), $.mesh_lod = Math.round($.mesh_lod), $.texture_lod = Math.round($.texture_lod), $.mesh_lod >= 0 && this.loadProgressiveMeshes(s, $.mesh_lod);
754
+ this.calculateLodLevel(t, s, r, n, $), $.mesh_lod = Math.round($.mesh_lod), $.texture_lod = Math.round($.texture_lod), $.mesh_lod >= 0 && this.loadProgressiveMeshes(s, $.mesh_lod);
749
755
  let o = $.texture_lod;
750
756
  s.material && o >= 0 && this.loadProgressiveTextures(s.material, o);
751
757
  for (const u of Z)
@@ -767,8 +773,8 @@ const E = class {
767
773
  }
768
774
  let s = !1;
769
775
  (e[Q] === void 0 || t < e[Q]) && (s = !0);
770
- const i = e["DEBUG:LOD"];
771
- i != null && (s = e[Q] != i, t = i), s && (e[Q] = t, T.assignTextureLOD(e, t).then((r) => {
776
+ const n = e["DEBUG:LOD"];
777
+ n != null && (s = e[Q] != n, t = n), s && (e[Q] = t, T.assignTextureLOD(e, t).then((r) => {
772
778
  this._lodchangedlisteners.forEach((o) => o({ type: "texture", level: t, object: e }));
773
779
  }));
774
780
  }
@@ -782,8 +788,8 @@ const E = class {
782
788
  if (!e)
783
789
  return Promise.resolve(null);
784
790
  let s = e[Q] !== t;
785
- const i = e["DEBUG:LOD"];
786
- if (i != null && (s = e[Q] != i, t = i), s) {
791
+ const n = e["DEBUG:LOD"];
792
+ if (n != null && (s = e[Q] != n, t = n), s) {
787
793
  e[Q] = t;
788
794
  const r = e.geometry;
789
795
  return T.assignMeshLOD(e, t).then((o) => (o && e[Q] == t && r != e.geometry && this._lodchangedlisteners.forEach((a) => a({ type: "mesh", level: t, object: e })), o));
@@ -791,10 +797,10 @@ const E = class {
791
797
  return Promise.resolve(null);
792
798
  }
793
799
  static isInside(e, t) {
794
- const s = e.min, i = e.max, r = (s.x + i.x) * 0.5, o = (s.y + i.y) * 0.5;
800
+ const s = e.min, n = e.max, r = (s.x + n.x) * 0.5, o = (s.y + n.y) * 0.5;
795
801
  return this._tempPtInside.set(r, o, s.z).applyMatrix4(t).z < 0;
796
802
  }
797
- calculateLodLevel(e, t, s, i, r) {
803
+ calculateLodLevel(e, t, s, n, r) {
798
804
  var F;
799
805
  if (!t) {
800
806
  r.mesh_lod = -1, r.texture_lod = -1;
@@ -819,9 +825,9 @@ const E = class {
819
825
  const D = t;
820
826
  if (!D.boundingBox)
821
827
  D.computeBoundingBox();
822
- else if (s.frames % 30 === 0) {
823
- const h = ce(D), k = D.geometry;
824
- h && (D.geometry = h), D.computeBoundingBox(), D.geometry = k;
828
+ else if (this.skinnedMeshAutoUpdateBoundsInterval > 0 && s.frames % this.skinnedMeshAutoUpdateBoundsInterval === 0) {
829
+ const h = ce(D), I = D.geometry;
830
+ h && (D.geometry = h), D.computeBoundingBox(), D.geometry = I;
825
831
  }
826
832
  x = D.boundingBox;
827
833
  }
@@ -850,10 +856,10 @@ const E = class {
850
856
  s.lastCentrality = 1;
851
857
  const h = this._tempBox.getSize(this._tempBoxSize);
852
858
  h.multiplyScalar(0.5), screen.availHeight > 0 && w > 0 && h.multiplyScalar(w / screen.availHeight), e.isPerspectiveCamera ? h.x *= e.aspect : e.isOrthographicCamera;
853
- const k = e.matrixWorldInverse, N = this._tempBox2;
854
- N.copy(x), N.applyMatrix4(t.matrixWorld), N.applyMatrix4(k);
855
- const I = N.getSize(this._tempBox2Size), A = Math.max(I.x, I.y);
856
- if (Math.max(h.x, h.y) != 0 && A != 0 && (h.z = I.z / Math.max(I.x, I.y) * Math.max(h.x, h.y)), s.lastScreenCoverage = Math.max(h.x, h.y, h.z), s.lastScreenspaceVolume.copy(h), s.lastScreenCoverage *= s.lastCentrality, G && E.debugDrawLine) {
859
+ const I = e.matrixWorldInverse, N = this._tempBox2;
860
+ N.copy(x), N.applyMatrix4(t.matrixWorld), N.applyMatrix4(I);
861
+ const R = N.getSize(this._tempBox2Size), A = Math.max(R.x, R.y);
862
+ if (Math.max(h.x, h.y) != 0 && A != 0 && (h.z = R.z / Math.max(R.x, R.y) * Math.max(h.x, h.y)), s.lastScreenCoverage = Math.max(h.x, h.y, h.z), s.lastScreenspaceVolume.copy(h), s.lastScreenCoverage *= s.lastCentrality, G && E.debugDrawLine) {
857
863
  const f = this.tempMatrix.copy(this.projectionScreenMatrix);
858
864
  f.invert();
859
865
  const y = E.corner0, O = E.corner1, S = E.corner2, P = E.corner3;
@@ -864,7 +870,7 @@ const E = class {
864
870
  let _ = 999;
865
871
  if (c && s.lastScreenCoverage > 0) {
866
872
  for (let f = 0; f < c.length; f++)
867
- if (c[f].density / s.lastScreenCoverage < i) {
873
+ if (c[f].density / s.lastScreenCoverage < n) {
868
874
  _ = f;
869
875
  break;
870
876
  }
@@ -884,17 +890,17 @@ const E = class {
884
890
  }
885
891
  } else {
886
892
  const h = s.lastScreenspaceVolume.x + s.lastScreenspaceVolume.y + s.lastScreenspaceVolume.z;
887
- let k = s.lastScreenCoverage * 4;
888
- ((F = this.context) == null ? void 0 : F.engine) === "model-viewer" && (k *= 1.5);
889
- const I = w / window.devicePixelRatio * k;
893
+ let I = s.lastScreenCoverage * 4;
894
+ ((F = this.context) == null ? void 0 : F.engine) === "model-viewer" && (I *= 1.5);
895
+ const R = w / window.devicePixelRatio * I;
890
896
  let A = !1;
891
897
  for (let W = p.lods.length - 1; W >= 0; W--) {
892
- let _ = p.lods[W];
893
- if (!(D && _.max_height >= 2048) && !(at() && _.max_height > 4096) && (_.max_height > I || !A && W === 0)) {
898
+ const _ = p.lods[W];
899
+ if (!(D && _.max_height >= 2048) && !(at() && _.max_height > 4096) && (_.max_height > R || !A && W === 0)) {
894
900
  if (A = !0, r.texture_lod = W, r.texture_lod < s.lastLodLevel_Texture) {
895
901
  const b = _.max_height;
896
902
  G && console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${r.texture_lod} = ${b}px
897
- Screensize: ${I.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${h.toFixed(1)}
903
+ Screensize: ${R.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${h.toFixed(1)}
898
904
  ${t.name}`);
899
905
  }
900
906
  break;
@@ -905,10 +911,10 @@ ${t.name}`);
905
911
  r.texture_lod = 0;
906
912
  }
907
913
  };
908
- let R = E;
914
+ let k = E;
909
915
  C = new WeakMap(), K = new WeakMap(), ye = new WeakMap(), te = new WeakMap(), se = new WeakMap(), me = new WeakMap(), Y = new WeakMap(), /** 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.
910
916
  */
911
- d(R, "debugDrawLine"), d(R, "corner0", new X()), d(R, "corner1", new X()), d(R, "corner2", new X()), d(R, "corner3", new X()), d(R, "_tempPtInside", new X());
917
+ d(k, "debugDrawLine"), d(k, "corner0", new X()), d(k, "corner1", new X()), d(k, "corner2", new X()), d(k, "corner3", new X()), d(k, "_tempPtInside", new X());
912
918
  class gt {
913
919
  constructor() {
914
920
  d(this, "frames", 0);
@@ -920,66 +926,66 @@ class gt {
920
926
  }
921
927
  }
922
928
  const Be = Symbol("NEEDLE_mesh_lod"), he = Symbol("NEEDLE_texture_lod");
923
- let ne = null;
929
+ let ie = null;
924
930
  function Ne() {
925
- const n = pt();
926
- n && (n.mapURLs(function(e) {
927
- return Re(), e;
928
- }), Re(), ne == null || ne.disconnect(), ne = new MutationObserver((e) => {
931
+ const i = pt();
932
+ i && (i.mapURLs(function(e) {
933
+ return ke(), e;
934
+ }), ke(), ie == null || ie.disconnect(), ie = new MutationObserver((e) => {
929
935
  e.forEach((t) => {
930
936
  t.addedNodes.forEach((s) => {
931
937
  s instanceof HTMLElement && s.tagName.toLowerCase() === "model-viewer" && ze(s);
932
938
  });
933
939
  });
934
- }), ne.observe(document, { childList: !0, subtree: !0 }));
940
+ }), ie.observe(document, { childList: !0, subtree: !0 }));
935
941
  }
936
942
  function pt() {
937
943
  if (typeof customElements > "u")
938
944
  return null;
939
- const n = customElements.get("model-viewer");
940
- return n || (customElements.whenDefined("model-viewer").then(() => {
945
+ const i = customElements.get("model-viewer");
946
+ return i || (customElements.whenDefined("model-viewer").then(() => {
941
947
  console.debug("[gltf-progressive] model-viewer defined"), Ne();
942
948
  }), null);
943
949
  }
944
- function Re() {
950
+ function ke() {
945
951
  if (typeof document > "u")
946
952
  return;
947
953
  document.querySelectorAll("model-viewer").forEach((e) => {
948
954
  ze(e);
949
955
  });
950
956
  }
951
- const ke = /* @__PURE__ */ new WeakSet();
957
+ const Ie = /* @__PURE__ */ new WeakSet();
952
958
  let yt = 0;
953
- function ze(n) {
954
- if (!n || ke.has(n))
959
+ function ze(i) {
960
+ if (!i || Ie.has(i))
955
961
  return null;
956
- ke.add(n), console.debug("[gltf-progressive] found new model-viewer..." + ++yt + `
957
- `, n.getAttribute("src"));
962
+ Ie.add(i), console.debug("[gltf-progressive] found new model-viewer..." + ++yt + `
963
+ `, i.getAttribute("src"));
958
964
  let e = null, t = null, s = null;
959
- for (let i = n; i != null; i = Object.getPrototypeOf(i)) {
960
- const r = Object.getOwnPropertySymbols(i), o = r.find((u) => u.toString() == "Symbol(renderer)"), a = r.find((u) => u.toString() == "Symbol(scene)"), l = r.find((u) => u.toString() == "Symbol(needsRender)");
961
- !e && o != null && (e = n[o].threeRenderer), !t && a != null && (t = n[a]), !s && l != null && (s = n[l]);
965
+ for (let n = i; n != null; n = Object.getPrototypeOf(n)) {
966
+ const r = Object.getOwnPropertySymbols(n), o = r.find((u) => u.toString() == "Symbol(renderer)"), a = r.find((u) => u.toString() == "Symbol(scene)"), l = r.find((u) => u.toString() == "Symbol(needsRender)");
967
+ !e && o != null && (e = i[o].threeRenderer), !t && a != null && (t = i[a]), !s && l != null && (s = i[l]);
962
968
  }
963
969
  if (e && t) {
964
- let i = function() {
970
+ let n = function() {
965
971
  if (s) {
966
972
  let o = 0, a = setInterval(() => {
967
973
  if (o++ > 5) {
968
974
  clearInterval(a);
969
975
  return;
970
976
  }
971
- s == null || s.call(n);
977
+ s == null || s.call(i);
972
978
  }, 300);
973
979
  }
974
980
  };
975
981
  console.debug("[gltf-progressive] setup model-viewer");
976
- const r = R.get(e, { engine: "model-viewer" });
977
- return R.addPlugin(new mt()), r.enable(), r.addEventListener("changed", () => {
978
- s == null || s.call(n);
979
- }), n.addEventListener("model-visibility", (o) => {
980
- o.detail.visible && (s == null || s.call(n));
981
- }), n.addEventListener("load", () => {
982
- i();
982
+ const r = k.get(e, { engine: "model-viewer" });
983
+ return k.addPlugin(new mt()), r.enable(), r.addEventListener("changed", () => {
984
+ s == null || s.call(i);
985
+ }), i.addEventListener("model-visibility", (o) => {
986
+ o.detail.visible && (s == null || s.call(i));
987
+ }), i.addEventListener("load", () => {
988
+ n();
983
989
  }), () => {
984
990
  r.disable();
985
991
  };
@@ -990,8 +996,8 @@ class mt {
990
996
  constructor() {
991
997
  d(this, "_didWarnAboutMissingUrl", !1);
992
998
  }
993
- onBeforeUpdateLOD(e, t, s, i) {
994
- this.tryParseMeshLOD(t, i), this.tryParseTextureLOD(t, i);
999
+ onBeforeUpdateLOD(e, t, s, n) {
1000
+ this.tryParseMeshLOD(t, n), this.tryParseTextureLOD(t, n);
995
1001
  }
996
1002
  getUrl(e) {
997
1003
  if (!e)
@@ -1009,7 +1015,7 @@ class mt {
1009
1015
  if (t[he] == !0)
1010
1016
  return;
1011
1017
  t[he] = !0;
1012
- const s = this.tryGetCurrentGLTF(e), i = this.tryGetCurrentModelViewer(e), r = this.getUrl(i);
1018
+ const s = this.tryGetCurrentGLTF(e), n = this.tryGetCurrentModelViewer(e), r = this.getUrl(n);
1013
1019
  if (r && s && t.material) {
1014
1020
  let o = function(l) {
1015
1021
  var c, g, p;
@@ -1048,44 +1054,44 @@ class mt {
1048
1054
  if (t[Be] == !0)
1049
1055
  return;
1050
1056
  t[Be] = !0;
1051
- const s = this.tryGetCurrentModelViewer(e), i = this.getUrl(s);
1052
- if (!i)
1057
+ const s = this.tryGetCurrentModelViewer(e), n = this.getUrl(s);
1058
+ if (!n)
1053
1059
  return;
1054
1060
  const r = (a = (o = t.userData) == null ? void 0 : o.gltfExtensions) == null ? void 0 : a[q];
1055
- if (r && i) {
1061
+ if (r && n) {
1056
1062
  const l = t.uuid;
1057
- T.registerMesh(i, l, t, 0, r.lods.length, r);
1063
+ T.registerMesh(n, l, t, 0, r.lods.length, r);
1058
1064
  }
1059
1065
  }
1060
1066
  }
1061
- function Lt(n, e, t, s) {
1067
+ function Lt(i, e, t, s) {
1062
1068
  $e(e), Ue(t), Fe(t, {
1063
1069
  progressive: !0,
1064
1070
  ...s == null ? void 0 : s.hints
1065
- }), t.register((r) => new T(r, n));
1066
- const i = R.get(e);
1067
- return (s == null ? void 0 : s.enableLODsManager) !== !1 && i.enable(), i;
1071
+ }), t.register((r) => new T(r, i));
1072
+ const n = k.get(e);
1073
+ return (s == null ? void 0 : s.enableLODsManager) !== !1 && n.enable(), n;
1068
1074
  }
1069
1075
  Ne();
1070
1076
  if (!lt) {
1071
- const n = {
1077
+ const i = {
1072
1078
  gltfProgressive: {
1073
1079
  useNeedleProgressive: Lt,
1074
- LODsManager: R,
1080
+ LODsManager: k,
1075
1081
  configureLoader: Fe,
1076
1082
  getRaycastMesh: ce,
1077
1083
  useRaycastMeshes: ut
1078
1084
  }
1079
1085
  };
1080
1086
  if (!globalThis.Needle)
1081
- globalThis.Needle = n;
1087
+ globalThis.Needle = i;
1082
1088
  else
1083
- for (const e in n)
1084
- globalThis.Needle[e] = n[e];
1089
+ for (const e in i)
1090
+ globalThis.Needle[e] = i[e];
1085
1091
  }
1086
1092
  export {
1087
1093
  q as EXTENSION_NAME,
1088
- R as LODsManager,
1094
+ k as LODsManager,
1089
1095
  T as NEEDLE_progressive,
1090
1096
  et as VERSION,
1091
1097
  Ue as addDracoAndKTX2Loaders,