aptechka 0.5.44 → 0.7.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 (234) hide show
  1. package/lib/Animation-6Na1MCtM.cjs +1 -0
  2. package/lib/Animation-CELiTw3n.js +132 -0
  3. package/lib/Composed-DmLYTh1b.js +35 -0
  4. package/lib/Composed-Dx2hs-va.cjs +1 -0
  5. package/lib/{Damped-P4MkCGoY.js → Damped-Mx_FNNVz.js} +2 -5
  6. package/lib/Damped-loFiBsBy.cjs +1 -0
  7. package/lib/{Derived-kPJs5JC5.js → Derived-DlCvc0xQ.js} +1 -1
  8. package/lib/{Derived-B-g8dYgh.cjs → Derived-a6MDQEPY.cjs} +1 -1
  9. package/lib/ElementConstructor-CAZ2ra8m.cjs +1 -0
  10. package/lib/ElementConstructor-OYlPJf2L.js +366 -0
  11. package/lib/Resource-D3TQormz.cjs +1 -0
  12. package/lib/Resource-DIcoALGo.js +64 -0
  13. package/lib/{SourceManager-Q-PB-Rkh.js → SourceManager-Bz329f90.js} +1 -1
  14. package/lib/{SourceManager-vSlsMKUE.cjs → SourceManager-kxr5eUyL.cjs} +1 -1
  15. package/lib/Store-6s0YXK4o.cjs +1 -0
  16. package/lib/{Store-BQXXikps.js → Store-BI2xxXOA.js} +42 -42
  17. package/lib/Tweened-B_mclQ61.cjs +1 -0
  18. package/lib/Tweened-NE8M9onF.js +48 -0
  19. package/lib/{Viewport-DMB0dO-s.cjs → Viewport-CJeKnL5V.cjs} +1 -1
  20. package/lib/{Viewport-CFFhFKqX.js → Viewport-D9IL7kUQ.js} +1 -1
  21. package/lib/_createStore-Cf1MyeHa.cjs +1 -0
  22. package/lib/_createStore-Ck9bHolX.js +12 -0
  23. package/lib/accordion/AccordionElement.d.ts +3 -0
  24. package/lib/accordion/index.cjs +1 -1
  25. package/lib/accordion/index.js +140 -104
  26. package/lib/animation/Animation.d.ts +10 -18
  27. package/lib/animation/Damped.d.ts +3 -5
  28. package/lib/animation/Tweened.d.ts +0 -2
  29. package/lib/animation/index.cjs +1 -1
  30. package/lib/animation/index.js +3 -3
  31. package/lib/attribute/index.cjs +1 -1
  32. package/lib/attribute/index.js +31 -31
  33. package/lib/canvas/index.cjs +1 -1
  34. package/lib/canvas/index.js +3 -3
  35. package/lib/checkbox/index.cjs +1 -1
  36. package/lib/checkbox/index.js +3 -3
  37. package/lib/class-linked-status/index.cjs +1 -1
  38. package/lib/class-linked-status/index.js +1 -1
  39. package/lib/controls/index.cjs +1 -1
  40. package/lib/controls/index.js +3 -3
  41. package/lib/counter/index.d.ts +8 -0
  42. package/lib/{createStylesheet-DBCEbDjI.js → createStylesheet-CR_yi5tp.js} +1 -1
  43. package/lib/{createStylesheet-CqHU9_qv.cjs → createStylesheet-p23sZ7Ey.cjs} +1 -1
  44. package/lib/css-property/index.cjs +1 -1
  45. package/lib/css-property/index.d.ts +1 -0
  46. package/lib/css-property/index.js +36 -32
  47. package/lib/dev/index.cjs +1 -1
  48. package/lib/dev/index.js +1 -1
  49. package/lib/device/index.cjs +1 -1
  50. package/lib/device/index.js +1 -1
  51. package/lib/element-constructor/index.cjs +1 -1
  52. package/lib/element-constructor/index.js +114 -113
  53. package/lib/en3/core/En3Raycaster.d.ts +20 -0
  54. package/lib/en3/core/En3View.d.ts +1 -1
  55. package/lib/en3/core/en3.d.ts +5 -1
  56. package/lib/en3/helpers/En3Controls.d.ts +5 -0
  57. package/lib/en3/helpers/En3GridHelper.d.ts +8 -0
  58. package/lib/en3/helpers/En3Object3dManager.d.ts +12 -0
  59. package/lib/en3/helpers/En3OrbitControls.d.ts +8 -0
  60. package/lib/en3/helpers/En3TransformControls.d.ts +8 -0
  61. package/lib/en3/helpers/index.cjs +1 -0
  62. package/lib/en3/helpers/index.d.ts +2 -0
  63. package/lib/en3/helpers/index.js +1165 -0
  64. package/lib/en3/index.cjs +1 -213
  65. package/lib/en3/index.d.ts +1 -19
  66. package/lib/en3/index.js +4 -3305
  67. package/lib/en3/libs/index.d.ts +1 -0
  68. package/lib/en3/loaders/{en3GLTFLoader.d.ts → _En3GLTFLoader.d.ts} +2 -4
  69. package/lib/en3/loaders/_En3TextureLoader.d.ts +8 -0
  70. package/lib/en3/loaders/index.cjs +1 -0
  71. package/lib/en3/loaders/index.d.ts +3 -0
  72. package/lib/en3/loaders/index.js +1757 -0
  73. package/lib/en3/loaders/loaders.d.ts +13 -0
  74. package/lib/en3/misc/index.cjs +10 -0
  75. package/lib/en3/misc/index.d.ts +2 -0
  76. package/lib/en3/misc/index.js +115 -0
  77. package/lib/en3/objects/En3Clip.d.ts +1 -1
  78. package/lib/en3/objects/En3GLTF.d.ts +2 -1
  79. package/lib/en3/objects/En3ImageLike.d.ts +2 -1
  80. package/lib/en3/objects/En3SourceConsumer.d.ts +1 -1
  81. package/lib/en3/objects/fluid/index.d.ts +0 -3
  82. package/lib/en3/objects/index.d.ts +7 -0
  83. package/lib/en3/utils/index.cjs +1 -0
  84. package/lib/en3/utils/index.d.ts +5 -0
  85. package/lib/en3/utils/index.js +43 -0
  86. package/lib/en3-C4mzaF6q.cjs +8 -0
  87. package/lib/en3-hbkN1OPu.js +343 -0
  88. package/lib/globals-DMjysUXI.js +8 -0
  89. package/lib/globals-bYKki-b9.cjs +1 -0
  90. package/lib/image/index.cjs +1 -1
  91. package/lib/image/index.js +1 -1
  92. package/lib/{index-BN9X-l9M.js → index-BAH_fO2N.js} +3 -3
  93. package/lib/{index-BbgmbQ-5.cjs → index-D1LQUR-R.cjs} +1 -1
  94. package/lib/instantiate-D19Uvc31.js +125 -0
  95. package/lib/instantiate-Db5gGSYG.cjs +1 -0
  96. package/lib/jsx/ComponentElement.d.ts +18 -0
  97. package/lib/jsx/globals.d.ts +13 -0
  98. package/lib/jsx/h.d.ts +7 -0
  99. package/lib/jsx/hooks/basic/_createStore.d.ts +4 -0
  100. package/lib/jsx/hooks/basic/attachInternals.d.ts +1 -0
  101. package/lib/jsx/hooks/basic/attachShadow.d.ts +1 -0
  102. package/lib/jsx/hooks/basic/attachStylesheet.d.ts +3 -0
  103. package/lib/jsx/hooks/basic/createContext.d.ts +2 -0
  104. package/lib/jsx/hooks/basic/onConnect.d.ts +3 -0
  105. package/lib/jsx/hooks/basic/onDisconnect.d.ts +3 -0
  106. package/lib/jsx/hooks/onAnimationFrame.cjs +1 -0
  107. package/lib/jsx/hooks/onAnimationFrame.d.ts +6 -0
  108. package/lib/jsx/hooks/onAnimationFrame.js +22 -0
  109. package/lib/jsx/hooks/onElementResize.cjs +1 -0
  110. package/lib/jsx/hooks/onElementResize.d.ts +5 -0
  111. package/lib/jsx/hooks/onElementResize.js +11 -0
  112. package/lib/jsx/hooks/onIntersection.cjs +1 -0
  113. package/lib/jsx/hooks/onIntersection.d.ts +5 -0
  114. package/lib/jsx/hooks/onIntersection.js +11 -0
  115. package/lib/jsx/hooks/onWindowResize.cjs +1 -0
  116. package/lib/jsx/hooks/onWindowResize.d.ts +3 -0
  117. package/lib/jsx/hooks/onWindowResize.js +8 -0
  118. package/lib/jsx/hooks/store/createArrayStore.d.ts +3 -0
  119. package/lib/jsx/hooks/store/createComposed.d.ts +3 -0
  120. package/lib/jsx/hooks/store/createDerived.d.ts +3 -0
  121. package/lib/jsx/hooks/store/createDerivedArray.d.ts +3 -0
  122. package/lib/jsx/hooks/store/createDerivedComponent.d.ts +3 -0
  123. package/lib/jsx/hooks/store/createDerivedComponents.d.ts +3 -0
  124. package/lib/jsx/hooks/store/createResource.d.ts +3 -0
  125. package/lib/jsx/hooks/store/createStore.d.ts +3 -0
  126. package/lib/jsx/hooks/store/index.cjs +1 -0
  127. package/lib/jsx/hooks/store/index.d.ts +7 -0
  128. package/lib/jsx/hooks/store/index.js +49 -0
  129. package/lib/jsx/hooks/watchAttribute.cjs +1 -0
  130. package/lib/jsx/hooks/watchAttribute.d.ts +6 -0
  131. package/lib/jsx/hooks/watchAttribute.js +17 -0
  132. package/lib/jsx/hooks/watchCSSProperty.cjs +1 -0
  133. package/lib/jsx/hooks/watchCSSProperty.d.ts +7 -0
  134. package/lib/jsx/hooks/watchCSSProperty.js +17 -0
  135. package/lib/jsx/index.cjs +1 -0
  136. package/lib/jsx/index.d.ts +13 -0
  137. package/lib/jsx/index.js +91 -0
  138. package/lib/jsx/instantiate.d.ts +5 -0
  139. package/lib/jsx/register.d.ts +1 -0
  140. package/lib/jsx/render.d.ts +6 -0
  141. package/lib/jsx/type.d.ts +188 -0
  142. package/lib/ladder/index.cjs +1 -1
  143. package/lib/ladder/index.d.ts +2 -0
  144. package/lib/ladder/index.js +84 -66
  145. package/lib/layout-box/index.cjs +1 -1
  146. package/lib/layout-box/index.d.ts +9 -0
  147. package/lib/layout-box/index.js +190 -164
  148. package/lib/media/index.cjs +1 -1
  149. package/lib/media/index.js +1 -1
  150. package/lib/modal/index.cjs +1 -1
  151. package/lib/modal/index.js +7 -7
  152. package/lib/morph/Morph.d.ts +2 -2
  153. package/lib/morph/index.cjs +1 -1
  154. package/lib/morph/index.d.ts +1 -1
  155. package/lib/morph/index.js +135 -143
  156. package/lib/notifier/index.d.ts +2 -2
  157. package/lib/notifier/index.js +3 -1
  158. package/lib/onConnect-DGP866cj.cjs +1 -0
  159. package/lib/onConnect-y5DrxJ9P.js +7 -0
  160. package/lib/pointer/index.cjs +1 -1
  161. package/lib/pointer/index.js +2 -2
  162. package/lib/polyfills-CM4SCDTt.cjs +1 -0
  163. package/lib/polyfills-X6KXuHg-.js +33 -0
  164. package/lib/popover/index.cjs +1 -1
  165. package/lib/popover/index.js +2 -2
  166. package/lib/router/Router.d.ts +11 -3
  167. package/lib/router/index.cjs +1 -1
  168. package/lib/router/index.d.ts +1 -1
  169. package/lib/router/index.js +185 -165
  170. package/lib/scroll/ScrollElement.d.ts +2 -19
  171. package/lib/scroll/ScrollSection.d.ts +23 -0
  172. package/lib/scroll/index.cjs +1 -1
  173. package/lib/scroll/index.js +81 -77
  174. package/lib/select/index.cjs +1 -1
  175. package/lib/select/index.js +1 -1
  176. package/lib/sequence/index.cjs +1 -1
  177. package/lib/sequence/index.js +1 -1
  178. package/lib/source/index.cjs +1 -1
  179. package/lib/source/index.js +2 -2
  180. package/lib/store/ArrayStore.d.ts +21 -0
  181. package/lib/store/Store.d.ts +1 -7
  182. package/lib/store/index.cjs +1 -1
  183. package/lib/store/index.d.ts +2 -2
  184. package/lib/store/index.js +65 -139
  185. package/lib/tags-BqJKcIve.js +485 -0
  186. package/lib/tags-ld5jemJw.cjs +1 -0
  187. package/lib/theme/index.cjs +1 -1
  188. package/lib/theme/index.js +2 -2
  189. package/lib/tweaker/TweakerBooleanManagerElement.d.ts +1 -1
  190. package/lib/tweaker/TweakerColorManagerElement.d.ts +1 -1
  191. package/lib/tweaker/TweakerFolderElement.d.ts +2 -0
  192. package/lib/tweaker/TweakerLinkManagerElement.d.ts +1 -1
  193. package/lib/tweaker/TweakerNumberManagerElement.d.ts +4 -8
  194. package/lib/tweaker/TweakerSelectManagerElement.d.ts +1 -1
  195. package/lib/tweaker/TweakerStoreManagerElement.d.ts +7 -7
  196. package/lib/tweaker/TweakerStringManagerElement.d.ts +3 -5
  197. package/lib/tweaker/index.cjs +3 -3
  198. package/lib/tweaker/index.js +535 -412
  199. package/lib/tweaker/tweakerManagerConstructors.d.ts +2 -2
  200. package/lib/tweaker/tweakerStorage.d.ts +8 -1
  201. package/lib/url-C3dWnJQg.cjs +1 -0
  202. package/lib/url-DMNfW7uN.js +22 -0
  203. package/lib/utils/index.cjs +1 -1
  204. package/lib/utils/index.d.ts +1 -0
  205. package/lib/utils/index.js +39 -34
  206. package/lib/utils/number.d.ts +1 -0
  207. package/lib/utils/url.d.ts +9 -0
  208. package/lib/video/index.cjs +1 -1
  209. package/lib/video/index.js +1 -1
  210. package/package.json +107 -3
  211. package/lib/Animation-DDHjrbtL.cjs +0 -1
  212. package/lib/Animation-Dq_05jlR.js +0 -217
  213. package/lib/DRACOLoader-C2CFpMGS.cjs +0 -2
  214. package/lib/DRACOLoader-D2KY2dku.js +0 -241
  215. package/lib/Damped-l0mnlhar.cjs +0 -1
  216. package/lib/KTX2Loader-DdUl1XiY.cjs +0 -2
  217. package/lib/KTX2Loader-DqpAffDj.js +0 -536
  218. package/lib/Store-C-1ruEIm.cjs +0 -1
  219. package/lib/Tweened-CwDC2zl8.js +0 -51
  220. package/lib/Tweened-DIt9j9B-.cjs +0 -1
  221. package/lib/animation/AnimationLink.d.ts +0 -13
  222. package/lib/en3/loaders/en3TextureLoader.d.ts +0 -3
  223. package/lib/en3/test/En3HTML.d.ts +0 -10
  224. package/lib/polyfills-BA-CL_HF.js +0 -27
  225. package/lib/polyfills-DHs2SNbz.cjs +0 -1
  226. package/lib/store/CumulativeResource.d.ts +0 -13
  227. package/lib/tags-CMPg9ETZ.js +0 -848
  228. package/lib/tags-Djb6mb1o.cjs +0 -1
  229. package/lib/tweaker/TweakerRangeManagerElement.d.ts +0 -11
  230. /package/lib/en3/{loaders → core}/en3Cache.d.ts +0 -0
  231. /package/lib/{MeshoptDecoder-CMeN3oU0.cjs → en3/libs/index.cjs} +0 -0
  232. /package/lib/{MeshoptDecoder-6XfTpOG2.js → en3/libs/index.js} +0 -0
  233. /package/lib/en3/{test → misc}/En3ModifiedMaterial.d.ts +0 -0
  234. /package/lib/en3/{attachments → misc}/En3SourceManager.d.ts +0 -0
package/lib/en3/index.js CHANGED
@@ -1,3307 +1,6 @@
1
- var dn = Object.defineProperty, fn = Object.defineProperties;
2
- var pn = Object.getOwnPropertyDescriptors;
3
- var Ss = Object.getOwnPropertySymbols;
4
- var mn = Object.prototype.hasOwnProperty, gn = Object.prototype.propertyIsEnumerable;
5
- var Rs = (u, t, e) => t in u ? dn(u, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[t] = e, Q = (u, t) => {
6
- for (var e in t || (t = {}))
7
- mn.call(t, e) && Rs(u, e, t[e]);
8
- if (Ss)
9
- for (var e of Ss(t))
10
- gn.call(t, e) && Rs(u, e, t[e]);
11
- return u;
12
- }, xt = (u, t) => fn(u, pn(t));
13
- var is = (u, t, e) => {
14
- if (!t.has(u))
15
- throw TypeError("Cannot " + e);
16
- };
17
- var r = (u, t, e) => (is(u, t, "read from private field"), e ? e.call(u) : t.get(u)), m = (u, t, e) => {
18
- if (t.has(u))
19
- throw TypeError("Cannot add the same private member more than once");
20
- t instanceof WeakSet ? t.add(u) : t.set(u, e);
21
- }, x = (u, t, e, n) => (is(u, t, "write to private field"), n ? n.call(u, e) : t.set(u, e), e);
22
- var $ = (u, t, e) => (is(u, t, "access private method"), e);
23
- var rs = (u, t, e) => new Promise((n, s) => {
24
- var i = (a) => {
25
- try {
26
- c(e.next(a));
27
- } catch (l) {
28
- s(l);
29
- }
30
- }, o = (a) => {
31
- try {
32
- c(e.throw(a));
33
- } catch (l) {
34
- s(l);
35
- }
36
- }, c = (a) => a.done ? n(a.value) : Promise.resolve(a.value).then(i, o);
37
- c((e = e.apply(u, t)).next());
38
- });
39
- import { RESIZE_ORDER as Vs, TICK_ORDER as ws } from "../order/index.js";
40
- import { windowResizer as we } from "../window-resizer/index.js";
41
- import { ticker as be } from "../ticker/index.js";
42
- import { g as Ks } from "../dom-0S_WDL4g.js";
43
- import * as os from "three";
44
- import { Mesh as Ee, OrthographicCamera as qt, PerspectiveCamera as ps, Scene as js, REVISION as xn, WebGLRenderer as An, TextureLoader as Xs, TrianglesDrawMode as vn, TriangleFanDrawMode as ms, TriangleStripDrawMode as Ws, Loader as yn, LoaderUtils as Tt, FileLoader as Ys, Color as B, LinearSRGBColorSpace as ae, SpotLight as Tn, PointLight as wn, DirectionalLight as bn, MeshBasicMaterial as yt, SRGBColorSpace as dt, MeshPhysicalMaterial as q, Vector2 as oe, Matrix4 as ft, Vector3 as L, Quaternion as bs, InstancedMesh as En, InstancedBufferAttribute as Sn, Object3D as Es, ImageBitmapLoader as Rn, BufferAttribute as Xt, InterleavedBuffer as _n, InterleavedBufferAttribute as Mn, LinearFilter as qs, LinearMipmapLinearFilter as Qs, RepeatWrapping as gs, PointsMaterial as Ln, Material as as, LineBasicMaterial as Cn, MeshStandardMaterial as $s, DoubleSide as Dn, PropertyBinding as Nn, BufferGeometry as Zs, SkinnedMesh as In, LineSegments as Js, Line as Fn, LineLoop as On, Points as kn, Group as wt, MathUtils as Pn, Skeleton as Bn, AnimationClip as Hn, Bone as Gn, InterpolateLinear as en, ColorManagement as _s, NearestFilter as Un, NearestMipmapNearestFilter as zn, LinearMipmapNearestFilter as Vn, NearestMipmapLinearFilter as Kn, ClampToEdgeWrapping as jn, MirroredRepeatWrapping as Xn, InterpolateDiscrete as Wn, FrontSide as Yn, Texture as Ms, VectorKeyframeTrack as Ls, NumberKeyframeTrack as Cs, QuaternionKeyframeTrack as Ds, Box3 as qn, Sphere as Qn, Interpolant as $n, Plane as Kt, PlaneHelper as jt, Camera as Zn, PlaneGeometry as ts, RawShaderMaterial as ss, AdditiveBlending as Jn, HalfFloatType as ei, FloatType as ti, WebGLRenderTarget as si, BoxGeometry as ni, VideoTexture as ii } from "three";
45
- import { LayoutBox as xs } from "../layout-box/index.js";
46
- import { loading as cs } from "../loading/index.js";
47
- import { S as ri } from "../SourceManager-Q-PB-Rkh.js";
48
- import { S as I } from "../Store-BQXXikps.js";
49
- import { f as oi } from "../easings-BKi40vHz.js";
50
- import { d as ai } from "../function-C10DGppn.js";
51
- import { T as ci } from "../Tweened-CwDC2zl8.js";
52
- import { d as li } from "../Viewport-CFFhFKqX.js";
53
- import { CustomElement as ui, define as hi } from "../custom-element/index.js";
54
- function pt(u) {
55
- const t = (e) => {
56
- e.dispose();
57
- for (const n of Object.keys(e)) {
58
- const s = e[n];
59
- s && typeof s == "object" && "minFilter" in s && s.dispose();
60
- }
61
- };
62
- u.traverse((e) => {
63
- if (e instanceof Ee) {
64
- if (e.geometry.dispose(), !Array.isArray(e.material) && e.material.isMaterial)
65
- t(e.material);
66
- else if (Array.isArray(e.material))
67
- for (const n of e.material)
68
- t(n);
69
- }
70
- });
71
- }
72
- var bt, N, _e, ue, he, Ue, de, fe;
73
- class Ns {
74
- constructor(t, e) {
75
- m(this, bt, void 0);
76
- m(this, N, void 0);
77
- m(this, _e, void 0);
78
- m(this, ue, void 0);
79
- m(this, he, void 0);
80
- m(this, Ue, void 0);
81
- m(this, de, void 0);
82
- m(this, fe, void 0);
83
- x(this, bt, t), x(this, N, (e == null ? void 0 : e.cameraType) === "orthographic" ? new qt() : new ps()), x(this, _e, new js()), x(this, ue, []), x(this, he, (e == null ? void 0 : e.cameraDistance) || 1e3), r(this, N).near = (e == null ? void 0 : e.cameraNear) || 1, r(this, N).far = (e == null ? void 0 : e.cameraFar) || 11e3, x(this, Ue, (e == null ? void 0 : e.cameraFov) || "auto"), x(this, de, Ks(e == null ? void 0 : e.sizeElement) || document.documentElement), this.beforeRenderCallback = e == null ? void 0 : e.beforeRender, x(this, fe, new xs(r(this, de))), r(this, fe).onScale(() => {
84
- this.resize();
85
- });
86
- }
87
- get name() {
88
- return r(this, bt);
89
- }
90
- get camera() {
91
- return r(this, N);
92
- }
93
- get scene() {
94
- return r(this, _e);
95
- }
96
- get box() {
97
- return r(this, fe);
98
- }
99
- get cameraDistance() {
100
- return r(this, he);
101
- }
102
- set cameraDistance(t) {
103
- x(this, he, t), this.resize();
104
- }
105
- get sizeElement() {
106
- return r(this, de);
107
- }
108
- get isClipped() {
109
- return r(this, de) !== S.containerElement;
110
- }
111
- resize() {
112
- const { width: t, height: e } = r(this, fe);
113
- r(this, N).position.z = r(this, he), r(this, N) instanceof ps ? (r(this, N).aspect = t / e, r(this, N).fov = r(this, Ue) === "auto" ? 2 * Math.atan(e / 2 / r(this, he)) * (180 / Math.PI) : r(this, Ue)) : r(this, N) instanceof qt && (r(this, N).left = t / -2, r(this, N).right = t / 2, r(this, N).top = e / 2, r(this, N).bottom = e / -2), r(this, N).updateProjectionMatrix();
114
- }
115
- destroy() {
116
- r(this, ue).forEach((t) => {
117
- t.userData.box.destroy();
118
- }), r(this, _e).clear(), pt(r(this, _e)), S.destroyView(this.name), r(this, fe).destroy();
119
- }
120
- attachToHTMLElement(t, e, n) {
121
- const s = new xs(t, xt(Q({}, n), {
122
- containerElement: r(this, de),
123
- cartesian: !0,
124
- scrollStep: !this.isClipped
125
- }));
126
- return s.bindObject(e), e.userData.box = s, r(this, ue).push(e), e;
127
- }
128
- detachFromHTMLElement(t) {
129
- x(this, ue, r(this, ue).filter((e) => e === t ? (t.userData.box.destroy(), !1) : !0));
130
- }
131
- add(...t) {
132
- const e = t[0], n = t[1], s = t[2];
133
- return this.scene.add(e), n ? this.attachToHTMLElement(n, e, s) : e;
134
- }
135
- remove(t, e) {
136
- this.scene.remove(t), e && this.detachFromHTMLElement(t);
137
- }
138
- }
139
- bt = new WeakMap(), N = new WeakMap(), _e = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), Ue = new WeakMap(), de = new WeakMap(), fe = new WeakMap();
140
- const j = /* @__PURE__ */ new Map();
141
- var Qt, ee, C, k, ze, Ve, Ke, Et, Me, St, Rt, _t;
142
- class di {
143
- constructor() {
144
- m(this, Qt, `https://unpkg.com/three@0.${xn}.x`);
145
- m(this, ee, null);
146
- m(this, C, null);
147
- m(this, k, /* @__PURE__ */ new Map());
148
- m(this, ze, 0);
149
- m(this, Ve, 0);
150
- m(this, Ke, 0);
151
- m(this, Et, 2);
152
- m(this, Me, !1);
153
- m(this, St, !1);
154
- m(this, Rt, () => {
155
- var t;
156
- x(this, ze, r(this, ee).clientWidth), x(this, Ve, r(this, ee).clientHeight), x(this, Ke, Math.min(r(this, Et), devicePixelRatio || 1)), r(this, C).setPixelRatio(r(this, Ke)), r(this, C).setSize(r(this, ze), r(this, Ve)), (t = this.onResize) == null || t.call(this);
157
- });
158
- m(this, _t, () => {
159
- r(this, C).setRenderTarget(null), r(this, k).forEach((t) => {
160
- this.render(t);
161
- });
162
- });
163
- }
164
- get CDNVersion() {
165
- return r(this, Qt);
166
- }
167
- get containerElement() {
168
- return r(this, ee);
169
- }
170
- get webglRenderer() {
171
- return r(this, C);
172
- }
173
- get views() {
174
- return r(this, k);
175
- }
176
- get view() {
177
- return this.getView("default");
178
- }
179
- get width() {
180
- return r(this, ze);
181
- }
182
- get height() {
183
- return r(this, Ve);
184
- }
185
- get pixelRatio() {
186
- return r(this, Ke);
187
- }
188
- get cacheAssets() {
189
- return r(this, St);
190
- }
191
- setup(t) {
192
- if (r(this, Me)) {
193
- console.warn("[en3.setup]: You are trying to setup en3 again.");
194
- return;
195
- }
196
- x(this, ee, Ks(t == null ? void 0 : t.containerElement) || document.body), x(this, Et, (t == null ? void 0 : t.maxPixelRatio) || 2), x(this, C, new An(t == null ? void 0 : t.webGLRendererParameters)), r(this, C).domElement.style.cssText = `
197
- position: fixed;
198
- left: 0;
199
- top: 0;
200
- width: 100%;
201
- height: 100%;
202
- z-index: -1;
203
- `, r(this, ee).append(r(this, C).domElement), r(this, k).set(
204
- "default",
205
- new Ns("default", Q({
206
- sizeElement: r(this, ee)
207
- }, t == null ? void 0 : t.view))
208
- ), x(this, St, (t == null ? void 0 : t.cacheAssets) || !1), x(this, Me, !0), we.subscribe(r(this, Rt), Vs.EN3), be.subscribe(r(this, _t), { order: ws.EN3 });
209
- }
210
- destroy() {
211
- if (!r(this, Me)) {
212
- console.warn(
213
- "[en3.setup]: You are trying to destory en3 but it has not been initialized."
214
- );
215
- return;
216
- }
217
- we.unsubscribe(r(this, Rt)), be.unsubscribe(r(this, _t)), r(this, k).forEach((t) => {
218
- t.destroy();
219
- }), r(this, C).dispose(), r(this, C).domElement.remove(), x(this, C, null), x(this, Me, !1), j.forEach((t) => {
220
- t.dispose();
221
- }), j.clear();
222
- }
223
- createView(t, e) {
224
- const n = r(this, k).size, s = new Ns(t, e);
225
- return r(this, k).set(t, s), n === 1 && r(this, C).setScissorTest(!0), s;
226
- }
227
- getView(t) {
228
- return r(this, k).get(t);
229
- }
230
- destroyView(t) {
231
- const e = r(this, k).get(t);
232
- e && (r(this, k).delete(t), e.destroy(), r(this, k).size <= 1 && r(this, C).setScissorTest(!1));
233
- }
234
- render(t) {
235
- var e;
236
- if (r(this, k).size > 1 || this.view.isClipped) {
237
- const n = t.box.left + t.box.CSSTranslation.x + t.box.scrollValue.x, s = S.height - t.box.height - t.box.top + t.box.CSSTranslation.y + t.box.scrollValue.y * -1;
238
- r(this, C).setScissor(n, s, t.box.width, t.box.height), r(this, C).setViewport(
239
- n,
240
- s,
241
- t.box.width,
242
- t.box.height
243
- );
244
- }
245
- (e = t.beforeRenderCallback) == null || e.call(t), r(this, C).render(t.scene, t.camera);
246
- }
247
- }
248
- Qt = new WeakMap(), ee = new WeakMap(), C = new WeakMap(), k = new WeakMap(), ze = new WeakMap(), Ve = new WeakMap(), Ke = new WeakMap(), Et = new WeakMap(), Me = new WeakMap(), St = new WeakMap(), Rt = new WeakMap(), _t = new WeakMap();
249
- const S = new di(), He = new Xs(), fi = He.load.bind(He), pi = He.loadAsync.bind(He);
250
- He.load = (u, t, ...e) => {
251
- if (S.cacheAssets && j.has(u)) {
252
- const n = j.get(u);
253
- return t == null || t(n.data), n.data;
254
- }
255
- return fi(
256
- u,
257
- (n) => {
258
- S.cacheAssets && j.set(u, {
259
- data: n,
260
- dispose: () => n.dispose()
261
- }), t == null || t(n);
262
- },
263
- ...e
264
- );
265
- };
266
- He.loadAsync = (u, ...t) => rs(void 0, null, function* () {
267
- if (S.cacheAssets && j.has(u))
268
- return j.get(u).data;
269
- const e = yield pi(u, ...t);
270
- return S.cacheAssets && j.set(u, {
271
- data: e,
272
- dispose: () => e.dispose()
273
- }), e;
274
- });
275
- function Is(u, t) {
276
- if (t === vn)
277
- return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), u;
278
- if (t === ms || t === Ws) {
279
- let e = u.getIndex();
280
- if (e === null) {
281
- const o = [], c = u.getAttribute("position");
282
- if (c !== void 0) {
283
- for (let a = 0; a < c.count; a++)
284
- o.push(a);
285
- u.setIndex(o), e = u.getIndex();
286
- } else
287
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), u;
288
- }
289
- const n = e.count - 2, s = [];
290
- if (t === ms)
291
- for (let o = 1; o <= n; o++)
292
- s.push(e.getX(0)), s.push(e.getX(o)), s.push(e.getX(o + 1));
293
- else
294
- for (let o = 0; o < n; o++)
295
- o % 2 === 0 ? (s.push(e.getX(o)), s.push(e.getX(o + 1)), s.push(e.getX(o + 2))) : (s.push(e.getX(o + 2)), s.push(e.getX(o + 1)), s.push(e.getX(o)));
296
- s.length / 3 !== n && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
297
- const i = u.clone();
298
- return i.setIndex(s), i.clearGroups(), i;
299
- } else
300
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), u;
301
- }
302
- class mi extends yn {
303
- constructor(t) {
304
- super(t), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
305
- return new yi(e);
306
- }), this.register(function(e) {
307
- return new Ti(e);
308
- }), this.register(function(e) {
309
- return new Ci(e);
310
- }), this.register(function(e) {
311
- return new Di(e);
312
- }), this.register(function(e) {
313
- return new Ni(e);
314
- }), this.register(function(e) {
315
- return new bi(e);
316
- }), this.register(function(e) {
317
- return new Ei(e);
318
- }), this.register(function(e) {
319
- return new Si(e);
320
- }), this.register(function(e) {
321
- return new Ri(e);
322
- }), this.register(function(e) {
323
- return new vi(e);
324
- }), this.register(function(e) {
325
- return new _i(e);
326
- }), this.register(function(e) {
327
- return new wi(e);
328
- }), this.register(function(e) {
329
- return new Li(e);
330
- }), this.register(function(e) {
331
- return new Mi(e);
332
- }), this.register(function(e) {
333
- return new xi(e);
334
- }), this.register(function(e) {
335
- return new Ii(e);
336
- }), this.register(function(e) {
337
- return new Fi(e);
338
- });
339
- }
340
- load(t, e, n, s) {
341
- const i = this;
342
- let o;
343
- if (this.resourcePath !== "")
344
- o = this.resourcePath;
345
- else if (this.path !== "") {
346
- const l = Tt.extractUrlBase(t);
347
- o = Tt.resolveURL(l, this.path);
348
- } else
349
- o = Tt.extractUrlBase(t);
350
- this.manager.itemStart(t);
351
- const c = function(l) {
352
- s ? s(l) : console.error(l), i.manager.itemError(t), i.manager.itemEnd(t);
353
- }, a = new Ys(this.manager);
354
- a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(t, function(l) {
355
- try {
356
- i.parse(l, o, function(d) {
357
- e(d), i.manager.itemEnd(t);
358
- }, c);
359
- } catch (d) {
360
- c(d);
361
- }
362
- }, n, c);
363
- }
364
- setDRACOLoader(t) {
365
- return this.dracoLoader = t, this;
366
- }
367
- setDDSLoader() {
368
- throw new Error(
369
- 'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
370
- );
371
- }
372
- setKTX2Loader(t) {
373
- return this.ktx2Loader = t, this;
374
- }
375
- setMeshoptDecoder(t) {
376
- return this.meshoptDecoder = t, this;
377
- }
378
- register(t) {
379
- return this.pluginCallbacks.indexOf(t) === -1 && this.pluginCallbacks.push(t), this;
380
- }
381
- unregister(t) {
382
- return this.pluginCallbacks.indexOf(t) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t), 1), this;
383
- }
384
- parse(t, e, n, s) {
385
- let i;
386
- const o = {}, c = {}, a = new TextDecoder();
387
- if (typeof t == "string")
388
- i = JSON.parse(t);
389
- else if (t instanceof ArrayBuffer)
390
- if (a.decode(new Uint8Array(t, 0, 4)) === tn) {
391
- try {
392
- o[w.KHR_BINARY_GLTF] = new Oi(t);
393
- } catch (h) {
394
- s && s(h);
395
- return;
396
- }
397
- i = JSON.parse(o[w.KHR_BINARY_GLTF].content);
398
- } else
399
- i = JSON.parse(a.decode(t));
400
- else
401
- i = t;
402
- if (i.asset === void 0 || i.asset.version[0] < 2) {
403
- s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
404
- return;
405
- }
406
- const l = new Yi(i, {
407
- path: e || this.resourcePath || "",
408
- crossOrigin: this.crossOrigin,
409
- requestHeader: this.requestHeader,
410
- manager: this.manager,
411
- ktx2Loader: this.ktx2Loader,
412
- meshoptDecoder: this.meshoptDecoder
413
- });
414
- l.fileLoader.setRequestHeader(this.requestHeader);
415
- for (let d = 0; d < this.pluginCallbacks.length; d++) {
416
- const h = this.pluginCallbacks[d](l);
417
- h.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), c[h.name] = h, o[h.name] = !0;
418
- }
419
- if (i.extensionsUsed)
420
- for (let d = 0; d < i.extensionsUsed.length; ++d) {
421
- const h = i.extensionsUsed[d], p = i.extensionsRequired || [];
422
- switch (h) {
423
- case w.KHR_MATERIALS_UNLIT:
424
- o[h] = new Ai();
425
- break;
426
- case w.KHR_DRACO_MESH_COMPRESSION:
427
- o[h] = new ki(i, this.dracoLoader);
428
- break;
429
- case w.KHR_TEXTURE_TRANSFORM:
430
- o[h] = new Pi();
431
- break;
432
- case w.KHR_MESH_QUANTIZATION:
433
- o[h] = new Bi();
434
- break;
435
- default:
436
- p.indexOf(h) >= 0 && c[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
437
- }
438
- }
439
- l.setExtensions(o), l.setPlugins(c), l.parse(n, s);
440
- }
441
- parseAsync(t, e) {
442
- const n = this;
443
- return new Promise(function(s, i) {
444
- n.parse(t, e, s, i);
445
- });
446
- }
447
- }
448
- function gi() {
449
- let u = {};
450
- return {
451
- get: function(t) {
452
- return u[t];
453
- },
454
- add: function(t, e) {
455
- u[t] = e;
456
- },
457
- remove: function(t) {
458
- delete u[t];
459
- },
460
- removeAll: function() {
461
- u = {};
462
- }
463
- };
464
- }
465
- const w = {
466
- KHR_BINARY_GLTF: "KHR_binary_glTF",
467
- KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
468
- KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
469
- KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
470
- KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
471
- KHR_MATERIALS_IOR: "KHR_materials_ior",
472
- KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
473
- KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
474
- KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
475
- KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
476
- KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
477
- KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
478
- KHR_MATERIALS_VOLUME: "KHR_materials_volume",
479
- KHR_TEXTURE_BASISU: "KHR_texture_basisu",
480
- KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
481
- KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
482
- KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
483
- EXT_MATERIALS_BUMP: "EXT_materials_bump",
484
- EXT_TEXTURE_WEBP: "EXT_texture_webp",
485
- EXT_TEXTURE_AVIF: "EXT_texture_avif",
486
- EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
487
- EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
488
- };
489
- class xi {
490
- constructor(t) {
491
- this.parser = t, this.name = w.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
492
- }
493
- _markDefs() {
494
- const t = this.parser, e = this.parser.json.nodes || [];
495
- for (let n = 0, s = e.length; n < s; n++) {
496
- const i = e[n];
497
- i.extensions && i.extensions[this.name] && i.extensions[this.name].light !== void 0 && t._addNodeRef(this.cache, i.extensions[this.name].light);
498
- }
499
- }
500
- _loadLight(t) {
501
- const e = this.parser, n = "light:" + t;
502
- let s = e.cache.get(n);
503
- if (s)
504
- return s;
505
- const i = e.json, a = ((i.extensions && i.extensions[this.name] || {}).lights || [])[t];
506
- let l;
507
- const d = new B(16777215);
508
- a.color !== void 0 && d.setRGB(a.color[0], a.color[1], a.color[2], ae);
509
- const h = a.range !== void 0 ? a.range : 0;
510
- switch (a.type) {
511
- case "directional":
512
- l = new bn(d), l.target.position.set(0, 0, -1), l.add(l.target);
513
- break;
514
- case "point":
515
- l = new wn(d), l.distance = h;
516
- break;
517
- case "spot":
518
- l = new Tn(d), l.distance = h, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle !== void 0 ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = a.spot.outerConeAngle !== void 0 ? a.spot.outerConeAngle : Math.PI / 4, l.angle = a.spot.outerConeAngle, l.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
519
- break;
520
- default:
521
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
522
- }
523
- return l.position.set(0, 0, 0), l.decay = 2, J(l, a), a.intensity !== void 0 && (l.intensity = a.intensity), l.name = e.createUniqueName(a.name || "light_" + t), s = Promise.resolve(l), e.cache.add(n, s), s;
524
- }
525
- getDependency(t, e) {
526
- if (t === "light")
527
- return this._loadLight(e);
528
- }
529
- createNodeAttachment(t) {
530
- const e = this, n = this.parser, i = n.json.nodes[t], c = (i.extensions && i.extensions[this.name] || {}).light;
531
- return c === void 0 ? null : this._loadLight(c).then(function(a) {
532
- return n._getNodeRef(e.cache, c, a);
533
- });
534
- }
535
- }
536
- class Ai {
537
- constructor() {
538
- this.name = w.KHR_MATERIALS_UNLIT;
539
- }
540
- getMaterialType() {
541
- return yt;
542
- }
543
- extendParams(t, e, n) {
544
- const s = [];
545
- t.color = new B(1, 1, 1), t.opacity = 1;
546
- const i = e.pbrMetallicRoughness;
547
- if (i) {
548
- if (Array.isArray(i.baseColorFactor)) {
549
- const o = i.baseColorFactor;
550
- t.color.setRGB(o[0], o[1], o[2], ae), t.opacity = o[3];
551
- }
552
- i.baseColorTexture !== void 0 && s.push(n.assignTexture(t, "map", i.baseColorTexture, dt));
553
- }
554
- return Promise.all(s);
555
- }
556
- }
557
- class vi {
558
- constructor(t) {
559
- this.parser = t, this.name = w.KHR_MATERIALS_EMISSIVE_STRENGTH;
560
- }
561
- extendMaterialParams(t, e) {
562
- const s = this.parser.json.materials[t];
563
- if (!s.extensions || !s.extensions[this.name])
564
- return Promise.resolve();
565
- const i = s.extensions[this.name].emissiveStrength;
566
- return i !== void 0 && (e.emissiveIntensity = i), Promise.resolve();
567
- }
568
- }
569
- class yi {
570
- constructor(t) {
571
- this.parser = t, this.name = w.KHR_MATERIALS_CLEARCOAT;
572
- }
573
- getMaterialType(t) {
574
- const n = this.parser.json.materials[t];
575
- return !n.extensions || !n.extensions[this.name] ? null : q;
576
- }
577
- extendMaterialParams(t, e) {
578
- const n = this.parser, s = n.json.materials[t];
579
- if (!s.extensions || !s.extensions[this.name])
580
- return Promise.resolve();
581
- const i = [], o = s.extensions[this.name];
582
- if (o.clearcoatFactor !== void 0 && (e.clearcoat = o.clearcoatFactor), o.clearcoatTexture !== void 0 && i.push(n.assignTexture(e, "clearcoatMap", o.clearcoatTexture)), o.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = o.clearcoatRoughnessFactor), o.clearcoatRoughnessTexture !== void 0 && i.push(n.assignTexture(e, "clearcoatRoughnessMap", o.clearcoatRoughnessTexture)), o.clearcoatNormalTexture !== void 0 && (i.push(n.assignTexture(e, "clearcoatNormalMap", o.clearcoatNormalTexture)), o.clearcoatNormalTexture.scale !== void 0)) {
583
- const c = o.clearcoatNormalTexture.scale;
584
- e.clearcoatNormalScale = new oe(c, c);
585
- }
586
- return Promise.all(i);
587
- }
588
- }
589
- class Ti {
590
- constructor(t) {
591
- this.parser = t, this.name = w.KHR_MATERIALS_DISPERSION;
592
- }
593
- getMaterialType(t) {
594
- const n = this.parser.json.materials[t];
595
- return !n.extensions || !n.extensions[this.name] ? null : q;
596
- }
597
- extendMaterialParams(t, e) {
598
- const s = this.parser.json.materials[t];
599
- if (!s.extensions || !s.extensions[this.name])
600
- return Promise.resolve();
601
- const i = s.extensions[this.name];
602
- return e.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
603
- }
604
- }
605
- class wi {
606
- constructor(t) {
607
- this.parser = t, this.name = w.KHR_MATERIALS_IRIDESCENCE;
608
- }
609
- getMaterialType(t) {
610
- const n = this.parser.json.materials[t];
611
- return !n.extensions || !n.extensions[this.name] ? null : q;
612
- }
613
- extendMaterialParams(t, e) {
614
- const n = this.parser, s = n.json.materials[t];
615
- if (!s.extensions || !s.extensions[this.name])
616
- return Promise.resolve();
617
- const i = [], o = s.extensions[this.name];
618
- return o.iridescenceFactor !== void 0 && (e.iridescence = o.iridescenceFactor), o.iridescenceTexture !== void 0 && i.push(n.assignTexture(e, "iridescenceMap", o.iridescenceTexture)), o.iridescenceIor !== void 0 && (e.iridescenceIOR = o.iridescenceIor), e.iridescenceThicknessRange === void 0 && (e.iridescenceThicknessRange = [100, 400]), o.iridescenceThicknessMinimum !== void 0 && (e.iridescenceThicknessRange[0] = o.iridescenceThicknessMinimum), o.iridescenceThicknessMaximum !== void 0 && (e.iridescenceThicknessRange[1] = o.iridescenceThicknessMaximum), o.iridescenceThicknessTexture !== void 0 && i.push(n.assignTexture(e, "iridescenceThicknessMap", o.iridescenceThicknessTexture)), Promise.all(i);
619
- }
620
- }
621
- class bi {
622
- constructor(t) {
623
- this.parser = t, this.name = w.KHR_MATERIALS_SHEEN;
624
- }
625
- getMaterialType(t) {
626
- const n = this.parser.json.materials[t];
627
- return !n.extensions || !n.extensions[this.name] ? null : q;
628
- }
629
- extendMaterialParams(t, e) {
630
- const n = this.parser, s = n.json.materials[t];
631
- if (!s.extensions || !s.extensions[this.name])
632
- return Promise.resolve();
633
- const i = [];
634
- e.sheenColor = new B(0, 0, 0), e.sheenRoughness = 0, e.sheen = 1;
635
- const o = s.extensions[this.name];
636
- if (o.sheenColorFactor !== void 0) {
637
- const c = o.sheenColorFactor;
638
- e.sheenColor.setRGB(c[0], c[1], c[2], ae);
639
- }
640
- return o.sheenRoughnessFactor !== void 0 && (e.sheenRoughness = o.sheenRoughnessFactor), o.sheenColorTexture !== void 0 && i.push(n.assignTexture(e, "sheenColorMap", o.sheenColorTexture, dt)), o.sheenRoughnessTexture !== void 0 && i.push(n.assignTexture(e, "sheenRoughnessMap", o.sheenRoughnessTexture)), Promise.all(i);
641
- }
642
- }
643
- class Ei {
644
- constructor(t) {
645
- this.parser = t, this.name = w.KHR_MATERIALS_TRANSMISSION;
646
- }
647
- getMaterialType(t) {
648
- const n = this.parser.json.materials[t];
649
- return !n.extensions || !n.extensions[this.name] ? null : q;
650
- }
651
- extendMaterialParams(t, e) {
652
- const n = this.parser, s = n.json.materials[t];
653
- if (!s.extensions || !s.extensions[this.name])
654
- return Promise.resolve();
655
- const i = [], o = s.extensions[this.name];
656
- return o.transmissionFactor !== void 0 && (e.transmission = o.transmissionFactor), o.transmissionTexture !== void 0 && i.push(n.assignTexture(e, "transmissionMap", o.transmissionTexture)), Promise.all(i);
657
- }
658
- }
659
- class Si {
660
- constructor(t) {
661
- this.parser = t, this.name = w.KHR_MATERIALS_VOLUME;
662
- }
663
- getMaterialType(t) {
664
- const n = this.parser.json.materials[t];
665
- return !n.extensions || !n.extensions[this.name] ? null : q;
666
- }
667
- extendMaterialParams(t, e) {
668
- const n = this.parser, s = n.json.materials[t];
669
- if (!s.extensions || !s.extensions[this.name])
670
- return Promise.resolve();
671
- const i = [], o = s.extensions[this.name];
672
- e.thickness = o.thicknessFactor !== void 0 ? o.thicknessFactor : 0, o.thicknessTexture !== void 0 && i.push(n.assignTexture(e, "thicknessMap", o.thicknessTexture)), e.attenuationDistance = o.attenuationDistance || 1 / 0;
673
- const c = o.attenuationColor || [1, 1, 1];
674
- return e.attenuationColor = new B().setRGB(c[0], c[1], c[2], ae), Promise.all(i);
675
- }
676
- }
677
- class Ri {
678
- constructor(t) {
679
- this.parser = t, this.name = w.KHR_MATERIALS_IOR;
680
- }
681
- getMaterialType(t) {
682
- const n = this.parser.json.materials[t];
683
- return !n.extensions || !n.extensions[this.name] ? null : q;
684
- }
685
- extendMaterialParams(t, e) {
686
- const s = this.parser.json.materials[t];
687
- if (!s.extensions || !s.extensions[this.name])
688
- return Promise.resolve();
689
- const i = s.extensions[this.name];
690
- return e.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
691
- }
692
- }
693
- class _i {
694
- constructor(t) {
695
- this.parser = t, this.name = w.KHR_MATERIALS_SPECULAR;
696
- }
697
- getMaterialType(t) {
698
- const n = this.parser.json.materials[t];
699
- return !n.extensions || !n.extensions[this.name] ? null : q;
700
- }
701
- extendMaterialParams(t, e) {
702
- const n = this.parser, s = n.json.materials[t];
703
- if (!s.extensions || !s.extensions[this.name])
704
- return Promise.resolve();
705
- const i = [], o = s.extensions[this.name];
706
- e.specularIntensity = o.specularFactor !== void 0 ? o.specularFactor : 1, o.specularTexture !== void 0 && i.push(n.assignTexture(e, "specularIntensityMap", o.specularTexture));
707
- const c = o.specularColorFactor || [1, 1, 1];
708
- return e.specularColor = new B().setRGB(c[0], c[1], c[2], ae), o.specularColorTexture !== void 0 && i.push(n.assignTexture(e, "specularColorMap", o.specularColorTexture, dt)), Promise.all(i);
709
- }
710
- }
711
- class Mi {
712
- constructor(t) {
713
- this.parser = t, this.name = w.EXT_MATERIALS_BUMP;
714
- }
715
- getMaterialType(t) {
716
- const n = this.parser.json.materials[t];
717
- return !n.extensions || !n.extensions[this.name] ? null : q;
718
- }
719
- extendMaterialParams(t, e) {
720
- const n = this.parser, s = n.json.materials[t];
721
- if (!s.extensions || !s.extensions[this.name])
722
- return Promise.resolve();
723
- const i = [], o = s.extensions[this.name];
724
- return e.bumpScale = o.bumpFactor !== void 0 ? o.bumpFactor : 1, o.bumpTexture !== void 0 && i.push(n.assignTexture(e, "bumpMap", o.bumpTexture)), Promise.all(i);
725
- }
726
- }
727
- class Li {
728
- constructor(t) {
729
- this.parser = t, this.name = w.KHR_MATERIALS_ANISOTROPY;
730
- }
731
- getMaterialType(t) {
732
- const n = this.parser.json.materials[t];
733
- return !n.extensions || !n.extensions[this.name] ? null : q;
734
- }
735
- extendMaterialParams(t, e) {
736
- const n = this.parser, s = n.json.materials[t];
737
- if (!s.extensions || !s.extensions[this.name])
738
- return Promise.resolve();
739
- const i = [], o = s.extensions[this.name];
740
- return o.anisotropyStrength !== void 0 && (e.anisotropy = o.anisotropyStrength), o.anisotropyRotation !== void 0 && (e.anisotropyRotation = o.anisotropyRotation), o.anisotropyTexture !== void 0 && i.push(n.assignTexture(e, "anisotropyMap", o.anisotropyTexture)), Promise.all(i);
741
- }
742
- }
743
- class Ci {
744
- constructor(t) {
745
- this.parser = t, this.name = w.KHR_TEXTURE_BASISU;
746
- }
747
- loadTexture(t) {
748
- const e = this.parser, n = e.json, s = n.textures[t];
749
- if (!s.extensions || !s.extensions[this.name])
750
- return null;
751
- const i = s.extensions[this.name], o = e.options.ktx2Loader;
752
- if (!o) {
753
- if (n.extensionsRequired && n.extensionsRequired.indexOf(this.name) >= 0)
754
- throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
755
- return null;
756
- }
757
- return e.loadTextureImage(t, i.source, o);
758
- }
759
- }
760
- class Di {
761
- constructor(t) {
762
- this.parser = t, this.name = w.EXT_TEXTURE_WEBP, this.isSupported = null;
763
- }
764
- loadTexture(t) {
765
- const e = this.name, n = this.parser, s = n.json, i = s.textures[t];
766
- if (!i.extensions || !i.extensions[e])
767
- return null;
768
- const o = i.extensions[e], c = s.images[o.source];
769
- let a = n.textureLoader;
770
- if (c.uri) {
771
- const l = n.options.manager.getHandler(c.uri);
772
- l !== null && (a = l);
773
- }
774
- return this.detectSupport().then(function(l) {
775
- if (l)
776
- return n.loadTextureImage(t, o.source, a);
777
- if (s.extensionsRequired && s.extensionsRequired.indexOf(e) >= 0)
778
- throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
779
- return n.loadTexture(t);
780
- });
781
- }
782
- detectSupport() {
783
- return this.isSupported || (this.isSupported = new Promise(function(t) {
784
- const e = new Image();
785
- e.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", e.onload = e.onerror = function() {
786
- t(e.height === 1);
787
- };
788
- })), this.isSupported;
789
- }
790
- }
791
- class Ni {
792
- constructor(t) {
793
- this.parser = t, this.name = w.EXT_TEXTURE_AVIF, this.isSupported = null;
794
- }
795
- loadTexture(t) {
796
- const e = this.name, n = this.parser, s = n.json, i = s.textures[t];
797
- if (!i.extensions || !i.extensions[e])
798
- return null;
799
- const o = i.extensions[e], c = s.images[o.source];
800
- let a = n.textureLoader;
801
- if (c.uri) {
802
- const l = n.options.manager.getHandler(c.uri);
803
- l !== null && (a = l);
804
- }
805
- return this.detectSupport().then(function(l) {
806
- if (l)
807
- return n.loadTextureImage(t, o.source, a);
808
- if (s.extensionsRequired && s.extensionsRequired.indexOf(e) >= 0)
809
- throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
810
- return n.loadTexture(t);
811
- });
812
- }
813
- detectSupport() {
814
- return this.isSupported || (this.isSupported = new Promise(function(t) {
815
- const e = new Image();
816
- e.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", e.onload = e.onerror = function() {
817
- t(e.height === 1);
818
- };
819
- })), this.isSupported;
820
- }
821
- }
822
- class Ii {
823
- constructor(t) {
824
- this.name = w.EXT_MESHOPT_COMPRESSION, this.parser = t;
825
- }
826
- loadBufferView(t) {
827
- const e = this.parser.json, n = e.bufferViews[t];
828
- if (n.extensions && n.extensions[this.name]) {
829
- const s = n.extensions[this.name], i = this.parser.getDependency("buffer", s.buffer), o = this.parser.options.meshoptDecoder;
830
- if (!o || !o.supported) {
831
- if (e.extensionsRequired && e.extensionsRequired.indexOf(this.name) >= 0)
832
- throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
833
- return null;
834
- }
835
- return i.then(function(c) {
836
- const a = s.byteOffset || 0, l = s.byteLength || 0, d = s.count, h = s.byteStride, p = new Uint8Array(c, a, l);
837
- return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(d, h, p, s.mode, s.filter).then(function(A) {
838
- return A.buffer;
839
- }) : o.ready.then(function() {
840
- const A = new ArrayBuffer(d * h);
841
- return o.decodeGltfBuffer(new Uint8Array(A), d, h, p, s.mode, s.filter), A;
842
- });
843
- });
844
- } else
845
- return null;
846
- }
847
- }
848
- class Fi {
849
- constructor(t) {
850
- this.name = w.EXT_MESH_GPU_INSTANCING, this.parser = t;
851
- }
852
- createNodeMesh(t) {
853
- const e = this.parser.json, n = e.nodes[t];
854
- if (!n.extensions || !n.extensions[this.name] || n.mesh === void 0)
855
- return null;
856
- const s = e.meshes[n.mesh];
857
- for (const l of s.primitives)
858
- if (l.mode !== G.TRIANGLES && l.mode !== G.TRIANGLE_STRIP && l.mode !== G.TRIANGLE_FAN && l.mode !== void 0)
859
- return null;
860
- const o = n.extensions[this.name].attributes, c = [], a = {};
861
- for (const l in o)
862
- c.push(this.parser.getDependency("accessor", o[l]).then((d) => (a[l] = d, a[l])));
863
- return c.length < 1 ? null : (c.push(this.parser.createNodeMesh(t)), Promise.all(c).then((l) => {
864
- const d = l.pop(), h = d.isGroup ? d.children : [d], p = l[0].count, A = [];
865
- for (const v of h) {
866
- const b = new ft(), g = new L(), f = new bs(), y = new L(1, 1, 1), _ = new En(v.geometry, v.material, p);
867
- for (let T = 0; T < p; T++)
868
- a.TRANSLATION && g.fromBufferAttribute(a.TRANSLATION, T), a.ROTATION && f.fromBufferAttribute(a.ROTATION, T), a.SCALE && y.fromBufferAttribute(a.SCALE, T), _.setMatrixAt(T, b.compose(g, f, y));
869
- for (const T in a)
870
- if (T === "_COLOR_0") {
871
- const M = a[T];
872
- _.instanceColor = new Sn(M.array, M.itemSize, M.normalized);
873
- } else
874
- T !== "TRANSLATION" && T !== "ROTATION" && T !== "SCALE" && v.geometry.setAttribute(T, a[T]);
875
- Es.prototype.copy.call(_, v), this.parser.assignFinalMaterial(_), A.push(_);
876
- }
877
- return d.isGroup ? (d.clear(), d.add(...A), d) : A[0];
878
- }));
879
- }
880
- }
881
- const tn = "glTF", At = 12, Fs = { JSON: 1313821514, BIN: 5130562 };
882
- class Oi {
883
- constructor(t) {
884
- this.name = w.KHR_BINARY_GLTF, this.content = null, this.body = null;
885
- const e = new DataView(t, 0, At), n = new TextDecoder();
886
- if (this.header = {
887
- magic: n.decode(new Uint8Array(t.slice(0, 4))),
888
- version: e.getUint32(4, !0),
889
- length: e.getUint32(8, !0)
890
- }, this.header.magic !== tn)
891
- throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
892
- if (this.header.version < 2)
893
- throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
894
- const s = this.header.length - At, i = new DataView(t, At);
895
- let o = 0;
896
- for (; o < s; ) {
897
- const c = i.getUint32(o, !0);
898
- o += 4;
899
- const a = i.getUint32(o, !0);
900
- if (o += 4, a === Fs.JSON) {
901
- const l = new Uint8Array(t, At + o, c);
902
- this.content = n.decode(l);
903
- } else if (a === Fs.BIN) {
904
- const l = At + o;
905
- this.body = t.slice(l, l + c);
906
- }
907
- o += c;
908
- }
909
- if (this.content === null)
910
- throw new Error("THREE.GLTFLoader: JSON content not found.");
911
- }
912
- }
913
- class ki {
914
- constructor(t, e) {
915
- if (!e)
916
- throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
917
- this.name = w.KHR_DRACO_MESH_COMPRESSION, this.json = t, this.dracoLoader = e, this.dracoLoader.preload();
918
- }
919
- decodePrimitive(t, e) {
920
- const n = this.json, s = this.dracoLoader, i = t.extensions[this.name].bufferView, o = t.extensions[this.name].attributes, c = {}, a = {}, l = {};
921
- for (const d in o) {
922
- const h = As[d] || d.toLowerCase();
923
- c[h] = o[d];
924
- }
925
- for (const d in t.attributes) {
926
- const h = As[d] || d.toLowerCase();
927
- if (o[d] !== void 0) {
928
- const p = n.accessors[t.attributes[d]], A = Ge[p.componentType];
929
- l[h] = A.name, a[h] = p.normalized === !0;
930
- }
931
- }
932
- return e.getDependency("bufferView", i).then(function(d) {
933
- return new Promise(function(h, p) {
934
- s.decodeDracoFile(d, function(A) {
935
- for (const v in A.attributes) {
936
- const b = A.attributes[v], g = a[v];
937
- g !== void 0 && (b.normalized = g);
938
- }
939
- h(A);
940
- }, c, l, ae, p);
941
- });
942
- });
943
- }
944
- }
945
- class Pi {
946
- constructor() {
947
- this.name = w.KHR_TEXTURE_TRANSFORM;
948
- }
949
- extendTexture(t, e) {
950
- return (e.texCoord === void 0 || e.texCoord === t.channel) && e.offset === void 0 && e.rotation === void 0 && e.scale === void 0 || (t = t.clone(), e.texCoord !== void 0 && (t.channel = e.texCoord), e.offset !== void 0 && t.offset.fromArray(e.offset), e.rotation !== void 0 && (t.rotation = e.rotation), e.scale !== void 0 && t.repeat.fromArray(e.scale), t.needsUpdate = !0), t;
951
- }
952
- }
953
- class Bi {
954
- constructor() {
955
- this.name = w.KHR_MESH_QUANTIZATION;
956
- }
957
- }
958
- class sn extends $n {
959
- constructor(t, e, n, s) {
960
- super(t, e, n, s);
961
- }
962
- copySampleValue_(t) {
963
- const e = this.resultBuffer, n = this.sampleValues, s = this.valueSize, i = t * s * 3 + s;
964
- for (let o = 0; o !== s; o++)
965
- e[o] = n[i + o];
966
- return e;
967
- }
968
- interpolate_(t, e, n, s) {
969
- const i = this.resultBuffer, o = this.sampleValues, c = this.valueSize, a = c * 2, l = c * 3, d = s - e, h = (n - e) / d, p = h * h, A = p * h, v = t * l, b = v - l, g = -2 * A + 3 * p, f = A - p, y = 1 - g, _ = f - p + h;
970
- for (let T = 0; T !== c; T++) {
971
- const M = o[b + T + c], F = o[b + T + a] * d, O = o[v + T + c], z = o[v + T] * d;
972
- i[T] = y * M + _ * F + g * O + f * z;
973
- }
974
- return i;
975
- }
976
- }
977
- const Hi = new bs();
978
- class Gi extends sn {
979
- interpolate_(t, e, n, s) {
980
- const i = super.interpolate_(t, e, n, s);
981
- return Hi.fromArray(i).normalize().toArray(i), i;
982
- }
983
- }
984
- const G = {
985
- FLOAT: 5126,
986
- //FLOAT_MAT2: 35674,
987
- FLOAT_MAT3: 35675,
988
- FLOAT_MAT4: 35676,
989
- FLOAT_VEC2: 35664,
990
- FLOAT_VEC3: 35665,
991
- FLOAT_VEC4: 35666,
992
- LINEAR: 9729,
993
- REPEAT: 10497,
994
- SAMPLER_2D: 35678,
995
- POINTS: 0,
996
- LINES: 1,
997
- LINE_LOOP: 2,
998
- LINE_STRIP: 3,
999
- TRIANGLES: 4,
1000
- TRIANGLE_STRIP: 5,
1001
- TRIANGLE_FAN: 6,
1002
- UNSIGNED_BYTE: 5121,
1003
- UNSIGNED_SHORT: 5123
1004
- }, Ge = {
1005
- 5120: Int8Array,
1006
- 5121: Uint8Array,
1007
- 5122: Int16Array,
1008
- 5123: Uint16Array,
1009
- 5125: Uint32Array,
1010
- 5126: Float32Array
1011
- }, Os = {
1012
- 9728: Un,
1013
- 9729: qs,
1014
- 9984: zn,
1015
- 9985: Vn,
1016
- 9986: Kn,
1017
- 9987: Qs
1018
- }, ks = {
1019
- 33071: jn,
1020
- 33648: Xn,
1021
- 10497: gs
1022
- }, ls = {
1023
- SCALAR: 1,
1024
- VEC2: 2,
1025
- VEC3: 3,
1026
- VEC4: 4,
1027
- MAT2: 4,
1028
- MAT3: 9,
1029
- MAT4: 16
1030
- }, As = {
1031
- POSITION: "position",
1032
- NORMAL: "normal",
1033
- TANGENT: "tangent",
1034
- TEXCOORD_0: "uv",
1035
- TEXCOORD_1: "uv1",
1036
- TEXCOORD_2: "uv2",
1037
- TEXCOORD_3: "uv3",
1038
- COLOR_0: "color",
1039
- WEIGHTS_0: "skinWeight",
1040
- JOINTS_0: "skinIndex"
1041
- }, le = {
1042
- scale: "scale",
1043
- translation: "position",
1044
- rotation: "quaternion",
1045
- weights: "morphTargetInfluences"
1046
- }, Ui = {
1047
- CUBICSPLINE: void 0,
1048
- // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
1049
- // keyframe track will be initialized with a default interpolation type, then modified.
1050
- LINEAR: en,
1051
- STEP: Wn
1052
- }, us = {
1053
- OPAQUE: "OPAQUE",
1054
- MASK: "MASK",
1055
- BLEND: "BLEND"
1056
- };
1057
- function zi(u) {
1058
- return u.DefaultMaterial === void 0 && (u.DefaultMaterial = new $s({
1059
- color: 16777215,
1060
- emissive: 0,
1061
- metalness: 1,
1062
- roughness: 1,
1063
- transparent: !1,
1064
- depthTest: !0,
1065
- side: Yn
1066
- })), u.DefaultMaterial;
1067
- }
1068
- function Se(u, t, e) {
1069
- for (const n in e.extensions)
1070
- u[n] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[n] = e.extensions[n]);
1071
- }
1072
- function J(u, t) {
1073
- t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(u.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
1074
- }
1075
- function Vi(u, t, e) {
1076
- let n = !1, s = !1, i = !1;
1077
- for (let l = 0, d = t.length; l < d; l++) {
1078
- const h = t[l];
1079
- if (h.POSITION !== void 0 && (n = !0), h.NORMAL !== void 0 && (s = !0), h.COLOR_0 !== void 0 && (i = !0), n && s && i)
1080
- break;
1081
- }
1082
- if (!n && !s && !i)
1083
- return Promise.resolve(u);
1084
- const o = [], c = [], a = [];
1085
- for (let l = 0, d = t.length; l < d; l++) {
1086
- const h = t[l];
1087
- if (n) {
1088
- const p = h.POSITION !== void 0 ? e.getDependency("accessor", h.POSITION) : u.attributes.position;
1089
- o.push(p);
1090
- }
1091
- if (s) {
1092
- const p = h.NORMAL !== void 0 ? e.getDependency("accessor", h.NORMAL) : u.attributes.normal;
1093
- c.push(p);
1094
- }
1095
- if (i) {
1096
- const p = h.COLOR_0 !== void 0 ? e.getDependency("accessor", h.COLOR_0) : u.attributes.color;
1097
- a.push(p);
1098
- }
1099
- }
1100
- return Promise.all([
1101
- Promise.all(o),
1102
- Promise.all(c),
1103
- Promise.all(a)
1104
- ]).then(function(l) {
1105
- const d = l[0], h = l[1], p = l[2];
1106
- return n && (u.morphAttributes.position = d), s && (u.morphAttributes.normal = h), i && (u.morphAttributes.color = p), u.morphTargetsRelative = !0, u;
1107
- });
1108
- }
1109
- function Ki(u, t) {
1110
- if (u.updateMorphTargets(), t.weights !== void 0)
1111
- for (let e = 0, n = t.weights.length; e < n; e++)
1112
- u.morphTargetInfluences[e] = t.weights[e];
1113
- if (t.extras && Array.isArray(t.extras.targetNames)) {
1114
- const e = t.extras.targetNames;
1115
- if (u.morphTargetInfluences.length === e.length) {
1116
- u.morphTargetDictionary = {};
1117
- for (let n = 0, s = e.length; n < s; n++)
1118
- u.morphTargetDictionary[e[n]] = n;
1119
- } else
1120
- console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
1121
- }
1122
- }
1123
- function ji(u) {
1124
- let t;
1125
- const e = u.extensions && u.extensions[w.KHR_DRACO_MESH_COMPRESSION];
1126
- if (e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + hs(e.attributes) : t = u.indices + ":" + hs(u.attributes) + ":" + u.mode, u.targets !== void 0)
1127
- for (let n = 0, s = u.targets.length; n < s; n++)
1128
- t += ":" + hs(u.targets[n]);
1129
- return t;
1130
- }
1131
- function hs(u) {
1132
- let t = "";
1133
- const e = Object.keys(u).sort();
1134
- for (let n = 0, s = e.length; n < s; n++)
1135
- t += e[n] + ":" + u[e[n]] + ";";
1136
- return t;
1137
- }
1138
- function vs(u) {
1139
- switch (u) {
1140
- case Int8Array:
1141
- return 1 / 127;
1142
- case Uint8Array:
1143
- return 1 / 255;
1144
- case Int16Array:
1145
- return 1 / 32767;
1146
- case Uint16Array:
1147
- return 1 / 65535;
1148
- default:
1149
- throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
1150
- }
1151
- }
1152
- function Xi(u) {
1153
- return u.search(/\.jpe?g($|\?)/i) > 0 || u.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : u.search(/\.webp($|\?)/i) > 0 || u.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
1154
- }
1155
- const Wi = new ft();
1156
- class Yi {
1157
- constructor(t = {}, e = {}) {
1158
- this.json = t, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new gi(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
1159
- let n = !1, s = !1, i = -1;
1160
- typeof navigator != "undefined" && (n = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, s = navigator.userAgent.indexOf("Firefox") > -1, i = s ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap == "undefined" || n || s && i < 98 ? this.textureLoader = new Xs(this.options.manager) : this.textureLoader = new Rn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Ys(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1161
- }
1162
- setExtensions(t) {
1163
- this.extensions = t;
1164
- }
1165
- setPlugins(t) {
1166
- this.plugins = t;
1167
- }
1168
- parse(t, e) {
1169
- const n = this, s = this.json, i = this.extensions;
1170
- this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(o) {
1171
- return o._markDefs && o._markDefs();
1172
- }), Promise.all(this._invokeAll(function(o) {
1173
- return o.beforeRoot && o.beforeRoot();
1174
- })).then(function() {
1175
- return Promise.all([
1176
- n.getDependencies("scene"),
1177
- n.getDependencies("animation"),
1178
- n.getDependencies("camera")
1179
- ]);
1180
- }).then(function(o) {
1181
- const c = {
1182
- scene: o[0][s.scene || 0],
1183
- scenes: o[0],
1184
- animations: o[1],
1185
- cameras: o[2],
1186
- asset: s.asset,
1187
- parser: n,
1188
- userData: {}
1189
- };
1190
- return Se(i, c, s), J(c, s), Promise.all(n._invokeAll(function(a) {
1191
- return a.afterRoot && a.afterRoot(c);
1192
- })).then(function() {
1193
- for (const a of c.scenes)
1194
- a.updateMatrixWorld();
1195
- t(c);
1196
- });
1197
- }).catch(e);
1198
- }
1199
- /**
1200
- * Marks the special nodes/meshes in json for efficient parse.
1201
- */
1202
- _markDefs() {
1203
- const t = this.json.nodes || [], e = this.json.skins || [], n = this.json.meshes || [];
1204
- for (let s = 0, i = e.length; s < i; s++) {
1205
- const o = e[s].joints;
1206
- for (let c = 0, a = o.length; c < a; c++)
1207
- t[o[c]].isBone = !0;
1208
- }
1209
- for (let s = 0, i = t.length; s < i; s++) {
1210
- const o = t[s];
1211
- o.mesh !== void 0 && (this._addNodeRef(this.meshCache, o.mesh), o.skin !== void 0 && (n[o.mesh].isSkinnedMesh = !0)), o.camera !== void 0 && this._addNodeRef(this.cameraCache, o.camera);
1212
- }
1213
- }
1214
- /**
1215
- * Counts references to shared node / Object3D resources. These resources
1216
- * can be reused, or "instantiated", at multiple nodes in the scene
1217
- * hierarchy. Mesh, Camera, and Light instances are instantiated and must
1218
- * be marked. Non-scenegraph resources (like Materials, Geometries, and
1219
- * Textures) can be reused directly and are not marked here.
1220
- *
1221
- * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
1222
- */
1223
- _addNodeRef(t, e) {
1224
- e !== void 0 && (t.refs[e] === void 0 && (t.refs[e] = t.uses[e] = 0), t.refs[e]++);
1225
- }
1226
- /** Returns a reference to a shared resource, cloning it if necessary. */
1227
- _getNodeRef(t, e, n) {
1228
- if (t.refs[e] <= 1)
1229
- return n;
1230
- const s = n.clone(), i = (o, c) => {
1231
- const a = this.associations.get(o);
1232
- a != null && this.associations.set(c, a);
1233
- for (const [l, d] of o.children.entries())
1234
- i(d, c.children[l]);
1235
- };
1236
- return i(n, s), s.name += "_instance_" + t.uses[e]++, s;
1237
- }
1238
- _invokeOne(t) {
1239
- const e = Object.values(this.plugins);
1240
- e.push(this);
1241
- for (let n = 0; n < e.length; n++) {
1242
- const s = t(e[n]);
1243
- if (s)
1244
- return s;
1245
- }
1246
- return null;
1247
- }
1248
- _invokeAll(t) {
1249
- const e = Object.values(this.plugins);
1250
- e.unshift(this);
1251
- const n = [];
1252
- for (let s = 0; s < e.length; s++) {
1253
- const i = t(e[s]);
1254
- i && n.push(i);
1255
- }
1256
- return n;
1257
- }
1258
- /**
1259
- * Requests the specified dependency asynchronously, with caching.
1260
- * @param {string} type
1261
- * @param {number} index
1262
- * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
1263
- */
1264
- getDependency(t, e) {
1265
- const n = t + ":" + e;
1266
- let s = this.cache.get(n);
1267
- if (!s) {
1268
- switch (t) {
1269
- case "scene":
1270
- s = this.loadScene(e);
1271
- break;
1272
- case "node":
1273
- s = this._invokeOne(function(i) {
1274
- return i.loadNode && i.loadNode(e);
1275
- });
1276
- break;
1277
- case "mesh":
1278
- s = this._invokeOne(function(i) {
1279
- return i.loadMesh && i.loadMesh(e);
1280
- });
1281
- break;
1282
- case "accessor":
1283
- s = this.loadAccessor(e);
1284
- break;
1285
- case "bufferView":
1286
- s = this._invokeOne(function(i) {
1287
- return i.loadBufferView && i.loadBufferView(e);
1288
- });
1289
- break;
1290
- case "buffer":
1291
- s = this.loadBuffer(e);
1292
- break;
1293
- case "material":
1294
- s = this._invokeOne(function(i) {
1295
- return i.loadMaterial && i.loadMaterial(e);
1296
- });
1297
- break;
1298
- case "texture":
1299
- s = this._invokeOne(function(i) {
1300
- return i.loadTexture && i.loadTexture(e);
1301
- });
1302
- break;
1303
- case "skin":
1304
- s = this.loadSkin(e);
1305
- break;
1306
- case "animation":
1307
- s = this._invokeOne(function(i) {
1308
- return i.loadAnimation && i.loadAnimation(e);
1309
- });
1310
- break;
1311
- case "camera":
1312
- s = this.loadCamera(e);
1313
- break;
1314
- default:
1315
- if (s = this._invokeOne(function(i) {
1316
- return i != this && i.getDependency && i.getDependency(t, e);
1317
- }), !s)
1318
- throw new Error("Unknown type: " + t);
1319
- break;
1320
- }
1321
- this.cache.add(n, s);
1322
- }
1323
- return s;
1324
- }
1325
- /**
1326
- * Requests all dependencies of the specified type asynchronously, with caching.
1327
- * @param {string} type
1328
- * @return {Promise<Array<Object>>}
1329
- */
1330
- getDependencies(t) {
1331
- let e = this.cache.get(t);
1332
- if (!e) {
1333
- const n = this, s = this.json[t + (t === "mesh" ? "es" : "s")] || [];
1334
- e = Promise.all(s.map(function(i, o) {
1335
- return n.getDependency(t, o);
1336
- })), this.cache.add(t, e);
1337
- }
1338
- return e;
1339
- }
1340
- /**
1341
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1342
- * @param {number} bufferIndex
1343
- * @return {Promise<ArrayBuffer>}
1344
- */
1345
- loadBuffer(t) {
1346
- const e = this.json.buffers[t], n = this.fileLoader;
1347
- if (e.type && e.type !== "arraybuffer")
1348
- throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
1349
- if (e.uri === void 0 && t === 0)
1350
- return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);
1351
- const s = this.options;
1352
- return new Promise(function(i, o) {
1353
- n.load(Tt.resolveURL(e.uri, s.path), i, void 0, function() {
1354
- o(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'));
1355
- });
1356
- });
1357
- }
1358
- /**
1359
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1360
- * @param {number} bufferViewIndex
1361
- * @return {Promise<ArrayBuffer>}
1362
- */
1363
- loadBufferView(t) {
1364
- const e = this.json.bufferViews[t];
1365
- return this.getDependency("buffer", e.buffer).then(function(n) {
1366
- const s = e.byteLength || 0, i = e.byteOffset || 0;
1367
- return n.slice(i, i + s);
1368
- });
1369
- }
1370
- /**
1371
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1372
- * @param {number} accessorIndex
1373
- * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1374
- */
1375
- loadAccessor(t) {
1376
- const e = this, n = this.json, s = this.json.accessors[t];
1377
- if (s.bufferView === void 0 && s.sparse === void 0) {
1378
- const o = ls[s.type], c = Ge[s.componentType], a = s.normalized === !0, l = new c(s.count * o);
1379
- return Promise.resolve(new Xt(l, o, a));
1380
- }
1381
- const i = [];
1382
- return s.bufferView !== void 0 ? i.push(this.getDependency("bufferView", s.bufferView)) : i.push(null), s.sparse !== void 0 && (i.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(i).then(function(o) {
1383
- const c = o[0], a = ls[s.type], l = Ge[s.componentType], d = l.BYTES_PER_ELEMENT, h = d * a, p = s.byteOffset || 0, A = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, v = s.normalized === !0;
1384
- let b, g;
1385
- if (A && A !== h) {
1386
- const f = Math.floor(p / A), y = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + f + ":" + s.count;
1387
- let _ = e.cache.get(y);
1388
- _ || (b = new l(c, f * A, s.count * A / d), _ = new _n(b, A / d), e.cache.add(y, _)), g = new Mn(_, a, p % A / d, v);
1389
- } else
1390
- c === null ? b = new l(s.count * a) : b = new l(c, p, s.count * a), g = new Xt(b, a, v);
1391
- if (s.sparse !== void 0) {
1392
- const f = ls.SCALAR, y = Ge[s.sparse.indices.componentType], _ = s.sparse.indices.byteOffset || 0, T = s.sparse.values.byteOffset || 0, M = new y(o[1], _, s.sparse.count * f), F = new l(o[2], T, s.sparse.count * a);
1393
- c !== null && (g = new Xt(g.array.slice(), g.itemSize, g.normalized));
1394
- for (let O = 0, z = M.length; O < z; O++) {
1395
- const ce = M[O];
1396
- if (g.setX(ce, F[O * a]), a >= 2 && g.setY(ce, F[O * a + 1]), a >= 3 && g.setZ(ce, F[O * a + 2]), a >= 4 && g.setW(ce, F[O * a + 3]), a >= 5)
1397
- throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1398
- }
1399
- }
1400
- return g;
1401
- });
1402
- }
1403
- /**
1404
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1405
- * @param {number} textureIndex
1406
- * @return {Promise<THREE.Texture|null>}
1407
- */
1408
- loadTexture(t) {
1409
- const e = this.json, n = this.options, i = e.textures[t].source, o = e.images[i];
1410
- let c = this.textureLoader;
1411
- if (o.uri) {
1412
- const a = n.manager.getHandler(o.uri);
1413
- a !== null && (c = a);
1414
- }
1415
- return this.loadTextureImage(t, i, c);
1416
- }
1417
- loadTextureImage(t, e, n) {
1418
- const s = this, i = this.json, o = i.textures[t], c = i.images[e], a = (c.uri || c.bufferView) + ":" + o.sampler;
1419
- if (this.textureCache[a])
1420
- return this.textureCache[a];
1421
- const l = this.loadImageSource(e, n).then(function(d) {
1422
- d.flipY = !1, d.name = o.name || c.name || "", d.name === "" && typeof c.uri == "string" && c.uri.startsWith("data:image/") === !1 && (d.name = c.uri);
1423
- const p = (i.samplers || {})[o.sampler] || {};
1424
- return d.magFilter = Os[p.magFilter] || qs, d.minFilter = Os[p.minFilter] || Qs, d.wrapS = ks[p.wrapS] || gs, d.wrapT = ks[p.wrapT] || gs, s.associations.set(d, { textures: t }), d;
1425
- }).catch(function() {
1426
- return null;
1427
- });
1428
- return this.textureCache[a] = l, l;
1429
- }
1430
- loadImageSource(t, e) {
1431
- const n = this, s = this.json, i = this.options;
1432
- if (this.sourceCache[t] !== void 0)
1433
- return this.sourceCache[t].then((h) => h.clone());
1434
- const o = s.images[t], c = self.URL || self.webkitURL;
1435
- let a = o.uri || "", l = !1;
1436
- if (o.bufferView !== void 0)
1437
- a = n.getDependency("bufferView", o.bufferView).then(function(h) {
1438
- l = !0;
1439
- const p = new Blob([h], { type: o.mimeType });
1440
- return a = c.createObjectURL(p), a;
1441
- });
1442
- else if (o.uri === void 0)
1443
- throw new Error("THREE.GLTFLoader: Image " + t + " is missing URI and bufferView");
1444
- const d = Promise.resolve(a).then(function(h) {
1445
- return new Promise(function(p, A) {
1446
- let v = p;
1447
- e.isImageBitmapLoader === !0 && (v = function(b) {
1448
- const g = new Ms(b);
1449
- g.needsUpdate = !0, p(g);
1450
- }), e.load(Tt.resolveURL(h, i.path), v, void 0, A);
1451
- });
1452
- }).then(function(h) {
1453
- return l === !0 && c.revokeObjectURL(a), J(h, o), h.userData.mimeType = o.mimeType || Xi(o.uri), h;
1454
- }).catch(function(h) {
1455
- throw console.error("THREE.GLTFLoader: Couldn't load texture", a), h;
1456
- });
1457
- return this.sourceCache[t] = d, d;
1458
- }
1459
- /**
1460
- * Asynchronously assigns a texture to the given material parameters.
1461
- * @param {Object} materialParams
1462
- * @param {string} mapName
1463
- * @param {Object} mapDef
1464
- * @return {Promise<Texture>}
1465
- */
1466
- assignTexture(t, e, n, s) {
1467
- const i = this;
1468
- return this.getDependency("texture", n.index).then(function(o) {
1469
- if (!o)
1470
- return null;
1471
- if (n.texCoord !== void 0 && n.texCoord > 0 && (o = o.clone(), o.channel = n.texCoord), i.extensions[w.KHR_TEXTURE_TRANSFORM]) {
1472
- const c = n.extensions !== void 0 ? n.extensions[w.KHR_TEXTURE_TRANSFORM] : void 0;
1473
- if (c) {
1474
- const a = i.associations.get(o);
1475
- o = i.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(o, c), i.associations.set(o, a);
1476
- }
1477
- }
1478
- return s !== void 0 && (o.colorSpace = s), t[e] = o, o;
1479
- });
1480
- }
1481
- /**
1482
- * Assigns final material to a Mesh, Line, or Points instance. The instance
1483
- * already has a material (generated from the glTF material options alone)
1484
- * but reuse of the same glTF material may require multiple threejs materials
1485
- * to accommodate different primitive types, defines, etc. New materials will
1486
- * be created if necessary, and reused from a cache.
1487
- * @param {Object3D} mesh Mesh, Line, or Points instance.
1488
- */
1489
- assignFinalMaterial(t) {
1490
- const e = t.geometry;
1491
- let n = t.material;
1492
- const s = e.attributes.tangent === void 0, i = e.attributes.color !== void 0, o = e.attributes.normal === void 0;
1493
- if (t.isPoints) {
1494
- const c = "PointsMaterial:" + n.uuid;
1495
- let a = this.cache.get(c);
1496
- a || (a = new Ln(), as.prototype.copy.call(a, n), a.color.copy(n.color), a.map = n.map, a.sizeAttenuation = !1, this.cache.add(c, a)), n = a;
1497
- } else if (t.isLine) {
1498
- const c = "LineBasicMaterial:" + n.uuid;
1499
- let a = this.cache.get(c);
1500
- a || (a = new Cn(), as.prototype.copy.call(a, n), a.color.copy(n.color), a.map = n.map, this.cache.add(c, a)), n = a;
1501
- }
1502
- if (s || i || o) {
1503
- let c = "ClonedMaterial:" + n.uuid + ":";
1504
- s && (c += "derivative-tangents:"), i && (c += "vertex-colors:"), o && (c += "flat-shading:");
1505
- let a = this.cache.get(c);
1506
- a || (a = n.clone(), i && (a.vertexColors = !0), o && (a.flatShading = !0), s && (a.normalScale && (a.normalScale.y *= -1), a.clearcoatNormalScale && (a.clearcoatNormalScale.y *= -1)), this.cache.add(c, a), this.associations.set(a, this.associations.get(n))), n = a;
1507
- }
1508
- t.material = n;
1509
- }
1510
- getMaterialType() {
1511
- return $s;
1512
- }
1513
- /**
1514
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1515
- * @param {number} materialIndex
1516
- * @return {Promise<Material>}
1517
- */
1518
- loadMaterial(t) {
1519
- const e = this, n = this.json, s = this.extensions, i = n.materials[t];
1520
- let o;
1521
- const c = {}, a = i.extensions || {}, l = [];
1522
- if (a[w.KHR_MATERIALS_UNLIT]) {
1523
- const h = s[w.KHR_MATERIALS_UNLIT];
1524
- o = h.getMaterialType(), l.push(h.extendParams(c, i, e));
1525
- } else {
1526
- const h = i.pbrMetallicRoughness || {};
1527
- if (c.color = new B(1, 1, 1), c.opacity = 1, Array.isArray(h.baseColorFactor)) {
1528
- const p = h.baseColorFactor;
1529
- c.color.setRGB(p[0], p[1], p[2], ae), c.opacity = p[3];
1530
- }
1531
- h.baseColorTexture !== void 0 && l.push(e.assignTexture(c, "map", h.baseColorTexture, dt)), c.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, c.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (l.push(e.assignTexture(c, "metalnessMap", h.metallicRoughnessTexture)), l.push(e.assignTexture(c, "roughnessMap", h.metallicRoughnessTexture))), o = this._invokeOne(function(p) {
1532
- return p.getMaterialType && p.getMaterialType(t);
1533
- }), l.push(Promise.all(this._invokeAll(function(p) {
1534
- return p.extendMaterialParams && p.extendMaterialParams(t, c);
1535
- })));
1536
- }
1537
- i.doubleSided === !0 && (c.side = Dn);
1538
- const d = i.alphaMode || us.OPAQUE;
1539
- if (d === us.BLEND ? (c.transparent = !0, c.depthWrite = !1) : (c.transparent = !1, d === us.MASK && (c.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== yt && (l.push(e.assignTexture(c, "normalMap", i.normalTexture)), c.normalScale = new oe(1, 1), i.normalTexture.scale !== void 0)) {
1540
- const h = i.normalTexture.scale;
1541
- c.normalScale.set(h, h);
1542
- }
1543
- if (i.occlusionTexture !== void 0 && o !== yt && (l.push(e.assignTexture(c, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (c.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && o !== yt) {
1544
- const h = i.emissiveFactor;
1545
- c.emissive = new B().setRGB(h[0], h[1], h[2], ae);
1546
- }
1547
- return i.emissiveTexture !== void 0 && o !== yt && l.push(e.assignTexture(c, "emissiveMap", i.emissiveTexture, dt)), Promise.all(l).then(function() {
1548
- const h = new o(c);
1549
- return i.name && (h.name = i.name), J(h, i), e.associations.set(h, { materials: t }), i.extensions && Se(s, h, i), h;
1550
- });
1551
- }
1552
- /** When Object3D instances are targeted by animation, they need unique names. */
1553
- createUniqueName(t) {
1554
- const e = Nn.sanitizeNodeName(t || "");
1555
- return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
1556
- }
1557
- /**
1558
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
1559
- *
1560
- * Creates BufferGeometries from primitives.
1561
- *
1562
- * @param {Array<GLTF.Primitive>} primitives
1563
- * @return {Promise<Array<BufferGeometry>>}
1564
- */
1565
- loadGeometries(t) {
1566
- const e = this, n = this.extensions, s = this.primitiveCache;
1567
- function i(c) {
1568
- return n[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c, e).then(function(a) {
1569
- return Ps(a, c, e);
1570
- });
1571
- }
1572
- const o = [];
1573
- for (let c = 0, a = t.length; c < a; c++) {
1574
- const l = t[c], d = ji(l), h = s[d];
1575
- if (h)
1576
- o.push(h.promise);
1577
- else {
1578
- let p;
1579
- l.extensions && l.extensions[w.KHR_DRACO_MESH_COMPRESSION] ? p = i(l) : p = Ps(new Zs(), l, e), s[d] = { primitive: l, promise: p }, o.push(p);
1580
- }
1581
- }
1582
- return Promise.all(o);
1583
- }
1584
- /**
1585
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
1586
- * @param {number} meshIndex
1587
- * @return {Promise<Group|Mesh|SkinnedMesh>}
1588
- */
1589
- loadMesh(t) {
1590
- const e = this, n = this.json, s = this.extensions, i = n.meshes[t], o = i.primitives, c = [];
1591
- for (let a = 0, l = o.length; a < l; a++) {
1592
- const d = o[a].material === void 0 ? zi(this.cache) : this.getDependency("material", o[a].material);
1593
- c.push(d);
1594
- }
1595
- return c.push(e.loadGeometries(o)), Promise.all(c).then(function(a) {
1596
- const l = a.slice(0, a.length - 1), d = a[a.length - 1], h = [];
1597
- for (let A = 0, v = d.length; A < v; A++) {
1598
- const b = d[A], g = o[A];
1599
- let f;
1600
- const y = l[A];
1601
- if (g.mode === G.TRIANGLES || g.mode === G.TRIANGLE_STRIP || g.mode === G.TRIANGLE_FAN || g.mode === void 0)
1602
- f = i.isSkinnedMesh === !0 ? new In(b, y) : new Ee(b, y), f.isSkinnedMesh === !0 && f.normalizeSkinWeights(), g.mode === G.TRIANGLE_STRIP ? f.geometry = Is(f.geometry, Ws) : g.mode === G.TRIANGLE_FAN && (f.geometry = Is(f.geometry, ms));
1603
- else if (g.mode === G.LINES)
1604
- f = new Js(b, y);
1605
- else if (g.mode === G.LINE_STRIP)
1606
- f = new Fn(b, y);
1607
- else if (g.mode === G.LINE_LOOP)
1608
- f = new On(b, y);
1609
- else if (g.mode === G.POINTS)
1610
- f = new kn(b, y);
1611
- else
1612
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + g.mode);
1613
- Object.keys(f.geometry.morphAttributes).length > 0 && Ki(f, i), f.name = e.createUniqueName(i.name || "mesh_" + t), J(f, i), g.extensions && Se(s, f, g), e.assignFinalMaterial(f), h.push(f);
1614
- }
1615
- for (let A = 0, v = h.length; A < v; A++)
1616
- e.associations.set(h[A], {
1617
- meshes: t,
1618
- primitives: A
1619
- });
1620
- if (h.length === 1)
1621
- return i.extensions && Se(s, h[0], i), h[0];
1622
- const p = new wt();
1623
- i.extensions && Se(s, p, i), e.associations.set(p, { meshes: t });
1624
- for (let A = 0, v = h.length; A < v; A++)
1625
- p.add(h[A]);
1626
- return p;
1627
- });
1628
- }
1629
- /**
1630
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
1631
- * @param {number} cameraIndex
1632
- * @return {Promise<THREE.Camera>}
1633
- */
1634
- loadCamera(t) {
1635
- let e;
1636
- const n = this.json.cameras[t], s = n[n.type];
1637
- if (!s) {
1638
- console.warn("THREE.GLTFLoader: Missing camera parameters.");
1639
- return;
1640
- }
1641
- return n.type === "perspective" ? e = new ps(Pn.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (e = new qt(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (e.name = this.createUniqueName(n.name)), J(e, n), Promise.resolve(e);
1642
- }
1643
- /**
1644
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
1645
- * @param {number} skinIndex
1646
- * @return {Promise<Skeleton>}
1647
- */
1648
- loadSkin(t) {
1649
- const e = this.json.skins[t], n = [];
1650
- for (let s = 0, i = e.joints.length; s < i; s++)
1651
- n.push(this._loadNodeShallow(e.joints[s]));
1652
- return e.inverseBindMatrices !== void 0 ? n.push(this.getDependency("accessor", e.inverseBindMatrices)) : n.push(null), Promise.all(n).then(function(s) {
1653
- const i = s.pop(), o = s, c = [], a = [];
1654
- for (let l = 0, d = o.length; l < d; l++) {
1655
- const h = o[l];
1656
- if (h) {
1657
- c.push(h);
1658
- const p = new ft();
1659
- i !== null && p.fromArray(i.array, l * 16), a.push(p);
1660
- } else
1661
- console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[l]);
1662
- }
1663
- return new Bn(c, a);
1664
- });
1665
- }
1666
- /**
1667
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
1668
- * @param {number} animationIndex
1669
- * @return {Promise<AnimationClip>}
1670
- */
1671
- loadAnimation(t) {
1672
- const e = this.json, n = this, s = e.animations[t], i = s.name ? s.name : "animation_" + t, o = [], c = [], a = [], l = [], d = [];
1673
- for (let h = 0, p = s.channels.length; h < p; h++) {
1674
- const A = s.channels[h], v = s.samplers[A.sampler], b = A.target, g = b.node, f = s.parameters !== void 0 ? s.parameters[v.input] : v.input, y = s.parameters !== void 0 ? s.parameters[v.output] : v.output;
1675
- b.node !== void 0 && (o.push(this.getDependency("node", g)), c.push(this.getDependency("accessor", f)), a.push(this.getDependency("accessor", y)), l.push(v), d.push(b));
1676
- }
1677
- return Promise.all([
1678
- Promise.all(o),
1679
- Promise.all(c),
1680
- Promise.all(a),
1681
- Promise.all(l),
1682
- Promise.all(d)
1683
- ]).then(function(h) {
1684
- const p = h[0], A = h[1], v = h[2], b = h[3], g = h[4], f = [];
1685
- for (let y = 0, _ = p.length; y < _; y++) {
1686
- const T = p[y], M = A[y], F = v[y], O = b[y], z = g[y];
1687
- if (T === void 0)
1688
- continue;
1689
- T.updateMatrix && T.updateMatrix();
1690
- const ce = n._createAnimationTracks(T, M, F, O, z);
1691
- if (ce)
1692
- for (let ns = 0; ns < ce.length; ns++)
1693
- f.push(ce[ns]);
1694
- }
1695
- return new Hn(i, void 0, f);
1696
- });
1697
- }
1698
- createNodeMesh(t) {
1699
- const e = this.json, n = this, s = e.nodes[t];
1700
- return s.mesh === void 0 ? null : n.getDependency("mesh", s.mesh).then(function(i) {
1701
- const o = n._getNodeRef(n.meshCache, s.mesh, i);
1702
- return s.weights !== void 0 && o.traverse(function(c) {
1703
- if (c.isMesh)
1704
- for (let a = 0, l = s.weights.length; a < l; a++)
1705
- c.morphTargetInfluences[a] = s.weights[a];
1706
- }), o;
1707
- });
1708
- }
1709
- /**
1710
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
1711
- * @param {number} nodeIndex
1712
- * @return {Promise<Object3D>}
1713
- */
1714
- loadNode(t) {
1715
- const e = this.json, n = this, s = e.nodes[t], i = n._loadNodeShallow(t), o = [], c = s.children || [];
1716
- for (let l = 0, d = c.length; l < d; l++)
1717
- o.push(n.getDependency("node", c[l]));
1718
- const a = s.skin === void 0 ? Promise.resolve(null) : n.getDependency("skin", s.skin);
1719
- return Promise.all([
1720
- i,
1721
- Promise.all(o),
1722
- a
1723
- ]).then(function(l) {
1724
- const d = l[0], h = l[1], p = l[2];
1725
- p !== null && d.traverse(function(A) {
1726
- A.isSkinnedMesh && A.bind(p, Wi);
1727
- });
1728
- for (let A = 0, v = h.length; A < v; A++)
1729
- d.add(h[A]);
1730
- return d;
1731
- });
1732
- }
1733
- // ._loadNodeShallow() parses a single node.
1734
- // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1735
- _loadNodeShallow(t) {
1736
- const e = this.json, n = this.extensions, s = this;
1737
- if (this.nodeCache[t] !== void 0)
1738
- return this.nodeCache[t];
1739
- const i = e.nodes[t], o = i.name ? s.createUniqueName(i.name) : "", c = [], a = s._invokeOne(function(l) {
1740
- return l.createNodeMesh && l.createNodeMesh(t);
1741
- });
1742
- return a && c.push(a), i.camera !== void 0 && c.push(s.getDependency("camera", i.camera).then(function(l) {
1743
- return s._getNodeRef(s.cameraCache, i.camera, l);
1744
- })), s._invokeAll(function(l) {
1745
- return l.createNodeAttachment && l.createNodeAttachment(t);
1746
- }).forEach(function(l) {
1747
- c.push(l);
1748
- }), this.nodeCache[t] = Promise.all(c).then(function(l) {
1749
- let d;
1750
- if (i.isBone === !0 ? d = new Gn() : l.length > 1 ? d = new wt() : l.length === 1 ? d = l[0] : d = new Es(), d !== l[0])
1751
- for (let h = 0, p = l.length; h < p; h++)
1752
- d.add(l[h]);
1753
- if (i.name && (d.userData.name = i.name, d.name = o), J(d, i), i.extensions && Se(n, d, i), i.matrix !== void 0) {
1754
- const h = new ft();
1755
- h.fromArray(i.matrix), d.applyMatrix4(h);
1756
- } else
1757
- i.translation !== void 0 && d.position.fromArray(i.translation), i.rotation !== void 0 && d.quaternion.fromArray(i.rotation), i.scale !== void 0 && d.scale.fromArray(i.scale);
1758
- return s.associations.has(d) || s.associations.set(d, {}), s.associations.get(d).nodes = t, d;
1759
- }), this.nodeCache[t];
1760
- }
1761
- /**
1762
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
1763
- * @param {number} sceneIndex
1764
- * @return {Promise<Group>}
1765
- */
1766
- loadScene(t) {
1767
- const e = this.extensions, n = this.json.scenes[t], s = this, i = new wt();
1768
- n.name && (i.name = s.createUniqueName(n.name)), J(i, n), n.extensions && Se(e, i, n);
1769
- const o = n.nodes || [], c = [];
1770
- for (let a = 0, l = o.length; a < l; a++)
1771
- c.push(s.getDependency("node", o[a]));
1772
- return Promise.all(c).then(function(a) {
1773
- for (let d = 0, h = a.length; d < h; d++)
1774
- i.add(a[d]);
1775
- const l = (d) => {
1776
- const h = /* @__PURE__ */ new Map();
1777
- for (const [p, A] of s.associations)
1778
- (p instanceof as || p instanceof Ms) && h.set(p, A);
1779
- return d.traverse((p) => {
1780
- const A = s.associations.get(p);
1781
- A != null && h.set(p, A);
1782
- }), h;
1783
- };
1784
- return s.associations = l(i), i;
1785
- });
1786
- }
1787
- _createAnimationTracks(t, e, n, s, i) {
1788
- const o = [], c = t.name ? t.name : t.uuid, a = [];
1789
- le[i.path] === le.weights ? t.traverse(function(p) {
1790
- p.morphTargetInfluences && a.push(p.name ? p.name : p.uuid);
1791
- }) : a.push(c);
1792
- let l;
1793
- switch (le[i.path]) {
1794
- case le.weights:
1795
- l = Cs;
1796
- break;
1797
- case le.rotation:
1798
- l = Ds;
1799
- break;
1800
- case le.position:
1801
- case le.scale:
1802
- l = Ls;
1803
- break;
1804
- default:
1805
- switch (n.itemSize) {
1806
- case 1:
1807
- l = Cs;
1808
- break;
1809
- case 2:
1810
- case 3:
1811
- default:
1812
- l = Ls;
1813
- break;
1814
- }
1815
- break;
1816
- }
1817
- const d = s.interpolation !== void 0 ? Ui[s.interpolation] : en, h = this._getArrayFromAccessor(n);
1818
- for (let p = 0, A = a.length; p < A; p++) {
1819
- const v = new l(
1820
- a[p] + "." + le[i.path],
1821
- e.array,
1822
- h,
1823
- d
1824
- );
1825
- s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(v), o.push(v);
1826
- }
1827
- return o;
1828
- }
1829
- _getArrayFromAccessor(t) {
1830
- let e = t.array;
1831
- if (t.normalized) {
1832
- const n = vs(e.constructor), s = new Float32Array(e.length);
1833
- for (let i = 0, o = e.length; i < o; i++)
1834
- s[i] = e[i] * n;
1835
- e = s;
1836
- }
1837
- return e;
1838
- }
1839
- _createCubicSplineTrackInterpolant(t) {
1840
- t.createInterpolant = function(n) {
1841
- const s = this instanceof Ds ? Gi : sn;
1842
- return new s(this.times, this.values, this.getValueSize() / 3, n);
1843
- }, t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1844
- }
1845
- }
1846
- function qi(u, t, e) {
1847
- const n = t.attributes, s = new qn();
1848
- if (n.POSITION !== void 0) {
1849
- const c = e.json.accessors[n.POSITION], a = c.min, l = c.max;
1850
- if (a !== void 0 && l !== void 0) {
1851
- if (s.set(
1852
- new L(a[0], a[1], a[2]),
1853
- new L(l[0], l[1], l[2])
1854
- ), c.normalized) {
1855
- const d = vs(Ge[c.componentType]);
1856
- s.min.multiplyScalar(d), s.max.multiplyScalar(d);
1857
- }
1858
- } else {
1859
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1860
- return;
1861
- }
1862
- } else
1863
- return;
1864
- const i = t.targets;
1865
- if (i !== void 0) {
1866
- const c = new L(), a = new L();
1867
- for (let l = 0, d = i.length; l < d; l++) {
1868
- const h = i[l];
1869
- if (h.POSITION !== void 0) {
1870
- const p = e.json.accessors[h.POSITION], A = p.min, v = p.max;
1871
- if (A !== void 0 && v !== void 0) {
1872
- if (a.setX(Math.max(Math.abs(A[0]), Math.abs(v[0]))), a.setY(Math.max(Math.abs(A[1]), Math.abs(v[1]))), a.setZ(Math.max(Math.abs(A[2]), Math.abs(v[2]))), p.normalized) {
1873
- const b = vs(Ge[p.componentType]);
1874
- a.multiplyScalar(b);
1875
- }
1876
- c.max(a);
1877
- } else
1878
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1879
- }
1880
- }
1881
- s.expandByVector(c);
1882
- }
1883
- u.boundingBox = s;
1884
- const o = new Qn();
1885
- s.getCenter(o.center), o.radius = s.min.distanceTo(s.max) / 2, u.boundingSphere = o;
1886
- }
1887
- function Ps(u, t, e) {
1888
- const n = t.attributes, s = [];
1889
- function i(o, c) {
1890
- return e.getDependency("accessor", o).then(function(a) {
1891
- u.setAttribute(c, a);
1892
- });
1893
- }
1894
- for (const o in n) {
1895
- const c = As[o] || o.toLowerCase();
1896
- c in u.attributes || s.push(i(n[o], c));
1897
- }
1898
- if (t.indices !== void 0 && !u.index) {
1899
- const o = e.getDependency("accessor", t.indices).then(function(c) {
1900
- u.setIndex(c);
1901
- });
1902
- s.push(o);
1903
- }
1904
- return _s.workingColorSpace !== ae && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${_s.workingColorSpace}" not supported.`), J(u, t), qi(u, t, e), Promise.all(s).then(function() {
1905
- return t.targets !== void 0 ? Vi(u, t.targets, e) : u;
1906
- });
1907
- }
1908
- var Le;
1909
- class Qi {
1910
- constructor() {
1911
- m(this, Le, new mi());
1912
- }
1913
- get gltfLoader() {
1914
- return r(this, Le);
1915
- }
1916
- setLoaders(t) {
1917
- return rs(this, null, function* () {
1918
- if (t != null && t.draco) {
1919
- const { DRACOLoader: e } = yield import("../DRACOLoader-D2KY2dku.js"), n = new e(), s = typeof t.draco == "boolean" ? `${S.CDNVersion}/examples/jsm/libs/draco/gltf/` : t.draco;
1920
- n.setDecoderPath(s), r(this, Le).setDRACOLoader(n);
1921
- }
1922
- if (t != null && t.ktx2) {
1923
- const { KTX2Loader: e } = yield import("../KTX2Loader-DqpAffDj.js"), n = new e(), s = typeof t.ktx2 == "boolean" ? `${S.CDNVersion}/examples/jsm/libs/basis/` : t.ktx2;
1924
- n.setTranscoderPath(s), r(this, Le).setKTX2Loader(
1925
- n.detectSupport(S.webglRenderer)
1926
- );
1927
- }
1928
- if (t != null && t.meshopt) {
1929
- const { MeshoptDecoder: e } = yield import("../MeshoptDecoder-6XfTpOG2.js");
1930
- r(this, Le).setMeshoptDecoder(e());
1931
- }
1932
- });
1933
- }
1934
- load(...t) {
1935
- const [e, n, ...s] = t;
1936
- if (S.cacheAssets && j.has(e)) {
1937
- const i = j.get(e).data;
1938
- n(i);
1939
- } else
1940
- this.gltfLoader.load(
1941
- e,
1942
- (i) => {
1943
- S.cacheAssets && j.set(e, {
1944
- data: i,
1945
- dispose: () => {
1946
- i.cameras.forEach((o) => pt(o)), i.scenes.forEach((o) => {
1947
- pt(o);
1948
- });
1949
- }
1950
- }), n(i);
1951
- },
1952
- ...s
1953
- );
1954
- }
1955
- }
1956
- Le = new WeakMap();
1957
- const $i = new Qi();
1958
- var te, D, se, Mt;
1959
- class Ur {
1960
- constructor(t, e) {
1961
- m(this, te, void 0);
1962
- m(this, D, void 0);
1963
- m(this, se, []);
1964
- m(this, Mt, () => {
1965
- const t = r(this, D).left - r(this, te).box.left, e = r(this, D).top - r(this, te).box.top;
1966
- let n = 0, s = 0;
1967
- r(this, te).isClipped || (n = r(this, D).position.x - r(this, D).left, s = r(this, D).position.y - r(this, D).top);
1968
- const i = r(this, te).box.width - r(this, D).scale.x, o = t - i, c = r(this, te).box.height - r(this, D).scale.y, a = e - c;
1969
- r(this, se)[0].constant = r(this, D).scale.y / 2 + s * -1 - c / 2 - a, r(this, se)[1].constant = r(this, D).scale.y / 2 + s + c / 2 + a, r(this, se)[2].constant = r(this, D).scale.x / 2 + n + i / 2 + o, r(this, se)[3].constant = r(this, D).scale.x / 2 + n * -1 - i / 2 - o;
1970
- });
1971
- x(this, te, S.getView((e == null ? void 0 : e.viewName) || "default")), x(this, D, new xs(t, { cartesian: !1 }));
1972
- const n = (e == null ? void 0 : e.scale) || 1;
1973
- x(this, se, [
1974
- new Kt(new L(0, -1 * n, 0)),
1975
- new Kt(new L(0, 1 * n, 0)),
1976
- new Kt(new L(-1 * n, 0, 0)),
1977
- new Kt(new L(1 * n, 0, 0))
1978
- ]), be.subscribe(r(this, Mt), { order: ws.LAYOUT_BOX });
1979
- }
1980
- get planes() {
1981
- return r(this, se);
1982
- }
1983
- get layoutBox() {
1984
- return r(this, D);
1985
- }
1986
- destroy() {
1987
- be.unsubscribe(r(this, Mt)), r(this, D).destroy();
1988
- }
1989
- }
1990
- te = new WeakMap(), D = new WeakMap(), se = new WeakMap(), Mt = new WeakMap();
1991
- class zr extends wt {
1992
- constructor(t, e = 500) {
1993
- super(), this.add(new jt(t.planes[0], e, 16711680)), this.add(new jt(t.planes[1], e, 16711680)), this.add(new jt(t.planes[2], e, 16711680)), this.add(new jt(t.planes[3], e, 16711680));
1994
- }
1995
- }
1996
- var je, Ce, Xe, Lt, Ct, pe, We, Dt;
1997
- class nn extends ri {
1998
- constructor(e) {
1999
- super(e);
2000
- m(this, je, new I(null));
2001
- m(this, Ce, new I(void 0));
2002
- m(this, Xe, void 0);
2003
- m(this, Lt, void 0);
2004
- m(this, Ct, void 0);
2005
- m(this, pe, void 0);
2006
- m(this, We, !1);
2007
- m(this, Dt, () => {
2008
- if (!(r(this, pe) && !r(this, We)) && (this.current !== this.previous && (r(this, je).current = null), this.current)) {
2009
- const e = r(this, Ct) ? this.current.url : this.current.name + this.current.extension;
2010
- r(this, pe) || cs.setTotal(e, 1), r(this, Ce).current = "start", r(this, Lt).load(
2011
- e,
2012
- (n) => {
2013
- var s;
2014
- r(this, je).current = ((s = this.processData) == null ? void 0 : s.call(this, n)) || n, r(this, Ce).current = "complete", r(this, pe) || cs.setLoaded(e, 1);
2015
- },
2016
- void 0,
2017
- () => {
2018
- r(this, pe) || (r(this, Ce).current = "error", cs.setError(e, e));
2019
- }
2020
- );
2021
- }
2022
- });
2023
- x(this, Xe, e.consumer), x(this, Lt, e.loader), x(this, Ct, e.keepSourceParameters || !1), x(this, pe, e.lazy || !1), this.subscribe(r(this, Dt)), r(this, Xe).addEventListener("added", () => {
2024
- this.connect();
2025
- }), r(this, Xe).addEventListener("removed", () => {
2026
- this.disconnect();
2027
- });
2028
- }
2029
- /**
2030
- * Resource store.
2031
- */
2032
- get data() {
2033
- return r(this, je);
2034
- }
2035
- /**
2036
- * Loading store.
2037
- */
2038
- get loading() {
2039
- return r(this, Ce);
2040
- }
2041
- /**
2042
- * Calling this method will start loading the resource.
2043
- */
2044
- lazyLoad() {
2045
- r(this, We) || (x(this, We, !0), r(this, Dt).call(this));
2046
- }
2047
- }
2048
- je = new WeakMap(), Ce = new WeakMap(), Xe = new WeakMap(), Lt = new WeakMap(), Ct = new WeakMap(), pe = new WeakMap(), We = new WeakMap(), Dt = new WeakMap();
2049
- var De;
2050
- class Vr extends wt {
2051
- constructor(e) {
2052
- super();
2053
- m(this, De, void 0);
2054
- x(this, De, new nn(Q({
2055
- loader: $i,
2056
- consumer: this
2057
- }, e))), r(this, De).processData = (n) => {
2058
- if (S.cacheAssets) {
2059
- const s = Q({}, n);
2060
- return s.scene = n.scene.clone(!0), s.scenes = n.scenes.map((i) => n.scene === i ? s.scene : i.clone(!0)), s;
2061
- }
2062
- return n;
2063
- }, r(this, De).data.subscribe((n) => {
2064
- n.current ? this.add(...n.current.scene.children) : this.children.forEach((s) => {
2065
- this.remove(s), pt(s);
2066
- });
2067
- });
2068
- }
2069
- get sourceManager() {
2070
- return r(this, De);
2071
- }
2072
- }
2073
- De = new WeakMap();
2074
- const mt = `attribute vec3 position;
2075
- uniform vec2 px;
2076
- uniform vec2 boundarySpace;
2077
- varying vec2 uv;
2078
-
2079
- precision highp float;
2080
-
2081
- void main(){
2082
- vec3 pos = position;
2083
- vec2 scale = 1.0 - boundarySpace * 2.0;
2084
- pos.xy = pos.xy * scale;
2085
- uv = vec2(0.5)+(pos.xy)*0.5;
2086
- gl_Position = vec4(pos, 1.0);
2087
- }`, Zi = `precision highp float;
2088
- uniform vec3 backgroundColor;
2089
- uniform float backgroundOpacity;
2090
- uniform vec3 fluidColor;
2091
- uniform float fluidOpacity;
2092
- uniform float backgroundMixThreshold;
2093
- uniform sampler2D velocity;
2094
- varying vec2 uv;
2095
-
2096
- void main(){
2097
- vec2 vel = texture2D(velocity, uv).xy;
2098
-
2099
- float len = length(vel);
2100
-
2101
- vel = vel * 0.5 + 0.5;
2102
-
2103
- vec4 backgroundColorA = mix(vec4(vec3(0.0,0.0,0.0), backgroundOpacity), vec4(backgroundColor, backgroundOpacity), backgroundMixThreshold);
2104
- vec4 fluidColorA = vec4(fluidColor, fluidOpacity);
2105
- vec4 finalColor = mix(backgroundColorA, fluidColorA, len);
2106
-
2107
- gl_FragColor = finalColor;
2108
- }`, Ji = `attribute vec3 position;
2109
- varying vec2 uv;
2110
- uniform vec2 px;
2111
-
2112
- precision highp float;
2113
-
2114
- void main(){
2115
- vec3 pos = position;
2116
- uv = 0.5 + pos.xy * 0.5;
2117
- vec2 n = sign(pos.xy);
2118
- pos.xy = abs(pos.xy) - px * 1.0;
2119
- pos.xy *= n;
2120
- gl_Position = vec4(pos, 1.0);
2121
- }`, Bs = `precision highp float;
2122
- uniform sampler2D velocity;
2123
- uniform float dt;
2124
- uniform bool isBFECC;
2125
- // uniform float uvScale;
2126
- uniform vec2 fboSize;
2127
- uniform vec2 px;
2128
- varying vec2 uv;
2129
-
2130
- void main(){
2131
- vec2 ratio = max(fboSize.x, fboSize.y) / fboSize;
2132
-
2133
- if(isBFECC == false){
2134
- vec2 vel = texture2D(velocity, uv).xy;
2135
- vec2 uv2 = uv - vel * dt * ratio;
2136
- vec2 newVel = texture2D(velocity, uv2).xy;
2137
- gl_FragColor = vec4(newVel, 0.0, 0.0);
2138
- } else {
2139
- vec2 spot_new = uv;
2140
- vec2 vel_old = texture2D(velocity, uv).xy;
2141
- // back trace
2142
- vec2 spot_old = spot_new - vel_old * dt * ratio;
2143
- vec2 vel_new1 = texture2D(velocity, spot_old).xy;
2144
-
2145
- // forward trace
2146
- vec2 spot_new2 = spot_old + vel_new1 * dt * ratio;
2147
-
2148
- vec2 error = spot_new2 - spot_new;
2149
-
2150
- vec2 spot_new3 = spot_new - error / 2.0;
2151
- vec2 vel_2 = texture2D(velocity, spot_new3).xy;
2152
-
2153
- // back trace 2
2154
- vec2 spot_old2 = spot_new3 - vel_2 * dt * ratio;
2155
- // gl_FragColor = vec4(spot_old2, 0.0, 0.0);
2156
- vec2 newVel2 = texture2D(velocity, spot_old2).xy;
2157
- gl_FragColor = vec4(newVel2, 0.0, 0.0);
2158
- }
2159
- }`;
2160
- var me, Ne, Nt, It, Ft, Ot, Ie;
2161
- class gt {
2162
- constructor(t) {
2163
- m(this, me, null);
2164
- m(this, Ne, null);
2165
- m(this, Nt, null);
2166
- m(this, It, null);
2167
- m(this, Ft, null);
2168
- m(this, Ot, void 0);
2169
- m(this, Ie, {});
2170
- var e;
2171
- if (x(this, Ot, t.material), (e = t.material) != null && e.uniforms)
2172
- for (const n in t.material.uniforms)
2173
- r(this, Ie)[n] = { value: t.material.uniforms[n] };
2174
- this.output = t.output;
2175
- }
2176
- get scene() {
2177
- return r(this, me);
2178
- }
2179
- get camera() {
2180
- return r(this, Ne);
2181
- }
2182
- get uniforms() {
2183
- return r(this, Ie);
2184
- }
2185
- update(...t) {
2186
- S.webglRenderer.setRenderTarget(this.output), S.webglRenderer.render(r(this, me), r(this, Ne)), S.webglRenderer.setRenderTarget(null);
2187
- }
2188
- dispose() {
2189
- pt(r(this, Ne)), pt(r(this, me));
2190
- }
2191
- init(...t) {
2192
- x(this, me, new js()), x(this, Ne, new Zn()), Object.keys(r(this, Ie)).length && (x(this, Nt, new ts(2, 2)), x(this, It, new ss(xt(Q({}, r(this, Ot)), {
2193
- uniforms: r(this, Ie)
2194
- }))), x(this, Ft, new Ee(r(this, Nt), r(this, It))), r(this, me).add(r(this, Ft)));
2195
- }
2196
- }
2197
- me = new WeakMap(), Ne = new WeakMap(), Nt = new WeakMap(), It = new WeakMap(), Ft = new WeakMap(), Ot = new WeakMap(), Ie = new WeakMap();
2198
- var Ye, $t, rn;
2199
- class er extends gt {
2200
- constructor(e) {
2201
- super({
2202
- material: {
2203
- vertexShader: mt,
2204
- fragmentShader: Bs,
2205
- uniforms: {
2206
- boundarySpace: e.cellScale,
2207
- px: e.cellScale,
2208
- fboSize: e.fboSize,
2209
- velocity: e.src.texture,
2210
- dt: e.dt,
2211
- isBFECC: e.BFECC
2212
- }
2213
- },
2214
- output: e.dst
2215
- });
2216
- m(this, $t);
2217
- m(this, Ye, null);
2218
- this.init();
2219
- }
2220
- update(e) {
2221
- this.uniforms.dt.value = e.dt, r(this, Ye).visible = e.isBounce, this.uniforms.isBFECC.value = e.BFECC, super.update();
2222
- }
2223
- init() {
2224
- super.init(), $(this, $t, rn).call(this);
2225
- }
2226
- }
2227
- Ye = new WeakMap(), $t = new WeakSet(), rn = function() {
2228
- const e = new Zs(), n = new Float32Array([
2229
- // left
2230
- -1,
2231
- -1,
2232
- 0,
2233
- -1,
2234
- 1,
2235
- 0,
2236
- // top
2237
- -1,
2238
- 1,
2239
- 0,
2240
- 1,
2241
- 1,
2242
- 0,
2243
- // right
2244
- 1,
2245
- 1,
2246
- 0,
2247
- 1,
2248
- -1,
2249
- 0,
2250
- // bottom
2251
- 1,
2252
- -1,
2253
- 0,
2254
- -1,
2255
- -1,
2256
- 0
2257
- ]);
2258
- e.setAttribute("position", new Xt(n, 3));
2259
- const s = new ss({
2260
- vertexShader: Ji,
2261
- fragmentShader: Bs,
2262
- uniforms: this.uniforms
2263
- });
2264
- x(this, Ye, new Js(e, s)), this.scene.add(r(this, Ye));
2265
- };
2266
- const tr = `precision highp float;
2267
-
2268
- attribute vec3 position;
2269
- attribute vec2 uv;
2270
- uniform vec2 center;
2271
- uniform vec2 scale;
2272
- uniform vec2 px;
2273
- varying vec2 vUv;
2274
-
2275
- void main(){
2276
- vec2 pos = position.xy * scale * 2.0 * px + center;
2277
- vUv = uv;
2278
- gl_Position = vec4(pos, 0.0, 1.0);
2279
- }
2280
- `, sr = `precision highp float;
2281
-
2282
- uniform vec2 force;
2283
- uniform vec2 center;
2284
- uniform vec2 scale;
2285
- uniform vec2 px;
2286
- varying vec2 vUv;
2287
-
2288
- void main(){
2289
- vec2 circle = (vUv - 0.5) * 2.0;
2290
- float d = 1.0-min(length(circle), 1.0);
2291
- d *= d;
2292
- gl_FragColor = vec4(force * d, 0, 1);
2293
- }
2294
- `;
2295
- var V, K, ge, qe;
2296
- class nr {
2297
- constructor() {
2298
- m(this, V, void 0);
2299
- m(this, K, void 0);
2300
- m(this, ge, void 0);
2301
- m(this, qe, void 0);
2302
- this.disabled = !1, x(this, V, new os.Vector2()), x(this, K, new os.Vector2()), x(this, ge, new os.Vector2()), x(this, qe, (t) => {
2303
- this.disabled || this.updateCoords(t.clientX, t.clientY);
2304
- });
2305
- }
2306
- init() {
2307
- document.body.addEventListener(
2308
- "pointermove",
2309
- r(this, qe),
2310
- !1
2311
- );
2312
- }
2313
- dispose() {
2314
- document.body.removeEventListener(
2315
- "pointermove",
2316
- r(this, qe),
2317
- !1
2318
- );
2319
- }
2320
- get coords() {
2321
- return r(this, V);
2322
- }
2323
- get diff() {
2324
- return r(this, ge);
2325
- }
2326
- updateCoords(t = 0, e = 0) {
2327
- r(this, V).set(t / S.width * 2 - 1, -(e / S.height) * 2 + 1), Math.abs(r(this, V).x - r(this, K).x) > 0.2 && (r(this, K).copy(r(this, V)), r(this, ge).subVectors(r(this, V), r(this, K)));
2328
- }
2329
- update() {
2330
- r(this, ge).subVectors(r(this, V), r(this, K)), r(this, K).copy(r(this, V)), r(this, K).x === 0 && r(this, K).y === 0 && r(this, ge).set(0, 0);
2331
- }
2332
- }
2333
- V = new WeakMap(), K = new WeakMap(), ge = new WeakMap(), qe = new WeakMap();
2334
- const Re = new nr();
2335
- var Qe;
2336
- class ir extends gt {
2337
- constructor(e) {
2338
- super({
2339
- output: e.dst
2340
- });
2341
- m(this, Qe, null);
2342
- this.init(e);
2343
- }
2344
- update(e) {
2345
- const n = Re.diff.x / 2 * e.pointerForce, s = Re.diff.y / 2 * e.pointerForce, i = e.pointerSize * e.cellScale.x, o = e.pointerSize * e.cellScale.y, c = Math.min(
2346
- Math.max(
2347
- Re.coords.x,
2348
- -1 + i + e.cellScale.x * 2
2349
- ),
2350
- 1 - i - e.cellScale.x * 2
2351
- ), a = Math.min(
2352
- Math.max(
2353
- Re.coords.y,
2354
- -1 + o + e.cellScale.y * 2
2355
- ),
2356
- 1 - o - e.cellScale.y * 2
2357
- ), l = r(this, Qe).material.uniforms;
2358
- l.force.value.set(n, s), l.center.value.set(c, a), l.scale.value.set(e.pointerSize, e.pointerSize), super.update();
2359
- }
2360
- init(e) {
2361
- super.init();
2362
- const n = new ts(1, 1), s = new ss({
2363
- vertexShader: tr,
2364
- fragmentShader: sr,
2365
- blending: Jn,
2366
- uniforms: {
2367
- px: {
2368
- value: e.cellScale
2369
- },
2370
- force: {
2371
- value: new oe(0, 0)
2372
- },
2373
- center: {
2374
- value: new oe(0, 0)
2375
- },
2376
- scale: {
2377
- value: new oe(e.pointerSize, e.pointerSize)
2378
- }
2379
- }
2380
- });
2381
- x(this, Qe, new Ee(n, s)), this.scene.add(r(this, Qe));
2382
- }
2383
- }
2384
- Qe = new WeakMap();
2385
- const rr = `precision highp float;
2386
- uniform sampler2D velocity;
2387
- uniform sampler2D velocity_new;
2388
- uniform float v;
2389
- uniform vec2 px;
2390
- uniform float dt;
2391
-
2392
- varying vec2 uv;
2393
-
2394
- void main(){
2395
- // poisson equation
2396
- vec2 old = texture2D(velocity, uv).xy;
2397
- vec2 new0 = texture2D(velocity_new, uv + vec2(px.x * 2.0, 0)).xy;
2398
- vec2 new1 = texture2D(velocity_new, uv - vec2(px.x * 2.0, 0)).xy;
2399
- vec2 new2 = texture2D(velocity_new, uv + vec2(0, px.y * 2.0)).xy;
2400
- vec2 new3 = texture2D(velocity_new, uv - vec2(0, px.y * 2.0)).xy;
2401
-
2402
- vec2 new = 4.0 * old + v * dt * (new0 + new1 + new2 + new3);
2403
- new /= 4.0 * (1.0 + v * dt);
2404
-
2405
- gl_FragColor = vec4(new, 0.0, 0.0);
2406
- }
2407
- `;
2408
- var $e, Ze;
2409
- class or extends gt {
2410
- constructor(e) {
2411
- super({
2412
- material: {
2413
- vertexShader: mt,
2414
- fragmentShader: rr,
2415
- uniforms: {
2416
- boundarySpace: e.boundarySpace,
2417
- velocity: e.src.texture,
2418
- velocity_new: e.dst_.texture,
2419
- v: e.viscous,
2420
- px: e.cellScale,
2421
- dt: e.dt
2422
- }
2423
- },
2424
- output: e.dst
2425
- });
2426
- m(this, $e, void 0);
2427
- m(this, Ze, void 0);
2428
- x(this, $e, e.dst_), x(this, Ze, e.dst), this.init();
2429
- }
2430
- update(e) {
2431
- let n = null, s = null;
2432
- this.uniforms.v.value = e.viscous;
2433
- for (var i = 0; i < e.iterations; i++)
2434
- i % 2 == 0 ? (n = r(this, $e), s = r(this, Ze)) : (n = r(this, Ze), s = r(this, $e)), this.uniforms.velocity_new.value = n.texture, this.output = s, this.uniforms.dt.value = e.dt, super.update();
2435
- return s;
2436
- }
2437
- }
2438
- $e = new WeakMap(), Ze = new WeakMap();
2439
- const ar = `precision highp float;
2440
- uniform sampler2D velocity;
2441
- uniform float dt;
2442
- uniform vec2 px;
2443
- varying vec2 uv;
2444
-
2445
- void main(){
2446
- float x0 = texture2D(velocity, uv-vec2(px.x, 0)).x;
2447
- float x1 = texture2D(velocity, uv+vec2(px.x, 0)).x;
2448
- float y0 = texture2D(velocity, uv-vec2(0, px.y)).y;
2449
- float y1 = texture2D(velocity, uv+vec2(0, px.y)).y;
2450
- float divergence = (x1-x0 + y1-y0) / 2.0;
2451
-
2452
- gl_FragColor = vec4(divergence / dt);
2453
- }
2454
- `;
2455
- class cr extends gt {
2456
- constructor(t) {
2457
- super({
2458
- material: {
2459
- vertexShader: mt,
2460
- fragmentShader: ar,
2461
- uniforms: {
2462
- boundarySpace: t.boundarySpace,
2463
- velocity: t.src.texture,
2464
- px: t.cellScale,
2465
- dt: t.dt
2466
- }
2467
- },
2468
- output: t.dst
2469
- }), this.init();
2470
- }
2471
- update(t) {
2472
- this.uniforms.velocity.value = t.vel.texture, super.update();
2473
- }
2474
- }
2475
- const lr = `precision highp float;
2476
- uniform sampler2D pressure;
2477
- uniform sampler2D divergence;
2478
- uniform vec2 px;
2479
- varying vec2 uv;
2480
-
2481
- void main(){
2482
- // poisson equation
2483
- float p0 = texture2D(pressure, uv+vec2(px.x * 2.0, 0)).r;
2484
- float p1 = texture2D(pressure, uv-vec2(px.x * 2.0, 0)).r;
2485
- float p2 = texture2D(pressure, uv+vec2(0, px.y * 2.0 )).r;
2486
- float p3 = texture2D(pressure, uv-vec2(0, px.y * 2.0 )).r;
2487
- float div = texture2D(divergence, uv).r;
2488
-
2489
- float newP = (p0 + p1 + p2 + p3) / 4.0 - div;
2490
- gl_FragColor = vec4(newP);
2491
- }
2492
- `;
2493
- var Je, et;
2494
- class ur extends gt {
2495
- constructor(e) {
2496
- super({
2497
- material: {
2498
- vertexShader: mt,
2499
- fragmentShader: lr,
2500
- uniforms: {
2501
- boundarySpace: e.boundarySpace,
2502
- pressure: e.dst_.texture,
2503
- divergence: e.src.texture,
2504
- px: e.cellScale
2505
- }
2506
- },
2507
- output: e.dst
2508
- });
2509
- m(this, Je, void 0);
2510
- m(this, et, void 0);
2511
- x(this, Je, e.dst_), x(this, et, e.dst), this.init();
2512
- }
2513
- update(e) {
2514
- let n = null, s = null;
2515
- for (var i = 0; i < e.iterations; i++)
2516
- i % 2 == 0 ? (n = r(this, Je), s = r(this, et)) : (n = r(this, et), s = r(this, Je)), this.uniforms.pressure.value = n.texture, this.output = s, super.update();
2517
- return s;
2518
- }
2519
- }
2520
- Je = new WeakMap(), et = new WeakMap();
2521
- const hr = `precision highp float;
2522
- uniform sampler2D pressure;
2523
- uniform sampler2D velocity;
2524
- uniform vec2 px;
2525
- uniform float dt;
2526
- varying vec2 uv;
2527
-
2528
- void main(){
2529
- float step = 1.0;
2530
-
2531
- float p0 = texture2D(pressure, uv+vec2(px.x * step, 0)).r;
2532
- float p1 = texture2D(pressure, uv-vec2(px.x * step, 0)).r;
2533
- float p2 = texture2D(pressure, uv+vec2(0, px.y * step)).r;
2534
- float p3 = texture2D(pressure, uv-vec2(0, px.y * step)).r;
2535
-
2536
- vec2 v = texture2D(velocity, uv).xy;
2537
- vec2 gradP = vec2(p0 - p1, p2 - p3) * 0.5;
2538
- v = v - gradP * dt;
2539
- gl_FragColor = vec4(v, 0.0, 1.0);
2540
- }
2541
- `;
2542
- class dr extends gt {
2543
- constructor(t) {
2544
- super({
2545
- material: {
2546
- vertexShader: mt,
2547
- fragmentShader: hr,
2548
- uniforms: {
2549
- boundarySpace: t.boundarySpace,
2550
- pressure: t.srcP.texture,
2551
- velocity: t.srcV.texture,
2552
- px: t.cellScale,
2553
- dt: t.dt
2554
- }
2555
- },
2556
- output: t.dst
2557
- }), this.init();
2558
- }
2559
- update(t) {
2560
- this.uniforms.velocity.value = t.vel.texture, this.uniforms.pressure.value = t.pressure.texture, super.update();
2561
- }
2562
- }
2563
- var E, R, ne, U, ie, tt, kt, st, nt, it, rt, Pt, ys, Zt, on, Jt, an;
2564
- class fr {
2565
- constructor() {
2566
- m(this, Pt);
2567
- m(this, Zt);
2568
- m(this, Jt);
2569
- m(this, E, {
2570
- isViscous: new I(!1, {
2571
- passport: {
2572
- name: "Fluid.Вязкость.Активна",
2573
- manager: {
2574
- type: "boolean"
2575
- }
2576
- }
2577
- }),
2578
- viscous: new I(30, {
2579
- passport: {
2580
- name: "Fluid.Вязкость.Величина",
2581
- manager: {
2582
- type: "range",
2583
- min: 0,
2584
- max: 500
2585
- }
2586
- }
2587
- }),
2588
- iterationsViscous: new I(16, {
2589
- passport: {
2590
- name: "Fluid.Вязкость.Количество итераций",
2591
- manager: {
2592
- type: "range",
2593
- min: 1,
2594
- max: 32,
2595
- step: 1
2596
- }
2597
- }
2598
- }),
2599
- pointerForce: new I(20, {
2600
- passport: {
2601
- name: "Fluid.Курсор.Сила",
2602
- manager: {
2603
- type: "range",
2604
- min: 1,
2605
- max: 200,
2606
- step: 1
2607
- }
2608
- }
2609
- }),
2610
- pointerSize: new I(100, {
2611
- passport: {
2612
- name: "Fluid.Курсор.Размер",
2613
- manager: {
2614
- type: "range",
2615
- min: 10,
2616
- max: 200,
2617
- step: 1
2618
- }
2619
- }
2620
- }),
2621
- dt: new I(0.014, {
2622
- passport: {
2623
- name: "Fluid.Скорость",
2624
- manager: {
2625
- type: "range",
2626
- min: 1e-3,
2627
- max: 0.1,
2628
- step: 1e-3
2629
- }
2630
- }
2631
- }),
2632
- iterationsPoisson: new I(16, {
2633
- passport: {
2634
- name: "Fluid.Poisson",
2635
- manager: {
2636
- type: "range",
2637
- min: 1,
2638
- max: 32,
2639
- step: 1
2640
- }
2641
- }
2642
- }),
2643
- resolution: new I(0.5, {
2644
- passport: {
2645
- name: "Fluid.Разрешение",
2646
- manager: {
2647
- type: "range",
2648
- min: 0.1,
2649
- max: 1
2650
- }
2651
- }
2652
- }),
2653
- isBounce: new I(!1, {
2654
- passport: {
2655
- name: "Fluid.Bounce",
2656
- manager: {
2657
- type: "boolean"
2658
- }
2659
- }
2660
- }),
2661
- BFECC: new I(!0, {
2662
- passport: {
2663
- name: "Fluid.BFECC",
2664
- manager: {
2665
- type: "boolean"
2666
- }
2667
- }
2668
- })
2669
- });
2670
- m(this, R, {
2671
- vel0: null,
2672
- vel1: null,
2673
- velViscous0: null,
2674
- velViscous1: null,
2675
- div: null,
2676
- pressure0: null,
2677
- pressure1: null
2678
- });
2679
- m(this, ne, new oe());
2680
- m(this, U, new oe());
2681
- m(this, ie, new oe());
2682
- m(this, tt, null);
2683
- m(this, kt, null);
2684
- m(this, st, null);
2685
- m(this, nt, null);
2686
- m(this, it, null);
2687
- m(this, rt, null);
2688
- this.init();
2689
- }
2690
- get parameters() {
2691
- return r(this, E);
2692
- }
2693
- get fbos() {
2694
- return r(this, R);
2695
- }
2696
- resize() {
2697
- $(this, Pt, ys).call(this);
2698
- for (let t in this.fbos)
2699
- r(this, R)[t].setSize(
2700
- r(this, ne).x,
2701
- r(this, ne).y
2702
- );
2703
- }
2704
- update() {
2705
- r(this, E).isBounce.current ? r(this, ie).set(0, 0) : r(this, ie).copy(r(this, U)), r(this, tt).update({
2706
- BFECC: r(this, E).BFECC.current,
2707
- dt: r(this, E).dt.current,
2708
- isBounce: r(this, E).isBounce.current
2709
- }), r(this, kt).update({
2710
- pointerSize: r(this, E).pointerSize.current,
2711
- pointerForce: r(this, E).pointerForce.current,
2712
- cellScale: r(this, U)
2713
- });
2714
- let t = r(this, R).vel1;
2715
- r(this, E).isViscous.current && (t = r(this, st).update({
2716
- viscous: r(this, E).viscous.current,
2717
- iterations: r(this, E).iterationsViscous.current,
2718
- dt: r(this, E).dt.current
2719
- })), r(this, nt).update({ vel: t });
2720
- const e = r(this, it).update({
2721
- iterations: r(this, E).iterationsPoisson.current
2722
- });
2723
- r(this, rt).update({ vel: t, pressure: e });
2724
- }
2725
- dispose() {
2726
- r(this, tt).dispose(), r(this, st).dispose(), r(this, nt).dispose(), r(this, it).dispose(), r(this, rt).dispose();
2727
- for (const t in r(this, R))
2728
- r(this, R)[t].dispose();
2729
- for (const t in r(this, E))
2730
- r(this, E)[t].close();
2731
- }
2732
- init() {
2733
- $(this, Pt, ys).call(this), $(this, Zt, on).call(this), $(this, Jt, an).call(this), setTimeout(() => {
2734
- r(this, E).isViscous.subscribe(() => {
2735
- }), r(this, E).viscous.subscribe(() => {
2736
- }), r(this, E).iterationsViscous.subscribe(() => {
2737
- }), r(this, E).pointerSize.subscribe(() => {
2738
- }), r(this, E).pointerForce.subscribe(() => {
2739
- }), r(this, E).dt.subscribe(() => {
2740
- }), r(this, E).resolution.subscribe(() => {
2741
- this.resize();
2742
- }), r(this, E).iterationsPoisson.subscribe(() => {
2743
- }), r(this, E).isBounce.subscribe(() => {
2744
- }), r(this, E).BFECC.subscribe(() => {
2745
- });
2746
- });
2747
- }
2748
- }
2749
- E = new WeakMap(), R = new WeakMap(), ne = new WeakMap(), U = new WeakMap(), ie = new WeakMap(), tt = new WeakMap(), kt = new WeakMap(), st = new WeakMap(), nt = new WeakMap(), it = new WeakMap(), rt = new WeakMap(), Pt = new WeakSet(), ys = function() {
2750
- const t = Math.round(r(this, E).resolution.current * S.width), e = Math.round(r(this, E).resolution.current * S.height), n = 1 / t, s = 1 / e;
2751
- r(this, U).set(n, s), r(this, ne).set(t, e);
2752
- }, Zt = new WeakSet(), on = function() {
2753
- const t = li.isApple ? ei : ti;
2754
- for (let e in r(this, R))
2755
- r(this, R)[e] = new si(
2756
- r(this, ne).x,
2757
- r(this, ne).y,
2758
- {
2759
- type: t
2760
- }
2761
- );
2762
- }, Jt = new WeakSet(), an = function() {
2763
- x(this, tt, new er({
2764
- cellScale: r(this, U),
2765
- fboSize: r(this, ne),
2766
- dt: r(this, E).dt.current,
2767
- src: r(this, R).vel0,
2768
- dst: r(this, R).vel1,
2769
- BFECC: r(this, E).BFECC.current
2770
- })), x(this, kt, new ir({
2771
- cellScale: r(this, U),
2772
- pointerSize: r(this, E).pointerSize.current,
2773
- dst: r(this, R).vel1
2774
- })), x(this, st, new or({
2775
- cellScale: r(this, U),
2776
- boundarySpace: r(this, ie),
2777
- viscous: r(this, E).viscous.current,
2778
- src: r(this, R).vel1,
2779
- dst: r(this, R).velViscous1,
2780
- dst_: r(this, R).velViscous0,
2781
- dt: r(this, E).dt.current
2782
- })), x(this, nt, new cr({
2783
- cellScale: r(this, U),
2784
- boundarySpace: r(this, ie),
2785
- src: r(this, R).velViscous0,
2786
- dst: r(this, R).div,
2787
- dt: r(this, E).dt.current
2788
- })), x(this, it, new ur({
2789
- cellScale: r(this, U),
2790
- boundarySpace: r(this, ie),
2791
- src: r(this, R).div,
2792
- dst: r(this, R).pressure1,
2793
- dst_: r(this, R).pressure0
2794
- })), x(this, rt, new dr({
2795
- cellScale: r(this, U),
2796
- boundarySpace: r(this, ie),
2797
- srcP: r(this, R).pressure0,
2798
- srcV: r(this, R).velViscous0,
2799
- dst: r(this, R).vel0,
2800
- dt: r(this, E).dt.current
2801
- }));
2802
- };
2803
- var xe, Fe, Oe, Ae, ke, ve, Pe, ot, at, ct, lt, ut;
2804
- class pr extends Ee {
2805
- constructor() {
2806
- super();
2807
- m(this, xe, void 0);
2808
- m(this, Fe, void 0);
2809
- m(this, Oe, void 0);
2810
- m(this, Ae, void 0);
2811
- m(this, ke, void 0);
2812
- m(this, ve, void 0);
2813
- m(this, Pe, void 0);
2814
- m(this, ot, void 0);
2815
- m(this, at, void 0);
2816
- m(this, ct, void 0);
2817
- m(this, lt, void 0);
2818
- m(this, ut, void 0);
2819
- this.colorTweenDuration = 1e3, x(this, Fe, new I("#000000", {
2820
- passport: {
2821
- name: "Fluid.Цвета.Фон.Цвет",
2822
- manager: {
2823
- type: "color"
2824
- }
2825
- }
2826
- })), x(this, Oe, new I(1, {
2827
- passport: {
2828
- name: "Fluid.Цвета.Фон.Порог",
2829
- manager: {
2830
- type: "range"
2831
- }
2832
- }
2833
- })), x(this, Ae, new I(1, {
2834
- passport: {
2835
- name: "Fluid.Цвета.Фон.Прозрачность",
2836
- manager: {
2837
- type: "range"
2838
- }
2839
- }
2840
- })), x(this, ke, new I("#ffffff", {
2841
- passport: {
2842
- name: "Fluid.Цвета.Жидкость.Цвет",
2843
- manager: {
2844
- type: "color"
2845
- }
2846
- }
2847
- })), x(this, ve, new I(1, {
2848
- passport: {
2849
- name: "Fluid.Цвета.Жидкость.Прозрачность",
2850
- manager: {
2851
- type: "range"
2852
- }
2853
- }
2854
- })), x(this, Pe, new ci(0, {
2855
- easing: oi,
2856
- min: 0,
2857
- max: 1,
2858
- duration: this.colorTweenDuration
2859
- })), x(this, ot, new B()), x(this, at, new B()), x(this, ct, new B()), x(this, lt, new B()), x(this, ut, ai(() => {
2860
- r(this, Pe).reset(), r(this, Pe).set(1);
2861
- }, 0)), x(this, xe, new fr()), Re.init(), this.geometry = new ts(2, 2), this.material = new ss({
2862
- vertexShader: mt,
2863
- fragmentShader: Zi,
2864
- transparent: !0,
2865
- uniforms: {
2866
- velocity: {
2867
- value: r(this, xe).fbos.vel0.texture
2868
- },
2869
- backgroundColor: {
2870
- value: r(this, at)
2871
- },
2872
- backgroundOpacity: {
2873
- value: r(this, Ae).current
2874
- },
2875
- fluidColor: {
2876
- value: r(this, ot)
2877
- },
2878
- fluidOpacity: {
2879
- value: r(this, ve).current
2880
- },
2881
- backgroundMixThreshold: {
2882
- value: 0
2883
- },
2884
- opacity: {
2885
- value: 1
2886
- },
2887
- boundarySpace: {
2888
- value: new oe(0, 0)
2889
- }
2890
- }
2891
- }), r(this, Fe).subscribe((e) => {
2892
- x(this, lt, new B(e.current)), r(this, ut).call(this);
2893
- }), r(this, ke).subscribe((e) => {
2894
- x(this, ct, new B(e.current)), r(this, ut).call(this);
2895
- }), r(this, Ae).subscribe((e) => {
2896
- this.material.uniforms.backgroundOpacity.value = e.current;
2897
- }), r(this, ve).subscribe((e) => {
2898
- this.material.uniforms.fluidOpacity.value = e.current;
2899
- }), r(this, Oe).subscribe((e) => {
2900
- this.material.uniforms.backgroundMixThreshold.value = e.current;
2901
- }), r(this, Pe).subscribe((e) => {
2902
- r(this, at).lerp(r(this, lt), e.current), r(this, ot).lerp(r(this, ct), e.current);
2903
- });
2904
- }
2905
- get backgroundColor() {
2906
- return r(this, Fe);
2907
- }
2908
- get backgroundMixThreshold() {
2909
- return r(this, Oe);
2910
- }
2911
- get backgroundOpacity() {
2912
- return r(this, Ae);
2913
- }
2914
- get fluidColor() {
2915
- return r(this, ke);
2916
- }
2917
- get fluidOpacity() {
2918
- return r(this, ve);
2919
- }
2920
- resize() {
2921
- r(this, xe).resize();
2922
- }
2923
- update() {
2924
- Re.update(), r(this, xe).update();
2925
- }
2926
- dispose() {
2927
- Re.dispose(), r(this, xe).dispose(), r(this, Fe).close(), r(this, Ae).close(), r(this, ke).close(), r(this, ve).close(), r(this, Oe).close();
2928
- }
2929
- }
2930
- xe = new WeakMap(), Fe = new WeakMap(), Oe = new WeakMap(), Ae = new WeakMap(), ke = new WeakMap(), ve = new WeakMap(), Pe = new WeakMap(), ot = new WeakMap(), at = new WeakMap(), ct = new WeakMap(), lt = new WeakMap(), ut = new WeakMap();
2931
- var mr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, xr = (u, t, e, n) => {
2932
- for (var s = n > 1 ? void 0 : n ? gr(t, e) : t, i = u.length - 1, o; i >= 0; i--)
2933
- (o = u[i]) && (s = (n ? o(t, e, s) : o(s)) || s);
2934
- return n && s && mr(t, e, s), s;
2935
- }, cn = (u, t, e) => {
2936
- if (!t.has(u))
2937
- throw TypeError("Cannot " + e);
2938
- }, X = (u, t, e) => (cn(u, t, "read from private field"), e ? e.call(u) : t.get(u)), ds = (u, t, e) => {
2939
- if (t.has(u))
2940
- throw TypeError("Cannot add the same private member more than once");
2941
- t instanceof WeakSet ? t.add(u) : t.set(u, e);
2942
- }, Ar = (u, t, e, n) => (cn(u, t, "write to private field"), t.set(u, e), e), Z, Wt, Yt;
2943
- let Hs = class extends ui {
2944
- constructor() {
2945
- super(...arguments), ds(this, Z, null), ds(this, Wt, () => {
2946
- X(this, Z).resize();
2947
- }), ds(this, Yt, () => {
2948
- S.width && X(this, Z).update();
2949
- });
2950
- }
2951
- get fluid() {
2952
- return X(this, Z);
2953
- }
2954
- connectedCallback() {
2955
- Ar(this, Z, new pr()), S.view.add(X(this, Z)), we.subscribe(X(this, Wt)), be.subscribe(X(this, Yt));
2956
- }
2957
- disconnectedCallback() {
2958
- S.view.remove(X(this, Z)), X(this, Z).dispose(), we.unsubscribe(X(this, Wt)), be.unsubscribe(X(this, Yt));
2959
- }
2960
- };
2961
- Z = /* @__PURE__ */ new WeakMap();
2962
- Wt = /* @__PURE__ */ new WeakMap();
2963
- Yt = /* @__PURE__ */ new WeakMap();
2964
- Hs = xr([
2965
- hi("en3-fluid")
2966
- ], Hs);
2967
- function ln(u, t, e) {
2968
- const n = t.x, s = t.y, i = e || u.image.width / u.image.height;
2969
- let o = 0, c = 0, a = u.offset.x, l = u.offset.y, d = u.rotation, h = u.center.x, p = u.center.y;
2970
- n / s > i ? (o = 1, c = s / n * i) : (c = 1, o = n / s / i), u.matrix.setUvTransform(a, l, o, c, d, h, p);
2971
- }
2972
- const vt = new L();
2973
- function H(u, t, e, n, s, i) {
2974
- const o = 2 * Math.PI * s / 4, c = Math.max(i - 2 * s, 0), a = Math.PI / 4;
2975
- vt.copy(t), vt[n] = 0, vt.normalize();
2976
- const l = 0.5 * o / (o + c), d = 1 - vt.angleTo(u) / a;
2977
- return Math.sign(vt[e]) === 1 ? d * l : c / (o + c) + l + l * (1 - d);
2978
- }
2979
- class vr extends ni {
2980
- constructor(t = 1, e = 1, n = 1, s = 2, i = 0.1) {
2981
- if (s = s * 2 + 1, i = Math.min(t / 2, e / 2, n / 2, i), super(1, 1, 1, s, s, s), s === 1)
2982
- return;
2983
- const o = this.toNonIndexed();
2984
- this.index = null, this.attributes.position = o.attributes.position, this.attributes.normal = o.attributes.normal, this.attributes.uv = o.attributes.uv;
2985
- const c = new L(), a = new L(), l = new L(t, e, n).divideScalar(2).subScalar(i), d = this.attributes.position.array, h = this.attributes.normal.array, p = this.attributes.uv.array, A = d.length / 6, v = new L(), b = 0.5 / s;
2986
- for (let g = 0, f = 0; g < d.length; g += 3, f += 2)
2987
- switch (c.fromArray(d, g), a.copy(c), a.x -= Math.sign(a.x) * b, a.y -= Math.sign(a.y) * b, a.z -= Math.sign(a.z) * b, a.normalize(), d[g + 0] = l.x * Math.sign(c.x) + a.x * i, d[g + 1] = l.y * Math.sign(c.y) + a.y * i, d[g + 2] = l.z * Math.sign(c.z) + a.z * i, h[g + 0] = a.x, h[g + 1] = a.y, h[g + 2] = a.z, Math.floor(g / A)) {
2988
- case 0:
2989
- v.set(1, 0, 0), p[f + 0] = H(v, a, "z", "y", i, n), p[f + 1] = 1 - H(v, a, "y", "z", i, e);
2990
- break;
2991
- case 1:
2992
- v.set(-1, 0, 0), p[f + 0] = 1 - H(v, a, "z", "y", i, n), p[f + 1] = 1 - H(v, a, "y", "z", i, e);
2993
- break;
2994
- case 2:
2995
- v.set(0, 1, 0), p[f + 0] = 1 - H(v, a, "x", "z", i, t), p[f + 1] = H(v, a, "z", "x", i, n);
2996
- break;
2997
- case 3:
2998
- v.set(0, -1, 0), p[f + 0] = 1 - H(v, a, "x", "z", i, t), p[f + 1] = 1 - H(v, a, "z", "x", i, n);
2999
- break;
3000
- case 4:
3001
- v.set(0, 0, 1), p[f + 0] = 1 - H(v, a, "x", "y", i, t), p[f + 1] = 1 - H(v, a, "y", "x", i, e);
3002
- break;
3003
- case 5:
3004
- v.set(0, 0, -1), p[f + 0] = H(v, a, "x", "y", i, t), p[f + 1] = 1 - H(v, a, "y", "x", i, e);
3005
- break;
3006
- }
3007
- }
3008
- }
3009
- var re, ht, Be;
3010
- class un extends Ee {
3011
- constructor(e) {
3012
- super(
3013
- e.round ? new vr(
3014
- e.width,
3015
- e.height,
3016
- 1,
3017
- e.segments,
3018
- e.round
3019
- ) : new ts(
3020
- e.width,
3021
- e.height,
3022
- e.segments,
3023
- e.segments
3024
- ),
3025
- e.material
3026
- );
3027
- m(this, re, void 0);
3028
- m(this, ht, void 0);
3029
- m(this, Be, () => {
3030
- r(this, re).data.current && r(this, ht) === "cover" && this.onCoverResize(r(this, re).data.current);
3031
- });
3032
- x(this, re, new nn(Q({
3033
- consumer: this
3034
- }, e))), x(this, ht, e.fit), this.addEventListener("added", () => {
3035
- we.subscribe(r(this, Be));
3036
- }), this.addEventListener("removed", () => {
3037
- we.unsubscribe(r(this, Be));
3038
- }), r(this, re).processData = (n) => S.cacheAssets ? n.clone() : n, r(this, re).data.subscribe((n) => {
3039
- !n.current && n.previous ? n.previous.dispose() : n.current && this.material && (r(this, ht) && (n.current.matrixAutoUpdate = !1), n.current.colorSpace = dt, n.current.center.set(0.5, 0.5), this.material.map = n.current, this.material.needsUpdate = !0, r(this, Be).call(this));
3040
- });
3041
- }
3042
- get sourceManager() {
3043
- return r(this, re);
3044
- }
3045
- updateTexture() {
3046
- r(this, Be).call(this);
3047
- }
3048
- onCoverResize(e) {
3049
- ln(e, {
3050
- x: this.scale.x,
3051
- y: this.scale.y
3052
- });
3053
- }
3054
- }
3055
- re = new WeakMap(), ht = new WeakMap(), Be = new WeakMap();
3056
- class Kr extends un {
3057
- constructor(t) {
3058
- super(xt(Q({}, t), {
3059
- loader: He
3060
- }));
3061
- }
3062
- }
3063
- class yr {
3064
- load(...t) {
3065
- const e = t[0], n = t[1], s = t[3], i = document.createElement("video");
3066
- i.src = e, i.onloadeddata = () => {
3067
- n(new ii(i)), i.onerror = null, i.onloadeddata = null;
3068
- }, i.onerror = () => {
3069
- s == null || s(e), i.onerror = null, i.onloadeddata = null;
3070
- };
3071
- }
3072
- }
3073
- var Bt, Ht, Gt;
3074
- class jr extends un {
3075
- constructor(e) {
3076
- super(xt(Q({}, e), {
3077
- loader: new yr()
3078
- }));
3079
- m(this, Bt, void 0);
3080
- m(this, Ht, void 0);
3081
- m(this, Gt, void 0);
3082
- x(this, Bt, e.autoplay || !1), x(this, Ht, e.muted || !1), x(this, Gt, e.loop || !1), this.sourceManager.data.subscribe((n) => {
3083
- if (n.current) {
3084
- const s = n.current.image;
3085
- r(this, Ht) && (s.muted = !0), r(this, Gt) && (s.loop = !0), r(this, Bt) && s.play();
3086
- }
3087
- });
3088
- }
3089
- onCoverResize(e) {
3090
- const n = e.image;
3091
- ln(
3092
- e,
3093
- {
3094
- x: this.scale.x,
3095
- y: this.scale.y
3096
- },
3097
- n.videoWidth / n.videoHeight
3098
- );
3099
- }
3100
- }
3101
- Bt = new WeakMap(), Ht = new WeakMap(), Gt = new WeakMap();
3102
- function Xr(u, t) {
3103
- u.traverse((e) => {
3104
- e instanceof Ee && t(e);
3105
- });
3106
- }
3107
- function Wr(u, t) {
3108
- u.traverse((e) => {
3109
- e instanceof Ee && e.material && (Array.isArray(e.material) ? e.material : [e.material]).forEach(t);
3110
- });
3111
- }
3112
- const fs = new L(), Tr = new L();
3113
- function Yr(u, t = "default") {
3114
- const e = S.getView(t), { width: n, height: s } = S, i = n / s;
3115
- u instanceof L ? fs.copy(u) : fs.set(...u);
3116
- const o = e.camera.getWorldPosition(Tr).distanceTo(fs);
3117
- if (e.camera instanceof qt)
3118
- return {
3119
- width: n / e.camera.zoom,
3120
- height: s / e.camera.zoom,
3121
- factor: 1,
3122
- distance: o,
3123
- aspect: i
3124
- };
3125
- {
3126
- const c = e.camera.fov * Math.PI / 180, a = 2 * Math.tan(c / 2) * o, l = a * (n / s);
3127
- return { width: l, height: a, factor: n / l, distance: o, aspect: i };
3128
- }
3129
- }
3130
- const Gs = new L(), wr = new bs(), Us = new L();
3131
- class br extends Es {
3132
- constructor(t = document.createElement("div")) {
3133
- super(), this.isCSS3DObject = !0, this.element = t, this.element.style.position = "absolute", this.element.style.pointerEvents = "auto", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.addEventListener("removed", function() {
3134
- this.traverse(function(e) {
3135
- e.element instanceof Element && e.element.parentNode !== null && e.element.parentNode.removeChild(e.element);
3136
- });
3137
- });
3138
- }
3139
- copy(t, e) {
3140
- return super.copy(t, e), this.element = t.element.cloneNode(!0), this;
3141
- }
3142
- }
3143
- const W = new ft(), Er = new ft();
3144
- class Sr {
3145
- constructor(t = {}) {
3146
- const e = this;
3147
- let n, s, i, o;
3148
- const c = {
3149
- camera: { style: "" },
3150
- objects: /* @__PURE__ */ new WeakMap()
3151
- }, a = t.element !== void 0 ? t.element : document.createElement("div");
3152
- a.style.overflow = "hidden", this.domElement = a;
3153
- const l = document.createElement("div");
3154
- l.style.transformOrigin = "0 0", l.style.pointerEvents = "none", a.appendChild(l);
3155
- const d = document.createElement("div");
3156
- d.style.transformStyle = "preserve-3d", l.appendChild(d), this.getSize = function() {
3157
- return {
3158
- width: n,
3159
- height: s
3160
- };
3161
- }, this.render = function(g, f) {
3162
- const y = f.projectionMatrix.elements[5] * o;
3163
- f.view && f.view.enabled ? (l.style.transform = `translate( ${-f.view.offsetX * (n / f.view.width)}px, ${-f.view.offsetY * (s / f.view.height)}px )`, l.style.transform += `scale( ${f.view.fullWidth / f.view.width}, ${f.view.fullHeight / f.view.height} )`) : l.style.transform = "", g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), f.parent === null && f.matrixWorldAutoUpdate === !0 && f.updateMatrixWorld();
3164
- let _, T;
3165
- f.isOrthographicCamera && (_ = -(f.right + f.left) / 2, T = (f.top + f.bottom) / 2);
3166
- const M = f.view && f.view.enabled ? f.view.height / f.view.fullHeight : 1, F = f.isOrthographicCamera ? `scale( ${M} )scale(` + y + ")translate(" + h(_) + "px," + h(T) + "px)" + p(f.matrixWorldInverse) : `scale( ${M} )translateZ(` + y + "px)" + p(f.matrixWorldInverse), z = (f.isPerspectiveCamera ? "perspective(" + y + "px) " : "") + F + "translate(" + i + "px," + o + "px)";
3167
- c.camera.style !== z && (d.style.transform = z, c.camera.style = z), b(g, g, f);
3168
- }, this.setSize = function(g, f) {
3169
- n = g, s = f, i = n / 2, o = s / 2, a.style.width = g + "px", a.style.height = f + "px", l.style.width = g + "px", l.style.height = f + "px", d.style.width = g + "px", d.style.height = f + "px";
3170
- };
3171
- function h(g) {
3172
- return Math.abs(g) < 1e-10 ? 0 : g;
3173
- }
3174
- function p(g) {
3175
- const f = g.elements;
3176
- return "matrix3d(" + h(f[0]) + "," + h(-f[1]) + "," + h(f[2]) + "," + h(f[3]) + "," + h(f[4]) + "," + h(-f[5]) + "," + h(f[6]) + "," + h(f[7]) + "," + h(f[8]) + "," + h(-f[9]) + "," + h(f[10]) + "," + h(f[11]) + "," + h(f[12]) + "," + h(-f[13]) + "," + h(f[14]) + "," + h(f[15]) + ")";
3177
- }
3178
- function A(g) {
3179
- const f = g.elements;
3180
- return "translate(-50%,-50%)" + ("matrix3d(" + h(f[0]) + "," + h(f[1]) + "," + h(f[2]) + "," + h(f[3]) + "," + h(-f[4]) + "," + h(-f[5]) + "," + h(-f[6]) + "," + h(-f[7]) + "," + h(f[8]) + "," + h(f[9]) + "," + h(f[10]) + "," + h(f[11]) + "," + h(f[12]) + "," + h(f[13]) + "," + h(f[14]) + "," + h(f[15]) + ")");
3181
- }
3182
- function v(g) {
3183
- g.isCSS3DObject && (g.element.style.display = "none");
3184
- for (let f = 0, y = g.children.length; f < y; f++)
3185
- v(g.children[f]);
3186
- }
3187
- function b(g, f, y, _) {
3188
- if (g.visible === !1) {
3189
- v(g);
3190
- return;
3191
- }
3192
- if (g.isCSS3DObject) {
3193
- const T = g.layers.test(y.layers) === !0, M = g.element;
3194
- if (M.style.display = T === !0 ? "" : "none", T === !0) {
3195
- g.onBeforeRender(e, f, y);
3196
- let F;
3197
- g.isCSS3DSprite ? (W.copy(y.matrixWorldInverse), W.transpose(), g.rotation2D !== 0 && W.multiply(Er.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(Gs, wr, Us), W.setPosition(Gs), W.scale(Us), W.elements[3] = 0, W.elements[7] = 0, W.elements[11] = 0, W.elements[15] = 1, F = A(W)) : F = A(g.matrixWorld);
3198
- const O = c.objects.get(g);
3199
- if (O === void 0 || O.style !== F) {
3200
- M.style.transform = F;
3201
- const z = { style: F };
3202
- c.objects.set(g, z);
3203
- }
3204
- M.parentNode !== d && d.appendChild(M), g.onAfterRender(e, f, y);
3205
- }
3206
- }
3207
- for (let T = 0, M = g.children.length; T < M; T++)
3208
- b(g.children[T], f, y);
3209
- }
3210
- }
3211
- }
3212
- var Y, es, hn, Ut, zt;
3213
- const P = class P extends br {
3214
- static destroy() {
3215
- we.unsubscribe(r(this, zt)), be.unsubscribe(r(this, Ut)), x(this, Y, null);
3216
- }
3217
- constructor(t) {
3218
- var e;
3219
- super(t.element), r(P, Y) || $(e = P, es, hn).call(e);
3220
- }
3221
- };
3222
- Y = new WeakMap(), es = new WeakSet(), hn = function() {
3223
- x(P, Y, new Sr()), r(P, Y).domElement.style.cssText = `
3224
- position: fixed;
3225
- left: 0;
3226
- top: 0;
3227
- width: 100%;
3228
- height: 100%;
3229
- z-index: 1;
3230
- pointer-events: none;
3231
- overflow: hidden;
3232
- `, S.containerElement.prepend(r(P, Y).domElement), we.subscribe(r(this, zt), Vs.EN3 + 1), be.subscribe(r(this, Ut), { order: ws.EN3 + 1 });
3233
- }, Ut = new WeakMap(), zt = new WeakMap(), m(P, es), m(P, Y, null), m(P, Ut, () => {
3234
- r(P, Y).render(S.view.scene, S.view.camera);
3235
- }), m(P, zt, () => {
3236
- r(P, Y).setSize(S.width, S.height);
3237
- });
3238
- let zs = P;
3239
- var ye, Te, Vt, Ts;
3240
- class qr {
3241
- constructor(t) {
3242
- m(this, Vt);
3243
- m(this, ye, void 0);
3244
- m(this, Te, void 0);
3245
- x(this, ye, t.material), x(this, Te, t.uniforms || {}), r(this, ye).userData.uniforms = r(this, Te);
3246
- let e;
3247
- const n = () => {
3248
- e == null || e();
3249
- };
3250
- r(this, ye).addEventListener("dispose", n), r(this, ye).onBeforeCompile = (s) => {
3251
- var i;
3252
- e == null || e();
3253
- for (const o in r(this, Te))
3254
- s.uniforms[o] = r(this, Te)[o];
3255
- t.vertextDeclarations && (s.vertexShader = `
3256
- ${t.vertextDeclarations}
3257
- ${s.vertexShader}
3258
- `), t.fragmentDeclarations && (s.fragmentShader = `
3259
- ${t.fragmentDeclarations}
3260
- ${s.fragmentShader}
3261
- `), $(this, Vt, Ts).call(this, s, "vertex", t), $(this, Vt, Ts).call(this, s, "fragment", t), e = (i = t.onReady) == null ? void 0 : i.call(t, this), t.log && (console.log("VERTEX SHADER: ", s.vertexShader), console.log("FRAGMENT SHADER: ", s.fragmentShader));
3262
- };
3263
- }
3264
- get material() {
3265
- return r(this, ye);
3266
- }
3267
- get uniforms() {
3268
- return r(this, Te);
3269
- }
3270
- }
3271
- ye = new WeakMap(), Te = new WeakMap(), Vt = new WeakSet(), Ts = function(t, e, n) {
3272
- const s = e === "vertex" ? "vertexChunk" : "fragmentChunk", i = e === "vertex" ? "vertexShader" : "fragmentShader";
3273
- n[s] && (n[s].replace ? t[i] = t[i].replace(
3274
- `#include <${n[s].replace}>`,
3275
- n[s].content
3276
- ) : n[s].update && (t[i] = t[i].replace(
3277
- `#include <${n[s].update}>`,
3278
- `
3279
- #include <${n[s].update}>
3280
- ${n[s].content}
3281
- `
3282
- )));
3283
- };
1
+ import { E as n, e as s, a as o } from "../en3-hbkN1OPu.js";
3284
2
  export {
3285
- Ur as En3Clip,
3286
- zr as En3ClipHelpers,
3287
- pr as En3Fluid,
3288
- Hs as En3FluidElement,
3289
- Vr as En3GLTF,
3290
- zs as En3HTML,
3291
- Kr as En3Image,
3292
- un as En3ImageLike,
3293
- qr as En3ModifiedMaterial,
3294
- nn as En3SourceManager,
3295
- jr as En3Video,
3296
- Ns as En3View,
3297
- ln as coverTexture,
3298
- pt as dispose,
3299
- S as en3,
3300
- j as en3Cache,
3301
- Re as en3FluidPointer,
3302
- $i as en3GLTFLoader,
3303
- He as en3TextureLoader,
3304
- Yr as getCurrentViewport,
3305
- Wr as traverseMaterials,
3306
- Xr as traverseMeshes
3
+ n as En3View,
4
+ s as en3,
5
+ o as en3Cache
3307
6
  };