@needle-tools/engine 4.1.0-experimental.13 → 4.1.0

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 (238) hide show
  1. package/CHANGELOG.md +72 -10
  2. package/README.md +28 -17
  3. package/components.needle.json +1 -1
  4. package/dist/gltf-progressive.js +220 -221
  5. package/dist/gltf-progressive.light.js +220 -221
  6. package/dist/gltf-progressive.light.min.js +6 -6
  7. package/dist/gltf-progressive.light.umd.cjs +7 -7
  8. package/dist/gltf-progressive.min.js +6 -6
  9. package/dist/gltf-progressive.umd.cjs +7 -7
  10. package/dist/needle-engine.bundle.js +8237 -7948
  11. package/dist/needle-engine.bundle.light.js +8190 -7901
  12. package/dist/needle-engine.bundle.light.min.js +140 -141
  13. package/dist/needle-engine.bundle.light.umd.cjs +138 -139
  14. package/dist/needle-engine.bundle.min.js +140 -141
  15. package/dist/needle-engine.bundle.umd.cjs +134 -135
  16. package/dist/needle-engine.d.ts +140 -0
  17. package/dist/needle-engine.js +597 -590
  18. package/dist/needle-engine.light.d.ts +140 -0
  19. package/dist/needle-engine.light.js +597 -590
  20. package/dist/needle-engine.light.min.js +1 -1
  21. package/dist/needle-engine.light.umd.cjs +1 -1
  22. package/dist/needle-engine.min.js +1 -1
  23. package/dist/needle-engine.umd.cjs +1 -1
  24. package/dist/postprocessing.js +1 -1
  25. package/dist/postprocessing.light.js +1 -1
  26. package/dist/postprocessing.light.min.js +1 -1
  27. package/dist/postprocessing.min.js +1 -1
  28. package/dist/three-examples.js +2809 -2450
  29. package/dist/three-examples.light.js +2809 -2450
  30. package/dist/three-examples.light.min.js +47 -15
  31. package/dist/three-examples.light.umd.cjs +47 -15
  32. package/dist/three-examples.min.js +47 -15
  33. package/dist/three-examples.umd.cjs +47 -15
  34. package/dist/three-mesh-ui.js +1 -1
  35. package/dist/three-mesh-ui.light.js +1 -1
  36. package/dist/three-mesh-ui.light.min.js +1 -1
  37. package/dist/three-mesh-ui.min.js +1 -1
  38. package/dist/three.js +577 -572
  39. package/dist/three.light.js +577 -572
  40. package/dist/three.light.min.js +170 -170
  41. package/dist/three.light.umd.cjs +170 -170
  42. package/dist/three.min.js +170 -170
  43. package/dist/three.umd.cjs +170 -170
  44. package/dist/vendor.js +1327 -1331
  45. package/dist/vendor.light.js +1327 -1331
  46. package/dist/vendor.light.min.js +33 -33
  47. package/dist/vendor.light.umd.cjs +33 -33
  48. package/dist/vendor.min.js +33 -33
  49. package/dist/vendor.umd.cjs +33 -33
  50. package/lib/engine/assets/index.js.map +1 -1
  51. package/lib/engine/engine.d.ts +4 -0
  52. package/lib/engine/engine.js +12 -0
  53. package/lib/engine/engine.js.map +1 -0
  54. package/lib/engine/engine_addressables.d.ts +6 -4
  55. package/lib/engine/engine_addressables.js +8 -1
  56. package/lib/engine/engine_addressables.js.map +1 -1
  57. package/lib/engine/engine_context.d.ts +3 -2
  58. package/lib/engine/engine_context.js +28 -4
  59. package/lib/engine/engine_context.js.map +1 -1
  60. package/lib/engine/engine_gameobject.d.ts +2 -12
  61. package/lib/engine/engine_gameobject.js +5 -15
  62. package/lib/engine/engine_gameobject.js.map +1 -1
  63. package/lib/engine/engine_gltf_builtin_components.js +5 -0
  64. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  65. package/lib/engine/engine_input.d.ts +19 -6
  66. package/lib/engine/engine_input.js +0 -10
  67. package/lib/engine/engine_input.js.map +1 -1
  68. package/lib/engine/engine_license.js +1 -1
  69. package/lib/engine/engine_license.js.map +1 -1
  70. package/lib/engine/engine_modules.d.ts +7 -0
  71. package/lib/engine/engine_modules.js +7 -0
  72. package/lib/engine/engine_modules.js.map +1 -1
  73. package/lib/engine/engine_networking_auto.js +6 -11
  74. package/lib/engine/engine_networking_auto.js.map +1 -1
  75. package/lib/engine/engine_networking_instantiate.d.ts +1 -1
  76. package/lib/engine/engine_physics_rapier.d.ts +6 -4
  77. package/lib/engine/engine_physics_rapier.js +38 -24
  78. package/lib/engine/engine_physics_rapier.js.map +1 -1
  79. package/lib/engine/engine_scenetools.js +6 -2
  80. package/lib/engine/engine_scenetools.js.map +1 -1
  81. package/lib/engine/engine_types.d.ts +9 -2
  82. package/lib/engine/engine_types.js +6 -0
  83. package/lib/engine/engine_types.js.map +1 -1
  84. package/lib/engine/engine_web_api.d.ts +12 -0
  85. package/lib/engine/engine_web_api.js +113 -0
  86. package/lib/engine/engine_web_api.js.map +1 -0
  87. package/lib/engine/export/gltf/Writers.js.map +1 -1
  88. package/lib/engine/export/gltf/index.js +11 -1
  89. package/lib/engine/export/gltf/index.js.map +1 -1
  90. package/lib/engine/export/utils.d.ts +2 -0
  91. package/lib/engine/export/utils.js +8 -0
  92. package/lib/engine/export/utils.js.map +1 -0
  93. package/lib/engine/extensions/NEEDLE_gameobject_data.js +1 -1
  94. package/lib/engine/extensions/NEEDLE_gameobject_data.js.map +1 -1
  95. package/lib/engine/js-extensions/Object3D.d.ts +5 -1
  96. package/lib/engine/js-extensions/Object3D.js.map +1 -1
  97. package/lib/engine/webcomponents/needle menu/needle-menu.js +8 -2
  98. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  99. package/lib/engine/xr/NeedleXRSession.js +3 -0
  100. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  101. package/lib/engine-components/AvatarLoader.js.map +1 -1
  102. package/lib/engine-components/Camera.d.ts +7 -4
  103. package/lib/engine-components/Camera.js +13 -10
  104. package/lib/engine-components/Camera.js.map +1 -1
  105. package/lib/engine-components/Collider.js +4 -5
  106. package/lib/engine-components/Collider.js.map +1 -1
  107. package/lib/engine-components/Component.d.ts +4 -3
  108. package/lib/engine-components/Component.js +6 -7
  109. package/lib/engine-components/Component.js.map +1 -1
  110. package/lib/engine-components/ContactShadows.d.ts +1 -1
  111. package/lib/engine-components/ContactShadows.js +7 -0
  112. package/lib/engine-components/ContactShadows.js.map +1 -1
  113. package/lib/engine-components/FlyControls.d.ts +10 -0
  114. package/lib/engine-components/FlyControls.js +29 -0
  115. package/lib/engine-components/FlyControls.js.map +1 -0
  116. package/lib/engine-components/GroundProjection.d.ts +1 -1
  117. package/lib/engine-components/GroundProjection.js +39 -32
  118. package/lib/engine-components/GroundProjection.js.map +1 -1
  119. package/lib/engine-components/OrbitControls.js +9 -1
  120. package/lib/engine-components/OrbitControls.js.map +1 -1
  121. package/lib/engine-components/RigidBody.d.ts +1 -0
  122. package/lib/engine-components/RigidBody.js +11 -4
  123. package/lib/engine-components/RigidBody.js.map +1 -1
  124. package/lib/engine-components/SceneSwitcher.d.ts +1 -1
  125. package/lib/engine-components/SceneSwitcher.js +1 -1
  126. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  127. package/lib/engine-components/SpatialTrigger.d.ts +2 -2
  128. package/lib/engine-components/SpatialTrigger.js +4 -4
  129. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  130. package/lib/engine-components/TransformGizmo.d.ts +7 -1
  131. package/lib/engine-components/TransformGizmo.js +39 -32
  132. package/lib/engine-components/TransformGizmo.js.map +1 -1
  133. package/lib/engine-components/VideoPlayer.js +0 -1
  134. package/lib/engine-components/VideoPlayer.js.map +1 -1
  135. package/lib/engine-components/export/gltf/GltfExport.js +23 -4
  136. package/lib/engine-components/export/gltf/GltfExport.js.map +1 -1
  137. package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +1 -1
  138. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +2 -2
  139. package/lib/engine-components/export/usdz/index.d.ts +1 -1
  140. package/lib/engine-components/export/usdz/index.js +1 -1
  141. package/lib/engine-components/export/usdz/index.js.map +1 -1
  142. package/lib/engine-components/particlesystem/ParticleSystem.d.ts +5 -6
  143. package/lib/engine-components/particlesystem/ParticleSystem.js +23 -9
  144. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  145. package/lib/engine-components/particlesystem/ParticleSystemModules.js +8 -2
  146. package/lib/engine-components/particlesystem/ParticleSystemModules.js.map +1 -1
  147. package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -1
  148. package/lib/engine-components/postprocessing/Effects/BloomEffect.js.map +1 -1
  149. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -1
  150. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
  151. package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
  152. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -1
  153. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js.map +1 -1
  154. package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +2 -0
  155. package/lib/engine-components/postprocessing/Effects/Sharpening.js +15 -6
  156. package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
  157. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js.map +1 -1
  158. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
  159. package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -1
  160. package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
  161. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  162. package/lib/engine-components/webxr/Avatar.js +3 -3
  163. package/lib/engine-components/webxr/Avatar.js.map +1 -1
  164. package/lib/engine-components/webxr/WebXR.js +22 -13
  165. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  166. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +4 -0
  167. package/lib/engine-components/webxr/WebXRImageTracking.js +14 -4
  168. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  169. package/lib/engine-components/webxr/WebXRRig.d.ts +11 -1
  170. package/lib/engine-components/webxr/WebXRRig.js +13 -1
  171. package/lib/engine-components/webxr/WebXRRig.js.map +1 -1
  172. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +4 -1
  173. package/lib/engine-components-experimental/networking/PlayerSync.js +18 -30
  174. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  175. package/lib/needle-engine.js +5 -5
  176. package/lib/needle-engine.js.map +1 -1
  177. package/package.json +14 -8
  178. package/plugins/common/config.cjs +22 -6
  179. package/plugins/common/config.js +27 -11
  180. package/plugins/next/next.js +47 -4
  181. package/plugins/vite/transform.js +3 -3
  182. package/src/engine/assets/index.ts +1 -0
  183. package/src/engine/codegen/register_types.ts +2 -2
  184. package/src/engine/engine_addressables.ts +19 -12
  185. package/src/engine/engine_context.ts +33 -8
  186. package/src/engine/engine_gameobject.ts +12 -16
  187. package/src/engine/engine_gltf_builtin_components.ts +7 -1
  188. package/src/engine/engine_input.ts +12 -5
  189. package/src/engine/engine_license.ts +2 -1
  190. package/src/engine/engine_modules.ts +7 -0
  191. package/src/engine/engine_networking_auto.ts +7 -22
  192. package/src/engine/engine_networking_instantiate.ts +1 -1
  193. package/src/engine/engine_physics_rapier.ts +48 -26
  194. package/src/engine/engine_scenetools.ts +6 -2
  195. package/src/engine/engine_types.ts +10 -2
  196. package/src/engine/export/gltf/Writers.ts +0 -1
  197. package/src/engine/export/gltf/index.ts +13 -3
  198. package/src/engine/export/index.ts +1 -1
  199. package/src/engine/export/utils.ts +10 -0
  200. package/src/engine/extensions/NEEDLE_gameobject_data.ts +1 -2
  201. package/src/engine/js-extensions/Object3D.ts +6 -1
  202. package/src/engine/webcomponents/needle menu/needle-menu.ts +16 -10
  203. package/src/engine/xr/NeedleXRSession.ts +4 -1
  204. package/src/engine-components/AvatarLoader.ts +1 -1
  205. package/src/engine-components/Camera.ts +14 -11
  206. package/src/engine-components/Collider.ts +4 -4
  207. package/src/engine-components/Component.ts +13 -7
  208. package/src/engine-components/ContactShadows.ts +11 -2
  209. package/src/engine-components/GroundProjection.ts +46 -38
  210. package/src/engine-components/OrbitControls.ts +9 -1
  211. package/src/engine-components/RigidBody.ts +13 -5
  212. package/src/engine-components/SceneSwitcher.ts +1 -1
  213. package/src/engine-components/SpatialTrigger.ts +6 -6
  214. package/src/engine-components/TransformGizmo.ts +41 -33
  215. package/src/engine-components/VideoPlayer.ts +0 -1
  216. package/src/engine-components/export/gltf/GltfExport.ts +26 -6
  217. package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +2 -2
  218. package/src/engine-components/export/usdz/index.ts +1 -1
  219. package/src/engine-components/particlesystem/ParticleSystem.ts +26 -10
  220. package/src/engine-components/particlesystem/ParticleSystemModules.ts +10 -3
  221. package/src/engine-components/postprocessing/Effects/Antialiasing.ts +0 -1
  222. package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -1
  223. package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +1 -1
  224. package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +1 -1
  225. package/src/engine-components/postprocessing/Effects/Pixelation.ts +1 -1
  226. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +1 -1
  227. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +1 -1
  228. package/src/engine-components/postprocessing/Effects/Sharpening.ts +17 -7
  229. package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +0 -1
  230. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +1 -1
  231. package/src/engine-components/postprocessing/Effects/Vignette.ts +1 -1
  232. package/src/engine-components/postprocessing/PostProcessingHandler.ts +2 -3
  233. package/src/engine-components/webxr/Avatar.ts +3 -3
  234. package/src/engine-components/webxr/WebXR.ts +23 -14
  235. package/src/engine-components/webxr/WebXRImageTracking.ts +23 -8
  236. package/src/engine-components/webxr/WebXRRig.ts +15 -2
  237. package/src/engine-components-experimental/networking/PlayerSync.ts +18 -37
  238. package/src/needle-engine.ts +5 -5
@@ -1,35 +1,35 @@
1
- import { B as he, M as H, a as We, T as j, b as ze, V as $, 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,43 +94,40 @@ 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(), N = "NEEDLE_progressive", y = oe("debugprogressive"), _e = Symbol("needle-progressive-texture"), ie = /* @__PURE__ */ new Map(), we = /* @__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 = S.getMeshLODInformation(a), l = c ? Math.min(e, c.lods.length) : 0;
116
- r["DEBUG:LOD"] = e, S.assignMeshLOD(r, l), c && (s = Math.max(s, c.lods.length - 1));
117
- } else if (r.isMaterial === !0) {
118
- r["DEBUG:LOD"] = e, S.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;
125
122
  window.addEventListener("keyup", (i) => {
126
- i.key === "p" && t(), i.key === "w" && (n = !n, we && we.forEach((r) => {
123
+ i.key === "p" && t(), i.key === "w" && (n = !n, ve && ve.forEach((r) => {
127
124
  r.name != "BackgroundCubeMaterial" && r.glyphMap == null && "wireframe" in r && (r.wireframe = n);
128
125
  }));
129
126
  });
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);
@@ -142,16 +139,16 @@ const D = class {
142
139
  var i, r;
143
140
  if (this._isLoadingMesh)
144
141
  return null;
145
- const n = (r = (i = this.parser.json.meshes[s]) == null ? void 0 : i.extensions) == null ? void 0 : r[N];
142
+ const n = (r = (i = this.parser.json.meshes[s]) == null ? void 0 : i.extensions) == null ? void 0 : r[$];
146
143
  return n ? (this._isLoadingMesh = !0, this.parser.getDependency("mesh", s).then((o) => {
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() {
154
- return N;
151
+ return $;
155
152
  }
156
153
  static getMeshLODInformation(t) {
157
154
  const e = this.getAssignedLODInformation(t);
@@ -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 && we.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
- const o = n == null ? void 0 : n.extensions[N];
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;
@@ -371,7 +368,7 @@ const D = class {
371
368
  }
372
369
  }), (s = this.parser.json.meshes) == null || s.forEach((n, i) => {
373
370
  if (n != null && n.extensions) {
374
- const r = n == null ? void 0 : n.extensions[N];
371
+ const r = n == null ? void 0 : n.extensions[$];
375
372
  if (r && r.lods) {
376
373
  for (const o of this.parser.associations.keys())
377
374
  if (o.isMesh) {
@@ -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;
@@ -395,107 +392,107 @@ const D = class {
395
392
  }
396
393
  if (r || (r = D.lodInfos.get(i)), r) {
397
394
  if (e > 0) {
398
- let m = !1;
395
+ let x = !1;
399
396
  const L = Array.isArray(r.lods);
400
- if (L && e >= r.lods.length ? m = !0 : L || (m = !0), m)
397
+ if (L && e >= r.lods.length ? x = !0 : L || (x = !0), x)
401
398
  return this.lowresCache.get(i);
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;
410
- const m = h + "_" + r.guid, L = this.previouslyLoaded.get(m);
407
+ const x = h + "_" + r.guid, L = this.previouslyLoaded.get(x);
411
408
  if (L !== void 0) {
412
- s && console.log(`LOD ${e} was already loading/loaded: ${m}`);
409
+ s && console.log(`LOD ${e} was already loading/loaded: ${x}`);
413
410
  let f = await L.catch((I) => (console.error(`Error loading LOD ${e} from ${h}
414
411
  `, I), null)), w = !1;
415
- if (f == null || (f instanceof j && t instanceof j ? (a = f.image) != null && a.data || (c = f.source) != null && c.data ? f = this.copySettings(t, f) : (w = !0, this.previouslyLoaded.delete(m)) : f instanceof he && t instanceof he && ((l = f.attributes.position) != null && l.array || (w = !0, this.previouslyLoaded.delete(m)))), !w)
412
+ if (f == null || (f instanceof j && t instanceof j ? (a = f.image) != null && a.data || (c = f.source) != null && c.data ? f = this.copySettings(t, f) : (w = !0, this.previouslyLoaded.delete(x)) : f instanceof he && t instanceof he && ((l = f.attributes.position) != null && l.array || (w = !0, this.previouslyLoaded.delete(x)))), !w)
416
413
  return f;
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((T) => setTimeout(T, 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
- const T = M.lods[e];
424
- T.hash && (k += "?v=" + T.hash);
420
+ const O = M.lods[e];
421
+ O.hash && (k += "?v=" + O.hash);
425
422
  }
426
- const v = await I.loadAsync(k).catch((T) => (console.error(`Error loading LOD ${e} from ${h}
427
- `, T), null));
428
- if (!v)
423
+ const E = await I.loadAsync(k).catch((O) => (console.error(`Error loading LOD ${e} from ${h}
424
+ `, O), null));
425
+ if (!E)
429
426
  return null;
430
- const U = v.parser;
427
+ const G = E.parser;
431
428
  s && console.log("Loading finished " + h, M.guid);
432
- let E = 0;
433
- if (v.parser.json.textures) {
434
- let T = !1;
435
- for (const u of v.parser.json.textures) {
429
+ let v = 0;
430
+ if (E.parser.json.textures) {
431
+ let O = !1;
432
+ for (const u of E.parser.json.textures) {
436
433
  if (u != null && u.extensions) {
437
- const g = u == null ? void 0 : u.extensions[N];
434
+ const g = u == null ? void 0 : u.extensions[$];
438
435
  if (g != null && g.guid && g.guid === M.guid) {
439
- T = !0;
436
+ O = !0;
440
437
  break;
441
438
  }
442
439
  }
443
- E++;
440
+ v++;
444
441
  }
445
- if (T) {
446
- let u = await U.getDependency("texture", E);
447
- return u && D.assignLODInformation(n.url, u, i, e, void 0, void 0), s && console.log('change "' + t.name + '" → "' + u.name + '"', h, E, u, m), t instanceof j && (u = this.copySettings(t, u)), u && (u.guid = M.guid), f(u);
442
+ if (O) {
443
+ let u = await G.getDependency("texture", v);
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, v.parser.json);
446
+ p && console.warn("Could not find texture with guid", M.guid, E.parser.json);
450
447
  }
451
- if (E = 0, v.parser.json.meshes) {
452
- let T = !1;
453
- for (const u of v.parser.json.meshes) {
448
+ if (v = 0, E.parser.json.meshes) {
449
+ let O = !1;
450
+ for (const u of E.parser.json.meshes) {
454
451
  if (u != null && u.extensions) {
455
- const g = u == null ? void 0 : u.extensions[N];
452
+ const g = u == null ? void 0 : u.extensions[$];
456
453
  if (g != null && g.guid && g.guid === M.guid) {
457
- T = !0;
454
+ O = !0;
458
455
  break;
459
456
  }
460
457
  }
461
- E++;
458
+ v++;
462
459
  }
463
- if (T) {
464
- const u = await U.getDependency("mesh", E), g = M;
465
- if (s && console.log(`Loaded Mesh "${u.name}"`, h, E, u, m), u.isMesh === !0) {
460
+ if (O) {
461
+ const u = await G.getDependency("mesh", v), g = M;
462
+ if (s && console.log(`Loaded Mesh "${u.name}"`, h, v, u, x), u.isMesh === !0) {
466
463
  const _ = u.geometry;
467
464
  return D.assignLODInformation(n.url, _, i, e, void 0, g.density), f(_);
468
465
  } else {
469
466
  const _ = new Array();
470
- for (let O = 0; O < u.children.length; O++) {
471
- const A = u.children[O];
472
- if (A.isMesh === !0) {
473
- const W = A.geometry;
474
- D.assignLODInformation(n.url, W, i, e, O, g.density), _.push(W);
467
+ for (let S = 0; S < u.children.length; S++) {
468
+ const T = u.children[S];
469
+ if (T.isMesh === !0) {
470
+ const W = T.geometry;
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, v.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
- return this.previouslyLoaded.set(m, P), await P;
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 S = D;
513
- S.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
- S.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
- S.lodInfos = /* @__PURE__ */ new Map();
537
- S.previouslyLoaded = /* @__PURE__ */ new Map();
538
- S.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
- }, G = (t, e, s, n) => (Ge(t, e, "write to private field"), n ? n.call(t, s) : e.set(t, s), s), b, z, ve, 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, b, 1), this.pause = !1, this.manual = !1, this._lodchangedlisteners = [], K(this, z, void 0), K(this, ve, 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 $(), this._tempBoxSize = new $(), this._tempBox2Size = new $(), 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
- G(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, G(e, Q, p(e, Q) + 1), G(e, re, p(e, ve).getDelta()), G(e, de, p(e, de) + p(e, re)), e._fpsBuffer.shift(), e._fpsBuffer.push(1 / p(e, re)), G(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, b)));
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), G(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, b) < 10 ? (G(this, b, p(this, b) + 1), B && console.warn("↓ Reducing LOD updates", p(this, b), p(this, V).toFixed(0))) : p(this, V) >= 60 && p(this, b) > 1 && (G(this, b, p(this, b) - 1), B && console.warn("↑ Increasing LOD updates", p(this, b), p(this, V).toFixed(0))) : G(this, b, this.updateInterval), p(this, b) > 0 && p(this, Q) % p(this, b) != 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, m = new qe({ color: h });
658
- l.object.material = m;
654
+ const h = Math.random() * 16777215, x = new Ve({ color: h });
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, S.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 S.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,8 +739,8 @@ 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 = S.getMeshLODInformation(e.geometry), l = c == null ? void 0 : c.lods, d = l && l.length > 0, h = S.getMaterialMinMaxLODsCount(e.material), m = (h == null ? void 0 : h.min_count) != 1 / 0 && h.min_count > 0 && h.max_count > 0;
745
- if (!d && !m) {
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;
743
+ if (!d && !x) {
746
744
  i.mesh_lod = 0, i.texture_lod = 0;
747
745
  return;
748
746
  }
@@ -750,17 +748,17 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
750
748
  const L = this.renderer.domElement.clientHeight || this.renderer.domElement.height;
751
749
  let M = e.geometry.boundingBox;
752
750
  if (e.type === "SkinnedMesh") {
753
- const x = e;
754
- if (!x.boundingBox)
755
- x.computeBoundingBox();
751
+ const m = e;
752
+ if (!m.boundingBox)
753
+ m.computeBoundingBox();
756
754
  else if (s.frames % 30 === 0) {
757
- const f = ae(x), w = x.geometry;
758
- f && (x.geometry = f), x.computeBoundingBox(), x.geometry = w;
755
+ const f = ae(m), w = m.geometry;
756
+ f && (m.geometry = f), m.computeBoundingBox(), m.geometry = w;
759
757
  }
760
- M = x.boundingBox;
758
+ M = m.boundingBox;
761
759
  }
762
- if (M && t.isPerspectiveCamera) {
763
- const x = t;
760
+ if (M) {
761
+ const m = t;
764
762
  if (e.geometry.attributes.color && e.geometry.attributes.color.count < 100 && e.geometry.boundingSphere) {
765
763
  this._sphere.copy(e.geometry.boundingSphere), this._sphere.applyMatrix4(e.matrixWorld);
766
764
  const u = t.getWorldPosition(this._tempWorldPosition);
@@ -769,48 +767,48 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
769
767
  return;
770
768
  }
771
769
  }
772
- if (this._tempBox.copy(M), this._tempBox.applyMatrix4(e.matrixWorld), C.isInside(this._tempBox, this.projectionScreenMatrix)) {
770
+ if (this._tempBox.copy(M), this._tempBox.applyMatrix4(e.matrixWorld), m.isPerspectiveCamera && C.isInside(this._tempBox, this.projectionScreenMatrix)) {
773
771
  i.mesh_lod = 0, i.texture_lod = 0;
774
772
  return;
775
773
  }
776
- if (this._tempBox.applyMatrix4(this.projectionScreenMatrix), this.renderer.xr.enabled && x.fov > 70) {
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, O = 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, O = (O - 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 = O < 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;
785
783
  const f = this._tempBox.getSize(this._tempBoxSize);
786
- f.multiplyScalar(0.5), screen.availHeight > 0 && L > 0 && f.multiplyScalar(L / screen.availHeight), f.x *= x.aspect;
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), v = Math.max(k.x, k.y);
790
- if (Math.max(f.x, f.y) != 0 && v != 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, O = C.corner2, A = C.corner3;
794
- g.copy(this._tempBox.min), _.copy(this._tempBox.max), _.x = g.x, O.copy(this._tempBox.max), O.y = g.y, A.copy(this._tempBox.max);
795
- const W = (g.z + A.z) * 0.5;
796
- g.z = _.z = O.z = A.z = W, g.applyMatrix4(u), _.applyMatrix4(u), O.applyMatrix4(u), A.applyMatrix4(u), C.debugDrawLine(g, _, 255), C.debugDrawLine(g, O, 255), C.debugDrawLine(_, A, 255), C.debugDrawLine(O, 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
- let E = 999;
796
+ let v = 999;
799
797
  if (l && s.lastScreenCoverage > 0) {
800
798
  for (let u = 0; u < l.length; u++)
801
799
  if (l[u].density / s.lastScreenCoverage < n) {
802
- E = u;
800
+ v = u;
803
801
  break;
804
802
  }
805
803
  }
806
- E < o && (o = E, a = !0);
804
+ v < o && (o = v, a = !0);
807
805
  }
808
806
  if (a ? i.mesh_lod = o : i.mesh_lod = s.lastLodLevel_Mesh, B && i.mesh_lod != s.lastLodLevel_Mesh) {
809
807
  const f = l == null ? void 0 : l[i.mesh_lod];
810
808
  f && console.log(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${i.mesh_lod} (${f.density.toFixed(0)}) - ${e.name}`);
811
809
  }
812
- if (m) {
813
- const x = "saveData" in globalThis.navigator && globalThis.navigator.saveData === !0;
810
+ if (x) {
811
+ const m = "saveData" in globalThis.navigator && globalThis.navigator.saveData === !0;
814
812
  if (s.lastLodLevel_Texture < 0) {
815
813
  if (i.texture_lod = h.max_count - 1, B) {
816
814
  const f = h.lods[h.max_count - 1];
@@ -821,12 +819,13 @@ 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
- for (let v = h.lods.length - 1; v >= 0; v--) {
825
- let U = h.lods[v];
826
- if (!(x && U.max_height >= 2048) && !(tt() && U.max_height > 4096) && U.max_height > k) {
827
- if (i.texture_lod = v, i.texture_lod < s.lastLodLevel_Texture) {
828
- const E = U.max_height;
829
- B && console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${i.texture_lod} = ${E}px
822
+ let E = !1;
823
+ for (let G = h.lods.length - 1; G >= 0; G--) {
824
+ let v = h.lods[G];
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) {
827
+ const O = v.max_height;
828
+ B && console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${i.texture_lod} = ${O}px
830
829
  Screensize: ${k.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${f.toFixed(1)}
831
830
  ${e.name}`);
832
831
  }
@@ -838,28 +837,28 @@ ${e.name}`);
838
837
  i.texture_lod = 0;
839
838
  }
840
839
  };
841
- let F = C;
840
+ let U = C;
842
841
  b = /* @__PURE__ */ new WeakMap();
843
- z = /* @__PURE__ */ new WeakMap();
844
- ve = /* @__PURE__ */ new WeakMap();
842
+ V = /* @__PURE__ */ new WeakMap();
843
+ we = /* @__PURE__ */ new WeakMap();
845
844
  Q = /* @__PURE__ */ new WeakMap();
846
845
  re = /* @__PURE__ */ new WeakMap();
847
846
  de = /* @__PURE__ */ new WeakMap();
848
- V = /* @__PURE__ */ new WeakMap();
849
- F.corner0 = new $();
850
- F.corner1 = new $();
851
- F.corner2 = new $();
852
- F.corner3 = new $();
853
- F._tempPtInside = new $();
854
- class lt {
847
+ q = /* @__PURE__ */ new WeakMap();
848
+ U.corner0 = new F();
849
+ U.corner1 = new F();
850
+ U.corner2 = new F();
851
+ U.corner3 = new F();
852
+ U._tempPtInside = new F();
853
+ class at {
855
854
  constructor() {
856
- this.frames = 0, this.lastLodLevel_Mesh = -1, this.lastLodLevel_Texture = -1, this.lastScreenCoverage = 0, this.lastScreenspaceVolume = new $(), this.lastCentrality = 0;
855
+ this.frames = 0, this.lastLodLevel_Mesh = -1, this.lastLodLevel_Texture = -1, this.lastScreenCoverage = 0, this.lastScreenspaceVolume = new F(), this.lastCentrality = 0;
857
856
  }
858
857
  }
859
858
  const Te = Symbol("NEEDLE_mesh_lod"), fe = Symbol("NEEDLE_texture_lod");
860
859
  let se = null;
861
860
  function Ne() {
862
- const t = ct();
861
+ const t = lt();
863
862
  t && (t.mapURLs(function(e) {
864
863
  return Ae(), e;
865
864
  }), Ae(), se == null || se.disconnect(), se = new MutationObserver((e) => {
@@ -870,7 +869,7 @@ function Ne() {
870
869
  });
871
870
  }), se.observe(document, { childList: !0, subtree: !0 }));
872
871
  }
873
- function ct() {
872
+ function lt() {
874
873
  if (typeof customElements > "u")
875
874
  return null;
876
875
  const t = customElements.get("model-viewer");
@@ -886,11 +885,11 @@ function Ae() {
886
885
  });
887
886
  }
888
887
  const Ce = /* @__PURE__ */ new WeakSet();
889
- let ut = 0;
888
+ let ct = 0;
890
889
  function $e(t) {
891
890
  if (!t || Ce.has(t))
892
891
  return null;
893
- 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 + `
894
893
  `, t.getAttribute("src"));
895
894
  let e = null, s = null, n = null;
896
895
  for (let i = t; i != null; i = Object.getPrototypeOf(i)) {
@@ -910,8 +909,8 @@ function $e(t) {
910
909
  }
911
910
  };
912
911
  console.debug("[gltf-progressive] setup model-viewer");
913
- const r = F.get(e, { engine: "model-viewer" });
914
- return F.addPlugin(new ft()), r.enable(), r.addEventListener("changed", () => {
912
+ const r = U.get(e, { engine: "model-viewer" });
913
+ return U.addPlugin(new ut()), r.enable(), r.addEventListener("changed", () => {
915
914
  n == null || n.call(t);
916
915
  }), t.addEventListener("model-visibility", (o) => {
917
916
  o.detail.visible && (n == null || n.call(t));
@@ -923,7 +922,7 @@ function $e(t) {
923
922
  }
924
923
  return null;
925
924
  }
926
- class ft {
925
+ class ut {
927
926
  constructor() {
928
927
  this._didWarnAboutMissingUrl = !1;
929
928
  }
@@ -949,7 +948,7 @@ class ft {
949
948
  const n = this.tryGetCurrentGLTF(e), i = this.tryGetCurrentModelViewer(e), r = this.getUrl(i);
950
949
  if (r && n && s.material) {
951
950
  let o = function(c) {
952
- var d, h, m;
951
+ var d, h, x;
953
952
  if (c[fe] == !0)
954
953
  return;
955
954
  c[fe] = !0, c.userData && (c.userData.LOD = -1);
@@ -957,17 +956,17 @@ class ft {
957
956
  for (let L = 0; L < l.length; L++) {
958
957
  const M = l[L], P = c[M];
959
958
  if ((P == null ? void 0 : P.isTexture) === !0) {
960
- const x = (h = (d = P.userData) == null ? void 0 : d.associations) == null ? void 0 : h.textures;
961
- if (x == null)
959
+ const m = (h = (d = P.userData) == null ? void 0 : d.associations) == null ? void 0 : h.textures;
960
+ if (m == null)
962
961
  continue;
963
- const f = n.parser.json.textures[x];
962
+ const f = n.parser.json.textures[m];
964
963
  if (!f) {
965
- console.warn("Texture data not found for texture index " + x);
964
+ console.warn("Texture data not found for texture index " + m);
966
965
  continue;
967
966
  }
968
- if ((m = f == null ? void 0 : f.extensions) != null && m[N]) {
969
- const w = f.extensions[N];
970
- w && r && S.registerTexture(r, P, w.lods.length, x, w);
967
+ if ((x = f == null ? void 0 : f.extensions) != null && x[$]) {
968
+ const w = f.extensions[$];
969
+ w && r && A.registerTexture(r, P, w.lods.length, m, w);
971
970
  }
972
971
  }
973
972
  }
@@ -988,30 +987,30 @@ class ft {
988
987
  const n = this.tryGetCurrentModelViewer(e), i = this.getUrl(n);
989
988
  if (!i)
990
989
  return;
991
- const r = (a = (o = s.userData) == null ? void 0 : o.gltfExtensions) == null ? void 0 : a[N];
990
+ const r = (a = (o = s.userData) == null ? void 0 : o.gltfExtensions) == null ? void 0 : a[$];
992
991
  if (r && i) {
993
992
  const c = s.uuid;
994
- S.registerMesh(i, c, s, 0, r.lods.length, r);
993
+ A.registerMesh(i, c, s, 0, r.lods.length, r);
995
994
  }
996
995
  }
997
996
  }
998
- function dt(t, e, s, n) {
997
+ function ft(t, e, s, n) {
999
998
  Be(e), Re(s), Ie(s, {
1000
999
  progressive: !0,
1001
1000
  ...n == null ? void 0 : n.hints
1002
- }), s.register((r) => new S(r, t));
1003
- const i = F.get(e);
1001
+ }), s.register((r) => new A(r, t));
1002
+ const i = U.get(e);
1004
1003
  return (n == null ? void 0 : n.enableLODsManager) !== !1 && i.enable(), i;
1005
1004
  }
1006
1005
  Ne();
1007
- if (!st) {
1006
+ if (!tt) {
1008
1007
  const t = {
1009
1008
  gltfProgressive: {
1010
- useNeedleProgressive: dt,
1011
- LODsManager: F,
1009
+ useNeedleProgressive: ft,
1010
+ LODsManager: U,
1012
1011
  configureLoader: Ie,
1013
1012
  getRaycastMesh: ae,
1014
- useRaycastMeshes: it
1013
+ useRaycastMeshes: rt
1015
1014
  }
1016
1015
  };
1017
1016
  if (!globalThis.Needle)
@@ -1021,12 +1020,12 @@ if (!st) {
1021
1020
  globalThis.Needle[e] = t[e];
1022
1021
  }
1023
1022
  export {
1024
- F as L,
1025
- S as N,
1023
+ U as L,
1024
+ A as N,
1026
1025
  Re as a,
1027
1026
  Ie as b,
1028
1027
  Be as c,
1029
- yt as d,
1028
+ pt as d,
1030
1029
  ae as g,
1031
- pt as s
1030
+ gt as s
1032
1031
  };