@needle-tools/engine 4.1.0-beta.8 → 4.1.0-beta.9

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 (75) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/gltf-progressive.js +148 -150
  3. package/dist/gltf-progressive.light.js +148 -150
  4. package/dist/gltf-progressive.light.min.js +6 -6
  5. package/dist/gltf-progressive.light.umd.cjs +7 -7
  6. package/dist/gltf-progressive.min.js +6 -6
  7. package/dist/gltf-progressive.umd.cjs +7 -7
  8. package/dist/needle-engine.bundle.js +4018 -4003
  9. package/dist/needle-engine.bundle.light.js +4018 -4003
  10. package/dist/needle-engine.bundle.light.min.js +109 -109
  11. package/dist/needle-engine.bundle.light.umd.cjs +115 -115
  12. package/dist/needle-engine.bundle.min.js +109 -109
  13. package/dist/needle-engine.bundle.umd.cjs +109 -109
  14. package/dist/needle-engine.d.ts +4 -0
  15. package/dist/needle-engine.js +2 -2
  16. package/dist/needle-engine.light.d.ts +13 -9
  17. package/dist/needle-engine.light.js +2 -2
  18. package/dist/needle-engine.light.min.js +1 -1
  19. package/dist/needle-engine.min.js +1 -1
  20. package/dist/postprocessing.js +1 -1
  21. package/dist/postprocessing.light.js +1 -1
  22. package/dist/postprocessing.light.min.js +1 -1
  23. package/dist/postprocessing.min.js +1 -1
  24. package/dist/three-examples.js +1 -1
  25. package/dist/three-examples.light.js +1 -1
  26. package/dist/three-examples.light.min.js +1 -1
  27. package/dist/three-examples.min.js +1 -1
  28. package/dist/three-mesh-ui.js +1 -1
  29. package/dist/three-mesh-ui.light.js +1 -1
  30. package/dist/three-mesh-ui.light.min.js +1 -1
  31. package/dist/three-mesh-ui.min.js +1 -1
  32. package/dist/three.js +14 -14
  33. package/dist/three.light.js +14 -14
  34. package/dist/three.light.min.js +1 -1
  35. package/dist/three.min.js +1 -1
  36. package/dist/vendor.js +1 -1
  37. package/dist/vendor.light.js +1 -1
  38. package/dist/vendor.light.min.js +1 -1
  39. package/dist/vendor.min.js +1 -1
  40. package/lib/engine/engine_gameobject.d.ts +0 -12
  41. package/lib/engine/engine_gameobject.js +0 -13
  42. package/lib/engine/engine_gameobject.js.map +1 -1
  43. package/lib/engine/engine_types.d.ts +5 -0
  44. package/lib/engine/engine_types.js +6 -0
  45. package/lib/engine/engine_types.js.map +1 -1
  46. package/lib/engine/export/gltf/Writers.js.map +1 -1
  47. package/lib/engine/export/gltf/index.js +11 -1
  48. package/lib/engine/export/gltf/index.js.map +1 -1
  49. package/lib/engine/export/utils.d.ts +2 -0
  50. package/lib/engine/export/utils.js +8 -0
  51. package/lib/engine/export/utils.js.map +1 -0
  52. package/lib/engine/extensions/NEEDLE_gameobject_data.js +1 -1
  53. package/lib/engine/extensions/NEEDLE_gameobject_data.js.map +1 -1
  54. package/lib/engine/js-extensions/Object3D.d.ts +5 -1
  55. package/lib/engine/js-extensions/Object3D.js.map +1 -1
  56. package/lib/engine-components/Component.d.ts +1 -2
  57. package/lib/engine-components/Component.js +3 -3
  58. package/lib/engine-components/Component.js.map +1 -1
  59. package/lib/engine-components/ContactShadows.d.ts +1 -1
  60. package/lib/engine-components/ContactShadows.js +7 -0
  61. package/lib/engine-components/ContactShadows.js.map +1 -1
  62. package/lib/engine-components/export/gltf/GltfExport.js +23 -4
  63. package/lib/engine-components/export/gltf/GltfExport.js.map +1 -1
  64. package/package.json +2 -2
  65. package/src/engine/engine_gameobject.ts +0 -13
  66. package/src/engine/engine_types.ts +6 -0
  67. package/src/engine/export/gltf/Writers.ts +0 -1
  68. package/src/engine/export/gltf/index.ts +13 -3
  69. package/src/engine/export/index.ts +1 -1
  70. package/src/engine/export/utils.ts +10 -0
  71. package/src/engine/extensions/NEEDLE_gameobject_data.ts +1 -2
  72. package/src/engine/js-extensions/Object3D.ts +6 -1
  73. package/src/engine-components/Component.ts +4 -4
  74. package/src/engine-components/ContactShadows.ts +11 -2
  75. package/src/engine-components/export/gltf/GltfExport.ts +26 -6
@@ -1,35 +1,35 @@
1
- import { B as he, M as H, a as We, T as j, b as ze, V as F, c as Se, S as Ve, d as be, e as qe, C as Ke } from "./three.js";
2
- import { D as Xe, K as Ye, G as Oe, M as He } from "./three-examples.js";
1
+ import { B as he, M as J, T as j, a as We, V as F, b as Se, S as ze, c as be, d as Ve, C as qe } from "./three.js";
2
+ import { D as Ke, K as Xe, G as Oe, M as Ye } from "./three-examples.js";
3
3
  const Pe = "";
4
4
  globalThis.GLTF_PROGRESSIVE_VERSION = Pe;
5
5
  console.debug(`[gltf-progressive] version ${Pe}`);
6
6
  let Z = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", ne = "https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";
7
- const Je = Z, Qe = ne, Ze = new URL(Z + "draco_decoder.js");
8
- fetch(Ze, {
7
+ const He = Z, Je = ne, Qe = new URL(Z + "draco_decoder.js");
8
+ fetch(Qe, {
9
9
  method: "GET",
10
10
  headers: {
11
11
  Range: "bytes=0-1"
12
12
  }
13
13
  }).catch((t) => {
14
- Z === Je && (Z = "./include/draco/"), ne === Qe && (ne = "./include/ktx2/");
14
+ Z === He && (Z = "./include/draco/"), ne === Je && (ne = "./include/ktx2/");
15
15
  }).finally(() => {
16
16
  ke();
17
17
  });
18
- function pt(t) {
18
+ function gt(t) {
19
19
  Z = t;
20
20
  }
21
- function yt(t) {
21
+ function pt(t) {
22
22
  ne = t;
23
23
  }
24
- let X, ge, Y;
24
+ let Y, ge, H;
25
25
  function ke() {
26
- X || (X = new Xe(), X.setDecoderPath(Z), X.setDecoderConfig({ type: "js" }), X.preload()), Y || (Y = new Ye(), Y.setTranscoderPath(ne), Y.init()), ge || (ge = He);
26
+ Y || (Y = new Ke(), Y.setDecoderPath(Z), Y.setDecoderConfig({ type: "js" }), Y.preload()), H || (H = new Xe(), H.setTranscoderPath(ne), H.init()), ge || (ge = Ye);
27
27
  }
28
28
  function Be(t) {
29
- return ke(), t ? Y.detectSupport(t) : t !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: X, ktx2Loader: Y, meshoptDecoder: ge };
29
+ return ke(), t ? H.detectSupport(t) : t !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: Y, ktx2Loader: H, meshoptDecoder: ge };
30
30
  }
31
31
  function Re(t) {
32
- t.dracoLoader || t.setDRACOLoader(X), t.ktx2Loader || t.setKTX2Loader(Y), t.meshoptDecoder || t.setMeshoptDecoder(ge);
32
+ t.dracoLoader || t.setDRACOLoader(Y), t.ktx2Loader || t.setKTX2Loader(H), t.meshoptDecoder || t.setMeshoptDecoder(ge);
33
33
  }
34
34
  const Me = /* @__PURE__ */ new WeakMap();
35
35
  function Ie(t, e) {
@@ -37,7 +37,7 @@ function Ie(t, e) {
37
37
  s ? s = Object.assign(s, e) : s = e, Me.set(t, s);
38
38
  }
39
39
  const Le = Oe.prototype.load;
40
- function je(...t) {
40
+ function Ze(...t) {
41
41
  const e = Me.get(this);
42
42
  let s = t[0];
43
43
  const n = new URL(s, window.location.href);
@@ -47,7 +47,7 @@ function je(...t) {
47
47
  }
48
48
  return t[0] = s, Le == null ? void 0 : Le.call(this, ...t);
49
49
  }
50
- Oe.prototype.load = je;
50
+ Oe.prototype.load = Ze;
51
51
  oe("debugprogressive");
52
52
  function oe(t) {
53
53
  if (typeof window > "u")
@@ -55,7 +55,7 @@ function oe(t) {
55
55
  const s = new URL(window.location.href).searchParams.get(t);
56
56
  return s == null || s === "0" || s === "false" ? !1 : s === "" ? !0 : s;
57
57
  }
58
- function et(t, e) {
58
+ function je(t, e) {
59
59
  if (e === void 0 || e.startsWith("./") || e.startsWith("http") || t === void 0)
60
60
  return e;
61
61
  const s = t.lastIndexOf("/");
@@ -68,25 +68,25 @@ function et(t, e) {
68
68
  return e;
69
69
  }
70
70
  let ee;
71
- function tt() {
71
+ function et() {
72
72
  return ee !== void 0 || (ee = /iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent), oe("debugprogressive") && console.log("[glTF Progressive]: isMobileDevice", ee)), ee;
73
73
  }
74
- const st = typeof window > "u" && typeof document > "u", De = Symbol("needle:raycast-mesh");
74
+ const tt = typeof window > "u" && typeof document > "u", De = Symbol("needle:raycast-mesh");
75
75
  function ae(t) {
76
76
  return (t == null ? void 0 : t[De]) instanceof he ? t[De] : null;
77
77
  }
78
- function rt(t, e) {
78
+ function st(t, e) {
79
79
  if ((t.type === "Mesh" || t.type === "SkinnedMesh") && !ae(t)) {
80
- const n = nt(e);
80
+ const n = it(e);
81
81
  n.userData = { isRaycastMesh: !0 }, t[De] = n;
82
82
  }
83
83
  }
84
- function it(t = !0) {
84
+ function rt(t = !0) {
85
85
  if (t) {
86
86
  if (te)
87
87
  return;
88
- const e = te = H.prototype.raycast;
89
- H.prototype.raycast = function(s, n) {
88
+ const e = te = J.prototype.raycast;
89
+ J.prototype.raycast = function(s, n) {
90
90
  const i = this, r = ae(i);
91
91
  let o;
92
92
  r && i.isMesh && (o = i.geometry, i.geometry = r), e.call(this, s, n), o && (i.geometry = o);
@@ -94,31 +94,28 @@ function it(t = !0) {
94
94
  } else {
95
95
  if (!te)
96
96
  return;
97
- H.prototype.raycast = te, te = null;
97
+ J.prototype.raycast = te, te = null;
98
98
  }
99
99
  }
100
100
  let te = null;
101
- function nt(t) {
101
+ function it(t) {
102
102
  const e = new he();
103
103
  for (const s in t.attributes)
104
104
  e.setAttribute(s, t.getAttribute(s));
105
105
  return e.setIndex(t.getIndex()), e;
106
106
  }
107
- const q = new Array(), $ = "NEEDLE_progressive", y = oe("debugprogressive"), _e = Symbol("needle-progressive-texture"), ie = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Set();
108
- if (y) {
107
+ const K = new Array(), $ = "NEEDLE_progressive", p = oe("debugprogressive"), _e = Symbol("needle-progressive-texture"), ie = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Set();
108
+ if (p) {
109
109
  let t = function() {
110
110
  e += 1, console.log("Toggle LOD level", e, ie), ie.forEach((i, r) => {
111
111
  for (const o of i.keys) {
112
112
  const a = r[o];
113
- if (a != null) {
113
+ if (a != null)
114
114
  if (a.isBufferGeometry === !0) {
115
- const c = b.getMeshLODInformation(a), l = c ? Math.min(e, c.lods.length) : 0;
116
- r["DEBUG:LOD"] = e, b.assignMeshLOD(r, l), c && (s = Math.max(s, c.lods.length - 1));
117
- } else if (r.isMaterial === !0) {
118
- r["DEBUG:LOD"] = e, b.assignTextureLOD(r, e);
119
- break;
120
- }
121
- }
115
+ const c = A.getMeshLODInformation(a), l = c ? Math.min(e, c.lods.length) : 0;
116
+ r["DEBUG:LOD"] = l, c && (s = Math.max(s, c.lods.length - 1));
117
+ } else
118
+ r.isMaterial === !0 && (r["DEBUG:LOD"] = e);
122
119
  }
123
120
  }), e >= s && (e = -1);
124
121
  }, e = -1, s = 2, n = !1;
@@ -130,7 +127,7 @@ if (y) {
130
127
  }
131
128
  function Ee(t, e, s) {
132
129
  var i;
133
- if (!y)
130
+ if (!p)
134
131
  return;
135
132
  ie.has(t) || ie.set(t, { keys: [], sourceId: s });
136
133
  const n = ie.get(t);
@@ -147,7 +144,7 @@ const D = class {
147
144
  var a;
148
145
  return this._isLoadingMesh = !1, o && D.registerMesh(this.url, n.guid, o, (a = n.lods) == null ? void 0 : a.length, void 0, n), o;
149
146
  })) : null;
150
- }, y && console.log("Progressive extension registered for", e), this.parser = t, this.url = e;
147
+ }, p && console.log("Progressive extension registered for", e), this.parser = t, this.url = e;
151
148
  }
152
149
  /** The name of the extension */
153
150
  get name() {
@@ -170,7 +167,7 @@ const D = class {
170
167
  this.getMaterialMinMaxLODsCount(o, e);
171
168
  return t[n] = e, e;
172
169
  }
173
- if (y === "verbose" && console.log("getMaterialMinMaxLODsCount", t), t.type === "ShaderMaterial" || t.type === "RawShaderMaterial") {
170
+ if (p === "verbose" && console.log("getMaterialMinMaxLODsCount", t), t.type === "ShaderMaterial" || t.type === "RawShaderMaterial") {
174
171
  const o = t;
175
172
  for (const a of Object.keys(o.uniforms)) {
176
173
  const c = o.uniforms[a].value;
@@ -249,21 +246,21 @@ const D = class {
249
246
  var s;
250
247
  if (!t)
251
248
  return Promise.resolve(null);
252
- if (t instanceof H || t.isMesh === !0) {
249
+ if (t instanceof J || t.isMesh === !0) {
253
250
  const n = t.geometry, i = this.getAssignedLODInformation(n);
254
251
  if (!i)
255
252
  return Promise.resolve(null);
256
- for (const r of q)
253
+ for (const r of K)
257
254
  (s = r.onBeforeGetLODMesh) == null || s.call(r, t, e);
258
255
  return t["LOD:requested level"] = e, D.getOrLoadLOD(n, e).then((r) => {
259
256
  if (Array.isArray(r)) {
260
257
  const o = i.index || 0;
261
258
  r = r[o];
262
259
  }
263
- return t["LOD:requested level"] === e && (delete t["LOD:requested level"], r && n != r && ((r == null ? void 0 : r.isBufferGeometry) ? (t.geometry = r, y && Ee(t, "geometry", i.url)) : y && console.error("Invalid LOD geometry", r))), r;
260
+ return t["LOD:requested level"] === e && (delete t["LOD:requested level"], r && n != r && ((r == null ? void 0 : r.isBufferGeometry) ? (t.geometry = r, p && Ee(t, "geometry", i.url)) : p && console.error("Invalid LOD geometry", r))), r;
264
261
  }).catch((r) => (console.error("Error loading mesh LOD", t, r), null));
265
262
  } else
266
- y && console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh", t);
263
+ p && console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh", t);
267
264
  return Promise.resolve(null);
268
265
  }
269
266
  static assignTextureLOD(t, e = 0) {
@@ -286,9 +283,9 @@ const D = class {
286
283
  } else
287
284
  return this.assignTextureLOD(s.material, e);
288
285
  }
289
- if (t instanceof We || t.isMaterial === !0) {
286
+ if (t.isMaterial === !0) {
290
287
  const s = t, n = [], i = new Array();
291
- if (y && ve.add(s), s.uniforms && (s.isRawShaderMaterial || s.isShaderMaterial === !0)) {
288
+ if (p && ve.add(s), s.uniforms && (s.isRawShaderMaterial || s.isShaderMaterial === !0)) {
292
289
  const r = s;
293
290
  for (const o of Object.keys(r.uniforms)) {
294
291
  const a = r.uniforms[o].value;
@@ -328,33 +325,33 @@ const D = class {
328
325
  if (i != t) {
329
326
  if (s && n) {
330
327
  const r = s[n];
331
- if (r) {
328
+ if (r && !p) {
332
329
  const o = this.getAssignedLODInformation(r);
333
330
  if (o && (o == null ? void 0 : o.level) < e)
334
- return y === "verbose" && console.warn("Assigned texture level is already higher: ", o.level, e, s, r, i), null;
331
+ return p === "verbose" && console.warn("Assigned texture level is already higher: ", o.level, e, s, r, i), null;
335
332
  }
336
333
  s[n] = i;
337
334
  }
338
- if (y && n && s) {
335
+ if (p && n && s) {
339
336
  const r = this.getAssignedLODInformation(t);
340
- r && Ee(s, n, r.url);
337
+ r ? Ee(s, n, r.url) : console.warn("No LOD info for texture", t);
341
338
  }
342
339
  }
343
340
  return i;
344
341
  } else
345
- y == "verbose" && console.warn("No LOD found for", t, e);
342
+ p == "verbose" && console.warn("No LOD found for", t, e);
346
343
  return null;
347
344
  }).catch((i) => (console.error("Error loading LOD", t, i), null));
348
345
  }
349
346
  afterRoot(t) {
350
347
  var e, s;
351
- return y && console.log("AFTER", this.url, t), (e = this.parser.json.textures) == null || e.forEach((n, i) => {
348
+ return p && console.log("AFTER", this.url, t), (e = this.parser.json.textures) == null || e.forEach((n, i) => {
352
349
  var r;
353
350
  if (n != null && n.extensions) {
354
351
  const o = n == null ? void 0 : n.extensions[$];
355
352
  if (o) {
356
353
  if (!o.lods) {
357
- y && console.warn("Texture has no LODs", o);
354
+ p && console.warn("Texture has no LODs", o);
358
355
  return;
359
356
  }
360
357
  let a = !1;
@@ -384,7 +381,7 @@ const D = class {
384
381
  }
385
382
  static async getOrLoadLOD(t, e) {
386
383
  var o, a, c, l;
387
- const s = y == "verbose", n = t.userData.LODS;
384
+ const s = p == "verbose", n = t.userData.LODS;
388
385
  if (!n)
389
386
  return null;
390
387
  const i = n == null ? void 0 : n.key;
@@ -402,8 +399,8 @@ const D = class {
402
399
  }
403
400
  const d = Array.isArray(r.lods) ? (o = r.lods[e]) == null ? void 0 : o.path : r.lods;
404
401
  if (!d)
405
- return y && !r["missing:uri"] && (r["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + e, r)), null;
406
- const h = et(n.url, d);
402
+ return p && !r["missing:uri"] && (r["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + e, r)), null;
403
+ const h = je(n.url, d);
407
404
  if (h.endsWith(".glb") || h.endsWith(".gltf")) {
408
405
  if (!r.guid)
409
406
  return console.warn("missing pointer for glb/gltf texture", r), null;
@@ -417,22 +414,22 @@ const D = class {
417
414
  }
418
415
  const M = r, P = new Promise(async (f, w) => {
419
416
  const I = new Oe();
420
- Re(I), y && (await new Promise((O) => setTimeout(O, 1e3)), s && console.warn("Start loading (delayed) " + h, M.guid));
417
+ Re(I), p && (await new Promise((O) => setTimeout(O, 1e3)), s && console.warn("Start loading (delayed) " + h, M.guid));
421
418
  let k = h;
422
419
  if (M && Array.isArray(M.lods)) {
423
420
  const O = M.lods[e];
424
421
  O.hash && (k += "?v=" + O.hash);
425
422
  }
426
- const T = await I.loadAsync(k).catch((O) => (console.error(`Error loading LOD ${e} from ${h}
423
+ const E = await I.loadAsync(k).catch((O) => (console.error(`Error loading LOD ${e} from ${h}
427
424
  `, O), null));
428
- if (!T)
425
+ if (!E)
429
426
  return null;
430
- const G = T.parser;
427
+ const G = E.parser;
431
428
  s && console.log("Loading finished " + h, M.guid);
432
429
  let v = 0;
433
- if (T.parser.json.textures) {
430
+ if (E.parser.json.textures) {
434
431
  let O = !1;
435
- for (const u of T.parser.json.textures) {
432
+ for (const u of E.parser.json.textures) {
436
433
  if (u != null && u.extensions) {
437
434
  const g = u == null ? void 0 : u.extensions[$];
438
435
  if (g != null && g.guid && g.guid === M.guid) {
@@ -446,11 +443,11 @@ const D = class {
446
443
  let u = await G.getDependency("texture", v);
447
444
  return u && D.assignLODInformation(n.url, u, i, e, void 0, void 0), s && console.log('change "' + t.name + '" → "' + u.name + '"', h, v, u, x), t instanceof j && (u = this.copySettings(t, u)), u && (u.guid = M.guid), f(u);
448
445
  } else
449
- y && console.warn("Could not find texture with guid", M.guid, T.parser.json);
446
+ p && console.warn("Could not find texture with guid", M.guid, E.parser.json);
450
447
  }
451
- if (v = 0, T.parser.json.meshes) {
448
+ if (v = 0, E.parser.json.meshes) {
452
449
  let O = !1;
453
- for (const u of T.parser.json.meshes) {
450
+ for (const u of E.parser.json.meshes) {
454
451
  if (u != null && u.extensions) {
455
452
  const g = u == null ? void 0 : u.extensions[$];
456
453
  if (g != null && g.guid && g.guid === M.guid) {
@@ -468,34 +465,34 @@ const D = class {
468
465
  } else {
469
466
  const _ = new Array();
470
467
  for (let S = 0; S < u.children.length; S++) {
471
- const A = u.children[S];
472
- if (A.isMesh === !0) {
473
- const W = A.geometry;
468
+ const T = u.children[S];
469
+ if (T.isMesh === !0) {
470
+ const W = T.geometry;
474
471
  D.assignLODInformation(n.url, W, i, e, S, g.density), _.push(W);
475
472
  }
476
473
  }
477
474
  return f(_);
478
475
  }
479
476
  } else
480
- y && console.warn("Could not find mesh with guid", M.guid, T.parser.json);
477
+ p && console.warn("Could not find mesh with guid", M.guid, E.parser.json);
481
478
  }
482
479
  return f(null);
483
480
  });
484
481
  return this.previouslyLoaded.set(x, P), await P;
485
482
  } else if (t instanceof j) {
486
483
  s && console.log("Load texture from uri: " + h);
487
- const L = await new ze().loadAsync(h);
488
- return L ? (L.guid = r.guid, L.flipY = !1, L.needsUpdate = !0, L.colorSpace = t.colorSpace, s && console.log(r, L)) : y && console.warn("failed loading", h), L;
484
+ const L = await new We().loadAsync(h);
485
+ return L ? (L.guid = r.guid, L.flipY = !1, L.needsUpdate = !0, L.colorSpace = t.colorSpace, s && console.log(r, L)) : p && console.warn("failed loading", h), L;
489
486
  }
490
487
  } else
491
- y && console.warn(`Can not load LOD ${e}: no LOD info found for "${i}" ${t.name}`, t.type);
488
+ p && console.warn(`Can not load LOD ${e}: no LOD info found for "${i}" ${t.name}`, t.type);
492
489
  return null;
493
490
  }
494
491
  static assignLODInformation(t, e, s, n, i, r) {
495
492
  if (!e)
496
493
  return;
497
494
  e.userData || (e.userData = {});
498
- const o = new ot(t, s, n, i, r);
495
+ const o = new nt(t, s, n, i, r);
499
496
  e.userData.LODS = o;
500
497
  }
501
498
  static getAssignedLODInformation(t) {
@@ -504,39 +501,39 @@ const D = class {
504
501
  }
505
502
  // private static readonly _copiedTextures: WeakMap<Texture, Texture> = new Map();
506
503
  static copySettings(t, e) {
507
- return e = e.clone(), y && console.warn(`Copying texture settings
504
+ return p && console.warn(`Copy texture settings
508
505
  `, t.uuid, `
509
- `, e.uuid), 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;
506
+ `, 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;
510
507
  }
511
508
  };
512
- let b = D;
513
- b.registerTexture = (t, e, s, n, i) => {
514
- if (y && console.log("> Progressive: register texture", n, e.name, e.uuid, e, i), !e) {
515
- y && console.error("gltf-progressive: Register texture without texture");
509
+ let A = D;
510
+ A.registerTexture = (t, e, s, n, i) => {
511
+ if (p && console.log("> Progressive: register texture", n, e.name, e.uuid, e, i), !e) {
512
+ p && console.error("gltf-progressive: Register texture without texture");
516
513
  return;
517
514
  }
518
515
  e.source && (e.source[_e] = i);
519
516
  const r = i.guid;
520
517
  D.assignLODInformation(t, e, r, s, n, void 0), D.lodInfos.set(r, i), D.lowresCache.set(r, e);
521
518
  };
522
- b.registerMesh = (t, e, s, n, i, r) => {
519
+ A.registerMesh = (t, e, s, n, i, r) => {
523
520
  var c;
524
- y && console.log("> Progressive: register mesh", i, s.name, r, s.uuid, s);
521
+ p && console.log("> Progressive: register mesh", i, s.name, r, s.uuid, s);
525
522
  const o = s.geometry;
526
523
  if (!o) {
527
- y && console.warn("gltf-progressive: Register mesh without geometry");
524
+ p && console.warn("gltf-progressive: Register mesh without geometry");
528
525
  return;
529
526
  }
530
527
  o.userData || (o.userData = {}), D.assignLODInformation(t, o, e, n, i, r.density), D.lodInfos.set(e, r);
531
528
  let a = D.lowresCache.get(e);
532
- a ? a.push(s.geometry) : a = [s.geometry], D.lowresCache.set(e, a), n > 0 && !ae(s) && rt(s, o);
533
- for (const l of q)
529
+ a ? a.push(s.geometry) : a = [s.geometry], D.lowresCache.set(e, a), n > 0 && !ae(s) && st(s, o);
530
+ for (const l of K)
534
531
  (c = l.onRegisteredNewMesh) == null || c.call(l, s, r);
535
532
  };
536
- b.lodInfos = /* @__PURE__ */ new Map();
537
- b.previouslyLoaded = /* @__PURE__ */ new Map();
538
- b.lowresCache = /* @__PURE__ */ new Map();
539
- class ot {
533
+ A.lodInfos = /* @__PURE__ */ new Map();
534
+ A.previouslyLoaded = /* @__PURE__ */ new Map();
535
+ A.lowresCache = /* @__PURE__ */ new Map();
536
+ class nt {
540
537
  constructor(e, s, n, i, r) {
541
538
  this.url = e, this.key = s, this.level = n, i != null && (this.index = i), r != null && (this.density = r);
542
539
  }
@@ -544,26 +541,26 @@ class ot {
544
541
  var Ge = (t, e, s) => {
545
542
  if (!e.has(t))
546
543
  throw TypeError("Cannot " + s);
547
- }, p = (t, e, s) => (Ge(t, e, "read from private field"), s ? s.call(t) : e.get(t)), K = (t, e, s) => {
544
+ }, y = (t, e, s) => (Ge(t, e, "read from private field"), s ? s.call(t) : e.get(t)), X = (t, e, s) => {
548
545
  if (e.has(t))
549
546
  throw TypeError("Cannot add the same private member more than once");
550
547
  e instanceof WeakSet ? e.add(t) : e.set(t, s);
551
- }, N = (t, e, s, n) => (Ge(t, e, "write to private field"), n ? n.call(t, s) : e.set(t, s), s), E, z, we, Q, re, de, V;
552
- const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:LODSManager"), xe = Symbol("Needle:LODState"), J = Symbol("Needle:CurrentLOD"), R = { mesh_lod: -1, texture_lod: -1 }, C = class {
548
+ }, N = (t, e, s, n) => (Ge(t, e, "write to private field"), n ? n.call(t, s) : e.set(t, s), s), b, V, we, Q, re, de, q;
549
+ const B = oe("debugprogressive"), ot = oe("noprogressive"), me = Symbol("Needle:LODSManager"), xe = Symbol("Needle:LODState"), z = Symbol("Needle:CurrentLOD"), R = { mesh_lod: -1, texture_lod: -1 }, C = class {
553
550
  // readonly plugins: NEEDLE_progressive_plugin[] = [];
554
551
  constructor(t, e) {
555
- this.projectionScreenMatrix = new Se(), this.targetTriangleDensity = 2e5, this.updateInterval = "auto", K(this, E, 1), this.pause = !1, this.manual = !1, this._lodchangedlisteners = [], K(this, z, void 0), K(this, we, new Ke()), K(this, Q, 0), K(this, re, 0), K(this, de, 0), K(this, V, 0), this._fpsBuffer = [60, 60, 60, 60, 60], this._sphere = new Ve(), this._tempBox = new be(), this._tempBox2 = new be(), this.tempMatrix = new Se(), this._tempWorldPosition = new F(), this._tempBoxSize = new F(), this._tempBox2Size = new F(), this.renderer = t, this.context = { ...e };
552
+ this.projectionScreenMatrix = new Se(), this.targetTriangleDensity = 2e5, this.updateInterval = "auto", X(this, b, 1), this.pause = !1, this.manual = !1, this._lodchangedlisteners = [], X(this, V, void 0), X(this, we, new qe()), X(this, Q, 0), X(this, re, 0), X(this, de, 0), X(this, q, 0), this._fpsBuffer = [60, 60, 60, 60, 60], this._sphere = new ze(), this._tempBox = new be(), this._tempBox2 = new be(), this.tempMatrix = new Se(), this._tempWorldPosition = new F(), this._tempBoxSize = new F(), this._tempBox2Size = new F(), this.renderer = t, this.context = { ...e };
556
553
  }
557
554
  /** @internal */
558
555
  static getObjectLODState(t) {
559
556
  return t[xe];
560
557
  }
561
558
  static addPlugin(t) {
562
- q.push(t);
559
+ K.push(t);
563
560
  }
564
561
  static removePlugin(t) {
565
- const e = q.indexOf(t);
566
- e >= 0 && q.splice(e, 1);
562
+ const e = K.indexOf(t);
563
+ e >= 0 && K.splice(e, 1);
567
564
  }
568
565
  /**
569
566
  * Gets the LODsManager for the given renderer. If the LODsManager does not exist yet, it will be created.
@@ -581,7 +578,7 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
581
578
  }
582
579
  /** @deprecated use static `LODsManager.addPlugin()` method. This getter will be removed in later versions */
583
580
  get plugins() {
584
- return q;
581
+ return K;
585
582
  }
586
583
  addEventListener(t, e) {
587
584
  t === "changed" && this._lodchangedlisteners.push(e);
@@ -596,21 +593,21 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
596
593
  * Enable the LODsManager. This will replace the render method of the renderer with a method that updates the LODs.
597
594
  */
598
595
  enable() {
599
- if (p(this, z))
596
+ if (y(this, V))
600
597
  return;
601
598
  console.debug("[gltf-progressive] Enabling LODsManager for renderer");
602
599
  let t = 0;
603
- N(this, z, this.renderer.render);
600
+ N(this, V, this.renderer.render);
604
601
  const e = this;
605
602
  Be(this.renderer), this.renderer.render = function(s, n) {
606
603
  const i = e.renderer.getRenderTarget();
607
- (i == null || "isXRRenderTarget" in i && i.isXRRenderTarget) && (t = 0, N(e, Q, p(e, Q) + 1), N(e, re, p(e, we).getDelta()), N(e, de, p(e, de) + p(e, re)), e._fpsBuffer.shift(), e._fpsBuffer.push(1 / p(e, re)), N(e, V, e._fpsBuffer.reduce((o, a) => o + a) / e._fpsBuffer.length), B && p(e, Q) % 200 === 0 && console.log("FPS", Math.round(p(e, V)), "Interval:", p(e, E)));
604
+ (i == null || "isXRRenderTarget" in i && i.isXRRenderTarget) && (t = 0, N(e, Q, y(e, Q) + 1), N(e, re, y(e, we).getDelta()), N(e, de, y(e, de) + y(e, re)), e._fpsBuffer.shift(), e._fpsBuffer.push(1 / y(e, re)), N(e, q, e._fpsBuffer.reduce((o, a) => o + a) / e._fpsBuffer.length), B && y(e, Q) % 200 === 0 && console.log("FPS", Math.round(y(e, q)), "Interval:", y(e, b)));
608
605
  const r = t++;
609
- p(e, z).call(this, s, n), e.onAfterRender(s, n, r);
606
+ y(e, V).call(this, s, n), e.onAfterRender(s, n, r);
610
607
  };
611
608
  }
612
609
  disable() {
613
- p(this, z) && (console.debug("[gltf-progressive] Disabling LODsManager for renderer"), this.renderer.render = p(this, z), N(this, z, void 0));
610
+ y(this, V) && (console.debug("[gltf-progressive] Disabling LODsManager for renderer"), this.renderer.render = y(this, V), N(this, V, void 0));
614
611
  }
615
612
  update(t, e) {
616
613
  this.internalUpdate(t, e);
@@ -625,7 +622,7 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
625
622
  (o.name === "EffectMaterial" || o.name === "CopyShader") && (r = !1);
626
623
  }
627
624
  if ((e.parent && e.parent.type === "CubeCamera" || s >= 1 && e.type === "OrthographicCamera") && (r = !1), r) {
628
- if (at || (this.updateInterval === "auto" ? p(this, V) < 40 && p(this, E) < 10 ? (N(this, E, p(this, E) + 1), B && console.warn("↓ Reducing LOD updates", p(this, E), p(this, V).toFixed(0))) : p(this, V) >= 60 && p(this, E) > 1 && (N(this, E, p(this, E) - 1), B && console.warn("↑ Increasing LOD updates", p(this, E), p(this, V).toFixed(0))) : N(this, E, this.updateInterval), p(this, E) > 0 && p(this, Q) % p(this, E) != 0))
625
+ if (ot || (this.updateInterval === "auto" ? y(this, q) < 40 && y(this, b) < 10 ? (N(this, b, y(this, b) + 1), B && console.warn("↓ Reducing LOD updates", y(this, b), y(this, q).toFixed(0))) : y(this, q) >= 60 && y(this, b) > 1 && (N(this, b, y(this, b) - 1), B && console.warn("↑ Increasing LOD updates", y(this, b), y(this, q).toFixed(0))) : N(this, b, this.updateInterval), y(this, b) > 0 && y(this, Q) % y(this, b) != 0))
629
626
  return;
630
627
  this.internalUpdate(t, e);
631
628
  }
@@ -654,21 +651,21 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
654
651
  }
655
652
  if (B === "color" && l.material && !l.object.progressive_debug_color) {
656
653
  l.object.progressive_debug_color = !0;
657
- const h = Math.random() * 16777215, x = new qe({ color: h });
654
+ const h = Math.random() * 16777215, x = new Ve({ color: h });
658
655
  l.object.material = x;
659
656
  }
660
657
  const d = l.object;
661
- (d instanceof H || d.isMesh) && this.updateLODs(t, e, d, i);
658
+ (d instanceof J || d.isMesh) && this.updateLODs(t, e, d, i);
662
659
  }
663
660
  const r = s.transparent;
664
661
  for (const l of r) {
665
662
  const d = l.object;
666
- (d instanceof H || d.isMesh) && this.updateLODs(t, e, d, i);
663
+ (d instanceof J || d.isMesh) && this.updateLODs(t, e, d, i);
667
664
  }
668
665
  const o = s.transmissive;
669
666
  for (const l of o) {
670
667
  const d = l.object;
671
- (d instanceof H || d.isMesh) && this.updateLODs(t, e, d, i);
668
+ (d instanceof J || d.isMesh) && this.updateLODs(t, e, d, i);
672
669
  }
673
670
  }
674
671
  /** Update the LOD levels for the renderer. */
@@ -676,17 +673,14 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
676
673
  var o, a;
677
674
  s.userData || (s.userData = {});
678
675
  let i = s[xe];
679
- if (i || (i = new lt(), s[xe] = i), i.frames++ < 2)
676
+ if (i || (i = new at(), s[xe] = i), i.frames++ < 2)
680
677
  return;
681
- for (const c of q)
678
+ for (const c of K)
682
679
  (o = c.onBeforeUpdateLOD) == null || o.call(c, this.renderer, t, e, s);
683
680
  this.calculateLodLevel(e, s, i, n, 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);
684
681
  let r = R.texture_lod;
685
- if (s.material && r >= 0) {
686
- const c = s["DEBUG:LOD"];
687
- c != null && (r = c), this.loadProgressiveTextures(s.material, r);
688
- }
689
- for (const c of q)
682
+ s.material && r >= 0 && this.loadProgressiveTextures(s.material, r);
683
+ for (const c of K)
690
684
  (a = c.onAfterUpdatedLOD) == null || a.call(c, this.renderer, t, e, s, R);
691
685
  i.lastLodLevel_Mesh = R.mesh_lod, i.lastLodLevel_Texture = R.texture_lod;
692
686
  }
@@ -699,13 +693,15 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
699
693
  if (!t)
700
694
  return;
701
695
  if (Array.isArray(t)) {
702
- for (const n of t)
703
- this.loadProgressiveTextures(n, e);
696
+ for (const i of t)
697
+ this.loadProgressiveTextures(i, e);
704
698
  return;
705
699
  }
706
700
  let s = !1;
707
- (t[J] === void 0 || e < t[J]) && (s = !0), s && (t[J] = e, b.assignTextureLOD(t, e).then((n) => {
708
- this._lodchangedlisteners.forEach((i) => i({ type: "texture", level: e, object: t }));
701
+ (t[z] === void 0 || e < t[z]) && (s = !0);
702
+ const n = t["DEBUG:LOD"];
703
+ n != null && (s = t[z] != n, e = n), s && (t[z] = e, A.assignTextureLOD(t, e).then((i) => {
704
+ this._lodchangedlisteners.forEach((r) => r({ type: "texture", level: e, object: t }));
709
705
  }));
710
706
  }
711
707
  /** Load progressive meshes for the given mesh
@@ -717,10 +713,12 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
717
713
  loadProgressiveMeshes(t, e) {
718
714
  if (!t)
719
715
  return Promise.resolve(null);
720
- if (t[J] !== e) {
721
- t[J] = e;
722
- const s = t.geometry;
723
- return b.assignMeshLOD(t, e).then((n) => (n && t[J] == e && s != t.geometry && this._lodchangedlisteners.forEach((i) => i({ type: "mesh", level: e, object: t })), n));
716
+ let s = t[z] !== e;
717
+ const n = t["DEBUG:LOD"];
718
+ if (n != null && (s = t[z] != n, e = n), s) {
719
+ t[z] = e;
720
+ const i = t.geometry;
721
+ return A.assignMeshLOD(t, e).then((r) => (r && t[z] == e && i != t.geometry && this._lodchangedlisteners.forEach((o) => o({ type: "mesh", level: e, object: t })), r));
724
722
  }
725
723
  return Promise.resolve(null);
726
724
  }
@@ -741,7 +739,7 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
741
739
  let o = 10 + 1, a = !1;
742
740
  if (B && e["DEBUG:LOD"] != null)
743
741
  return e["DEBUG:LOD"];
744
- const c = b.getMeshLODInformation(e.geometry), l = c == null ? void 0 : c.lods, d = l && l.length > 0, h = b.getMaterialMinMaxLODsCount(e.material), x = (h == null ? void 0 : h.min_count) != 1 / 0 && h.min_count > 0 && h.max_count > 0;
742
+ const c = A.getMeshLODInformation(e.geometry), l = c == null ? void 0 : c.lods, d = l && l.length > 0, h = A.getMaterialMinMaxLODsCount(e.material), x = (h == null ? void 0 : h.min_count) != 1 / 0 && h.min_count > 0 && h.max_count > 0;
745
743
  if (!d && !x) {
746
744
  i.mesh_lod = 0, i.texture_lod = 0;
747
745
  return;
@@ -775,10 +773,10 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
775
773
  }
776
774
  if (this._tempBox.applyMatrix4(this.projectionScreenMatrix), this.renderer.xr.enabled && m.isPerspectiveCamera && m.fov > 70) {
777
775
  const u = this._tempBox.min, g = this._tempBox.max;
778
- let _ = u.x, S = u.y, A = g.x, W = g.y;
776
+ let _ = u.x, S = u.y, T = g.x, W = g.y;
779
777
  const le = 2, pe = 1.5, ce = (u.x + g.x) * 0.5, ue = (u.y + g.y) * 0.5;
780
- _ = (_ - ce) * le + ce, S = (S - ue) * le + ue, A = (A - ce) * le + ce, W = (W - ue) * le + ue;
781
- const Fe = _ < 0 && A > 0 ? 0 : Math.min(Math.abs(u.x), Math.abs(g.x)), Ue = S < 0 && W > 0 ? 0 : Math.min(Math.abs(u.y), Math.abs(g.y)), ye = Math.max(Fe, Ue);
778
+ _ = (_ - ce) * le + ce, S = (S - ue) * le + ue, T = (T - ce) * le + ce, W = (W - ue) * le + ue;
779
+ const Fe = _ < 0 && T > 0 ? 0 : Math.min(Math.abs(u.x), Math.abs(g.x)), Ue = S < 0 && W > 0 ? 0 : Math.min(Math.abs(u.y), Math.abs(g.y)), ye = Math.max(Fe, Ue);
782
780
  s.lastCentrality = (pe - ye) * (pe - ye) * (pe - ye);
783
781
  } else
784
782
  s.lastCentrality = 1;
@@ -786,14 +784,14 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
786
784
  f.multiplyScalar(0.5), screen.availHeight > 0 && L > 0 && f.multiplyScalar(L / screen.availHeight), t.isPerspectiveCamera ? f.x *= t.aspect : t.isOrthographicCamera;
787
785
  const w = t.matrixWorldInverse, I = this._tempBox2;
788
786
  I.copy(M), I.applyMatrix4(e.matrixWorld), I.applyMatrix4(w);
789
- const k = I.getSize(this._tempBox2Size), T = Math.max(k.x, k.y);
790
- if (Math.max(f.x, f.y) != 0 && T != 0 && (f.z = k.z / Math.max(k.x, k.y) * Math.max(f.x, f.y)), s.lastScreenCoverage = Math.max(f.x, f.y, f.z), s.lastScreenspaceVolume.copy(f), s.lastScreenCoverage *= s.lastCentrality, B && C.debugDrawLine) {
787
+ const k = I.getSize(this._tempBox2Size), E = Math.max(k.x, k.y);
788
+ if (Math.max(f.x, f.y) != 0 && E != 0 && (f.z = k.z / Math.max(k.x, k.y) * Math.max(f.x, f.y)), s.lastScreenCoverage = Math.max(f.x, f.y, f.z), s.lastScreenspaceVolume.copy(f), s.lastScreenCoverage *= s.lastCentrality, B && C.debugDrawLine) {
791
789
  const u = this.tempMatrix.copy(this.projectionScreenMatrix);
792
790
  u.invert();
793
- const g = C.corner0, _ = C.corner1, S = C.corner2, A = C.corner3;
794
- g.copy(this._tempBox.min), _.copy(this._tempBox.max), _.x = g.x, S.copy(this._tempBox.max), S.y = g.y, A.copy(this._tempBox.max);
795
- const W = (g.z + A.z) * 0.5;
796
- g.z = _.z = S.z = A.z = W, g.applyMatrix4(u), _.applyMatrix4(u), S.applyMatrix4(u), A.applyMatrix4(u), C.debugDrawLine(g, _, 255), C.debugDrawLine(g, S, 255), C.debugDrawLine(_, A, 255), C.debugDrawLine(S, A, 255);
791
+ const g = C.corner0, _ = C.corner1, S = C.corner2, T = C.corner3;
792
+ g.copy(this._tempBox.min), _.copy(this._tempBox.max), _.x = g.x, S.copy(this._tempBox.max), S.y = g.y, T.copy(this._tempBox.max);
793
+ const W = (g.z + T.z) * 0.5;
794
+ g.z = _.z = S.z = T.z = W, g.applyMatrix4(u), _.applyMatrix4(u), S.applyMatrix4(u), T.applyMatrix4(u), C.debugDrawLine(g, _, 255), C.debugDrawLine(g, S, 255), C.debugDrawLine(_, T, 255), C.debugDrawLine(S, T, 255);
797
795
  }
798
796
  let v = 999;
799
797
  if (l && s.lastScreenCoverage > 0) {
@@ -821,11 +819,11 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
821
819
  let w = s.lastScreenCoverage * 4;
822
820
  ((P = this.context) == null ? void 0 : P.engine) === "model-viewer" && (w *= 1.5);
823
821
  const k = L / window.devicePixelRatio * w;
824
- let T = !1;
822
+ let E = !1;
825
823
  for (let G = h.lods.length - 1; G >= 0; G--) {
826
824
  let v = h.lods[G];
827
- if (!(m && v.max_height >= 2048) && !(tt() && v.max_height > 4096) && (v.max_height > k || !T && G === 0)) {
828
- if (T = !0, i.texture_lod = G, i.texture_lod < s.lastLodLevel_Texture) {
825
+ if (!(m && v.max_height >= 2048) && !(et() && v.max_height > 4096) && (v.max_height > k || !E && G === 0)) {
826
+ if (E = !0, i.texture_lod = G, i.texture_lod < s.lastLodLevel_Texture) {
829
827
  const O = v.max_height;
830
828
  B && console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${i.texture_lod} = ${O}px
831
829
  Screensize: ${k.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${f.toFixed(1)}
@@ -840,19 +838,19 @@ ${e.name}`);
840
838
  }
841
839
  };
842
840
  let U = C;
843
- E = /* @__PURE__ */ new WeakMap();
844
- z = /* @__PURE__ */ new WeakMap();
841
+ b = /* @__PURE__ */ new WeakMap();
842
+ V = /* @__PURE__ */ new WeakMap();
845
843
  we = /* @__PURE__ */ new WeakMap();
846
844
  Q = /* @__PURE__ */ new WeakMap();
847
845
  re = /* @__PURE__ */ new WeakMap();
848
846
  de = /* @__PURE__ */ new WeakMap();
849
- V = /* @__PURE__ */ new WeakMap();
847
+ q = /* @__PURE__ */ new WeakMap();
850
848
  U.corner0 = new F();
851
849
  U.corner1 = new F();
852
850
  U.corner2 = new F();
853
851
  U.corner3 = new F();
854
852
  U._tempPtInside = new F();
855
- class lt {
853
+ class at {
856
854
  constructor() {
857
855
  this.frames = 0, this.lastLodLevel_Mesh = -1, this.lastLodLevel_Texture = -1, this.lastScreenCoverage = 0, this.lastScreenspaceVolume = new F(), this.lastCentrality = 0;
858
856
  }
@@ -860,7 +858,7 @@ class lt {
860
858
  const Te = Symbol("NEEDLE_mesh_lod"), fe = Symbol("NEEDLE_texture_lod");
861
859
  let se = null;
862
860
  function Ne() {
863
- const t = ct();
861
+ const t = lt();
864
862
  t && (t.mapURLs(function(e) {
865
863
  return Ae(), e;
866
864
  }), Ae(), se == null || se.disconnect(), se = new MutationObserver((e) => {
@@ -871,7 +869,7 @@ function Ne() {
871
869
  });
872
870
  }), se.observe(document, { childList: !0, subtree: !0 }));
873
871
  }
874
- function ct() {
872
+ function lt() {
875
873
  if (typeof customElements > "u")
876
874
  return null;
877
875
  const t = customElements.get("model-viewer");
@@ -887,11 +885,11 @@ function Ae() {
887
885
  });
888
886
  }
889
887
  const Ce = /* @__PURE__ */ new WeakSet();
890
- let ut = 0;
888
+ let ct = 0;
891
889
  function $e(t) {
892
890
  if (!t || Ce.has(t))
893
891
  return null;
894
- Ce.add(t), console.debug("[gltf-progressive] found new model-viewer..." + ++ut + `
892
+ Ce.add(t), console.debug("[gltf-progressive] found new model-viewer..." + ++ct + `
895
893
  `, t.getAttribute("src"));
896
894
  let e = null, s = null, n = null;
897
895
  for (let i = t; i != null; i = Object.getPrototypeOf(i)) {
@@ -912,7 +910,7 @@ function $e(t) {
912
910
  };
913
911
  console.debug("[gltf-progressive] setup model-viewer");
914
912
  const r = U.get(e, { engine: "model-viewer" });
915
- return U.addPlugin(new ft()), r.enable(), r.addEventListener("changed", () => {
913
+ return U.addPlugin(new ut()), r.enable(), r.addEventListener("changed", () => {
916
914
  n == null || n.call(t);
917
915
  }), t.addEventListener("model-visibility", (o) => {
918
916
  o.detail.visible && (n == null || n.call(t));
@@ -924,7 +922,7 @@ function $e(t) {
924
922
  }
925
923
  return null;
926
924
  }
927
- class ft {
925
+ class ut {
928
926
  constructor() {
929
927
  this._didWarnAboutMissingUrl = !1;
930
928
  }
@@ -968,7 +966,7 @@ class ft {
968
966
  }
969
967
  if ((x = f == null ? void 0 : f.extensions) != null && x[$]) {
970
968
  const w = f.extensions[$];
971
- w && r && b.registerTexture(r, P, w.lods.length, m, w);
969
+ w && r && A.registerTexture(r, P, w.lods.length, m, w);
972
970
  }
973
971
  }
974
972
  }
@@ -992,27 +990,27 @@ class ft {
992
990
  const r = (a = (o = s.userData) == null ? void 0 : o.gltfExtensions) == null ? void 0 : a[$];
993
991
  if (r && i) {
994
992
  const c = s.uuid;
995
- b.registerMesh(i, c, s, 0, r.lods.length, r);
993
+ A.registerMesh(i, c, s, 0, r.lods.length, r);
996
994
  }
997
995
  }
998
996
  }
999
- function dt(t, e, s, n) {
997
+ function ft(t, e, s, n) {
1000
998
  Be(e), Re(s), Ie(s, {
1001
999
  progressive: !0,
1002
1000
  ...n == null ? void 0 : n.hints
1003
- }), s.register((r) => new b(r, t));
1001
+ }), s.register((r) => new A(r, t));
1004
1002
  const i = U.get(e);
1005
1003
  return (n == null ? void 0 : n.enableLODsManager) !== !1 && i.enable(), i;
1006
1004
  }
1007
1005
  Ne();
1008
- if (!st) {
1006
+ if (!tt) {
1009
1007
  const t = {
1010
1008
  gltfProgressive: {
1011
- useNeedleProgressive: dt,
1009
+ useNeedleProgressive: ft,
1012
1010
  LODsManager: U,
1013
1011
  configureLoader: Ie,
1014
1012
  getRaycastMesh: ae,
1015
- useRaycastMeshes: it
1013
+ useRaycastMeshes: rt
1016
1014
  }
1017
1015
  };
1018
1016
  if (!globalThis.Needle)
@@ -1023,11 +1021,11 @@ if (!st) {
1023
1021
  }
1024
1022
  export {
1025
1023
  U as L,
1026
- b as N,
1024
+ A as N,
1027
1025
  Re as a,
1028
1026
  Ie as b,
1029
1027
  Be as c,
1030
- yt as d,
1028
+ pt as d,
1031
1029
  ae as g,
1032
- pt as s
1030
+ gt as s
1033
1031
  };