vitareinforce

swiper-gl-js

Jan 19th, 2023
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 143.50 KB | None | 0 0
  1. /**
  2. * UI Initiative Swiper GL
  3. *
  4. * Stunning WebGL image transitions
  5. *
  6. * https://uiinitiative.com
  7. *
  8. * Copyright 2022 UI Initiative
  9. *
  10. * Released under the UI Initiative Regular License
  11. *
  12. */
  13. ! function(t, e) {
  14. "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).SwiperGL = e()
  15. }(this, (function() {
  16. "use strict";
  17.  
  18. function t(t) {
  19. let e = t[0],
  20. i = t[1],
  21. s = t[2];
  22. return Math.sqrt(e * e + i * i + s * s)
  23. }
  24.  
  25. function e(t, e) {
  26. return t[0] = e[0], t[1] = e[1], t[2] = e[2], t
  27. }
  28.  
  29. function i(t, e, i) {
  30. return t[0] = e[0] + i[0], t[1] = e[1] + i[1], t[2] = e[2] + i[2], t
  31. }
  32.  
  33. function s(t, e, i) {
  34. return t[0] = e[0] - i[0], t[1] = e[1] - i[1], t[2] = e[2] - i[2], t
  35. }
  36.  
  37. function r(t, e, i) {
  38. return t[0] = e[0] * i, t[1] = e[1] * i, t[2] = e[2] * i, t
  39. }
  40.  
  41. function n(t) {
  42. let e = t[0],
  43. i = t[1],
  44. s = t[2];
  45. return e * e + i * i + s * s
  46. }
  47.  
  48. function a(t, e) {
  49. let i = e[0],
  50. s = e[1],
  51. r = e[2],
  52. n = i * i + s * s + r * r;
  53. return n > 0 && (n = 1 / Math.sqrt(n)), t[0] = e[0] * n, t[1] = e[1] * n, t[2] = e[2] * n, t
  54. }
  55.  
  56. function o(t, e) {
  57. return t[0] * e[0] + t[1] * e[1] + t[2] * e[2]
  58. }
  59.  
  60. function h(t, e, i) {
  61. let s = e[0],
  62. r = e[1],
  63. n = e[2],
  64. a = i[0],
  65. o = i[1],
  66. h = i[2];
  67. return t[0] = r * h - n * o, t[1] = n * a - s * h, t[2] = s * o - r * a, t
  68. }
  69. const l = function() {
  70. const t = [0, 0, 0],
  71. i = [0, 0, 0];
  72. return function(s, r) {
  73. e(t, s), e(i, r), a(t, t), a(i, i);
  74. let n = o(t, i);
  75. return n > 1 ? 0 : n < -1 ? Math.PI : Math.acos(n)
  76. }
  77. }();
  78. class c extends Array {
  79. constructor(t = 0, e = t, i = t) {
  80. return super(t, e, i), this
  81. }
  82. get x() {
  83. return this[0]
  84. }
  85. get y() {
  86. return this[1]
  87. }
  88. get z() {
  89. return this[2]
  90. }
  91. set x(t) {
  92. this[0] = t
  93. }
  94. set y(t) {
  95. this[1] = t
  96. }
  97. set z(t) {
  98. this[2] = t
  99. }
  100. set(t, e = t, i = t) {
  101. return t.length ? this.copy(t) : (function(t, e, i, s) {
  102. t[0] = e, t[1] = i, t[2] = s
  103. }(this, t, e, i), this)
  104. }
  105. copy(t) {
  106. return e(this, t), this
  107. }
  108. add(t, e) {
  109. return e ? i(this, t, e) : i(this, this, t), this
  110. }
  111. sub(t, e) {
  112. return e ? s(this, t, e) : s(this, this, t), this
  113. }
  114. multiply(t) {
  115. var e, i, s;
  116. return t.length ? (i = this, s = t, (e = this)[0] = i[0] * s[0], e[1] = i[1] * s[1], e[2] = i[2] * s[2]) : r(this, this, t), this
  117. }
  118. divide(t) {
  119. var e, i, s;
  120. return t.length ? (i = this, s = t, (e = this)[0] = i[0] / s[0], e[1] = i[1] / s[1], e[2] = i[2] / s[2]) : r(this, this, 1 / t), this
  121. }
  122. inverse(t = this) {
  123. var e, i;
  124. return i = t, (e = this)[0] = 1 / i[0], e[1] = 1 / i[1], e[2] = 1 / i[2], this
  125. }
  126. len() {
  127. return t(this)
  128. }
  129. distance(e) {
  130. return e ? function(t, e) {
  131. let i = e[0] - t[0],
  132. s = e[1] - t[1],
  133. r = e[2] - t[2];
  134. return Math.sqrt(i * i + s * s + r * r)
  135. }(this, e) : t(this)
  136. }
  137. squaredLen() {
  138. return n(this)
  139. }
  140. squaredDistance(t) {
  141. return t ? function(t, e) {
  142. let i = e[0] - t[0],
  143. s = e[1] - t[1],
  144. r = e[2] - t[2];
  145. return i * i + s * s + r * r
  146. }(this, t) : n(this)
  147. }
  148. negate(t = this) {
  149. var e, i;
  150. return i = t, (e = this)[0] = -i[0], e[1] = -i[1], e[2] = -i[2], this
  151. }
  152. cross(t, e) {
  153. return e ? h(this, t, e) : h(this, this, t), this
  154. }
  155. scale(t) {
  156. return r(this, this, t), this
  157. }
  158. normalize() {
  159. return a(this, this), this
  160. }
  161. dot(t) {
  162. return o(this, t)
  163. }
  164. equals(t) {
  165. return i = t, (e = this)[0] === i[0] && e[1] === i[1] && e[2] === i[2];
  166. var e, i
  167. }
  168. applyMatrix3(t) {
  169. return function(t, e, i) {
  170. let s = e[0],
  171. r = e[1],
  172. n = e[2];
  173. t[0] = s * i[0] + r * i[3] + n * i[6], t[1] = s * i[1] + r * i[4] + n * i[7], t[2] = s * i[2] + r * i[5] + n * i[8]
  174. }(this, this, t), this
  175. }
  176. applyMatrix4(t) {
  177. return function(t, e, i) {
  178. let s = e[0],
  179. r = e[1],
  180. n = e[2],
  181. a = i[3] * s + i[7] * r + i[11] * n + i[15];
  182. a = a || 1, t[0] = (i[0] * s + i[4] * r + i[8] * n + i[12]) / a, t[1] = (i[1] * s + i[5] * r + i[9] * n + i[13]) / a, t[2] = (i[2] * s + i[6] * r + i[10] * n + i[14]) / a
  183. }(this, this, t), this
  184. }
  185. scaleRotateMatrix4(t) {
  186. return function(t, e, i) {
  187. let s = e[0],
  188. r = e[1],
  189. n = e[2],
  190. a = i[3] * s + i[7] * r + i[11] * n + i[15];
  191. a = a || 1, t[0] = (i[0] * s + i[4] * r + i[8] * n) / a, t[1] = (i[1] * s + i[5] * r + i[9] * n) / a, t[2] = (i[2] * s + i[6] * r + i[10] * n) / a
  192. }(this, this, t), this
  193. }
  194. applyQuaternion(t) {
  195. return function(t, e, i) {
  196. let s = e[0],
  197. r = e[1],
  198. n = e[2],
  199. a = i[0],
  200. o = i[1],
  201. h = i[2],
  202. l = o * n - h * r,
  203. c = h * s - a * n,
  204. u = a * r - o * s,
  205. g = o * u - h * c,
  206. m = h * l - a * u,
  207. d = a * c - o * l,
  208. p = 2 * i[3];
  209. l *= p, c *= p, u *= p, g *= 2, m *= 2, d *= 2, t[0] = s + l + g, t[1] = r + c + m, t[2] = n + u + d
  210. }(this, this, t), this
  211. }
  212. angle(t) {
  213. return l(this, t)
  214. }
  215. lerp(t, e) {
  216. return function(t, e, i, s) {
  217. let r = e[0],
  218. n = e[1],
  219. a = e[2];
  220. t[0] = r + s * (i[0] - r), t[1] = n + s * (i[1] - n), t[2] = a + s * (i[2] - a)
  221. }(this, this, t, e), this
  222. }
  223. clone() {
  224. return new c(this[0], this[1], this[2])
  225. }
  226. fromArray(t, e = 0) {
  227. return this[0] = t[e], this[1] = t[e + 1], this[2] = t[e + 2], this
  228. }
  229. toArray(t = [], e = 0) {
  230. return t[e] = this[0], t[e + 1] = this[1], t[e + 2] = this[2], t
  231. }
  232. transformDirection(t) {
  233. const e = this[0],
  234. i = this[1],
  235. s = this[2];
  236. return this[0] = t[0] * e + t[4] * i + t[8] * s, this[1] = t[1] * e + t[5] * i + t[9] * s, this[2] = t[2] * e + t[6] * i + t[10] * s, this.normalize()
  237. }
  238. }
  239. const u = new c;
  240. let g = 1,
  241. m = 1,
  242. d = !1;
  243. class p {
  244. constructor(t, e = {}) {
  245. t.canvas || console.error("gl not passed as first argument to Geometry"), this.gl = t, this.attributes = e, this.id = g++, this.VAOs = {}, this.drawRange = {
  246. start: 0,
  247. count: 0
  248. }, this.instancedCount = 0, this.gl.renderer.bindVertexArray(null), this.gl.renderer.currentGeometry = null, this.glState = this.gl.renderer.state;
  249. for (let t in e) this.addAttribute(t, e[t])
  250. }
  251. addAttribute(t, e) {
  252. if (this.attributes[t] = e, e.id = m++, e.size = e.size || 1, e.type = e.type || (e.data.constructor === Float32Array ? this.gl.FLOAT : e.data.constructor === Uint16Array ? this.gl.UNSIGNED_SHORT : this.gl.UNSIGNED_INT), e.target = "index" === t ? this.gl.ELEMENT_ARRAY_BUFFER : this.gl.ARRAY_BUFFER, e.normalized = e.normalized || !1, e.stride = e.stride || 0, e.offset = e.offset || 0, e.count = e.count || (e.stride ? e.data.byteLength / e.stride : e.data.length / e.size), e.divisor = e.instanced || 0, e.needsUpdate = !1, e.usage = e.usage || this.gl.STATIC_DRAW, e.buffer || this.updateAttribute(e), e.divisor) {
  253. if (this.isInstanced = !0, this.instancedCount && this.instancedCount !== e.count * e.divisor) return console.warn("geometry has multiple instanced buffers of different length"), this.instancedCount = Math.min(this.instancedCount, e.count * e.divisor);
  254. this.instancedCount = e.count * e.divisor
  255. } else "index" === t ? this.drawRange.count = e.count : this.attributes.index || (this.drawRange.count = Math.max(this.drawRange.count, e.count))
  256. }
  257. updateAttribute(t) {
  258. const e = !t.buffer;
  259. e && (t.buffer = this.gl.createBuffer()), this.glState.boundBuffer !== t.buffer && (this.gl.bindBuffer(t.target, t.buffer), this.glState.boundBuffer = t.buffer), e ? this.gl.bufferData(t.target, t.data, t.usage) : this.gl.bufferSubData(t.target, 0, t.data), t.needsUpdate = !1
  260. }
  261. setIndex(t) {
  262. this.addAttribute("index", t)
  263. }
  264. setDrawRange(t, e) {
  265. this.drawRange.start = t, this.drawRange.count = e
  266. }
  267. setInstancedCount(t) {
  268. this.instancedCount = t
  269. }
  270. createVAO(t) {
  271. this.VAOs[t.attributeOrder] = this.gl.renderer.createVertexArray(), this.gl.renderer.bindVertexArray(this.VAOs[t.attributeOrder]), this.bindAttributes(t)
  272. }
  273. bindAttributes(t) {
  274. t.attributeLocations.forEach(((t, {
  275. name: e,
  276. type: i
  277. }) => {
  278. if (!this.attributes[e]) return void console.warn(`active attribute ${e} not being supplied`);
  279. const s = this.attributes[e];
  280. this.gl.bindBuffer(s.target, s.buffer), this.glState.boundBuffer = s.buffer;
  281. let r = 1;
  282. 35674 === i && (r = 2), 35675 === i && (r = 3), 35676 === i && (r = 4);
  283. const n = s.size / r,
  284. a = 1 === r ? 0 : r * r * r,
  285. o = 1 === r ? 0 : r * r;
  286. for (let e = 0; e < r; e++) this.gl.vertexAttribPointer(t + e, n, s.type, s.normalized, s.stride + a, s.offset + e * o), this.gl.enableVertexAttribArray(t + e), this.gl.renderer.vertexAttribDivisor(t + e, s.divisor)
  287. })), this.attributes.index && this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.attributes.index.buffer)
  288. }
  289. draw({
  290. program: t,
  291. mode: e = this.gl.TRIANGLES
  292. }) {
  293. this.gl.renderer.currentGeometry !== `${this.id}_${t.attributeOrder}` && (this.VAOs[t.attributeOrder] || this.createVAO(t), this.gl.renderer.bindVertexArray(this.VAOs[t.attributeOrder]), this.gl.renderer.currentGeometry = `${this.id}_${t.attributeOrder}`), t.attributeLocations.forEach(((t, {
  294. name: e
  295. }) => {
  296. const i = this.attributes[e];
  297. i.needsUpdate && this.updateAttribute(i)
  298. })), this.isInstanced ? this.attributes.index ? this.gl.renderer.drawElementsInstanced(e, this.drawRange.count, this.attributes.index.type, this.attributes.index.offset + 2 * this.drawRange.start, this.instancedCount) : this.gl.renderer.drawArraysInstanced(e, this.drawRange.start, this.drawRange.count, this.instancedCount) : this.attributes.index ? this.gl.drawElements(e, this.drawRange.count, this.attributes.index.type, this.attributes.index.offset + 2 * this.drawRange.start) : this.gl.drawArrays(e, this.drawRange.start, this.drawRange.count)
  299. }
  300. getPosition() {
  301. const t = this.attributes.position;
  302. return t.data ? t : d ? void 0 : (console.warn("No position buffer data found to compute bounds"), d = !0)
  303. }
  304. computeBoundingBox(t) {
  305. t || (t = this.getPosition());
  306. const e = t.data,
  307. i = t.stride ? t.stride / e.BYTES_PER_ELEMENT : t.size;
  308. this.bounds || (this.bounds = {
  309. min: new c,
  310. max: new c,
  311. center: new c,
  312. scale: new c,
  313. radius: 1 / 0
  314. });
  315. const s = this.bounds.min,
  316. r = this.bounds.max,
  317. n = this.bounds.center,
  318. a = this.bounds.scale;
  319. s.set(1 / 0), r.set(-1 / 0);
  320. for (let t = 0, n = e.length; t < n; t += i) {
  321. const i = e[t],
  322. n = e[t + 1],
  323. a = e[t + 2];
  324. s.x = Math.min(i, s.x), s.y = Math.min(n, s.y), s.z = Math.min(a, s.z), r.x = Math.max(i, r.x), r.y = Math.max(n, r.y), r.z = Math.max(a, r.z)
  325. }
  326. a.sub(r, s), n.add(s, r).divide(2)
  327. }
  328. computeBoundingSphere(t) {
  329. t || (t = this.getPosition());
  330. const e = t.data,
  331. i = t.stride ? t.stride / e.BYTES_PER_ELEMENT : t.size;
  332. this.bounds || this.computeBoundingBox(t);
  333. let s = 0;
  334. for (let t = 0, r = e.length; t < r; t += i) u.fromArray(e, t), s = Math.max(s, this.bounds.center.squaredDistance(u));
  335. this.bounds.radius = Math.sqrt(s)
  336. }
  337. remove() {
  338. for (let t in this.VAOs) this.gl.renderer.deleteVertexArray(this.VAOs[t]), delete this.VAOs[t];
  339. for (let t in this.attributes) this.gl.deleteBuffer(this.attributes[t].buffer), delete this.attributes[t]
  340. }
  341. }
  342. let x = 1;
  343. const f = {};
  344. class A {
  345. constructor(t, {
  346. vertex: e,
  347. fragment: i,
  348. uniforms: s = {},
  349. transparent: r = !1,
  350. cullFace: n = t.BACK,
  351. frontFace: a = t.CCW,
  352. depthTest: o = !0,
  353. depthWrite: h = !0,
  354. depthFunc: l = t.LESS
  355. } = {}) {
  356. t.canvas || console.error("gl not passed as fist argument to Program"), this.gl = t, this.uniforms = s, this.id = x++, e || console.warn("vertex shader not supplied"), i || console.warn("fragment shader not supplied"), this.transparent = r, this.cullFace = n, this.frontFace = a, this.depthTest = o, this.depthWrite = h, this.depthFunc = l, this.blendFunc = {}, this.blendEquation = {}, this.transparent && !this.blendFunc.src && (this.gl.renderer.premultipliedAlpha ? this.setBlendFunc(this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA) : this.setBlendFunc(this.gl.SRC_ALPHA, this.gl.ONE_MINUS_SRC_ALPHA));
  357. const c = t.createShader(t.VERTEX_SHADER);
  358. t.shaderSource(c, e), t.compileShader(c), "" !== t.getShaderInfoLog(c) && console.warn(`${t.getShaderInfoLog(c)}\nVertex Shader\n${M(e)}`);
  359. const u = t.createShader(t.FRAGMENT_SHADER);
  360. if (t.shaderSource(u, i), t.compileShader(u), "" !== t.getShaderInfoLog(u) && console.warn(`${t.getShaderInfoLog(u)}\nFragment Shader\n${M(i)}`), this.program = t.createProgram(), t.attachShader(this.program, c), t.attachShader(this.program, u), t.linkProgram(this.program), !t.getProgramParameter(this.program, t.LINK_STATUS)) return console.warn(t.getProgramInfoLog(this.program));
  361. t.deleteShader(c), t.deleteShader(u), this.uniformLocations = new Map;
  362. let g = t.getProgramParameter(this.program, t.ACTIVE_UNIFORMS);
  363. for (let e = 0; e < g; e++) {
  364. let i = t.getActiveUniform(this.program, e);
  365. this.uniformLocations.set(i, t.getUniformLocation(this.program, i.name));
  366. const s = i.name.match(/(\w+)/g);
  367. i.uniformName = s[0], 3 === s.length ? (i.isStructArray = !0, i.structIndex = Number(s[1]), i.structProperty = s[2]) : 2 === s.length && isNaN(Number(s[1])) && (i.isStruct = !0, i.structProperty = s[1])
  368. }
  369. this.attributeLocations = new Map;
  370. const m = [],
  371. d = t.getProgramParameter(this.program, t.ACTIVE_ATTRIBUTES);
  372. for (let e = 0; e < d; e++) {
  373. const i = t.getActiveAttrib(this.program, e),
  374. s = t.getAttribLocation(this.program, i.name); - 1 !== s && (m[s] = i.name, this.attributeLocations.set(i, s))
  375. }
  376. this.attributeOrder = m.join("")
  377. }
  378. setBlendFunc(t, e, i, s) {
  379. this.blendFunc.src = t, this.blendFunc.dst = e, this.blendFunc.srcAlpha = i, this.blendFunc.dstAlpha = s, t && (this.transparent = !0)
  380. }
  381. setBlendEquation(t, e) {
  382. this.blendEquation.modeRGB = t, this.blendEquation.modeAlpha = e
  383. }
  384. applyState() {
  385. this.depthTest ? this.gl.renderer.enable(this.gl.DEPTH_TEST) : this.gl.renderer.disable(this.gl.DEPTH_TEST), this.cullFace ? this.gl.renderer.enable(this.gl.CULL_FACE) : this.gl.renderer.disable(this.gl.CULL_FACE), this.blendFunc.src ? this.gl.renderer.enable(this.gl.BLEND) : this.gl.renderer.disable(this.gl.BLEND), this.cullFace && this.gl.renderer.setCullFace(this.cullFace), this.gl.renderer.setFrontFace(this.frontFace), this.gl.renderer.setDepthMask(this.depthWrite), this.gl.renderer.setDepthFunc(this.depthFunc), this.blendFunc.src && this.gl.renderer.setBlendFunc(this.blendFunc.src, this.blendFunc.dst, this.blendFunc.srcAlpha, this.blendFunc.dstAlpha), this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB, this.blendEquation.modeAlpha)
  386. }
  387. use({
  388. flipFaces: t = !1
  389. } = {}) {
  390. let e = -1;
  391. this.gl.renderer.state.currentProgram === this.id || (this.gl.useProgram(this.program), this.gl.renderer.state.currentProgram = this.id), this.uniformLocations.forEach(((t, i) => {
  392. let s = i.uniformName,
  393. r = this.uniforms[s];
  394. if (i.isStruct && (r = r[i.structProperty], s += `.${i.structProperty}`), i.isStructArray && (r = r[i.structIndex][i.structProperty], s += `[${i.structIndex}].${i.structProperty}`), !r) return y(`Active uniform ${s} has not been supplied`);
  395. if (r && void 0 === r.value) return y(`${s} uniform is missing a value parameter`);
  396. if (r.value.texture) return e += 1, r.value.update(e), v(this.gl, i.type, t, e);
  397. if (r.value.length && r.value[0].texture) {
  398. const s = [];
  399. return r.value.forEach((t => {
  400. e += 1, t.update(e), s.push(e)
  401. })), v(this.gl, i.type, t, s)
  402. }
  403. v(this.gl, i.type, t, r.value)
  404. })), this.applyState(), t && this.gl.renderer.setFrontFace(this.frontFace === this.gl.CCW ? this.gl.CW : this.gl.CCW)
  405. }
  406. remove() {
  407. this.gl.deleteProgram(this.program)
  408. }
  409. }
  410.  
  411. function v(t, e, i, s) {
  412. s = s.length ? function(t) {
  413. const e = t.length,
  414. i = t[0].length;
  415. if (void 0 === i) return t;
  416. const s = e * i;
  417. let r = f[s];
  418. r || (f[s] = r = new Float32Array(s));
  419. for (let s = 0; s < e; s++) r.set(t[s], s * i);
  420. return r
  421. }(s) : s;
  422. const r = t.renderer.state.uniformLocations.get(i);
  423. if (s.length)
  424. if (void 0 === r || r.length !== s.length) t.renderer.state.uniformLocations.set(i, s.slice(0));
  425. else {
  426. if (function(t, e) {
  427. if (t.length !== e.length) return !1;
  428. for (let i = 0, s = t.length; i < s; i++)
  429. if (t[i] !== e[i]) return !1;
  430. return !0
  431. }(r, s)) return;
  432. r.set ? r.set(s) : function(t, e) {
  433. for (let i = 0, s = t.length; i < s; i++) t[i] = e[i]
  434. }(r, s), t.renderer.state.uniformLocations.set(i, r)
  435. }
  436. else {
  437. if (r === s) return;
  438. t.renderer.state.uniformLocations.set(i, s)
  439. }
  440. switch (e) {
  441. case 5126:
  442. return s.length ? t.uniform1fv(i, s) : t.uniform1f(i, s);
  443. case 35664:
  444. return t.uniform2fv(i, s);
  445. case 35665:
  446. return t.uniform3fv(i, s);
  447. case 35666:
  448. return t.uniform4fv(i, s);
  449. case 35670:
  450. case 5124:
  451. case 35678:
  452. case 35680:
  453. return s.length ? t.uniform1iv(i, s) : t.uniform1i(i, s);
  454. case 35671:
  455. case 35667:
  456. return t.uniform2iv(i, s);
  457. case 35672:
  458. case 35668:
  459. return t.uniform3iv(i, s);
  460. case 35673:
  461. case 35669:
  462. return t.uniform4iv(i, s);
  463. case 35674:
  464. return t.uniformMatrix2fv(i, !1, s);
  465. case 35675:
  466. return t.uniformMatrix3fv(i, !1, s);
  467. case 35676:
  468. return t.uniformMatrix4fv(i, !1, s)
  469. }
  470. }
  471.  
  472. function M(t) {
  473. let e = t.split("\n");
  474. for (let t = 0; t < e.length; t++) e[t] = t + 1 + ": " + e[t];
  475. return e.join("\n")
  476. }
  477. let w = 0;
  478.  
  479. function y(t) {
  480. w > 100 || (console.warn(t), w++, w > 100 && console.warn("More than 100 program warnings - stopping logs."))
  481. }
  482. const E = new c;
  483. let U = 1;
  484. class F {
  485. constructor({
  486. canvas: t = document.createElement("canvas"),
  487. width: e = 300,
  488. height: i = 150,
  489. dpr: s = 1,
  490. alpha: r = !1,
  491. depth: n = !0,
  492. stencil: a = !1,
  493. antialias: o = !1,
  494. premultipliedAlpha: h = !1,
  495. preserveDrawingBuffer: l = !1,
  496. powerPreference: c = "default",
  497. autoClear: u = !0,
  498. webgl: g = 2
  499. } = {}) {
  500. const m = {
  501. alpha: r,
  502. depth: n,
  503. stencil: a,
  504. antialias: o,
  505. premultipliedAlpha: h,
  506. preserveDrawingBuffer: l,
  507. powerPreference: c
  508. };
  509. this.dpr = s, this.alpha = r, this.color = !0, this.depth = n, this.stencil = a, this.premultipliedAlpha = h, this.autoClear = u, this.id = U++, 2 === g && (this.gl = t.getContext("webgl2", m)), this.isWebgl2 = !!this.gl, this.gl || (this.gl = t.getContext("webgl", m)), this.gl || console.error("unable to create webgl context"), this.gl.renderer = this, this.setSize(e, i), this.state = {}, this.state.blendFunc = {
  510. src: this.gl.ONE,
  511. dst: this.gl.ZERO
  512. }, this.state.blendEquation = {
  513. modeRGB: this.gl.FUNC_ADD
  514. }, this.state.cullFace = null, this.state.frontFace = this.gl.CCW, this.state.depthMask = !0, this.state.depthFunc = this.gl.LESS, this.state.premultiplyAlpha = !1, this.state.flipY = !1, this.state.unpackAlignment = 4, this.state.framebuffer = null, this.state.viewport = {
  515. x: 0,
  516. y: 0,
  517. width: null,
  518. height: null
  519. }, this.state.textureUnits = [], this.state.activeTextureUnit = 0, this.state.boundBuffer = null, this.state.uniformLocations = new Map, this.state.currentProgram = null, this.extensions = {}, this.isWebgl2 ? (this.getExtension("EXT_color_buffer_float"), this.getExtension("OES_texture_float_linear")) : (this.getExtension("OES_texture_float"), this.getExtension("OES_texture_float_linear"), this.getExtension("OES_texture_half_float"), this.getExtension("OES_texture_half_float_linear"), this.getExtension("OES_element_index_uint"), this.getExtension("OES_standard_derivatives"), this.getExtension("EXT_sRGB"), this.getExtension("WEBGL_depth_texture"), this.getExtension("WEBGL_draw_buffers")), this.getExtension("WEBGL_compressed_texture_astc"), this.getExtension("EXT_texture_compression_bptc"), this.getExtension("WEBGL_compressed_texture_s3tc"), this.getExtension("WEBGL_compressed_texture_etc1"), this.getExtension("WEBGL_compressed_texture_pvrtc"), this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"), this.vertexAttribDivisor = this.getExtension("ANGLE_instanced_arrays", "vertexAttribDivisor", "vertexAttribDivisorANGLE"), this.drawArraysInstanced = this.getExtension("ANGLE_instanced_arrays", "drawArraysInstanced", "drawArraysInstancedANGLE"), this.drawElementsInstanced = this.getExtension("ANGLE_instanced_arrays", "drawElementsInstanced", "drawElementsInstancedANGLE"), this.createVertexArray = this.getExtension("OES_vertex_array_object", "createVertexArray", "createVertexArrayOES"), this.bindVertexArray = this.getExtension("OES_vertex_array_object", "bindVertexArray", "bindVertexArrayOES"), this.deleteVertexArray = this.getExtension("OES_vertex_array_object", "deleteVertexArray", "deleteVertexArrayOES"), this.drawBuffers = this.getExtension("WEBGL_draw_buffers", "drawBuffers", "drawBuffersWEBGL"), this.parameters = {}, this.parameters.maxTextureUnits = this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS), this.parameters.maxAnisotropy = this.getExtension("EXT_texture_filter_anisotropic") ? this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0
  520. }
  521. setSize(t, e) {
  522. this.width = t, this.height = e, this.gl.canvas.width = t * this.dpr, this.gl.canvas.height = e * this.dpr, Object.assign(this.gl.canvas.style, {
  523. width: t + "px",
  524. height: e + "px"
  525. })
  526. }
  527. setViewport(t, e, i = 0, s = 0) {
  528. this.state.viewport.width === t && this.state.viewport.height === e || (this.state.viewport.width = t, this.state.viewport.height = e, this.state.viewport.x = i, this.state.viewport.y = s, this.gl.viewport(i, s, t, e))
  529. }
  530. setScissor(t, e, i = 0, s = 0) {
  531. this.gl.scissor(i, s, t, e)
  532. }
  533. enable(t) {
  534. !0 !== this.state[t] && (this.gl.enable(t), this.state[t] = !0)
  535. }
  536. disable(t) {
  537. !1 !== this.state[t] && (this.gl.disable(t), this.state[t] = !1)
  538. }
  539. setBlendFunc(t, e, i, s) {
  540. this.state.blendFunc.src === t && this.state.blendFunc.dst === e && this.state.blendFunc.srcAlpha === i && this.state.blendFunc.dstAlpha === s || (this.state.blendFunc.src = t, this.state.blendFunc.dst = e, this.state.blendFunc.srcAlpha = i, this.state.blendFunc.dstAlpha = s, void 0 !== i ? this.gl.blendFuncSeparate(t, e, i, s) : this.gl.blendFunc(t, e))
  541. }
  542. setBlendEquation(t, e) {
  543. t = t || this.gl.FUNC_ADD, this.state.blendEquation.modeRGB === t && this.state.blendEquation.modeAlpha === e || (this.state.blendEquation.modeRGB = t, this.state.blendEquation.modeAlpha = e, void 0 !== e ? this.gl.blendEquationSeparate(t, e) : this.gl.blendEquation(t))
  544. }
  545. setCullFace(t) {
  546. this.state.cullFace !== t && (this.state.cullFace = t, this.gl.cullFace(t))
  547. }
  548. setFrontFace(t) {
  549. this.state.frontFace !== t && (this.state.frontFace = t, this.gl.frontFace(t))
  550. }
  551. setDepthMask(t) {
  552. this.state.depthMask !== t && (this.state.depthMask = t, this.gl.depthMask(t))
  553. }
  554. setDepthFunc(t) {
  555. this.state.depthFunc !== t && (this.state.depthFunc = t, this.gl.depthFunc(t))
  556. }
  557. activeTexture(t) {
  558. this.state.activeTextureUnit !== t && (this.state.activeTextureUnit = t, this.gl.activeTexture(this.gl.TEXTURE0 + t))
  559. }
  560. bindFramebuffer({
  561. target: t = this.gl.FRAMEBUFFER,
  562. buffer: e = null
  563. } = {}) {
  564. this.state.framebuffer !== e && (this.state.framebuffer = e, this.gl.bindFramebuffer(t, e))
  565. }
  566. getExtension(t, e, i) {
  567. return e && this.gl[e] ? this.gl[e].bind(this.gl) : (this.extensions[t] || (this.extensions[t] = this.gl.getExtension(t)), e ? this.extensions[t] ? this.extensions[t][i].bind(this.extensions[t]) : null : this.extensions[t])
  568. }
  569. sortOpaque(t, e) {
  570. return t.renderOrder !== e.renderOrder ? t.renderOrder - e.renderOrder : t.program.id !== e.program.id ? t.program.id - e.program.id : t.zDepth !== e.zDepth ? t.zDepth - e.zDepth : e.id - t.id
  571. }
  572. sortTransparent(t, e) {
  573. return t.renderOrder !== e.renderOrder ? t.renderOrder - e.renderOrder : t.zDepth !== e.zDepth ? e.zDepth - t.zDepth : e.id - t.id
  574. }
  575. sortUI(t, e) {
  576. return t.renderOrder !== e.renderOrder ? t.renderOrder - e.renderOrder : t.program.id !== e.program.id ? t.program.id - e.program.id : e.id - t.id
  577. }
  578. getRenderList({
  579. scene: t,
  580. camera: e,
  581. frustumCull: i,
  582. sort: s
  583. }) {
  584. let r = [];
  585. if (e && i && e.updateFrustum(), t.traverse((t => {
  586. if (!t.visible) return !0;
  587. t.draw && (i && t.frustumCulled && e && !e.frustumIntersectsMesh(t) || r.push(t))
  588. })), s) {
  589. const t = [],
  590. i = [],
  591. s = [];
  592. r.forEach((r => {
  593. r.program.transparent ? r.program.depthTest ? i.push(r) : s.push(r) : t.push(r), r.zDepth = 0, 0 === r.renderOrder && r.program.depthTest && e && (r.worldMatrix.getTranslation(E), E.applyMatrix4(e.projectionViewMatrix), r.zDepth = E.z)
  594. })), t.sort(this.sortOpaque), i.sort(this.sortTransparent), s.sort(this.sortUI), r = t.concat(i, s)
  595. }
  596. return r
  597. }
  598. render({
  599. scene: t,
  600. camera: e,
  601. target: i = null,
  602. update: s = !0,
  603. sort: r = !0,
  604. frustumCull: n = !0,
  605. clear: a
  606. }) {
  607. null === i ? (this.bindFramebuffer(), this.setViewport(this.width * this.dpr, this.height * this.dpr)) : (this.bindFramebuffer(i), this.setViewport(i.width, i.height)), (a || this.autoClear && !1 !== a) && (!this.depth || i && !i.depth || (this.enable(this.gl.DEPTH_TEST), this.setDepthMask(!0)), this.gl.clear((this.color ? this.gl.COLOR_BUFFER_BIT : 0) | (this.depth ? this.gl.DEPTH_BUFFER_BIT : 0) | (this.stencil ? this.gl.STENCIL_BUFFER_BIT : 0))), s && t.updateMatrixWorld(), e && e.updateMatrixWorld();
  608. this.getRenderList({
  609. scene: t,
  610. camera: e,
  611. frustumCull: n,
  612. sort: r
  613. }).forEach((t => {
  614. t.draw({
  615. camera: e
  616. })
  617. }))
  618. }
  619. }
  620.  
  621. function C(t, e) {
  622. return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t
  623. }
  624.  
  625. function R(t, e, i, s, r) {
  626. return t[0] = e, t[1] = i, t[2] = s, t[3] = r, t
  627. }
  628.  
  629. function b(t, e) {
  630. let i = e[0],
  631. s = e[1],
  632. r = e[2],
  633. n = e[3],
  634. a = i * i + s * s + r * r + n * n;
  635. return a > 0 && (a = 1 / Math.sqrt(a)), t[0] = i * a, t[1] = s * a, t[2] = r * a, t[3] = n * a, t
  636. }
  637.  
  638. function T(t, e) {
  639. return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3] * e[3]
  640. }
  641.  
  642. function G(t, e, i) {
  643. let s = e[0],
  644. r = e[1],
  645. n = e[2],
  646. a = e[3],
  647. o = i[0],
  648. h = i[1],
  649. l = i[2],
  650. c = i[3];
  651. return t[0] = s * c + a * o + r * l - n * h, t[1] = r * c + a * h + n * o - s * l, t[2] = n * c + a * l + s * h - r * o, t[3] = a * c - s * o - r * h - n * l, t
  652. }
  653. const I = C,
  654. S = R,
  655. Y = T,
  656. B = b;
  657. class K extends Array {
  658. constructor(t = 0, e = 0, i = 0, s = 1) {
  659. return super(t, e, i, s), this.onChange = () => {}, this
  660. }
  661. get x() {
  662. return this[0]
  663. }
  664. get y() {
  665. return this[1]
  666. }
  667. get z() {
  668. return this[2]
  669. }
  670. get w() {
  671. return this[3]
  672. }
  673. set x(t) {
  674. this[0] = t, this.onChange()
  675. }
  676. set y(t) {
  677. this[1] = t, this.onChange()
  678. }
  679. set z(t) {
  680. this[2] = t, this.onChange()
  681. }
  682. set w(t) {
  683. this[3] = t, this.onChange()
  684. }
  685. identity() {
  686. var t;
  687. return (t = this)[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, this.onChange(), this
  688. }
  689. set(t, e, i, s) {
  690. return t.length ? this.copy(t) : (S(this, t, e, i, s), this.onChange(), this)
  691. }
  692. rotateX(t) {
  693. return function(t, e, i) {
  694. i *= .5;
  695. let s = e[0],
  696. r = e[1],
  697. n = e[2],
  698. a = e[3],
  699. o = Math.sin(i),
  700. h = Math.cos(i);
  701. t[0] = s * h + a * o, t[1] = r * h + n * o, t[2] = n * h - r * o, t[3] = a * h - s * o
  702. }(this, this, t), this.onChange(), this
  703. }
  704. rotateY(t) {
  705. return function(t, e, i) {
  706. i *= .5;
  707. let s = e[0],
  708. r = e[1],
  709. n = e[2],
  710. a = e[3],
  711. o = Math.sin(i),
  712. h = Math.cos(i);
  713. t[0] = s * h - n * o, t[1] = r * h + a * o, t[2] = n * h + s * o, t[3] = a * h - r * o
  714. }(this, this, t), this.onChange(), this
  715. }
  716. rotateZ(t) {
  717. return function(t, e, i) {
  718. i *= .5;
  719. let s = e[0],
  720. r = e[1],
  721. n = e[2],
  722. a = e[3],
  723. o = Math.sin(i),
  724. h = Math.cos(i);
  725. t[0] = s * h + r * o, t[1] = r * h - s * o, t[2] = n * h + a * o, t[3] = a * h - n * o
  726. }(this, this, t), this.onChange(), this
  727. }
  728. inverse(t = this) {
  729. return function(t, e) {
  730. let i = e[0],
  731. s = e[1],
  732. r = e[2],
  733. n = e[3],
  734. a = i * i + s * s + r * r + n * n,
  735. o = a ? 1 / a : 0;
  736. t[0] = -i * o, t[1] = -s * o, t[2] = -r * o, t[3] = n * o
  737. }(this, t), this.onChange(), this
  738. }
  739. conjugate(t = this) {
  740. var e, i;
  741. return i = t, (e = this)[0] = -i[0], e[1] = -i[1], e[2] = -i[2], e[3] = i[3], this.onChange(), this
  742. }
  743. copy(t) {
  744. return I(this, t), this.onChange(), this
  745. }
  746. normalize(t = this) {
  747. return B(this, t), this.onChange(), this
  748. }
  749. multiply(t, e) {
  750. return e ? G(this, t, e) : G(this, this, t), this.onChange(), this
  751. }
  752. dot(t) {
  753. return Y(this, t)
  754. }
  755. fromMatrix3(t) {
  756. return function(t, e) {
  757. let i, s = e[0] + e[4] + e[8];
  758. if (s > 0) i = Math.sqrt(s + 1), t[3] = .5 * i, i = .5 / i, t[0] = (e[5] - e[7]) * i, t[1] = (e[6] - e[2]) * i, t[2] = (e[1] - e[3]) * i;
  759. else {
  760. let s = 0;
  761. e[4] > e[0] && (s = 1), e[8] > e[3 * s + s] && (s = 2);
  762. let r = (s + 1) % 3,
  763. n = (s + 2) % 3;
  764. i = Math.sqrt(e[3 * s + s] - e[3 * r + r] - e[3 * n + n] + 1), t[s] = .5 * i, i = .5 / i, t[3] = (e[3 * r + n] - e[3 * n + r]) * i, t[r] = (e[3 * r + s] + e[3 * s + r]) * i, t[n] = (e[3 * n + s] + e[3 * s + n]) * i
  765. }
  766. }(this, t), this.onChange(), this
  767. }
  768. fromEuler(t) {
  769. return function(t, e, i = "YXZ") {
  770. let s = Math.sin(.5 * e[0]),
  771. r = Math.cos(.5 * e[0]),
  772. n = Math.sin(.5 * e[1]),
  773. a = Math.cos(.5 * e[1]),
  774. o = Math.sin(.5 * e[2]),
  775. h = Math.cos(.5 * e[2]);
  776. "XYZ" === i ? (t[0] = s * a * h + r * n * o, t[1] = r * n * h - s * a * o, t[2] = r * a * o + s * n * h, t[3] = r * a * h - s * n * o) : "YXZ" === i ? (t[0] = s * a * h + r * n * o, t[1] = r * n * h - s * a * o, t[2] = r * a * o - s * n * h, t[3] = r * a * h + s * n * o) : "ZXY" === i ? (t[0] = s * a * h - r * n * o, t[1] = r * n * h + s * a * o, t[2] = r * a * o + s * n * h, t[3] = r * a * h - s * n * o) : "ZYX" === i ? (t[0] = s * a * h - r * n * o, t[1] = r * n * h + s * a * o, t[2] = r * a * o - s * n * h, t[3] = r * a * h + s * n * o) : "YZX" === i ? (t[0] = s * a * h + r * n * o, t[1] = r * n * h + s * a * o, t[2] = r * a * o - s * n * h, t[3] = r * a * h - s * n * o) : "XZY" === i && (t[0] = s * a * h - r * n * o, t[1] = r * n * h - s * a * o, t[2] = r * a * o + s * n * h, t[3] = r * a * h + s * n * o)
  777. }(this, t, t.order), this
  778. }
  779. fromAxisAngle(t, e) {
  780. return function(t, e, i) {
  781. i *= .5;
  782. let s = Math.sin(i);
  783. t[0] = s * e[0], t[1] = s * e[1], t[2] = s * e[2], t[3] = Math.cos(i)
  784. }(this, t, e), this
  785. }
  786. slerp(t, e) {
  787. return function(t, e, i, s) {
  788. let r, n, a, o, h, l = e[0],
  789. c = e[1],
  790. u = e[2],
  791. g = e[3],
  792. m = i[0],
  793. d = i[1],
  794. p = i[2],
  795. x = i[3];
  796. n = l * m + c * d + u * p + g * x, n < 0 && (n = -n, m = -m, d = -d, p = -p, x = -x), 1 - n > 1e-6 ? (r = Math.acos(n), a = Math.sin(r), o = Math.sin((1 - s) * r) / a, h = Math.sin(s * r) / a) : (o = 1 - s, h = s), t[0] = o * l + h * m, t[1] = o * c + h * d, t[2] = o * u + h * p, t[3] = o * g + h * x
  797. }(this, this, t, e), this
  798. }
  799. fromArray(t, e = 0) {
  800. return this[0] = t[e], this[1] = t[e + 1], this[2] = t[e + 2], this[3] = t[e + 3], this
  801. }
  802. toArray(t = [], e = 0) {
  803. return t[e] = this[0], t[e + 1] = this[1], t[e + 2] = this[2], t[e + 3] = this[3], t
  804. }
  805. }
  806.  
  807. function D(t, e, i) {
  808. let s = e[0],
  809. r = e[1],
  810. n = e[2],
  811. a = e[3],
  812. o = e[4],
  813. h = e[5],
  814. l = e[6],
  815. c = e[7],
  816. u = e[8],
  817. g = e[9],
  818. m = e[10],
  819. d = e[11],
  820. p = e[12],
  821. x = e[13],
  822. f = e[14],
  823. A = e[15],
  824. v = i[0],
  825. M = i[1],
  826. w = i[2],
  827. y = i[3];
  828. return t[0] = v * s + M * o + w * u + y * p, t[1] = v * r + M * h + w * g + y * x, t[2] = v * n + M * l + w * m + y * f, t[3] = v * a + M * c + w * d + y * A, v = i[4], M = i[5], w = i[6], y = i[7], t[4] = v * s + M * o + w * u + y * p, t[5] = v * r + M * h + w * g + y * x, t[6] = v * n + M * l + w * m + y * f, t[7] = v * a + M * c + w * d + y * A, v = i[8], M = i[9], w = i[10], y = i[11], t[8] = v * s + M * o + w * u + y * p, t[9] = v * r + M * h + w * g + y * x, t[10] = v * n + M * l + w * m + y * f, t[11] = v * a + M * c + w * d + y * A, v = i[12], M = i[13], w = i[14], y = i[15], t[12] = v * s + M * o + w * u + y * p, t[13] = v * r + M * h + w * g + y * x, t[14] = v * n + M * l + w * m + y * f, t[15] = v * a + M * c + w * d + y * A, t
  829. }
  830.  
  831. function k(t, e) {
  832. let i = e[0],
  833. s = e[1],
  834. r = e[2],
  835. n = e[4],
  836. a = e[5],
  837. o = e[6],
  838. h = e[8],
  839. l = e[9],
  840. c = e[10];
  841. return t[0] = Math.hypot(i, s, r), t[1] = Math.hypot(n, a, o), t[2] = Math.hypot(h, l, c), t
  842. }
  843. const Q = function() {
  844. const t = [0, 0, 0];
  845. return function(e, i) {
  846. let s = t;
  847. k(s, i);
  848. let r = 1 / s[0],
  849. n = 1 / s[1],
  850. a = 1 / s[2],
  851. o = i[0] * r,
  852. h = i[1] * n,
  853. l = i[2] * a,
  854. c = i[4] * r,
  855. u = i[5] * n,
  856. g = i[6] * a,
  857. m = i[8] * r,
  858. d = i[9] * n,
  859. p = i[10] * a,
  860. x = o + u + p,
  861. f = 0;
  862. return x > 0 ? (f = 2 * Math.sqrt(x + 1), e[3] = .25 * f, e[0] = (g - d) / f, e[1] = (m - l) / f, e[2] = (h - c) / f) : o > u && o > p ? (f = 2 * Math.sqrt(1 + o - u - p), e[3] = (g - d) / f, e[0] = .25 * f, e[1] = (h + c) / f, e[2] = (m + l) / f) : u > p ? (f = 2 * Math.sqrt(1 + u - o - p), e[3] = (m - l) / f, e[0] = (h + c) / f, e[1] = .25 * f, e[2] = (g + d) / f) : (f = 2 * Math.sqrt(1 + p - o - u), e[3] = (h - c) / f, e[0] = (m + l) / f, e[1] = (g + d) / f, e[2] = .25 * f), e
  863. }
  864. }();
  865. class N extends Array {
  866. constructor(t = 1, e = 0, i = 0, s = 0, r = 0, n = 1, a = 0, o = 0, h = 0, l = 0, c = 1, u = 0, g = 0, m = 0, d = 0, p = 1) {
  867. return super(t, e, i, s, r, n, a, o, h, l, c, u, g, m, d, p), this
  868. }
  869. get x() {
  870. return this[12]
  871. }
  872. get y() {
  873. return this[13]
  874. }
  875. get z() {
  876. return this[14]
  877. }
  878. get w() {
  879. return this[15]
  880. }
  881. set x(t) {
  882. this[12] = t
  883. }
  884. set y(t) {
  885. this[13] = t
  886. }
  887. set z(t) {
  888. this[14] = t
  889. }
  890. set w(t) {
  891. this[15] = t
  892. }
  893. set(t, e, i, s, r, n, a, o, h, l, c, u, g, m, d, p) {
  894. return t.length ? this.copy(t) : (function(t, e, i, s, r, n, a, o, h, l, c, u, g, m, d, p, x) {
  895. t[0] = e, t[1] = i, t[2] = s, t[3] = r, t[4] = n, t[5] = a, t[6] = o, t[7] = h, t[8] = l, t[9] = c, t[10] = u, t[11] = g, t[12] = m, t[13] = d, t[14] = p, t[15] = x
  896. }(this, t, e, i, s, r, n, a, o, h, l, c, u, g, m, d, p), this)
  897. }
  898. translate(t, e = this) {
  899. return function(t, e, i) {
  900. let s, r, n, a, o, h, l, c, u, g, m, d, p = i[0],
  901. x = i[1],
  902. f = i[2];
  903. e === t ? (t[12] = e[0] * p + e[4] * x + e[8] * f + e[12], t[13] = e[1] * p + e[5] * x + e[9] * f + e[13], t[14] = e[2] * p + e[6] * x + e[10] * f + e[14], t[15] = e[3] * p + e[7] * x + e[11] * f + e[15]) : (s = e[0], r = e[1], n = e[2], a = e[3], o = e[4], h = e[5], l = e[6], c = e[7], u = e[8], g = e[9], m = e[10], d = e[11], t[0] = s, t[1] = r, t[2] = n, t[3] = a, t[4] = o, t[5] = h, t[6] = l, t[7] = c, t[8] = u, t[9] = g, t[10] = m, t[11] = d, t[12] = s * p + o * x + u * f + e[12], t[13] = r * p + h * x + g * f + e[13], t[14] = n * p + l * x + m * f + e[14], t[15] = a * p + c * x + d * f + e[15])
  904. }(this, e, t), this
  905. }
  906. rotate(t, e, i = this) {
  907. return function(t, e, i, s) {
  908. let r, n, a, o, h, l, c, u, g, m, d, p, x, f, A, v, M, w, y, E, U, F, C, R, b = s[0],
  909. T = s[1],
  910. G = s[2],
  911. I = Math.hypot(b, T, G);
  912. Math.abs(I) < 1e-6 || (I = 1 / I, b *= I, T *= I, G *= I, r = Math.sin(i), n = Math.cos(i), a = 1 - n, o = e[0], h = e[1], l = e[2], c = e[3], u = e[4], g = e[5], m = e[6], d = e[7], p = e[8], x = e[9], f = e[10], A = e[11], v = b * b * a + n, M = T * b * a + G * r, w = G * b * a - T * r, y = b * T * a - G * r, E = T * T * a + n, U = G * T * a + b * r, F = b * G * a + T * r, C = T * G * a - b * r, R = G * G * a + n, t[0] = o * v + u * M + p * w, t[1] = h * v + g * M + x * w, t[2] = l * v + m * M + f * w, t[3] = c * v + d * M + A * w, t[4] = o * y + u * E + p * U, t[5] = h * y + g * E + x * U, t[6] = l * y + m * E + f * U, t[7] = c * y + d * E + A * U, t[8] = o * F + u * C + p * R, t[9] = h * F + g * C + x * R, t[10] = l * F + m * C + f * R, t[11] = c * F + d * C + A * R, e !== t && (t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]))
  913. }(this, i, t, e), this
  914. }
  915. scale(t, e = this) {
  916. return function(t, e, i) {
  917. let s = i[0],
  918. r = i[1],
  919. n = i[2];
  920. t[0] = e[0] * s, t[1] = e[1] * s, t[2] = e[2] * s, t[3] = e[3] * s, t[4] = e[4] * r, t[5] = e[5] * r, t[6] = e[6] * r, t[7] = e[7] * r, t[8] = e[8] * n, t[9] = e[9] * n, t[10] = e[10] * n, t[11] = e[11] * n, t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]
  921. }(this, e, "number" == typeof t ? [t, t, t] : t), this
  922. }
  923. multiply(t, e) {
  924. return e ? D(this, t, e) : D(this, this, t), this
  925. }
  926. identity() {
  927. var t;
  928. return (t = this)[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this
  929. }
  930. copy(t) {
  931. var e, i;
  932. return i = t, (e = this)[0] = i[0], e[1] = i[1], e[2] = i[2], e[3] = i[3], e[4] = i[4], e[5] = i[5], e[6] = i[6], e[7] = i[7], e[8] = i[8], e[9] = i[9], e[10] = i[10], e[11] = i[11], e[12] = i[12], e[13] = i[13], e[14] = i[14], e[15] = i[15], this
  933. }
  934. fromPerspective({
  935. fov: t,
  936. aspect: e,
  937. near: i,
  938. far: s
  939. } = {}) {
  940. return function(t, e, i, s, r) {
  941. let n = 1 / Math.tan(e / 2),
  942. a = 1 / (s - r);
  943. t[0] = n / i, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = n, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = (r + s) * a, t[11] = -1, t[12] = 0, t[13] = 0, t[14] = 2 * r * s * a, t[15] = 0
  944. }(this, t, e, i, s), this
  945. }
  946. fromOrthogonal({
  947. left: t,
  948. right: e,
  949. bottom: i,
  950. top: s,
  951. near: r,
  952. far: n
  953. }) {
  954. return function(t, e, i, s, r, n, a) {
  955. let o = 1 / (e - i),
  956. h = 1 / (s - r),
  957. l = 1 / (n - a);
  958. t[0] = -2 * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * h, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 2 * l, t[11] = 0, t[12] = (e + i) * o, t[13] = (r + s) * h, t[14] = (a + n) * l, t[15] = 1
  959. }(this, t, e, i, s, r, n), this
  960. }
  961. fromQuaternion(t) {
  962. return function(t, e) {
  963. let i = e[0],
  964. s = e[1],
  965. r = e[2],
  966. n = e[3],
  967. a = i + i,
  968. o = s + s,
  969. h = r + r,
  970. l = i * a,
  971. c = s * a,
  972. u = s * o,
  973. g = r * a,
  974. m = r * o,
  975. d = r * h,
  976. p = n * a,
  977. x = n * o,
  978. f = n * h;
  979. t[0] = 1 - u - d, t[1] = c + f, t[2] = g - x, t[3] = 0, t[4] = c - f, t[5] = 1 - l - d, t[6] = m + p, t[7] = 0, t[8] = g + x, t[9] = m - p, t[10] = 1 - l - u, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1
  980. }(this, t), this
  981. }
  982. setPosition(t) {
  983. return this.x = t[0], this.y = t[1], this.z = t[2], this
  984. }
  985. inverse(t = this) {
  986. return function(t, e) {
  987. let i = e[0],
  988. s = e[1],
  989. r = e[2],
  990. n = e[3],
  991. a = e[4],
  992. o = e[5],
  993. h = e[6],
  994. l = e[7],
  995. c = e[8],
  996. u = e[9],
  997. g = e[10],
  998. m = e[11],
  999. d = e[12],
  1000. p = e[13],
  1001. x = e[14],
  1002. f = e[15],
  1003. A = i * o - s * a,
  1004. v = i * h - r * a,
  1005. M = i * l - n * a,
  1006. w = s * h - r * o,
  1007. y = s * l - n * o,
  1008. E = r * l - n * h,
  1009. U = c * p - u * d,
  1010. F = c * x - g * d,
  1011. C = c * f - m * d,
  1012. R = u * x - g * p,
  1013. b = u * f - m * p,
  1014. T = g * f - m * x,
  1015. G = A * T - v * b + M * R + w * C - y * F + E * U;
  1016. G && (G = 1 / G, t[0] = (o * T - h * b + l * R) * G, t[1] = (r * b - s * T - n * R) * G, t[2] = (p * E - x * y + f * w) * G, t[3] = (g * y - u * E - m * w) * G, t[4] = (h * C - a * T - l * F) * G, t[5] = (i * T - r * C + n * F) * G, t[6] = (x * M - d * E - f * v) * G, t[7] = (c * E - g * M + m * v) * G, t[8] = (a * b - o * C + l * U) * G, t[9] = (s * C - i * b - n * U) * G, t[10] = (d * y - p * M + f * A) * G, t[11] = (u * M - c * y - m * A) * G, t[12] = (o * F - a * R - h * U) * G, t[13] = (i * R - s * F + r * U) * G, t[14] = (p * v - d * w - x * A) * G, t[15] = (c * w - u * v + g * A) * G)
  1017. }(this, t), this
  1018. }
  1019. compose(t, e, i) {
  1020. return function(t, e, i, s) {
  1021. let r = e[0],
  1022. n = e[1],
  1023. a = e[2],
  1024. o = e[3],
  1025. h = r + r,
  1026. l = n + n,
  1027. c = a + a,
  1028. u = r * h,
  1029. g = r * l,
  1030. m = r * c,
  1031. d = n * l,
  1032. p = n * c,
  1033. x = a * c,
  1034. f = o * h,
  1035. A = o * l,
  1036. v = o * c,
  1037. M = s[0],
  1038. w = s[1],
  1039. y = s[2];
  1040. t[0] = (1 - (d + x)) * M, t[1] = (g + v) * M, t[2] = (m - A) * M, t[3] = 0, t[4] = (g - v) * w, t[5] = (1 - (u + x)) * w, t[6] = (p + f) * w, t[7] = 0, t[8] = (m + A) * y, t[9] = (p - f) * y, t[10] = (1 - (u + d)) * y, t[11] = 0, t[12] = i[0], t[13] = i[1], t[14] = i[2], t[15] = 1
  1041. }(this, t, e, i), this
  1042. }
  1043. getRotation(t) {
  1044. return Q(t, this), this
  1045. }
  1046. getTranslation(t) {
  1047. var e, i;
  1048. return i = this, (e = t)[0] = i[12], e[1] = i[13], e[2] = i[14], this
  1049. }
  1050. getScaling(t) {
  1051. return k(t, this), this
  1052. }
  1053. getMaxScaleOnAxis() {
  1054. return function(t) {
  1055. let e = t[0],
  1056. i = t[1],
  1057. s = t[2],
  1058. r = t[4],
  1059. n = t[5],
  1060. a = t[6],
  1061. o = t[8],
  1062. h = t[9],
  1063. l = t[10];
  1064. const c = e * e + i * i + s * s,
  1065. u = r * r + n * n + a * a,
  1066. g = o * o + h * h + l * l;
  1067. return Math.sqrt(Math.max(c, u, g))
  1068. }(this)
  1069. }
  1070. lookAt(t, e, i) {
  1071. return function(t, e, i, s) {
  1072. let r = e[0],
  1073. n = e[1],
  1074. a = e[2],
  1075. o = s[0],
  1076. h = s[1],
  1077. l = s[2],
  1078. c = r - i[0],
  1079. u = n - i[1],
  1080. g = a - i[2],
  1081. m = c * c + u * u + g * g;
  1082. 0 === m ? g = 1 : (m = 1 / Math.sqrt(m), c *= m, u *= m, g *= m);
  1083. let d = h * g - l * u,
  1084. p = l * c - o * g,
  1085. x = o * u - h * c;
  1086. m = d * d + p * p + x * x, 0 === m && (l ? o += 1e-6 : h ? l += 1e-6 : h += 1e-6, d = h * g - l * u, p = l * c - o * g, x = o * u - h * c, m = d * d + p * p + x * x), m = 1 / Math.sqrt(m), d *= m, p *= m, x *= m, t[0] = d, t[1] = p, t[2] = x, t[3] = 0, t[4] = u * x - g * p, t[5] = g * d - c * x, t[6] = c * p - u * d, t[7] = 0, t[8] = c, t[9] = u, t[10] = g, t[11] = 0, t[12] = r, t[13] = n, t[14] = a, t[15] = 1
  1087. }(this, t, e, i), this
  1088. }
  1089. determinant() {
  1090. return function(t) {
  1091. let e = t[0],
  1092. i = t[1],
  1093. s = t[2],
  1094. r = t[3],
  1095. n = t[4],
  1096. a = t[5],
  1097. o = t[6],
  1098. h = t[7],
  1099. l = t[8],
  1100. c = t[9],
  1101. u = t[10],
  1102. g = t[11],
  1103. m = t[12],
  1104. d = t[13],
  1105. p = t[14],
  1106. x = t[15];
  1107. return (e * a - i * n) * (u * x - g * p) - (e * o - s * n) * (c * x - g * d) + (e * h - r * n) * (c * p - u * d) + (i * o - s * a) * (l * x - g * m) - (i * h - r * a) * (l * p - u * m) + (s * h - r * o) * (l * d - c * m)
  1108. }(this)
  1109. }
  1110. fromArray(t, e = 0) {
  1111. return this[0] = t[e], this[1] = t[e + 1], this[2] = t[e + 2], this[3] = t[e + 3], this[4] = t[e + 4], this[5] = t[e + 5], this[6] = t[e + 6], this[7] = t[e + 7], this[8] = t[e + 8], this[9] = t[e + 9], this[10] = t[e + 10], this[11] = t[e + 11], this[12] = t[e + 12], this[13] = t[e + 13], this[14] = t[e + 14], this[15] = t[e + 15], this
  1112. }
  1113. toArray(t = [], e = 0) {
  1114. return t[e] = this[0], t[e + 1] = this[1], t[e + 2] = this[2], t[e + 3] = this[3], t[e + 4] = this[4], t[e + 5] = this[5], t[e + 6] = this[6], t[e + 7] = this[7], t[e + 8] = this[8], t[e + 9] = this[9], t[e + 10] = this[10], t[e + 11] = this[11], t[e + 12] = this[12], t[e + 13] = this[13], t[e + 14] = this[14], t[e + 15] = this[15], t
  1115. }
  1116. }
  1117. const j = new N;
  1118. class O extends Array {
  1119. constructor(t = 0, e = t, i = t, s = "YXZ") {
  1120. return super(t, e, i), this.order = s, this.onChange = () => {}, this
  1121. }
  1122. get x() {
  1123. return this[0]
  1124. }
  1125. get y() {
  1126. return this[1]
  1127. }
  1128. get z() {
  1129. return this[2]
  1130. }
  1131. set x(t) {
  1132. this[0] = t, this.onChange()
  1133. }
  1134. set y(t) {
  1135. this[1] = t, this.onChange()
  1136. }
  1137. set z(t) {
  1138. this[2] = t, this.onChange()
  1139. }
  1140. set(t, e = t, i = t) {
  1141. return t.length ? this.copy(t) : (this[0] = t, this[1] = e, this[2] = i, this.onChange(), this)
  1142. }
  1143. copy(t) {
  1144. return this[0] = t[0], this[1] = t[1], this[2] = t[2], this.onChange(), this
  1145. }
  1146. reorder(t) {
  1147. return this.order = t, this.onChange(), this
  1148. }
  1149. fromRotationMatrix(t, e = this.order) {
  1150. return function(t, e, i = "YXZ") {
  1151. "XYZ" === i ? (t[1] = Math.asin(Math.min(Math.max(e[8], -1), 1)), Math.abs(e[8]) < .99999 ? (t[0] = Math.atan2(-e[9], e[10]), t[2] = Math.atan2(-e[4], e[0])) : (t[0] = Math.atan2(e[6], e[5]), t[2] = 0)) : "YXZ" === i ? (t[0] = Math.asin(-Math.min(Math.max(e[9], -1), 1)), Math.abs(e[9]) < .99999 ? (t[1] = Math.atan2(e[8], e[10]), t[2] = Math.atan2(e[1], e[5])) : (t[1] = Math.atan2(-e[2], e[0]), t[2] = 0)) : "ZXY" === i ? (t[0] = Math.asin(Math.min(Math.max(e[6], -1), 1)), Math.abs(e[6]) < .99999 ? (t[1] = Math.atan2(-e[2], e[10]), t[2] = Math.atan2(-e[4], e[5])) : (t[1] = 0, t[2] = Math.atan2(e[1], e[0]))) : "ZYX" === i ? (t[1] = Math.asin(-Math.min(Math.max(e[2], -1), 1)), Math.abs(e[2]) < .99999 ? (t[0] = Math.atan2(e[6], e[10]), t[2] = Math.atan2(e[1], e[0])) : (t[0] = 0, t[2] = Math.atan2(-e[4], e[5]))) : "YZX" === i ? (t[2] = Math.asin(Math.min(Math.max(e[1], -1), 1)), Math.abs(e[1]) < .99999 ? (t[0] = Math.atan2(-e[9], e[5]), t[1] = Math.atan2(-e[2], e[0])) : (t[0] = 0, t[1] = Math.atan2(e[8], e[10]))) : "XZY" === i && (t[2] = Math.asin(-Math.min(Math.max(e[4], -1), 1)), Math.abs(e[4]) < .99999 ? (t[0] = Math.atan2(e[6], e[5]), t[1] = Math.atan2(e[8], e[0])) : (t[0] = Math.atan2(-e[9], e[10]), t[1] = 0))
  1152. }(this, t, e), this
  1153. }
  1154. fromQuaternion(t, e = this.order) {
  1155. return j.fromQuaternion(t), this.fromRotationMatrix(j, e)
  1156. }
  1157. toArray(t = [], e = 0) {
  1158. return t[e] = this[0], t[e + 1] = this[1], t[e + 2] = this[2], t
  1159. }
  1160. }
  1161. class P {
  1162. constructor() {
  1163. this.parent = null, this.children = [], this.visible = !0, this.matrix = new N, this.worldMatrix = new N, this.matrixAutoUpdate = !0, this.position = new c, this.quaternion = new K, this.scale = new c(1), this.rotation = new O, this.up = new c(0, 1, 0), this.rotation.onChange = () => this.quaternion.fromEuler(this.rotation), this.quaternion.onChange = () => this.rotation.fromQuaternion(this.quaternion)
  1164. }
  1165. setParent(t, e = !0) {
  1166. this.parent && t !== this.parent && this.parent.removeChild(this, !1), this.parent = t, e && t && t.addChild(this, !1)
  1167. }
  1168. addChild(t, e = !0) {
  1169. ~this.children.indexOf(t) || this.children.push(t), e && t.setParent(this, !1)
  1170. }
  1171. removeChild(t, e = !0) {
  1172. ~this.children.indexOf(t) && this.children.splice(this.children.indexOf(t), 1), e && t.setParent(null, !1)
  1173. }
  1174. updateMatrixWorld(t) {
  1175. this.matrixAutoUpdate && this.updateMatrix(), (this.worldMatrixNeedsUpdate || t) && (null === this.parent ? this.worldMatrix.copy(this.matrix) : this.worldMatrix.multiply(this.parent.worldMatrix, this.matrix), this.worldMatrixNeedsUpdate = !1, t = !0);
  1176. for (let e = 0, i = this.children.length; e < i; e++) this.children[e].updateMatrixWorld(t)
  1177. }
  1178. updateMatrix() {
  1179. this.matrix.compose(this.quaternion, this.position, this.scale), this.worldMatrixNeedsUpdate = !0
  1180. }
  1181. traverse(t) {
  1182. if (!t(this))
  1183. for (let e = 0, i = this.children.length; e < i; e++) this.children[e].traverse(t)
  1184. }
  1185. decompose() {
  1186. this.matrix.getTranslation(this.position), this.matrix.getRotation(this.quaternion), this.matrix.getScaling(this.scale), this.rotation.fromQuaternion(this.quaternion)
  1187. }
  1188. lookAt(t, e = !1) {
  1189. e ? this.matrix.lookAt(this.position, t, this.up) : this.matrix.lookAt(t, this.position, this.up), this.matrix.getRotation(this.quaternion), this.rotation.fromQuaternion(this.quaternion)
  1190. }
  1191. }
  1192. const z = new N,
  1193. V = new c,
  1194. Z = new c;
  1195. class J extends P {
  1196. constructor(t, {
  1197. near: e = .1,
  1198. far: i = 100,
  1199. fov: s = 45,
  1200. aspect: r = 1,
  1201. left: n,
  1202. right: a,
  1203. bottom: o,
  1204. top: h,
  1205. zoom: l = 1
  1206. } = {}) {
  1207. super(), Object.assign(this, {
  1208. near: e,
  1209. far: i,
  1210. fov: s,
  1211. aspect: r,
  1212. left: n,
  1213. right: a,
  1214. bottom: o,
  1215. top: h,
  1216. zoom: l
  1217. }), this.projectionMatrix = new N, this.viewMatrix = new N, this.projectionViewMatrix = new N, this.worldPosition = new c, this.type = n || a ? "orthographic" : "perspective", "orthographic" === this.type ? this.orthographic() : this.perspective()
  1218. }
  1219. perspective({
  1220. near: t = this.near,
  1221. far: e = this.far,
  1222. fov: i = this.fov,
  1223. aspect: s = this.aspect
  1224. } = {}) {
  1225. return Object.assign(this, {
  1226. near: t,
  1227. far: e,
  1228. fov: i,
  1229. aspect: s
  1230. }), this.projectionMatrix.fromPerspective({
  1231. fov: i * (Math.PI / 180),
  1232. aspect: s,
  1233. near: t,
  1234. far: e
  1235. }), this.type = "perspective", this
  1236. }
  1237. orthographic({
  1238. near: t = this.near,
  1239. far: e = this.far,
  1240. left: i = this.left,
  1241. right: s = this.right,
  1242. bottom: r = this.bottom,
  1243. top: n = this.top,
  1244. zoom: a = this.zoom
  1245. } = {}) {
  1246. return Object.assign(this, {
  1247. near: t,
  1248. far: e,
  1249. left: i,
  1250. right: s,
  1251. bottom: r,
  1252. top: n,
  1253. zoom: a
  1254. }), i /= a, s /= a, r /= a, n /= a, this.projectionMatrix.fromOrthogonal({
  1255. left: i,
  1256. right: s,
  1257. bottom: r,
  1258. top: n,
  1259. near: t,
  1260. far: e
  1261. }), this.type = "orthographic", this
  1262. }
  1263. updateMatrixWorld() {
  1264. return super.updateMatrixWorld(), this.viewMatrix.inverse(this.worldMatrix), this.worldMatrix.getTranslation(this.worldPosition), this.projectionViewMatrix.multiply(this.projectionMatrix, this.viewMatrix), this
  1265. }
  1266. lookAt(t) {
  1267. return super.lookAt(t, !0), this
  1268. }
  1269. project(t) {
  1270. return t.applyMatrix4(this.viewMatrix), t.applyMatrix4(this.projectionMatrix), this
  1271. }
  1272. unproject(t) {
  1273. return t.applyMatrix4(z.inverse(this.projectionMatrix)), t.applyMatrix4(this.worldMatrix), this
  1274. }
  1275. updateFrustum() {
  1276. this.frustum || (this.frustum = [new c, new c, new c, new c, new c, new c]);
  1277. const t = this.projectionViewMatrix;
  1278. this.frustum[0].set(t[3] - t[0], t[7] - t[4], t[11] - t[8]).constant = t[15] - t[12], this.frustum[1].set(t[3] + t[0], t[7] + t[4], t[11] + t[8]).constant = t[15] + t[12], this.frustum[2].set(t[3] + t[1], t[7] + t[5], t[11] + t[9]).constant = t[15] + t[13], this.frustum[3].set(t[3] - t[1], t[7] - t[5], t[11] - t[9]).constant = t[15] - t[13], this.frustum[4].set(t[3] - t[2], t[7] - t[6], t[11] - t[10]).constant = t[15] - t[14], this.frustum[5].set(t[3] + t[2], t[7] + t[6], t[11] + t[10]).constant = t[15] + t[14];
  1279. for (let t = 0; t < 6; t++) {
  1280. const e = 1 / this.frustum[t].distance();
  1281. this.frustum[t].multiply(e), this.frustum[t].constant *= e
  1282. }
  1283. }
  1284. frustumIntersectsMesh(t) {
  1285. if (!t.geometry.attributes.position) return !0;
  1286. if (t.geometry.bounds && t.geometry.bounds.radius !== 1 / 0 || t.geometry.computeBoundingSphere(), !t.geometry.bounds) return !0;
  1287. const e = V;
  1288. e.copy(t.geometry.bounds.center), e.applyMatrix4(t.worldMatrix);
  1289. const i = t.geometry.bounds.radius * t.worldMatrix.getMaxScaleOnAxis();
  1290. return this.frustumIntersectsSphere(e, i)
  1291. }
  1292. frustumIntersectsSphere(t, e) {
  1293. const i = Z;
  1294. for (let s = 0; s < 6; s++) {
  1295. const r = this.frustum[s];
  1296. if (i.copy(r).dot(t) + r.constant < -e) return !1
  1297. }
  1298. return !0
  1299. }
  1300. }
  1301.  
  1302. function L(t, e, i) {
  1303. let s = e[0],
  1304. r = e[1],
  1305. n = e[2],
  1306. a = e[3],
  1307. o = e[4],
  1308. h = e[5],
  1309. l = e[6],
  1310. c = e[7],
  1311. u = e[8],
  1312. g = i[0],
  1313. m = i[1],
  1314. d = i[2],
  1315. p = i[3],
  1316. x = i[4],
  1317. f = i[5],
  1318. A = i[6],
  1319. v = i[7],
  1320. M = i[8];
  1321. return t[0] = g * s + m * a + d * l, t[1] = g * r + m * o + d * c, t[2] = g * n + m * h + d * u, t[3] = p * s + x * a + f * l, t[4] = p * r + x * o + f * c, t[5] = p * n + x * h + f * u, t[6] = A * s + v * a + M * l, t[7] = A * r + v * o + M * c, t[8] = A * n + v * h + M * u, t
  1322. }
  1323. class H extends Array {
  1324. constructor(t = 1, e = 0, i = 0, s = 0, r = 1, n = 0, a = 0, o = 0, h = 1) {
  1325. return super(t, e, i, s, r, n, a, o, h), this
  1326. }
  1327. set(t, e, i, s, r, n, a, o, h) {
  1328. return t.length ? this.copy(t) : (function(t, e, i, s, r, n, a, o, h, l) {
  1329. t[0] = e, t[1] = i, t[2] = s, t[3] = r, t[4] = n, t[5] = a, t[6] = o, t[7] = h, t[8] = l
  1330. }(this, t, e, i, s, r, n, a, o, h), this)
  1331. }
  1332. translate(t, e = this) {
  1333. return function(t, e, i) {
  1334. let s = e[0],
  1335. r = e[1],
  1336. n = e[2],
  1337. a = e[3],
  1338. o = e[4],
  1339. h = e[5],
  1340. l = e[6],
  1341. c = e[7],
  1342. u = e[8],
  1343. g = i[0],
  1344. m = i[1];
  1345. t[0] = s, t[1] = r, t[2] = n, t[3] = a, t[4] = o, t[5] = h, t[6] = g * s + m * a + l, t[7] = g * r + m * o + c, t[8] = g * n + m * h + u
  1346. }(this, e, t), this
  1347. }
  1348. rotate(t, e = this) {
  1349. return function(t, e, i) {
  1350. let s = e[0],
  1351. r = e[1],
  1352. n = e[2],
  1353. a = e[3],
  1354. o = e[4],
  1355. h = e[5],
  1356. l = e[6],
  1357. c = e[7],
  1358. u = e[8],
  1359. g = Math.sin(i),
  1360. m = Math.cos(i);
  1361. t[0] = m * s + g * a, t[1] = m * r + g * o, t[2] = m * n + g * h, t[3] = m * a - g * s, t[4] = m * o - g * r, t[5] = m * h - g * n, t[6] = l, t[7] = c, t[8] = u
  1362. }(this, e, t), this
  1363. }
  1364. scale(t, e = this) {
  1365. return function(t, e, i) {
  1366. let s = i[0],
  1367. r = i[1];
  1368. t[0] = s * e[0], t[1] = s * e[1], t[2] = s * e[2], t[3] = r * e[3], t[4] = r * e[4], t[5] = r * e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8]
  1369. }(this, e, t), this
  1370. }
  1371. multiply(t, e) {
  1372. return e ? L(this, t, e) : L(this, this, t), this
  1373. }
  1374. identity() {
  1375. var t;
  1376. return (t = this)[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, this
  1377. }
  1378. copy(t) {
  1379. var e, i;
  1380. return i = t, (e = this)[0] = i[0], e[1] = i[1], e[2] = i[2], e[3] = i[3], e[4] = i[4], e[5] = i[5], e[6] = i[6], e[7] = i[7], e[8] = i[8], this
  1381. }
  1382. fromMatrix4(t) {
  1383. var e, i;
  1384. return i = t, (e = this)[0] = i[0], e[1] = i[1], e[2] = i[2], e[3] = i[4], e[4] = i[5], e[5] = i[6], e[6] = i[8], e[7] = i[9], e[8] = i[10], this
  1385. }
  1386. fromQuaternion(t) {
  1387. return function(t, e) {
  1388. let i = e[0],
  1389. s = e[1],
  1390. r = e[2],
  1391. n = e[3],
  1392. a = i + i,
  1393. o = s + s,
  1394. h = r + r,
  1395. l = i * a,
  1396. c = s * a,
  1397. u = s * o,
  1398. g = r * a,
  1399. m = r * o,
  1400. d = r * h,
  1401. p = n * a,
  1402. x = n * o,
  1403. f = n * h;
  1404. t[0] = 1 - u - d, t[3] = c - f, t[6] = g + x, t[1] = c + f, t[4] = 1 - l - d, t[7] = m - p, t[2] = g - x, t[5] = m + p, t[8] = 1 - l - u
  1405. }(this, t), this
  1406. }
  1407. fromBasis(t, e, i) {
  1408. return this.set(t[0], t[1], t[2], e[0], e[1], e[2], i[0], i[1], i[2]), this
  1409. }
  1410. inverse(t = this) {
  1411. return function(t, e) {
  1412. let i = e[0],
  1413. s = e[1],
  1414. r = e[2],
  1415. n = e[3],
  1416. a = e[4],
  1417. o = e[5],
  1418. h = e[6],
  1419. l = e[7],
  1420. c = e[8],
  1421. u = c * a - o * l,
  1422. g = -c * n + o * h,
  1423. m = l * n - a * h,
  1424. d = i * u + s * g + r * m;
  1425. d && (d = 1 / d, t[0] = u * d, t[1] = (-c * s + r * l) * d, t[2] = (o * s - r * a) * d, t[3] = g * d, t[4] = (c * i - r * h) * d, t[5] = (-o * i + r * n) * d, t[6] = m * d, t[7] = (-l * i + s * h) * d, t[8] = (a * i - s * n) * d)
  1426. }(this, t), this
  1427. }
  1428. getNormalMatrix(t) {
  1429. return function(t, e) {
  1430. let i = e[0],
  1431. s = e[1],
  1432. r = e[2],
  1433. n = e[3],
  1434. a = e[4],
  1435. o = e[5],
  1436. h = e[6],
  1437. l = e[7],
  1438. c = e[8],
  1439. u = e[9],
  1440. g = e[10],
  1441. m = e[11],
  1442. d = e[12],
  1443. p = e[13],
  1444. x = e[14],
  1445. f = e[15],
  1446. A = i * o - s * a,
  1447. v = i * h - r * a,
  1448. M = i * l - n * a,
  1449. w = s * h - r * o,
  1450. y = s * l - n * o,
  1451. E = r * l - n * h,
  1452. U = c * p - u * d,
  1453. F = c * x - g * d,
  1454. C = c * f - m * d,
  1455. R = u * x - g * p,
  1456. b = u * f - m * p,
  1457. T = g * f - m * x,
  1458. G = A * T - v * b + M * R + w * C - y * F + E * U;
  1459. G && (G = 1 / G, t[0] = (o * T - h * b + l * R) * G, t[1] = (h * C - a * T - l * F) * G, t[2] = (a * b - o * C + l * U) * G, t[3] = (r * b - s * T - n * R) * G, t[4] = (i * T - r * C + n * F) * G, t[5] = (s * C - i * b - n * U) * G, t[6] = (p * E - x * y + f * w) * G, t[7] = (x * M - d * E - f * v) * G, t[8] = (d * y - p * M + f * A) * G)
  1460. }(this, t), this
  1461. }
  1462. }
  1463. let W = 0;
  1464. class q extends P {
  1465. constructor(t, {
  1466. geometry: e,
  1467. program: i,
  1468. mode: s = t.TRIANGLES,
  1469. frustumCulled: r = !0,
  1470. renderOrder: n = 0
  1471. } = {}) {
  1472. super(), t.canvas || console.error("gl not passed as first argument to Mesh"), this.gl = t, this.id = W++, this.geometry = e, this.program = i, this.mode = s, this.frustumCulled = r, this.renderOrder = n, this.modelViewMatrix = new N, this.normalMatrix = new H, this.beforeRenderCallbacks = [], this.afterRenderCallbacks = []
  1473. }
  1474. onBeforeRender(t) {
  1475. return this.beforeRenderCallbacks.push(t), this
  1476. }
  1477. onAfterRender(t) {
  1478. return this.afterRenderCallbacks.push(t), this
  1479. }
  1480. draw({
  1481. camera: t
  1482. } = {}) {
  1483. this.beforeRenderCallbacks.forEach((e => e && e({
  1484. mesh: this,
  1485. camera: t
  1486. }))), t && (this.program.uniforms.modelMatrix || Object.assign(this.program.uniforms, {
  1487. modelMatrix: {
  1488. value: null
  1489. },
  1490. viewMatrix: {
  1491. value: null
  1492. },
  1493. modelViewMatrix: {
  1494. value: null
  1495. },
  1496. normalMatrix: {
  1497. value: null
  1498. },
  1499. projectionMatrix: {
  1500. value: null
  1501. },
  1502. cameraPosition: {
  1503. value: null
  1504. }
  1505. }), this.program.uniforms.projectionMatrix.value = t.projectionMatrix, this.program.uniforms.cameraPosition.value = t.worldPosition, this.program.uniforms.viewMatrix.value = t.viewMatrix, this.modelViewMatrix.multiply(t.viewMatrix, this.worldMatrix), this.normalMatrix.getNormalMatrix(this.modelViewMatrix), this.program.uniforms.modelMatrix.value = this.worldMatrix, this.program.uniforms.modelViewMatrix.value = this.modelViewMatrix, this.program.uniforms.normalMatrix.value = this.normalMatrix);
  1506. let e = this.program.cullFace && this.worldMatrix.determinant() < 0;
  1507. this.program.use({
  1508. flipFaces: e
  1509. }), this.geometry.draw({
  1510. mode: this.mode,
  1511. program: this.program
  1512. }), this.afterRenderCallbacks.forEach((e => e && e({
  1513. mesh: this,
  1514. camera: t
  1515. })))
  1516. }
  1517. }
  1518. const X = new Uint8Array(4);
  1519.  
  1520. function _(t) {
  1521. return 0 == (t & t - 1)
  1522. }
  1523. let $ = 1;
  1524. class tt {
  1525. constructor(t, {
  1526. image: e,
  1527. target: i = t.TEXTURE_2D,
  1528. type: s = t.UNSIGNED_BYTE,
  1529. format: r = t.RGBA,
  1530. internalFormat: n = r,
  1531. wrapS: a = t.CLAMP_TO_EDGE,
  1532. wrapT: o = t.CLAMP_TO_EDGE,
  1533. generateMipmaps: h = !0,
  1534. minFilter: l = (h ? t.NEAREST_MIPMAP_LINEAR : t.LINEAR),
  1535. magFilter: c = t.LINEAR,
  1536. premultiplyAlpha: u = !1,
  1537. unpackAlignment: g = 4,
  1538. flipY: m = i == t.TEXTURE_2D,
  1539. anisotropy: d = 0,
  1540. level: p = 0,
  1541. width: x,
  1542. height: f = x
  1543. } = {}) {
  1544. this.gl = t, this.id = $++, this.image = e, this.target = i, this.type = s, this.format = r, this.internalFormat = n, this.minFilter = l, this.magFilter = c, this.wrapS = a, this.wrapT = o, this.generateMipmaps = h, this.premultiplyAlpha = u, this.unpackAlignment = g, this.flipY = m, this.anisotropy = Math.min(d, this.gl.renderer.parameters.maxAnisotropy), this.level = p, this.width = x, this.height = f, this.texture = this.gl.createTexture(), this.store = {
  1545. image: null
  1546. }, this.glState = this.gl.renderer.state, this.state = {}, this.state.minFilter = this.gl.NEAREST_MIPMAP_LINEAR, this.state.magFilter = this.gl.LINEAR, this.state.wrapS = this.gl.REPEAT, this.state.wrapT = this.gl.REPEAT, this.state.anisotropy = 0
  1547. }
  1548. bind() {
  1549. this.glState.textureUnits[this.glState.activeTextureUnit] !== this.id && (this.gl.bindTexture(this.target, this.texture), this.glState.textureUnits[this.glState.activeTextureUnit] = this.id)
  1550. }
  1551. update(t = 0) {
  1552. const e = !(this.image === this.store.image && !this.needsUpdate);
  1553. if ((e || this.glState.textureUnits[t] !== this.id) && (this.gl.renderer.activeTexture(t), this.bind()), e) {
  1554. if (this.needsUpdate = !1, this.flipY !== this.glState.flipY && (this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, this.flipY), this.glState.flipY = this.flipY), this.premultiplyAlpha !== this.glState.premultiplyAlpha && (this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha), this.glState.premultiplyAlpha = this.premultiplyAlpha), this.unpackAlignment !== this.glState.unpackAlignment && (this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT, this.unpackAlignment), this.glState.unpackAlignment = this.unpackAlignment), this.minFilter !== this.state.minFilter && (this.gl.texParameteri(this.target, this.gl.TEXTURE_MIN_FILTER, this.minFilter), this.state.minFilter = this.minFilter), this.magFilter !== this.state.magFilter && (this.gl.texParameteri(this.target, this.gl.TEXTURE_MAG_FILTER, this.magFilter), this.state.magFilter = this.magFilter), this.wrapS !== this.state.wrapS && (this.gl.texParameteri(this.target, this.gl.TEXTURE_WRAP_S, this.wrapS), this.state.wrapS = this.wrapS), this.wrapT !== this.state.wrapT && (this.gl.texParameteri(this.target, this.gl.TEXTURE_WRAP_T, this.wrapT), this.state.wrapT = this.wrapT), this.anisotropy && this.anisotropy !== this.state.anisotropy && (this.gl.texParameterf(this.target, this.gl.renderer.getExtension("EXT_texture_filter_anisotropic").TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropy), this.state.anisotropy = this.anisotropy), this.image) {
  1555. if (this.image.width && (this.width = this.image.width, this.height = this.image.height), this.target === this.gl.TEXTURE_CUBE_MAP)
  1556. for (let t = 0; t < 6; t++) this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X + t, this.level, this.internalFormat, this.format, this.type, this.image[t]);
  1557. else if (ArrayBuffer.isView(this.image)) this.gl.texImage2D(this.target, this.level, this.internalFormat, this.width, this.height, 0, this.format, this.type, this.image);
  1558. else if (this.image.isCompressedTexture)
  1559. for (let t = 0; t < this.image.length; t++) this.gl.compressedTexImage2D(this.target, t, this.internalFormat, this.image[t].width, this.image[t].height, 0, this.image[t].data);
  1560. else this.gl.texImage2D(this.target, this.level, this.internalFormat, this.format, this.type, this.image);
  1561. this.generateMipmaps && (this.gl.renderer.isWebgl2 || _(this.image.width) && _(this.image.height) ? this.gl.generateMipmap(this.target) : (this.generateMipmaps = !1, this.wrapS = this.wrapT = this.gl.CLAMP_TO_EDGE, this.minFilter = this.gl.LINEAR)), this.onUpdate && this.onUpdate()
  1562. } else if (this.target === this.gl.TEXTURE_CUBE_MAP)
  1563. for (let t = 0; t < 6; t++) this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X + t, 0, this.gl.RGBA, 1, 1, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, X);
  1564. else this.width ? this.gl.texImage2D(this.target, this.level, this.internalFormat, this.width, this.height, 0, this.format, this.type, null) : this.gl.texImage2D(this.target, 0, this.gl.RGBA, 1, 1, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, X);
  1565. this.store.image = this.image
  1566. }
  1567. }
  1568. }
  1569. class et extends Array {
  1570. constructor(t = 0, e = t, i = t, s = t) {
  1571. return super(t, e, i, s), this
  1572. }
  1573. get x() {
  1574. return this[0]
  1575. }
  1576. get y() {
  1577. return this[1]
  1578. }
  1579. get z() {
  1580. return this[2]
  1581. }
  1582. get w() {
  1583. return this[3]
  1584. }
  1585. set x(t) {
  1586. this[0] = t
  1587. }
  1588. set y(t) {
  1589. this[1] = t
  1590. }
  1591. set z(t) {
  1592. this[2] = t
  1593. }
  1594. set w(t) {
  1595. this[3] = t
  1596. }
  1597. set(t, e, i, s) {
  1598. return t.length ? this.copy(t) : (R(this, t, e, i, s), this)
  1599. }
  1600. copy(t) {
  1601. return C(this, t), this
  1602. }
  1603. normalize() {
  1604. return b(this, this), this
  1605. }
  1606. multiply(t) {
  1607. var e, i, s;
  1608. return i = this, s = t, (e = this)[0] = i[0] * s, e[1] = i[1] * s, e[2] = i[2] * s, e[3] = i[3] * s, this
  1609. }
  1610. dot(t) {
  1611. return T(this, t)
  1612. }
  1613. fromArray(t, e = 0) {
  1614. return this[0] = t[e], this[1] = t[e + 1], this[2] = t[e + 2], this[3] = t[e + 3], this
  1615. }
  1616. toArray(t = [], e = 0) {
  1617. return t[e] = this[0], t[e + 1] = this[1], t[e + 2] = this[2], t[e + 3] = this[3], t
  1618. }
  1619. }
  1620. class it extends p {
  1621. constructor(t, {
  1622. width: e = 1,
  1623. height: i = 1,
  1624. widthSegments: s = 1,
  1625. heightSegments: r = 1,
  1626. attributes: n = {}
  1627. } = {}) {
  1628. const a = s,
  1629. o = r,
  1630. h = (a + 1) * (o + 1),
  1631. l = a * o * 6,
  1632. c = new Float32Array(3 * h),
  1633. u = new Float32Array(3 * h),
  1634. g = new Float32Array(2 * h),
  1635. m = l > 65536 ? new Uint32Array(l) : new Uint16Array(l);
  1636. it.buildPlane(c, u, g, m, e, i, 0, a, o), Object.assign(n, {
  1637. position: {
  1638. size: 3,
  1639. data: c
  1640. },
  1641. normal: {
  1642. size: 3,
  1643. data: u
  1644. },
  1645. uv: {
  1646. size: 2,
  1647. data: g
  1648. },
  1649. index: {
  1650. data: m
  1651. }
  1652. }), super(t, n)
  1653. }
  1654. static buildPlane(t, e, i, s, r, n, a, o, h, l = 0, c = 1, u = 2, g = 1, m = -1, d = 0, p = 0) {
  1655. const x = d,
  1656. f = r / o,
  1657. A = n / h;
  1658. for (let v = 0; v <= h; v++) {
  1659. let M = v * A - n / 2;
  1660. for (let n = 0; n <= o; n++, d++) {
  1661. let A = n * f - r / 2;
  1662. if (t[3 * d + l] = A * g, t[3 * d + c] = M * m, t[3 * d + u] = a / 2, e[3 * d + l] = 0, e[3 * d + c] = 0, e[3 * d + u] = a >= 0 ? 1 : -1, i[2 * d] = n / o, i[2 * d + 1] = 1 - v / h, v === h || n === o) continue;
  1663. let w = x + n + v * (o + 1),
  1664. y = x + n + (v + 1) * (o + 1),
  1665. E = x + n + (v + 1) * (o + 1) + 1,
  1666. U = x + n + v * (o + 1) + 1;
  1667. s[6 * p] = w, s[6 * p + 1] = y, s[6 * p + 2] = U, s[6 * p + 3] = y, s[6 * p + 4] = E, s[6 * p + 5] = U, p++
  1668. }
  1669. }
  1670. }
  1671. }
  1672. const st = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwkHBgoJCAkLCwoMDxkQDw4ODx4WFxIZJCAmJSMgIyIoLTkwKCo2KyIjMkQyNjs9QEBAJjBGS0U+Sjk/QD3/2wBDAQsLCw8NDx0QEB09KSMpPT09PT09PT09PT09PT09PT09P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BIsbLNCiKSaKKlRihyVDMBzMEWNsUImchRIiVn9mSMYscmyWZoaHKJaEJCxGkxysxuiTkOBnopWYFC5UUmUKSN6NbFHrFDyP6FZiNjstCZiOUhQMjIUWeguM1fVlpmMhlDn1h1YmrLEpmtdWmU+skZiiYGbRgj//xAAUEQEAAAAAAAAAAAAAAAAAAADA/9oACAECAQE/AAAH/8QAFBEBAAAAAAAAAAAAAAAAAAAAwP/aAAgBAwEBPwAAB//Z",
  1673. rt = .5 * (Math.sqrt(3) - 1),
  1674. nt = (3 - Math.sqrt(3)) / 6,
  1675. at = t => 0 | Math.floor(t),
  1676. ot = new Float64Array([1, 1, -1, 1, 1, -1, -1, -1, 1, 0, -1, 0, 1, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, -1]);
  1677.  
  1678. function ht(t) {
  1679. return t * (.5 - Math.random())
  1680. }
  1681.  
  1682. function lt(t, e) {
  1683. return t + Math.random() * (e - t)
  1684. }
  1685. const ct = function(t = Math.random) {
  1686. const e = function(t) {
  1687. const e = 512,
  1688. i = new Uint8Array(e);
  1689. for (let t = 0; t < e / 2; t++) i[t] = t;
  1690. for (let s = 0; s < e / 2 - 1; s++) {
  1691. const e = s + ~~(t() * (256 - s)),
  1692. r = i[s];
  1693. i[s] = i[e], i[e] = r
  1694. }
  1695. for (let t = 256; t < e; t++) i[t] = i[t - 256];
  1696. return i
  1697. }(t),
  1698. i = new Float64Array(e).map((t => ot[t % 12 * 2])),
  1699. s = new Float64Array(e).map((t => ot[t % 12 * 2 + 1]));
  1700. return function(t, r) {
  1701. let n = 0,
  1702. a = 0,
  1703. o = 0;
  1704. const h = (t + r) * rt,
  1705. l = at(t + h),
  1706. c = at(r + h),
  1707. u = (l + c) * nt,
  1708. g = t - (l - u),
  1709. m = r - (c - u);
  1710. let d, p;
  1711. g > m ? (d = 1, p = 0) : (d = 0, p = 1);
  1712. const x = g - d + nt,
  1713. f = m - p + nt,
  1714. A = g - 1 + 2 * nt,
  1715. v = m - 1 + 2 * nt,
  1716. M = 255 & l,
  1717. w = 255 & c;
  1718. let y = .5 - g * g - m * m;
  1719. if (y >= 0) {
  1720. const t = M + e[w];
  1721. y *= y, n = y * y * (i[t] * g + s[t] * m)
  1722. }
  1723. let E = .5 - x * x - f * f;
  1724. if (E >= 0) {
  1725. const t = M + d + e[w + p];
  1726. E *= E, a = E * E * (i[t] * x + s[t] * f)
  1727. }
  1728. let U = .5 - A * A - v * v;
  1729. if (U >= 0) {
  1730. const t = M + 1 + e[w + 1];
  1731. U *= U, o = U * U * (i[t] * A + s[t] * v)
  1732. }
  1733. return 70 * (n + a + o)
  1734. }
  1735. }(Math.random);
  1736.  
  1737. function ut(t) {
  1738. return Math.max(0, Math.min(1, t))
  1739. }
  1740. const gt = "float PI = 3.141592653589793238;",
  1741. mt = "\n#extension GL_OES_standard_derivatives : enable\nprecision highp float;\n\nuniform float time;\nuniform float progress;\nuniform sampler2D texture1;\nuniform sampler2D texture2;\nuniform vec4 resolution;\nvarying vec2 vUv;\n",
  1742. dt = "\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute float offset;\nattribute vec3 bary;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float progress;\nuniform vec4 resolution;\n\nvarying vec2 vUv;\nvarying float vProgress;\nvarying float vProgress1;\nvarying vec3 vBary;\n",
  1743. pt = "\nmat4 rotationMatrix(vec3 axis, float angle) {\n axis = normalize(axis);\n float s = sin(angle);\n float c = cos(angle);\n float oc = 1.0 - c;\n\n return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,\n oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,\n oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,\n 0.0, 0.0, 0.0, 1.0);\n}\nvec3 rotate(vec3 v, vec3 axis, float angle) {\n mat4 m = rotationMatrix(axis, angle);\n return (m * vec4(v, 1.0)).xyz;\n}\n",
  1744. xt = {
  1745. dots: {
  1746. uniforms: {},
  1747. fragment: `\n ${mt}\n const float SQRT_2 = 1.414213562373;\n const vec2 center = vec2(0, 0);// = vec2(0, 0);\n const float dots = 20.0;// = 20.0;\n\n vec4 getFromColor(vec2 p) {\n return texture2D(texture1, p);\n }\n\n vec4 getToColor(vec2 p) {\n return texture2D(texture2, p);\n }\n\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n\n bool nextImage = distance(fract(newUV * dots), vec2(0.5, 0.5)) < ( progress / distance(newUV, center));\n gl_FragColor = nextImage ? getToColor(newUV) : getFromColor(newUV);\n }\n\n `
  1748. },
  1749. flyeye: {
  1750. uniforms: {},
  1751. fragment: `\n ${mt}\n const float size = 0.04; // = 0.04\n const float zoom = 100.0; // = 50.0\n const float colorSeparation = 0.3; // = 0.3\n\n vec4 getFromColor(vec2 p) {\n return texture2D(texture1, p);\n }\n\n vec4 getToColor(vec2 p) {\n return texture2D(texture2, p);\n }\n\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n\n float inv = 1. - progress;\n vec2 disp = size*vec2(cos(zoom*newUV.x), sin(zoom*newUV.y));\n vec4 texTo = getToColor(newUV + inv*disp);\n vec4 texFrom = vec4(\n getFromColor(newUV + progress*disp*(1.0 - colorSeparation)).r,\n getFromColor(newUV + progress*disp).g,\n getFromColor(newUV + progress*disp*(1.0 + colorSeparation)).b,\n 1.0);\n gl_FragColor = texTo*progress + texFrom*inv;\n }\n\n `
  1752. },
  1753. "morph-x": {
  1754. uniforms: {
  1755. intensity: {
  1756. value: 1,
  1757. type: "f",
  1758. min: 0,
  1759. max: 3
  1760. }
  1761. },
  1762. fragment: `\n ${mt}\n uniform float intensity;\n uniform sampler2D displacement;\n mat2 getRotM(float angle) {\n float s = sin(angle);\n float c = cos(angle);\n return mat2(c, -s, s, c);\n }\n const float PI = 3.1415;\n const float angle1 = PI *0.25;\n const float angle2 = -PI *0.75;\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n vec4 disp = texture2D(displacement, newUV);\n vec2 dispVec = vec2(disp.r, disp.g);\n vec2 distortedPosition1 = newUV + getRotM(angle1) * dispVec * intensity * progress;\n vec4 t1 = texture2D(texture1, distortedPosition1);\n vec2 distortedPosition2 = newUV + getRotM(angle2) * dispVec * intensity * (1.0 - progress);\n vec4 t2 = texture2D(texture2, distortedPosition2);\n gl_FragColor = mix(t1, t2, progress);\n }\n`
  1763. },
  1764. "morph-y": {
  1765. uniforms: {
  1766. intensity: {
  1767. value: .3,
  1768. type: "f",
  1769. min: 0,
  1770. max: 2
  1771. }
  1772. },
  1773. fragment: `\n ${mt}\n uniform float intensity;\n uniform sampler2D displacement;\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n vec4 d1 = texture2D(texture1, newUV);\n vec4 d2 = texture2D(texture2, newUV);\n float displace1 = (d1.r + d1.g + d1.b)*0.33;\n float displace2 = (d2.r + d2.g + d2.b)*0.33;\n\n vec4 t1 = texture2D(texture1, vec2(newUV.x, newUV.y + progress * (displace2 * intensity)));\n vec4 t2 = texture2D(texture2, vec2(newUV.x, newUV.y + (1.0 - progress) * (displace1 * intensity)));\n gl_FragColor = mix(t1, t2, progress);\n }\n`
  1774. },
  1775. "page-curl": {
  1776. uniforms: {},
  1777. fragment: `\n ${mt}\n const float MIN_AMOUNT = -0.16;\n const float MAX_AMOUNT = 1.5;\n\n const float PI = 3.141592653589793;\n\n const float scale = 512.0;\n const float sharpness = 3.0;\n\n const float cylinderRadius = 1.0 / PI / 2.0;\n\n vec4 getFromColor(vec2 p) {\n return texture2D(texture1, p);\n }\n\n vec4 getToColor(vec2 p) {\n return texture2D(texture2, p);\n }\n\n vec3 hitPoint(float hitAngle, float yc, vec3 point, mat3 rrotation) {\n float hitPoint = hitAngle / (2.0 * PI);\n point.y = hitPoint;\n return rrotation * point;\n }\n\n vec4 antiAlias(vec4 color1, vec4 color2, float distanc) {\n distanc *= scale;\n if(distanc < 0.0)\n return color2;\n if(distanc > 2.0)\n return color1;\n float dd = pow(1.0 - distanc / 2.0, sharpness);\n return ((color2 - color1) * dd) + color1;\n }\n\n float distanceToEdge(vec3 point) {\n float dx = abs(point.x > 0.5 ? 1.0 - point.x : point.x);\n float dy = abs(point.y > 0.5 ? 1.0 - point.y : point.y);\n if(point.x < 0.0)\n dx = -point.x;\n if(point.x > 1.0)\n dx = point.x - 1.0;\n if(point.y < 0.0)\n dy = -point.y;\n if(point.y > 1.0)\n dy = point.y - 1.0;\n if((point.x < 0.0 || point.x > 1.0) && (point.y < 0.0 || point.y > 1.0))\n return sqrt(dx * dx + dy * dy);\n return min(dx, dy);\n }\n\n vec4 seeThrough(float yc, vec2 p, mat3 rotation, mat3 rrotation, float cylinderAngle) {\n float hitAngle = PI - (acos(yc / cylinderRadius) - cylinderAngle);\n vec3 point = hitPoint(hitAngle, yc, rotation * vec3(p, 1.0), rrotation);\n if(yc <= 0.0 && (point.x < 0.0 || point.y < 0.0 || point.x > 1.0 || point.y > 1.0)) {\n return getToColor(p);\n }\n\n if(yc > 0.0)\n return getFromColor(p);\n\n vec4 color = getFromColor(point.xy);\n vec4 tcolor = vec4(0.0);\n\n return antiAlias(color, tcolor, distanceToEdge(point));\n }\n\n vec4 seeThroughWithShadow(float yc, vec2 p, vec3 point, mat3 rotation, mat3 rrotation, float cylinderAngle, float amount) {\n float shadow = distanceToEdge(point) * 30.0;\n shadow = (1.0 - shadow) / 3.0;\n\n if(shadow < 0.0)\n shadow = 0.0;\n else\n shadow *= amount;\n\n vec4 shadowColor = seeThrough(yc, p, rotation, rrotation, cylinderAngle);\n shadowColor.r -= shadow;\n shadowColor.g -= shadow;\n shadowColor.b -= shadow;\n\n return shadowColor;\n }\n\n vec4 backside(float yc, vec3 point) {\n vec4 color = getFromColor(point.xy);\n float gray = (color.r + color.b + color.g) / 15.0;\n gray += (8.0 / 10.0) * (pow(1.0 - abs(yc / cylinderRadius), 2.0 / 10.0) / 2.0 + (5.0 / 10.0));\n color.rgb = vec3(gray);\n return color;\n }\n\n vec4 behindSurface(vec2 p, float yc, vec3 point, mat3 rrotation, float cylinderAngle, float amount) {\n float shado = (1.0 - ((-cylinderRadius - yc) / amount * 7.0)) / 6.0;\n shado *= 1.0 - abs(point.x - 0.5);\n\n yc = (-cylinderRadius - cylinderRadius - yc);\n\n float hitAngle = (acos(yc / cylinderRadius) + cylinderAngle) - PI;\n point = hitPoint(hitAngle, yc, point, rrotation);\n\n if(yc < 0.0 && point.x >= 0.0 && point.y >= 0.0 && point.x <= 1.0 && point.y <= 1.0 && (hitAngle < PI || amount > 0.5)) {\n shado = 1.0 - (sqrt(pow(point.x - 0.5, 2.0) + pow(point.y - 0.5, 2.0)) / (71.0 / 100.0));\n shado *= pow(-yc / cylinderRadius, 3.0);\n shado *= 0.5;\n } else {\n shado = 0.0;\n }\n return vec4(getToColor(p).rgb - shado, 1.0);\n }\n\n void main() {\n vec2 newUV = (vUv - vec2(0.5)) * resolution.zw + vec2(0.5);\n\n float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\n float cylinderCenter = amount;\n // 360 degrees * amount\n float cylinderAngle = 2.0 * PI * amount;\n\n const float angle = 100.0 * PI / 180.0;\n float c = cos(-angle);\n float s = sin(-angle);\n\n mat3 rotation = mat3(c, s, 0, -s, c, 0, -0.801, 0.8900, 1);\n c = cos(angle);\n s = sin(angle);\n\n mat3 rrotation = mat3(c, s, 0, -s, c, 0, 0.98500, 0.985, 1);\n\n vec3 point = rotation * vec3(newUV, 1.0);\n\n float yc = point.y - cylinderCenter;\n\n if(yc < -cylinderRadius) {\n // Behind surface\n gl_FragColor = behindSurface(newUV, yc, point, rrotation, cylinderAngle, amount);\n return;\n }\n\n if(yc > cylinderRadius) {\n // Flat surface\n gl_FragColor = getFromColor(newUV);\n return;\n }\n\n float hitAngle = (acos(yc / cylinderRadius) + cylinderAngle) - PI;\n\n float hitAngleMod = mod(hitAngle, 2.0 * PI);\n if((hitAngleMod > PI && amount < 0.5) || (hitAngleMod > PI / 2.0 && amount < 0.0)) {\n gl_FragColor = seeThrough(yc, newUV, rotation, rrotation, cylinderAngle);\n return;\n }\n\n point = hitPoint(hitAngle, yc, point, rrotation);\n\n if(point.x < 0.0 || point.y < 0.0 || point.x > 1.0 || point.y > 1.0) {\n gl_FragColor = seeThroughWithShadow(yc, newUV, point, rotation, rrotation, cylinderAngle, amount);\n return;\n }\n\n vec4 color = backside(yc, point);\n\n vec4 otherColor;\n if(yc < 0.0) {\n float shado = 1.0 - (sqrt(pow(point.x - 0.5, 2.0) + pow(point.y - 0.5, 2.0)) / 0.71);\n shado *= pow(-yc / cylinderRadius, 3.0);\n shado *= 0.5;\n otherColor = vec4(0.0, 0.0, 0.0, shado);\n } else {\n otherColor = getFromColor(newUV);\n }\n\n color = antiAlias(color, otherColor, cylinderRadius - abs(yc));\n\n vec4 cl = seeThroughWithShadow(yc, newUV, point, rotation, rrotation, cylinderAngle, amount);\n float dist = distanceToEdge(point);\n\n gl_FragColor = antiAlias(color, cl, dist);\n }\n `
  1778. },
  1779. "peel-x": {
  1780. uniforms: {},
  1781. fragment: `\n ${mt}\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n vec2 p = newUV;\n float x = progress;\n x = smoothstep(.0,1.0,(x*2.0+p.x-1.0));\n vec4 f = mix(\n texture2D(texture1, (p-.5)*(1.-x)+.5),\n texture2D(texture2, (p-.5)*x+.5),\n x);\n gl_FragColor = f;\n }\n `
  1782. },
  1783. "peel-y": {
  1784. uniforms: {},
  1785. fragment: `\n ${mt}\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n vec2 p = newUV;\n float x = progress;\n x = smoothstep(.0,1.0,(x*2.0+p.y-1.0));\n vec4 f = mix(\n texture2D(texture1, (p-.5)*(1.-x)+.5),\n texture2D(texture2, (p-.5)*x+.5),\n x);\n gl_FragColor = f;\n }\n `
  1786. },
  1787. "polygons-fall": {
  1788. uniforms: {},
  1789. detail: 12,
  1790. offsetTop: 0,
  1791. vertex: `\n ${dt}\n attribute vec3 centroid1;\n\n ${pt}\n\n void main() {\n ${gt}\n vUv = uv;\n vBary = bary;\n\n vec3 newpos = position;\n\n float o = 1. - offset;\n float pr = (progress - 0.5) * (0. + resolution.y / resolution.x) + 0.5;\n pr = progress;\n float prog = clamp((pr - o * 0.9) / 0.1, 0., 1.);\n vProgress = prog;\n vProgress1 = clamp((pr - clamp(o - 0.1, 0., 1.) * 0.9) / 0.1, 0., 1.);\n newpos = rotate((newpos - centroid1), vec3(1., 0., 0.), -prog * PI) + centroid1 + vec3(0., -1., 0.) * prog * 0.;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newpos, 1.0);\n }\n `,
  1792. fragment: `\n ${mt}\n varying float vProgress;\n varying float vProgress1;\n ${gt}\n varying vec3 vBary;\n\n void main()\t{\n float width = 2.5 * vProgress1;\n vec3 d;\n #ifdef GL_OES_standard_derivatives\n d = fwidth(vBary);\n #endif\n vec3 s = smoothstep(d * (width + 0.5), d * (width - 0.5), vBary);\n float alpha = max(max(s.x, s.y), s.z);\n vec3 color = vec3(alpha);\n vec2 newUV = (vUv - vec2(0.5)) * resolution.zw + vec2(0.5);\n vec4 t = texture2D(texture1, newUV);\n float opa = smoothstep(1., 0.5, vProgress);\n opa = 1. - vProgress;\n gl_FragColor = vec4(vUv, 0.0, opa);\n gl_FragColor = vec4(t.rgb + .5 * color * vProgress1, opa);\n }\n `
  1793. },
  1794. "polygons-morph": {
  1795. uniforms: {},
  1796. detail: 20,
  1797. offsetTop: .4,
  1798. vertex: `\n ${dt}\n ${pt}\n\n void main() {\n ${gt}\n vUv = uv;\n vBary = bary;\n\n vec3 newpos = position;\n\n float o = 1. - offset;\n float prog = clamp((progress - o * 0.6) / 0.4, 0., 1.);\n vProgress = prog;\n vProgress1 = clamp((progress - clamp(o - 0.1, -0., 1.) * 0.9) / 0.1, 0., 1.);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newpos, 1.0);\n }\n `,
  1799. fragment: `\n ${mt}\n varying float vProgress;\n varying float vProgress1;\n ${gt}\n varying vec3 vBary;\n void main()\t{\n float width = 2.5 * vProgress1;\n vec3 d;\n #ifdef GL_OES_standard_derivatives\n d = fwidth(vBary);\n #endif\n vec3 s = smoothstep(d * (width + 0.5), d * (width - 0.5), vBary);\n float alpha = max(max(s.x, s.y), s.z);\n vec3 color = vec3(alpha);\n\n vec2 newUV = (vUv - vec2(0.5)) * resolution.zw + vec2(0.5);\n vec4 t = texture2D(texture1, newUV);\n float opa = smoothstep(1., 0.5, vProgress);\n opa = 1. - vProgress;\n gl_FragColor = vec4(t.rgb + 1. * color * vProgress1, opa);\n }\n `
  1800. },
  1801. "polygons-wind": {
  1802. uniforms: {},
  1803. detail: 40,
  1804. offsetTop: 1,
  1805. vertex: `\n ${dt}\n attribute vec3 control0;\n attribute vec3 control1;\n\n ${pt}\n\n float easeOut(float t){\n return t * t * t;\n }\n\n vec3 bezier4(vec3 a, vec3 b, vec3 c, vec3 d, float t) {\n return mix(mix(mix(a, b, t), mix(b, c, t), t), mix(mix(b, c, t), mix(c, d, t), t), t);\n }\n\n void main() {\n ${gt}\n vUv = uv;\n vBary = bary;\n\n vec3 newpos = position;\n\n float o = 1. - offset;\n float prog = clamp((progress - o * 0.6) / 0.4, 0., 1.);\n vProgress = prog;\n vProgress1 = clamp((progress - clamp(o - 0.2, -0., 1.) * 0.6) / 0.4, 0., 1.);\n newpos = bezier4(newpos, control0, control1, newpos, easeOut(prog));\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newpos, 1.0);\n }\n `,
  1806. fragment: `\n ${mt}\n varying float vProgress;\n varying float vProgress1;\n ${gt}\n varying vec3 vBary;\n void main()\t{\n float width = 2.5 * vProgress1;\n vec3 d;\n #ifdef GL_OES_standard_derivatives\n d = fwidth(vBary);\n #endif\n vec3 s = smoothstep(d * (width + 0.5), d * (width - 0.5), vBary);\n float alpha = max(max(s.x, s.y), s.z);\n vec3 color = vec3(alpha);\n\n vec2 newUV = (vUv - vec2(0.5)) * resolution.zw + vec2(0.5);\n vec4 t = texture2D(texture1, newUV);\n float opa = smoothstep(1., 0.5, vProgress);\n opa = 1. - vProgress;\n gl_FragColor = vec4(vUv, 0.0, opa);\n opa = smoothstep(0.5, 1., opa);\n gl_FragColor = vec4(t.rgb + 1. * color * vProgress1, opa);\n }\n `
  1807. },
  1808. pixelize: {
  1809. uniforms: {},
  1810. fragment: `\n ${mt}\n ivec2 squaresMin = ivec2(50);\n int steps = 20;\n\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n\n float d = min(progress, 1.0 - progress);\n float dist = steps>0 ? ceil(d * float(steps)) / float(steps) : d;\n vec2 squareSize = 2.0 * dist / vec2(squaresMin);\n\n vec2 p = dist>0.0 ? (floor(newUV / squareSize) + 0.5) * squareSize : newUV;\n\n vec2 uv1 = newUV;\n vec2 uv2 = newUV;\n\n vec4 t1 = texture2D(texture1,p);\n vec4 t2 = texture2D(texture2,p);\n\n gl_FragColor = mix(t1, t2, progress);\n }\n `
  1811. },
  1812. ripple: {
  1813. uniforms: {
  1814. radius: {
  1815. value: .9,
  1816. type: "f",
  1817. min: .1,
  1818. max: 2
  1819. },
  1820. width: {
  1821. value: .35,
  1822. type: "f",
  1823. min: 0,
  1824. max: 1
  1825. }
  1826. },
  1827. fragment: `\n ${mt}\n uniform float width;\n uniform float radius;\n uniform sampler2D displacement;\n float parabola( float x, float k ) {\n return pow( 4. * x * ( 1. - x ), k );\n }\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n vec2 p = newUV;\n vec2 start = vec2(0.5,0.5);\n vec2 aspect = resolution.wz;\n vec2 uv = newUV;\n float dt = parabola(progress, 1.);\n vec4 noise = texture2D(displacement, fract(vUv+time*0.04));\n float prog = progress*0.66 + noise.g * 0.04;\n float circ = 1. - smoothstep(-width, 0.0, radius * distance(start*aspect, uv*aspect) - prog*(1.+width));\n float intpl = pow(abs(circ), 1.);\n vec4 t1 = texture2D( texture1, (uv - 0.5) * (1.0 - intpl) + 0.5 ) ;\n vec4 t2 = texture2D( texture2, (uv - 0.5) * intpl + 0.5 );\n gl_FragColor = mix( t1, t2, intpl );\n }\n `
  1828. },
  1829. shutters: {
  1830. uniforms: {
  1831. intensity: {
  1832. value: 50,
  1833. type: "f",
  1834. min: 1,
  1835. max: 100
  1836. }
  1837. },
  1838. fragment: `\n ${mt}\n uniform float intensity;\n mat2 rotate(float a) {\n float s = sin(a);\n float c = cos(a);\n return mat2(c, -s, s, c);\n }\n const float PI = 3.1415;\n const float angle1 = PI *0.25;\n const float angle2 = PI *0.25;\n\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n\n vec2 uvDivided = fract(newUV*vec2(intensity,1.));\n\n vec2 uvDisplaced1 = newUV + rotate(angle1)*uvDivided*progress*0.1;\n vec2 uvDisplaced2 = newUV + rotate(angle2)*uvDivided*(1. - progress)*0.1;\n\n vec4 t1 = texture2D(texture1,uvDisplaced1);\n vec4 t2 = texture2D(texture2,uvDisplaced2);\n\n gl_FragColor = mix(t1, t2, progress);\n }\n\n `
  1839. },
  1840. slices: {
  1841. uniforms: {
  1842. size: {
  1843. value: .25,
  1844. type: "f",
  1845. min: .1,
  1846. max: 1
  1847. }
  1848. },
  1849. fragment: `\n ${mt}\n uniform float size; // = 0.2\n float count = 20.; // = 10.0\n float smoothness = .5; // = 0.5\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n\n float pr = smoothstep(-smoothness, 0.0, newUV.x - progress * (1.0 + smoothness));\n float s = step(pr, fract(count * newUV.x));\n\n vec2 uv1 = newUV;\n vec2 uv2 = newUV;\n\n vec4 t1 = texture2D(texture1,uv1);\n vec4 t2 = texture2D(texture2,uv2);\n gl_FragColor = mix(t1, t2, s);\n\n }\n `
  1850. },
  1851. squares: {
  1852. uniforms: {},
  1853. fragment: `\n ${mt}\n ivec2 squares = ivec2(10,10);\n vec2 direction = vec2(1.0, -0.5);\n float smoothness = 1.6;\n\n const vec2 center = vec2(0.5, 0.5);\n void main() {\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n\n vec2 v = normalize(direction);\n v /= abs(v.x)+abs(v.y);\n float d = v.x * center.x + v.y * center.y;\n float offset = smoothness;\n float pr = smoothstep(-offset, 0.0, v.x * newUV.x + v.y * newUV.y - (d-0.5+progress*(1.+offset)));\n vec2 squarep = fract(newUV*vec2(squares));\n vec2 squaremin = vec2(pr/2.0);\n vec2 squaremax = vec2(1.0 - pr/2.0);\n float a = (1.0 - step(progress, 0.0)) * step(squaremin.x, squarep.x) * step(squaremin.y, squarep.y) * step(squarep.x, squaremax.x) * step(squarep.y, squaremax.y);\n\n vec2 uv1 = newUV;\n vec2 uv2 = newUV;\n\n vec4 t1 = texture2D(texture1,newUV);\n vec4 t2 = texture2D(texture2,newUV);\n\n gl_FragColor = mix(t1, t2, a);\n }\n `
  1854. },
  1855. stretch: {
  1856. uniforms: {
  1857. intensity: {
  1858. value: 50,
  1859. type: "f",
  1860. min: 1,
  1861. max: 100
  1862. }
  1863. },
  1864. fragment: `\n ${mt}\n uniform float intensity;\n mat2 rotate(float a) {\n float s = sin(a);\n float c = cos(a);\n return mat2(c, -s, s, c);\n }\n const float PI = 3.1415;\n const float angle1 = PI *0.25;\n const float angle2 = -PI *0.75;\n const float noiseSeed = 2.;\n float random() {\n return fract(sin(noiseSeed + dot(gl_FragCoord.xy / resolution.xy / 10.0, vec2(12.9898, 4.1414))) * 43758.5453);\n }\n float hash(float n) { return fract(sin(n) * 1e4); }\n float hash(vec2 p) { return fract(1e4 * sin(17.0 * p.x + p.y * 0.1) * (0.1 + abs(sin(p.y * 13.0 + p.x)))); }\n float hnoise(vec2 x) {\n vec2 i = floor(x);\n vec2 f = fract(x);\n float a = hash(i);\n float b = hash(i + vec2(1.0, 0.0));\n float c = hash(i + vec2(0.0, 1.0));\n float d = hash(i + vec2(1.0, 1.0));\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;\n }\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n\n float hn = hnoise(newUV.xy * resolution.xy / 100.0);\n vec2 d = vec2(0.,normalize(vec2(0.5,0.5) - newUV.xy).y);\n vec2 uv1 = newUV + d * progress / 5.0 * (1.0 + hn / 2.0);\n vec2 uv2 = newUV - d * (1.0 - progress) / 5.0 * (1.0 + hn / 2.0);\n vec4 t1 = texture2D(texture1,uv1);\n vec4 t2 = texture2D(texture2,uv2);\n gl_FragColor = mix(t1, t2, progress);\n }\n `
  1865. },
  1866. "wave-x": {
  1867. uniforms: {},
  1868. fragment: `\n ${mt}\n uniform sampler2D displacement;\n vec2 mirrored(vec2 v) {\n vec2 m = mod(v,2.);\n return mix(m,2.0 - m, step(1.0 ,m));\n }\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n vec4 noise = texture2D(displacement, mirrored(newUV+time*0.04));\n float prog = (1.0 - progress)*0.8 -0.05 + noise.g * 0.06;\n float intpl = pow(abs(smoothstep(0., 1., (prog*2. - vUv.x + 0.5))), 10.);\n\n vec4 t1 = texture2D( texture2, (newUV - 0.5) * (1.0 - intpl) + 0.5 ) ;\n vec4 t2 = texture2D( texture1, (newUV - 0.5) * intpl + 0.5 );\n gl_FragColor = mix( t1, t2, intpl );\n }\n `
  1869. },
  1870. wind: {
  1871. uniforms: {},
  1872. fragment: `\n ${mt}\n float size = 0.2;\n\n float rand (vec2 co) {\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n void main()\t{\n vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);\n\n float r = rand(vec2(0, newUV.y));\n float m = smoothstep(0.0, -size, newUV.x*(1.0-size) + size*r - ((progress) * (1.0 + size)));\n\n vec2 uv1 = newUV;\n vec2 uv2 = newUV;\n\n vec4 t1 = texture2D(texture1,uv1);\n vec4 t2 = texture2D(texture2,uv2);\n gl_FragColor = mix(t1, t2, m);\n\n }\n `
  1873. }
  1874. },
  1875. ft = "\nattribute vec2 uv;\nattribute vec3 position;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",
  1876. At = t => {
  1877. let e = xt;
  1878. Array.isArray(t) && t.length && (e = {}, Object.keys(xt).forEach((i => {
  1879. t.includes(i) && (e[i] = xt[i])
  1880. })));
  1881. const i = Math.floor(Math.random() * Object.keys(e).length);
  1882. return e[Object.keys(e)[i]]
  1883. };
  1884. class vt {
  1885. constructor(t) {
  1886. const e = "random" === t.shader || Array.isArray(t.shader) ? At(t.shader) : xt[t.shader];
  1887. this.shader = e, this.displacement = t.displacementMap || st, this.scene = new P, this.swiper = t.swiper, this.vertex = e.vertex || ft, this.fragment = e.fragment, this.uniforms = e.uniforms || {}, this.renderer = new F({
  1888. dpr: 2,
  1889. webgl: 2
  1890. }), this.gl = this.renderer.gl, this.width = window.innerWidth, this.height = window.innerHeight, this.renderer.setSize(this.width, this.height), this.gl.clearColor(1, 1, 1, 1), this.opts = t, this.container = this.swiper.el, this.images = [], this.displacementTexture = null, this.container.querySelectorAll(".swiper-gl-image").forEach((t => {
  1891. this.images.push(t.src)
  1892. })), this.width = this.swiper.width, this.height = this.swiper.height, this.container.prepend(this.gl.canvas), this.camera = new J(this.gl, {
  1893. fov: 45
  1894. }), this.camera.perspective({
  1895. aspect: this.gl.canvas.width / this.gl.canvas.height
  1896. }), this.camera.position.set(0, 0, 2), this.time = 0, this.current = 0, this.textures = [], this.init((() => {
  1897. this.addObjects(), this.resize(), this.render()
  1898. }))
  1899. }
  1900. animateUniform(t, e, i) {
  1901. const s = t.value;
  1902. let r, n = null;
  1903. window.cancelAnimationFrame(this.animateUniformFrame);
  1904. const a = e > t.value ? "next" : "prev",
  1905. o = (t, e) => "next" === a && t >= e || "prev" === a && t <= e,
  1906. h = () => {
  1907. if (this.destroyed) return;
  1908. r = (new Date).getTime(), null === n && (n = r);
  1909. const a = Math.max(Math.min((r - n) / this.swiper.params.speed, 1), 0),
  1910. l = .5 - Math.cos(a * Math.PI) / 2;
  1911. let c = s + l * (e - s);
  1912. if (o(c, e) && (c = e), t.value = c, o(c, e)) return cancelAnimationFrame(this.animateUniformFrame), void(i && i());
  1913. this.animateUniformFrame = requestAnimationFrame(h)
  1914. };
  1915. h()
  1916. }
  1917. init(t) {
  1918. const e = [],
  1919. i = this;
  1920. this.images.forEach(((t, s) => {
  1921. const r = new Promise((e => {
  1922. const r = new Image;
  1923. r.crossOrigin = "anonymous";
  1924. const n = new tt(this.gl);
  1925. r.onload = () => {
  1926. n.image = r, i.textures[s] = n, e()
  1927. }, r.src = t
  1928. }));
  1929. e.push(r)
  1930. })), e.push(new Promise((t => {
  1931. const e = new Image;
  1932. e.crossOrigin = "anonymous";
  1933. const s = new tt(this.gl);
  1934. e.onload = () => {
  1935. s.image = e, i.displacementTexture = s, t()
  1936. }, e.src = st
  1937. }))), Promise.all(e).then((() => {
  1938. this.initialized = !0, this.onInit && this.onInit(), t()
  1939. }))
  1940. }
  1941. resize() {
  1942. if (!this.initialized || this.destroyed) return;
  1943. const {
  1944. width: t,
  1945. height: e
  1946. } = this.swiper;
  1947. this.width = t, this.height = e, this.renderer.setSize(t, e);
  1948. const i = this.camera.position.z;
  1949. if (this.camera.perspective({
  1950. aspect: t / e,
  1951. fov: 180 / Math.PI * 2 * Math.atan(1 / (2 * i))
  1952. }), !this.textures[0].image) return;
  1953. const s = this.textures[0].image.height / this.textures[0].image.width;
  1954. let r, n;
  1955. e / t > s ? (r = t / e * s, n = 1) : (r = 1, n = e / t / s), this.material.uniforms.resolution.value.x = t, this.material.uniforms.resolution.value.y = e, this.material.uniforms.resolution.value.z = r, this.material.uniforms.resolution.value.w = n, this.shader.vertex && this.vertexMaterial && (this.vertexMaterial.uniforms.resolution.value.x = t, this.vertexMaterial.uniforms.resolution.value.y = e, this.vertexMaterial.uniforms.resolution.value.z = r, this.vertexMaterial.uniforms.resolution.value.w = n), this.shader.vertex ? (this.nextMesh.scale.set(this.camera.aspect / 2, .5, .5), this.currentMesh.scale.set(this.camera.aspect / 2, .5, .5)) : (this.plane.scale.x = this.camera.aspect, this.plane.scale.y = 1)
  1956. }
  1957. createMaterial() {
  1958. return new A(this.gl, {
  1959. extensions: {
  1960. derivatives: "#extension GL_OES_standard_derivatives : enable"
  1961. },
  1962. uniforms: {
  1963. time: {
  1964. type: "f",
  1965. value: 0
  1966. },
  1967. progress: {
  1968. type: "f",
  1969. value: 0
  1970. },
  1971. intensity: {
  1972. type: "f",
  1973. value: 0
  1974. },
  1975. width: {
  1976. type: "f",
  1977. value: 0
  1978. },
  1979. radius: {
  1980. type: "f",
  1981. value: 0
  1982. },
  1983. size: {
  1984. type: "f",
  1985. value: 0
  1986. },
  1987. texture1: {
  1988. type: "f",
  1989. value: this.textures[0]
  1990. },
  1991. texture2: {
  1992. type: "f",
  1993. value: this.textures[1]
  1994. },
  1995. displacement: {
  1996. type: "f",
  1997. value: this.displacementTexture
  1998. },
  1999. resolution: {
  2000. type: "v4",
  2001. value: new et
  2002. }
  2003. },
  2004. vertex: this.shader.vertex || ft,
  2005. fragment: this.shader.fragment,
  2006. ...this.shader.vertex ? {
  2007. transparent: !0,
  2008. depthWrite: !1
  2009. } : {}
  2010. })
  2011. }
  2012. addObjects() {
  2013. if (this.scene.children.forEach((t => {
  2014. this.scene.removeChild(t)
  2015. })), this.scene.children.forEach((t => {
  2016. this.scene.removeChild(t)
  2017. })), this.material = this.createMaterial(), this.shader.vertex) {
  2018. const t = function(t, e, i) {
  2019. i = i || 0;
  2020. const s = e,
  2021. r = 2 / s,
  2022. n = r * Math.sqrt(3) / 2,
  2023. a = 2 / n,
  2024. o = [],
  2025. h = [],
  2026. l = [],
  2027. c = [],
  2028. u = [],
  2029. g = [],
  2030. m = [];
  2031. let d = 0;
  2032. const x = [];
  2033. let f = 0;
  2034. for (let t = 0; t < a; t += 1) {
  2035. f = t * n, d = t % 2 == 1 ? -r / 2 : 0;
  2036. for (let p = 0; p <= s; p += 1) {
  2037. const s = Math.sign(p * r + d - 1);
  2038. h.push(p * r + d - 1, f - 1, 0), m.push((p * r + d) / 2, f / 2), h.push(p * r + r / 2 + d - 1, n + f - 1, 0), m.push((p * r + r / 2 + d) / 2, (n + f) / 2), h.push(p * r - r / 2 + d - 1, n + f - 1, 0), m.push((p * r - r / 2 + d) / 2, (n + f) / 2);
  2039. let A = ct(p / a, t / a) + Math.random();
  2040. const v = ut(f / 2 + 2 * A / e);
  2041. let M = Math.random();
  2042. o.push(v, ut(v + .1 * i), ut(v + .1 * i)), g.push(M, M, M);
  2043. const w = [p * r + d - 1, f - 1, 0];
  2044. l.push(...w, ...w, ...w);
  2045. const y = [2 * s * lt(-.3, .3), -2 * lt(-.3, .3) * 1.5, -ht(.5)],
  2046. E = [2 * s * lt(.3, .6), -2 * lt(.3, .6) * 1.5, -ht(.5)];
  2047. c.push(...y, ...y, ...y), u.push(...E, ...E, ...E), x.push(0, 0, 1, 0, 1, 0, 1, 0, 0), h.push(p * r + d - 1, f - 1, 0), m.push((p * r + d) / 2, f / 2), h.push(p * r + r + d - 1, f - 1, 0), m.push((p * r + r + d) / 2, f / 2), h.push(p * r + r / 2 + d - 1, n + f - 1, 0), m.push((p * r + r / 2 + d) / 2, (n + f) / 2), A = ct((p + 1) / a, t / a) + Math.random();
  2048. const U = ut(f / 2 + 2 * A / e);
  2049. M = Math.random(), o.push(U, U, ut(U + .1 * i)), g.push(M, M, M);
  2050. const F = [p * r + d - 1, f - 1, 0];
  2051. c.push(...y, ...y, ...y), u.push(...E, ...E, ...E), l.push(...F, ...F, ...F), x.push(0, 0, 1, 0, 1, 0, 1, 0, 0)
  2052. }
  2053. }
  2054. const A = new p(t);
  2055. return A.addAttribute("position", {
  2056. size: 3,
  2057. data: new Float32Array(h)
  2058. }), A.addAttribute("bary", {
  2059. size: 3,
  2060. data: new Float32Array(x)
  2061. }), A.addAttribute("uv", {
  2062. size: 2,
  2063. data: new Float32Array(m)
  2064. }), A.addAttribute("offset", {
  2065. size: 1,
  2066. data: new Float32Array(o)
  2067. }), A.addAttribute("centroid1", {
  2068. size: 3,
  2069. data: new Float32Array(l)
  2070. }), A.addAttribute("control0", {
  2071. size: 3,
  2072. data: new Float32Array(c)
  2073. }), A.addAttribute("control1", {
  2074. size: 3,
  2075. data: new Float32Array(u)
  2076. }), A.addAttribute("random", {
  2077. size: 1,
  2078. data: new Float32Array(g)
  2079. }), A
  2080. }(this.gl, this.shader.detail, this.shader.offsetTop),
  2081. e = this.textures[1];
  2082. this.vertexMaterial = this.createMaterial(), this.vertexMaterial.uniforms.texture1.value = e, this.currentMesh = new q(this.gl, {
  2083. geometry: t,
  2084. program: this.material
  2085. }), this.nextMesh = new q(this.gl, {
  2086. geometry: t,
  2087. program: this.vertexMaterial
  2088. }), this.nextMesh.position.z = -1e-4, this.currentMesh.setParent(this.scene), this.nextMesh.setParent(this.scene)
  2089. } else {
  2090. const t = new it(this.gl, {
  2091. width: 1,
  2092. height: 1,
  2093. widthSegments: 2,
  2094. heightSegments: 2
  2095. });
  2096. this.plane = new q(this.gl, {
  2097. geometry: t,
  2098. program: this.material
  2099. }), this.plane.setParent(this.scene)
  2100. }
  2101. }
  2102. replaceShader(t) {
  2103. let e, i;
  2104. this.shader.vertex ? (e = this.material.uniforms.texture1.value, i = this.vertexMaterial.uniforms.texture1.value) : (e = this.material.uniforms.texture1.value, i = this.material.uniforms.texture2.value);
  2105. const s = "random" === t || Array.isArray(t) ? At(t) : xt[t],
  2106. {
  2107. fragment: r,
  2108. uniforms: n,
  2109. vertex: a
  2110. } = s;
  2111. this.shader = s, this.vertex = a || ft, this.fragment = r || "", this.uniforms = n || {}, this.addObjects(), this.shader.vertex ? (this.material.uniforms.texture1.value = i, this.vertexMaterial.uniforms.texture1.value = i) : (this.material.uniforms.texture1.value = e, this.material.uniforms.texture2.value = i, this.material.uniforms.progress.value = 1), this.resize(), this.swiper.params.gl.shader = t
  2112. }
  2113. replaceRandomShader() {
  2114. const t = At(this.opts.shader),
  2115. {
  2116. fragment: e,
  2117. uniforms: i,
  2118. vertex: s
  2119. } = t;
  2120. this.shader = t, this.fragment = e || "", this.uniforms = i || {}, this.vertex = s || ft, this.addObjects(), this.resize()
  2121. }
  2122. setProgress(t, e, i, s) {
  2123. if (this.destroyed) return;
  2124. if (!this.initialized) return void(this.onInit = () => {
  2125. requestAnimationFrame((() => {
  2126. this.setProgress(t, e, i, s)
  2127. }))
  2128. });
  2129. const r = this.textures[e],
  2130. n = this.textures[t];
  2131. this.material.uniforms.texture1.value = n, this.shader.vertex ? this.vertexMaterial.uniforms.texture1.value = r : this.material.uniforms.texture2.value = r, s ? (0 === i && 0 === this.material.uniforms.progress.value && (this.material.uniforms.progress.value = 1), 1 === i && 1 === this.material.uniforms.progress.value && (this.material.uniforms.progress.value = 0), this.animateUniform(this.material.uniforms.progress, i, (() => {
  2132. ("random" === this.swiper.params.gl.shader || Array.isArray(this.swiper.params.gl.shader)) && (this.replaceRandomShader(), this.material.uniforms.texture1.value = n, this.material.uniforms.texture2.value = r, this.material.uniforms.progress.value = i), 1 === i && (this.material.uniforms.texture1.value = r), this.material.uniforms.progress.value = 0
  2133. }))) : this.material.uniforms.progress.value = Math.abs(i)
  2134. }
  2135. render() {
  2136. this.swiper.destroyed || this.destroyed || (this.time += .05, this.material.uniforms.time.value = this.time, Object.keys(this.uniforms).forEach((t => {
  2137. this.material.uniforms[t].value = this.uniforms[t].value
  2138. })), requestAnimationFrame(this.render.bind(this)), this.renderer.render({
  2139. scene: this.scene,
  2140. camera: this.camera
  2141. }))
  2142. }
  2143. destroy() {
  2144. this.initialized = !1, this.destroyed = !0, this.gl && this.gl.canvas && this.container.removeChild(this.gl.canvas)
  2145. }
  2146. }
  2147. return function({
  2148. swiper: t,
  2149. on: e,
  2150. extendParams: i
  2151. }) {
  2152. t.gl = null;
  2153. let s = !1;
  2154. i({
  2155. gl: {
  2156. shader: "random",
  2157. displacementMap: void 0
  2158. }
  2159. });
  2160. const r = () => {
  2161. t.gl = new vt({
  2162. debug: !0,
  2163. swiper: t,
  2164. shader: t.params.gl.shader
  2165. })
  2166. };
  2167. let n, a;
  2168. e("beforeInit", (() => {
  2169. if ("gl" !== t.params.effect) return;
  2170. if (! function() {
  2171. try {
  2172. const t = document.createElement("canvas");
  2173. return !!window.WebGLRenderingContext && (t.getContext("webgl") || t.getContext("experimental-webgl"))
  2174. } catch (t) {
  2175. return !1
  2176. }
  2177. }()) return void(s = !0);
  2178. t.classNames.push(`${t.params.containerModifierClass}gl`);
  2179. const e = {
  2180. watchSlidesProgress: !0
  2181. };
  2182. Object.assign(t.params, e), Object.assign(t.originalParams, e)
  2183. })), e("init", (() => {
  2184. "gl" !== t.params.effect || s || t.gl || r()
  2185. })), e("resize", (() => {
  2186. "gl" !== t.params.effect || s || t.gl.resize()
  2187. })), e("setTranslate", (() => {
  2188. if ("gl" !== t.params.effect || s) return;
  2189. let e, i, o;
  2190. t.gl || r(), t.slides.forEach(((s, r) => {
  2191. const n = s.progress;
  2192. (n > 0 && n < 1 || 0 === n && t.progress < a) && (e = r, i = r + 1, o = n), (n < 0 && n > -1 || 0 === n && t.progress > a) && (e = r - 1, i = r, o = 1 + n)
  2193. })), a = t.progress || 0, void 0 === e && void 0 === i || t.gl.setProgress(e, i, o, n)
  2194. })), e("setTransition", ((e, i) => {
  2195. "gl" !== t.params.effect || s || (n = i > 0 && !t.params.cssMode)
  2196. })), e("destroy", (() => {
  2197. "gl" !== t.params.effect || s || t.gl && (t.gl.destroy(), t.gl = null)
  2198. }))
  2199. }
  2200. }));
  2201. //# sourceMappingURL=swiper-gl.min.js.map
Add Comment
Please, Sign In to add comment