diff --git a/tools/mc-classic/assets/js/app.js b/tools/mc-classic/assets/js/app.js index 1db6522..4b812a0 100644 --- a/tools/mc-classic/assets/js/app.js +++ b/tools/mc-classic/assets/js/app.js @@ -1,81 +1,91 @@ -!function(funcsArray) { - var allFuncs = {}; +!(function (funcsArray) { + var allFuncs = {}; - function getterFunc(index) { - if (allFuncs[index]) - return allFuncs[index].exports; - - var newFunc = allFuncs[index] = { - i: index, - l: false, - exports: {} - }; + function getterFunc(index) { + if (allFuncs[index]) return allFuncs[index].exports; - funcsArray[index].call(newFunc.exports, newFunc, newFunc.exports, getterFunc); - newFunc.l = true; + var newFunc = (allFuncs[index] = { + i: index, + l: false, + exports: {}, + }); - return newFunc.exports; - } + funcsArray[index].call( + newFunc.exports, + newFunc, + newFunc.exports, + getterFunc + ); + newFunc.l = true; - getterFunc.m = funcsArray; - getterFunc.c = allFuncs; + return newFunc.exports; + } - getterFunc.d = function(e, t, n) { - getterFunc.o(e, t) || Object.defineProperty(e, t, { - enumerable: true, - get: n - }) - } - - getterFunc.r = function(e) { - "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { - value: "Module" - }), - Object.defineProperty(e, "__esModule", { - value: true - }) - } - - getterFunc.t = function(e, t) { - if (1 & t && (e = getterFunc(e)), - 8 & t) + getterFunc.m = funcsArray; + getterFunc.c = allFuncs; + + getterFunc.d = function (e, t, n) { + getterFunc.o(e, t) || + Object.defineProperty(e, t, { + enumerable: true, + get: n, + }); + }; + + getterFunc.r = function (e) { + "undefined" != typeof Symbol && + Symbol.toStringTag && + Object.defineProperty(e, Symbol.toStringTag, { + value: "Module", + }), + Object.defineProperty(e, "__esModule", { + value: true, + }); + }; + + getterFunc.t = function (e, t) { + if ((1 & t && (e = getterFunc(e)), 8 & t)) return e; + if (4 & t && "object" == typeof e && e && e.__esModule) return e; + var n = Object.create(null); + if ( + (getterFunc.r(n), + Object.defineProperty(n, "default", { + enumerable: true, + value: e, + }), + 2 & t && "string" != typeof e) + ) + for (var r in e) + getterFunc.d( + n, + r, + function (t) { + return e[t]; + }.bind(null, r) + ); + return n; + }; + + getterFunc.n = function (e) { + var t = + e && e.__esModule + ? function () { + return e.default; + } + : function () { return e; - if (4 & t && "object" == typeof e && e && e.__esModule) - return e; - var n = Object.create(null); - if (getterFunc.r(n), - Object.defineProperty(n, "default", { - enumerable: true, - value: e - }), - 2 & t && "string" != typeof e) - for (var r in e) - getterFunc.d(n, r, function(t) { - return e[t] - } - .bind(null, r)); - return n - } - - getterFunc.n = function(e) { - var t = e && e.__esModule ? function() { - return e.default - } - : function() { - return e - } - ; - return getterFunc.d(t, "a", t), - t - } - - getterFunc.o = function(e, t) { - return Object.prototype.hasOwnProperty.call(e, t) - } - - getterFunc.p = "/"; - getterFunc(getterFunc.s = 228); -} ([function(exp, t, getterFunc) { + }; + return getterFunc.d(t, "a", t), t; + }; + + getterFunc.o = function (e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + }; + + getterFunc.p = "/"; + getterFunc((getterFunc.s = 228)); +})([ + function (exp, t, getterFunc) { var windowObject = getterFunc(5); var r = getterFunc(14); var o = getterFunc(23); @@ -83,25 +93,34 @@ var s = getterFunc(34); var c = function e(t, i, c) { - var u; - var l; - var h; - var f; - var d = t & e.F; - var p = t & e.G; - var m = t & e.P; - var g = t & e.B; - var _ = p ? windowObject : t & e.S ? windowObject[i] || (windowObject[i] = {}) : (windowObject[i] || {}).prototype; - var v = p ? r : r[i] || (r[i] = {}); - var y = v.prototype || (v.prototype = {}); - - for (u in p && (c = i), c) { - h = ((l = !d && _ && void 0 !== _[u]) ? _ : c)[u]; - f = g && l ? s(h, windowObject) : m && "function" == typeof h ? s(Function.call, h) : h; - _ && a(_, u, h, t & e.U); - v[u] != h && o(v, u, f); - m && y[u] != h && (y[u] = h); - } + var u; + var l; + var h; + var f; + var d = t & e.F; + var p = t & e.G; + var m = t & e.P; + var g = t & e.B; + var _ = p + ? windowObject + : t & e.S + ? windowObject[i] || (windowObject[i] = {}) + : (windowObject[i] || {}).prototype; + var v = p ? r : r[i] || (r[i] = {}); + var y = v.prototype || (v.prototype = {}); + + for (u in (p && (c = i), c)) { + h = ((l = !d && _ && void 0 !== _[u]) ? _ : c)[u]; + f = + g && l + ? s(h, windowObject) + : m && "function" == typeof h + ? s(Function.call, h) + : h; + _ && a(_, u, h, t & e.U); + v[u] != h && o(v, u, f); + m && y[u] != h && (y[u] = h); + } }; windowObject.core = r; @@ -114,598 +133,707 @@ c.U = 64; c.R = 128; exp.exports = c; -} -, function(e, t) { - "function" == typeof Object.create ? e.exports = function(e, t) { - e.super_ = t, - e.prototype = Object.create(t.prototype, { - constructor: { + }, + function (e, t) { + "function" == typeof Object.create + ? (e.exports = function (e, t) { + (e.super_ = t), + (e.prototype = Object.create(t.prototype, { + constructor: { value: e, enumerable: false, writable: true, - configurable: true - } + configurable: true, + }, + })); }) - } - : e.exports = function(e, t) { - e.super_ = t; - var i = function() {}; - i.prototype = t.prototype, - e.prototype = new i, - e.prototype.constructor = e - } -} -, function(e, t, i) { - var n = i(9) - , r = n.Buffer; + : (e.exports = function (e, t) { + e.super_ = t; + var i = function () {}; + (i.prototype = t.prototype), + (e.prototype = new i()), + (e.prototype.constructor = e); + }); + }, + function (e, t, i) { + var n = i(9), + r = n.Buffer; function o(e, t) { - for (var i in e) - t[i] = e[i] + for (var i in e) t[i] = e[i]; } function a(e, t, i) { - return r(e, t, i) + return r(e, t, i); } - r.from && r.alloc && r.allocUnsafe && r.allocUnsafeSlow ? e.exports = n : (o(n, t), - t.Buffer = a), - o(r, a), - a.from = function(e, t, i) { + r.from && r.alloc && r.allocUnsafe && r.allocUnsafeSlow + ? (e.exports = n) + : (o(n, t), (t.Buffer = a)), + o(r, a), + (a.from = function (e, t, i) { if ("number" == typeof e) - throw new TypeError("Argument must not be a number"); - return r(e, t, i) - } - , - a.alloc = function(e, t, i) { + throw new TypeError("Argument must not be a number"); + return r(e, t, i); + }), + (a.alloc = function (e, t, i) { if ("number" != typeof e) - throw new TypeError("Argument must be a number"); + throw new TypeError("Argument must be a number"); var n = r(e); - return void 0 !== t ? "string" == typeof i ? n.fill(t, i) : n.fill(t) : n.fill(0), - n - } - , - a.allocUnsafe = function(e) { + return ( + void 0 !== t + ? "string" == typeof i + ? n.fill(t, i) + : n.fill(t) + : n.fill(0), + n + ); + }), + (a.allocUnsafe = function (e) { if ("number" != typeof e) - throw new TypeError("Argument must be a number"); - return r(e) - } - , - a.allocUnsafeSlow = function(e) { + throw new TypeError("Argument must be a number"); + return r(e); + }), + (a.allocUnsafeSlow = function (e) { if ("number" != typeof e) - throw new TypeError("Argument must be a number"); - return n.SlowBuffer(e) - } -} -, function(exp, t) { - exp.exports = function(e) { - try { - return !!e() - } catch (error) { - return true - } - } -} -, function(exp, t, i) { + throw new TypeError("Argument must be a number"); + return n.SlowBuffer(e); + }); + }, + function (exp, t) { + exp.exports = function (e) { + try { + return !!e(); + } catch (error) { + return true; + } + }; + }, + function (exp, t, i) { var n = i(6); - exp.exports = function(e) { - if (!n(e)) - throw TypeError(e + " is not an object!"); - return e - } -} -, function(exp, t) { // getWindow i = 5 - var _window = exp.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(); - - if(typeof __g == "number") - __g = _window; -} -, function(exp, t) { + exp.exports = function (e) { + if (!n(e)) throw TypeError(e + " is not an object!"); + return e; + }; + }, + function (exp, t) { + // getWindow i = 5 + var _window = (exp.exports = + "undefined" != typeof window && window.Math == Math + ? window + : "undefined" != typeof self && self.Math == Math + ? self + : Function("return this")()); + + if (typeof __g == "number") __g = _window; + }, + function (exp, t) { function i(e) { - return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (i = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - exp.exports = function(e) { - return "object" === i(e) ? null !== e : "function" == typeof e - } -} -, function(e, t, i) { + exp.exports = function (e) { + return "object" === i(e) ? null !== e : "function" == typeof e; + }; + }, + function (e, t, i) { "use strict"; function n(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n.enumerable = n.enumerable || false, - n.configurable = true, - "value"in n && (n.writable = true), - Object.defineProperty(e, n.key, n) - } + for (var i = 0; i < t.length; i++) { + var n = t[i]; + (n.enumerable = n.enumerable || false), + (n.configurable = true), + "value" in n && (n.writable = true), + Object.defineProperty(e, n.key, n); + } } i.r(t); - var r = function() { - function e() { - return function(e, t) { - if (!(e instanceof t)) - throw new TypeError("Cannot call a class as a function") - }(this, e), - e.instance || (e.instance = this), - this.changedBlocks = {}, - this.worldSeed = null, - this.worldSize = 128, - this.timeout = null, - this.version = 0, - this.loadDataIfExists(), - e.instance - } - var t, i, r; - return t = e, - r = [{ + var r = (function () { + function e() { + return ( + (function (e, t) { + if (!(e instanceof t)) + throw new TypeError("Cannot call a class as a function"); + })(this, e), + e.instance || (e.instance = this), + (this.changedBlocks = {}), + (this.worldSeed = null), + (this.worldSize = 128), + (this.timeout = null), + (this.version = 0), + this.loadDataIfExists(), + e.instance + ); + } + var t, i, r; + return ( + (t = e), + (r = [ + { key: "getInstance", - value: function() { - return void 0 === e.instance && (e.instance = new e), - e.instance - } - }], - (i = [{ + value: function () { + return ( + void 0 === e.instance && (e.instance = new e()), e.instance + ); + }, + }, + ]), + (i = [ + { key: "loadDataIfExists", - value: function() { - var e = localStorage.getItem("savedGame"); - if (e) { - var t = JSON.parse(e); - this.worldSeed = t.worldSeed, - this.changedBlocks = t.changedBlocks, - this.worldSize = t.worldSize, - this.version = void 0 !== t.version ? t.version : 0 - } - 0 === this.version && this.clearData() - } - }, { + value: function () { + var e = localStorage.getItem("savedGame"); + if (e) { + var t = JSON.parse(e); + (this.worldSeed = t.worldSeed), + (this.changedBlocks = t.changedBlocks), + (this.worldSize = t.worldSize), + (this.version = void 0 !== t.version ? t.version : 0); + } + 0 === this.version && this.clearData(); + }, + }, + { key: "gameSaved", - value: function() { - return !!this.worldSeed - } - }, { + value: function () { + return !!this.worldSeed; + }, + }, + { key: "updateData", - value: function() { - var e = JSON.stringify({ - worldSeed: this.worldSeed, - changedBlocks: this.changedBlocks, - worldSize: this.worldSize, - version: 1 - }); - localStorage.setItem("savedGame", e) - } - }, { + value: function () { + var e = JSON.stringify({ + worldSeed: this.worldSeed, + changedBlocks: this.changedBlocks, + worldSize: this.worldSize, + version: 1, + }); + localStorage.setItem("savedGame", e); + }, + }, + { key: "clearData", - value: function() { - this.worldSeed = null, - this.changedBlocks = {}, - this.updateData() - } - }, { + value: function () { + (this.worldSeed = null), + (this.changedBlocks = {}), + this.updateData(); + }, + }, + { key: "setWorldSeed", - value: function(e) { - this.worldSeed = e, - this.updateData() - } - }, { + value: function (e) { + (this.worldSeed = e), this.updateData(); + }, + }, + { key: "getWorldSeed", - value: function() { - return this.worldSeed - } - }, { + value: function () { + return this.worldSeed; + }, + }, + { key: "setWorldSize", - value: function(e) { - this.worldSize = e, - this.updateData() - } - }, { + value: function (e) { + (this.worldSize = e), this.updateData(); + }, + }, + { key: "getWorldSize", - value: function() { - return this.worldSize - } - }, { + value: function () { + return this.worldSize; + }, + }, + { key: "addBlockChange", - value: function(e) { - var t = this; - this.changedBlocks["p" + e.p[0] + "_" + e.p[1] + "_" + e.p[2]] = { - a: e.add ? 1 : 0, - bt: e.bt - }, - null === this.timeout && (this.timeout = setTimeout(function() { + value: function (e) { + var t = this; + (this.changedBlocks["p" + e.p[0] + "_" + e.p[1] + "_" + e.p[2]] = + { + a: e.add ? 1 : 0, + bt: e.bt, + }), + null === this.timeout && + (this.timeout = setTimeout(function () { Date.now(); - t.updateData(), - t.timeout = null - }, 3e3)) - } - }, { + t.updateData(), (t.timeout = null); + }, 3e3)); + }, + }, + { key: "getChangedBlocks", - value: function() { - var e = []; - for (var t in this.changedBlocks) { - var i = t.substr(1).split("_").map(function(e) { - return parseInt(e) - }); - e.push({ - p: i, - add: !!this.changedBlocks[t].a, - bt: this.changedBlocks[t].bt - }) - } - return e - } - }]) && n(t.prototype, i), + value: function () { + var e = []; + for (var t in this.changedBlocks) { + var i = t + .substr(1) + .split("_") + .map(function (e) { + return parseInt(e); + }); + e.push({ + p: i, + add: !!this.changedBlocks[t].a, + bt: this.changedBlocks[t].bt, + }); + } + return e; + }, + }, + ]) && n(t.prototype, i), r && n(t, r), e - }(); - t.default = r -} -, function(e, t, i) { - var n = i(96)("wks") - , r = i(46) - , o = i(5).Symbol - , a = "function" == typeof o; - (e.exports = function(e) { - return n[e] || (n[e] = a && o[e] || (a ? o : r)("Symbol." + e)) - } - ).store = n -} -, function(e, t, i) { + ); + })(); + t.default = r; + }, + function (e, t, i) { + var n = i(96)("wks"), + r = i(46), + o = i(5).Symbol, + a = "function" == typeof o; + (e.exports = function (e) { + return n[e] || (n[e] = (a && o[e]) || (a ? o : r)("Symbol." + e)); + }).store = n; + }, + function (e, t, i) { "use strict"; - (function(e) { - /*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ - var n = i(398) - , r = i(399) - , o = i(168); - function a() { - return c.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823 + (function (e) { + /*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + var n = i(398), + r = i(399), + o = i(168); + function a() { + return c.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823; + } + function s(e, t) { + if (a() < t) throw new RangeError("Invalid typed array length"); + return ( + c.TYPED_ARRAY_SUPPORT + ? ((e = new Uint8Array(t)).__proto__ = c.prototype) + : (null === e && (e = new c(t)), (e.length = t)), + e + ); + } + function c(e, t, i) { + if (!(c.TYPED_ARRAY_SUPPORT || this instanceof c)) + return new c(e, t, i); + if ("number" == typeof e) { + if ("string" == typeof t) + throw new Error( + "If encoding is specified then the first argument must be a string" + ); + return h(this, e); } - function s(e, t) { - if (a() < t) - throw new RangeError("Invalid typed array length"); - return c.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = c.prototype : (null === e && (e = new c(t)), - e.length = t), - e + return u(this, e, t, i); + } + function u(e, t, i, n) { + if ("number" == typeof t) + throw new TypeError('"value" argument must not be a number'); + return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer + ? (function (e, t, i, n) { + if ((t.byteLength, i < 0 || t.byteLength < i)) + throw new RangeError("'offset' is out of bounds"); + if (t.byteLength < i + (n || 0)) + throw new RangeError("'length' is out of bounds"); + t = + void 0 === i && void 0 === n + ? new Uint8Array(t) + : void 0 === n + ? new Uint8Array(t, i) + : new Uint8Array(t, i, n); + c.TYPED_ARRAY_SUPPORT + ? ((e = t).__proto__ = c.prototype) + : (e = f(e, t)); + return e; + })(e, t, i, n) + : "string" == typeof t + ? (function (e, t, i) { + ("string" == typeof i && "" !== i) || (i = "utf8"); + if (!c.isEncoding(i)) + throw new TypeError( + '"encoding" must be a valid string encoding' + ); + var n = 0 | p(t, i), + r = (e = s(e, n)).write(t, i); + r !== n && (e = e.slice(0, r)); + return e; + })(e, t, i) + : (function (e, t) { + if (c.isBuffer(t)) { + var i = 0 | d(t.length); + return 0 === (e = s(e, i)).length ? e : (t.copy(e, 0, 0, i), e); + } + if (t) { + if ( + ("undefined" != typeof ArrayBuffer && + t.buffer instanceof ArrayBuffer) || + "length" in t + ) + return "number" != typeof t.length || (n = t.length) != n + ? s(e, 0) + : f(e, t); + if ("Buffer" === t.type && o(t.data)) return f(e, t.data); + } + var n; + throw new TypeError( + "First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object." + ); + })(e, t); + } + function l(e) { + if ("number" != typeof e) + throw new TypeError('"size" argument must be a number'); + if (e < 0) throw new RangeError('"size" argument must not be negative'); + } + function h(e, t) { + if ((l(t), (e = s(e, t < 0 ? 0 : 0 | d(t))), !c.TYPED_ARRAY_SUPPORT)) + for (var i = 0; i < t; ++i) e[i] = 0; + return e; + } + function f(e, t) { + var i = t.length < 0 ? 0 : 0 | d(t.length); + e = s(e, i); + for (var n = 0; n < i; n += 1) e[n] = 255 & t[n]; + return e; + } + function d(e) { + if (e >= a()) + throw new RangeError( + "Attempt to allocate Buffer larger than maximum size: 0x" + + a().toString(16) + + " bytes" + ); + return 0 | e; + } + function p(e, t) { + if (c.isBuffer(e)) return e.length; + if ( + "undefined" != typeof ArrayBuffer && + "function" == typeof ArrayBuffer.isView && + (ArrayBuffer.isView(e) || e instanceof ArrayBuffer) + ) + return e.byteLength; + "string" != typeof e && (e = "" + e); + var i = e.length; + if (0 === i) return 0; + for (var n = false; ; ) + switch (t) { + case "ascii": + case "latin1": + case "binary": + return i; + case "utf8": + case "utf-8": + case void 0: + return V(e).length; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return 2 * i; + case "hex": + return i >>> 1; + case "base64": + return G(e).length; + default: + if (n) return V(e).length; + (t = ("" + t).toLowerCase()), (n = true); + } + } + function m(e, t, i) { + var n = e[t]; + (e[t] = e[i]), (e[i] = n); + } + function g(e, t, i, n, r) { + if (0 === e.length) return -1; + if ( + ("string" == typeof i + ? ((n = i), (i = 0)) + : i > 2147483647 + ? (i = 2147483647) + : i < -2147483648 && (i = -2147483648), + (i = +i), + isNaN(i) && (i = r ? 0 : e.length - 1), + i < 0 && (i = e.length + i), + i >= e.length) + ) { + if (r) return -1; + i = e.length - 1; + } else if (i < 0) { + if (!r) return -1; + i = 0; } - function c(e, t, i) { - if (!(c.TYPED_ARRAY_SUPPORT || this instanceof c)) - return new c(e,t,i); - if ("number" == typeof e) { - if ("string" == typeof t) - throw new Error("If encoding is specified then the first argument must be a string"); - return h(this, e) + if (("string" == typeof t && (t = c.from(t, n)), c.isBuffer(t))) + return 0 === t.length ? -1 : _(e, t, i, n, r); + if ("number" == typeof t) + return ( + (t &= 255), + c.TYPED_ARRAY_SUPPORT && + "function" == typeof Uint8Array.prototype.indexOf + ? r + ? Uint8Array.prototype.indexOf.call(e, t, i) + : Uint8Array.prototype.lastIndexOf.call(e, t, i) + : _(e, [t], i, n, r) + ); + throw new TypeError("val must be string, number or Buffer"); + } + function _(e, t, i, n, r) { + var o, + a = 1, + s = e.length, + c = t.length; + if ( + void 0 !== n && + ("ucs2" === (n = String(n).toLowerCase()) || + "ucs-2" === n || + "utf16le" === n || + "utf-16le" === n) + ) { + if (e.length < 2 || t.length < 2) return -1; + (a = 2), (s /= 2), (c /= 2), (i /= 2); + } + function u(e, t) { + return 1 === a ? e[t] : e.readUInt16BE(t * a); + } + if (r) { + var l = -1; + for (o = i; o < s; o++) + if (u(e, o) === u(t, -1 === l ? 0 : o - l)) { + if ((-1 === l && (l = o), o - l + 1 === c)) return l * a; + } else -1 !== l && (o -= o - l), (l = -1); + } else + for (i + c > s && (i = s - c), o = i; o >= 0; o--) { + for (var h = true, f = 0; f < c; f++) + if (u(e, o + f) !== u(t, f)) { + h = false; + break; + } + if (h) return o; + } + return -1; + } + function v(e, t, i, n) { + i = Number(i) || 0; + var r = e.length - i; + n ? (n = Number(n)) > r && (n = r) : (n = r); + var o = t.length; + if (o % 2 != 0) throw new TypeError("Invalid hex string"); + n > o / 2 && (n = o / 2); + for (var a = 0; a < n; ++a) { + var s = parseInt(t.substr(2 * a, 2), 16); + if (isNaN(s)) return a; + e[i + a] = s; + } + return a; + } + function y(e, t, i, n) { + return z(V(t, e.length - i), e, i, n); + } + function b(e, t, i, n) { + return z( + (function (e) { + for (var t = [], i = 0; i < e.length; ++i) + t.push(255 & e.charCodeAt(i)); + return t; + })(t), + e, + i, + n + ); + } + function E(e, t, i, n) { + return b(e, t, i, n); + } + function T(e, t, i, n) { + return z(G(t), e, i, n); + } + function A(e, t, i, n) { + return z( + (function (e, t) { + for ( + var i, n, r, o = [], a = 0; + a < e.length && !((t -= 2) < 0); + ++a + ) + (i = e.charCodeAt(a)), + (n = i >> 8), + (r = i % 256), + o.push(r), + o.push(n); + return o; + })(t, e.length - i), + e, + i, + n + ); + } + function x(e, t, i) { + return 0 === t && i === e.length + ? n.fromByteArray(e) + : n.fromByteArray(e.slice(t, i)); + } + function S(e, t, i) { + i = Math.min(e.length, i); + for (var n = [], r = t; r < i; ) { + var o, + a, + s, + c, + u = e[r], + l = null, + h = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1; + if (r + h <= i) + switch (h) { + case 1: + u < 128 && (l = u); + break; + case 2: + 128 == (192 & (o = e[r + 1])) && + (c = ((31 & u) << 6) | (63 & o)) > 127 && + (l = c); + break; + case 3: + (o = e[r + 1]), + (a = e[r + 2]), + 128 == (192 & o) && + 128 == (192 & a) && + (c = ((15 & u) << 12) | ((63 & o) << 6) | (63 & a)) > + 2047 && + (c < 55296 || c > 57343) && + (l = c); + break; + case 4: + (o = e[r + 1]), + (a = e[r + 2]), + (s = e[r + 3]), + 128 == (192 & o) && + 128 == (192 & a) && + 128 == (192 & s) && + (c = + ((15 & u) << 18) | + ((63 & o) << 12) | + ((63 & a) << 6) | + (63 & s)) > 65535 && + c < 1114112 && + (l = c); } - return u(this, e, t, i) + null === l + ? ((l = 65533), (h = 1)) + : l > 65535 && + ((l -= 65536), + n.push(((l >>> 10) & 1023) | 55296), + (l = 56320 | (1023 & l))), + n.push(l), + (r += h); } - function u(e, t, i, n) { - if ("number" == typeof t) - throw new TypeError('"value" argument must not be a number'); - return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? function(e, t, i, n) { - if (t.byteLength, - i < 0 || t.byteLength < i) - throw new RangeError("'offset' is out of bounds"); - if (t.byteLength < i + (n || 0)) - throw new RangeError("'length' is out of bounds"); - t = void 0 === i && void 0 === n ? new Uint8Array(t) : void 0 === n ? new Uint8Array(t,i) : new Uint8Array(t,i,n); - c.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = c.prototype : e = f(e, t); - return e - }(e, t, i, n) : "string" == typeof t ? function(e, t, i) { - "string" == typeof i && "" !== i || (i = "utf8"); - if (!c.isEncoding(i)) - throw new TypeError('"encoding" must be a valid string encoding'); - var n = 0 | p(t, i) - , r = (e = s(e, n)).write(t, i); - r !== n && (e = e.slice(0, r)); - return e - }(e, t, i) : function(e, t) { - if (c.isBuffer(t)) { - var i = 0 | d(t.length); - return 0 === (e = s(e, i)).length ? e : (t.copy(e, 0, 0, i), - e) + return (function (e) { + var t = e.length; + if (t <= C) return String.fromCharCode.apply(String, e); + var i = "", + n = 0; + for (; n < t; ) + i += String.fromCharCode.apply(String, e.slice(n, (n += C))); + return i; + })(n); + } + (t.Buffer = c), + (t.SlowBuffer = function (e) { + +e != e && (e = 0); + return c.alloc(+e); + }), + (t.INSPECT_MAX_BYTES = 50), + (c.TYPED_ARRAY_SUPPORT = + void 0 !== e.TYPED_ARRAY_SUPPORT + ? e.TYPED_ARRAY_SUPPORT + : (function () { + try { + var e = new Uint8Array(1); + return ( + (e.__proto__ = { + __proto__: Uint8Array.prototype, + foo: function () { + return 42; + }, + }), + 42 === e.foo() && + "function" == typeof e.subarray && + 0 === e.subarray(1, 1).byteLength + ); + } catch (e) { + return false; } - if (t) { - if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length"in t) - return "number" != typeof t.length || (n = t.length) != n ? s(e, 0) : f(e, t); - if ("Buffer" === t.type && o(t.data)) - return f(e, t.data) - } - var n; - throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.") - }(e, t) - } - function l(e) { - if ("number" != typeof e) - throw new TypeError('"size" argument must be a number'); - if (e < 0) - throw new RangeError('"size" argument must not be negative') - } - function h(e, t) { - if (l(t), - e = s(e, t < 0 ? 0 : 0 | d(t)), - !c.TYPED_ARRAY_SUPPORT) - for (var i = 0; i < t; ++i) - e[i] = 0; - return e - } - function f(e, t) { - var i = t.length < 0 ? 0 : 0 | d(t.length); - e = s(e, i); - for (var n = 0; n < i; n += 1) - e[n] = 255 & t[n]; - return e - } - function d(e) { - if (e >= a()) - throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + a().toString(16) + " bytes"); - return 0 | e - } - function p(e, t) { - if (c.isBuffer(e)) - return e.length; - if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer)) - return e.byteLength; - "string" != typeof e && (e = "" + e); - var i = e.length; - if (0 === i) - return 0; - for (var n = false; ; ) - switch (t) { - case "ascii": - case "latin1": - case "binary": - return i; - case "utf8": - case "utf-8": - case void 0: - return V(e).length; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return 2 * i; - case "hex": - return i >>> 1; - case "base64": - return G(e).length; - default: - if (n) - return V(e).length; - t = ("" + t).toLowerCase(), - n = true - } - } - function m(e, t, i) { - var n = e[t]; - e[t] = e[i], - e[i] = n - } - function g(e, t, i, n, r) { - if (0 === e.length) - return -1; - if ("string" == typeof i ? (n = i, - i = 0) : i > 2147483647 ? i = 2147483647 : i < -2147483648 && (i = -2147483648), - i = +i, - isNaN(i) && (i = r ? 0 : e.length - 1), - i < 0 && (i = e.length + i), - i >= e.length) { - if (r) - return -1; - i = e.length - 1 - } else if (i < 0) { - if (!r) - return -1; - i = 0 + })()), + (t.kMaxLength = a()), + (c.poolSize = 8192), + (c._augment = function (e) { + return (e.__proto__ = c.prototype), e; + }), + (c.from = function (e, t, i) { + return u(null, e, t, i); + }), + c.TYPED_ARRAY_SUPPORT && + ((c.prototype.__proto__ = Uint8Array.prototype), + (c.__proto__ = Uint8Array), + "undefined" != typeof Symbol && + Symbol.species && + c[Symbol.species] === c && + Object.defineProperty(c, Symbol.species, { + value: null, + configurable: true, + })), + (c.alloc = function (e, t, i) { + return (function (e, t, i, n) { + return ( + l(t), + t <= 0 + ? s(e, t) + : void 0 !== i + ? "string" == typeof n + ? s(e, t).fill(i, n) + : s(e, t).fill(i) + : s(e, t) + ); + })(null, e, t, i); + }), + (c.allocUnsafe = function (e) { + return h(null, e); + }), + (c.allocUnsafeSlow = function (e) { + return h(null, e); + }), + (c.isBuffer = function (e) { + return !(null == e || !e._isBuffer); + }), + (c.compare = function (e, t) { + if (!c.isBuffer(e) || !c.isBuffer(t)) + throw new TypeError("Arguments must be Buffers"); + if (e === t) return 0; + for ( + var i = e.length, n = t.length, r = 0, o = Math.min(i, n); + r < o; + ++r + ) + if (e[r] !== t[r]) { + (i = e[r]), (n = t[r]); + break; } - if ("string" == typeof t && (t = c.from(t, n)), - c.isBuffer(t)) - return 0 === t.length ? -1 : _(e, t, i, n, r); - if ("number" == typeof t) - return t &= 255, - c.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? r ? Uint8Array.prototype.indexOf.call(e, t, i) : Uint8Array.prototype.lastIndexOf.call(e, t, i) : _(e, [t], i, n, r); - throw new TypeError("val must be string, number or Buffer") - } - function _(e, t, i, n, r) { - var o, a = 1, s = e.length, c = t.length; - if (void 0 !== n && ("ucs2" === (n = String(n).toLowerCase()) || "ucs-2" === n || "utf16le" === n || "utf-16le" === n)) { - if (e.length < 2 || t.length < 2) - return -1; - a = 2, - s /= 2, - c /= 2, - i /= 2 - } - function u(e, t) { - return 1 === a ? e[t] : e.readUInt16BE(t * a) - } - if (r) { - var l = -1; - for (o = i; o < s; o++) - if (u(e, o) === u(t, -1 === l ? 0 : o - l)) { - if (-1 === l && (l = o), - o - l + 1 === c) - return l * a - } else - -1 !== l && (o -= o - l), - l = -1 - } else - for (i + c > s && (i = s - c), - o = i; o >= 0; o--) { - for (var h = true, f = 0; f < c; f++) - if (u(e, o + f) !== u(t, f)) { - h = false; - break - } - if (h) - return o - } - return -1 - } - function v(e, t, i, n) { - i = Number(i) || 0; - var r = e.length - i; - n ? (n = Number(n)) > r && (n = r) : n = r; - var o = t.length; - if (o % 2 != 0) - throw new TypeError("Invalid hex string"); - n > o / 2 && (n = o / 2); - for (var a = 0; a < n; ++a) { - var s = parseInt(t.substr(2 * a, 2), 16); - if (isNaN(s)) - return a; - e[i + a] = s - } - return a - } - function y(e, t, i, n) { - return z(V(t, e.length - i), e, i, n) - } - function b(e, t, i, n) { - return z(function(e) { - for (var t = [], i = 0; i < e.length; ++i) - t.push(255 & e.charCodeAt(i)); - return t - }(t), e, i, n) - } - function E(e, t, i, n) { - return b(e, t, i, n) - } - function T(e, t, i, n) { - return z(G(t), e, i, n) - } - function A(e, t, i, n) { - return z(function(e, t) { - for (var i, n, r, o = [], a = 0; a < e.length && !((t -= 2) < 0); ++a) - i = e.charCodeAt(a), - n = i >> 8, - r = i % 256, - o.push(r), - o.push(n); - return o - }(t, e.length - i), e, i, n) - } - function x(e, t, i) { - return 0 === t && i === e.length ? n.fromByteArray(e) : n.fromByteArray(e.slice(t, i)) - } - function S(e, t, i) { - i = Math.min(e.length, i); - for (var n = [], r = t; r < i; ) { - var o, a, s, c, u = e[r], l = null, h = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1; - if (r + h <= i) - switch (h) { - case 1: - u < 128 && (l = u); - break; - case 2: - 128 == (192 & (o = e[r + 1])) && (c = (31 & u) << 6 | 63 & o) > 127 && (l = c); - break; - case 3: - o = e[r + 1], - a = e[r + 2], - 128 == (192 & o) && 128 == (192 & a) && (c = (15 & u) << 12 | (63 & o) << 6 | 63 & a) > 2047 && (c < 55296 || c > 57343) && (l = c); - break; - case 4: - o = e[r + 1], - a = e[r + 2], - s = e[r + 3], - 128 == (192 & o) && 128 == (192 & a) && 128 == (192 & s) && (c = (15 & u) << 18 | (63 & o) << 12 | (63 & a) << 6 | 63 & s) > 65535 && c < 1114112 && (l = c) - } - null === l ? (l = 65533, - h = 1) : l > 65535 && (l -= 65536, - n.push(l >>> 10 & 1023 | 55296), - l = 56320 | 1023 & l), - n.push(l), - r += h - } - return function(e) { - var t = e.length; - if (t <= C) - return String.fromCharCode.apply(String, e); - var i = "" - , n = 0; - for (; n < t; ) - i += String.fromCharCode.apply(String, e.slice(n, n += C)); - return i - }(n) - } - t.Buffer = c, - t.SlowBuffer = function(e) { - +e != e && (e = 0); - return c.alloc(+e) - } - , - t.INSPECT_MAX_BYTES = 50, - c.TYPED_ARRAY_SUPPORT = void 0 !== e.TYPED_ARRAY_SUPPORT ? e.TYPED_ARRAY_SUPPORT : function() { - try { - var e = new Uint8Array(1); - return e.__proto__ = { - __proto__: Uint8Array.prototype, - foo: function() { - return 42 - } - }, - 42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength - } catch (e) { - return false - } - }(), - t.kMaxLength = a(), - c.poolSize = 8192, - c._augment = function(e) { - return e.__proto__ = c.prototype, - e - } - , - c.from = function(e, t, i) { - return u(null, e, t, i) - } - , - c.TYPED_ARRAY_SUPPORT && (c.prototype.__proto__ = Uint8Array.prototype, - c.__proto__ = Uint8Array, - "undefined" != typeof Symbol && Symbol.species && c[Symbol.species] === c && Object.defineProperty(c, Symbol.species, { - value: null, - configurable: true - })), - c.alloc = function(e, t, i) { - return function(e, t, i, n) { - return l(t), - t <= 0 ? s(e, t) : void 0 !== i ? "string" == typeof n ? s(e, t).fill(i, n) : s(e, t).fill(i) : s(e, t) - }(null, e, t, i) - } - , - c.allocUnsafe = function(e) { - return h(null, e) - } - , - c.allocUnsafeSlow = function(e) { - return h(null, e) - } - , - c.isBuffer = function(e) { - return !(null == e || !e._isBuffer) - } - , - c.compare = function(e, t) { - if (!c.isBuffer(e) || !c.isBuffer(t)) - throw new TypeError("Arguments must be Buffers"); - if (e === t) - return 0; - for (var i = e.length, n = t.length, r = 0, o = Math.min(i, n); r < o; ++r) - if (e[r] !== t[r]) { - i = e[r], - n = t[r]; - break - } - return i < n ? -1 : n < i ? 1 : 0 - } - , - c.isEncoding = function(e) { - switch (String(e).toLowerCase()) { + return i < n ? -1 : n < i ? 1 : 0; + }), + (c.isEncoding = function (e) { + switch (String(e).toLowerCase()) { case "hex": case "utf8": case "utf-8": @@ -717,8274 +845,9930 @@ case "ucs-2": case "utf16le": case "utf-16le": - return true; + return true; default: - return false - } - } - , - c.concat = function(e, t) { - if (!o(e)) - throw new TypeError('"list" argument must be an Array of Buffers'); - if (0 === e.length) - return c.alloc(0); - var i; - if (void 0 === t) - for (t = 0, - i = 0; i < e.length; ++i) - t += e[i].length; - var n = c.allocUnsafe(t) - , r = 0; - for (i = 0; i < e.length; ++i) { - var a = e[i]; - if (!c.isBuffer(a)) - throw new TypeError('"list" argument must be an Array of Buffers'); - a.copy(n, r), - r += a.length - } - return n - } - , - c.byteLength = p, - c.prototype._isBuffer = true, - c.prototype.swap16 = function() { - var e = this.length; - if (e % 2 != 0) - throw new RangeError("Buffer size must be a multiple of 16-bits"); - for (var t = 0; t < e; t += 2) - m(this, t, t + 1); - return this - } - , - c.prototype.swap32 = function() { - var e = this.length; - if (e % 4 != 0) - throw new RangeError("Buffer size must be a multiple of 32-bits"); - for (var t = 0; t < e; t += 4) - m(this, t, t + 3), - m(this, t + 1, t + 2); - return this - } - , - c.prototype.swap64 = function() { - var e = this.length; - if (e % 8 != 0) - throw new RangeError("Buffer size must be a multiple of 64-bits"); - for (var t = 0; t < e; t += 8) - m(this, t, t + 7), - m(this, t + 1, t + 6), - m(this, t + 2, t + 5), - m(this, t + 3, t + 4); - return this - } - , - c.prototype.toString = function() { - var e = 0 | this.length; - return 0 === e ? "" : 0 === arguments.length ? S(this, 0, e) : function(e, t, i) { + return false; + } + }), + (c.concat = function (e, t) { + if (!o(e)) + throw new TypeError('"list" argument must be an Array of Buffers'); + if (0 === e.length) return c.alloc(0); + var i; + if (void 0 === t) + for (t = 0, i = 0; i < e.length; ++i) t += e[i].length; + var n = c.allocUnsafe(t), + r = 0; + for (i = 0; i < e.length; ++i) { + var a = e[i]; + if (!c.isBuffer(a)) + throw new TypeError( + '"list" argument must be an Array of Buffers' + ); + a.copy(n, r), (r += a.length); + } + return n; + }), + (c.byteLength = p), + (c.prototype._isBuffer = true), + (c.prototype.swap16 = function () { + var e = this.length; + if (e % 2 != 0) + throw new RangeError("Buffer size must be a multiple of 16-bits"); + for (var t = 0; t < e; t += 2) m(this, t, t + 1); + return this; + }), + (c.prototype.swap32 = function () { + var e = this.length; + if (e % 4 != 0) + throw new RangeError("Buffer size must be a multiple of 32-bits"); + for (var t = 0; t < e; t += 4) + m(this, t, t + 3), m(this, t + 1, t + 2); + return this; + }), + (c.prototype.swap64 = function () { + var e = this.length; + if (e % 8 != 0) + throw new RangeError("Buffer size must be a multiple of 64-bits"); + for (var t = 0; t < e; t += 8) + m(this, t, t + 7), + m(this, t + 1, t + 6), + m(this, t + 2, t + 5), + m(this, t + 3, t + 4); + return this; + }), + (c.prototype.toString = function () { + var e = 0 | this.length; + return 0 === e + ? "" + : 0 === arguments.length + ? S(this, 0, e) + : function (e, t, i) { var n = false; - if ((void 0 === t || t < 0) && (t = 0), - t > this.length) - return ""; - if ((void 0 === i || i > this.length) && (i = this.length), - i <= 0) - return ""; - if ((i >>>= 0) <= (t >>>= 0)) - return ""; + if (((void 0 === t || t < 0) && (t = 0), t > this.length)) + return ""; + if ( + ((void 0 === i || i > this.length) && (i = this.length), + i <= 0) + ) + return ""; + if ((i >>>= 0) <= (t >>>= 0)) return ""; for (e || (e = "utf8"); ; ) - switch (e) { + switch (e) { case "hex": - return M(this, t, i); + return M(this, t, i); case "utf8": case "utf-8": - return S(this, t, i); + return S(this, t, i); case "ascii": - return P(this, t, i); + return P(this, t, i); case "latin1": case "binary": - return R(this, t, i); + return R(this, t, i); case "base64": - return x(this, t, i); + return x(this, t, i); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": - return O(this, t, i); + return O(this, t, i); default: - if (n) - throw new TypeError("Unknown encoding: " + e); - e = (e + "").toLowerCase(), - n = true - } - } - .apply(this, arguments) - } - , - c.prototype.equals = function(e) { - if (!c.isBuffer(e)) - throw new TypeError("Argument must be a Buffer"); - return this === e || 0 === c.compare(this, e) - } - , - c.prototype.inspect = function() { - var e = "" - , i = t.INSPECT_MAX_BYTES; - return this.length > 0 && (e = this.toString("hex", 0, i).match(/.{2}/g).join(" "), - this.length > i && (e += " ... ")), + if (n) throw new TypeError("Unknown encoding: " + e); + (e = (e + "").toLowerCase()), (n = true); + } + }.apply(this, arguments); + }), + (c.prototype.equals = function (e) { + if (!c.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); + return this === e || 0 === c.compare(this, e); + }), + (c.prototype.inspect = function () { + var e = "", + i = t.INSPECT_MAX_BYTES; + return ( + this.length > 0 && + ((e = this.toString("hex", 0, i).match(/.{2}/g).join(" ")), + this.length > i && (e += " ... ")), "" - } - , - c.prototype.compare = function(e, t, i, n, r) { - if (!c.isBuffer(e)) - throw new TypeError("Argument must be a Buffer"); - if (void 0 === t && (t = 0), + ); + }), + (c.prototype.compare = function (e, t, i, n, r) { + if (!c.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); + if ( + (void 0 === t && (t = 0), void 0 === i && (i = e ? e.length : 0), void 0 === n && (n = 0), void 0 === r && (r = this.length), t < 0 || i > e.length || n < 0 || r > this.length) - throw new RangeError("out of range index"); - if (n >= r && t >= i) - return 0; - if (n >= r) - return -1; - if (t >= i) - return 1; - if (this === e) - return 0; - for (var o = (r >>>= 0) - (n >>>= 0), a = (i >>>= 0) - (t >>>= 0), s = Math.min(o, a), u = this.slice(n, r), l = e.slice(t, i), h = 0; h < s; ++h) - if (u[h] !== l[h]) { - o = u[h], - a = l[h]; - break - } - return o < a ? -1 : a < o ? 1 : 0 - } - , - c.prototype.includes = function(e, t, i) { - return -1 !== this.indexOf(e, t, i) - } - , - c.prototype.indexOf = function(e, t, i) { - return g(this, e, t, i, true) - } - , - c.prototype.lastIndexOf = function(e, t, i) { - return g(this, e, t, i, false) - } - , - c.prototype.write = function(e, t, i, n) { - if (void 0 === t) - n = "utf8", - i = this.length, - t = 0; - else if (void 0 === i && "string" == typeof t) - n = t, - i = this.length, - t = 0; - else { - if (!isFinite(t)) - throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); - t |= 0, - isFinite(i) ? (i |= 0, - void 0 === n && (n = "utf8")) : (n = i, - i = void 0) + ) + throw new RangeError("out of range index"); + if (n >= r && t >= i) return 0; + if (n >= r) return -1; + if (t >= i) return 1; + if (this === e) return 0; + for ( + var o = (r >>>= 0) - (n >>>= 0), + a = (i >>>= 0) - (t >>>= 0), + s = Math.min(o, a), + u = this.slice(n, r), + l = e.slice(t, i), + h = 0; + h < s; + ++h + ) + if (u[h] !== l[h]) { + (o = u[h]), (a = l[h]); + break; } - var r = this.length - t; - if ((void 0 === i || i > r) && (i = r), - e.length > 0 && (i < 0 || t < 0) || t > this.length) - throw new RangeError("Attempt to write outside buffer bounds"); - n || (n = "utf8"); - for (var o = false; ; ) - switch (n) { - case "hex": - return v(this, e, t, i); - case "utf8": - case "utf-8": - return y(this, e, t, i); - case "ascii": - return b(this, e, t, i); - case "latin1": - case "binary": - return E(this, e, t, i); - case "base64": - return T(this, e, t, i); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return A(this, e, t, i); - default: - if (o) - throw new TypeError("Unknown encoding: " + n); - n = ("" + n).toLowerCase(), - o = true - } - } - , - c.prototype.toJSON = function() { - return { - type: "Buffer", - data: Array.prototype.slice.call(this._arr || this, 0) + return o < a ? -1 : a < o ? 1 : 0; + }), + (c.prototype.includes = function (e, t, i) { + return -1 !== this.indexOf(e, t, i); + }), + (c.prototype.indexOf = function (e, t, i) { + return g(this, e, t, i, true); + }), + (c.prototype.lastIndexOf = function (e, t, i) { + return g(this, e, t, i, false); + }), + (c.prototype.write = function (e, t, i, n) { + if (void 0 === t) (n = "utf8"), (i = this.length), (t = 0); + else if (void 0 === i && "string" == typeof t) + (n = t), (i = this.length), (t = 0); + else { + if (!isFinite(t)) + throw new Error( + "Buffer.write(string, encoding, offset[, length]) is no longer supported" + ); + (t |= 0), + isFinite(i) + ? ((i |= 0), void 0 === n && (n = "utf8")) + : ((n = i), (i = void 0)); + } + var r = this.length - t; + if ( + ((void 0 === i || i > r) && (i = r), + (e.length > 0 && (i < 0 || t < 0)) || t > this.length) + ) + throw new RangeError("Attempt to write outside buffer bounds"); + n || (n = "utf8"); + for (var o = false; ; ) + switch (n) { + case "hex": + return v(this, e, t, i); + case "utf8": + case "utf-8": + return y(this, e, t, i); + case "ascii": + return b(this, e, t, i); + case "latin1": + case "binary": + return E(this, e, t, i); + case "base64": + return T(this, e, t, i); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return A(this, e, t, i); + default: + if (o) throw new TypeError("Unknown encoding: " + n); + (n = ("" + n).toLowerCase()), (o = true); } + }), + (c.prototype.toJSON = function () { + return { + type: "Buffer", + data: Array.prototype.slice.call(this._arr || this, 0), + }; + }); + var C = 4096; + function P(e, t, i) { + var n = ""; + i = Math.min(e.length, i); + for (var r = t; r < i; ++r) n += String.fromCharCode(127 & e[r]); + return n; + } + function R(e, t, i) { + var n = ""; + i = Math.min(e.length, i); + for (var r = t; r < i; ++r) n += String.fromCharCode(e[r]); + return n; + } + function M(e, t, i) { + var n = e.length; + (!t || t < 0) && (t = 0), (!i || i < 0 || i > n) && (i = n); + for (var r = "", o = t; o < i; ++o) r += U(e[o]); + return r; + } + function O(e, t, i) { + for (var n = e.slice(t, i), r = "", o = 0; o < n.length; o += 2) + r += String.fromCharCode(n[o] + 256 * n[o + 1]); + return r; + } + function w(e, t, i) { + if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint"); + if (e + t > i) + throw new RangeError("Trying to access beyond buffer length"); + } + function I(e, t, i, n, r, o) { + if (!c.isBuffer(e)) + throw new TypeError('"buffer" argument must be a Buffer instance'); + if (t > r || t < o) + throw new RangeError('"value" argument is out of bounds'); + if (i + n > e.length) throw new RangeError("Index out of range"); + } + function D(e, t, i, n) { + t < 0 && (t = 65535 + t + 1); + for (var r = 0, o = Math.min(e.length - i, 2); r < o; ++r) + e[i + r] = + (t & (255 << (8 * (n ? r : 1 - r)))) >>> (8 * (n ? r : 1 - r)); + } + function L(e, t, i, n) { + t < 0 && (t = 4294967295 + t + 1); + for (var r = 0, o = Math.min(e.length - i, 4); r < o; ++r) + e[i + r] = (t >>> (8 * (n ? r : 3 - r))) & 255; + } + function F(e, t, i, n, r, o) { + if (i + n > e.length) throw new RangeError("Index out of range"); + if (i < 0) throw new RangeError("Index out of range"); + } + function B(e, t, i, n, o) { + return o || F(e, 0, i, 4), r.write(e, t, i, n, 23, 4), i + 4; + } + function N(e, t, i, n, o) { + return o || F(e, 0, i, 8), r.write(e, t, i, n, 52, 8), i + 8; + } + (c.prototype.slice = function (e, t) { + var i, + n = this.length; + if ( + ((e = ~~e) < 0 ? (e += n) < 0 && (e = 0) : e > n && (e = n), + (t = void 0 === t ? n : ~~t) < 0 + ? (t += n) < 0 && (t = 0) + : t > n && (t = n), + t < e && (t = e), + c.TYPED_ARRAY_SUPPORT) + ) + (i = this.subarray(e, t)).__proto__ = c.prototype; + else { + var r = t - e; + i = new c(r, void 0); + for (var o = 0; o < r; ++o) i[o] = this[o + e]; } - ; - var C = 4096; - function P(e, t, i) { - var n = ""; - i = Math.min(e.length, i); - for (var r = t; r < i; ++r) - n += String.fromCharCode(127 & e[r]); - return n - } - function R(e, t, i) { - var n = ""; - i = Math.min(e.length, i); - for (var r = t; r < i; ++r) - n += String.fromCharCode(e[r]); - return n - } - function M(e, t, i) { - var n = e.length; - (!t || t < 0) && (t = 0), - (!i || i < 0 || i > n) && (i = n); - for (var r = "", o = t; o < i; ++o) - r += U(e[o]); - return r - } - function O(e, t, i) { - for (var n = e.slice(t, i), r = "", o = 0; o < n.length; o += 2) - r += String.fromCharCode(n[o] + 256 * n[o + 1]); - return r - } - function w(e, t, i) { - if (e % 1 != 0 || e < 0) - throw new RangeError("offset is not uint"); - if (e + t > i) - throw new RangeError("Trying to access beyond buffer length") - } - function I(e, t, i, n, r, o) { - if (!c.isBuffer(e)) - throw new TypeError('"buffer" argument must be a Buffer instance'); - if (t > r || t < o) - throw new RangeError('"value" argument is out of bounds'); - if (i + n > e.length) - throw new RangeError("Index out of range") - } - function D(e, t, i, n) { - t < 0 && (t = 65535 + t + 1); - for (var r = 0, o = Math.min(e.length - i, 2); r < o; ++r) - e[i + r] = (t & 255 << 8 * (n ? r : 1 - r)) >>> 8 * (n ? r : 1 - r) - } - function L(e, t, i, n) { - t < 0 && (t = 4294967295 + t + 1); - for (var r = 0, o = Math.min(e.length - i, 4); r < o; ++r) - e[i + r] = t >>> 8 * (n ? r : 3 - r) & 255 - } - function F(e, t, i, n, r, o) { - if (i + n > e.length) - throw new RangeError("Index out of range"); - if (i < 0) - throw new RangeError("Index out of range") - } - function B(e, t, i, n, o) { - return o || F(e, 0, i, 4), - r.write(e, t, i, n, 23, 4), - i + 4 - } - function N(e, t, i, n, o) { - return o || F(e, 0, i, 8), - r.write(e, t, i, n, 52, 8), - i + 8 - } - c.prototype.slice = function(e, t) { - var i, n = this.length; - if ((e = ~~e) < 0 ? (e += n) < 0 && (e = 0) : e > n && (e = n), - (t = void 0 === t ? n : ~~t) < 0 ? (t += n) < 0 && (t = 0) : t > n && (t = n), - t < e && (t = e), - c.TYPED_ARRAY_SUPPORT) - (i = this.subarray(e, t)).__proto__ = c.prototype; - else { - var r = t - e; - i = new c(r,void 0); - for (var o = 0; o < r; ++o) - i[o] = this[o + e] - } - return i - } - , - c.prototype.readUIntLE = function(e, t, i) { - e |= 0, - t |= 0, - i || w(e, t, this.length); - for (var n = this[e], r = 1, o = 0; ++o < t && (r *= 256); ) - n += this[e + o] * r; - return n - } - , - c.prototype.readUIntBE = function(e, t, i) { - e |= 0, - t |= 0, - i || w(e, t, this.length); - for (var n = this[e + --t], r = 1; t > 0 && (r *= 256); ) - n += this[e + --t] * r; - return n - } - , - c.prototype.readUInt8 = function(e, t) { - return t || w(e, 1, this.length), - this[e] - } - , - c.prototype.readUInt16LE = function(e, t) { - return t || w(e, 2, this.length), - this[e] | this[e + 1] << 8 - } - , - c.prototype.readUInt16BE = function(e, t) { - return t || w(e, 2, this.length), - this[e] << 8 | this[e + 1] - } - , - c.prototype.readUInt32LE = function(e, t) { - return t || w(e, 4, this.length), - (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3] - } - , - c.prototype.readUInt32BE = function(e, t) { - return t || w(e, 4, this.length), - 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]) - } - , - c.prototype.readIntLE = function(e, t, i) { - e |= 0, - t |= 0, - i || w(e, t, this.length); - for (var n = this[e], r = 1, o = 0; ++o < t && (r *= 256); ) - n += this[e + o] * r; - return n >= (r *= 128) && (n -= Math.pow(2, 8 * t)), - n - } - , - c.prototype.readIntBE = function(e, t, i) { - e |= 0, - t |= 0, - i || w(e, t, this.length); - for (var n = t, r = 1, o = this[e + --n]; n > 0 && (r *= 256); ) - o += this[e + --n] * r; - return o >= (r *= 128) && (o -= Math.pow(2, 8 * t)), - o - } - , - c.prototype.readInt8 = function(e, t) { - return t || w(e, 1, this.length), + return i; + }), + (c.prototype.readUIntLE = function (e, t, i) { + (e |= 0), (t |= 0), i || w(e, t, this.length); + for (var n = this[e], r = 1, o = 0; ++o < t && (r *= 256); ) + n += this[e + o] * r; + return n; + }), + (c.prototype.readUIntBE = function (e, t, i) { + (e |= 0), (t |= 0), i || w(e, t, this.length); + for (var n = this[e + --t], r = 1; t > 0 && (r *= 256); ) + n += this[e + --t] * r; + return n; + }), + (c.prototype.readUInt8 = function (e, t) { + return t || w(e, 1, this.length), this[e]; + }), + (c.prototype.readUInt16LE = function (e, t) { + return t || w(e, 2, this.length), this[e] | (this[e + 1] << 8); + }), + (c.prototype.readUInt16BE = function (e, t) { + return t || w(e, 2, this.length), (this[e] << 8) | this[e + 1]; + }), + (c.prototype.readUInt32LE = function (e, t) { + return ( + t || w(e, 4, this.length), + (this[e] | (this[e + 1] << 8) | (this[e + 2] << 16)) + + 16777216 * this[e + 3] + ); + }), + (c.prototype.readUInt32BE = function (e, t) { + return ( + t || w(e, 4, this.length), + 16777216 * this[e] + + ((this[e + 1] << 16) | (this[e + 2] << 8) | this[e + 3]) + ); + }), + (c.prototype.readIntLE = function (e, t, i) { + (e |= 0), (t |= 0), i || w(e, t, this.length); + for (var n = this[e], r = 1, o = 0; ++o < t && (r *= 256); ) + n += this[e + o] * r; + return n >= (r *= 128) && (n -= Math.pow(2, 8 * t)), n; + }), + (c.prototype.readIntBE = function (e, t, i) { + (e |= 0), (t |= 0), i || w(e, t, this.length); + for (var n = t, r = 1, o = this[e + --n]; n > 0 && (r *= 256); ) + o += this[e + --n] * r; + return o >= (r *= 128) && (o -= Math.pow(2, 8 * t)), o; + }), + (c.prototype.readInt8 = function (e, t) { + return ( + t || w(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e] - } - , - c.prototype.readInt16LE = function(e, t) { - t || w(e, 2, this.length); - var i = this[e] | this[e + 1] << 8; - return 32768 & i ? 4294901760 | i : i - } - , - c.prototype.readInt16BE = function(e, t) { - t || w(e, 2, this.length); - var i = this[e + 1] | this[e] << 8; - return 32768 & i ? 4294901760 | i : i - } - , - c.prototype.readInt32LE = function(e, t) { - return t || w(e, 4, this.length), - this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24 - } - , - c.prototype.readInt32BE = function(e, t) { - return t || w(e, 4, this.length), - this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3] - } - , - c.prototype.readFloatLE = function(e, t) { - return t || w(e, 4, this.length), - r.read(this, e, true, 23, 4) - } - , - c.prototype.readFloatBE = function(e, t) { - return t || w(e, 4, this.length), - r.read(this, e, false, 23, 4) - } - , - c.prototype.readDoubleLE = function(e, t) { - return t || w(e, 8, this.length), - r.read(this, e, true, 52, 8) - } - , - c.prototype.readDoubleBE = function(e, t) { - return t || w(e, 8, this.length), - r.read(this, e, false, 52, 8) - } - , - c.prototype.writeUIntLE = function(e, t, i, n) { - (e = +e, - t |= 0, - i |= 0, - n) || I(this, e, t, i, Math.pow(2, 8 * i) - 1, 0); - var r = 1 - , o = 0; - for (this[t] = 255 & e; ++o < i && (r *= 256); ) - this[t + o] = e / r & 255; - return t + i - } - , - c.prototype.writeUIntBE = function(e, t, i, n) { - (e = +e, - t |= 0, - i |= 0, - n) || I(this, e, t, i, Math.pow(2, 8 * i) - 1, 0); - var r = i - 1 - , o = 1; - for (this[t + r] = 255 & e; --r >= 0 && (o *= 256); ) - this[t + r] = e / o & 255; - return t + i - } - , - c.prototype.writeUInt8 = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.readInt16LE = function (e, t) { + t || w(e, 2, this.length); + var i = this[e] | (this[e + 1] << 8); + return 32768 & i ? 4294901760 | i : i; + }), + (c.prototype.readInt16BE = function (e, t) { + t || w(e, 2, this.length); + var i = this[e + 1] | (this[e] << 8); + return 32768 & i ? 4294901760 | i : i; + }), + (c.prototype.readInt32LE = function (e, t) { + return ( + t || w(e, 4, this.length), + this[e] | + (this[e + 1] << 8) | + (this[e + 2] << 16) | + (this[e + 3] << 24) + ); + }), + (c.prototype.readInt32BE = function (e, t) { + return ( + t || w(e, 4, this.length), + (this[e] << 24) | + (this[e + 1] << 16) | + (this[e + 2] << 8) | + this[e + 3] + ); + }), + (c.prototype.readFloatLE = function (e, t) { + return t || w(e, 4, this.length), r.read(this, e, true, 23, 4); + }), + (c.prototype.readFloatBE = function (e, t) { + return t || w(e, 4, this.length), r.read(this, e, false, 23, 4); + }), + (c.prototype.readDoubleLE = function (e, t) { + return t || w(e, 8, this.length), r.read(this, e, true, 52, 8); + }), + (c.prototype.readDoubleBE = function (e, t) { + return t || w(e, 8, this.length), r.read(this, e, false, 52, 8); + }), + (c.prototype.writeUIntLE = function (e, t, i, n) { + ((e = +e), (t |= 0), (i |= 0), n) || + I(this, e, t, i, Math.pow(2, 8 * i) - 1, 0); + var r = 1, + o = 0; + for (this[t] = 255 & e; ++o < i && (r *= 256); ) + this[t + o] = (e / r) & 255; + return t + i; + }), + (c.prototype.writeUIntBE = function (e, t, i, n) { + ((e = +e), (t |= 0), (i |= 0), n) || + I(this, e, t, i, Math.pow(2, 8 * i) - 1, 0); + var r = i - 1, + o = 1; + for (this[t + r] = 255 & e; --r >= 0 && (o *= 256); ) + this[t + r] = (e / o) & 255; + return t + i; + }), + (c.prototype.writeUInt8 = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 1, 255, 0), c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), - this[t] = 255 & e, + (this[t] = 255 & e), t + 1 - } - , - c.prototype.writeUInt16LE = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeUInt16LE = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 2, 65535, 0), - c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, - this[t + 1] = e >>> 8) : D(this, e, t, true), + c.TYPED_ARRAY_SUPPORT + ? ((this[t] = 255 & e), (this[t + 1] = e >>> 8)) + : D(this, e, t, true), t + 2 - } - , - c.prototype.writeUInt16BE = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeUInt16BE = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 2, 65535, 0), - c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, - this[t + 1] = 255 & e) : D(this, e, t, false), + c.TYPED_ARRAY_SUPPORT + ? ((this[t] = e >>> 8), (this[t + 1] = 255 & e)) + : D(this, e, t, false), t + 2 - } - , - c.prototype.writeUInt32LE = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeUInt32LE = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 4, 4294967295, 0), - c.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24, - this[t + 2] = e >>> 16, - this[t + 1] = e >>> 8, - this[t] = 255 & e) : L(this, e, t, true), + c.TYPED_ARRAY_SUPPORT + ? ((this[t + 3] = e >>> 24), + (this[t + 2] = e >>> 16), + (this[t + 1] = e >>> 8), + (this[t] = 255 & e)) + : L(this, e, t, true), t + 4 - } - , - c.prototype.writeUInt32BE = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeUInt32BE = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 4, 4294967295, 0), - c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, - this[t + 1] = e >>> 16, - this[t + 2] = e >>> 8, - this[t + 3] = 255 & e) : L(this, e, t, false), + c.TYPED_ARRAY_SUPPORT + ? ((this[t] = e >>> 24), + (this[t + 1] = e >>> 16), + (this[t + 2] = e >>> 8), + (this[t + 3] = 255 & e)) + : L(this, e, t, false), t + 4 - } - , - c.prototype.writeIntLE = function(e, t, i, n) { - if (e = +e, - t |= 0, - !n) { - var r = Math.pow(2, 8 * i - 1); - I(this, e, t, i, r - 1, -r) - } - var o = 0 - , a = 1 - , s = 0; - for (this[t] = 255 & e; ++o < i && (a *= 256); ) - e < 0 && 0 === s && 0 !== this[t + o - 1] && (s = 1), - this[t + o] = (e / a >> 0) - s & 255; - return t + i - } - , - c.prototype.writeIntBE = function(e, t, i, n) { - if (e = +e, - t |= 0, - !n) { - var r = Math.pow(2, 8 * i - 1); - I(this, e, t, i, r - 1, -r) - } - var o = i - 1 - , a = 1 - , s = 0; - for (this[t + o] = 255 & e; --o >= 0 && (a *= 256); ) - e < 0 && 0 === s && 0 !== this[t + o + 1] && (s = 1), - this[t + o] = (e / a >> 0) - s & 255; - return t + i - } - , - c.prototype.writeInt8 = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeIntLE = function (e, t, i, n) { + if (((e = +e), (t |= 0), !n)) { + var r = Math.pow(2, 8 * i - 1); + I(this, e, t, i, r - 1, -r); + } + var o = 0, + a = 1, + s = 0; + for (this[t] = 255 & e; ++o < i && (a *= 256); ) + e < 0 && 0 === s && 0 !== this[t + o - 1] && (s = 1), + (this[t + o] = (((e / a) >> 0) - s) & 255); + return t + i; + }), + (c.prototype.writeIntBE = function (e, t, i, n) { + if (((e = +e), (t |= 0), !n)) { + var r = Math.pow(2, 8 * i - 1); + I(this, e, t, i, r - 1, -r); + } + var o = i - 1, + a = 1, + s = 0; + for (this[t + o] = 255 & e; --o >= 0 && (a *= 256); ) + e < 0 && 0 === s && 0 !== this[t + o + 1] && (s = 1), + (this[t + o] = (((e / a) >> 0) - s) & 255); + return t + i; + }), + (c.prototype.writeInt8 = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 1, 127, -128), c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), - this[t] = 255 & e, + (this[t] = 255 & e), t + 1 - } - , - c.prototype.writeInt16LE = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeInt16LE = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 2, 32767, -32768), - c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, - this[t + 1] = e >>> 8) : D(this, e, t, true), + c.TYPED_ARRAY_SUPPORT + ? ((this[t] = 255 & e), (this[t + 1] = e >>> 8)) + : D(this, e, t, true), t + 2 - } - , - c.prototype.writeInt16BE = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeInt16BE = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 2, 32767, -32768), - c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, - this[t + 1] = 255 & e) : D(this, e, t, false), + c.TYPED_ARRAY_SUPPORT + ? ((this[t] = e >>> 8), (this[t + 1] = 255 & e)) + : D(this, e, t, false), t + 2 - } - , - c.prototype.writeInt32LE = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeInt32LE = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 4, 2147483647, -2147483648), - c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, - this[t + 1] = e >>> 8, - this[t + 2] = e >>> 16, - this[t + 3] = e >>> 24) : L(this, e, t, true), + c.TYPED_ARRAY_SUPPORT + ? ((this[t] = 255 & e), + (this[t + 1] = e >>> 8), + (this[t + 2] = e >>> 16), + (this[t + 3] = e >>> 24)) + : L(this, e, t, true), t + 4 - } - , - c.prototype.writeInt32BE = function(e, t, i) { - return e = +e, - t |= 0, + ); + }), + (c.prototype.writeInt32BE = function (e, t, i) { + return ( + (e = +e), + (t |= 0), i || I(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), - c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, - this[t + 1] = e >>> 16, - this[t + 2] = e >>> 8, - this[t + 3] = 255 & e) : L(this, e, t, false), + c.TYPED_ARRAY_SUPPORT + ? ((this[t] = e >>> 24), + (this[t + 1] = e >>> 16), + (this[t + 2] = e >>> 8), + (this[t + 3] = 255 & e)) + : L(this, e, t, false), t + 4 - } - , - c.prototype.writeFloatLE = function(e, t, i) { - return B(this, e, t, true, i) - } - , - c.prototype.writeFloatBE = function(e, t, i) { - return B(this, e, t, false, i) - } - , - c.prototype.writeDoubleLE = function(e, t, i) { - return N(this, e, t, true, i) - } - , - c.prototype.writeDoubleBE = function(e, t, i) { - return N(this, e, t, false, i) - } - , - c.prototype.copy = function(e, t, i, n) { - if (i || (i = 0), + ); + }), + (c.prototype.writeFloatLE = function (e, t, i) { + return B(this, e, t, true, i); + }), + (c.prototype.writeFloatBE = function (e, t, i) { + return B(this, e, t, false, i); + }), + (c.prototype.writeDoubleLE = function (e, t, i) { + return N(this, e, t, true, i); + }), + (c.prototype.writeDoubleBE = function (e, t, i) { + return N(this, e, t, false, i); + }), + (c.prototype.copy = function (e, t, i, n) { + if ( + (i || (i = 0), n || 0 === n || (n = this.length), t >= e.length && (t = e.length), t || (t = 0), n > 0 && n < i && (n = i), n === i) - return 0; - if (0 === e.length || 0 === this.length) - return 0; - if (t < 0) - throw new RangeError("targetStart out of bounds"); - if (i < 0 || i >= this.length) - throw new RangeError("sourceStart out of bounds"); - if (n < 0) - throw new RangeError("sourceEnd out of bounds"); - n > this.length && (n = this.length), + ) + return 0; + if (0 === e.length || 0 === this.length) return 0; + if (t < 0) throw new RangeError("targetStart out of bounds"); + if (i < 0 || i >= this.length) + throw new RangeError("sourceStart out of bounds"); + if (n < 0) throw new RangeError("sourceEnd out of bounds"); + n > this.length && (n = this.length), e.length - t < n - i && (n = e.length - t + i); - var r, o = n - i; - if (this === e && i < t && t < n) - for (r = o - 1; r >= 0; --r) - e[r + t] = this[r + i]; - else if (o < 1e3 || !c.TYPED_ARRAY_SUPPORT) - for (r = 0; r < o; ++r) - e[r + t] = this[r + i]; - else - Uint8Array.prototype.set.call(e, this.subarray(i, i + o), t); - return o - } - , - c.prototype.fill = function(e, t, i, n) { - if ("string" == typeof e) { - if ("string" == typeof t ? (n = t, - t = 0, - i = this.length) : "string" == typeof i && (n = i, - i = this.length), - 1 === e.length) { - var r = e.charCodeAt(0); - r < 256 && (e = r) - } - if (void 0 !== n && "string" != typeof n) - throw new TypeError("encoding must be a string"); - if ("string" == typeof n && !c.isEncoding(n)) - throw new TypeError("Unknown encoding: " + n) - } else - "number" == typeof e && (e &= 255); - if (t < 0 || this.length < t || this.length < i) - throw new RangeError("Out of range index"); - if (i <= t) - return this; - var o; - if (t >>>= 0, - i = void 0 === i ? this.length : i >>> 0, + var r, + o = n - i; + if (this === e && i < t && t < n) + for (r = o - 1; r >= 0; --r) e[r + t] = this[r + i]; + else if (o < 1e3 || !c.TYPED_ARRAY_SUPPORT) + for (r = 0; r < o; ++r) e[r + t] = this[r + i]; + else Uint8Array.prototype.set.call(e, this.subarray(i, i + o), t); + return o; + }), + (c.prototype.fill = function (e, t, i, n) { + if ("string" == typeof e) { + if ( + ("string" == typeof t + ? ((n = t), (t = 0), (i = this.length)) + : "string" == typeof i && ((n = i), (i = this.length)), + 1 === e.length) + ) { + var r = e.charCodeAt(0); + r < 256 && (e = r); + } + if (void 0 !== n && "string" != typeof n) + throw new TypeError("encoding must be a string"); + if ("string" == typeof n && !c.isEncoding(n)) + throw new TypeError("Unknown encoding: " + n); + } else "number" == typeof e && (e &= 255); + if (t < 0 || this.length < t || this.length < i) + throw new RangeError("Out of range index"); + if (i <= t) return this; + var o; + if ( + ((t >>>= 0), + (i = void 0 === i ? this.length : i >>> 0), e || (e = 0), "number" == typeof e) - for (o = t; o < i; ++o) - this[o] = e; - else { - var a = c.isBuffer(e) ? e : V(new c(e,n).toString()) - , s = a.length; - for (o = 0; o < i - t; ++o) - this[o + t] = a[o % s] + ) + for (o = t; o < i; ++o) this[o] = e; + else { + var a = c.isBuffer(e) ? e : V(new c(e, n).toString()), + s = a.length; + for (o = 0; o < i - t; ++o) this[o + t] = a[o % s]; + } + return this; + }); + var k = /[^+\/0-9A-Za-z-_]/g; + function U(e) { + return e < 16 ? "0" + e.toString(16) : e.toString(16); + } + function V(e, t) { + var i; + t = t || 1 / 0; + for (var n = e.length, r = null, o = [], a = 0; a < n; ++a) { + if ((i = e.charCodeAt(a)) > 55295 && i < 57344) { + if (!r) { + if (i > 56319) { + (t -= 3) > -1 && o.push(239, 191, 189); + continue; + } + if (a + 1 === n) { + (t -= 3) > -1 && o.push(239, 191, 189); + continue; + } + r = i; + continue; } - return this - } - ; - var k = /[^+\/0-9A-Za-z-_]/g; - function U(e) { - return e < 16 ? "0" + e.toString(16) : e.toString(16) - } - function V(e, t) { - var i; - t = t || 1 / 0; - for (var n = e.length, r = null, o = [], a = 0; a < n; ++a) { - if ((i = e.charCodeAt(a)) > 55295 && i < 57344) { - if (!r) { - if (i > 56319) { - (t -= 3) > -1 && o.push(239, 191, 189); - continue - } - if (a + 1 === n) { - (t -= 3) > -1 && o.push(239, 191, 189); - continue - } - r = i; - continue - } - if (i < 56320) { - (t -= 3) > -1 && o.push(239, 191, 189), - r = i; - continue - } - i = 65536 + (r - 55296 << 10 | i - 56320) - } else - r && (t -= 3) > -1 && o.push(239, 191, 189); - if (r = null, - i < 128) { - if ((t -= 1) < 0) - break; - o.push(i) - } else if (i < 2048) { - if ((t -= 2) < 0) - break; - o.push(i >> 6 | 192, 63 & i | 128) - } else if (i < 65536) { - if ((t -= 3) < 0) - break; - o.push(i >> 12 | 224, i >> 6 & 63 | 128, 63 & i | 128) - } else { - if (!(i < 1114112)) - throw new Error("Invalid code point"); - if ((t -= 4) < 0) - break; - o.push(i >> 18 | 240, i >> 12 & 63 | 128, i >> 6 & 63 | 128, 63 & i | 128) - } + if (i < 56320) { + (t -= 3) > -1 && o.push(239, 191, 189), (r = i); + continue; } - return o + i = 65536 + (((r - 55296) << 10) | (i - 56320)); + } else r && (t -= 3) > -1 && o.push(239, 191, 189); + if (((r = null), i < 128)) { + if ((t -= 1) < 0) break; + o.push(i); + } else if (i < 2048) { + if ((t -= 2) < 0) break; + o.push((i >> 6) | 192, (63 & i) | 128); + } else if (i < 65536) { + if ((t -= 3) < 0) break; + o.push((i >> 12) | 224, ((i >> 6) & 63) | 128, (63 & i) | 128); + } else { + if (!(i < 1114112)) throw new Error("Invalid code point"); + if ((t -= 4) < 0) break; + o.push( + (i >> 18) | 240, + ((i >> 12) & 63) | 128, + ((i >> 6) & 63) | 128, + (63 & i) | 128 + ); + } } - function G(e) { - return n.toByteArray(function(e) { - if ((e = function(e) { - return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "") - }(e).replace(k, "")).length < 2) - return ""; - for (; e.length % 4 != 0; ) - e += "="; - return e - }(e)) - } - function z(e, t, i, n) { - for (var r = 0; r < n && !(r + i >= t.length || r >= e.length); ++r) - t[r + i] = e[r]; - return r - } - } - ).call(this, i(15)) -} -, function(exp, t, i) { + return o; + } + function G(e) { + return n.toByteArray( + (function (e) { + if ( + (e = (function (e) { + return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, ""); + })(e).replace(k, "")).length < 2 + ) + return ""; + for (; e.length % 4 != 0; ) e += "="; + return e; + })(e) + ); + } + function z(e, t, i, n) { + for (var r = 0; r < n && !(r + i >= t.length || r >= e.length); ++r) + t[r + i] = e[r]; + return r; + } + }.call(this, i(15))); + }, + function (exp, t, i) { var n = i(28); var r = Math.min; - exp.exports = function(e) { - return e > 0 ? r(n(e), 9007199254740991) : 0 - } -} -, function(e, t, i) { - (function(e) { - function t(e) { - return (t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - !function(e, n) { - "use strict"; - function r(e, t) { - if (!e) - throw new Error(t || "Assertion failed") - } - function o(e, t) { - e.super_ = t; - var i = function() {}; - i.prototype = t.prototype, - e.prototype = new i, - e.prototype.constructor = e - } - function a(e, t, i) { - if (a.isBN(e)) - return e; - this.negative = 0, - this.words = null, - this.length = 0, - this.red = null, - null !== e && ("le" !== t && "be" !== t || (i = t, - t = 10), - this._init(e || 0, t || 10, i || "be")) - } - var s; - "object" === t(e) ? e.exports = a : n.BN = a, - a.BN = a, - a.wordSize = 26; - try { - s = i(543).Buffer - } catch (e) {} - function c(e, t, i) { - for (var n = 0, r = Math.min(e.length, i), o = t; o < r; o++) { - var a = e.charCodeAt(o) - 48; - n <<= 4, - n |= a >= 49 && a <= 54 ? a - 49 + 10 : a >= 17 && a <= 22 ? a - 17 + 10 : 15 & a - } - return n - } - function u(e, t, i, n) { - for (var r = 0, o = Math.min(e.length, i), a = t; a < o; a++) { - var s = e.charCodeAt(a) - 48; - r *= n, - r += s >= 49 ? s - 49 + 10 : s >= 17 ? s - 17 + 10 : s - } - return r - } - a.isBN = function(e) { - return e instanceof a || null !== e && "object" === t(e) && e.constructor.wordSize === a.wordSize && Array.isArray(e.words) - } - , - a.max = function(e, t) { - return e.cmp(t) > 0 ? e : t - } - , - a.min = function(e, t) { - return e.cmp(t) < 0 ? e : t - } - , - a.prototype._init = function(e, i, n) { - if ("number" == typeof e) - return this._initNumber(e, i, n); - if ("object" === t(e)) - return this._initArray(e, i, n); - "hex" === i && (i = 16), - r(i === (0 | i) && i >= 2 && i <= 36); - var o = 0; - "-" === (e = e.toString().replace(/\s+/g, ""))[0] && o++, - 16 === i ? this._parseHex(e, o) : this._parseBase(e, i, o), - "-" === e[0] && (this.negative = 1), - this.strip(), - "le" === n && this._initArray(this.toArray(), i, n) - } - , - a.prototype._initNumber = function(e, t, i) { - e < 0 && (this.negative = 1, - e = -e), - e < 67108864 ? (this.words = [67108863 & e], - this.length = 1) : e < 4503599627370496 ? (this.words = [67108863 & e, e / 67108864 & 67108863], - this.length = 2) : (r(e < 9007199254740992), - this.words = [67108863 & e, e / 67108864 & 67108863, 1], - this.length = 3), - "le" === i && this._initArray(this.toArray(), t, i) - } - , - a.prototype._initArray = function(e, t, i) { - if (r("number" == typeof e.length), - e.length <= 0) - return this.words = [0], - this.length = 1, - this; - this.length = Math.ceil(e.length / 3), - this.words = new Array(this.length); - for (var n = 0; n < this.length; n++) - this.words[n] = 0; - var o, a, s = 0; - if ("be" === i) - for (n = e.length - 1, - o = 0; n >= 0; n -= 3) - a = e[n] | e[n - 1] << 8 | e[n - 2] << 16, - this.words[o] |= a << s & 67108863, - this.words[o + 1] = a >>> 26 - s & 67108863, - (s += 24) >= 26 && (s -= 26, - o++); - else if ("le" === i) - for (n = 0, - o = 0; n < e.length; n += 3) - a = e[n] | e[n + 1] << 8 | e[n + 2] << 16, - this.words[o] |= a << s & 67108863, - this.words[o + 1] = a >>> 26 - s & 67108863, - (s += 24) >= 26 && (s -= 26, - o++); - return this.strip() - } - , - a.prototype._parseHex = function(e, t) { - this.length = Math.ceil((e.length - t) / 6), - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) - this.words[i] = 0; - var n, r, o = 0; - for (i = e.length - 6, - n = 0; i >= t; i -= 6) - r = c(e, i, i + 6), - this.words[n] |= r << o & 67108863, - this.words[n + 1] |= r >>> 26 - o & 4194303, - (o += 24) >= 26 && (o -= 26, - n++); - i + 6 !== t && (r = c(e, t, i + 6), - this.words[n] |= r << o & 67108863, - this.words[n + 1] |= r >>> 26 - o & 4194303), - this.strip() - } - , - a.prototype._parseBase = function(e, t, i) { - this.words = [0], - this.length = 1; - for (var n = 0, r = 1; r <= 67108863; r *= t) - n++; - n--, - r = r / t | 0; - for (var o = e.length - i, a = o % n, s = Math.min(o, o - a) + i, c = 0, l = i; l < s; l += n) - c = u(e, l, l + n, t), - this.imuln(r), - this.words[0] + c < 67108864 ? this.words[0] += c : this._iaddn(c); - if (0 !== a) { - var h = 1; - for (c = u(e, l, e.length, t), - l = 0; l < a; l++) - h *= t; - this.imuln(h), - this.words[0] + c < 67108864 ? this.words[0] += c : this._iaddn(c) - } - } - , - a.prototype.copy = function(e) { - e.words = new Array(this.length); - for (var t = 0; t < this.length; t++) - e.words[t] = this.words[t]; - e.length = this.length, - e.negative = this.negative, - e.red = this.red - } - , - a.prototype.clone = function() { - var e = new a(null); - return this.copy(e), - e - } - , - a.prototype._expand = function(e) { - for (; this.length < e; ) - this.words[this.length++] = 0; - return this - } - , - a.prototype.strip = function() { - for (; this.length > 1 && 0 === this.words[this.length - 1]; ) - this.length--; - return this._normSign() - } - , - a.prototype._normSign = function() { - return 1 === this.length && 0 === this.words[0] && (this.negative = 0), - this - } - , - a.prototype.inspect = function() { - return (this.red ? "" - } - ; - var l = ["", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000", "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000", "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000", "00000000000000000000", "000000000000000000000", "0000000000000000000000", "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000"] - , h = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5] - , f = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176]; - function d(e, t, i) { - i.negative = t.negative ^ e.negative; - var n = e.length + t.length | 0; - i.length = n, - n = n - 1 | 0; - var r = 0 | e.words[0] - , o = 0 | t.words[0] - , a = r * o - , s = 67108863 & a - , c = a / 67108864 | 0; - i.words[0] = s; - for (var u = 1; u < n; u++) { - for (var l = c >>> 26, h = 67108863 & c, f = Math.min(u, t.length - 1), d = Math.max(0, u - e.length + 1); d <= f; d++) { - var p = u - d | 0; - l += (a = (r = 0 | e.words[p]) * (o = 0 | t.words[d]) + h) / 67108864 | 0, - h = 67108863 & a - } - i.words[u] = 0 | h, - c = 0 | l - } - return 0 !== c ? i.words[u] = 0 | c : i.length--, - i.strip() - } - a.prototype.toString = function(e, t) { - var i; - if (t = 0 | t || 1, - 16 === (e = e || 10) || "hex" === e) { - i = ""; - for (var n = 0, o = 0, a = 0; a < this.length; a++) { - var s = this.words[a] - , c = (16777215 & (s << n | o)).toString(16); - i = 0 !== (o = s >>> 24 - n & 16777215) || a !== this.length - 1 ? l[6 - c.length] + c + i : c + i, - (n += 2) >= 26 && (n -= 26, - a--) - } - for (0 !== o && (i = o.toString(16) + i); i.length % t != 0; ) - i = "0" + i; - return 0 !== this.negative && (i = "-" + i), - i - } - if (e === (0 | e) && e >= 2 && e <= 36) { - var u = h[e] - , d = f[e]; - i = ""; - var p = this.clone(); - for (p.negative = 0; !p.isZero(); ) { - var m = p.modn(d).toString(e); - i = (p = p.idivn(d)).isZero() ? m + i : l[u - m.length] + m + i - } - for (this.isZero() && (i = "0" + i); i.length % t != 0; ) - i = "0" + i; - return 0 !== this.negative && (i = "-" + i), - i - } - r(false, "Base should be between 2 and 36") - } - , - a.prototype.toNumber = function() { - var e = this.words[0]; - return 2 === this.length ? e += 67108864 * this.words[1] : 3 === this.length && 1 === this.words[2] ? e += 4503599627370496 + 67108864 * this.words[1] : this.length > 2 && r(false, "Number can only safely store up to 53 bits"), - 0 !== this.negative ? -e : e - } - , - a.prototype.toJSON = function() { - return this.toString(16) - } - , - a.prototype.toBuffer = function(e, t) { - return r(void 0 !== s), - this.toArrayLike(s, e, t) - } - , - a.prototype.toArray = function(e, t) { - return this.toArrayLike(Array, e, t) - } - , - a.prototype.toArrayLike = function(e, t, i) { - var n = this.byteLength() - , o = i || Math.max(1, n); - r(n <= o, "byte array longer than desired length"), - r(o > 0, "Requested array length <= 0"), - this.strip(); - var a, s, c = "le" === t, u = new e(o), l = this.clone(); - if (c) { - for (s = 0; !l.isZero(); s++) - a = l.andln(255), - l.iushrn(8), - u[s] = a; - for (; s < o; s++) - u[s] = 0 - } else { - for (s = 0; s < o - n; s++) - u[s] = 0; - for (s = 0; !l.isZero(); s++) - a = l.andln(255), - l.iushrn(8), - u[o - s - 1] = a - } - return u - } - , - Math.clz32 ? a.prototype._countBits = function(e) { - return 32 - Math.clz32(e) - } - : a.prototype._countBits = function(e) { - var t = e - , i = 0; - return t >= 4096 && (i += 13, - t >>>= 13), - t >= 64 && (i += 7, - t >>>= 7), - t >= 8 && (i += 4, - t >>>= 4), - t >= 2 && (i += 2, - t >>>= 2), - i + t - } - , - a.prototype._zeroBits = function(e) { - if (0 === e) - return 26; - var t = e - , i = 0; - return 0 == (8191 & t) && (i += 13, - t >>>= 13), - 0 == (127 & t) && (i += 7, - t >>>= 7), - 0 == (15 & t) && (i += 4, - t >>>= 4), - 0 == (3 & t) && (i += 2, - t >>>= 2), - 0 == (1 & t) && i++, - i - } - , - a.prototype.bitLength = function() { - var e = this.words[this.length - 1] - , t = this._countBits(e); - return 26 * (this.length - 1) + t - } - , - a.prototype.zeroBits = function() { - if (this.isZero()) - return 0; - for (var e = 0, t = 0; t < this.length; t++) { - var i = this._zeroBits(this.words[t]); - if (e += i, - 26 !== i) - break - } - return e - } - , - a.prototype.byteLength = function() { - return Math.ceil(this.bitLength() / 8) - } - , - a.prototype.toTwos = function(e) { - return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone() - } - , - a.prototype.fromTwos = function(e) { - return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone() - } - , - a.prototype.isNeg = function() { - return 0 !== this.negative - } - , - a.prototype.neg = function() { - return this.clone().ineg() - } - , - a.prototype.ineg = function() { - return this.isZero() || (this.negative ^= 1), - this - } - , - a.prototype.iuor = function(e) { - for (; this.length < e.length; ) - this.words[this.length++] = 0; - for (var t = 0; t < e.length; t++) - this.words[t] = this.words[t] | e.words[t]; - return this.strip() - } - , - a.prototype.ior = function(e) { - return r(0 == (this.negative | e.negative)), - this.iuor(e) - } - , - a.prototype.or = function(e) { - return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this) - } - , - a.prototype.uor = function(e) { - return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this) - } - , - a.prototype.iuand = function(e) { - var t; - t = this.length > e.length ? e : this; - for (var i = 0; i < t.length; i++) - this.words[i] = this.words[i] & e.words[i]; - return this.length = t.length, - this.strip() - } - , - a.prototype.iand = function(e) { - return r(0 == (this.negative | e.negative)), - this.iuand(e) - } - , - a.prototype.and = function(e) { - return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this) - } - , - a.prototype.uand = function(e) { - return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this) - } - , - a.prototype.iuxor = function(e) { - var t, i; - this.length > e.length ? (t = this, - i = e) : (t = e, - i = this); - for (var n = 0; n < i.length; n++) - this.words[n] = t.words[n] ^ i.words[n]; - if (this !== t) - for (; n < t.length; n++) - this.words[n] = t.words[n]; - return this.length = t.length, - this.strip() - } - , - a.prototype.ixor = function(e) { - return r(0 == (this.negative | e.negative)), - this.iuxor(e) - } - , - a.prototype.xor = function(e) { - return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this) - } - , - a.prototype.uxor = function(e) { - return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this) - } - , - a.prototype.inotn = function(e) { - r("number" == typeof e && e >= 0); - var t = 0 | Math.ceil(e / 26) - , i = e % 26; - this._expand(t), - i > 0 && t--; - for (var n = 0; n < t; n++) - this.words[n] = 67108863 & ~this.words[n]; - return i > 0 && (this.words[n] = ~this.words[n] & 67108863 >> 26 - i), - this.strip() - } - , - a.prototype.notn = function(e) { - return this.clone().inotn(e) - } - , - a.prototype.setn = function(e, t) { - r("number" == typeof e && e >= 0); - var i = e / 26 | 0 - , n = e % 26; - return this._expand(i + 1), - this.words[i] = t ? this.words[i] | 1 << n : this.words[i] & ~(1 << n), - this.strip() - } - , - a.prototype.iadd = function(e) { - var t, i, n; - if (0 !== this.negative && 0 === e.negative) - return this.negative = 0, - t = this.isub(e), - this.negative ^= 1, - this._normSign(); - if (0 === this.negative && 0 !== e.negative) - return e.negative = 0, - t = this.isub(e), - e.negative = 1, - t._normSign(); - this.length > e.length ? (i = this, - n = e) : (i = e, - n = this); - for (var r = 0, o = 0; o < n.length; o++) - t = (0 | i.words[o]) + (0 | n.words[o]) + r, - this.words[o] = 67108863 & t, - r = t >>> 26; - for (; 0 !== r && o < i.length; o++) - t = (0 | i.words[o]) + r, - this.words[o] = 67108863 & t, - r = t >>> 26; - if (this.length = i.length, - 0 !== r) - this.words[this.length] = r, - this.length++; - else if (i !== this) - for (; o < i.length; o++) - this.words[o] = i.words[o]; - return this - } - , - a.prototype.add = function(e) { - var t; - return 0 !== e.negative && 0 === this.negative ? (e.negative = 0, - t = this.sub(e), - e.negative ^= 1, - t) : 0 === e.negative && 0 !== this.negative ? (this.negative = 0, - t = e.sub(this), - this.negative = 1, - t) : this.length > e.length ? this.clone().iadd(e) : e.clone().iadd(this) - } - , - a.prototype.isub = function(e) { - if (0 !== e.negative) { - e.negative = 0; - var t = this.iadd(e); - return e.negative = 1, - t._normSign() - } - if (0 !== this.negative) - return this.negative = 0, - this.iadd(e), - this.negative = 1, - this._normSign(); - var i, n, r = this.cmp(e); - if (0 === r) - return this.negative = 0, - this.length = 1, - this.words[0] = 0, - this; - r > 0 ? (i = this, - n = e) : (i = e, - n = this); - for (var o = 0, a = 0; a < n.length; a++) - o = (t = (0 | i.words[a]) - (0 | n.words[a]) + o) >> 26, - this.words[a] = 67108863 & t; - for (; 0 !== o && a < i.length; a++) - o = (t = (0 | i.words[a]) + o) >> 26, - this.words[a] = 67108863 & t; - if (0 === o && a < i.length && i !== this) - for (; a < i.length; a++) - this.words[a] = i.words[a]; - return this.length = Math.max(this.length, a), - i !== this && (this.negative = 1), - this.strip() - } - , - a.prototype.sub = function(e) { - return this.clone().isub(e) - } - ; - var p = function(e, t, i) { - var n, r, o, a = e.words, s = t.words, c = i.words, u = 0, l = 0 | a[0], h = 8191 & l, f = l >>> 13, d = 0 | a[1], p = 8191 & d, m = d >>> 13, g = 0 | a[2], _ = 8191 & g, v = g >>> 13, y = 0 | a[3], b = 8191 & y, E = y >>> 13, T = 0 | a[4], A = 8191 & T, x = T >>> 13, S = 0 | a[5], C = 8191 & S, P = S >>> 13, R = 0 | a[6], M = 8191 & R, O = R >>> 13, w = 0 | a[7], I = 8191 & w, D = w >>> 13, L = 0 | a[8], F = 8191 & L, B = L >>> 13, N = 0 | a[9], k = 8191 & N, U = N >>> 13, V = 0 | s[0], G = 8191 & V, z = V >>> 13, j = 0 | s[1], H = 8191 & j, W = j >>> 13, X = 0 | s[2], Y = 8191 & X, K = X >>> 13, Q = 0 | s[3], q = 8191 & Q, Z = Q >>> 13, J = 0 | s[4], $ = 8191 & J, ee = J >>> 13, te = 0 | s[5], ie = 8191 & te, ne = te >>> 13, re = 0 | s[6], oe = 8191 & re, ae = re >>> 13, se = 0 | s[7], ce = 8191 & se, ue = se >>> 13, le = 0 | s[8], he = 8191 & le, fe = le >>> 13, de = 0 | s[9], pe = 8191 & de, me = de >>> 13; - i.negative = e.negative ^ t.negative, - i.length = 19; - var ge = (u + (n = Math.imul(h, G)) | 0) + ((8191 & (r = (r = Math.imul(h, z)) + Math.imul(f, G) | 0)) << 13) | 0; - u = ((o = Math.imul(f, z)) + (r >>> 13) | 0) + (ge >>> 26) | 0, - ge &= 67108863, - n = Math.imul(p, G), - r = (r = Math.imul(p, z)) + Math.imul(m, G) | 0, - o = Math.imul(m, z); - var _e = (u + (n = n + Math.imul(h, H) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, W) | 0) + Math.imul(f, H) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, W) | 0) + (r >>> 13) | 0) + (_e >>> 26) | 0, - _e &= 67108863, - n = Math.imul(_, G), - r = (r = Math.imul(_, z)) + Math.imul(v, G) | 0, - o = Math.imul(v, z), - n = n + Math.imul(p, H) | 0, - r = (r = r + Math.imul(p, W) | 0) + Math.imul(m, H) | 0, - o = o + Math.imul(m, W) | 0; - var ve = (u + (n = n + Math.imul(h, Y) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, K) | 0) + Math.imul(f, Y) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, K) | 0) + (r >>> 13) | 0) + (ve >>> 26) | 0, - ve &= 67108863, - n = Math.imul(b, G), - r = (r = Math.imul(b, z)) + Math.imul(E, G) | 0, - o = Math.imul(E, z), - n = n + Math.imul(_, H) | 0, - r = (r = r + Math.imul(_, W) | 0) + Math.imul(v, H) | 0, - o = o + Math.imul(v, W) | 0, - n = n + Math.imul(p, Y) | 0, - r = (r = r + Math.imul(p, K) | 0) + Math.imul(m, Y) | 0, - o = o + Math.imul(m, K) | 0; - var ye = (u + (n = n + Math.imul(h, q) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, Z) | 0) + Math.imul(f, q) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, Z) | 0) + (r >>> 13) | 0) + (ye >>> 26) | 0, - ye &= 67108863, - n = Math.imul(A, G), - r = (r = Math.imul(A, z)) + Math.imul(x, G) | 0, - o = Math.imul(x, z), - n = n + Math.imul(b, H) | 0, - r = (r = r + Math.imul(b, W) | 0) + Math.imul(E, H) | 0, - o = o + Math.imul(E, W) | 0, - n = n + Math.imul(_, Y) | 0, - r = (r = r + Math.imul(_, K) | 0) + Math.imul(v, Y) | 0, - o = o + Math.imul(v, K) | 0, - n = n + Math.imul(p, q) | 0, - r = (r = r + Math.imul(p, Z) | 0) + Math.imul(m, q) | 0, - o = o + Math.imul(m, Z) | 0; - var be = (u + (n = n + Math.imul(h, $) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, ee) | 0) + Math.imul(f, $) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, ee) | 0) + (r >>> 13) | 0) + (be >>> 26) | 0, - be &= 67108863, - n = Math.imul(C, G), - r = (r = Math.imul(C, z)) + Math.imul(P, G) | 0, - o = Math.imul(P, z), - n = n + Math.imul(A, H) | 0, - r = (r = r + Math.imul(A, W) | 0) + Math.imul(x, H) | 0, - o = o + Math.imul(x, W) | 0, - n = n + Math.imul(b, Y) | 0, - r = (r = r + Math.imul(b, K) | 0) + Math.imul(E, Y) | 0, - o = o + Math.imul(E, K) | 0, - n = n + Math.imul(_, q) | 0, - r = (r = r + Math.imul(_, Z) | 0) + Math.imul(v, q) | 0, - o = o + Math.imul(v, Z) | 0, - n = n + Math.imul(p, $) | 0, - r = (r = r + Math.imul(p, ee) | 0) + Math.imul(m, $) | 0, - o = o + Math.imul(m, ee) | 0; - var Ee = (u + (n = n + Math.imul(h, ie) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, ne) | 0) + Math.imul(f, ie) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, ne) | 0) + (r >>> 13) | 0) + (Ee >>> 26) | 0, - Ee &= 67108863, - n = Math.imul(M, G), - r = (r = Math.imul(M, z)) + Math.imul(O, G) | 0, - o = Math.imul(O, z), - n = n + Math.imul(C, H) | 0, - r = (r = r + Math.imul(C, W) | 0) + Math.imul(P, H) | 0, - o = o + Math.imul(P, W) | 0, - n = n + Math.imul(A, Y) | 0, - r = (r = r + Math.imul(A, K) | 0) + Math.imul(x, Y) | 0, - o = o + Math.imul(x, K) | 0, - n = n + Math.imul(b, q) | 0, - r = (r = r + Math.imul(b, Z) | 0) + Math.imul(E, q) | 0, - o = o + Math.imul(E, Z) | 0, - n = n + Math.imul(_, $) | 0, - r = (r = r + Math.imul(_, ee) | 0) + Math.imul(v, $) | 0, - o = o + Math.imul(v, ee) | 0, - n = n + Math.imul(p, ie) | 0, - r = (r = r + Math.imul(p, ne) | 0) + Math.imul(m, ie) | 0, - o = o + Math.imul(m, ne) | 0; - var Te = (u + (n = n + Math.imul(h, oe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, ae) | 0) + Math.imul(f, oe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, ae) | 0) + (r >>> 13) | 0) + (Te >>> 26) | 0, - Te &= 67108863, - n = Math.imul(I, G), - r = (r = Math.imul(I, z)) + Math.imul(D, G) | 0, - o = Math.imul(D, z), - n = n + Math.imul(M, H) | 0, - r = (r = r + Math.imul(M, W) | 0) + Math.imul(O, H) | 0, - o = o + Math.imul(O, W) | 0, - n = n + Math.imul(C, Y) | 0, - r = (r = r + Math.imul(C, K) | 0) + Math.imul(P, Y) | 0, - o = o + Math.imul(P, K) | 0, - n = n + Math.imul(A, q) | 0, - r = (r = r + Math.imul(A, Z) | 0) + Math.imul(x, q) | 0, - o = o + Math.imul(x, Z) | 0, - n = n + Math.imul(b, $) | 0, - r = (r = r + Math.imul(b, ee) | 0) + Math.imul(E, $) | 0, - o = o + Math.imul(E, ee) | 0, - n = n + Math.imul(_, ie) | 0, - r = (r = r + Math.imul(_, ne) | 0) + Math.imul(v, ie) | 0, - o = o + Math.imul(v, ne) | 0, - n = n + Math.imul(p, oe) | 0, - r = (r = r + Math.imul(p, ae) | 0) + Math.imul(m, oe) | 0, - o = o + Math.imul(m, ae) | 0; - var Ae = (u + (n = n + Math.imul(h, ce) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, ue) | 0) + Math.imul(f, ce) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, ue) | 0) + (r >>> 13) | 0) + (Ae >>> 26) | 0, - Ae &= 67108863, - n = Math.imul(F, G), - r = (r = Math.imul(F, z)) + Math.imul(B, G) | 0, - o = Math.imul(B, z), - n = n + Math.imul(I, H) | 0, - r = (r = r + Math.imul(I, W) | 0) + Math.imul(D, H) | 0, - o = o + Math.imul(D, W) | 0, - n = n + Math.imul(M, Y) | 0, - r = (r = r + Math.imul(M, K) | 0) + Math.imul(O, Y) | 0, - o = o + Math.imul(O, K) | 0, - n = n + Math.imul(C, q) | 0, - r = (r = r + Math.imul(C, Z) | 0) + Math.imul(P, q) | 0, - o = o + Math.imul(P, Z) | 0, - n = n + Math.imul(A, $) | 0, - r = (r = r + Math.imul(A, ee) | 0) + Math.imul(x, $) | 0, - o = o + Math.imul(x, ee) | 0, - n = n + Math.imul(b, ie) | 0, - r = (r = r + Math.imul(b, ne) | 0) + Math.imul(E, ie) | 0, - o = o + Math.imul(E, ne) | 0, - n = n + Math.imul(_, oe) | 0, - r = (r = r + Math.imul(_, ae) | 0) + Math.imul(v, oe) | 0, - o = o + Math.imul(v, ae) | 0, - n = n + Math.imul(p, ce) | 0, - r = (r = r + Math.imul(p, ue) | 0) + Math.imul(m, ce) | 0, - o = o + Math.imul(m, ue) | 0; - var xe = (u + (n = n + Math.imul(h, he) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, fe) | 0) + Math.imul(f, he) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, fe) | 0) + (r >>> 13) | 0) + (xe >>> 26) | 0, - xe &= 67108863, - n = Math.imul(k, G), - r = (r = Math.imul(k, z)) + Math.imul(U, G) | 0, - o = Math.imul(U, z), - n = n + Math.imul(F, H) | 0, - r = (r = r + Math.imul(F, W) | 0) + Math.imul(B, H) | 0, - o = o + Math.imul(B, W) | 0, - n = n + Math.imul(I, Y) | 0, - r = (r = r + Math.imul(I, K) | 0) + Math.imul(D, Y) | 0, - o = o + Math.imul(D, K) | 0, - n = n + Math.imul(M, q) | 0, - r = (r = r + Math.imul(M, Z) | 0) + Math.imul(O, q) | 0, - o = o + Math.imul(O, Z) | 0, - n = n + Math.imul(C, $) | 0, - r = (r = r + Math.imul(C, ee) | 0) + Math.imul(P, $) | 0, - o = o + Math.imul(P, ee) | 0, - n = n + Math.imul(A, ie) | 0, - r = (r = r + Math.imul(A, ne) | 0) + Math.imul(x, ie) | 0, - o = o + Math.imul(x, ne) | 0, - n = n + Math.imul(b, oe) | 0, - r = (r = r + Math.imul(b, ae) | 0) + Math.imul(E, oe) | 0, - o = o + Math.imul(E, ae) | 0, - n = n + Math.imul(_, ce) | 0, - r = (r = r + Math.imul(_, ue) | 0) + Math.imul(v, ce) | 0, - o = o + Math.imul(v, ue) | 0, - n = n + Math.imul(p, he) | 0, - r = (r = r + Math.imul(p, fe) | 0) + Math.imul(m, he) | 0, - o = o + Math.imul(m, fe) | 0; - var Se = (u + (n = n + Math.imul(h, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(h, me) | 0) + Math.imul(f, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(f, me) | 0) + (r >>> 13) | 0) + (Se >>> 26) | 0, - Se &= 67108863, - n = Math.imul(k, H), - r = (r = Math.imul(k, W)) + Math.imul(U, H) | 0, - o = Math.imul(U, W), - n = n + Math.imul(F, Y) | 0, - r = (r = r + Math.imul(F, K) | 0) + Math.imul(B, Y) | 0, - o = o + Math.imul(B, K) | 0, - n = n + Math.imul(I, q) | 0, - r = (r = r + Math.imul(I, Z) | 0) + Math.imul(D, q) | 0, - o = o + Math.imul(D, Z) | 0, - n = n + Math.imul(M, $) | 0, - r = (r = r + Math.imul(M, ee) | 0) + Math.imul(O, $) | 0, - o = o + Math.imul(O, ee) | 0, - n = n + Math.imul(C, ie) | 0, - r = (r = r + Math.imul(C, ne) | 0) + Math.imul(P, ie) | 0, - o = o + Math.imul(P, ne) | 0, - n = n + Math.imul(A, oe) | 0, - r = (r = r + Math.imul(A, ae) | 0) + Math.imul(x, oe) | 0, - o = o + Math.imul(x, ae) | 0, - n = n + Math.imul(b, ce) | 0, - r = (r = r + Math.imul(b, ue) | 0) + Math.imul(E, ce) | 0, - o = o + Math.imul(E, ue) | 0, - n = n + Math.imul(_, he) | 0, - r = (r = r + Math.imul(_, fe) | 0) + Math.imul(v, he) | 0, - o = o + Math.imul(v, fe) | 0; - var Ce = (u + (n = n + Math.imul(p, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(p, me) | 0) + Math.imul(m, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(m, me) | 0) + (r >>> 13) | 0) + (Ce >>> 26) | 0, - Ce &= 67108863, - n = Math.imul(k, Y), - r = (r = Math.imul(k, K)) + Math.imul(U, Y) | 0, - o = Math.imul(U, K), - n = n + Math.imul(F, q) | 0, - r = (r = r + Math.imul(F, Z) | 0) + Math.imul(B, q) | 0, - o = o + Math.imul(B, Z) | 0, - n = n + Math.imul(I, $) | 0, - r = (r = r + Math.imul(I, ee) | 0) + Math.imul(D, $) | 0, - o = o + Math.imul(D, ee) | 0, - n = n + Math.imul(M, ie) | 0, - r = (r = r + Math.imul(M, ne) | 0) + Math.imul(O, ie) | 0, - o = o + Math.imul(O, ne) | 0, - n = n + Math.imul(C, oe) | 0, - r = (r = r + Math.imul(C, ae) | 0) + Math.imul(P, oe) | 0, - o = o + Math.imul(P, ae) | 0, - n = n + Math.imul(A, ce) | 0, - r = (r = r + Math.imul(A, ue) | 0) + Math.imul(x, ce) | 0, - o = o + Math.imul(x, ue) | 0, - n = n + Math.imul(b, he) | 0, - r = (r = r + Math.imul(b, fe) | 0) + Math.imul(E, he) | 0, - o = o + Math.imul(E, fe) | 0; - var Pe = (u + (n = n + Math.imul(_, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(_, me) | 0) + Math.imul(v, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(v, me) | 0) + (r >>> 13) | 0) + (Pe >>> 26) | 0, - Pe &= 67108863, - n = Math.imul(k, q), - r = (r = Math.imul(k, Z)) + Math.imul(U, q) | 0, - o = Math.imul(U, Z), - n = n + Math.imul(F, $) | 0, - r = (r = r + Math.imul(F, ee) | 0) + Math.imul(B, $) | 0, - o = o + Math.imul(B, ee) | 0, - n = n + Math.imul(I, ie) | 0, - r = (r = r + Math.imul(I, ne) | 0) + Math.imul(D, ie) | 0, - o = o + Math.imul(D, ne) | 0, - n = n + Math.imul(M, oe) | 0, - r = (r = r + Math.imul(M, ae) | 0) + Math.imul(O, oe) | 0, - o = o + Math.imul(O, ae) | 0, - n = n + Math.imul(C, ce) | 0, - r = (r = r + Math.imul(C, ue) | 0) + Math.imul(P, ce) | 0, - o = o + Math.imul(P, ue) | 0, - n = n + Math.imul(A, he) | 0, - r = (r = r + Math.imul(A, fe) | 0) + Math.imul(x, he) | 0, - o = o + Math.imul(x, fe) | 0; - var Re = (u + (n = n + Math.imul(b, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(b, me) | 0) + Math.imul(E, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(E, me) | 0) + (r >>> 13) | 0) + (Re >>> 26) | 0, - Re &= 67108863, - n = Math.imul(k, $), - r = (r = Math.imul(k, ee)) + Math.imul(U, $) | 0, - o = Math.imul(U, ee), - n = n + Math.imul(F, ie) | 0, - r = (r = r + Math.imul(F, ne) | 0) + Math.imul(B, ie) | 0, - o = o + Math.imul(B, ne) | 0, - n = n + Math.imul(I, oe) | 0, - r = (r = r + Math.imul(I, ae) | 0) + Math.imul(D, oe) | 0, - o = o + Math.imul(D, ae) | 0, - n = n + Math.imul(M, ce) | 0, - r = (r = r + Math.imul(M, ue) | 0) + Math.imul(O, ce) | 0, - o = o + Math.imul(O, ue) | 0, - n = n + Math.imul(C, he) | 0, - r = (r = r + Math.imul(C, fe) | 0) + Math.imul(P, he) | 0, - o = o + Math.imul(P, fe) | 0; - var Me = (u + (n = n + Math.imul(A, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(A, me) | 0) + Math.imul(x, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(x, me) | 0) + (r >>> 13) | 0) + (Me >>> 26) | 0, - Me &= 67108863, - n = Math.imul(k, ie), - r = (r = Math.imul(k, ne)) + Math.imul(U, ie) | 0, - o = Math.imul(U, ne), - n = n + Math.imul(F, oe) | 0, - r = (r = r + Math.imul(F, ae) | 0) + Math.imul(B, oe) | 0, - o = o + Math.imul(B, ae) | 0, - n = n + Math.imul(I, ce) | 0, - r = (r = r + Math.imul(I, ue) | 0) + Math.imul(D, ce) | 0, - o = o + Math.imul(D, ue) | 0, - n = n + Math.imul(M, he) | 0, - r = (r = r + Math.imul(M, fe) | 0) + Math.imul(O, he) | 0, - o = o + Math.imul(O, fe) | 0; - var Oe = (u + (n = n + Math.imul(C, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(C, me) | 0) + Math.imul(P, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(P, me) | 0) + (r >>> 13) | 0) + (Oe >>> 26) | 0, - Oe &= 67108863, - n = Math.imul(k, oe), - r = (r = Math.imul(k, ae)) + Math.imul(U, oe) | 0, - o = Math.imul(U, ae), - n = n + Math.imul(F, ce) | 0, - r = (r = r + Math.imul(F, ue) | 0) + Math.imul(B, ce) | 0, - o = o + Math.imul(B, ue) | 0, - n = n + Math.imul(I, he) | 0, - r = (r = r + Math.imul(I, fe) | 0) + Math.imul(D, he) | 0, - o = o + Math.imul(D, fe) | 0; - var we = (u + (n = n + Math.imul(M, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(M, me) | 0) + Math.imul(O, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(O, me) | 0) + (r >>> 13) | 0) + (we >>> 26) | 0, - we &= 67108863, - n = Math.imul(k, ce), - r = (r = Math.imul(k, ue)) + Math.imul(U, ce) | 0, - o = Math.imul(U, ue), - n = n + Math.imul(F, he) | 0, - r = (r = r + Math.imul(F, fe) | 0) + Math.imul(B, he) | 0, - o = o + Math.imul(B, fe) | 0; - var Ie = (u + (n = n + Math.imul(I, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(I, me) | 0) + Math.imul(D, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(D, me) | 0) + (r >>> 13) | 0) + (Ie >>> 26) | 0, - Ie &= 67108863, - n = Math.imul(k, he), - r = (r = Math.imul(k, fe)) + Math.imul(U, he) | 0, - o = Math.imul(U, fe); - var De = (u + (n = n + Math.imul(F, pe) | 0) | 0) + ((8191 & (r = (r = r + Math.imul(F, me) | 0) + Math.imul(B, pe) | 0)) << 13) | 0; - u = ((o = o + Math.imul(B, me) | 0) + (r >>> 13) | 0) + (De >>> 26) | 0, - De &= 67108863; - var Le = (u + (n = Math.imul(k, pe)) | 0) + ((8191 & (r = (r = Math.imul(k, me)) + Math.imul(U, pe) | 0)) << 13) | 0; - return u = ((o = Math.imul(U, me)) + (r >>> 13) | 0) + (Le >>> 26) | 0, - Le &= 67108863, - c[0] = ge, - c[1] = _e, - c[2] = ve, - c[3] = ye, - c[4] = be, - c[5] = Ee, - c[6] = Te, - c[7] = Ae, - c[8] = xe, - c[9] = Se, - c[10] = Ce, - c[11] = Pe, - c[12] = Re, - c[13] = Me, - c[14] = Oe, - c[15] = we, - c[16] = Ie, - c[17] = De, - c[18] = Le, - 0 !== u && (c[19] = u, - i.length++), - i - }; - function m(e, t, i) { - return (new g).mulp(e, t, i) - } - function g(e, t) { - this.x = e, - this.y = t - } - Math.imul || (p = d), - a.prototype.mulTo = function(e, t) { - var i = this.length + e.length; - return 10 === this.length && 10 === e.length ? p(this, e, t) : i < 63 ? d(this, e, t) : i < 1024 ? function(e, t, i) { - i.negative = t.negative ^ e.negative, - i.length = e.length + t.length; - for (var n = 0, r = 0, o = 0; o < i.length - 1; o++) { - var a = r; - r = 0; - for (var s = 67108863 & n, c = Math.min(o, t.length - 1), u = Math.max(0, o - e.length + 1); u <= c; u++) { - var l = o - u - , h = (0 | e.words[l]) * (0 | t.words[u]) - , f = 67108863 & h; - s = 67108863 & (f = f + s | 0), - r += (a = (a = a + (h / 67108864 | 0) | 0) + (f >>> 26) | 0) >>> 26, - a &= 67108863 - } - i.words[o] = s, - n = a, - a = r - } - return 0 !== n ? i.words[o] = n : i.length--, - i.strip() - }(this, e, t) : m(this, e, t) - } - , - g.prototype.makeRBT = function(e) { - for (var t = new Array(e), i = a.prototype._countBits(e) - 1, n = 0; n < e; n++) - t[n] = this.revBin(n, i, e); - return t - } - , - g.prototype.revBin = function(e, t, i) { - if (0 === e || e === i - 1) - return e; - for (var n = 0, r = 0; r < t; r++) - n |= (1 & e) << t - r - 1, - e >>= 1; - return n - } - , - g.prototype.permute = function(e, t, i, n, r, o) { - for (var a = 0; a < o; a++) - n[a] = t[e[a]], - r[a] = i[e[a]] - } - , - g.prototype.transform = function(e, t, i, n, r, o) { - this.permute(o, e, t, i, n, r); - for (var a = 1; a < r; a <<= 1) - for (var s = a << 1, c = Math.cos(2 * Math.PI / s), u = Math.sin(2 * Math.PI / s), l = 0; l < r; l += s) - for (var h = c, f = u, d = 0; d < a; d++) { - var p = i[l + d] - , m = n[l + d] - , g = i[l + d + a] - , _ = n[l + d + a] - , v = h * g - f * _; - _ = h * _ + f * g, - g = v, - i[l + d] = p + g, - n[l + d] = m + _, - i[l + d + a] = p - g, - n[l + d + a] = m - _, - d !== s && (v = c * h - u * f, - f = c * f + u * h, - h = v) - } - } - , - g.prototype.guessLen13b = function(e, t) { - var i = 1 | Math.max(t, e) - , n = 1 & i - , r = 0; - for (i = i / 2 | 0; i; i >>>= 1) - r++; - return 1 << r + 1 + n - } - , - g.prototype.conjugate = function(e, t, i) { - if (!(i <= 1)) - for (var n = 0; n < i / 2; n++) { - var r = e[n]; - e[n] = e[i - n - 1], - e[i - n - 1] = r, - r = t[n], - t[n] = -t[i - n - 1], - t[i - n - 1] = -r - } - } - , - g.prototype.normalize13b = function(e, t) { - for (var i = 0, n = 0; n < t / 2; n++) { - var r = 8192 * Math.round(e[2 * n + 1] / t) + Math.round(e[2 * n] / t) + i; - e[n] = 67108863 & r, - i = r < 67108864 ? 0 : r / 67108864 | 0 - } - return e - } - , - g.prototype.convert13b = function(e, t, i, n) { - for (var o = 0, a = 0; a < t; a++) - o += 0 | e[a], - i[2 * a] = 8191 & o, - o >>>= 13, - i[2 * a + 1] = 8191 & o, - o >>>= 13; - for (a = 2 * t; a < n; ++a) - i[a] = 0; - r(0 === o), - r(0 == (-8192 & o)) - } - , - g.prototype.stub = function(e) { - for (var t = new Array(e), i = 0; i < e; i++) - t[i] = 0; - return t - } - , - g.prototype.mulp = function(e, t, i) { - var n = 2 * this.guessLen13b(e.length, t.length) - , r = this.makeRBT(n) - , o = this.stub(n) - , a = new Array(n) - , s = new Array(n) - , c = new Array(n) - , u = new Array(n) - , l = new Array(n) - , h = new Array(n) - , f = i.words; - f.length = n, - this.convert13b(e.words, e.length, a, n), - this.convert13b(t.words, t.length, u, n), - this.transform(a, o, s, c, n, r), - this.transform(u, o, l, h, n, r); - for (var d = 0; d < n; d++) { - var p = s[d] * l[d] - c[d] * h[d]; - c[d] = s[d] * h[d] + c[d] * l[d], - s[d] = p - } - return this.conjugate(s, c, n), - this.transform(s, c, f, o, n, r), - this.conjugate(f, o, n), - this.normalize13b(f, n), - i.negative = e.negative ^ t.negative, - i.length = e.length + t.length, - i.strip() - } - , - a.prototype.mul = function(e) { - var t = new a(null); - return t.words = new Array(this.length + e.length), - this.mulTo(e, t) - } - , - a.prototype.mulf = function(e) { - var t = new a(null); - return t.words = new Array(this.length + e.length), - m(this, e, t) - } - , - a.prototype.imul = function(e) { - return this.clone().mulTo(e, this) - } - , - a.prototype.imuln = function(e) { - r("number" == typeof e), - r(e < 67108864); - for (var t = 0, i = 0; i < this.length; i++) { - var n = (0 | this.words[i]) * e - , o = (67108863 & n) + (67108863 & t); - t >>= 26, - t += n / 67108864 | 0, - t += o >>> 26, - this.words[i] = 67108863 & o - } - return 0 !== t && (this.words[i] = t, - this.length++), - this - } - , - a.prototype.muln = function(e) { - return this.clone().imuln(e) - } - , - a.prototype.sqr = function() { - return this.mul(this) - } - , - a.prototype.isqr = function() { - return this.imul(this.clone()) - } - , - a.prototype.pow = function(e) { - var t = function(e) { - for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) { - var n = i / 26 | 0 - , r = i % 26; - t[i] = (e.words[n] & 1 << r) >>> r - } - return t - }(e); - if (0 === t.length) - return new a(1); - for (var i = this, n = 0; n < t.length && 0 === t[n]; n++, - i = i.sqr()) - ; - if (++n < t.length) - for (var r = i.sqr(); n < t.length; n++, - r = r.sqr()) - 0 !== t[n] && (i = i.mul(r)); - return i - } - , - a.prototype.iushln = function(e) { - r("number" == typeof e && e >= 0); - var t, i = e % 26, n = (e - i) / 26, o = 67108863 >>> 26 - i << 26 - i; - if (0 !== i) { - var a = 0; - for (t = 0; t < this.length; t++) { - var s = this.words[t] & o - , c = (0 | this.words[t]) - s << i; - this.words[t] = c | a, - a = s >>> 26 - i - } - a && (this.words[t] = a, - this.length++) - } - if (0 !== n) { - for (t = this.length - 1; t >= 0; t--) - this.words[t + n] = this.words[t]; - for (t = 0; t < n; t++) - this.words[t] = 0; - this.length += n - } - return this.strip() - } - , - a.prototype.ishln = function(e) { - return r(0 === this.negative), - this.iushln(e) - } - , - a.prototype.iushrn = function(e, t, i) { - var n; - r("number" == typeof e && e >= 0), - n = t ? (t - t % 26) / 26 : 0; - var o = e % 26 - , a = Math.min((e - o) / 26, this.length) - , s = 67108863 ^ 67108863 >>> o << o - , c = i; - if (n -= a, - n = Math.max(0, n), - c) { - for (var u = 0; u < a; u++) - c.words[u] = this.words[u]; - c.length = a - } - if (0 === a) - ; - else if (this.length > a) - for (this.length -= a, - u = 0; u < this.length; u++) - this.words[u] = this.words[u + a]; - else - this.words[0] = 0, - this.length = 1; - var l = 0; - for (u = this.length - 1; u >= 0 && (0 !== l || u >= n); u--) { - var h = 0 | this.words[u]; - this.words[u] = l << 26 - o | h >>> o, - l = h & s - } - return c && 0 !== l && (c.words[c.length++] = l), - 0 === this.length && (this.words[0] = 0, - this.length = 1), - this.strip() - } - , - a.prototype.ishrn = function(e, t, i) { - return r(0 === this.negative), - this.iushrn(e, t, i) - } - , - a.prototype.shln = function(e) { - return this.clone().ishln(e) - } - , - a.prototype.ushln = function(e) { - return this.clone().iushln(e) - } - , - a.prototype.shrn = function(e) { - return this.clone().ishrn(e) - } - , - a.prototype.ushrn = function(e) { - return this.clone().iushrn(e) - } - , - a.prototype.testn = function(e) { - r("number" == typeof e && e >= 0); - var t = e % 26 - , i = (e - t) / 26 - , n = 1 << t; - return !(this.length <= i) && !!(this.words[i] & n) - } - , - a.prototype.imaskn = function(e) { - r("number" == typeof e && e >= 0); - var t = e % 26 - , i = (e - t) / 26; - if (r(0 === this.negative, "imaskn works only with positive numbers"), - this.length <= i) - return this; - if (0 !== t && i++, - this.length = Math.min(i, this.length), - 0 !== t) { - var n = 67108863 ^ 67108863 >>> t << t; - this.words[this.length - 1] &= n - } - return this.strip() - } - , - a.prototype.maskn = function(e) { - return this.clone().imaskn(e) - } - , - a.prototype.iaddn = function(e) { - return r("number" == typeof e), - r(e < 67108864), - e < 0 ? this.isubn(-e) : 0 !== this.negative ? 1 === this.length && (0 | this.words[0]) < e ? (this.words[0] = e - (0 | this.words[0]), - this.negative = 0, - this) : (this.negative = 0, - this.isubn(e), - this.negative = 1, - this) : this._iaddn(e) - } - , - a.prototype._iaddn = function(e) { - this.words[0] += e; - for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) - this.words[t] -= 67108864, - t === this.length - 1 ? this.words[t + 1] = 1 : this.words[t + 1]++; - return this.length = Math.max(this.length, t + 1), - this - } - , - a.prototype.isubn = function(e) { - if (r("number" == typeof e), - r(e < 67108864), - e < 0) - return this.iaddn(-e); - if (0 !== this.negative) - return this.negative = 0, - this.iaddn(e), - this.negative = 1, - this; - if (this.words[0] -= e, - 1 === this.length && this.words[0] < 0) - this.words[0] = -this.words[0], - this.negative = 1; - else - for (var t = 0; t < this.length && this.words[t] < 0; t++) - this.words[t] += 67108864, - this.words[t + 1] -= 1; - return this.strip() - } - , - a.prototype.addn = function(e) { - return this.clone().iaddn(e) - } - , - a.prototype.subn = function(e) { - return this.clone().isubn(e) - } - , - a.prototype.iabs = function() { - return this.negative = 0, - this - } - , - a.prototype.abs = function() { - return this.clone().iabs() - } - , - a.prototype._ishlnsubmul = function(e, t, i) { - var n, o, a = e.length + i; - this._expand(a); - var s = 0; - for (n = 0; n < e.length; n++) { - o = (0 | this.words[n + i]) + s; - var c = (0 | e.words[n]) * t; - s = ((o -= 67108863 & c) >> 26) - (c / 67108864 | 0), - this.words[n + i] = 67108863 & o - } - for (; n < this.length - i; n++) - s = (o = (0 | this.words[n + i]) + s) >> 26, - this.words[n + i] = 67108863 & o; - if (0 === s) - return this.strip(); - for (r(-1 === s), - s = 0, - n = 0; n < this.length; n++) - s = (o = -(0 | this.words[n]) + s) >> 26, - this.words[n] = 67108863 & o; - return this.negative = 1, - this.strip() - } - , - a.prototype._wordDiv = function(e, t) { - var i = (this.length, - e.length) - , n = this.clone() - , r = e - , o = 0 | r.words[r.length - 1]; - 0 !== (i = 26 - this._countBits(o)) && (r = r.ushln(i), - n.iushln(i), - o = 0 | r.words[r.length - 1]); - var s, c = n.length - r.length; - if ("mod" !== t) { - (s = new a(null)).length = c + 1, - s.words = new Array(s.length); - for (var u = 0; u < s.length; u++) - s.words[u] = 0 - } - var l = n.clone()._ishlnsubmul(r, 1, c); - 0 === l.negative && (n = l, - s && (s.words[c] = 1)); - for (var h = c - 1; h >= 0; h--) { - var f = 67108864 * (0 | n.words[r.length + h]) + (0 | n.words[r.length + h - 1]); - for (f = Math.min(f / o | 0, 67108863), - n._ishlnsubmul(r, f, h); 0 !== n.negative; ) - f--, - n.negative = 0, - n._ishlnsubmul(r, 1, h), - n.isZero() || (n.negative ^= 1); - s && (s.words[h] = f) - } - return s && s.strip(), - n.strip(), - "div" !== t && 0 !== i && n.iushrn(i), - { - div: s || null, - mod: n - } - } - , - a.prototype.divmod = function(e, t, i) { - return r(!e.isZero()), - this.isZero() ? { - div: new a(0), - mod: new a(0) - } : 0 !== this.negative && 0 === e.negative ? (s = this.neg().divmod(e, t), - "mod" !== t && (n = s.div.neg()), - "div" !== t && (o = s.mod.neg(), - i && 0 !== o.negative && o.iadd(e)), - { - div: n, - mod: o - }) : 0 === this.negative && 0 !== e.negative ? (s = this.divmod(e.neg(), t), - "mod" !== t && (n = s.div.neg()), - { - div: n, - mod: s.mod - }) : 0 != (this.negative & e.negative) ? (s = this.neg().divmod(e.neg(), t), - "div" !== t && (o = s.mod.neg(), - i && 0 !== o.negative && o.isub(e)), - { - div: s.div, - mod: o - }) : e.length > this.length || this.cmp(e) < 0 ? { - div: new a(0), - mod: this - } : 1 === e.length ? "div" === t ? { - div: this.divn(e.words[0]), - mod: null - } : "mod" === t ? { - div: null, - mod: new a(this.modn(e.words[0])) - } : { - div: this.divn(e.words[0]), - mod: new a(this.modn(e.words[0])) - } : this._wordDiv(e, t); - var n, o, s - } - , - a.prototype.div = function(e) { - return this.divmod(e, "div", false).div - } - , - a.prototype.mod = function(e) { - return this.divmod(e, "mod", false).mod - } - , - a.prototype.umod = function(e) { - return this.divmod(e, "mod", true).mod - } - , - a.prototype.divRound = function(e) { - var t = this.divmod(e); - if (t.mod.isZero()) - return t.div; - var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod - , n = e.ushrn(1) - , r = e.andln(1) - , o = i.cmp(n); - return o < 0 || 1 === r && 0 === o ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn(1) - } - , - a.prototype.modn = function(e) { - r(e <= 67108863); - for (var t = (1 << 26) % e, i = 0, n = this.length - 1; n >= 0; n--) - i = (t * i + (0 | this.words[n])) % e; - return i - } - , - a.prototype.idivn = function(e) { - r(e <= 67108863); - for (var t = 0, i = this.length - 1; i >= 0; i--) { - var n = (0 | this.words[i]) + 67108864 * t; - this.words[i] = n / e | 0, - t = n % e - } - return this.strip() - } - , - a.prototype.divn = function(e) { - return this.clone().idivn(e) - } - , - a.prototype.egcd = function(e) { - r(0 === e.negative), - r(!e.isZero()); - var t = this - , i = e.clone(); - t = 0 !== t.negative ? t.umod(e) : t.clone(); - for (var n = new a(1), o = new a(0), s = new a(0), c = new a(1), u = 0; t.isEven() && i.isEven(); ) - t.iushrn(1), - i.iushrn(1), - ++u; - for (var l = i.clone(), h = t.clone(); !t.isZero(); ) { - for (var f = 0, d = 1; 0 == (t.words[0] & d) && f < 26; ++f, - d <<= 1) - ; - if (f > 0) - for (t.iushrn(f); f-- > 0; ) - (n.isOdd() || o.isOdd()) && (n.iadd(l), - o.isub(h)), - n.iushrn(1), - o.iushrn(1); - for (var p = 0, m = 1; 0 == (i.words[0] & m) && p < 26; ++p, - m <<= 1) - ; - if (p > 0) - for (i.iushrn(p); p-- > 0; ) - (s.isOdd() || c.isOdd()) && (s.iadd(l), - c.isub(h)), - s.iushrn(1), - c.iushrn(1); - t.cmp(i) >= 0 ? (t.isub(i), - n.isub(s), - o.isub(c)) : (i.isub(t), - s.isub(n), - c.isub(o)) - } - return { - a: s, - b: c, - gcd: i.iushln(u) - } - } - , - a.prototype._invmp = function(e) { - r(0 === e.negative), - r(!e.isZero()); - var t = this - , i = e.clone(); - t = 0 !== t.negative ? t.umod(e) : t.clone(); - for (var n, o = new a(1), s = new a(0), c = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0; ) { - for (var u = 0, l = 1; 0 == (t.words[0] & l) && u < 26; ++u, - l <<= 1) - ; - if (u > 0) - for (t.iushrn(u); u-- > 0; ) - o.isOdd() && o.iadd(c), - o.iushrn(1); - for (var h = 0, f = 1; 0 == (i.words[0] & f) && h < 26; ++h, - f <<= 1) - ; - if (h > 0) - for (i.iushrn(h); h-- > 0; ) - s.isOdd() && s.iadd(c), - s.iushrn(1); - t.cmp(i) >= 0 ? (t.isub(i), - o.isub(s)) : (i.isub(t), - s.isub(o)) - } - return (n = 0 === t.cmpn(1) ? o : s).cmpn(0) < 0 && n.iadd(e), - n - } - , - a.prototype.gcd = function(e) { - if (this.isZero()) - return e.abs(); - if (e.isZero()) - return this.abs(); - var t = this.clone() - , i = e.clone(); - t.negative = 0, - i.negative = 0; - for (var n = 0; t.isEven() && i.isEven(); n++) - t.iushrn(1), - i.iushrn(1); - for (; ; ) { - for (; t.isEven(); ) - t.iushrn(1); - for (; i.isEven(); ) - i.iushrn(1); - var r = t.cmp(i); - if (r < 0) { - var o = t; - t = i, - i = o - } else if (0 === r || 0 === i.cmpn(1)) - break; - t.isub(i) - } - return i.iushln(n) - } - , - a.prototype.invm = function(e) { - return this.egcd(e).a.umod(e) - } - , - a.prototype.isEven = function() { - return 0 == (1 & this.words[0]) - } - , - a.prototype.isOdd = function() { - return 1 == (1 & this.words[0]) - } - , - a.prototype.andln = function(e) { - return this.words[0] & e - } - , - a.prototype.bincn = function(e) { - r("number" == typeof e); - var t = e % 26 - , i = (e - t) / 26 - , n = 1 << t; - if (this.length <= i) - return this._expand(i + 1), - this.words[i] |= n, - this; - for (var o = n, a = i; 0 !== o && a < this.length; a++) { - var s = 0 | this.words[a]; - o = (s += o) >>> 26, - s &= 67108863, - this.words[a] = s - } - return 0 !== o && (this.words[a] = o, - this.length++), - this - } - , - a.prototype.isZero = function() { - return 1 === this.length && 0 === this.words[0] - } - , - a.prototype.cmpn = function(e) { - var t, i = e < 0; - if (0 !== this.negative && !i) - return -1; - if (0 === this.negative && i) - return 1; - if (this.strip(), - this.length > 1) - t = 1; - else { - i && (e = -e), - r(e <= 67108863, "Number is too big"); - var n = 0 | this.words[0]; - t = n === e ? 0 : n < e ? -1 : 1 - } - return 0 !== this.negative ? 0 | -t : t - } - , - a.prototype.cmp = function(e) { - if (0 !== this.negative && 0 === e.negative) - return -1; - if (0 === this.negative && 0 !== e.negative) - return 1; - var t = this.ucmp(e); - return 0 !== this.negative ? 0 | -t : t - } - , - a.prototype.ucmp = function(e) { - if (this.length > e.length) - return 1; - if (this.length < e.length) - return -1; - for (var t = 0, i = this.length - 1; i >= 0; i--) { - var n = 0 | this.words[i] - , r = 0 | e.words[i]; - if (n !== r) { - n < r ? t = -1 : n > r && (t = 1); - break - } - } - return t - } - , - a.prototype.gtn = function(e) { - return 1 === this.cmpn(e) - } - , - a.prototype.gt = function(e) { - return 1 === this.cmp(e) - } - , - a.prototype.gten = function(e) { - return this.cmpn(e) >= 0 - } - , - a.prototype.gte = function(e) { - return this.cmp(e) >= 0 - } - , - a.prototype.ltn = function(e) { - return -1 === this.cmpn(e) - } - , - a.prototype.lt = function(e) { - return -1 === this.cmp(e) - } - , - a.prototype.lten = function(e) { - return this.cmpn(e) <= 0 - } - , - a.prototype.lte = function(e) { - return this.cmp(e) <= 0 - } - , - a.prototype.eqn = function(e) { - return 0 === this.cmpn(e) - } - , - a.prototype.eq = function(e) { - return 0 === this.cmp(e) - } - , - a.red = function(e) { - return new A(e) - } - , - a.prototype.toRed = function(e) { - return r(!this.red, "Already a number in reduction context"), - r(0 === this.negative, "red works only with positives"), - e.convertTo(this)._forceRed(e) - } - , - a.prototype.fromRed = function() { - return r(this.red, "fromRed works only with numbers in reduction context"), - this.red.convertFrom(this) - } - , - a.prototype._forceRed = function(e) { - return this.red = e, - this - } - , - a.prototype.forceRed = function(e) { - return r(!this.red, "Already a number in reduction context"), - this._forceRed(e) - } - , - a.prototype.redAdd = function(e) { - return r(this.red, "redAdd works only with red numbers"), - this.red.add(this, e) - } - , - a.prototype.redIAdd = function(e) { - return r(this.red, "redIAdd works only with red numbers"), - this.red.iadd(this, e) - } - , - a.prototype.redSub = function(e) { - return r(this.red, "redSub works only with red numbers"), - this.red.sub(this, e) - } - , - a.prototype.redISub = function(e) { - return r(this.red, "redISub works only with red numbers"), - this.red.isub(this, e) - } - , - a.prototype.redShl = function(e) { - return r(this.red, "redShl works only with red numbers"), - this.red.shl(this, e) - } - , - a.prototype.redMul = function(e) { - return r(this.red, "redMul works only with red numbers"), - this.red._verify2(this, e), - this.red.mul(this, e) - } - , - a.prototype.redIMul = function(e) { - return r(this.red, "redMul works only with red numbers"), - this.red._verify2(this, e), - this.red.imul(this, e) - } - , - a.prototype.redSqr = function() { - return r(this.red, "redSqr works only with red numbers"), - this.red._verify1(this), - this.red.sqr(this) - } - , - a.prototype.redISqr = function() { - return r(this.red, "redISqr works only with red numbers"), - this.red._verify1(this), - this.red.isqr(this) - } - , - a.prototype.redSqrt = function() { - return r(this.red, "redSqrt works only with red numbers"), - this.red._verify1(this), - this.red.sqrt(this) - } - , - a.prototype.redInvm = function() { - return r(this.red, "redInvm works only with red numbers"), - this.red._verify1(this), - this.red.invm(this) - } - , - a.prototype.redNeg = function() { - return r(this.red, "redNeg works only with red numbers"), - this.red._verify1(this), - this.red.neg(this) - } - , - a.prototype.redPow = function(e) { - return r(this.red && !e.red, "redPow(normalNum)"), - this.red._verify1(this), - this.red.pow(this, e) - } - ; - var _ = { - k256: null, - p224: null, - p192: null, - p25519: null - }; - function v(e, t) { - this.name = e, - this.p = new a(t,16), - this.n = this.p.bitLength(), - this.k = new a(1).iushln(this.n).isub(this.p), - this.tmp = this._tmp() - } - function y() { - v.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f") - } - function b() { - v.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001") - } - function E() { - v.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff") - } - function T() { - v.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed") - } - function A(e) { - if ("string" == typeof e) { - var t = a._prime(e); - this.m = t.p, - this.prime = t - } else - r(e.gtn(1), "modulus must be greater than 1"), - this.m = e, - this.prime = null - } - function x(e) { - A.call(this, e), - this.shift = this.m.bitLength(), - this.shift % 26 != 0 && (this.shift += 26 - this.shift % 26), - this.r = new a(1).iushln(this.shift), - this.r2 = this.imod(this.r.sqr()), - this.rinv = this.r._invmp(this.m), - this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), - this.minv = this.minv.umod(this.r), - this.minv = this.r.sub(this.minv) - } - v.prototype._tmp = function() { - var e = new a(null); - return e.words = new Array(Math.ceil(this.n / 13)), - e - } - , - v.prototype.ireduce = function(e) { - var t, i = e; - do { - this.split(i, this.tmp), - t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength() - } while (t > this.n);var n = t < this.n ? -1 : i.ucmp(this.p); - return 0 === n ? (i.words[0] = 0, - i.length = 1) : n > 0 ? i.isub(this.p) : i.strip(), - i - } - , - v.prototype.split = function(e, t) { - e.iushrn(this.n, 0, t) - } - , - v.prototype.imulK = function(e) { - return e.imul(this.k) - } - , - o(y, v), - y.prototype.split = function(e, t) { - for (var i = Math.min(e.length, 9), n = 0; n < i; n++) - t.words[n] = e.words[n]; - if (t.length = i, - e.length <= 9) - return e.words[0] = 0, - void (e.length = 1); - var r = e.words[9]; - for (t.words[t.length++] = 4194303 & r, - n = 10; n < e.length; n++) { - var o = 0 | e.words[n]; - e.words[n - 10] = (4194303 & o) << 4 | r >>> 22, - r = o - } - r >>>= 22, - e.words[n - 10] = r, - 0 === r && e.length > 10 ? e.length -= 10 : e.length -= 9 - } - , - y.prototype.imulK = function(e) { - e.words[e.length] = 0, - e.words[e.length + 1] = 0, - e.length += 2; - for (var t = 0, i = 0; i < e.length; i++) { - var n = 0 | e.words[i]; - t += 977 * n, - e.words[i] = 67108863 & t, - t = 64 * n + (t / 67108864 | 0) - } - return 0 === e.words[e.length - 1] && (e.length--, - 0 === e.words[e.length - 1] && e.length--), - e - } - , - o(b, v), - o(E, v), - o(T, v), - T.prototype.imulK = function(e) { - for (var t = 0, i = 0; i < e.length; i++) { - var n = 19 * (0 | e.words[i]) + t - , r = 67108863 & n; - n >>>= 26, - e.words[i] = r, - t = n - } - return 0 !== t && (e.words[e.length++] = t), - e - } - , - a._prime = function(e) { - if (_[e]) - return _[e]; - var t; - if ("k256" === e) - t = new y; - else if ("p224" === e) - t = new b; - else if ("p192" === e) - t = new E; - else { - if ("p25519" !== e) - throw new Error("Unknown prime " + e); - t = new T - } - return _[e] = t, - t - } - , - A.prototype._verify1 = function(e) { - r(0 === e.negative, "red works only with positives"), - r(e.red, "red works only with red numbers") - } - , - A.prototype._verify2 = function(e, t) { - r(0 == (e.negative | t.negative), "red works only with positives"), - r(e.red && e.red === t.red, "red works only with red numbers") - } - , - A.prototype.imod = function(e) { - return this.prime ? this.prime.ireduce(e)._forceRed(this) : e.umod(this.m)._forceRed(this) - } - , - A.prototype.neg = function(e) { - return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this) - } - , - A.prototype.add = function(e, t) { - this._verify2(e, t); - var i = e.add(t); - return i.cmp(this.m) >= 0 && i.isub(this.m), - i._forceRed(this) - } - , - A.prototype.iadd = function(e, t) { - this._verify2(e, t); - var i = e.iadd(t); - return i.cmp(this.m) >= 0 && i.isub(this.m), - i - } - , - A.prototype.sub = function(e, t) { - this._verify2(e, t); - var i = e.sub(t); - return i.cmpn(0) < 0 && i.iadd(this.m), - i._forceRed(this) - } - , - A.prototype.isub = function(e, t) { - this._verify2(e, t); - var i = e.isub(t); - return i.cmpn(0) < 0 && i.iadd(this.m), - i - } - , - A.prototype.shl = function(e, t) { - return this._verify1(e), - this.imod(e.ushln(t)) - } - , - A.prototype.imul = function(e, t) { - return this._verify2(e, t), - this.imod(e.imul(t)) - } - , - A.prototype.mul = function(e, t) { - return this._verify2(e, t), - this.imod(e.mul(t)) - } - , - A.prototype.isqr = function(e) { - return this.imul(e, e.clone()) - } - , - A.prototype.sqr = function(e) { - return this.mul(e, e) - } - , - A.prototype.sqrt = function(e) { - if (e.isZero()) - return e.clone(); - var t = this.m.andln(3); - if (r(t % 2 == 1), - 3 === t) { - var i = this.m.add(new a(1)).iushrn(2); - return this.pow(e, i) - } - for (var n = this.m.subn(1), o = 0; !n.isZero() && 0 === n.andln(1); ) - o++, - n.iushrn(1); - r(!n.isZero()); - var s = new a(1).toRed(this) - , c = s.redNeg() - , u = this.m.subn(1).iushrn(1) - , l = this.m.bitLength(); - for (l = new a(2 * l * l).toRed(this); 0 !== this.pow(l, u).cmp(c); ) - l.redIAdd(c); - for (var h = this.pow(l, n), f = this.pow(e, n.addn(1).iushrn(1)), d = this.pow(e, n), p = o; 0 !== d.cmp(s); ) { - for (var m = d, g = 0; 0 !== m.cmp(s); g++) - m = m.redSqr(); - r(g < p); - var _ = this.pow(h, new a(1).iushln(p - g - 1)); - f = f.redMul(_), - h = _.redSqr(), - d = d.redMul(h), - p = g - } - return f - } - , - A.prototype.invm = function(e) { - var t = e._invmp(this.m); - return 0 !== t.negative ? (t.negative = 0, - this.imod(t).redNeg()) : this.imod(t) - } - , - A.prototype.pow = function(e, t) { - if (t.isZero()) - return new a(1).toRed(this); - if (0 === t.cmpn(1)) - return e.clone(); - var i = new Array(16); - i[0] = new a(1).toRed(this), - i[1] = e; - for (var n = 2; n < i.length; n++) - i[n] = this.mul(i[n - 1], e); - var r = i[0] - , o = 0 - , s = 0 - , c = t.bitLength() % 26; - for (0 === c && (c = 26), - n = t.length - 1; n >= 0; n--) { - for (var u = t.words[n], l = c - 1; l >= 0; l--) { - var h = u >> l & 1; - r !== i[0] && (r = this.sqr(r)), - 0 !== h || 0 !== o ? (o <<= 1, - o |= h, - (4 === ++s || 0 === n && 0 === l) && (r = this.mul(r, i[o]), - s = 0, - o = 0)) : s = 0 - } - c = 26 - } - return r - } - , - A.prototype.convertTo = function(e) { - var t = e.umod(this.m); - return t === e ? t.clone() : t - } - , - A.prototype.convertFrom = function(e) { - var t = e.clone(); - return t.red = null, - t - } - , - a.mont = function(e) { - return new x(e) - } - , - o(x, A), - x.prototype.convertTo = function(e) { - return this.imod(e.ushln(this.shift)) - } - , - x.prototype.convertFrom = function(e) { - var t = this.imod(e.mul(this.rinv)); - return t.red = null, - t - } - , - x.prototype.imul = function(e, t) { - if (e.isZero() || t.isZero()) - return e.words[0] = 0, - e.length = 1, - e; - var i = e.imul(t) - , n = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m) - , r = i.isub(n).iushrn(this.shift) - , o = r; - return r.cmp(this.m) >= 0 ? o = r.isub(this.m) : r.cmpn(0) < 0 && (o = r.iadd(this.m)), - o._forceRed(this) - } - , - x.prototype.mul = function(e, t) { - if (e.isZero() || t.isZero()) - return new a(0)._forceRed(this); - var i = e.mul(t) - , n = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m) - , r = i.isub(n).iushrn(this.shift) - , o = r; - return r.cmp(this.m) >= 0 ? o = r.isub(this.m) : r.cmpn(0) < 0 && (o = r.iadd(this.m)), - o._forceRed(this) - } - , - x.prototype.invm = function(e) { - return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this) - } - }(e, this) - } - ).call(this, i(122)(e)) -} -, function(e, t, i) { - var n = i(4) - , r = i(138) - , o = i(39) - , a = Object.defineProperty; - t.f = i(13) ? Object.defineProperty : function(e, t, i) { - if (n(e), - t = o(t, true), - n(i), - r) - try { - return a(e, t, i) - } catch (e) {} - if ("get"in i || "set"in i) - throw TypeError("Accessors not supported!"); - return "value"in i && (e[t] = i.value), - e - } -} -, function(e, t, i) { - e.exports = !i(3)(function() { - return 7 != Object.defineProperty({}, "a", { - get: function() { - return 7 - } - }).a - }) -} -, function(exp, t) { - var i = exp.exports = { - version: "2.6.0" + exp.exports = function (e) { + return e > 0 ? r(n(e), 9007199254740991) : 0; }; - - "number" == typeof __e && (__e = i) -} -, function(e, t) { - function i(e) { - return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - var n; - n = function() { - return this - }(); - try { - n = n || new Function("return this")() - } catch (e) { - "object" === ("undefined" == typeof window ? "undefined" : i(window)) && (n = window) - } - e.exports = n -} -, function(exp, unused_arg, getterFunc) { // vec3Math i = 16 - exp.exports = { - EPSILON: getterFunc(173), - create: getterFunc(174), - clone: getterFunc(413), - angle: getterFunc(414), - fromValues: getterFunc(175), - copy: getterFunc(415), - set: getterFunc(416), - equals: getterFunc(417), - exactEquals: getterFunc(418), - add: getterFunc(419), - subtract: getterFunc(178), - sub: getterFunc(420), - multiply: getterFunc(179), - mul: getterFunc(421), - divide: getterFunc(180), - div: getterFunc(422), - min: getterFunc(423), - max: getterFunc(424), - floor: getterFunc(425), - ceil: getterFunc(426), - round: getterFunc(427), - scale: getterFunc(428), - scaleAndAdd: getterFunc(429), - distance: getterFunc(181), - dist: getterFunc(430), - squaredDistance: getterFunc(182), - sqrDist: getterFunc(431), - length: getterFunc(183), - len: getterFunc(432), - squaredLength: getterFunc(184), - sqrLen: getterFunc(433), - negate: getterFunc(434), - inverse: getterFunc(435), - normalize: getterFunc(176), - dot: getterFunc(177), - cross: getterFunc(436), - lerp: getterFunc(437), - random: getterFunc(438), - transformMat4: getterFunc(439), - transformMat3: getterFunc(440), - transformQuat: getterFunc(441), - rotateX: getterFunc(442), - rotateY: getterFunc(443), - rotateZ: getterFunc(444), - forEach: getterFunc(445) - } -} -, function(e, t, getterFunc) { - "use strict"; - var n = t; - n.version = getterFunc(549).version, - n.utils = getterFunc(550), - n.rand = getterFunc(213), - n.curve = getterFunc(91), - n.curves = getterFunc(555), - n.ec = getterFunc(563), - n.eddsa = getterFunc(567) -} -, function(e, t, i) { - "use strict"; - (function(e) { - function n(t, i, n, r, o, a, s) { - try { - var c = t[a](s) - , u = c.value - } catch (e) { - return void n(e) - } - c.done ? i(u) : e.resolve(u).then(r, o) - } - function r(t) { - return function() { - var i = this - , r = arguments; - return new e(function(e, o) { - var a = t.apply(i, r); - function s(t) { - n(a, e, o, s, c, "next", t) - } - function c(t) { - n(a, e, o, s, c, "throw", t) - } - s(void 0) - } - ) - } + }, + function (e, t, i) { + (function (e) { + function t(e) { + return (t = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + !(function (e, n) { + "use strict"; + function r(e, t) { + if (!e) throw new Error(t || "Assertion failed"); } function o(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n.enumerable = n.enumerable || false, - n.configurable = true, - "value"in n && (n.writable = true), - Object.defineProperty(e, n.key, n) - } + e.super_ = t; + var i = function () {}; + (i.prototype = t.prototype), + (e.prototype = new i()), + (e.prototype.constructor = e); } - var a = i(397) - , s = function() { - function t() { - !function(e, t) { - if (!(e instanceof t)) - throw new TypeError("Cannot call a class as a function") - }(this, t) + function a(e, t, i) { + if (a.isBN(e)) return e; + (this.negative = 0), + (this.words = null), + (this.length = 0), + (this.red = null), + null !== e && + (("le" !== t && "be" !== t) || ((i = t), (t = 10)), + this._init(e || 0, t || 10, i || "be")); + } + var s; + "object" === t(e) ? (e.exports = a) : (n.BN = a), + (a.BN = a), + (a.wordSize = 26); + try { + s = i(543).Buffer; + } catch (e) {} + function c(e, t, i) { + for (var n = 0, r = Math.min(e.length, i), o = t; o < r; o++) { + var a = e.charCodeAt(o) - 48; + (n <<= 4), + (n |= + a >= 49 && a <= 54 + ? a - 49 + 10 + : a >= 17 && a <= 22 + ? a - 17 + 10 + : 15 & a); + } + return n; + } + function u(e, t, i, n) { + for (var r = 0, o = Math.min(e.length, i), a = t; a < o; a++) { + var s = e.charCodeAt(a) - 48; + (r *= n), (r += s >= 49 ? s - 49 + 10 : s >= 17 ? s - 17 + 10 : s); + } + return r; + } + (a.isBN = function (e) { + return ( + e instanceof a || + (null !== e && + "object" === t(e) && + e.constructor.wordSize === a.wordSize && + Array.isArray(e.words)) + ); + }), + (a.max = function (e, t) { + return e.cmp(t) > 0 ? e : t; + }), + (a.min = function (e, t) { + return e.cmp(t) < 0 ? e : t; + }), + (a.prototype._init = function (e, i, n) { + if ("number" == typeof e) return this._initNumber(e, i, n); + if ("object" === t(e)) return this._initArray(e, i, n); + "hex" === i && (i = 16), r(i === (0 | i) && i >= 2 && i <= 36); + var o = 0; + "-" === (e = e.toString().replace(/\s+/g, ""))[0] && o++, + 16 === i ? this._parseHex(e, o) : this._parseBase(e, i, o), + "-" === e[0] && (this.negative = 1), + this.strip(), + "le" === n && this._initArray(this.toArray(), i, n); + }), + (a.prototype._initNumber = function (e, t, i) { + e < 0 && ((this.negative = 1), (e = -e)), + e < 67108864 + ? ((this.words = [67108863 & e]), (this.length = 1)) + : e < 4503599627370496 + ? ((this.words = [67108863 & e, (e / 67108864) & 67108863]), + (this.length = 2)) + : (r(e < 9007199254740992), + (this.words = [67108863 & e, (e / 67108864) & 67108863, 1]), + (this.length = 3)), + "le" === i && this._initArray(this.toArray(), t, i); + }), + (a.prototype._initArray = function (e, t, i) { + if ((r("number" == typeof e.length), e.length <= 0)) + return (this.words = [0]), (this.length = 1), this; + (this.length = Math.ceil(e.length / 3)), + (this.words = new Array(this.length)); + for (var n = 0; n < this.length; n++) this.words[n] = 0; + var o, + a, + s = 0; + if ("be" === i) + for (n = e.length - 1, o = 0; n >= 0; n -= 3) + (a = e[n] | (e[n - 1] << 8) | (e[n - 2] << 16)), + (this.words[o] |= (a << s) & 67108863), + (this.words[o + 1] = (a >>> (26 - s)) & 67108863), + (s += 24) >= 26 && ((s -= 26), o++); + else if ("le" === i) + for (n = 0, o = 0; n < e.length; n += 3) + (a = e[n] | (e[n + 1] << 8) | (e[n + 2] << 16)), + (this.words[o] |= (a << s) & 67108863), + (this.words[o + 1] = (a >>> (26 - s)) & 67108863), + (s += 24) >= 26 && ((s -= 26), o++); + return this.strip(); + }), + (a.prototype._parseHex = function (e, t) { + (this.length = Math.ceil((e.length - t) / 6)), + (this.words = new Array(this.length)); + for (var i = 0; i < this.length; i++) this.words[i] = 0; + var n, + r, + o = 0; + for (i = e.length - 6, n = 0; i >= t; i -= 6) + (r = c(e, i, i + 6)), + (this.words[n] |= (r << o) & 67108863), + (this.words[n + 1] |= (r >>> (26 - o)) & 4194303), + (o += 24) >= 26 && ((o -= 26), n++); + i + 6 !== t && + ((r = c(e, t, i + 6)), + (this.words[n] |= (r << o) & 67108863), + (this.words[n + 1] |= (r >>> (26 - o)) & 4194303)), + this.strip(); + }), + (a.prototype._parseBase = function (e, t, i) { + (this.words = [0]), (this.length = 1); + for (var n = 0, r = 1; r <= 67108863; r *= t) n++; + n--, (r = (r / t) | 0); + for ( + var o = e.length - i, + a = o % n, + s = Math.min(o, o - a) + i, + c = 0, + l = i; + l < s; + l += n + ) + (c = u(e, l, l + n, t)), + this.imuln(r), + this.words[0] + c < 67108864 + ? (this.words[0] += c) + : this._iaddn(c); + if (0 !== a) { + var h = 1; + for (c = u(e, l, e.length, t), l = 0; l < a; l++) h *= t; + this.imuln(h), + this.words[0] + c < 67108864 + ? (this.words[0] += c) + : this._iaddn(c); } - var i, n, s; - return i = t, - n = null, - s = [{ + }), + (a.prototype.copy = function (e) { + e.words = new Array(this.length); + for (var t = 0; t < this.length; t++) e.words[t] = this.words[t]; + (e.length = this.length), + (e.negative = this.negative), + (e.red = this.red); + }), + (a.prototype.clone = function () { + var e = new a(null); + return this.copy(e), e; + }), + (a.prototype._expand = function (e) { + for (; this.length < e; ) this.words[this.length++] = 0; + return this; + }), + (a.prototype.strip = function () { + for (; this.length > 1 && 0 === this.words[this.length - 1]; ) + this.length--; + return this._normSign(); + }), + (a.prototype._normSign = function () { + return ( + 1 === this.length && 0 === this.words[0] && (this.negative = 0), + this + ); + }), + (a.prototype.inspect = function () { + return (this.red ? ""; + }); + var l = [ + "", + "0", + "00", + "000", + "0000", + "00000", + "000000", + "0000000", + "00000000", + "000000000", + "0000000000", + "00000000000", + "000000000000", + "0000000000000", + "00000000000000", + "000000000000000", + "0000000000000000", + "00000000000000000", + "000000000000000000", + "0000000000000000000", + "00000000000000000000", + "000000000000000000000", + "0000000000000000000000", + "00000000000000000000000", + "000000000000000000000000", + "0000000000000000000000000", + ], + h = [ + 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + ], + f = [ + 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, + 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536, + 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, + 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, + 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875, + 60466176, + ]; + function d(e, t, i) { + i.negative = t.negative ^ e.negative; + var n = (e.length + t.length) | 0; + (i.length = n), (n = (n - 1) | 0); + var r = 0 | e.words[0], + o = 0 | t.words[0], + a = r * o, + s = 67108863 & a, + c = (a / 67108864) | 0; + i.words[0] = s; + for (var u = 1; u < n; u++) { + for ( + var l = c >>> 26, + h = 67108863 & c, + f = Math.min(u, t.length - 1), + d = Math.max(0, u - e.length + 1); + d <= f; + d++ + ) { + var p = (u - d) | 0; + (l += + ((a = (r = 0 | e.words[p]) * (o = 0 | t.words[d]) + h) / + 67108864) | + 0), + (h = 67108863 & a); + } + (i.words[u] = 0 | h), (c = 0 | l); + } + return 0 !== c ? (i.words[u] = 0 | c) : i.length--, i.strip(); + } + (a.prototype.toString = function (e, t) { + var i; + if (((t = 0 | t || 1), 16 === (e = e || 10) || "hex" === e)) { + i = ""; + for (var n = 0, o = 0, a = 0; a < this.length; a++) { + var s = this.words[a], + c = (16777215 & ((s << n) | o)).toString(16); + (i = + 0 !== (o = (s >>> (24 - n)) & 16777215) || a !== this.length - 1 + ? l[6 - c.length] + c + i + : c + i), + (n += 2) >= 26 && ((n -= 26), a--); + } + for (0 !== o && (i = o.toString(16) + i); i.length % t != 0; ) + i = "0" + i; + return 0 !== this.negative && (i = "-" + i), i; + } + if (e === (0 | e) && e >= 2 && e <= 36) { + var u = h[e], + d = f[e]; + i = ""; + var p = this.clone(); + for (p.negative = 0; !p.isZero(); ) { + var m = p.modn(d).toString(e); + i = (p = p.idivn(d)).isZero() ? m + i : l[u - m.length] + m + i; + } + for (this.isZero() && (i = "0" + i); i.length % t != 0; ) + i = "0" + i; + return 0 !== this.negative && (i = "-" + i), i; + } + r(false, "Base should be between 2 and 36"); + }), + (a.prototype.toNumber = function () { + var e = this.words[0]; + return ( + 2 === this.length + ? (e += 67108864 * this.words[1]) + : 3 === this.length && 1 === this.words[2] + ? (e += 4503599627370496 + 67108864 * this.words[1]) + : this.length > 2 && + r(false, "Number can only safely store up to 53 bits"), + 0 !== this.negative ? -e : e + ); + }), + (a.prototype.toJSON = function () { + return this.toString(16); + }), + (a.prototype.toBuffer = function (e, t) { + return r(void 0 !== s), this.toArrayLike(s, e, t); + }), + (a.prototype.toArray = function (e, t) { + return this.toArrayLike(Array, e, t); + }), + (a.prototype.toArrayLike = function (e, t, i) { + var n = this.byteLength(), + o = i || Math.max(1, n); + r(n <= o, "byte array longer than desired length"), + r(o > 0, "Requested array length <= 0"), + this.strip(); + var a, + s, + c = "le" === t, + u = new e(o), + l = this.clone(); + if (c) { + for (s = 0; !l.isZero(); s++) + (a = l.andln(255)), l.iushrn(8), (u[s] = a); + for (; s < o; s++) u[s] = 0; + } else { + for (s = 0; s < o - n; s++) u[s] = 0; + for (s = 0; !l.isZero(); s++) + (a = l.andln(255)), l.iushrn(8), (u[o - s - 1] = a); + } + return u; + }), + Math.clz32 + ? (a.prototype._countBits = function (e) { + return 32 - Math.clz32(e); + }) + : (a.prototype._countBits = function (e) { + var t = e, + i = 0; + return ( + t >= 4096 && ((i += 13), (t >>>= 13)), + t >= 64 && ((i += 7), (t >>>= 7)), + t >= 8 && ((i += 4), (t >>>= 4)), + t >= 2 && ((i += 2), (t >>>= 2)), + i + t + ); + }), + (a.prototype._zeroBits = function (e) { + if (0 === e) return 26; + var t = e, + i = 0; + return ( + 0 == (8191 & t) && ((i += 13), (t >>>= 13)), + 0 == (127 & t) && ((i += 7), (t >>>= 7)), + 0 == (15 & t) && ((i += 4), (t >>>= 4)), + 0 == (3 & t) && ((i += 2), (t >>>= 2)), + 0 == (1 & t) && i++, + i + ); + }), + (a.prototype.bitLength = function () { + var e = this.words[this.length - 1], + t = this._countBits(e); + return 26 * (this.length - 1) + t; + }), + (a.prototype.zeroBits = function () { + if (this.isZero()) return 0; + for (var e = 0, t = 0; t < this.length; t++) { + var i = this._zeroBits(this.words[t]); + if (((e += i), 26 !== i)) break; + } + return e; + }), + (a.prototype.byteLength = function () { + return Math.ceil(this.bitLength() / 8); + }), + (a.prototype.toTwos = function (e) { + return 0 !== this.negative + ? this.abs().inotn(e).iaddn(1) + : this.clone(); + }), + (a.prototype.fromTwos = function (e) { + return this.testn(e - 1) + ? this.notn(e).iaddn(1).ineg() + : this.clone(); + }), + (a.prototype.isNeg = function () { + return 0 !== this.negative; + }), + (a.prototype.neg = function () { + return this.clone().ineg(); + }), + (a.prototype.ineg = function () { + return this.isZero() || (this.negative ^= 1), this; + }), + (a.prototype.iuor = function (e) { + for (; this.length < e.length; ) this.words[this.length++] = 0; + for (var t = 0; t < e.length; t++) + this.words[t] = this.words[t] | e.words[t]; + return this.strip(); + }), + (a.prototype.ior = function (e) { + return r(0 == (this.negative | e.negative)), this.iuor(e); + }), + (a.prototype.or = function (e) { + return this.length > e.length + ? this.clone().ior(e) + : e.clone().ior(this); + }), + (a.prototype.uor = function (e) { + return this.length > e.length + ? this.clone().iuor(e) + : e.clone().iuor(this); + }), + (a.prototype.iuand = function (e) { + var t; + t = this.length > e.length ? e : this; + for (var i = 0; i < t.length; i++) + this.words[i] = this.words[i] & e.words[i]; + return (this.length = t.length), this.strip(); + }), + (a.prototype.iand = function (e) { + return r(0 == (this.negative | e.negative)), this.iuand(e); + }), + (a.prototype.and = function (e) { + return this.length > e.length + ? this.clone().iand(e) + : e.clone().iand(this); + }), + (a.prototype.uand = function (e) { + return this.length > e.length + ? this.clone().iuand(e) + : e.clone().iuand(this); + }), + (a.prototype.iuxor = function (e) { + var t, i; + this.length > e.length + ? ((t = this), (i = e)) + : ((t = e), (i = this)); + for (var n = 0; n < i.length; n++) + this.words[n] = t.words[n] ^ i.words[n]; + if (this !== t) + for (; n < t.length; n++) this.words[n] = t.words[n]; + return (this.length = t.length), this.strip(); + }), + (a.prototype.ixor = function (e) { + return r(0 == (this.negative | e.negative)), this.iuxor(e); + }), + (a.prototype.xor = function (e) { + return this.length > e.length + ? this.clone().ixor(e) + : e.clone().ixor(this); + }), + (a.prototype.uxor = function (e) { + return this.length > e.length + ? this.clone().iuxor(e) + : e.clone().iuxor(this); + }), + (a.prototype.inotn = function (e) { + r("number" == typeof e && e >= 0); + var t = 0 | Math.ceil(e / 26), + i = e % 26; + this._expand(t), i > 0 && t--; + for (var n = 0; n < t; n++) + this.words[n] = 67108863 & ~this.words[n]; + return ( + i > 0 && + (this.words[n] = ~this.words[n] & (67108863 >> (26 - i))), + this.strip() + ); + }), + (a.prototype.notn = function (e) { + return this.clone().inotn(e); + }), + (a.prototype.setn = function (e, t) { + r("number" == typeof e && e >= 0); + var i = (e / 26) | 0, + n = e % 26; + return ( + this._expand(i + 1), + (this.words[i] = t + ? this.words[i] | (1 << n) + : this.words[i] & ~(1 << n)), + this.strip() + ); + }), + (a.prototype.iadd = function (e) { + var t, i, n; + if (0 !== this.negative && 0 === e.negative) + return ( + (this.negative = 0), + (t = this.isub(e)), + (this.negative ^= 1), + this._normSign() + ); + if (0 === this.negative && 0 !== e.negative) + return ( + (e.negative = 0), + (t = this.isub(e)), + (e.negative = 1), + t._normSign() + ); + this.length > e.length + ? ((i = this), (n = e)) + : ((i = e), (n = this)); + for (var r = 0, o = 0; o < n.length; o++) + (t = (0 | i.words[o]) + (0 | n.words[o]) + r), + (this.words[o] = 67108863 & t), + (r = t >>> 26); + for (; 0 !== r && o < i.length; o++) + (t = (0 | i.words[o]) + r), + (this.words[o] = 67108863 & t), + (r = t >>> 26); + if (((this.length = i.length), 0 !== r)) + (this.words[this.length] = r), this.length++; + else if (i !== this) + for (; o < i.length; o++) this.words[o] = i.words[o]; + return this; + }), + (a.prototype.add = function (e) { + var t; + return 0 !== e.negative && 0 === this.negative + ? ((e.negative = 0), (t = this.sub(e)), (e.negative ^= 1), t) + : 0 === e.negative && 0 !== this.negative + ? ((this.negative = 0), (t = e.sub(this)), (this.negative = 1), t) + : this.length > e.length + ? this.clone().iadd(e) + : e.clone().iadd(this); + }), + (a.prototype.isub = function (e) { + if (0 !== e.negative) { + e.negative = 0; + var t = this.iadd(e); + return (e.negative = 1), t._normSign(); + } + if (0 !== this.negative) + return ( + (this.negative = 0), + this.iadd(e), + (this.negative = 1), + this._normSign() + ); + var i, + n, + r = this.cmp(e); + if (0 === r) + return ( + (this.negative = 0), + (this.length = 1), + (this.words[0] = 0), + this + ); + r > 0 ? ((i = this), (n = e)) : ((i = e), (n = this)); + for (var o = 0, a = 0; a < n.length; a++) + (o = (t = (0 | i.words[a]) - (0 | n.words[a]) + o) >> 26), + (this.words[a] = 67108863 & t); + for (; 0 !== o && a < i.length; a++) + (o = (t = (0 | i.words[a]) + o) >> 26), + (this.words[a] = 67108863 & t); + if (0 === o && a < i.length && i !== this) + for (; a < i.length; a++) this.words[a] = i.words[a]; + return ( + (this.length = Math.max(this.length, a)), + i !== this && (this.negative = 1), + this.strip() + ); + }), + (a.prototype.sub = function (e) { + return this.clone().isub(e); + }); + var p = function (e, t, i) { + var n, + r, + o, + a = e.words, + s = t.words, + c = i.words, + u = 0, + l = 0 | a[0], + h = 8191 & l, + f = l >>> 13, + d = 0 | a[1], + p = 8191 & d, + m = d >>> 13, + g = 0 | a[2], + _ = 8191 & g, + v = g >>> 13, + y = 0 | a[3], + b = 8191 & y, + E = y >>> 13, + T = 0 | a[4], + A = 8191 & T, + x = T >>> 13, + S = 0 | a[5], + C = 8191 & S, + P = S >>> 13, + R = 0 | a[6], + M = 8191 & R, + O = R >>> 13, + w = 0 | a[7], + I = 8191 & w, + D = w >>> 13, + L = 0 | a[8], + F = 8191 & L, + B = L >>> 13, + N = 0 | a[9], + k = 8191 & N, + U = N >>> 13, + V = 0 | s[0], + G = 8191 & V, + z = V >>> 13, + j = 0 | s[1], + H = 8191 & j, + W = j >>> 13, + X = 0 | s[2], + Y = 8191 & X, + K = X >>> 13, + Q = 0 | s[3], + q = 8191 & Q, + Z = Q >>> 13, + J = 0 | s[4], + $ = 8191 & J, + ee = J >>> 13, + te = 0 | s[5], + ie = 8191 & te, + ne = te >>> 13, + re = 0 | s[6], + oe = 8191 & re, + ae = re >>> 13, + se = 0 | s[7], + ce = 8191 & se, + ue = se >>> 13, + le = 0 | s[8], + he = 8191 & le, + fe = le >>> 13, + de = 0 | s[9], + pe = 8191 & de, + me = de >>> 13; + (i.negative = e.negative ^ t.negative), (i.length = 19); + var ge = + (((u + (n = Math.imul(h, G))) | 0) + + ((8191 & (r = ((r = Math.imul(h, z)) + Math.imul(f, G)) | 0)) << + 13)) | + 0; + (u = ((((o = Math.imul(f, z)) + (r >>> 13)) | 0) + (ge >>> 26)) | 0), + (ge &= 67108863), + (n = Math.imul(p, G)), + (r = ((r = Math.imul(p, z)) + Math.imul(m, G)) | 0), + (o = Math.imul(m, z)); + var _e = + (((u + (n = (n + Math.imul(h, H)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, W)) | 0) + Math.imul(f, H)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, W)) | 0) + (r >>> 13)) | 0) + + (_e >>> 26)) | + 0), + (_e &= 67108863), + (n = Math.imul(_, G)), + (r = ((r = Math.imul(_, z)) + Math.imul(v, G)) | 0), + (o = Math.imul(v, z)), + (n = (n + Math.imul(p, H)) | 0), + (r = ((r = (r + Math.imul(p, W)) | 0) + Math.imul(m, H)) | 0), + (o = (o + Math.imul(m, W)) | 0); + var ve = + (((u + (n = (n + Math.imul(h, Y)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, K)) | 0) + Math.imul(f, Y)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, K)) | 0) + (r >>> 13)) | 0) + + (ve >>> 26)) | + 0), + (ve &= 67108863), + (n = Math.imul(b, G)), + (r = ((r = Math.imul(b, z)) + Math.imul(E, G)) | 0), + (o = Math.imul(E, z)), + (n = (n + Math.imul(_, H)) | 0), + (r = ((r = (r + Math.imul(_, W)) | 0) + Math.imul(v, H)) | 0), + (o = (o + Math.imul(v, W)) | 0), + (n = (n + Math.imul(p, Y)) | 0), + (r = ((r = (r + Math.imul(p, K)) | 0) + Math.imul(m, Y)) | 0), + (o = (o + Math.imul(m, K)) | 0); + var ye = + (((u + (n = (n + Math.imul(h, q)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, Z)) | 0) + Math.imul(f, q)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, Z)) | 0) + (r >>> 13)) | 0) + + (ye >>> 26)) | + 0), + (ye &= 67108863), + (n = Math.imul(A, G)), + (r = ((r = Math.imul(A, z)) + Math.imul(x, G)) | 0), + (o = Math.imul(x, z)), + (n = (n + Math.imul(b, H)) | 0), + (r = ((r = (r + Math.imul(b, W)) | 0) + Math.imul(E, H)) | 0), + (o = (o + Math.imul(E, W)) | 0), + (n = (n + Math.imul(_, Y)) | 0), + (r = ((r = (r + Math.imul(_, K)) | 0) + Math.imul(v, Y)) | 0), + (o = (o + Math.imul(v, K)) | 0), + (n = (n + Math.imul(p, q)) | 0), + (r = ((r = (r + Math.imul(p, Z)) | 0) + Math.imul(m, q)) | 0), + (o = (o + Math.imul(m, Z)) | 0); + var be = + (((u + (n = (n + Math.imul(h, $)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, ee)) | 0) + Math.imul(f, $)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, ee)) | 0) + (r >>> 13)) | 0) + + (be >>> 26)) | + 0), + (be &= 67108863), + (n = Math.imul(C, G)), + (r = ((r = Math.imul(C, z)) + Math.imul(P, G)) | 0), + (o = Math.imul(P, z)), + (n = (n + Math.imul(A, H)) | 0), + (r = ((r = (r + Math.imul(A, W)) | 0) + Math.imul(x, H)) | 0), + (o = (o + Math.imul(x, W)) | 0), + (n = (n + Math.imul(b, Y)) | 0), + (r = ((r = (r + Math.imul(b, K)) | 0) + Math.imul(E, Y)) | 0), + (o = (o + Math.imul(E, K)) | 0), + (n = (n + Math.imul(_, q)) | 0), + (r = ((r = (r + Math.imul(_, Z)) | 0) + Math.imul(v, q)) | 0), + (o = (o + Math.imul(v, Z)) | 0), + (n = (n + Math.imul(p, $)) | 0), + (r = ((r = (r + Math.imul(p, ee)) | 0) + Math.imul(m, $)) | 0), + (o = (o + Math.imul(m, ee)) | 0); + var Ee = + (((u + (n = (n + Math.imul(h, ie)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, ne)) | 0) + Math.imul(f, ie)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, ne)) | 0) + (r >>> 13)) | 0) + + (Ee >>> 26)) | + 0), + (Ee &= 67108863), + (n = Math.imul(M, G)), + (r = ((r = Math.imul(M, z)) + Math.imul(O, G)) | 0), + (o = Math.imul(O, z)), + (n = (n + Math.imul(C, H)) | 0), + (r = ((r = (r + Math.imul(C, W)) | 0) + Math.imul(P, H)) | 0), + (o = (o + Math.imul(P, W)) | 0), + (n = (n + Math.imul(A, Y)) | 0), + (r = ((r = (r + Math.imul(A, K)) | 0) + Math.imul(x, Y)) | 0), + (o = (o + Math.imul(x, K)) | 0), + (n = (n + Math.imul(b, q)) | 0), + (r = ((r = (r + Math.imul(b, Z)) | 0) + Math.imul(E, q)) | 0), + (o = (o + Math.imul(E, Z)) | 0), + (n = (n + Math.imul(_, $)) | 0), + (r = ((r = (r + Math.imul(_, ee)) | 0) + Math.imul(v, $)) | 0), + (o = (o + Math.imul(v, ee)) | 0), + (n = (n + Math.imul(p, ie)) | 0), + (r = ((r = (r + Math.imul(p, ne)) | 0) + Math.imul(m, ie)) | 0), + (o = (o + Math.imul(m, ne)) | 0); + var Te = + (((u + (n = (n + Math.imul(h, oe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, ae)) | 0) + Math.imul(f, oe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, ae)) | 0) + (r >>> 13)) | 0) + + (Te >>> 26)) | + 0), + (Te &= 67108863), + (n = Math.imul(I, G)), + (r = ((r = Math.imul(I, z)) + Math.imul(D, G)) | 0), + (o = Math.imul(D, z)), + (n = (n + Math.imul(M, H)) | 0), + (r = ((r = (r + Math.imul(M, W)) | 0) + Math.imul(O, H)) | 0), + (o = (o + Math.imul(O, W)) | 0), + (n = (n + Math.imul(C, Y)) | 0), + (r = ((r = (r + Math.imul(C, K)) | 0) + Math.imul(P, Y)) | 0), + (o = (o + Math.imul(P, K)) | 0), + (n = (n + Math.imul(A, q)) | 0), + (r = ((r = (r + Math.imul(A, Z)) | 0) + Math.imul(x, q)) | 0), + (o = (o + Math.imul(x, Z)) | 0), + (n = (n + Math.imul(b, $)) | 0), + (r = ((r = (r + Math.imul(b, ee)) | 0) + Math.imul(E, $)) | 0), + (o = (o + Math.imul(E, ee)) | 0), + (n = (n + Math.imul(_, ie)) | 0), + (r = ((r = (r + Math.imul(_, ne)) | 0) + Math.imul(v, ie)) | 0), + (o = (o + Math.imul(v, ne)) | 0), + (n = (n + Math.imul(p, oe)) | 0), + (r = ((r = (r + Math.imul(p, ae)) | 0) + Math.imul(m, oe)) | 0), + (o = (o + Math.imul(m, ae)) | 0); + var Ae = + (((u + (n = (n + Math.imul(h, ce)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, ue)) | 0) + Math.imul(f, ce)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, ue)) | 0) + (r >>> 13)) | 0) + + (Ae >>> 26)) | + 0), + (Ae &= 67108863), + (n = Math.imul(F, G)), + (r = ((r = Math.imul(F, z)) + Math.imul(B, G)) | 0), + (o = Math.imul(B, z)), + (n = (n + Math.imul(I, H)) | 0), + (r = ((r = (r + Math.imul(I, W)) | 0) + Math.imul(D, H)) | 0), + (o = (o + Math.imul(D, W)) | 0), + (n = (n + Math.imul(M, Y)) | 0), + (r = ((r = (r + Math.imul(M, K)) | 0) + Math.imul(O, Y)) | 0), + (o = (o + Math.imul(O, K)) | 0), + (n = (n + Math.imul(C, q)) | 0), + (r = ((r = (r + Math.imul(C, Z)) | 0) + Math.imul(P, q)) | 0), + (o = (o + Math.imul(P, Z)) | 0), + (n = (n + Math.imul(A, $)) | 0), + (r = ((r = (r + Math.imul(A, ee)) | 0) + Math.imul(x, $)) | 0), + (o = (o + Math.imul(x, ee)) | 0), + (n = (n + Math.imul(b, ie)) | 0), + (r = ((r = (r + Math.imul(b, ne)) | 0) + Math.imul(E, ie)) | 0), + (o = (o + Math.imul(E, ne)) | 0), + (n = (n + Math.imul(_, oe)) | 0), + (r = ((r = (r + Math.imul(_, ae)) | 0) + Math.imul(v, oe)) | 0), + (o = (o + Math.imul(v, ae)) | 0), + (n = (n + Math.imul(p, ce)) | 0), + (r = ((r = (r + Math.imul(p, ue)) | 0) + Math.imul(m, ce)) | 0), + (o = (o + Math.imul(m, ue)) | 0); + var xe = + (((u + (n = (n + Math.imul(h, he)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, fe)) | 0) + Math.imul(f, he)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, fe)) | 0) + (r >>> 13)) | 0) + + (xe >>> 26)) | + 0), + (xe &= 67108863), + (n = Math.imul(k, G)), + (r = ((r = Math.imul(k, z)) + Math.imul(U, G)) | 0), + (o = Math.imul(U, z)), + (n = (n + Math.imul(F, H)) | 0), + (r = ((r = (r + Math.imul(F, W)) | 0) + Math.imul(B, H)) | 0), + (o = (o + Math.imul(B, W)) | 0), + (n = (n + Math.imul(I, Y)) | 0), + (r = ((r = (r + Math.imul(I, K)) | 0) + Math.imul(D, Y)) | 0), + (o = (o + Math.imul(D, K)) | 0), + (n = (n + Math.imul(M, q)) | 0), + (r = ((r = (r + Math.imul(M, Z)) | 0) + Math.imul(O, q)) | 0), + (o = (o + Math.imul(O, Z)) | 0), + (n = (n + Math.imul(C, $)) | 0), + (r = ((r = (r + Math.imul(C, ee)) | 0) + Math.imul(P, $)) | 0), + (o = (o + Math.imul(P, ee)) | 0), + (n = (n + Math.imul(A, ie)) | 0), + (r = ((r = (r + Math.imul(A, ne)) | 0) + Math.imul(x, ie)) | 0), + (o = (o + Math.imul(x, ne)) | 0), + (n = (n + Math.imul(b, oe)) | 0), + (r = ((r = (r + Math.imul(b, ae)) | 0) + Math.imul(E, oe)) | 0), + (o = (o + Math.imul(E, ae)) | 0), + (n = (n + Math.imul(_, ce)) | 0), + (r = ((r = (r + Math.imul(_, ue)) | 0) + Math.imul(v, ce)) | 0), + (o = (o + Math.imul(v, ue)) | 0), + (n = (n + Math.imul(p, he)) | 0), + (r = ((r = (r + Math.imul(p, fe)) | 0) + Math.imul(m, he)) | 0), + (o = (o + Math.imul(m, fe)) | 0); + var Se = + (((u + (n = (n + Math.imul(h, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(h, me)) | 0) + Math.imul(f, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(f, me)) | 0) + (r >>> 13)) | 0) + + (Se >>> 26)) | + 0), + (Se &= 67108863), + (n = Math.imul(k, H)), + (r = ((r = Math.imul(k, W)) + Math.imul(U, H)) | 0), + (o = Math.imul(U, W)), + (n = (n + Math.imul(F, Y)) | 0), + (r = ((r = (r + Math.imul(F, K)) | 0) + Math.imul(B, Y)) | 0), + (o = (o + Math.imul(B, K)) | 0), + (n = (n + Math.imul(I, q)) | 0), + (r = ((r = (r + Math.imul(I, Z)) | 0) + Math.imul(D, q)) | 0), + (o = (o + Math.imul(D, Z)) | 0), + (n = (n + Math.imul(M, $)) | 0), + (r = ((r = (r + Math.imul(M, ee)) | 0) + Math.imul(O, $)) | 0), + (o = (o + Math.imul(O, ee)) | 0), + (n = (n + Math.imul(C, ie)) | 0), + (r = ((r = (r + Math.imul(C, ne)) | 0) + Math.imul(P, ie)) | 0), + (o = (o + Math.imul(P, ne)) | 0), + (n = (n + Math.imul(A, oe)) | 0), + (r = ((r = (r + Math.imul(A, ae)) | 0) + Math.imul(x, oe)) | 0), + (o = (o + Math.imul(x, ae)) | 0), + (n = (n + Math.imul(b, ce)) | 0), + (r = ((r = (r + Math.imul(b, ue)) | 0) + Math.imul(E, ce)) | 0), + (o = (o + Math.imul(E, ue)) | 0), + (n = (n + Math.imul(_, he)) | 0), + (r = ((r = (r + Math.imul(_, fe)) | 0) + Math.imul(v, he)) | 0), + (o = (o + Math.imul(v, fe)) | 0); + var Ce = + (((u + (n = (n + Math.imul(p, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(p, me)) | 0) + Math.imul(m, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(m, me)) | 0) + (r >>> 13)) | 0) + + (Ce >>> 26)) | + 0), + (Ce &= 67108863), + (n = Math.imul(k, Y)), + (r = ((r = Math.imul(k, K)) + Math.imul(U, Y)) | 0), + (o = Math.imul(U, K)), + (n = (n + Math.imul(F, q)) | 0), + (r = ((r = (r + Math.imul(F, Z)) | 0) + Math.imul(B, q)) | 0), + (o = (o + Math.imul(B, Z)) | 0), + (n = (n + Math.imul(I, $)) | 0), + (r = ((r = (r + Math.imul(I, ee)) | 0) + Math.imul(D, $)) | 0), + (o = (o + Math.imul(D, ee)) | 0), + (n = (n + Math.imul(M, ie)) | 0), + (r = ((r = (r + Math.imul(M, ne)) | 0) + Math.imul(O, ie)) | 0), + (o = (o + Math.imul(O, ne)) | 0), + (n = (n + Math.imul(C, oe)) | 0), + (r = ((r = (r + Math.imul(C, ae)) | 0) + Math.imul(P, oe)) | 0), + (o = (o + Math.imul(P, ae)) | 0), + (n = (n + Math.imul(A, ce)) | 0), + (r = ((r = (r + Math.imul(A, ue)) | 0) + Math.imul(x, ce)) | 0), + (o = (o + Math.imul(x, ue)) | 0), + (n = (n + Math.imul(b, he)) | 0), + (r = ((r = (r + Math.imul(b, fe)) | 0) + Math.imul(E, he)) | 0), + (o = (o + Math.imul(E, fe)) | 0); + var Pe = + (((u + (n = (n + Math.imul(_, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(_, me)) | 0) + Math.imul(v, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(v, me)) | 0) + (r >>> 13)) | 0) + + (Pe >>> 26)) | + 0), + (Pe &= 67108863), + (n = Math.imul(k, q)), + (r = ((r = Math.imul(k, Z)) + Math.imul(U, q)) | 0), + (o = Math.imul(U, Z)), + (n = (n + Math.imul(F, $)) | 0), + (r = ((r = (r + Math.imul(F, ee)) | 0) + Math.imul(B, $)) | 0), + (o = (o + Math.imul(B, ee)) | 0), + (n = (n + Math.imul(I, ie)) | 0), + (r = ((r = (r + Math.imul(I, ne)) | 0) + Math.imul(D, ie)) | 0), + (o = (o + Math.imul(D, ne)) | 0), + (n = (n + Math.imul(M, oe)) | 0), + (r = ((r = (r + Math.imul(M, ae)) | 0) + Math.imul(O, oe)) | 0), + (o = (o + Math.imul(O, ae)) | 0), + (n = (n + Math.imul(C, ce)) | 0), + (r = ((r = (r + Math.imul(C, ue)) | 0) + Math.imul(P, ce)) | 0), + (o = (o + Math.imul(P, ue)) | 0), + (n = (n + Math.imul(A, he)) | 0), + (r = ((r = (r + Math.imul(A, fe)) | 0) + Math.imul(x, he)) | 0), + (o = (o + Math.imul(x, fe)) | 0); + var Re = + (((u + (n = (n + Math.imul(b, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(b, me)) | 0) + Math.imul(E, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(E, me)) | 0) + (r >>> 13)) | 0) + + (Re >>> 26)) | + 0), + (Re &= 67108863), + (n = Math.imul(k, $)), + (r = ((r = Math.imul(k, ee)) + Math.imul(U, $)) | 0), + (o = Math.imul(U, ee)), + (n = (n + Math.imul(F, ie)) | 0), + (r = ((r = (r + Math.imul(F, ne)) | 0) + Math.imul(B, ie)) | 0), + (o = (o + Math.imul(B, ne)) | 0), + (n = (n + Math.imul(I, oe)) | 0), + (r = ((r = (r + Math.imul(I, ae)) | 0) + Math.imul(D, oe)) | 0), + (o = (o + Math.imul(D, ae)) | 0), + (n = (n + Math.imul(M, ce)) | 0), + (r = ((r = (r + Math.imul(M, ue)) | 0) + Math.imul(O, ce)) | 0), + (o = (o + Math.imul(O, ue)) | 0), + (n = (n + Math.imul(C, he)) | 0), + (r = ((r = (r + Math.imul(C, fe)) | 0) + Math.imul(P, he)) | 0), + (o = (o + Math.imul(P, fe)) | 0); + var Me = + (((u + (n = (n + Math.imul(A, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(A, me)) | 0) + Math.imul(x, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(x, me)) | 0) + (r >>> 13)) | 0) + + (Me >>> 26)) | + 0), + (Me &= 67108863), + (n = Math.imul(k, ie)), + (r = ((r = Math.imul(k, ne)) + Math.imul(U, ie)) | 0), + (o = Math.imul(U, ne)), + (n = (n + Math.imul(F, oe)) | 0), + (r = ((r = (r + Math.imul(F, ae)) | 0) + Math.imul(B, oe)) | 0), + (o = (o + Math.imul(B, ae)) | 0), + (n = (n + Math.imul(I, ce)) | 0), + (r = ((r = (r + Math.imul(I, ue)) | 0) + Math.imul(D, ce)) | 0), + (o = (o + Math.imul(D, ue)) | 0), + (n = (n + Math.imul(M, he)) | 0), + (r = ((r = (r + Math.imul(M, fe)) | 0) + Math.imul(O, he)) | 0), + (o = (o + Math.imul(O, fe)) | 0); + var Oe = + (((u + (n = (n + Math.imul(C, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(C, me)) | 0) + Math.imul(P, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(P, me)) | 0) + (r >>> 13)) | 0) + + (Oe >>> 26)) | + 0), + (Oe &= 67108863), + (n = Math.imul(k, oe)), + (r = ((r = Math.imul(k, ae)) + Math.imul(U, oe)) | 0), + (o = Math.imul(U, ae)), + (n = (n + Math.imul(F, ce)) | 0), + (r = ((r = (r + Math.imul(F, ue)) | 0) + Math.imul(B, ce)) | 0), + (o = (o + Math.imul(B, ue)) | 0), + (n = (n + Math.imul(I, he)) | 0), + (r = ((r = (r + Math.imul(I, fe)) | 0) + Math.imul(D, he)) | 0), + (o = (o + Math.imul(D, fe)) | 0); + var we = + (((u + (n = (n + Math.imul(M, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(M, me)) | 0) + Math.imul(O, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(O, me)) | 0) + (r >>> 13)) | 0) + + (we >>> 26)) | + 0), + (we &= 67108863), + (n = Math.imul(k, ce)), + (r = ((r = Math.imul(k, ue)) + Math.imul(U, ce)) | 0), + (o = Math.imul(U, ue)), + (n = (n + Math.imul(F, he)) | 0), + (r = ((r = (r + Math.imul(F, fe)) | 0) + Math.imul(B, he)) | 0), + (o = (o + Math.imul(B, fe)) | 0); + var Ie = + (((u + (n = (n + Math.imul(I, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(I, me)) | 0) + Math.imul(D, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(D, me)) | 0) + (r >>> 13)) | 0) + + (Ie >>> 26)) | + 0), + (Ie &= 67108863), + (n = Math.imul(k, he)), + (r = ((r = Math.imul(k, fe)) + Math.imul(U, he)) | 0), + (o = Math.imul(U, fe)); + var De = + (((u + (n = (n + Math.imul(F, pe)) | 0)) | 0) + + ((8191 & + (r = + ((r = (r + Math.imul(F, me)) | 0) + Math.imul(B, pe)) | 0)) << + 13)) | + 0; + (u = + ((((o = (o + Math.imul(B, me)) | 0) + (r >>> 13)) | 0) + + (De >>> 26)) | + 0), + (De &= 67108863); + var Le = + (((u + (n = Math.imul(k, pe))) | 0) + + ((8191 & (r = ((r = Math.imul(k, me)) + Math.imul(U, pe)) | 0)) << + 13)) | + 0; + return ( + (u = + ((((o = Math.imul(U, me)) + (r >>> 13)) | 0) + (Le >>> 26)) | 0), + (Le &= 67108863), + (c[0] = ge), + (c[1] = _e), + (c[2] = ve), + (c[3] = ye), + (c[4] = be), + (c[5] = Ee), + (c[6] = Te), + (c[7] = Ae), + (c[8] = xe), + (c[9] = Se), + (c[10] = Ce), + (c[11] = Pe), + (c[12] = Re), + (c[13] = Me), + (c[14] = Oe), + (c[15] = we), + (c[16] = Ie), + (c[17] = De), + (c[18] = Le), + 0 !== u && ((c[19] = u), i.length++), + i + ); + }; + function m(e, t, i) { + return new g().mulp(e, t, i); + } + function g(e, t) { + (this.x = e), (this.y = t); + } + Math.imul || (p = d), + (a.prototype.mulTo = function (e, t) { + var i = this.length + e.length; + return 10 === this.length && 10 === e.length + ? p(this, e, t) + : i < 63 + ? d(this, e, t) + : i < 1024 + ? (function (e, t, i) { + (i.negative = t.negative ^ e.negative), + (i.length = e.length + t.length); + for (var n = 0, r = 0, o = 0; o < i.length - 1; o++) { + var a = r; + r = 0; + for ( + var s = 67108863 & n, + c = Math.min(o, t.length - 1), + u = Math.max(0, o - e.length + 1); + u <= c; + u++ + ) { + var l = o - u, + h = (0 | e.words[l]) * (0 | t.words[u]), + f = 67108863 & h; + (s = 67108863 & (f = (f + s) | 0)), + (r += + (a = + ((a = (a + ((h / 67108864) | 0)) | 0) + + (f >>> 26)) | + 0) >>> 26), + (a &= 67108863); + } + (i.words[o] = s), (n = a), (a = r); + } + return 0 !== n ? (i.words[o] = n) : i.length--, i.strip(); + })(this, e, t) + : m(this, e, t); + }), + (g.prototype.makeRBT = function (e) { + for ( + var t = new Array(e), i = a.prototype._countBits(e) - 1, n = 0; + n < e; + n++ + ) + t[n] = this.revBin(n, i, e); + return t; + }), + (g.prototype.revBin = function (e, t, i) { + if (0 === e || e === i - 1) return e; + for (var n = 0, r = 0; r < t; r++) + (n |= (1 & e) << (t - r - 1)), (e >>= 1); + return n; + }), + (g.prototype.permute = function (e, t, i, n, r, o) { + for (var a = 0; a < o; a++) (n[a] = t[e[a]]), (r[a] = i[e[a]]); + }), + (g.prototype.transform = function (e, t, i, n, r, o) { + this.permute(o, e, t, i, n, r); + for (var a = 1; a < r; a <<= 1) + for ( + var s = a << 1, + c = Math.cos((2 * Math.PI) / s), + u = Math.sin((2 * Math.PI) / s), + l = 0; + l < r; + l += s + ) + for (var h = c, f = u, d = 0; d < a; d++) { + var p = i[l + d], + m = n[l + d], + g = i[l + d + a], + _ = n[l + d + a], + v = h * g - f * _; + (_ = h * _ + f * g), + (g = v), + (i[l + d] = p + g), + (n[l + d] = m + _), + (i[l + d + a] = p - g), + (n[l + d + a] = m - _), + d !== s && + ((v = c * h - u * f), (f = c * f + u * h), (h = v)); + } + }), + (g.prototype.guessLen13b = function (e, t) { + var i = 1 | Math.max(t, e), + n = 1 & i, + r = 0; + for (i = (i / 2) | 0; i; i >>>= 1) r++; + return 1 << (r + 1 + n); + }), + (g.prototype.conjugate = function (e, t, i) { + if (!(i <= 1)) + for (var n = 0; n < i / 2; n++) { + var r = e[n]; + (e[n] = e[i - n - 1]), + (e[i - n - 1] = r), + (r = t[n]), + (t[n] = -t[i - n - 1]), + (t[i - n - 1] = -r); + } + }), + (g.prototype.normalize13b = function (e, t) { + for (var i = 0, n = 0; n < t / 2; n++) { + var r = + 8192 * Math.round(e[2 * n + 1] / t) + + Math.round(e[2 * n] / t) + + i; + (e[n] = 67108863 & r), + (i = r < 67108864 ? 0 : (r / 67108864) | 0); + } + return e; + }), + (g.prototype.convert13b = function (e, t, i, n) { + for (var o = 0, a = 0; a < t; a++) + (o += 0 | e[a]), + (i[2 * a] = 8191 & o), + (o >>>= 13), + (i[2 * a + 1] = 8191 & o), + (o >>>= 13); + for (a = 2 * t; a < n; ++a) i[a] = 0; + r(0 === o), r(0 == (-8192 & o)); + }), + (g.prototype.stub = function (e) { + for (var t = new Array(e), i = 0; i < e; i++) t[i] = 0; + return t; + }), + (g.prototype.mulp = function (e, t, i) { + var n = 2 * this.guessLen13b(e.length, t.length), + r = this.makeRBT(n), + o = this.stub(n), + a = new Array(n), + s = new Array(n), + c = new Array(n), + u = new Array(n), + l = new Array(n), + h = new Array(n), + f = i.words; + (f.length = n), + this.convert13b(e.words, e.length, a, n), + this.convert13b(t.words, t.length, u, n), + this.transform(a, o, s, c, n, r), + this.transform(u, o, l, h, n, r); + for (var d = 0; d < n; d++) { + var p = s[d] * l[d] - c[d] * h[d]; + (c[d] = s[d] * h[d] + c[d] * l[d]), (s[d] = p); + } + return ( + this.conjugate(s, c, n), + this.transform(s, c, f, o, n, r), + this.conjugate(f, o, n), + this.normalize13b(f, n), + (i.negative = e.negative ^ t.negative), + (i.length = e.length + t.length), + i.strip() + ); + }), + (a.prototype.mul = function (e) { + var t = new a(null); + return ( + (t.words = new Array(this.length + e.length)), this.mulTo(e, t) + ); + }), + (a.prototype.mulf = function (e) { + var t = new a(null); + return (t.words = new Array(this.length + e.length)), m(this, e, t); + }), + (a.prototype.imul = function (e) { + return this.clone().mulTo(e, this); + }), + (a.prototype.imuln = function (e) { + r("number" == typeof e), r(e < 67108864); + for (var t = 0, i = 0; i < this.length; i++) { + var n = (0 | this.words[i]) * e, + o = (67108863 & n) + (67108863 & t); + (t >>= 26), + (t += (n / 67108864) | 0), + (t += o >>> 26), + (this.words[i] = 67108863 & o); + } + return 0 !== t && ((this.words[i] = t), this.length++), this; + }), + (a.prototype.muln = function (e) { + return this.clone().imuln(e); + }), + (a.prototype.sqr = function () { + return this.mul(this); + }), + (a.prototype.isqr = function () { + return this.imul(this.clone()); + }), + (a.prototype.pow = function (e) { + var t = (function (e) { + for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) { + var n = (i / 26) | 0, + r = i % 26; + t[i] = (e.words[n] & (1 << r)) >>> r; + } + return t; + })(e); + if (0 === t.length) return new a(1); + for ( + var i = this, n = 0; + n < t.length && 0 === t[n]; + n++, i = i.sqr() + ); + if (++n < t.length) + for (var r = i.sqr(); n < t.length; n++, r = r.sqr()) + 0 !== t[n] && (i = i.mul(r)); + return i; + }), + (a.prototype.iushln = function (e) { + r("number" == typeof e && e >= 0); + var t, + i = e % 26, + n = (e - i) / 26, + o = (67108863 >>> (26 - i)) << (26 - i); + if (0 !== i) { + var a = 0; + for (t = 0; t < this.length; t++) { + var s = this.words[t] & o, + c = ((0 | this.words[t]) - s) << i; + (this.words[t] = c | a), (a = s >>> (26 - i)); + } + a && ((this.words[t] = a), this.length++); + } + if (0 !== n) { + for (t = this.length - 1; t >= 0; t--) + this.words[t + n] = this.words[t]; + for (t = 0; t < n; t++) this.words[t] = 0; + this.length += n; + } + return this.strip(); + }), + (a.prototype.ishln = function (e) { + return r(0 === this.negative), this.iushln(e); + }), + (a.prototype.iushrn = function (e, t, i) { + var n; + r("number" == typeof e && e >= 0), + (n = t ? (t - (t % 26)) / 26 : 0); + var o = e % 26, + a = Math.min((e - o) / 26, this.length), + s = 67108863 ^ ((67108863 >>> o) << o), + c = i; + if (((n -= a), (n = Math.max(0, n)), c)) { + for (var u = 0; u < a; u++) c.words[u] = this.words[u]; + c.length = a; + } + if (0 === a); + else if (this.length > a) + for (this.length -= a, u = 0; u < this.length; u++) + this.words[u] = this.words[u + a]; + else (this.words[0] = 0), (this.length = 1); + var l = 0; + for (u = this.length - 1; u >= 0 && (0 !== l || u >= n); u--) { + var h = 0 | this.words[u]; + (this.words[u] = (l << (26 - o)) | (h >>> o)), (l = h & s); + } + return ( + c && 0 !== l && (c.words[c.length++] = l), + 0 === this.length && ((this.words[0] = 0), (this.length = 1)), + this.strip() + ); + }), + (a.prototype.ishrn = function (e, t, i) { + return r(0 === this.negative), this.iushrn(e, t, i); + }), + (a.prototype.shln = function (e) { + return this.clone().ishln(e); + }), + (a.prototype.ushln = function (e) { + return this.clone().iushln(e); + }), + (a.prototype.shrn = function (e) { + return this.clone().ishrn(e); + }), + (a.prototype.ushrn = function (e) { + return this.clone().iushrn(e); + }), + (a.prototype.testn = function (e) { + r("number" == typeof e && e >= 0); + var t = e % 26, + i = (e - t) / 26, + n = 1 << t; + return !(this.length <= i) && !!(this.words[i] & n); + }), + (a.prototype.imaskn = function (e) { + r("number" == typeof e && e >= 0); + var t = e % 26, + i = (e - t) / 26; + if ( + (r( + 0 === this.negative, + "imaskn works only with positive numbers" + ), + this.length <= i) + ) + return this; + if ( + (0 !== t && i++, + (this.length = Math.min(i, this.length)), + 0 !== t) + ) { + var n = 67108863 ^ ((67108863 >>> t) << t); + this.words[this.length - 1] &= n; + } + return this.strip(); + }), + (a.prototype.maskn = function (e) { + return this.clone().imaskn(e); + }), + (a.prototype.iaddn = function (e) { + return ( + r("number" == typeof e), + r(e < 67108864), + e < 0 + ? this.isubn(-e) + : 0 !== this.negative + ? 1 === this.length && (0 | this.words[0]) < e + ? ((this.words[0] = e - (0 | this.words[0])), + (this.negative = 0), + this) + : ((this.negative = 0), + this.isubn(e), + (this.negative = 1), + this) + : this._iaddn(e) + ); + }), + (a.prototype._iaddn = function (e) { + this.words[0] += e; + for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) + (this.words[t] -= 67108864), + t === this.length - 1 + ? (this.words[t + 1] = 1) + : this.words[t + 1]++; + return (this.length = Math.max(this.length, t + 1)), this; + }), + (a.prototype.isubn = function (e) { + if ((r("number" == typeof e), r(e < 67108864), e < 0)) + return this.iaddn(-e); + if (0 !== this.negative) + return ( + (this.negative = 0), this.iaddn(e), (this.negative = 1), this + ); + if (((this.words[0] -= e), 1 === this.length && this.words[0] < 0)) + (this.words[0] = -this.words[0]), (this.negative = 1); + else + for (var t = 0; t < this.length && this.words[t] < 0; t++) + (this.words[t] += 67108864), (this.words[t + 1] -= 1); + return this.strip(); + }), + (a.prototype.addn = function (e) { + return this.clone().iaddn(e); + }), + (a.prototype.subn = function (e) { + return this.clone().isubn(e); + }), + (a.prototype.iabs = function () { + return (this.negative = 0), this; + }), + (a.prototype.abs = function () { + return this.clone().iabs(); + }), + (a.prototype._ishlnsubmul = function (e, t, i) { + var n, + o, + a = e.length + i; + this._expand(a); + var s = 0; + for (n = 0; n < e.length; n++) { + o = (0 | this.words[n + i]) + s; + var c = (0 | e.words[n]) * t; + (s = ((o -= 67108863 & c) >> 26) - ((c / 67108864) | 0)), + (this.words[n + i] = 67108863 & o); + } + for (; n < this.length - i; n++) + (s = (o = (0 | this.words[n + i]) + s) >> 26), + (this.words[n + i] = 67108863 & o); + if (0 === s) return this.strip(); + for (r(-1 === s), s = 0, n = 0; n < this.length; n++) + (s = (o = -(0 | this.words[n]) + s) >> 26), + (this.words[n] = 67108863 & o); + return (this.negative = 1), this.strip(); + }), + (a.prototype._wordDiv = function (e, t) { + var i = (this.length, e.length), + n = this.clone(), + r = e, + o = 0 | r.words[r.length - 1]; + 0 !== (i = 26 - this._countBits(o)) && + ((r = r.ushln(i)), n.iushln(i), (o = 0 | r.words[r.length - 1])); + var s, + c = n.length - r.length; + if ("mod" !== t) { + ((s = new a(null)).length = c + 1), + (s.words = new Array(s.length)); + for (var u = 0; u < s.length; u++) s.words[u] = 0; + } + var l = n.clone()._ishlnsubmul(r, 1, c); + 0 === l.negative && ((n = l), s && (s.words[c] = 1)); + for (var h = c - 1; h >= 0; h--) { + var f = + 67108864 * (0 | n.words[r.length + h]) + + (0 | n.words[r.length + h - 1]); + for ( + f = Math.min((f / o) | 0, 67108863), n._ishlnsubmul(r, f, h); + 0 !== n.negative; + + ) + f--, + (n.negative = 0), + n._ishlnsubmul(r, 1, h), + n.isZero() || (n.negative ^= 1); + s && (s.words[h] = f); + } + return ( + s && s.strip(), + n.strip(), + "div" !== t && 0 !== i && n.iushrn(i), + { + div: s || null, + mod: n, + } + ); + }), + (a.prototype.divmod = function (e, t, i) { + return ( + r(!e.isZero()), + this.isZero() + ? { + div: new a(0), + mod: new a(0), + } + : 0 !== this.negative && 0 === e.negative + ? ((s = this.neg().divmod(e, t)), + "mod" !== t && (n = s.div.neg()), + "div" !== t && + ((o = s.mod.neg()), i && 0 !== o.negative && o.iadd(e)), + { + div: n, + mod: o, + }) + : 0 === this.negative && 0 !== e.negative + ? ((s = this.divmod(e.neg(), t)), + "mod" !== t && (n = s.div.neg()), + { + div: n, + mod: s.mod, + }) + : 0 != (this.negative & e.negative) + ? ((s = this.neg().divmod(e.neg(), t)), + "div" !== t && + ((o = s.mod.neg()), i && 0 !== o.negative && o.isub(e)), + { + div: s.div, + mod: o, + }) + : e.length > this.length || this.cmp(e) < 0 + ? { + div: new a(0), + mod: this, + } + : 1 === e.length + ? "div" === t + ? { + div: this.divn(e.words[0]), + mod: null, + } + : "mod" === t + ? { + div: null, + mod: new a(this.modn(e.words[0])), + } + : { + div: this.divn(e.words[0]), + mod: new a(this.modn(e.words[0])), + } + : this._wordDiv(e, t) + ); + var n, o, s; + }), + (a.prototype.div = function (e) { + return this.divmod(e, "div", false).div; + }), + (a.prototype.mod = function (e) { + return this.divmod(e, "mod", false).mod; + }), + (a.prototype.umod = function (e) { + return this.divmod(e, "mod", true).mod; + }), + (a.prototype.divRound = function (e) { + var t = this.divmod(e); + if (t.mod.isZero()) return t.div; + var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod, + n = e.ushrn(1), + r = e.andln(1), + o = i.cmp(n); + return o < 0 || (1 === r && 0 === o) + ? t.div + : 0 !== t.div.negative + ? t.div.isubn(1) + : t.div.iaddn(1); + }), + (a.prototype.modn = function (e) { + r(e <= 67108863); + for (var t = (1 << 26) % e, i = 0, n = this.length - 1; n >= 0; n--) + i = (t * i + (0 | this.words[n])) % e; + return i; + }), + (a.prototype.idivn = function (e) { + r(e <= 67108863); + for (var t = 0, i = this.length - 1; i >= 0; i--) { + var n = (0 | this.words[i]) + 67108864 * t; + (this.words[i] = (n / e) | 0), (t = n % e); + } + return this.strip(); + }), + (a.prototype.divn = function (e) { + return this.clone().idivn(e); + }), + (a.prototype.egcd = function (e) { + r(0 === e.negative), r(!e.isZero()); + var t = this, + i = e.clone(); + t = 0 !== t.negative ? t.umod(e) : t.clone(); + for ( + var n = new a(1), o = new a(0), s = new a(0), c = new a(1), u = 0; + t.isEven() && i.isEven(); + + ) + t.iushrn(1), i.iushrn(1), ++u; + for (var l = i.clone(), h = t.clone(); !t.isZero(); ) { + for ( + var f = 0, d = 1; + 0 == (t.words[0] & d) && f < 26; + ++f, d <<= 1 + ); + if (f > 0) + for (t.iushrn(f); f-- > 0; ) + (n.isOdd() || o.isOdd()) && (n.iadd(l), o.isub(h)), + n.iushrn(1), + o.iushrn(1); + for ( + var p = 0, m = 1; + 0 == (i.words[0] & m) && p < 26; + ++p, m <<= 1 + ); + if (p > 0) + for (i.iushrn(p); p-- > 0; ) + (s.isOdd() || c.isOdd()) && (s.iadd(l), c.isub(h)), + s.iushrn(1), + c.iushrn(1); + t.cmp(i) >= 0 + ? (t.isub(i), n.isub(s), o.isub(c)) + : (i.isub(t), s.isub(n), c.isub(o)); + } + return { + a: s, + b: c, + gcd: i.iushln(u), + }; + }), + (a.prototype._invmp = function (e) { + r(0 === e.negative), r(!e.isZero()); + var t = this, + i = e.clone(); + t = 0 !== t.negative ? t.umod(e) : t.clone(); + for ( + var n, o = new a(1), s = new a(0), c = i.clone(); + t.cmpn(1) > 0 && i.cmpn(1) > 0; + + ) { + for ( + var u = 0, l = 1; + 0 == (t.words[0] & l) && u < 26; + ++u, l <<= 1 + ); + if (u > 0) + for (t.iushrn(u); u-- > 0; ) + o.isOdd() && o.iadd(c), o.iushrn(1); + for ( + var h = 0, f = 1; + 0 == (i.words[0] & f) && h < 26; + ++h, f <<= 1 + ); + if (h > 0) + for (i.iushrn(h); h-- > 0; ) + s.isOdd() && s.iadd(c), s.iushrn(1); + t.cmp(i) >= 0 ? (t.isub(i), o.isub(s)) : (i.isub(t), s.isub(o)); + } + return (n = 0 === t.cmpn(1) ? o : s).cmpn(0) < 0 && n.iadd(e), n; + }), + (a.prototype.gcd = function (e) { + if (this.isZero()) return e.abs(); + if (e.isZero()) return this.abs(); + var t = this.clone(), + i = e.clone(); + (t.negative = 0), (i.negative = 0); + for (var n = 0; t.isEven() && i.isEven(); n++) + t.iushrn(1), i.iushrn(1); + for (;;) { + for (; t.isEven(); ) t.iushrn(1); + for (; i.isEven(); ) i.iushrn(1); + var r = t.cmp(i); + if (r < 0) { + var o = t; + (t = i), (i = o); + } else if (0 === r || 0 === i.cmpn(1)) break; + t.isub(i); + } + return i.iushln(n); + }), + (a.prototype.invm = function (e) { + return this.egcd(e).a.umod(e); + }), + (a.prototype.isEven = function () { + return 0 == (1 & this.words[0]); + }), + (a.prototype.isOdd = function () { + return 1 == (1 & this.words[0]); + }), + (a.prototype.andln = function (e) { + return this.words[0] & e; + }), + (a.prototype.bincn = function (e) { + r("number" == typeof e); + var t = e % 26, + i = (e - t) / 26, + n = 1 << t; + if (this.length <= i) + return this._expand(i + 1), (this.words[i] |= n), this; + for (var o = n, a = i; 0 !== o && a < this.length; a++) { + var s = 0 | this.words[a]; + (o = (s += o) >>> 26), (s &= 67108863), (this.words[a] = s); + } + return 0 !== o && ((this.words[a] = o), this.length++), this; + }), + (a.prototype.isZero = function () { + return 1 === this.length && 0 === this.words[0]; + }), + (a.prototype.cmpn = function (e) { + var t, + i = e < 0; + if (0 !== this.negative && !i) return -1; + if (0 === this.negative && i) return 1; + if ((this.strip(), this.length > 1)) t = 1; + else { + i && (e = -e), r(e <= 67108863, "Number is too big"); + var n = 0 | this.words[0]; + t = n === e ? 0 : n < e ? -1 : 1; + } + return 0 !== this.negative ? 0 | -t : t; + }), + (a.prototype.cmp = function (e) { + if (0 !== this.negative && 0 === e.negative) return -1; + if (0 === this.negative && 0 !== e.negative) return 1; + var t = this.ucmp(e); + return 0 !== this.negative ? 0 | -t : t; + }), + (a.prototype.ucmp = function (e) { + if (this.length > e.length) return 1; + if (this.length < e.length) return -1; + for (var t = 0, i = this.length - 1; i >= 0; i--) { + var n = 0 | this.words[i], + r = 0 | e.words[i]; + if (n !== r) { + n < r ? (t = -1) : n > r && (t = 1); + break; + } + } + return t; + }), + (a.prototype.gtn = function (e) { + return 1 === this.cmpn(e); + }), + (a.prototype.gt = function (e) { + return 1 === this.cmp(e); + }), + (a.prototype.gten = function (e) { + return this.cmpn(e) >= 0; + }), + (a.prototype.gte = function (e) { + return this.cmp(e) >= 0; + }), + (a.prototype.ltn = function (e) { + return -1 === this.cmpn(e); + }), + (a.prototype.lt = function (e) { + return -1 === this.cmp(e); + }), + (a.prototype.lten = function (e) { + return this.cmpn(e) <= 0; + }), + (a.prototype.lte = function (e) { + return this.cmp(e) <= 0; + }), + (a.prototype.eqn = function (e) { + return 0 === this.cmpn(e); + }), + (a.prototype.eq = function (e) { + return 0 === this.cmp(e); + }), + (a.red = function (e) { + return new A(e); + }), + (a.prototype.toRed = function (e) { + return ( + r(!this.red, "Already a number in reduction context"), + r(0 === this.negative, "red works only with positives"), + e.convertTo(this)._forceRed(e) + ); + }), + (a.prototype.fromRed = function () { + return ( + r( + this.red, + "fromRed works only with numbers in reduction context" + ), + this.red.convertFrom(this) + ); + }), + (a.prototype._forceRed = function (e) { + return (this.red = e), this; + }), + (a.prototype.forceRed = function (e) { + return ( + r(!this.red, "Already a number in reduction context"), + this._forceRed(e) + ); + }), + (a.prototype.redAdd = function (e) { + return ( + r(this.red, "redAdd works only with red numbers"), + this.red.add(this, e) + ); + }), + (a.prototype.redIAdd = function (e) { + return ( + r(this.red, "redIAdd works only with red numbers"), + this.red.iadd(this, e) + ); + }), + (a.prototype.redSub = function (e) { + return ( + r(this.red, "redSub works only with red numbers"), + this.red.sub(this, e) + ); + }), + (a.prototype.redISub = function (e) { + return ( + r(this.red, "redISub works only with red numbers"), + this.red.isub(this, e) + ); + }), + (a.prototype.redShl = function (e) { + return ( + r(this.red, "redShl works only with red numbers"), + this.red.shl(this, e) + ); + }), + (a.prototype.redMul = function (e) { + return ( + r(this.red, "redMul works only with red numbers"), + this.red._verify2(this, e), + this.red.mul(this, e) + ); + }), + (a.prototype.redIMul = function (e) { + return ( + r(this.red, "redMul works only with red numbers"), + this.red._verify2(this, e), + this.red.imul(this, e) + ); + }), + (a.prototype.redSqr = function () { + return ( + r(this.red, "redSqr works only with red numbers"), + this.red._verify1(this), + this.red.sqr(this) + ); + }), + (a.prototype.redISqr = function () { + return ( + r(this.red, "redISqr works only with red numbers"), + this.red._verify1(this), + this.red.isqr(this) + ); + }), + (a.prototype.redSqrt = function () { + return ( + r(this.red, "redSqrt works only with red numbers"), + this.red._verify1(this), + this.red.sqrt(this) + ); + }), + (a.prototype.redInvm = function () { + return ( + r(this.red, "redInvm works only with red numbers"), + this.red._verify1(this), + this.red.invm(this) + ); + }), + (a.prototype.redNeg = function () { + return ( + r(this.red, "redNeg works only with red numbers"), + this.red._verify1(this), + this.red.neg(this) + ); + }), + (a.prototype.redPow = function (e) { + return ( + r(this.red && !e.red, "redPow(normalNum)"), + this.red._verify1(this), + this.red.pow(this, e) + ); + }); + var _ = { + k256: null, + p224: null, + p192: null, + p25519: null, + }; + function v(e, t) { + (this.name = e), + (this.p = new a(t, 16)), + (this.n = this.p.bitLength()), + (this.k = new a(1).iushln(this.n).isub(this.p)), + (this.tmp = this._tmp()); + } + function y() { + v.call( + this, + "k256", + "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" + ); + } + function b() { + v.call( + this, + "p224", + "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" + ); + } + function E() { + v.call( + this, + "p192", + "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" + ); + } + function T() { + v.call( + this, + "25519", + "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" + ); + } + function A(e) { + if ("string" == typeof e) { + var t = a._prime(e); + (this.m = t.p), (this.prime = t); + } else + r(e.gtn(1), "modulus must be greater than 1"), + (this.m = e), + (this.prime = null); + } + function x(e) { + A.call(this, e), + (this.shift = this.m.bitLength()), + this.shift % 26 != 0 && (this.shift += 26 - (this.shift % 26)), + (this.r = new a(1).iushln(this.shift)), + (this.r2 = this.imod(this.r.sqr())), + (this.rinv = this.r._invmp(this.m)), + (this.minv = this.rinv.mul(this.r).isubn(1).div(this.m)), + (this.minv = this.minv.umod(this.r)), + (this.minv = this.r.sub(this.minv)); + } + (v.prototype._tmp = function () { + var e = new a(null); + return (e.words = new Array(Math.ceil(this.n / 13))), e; + }), + (v.prototype.ireduce = function (e) { + var t, + i = e; + do { + this.split(i, this.tmp), + (t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength()); + } while (t > this.n); + var n = t < this.n ? -1 : i.ucmp(this.p); + return ( + 0 === n + ? ((i.words[0] = 0), (i.length = 1)) + : n > 0 + ? i.isub(this.p) + : i.strip(), + i + ); + }), + (v.prototype.split = function (e, t) { + e.iushrn(this.n, 0, t); + }), + (v.prototype.imulK = function (e) { + return e.imul(this.k); + }), + o(y, v), + (y.prototype.split = function (e, t) { + for (var i = Math.min(e.length, 9), n = 0; n < i; n++) + t.words[n] = e.words[n]; + if (((t.length = i), e.length <= 9)) + return (e.words[0] = 0), void (e.length = 1); + var r = e.words[9]; + for (t.words[t.length++] = 4194303 & r, n = 10; n < e.length; n++) { + var o = 0 | e.words[n]; + (e.words[n - 10] = ((4194303 & o) << 4) | (r >>> 22)), (r = o); + } + (r >>>= 22), + (e.words[n - 10] = r), + 0 === r && e.length > 10 ? (e.length -= 10) : (e.length -= 9); + }), + (y.prototype.imulK = function (e) { + (e.words[e.length] = 0), + (e.words[e.length + 1] = 0), + (e.length += 2); + for (var t = 0, i = 0; i < e.length; i++) { + var n = 0 | e.words[i]; + (t += 977 * n), + (e.words[i] = 67108863 & t), + (t = 64 * n + ((t / 67108864) | 0)); + } + return ( + 0 === e.words[e.length - 1] && + (e.length--, 0 === e.words[e.length - 1] && e.length--), + e + ); + }), + o(b, v), + o(E, v), + o(T, v), + (T.prototype.imulK = function (e) { + for (var t = 0, i = 0; i < e.length; i++) { + var n = 19 * (0 | e.words[i]) + t, + r = 67108863 & n; + (n >>>= 26), (e.words[i] = r), (t = n); + } + return 0 !== t && (e.words[e.length++] = t), e; + }), + (a._prime = function (e) { + if (_[e]) return _[e]; + var t; + if ("k256" === e) t = new y(); + else if ("p224" === e) t = new b(); + else if ("p192" === e) t = new E(); + else { + if ("p25519" !== e) throw new Error("Unknown prime " + e); + t = new T(); + } + return (_[e] = t), t; + }), + (A.prototype._verify1 = function (e) { + r(0 === e.negative, "red works only with positives"), + r(e.red, "red works only with red numbers"); + }), + (A.prototype._verify2 = function (e, t) { + r(0 == (e.negative | t.negative), "red works only with positives"), + r(e.red && e.red === t.red, "red works only with red numbers"); + }), + (A.prototype.imod = function (e) { + return this.prime + ? this.prime.ireduce(e)._forceRed(this) + : e.umod(this.m)._forceRed(this); + }), + (A.prototype.neg = function (e) { + return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this); + }), + (A.prototype.add = function (e, t) { + this._verify2(e, t); + var i = e.add(t); + return i.cmp(this.m) >= 0 && i.isub(this.m), i._forceRed(this); + }), + (A.prototype.iadd = function (e, t) { + this._verify2(e, t); + var i = e.iadd(t); + return i.cmp(this.m) >= 0 && i.isub(this.m), i; + }), + (A.prototype.sub = function (e, t) { + this._verify2(e, t); + var i = e.sub(t); + return i.cmpn(0) < 0 && i.iadd(this.m), i._forceRed(this); + }), + (A.prototype.isub = function (e, t) { + this._verify2(e, t); + var i = e.isub(t); + return i.cmpn(0) < 0 && i.iadd(this.m), i; + }), + (A.prototype.shl = function (e, t) { + return this._verify1(e), this.imod(e.ushln(t)); + }), + (A.prototype.imul = function (e, t) { + return this._verify2(e, t), this.imod(e.imul(t)); + }), + (A.prototype.mul = function (e, t) { + return this._verify2(e, t), this.imod(e.mul(t)); + }), + (A.prototype.isqr = function (e) { + return this.imul(e, e.clone()); + }), + (A.prototype.sqr = function (e) { + return this.mul(e, e); + }), + (A.prototype.sqrt = function (e) { + if (e.isZero()) return e.clone(); + var t = this.m.andln(3); + if ((r(t % 2 == 1), 3 === t)) { + var i = this.m.add(new a(1)).iushrn(2); + return this.pow(e, i); + } + for ( + var n = this.m.subn(1), o = 0; + !n.isZero() && 0 === n.andln(1); + + ) + o++, n.iushrn(1); + r(!n.isZero()); + var s = new a(1).toRed(this), + c = s.redNeg(), + u = this.m.subn(1).iushrn(1), + l = this.m.bitLength(); + for ( + l = new a(2 * l * l).toRed(this); + 0 !== this.pow(l, u).cmp(c); + + ) + l.redIAdd(c); + for ( + var h = this.pow(l, n), + f = this.pow(e, n.addn(1).iushrn(1)), + d = this.pow(e, n), + p = o; + 0 !== d.cmp(s); + + ) { + for (var m = d, g = 0; 0 !== m.cmp(s); g++) m = m.redSqr(); + r(g < p); + var _ = this.pow(h, new a(1).iushln(p - g - 1)); + (f = f.redMul(_)), (h = _.redSqr()), (d = d.redMul(h)), (p = g); + } + return f; + }), + (A.prototype.invm = function (e) { + var t = e._invmp(this.m); + return 0 !== t.negative + ? ((t.negative = 0), this.imod(t).redNeg()) + : this.imod(t); + }), + (A.prototype.pow = function (e, t) { + if (t.isZero()) return new a(1).toRed(this); + if (0 === t.cmpn(1)) return e.clone(); + var i = new Array(16); + (i[0] = new a(1).toRed(this)), (i[1] = e); + for (var n = 2; n < i.length; n++) i[n] = this.mul(i[n - 1], e); + var r = i[0], + o = 0, + s = 0, + c = t.bitLength() % 26; + for (0 === c && (c = 26), n = t.length - 1; n >= 0; n--) { + for (var u = t.words[n], l = c - 1; l >= 0; l--) { + var h = (u >> l) & 1; + r !== i[0] && (r = this.sqr(r)), + 0 !== h || 0 !== o + ? ((o <<= 1), + (o |= h), + (4 === ++s || (0 === n && 0 === l)) && + ((r = this.mul(r, i[o])), (s = 0), (o = 0))) + : (s = 0); + } + c = 26; + } + return r; + }), + (A.prototype.convertTo = function (e) { + var t = e.umod(this.m); + return t === e ? t.clone() : t; + }), + (A.prototype.convertFrom = function (e) { + var t = e.clone(); + return (t.red = null), t; + }), + (a.mont = function (e) { + return new x(e); + }), + o(x, A), + (x.prototype.convertTo = function (e) { + return this.imod(e.ushln(this.shift)); + }), + (x.prototype.convertFrom = function (e) { + var t = this.imod(e.mul(this.rinv)); + return (t.red = null), t; + }), + (x.prototype.imul = function (e, t) { + if (e.isZero() || t.isZero()) + return (e.words[0] = 0), (e.length = 1), e; + var i = e.imul(t), + n = i + .maskn(this.shift) + .mul(this.minv) + .imaskn(this.shift) + .mul(this.m), + r = i.isub(n).iushrn(this.shift), + o = r; + return ( + r.cmp(this.m) >= 0 + ? (o = r.isub(this.m)) + : r.cmpn(0) < 0 && (o = r.iadd(this.m)), + o._forceRed(this) + ); + }), + (x.prototype.mul = function (e, t) { + if (e.isZero() || t.isZero()) return new a(0)._forceRed(this); + var i = e.mul(t), + n = i + .maskn(this.shift) + .mul(this.minv) + .imaskn(this.shift) + .mul(this.m), + r = i.isub(n).iushrn(this.shift), + o = r; + return ( + r.cmp(this.m) >= 0 + ? (o = r.isub(this.m)) + : r.cmpn(0) < 0 && (o = r.iadd(this.m)), + o._forceRed(this) + ); + }), + (x.prototype.invm = function (e) { + return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this); + }); + })(e, this); + }.call(this, i(122)(e))); + }, + function (e, t, i) { + var n = i(4), + r = i(138), + o = i(39), + a = Object.defineProperty; + t.f = i(13) + ? Object.defineProperty + : function (e, t, i) { + if ((n(e), (t = o(t, true)), n(i), r)) + try { + return a(e, t, i); + } catch (e) {} + if ("get" in i || "set" in i) + throw TypeError("Accessors not supported!"); + return "value" in i && (e[t] = i.value), e; + }; + }, + function (e, t, i) { + e.exports = !i(3)(function () { + return ( + 7 != + Object.defineProperty({}, "a", { + get: function () { + return 7; + }, + }).a + ); + }); + }, + function (exp, t) { + var i = (exp.exports = { + version: "2.6.0", + }); + + "number" == typeof __e && (__e = i); + }, + function (e, t) { + function i(e) { + return (i = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + var n; + n = (function () { + return this; + })(); + try { + n = n || new Function("return this")(); + } catch (e) { + "object" === ("undefined" == typeof window ? "undefined" : i(window)) && + (n = window); + } + e.exports = n; + }, + function (exp, unused_arg, getterFunc) { + // vec3Math i = 16 + exp.exports = { + EPSILON: getterFunc(173), + create: getterFunc(174), + clone: getterFunc(413), + angle: getterFunc(414), + fromValues: getterFunc(175), + copy: getterFunc(415), + set: getterFunc(416), + equals: getterFunc(417), + exactEquals: getterFunc(418), + add: getterFunc(419), + subtract: getterFunc(178), + sub: getterFunc(420), + multiply: getterFunc(179), + mul: getterFunc(421), + divide: getterFunc(180), + div: getterFunc(422), + min: getterFunc(423), + max: getterFunc(424), + floor: getterFunc(425), + ceil: getterFunc(426), + round: getterFunc(427), + scale: getterFunc(428), + scaleAndAdd: getterFunc(429), + distance: getterFunc(181), + dist: getterFunc(430), + squaredDistance: getterFunc(182), + sqrDist: getterFunc(431), + length: getterFunc(183), + len: getterFunc(432), + squaredLength: getterFunc(184), + sqrLen: getterFunc(433), + negate: getterFunc(434), + inverse: getterFunc(435), + normalize: getterFunc(176), + dot: getterFunc(177), + cross: getterFunc(436), + lerp: getterFunc(437), + random: getterFunc(438), + transformMat4: getterFunc(439), + transformMat3: getterFunc(440), + transformQuat: getterFunc(441), + rotateX: getterFunc(442), + rotateY: getterFunc(443), + rotateZ: getterFunc(444), + forEach: getterFunc(445), + }; + }, + function (e, t, getterFunc) { + "use strict"; + var n = t; + (n.version = getterFunc(549).version), + (n.utils = getterFunc(550)), + (n.rand = getterFunc(213)), + (n.curve = getterFunc(91)), + (n.curves = getterFunc(555)), + (n.ec = getterFunc(563)), + (n.eddsa = getterFunc(567)); + }, + function (e, t, i) { + "use strict"; + (function (e) { + function n(t, i, n, r, o, a, s) { + try { + var c = t[a](s), + u = c.value; + } catch (e) { + return void n(e); + } + c.done ? i(u) : e.resolve(u).then(r, o); + } + function r(t) { + return function () { + var i = this, + r = arguments; + return new e(function (e, o) { + var a = t.apply(i, r); + function s(t) { + n(a, e, o, s, c, "next", t); + } + function c(t) { + n(a, e, o, s, c, "throw", t); + } + s(void 0); + }); + }; + } + function o(e, t) { + for (var i = 0; i < t.length; i++) { + var n = t[i]; + (n.enumerable = n.enumerable || false), + (n.configurable = true), + "value" in n && (n.writable = true), + Object.defineProperty(e, n.key, n); + } + } + var a = i(397), + s = (function () { + function t() { + !(function (e, t) { + if (!(e instanceof t)) + throw new TypeError("Cannot call a class as a function"); + })(this, t); + } + var i, n, s; + return ( + (i = t), + (n = null), + (s = [ + { key: "init", - value: function() { - self.baseUrl = a.backendBaseUrl, - self.socket = null - } - }, { + value: function () { + (self.baseUrl = a.backendBaseUrl), (self.socket = null); + }, + }, + { key: "getICECandidates", - value: function(i) { - return new e(function(e, n) { - t.executeXhr("/get-ice-candidates/" + i, "get").then(function(t) { - e([JSON.parse(t).v.iceServers]) - }) - } - ) - } - }, { + value: function (i) { + return new e(function (e, n) { + t.executeXhr("/get-ice-candidates/" + i, "get").then( + function (t) { + e([JSON.parse(t).v.iceServers]); + } + ); + }); + }, + }, + { key: "getNewGame", - value: function() { - return new e(function(e, i) { - t.executeXhr("/game", "get").then(function(i) { - var n = JSON.parse(i); - e(n), - setInterval(function() { - t.executeXhr("/game/" + n.code + "/heartbeat", "put").then(function(e) {}) - }, 3e4) - }) - } - ) - } - }, { + value: function () { + return new e(function (e, i) { + t.executeXhr("/game", "get").then(function (i) { + var n = JSON.parse(i); + e(n), + setInterval(function () { + t.executeXhr( + "/game/" + n.code + "/heartbeat", + "put" + ).then(function (e) {}); + }, 3e4); + }); + }); + }, + }, + { key: "getGame", - value: function(i) { - return null == i ? t.getNewGame() : new e(function(e, n) { - t.executeXhr("/game/" + i, "get").then(function(t) { - e(JSON.parse(t)) - }, function(t) { - e(null) - }) - } - ) - } - }, { + value: function (i) { + return null == i + ? t.getNewGame() + : new e(function (e, n) { + t.executeXhr("/game/" + i, "get").then( + function (t) { + e(JSON.parse(t)); + }, + function (t) { + e(null); + } + ); + }); + }, + }, + { key: "listenForData", - value: function() { - var e = r(regeneratorRuntime.mark(function e(t, i) { - return regeneratorRuntime.wrap(function(e) { - for (; ; ) - switch (e.prev = e.next) { - case 0: - if (null !== self.socket) { - e.next = 3; - break - } - return console.log("no socket!"), - e.abrupt("return"); - case 3: - socket.addEventListener("message", function(e) { - var t = JSON.parse(e.data) - , n = { - payload: t.p, - meta: t.m, - msgEvent: t.o, - to: t.m.t, - from: t.m.f - }; - i(n) - }); - case 4: - case "end": - return e.stop() + value: (function () { + var e = r( + regeneratorRuntime.mark(function e(t, i) { + return regeneratorRuntime.wrap( + function (e) { + for (;;) + switch ((e.prev = e.next)) { + case 0: + if (null !== self.socket) { + e.next = 3; + break; } - }, e, this) - })); - return function(t, i) { - return e.apply(this, arguments) - } - }() - }, { + return ( + console.log("no socket!"), e.abrupt("return") + ); + case 3: + socket.addEventListener( + "message", + function (e) { + var t = JSON.parse(e.data), + n = { + payload: t.p, + meta: t.m, + msgEvent: t.o, + to: t.m.t, + from: t.m.f, + }; + i(n); + } + ); + case 4: + case "end": + return e.stop(); + } + }, + e, + this + ); + }) + ); + return function (t, i) { + return e.apply(this, arguments); + }; + })(), + }, + { key: "createSignalingChannel", - value: function() { - var i = r(regeneratorRuntime.mark(function i(n, o) { - return regeneratorRuntime.wrap(function(i) { - for (; ; ) - switch (i.prev = i.next) { - case 0: - return i.abrupt("return", new e(function() { - var e = r(regeneratorRuntime.mark(function e(i, r) { - var a; - return regeneratorRuntime.wrap(function(e) { - for (; ; ) - switch (e.prev = e.next) { - case 0: - return e.next = 2, - t.executeXhr("/create-channel/" + n, "get"); - case 2: - return e.next = 4, - t.getWebSocket(n, o); - case 4: - a = e.sent, - self.socket = a, - a.addEventListener("open", function() { - i(), - setInterval(function() { - a.send("ping") - }, 800) - }); - case 7: - case "end": - return e.stop() - } - }, e, this) - })); - return function(t, i) { - return e.apply(this, arguments) - } - }())); - case 1: - case "end": - return i.stop() - } - }, i, this) - })); - return function(e, t) { - return i.apply(this, arguments) - } - }() - }, { + value: (function () { + var i = r( + regeneratorRuntime.mark(function i(n, o) { + return regeneratorRuntime.wrap( + function (i) { + for (;;) + switch ((i.prev = i.next)) { + case 0: + return i.abrupt( + "return", + new e( + (function () { + var e = r( + regeneratorRuntime.mark(function e( + i, + r + ) { + var a; + return regeneratorRuntime.wrap( + function (e) { + for (;;) + switch ((e.prev = e.next)) { + case 0: + return ( + (e.next = 2), + t.executeXhr( + "/create-channel/" + n, + "get" + ) + ); + case 2: + return ( + (e.next = 4), + t.getWebSocket(n, o) + ); + case 4: + (a = e.sent), + (self.socket = a), + a.addEventListener( + "open", + function () { + i(), + setInterval( + function () { + a.send("ping"); + }, + 800 + ); + } + ); + case 7: + case "end": + return e.stop(); + } + }, + e, + this + ); + }) + ); + return function (t, i) { + return e.apply(this, arguments); + }; + })() + ) + ); + case 1: + case "end": + return i.stop(); + } + }, + i, + this + ); + }) + ); + return function (e, t) { + return i.apply(this, arguments); + }; + })(), + }, + { key: "joinSignalingChannel", - value: function() { - var i = r(regeneratorRuntime.mark(function i(n, o) { - return regeneratorRuntime.wrap(function(i) { - for (; ; ) - switch (i.prev = i.next) { - case 0: - return i.abrupt("return", new e(function() { - var e = r(regeneratorRuntime.mark(function e(i, r) { - var a; - return regeneratorRuntime.wrap(function(e) { - for (; ; ) - switch (e.prev = e.next) { - case 0: - return e.next = 2, - t.getWebSocket(n, o); - case 2: - a = e.sent, - self.socket = a, - a.addEventListener("open", function() { - i(), - setInterval(function() { - a.send("ping") - }, 800) - }); - case 5: - case "end": - return e.stop() - } - }, e, this) - })); - return function(t, i) { - return e.apply(this, arguments) - } - }())); - case 1: - case "end": - return i.stop() - } - }, i, this) - })); - return function(e, t) { - return i.apply(this, arguments) - } - }() - }, { + value: (function () { + var i = r( + regeneratorRuntime.mark(function i(n, o) { + return regeneratorRuntime.wrap( + function (i) { + for (;;) + switch ((i.prev = i.next)) { + case 0: + return i.abrupt( + "return", + new e( + (function () { + var e = r( + regeneratorRuntime.mark(function e( + i, + r + ) { + var a; + return regeneratorRuntime.wrap( + function (e) { + for (;;) + switch ((e.prev = e.next)) { + case 0: + return ( + (e.next = 2), + t.getWebSocket(n, o) + ); + case 2: + (a = e.sent), + (self.socket = a), + a.addEventListener( + "open", + function () { + i(), + setInterval( + function () { + a.send("ping"); + }, + 800 + ); + } + ); + case 5: + case "end": + return e.stop(); + } + }, + e, + this + ); + }) + ); + return function (t, i) { + return e.apply(this, arguments); + }; + })() + ) + ); + case 1: + case "end": + return i.stop(); + } + }, + i, + this + ); + }) + ); + return function (e, t) { + return i.apply(this, arguments); + }; + })(), + }, + { key: "sendSignalingTo", - value: function() { - var e = r(regeneratorRuntime.mark(function e(t, i, n, r) { - var o; - return regeneratorRuntime.wrap(function(e) { - for (; ; ) - switch (e.prev = e.next) { - case 0: - if (null !== self.socket) { - e.next = 3; - break - } - return console.log("no socket!"), - e.abrupt("return"); - case 3: - o = { - t: "u", - m: { - f: t + "/" + n, - t: i, - o: "message" - }, - p: { - signal: JSON.stringify(r) - } - }, - self.socket.send(JSON.stringify(o)); - case 5: - case "end": - return e.stop() + value: (function () { + var e = r( + regeneratorRuntime.mark(function e(t, i, n, r) { + var o; + return regeneratorRuntime.wrap( + function (e) { + for (;;) + switch ((e.prev = e.next)) { + case 0: + if (null !== self.socket) { + e.next = 3; + break; } - }, e, this) - })); - return function(t, i, n, r) { - return e.apply(this, arguments) - } - }() - }, { + return ( + console.log("no socket!"), e.abrupt("return") + ); + case 3: + (o = { + t: "u", + m: { + f: t + "/" + n, + t: i, + o: "message", + }, + p: { + signal: JSON.stringify(r), + }, + }), + self.socket.send(JSON.stringify(o)); + case 5: + case "end": + return e.stop(); + } + }, + e, + this + ); + }) + ); + return function (t, i, n, r) { + return e.apply(this, arguments); + }; + })(), + }, + { key: "getWebSocket", - value: function() { - var e = r(regeneratorRuntime.mark(function e(i, n) { - var r, o, a; - return regeneratorRuntime.wrap(function(e) { - for (; ; ) - switch (e.prev = e.next) { - case 0: - return e.t0 = JSON, - e.next = 3, - t.executeXhr("/get-signaling-token/" + i + "/" + n, "get"); - case 3: - return e.t1 = e.sent, - r = e.t0.parse.call(e.t0, e.t1).v, - e.t2 = JSON, - e.next = 8, - t.executeXhr("/get-signaling-host/" + i + "/" + n, "get"); - case 8: - return e.t3 = e.sent, - o = e.t2.parse.call(e.t2, e.t3).v, - a = o + "/v2/" + r, - e.abrupt("return", new WebSocket(a)); - case 12: - case "end": - return e.stop() - } - }, e, this) - })); - return function(t, i) { - return e.apply(this, arguments) - } - }() - }, { + value: (function () { + var e = r( + regeneratorRuntime.mark(function e(i, n) { + var r, o, a; + return regeneratorRuntime.wrap( + function (e) { + for (;;) + switch ((e.prev = e.next)) { + case 0: + return ( + (e.t0 = JSON), + (e.next = 3), + t.executeXhr( + "/get-signaling-token/" + i + "/" + n, + "get" + ) + ); + case 3: + return ( + (e.t1 = e.sent), + (r = e.t0.parse.call(e.t0, e.t1).v), + (e.t2 = JSON), + (e.next = 8), + t.executeXhr( + "/get-signaling-host/" + i + "/" + n, + "get" + ) + ); + case 8: + return ( + (e.t3 = e.sent), + (o = e.t2.parse.call(e.t2, e.t3).v), + (a = o + "/v2/" + r), + e.abrupt("return", new WebSocket(a)) + ); + case 12: + case "end": + return e.stop(); + } + }, + e, + this + ); + }) + ); + return function (t, i) { + return e.apply(this, arguments); + }; + })(), + }, + { key: "addPlayerToGame", - value: function(i, n) { - return new e(function(e, n) { - t.executeXhr("/game/" + i, "put").then(function(t) { - e(JSON.parse(t)) - }) - } - ) - } - }, { + value: function (i, n) { + return new e(function (e, n) { + t.executeXhr("/game/" + i, "put").then(function (t) { + e(JSON.parse(t)); + }); + }); + }, + }, + { key: "pathUrl", - value: function(e) { - return self.baseUrl + e - } - }, { + value: function (e) { + return self.baseUrl + e; + }, + }, + { key: "executeXhr", - value: function(i, n) { - return new e(function(e, r) { - var o = new XMLHttpRequest - , a = t.pathUrl(i); - o.open(n, a), - o.onreadystatechange = function() { - 4 !== o.readyState || 404 !== o.status || r() - } - , - o.send(), - o.onload = function() { - e(o.responseText) - } - , - o.onerror = function(e) { - console.log(e), - r(e) - } - } - ) - } - }], + value: function (i, n) { + return new e(function (e, r) { + var o = new XMLHttpRequest(), + a = t.pathUrl(i); + o.open(n, a), + (o.onreadystatechange = function () { + 4 !== o.readyState || 404 !== o.status || r(); + }), + o.send(), + (o.onload = function () { + e(o.responseText); + }), + (o.onerror = function (e) { + console.log(e), r(e); + }); + }); + }, + }, + ]), n && o(i.prototype, n), s && o(i, s), t - }(); - t.a = s - } - ).call(this, i(41)) -} -, function(e, t, i) { - var n = i(5) - , r = i(23) - , o = i(22) - , a = i(46)("src") - , s = Function.toString - , c = ("" + s).split("toString"); - i(14).inspectSource = function(e) { - return s.call(e) - } - , - (e.exports = function(e, t, i, s) { + ); + })(); + t.a = s; + }.call(this, i(41))); + }, + function (e, t, i) { + var n = i(5), + r = i(23), + o = i(22), + a = i(46)("src"), + s = Function.toString, + c = ("" + s).split("toString"); + (i(14).inspectSource = function (e) { + return s.call(e); + }), + (e.exports = function (e, t, i, s) { var u = "function" == typeof i; u && (o(i, "name") || r(i, "name", t)), - e[t] !== i && (u && (o(i, a) || r(i, a, e[t] ? "" + e[t] : c.join(String(t)))), - e === n ? e[t] = i : s ? e[t] ? e[t] = i : r(e, t, i) : (delete e[t], - r(e, t, i))) - } - )(Function.prototype, "toString", function() { - return "function" == typeof this && this[a] || s.call(this) - }) -} -, function(e, t, i) { + e[t] !== i && + (u && (o(i, a) || r(i, a, e[t] ? "" + e[t] : c.join(String(t)))), + e === n + ? (e[t] = i) + : s + ? e[t] + ? (e[t] = i) + : r(e, t, i) + : (delete e[t], r(e, t, i))); + })(Function.prototype, "toString", function () { + return ("function" == typeof this && this[a]) || s.call(this); + }); + }, + function (e, t, i) { var n = i(37); - e.exports = function(e) { - return Object(n(e)) - } -} -, function(e, t, i) { - var n = i(0) - , r = i(3) - , o = i(37) - , a = /"/g - , s = function(e, t, i, n) { - var r = String(o(e)) - , s = "<" + t; - return "" !== i && (s += " " + i + '="' + String(n).replace(a, """) + '"'), - s + ">" + r + "" + e.exports = function (e) { + return Object(n(e)); }; - e.exports = function(e, t) { - var i = {}; - i[e] = t(s), - n(n.P + n.F * r(function() { - var t = ""[e]('"'); - return t !== t.toLowerCase() || t.split('"').length > 3 - }), "String", i) - } -} -, function(e, t) { + }, + function (e, t, i) { + var n = i(0), + r = i(3), + o = i(37), + a = /"/g, + s = function (e, t, i, n) { + var r = String(o(e)), + s = "<" + t; + return ( + "" !== i && + (s += " " + i + '="' + String(n).replace(a, """) + '"'), + s + ">" + r + "" + ); + }; + e.exports = function (e, t) { + var i = {}; + (i[e] = t(s)), + n( + n.P + + n.F * + r(function () { + var t = ""[e]('"'); + return t !== t.toLowerCase() || t.split('"').length > 3; + }), + "String", + i + ); + }; + }, + function (e, t) { var i = {}.hasOwnProperty; - e.exports = function(e, t) { - return i.call(e, t) - } -} -, function(e, t, i) { - var n = i(12) - , r = i(45); - e.exports = i(13) ? function(e, t, i) { - return n.f(e, t, r(1, i)) - } - : function(e, t, i) { - return e[t] = i, - e - } -} -, function(e, t, i) { - var n = i(64) - , r = i(37); - e.exports = function(e) { - return n(r(e)) - } -} -, function(e, t) { + e.exports = function (e, t) { + return i.call(e, t); + }; + }, + function (e, t, i) { + var n = i(12), + r = i(45); + e.exports = i(13) + ? function (e, t, i) { + return n.f(e, t, r(1, i)); + } + : function (e, t, i) { + return (e[t] = i), e; + }; + }, + function (e, t, i) { + var n = i(64), + r = i(37); + e.exports = function (e) { + return n(r(e)); + }; + }, + function (e, t) { function i(e, t) { - if (!e) - throw new Error(t || "Assertion failed") + if (!e) throw new Error(t || "Assertion failed"); } - e.exports = i, - i.equal = function(e, t, i) { - if (e != t) - throw new Error(i || "Assertion failed: " + e + " != " + t) - } -} -, function(e, t, i) { + (e.exports = i), + (i.equal = function (e, t, i) { + if (e != t) throw new Error(i || "Assertion failed: " + e + " != " + t); + }); + }, + function (e, t, i) { "use strict"; var n = i(3); - e.exports = function(e, t) { - return !!e && n(function() { - t ? e.call(null, function() {}, 1) : e.call(null) + e.exports = function (e, t) { + return ( + !!e && + n(function () { + t ? e.call(null, function () {}, 1) : e.call(null); }) - } -} -, function(e, t) { - var i, n, r = e.exports = {}; + ); + }; + }, + function (e, t) { + var i, + n, + r = (e.exports = {}); function o() { - throw new Error("setTimeout has not been defined") + throw new Error("setTimeout has not been defined"); } function a() { - throw new Error("clearTimeout has not been defined") + throw new Error("clearTimeout has not been defined"); } function s(e) { - if (i === setTimeout) - return setTimeout(e, 0); - if ((i === o || !i) && setTimeout) - return i = setTimeout, - setTimeout(e, 0); + if (i === setTimeout) return setTimeout(e, 0); + if ((i === o || !i) && setTimeout) + return (i = setTimeout), setTimeout(e, 0); + try { + return i(e, 0); + } catch (t) { try { - return i(e, 0) + return i.call(null, e, 0); } catch (t) { - try { - return i.call(null, e, 0) - } catch (t) { - return i.call(this, e, 0) - } + return i.call(this, e, 0); } + } } - !function() { - try { - i = "function" == typeof setTimeout ? setTimeout : o - } catch (e) { - i = o - } - try { - n = "function" == typeof clearTimeout ? clearTimeout : a - } catch (e) { - n = a - } - }(); - var c, u = [], l = false, h = -1; + !(function () { + try { + i = "function" == typeof setTimeout ? setTimeout : o; + } catch (e) { + i = o; + } + try { + n = "function" == typeof clearTimeout ? clearTimeout : a; + } catch (e) { + n = a; + } + })(); + var c, + u = [], + l = false, + h = -1; function f() { - l && c && (l = false, - c.length ? u = c.concat(u) : h = -1, - u.length && d()) + l && + c && + ((l = false), c.length ? (u = c.concat(u)) : (h = -1), u.length && d()); } function d() { - if (!l) { - var e = s(f); - l = true; - for (var t = u.length; t; ) { - for (c = u, - u = []; ++h < t; ) - c && c[h].run(); - h = -1, - t = u.length - } - c = null, - l = false, - function(e) { - if (n === clearTimeout) - return clearTimeout(e); - if ((n === a || !n) && clearTimeout) - return n = clearTimeout, - clearTimeout(e); - try { - n(e) - } catch (t) { - try { - return n.call(null, e) - } catch (t) { - return n.call(this, e) - } - } - }(e) + if (!l) { + var e = s(f); + l = true; + for (var t = u.length; t; ) { + for (c = u, u = []; ++h < t; ) c && c[h].run(); + (h = -1), (t = u.length); } + (c = null), + (l = false), + (function (e) { + if (n === clearTimeout) return clearTimeout(e); + if ((n === a || !n) && clearTimeout) + return (n = clearTimeout), clearTimeout(e); + try { + n(e); + } catch (t) { + try { + return n.call(null, e); + } catch (t) { + return n.call(this, e); + } + } + })(e); + } } function p(e, t) { - this.fun = e, - this.array = t + (this.fun = e), (this.array = t); } function m() {} - r.nextTick = function(e) { - var t = new Array(arguments.length - 1); - if (arguments.length > 1) - for (var i = 1; i < arguments.length; i++) - t[i - 1] = arguments[i]; - u.push(new p(e,t)), - 1 !== u.length || l || s(d) - } - , - p.prototype.run = function() { - this.fun.apply(null, this.array) - } - , - r.title = "browser", - r.browser = true, - r.env = {}, - r.argv = [], - r.version = "", - r.versions = {}, - r.on = m, - r.addListener = m, - r.once = m, - r.off = m, - r.removeListener = m, - r.removeAllListeners = m, - r.emit = m, - r.prependListener = m, - r.prependOnceListener = m, - r.listeners = function(e) { - return [] - } - , - r.binding = function(e) { - throw new Error("process.binding is not supported") - } - , - r.cwd = function() { - return "/" - } - , - r.chdir = function(e) { - throw new Error("process.chdir is not supported") - } - , - r.umask = function() { - return 0 - } -} -, function(e, t) { - var i = Math.ceil - , n = Math.floor; - e.exports = function(e) { - return isNaN(e = +e) ? 0 : (e > 0 ? n : i)(e) - } -} -, function(e, t, i) { - var n = i(65) - , r = i(45) - , o = i(24) - , a = i(39) - , s = i(22) - , c = i(138) - , u = Object.getOwnPropertyDescriptor; - t.f = i(13) ? u : function(e, t) { - if (e = o(e), - t = a(t, true), - c) + (r.nextTick = function (e) { + var t = new Array(arguments.length - 1); + if (arguments.length > 1) + for (var i = 1; i < arguments.length; i++) t[i - 1] = arguments[i]; + u.push(new p(e, t)), 1 !== u.length || l || s(d); + }), + (p.prototype.run = function () { + this.fun.apply(null, this.array); + }), + (r.title = "browser"), + (r.browser = true), + (r.env = {}), + (r.argv = []), + (r.version = ""), + (r.versions = {}), + (r.on = m), + (r.addListener = m), + (r.once = m), + (r.off = m), + (r.removeListener = m), + (r.removeAllListeners = m), + (r.emit = m), + (r.prependListener = m), + (r.prependOnceListener = m), + (r.listeners = function (e) { + return []; + }), + (r.binding = function (e) { + throw new Error("process.binding is not supported"); + }), + (r.cwd = function () { + return "/"; + }), + (r.chdir = function (e) { + throw new Error("process.chdir is not supported"); + }), + (r.umask = function () { + return 0; + }); + }, + function (e, t) { + var i = Math.ceil, + n = Math.floor; + e.exports = function (e) { + return isNaN((e = +e)) ? 0 : (e > 0 ? n : i)(e); + }; + }, + function (e, t, i) { + var n = i(65), + r = i(45), + o = i(24), + a = i(39), + s = i(22), + c = i(138), + u = Object.getOwnPropertyDescriptor; + t.f = i(13) + ? u + : function (e, t) { + if (((e = o(e)), (t = a(t, true)), c)) try { - return u(e, t) + return u(e, t); } catch (e) {} - if (s(e, t)) - return r(!n.f.call(e, t), e[t]) - } -} -, function(e, t, i) { - var n = i(0) - , r = i(14) - , o = i(3); - e.exports = function(e, t) { - var i = (r.Object || {})[e] || Object[e] - , a = {}; - a[e] = t(i), - n(n.S + n.F * o(function() { - i(1) - }), "Object", a) - } -} -, function(e, t, i) { - var n = i(34) - , r = i(64) - , o = i(20) - , a = i(10) - , s = i(321); - e.exports = function(e, t) { - var i = 1 == e - , c = 2 == e - , u = 3 == e - , l = 4 == e - , h = 6 == e - , f = 5 == e || h - , d = t || s; - return function(t, s, p) { - for (var m, g, _ = o(t), v = r(_), y = n(s, p, 3), b = a(v.length), E = 0, T = i ? d(t, b) : c ? d(t, 0) : void 0; b > E; E++) - if ((f || E in v) && (g = y(m = v[E], E, _), - e)) - if (i) - T[E] = g; - else if (g) - switch (e) { - case 3: - return true; - case 5: - return m; - case 6: - return E; - case 2: - T.push(m) - } - else if (l) - return false; - return h ? -1 : u || l ? l : T - } - } -} -, function(e, t, i) { + if (s(e, t)) return r(!n.f.call(e, t), e[t]); + }; + }, + function (e, t, i) { + var n = i(0), + r = i(14), + o = i(3); + e.exports = function (e, t) { + var i = (r.Object || {})[e] || Object[e], + a = {}; + (a[e] = t(i)), + n( + n.S + + n.F * + o(function () { + i(1); + }), + "Object", + a + ); + }; + }, + function (e, t, i) { + var n = i(34), + r = i(64), + o = i(20), + a = i(10), + s = i(321); + e.exports = function (e, t) { + var i = 1 == e, + c = 2 == e, + u = 3 == e, + l = 4 == e, + h = 6 == e, + f = 5 == e || h, + d = t || s; + return function (t, s, p) { + for ( + var m, + g, + _ = o(t), + v = r(_), + y = n(s, p, 3), + b = a(v.length), + E = 0, + T = i ? d(t, b) : c ? d(t, 0) : void 0; + b > E; + E++ + ) + if ((f || E in v) && ((g = y((m = v[E]), E, _)), e)) + if (i) T[E] = g; + else if (g) + switch (e) { + case 3: + return true; + case 5: + return m; + case 6: + return E; + case 2: + T.push(m); + } + else if (l) return false; + return h ? -1 : u || l ? l : T; + }; + }; + }, + function (e, t, i) { "use strict"; function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - var r = Object.prototype.hasOwnProperty - , o = Object.prototype.toString - , a = Object.defineProperty - , s = Object.getOwnPropertyDescriptor - , c = function(e) { - return "function" == typeof Array.isArray ? Array.isArray(e) : "[object Array]" === o.call(e) - } - , u = function(e) { - if (!e || "[object Object]" !== o.call(e)) - return false; - var t, i = r.call(e, "constructor"), n = e.constructor && e.constructor.prototype && r.call(e.constructor.prototype, "isPrototypeOf"); - if (e.constructor && !i && !n) - return false; - for (t in e) - ; - return void 0 === t || r.call(e, t) - } - , l = function(e, t) { - a && "__proto__" === t.name ? a(e, t.name, { - enumerable: true, - configurable: true, - value: t.newValue, - writable: true - }) : e[t.name] = t.newValue - } - , h = function(e, t) { + var r = Object.prototype.hasOwnProperty, + o = Object.prototype.toString, + a = Object.defineProperty, + s = Object.getOwnPropertyDescriptor, + c = function (e) { + return "function" == typeof Array.isArray + ? Array.isArray(e) + : "[object Array]" === o.call(e); + }, + u = function (e) { + if (!e || "[object Object]" !== o.call(e)) return false; + var t, + i = r.call(e, "constructor"), + n = + e.constructor && + e.constructor.prototype && + r.call(e.constructor.prototype, "isPrototypeOf"); + if (e.constructor && !i && !n) return false; + for (t in e); + return void 0 === t || r.call(e, t); + }, + l = function (e, t) { + a && "__proto__" === t.name + ? a(e, t.name, { + enumerable: true, + configurable: true, + value: t.newValue, + writable: true, + }) + : (e[t.name] = t.newValue); + }, + h = function (e, t) { if ("__proto__" === t) { - if (!r.call(e, t)) - return; - if (s) - return s(e, t).value + if (!r.call(e, t)) return; + if (s) return s(e, t).value; } - return e[t] - }; + return e[t]; + }; e.exports = function e() { - var t, i, r, o, a, s, f = arguments[0], d = 1, p = arguments.length, m = false; - for ("boolean" == typeof f && (m = f, - f = arguments[1] || {}, - d = 2), - (null == f || "object" !== n(f) && "function" != typeof f) && (f = {}); d < p; ++d) - if (null != (t = arguments[d])) - for (i in t) - r = h(f, i), - f !== (o = h(t, i)) && (m && o && (u(o) || (a = c(o))) ? (a ? (a = false, - s = r && c(r) ? r : []) : s = r && u(r) ? r : {}, + var t, + i, + r, + o, + a, + s, + f = arguments[0], + d = 1, + p = arguments.length, + m = false; + for ( + "boolean" == typeof f && ((m = f), (f = arguments[1] || {}), (d = 2)), + (null == f || ("object" !== n(f) && "function" != typeof f)) && + (f = {}); + d < p; + ++d + ) + if (null != (t = arguments[d])) + for (i in t) + (r = h(f, i)), + f !== (o = h(t, i)) && + (m && o && (u(o) || (a = c(o))) + ? (a + ? ((a = false), (s = r && c(r) ? r : [])) + : (s = r && u(r) ? r : {}), l(f, { - name: i, - newValue: e(m, s, o) - })) : void 0 !== o && l(f, { - name: i, - newValue: o + name: i, + newValue: e(m, s, o), + })) + : void 0 !== o && + l(f, { + name: i, + newValue: o, })); - return f - } -} -, function(e, t, i) { + return f; + }; + }, + function (e, t, i) { "use strict"; - var n = i(25) - , r = i(1); + var n = i(25), + r = i(1); function o(e, t) { - return 55296 == (64512 & e.charCodeAt(t)) && (!(t < 0 || t + 1 >= e.length) && 56320 == (64512 & e.charCodeAt(t + 1))) + return ( + 55296 == (64512 & e.charCodeAt(t)) && + !(t < 0 || t + 1 >= e.length) && + 56320 == (64512 & e.charCodeAt(t + 1)) + ); } function a(e) { - return (e >>> 24 | e >>> 8 & 65280 | e << 8 & 16711680 | (255 & e) << 24) >>> 0 + return ( + ((e >>> 24) | + ((e >>> 8) & 65280) | + ((e << 8) & 16711680) | + ((255 & e) << 24)) >>> + 0 + ); } function s(e) { - return 1 === e.length ? "0" + e : e + return 1 === e.length ? "0" + e : e; } function c(e) { - return 7 === e.length ? "0" + e : 6 === e.length ? "00" + e : 5 === e.length ? "000" + e : 4 === e.length ? "0000" + e : 3 === e.length ? "00000" + e : 2 === e.length ? "000000" + e : 1 === e.length ? "0000000" + e : e + return 7 === e.length + ? "0" + e + : 6 === e.length + ? "00" + e + : 5 === e.length + ? "000" + e + : 4 === e.length + ? "0000" + e + : 3 === e.length + ? "00000" + e + : 2 === e.length + ? "000000" + e + : 1 === e.length + ? "0000000" + e + : e; } - t.inherits = r, - t.toArray = function(e, t) { - if (Array.isArray(e)) - return e.slice(); - if (!e) - return []; + (t.inherits = r), + (t.toArray = function (e, t) { + if (Array.isArray(e)) return e.slice(); + if (!e) return []; var i = []; if ("string" == typeof e) - if (t) { - if ("hex" === t) - for ((e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (e = "0" + e), - r = 0; r < e.length; r += 2) - i.push(parseInt(e[r] + e[r + 1], 16)) - } else - for (var n = 0, r = 0; r < e.length; r++) { - var a = e.charCodeAt(r); - a < 128 ? i[n++] = a : a < 2048 ? (i[n++] = a >> 6 | 192, - i[n++] = 63 & a | 128) : o(e, r) ? (a = 65536 + ((1023 & a) << 10) + (1023 & e.charCodeAt(++r)), - i[n++] = a >> 18 | 240, - i[n++] = a >> 12 & 63 | 128, - i[n++] = a >> 6 & 63 | 128, - i[n++] = 63 & a | 128) : (i[n++] = a >> 12 | 224, - i[n++] = a >> 6 & 63 | 128, - i[n++] = 63 & a | 128) - } - else - for (r = 0; r < e.length; r++) - i[r] = 0 | e[r]; - return i - } - , - t.toHex = function(e) { - for (var t = "", i = 0; i < e.length; i++) - t += s(e[i].toString(16)); - return t - } - , - t.htonl = a, - t.toHex32 = function(e, t) { + if (t) { + if ("hex" === t) + for ( + (e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && + (e = "0" + e), + r = 0; + r < e.length; + r += 2 + ) + i.push(parseInt(e[r] + e[r + 1], 16)); + } else + for (var n = 0, r = 0; r < e.length; r++) { + var a = e.charCodeAt(r); + a < 128 + ? (i[n++] = a) + : a < 2048 + ? ((i[n++] = (a >> 6) | 192), (i[n++] = (63 & a) | 128)) + : o(e, r) + ? ((a = + 65536 + ((1023 & a) << 10) + (1023 & e.charCodeAt(++r))), + (i[n++] = (a >> 18) | 240), + (i[n++] = ((a >> 12) & 63) | 128), + (i[n++] = ((a >> 6) & 63) | 128), + (i[n++] = (63 & a) | 128)) + : ((i[n++] = (a >> 12) | 224), + (i[n++] = ((a >> 6) & 63) | 128), + (i[n++] = (63 & a) | 128)); + } + else for (r = 0; r < e.length; r++) i[r] = 0 | e[r]; + return i; + }), + (t.toHex = function (e) { + for (var t = "", i = 0; i < e.length; i++) t += s(e[i].toString(16)); + return t; + }), + (t.htonl = a), + (t.toHex32 = function (e, t) { for (var i = "", n = 0; n < e.length; n++) { - var r = e[n]; - "little" === t && (r = a(r)), - i += c(r.toString(16)) + var r = e[n]; + "little" === t && (r = a(r)), (i += c(r.toString(16))); } - return i - } - , - t.zero2 = s, - t.zero8 = c, - t.join32 = function(e, t, i, r) { + return i; + }), + (t.zero2 = s), + (t.zero8 = c), + (t.join32 = function (e, t, i, r) { var o = i - t; n(o % 4 == 0); - for (var a = new Array(o / 4), s = 0, c = t; s < a.length; s++, - c += 4) { - var u; - u = "big" === r ? e[c] << 24 | e[c + 1] << 16 | e[c + 2] << 8 | e[c + 3] : e[c + 3] << 24 | e[c + 2] << 16 | e[c + 1] << 8 | e[c], - a[s] = u >>> 0 + for ( + var a = new Array(o / 4), s = 0, c = t; + s < a.length; + s++, c += 4 + ) { + var u; + (u = + "big" === r + ? (e[c] << 24) | (e[c + 1] << 16) | (e[c + 2] << 8) | e[c + 3] + : (e[c + 3] << 24) | (e[c + 2] << 16) | (e[c + 1] << 8) | e[c]), + (a[s] = u >>> 0); } - return a - } - , - t.split32 = function(e, t) { - for (var i = new Array(4 * e.length), n = 0, r = 0; n < e.length; n++, - r += 4) { - var o = e[n]; - "big" === t ? (i[r] = o >>> 24, - i[r + 1] = o >>> 16 & 255, - i[r + 2] = o >>> 8 & 255, - i[r + 3] = 255 & o) : (i[r + 3] = o >>> 24, - i[r + 2] = o >>> 16 & 255, - i[r + 1] = o >>> 8 & 255, - i[r] = 255 & o) + return a; + }), + (t.split32 = function (e, t) { + for ( + var i = new Array(4 * e.length), n = 0, r = 0; + n < e.length; + n++, r += 4 + ) { + var o = e[n]; + "big" === t + ? ((i[r] = o >>> 24), + (i[r + 1] = (o >>> 16) & 255), + (i[r + 2] = (o >>> 8) & 255), + (i[r + 3] = 255 & o)) + : ((i[r + 3] = o >>> 24), + (i[r + 2] = (o >>> 16) & 255), + (i[r + 1] = (o >>> 8) & 255), + (i[r] = 255 & o)); } - return i - } - , - t.rotr32 = function(e, t) { - return e >>> t | e << 32 - t - } - , - t.rotl32 = function(e, t) { - return e << t | e >>> 32 - t - } - , - t.sum32 = function(e, t) { - return e + t >>> 0 - } - , - t.sum32_3 = function(e, t, i) { - return e + t + i >>> 0 - } - , - t.sum32_4 = function(e, t, i, n) { - return e + t + i + n >>> 0 - } - , - t.sum32_5 = function(e, t, i, n, r) { - return e + t + i + n + r >>> 0 - } - , - t.sum64 = function(e, t, i, n) { - var r = e[t] - , o = n + e[t + 1] >>> 0 - , a = (o < n ? 1 : 0) + i + r; - e[t] = a >>> 0, - e[t + 1] = o - } - , - t.sum64_hi = function(e, t, i, n) { - return (t + n >>> 0 < t ? 1 : 0) + e + i >>> 0 - } - , - t.sum64_lo = function(e, t, i, n) { - return t + n >>> 0 - } - , - t.sum64_4_hi = function(e, t, i, n, r, o, a, s) { - var c = 0 - , u = t; - return c += (u = u + n >>> 0) < t ? 1 : 0, - c += (u = u + o >>> 0) < o ? 1 : 0, - e + i + r + a + (c += (u = u + s >>> 0) < s ? 1 : 0) >>> 0 - } - , - t.sum64_4_lo = function(e, t, i, n, r, o, a, s) { - return t + n + o + s >>> 0 - } - , - t.sum64_5_hi = function(e, t, i, n, r, o, a, s, c, u) { - var l = 0 - , h = t; - return l += (h = h + n >>> 0) < t ? 1 : 0, - l += (h = h + o >>> 0) < o ? 1 : 0, - l += (h = h + s >>> 0) < s ? 1 : 0, - e + i + r + a + c + (l += (h = h + u >>> 0) < u ? 1 : 0) >>> 0 - } - , - t.sum64_5_lo = function(e, t, i, n, r, o, a, s, c, u) { - return t + n + o + s + u >>> 0 - } - , - t.rotr64_hi = function(e, t, i) { - return (t << 32 - i | e >>> i) >>> 0 - } - , - t.rotr64_lo = function(e, t, i) { - return (e << 32 - i | t >>> i) >>> 0 - } - , - t.shr64_hi = function(e, t, i) { - return e >>> i - } - , - t.shr64_lo = function(e, t, i) { - return (e << 32 - i | t >>> i) >>> 0 - } -} -, function(e, t, i) { + return i; + }), + (t.rotr32 = function (e, t) { + return (e >>> t) | (e << (32 - t)); + }), + (t.rotl32 = function (e, t) { + return (e << t) | (e >>> (32 - t)); + }), + (t.sum32 = function (e, t) { + return (e + t) >>> 0; + }), + (t.sum32_3 = function (e, t, i) { + return (e + t + i) >>> 0; + }), + (t.sum32_4 = function (e, t, i, n) { + return (e + t + i + n) >>> 0; + }), + (t.sum32_5 = function (e, t, i, n, r) { + return (e + t + i + n + r) >>> 0; + }), + (t.sum64 = function (e, t, i, n) { + var r = e[t], + o = (n + e[t + 1]) >>> 0, + a = (o < n ? 1 : 0) + i + r; + (e[t] = a >>> 0), (e[t + 1] = o); + }), + (t.sum64_hi = function (e, t, i, n) { + return (((t + n) >>> 0 < t ? 1 : 0) + e + i) >>> 0; + }), + (t.sum64_lo = function (e, t, i, n) { + return (t + n) >>> 0; + }), + (t.sum64_4_hi = function (e, t, i, n, r, o, a, s) { + var c = 0, + u = t; + return ( + (c += (u = (u + n) >>> 0) < t ? 1 : 0), + (c += (u = (u + o) >>> 0) < o ? 1 : 0), + (e + i + r + a + (c += (u = (u + s) >>> 0) < s ? 1 : 0)) >>> 0 + ); + }), + (t.sum64_4_lo = function (e, t, i, n, r, o, a, s) { + return (t + n + o + s) >>> 0; + }), + (t.sum64_5_hi = function (e, t, i, n, r, o, a, s, c, u) { + var l = 0, + h = t; + return ( + (l += (h = (h + n) >>> 0) < t ? 1 : 0), + (l += (h = (h + o) >>> 0) < o ? 1 : 0), + (l += (h = (h + s) >>> 0) < s ? 1 : 0), + (e + i + r + a + c + (l += (h = (h + u) >>> 0) < u ? 1 : 0)) >>> 0 + ); + }), + (t.sum64_5_lo = function (e, t, i, n, r, o, a, s, c, u) { + return (t + n + o + s + u) >>> 0; + }), + (t.rotr64_hi = function (e, t, i) { + return ((t << (32 - i)) | (e >>> i)) >>> 0; + }), + (t.rotr64_lo = function (e, t, i) { + return ((e << (32 - i)) | (t >>> i)) >>> 0; + }), + (t.shr64_hi = function (e, t, i) { + return e >>> i; + }), + (t.shr64_lo = function (e, t, i) { + return ((e << (32 - i)) | (t >>> i)) >>> 0; + }); + }, + function (e, t, i) { var n = i(35); - e.exports = function(e, t, i) { - if (n(e), - void 0 === t) - return e; - switch (i) { + e.exports = function (e, t, i) { + if ((n(e), void 0 === t)) return e; + switch (i) { case 1: - return function(i) { - return e.call(t, i) - } - ; + return function (i) { + return e.call(t, i); + }; case 2: - return function(i, n) { - return e.call(t, i, n) - } - ; + return function (i, n) { + return e.call(t, i, n); + }; case 3: - return function(i, n, r) { - return e.call(t, i, n, r) - } - } - return function() { - return e.apply(t, arguments) - } - } -} -, function(e, t) { - e.exports = function(e) { - if ("function" != typeof e) - throw TypeError(e + " is not a function!"); - return e - } -} -, function(e, t) { + return function (i, n, r) { + return e.call(t, i, n, r); + }; + } + return function () { + return e.apply(t, arguments); + }; + }; + }, + function (e, t) { + e.exports = function (e) { + if ("function" != typeof e) throw TypeError(e + " is not a function!"); + return e; + }; + }, + function (e, t) { var i = {}.toString; - e.exports = function(e) { - return i.call(e).slice(8, -1) - } -} -, function(e, t) { - e.exports = function(e) { - if (null == e) - throw TypeError("Can't call method on " + e); - return e - } -} -, function(e, t, i) { + e.exports = function (e) { + return i.call(e).slice(8, -1); + }; + }, + function (e, t) { + e.exports = function (e) { + if (null == e) throw TypeError("Can't call method on " + e); + return e; + }; + }, + function (e, t, i) { "use strict"; function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } if (i(13)) { - var r = i(47) - , o = i(5) - , a = i(3) - , s = i(0) - , c = i(84) - , u = i(121) - , l = i(34) - , h = i(60) - , f = i(45) - , d = i(23) - , p = i(61) - , m = i(28) - , g = i(10) - , _ = i(164) - , v = i(49) - , y = i(39) - , b = i(22) - , E = i(66) - , T = i(6) - , A = i(20) - , x = i(113) - , S = i(50) - , C = i(52) - , P = i(51).f - , R = i(115) - , M = i(46) - , O = i(8) - , w = i(31) - , I = i(74) - , D = i(67) - , L = i(117) - , F = i(57) - , B = i(77) - , N = i(59) - , k = i(116) - , U = i(155) - , V = i(12) - , G = i(29) - , z = V.f - , j = G.f - , H = o.RangeError - , W = o.TypeError - , X = o.Uint8Array - , Y = Array.prototype - , K = u.ArrayBuffer - , Q = u.DataView - , q = w(0) - , Z = w(2) - , J = w(3) - , $ = w(4) - , ee = w(5) - , te = w(6) - , ie = I(true) - , ne = I(false) - , re = L.values - , oe = L.keys - , ae = L.entries - , se = Y.lastIndexOf - , ce = Y.reduce - , ue = Y.reduceRight - , le = Y.join - , he = Y.sort - , fe = Y.slice - , de = Y.toString - , pe = Y.toLocaleString - , me = O("iterator") - , ge = O("toStringTag") - , _e = M("typed_constructor") - , ve = M("def_constructor") - , ye = c.CONSTR - , be = c.TYPED - , Ee = c.VIEW - , Te = w(1, function(e, t) { - return Pe(D(e, e[ve]), t) - }) - , Ae = a(function() { - return 1 === new X(new Uint16Array([1]).buffer)[0] - }) - , xe = !!X && !!X.prototype.set && a(function() { - new X(1).set({}) - }) - , Se = function(e, t) { - var i = m(e); - if (i < 0 || i % t) - throw H("Wrong offset!"); - return i - } - , Ce = function(e) { - if (T(e) && be in e) - return e; - throw W(e + " is not a typed array!") - } - , Pe = function(e, t) { - if (!(T(e) && _e in e)) - throw W("It is not a typed array constructor!"); - return new e(t) - } - , Re = function(e, t) { - return Me(D(e, e[ve]), t) - } - , Me = function(e, t) { - for (var i = 0, n = t.length, r = Pe(e, n); n > i; ) - r[i] = t[i++]; - return r - } - , Oe = function(e, t, i) { - z(e, t, { - get: function() { - return this._d[i] - } - }) - } - , we = function(e) { - var t, i, n, r, o, a, s = A(e), c = arguments.length, u = c > 1 ? arguments[1] : void 0, h = void 0 !== u, f = R(s); - if (null != f && !x(f)) { - for (a = f.call(s), - n = [], - t = 0; !(o = a.next()).done; t++) - n.push(o.value); - s = n - } - for (h && c > 2 && (u = l(u, arguments[2], 2)), - t = 0, - i = g(s.length), - r = Pe(this, i); i > t; t++) - r[t] = h ? u(s[t], t) : s[t]; - return r - } - , Ie = function() { - for (var e = 0, t = arguments.length, i = Pe(this, t); t > e; ) - i[e] = arguments[e++]; - return i - } - , De = !!X && a(function() { - pe.call(new X(1)) - }) - , Le = function() { - return pe.apply(De ? fe.call(Ce(this)) : Ce(this), arguments) - } - , Fe = { - copyWithin: function(e, t) { - return U.call(Ce(this), e, t, arguments.length > 2 ? arguments[2] : void 0) - }, - every: function(e) { - return $(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) - }, - fill: function(e) { - return k.apply(Ce(this), arguments) - }, - filter: function(e) { - return Re(this, Z(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0)) - }, - find: function(e) { - return ee(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) - }, - findIndex: function(e) { - return te(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) - }, - forEach: function(e) { - q(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) - }, - indexOf: function(e) { - return ne(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) - }, - includes: function(e) { - return ie(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) - }, - join: function(e) { - return le.apply(Ce(this), arguments) - }, - lastIndexOf: function(e) { - return se.apply(Ce(this), arguments) - }, - map: function(e) { - return Te(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) - }, - reduce: function(e) { - return ce.apply(Ce(this), arguments) - }, - reduceRight: function(e) { - return ue.apply(Ce(this), arguments) - }, - reverse: function() { - for (var e, t = Ce(this).length, i = Math.floor(t / 2), n = 0; n < i; ) - e = this[n], - this[n++] = this[--t], - this[t] = e; - return this - }, - some: function(e) { - return J(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) - }, - sort: function(e) { - return he.call(Ce(this), e) - }, - subarray: function(e, t) { - var i = Ce(this) - , n = i.length - , r = v(e, n); - return new (D(i, i[ve]))(i.buffer,i.byteOffset + r * i.BYTES_PER_ELEMENT,g((void 0 === t ? n : v(t, n)) - r)) - } - } - , Be = function(e, t) { - return Re(this, fe.call(Ce(this), e, t)) - } - , Ne = function(e) { - Ce(this); - var t = Se(arguments[1], 1) - , i = this.length - , n = A(e) - , r = g(n.length) - , o = 0; - if (r + t > i) - throw H("Wrong length!"); - for (; o < r; ) - this[t + o] = n[o++] - } - , ke = { - entries: function() { - return ae.call(Ce(this)) - }, - keys: function() { - return oe.call(Ce(this)) - }, - values: function() { - return re.call(Ce(this)) - } - } - , Ue = function(e, t) { - return T(e) && e[be] && "symbol" != n(t) && t in e && String(+t) == String(t) - } - , Ve = function(e, t) { - return Ue(e, t = y(t, true)) ? f(2, e[t]) : j(e, t) - } - , Ge = function(e, t, i) { - return !(Ue(e, t = y(t, true)) && T(i) && b(i, "value")) || b(i, "get") || b(i, "set") || i.configurable || b(i, "writable") && !i.writable || b(i, "enumerable") && !i.enumerable ? z(e, t, i) : (e[t] = i.value, - e) - }; - ye || (G.f = Ve, - V.f = Ge), - s(s.S + s.F * !ye, "Object", { - getOwnPropertyDescriptor: Ve, - defineProperty: Ge + var r = i(47), + o = i(5), + a = i(3), + s = i(0), + c = i(84), + u = i(121), + l = i(34), + h = i(60), + f = i(45), + d = i(23), + p = i(61), + m = i(28), + g = i(10), + _ = i(164), + v = i(49), + y = i(39), + b = i(22), + E = i(66), + T = i(6), + A = i(20), + x = i(113), + S = i(50), + C = i(52), + P = i(51).f, + R = i(115), + M = i(46), + O = i(8), + w = i(31), + I = i(74), + D = i(67), + L = i(117), + F = i(57), + B = i(77), + N = i(59), + k = i(116), + U = i(155), + V = i(12), + G = i(29), + z = V.f, + j = G.f, + H = o.RangeError, + W = o.TypeError, + X = o.Uint8Array, + Y = Array.prototype, + K = u.ArrayBuffer, + Q = u.DataView, + q = w(0), + Z = w(2), + J = w(3), + $ = w(4), + ee = w(5), + te = w(6), + ie = I(true), + ne = I(false), + re = L.values, + oe = L.keys, + ae = L.entries, + se = Y.lastIndexOf, + ce = Y.reduce, + ue = Y.reduceRight, + le = Y.join, + he = Y.sort, + fe = Y.slice, + de = Y.toString, + pe = Y.toLocaleString, + me = O("iterator"), + ge = O("toStringTag"), + _e = M("typed_constructor"), + ve = M("def_constructor"), + ye = c.CONSTR, + be = c.TYPED, + Ee = c.VIEW, + Te = w(1, function (e, t) { + return Pe(D(e, e[ve]), t); }), - a(function() { - de.call({}) - }) && (de = pe = function() { - return le.call(this) - } - ); - var ze = p({}, Fe); - p(ze, ke), + Ae = a(function () { + return 1 === new X(new Uint16Array([1]).buffer)[0]; + }), + xe = + !!X && + !!X.prototype.set && + a(function () { + new X(1).set({}); + }), + Se = function (e, t) { + var i = m(e); + if (i < 0 || i % t) throw H("Wrong offset!"); + return i; + }, + Ce = function (e) { + if (T(e) && be in e) return e; + throw W(e + " is not a typed array!"); + }, + Pe = function (e, t) { + if (!(T(e) && _e in e)) + throw W("It is not a typed array constructor!"); + return new e(t); + }, + Re = function (e, t) { + return Me(D(e, e[ve]), t); + }, + Me = function (e, t) { + for (var i = 0, n = t.length, r = Pe(e, n); n > i; ) r[i] = t[i++]; + return r; + }, + Oe = function (e, t, i) { + z(e, t, { + get: function () { + return this._d[i]; + }, + }); + }, + we = function (e) { + var t, + i, + n, + r, + o, + a, + s = A(e), + c = arguments.length, + u = c > 1 ? arguments[1] : void 0, + h = void 0 !== u, + f = R(s); + if (null != f && !x(f)) { + for (a = f.call(s), n = [], t = 0; !(o = a.next()).done; t++) + n.push(o.value); + s = n; + } + for ( + h && c > 2 && (u = l(u, arguments[2], 2)), + t = 0, + i = g(s.length), + r = Pe(this, i); + i > t; + t++ + ) + r[t] = h ? u(s[t], t) : s[t]; + return r; + }, + Ie = function () { + for (var e = 0, t = arguments.length, i = Pe(this, t); t > e; ) + i[e] = arguments[e++]; + return i; + }, + De = + !!X && + a(function () { + pe.call(new X(1)); + }), + Le = function () { + return pe.apply(De ? fe.call(Ce(this)) : Ce(this), arguments); + }, + Fe = { + copyWithin: function (e, t) { + return U.call( + Ce(this), + e, + t, + arguments.length > 2 ? arguments[2] : void 0 + ); + }, + every: function (e) { + return $(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0); + }, + fill: function (e) { + return k.apply(Ce(this), arguments); + }, + filter: function (e) { + return Re( + this, + Z(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) + ); + }, + find: function (e) { + return ee( + Ce(this), + e, + arguments.length > 1 ? arguments[1] : void 0 + ); + }, + findIndex: function (e) { + return te( + Ce(this), + e, + arguments.length > 1 ? arguments[1] : void 0 + ); + }, + forEach: function (e) { + q(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0); + }, + indexOf: function (e) { + return ne( + Ce(this), + e, + arguments.length > 1 ? arguments[1] : void 0 + ); + }, + includes: function (e) { + return ie( + Ce(this), + e, + arguments.length > 1 ? arguments[1] : void 0 + ); + }, + join: function (e) { + return le.apply(Ce(this), arguments); + }, + lastIndexOf: function (e) { + return se.apply(Ce(this), arguments); + }, + map: function (e) { + return Te( + Ce(this), + e, + arguments.length > 1 ? arguments[1] : void 0 + ); + }, + reduce: function (e) { + return ce.apply(Ce(this), arguments); + }, + reduceRight: function (e) { + return ue.apply(Ce(this), arguments); + }, + reverse: function () { + for ( + var e, t = Ce(this).length, i = Math.floor(t / 2), n = 0; + n < i; + + ) + (e = this[n]), (this[n++] = this[--t]), (this[t] = e); + return this; + }, + some: function (e) { + return J(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0); + }, + sort: function (e) { + return he.call(Ce(this), e); + }, + subarray: function (e, t) { + var i = Ce(this), + n = i.length, + r = v(e, n); + return new (D(i, i[ve]))( + i.buffer, + i.byteOffset + r * i.BYTES_PER_ELEMENT, + g((void 0 === t ? n : v(t, n)) - r) + ); + }, + }, + Be = function (e, t) { + return Re(this, fe.call(Ce(this), e, t)); + }, + Ne = function (e) { + Ce(this); + var t = Se(arguments[1], 1), + i = this.length, + n = A(e), + r = g(n.length), + o = 0; + if (r + t > i) throw H("Wrong length!"); + for (; o < r; ) this[t + o] = n[o++]; + }, + ke = { + entries: function () { + return ae.call(Ce(this)); + }, + keys: function () { + return oe.call(Ce(this)); + }, + values: function () { + return re.call(Ce(this)); + }, + }, + Ue = function (e, t) { + return ( + T(e) && + e[be] && + "symbol" != n(t) && + t in e && + String(+t) == String(t) + ); + }, + Ve = function (e, t) { + return Ue(e, (t = y(t, true))) ? f(2, e[t]) : j(e, t); + }, + Ge = function (e, t, i) { + return !(Ue(e, (t = y(t, true))) && T(i) && b(i, "value")) || + b(i, "get") || + b(i, "set") || + i.configurable || + (b(i, "writable") && !i.writable) || + (b(i, "enumerable") && !i.enumerable) + ? z(e, t, i) + : ((e[t] = i.value), e); + }; + ye || ((G.f = Ve), (V.f = Ge)), + s(s.S + s.F * !ye, "Object", { + getOwnPropertyDescriptor: Ve, + defineProperty: Ge, + }), + a(function () { + de.call({}); + }) && + (de = pe = + function () { + return le.call(this); + }); + var ze = p({}, Fe); + p(ze, ke), d(ze, me, ke.values), p(ze, { - slice: Be, - set: Ne, - constructor: function() {}, - toString: de, - toLocaleString: Le + slice: Be, + set: Ne, + constructor: function () {}, + toString: de, + toLocaleString: Le, }), Oe(ze, "buffer", "b"), Oe(ze, "byteOffset", "o"), Oe(ze, "byteLength", "l"), Oe(ze, "length", "e"), z(ze, ge, { - get: function() { - return this[be] - } + get: function () { + return this[be]; + }, }), - e.exports = function(e, t, i, n) { - var u = e + ((n = !!n) ? "Clamped" : "") + "Array" - , l = "get" + e - , f = "set" + e - , p = o[u] - , m = p || {} - , v = p && C(p) - , y = !p || !c.ABV - , b = {} - , A = p && p.prototype - , x = function(e, i) { - z(e, i, { - get: function() { - return function(e, i) { - var n = e._d; - return n.v[l](i * t + n.o, Ae) - }(this, i) - }, - set: function(e) { - return function(e, i, r) { - var o = e._d; - n && (r = (r = Math.round(r)) < 0 ? 0 : r > 255 ? 255 : 255 & r), - o.v[f](i * t + o.o, r, Ae) - }(this, i, e) - }, - enumerable: true - }) + (e.exports = function (e, t, i, n) { + var u = e + ((n = !!n) ? "Clamped" : "") + "Array", + l = "get" + e, + f = "set" + e, + p = o[u], + m = p || {}, + v = p && C(p), + y = !p || !c.ABV, + b = {}, + A = p && p.prototype, + x = function (e, i) { + z(e, i, { + get: function () { + return (function (e, i) { + var n = e._d; + return n.v[l](i * t + n.o, Ae); + })(this, i); + }, + set: function (e) { + return (function (e, i, r) { + var o = e._d; + n && + (r = + (r = Math.round(r)) < 0 ? 0 : r > 255 ? 255 : 255 & r), + o.v[f](i * t + o.o, r, Ae); + })(this, i, e); + }, + enumerable: true, + }); }; - y ? (p = i(function(e, i, n, r) { + y + ? ((p = i(function (e, i, n, r) { h(e, p, u, "_d"); - var o, a, s, c, l = 0, f = 0; + var o, + a, + s, + c, + l = 0, + f = 0; if (T(i)) { - if (!(i instanceof K || "ArrayBuffer" == (c = E(i)) || "SharedArrayBuffer" == c)) - return be in i ? Me(p, i) : we.call(p, i); - o = i, - f = Se(n, t); - var m = i.byteLength; - if (void 0 === r) { - if (m % t) - throw H("Wrong length!"); - if ((a = m - f) < 0) - throw H("Wrong length!") - } else if ((a = g(r) * t) + f > m) - throw H("Wrong length!"); - s = a / t - } else - s = _(i), - o = new K(a = s * t); - for (d(e, "_d", { + if ( + !( + i instanceof K || + "ArrayBuffer" == (c = E(i)) || + "SharedArrayBuffer" == c + ) + ) + return be in i ? Me(p, i) : we.call(p, i); + (o = i), (f = Se(n, t)); + var m = i.byteLength; + if (void 0 === r) { + if (m % t) throw H("Wrong length!"); + if ((a = m - f) < 0) throw H("Wrong length!"); + } else if ((a = g(r) * t) + f > m) throw H("Wrong length!"); + s = a / t; + } else (s = _(i)), (o = new K((a = s * t))); + for ( + d(e, "_d", { b: o, o: f, l: a, e: s, - v: new Q(o) - }); l < s; ) - x(e, l++) - }), - A = p.prototype = S(ze), - d(A, "constructor", p)) : a(function() { - p(1) - }) && a(function() { - new p(-1) - }) && B(function(e) { - new p, - new p(null), - new p(1.5), - new p(e) - }, true) || (p = i(function(e, i, n, r) { + v: new Q(o), + }); + l < s; + + ) + x(e, l++); + })), + (A = p.prototype = S(ze)), + d(A, "constructor", p)) + : (a(function () { + p(1); + }) && + a(function () { + new p(-1); + }) && + B(function (e) { + new p(), new p(null), new p(1.5), new p(e); + }, true)) || + ((p = i(function (e, i, n, r) { var o; - return h(e, p, u), - T(i) ? i instanceof K || "ArrayBuffer" == (o = E(i)) || "SharedArrayBuffer" == o ? void 0 !== r ? new m(i,Se(n, t),r) : void 0 !== n ? new m(i,Se(n, t)) : new m(i) : be in i ? Me(p, i) : we.call(p, i) : new m(_(i)) - }), - q(v !== Function.prototype ? P(m).concat(P(v)) : P(m), function(e) { - e in p || d(p, e, m[e]) - }), - p.prototype = A, - r || (A.constructor = p)); - var R = A[me] - , M = !!R && ("values" == R.name || null == R.name) - , O = ke.values; - d(p, _e, true), + return ( + h(e, p, u), + T(i) + ? i instanceof K || + "ArrayBuffer" == (o = E(i)) || + "SharedArrayBuffer" == o + ? void 0 !== r + ? new m(i, Se(n, t), r) + : void 0 !== n + ? new m(i, Se(n, t)) + : new m(i) + : be in i + ? Me(p, i) + : we.call(p, i) + : new m(_(i)) + ); + })), + q( + v !== Function.prototype ? P(m).concat(P(v)) : P(m), + function (e) { + e in p || d(p, e, m[e]); + } + ), + (p.prototype = A), + r || (A.constructor = p)); + var R = A[me], + M = !!R && ("values" == R.name || null == R.name), + O = ke.values; + d(p, _e, true), d(A, be, u), d(A, Ee, true), d(A, ve, p), - (n ? new p(1)[ge] == u : ge in A) || z(A, ge, { - get: function() { - return u - } - }), - b[u] = p, + (n ? new p(1)[ge] == u : ge in A) || + z(A, ge, { + get: function () { + return u; + }, + }), + (b[u] = p), s(s.G + s.W + s.F * (p != m), b), s(s.S, u, { - BYTES_PER_ELEMENT: t + BYTES_PER_ELEMENT: t, }), - s(s.S + s.F * a(function() { - m.of.call(p, 1) - }), u, { + s( + s.S + + s.F * + a(function () { + m.of.call(p, 1); + }), + u, + { from: we, - of: Ie - }), - "BYTES_PER_ELEMENT"in A || d(A, "BYTES_PER_ELEMENT", t), + of: Ie, + } + ), + "BYTES_PER_ELEMENT" in A || d(A, "BYTES_PER_ELEMENT", t), s(s.P, u, Fe), N(u), s(s.P + s.F * xe, u, { - set: Ne + set: Ne, }), s(s.P + s.F * !M, u, ke), r || A.toString == de || (A.toString = de), - s(s.P + s.F * a(function() { - new p(1).slice() - }), u, { - slice: Be - }), - s(s.P + s.F * (a(function() { - return [1, 2].toLocaleString() != new p([1, 2]).toLocaleString() - }) || !a(function() { - A.toLocaleString.call([1, 2]) - })), u, { - toLocaleString: Le - }), - F[u] = M ? R : O, - r || M || d(A, me, O) - } - } else - e.exports = function() {} -} -, function(e, t, i) { + s( + s.P + + s.F * + a(function () { + new p(1).slice(); + }), + u, + { + slice: Be, + } + ), + s( + s.P + + s.F * + (a(function () { + return ( + [1, 2].toLocaleString() != new p([1, 2]).toLocaleString() + ); + }) || + !a(function () { + A.toLocaleString.call([1, 2]); + })), + u, + { + toLocaleString: Le, + } + ), + (F[u] = M ? R : O), + r || M || d(A, me, O); + }); + } else e.exports = function () {}; + }, + function (e, t, i) { var n = i(6); - e.exports = function(e, t) { - if (!n(e)) - return e; - var i, r; - if (t && "function" == typeof (i = e.toString) && !n(r = i.call(e))) - return r; - if ("function" == typeof (i = e.valueOf) && !n(r = i.call(e))) - return r; - if (!t && "function" == typeof (i = e.toString) && !n(r = i.call(e))) - return r; - throw TypeError("Can't convert object to primitive value") - } -} -, function(e, t, i) { + e.exports = function (e, t) { + if (!n(e)) return e; + var i, r; + if (t && "function" == typeof (i = e.toString) && !n((r = i.call(e)))) + return r; + if ("function" == typeof (i = e.valueOf) && !n((r = i.call(e)))) return r; + if (!t && "function" == typeof (i = e.toString) && !n((r = i.call(e)))) + return r; + throw TypeError("Can't convert object to primitive value"); + }; + }, + function (e, t, i) { function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - var r = i(46)("meta") - , o = i(6) - , a = i(22) - , s = i(12).f - , c = 0 - , u = Object.isExtensible || function() { - return true - } - , l = !i(3)(function() { - return u(Object.preventExtensions({})) - }) - , h = function(e) { - s(e, r, { - value: { - i: "O" + ++c, - w: {} + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; } - }) + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - , f = e.exports = { + var r = i(46)("meta"), + o = i(6), + a = i(22), + s = i(12).f, + c = 0, + u = + Object.isExtensible || + function () { + return true; + }, + l = !i(3)(function () { + return u(Object.preventExtensions({})); + }), + h = function (e) { + s(e, r, { + value: { + i: "O" + ++c, + w: {}, + }, + }); + }, + f = (e.exports = { KEY: r, NEED: false, - fastKey: function(e, t) { - if (!o(e)) - return "symbol" == n(e) ? e : ("string" == typeof e ? "S" : "P") + e; - if (!a(e, r)) { - if (!u(e)) - return "F"; - if (!t) - return "E"; - h(e) - } - return e[r].i + fastKey: function (e, t) { + if (!o(e)) + return "symbol" == n(e) + ? e + : ("string" == typeof e ? "S" : "P") + e; + if (!a(e, r)) { + if (!u(e)) return "F"; + if (!t) return "E"; + h(e); + } + return e[r].i; }, - getWeak: function(e, t) { - if (!a(e, r)) { - if (!u(e)) - return true; - if (!t) - return false; - h(e) - } - return e[r].w + getWeak: function (e, t) { + if (!a(e, r)) { + if (!u(e)) return true; + if (!t) return false; + h(e); + } + return e[r].w; }, - onFreeze: function(e) { - return l && f.NEED && u(e) && !a(e, r) && h(e), - e - } - } -} -, function(e, t, i) { - e.exports = i(394).Promise -} -, function(e, t) { + onFreeze: function (e) { + return l && f.NEED && u(e) && !a(e, r) && h(e), e; + }, + }); + }, + function (e, t, i) { + e.exports = i(394).Promise; + }, + function (e, t) { function i(e) { - return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (i = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } function n() { - this._events = this._events || {}, - this._maxListeners = this._maxListeners || void 0 + (this._events = this._events || {}), + (this._maxListeners = this._maxListeners || void 0); } function r(e) { - return "function" == typeof e + return "function" == typeof e; } function o(e) { - return "object" === i(e) && null !== e + return "object" === i(e) && null !== e; } function a(e) { - return void 0 === e + return void 0 === e; } - e.exports = n, - n.EventEmitter = n, - n.prototype._events = void 0, - n.prototype._maxListeners = void 0, - n.defaultMaxListeners = 10, - n.prototype.setMaxListeners = function(e) { + (e.exports = n), + (n.EventEmitter = n), + (n.prototype._events = void 0), + (n.prototype._maxListeners = void 0), + (n.defaultMaxListeners = 10), + (n.prototype.setMaxListeners = function (e) { if ("number" != typeof e || e < 0 || isNaN(e)) - throw TypeError("n must be a positive number"); - return this._maxListeners = e, - this - } - , - n.prototype.emit = function(e) { + throw TypeError("n must be a positive number"); + return (this._maxListeners = e), this; + }), + (n.prototype.emit = function (e) { var t, i, n, s, c, u; - if (this._events || (this._events = {}), - "error" === e && (!this._events.error || o(this._events.error) && !this._events.error.length)) { - if ((t = arguments[1])instanceof Error) - throw t; - var l = new Error('Uncaught, unspecified "error" event. (' + t + ")"); - throw l.context = t, - l + if ( + (this._events || (this._events = {}), + "error" === e && + (!this._events.error || + (o(this._events.error) && !this._events.error.length))) + ) { + if ((t = arguments[1]) instanceof Error) throw t; + var l = new Error('Uncaught, unspecified "error" event. (' + t + ")"); + throw ((l.context = t), l); } - if (a(i = this._events[e])) - return false; + if (a((i = this._events[e]))) return false; if (r(i)) - switch (arguments.length) { + switch (arguments.length) { case 1: - i.call(this); - break; + i.call(this); + break; case 2: - i.call(this, arguments[1]); - break; + i.call(this, arguments[1]); + break; case 3: - i.call(this, arguments[1], arguments[2]); - break; + i.call(this, arguments[1], arguments[2]); + break; default: - s = Array.prototype.slice.call(arguments, 1), - i.apply(this, s) - } + (s = Array.prototype.slice.call(arguments, 1)), i.apply(this, s); + } else if (o(i)) - for (s = Array.prototype.slice.call(arguments, 1), - n = (u = i.slice()).length, - c = 0; c < n; c++) - u[c].apply(this, s); - return true - } - , - n.prototype.addListener = function(e, t) { + for ( + s = Array.prototype.slice.call(arguments, 1), + n = (u = i.slice()).length, + c = 0; + c < n; + c++ + ) + u[c].apply(this, s); + return true; + }), + (n.prototype.addListener = function (e, t) { var i; - if (!r(t)) - throw TypeError("listener must be a function"); - return this._events || (this._events = {}), - this._events.newListener && this.emit("newListener", e, r(t.listener) ? t.listener : t), - this._events[e] ? o(this._events[e]) ? this._events[e].push(t) : this._events[e] = [this._events[e], t] : this._events[e] = t, - o(this._events[e]) && !this._events[e].warned && (i = a(this._maxListeners) ? n.defaultMaxListeners : this._maxListeners) && i > 0 && this._events[e].length > i && (this._events[e].warned = true, - console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[e].length), - "function" == typeof console.trace && console.trace()), - this - } - , - n.prototype.on = n.prototype.addListener, - n.prototype.once = function(e, t) { - if (!r(t)) - throw TypeError("listener must be a function"); + if (!r(t)) throw TypeError("listener must be a function"); + return ( + this._events || (this._events = {}), + this._events.newListener && + this.emit("newListener", e, r(t.listener) ? t.listener : t), + this._events[e] + ? o(this._events[e]) + ? this._events[e].push(t) + : (this._events[e] = [this._events[e], t]) + : (this._events[e] = t), + o(this._events[e]) && + !this._events[e].warned && + (i = a(this._maxListeners) + ? n.defaultMaxListeners + : this._maxListeners) && + i > 0 && + this._events[e].length > i && + ((this._events[e].warned = true), + console.error( + "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", + this._events[e].length + ), + "function" == typeof console.trace && console.trace()), + this + ); + }), + (n.prototype.on = n.prototype.addListener), + (n.prototype.once = function (e, t) { + if (!r(t)) throw TypeError("listener must be a function"); var i = false; function n() { - this.removeListener(e, n), - i || (i = true, - t.apply(this, arguments)) + this.removeListener(e, n), + i || ((i = true), t.apply(this, arguments)); } - return n.listener = t, - this.on(e, n), - this - } - , - n.prototype.removeListener = function(e, t) { + return (n.listener = t), this.on(e, n), this; + }), + (n.prototype.removeListener = function (e, t) { var i, n, a, s; - if (!r(t)) - throw TypeError("listener must be a function"); - if (!this._events || !this._events[e]) - return this; - if (a = (i = this._events[e]).length, - n = -1, - i === t || r(i.listener) && i.listener === t) - delete this._events[e], + if (!r(t)) throw TypeError("listener must be a function"); + if (!this._events || !this._events[e]) return this; + if ( + ((a = (i = this._events[e]).length), + (n = -1), + i === t || (r(i.listener) && i.listener === t)) + ) + delete this._events[e], this._events.removeListener && this.emit("removeListener", e, t); else if (o(i)) { - for (s = a; s-- > 0; ) - if (i[s] === t || i[s].listener && i[s].listener === t) { - n = s; - break - } - if (n < 0) - return this; - 1 === i.length ? (i.length = 0, - delete this._events[e]) : i.splice(n, 1), - this._events.removeListener && this.emit("removeListener", e, t) + for (s = a; s-- > 0; ) + if (i[s] === t || (i[s].listener && i[s].listener === t)) { + n = s; + break; + } + if (n < 0) return this; + 1 === i.length + ? ((i.length = 0), delete this._events[e]) + : i.splice(n, 1), + this._events.removeListener && this.emit("removeListener", e, t); } - return this - } - , - n.prototype.removeAllListeners = function(e) { + return this; + }), + (n.prototype.removeAllListeners = function (e) { var t, i; - if (!this._events) - return this; + if (!this._events) return this; if (!this._events.removeListener) - return 0 === arguments.length ? this._events = {} : this._events[e] && delete this._events[e], - this; - if (0 === arguments.length) { - for (t in this._events) - "removeListener" !== t && this.removeAllListeners(t); - return this.removeAllListeners("removeListener"), - this._events = {}, + return ( + 0 === arguments.length + ? (this._events = {}) + : this._events[e] && delete this._events[e], this + ); + if (0 === arguments.length) { + for (t in this._events) + "removeListener" !== t && this.removeAllListeners(t); + return ( + this.removeAllListeners("removeListener"), (this._events = {}), this + ); } - if (r(i = this._events[e])) - this.removeListener(e, i); - else if (i) - for (; i.length; ) - this.removeListener(e, i[i.length - 1]); - return delete this._events[e], - this - } - , - n.prototype.listeners = function(e) { - return this._events && this._events[e] ? r(this._events[e]) ? [this._events[e]] : this._events[e].slice() : [] - } - , - n.prototype.listenerCount = function(e) { + if (r((i = this._events[e]))) this.removeListener(e, i); + else if (i) for (; i.length; ) this.removeListener(e, i[i.length - 1]); + return delete this._events[e], this; + }), + (n.prototype.listeners = function (e) { + return this._events && this._events[e] + ? r(this._events[e]) + ? [this._events[e]] + : this._events[e].slice() + : []; + }), + (n.prototype.listenerCount = function (e) { if (this._events) { - var t = this._events[e]; - if (r(t)) - return 1; - if (t) - return t.length + var t = this._events[e]; + if (r(t)) return 1; + if (t) return t.length; } - return 0 - } - , - n.listenerCount = function(e, t) { - return e.listenerCount(t) - } -} -, function(e, t, i) { + return 0; + }), + (n.listenerCount = function (e, t) { + return e.listenerCount(t); + }); + }, + function (e, t, i) { "use strict"; e.exports = { - Timer: function(e, t) { - var i = t || "" - , n = e || 1 - , r = [] - , o = [] - , a = 0 - , s = 0 - , c = 0 - , u = 0 - , l = true; - this.start = function() { - l && (r.length = o.length = 0, - l = false), - a = s = performance.now(), - c++ + Timer: function (e, t) { + var i = t || "", + n = e || 1, + r = [], + o = [], + a = 0, + s = 0, + c = 0, + u = 0, + l = true; + (this.start = function () { + l && ((r.length = o.length = 0), (l = false)), + (a = s = performance.now()), + c++; + }), + (this.add = function (e) { + var t = performance.now(); + o.indexOf(e) < 0 && o.push(e); + var i = o.indexOf(e); + r[i] || (r[i] = 0), (r[i] += t - s), (s = t); + }), + (this.report = function () { + if (((u += performance.now() - a), c === n)) { + var e = + " total: " + (u / n).toFixed(2) + "ms (avg, " + n + " runs)"; + console.log( + i + ":", + o + .map(function (e, t) { + return e + ": " + (r[t] / n).toFixed(2) + "ms "; + }) + .join(""), + n > 1 ? e : "" + ), + (l = true), + (c = 0), + (u = 0); } - , - this.add = function(e) { - var t = performance.now(); - o.indexOf(e) < 0 && o.push(e); - var i = o.indexOf(e); - r[i] || (r[i] = 0), - r[i] += t - s, - s = t - } - , - this.report = function() { - if (u += performance.now() - a, - c === n) { - var e = " total: " + (u / n).toFixed(2) + "ms (avg, " + n + " runs)"; - console.log(i + ":", o.map(function(e, t) { - return e + ": " + (r[t] / n).toFixed(2) + "ms " - }).join(""), n > 1 ? e : ""), - l = true, - c = 0, - u = 0 - } - } - }, - removeUnorderedListItem: function(e, t) { - var i = e.indexOf(t); - if (i < 0) - return; - i === e.length - 1 ? e.pop() : e[i] = e.pop() - } - } -} -, function(e, t, i) { - var n = i(2).Buffer - , r = i(128).Transform - , o = i(124).StringDecoder; + }); + }, + removeUnorderedListItem: function (e, t) { + var i = e.indexOf(t); + if (i < 0) return; + i === e.length - 1 ? e.pop() : (e[i] = e.pop()); + }, + }; + }, + function (e, t, i) { + var n = i(2).Buffer, + r = i(128).Transform, + o = i(124).StringDecoder; function a(e) { - r.call(this), - this.hashMode = "string" == typeof e, - this.hashMode ? this[e] = this._finalOrDigest : this.final = this._finalOrDigest, - this._final && (this.__final = this._final, - this._final = null), - this._decoder = null, - this._encoding = null + r.call(this), + (this.hashMode = "string" == typeof e), + this.hashMode + ? (this[e] = this._finalOrDigest) + : (this.final = this._finalOrDigest), + this._final && ((this.__final = this._final), (this._final = null)), + (this._decoder = null), + (this._encoding = null); } i(1)(a, r), - a.prototype.update = function(e, t, i) { + (a.prototype.update = function (e, t, i) { "string" == typeof e && (e = n.from(e, t)); var r = this._update(e); - return this.hashMode ? this : (i && (r = this._toString(r, i)), - r) - } - , - a.prototype.setAutoPadding = function() {} - , - a.prototype.getAuthTag = function() { - throw new Error("trying to get auth tag in unsupported state") - } - , - a.prototype.setAuthTag = function() { - throw new Error("trying to set auth tag in unsupported state") - } - , - a.prototype.setAAD = function() { - throw new Error("trying to set aad in unsupported state") - } - , - a.prototype._transform = function(e, t, i) { + return this.hashMode ? this : (i && (r = this._toString(r, i)), r); + }), + (a.prototype.setAutoPadding = function () {}), + (a.prototype.getAuthTag = function () { + throw new Error("trying to get auth tag in unsupported state"); + }), + (a.prototype.setAuthTag = function () { + throw new Error("trying to set auth tag in unsupported state"); + }), + (a.prototype.setAAD = function () { + throw new Error("trying to set aad in unsupported state"); + }), + (a.prototype._transform = function (e, t, i) { var n; try { - this.hashMode ? this._update(e) : this.push(this._update(e)) + this.hashMode ? this._update(e) : this.push(this._update(e)); } catch (e) { - n = e + n = e; } finally { - i(n) + i(n); } - } - , - a.prototype._flush = function(e) { + }), + (a.prototype._flush = function (e) { var t; try { - this.push(this.__final()) + this.push(this.__final()); } catch (e) { - t = e + t = e; } - e(t) - } - , - a.prototype._finalOrDigest = function(e) { + e(t); + }), + (a.prototype._finalOrDigest = function (e) { var t = this.__final() || n.alloc(0); - return e && (t = this._toString(t, e, true)), - t - } - , - a.prototype._toString = function(e, t, i) { - if (this._decoder || (this._decoder = new o(t), - this._encoding = t), - this._encoding !== t) - throw new Error("can't switch encodings"); + return e && (t = this._toString(t, e, true)), t; + }), + (a.prototype._toString = function (e, t, i) { + if ( + (this._decoder || ((this._decoder = new o(t)), (this._encoding = t)), + this._encoding !== t) + ) + throw new Error("can't switch encodings"); var n = this._decoder.write(e); - return i && (n += this._decoder.end()), - n - } - , - e.exports = a -} -, function(e, t) { - e.exports = function(e, t) { - return { - enumerable: !(1 & e), - configurable: !(2 & e), - writable: !(4 & e), - value: t - } - } -} -, function(e, t) { - var i = 0 - , n = Math.random(); - e.exports = function(e) { - return "Symbol(".concat(void 0 === e ? "" : e, ")_", (++i + n).toString(36)) - } -} -, function(e, t) { - e.exports = false -} -, function(e, t, i) { - var n = i(140) - , r = i(99); - e.exports = Object.keys || function(e) { - return n(e, r) - } -} -, function(e, t, i) { - var n = i(28) - , r = Math.max - , o = Math.min; - e.exports = function(e, t) { - return (e = n(e)) < 0 ? r(e + t, 0) : o(e, t) - } -} -, function(e, t, i) { - var n = i(4) - , r = i(141) - , o = i(99) - , a = i(98)("IE_PROTO") - , s = function() {} - , c = function() { - var e, t = i(95)("iframe"), n = o.length; - for (t.style.display = "none", - i(101).appendChild(t), - t.src = "javascript:", - (e = t.contentWindow.document).open(), - e.write(""), + e.close(), + c = e.F; + n--; + + ) + delete c.prototype[o[n]]; + return c(); + }; + e.exports = + Object.create || + function (e, t) { var i; - return null !== e ? (s.prototype = n(e), - i = new s, - s.prototype = null, - i[a] = e) : i = c(), - void 0 === t ? i : r(i, t) - } -} -, function(e, t, i) { - var n = i(140) - , r = i(99).concat("length", "prototype"); - t.f = Object.getOwnPropertyNames || function(e) { - return n(e, r) - } -} -, function(e, t, i) { - var n = i(22) - , r = i(20) - , o = i(98)("IE_PROTO") - , a = Object.prototype; - e.exports = Object.getPrototypeOf || function(e) { - return e = r(e), - n(e, o) ? e[o] : "function" == typeof e.constructor && e instanceof e.constructor ? e.constructor.prototype : e instanceof Object ? a : null - } -} -, function(e, t, i) { + return ( + null !== e + ? ((s.prototype = n(e)), + (i = new s()), + (s.prototype = null), + (i[a] = e)) + : (i = c()), + void 0 === t ? i : r(i, t) + ); + }; + }, + function (e, t, i) { + var n = i(140), + r = i(99).concat("length", "prototype"); + t.f = + Object.getOwnPropertyNames || + function (e) { + return n(e, r); + }; + }, + function (e, t, i) { + var n = i(22), + r = i(20), + o = i(98)("IE_PROTO"), + a = Object.prototype; + e.exports = + Object.getPrototypeOf || + function (e) { + return ( + (e = r(e)), + n(e, o) + ? e[o] + : "function" == typeof e.constructor && e instanceof e.constructor + ? e.constructor.prototype + : e instanceof Object + ? a + : null + ); + }; + }, + function (e, t, i) { "use strict"; - (function(t, n) { - var r = i(2).Buffer - , o = t.crypto || t.msCrypto; - o && o.getRandomValues ? e.exports = function(e, i) { - if (e > 65536) - throw new Error("requested too many random bytes"); + (function (t, n) { + var r = i(2).Buffer, + o = t.crypto || t.msCrypto; + o && o.getRandomValues + ? (e.exports = function (e, i) { + if (e > 65536) throw new Error("requested too many random bytes"); var a = new t.Uint8Array(e); e > 0 && o.getRandomValues(a); var s = r.from(a.buffer); if ("function" == typeof i) - return n.nextTick(function() { - i(null, s) - }); - return s - } - : e.exports = function() { - throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11") - } - } - ).call(this, i(15), i(27)) -} -, function(e, t, i) { + return n.nextTick(function () { + i(null, s); + }); + return s; + }) + : (e.exports = function () { + throw new Error( + "Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11" + ); + }); + }.call(this, i(15), i(27))); + }, + function (e, t, i) { "use strict"; - var n = i(86) - , r = Object.keys || function(e) { - var t = []; - for (var i in e) - t.push(i); - return t - } - ; + var n = i(86), + r = + Object.keys || + function (e) { + var t = []; + for (var i in e) t.push(i); + return t; + }; e.exports = h; var o = i(68); o.inherits = i(1); - var a = i(169) - , s = i(123); + var a = i(169), + s = i(123); o.inherits(h, a); for (var c = r(s.prototype), u = 0; u < c.length; u++) { - var l = c[u]; - h.prototype[l] || (h.prototype[l] = s.prototype[l]) + var l = c[u]; + h.prototype[l] || (h.prototype[l] = s.prototype[l]); } function h(e) { - if (!(this instanceof h)) - return new h(e); - a.call(this, e), + if (!(this instanceof h)) return new h(e); + a.call(this, e), s.call(this, e), e && false === e.readable && (this.readable = false), e && false === e.writable && (this.writable = false), - this.allowHalfOpen = true, + (this.allowHalfOpen = true), e && false === e.allowHalfOpen && (this.allowHalfOpen = false), - this.once("end", f) + this.once("end", f); } function f() { - this.allowHalfOpen || this._writableState.ended || n.nextTick(d, this) + this.allowHalfOpen || this._writableState.ended || n.nextTick(d, this); } function d(e) { - e.end() + e.end(); } Object.defineProperty(h.prototype, "writableHighWaterMark", { - enumerable: false, - get: function() { - return this._writableState.highWaterMark - } + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + }, }), - Object.defineProperty(h.prototype, "destroyed", { - get: function() { - return void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState.destroyed && this._writableState.destroyed) + Object.defineProperty(h.prototype, "destroyed", { + get: function () { + return ( + void 0 !== this._readableState && + void 0 !== this._writableState && + this._readableState.destroyed && + this._writableState.destroyed + ); }, - set: function(e) { - void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState.destroyed = e, - this._writableState.destroyed = e) - } - }), - h.prototype._destroy = function(e, t) { - this.push(null), - this.end(), - n.nextTick(t, e) - } -} -, function(e, t, i) { + set: function (e) { + void 0 !== this._readableState && + void 0 !== this._writableState && + ((this._readableState.destroyed = e), + (this._writableState.destroyed = e)); + }, + }), + (h.prototype._destroy = function (e, t) { + this.push(null), this.end(), n.nextTick(t, e); + }); + }, + function (e, t, i) { "use strict"; var n = i(94); function r(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n.enumerable = n.enumerable || false, - n.configurable = true, - "value"in n && (n.writable = true), - Object.defineProperty(e, n.key, n) - } + for (var i = 0; i < t.length; i++) { + var n = t[i]; + (n.enumerable = n.enumerable || false), + (n.configurable = true), + "value" in n && (n.writable = true), + Object.defineProperty(e, n.key, n); + } } - var o = function() { - function e(t, i) { - !function(e, t) { - if (!(e instanceof t)) - throw new TypeError("Cannot call a class as a function") - }(this, e), - void 0 === e.id && (e.id = 1e4), - this.isClient = t.isClient, - this.isSelf = void 0 !== t.isSelf && t.isSelf, - this.network = void 0 !== t.network ? t.network : null, - this.initializeState(t), - this.positionCallback = "function" == typeof i ? i : null, - this.id = e.id += 1, - true === this.isClient && this.sendJoined() - } - var t, i, o; - return t = e, - (i = [{ + var o = (function () { + function e(t, i) { + !(function (e, t) { + if (!(e instanceof t)) + throw new TypeError("Cannot call a class as a function"); + })(this, e), + void 0 === e.id && (e.id = 1e4), + (this.isClient = t.isClient), + (this.isSelf = void 0 !== t.isSelf && t.isSelf), + (this.network = void 0 !== t.network ? t.network : null), + this.initializeState(t), + (this.positionCallback = "function" == typeof i ? i : null), + (this.id = e.id += 1), + true === this.isClient && this.sendJoined(); + } + var t, i, o; + return ( + (t = e), + (i = [ + { key: "initializeState", - value: function(e) { - this.state = { - name: e.name, - position: { - x: 0, - y: 0, - z: 0 - }, - rotation: { - x: 0, - y: 0, - z: 0 - }, - walking: false, - spawned: false + value: function (e) { + (this.state = { + name: e.name, + position: { + x: 0, + y: 0, + z: 0, }, - this.peer = e.peer - } - }, { + rotation: { + x: 0, + y: 0, + z: 0, + }, + walking: false, + spawned: false, + }), + (this.peer = e.peer); + }, + }, + { key: "setPosition", - value: function(e, t, i) { - this.state.walking = e.x !== this.state.position.x || e.z !== this.state.position.z, - this.state.position = e, - this.state.rotation = t, - this.state.spawned = i, - this.positionCallback && this.positionCallback(this.state) - } - }, { + value: function (e, t, i) { + (this.state.walking = + e.x !== this.state.position.x || e.z !== this.state.position.z), + (this.state.position = e), + (this.state.rotation = t), + (this.state.spawned = i), + this.positionCallback && this.positionCallback(this.state); + }, + }, + { key: "setState", - value: function(e) { - var t = this.state.name !== e.name; - this.state.position = e.position, - this.state.rotation = e.rotation, - this.state.walking = e.walking, - this.state.spawned = e.spawned, - this.state.name = e.name, - (void 0 === this.noaPlayer || t) && this.state.spawned && (void 0 !== this.noaPlayer && this.noaPlayer.remove(), - this.noaPlayer = n.a.getInstance().addPlayer(0, 0, 0, this.state.name, this.id)), - void 0 !== this.noaPlayer && (this.noaPlayer.setPosition(e.position.x, e.position.y, e.position.z), - this.noaPlayer.setRotation(0, e.rotation.y, 0), - this.noaPlayer.walking = e.walking) - } - }, { + value: function (e) { + var t = this.state.name !== e.name; + (this.state.position = e.position), + (this.state.rotation = e.rotation), + (this.state.walking = e.walking), + (this.state.spawned = e.spawned), + (this.state.name = e.name), + (void 0 === this.noaPlayer || t) && + this.state.spawned && + (void 0 !== this.noaPlayer && this.noaPlayer.remove(), + (this.noaPlayer = n.a + .getInstance() + .addPlayer(0, 0, 0, this.state.name, this.id))), + void 0 !== this.noaPlayer && + (this.noaPlayer.setPosition( + e.position.x, + e.position.y, + e.position.z + ), + this.noaPlayer.setRotation(0, e.rotation.y, 0), + (this.noaPlayer.walking = e.walking)); + }, + }, + { key: "sendJoined", - value: function() { - null != this.network && this.network.sendJoined(this.state.name) - } - }, { + value: function () { + null != this.network && this.network.sendJoined(this.state.name); + }, + }, + { key: "sendMessage", - value: function(e) { - null != this.network && this.network.sendMessage(e) - } - }, { + value: function (e) { + null != this.network && this.network.sendMessage(e); + }, + }, + { key: "emitFireEvent", - value: function(e) { - null != this.network && this.network.emitFireEvent(e) - } - }]) && r(t.prototype, i), + value: function (e) { + null != this.network && this.network.emitFireEvent(e); + }, + }, + ]) && r(t.prototype, i), o && r(t, o), e - }(); - t.a = o -} -, function(e, t, i) { - var n = i(12).f - , r = i(22) - , o = i(8)("toStringTag"); - e.exports = function(e, t, i) { - e && !r(e = i ? e : e.prototype, o) && n(e, o, { - configurable: true, - value: t - }) - } -} -, function(e, t) { - e.exports = {} -} -, function(e, t, i) { - var n = i(8)("unscopables") - , r = Array.prototype; + ); + })(); + t.a = o; + }, + function (e, t, i) { + var n = i(12).f, + r = i(22), + o = i(8)("toStringTag"); + e.exports = function (e, t, i) { + e && + !r((e = i ? e : e.prototype), o) && + n(e, o, { + configurable: true, + value: t, + }); + }; + }, + function (e, t) { + e.exports = {}; + }, + function (e, t, i) { + var n = i(8)("unscopables"), + r = Array.prototype; null == r[n] && i(23)(r, n, {}), - e.exports = function(e) { - r[n][e] = true - } -} -, function(e, t, i) { + (e.exports = function (e) { + r[n][e] = true; + }); + }, + function (e, t, i) { "use strict"; - var n = i(5) - , r = i(12) - , o = i(13) - , a = i(8)("species"); - e.exports = function(e) { - var t = n[e]; - o && t && !t[a] && r.f(t, a, { - configurable: true, - get: function() { - return this - } - }) - } -} -, function(e, t) { - e.exports = function(e, t, i, n) { - if (!(e instanceof t) || void 0 !== n && n in e) - throw TypeError(i + ": incorrect invocation!"); - return e - } -} -, function(e, t, i) { + var n = i(5), + r = i(12), + o = i(13), + a = i(8)("species"); + e.exports = function (e) { + var t = n[e]; + o && + t && + !t[a] && + r.f(t, a, { + configurable: true, + get: function () { + return this; + }, + }); + }; + }, + function (e, t) { + e.exports = function (e, t, i, n) { + if (!(e instanceof t) || (void 0 !== n && n in e)) + throw TypeError(i + ": incorrect invocation!"); + return e; + }; + }, + function (e, t, i) { var n = i(19); - e.exports = function(e, t, i) { - for (var r in t) - n(e, r, t[r], i); - return e - } -} -, function(e, t, i) { + e.exports = function (e, t, i) { + for (var r in t) n(e, r, t[r], i); + return e; + }; + }, + function (e, t, i) { var n = i(6); - e.exports = function(e, t) { - if (!n(e) || e._t !== t) - throw TypeError("Incompatible receiver, " + t + " required!"); - return e - } -} -, function(e, t, i) { + e.exports = function (e, t) { + if (!n(e) || e._t !== t) + throw TypeError("Incompatible receiver, " + t + " required!"); + return e; + }; + }, + function (e, t, i) { var n = i(2).Buffer; function r(e, t) { - this._block = n.alloc(e), - this._finalSize = t, - this._blockSize = e, - this._len = 0 + (this._block = n.alloc(e)), + (this._finalSize = t), + (this._blockSize = e), + (this._len = 0); } - r.prototype.update = function(e, t) { - "string" == typeof e && (t = t || "utf8", - e = n.from(e, t)); - for (var i = this._block, r = this._blockSize, o = e.length, a = this._len, s = 0; s < o; ) { - for (var c = a % r, u = Math.min(o - s, r - c), l = 0; l < u; l++) - i[c + l] = e[s + l]; - s += u, - (a += u) % r == 0 && this._update(i) - } - return this._len += o, - this - } - , - r.prototype.digest = function(e) { + (r.prototype.update = function (e, t) { + "string" == typeof e && ((t = t || "utf8"), (e = n.from(e, t))); + for ( + var i = this._block, + r = this._blockSize, + o = e.length, + a = this._len, + s = 0; + s < o; + + ) { + for (var c = a % r, u = Math.min(o - s, r - c), l = 0; l < u; l++) + i[c + l] = e[s + l]; + (s += u), (a += u) % r == 0 && this._update(i); + } + return (this._len += o), this; + }), + (r.prototype.digest = function (e) { var t = this._len % this._blockSize; - this._block[t] = 128, - this._block.fill(0, t + 1), - t >= this._finalSize && (this._update(this._block), - this._block.fill(0)); + (this._block[t] = 128), + this._block.fill(0, t + 1), + t >= this._finalSize && + (this._update(this._block), this._block.fill(0)); var i = 8 * this._len; - if (i <= 4294967295) - this._block.writeUInt32BE(i, this._blockSize - 4); + if (i <= 4294967295) this._block.writeUInt32BE(i, this._blockSize - 4); else { - var n = (4294967295 & i) >>> 0 - , r = (i - n) / 4294967296; - this._block.writeUInt32BE(r, this._blockSize - 8), - this._block.writeUInt32BE(n, this._blockSize - 4) + var n = (4294967295 & i) >>> 0, + r = (i - n) / 4294967296; + this._block.writeUInt32BE(r, this._blockSize - 8), + this._block.writeUInt32BE(n, this._blockSize - 4); } this._update(this._block); var o = this._hash(); - return e ? o.toString(e) : o - } - , - r.prototype._update = function() { - throw new Error("_update must be implemented by subclass") - } - , - e.exports = r -} -, function(e, t, i) { + return e ? o.toString(e) : o; + }), + (r.prototype._update = function () { + throw new Error("_update must be implemented by subclass"); + }), + (e.exports = r); + }, + function (e, t, i) { var n = i(36); - e.exports = Object("z").propertyIsEnumerable(0) ? Object : function(e) { - return "String" == n(e) ? e.split("") : Object(e) - } -} -, function(e, t) { - t.f = {}.propertyIsEnumerable -} -, function(e, t, i) { - var n = i(36) - , r = i(8)("toStringTag") - , o = "Arguments" == n(function() { - return arguments - }()); - e.exports = function(e) { - var t, i, a; - return void 0 === e ? "Undefined" : null === e ? "Null" : "string" == typeof (i = function(e, t) { + e.exports = Object("z").propertyIsEnumerable(0) + ? Object + : function (e) { + return "String" == n(e) ? e.split("") : Object(e); + }; + }, + function (e, t) { + t.f = {}.propertyIsEnumerable; + }, + function (e, t, i) { + var n = i(36), + r = i(8)("toStringTag"), + o = + "Arguments" == + n( + (function () { + return arguments; + })() + ); + e.exports = function (e) { + var t, i, a; + return void 0 === e + ? "Undefined" + : null === e + ? "Null" + : "string" == + typeof (i = (function (e, t) { try { - return e[t] + return e[t]; } catch (e) {} - }(t = Object(e), r)) ? i : o ? n(t) : "Object" == (a = n(t)) && "function" == typeof t.callee ? "Arguments" : a - } -} -, function(e, t, i) { - var n = i(4) - , r = i(35) - , o = i(8)("species"); - e.exports = function(e, t) { - var i, a = n(e).constructor; - return void 0 === a || null == (i = n(a)[o]) ? t : r(i) - } -} -, function(e, t, i) { - (function(e) { - function i(e) { - return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - function n(e) { - return Object.prototype.toString.call(e) - } - t.isArray = function(e) { - return Array.isArray ? Array.isArray(e) : "[object Array]" === n(e) - } - , - t.isBoolean = function(e) { - return "boolean" == typeof e - } - , - t.isNull = function(e) { - return null === e - } - , - t.isNullOrUndefined = function(e) { - return null == e - } - , - t.isNumber = function(e) { - return "number" == typeof e - } - , - t.isString = function(e) { - return "string" == typeof e - } - , - t.isSymbol = function(e) { - return "symbol" === i(e) - } - , - t.isUndefined = function(e) { - return void 0 === e - } - , - t.isRegExp = function(e) { - return "[object RegExp]" === n(e) - } - , - t.isObject = function(e) { - return "object" === i(e) && null !== e - } - , - t.isDate = function(e) { - return "[object Date]" === n(e) - } - , - t.isError = function(e) { - return "[object Error]" === n(e) || e instanceof Error - } - , - t.isFunction = function(e) { - return "function" == typeof e - } - , - t.isPrimitive = function(e) { - return null === e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || "symbol" === i(e) || void 0 === e - } - , - t.isBuffer = e.isBuffer - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { + })((t = Object(e)), r)) + ? i + : o + ? n(t) + : "Object" == (a = n(t)) && "function" == typeof t.callee + ? "Arguments" + : a; + }; + }, + function (e, t, i) { + var n = i(4), + r = i(35), + o = i(8)("species"); + e.exports = function (e, t) { + var i, + a = n(e).constructor; + return void 0 === a || null == (i = n(a)[o]) ? t : r(i); + }; + }, + function (e, t, i) { + (function (e) { + function i(e) { + return (i = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + function n(e) { + return Object.prototype.toString.call(e); + } + (t.isArray = function (e) { + return Array.isArray ? Array.isArray(e) : "[object Array]" === n(e); + }), + (t.isBoolean = function (e) { + return "boolean" == typeof e; + }), + (t.isNull = function (e) { + return null === e; + }), + (t.isNullOrUndefined = function (e) { + return null == e; + }), + (t.isNumber = function (e) { + return "number" == typeof e; + }), + (t.isString = function (e) { + return "string" == typeof e; + }), + (t.isSymbol = function (e) { + return "symbol" === i(e); + }), + (t.isUndefined = function (e) { + return void 0 === e; + }), + (t.isRegExp = function (e) { + return "[object RegExp]" === n(e); + }), + (t.isObject = function (e) { + return "object" === i(e) && null !== e; + }), + (t.isDate = function (e) { + return "[object Date]" === n(e); + }), + (t.isError = function (e) { + return "[object Error]" === n(e) || e instanceof Error; + }), + (t.isFunction = function (e) { + return "function" == typeof e; + }), + (t.isPrimitive = function (e) { + return ( + null === e || + "boolean" == typeof e || + "number" == typeof e || + "string" == typeof e || + "symbol" === i(e) || + void 0 === e + ); + }), + (t.isBuffer = e.isBuffer); + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { "use strict"; - var n = i(1) - , r = i(127) - , o = i(129) - , a = i(130) - , s = i(44); + var n = i(1), + r = i(127), + o = i(129), + a = i(130), + s = i(44); function c(e) { - s.call(this, "digest"), - this._hash = e + s.call(this, "digest"), (this._hash = e); } n(c, s), - c.prototype._update = function(e) { - this._hash.update(e) - } - , - c.prototype._final = function() { - return this._hash.digest() - } - , - e.exports = function(e) { - return "md5" === (e = e.toLowerCase()) ? new r : "rmd160" === e || "ripemd160" === e ? new o : new c(a(e)) - } -} -, function(e, t, i) { - (function(t) { - e.exports = function(e, i) { - for (var n = Math.min(e.length, i.length), r = new t(n), o = 0; o < n; ++o) - r[o] = e[o] ^ i[o]; - return r - } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { + (c.prototype._update = function (e) { + this._hash.update(e); + }), + (c.prototype._final = function () { + return this._hash.digest(); + }), + (e.exports = function (e) { + return "md5" === (e = e.toLowerCase()) + ? new r() + : "rmd160" === e || "ripemd160" === e + ? new o() + : new c(a(e)); + }); + }, + function (e, t, i) { + (function (t) { + e.exports = function (e, i) { + for ( + var n = Math.min(e.length, i.length), r = new t(n), o = 0; + o < n; + ++o + ) + r[o] = e[o] ^ i[o]; + return r; + }; + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { "use strict"; - var n = i(33) - , r = i(25); + var n = i(33), + r = i(25); function o() { - this.pending = null, - this.pendingTotal = 0, - this.blockSize = this.constructor.blockSize, - this.outSize = this.constructor.outSize, - this.hmacStrength = this.constructor.hmacStrength, - this.padLength = this.constructor.padLength / 8, - this.endian = "big", - this._delta8 = this.blockSize / 8, - this._delta32 = this.blockSize / 32 + (this.pending = null), + (this.pendingTotal = 0), + (this.blockSize = this.constructor.blockSize), + (this.outSize = this.constructor.outSize), + (this.hmacStrength = this.constructor.hmacStrength), + (this.padLength = this.constructor.padLength / 8), + (this.endian = "big"), + (this._delta8 = this.blockSize / 8), + (this._delta32 = this.blockSize / 32); } - t.BlockHash = o, - o.prototype.update = function(e, t) { - if (e = n.toArray(e, t), - this.pending ? this.pending = this.pending.concat(e) : this.pending = e, - this.pendingTotal += e.length, - this.pending.length >= this._delta8) { - var i = (e = this.pending).length % this._delta8; - this.pending = e.slice(e.length - i, e.length), + (t.BlockHash = o), + (o.prototype.update = function (e, t) { + if ( + ((e = n.toArray(e, t)), + this.pending + ? (this.pending = this.pending.concat(e)) + : (this.pending = e), + (this.pendingTotal += e.length), + this.pending.length >= this._delta8) + ) { + var i = (e = this.pending).length % this._delta8; + (this.pending = e.slice(e.length - i, e.length)), 0 === this.pending.length && (this.pending = null), - e = n.join32(e, 0, e.length - i, this.endian); - for (var r = 0; r < e.length; r += this._delta32) - this._update(e, r, r + this._delta32) + (e = n.join32(e, 0, e.length - i, this.endian)); + for (var r = 0; r < e.length; r += this._delta32) + this._update(e, r, r + this._delta32); } - return this - } - , - o.prototype.digest = function(e) { - return this.update(this._pad()), - r(null === this.pending), - this._digest(e) - } - , - o.prototype._pad = function() { - var e = this.pendingTotal - , t = this._delta8 - , i = t - (e + this.padLength) % t - , n = new Array(i + this.padLength); + return this; + }), + (o.prototype.digest = function (e) { + return ( + this.update(this._pad()), r(null === this.pending), this._digest(e) + ); + }), + (o.prototype._pad = function () { + var e = this.pendingTotal, + t = this._delta8, + i = t - ((e + this.padLength) % t), + n = new Array(i + this.padLength); n[0] = 128; - for (var r = 1; r < i; r++) - n[r] = 0; - if (e <<= 3, - "big" === this.endian) { - for (var o = 8; o < this.padLength; o++) - n[r++] = 0; - n[r++] = 0, - n[r++] = 0, - n[r++] = 0, - n[r++] = 0, - n[r++] = e >>> 24 & 255, - n[r++] = e >>> 16 & 255, - n[r++] = e >>> 8 & 255, - n[r++] = 255 & e + for (var r = 1; r < i; r++) n[r] = 0; + if (((e <<= 3), "big" === this.endian)) { + for (var o = 8; o < this.padLength; o++) n[r++] = 0; + (n[r++] = 0), + (n[r++] = 0), + (n[r++] = 0), + (n[r++] = 0), + (n[r++] = (e >>> 24) & 255), + (n[r++] = (e >>> 16) & 255), + (n[r++] = (e >>> 8) & 255), + (n[r++] = 255 & e); } else - for (n[r++] = 255 & e, - n[r++] = e >>> 8 & 255, - n[r++] = e >>> 16 & 255, - n[r++] = e >>> 24 & 255, - n[r++] = 0, - n[r++] = 0, - n[r++] = 0, - n[r++] = 0, - o = 8; o < this.padLength; o++) - n[r++] = 0; - return n - } -} -, function(e, t, i) { + for ( + n[r++] = 255 & e, + n[r++] = (e >>> 8) & 255, + n[r++] = (e >>> 16) & 255, + n[r++] = (e >>> 24) & 255, + n[r++] = 0, + n[r++] = 0, + n[r++] = 0, + n[r++] = 0, + o = 8; + o < this.padLength; + o++ + ) + n[r++] = 0; + return n; + }); + }, + function (e, t, i) { var n = t; - n.bignum = i(11), - n.define = i(571).define, - n.base = i(73), - n.constants = i(219), - n.decoders = i(577), - n.encoders = i(579) -} -, function(e, t, i) { + (n.bignum = i(11)), + (n.define = i(571).define), + (n.base = i(73)), + (n.constants = i(219)), + (n.decoders = i(577)), + (n.encoders = i(579)); + }, + function (e, t, i) { var n = t; - n.Reporter = i(574).Reporter, - n.DecoderBuffer = i(218).DecoderBuffer, - n.EncoderBuffer = i(218).EncoderBuffer, - n.Node = i(575) -} -, function(e, t, i) { - var n = i(24) - , r = i(10) - , o = i(49); - e.exports = function(e) { - return function(t, i, a) { - var s, c = n(t), u = r(c.length), l = o(a, u); - if (e && i != i) { - for (; u > l; ) - if ((s = c[l++]) != s) - return true - } else - for (; u > l; l++) - if ((e || l in c) && c[l] === i) - return e || l || 0; - return !e && -1 - } - } -} -, function(e, t) { - t.f = Object.getOwnPropertySymbols -} -, function(e, t, i) { - var n = i(0) - , r = i(37) - , o = i(3) - , a = i(103) - , s = "[" + a + "]" - , c = RegExp("^" + s + s + "*") - , u = RegExp(s + s + "*$") - , l = function(e, t, i) { - var r = {} - , s = o(function() { - return !!a[e]() || "​…" != "​…"[e]() - }) - , c = r[e] = s ? t(h) : a[e]; - i && (r[i] = c), - n(n.P + n.F * s, "String", r) - } - , h = l.trim = function(e, t) { - return e = String(r(e)), - 1 & t && (e = e.replace(c, "")), - 2 & t && (e = e.replace(u, "")), - e - } - ; - e.exports = l -} -, function(e, t, i) { - var n = i(8)("iterator") - , r = false; + (n.Reporter = i(574).Reporter), + (n.DecoderBuffer = i(218).DecoderBuffer), + (n.EncoderBuffer = i(218).EncoderBuffer), + (n.Node = i(575)); + }, + function (e, t, i) { + var n = i(24), + r = i(10), + o = i(49); + e.exports = function (e) { + return function (t, i, a) { + var s, + c = n(t), + u = r(c.length), + l = o(a, u); + if (e && i != i) { + for (; u > l; ) if ((s = c[l++]) != s) return true; + } else + for (; u > l; l++) + if ((e || l in c) && c[l] === i) return e || l || 0; + return !e && -1; + }; + }; + }, + function (e, t) { + t.f = Object.getOwnPropertySymbols; + }, + function (e, t, i) { + var n = i(0), + r = i(37), + o = i(3), + a = i(103), + s = "[" + a + "]", + c = RegExp("^" + s + s + "*"), + u = RegExp(s + s + "*$"), + l = function (e, t, i) { + var r = {}, + s = o(function () { + return !!a[e]() || "​…" != "​…"[e](); + }), + c = (r[e] = s ? t(h) : a[e]); + i && (r[i] = c), n(n.P + n.F * s, "String", r); + }, + h = (l.trim = function (e, t) { + return ( + (e = String(r(e))), + 1 & t && (e = e.replace(c, "")), + 2 & t && (e = e.replace(u, "")), + e + ); + }); + e.exports = l; + }, + function (e, t, i) { + var n = i(8)("iterator"), + r = false; try { - var o = [7][n](); - o.return = function() { - r = true - } - , - Array.from(o, function() { - throw 2 - }) + var o = [7][n](); + (o.return = function () { + r = true; + }), + Array.from(o, function () { + throw 2; + }); } catch (e) {} - e.exports = function(e, t) { - if (!t && !r) - return false; - var i = false; - try { - var o = [7] - , a = o[n](); - a.next = function() { - return { - done: i = true - } - } - , - o[n] = function() { - return a - } - , - e(o) - } catch (e) {} - return i - } -} -, function(e, t, i) { + e.exports = function (e, t) { + if (!t && !r) return false; + var i = false; + try { + var o = [7], + a = o[n](); + (a.next = function () { + return { + done: (i = true), + }; + }), + (o[n] = function () { + return a; + }), + e(o); + } catch (e) {} + return i; + }; + }, + function (e, t, i) { "use strict"; var n = i(4); - e.exports = function() { - var e = n(this) - , t = ""; - return e.global && (t += "g"), + e.exports = function () { + var e = n(this), + t = ""; + return ( + e.global && (t += "g"), e.ignoreCase && (t += "i"), e.multiline && (t += "m"), e.unicode && (t += "u"), e.sticky && (t += "y"), t - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - var r = i(66) - , o = RegExp.prototype.exec; - e.exports = function(e, t) { - var i = e.exec; - if ("function" == typeof i) { - var a = i.call(e, t); - if ("object" !== n(a)) - throw new TypeError("RegExp exec method returned something other than an Object or null"); - return a - } - if ("RegExp" !== r(e)) - throw new TypeError("RegExp#exec called on incompatible receiver"); - return o.call(e, t) - } -} -, function(e, t, i) { + var r = i(66), + o = RegExp.prototype.exec; + e.exports = function (e, t) { + var i = e.exec; + if ("function" == typeof i) { + var a = i.call(e, t); + if ("object" !== n(a)) + throw new TypeError( + "RegExp exec method returned something other than an Object or null" + ); + return a; + } + if ("RegExp" !== r(e)) + throw new TypeError("RegExp#exec called on incompatible receiver"); + return o.call(e, t); + }; + }, + function (e, t, i) { "use strict"; i(157); - var n = i(19) - , r = i(23) - , o = i(3) - , a = i(37) - , s = i(8) - , c = i(118) - , u = s("species") - , l = !o(function() { + var n = i(19), + r = i(23), + o = i(3), + a = i(37), + s = i(8), + c = i(118), + u = s("species"), + l = !o(function () { var e = /./; - return e.exec = function() { + return ( + (e.exec = function () { var e = []; - return e.groups = { - a: "7" - }, - e - } - , - "7" !== "".replace(e, "$") - }) - , h = function() { - var e = /(?:)/ - , t = e.exec; - e.exec = function() { - return t.apply(this, arguments) - } - ; - var i = "ab".split(e); - return 2 === i.length && "a" === i[0] && "b" === i[1] - }(); - e.exports = function(e, t, i) { - var f = s(e) - , d = !o(function() { - var t = {}; - return t[f] = function() { - return 7 - } - , - 7 != ""[e](t) - }) - , p = d ? !o(function() { - var t = false - , i = /a/; - return i.exec = function() { - return t = true, - null - } - , - "split" === e && (i.constructor = {}, - i.constructor[u] = function() { - return i - } - ), - i[f](""), - !t - }) : void 0; - if (!d || !p || "replace" === e && !l || "split" === e && !h) { - var m = /./[f] - , g = i(a, f, ""[e], function(e, t, i, n, r) { - return t.exec === c ? d && !r ? { - done: true, - value: m.call(t, i, n) - } : { - done: true, - value: e.call(i, t, n) - } : { - done: false - } - }) - , _ = g[0] - , v = g[1]; - n(String.prototype, e, _), - r(RegExp.prototype, f, 2 == t ? function(e, t) { - return v.call(e, this, t) - } - : function(e) { - return v.call(e, this) - } - ) - } - } -} -, function(e, t, i) { - var n = i(34) - , r = i(153) - , o = i(113) - , a = i(4) - , s = i(10) - , c = i(115) - , u = {} - , l = {}; - (t = e.exports = function(e, t, i, h, f) { - var d, p, m, g, _ = f ? function() { - return e - } - : c(e), v = n(i, h, t ? 2 : 1), y = 0; - if ("function" != typeof _) - throw TypeError(e + " is not iterable!"); - if (o(_)) { - for (d = s(e.length); d > y; y++) - if ((g = t ? v(a(p = e[y])[0], p[1]) : v(e[y])) === u || g === l) - return g - } else - for (m = _.call(e); !(p = m.next()).done; ) - if ((g = r(m, v, p.value, t)) === u || g === l) - return g - } - ).BREAK = u, - t.RETURN = l -} -, function(e, t, i) { - var n = i(5).navigator; - e.exports = n && n.userAgent || "" -} -, function(e, t, i) { - "use strict"; - var n = i(5) - , r = i(0) - , o = i(19) - , a = i(61) - , s = i(40) - , c = i(81) - , u = i(60) - , l = i(6) - , h = i(3) - , f = i(77) - , d = i(56) - , p = i(104); - e.exports = function(e, t, i, m, g, _) { - var v = n[e] - , y = v - , b = g ? "set" : "add" - , E = y && y.prototype - , T = {} - , A = function(e) { - var t = E[e]; - o(E, e, "delete" == e ? function(e) { - return !(_ && !l(e)) && t.call(this, 0 === e ? 0 : e) - } - : "has" == e ? function(e) { - return !(_ && !l(e)) && t.call(this, 0 === e ? 0 : e) - } - : "get" == e ? function(e) { - return _ && !l(e) ? void 0 : t.call(this, 0 === e ? 0 : e) - } - : "add" == e ? function(e) { - return t.call(this, 0 === e ? 0 : e), - this - } - : function(e, i) { - return t.call(this, 0 === e ? 0 : e, i), - this - } - ) + return ( + (e.groups = { + a: "7", + }), + e + ); + }), + "7" !== "".replace(e, "$") + ); + }), + h = (function () { + var e = /(?:)/, + t = e.exec; + e.exec = function () { + return t.apply(this, arguments); }; - if ("function" == typeof y && (_ || E.forEach && !h(function() { - (new y).entries().next() - }))) { - var x = new y - , S = x[b](_ ? {} : -0, 1) != x - , C = h(function() { - x.has(1) + var i = "ab".split(e); + return 2 === i.length && "a" === i[0] && "b" === i[1]; + })(); + e.exports = function (e, t, i) { + var f = s(e), + d = !o(function () { + var t = {}; + return ( + (t[f] = function () { + return 7; + }), + 7 != ""[e](t) + ); + }), + p = d + ? !o(function () { + var t = false, + i = /a/; + return ( + (i.exec = function () { + return (t = true), null; + }), + "split" === e && + ((i.constructor = {}), + (i.constructor[u] = function () { + return i; + })), + i[f](""), + !t + ); }) - , P = f(function(e) { - new y(e) - }) - , R = !_ && h(function() { - for (var e = new y, t = 5; t--; ) - e[b](t, t); - return !e.has(-0) - }); - P || ((y = t(function(t, i) { - u(t, y, e); - var n = p(new v, t, y); - return null != i && c(i, g, n[b], n), - n - })).prototype = E, - E.constructor = y), - (C || R) && (A("delete"), - A("has"), - g && A("get")), - (R || S) && A(b), - _ && E.clear && delete E.clear + : void 0; + if (!d || !p || ("replace" === e && !l) || ("split" === e && !h)) { + var m = /./[f], + g = i(a, f, ""[e], function (e, t, i, n, r) { + return t.exec === c + ? d && !r + ? { + done: true, + value: m.call(t, i, n), + } + : { + done: true, + value: e.call(i, t, n), + } + : { + done: false, + }; + }), + _ = g[0], + v = g[1]; + n(String.prototype, e, _), + r( + RegExp.prototype, + f, + 2 == t + ? function (e, t) { + return v.call(e, this, t); + } + : function (e) { + return v.call(e, this); + } + ); + } + }; + }, + function (e, t, i) { + var n = i(34), + r = i(153), + o = i(113), + a = i(4), + s = i(10), + c = i(115), + u = {}, + l = {}; + ((t = e.exports = + function (e, t, i, h, f) { + var d, + p, + m, + g, + _ = f + ? function () { + return e; + } + : c(e), + v = n(i, h, t ? 2 : 1), + y = 0; + if ("function" != typeof _) throw TypeError(e + " is not iterable!"); + if (o(_)) { + for (d = s(e.length); d > y; y++) + if ((g = t ? v(a((p = e[y]))[0], p[1]) : v(e[y])) === u || g === l) + return g; } else - y = m.getConstructor(t, e, g, b), - a(y.prototype, i), - s.NEED = true; - return d(y, e), - T[e] = y, + for (m = _.call(e); !(p = m.next()).done; ) + if ((g = r(m, v, p.value, t)) === u || g === l) return g; + }).BREAK = u), + (t.RETURN = l); + }, + function (e, t, i) { + var n = i(5).navigator; + e.exports = (n && n.userAgent) || ""; + }, + function (e, t, i) { + "use strict"; + var n = i(5), + r = i(0), + o = i(19), + a = i(61), + s = i(40), + c = i(81), + u = i(60), + l = i(6), + h = i(3), + f = i(77), + d = i(56), + p = i(104); + e.exports = function (e, t, i, m, g, _) { + var v = n[e], + y = v, + b = g ? "set" : "add", + E = y && y.prototype, + T = {}, + A = function (e) { + var t = E[e]; + o( + E, + e, + "delete" == e + ? function (e) { + return !(_ && !l(e)) && t.call(this, 0 === e ? 0 : e); + } + : "has" == e + ? function (e) { + return !(_ && !l(e)) && t.call(this, 0 === e ? 0 : e); + } + : "get" == e + ? function (e) { + return _ && !l(e) ? void 0 : t.call(this, 0 === e ? 0 : e); + } + : "add" == e + ? function (e) { + return t.call(this, 0 === e ? 0 : e), this; + } + : function (e, i) { + return t.call(this, 0 === e ? 0 : e, i), this; + } + ); + }; + if ( + "function" == typeof y && + (_ || + (E.forEach && + !h(function () { + new y().entries().next(); + }))) + ) { + var x = new y(), + S = x[b](_ ? {} : -0, 1) != x, + C = h(function () { + x.has(1); + }), + P = f(function (e) { + new y(e); + }), + R = + !_ && + h(function () { + for (var e = new y(), t = 5; t--; ) e[b](t, t); + return !e.has(-0); + }); + P || + (((y = t(function (t, i) { + u(t, y, e); + var n = p(new v(), t, y); + return null != i && c(i, g, n[b], n), n; + })).prototype = E), + (E.constructor = y)), + (C || R) && (A("delete"), A("has"), g && A("get")), + (R || S) && A(b), + _ && E.clear && delete E.clear; + } else + (y = m.getConstructor(t, e, g, b)), a(y.prototype, i), (s.NEED = true); + return ( + d(y, e), + (T[e] = y), r(r.G + r.W + r.F * (y != v), T), _ || m.setStrong(y, e, g), y - } -} -, function(e, t, i) { - for (var n, r = i(5), o = i(23), a = i(46), s = a("typed_array"), c = a("view"), u = !(!r.ArrayBuffer || !r.DataView), l = u, h = 0, f = "Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(","); h < 9; ) - (n = r[f[h++]]) ? (o(n.prototype, s, true), - o(n.prototype, c, true)) : l = false; + ); + }; + }, + function (e, t, i) { + for ( + var n, + r = i(5), + o = i(23), + a = i(46), + s = a("typed_array"), + c = a("view"), + u = !(!r.ArrayBuffer || !r.DataView), + l = u, + h = 0, + f = + "Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split( + "," + ); + h < 9; + + ) + (n = r[f[h++]]) + ? (o(n.prototype, s, true), o(n.prototype, c, true)) + : (l = false); e.exports = { - ABV: u, - CONSTR: l, - TYPED: s, - VIEW: c - } -} -, function(e, t, i) { - (t = e.exports = i(169)).Stream = t, - t.Readable = t, - t.Writable = i(123), - t.Duplex = i(54), - t.Transform = i(172), - t.PassThrough = i(410) -} -, function(e, t, i) { + ABV: u, + CONSTR: l, + TYPED: s, + VIEW: c, + }; + }, + function (e, t, i) { + ((t = e.exports = i(169)).Stream = t), + (t.Readable = t), + (t.Writable = i(123)), + (t.Duplex = i(54)), + (t.Transform = i(172)), + (t.PassThrough = i(410)); + }, + function (e, t, i) { "use strict"; - (function(t) { - !t.version || 0 === t.version.indexOf("v0.") || 0 === t.version.indexOf("v1.") && 0 !== t.version.indexOf("v1.8.") ? e.exports = { - nextTick: function(e, i, n, r) { - if ("function" != typeof e) - throw new TypeError('"callback" argument must be a function'); - var o, a, s = arguments.length; - switch (s) { + (function (t) { + !t.version || + 0 === t.version.indexOf("v0.") || + (0 === t.version.indexOf("v1.") && 0 !== t.version.indexOf("v1.8.")) + ? (e.exports = { + nextTick: function (e, i, n, r) { + if ("function" != typeof e) + throw new TypeError('"callback" argument must be a function'); + var o, + a, + s = arguments.length; + switch (s) { case 0: case 1: - return t.nextTick(e); + return t.nextTick(e); case 2: - return t.nextTick(function() { - e.call(null, i) - }); + return t.nextTick(function () { + e.call(null, i); + }); case 3: - return t.nextTick(function() { - e.call(null, i, n) - }); + return t.nextTick(function () { + e.call(null, i, n); + }); case 4: - return t.nextTick(function() { - e.call(null, i, n, r) - }); + return t.nextTick(function () { + e.call(null, i, n, r); + }); default: - for (o = new Array(s - 1), - a = 0; a < o.length; ) - o[a++] = arguments[a]; - return t.nextTick(function() { - e.apply(null, o) - }) - } - } - } : e.exports = t - } - ).call(this, i(27)) -} -, function(exp, t, getterFunc) { + for (o = new Array(s - 1), a = 0; a < o.length; ) + o[a++] = arguments[a]; + return t.nextTick(function () { + e.apply(null, o); + }); + } + }, + }) + : (e.exports = t); + }.call(this, i(27))); + }, + function (exp, t, getterFunc) { exp.exports = r; var vec3Math = getterFunc(16); function r(e, t) { - if (!(this instanceof r)) - return new r(e,t); - var i = vec3Math.create(); - vec3Math.add(i, e, t), - this.base = vec3Math.min(vec3Math.create(), e, i), - this.vec = vec3Math.clone(t), - this.max = vec3Math.max(vec3Math.create(), e, i), - this.mag = vec3Math.length(this.vec) + if (!(this instanceof r)) return new r(e, t); + var i = vec3Math.create(); + vec3Math.add(i, e, t), + (this.base = vec3Math.min(vec3Math.create(), e, i)), + (this.vec = vec3Math.clone(t)), + (this.max = vec3Math.max(vec3Math.create(), e, i)), + (this.mag = vec3Math.length(this.vec)); } var o = r.prototype; - o.width = function() { - return this.vec[0] - } - , - o.height = function() { - return this.vec[1] - } - , - o.depth = function() { - return this.vec[2] - } - , - o.x0 = function() { - return this.base[0] - } - , - o.y0 = function() { - return this.base[1] - } - , - o.z0 = function() { - return this.base[2] - } - , - o.x1 = function() { - return this.max[0] - } - , - o.y1 = function() { - return this.max[1] - } - , - o.z1 = function() { - return this.max[2] - } - , - o.translate = function(e) { - return vec3Math.add(this.max, this.max, e), - vec3Math.add(this.base, this.base, e), - this - } - , - o.setPosition = function(e) { - return vec3Math.add(this.max, e, this.vec), - vec3Math.copy(this.base, e), - this - } - , - o.expand = function(e) { - var t = vec3Math.create() - , i = vec3Math.create(); - return vec3Math.max(t, e.max, this.max), - vec3Math.min(i, e.base, this.base), - vec3Math.subtract(t, t, i), - new r(i,t) - } - , - o.intersects = function(e) { - return !(e.base[0] > this.max[0]) && (!(e.base[1] > this.max[1]) && (!(e.base[2] > this.max[2]) && (!(e.max[0] < this.base[0]) && (!(e.max[1] < this.base[1]) && !(e.max[2] < this.base[2]))))) - } - , - o.touches = function(e) { + (o.width = function () { + return this.vec[0]; + }), + (o.height = function () { + return this.vec[1]; + }), + (o.depth = function () { + return this.vec[2]; + }), + (o.x0 = function () { + return this.base[0]; + }), + (o.y0 = function () { + return this.base[1]; + }), + (o.z0 = function () { + return this.base[2]; + }), + (o.x1 = function () { + return this.max[0]; + }), + (o.y1 = function () { + return this.max[1]; + }), + (o.z1 = function () { + return this.max[2]; + }), + (o.translate = function (e) { + return ( + vec3Math.add(this.max, this.max, e), + vec3Math.add(this.base, this.base, e), + this + ); + }), + (o.setPosition = function (e) { + return ( + vec3Math.add(this.max, e, this.vec), vec3Math.copy(this.base, e), this + ); + }), + (o.expand = function (e) { + var t = vec3Math.create(), + i = vec3Math.create(); + return ( + vec3Math.max(t, e.max, this.max), + vec3Math.min(i, e.base, this.base), + vec3Math.subtract(t, t, i), + new r(i, t) + ); + }), + (o.intersects = function (e) { + return ( + !(e.base[0] > this.max[0]) && + !(e.base[1] > this.max[1]) && + !(e.base[2] > this.max[2]) && + !(e.max[0] < this.base[0]) && + !(e.max[1] < this.base[1]) && + !(e.max[2] < this.base[2]) + ); + }), + (o.touches = function (e) { var t = this.union(e); - return null !== t && (0 == t.width() || 0 == t.height() || 0 == t.depth()) - } - , - o.union = function(e) { - if (!this.intersects(e)) - return null; - var t = Math.max(e.base[0], this.base[0]) - , i = Math.max(e.base[1], this.base[1]) - , n = Math.max(e.base[2], this.base[2]); - return new r([t, i, n],[Math.min(e.max[0], this.max[0]) - t, Math.min(e.max[1], this.max[1]) - i, Math.min(e.max[2], this.max[2]) - n]) - } -} -, function(e, t, i) { - var n = i(185) - , r = i(446) - , o = "undefined" != typeof Float64Array; + return ( + null !== t && (0 == t.width() || 0 == t.height() || 0 == t.depth()) + ); + }), + (o.union = function (e) { + if (!this.intersects(e)) return null; + var t = Math.max(e.base[0], this.base[0]), + i = Math.max(e.base[1], this.base[1]), + n = Math.max(e.base[2], this.base[2]); + return new r( + [t, i, n], + [ + Math.min(e.max[0], this.max[0]) - t, + Math.min(e.max[1], this.max[1]) - i, + Math.min(e.max[2], this.max[2]) - n, + ] + ); + }); + }, + function (e, t, i) { + var n = i(185), + r = i(446), + o = "undefined" != typeof Float64Array; function a(e, t) { - return e[0] - t[0] + return e[0] - t[0]; } function s() { - var e, t = this.stride, i = new Array(t.length); - for (e = 0; e < i.length; ++e) - i[e] = [Math.abs(t[e]), e]; - i.sort(a); - var n = new Array(i.length); - for (e = 0; e < n.length; ++e) - n[e] = i[e][1]; - return n + var e, + t = this.stride, + i = new Array(t.length); + for (e = 0; e < i.length; ++e) i[e] = [Math.abs(t[e]), e]; + i.sort(a); + var n = new Array(i.length); + for (e = 0; e < n.length; ++e) n[e] = i[e][1]; + return n; } function c(e, t) { - var i = ["View", t, "d", e].join(""); - t < 0 && (i = "View_Nil" + e); - var r = "generic" === e; - if (-1 === t) { - var o = "function " + i + "(a){this.data=a;};var proto=" + i + ".prototype;proto.dtype='" + e + "';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new " + i + "(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_" + i + "(a){return new " + i + "(a);}"; - return new Function(o)() - } - if (0 === t) { - o = "function " + i + "(a,d) {this.data = a;this.offset = d};var proto=" + i + ".prototype;proto.dtype='" + e + "';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function " + i + "_copy() {return new " + i + "(this.data,this.offset)};proto.pick=function " + i + "_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function " + i + "_get(){return " + (r ? "this.data.get(this.offset)" : "this.data[this.offset]") + "};proto.set=function " + i + "_set(v){return " + (r ? "this.data.set(this.offset,v)" : "this.data[this.offset]=v") + "};return function construct_" + i + "(a,b,c,d){return new " + i + "(a,d)}"; - return new Function("TrivialArray",o)(u[e][0]) - } - o = ["'use strict'"]; - var a = n(t) - , c = a.map(function(e) { - return "i" + e - }) - , l = "this.offset+" + a.map(function(e) { - return "this.stride[" + e + "]*i" + e - }).join("+") - , h = a.map(function(e) { - return "b" + e - }).join(",") - , f = a.map(function(e) { - return "c" + e - }).join(","); - o.push("function " + i + "(a," + h + "," + f + ",d){this.data=a", "this.shape=[" + h + "]", "this.stride=[" + f + "]", "this.offset=d|0}", "var proto=" + i + ".prototype", "proto.dtype='" + e + "'", "proto.dimension=" + t), - o.push("Object.defineProperty(proto,'size',{get:function " + i + "_size(){return " + a.map(function(e) { - return "this.shape[" + e + "]" - }).join("*"), "}})"), - 1 === t ? o.push("proto.order=[0]") : (o.push("Object.defineProperty(proto,'order',{get:"), - t < 4 ? (o.push("function " + i + "_order(){"), - 2 === t ? o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})") : 3 === t && o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")) : o.push("ORDER})")), + var i = ["View", t, "d", e].join(""); + t < 0 && (i = "View_Nil" + e); + var r = "generic" === e; + if (-1 === t) { + var o = + "function " + + i + + "(a){this.data=a;};var proto=" + + i + + ".prototype;proto.dtype='" + + e + + "';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new " + + i + + "(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_" + + i + + "(a){return new " + + i + + "(a);}"; + return new Function(o)(); + } + if (0 === t) { + o = + "function " + + i + + "(a,d) {this.data = a;this.offset = d};var proto=" + + i + + ".prototype;proto.dtype='" + + e + + "';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function " + + i + + "_copy() {return new " + + i + + "(this.data,this.offset)};proto.pick=function " + + i + + "_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function " + + i + + "_get(){return " + + (r ? "this.data.get(this.offset)" : "this.data[this.offset]") + + "};proto.set=function " + + i + + "_set(v){return " + + (r ? "this.data.set(this.offset,v)" : "this.data[this.offset]=v") + + "};return function construct_" + + i + + "(a,b,c,d){return new " + + i + + "(a,d)}"; + return new Function("TrivialArray", o)(u[e][0]); + } + o = ["'use strict'"]; + var a = n(t), + c = a.map(function (e) { + return "i" + e; + }), + l = + "this.offset+" + + a + .map(function (e) { + return "this.stride[" + e + "]*i" + e; + }) + .join("+"), + h = a + .map(function (e) { + return "b" + e; + }) + .join(","), + f = a + .map(function (e) { + return "c" + e; + }) + .join(","); + o.push( + "function " + i + "(a," + h + "," + f + ",d){this.data=a", + "this.shape=[" + h + "]", + "this.stride=[" + f + "]", + "this.offset=d|0}", + "var proto=" + i + ".prototype", + "proto.dtype='" + e + "'", + "proto.dimension=" + t + ), + o.push( + "Object.defineProperty(proto,'size',{get:function " + + i + + "_size(){return " + + a + .map(function (e) { + return "this.shape[" + e + "]"; + }) + .join("*"), + "}})" + ), + 1 === t + ? o.push("proto.order=[0]") + : (o.push("Object.defineProperty(proto,'order',{get:"), + t < 4 + ? (o.push("function " + i + "_order(){"), + 2 === t + ? o.push( + "return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})" + ) + : 3 === t && + o.push( + "var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})" + )) + : o.push("ORDER})")), o.push("proto.set=function " + i + "_set(" + c.join(",") + ",v){"), - r ? o.push("return this.data.set(" + l + ",v)}") : o.push("return this.data[" + l + "]=v}"), + r + ? o.push("return this.data.set(" + l + ",v)}") + : o.push("return this.data[" + l + "]=v}"), o.push("proto.get=function " + i + "_get(" + c.join(",") + "){"), - r ? o.push("return this.data.get(" + l + ")}") : o.push("return this.data[" + l + "]}"), - o.push("proto.index=function " + i + "_index(", c.join(), "){return " + l + "}"), - o.push("proto.hi=function " + i + "_hi(" + c.join(",") + "){return new " + i + "(this.data," + a.map(function(e) { - return ["(typeof i", e, "!=='number'||i", e, "<0)?this.shape[", e, "]:i", e, "|0"].join("") - }).join(",") + "," + a.map(function(e) { - return "this.stride[" + e + "]" - }).join(",") + ",this.offset)}"); - var d = a.map(function(e) { - return "a" + e + "=this.shape[" + e + "]" - }) - , p = a.map(function(e) { - return "c" + e + "=this.stride[" + e + "]" + r + ? o.push("return this.data.get(" + l + ")}") + : o.push("return this.data[" + l + "]}"), + o.push( + "proto.index=function " + i + "_index(", + c.join(), + "){return " + l + "}" + ), + o.push( + "proto.hi=function " + + i + + "_hi(" + + c.join(",") + + "){return new " + + i + + "(this.data," + + a + .map(function (e) { + return [ + "(typeof i", + e, + "!=='number'||i", + e, + "<0)?this.shape[", + e, + "]:i", + e, + "|0", + ].join(""); + }) + .join(",") + + "," + + a + .map(function (e) { + return "this.stride[" + e + "]"; + }) + .join(",") + + ",this.offset)}" + ); + var d = a.map(function (e) { + return "a" + e + "=this.shape[" + e + "]"; + }), + p = a.map(function (e) { + return "c" + e + "=this.stride[" + e + "]"; }); - o.push("proto.lo=function " + i + "_lo(" + c.join(",") + "){var b=this.offset,d=0," + d.join(",") + "," + p.join(",")); - for (var m = 0; m < t; ++m) - o.push("if(typeof i" + m + "==='number'&&i" + m + ">=0){d=i" + m + "|0;b+=c" + m + "*d;a" + m + "-=d}"); - o.push("return new " + i + "(this.data," + a.map(function(e) { - return "a" + e - }).join(",") + "," + a.map(function(e) { - return "c" + e - }).join(",") + ",b)}"), - o.push("proto.step=function " + i + "_step(" + c.join(",") + "){var " + a.map(function(e) { - return "a" + e + "=this.shape[" + e + "]" - }).join(",") + "," + a.map(function(e) { - return "b" + e + "=this.stride[" + e + "]" - }).join(",") + ",c=this.offset,d=0,ceil=Math.ceil"); - for (m = 0; m < t; ++m) - o.push("if(typeof i" + m + "==='number'){d=i" + m + "|0;if(d<0){c+=b" + m + "*(a" + m + "-1);a" + m + "=ceil(-a" + m + "/d)}else{a" + m + "=ceil(a" + m + "/d)}b" + m + "*=d}"); - o.push("return new " + i + "(this.data," + a.map(function(e) { - return "a" + e - }).join(",") + "," + a.map(function(e) { - return "b" + e - }).join(",") + ",c)}"); - var g = new Array(t) - , _ = new Array(t); - for (m = 0; m < t; ++m) - g[m] = "a[i" + m + "]", - _[m] = "b[i" + m + "]"; - o.push("proto.transpose=function " + i + "_transpose(" + c + "){" + c.map(function(e, t) { - return e + "=(" + e + "===undefined?" + t + ":" + e + "|0)" - }).join(";"), "var a=this.shape,b=this.stride;return new " + i + "(this.data," + g.join(",") + "," + _.join(",") + ",this.offset)}"), - o.push("proto.pick=function " + i + "_pick(" + c + "){var a=[],b=[],c=this.offset"); - for (m = 0; m < t; ++m) - o.push("if(typeof i" + m + "==='number'&&i" + m + ">=0){c=(c+this.stride[" + m + "]*i" + m + ")|0}else{a.push(this.shape[" + m + "]);b.push(this.stride[" + m + "])}"); - return o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"), - o.push("return function construct_" + i + "(data,shape,stride,offset){return new " + i + "(data," + a.map(function(e) { - return "shape[" + e + "]" - }).join(",") + "," + a.map(function(e) { - return "stride[" + e + "]" - }).join(",") + ",offset)}"), - new Function("CTOR_LIST","ORDER",o.join("\n"))(u[e], s) + o.push( + "proto.lo=function " + + i + + "_lo(" + + c.join(",") + + "){var b=this.offset,d=0," + + d.join(",") + + "," + + p.join(",") + ); + for (var m = 0; m < t; ++m) + o.push( + "if(typeof i" + + m + + "==='number'&&i" + + m + + ">=0){d=i" + + m + + "|0;b+=c" + + m + + "*d;a" + + m + + "-=d}" + ); + o.push( + "return new " + + i + + "(this.data," + + a + .map(function (e) { + return "a" + e; + }) + .join(",") + + "," + + a + .map(function (e) { + return "c" + e; + }) + .join(",") + + ",b)}" + ), + o.push( + "proto.step=function " + + i + + "_step(" + + c.join(",") + + "){var " + + a + .map(function (e) { + return "a" + e + "=this.shape[" + e + "]"; + }) + .join(",") + + "," + + a + .map(function (e) { + return "b" + e + "=this.stride[" + e + "]"; + }) + .join(",") + + ",c=this.offset,d=0,ceil=Math.ceil" + ); + for (m = 0; m < t; ++m) + o.push( + "if(typeof i" + + m + + "==='number'){d=i" + + m + + "|0;if(d<0){c+=b" + + m + + "*(a" + + m + + "-1);a" + + m + + "=ceil(-a" + + m + + "/d)}else{a" + + m + + "=ceil(a" + + m + + "/d)}b" + + m + + "*=d}" + ); + o.push( + "return new " + + i + + "(this.data," + + a + .map(function (e) { + return "a" + e; + }) + .join(",") + + "," + + a + .map(function (e) { + return "b" + e; + }) + .join(",") + + ",c)}" + ); + var g = new Array(t), + _ = new Array(t); + for (m = 0; m < t; ++m) + (g[m] = "a[i" + m + "]"), (_[m] = "b[i" + m + "]"); + o.push( + "proto.transpose=function " + + i + + "_transpose(" + + c + + "){" + + c + .map(function (e, t) { + return e + "=(" + e + "===undefined?" + t + ":" + e + "|0)"; + }) + .join(";"), + "var a=this.shape,b=this.stride;return new " + + i + + "(this.data," + + g.join(",") + + "," + + _.join(",") + + ",this.offset)}" + ), + o.push( + "proto.pick=function " + + i + + "_pick(" + + c + + "){var a=[],b=[],c=this.offset" + ); + for (m = 0; m < t; ++m) + o.push( + "if(typeof i" + + m + + "==='number'&&i" + + m + + ">=0){c=(c+this.stride[" + + m + + "]*i" + + m + + ")|0}else{a.push(this.shape[" + + m + + "]);b.push(this.stride[" + + m + + "])}" + ); + return ( + o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"), + o.push( + "return function construct_" + + i + + "(data,shape,stride,offset){return new " + + i + + "(data," + + a + .map(function (e) { + return "shape[" + e + "]"; + }) + .join(",") + + "," + + a + .map(function (e) { + return "stride[" + e + "]"; + }) + .join(",") + + ",offset)}" + ), + new Function("CTOR_LIST", "ORDER", o.join("\n"))(u[e], s) + ); } var u = { - float32: [], - float64: [], - int8: [], - int16: [], - int32: [], - uint8: [], - uint16: [], - uint32: [], - array: [], - uint8_clamped: [], - buffer: [], - generic: [] + float32: [], + float64: [], + int8: [], + int16: [], + int32: [], + uint8: [], + uint16: [], + uint32: [], + array: [], + uint8_clamped: [], + buffer: [], + generic: [], }; - e.exports = function(e, t, i, n) { - if (void 0 === e) - return (0, - u.array[0])([]); - "number" == typeof e && (e = [e]), - void 0 === t && (t = [e.length]); - var a = t.length; - if (void 0 === i) { - i = new Array(a); - for (var s = a - 1, l = 1; s >= 0; --s) - i[s] = l, - l *= t[s] - } - if (void 0 === n) - for (n = 0, - s = 0; s < a; ++s) - i[s] < 0 && (n -= (t[s] - 1) * i[s]); - for (var h = function(e) { - if (r(e)) - return "buffer"; + e.exports = function (e, t, i, n) { + if (void 0 === e) return (0, u.array[0])([]); + "number" == typeof e && (e = [e]), void 0 === t && (t = [e.length]); + var a = t.length; + if (void 0 === i) { + i = new Array(a); + for (var s = a - 1, l = 1; s >= 0; --s) (i[s] = l), (l *= t[s]); + } + if (void 0 === n) + for (n = 0, s = 0; s < a; ++s) i[s] < 0 && (n -= (t[s] - 1) * i[s]); + for ( + var h = (function (e) { + if (r(e)) return "buffer"; if (o) - switch (Object.prototype.toString.call(e)) { + switch (Object.prototype.toString.call(e)) { case "[object Float64Array]": - return "float64"; + return "float64"; case "[object Float32Array]": - return "float32"; + return "float32"; case "[object Int8Array]": - return "int8"; + return "int8"; case "[object Int16Array]": - return "int16"; + return "int16"; case "[object Int32Array]": - return "int32"; + return "int32"; case "[object Uint8Array]": - return "uint8"; + return "uint8"; case "[object Uint16Array]": - return "uint16"; + return "uint16"; case "[object Uint32Array]": - return "uint32"; + return "uint32"; case "[object Uint8ClampedArray]": - return "uint8_clamped" - } - return Array.isArray(e) ? "array" : "generic" - }(e), f = u[h]; f.length <= a + 1; ) - f.push(c(h, f.length - 1)); - return (0, - f[a + 1])(e, t, i, n) - } -} -, function(e, t, i) { + return "uint8_clamped"; + } + return Array.isArray(e) ? "array" : "generic"; + })(e), + f = u[h]; + f.length <= a + 1; + + ) + f.push(c(h, f.length - 1)); + return (0, f[a + 1])(e, t, i, n); + }; + }, + function (e, t, i) { var n = i(2).Buffer; function r(e) { - n.isBuffer(e) || (e = n.from(e)); - for (var t = e.length / 4 | 0, i = new Array(t), r = 0; r < t; r++) - i[r] = e.readUInt32BE(4 * r); - return i + n.isBuffer(e) || (e = n.from(e)); + for (var t = (e.length / 4) | 0, i = new Array(t), r = 0; r < t; r++) + i[r] = e.readUInt32BE(4 * r); + return i; } function o(e) { - for (; 0 < e.length; e++) - e[0] = 0 + for (; 0 < e.length; e++) e[0] = 0; } function a(e, t, i, n, r) { - for (var o, a, s, c, u = i[0], l = i[1], h = i[2], f = i[3], d = e[0] ^ t[0], p = e[1] ^ t[1], m = e[2] ^ t[2], g = e[3] ^ t[3], _ = 4, v = 1; v < r; v++) - o = u[d >>> 24] ^ l[p >>> 16 & 255] ^ h[m >>> 8 & 255] ^ f[255 & g] ^ t[_++], - a = u[p >>> 24] ^ l[m >>> 16 & 255] ^ h[g >>> 8 & 255] ^ f[255 & d] ^ t[_++], - s = u[m >>> 24] ^ l[g >>> 16 & 255] ^ h[d >>> 8 & 255] ^ f[255 & p] ^ t[_++], - c = u[g >>> 24] ^ l[d >>> 16 & 255] ^ h[p >>> 8 & 255] ^ f[255 & m] ^ t[_++], - d = o, - p = a, - m = s, - g = c; - return o = (n[d >>> 24] << 24 | n[p >>> 16 & 255] << 16 | n[m >>> 8 & 255] << 8 | n[255 & g]) ^ t[_++], - a = (n[p >>> 24] << 24 | n[m >>> 16 & 255] << 16 | n[g >>> 8 & 255] << 8 | n[255 & d]) ^ t[_++], - s = (n[m >>> 24] << 24 | n[g >>> 16 & 255] << 16 | n[d >>> 8 & 255] << 8 | n[255 & p]) ^ t[_++], - c = (n[g >>> 24] << 24 | n[d >>> 16 & 255] << 16 | n[p >>> 8 & 255] << 8 | n[255 & m]) ^ t[_++], - [o >>>= 0, a >>>= 0, s >>>= 0, c >>>= 0] + for ( + var o, + a, + s, + c, + u = i[0], + l = i[1], + h = i[2], + f = i[3], + d = e[0] ^ t[0], + p = e[1] ^ t[1], + m = e[2] ^ t[2], + g = e[3] ^ t[3], + _ = 4, + v = 1; + v < r; + v++ + ) + (o = + u[d >>> 24] ^ + l[(p >>> 16) & 255] ^ + h[(m >>> 8) & 255] ^ + f[255 & g] ^ + t[_++]), + (a = + u[p >>> 24] ^ + l[(m >>> 16) & 255] ^ + h[(g >>> 8) & 255] ^ + f[255 & d] ^ + t[_++]), + (s = + u[m >>> 24] ^ + l[(g >>> 16) & 255] ^ + h[(d >>> 8) & 255] ^ + f[255 & p] ^ + t[_++]), + (c = + u[g >>> 24] ^ + l[(d >>> 16) & 255] ^ + h[(p >>> 8) & 255] ^ + f[255 & m] ^ + t[_++]), + (d = o), + (p = a), + (m = s), + (g = c); + return ( + (o = + ((n[d >>> 24] << 24) | + (n[(p >>> 16) & 255] << 16) | + (n[(m >>> 8) & 255] << 8) | + n[255 & g]) ^ + t[_++]), + (a = + ((n[p >>> 24] << 24) | + (n[(m >>> 16) & 255] << 16) | + (n[(g >>> 8) & 255] << 8) | + n[255 & d]) ^ + t[_++]), + (s = + ((n[m >>> 24] << 24) | + (n[(g >>> 16) & 255] << 16) | + (n[(d >>> 8) & 255] << 8) | + n[255 & p]) ^ + t[_++]), + (c = + ((n[g >>> 24] << 24) | + (n[(d >>> 16) & 255] << 16) | + (n[(p >>> 8) & 255] << 8) | + n[255 & m]) ^ + t[_++]), + [(o >>>= 0), (a >>>= 0), (s >>>= 0), (c >>>= 0)] + ); } - var s = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54] - , c = function() { + var s = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], + c = (function () { for (var e = new Array(256), t = 0; t < 256; t++) - e[t] = t < 128 ? t << 1 : t << 1 ^ 283; - for (var i = [], n = [], r = [[], [], [], []], o = [[], [], [], []], a = 0, s = 0, c = 0; c < 256; ++c) { - var u = s ^ s << 1 ^ s << 2 ^ s << 3 ^ s << 4; - u = u >>> 8 ^ 255 & u ^ 99, - i[a] = u, - n[u] = a; - var l = e[a] - , h = e[l] - , f = e[h] - , d = 257 * e[u] ^ 16843008 * u; - r[0][a] = d << 24 | d >>> 8, - r[1][a] = d << 16 | d >>> 16, - r[2][a] = d << 8 | d >>> 24, - r[3][a] = d, - d = 16843009 * f ^ 65537 * h ^ 257 * l ^ 16843008 * a, - o[0][u] = d << 24 | d >>> 8, - o[1][u] = d << 16 | d >>> 16, - o[2][u] = d << 8 | d >>> 24, - o[3][u] = d, - 0 === a ? a = s = 1 : (a = l ^ e[e[e[f ^ l]]], - s ^= e[e[s]]) + e[t] = t < 128 ? t << 1 : (t << 1) ^ 283; + for ( + var i = [], + n = [], + r = [[], [], [], []], + o = [[], [], [], []], + a = 0, + s = 0, + c = 0; + c < 256; + ++c + ) { + var u = s ^ (s << 1) ^ (s << 2) ^ (s << 3) ^ (s << 4); + (u = (u >>> 8) ^ (255 & u) ^ 99), (i[a] = u), (n[u] = a); + var l = e[a], + h = e[l], + f = e[h], + d = (257 * e[u]) ^ (16843008 * u); + (r[0][a] = (d << 24) | (d >>> 8)), + (r[1][a] = (d << 16) | (d >>> 16)), + (r[2][a] = (d << 8) | (d >>> 24)), + (r[3][a] = d), + (d = (16843009 * f) ^ (65537 * h) ^ (257 * l) ^ (16843008 * a)), + (o[0][u] = (d << 24) | (d >>> 8)), + (o[1][u] = (d << 16) | (d >>> 16)), + (o[2][u] = (d << 8) | (d >>> 24)), + (o[3][u] = d), + 0 === a ? (a = s = 1) : ((a = l ^ e[e[e[f ^ l]]]), (s ^= e[e[s]])); } return { - SBOX: i, - INV_SBOX: n, - SUB_MIX: r, - INV_SUB_MIX: o - } - }(); + SBOX: i, + INV_SBOX: n, + SUB_MIX: r, + INV_SUB_MIX: o, + }; + })(); function u(e) { - this._key = r(e), - this._reset() + (this._key = r(e)), this._reset(); } - u.blockSize = 16, - u.keySize = 32, - u.prototype.blockSize = u.blockSize, - u.prototype.keySize = u.keySize, - u.prototype._reset = function() { - for (var e = this._key, t = e.length, i = t + 6, n = 4 * (i + 1), r = [], o = 0; o < t; o++) - r[o] = e[o]; + (u.blockSize = 16), + (u.keySize = 32), + (u.prototype.blockSize = u.blockSize), + (u.prototype.keySize = u.keySize), + (u.prototype._reset = function () { + for ( + var e = this._key, + t = e.length, + i = t + 6, + n = 4 * (i + 1), + r = [], + o = 0; + o < t; + o++ + ) + r[o] = e[o]; for (o = t; o < n; o++) { - var a = r[o - 1]; - o % t == 0 ? (a = a << 8 | a >>> 24, - a = c.SBOX[a >>> 24] << 24 | c.SBOX[a >>> 16 & 255] << 16 | c.SBOX[a >>> 8 & 255] << 8 | c.SBOX[255 & a], - a ^= s[o / t | 0] << 24) : t > 6 && o % t == 4 && (a = c.SBOX[a >>> 24] << 24 | c.SBOX[a >>> 16 & 255] << 16 | c.SBOX[a >>> 8 & 255] << 8 | c.SBOX[255 & a]), - r[o] = r[o - t] ^ a + var a = r[o - 1]; + o % t == 0 + ? ((a = (a << 8) | (a >>> 24)), + (a = + (c.SBOX[a >>> 24] << 24) | + (c.SBOX[(a >>> 16) & 255] << 16) | + (c.SBOX[(a >>> 8) & 255] << 8) | + c.SBOX[255 & a]), + (a ^= s[(o / t) | 0] << 24)) + : t > 6 && + o % t == 4 && + (a = + (c.SBOX[a >>> 24] << 24) | + (c.SBOX[(a >>> 16) & 255] << 16) | + (c.SBOX[(a >>> 8) & 255] << 8) | + c.SBOX[255 & a]), + (r[o] = r[o - t] ^ a); } for (var u = [], l = 0; l < n; l++) { - var h = n - l - , f = r[h - (l % 4 ? 0 : 4)]; - u[l] = l < 4 || h <= 4 ? f : c.INV_SUB_MIX[0][c.SBOX[f >>> 24]] ^ c.INV_SUB_MIX[1][c.SBOX[f >>> 16 & 255]] ^ c.INV_SUB_MIX[2][c.SBOX[f >>> 8 & 255]] ^ c.INV_SUB_MIX[3][c.SBOX[255 & f]] + var h = n - l, + f = r[h - (l % 4 ? 0 : 4)]; + u[l] = + l < 4 || h <= 4 + ? f + : c.INV_SUB_MIX[0][c.SBOX[f >>> 24]] ^ + c.INV_SUB_MIX[1][c.SBOX[(f >>> 16) & 255]] ^ + c.INV_SUB_MIX[2][c.SBOX[(f >>> 8) & 255]] ^ + c.INV_SUB_MIX[3][c.SBOX[255 & f]]; } - this._nRounds = i, - this._keySchedule = r, - this._invKeySchedule = u - } - , - u.prototype.encryptBlockRaw = function(e) { - return a(e = r(e), this._keySchedule, c.SUB_MIX, c.SBOX, this._nRounds) - } - , - u.prototype.encryptBlock = function(e) { - var t = this.encryptBlockRaw(e) - , i = n.allocUnsafe(16); - return i.writeUInt32BE(t[0], 0), - i.writeUInt32BE(t[1], 4), - i.writeUInt32BE(t[2], 8), - i.writeUInt32BE(t[3], 12), - i - } - , - u.prototype.decryptBlock = function(e) { + (this._nRounds = i), + (this._keySchedule = r), + (this._invKeySchedule = u); + }), + (u.prototype.encryptBlockRaw = function (e) { + return a( + (e = r(e)), + this._keySchedule, + c.SUB_MIX, + c.SBOX, + this._nRounds + ); + }), + (u.prototype.encryptBlock = function (e) { + var t = this.encryptBlockRaw(e), + i = n.allocUnsafe(16); + return ( + i.writeUInt32BE(t[0], 0), + i.writeUInt32BE(t[1], 4), + i.writeUInt32BE(t[2], 8), + i.writeUInt32BE(t[3], 12), + i + ); + }), + (u.prototype.decryptBlock = function (e) { var t = (e = r(e))[1]; - e[1] = e[3], - e[3] = t; - var i = a(e, this._invKeySchedule, c.INV_SUB_MIX, c.INV_SBOX, this._nRounds) - , o = n.allocUnsafe(16); - return o.writeUInt32BE(i[0], 0), - o.writeUInt32BE(i[3], 4), - o.writeUInt32BE(i[2], 8), - o.writeUInt32BE(i[1], 12), - o - } - , - u.prototype.scrub = function() { - o(this._keySchedule), - o(this._invKeySchedule), - o(this._key) - } - , - e.exports.AES = u -} -, function(e, t, i) { - var n = i(2).Buffer - , r = i(127); - e.exports = function(e, t, i, o) { - if (n.isBuffer(e) || (e = n.from(e, "binary")), - t && (n.isBuffer(t) || (t = n.from(t, "binary")), - 8 !== t.length)) - throw new RangeError("salt should be Buffer with 8 byte length"); - for (var a = i / 8, s = n.alloc(a), c = n.alloc(o || 0), u = n.alloc(0); a > 0 || o > 0; ) { - var l = new r; - l.update(u), - l.update(e), - t && l.update(t), - u = l.digest(); - var h = 0; - if (a > 0) { - var f = s.length - a; - h = Math.min(a, u.length), - u.copy(s, f, 0, h), - a -= h - } - if (h < u.length && o > 0) { - var d = c.length - o - , p = Math.min(o, u.length - h); - u.copy(c, d, h, h + p), - o -= p - } + (e[1] = e[3]), (e[3] = t); + var i = a( + e, + this._invKeySchedule, + c.INV_SUB_MIX, + c.INV_SBOX, + this._nRounds + ), + o = n.allocUnsafe(16); + return ( + o.writeUInt32BE(i[0], 0), + o.writeUInt32BE(i[3], 4), + o.writeUInt32BE(i[2], 8), + o.writeUInt32BE(i[1], 12), + o + ); + }), + (u.prototype.scrub = function () { + o(this._keySchedule), o(this._invKeySchedule), o(this._key); + }), + (e.exports.AES = u); + }, + function (e, t, i) { + var n = i(2).Buffer, + r = i(127); + e.exports = function (e, t, i, o) { + if ( + (n.isBuffer(e) || (e = n.from(e, "binary")), + t && (n.isBuffer(t) || (t = n.from(t, "binary")), 8 !== t.length)) + ) + throw new RangeError("salt should be Buffer with 8 byte length"); + for ( + var a = i / 8, s = n.alloc(a), c = n.alloc(o || 0), u = n.alloc(0); + a > 0 || o > 0; + + ) { + var l = new r(); + l.update(u), l.update(e), t && l.update(t), (u = l.digest()); + var h = 0; + if (a > 0) { + var f = s.length - a; + (h = Math.min(a, u.length)), u.copy(s, f, 0, h), (a -= h); } - return u.fill(0), + if (h < u.length && o > 0) { + var d = c.length - o, + p = Math.min(o, u.length - h); + u.copy(c, d, h, h + p), (o -= p); + } + } + return ( + u.fill(0), { - key: s, - iv: c + key: s, + iv: c, } - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; var n = t; - n.base = i(551), - n.short = i(552), - n.mont = i(553), - n.edwards = i(554) -} -, function(e, t, i) { - (function(t) { - function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - var r = i(570) - , o = i(582) - , a = i(583) - , s = i(132) - , c = i(202); - function u(e) { - var i; - "object" !== n(e) || t.isBuffer(e) || (i = e.passphrase, - e = e.key), - "string" == typeof e && (e = new t(e)); - var u, l, h = a(e, i), f = h.tag, d = h.data; - switch (f) { - case "CERTIFICATE": - l = r.certificate.decode(d, "der").tbsCertificate.subjectPublicKeyInfo; - case "PUBLIC KEY": - switch (l || (l = r.PublicKey.decode(d, "der")), - u = l.algorithm.algorithm.join(".")) { - case "1.2.840.113549.1.1.1": - return r.RSAPublicKey.decode(l.subjectPublicKey.data, "der"); - case "1.2.840.10045.2.1": - return l.subjectPrivateKey = l.subjectPublicKey, - { - type: "ec", - data: l - }; - case "1.2.840.10040.4.1": - return l.algorithm.params.pub_key = r.DSAparam.decode(l.subjectPublicKey.data, "der"), - { - type: "dsa", - data: l.algorithm.params - }; - default: - throw new Error("unknown key id " + u) - } - throw new Error("unknown key type " + f); - case "ENCRYPTED PRIVATE KEY": - d = function(e, i) { - var n = e.algorithm.decrypt.kde.kdeparams.salt - , r = parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(), 10) - , a = o[e.algorithm.decrypt.cipher.algo.join(".")] - , u = e.algorithm.decrypt.cipher.iv - , l = e.subjectPrivateKey - , h = parseInt(a.split("-")[1], 10) / 8 - , f = c.pbkdf2Sync(i, n, r, h) - , d = s.createDecipheriv(a, f, u) - , p = []; - return p.push(d.update(l)), - p.push(d.final()), - t.concat(p) - }(d = r.EncryptedPrivateKey.decode(d, "der"), i); - case "PRIVATE KEY": - switch (u = (l = r.PrivateKey.decode(d, "der")).algorithm.algorithm.join(".")) { - case "1.2.840.113549.1.1.1": - return r.RSAPrivateKey.decode(l.subjectPrivateKey, "der"); - case "1.2.840.10045.2.1": - return { - curve: l.algorithm.curve, - privateKey: r.ECPrivateKey.decode(l.subjectPrivateKey, "der").privateKey - }; - case "1.2.840.10040.4.1": - return l.algorithm.params.priv_key = r.DSAparam.decode(l.subjectPrivateKey, "der"), - { - type: "dsa", - params: l.algorithm.params - }; - default: - throw new Error("unknown key id " + u) - } - throw new Error("unknown key type " + f); - case "RSA PUBLIC KEY": - return r.RSAPublicKey.decode(d, "der"); - case "RSA PRIVATE KEY": - return r.RSAPrivateKey.decode(d, "der"); - case "DSA PRIVATE KEY": - return { + (n.base = i(551)), + (n.short = i(552)), + (n.mont = i(553)), + (n.edwards = i(554)); + }, + function (e, t, i) { + (function (t) { + function n(e) { + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + var r = i(570), + o = i(582), + a = i(583), + s = i(132), + c = i(202); + function u(e) { + var i; + "object" !== n(e) || t.isBuffer(e) || ((i = e.passphrase), (e = e.key)), + "string" == typeof e && (e = new t(e)); + var u, + l, + h = a(e, i), + f = h.tag, + d = h.data; + switch (f) { + case "CERTIFICATE": + l = r.certificate.decode(d, "der").tbsCertificate + .subjectPublicKeyInfo; + case "PUBLIC KEY": + switch ( + (l || (l = r.PublicKey.decode(d, "der")), + (u = l.algorithm.algorithm.join("."))) + ) { + case "1.2.840.113549.1.1.1": + return r.RSAPublicKey.decode(l.subjectPublicKey.data, "der"); + case "1.2.840.10045.2.1": + return ( + (l.subjectPrivateKey = l.subjectPublicKey), + { + type: "ec", + data: l, + } + ); + case "1.2.840.10040.4.1": + return ( + (l.algorithm.params.pub_key = r.DSAparam.decode( + l.subjectPublicKey.data, + "der" + )), + { type: "dsa", - params: r.DSAPrivateKey.decode(d, "der") - }; - case "EC PRIVATE KEY": + data: l.algorithm.params, + } + ); + default: + throw new Error("unknown key id " + u); + } + throw new Error("unknown key type " + f); + case "ENCRYPTED PRIVATE KEY": + d = (function (e, i) { + var n = e.algorithm.decrypt.kde.kdeparams.salt, + r = parseInt( + e.algorithm.decrypt.kde.kdeparams.iters.toString(), + 10 + ), + a = o[e.algorithm.decrypt.cipher.algo.join(".")], + u = e.algorithm.decrypt.cipher.iv, + l = e.subjectPrivateKey, + h = parseInt(a.split("-")[1], 10) / 8, + f = c.pbkdf2Sync(i, n, r, h), + d = s.createDecipheriv(a, f, u), + p = []; + return p.push(d.update(l)), p.push(d.final()), t.concat(p); + })((d = r.EncryptedPrivateKey.decode(d, "der")), i); + case "PRIVATE KEY": + switch ( + (u = (l = r.PrivateKey.decode(d, "der")).algorithm.algorithm.join( + "." + )) + ) { + case "1.2.840.113549.1.1.1": + return r.RSAPrivateKey.decode(l.subjectPrivateKey, "der"); + case "1.2.840.10045.2.1": return { - curve: (d = r.ECPrivateKey.decode(d, "der")).parameters.value, - privateKey: d.privateKey + curve: l.algorithm.curve, + privateKey: r.ECPrivateKey.decode(l.subjectPrivateKey, "der") + .privateKey, }; - default: - throw new Error("unknown key type " + f) + case "1.2.840.10040.4.1": + return ( + (l.algorithm.params.priv_key = r.DSAparam.decode( + l.subjectPrivateKey, + "der" + )), + { + type: "dsa", + params: l.algorithm.params, + } + ); + default: + throw new Error("unknown key id " + u); } - } - e.exports = u, - u.signature = r.signature - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { - (function(t, n) { - function r(e, i, n, r, o, a, s) { - try { - var c = e[a](s) - , u = c.value - } catch (e) { - return void n(e) - } - c.done ? i(u) : t.resolve(u).then(r, o) - } - function o(e) { - return (o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - e.exports = f; - var a = i(400)("simple-peer") - , s = i(403) - , c = i(1) - , u = i(53) - , l = i(85) - , h = 5e3; - function f(e) { - var i, n, r = this; - if (!(r instanceof f)) - return new f(e); - if (r._id = u(4).toString("hex").slice(0, 7), - r._debug("new peer %o", e), - e = Object.assign({ - allowHalfOpen: false - }, e), - l.Duplex.call(r, e), - r.channelName = e.initiator ? e.channelName || u(20).toString("hex") : null, - r._isChromium = "undefined" != typeof window && !!window.webkitRTCPeerConnection, - r.initiator = e.initiator || false, - r.channelConfig = e.channelConfig || f.channelConfig, - r.config = Object.assign({}, f.config, e.config), - r.constraints = r._transformConstraints(e.constraints || f.constraints), - r.offerConstraints = r._transformConstraints(e.offerConstraints || {}), - r.answerConstraints = r._transformConstraints(e.answerConstraints || {}), - r.sdpTransform = e.sdpTransform || function(e) { - return e - } - , - r.streams = e.streams || (e.stream ? [e.stream] : []), - r.trickle = void 0 === e.trickle || e.trickle, - r.allowHalfTrickle = void 0 !== e.allowHalfTrickle && e.allowHalfTrickle, - r.iceCompleteTimeout = e.iceCompleteTimeout || h, - r.destroyed = false, - r.connected = false, - r.remoteAddress = void 0, - r.remoteFamily = void 0, - r.remotePort = void 0, - r.localAddress = void 0, - r.localPort = void 0, - r._wrtc = e.wrtc && "object" === o(e.wrtc) ? e.wrtc : s(), - !r._wrtc) - throw "undefined" == typeof window ? p("No WebRTC support: Specify `opts.wrtc` option in this environment", "ERR_WEBRTC_SUPPORT") : p("No WebRTC support: Not a supported browser", "ERR_WEBRTC_SUPPORT"); - r._pcReady = false, - r._channelReady = false, - r._iceComplete = false, - r._iceCompleteTimer = null, - r._channel = null, - r._pendingCandidates = [], - r._isNegotiating = !r.initiator, - r._batchedNegotiation = false, - r._queuedNegotiation = false, - r._sendersAwaitingStable = [], - r._senderMap = new Map, - r._firstStable = true, - r._closingInterval = null, - r._remoteTracks = [], - r._remoteStreams = [], - r._chunk = null, - r._cb = null, - r._interval = null, - r._pc = new r._wrtc.RTCPeerConnection(r.config,r.constraints), - (r._isChromium || r._wrtc && r._wrtc.electronDaemon) && (i = r._wrtc.RTCPeerConnection, - (n = r._pc).createOffer = function(e) { - var n = this; - return new t(function(t, r) { - i.prototype.createOffer.call(n, t, r, e) - } - ) - } - , - n.createAnswer = function(e) { - var n = this; - return new t(function(t, r) { - i.prototype.createAnswer.call(n, t, r, e) - } - ) - } - , - n.setLocalDescription = function(e) { - var n = this; - return new t(function(t, r) { - i.prototype.setLocalDescription.call(n, e, t, r) - } - ) - } - , - n.setRemoteDescription = function(e) { - var n = this; - return new t(function(t, r) { - i.prototype.setRemoteDescription.call(n, e, t, r) - } - ) - } - ), - r._isReactNativeWebrtc = "number" == typeof r._pc._peerConnectionId, - r._pc.oniceconnectionstatechange = function() { - r._onIceStateChange() - } - , - r._pc.onicegatheringstatechange = function() { - r._onIceStateChange() - } - , - r._pc.onsignalingstatechange = function() { - r._onSignalingStateChange() - } - , - r._pc.onicecandidate = function(e) { - r._onIceCandidate(e) - } - , - r.initiator ? r._setupData({ - channel: r._pc.createDataChannel(r.channelName, r.channelConfig) - }) : r._pc.ondatachannel = function(e) { - r._setupData(e) - } - , - "addTrack"in r._pc && (r.streams && r.streams.forEach(function(e) { - r.addStream(e) - }), - r._pc.ontrack = function(e) { - r._onTrack(e) - } - ), - r.initiator && r._needsNegotiation(), - r._onFinishBound = function() { - r._onFinish() - } - , - r.once("finish", r._onFinishBound) - } - function d(e) { - return e.replace(/a=ice-options:trickle\s\n/g, "") - } - function p(e, t) { - var i = new Error(e); - return i.code = t, - i - } - function m() {} - c(f, l.Duplex), - f.WEBRTC_SUPPORT = !!s(), - f.config = { - iceServers: [{ - urls: "stun:stun.l.google.com:19302" - }, { - urls: "stun:global.stun.twilio.com:3478?transport=udp" - }] - }, - f.constraints = {}, - f.channelConfig = {}, - Object.defineProperty(f.prototype, "bufferSize", { - get: function() { - return this._channel && this._channel.bufferedAmount || 0 - } - }), - f.prototype.address = function() { + throw new Error("unknown key type " + f); + case "RSA PUBLIC KEY": + return r.RSAPublicKey.decode(d, "der"); + case "RSA PRIVATE KEY": + return r.RSAPrivateKey.decode(d, "der"); + case "DSA PRIVATE KEY": return { - port: this.localPort, - family: "IPv4", - address: this.localAddress - } + type: "dsa", + params: r.DSAPrivateKey.decode(d, "der"), + }; + case "EC PRIVATE KEY": + return { + curve: (d = r.ECPrivateKey.decode(d, "der")).parameters.value, + privateKey: d.privateKey, + }; + default: + throw new Error("unknown key type " + f); } - , - f.prototype.signal = function(e) { - var t = this; - if (t.destroyed) - throw p("cannot signal after peer is destroyed", "ERR_SIGNALING"); - if ("string" == typeof e) - try { - e = JSON.parse(e) - } catch (t) { - e = {} - } - t._debug("signal()"), - e.renegotiate && t.initiator && (t._debug("got request to renegotiate"), - t._needsNegotiation()), - e.candidate && (t._pc.remoteDescription && t._pc.remoteDescription.type ? t._addIceCandidate(e.candidate) : t._pendingCandidates.push(e.candidate)), - e.sdp && t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function() { - t.destroyed || (t._pendingCandidates.forEach(function(e) { - t._addIceCandidate(e) - }), - t._pendingCandidates = [], - "offer" === t._pc.remoteDescription.type && t._createAnswer()) - }).catch(function(e) { - t.destroy(p(e, "ERR_SET_REMOTE_DESCRIPTION")) + } + (e.exports = u), (u.signature = r.signature); + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { + (function (t, n) { + function r(e, i, n, r, o, a, s) { + try { + var c = e[a](s), + u = c.value; + } catch (e) { + return void n(e); + } + c.done ? i(u) : t.resolve(u).then(r, o); + } + function o(e) { + return (o = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + e.exports = f; + var a = i(400)("simple-peer"), + s = i(403), + c = i(1), + u = i(53), + l = i(85), + h = 5e3; + function f(e) { + var i, + n, + r = this; + if (!(r instanceof f)) return new f(e); + if ( + ((r._id = u(4).toString("hex").slice(0, 7)), + r._debug("new peer %o", e), + (e = Object.assign( + { + allowHalfOpen: false, + }, + e + )), + l.Duplex.call(r, e), + (r.channelName = e.initiator + ? e.channelName || u(20).toString("hex") + : null), + (r._isChromium = + "undefined" != typeof window && !!window.webkitRTCPeerConnection), + (r.initiator = e.initiator || false), + (r.channelConfig = e.channelConfig || f.channelConfig), + (r.config = Object.assign({}, f.config, e.config)), + (r.constraints = r._transformConstraints( + e.constraints || f.constraints + )), + (r.offerConstraints = r._transformConstraints( + e.offerConstraints || {} + )), + (r.answerConstraints = r._transformConstraints( + e.answerConstraints || {} + )), + (r.sdpTransform = + e.sdpTransform || + function (e) { + return e; }), - e.sdp || e.candidate || e.renegotiate || t.destroy(p("signal() called with invalid signal data", "ERR_SIGNALING")) - } - , - f.prototype._addIceCandidate = function(e) { - var t = this; + (r.streams = e.streams || (e.stream ? [e.stream] : [])), + (r.trickle = void 0 === e.trickle || e.trickle), + (r.allowHalfTrickle = + void 0 !== e.allowHalfTrickle && e.allowHalfTrickle), + (r.iceCompleteTimeout = e.iceCompleteTimeout || h), + (r.destroyed = false), + (r.connected = false), + (r.remoteAddress = void 0), + (r.remoteFamily = void 0), + (r.remotePort = void 0), + (r.localAddress = void 0), + (r.localPort = void 0), + (r._wrtc = e.wrtc && "object" === o(e.wrtc) ? e.wrtc : s()), + !r._wrtc) + ) + throw "undefined" == typeof window + ? p( + "No WebRTC support: Specify `opts.wrtc` option in this environment", + "ERR_WEBRTC_SUPPORT" + ) + : p( + "No WebRTC support: Not a supported browser", + "ERR_WEBRTC_SUPPORT" + ); + (r._pcReady = false), + (r._channelReady = false), + (r._iceComplete = false), + (r._iceCompleteTimer = null), + (r._channel = null), + (r._pendingCandidates = []), + (r._isNegotiating = !r.initiator), + (r._batchedNegotiation = false), + (r._queuedNegotiation = false), + (r._sendersAwaitingStable = []), + (r._senderMap = new Map()), + (r._firstStable = true), + (r._closingInterval = null), + (r._remoteTracks = []), + (r._remoteStreams = []), + (r._chunk = null), + (r._cb = null), + (r._interval = null), + (r._pc = new r._wrtc.RTCPeerConnection(r.config, r.constraints)), + (r._isChromium || (r._wrtc && r._wrtc.electronDaemon)) && + ((i = r._wrtc.RTCPeerConnection), + ((n = r._pc).createOffer = function (e) { + var n = this; + return new t(function (t, r) { + i.prototype.createOffer.call(n, t, r, e); + }); + }), + (n.createAnswer = function (e) { + var n = this; + return new t(function (t, r) { + i.prototype.createAnswer.call(n, t, r, e); + }); + }), + (n.setLocalDescription = function (e) { + var n = this; + return new t(function (t, r) { + i.prototype.setLocalDescription.call(n, e, t, r); + }); + }), + (n.setRemoteDescription = function (e) { + var n = this; + return new t(function (t, r) { + i.prototype.setRemoteDescription.call(n, e, t, r); + }); + })), + (r._isReactNativeWebrtc = "number" == typeof r._pc._peerConnectionId), + (r._pc.oniceconnectionstatechange = function () { + r._onIceStateChange(); + }), + (r._pc.onicegatheringstatechange = function () { + r._onIceStateChange(); + }), + (r._pc.onsignalingstatechange = function () { + r._onSignalingStateChange(); + }), + (r._pc.onicecandidate = function (e) { + r._onIceCandidate(e); + }), + r.initiator + ? r._setupData({ + channel: r._pc.createDataChannel( + r.channelName, + r.channelConfig + ), + }) + : (r._pc.ondatachannel = function (e) { + r._setupData(e); + }), + "addTrack" in r._pc && + (r.streams && + r.streams.forEach(function (e) { + r.addStream(e); + }), + (r._pc.ontrack = function (e) { + r._onTrack(e); + })), + r.initiator && r._needsNegotiation(), + (r._onFinishBound = function () { + r._onFinish(); + }), + r.once("finish", r._onFinishBound); + } + function d(e) { + return e.replace(/a=ice-options:trickle\s\n/g, ""); + } + function p(e, t) { + var i = new Error(e); + return (i.code = t), i; + } + function m() {} + c(f, l.Duplex), + (f.WEBRTC_SUPPORT = !!s()), + (f.config = { + iceServers: [ + { + urls: "stun:stun.l.google.com:19302", + }, + { + urls: "stun:global.stun.twilio.com:3478?transport=udp", + }, + ], + }), + (f.constraints = {}), + (f.channelConfig = {}), + Object.defineProperty(f.prototype, "bufferSize", { + get: function () { + return (this._channel && this._channel.bufferedAmount) || 0; + }, + }), + (f.prototype.address = function () { + return { + port: this.localPort, + family: "IPv4", + address: this.localAddress, + }; + }), + (f.prototype.signal = function (e) { + var t = this; + if (t.destroyed) + throw p("cannot signal after peer is destroyed", "ERR_SIGNALING"); + if ("string" == typeof e) try { - t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e), m, function(e) { - t.destroy(p(e, "ERR_ADD_ICE_CANDIDATE")) - }) - } catch (e) { - t.destroy(p("error adding candidate: " + e.message, "ERR_ADD_ICE_CANDIDATE")) + e = JSON.parse(e); + } catch (t) { + e = {}; } - } - , - f.prototype.send = function(e) { - this._channel.send(e) - } - , - f.prototype.addStream = function(e) { - var t = this; - t._debug("addStream()"), - e.getTracks().forEach(function(i) { - t.addTrack(i, e) - }) - } - , - f.prototype.addTrack = function(e, t) { - this._debug("addTrack()"); - var i = this._pc.addTrack(e, t) - , n = this._senderMap.get(e) || new Map; - n.set(t, i), - this._senderMap.set(e, n), - this._needsNegotiation() - } - , - f.prototype.replaceTrack = function() { - var e, i = (e = regeneratorRuntime.mark(function e(t, i, n) { + t._debug("signal()"), + e.renegotiate && + t.initiator && + (t._debug("got request to renegotiate"), t._needsNegotiation()), + e.candidate && + (t._pc.remoteDescription && t._pc.remoteDescription.type + ? t._addIceCandidate(e.candidate) + : t._pendingCandidates.push(e.candidate)), + e.sdp && + t._pc + .setRemoteDescription(new t._wrtc.RTCSessionDescription(e)) + .then(function () { + t.destroyed || + (t._pendingCandidates.forEach(function (e) { + t._addIceCandidate(e); + }), + (t._pendingCandidates = []), + "offer" === t._pc.remoteDescription.type && + t._createAnswer()); + }) + .catch(function (e) { + t.destroy(p(e, "ERR_SET_REMOTE_DESCRIPTION")); + }), + e.sdp || + e.candidate || + e.renegotiate || + t.destroy( + p("signal() called with invalid signal data", "ERR_SIGNALING") + ); + }), + (f.prototype._addIceCandidate = function (e) { + var t = this; + try { + t._pc.addIceCandidate( + new t._wrtc.RTCIceCandidate(e), + m, + function (e) { + t.destroy(p(e, "ERR_ADD_ICE_CANDIDATE")); + } + ); + } catch (e) { + t.destroy( + p("error adding candidate: " + e.message, "ERR_ADD_ICE_CANDIDATE") + ); + } + }), + (f.prototype.send = function (e) { + this._channel.send(e); + }), + (f.prototype.addStream = function (e) { + var t = this; + t._debug("addStream()"), + e.getTracks().forEach(function (i) { + t.addTrack(i, e); + }); + }), + (f.prototype.addTrack = function (e, t) { + this._debug("addTrack()"); + var i = this._pc.addTrack(e, t), + n = this._senderMap.get(e) || new Map(); + n.set(t, i), this._senderMap.set(e, n), this._needsNegotiation(); + }), + (f.prototype.replaceTrack = (function () { + var e, + i = + ((e = regeneratorRuntime.mark(function e(t, i, n) { var r, o, a; - return regeneratorRuntime.wrap(function(e) { - for (; ; ) - switch (e.prev = e.next) { + return regeneratorRuntime.wrap( + function (e) { + for (;;) + switch ((e.prev = e.next)) { case 0: - if ((r = this)._debug("replaceTrack()"), - o = r._senderMap.get(t), - (a = o ? o.get(n) : null) || r.destroy(new Error("Cannot replace track that was never added.")), + if ( + ((r = this)._debug("replaceTrack()"), + (o = r._senderMap.get(t)), + (a = o ? o.get(n) : null) || + r.destroy( + new Error( + "Cannot replace track that was never added." + ) + ), i && r._senderMap.set(i, o), - null == a.replaceTrack) { - e.next = 11; - break - } - return e.next = 9, - a.replaceTrack(i); - case 9: - e.next = 12; + null == a.replaceTrack) + ) { + e.next = 11; break; + } + return (e.next = 9), a.replaceTrack(i); + case 9: + e.next = 12; + break; case 11: - r.destroy(p("replaceTrack is not supported in this browser", "ERR_UNSUPPORTED_REPLACETRACK")); + r.destroy( + p( + "replaceTrack is not supported in this browser", + "ERR_UNSUPPORTED_REPLACETRACK" + ) + ); case 12: case "end": - return e.stop() - } - }, e, this) - }), - function() { - var i = this - , n = arguments; - return new t(function(t, o) { - var a = e.apply(i, n); - function s(e) { - r(a, t, o, s, c, "next", e) - } - function c(e) { - r(a, t, o, s, c, "throw", e) - } - s(void 0) - } - ) - } + return e.stop(); + } + }, + e, + this + ); + })), + function () { + var i = this, + n = arguments; + return new t(function (t, o) { + var a = e.apply(i, n); + function s(e) { + r(a, t, o, s, c, "next", e); + } + function c(e) { + r(a, t, o, s, c, "throw", e); + } + s(void 0); + }); + }); + return function (e, t, n) { + return i.apply(this, arguments); + }; + })()), + (f.prototype.removeTrack = function (e, t) { + this._debug("removeSender()"); + var i = this._senderMap.get(e), + n = i ? i.get(t) : null; + n || + this.destroy( + new Error("Cannot remove track that was never added.") ); - return function(e, t, n) { - return i.apply(this, arguments) + try { + this._pc.removeTrack(n); + } catch (e) { + "NS_ERROR_UNEXPECTED" === e.name + ? this._sendersAwaitingStable.push(n) + : this.destroy(e); + } + }), + (f.prototype.removeStream = function (e) { + var t = this; + t._debug("removeSenders()"), + e.getTracks().forEach(function (i) { + t.removeTrack(i, e); + }); + }), + (f.prototype._needsNegotiation = function () { + var e = this; + e._debug("_needsNegotiation"), + e._batchedNegotiation || + ((e._batchedNegotiation = true), + setTimeout(function () { + (e._batchedNegotiation = false), + e._debug("starting batched negotiation"), + e.negotiate(); + }, 0)); + }), + (f.prototype.negotiate = function () { + this.initiator + ? this._isNegotiating + ? ((this._queuedNegotiation = true), + this._debug("already negotiating, queueing")) + : (this._debug("start negotiation"), this._createOffer()) + : this._isNegotiating || + (this._debug("requesting negotiation from initiator"), + this.emit("signal", { + renegotiate: true, + })), + (this._isNegotiating = true); + }), + (f.prototype.destroy = function (e) { + this._destroy(e, function () {}); + }), + (f.prototype._destroy = function (e, t) { + if (!this.destroyed) { + if ( + (this._debug("destroy (error: %s)", e && (e.message || e)), + (this.readable = this.writable = false), + this._readableState.ended || this.push(null), + this._writableState.finished || this.end(), + (this.destroyed = true), + (this.connected = false), + (this._pcReady = false), + (this._channelReady = false), + (this._remoteTracks = null), + (this._remoteStreams = null), + (this._senderMap = null), + clearInterval(this._closingInterval), + (this._closingInterval = null), + clearInterval(this._interval), + (this._interval = null), + (this._chunk = null), + (this._cb = null), + this._onFinishBound && + this.removeListener("finish", this._onFinishBound), + (this._onFinishBound = null), + this._channel) + ) { + try { + this._channel.close(); + } catch (e) {} + (this._channel.onmessage = null), + (this._channel.onopen = null), + (this._channel.onclose = null), + (this._channel.onerror = null); } - }(), - f.prototype.removeTrack = function(e, t) { - this._debug("removeSender()"); - var i = this._senderMap.get(e) - , n = i ? i.get(t) : null; - n || this.destroy(new Error("Cannot remove track that was never added.")); + if (this._pc) { + try { + this._pc.close(); + } catch (e) {} + (this._pc.oniceconnectionstatechange = null), + (this._pc.onicegatheringstatechange = null), + (this._pc.onsignalingstatechange = null), + (this._pc.onicecandidate = null), + "addTrack" in this._pc && (this._pc.ontrack = null), + (this._pc.ondatachannel = null); + } + (this._pc = null), + (this._channel = null), + e && this.emit("error", e), + this.emit("close"), + t(); + } + }), + (f.prototype._setupData = function (e) { + var t = this; + if (!e.channel) + return t.destroy( + p( + "Data channel event is missing `channel` property", + "ERR_DATA_CHANNEL" + ) + ); + (t._channel = e.channel), + (t._channel.binaryType = "arraybuffer"), + "number" == typeof t._channel.bufferedAmountLowThreshold && + (t._channel.bufferedAmountLowThreshold = 65536), + (t.channelName = t._channel.label), + (t._channel.onmessage = function (e) { + t._onChannelMessage(e); + }), + (t._channel.onbufferedamountlow = function () { + t._onChannelBufferedAmountLow(); + }), + (t._channel.onopen = function () { + t._onChannelOpen(); + }), + (t._channel.onclose = function () { + t._onChannelClose(); + }), + (t._channel.onerror = function (e) { + t.destroy(p(e, "ERR_DATA_CHANNEL")); + }); + var i = false; + t._closingInterval = setInterval(function () { + t._channel && "closing" === t._channel.readyState + ? (i && t._onChannelClose(), (i = true)) + : (i = false); + }, 5e3); + }), + (f.prototype._read = function () {}), + (f.prototype._write = function (e, t, i) { + if (this.destroyed) + return i( + p("cannot write after peer is destroyed", "ERR_DATA_CHANNEL") + ); + if (this.connected) { try { - this._pc.removeTrack(n) + this.send(e); } catch (e) { - "NS_ERROR_UNEXPECTED" === e.name ? this._sendersAwaitingStable.push(n) : this.destroy(e) + return this.destroy(p(e, "ERR_DATA_CHANNEL")); } - } - , - f.prototype.removeStream = function(e) { - var t = this; - t._debug("removeSenders()"), - e.getTracks().forEach(function(i) { - t.removeTrack(i, e) - }) - } - , - f.prototype._needsNegotiation = function() { - var e = this; - e._debug("_needsNegotiation"), - e._batchedNegotiation || (e._batchedNegotiation = true, - setTimeout(function() { - e._batchedNegotiation = false, - e._debug("starting batched negotiation"), - e.negotiate() - }, 0)) - } - , - f.prototype.negotiate = function() { - this.initiator ? this._isNegotiating ? (this._queuedNegotiation = true, - this._debug("already negotiating, queueing")) : (this._debug("start negotiation"), - this._createOffer()) : this._isNegotiating || (this._debug("requesting negotiation from initiator"), - this.emit("signal", { - renegotiate: true - })), - this._isNegotiating = true - } - , - f.prototype.destroy = function(e) { - this._destroy(e, function() {}) - } - , - f.prototype._destroy = function(e, t) { - if (!this.destroyed) { - if (this._debug("destroy (error: %s)", e && (e.message || e)), - this.readable = this.writable = false, - this._readableState.ended || this.push(null), - this._writableState.finished || this.end(), - this.destroyed = true, - this.connected = false, - this._pcReady = false, - this._channelReady = false, - this._remoteTracks = null, - this._remoteStreams = null, - this._senderMap = null, - clearInterval(this._closingInterval), - this._closingInterval = null, - clearInterval(this._interval), - this._interval = null, - this._chunk = null, - this._cb = null, - this._onFinishBound && this.removeListener("finish", this._onFinishBound), - this._onFinishBound = null, - this._channel) { - try { - this._channel.close() - } catch (e) {} - this._channel.onmessage = null, - this._channel.onopen = null, - this._channel.onclose = null, - this._channel.onerror = null - } - if (this._pc) { - try { - this._pc.close() - } catch (e) {} - this._pc.oniceconnectionstatechange = null, - this._pc.onicegatheringstatechange = null, - this._pc.onsignalingstatechange = null, - this._pc.onicecandidate = null, - "addTrack"in this._pc && (this._pc.ontrack = null), - this._pc.ondatachannel = null - } - this._pc = null, - this._channel = null, - e && this.emit("error", e), - this.emit("close"), - t() - } - } - , - f.prototype._setupData = function(e) { - var t = this; - if (!e.channel) - return t.destroy(p("Data channel event is missing `channel` property", "ERR_DATA_CHANNEL")); - t._channel = e.channel, - t._channel.binaryType = "arraybuffer", - "number" == typeof t._channel.bufferedAmountLowThreshold && (t._channel.bufferedAmountLowThreshold = 65536), - t.channelName = t._channel.label, - t._channel.onmessage = function(e) { - t._onChannelMessage(e) - } - , - t._channel.onbufferedamountlow = function() { - t._onChannelBufferedAmountLow() - } - , - t._channel.onopen = function() { - t._onChannelOpen() - } - , - t._channel.onclose = function() { - t._onChannelClose() - } - , - t._channel.onerror = function(e) { - t.destroy(p(e, "ERR_DATA_CHANNEL")) - } - ; - var i = false; - t._closingInterval = setInterval(function() { - t._channel && "closing" === t._channel.readyState ? (i && t._onChannelClose(), - i = true) : i = false - }, 5e3) - } - , - f.prototype._read = function() {} - , - f.prototype._write = function(e, t, i) { - if (this.destroyed) - return i(p("cannot write after peer is destroyed", "ERR_DATA_CHANNEL")); - if (this.connected) { - try { - this.send(e) - } catch (e) { - return this.destroy(p(e, "ERR_DATA_CHANNEL")) - } - this._channel.bufferedAmount > 65536 ? (this._debug("start backpressure: bufferedAmount %d", this._channel.bufferedAmount), - this._cb = i) : i(null) - } else - this._debug("write before connect"), - this._chunk = e, - this._cb = i - } - , - f.prototype._onFinish = function() { - var e = this; - function t() { - setTimeout(function() { - e.destroy() - }, 1e3) - } - e.destroyed || (e.connected ? t() : e.once("connect", t)) - } - , - f.prototype._startIceCompleteTimeout = function() { - a("started iceComplete timeout"); - var e = this; - e.destroyed || e._iceCompleteTimer || (e._iceCompleteTimer = setTimeout(function() { - e._iceComplete || (e._iceComplete = true, + this._channel.bufferedAmount > 65536 + ? (this._debug( + "start backpressure: bufferedAmount %d", + this._channel.bufferedAmount + ), + (this._cb = i)) + : i(null); + } else + this._debug("write before connect"), + (this._chunk = e), + (this._cb = i); + }), + (f.prototype._onFinish = function () { + var e = this; + function t() { + setTimeout(function () { + e.destroy(); + }, 1e3); + } + e.destroyed || (e.connected ? t() : e.once("connect", t)); + }), + (f.prototype._startIceCompleteTimeout = function () { + a("started iceComplete timeout"); + var e = this; + e.destroyed || + e._iceCompleteTimer || + (e._iceCompleteTimer = setTimeout(function () { + e._iceComplete || + ((e._iceComplete = true), e.emit("iceTimeout"), - e.emit("_iceComplete")) - }, this.iceCompleteTimeout)) - } - , - f.prototype._createOffer = function() { - var e = this; - e.destroyed || e._pc.createOffer(e.offerConstraints).then(function(t) { + e.emit("_iceComplete")); + }, this.iceCompleteTimeout)); + }), + (f.prototype._createOffer = function () { + var e = this; + e.destroyed || + e._pc + .createOffer(e.offerConstraints) + .then(function (t) { function i() { - if (!e.destroyed) { - var i = e._pc.localDescription || t; - e._debug("signal"), - e.emit("signal", { - type: i.type, - sdp: i.sdp - }) - } + if (!e.destroyed) { + var i = e._pc.localDescription || t; + e._debug("signal"), + e.emit("signal", { + type: i.type, + sdp: i.sdp, + }); + } } - e.destroyed || (e.trickle || e.allowHalfTrickle || (t.sdp = d(t.sdp)), - t.sdp = e.sdpTransform(t.sdp), - e._pc.setLocalDescription(t).then(function() { - if (e._debug("createOffer success"), - e.destroyed) + e.destroyed || + (e.trickle || e.allowHalfTrickle || (t.sdp = d(t.sdp)), + (t.sdp = e.sdpTransform(t.sdp)), + e._pc + .setLocalDescription(t) + .then(function () { + if ((e._debug("createOffer success"), e.destroyed)) return; - e.trickle || e._iceComplete ? i() : e.once("_iceComplete", i) - }).catch(function(t) { - e.destroy(p(t, "ERR_SET_LOCAL_DESCRIPTION")) - })) - }).catch(function(t) { - e.destroy(p(t, "ERR_CREATE_OFFER")) - }) - } - , - f.prototype._createAnswer = function() { - var e = this; - e.destroyed || e._pc.createAnswer(e.answerConstraints).then(function(t) { + e.trickle || e._iceComplete + ? i() + : e.once("_iceComplete", i); + }) + .catch(function (t) { + e.destroy(p(t, "ERR_SET_LOCAL_DESCRIPTION")); + })); + }) + .catch(function (t) { + e.destroy(p(t, "ERR_CREATE_OFFER")); + }); + }), + (f.prototype._createAnswer = function () { + var e = this; + e.destroyed || + e._pc + .createAnswer(e.answerConstraints) + .then(function (t) { function i() { - if (!e.destroyed) { - var i = e._pc.localDescription || t; - e._debug("signal"), - e.emit("signal", { - type: i.type, - sdp: i.sdp - }) - } + if (!e.destroyed) { + var i = e._pc.localDescription || t; + e._debug("signal"), + e.emit("signal", { + type: i.type, + sdp: i.sdp, + }); + } } - e.destroyed || (e.trickle || e.allowHalfTrickle || (t.sdp = d(t.sdp)), - t.sdp = e.sdpTransform(t.sdp), - e._pc.setLocalDescription(t).then(function() { - if (e.destroyed) - return; - e.trickle || e._iceComplete ? i() : e.once("_iceComplete", i) - }).catch(function(t) { - e.destroy(p(t, "ERR_SET_LOCAL_DESCRIPTION")) - })) - }).catch(function(t) { - e.destroy(p(t, "ERR_CREATE_ANSWER")) - }) - } - , - f.prototype._onIceStateChange = function() { - if (!this.destroyed) { - var e = this._pc.iceConnectionState - , t = this._pc.iceGatheringState; - this._debug("iceStateChange (connection: %s) (gathering: %s)", e, t), - this.emit("iceStateChange", e, t), - "connected" !== e && "completed" !== e || (this._pcReady = true, - this._maybeReady()), - "failed" === e && this.destroy(p("Ice connection failed.", "ERR_ICE_CONNECTION_FAILURE")), - "closed" === e && this.destroy(new Error("Ice connection closed.")) - } - } - , - f.prototype.getStats = function(e) { - var t = this; - 0 === t._pc.getStats.length ? t._pc.getStats().then(function(t) { - var i = []; - t.forEach(function(e) { - i.push(e) - }), - e(null, i) - }, function(t) { - e(t) - }) : t._isReactNativeWebrtc ? t._pc.getStats(null, function(t) { - var i = []; - t.forEach(function(e) { - i.push(e) - }), - e(null, i) - }, function(t) { - e(t) - }) : t._pc.getStats.length > 0 ? t._pc.getStats(function(i) { - if (!t.destroyed) { + e.destroyed || + (e.trickle || e.allowHalfTrickle || (t.sdp = d(t.sdp)), + (t.sdp = e.sdpTransform(t.sdp)), + e._pc + .setLocalDescription(t) + .then(function () { + if (e.destroyed) return; + e.trickle || e._iceComplete + ? i() + : e.once("_iceComplete", i); + }) + .catch(function (t) { + e.destroy(p(t, "ERR_SET_LOCAL_DESCRIPTION")); + })); + }) + .catch(function (t) { + e.destroy(p(t, "ERR_CREATE_ANSWER")); + }); + }), + (f.prototype._onIceStateChange = function () { + if (!this.destroyed) { + var e = this._pc.iceConnectionState, + t = this._pc.iceGatheringState; + this._debug( + "iceStateChange (connection: %s) (gathering: %s)", + e, + t + ), + this.emit("iceStateChange", e, t), + ("connected" !== e && "completed" !== e) || + ((this._pcReady = true), this._maybeReady()), + "failed" === e && + this.destroy( + p("Ice connection failed.", "ERR_ICE_CONNECTION_FAILURE") + ), + "closed" === e && + this.destroy(new Error("Ice connection closed.")); + } + }), + (f.prototype.getStats = function (e) { + var t = this; + 0 === t._pc.getStats.length + ? t._pc.getStats().then( + function (t) { + var i = []; + t.forEach(function (e) { + i.push(e); + }), + e(null, i); + }, + function (t) { + e(t); + } + ) + : t._isReactNativeWebrtc + ? t._pc.getStats( + null, + function (t) { + var i = []; + t.forEach(function (e) { + i.push(e); + }), + e(null, i); + }, + function (t) { + e(t); + } + ) + : t._pc.getStats.length > 0 + ? t._pc.getStats( + function (i) { + if (!t.destroyed) { var n = []; - i.result().forEach(function(e) { - var t = {}; - e.names().forEach(function(i) { - t[i] = e.stat(i) - }), - t.id = e.id, - t.type = e.type, - t.timestamp = e.timestamp, - n.push(t) + i.result().forEach(function (e) { + var t = {}; + e.names().forEach(function (i) { + t[i] = e.stat(i); + }), + (t.id = e.id), + (t.type = e.type), + (t.timestamp = e.timestamp), + n.push(t); }), - e(null, n) + e(null, n); + } + }, + function (t) { + e(t); } - }, function(t) { - e(t) - }) : e(null, []) - } - , - f.prototype._maybeReady = function() { - var e = this; - e._debug("maybeReady pc %s channel %s", e._pcReady, e._channelReady), - !e.connected && !e._connecting && e._pcReady && e._channelReady && (e._connecting = true, - function t() { - e.destroyed || e.getStats(function(i, n) { + ) + : e(null, []); + }), + (f.prototype._maybeReady = function () { + var e = this; + e._debug("maybeReady pc %s channel %s", e._pcReady, e._channelReady), + !e.connected && + !e._connecting && + e._pcReady && + e._channelReady && + ((e._connecting = true), + (function t() { + e.destroyed || + e.getStats(function (i, n) { if (!e.destroyed) { - i && (n = []); - var r = {} - , o = {} - , a = {} - , s = false; - if (n.forEach(function(e) { - "remotecandidate" !== e.type && "remote-candidate" !== e.type || (r[e.id] = e), - "localcandidate" !== e.type && "local-candidate" !== e.type || (o[e.id] = e), - "candidatepair" !== e.type && "candidate-pair" !== e.type || (a[e.id] = e) + i && (n = []); + var r = {}, + o = {}, + a = {}, + s = false; + if ( + (n.forEach(function (e) { + ("remotecandidate" !== e.type && + "remote-candidate" !== e.type) || + (r[e.id] = e), + ("localcandidate" !== e.type && + "local-candidate" !== e.type) || + (o[e.id] = e), + ("candidatepair" !== e.type && + "candidate-pair" !== e.type) || + (a[e.id] = e); }), - n.forEach(function(e) { - "transport" === e.type && e.selectedCandidatePairId && u(a[e.selectedCandidatePairId]), - ("googCandidatePair" === e.type && "true" === e.googActiveConnection || ("candidatepair" === e.type || "candidate-pair" === e.type) && e.selected) && u(e) + n.forEach(function (e) { + "transport" === e.type && + e.selectedCandidatePairId && + u(a[e.selectedCandidatePairId]), + (("googCandidatePair" === e.type && + "true" === e.googActiveConnection) || + (("candidatepair" === e.type || + "candidate-pair" === e.type) && + e.selected)) && + u(e); }), - s || Object.keys(a).length && !Object.keys(o).length) { - if (e._connecting = false, - e.connected = true, - e._chunk) { - try { - e.send(e._chunk) - } catch (i) { - return e.destroy(p(i, "ERR_DATA_CHANNEL")) - } - e._chunk = null, - e._debug('sent chunk from "write before connect"'); - var c = e._cb; - e._cb = null, - c(null) - } - "number" != typeof e._channel.bufferedAmountLowThreshold && (e._interval = setInterval(function() { - e._onInterval() - }, 150), - e._interval.unref && e._interval.unref()), - e._debug("connect"), - e.emit("connect") - } else - setTimeout(t, 100) + s || (Object.keys(a).length && !Object.keys(o).length)) + ) { + if ( + ((e._connecting = false), + (e.connected = true), + e._chunk) + ) { + try { + e.send(e._chunk); + } catch (i) { + return e.destroy(p(i, "ERR_DATA_CHANNEL")); + } + (e._chunk = null), + e._debug('sent chunk from "write before connect"'); + var c = e._cb; + (e._cb = null), c(null); + } + "number" != + typeof e._channel.bufferedAmountLowThreshold && + ((e._interval = setInterval(function () { + e._onInterval(); + }, 150)), + e._interval.unref && e._interval.unref()), + e._debug("connect"), + e.emit("connect"); + } else setTimeout(t, 100); } function u(t) { - s = true; - var i = o[t.localCandidateId]; - i && i.ip ? (e.localAddress = i.ip, - e.localPort = Number(i.port)) : i && i.ipAddress ? (e.localAddress = i.ipAddress, - e.localPort = Number(i.portNumber)) : "string" == typeof t.googLocalAddress && (i = t.googLocalAddress.split(":"), - e.localAddress = i[0], - e.localPort = Number(i[1])); - var n = r[t.remoteCandidateId]; - n && n.ip ? (e.remoteAddress = n.ip, - e.remotePort = Number(n.port)) : n && n.ipAddress ? (e.remoteAddress = n.ipAddress, - e.remotePort = Number(n.portNumber)) : "string" == typeof t.googRemoteAddress && (n = t.googRemoteAddress.split(":"), - e.remoteAddress = n[0], - e.remotePort = Number(n[1])), - e.remoteFamily = "IPv4", - e._debug("connect local: %s:%s remote: %s:%s", e.localAddress, e.localPort, e.remoteAddress, e.remotePort) + s = true; + var i = o[t.localCandidateId]; + i && i.ip + ? ((e.localAddress = i.ip), + (e.localPort = Number(i.port))) + : i && i.ipAddress + ? ((e.localAddress = i.ipAddress), + (e.localPort = Number(i.portNumber))) + : "string" == typeof t.googLocalAddress && + ((i = t.googLocalAddress.split(":")), + (e.localAddress = i[0]), + (e.localPort = Number(i[1]))); + var n = r[t.remoteCandidateId]; + n && n.ip + ? ((e.remoteAddress = n.ip), + (e.remotePort = Number(n.port))) + : n && n.ipAddress + ? ((e.remoteAddress = n.ipAddress), + (e.remotePort = Number(n.portNumber))) + : "string" == typeof t.googRemoteAddress && + ((n = t.googRemoteAddress.split(":")), + (e.remoteAddress = n[0]), + (e.remotePort = Number(n[1]))), + (e.remoteFamily = "IPv4"), + e._debug( + "connect local: %s:%s remote: %s:%s", + e.localAddress, + e.localPort, + e.remoteAddress, + e.remotePort + ); } - }) - }()) - } - , - f.prototype._onInterval = function() { - !this._cb || !this._channel || this._channel.bufferedAmount > 65536 || this._onChannelBufferedAmountLow() - } - , - f.prototype._onSignalingStateChange = function() { - var e = this; - e.destroyed || ("stable" !== e._pc.signalingState || e._firstStable || (e._isNegotiating = false, - e._debug("flushing sender queue", e._sendersAwaitingStable), - e._sendersAwaitingStable.forEach(function(t) { - e._pc.removeTrack(t), - e._queuedNegotiation = true - }), - e._sendersAwaitingStable = [], - e._queuedNegotiation && (e._debug("flushing negotiation queue"), - e._queuedNegotiation = false, - e._needsNegotiation()), - e._debug("negotiate"), - e.emit("negotiate")), - e._firstStable = false, + }); + })()); + }), + (f.prototype._onInterval = function () { + !this._cb || + !this._channel || + this._channel.bufferedAmount > 65536 || + this._onChannelBufferedAmountLow(); + }), + (f.prototype._onSignalingStateChange = function () { + var e = this; + e.destroyed || + ("stable" !== e._pc.signalingState || + e._firstStable || + ((e._isNegotiating = false), + e._debug("flushing sender queue", e._sendersAwaitingStable), + e._sendersAwaitingStable.forEach(function (t) { + e._pc.removeTrack(t), (e._queuedNegotiation = true); + }), + (e._sendersAwaitingStable = []), + e._queuedNegotiation && + (e._debug("flushing negotiation queue"), + (e._queuedNegotiation = false), + e._needsNegotiation()), + e._debug("negotiate"), + e.emit("negotiate")), + (e._firstStable = false), e._debug("signalingStateChange %s", e._pc.signalingState), - e.emit("signalingStateChange", e._pc.signalingState)) - } - , - f.prototype._onIceCandidate = function(e) { - this.destroyed || (e.candidate && this.trickle ? this.emit("signal", { - candidate: { + e.emit("signalingStateChange", e._pc.signalingState)); + }), + (f.prototype._onIceCandidate = function (e) { + this.destroyed || + (e.candidate && this.trickle + ? this.emit("signal", { + candidate: { candidate: e.candidate.candidate, sdpMLineIndex: e.candidate.sdpMLineIndex, - sdpMid: e.candidate.sdpMid - } - }) : e.candidate || this._iceComplete || (this._iceComplete = true, - this.emit("_iceComplete")), - e.candidate && this._startIceCompleteTimeout()) - } - , - f.prototype._onChannelMessage = function(e) { - if (!this.destroyed) { - var t = e.data; - t instanceof ArrayBuffer && (t = n.from(t)), - this.push(t) - } - } - , - f.prototype._onChannelBufferedAmountLow = function() { - if (!this.destroyed && this._cb) { - this._debug("ending backpressure: bufferedAmount %d", this._channel.bufferedAmount); - var e = this._cb; - this._cb = null, - e(null) - } - } - , - f.prototype._onChannelOpen = function() { - this.connected || this.destroyed || (this._debug("on channel open"), - this._channelReady = true, - this._maybeReady()) - } - , - f.prototype._onChannelClose = function() { - this.destroyed || (this._debug("on channel close"), - this.destroy()) - } - , - f.prototype._onTrack = function(e) { - var t = this; - t.destroyed || e.streams.forEach(function(i) { - t._debug("on track"), + sdpMid: e.candidate.sdpMid, + }, + }) + : e.candidate || + this._iceComplete || + ((this._iceComplete = true), this.emit("_iceComplete")), + e.candidate && this._startIceCompleteTimeout()); + }), + (f.prototype._onChannelMessage = function (e) { + if (!this.destroyed) { + var t = e.data; + t instanceof ArrayBuffer && (t = n.from(t)), this.push(t); + } + }), + (f.prototype._onChannelBufferedAmountLow = function () { + if (!this.destroyed && this._cb) { + this._debug( + "ending backpressure: bufferedAmount %d", + this._channel.bufferedAmount + ); + var e = this._cb; + (this._cb = null), e(null); + } + }), + (f.prototype._onChannelOpen = function () { + this.connected || + this.destroyed || + (this._debug("on channel open"), + (this._channelReady = true), + this._maybeReady()); + }), + (f.prototype._onChannelClose = function () { + this.destroyed || (this._debug("on channel close"), this.destroy()); + }), + (f.prototype._onTrack = function (e) { + var t = this; + t.destroyed || + e.streams.forEach(function (i) { + t._debug("on track"), t.emit("track", e.track, i), t._remoteTracks.push({ - track: e.track, - stream: i + track: e.track, + stream: i, }), - t._remoteStreams.some(function(e) { - return e.id === i.id - }) || (t._remoteStreams.push(i), - setTimeout(function() { - t.emit("stream", i) - }, 0)) - }) - } - , - f.prototype.setConstraints = function(e) { - this.initiator ? this.offerConstraints = this._transformConstraints(e) : this.answerConstraints = this._transformConstraints(e) - } - , - f.prototype._debug = function() { - var e = [].slice.call(arguments); - e[0] = "[" + this._id + "] " + e[0], - a.apply(null, e) - } - , - f.prototype._transformConstraints = function(e) { - if (0 === Object.keys(e).length) - return e; - if ((e.mandatory || e.optional) && !this._isChromium) { - var t = Object.assign({}, e.optional, e.mandatory); - return void 0 !== t.OfferToReceiveVideo && (t.offerToReceiveVideo = t.OfferToReceiveVideo, + t._remoteStreams.some(function (e) { + return e.id === i.id; + }) || + (t._remoteStreams.push(i), + setTimeout(function () { + t.emit("stream", i); + }, 0)); + }); + }), + (f.prototype.setConstraints = function (e) { + this.initiator + ? (this.offerConstraints = this._transformConstraints(e)) + : (this.answerConstraints = this._transformConstraints(e)); + }), + (f.prototype._debug = function () { + var e = [].slice.call(arguments); + (e[0] = "[" + this._id + "] " + e[0]), a.apply(null, e); + }), + (f.prototype._transformConstraints = function (e) { + if (0 === Object.keys(e).length) return e; + if ((e.mandatory || e.optional) && !this._isChromium) { + var t = Object.assign({}, e.optional, e.mandatory); + return ( + void 0 !== t.OfferToReceiveVideo && + ((t.offerToReceiveVideo = t.OfferToReceiveVideo), delete t.OfferToReceiveVideo), - void 0 !== t.OfferToReceiveAudio && (t.offerToReceiveAudio = t.OfferToReceiveAudio, + void 0 !== t.OfferToReceiveAudio && + ((t.offerToReceiveAudio = t.OfferToReceiveAudio), delete t.OfferToReceiveAudio), - t - } - return e.mandatory || e.optional || !this._isChromium ? e : (void 0 !== e.offerToReceiveVideo && (e.OfferToReceiveVideo = e.offerToReceiveVideo, - delete e.offerToReceiveVideo), - void 0 !== e.offerToReceiveAudio && (e.OfferToReceiveAudio = e.offerToReceiveAudio, - delete e.offerToReceiveAudio), - { - mandatory: e - }) - } - } - ).call(this, i(41), i(9).Buffer) -} -, function(e, t, i) { + t + ); + } + return e.mandatory || e.optional || !this._isChromium + ? e + : (void 0 !== e.offerToReceiveVideo && + ((e.OfferToReceiveVideo = e.offerToReceiveVideo), + delete e.offerToReceiveVideo), + void 0 !== e.offerToReceiveAudio && + ((e.OfferToReceiveAudio = e.offerToReceiveAudio), + delete e.offerToReceiveAudio), + { + mandatory: e, + }); + }); + }.call(this, i(41), i(9).Buffer)); + }, + function (e, t, i) { "use strict"; var targetBlockAdjacentPos = i(7); function r(e) { - var t = 2 - , i = 256 - , n = 10 - , r = document.createElement("canvas"); - r.width = window.innerWidth - 16, - r.height = i * t; - var o = r.getContext("2d"); - o.imageSmoothingEnabled = false; - var a = document.getElementById("chat"); - a.appendChild(r), - a.style.width = r.width + "px", - a.style.height = i * t + "px"; - var s = "" - , c = 0 - , l = [] - , h = 0 - , f = { - player: null, - isOpen: false, - open: function() { - n = 20, - c = performance.now(), - f.isOpen = true, - i = 512, - f.resize(), - document.addEventListener("keypress", f.keypress, false), - document.addEventListener("keydown", f.keydown, false), - document.exitPointerLock(), - e.inputs.state.active = false - }, - close: function() { - document.removeEventListener("keypress", f.keypress), - document.removeEventListener("keydown", f.keydown); - var t = document.getElementById("noa-container"); - setTimeout(function() { - null != t && t.requestPointerLock() - }, 200), - n = 10, - f.isOpen = false, - i = 256, - f.resize(), - e.inputs.state.active = true - }, - sendMessage: function(msgStr) { - if (msgStr.indexOf("/") == 0 || msgStr.indexOf("#") == 0) { - var retMessage = 'Unknown command. Type "/help" for help.'; + var t = 2, + i = 256, + n = 10, + r = document.createElement("canvas"); + (r.width = window.innerWidth - 16), (r.height = i * t); + var o = r.getContext("2d"); + o.imageSmoothingEnabled = false; + var a = document.getElementById("chat"); + a.appendChild(r), + (a.style.width = r.width + "px"), + (a.style.height = i * t + "px"); + var s = "", + c = 0, + l = [], + h = 0, + f = { + player: null, + isOpen: false, + open: function () { + (n = 20), + (c = performance.now()), + (f.isOpen = true), + (i = 512), + f.resize(), + document.addEventListener("keypress", f.keypress, false), + document.addEventListener("keydown", f.keydown, false), + document.exitPointerLock(), + (e.inputs.state.active = false); + }, + close: function () { + document.removeEventListener("keypress", f.keypress), + document.removeEventListener("keydown", f.keydown); + var t = document.getElementById("noa-container"); + setTimeout(function () { + null != t && t.requestPointerLock(); + }, 200), + (n = 10), + (f.isOpen = false), + (i = 256), + f.resize(), + (e.inputs.state.active = true); + }, + sendMessage: function (msgStr) { + if (msgStr.indexOf("/") == 0 || msgStr.indexOf("#") == 0) { + var retMessage = 'Unknown command. Type "/help" for help.'; - if (0 == msgStr.indexOf("/ban") && (retMessage = "Command disabled."), - 0 == msgStr.indexOf("/banip") && (retMessage = "Command disabled."), - 0 == msgStr.indexOf("/say") && (retMessage = "Command disabled."), - 0 == msgStr.indexOf("/deop") && (retMessage = "Command disabled."), - 0 == msgStr.indexOf("/kick")) { - var i = msgStr.substr(msgStr.indexOf("kick") + 5).trim(); - retMessage = u.getInstance().kickPlayer(i) - } + if ( + (0 == msgStr.indexOf("/ban") && + (retMessage = "Command disabled."), + 0 == msgStr.indexOf("/banip") && + (retMessage = "Command disabled."), + 0 == msgStr.indexOf("/say") && + (retMessage = "Command disabled."), + 0 == msgStr.indexOf("/deop") && + (retMessage = "Command disabled."), + 0 == msgStr.indexOf("/kick")) + ) { + var i = msgStr.substr(msgStr.indexOf("kick") + 5).trim(); + retMessage = u.getInstance().kickPlayer(i); + } - if(msgStr.indexOf("/op") == 0) { - retMessage = "Command disabled."; - } + if (msgStr.indexOf("/op") == 0) { + retMessage = "Command disabled."; + } - if (0 == msgStr.indexOf("/tp")) { - var playerToStr = msgStr.substr(msgStr.indexOf("tp") + 3).trim(); // message w/o "/tp " + if (0 == msgStr.indexOf("/tp")) { + var playerToStr = msgStr + .substr(msgStr.indexOf("tp") + 3) + .trim(); // message w/o "/tp " - retMessage = u.getInstance().teleportToPlayer(playerToStr) - } + retMessage = u.getInstance().teleportToPlayer(playerToStr); + } - return 0 == msgStr.indexOf("/unban") && (retMessage = "Command disabled."), - 0 == msgStr.indexOf("/setspawn") && (retMessage = u.getInstance().setSpawn()), - 0 == msgStr.indexOf("/solid") && (retMessage = "Command disabled."), - 0 == msgStr.indexOf("/list") && (retMessage = JSON.stringify(u.getInstance().getPlayerNames()).slice(1, -1)), - 0 == msgStr.indexOf("/help") && (retMessage = "Available Commands: /list /kick /tp /setspawn /help"), - l.push({ - type: "local", - message: retMessage, - from: "", - timestamp: (new Date).getTime() - }), - void (l.length > 20 && l.shift()) - } - null != f.player && f.player.sendMessage(msgStr) - }, - keydown: function(e) { - if (e.shiftKey && 55 == e.keyCode && (e.preventDefault(), - f.keypress(e)), - 13 == e.keyCode) { - var t = s.trim(); - return t.length > 0 && f.sendMessage(t), - s = "", - void f.redraw() - } - 8 == e.keyCode && s.length > 0 && (s = s.substring(0, s.length - 1)), - f.redraw() - }, - keypress: function(e) { - if (!(performance.now() < c + 100)) { - var t = e.key - , i = 10; - null != f.player && (i = f.player.state.name.length), - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\\\"#%/()=+?[]{}<>@|$;".indexOf(t) >= 0 && s.length < 64 - (i + 2) && (s += t), - f.redraw() - } - }, - update: function(e) { - for (l = function(e) { - for (var t = e.concat(), i = 0; i < t.length; ++i) - for (var n = i + 1; n < t.length; ++n) - JSON.stringify(t[i]) === JSON.stringify(t[n]) && t.splice(n--, 1); - return t - }(l.concat(e)); l.length > 20; ) - l.shift(); - f.redraw() - }, - tick: function() { - var e = (new Date).getTime(); - if (!(e < h + 1e3)) { - for (var t = false, i = 0; i < l.length; i++) { - l[i].timestamp + 1e4 < e && (l[i].isOld = true, - t = true) - } - t && f.redraw(), - h = e - } - }, - redraw: function() { - o.clearRect(0, 0, r.width, i * t), - o.font = 14 * t + "px Minecraft, sans-serif", - o.textBaseline = "alphabetic", - o.textAlign = "left"; - var e = 4 * t - , a = 2 * t; - if (f.isOpen) { - o.fillStyle = "rgba(0,0,0,0.6)", - o.fillRect(0, i * t - 25 * t, r.width, i * t); - var c = i * t - 7 * t; - o.fillStyle = "rgb(63,63,63)", - o.fillText("> " + s, e + a, c + a), - o.fillStyle = "rgb(255,255,255)", - o.fillText("> " + s, e, c) - } - e = 0; - for (var u = 1, h = l.length - 1; h >= 0; h--) - if (!l[h].isOld || f.isOpen) { - if (u > n) - break; - var d = "" - , p = "rgb(255,255,255)"; - switch (l[h].type) { - case "message": - d = l[h].from + ": " + l[h].message; - break; - case "left": - d = l[h].from + " left the game", - p = "rgb(255,255,64)"; - break; - case "joined": - d = l[h].from + " joined the game", - p = "rgb(255,255,64)"; - break; - case "local": - d = l[h].message, - p = "rgb(255,255,64)" - } - var m = i * t - 25 * t - 15 * u++ * t; - o.fillStyle = "rgb(63,63,63)", - o.fillText(d, e + a, m + a), - o.fillStyle = p, - o.fillText(d, e, m) - } - }, - resize: function() { - t = 2, - window.innerHeight < 600 && (t = 1), - r.width = window.innerWidth - 16, - r.height = i * t, - a.style.width = r.width + "px", - a.style.height = i * t + "px", - o.imageSmoothingEnabled = false, - f.redraw() + return ( + 0 == msgStr.indexOf("/unban") && + (retMessage = "Command disabled."), + 0 == msgStr.indexOf("/setspawn") && + (retMessage = u.getInstance().setSpawn()), + 0 == msgStr.indexOf("/solid") && + (retMessage = "Command disabled."), + 0 == msgStr.indexOf("/list") && + (retMessage = JSON.stringify( + u.getInstance().getPlayerNames() + ).slice(1, -1)), + 0 == msgStr.indexOf("/help") && + (retMessage = + "Available Commands: /list /kick /tp /setspawn /help"), + l.push({ + type: "local", + message: retMessage, + from: "", + timestamp: new Date().getTime(), + }), + void (l.length > 20 && l.shift()) + ); } + null != f.player && f.player.sendMessage(msgStr); + }, + keydown: function (e) { + if ( + (e.shiftKey && + 55 == e.keyCode && + (e.preventDefault(), f.keypress(e)), + 13 == e.keyCode) + ) { + var t = s.trim(); + return ( + t.length > 0 && f.sendMessage(t), (s = ""), void f.redraw() + ); + } + 8 == e.keyCode && + s.length > 0 && + (s = s.substring(0, s.length - 1)), + f.redraw(); + }, + keypress: function (e) { + if (!(performance.now() < c + 100)) { + var t = e.key, + i = 10; + null != f.player && (i = f.player.state.name.length), + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\\\"#%/()=+?[]{}<>@|$;".indexOf( + t + ) >= 0 && + s.length < 64 - (i + 2) && + (s += t), + f.redraw(); + } + }, + update: function (e) { + for ( + l = (function (e) { + for (var t = e.concat(), i = 0; i < t.length; ++i) + for (var n = i + 1; n < t.length; ++n) + JSON.stringify(t[i]) === JSON.stringify(t[n]) && + t.splice(n--, 1); + return t; + })(l.concat(e)); + l.length > 20; + + ) + l.shift(); + f.redraw(); + }, + tick: function () { + var e = new Date().getTime(); + if (!(e < h + 1e3)) { + for (var t = false, i = 0; i < l.length; i++) { + l[i].timestamp + 1e4 < e && ((l[i].isOld = true), (t = true)); + } + t && f.redraw(), (h = e); + } + }, + redraw: function () { + o.clearRect(0, 0, r.width, i * t), + (o.font = 14 * t + "px Minecraft, sans-serif"), + (o.textBaseline = "alphabetic"), + (o.textAlign = "left"); + var e = 4 * t, + a = 2 * t; + if (f.isOpen) { + (o.fillStyle = "rgba(0,0,0,0.6)"), + o.fillRect(0, i * t - 25 * t, r.width, i * t); + var c = i * t - 7 * t; + (o.fillStyle = "rgb(63,63,63)"), + o.fillText("> " + s, e + a, c + a), + (o.fillStyle = "rgb(255,255,255)"), + o.fillText("> " + s, e, c); + } + e = 0; + for (var u = 1, h = l.length - 1; h >= 0; h--) + if (!l[h].isOld || f.isOpen) { + if (u > n) break; + var d = "", + p = "rgb(255,255,255)"; + switch (l[h].type) { + case "message": + d = l[h].from + ": " + l[h].message; + break; + case "left": + (d = l[h].from + " left the game"), (p = "rgb(255,255,64)"); + break; + case "joined": + (d = l[h].from + " joined the game"), + (p = "rgb(255,255,64)"); + break; + case "local": + (d = l[h].message), (p = "rgb(255,255,64)"); + } + var m = i * t - 25 * t - 15 * u++ * t; + (o.fillStyle = "rgb(63,63,63)"), + o.fillText(d, e + a, m + a), + (o.fillStyle = p), + o.fillText(d, e, m); + } + }, + resize: function () { + (t = 2), + window.innerHeight < 600 && (t = 1), + (r.width = window.innerWidth - 16), + (r.height = i * t), + (a.style.width = r.width + "px"), + (a.style.height = i * t + "px"), + (o.imageSmoothingEnabled = false), + f.redraw(); + }, }; - return f.resize(), - f + return f.resize(), f; } - var blockInHand = function(e) { - return r(e) + var blockInHand = function (e) { + return r(e); }; function isLocalPlayer(e) { - return function(e) { - if (Array.isArray(e)) { - for (var t = 0, i = new Array(e.length); t < e.length; t++) - i[t] = e[t]; - return i - } - }(e) || function(e) { - if (Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e)) - return Array.from(e) - }(e) || function() { - throw new TypeError("Invalid attempt to spread non-iterable instance") - }() + return ( + (function (e) { + if (Array.isArray(e)) { + for (var t = 0, i = new Array(e.length); t < e.length; t++) + i[t] = e[t]; + return i; + } + })(e) || + (function (e) { + if ( + Symbol.iterator in Object(e) || + "[object Arguments]" === Object.prototype.toString.call(e) + ) + return Array.from(e); + })(e) || + (function () { + throw new TypeError( + "Invalid attempt to spread non-iterable instance" + ); + })() + ); } function s(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n.enumerable = n.enumerable || false, - n.configurable = true, - "value"in n && (n.writable = true), - Object.defineProperty(e, n.key, n) - } + for (var i = 0; i < t.length; i++) { + var n = t[i]; + (n.enumerable = n.enumerable || false), + (n.configurable = true), + "value" in n && (n.writable = true), + Object.defineProperty(e, n.key, n); + } } window.BABYLON = i(411); - var c = function() { + var c = (function () { function e() { - return function(e, t) { - if (!(e instanceof t)) - throw new TypeError("Cannot call a class as a function") - }(this, e), + return ( + (function (e, t) { + if (!(e instanceof t)) + throw new TypeError("Cannot call a class as a function"); + })(this, e), e.instance || (e.instance = this), e.instance + ); } var t, r, c; - return t = e, - c = [{ - key: "getInstance", - value: function() { - return void 0 === e.instance && (e.instance = new e), - e.instance - } - }], - (r = [{ - key: "initialize", - value: function(e) { + return ( + (t = e), + (c = [ + { + key: "getInstance", + value: function () { + return ( + void 0 === e.instance && (e.instance = new e()), e.instance + ); + }, + }, + ]), + (r = [ + { + key: "initialize", + value: function (e) { var t = this; - this.playerSpawned = false, - this.worldGenerated = false, - this.worldInitialized = false, - this.client = null, - this.network = e.network; - var r = i(412) - , s = i(495); + (this.playerSpawned = false), + (this.worldGenerated = false), + (this.worldInitialized = false), + (this.client = null), + (this.network = e.network); + var r = i(412), + s = i(495); this.soundPlayer = i(497)(); - var c, u = i(499), l = i(500), h = i(501), f = i(502), d = i(503), p = i(194), m = u(), g = 32, _ = 128, v = 30, y = null, b = false, E = false, T = this; + var c, + u = i(499), + l = i(500), + h = i(501), + f = i(502), + d = i(503), + p = i(194), + m = u(), + g = 32, + _ = 128, + v = 30, + y = null, + b = false, + E = false, + T = this; if (Math.round(e.seed) == e.seed) { - this.player = void 0 !== e.player ? e.player : null; - var A = new URLSearchParams(window.location.search) - , x = A.get("size"); - if ("small" == x && (_ = 128), + this.player = void 0 !== e.player ? e.player : null; + var A = new URLSearchParams(window.location.search), + x = A.get("size"); + if ( + ("small" == x && (_ = 128), "normal" == x && (_ = 256), "huge" == x && (_ = 512), - targetBlockAdjacentPos.default.getInstance().gameSaved() ? _ = targetBlockAdjacentPos.default.getInstance().getWorldSize() : targetBlockAdjacentPos.default.getInstance().setWorldSize(_), - "undefined" != typeof Worker) { - if (void 0 === S) { - var S = new Worker("assets/js/RandomLevelWorker.js"); - S.postMessage({ - worldSize: _, - seed: e.seed - }), - m.show() - } - S.onmessage = function(e) { - var t = e.data; - m.task = t.string, - m.percent = t.percent, - m.tick(), - null != t.tiles && (y = t.tiles, - T.worldGenerated = true, - null == T.client ? targetBlockAdjacentPos.default.getInstance().gameSaved() ? (T.syncSavedWorld(), - Ee()) : Ee() : T.client && (T.hostInfo ? T.hostInfo.numberOfChangedBlocks <= 0 ? Ee() : T.client.broadcast({ - type: "requestChanges", - from: T.client.state.changedBlocks.length - }) : Ee())) - } - } else - console.log("No worker support."); - var C = .5 * _ - , P = 8e3 - , R = 24e3 - , M = 8e3 - , O = 24e3 - , w = 3e3 - , I = 12e3 - , D = { - chunkSize: g, - chunkAddDistance: 7, - chunkRemoveDistance: 8, - blockTestDistance: 6, - playerStart: [C + .5, 48, C + .5], - playerHeight: 1.8, - texturePath: "assets/textures/", - useAO: false, - stickyPointerLock: true + targetBlockAdjacentPos.default.getInstance().gameSaved() + ? (_ = targetBlockAdjacentPos.default + .getInstance() + .getWorldSize()) + : targetBlockAdjacentPos.default + .getInstance() + .setWorldSize(_), + "undefined" != typeof Worker) + ) { + if (void 0 === S) { + var S = new Worker("assets/js/RandomLevelWorker.js"); + S.postMessage({ + worldSize: _, + seed: e.seed, + }), + m.show(); + } + S.onmessage = function (e) { + var t = e.data; + (m.task = t.string), + (m.percent = t.percent), + m.tick(), + null != t.tiles && + ((y = t.tiles), + (T.worldGenerated = true), + null == T.client + ? targetBlockAdjacentPos.default + .getInstance() + .gameSaved() + ? (T.syncSavedWorld(), Ee()) + : Ee() + : T.client && + (T.hostInfo + ? T.hostInfo.numberOfChangedBlocks <= 0 + ? Ee() + : T.client.broadcast({ + type: "requestChanges", + from: T.client.state.changedBlocks.length, + }) + : Ee())); }; - this.lightDepths = new Array(_); - for (var L = 0; L < _; L++) - this.lightDepths[L] = new Array(_); - var F = { - music: false, - sound: true, - invert: false, - fps: false, - drawDistance: 0, - forward: "W", - left: "A", - backward: "S", - right: "D", - jump: "", - build: "B", - chat: "T", - fog: "F", - saveLoc: "", - loadLoc: "R", - username: "" - } - , B = JSON.parse(localStorage.getItem("settings")); - null == B || B.back || (F = B); - var N = { - forward: F.forward, - left: F.left, - backward: F.backward, - right: F.right, - fire: "", - "mid-fire": "", - "alt-fire": "", - jump: F.jump, - build: F.build, - chat: F.chat, - fog: F.fog, - saveLoc: F.saveLoc, - loadLoc: F.loadLoc, - spawnSteve: "G" + } else console.log("No worker support."); + var C = 0.5 * _, + P = 8e3, + R = 24e3, + M = 8e3, + O = 24e3, + w = 3e3, + I = 12e3, + D = { + chunkSize: g, + chunkAddDistance: 7, + chunkRemoveDistance: 8, + blockTestDistance: 6, + playerStart: [C + 0.5, 48, C + 0.5], + playerHeight: 1.8, + texturePath: "assets/textures/", + useAO: false, + stickyPointerLock: true, }; - D.bindings = N, - D.settings = F, - this.soundPlayer.musicOn = F.music, - this.soundPlayer.soundOn = F.sound; - var k = r(D); - k.setPaused(true), - k.worldSize = _, - k.worldHeight = 64, - k.waterLevel = v, - k.time = 0, - k.rendering._camera.minZ = .1, - k.rendering._camera.fov = 70 * Math.PI / 180, - k.rendering._scene.fogColor = new BABYLON.Color3(.9,.95,1), - k.rendering._scene.fogMode = BABYLON.Scene.FOGMODE_EXP2, - k.rendering._scene.fogDensity = .002, - k.rendering._scene.clearColor = k.rendering._scene.fogColor, - this.hostInfo ? k.hostInfo = this.hostInfo : k.hostInfo = { - maxPlayers: this.player.network.maxPlayers - }; - var U = l(k) - , V = h(U) - , G = f(k, e.singlePlayer) - , z = p(k); - this.addParticles = s(k); - var j = U.currentId - 1; - k.on("tick", function(e) { - if (k.time += e, - null != T.player && null == c.player && (c.player = T.player), - c && c.tick(), - z && z.isOpen && z.tick(), - W && (W.material.diffuseTexture.uOffset = 2e-7 * k.time), - T.steveArray) - for (var t = 0; t < T.steveArray.length; t++) { - var i = T.steveArray[t]; - if (i.tick(e), - i.state.shouldRemove) - i.remove(), - T.steveArray.splice(t, 1)[0] = null - } - !function() { - if (k.time > he + le) { - var e = fe.slice(); - fe.length = 0; - for (var t = 0; t < e.length; t++) { - var i, n = e[t]; - (i = n).func.apply(i, isLocalPlayer(n.args)) - } - he = k.time - } - if (k.time > me + pe) { - var e = ge.slice(); - ge.length = 0; - for (var t = 0; t < e.length; t++) { - var r, n = e[t]; - (r = n).func.apply(r, isLocalPlayer(n.args)) - } - me = k.time - } - }() - }), - this.getBrightness = function(e, t, i) { - return e < 0 || t < 0 || i < 0 || e >= _ - 1 || i >= _ - 1 ? t >= v ? 1 : .6 : t >= T.lightDepths[e][i] + 1 ? 1 : .6 - } - , - k.getBrightness = this.getBrightness, - this.addBlockCheckLit = function(e, t, i) { - var n = this.lightDepths[e][i]; - if (t >= n) { - if (Math.floor(t / g) != Math.floor(n / g)) { - var r = k.world.getBlockID(e, n, i); - k.world.setBlockID(0, e, n, i), - k.world.setBlockID(r, e, n, i) - } - this.lightDepths[e][i] = t - } - } - , - this.removeBlockCheckLit = function(x, y, z) { // returns light value at position of removed block - // lowest block exposed to sunlight at pos - var lightDepth = this.lightDepths[x][z]; - - if (y >= lightDepth) { - - // loop thru blocks under y, check if transparent - for (var blockID = 0, lowestLit = y; (0 == blockID || blockID == this.redflowerID || blockID == this.yellowflowerID || blockID == this.bushID || blockID == this.redmushroomID || blockID == this.brownmushroomID || blockID == this.glassID || blockID == this.leafID || blockID == this.emptySpongeID) && lowestLit >= 0; ) { - lowestLit -= 1; - blockID = k.world.getBlockID(x, lowestLit, z); - } - - if(Math.floor(lowestLit / g) != Math.floor(lightDepth / g)) { - k.world.setBlockID(0, x, lowestLit, z); - k.world.setBlockID(blockID, x, lowestLit, z); - } - - // update lightDepths to lowest Y position lit - this.lightDepths[x][z] = lowestLit; - - return 1 - } - - return .6 - }; - - var H = function e() { - var t = false; - if (T.hostInfo && null != T.hostInfo.spawnPoint && null != T.hostInfo.spawnPoint && (t = true), - t) - k.entities.setPosition(k.playerEntity, T.hostInfo.spawnPoint.x, T.hostInfo.spawnPoint.y, T.hostInfo.spawnPoint.z); - else { - for (var i = 0, n = 0; i < v && n < 50; ) { - var r = Math.floor(C - _ / 4 + Math.random() * (_ / 2)) + .5 - , o = Math.floor(C - _ / 4 + Math.random() * (_ / 2)) + .5 - , a = k.pick([r, 100, o], [0, -1, 0], 1e3, true); - null != a && (i = a.position[1]), - ++n - } - if (n >= 50) - return void setTimeout(e, 100); - k.entities.setPosition(k.playerEntity, a.position[0], a.position[1] + 1, a.position[2]) - } - m.hide(), - T.updateResetPosition(), - T.playerSpawned = true, - setTimeout(function() { - k.entities.setPhysicsInterpolation(k.playerEntity, true) - }, 100) - } - , W = i(504)(k) - , X = (i(505)(k), - i(506)(k, g), - i(507)) - , Y = i(508) - , K = ["grass", "dirt", "grass_dirt", "stone", "wood", "rock", "bedrock", "sand", "gravel", "tree_top", "tree_side", "lava", "rock_gold", "rock_bronze", "rock_coal", "gold", "sponge", "color0", "color1", "color2", "color3", "color4", "color5", "color6", "color7", "color8", "color9", "color10", "color11", "color12", "color13", "color14", "color15"] - , Q = ["leaves_opaque", "glass", "water", "bush", "red_flower", "yellow_flower", "red_mushroom", "brown_mushroom"]; - for (L = 0; L < K.length; L++) { - var q = null; - "lava" == (Z = K[L]) && (q = [.4, 0, 0, .95]), - k.registry.registerMaterial(Z, q, Z + ".png") - } - for (L = 0; L < Q.length; L++) { - var Z; - q = null; - "water" == (Z = Q[L]) && (q = [0, 0, .4, .85]); - k.registry.registerMaterial(Z, q, Z + ".png", true) - } - k.registry.registerMaterial("empty_sponge", [0, 0, 0, 0], null, true); - var J = [] - , $ = [null, null, null, 8, 5, 6, 15, 16]; - for (L = 3; L < 8; L++) { - var ee = Q[L] - , te = X(k); - (oe = k.rendering.makeStandardMaterial(ee + "Mat")).diffuseTexture = new BABYLON.Texture("assets/textures/" + ee + ".png",scene,true,true,1), - oe.diffuseTexture.hasAlpha = true, - oe.diffuseTexture.getAlphaFromRGB = true, - te.material = oe; - var ie = $[L] - , ne = k.registry.registerBlock(ie, { - material: [null, ee, null, null, null, null], - opaque: false, - blockMesh: te + this.lightDepths = new Array(_); + for (var L = 0; L < _; L++) + this.lightDepths[L] = new Array(_); + var F = { + music: false, + sound: true, + invert: false, + fps: false, + drawDistance: 0, + forward: "W", + left: "A", + backward: "S", + right: "D", + jump: "", + build: "B", + chat: "T", + fog: "F", + saveLoc: "", + loadLoc: "R", + username: "", + }, + B = JSON.parse(localStorage.getItem("settings")); + null == B || B.back || (F = B); + var N = { + forward: F.forward, + left: F.left, + backward: F.backward, + right: F.right, + fire: "", + "mid-fire": "", + "alt-fire": "", + jump: F.jump, + build: F.build, + chat: F.chat, + fog: F.fog, + saveLoc: F.saveLoc, + loadLoc: F.loadLoc, + spawnSteve: "G", + }; + (D.bindings = N), + (D.settings = F), + (this.soundPlayer.musicOn = F.music), + (this.soundPlayer.soundOn = F.sound); + var k = r(D); + k.setPaused(true), + (k.worldSize = _), + (k.worldHeight = 64), + (k.waterLevel = v), + (k.time = 0), + (k.rendering._camera.minZ = 0.1), + (k.rendering._camera.fov = (70 * Math.PI) / 180), + (k.rendering._scene.fogColor = new BABYLON.Color3( + 0.9, + 0.95, + 1 + )), + (k.rendering._scene.fogMode = BABYLON.Scene.FOGMODE_EXP2), + (k.rendering._scene.fogDensity = 0.002), + (k.rendering._scene.clearColor = + k.rendering._scene.fogColor), + this.hostInfo + ? (k.hostInfo = this.hostInfo) + : (k.hostInfo = { + maxPlayers: this.player.network.maxPlayers, }); - J.push(ne) - } - this.grassID = k.registry.registerBlock(1, { - material: ["grass", "dirt", "grass_dirt"] + var U = l(k), + V = h(U), + G = f(k, e.singlePlayer), + z = p(k); + this.addParticles = s(k); + var j = U.currentId - 1; + k.on("tick", function (e) { + if ( + ((k.time += e), + null != T.player && + null == c.player && + (c.player = T.player), + c && c.tick(), + z && z.isOpen && z.tick(), + W && (W.material.diffuseTexture.uOffset = 2e-7 * k.time), + T.steveArray) + ) + for (var t = 0; t < T.steveArray.length; t++) { + var i = T.steveArray[t]; + if ((i.tick(e), i.state.shouldRemove)) + i.remove(), (T.steveArray.splice(t, 1)[0] = null); + } + !(function () { + if (k.time > he + le) { + var e = fe.slice(); + fe.length = 0; + for (var t = 0; t < e.length; t++) { + var i, + n = e[t]; + (i = n).func.apply(i, isLocalPlayer(n.args)); + } + he = k.time; + } + if (k.time > me + pe) { + var e = ge.slice(); + ge.length = 0; + for (var t = 0; t < e.length; t++) { + var r, + n = e[t]; + (r = n).func.apply(r, isLocalPlayer(n.args)); + } + me = k.time; + } + })(); + }), + (this.getBrightness = function (e, t, i) { + return e < 0 || t < 0 || i < 0 || e >= _ - 1 || i >= _ - 1 + ? t >= v + ? 1 + : 0.6 + : t >= T.lightDepths[e][i] + 1 + ? 1 + : 0.6; }), - this.stoneID = k.registry.registerBlock(2, { - material: "stone" + (k.getBrightness = this.getBrightness), + (this.addBlockCheckLit = function (e, t, i) { + var n = this.lightDepths[e][i]; + if (t >= n) { + if (Math.floor(t / g) != Math.floor(n / g)) { + var r = k.world.getBlockID(e, n, i); + k.world.setBlockID(0, e, n, i), + k.world.setBlockID(r, e, n, i); + } + this.lightDepths[e][i] = t; + } }), - this.dirtID = k.registry.registerBlock(3, { - material: "dirt" - }), - this.woodID = k.registry.registerBlock(4, { - material: "wood" - }), - this.redflowerID = J[1], - this.yellowflowerID = J[2], - this.waterID = k.registry.registerBlock(7, { - material: "water", - opaque: false, - solid: false, - fluid: true, - fluidDensity: 1, - viscosity: .5 - }), - this.bushID = J[0], - this.rockID = k.registry.registerBlock(9, { - material: "rock" - }), - this.bedrockID = k.registry.registerBlock(10, { - material: "bedrock" - }), - this.sandID = k.registry.registerBlock(11, { - material: "sand" - }), - this.gravelID = k.registry.registerBlock(12, { - material: "gravel" - }), - this.treeID = k.registry.registerBlock(13, { - material: ["tree_top", "tree_top", "tree_side"] - }), - this.leafID = k.registry.registerBlock(14, { - material: "leaves_opaque", - opaque: false - }), - this.redmushroomID = J[3], - this.brownmushroomID = J[4], - this.lavaID = k.registry.registerBlock(17, { - material: "lava", - solid: false, - fluid: true, - fluidDensity: 1, - viscosity: .5 - }), - this.rockGoldID = k.registry.registerBlock(18, { - material: "rock_gold" - }), - this.rockbronzeID = k.registry.registerBlock(19, { - material: "rock_bronze" - }), - this.rockcoalID = k.registry.registerBlock(20, { - material: "rock_coal" - }), - this.goldID = k.registry.registerBlock(21, { - material: "gold" - }), - this.spongeID = k.registry.registerBlock(22, { - material: "sponge" - }), - this.glassID = k.registry.registerBlock(23, { - material: "glass", - opaque: false - }), - this.colorBlockArray = []; - for (L = 0; L < 16; L++) { - var re = k.registry.registerBlock(24 + L, { - material: "color" + L - }); - this.colorBlockArray.push(re) - } - this.emptySpongeID = k.registry.registerBlock(40, { - material: "empty_sponge", - opaque: false, - solid: false + (this.removeBlockCheckLit = function (x, y, z) { + // returns light value at position of removed block + // lowest block exposed to sunlight at pos + var lightDepth = this.lightDepths[x][z]; + + if (y >= lightDepth) { + // loop thru blocks under y, check if transparent + for ( + var blockID = 0, lowestLit = y; + (0 == blockID || + blockID == this.redflowerID || + blockID == this.yellowflowerID || + blockID == this.bushID || + blockID == this.redmushroomID || + blockID == this.brownmushroomID || + blockID == this.glassID || + blockID == this.leafID || + blockID == this.emptySpongeID) && + lowestLit >= 0; + + ) { + lowestLit -= 1; + blockID = k.world.getBlockID(x, lowestLit, z); + } + + if ( + Math.floor(lowestLit / g) != + Math.floor(lightDepth / g) + ) { + k.world.setBlockID(0, x, lowestLit, z); + k.world.setBlockID(blockID, x, lowestLit, z); + } + + // update lightDepths to lowest Y position lit + this.lightDepths[x][z] = lowestLit; + + return 1; + } + + return 0.6; }); - var oe; - te = Y(k); - (oe = k.rendering.makeStandardMaterial(ee + "Mat")).diffuseTexture = k.waterTexture, - oe.alpha = .85, - oe.useAlphaFromDiffuseTexture = true, - oe.backFaceCulling = false, - oe.disableLighting = true, - oe.emissiveColor = new BABYLON.Color3(.6,.6,.6), - te.material = oe, - this.waterHackID = k.registry.registerBlock(41, { - material: [null, "water", null, null, null, null], + + var H = function e() { + var t = false; + if ( + (T.hostInfo && + null != T.hostInfo.spawnPoint && + null != T.hostInfo.spawnPoint && + (t = true), + t) + ) + k.entities.setPosition( + k.playerEntity, + T.hostInfo.spawnPoint.x, + T.hostInfo.spawnPoint.y, + T.hostInfo.spawnPoint.z + ); + else { + for (var i = 0, n = 0; i < v && n < 50; ) { + var r = + Math.floor(C - _ / 4 + Math.random() * (_ / 2)) + + 0.5, + o = + Math.floor(C - _ / 4 + Math.random() * (_ / 2)) + + 0.5, + a = k.pick([r, 100, o], [0, -1, 0], 1e3, true); + null != a && (i = a.position[1]), ++n; + } + if (n >= 50) return void setTimeout(e, 100); + k.entities.setPosition( + k.playerEntity, + a.position[0], + a.position[1] + 1, + a.position[2] + ); + } + m.hide(), + T.updateResetPosition(), + (T.playerSpawned = true), + setTimeout(function () { + k.entities.setPhysicsInterpolation( + k.playerEntity, + true + ); + }, 100); + }, + W = i(504)(k), + X = (i(505)(k), i(506)(k, g), i(507)), + Y = i(508), + K = [ + "grass", + "dirt", + "grass_dirt", + "stone", + "wood", + "rock", + "bedrock", + "sand", + "gravel", + "tree_top", + "tree_side", + "lava", + "rock_gold", + "rock_bronze", + "rock_coal", + "gold", + "sponge", + "color0", + "color1", + "color2", + "color3", + "color4", + "color5", + "color6", + "color7", + "color8", + "color9", + "color10", + "color11", + "color12", + "color13", + "color14", + "color15", + ], + Q = [ + "leaves_opaque", + "glass", + "water", + "bush", + "red_flower", + "yellow_flower", + "red_mushroom", + "brown_mushroom", + ]; + for (L = 0; L < K.length; L++) { + var q = null; + "lava" == (Z = K[L]) && (q = [0.4, 0, 0, 0.95]), + k.registry.registerMaterial(Z, q, Z + ".png"); + } + for (L = 0; L < Q.length; L++) { + var Z; + q = null; + "water" == (Z = Q[L]) && (q = [0, 0, 0.4, 0.85]); + k.registry.registerMaterial(Z, q, Z + ".png", true); + } + k.registry.registerMaterial( + "empty_sponge", + [0, 0, 0, 0], + null, + true + ); + var J = [], + $ = [null, null, null, 8, 5, 6, 15, 16]; + for (L = 3; L < 8; L++) { + var ee = Q[L], + te = X(k); + ((oe = k.rendering.makeStandardMaterial( + ee + "Mat" + )).diffuseTexture = new BABYLON.Texture( + "assets/textures/" + ee + ".png", + scene, + true, + true, + 1 + )), + (oe.diffuseTexture.hasAlpha = true), + (oe.diffuseTexture.getAlphaFromRGB = true), + (te.material = oe); + var ie = $[L], + ne = k.registry.registerBlock(ie, { + material: [null, ee, null, null, null, null], opaque: false, - solid: false, - fluid: true, - fluidDensity: 1, - viscosity: .5, - blockMesh: te - }), - this.soundArray = [null, { + blockMesh: te, + }); + J.push(ne); + } + (this.grassID = k.registry.registerBlock(1, { + material: ["grass", "dirt", "grass_dirt"], + })), + (this.stoneID = k.registry.registerBlock(2, { + material: "stone", + })), + (this.dirtID = k.registry.registerBlock(3, { + material: "dirt", + })), + (this.woodID = k.registry.registerBlock(4, { + material: "wood", + })), + (this.redflowerID = J[1]), + (this.yellowflowerID = J[2]), + (this.waterID = k.registry.registerBlock(7, { + material: "water", + opaque: false, + solid: false, + fluid: true, + fluidDensity: 1, + viscosity: 0.5, + })), + (this.bushID = J[0]), + (this.rockID = k.registry.registerBlock(9, { + material: "rock", + })), + (this.bedrockID = k.registry.registerBlock(10, { + material: "bedrock", + })), + (this.sandID = k.registry.registerBlock(11, { + material: "sand", + })), + (this.gravelID = k.registry.registerBlock(12, { + material: "gravel", + })), + (this.treeID = k.registry.registerBlock(13, { + material: ["tree_top", "tree_top", "tree_side"], + })), + (this.leafID = k.registry.registerBlock(14, { + material: "leaves_opaque", + opaque: false, + })), + (this.redmushroomID = J[3]), + (this.brownmushroomID = J[4]), + (this.lavaID = k.registry.registerBlock(17, { + material: "lava", + solid: false, + fluid: true, + fluidDensity: 1, + viscosity: 0.5, + })), + (this.rockGoldID = k.registry.registerBlock(18, { + material: "rock_gold", + })), + (this.rockbronzeID = k.registry.registerBlock(19, { + material: "rock_bronze", + })), + (this.rockcoalID = k.registry.registerBlock(20, { + material: "rock_coal", + })), + (this.goldID = k.registry.registerBlock(21, { + material: "gold", + })), + (this.spongeID = k.registry.registerBlock(22, { + material: "sponge", + })), + (this.glassID = k.registry.registerBlock(23, { + material: "glass", + opaque: false, + })), + (this.colorBlockArray = []); + for (L = 0; L < 16; L++) { + var re = k.registry.registerBlock(24 + L, { + material: "color" + L, + }); + this.colorBlockArray.push(re); + } + this.emptySpongeID = k.registry.registerBlock(40, { + material: "empty_sponge", + opaque: false, + solid: false, + }); + var oe; + te = Y(k); + ((oe = k.rendering.makeStandardMaterial( + ee + "Mat" + )).diffuseTexture = k.waterTexture), + (oe.alpha = 0.85), + (oe.useAlphaFromDiffuseTexture = true), + (oe.backFaceCulling = false), + (oe.disableLighting = true), + (oe.emissiveColor = new BABYLON.Color3(0.6, 0.6, 0.6)), + (te.material = oe), + (this.waterHackID = k.registry.registerBlock(41, { + material: [null, "water", null, null, null, null], + opaque: false, + solid: false, + fluid: true, + fluidDensity: 1, + viscosity: 0.5, + blockMesh: te, + })), + (this.soundArray = [ + null, + { id: "grass", - volume: .9, - pitch: 1 - }, { + volume: 0.9, + pitch: 1, + }, + { id: "stone", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "grass", - volume: .8, - pitch: 1 - }, { + volume: 0.8, + pitch: 1, + }, + { id: "wood", volume: 1, - pitch: 1 - }, null, null, null, null, { + pitch: 1, + }, + null, + null, + null, + null, + { id: "stone", volume: 1, - pitch: 1 - }, null, { + pitch: 1, + }, + null, + { id: "gravel", - volume: .8, - pitch: 1 - }, { + volume: 0.8, + pitch: 1, + }, + { id: "gravel", - volume: .8, - pitch: 1 - }, { + volume: 0.8, + pitch: 1, + }, + { id: "wood", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "grass", volume: 1, - pitch: .4 - }, null, null, null, { + pitch: 0.4, + }, + null, + null, + null, + { id: "stone", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "stone", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "stone", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "metal", - volume: .7, - pitch: 1 - }, { + volume: 0.7, + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: .9 - }, { + pitch: 0.9, + }, + { id: "metal", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }, { + pitch: 1, + }, + { id: "cloth", volume: 1, - pitch: 1 - }], - this.blockArray = [this.grassID, this.stoneID, this.dirtID, this.woodID, this.redflowerID, this.yellowflowerID, this.waterID, this.bushID, this.rockID, this.bedrockID, this.sandID, this.gravelID, this.treeID, this.leafID, this.redmushroomID, this.brownmushroomID, this.lavaID, this.rockGoldID, this.rockbronzeID, this.rockcoalID, this.goldID, this.spongeID, this.glassID]; - for (L = 0; L < this.colorBlockArray.length; L++) - this.blockArray.push(this.colorBlockArray[L]); - var ae = i(509)(k, this.blockArray); - ae.setBlock(j), - window.addEventListener("beforeunload", function(e) { - !T.playerSpawned || b || E || (e.preventDefault(), - e.returnValue = "") + pitch: 1, + }, + ]), + (this.blockArray = [ + this.grassID, + this.stoneID, + this.dirtID, + this.woodID, + this.redflowerID, + this.yellowflowerID, + this.waterID, + this.bushID, + this.rockID, + this.bedrockID, + this.sandID, + this.gravelID, + this.treeID, + this.leafID, + this.redmushroomID, + this.brownmushroomID, + this.lavaID, + this.rockGoldID, + this.rockbronzeID, + this.rockcoalID, + this.goldID, + this.spongeID, + this.glassID, + ]); + for (L = 0; L < this.colorBlockArray.length; L++) + this.blockArray.push(this.colorBlockArray[L]); + var ae = i(509)(k, this.blockArray); + ae.setBlock(j), + window.addEventListener("beforeunload", function (e) { + !T.playerSpawned || + b || + E || + (e.preventDefault(), (e.returnValue = "")); }), document.addEventListener("mousewheel", Ae, false), document.addEventListener("DOMMouseScroll", Ae, false), - k.inputs.down.on("fire", function() { - if (k.targetedBlock) { - var e = { - targetedBlockBlockID: k.targetedBlock.blockID, - targetedBlockPosition: k.targetedBlock.position, - targetedBlockAdjacentPosition: k.targetedBlock.adjacent, - chosenBlock: j, - addMode: k.addMode - }; - k.addMode && (e.localPlayer = true); - var t = T.handleFireEvent(e); - delete e.localPlayer, - null != T.player && t && T.player.emitFireEvent(e) - } + k.inputs.down.on("fire", function () { + if (k.targetedBlock) { + var e = { + targetedBlockBlockID: k.targetedBlock.blockID, + targetedBlockPosition: k.targetedBlock.position, + targetedBlockAdjacentPosition: + k.targetedBlock.adjacent, + chosenBlock: j, + addMode: k.addMode, + }; + k.addMode && (e.localPlayer = true); + var t = T.handleFireEvent(e); + delete e.localPlayer, + null != T.player && t && T.player.emitFireEvent(e); + } }), - k.inputs.down.on("mid-fire", function() { - if (k.targetedBlock) { - var e = k.targetedBlock.blockID; - if (e == T.rockcoalID || e == T.rockbronzeID || e == T.rockGoldID) - return; - 1 == e && (e = 3), - U.pick(e), - j = e - 1, - ae.setBlock(j) - } + k.inputs.down.on("mid-fire", function () { + if (k.targetedBlock) { + var e = k.targetedBlock.blockID; + if ( + e == T.rockcoalID || + e == T.rockbronzeID || + e == T.rockGoldID + ) + return; + 1 == e && (e = 3), + U.pick(e), + (j = e - 1), + ae.setBlock(j); + } }), - k.inputs.down.on("alt-fire", function() { - k.addMode ? k.addMode = false : (k.addMode = true, - ae.setBlock(j)), + k.inputs.down.on("alt-fire", function () { + k.addMode + ? (k.addMode = false) + : ((k.addMode = true), ae.setBlock(j)), k.resetTargetBlock(), - k.emit("targetBlockChanged", k.targetedBlock) + k.emit("targetBlockChanged", k.targetedBlock); }), - document.addEventListener("keydown", function(e) { + document.addEventListener( + "keydown", + function (e) { var t = e.keyCode; - if (8 == t && e.preventDefault(), - e.ctrlKey && e.preventDefault(), - !z.isOpen && se) - if (se = false, - 27 == t && c.isOpen) - c.close(); - else if (27 == t && (G.isOpen ? G.close() : (G.open(), - V.isOpen && V.close())), - !G.isOpen && (!c || !c.isOpen) && t >= 49 && t <= 57) { - var i = t - 49; - U.setIndex(i), - j = U.currentId - 1, - ae.setBlock(j) - } - }, false), - document.addEventListener("keyup", function(e) { - se = true - }, false); - var se = true; - k.inputs.down.on("build", function(e, t) { - G.isOpen || c.isOpen || V.open() + if ( + (8 == t && e.preventDefault(), + e.ctrlKey && e.preventDefault(), + !z.isOpen && se) + ) + if (((se = false), 27 == t && c.isOpen)) c.close(); + else if ( + (27 == t && + (G.isOpen + ? G.close() + : (G.open(), V.isOpen && V.close())), + !G.isOpen && + (!c || !c.isOpen) && + t >= 49 && + t <= 57) + ) { + var i = t - 49; + U.setIndex(i), + (j = U.currentId - 1), + ae.setBlock(j); + } + }, + false + ), + document.addEventListener( + "keyup", + function (e) { + se = true; + }, + false + ); + var se = true; + k.inputs.down.on("build", function (e, t) { + G.isOpen || c.isOpen || V.open(); + }), + k.inputs.down.on("chat", function (e, t) { + G.isOpen || c.isOpen || (V.isOpen && V.close(), c.open()); }), - k.inputs.down.on("chat", function(e, t) { - G.isOpen || c.isOpen || (V.isOpen && V.close(), - c.open()) + k.inputs.down.on("fog", function (e, t) { + G.isOpen || c.isOpen || ye(); }), - k.inputs.down.on("fog", function(e, t) { - G.isOpen || c.isOpen || ye() + k.inputs.down.on("saveLoc", function (e, t) { + G.isOpen || c.isOpen || T.updateResetPosition(); }), - k.inputs.down.on("saveLoc", function(e, t) { - G.isOpen || c.isOpen || T.updateResetPosition() + k.inputs.down.on("loadLoc", function (e, t) { + G.isOpen || c.isOpen || T.applyResetPosition(); }), - k.inputs.down.on("loadLoc", function(e, t) { - G.isOpen || c.isOpen || T.applyResetPosition() - }), - k.inputs.down.on("spawnSteve", function(e, t) { - G.isOpen || c.isOpen || T.spawnSteve() + k.inputs.down.on("spawnSteve", function (e, t) { + G.isOpen || c.isOpen || T.spawnSteve(); }); - var ce = false; - document.addEventListener("pointerlockchange", function(e) { - var t = false; - c && (t = c.isOpen), - null != document.pointerLockElement || !ce || V.isOpen || t || z.isOpen ? (ce = true, - k.inputs.state.forward = false, - k.inputs.state.backward = false, - k.inputs.state.left = false, - k.inputs.state.right = false, - t && se && c.close()) : G.open() - }, false), - window.addEventListener("resize", function(e) { - G.resize(), + var ce = false; + document.addEventListener( + "pointerlockchange", + function (e) { + var t = false; + c && (t = c.isOpen), + null != document.pointerLockElement || + !ce || + V.isOpen || + t || + z.isOpen + ? ((ce = true), + (k.inputs.state.forward = false), + (k.inputs.state.backward = false), + (k.inputs.state.left = false), + (k.inputs.state.right = false), + t && se && c.close()) + : G.open(); + }, + false + ), + window.addEventListener("resize", function (e) { + G.resize(), m.resize(), z.resize(), U.resize(), c && c.resize(), k.version && k.version.resize(), - V.resize() + V.resize(); }), - k.on("setPreviewBlock", function(e) { - j = e - 1, - ae.setBlock(j) + k.on("setPreviewBlock", function (e) { + (j = e - 1), ae.setBlock(j); }); - var ue = { - position: [D.playerStart[0], D.playerStart[1], D.playerStart[2]], - rotation: [0, 0, 0] + var ue = { + position: [ + D.playerStart[0], + D.playerStart[1], + D.playerStart[2], + ], + rotation: [0, 0, 0], + }; + (this.setPlayerPosition = function (e) { + var t = k.playerEntity; + k.entities.setPhysicsInterpolation(t, false), + k.entities.setPosition(t, e[0], e[1] + 0.5, e[2]), + setTimeout(function () { + k.entities.setPhysicsInterpolation(t, true); + }, 100); + }), + (this.updateResetPosition = function () { + var e = k.playerEntity, + t = k.entities.getPosition(e); + (ue.position[0] = t[0]), + (ue.position[1] = t[1]), + (ue.position[2] = t[2]), + (ue.rotation[0] = 0), + (ue.rotation[1] = + k.rendering._rotationHolder.rotation.y), + (ue.rotation[2] = 0), + T.applyResetPosition(); + }), + (this.applyResetPosition = function () { + k.entities.setPhysicsInterpolation(k.playerEntity, false); + var e = k.playerEntity; + k.entities.setPosition( + e, + ue.position[0], + ue.position[1] + 0.5, + ue.position[2] + ), + (k.rendering._rotationHolder.rotation.x = + ue.rotation[0]), + (k.rendering._rotationHolder.rotation.y = + ue.rotation[1]), + (k.rendering._rotationHolder.rotation.z = + ue.rotation[2]), + setTimeout(function () { + k.entities.setPhysicsInterpolation( + k.playerEntity, + true + ); + }, 100); + }), + (this.steveArray = []), + (this.spawnSteve = function () { + var e = k.entities.getPositionData(k.playerEntity), + t = i(510), + n = e.position[0], + r = e.position[1] + 0.5, + o = e.position[2], + a = t(k, n, r, o); + T.steveArray.push(a); + }); + var le = 250, + he = 0, + fe = [], + de = function (e, t) { + fe.push({ + func: e, + args: t, + }); + }, + pe = 1500, + me = 0, + ge = [], + _e = function (e, t) { + ge.push({ + func: e, + args: t, + }); }; - this.setPlayerPosition = function(e) { - var t = k.playerEntity; - k.entities.setPhysicsInterpolation(t, false), - k.entities.setPosition(t, e[0], e[1] + .5, e[2]), - setTimeout(function() { - k.entities.setPhysicsInterpolation(t, true) - }, 100) + (this.checkWaterBelowAdd = function (e, t, i) { + var n = this.waterID; + this.shouldWaterHaveSurface(e, t, i) && + (n = this.waterHackID), + this.setBlock(n, e, t, i); + var r = k.world.getBlockID(e - 1, t, i), + o = k.world.getBlockID(e + 1, t, i), + a = k.world.getBlockID(e, t, i + 1), + s = k.world.getBlockID(e, t, i - 1); + if (r == this.waterID || r == this.waterHackID) { + n = this.waterID; + var c = k.world.getBlockID(e - 1, t + 1, i); + this.shouldWaterHaveSurface(e - 1, t, i) && + 0 != c && + (n = this.waterHackID), + this.setBlock(n, e - 1, t, i); } - , - this.updateResetPosition = function() { - var e = k.playerEntity - , t = k.entities.getPosition(e); - ue.position[0] = t[0], - ue.position[1] = t[1], - ue.position[2] = t[2], - ue.rotation[0] = 0, - ue.rotation[1] = k.rendering._rotationHolder.rotation.y, - ue.rotation[2] = 0, - T.applyResetPosition() + if (o == this.waterID || o == this.waterHackID) { + n = this.waterID; + var u = k.world.getBlockID(e + 1, t + 1, i); + this.shouldWaterHaveSurface(e + 1, t, i) && + 0 != u && + (n = this.waterHackID), + this.setBlock(n, e + 1, t, i); } - , - this.applyResetPosition = function() { - k.entities.setPhysicsInterpolation(k.playerEntity, false); - var e = k.playerEntity; - k.entities.setPosition(e, ue.position[0], ue.position[1] + .5, ue.position[2]), - k.rendering._rotationHolder.rotation.x = ue.rotation[0], - k.rendering._rotationHolder.rotation.y = ue.rotation[1], - k.rendering._rotationHolder.rotation.z = ue.rotation[2], - setTimeout(function() { - k.entities.setPhysicsInterpolation(k.playerEntity, true) - }, 100) + if (a == this.waterID || a == this.waterHackID) { + n = this.waterID; + var l = k.world.getBlockID(e, t + 1, i + 1); + this.shouldWaterHaveSurface(e, t, i + 1) && + 0 != l && + (n = this.waterHackID), + this.setBlock(n, e, t, i + 1); } - , - this.steveArray = [], - this.spawnSteve = function() { - var e = k.entities.getPositionData(k.playerEntity) - , t = i(510) - , n = e.position[0] - , r = e.position[1] + .5 - , o = e.position[2] - , a = t(k, n, r, o); - T.steveArray.push(a) + if (s == this.waterID || s == this.waterHackID) { + n = this.waterID; + var h = k.world.getBlockID(e, t + 1, i - 1); + this.shouldWaterHaveSurface(e, t, i - 1) && + 0 != h && + (n = this.waterHackID), + this.setBlock(n, e, t, i - 1); } - ; - var le = 250 - , he = 0 - , fe = [] - , de = function(e, t) { - fe.push({ - func: e, - args: t - }) - } - , pe = 1500 - , me = 0 - , ge = [] - , _e = function(e, t) { - ge.push({ - func: e, - args: t - }) - }; - this.checkWaterBelowAdd = function(e, t, i) { - var n = this.waterID; - this.shouldWaterHaveSurface(e, t, i) && (n = this.waterHackID), - this.setBlock(n, e, t, i); - var r = k.world.getBlockID(e - 1, t, i) - , o = k.world.getBlockID(e + 1, t, i) - , a = k.world.getBlockID(e, t, i + 1) - , s = k.world.getBlockID(e, t, i - 1); - if (r == this.waterID || r == this.waterHackID) { - n = this.waterID; - var c = k.world.getBlockID(e - 1, t + 1, i); - this.shouldWaterHaveSurface(e - 1, t, i) && 0 != c && (n = this.waterHackID), - this.setBlock(n, e - 1, t, i) - } - if (o == this.waterID || o == this.waterHackID) { - n = this.waterID; - var u = k.world.getBlockID(e + 1, t + 1, i); - this.shouldWaterHaveSurface(e + 1, t, i) && 0 != u && (n = this.waterHackID), - this.setBlock(n, e + 1, t, i) - } - if (a == this.waterID || a == this.waterHackID) { - n = this.waterID; - var l = k.world.getBlockID(e, t + 1, i + 1); - this.shouldWaterHaveSurface(e, t, i + 1) && 0 != l && (n = this.waterHackID), - this.setBlock(n, e, t, i + 1) - } - if (s == this.waterID || s == this.waterHackID) { - n = this.waterID; - var h = k.world.getBlockID(e, t + 1, i - 1); - this.shouldWaterHaveSurface(e, t, i - 1) && 0 != h && (n = this.waterHackID), - this.setBlock(n, e, t, i - 1) - } - } - , - this.checkWaterHackBelowDestroy = function(e, t, i) { - k.world.getBlockID(e, t, i) == this.waterHackID && this.addBlock(this.waterID, e, t, i); - var n, r = k.world.getBlockID(e - 1, t, i), o = k.world.getBlockID(e + 1, t, i), a = k.world.getBlockID(e, t, i + 1), s = k.world.getBlockID(e, t, i - 1); - if (r == this.waterID || r == this.waterHackID) { - n = this.waterID; - var c = k.world.getBlockID(e - 1, t + 1, i); - this.shouldWaterHaveSurface(e - 1, t, i) && 0 != c && (n = this.waterHackID), - this.setBlock(n, e - 1, t, i) - } - if (o == this.waterID || o == this.waterHackID) { - n = this.waterID; - var u = k.world.getBlockID(e + 1, t + 1, i); - this.shouldWaterHaveSurface(e + 1, t, i) && 0 != u && (n = this.waterHackID), - this.setBlock(n, e + 1, t, i) - } - if (a == this.waterID || a == this.waterHackID) { - n = this.waterID; - var l = k.world.getBlockID(e, t + 1, i + 1); - this.shouldWaterHaveSurface(e, t, i + 1) && 0 != l && (n = this.waterHackID), - this.setBlock(n, e, t, i + 1) - } - if (s == this.waterID || s == this.waterHackID) { - n = this.waterID; - var h = k.world.getBlockID(e, t + 1, i - 1); - this.shouldWaterHaveSurface(e, t, i - 1) && 0 != h && (n = this.waterHackID), - this.setBlock(n, e, t, i - 1) - } - } - , - this.shouldWaterHaveSurface = function(e, t, i) { - var n = k.world.getBlockID(e, t + 1, i) - , r = k.world.getBlockID(e - 1, t + 1, i) - , o = k.world.getBlockID(e + 1, t + 1, i) - , a = k.world.getBlockID(e, t + 1, i + 1) - , s = k.world.getBlockID(e, t + 1, i - 1); - return (0 == n || 0 == r || 0 == o || 0 == a || 0 == s) && n != this.waterID && r != this.waterID && o != this.waterID && a != this.waterID && s != this.waterID && n != this.waterHackID && r != this.waterHackID && o != this.waterHackID && a != this.waterHackID && s != this.waterHackID - } - , - this.addWater = function(e, t, i) { - if (e < 0 || e >= k.worldSize - 1 || i < 0 || i >= k.worldSize - 1) - return false; - var n = this.waterID - , r = k.world.getBlockID(e, t + 1, i); - if (this.shouldWaterHaveSurface(e, t, i) && 0 != r && r != this.emptySpongeID && (n = this.waterHackID), - this.addBlock(this.waterID, e, t, i), - n != this.waterID) { - this.addBlock(n, e, t, i); - var o = k.world.getBlockID(e - 1, t, i) - , a = k.world.getBlockID(e + 1, t, i) - , s = k.world.getBlockID(e, t, i + 1) - , c = k.world.getBlockID(e, t, i - 1) - , u = k.world.getBlockID(e - 1, t + 1, i) - , l = k.world.getBlockID(e + 1, t + 1, i) - , h = k.world.getBlockID(e, t + 1, i + 1) - , f = k.world.getBlockID(e, t + 1, i - 1); - o == this.waterID && 0 != u && (k.setBlock(n, e - 1, t, i), - this.setBlockTilesArray(n, e - 1, t, i)), - a == this.waterID && 0 != l && (k.setBlock(n, e + 1, t, i), - this.setBlockTilesArray(n, e - 1, t, i)), - s == this.waterID && 0 != h && (k.setBlock(n, e, t, i + 1), - this.setBlockTilesArray(n, e - 1, t, i)), - c == this.waterID && 0 != f && (k.setBlock(n, e, t, i - 1), - this.setBlockTilesArray(n, e - 1, t, i)) - } - var d = k.world.getBlockID(e, t - 1, i); - return d == this.grassID && this.flagToRemoveGrass(e, t - 1, i), - d == this.lavaID && this.setBlock(this.stoneID, e, t - 1, i), - d == this.waterHackID && this.setBlock(this.waterID, e, t - 1, i), - true - } - , - this.addLava = function(e, t, i) { - this.addBlock(this.lavaID, e, t, i); - var n = k.world.getBlockID(e, t - 1, i); - n == this.grassID && this.flagToRemoveGrass(e, t - 1, i), - n == this.waterID && this.setBlock(this.stoneID, e, t - 1, i) - } - , - this.checkNeighbours = function(e, t, i, n) { - if (!(e < 0 || e >= k.worldSize - 1 || i < 0 || i >= k.worldSize - 1) && 0 == k.world.getBlockID(e, t, i)) { - var r = k.world.getBlockID(e, t + 1, i) - , o = k.world.getBlockID(e - 1, t, i) - , a = k.world.getBlockID(e + 1, t, i) - , s = k.world.getBlockID(e, t, i + 1) - , c = k.world.getBlockID(e, t, i - 1); - r != T.lavaID && o != T.lavaID && a != T.lavaID && s != T.lavaID && c != T.lavaID || setTimeout(function() { - T.addLava(e, t, i), - _e(T.checkNeighboursAsLava, [e, t, i]) - }, 1500), - r != T.waterID && o != T.waterID && a != T.waterID && s != T.waterID && c != T.waterID && r != T.waterHackID && o != T.waterHackID && a != T.waterHackID && s != T.waterHackID && c != T.waterHackID || setTimeout(function() { - T.addWater(e, t, i) && de(T.checkNeighboursAsWater, [e, t, i]) - }, 150), - n && setTimeout(function() { - T.checkWaterHackBelowDestroy(e, t - 1, i) - }, 160) - } - } - , - this.checkNeighboursAsWater = function(e, t, i) { - if (!(e <= 0 || e >= k.worldSize - 1 || i <= 0 || i >= k.worldSize - 1)) { - var n = k.world.getBlockID(e, t - 1, i) - , r = k.world.getBlockID(e - 1, t, i) - , o = k.world.getBlockID(e + 1, t, i) - , a = k.world.getBlockID(e, t, i + 1) - , s = k.world.getBlockID(e, t, i - 1); - 0 == n && T.addWater(e, t - 1, i) && de(T.checkNeighboursAsWater, [e, t - 1, i]), - 0 == r && T.addWater(e - 1, t, i) && de(T.checkNeighboursAsWater, [e - 1, t, i]), - 0 == o && T.addWater(e + 1, t, i) && de(T.checkNeighboursAsWater, [e + 1, t, i]), - 0 == a && T.addWater(e, t, i + 1) && de(T.checkNeighboursAsWater, [e, t, i + 1]), - 0 == s && T.addWater(e, t, i - 1) && de(T.checkNeighboursAsWater, [e, t, i - 1]) - } - } - , - this.checkNeighboursAsLava = function(e, t, i) { - if (!(e < 0 || e > k.worldSize - 1 || i < 0 || i > k.worldSize - 1)) { - var n = k.world.getBlockID(e, t - 1, i) - , r = k.world.getBlockID(e - 1, t, i) - , o = k.world.getBlockID(e + 1, t, i) - , a = k.world.getBlockID(e, t, i + 1) - , s = k.world.getBlockID(e, t, i - 1); - 0 == n && (T.addLava(e, t - 1, i), - _e(T.checkNeighboursAsLava, [e, t - 1, i])), - 0 == r && (T.addLava(e - 1, t, i), - _e(T.checkNeighboursAsLava, [e - 1, t, i])), - 0 == o && (T.addLava(e + 1, t, i), - _e(T.checkNeighboursAsLava, [e + 1, t, i])), - 0 == a && (T.addLava(e, t, i + 1), - _e(T.checkNeighboursAsLava, [e, t, i + 1])), - 0 == s && (T.addLava(e, t, i - 1), - _e(T.checkNeighboursAsLava, [e, t, i - 1])) - } - } - , - this.flagToGrowGrass = function(e, t, i) { - var n = P + Math.random() * (R - P); - setTimeout(function() { - if (k.world.getBlockID(e, t, i) == T.dirtID) { - var n = T.checkUpForBlocker(e, t, i); - 0 != n && n != T.redflowerID && n != T.yellowflowerID && n != T.bushID && n != T.redmushroomID && n != T.brownmushroomID && n != T.glassID && n != T.leafID || T.setBlock(T.grassID, e, t, i) - } - }, n) - } - , - this.flagToRemoveGrass = function(e, t, i) { - var n = M + Math.random() * (O - M); - setTimeout(function() { - if (k.world.getBlockID(e, t, i) == T.grassID) { - var n = T.checkUpForBlocker(e, t, i); - 0 != n && n != T.redflowerID && n != T.yellowflowerID && n != T.bushID && n != T.redmushroomID && n != T.brownmushroomID && n != T.glassID && n != T.leafID && T.setBlock(T.dirtID, e, t, i) - } - }, n) - } - , - this.checkBelowFoilage = function(e, t, i) { - var n = w + Math.random() * (I - w); - setTimeout(function() { - var n = k.world.getBlockID(e, t, i); - if (n == T.redflowerID || n == T.yellowflowerID || n == T.bushID || n == T.redmushroomID || n == T.brownmushroomID) { - var r = k.world.getBlockID(e, t - 1, i); - r != T.grassID && r != T.dirtID && (T.setBlock(0, e, t, i), - de(T.checkNeighbours, [e, t, i])) - } - }, n) - } - , - this.checkAboveFoilage = function(e, t, i) { - var n = w + Math.random() * (I - w); - setTimeout(function() { - var n = k.world.getBlockID(e, t, i); - if ((n == T.redflowerID || n == T.yellowflowerID || n == T.bushID || n == T.redmushroomID || n == T.brownmushroomID) && T.getBrightness(e, t, i) < 1) { - T.setBlock(0, e, t, i), - de(T.checkNeighbours, [e, t, i]); - var r = k.world.getBlockID(e, t + 1, i); - r != T.sandID && r != T.gravelID || T.checkDownSandGravel(e, t + 1, i, r) - } - }, n) - } - , - this.checkDownForGrass = function(e, t, i) { - for (var n = 0, r = t; (0 == n || n == this.redflowerID || n == this.yellowflowerID || n == this.bushID || n == this.redmushroomID || n == this.brownmushroomID || n == this.glassID || n == this.leafID) && r >= 0; ) - r -= 1, - (n = k.world.getBlockID(e, r, i)) != this.redflowerID && n != this.yellowflowerID && n != this.bushID && n != this.redmushroomID && n != this.brownmushroomID || T.checkAboveFoilage(e, r, i); - n == this.grassID && this.flagToRemoveGrass(e, r, i) - } - , - this.checkDownForDirt = function(e, t, i) { - for (var n = 0, r = t; (0 == n || n == this.redflowerID || n == this.yellowflowerID || n == this.bushID || n == this.redmushroomID || n == this.brownmushroomID || n == this.glassID || n == this.leafID) && r >= 0; ) - r -= 1, - n = k.world.getBlockID(e, r, i); - n == this.dirtID && this.flagToGrowGrass(e, r, i) - } - , - this.checkDownSandGravel = function(e, t, i, n) { - for (var r = 0, o = t; (0 == r || r == this.waterID || r == this.waterHackID || r == this.lavaID || r == this.emptySpongeID) && o >= 0; ) - o -= 1, - r = k.world.getBlockID(e, o, i); - if (0 != r) { - T.setBlock(0, e, t, i), - T.setBlock(n, e, o + 1, i); - var a = k.world.getBlockID(e, t + 1, i); - a != T.sandID && a != T.gravelID || T.checkDownSandGravel(e, t + 1, i, a); - T.removeBlockCheckLit(e, t, i); - T.checkNeighbours(e, t, i, false) - } - } - , - this.checkUpForBlocker = function(e, t, i) { - for (var n = 0, r = t; (0 == n || n == this.redflowerID || n == this.yellowflowerID || n == this.bushID || n == this.redmushroomID || n == this.brownmushroomID || n == this.glassID || n == this.leafID) && r < 64; ) - r += 1, - n = k.world.getBlockID(e, r, i); - return n - } - ; - var ve = {}; - this.updateRemainingSponges = function() { - for (var e in ve) { - var t = ve[e]; - T.checkAddSponge(t.x, t.y, t.z, false) - } - } - , - this.checkAddSponge = function(e, t, i, n) { - (n || null == n) && (ve["s" + e + t + i] = { - x: e, - y: t, - z: i - }); - for (var r = Math.max(e - 2, 1), o = Math.min(e + 2, _ - 3), a = Math.max(i - 2, 1), s = Math.min(i + 2, _ - 3), c = t - 2; c <= t + 2; c++) - for (var u = r; u <= o; u++) - for (var l = a; l <= s; l++) { - var h = k.world.getBlockID(u, c, l); - h != T.waterID && 0 != h || (T.setBlock(T.emptySpongeID, u, c, l), - T.removeBlockCheckLit(u, c, l)) - } - } - , - this.checkRemoveSponge = function(e, t, i) { - delete ve["s" + e + t + i]; - for (var n = Math.max(e - 2, 1), r = Math.min(e + 2, _ - 3), o = Math.max(i - 2, 1), a = Math.min(i + 2, _ - 3), s = t - 2; s <= t + 2; s++) - for (var c = n; c <= r; c++) - for (var u = o; u <= a; u++) { - var l; - l = c == e - 2 || c == e + 2 || u == i - 2 || u == i + 2, - k.world.getBlockID(c, s, u) == T.emptySpongeID && (T.setBlock(0, c, s, u), - l && de(T.checkNeighbours, [c, s, u])) - } - T.updateRemainingSponges() - } - ; - var ye = function() { - k.settings.drawDistance++, - k.settings.drawDistance > 3 && (k.settings.drawDistance = 0), - be(k.settings.drawDistance), - k.emit("saveSettings") - }; - k.on("cycleDrawDistance", ye); - var be = function(e) { - switch (k.settings.drawDistance = e, - e) { - case 0: - k.rendering.fogWorld = .002, - k.rendering.fogWater = .08, - k.rendering.fogLava = .2, - k.rendering._camera.maxZ = 800; - break; - case 1: - k.rendering.fogWorld = .008, - k.rendering.fogWater = .08, - k.rendering.fogLava = .2, - k.rendering._camera.maxZ = 200; - break; - case 2: - k.rendering.fogWorld = .05, - k.rendering.fogWater = .1, - k.rendering.fogLava = .2, - k.rendering._camera.maxZ = 50; - break; - case 3: - k.rendering.fogWorld = .2, - k.rendering.fogWater = .2, - k.rendering.fogLava = .2, - k.rendering._camera.maxZ = 10 - } - k.rendering._camLocBlock += 1 - }; - be(k.settings.drawDistance), - k.on("toggleMusic", function() { - k.settings.music ? (k.settings.music = false, - T.soundPlayer.setMusicVolume(0)) : (k.settings.music = true, - T.soundPlayer.setMusicVolume(1)), - T.soundPlayer.musicOn = k.settings.music, - k.emit("saveSettings") + }), + (this.checkWaterHackBelowDestroy = function (e, t, i) { + k.world.getBlockID(e, t, i) == this.waterHackID && + this.addBlock(this.waterID, e, t, i); + var n, + r = k.world.getBlockID(e - 1, t, i), + o = k.world.getBlockID(e + 1, t, i), + a = k.world.getBlockID(e, t, i + 1), + s = k.world.getBlockID(e, t, i - 1); + if (r == this.waterID || r == this.waterHackID) { + n = this.waterID; + var c = k.world.getBlockID(e - 1, t + 1, i); + this.shouldWaterHaveSurface(e - 1, t, i) && + 0 != c && + (n = this.waterHackID), + this.setBlock(n, e - 1, t, i); + } + if (o == this.waterID || o == this.waterHackID) { + n = this.waterID; + var u = k.world.getBlockID(e + 1, t + 1, i); + this.shouldWaterHaveSurface(e + 1, t, i) && + 0 != u && + (n = this.waterHackID), + this.setBlock(n, e + 1, t, i); + } + if (a == this.waterID || a == this.waterHackID) { + n = this.waterID; + var l = k.world.getBlockID(e, t + 1, i + 1); + this.shouldWaterHaveSurface(e, t, i + 1) && + 0 != l && + (n = this.waterHackID), + this.setBlock(n, e, t, i + 1); + } + if (s == this.waterID || s == this.waterHackID) { + n = this.waterID; + var h = k.world.getBlockID(e, t + 1, i - 1); + this.shouldWaterHaveSurface(e, t, i - 1) && + 0 != h && + (n = this.waterHackID), + this.setBlock(n, e, t, i - 1); + } }), - k.on("toggleSound", function() { - k.settings.sound ? k.settings.sound = false : k.settings.sound = true, - T.soundPlayer.soundOn = k.settings.sound, - k.emit("saveSettings") + (this.shouldWaterHaveSurface = function (e, t, i) { + var n = k.world.getBlockID(e, t + 1, i), + r = k.world.getBlockID(e - 1, t + 1, i), + o = k.world.getBlockID(e + 1, t + 1, i), + a = k.world.getBlockID(e, t + 1, i + 1), + s = k.world.getBlockID(e, t + 1, i - 1); + return ( + (0 == n || 0 == r || 0 == o || 0 == a || 0 == s) && + n != this.waterID && + r != this.waterID && + o != this.waterID && + a != this.waterID && + s != this.waterID && + n != this.waterHackID && + r != this.waterHackID && + o != this.waterHackID && + a != this.waterHackID && + s != this.waterHackID + ); }), - k.on("toggleInvertMouse", function() { - k.settings.invert ? k.settings.invert = false : k.settings.invert = true, - k.cameraControls.inverseY = k.settings.invert, - k.emit("saveSettings") - }), - k.on("toggleFps", function() { - k.settings.fps ? k.settings.fps = false : k.settings.fps = true, - k.version.showFps = k.settings.fps, - k.version.lastRedraw = 0, - k.version.redraw(), - k.emit("saveSettings") - }), - k.on("saveSettings", function() { - localStorage.setItem("settings", JSON.stringify(k.settings)) - }), - setInterval(function() { - if (null != t.player) { - var e = k.entities.getPositionData(k.playerEntity) - , i = k.rendering._rotationHolder.rotation; - t.player.setPosition({ - x: e.position[0], - y: e.position[1], - z: e.position[2] - }, i, t.playerSpawned) - } - }, 50), - k.setName = function(e) { - T.setName && T.setName(e) - } - , - this.onHostDisconnect = function() { - E || (this.worldInitialized && (G.isOpen && G.close(), - c.isOpen && c.close(), - V.isOpen && V.close()), - z && z.show(3), - b = true) - } - , - this.onHostFull = function() { - z && z.show(2) - } - , - this.onKicked = function() { - E = true, - z && z.show(5) - } - , - this.addPlayer = function(e, t, n, r, o) { - return i(512)(k, e, t, n, r, o) - } - , - this.getPlayerPosition = function() { - return k.entities.getPosition(k.playerEntity) - } - , - this.getPlayerRotation = function() { - return k.rendering._rotationHolder.rotation - } - , - this.setBlock = function(e, t, i, n) { - var r = t.length ? t : [t, i, n]; - this.setBlockTilesArray(e, r), - k.setBlock(e, r), - void 0 !== this.changedBlockHandler && null !== this.changedBlockHandler && this.changedBlockHandler.setBlock(r, e) - } - , - this.addBlock = function(blockToAdd, t, localPlayer, n) { - var blockPos = t.length ? t : [t, localPlayer, n]; // if t is not arr, blockPos = [t, i, n] - - var o = !!t.length && localPlayer; // whether t is an arr AND i = true - - this.setBlockTilesArray(blockToAdd, blockPos); - - var addBlockRet = k.addBlock(blockToAdd, blockPos, o); - - if(!!addBlockRet) { - if(this.changedBlockHandler !== void 0 && this.changedBlockHandler !== null) { - this.changedBlockHandler.addBlock(blockPos, blockToAdd); - } - - if(blockToAdd != this.leafID && blockToAdd != this.glassID && blockToAdd != this.redflowerID - && blockToAdd != this.yellowflowerID && blockToAdd != this.bushID - && blockToAdd != this.redmushroomID && blockToAdd != this.brownmushroomID) { - this.addBlockCheckLit(blockPos[0], blockPos[1], blockPos[2]); - } - - return true; - } - + (this.addWater = function (e, t, i) { + if ( + e < 0 || + e >= k.worldSize - 1 || + i < 0 || + i >= k.worldSize - 1 + ) return false; - } - , - this.handleChangedBlocks = function(e) { - for (var t in e) { - var i = e[t]; - this.setBlockTilesArray(i.bt, i.p), - this.worldInitialized && (i.add ? this.addBlock(i.bt, i.p) : (this.setBlock(i.bt, i.p), - 0 == i.bt && this.removeBlockCheckLit(i.p[0], i.p[1], i.p[2]))) + var n = this.waterID, + r = k.world.getBlockID(e, t + 1, i); + if ( + (this.shouldWaterHaveSurface(e, t, i) && + 0 != r && + r != this.emptySpongeID && + (n = this.waterHackID), + this.addBlock(this.waterID, e, t, i), + n != this.waterID) + ) { + this.addBlock(n, e, t, i); + var o = k.world.getBlockID(e - 1, t, i), + a = k.world.getBlockID(e + 1, t, i), + s = k.world.getBlockID(e, t, i + 1), + c = k.world.getBlockID(e, t, i - 1), + u = k.world.getBlockID(e - 1, t + 1, i), + l = k.world.getBlockID(e + 1, t + 1, i), + h = k.world.getBlockID(e, t + 1, i + 1), + f = k.world.getBlockID(e, t + 1, i - 1); + o == this.waterID && + 0 != u && + (k.setBlock(n, e - 1, t, i), + this.setBlockTilesArray(n, e - 1, t, i)), + a == this.waterID && + 0 != l && + (k.setBlock(n, e + 1, t, i), + this.setBlockTilesArray(n, e - 1, t, i)), + s == this.waterID && + 0 != h && + (k.setBlock(n, e, t, i + 1), + this.setBlockTilesArray(n, e - 1, t, i)), + c == this.waterID && + 0 != f && + (k.setBlock(n, e, t, i - 1), + this.setBlockTilesArray(n, e - 1, t, i)); + } + var d = k.world.getBlockID(e, t - 1, i); + return ( + d == this.grassID && + this.flagToRemoveGrass(e, t - 1, i), + d == this.lavaID && + this.setBlock(this.stoneID, e, t - 1, i), + d == this.waterHackID && + this.setBlock(this.waterID, e, t - 1, i), + true + ); + }), + (this.addLava = function (e, t, i) { + this.addBlock(this.lavaID, e, t, i); + var n = k.world.getBlockID(e, t - 1, i); + n == this.grassID && this.flagToRemoveGrass(e, t - 1, i), + n == this.waterID && + this.setBlock(this.stoneID, e, t - 1, i); + }), + (this.checkNeighbours = function (e, t, i, n) { + if ( + !( + e < 0 || + e >= k.worldSize - 1 || + i < 0 || + i >= k.worldSize - 1 + ) && + 0 == k.world.getBlockID(e, t, i) + ) { + var r = k.world.getBlockID(e, t + 1, i), + o = k.world.getBlockID(e - 1, t, i), + a = k.world.getBlockID(e + 1, t, i), + s = k.world.getBlockID(e, t, i + 1), + c = k.world.getBlockID(e, t, i - 1); + (r != T.lavaID && + o != T.lavaID && + a != T.lavaID && + s != T.lavaID && + c != T.lavaID) || + setTimeout(function () { + T.addLava(e, t, i), + _e(T.checkNeighboursAsLava, [e, t, i]); + }, 1500), + (r != T.waterID && + o != T.waterID && + a != T.waterID && + s != T.waterID && + c != T.waterID && + r != T.waterHackID && + o != T.waterHackID && + a != T.waterHackID && + s != T.waterHackID && + c != T.waterHackID) || + setTimeout(function () { + T.addWater(e, t, i) && + de(T.checkNeighboursAsWater, [e, t, i]); + }, 150), + n && + setTimeout(function () { + T.checkWaterHackBelowDestroy(e, t - 1, i); + }, 160); + } + }), + (this.checkNeighboursAsWater = function (e, t, i) { + if ( + !( + e <= 0 || + e >= k.worldSize - 1 || + i <= 0 || + i >= k.worldSize - 1 + ) + ) { + var n = k.world.getBlockID(e, t - 1, i), + r = k.world.getBlockID(e - 1, t, i), + o = k.world.getBlockID(e + 1, t, i), + a = k.world.getBlockID(e, t, i + 1), + s = k.world.getBlockID(e, t, i - 1); + 0 == n && + T.addWater(e, t - 1, i) && + de(T.checkNeighboursAsWater, [e, t - 1, i]), + 0 == r && + T.addWater(e - 1, t, i) && + de(T.checkNeighboursAsWater, [e - 1, t, i]), + 0 == o && + T.addWater(e + 1, t, i) && + de(T.checkNeighboursAsWater, [e + 1, t, i]), + 0 == a && + T.addWater(e, t, i + 1) && + de(T.checkNeighboursAsWater, [e, t, i + 1]), + 0 == s && + T.addWater(e, t, i - 1) && + de(T.checkNeighboursAsWater, [e, t, i - 1]); + } + }), + (this.checkNeighboursAsLava = function (e, t, i) { + if ( + !( + e < 0 || + e > k.worldSize - 1 || + i < 0 || + i > k.worldSize - 1 + ) + ) { + var n = k.world.getBlockID(e, t - 1, i), + r = k.world.getBlockID(e - 1, t, i), + o = k.world.getBlockID(e + 1, t, i), + a = k.world.getBlockID(e, t, i + 1), + s = k.world.getBlockID(e, t, i - 1); + 0 == n && + (T.addLava(e, t - 1, i), + _e(T.checkNeighboursAsLava, [e, t - 1, i])), + 0 == r && + (T.addLava(e - 1, t, i), + _e(T.checkNeighboursAsLava, [e - 1, t, i])), + 0 == o && + (T.addLava(e + 1, t, i), + _e(T.checkNeighboursAsLava, [e + 1, t, i])), + 0 == a && + (T.addLava(e, t, i + 1), + _e(T.checkNeighboursAsLava, [e, t, i + 1])), + 0 == s && + (T.addLava(e, t, i - 1), + _e(T.checkNeighboursAsLava, [e, t, i - 1])); + } + }), + (this.flagToGrowGrass = function (e, t, i) { + var n = P + Math.random() * (R - P); + setTimeout(function () { + if (k.world.getBlockID(e, t, i) == T.dirtID) { + var n = T.checkUpForBlocker(e, t, i); + (0 != n && + n != T.redflowerID && + n != T.yellowflowerID && + n != T.bushID && + n != T.redmushroomID && + n != T.brownmushroomID && + n != T.glassID && + n != T.leafID) || + T.setBlock(T.grassID, e, t, i); } - this.worldGenerated && !this.worldInitialized && Ee() - } - , - this.syncSavedWorld = function() { - var e = targetBlockAdjacentPos.default.getInstance().getChangedBlocks(); - for (var t in e) { - var i = e[t]; - this.setBlockTilesArray(i.bt, i.p) + }, n); + }), + (this.flagToRemoveGrass = function (e, t, i) { + var n = M + Math.random() * (O - M); + setTimeout(function () { + if (k.world.getBlockID(e, t, i) == T.grassID) { + var n = T.checkUpForBlocker(e, t, i); + 0 != n && + n != T.redflowerID && + n != T.yellowflowerID && + n != T.bushID && + n != T.redmushroomID && + n != T.brownmushroomID && + n != T.glassID && + n != T.leafID && + T.setBlock(T.dirtID, e, t, i); } - } - , - this.setBlockTilesArray = function(e, t, i, n) { - if (y) { - var r = t.length ? t : [t, i, n]; - y[(r[1] * _ + r[2]) * _ + r[0]] = e + }, n); + }), + (this.checkBelowFoilage = function (e, t, i) { + var n = w + Math.random() * (I - w); + setTimeout(function () { + var n = k.world.getBlockID(e, t, i); + if ( + n == T.redflowerID || + n == T.yellowflowerID || + n == T.bushID || + n == T.redmushroomID || + n == T.brownmushroomID + ) { + var r = k.world.getBlockID(e, t - 1, i); + r != T.grassID && + r != T.dirtID && + (T.setBlock(0, e, t, i), + de(T.checkNeighbours, [e, t, i])); } + }, n); + }), + (this.checkAboveFoilage = function (e, t, i) { + var n = w + Math.random() * (I - w); + setTimeout(function () { + var n = k.world.getBlockID(e, t, i); + if ( + (n == T.redflowerID || + n == T.yellowflowerID || + n == T.bushID || + n == T.redmushroomID || + n == T.brownmushroomID) && + T.getBrightness(e, t, i) < 1 + ) { + T.setBlock(0, e, t, i), + de(T.checkNeighbours, [e, t, i]); + var r = k.world.getBlockID(e, t + 1, i); + (r != T.sandID && r != T.gravelID) || + T.checkDownSandGravel(e, t + 1, i, r); + } + }, n); + }), + (this.checkDownForGrass = function (e, t, i) { + for ( + var n = 0, r = t; + (0 == n || + n == this.redflowerID || + n == this.yellowflowerID || + n == this.bushID || + n == this.redmushroomID || + n == this.brownmushroomID || + n == this.glassID || + n == this.leafID) && + r >= 0; + + ) + (r -= 1), + ((n = k.world.getBlockID(e, r, i)) != + this.redflowerID && + n != this.yellowflowerID && + n != this.bushID && + n != this.redmushroomID && + n != this.brownmushroomID) || + T.checkAboveFoilage(e, r, i); + n == this.grassID && this.flagToRemoveGrass(e, r, i); + }), + (this.checkDownForDirt = function (e, t, i) { + for ( + var n = 0, r = t; + (0 == n || + n == this.redflowerID || + n == this.yellowflowerID || + n == this.bushID || + n == this.redmushroomID || + n == this.brownmushroomID || + n == this.glassID || + n == this.leafID) && + r >= 0; + + ) + (r -= 1), (n = k.world.getBlockID(e, r, i)); + n == this.dirtID && this.flagToGrowGrass(e, r, i); + }), + (this.checkDownSandGravel = function (e, t, i, n) { + for ( + var r = 0, o = t; + (0 == r || + r == this.waterID || + r == this.waterHackID || + r == this.lavaID || + r == this.emptySpongeID) && + o >= 0; + + ) + (o -= 1), (r = k.world.getBlockID(e, o, i)); + if (0 != r) { + T.setBlock(0, e, t, i), T.setBlock(n, e, o + 1, i); + var a = k.world.getBlockID(e, t + 1, i); + (a != T.sandID && a != T.gravelID) || + T.checkDownSandGravel(e, t + 1, i, a); + T.removeBlockCheckLit(e, t, i); + T.checkNeighbours(e, t, i, false); + } + }), + (this.checkUpForBlocker = function (e, t, i) { + for ( + var n = 0, r = t; + (0 == n || + n == this.redflowerID || + n == this.yellowflowerID || + n == this.bushID || + n == this.redmushroomID || + n == this.brownmushroomID || + n == this.glassID || + n == this.leafID) && + r < 64; + + ) + (r += 1), (n = k.world.getBlockID(e, r, i)); + return n; + }); + var ve = {}; + (this.updateRemainingSponges = function () { + for (var e in ve) { + var t = ve[e]; + T.checkAddSponge(t.x, t.y, t.z, false); } - , - this.updateChatLog = function(e) { - void 0 !== c && c.update(e) + }), + (this.checkAddSponge = function (e, t, i, n) { + (n || null == n) && + (ve["s" + e + t + i] = { + x: e, + y: t, + z: i, + }); + for ( + var r = Math.max(e - 2, 1), + o = Math.min(e + 2, _ - 3), + a = Math.max(i - 2, 1), + s = Math.min(i + 2, _ - 3), + c = t - 2; + c <= t + 2; + c++ + ) + for (var u = r; u <= o; u++) + for (var l = a; l <= s; l++) { + var h = k.world.getBlockID(u, c, l); + (h != T.waterID && 0 != h) || + (T.setBlock(T.emptySpongeID, u, c, l), + T.removeBlockCheckLit(u, c, l)); + } + }), + (this.checkRemoveSponge = function (e, t, i) { + delete ve["s" + e + t + i]; + for ( + var n = Math.max(e - 2, 1), + r = Math.min(e + 2, _ - 3), + o = Math.max(i - 2, 1), + a = Math.min(i + 2, _ - 3), + s = t - 2; + s <= t + 2; + s++ + ) + for (var c = n; c <= r; c++) + for (var u = o; u <= a; u++) { + var l; + (l = + c == e - 2 || + c == e + 2 || + u == i - 2 || + u == i + 2), + k.world.getBlockID(c, s, u) == T.emptySpongeID && + (T.setBlock(0, c, s, u), + l && de(T.checkNeighbours, [c, s, u])); + } + T.updateRemainingSponges(); + }); + var ye = function () { + k.settings.drawDistance++, + k.settings.drawDistance > 3 && + (k.settings.drawDistance = 0), + be(k.settings.drawDistance), + k.emit("saveSettings"); + }; + k.on("cycleDrawDistance", ye); + var be = function (e) { + switch (((k.settings.drawDistance = e), e)) { + case 0: + (k.rendering.fogWorld = 0.002), + (k.rendering.fogWater = 0.08), + (k.rendering.fogLava = 0.2), + (k.rendering._camera.maxZ = 800); + break; + case 1: + (k.rendering.fogWorld = 0.008), + (k.rendering.fogWater = 0.08), + (k.rendering.fogLava = 0.2), + (k.rendering._camera.maxZ = 200); + break; + case 2: + (k.rendering.fogWorld = 0.05), + (k.rendering.fogWater = 0.1), + (k.rendering.fogLava = 0.2), + (k.rendering._camera.maxZ = 50); + break; + case 3: + (k.rendering.fogWorld = 0.2), + (k.rendering.fogWater = 0.2), + (k.rendering.fogLava = 0.2), + (k.rendering._camera.maxZ = 10); } - } else - console.log("seed must be an integer."); + k.rendering._camLocBlock += 1; + }; + be(k.settings.drawDistance), + k.on("toggleMusic", function () { + k.settings.music + ? ((k.settings.music = false), + T.soundPlayer.setMusicVolume(0)) + : ((k.settings.music = true), + T.soundPlayer.setMusicVolume(1)), + (T.soundPlayer.musicOn = k.settings.music), + k.emit("saveSettings"); + }), + k.on("toggleSound", function () { + k.settings.sound + ? (k.settings.sound = false) + : (k.settings.sound = true), + (T.soundPlayer.soundOn = k.settings.sound), + k.emit("saveSettings"); + }), + k.on("toggleInvertMouse", function () { + k.settings.invert + ? (k.settings.invert = false) + : (k.settings.invert = true), + (k.cameraControls.inverseY = k.settings.invert), + k.emit("saveSettings"); + }), + k.on("toggleFps", function () { + k.settings.fps + ? (k.settings.fps = false) + : (k.settings.fps = true), + (k.version.showFps = k.settings.fps), + (k.version.lastRedraw = 0), + k.version.redraw(), + k.emit("saveSettings"); + }), + k.on("saveSettings", function () { + localStorage.setItem( + "settings", + JSON.stringify(k.settings) + ); + }), + setInterval(function () { + if (null != t.player) { + var e = k.entities.getPositionData(k.playerEntity), + i = k.rendering._rotationHolder.rotation; + t.player.setPosition( + { + x: e.position[0], + y: e.position[1], + z: e.position[2], + }, + i, + t.playerSpawned + ); + } + }, 50), + (k.setName = function (e) { + T.setName && T.setName(e); + }), + (this.onHostDisconnect = function () { + E || + (this.worldInitialized && + (G.isOpen && G.close(), + c.isOpen && c.close(), + V.isOpen && V.close()), + z && z.show(3), + (b = true)); + }), + (this.onHostFull = function () { + z && z.show(2); + }), + (this.onKicked = function () { + (E = true), z && z.show(5); + }), + (this.addPlayer = function (e, t, n, r, o) { + return i(512)(k, e, t, n, r, o); + }), + (this.getPlayerPosition = function () { + return k.entities.getPosition(k.playerEntity); + }), + (this.getPlayerRotation = function () { + return k.rendering._rotationHolder.rotation; + }), + (this.setBlock = function (e, t, i, n) { + var r = t.length ? t : [t, i, n]; + this.setBlockTilesArray(e, r), + k.setBlock(e, r), + void 0 !== this.changedBlockHandler && + null !== this.changedBlockHandler && + this.changedBlockHandler.setBlock(r, e); + }), + (this.addBlock = function (blockToAdd, t, localPlayer, n) { + var blockPos = t.length ? t : [t, localPlayer, n]; // if t is not arr, blockPos = [t, i, n] + + var o = !!t.length && localPlayer; // whether t is an arr AND i = true + + this.setBlockTilesArray(blockToAdd, blockPos); + + var addBlockRet = k.addBlock(blockToAdd, blockPos, o); + + if (!!addBlockRet) { + if ( + this.changedBlockHandler !== void 0 && + this.changedBlockHandler !== null + ) { + this.changedBlockHandler.addBlock( + blockPos, + blockToAdd + ); + } + + if ( + blockToAdd != this.leafID && + blockToAdd != this.glassID && + blockToAdd != this.redflowerID && + blockToAdd != this.yellowflowerID && + blockToAdd != this.bushID && + blockToAdd != this.redmushroomID && + blockToAdd != this.brownmushroomID + ) { + this.addBlockCheckLit( + blockPos[0], + blockPos[1], + blockPos[2] + ); + } + + return true; + } + + return false; + }), + (this.handleChangedBlocks = function (e) { + for (var t in e) { + var i = e[t]; + this.setBlockTilesArray(i.bt, i.p), + this.worldInitialized && + (i.add + ? this.addBlock(i.bt, i.p) + : (this.setBlock(i.bt, i.p), + 0 == i.bt && + this.removeBlockCheckLit( + i.p[0], + i.p[1], + i.p[2] + ))); + } + this.worldGenerated && !this.worldInitialized && Ee(); + }), + (this.syncSavedWorld = function () { + var e = targetBlockAdjacentPos.default + .getInstance() + .getChangedBlocks(); + for (var t in e) { + var i = e[t]; + this.setBlockTilesArray(i.bt, i.p); + } + }), + (this.setBlockTilesArray = function (e, t, i, n) { + if (y) { + var r = t.length ? t : [t, i, n]; + y[(r[1] * _ + r[2]) * _ + r[0]] = e; + } + }), + (this.updateChatLog = function (e) { + void 0 !== c && c.update(e); + }); + } else console.log("seed must be an integer."); function Ee() { - !function() { - for (var e = 0; e < _; ++e) - for (var t = 0; t < 64; ++t) - for (var i = 0; i < _; ++i) { - var n = e - , r = t - , o = i - , a = y[(r * _ + o) * _ + n] - , s = 0; - null != T.lightDepths[n][o] && (s = T.lightDepths[n][o]), - 0 != a && a != T.redflowerID && a != T.yellowflowerID && a != T.bushID && a != T.redmushroomID && a != T.brownmushroomID && a != T.glassID && a != T.leafID && a != T.emptySpongeID && r >= s && (s = r), - T.lightDepths[n][o] = s - } - }(), + !(function () { + for (var e = 0; e < _; ++e) + for (var t = 0; t < 64; ++t) + for (var i = 0; i < _; ++i) { + var n = e, + r = t, + o = i, + a = y[(r * _ + o) * _ + n], + s = 0; + null != T.lightDepths[n][o] && + (s = T.lightDepths[n][o]), + 0 != a && + a != T.redflowerID && + a != T.yellowflowerID && + a != T.bushID && + a != T.redmushroomID && + a != T.brownmushroomID && + a != T.glassID && + a != T.leafID && + a != T.emptySpongeID && + r >= s && + (s = r), + (T.lightDepths[n][o] = s); + } + })(), k.world.on("worldDataNeeded", Te), k.setPaused(false), - c = blockInHand(k), - k.version = d(), - k.version.showFps = k.settings.fps, + (c = blockInHand(k)), + (k.version = d()), + (k.version.showFps = k.settings.fps), k.entities.setPhysicsInterpolation(k.playerEntity, false), setTimeout(H, 100), - T.worldInitialized = true, - k.hostInfo.gameFull && (G.isOpen && G.close(true), - z.show(2)), - null != A.get("host") ? (G.isOpen && G.close(true), - T.noWebrtcJoin ? z.show(6) : z.show(0)) : null != A.get("join") && (G.isOpen && G.close(true), - z.show(1)) + (T.worldInitialized = true), + k.hostInfo.gameFull && + (G.isOpen && G.close(true), z.show(2)), + null != A.get("host") + ? (G.isOpen && G.close(true), + T.noWebrtcJoin ? z.show(6) : z.show(0)) + : null != A.get("join") && + (G.isOpen && G.close(true), z.show(1)); } function Te(e, t, i, n, r) { - var o = e.split("|") - , a = parseInt(o[0], 10) - , s = parseInt(o[1], 10) - , c = parseInt(o[2], 10) - , u = a * g - , l = s * g - , h = c * g - , f = false; - if ((a < 0 || s < 0 || c < 0) && (f = true), + var o = e.split("|"), + a = parseInt(o[0], 10), + s = parseInt(o[1], 10), + c = parseInt(o[2], 10), + u = a * g, + l = s * g, + h = c * g, + f = false; + if ( + ((a < 0 || s < 0 || c < 0) && (f = true), (a >= _ / g || s >= 64 / g || c >= _ / g) && (f = true), - f) { - for (var d = T.bedrockID, p = 0; p < t.shape[0]; ++p) - for (var m = 0; m < t.shape[1]; ++m) - for (var b = 0; b < t.shape[2]; ++b) { - d = 0, - (E = m - 1 + l) <= v && (d = T.waterID), - E <= v - 2 && (d = T.bedrockID), - t.set(p, m, b, d) - } - k.world.setChunkData(e, t) - } else { - for (d = T.bedrockID, - p = 0; p < t.shape[0]; ++p) - for (m = 0; m < t.shape[1]; ++m) - for (b = 0; b < t.shape[2]; ++b) { - var E, A = p - 1 + u, x = b - 1 + h; - null != (d = y[((E = m - 1 + l) * _ + x) * _ + A]) && 0 != E || (d = T.bedrockID), - (A < 0 || x < 0 || p + u >= _ || b + h >= _) && (d = 0, - E <= v && (d = T.waterID), - E <= v - 2 && (d = T.bedrockID)), - t.set(p, m, b, d) - } - k.world.setChunkData(e, t) - } + f) + ) { + for (var d = T.bedrockID, p = 0; p < t.shape[0]; ++p) + for (var m = 0; m < t.shape[1]; ++m) + for (var b = 0; b < t.shape[2]; ++b) { + (d = 0), + (E = m - 1 + l) <= v && (d = T.waterID), + E <= v - 2 && (d = T.bedrockID), + t.set(p, m, b, d); + } + k.world.setChunkData(e, t); + } else { + for (d = T.bedrockID, p = 0; p < t.shape[0]; ++p) + for (m = 0; m < t.shape[1]; ++m) + for (b = 0; b < t.shape[2]; ++b) { + var E, + A = p - 1 + u, + x = b - 1 + h; + (null != (d = y[((E = m - 1 + l) * _ + x) * _ + A]) && + 0 != E) || + (d = T.bedrockID), + (A < 0 || x < 0 || p + u >= _ || b + h >= _) && + ((d = 0), + E <= v && (d = T.waterID), + E <= v - 2 && (d = T.bedrockID)), + t.set(p, m, b, d); + } + k.world.setChunkData(e, t); + } } function Ae(e) { - e.ctrlKey && e.preventDefault() + e.ctrlKey && e.preventDefault(); } - } - }, { - key: "handleFireEvent", - value: function(event) { + }, + }, + { + key: "handleFireEvent", + value: function (event) { var targetedBlockID = event.targetedBlockBlockID; var targetBlockPos = event.targetedBlockPosition; var blockPlacePos = event.targetedBlockAdjacentPosition; @@ -8993,1749 +10777,2211 @@ var isLocalPlayer = event.localPlayer; if (typeof noa == "undefined") { - if(isAdding) - this.setBlockTilesArray(this.blockArray[blockInHand], blockPlacePos); - else - this.setBlockTilesArray(0, targetBlockPos); + if (isAdding) + this.setBlockTilesArray( + this.blockArray[blockInHand], + blockPlacePos + ); + else this.setBlockTilesArray(0, targetBlockPos); - return false; + return false; } if (isAdding) { - // is block past world height? - if (blockPlacePos[1] >= noa.worldHeight) - return false; - - var blockAtPlacePos = noa.world.getBlockID(blockPlacePos[0], blockPlacePos[1], blockPlacePos[2]); - var blockToPlace = this.blockArray[blockInHand]; + // is block past world height? + if (blockPlacePos[1] >= noa.worldHeight) return false; - // add the block - var blockAdded = this.addBlock(blockToPlace, blockPlacePos, isLocalPlayer); - if (!blockAdded) { - return false; - } + var blockAtPlacePos = noa.world.getBlockID( + blockPlacePos[0], + blockPlacePos[1], + blockPlacePos[2] + ); + var blockToPlace = this.blockArray[blockInHand]; - if(blockToPlace == this.dirtID) - this.flagToGrowGrass(blockPlacePos[0], blockPlacePos[1], blockPlacePos[2]); + // add the block + var blockAdded = this.addBlock( + blockToPlace, + blockPlacePos, + isLocalPlayer + ); + if (!blockAdded) { + return false; + } - this.checkDownForGrass(blockPlacePos[0], blockPlacePos[1], blockPlacePos[2]); - - var blockUnder = noa.world.getBlockID(blockPlacePos[0], blockPlacePos[1] - 1, blockPlacePos[2]); + if (blockToPlace == this.dirtID) + this.flagToGrowGrass( + blockPlacePos[0], + blockPlacePos[1], + blockPlacePos[2] + ); + this.checkDownForGrass( + blockPlacePos[0], + blockPlacePos[1], + blockPlacePos[2] + ); - if((blockUnder == this.waterID || blockUnder == this.waterHackID) && blockAtPlacePos == 0) - this.checkWaterBelowAdd(blockPlacePos[0], blockPlacePos[1] - 1, blockPlacePos[2]); + var blockUnder = noa.world.getBlockID( + blockPlacePos[0], + blockPlacePos[1] - 1, + blockPlacePos[2] + ); - if(blockToPlace == this.sandID || blockToPlace != this.gravelID) - this.checkDownSandGravel(blockPlacePos[0], blockPlacePos[1], blockPlacePos[2], blockToPlace); - - if(blockToPlace == this.spongeID) - this.checkAddSponge(blockPlacePos[0], blockPlacePos[1], blockPlacePos[2]); + if ( + (blockUnder == this.waterID || + blockUnder == this.waterHackID) && + blockAtPlacePos == 0 + ) + this.checkWaterBelowAdd( + blockPlacePos[0], + blockPlacePos[1] - 1, + blockPlacePos[2] + ); - if(blockToPlace == this.redflowerID || blockToPlace == this.yellowflowerID || blockToPlace == this.bushID || blockToPlace == this.redmushroomID - || blockToPlace == this.brownmushroomID && (blockUnder != this.dirtID && blockUnder != this.grassID)) { - this.checkBelowFoilage(blockPlacePos[0], blockPlacePos[1], blockPlacePos[2]); - } + if ( + blockToPlace == this.sandID || + blockToPlace != this.gravelID + ) + this.checkDownSandGravel( + blockPlacePos[0], + blockPlacePos[1], + blockPlacePos[2], + blockToPlace + ); - this.checkAboveFoilage(blockPlacePos[0], blockPlacePos[1], blockPlacePos[2]); + if (blockToPlace == this.spongeID) + this.checkAddSponge( + blockPlacePos[0], + blockPlacePos[1], + blockPlacePos[2] + ); - return true + if ( + blockToPlace == this.redflowerID || + blockToPlace == this.yellowflowerID || + blockToPlace == this.bushID || + blockToPlace == this.redmushroomID || + (blockToPlace == this.brownmushroomID && + blockUnder != this.dirtID && + blockUnder != this.grassID) + ) { + this.checkBelowFoilage( + blockPlacePos[0], + blockPlacePos[1], + blockPlacePos[2] + ); + } + + this.checkAboveFoilage( + blockPlacePos[0], + blockPlacePos[1], + blockPlacePos[2] + ); + + return true; } else { - if (targetedBlockID != this.bedrockID) { - var blockFaceMatAccessor = noa.registry.getBlockFaceMaterialAccessor(); + if (targetedBlockID != this.bedrockID) { + var blockFaceMatAccessor = + noa.registry.getBlockFaceMaterialAccessor(); - var blockTexId = blockFaceMatAccessor(targetedBlockID, 0); - var blockTexture = noa.registry._textures[blockTexId]; + var blockTexId = blockFaceMatAccessor(targetedBlockID, 0); + var blockTexture = noa.registry._textures[blockTexId]; - // set air block to target, "breaking" the block - this.setBlock(0, targetBlockPos); + // set air block to target, "breaking" the block + this.setBlock(0, targetBlockPos); - var f = this.removeBlockCheckLit(targetBlockPos[0], targetBlockPos[1], targetBlockPos[2]); - var targetVec3 = new BABYLON.Vector3(targetBlockPos[0], targetBlockPos[1], targetBlockPos[2]); - var blockDist = BABYLON.Vector3.Distance(noa.rendering._cameraHolder.position, targetVec3); - - if (blockTexture != null && blockDist < 15) - this.addParticles("debris", blockTexture, f).mesh.position.copyFromFloats(targetBlockPos[0] + .5, targetBlockPos[1] + .5, targetBlockPos[2] + .5); - - - this.checkDownForDirt(targetBlockPos[0], targetBlockPos[1], targetBlockPos[2]), - targetedBlockID == this.spongeID && this.checkRemoveSponge(targetBlockPos[0], targetBlockPos[1], targetBlockPos[2]); + var f = this.removeBlockCheckLit( + targetBlockPos[0], + targetBlockPos[1], + targetBlockPos[2] + ); + var targetVec3 = new BABYLON.Vector3( + targetBlockPos[0], + targetBlockPos[1], + targetBlockPos[2] + ); + var blockDist = BABYLON.Vector3.Distance( + noa.rendering._cameraHolder.position, + targetVec3 + ); + if (blockTexture != null && blockDist < 15) + this.addParticles( + "debris", + blockTexture, + f + ).mesh.position.copyFromFloats( + targetBlockPos[0] + 0.5, + targetBlockPos[1] + 0.5, + targetBlockPos[2] + 0.5 + ); - var m = noa.world.getBlockID(targetBlockPos[0], targetBlockPos[1] + 1, targetBlockPos[2]); + this.checkDownForDirt( + targetBlockPos[0], + targetBlockPos[1], + targetBlockPos[2] + ), + targetedBlockID == this.spongeID && + this.checkRemoveSponge( + targetBlockPos[0], + targetBlockPos[1], + targetBlockPos[2] + ); + var m = noa.world.getBlockID( + targetBlockPos[0], + targetBlockPos[1] + 1, + targetBlockPos[2] + ); - targetedBlockID != this.dirtID && targetedBlockID != this.grassID || m != this.redflowerID && m != this.yellowflowerID && m != this.bushID && m != this.redmushroomID && m != this.brownmushroomID || this.checkBelowFoilage(targetBlockPos[0], targetBlockPos[1] + 1, targetBlockPos[2]), - m != this.sandID && m != this.gravelID || this.checkDownSandGravel(targetBlockPos[0], targetBlockPos[1] + 1, targetBlockPos[2], m); + (targetedBlockID != this.dirtID && + targetedBlockID != this.grassID) || + (m != this.redflowerID && + m != this.yellowflowerID && + m != this.bushID && + m != this.redmushroomID && + m != this.brownmushroomID) || + this.checkBelowFoilage( + targetBlockPos[0], + targetBlockPos[1] + 1, + targetBlockPos[2] + ), + (m != this.sandID && m != this.gravelID) || + this.checkDownSandGravel( + targetBlockPos[0], + targetBlockPos[1] + 1, + targetBlockPos[2], + m + ); + var g = this.soundArray[targetedBlockID]; - var g = this.soundArray[targetedBlockID]; - - - if (null != g && blockDist < 15) { - var _ = 1 - blockDist / 25; - this.soundPlayer.play(g.id, g.volume * _, g.pitch) - } - var blockUnder, y = false; - return (blockUnder = noa.world.getBlockID(targetBlockPos[0], targetBlockPos[1] - 1, targetBlockPos[2])) != this.waterID && blockUnder != this.waterHackID || (y = true), - this.checkNeighbours(targetBlockPos[0], targetBlockPos[1], targetBlockPos[2], y), - true + if (null != g && blockDist < 15) { + var _ = 1 - blockDist / 25; + this.soundPlayer.play(g.id, g.volume * _, g.pitch); } + var blockUnder, + y = false; + return ( + ((blockUnder = noa.world.getBlockID( + targetBlockPos[0], + targetBlockPos[1] - 1, + targetBlockPos[2] + )) != this.waterID && + blockUnder != this.waterHackID) || + (y = true), + this.checkNeighbours( + targetBlockPos[0], + targetBlockPos[1], + targetBlockPos[2], + y + ), + true + ); + } } - } - }, { - key: "setChangedBlockHandler", - value: function(e) { - this.changedBlockHandler = e - } - }, { - key: "setPlayer", - value: function(e) { - this.player = e - } - }, { - key: "setHostInfo", - value: function(e) { - if (this.hostInfo = e, - this.hostInfo.gameFull || this.hostInfo.noSuchGame) { - if (!t) - var t = i(194)({}); - this.hostInfo.noSuchGame ? (t.show(4), - document.body.style.overflow = "hidden") : t.show(2), - window.addEventListener("resize", function(e) { - t.resize() - }) + }, + }, + { + key: "setChangedBlockHandler", + value: function (e) { + this.changedBlockHandler = e; + }, + }, + { + key: "setPlayer", + value: function (e) { + this.player = e; + }, + }, + { + key: "setHostInfo", + value: function (e) { + if ( + ((this.hostInfo = e), + this.hostInfo.gameFull || this.hostInfo.noSuchGame) + ) { + if (!t) var t = i(194)({}); + this.hostInfo.noSuchGame + ? (t.show(4), (document.body.style.overflow = "hidden")) + : t.show(2), + window.addEventListener("resize", function (e) { + t.resize(); + }); } - } - }, { - key: "getPlayerNames", - value: function() { - return this.network.getSpawnedPlayerNames() - } - }, { - key: "kickPlayer", - value: function(e) { - return this.network.kickPlayer(e) - } - }, { - key: "teleportToPlayer", - value: function(playerName) { + }, + }, + { + key: "getPlayerNames", + value: function () { + return this.network.getSpawnedPlayerNames(); + }, + }, + { + key: "kickPlayer", + value: function (e) { + return this.network.kickPlayer(e); + }, + }, + { + key: "teleportToPlayer", + value: function (playerName) { for (var curPlayer in this.network.state.players) - if (this.network.state.players[curPlayer].state.name === playerName) { - var curPlayerPos = this.network.state.players[curPlayer].state.position; - - noa.entities.setPhysicsInterpolation(noa.playerEntity, false); - noa.entities.setPosition(noa.playerEntity, curPlayerPos.x, curPlayerPos.y, curPlayerPos.z); - - setTimeout(function() { - noa.entities.setPhysicsInterpolation(noa.playerEntity, true) - }, 100); + if ( + this.network.state.players[curPlayer].state.name === + playerName + ) { + var curPlayerPos = + this.network.state.players[curPlayer].state.position; - return "Teleporting to " + playerName + " " + JSON.stringify(curPlayerPos) - } - return "No such player" - } - }, { - key: "setSpawn", - value: function() { - return this.network.setSpawnToCurrentPosition() - } - }, { - key: "teleportTo", - value: function(e) { + noa.entities.setPhysicsInterpolation( + noa.playerEntity, + false + ); + noa.entities.setPosition( + noa.playerEntity, + curPlayerPos.x, + curPlayerPos.y, + curPlayerPos.z + ); + + setTimeout(function () { + noa.entities.setPhysicsInterpolation( + noa.playerEntity, + true + ); + }, 100); + + return ( + "Teleporting to " + + playerName + + " " + + JSON.stringify(curPlayerPos) + ); + } + return "No such player"; + }, + }, + { + key: "setSpawn", + value: function () { + return this.network.setSpawnToCurrentPosition(); + }, + }, + { + key: "teleportTo", + value: function (e) { var t = this.network.getPositionFor(e); - return null === t ? e + ": no such player" : (this.setPlayerPosition([t.x, t.y, t.z]), - "teleported to " + e) - } - }]) && s(t.prototype, r), - c && s(t, c), - e - }() - , u = t.a = c -} -, function(e, t, i) { - var n = i(6) - , r = i(5).document - , o = n(r) && n(r.createElement); - e.exports = function(e) { - return o ? r.createElement(e) : {} - } -} -, function(e, t, i) { - var n = i(14) - , r = i(5) - , o = r["__core-js_shared__"] || (r["__core-js_shared__"] = {}); - (e.exports = function(e, t) { - return o[e] || (o[e] = void 0 !== t ? t : {}) - } - )("versions", []).push({ - version: n.version, - mode: i(47) ? "pure" : "global", - copyright: "© 2018 Denis Pushkarev (zloirock.ru)" - }) -} -, function(e, t, i) { - t.f = i(8) -} -, function(e, t, i) { - var n = i(96)("keys") - , r = i(46); - e.exports = function(e) { - return n[e] || (n[e] = r(e)) - } -} -, function(e, t) { - e.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",") -} -, function(e, t, i) { + return null === t + ? e + ": no such player" + : (this.setPlayerPosition([t.x, t.y, t.z]), + "teleported to " + e); + }, + }, + ]) && s(t.prototype, r), + c && s(t, c), + e + ); + })(), + u = (t.a = c); + }, + function (e, t, i) { + var n = i(6), + r = i(5).document, + o = n(r) && n(r.createElement); + e.exports = function (e) { + return o ? r.createElement(e) : {}; + }; + }, + function (e, t, i) { + var n = i(14), + r = i(5), + o = r["__core-js_shared__"] || (r["__core-js_shared__"] = {}); + (e.exports = function (e, t) { + return o[e] || (o[e] = void 0 !== t ? t : {}); + })("versions", []).push({ + version: n.version, + mode: i(47) ? "pure" : "global", + copyright: "© 2018 Denis Pushkarev (zloirock.ru)", + }); + }, + function (e, t, i) { + t.f = i(8); + }, + function (e, t, i) { + var n = i(96)("keys"), + r = i(46); + e.exports = function (e) { + return n[e] || (n[e] = r(e)); + }; + }, + function (e, t) { + e.exports = + "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split( + "," + ); + }, + function (e, t, i) { var n = i(36); - e.exports = Array.isArray || function(e) { - return "Array" == n(e) - } -} -, function(e, t, i) { + e.exports = + Array.isArray || + function (e) { + return "Array" == n(e); + }; + }, + function (e, t, i) { var n = i(5).document; - e.exports = n && n.documentElement -} -, function(e, t, i) { - var n = i(6) - , r = i(4) - , o = function(e, t) { - if (r(e), - !n(t) && null !== t) - throw TypeError(t + ": can't set as prototype!") - }; + e.exports = n && n.documentElement; + }, + function (e, t, i) { + var n = i(6), + r = i(4), + o = function (e, t) { + if ((r(e), !n(t) && null !== t)) + throw TypeError(t + ": can't set as prototype!"); + }; e.exports = { - set: Object.setPrototypeOf || ("__proto__"in {} ? function(e, t, n) { - try { - (n = i(34)(Function.call, i(29).f(Object.prototype, "__proto__").set, 2))(e, []), - t = !(e instanceof Array) - } catch (e) { - t = true - } - return function(e, i) { - return o(e, i), - t ? e.__proto__ = i : n(e, i), - e - } - }({}, false) : void 0), - check: o - } -} -, function(e, t) { - e.exports = "\t\n\v\f\r   ᠎              \u2028\u2029\ufeff" -} -, function(e, t, i) { - var n = i(6) - , r = i(102).set; - e.exports = function(e, t, i) { - var o, a = t.constructor; - return a !== i && "function" == typeof a && (o = a.prototype) !== i.prototype && n(o) && r && r(e, o), - e - } -} -, function(e, t, i) { - "use strict"; - var n = i(28) - , r = i(37); - e.exports = function(e) { - var t = String(r(this)) - , i = "" - , o = n(e); - if (o < 0 || o == 1 / 0) - throw RangeError("Count can't be negative"); - for (; o > 0; (o >>>= 1) && (t += t)) - 1 & o && (i += t); - return i - } -} -, function(e, t) { - e.exports = Math.sign || function(e) { - return 0 == (e = +e) || e != e ? e : e < 0 ? -1 : 1 - } -} -, function(e, t) { - var i = Math.expm1; - e.exports = !i || i(10) > 22025.465794806718 || i(10) < 22025.465794806718 || -2e-17 != i(-2e-17) ? function(e) { - return 0 == (e = +e) ? e : e > -1e-6 && e < 1e-6 ? e + e * e / 2 : Math.exp(e) - 1 - } - : i -} -, function(e, t, i) { - var n = i(28) - , r = i(37); - e.exports = function(e) { - return function(t, i) { - var o, a, s = String(r(t)), c = n(i), u = s.length; - return c < 0 || c >= u ? e ? "" : void 0 : (o = s.charCodeAt(c)) < 55296 || o > 56319 || c + 1 === u || (a = s.charCodeAt(c + 1)) < 56320 || a > 57343 ? e ? s.charAt(c) : o : e ? s.slice(c, c + 2) : a - 56320 + (o - 55296 << 10) + 65536 - } - } -} -, function(e, t, i) { - "use strict"; - var n = i(47) - , r = i(0) - , o = i(19) - , a = i(23) - , s = i(57) - , c = i(152) - , u = i(56) - , l = i(52) - , h = i(8)("iterator") - , f = !([].keys && "next"in [].keys()) - , d = function() { - return this + set: + Object.setPrototypeOf || + ("__proto__" in {} + ? (function (e, t, n) { + try { + (n = i(34)( + Function.call, + i(29).f(Object.prototype, "__proto__").set, + 2 + ))(e, []), + (t = !(e instanceof Array)); + } catch (e) { + t = true; + } + return function (e, i) { + return o(e, i), t ? (e.__proto__ = i) : n(e, i), e; + }; + })({}, false) + : void 0), + check: o, }; - e.exports = function(e, t, i, p, m, g, _) { - c(i, t, p); - var v, y, b, E = function(e) { - if (!f && e in S) - return S[e]; - switch (e) { + }, + function (e, t) { + e.exports = "\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"; + }, + function (e, t, i) { + var n = i(6), + r = i(102).set; + e.exports = function (e, t, i) { + var o, + a = t.constructor; + return ( + a !== i && + "function" == typeof a && + (o = a.prototype) !== i.prototype && + n(o) && + r && + r(e, o), + e + ); + }; + }, + function (e, t, i) { + "use strict"; + var n = i(28), + r = i(37); + e.exports = function (e) { + var t = String(r(this)), + i = "", + o = n(e); + if (o < 0 || o == 1 / 0) throw RangeError("Count can't be negative"); + for (; o > 0; (o >>>= 1) && (t += t)) 1 & o && (i += t); + return i; + }; + }, + function (e, t) { + e.exports = + Math.sign || + function (e) { + return 0 == (e = +e) || e != e ? e : e < 0 ? -1 : 1; + }; + }, + function (e, t) { + var i = Math.expm1; + e.exports = + !i || + i(10) > 22025.465794806718 || + i(10) < 22025.465794806718 || + -2e-17 != i(-2e-17) + ? function (e) { + return 0 == (e = +e) + ? e + : e > -1e-6 && e < 1e-6 + ? e + (e * e) / 2 + : Math.exp(e) - 1; + } + : i; + }, + function (e, t, i) { + var n = i(28), + r = i(37); + e.exports = function (e) { + return function (t, i) { + var o, + a, + s = String(r(t)), + c = n(i), + u = s.length; + return c < 0 || c >= u + ? e + ? "" + : void 0 + : (o = s.charCodeAt(c)) < 55296 || + o > 56319 || + c + 1 === u || + (a = s.charCodeAt(c + 1)) < 56320 || + a > 57343 + ? e + ? s.charAt(c) + : o + : e + ? s.slice(c, c + 2) + : a - 56320 + ((o - 55296) << 10) + 65536; + }; + }; + }, + function (e, t, i) { + "use strict"; + var n = i(47), + r = i(0), + o = i(19), + a = i(23), + s = i(57), + c = i(152), + u = i(56), + l = i(52), + h = i(8)("iterator"), + f = !([].keys && "next" in [].keys()), + d = function () { + return this; + }; + e.exports = function (e, t, i, p, m, g, _) { + c(i, t, p); + var v, + y, + b, + E = function (e) { + if (!f && e in S) return S[e]; + switch (e) { case "keys": case "values": - return function() { - return new i(this,e) - } - } - return function() { - return new i(this,e) - } - }, T = t + " Iterator", A = "values" == m, x = false, S = e.prototype, C = S[h] || S["@@iterator"] || m && S[m], P = C || E(m), R = m ? A ? E("entries") : P : void 0, M = "Array" == t && S.entries || C; - if (M && (b = l(M.call(new e))) !== Object.prototype && b.next && (u(b, T, true), - n || "function" == typeof b[h] || a(b, h, d)), - A && C && "values" !== C.name && (x = true, - P = function() { - return C.call(this) - } - ), - n && !_ || !f && !x && S[h] || a(S, h, P), - s[t] = P, - s[T] = d, + return function () { + return new i(this, e); + }; + } + return function () { + return new i(this, e); + }; + }, + T = t + " Iterator", + A = "values" == m, + x = false, + S = e.prototype, + C = S[h] || S["@@iterator"] || (m && S[m]), + P = C || E(m), + R = m ? (A ? E("entries") : P) : void 0, + M = ("Array" == t && S.entries) || C; + if ( + (M && + (b = l(M.call(new e()))) !== Object.prototype && + b.next && + (u(b, T, true), n || "function" == typeof b[h] || a(b, h, d)), + A && + C && + "values" !== C.name && + ((x = true), + (P = function () { + return C.call(this); + })), + (n && !_) || (!f && !x && S[h]) || a(S, h, P), + (s[t] = P), + (s[T] = d), m) - if (v = { - values: A ? P : E("values"), - keys: g ? P : E("keys"), - entries: R - }, - _) - for (y in v) - y in S || o(S, y, v[y]); - else - r(r.P + r.F * (f || x), t, v); - return v - } -} -, function(e, t, i) { - var n = i(111) - , r = i(37); - e.exports = function(e, t, i) { - if (n(t)) - throw TypeError("String#" + i + " doesn't accept regex!"); - return String(r(e)) - } -} -, function(e, t, i) { - var n = i(6) - , r = i(36) - , o = i(8)("match"); - e.exports = function(e) { - var t; - return n(e) && (void 0 !== (t = e[o]) ? !!t : "RegExp" == r(e)) - } -} -, function(e, t, i) { + ) + if ( + ((v = { + values: A ? P : E("values"), + keys: g ? P : E("keys"), + entries: R, + }), + _) + ) + for (y in v) y in S || o(S, y, v[y]); + else r(r.P + r.F * (f || x), t, v); + return v; + }; + }, + function (e, t, i) { + var n = i(111), + r = i(37); + e.exports = function (e, t, i) { + if (n(t)) throw TypeError("String#" + i + " doesn't accept regex!"); + return String(r(e)); + }; + }, + function (e, t, i) { + var n = i(6), + r = i(36), + o = i(8)("match"); + e.exports = function (e) { + var t; + return n(e) && (void 0 !== (t = e[o]) ? !!t : "RegExp" == r(e)); + }; + }, + function (e, t, i) { var n = i(8)("match"); - e.exports = function(e) { - var t = /./; + e.exports = function (e) { + var t = /./; + try { + "/./"[e](t); + } catch (i) { try { - "/./"[e](t) - } catch (i) { - try { - return t[n] = false, - !"/./"[e](t) - } catch (e) {} - } - return true - } -} -, function(e, t, i) { - var n = i(57) - , r = i(8)("iterator") - , o = Array.prototype; - e.exports = function(e) { - return void 0 !== e && (n.Array === e || o[r] === e) - } -} -, function(e, t, i) { + return (t[n] = false), !"/./"[e](t); + } catch (e) {} + } + return true; + }; + }, + function (e, t, i) { + var n = i(57), + r = i(8)("iterator"), + o = Array.prototype; + e.exports = function (e) { + return void 0 !== e && (n.Array === e || o[r] === e); + }; + }, + function (e, t, i) { "use strict"; - var n = i(12) - , r = i(45); - e.exports = function(e, t, i) { - t in e ? n.f(e, t, r(0, i)) : e[t] = i - } -} -, function(e, t, i) { - var n = i(66) - , r = i(8)("iterator") - , o = i(57); - e.exports = i(14).getIteratorMethod = function(e) { - if (null != e) - return e[r] || e["@@iterator"] || o[n(e)] - } -} -, function(e, t, i) { + var n = i(12), + r = i(45); + e.exports = function (e, t, i) { + t in e ? n.f(e, t, r(0, i)) : (e[t] = i); + }; + }, + function (e, t, i) { + var n = i(66), + r = i(8)("iterator"), + o = i(57); + e.exports = i(14).getIteratorMethod = function (e) { + if (null != e) return e[r] || e["@@iterator"] || o[n(e)]; + }; + }, + function (e, t, i) { "use strict"; - var n = i(20) - , r = i(49) - , o = i(10); - e.exports = function(e) { - for (var t = n(this), i = o(t.length), a = arguments.length, s = r(a > 1 ? arguments[1] : void 0, i), c = a > 2 ? arguments[2] : void 0, u = void 0 === c ? i : r(c, i); u > s; ) - t[s++] = e; - return t - } -} -, function(e, t, i) { + var n = i(20), + r = i(49), + o = i(10); + e.exports = function (e) { + for ( + var t = n(this), + i = o(t.length), + a = arguments.length, + s = r(a > 1 ? arguments[1] : void 0, i), + c = a > 2 ? arguments[2] : void 0, + u = void 0 === c ? i : r(c, i); + u > s; + + ) + t[s++] = e; + return t; + }; + }, + function (e, t, i) { "use strict"; - var n = i(58) - , r = i(156) - , o = i(57) - , a = i(24); - e.exports = i(109)(Array, "Array", function(e, t) { - this._t = a(e), - this._i = 0, - this._k = t - }, function() { - var e = this._t - , t = this._k - , i = this._i++; - return !e || i >= e.length ? (this._t = void 0, - r(1)) : r(0, "keys" == t ? i : "values" == t ? e[i] : [i, e[i]]) - }, "values"), - o.Arguments = o.Array, - n("keys"), - n("values"), - n("entries") -} -, function(e, t, i) { + var n = i(58), + r = i(156), + o = i(57), + a = i(24); + (e.exports = i(109)( + Array, + "Array", + function (e, t) { + (this._t = a(e)), (this._i = 0), (this._k = t); + }, + function () { + var e = this._t, + t = this._k, + i = this._i++; + return !e || i >= e.length + ? ((this._t = void 0), r(1)) + : r(0, "keys" == t ? i : "values" == t ? e[i] : [i, e[i]]); + }, + "values" + )), + (o.Arguments = o.Array), + n("keys"), + n("values"), + n("entries"); + }, + function (e, t, i) { "use strict"; - var n, r, o = i(78), a = RegExp.prototype.exec, s = String.prototype.replace, c = a, u = (n = /a/, - r = /b*/g, - a.call(n, "a"), - a.call(r, "a"), - 0 !== n.lastIndex || 0 !== r.lastIndex), l = void 0 !== /()??/.exec("")[1]; - (u || l) && (c = function(e) { - var t, i, n, r, c = this; - return l && (i = new RegExp("^" + c.source + "$(?!\\s)",o.call(c))), - u && (t = c.lastIndex), - n = a.call(c, e), - u && n && (c.lastIndex = c.global ? n.index + n[0].length : t), - l && n && n.length > 1 && s.call(n[0], i, function() { - for (r = 1; r < arguments.length - 2; r++) - void 0 === arguments[r] && (n[r] = void 0) - }), - n - } - ), - e.exports = c -} -, function(e, t, i) { + var n, + r, + o = i(78), + a = RegExp.prototype.exec, + s = String.prototype.replace, + c = a, + u = + ((n = /a/), + (r = /b*/g), + a.call(n, "a"), + a.call(r, "a"), + 0 !== n.lastIndex || 0 !== r.lastIndex), + l = void 0 !== /()??/.exec("")[1]; + (u || l) && + (c = function (e) { + var t, + i, + n, + r, + c = this; + return ( + l && (i = new RegExp("^" + c.source + "$(?!\\s)", o.call(c))), + u && (t = c.lastIndex), + (n = a.call(c, e)), + u && n && (c.lastIndex = c.global ? n.index + n[0].length : t), + l && + n && + n.length > 1 && + s.call(n[0], i, function () { + for (r = 1; r < arguments.length - 2; r++) + void 0 === arguments[r] && (n[r] = void 0); + }), + n + ); + }), + (e.exports = c); + }, + function (e, t, i) { "use strict"; var n = i(108)(true); - e.exports = function(e, t, i) { - return t + (i ? n(e, t).length : 1) - } -} -, function(e, t, i) { - var n, r, o, a = i(34), s = i(146), c = i(101), u = i(95), l = i(5), h = l.process, f = l.setImmediate, d = l.clearImmediate, p = l.MessageChannel, m = l.Dispatch, g = 0, _ = {}, v = function() { + e.exports = function (e, t, i) { + return t + (i ? n(e, t).length : 1); + }; + }, + function (e, t, i) { + var n, + r, + o, + a = i(34), + s = i(146), + c = i(101), + u = i(95), + l = i(5), + h = l.process, + f = l.setImmediate, + d = l.clearImmediate, + p = l.MessageChannel, + m = l.Dispatch, + g = 0, + _ = {}, + v = function () { var e = +this; if (_.hasOwnProperty(e)) { - var t = _[e]; - delete _[e], - t() + var t = _[e]; + delete _[e], t(); } - }, y = function(e) { - v.call(e.data) - }; - f && d || (f = function(e) { - for (var t = [], i = 1; arguments.length > i; ) - t.push(arguments[i++]); - return _[++g] = function() { - s("function" == typeof e ? e : Function(e), t) - } - , - n(g), - g - } - , - d = function(e) { - delete _[e] - } - , - "process" == i(36)(h) ? n = function(e) { - h.nextTick(a(v, e, 1)) - } - : m && m.now ? n = function(e) { - m.now(a(v, e, 1)) - } - : p ? (o = (r = new p).port2, - r.port1.onmessage = y, - n = a(o.postMessage, o, 1)) : l.addEventListener && "function" == typeof postMessage && !l.importScripts ? (n = function(e) { - l.postMessage(e + "", "*") - } - , - l.addEventListener("message", y, false)) : n = "onreadystatechange"in u("script") ? function(e) { - c.appendChild(u("script")).onreadystatechange = function() { - c.removeChild(this), - v.call(e) - } - } - : function(e) { - setTimeout(a(v, e, 1), 0) - } - ), - e.exports = { + }, + y = function (e) { + v.call(e.data); + }; + (f && d) || + ((f = function (e) { + for (var t = [], i = 1; arguments.length > i; ) t.push(arguments[i++]); + return ( + (_[++g] = function () { + s("function" == typeof e ? e : Function(e), t); + }), + n(g), + g + ); + }), + (d = function (e) { + delete _[e]; + }), + "process" == i(36)(h) + ? (n = function (e) { + h.nextTick(a(v, e, 1)); + }) + : m && m.now + ? (n = function (e) { + m.now(a(v, e, 1)); + }) + : p + ? ((o = (r = new p()).port2), + (r.port1.onmessage = y), + (n = a(o.postMessage, o, 1))) + : l.addEventListener && + "function" == typeof postMessage && + !l.importScripts + ? ((n = function (e) { + l.postMessage(e + "", "*"); + }), + l.addEventListener("message", y, false)) + : (n = + "onreadystatechange" in u("script") + ? function (e) { + c.appendChild(u("script")).onreadystatechange = function () { + c.removeChild(this), v.call(e); + }; + } + : function (e) { + setTimeout(a(v, e, 1), 0); + })), + (e.exports = { set: f, - clear: d - } -} -, function(e, t, i) { + clear: d, + }); + }, + function (e, t, i) { "use strict"; - var n = i(5) - , r = i(13) - , o = i(47) - , a = i(84) - , s = i(23) - , c = i(61) - , u = i(3) - , l = i(60) - , h = i(28) - , f = i(10) - , d = i(164) - , p = i(51).f - , m = i(12).f - , g = i(116) - , _ = i(56) - , v = "prototype" - , y = "Wrong index!" - , b = n.ArrayBuffer - , E = n.DataView - , T = n.Math - , A = n.RangeError - , x = n.Infinity - , S = b - , C = T.abs - , P = T.pow - , R = T.floor - , M = T.log - , O = T.LN2 - , w = r ? "_b" : "buffer" - , I = r ? "_l" : "byteLength" - , D = r ? "_o" : "byteOffset"; + var n = i(5), + r = i(13), + o = i(47), + a = i(84), + s = i(23), + c = i(61), + u = i(3), + l = i(60), + h = i(28), + f = i(10), + d = i(164), + p = i(51).f, + m = i(12).f, + g = i(116), + _ = i(56), + v = "prototype", + y = "Wrong index!", + b = n.ArrayBuffer, + E = n.DataView, + T = n.Math, + A = n.RangeError, + x = n.Infinity, + S = b, + C = T.abs, + P = T.pow, + R = T.floor, + M = T.log, + O = T.LN2, + w = r ? "_b" : "buffer", + I = r ? "_l" : "byteLength", + D = r ? "_o" : "byteOffset"; function L(e, t, i) { - var n, r, o, a = new Array(i), s = 8 * i - t - 1, c = (1 << s) - 1, u = c >> 1, l = 23 === t ? P(2, -24) - P(2, -77) : 0, h = 0, f = e < 0 || 0 === e && 1 / e < 0 ? 1 : 0; - for ((e = C(e)) != e || e === x ? (r = e != e ? 1 : 0, - n = c) : (n = R(M(e) / O), - e * (o = P(2, -n)) < 1 && (n--, - o *= 2), - (e += n + u >= 1 ? l / o : l * P(2, 1 - u)) * o >= 2 && (n++, - o /= 2), - n + u >= c ? (r = 0, - n = c) : n + u >= 1 ? (r = (e * o - 1) * P(2, t), - n += u) : (r = e * P(2, u - 1) * P(2, t), - n = 0)); t >= 8; a[h++] = 255 & r, - r /= 256, - t -= 8) - ; - for (n = n << t | r, - s += t; s > 0; a[h++] = 255 & n, - n /= 256, - s -= 8) - ; - return a[--h] |= 128 * f, - a + var n, + r, + o, + a = new Array(i), + s = 8 * i - t - 1, + c = (1 << s) - 1, + u = c >> 1, + l = 23 === t ? P(2, -24) - P(2, -77) : 0, + h = 0, + f = e < 0 || (0 === e && 1 / e < 0) ? 1 : 0; + for ( + (e = C(e)) != e || e === x + ? ((r = e != e ? 1 : 0), (n = c)) + : ((n = R(M(e) / O)), + e * (o = P(2, -n)) < 1 && (n--, (o *= 2)), + (e += n + u >= 1 ? l / o : l * P(2, 1 - u)) * o >= 2 && + (n++, (o /= 2)), + n + u >= c + ? ((r = 0), (n = c)) + : n + u >= 1 + ? ((r = (e * o - 1) * P(2, t)), (n += u)) + : ((r = e * P(2, u - 1) * P(2, t)), (n = 0))); + t >= 8; + a[h++] = 255 & r, r /= 256, t -= 8 + ); + for (n = (n << t) | r, s += t; s > 0; a[h++] = 255 & n, n /= 256, s -= 8); + return (a[--h] |= 128 * f), a; } function F(e, t, i) { - var n, r = 8 * i - t - 1, o = (1 << r) - 1, a = o >> 1, s = r - 7, c = i - 1, u = e[c--], l = 127 & u; - for (u >>= 7; s > 0; l = 256 * l + e[c], - c--, - s -= 8) - ; - for (n = l & (1 << -s) - 1, - l >>= -s, - s += t; s > 0; n = 256 * n + e[c], - c--, - s -= 8) - ; - if (0 === l) - l = 1 - a; - else { - if (l === o) - return n ? NaN : u ? -x : x; - n += P(2, t), - l -= a - } - return (u ? -1 : 1) * n * P(2, l - t) + var n, + r = 8 * i - t - 1, + o = (1 << r) - 1, + a = o >> 1, + s = r - 7, + c = i - 1, + u = e[c--], + l = 127 & u; + for (u >>= 7; s > 0; l = 256 * l + e[c], c--, s -= 8); + for ( + n = l & ((1 << -s) - 1), l >>= -s, s += t; + s > 0; + n = 256 * n + e[c], c--, s -= 8 + ); + if (0 === l) l = 1 - a; + else { + if (l === o) return n ? NaN : u ? -x : x; + (n += P(2, t)), (l -= a); + } + return (u ? -1 : 1) * n * P(2, l - t); } function B(e) { - return e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0] + return (e[3] << 24) | (e[2] << 16) | (e[1] << 8) | e[0]; } function N(e) { - return [255 & e] + return [255 & e]; } function k(e) { - return [255 & e, e >> 8 & 255] + return [255 & e, (e >> 8) & 255]; } function U(e) { - return [255 & e, e >> 8 & 255, e >> 16 & 255, e >> 24 & 255] + return [255 & e, (e >> 8) & 255, (e >> 16) & 255, (e >> 24) & 255]; } function V(e) { - return L(e, 52, 8) + return L(e, 52, 8); } function G(e) { - return L(e, 23, 4) + return L(e, 23, 4); } function z(e, t, i) { - m(e[v], t, { - get: function() { - return this[i] - } - }) + m(e[v], t, { + get: function () { + return this[i]; + }, + }); } function j(e, t, i, n) { - var r = d(+i); - if (r + t > e[I]) - throw A(y); - var o = e[w]._b - , a = r + e[D] - , s = o.slice(a, a + t); - return n ? s : s.reverse() + var r = d(+i); + if (r + t > e[I]) throw A(y); + var o = e[w]._b, + a = r + e[D], + s = o.slice(a, a + t); + return n ? s : s.reverse(); } function H(e, t, i, n, r, o) { - var a = d(+i); - if (a + t > e[I]) - throw A(y); - for (var s = e[w]._b, c = a + e[D], u = n(+r), l = 0; l < t; l++) - s[c + l] = u[o ? l : t - l - 1] + var a = d(+i); + if (a + t > e[I]) throw A(y); + for (var s = e[w]._b, c = a + e[D], u = n(+r), l = 0; l < t; l++) + s[c + l] = u[o ? l : t - l - 1]; } if (a.ABV) { - if (!u(function() { - b(1) - }) || !u(function() { - new b(-1) - }) || u(function() { - return new b, - new b(1.5), - new b(NaN), - "ArrayBuffer" != b.name - })) { - for (var W, X = (b = function(e) { - return l(this, b), - new S(d(e)) - } - )[v] = S[v], Y = p(S), K = 0; Y.length > K; ) - (W = Y[K++])in b || s(b, W, S[W]); - o || (X.constructor = b) - } - var Q = new E(new b(2)) - , q = E[v].setInt8; - Q.setInt8(0, 2147483648), + if ( + !u(function () { + b(1); + }) || + !u(function () { + new b(-1); + }) || + u(function () { + return new b(), new b(1.5), new b(NaN), "ArrayBuffer" != b.name; + }) + ) { + for ( + var W, + X = ((b = function (e) { + return l(this, b), new S(d(e)); + })[v] = S[v]), + Y = p(S), + K = 0; + Y.length > K; + + ) + (W = Y[K++]) in b || s(b, W, S[W]); + o || (X.constructor = b); + } + var Q = new E(new b(2)), + q = E[v].setInt8; + Q.setInt8(0, 2147483648), Q.setInt8(1, 2147483649), - !Q.getInt8(0) && Q.getInt8(1) || c(E[v], { - setInt8: function(e, t) { - q.call(this, e, t << 24 >> 24) + (!Q.getInt8(0) && Q.getInt8(1)) || + c( + E[v], + { + setInt8: function (e, t) { + q.call(this, e, (t << 24) >> 24); + }, + setUint8: function (e, t) { + q.call(this, e, (t << 24) >> 24); + }, }, - setUint8: function(e, t) { - q.call(this, e, t << 24 >> 24) - } - }, true) + true + ); } else - b = function(e) { - l(this, b, "ArrayBuffer"); - var t = d(e); - this._b = g.call(new Array(t), 0), - this[I] = t - } - , - E = function(e, t, i) { - l(this, E, "DataView"), - l(e, b, "DataView"); - var n = e[I] - , r = h(t); - if (r < 0 || r > n) - throw A("Wrong offset!"); - if (r + (i = void 0 === i ? n - r : f(i)) > n) - throw A("Wrong length!"); - this[w] = e, - this[D] = r, - this[I] = i - } - , - r && (z(b, "byteLength", "_l"), - z(E, "buffer", "_b"), - z(E, "byteLength", "_l"), - z(E, "byteOffset", "_o")), + (b = function (e) { + l(this, b, "ArrayBuffer"); + var t = d(e); + (this._b = g.call(new Array(t), 0)), (this[I] = t); + }), + (E = function (e, t, i) { + l(this, E, "DataView"), l(e, b, "DataView"); + var n = e[I], + r = h(t); + if (r < 0 || r > n) throw A("Wrong offset!"); + if (r + (i = void 0 === i ? n - r : f(i)) > n) + throw A("Wrong length!"); + (this[w] = e), (this[D] = r), (this[I] = i); + }), + r && + (z(b, "byteLength", "_l"), + z(E, "buffer", "_b"), + z(E, "byteLength", "_l"), + z(E, "byteOffset", "_o")), c(E[v], { - getInt8: function(e) { - return j(this, 1, e)[0] << 24 >> 24 - }, - getUint8: function(e) { - return j(this, 1, e)[0] - }, - getInt16: function(e) { - var t = j(this, 2, e, arguments[1]); - return (t[1] << 8 | t[0]) << 16 >> 16 - }, - getUint16: function(e) { - var t = j(this, 2, e, arguments[1]); - return t[1] << 8 | t[0] - }, - getInt32: function(e) { - return B(j(this, 4, e, arguments[1])) - }, - getUint32: function(e) { - return B(j(this, 4, e, arguments[1])) >>> 0 - }, - getFloat32: function(e) { - return F(j(this, 4, e, arguments[1]), 23, 4) - }, - getFloat64: function(e) { - return F(j(this, 8, e, arguments[1]), 52, 8) - }, - setInt8: function(e, t) { - H(this, 1, e, N, t) - }, - setUint8: function(e, t) { - H(this, 1, e, N, t) - }, - setInt16: function(e, t) { - H(this, 2, e, k, t, arguments[2]) - }, - setUint16: function(e, t) { - H(this, 2, e, k, t, arguments[2]) - }, - setInt32: function(e, t) { - H(this, 4, e, U, t, arguments[2]) - }, - setUint32: function(e, t) { - H(this, 4, e, U, t, arguments[2]) - }, - setFloat32: function(e, t) { - H(this, 4, e, G, t, arguments[2]) - }, - setFloat64: function(e, t) { - H(this, 8, e, V, t, arguments[2]) - } + getInt8: function (e) { + return (j(this, 1, e)[0] << 24) >> 24; + }, + getUint8: function (e) { + return j(this, 1, e)[0]; + }, + getInt16: function (e) { + var t = j(this, 2, e, arguments[1]); + return (((t[1] << 8) | t[0]) << 16) >> 16; + }, + getUint16: function (e) { + var t = j(this, 2, e, arguments[1]); + return (t[1] << 8) | t[0]; + }, + getInt32: function (e) { + return B(j(this, 4, e, arguments[1])); + }, + getUint32: function (e) { + return B(j(this, 4, e, arguments[1])) >>> 0; + }, + getFloat32: function (e) { + return F(j(this, 4, e, arguments[1]), 23, 4); + }, + getFloat64: function (e) { + return F(j(this, 8, e, arguments[1]), 52, 8); + }, + setInt8: function (e, t) { + H(this, 1, e, N, t); + }, + setUint8: function (e, t) { + H(this, 1, e, N, t); + }, + setInt16: function (e, t) { + H(this, 2, e, k, t, arguments[2]); + }, + setUint16: function (e, t) { + H(this, 2, e, k, t, arguments[2]); + }, + setInt32: function (e, t) { + H(this, 4, e, U, t, arguments[2]); + }, + setUint32: function (e, t) { + H(this, 4, e, U, t, arguments[2]); + }, + setFloat32: function (e, t) { + H(this, 4, e, G, t, arguments[2]); + }, + setFloat64: function (e, t) { + H(this, 8, e, V, t, arguments[2]); + }, }); _(b, "ArrayBuffer"), - _(E, "DataView"), - s(E[v], a.VIEW, true), - t.ArrayBuffer = b, - t.DataView = E -} -, function(e, t) { - e.exports = function(e) { - return e.webpackPolyfill || (e.deprecate = function() {} - , - e.paths = [], - e.children || (e.children = []), - Object.defineProperty(e, "loaded", { + _(E, "DataView"), + s(E[v], a.VIEW, true), + (t.ArrayBuffer = b), + (t.DataView = E); + }, + function (e, t) { + e.exports = function (e) { + return ( + e.webpackPolyfill || + ((e.deprecate = function () {}), + (e.paths = []), + e.children || (e.children = []), + Object.defineProperty(e, "loaded", { enumerable: true, - get: function() { - return e.l - } - }), - Object.defineProperty(e, "id", { + get: function () { + return e.l; + }, + }), + Object.defineProperty(e, "id", { enumerable: true, - get: function() { - return e.i - } - }), - e.webpackPolyfill = 1), + get: function () { + return e.i; + }, + }), + (e.webpackPolyfill = 1)), e - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; - (function(t, n, r) { - var o = i(86); - function a(e) { - var t = this; - this.next = null, - this.entry = null, - this.finish = function() { - !function(e, t, i) { - var n = e.entry; - e.entry = null; - for (; n; ) { - var r = n.callback; - t.pendingcb--, - r(i), - n = n.next - } - t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e - }(t, e) - } - } - e.exports = v; - var s, c = !t.browser && ["v0.10", "v0.9."].indexOf(t.version.slice(0, 5)) > -1 ? n : o.nextTick; - v.WritableState = _; - var u = i(68); - u.inherits = i(1); - var l = { - deprecate: i(409) - } - , h = i(170) - , f = i(2).Buffer - , d = r.Uint8Array || function() {} - ; - var p, m = i(171); - function g() {} - function _(e, t) { - s = s || i(54), - e = e || {}; - var n = t instanceof s; - this.objectMode = !!e.objectMode, - n && (this.objectMode = this.objectMode || !!e.writableObjectMode); - var r = e.highWaterMark - , u = e.writableHighWaterMark - , l = this.objectMode ? 16 : 16384; - this.highWaterMark = r || 0 === r ? r : n && (u || 0 === u) ? u : l, - this.highWaterMark = Math.floor(this.highWaterMark), - this.finalCalled = false, - this.needDrain = false, - this.ending = false, - this.ended = false, - this.finished = false, - this.destroyed = false; - var h = false === e.decodeStrings; - this.decodeStrings = !h, - this.defaultEncoding = e.defaultEncoding || "utf8", - this.length = 0, - this.writing = false, - this.corked = 0, - this.sync = true, - this.bufferProcessing = false, - this.onwrite = function(e) { - !function(e, t) { - var i = e._writableState - , n = i.sync - , r = i.writecb; - if (function(e) { - e.writing = false, - e.writecb = null, - e.length -= e.writelen, - e.writelen = 0 - }(i), - t) - !function(e, t, i, n, r) { - --t.pendingcb, - i ? (o.nextTick(r, n), - o.nextTick(x, e, t), - e._writableState.errorEmitted = true, - e.emit("error", n)) : (r(n), - e._writableState.errorEmitted = true, - e.emit("error", n), - x(e, t)) - }(e, i, n, t, r); - else { - var a = T(i); - a || i.corked || i.bufferProcessing || !i.bufferedRequest || E(e, i), - n ? c(b, e, i, a, r) : b(e, i, a, r) - } - }(t, e) - } - , - this.writecb = null, - this.writelen = 0, - this.bufferedRequest = null, - this.lastBufferedRequest = null, - this.pendingcb = 0, - this.prefinished = false, - this.errorEmitted = false, - this.bufferedRequestCount = 0, - this.corkedRequestsFree = new a(this) - } - function v(e) { - if (s = s || i(54), - !(p.call(v, this) || this instanceof s)) - return new v(e); - this._writableState = new _(e,this), - this.writable = true, - e && ("function" == typeof e.write && (this._write = e.write), + (function (t, n, r) { + var o = i(86); + function a(e) { + var t = this; + (this.next = null), + (this.entry = null), + (this.finish = function () { + !(function (e, t, i) { + var n = e.entry; + e.entry = null; + for (; n; ) { + var r = n.callback; + t.pendingcb--, r(i), (n = n.next); + } + t.corkedRequestsFree + ? (t.corkedRequestsFree.next = e) + : (t.corkedRequestsFree = e); + })(t, e); + }); + } + e.exports = v; + var s, + c = + !t.browser && ["v0.10", "v0.9."].indexOf(t.version.slice(0, 5)) > -1 + ? n + : o.nextTick; + v.WritableState = _; + var u = i(68); + u.inherits = i(1); + var l = { + deprecate: i(409), + }, + h = i(170), + f = i(2).Buffer, + d = r.Uint8Array || function () {}; + var p, + m = i(171); + function g() {} + function _(e, t) { + (s = s || i(54)), (e = e || {}); + var n = t instanceof s; + (this.objectMode = !!e.objectMode), + n && (this.objectMode = this.objectMode || !!e.writableObjectMode); + var r = e.highWaterMark, + u = e.writableHighWaterMark, + l = this.objectMode ? 16 : 16384; + (this.highWaterMark = r || 0 === r ? r : n && (u || 0 === u) ? u : l), + (this.highWaterMark = Math.floor(this.highWaterMark)), + (this.finalCalled = false), + (this.needDrain = false), + (this.ending = false), + (this.ended = false), + (this.finished = false), + (this.destroyed = false); + var h = false === e.decodeStrings; + (this.decodeStrings = !h), + (this.defaultEncoding = e.defaultEncoding || "utf8"), + (this.length = 0), + (this.writing = false), + (this.corked = 0), + (this.sync = true), + (this.bufferProcessing = false), + (this.onwrite = function (e) { + !(function (e, t) { + var i = e._writableState, + n = i.sync, + r = i.writecb; + if ( + ((function (e) { + (e.writing = false), + (e.writecb = null), + (e.length -= e.writelen), + (e.writelen = 0); + })(i), + t) + ) + !(function (e, t, i, n, r) { + --t.pendingcb, + i + ? (o.nextTick(r, n), + o.nextTick(x, e, t), + (e._writableState.errorEmitted = true), + e.emit("error", n)) + : (r(n), + (e._writableState.errorEmitted = true), + e.emit("error", n), + x(e, t)); + })(e, i, n, t, r); + else { + var a = T(i); + a || + i.corked || + i.bufferProcessing || + !i.bufferedRequest || + E(e, i), + n ? c(b, e, i, a, r) : b(e, i, a, r); + } + })(t, e); + }), + (this.writecb = null), + (this.writelen = 0), + (this.bufferedRequest = null), + (this.lastBufferedRequest = null), + (this.pendingcb = 0), + (this.prefinished = false), + (this.errorEmitted = false), + (this.bufferedRequestCount = 0), + (this.corkedRequestsFree = new a(this)); + } + function v(e) { + if (((s = s || i(54)), !(p.call(v, this) || this instanceof s))) + return new v(e); + (this._writableState = new _(e, this)), + (this.writable = true), + e && + ("function" == typeof e.write && (this._write = e.write), "function" == typeof e.writev && (this._writev = e.writev), "function" == typeof e.destroy && (this._destroy = e.destroy), "function" == typeof e.final && (this._final = e.final)), - h.call(this) + h.call(this); + } + function y(e, t, i, n, r, o, a) { + (t.writelen = n), + (t.writecb = a), + (t.writing = true), + (t.sync = true), + i ? e._writev(r, t.onwrite) : e._write(r, o, t.onwrite), + (t.sync = false); + } + function b(e, t, i, n) { + i || + (function (e, t) { + 0 === t.length && + t.needDrain && + ((t.needDrain = false), e.emit("drain")); + })(e, t), + t.pendingcb--, + n(), + x(e, t); + } + function E(e, t) { + t.bufferProcessing = true; + var i = t.bufferedRequest; + if (e._writev && i && i.next) { + var n = t.bufferedRequestCount, + r = new Array(n), + o = t.corkedRequestsFree; + o.entry = i; + for (var s = 0, c = true; i; ) + (r[s] = i), i.isBuf || (c = false), (i = i.next), (s += 1); + (r.allBuffers = c), + y(e, t, true, t.length, r, "", o.finish), + t.pendingcb++, + (t.lastBufferedRequest = null), + o.next + ? ((t.corkedRequestsFree = o.next), (o.next = null)) + : (t.corkedRequestsFree = new a(t)), + (t.bufferedRequestCount = 0); + } else { + for (; i; ) { + var u = i.chunk, + l = i.encoding, + h = i.callback; + if ( + (y(e, t, false, t.objectMode ? 1 : u.length, u, l, h), + (i = i.next), + t.bufferedRequestCount--, + t.writing) + ) + break; + } + null === i && (t.lastBufferedRequest = null); } - function y(e, t, i, n, r, o, a) { - t.writelen = n, - t.writecb = a, - t.writing = true, - t.sync = true, - i ? e._writev(r, t.onwrite) : e._write(r, o, t.onwrite), - t.sync = false - } - function b(e, t, i, n) { - i || function(e, t) { - 0 === t.length && t.needDrain && (t.needDrain = false, - e.emit("drain")) - }(e, t), - t.pendingcb--, - n(), - x(e, t) - } - function E(e, t) { - t.bufferProcessing = true; - var i = t.bufferedRequest; - if (e._writev && i && i.next) { - var n = t.bufferedRequestCount - , r = new Array(n) - , o = t.corkedRequestsFree; - o.entry = i; - for (var s = 0, c = true; i; ) - r[s] = i, - i.isBuf || (c = false), - i = i.next, - s += 1; - r.allBuffers = c, - y(e, t, true, t.length, r, "", o.finish), - t.pendingcb++, - t.lastBufferedRequest = null, - o.next ? (t.corkedRequestsFree = o.next, - o.next = null) : t.corkedRequestsFree = new a(t), - t.bufferedRequestCount = 0 - } else { - for (; i; ) { - var u = i.chunk - , l = i.encoding - , h = i.callback; - if (y(e, t, false, t.objectMode ? 1 : u.length, u, l, h), - i = i.next, - t.bufferedRequestCount--, - t.writing) - break - } - null === i && (t.lastBufferedRequest = null) - } - t.bufferedRequest = i, - t.bufferProcessing = false - } - function T(e) { - return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing - } - function A(e, t) { - e._final(function(i) { - t.pendingcb--, - i && e.emit("error", i), - t.prefinished = true, - e.emit("prefinish"), - x(e, t) - }) - } - function x(e, t) { - var i = T(t); - return i && (!function(e, t) { - t.prefinished || t.finalCalled || ("function" == typeof e._final ? (t.pendingcb++, - t.finalCalled = true, - o.nextTick(A, e, t)) : (t.prefinished = true, - e.emit("prefinish"))) - }(e, t), - 0 === t.pendingcb && (t.finished = true, - e.emit("finish"))), - i - } - u.inherits(v, h), - _.prototype.getBuffer = function() { - for (var e = this.bufferedRequest, t = []; e; ) - t.push(e), - e = e.next; - return t - } - , - function() { - try { - Object.defineProperty(_.prototype, "buffer", { - get: l.deprecate(function() { - return this.getBuffer() - }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") - }) - } catch (e) {} - }(), - "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[Symbol.hasInstance] ? (p = Function.prototype[Symbol.hasInstance], - Object.defineProperty(v, Symbol.hasInstance, { - value: function(e) { - return !!p.call(this, e) || this === v && (e && e._writableState instanceof _) - } - })) : p = function(e) { - return e instanceof this - } - , - v.prototype.pipe = function() { - this.emit("error", new Error("Cannot pipe, not readable")) - } - , - v.prototype.write = function(e, t, i) { - var n, r = this._writableState, a = false, s = !r.objectMode && (n = e, - f.isBuffer(n) || n instanceof d); - return s && !f.isBuffer(e) && (e = function(e) { - return f.from(e) - }(e)), - "function" == typeof t && (i = t, - t = null), - s ? t = "buffer" : t || (t = r.defaultEncoding), + (t.bufferedRequest = i), (t.bufferProcessing = false); + } + function T(e) { + return ( + e.ending && + 0 === e.length && + null === e.bufferedRequest && + !e.finished && + !e.writing + ); + } + function A(e, t) { + e._final(function (i) { + t.pendingcb--, + i && e.emit("error", i), + (t.prefinished = true), + e.emit("prefinish"), + x(e, t); + }); + } + function x(e, t) { + var i = T(t); + return ( + i && + (!(function (e, t) { + t.prefinished || + t.finalCalled || + ("function" == typeof e._final + ? (t.pendingcb++, (t.finalCalled = true), o.nextTick(A, e, t)) + : ((t.prefinished = true), e.emit("prefinish"))); + })(e, t), + 0 === t.pendingcb && ((t.finished = true), e.emit("finish"))), + i + ); + } + u.inherits(v, h), + (_.prototype.getBuffer = function () { + for (var e = this.bufferedRequest, t = []; e; ) + t.push(e), (e = e.next); + return t; + }), + (function () { + try { + Object.defineProperty(_.prototype, "buffer", { + get: l.deprecate( + function () { + return this.getBuffer(); + }, + "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", + "DEP0003" + ), + }); + } catch (e) {} + })(), + "function" == typeof Symbol && + Symbol.hasInstance && + "function" == typeof Function.prototype[Symbol.hasInstance] + ? ((p = Function.prototype[Symbol.hasInstance]), + Object.defineProperty(v, Symbol.hasInstance, { + value: function (e) { + return ( + !!p.call(this, e) || + (this === v && e && e._writableState instanceof _) + ); + }, + })) + : (p = function (e) { + return e instanceof this; + }), + (v.prototype.pipe = function () { + this.emit("error", new Error("Cannot pipe, not readable")); + }), + (v.prototype.write = function (e, t, i) { + var n, + r = this._writableState, + a = false, + s = !r.objectMode && ((n = e), f.isBuffer(n) || n instanceof d); + return ( + s && + !f.isBuffer(e) && + (e = (function (e) { + return f.from(e); + })(e)), + "function" == typeof t && ((i = t), (t = null)), + s ? (t = "buffer") : t || (t = r.defaultEncoding), "function" != typeof i && (i = g), - r.ended ? function(e, t) { - var i = new Error("write after end"); - e.emit("error", i), - o.nextTick(t, i) - }(this, i) : (s || function(e, t, i, n) { - var r = true - , a = false; - return null === i ? a = new TypeError("May not write null values to stream") : "string" == typeof i || void 0 === i || t.objectMode || (a = new TypeError("Invalid non-string/buffer chunk")), - a && (e.emit("error", a), - o.nextTick(n, a), - r = false), - r - }(this, r, e, i)) && (r.pendingcb++, - a = function(e, t, i, n, r, o) { - if (!i) { - var a = function(e, t, i) { - e.objectMode || false === e.decodeStrings || "string" != typeof t || (t = f.from(t, i)); - return t - }(t, n, r); - n !== a && (i = true, - r = "buffer", - n = a) - } - var s = t.objectMode ? 1 : n.length; - t.length += s; - var c = t.length < t.highWaterMark; - c || (t.needDrain = true); - if (t.writing || t.corked) { + r.ended + ? (function (e, t) { + var i = new Error("write after end"); + e.emit("error", i), o.nextTick(t, i); + })(this, i) + : (s || + (function (e, t, i, n) { + var r = true, + a = false; + return ( + null === i + ? (a = new TypeError( + "May not write null values to stream" + )) + : "string" == typeof i || + void 0 === i || + t.objectMode || + (a = new TypeError( + "Invalid non-string/buffer chunk" + )), + a && (e.emit("error", a), o.nextTick(n, a), (r = false)), + r + ); + })(this, r, e, i)) && + (r.pendingcb++, + (a = (function (e, t, i, n, r, o) { + if (!i) { + var a = (function (e, t, i) { + e.objectMode || + false === e.decodeStrings || + "string" != typeof t || + (t = f.from(t, i)); + return t; + })(t, n, r); + n !== a && ((i = true), (r = "buffer"), (n = a)); + } + var s = t.objectMode ? 1 : n.length; + t.length += s; + var c = t.length < t.highWaterMark; + c || (t.needDrain = true); + if (t.writing || t.corked) { var u = t.lastBufferedRequest; - t.lastBufferedRequest = { - chunk: n, - encoding: r, - isBuf: i, - callback: o, - next: null - }, - u ? u.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, - t.bufferedRequestCount += 1 - } else - y(e, t, false, s, n, r, o); - return c - }(this, r, s, e, t, i)), + (t.lastBufferedRequest = { + chunk: n, + encoding: r, + isBuf: i, + callback: o, + next: null, + }), + u + ? (u.next = t.lastBufferedRequest) + : (t.bufferedRequest = t.lastBufferedRequest), + (t.bufferedRequestCount += 1); + } else y(e, t, false, s, n, r, o); + return c; + })(this, r, s, e, t, i))), a - } - , - v.prototype.cork = function() { - this._writableState.corked++ - } - , - v.prototype.uncork = function() { - var e = this._writableState; - e.corked && (e.corked--, - e.writing || e.corked || e.finished || e.bufferProcessing || !e.bufferedRequest || E(this, e)) - } - , - v.prototype.setDefaultEncoding = function(e) { - if ("string" == typeof e && (e = e.toLowerCase()), - !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((e + "").toLowerCase()) > -1)) - throw new TypeError("Unknown encoding: " + e); - return this._writableState.defaultEncoding = e, - this - } - , + ); + }), + (v.prototype.cork = function () { + this._writableState.corked++; + }), + (v.prototype.uncork = function () { + var e = this._writableState; + e.corked && + (e.corked--, + e.writing || + e.corked || + e.finished || + e.bufferProcessing || + !e.bufferedRequest || + E(this, e)); + }), + (v.prototype.setDefaultEncoding = function (e) { + if ( + ("string" == typeof e && (e = e.toLowerCase()), + !( + [ + "hex", + "utf8", + "utf-8", + "ascii", + "binary", + "base64", + "ucs2", + "ucs-2", + "utf16le", + "utf-16le", + "raw", + ].indexOf((e + "").toLowerCase()) > -1 + )) + ) + throw new TypeError("Unknown encoding: " + e); + return (this._writableState.defaultEncoding = e), this; + }), Object.defineProperty(v.prototype, "writableHighWaterMark", { - enumerable: false, - get: function() { - return this._writableState.highWaterMark - } + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + }, }), - v.prototype._write = function(e, t, i) { - i(new Error("_write() is not implemented")) - } - , - v.prototype._writev = null, - v.prototype.end = function(e, t, i) { - var n = this._writableState; - "function" == typeof e ? (i = e, - e = null, - t = null) : "function" == typeof t && (i = t, - t = null), + (v.prototype._write = function (e, t, i) { + i(new Error("_write() is not implemented")); + }), + (v.prototype._writev = null), + (v.prototype.end = function (e, t, i) { + var n = this._writableState; + "function" == typeof e + ? ((i = e), (e = null), (t = null)) + : "function" == typeof t && ((i = t), (t = null)), null != e && this.write(e, t), - n.corked && (n.corked = 1, - this.uncork()), - n.ending || n.finished || function(e, t, i) { - t.ending = true, - x(e, t), - i && (t.finished ? o.nextTick(i) : e.once("finish", i)); - t.ended = true, - e.writable = false - }(this, n, i) - } - , - Object.defineProperty(v.prototype, "destroyed", { - get: function() { - return void 0 !== this._writableState && this._writableState.destroyed - }, - set: function(e) { - this._writableState && (this._writableState.destroyed = e) - } + n.corked && ((n.corked = 1), this.uncork()), + n.ending || + n.finished || + (function (e, t, i) { + (t.ending = true), + x(e, t), + i && (t.finished ? o.nextTick(i) : e.once("finish", i)); + (t.ended = true), (e.writable = false); + })(this, n, i); }), - v.prototype.destroy = m.destroy, - v.prototype._undestroy = m.undestroy, - v.prototype._destroy = function(e, t) { - this.end(), - t(e) - } - } - ).call(this, i(27), i(407).setImmediate, i(15)) -} -, function(e, t, i) { + Object.defineProperty(v.prototype, "destroyed", { + get: function () { + return ( + void 0 !== this._writableState && this._writableState.destroyed + ); + }, + set: function (e) { + this._writableState && (this._writableState.destroyed = e); + }, + }), + (v.prototype.destroy = m.destroy), + (v.prototype._undestroy = m.undestroy), + (v.prototype._destroy = function (e, t) { + this.end(), t(e); + }); + }.call(this, i(27), i(407).setImmediate, i(15))); + }, + function (e, t, i) { "use strict"; - var n = i(2).Buffer - , r = n.isEncoding || function(e) { - switch ((e = "" + e) && e.toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - case "raw": - return true; - default: - return false - } - } - ; + var n = i(2).Buffer, + r = + n.isEncoding || + function (e) { + switch ((e = "" + e) && e.toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + case "raw": + return true; + default: + return false; + } + }; function o(e) { - var t; - switch (this.encoding = function(e) { - var t = function(e) { - if (!e) - return "utf8"; - for (var t; ; ) - switch (e) { - case "utf8": - case "utf-8": - return "utf8"; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return "utf16le"; - case "latin1": - case "binary": - return "latin1"; - case "base64": - case "ascii": - case "hex": - return e; - default: - if (t) - return; - e = ("" + e).toLowerCase(), - t = true - } - }(e); - if ("string" != typeof t && (n.isEncoding === r || !r(e))) - throw new Error("Unknown encoding: " + e); - return t || e - }(e), - this.encoding) { + var t; + switch ( + ((this.encoding = (function (e) { + var t = (function (e) { + if (!e) return "utf8"; + for (var t; ; ) + switch (e) { + case "utf8": + case "utf-8": + return "utf8"; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return "utf16le"; + case "latin1": + case "binary": + return "latin1"; + case "base64": + case "ascii": + case "hex": + return e; + default: + if (t) return; + (e = ("" + e).toLowerCase()), (t = true); + } + })(e); + if ("string" != typeof t && (n.isEncoding === r || !r(e))) + throw new Error("Unknown encoding: " + e); + return t || e; + })(e)), + this.encoding) + ) { case "utf16le": - this.text = c, - this.end = u, - t = 4; - break; + (this.text = c), (this.end = u), (t = 4); + break; case "utf8": - this.fillLast = s, - t = 4; - break; + (this.fillLast = s), (t = 4); + break; case "base64": - this.text = l, - this.end = h, - t = 3; - break; + (this.text = l), (this.end = h), (t = 3); + break; default: - return this.write = f, - void (this.end = d) - } - this.lastNeed = 0, - this.lastTotal = 0, - this.lastChar = n.allocUnsafe(t) + return (this.write = f), void (this.end = d); + } + (this.lastNeed = 0), + (this.lastTotal = 0), + (this.lastChar = n.allocUnsafe(t)); } function a(e) { - return e <= 127 ? 0 : e >> 5 == 6 ? 2 : e >> 4 == 14 ? 3 : e >> 3 == 30 ? 4 : e >> 6 == 2 ? -1 : -2 + return e <= 127 + ? 0 + : e >> 5 == 6 + ? 2 + : e >> 4 == 14 + ? 3 + : e >> 3 == 30 + ? 4 + : e >> 6 == 2 + ? -1 + : -2; } function s(e) { - var t = this.lastTotal - this.lastNeed - , i = function(e, t, i) { - if (128 != (192 & t[0])) - return e.lastNeed = 0, - "�"; - if (e.lastNeed > 1 && t.length > 1) { - if (128 != (192 & t[1])) - return e.lastNeed = 1, - "�"; - if (e.lastNeed > 2 && t.length > 2 && 128 != (192 & t[2])) - return e.lastNeed = 2, - "�" - } - }(this, e); - return void 0 !== i ? i : this.lastNeed <= e.length ? (e.copy(this.lastChar, t, 0, this.lastNeed), - this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (e.copy(this.lastChar, t, 0, e.length), - void (this.lastNeed -= e.length)) + var t = this.lastTotal - this.lastNeed, + i = (function (e, t, i) { + if (128 != (192 & t[0])) return (e.lastNeed = 0), "�"; + if (e.lastNeed > 1 && t.length > 1) { + if (128 != (192 & t[1])) return (e.lastNeed = 1), "�"; + if (e.lastNeed > 2 && t.length > 2 && 128 != (192 & t[2])) + return (e.lastNeed = 2), "�"; + } + })(this, e); + return void 0 !== i + ? i + : this.lastNeed <= e.length + ? (e.copy(this.lastChar, t, 0, this.lastNeed), + this.lastChar.toString(this.encoding, 0, this.lastTotal)) + : (e.copy(this.lastChar, t, 0, e.length), + void (this.lastNeed -= e.length)); } function c(e, t) { - if ((e.length - t) % 2 == 0) { - var i = e.toString("utf16le", t); - if (i) { - var n = i.charCodeAt(i.length - 1); - if (n >= 55296 && n <= 56319) - return this.lastNeed = 2, - this.lastTotal = 4, - this.lastChar[0] = e[e.length - 2], - this.lastChar[1] = e[e.length - 1], - i.slice(0, -1) - } - return i + if ((e.length - t) % 2 == 0) { + var i = e.toString("utf16le", t); + if (i) { + var n = i.charCodeAt(i.length - 1); + if (n >= 55296 && n <= 56319) + return ( + (this.lastNeed = 2), + (this.lastTotal = 4), + (this.lastChar[0] = e[e.length - 2]), + (this.lastChar[1] = e[e.length - 1]), + i.slice(0, -1) + ); } - return this.lastNeed = 1, - this.lastTotal = 2, - this.lastChar[0] = e[e.length - 1], + return i; + } + return ( + (this.lastNeed = 1), + (this.lastTotal = 2), + (this.lastChar[0] = e[e.length - 1]), e.toString("utf16le", t, e.length - 1) + ); } function u(e) { - var t = e && e.length ? this.write(e) : ""; - if (this.lastNeed) { - var i = this.lastTotal - this.lastNeed; - return t + this.lastChar.toString("utf16le", 0, i) - } - return t + var t = e && e.length ? this.write(e) : ""; + if (this.lastNeed) { + var i = this.lastTotal - this.lastNeed; + return t + this.lastChar.toString("utf16le", 0, i); + } + return t; } function l(e, t) { - var i = (e.length - t) % 3; - return 0 === i ? e.toString("base64", t) : (this.lastNeed = 3 - i, - this.lastTotal = 3, - 1 === i ? this.lastChar[0] = e[e.length - 1] : (this.lastChar[0] = e[e.length - 2], - this.lastChar[1] = e[e.length - 1]), - e.toString("base64", t, e.length - i)) + var i = (e.length - t) % 3; + return 0 === i + ? e.toString("base64", t) + : ((this.lastNeed = 3 - i), + (this.lastTotal = 3), + 1 === i + ? (this.lastChar[0] = e[e.length - 1]) + : ((this.lastChar[0] = e[e.length - 2]), + (this.lastChar[1] = e[e.length - 1])), + e.toString("base64", t, e.length - i)); } function h(e) { - var t = e && e.length ? this.write(e) : ""; - return this.lastNeed ? t + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : t + var t = e && e.length ? this.write(e) : ""; + return this.lastNeed + ? t + this.lastChar.toString("base64", 0, 3 - this.lastNeed) + : t; } function f(e) { - return e.toString(this.encoding) + return e.toString(this.encoding); } function d(e) { - return e && e.length ? this.write(e) : "" + return e && e.length ? this.write(e) : ""; } - t.StringDecoder = o, - o.prototype.write = function(e) { - if (0 === e.length) - return ""; + (t.StringDecoder = o), + (o.prototype.write = function (e) { + if (0 === e.length) return ""; var t, i; if (this.lastNeed) { - if (void 0 === (t = this.fillLast(e))) - return ""; - i = this.lastNeed, - this.lastNeed = 0 - } else - i = 0; - return i < e.length ? t ? t + this.text(e, i) : this.text(e, i) : t || "" - } - , - o.prototype.end = function(e) { + if (void 0 === (t = this.fillLast(e))) return ""; + (i = this.lastNeed), (this.lastNeed = 0); + } else i = 0; + return i < e.length + ? t + ? t + this.text(e, i) + : this.text(e, i) + : t || ""; + }), + (o.prototype.end = function (e) { var t = e && e.length ? this.write(e) : ""; - return this.lastNeed ? t + "�" : t - } - , - o.prototype.text = function(e, t) { - var i = function(e, t, i) { - var n = t.length - 1; - if (n < i) - return 0; - var r = a(t[n]); - if (r >= 0) - return r > 0 && (e.lastNeed = r - 1), - r; - if (--n < i || -2 === r) - return 0; - if ((r = a(t[n])) >= 0) - return r > 0 && (e.lastNeed = r - 2), - r; - if (--n < i || -2 === r) - return 0; - if ((r = a(t[n])) >= 0) - return r > 0 && (2 === r ? r = 0 : e.lastNeed = r - 3), - r; - return 0 - }(this, e, t); - if (!this.lastNeed) - return e.toString("utf8", t); + return this.lastNeed ? t + "�" : t; + }), + (o.prototype.text = function (e, t) { + var i = (function (e, t, i) { + var n = t.length - 1; + if (n < i) return 0; + var r = a(t[n]); + if (r >= 0) return r > 0 && (e.lastNeed = r - 1), r; + if (--n < i || -2 === r) return 0; + if ((r = a(t[n])) >= 0) return r > 0 && (e.lastNeed = r - 2), r; + if (--n < i || -2 === r) return 0; + if ((r = a(t[n])) >= 0) + return r > 0 && (2 === r ? (r = 0) : (e.lastNeed = r - 3)), r; + return 0; + })(this, e, t); + if (!this.lastNeed) return e.toString("utf8", t); this.lastTotal = i; var n = e.length - (i - this.lastNeed); - return e.copy(this.lastChar, 0, n), - e.toString("utf8", t, n) - } - , - o.prototype.fillLast = function(e) { + return e.copy(this.lastChar, 0, n), e.toString("utf8", t, n); + }), + (o.prototype.fillLast = function (e) { if (this.lastNeed <= e.length) - return e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), - this.lastChar.toString(this.encoding, 0, this.lastTotal); + return ( + e.copy( + this.lastChar, + this.lastTotal - this.lastNeed, + 0, + this.lastNeed + ), + this.lastChar.toString(this.encoding, 0, this.lastTotal) + ); e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, e.length), - this.lastNeed -= e.length - } -} -, function(e, t, i) { + (this.lastNeed -= e.length); + }); + }, + function (e, t, i) { "use strict"; - (function(e, n) { - var r = i(126) - , o = i(484); - e.__TYPEDARRAY_POOL || (e.__TYPEDARRAY_POOL = { - UINT8: o([32, 0]), - UINT16: o([32, 0]), - UINT32: o([32, 0]), - INT8: o([32, 0]), - INT16: o([32, 0]), - INT32: o([32, 0]), - FLOAT: o([32, 0]), - DOUBLE: o([32, 0]), - DATA: o([32, 0]), - UINT8C: o([32, 0]), - BUFFER: o([32, 0]) + (function (e, n) { + var r = i(126), + o = i(484); + e.__TYPEDARRAY_POOL || + (e.__TYPEDARRAY_POOL = { + UINT8: o([32, 0]), + UINT16: o([32, 0]), + UINT32: o([32, 0]), + INT8: o([32, 0]), + INT16: o([32, 0]), + INT32: o([32, 0]), + FLOAT: o([32, 0]), + DOUBLE: o([32, 0]), + DATA: o([32, 0]), + UINT8C: o([32, 0]), + BUFFER: o([32, 0]), }); - var a = "undefined" != typeof Uint8ClampedArray - , s = e.__TYPEDARRAY_POOL; - s.UINT8C || (s.UINT8C = o([32, 0])), - s.BUFFER || (s.BUFFER = o([32, 0])); - var c = s.DATA - , u = s.BUFFER; - function l(e) { - if (e) { - var t = e.length || e.byteLength - , i = r.log2(t); - c[i].push(e) - } + var a = "undefined" != typeof Uint8ClampedArray, + s = e.__TYPEDARRAY_POOL; + s.UINT8C || (s.UINT8C = o([32, 0])), s.BUFFER || (s.BUFFER = o([32, 0])); + var c = s.DATA, + u = s.BUFFER; + function l(e) { + if (e) { + var t = e.length || e.byteLength, + i = r.log2(t); + c[i].push(e); } - function h(e) { - e = r.nextPow2(e); - var t = r.log2(e) - , i = c[t]; - return i.length > 0 ? i.pop() : new ArrayBuffer(e) + } + function h(e) { + e = r.nextPow2(e); + var t = r.log2(e), + i = c[t]; + return i.length > 0 ? i.pop() : new ArrayBuffer(e); + } + function f(e) { + return new Uint8Array(h(e), 0, e); + } + function d(e) { + return new Uint16Array(h(2 * e), 0, e); + } + function p(e) { + return new Uint32Array(h(4 * e), 0, e); + } + function m(e) { + return new Int8Array(h(e), 0, e); + } + function g(e) { + return new Int16Array(h(2 * e), 0, e); + } + function _(e) { + return new Int32Array(h(4 * e), 0, e); + } + function v(e) { + return new Float32Array(h(4 * e), 0, e); + } + function y(e) { + return new Float64Array(h(8 * e), 0, e); + } + function b(e) { + return a ? new Uint8ClampedArray(h(e), 0, e) : f(e); + } + function E(e) { + return new DataView(h(e), 0, e); + } + function T(e) { + e = r.nextPow2(e); + var t = r.log2(e), + i = u[t]; + return i.length > 0 ? i.pop() : new n(e); + } + (t.free = function (e) { + if (n.isBuffer(e)) u[r.log2(e.length)].push(e); + else { + if ( + ("[object ArrayBuffer]" !== Object.prototype.toString.call(e) && + (e = e.buffer), + !e) + ) + return; + var t = e.length || e.byteLength, + i = 0 | r.log2(t); + c[i].push(e); } - function f(e) { - return new Uint8Array(h(e),0,e) - } - function d(e) { - return new Uint16Array(h(2 * e),0,e) - } - function p(e) { - return new Uint32Array(h(4 * e),0,e) - } - function m(e) { - return new Int8Array(h(e),0,e) - } - function g(e) { - return new Int16Array(h(2 * e),0,e) - } - function _(e) { - return new Int32Array(h(4 * e),0,e) - } - function v(e) { - return new Float32Array(h(4 * e),0,e) - } - function y(e) { - return new Float64Array(h(8 * e),0,e) - } - function b(e) { - return a ? new Uint8ClampedArray(h(e),0,e) : f(e) - } - function E(e) { - return new DataView(h(e),0,e) - } - function T(e) { - e = r.nextPow2(e); - var t = r.log2(e) - , i = u[t]; - return i.length > 0 ? i.pop() : new n(e) - } - t.free = function(e) { - if (n.isBuffer(e)) - u[r.log2(e.length)].push(e); - else { - if ("[object ArrayBuffer]" !== Object.prototype.toString.call(e) && (e = e.buffer), - !e) - return; - var t = e.length || e.byteLength - , i = 0 | r.log2(t); - c[i].push(e) - } - } - , - t.freeUint8 = t.freeUint16 = t.freeUint32 = t.freeInt8 = t.freeInt16 = t.freeInt32 = t.freeFloat32 = t.freeFloat = t.freeFloat64 = t.freeDouble = t.freeUint8Clamped = t.freeDataView = function(e) { - l(e.buffer) - } - , - t.freeArrayBuffer = l, - t.freeBuffer = function(e) { - u[r.log2(e.length)].push(e) - } - , - t.malloc = function(e, t) { - if (void 0 === t || "arraybuffer" === t) - return h(e); - switch (t) { + }), + (t.freeUint8 = + t.freeUint16 = + t.freeUint32 = + t.freeInt8 = + t.freeInt16 = + t.freeInt32 = + t.freeFloat32 = + t.freeFloat = + t.freeFloat64 = + t.freeDouble = + t.freeUint8Clamped = + t.freeDataView = + function (e) { + l(e.buffer); + }), + (t.freeArrayBuffer = l), + (t.freeBuffer = function (e) { + u[r.log2(e.length)].push(e); + }), + (t.malloc = function (e, t) { + if (void 0 === t || "arraybuffer" === t) return h(e); + switch (t) { case "uint8": - return f(e); + return f(e); case "uint16": - return d(e); + return d(e); case "uint32": - return p(e); + return p(e); case "int8": - return m(e); + return m(e); case "int16": - return g(e); + return g(e); case "int32": - return _(e); + return _(e); case "float": case "float32": - return v(e); + return v(e); case "double": case "float64": - return y(e); + return y(e); case "uint8_clamped": - return b(e); + return b(e); case "buffer": - return T(e); + return T(e); case "data": case "dataview": - return E(e); + return E(e); default: - return null - } - return null - } - , - t.mallocArrayBuffer = h, - t.mallocUint8 = f, - t.mallocUint16 = d, - t.mallocUint32 = p, - t.mallocInt8 = m, - t.mallocInt16 = g, - t.mallocInt32 = _, - t.mallocFloat32 = t.mallocFloat = v, - t.mallocFloat64 = t.mallocDouble = y, - t.mallocUint8Clamped = b, - t.mallocDataView = E, - t.mallocBuffer = T, - t.clearCache = function() { - for (var e = 0; e < 32; ++e) - s.UINT8[e].length = 0, - s.UINT16[e].length = 0, - s.UINT32[e].length = 0, - s.INT8[e].length = 0, - s.INT16[e].length = 0, - s.INT32[e].length = 0, - s.FLOAT[e].length = 0, - s.DOUBLE[e].length = 0, - s.UINT8C[e].length = 0, - c[e].length = 0, - u[e].length = 0 - } - } - ).call(this, i(15), i(9).Buffer) -} -, function(e, t, i) { + return null; + } + return null; + }), + (t.mallocArrayBuffer = h), + (t.mallocUint8 = f), + (t.mallocUint16 = d), + (t.mallocUint32 = p), + (t.mallocInt8 = m), + (t.mallocInt16 = g), + (t.mallocInt32 = _), + (t.mallocFloat32 = t.mallocFloat = v), + (t.mallocFloat64 = t.mallocDouble = y), + (t.mallocUint8Clamped = b), + (t.mallocDataView = E), + (t.mallocBuffer = T), + (t.clearCache = function () { + for (var e = 0; e < 32; ++e) + (s.UINT8[e].length = 0), + (s.UINT16[e].length = 0), + (s.UINT32[e].length = 0), + (s.INT8[e].length = 0), + (s.INT16[e].length = 0), + (s.INT32[e].length = 0), + (s.FLOAT[e].length = 0), + (s.DOUBLE[e].length = 0), + (s.UINT8C[e].length = 0), + (c[e].length = 0), + (u[e].length = 0); + }); + }.call(this, i(15), i(9).Buffer)); + }, + function (e, t, i) { "use strict"; function n(e) { - var t = 32; - return (e &= -e) && t--, + var t = 32; + return ( + (e &= -e) && t--, 65535 & e && (t -= 16), 16711935 & e && (t -= 8), 252645135 & e && (t -= 4), 858993459 & e && (t -= 2), 1431655765 & e && (t -= 1), t + ); } - t.INT_BITS = 32, - t.INT_MAX = 2147483647, - t.INT_MIN = -1 << 31, - t.sign = function(e) { - return (e > 0) - (e < 0) - } - , - t.abs = function(e) { + (t.INT_BITS = 32), + (t.INT_MAX = 2147483647), + (t.INT_MIN = -1 << 31), + (t.sign = function (e) { + return (e > 0) - (e < 0); + }), + (t.abs = function (e) { var t = e >> 31; - return (e ^ t) - t - } - , - t.min = function(e, t) { - return t ^ (e ^ t) & -(e < t) - } - , - t.max = function(e, t) { - return e ^ (e ^ t) & -(e < t) - } - , - t.isPow2 = function(e) { - return !(e & e - 1 || !e) - } - , - t.log2 = function(e) { + return (e ^ t) - t; + }), + (t.min = function (e, t) { + return t ^ ((e ^ t) & -(e < t)); + }), + (t.max = function (e, t) { + return e ^ ((e ^ t) & -(e < t)); + }), + (t.isPow2 = function (e) { + return !(e & (e - 1) || !e); + }), + (t.log2 = function (e) { var t, i; - return t = (e > 65535) << 4, - t |= i = ((e >>>= t) > 255) << 3, - t |= i = ((e >>>= i) > 15) << 2, - (t |= i = ((e >>>= i) > 3) << 1) | (e >>>= i) >> 1 - } - , - t.log10 = function(e) { - return e >= 1e9 ? 9 : e >= 1e8 ? 8 : e >= 1e7 ? 7 : e >= 1e6 ? 6 : e >= 1e5 ? 5 : e >= 1e4 ? 4 : e >= 1e3 ? 3 : e >= 100 ? 2 : e >= 10 ? 1 : 0 - } - , - t.popCount = function(e) { - return 16843009 * ((e = (858993459 & (e -= e >>> 1 & 1431655765)) + (e >>> 2 & 858993459)) + (e >>> 4) & 252645135) >>> 24 - } - , - t.countTrailingZeros = n, - t.nextPow2 = function(e) { - return e += 0 === e, - --e, - e |= e >>> 1, - e |= e >>> 2, - e |= e >>> 4, - e |= e >>> 8, - (e |= e >>> 16) + 1 - } - , - t.prevPow2 = function(e) { - return e |= e >>> 1, - e |= e >>> 2, - e |= e >>> 4, - e |= e >>> 8, - (e |= e >>> 16) - (e >>> 1) - } - , - t.parity = function(e) { - return e ^= e >>> 16, - e ^= e >>> 8, - e ^= e >>> 4, - 27030 >>> (e &= 15) & 1 - } - ; + return ( + (t = (e > 65535) << 4), + (t |= i = ((e >>>= t) > 255) << 3), + (t |= i = ((e >>>= i) > 15) << 2), + (t |= i = ((e >>>= i) > 3) << 1) | ((e >>>= i) >> 1) + ); + }), + (t.log10 = function (e) { + return e >= 1e9 + ? 9 + : e >= 1e8 + ? 8 + : e >= 1e7 + ? 7 + : e >= 1e6 + ? 6 + : e >= 1e5 + ? 5 + : e >= 1e4 + ? 4 + : e >= 1e3 + ? 3 + : e >= 100 + ? 2 + : e >= 10 + ? 1 + : 0; + }), + (t.popCount = function (e) { + return ( + (16843009 * + (((e = + (858993459 & (e -= (e >>> 1) & 1431655765)) + + ((e >>> 2) & 858993459)) + + (e >>> 4)) & + 252645135)) >>> + 24 + ); + }), + (t.countTrailingZeros = n), + (t.nextPow2 = function (e) { + return ( + (e += 0 === e), + --e, + (e |= e >>> 1), + (e |= e >>> 2), + (e |= e >>> 4), + (e |= e >>> 8), + (e |= e >>> 16) + 1 + ); + }), + (t.prevPow2 = function (e) { + return ( + (e |= e >>> 1), + (e |= e >>> 2), + (e |= e >>> 4), + (e |= e >>> 8), + (e |= e >>> 16) - (e >>> 1) + ); + }), + (t.parity = function (e) { + return ( + (e ^= e >>> 16), + (e ^= e >>> 8), + (e ^= e >>> 4), + (27030 >>> (e &= 15)) & 1 + ); + }); var r = new Array(256); - !function(e) { - for (var t = 0; t < 256; ++t) { - var i = t - , n = t - , r = 7; - for (i >>>= 1; i; i >>>= 1) - n <<= 1, - n |= 1 & i, - --r; - e[t] = n << r & 255 - } - }(r), - t.reverse = function(e) { - return r[255 & e] << 24 | r[e >>> 8 & 255] << 16 | r[e >>> 16 & 255] << 8 | r[e >>> 24 & 255] - } - , - t.interleave2 = function(e, t) { - return (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e &= 65535) | e << 8)) | e << 4)) | e << 2)) | e << 1)) | (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t &= 65535) | t << 8)) | t << 4)) | t << 2)) | t << 1)) << 1 - } - , - t.deinterleave2 = function(e, t) { - return (e = 65535 & ((e = 16711935 & ((e = 252645135 & ((e = 858993459 & ((e = e >>> t & 1431655765) | e >>> 1)) | e >>> 2)) | e >>> 4)) | e >>> 16)) << 16 >> 16 - } - , - t.interleave3 = function(e, t, i) { - return e = 1227133513 & ((e = 3272356035 & ((e = 251719695 & ((e = 4278190335 & ((e &= 1023) | e << 16)) | e << 8)) | e << 4)) | e << 2), - (e |= (t = 1227133513 & ((t = 3272356035 & ((t = 251719695 & ((t = 4278190335 & ((t &= 1023) | t << 16)) | t << 8)) | t << 4)) | t << 2)) << 1) | (i = 1227133513 & ((i = 3272356035 & ((i = 251719695 & ((i = 4278190335 & ((i &= 1023) | i << 16)) | i << 8)) | i << 4)) | i << 2)) << 2 - } - , - t.deinterleave3 = function(e, t) { - return (e = 1023 & ((e = 4278190335 & ((e = 251719695 & ((e = 3272356035 & ((e = e >>> t & 1227133513) | e >>> 2)) | e >>> 4)) | e >>> 8)) | e >>> 16)) << 22 >> 22 - } - , - t.nextCombination = function(e) { - var t = e | e - 1; - return t + 1 | (~t & -~t) - 1 >>> n(e) + 1 - } -} -, function(e, t, i) { + !(function (e) { + for (var t = 0; t < 256; ++t) { + var i = t, + n = t, + r = 7; + for (i >>>= 1; i; i >>>= 1) (n <<= 1), (n |= 1 & i), --r; + e[t] = (n << r) & 255; + } + })(r), + (t.reverse = function (e) { + return ( + (r[255 & e] << 24) | + (r[(e >>> 8) & 255] << 16) | + (r[(e >>> 16) & 255] << 8) | + r[(e >>> 24) & 255] + ); + }), + (t.interleave2 = function (e, t) { + return ( + (e = + 1431655765 & + ((e = + 858993459 & + ((e = + 252645135 & + ((e = 16711935 & ((e &= 65535) | (e << 8))) | (e << 4))) | + (e << 2))) | + (e << 1))) | + ((t = + 1431655765 & + ((t = + 858993459 & + ((t = + 252645135 & + ((t = 16711935 & ((t &= 65535) | (t << 8))) | (t << 4))) | + (t << 2))) | + (t << 1))) << + 1) + ); + }), + (t.deinterleave2 = function (e, t) { + return ( + ((e = + 65535 & + ((e = + 16711935 & + ((e = + 252645135 & + ((e = 858993459 & ((e = (e >>> t) & 1431655765) | (e >>> 1))) | + (e >>> 2))) | + (e >>> 4))) | + (e >>> 16))) << + 16) >> + 16 + ); + }), + (t.interleave3 = function (e, t, i) { + return ( + (e = + 1227133513 & + ((e = + 3272356035 & + ((e = + 251719695 & + ((e = 4278190335 & ((e &= 1023) | (e << 16))) | (e << 8))) | + (e << 4))) | + (e << 2))), + (e |= + (t = + 1227133513 & + ((t = + 3272356035 & + ((t = + 251719695 & + ((t = 4278190335 & ((t &= 1023) | (t << 16))) | (t << 8))) | + (t << 4))) | + (t << 2))) << 1) | + ((i = + 1227133513 & + ((i = + 3272356035 & + ((i = + 251719695 & + ((i = 4278190335 & ((i &= 1023) | (i << 16))) | (i << 8))) | + (i << 4))) | + (i << 2))) << + 2) + ); + }), + (t.deinterleave3 = function (e, t) { + return ( + ((e = + 1023 & + ((e = + 4278190335 & + ((e = + 251719695 & + ((e = 3272356035 & ((e = (e >>> t) & 1227133513) | (e >>> 2))) | + (e >>> 4))) | + (e >>> 8))) | + (e >>> 16))) << + 22) >> + 22 + ); + }), + (t.nextCombination = function (e) { + var t = e | (e - 1); + return (t + 1) | (((~t & -~t) - 1) >>> (n(e) + 1)); + }); + }, + function (e, t, i) { "use strict"; - var n = i(1) - , r = i(196) - , o = i(2).Buffer - , a = new Array(16); + var n = i(1), + r = i(196), + o = i(2).Buffer, + a = new Array(16); function s() { - r.call(this, 64), - this._a = 1732584193, - this._b = 4023233417, - this._c = 2562383102, - this._d = 271733878 + r.call(this, 64), + (this._a = 1732584193), + (this._b = 4023233417), + (this._c = 2562383102), + (this._d = 271733878); } function c(e, t) { - return e << t | e >>> 32 - t + return (e << t) | (e >>> (32 - t)); } function u(e, t, i, n, r, o, a) { - return c(e + (t & i | ~t & n) + r + o | 0, a) + t | 0 + return (c((e + ((t & i) | (~t & n)) + r + o) | 0, a) + t) | 0; } function l(e, t, i, n, r, o, a) { - return c(e + (t & n | i & ~n) + r + o | 0, a) + t | 0 + return (c((e + ((t & n) | (i & ~n)) + r + o) | 0, a) + t) | 0; } function h(e, t, i, n, r, o, a) { - return c(e + (t ^ i ^ n) + r + o | 0, a) + t | 0 + return (c((e + (t ^ i ^ n) + r + o) | 0, a) + t) | 0; } function f(e, t, i, n, r, o, a) { - return c(e + (i ^ (t | ~n)) + r + o | 0, a) + t | 0 + return (c((e + (i ^ (t | ~n)) + r + o) | 0, a) + t) | 0; } n(s, r), - s.prototype._update = function() { + (s.prototype._update = function () { for (var e = a, t = 0; t < 16; ++t) - e[t] = this._block.readInt32LE(4 * t); - var i = this._a - , n = this._b - , r = this._c - , o = this._d; - i = u(i, n, r, o, e[0], 3614090360, 7), - o = u(o, i, n, r, e[1], 3905402710, 12), - r = u(r, o, i, n, e[2], 606105819, 17), - n = u(n, r, o, i, e[3], 3250441966, 22), - i = u(i, n, r, o, e[4], 4118548399, 7), - o = u(o, i, n, r, e[5], 1200080426, 12), - r = u(r, o, i, n, e[6], 2821735955, 17), - n = u(n, r, o, i, e[7], 4249261313, 22), - i = u(i, n, r, o, e[8], 1770035416, 7), - o = u(o, i, n, r, e[9], 2336552879, 12), - r = u(r, o, i, n, e[10], 4294925233, 17), - n = u(n, r, o, i, e[11], 2304563134, 22), - i = u(i, n, r, o, e[12], 1804603682, 7), - o = u(o, i, n, r, e[13], 4254626195, 12), - r = u(r, o, i, n, e[14], 2792965006, 17), - i = l(i, n = u(n, r, o, i, e[15], 1236535329, 22), r, o, e[1], 4129170786, 5), - o = l(o, i, n, r, e[6], 3225465664, 9), - r = l(r, o, i, n, e[11], 643717713, 14), - n = l(n, r, o, i, e[0], 3921069994, 20), - i = l(i, n, r, o, e[5], 3593408605, 5), - o = l(o, i, n, r, e[10], 38016083, 9), - r = l(r, o, i, n, e[15], 3634488961, 14), - n = l(n, r, o, i, e[4], 3889429448, 20), - i = l(i, n, r, o, e[9], 568446438, 5), - o = l(o, i, n, r, e[14], 3275163606, 9), - r = l(r, o, i, n, e[3], 4107603335, 14), - n = l(n, r, o, i, e[8], 1163531501, 20), - i = l(i, n, r, o, e[13], 2850285829, 5), - o = l(o, i, n, r, e[2], 4243563512, 9), - r = l(r, o, i, n, e[7], 1735328473, 14), - i = h(i, n = l(n, r, o, i, e[12], 2368359562, 20), r, o, e[5], 4294588738, 4), - o = h(o, i, n, r, e[8], 2272392833, 11), - r = h(r, o, i, n, e[11], 1839030562, 16), - n = h(n, r, o, i, e[14], 4259657740, 23), - i = h(i, n, r, o, e[1], 2763975236, 4), - o = h(o, i, n, r, e[4], 1272893353, 11), - r = h(r, o, i, n, e[7], 4139469664, 16), - n = h(n, r, o, i, e[10], 3200236656, 23), - i = h(i, n, r, o, e[13], 681279174, 4), - o = h(o, i, n, r, e[0], 3936430074, 11), - r = h(r, o, i, n, e[3], 3572445317, 16), - n = h(n, r, o, i, e[6], 76029189, 23), - i = h(i, n, r, o, e[9], 3654602809, 4), - o = h(o, i, n, r, e[12], 3873151461, 11), - r = h(r, o, i, n, e[15], 530742520, 16), - i = f(i, n = h(n, r, o, i, e[2], 3299628645, 23), r, o, e[0], 4096336452, 6), - o = f(o, i, n, r, e[7], 1126891415, 10), - r = f(r, o, i, n, e[14], 2878612391, 15), - n = f(n, r, o, i, e[5], 4237533241, 21), - i = f(i, n, r, o, e[12], 1700485571, 6), - o = f(o, i, n, r, e[3], 2399980690, 10), - r = f(r, o, i, n, e[10], 4293915773, 15), - n = f(n, r, o, i, e[1], 2240044497, 21), - i = f(i, n, r, o, e[8], 1873313359, 6), - o = f(o, i, n, r, e[15], 4264355552, 10), - r = f(r, o, i, n, e[6], 2734768916, 15), - n = f(n, r, o, i, e[13], 1309151649, 21), - i = f(i, n, r, o, e[4], 4149444226, 6), - o = f(o, i, n, r, e[11], 3174756917, 10), - r = f(r, o, i, n, e[2], 718787259, 15), - n = f(n, r, o, i, e[9], 3951481745, 21), - this._a = this._a + i | 0, - this._b = this._b + n | 0, - this._c = this._c + r | 0, - this._d = this._d + o | 0 - } - , - s.prototype._digest = function() { - this._block[this._blockOffset++] = 128, - this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), - this._update(), - this._blockOffset = 0), - this._block.fill(0, this._blockOffset, 56), - this._block.writeUInt32LE(this._length[0], 56), - this._block.writeUInt32LE(this._length[1], 60), - this._update(); + e[t] = this._block.readInt32LE(4 * t); + var i = this._a, + n = this._b, + r = this._c, + o = this._d; + (i = u(i, n, r, o, e[0], 3614090360, 7)), + (o = u(o, i, n, r, e[1], 3905402710, 12)), + (r = u(r, o, i, n, e[2], 606105819, 17)), + (n = u(n, r, o, i, e[3], 3250441966, 22)), + (i = u(i, n, r, o, e[4], 4118548399, 7)), + (o = u(o, i, n, r, e[5], 1200080426, 12)), + (r = u(r, o, i, n, e[6], 2821735955, 17)), + (n = u(n, r, o, i, e[7], 4249261313, 22)), + (i = u(i, n, r, o, e[8], 1770035416, 7)), + (o = u(o, i, n, r, e[9], 2336552879, 12)), + (r = u(r, o, i, n, e[10], 4294925233, 17)), + (n = u(n, r, o, i, e[11], 2304563134, 22)), + (i = u(i, n, r, o, e[12], 1804603682, 7)), + (o = u(o, i, n, r, e[13], 4254626195, 12)), + (r = u(r, o, i, n, e[14], 2792965006, 17)), + (i = l( + i, + (n = u(n, r, o, i, e[15], 1236535329, 22)), + r, + o, + e[1], + 4129170786, + 5 + )), + (o = l(o, i, n, r, e[6], 3225465664, 9)), + (r = l(r, o, i, n, e[11], 643717713, 14)), + (n = l(n, r, o, i, e[0], 3921069994, 20)), + (i = l(i, n, r, o, e[5], 3593408605, 5)), + (o = l(o, i, n, r, e[10], 38016083, 9)), + (r = l(r, o, i, n, e[15], 3634488961, 14)), + (n = l(n, r, o, i, e[4], 3889429448, 20)), + (i = l(i, n, r, o, e[9], 568446438, 5)), + (o = l(o, i, n, r, e[14], 3275163606, 9)), + (r = l(r, o, i, n, e[3], 4107603335, 14)), + (n = l(n, r, o, i, e[8], 1163531501, 20)), + (i = l(i, n, r, o, e[13], 2850285829, 5)), + (o = l(o, i, n, r, e[2], 4243563512, 9)), + (r = l(r, o, i, n, e[7], 1735328473, 14)), + (i = h( + i, + (n = l(n, r, o, i, e[12], 2368359562, 20)), + r, + o, + e[5], + 4294588738, + 4 + )), + (o = h(o, i, n, r, e[8], 2272392833, 11)), + (r = h(r, o, i, n, e[11], 1839030562, 16)), + (n = h(n, r, o, i, e[14], 4259657740, 23)), + (i = h(i, n, r, o, e[1], 2763975236, 4)), + (o = h(o, i, n, r, e[4], 1272893353, 11)), + (r = h(r, o, i, n, e[7], 4139469664, 16)), + (n = h(n, r, o, i, e[10], 3200236656, 23)), + (i = h(i, n, r, o, e[13], 681279174, 4)), + (o = h(o, i, n, r, e[0], 3936430074, 11)), + (r = h(r, o, i, n, e[3], 3572445317, 16)), + (n = h(n, r, o, i, e[6], 76029189, 23)), + (i = h(i, n, r, o, e[9], 3654602809, 4)), + (o = h(o, i, n, r, e[12], 3873151461, 11)), + (r = h(r, o, i, n, e[15], 530742520, 16)), + (i = f( + i, + (n = h(n, r, o, i, e[2], 3299628645, 23)), + r, + o, + e[0], + 4096336452, + 6 + )), + (o = f(o, i, n, r, e[7], 1126891415, 10)), + (r = f(r, o, i, n, e[14], 2878612391, 15)), + (n = f(n, r, o, i, e[5], 4237533241, 21)), + (i = f(i, n, r, o, e[12], 1700485571, 6)), + (o = f(o, i, n, r, e[3], 2399980690, 10)), + (r = f(r, o, i, n, e[10], 4293915773, 15)), + (n = f(n, r, o, i, e[1], 2240044497, 21)), + (i = f(i, n, r, o, e[8], 1873313359, 6)), + (o = f(o, i, n, r, e[15], 4264355552, 10)), + (r = f(r, o, i, n, e[6], 2734768916, 15)), + (n = f(n, r, o, i, e[13], 1309151649, 21)), + (i = f(i, n, r, o, e[4], 4149444226, 6)), + (o = f(o, i, n, r, e[11], 3174756917, 10)), + (r = f(r, o, i, n, e[2], 718787259, 15)), + (n = f(n, r, o, i, e[9], 3951481745, 21)), + (this._a = (this._a + i) | 0), + (this._b = (this._b + n) | 0), + (this._c = (this._c + r) | 0), + (this._d = (this._d + o) | 0); + }), + (s.prototype._digest = function () { + (this._block[this._blockOffset++] = 128), + this._blockOffset > 56 && + (this._block.fill(0, this._blockOffset, 64), + this._update(), + (this._blockOffset = 0)), + this._block.fill(0, this._blockOffset, 56), + this._block.writeUInt32LE(this._length[0], 56), + this._block.writeUInt32LE(this._length[1], 60), + this._update(); var e = o.allocUnsafe(16); - return e.writeInt32LE(this._a, 0), - e.writeInt32LE(this._b, 4), - e.writeInt32LE(this._c, 8), - e.writeInt32LE(this._d, 12), - e - } - , - e.exports = s -} -, function(e, t, i) { + return ( + e.writeInt32LE(this._a, 0), + e.writeInt32LE(this._b, 4), + e.writeInt32LE(this._c, 8), + e.writeInt32LE(this._d, 12), + e + ); + }), + (e.exports = s); + }, + function (e, t, i) { e.exports = r; var n = i(42).EventEmitter; function r() { - n.call(this) + n.call(this); } i(1)(r, n), - r.Readable = i(85), - r.Writable = i(514), - r.Duplex = i(515), - r.Transform = i(516), - r.PassThrough = i(517), - r.Stream = r, - r.prototype.pipe = function(e, t) { + (r.Readable = i(85)), + (r.Writable = i(514)), + (r.Duplex = i(515)), + (r.Transform = i(516)), + (r.PassThrough = i(517)), + (r.Stream = r), + (r.prototype.pipe = function (e, t) { var i = this; function r(t) { - e.writable && false === e.write(t) && i.pause && i.pause() + e.writable && false === e.write(t) && i.pause && i.pause(); } function o() { - i.readable && i.resume && i.resume() + i.readable && i.resume && i.resume(); } i.on("data", r), - e.on("drain", o), - e._isStdio || t && false === t.end || (i.on("end", s), - i.on("close", c)); + e.on("drain", o), + e._isStdio || + (t && false === t.end) || + (i.on("end", s), i.on("close", c)); var a = false; function s() { - a || (a = true, - e.end()) + a || ((a = true), e.end()); } function c() { - a || (a = true, - "function" == typeof e.destroy && e.destroy()) + a || ((a = true), "function" == typeof e.destroy && e.destroy()); } function u(e) { - if (l(), - 0 === n.listenerCount(this, "error")) - throw e + if ((l(), 0 === n.listenerCount(this, "error"))) throw e; } function l() { - i.removeListener("data", r), + i.removeListener("data", r), e.removeListener("drain", o), i.removeListener("end", s), i.removeListener("close", c), @@ -10743,142 +12989,188 @@ e.removeListener("error", u), i.removeListener("end", l), i.removeListener("close", l), - e.removeListener("close", l) + e.removeListener("close", l); } - return i.on("error", u), - e.on("error", u), - i.on("end", l), - i.on("close", l), - e.on("close", l), - e.emit("pipe", i), - e - } -} -, function(e, t, i) { + return ( + i.on("error", u), + e.on("error", u), + i.on("end", l), + i.on("close", l), + e.on("close", l), + e.emit("pipe", i), + e + ); + }); + }, + function (e, t, i) { "use strict"; - var n = i(9).Buffer - , r = i(1) - , o = i(196) - , a = new Array(16) - , s = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13] - , c = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11] - , u = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6] - , l = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11] - , h = [0, 1518500249, 1859775393, 2400959708, 2840853838] - , f = [1352829926, 1548603684, 1836072691, 2053994217, 0]; + var n = i(9).Buffer, + r = i(1), + o = i(196), + a = new Array(16), + s = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, + 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, + 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, + ], + c = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, + 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, + 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, + 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11, + ], + u = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, + 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, + 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, + 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6, + ], + l = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, + 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, + 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, + 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11, + ], + h = [0, 1518500249, 1859775393, 2400959708, 2840853838], + f = [1352829926, 1548603684, 1836072691, 2053994217, 0]; function d() { - o.call(this, 64), - this._a = 1732584193, - this._b = 4023233417, - this._c = 2562383102, - this._d = 271733878, - this._e = 3285377520 + o.call(this, 64), + (this._a = 1732584193), + (this._b = 4023233417), + (this._c = 2562383102), + (this._d = 271733878), + (this._e = 3285377520); } function p(e, t) { - return e << t | e >>> 32 - t + return (e << t) | (e >>> (32 - t)); } function m(e, t, i, n, r, o, a, s) { - return p(e + (t ^ i ^ n) + o + a | 0, s) + r | 0 + return (p((e + (t ^ i ^ n) + o + a) | 0, s) + r) | 0; } function g(e, t, i, n, r, o, a, s) { - return p(e + (t & i | ~t & n) + o + a | 0, s) + r | 0 + return (p((e + ((t & i) | (~t & n)) + o + a) | 0, s) + r) | 0; } function _(e, t, i, n, r, o, a, s) { - return p(e + ((t | ~i) ^ n) + o + a | 0, s) + r | 0 + return (p((e + ((t | ~i) ^ n) + o + a) | 0, s) + r) | 0; } function v(e, t, i, n, r, o, a, s) { - return p(e + (t & n | i & ~n) + o + a | 0, s) + r | 0 + return (p((e + ((t & n) | (i & ~n)) + o + a) | 0, s) + r) | 0; } function y(e, t, i, n, r, o, a, s) { - return p(e + (t ^ (i | ~n)) + o + a | 0, s) + r | 0 + return (p((e + (t ^ (i | ~n)) + o + a) | 0, s) + r) | 0; } r(d, o), - d.prototype._update = function() { + (d.prototype._update = function () { for (var e = a, t = 0; t < 16; ++t) - e[t] = this._block.readInt32LE(4 * t); - for (var i = 0 | this._a, n = 0 | this._b, r = 0 | this._c, o = 0 | this._d, d = 0 | this._e, b = 0 | this._a, E = 0 | this._b, T = 0 | this._c, A = 0 | this._d, x = 0 | this._e, S = 0; S < 80; S += 1) { - var C, P; - S < 16 ? (C = m(i, n, r, o, d, e[s[S]], h[0], u[S]), - P = y(b, E, T, A, x, e[c[S]], f[0], l[S])) : S < 32 ? (C = g(i, n, r, o, d, e[s[S]], h[1], u[S]), - P = v(b, E, T, A, x, e[c[S]], f[1], l[S])) : S < 48 ? (C = _(i, n, r, o, d, e[s[S]], h[2], u[S]), - P = _(b, E, T, A, x, e[c[S]], f[2], l[S])) : S < 64 ? (C = v(i, n, r, o, d, e[s[S]], h[3], u[S]), - P = g(b, E, T, A, x, e[c[S]], f[3], l[S])) : (C = y(i, n, r, o, d, e[s[S]], h[4], u[S]), - P = m(b, E, T, A, x, e[c[S]], f[4], l[S])), - i = d, - d = o, - o = p(r, 10), - r = n, - n = C, - b = x, - x = A, - A = p(T, 10), - T = E, - E = P + e[t] = this._block.readInt32LE(4 * t); + for ( + var i = 0 | this._a, + n = 0 | this._b, + r = 0 | this._c, + o = 0 | this._d, + d = 0 | this._e, + b = 0 | this._a, + E = 0 | this._b, + T = 0 | this._c, + A = 0 | this._d, + x = 0 | this._e, + S = 0; + S < 80; + S += 1 + ) { + var C, P; + S < 16 + ? ((C = m(i, n, r, o, d, e[s[S]], h[0], u[S])), + (P = y(b, E, T, A, x, e[c[S]], f[0], l[S]))) + : S < 32 + ? ((C = g(i, n, r, o, d, e[s[S]], h[1], u[S])), + (P = v(b, E, T, A, x, e[c[S]], f[1], l[S]))) + : S < 48 + ? ((C = _(i, n, r, o, d, e[s[S]], h[2], u[S])), + (P = _(b, E, T, A, x, e[c[S]], f[2], l[S]))) + : S < 64 + ? ((C = v(i, n, r, o, d, e[s[S]], h[3], u[S])), + (P = g(b, E, T, A, x, e[c[S]], f[3], l[S]))) + : ((C = y(i, n, r, o, d, e[s[S]], h[4], u[S])), + (P = m(b, E, T, A, x, e[c[S]], f[4], l[S]))), + (i = d), + (d = o), + (o = p(r, 10)), + (r = n), + (n = C), + (b = x), + (x = A), + (A = p(T, 10)), + (T = E), + (E = P); } - var R = this._b + r + A | 0; - this._b = this._c + o + x | 0, - this._c = this._d + d + b | 0, - this._d = this._e + i + E | 0, - this._e = this._a + n + T | 0, - this._a = R - } - , - d.prototype._digest = function() { - this._block[this._blockOffset++] = 128, - this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), - this._update(), - this._blockOffset = 0), - this._block.fill(0, this._blockOffset, 56), - this._block.writeUInt32LE(this._length[0], 56), - this._block.writeUInt32LE(this._length[1], 60), - this._update(); + var R = (this._b + r + A) | 0; + (this._b = (this._c + o + x) | 0), + (this._c = (this._d + d + b) | 0), + (this._d = (this._e + i + E) | 0), + (this._e = (this._a + n + T) | 0), + (this._a = R); + }), + (d.prototype._digest = function () { + (this._block[this._blockOffset++] = 128), + this._blockOffset > 56 && + (this._block.fill(0, this._blockOffset, 64), + this._update(), + (this._blockOffset = 0)), + this._block.fill(0, this._blockOffset, 56), + this._block.writeUInt32LE(this._length[0], 56), + this._block.writeUInt32LE(this._length[1], 60), + this._update(); var e = n.alloc ? n.alloc(20) : new n(20); - return e.writeInt32LE(this._a, 0), - e.writeInt32LE(this._b, 4), - e.writeInt32LE(this._c, 8), - e.writeInt32LE(this._d, 12), - e.writeInt32LE(this._e, 16), - e - } - , - e.exports = d -} -, function(e, t, i) { - (t = e.exports = function(e) { + return ( + e.writeInt32LE(this._a, 0), + e.writeInt32LE(this._b, 4), + e.writeInt32LE(this._c, 8), + e.writeInt32LE(this._d, 12), + e.writeInt32LE(this._e, 16), + e + ); + }), + (e.exports = d); + }, + function (e, t, i) { + ((t = e.exports = + function (e) { e = e.toLowerCase(); var i = t[e]; if (!i) - throw new Error(e + " is not supported (we accept pull requests)"); - return new i - } - ).sha = i(518), - t.sha1 = i(519), - t.sha224 = i(520), - t.sha256 = i(197), - t.sha384 = i(521), - t.sha512 = i(198) -} -, function(e, t, i) { + throw new Error(e + " is not supported (we accept pull requests)"); + return new i(); + }).sha = i(518)), + (t.sha1 = i(519)), + (t.sha224 = i(520)), + (t.sha256 = i(197)), + (t.sha384 = i(521)), + (t.sha512 = i(198)); + }, + function (e, t, i) { "use strict"; - t.utils = i(527), - t.Cipher = i(528), - t.DES = i(529), - t.CBC = i(530), - t.EDE = i(531) -} -, function(e, t, i) { - var n = i(532) - , r = i(540) - , o = i(208); - t.createCipher = t.Cipher = n.createCipher, - t.createCipheriv = t.Cipheriv = n.createCipheriv, - t.createDecipher = t.Decipher = r.createDecipher, - t.createDecipheriv = t.Decipheriv = r.createDecipheriv, - t.listCiphers = t.getCiphers = function() { - return Object.keys(o) - } -} -, function(e, t, i) { + (t.utils = i(527)), + (t.Cipher = i(528)), + (t.DES = i(529)), + (t.CBC = i(530)), + (t.EDE = i(531)); + }, + function (e, t, i) { + var n = i(532), + r = i(540), + o = i(208); + (t.createCipher = t.Cipher = n.createCipher), + (t.createCipheriv = t.Cipheriv = n.createCipheriv), + (t.createDecipher = t.Decipher = r.createDecipher), + (t.createDecipheriv = t.Decipheriv = r.createDecipheriv), + (t.listCiphers = t.getCiphers = + function () { + return Object.keys(o); + }); + }, + function (e, t, i) { var n = { ECB: i(533), CBC: i(534), @@ -10887,1607 +13179,1895 @@ CFB1: i(537), OFB: i(538), CTR: i(206), - GCM: i(206) - } - , r = i(208); - for (var o in r) - r[o].module = n[r[o].mode]; - e.exports = r -} -, function(e, t, i) { - (function(t) { - var n = i(11) - , r = i(53); - function o(e, i) { - var r = function(e) { - var t = a(e); - return { - blinder: t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed(), - unblinder: t.invm(e.modulus) - } - }(i) - , o = i.modulus.byteLength() - , s = (n.mont(i.modulus), - new n(e).mul(r.blinder).umod(i.modulus)) - , c = s.toRed(n.mont(i.prime1)) - , u = s.toRed(n.mont(i.prime2)) - , l = i.coefficient - , h = i.prime1 - , f = i.prime2 - , d = c.redPow(i.exponent1) - , p = u.redPow(i.exponent2); - d = d.fromRed(), - p = p.fromRed(); - var m = d.isub(p).imul(l).umod(h); - return m.imul(f), - p.iadd(m), - new t(p.imul(r.unblinder).umod(i.modulus).toArray(false, o)) - } - function a(e) { - for (var t = e.modulus.byteLength(), i = new n(r(t)); i.cmp(e.modulus) >= 0 || !i.umod(e.prime1) || !i.umod(e.prime2); ) - i = new n(r(t)); - return i - } - e.exports = o, - o.getr = a - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { + GCM: i(206), + }, + r = i(208); + for (var o in r) r[o].module = n[r[o].mode]; + e.exports = r; + }, + function (e, t, i) { + (function (t) { + var n = i(11), + r = i(53); + function o(e, i) { + var r = (function (e) { + var t = a(e); + return { + blinder: t + .toRed(n.mont(e.modulus)) + .redPow(new n(e.publicExponent)) + .fromRed(), + unblinder: t.invm(e.modulus), + }; + })(i), + o = i.modulus.byteLength(), + s = (n.mont(i.modulus), new n(e).mul(r.blinder).umod(i.modulus)), + c = s.toRed(n.mont(i.prime1)), + u = s.toRed(n.mont(i.prime2)), + l = i.coefficient, + h = i.prime1, + f = i.prime2, + d = c.redPow(i.exponent1), + p = u.redPow(i.exponent2); + (d = d.fromRed()), (p = p.fromRed()); + var m = d.isub(p).imul(l).umod(h); + return ( + m.imul(f), + p.iadd(m), + new t(p.imul(r.unblinder).umod(i.modulus).toArray(false, o)) + ); + } + function a(e) { + for ( + var t = e.modulus.byteLength(), i = new n(r(t)); + i.cmp(e.modulus) >= 0 || !i.umod(e.prime1) || !i.umod(e.prime2); + + ) + i = new n(r(t)); + return i; + } + (e.exports = o), (o.getr = a); + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { var n = t; - n.utils = i(33), - n.common = i(71), - n.sha = i(556), - n.ripemd = i(560), - n.hmac = i(561), - n.sha1 = n.sha.sha1, - n.sha256 = n.sha.sha256, - n.sha224 = n.sha.sha224, - n.sha384 = n.sha.sha384, - n.sha512 = n.sha.sha512, - n.ripemd160 = n.ripemd.ripemd160 -} -, function(e, t, i) { + (n.utils = i(33)), + (n.common = i(71)), + (n.sha = i(556)), + (n.ripemd = i(560)), + (n.hmac = i(561)), + (n.sha1 = n.sha.sha1), + (n.sha256 = n.sha.sha256), + (n.sha224 = n.sha.sha224), + (n.sha384 = n.sha.sha384), + (n.sha512 = n.sha.sha512), + (n.ripemd160 = n.ripemd.ripemd160); + }, + function (e, t, i) { "use strict"; i.r(t), - t.default = function() { + (t.default = function () { var e = new URL(document.location).searchParams; - this.isSinglePlayer = !!e.get("singlePlayer"), - this.isWebRTCSupported = false; + (this.isSinglePlayer = !!e.get("singlePlayer")), + (this.isWebRTCSupported = false); try { - (new RTCPeerConnection).ondatachannel = function(e) {} - , - this.isWebRTCSupported = true + (new RTCPeerConnection().ondatachannel = function (e) {}), + (this.isWebRTCSupported = true); } catch (e) {} this.isWebGLSupported = false; - var t = document.createElement("canvas") - , i = t.getContext("webgl") || t.getContext("experimental-webgl"); - i && i instanceof WebGLRenderingContext && (this.isWebGLSupported = true), - this.isMobile = false, - new RegExp("Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile","i").test(navigator.userAgent) && (this.isMobile = true) - } -} -, function(e, t, i) { + var t = document.createElement("canvas"), + i = t.getContext("webgl") || t.getContext("experimental-webgl"); + i && + i instanceof WebGLRenderingContext && + (this.isWebGLSupported = true), + (this.isMobile = false), + new RegExp( + "Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile", + "i" + ).test(navigator.userAgent) && (this.isMobile = true); + }); + }, + function (e, t, i) { "use strict"; - (function(e) { - var n = i(93) - , r = i.n(n) - , o = i(55) - , a = i(18) - , s = i(7); - function c(e, t, i) { - return t in e ? Object.defineProperty(e, t, { + (function (e) { + var n = i(93), + r = i.n(n), + o = i(55), + a = i(18), + s = i(7); + function c(e, t, i) { + return ( + t in e + ? Object.defineProperty(e, t, { value: i, enumerable: true, configurable: true, - writable: true - }) : e[t] = i, - e + writable: true, + }) + : (e[t] = i), + e + ); + } + function u(e, t) { + for (var i = 0; i < t.length; i++) { + var n = t[i]; + (n.enumerable = n.enumerable || false), + (n.configurable = true), + "value" in n && (n.writable = true), + Object.defineProperty(e, n.key, n); } - function u(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n.enumerable = n.enumerable || false, - n.configurable = true, - "value"in n && (n.writable = true), - Object.defineProperty(e, n.key, n) - } + } + var l = (function () { + function t(e) { + var i = this; + !(function (e, t) { + if (!(e instanceof t)) + throw new TypeError("Cannot call a class as a function"); + })(this, t), + (this.maxChangesPerSync = 1e3), + this.initializeState(e), + (this.maxPlayers = 10), + (this.lastUpdate = 0), + (this.changedBlocks = []); + var n = this; + (this.changedBlockHandler = { + setBlock: function (e, t) { + var i = { + add: false, + p: e.slice(), + bt: t, + }; + s.default.getInstance().addBlockChange(i), + n.changedBlocks.push(i); + }, + addBlock: function (e, t) { + var i = { + add: true, + p: e.slice(), + bt: t, + }; + s.default.getInstance().addBlockChange(i), + n.changedBlocks.push(i); + }, + }), + setInterval(function () { + i.update(); + }, 50); } - var l = function() { - function t(e) { - var i = this; - !function(e, t) { - if (!(e instanceof t)) - throw new TypeError("Cannot call a class as a function") - }(this, t), - this.maxChangesPerSync = 1e3, - this.initializeState(e), - this.maxPlayers = 10, - this.lastUpdate = 0, - this.changedBlocks = []; - var n = this; - this.changedBlockHandler = { - setBlock: function(e, t) { - var i = { - add: false, - p: e.slice(), - bt: t - }; - s.default.getInstance().addBlockChange(i), - n.changedBlocks.push(i) + var i, n, l; + return ( + (i = t), + (n = [ + { + key: "update", + value: function () { + new Date(), this.lastUpdate; + this.broadcastPlayers(); + }, + }, + { + key: "initializeState", + value: function (e) { + var t = {}, + i = new o.a({ + name: e.name, + network: this, + isClient: false, + peer: { + send: function () {}, }, - addBlock: function(e, t) { - var i = { - add: true, - p: e.slice(), - bt: t - }; - s.default.getInstance().addBlockChange(i), - n.changedBlocks.push(i) - } - }, - setInterval(function() { - i.update() - }, 50) - } - var i, n, l; - return i = t, - (n = [{ - key: "update", - value: function() { - new Date, - this.lastUpdate; - this.broadcastPlayers() - } - }, { - key: "initializeState", - value: function(e) { - var t = {} - , i = new o.a({ - name: e.name, - network: this, - isClient: false, - peer: { - send: function() {} - } - }); - t[e.name] = i, - this.state = { - name: e.name, - players: t, - code: null, - gameStarted: false, - game: e.game, - seed: e.seed, - chatLog: [], - spawnPoint: null - }, - this.hostPlayer = i - } - }, { - key: "setName", - value: function(e) { - this.getPlayer().state.name = e, - this.state.name = e - } - }, { - key: "getPlayer", - value: function() { - return this.hostPlayer - } - }, { - key: "copyPlayers", - value: function() { - return Object.assign({}, this.state.players) - } - }, { - key: "playersToArray", - value: function() { - var e = []; - for (var t in this.state.players) - e.push({ - name: t, - peer: this.state.players[t].peer, - state: this.state.players[t].state - }); - return e - } - }, { - key: "getSpawnedPlayerNames", - value: function() { - var e = []; - for (var t in this.state.players) - this.state.players[t].state.spawned && e.push(this.state.players[t].state.name); - return e - } - }, { - key: "kickPlayer", - value: function(e) { - if (this.state.name === e) - return "No kicking yourself"; - for (var t in this.state.players) - if (this.state.players[t].state.name === e) { - var i = { - message: "kicking " + e, - timestamp: +new Date, - type: "message", - from: this.state.name - }; - return this.handleMessage(i), - this.broadcastPlayer(t, { - type: "kicked" - }), - this.state.players[t].peer.destroy(), - "Kicking " + e - } - return "No such player" - } - }, { - key: "setSpawnToCurrentPosition", - value: function() { - return this.state.spawnPoint = this.hostPlayer.state.position, - "Spawn point set to " + JSON.stringify(this.hostPlayer.state.position) - } - }, { - key: "getPositionFor", - value: function(e) { - for (var t in this.state.players) - if (this.state.players[t].state.name === e) - return this.state.players[t].state.position; - return null - } - }, { - key: "handleData", - value: function(e, t) { - switch (t.type) { - case "connected": - this.handleConnected(e); - break; - case "playerState": - this.handlePlayerState(e, t.data.state); - break; - case "setBlockTypeAt": - this.state.game.setBlock(t.data.blockTypeId, t.data.position); - break; - case "fireEvent": - this.state.game.handleFireEvent(t.data), - this.broadcastToOthers(e, { - type: "fireEvent", - data: t.data - }); - break; - case "message": - this.handleMessage(t.message); - break; - case "requestChanges": - var i = this.changedBlocks.slice(t.from, t.from + this.maxChangesPerSync); - i.length && this.broadcastPlayer(e, { - type: "changedBlocks", - blocks: i, - from: t.from - }); - break; - default: - throw Error("Unkown data type ", t.type) - } - } - }, { - key: "broadcastPlayer", - value: function(e, t) { - var i = this.state.players[e].peer; - i.connected && i.send(JSON.stringify(t)) - } - }, { - key: "broadcast", - value: function(e) { - for (var t in this.state.players) - this.broadcastPlayer(t, e) - } - }, { - key: "broadcastToOthers", - value: function(e, t) { - for (var i in this.state.players) - e !== i && this.broadcastPlayer(i, t) - } - }, { - key: "broadcastPlayers", - value: function() { - this.broadcast({ - type: "players", - players: this.playersToArray().map(function(e) { - return { - name: e.state.name, - id: e.name, - state: e.state - } - }) - }) - } - }, { - key: "handleConnected", - value: function(e) { - this.broadcastPlayers() - } - }, { - key: "getOpenGame", - value: function(t) { - var i = this; - return new e(function(e, n) { - a.a.getGame(t).then(function(t) { - i.gameCode = t.code, - console.log("got code " + i.gameCode), - e(i.gameCode) - }) - } - ) - } - }, { - key: "initNewGame", - value: function(t) { - var i = this; - return new e(function(e, n) { - i.getOpenGame(t).then(function(t) { - i.setState({ - code: t - }), - e(t), - a.a.createSignalingChannel(t, "host").then(function() { - a.a.listenForData(t, function(e) { - void 0 !== e.payload.signal && i.handlePlayerSignaling(e, t) - }) - }) - }) - } - ) - } - }, { - key: "handlePlayerSignaling", - value: function(e, t) { - var i = this - , n = e.from.split("/")[1]; - if (void 0 === this.state.players[n]) { - var s = new r.a({ - initiator: false - }); - s.signal(e.payload.signal), - s.on("signal", function(e) { - a.a.sendSignalingTo(t, n, "host", e) - }); - var c = this.copyPlayers(); - c[n] = new o.a({ - name: n, - peer: s - }), - this.setState({ - players: c - }, function() { - i.broadcastPlayers() - }), - s.on("connect", function() { - var e = i.playersToArray().length - , t = e > i.maxPlayers; - i.sendWelcomeInfo(s, t, e), - t && l(false) - }), - s.on("data", function(e) { - i.handleData(n, JSON.parse(e)) - }); - var u = this - , l = function(e) { - var t = Object.assign({}, u.state.players); - void 0 !== t[n] && (void 0 !== t[n].noaPlayer && t[n].noaPlayer.remove(), - e && t[n].state.spawned && u.sendLeftMessage(t[n].state.name), - delete t[n], - u.setState({ - players: t - }), - s.destroy()) - }; - s.on("close", function() { - l(true) - }), - s.on("error", function(e) { - e.code - }) - } - } - }, { - key: "sendWelcomeInfo", - value: function(e, t, i) { - e.send(JSON.stringify({ - type: "welcomeInfo", - hostName: this.hostPlayer.state.name, - gameFull: t, - playerCount: i, - maxPlayers: this.maxPlayers, - worldSeed: this.state.seed, - worldSize: s.default.getInstance().getWorldSize(), - spawnPoint: this.state.spawnPoint, - numberOfChangedBlocks: this.changedBlocks.length - })) - } - }, { - key: "setState", - value: function(e, t) { - this.state = function(e) { - for (var t = 1; t < arguments.length; t++) { - var i = null != arguments[t] ? arguments[t] : {} - , n = Object.keys(i); - "function" == typeof Object.getOwnPropertySymbols && (n = n.concat(Object.getOwnPropertySymbols(i).filter(function(e) { - return Object.getOwnPropertyDescriptor(i, e).enumerable - }))), - n.forEach(function(t) { - c(e, t, i[t]) - }) - } - return e - }({}, this.state, e), - t && "function" == typeof t && t() - } - }, { - key: "handlePlayerState", - value: function(e, t) { - this.state.players[e].setState(t) - } - }, { - key: "emitFireEvent", - value: function(e) { - this.broadcast({ + }); + (t[e.name] = i), + (this.state = { + name: e.name, + players: t, + code: null, + gameStarted: false, + game: e.game, + seed: e.seed, + chatLog: [], + spawnPoint: null, + }), + (this.hostPlayer = i); + }, + }, + { + key: "setName", + value: function (e) { + (this.getPlayer().state.name = e), (this.state.name = e); + }, + }, + { + key: "getPlayer", + value: function () { + return this.hostPlayer; + }, + }, + { + key: "copyPlayers", + value: function () { + return Object.assign({}, this.state.players); + }, + }, + { + key: "playersToArray", + value: function () { + var e = []; + for (var t in this.state.players) + e.push({ + name: t, + peer: this.state.players[t].peer, + state: this.state.players[t].state, + }); + return e; + }, + }, + { + key: "getSpawnedPlayerNames", + value: function () { + var e = []; + for (var t in this.state.players) + this.state.players[t].state.spawned && + e.push(this.state.players[t].state.name); + return e; + }, + }, + { + key: "kickPlayer", + value: function (e) { + if (this.state.name === e) return "No kicking yourself"; + for (var t in this.state.players) + if (this.state.players[t].state.name === e) { + var i = { + message: "kicking " + e, + timestamp: +new Date(), + type: "message", + from: this.state.name, + }; + return ( + this.handleMessage(i), + this.broadcastPlayer(t, { + type: "kicked", + }), + this.state.players[t].peer.destroy(), + "Kicking " + e + ); + } + return "No such player"; + }, + }, + { + key: "setSpawnToCurrentPosition", + value: function () { + return ( + (this.state.spawnPoint = this.hostPlayer.state.position), + "Spawn point set to " + + JSON.stringify(this.hostPlayer.state.position) + ); + }, + }, + { + key: "getPositionFor", + value: function (e) { + for (var t in this.state.players) + if (this.state.players[t].state.name === e) + return this.state.players[t].state.position; + return null; + }, + }, + { + key: "handleData", + value: function (e, t) { + switch (t.type) { + case "connected": + this.handleConnected(e); + break; + case "playerState": + this.handlePlayerState(e, t.data.state); + break; + case "setBlockTypeAt": + this.state.game.setBlock( + t.data.blockTypeId, + t.data.position + ); + break; + case "fireEvent": + this.state.game.handleFireEvent(t.data), + this.broadcastToOthers(e, { type: "fireEvent", - data: e - }) + data: t.data, + }); + break; + case "message": + this.handleMessage(t.message); + break; + case "requestChanges": + var i = this.changedBlocks.slice( + t.from, + t.from + this.maxChangesPerSync + ); + i.length && + this.broadcastPlayer(e, { + type: "changedBlocks", + blocks: i, + from: t.from, + }); + break; + default: + throw Error("Unkown data type ", t.type); } - }, { - key: "sendJoinedMessage", - value: function(e) { - var t = { - message: "", - timestamp: +new Date, - type: "joined", - from: e + }, + }, + { + key: "broadcastPlayer", + value: function (e, t) { + var i = this.state.players[e].peer; + i.connected && i.send(JSON.stringify(t)); + }, + }, + { + key: "broadcast", + value: function (e) { + for (var t in this.state.players) this.broadcastPlayer(t, e); + }, + }, + { + key: "broadcastToOthers", + value: function (e, t) { + for (var i in this.state.players) + e !== i && this.broadcastPlayer(i, t); + }, + }, + { + key: "broadcastPlayers", + value: function () { + this.broadcast({ + type: "players", + players: this.playersToArray().map(function (e) { + return { + name: e.state.name, + id: e.name, + state: e.state, }; - this.handleMessage(t) - } - }, { - key: "sendLeftMessage", - value: function(e) { - var t = { - message: "", - timestamp: +new Date, - type: "left", - from: e + }), + }); + }, + }, + { + key: "handleConnected", + value: function (e) { + this.broadcastPlayers(); + }, + }, + { + key: "getOpenGame", + value: function (t) { + var i = this; + return new e(function (e, n) { + a.a.getGame(t).then(function (t) { + (i.gameCode = t.code), + console.log("got code " + i.gameCode), + e(i.gameCode); + }); + }); + }, + }, + { + key: "initNewGame", + value: function (t) { + var i = this; + return new e(function (e, n) { + i.getOpenGame(t).then(function (t) { + i.setState({ + code: t, + }), + e(t), + a.a.createSignalingChannel(t, "host").then(function () { + a.a.listenForData(t, function (e) { + void 0 !== e.payload.signal && + i.handlePlayerSignaling(e, t); + }); + }); + }); + }); + }, + }, + { + key: "handlePlayerSignaling", + value: function (e, t) { + var i = this, + n = e.from.split("/")[1]; + if (void 0 === this.state.players[n]) { + var s = new r.a({ + initiator: false, + }); + s.signal(e.payload.signal), + s.on("signal", function (e) { + a.a.sendSignalingTo(t, n, "host", e); + }); + var c = this.copyPlayers(); + (c[n] = new o.a({ + name: n, + peer: s, + })), + this.setState( + { + players: c, + }, + function () { + i.broadcastPlayers(); + } + ), + s.on("connect", function () { + var e = i.playersToArray().length, + t = e > i.maxPlayers; + i.sendWelcomeInfo(s, t, e), t && l(false); + }), + s.on("data", function (e) { + i.handleData(n, JSON.parse(e)); + }); + var u = this, + l = function (e) { + var t = Object.assign({}, u.state.players); + void 0 !== t[n] && + (void 0 !== t[n].noaPlayer && t[n].noaPlayer.remove(), + e && + t[n].state.spawned && + u.sendLeftMessage(t[n].state.name), + delete t[n], + u.setState({ + players: t, + }), + s.destroy()); }; - this.handleMessage(t) + s.on("close", function () { + l(true); + }), + s.on("error", function (e) { + e.code; + }); } - }, { - key: "sendMessage", - value: function(e) { - var t = { - message: e, - timestamp: +new Date, - type: "message", - from: this.state.name - }; - this.handleMessage(t) - } - }, { - key: "handleMessage", - value: function(e) { - this.state.chatLog.push(e), - this.state.game.updateChatLog(this.state.chatLog.slice(-20)), - this.broadcastToOthers(this.state.name, { - type: "chatLog", - chatLog: this.state.chatLog.slice(-20) - }) - } - }, { - key: "setChangedBlocks", - value: function(e) { - this.changedBlocks = e.splice(0) - } - }]) && u(i.prototype, n), - l && u(i, l), - t - }(); - t.a = l - } - ).call(this, i(41)) -} -, function(e, t, i) { - e.exports = !i(13) && !i(3)(function() { - return 7 != Object.defineProperty(i(95)("div"), "a", { - get: function() { - return 7 - } - }).a - }) -} -, function(e, t, i) { - var n = i(5) - , r = i(14) - , o = i(47) - , a = i(97) - , s = i(12).f; - e.exports = function(e) { - var t = r.Symbol || (r.Symbol = o ? {} : n.Symbol || {}); - "_" == e.charAt(0) || e in t || s(t, e, { - value: a.f(e) - }) - } -} -, function(e, t, i) { - var n = i(22) - , r = i(24) - , o = i(74)(false) - , a = i(98)("IE_PROTO"); - e.exports = function(e, t) { - var i, s = r(e), c = 0, u = []; - for (i in s) - i != a && n(s, i) && u.push(i); - for (; t.length > c; ) - n(s, i = t[c++]) && (~o(u, i) || u.push(i)); - return u - } -} -, function(e, t, i) { - var n = i(12) - , r = i(4) - , o = i(48); - e.exports = i(13) ? Object.defineProperties : function(e, t) { - r(e); - for (var i, a = o(t), s = a.length, c = 0; s > c; ) - n.f(e, i = a[c++], t[i]); - return e - } -} -, function(e, t, i) { - function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - var r = i(24) - , o = i(51).f - , a = {}.toString - , s = "object" == ("undefined" == typeof window ? "undefined" : n(window)) && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; - e.exports.f = function(e) { - return s && "[object Window]" == a.call(e) ? function(e) { - try { - return o(e) - } catch (e) { - return s.slice() - } - }(e) : o(r(e)) - } -} -, function(e, t, i) { - "use strict"; - var n = i(48) - , r = i(75) - , o = i(65) - , a = i(20) - , s = i(64) - , c = Object.assign; - e.exports = !c || i(3)(function() { - var e = {} - , t = {} - , i = Symbol() - , n = "abcdefghijklmnopqrst"; - return e[i] = 7, - n.split("").forEach(function(e) { - t[e] = e - }), - 7 != c({}, e)[i] || Object.keys(c({}, t)).join("") != n - }) ? function(e, t) { - for (var i = a(e), c = arguments.length, u = 1, l = r.f, h = o.f; c > u; ) - for (var f, d = s(arguments[u++]), p = l ? n(d).concat(l(d)) : n(d), m = p.length, g = 0; m > g; ) - h.call(d, f = p[g++]) && (i[f] = d[f]); - return i - } - : c -} -, function(e, t) { - e.exports = Object.is || function(e, t) { - return e === t ? 0 !== e || 1 / e == 1 / t : e != e && t != t - } -} -, function(e, t, i) { - "use strict"; - var n = i(35) - , r = i(6) - , o = i(146) - , a = [].slice - , s = {}; - e.exports = Function.bind || function(e) { - var t = n(this) - , i = a.call(arguments, 1) - , c = function n() { - var r = i.concat(a.call(arguments)); - return this instanceof n ? function(e, t, i) { - if (!(t in s)) { - for (var n = [], r = 0; r < t; r++) - n[r] = "a[" + r + "]"; - s[t] = Function("F,a", "return new F(" + n.join(",") + ")") - } - return s[t](e, i) - }(t, r.length, r) : o(t, r, e) + }, + }, + { + key: "sendWelcomeInfo", + value: function (e, t, i) { + e.send( + JSON.stringify({ + type: "welcomeInfo", + hostName: this.hostPlayer.state.name, + gameFull: t, + playerCount: i, + maxPlayers: this.maxPlayers, + worldSeed: this.state.seed, + worldSize: s.default.getInstance().getWorldSize(), + spawnPoint: this.state.spawnPoint, + numberOfChangedBlocks: this.changedBlocks.length, + }) + ); + }, + }, + { + key: "setState", + value: function (e, t) { + (this.state = (function (e) { + for (var t = 1; t < arguments.length; t++) { + var i = null != arguments[t] ? arguments[t] : {}, + n = Object.keys(i); + "function" == typeof Object.getOwnPropertySymbols && + (n = n.concat( + Object.getOwnPropertySymbols(i).filter(function (e) { + return Object.getOwnPropertyDescriptor( + i, + e + ).enumerable; + }) + )), + n.forEach(function (t) { + c(e, t, i[t]); + }); + } + return e; + })({}, this.state, e)), + t && "function" == typeof t && t(); + }, + }, + { + key: "handlePlayerState", + value: function (e, t) { + this.state.players[e].setState(t); + }, + }, + { + key: "emitFireEvent", + value: function (e) { + this.broadcast({ + type: "fireEvent", + data: e, + }); + }, + }, + { + key: "sendJoinedMessage", + value: function (e) { + var t = { + message: "", + timestamp: +new Date(), + type: "joined", + from: e, + }; + this.handleMessage(t); + }, + }, + { + key: "sendLeftMessage", + value: function (e) { + var t = { + message: "", + timestamp: +new Date(), + type: "left", + from: e, + }; + this.handleMessage(t); + }, + }, + { + key: "sendMessage", + value: function (e) { + var t = { + message: e, + timestamp: +new Date(), + type: "message", + from: this.state.name, + }; + this.handleMessage(t); + }, + }, + { + key: "handleMessage", + value: function (e) { + this.state.chatLog.push(e), + this.state.game.updateChatLog(this.state.chatLog.slice(-20)), + this.broadcastToOthers(this.state.name, { + type: "chatLog", + chatLog: this.state.chatLog.slice(-20), + }); + }, + }, + { + key: "setChangedBlocks", + value: function (e) { + this.changedBlocks = e.splice(0); + }, + }, + ]) && u(i.prototype, n), + l && u(i, l), + t + ); + })(); + t.a = l; + }.call(this, i(41))); + }, + function (e, t, i) { + e.exports = + !i(13) && + !i(3)(function () { + return ( + 7 != + Object.defineProperty(i(95)("div"), "a", { + get: function () { + return 7; + }, + }).a + ); + }); + }, + function (e, t, i) { + var n = i(5), + r = i(14), + o = i(47), + a = i(97), + s = i(12).f; + e.exports = function (e) { + var t = r.Symbol || (r.Symbol = o ? {} : n.Symbol || {}); + "_" == e.charAt(0) || + e in t || + s(t, e, { + value: a.f(e), + }); + }; + }, + function (e, t, i) { + var n = i(22), + r = i(24), + o = i(74)(false), + a = i(98)("IE_PROTO"); + e.exports = function (e, t) { + var i, + s = r(e), + c = 0, + u = []; + for (i in s) i != a && n(s, i) && u.push(i); + for (; t.length > c; ) n(s, (i = t[c++])) && (~o(u, i) || u.push(i)); + return u; + }; + }, + function (e, t, i) { + var n = i(12), + r = i(4), + o = i(48); + e.exports = i(13) + ? Object.defineProperties + : function (e, t) { + r(e); + for (var i, a = o(t), s = a.length, c = 0; s > c; ) + n.f(e, (i = a[c++]), t[i]); + return e; }; - return r(t.prototype) && (c.prototype = t.prototype), - c - } -} -, function(e, t) { - e.exports = function(e, t, i) { - var n = void 0 === i; - switch (t.length) { - case 0: - return n ? e() : e.call(i); - case 1: - return n ? e(t[0]) : e.call(i, t[0]); - case 2: - return n ? e(t[0], t[1]) : e.call(i, t[0], t[1]); - case 3: - return n ? e(t[0], t[1], t[2]) : e.call(i, t[0], t[1], t[2]); - case 4: - return n ? e(t[0], t[1], t[2], t[3]) : e.call(i, t[0], t[1], t[2], t[3]) - } - return e.apply(i, t) - } -} -, function(e, t, i) { - var n = i(5).parseInt - , r = i(76).trim - , o = i(103) - , a = /^[-+]?0[xX]/; - e.exports = 8 !== n(o + "08") || 22 !== n(o + "0x16") ? function(e, t) { - var i = r(String(e), 3); - return n(i, t >>> 0 || (a.test(i) ? 16 : 10)) - } - : n -} -, function(e, t, i) { - var n = i(5).parseFloat - , r = i(76).trim; - e.exports = 1 / n(i(103) + "-0") != -1 / 0 ? function(e) { - var t = r(String(e), 3) - , i = n(t); - return 0 === i && "-" == t.charAt(0) ? -0 : i - } - : n -} -, function(e, t, i) { - var n = i(36); - e.exports = function(e, t) { - if ("number" != typeof e && "Number" != n(e)) - throw TypeError(t); - return +e - } -} -, function(e, t, i) { - var n = i(6) - , r = Math.floor; - e.exports = function(e) { - return !n(e) && isFinite(e) && r(e) === e - } -} -, function(e, t) { - e.exports = Math.log1p || function(e) { - return (e = +e) > -1e-8 && e < 1e-8 ? e - e * e / 2 : Math.log(1 + e) - } -} -, function(e, t, i) { - "use strict"; - var n = i(50) - , r = i(45) - , o = i(56) - , a = {}; - i(23)(a, i(8)("iterator"), function() { - return this - }), - e.exports = function(e, t, i) { - e.prototype = n(a, { - next: r(1, i) - }), - o(e, t + " Iterator") - } -} -, function(e, t, i) { - var n = i(4); - e.exports = function(e, t, i, r) { - try { - return r ? t(n(i)[0], i[1]) : t(i) - } catch (t) { - var o = e.return; - throw void 0 !== o && n(o.call(e)), - t - } - } -} -, function(e, t, i) { - var n = i(35) - , r = i(20) - , o = i(64) - , a = i(10); - e.exports = function(e, t, i, s, c) { - n(t); - var u = r(e) - , l = o(u) - , h = a(u.length) - , f = c ? h - 1 : 0 - , d = c ? -1 : 1; - if (i < 2) - for (; ; ) { - if (f in l) { - s = l[f], - f += d; - break - } - if (f += d, - c ? f < 0 : h <= f) - throw TypeError("Reduce of empty array with no initial value") + }, + function (e, t, i) { + function n(e) { + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; } - for (; c ? f >= 0 : h > f; f += d) - f in l && (s = t(s, l[f], f, u)); - return s + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } -} -, function(e, t, i) { + var r = i(24), + o = i(51).f, + a = {}.toString, + s = + "object" == ("undefined" == typeof window ? "undefined" : n(window)) && + window && + Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) + : []; + e.exports.f = function (e) { + return s && "[object Window]" == a.call(e) + ? (function (e) { + try { + return o(e); + } catch (e) { + return s.slice(); + } + })(e) + : o(r(e)); + }; + }, + function (e, t, i) { "use strict"; - var n = i(20) - , r = i(49) - , o = i(10); - e.exports = [].copyWithin || function(e, t) { - var i = n(this) - , a = o(i.length) - , s = r(e, a) - , c = r(t, a) - , u = arguments.length > 2 ? arguments[2] : void 0 - , l = Math.min((void 0 === u ? a : r(u, a)) - c, a - s) - , h = 1; - for (c < s && s < c + l && (h = -1, - c += l - 1, - s += l - 1); l-- > 0; ) - c in i ? i[s] = i[c] : delete i[s], - s += h, - c += h; - return i - } -} -, function(e, t) { - e.exports = function(e, t) { - return { - value: t, - done: !!e + var n = i(48), + r = i(75), + o = i(65), + a = i(20), + s = i(64), + c = Object.assign; + e.exports = + !c || + i(3)(function () { + var e = {}, + t = {}, + i = Symbol(), + n = "abcdefghijklmnopqrst"; + return ( + (e[i] = 7), + n.split("").forEach(function (e) { + t[e] = e; + }), + 7 != c({}, e)[i] || Object.keys(c({}, t)).join("") != n + ); + }) + ? function (e, t) { + for ( + var i = a(e), c = arguments.length, u = 1, l = r.f, h = o.f; + c > u; + + ) + for ( + var f, + d = s(arguments[u++]), + p = l ? n(d).concat(l(d)) : n(d), + m = p.length, + g = 0; + m > g; + + ) + h.call(d, (f = p[g++])) && (i[f] = d[f]); + return i; + } + : c; + }, + function (e, t) { + e.exports = + Object.is || + function (e, t) { + return e === t ? 0 !== e || 1 / e == 1 / t : e != e && t != t; + }; + }, + function (e, t, i) { + "use strict"; + var n = i(35), + r = i(6), + o = i(146), + a = [].slice, + s = {}; + e.exports = + Function.bind || + function (e) { + var t = n(this), + i = a.call(arguments, 1), + c = function n() { + var r = i.concat(a.call(arguments)); + return this instanceof n + ? (function (e, t, i) { + if (!(t in s)) { + for (var n = [], r = 0; r < t; r++) n[r] = "a[" + r + "]"; + s[t] = Function("F,a", "return new F(" + n.join(",") + ")"); + } + return s[t](e, i); + })(t, r.length, r) + : o(t, r, e); + }; + return r(t.prototype) && (c.prototype = t.prototype), c; + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + var n = void 0 === i; + switch (t.length) { + case 0: + return n ? e() : e.call(i); + case 1: + return n ? e(t[0]) : e.call(i, t[0]); + case 2: + return n ? e(t[0], t[1]) : e.call(i, t[0], t[1]); + case 3: + return n ? e(t[0], t[1], t[2]) : e.call(i, t[0], t[1], t[2]); + case 4: + return n + ? e(t[0], t[1], t[2], t[3]) + : e.call(i, t[0], t[1], t[2], t[3]); + } + return e.apply(i, t); + }; + }, + function (e, t, i) { + var n = i(5).parseInt, + r = i(76).trim, + o = i(103), + a = /^[-+]?0[xX]/; + e.exports = + 8 !== n(o + "08") || 22 !== n(o + "0x16") + ? function (e, t) { + var i = r(String(e), 3); + return n(i, t >>> 0 || (a.test(i) ? 16 : 10)); + } + : n; + }, + function (e, t, i) { + var n = i(5).parseFloat, + r = i(76).trim; + e.exports = + 1 / n(i(103) + "-0") != -1 / 0 + ? function (e) { + var t = r(String(e), 3), + i = n(t); + return 0 === i && "-" == t.charAt(0) ? -0 : i; + } + : n; + }, + function (e, t, i) { + var n = i(36); + e.exports = function (e, t) { + if ("number" != typeof e && "Number" != n(e)) throw TypeError(t); + return +e; + }; + }, + function (e, t, i) { + var n = i(6), + r = Math.floor; + e.exports = function (e) { + return !n(e) && isFinite(e) && r(e) === e; + }; + }, + function (e, t) { + e.exports = + Math.log1p || + function (e) { + return (e = +e) > -1e-8 && e < 1e-8 ? e - (e * e) / 2 : Math.log(1 + e); + }; + }, + function (e, t, i) { + "use strict"; + var n = i(50), + r = i(45), + o = i(56), + a = {}; + i(23)(a, i(8)("iterator"), function () { + return this; + }), + (e.exports = function (e, t, i) { + (e.prototype = n(a, { + next: r(1, i), + })), + o(e, t + " Iterator"); + }); + }, + function (e, t, i) { + var n = i(4); + e.exports = function (e, t, i, r) { + try { + return r ? t(n(i)[0], i[1]) : t(i); + } catch (t) { + var o = e.return; + throw (void 0 !== o && n(o.call(e)), t); + } + }; + }, + function (e, t, i) { + var n = i(35), + r = i(20), + o = i(64), + a = i(10); + e.exports = function (e, t, i, s, c) { + n(t); + var u = r(e), + l = o(u), + h = a(u.length), + f = c ? h - 1 : 0, + d = c ? -1 : 1; + if (i < 2) + for (;;) { + if (f in l) { + (s = l[f]), (f += d); + break; + } + if (((f += d), c ? f < 0 : h <= f)) + throw TypeError("Reduce of empty array with no initial value"); } - } -} -, function(e, t, i) { + for (; c ? f >= 0 : h > f; f += d) f in l && (s = t(s, l[f], f, u)); + return s; + }; + }, + function (e, t, i) { + "use strict"; + var n = i(20), + r = i(49), + o = i(10); + e.exports = + [].copyWithin || + function (e, t) { + var i = n(this), + a = o(i.length), + s = r(e, a), + c = r(t, a), + u = arguments.length > 2 ? arguments[2] : void 0, + l = Math.min((void 0 === u ? a : r(u, a)) - c, a - s), + h = 1; + for ( + c < s && s < c + l && ((h = -1), (c += l - 1), (s += l - 1)); + l-- > 0; + + ) + c in i ? (i[s] = i[c]) : delete i[s], (s += h), (c += h); + return i; + }; + }, + function (e, t) { + e.exports = function (e, t) { + return { + value: t, + done: !!e, + }; + }; + }, + function (e, t, i) { "use strict"; var n = i(118); - i(0)({ + i(0)( + { target: "RegExp", proto: true, - forced: n !== /./.exec - }, { - exec: n - }) -} -, function(e, t, i) { - i(13) && "g" != /./g.flags && i(12).f(RegExp.prototype, "flags", { + forced: n !== /./.exec, + }, + { + exec: n, + } + ); + }, + function (e, t, i) { + i(13) && + "g" != /./g.flags && + i(12).f(RegExp.prototype, "flags", { configurable: true, - get: i(78) - }) -} -, function(e, t, i) { + get: i(78), + }); + }, + function (e, t, i) { "use strict"; - var n, r, o, a, s = i(47), c = i(5), u = i(34), l = i(66), h = i(0), f = i(6), d = i(35), p = i(60), m = i(81), g = i(67), _ = i(120).set, v = i(342)(), y = i(160), b = i(343), E = i(82), T = i(161), A = c.TypeError, x = c.process, S = x && x.versions, C = S && S.v8 || "", P = c.Promise, R = "process" == l(x), M = function() {}, O = r = y.f, w = !!function() { + var n, + r, + o, + a, + s = i(47), + c = i(5), + u = i(34), + l = i(66), + h = i(0), + f = i(6), + d = i(35), + p = i(60), + m = i(81), + g = i(67), + _ = i(120).set, + v = i(342)(), + y = i(160), + b = i(343), + E = i(82), + T = i(161), + A = c.TypeError, + x = c.process, + S = x && x.versions, + C = (S && S.v8) || "", + P = c.Promise, + R = "process" == l(x), + M = function () {}, + O = (r = y.f), + w = !!(function () { try { - var e = P.resolve(1) - , t = (e.constructor = {})[i(8)("species")] = function(e) { - e(M, M) - } - ; - return (R || "function" == typeof PromiseRejectionEvent) && e.then(M)instanceof t && 0 !== C.indexOf("6.6") && -1 === E.indexOf("Chrome/66") + var e = P.resolve(1), + t = ((e.constructor = {})[i(8)("species")] = function (e) { + e(M, M); + }); + return ( + (R || "function" == typeof PromiseRejectionEvent) && + e.then(M) instanceof t && + 0 !== C.indexOf("6.6") && + -1 === E.indexOf("Chrome/66") + ); } catch (e) {} - }(), I = function(e) { + })(), + I = function (e) { var t; - return !(!f(e) || "function" != typeof (t = e.then)) && t - }, D = function(e, t) { + return !(!f(e) || "function" != typeof (t = e.then)) && t; + }, + D = function (e, t) { if (!e._n) { - e._n = true; - var i = e._c; - v(function() { - for (var n = e._v, r = 1 == e._s, o = 0, a = function(t) { - var i, o, a, s = r ? t.ok : t.fail, c = t.resolve, u = t.reject, l = t.domain; - try { - s ? (r || (2 == e._h && B(e), - e._h = 1), - true === s ? i = n : (l && l.enter(), - i = s(n), - l && (l.exit(), - a = true)), - i === t.promise ? u(A("Promise-chain cycle")) : (o = I(i)) ? o.call(i, c, u) : c(i)) : u(n) - } catch (e) { - l && !a && l.exit(), - u(e) - } - }; i.length > o; ) - a(i[o++]); - e._c = [], - e._n = false, - t && !e._h && L(e) - }) + e._n = true; + var i = e._c; + v(function () { + for ( + var n = e._v, + r = 1 == e._s, + o = 0, + a = function (t) { + var i, + o, + a, + s = r ? t.ok : t.fail, + c = t.resolve, + u = t.reject, + l = t.domain; + try { + s + ? (r || (2 == e._h && B(e), (e._h = 1)), + true === s + ? (i = n) + : (l && l.enter(), + (i = s(n)), + l && (l.exit(), (a = true))), + i === t.promise + ? u(A("Promise-chain cycle")) + : (o = I(i)) + ? o.call(i, c, u) + : c(i)) + : u(n); + } catch (e) { + l && !a && l.exit(), u(e); + } + }; + i.length > o; + + ) + a(i[o++]); + (e._c = []), (e._n = false), t && !e._h && L(e); + }); } - }, L = function(e) { - _.call(c, function() { - var t, i, n, r = e._v, o = F(e); - if (o && (t = b(function() { - R ? x.emit("unhandledRejection", r, e) : (i = c.onunhandledrejection) ? i({ - promise: e, - reason: r - }) : (n = c.console) && n.error && n.error("Unhandled promise rejection", r) - }), - e._h = R || F(e) ? 2 : 1), - e._a = void 0, + }, + L = function (e) { + _.call(c, function () { + var t, + i, + n, + r = e._v, + o = F(e); + if ( + (o && + ((t = b(function () { + R + ? x.emit("unhandledRejection", r, e) + : (i = c.onunhandledrejection) + ? i({ + promise: e, + reason: r, + }) + : (n = c.console) && + n.error && + n.error("Unhandled promise rejection", r); + })), + (e._h = R || F(e) ? 2 : 1)), + (e._a = void 0), o && t.e) - throw t.v - }) - }, F = function(e) { - return 1 !== e._h && 0 === (e._a || e._c).length - }, B = function(e) { - _.call(c, function() { - var t; - R ? x.emit("rejectionHandled", e) : (t = c.onrejectionhandled) && t({ + ) + throw t.v; + }); + }, + F = function (e) { + return 1 !== e._h && 0 === (e._a || e._c).length; + }, + B = function (e) { + _.call(c, function () { + var t; + R + ? x.emit("rejectionHandled", e) + : (t = c.onrejectionhandled) && + t({ promise: e, - reason: e._v - }) - }) - }, N = function(e) { + reason: e._v, + }); + }); + }, + N = function (e) { var t = this; - t._d || (t._d = true, - (t = t._w || t)._v = e, - t._s = 2, - t._a || (t._a = t._c.slice()), - D(t, true)) - }, k = function e(t) { - var i, n = this; + t._d || + ((t._d = true), + ((t = t._w || t)._v = e), + (t._s = 2), + t._a || (t._a = t._c.slice()), + D(t, true)); + }, + k = function e(t) { + var i, + n = this; if (!n._d) { - n._d = true, - n = n._w || n; - try { - if (n === t) - throw A("Promise can't be resolved itself"); - (i = I(t)) ? v(function() { - var r = { - _w: n, - _d: false - }; - try { - i.call(t, u(e, r, 1), u(N, r, 1)) - } catch (e) { - N.call(r, e) - } - }) : (n._v = t, - n._s = 1, - D(n, false)) - } catch (e) { - N.call({ + (n._d = true), (n = n._w || n); + try { + if (n === t) throw A("Promise can't be resolved itself"); + (i = I(t)) + ? v(function () { + var r = { _w: n, - _d: false - }, e) - } + _d: false, + }; + try { + i.call(t, u(e, r, 1), u(N, r, 1)); + } catch (e) { + N.call(r, e); + } + }) + : ((n._v = t), (n._s = 1), D(n, false)); + } catch (e) { + N.call( + { + _w: n, + _d: false, + }, + e + ); + } } - }; - w || (P = function(e) { - p(this, P, "Promise", "_h"), - d(e), - n.call(this); + }; + w || + ((P = function (e) { + p(this, P, "Promise", "_h"), d(e), n.call(this); try { - e(u(k, this, 1), u(N, this, 1)) + e(u(k, this, 1), u(N, this, 1)); } catch (e) { - N.call(this, e) + N.call(this, e); } - } - , - (n = function(e) { - this._c = [], - this._a = void 0, - this._s = 0, - this._d = false, - this._v = void 0, - this._h = 0, - this._n = false - } - ).prototype = i(61)(P.prototype, { - then: function(e, t) { - var i = O(g(this, P)); - return i.ok = "function" != typeof e || e, - i.fail = "function" == typeof t && t, - i.domain = R ? x.domain : void 0, + }), + ((n = function (e) { + (this._c = []), + (this._a = void 0), + (this._s = 0), + (this._d = false), + (this._v = void 0), + (this._h = 0), + (this._n = false); + }).prototype = i(61)(P.prototype, { + then: function (e, t) { + var i = O(g(this, P)); + return ( + (i.ok = "function" != typeof e || e), + (i.fail = "function" == typeof t && t), + (i.domain = R ? x.domain : void 0), this._c.push(i), this._a && this._a.push(i), this._s && D(this, false), i.promise + ); }, - catch: function(e) { - return this.then(void 0, e) - } - }), - o = function() { - var e = new n; - this.promise = e, - this.resolve = u(k, e, 1), - this.reject = u(N, e, 1) - } - , - y.f = O = function(e) { - return e === P || e === a ? new o(e) : r(e) - } - ), - h(h.G + h.W + h.F * !w, { - Promise: P - }), - i(56)(P, "Promise"), - i(59)("Promise"), - a = i(14).Promise, - h(h.S + h.F * !w, "Promise", { - reject: function(e) { - var t = O(this); - return (0, - t.reject)(e), - t.promise - } - }), - h(h.S + h.F * (s || !w), "Promise", { - resolve: function(e) { - return T(s && this === a ? P : this, e) - } - }), - h(h.S + h.F * !(w && i(77)(function(e) { - P.all(e).catch(M) - })), "Promise", { - all: function(e) { - var t = this - , i = O(t) - , n = i.resolve - , r = i.reject - , o = b(function() { - var i = [] - , o = 0 - , a = 1; - m(e, false, function(e) { - var s = o++ - , c = false; - i.push(void 0), + catch: function (e) { + return this.then(void 0, e); + }, + })), + (o = function () { + var e = new n(); + (this.promise = e), + (this.resolve = u(k, e, 1)), + (this.reject = u(N, e, 1)); + }), + (y.f = O = + function (e) { + return e === P || e === a ? new o(e) : r(e); + })), + h(h.G + h.W + h.F * !w, { + Promise: P, + }), + i(56)(P, "Promise"), + i(59)("Promise"), + (a = i(14).Promise), + h(h.S + h.F * !w, "Promise", { + reject: function (e) { + var t = O(this); + return (0, t.reject)(e), t.promise; + }, + }), + h(h.S + h.F * (s || !w), "Promise", { + resolve: function (e) { + return T(s && this === a ? P : this, e); + }, + }), + h( + h.S + + h.F * + !( + w && + i(77)(function (e) { + P.all(e).catch(M); + }) + ), + "Promise", + { + all: function (e) { + var t = this, + i = O(t), + n = i.resolve, + r = i.reject, + o = b(function () { + var i = [], + o = 0, + a = 1; + m(e, false, function (e) { + var s = o++, + c = false; + i.push(void 0), a++, - t.resolve(e).then(function(e) { - c || (c = true, - i[s] = e, - --a || n(i)) - }, r) + t.resolve(e).then(function (e) { + c || ((c = true), (i[s] = e), --a || n(i)); + }, r); }), - --a || n(i) - }); - return o.e && r(o.v), - i.promise - }, - race: function(e) { - var t = this - , i = O(t) - , n = i.reject - , r = b(function() { - m(e, false, function(e) { - t.resolve(e).then(i.resolve, n) - }) - }); - return r.e && n(r.v), - i.promise + --a || n(i); + }); + return o.e && r(o.v), i.promise; + }, + race: function (e) { + var t = this, + i = O(t), + n = i.reject, + r = b(function () { + m(e, false, function (e) { + t.resolve(e).then(i.resolve, n); + }); + }); + return r.e && n(r.v), i.promise; + }, } - }) -} -, function(e, t, i) { + ); + }, + function (e, t, i) { "use strict"; var n = i(35); function r(e) { - var t, i; - this.promise = new e(function(e, n) { - if (void 0 !== t || void 0 !== i) - throw TypeError("Bad Promise constructor"); - t = e, - i = n - } - ), - this.resolve = n(t), - this.reject = n(i) + var t, i; + (this.promise = new e(function (e, n) { + if (void 0 !== t || void 0 !== i) + throw TypeError("Bad Promise constructor"); + (t = e), (i = n); + })), + (this.resolve = n(t)), + (this.reject = n(i)); } - e.exports.f = function(e) { - return new r(e) - } -} -, function(e, t, i) { - var n = i(4) - , r = i(6) - , o = i(160); - e.exports = function(e, t) { - if (n(e), - r(t) && t.constructor === e) - return t; - var i = o.f(e); - return (0, - i.resolve)(t), - i.promise - } -} -, function(e, t, i) { - "use strict"; - var n = i(12).f - , r = i(50) - , o = i(61) - , a = i(34) - , s = i(60) - , c = i(81) - , u = i(109) - , l = i(156) - , h = i(59) - , f = i(13) - , d = i(40).fastKey - , p = i(62) - , m = f ? "_s" : "size" - , g = function(e, t) { - var i, n = d(t); - if ("F" !== n) - return e._i[n]; - for (i = e._f; i; i = i.n) - if (i.k == t) - return i + e.exports.f = function (e) { + return new r(e); }; + }, + function (e, t, i) { + var n = i(4), + r = i(6), + o = i(160); + e.exports = function (e, t) { + if ((n(e), r(t) && t.constructor === e)) return t; + var i = o.f(e); + return (0, i.resolve)(t), i.promise; + }; + }, + function (e, t, i) { + "use strict"; + var n = i(12).f, + r = i(50), + o = i(61), + a = i(34), + s = i(60), + c = i(81), + u = i(109), + l = i(156), + h = i(59), + f = i(13), + d = i(40).fastKey, + p = i(62), + m = f ? "_s" : "size", + g = function (e, t) { + var i, + n = d(t); + if ("F" !== n) return e._i[n]; + for (i = e._f; i; i = i.n) if (i.k == t) return i; + }; e.exports = { - getConstructor: function(e, t, i, u) { - var l = e(function(e, n) { - s(e, l, t, "_i"), - e._t = t, - e._i = r(null), - e._f = void 0, - e._l = void 0, - e[m] = 0, - null != n && c(n, i, e[u], e) - }); - return o(l.prototype, { - clear: function() { - for (var e = p(this, t), i = e._i, n = e._f; n; n = n.n) - n.r = true, - n.p && (n.p = n.p.n = void 0), - delete i[n.i]; - e._f = e._l = void 0, - e[m] = 0 - }, - delete: function(e) { - var i = p(this, t) - , n = g(i, e); - if (n) { - var r = n.n - , o = n.p; - delete i._i[n.i], - n.r = true, - o && (o.n = r), - r && (r.p = o), - i._f == n && (i._f = r), - i._l == n && (i._l = o), - i[m]-- - } - return !!n - }, - forEach: function(e) { - p(this, t); - for (var i, n = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); i = i ? i.n : this._f; ) - for (n(i.v, i.k, this); i && i.r; ) - i = i.p - }, - has: function(e) { - return !!g(p(this, t), e) - } - }), - f && n(l.prototype, "size", { - get: function() { - return p(this, t)[m] - } - }), - l - }, - def: function(e, t, i) { - var n, r, o = g(e, t); - return o ? o.v = i : (e._l = o = { - i: r = d(t, true), - k: t, - v: i, - p: n = e._l, - n: void 0, - r: false + getConstructor: function (e, t, i, u) { + var l = e(function (e, n) { + s(e, l, t, "_i"), + (e._t = t), + (e._i = r(null)), + (e._f = void 0), + (e._l = void 0), + (e[m] = 0), + null != n && c(n, i, e[u], e); + }); + return ( + o(l.prototype, { + clear: function () { + for (var e = p(this, t), i = e._i, n = e._f; n; n = n.n) + (n.r = true), n.p && (n.p = n.p.n = void 0), delete i[n.i]; + (e._f = e._l = void 0), (e[m] = 0); }, - e._f || (e._f = o), - n && (n.n = o), - e[m]++, - "F" !== r && (e._i[r] = o)), - e - }, - getEntry: g, - setStrong: function(e, t, i) { - u(e, t, function(e, i) { - this._t = p(e, t), - this._k = i, - this._l = void 0 - }, function() { - for (var e = this._k, t = this._l; t && t.r; ) - t = t.p; - return this._t && (this._l = t = t ? t.n : this._t._f) ? l(0, "keys" == e ? t.k : "values" == e ? t.v : [t.k, t.v]) : (this._t = void 0, - l(1)) - }, i ? "entries" : "values", !i, true), - h(t) - } - } -} -, function(e, t, i) { - "use strict"; - var n = i(61) - , r = i(40).getWeak - , o = i(4) - , a = i(6) - , s = i(60) - , c = i(81) - , u = i(31) - , l = i(22) - , h = i(62) - , f = u(5) - , d = u(6) - , p = 0 - , m = function(e) { - return e._l || (e._l = new g) - } - , g = function() { - this.a = [] - } - , _ = function(e, t) { - return f(e.a, function(e) { - return e[0] === t - }) + delete: function (e) { + var i = p(this, t), + n = g(i, e); + if (n) { + var r = n.n, + o = n.p; + delete i._i[n.i], + (n.r = true), + o && (o.n = r), + r && (r.p = o), + i._f == n && (i._f = r), + i._l == n && (i._l = o), + i[m]--; + } + return !!n; + }, + forEach: function (e) { + p(this, t); + for ( + var i, + n = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + (i = i ? i.n : this._f); + + ) + for (n(i.v, i.k, this); i && i.r; ) i = i.p; + }, + has: function (e) { + return !!g(p(this, t), e); + }, + }), + f && + n(l.prototype, "size", { + get: function () { + return p(this, t)[m]; + }, + }), + l + ); + }, + def: function (e, t, i) { + var n, + r, + o = g(e, t); + return ( + o + ? (o.v = i) + : ((e._l = o = + { + i: (r = d(t, true)), + k: t, + v: i, + p: (n = e._l), + n: void 0, + r: false, + }), + e._f || (e._f = o), + n && (n.n = o), + e[m]++, + "F" !== r && (e._i[r] = o)), + e + ); + }, + getEntry: g, + setStrong: function (e, t, i) { + u( + e, + t, + function (e, i) { + (this._t = p(e, t)), (this._k = i), (this._l = void 0); + }, + function () { + for (var e = this._k, t = this._l; t && t.r; ) t = t.p; + return this._t && (this._l = t = t ? t.n : this._t._f) + ? l(0, "keys" == e ? t.k : "values" == e ? t.v : [t.k, t.v]) + : ((this._t = void 0), l(1)); + }, + i ? "entries" : "values", + !i, + true + ), + h(t); + }, }; - g.prototype = { - get: function(e) { - var t = _(this, e); - if (t) - return t[1] - }, - has: function(e) { - return !!_(this, e) - }, - set: function(e, t) { - var i = _(this, e); - i ? i[1] = t : this.a.push([e, t]) - }, - delete: function(e) { - var t = d(this.a, function(t) { - return t[0] === e - }); - return ~t && this.a.splice(t, 1), - !!~t - } - }, - e.exports = { - getConstructor: function(e, t, i, o) { - var u = e(function(e, n) { - s(e, u, t, "_i"), - e._t = t, - e._i = p++, - e._l = void 0, - null != n && c(n, i, e[o], e) - }); - return n(u.prototype, { - delete: function(e) { - if (!a(e)) - return false; - var i = r(e); - return true === i ? m(h(this, t)).delete(e) : i && l(i, this._i) && delete i[this._i] - }, - has: function(e) { - if (!a(e)) - return false; - var i = r(e); - return true === i ? m(h(this, t)).has(e) : i && l(i, this._i) - } + }, + function (e, t, i) { + "use strict"; + var n = i(61), + r = i(40).getWeak, + o = i(4), + a = i(6), + s = i(60), + c = i(81), + u = i(31), + l = i(22), + h = i(62), + f = u(5), + d = u(6), + p = 0, + m = function (e) { + return e._l || (e._l = new g()); + }, + g = function () { + this.a = []; + }, + _ = function (e, t) { + return f(e.a, function (e) { + return e[0] === t; + }); + }; + (g.prototype = { + get: function (e) { + var t = _(this, e); + if (t) return t[1]; + }, + has: function (e) { + return !!_(this, e); + }, + set: function (e, t) { + var i = _(this, e); + i ? (i[1] = t) : this.a.push([e, t]); + }, + delete: function (e) { + var t = d(this.a, function (t) { + return t[0] === e; + }); + return ~t && this.a.splice(t, 1), !!~t; + }, + }), + (e.exports = { + getConstructor: function (e, t, i, o) { + var u = e(function (e, n) { + s(e, u, t, "_i"), + (e._t = t), + (e._i = p++), + (e._l = void 0), + null != n && c(n, i, e[o], e); + }); + return ( + n(u.prototype, { + delete: function (e) { + if (!a(e)) return false; + var i = r(e); + return true === i + ? m(h(this, t)).delete(e) + : i && l(i, this._i) && delete i[this._i]; + }, + has: function (e) { + if (!a(e)) return false; + var i = r(e); + return true === i ? m(h(this, t)).has(e) : i && l(i, this._i); + }, }), u + ); }, - def: function(e, t, i) { - var n = r(o(t), true); - return true === n ? m(e).set(t, i) : n[e._i] = i, - e + def: function (e, t, i) { + var n = r(o(t), true); + return true === n ? m(e).set(t, i) : (n[e._i] = i), e; }, - ufstore: m - } -} -, function(e, t, i) { - var n = i(28) - , r = i(10); - e.exports = function(e) { - if (void 0 === e) - return 0; - var t = n(e) - , i = r(t); - if (t !== i) - throw RangeError("Wrong length!"); - return i - } -} -, function(e, t, i) { - var n = i(51) - , r = i(75) - , o = i(4) - , a = i(5).Reflect; - e.exports = a && a.ownKeys || function(e) { - var t = n.f(o(e)) - , i = r.f; - return i ? t.concat(i(e)) : t - } -} -, function(e, t, i) { - var n = i(10) - , r = i(105) - , o = i(37); - e.exports = function(e, t, i, a) { - var s = String(o(e)) - , c = s.length - , u = void 0 === i ? " " : String(i) - , l = n(t); - if (l <= c || "" == u) - return s; - var h = l - c - , f = r.call(u, Math.ceil(h / u.length)); - return f.length > h && (f = f.slice(0, h)), - a ? f + s : s + f - } -} -, function(e, t, i) { - var n = i(48) - , r = i(24) - , o = i(65).f; - e.exports = function(e) { - return function(t) { - for (var i, a = r(t), s = n(a), c = s.length, u = 0, l = []; c > u; ) - o.call(a, i = s[u++]) && l.push(e ? [i, a[i]] : a[i]); - return l - } - } -} -, function(e, t) { + ufstore: m, + }); + }, + function (e, t, i) { + var n = i(28), + r = i(10); + e.exports = function (e) { + if (void 0 === e) return 0; + var t = n(e), + i = r(t); + if (t !== i) throw RangeError("Wrong length!"); + return i; + }; + }, + function (e, t, i) { + var n = i(51), + r = i(75), + o = i(4), + a = i(5).Reflect; + e.exports = + (a && a.ownKeys) || + function (e) { + var t = n.f(o(e)), + i = r.f; + return i ? t.concat(i(e)) : t; + }; + }, + function (e, t, i) { + var n = i(10), + r = i(105), + o = i(37); + e.exports = function (e, t, i, a) { + var s = String(o(e)), + c = s.length, + u = void 0 === i ? " " : String(i), + l = n(t); + if (l <= c || "" == u) return s; + var h = l - c, + f = r.call(u, Math.ceil(h / u.length)); + return f.length > h && (f = f.slice(0, h)), a ? f + s : s + f; + }; + }, + function (e, t, i) { + var n = i(48), + r = i(24), + o = i(65).f; + e.exports = function (e) { + return function (t) { + for (var i, a = r(t), s = n(a), c = s.length, u = 0, l = []; c > u; ) + o.call(a, (i = s[u++])) && l.push(e ? [i, a[i]] : a[i]); + return l; + }; + }; + }, + function (e, t) { var i = {}.toString; - e.exports = Array.isArray || function(e) { - return "[object Array]" == i.call(e) - } -} -, function(e, t, i) { + e.exports = + Array.isArray || + function (e) { + return "[object Array]" == i.call(e); + }; + }, + function (e, t, i) { "use strict"; - (function(t, n) { - var r = i(86); - e.exports = y; - var o, a = i(168); - y.ReadableState = v; - i(42).EventEmitter; - var s = function(e, t) { - return e.listeners(t).length - } - , c = i(170) - , u = i(2).Buffer - , l = t.Uint8Array || function() {} - ; - var h = i(68); - h.inherits = i(1); - var f = i(404) - , d = void 0; - d = f && f.debuglog ? f.debuglog("stream") : function() {} - ; - var p, m = i(405), g = i(171); - h.inherits(y, c); - var _ = ["error", "close", "destroy", "pause", "resume"]; - function v(e, t) { - e = e || {}; - var n = t instanceof (o = o || i(54)); - this.objectMode = !!e.objectMode, - n && (this.objectMode = this.objectMode || !!e.readableObjectMode); - var r = e.highWaterMark - , a = e.readableHighWaterMark - , s = this.objectMode ? 16 : 16384; - this.highWaterMark = r || 0 === r ? r : n && (a || 0 === a) ? a : s, - this.highWaterMark = Math.floor(this.highWaterMark), - this.buffer = new m, - this.length = 0, - this.pipes = null, - this.pipesCount = 0, - this.flowing = null, - this.ended = false, - this.endEmitted = false, - this.reading = false, - this.sync = true, - this.needReadable = false, - this.emittedReadable = false, - this.readableListening = false, - this.resumeScheduled = false, - this.destroyed = false, - this.defaultEncoding = e.defaultEncoding || "utf8", - this.awaitDrain = 0, - this.readingMore = false, - this.decoder = null, - this.encoding = null, - e.encoding && (p || (p = i(124).StringDecoder), - this.decoder = new p(e.encoding), - this.encoding = e.encoding) - } - function y(e) { - if (o = o || i(54), - !(this instanceof y)) - return new y(e); - this._readableState = new v(e,this), - this.readable = true, - e && ("function" == typeof e.read && (this._read = e.read), + (function (t, n) { + var r = i(86); + e.exports = y; + var o, + a = i(168); + y.ReadableState = v; + i(42).EventEmitter; + var s = function (e, t) { + return e.listeners(t).length; + }, + c = i(170), + u = i(2).Buffer, + l = t.Uint8Array || function () {}; + var h = i(68); + h.inherits = i(1); + var f = i(404), + d = void 0; + d = f && f.debuglog ? f.debuglog("stream") : function () {}; + var p, + m = i(405), + g = i(171); + h.inherits(y, c); + var _ = ["error", "close", "destroy", "pause", "resume"]; + function v(e, t) { + e = e || {}; + var n = t instanceof (o = o || i(54)); + (this.objectMode = !!e.objectMode), + n && (this.objectMode = this.objectMode || !!e.readableObjectMode); + var r = e.highWaterMark, + a = e.readableHighWaterMark, + s = this.objectMode ? 16 : 16384; + (this.highWaterMark = r || 0 === r ? r : n && (a || 0 === a) ? a : s), + (this.highWaterMark = Math.floor(this.highWaterMark)), + (this.buffer = new m()), + (this.length = 0), + (this.pipes = null), + (this.pipesCount = 0), + (this.flowing = null), + (this.ended = false), + (this.endEmitted = false), + (this.reading = false), + (this.sync = true), + (this.needReadable = false), + (this.emittedReadable = false), + (this.readableListening = false), + (this.resumeScheduled = false), + (this.destroyed = false), + (this.defaultEncoding = e.defaultEncoding || "utf8"), + (this.awaitDrain = 0), + (this.readingMore = false), + (this.decoder = null), + (this.encoding = null), + e.encoding && + (p || (p = i(124).StringDecoder), + (this.decoder = new p(e.encoding)), + (this.encoding = e.encoding)); + } + function y(e) { + if (((o = o || i(54)), !(this instanceof y))) return new y(e); + (this._readableState = new v(e, this)), + (this.readable = true), + e && + ("function" == typeof e.read && (this._read = e.read), "function" == typeof e.destroy && (this._destroy = e.destroy)), - c.call(this) - } - function b(e, t, i, n, r) { - var o, a = e._readableState; - null === t ? (a.reading = false, - function(e, t) { - if (t.ended) - return; - if (t.decoder) { - var i = t.decoder.end(); - i && i.length && (t.buffer.push(i), - t.length += t.objectMode ? 1 : i.length) - } - t.ended = true, - x(e) - }(e, a)) : (r || (o = function(e, t) { + c.call(this); + } + function b(e, t, i, n, r) { + var o, + a = e._readableState; + null === t + ? ((a.reading = false), + (function (e, t) { + if (t.ended) return; + if (t.decoder) { + var i = t.decoder.end(); + i && + i.length && + (t.buffer.push(i), (t.length += t.objectMode ? 1 : i.length)); + } + (t.ended = true), x(e); + })(e, a)) + : (r || + (o = (function (e, t) { var i; - n = t, - u.isBuffer(n) || n instanceof l || "string" == typeof t || void 0 === t || e.objectMode || (i = new TypeError("Invalid non-string/buffer chunk")); + (n = t), + u.isBuffer(n) || + n instanceof l || + "string" == typeof t || + void 0 === t || + e.objectMode || + (i = new TypeError("Invalid non-string/buffer chunk")); var n; - return i - }(a, t)), - o ? e.emit("error", o) : a.objectMode || t && t.length > 0 ? ("string" == typeof t || a.objectMode || Object.getPrototypeOf(t) === u.prototype || (t = function(e) { - return u.from(e) - }(t)), - n ? a.endEmitted ? e.emit("error", new Error("stream.unshift() after end event")) : E(e, a, t, true) : a.ended ? e.emit("error", new Error("stream.push() after EOF")) : (a.reading = false, - a.decoder && !i ? (t = a.decoder.write(t), - a.objectMode || 0 !== t.length ? E(e, a, t, false) : C(e, a)) : E(e, a, t, false))) : n || (a.reading = false)); - return function(e) { - return !e.ended && (e.needReadable || e.length < e.highWaterMark || 0 === e.length) - }(a) - } - function E(e, t, i, n) { - t.flowing && 0 === t.length && !t.sync ? (e.emit("data", i), - e.read(0)) : (t.length += t.objectMode ? 1 : i.length, + return i; + })(a, t)), + o + ? e.emit("error", o) + : a.objectMode || (t && t.length > 0) + ? ("string" == typeof t || + a.objectMode || + Object.getPrototypeOf(t) === u.prototype || + (t = (function (e) { + return u.from(e); + })(t)), + n + ? a.endEmitted + ? e.emit( + "error", + new Error("stream.unshift() after end event") + ) + : E(e, a, t, true) + : a.ended + ? e.emit("error", new Error("stream.push() after EOF")) + : ((a.reading = false), + a.decoder && !i + ? ((t = a.decoder.write(t)), + a.objectMode || 0 !== t.length + ? E(e, a, t, false) + : C(e, a)) + : E(e, a, t, false))) + : n || (a.reading = false)); + return (function (e) { + return ( + !e.ended && + (e.needReadable || e.length < e.highWaterMark || 0 === e.length) + ); + })(a); + } + function E(e, t, i, n) { + t.flowing && 0 === t.length && !t.sync + ? (e.emit("data", i), e.read(0)) + : ((t.length += t.objectMode ? 1 : i.length), n ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && x(e)), - C(e, t) - } - Object.defineProperty(y.prototype, "destroyed", { - get: function() { - return void 0 !== this._readableState && this._readableState.destroyed - }, - set: function(e) { - this._readableState && (this._readableState.destroyed = e) - } + C(e, t); + } + Object.defineProperty(y.prototype, "destroyed", { + get: function () { + return ( + void 0 !== this._readableState && this._readableState.destroyed + ); + }, + set: function (e) { + this._readableState && (this._readableState.destroyed = e); + }, + }), + (y.prototype.destroy = g.destroy), + (y.prototype._undestroy = g.undestroy), + (y.prototype._destroy = function (e, t) { + this.push(null), t(e); }), - y.prototype.destroy = g.destroy, - y.prototype._undestroy = g.undestroy, - y.prototype._destroy = function(e, t) { - this.push(null), - t(e) - } - , - y.prototype.push = function(e, t) { - var i, n = this._readableState; - return n.objectMode ? i = true : "string" == typeof e && ((t = t || n.defaultEncoding) !== n.encoding && (e = u.from(e, t), - t = ""), - i = true), + (y.prototype.push = function (e, t) { + var i, + n = this._readableState; + return ( + n.objectMode + ? (i = true) + : "string" == typeof e && + ((t = t || n.defaultEncoding) !== n.encoding && + ((e = u.from(e, t)), (t = "")), + (i = true)), b(this, e, t, false, i) - } - , - y.prototype.unshift = function(e) { - return b(this, e, null, true, false) - } - , - y.prototype.isPaused = function() { - return false === this._readableState.flowing - } - , - y.prototype.setEncoding = function(e) { - return p || (p = i(124).StringDecoder), - this._readableState.decoder = new p(e), - this._readableState.encoding = e, + ); + }), + (y.prototype.unshift = function (e) { + return b(this, e, null, true, false); + }), + (y.prototype.isPaused = function () { + return false === this._readableState.flowing; + }), + (y.prototype.setEncoding = function (e) { + return ( + p || (p = i(124).StringDecoder), + (this._readableState.decoder = new p(e)), + (this._readableState.encoding = e), this - } - ; - var T = 8388608; - function A(e, t) { - return e <= 0 || 0 === t.length && t.ended ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t.buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = function(e) { - return e >= T ? e = T : (e--, - e |= e >>> 1, - e |= e >>> 2, - e |= e >>> 4, - e |= e >>> 8, - e |= e >>> 16, - e++), - e - }(e)), - e <= t.length ? e : t.ended ? t.length : (t.needReadable = true, - 0)) - } - function x(e) { - var t = e._readableState; - t.needReadable = false, - t.emittedReadable || (d("emitReadable", t.flowing), - t.emittedReadable = true, - t.sync ? r.nextTick(S, e) : S(e)) - } - function S(e) { - d("emit readable"), - e.emit("readable"), - O(e) - } - function C(e, t) { - t.readingMore || (t.readingMore = true, - r.nextTick(P, e, t)) - } - function P(e, t) { - for (var i = t.length; !t.reading && !t.flowing && !t.ended && t.length < t.highWaterMark && (d("maybeReadMore read 0"), - e.read(0), - i !== t.length); ) - i = t.length; - t.readingMore = false - } - function R(e) { - d("readable nexttick read 0"), - e.read(0) - } - function M(e, t) { - t.reading || (d("resume read 0"), - e.read(0)), - t.resumeScheduled = false, - t.awaitDrain = 0, - e.emit("resume"), - O(e), - t.flowing && !t.reading && e.read(0) - } - function O(e) { - var t = e._readableState; - for (d("flow", t.flowing); t.flowing && null !== e.read(); ) - ; - } - function w(e, t) { - return 0 === t.length ? null : (t.objectMode ? i = t.buffer.shift() : !e || e >= t.length ? (i = t.decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.head.data : t.buffer.concat(t.length), - t.buffer.clear()) : i = function(e, t, i) { - var n; - e < t.head.data.length ? (n = t.head.data.slice(0, e), - t.head.data = t.head.data.slice(e)) : n = e === t.head.data.length ? t.shift() : i ? function(e, t) { - var i = t.head - , n = 1 - , r = i.data; - e -= r.length; - for (; i = i.next; ) { - var o = i.data - , a = e > o.length ? o.length : e; - if (a === o.length ? r += o : r += o.slice(0, e), - 0 === (e -= a)) { - a === o.length ? (++n, - i.next ? t.head = i.next : t.head = t.tail = null) : (t.head = i, - i.data = o.slice(a)); - break - } - ++n - } - return t.length -= n, - r - }(e, t) : function(e, t) { - var i = u.allocUnsafe(e) - , n = t.head - , r = 1; - n.data.copy(i), - e -= n.data.length; - for (; n = n.next; ) { - var o = n.data - , a = e > o.length ? o.length : e; - if (o.copy(i, i.length - e, 0, a), - 0 === (e -= a)) { - a === o.length ? (++r, - n.next ? t.head = n.next : t.head = t.tail = null) : (t.head = n, - n.data = o.slice(a)); - break - } - ++r - } - return t.length -= r, - i - }(e, t); - return n - }(e, t.buffer, t.decoder), + ); + }); + var T = 8388608; + function A(e, t) { + return e <= 0 || (0 === t.length && t.ended) + ? 0 + : t.objectMode + ? 1 + : e != e + ? t.flowing && t.length + ? t.buffer.head.data.length + : t.length + : (e > t.highWaterMark && + (t.highWaterMark = (function (e) { + return ( + e >= T + ? (e = T) + : (e--, + (e |= e >>> 1), + (e |= e >>> 2), + (e |= e >>> 4), + (e |= e >>> 8), + (e |= e >>> 16), + e++), + e + ); + })(e)), + e <= t.length + ? e + : t.ended + ? t.length + : ((t.needReadable = true), 0)); + } + function x(e) { + var t = e._readableState; + (t.needReadable = false), + t.emittedReadable || + (d("emitReadable", t.flowing), + (t.emittedReadable = true), + t.sync ? r.nextTick(S, e) : S(e)); + } + function S(e) { + d("emit readable"), e.emit("readable"), O(e); + } + function C(e, t) { + t.readingMore || ((t.readingMore = true), r.nextTick(P, e, t)); + } + function P(e, t) { + for ( + var i = t.length; + !t.reading && + !t.flowing && + !t.ended && + t.length < t.highWaterMark && + (d("maybeReadMore read 0"), e.read(0), i !== t.length); + + ) + i = t.length; + t.readingMore = false; + } + function R(e) { + d("readable nexttick read 0"), e.read(0); + } + function M(e, t) { + t.reading || (d("resume read 0"), e.read(0)), + (t.resumeScheduled = false), + (t.awaitDrain = 0), + e.emit("resume"), + O(e), + t.flowing && !t.reading && e.read(0); + } + function O(e) { + var t = e._readableState; + for (d("flow", t.flowing); t.flowing && null !== e.read(); ); + } + function w(e, t) { + return 0 === t.length + ? null + : (t.objectMode + ? (i = t.buffer.shift()) + : !e || e >= t.length + ? ((i = t.decoder + ? t.buffer.join("") + : 1 === t.buffer.length + ? t.buffer.head.data + : t.buffer.concat(t.length)), + t.buffer.clear()) + : (i = (function (e, t, i) { + var n; + e < t.head.data.length + ? ((n = t.head.data.slice(0, e)), + (t.head.data = t.head.data.slice(e))) + : (n = + e === t.head.data.length + ? t.shift() + : i + ? (function (e, t) { + var i = t.head, + n = 1, + r = i.data; + e -= r.length; + for (; (i = i.next); ) { + var o = i.data, + a = e > o.length ? o.length : e; + if ( + (a === o.length + ? (r += o) + : (r += o.slice(0, e)), + 0 === (e -= a)) + ) { + a === o.length + ? (++n, + i.next + ? (t.head = i.next) + : (t.head = t.tail = null)) + : ((t.head = i), (i.data = o.slice(a))); + break; + } + ++n; + } + return (t.length -= n), r; + })(e, t) + : (function (e, t) { + var i = u.allocUnsafe(e), + n = t.head, + r = 1; + n.data.copy(i), (e -= n.data.length); + for (; (n = n.next); ) { + var o = n.data, + a = e > o.length ? o.length : e; + if ( + (o.copy(i, i.length - e, 0, a), + 0 === (e -= a)) + ) { + a === o.length + ? (++r, + n.next + ? (t.head = n.next) + : (t.head = t.tail = null)) + : ((t.head = n), (n.data = o.slice(a))); + break; + } + ++r; + } + return (t.length -= r), i; + })(e, t)); + return n; + })(e, t.buffer, t.decoder)), i); - var i - } - function I(e) { - var t = e._readableState; - if (t.length > 0) - throw new Error('"endReadable()" called on non-empty stream'); - t.endEmitted || (t.ended = true, - r.nextTick(D, t, e)) - } - function D(e, t) { - e.endEmitted || 0 !== e.length || (e.endEmitted = true, - t.readable = false, - t.emit("end")) - } - function L(e, t) { - for (var i = 0, n = e.length; i < n; i++) - if (e[i] === t) - return i; - return -1 - } - y.prototype.read = function(e) { - d("read", e), - e = parseInt(e, 10); - var t = this._readableState - , i = e; - if (0 !== e && (t.emittedReadable = false), - 0 === e && t.needReadable && (t.length >= t.highWaterMark || t.ended)) - return d("read: emitReadable", t.length, t.ended), - 0 === t.length && t.ended ? I(this) : x(this), - null; - if (0 === (e = A(e, t)) && t.ended) - return 0 === t.length && I(this), - null; - var n, r = t.needReadable; - return d("need readable", r), - (0 === t.length || t.length - e < t.highWaterMark) && d("length less than watermark", r = true), - t.ended || t.reading ? d("reading or ended", r = false) : r && (d("do read"), - t.reading = true, - t.sync = true, - 0 === t.length && (t.needReadable = true), - this._read(t.highWaterMark), - t.sync = false, - t.reading || (e = A(i, t))), - null === (n = e > 0 ? w(e, t) : null) ? (t.needReadable = true, - e = 0) : t.length -= e, - 0 === t.length && (t.ended || (t.needReadable = true), - i !== e && t.ended && I(this)), - null !== n && this.emit("data", n), - n - } - , - y.prototype._read = function(e) { - this.emit("error", new Error("_read() is not implemented")) - } - , - y.prototype.pipe = function(e, t) { - var i = this - , o = this._readableState; - switch (o.pipesCount) { + var i; + } + function I(e) { + var t = e._readableState; + if (t.length > 0) + throw new Error('"endReadable()" called on non-empty stream'); + t.endEmitted || ((t.ended = true), r.nextTick(D, t, e)); + } + function D(e, t) { + e.endEmitted || + 0 !== e.length || + ((e.endEmitted = true), (t.readable = false), t.emit("end")); + } + function L(e, t) { + for (var i = 0, n = e.length; i < n; i++) if (e[i] === t) return i; + return -1; + } + (y.prototype.read = function (e) { + d("read", e), (e = parseInt(e, 10)); + var t = this._readableState, + i = e; + if ( + (0 !== e && (t.emittedReadable = false), + 0 === e && t.needReadable && (t.length >= t.highWaterMark || t.ended)) + ) + return ( + d("read: emitReadable", t.length, t.ended), + 0 === t.length && t.ended ? I(this) : x(this), + null + ); + if (0 === (e = A(e, t)) && t.ended) + return 0 === t.length && I(this), null; + var n, + r = t.needReadable; + return ( + d("need readable", r), + (0 === t.length || t.length - e < t.highWaterMark) && + d("length less than watermark", (r = true)), + t.ended || t.reading + ? d("reading or ended", (r = false)) + : r && + (d("do read"), + (t.reading = true), + (t.sync = true), + 0 === t.length && (t.needReadable = true), + this._read(t.highWaterMark), + (t.sync = false), + t.reading || (e = A(i, t))), + null === (n = e > 0 ? w(e, t) : null) + ? ((t.needReadable = true), (e = 0)) + : (t.length -= e), + 0 === t.length && + (t.ended || (t.needReadable = true), i !== e && t.ended && I(this)), + null !== n && this.emit("data", n), + n + ); + }), + (y.prototype._read = function (e) { + this.emit("error", new Error("_read() is not implemented")); + }), + (y.prototype.pipe = function (e, t) { + var i = this, + o = this._readableState; + switch (o.pipesCount) { case 0: - o.pipes = e; - break; + o.pipes = e; + break; case 1: - o.pipes = [o.pipes, e]; - break; + o.pipes = [o.pipes, e]; + break; default: - o.pipes.push(e) - } - o.pipesCount += 1, - d("pipe count=%d opts=%j", o.pipesCount, t); - var c = (!t || false !== t.end) && e !== n.stdout && e !== n.stderr ? l : y; - function u(t, n) { - d("onunpipe"), - t === i && n && false === n.hasUnpiped && (n.hasUnpiped = true, + o.pipes.push(e); + } + (o.pipesCount += 1), d("pipe count=%d opts=%j", o.pipesCount, t); + var c = + (!t || false !== t.end) && e !== n.stdout && e !== n.stderr ? l : y; + function u(t, n) { + d("onunpipe"), + t === i && + n && + false === n.hasUnpiped && + ((n.hasUnpiped = true), d("cleanup"), e.removeListener("close", _), e.removeListener("finish", v), @@ -12497,930 +15077,1053 @@ i.removeListener("end", l), i.removeListener("end", y), i.removeListener("data", m), - f = true, - !o.awaitDrain || e._writableState && !e._writableState.needDrain || h()) - } - function l() { - d("onend"), - e.end() - } - o.endEmitted ? r.nextTick(c) : i.once("end", c), - e.on("unpipe", u); - var h = function(e) { - return function() { - var t = e._readableState; - d("pipeOnDrain", t.awaitDrain), - t.awaitDrain && t.awaitDrain--, - 0 === t.awaitDrain && s(e, "data") && (t.flowing = true, - O(e)) - } - }(i); - e.on("drain", h); - var f = false; - var p = false; - function m(t) { - d("ondata"), - p = false, - false !== e.write(t) || p || ((1 === o.pipesCount && o.pipes === e || o.pipesCount > 1 && -1 !== L(o.pipes, e)) && !f && (d("false write response, pause", i._readableState.awaitDrain), - i._readableState.awaitDrain++, - p = true), - i.pause()) - } - function g(t) { - d("onerror", t), - y(), - e.removeListener("error", g), - 0 === s(e, "error") && e.emit("error", t) - } - function _() { - e.removeListener("finish", v), - y() - } - function v() { - d("onfinish"), - e.removeListener("close", _), - y() - } - function y() { - d("unpipe"), - i.unpipe(e) - } - return i.on("data", m), - function(e, t, i) { - if ("function" == typeof e.prependListener) - return e.prependListener(t, i); - e._events && e._events[t] ? a(e._events[t]) ? e._events[t].unshift(i) : e._events[t] = [i, e._events[t]] : e.on(t, i) - }(e, "error", g), + (f = true), + !o.awaitDrain || + (e._writableState && !e._writableState.needDrain) || + h()); + } + function l() { + d("onend"), e.end(); + } + o.endEmitted ? r.nextTick(c) : i.once("end", c), e.on("unpipe", u); + var h = (function (e) { + return function () { + var t = e._readableState; + d("pipeOnDrain", t.awaitDrain), + t.awaitDrain && t.awaitDrain--, + 0 === t.awaitDrain && + s(e, "data") && + ((t.flowing = true), O(e)); + }; + })(i); + e.on("drain", h); + var f = false; + var p = false; + function m(t) { + d("ondata"), + (p = false), + false !== e.write(t) || + p || + (((1 === o.pipesCount && o.pipes === e) || + (o.pipesCount > 1 && -1 !== L(o.pipes, e))) && + !f && + (d( + "false write response, pause", + i._readableState.awaitDrain + ), + i._readableState.awaitDrain++, + (p = true)), + i.pause()); + } + function g(t) { + d("onerror", t), + y(), + e.removeListener("error", g), + 0 === s(e, "error") && e.emit("error", t); + } + function _() { + e.removeListener("finish", v), y(); + } + function v() { + d("onfinish"), e.removeListener("close", _), y(); + } + function y() { + d("unpipe"), i.unpipe(e); + } + return ( + i.on("data", m), + (function (e, t, i) { + if ("function" == typeof e.prependListener) + return e.prependListener(t, i); + e._events && e._events[t] + ? a(e._events[t]) + ? e._events[t].unshift(i) + : (e._events[t] = [i, e._events[t]]) + : e.on(t, i); + })(e, "error", g), e.once("close", _), e.once("finish", v), e.emit("pipe", i), - o.flowing || (d("pipe resume"), - i.resume()), + o.flowing || (d("pipe resume"), i.resume()), e - } - , - y.prototype.unpipe = function(e) { - var t = this._readableState - , i = { - hasUnpiped: false + ); + }), + (y.prototype.unpipe = function (e) { + var t = this._readableState, + i = { + hasUnpiped: false, }; - if (0 === t.pipesCount) - return this; - if (1 === t.pipesCount) - return e && e !== t.pipes ? this : (e || (e = t.pipes), - t.pipes = null, - t.pipesCount = 0, - t.flowing = false, + if (0 === t.pipesCount) return this; + if (1 === t.pipesCount) + return e && e !== t.pipes + ? this + : (e || (e = t.pipes), + (t.pipes = null), + (t.pipesCount = 0), + (t.flowing = false), e && e.emit("unpipe", this, i), this); - if (!e) { - var n = t.pipes - , r = t.pipesCount; - t.pipes = null, - t.pipesCount = 0, - t.flowing = false; - for (var o = 0; o < r; o++) - n[o].emit("unpipe", this, i); - return this - } - var a = L(t.pipes, e); - return -1 === a ? this : (t.pipes.splice(a, 1), - t.pipesCount -= 1, - 1 === t.pipesCount && (t.pipes = t.pipes[0]), - e.emit("unpipe", this, i), - this) - } - , - y.prototype.on = function(e, t) { - var i = c.prototype.on.call(this, e, t); - if ("data" === e) - false !== this._readableState.flowing && this.resume(); - else if ("readable" === e) { - var n = this._readableState; - n.endEmitted || n.readableListening || (n.readableListening = n.needReadable = true, - n.emittedReadable = false, - n.reading ? n.length && x(this) : r.nextTick(R, this)) - } - return i - } - , - y.prototype.addListener = y.prototype.on, - y.prototype.resume = function() { - var e = this._readableState; - return e.flowing || (d("resume"), - e.flowing = true, - function(e, t) { - t.resumeScheduled || (t.resumeScheduled = true, - r.nextTick(M, e, t)) - }(this, e)), - this - } - , - y.prototype.pause = function() { - return d("call pause flowing=%j", this._readableState.flowing), - false !== this._readableState.flowing && (d("pause"), - this._readableState.flowing = false, - this.emit("pause")), - this - } - , - y.prototype.wrap = function(e) { - var t = this - , i = this._readableState - , n = false; - for (var r in e.on("end", function() { - if (d("wrapped end"), - i.decoder && !i.ended) { - var e = i.decoder.end(); - e && e.length && t.push(e) - } - t.push(null) - }), - e.on("data", function(r) { - (d("wrapped data"), - i.decoder && (r = i.decoder.write(r)), - i.objectMode && null == r) || (i.objectMode || r && r.length) && (t.push(r) || (n = true, - e.pause())) - }), - e) - void 0 === this[r] && "function" == typeof e[r] && (this[r] = function(t) { - return function() { - return e[t].apply(e, arguments) - } - }(r)); - for (var o = 0; o < _.length; o++) - e.on(_[o], this.emit.bind(this, _[o])); - return this._read = function(t) { - d("wrapped _read", t), - n && (n = false, - e.resume()) - } - , - this - } - , - Object.defineProperty(y.prototype, "readableHighWaterMark", { - enumerable: false, - get: function() { - return this._readableState.highWaterMark - } + if (!e) { + var n = t.pipes, + r = t.pipesCount; + (t.pipes = null), (t.pipesCount = 0), (t.flowing = false); + for (var o = 0; o < r; o++) n[o].emit("unpipe", this, i); + return this; + } + var a = L(t.pipes, e); + return -1 === a + ? this + : (t.pipes.splice(a, 1), + (t.pipesCount -= 1), + 1 === t.pipesCount && (t.pipes = t.pipes[0]), + e.emit("unpipe", this, i), + this); }), - y._fromList = w - } - ).call(this, i(15), i(27)) -} -, function(e, t, i) { - e.exports = i(42).EventEmitter -} -, function(e, t, i) { + (y.prototype.on = function (e, t) { + var i = c.prototype.on.call(this, e, t); + if ("data" === e) + false !== this._readableState.flowing && this.resume(); + else if ("readable" === e) { + var n = this._readableState; + n.endEmitted || + n.readableListening || + ((n.readableListening = n.needReadable = true), + (n.emittedReadable = false), + n.reading ? n.length && x(this) : r.nextTick(R, this)); + } + return i; + }), + (y.prototype.addListener = y.prototype.on), + (y.prototype.resume = function () { + var e = this._readableState; + return ( + e.flowing || + (d("resume"), + (e.flowing = true), + (function (e, t) { + t.resumeScheduled || + ((t.resumeScheduled = true), r.nextTick(M, e, t)); + })(this, e)), + this + ); + }), + (y.prototype.pause = function () { + return ( + d("call pause flowing=%j", this._readableState.flowing), + false !== this._readableState.flowing && + (d("pause"), + (this._readableState.flowing = false), + this.emit("pause")), + this + ); + }), + (y.prototype.wrap = function (e) { + var t = this, + i = this._readableState, + n = false; + for (var r in (e.on("end", function () { + if ((d("wrapped end"), i.decoder && !i.ended)) { + var e = i.decoder.end(); + e && e.length && t.push(e); + } + t.push(null); + }), + e.on("data", function (r) { + (d("wrapped data"), + i.decoder && (r = i.decoder.write(r)), + i.objectMode && null == r) || + ((i.objectMode || (r && r.length)) && + (t.push(r) || ((n = true), e.pause()))); + }), + e)) + void 0 === this[r] && + "function" == typeof e[r] && + (this[r] = (function (t) { + return function () { + return e[t].apply(e, arguments); + }; + })(r)); + for (var o = 0; o < _.length; o++) + e.on(_[o], this.emit.bind(this, _[o])); + return ( + (this._read = function (t) { + d("wrapped _read", t), n && ((n = false), e.resume()); + }), + this + ); + }), + Object.defineProperty(y.prototype, "readableHighWaterMark", { + enumerable: false, + get: function () { + return this._readableState.highWaterMark; + }, + }), + (y._fromList = w); + }.call(this, i(15), i(27))); + }, + function (e, t, i) { + e.exports = i(42).EventEmitter; + }, + function (e, t, i) { "use strict"; var n = i(86); function r(e, t) { - e.emit("error", t) + e.emit("error", t); } e.exports = { - destroy: function(e, t) { - var i = this - , o = this._readableState && this._readableState.destroyed - , a = this._writableState && this._writableState.destroyed; - return o || a ? (t ? t(e) : !e || this._writableState && this._writableState.errorEmitted || n.nextTick(r, this, e), - this) : (this._readableState && (this._readableState.destroyed = true), - this._writableState && (this._writableState.destroyed = true), - this._destroy(e || null, function(e) { - !t && e ? (n.nextTick(r, i, e), - i._writableState && (i._writableState.errorEmitted = true)) : t && t(e) - }), + destroy: function (e, t) { + var i = this, + o = this._readableState && this._readableState.destroyed, + a = this._writableState && this._writableState.destroyed; + return o || a + ? (t + ? t(e) + : !e || + (this._writableState && this._writableState.errorEmitted) || + n.nextTick(r, this, e), this) - }, - undestroy: function() { - this._readableState && (this._readableState.destroyed = false, - this._readableState.reading = false, - this._readableState.ended = false, - this._readableState.endEmitted = false), - this._writableState && (this._writableState.destroyed = false, - this._writableState.ended = false, - this._writableState.ending = false, - this._writableState.finished = false, - this._writableState.errorEmitted = false) - } - } -} -, function(e, t, i) { + : (this._readableState && (this._readableState.destroyed = true), + this._writableState && (this._writableState.destroyed = true), + this._destroy(e || null, function (e) { + !t && e + ? (n.nextTick(r, i, e), + i._writableState && (i._writableState.errorEmitted = true)) + : t && t(e); + }), + this); + }, + undestroy: function () { + this._readableState && + ((this._readableState.destroyed = false), + (this._readableState.reading = false), + (this._readableState.ended = false), + (this._readableState.endEmitted = false)), + this._writableState && + ((this._writableState.destroyed = false), + (this._writableState.ended = false), + (this._writableState.ending = false), + (this._writableState.finished = false), + (this._writableState.errorEmitted = false)); + }, + }; + }, + function (e, t, i) { "use strict"; e.exports = a; - var n = i(54) - , r = i(68); + var n = i(54), + r = i(68); function o(e, t) { - var i = this._transformState; - i.transforming = false; - var n = i.writecb; - if (!n) - return this.emit("error", new Error("write callback called multiple times")); - i.writechunk = null, - i.writecb = null, + var i = this._transformState; + i.transforming = false; + var n = i.writecb; + if (!n) + return this.emit( + "error", + new Error("write callback called multiple times") + ); + (i.writechunk = null), + (i.writecb = null), null != t && this.push(t), n(e); - var r = this._readableState; - r.reading = false, - (r.needReadable || r.length < r.highWaterMark) && this._read(r.highWaterMark) + var r = this._readableState; + (r.reading = false), + (r.needReadable || r.length < r.highWaterMark) && + this._read(r.highWaterMark); } function a(e) { - if (!(this instanceof a)) - return new a(e); - n.call(this, e), - this._transformState = { - afterTransform: o.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }, - this._readableState.needReadable = true, - this._readableState.sync = false, - e && ("function" == typeof e.transform && (this._transform = e.transform), - "function" == typeof e.flush && (this._flush = e.flush)), - this.on("prefinish", s) + if (!(this instanceof a)) return new a(e); + n.call(this, e), + (this._transformState = { + afterTransform: o.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null, + }), + (this._readableState.needReadable = true), + (this._readableState.sync = false), + e && + ("function" == typeof e.transform && (this._transform = e.transform), + "function" == typeof e.flush && (this._flush = e.flush)), + this.on("prefinish", s); } function s() { - var e = this; - "function" == typeof this._flush ? this._flush(function(t, i) { - c(e, t, i) - }) : c(this, null, null) + var e = this; + "function" == typeof this._flush + ? this._flush(function (t, i) { + c(e, t, i); + }) + : c(this, null, null); } function c(e, t, i) { - if (t) - return e.emit("error", t); - if (null != i && e.push(i), - e._writableState.length) - throw new Error("Calling transform done when ws.length != 0"); - if (e._transformState.transforming) - throw new Error("Calling transform done when still transforming"); - return e.push(null) + if (t) return e.emit("error", t); + if ((null != i && e.push(i), e._writableState.length)) + throw new Error("Calling transform done when ws.length != 0"); + if (e._transformState.transforming) + throw new Error("Calling transform done when still transforming"); + return e.push(null); } - r.inherits = i(1), - r.inherits(a, n), - a.prototype.push = function(e, t) { - return this._transformState.needTransform = false, - n.prototype.push.call(this, e, t) - } - , - a.prototype._transform = function(e, t, i) { - throw new Error("_transform() is not implemented") - } - , - a.prototype._write = function(e, t, i) { + (r.inherits = i(1)), + r.inherits(a, n), + (a.prototype.push = function (e, t) { + return ( + (this._transformState.needTransform = false), + n.prototype.push.call(this, e, t) + ); + }), + (a.prototype._transform = function (e, t, i) { + throw new Error("_transform() is not implemented"); + }), + (a.prototype._write = function (e, t, i) { var n = this._transformState; - if (n.writecb = i, - n.writechunk = e, - n.writeencoding = t, - !n.transforming) { - var r = this._readableState; - (n.needTransform || r.needReadable || r.length < r.highWaterMark) && this._read(r.highWaterMark) + if ( + ((n.writecb = i), + (n.writechunk = e), + (n.writeencoding = t), + !n.transforming) + ) { + var r = this._readableState; + (n.needTransform || r.needReadable || r.length < r.highWaterMark) && + this._read(r.highWaterMark); } - } - , - a.prototype._read = function(e) { + }), + (a.prototype._read = function (e) { var t = this._transformState; - null !== t.writechunk && t.writecb && !t.transforming ? (t.transforming = true, - this._transform(t.writechunk, t.writeencoding, t.afterTransform)) : t.needTransform = true - } - , - a.prototype._destroy = function(e, t) { + null !== t.writechunk && t.writecb && !t.transforming + ? ((t.transforming = true), + this._transform(t.writechunk, t.writeencoding, t.afterTransform)) + : (t.needTransform = true); + }), + (a.prototype._destroy = function (e, t) { var i = this; - n.prototype._destroy.call(this, e, function(e) { - t(e), - i.emit("close") - }) - } -} -, function(exp, t) { // EPSILON i = 173 - exp.exports = 1e-6 -} -, function(exp, t) { // createVec3 i = 174 - exp.exports = function() { - var vec3 = new Float32Array(3); - - vec3[0] = 0; - vec3[1] = 0; - vec3[2] = 0; + n.prototype._destroy.call(this, e, function (e) { + t(e), i.emit("close"); + }); + }); + }, + function (exp, t) { + // EPSILON i = 173 + exp.exports = 1e-6; + }, + function (exp, t) { + // createVec3 i = 174 + exp.exports = function () { + var vec3 = new Float32Array(3); - return vec3 - } -} -, function(exp, t) { // fromValuesVec3(x, y, z) i = 175 - exp.exports = function(x, y, z) { - var vec3 = new Float32Array(3); - - vec3[0] = x; - vec3[1] = y; - vec3[2] = z; + vec3[0] = 0; + vec3[1] = 0; + vec3[2] = 0; - return vec3 - } -} -, function(exp, t) { // TODO i = 176 - exp.exports = function(vec3_0, vec3_1) { - var x = vec3_1[0]; - var y = vec3_1[1]; - var z = vec3_1[2]; + return vec3; + }; + }, + function (exp, t) { + // fromValuesVec3(x, y, z) i = 175 + exp.exports = function (x, y, z) { + var vec3 = new Float32Array(3); - var sumOfSquares = x * x + y * y + z * z; - - if(sumOfSquares > 0) { - sumOfSquares = 1 / Math.sqrt(sumOfSquares); - vec3_0[0] = vec3_1[0] * sumOfSquares; - vec3_0[1] = vec3_1[1] * sumOfSquares; - vec3_0[2] = vec3_1[2] * sumOfSquares; - } + vec3[0] = x; + vec3[1] = y; + vec3[2] = z; - return vec3_0 - } -} -, function(exp, t) { // multSum(vec3, vec3) i = 177 - exp.exports = function(vec3_0, vec3_1) { - return vec3_0[0] * vec3_1[0] + vec3_0[1] * vec3_1[1] + vec3_0[2] * vec3_1[2] - } -} -, function(e, t) { - e.exports = function(e, t, i) { - return e[0] = t[0] - i[0], - e[1] = t[1] - i[1], - e[2] = t[2] - i[2], - e - } -} -, function(e, t) { - e.exports = function(e, t, i) { - return e[0] = t[0] * i[0], - e[1] = t[1] * i[1], - e[2] = t[2] * i[2], - e - } -} -, function(e, t) { - e.exports = function(e, t, i) { - return e[0] = t[0] / i[0], - e[1] = t[1] / i[1], - e[2] = t[2] / i[2], - e - } -} -, function(e, t) { - e.exports = function(e, t) { - var i = t[0] - e[0] - , n = t[1] - e[1] - , r = t[2] - e[2]; - return Math.sqrt(i * i + n * n + r * r) - } -} -, function(e, t) { - e.exports = function(e, t) { - var i = t[0] - e[0] - , n = t[1] - e[1] - , r = t[2] - e[2]; - return i * i + n * n + r * r - } -} -, function(e, t) { - e.exports = function(e) { - var t = e[0] - , i = e[1] - , n = e[2]; - return Math.sqrt(t * t + i * i + n * n) - } -} -, function(e, t) { - e.exports = function(e) { - var t = e[0] - , i = e[1] - , n = e[2]; - return t * t + i * i + n * n - } -} -, function(e, t, i) { + return vec3; + }; + }, + function (exp, t) { + // TODO i = 176 + exp.exports = function (vec3_0, vec3_1) { + var x = vec3_1[0]; + var y = vec3_1[1]; + var z = vec3_1[2]; + + var sumOfSquares = x * x + y * y + z * z; + + if (sumOfSquares > 0) { + sumOfSquares = 1 / Math.sqrt(sumOfSquares); + vec3_0[0] = vec3_1[0] * sumOfSquares; + vec3_0[1] = vec3_1[1] * sumOfSquares; + vec3_0[2] = vec3_1[2] * sumOfSquares; + } + + return vec3_0; + }; + }, + function (exp, t) { + // multSum(vec3, vec3) i = 177 + exp.exports = function (vec3_0, vec3_1) { + return ( + vec3_0[0] * vec3_1[0] + vec3_0[1] * vec3_1[1] + vec3_0[2] * vec3_1[2] + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + return ( + (e[0] = t[0] - i[0]), (e[1] = t[1] - i[1]), (e[2] = t[2] - i[2]), e + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + return ( + (e[0] = t[0] * i[0]), (e[1] = t[1] * i[1]), (e[2] = t[2] * i[2]), e + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + return ( + (e[0] = t[0] / i[0]), (e[1] = t[1] / i[1]), (e[2] = t[2] / i[2]), e + ); + }; + }, + function (e, t) { + e.exports = function (e, t) { + var i = t[0] - e[0], + n = t[1] - e[1], + r = t[2] - e[2]; + return Math.sqrt(i * i + n * n + r * r); + }; + }, + function (e, t) { + e.exports = function (e, t) { + var i = t[0] - e[0], + n = t[1] - e[1], + r = t[2] - e[2]; + return i * i + n * n + r * r; + }; + }, + function (e, t) { + e.exports = function (e) { + var t = e[0], + i = e[1], + n = e[2]; + return Math.sqrt(t * t + i * i + n * n); + }; + }, + function (e, t) { + e.exports = function (e) { + var t = e[0], + i = e[1], + n = e[2]; + return t * t + i * i + n * n; + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - for (var t = new Array(e), i = 0; i < e; ++i) - t[i] = i; - return t - } -} -, function(e, t, i) { - (function(e, n) { - function r(e) { - return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + e.exports = function (e) { + for (var t = new Array(e), i = 0; i < e; ++i) t[i] = i; + return t; + }; + }, + function (e, t, i) { + (function (e, n) { + function r(e) { + return (r = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + var o = /%[sdj%]/g; + (t.format = function (e) { + if (!v(e)) { + for (var t = [], i = 0; i < arguments.length; i++) + t.push(c(arguments[i])); + return t.join(" "); } - var o = /%[sdj%]/g; - t.format = function(e) { - if (!v(e)) { - for (var t = [], i = 0; i < arguments.length; i++) - t.push(c(arguments[i])); - return t.join(" ") - } - i = 1; - for (var n = arguments, r = n.length, a = String(e).replace(o, function(e) { - if ("%%" === e) - return "%"; - if (i >= r) - return e; - switch (e) { + i = 1; + for ( + var n = arguments, + r = n.length, + a = String(e).replace(o, function (e) { + if ("%%" === e) return "%"; + if (i >= r) return e; + switch (e) { case "%s": - return String(n[i++]); + return String(n[i++]); case "%d": - return Number(n[i++]); + return Number(n[i++]); case "%j": - try { - return JSON.stringify(n[i++]) - } catch (e) { - return "[Circular]" - } + try { + return JSON.stringify(n[i++]); + } catch (e) { + return "[Circular]"; + } default: - return e - } - }), s = n[i]; i < r; s = n[++i]) - g(s) || !E(s) ? a += " " + s : a += " " + c(s); - return a - } - , - t.deprecate = function(i, r) { - if (y(e.process)) - return function() { - return t.deprecate(i, r).apply(this, arguments) - } - ; - if (true === n.noDeprecation) - return i; - var o = false; - return function() { - if (!o) { - if (n.throwDeprecation) - throw new Error(r); - n.traceDeprecation ? console.trace(r) : console.error(r), - o = true - } - return i.apply(this, arguments) - } - } - ; - var a, s = {}; - function c(e, i) { - var n = { - seen: [], - stylize: l - }; - return arguments.length >= 3 && (n.depth = arguments[2]), - arguments.length >= 4 && (n.colors = arguments[3]), - m(i) ? n.showHidden = i : i && t._extend(n, i), - y(n.showHidden) && (n.showHidden = false), - y(n.depth) && (n.depth = 2), - y(n.colors) && (n.colors = false), - y(n.customInspect) && (n.customInspect = true), - n.colors && (n.stylize = u), - h(n, e, n.depth) - } - function u(e, t) { - var i = c.styles[t]; - return i ? "[" + c.colors[i][0] + "m" + e + "[" + c.colors[i][1] + "m" : e - } - function l(e, t) { - return e - } - function h(e, i, n) { - if (e.customInspect && i && x(i.inspect) && i.inspect !== t.inspect && (!i.constructor || i.constructor.prototype !== i)) { - var r = i.inspect(n, e); - return v(r) || (r = h(e, r, n)), - r - } - var o = function(e, t) { - if (y(t)) - return e.stylize("undefined", "undefined"); - if (v(t)) { - var i = "'" + JSON.stringify(t).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; - return e.stylize(i, "string") - } - if (_(t)) - return e.stylize("" + t, "number"); - if (m(t)) - return e.stylize("" + t, "boolean"); - if (g(t)) - return e.stylize("null", "null") - }(e, i); - if (o) - return o; - var a = Object.keys(i) - , s = function(e) { - var t = {}; - return e.forEach(function(e, i) { - t[e] = true - }), - t - }(a); - if (e.showHidden && (a = Object.getOwnPropertyNames(i)), - A(i) && (a.indexOf("message") >= 0 || a.indexOf("description") >= 0)) - return f(i); - if (0 === a.length) { - if (x(i)) { - var c = i.name ? ": " + i.name : ""; - return e.stylize("[Function" + c + "]", "special") - } - if (b(i)) - return e.stylize(RegExp.prototype.toString.call(i), "regexp"); - if (T(i)) - return e.stylize(Date.prototype.toString.call(i), "date"); - if (A(i)) - return f(i) - } - var u, l = "", E = false, S = ["{", "}"]; - (p(i) && (E = true, - S = ["[", "]"]), - x(i)) && (l = " [Function" + (i.name ? ": " + i.name : "") + "]"); - return b(i) && (l = " " + RegExp.prototype.toString.call(i)), - T(i) && (l = " " + Date.prototype.toUTCString.call(i)), - A(i) && (l = " " + f(i)), - 0 !== a.length || E && 0 != i.length ? n < 0 ? b(i) ? e.stylize(RegExp.prototype.toString.call(i), "regexp") : e.stylize("[Object]", "special") : (e.seen.push(i), - u = E ? function(e, t, i, n, r) { - for (var o = [], a = 0, s = t.length; a < s; ++a) - R(t, String(a)) ? o.push(d(e, t, i, n, String(a), true)) : o.push(""); - return r.forEach(function(r) { - r.match(/^\d+$/) || o.push(d(e, t, i, n, r, true)) - }), - o - }(e, i, n, s, a) : a.map(function(t) { - return d(e, i, n, s, t, E) + return e; + } }), - e.seen.pop(), - function(e, t, i) { - if (e.reduce(function(e, t) { - return 0, - t.indexOf("\n") >= 0 && 0, - e + t.replace(/\u001b\[\d\d?m/g, "").length + 1 - }, 0) > 60) - return i[0] + ("" === t ? "" : t + "\n ") + " " + e.join(",\n ") + " " + i[1]; - return i[0] + t + " " + e.join(", ") + " " + i[1] - }(u, l, S)) : S[0] + l + S[1] - } - function f(e) { - return "[" + Error.prototype.toString.call(e) + "]" - } - function d(e, t, i, n, r, o) { - var a, s, c; - if ((c = Object.getOwnPropertyDescriptor(t, r) || { - value: t[r] - }).get ? s = c.set ? e.stylize("[Getter/Setter]", "special") : e.stylize("[Getter]", "special") : c.set && (s = e.stylize("[Setter]", "special")), - R(n, r) || (a = "[" + r + "]"), - s || (e.seen.indexOf(c.value) < 0 ? (s = g(i) ? h(e, c.value, null) : h(e, c.value, i - 1)).indexOf("\n") > -1 && (s = o ? s.split("\n").map(function(e) { - return " " + e - }).join("\n").substr(2) : "\n" + s.split("\n").map(function(e) { - return " " + e - }).join("\n")) : s = e.stylize("[Circular]", "special")), - y(a)) { - if (o && r.match(/^\d+$/)) - return s; - (a = JSON.stringify("" + r)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (a = a.substr(1, a.length - 2), - a = e.stylize(a, "name")) : (a = a.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), - a = e.stylize(a, "string")) + s = n[i]; + i < r; + s = n[++i] + ) + g(s) || !E(s) ? (a += " " + s) : (a += " " + c(s)); + return a; + }), + (t.deprecate = function (i, r) { + if (y(e.process)) + return function () { + return t.deprecate(i, r).apply(this, arguments); + }; + if (true === n.noDeprecation) return i; + var o = false; + return function () { + if (!o) { + if (n.throwDeprecation) throw new Error(r); + n.traceDeprecation ? console.trace(r) : console.error(r), + (o = true); } - return a + ": " + s + return i.apply(this, arguments); + }; + }); + var a, + s = {}; + function c(e, i) { + var n = { + seen: [], + stylize: l, + }; + return ( + arguments.length >= 3 && (n.depth = arguments[2]), + arguments.length >= 4 && (n.colors = arguments[3]), + m(i) ? (n.showHidden = i) : i && t._extend(n, i), + y(n.showHidden) && (n.showHidden = false), + y(n.depth) && (n.depth = 2), + y(n.colors) && (n.colors = false), + y(n.customInspect) && (n.customInspect = true), + n.colors && (n.stylize = u), + h(n, e, n.depth) + ); + } + function u(e, t) { + var i = c.styles[t]; + return i + ? "[" + c.colors[i][0] + "m" + e + "[" + c.colors[i][1] + "m" + : e; + } + function l(e, t) { + return e; + } + function h(e, i, n) { + if ( + e.customInspect && + i && + x(i.inspect) && + i.inspect !== t.inspect && + (!i.constructor || i.constructor.prototype !== i) + ) { + var r = i.inspect(n, e); + return v(r) || (r = h(e, r, n)), r; } - function p(e) { - return Array.isArray(e) + var o = (function (e, t) { + if (y(t)) return e.stylize("undefined", "undefined"); + if (v(t)) { + var i = + "'" + + JSON.stringify(t) + .replace(/^"|"$/g, "") + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + + "'"; + return e.stylize(i, "string"); + } + if (_(t)) return e.stylize("" + t, "number"); + if (m(t)) return e.stylize("" + t, "boolean"); + if (g(t)) return e.stylize("null", "null"); + })(e, i); + if (o) return o; + var a = Object.keys(i), + s = (function (e) { + var t = {}; + return ( + e.forEach(function (e, i) { + t[e] = true; + }), + t + ); + })(a); + if ( + (e.showHidden && (a = Object.getOwnPropertyNames(i)), + A(i) && (a.indexOf("message") >= 0 || a.indexOf("description") >= 0)) + ) + return f(i); + if (0 === a.length) { + if (x(i)) { + var c = i.name ? ": " + i.name : ""; + return e.stylize("[Function" + c + "]", "special"); + } + if (b(i)) + return e.stylize(RegExp.prototype.toString.call(i), "regexp"); + if (T(i)) return e.stylize(Date.prototype.toString.call(i), "date"); + if (A(i)) return f(i); } - function m(e) { - return "boolean" == typeof e + var u, + l = "", + E = false, + S = ["{", "}"]; + (p(i) && ((E = true), (S = ["[", "]"])), x(i)) && + (l = " [Function" + (i.name ? ": " + i.name : "") + "]"); + return ( + b(i) && (l = " " + RegExp.prototype.toString.call(i)), + T(i) && (l = " " + Date.prototype.toUTCString.call(i)), + A(i) && (l = " " + f(i)), + 0 !== a.length || (E && 0 != i.length) + ? n < 0 + ? b(i) + ? e.stylize(RegExp.prototype.toString.call(i), "regexp") + : e.stylize("[Object]", "special") + : (e.seen.push(i), + (u = E + ? (function (e, t, i, n, r) { + for (var o = [], a = 0, s = t.length; a < s; ++a) + R(t, String(a)) + ? o.push(d(e, t, i, n, String(a), true)) + : o.push(""); + return ( + r.forEach(function (r) { + r.match(/^\d+$/) || o.push(d(e, t, i, n, r, true)); + }), + o + ); + })(e, i, n, s, a) + : a.map(function (t) { + return d(e, i, n, s, t, E); + })), + e.seen.pop(), + (function (e, t, i) { + if ( + e.reduce(function (e, t) { + return ( + 0, + t.indexOf("\n") >= 0 && 0, + e + t.replace(/\u001b\[\d\d?m/g, "").length + 1 + ); + }, 0) > 60 + ) + return ( + i[0] + + ("" === t ? "" : t + "\n ") + + " " + + e.join(",\n ") + + " " + + i[1] + ); + return i[0] + t + " " + e.join(", ") + " " + i[1]; + })(u, l, S)) + : S[0] + l + S[1] + ); + } + function f(e) { + return "[" + Error.prototype.toString.call(e) + "]"; + } + function d(e, t, i, n, r, o) { + var a, s, c; + if ( + ((c = Object.getOwnPropertyDescriptor(t, r) || { + value: t[r], + }).get + ? (s = c.set + ? e.stylize("[Getter/Setter]", "special") + : e.stylize("[Getter]", "special")) + : c.set && (s = e.stylize("[Setter]", "special")), + R(n, r) || (a = "[" + r + "]"), + s || + (e.seen.indexOf(c.value) < 0 + ? (s = g(i) ? h(e, c.value, null) : h(e, c.value, i - 1)).indexOf( + "\n" + ) > -1 && + (s = o + ? s + .split("\n") + .map(function (e) { + return " " + e; + }) + .join("\n") + .substr(2) + : "\n" + + s + .split("\n") + .map(function (e) { + return " " + e; + }) + .join("\n")) + : (s = e.stylize("[Circular]", "special"))), + y(a)) + ) { + if (o && r.match(/^\d+$/)) return s; + (a = JSON.stringify("" + r)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) + ? ((a = a.substr(1, a.length - 2)), (a = e.stylize(a, "name"))) + : ((a = a + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'")), + (a = e.stylize(a, "string"))); } - function g(e) { - return null === e - } - function _(e) { - return "number" == typeof e - } - function v(e) { - return "string" == typeof e - } - function y(e) { - return void 0 === e - } - function b(e) { - return E(e) && "[object RegExp]" === S(e) - } - function E(e) { - return "object" === r(e) && null !== e - } - function T(e) { - return E(e) && "[object Date]" === S(e) - } - function A(e) { - return E(e) && ("[object Error]" === S(e) || e instanceof Error) - } - function x(e) { - return "function" == typeof e - } - function S(e) { - return Object.prototype.toString.call(e) - } - function C(e) { - return e < 10 ? "0" + e.toString(10) : e.toString(10) - } - t.debuglog = function(e) { - if (y(a) && (a = n.env.NODE_DEBUG || ""), - e = e.toUpperCase(), - !s[e]) - if (new RegExp("\\b" + e + "\\b","i").test(a)) { - var i = n.pid; - s[e] = function() { - var n = t.format.apply(t, arguments); - console.error("%s %d: %s", e, i, n) - } - } else - s[e] = function() {} - ; - return s[e] - } - , - t.inspect = c, - c.colors = { - bold: [1, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - white: [37, 39], - grey: [90, 39], - black: [30, 39], - blue: [34, 39], - cyan: [36, 39], - green: [32, 39], - magenta: [35, 39], - red: [31, 39], - yellow: [33, 39] - }, - c.styles = { - special: "cyan", - number: "yellow", - boolean: "yellow", - undefined: "grey", - null: "bold", - string: "green", - date: "magenta", - regexp: "red" - }, - t.isArray = p, - t.isBoolean = m, - t.isNull = g, - t.isNullOrUndefined = function(e) { - return null == e - } - , - t.isNumber = _, - t.isString = v, - t.isSymbol = function(e) { - return "symbol" === r(e) - } - , - t.isUndefined = y, - t.isRegExp = b, - t.isObject = E, - t.isDate = T, - t.isError = A, - t.isFunction = x, - t.isPrimitive = function(e) { - return null === e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || "symbol" === r(e) || void 0 === e - } - , - t.isBuffer = i(449); - var P = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; - function R(e, t) { - return Object.prototype.hasOwnProperty.call(e, t) - } - t.log = function() { - var e, i; - console.log("%s - %s", (e = new Date, - i = [C(e.getHours()), C(e.getMinutes()), C(e.getSeconds())].join(":"), - [e.getDate(), P[e.getMonth()], i].join(" ")), t.format.apply(t, arguments)) - } - , - t.inherits = i(1), - t._extend = function(e, t) { - if (!t || !E(t)) - return e; - for (var i = Object.keys(t), n = i.length; n--; ) - e[i[n]] = t[i[n]]; - return e - } - } - ).call(this, i(15), i(27)) -} -, function(e, t, i) { + return a + ": " + s; + } + function p(e) { + return Array.isArray(e); + } + function m(e) { + return "boolean" == typeof e; + } + function g(e) { + return null === e; + } + function _(e) { + return "number" == typeof e; + } + function v(e) { + return "string" == typeof e; + } + function y(e) { + return void 0 === e; + } + function b(e) { + return E(e) && "[object RegExp]" === S(e); + } + function E(e) { + return "object" === r(e) && null !== e; + } + function T(e) { + return E(e) && "[object Date]" === S(e); + } + function A(e) { + return E(e) && ("[object Error]" === S(e) || e instanceof Error); + } + function x(e) { + return "function" == typeof e; + } + function S(e) { + return Object.prototype.toString.call(e); + } + function C(e) { + return e < 10 ? "0" + e.toString(10) : e.toString(10); + } + (t.debuglog = function (e) { + if ( + (y(a) && (a = n.env.NODE_DEBUG || ""), (e = e.toUpperCase()), !s[e]) + ) + if (new RegExp("\\b" + e + "\\b", "i").test(a)) { + var i = n.pid; + s[e] = function () { + var n = t.format.apply(t, arguments); + console.error("%s %d: %s", e, i, n); + }; + } else s[e] = function () {}; + return s[e]; + }), + (t.inspect = c), + (c.colors = { + bold: [1, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + white: [37, 39], + grey: [90, 39], + black: [30, 39], + blue: [34, 39], + cyan: [36, 39], + green: [32, 39], + magenta: [35, 39], + red: [31, 39], + yellow: [33, 39], + }), + (c.styles = { + special: "cyan", + number: "yellow", + boolean: "yellow", + undefined: "grey", + null: "bold", + string: "green", + date: "magenta", + regexp: "red", + }), + (t.isArray = p), + (t.isBoolean = m), + (t.isNull = g), + (t.isNullOrUndefined = function (e) { + return null == e; + }), + (t.isNumber = _), + (t.isString = v), + (t.isSymbol = function (e) { + return "symbol" === r(e); + }), + (t.isUndefined = y), + (t.isRegExp = b), + (t.isObject = E), + (t.isDate = T), + (t.isError = A), + (t.isFunction = x), + (t.isPrimitive = function (e) { + return ( + null === e || + "boolean" == typeof e || + "number" == typeof e || + "string" == typeof e || + "symbol" === r(e) || + void 0 === e + ); + }), + (t.isBuffer = i(449)); + var P = [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ]; + function R(e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + } + (t.log = function () { + var e, i; + console.log( + "%s - %s", + ((e = new Date()), + (i = [C(e.getHours()), C(e.getMinutes()), C(e.getSeconds())].join( + ":" + )), + [e.getDate(), P[e.getMonth()], i].join(" ")), + t.format.apply(t, arguments) + ); + }), + (t.inherits = i(1)), + (t._extend = function (e, t) { + if (!t || !E(t)) return e; + for (var i = Object.keys(t), n = i.length; n--; ) e[i[n]] = t[i[n]]; + return e; + }); + }.call(this, i(15), i(27))); + }, + function (e, t, i) { "use strict"; - var n = [] - , r = [] - , o = [] - , a = [] - , s = [] - , c = [] - , u = [] - , l = [] - , h = [] - , f = [] - , d = [] - , p = []; - e.exports = function(e, t, i, m, g, _) { - for (var v = u, y = h, b = f, E = p, T = 0; T < 3; T++) - v[T] = +i[T], - b[T] = +t.max[T], - y[T] = +t.base[T]; - _ || (_ = 1e-10); - var A = function(e, t, i, u, h, f) { - var p = n - , m = r - , g = o - , _ = a - , v = s - , y = c - , b = l - , E = Math.floor - , T = 0 - , A = 0 - , x = 0 - , S = 0 - , C = 0; - if (P(), - 0 === x) - return 0; - for (S = O(); A <= x; ) { - if (R(S) && M()) - return T; - S = O() - } - for (T += x, - C = 0; C < 3; C++) - u[C] += i[C], - h[C] += i[C]; - return T; - function P() { - if (A = 0, - 0 !== (x = Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2]))) - for (var e = 0; e < 3; e++) { - var t = i[e] >= 0; - _[e] = t ? 1 : -1; - var n = t ? h[e] : u[e]; - p[e] = t ? u[e] : h[e], - m[e] = w(n, _[e]), - g[e] = I(p[e], _[e]), - b[e] = i[e] / x, - v[e] = Math.abs(1 / b[e]); - var r = t ? m[e] + 1 - n : n - m[e]; - y[e] = v[e] < 1 / 0 ? v[e] * r : 1 / 0 - } - } - function R(t) { - for (var i = _[0], n = 0 === t ? m[0] : g[0], r = m[0] + i, o = _[1], a = 1 === t ? m[1] : g[1], s = m[1] + o, c = _[2], u = 2 === t ? m[2] : g[2], l = m[2] + c, h = n; h != r; h += i) - for (var f = a; f != s; f += o) - for (var d = u; d != l; d += c) - if (e(h, f, d)) - return true; - return false - } - function M() { - T += A; - var e = _[S] - , n = A / x - , r = d; - for (C = 0; C < 3; C++) { - var o = i[C] * n; - u[C] += o, - h[C] += o, - r[C] = i[C] - o - } - if (e > 0 ? h[S] = Math.round(h[S]) : u[S] = Math.round(u[S]), - t(T, S, e, r)) - return true; - for (C = 0; C < 3; C++) - i[C] = r[C]; - return P(), - 0 === x - } - function O() { - var e = y[0] < y[1] ? y[0] < y[2] ? 0 : 2 : y[1] < y[2] ? 1 : 2 - , t = y[e] - A; - for (A = y[e], - m[e] += _[e], - y[e] += v[e], - C = 0; C < 3; C++) - p[C] += t * b[C], - g[C] = I(p[C], _[C]); - return e - } - function w(e, t) { - return E(e - t * f) - } - function I(e, t) { - return E(e + t * f) - } - }(e, m, v, y, b, _); - if (!g) { - for (T = 0; T < 3; T++) - E[T] = i[T] > 0 ? b[T] - t.max[T] : y[T] - t.base[T]; - t.translate(E) + var n = [], + r = [], + o = [], + a = [], + s = [], + c = [], + u = [], + l = [], + h = [], + f = [], + d = [], + p = []; + e.exports = function (e, t, i, m, g, _) { + for (var v = u, y = h, b = f, E = p, T = 0; T < 3; T++) + (v[T] = +i[T]), (b[T] = +t.max[T]), (y[T] = +t.base[T]); + _ || (_ = 1e-10); + var A = (function (e, t, i, u, h, f) { + var p = n, + m = r, + g = o, + _ = a, + v = s, + y = c, + b = l, + E = Math.floor, + T = 0, + A = 0, + x = 0, + S = 0, + C = 0; + if ((P(), 0 === x)) return 0; + for (S = O(); A <= x; ) { + if (R(S) && M()) return T; + S = O(); } - return A - } -} -, function(e, t, i) { + for (T += x, C = 0; C < 3; C++) (u[C] += i[C]), (h[C] += i[C]); + return T; + function P() { + if ( + ((A = 0), + 0 !== (x = Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2]))) + ) + for (var e = 0; e < 3; e++) { + var t = i[e] >= 0; + _[e] = t ? 1 : -1; + var n = t ? h[e] : u[e]; + (p[e] = t ? u[e] : h[e]), + (m[e] = w(n, _[e])), + (g[e] = I(p[e], _[e])), + (b[e] = i[e] / x), + (v[e] = Math.abs(1 / b[e])); + var r = t ? m[e] + 1 - n : n - m[e]; + y[e] = v[e] < 1 / 0 ? v[e] * r : 1 / 0; + } + } + function R(t) { + for ( + var i = _[0], + n = 0 === t ? m[0] : g[0], + r = m[0] + i, + o = _[1], + a = 1 === t ? m[1] : g[1], + s = m[1] + o, + c = _[2], + u = 2 === t ? m[2] : g[2], + l = m[2] + c, + h = n; + h != r; + h += i + ) + for (var f = a; f != s; f += o) + for (var d = u; d != l; d += c) if (e(h, f, d)) return true; + return false; + } + function M() { + T += A; + var e = _[S], + n = A / x, + r = d; + for (C = 0; C < 3; C++) { + var o = i[C] * n; + (u[C] += o), (h[C] += o), (r[C] = i[C] - o); + } + if ( + (e > 0 ? (h[S] = Math.round(h[S])) : (u[S] = Math.round(u[S])), + t(T, S, e, r)) + ) + return true; + for (C = 0; C < 3; C++) i[C] = r[C]; + return P(), 0 === x; + } + function O() { + var e = y[0] < y[1] ? (y[0] < y[2] ? 0 : 2) : y[1] < y[2] ? 1 : 2, + t = y[e] - A; + for (A = y[e], m[e] += _[e], y[e] += v[e], C = 0; C < 3; C++) + (p[C] += t * b[C]), (g[C] = I(p[C], _[C])); + return e; + } + function w(e, t) { + return E(e - t * f); + } + function I(e, t) { + return E(e + t * f); + } + })(e, m, v, y, b, _); + if (!g) { + for (T = 0; T < 3; T++) + E[T] = i[T] > 0 ? b[T] - t.max[T] : y[T] - t.base[T]; + t.translate(E); + } + return A; + }; + }, + function (e, t, i) { "use strict"; var n = {}; e.exports = n; - var r = 13 - , o = 1 << r++ - , a = 1 << r++ - , s = 1 << r++; - n.ID_MASK = 511, - n.VAR_MASK = 7680, - n.SOLID_BIT = o, - n.OPAQUE_BIT = a, - n.OBJECT_BIT = s -} -, function(e, t, i) { + var r = 13, + o = 1 << r++, + a = 1 << r++, + s = 1 << r++; + (n.ID_MASK = 511), + (n.VAR_MASK = 7680), + (n.SOLID_BIT = o), + (n.OPAQUE_BIT = a), + (n.OBJECT_BIT = s); + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - return function(e) { - var t = new Float32Array(256) - , i = new Float32Array(256) - , n = new Float32Array(256) - , r = new Float32Array(256) - , o = new Uint8ClampedArray(1024) - , a = new BABYLON.DynamicTexture("waterTexture",{ - width: 16, - height: 16 - },e.rendering._scene); - a.hasAlpha = true, - a.anisotropicFilteringLevel = 1, - a.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE), - a.wrapU = 1, - a.wrapV = 1; - var s = a.getContext() - , c = new ImageData(o,16,16) - , u = 0; - e.on("tick", function(e) { - ++u % 2 != 0 && l.redraw() - }); - var l = { - texture: a, - tick: function() {}, - redraw: function() { - l.update(), - s.clearRect(0, 0, 16, 16), - s.putImageData(c, 0, 0), - a.update() - }, - update: function() { - for (var e = 0; e < 16; e++) - for (var a = 0; a < 16; a++) { - for (var s = 0, c = e - 1; c <= e + 1; c++) { - var u = 15 & c - , l = 15 & a; - s += t[u + 16 * l] - } - i[e + 16 * a] = s / 3.3 + .8 * n[e + 16 * a] - } - for (var e = 0; e < 16; e++) - for (var a = 0; a < 16; a++) - n[e + 16 * a] += .05 * r[e + 16 * a], - n[e + 16 * a] < 0 && (n[e + 16 * a] = 0), - r[e + 16 * a] -= .1, - Math.random() < .05 && (r[e + 16 * a] = .5); - var h = i; - i = t, - t = h; - for (var f = 0; f < 256; f++) { - var s = t[f]; - s > 1 && (s = 1), - s < 0 && (s = 0); - var d = s * s - , p = 32 + 32 * d - , m = 50 + 64 * d - , g = 196 + 50 * d; - o[4 * f + 0] = p, - o[4 * f + 1] = m, - o[4 * f + 2] = 255, - o[4 * f + 3] = g - } + e.exports = function (e) { + return (function (e) { + var t = new Float32Array(256), + i = new Float32Array(256), + n = new Float32Array(256), + r = new Float32Array(256), + o = new Uint8ClampedArray(1024), + a = new BABYLON.DynamicTexture( + "waterTexture", + { + width: 16, + height: 16, + }, + e.rendering._scene + ); + (a.hasAlpha = true), + (a.anisotropicFilteringLevel = 1), + a.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE), + (a.wrapU = 1), + (a.wrapV = 1); + var s = a.getContext(), + c = new ImageData(o, 16, 16), + u = 0; + e.on("tick", function (e) { + ++u % 2 != 0 && l.redraw(); + }); + var l = { + texture: a, + tick: function () {}, + redraw: function () { + l.update(), + s.clearRect(0, 0, 16, 16), + s.putImageData(c, 0, 0), + a.update(); + }, + update: function () { + for (var e = 0; e < 16; e++) + for (var a = 0; a < 16; a++) { + for (var s = 0, c = e - 1; c <= e + 1; c++) { + var u = 15 & c, + l = 15 & a; + s += t[u + 16 * l]; } - }; - return e.waterTexture = a, - l - }(e) - } -} -, function(e, t, i) { + i[e + 16 * a] = s / 3.3 + 0.8 * n[e + 16 * a]; + } + for (var e = 0; e < 16; e++) + for (var a = 0; a < 16; a++) + (n[e + 16 * a] += 0.05 * r[e + 16 * a]), + n[e + 16 * a] < 0 && (n[e + 16 * a] = 0), + (r[e + 16 * a] -= 0.1), + Math.random() < 0.05 && (r[e + 16 * a] = 0.5); + var h = i; + (i = t), (t = h); + for (var f = 0; f < 256; f++) { + var s = t[f]; + s > 1 && (s = 1), s < 0 && (s = 0); + var d = s * s, + p = 32 + 32 * d, + m = 50 + 64 * d, + g = 196 + 50 * d; + (o[4 * f + 0] = p), + (o[4 * f + 1] = m), + (o[4 * f + 2] = 255), + (o[4 * f + 3] = g); + } + }, + }; + return (e.waterTexture = a), l; + })(e); + }; + }, + function (e, t, i) { "use strict"; - var n, r = "undefined" != typeof window ? window.navigator.userAgent : "", o = /OS X/.test(r), a = /Opera/.test(r), s = !/like Gecko/.test(r) && !a, c = e.exports = { + var n, + r = "undefined" != typeof window ? window.navigator.userAgent : "", + o = /OS X/.test(r), + a = /Opera/.test(r), + s = !/like Gecko/.test(r) && !a, + c = (e.exports = { 0: o ? "" : "", 1: "", 2: "", @@ -13522,1365 +16225,1669 @@ 251: "", 252: "", 253: "", - 254: "" - }; - for (n = 58; n < 65; ++n) - c[n] = String.fromCharCode(n); - for (n = 48; n < 58; ++n) - c[n] = n - 48 + ""; - for (n = 65; n < 91; ++n) - c[n] = String.fromCharCode(n); - for (n = 96; n < 106; ++n) - c[n] = ""; - for (n = 112; n < 136; ++n) - c[n] = "F" + (n - 111) -} -, function(e, t, getterFunc) { + 254: "", + }); + for (n = 58; n < 65; ++n) c[n] = String.fromCharCode(n); + for (n = 48; n < 58; ++n) c[n] = n - 48 + ""; + for (n = 65; n < 91; ++n) c[n] = String.fromCharCode(n); + for (n = 96; n < 106; ++n) c[n] = ""; + for (n = 112; n < 136; ++n) c[n] = "F" + (n - 111); + }, + function (e, t, getterFunc) { e.exports = r; var vec3Math = getterFunc(16); function r(e, t) { - if (!(this instanceof r)) - return new r(e,t); - var i = vec3Math.create(); - vec3Math.add(i, e, t), - this.base = vec3Math.min(vec3Math.create(), e, i), - this.vec = vec3Math.clone(t), - this.max = vec3Math.max(vec3Math.create(), e, i), - this.mag = vec3Math.length(this.vec) + if (!(this instanceof r)) return new r(e, t); + var i = vec3Math.create(); + vec3Math.add(i, e, t), + (this.base = vec3Math.min(vec3Math.create(), e, i)), + (this.vec = vec3Math.clone(t)), + (this.max = vec3Math.max(vec3Math.create(), e, i)), + (this.mag = vec3Math.length(this.vec)); } var o = r.prototype; - o.width = function() { - return this.vec[0] - } - , - o.height = function() { - return this.vec[1] - } - , - o.depth = function() { - return this.vec[2] - } - , - o.x0 = function() { - return this.base[0] - } - , - o.y0 = function() { - return this.base[1] - } - , - o.z0 = function() { - return this.base[2] - } - , - o.x1 = function() { - return this.max[0] - } - , - o.y1 = function() { - return this.max[1] - } - , - o.z1 = function() { - return this.max[2] - } - , - o.translate = function(e) { - return vec3Math.add(this.max, this.max, e), - vec3Math.add(this.base, this.base, e), - this - } - , - o.setPosition = function(e) { - return vec3Math.add(this.max, e, this.vec), - vec3Math.copy(this.base, e), - this - } - , - o.expand = function(e) { - var t = vec3Math.create() - , i = vec3Math.create(); - return vec3Math.max(t, e.max, this.max), - vec3Math.min(i, e.base, this.base), - vec3Math.subtract(t, t, i), - new r(i,t) - } - , - o.intersects = function(e) { - return !(e.base[0] > this.max[0]) && (!(e.base[1] > this.max[1]) && (!(e.base[2] > this.max[2]) && (!(e.max[0] < this.base[0]) && (!(e.max[1] < this.base[1]) && !(e.max[2] < this.base[2]))))) - } - , - o.touches = function(e) { + (o.width = function () { + return this.vec[0]; + }), + (o.height = function () { + return this.vec[1]; + }), + (o.depth = function () { + return this.vec[2]; + }), + (o.x0 = function () { + return this.base[0]; + }), + (o.y0 = function () { + return this.base[1]; + }), + (o.z0 = function () { + return this.base[2]; + }), + (o.x1 = function () { + return this.max[0]; + }), + (o.y1 = function () { + return this.max[1]; + }), + (o.z1 = function () { + return this.max[2]; + }), + (o.translate = function (e) { + return ( + vec3Math.add(this.max, this.max, e), + vec3Math.add(this.base, this.base, e), + this + ); + }), + (o.setPosition = function (e) { + return ( + vec3Math.add(this.max, e, this.vec), vec3Math.copy(this.base, e), this + ); + }), + (o.expand = function (e) { + var t = vec3Math.create(), + i = vec3Math.create(); + return ( + vec3Math.max(t, e.max, this.max), + vec3Math.min(i, e.base, this.base), + vec3Math.subtract(t, t, i), + new r(i, t) + ); + }), + (o.intersects = function (e) { + return ( + !(e.base[0] > this.max[0]) && + !(e.base[1] > this.max[1]) && + !(e.base[2] > this.max[2]) && + !(e.max[0] < this.base[0]) && + !(e.max[1] < this.base[1]) && + !(e.max[2] < this.base[2]) + ); + }), + (o.touches = function (e) { var t = this.union(e); - return null !== t && (0 == t.width() || 0 == t.height() || 0 == t.depth()) - } - , - o.union = function(e) { - if (!this.intersects(e)) - return null; - var t = Math.max(e.base[0], this.base[0]) - , i = Math.max(e.base[1], this.base[1]) - , n = Math.max(e.base[2], this.base[2]); - return new r([t, i, n],[Math.min(e.max[0], this.max[0]) - t, Math.min(e.max[1], this.max[1]) - i, Math.min(e.max[2], this.max[2]) - n]) - } -} -, function(e, t, i) { + return ( + null !== t && (0 == t.width() || 0 == t.height() || 0 == t.depth()) + ); + }), + (o.union = function (e) { + if (!this.intersects(e)) return null; + var t = Math.max(e.base[0], this.base[0]), + i = Math.max(e.base[1], this.base[1]), + n = Math.max(e.base[2], this.base[2]); + return new r( + [t, i, n], + [ + Math.min(e.max[0], this.max[0]) - t, + Math.min(e.max[1], this.max[1]) - i, + Math.min(e.max[2], this.max[2]) - n, + ] + ); + }); + }, + function (e, t, i) { "use strict"; e.exports = { - init: function(e) { - var t = r.nextPow2(e); - s.length < t && (n.free(s), - s = n.mallocInt32(t)); - c.length < t && (n.free(c), - c = n.mallocInt32(t)); - u.length < t && (n.free(u), - u = n.mallocInt32(t)); - l.length < t && (n.free(l), - l = n.mallocInt32(t)); - h.length < t && (n.free(h), - h = n.mallocInt32(t)); - f.length < t && (n.free(f), - f = n.mallocInt32(t)); - var i = 8 * t; - d.length < i && (n.free(d), - d = n.mallocDouble(i)) - }, - sweepBipartite: function(e, t, i, n, r, h, f, g, _, v) { - for (var y = 0, b = 2 * e, E = e - 1, T = b - 1, A = i; A < n; ++A) { - var x = h[A] - , S = b * A; - d[y++] = r[S + E], - d[y++] = -(x + 1), - d[y++] = r[S + T], - d[y++] = x - } - for (var A = f; A < g; ++A) { - var x = v[A] + a - , C = b * A; - d[y++] = _[C + E], - d[y++] = -x, - d[y++] = _[C + T], - d[y++] = x - } - var P = y >>> 1; - o(d, P); - for (var R = 0, M = 0, A = 0; A < P; ++A) { - var O = 0 | d[2 * A + 1]; - if (O >= a) - p(u, l, M--, O = O - a | 0); - else if (O >= 0) - p(s, c, R--, O); - else if (O <= -a) { - O = -O - a | 0; - for (var w = 0; w < R; ++w) { - var I = t(s[w], O); - if (void 0 !== I) - return I - } - m(u, l, M++, O) - } else { - O = -O - 1 | 0; - for (var w = 0; w < M; ++w) { - var I = t(O, u[w]); - if (void 0 !== I) - return I - } - m(s, c, R++, O) - } - } - }, - sweepComplete: function(e, t, i, n, r, a, g, _, v, y) { - for (var b = 0, E = 2 * e, T = e - 1, A = E - 1, x = i; x < n; ++x) { - var S = a[x] + 1 << 1 - , C = E * x; - d[b++] = r[C + T], - d[b++] = -S, - d[b++] = r[C + A], - d[b++] = S - } - for (var x = g; x < _; ++x) { - var S = y[x] + 1 << 1 - , P = E * x; - d[b++] = v[P + T], - d[b++] = 1 | -S, - d[b++] = v[P + A], - d[b++] = 1 | S - } - var R = b >>> 1; - o(d, R); - for (var M = 0, O = 0, w = 0, x = 0; x < R; ++x) { - var I = 0 | d[2 * x + 1] - , D = 1 & I; - if (x < R - 1 && I >> 1 == d[2 * x + 3] >> 1 && (D = 2, - x += 1), - I < 0) { - for (var L = -(I >> 1) - 1, F = 0; F < w; ++F) { - var B = t(h[F], L); - if (void 0 !== B) - return B - } - if (0 !== D) - for (var F = 0; F < M; ++F) { - var B = t(s[F], L); - if (void 0 !== B) - return B - } - if (1 !== D) - for (var F = 0; F < O; ++F) { - var B = t(u[F], L); - if (void 0 !== B) - return B - } - 0 === D ? m(s, c, M++, L) : 1 === D ? m(u, l, O++, L) : 2 === D && m(h, f, w++, L) - } else { - var L = (I >> 1) - 1; - 0 === D ? p(s, c, M--, L) : 1 === D ? p(u, l, O--, L) : 2 === D && p(h, f, w--, L) - } - } - }, - scanBipartite: function(e, t, i, n, r, u, l, h, f, g, _, v) { - var y = 0 - , b = 2 * e - , E = t - , T = t + e - , A = 1 - , x = 1; - n ? x = a : A = a; - for (var S = r; S < u; ++S) { - var C = S + A - , P = b * S; - d[y++] = l[P + E], - d[y++] = -C, - d[y++] = l[P + T], - d[y++] = C - } - for (var S = f; S < g; ++S) { - var C = S + x - , R = b * S; - d[y++] = _[R + E], - d[y++] = -C - } - var M = y >>> 1; - o(d, M); - for (var O = 0, S = 0; S < M; ++S) { - var w = 0 | d[2 * S + 1]; - if (w < 0) { - var C = -w - , I = false; - if (C >= a ? (I = !n, - C -= a) : (I = !!n, - C -= 1), - I) - m(s, c, O++, C); - else { - var D = v[C] - , L = b * C - , F = _[L + t + 1] - , B = _[L + t + 1 + e]; - e: for (var N = 0; N < O; ++N) { - var k = s[N] - , U = b * k; - if (!(B < l[U + t + 1] || l[U + t + 1 + e] < F)) { - for (var V = t + 2; V < e; ++V) - if (_[L + V + e] < l[U + V] || l[U + V + e] < _[L + V]) - continue e; - var G, z = h[k]; - if (void 0 !== (G = n ? i(D, z) : i(z, D))) - return G - } - } - } - } else - p(s, c, O--, w - A) - } - }, - scanComplete: function(e, t, i, n, r, c, u, l, h, f, p) { - for (var m = 0, g = 2 * e, _ = t, v = t + e, y = n; y < r; ++y) { - var b = y + a - , E = g * y; - d[m++] = c[E + _], - d[m++] = -b, - d[m++] = c[E + v], - d[m++] = b - } - for (var y = l; y < h; ++y) { - var b = y + 1 - , T = g * y; - d[m++] = f[T + _], - d[m++] = -b - } - var A = m >>> 1; - o(d, A); - for (var x = 0, y = 0; y < A; ++y) { - var S = 0 | d[2 * y + 1]; - if (S < 0) { - var b = -S; - if (b >= a) - s[x++] = b - a; - else { - var C = p[b -= 1] - , P = g * b - , R = f[P + t + 1] - , M = f[P + t + 1 + e]; - e: for (var O = 0; O < x; ++O) { - var w = s[O] - , I = u[w]; - if (I === C) - break; - var D = g * w; - if (!(M < c[D + t + 1] || c[D + t + 1 + e] < R)) { - for (var L = t + 2; L < e; ++L) - if (f[P + L + e] < c[D + L] || c[D + L + e] < f[P + L]) - continue e; - var F = i(I, C); - if (void 0 !== F) - return F - } - } - } - } else { - for (var b = S - a, O = x - 1; O >= 0; --O) - if (s[O] === b) { - for (var L = O + 1; L < x; ++L) - s[L - 1] = s[L]; - break - } - --x - } - } + init: function (e) { + var t = r.nextPow2(e); + s.length < t && (n.free(s), (s = n.mallocInt32(t))); + c.length < t && (n.free(c), (c = n.mallocInt32(t))); + u.length < t && (n.free(u), (u = n.mallocInt32(t))); + l.length < t && (n.free(l), (l = n.mallocInt32(t))); + h.length < t && (n.free(h), (h = n.mallocInt32(t))); + f.length < t && (n.free(f), (f = n.mallocInt32(t))); + var i = 8 * t; + d.length < i && (n.free(d), (d = n.mallocDouble(i))); + }, + sweepBipartite: function (e, t, i, n, r, h, f, g, _, v) { + for (var y = 0, b = 2 * e, E = e - 1, T = b - 1, A = i; A < n; ++A) { + var x = h[A], + S = b * A; + (d[y++] = r[S + E]), + (d[y++] = -(x + 1)), + (d[y++] = r[S + T]), + (d[y++] = x); } + for (var A = f; A < g; ++A) { + var x = v[A] + a, + C = b * A; + (d[y++] = _[C + E]), (d[y++] = -x), (d[y++] = _[C + T]), (d[y++] = x); + } + var P = y >>> 1; + o(d, P); + for (var R = 0, M = 0, A = 0; A < P; ++A) { + var O = 0 | d[2 * A + 1]; + if (O >= a) p(u, l, M--, (O = (O - a) | 0)); + else if (O >= 0) p(s, c, R--, O); + else if (O <= -a) { + O = (-O - a) | 0; + for (var w = 0; w < R; ++w) { + var I = t(s[w], O); + if (void 0 !== I) return I; + } + m(u, l, M++, O); + } else { + O = (-O - 1) | 0; + for (var w = 0; w < M; ++w) { + var I = t(O, u[w]); + if (void 0 !== I) return I; + } + m(s, c, R++, O); + } + } + }, + sweepComplete: function (e, t, i, n, r, a, g, _, v, y) { + for (var b = 0, E = 2 * e, T = e - 1, A = E - 1, x = i; x < n; ++x) { + var S = (a[x] + 1) << 1, + C = E * x; + (d[b++] = r[C + T]), (d[b++] = -S), (d[b++] = r[C + A]), (d[b++] = S); + } + for (var x = g; x < _; ++x) { + var S = (y[x] + 1) << 1, + P = E * x; + (d[b++] = v[P + T]), + (d[b++] = 1 | -S), + (d[b++] = v[P + A]), + (d[b++] = 1 | S); + } + var R = b >>> 1; + o(d, R); + for (var M = 0, O = 0, w = 0, x = 0; x < R; ++x) { + var I = 0 | d[2 * x + 1], + D = 1 & I; + if ( + (x < R - 1 && I >> 1 == d[2 * x + 3] >> 1 && ((D = 2), (x += 1)), + I < 0) + ) { + for (var L = -(I >> 1) - 1, F = 0; F < w; ++F) { + var B = t(h[F], L); + if (void 0 !== B) return B; + } + if (0 !== D) + for (var F = 0; F < M; ++F) { + var B = t(s[F], L); + if (void 0 !== B) return B; + } + if (1 !== D) + for (var F = 0; F < O; ++F) { + var B = t(u[F], L); + if (void 0 !== B) return B; + } + 0 === D + ? m(s, c, M++, L) + : 1 === D + ? m(u, l, O++, L) + : 2 === D && m(h, f, w++, L); + } else { + var L = (I >> 1) - 1; + 0 === D + ? p(s, c, M--, L) + : 1 === D + ? p(u, l, O--, L) + : 2 === D && p(h, f, w--, L); + } + } + }, + scanBipartite: function (e, t, i, n, r, u, l, h, f, g, _, v) { + var y = 0, + b = 2 * e, + E = t, + T = t + e, + A = 1, + x = 1; + n ? (x = a) : (A = a); + for (var S = r; S < u; ++S) { + var C = S + A, + P = b * S; + (d[y++] = l[P + E]), (d[y++] = -C), (d[y++] = l[P + T]), (d[y++] = C); + } + for (var S = f; S < g; ++S) { + var C = S + x, + R = b * S; + (d[y++] = _[R + E]), (d[y++] = -C); + } + var M = y >>> 1; + o(d, M); + for (var O = 0, S = 0; S < M; ++S) { + var w = 0 | d[2 * S + 1]; + if (w < 0) { + var C = -w, + I = false; + if ((C >= a ? ((I = !n), (C -= a)) : ((I = !!n), (C -= 1)), I)) + m(s, c, O++, C); + else { + var D = v[C], + L = b * C, + F = _[L + t + 1], + B = _[L + t + 1 + e]; + e: for (var N = 0; N < O; ++N) { + var k = s[N], + U = b * k; + if (!(B < l[U + t + 1] || l[U + t + 1 + e] < F)) { + for (var V = t + 2; V < e; ++V) + if (_[L + V + e] < l[U + V] || l[U + V + e] < _[L + V]) + continue e; + var G, + z = h[k]; + if (void 0 !== (G = n ? i(D, z) : i(z, D))) return G; + } + } + } + } else p(s, c, O--, w - A); + } + }, + scanComplete: function (e, t, i, n, r, c, u, l, h, f, p) { + for (var m = 0, g = 2 * e, _ = t, v = t + e, y = n; y < r; ++y) { + var b = y + a, + E = g * y; + (d[m++] = c[E + _]), (d[m++] = -b), (d[m++] = c[E + v]), (d[m++] = b); + } + for (var y = l; y < h; ++y) { + var b = y + 1, + T = g * y; + (d[m++] = f[T + _]), (d[m++] = -b); + } + var A = m >>> 1; + o(d, A); + for (var x = 0, y = 0; y < A; ++y) { + var S = 0 | d[2 * y + 1]; + if (S < 0) { + var b = -S; + if (b >= a) s[x++] = b - a; + else { + var C = p[(b -= 1)], + P = g * b, + R = f[P + t + 1], + M = f[P + t + 1 + e]; + e: for (var O = 0; O < x; ++O) { + var w = s[O], + I = u[w]; + if (I === C) break; + var D = g * w; + if (!(M < c[D + t + 1] || c[D + t + 1 + e] < R)) { + for (var L = t + 2; L < e; ++L) + if (f[P + L + e] < c[D + L] || c[D + L + e] < f[P + L]) + continue e; + var F = i(I, C); + if (void 0 !== F) return F; + } + } + } + } else { + for (var b = S - a, O = x - 1; O >= 0; --O) + if (s[O] === b) { + for (var L = O + 1; L < x; ++L) s[L - 1] = s[L]; + break; + } + --x; + } + } + }, }; - var n = i(125) - , r = i(126) - , o = i(485) - , a = 1 << 28 - , s = n.mallocInt32(1024) - , c = n.mallocInt32(1024) - , u = n.mallocInt32(1024) - , l = n.mallocInt32(1024) - , h = n.mallocInt32(1024) - , f = n.mallocInt32(1024) - , d = n.mallocDouble(8192); + var n = i(125), + r = i(126), + o = i(485), + a = 1 << 28, + s = n.mallocInt32(1024), + c = n.mallocInt32(1024), + u = n.mallocInt32(1024), + l = n.mallocInt32(1024), + h = n.mallocInt32(1024), + f = n.mallocInt32(1024), + d = n.mallocDouble(8192); function p(e, t, i, n) { - var r = t[n] - , o = e[i - 1]; - e[r] = o, - t[o] = r + var r = t[n], + o = e[i - 1]; + (e[r] = o), (t[o] = r); } function m(e, t, i, n) { - e[i] = n, - t[n] = i + (e[i] = n), (t[n] = i); } -} -, function(e, t, i) { + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t) { - var i = "abcdef".split("").concat(t) - , r = []; - e.indexOf("lo") >= 0 && r.push("lo=e[k+n]"); - e.indexOf("hi") >= 0 && r.push("hi=e[k+o]"); - return i.push(n.replace("_", r.join()).replace("$", e)), + e.exports = function (e, t) { + var i = "abcdef".split("").concat(t), + r = []; + e.indexOf("lo") >= 0 && r.push("lo=e[k+n]"); + e.indexOf("hi") >= 0 && r.push("hi=e[k+o]"); + return ( + i.push(n.replace("_", r.join()).replace("$", e)), Function.apply(void 0, i) - } - ; - var n = "for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m" -} -, function(module, exports, __webpack_require__) { + ); + }; + var n = + "for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"; + }, + function (module, exports, __webpack_require__) { "use strict"; function overlay(game) { - var scale = 2 - , buttonscale = scale + 1 - , patternScale = 8 - , width = window.innerWidth - , height = window.innerHeight - , mouseOverButton = null - , tickRate = 500 - , lastTick = 0 - , blinkCount = 0 - , blinkCopy = false - , ypos = Math.floor(.5 * height) - 120 * scale - , center = Math.floor(.5 * width) - , urlParams = new URLSearchParams(window.location.search) - , url = window.location.href.split("?")[0]; - if (urlParams.has("size") && urlParams.delete("size"), - urlParams.has("host")) { - var value = urlParams.get("host"); - urlParams.delete("host"), - urlParams.append("join", value), - url += "?" + urlParams.toString(), - history.pushState && window.history.pushState({ - path: url - }, "", url) - } else - url = window.location.href; - var copyTextarea = document.querySelector(".js-copytextarea"); - copyTextarea.value = url; - var allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\\\"#%/()=+?[]{}<>@|$;" - , username = ""; - game.settings && "" != game.settings.username && null != game.settings.username && (username = game.settings.username); - var state = 0 - , canvas = document.createElement("canvas"); - canvas.width = width, - canvas.height = height; - var context = canvas.getContext("2d"); - context.imageSmoothingEnabled = false; - var div = document.getElementById("overlay"); - div.appendChild(canvas), - div.style.width = width + "px", - div.style.height = height + "px"; - var patternSize = 16 * patternScale - , patternCanvas = document.createElement("canvas"); - patternCanvas.width = patternSize, - patternCanvas.height = patternSize; - var patternContext = patternCanvas.getContext("2d"); - patternContext.imageSmoothingEnabled = false; - var loaded = 0 - , totalLoad = 3 - , checkLoading = function() { - ++loaded >= totalLoad && (patternContext.drawImage(bg, 0, 0, patternSize, patternSize), - patternContext.fillStyle = "rgba(0,0,0,0.7)", + var scale = 2, + buttonscale = scale + 1, + patternScale = 8, + width = window.innerWidth, + height = window.innerHeight, + mouseOverButton = null, + tickRate = 500, + lastTick = 0, + blinkCount = 0, + blinkCopy = false, + ypos = Math.floor(0.5 * height) - 120 * scale, + center = Math.floor(0.5 * width), + urlParams = new URLSearchParams(window.location.search), + url = window.location.href.split("?")[0]; + if ( + (urlParams.has("size") && urlParams.delete("size"), + urlParams.has("host")) + ) { + var value = urlParams.get("host"); + urlParams.delete("host"), + urlParams.append("join", value), + (url += "?" + urlParams.toString()), + history.pushState && + window.history.pushState( + { + path: url, + }, + "", + url + ); + } else url = window.location.href; + var copyTextarea = document.querySelector(".js-copytextarea"); + copyTextarea.value = url; + var allowedChars = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\\\"#%/()=+?[]{}<>@|$;", + username = ""; + game.settings && + "" != game.settings.username && + null != game.settings.username && + (username = game.settings.username); + var state = 0, + canvas = document.createElement("canvas"); + (canvas.width = width), (canvas.height = height); + var context = canvas.getContext("2d"); + context.imageSmoothingEnabled = false; + var div = document.getElementById("overlay"); + div.appendChild(canvas), + (div.style.width = width + "px"), + (div.style.height = height + "px"); + var patternSize = 16 * patternScale, + patternCanvas = document.createElement("canvas"); + (patternCanvas.width = patternSize), (patternCanvas.height = patternSize); + var patternContext = patternCanvas.getContext("2d"); + patternContext.imageSmoothingEnabled = false; + var loaded = 0, + totalLoad = 3, + checkLoading = function () { + ++loaded >= totalLoad && + (patternContext.drawImage(bg, 0, 0, patternSize, patternSize), + (patternContext.fillStyle = "rgba(0,0,0,0.7)"), patternContext.fillRect(0, 0, patternSize, patternSize), - pattern = context.createPattern(patternCanvas, "repeat"), - obj.redraw()) - } - , bg = new Image; - bg.onload = checkLoading, - bg.src = "assets/textures/dirt.png"; - var button = new Image; - button.onload = checkLoading, - button.src = "assets/textures/button.png"; - var button_over = new Image; - button_over.onload = checkLoading, - button_over.src = "assets/textures/button_over.png"; - var pattern = context.createPattern(patternCanvas, "repeat") - , drawText = function(e, t, i, n) { - context.font = 12 * scale + "px Minecraft", - context.textBaseline = "alphabetic", - context.textAlign = "center"; - var r = 2 * scale; - context.fillStyle = "rgb(63,63,63)", + (pattern = context.createPattern(patternCanvas, "repeat")), + obj.redraw()); + }, + bg = new Image(); + (bg.onload = checkLoading), (bg.src = "assets/textures/dirt.png"); + var button = new Image(); + (button.onload = checkLoading), + (button.src = "assets/textures/button.png"); + var button_over = new Image(); + (button_over.onload = checkLoading), + (button_over.src = "assets/textures/button_over.png"); + var pattern = context.createPattern(patternCanvas, "repeat"), + drawText = function (e, t, i, n) { + (context.font = 12 * scale + "px Minecraft"), + (context.textBaseline = "alphabetic"), + (context.textAlign = "center"); + var r = 2 * scale; + (context.fillStyle = "rgb(63,63,63)"), context.fillText(e, t + r, i + r), - context.fillStyle = n || "rgb(255,255,255)", - context.fillText(e, t, i) - } - , makeButton = function(e, t, i, n) { - return { - str: e, - x: t, - y: i, - over: false, - func: n, - widthscale: 1, - key: null, - draw: function() { - this.widthscale < 1 && (context.fillStyle = "rgba(0,0,0,1)", - context.fillRect(center - scale + this.x * scale - .5 * button.width * buttonscale * this.widthscale, ypos + this.y * scale, 2 * scale + button.width * buttonscale * this.widthscale, button.height * buttonscale)); - var e = button; - this.over && (e = button_over), - context.drawImage(e, center + this.x * scale - .5 * button.width * buttonscale * this.widthscale, ypos + this.y * scale, button.width * buttonscale * this.widthscale, button.height * buttonscale); - var t = "rgb(255,255,255)"; - this.over && (t = "rgb(255,255,160)"), - drawText(this.str, center + this.x * scale, ypos + this.y * scale + 19 * scale, t) - } - } - }; - function submitUsername() { - var e = username.trim(); - e !== game.hostInfo.hostName && e.length > 0 && (game.settings.username = e, - game.emit("saveSettings"), - game.setName(e), - obj.hide()) - } - function copyUrl() { - var e = document.querySelector(".js-copytextarea"); - e.focus(), - e.select(), - blinkCopy = true, - obj.redraw(), - setTimeout(function() { - blinkCopy = false, - obj.redraw() - }, 250); - try { - document.execCommand("copy") - } catch (e) {} - } - function newGame() { - var e = window.location.href.split("?")[0]; - window.location.href = e - } - function takeOverHost() { - var e = window.location.href.split("?")[0]; - window.location.href = e - } - function newGameWebrtc() { - obj.show(0) - } - var startButtonHost = makeButton("Start", 78, 170, submitUsername); - startButtonHost.widthscale = .5; - var startButtonClient = makeButton("Start", 0, 130, submitUsername) - , copyButton = makeButton("Copy", 0, 80, copyUrl) - , copyButtonHidden = makeButton("Copy Hidden", 0, 40, copyUrl) - , newgameButton = makeButton("Launch a new game", 0, 130, newGame) - , newgameHostButton = makeButton("Relaunch the game as a host", 0, 120, takeOverHost) - , newgameButtonNoWebrtc = makeButton("Launch a new game", 0, 130, newGameWebrtc) - , array0 = [startButtonHost, copyButton, copyButtonHidden] - , array1 = [startButtonClient] - , array2 = [newgameButton] - , array3 = [newgameHostButton] - , array4 = [newgameButton] - , array5 = [newgameButton] - , array6 = [newgameButtonNoWebrtc] - , activeArray = array1 - , obj = { - isOpen: true, - show: function show(openState) { - state = openState, - 1 != state || obj.isWebRTCSupported || (state = 6), - activeArray = eval("array" + state), - document.addEventListener("keypress", obj.keypress, false), - document.addEventListener("keydown", obj.keydown, false), - div.addEventListener("mousemove", this.mousemove, false), - document.addEventListener("mousedown", this.press, false), - obj.isOpen = true, - obj.redraw(), - div.style.display = "block", - document.exitPointerLock(), - game.inputs && (game.inputs.state.active = false) - }, - hide: function() { - document.removeEventListener("keypress", obj.keypress), - document.removeEventListener("keydown", obj.keydown), - div.removeEventListener("mousemove", this.mousemove), - document.removeEventListener("mousedown", this.press), - obj.isOpen = false, - div.style.display = "none"; - var e = document.getElementById("noa-container"); - setTimeout(function() { - null != e && e.requestPointerLock() - }, 200), - game.inputs && (game.inputs.state.active = true) - }, - mousemove: function(e) { - for (var t = e.layerX, i = e.layerY, n = null, r = 0; r < activeArray.length; r++) { - var o = activeArray[r] - , a = center + o.x * scale - .5 * button.width * buttonscale * o.widthscale - , s = ypos + o.y * scale - , c = a + button.width * buttonscale * o.widthscale - , u = s + button.height * buttonscale; - if (t > a && t < c && i > s && i < u) { - n = r; - break - } - } - null != n && n != mouseOverButton && (activeArray[n].over = true, - obj.redraw()), - null == n && null != mouseOverButton && (activeArray[mouseOverButton].over = false, - obj.redraw()), - mouseOverButton = n - }, - press: function(e) { - if (null != activeArray[mouseOverButton]) { - var t = activeArray[mouseOverButton].func; - null != t && t() - } - }, - keydown: function(e) { - 13 != e.keyCode ? (8 == e.keyCode && username.length > 0 && (username = username.substring(0, username.length - 1)), - obj.redraw()) : submitUsername() - }, - keypress: function(e) { - var t = e.key; - allowedChars.indexOf(t) >= 0 && username.length < 32 && (username += t), - obj.redraw() - }, - tick: function() { - var e = performance.now(); - e < lastTick + tickRate || (blinkCount++, - obj.redraw(), - lastTick = e) - }, - redraw: function() { - context.clearRect(0, 0, width, height), - state <= 1 || 3 == state ? (context.fillStyle = "rgba(0,0,0,0.6)", - context.fillRect(0, 0, width, height)) : (context.fillStyle = pattern, - context.fillRect(0, 0, width, height)), - context.font = 14 * scale + "px Minecraft, sans-serif", - context.textBaseline = "alphabetic", - context.textAlign = "center", - context.strokeStyle = "rgba(255,255,255,1)", - context.lineWidth = scale; - var e = 0; - if (0 == state) { - if (drawText("Game generated!", center, ypos - 10 * scale), - obj.isWebRTCSupported) { - drawText("You are the host. You can invite some (" + (game.hostInfo.maxPlayers - 1) + ") friends to join you.", center, ypos + 24 * scale); - var t = 300 * scale - , i = 30 * scale; - copyButtonHidden.draw(), - context.fillStyle = "rgba(0,0,0,1)", - blinkCopy && (context.fillStyle = "rgba(127,127,127,1)"), - context.fillRect(.5 * width - .5 * t, .5 * height - 80 * scale, t, i), - context.save(), - context.rect(.5 * width - .5 * t, .5 * height - 80 * scale, t, i), - context.clip(), - drawText(url, center, ypos + 60 * scale), - context.restore(), - context.strokeRect(.5 * width - .5 * t, .5 * height - 80 * scale, t, i), - copyButton.draw(), - e = 40 * scale - } else - drawText("Your current browser does not have support for WebRTC.", center, ypos + 24 * scale), - drawText("That means you can only play in single player mode.", center, ypos + 41 * scale), - drawText("Please use another browser to play multiplayer,", center, ypos + 58 * scale), - startButtonHost.y = 130; - drawText("Pick a username and start the game.", center, ypos + 115 * scale + e); - t = 150 * scale, - i = 30 * scale; - var n = -78 * scale; - context.fillStyle = "rgba(0,0,0,1)", - context.fillRect(n + .5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), - context.save(), - context.rect(n + .5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), - context.clip(), - drawText(username, center + n, ypos + 150 * scale + e); - var r = context.measureText(username).width; - blinkCount % 2 == 0 && (context.fillStyle = "rgba(255,255,255,1)", - context.fillRect(n + center + .5 * r, ypos + 135 * scale + e, scale, 20 * scale)), - context.restore(), - context.strokeRect(.5 * width - .5 * t + n, .5 * height + 10 * scale + e, t, i), - startButtonHost.draw(), - drawText("Left click to place or mine blocks (right click to toggle).", center, ypos + 190 * scale + e) - } - if (1 == state) { - var o = "Welcome!"; - "temp" != game.hostInfo.hostName && (o = 'Welcome to "' + game.hostInfo.hostName + '".'), - drawText(o, center, ypos + 0 * scale), - drawText(" You are player " + game.hostInfo.playerCount + " of " + game.hostInfo.maxPlayers + ".", center, ypos + 17 * scale), - drawText("Pick a username and start the game.", center, ypos + 115 * scale + (e = -40 * scale)); - t = 300 * scale, - i = 30 * scale; - context.fillStyle = "rgba(0,0,0,1)", - context.fillRect(.5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), - context.save(), - context.rect(.5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), - context.clip(), - drawText(username, center, ypos + 150 * scale + e); - r = context.measureText(username).width; - blinkCount % 2 == 0 && (context.fillStyle = "rgba(255,255,255,1)", - context.fillRect(center + .5 * r, ypos + 135 * scale + e, scale, 20 * scale)), - context.restore(), - context.strokeRect(.5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), - startButtonClient.draw(), - drawText("Left click to place or mine blocks (right click to toggle).", center, ypos + 240 * scale + e) - } - 2 == state && (drawText("The game you are trying to join is full.", center, ypos + 88 * scale), - drawText("Come back later or host you own game.", center, ypos + 105 * scale), - newgameButton.draw()), - 3 == state && (drawText("The End!", center, ypos + 4 * scale), - drawText("The host left the game.", center, ypos + 38 * scale), - drawText("If you launch a new game you will become the host and be able to", center, ypos + 75 * scale), - drawText("invite friends. The new game will be based on this world.", center, ypos + 92 * scale), - newgameHostButton.draw()), - 4 == state && (drawText("The game you are trying to join doesn't exist.", center, ypos + 88 * scale), - drawText("You can still host a new game and invite your friends.", center, ypos + 105 * scale), - newgameButton.draw()), - 5 == state && (drawText("You were kicked!", center, ypos + 88 * scale), - drawText("You can host a new game and invite your own friends.", center, ypos + 105 * scale), - newgameButton.draw()), - 6 == state && (drawText("Your current browser does not have support for WebRTC.", center, ypos + 71 * scale), - drawText("If you want to join a game, please use another browser.", center, ypos + 88 * scale), - drawText("Or you can launch a single player game.", center, ypos + 105 * scale), - newgameButtonNoWebrtc.draw()) - }, - resize: function() { - scale = 2, - window.innerHeight < 600 && (scale = 1), - buttonscale = 1.5 * scale, - width = window.innerWidth, - height = window.innerHeight, - center = Math.floor(.5 * width), - ypos = Math.floor(.5 * height) - 120 * scale, - canvas.width = width, - canvas.height = height, - div.style.width = width + "px", - div.style.height = height + "px", - context.imageSmoothingEnabled = false, - obj.redraw() - }, - isWebRTCSupported: false + (context.fillStyle = n || "rgb(255,255,255)"), + context.fillText(e, t, i); + }, + makeButton = function (e, t, i, n) { + return { + str: e, + x: t, + y: i, + over: false, + func: n, + widthscale: 1, + key: null, + draw: function () { + this.widthscale < 1 && + ((context.fillStyle = "rgba(0,0,0,1)"), + context.fillRect( + center - + scale + + this.x * scale - + 0.5 * button.width * buttonscale * this.widthscale, + ypos + this.y * scale, + 2 * scale + button.width * buttonscale * this.widthscale, + button.height * buttonscale + )); + var e = button; + this.over && (e = button_over), + context.drawImage( + e, + center + + this.x * scale - + 0.5 * button.width * buttonscale * this.widthscale, + ypos + this.y * scale, + button.width * buttonscale * this.widthscale, + button.height * buttonscale + ); + var t = "rgb(255,255,255)"; + this.over && (t = "rgb(255,255,160)"), + drawText( + this.str, + center + this.x * scale, + ypos + this.y * scale + 19 * scale, + t + ); + }, + }; }; + function submitUsername() { + var e = username.trim(); + e !== game.hostInfo.hostName && + e.length > 0 && + ((game.settings.username = e), + game.emit("saveSettings"), + game.setName(e), + obj.hide()); + } + function copyUrl() { + var e = document.querySelector(".js-copytextarea"); + e.focus(), + e.select(), + (blinkCopy = true), + obj.redraw(), + setTimeout(function () { + (blinkCopy = false), obj.redraw(); + }, 250); try { - var remoteConnection = new RTCPeerConnection; - remoteConnection.ondatachannel = function(e) {} - , - obj.isWebRTCSupported = true + document.execCommand("copy"); } catch (e) {} - return obj.hide(), - obj + } + function newGame() { + var e = window.location.href.split("?")[0]; + window.location.href = e; + } + function takeOverHost() { + var e = window.location.href.split("?")[0]; + window.location.href = e; + } + function newGameWebrtc() { + obj.show(0); + } + var startButtonHost = makeButton("Start", 78, 170, submitUsername); + startButtonHost.widthscale = 0.5; + var startButtonClient = makeButton("Start", 0, 130, submitUsername), + copyButton = makeButton("Copy", 0, 80, copyUrl), + copyButtonHidden = makeButton("Copy Hidden", 0, 40, copyUrl), + newgameButton = makeButton("Launch a new game", 0, 130, newGame), + newgameHostButton = makeButton( + "Relaunch the game as a host", + 0, + 120, + takeOverHost + ), + newgameButtonNoWebrtc = makeButton( + "Launch a new game", + 0, + 130, + newGameWebrtc + ), + array0 = [startButtonHost, copyButton, copyButtonHidden], + array1 = [startButtonClient], + array2 = [newgameButton], + array3 = [newgameHostButton], + array4 = [newgameButton], + array5 = [newgameButton], + array6 = [newgameButtonNoWebrtc], + activeArray = array1, + obj = { + isOpen: true, + show: function show(openState) { + (state = openState), + 1 != state || obj.isWebRTCSupported || (state = 6), + (activeArray = eval("array" + state)), + document.addEventListener("keypress", obj.keypress, false), + document.addEventListener("keydown", obj.keydown, false), + div.addEventListener("mousemove", this.mousemove, false), + document.addEventListener("mousedown", this.press, false), + (obj.isOpen = true), + obj.redraw(), + (div.style.display = "block"), + document.exitPointerLock(), + game.inputs && (game.inputs.state.active = false); + }, + hide: function () { + document.removeEventListener("keypress", obj.keypress), + document.removeEventListener("keydown", obj.keydown), + div.removeEventListener("mousemove", this.mousemove), + document.removeEventListener("mousedown", this.press), + (obj.isOpen = false), + (div.style.display = "none"); + var e = document.getElementById("noa-container"); + setTimeout(function () { + null != e && e.requestPointerLock(); + }, 200), + game.inputs && (game.inputs.state.active = true); + }, + mousemove: function (e) { + for ( + var t = e.layerX, i = e.layerY, n = null, r = 0; + r < activeArray.length; + r++ + ) { + var o = activeArray[r], + a = + center + + o.x * scale - + 0.5 * button.width * buttonscale * o.widthscale, + s = ypos + o.y * scale, + c = a + button.width * buttonscale * o.widthscale, + u = s + button.height * buttonscale; + if (t > a && t < c && i > s && i < u) { + n = r; + break; + } + } + null != n && + n != mouseOverButton && + ((activeArray[n].over = true), obj.redraw()), + null == n && + null != mouseOverButton && + ((activeArray[mouseOverButton].over = false), obj.redraw()), + (mouseOverButton = n); + }, + press: function (e) { + if (null != activeArray[mouseOverButton]) { + var t = activeArray[mouseOverButton].func; + null != t && t(); + } + }, + keydown: function (e) { + 13 != e.keyCode + ? (8 == e.keyCode && + username.length > 0 && + (username = username.substring(0, username.length - 1)), + obj.redraw()) + : submitUsername(); + }, + keypress: function (e) { + var t = e.key; + allowedChars.indexOf(t) >= 0 && + username.length < 32 && + (username += t), + obj.redraw(); + }, + tick: function () { + var e = performance.now(); + e < lastTick + tickRate || + (blinkCount++, obj.redraw(), (lastTick = e)); + }, + redraw: function () { + context.clearRect(0, 0, width, height), + state <= 1 || 3 == state + ? ((context.fillStyle = "rgba(0,0,0,0.6)"), + context.fillRect(0, 0, width, height)) + : ((context.fillStyle = pattern), + context.fillRect(0, 0, width, height)), + (context.font = 14 * scale + "px Minecraft, sans-serif"), + (context.textBaseline = "alphabetic"), + (context.textAlign = "center"), + (context.strokeStyle = "rgba(255,255,255,1)"), + (context.lineWidth = scale); + var e = 0; + if (0 == state) { + if ( + (drawText("Game generated!", center, ypos - 10 * scale), + obj.isWebRTCSupported) + ) { + drawText( + "You are the host. You can invite some (" + + (game.hostInfo.maxPlayers - 1) + + ") friends to join you.", + center, + ypos + 24 * scale + ); + var t = 300 * scale, + i = 30 * scale; + copyButtonHidden.draw(), + (context.fillStyle = "rgba(0,0,0,1)"), + blinkCopy && (context.fillStyle = "rgba(127,127,127,1)"), + context.fillRect( + 0.5 * width - 0.5 * t, + 0.5 * height - 80 * scale, + t, + i + ), + context.save(), + context.rect( + 0.5 * width - 0.5 * t, + 0.5 * height - 80 * scale, + t, + i + ), + context.clip(), + drawText(url, center, ypos + 60 * scale), + context.restore(), + context.strokeRect( + 0.5 * width - 0.5 * t, + 0.5 * height - 80 * scale, + t, + i + ), + copyButton.draw(), + (e = 40 * scale); + } else + drawText( + "Your current browser does not have support for WebRTC.", + center, + ypos + 24 * scale + ), + drawText( + "That means you can only play in single player mode.", + center, + ypos + 41 * scale + ), + drawText( + "Please use another browser to play multiplayer,", + center, + ypos + 58 * scale + ), + (startButtonHost.y = 130); + drawText( + "Pick a username and start the game.", + center, + ypos + 115 * scale + e + ); + (t = 150 * scale), (i = 30 * scale); + var n = -78 * scale; + (context.fillStyle = "rgba(0,0,0,1)"), + context.fillRect( + n + 0.5 * width - 0.5 * t, + 0.5 * height + 10 * scale + e, + t, + i + ), + context.save(), + context.rect( + n + 0.5 * width - 0.5 * t, + 0.5 * height + 10 * scale + e, + t, + i + ), + context.clip(), + drawText(username, center + n, ypos + 150 * scale + e); + var r = context.measureText(username).width; + blinkCount % 2 == 0 && + ((context.fillStyle = "rgba(255,255,255,1)"), + context.fillRect( + n + center + 0.5 * r, + ypos + 135 * scale + e, + scale, + 20 * scale + )), + context.restore(), + context.strokeRect( + 0.5 * width - 0.5 * t + n, + 0.5 * height + 10 * scale + e, + t, + i + ), + startButtonHost.draw(), + drawText( + "Left click to place or mine blocks (right click to toggle).", + center, + ypos + 190 * scale + e + ); + } + if (1 == state) { + var o = "Welcome!"; + "temp" != game.hostInfo.hostName && + (o = 'Welcome to "' + game.hostInfo.hostName + '".'), + drawText(o, center, ypos + 0 * scale), + drawText( + " You are player " + + game.hostInfo.playerCount + + " of " + + game.hostInfo.maxPlayers + + ".", + center, + ypos + 17 * scale + ), + drawText( + "Pick a username and start the game.", + center, + ypos + 115 * scale + (e = -40 * scale) + ); + (t = 300 * scale), (i = 30 * scale); + (context.fillStyle = "rgba(0,0,0,1)"), + context.fillRect( + 0.5 * width - 0.5 * t, + 0.5 * height + 10 * scale + e, + t, + i + ), + context.save(), + context.rect( + 0.5 * width - 0.5 * t, + 0.5 * height + 10 * scale + e, + t, + i + ), + context.clip(), + drawText(username, center, ypos + 150 * scale + e); + r = context.measureText(username).width; + blinkCount % 2 == 0 && + ((context.fillStyle = "rgba(255,255,255,1)"), + context.fillRect( + center + 0.5 * r, + ypos + 135 * scale + e, + scale, + 20 * scale + )), + context.restore(), + context.strokeRect( + 0.5 * width - 0.5 * t, + 0.5 * height + 10 * scale + e, + t, + i + ), + startButtonClient.draw(), + drawText( + "Left click to place or mine blocks (right click to toggle).", + center, + ypos + 240 * scale + e + ); + } + 2 == state && + (drawText( + "The game you are trying to join is full.", + center, + ypos + 88 * scale + ), + drawText( + "Come back later or host you own game.", + center, + ypos + 105 * scale + ), + newgameButton.draw()), + 3 == state && + (drawText("The End!", center, ypos + 4 * scale), + drawText("The host left the game.", center, ypos + 38 * scale), + drawText( + "If you launch a new game you will become the host and be able to", + center, + ypos + 75 * scale + ), + drawText( + "invite friends. The new game will be based on this world.", + center, + ypos + 92 * scale + ), + newgameHostButton.draw()), + 4 == state && + (drawText( + "The game you are trying to join doesn't exist.", + center, + ypos + 88 * scale + ), + drawText( + "You can still host a new game and invite your friends.", + center, + ypos + 105 * scale + ), + newgameButton.draw()), + 5 == state && + (drawText("You were kicked!", center, ypos + 88 * scale), + drawText( + "You can host a new game and invite your own friends.", + center, + ypos + 105 * scale + ), + newgameButton.draw()), + 6 == state && + (drawText( + "Your current browser does not have support for WebRTC.", + center, + ypos + 71 * scale + ), + drawText( + "If you want to join a game, please use another browser.", + center, + ypos + 88 * scale + ), + drawText( + "Or you can launch a single player game.", + center, + ypos + 105 * scale + ), + newgameButtonNoWebrtc.draw()); + }, + resize: function () { + (scale = 2), + window.innerHeight < 600 && (scale = 1), + (buttonscale = 1.5 * scale), + (width = window.innerWidth), + (height = window.innerHeight), + (center = Math.floor(0.5 * width)), + (ypos = Math.floor(0.5 * height) - 120 * scale), + (canvas.width = width), + (canvas.height = height), + (div.style.width = width + "px"), + (div.style.height = height + "px"), + (context.imageSmoothingEnabled = false), + obj.redraw(); + }, + isWebRTCSupported: false, + }; + try { + var remoteConnection = new RTCPeerConnection(); + (remoteConnection.ondatachannel = function (e) {}), + (obj.isWebRTCSupported = true); + } catch (e) {} + return obj.hide(), obj; } - module.exports = function(e) { - return overlay(e) - } -} -, function(e, t, i) { + module.exports = function (e) { + return overlay(e); + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - var t = e.rendering._scene - , i = new BABYLON.StandardMaterial("head",t) - , n = new BABYLON.Texture("assets/textures/stevehead.png",t,true,false,BABYLON.Texture.NEAREST_SAMPLINGMODE); - i.diffuseTexture = n, - i.specularColor = new BABYLON.Color3(0,0,0); - for (var r = new Array(6), o = 0; o < 6; o++) - r[o] = new BABYLON.Vector4(o / 8,0,(o + 1) / 8,1); - var a = { - width: .45, - height: .45, - depth: .45, - faceUV: r - } - , s = BABYLON.MeshBuilder.CreateBox("head", a, t); - s.material = i, - s.rotate(BABYLON.Axis.Y, Math.PI, BABYLON.Space.WORLD); - var c = new BABYLON.StandardMaterial("torso",t); - n = new BABYLON.Texture("assets/textures/stevetorso.png",t,true,false,BABYLON.Texture.NEAREST_SAMPLINGMODE); - c.diffuseTexture = n, - c.specularColor = new BABYLON.Color3(0,0,0); - for (r = new Array(6), - o = 0; o < 6; o++) - r[o] = new BABYLON.Vector4(o / 8,0,(o + 1) / 8,1); - a = { - width: .45, - height: .675, - depth: .225, - faceUV: r - }; - var u = BABYLON.MeshBuilder.CreateBox("torso", a, t); - u.material = c; - var l = new BABYLON.StandardMaterial("arm",t); - n = new BABYLON.Texture("assets/textures/stevearm.png",t,true,false,BABYLON.Texture.NEAREST_SAMPLINGMODE); - l.diffuseTexture = n, - l.specularColor = new BABYLON.Color3(0,0,0); - for (r = new Array(6), - o = 0; o < 6; o++) - r[o] = new BABYLON.Vector4(o / 8,0,(o + 1) / 8,1); - a = { - width: .225, - height: .675, - depth: .225, - faceUV: r - }; - var h = BABYLON.MeshBuilder.CreateBox("leftArm", a, t); - h.material = l; - var f = BABYLON.MeshBuilder.CreateBox("rightLeg", a, t); - f.material = l; - var d = new BABYLON.StandardMaterial("leg",t); - n = new BABYLON.Texture("assets/textures/steveleg.png",t,true,false,BABYLON.Texture.NEAREST_SAMPLINGMODE); - d.diffuseTexture = n, - d.specularColor = new BABYLON.Color3(0,0,0); - for (r = new Array(6), - o = 0; o < 6; o++) - r[o] = new BABYLON.Vector4(o / 8,0,(o + 1) / 8,1); - a = { - width: .225, - height: .675, - depth: .225, - faceUV: r - }; - var p = BABYLON.MeshBuilder.CreateBox("leftLeg", a, t); - p.material = d; - var m = BABYLON.MeshBuilder.CreateBox("rightLeg", a, t); - m.material = d, - h.setPivotPoint(new BABYLON.Vector3(0,.225,0)), - f.setPivotPoint(new BABYLON.Vector3(0,.225,0)), - p.setPivotPoint(new BABYLON.Vector3(0,.3375,0)), - m.setPivotPoint(new BABYLON.Vector3(0,.3375,0)), - s.parent = u, - p.parent = u, - m.parent = u, - h.parent = u, - f.parent = u, - s.position = new BABYLON.Vector3(0,.5625,0), - p.position = new BABYLON.Vector3(.1125,-.3375,0), - m.position = new BABYLON.Vector3(-.1125,-.3375,0), - h.position = new BABYLON.Vector3(.3375,.225,0), - f.position = new BABYLON.Vector3(-.3375,.225,0); - var g = 0 - , _ = 0 - , v = 0; - return u.walking = true, - u.animate = function(e) { - var t = .01 * (g += e) - , i = 5e-4 * g - , n = 65e-5 * g - , r = 1.2 - , o = 1; - this.walking || (r = 0, - o = 0), - _ += (r - _) / 4, - v += (o - v) / 4, - p.rotation.x = Math.sin(t) * _, - m.rotation.x = -Math.sin(t) * _, - h.rotation.x = -Math.sin(t) * _, - f.rotation.x = Math.sin(t) * _, - h.rotation.z = Math.abs(Math.sin(i)) * v, - f.rotation.z = -Math.abs(Math.sin(n)) * v - } - , + e.exports = function (e) { + var t = e.rendering._scene, + i = new BABYLON.StandardMaterial("head", t), + n = new BABYLON.Texture( + "assets/textures/stevehead.png", + t, + true, + false, + BABYLON.Texture.NEAREST_SAMPLINGMODE + ); + (i.diffuseTexture = n), (i.specularColor = new BABYLON.Color3(0, 0, 0)); + for (var r = new Array(6), o = 0; o < 6; o++) + r[o] = new BABYLON.Vector4(o / 8, 0, (o + 1) / 8, 1); + var a = { + width: 0.45, + height: 0.45, + depth: 0.45, + faceUV: r, + }, + s = BABYLON.MeshBuilder.CreateBox("head", a, t); + (s.material = i), s.rotate(BABYLON.Axis.Y, Math.PI, BABYLON.Space.WORLD); + var c = new BABYLON.StandardMaterial("torso", t); + n = new BABYLON.Texture( + "assets/textures/stevetorso.png", + t, + true, + false, + BABYLON.Texture.NEAREST_SAMPLINGMODE + ); + (c.diffuseTexture = n), (c.specularColor = new BABYLON.Color3(0, 0, 0)); + for (r = new Array(6), o = 0; o < 6; o++) + r[o] = new BABYLON.Vector4(o / 8, 0, (o + 1) / 8, 1); + a = { + width: 0.45, + height: 0.675, + depth: 0.225, + faceUV: r, + }; + var u = BABYLON.MeshBuilder.CreateBox("torso", a, t); + u.material = c; + var l = new BABYLON.StandardMaterial("arm", t); + n = new BABYLON.Texture( + "assets/textures/stevearm.png", + t, + true, + false, + BABYLON.Texture.NEAREST_SAMPLINGMODE + ); + (l.diffuseTexture = n), (l.specularColor = new BABYLON.Color3(0, 0, 0)); + for (r = new Array(6), o = 0; o < 6; o++) + r[o] = new BABYLON.Vector4(o / 8, 0, (o + 1) / 8, 1); + a = { + width: 0.225, + height: 0.675, + depth: 0.225, + faceUV: r, + }; + var h = BABYLON.MeshBuilder.CreateBox("leftArm", a, t); + h.material = l; + var f = BABYLON.MeshBuilder.CreateBox("rightLeg", a, t); + f.material = l; + var d = new BABYLON.StandardMaterial("leg", t); + n = new BABYLON.Texture( + "assets/textures/steveleg.png", + t, + true, + false, + BABYLON.Texture.NEAREST_SAMPLINGMODE + ); + (d.diffuseTexture = n), (d.specularColor = new BABYLON.Color3(0, 0, 0)); + for (r = new Array(6), o = 0; o < 6; o++) + r[o] = new BABYLON.Vector4(o / 8, 0, (o + 1) / 8, 1); + a = { + width: 0.225, + height: 0.675, + depth: 0.225, + faceUV: r, + }; + var p = BABYLON.MeshBuilder.CreateBox("leftLeg", a, t); + p.material = d; + var m = BABYLON.MeshBuilder.CreateBox("rightLeg", a, t); + (m.material = d), + h.setPivotPoint(new BABYLON.Vector3(0, 0.225, 0)), + f.setPivotPoint(new BABYLON.Vector3(0, 0.225, 0)), + p.setPivotPoint(new BABYLON.Vector3(0, 0.3375, 0)), + m.setPivotPoint(new BABYLON.Vector3(0, 0.3375, 0)), + (s.parent = u), + (p.parent = u), + (m.parent = u), + (h.parent = u), + (f.parent = u), + (s.position = new BABYLON.Vector3(0, 0.5625, 0)), + (p.position = new BABYLON.Vector3(0.1125, -0.3375, 0)), + (m.position = new BABYLON.Vector3(-0.1125, -0.3375, 0)), + (h.position = new BABYLON.Vector3(0.3375, 0.225, 0)), + (f.position = new BABYLON.Vector3(-0.3375, 0.225, 0)); + var g = 0, + _ = 0, + v = 0; + return ( + (u.walking = true), + (u.animate = function (e) { + var t = 0.01 * (g += e), + i = 5e-4 * g, + n = 65e-5 * g, + r = 1.2, + o = 1; + this.walking || ((r = 0), (o = 0)), + (_ += (r - _) / 4), + (v += (o - v) / 4), + (p.rotation.x = Math.sin(t) * _), + (m.rotation.x = -Math.sin(t) * _), + (h.rotation.x = -Math.sin(t) * _), + (f.rotation.x = Math.sin(t) * _), + (h.rotation.z = Math.abs(Math.sin(i)) * v), + (f.rotation.z = -Math.abs(Math.sin(n)) * v); + }), u - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; - var n = i(2).Buffer - , r = i(128).Transform; + var n = i(2).Buffer, + r = i(128).Transform; function o(e) { - r.call(this), - this._block = n.allocUnsafe(e), - this._blockSize = e, - this._blockOffset = 0, - this._length = [0, 0, 0, 0], - this._finalized = false + r.call(this), + (this._block = n.allocUnsafe(e)), + (this._blockSize = e), + (this._blockOffset = 0), + (this._length = [0, 0, 0, 0]), + (this._finalized = false); } i(1)(o, r), - o.prototype._transform = function(e, t, i) { + (o.prototype._transform = function (e, t, i) { var n = null; try { - this.update(e, t) + this.update(e, t); } catch (e) { - n = e + n = e; } - i(n) - } - , - o.prototype._flush = function(e) { + i(n); + }), + (o.prototype._flush = function (e) { var t = null; try { - this.push(this.digest()) + this.push(this.digest()); } catch (e) { - t = e + t = e; } - e(t) - } - , - o.prototype.update = function(e, t) { - if (function(e, t) { + e(t); + }), + (o.prototype.update = function (e, t) { + if ( + ((function (e, t) { if (!n.isBuffer(e) && "string" != typeof e) - throw new TypeError(t + " must be a string or a buffer") - }(e, "Data"), - this._finalized) - throw new Error("Digest already called"); + throw new TypeError(t + " must be a string or a buffer"); + })(e, "Data"), + this._finalized) + ) + throw new Error("Digest already called"); n.isBuffer(e) || (e = n.from(e, t)); - for (var i = this._block, r = 0; this._blockOffset + e.length - r >= this._blockSize; ) { - for (var o = this._blockOffset; o < this._blockSize; ) - i[o++] = e[r++]; - this._update(), - this._blockOffset = 0 + for ( + var i = this._block, r = 0; + this._blockOffset + e.length - r >= this._blockSize; + + ) { + for (var o = this._blockOffset; o < this._blockSize; ) + i[o++] = e[r++]; + this._update(), (this._blockOffset = 0); } - for (; r < e.length; ) - i[this._blockOffset++] = e[r++]; + for (; r < e.length; ) i[this._blockOffset++] = e[r++]; for (var a = 0, s = 8 * e.length; s > 0; ++a) - this._length[a] += s, - (s = this._length[a] / 4294967296 | 0) > 0 && (this._length[a] -= 4294967296 * s); - return this - } - , - o.prototype._update = function() { - throw new Error("_update is not implemented") - } - , - o.prototype.digest = function(e) { - if (this._finalized) - throw new Error("Digest already called"); + (this._length[a] += s), + (s = (this._length[a] / 4294967296) | 0) > 0 && + (this._length[a] -= 4294967296 * s); + return this; + }), + (o.prototype._update = function () { + throw new Error("_update is not implemented"); + }), + (o.prototype.digest = function (e) { + if (this._finalized) throw new Error("Digest already called"); this._finalized = true; var t = this._digest(); void 0 !== e && (t = t.toString(e)), - this._block.fill(0), - this._blockOffset = 0; - for (var i = 0; i < 4; ++i) - this._length[i] = 0; - return t - } - , - o.prototype._digest = function() { - throw new Error("_digest is not implemented") - } - , - e.exports = o -} -, function(e, t, i) { - var n = i(1) - , r = i(63) - , o = i(2).Buffer - , a = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298] - , s = new Array(64); + this._block.fill(0), + (this._blockOffset = 0); + for (var i = 0; i < 4; ++i) this._length[i] = 0; + return t; + }), + (o.prototype._digest = function () { + throw new Error("_digest is not implemented"); + }), + (e.exports = o); + }, + function (e, t, i) { + var n = i(1), + r = i(63), + o = i(2).Buffer, + a = [ + 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, + 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, + 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, + 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, + 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, + 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, + 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, + 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, + 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, + 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, + 2428436474, 2756734187, 3204031479, 3329325298, + ], + s = new Array(64); function c() { - this.init(), - this._w = s, - r.call(this, 64, 56) + this.init(), (this._w = s), r.call(this, 64, 56); } function u(e, t, i) { - return i ^ e & (t ^ i) + return i ^ (e & (t ^ i)); } function l(e, t, i) { - return e & t | i & (e | t) + return (e & t) | (i & (e | t)); } function h(e) { - return (e >>> 2 | e << 30) ^ (e >>> 13 | e << 19) ^ (e >>> 22 | e << 10) + return ( + ((e >>> 2) | (e << 30)) ^ + ((e >>> 13) | (e << 19)) ^ + ((e >>> 22) | (e << 10)) + ); } function f(e) { - return (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7) + return ( + ((e >>> 6) | (e << 26)) ^ + ((e >>> 11) | (e << 21)) ^ + ((e >>> 25) | (e << 7)) + ); } function d(e) { - return (e >>> 7 | e << 25) ^ (e >>> 18 | e << 14) ^ e >>> 3 + return ((e >>> 7) | (e << 25)) ^ ((e >>> 18) | (e << 14)) ^ (e >>> 3); } n(c, r), - c.prototype.init = function() { - return this._a = 1779033703, - this._b = 3144134277, - this._c = 1013904242, - this._d = 2773480762, - this._e = 1359893119, - this._f = 2600822924, - this._g = 528734635, - this._h = 1541459225, - this - } - , - c.prototype._update = function(e) { - for (var t, i = this._w, n = 0 | this._a, r = 0 | this._b, o = 0 | this._c, s = 0 | this._d, c = 0 | this._e, p = 0 | this._f, m = 0 | this._g, g = 0 | this._h, _ = 0; _ < 16; ++_) - i[_] = e.readInt32BE(4 * _); + (c.prototype.init = function () { + return ( + (this._a = 1779033703), + (this._b = 3144134277), + (this._c = 1013904242), + (this._d = 2773480762), + (this._e = 1359893119), + (this._f = 2600822924), + (this._g = 528734635), + (this._h = 1541459225), + this + ); + }), + (c.prototype._update = function (e) { + for ( + var t, + i = this._w, + n = 0 | this._a, + r = 0 | this._b, + o = 0 | this._c, + s = 0 | this._d, + c = 0 | this._e, + p = 0 | this._f, + m = 0 | this._g, + g = 0 | this._h, + _ = 0; + _ < 16; + ++_ + ) + i[_] = e.readInt32BE(4 * _); for (; _ < 64; ++_) - i[_] = 0 | (((t = i[_ - 2]) >>> 17 | t << 15) ^ (t >>> 19 | t << 13) ^ t >>> 10) + i[_ - 7] + d(i[_ - 15]) + i[_ - 16]; + i[_] = + 0 | + (((((t = i[_ - 2]) >>> 17) | (t << 15)) ^ + ((t >>> 19) | (t << 13)) ^ + (t >>> 10)) + + i[_ - 7] + + d(i[_ - 15]) + + i[_ - 16]); for (var v = 0; v < 64; ++v) { - var y = g + f(c) + u(c, p, m) + a[v] + i[v] | 0 - , b = h(n) + l(n, r, o) | 0; - g = m, - m = p, - p = c, - c = s + y | 0, - s = o, - o = r, - r = n, - n = y + b | 0 + var y = (g + f(c) + u(c, p, m) + a[v] + i[v]) | 0, + b = (h(n) + l(n, r, o)) | 0; + (g = m), + (m = p), + (p = c), + (c = (s + y) | 0), + (s = o), + (o = r), + (r = n), + (n = (y + b) | 0); } - this._a = n + this._a | 0, - this._b = r + this._b | 0, - this._c = o + this._c | 0, - this._d = s + this._d | 0, - this._e = c + this._e | 0, - this._f = p + this._f | 0, - this._g = m + this._g | 0, - this._h = g + this._h | 0 - } - , - c.prototype._hash = function() { + (this._a = (n + this._a) | 0), + (this._b = (r + this._b) | 0), + (this._c = (o + this._c) | 0), + (this._d = (s + this._d) | 0), + (this._e = (c + this._e) | 0), + (this._f = (p + this._f) | 0), + (this._g = (m + this._g) | 0), + (this._h = (g + this._h) | 0); + }), + (c.prototype._hash = function () { var e = o.allocUnsafe(32); - return e.writeInt32BE(this._a, 0), - e.writeInt32BE(this._b, 4), - e.writeInt32BE(this._c, 8), - e.writeInt32BE(this._d, 12), - e.writeInt32BE(this._e, 16), - e.writeInt32BE(this._f, 20), - e.writeInt32BE(this._g, 24), - e.writeInt32BE(this._h, 28), - e - } - , - e.exports = c -} -, function(e, t, i) { - var n = i(1) - , r = i(63) - , o = i(2).Buffer - , a = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591] - , s = new Array(160); + return ( + e.writeInt32BE(this._a, 0), + e.writeInt32BE(this._b, 4), + e.writeInt32BE(this._c, 8), + e.writeInt32BE(this._d, 12), + e.writeInt32BE(this._e, 16), + e.writeInt32BE(this._f, 20), + e.writeInt32BE(this._g, 24), + e.writeInt32BE(this._h, 28), + e + ); + }), + (e.exports = c); + }, + function (e, t, i) { + var n = i(1), + r = i(63), + o = i(2).Buffer, + a = [ + 1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, + 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, + 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, + 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, + 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, + 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, + 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, + 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, + 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, + 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, + 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, + 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, + 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, + 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, + 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, + 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, + 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, + 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, + 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, + 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, + 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, + 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, + 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, + 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, + 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, + 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, + 1607167915, 987167468, 1816402316, 1246189591, + ], + s = new Array(160); function c() { - this.init(), - this._w = s, - r.call(this, 128, 112) + this.init(), (this._w = s), r.call(this, 128, 112); } function u(e, t, i) { - return i ^ e & (t ^ i) + return i ^ (e & (t ^ i)); } function l(e, t, i) { - return e & t | i & (e | t) + return (e & t) | (i & (e | t)); } function h(e, t) { - return (e >>> 28 | t << 4) ^ (t >>> 2 | e << 30) ^ (t >>> 7 | e << 25) + return ( + ((e >>> 28) | (t << 4)) ^ + ((t >>> 2) | (e << 30)) ^ + ((t >>> 7) | (e << 25)) + ); } function f(e, t) { - return (e >>> 14 | t << 18) ^ (e >>> 18 | t << 14) ^ (t >>> 9 | e << 23) + return ( + ((e >>> 14) | (t << 18)) ^ + ((e >>> 18) | (t << 14)) ^ + ((t >>> 9) | (e << 23)) + ); } function d(e, t) { - return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ e >>> 7 + return ((e >>> 1) | (t << 31)) ^ ((e >>> 8) | (t << 24)) ^ (e >>> 7); } function p(e, t) { - return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ (e >>> 7 | t << 25) + return ( + ((e >>> 1) | (t << 31)) ^ + ((e >>> 8) | (t << 24)) ^ + ((e >>> 7) | (t << 25)) + ); } function m(e, t) { - return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ e >>> 6 + return ((e >>> 19) | (t << 13)) ^ ((t >>> 29) | (e << 3)) ^ (e >>> 6); } function g(e, t) { - return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ (e >>> 6 | t << 26) + return ( + ((e >>> 19) | (t << 13)) ^ + ((t >>> 29) | (e << 3)) ^ + ((e >>> 6) | (t << 26)) + ); } function _(e, t) { - return e >>> 0 < t >>> 0 ? 1 : 0 + return e >>> 0 < t >>> 0 ? 1 : 0; } n(c, r), - c.prototype.init = function() { - return this._ah = 1779033703, - this._bh = 3144134277, - this._ch = 1013904242, - this._dh = 2773480762, - this._eh = 1359893119, - this._fh = 2600822924, - this._gh = 528734635, - this._hh = 1541459225, - this._al = 4089235720, - this._bl = 2227873595, - this._cl = 4271175723, - this._dl = 1595750129, - this._el = 2917565137, - this._fl = 725511199, - this._gl = 4215389547, - this._hl = 327033209, - this - } - , - c.prototype._update = function(e) { - for (var t = this._w, i = 0 | this._ah, n = 0 | this._bh, r = 0 | this._ch, o = 0 | this._dh, s = 0 | this._eh, c = 0 | this._fh, v = 0 | this._gh, y = 0 | this._hh, b = 0 | this._al, E = 0 | this._bl, T = 0 | this._cl, A = 0 | this._dl, x = 0 | this._el, S = 0 | this._fl, C = 0 | this._gl, P = 0 | this._hl, R = 0; R < 32; R += 2) - t[R] = e.readInt32BE(4 * R), - t[R + 1] = e.readInt32BE(4 * R + 4); + (c.prototype.init = function () { + return ( + (this._ah = 1779033703), + (this._bh = 3144134277), + (this._ch = 1013904242), + (this._dh = 2773480762), + (this._eh = 1359893119), + (this._fh = 2600822924), + (this._gh = 528734635), + (this._hh = 1541459225), + (this._al = 4089235720), + (this._bl = 2227873595), + (this._cl = 4271175723), + (this._dl = 1595750129), + (this._el = 2917565137), + (this._fl = 725511199), + (this._gl = 4215389547), + (this._hl = 327033209), + this + ); + }), + (c.prototype._update = function (e) { + for ( + var t = this._w, + i = 0 | this._ah, + n = 0 | this._bh, + r = 0 | this._ch, + o = 0 | this._dh, + s = 0 | this._eh, + c = 0 | this._fh, + v = 0 | this._gh, + y = 0 | this._hh, + b = 0 | this._al, + E = 0 | this._bl, + T = 0 | this._cl, + A = 0 | this._dl, + x = 0 | this._el, + S = 0 | this._fl, + C = 0 | this._gl, + P = 0 | this._hl, + R = 0; + R < 32; + R += 2 + ) + (t[R] = e.readInt32BE(4 * R)), (t[R + 1] = e.readInt32BE(4 * R + 4)); for (; R < 160; R += 2) { - var M = t[R - 30] - , O = t[R - 30 + 1] - , w = d(M, O) - , I = p(O, M) - , D = m(M = t[R - 4], O = t[R - 4 + 1]) - , L = g(O, M) - , F = t[R - 14] - , B = t[R - 14 + 1] - , N = t[R - 32] - , k = t[R - 32 + 1] - , U = I + B | 0 - , V = w + F + _(U, I) | 0; - V = (V = V + D + _(U = U + L | 0, L) | 0) + N + _(U = U + k | 0, k) | 0, - t[R] = V, - t[R + 1] = U + var M = t[R - 30], + O = t[R - 30 + 1], + w = d(M, O), + I = p(O, M), + D = m((M = t[R - 4]), (O = t[R - 4 + 1])), + L = g(O, M), + F = t[R - 14], + B = t[R - 14 + 1], + N = t[R - 32], + k = t[R - 32 + 1], + U = (I + B) | 0, + V = (w + F + _(U, I)) | 0; + (V = + ((V = (V + D + _((U = (U + L) | 0), L)) | 0) + + N + + _((U = (U + k) | 0), k)) | + 0), + (t[R] = V), + (t[R + 1] = U); } for (var G = 0; G < 160; G += 2) { - V = t[G], - U = t[G + 1]; - var z = l(i, n, r) - , j = l(b, E, T) - , H = h(i, b) - , W = h(b, i) - , X = f(s, x) - , Y = f(x, s) - , K = a[G] - , Q = a[G + 1] - , q = u(s, c, v) - , Z = u(x, S, C) - , J = P + Y | 0 - , $ = y + X + _(J, P) | 0; - $ = ($ = ($ = $ + q + _(J = J + Z | 0, Z) | 0) + K + _(J = J + Q | 0, Q) | 0) + V + _(J = J + U | 0, U) | 0; - var ee = W + j | 0 - , te = H + z + _(ee, W) | 0; - y = v, - P = C, - v = c, - C = S, - c = s, - S = x, - s = o + $ + _(x = A + J | 0, A) | 0, - o = r, - A = T, - r = n, - T = E, - n = i, - E = b, - i = $ + te + _(b = J + ee | 0, J) | 0 + (V = t[G]), (U = t[G + 1]); + var z = l(i, n, r), + j = l(b, E, T), + H = h(i, b), + W = h(b, i), + X = f(s, x), + Y = f(x, s), + K = a[G], + Q = a[G + 1], + q = u(s, c, v), + Z = u(x, S, C), + J = (P + Y) | 0, + $ = (y + X + _(J, P)) | 0; + $ = + (($ = + (($ = ($ + q + _((J = (J + Z) | 0), Z)) | 0) + + K + + _((J = (J + Q) | 0), Q)) | + 0) + + V + + _((J = (J + U) | 0), U)) | + 0; + var ee = (W + j) | 0, + te = (H + z + _(ee, W)) | 0; + (y = v), + (P = C), + (v = c), + (C = S), + (c = s), + (S = x), + (s = (o + $ + _((x = (A + J) | 0), A)) | 0), + (o = r), + (A = T), + (r = n), + (T = E), + (n = i), + (E = b), + (i = ($ + te + _((b = (J + ee) | 0), J)) | 0); } - this._al = this._al + b | 0, - this._bl = this._bl + E | 0, - this._cl = this._cl + T | 0, - this._dl = this._dl + A | 0, - this._el = this._el + x | 0, - this._fl = this._fl + S | 0, - this._gl = this._gl + C | 0, - this._hl = this._hl + P | 0, - this._ah = this._ah + i + _(this._al, b) | 0, - this._bh = this._bh + n + _(this._bl, E) | 0, - this._ch = this._ch + r + _(this._cl, T) | 0, - this._dh = this._dh + o + _(this._dl, A) | 0, - this._eh = this._eh + s + _(this._el, x) | 0, - this._fh = this._fh + c + _(this._fl, S) | 0, - this._gh = this._gh + v + _(this._gl, C) | 0, - this._hh = this._hh + y + _(this._hl, P) | 0 - } - , - c.prototype._hash = function() { + (this._al = (this._al + b) | 0), + (this._bl = (this._bl + E) | 0), + (this._cl = (this._cl + T) | 0), + (this._dl = (this._dl + A) | 0), + (this._el = (this._el + x) | 0), + (this._fl = (this._fl + S) | 0), + (this._gl = (this._gl + C) | 0), + (this._hl = (this._hl + P) | 0), + (this._ah = (this._ah + i + _(this._al, b)) | 0), + (this._bh = (this._bh + n + _(this._bl, E)) | 0), + (this._ch = (this._ch + r + _(this._cl, T)) | 0), + (this._dh = (this._dh + o + _(this._dl, A)) | 0), + (this._eh = (this._eh + s + _(this._el, x)) | 0), + (this._fh = (this._fh + c + _(this._fl, S)) | 0), + (this._gh = (this._gh + v + _(this._gl, C)) | 0), + (this._hh = (this._hh + y + _(this._hl, P)) | 0); + }), + (c.prototype._hash = function () { var e = o.allocUnsafe(64); function t(t, i, n) { - e.writeInt32BE(t, n), - e.writeInt32BE(i, n + 4) + e.writeInt32BE(t, n), e.writeInt32BE(i, n + 4); } - return t(this._ah, this._al, 0), - t(this._bh, this._bl, 8), - t(this._ch, this._cl, 16), - t(this._dh, this._dl, 24), - t(this._eh, this._el, 32), - t(this._fh, this._fl, 40), - t(this._gh, this._gl, 48), - t(this._hh, this._hl, 56), - e - } - , - e.exports = c -} -, function(e, t, i) { + return ( + t(this._ah, this._al, 0), + t(this._bh, this._bl, 8), + t(this._ch, this._cl, 16), + t(this._dh, this._dl, 24), + t(this._eh, this._el, 32), + t(this._fh, this._fl, 40), + t(this._gh, this._gl, 48), + t(this._hh, this._hl, 56), + e + ); + }), + (e.exports = c); + }, + function (e, t, i) { "use strict"; - var n = i(1) - , r = i(522) - , o = i(44) - , a = i(2).Buffer - , s = i(200) - , c = i(129) - , u = i(130) - , l = a.alloc(128); + var n = i(1), + r = i(522), + o = i(44), + a = i(2).Buffer, + s = i(200), + c = i(129), + u = i(130), + l = a.alloc(128); function h(e, t) { - o.call(this, "digest"), - "string" == typeof t && (t = a.from(t)); - var i = "sha512" === e || "sha384" === e ? 128 : 64; - (this._alg = e, - this._key = t, - t.length > i) ? t = ("rmd160" === e ? new c : u(e)).update(t).digest() : t.length < i && (t = a.concat([t, l], i)); - for (var n = this._ipad = a.allocUnsafe(i), r = this._opad = a.allocUnsafe(i), s = 0; s < i; s++) - n[s] = 54 ^ t[s], - r[s] = 92 ^ t[s]; - this._hash = "rmd160" === e ? new c : u(e), - this._hash.update(n) + o.call(this, "digest"), "string" == typeof t && (t = a.from(t)); + var i = "sha512" === e || "sha384" === e ? 128 : 64; + ((this._alg = e), (this._key = t), t.length > i) + ? (t = ("rmd160" === e ? new c() : u(e)).update(t).digest()) + : t.length < i && (t = a.concat([t, l], i)); + for ( + var n = (this._ipad = a.allocUnsafe(i)), + r = (this._opad = a.allocUnsafe(i)), + s = 0; + s < i; + s++ + ) + (n[s] = 54 ^ t[s]), (r[s] = 92 ^ t[s]); + (this._hash = "rmd160" === e ? new c() : u(e)), this._hash.update(n); } n(h, o), - h.prototype._update = function(e) { - this._hash.update(e) - } - , - h.prototype._final = function() { + (h.prototype._update = function (e) { + this._hash.update(e); + }), + (h.prototype._final = function () { var e = this._hash.digest(); - return ("rmd160" === this._alg ? new c : u(this._alg)).update(this._opad).update(e).digest() - } - , - e.exports = function(e, t) { - return "rmd160" === (e = e.toLowerCase()) || "ripemd160" === e ? new h("rmd160",t) : "md5" === e ? new r(s,t) : new h(e,t) - } -} -, function(e, t, i) { + return ("rmd160" === this._alg ? new c() : u(this._alg)) + .update(this._opad) + .update(e) + .digest(); + }), + (e.exports = function (e, t) { + return "rmd160" === (e = e.toLowerCase()) || "ripemd160" === e + ? new h("rmd160", t) + : "md5" === e + ? new r(s, t) + : new h(e, t); + }); + }, + function (e, t, i) { var n = i(127); - e.exports = function(e) { - return (new n).update(e).digest() - } -} -, function(e) { + e.exports = function (e) { + return new n().update(e).digest(); + }; + }, + function (e) { e.exports = { - sha224WithRSAEncryption: { - sign: "rsa", - hash: "sha224", - id: "302d300d06096086480165030402040500041c" - }, - "RSA-SHA224": { - sign: "ecdsa/rsa", - hash: "sha224", - id: "302d300d06096086480165030402040500041c" - }, - sha256WithRSAEncryption: { - sign: "rsa", - hash: "sha256", - id: "3031300d060960864801650304020105000420" - }, - "RSA-SHA256": { - sign: "ecdsa/rsa", - hash: "sha256", - id: "3031300d060960864801650304020105000420" - }, - sha384WithRSAEncryption: { - sign: "rsa", - hash: "sha384", - id: "3041300d060960864801650304020205000430" - }, - "RSA-SHA384": { - sign: "ecdsa/rsa", - hash: "sha384", - id: "3041300d060960864801650304020205000430" - }, - sha512WithRSAEncryption: { - sign: "rsa", - hash: "sha512", - id: "3051300d060960864801650304020305000440" - }, - "RSA-SHA512": { - sign: "ecdsa/rsa", - hash: "sha512", - id: "3051300d060960864801650304020305000440" - }, - "RSA-SHA1": { - sign: "rsa", - hash: "sha1", - id: "3021300906052b0e03021a05000414" - }, - "ecdsa-with-SHA1": { - sign: "ecdsa", - hash: "sha1", - id: "" - }, - sha256: { - sign: "ecdsa", - hash: "sha256", - id: "" - }, - sha224: { - sign: "ecdsa", - hash: "sha224", - id: "" - }, - sha384: { - sign: "ecdsa", - hash: "sha384", - id: "" - }, - sha512: { - sign: "ecdsa", - hash: "sha512", - id: "" - }, - "DSA-SHA": { - sign: "dsa", - hash: "sha1", - id: "" - }, - "DSA-SHA1": { - sign: "dsa", - hash: "sha1", - id: "" - }, - DSA: { - sign: "dsa", - hash: "sha1", - id: "" - }, - "DSA-WITH-SHA224": { - sign: "dsa", - hash: "sha224", - id: "" - }, - "DSA-SHA224": { - sign: "dsa", - hash: "sha224", - id: "" - }, - "DSA-WITH-SHA256": { - sign: "dsa", - hash: "sha256", - id: "" - }, - "DSA-SHA256": { - sign: "dsa", - hash: "sha256", - id: "" - }, - "DSA-WITH-SHA384": { - sign: "dsa", - hash: "sha384", - id: "" - }, - "DSA-SHA384": { - sign: "dsa", - hash: "sha384", - id: "" - }, - "DSA-WITH-SHA512": { - sign: "dsa", - hash: "sha512", - id: "" - }, - "DSA-SHA512": { - sign: "dsa", - hash: "sha512", - id: "" - }, - "DSA-RIPEMD160": { - sign: "dsa", - hash: "rmd160", - id: "" - }, - ripemd160WithRSA: { - sign: "rsa", - hash: "rmd160", - id: "3021300906052b2403020105000414" - }, - "RSA-RIPEMD160": { - sign: "rsa", - hash: "rmd160", - id: "3021300906052b2403020105000414" - }, - md5WithRSAEncryption: { - sign: "rsa", - hash: "md5", - id: "3020300c06082a864886f70d020505000410" - }, - "RSA-MD5": { - sign: "rsa", - hash: "md5", - id: "3020300c06082a864886f70d020505000410" - } - } -} -, function(e, t, i) { - t.pbkdf2 = i(524), - t.pbkdf2Sync = i(205) -} -, function(e, t, i) { - (function(t) { - var i = Math.pow(2, 30) - 1; - function n(e, i) { - if ("string" != typeof e && !t.isBuffer(e)) - throw new TypeError(i + " must be a buffer or string") - } - e.exports = function(e, t, r, o) { - if (n(e, "Password"), - n(t, "Salt"), - "number" != typeof r) - throw new TypeError("Iterations not a number"); - if (r < 0) - throw new TypeError("Bad iterations"); - if ("number" != typeof o) - throw new TypeError("Key length not a number"); - if (o < 0 || o > i || o != o) - throw new TypeError("Bad key length") - } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { - (function(t) { - var i; - t.browser ? i = "utf-8" : i = parseInt(t.version.split(".")[0].slice(1), 10) >= 6 ? "utf-8" : "binary"; - e.exports = i - } - ).call(this, i(27)) -} -, function(e, t, i) { - var n = i(200) - , r = i(129) - , o = i(130) - , a = i(203) - , s = i(204) - , c = i(2).Buffer - , u = c.alloc(128) - , l = { + sha224WithRSAEncryption: { + sign: "rsa", + hash: "sha224", + id: "302d300d06096086480165030402040500041c", + }, + "RSA-SHA224": { + sign: "ecdsa/rsa", + hash: "sha224", + id: "302d300d06096086480165030402040500041c", + }, + sha256WithRSAEncryption: { + sign: "rsa", + hash: "sha256", + id: "3031300d060960864801650304020105000420", + }, + "RSA-SHA256": { + sign: "ecdsa/rsa", + hash: "sha256", + id: "3031300d060960864801650304020105000420", + }, + sha384WithRSAEncryption: { + sign: "rsa", + hash: "sha384", + id: "3041300d060960864801650304020205000430", + }, + "RSA-SHA384": { + sign: "ecdsa/rsa", + hash: "sha384", + id: "3041300d060960864801650304020205000430", + }, + sha512WithRSAEncryption: { + sign: "rsa", + hash: "sha512", + id: "3051300d060960864801650304020305000440", + }, + "RSA-SHA512": { + sign: "ecdsa/rsa", + hash: "sha512", + id: "3051300d060960864801650304020305000440", + }, + "RSA-SHA1": { + sign: "rsa", + hash: "sha1", + id: "3021300906052b0e03021a05000414", + }, + "ecdsa-with-SHA1": { + sign: "ecdsa", + hash: "sha1", + id: "", + }, + sha256: { + sign: "ecdsa", + hash: "sha256", + id: "", + }, + sha224: { + sign: "ecdsa", + hash: "sha224", + id: "", + }, + sha384: { + sign: "ecdsa", + hash: "sha384", + id: "", + }, + sha512: { + sign: "ecdsa", + hash: "sha512", + id: "", + }, + "DSA-SHA": { + sign: "dsa", + hash: "sha1", + id: "", + }, + "DSA-SHA1": { + sign: "dsa", + hash: "sha1", + id: "", + }, + DSA: { + sign: "dsa", + hash: "sha1", + id: "", + }, + "DSA-WITH-SHA224": { + sign: "dsa", + hash: "sha224", + id: "", + }, + "DSA-SHA224": { + sign: "dsa", + hash: "sha224", + id: "", + }, + "DSA-WITH-SHA256": { + sign: "dsa", + hash: "sha256", + id: "", + }, + "DSA-SHA256": { + sign: "dsa", + hash: "sha256", + id: "", + }, + "DSA-WITH-SHA384": { + sign: "dsa", + hash: "sha384", + id: "", + }, + "DSA-SHA384": { + sign: "dsa", + hash: "sha384", + id: "", + }, + "DSA-WITH-SHA512": { + sign: "dsa", + hash: "sha512", + id: "", + }, + "DSA-SHA512": { + sign: "dsa", + hash: "sha512", + id: "", + }, + "DSA-RIPEMD160": { + sign: "dsa", + hash: "rmd160", + id: "", + }, + ripemd160WithRSA: { + sign: "rsa", + hash: "rmd160", + id: "3021300906052b2403020105000414", + }, + "RSA-RIPEMD160": { + sign: "rsa", + hash: "rmd160", + id: "3021300906052b2403020105000414", + }, + md5WithRSAEncryption: { + sign: "rsa", + hash: "md5", + id: "3020300c06082a864886f70d020505000410", + }, + "RSA-MD5": { + sign: "rsa", + hash: "md5", + id: "3020300c06082a864886f70d020505000410", + }, + }; + }, + function (e, t, i) { + (t.pbkdf2 = i(524)), (t.pbkdf2Sync = i(205)); + }, + function (e, t, i) { + (function (t) { + var i = Math.pow(2, 30) - 1; + function n(e, i) { + if ("string" != typeof e && !t.isBuffer(e)) + throw new TypeError(i + " must be a buffer or string"); + } + e.exports = function (e, t, r, o) { + if ((n(e, "Password"), n(t, "Salt"), "number" != typeof r)) + throw new TypeError("Iterations not a number"); + if (r < 0) throw new TypeError("Bad iterations"); + if ("number" != typeof o) + throw new TypeError("Key length not a number"); + if (o < 0 || o > i || o != o) throw new TypeError("Bad key length"); + }; + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { + (function (t) { + var i; + t.browser + ? (i = "utf-8") + : (i = + parseInt(t.version.split(".")[0].slice(1), 10) >= 6 + ? "utf-8" + : "binary"); + e.exports = i; + }.call(this, i(27))); + }, + function (e, t, i) { + var n = i(200), + r = i(129), + o = i(130), + a = i(203), + s = i(204), + c = i(2).Buffer, + u = c.alloc(128), + l = { md5: 16, sha1: 20, sha224: 28, @@ -14888,2050 +17895,2191 @@ sha384: 48, sha512: 64, rmd160: 20, - ripemd160: 20 - }; + ripemd160: 20, + }; function h(e, t, i) { - var a = function(e) { - return "rmd160" === e || "ripemd160" === e ? function(e) { - return (new r).update(e).digest() - } - : "md5" === e ? n : function(t) { - return o(e).update(t).digest() - } - }(e) - , s = "sha512" === e || "sha384" === e ? 128 : 64; - t.length > s ? t = a(t) : t.length < s && (t = c.concat([t, u], s)); - for (var h = c.allocUnsafe(s + l[e]), f = c.allocUnsafe(s + l[e]), d = 0; d < s; d++) - h[d] = 54 ^ t[d], - f[d] = 92 ^ t[d]; - var p = c.allocUnsafe(s + i + 4); - h.copy(p, 0, 0, s), - this.ipad1 = p, - this.ipad2 = h, - this.opad = f, - this.alg = e, - this.blocksize = s, - this.hash = a, - this.size = l[e] + var a = (function (e) { + return "rmd160" === e || "ripemd160" === e + ? function (e) { + return new r().update(e).digest(); + } + : "md5" === e + ? n + : function (t) { + return o(e).update(t).digest(); + }; + })(e), + s = "sha512" === e || "sha384" === e ? 128 : 64; + t.length > s ? (t = a(t)) : t.length < s && (t = c.concat([t, u], s)); + for ( + var h = c.allocUnsafe(s + l[e]), f = c.allocUnsafe(s + l[e]), d = 0; + d < s; + d++ + ) + (h[d] = 54 ^ t[d]), (f[d] = 92 ^ t[d]); + var p = c.allocUnsafe(s + i + 4); + h.copy(p, 0, 0, s), + (this.ipad1 = p), + (this.ipad2 = h), + (this.opad = f), + (this.alg = e), + (this.blocksize = s), + (this.hash = a), + (this.size = l[e]); } - h.prototype.run = function(e, t) { - return e.copy(t, this.blocksize), + (h.prototype.run = function (e, t) { + return ( + e.copy(t, this.blocksize), this.hash(t).copy(this.opad, this.blocksize), this.hash(this.opad) - } - , - e.exports = function(e, t, i, n, r) { + ); + }), + (e.exports = function (e, t, i, n, r) { a(e, t, i, n), - c.isBuffer(e) || (e = c.from(e, s)), - c.isBuffer(t) || (t = c.from(t, s)); - var o = new h(r = r || "sha1",e,t.length) - , u = c.allocUnsafe(n) - , f = c.allocUnsafe(t.length + 4); + c.isBuffer(e) || (e = c.from(e, s)), + c.isBuffer(t) || (t = c.from(t, s)); + var o = new h((r = r || "sha1"), e, t.length), + u = c.allocUnsafe(n), + f = c.allocUnsafe(t.length + 4); t.copy(f, 0, 0, t.length); for (var d = 0, p = l[r], m = Math.ceil(n / p), g = 1; g <= m; g++) { - f.writeUInt32BE(g, t.length); - for (var _ = o.run(f, o.ipad1), v = _, y = 1; y < i; y++) { - v = o.run(v, o.ipad2); - for (var b = 0; b < p; b++) - _[b] ^= v[b] - } - _.copy(u, d), - d += p + f.writeUInt32BE(g, t.length); + for (var _ = o.run(f, o.ipad1), v = _, y = 1; y < i; y++) { + v = o.run(v, o.ipad2); + for (var b = 0; b < p; b++) _[b] ^= v[b]; + } + _.copy(u, d), (d += p); } - return u - } -} -, function(e, t, i) { - var n = i(70) - , r = i(2).Buffer - , o = i(207); + return u; + }); + }, + function (e, t, i) { + var n = i(70), + r = i(2).Buffer, + o = i(207); function a(e) { - var t = e._cipher.encryptBlockRaw(e._prev); - return o(e._prev), - t + var t = e._cipher.encryptBlockRaw(e._prev); + return o(e._prev), t; } - t.encrypt = function(e, t) { - var i = Math.ceil(t.length / 16) - , o = e._cache.length; - e._cache = r.concat([e._cache, r.allocUnsafe(16 * i)]); - for (var s = 0; s < i; s++) { - var c = a(e) - , u = o + 16 * s; - e._cache.writeUInt32BE(c[0], u + 0), - e._cache.writeUInt32BE(c[1], u + 4), - e._cache.writeUInt32BE(c[2], u + 8), - e._cache.writeUInt32BE(c[3], u + 12) + t.encrypt = function (e, t) { + var i = Math.ceil(t.length / 16), + o = e._cache.length; + e._cache = r.concat([e._cache, r.allocUnsafe(16 * i)]); + for (var s = 0; s < i; s++) { + var c = a(e), + u = o + 16 * s; + e._cache.writeUInt32BE(c[0], u + 0), + e._cache.writeUInt32BE(c[1], u + 4), + e._cache.writeUInt32BE(c[2], u + 8), + e._cache.writeUInt32BE(c[3], u + 12); + } + var l = e._cache.slice(0, t.length); + return (e._cache = e._cache.slice(t.length)), n(t, l); + }; + }, + function (e, t) { + e.exports = function (e) { + for (var t, i = e.length; i--; ) { + if (255 !== (t = e.readUInt8(i))) { + t++, e.writeUInt8(t, i); + break; } - var l = e._cache.slice(0, t.length); - return e._cache = e._cache.slice(t.length), - n(t, l) - } -} -, function(e, t) { - e.exports = function(e) { - for (var t, i = e.length; i--; ) { - if (255 !== (t = e.readUInt8(i))) { - t++, - e.writeUInt8(t, i); - break - } - e.writeUInt8(0, i) - } - } -} -, function(e) { + e.writeUInt8(0, i); + } + }; + }, + function (e) { e.exports = { - "aes-128-ecb": { - cipher: "AES", - key: 128, - iv: 0, - mode: "ECB", - type: "block" - }, - "aes-192-ecb": { - cipher: "AES", - key: 192, - iv: 0, - mode: "ECB", - type: "block" - }, - "aes-256-ecb": { - cipher: "AES", - key: 256, - iv: 0, - mode: "ECB", - type: "block" - }, - "aes-128-cbc": { - cipher: "AES", - key: 128, - iv: 16, - mode: "CBC", - type: "block" - }, - "aes-192-cbc": { - cipher: "AES", - key: 192, - iv: 16, - mode: "CBC", - type: "block" - }, - "aes-256-cbc": { - cipher: "AES", - key: 256, - iv: 16, - mode: "CBC", - type: "block" - }, - aes128: { - cipher: "AES", - key: 128, - iv: 16, - mode: "CBC", - type: "block" - }, - aes192: { - cipher: "AES", - key: 192, - iv: 16, - mode: "CBC", - type: "block" - }, - aes256: { - cipher: "AES", - key: 256, - iv: 16, - mode: "CBC", - type: "block" - }, - "aes-128-cfb": { - cipher: "AES", - key: 128, - iv: 16, - mode: "CFB", - type: "stream" - }, - "aes-192-cfb": { - cipher: "AES", - key: 192, - iv: 16, - mode: "CFB", - type: "stream" - }, - "aes-256-cfb": { - cipher: "AES", - key: 256, - iv: 16, - mode: "CFB", - type: "stream" - }, - "aes-128-cfb8": { - cipher: "AES", - key: 128, - iv: 16, - mode: "CFB8", - type: "stream" - }, - "aes-192-cfb8": { - cipher: "AES", - key: 192, - iv: 16, - mode: "CFB8", - type: "stream" - }, - "aes-256-cfb8": { - cipher: "AES", - key: 256, - iv: 16, - mode: "CFB8", - type: "stream" - }, - "aes-128-cfb1": { - cipher: "AES", - key: 128, - iv: 16, - mode: "CFB1", - type: "stream" - }, - "aes-192-cfb1": { - cipher: "AES", - key: 192, - iv: 16, - mode: "CFB1", - type: "stream" - }, - "aes-256-cfb1": { - cipher: "AES", - key: 256, - iv: 16, - mode: "CFB1", - type: "stream" - }, - "aes-128-ofb": { - cipher: "AES", - key: 128, - iv: 16, - mode: "OFB", - type: "stream" - }, - "aes-192-ofb": { - cipher: "AES", - key: 192, - iv: 16, - mode: "OFB", - type: "stream" - }, - "aes-256-ofb": { - cipher: "AES", - key: 256, - iv: 16, - mode: "OFB", - type: "stream" - }, - "aes-128-ctr": { - cipher: "AES", - key: 128, - iv: 16, - mode: "CTR", - type: "stream" - }, - "aes-192-ctr": { - cipher: "AES", - key: 192, - iv: 16, - mode: "CTR", - type: "stream" - }, - "aes-256-ctr": { - cipher: "AES", - key: 256, - iv: 16, - mode: "CTR", - type: "stream" - }, - "aes-128-gcm": { - cipher: "AES", - key: 128, - iv: 12, - mode: "GCM", - type: "auth" - }, - "aes-192-gcm": { - cipher: "AES", - key: 192, - iv: 12, - mode: "GCM", - type: "auth" - }, - "aes-256-gcm": { - cipher: "AES", - key: 256, - iv: 12, - mode: "GCM", - type: "auth" - } - } -} -, function(e, t, i) { - var n = i(89) - , r = i(2).Buffer - , o = i(44) - , a = i(1) - , s = i(539) - , c = i(70) - , u = i(207); + "aes-128-ecb": { + cipher: "AES", + key: 128, + iv: 0, + mode: "ECB", + type: "block", + }, + "aes-192-ecb": { + cipher: "AES", + key: 192, + iv: 0, + mode: "ECB", + type: "block", + }, + "aes-256-ecb": { + cipher: "AES", + key: 256, + iv: 0, + mode: "ECB", + type: "block", + }, + "aes-128-cbc": { + cipher: "AES", + key: 128, + iv: 16, + mode: "CBC", + type: "block", + }, + "aes-192-cbc": { + cipher: "AES", + key: 192, + iv: 16, + mode: "CBC", + type: "block", + }, + "aes-256-cbc": { + cipher: "AES", + key: 256, + iv: 16, + mode: "CBC", + type: "block", + }, + aes128: { + cipher: "AES", + key: 128, + iv: 16, + mode: "CBC", + type: "block", + }, + aes192: { + cipher: "AES", + key: 192, + iv: 16, + mode: "CBC", + type: "block", + }, + aes256: { + cipher: "AES", + key: 256, + iv: 16, + mode: "CBC", + type: "block", + }, + "aes-128-cfb": { + cipher: "AES", + key: 128, + iv: 16, + mode: "CFB", + type: "stream", + }, + "aes-192-cfb": { + cipher: "AES", + key: 192, + iv: 16, + mode: "CFB", + type: "stream", + }, + "aes-256-cfb": { + cipher: "AES", + key: 256, + iv: 16, + mode: "CFB", + type: "stream", + }, + "aes-128-cfb8": { + cipher: "AES", + key: 128, + iv: 16, + mode: "CFB8", + type: "stream", + }, + "aes-192-cfb8": { + cipher: "AES", + key: 192, + iv: 16, + mode: "CFB8", + type: "stream", + }, + "aes-256-cfb8": { + cipher: "AES", + key: 256, + iv: 16, + mode: "CFB8", + type: "stream", + }, + "aes-128-cfb1": { + cipher: "AES", + key: 128, + iv: 16, + mode: "CFB1", + type: "stream", + }, + "aes-192-cfb1": { + cipher: "AES", + key: 192, + iv: 16, + mode: "CFB1", + type: "stream", + }, + "aes-256-cfb1": { + cipher: "AES", + key: 256, + iv: 16, + mode: "CFB1", + type: "stream", + }, + "aes-128-ofb": { + cipher: "AES", + key: 128, + iv: 16, + mode: "OFB", + type: "stream", + }, + "aes-192-ofb": { + cipher: "AES", + key: 192, + iv: 16, + mode: "OFB", + type: "stream", + }, + "aes-256-ofb": { + cipher: "AES", + key: 256, + iv: 16, + mode: "OFB", + type: "stream", + }, + "aes-128-ctr": { + cipher: "AES", + key: 128, + iv: 16, + mode: "CTR", + type: "stream", + }, + "aes-192-ctr": { + cipher: "AES", + key: 192, + iv: 16, + mode: "CTR", + type: "stream", + }, + "aes-256-ctr": { + cipher: "AES", + key: 256, + iv: 16, + mode: "CTR", + type: "stream", + }, + "aes-128-gcm": { + cipher: "AES", + key: 128, + iv: 12, + mode: "GCM", + type: "auth", + }, + "aes-192-gcm": { + cipher: "AES", + key: 192, + iv: 12, + mode: "GCM", + type: "auth", + }, + "aes-256-gcm": { + cipher: "AES", + key: 256, + iv: 12, + mode: "GCM", + type: "auth", + }, + }; + }, + function (e, t, i) { + var n = i(89), + r = i(2).Buffer, + o = i(44), + a = i(1), + s = i(539), + c = i(70), + u = i(207); function l(e, t, i, a) { - o.call(this); - var c = r.alloc(4, 0); - this._cipher = new n.AES(t); - var l = this._cipher.encryptBlock(c); - this._ghash = new s(l), - i = function(e, t, i) { - if (12 === t.length) - return e._finID = r.concat([t, r.from([0, 0, 0, 1])]), - r.concat([t, r.from([0, 0, 0, 2])]); - var n = new s(i) - , o = t.length - , a = o % 16; - n.update(t), - a && (a = 16 - a, - n.update(r.alloc(a, 0))), + o.call(this); + var c = r.alloc(4, 0); + this._cipher = new n.AES(t); + var l = this._cipher.encryptBlock(c); + (this._ghash = new s(l)), + (i = (function (e, t, i) { + if (12 === t.length) + return ( + (e._finID = r.concat([t, r.from([0, 0, 0, 1])])), + r.concat([t, r.from([0, 0, 0, 2])]) + ); + var n = new s(i), + o = t.length, + a = o % 16; + n.update(t), + a && ((a = 16 - a), n.update(r.alloc(a, 0))), n.update(r.alloc(8, 0)); - var c = 8 * o - , l = r.alloc(8); - l.writeUIntBE(c, 0, 8), - n.update(l), - e._finID = n.state; - var h = r.from(e._finID); - return u(h), - h - }(this, i, l), - this._prev = r.from(i), - this._cache = r.allocUnsafe(0), - this._secCache = r.allocUnsafe(0), - this._decrypt = a, - this._alen = 0, - this._len = 0, - this._mode = e, - this._authTag = null, - this._called = false + var c = 8 * o, + l = r.alloc(8); + l.writeUIntBE(c, 0, 8), n.update(l), (e._finID = n.state); + var h = r.from(e._finID); + return u(h), h; + })(this, i, l)), + (this._prev = r.from(i)), + (this._cache = r.allocUnsafe(0)), + (this._secCache = r.allocUnsafe(0)), + (this._decrypt = a), + (this._alen = 0), + (this._len = 0), + (this._mode = e), + (this._authTag = null), + (this._called = false); } a(l, o), - l.prototype._update = function(e) { + (l.prototype._update = function (e) { if (!this._called && this._alen) { - var t = 16 - this._alen % 16; - t < 16 && (t = r.alloc(t, 0), - this._ghash.update(t)) + var t = 16 - (this._alen % 16); + t < 16 && ((t = r.alloc(t, 0)), this._ghash.update(t)); } this._called = true; var i = this._mode.encrypt(this, e); - return this._decrypt ? this._ghash.update(e) : this._ghash.update(i), - this._len += e.length, - i - } - , - l.prototype._final = function() { + return ( + this._decrypt ? this._ghash.update(e) : this._ghash.update(i), + (this._len += e.length), + i + ); + }), + (l.prototype._final = function () { if (this._decrypt && !this._authTag) - throw new Error("Unsupported state or unable to authenticate data"); - var e = c(this._ghash.final(8 * this._alen, 8 * this._len), this._cipher.encryptBlock(this._finID)); - if (this._decrypt && function(e, t) { + throw new Error("Unsupported state or unable to authenticate data"); + var e = c( + this._ghash.final(8 * this._alen, 8 * this._len), + this._cipher.encryptBlock(this._finID) + ); + if ( + this._decrypt && + (function (e, t) { var i = 0; e.length !== t.length && i++; for (var n = Math.min(e.length, t.length), r = 0; r < n; ++r) - i += e[r] ^ t[r]; - return i - }(e, this._authTag)) - throw new Error("Unsupported state or unable to authenticate data"); - this._authTag = e, - this._cipher.scrub() - } - , - l.prototype.getAuthTag = function() { + i += e[r] ^ t[r]; + return i; + })(e, this._authTag) + ) + throw new Error("Unsupported state or unable to authenticate data"); + (this._authTag = e), this._cipher.scrub(); + }), + (l.prototype.getAuthTag = function () { if (this._decrypt || !r.isBuffer(this._authTag)) - throw new Error("Attempting to get auth tag in unsupported state"); - return this._authTag - } - , - l.prototype.setAuthTag = function(e) { + throw new Error("Attempting to get auth tag in unsupported state"); + return this._authTag; + }), + (l.prototype.setAuthTag = function (e) { if (!this._decrypt) - throw new Error("Attempting to set auth tag in unsupported state"); - this._authTag = e - } - , - l.prototype.setAAD = function(e) { + throw new Error("Attempting to set auth tag in unsupported state"); + this._authTag = e; + }), + (l.prototype.setAAD = function (e) { if (this._called) - throw new Error("Attempting to set AAD in unsupported state"); - this._ghash.update(e), - this._alen += e.length - } - , - e.exports = l -} -, function(e, t, i) { - var n = i(89) - , r = i(2).Buffer - , o = i(44); + throw new Error("Attempting to set AAD in unsupported state"); + this._ghash.update(e), (this._alen += e.length); + }), + (e.exports = l); + }, + function (e, t, i) { + var n = i(89), + r = i(2).Buffer, + o = i(44); function a(e, t, i, a) { - o.call(this), - this._cipher = new n.AES(t), - this._prev = r.from(i), - this._cache = r.allocUnsafe(0), - this._secCache = r.allocUnsafe(0), - this._decrypt = a, - this._mode = e + o.call(this), + (this._cipher = new n.AES(t)), + (this._prev = r.from(i)), + (this._cache = r.allocUnsafe(0)), + (this._secCache = r.allocUnsafe(0)), + (this._decrypt = a), + (this._mode = e); } i(1)(a, o), - a.prototype._update = function(e) { - return this._mode.encrypt(this, e, this._decrypt) - } - , - a.prototype._final = function() { - this._cipher.scrub() - } - , - e.exports = a -} -, function(e, t, i) { + (a.prototype._update = function (e) { + return this._mode.encrypt(this, e, this._decrypt); + }), + (a.prototype._final = function () { + this._cipher.scrub(); + }), + (e.exports = a); + }, + function (e, t, i) { var n = i(53); - e.exports = v, - v.simpleSieve = g, - v.fermatTest = _; - var r = i(11) - , o = new r(24) - , a = new (i(212)) - , s = new r(1) - , c = new r(2) - , u = new r(5) - , l = (new r(16), - new r(8), - new r(10)) - , h = new r(3) - , f = (new r(7), - new r(11)) - , d = new r(4) - , p = (new r(12), - null); + (e.exports = v), (v.simpleSieve = g), (v.fermatTest = _); + var r = i(11), + o = new r(24), + a = new (i(212))(), + s = new r(1), + c = new r(2), + u = new r(5), + l = (new r(16), new r(8), new r(10)), + h = new r(3), + f = (new r(7), new r(11)), + d = new r(4), + p = (new r(12), null); function m() { - if (null !== p) - return p; - var e = []; - e[0] = 2; - for (var t = 1, i = 3; i < 1048576; i += 2) { - for (var n = Math.ceil(Math.sqrt(i)), r = 0; r < t && e[r] <= n && i % e[r] != 0; r++) - ; - t !== r && e[r] <= n || (e[t++] = i) - } - return p = e, - e + if (null !== p) return p; + var e = []; + e[0] = 2; + for (var t = 1, i = 3; i < 1048576; i += 2) { + for ( + var n = Math.ceil(Math.sqrt(i)), r = 0; + r < t && e[r] <= n && i % e[r] != 0; + r++ + ); + (t !== r && e[r] <= n) || (e[t++] = i); + } + return (p = e), e; } function g(e) { - for (var t = m(), i = 0; i < t.length; i++) - if (0 === e.modn(t[i])) - return 0 === e.cmpn(t[i]); - return true + for (var t = m(), i = 0; i < t.length; i++) + if (0 === e.modn(t[i])) return 0 === e.cmpn(t[i]); + return true; } function _(e) { - var t = r.mont(e); - return 0 === c.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1) + var t = r.mont(e); + return 0 === c.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1); } function v(e, t) { - if (e < 16) - return new r(2 === t || 5 === t ? [140, 123] : [140, 39]); - var i, p; - for (t = new r(t); ; ) { - for (i = new r(n(Math.ceil(e / 8))); i.bitLength() > e; ) - i.ishrn(1); - if (i.isEven() && i.iadd(s), - i.testn(1) || i.iadd(c), - t.cmp(c)) { - if (!t.cmp(u)) - for (; i.mod(l).cmp(h); ) - i.iadd(d) - } else - for (; i.mod(o).cmp(f); ) - i.iadd(d); - if (g(p = i.shrn(1)) && g(i) && _(p) && _(i) && a.test(p) && a.test(i)) - return i - } + if (e < 16) return new r(2 === t || 5 === t ? [140, 123] : [140, 39]); + var i, p; + for (t = new r(t); ; ) { + for (i = new r(n(Math.ceil(e / 8))); i.bitLength() > e; ) i.ishrn(1); + if ((i.isEven() && i.iadd(s), i.testn(1) || i.iadd(c), t.cmp(c))) { + if (!t.cmp(u)) for (; i.mod(l).cmp(h); ) i.iadd(d); + } else for (; i.mod(o).cmp(f); ) i.iadd(d); + if ( + g((p = i.shrn(1))) && + g(i) && + _(p) && + _(i) && + a.test(p) && + a.test(i) + ) + return i; + } } -} -, function(e, t, i) { - var n = i(11) - , r = i(213); + }, + function (e, t, i) { + var n = i(11), + r = i(213); function o(e) { - this.rand = e || new r.Rand + this.rand = e || new r.Rand(); } - e.exports = o, - o.create = function(e) { - return new o(e) - } - , - o.prototype._randbelow = function(e) { - var t = e.bitLength() - , i = Math.ceil(t / 8); + (e.exports = o), + (o.create = function (e) { + return new o(e); + }), + (o.prototype._randbelow = function (e) { + var t = e.bitLength(), + i = Math.ceil(t / 8); do { - var r = new n(this.rand.generate(i)) - } while (r.cmp(e) >= 0);return r - } - , - o.prototype._randrange = function(e, t) { + var r = new n(this.rand.generate(i)); + } while (r.cmp(e) >= 0); + return r; + }), + (o.prototype._randrange = function (e, t) { var i = t.sub(e); - return e.add(this._randbelow(i)) - } - , - o.prototype.test = function(e, t, i) { - var r = e.bitLength() - , o = n.mont(e) - , a = new n(1).toRed(o); - t || (t = Math.max(1, r / 48 | 0)); - for (var s = e.subn(1), c = 0; !s.testn(c); c++) - ; + return e.add(this._randbelow(i)); + }), + (o.prototype.test = function (e, t, i) { + var r = e.bitLength(), + o = n.mont(e), + a = new n(1).toRed(o); + t || (t = Math.max(1, (r / 48) | 0)); + for (var s = e.subn(1), c = 0; !s.testn(c); c++); for (var u = e.shrn(c), l = s.toRed(o); t > 0; t--) { - var h = this._randrange(new n(2), s); - i && i(h); - var f = h.toRed(o).redPow(u); - if (0 !== f.cmp(a) && 0 !== f.cmp(l)) { - for (var d = 1; d < c; d++) { - if (0 === (f = f.redSqr()).cmp(a)) - return false; - if (0 === f.cmp(l)) - break - } - if (d === c) - return false + var h = this._randrange(new n(2), s); + i && i(h); + var f = h.toRed(o).redPow(u); + if (0 !== f.cmp(a) && 0 !== f.cmp(l)) { + for (var d = 1; d < c; d++) { + if (0 === (f = f.redSqr()).cmp(a)) return false; + if (0 === f.cmp(l)) break; } + if (d === c) return false; + } } - return true - } - , - o.prototype.getDivisor = function(e, t) { - var i = e.bitLength() - , r = n.mont(e) - , o = new n(1).toRed(r); - t || (t = Math.max(1, i / 48 | 0)); - for (var a = e.subn(1), s = 0; !a.testn(s); s++) - ; + return true; + }), + (o.prototype.getDivisor = function (e, t) { + var i = e.bitLength(), + r = n.mont(e), + o = new n(1).toRed(r); + t || (t = Math.max(1, (i / 48) | 0)); + for (var a = e.subn(1), s = 0; !a.testn(s); s++); for (var c = e.shrn(s), u = a.toRed(r); t > 0; t--) { - var l = this._randrange(new n(2), a) - , h = e.gcd(l); - if (0 !== h.cmpn(1)) - return h; - var f = l.toRed(r).redPow(c); - if (0 !== f.cmp(o) && 0 !== f.cmp(u)) { - for (var d = 1; d < s; d++) { - if (0 === (f = f.redSqr()).cmp(o)) - return f.fromRed().subn(1).gcd(e); - if (0 === f.cmp(u)) - break - } - if (d === s) - return (f = f.redSqr()).fromRed().subn(1).gcd(e) + var l = this._randrange(new n(2), a), + h = e.gcd(l); + if (0 !== h.cmpn(1)) return h; + var f = l.toRed(r).redPow(c); + if (0 !== f.cmp(o) && 0 !== f.cmp(u)) { + for (var d = 1; d < s; d++) { + if (0 === (f = f.redSqr()).cmp(o)) + return f.fromRed().subn(1).gcd(e); + if (0 === f.cmp(u)) break; } + if (d === s) return (f = f.redSqr()).fromRed().subn(1).gcd(e); + } } - return false - } -} -, function(e, t, i) { + return false; + }); + }, + function (e, t, i) { function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } var r; function o(e) { - this.rand = e + this.rand = e; } - if (e.exports = function(e) { - return r || (r = new o(null)), - r.generate(e) - } - , - e.exports.Rand = o, - o.prototype.generate = function(e) { - return this._rand(e) - } - , - o.prototype._rand = function(e) { - if (this.rand.getBytes) - return this.rand.getBytes(e); + if ( + ((e.exports = function (e) { + return r || (r = new o(null)), r.generate(e); + }), + (e.exports.Rand = o), + (o.prototype.generate = function (e) { + return this._rand(e); + }), + (o.prototype._rand = function (e) { + if (this.rand.getBytes) return this.rand.getBytes(e); for (var t = new Uint8Array(e), i = 0; i < t.length; i++) - t[i] = this.rand.getByte(); - return t - } - , - "object" === ("undefined" == typeof self ? "undefined" : n(self))) - self.crypto && self.crypto.getRandomValues ? o.prototype._rand = function(e) { + t[i] = this.rand.getByte(); + return t; + }), + "object" === ("undefined" == typeof self ? "undefined" : n(self))) + ) + self.crypto && self.crypto.getRandomValues + ? (o.prototype._rand = function (e) { var t = new Uint8Array(e); - return self.crypto.getRandomValues(t), - t - } - : self.msCrypto && self.msCrypto.getRandomValues ? o.prototype._rand = function(e) { + return self.crypto.getRandomValues(t), t; + }) + : self.msCrypto && self.msCrypto.getRandomValues + ? (o.prototype._rand = function (e) { var t = new Uint8Array(e); - return self.msCrypto.getRandomValues(t), - t - } - : "object" === ("undefined" == typeof window ? "undefined" : n(window)) && (o.prototype._rand = function() { - throw new Error("Not implemented yet") - } - ); + return self.msCrypto.getRandomValues(t), t; + }) + : "object" === + ("undefined" == typeof window ? "undefined" : n(window)) && + (o.prototype._rand = function () { + throw new Error("Not implemented yet"); + }); else - try { - var a = i(544); - if ("function" != typeof a.randomBytes) - throw new Error("Not supported"); - o.prototype._rand = function(e) { - return a.randomBytes(e) - } - } catch (e) {} -} -, function(e, t, i) { + try { + var a = i(544); + if ("function" != typeof a.randomBytes) + throw new Error("Not supported"); + o.prototype._rand = function (e) { + return a.randomBytes(e); + }; + } catch (e) {} + }, + function (e, t, i) { "use strict"; var n = t; function r(e) { - return 1 === e.length ? "0" + e : e + return 1 === e.length ? "0" + e : e; } function o(e) { - for (var t = "", i = 0; i < e.length; i++) - t += r(e[i].toString(16)); - return t + for (var t = "", i = 0; i < e.length; i++) t += r(e[i].toString(16)); + return t; } - n.toArray = function(e, t) { - if (Array.isArray(e)) - return e.slice(); - if (!e) - return []; - var i = []; - if ("string" != typeof e) { - for (var n = 0; n < e.length; n++) - i[n] = 0 | e[n]; - return i + (n.toArray = function (e, t) { + if (Array.isArray(e)) return e.slice(); + if (!e) return []; + var i = []; + if ("string" != typeof e) { + for (var n = 0; n < e.length; n++) i[n] = 0 | e[n]; + return i; + } + if ("hex" === t) + for ( + (e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (e = "0" + e), + n = 0; + n < e.length; + n += 2 + ) + i.push(parseInt(e[n] + e[n + 1], 16)); + else + for (n = 0; n < e.length; n++) { + var r = e.charCodeAt(n), + o = r >> 8, + a = 255 & r; + o ? i.push(o, a) : i.push(a); } - if ("hex" === t) - for ((e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (e = "0" + e), - n = 0; n < e.length; n += 2) - i.push(parseInt(e[n] + e[n + 1], 16)); - else - for (n = 0; n < e.length; n++) { - var r = e.charCodeAt(n) - , o = r >> 8 - , a = 255 & r; - o ? i.push(o, a) : i.push(a) - } - return i - } - , - n.zero2 = r, - n.toHex = o, - n.encode = function(e, t) { - return "hex" === t ? o(e) : e - } -} -, function(e, t, i) { + return i; + }), + (n.zero2 = r), + (n.toHex = o), + (n.encode = function (e, t) { + return "hex" === t ? o(e) : e; + }); + }, + function (e, t, i) { "use strict"; var n = i(33).rotr32; function r(e, t, i) { - return e & t ^ ~e & i + return (e & t) ^ (~e & i); } function o(e, t, i) { - return e & t ^ e & i ^ t & i + return (e & t) ^ (e & i) ^ (t & i); } function a(e, t, i) { - return e ^ t ^ i + return e ^ t ^ i; } - t.ft_1 = function(e, t, i, n) { - return 0 === e ? r(t, i, n) : 1 === e || 3 === e ? a(t, i, n) : 2 === e ? o(t, i, n) : void 0 - } - , - t.ch32 = r, - t.maj32 = o, - t.p32 = a, - t.s0_256 = function(e) { - return n(e, 2) ^ n(e, 13) ^ n(e, 22) - } - , - t.s1_256 = function(e) { - return n(e, 6) ^ n(e, 11) ^ n(e, 25) - } - , - t.g0_256 = function(e) { - return n(e, 7) ^ n(e, 18) ^ e >>> 3 - } - , - t.g1_256 = function(e) { - return n(e, 17) ^ n(e, 19) ^ e >>> 10 - } -} -, function(e, t, i) { + (t.ft_1 = function (e, t, i, n) { + return 0 === e + ? r(t, i, n) + : 1 === e || 3 === e + ? a(t, i, n) + : 2 === e + ? o(t, i, n) + : void 0; + }), + (t.ch32 = r), + (t.maj32 = o), + (t.p32 = a), + (t.s0_256 = function (e) { + return n(e, 2) ^ n(e, 13) ^ n(e, 22); + }), + (t.s1_256 = function (e) { + return n(e, 6) ^ n(e, 11) ^ n(e, 25); + }), + (t.g0_256 = function (e) { + return n(e, 7) ^ n(e, 18) ^ (e >>> 3); + }), + (t.g1_256 = function (e) { + return n(e, 17) ^ n(e, 19) ^ (e >>> 10); + }); + }, + function (e, t, i) { "use strict"; - var n = i(33) - , r = i(71) - , o = i(215) - , a = i(25) - , s = n.sum32 - , c = n.sum32_4 - , u = n.sum32_5 - , l = o.ch32 - , h = o.maj32 - , f = o.s0_256 - , d = o.s1_256 - , p = o.g0_256 - , m = o.g1_256 - , g = r.BlockHash - , _ = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298]; + var n = i(33), + r = i(71), + o = i(215), + a = i(25), + s = n.sum32, + c = n.sum32_4, + u = n.sum32_5, + l = o.ch32, + h = o.maj32, + f = o.s0_256, + d = o.s1_256, + p = o.g0_256, + m = o.g1_256, + g = r.BlockHash, + _ = [ + 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, + 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, + 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, + 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, + 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, + 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, + 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, + 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, + 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, + 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, + 2428436474, 2756734187, 3204031479, 3329325298, + ]; function v() { - if (!(this instanceof v)) - return new v; - g.call(this), - this.h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225], - this.k = _, - this.W = new Array(64) + if (!(this instanceof v)) return new v(); + g.call(this), + (this.h = [ + 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, + 2600822924, 528734635, 1541459225, + ]), + (this.k = _), + (this.W = new Array(64)); } n.inherits(v, g), - e.exports = v, - v.blockSize = 512, - v.outSize = 256, - v.hmacStrength = 192, - v.padLength = 64, - v.prototype._update = function(e, t) { - for (var i = this.W, n = 0; n < 16; n++) - i[n] = e[t + n]; + (e.exports = v), + (v.blockSize = 512), + (v.outSize = 256), + (v.hmacStrength = 192), + (v.padLength = 64), + (v.prototype._update = function (e, t) { + for (var i = this.W, n = 0; n < 16; n++) i[n] = e[t + n]; for (; n < i.length; n++) - i[n] = c(m(i[n - 2]), i[n - 7], p(i[n - 15]), i[n - 16]); - var r = this.h[0] - , o = this.h[1] - , g = this.h[2] - , _ = this.h[3] - , v = this.h[4] - , y = this.h[5] - , b = this.h[6] - , E = this.h[7]; - for (a(this.k.length === i.length), - n = 0; n < i.length; n++) { - var T = u(E, d(v), l(v, y, b), this.k[n], i[n]) - , A = s(f(r), h(r, o, g)); - E = b, - b = y, - y = v, - v = s(_, T), - _ = g, - g = o, - o = r, - r = s(T, A) + i[n] = c(m(i[n - 2]), i[n - 7], p(i[n - 15]), i[n - 16]); + var r = this.h[0], + o = this.h[1], + g = this.h[2], + _ = this.h[3], + v = this.h[4], + y = this.h[5], + b = this.h[6], + E = this.h[7]; + for (a(this.k.length === i.length), n = 0; n < i.length; n++) { + var T = u(E, d(v), l(v, y, b), this.k[n], i[n]), + A = s(f(r), h(r, o, g)); + (E = b), + (b = y), + (y = v), + (v = s(_, T)), + (_ = g), + (g = o), + (o = r), + (r = s(T, A)); } - this.h[0] = s(this.h[0], r), - this.h[1] = s(this.h[1], o), - this.h[2] = s(this.h[2], g), - this.h[3] = s(this.h[3], _), - this.h[4] = s(this.h[4], v), - this.h[5] = s(this.h[5], y), - this.h[6] = s(this.h[6], b), - this.h[7] = s(this.h[7], E) - } - , - v.prototype._digest = function(e) { - return "hex" === e ? n.toHex32(this.h, "big") : n.split32(this.h, "big") - } -} -, function(e, t, i) { + (this.h[0] = s(this.h[0], r)), + (this.h[1] = s(this.h[1], o)), + (this.h[2] = s(this.h[2], g)), + (this.h[3] = s(this.h[3], _)), + (this.h[4] = s(this.h[4], v)), + (this.h[5] = s(this.h[5], y)), + (this.h[6] = s(this.h[6], b)), + (this.h[7] = s(this.h[7], E)); + }), + (v.prototype._digest = function (e) { + return "hex" === e + ? n.toHex32(this.h, "big") + : n.split32(this.h, "big"); + }); + }, + function (e, t, i) { "use strict"; - var n = i(33) - , r = i(71) - , o = i(25) - , a = n.rotr64_hi - , s = n.rotr64_lo - , c = n.shr64_hi - , u = n.shr64_lo - , l = n.sum64 - , h = n.sum64_hi - , f = n.sum64_lo - , d = n.sum64_4_hi - , p = n.sum64_4_lo - , m = n.sum64_5_hi - , g = n.sum64_5_lo - , _ = r.BlockHash - , v = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591]; + var n = i(33), + r = i(71), + o = i(25), + a = n.rotr64_hi, + s = n.rotr64_lo, + c = n.shr64_hi, + u = n.shr64_lo, + l = n.sum64, + h = n.sum64_hi, + f = n.sum64_lo, + d = n.sum64_4_hi, + p = n.sum64_4_lo, + m = n.sum64_5_hi, + g = n.sum64_5_lo, + _ = r.BlockHash, + v = [ + 1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, + 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, + 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, + 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, + 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, + 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, + 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, + 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, + 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, + 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, + 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, + 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, + 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, + 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, + 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, + 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, + 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, + 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, + 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, + 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, + 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, + 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, + 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, + 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, + 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, + 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, + 1607167915, 987167468, 1816402316, 1246189591, + ]; function y() { - if (!(this instanceof y)) - return new y; - _.call(this), - this.h = [1779033703, 4089235720, 3144134277, 2227873595, 1013904242, 4271175723, 2773480762, 1595750129, 1359893119, 2917565137, 2600822924, 725511199, 528734635, 4215389547, 1541459225, 327033209], - this.k = v, - this.W = new Array(160) + if (!(this instanceof y)) return new y(); + _.call(this), + (this.h = [ + 1779033703, 4089235720, 3144134277, 2227873595, 1013904242, + 4271175723, 2773480762, 1595750129, 1359893119, 2917565137, + 2600822924, 725511199, 528734635, 4215389547, 1541459225, 327033209, + ]), + (this.k = v), + (this.W = new Array(160)); } function b(e, t, i, n, r) { - var o = e & i ^ ~e & r; - return o < 0 && (o += 4294967296), - o + var o = (e & i) ^ (~e & r); + return o < 0 && (o += 4294967296), o; } function E(e, t, i, n, r, o) { - var a = t & n ^ ~t & o; - return a < 0 && (a += 4294967296), - a + var a = (t & n) ^ (~t & o); + return a < 0 && (a += 4294967296), a; } function T(e, t, i, n, r) { - var o = e & i ^ e & r ^ i & r; - return o < 0 && (o += 4294967296), - o + var o = (e & i) ^ (e & r) ^ (i & r); + return o < 0 && (o += 4294967296), o; } function A(e, t, i, n, r, o) { - var a = t & n ^ t & o ^ n & o; - return a < 0 && (a += 4294967296), - a + var a = (t & n) ^ (t & o) ^ (n & o); + return a < 0 && (a += 4294967296), a; } function x(e, t) { - var i = a(e, t, 28) ^ a(t, e, 2) ^ a(t, e, 7); - return i < 0 && (i += 4294967296), - i + var i = a(e, t, 28) ^ a(t, e, 2) ^ a(t, e, 7); + return i < 0 && (i += 4294967296), i; } function S(e, t) { - var i = s(e, t, 28) ^ s(t, e, 2) ^ s(t, e, 7); - return i < 0 && (i += 4294967296), - i + var i = s(e, t, 28) ^ s(t, e, 2) ^ s(t, e, 7); + return i < 0 && (i += 4294967296), i; } function C(e, t) { - var i = a(e, t, 14) ^ a(e, t, 18) ^ a(t, e, 9); - return i < 0 && (i += 4294967296), - i + var i = a(e, t, 14) ^ a(e, t, 18) ^ a(t, e, 9); + return i < 0 && (i += 4294967296), i; } function P(e, t) { - var i = s(e, t, 14) ^ s(e, t, 18) ^ s(t, e, 9); - return i < 0 && (i += 4294967296), - i + var i = s(e, t, 14) ^ s(e, t, 18) ^ s(t, e, 9); + return i < 0 && (i += 4294967296), i; } function R(e, t) { - var i = a(e, t, 1) ^ a(e, t, 8) ^ c(e, t, 7); - return i < 0 && (i += 4294967296), - i + var i = a(e, t, 1) ^ a(e, t, 8) ^ c(e, t, 7); + return i < 0 && (i += 4294967296), i; } function M(e, t) { - var i = s(e, t, 1) ^ s(e, t, 8) ^ u(e, t, 7); - return i < 0 && (i += 4294967296), - i + var i = s(e, t, 1) ^ s(e, t, 8) ^ u(e, t, 7); + return i < 0 && (i += 4294967296), i; } function O(e, t) { - var i = a(e, t, 19) ^ a(t, e, 29) ^ c(e, t, 6); - return i < 0 && (i += 4294967296), - i + var i = a(e, t, 19) ^ a(t, e, 29) ^ c(e, t, 6); + return i < 0 && (i += 4294967296), i; } function w(e, t) { - var i = s(e, t, 19) ^ s(t, e, 29) ^ u(e, t, 6); - return i < 0 && (i += 4294967296), - i + var i = s(e, t, 19) ^ s(t, e, 29) ^ u(e, t, 6); + return i < 0 && (i += 4294967296), i; } n.inherits(y, _), - e.exports = y, - y.blockSize = 1024, - y.outSize = 512, - y.hmacStrength = 192, - y.padLength = 128, - y.prototype._prepareBlock = function(e, t) { - for (var i = this.W, n = 0; n < 32; n++) - i[n] = e[t + n]; + (e.exports = y), + (y.blockSize = 1024), + (y.outSize = 512), + (y.hmacStrength = 192), + (y.padLength = 128), + (y.prototype._prepareBlock = function (e, t) { + for (var i = this.W, n = 0; n < 32; n++) i[n] = e[t + n]; for (; n < i.length; n += 2) { - var r = O(i[n - 4], i[n - 3]) - , o = w(i[n - 4], i[n - 3]) - , a = i[n - 14] - , s = i[n - 13] - , c = R(i[n - 30], i[n - 29]) - , u = M(i[n - 30], i[n - 29]) - , l = i[n - 32] - , h = i[n - 31]; - i[n] = d(r, o, a, s, c, u, l, h), - i[n + 1] = p(r, o, a, s, c, u, l, h) + var r = O(i[n - 4], i[n - 3]), + o = w(i[n - 4], i[n - 3]), + a = i[n - 14], + s = i[n - 13], + c = R(i[n - 30], i[n - 29]), + u = M(i[n - 30], i[n - 29]), + l = i[n - 32], + h = i[n - 31]; + (i[n] = d(r, o, a, s, c, u, l, h)), + (i[n + 1] = p(r, o, a, s, c, u, l, h)); } - } - , - y.prototype._update = function(e, t) { + }), + (y.prototype._update = function (e, t) { this._prepareBlock(e, t); - var i = this.W - , n = this.h[0] - , r = this.h[1] - , a = this.h[2] - , s = this.h[3] - , c = this.h[4] - , u = this.h[5] - , d = this.h[6] - , p = this.h[7] - , _ = this.h[8] - , v = this.h[9] - , y = this.h[10] - , R = this.h[11] - , M = this.h[12] - , O = this.h[13] - , w = this.h[14] - , I = this.h[15]; + var i = this.W, + n = this.h[0], + r = this.h[1], + a = this.h[2], + s = this.h[3], + c = this.h[4], + u = this.h[5], + d = this.h[6], + p = this.h[7], + _ = this.h[8], + v = this.h[9], + y = this.h[10], + R = this.h[11], + M = this.h[12], + O = this.h[13], + w = this.h[14], + I = this.h[15]; o(this.k.length === i.length); for (var D = 0; D < i.length; D += 2) { - var L = w - , F = I - , B = C(_, v) - , N = P(_, v) - , k = b(_, v, y, R, M) - , U = E(_, v, y, R, M, O) - , V = this.k[D] - , G = this.k[D + 1] - , z = i[D] - , j = i[D + 1] - , H = m(L, F, B, N, k, U, V, G, z, j) - , W = g(L, F, B, N, k, U, V, G, z, j); - L = x(n, r), - F = S(n, r), - B = T(n, r, a, s, c), - N = A(n, r, a, s, c, u); - var X = h(L, F, B, N) - , Y = f(L, F, B, N); - w = M, - I = O, - M = y, - O = R, - y = _, - R = v, - _ = h(d, p, H, W), - v = f(p, p, H, W), - d = c, - p = u, - c = a, - u = s, - a = n, - s = r, - n = h(H, W, X, Y), - r = f(H, W, X, Y) + var L = w, + F = I, + B = C(_, v), + N = P(_, v), + k = b(_, v, y, R, M), + U = E(_, v, y, R, M, O), + V = this.k[D], + G = this.k[D + 1], + z = i[D], + j = i[D + 1], + H = m(L, F, B, N, k, U, V, G, z, j), + W = g(L, F, B, N, k, U, V, G, z, j); + (L = x(n, r)), + (F = S(n, r)), + (B = T(n, r, a, s, c)), + (N = A(n, r, a, s, c, u)); + var X = h(L, F, B, N), + Y = f(L, F, B, N); + (w = M), + (I = O), + (M = y), + (O = R), + (y = _), + (R = v), + (_ = h(d, p, H, W)), + (v = f(p, p, H, W)), + (d = c), + (p = u), + (c = a), + (u = s), + (a = n), + (s = r), + (n = h(H, W, X, Y)), + (r = f(H, W, X, Y)); } l(this.h, 0, n, r), - l(this.h, 2, a, s), - l(this.h, 4, c, u), - l(this.h, 6, d, p), - l(this.h, 8, _, v), - l(this.h, 10, y, R), - l(this.h, 12, M, O), - l(this.h, 14, w, I) - } - , - y.prototype._digest = function(e) { - return "hex" === e ? n.toHex32(this.h, "big") : n.split32(this.h, "big") - } -} -, function(e, t, i) { + l(this.h, 2, a, s), + l(this.h, 4, c, u), + l(this.h, 6, d, p), + l(this.h, 8, _, v), + l(this.h, 10, y, R), + l(this.h, 12, M, O), + l(this.h, 14, w, I); + }), + (y.prototype._digest = function (e) { + return "hex" === e + ? n.toHex32(this.h, "big") + : n.split32(this.h, "big"); + }); + }, + function (e, t, i) { function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - var r = i(1) - , o = i(73).Reporter - , a = i(9).Buffer; + var r = i(1), + o = i(73).Reporter, + a = i(9).Buffer; function s(e, t) { - o.call(this, t), - a.isBuffer(e) ? (this.base = e, - this.offset = 0, - this.length = e.length) : this.error("Input not Buffer") + o.call(this, t), + a.isBuffer(e) + ? ((this.base = e), (this.offset = 0), (this.length = e.length)) + : this.error("Input not Buffer"); } function c(e, t) { - if (Array.isArray(e)) - this.length = 0, - this.value = e.map(function(e) { - return e instanceof c || (e = new c(e,t)), - this.length += e.length, - e - }, this); - else if ("number" == typeof e) { - if (!(0 <= e && e <= 255)) - return t.error("non-byte EncoderBuffer value"); - this.value = e, - this.length = 1 - } else if ("string" == typeof e) - this.value = e, - this.length = a.byteLength(e); - else { - if (!a.isBuffer(e)) - return t.error("Unsupported type: " + n(e)); - this.value = e, - this.length = e.length - } + if (Array.isArray(e)) + (this.length = 0), + (this.value = e.map(function (e) { + return ( + e instanceof c || (e = new c(e, t)), (this.length += e.length), e + ); + }, this)); + else if ("number" == typeof e) { + if (!(0 <= e && e <= 255)) + return t.error("non-byte EncoderBuffer value"); + (this.value = e), (this.length = 1); + } else if ("string" == typeof e) + (this.value = e), (this.length = a.byteLength(e)); + else { + if (!a.isBuffer(e)) return t.error("Unsupported type: " + n(e)); + (this.value = e), (this.length = e.length); + } } r(s, o), - t.DecoderBuffer = s, - s.prototype.save = function() { + (t.DecoderBuffer = s), + (s.prototype.save = function () { return { - offset: this.offset, - reporter: o.prototype.save.call(this) - } - } - , - s.prototype.restore = function(e) { + offset: this.offset, + reporter: o.prototype.save.call(this), + }; + }), + (s.prototype.restore = function (e) { var t = new s(this.base); - return t.offset = e.offset, - t.length = this.offset, - this.offset = e.offset, - o.prototype.restore.call(this, e.reporter), - t - } - , - s.prototype.isEmpty = function() { - return this.offset === this.length - } - , - s.prototype.readUInt8 = function(e) { - return this.offset + 1 <= this.length ? this.base.readUInt8(this.offset++, true) : this.error(e || "DecoderBuffer overrun") - } - , - s.prototype.skip = function(e, t) { + return ( + (t.offset = e.offset), + (t.length = this.offset), + (this.offset = e.offset), + o.prototype.restore.call(this, e.reporter), + t + ); + }), + (s.prototype.isEmpty = function () { + return this.offset === this.length; + }), + (s.prototype.readUInt8 = function (e) { + return this.offset + 1 <= this.length + ? this.base.readUInt8(this.offset++, true) + : this.error(e || "DecoderBuffer overrun"); + }), + (s.prototype.skip = function (e, t) { if (!(this.offset + e <= this.length)) - return this.error(t || "DecoderBuffer overrun"); + return this.error(t || "DecoderBuffer overrun"); var i = new s(this.base); - return i._reporterState = this._reporterState, - i.offset = this.offset, - i.length = this.offset + e, - this.offset += e, - i - } - , - s.prototype.raw = function(e) { - return this.base.slice(e ? e.offset : this.offset, this.length) - } - , - t.EncoderBuffer = c, - c.prototype.join = function(e, t) { - return e || (e = new a(this.length)), - t || (t = 0), - 0 === this.length ? e : (Array.isArray(this.value) ? this.value.forEach(function(i) { - i.join(e, t), - t += i.length - }) : ("number" == typeof this.value ? e[t] = this.value : "string" == typeof this.value ? e.write(this.value, t) : a.isBuffer(this.value) && this.value.copy(e, t), - t += this.length), - e) - } -} -, function(e, t, i) { + return ( + (i._reporterState = this._reporterState), + (i.offset = this.offset), + (i.length = this.offset + e), + (this.offset += e), + i + ); + }), + (s.prototype.raw = function (e) { + return this.base.slice(e ? e.offset : this.offset, this.length); + }), + (t.EncoderBuffer = c), + (c.prototype.join = function (e, t) { + return ( + e || (e = new a(this.length)), + t || (t = 0), + 0 === this.length + ? e + : (Array.isArray(this.value) + ? this.value.forEach(function (i) { + i.join(e, t), (t += i.length); + }) + : ("number" == typeof this.value + ? (e[t] = this.value) + : "string" == typeof this.value + ? e.write(this.value, t) + : a.isBuffer(this.value) && this.value.copy(e, t), + (t += this.length)), + e) + ); + }); + }, + function (e, t, i) { var n = t; - n._reverse = function(e) { - var t = {}; - return Object.keys(e).forEach(function(i) { - (0 | i) == i && (i |= 0); - var n = e[i]; - t[n] = i + (n._reverse = function (e) { + var t = {}; + return ( + Object.keys(e).forEach(function (i) { + (0 | i) == i && (i |= 0); + var n = e[i]; + t[n] = i; }), t - } - , - n.der = i(576) -} -, function(e, t, i) { - var n = i(1) - , r = i(72) - , o = r.base - , a = r.bignum - , s = r.constants.der; + ); + }), + (n.der = i(576)); + }, + function (e, t, i) { + var n = i(1), + r = i(72), + o = r.base, + a = r.bignum, + s = r.constants.der; function c(e) { - this.enc = "der", - this.name = e.name, - this.entity = e, - this.tree = new u, - this.tree._init(e.body) + (this.enc = "der"), + (this.name = e.name), + (this.entity = e), + (this.tree = new u()), + this.tree._init(e.body); } function u(e) { - o.Node.call(this, "der", e) + o.Node.call(this, "der", e); } function l(e, t) { - var i = e.readUInt8(t); - if (e.isError(i)) - return i; - var n = s.tagClass[i >> 6] - , r = 0 == (32 & i); - if (31 == (31 & i)) { - var o = i; - for (i = 0; 128 == (128 & o); ) { - if (o = e.readUInt8(t), - e.isError(o)) - return o; - i <<= 7, - i |= 127 & o - } - } else - i &= 31; - return { - cls: n, - primitive: r, - tag: i, - tagStr: s.tag[i] + var i = e.readUInt8(t); + if (e.isError(i)) return i; + var n = s.tagClass[i >> 6], + r = 0 == (32 & i); + if (31 == (31 & i)) { + var o = i; + for (i = 0; 128 == (128 & o); ) { + if (((o = e.readUInt8(t)), e.isError(o))) return o; + (i <<= 7), (i |= 127 & o); } + } else i &= 31; + return { + cls: n, + primitive: r, + tag: i, + tagStr: s.tag[i], + }; } function h(e, t, i) { - var n = e.readUInt8(i); - if (e.isError(n)) - return n; - if (!t && 128 === n) - return null; - if (0 == (128 & n)) - return n; - var r = 127 & n; - if (r > 4) - return e.error("length octect is too long"); - n = 0; - for (var o = 0; o < r; o++) { - n <<= 8; - var a = e.readUInt8(i); - if (e.isError(a)) - return a; - n |= a - } - return n + var n = e.readUInt8(i); + if (e.isError(n)) return n; + if (!t && 128 === n) return null; + if (0 == (128 & n)) return n; + var r = 127 & n; + if (r > 4) return e.error("length octect is too long"); + n = 0; + for (var o = 0; o < r; o++) { + n <<= 8; + var a = e.readUInt8(i); + if (e.isError(a)) return a; + n |= a; + } + return n; } - e.exports = c, - c.prototype.decode = function(e, t) { - return e instanceof o.DecoderBuffer || (e = new o.DecoderBuffer(e,t)), - this.tree._decode(e, t) - } - , - n(u, o.Node), - u.prototype._peekTag = function(e, t, i) { - if (e.isEmpty()) - return false; - var n = e.save() - , r = l(e, 'Failed to peek tag: "' + t + '"'); - return e.isError(r) ? r : (e.restore(n), - r.tag === t || r.tagStr === t || r.tagStr + "of" === t || i) - } - , - u.prototype._decodeTag = function(e, t, i) { + (e.exports = c), + (c.prototype.decode = function (e, t) { + return ( + e instanceof o.DecoderBuffer || (e = new o.DecoderBuffer(e, t)), + this.tree._decode(e, t) + ); + }), + n(u, o.Node), + (u.prototype._peekTag = function (e, t, i) { + if (e.isEmpty()) return false; + var n = e.save(), + r = l(e, 'Failed to peek tag: "' + t + '"'); + return e.isError(r) + ? r + : (e.restore(n), + r.tag === t || r.tagStr === t || r.tagStr + "of" === t || i); + }), + (u.prototype._decodeTag = function (e, t, i) { var n = l(e, 'Failed to decode tag of "' + t + '"'); - if (e.isError(n)) - return n; + if (e.isError(n)) return n; var r = h(e, n.primitive, 'Failed to get length of "' + t + '"'); - if (e.isError(r)) - return r; + if (e.isError(r)) return r; if (!i && n.tag !== t && n.tagStr !== t && n.tagStr + "of" !== t) - return e.error('Failed to match tag: "' + t + '"'); + return e.error('Failed to match tag: "' + t + '"'); if (n.primitive || null !== r) - return e.skip(r, 'Failed to match body of: "' + t + '"'); - var o = e.save() - , a = this._skipUntilEnd(e, 'Failed to skip indefinite length body: "' + this.tag + '"'); - return e.isError(a) ? a : (r = e.offset - o.offset, - e.restore(o), - e.skip(r, 'Failed to match body of: "' + t + '"')) - } - , - u.prototype._skipUntilEnd = function(e, t) { - for (; ; ) { - var i = l(e, t); - if (e.isError(i)) - return i; - var n, r = h(e, i.primitive, t); - if (e.isError(r)) - return r; - if (n = i.primitive || null !== r ? e.skip(r) : this._skipUntilEnd(e, t), + return e.skip(r, 'Failed to match body of: "' + t + '"'); + var o = e.save(), + a = this._skipUntilEnd( + e, + 'Failed to skip indefinite length body: "' + this.tag + '"' + ); + return e.isError(a) + ? a + : ((r = e.offset - o.offset), + e.restore(o), + e.skip(r, 'Failed to match body of: "' + t + '"')); + }), + (u.prototype._skipUntilEnd = function (e, t) { + for (;;) { + var i = l(e, t); + if (e.isError(i)) return i; + var n, + r = h(e, i.primitive, t); + if (e.isError(r)) return r; + if ( + ((n = + i.primitive || null !== r ? e.skip(r) : this._skipUntilEnd(e, t)), e.isError(n)) - return n; - if ("end" === i.tagStr) - break + ) + return n; + if ("end" === i.tagStr) break; } - } - , - u.prototype._decodeList = function(e, t, i, n) { + }), + (u.prototype._decodeList = function (e, t, i, n) { for (var r = []; !e.isEmpty(); ) { - var o = this._peekTag(e, "end"); - if (e.isError(o)) - return o; - var a = i.decode(e, "der", n); - if (e.isError(a) && o) - break; - r.push(a) + var o = this._peekTag(e, "end"); + if (e.isError(o)) return o; + var a = i.decode(e, "der", n); + if (e.isError(a) && o) break; + r.push(a); } - return r - } - , - u.prototype._decodeStr = function(e, t) { + return r; + }), + (u.prototype._decodeStr = function (e, t) { if ("bitstr" === t) { - var i = e.readUInt8(); - return e.isError(i) ? i : { + var i = e.readUInt8(); + return e.isError(i) + ? i + : { unused: i, - data: e.raw() - } + data: e.raw(), + }; } if ("bmpstr" === t) { - var n = e.raw(); - if (n.length % 2 == 1) - return e.error("Decoding of string type: bmpstr length mismatch"); - for (var r = "", o = 0; o < n.length / 2; o++) - r += String.fromCharCode(n.readUInt16BE(2 * o)); - return r + var n = e.raw(); + if (n.length % 2 == 1) + return e.error("Decoding of string type: bmpstr length mismatch"); + for (var r = "", o = 0; o < n.length / 2; o++) + r += String.fromCharCode(n.readUInt16BE(2 * o)); + return r; } if ("numstr" === t) { - var a = e.raw().toString("ascii"); - return this._isNumstr(a) ? a : e.error("Decoding of string type: numstr unsupported characters") + var a = e.raw().toString("ascii"); + return this._isNumstr(a) + ? a + : e.error("Decoding of string type: numstr unsupported characters"); } - if ("octstr" === t) - return e.raw(); - if ("objDesc" === t) - return e.raw(); + if ("octstr" === t) return e.raw(); + if ("objDesc" === t) return e.raw(); if ("printstr" === t) { - var s = e.raw().toString("ascii"); - return this._isPrintstr(s) ? s : e.error("Decoding of string type: printstr unsupported characters") + var s = e.raw().toString("ascii"); + return this._isPrintstr(s) + ? s + : e.error( + "Decoding of string type: printstr unsupported characters" + ); } - return /str$/.test(t) ? e.raw().toString() : e.error("Decoding of string type: " + t + " unsupported") - } - , - u.prototype._decodeObjid = function(e, t, i) { + return /str$/.test(t) + ? e.raw().toString() + : e.error("Decoding of string type: " + t + " unsupported"); + }), + (u.prototype._decodeObjid = function (e, t, i) { for (var n, r = [], o = 0; !e.isEmpty(); ) { - var a = e.readUInt8(); - o <<= 7, - o |= 127 & a, - 0 == (128 & a) && (r.push(o), - o = 0) + var a = e.readUInt8(); + (o <<= 7), (o |= 127 & a), 0 == (128 & a) && (r.push(o), (o = 0)); } 128 & a && r.push(o); - var s = r[0] / 40 | 0 - , c = r[0] % 40; - if (n = i ? r : [s, c].concat(r.slice(1)), - t) { - var u = t[n.join(" ")]; - void 0 === u && (u = t[n.join(".")]), - void 0 !== u && (n = u) + var s = (r[0] / 40) | 0, + c = r[0] % 40; + if (((n = i ? r : [s, c].concat(r.slice(1))), t)) { + var u = t[n.join(" ")]; + void 0 === u && (u = t[n.join(".")]), void 0 !== u && (n = u); } - return n - } - , - u.prototype._decodeTime = function(e, t) { + return n; + }), + (u.prototype._decodeTime = function (e, t) { var i = e.raw().toString(); if ("gentime" === t) - var n = 0 | i.slice(0, 4) - , r = 0 | i.slice(4, 6) - , o = 0 | i.slice(6, 8) - , a = 0 | i.slice(8, 10) - , s = 0 | i.slice(10, 12) - , c = 0 | i.slice(12, 14); + var n = 0 | i.slice(0, 4), + r = 0 | i.slice(4, 6), + o = 0 | i.slice(6, 8), + a = 0 | i.slice(8, 10), + s = 0 | i.slice(10, 12), + c = 0 | i.slice(12, 14); else { - if ("utctime" !== t) - return e.error("Decoding " + t + " time is not supported yet"); - n = 0 | i.slice(0, 2), - r = 0 | i.slice(2, 4), - o = 0 | i.slice(4, 6), - a = 0 | i.slice(6, 8), - s = 0 | i.slice(8, 10), - c = 0 | i.slice(10, 12); - n = n < 70 ? 2e3 + n : 1900 + n + if ("utctime" !== t) + return e.error("Decoding " + t + " time is not supported yet"); + (n = 0 | i.slice(0, 2)), + (r = 0 | i.slice(2, 4)), + (o = 0 | i.slice(4, 6)), + (a = 0 | i.slice(6, 8)), + (s = 0 | i.slice(8, 10)), + (c = 0 | i.slice(10, 12)); + n = n < 70 ? 2e3 + n : 1900 + n; } - return Date.UTC(n, r - 1, o, a, s, c, 0) - } - , - u.prototype._decodeNull = function(e) { - return null - } - , - u.prototype._decodeBool = function(e) { + return Date.UTC(n, r - 1, o, a, s, c, 0); + }), + (u.prototype._decodeNull = function (e) { + return null; + }), + (u.prototype._decodeBool = function (e) { var t = e.readUInt8(); - return e.isError(t) ? t : 0 !== t - } - , - u.prototype._decodeInt = function(e, t) { - var i = e.raw() - , n = new a(i); - return t && (n = t[n.toString(10)] || n), - n - } - , - u.prototype._use = function(e, t) { - return "function" == typeof e && (e = e(t)), - e._getDecoder("der").tree - } -} -, function(e, t, i) { - var n = i(1) - , r = i(9).Buffer - , o = i(72) - , a = o.base - , s = o.constants.der; + return e.isError(t) ? t : 0 !== t; + }), + (u.prototype._decodeInt = function (e, t) { + var i = e.raw(), + n = new a(i); + return t && (n = t[n.toString(10)] || n), n; + }), + (u.prototype._use = function (e, t) { + return "function" == typeof e && (e = e(t)), e._getDecoder("der").tree; + }); + }, + function (e, t, i) { + var n = i(1), + r = i(9).Buffer, + o = i(72), + a = o.base, + s = o.constants.der; function c(e) { - this.enc = "der", - this.name = e.name, - this.entity = e, - this.tree = new u, - this.tree._init(e.body) + (this.enc = "der"), + (this.name = e.name), + (this.entity = e), + (this.tree = new u()), + this.tree._init(e.body); } function u(e) { - a.Node.call(this, "der", e) + a.Node.call(this, "der", e); } function l(e) { - return e < 10 ? "0" + e : e + return e < 10 ? "0" + e : e; } - e.exports = c, - c.prototype.encode = function(e, t) { - return this.tree._encode(e, t).join() - } - , - n(u, a.Node), - u.prototype._encodeComposite = function(e, t, i, n) { - var o, a = function(e, t, i, n) { + (e.exports = c), + (c.prototype.encode = function (e, t) { + return this.tree._encode(e, t).join(); + }), + n(u, a.Node), + (u.prototype._encodeComposite = function (e, t, i, n) { + var o, + a = (function (e, t, i, n) { var r; - "seqof" === e ? e = "seq" : "setof" === e && (e = "set"); - if (s.tagByName.hasOwnProperty(e)) - r = s.tagByName[e]; + "seqof" === e ? (e = "seq") : "setof" === e && (e = "set"); + if (s.tagByName.hasOwnProperty(e)) r = s.tagByName[e]; else { - if ("number" != typeof e || (0 | e) !== e) - return n.error("Unknown tag: " + e); - r = e + if ("number" != typeof e || (0 | e) !== e) + return n.error("Unknown tag: " + e); + r = e; } - if (r >= 31) - return n.error("Multi-octet tag encoding unsupported"); + if (r >= 31) return n.error("Multi-octet tag encoding unsupported"); t || (r |= 32); - return r |= s.tagClassByName[i || "universal"] << 6 - }(e, t, i, this.reporter); + return (r |= s.tagClassByName[i || "universal"] << 6); + })(e, t, i, this.reporter); if (n.length < 128) - return (o = new r(2))[0] = a, - o[1] = n.length, - this._createEncoderBuffer([o, n]); - for (var c = 1, u = n.length; u >= 256; u >>= 8) - c++; - (o = new r(2 + c))[0] = a, - o[1] = 128 | c; + return ( + ((o = new r(2))[0] = a), + (o[1] = n.length), + this._createEncoderBuffer([o, n]) + ); + for (var c = 1, u = n.length; u >= 256; u >>= 8) c++; + ((o = new r(2 + c))[0] = a), (o[1] = 128 | c); u = 1 + c; - for (var l = n.length; l > 0; u--, - l >>= 8) - o[u] = 255 & l; - return this._createEncoderBuffer([o, n]) - } - , - u.prototype._encodeStr = function(e, t) { + for (var l = n.length; l > 0; u--, l >>= 8) o[u] = 255 & l; + return this._createEncoderBuffer([o, n]); + }), + (u.prototype._encodeStr = function (e, t) { if ("bitstr" === t) - return this._createEncoderBuffer([0 | e.unused, e.data]); + return this._createEncoderBuffer([0 | e.unused, e.data]); if ("bmpstr" === t) { - for (var i = new r(2 * e.length), n = 0; n < e.length; n++) - i.writeUInt16BE(e.charCodeAt(n), 2 * n); - return this._createEncoderBuffer(i) + for (var i = new r(2 * e.length), n = 0; n < e.length; n++) + i.writeUInt16BE(e.charCodeAt(n), 2 * n); + return this._createEncoderBuffer(i); } - return "numstr" === t ? this._isNumstr(e) ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: numstr supports only digits and space") : "printstr" === t ? this._isPrintstr(e) ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark") : /str$/.test(t) ? this._createEncoderBuffer(e) : "objDesc" === t ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: " + t + " unsupported") - } - , - u.prototype._encodeObjid = function(e, t, i) { + return "numstr" === t + ? this._isNumstr(e) + ? this._createEncoderBuffer(e) + : this.reporter.error( + "Encoding of string type: numstr supports only digits and space" + ) + : "printstr" === t + ? this._isPrintstr(e) + ? this._createEncoderBuffer(e) + : this.reporter.error( + "Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark" + ) + : /str$/.test(t) + ? this._createEncoderBuffer(e) + : "objDesc" === t + ? this._createEncoderBuffer(e) + : this.reporter.error( + "Encoding of string type: " + t + " unsupported" + ); + }), + (u.prototype._encodeObjid = function (e, t, i) { if ("string" == typeof e) { - if (!t) - return this.reporter.error("string objid given, but no values map found"); - if (!t.hasOwnProperty(e)) - return this.reporter.error("objid not found in values map"); - e = t[e].split(/[\s\.]+/g); - for (var n = 0; n < e.length; n++) - e[n] |= 0 + if (!t) + return this.reporter.error( + "string objid given, but no values map found" + ); + if (!t.hasOwnProperty(e)) + return this.reporter.error("objid not found in values map"); + e = t[e].split(/[\s\.]+/g); + for (var n = 0; n < e.length; n++) e[n] |= 0; } else if (Array.isArray(e)) { - e = e.slice(); - for (n = 0; n < e.length; n++) - e[n] |= 0 + e = e.slice(); + for (n = 0; n < e.length; n++) e[n] |= 0; } if (!Array.isArray(e)) - return this.reporter.error("objid() should be either array or string, got: " + JSON.stringify(e)); + return this.reporter.error( + "objid() should be either array or string, got: " + + JSON.stringify(e) + ); if (!i) { - if (e[1] >= 40) - return this.reporter.error("Second objid identifier OOB"); - e.splice(0, 2, 40 * e[0] + e[1]) + if (e[1] >= 40) + return this.reporter.error("Second objid identifier OOB"); + e.splice(0, 2, 40 * e[0] + e[1]); } var o = 0; for (n = 0; n < e.length; n++) { - var a = e[n]; - for (o++; a >= 128; a >>= 7) - o++ + var a = e[n]; + for (o++; a >= 128; a >>= 7) o++; } - var s = new r(o) - , c = s.length - 1; + var s = new r(o), + c = s.length - 1; for (n = e.length - 1; n >= 0; n--) { - a = e[n]; - for (s[c--] = 127 & a; (a >>= 7) > 0; ) - s[c--] = 128 | 127 & a + a = e[n]; + for (s[c--] = 127 & a; (a >>= 7) > 0; ) s[c--] = 128 | (127 & a); } - return this._createEncoderBuffer(s) - } - , - u.prototype._encodeTime = function(e, t) { - var i, n = new Date(e); - return "gentime" === t ? i = [l(n.getFullYear()), l(n.getUTCMonth() + 1), l(n.getUTCDate()), l(n.getUTCHours()), l(n.getUTCMinutes()), l(n.getUTCSeconds()), "Z"].join("") : "utctime" === t ? i = [l(n.getFullYear() % 100), l(n.getUTCMonth() + 1), l(n.getUTCDate()), l(n.getUTCHours()), l(n.getUTCMinutes()), l(n.getUTCSeconds()), "Z"].join("") : this.reporter.error("Encoding " + t + " time is not supported yet"), - this._encodeStr(i, "octstr") - } - , - u.prototype._encodeNull = function() { - return this._createEncoderBuffer("") - } - , - u.prototype._encodeInt = function(e, t) { + return this._createEncoderBuffer(s); + }), + (u.prototype._encodeTime = function (e, t) { + var i, + n = new Date(e); + return ( + "gentime" === t + ? (i = [ + l(n.getFullYear()), + l(n.getUTCMonth() + 1), + l(n.getUTCDate()), + l(n.getUTCHours()), + l(n.getUTCMinutes()), + l(n.getUTCSeconds()), + "Z", + ].join("")) + : "utctime" === t + ? (i = [ + l(n.getFullYear() % 100), + l(n.getUTCMonth() + 1), + l(n.getUTCDate()), + l(n.getUTCHours()), + l(n.getUTCMinutes()), + l(n.getUTCSeconds()), + "Z", + ].join("")) + : this.reporter.error( + "Encoding " + t + " time is not supported yet" + ), + this._encodeStr(i, "octstr") + ); + }), + (u.prototype._encodeNull = function () { + return this._createEncoderBuffer(""); + }), + (u.prototype._encodeInt = function (e, t) { if ("string" == typeof e) { - if (!t) - return this.reporter.error("String int or enum given, but no values map"); - if (!t.hasOwnProperty(e)) - return this.reporter.error("Values map doesn't contain: " + JSON.stringify(e)); - e = t[e] + if (!t) + return this.reporter.error( + "String int or enum given, but no values map" + ); + if (!t.hasOwnProperty(e)) + return this.reporter.error( + "Values map doesn't contain: " + JSON.stringify(e) + ); + e = t[e]; } if ("number" != typeof e && !r.isBuffer(e)) { - var i = e.toArray(); - !e.sign && 128 & i[0] && i.unshift(0), - e = new r(i) + var i = e.toArray(); + !e.sign && 128 & i[0] && i.unshift(0), (e = new r(i)); } if (r.isBuffer(e)) { - var n = e.length; - 0 === e.length && n++; - var o = new r(n); - return e.copy(o), + var n = e.length; + 0 === e.length && n++; + var o = new r(n); + return ( + e.copy(o), 0 === e.length && (o[0] = 0), this._createEncoderBuffer(o) + ); } - if (e < 128) - return this._createEncoderBuffer(e); - if (e < 256) - return this._createEncoderBuffer([0, e]); + if (e < 128) return this._createEncoderBuffer(e); + if (e < 256) return this._createEncoderBuffer([0, e]); n = 1; - for (var a = e; a >= 256; a >>= 8) - n++; + for (var a = e; a >= 256; a >>= 8) n++; for (a = (o = new Array(n)).length - 1; a >= 0; a--) - o[a] = 255 & e, - e >>= 8; - return 128 & o[0] && o.unshift(0), - this._createEncoderBuffer(new r(o)) - } - , - u.prototype._encodeBool = function(e) { - return this._createEncoderBuffer(e ? 255 : 0) - } - , - u.prototype._use = function(e, t) { - return "function" == typeof e && (e = e(t)), - e._getEncoder("der").tree - } - , - u.prototype._skipDefault = function(e, t, i) { - var n, r = this._baseState; - if (null === r.default) - return false; + (o[a] = 255 & e), (e >>= 8); + return 128 & o[0] && o.unshift(0), this._createEncoderBuffer(new r(o)); + }), + (u.prototype._encodeBool = function (e) { + return this._createEncoderBuffer(e ? 255 : 0); + }), + (u.prototype._use = function (e, t) { + return "function" == typeof e && (e = e(t)), e._getEncoder("der").tree; + }), + (u.prototype._skipDefault = function (e, t, i) { + var n, + r = this._baseState; + if (null === r.default) return false; var o = e.join(); - if (void 0 === r.defaultBuffer && (r.defaultBuffer = this._encodeValue(r.default, t, i).join()), - o.length !== r.defaultBuffer.length) - return false; + if ( + (void 0 === r.defaultBuffer && + (r.defaultBuffer = this._encodeValue(r.default, t, i).join()), + o.length !== r.defaultBuffer.length) + ) + return false; for (n = 0; n < o.length; n++) - if (o[n] !== r.defaultBuffer[n]) - return false; - return true - } -} -, function(e) { + if (o[n] !== r.defaultBuffer[n]) return false; + return true; + }); + }, + function (e) { e.exports = { - "1.3.132.0.10": "secp256k1", - "1.3.132.0.33": "p224", - "1.2.840.10045.3.1.1": "p192", - "1.2.840.10045.3.1.7": "p256", - "1.3.132.0.34": "p384", - "1.3.132.0.35": "p521" - } -} -, function(e, t, i) { - var n = i(69) - , r = i(2).Buffer; + "1.3.132.0.10": "secp256k1", + "1.3.132.0.33": "p224", + "1.2.840.10045.3.1.1": "p192", + "1.2.840.10045.3.1.7": "p256", + "1.3.132.0.34": "p384", + "1.3.132.0.35": "p521", + }; + }, + function (e, t, i) { + var n = i(69), + r = i(2).Buffer; function o(e) { - var t = r.allocUnsafe(4); - return t.writeUInt32BE(e, 0), - t + var t = r.allocUnsafe(4); + return t.writeUInt32BE(e, 0), t; } - e.exports = function(e, t) { - for (var i, a = r.alloc(0), s = 0; a.length < t; ) - i = o(s++), - a = r.concat([a, n("sha1").update(e).update(i).digest()]); - return a.slice(0, t) - } -} -, function(e, t) { - e.exports = function(e, t) { - for (var i = e.length, n = -1; ++n < i; ) - e[n] ^= t[n]; - return e - } -} -, function(e, t, i) { - var n = i(11) - , r = i(2).Buffer; - e.exports = function(e, t) { - return r.from(e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed().toArray()) - } -} -, function(e, t, i) { + e.exports = function (e, t) { + for (var i, a = r.alloc(0), s = 0; a.length < t; ) + (i = o(s++)), + (a = r.concat([a, n("sha1").update(e).update(i).digest()])); + return a.slice(0, t); + }; + }, + function (e, t) { + e.exports = function (e, t) { + for (var i = e.length, n = -1; ++n < i; ) e[n] ^= t[n]; + return e; + }; + }, + function (e, t, i) { + var n = i(11), + r = i(2).Buffer; + e.exports = function (e, t) { + return r.from( + e + .toRed(n.mont(t.modulus)) + .redPow(new n(t.publicExponent)) + .fromRed() + .toArray() + ); + }; + }, + function (e, t, i) { "use strict"; - (function(e) { - var n = i(93) - , r = i.n(n) - , o = i(55) - , a = i(18) - , s = i(7) - , c = i(227); - function u(e, t, i) { - return t in e ? Object.defineProperty(e, t, { + (function (e) { + var n = i(93), + r = i.n(n), + o = i(55), + a = i(18), + s = i(7), + c = i(227); + function u(e, t, i) { + return ( + t in e + ? Object.defineProperty(e, t, { value: i, enumerable: true, configurable: true, - writable: true - }) : e[t] = i, - e + writable: true, + }) + : (e[t] = i), + e + ); + } + function l(e) { + return ( + (function (e) { + if (Array.isArray(e)) { + for (var t = 0, i = new Array(e.length); t < e.length; t++) + i[t] = e[t]; + return i; + } + })(e) || + (function (e) { + if ( + Symbol.iterator in Object(e) || + "[object Arguments]" === Object.prototype.toString.call(e) + ) + return Array.from(e); + })(e) || + (function () { + throw new TypeError( + "Invalid attempt to spread non-iterable instance" + ); + })() + ); + } + function h(e, t) { + for (var i = 0; i < t.length; i++) { + var n = t[i]; + (n.enumerable = n.enumerable || false), + (n.configurable = true), + "value" in n && (n.writable = true), + Object.defineProperty(e, n.key, n); } - function l(e) { - return function(e) { - if (Array.isArray(e)) { - for (var t = 0, i = new Array(e.length); t < e.length; t++) - i[t] = e[t]; - return i + } + var f = (function () { + function t(e) { + !(function (e, t) { + if (!(e instanceof t)) + throw new TypeError("Cannot call a class as a function"); + })(this, t), + this.initializeState(e), + (this.welcomeInfoResolve = null), + (this.peer = null); + } + var i, n, f; + return ( + (i = t), + (n = [ + { + key: "initializeState", + value: function (e) { + this.state = { + code: e.code, + name: e.name, + connected: false, + connecting: false, + gameStarted: false, + error: "", + host: null, + players: [], + game: e.game, + changedBlocks: [], + enqueuedChangedBlocks: [], + chatLog: [], + }; + }, + }, + { + key: "handleData", + value: function (e) { + switch (e.type) { + case "startGame": + this.setState({ + gameStarted: true, + }); + break; + case "players": + this.handlePlayers(e.players); + break; + case "changedBlocks": + this.handleChangedBlocks(e); + break; + case "fireEvent": + this.state.game.handleFireEvent(e.data); + break; + case "chatLog": + this.handleChatLog(e.chatLog); + break; + case "welcomeInfo": + this.handleWelcomeInfo(e); + break; + case "kicked": + this.handleOnKicked(); + break; + default: + throw Error("Unknown input type " + e.type); } - }(e) || function(e) { - if (Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e)) - return Array.from(e) - }(e) || function() { - throw new TypeError("Invalid attempt to spread non-iterable instance") - }() - } - function h(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n.enumerable = n.enumerable || false, - n.configurable = true, - "value"in n && (n.writable = true), - Object.defineProperty(e, n.key, n) - } - } - var f = function() { - function t(e) { - !function(e, t) { - if (!(e instanceof t)) - throw new TypeError("Cannot call a class as a function") - }(this, t), - this.initializeState(e), - this.welcomeInfoResolve = null, - this.peer = null - } - var i, n, f; - return i = t, - (n = [{ - key: "initializeState", - value: function(e) { - this.state = { - code: e.code, - name: e.name, - connected: false, + }, + }, + { + key: "handleChangedBlocks", + value: function (e) { + if (e.blocks.length || !this.state.game.playerSpawned) + if (this.state.game.worldGenerated) { + if (this.state.enqueuedChangedBlocks.length) { + (this.state.changedBlocks = + this.state.enqueuedChangedBlocks.splice(0)), + this.state.game.handleChangedBlocks( + this.state.changedBlocks + ); + for (var t = 0; t < this.state.changedBlocks.length; t++) + s.default + .getInstance() + .addBlockChange(this.state.changedBlocks[t]); + } + for (var i = 0; i < e.blocks.length; i++) + void 0 === this.state.changedBlocks[e.from + i] && + ((this.state.changedBlocks[e.from + i] = e.blocks[i]), + s.default.getInstance().addBlockChange(e.blocks[i])); + this.state.game.handleChangedBlocks(e.blocks); + } else + this.state.enqueuedChangedBlocks = l( + this.state.enqueuedChangedBlocks + ).concat(l(e.blocks)); + }, + }, + { + key: "broadcast", + value: function (e) { + this.peer.connected && this.peer.send(JSON.stringify(e)); + }, + }, + { + key: "joinGame", + value: function () { + var t = this; + return new e(function (e, i) { + t.setState({ + error: "", + connecting: true, + }); + var n = t.state, + r = n.code; + n.database; + a.a.getGame(r).then(function (i) { + null == i + ? t.handleNoSuchGame(e, r) + : t.handleJoinExistingGame(r, e); + }); + }); + }, + }, + { + key: "handleJoinExistingGame", + value: function (e, t) { + var i = this; + a.a.getICECandidates(e).then(function (n) { + var o = c(8); + a.a.joinSignalingChannel(e, o).then(function () { + var s = new r.a({ + initiator: true, + trickle: false, + reconnectTimer: 3e3, + config: { + iceServers: n, + }, + }); + (i.peer = s), + s.on("signal", function (t) { + a.a + .sendSignalingTo(e, "host", o, t) + .then(function () {}); + }), + a.a.listenForData(e, function (e) { + void 0 !== e.payload.signal && + s.signal(e.payload.signal); + }), + s.on("data", function (e) { + i.handleData(JSON.parse(e)); + }), + i.handleConnectionEstablished(s, t, e), + i.pollWorldChanges(), + i.handleHostDisconnected(s, e), + s.on("error", function (e) { + "ERR_ICE_CONNECTION_FAILURE" === e.code && + (console.log("Host disconnected!"), + console.log(e), + console.log(this)); + }); + }); + }); + }, + }, + { + key: "handleHostDisconnected", + value: function (e, t) { + var i = this; + e.on("close", function () { + i.setState({ + gameStarted: false, + connected: false, + error: "Disconnected from host", + code: "", + }), + i.removeOtherPlayers(); + }); + }, + }, + { + key: "handleConnectionEstablished", + value: function (e, t, i) { + var n = this; + e.on("connect", function () { + setTimeout(function () { + n.broadcast({ + type: "connected", + }), + n.setState({ + connected: true, connecting: false, - gameStarted: false, - error: "", - host: null, - players: [], - game: e.game, - changedBlocks: [], - enqueuedChangedBlocks: [], - chatLog: [] - } - } - }, { - key: "handleData", - value: function(e) { - switch (e.type) { - case "startGame": - this.setState({ - gameStarted: true + }); + }, 1e3), + t(i); + }); + }, + }, + { + key: "pollWorldChanges", + value: function () { + var e = this; + setInterval(function () { + var t = e.state.changedBlocks.length + ? e.state.changedBlocks.length + : e.state.enqueuedChangedBlocks.length; + e.broadcast({ + type: "requestChanges", + from: t, + }); + }, 1e3); + }, + }, + { + key: "handleNoSuchGame", + value: function (e, t) { + this.handleWelcomeInfo({ + hostName: "no host", + gameFull: true, + playerCount: 0, + maxPlayers: 0, + worldSeed: 0, + noSuchGame: true, + worldSize: 128, + numberOfChangedBlocks: 0, + }), + e(t); + }, + }, + { + key: "getWelcomeInfo", + value: function () { + var t = this; + return new e(function (e, i) { + t.welcomeInfoResolve = e; + }); + }, + }, + { + key: "getSpawnedPlayerNames", + value: function () { + var e = [this.state.name]; + for (var t in this.state.players) + this.state.players[t].state.spawned && + e.push(this.state.players[t].state.name); + return e; + }, + }, + { + key: "setBlockAt", + value: function (e, t) { + this.broadcast({ + type: "setBlockTypeAt", + data: { + position: e, + blockTypeId: t, + }, + }); + }, + }, + { + key: "emitFireEvent", + value: function (e) { + this.broadcast({ + type: "fireEvent", + data: e, + }); + }, + }, + { + key: "sendJoined", + value: function (e) { + var t = { + message: "", + timestamp: +new Date(), + type: "joined", + from: e, + }; + this.broadcast({ + type: "message", + message: t, + }); + }, + }, + { + key: "sendMessage", + value: function (e) { + var t = { + message: e, + timestamp: +new Date(), + type: "message", + from: this.state.name, + }; + this.broadcast({ + type: "message", + message: t, + }); + }, + }, + { + key: "setState", + value: function (e, t) { + "Disconnected from host" == e.error && + this.state.game.onHostDisconnect && + this.state.game.onHostDisconnect(), + (this.state = (function (e) { + for (var t = 1; t < arguments.length; t++) { + var i = null != arguments[t] ? arguments[t] : {}, + n = Object.keys(i); + "function" == typeof Object.getOwnPropertySymbols && + (n = n.concat( + Object.getOwnPropertySymbols(i).filter(function (e) { + return Object.getOwnPropertyDescriptor( + i, + e + ).enumerable; + }) + )), + n.forEach(function (t) { + u(e, t, i[t]); }); - break; - case "players": - this.handlePlayers(e.players); - break; - case "changedBlocks": - this.handleChangedBlocks(e); - break; - case "fireEvent": - this.state.game.handleFireEvent(e.data); - break; - case "chatLog": - this.handleChatLog(e.chatLog); - break; - case "welcomeInfo": - this.handleWelcomeInfo(e); - break; - case "kicked": - this.handleOnKicked(); - break; - default: - throw Error("Unknown input type " + e.type) } - } - }, { - key: "handleChangedBlocks", - value: function(e) { - if (e.blocks.length || !this.state.game.playerSpawned) - if (this.state.game.worldGenerated) { - if (this.state.enqueuedChangedBlocks.length) { - this.state.changedBlocks = this.state.enqueuedChangedBlocks.splice(0), - this.state.game.handleChangedBlocks(this.state.changedBlocks); - for (var t = 0; t < this.state.changedBlocks.length; t++) - s.default.getInstance().addBlockChange(this.state.changedBlocks[t]) - } - for (var i = 0; i < e.blocks.length; i++) - void 0 === this.state.changedBlocks[e.from + i] && (this.state.changedBlocks[e.from + i] = e.blocks[i], - s.default.getInstance().addBlockChange(e.blocks[i])); - this.state.game.handleChangedBlocks(e.blocks) - } else - this.state.enqueuedChangedBlocks = l(this.state.enqueuedChangedBlocks).concat(l(e.blocks)) - } - }, { - key: "broadcast", - value: function(e) { - this.peer.connected && this.peer.send(JSON.stringify(e)) - } - }, { - key: "joinGame", - value: function() { - var t = this; - return new e(function(e, i) { - t.setState({ - error: "", - connecting: true - }); - var n = t.state - , r = n.code; - n.database; - a.a.getGame(r).then(function(i) { - null == i ? t.handleNoSuchGame(e, r) : t.handleJoinExistingGame(r, e) - }) + return e; + })({}, this.state, e)), + t && "function" == typeof t && t(); + }, + }, + { + key: "removeOtherPlayers", + value: function () { + for (var e in this.state.players) + e !== this.state.name && + (this.state.players[e].noaPlayer.remove(), + delete this.state.players[e]); + }, + }, + { + key: "handlePlayers", + value: function (e) { + if (this.state.game.playerSpawned) { + var t = []; + for (var i in e) + if (true === e[i].state.spawned) { + var n = e[i].state.name; + t.push(n), + n !== this.state.name && + void 0 === this.state.players[n] && + (this.state.players[n] = new o.a({ + name: n, + isClient: true, + })), + n !== this.state.name && + this.state.players[n].setState(e[i].state); } - ) + for (var r in this.state.players) + -1 === t.indexOf(r) && + (this.state.players[r].noaPlayer.remove(), + delete this.state.players[r]); } - }, { - key: "handleJoinExistingGame", - value: function(e, t) { - var i = this; - a.a.getICECandidates(e).then(function(n) { - var o = c(8); - a.a.joinSignalingChannel(e, o).then(function() { - var s = new r.a({ - initiator: true, - trickle: false, - reconnectTimer: 3e3, - config: { - iceServers: n - } - }); - i.peer = s, - s.on("signal", function(t) { - a.a.sendSignalingTo(e, "host", o, t).then(function() {}) - }), - a.a.listenForData(e, function(e) { - void 0 !== e.payload.signal && s.signal(e.payload.signal) - }), - s.on("data", function(e) { - i.handleData(JSON.parse(e)) - }), - i.handleConnectionEstablished(s, t, e), - i.pollWorldChanges(), - i.handleHostDisconnected(s, e), - s.on("error", function(e) { - "ERR_ICE_CONNECTION_FAILURE" === e.code && (console.log("Host disconnected!"), - console.log(e), - console.log(this)) - }) - }) - }) - } - }, { - key: "handleHostDisconnected", - value: function(e, t) { - var i = this; - e.on("close", function() { - i.setState({ - gameStarted: false, - connected: false, - error: "Disconnected from host", - code: "" - }), - i.removeOtherPlayers() - }) - } - }, { - key: "handleConnectionEstablished", - value: function(e, t, i) { - var n = this; - e.on("connect", function() { - setTimeout(function() { - n.broadcast({ - type: "connected" - }), - n.setState({ - connected: true, - connecting: false - }) - }, 1e3), - t(i) - }) - } - }, { - key: "pollWorldChanges", - value: function() { - var e = this; - setInterval(function() { - var t = e.state.changedBlocks.length ? e.state.changedBlocks.length : e.state.enqueuedChangedBlocks.length; - e.broadcast({ - type: "requestChanges", - from: t - }) - }, 1e3) - } - }, { - key: "handleNoSuchGame", - value: function(e, t) { - this.handleWelcomeInfo({ - hostName: "no host", - gameFull: true, - playerCount: 0, - maxPlayers: 0, - worldSeed: 0, - noSuchGame: true, - worldSize: 128, - numberOfChangedBlocks: 0 - }), - e(t) - } - }, { - key: "getWelcomeInfo", - value: function() { - var t = this; - return new e(function(e, i) { - t.welcomeInfoResolve = e - } - ) - } - }, { - key: "getSpawnedPlayerNames", - value: function() { - var e = [this.state.name]; - for (var t in this.state.players) - this.state.players[t].state.spawned && e.push(this.state.players[t].state.name); - return e - } - }, { - key: "setBlockAt", - value: function(e, t) { - this.broadcast({ - type: "setBlockTypeAt", - data: { - position: e, - blockTypeId: t - } - }) - } - }, { - key: "emitFireEvent", - value: function(e) { - this.broadcast({ - type: "fireEvent", - data: e - }) - } - }, { - key: "sendJoined", - value: function(e) { - var t = { - message: "", - timestamp: +new Date, - type: "joined", - from: e - }; - this.broadcast({ - type: "message", - message: t - }) - } - }, { - key: "sendMessage", - value: function(e) { - var t = { - message: e, - timestamp: +new Date, - type: "message", - from: this.state.name - }; - this.broadcast({ - type: "message", - message: t - }) - } - }, { - key: "setState", - value: function(e, t) { - "Disconnected from host" == e.error && this.state.game.onHostDisconnect && this.state.game.onHostDisconnect(), - this.state = function(e) { - for (var t = 1; t < arguments.length; t++) { - var i = null != arguments[t] ? arguments[t] : {} - , n = Object.keys(i); - "function" == typeof Object.getOwnPropertySymbols && (n = n.concat(Object.getOwnPropertySymbols(i).filter(function(e) { - return Object.getOwnPropertyDescriptor(i, e).enumerable - }))), - n.forEach(function(t) { - u(e, t, i[t]) - }) - } - return e - }({}, this.state, e), - t && "function" == typeof t && t() - } - }, { - key: "removeOtherPlayers", - value: function() { - for (var e in this.state.players) - e !== this.state.name && (this.state.players[e].noaPlayer.remove(), - delete this.state.players[e]) - } - }, { - key: "handlePlayers", - value: function(e) { - if (this.state.game.playerSpawned) { - var t = []; - for (var i in e) - if (true === e[i].state.spawned) { - var n = e[i].state.name; - t.push(n), - n !== this.state.name && void 0 === this.state.players[n] && (this.state.players[n] = new o.a({ - name: n, - isClient: true - })), - n !== this.state.name && this.state.players[n].setState(e[i].state) - } - for (var r in this.state.players) - -1 === t.indexOf(r) && (this.state.players[r].noaPlayer.remove(), - delete this.state.players[r]) - } - } - }, { - key: "kickPlayer", - value: function(e) { - return "Command not allowed" - } - }, { - key: "setSpawnToCurrentPosition", - value: function() { - return "Command not allowed" - } - }, { - key: "getPositionFor", - value: function(e) { - for (var t in this.state.players) - if (this.state.players[t].state.name === e) - return this.state.players[t].state.position; - return null - } - }, { - key: "handleChatLog", - value: function(e) { - this.state.game.playerSpawned && (this.state.chatLog = e, - this.state.game.updateChatLog(this.state.chatLog)) - } - }, { - key: "handleOnKicked", - value: function() { - this.state.game.playerSpawned && this.state.game.onKicked() - } - }, { - key: "handleWelcomeInfo", - value: function(e) { - null != this.welcomeInfoResolve && this.welcomeInfoResolve(e), - this.state.game.setHostInfo({ - hostName: e.hostName, - gameFull: e.gameFull, - playerCount: e.playerCount, - maxPlayers: e.maxPlayers, - worldSeed: e.worldSeed, - worldSize: e.worldSize, - spawnPoint: e.spawnPoint, - noSuchGame: void 0 !== e.noSuchGame && e.noSuchGame, - numberOfChangedBlocks: e.numberOfChangedBlocks - }), - e.gameFull && this.peer.destroy() - } - }]) && h(i.prototype, n), - f && h(i, f), - t - }(); - t.a = f - } - ).call(this, i(41)) -} -, function(e, t, i) { - (function(t) { - var n = i(513); - e.exports = function(e, i) { - if (t.isBuffer(e) && (i = e, - e = 0), - "number" != typeof e && (e = 16), - !t.isBuffer(i)) { - var r = Math.log(Math.pow(64, e)) / Math.log(2) / 8; - i = n.randomBytes(r) - } - return i.toString("base64").replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "").substr(0, e || void 0) + }, + }, + { + key: "kickPlayer", + value: function (e) { + return "Command not allowed"; + }, + }, + { + key: "setSpawnToCurrentPosition", + value: function () { + return "Command not allowed"; + }, + }, + { + key: "getPositionFor", + value: function (e) { + for (var t in this.state.players) + if (this.state.players[t].state.name === e) + return this.state.players[t].state.position; + return null; + }, + }, + { + key: "handleChatLog", + value: function (e) { + this.state.game.playerSpawned && + ((this.state.chatLog = e), + this.state.game.updateChatLog(this.state.chatLog)); + }, + }, + { + key: "handleOnKicked", + value: function () { + this.state.game.playerSpawned && this.state.game.onKicked(); + }, + }, + { + key: "handleWelcomeInfo", + value: function (e) { + null != this.welcomeInfoResolve && this.welcomeInfoResolve(e), + this.state.game.setHostInfo({ + hostName: e.hostName, + gameFull: e.gameFull, + playerCount: e.playerCount, + maxPlayers: e.maxPlayers, + worldSeed: e.worldSeed, + worldSize: e.worldSize, + spawnPoint: e.spawnPoint, + noSuchGame: void 0 !== e.noSuchGame && e.noSuchGame, + numberOfChangedBlocks: e.numberOfChangedBlocks, + }), + e.gameFull && this.peer.destroy(); + }, + }, + ]) && h(i.prototype, n), + f && h(i, f), + t + ); + })(); + t.a = f; + }.call(this, i(41))); + }, + function (e, t, i) { + (function (t) { + var n = i(513); + e.exports = function (e, i) { + if ( + (t.isBuffer(e) && ((i = e), (e = 0)), + "number" != typeof e && (e = 16), + !t.isBuffer(i)) + ) { + var r = Math.log(Math.pow(64, e)) / Math.log(2) / 8; + i = n.randomBytes(r); } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { + return i + .toString("base64") + .replace(/\//g, "_") + .replace(/\+/g, "-") + .replace(/=/g, "") + .substr(0, e || void 0); + }; + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { "use strict"; i.r(t); - i(229), - i(396); - var n = i(18) - , r = i(137) - , o = i(226) - , a = i(94) - , s = i(55) - , c = i(136) - , u = i(7); + i(229), i(396); + var n = i(18), + r = i(137), + o = i(226), + a = i(94), + s = i(55), + c = i(136), + u = i(7); function l(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n.enumerable = n.enumerable || false, - n.configurable = true, - "value"in n && (n.writable = true), - Object.defineProperty(e, n.key, n) - } + for (var i = 0; i < t.length; i++) { + var n = t[i]; + (n.enumerable = n.enumerable || false), + (n.configurable = true), + "value" in n && (n.writable = true), + Object.defineProperty(e, n.key, n); + } } - new (function() { - function e() { - var t = this; - !function(e, t) { - if (!(e instanceof t)) - throw new TypeError("Cannot call a class as a function") - }(this, e), - n.a.init(), - n.a.executeXhr("/game/multiplayer-enabled", "get").then(function(e) { - var i = new a.a - , n = Math.floor(99999999999999 * Math.random()) - , r = new URL(document.location).searchParams; - u.default.getInstance().gameSaved() && (n = u.default.getInstance().getWorldSeed()), - i.noWebrtcJoin = false; - var o = new c.default; - if (o.isMobile) - document.getElementById("mobile").style.display = "block"; - else if (o.isWebGLSupported) { - var s = JSON.parse(e).multiplayerEnabled; - o.isSinglePlayer || "true" !== s ? t.setupAsSinglePlayer(n, i) : null === r.get("join") ? t.setupAsHost(r, n, i) : o.isWebRTCSupported ? t.setupAsClient(r, i) : (t.setupAsHost(r, n, i), - i.noWebrtcJoin = true) - } else - document.getElementById("webgl_webrtc").style.display = "block" - }) - } - var t, i, h; - return t = e, - (i = [{ + new ((function () { + function e() { + var t = this; + !(function (e, t) { + if (!(e instanceof t)) + throw new TypeError("Cannot call a class as a function"); + })(this, e), + n.a.init(), + n.a.executeXhr("/game/multiplayer-enabled", "get").then(function (e) { + var i = new a.a(), + n = Math.floor(99999999999999 * Math.random()), + r = new URL(document.location).searchParams; + u.default.getInstance().gameSaved() && + (n = u.default.getInstance().getWorldSeed()), + (i.noWebrtcJoin = false); + var o = new c.default(); + if (o.isMobile) + document.getElementById("mobile").style.display = "block"; + else if (o.isWebGLSupported) { + var s = JSON.parse(e).multiplayerEnabled; + o.isSinglePlayer || "true" !== s + ? t.setupAsSinglePlayer(n, i) + : null === r.get("join") + ? t.setupAsHost(r, n, i) + : o.isWebRTCSupported + ? t.setupAsClient(r, i) + : (t.setupAsHost(r, n, i), (i.noWebrtcJoin = true)); + } else + document.getElementById("webgl_webrtc").style.display = "block"; + }); + } + var t, i, h; + return ( + (t = e), + (i = [ + { key: "setupAsClient", - value: function(e, t) { - var i = e.get("join") - , n = new o.a({ - code: i, - game: t - }) - , r = null; - t.setName = function(e) { - null === r && (r = new s.a({ - name: e, - network: n, - isSelf: true, - isClient: true - },function(e) { - n.broadcast({ - type: "playerState", - data: { - state: e - } - }) - } - ), - n.setState({ - name: e - }), - t.setPlayer(r)) - } - , - n.joinGame().then(function(e) { - u.default.getInstance().clearData() + value: function (e, t) { + var i = e.get("join"), + n = new o.a({ + code: i, + game: t, }), - n.getWelcomeInfo().then(function(e) { - u.default.getInstance().setWorldSeed(e.worldSeed), + r = null; + (t.setName = function (e) { + null === r && + ((r = new s.a( + { + name: e, + network: n, + isSelf: true, + isClient: true, + }, + function (e) { + n.broadcast({ + type: "playerState", + data: { + state: e, + }, + }); + } + )), + n.setState({ + name: e, + }), + t.setPlayer(r)); + }), + n.joinGame().then(function (e) { + u.default.getInstance().clearData(); + }), + n.getWelcomeInfo().then(function (e) { + u.default.getInstance().setWorldSeed(e.worldSeed), u.default.getInstance().setWorldSize(e.worldSize), t.initialize({ - seed: e.worldSeed, - network: n + seed: e.worldSeed, + network: n, }), - t.client = n - }) - } - }, { + (t.client = n); + }); + }, + }, + { key: "setupAsSinglePlayer", - value: function(e, t) { - var i = new r.a({ - name: "temp", - seed: e, - game: t - }); - if (u.default.getInstance().setWorldSeed(e), - u.default.getInstance().gameSaved()) { - var n = u.default.getInstance().getChangedBlocks(); - i.setChangedBlocks(n) - } - t.initialize({ - seed: e, - player: i.getPlayer(), - network: i, - singlePlayer: true - }), + value: function (e, t) { + var i = new r.a({ + name: "temp", + seed: e, + game: t, + }); + if ( + (u.default.getInstance().setWorldSeed(e), + u.default.getInstance().gameSaved()) + ) { + var n = u.default.getInstance().getChangedBlocks(); + i.setChangedBlocks(n); + } + t.initialize({ + seed: e, + player: i.getPlayer(), + network: i, + singlePlayer: true, + }), t.setChangedBlockHandler(i.changedBlockHandler), - t.setName = function(e) { - i.setName(e) - } - } - }, { - key: "setupAsHost", - value: function(e, t, i) { - var n = this - , o = null !== e.get("host") ? e.get("host") : null - , a = new r.a({ - name: "temp", - seed: t, - game: i + (t.setName = function (e) { + i.setName(e); }); - if (u.default.getInstance().setWorldSeed(t), - u.default.getInstance().gameSaved()) { - var s = u.default.getInstance().getChangedBlocks(); - a.setChangedBlocks(s) - } - a.initNewGame(o).then(function(r) { - n.setHostUrl(e, r), - i.initialize({ - seed: t, - player: a.getPlayer(), - network: a - }), - i.setChangedBlockHandler(a.changedBlockHandler) - }), - i.setName = function(e) { - a.setName(e) - } - } - }, { + }, + }, + { + key: "setupAsHost", + value: function (e, t, i) { + var n = this, + o = null !== e.get("host") ? e.get("host") : null, + a = new r.a({ + name: "temp", + seed: t, + game: i, + }); + if ( + (u.default.getInstance().setWorldSeed(t), + u.default.getInstance().gameSaved()) + ) { + var s = u.default.getInstance().getChangedBlocks(); + a.setChangedBlocks(s); + } + a.initNewGame(o).then(function (r) { + n.setHostUrl(e, r), + i.initialize({ + seed: t, + player: a.getPlayer(), + network: a, + }), + i.setChangedBlockHandler(a.changedBlockHandler); + }), + (i.setName = function (e) { + a.setName(e); + }); + }, + }, + { key: "setHostUrl", - value: function(e, t) { - if ("URLSearchParams"in window) { - var i = new URLSearchParams(window.location.search); - i.set("host", t), - history.pushState({}, t, "?" + i.toString()) - } - } - }]) && l(t.prototype, i), + value: function (e, t) { + if ("URLSearchParams" in window) { + var i = new URLSearchParams(window.location.search); + i.set("host", t), history.pushState({}, t, "?" + i.toString()); + } + }, + }, + ]) && l(t.prototype, i), h && l(t, h), e - }()) -} -, function(e, t, i) { + ); + })())(); + }, + function (e, t, i) { "use strict"; - (function(e) { - i(230), + (function (e) { + i(230), i(373), i(375), i(377), @@ -16942,7931 +20090,9356 @@ i(387), i(389), i(393), - e._babelPolyfill && "undefined" != typeof console && console.warn && console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."), - e._babelPolyfill = true - } - ).call(this, i(15)) -} -, function(e, t, i) { + e._babelPolyfill && + "undefined" != typeof console && + console.warn && + console.warn( + "@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning." + ), + (e._babelPolyfill = true); + }.call(this, i(15))); + }, + function (e, t, i) { i(231), - i(233), - i(234), - i(235), - i(236), - i(237), - i(238), - i(239), - i(240), - i(241), - i(242), - i(243), - i(244), - i(245), - i(246), - i(247), - i(248), - i(249), - i(250), - i(251), - i(252), - i(253), - i(254), - i(255), - i(256), - i(257), - i(258), - i(259), - i(260), - i(261), - i(262), - i(263), - i(264), - i(265), - i(266), - i(267), - i(268), - i(269), - i(270), - i(271), - i(272), - i(273), - i(274), - i(276), - i(277), - i(278), - i(279), - i(280), - i(281), - i(282), - i(283), - i(284), - i(285), - i(286), - i(287), - i(288), - i(289), - i(290), - i(291), - i(292), - i(293), - i(294), - i(295), - i(296), - i(297), - i(298), - i(299), - i(300), - i(301), - i(302), - i(303), - i(304), - i(305), - i(306), - i(307), - i(308), - i(309), - i(311), - i(312), - i(314), - i(315), - i(316), - i(317), - i(318), - i(319), - i(320), - i(323), - i(324), - i(325), - i(326), - i(327), - i(328), - i(329), - i(330), - i(331), - i(332), - i(333), - i(334), - i(335), - i(117), - i(336), - i(157), - i(337), - i(158), - i(338), - i(339), - i(340), - i(341), - i(159), - i(344), - i(345), - i(346), - i(347), - i(348), - i(349), - i(350), - i(351), - i(352), - i(353), - i(354), - i(355), - i(356), - i(357), - i(358), - i(359), - i(360), - i(361), - i(362), - i(363), - i(364), - i(365), - i(366), - i(367), - i(368), - i(369), - i(370), - i(371), - i(372), - e.exports = i(14) -} -, function(e, t, i) { + i(233), + i(234), + i(235), + i(236), + i(237), + i(238), + i(239), + i(240), + i(241), + i(242), + i(243), + i(244), + i(245), + i(246), + i(247), + i(248), + i(249), + i(250), + i(251), + i(252), + i(253), + i(254), + i(255), + i(256), + i(257), + i(258), + i(259), + i(260), + i(261), + i(262), + i(263), + i(264), + i(265), + i(266), + i(267), + i(268), + i(269), + i(270), + i(271), + i(272), + i(273), + i(274), + i(276), + i(277), + i(278), + i(279), + i(280), + i(281), + i(282), + i(283), + i(284), + i(285), + i(286), + i(287), + i(288), + i(289), + i(290), + i(291), + i(292), + i(293), + i(294), + i(295), + i(296), + i(297), + i(298), + i(299), + i(300), + i(301), + i(302), + i(303), + i(304), + i(305), + i(306), + i(307), + i(308), + i(309), + i(311), + i(312), + i(314), + i(315), + i(316), + i(317), + i(318), + i(319), + i(320), + i(323), + i(324), + i(325), + i(326), + i(327), + i(328), + i(329), + i(330), + i(331), + i(332), + i(333), + i(334), + i(335), + i(117), + i(336), + i(157), + i(337), + i(158), + i(338), + i(339), + i(340), + i(341), + i(159), + i(344), + i(345), + i(346), + i(347), + i(348), + i(349), + i(350), + i(351), + i(352), + i(353), + i(354), + i(355), + i(356), + i(357), + i(358), + i(359), + i(360), + i(361), + i(362), + i(363), + i(364), + i(365), + i(366), + i(367), + i(368), + i(369), + i(370), + i(371), + i(372), + (e.exports = i(14)); + }, + function (e, t, i) { "use strict"; function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - var r = i(5) - , o = i(22) - , a = i(13) - , s = i(0) - , c = i(19) - , u = i(40).KEY - , l = i(3) - , h = i(96) - , f = i(56) - , d = i(46) - , p = i(8) - , m = i(97) - , g = i(139) - , _ = i(232) - , v = i(100) - , y = i(4) - , b = i(6) - , E = i(24) - , T = i(39) - , A = i(45) - , x = i(50) - , S = i(142) - , C = i(29) - , P = i(12) - , R = i(48) - , M = C.f - , O = P.f - , w = S.f - , I = r.Symbol - , D = r.JSON - , L = D && D.stringify - , F = p("_hidden") - , B = p("toPrimitive") - , N = {}.propertyIsEnumerable - , k = h("symbol-registry") - , U = h("symbols") - , V = h("op-symbols") - , G = Object.prototype - , z = "function" == typeof I - , j = r.QObject - , H = !j || !j.prototype || !j.prototype.findChild - , W = a && l(function() { - return 7 != x(O({}, "a", { - get: function() { - return O(this, "a", { - value: 7 - }).a + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; } - })).a - }) ? function(e, t, i) { - var n = M(G, t); - n && delete G[t], - O(e, t, i), - n && e !== G && O(G, t, n) + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - : O - , X = function(e) { - var t = U[e] = x(I.prototype); - return t._k = e, - t - } - , Y = z && "symbol" == n(I.iterator) ? function(e) { - return "symbol" == n(e) - } - : function(e) { - return e instanceof I - } - , K = function(e, t, i) { - return e === G && K(V, t, i), - y(e), - t = T(t, true), - y(i), - o(U, t) ? (i.enumerable ? (o(e, F) && e[F][t] && (e[F][t] = false), - i = x(i, { - enumerable: A(0, false) - })) : (o(e, F) || O(e, F, A(1, {})), - e[F][t] = true), - W(e, t, i)) : O(e, t, i) - } - , Q = function(e, t) { + var r = i(5), + o = i(22), + a = i(13), + s = i(0), + c = i(19), + u = i(40).KEY, + l = i(3), + h = i(96), + f = i(56), + d = i(46), + p = i(8), + m = i(97), + g = i(139), + _ = i(232), + v = i(100), + y = i(4), + b = i(6), + E = i(24), + T = i(39), + A = i(45), + x = i(50), + S = i(142), + C = i(29), + P = i(12), + R = i(48), + M = C.f, + O = P.f, + w = S.f, + I = r.Symbol, + D = r.JSON, + L = D && D.stringify, + F = p("_hidden"), + B = p("toPrimitive"), + N = {}.propertyIsEnumerable, + k = h("symbol-registry"), + U = h("symbols"), + V = h("op-symbols"), + G = Object.prototype, + z = "function" == typeof I, + j = r.QObject, + H = !j || !j.prototype || !j.prototype.findChild, + W = + a && + l(function () { + return ( + 7 != + x( + O({}, "a", { + get: function () { + return O(this, "a", { + value: 7, + }).a; + }, + }) + ).a + ); + }) + ? function (e, t, i) { + var n = M(G, t); + n && delete G[t], O(e, t, i), n && e !== G && O(G, t, n); + } + : O, + X = function (e) { + var t = (U[e] = x(I.prototype)); + return (t._k = e), t; + }, + Y = + z && "symbol" == n(I.iterator) + ? function (e) { + return "symbol" == n(e); + } + : function (e) { + return e instanceof I; + }, + K = function (e, t, i) { + return ( + e === G && K(V, t, i), + y(e), + (t = T(t, true)), + y(i), + o(U, t) + ? (i.enumerable + ? (o(e, F) && e[F][t] && (e[F][t] = false), + (i = x(i, { + enumerable: A(0, false), + }))) + : (o(e, F) || O(e, F, A(1, {})), (e[F][t] = true)), + W(e, t, i)) + : O(e, t, i) + ); + }, + Q = function (e, t) { y(e); - for (var i, n = _(t = E(t)), r = 0, o = n.length; o > r; ) - K(e, i = n[r++], t[i]); - return e - } - , q = function(e) { - var t = N.call(this, e = T(e, true)); - return !(this === G && o(U, e) && !o(V, e)) && (!(t || !o(this, e) || !o(U, e) || o(this, F) && this[F][e]) || t) - } - , Z = function(e, t) { - if (e = E(e), - t = T(t, true), - e !== G || !o(U, t) || o(V, t)) { - var i = M(e, t); - return !i || !o(U, t) || o(e, F) && e[F][t] || (i.enumerable = true), - i + for (var i, n = _((t = E(t))), r = 0, o = n.length; o > r; ) + K(e, (i = n[r++]), t[i]); + return e; + }, + q = function (e) { + var t = N.call(this, (e = T(e, true))); + return ( + !(this === G && o(U, e) && !o(V, e)) && + (!(t || !o(this, e) || !o(U, e) || (o(this, F) && this[F][e])) || t) + ); + }, + Z = function (e, t) { + if (((e = E(e)), (t = T(t, true)), e !== G || !o(U, t) || o(V, t))) { + var i = M(e, t); + return ( + !i || !o(U, t) || (o(e, F) && e[F][t]) || (i.enumerable = true), i + ); } - } - , J = function(e) { + }, + J = function (e) { for (var t, i = w(E(e)), n = [], r = 0; i.length > r; ) - o(U, t = i[r++]) || t == F || t == u || n.push(t); - return n - } - , $ = function(e) { - for (var t, i = e === G, n = w(i ? V : E(e)), r = [], a = 0; n.length > a; ) - !o(U, t = n[a++]) || i && !o(G, t) || r.push(U[t]); - return r - }; - z || (c((I = function() { - if (this instanceof I) + o(U, (t = i[r++])) || t == F || t == u || n.push(t); + return n; + }, + $ = function (e) { + for ( + var t, i = e === G, n = w(i ? V : E(e)), r = [], a = 0; + n.length > a; + + ) + !o(U, (t = n[a++])) || (i && !o(G, t)) || r.push(U[t]); + return r; + }; + z || + (c( + (I = function () { + if (this instanceof I) throw TypeError("Symbol is not a constructor!"); - var e = d(arguments.length > 0 ? arguments[0] : void 0); - return a && H && W(G, e, { - configurable: true, - set: function t(i) { - this === G && t.call(V, i), - o(this, F) && o(this[F], e) && (this[F][e] = false), - W(this, e, A(1, i)) - } - }), - X(e) - } - ).prototype, "toString", function() { - return this._k - }), - C.f = Z, - P.f = K, - i(51).f = S.f = J, - i(65).f = q, - i(75).f = $, - a && !i(47) && c(G, "propertyIsEnumerable", q, true), - m.f = function(e) { - return X(p(e)) - } - ), - s(s.G + s.W + s.F * !z, { - Symbol: I - }); - for (var ee = "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","), te = 0; ee.length > te; ) - p(ee[te++]); - for (var ie = R(p.store), ne = 0; ie.length > ne; ) - g(ie[ne++]); - s(s.S + s.F * !z, "Symbol", { - for: function(e) { - return o(k, e += "") ? k[e] : k[e] = I(e) - }, - keyFor: function(e) { - if (!Y(e)) - throw TypeError(e + " is not a symbol!"); - for (var t in k) - if (k[t] === e) - return t - }, - useSetter: function() { - H = true - }, - useSimple: function() { - H = false + var e = d(arguments.length > 0 ? arguments[0] : void 0); + return ( + a && + H && + W(G, e, { + configurable: true, + set: function t(i) { + this === G && t.call(V, i), + o(this, F) && o(this[F], e) && (this[F][e] = false), + W(this, e, A(1, i)); + }, + }), + X(e) + ); + }).prototype, + "toString", + function () { + return this._k; } + ), + (C.f = Z), + (P.f = K), + (i(51).f = S.f = J), + (i(65).f = q), + (i(75).f = $), + a && !i(47) && c(G, "propertyIsEnumerable", q, true), + (m.f = function (e) { + return X(p(e)); + })), + s(s.G + s.W + s.F * !z, { + Symbol: I, + }); + for ( + var ee = + "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split( + "," + ), + te = 0; + ee.length > te; + + ) + p(ee[te++]); + for (var ie = R(p.store), ne = 0; ie.length > ne; ) g(ie[ne++]); + s(s.S + s.F * !z, "Symbol", { + for: function (e) { + return o(k, (e += "")) ? k[e] : (k[e] = I(e)); + }, + keyFor: function (e) { + if (!Y(e)) throw TypeError(e + " is not a symbol!"); + for (var t in k) if (k[t] === e) return t; + }, + useSetter: function () { + H = true; + }, + useSimple: function () { + H = false; + }, }), - s(s.S + s.F * !z, "Object", { - create: function(e, t) { - return void 0 === t ? x(e) : Q(x(e), t) + s(s.S + s.F * !z, "Object", { + create: function (e, t) { + return void 0 === t ? x(e) : Q(x(e), t); }, defineProperty: K, defineProperties: Q, getOwnPropertyDescriptor: Z, getOwnPropertyNames: J, - getOwnPropertySymbols: $ - }), - D && s(s.S + s.F * (!z || l(function() { - var e = I(); - return "[null]" != L([e]) || "{}" != L({ - a: e - }) || "{}" != L(Object(e)) - })), "JSON", { - stringify: function(e) { - for (var t, i, n = [e], r = 1; arguments.length > r; ) + getOwnPropertySymbols: $, + }), + D && + s( + s.S + + s.F * + (!z || + l(function () { + var e = I(); + return ( + "[null]" != L([e]) || + "{}" != + L({ + a: e, + }) || + "{}" != L(Object(e)) + ); + })), + "JSON", + { + stringify: function (e) { + for (var t, i, n = [e], r = 1; arguments.length > r; ) n.push(arguments[r++]); - if (i = t = n[1], - (b(t) || void 0 !== e) && !Y(e)) - return v(t) || (t = function(e, t) { - if ("function" == typeof i && (t = i.call(this, e, t)), - !Y(t)) - return t - } - ), - n[1] = t, - L.apply(D, n) - } - }), - I.prototype[B] || i(23)(I.prototype, B, I.prototype.valueOf), - f(I, "Symbol"), - f(Math, "Math", true), - f(r.JSON, "JSON", true) -} -, function(e, t, i) { - var n = i(48) - , r = i(75) - , o = i(65); - e.exports = function(e) { - var t = n(e) - , i = r.f; - if (i) - for (var a, s = i(e), c = o.f, u = 0; s.length > u; ) - c.call(e, a = s[u++]) && t.push(a); - return t - } -} -, function(e, t, i) { + if (((i = t = n[1]), (b(t) || void 0 !== e) && !Y(e))) + return ( + v(t) || + (t = function (e, t) { + if ( + ("function" == typeof i && (t = i.call(this, e, t)), + !Y(t)) + ) + return t; + }), + (n[1] = t), + L.apply(D, n) + ); + }, + } + ), + I.prototype[B] || i(23)(I.prototype, B, I.prototype.valueOf), + f(I, "Symbol"), + f(Math, "Math", true), + f(r.JSON, "JSON", true); + }, + function (e, t, i) { + var n = i(48), + r = i(75), + o = i(65); + e.exports = function (e) { + var t = n(e), + i = r.f; + if (i) + for (var a, s = i(e), c = o.f, u = 0; s.length > u; ) + c.call(e, (a = s[u++])) && t.push(a); + return t; + }; + }, + function (e, t, i) { var n = i(0); n(n.S, "Object", { - create: i(50) - }) -} -, function(e, t, i) { + create: i(50), + }); + }, + function (e, t, i) { var n = i(0); n(n.S + n.F * !i(13), "Object", { - defineProperty: i(12).f - }) -} -, function(e, t, i) { + defineProperty: i(12).f, + }); + }, + function (e, t, i) { var n = i(0); n(n.S + n.F * !i(13), "Object", { - defineProperties: i(141) - }) -} -, function(e, t, i) { - var n = i(24) - , r = i(29).f; - i(30)("getOwnPropertyDescriptor", function() { - return function(e, t) { - return r(n(e), t) - } - }) -} -, function(e, t, i) { - var n = i(20) - , r = i(52); - i(30)("getPrototypeOf", function() { - return function(e) { - return r(n(e)) - } - }) -} -, function(e, t, i) { - var n = i(20) - , r = i(48); - i(30)("keys", function() { - return function(e) { - return r(n(e)) - } - }) -} -, function(e, t, i) { - i(30)("getOwnPropertyNames", function() { - return i(142).f - }) -} -, function(e, t, i) { - var n = i(6) - , r = i(40).onFreeze; - i(30)("freeze", function(e) { - return function(t) { - return e && n(t) ? e(r(t)) : t - } - }) -} -, function(e, t, i) { - var n = i(6) - , r = i(40).onFreeze; - i(30)("seal", function(e) { - return function(t) { - return e && n(t) ? e(r(t)) : t - } - }) -} -, function(e, t, i) { - var n = i(6) - , r = i(40).onFreeze; - i(30)("preventExtensions", function(e) { - return function(t) { - return e && n(t) ? e(r(t)) : t - } - }) -} -, function(e, t, i) { + defineProperties: i(141), + }); + }, + function (e, t, i) { + var n = i(24), + r = i(29).f; + i(30)("getOwnPropertyDescriptor", function () { + return function (e, t) { + return r(n(e), t); + }; + }); + }, + function (e, t, i) { + var n = i(20), + r = i(52); + i(30)("getPrototypeOf", function () { + return function (e) { + return r(n(e)); + }; + }); + }, + function (e, t, i) { + var n = i(20), + r = i(48); + i(30)("keys", function () { + return function (e) { + return r(n(e)); + }; + }); + }, + function (e, t, i) { + i(30)("getOwnPropertyNames", function () { + return i(142).f; + }); + }, + function (e, t, i) { + var n = i(6), + r = i(40).onFreeze; + i(30)("freeze", function (e) { + return function (t) { + return e && n(t) ? e(r(t)) : t; + }; + }); + }, + function (e, t, i) { + var n = i(6), + r = i(40).onFreeze; + i(30)("seal", function (e) { + return function (t) { + return e && n(t) ? e(r(t)) : t; + }; + }); + }, + function (e, t, i) { + var n = i(6), + r = i(40).onFreeze; + i(30)("preventExtensions", function (e) { + return function (t) { + return e && n(t) ? e(r(t)) : t; + }; + }); + }, + function (e, t, i) { var n = i(6); - i(30)("isFrozen", function(e) { - return function(t) { - return !n(t) || !!e && e(t) - } - }) -} -, function(e, t, i) { + i(30)("isFrozen", function (e) { + return function (t) { + return !n(t) || (!!e && e(t)); + }; + }); + }, + function (e, t, i) { var n = i(6); - i(30)("isSealed", function(e) { - return function(t) { - return !n(t) || !!e && e(t) - } - }) -} -, function(e, t, i) { + i(30)("isSealed", function (e) { + return function (t) { + return !n(t) || (!!e && e(t)); + }; + }); + }, + function (e, t, i) { var n = i(6); - i(30)("isExtensible", function(e) { - return function(t) { - return !!n(t) && (!e || e(t)) - } - }) -} -, function(e, t, i) { + i(30)("isExtensible", function (e) { + return function (t) { + return !!n(t) && (!e || e(t)); + }; + }); + }, + function (e, t, i) { var n = i(0); n(n.S + n.F, "Object", { - assign: i(143) - }) -} -, function(e, t, i) { + assign: i(143), + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Object", { - is: i(144) - }) -} -, function(e, t, i) { + is: i(144), + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Object", { - setPrototypeOf: i(102).set - }) -} -, function(e, t, i) { + setPrototypeOf: i(102).set, + }); + }, + function (e, t, i) { "use strict"; - var n = i(66) - , r = {}; - r[i(8)("toStringTag")] = "z", - r + "" != "[object z]" && i(19)(Object.prototype, "toString", function() { - return "[object " + n(this) + "]" - }, true) -} -, function(e, t, i) { + var n = i(66), + r = {}; + (r[i(8)("toStringTag")] = "z"), + r + "" != "[object z]" && + i(19)( + Object.prototype, + "toString", + function () { + return "[object " + n(this) + "]"; + }, + true + ); + }, + function (e, t, i) { var n = i(0); n(n.P, "Function", { - bind: i(145) - }) -} -, function(e, t, i) { - var n = i(12).f - , r = Function.prototype - , o = /^\s*function ([^ (]*)/; - "name"in r || i(13) && n(r, "name", { - configurable: true, - get: function() { + bind: i(145), + }); + }, + function (e, t, i) { + var n = i(12).f, + r = Function.prototype, + o = /^\s*function ([^ (]*)/; + "name" in r || + (i(13) && + n(r, "name", { + configurable: true, + get: function () { try { - return ("" + this).match(o)[1] + return ("" + this).match(o)[1]; } catch (e) { - return "" + return ""; } - } - }) -} -, function(e, t, i) { + }, + })); + }, + function (e, t, i) { "use strict"; - var n = i(6) - , r = i(52) - , o = i(8)("hasInstance") - , a = Function.prototype; - o in a || i(12).f(a, o, { - value: function(e) { - if ("function" != typeof this || !n(e)) - return false; - if (!n(this.prototype)) - return e instanceof this; - for (; e = r(e); ) - if (this.prototype === e) - return true; - return false - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(147); + var n = i(6), + r = i(52), + o = i(8)("hasInstance"), + a = Function.prototype; + o in a || + i(12).f(a, o, { + value: function (e) { + if ("function" != typeof this || !n(e)) return false; + if (!n(this.prototype)) return e instanceof this; + for (; (e = r(e)); ) if (this.prototype === e) return true; + return false; + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(147); n(n.G + n.F * (parseInt != r), { - parseInt: r - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(148); + parseInt: r, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(148); n(n.G + n.F * (parseFloat != r), { - parseFloat: r - }) -} -, function(e, t, i) { + parseFloat: r, + }); + }, + function (e, t, i) { "use strict"; - var n = i(5) - , r = i(22) - , o = i(36) - , a = i(104) - , s = i(39) - , c = i(3) - , u = i(51).f - , l = i(29).f - , h = i(12).f - , f = i(76).trim - , d = n.Number - , p = d - , m = d.prototype - , g = "Number" == o(i(50)(m)) - , _ = "trim"in String.prototype - , v = function(e) { + var n = i(5), + r = i(22), + o = i(36), + a = i(104), + s = i(39), + c = i(3), + u = i(51).f, + l = i(29).f, + h = i(12).f, + f = i(76).trim, + d = n.Number, + p = d, + m = d.prototype, + g = "Number" == o(i(50)(m)), + _ = "trim" in String.prototype, + v = function (e) { var t = s(e, false); if ("string" == typeof t && t.length > 2) { - var i, n, r, o = (t = _ ? t.trim() : f(t, 3)).charCodeAt(0); - if (43 === o || 45 === o) { - if (88 === (i = t.charCodeAt(2)) || 120 === i) - return NaN - } else if (48 === o) { - switch (t.charCodeAt(1)) { - case 66: - case 98: - n = 2, - r = 49; - break; - case 79: - case 111: - n = 8, - r = 55; - break; - default: - return +t - } - for (var a, c = t.slice(2), u = 0, l = c.length; u < l; u++) - if ((a = c.charCodeAt(u)) < 48 || a > r) - return NaN; - return parseInt(c, n) + var i, + n, + r, + o = (t = _ ? t.trim() : f(t, 3)).charCodeAt(0); + if (43 === o || 45 === o) { + if (88 === (i = t.charCodeAt(2)) || 120 === i) return NaN; + } else if (48 === o) { + switch (t.charCodeAt(1)) { + case 66: + case 98: + (n = 2), (r = 49); + break; + case 79: + case 111: + (n = 8), (r = 55); + break; + default: + return +t; } + for (var a, c = t.slice(2), u = 0, l = c.length; u < l; u++) + if ((a = c.charCodeAt(u)) < 48 || a > r) return NaN; + return parseInt(c, n); + } } - return +t - }; + return +t; + }; if (!d(" 0o1") || !d("0b1") || d("+0x1")) { - d = function(e) { - var t = arguments.length < 1 ? 0 : e - , i = this; - return i instanceof d && (g ? c(function() { - m.valueOf.call(i) - }) : "Number" != o(i)) ? a(new p(v(t)), i, d) : v(t) - } - ; - for (var y, b = i(13) ? u(p) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","), E = 0; b.length > E; E++) - r(p, y = b[E]) && !r(d, y) && h(d, y, l(p, y)); - d.prototype = m, - m.constructor = d, - i(19)(n, "Number", d) + d = function (e) { + var t = arguments.length < 1 ? 0 : e, + i = this; + return i instanceof d && + (g + ? c(function () { + m.valueOf.call(i); + }) + : "Number" != o(i)) + ? a(new p(v(t)), i, d) + : v(t); + }; + for ( + var y, + b = i(13) + ? u(p) + : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split( + "," + ), + E = 0; + b.length > E; + E++ + ) + r(p, (y = b[E])) && !r(d, y) && h(d, y, l(p, y)); + (d.prototype = m), (m.constructor = d), i(19)(n, "Number", d); } -} -, function(e, t, i) { + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(28) - , o = i(149) - , a = i(105) - , s = 1..toFixed - , c = Math.floor - , u = [0, 0, 0, 0, 0, 0] - , l = "Number.toFixed: incorrect invocation!" - , h = function(e, t) { + var n = i(0), + r = i(28), + o = i(149), + a = i(105), + s = (1).toFixed, + c = Math.floor, + u = [0, 0, 0, 0, 0, 0], + l = "Number.toFixed: incorrect invocation!", + h = function (e, t) { for (var i = -1, n = t; ++i < 6; ) - n += e * u[i], - u[i] = n % 1e7, - n = c(n / 1e7) - } - , f = function(e) { + (n += e * u[i]), (u[i] = n % 1e7), (n = c(n / 1e7)); + }, + f = function (e) { for (var t = 6, i = 0; --t >= 0; ) - i += u[t], - u[t] = c(i / e), - i = i % e * 1e7 - } - , d = function() { + (i += u[t]), (u[t] = c(i / e)), (i = (i % e) * 1e7); + }, + d = function () { for (var e = 6, t = ""; --e >= 0; ) - if ("" !== t || 0 === e || 0 !== u[e]) { - var i = String(u[e]); - t = "" === t ? i : t + a.call("0", 7 - i.length) + i - } - return t - } - , p = function e(t, i, n) { - return 0 === i ? n : i % 2 == 1 ? e(t, i - 1, n * t) : e(t * t, i / 2, n) - }; - n(n.P + n.F * (!!s && ("0.000" !== 8e-5.toFixed(3) || "1" !== .9.toFixed(0) || "1.25" !== 1.255.toFixed(2) || "1000000000000000128" !== (0xde0b6b3a7640080).toFixed(0)) || !i(3)(function() { - s.call({}) - })), "Number", { - toFixed: function(e) { - var t, i, n, s, c = o(this, l), u = r(e), m = "", g = "0"; - if (u < 0 || u > 20) - throw RangeError(l); - if (c != c) - return "NaN"; - if (c <= -1e21 || c >= 1e21) - return String(c); - if (c < 0 && (m = "-", - c = -c), - c > 1e-21) - if (i = (t = function(e) { - for (var t = 0, i = e; i >= 4096; ) - t += 12, - i /= 4096; - for (; i >= 2; ) - t += 1, - i /= 2; - return t - }(c * p(2, 69, 1)) - 69) < 0 ? c * p(2, -t, 1) : c / p(2, t, 1), - i *= 4503599627370496, - (t = 52 - t) > 0) { - for (h(0, i), - n = u; n >= 7; ) - h(1e7, 0), - n -= 7; - for (h(p(10, n, 1), 0), - n = t - 1; n >= 23; ) - f(1 << 23), - n -= 23; - f(1 << n), - h(1, 1), - f(2), - g = d() - } else - h(0, i), - h(1 << -t, 0), - g = d() + a.call("0", u); - return g = u > 0 ? m + ((s = g.length) <= u ? "0." + a.call("0", u - s) + g : g.slice(0, s - u) + "." + g.slice(s - u)) : m + g - } - }) -} -, function(e, t, i) { + if ("" !== t || 0 === e || 0 !== u[e]) { + var i = String(u[e]); + t = "" === t ? i : t + a.call("0", 7 - i.length) + i; + } + return t; + }, + p = function e(t, i, n) { + return 0 === i + ? n + : i % 2 == 1 + ? e(t, i - 1, n * t) + : e(t * t, i / 2, n); + }; + n( + n.P + + n.F * + ((!!s && + ("0.000" !== (8e-5).toFixed(3) || + "1" !== (0.9).toFixed(0) || + "1.25" !== (1.255).toFixed(2) || + "1000000000000000128" !== (0xde0b6b3a7640080).toFixed(0))) || + !i(3)(function () { + s.call({}); + })), + "Number", + { + toFixed: function (e) { + var t, + i, + n, + s, + c = o(this, l), + u = r(e), + m = "", + g = "0"; + if (u < 0 || u > 20) throw RangeError(l); + if (c != c) return "NaN"; + if (c <= -1e21 || c >= 1e21) return String(c); + if ((c < 0 && ((m = "-"), (c = -c)), c > 1e-21)) + if ( + ((i = + (t = + (function (e) { + for (var t = 0, i = e; i >= 4096; ) (t += 12), (i /= 4096); + for (; i >= 2; ) (t += 1), (i /= 2); + return t; + })(c * p(2, 69, 1)) - 69) < 0 + ? c * p(2, -t, 1) + : c / p(2, t, 1)), + (i *= 4503599627370496), + (t = 52 - t) > 0) + ) { + for (h(0, i), n = u; n >= 7; ) h(1e7, 0), (n -= 7); + for (h(p(10, n, 1), 0), n = t - 1; n >= 23; ) + f(1 << 23), (n -= 23); + f(1 << n), h(1, 1), f(2), (g = d()); + } else h(0, i), h(1 << -t, 0), (g = d() + a.call("0", u)); + return (g = + u > 0 + ? m + + ((s = g.length) <= u + ? "0." + a.call("0", u - s) + g + : g.slice(0, s - u) + "." + g.slice(s - u)) + : m + g); + }, + } + ); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(3) - , o = i(149) - , a = 1..toPrecision; - n(n.P + n.F * (r(function() { - return "1" !== a.call(1, void 0) - }) || !r(function() { - a.call({}) - })), "Number", { - toPrecision: function(e) { - var t = o(this, "Number#toPrecision: incorrect invocation!"); - return void 0 === e ? a.call(t) : a.call(t, e) - } - }) -} -, function(e, t, i) { + var n = i(0), + r = i(3), + o = i(149), + a = (1).toPrecision; + n( + n.P + + n.F * + (r(function () { + return "1" !== a.call(1, void 0); + }) || + !r(function () { + a.call({}); + })), + "Number", + { + toPrecision: function (e) { + var t = o(this, "Number#toPrecision: incorrect invocation!"); + return void 0 === e ? a.call(t) : a.call(t, e); + }, + } + ); + }, + function (e, t, i) { var n = i(0); n(n.S, "Number", { - EPSILON: Math.pow(2, -52) - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(5).isFinite; + EPSILON: Math.pow(2, -52), + }); + }, + function (e, t, i) { + var n = i(0), + r = i(5).isFinite; n(n.S, "Number", { - isFinite: function(e) { - return "number" == typeof e && r(e) - } - }) -} -, function(e, t, i) { + isFinite: function (e) { + return "number" == typeof e && r(e); + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Number", { - isInteger: i(150) - }) -} -, function(e, t, i) { + isInteger: i(150), + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Number", { - isNaN: function(e) { - return e != e - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(150) - , o = Math.abs; + isNaN: function (e) { + return e != e; + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(150), + o = Math.abs; n(n.S, "Number", { - isSafeInteger: function(e) { - return r(e) && o(e) <= 9007199254740991 - } - }) -} -, function(e, t, i) { + isSafeInteger: function (e) { + return r(e) && o(e) <= 9007199254740991; + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Number", { - MAX_SAFE_INTEGER: 9007199254740991 - }) -} -, function(e, t, i) { + MAX_SAFE_INTEGER: 9007199254740991, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Number", { - MIN_SAFE_INTEGER: -9007199254740991 - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(148); + MIN_SAFE_INTEGER: -9007199254740991, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(148); n(n.S + n.F * (Number.parseFloat != r), "Number", { - parseFloat: r - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(147); + parseFloat: r, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(147); n(n.S + n.F * (Number.parseInt != r), "Number", { - parseInt: r - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(151) - , o = Math.sqrt - , a = Math.acosh; - n(n.S + n.F * !(a && 710 == Math.floor(a(Number.MAX_VALUE)) && a(1 / 0) == 1 / 0), "Math", { - acosh: function(e) { - return (e = +e) < 1 ? NaN : e > 94906265.62425156 ? Math.log(e) + Math.LN2 : r(e - 1 + o(e - 1) * o(e + 1)) - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = Math.asinh; + parseInt: r, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(151), + o = Math.sqrt, + a = Math.acosh; + n( + n.S + + n.F * + !(a && 710 == Math.floor(a(Number.MAX_VALUE)) && a(1 / 0) == 1 / 0), + "Math", + { + acosh: function (e) { + return (e = +e) < 1 + ? NaN + : e > 94906265.62425156 + ? Math.log(e) + Math.LN2 + : r(e - 1 + o(e - 1) * o(e + 1)); + }, + } + ); + }, + function (e, t, i) { + var n = i(0), + r = Math.asinh; n(n.S + n.F * !(r && 1 / r(0) > 0), "Math", { - asinh: function e(t) { - return isFinite(t = +t) && 0 != t ? t < 0 ? -e(-t) : Math.log(t + Math.sqrt(t * t + 1)) : t - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = Math.atanh; + asinh: function e(t) { + return isFinite((t = +t)) && 0 != t + ? t < 0 + ? -e(-t) + : Math.log(t + Math.sqrt(t * t + 1)) + : t; + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = Math.atanh; n(n.S + n.F * !(r && 1 / r(-0) < 0), "Math", { - atanh: function(e) { - return 0 == (e = +e) ? e : Math.log((1 + e) / (1 - e)) / 2 - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(106); + atanh: function (e) { + return 0 == (e = +e) ? e : Math.log((1 + e) / (1 - e)) / 2; + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(106); n(n.S, "Math", { - cbrt: function(e) { - return r(e = +e) * Math.pow(Math.abs(e), 1 / 3) - } - }) -} -, function(e, t, i) { + cbrt: function (e) { + return r((e = +e)) * Math.pow(Math.abs(e), 1 / 3); + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Math", { - clz32: function(e) { - return (e >>>= 0) ? 31 - Math.floor(Math.log(e + .5) * Math.LOG2E) : 32 - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = Math.exp; + clz32: function (e) { + return (e >>>= 0) + ? 31 - Math.floor(Math.log(e + 0.5) * Math.LOG2E) + : 32; + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = Math.exp; n(n.S, "Math", { - cosh: function(e) { - return (r(e = +e) + r(-e)) / 2 - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(107); + cosh: function (e) { + return (r((e = +e)) + r(-e)) / 2; + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(107); n(n.S + n.F * (r != Math.expm1), "Math", { - expm1: r - }) -} -, function(e, t, i) { + expm1: r, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Math", { - fround: i(275) - }) -} -, function(e, t, i) { - var n = i(106) - , r = Math.pow - , o = r(2, -52) - , a = r(2, -23) - , s = r(2, 127) * (2 - a) - , c = r(2, -126); - e.exports = Math.fround || function(e) { - var t, i, r = Math.abs(e), u = n(e); - return r < c ? u * (r / c / a + 1 / o - 1 / o) * c * a : (i = (t = (1 + a / o) * r) - (t - r)) > s || i != i ? u * (1 / 0) : u * i - } -} -, function(e, t, i) { - var n = i(0) - , r = Math.abs; + fround: i(275), + }); + }, + function (e, t, i) { + var n = i(106), + r = Math.pow, + o = r(2, -52), + a = r(2, -23), + s = r(2, 127) * (2 - a), + c = r(2, -126); + e.exports = + Math.fround || + function (e) { + var t, + i, + r = Math.abs(e), + u = n(e); + return r < c + ? u * (r / c / a + 1 / o - 1 / o) * c * a + : (i = (t = (1 + a / o) * r) - (t - r)) > s || i != i + ? u * (1 / 0) + : u * i; + }; + }, + function (e, t, i) { + var n = i(0), + r = Math.abs; n(n.S, "Math", { - hypot: function(e, t) { - for (var i, n, o = 0, a = 0, s = arguments.length, c = 0; a < s; ) - c < (i = r(arguments[a++])) ? (o = o * (n = c / i) * n + 1, - c = i) : o += i > 0 ? (n = i / c) * n : i; - return c === 1 / 0 ? 1 / 0 : c * Math.sqrt(o) - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = Math.imul; - n(n.S + n.F * i(3)(function() { - return -5 != r(4294967295, 5) || 2 != r.length - }), "Math", { - imul: function(e, t) { - var i = +e - , n = +t - , r = 65535 & i - , o = 65535 & n; - return 0 | r * o + ((65535 & i >>> 16) * o + r * (65535 & n >>> 16) << 16 >>> 0) - } - }) -} -, function(e, t, i) { + hypot: function (e, t) { + for (var i, n, o = 0, a = 0, s = arguments.length, c = 0; a < s; ) + c < (i = r(arguments[a++])) + ? ((o = o * (n = c / i) * n + 1), (c = i)) + : (o += i > 0 ? (n = i / c) * n : i); + return c === 1 / 0 ? 1 / 0 : c * Math.sqrt(o); + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = Math.imul; + n( + n.S + + n.F * + i(3)(function () { + return -5 != r(4294967295, 5) || 2 != r.length; + }), + "Math", + { + imul: function (e, t) { + var i = +e, + n = +t, + r = 65535 & i, + o = 65535 & n; + return ( + 0 | + (r * o + + ((((65535 & (i >>> 16)) * o + r * (65535 & (n >>> 16))) << 16) >>> + 0)) + ); + }, + } + ); + }, + function (e, t, i) { var n = i(0); n(n.S, "Math", { - log10: function(e) { - return Math.log(e) * Math.LOG10E - } - }) -} -, function(e, t, i) { + log10: function (e) { + return Math.log(e) * Math.LOG10E; + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Math", { - log1p: i(151) - }) -} -, function(e, t, i) { + log1p: i(151), + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Math", { - log2: function(e) { - return Math.log(e) / Math.LN2 - } - }) -} -, function(e, t, i) { + log2: function (e) { + return Math.log(e) / Math.LN2; + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Math", { - sign: i(106) - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(107) - , o = Math.exp; - n(n.S + n.F * i(3)(function() { - return -2e-17 != !Math.sinh(-2e-17) - }), "Math", { - sinh: function(e) { - return Math.abs(e = +e) < 1 ? (r(e) - r(-e)) / 2 : (o(e - 1) - o(-e - 1)) * (Math.E / 2) - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(107) - , o = Math.exp; + sign: i(106), + }); + }, + function (e, t, i) { + var n = i(0), + r = i(107), + o = Math.exp; + n( + n.S + + n.F * + i(3)(function () { + return -2e-17 != !Math.sinh(-2e-17); + }), + "Math", + { + sinh: function (e) { + return Math.abs((e = +e)) < 1 + ? (r(e) - r(-e)) / 2 + : (o(e - 1) - o(-e - 1)) * (Math.E / 2); + }, + } + ); + }, + function (e, t, i) { + var n = i(0), + r = i(107), + o = Math.exp; n(n.S, "Math", { - tanh: function(e) { - var t = r(e = +e) - , i = r(-e); - return t == 1 / 0 ? 1 : i == 1 / 0 ? -1 : (t - i) / (o(e) + o(-e)) - } - }) -} -, function(e, t, i) { + tanh: function (e) { + var t = r((e = +e)), + i = r(-e); + return t == 1 / 0 ? 1 : i == 1 / 0 ? -1 : (t - i) / (o(e) + o(-e)); + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Math", { - trunc: function(e) { - return (e > 0 ? Math.floor : Math.ceil)(e) - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(49) - , o = String.fromCharCode - , a = String.fromCodePoint; + trunc: function (e) { + return (e > 0 ? Math.floor : Math.ceil)(e); + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(49), + o = String.fromCharCode, + a = String.fromCodePoint; n(n.S + n.F * (!!a && 1 != a.length), "String", { - fromCodePoint: function(e) { - for (var t, i = [], n = arguments.length, a = 0; n > a; ) { - if (t = +arguments[a++], - r(t, 1114111) !== t) - throw RangeError(t + " is not a valid code point"); - i.push(t < 65536 ? o(t) : o(55296 + ((t -= 65536) >> 10), t % 1024 + 56320)) - } - return i.join("") + fromCodePoint: function (e) { + for (var t, i = [], n = arguments.length, a = 0; n > a; ) { + if (((t = +arguments[a++]), r(t, 1114111) !== t)) + throw RangeError(t + " is not a valid code point"); + i.push( + t < 65536 + ? o(t) + : o(55296 + ((t -= 65536) >> 10), (t % 1024) + 56320) + ); } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(24) - , o = i(10); + return i.join(""); + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(24), + o = i(10); n(n.S, "String", { - raw: function(e) { - for (var t = r(e.raw), i = o(t.length), n = arguments.length, a = [], s = 0; i > s; ) - a.push(String(t[s++])), - s < n && a.push(String(arguments[s])); - return a.join("") - } - }) -} -, function(e, t, i) { + raw: function (e) { + for ( + var t = r(e.raw), + i = o(t.length), + n = arguments.length, + a = [], + s = 0; + i > s; + + ) + a.push(String(t[s++])), s < n && a.push(String(arguments[s])); + return a.join(""); + }, + }); + }, + function (e, t, i) { "use strict"; - i(76)("trim", function(e) { - return function() { - return e(this, 3) - } - }) -} -, function(e, t, i) { + i(76)("trim", function (e) { + return function () { + return e(this, 3); + }; + }); + }, + function (e, t, i) { "use strict"; var n = i(108)(true); - i(109)(String, "String", function(e) { - this._t = String(e), - this._i = 0 - }, function() { - var e, t = this._t, i = this._i; - return i >= t.length ? { - value: void 0, - done: true - } : (e = n(t, i), - this._i += e.length, - { - value: e, - done: false - }) - }) -} -, function(e, t, i) { + i(109)( + String, + "String", + function (e) { + (this._t = String(e)), (this._i = 0); + }, + function () { + var e, + t = this._t, + i = this._i; + return i >= t.length + ? { + value: void 0, + done: true, + } + : ((e = n(t, i)), + (this._i += e.length), + { + value: e, + done: false, + }); + } + ); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(108)(false); + var n = i(0), + r = i(108)(false); n(n.P, "String", { - codePointAt: function(e) { - return r(this, e) - } - }) -} -, function(e, t, i) { + codePointAt: function (e) { + return r(this, e); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(10) - , o = i(110) - , a = "".endsWith; + var n = i(0), + r = i(10), + o = i(110), + a = "".endsWith; n(n.P + n.F * i(112)("endsWith"), "String", { - endsWith: function(e) { - var t = o(this, e, "endsWith") - , i = arguments.length > 1 ? arguments[1] : void 0 - , n = r(t.length) - , s = void 0 === i ? n : Math.min(r(i), n) - , c = String(e); - return a ? a.call(t, c, s) : t.slice(s - c.length, s) === c - } - }) -} -, function(e, t, i) { + endsWith: function (e) { + var t = o(this, e, "endsWith"), + i = arguments.length > 1 ? arguments[1] : void 0, + n = r(t.length), + s = void 0 === i ? n : Math.min(r(i), n), + c = String(e); + return a ? a.call(t, c, s) : t.slice(s - c.length, s) === c; + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(110); + var n = i(0), + r = i(110); n(n.P + n.F * i(112)("includes"), "String", { - includes: function(e) { - return !!~r(this, e, "includes").indexOf(e, arguments.length > 1 ? arguments[1] : void 0) - } - }) -} -, function(e, t, i) { + includes: function (e) { + return !!~r(this, e, "includes").indexOf( + e, + arguments.length > 1 ? arguments[1] : void 0 + ); + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.P, "String", { - repeat: i(105) - }) -} -, function(e, t, i) { + repeat: i(105), + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(10) - , o = i(110) - , a = "".startsWith; + var n = i(0), + r = i(10), + o = i(110), + a = "".startsWith; n(n.P + n.F * i(112)("startsWith"), "String", { - startsWith: function(e) { - var t = o(this, e, "startsWith") - , i = r(Math.min(arguments.length > 1 ? arguments[1] : void 0, t.length)) - , n = String(e); - return a ? a.call(t, n, i) : t.slice(i, i + n.length) === n - } - }) -} -, function(e, t, i) { + startsWith: function (e) { + var t = o(this, e, "startsWith"), + i = r( + Math.min(arguments.length > 1 ? arguments[1] : void 0, t.length) + ), + n = String(e); + return a ? a.call(t, n, i) : t.slice(i, i + n.length) === n; + }, + }); + }, + function (e, t, i) { "use strict"; - i(21)("anchor", function(e) { - return function(t) { - return e(this, "a", "name", t) - } - }) -} -, function(e, t, i) { + i(21)("anchor", function (e) { + return function (t) { + return e(this, "a", "name", t); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("big", function(e) { - return function() { - return e(this, "big", "", "") - } - }) -} -, function(e, t, i) { + i(21)("big", function (e) { + return function () { + return e(this, "big", "", ""); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("blink", function(e) { - return function() { - return e(this, "blink", "", "") - } - }) -} -, function(e, t, i) { + i(21)("blink", function (e) { + return function () { + return e(this, "blink", "", ""); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("bold", function(e) { - return function() { - return e(this, "b", "", "") - } - }) -} -, function(e, t, i) { + i(21)("bold", function (e) { + return function () { + return e(this, "b", "", ""); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("fixed", function(e) { - return function() { - return e(this, "tt", "", "") - } - }) -} -, function(e, t, i) { + i(21)("fixed", function (e) { + return function () { + return e(this, "tt", "", ""); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("fontcolor", function(e) { - return function(t) { - return e(this, "font", "color", t) - } - }) -} -, function(e, t, i) { + i(21)("fontcolor", function (e) { + return function (t) { + return e(this, "font", "color", t); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("fontsize", function(e) { - return function(t) { - return e(this, "font", "size", t) - } - }) -} -, function(e, t, i) { + i(21)("fontsize", function (e) { + return function (t) { + return e(this, "font", "size", t); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("italics", function(e) { - return function() { - return e(this, "i", "", "") - } - }) -} -, function(e, t, i) { + i(21)("italics", function (e) { + return function () { + return e(this, "i", "", ""); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("link", function(e) { - return function(t) { - return e(this, "a", "href", t) - } - }) -} -, function(e, t, i) { + i(21)("link", function (e) { + return function (t) { + return e(this, "a", "href", t); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("small", function(e) { - return function() { - return e(this, "small", "", "") - } - }) -} -, function(e, t, i) { + i(21)("small", function (e) { + return function () { + return e(this, "small", "", ""); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("strike", function(e) { - return function() { - return e(this, "strike", "", "") - } - }) -} -, function(e, t, i) { + i(21)("strike", function (e) { + return function () { + return e(this, "strike", "", ""); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("sub", function(e) { - return function() { - return e(this, "sub", "", "") - } - }) -} -, function(e, t, i) { + i(21)("sub", function (e) { + return function () { + return e(this, "sub", "", ""); + }; + }); + }, + function (e, t, i) { "use strict"; - i(21)("sup", function(e) { - return function() { - return e(this, "sup", "", "") - } - }) -} -, function(e, t, i) { + i(21)("sup", function (e) { + return function () { + return e(this, "sup", "", ""); + }; + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Date", { - now: function() { - return (new Date).getTime() - } - }) -} -, function(e, t, i) { + now: function () { + return new Date().getTime(); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(20) - , o = i(39); - n(n.P + n.F * i(3)(function() { - return null !== new Date(NaN).toJSON() || 1 !== Date.prototype.toJSON.call({ - toISOString: function() { - return 1 - } - }) - }), "Date", { - toJSON: function(e) { - var t = r(this) - , i = o(t); - return "number" != typeof i || isFinite(i) ? t.toISOString() : null - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(310); + var n = i(0), + r = i(20), + o = i(39); + n( + n.P + + n.F * + i(3)(function () { + return ( + null !== new Date(NaN).toJSON() || + 1 !== + Date.prototype.toJSON.call({ + toISOString: function () { + return 1; + }, + }) + ); + }), + "Date", + { + toJSON: function (e) { + var t = r(this), + i = o(t); + return "number" != typeof i || isFinite(i) ? t.toISOString() : null; + }, + } + ); + }, + function (e, t, i) { + var n = i(0), + r = i(310); n(n.P + n.F * (Date.prototype.toISOString !== r), "Date", { - toISOString: r - }) -} -, function(e, t, i) { + toISOString: r, + }); + }, + function (e, t, i) { "use strict"; - var n = i(3) - , r = Date.prototype.getTime - , o = Date.prototype.toISOString - , a = function(e) { - return e > 9 ? e : "0" + e - }; - e.exports = n(function() { - return "0385-07-25T07:06:39.999Z" != o.call(new Date(-5e13 - 1)) - }) || !n(function() { - o.call(new Date(NaN)) - }) ? function() { - if (!isFinite(r.call(this))) - throw RangeError("Invalid time value"); - var e = this - , t = e.getUTCFullYear() - , i = e.getUTCMilliseconds() - , n = t < 0 ? "-" : t > 9999 ? "+" : ""; - return n + ("00000" + Math.abs(t)).slice(n ? -6 : -4) + "-" + a(e.getUTCMonth() + 1) + "-" + a(e.getUTCDate()) + "T" + a(e.getUTCHours()) + ":" + a(e.getUTCMinutes()) + ":" + a(e.getUTCSeconds()) + "." + (i > 99 ? i : "0" + a(i)) + "Z" - } - : o -} -, function(e, t, i) { - var n = Date.prototype - , r = n.toString - , o = n.getTime; - new Date(NaN) + "" != "Invalid Date" && i(19)(n, "toString", function() { + var n = i(3), + r = Date.prototype.getTime, + o = Date.prototype.toISOString, + a = function (e) { + return e > 9 ? e : "0" + e; + }; + e.exports = + n(function () { + return "0385-07-25T07:06:39.999Z" != o.call(new Date(-5e13 - 1)); + }) || + !n(function () { + o.call(new Date(NaN)); + }) + ? function () { + if (!isFinite(r.call(this))) throw RangeError("Invalid time value"); + var e = this, + t = e.getUTCFullYear(), + i = e.getUTCMilliseconds(), + n = t < 0 ? "-" : t > 9999 ? "+" : ""; + return ( + n + + ("00000" + Math.abs(t)).slice(n ? -6 : -4) + + "-" + + a(e.getUTCMonth() + 1) + + "-" + + a(e.getUTCDate()) + + "T" + + a(e.getUTCHours()) + + ":" + + a(e.getUTCMinutes()) + + ":" + + a(e.getUTCSeconds()) + + "." + + (i > 99 ? i : "0" + a(i)) + + "Z" + ); + } + : o; + }, + function (e, t, i) { + var n = Date.prototype, + r = n.toString, + o = n.getTime; + new Date(NaN) + "" != "Invalid Date" && + i(19)(n, "toString", function () { var e = o.call(this); - return e == e ? r.call(this) : "Invalid Date" - }) -} -, function(e, t, i) { - var n = i(8)("toPrimitive") - , r = Date.prototype; - n in r || i(23)(r, n, i(313)) -} -, function(e, t, i) { + return e == e ? r.call(this) : "Invalid Date"; + }); + }, + function (e, t, i) { + var n = i(8)("toPrimitive"), + r = Date.prototype; + n in r || i(23)(r, n, i(313)); + }, + function (e, t, i) { "use strict"; - var n = i(4) - , r = i(39); - e.exports = function(e) { - if ("string" !== e && "number" !== e && "default" !== e) - throw TypeError("Incorrect hint"); - return r(n(this), "number" != e) - } -} -, function(e, t, i) { + var n = i(4), + r = i(39); + e.exports = function (e) { + if ("string" !== e && "number" !== e && "default" !== e) + throw TypeError("Incorrect hint"); + return r(n(this), "number" != e); + }; + }, + function (e, t, i) { var n = i(0); n(n.S, "Array", { - isArray: i(100) - }) -} -, function(e, t, i) { + isArray: i(100), + }); + }, + function (e, t, i) { "use strict"; - var n = i(34) - , r = i(0) - , o = i(20) - , a = i(153) - , s = i(113) - , c = i(10) - , u = i(114) - , l = i(115); - r(r.S + r.F * !i(77)(function(e) { - Array.from(e) - }), "Array", { - from: function(e) { - var t, i, r, h, f = o(e), d = "function" == typeof this ? this : Array, p = arguments.length, m = p > 1 ? arguments[1] : void 0, g = void 0 !== m, _ = 0, v = l(f); - if (g && (m = n(m, p > 2 ? arguments[2] : void 0, 2)), - null == v || d == Array && s(v)) - for (i = new d(t = c(f.length)); t > _; _++) - u(i, _, g ? m(f[_], _) : f[_]); - else - for (h = v.call(f), - i = new d; !(r = h.next()).done; _++) - u(i, _, g ? a(h, m, [r.value, _], true) : r.value); - return i.length = _, - i - } - }) -} -, function(e, t, i) { + var n = i(34), + r = i(0), + o = i(20), + a = i(153), + s = i(113), + c = i(10), + u = i(114), + l = i(115); + r( + r.S + + r.F * + !i(77)(function (e) { + Array.from(e); + }), + "Array", + { + from: function (e) { + var t, + i, + r, + h, + f = o(e), + d = "function" == typeof this ? this : Array, + p = arguments.length, + m = p > 1 ? arguments[1] : void 0, + g = void 0 !== m, + _ = 0, + v = l(f); + if ( + (g && (m = n(m, p > 2 ? arguments[2] : void 0, 2)), + null == v || (d == Array && s(v))) + ) + for (i = new d((t = c(f.length))); t > _; _++) + u(i, _, g ? m(f[_], _) : f[_]); + else + for (h = v.call(f), i = new d(); !(r = h.next()).done; _++) + u(i, _, g ? a(h, m, [r.value, _], true) : r.value); + return (i.length = _), i; + }, + } + ); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(114); - n(n.S + n.F * i(3)(function() { - function e() {} - return !(Array.of.call(e)instanceof e) - }), "Array", { - of: function() { - for (var e = 0, t = arguments.length, i = new ("function" == typeof this ? this : Array)(t); t > e; ) - r(i, e, arguments[e++]); - return i.length = t, - i - } - }) -} -, function(e, t, i) { + var n = i(0), + r = i(114); + n( + n.S + + n.F * + i(3)(function () { + function e() {} + return !(Array.of.call(e) instanceof e); + }), + "Array", + { + of: function () { + for ( + var e = 0, + t = arguments.length, + i = new ("function" == typeof this ? this : Array)(t); + t > e; + + ) + r(i, e, arguments[e++]); + return (i.length = t), i; + }, + } + ); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(24) - , o = [].join; + var n = i(0), + r = i(24), + o = [].join; n(n.P + n.F * (i(64) != Object || !i(26)(o)), "Array", { - join: function(e) { - return o.call(r(this), void 0 === e ? "," : e) - } - }) -} -, function(e, t, i) { + join: function (e) { + return o.call(r(this), void 0 === e ? "," : e); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(101) - , o = i(36) - , a = i(49) - , s = i(10) - , c = [].slice; - n(n.P + n.F * i(3)(function() { - r && c.call(r) - }), "Array", { - slice: function(e, t) { - var i = s(this.length) - , n = o(this); - if (t = void 0 === t ? i : t, - "Array" == n) - return c.call(this, e, t); - for (var r = a(e, i), u = a(t, i), l = s(u - r), h = new Array(l), f = 0; f < l; f++) - h[f] = "String" == n ? this.charAt(r + f) : this[r + f]; - return h - } - }) -} -, function(e, t, i) { + var n = i(0), + r = i(101), + o = i(36), + a = i(49), + s = i(10), + c = [].slice; + n( + n.P + + n.F * + i(3)(function () { + r && c.call(r); + }), + "Array", + { + slice: function (e, t) { + var i = s(this.length), + n = o(this); + if (((t = void 0 === t ? i : t), "Array" == n)) + return c.call(this, e, t); + for ( + var r = a(e, i), u = a(t, i), l = s(u - r), h = new Array(l), f = 0; + f < l; + f++ + ) + h[f] = "String" == n ? this.charAt(r + f) : this[r + f]; + return h; + }, + } + ); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(35) - , o = i(20) - , a = i(3) - , s = [].sort - , c = [1, 2, 3]; - n(n.P + n.F * (a(function() { - c.sort(void 0) - }) || !a(function() { - c.sort(null) - }) || !i(26)(s)), "Array", { - sort: function(e) { - return void 0 === e ? s.call(o(this)) : s.call(o(this), r(e)) - } - }) -} -, function(e, t, i) { + var n = i(0), + r = i(35), + o = i(20), + a = i(3), + s = [].sort, + c = [1, 2, 3]; + n( + n.P + + n.F * + (a(function () { + c.sort(void 0); + }) || + !a(function () { + c.sort(null); + }) || + !i(26)(s)), + "Array", + { + sort: function (e) { + return void 0 === e ? s.call(o(this)) : s.call(o(this), r(e)); + }, + } + ); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(31)(0) - , o = i(26)([].forEach, true); + var n = i(0), + r = i(31)(0), + o = i(26)([].forEach, true); n(n.P + n.F * !o, "Array", { - forEach: function(e) { - return r(this, e, arguments[1]) - } - }) -} -, function(e, t, i) { + forEach: function (e) { + return r(this, e, arguments[1]); + }, + }); + }, + function (e, t, i) { var n = i(322); - e.exports = function(e, t) { - return new (n(e))(t) - } -} -, function(e, t, i) { - var n = i(6) - , r = i(100) - , o = i(8)("species"); - e.exports = function(e) { - var t; - return r(e) && ("function" != typeof (t = e.constructor) || t !== Array && !r(t.prototype) || (t = void 0), - n(t) && null === (t = t[o]) && (t = void 0)), + e.exports = function (e, t) { + return new (n(e))(t); + }; + }, + function (e, t, i) { + var n = i(6), + r = i(100), + o = i(8)("species"); + e.exports = function (e) { + var t; + return ( + r(e) && + ("function" != typeof (t = e.constructor) || + (t !== Array && !r(t.prototype)) || + (t = void 0), + n(t) && null === (t = t[o]) && (t = void 0)), void 0 === t ? Array : t - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(31)(1); + var n = i(0), + r = i(31)(1); n(n.P + n.F * !i(26)([].map, true), "Array", { - map: function(e) { - return r(this, e, arguments[1]) - } - }) -} -, function(e, t, i) { + map: function (e) { + return r(this, e, arguments[1]); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(31)(2); + var n = i(0), + r = i(31)(2); n(n.P + n.F * !i(26)([].filter, true), "Array", { - filter: function(e) { - return r(this, e, arguments[1]) - } - }) -} -, function(e, t, i) { + filter: function (e) { + return r(this, e, arguments[1]); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(31)(3); + var n = i(0), + r = i(31)(3); n(n.P + n.F * !i(26)([].some, true), "Array", { - some: function(e) { - return r(this, e, arguments[1]) - } - }) -} -, function(e, t, i) { + some: function (e) { + return r(this, e, arguments[1]); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(31)(4); + var n = i(0), + r = i(31)(4); n(n.P + n.F * !i(26)([].every, true), "Array", { - every: function(e) { - return r(this, e, arguments[1]) - } - }) -} -, function(e, t, i) { + every: function (e) { + return r(this, e, arguments[1]); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(154); + var n = i(0), + r = i(154); n(n.P + n.F * !i(26)([].reduce, true), "Array", { - reduce: function(e) { - return r(this, e, arguments.length, arguments[1], false) - } - }) -} -, function(e, t, i) { + reduce: function (e) { + return r(this, e, arguments.length, arguments[1], false); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(154); + var n = i(0), + r = i(154); n(n.P + n.F * !i(26)([].reduceRight, true), "Array", { - reduceRight: function(e) { - return r(this, e, arguments.length, arguments[1], true) - } - }) -} -, function(e, t, i) { + reduceRight: function (e) { + return r(this, e, arguments.length, arguments[1], true); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(74)(false) - , o = [].indexOf - , a = !!o && 1 / [1].indexOf(1, -0) < 0; + var n = i(0), + r = i(74)(false), + o = [].indexOf, + a = !!o && 1 / [1].indexOf(1, -0) < 0; n(n.P + n.F * (a || !i(26)(o)), "Array", { - indexOf: function(e) { - return a ? o.apply(this, arguments) || 0 : r(this, e, arguments[1]) - } - }) -} -, function(e, t, i) { + indexOf: function (e) { + return a ? o.apply(this, arguments) || 0 : r(this, e, arguments[1]); + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(24) - , o = i(28) - , a = i(10) - , s = [].lastIndexOf - , c = !!s && 1 / [1].lastIndexOf(1, -0) < 0; + var n = i(0), + r = i(24), + o = i(28), + a = i(10), + s = [].lastIndexOf, + c = !!s && 1 / [1].lastIndexOf(1, -0) < 0; n(n.P + n.F * (c || !i(26)(s)), "Array", { - lastIndexOf: function(e) { - if (c) - return s.apply(this, arguments) || 0; - var t = r(this) - , i = a(t.length) - , n = i - 1; - for (arguments.length > 1 && (n = Math.min(n, o(arguments[1]))), - n < 0 && (n = i + n); n >= 0; n--) - if (n in t && t[n] === e) - return n || 0; - return -1 - } - }) -} -, function(e, t, i) { + lastIndexOf: function (e) { + if (c) return s.apply(this, arguments) || 0; + var t = r(this), + i = a(t.length), + n = i - 1; + for ( + arguments.length > 1 && (n = Math.min(n, o(arguments[1]))), + n < 0 && (n = i + n); + n >= 0; + n-- + ) + if (n in t && t[n] === e) return n || 0; + return -1; + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.P, "Array", { - copyWithin: i(155) + copyWithin: i(155), }), - i(58)("copyWithin") -} -, function(e, t, i) { + i(58)("copyWithin"); + }, + function (e, t, i) { var n = i(0); n(n.P, "Array", { - fill: i(116) + fill: i(116), }), - i(58)("fill") -} -, function(e, t, i) { + i(58)("fill"); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(31)(5) - , o = true; - "find"in [] && Array(1).find(function() { - o = false - }), - n(n.P + n.F * o, "Array", { - find: function(e) { - return r(this, e, arguments.length > 1 ? arguments[1] : void 0) - } - }), - i(58)("find") -} -, function(e, t, i) { + var n = i(0), + r = i(31)(5), + o = true; + "find" in [] && + Array(1).find(function () { + o = false; + }), + n(n.P + n.F * o, "Array", { + find: function (e) { + return r(this, e, arguments.length > 1 ? arguments[1] : void 0); + }, + }), + i(58)("find"); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(31)(6) - , o = "findIndex" - , a = true; - o in [] && Array(1)[o](function() { - a = false - }), - n(n.P + n.F * a, "Array", { - findIndex: function(e) { - return r(this, e, arguments.length > 1 ? arguments[1] : void 0) - } - }), - i(58)(o) -} -, function(e, t, i) { - i(59)("Array") -} -, function(e, t, i) { - var n = i(5) - , r = i(104) - , o = i(12).f - , a = i(51).f - , s = i(111) - , c = i(78) - , u = n.RegExp - , l = u - , h = u.prototype - , f = /a/g - , d = /a/g - , p = new u(f) !== f; - if (i(13) && (!p || i(3)(function() { - return d[i(8)("match")] = false, - u(f) != f || u(d) == d || "/a/i" != u(f, "i") - }))) { - u = function(e, t) { - var i = this instanceof u - , n = s(e) - , o = void 0 === t; - return !i && n && e.constructor === u && o ? e : r(p ? new l(n && !o ? e.source : e,t) : l((n = e instanceof u) ? e.source : e, n && o ? c.call(e) : t), i ? this : h, u) - } - ; - for (var m = function(e) { - e in u || o(u, e, { + var n = i(0), + r = i(31)(6), + o = "findIndex", + a = true; + o in [] && + Array(1)[o](function () { + a = false; + }), + n(n.P + n.F * a, "Array", { + findIndex: function (e) { + return r(this, e, arguments.length > 1 ? arguments[1] : void 0); + }, + }), + i(58)(o); + }, + function (e, t, i) { + i(59)("Array"); + }, + function (e, t, i) { + var n = i(5), + r = i(104), + o = i(12).f, + a = i(51).f, + s = i(111), + c = i(78), + u = n.RegExp, + l = u, + h = u.prototype, + f = /a/g, + d = /a/g, + p = new u(f) !== f; + if ( + i(13) && + (!p || + i(3)(function () { + return ( + (d[i(8)("match")] = false), + u(f) != f || u(d) == d || "/a/i" != u(f, "i") + ); + })) + ) { + u = function (e, t) { + var i = this instanceof u, + n = s(e), + o = void 0 === t; + return !i && n && e.constructor === u && o + ? e + : r( + p + ? new l(n && !o ? e.source : e, t) + : l( + (n = e instanceof u) ? e.source : e, + n && o ? c.call(e) : t + ), + i ? this : h, + u + ); + }; + for ( + var m = function (e) { + (e in u) || + o(u, e, { configurable: true, - get: function() { - return l[e] + get: function () { + return l[e]; }, - set: function(t) { - l[e] = t - } - }) - }, g = a(l), _ = 0; g.length > _; ) - m(g[_++]); - h.constructor = u, - u.prototype = h, - i(19)(n, "RegExp", u) + set: function (t) { + l[e] = t; + }, + }); + }, + g = a(l), + _ = 0; + g.length > _; + + ) + m(g[_++]); + (h.constructor = u), (u.prototype = h), i(19)(n, "RegExp", u); } - i(59)("RegExp") -} -, function(e, t, i) { + i(59)("RegExp"); + }, + function (e, t, i) { "use strict"; i(158); - var n = i(4) - , r = i(78) - , o = i(13) - , a = /./.toString - , s = function(e) { - i(19)(RegExp.prototype, "toString", e, true) - }; - i(3)(function() { - return "/a/b" != a.call({ - source: "a", - flags: "b" + var n = i(4), + r = i(78), + o = i(13), + a = /./.toString, + s = function (e) { + i(19)(RegExp.prototype, "toString", e, true); + }; + i(3)(function () { + return ( + "/a/b" != + a.call({ + source: "a", + flags: "b", }) - }) ? s(function() { - var e = n(this); - return "/".concat(e.source, "/", "flags"in e ? e.flags : !o && e instanceof RegExp ? r.call(e) : void 0) - }) : "toString" != a.name && s(function() { - return a.call(this) + ); }) -} -, function(e, t, i) { + ? s(function () { + var e = n(this); + return "/".concat( + e.source, + "/", + "flags" in e + ? e.flags + : !o && e instanceof RegExp + ? r.call(e) + : void 0 + ); + }) + : "toString" != a.name && + s(function () { + return a.call(this); + }); + }, + function (e, t, i) { "use strict"; - var n = i(4) - , r = i(10) - , o = i(119) - , a = i(79); - i(80)("match", 1, function(e, t, i, s) { - return [function(i) { - var n = e(this) - , r = null == i ? void 0 : i[t]; - return void 0 !== r ? r.call(i, n) : new RegExp(i)[t](String(n)) - } - , function(e) { - var t = s(i, e, this); - if (t.done) - return t.value; - var c = n(e) - , u = String(this); - if (!c.global) - return a(c, u); - var l = c.unicode; - c.lastIndex = 0; - for (var h, f = [], d = 0; null !== (h = a(c, u)); ) { - var p = String(h[0]); - f[d] = p, - "" === p && (c.lastIndex = o(u, r(c.lastIndex), l)), - d++ - } - return 0 === d ? null : f - } - ] - }) -} -, function(e, t, i) { + var n = i(4), + r = i(10), + o = i(119), + a = i(79); + i(80)("match", 1, function (e, t, i, s) { + return [ + function (i) { + var n = e(this), + r = null == i ? void 0 : i[t]; + return void 0 !== r ? r.call(i, n) : new RegExp(i)[t](String(n)); + }, + function (e) { + var t = s(i, e, this); + if (t.done) return t.value; + var c = n(e), + u = String(this); + if (!c.global) return a(c, u); + var l = c.unicode; + c.lastIndex = 0; + for (var h, f = [], d = 0; null !== (h = a(c, u)); ) { + var p = String(h[0]); + (f[d] = p), + "" === p && (c.lastIndex = o(u, r(c.lastIndex), l)), + d++; + } + return 0 === d ? null : f; + }, + ]; + }); + }, + function (e, t, i) { "use strict"; - var n = i(4) - , r = i(20) - , o = i(10) - , a = i(28) - , s = i(119) - , c = i(79) - , u = Math.max - , l = Math.min - , h = Math.floor - , f = /\$([$&`']|\d\d?|<[^>]*>)/g - , d = /\$([$&`']|\d\d?)/g; - i(80)("replace", 2, function(e, t, i, p) { - return [function(n, r) { - var o = e(this) - , a = null == n ? void 0 : n[t]; - return void 0 !== a ? a.call(n, o, r) : i.call(String(o), n, r) - } - , function(e, t) { - var r = p(i, e, this, t); - if (r.done) - return r.value; - var h = n(e) - , f = String(this) - , d = "function" == typeof t; - d || (t = String(t)); - var g = h.global; - if (g) { - var _ = h.unicode; - h.lastIndex = 0 - } - for (var v = []; ; ) { - var y = c(h, f); - if (null === y) - break; - if (v.push(y), - !g) - break; - "" === String(y[0]) && (h.lastIndex = s(f, o(h.lastIndex), _)) - } - for (var b, E = "", T = 0, A = 0; A < v.length; A++) { - y = v[A]; - for (var x = String(y[0]), S = u(l(a(y.index), f.length), 0), C = [], P = 1; P < y.length; P++) - C.push(void 0 === (b = y[P]) ? b : String(b)); - var R = y.groups; - if (d) { - var M = [x].concat(C, S, f); - void 0 !== R && M.push(R); - var O = String(t.apply(void 0, M)) - } else - O = m(x, f, S, C, R, t); - S >= T && (E += f.slice(T, S) + O, - T = S + x.length) - } - return E + f.slice(T) - } - ]; - function m(e, t, n, o, a, s) { - var c = n + e.length - , u = o.length - , l = d; - return void 0 !== a && (a = r(a), - l = f), - i.call(s, l, function(i, r) { - var s; - switch (r.charAt(0)) { - case "$": - return "$"; - case "&": - return e; - case "`": - return t.slice(0, n); - case "'": - return t.slice(c); - case "<": - s = a[r.slice(1, -1)]; - break; - default: - var l = +r; - if (0 === l) - return r; - if (l > u) { - var f = h(l / 10); - return 0 === f ? r : f <= u ? void 0 === o[f - 1] ? r.charAt(1) : o[f - 1] + r.charAt(1) : r - } - s = o[l - 1] + var n = i(4), + r = i(20), + o = i(10), + a = i(28), + s = i(119), + c = i(79), + u = Math.max, + l = Math.min, + h = Math.floor, + f = /\$([$&`']|\d\d?|<[^>]*>)/g, + d = /\$([$&`']|\d\d?)/g; + i(80)("replace", 2, function (e, t, i, p) { + return [ + function (n, r) { + var o = e(this), + a = null == n ? void 0 : n[t]; + return void 0 !== a ? a.call(n, o, r) : i.call(String(o), n, r); + }, + function (e, t) { + var r = p(i, e, this, t); + if (r.done) return r.value; + var h = n(e), + f = String(this), + d = "function" == typeof t; + d || (t = String(t)); + var g = h.global; + if (g) { + var _ = h.unicode; + h.lastIndex = 0; + } + for (var v = []; ; ) { + var y = c(h, f); + if (null === y) break; + if ((v.push(y), !g)) break; + "" === String(y[0]) && (h.lastIndex = s(f, o(h.lastIndex), _)); + } + for (var b, E = "", T = 0, A = 0; A < v.length; A++) { + y = v[A]; + for ( + var x = String(y[0]), + S = u(l(a(y.index), f.length), 0), + C = [], + P = 1; + P < y.length; + P++ + ) + C.push(void 0 === (b = y[P]) ? b : String(b)); + var R = y.groups; + if (d) { + var M = [x].concat(C, S, f); + void 0 !== R && M.push(R); + var O = String(t.apply(void 0, M)); + } else O = m(x, f, S, C, R, t); + S >= T && ((E += f.slice(T, S) + O), (T = S + x.length)); + } + return E + f.slice(T); + }, + ]; + function m(e, t, n, o, a, s) { + var c = n + e.length, + u = o.length, + l = d; + return ( + void 0 !== a && ((a = r(a)), (l = f)), + i.call(s, l, function (i, r) { + var s; + switch (r.charAt(0)) { + case "$": + return "$"; + case "&": + return e; + case "`": + return t.slice(0, n); + case "'": + return t.slice(c); + case "<": + s = a[r.slice(1, -1)]; + break; + default: + var l = +r; + if (0 === l) return r; + if (l > u) { + var f = h(l / 10); + return 0 === f + ? r + : f <= u + ? void 0 === o[f - 1] + ? r.charAt(1) + : o[f - 1] + r.charAt(1) + : r; } - return void 0 === s ? "" : s - }) - } - }) -} -, function(e, t, i) { + s = o[l - 1]; + } + return void 0 === s ? "" : s; + }) + ); + } + }); + }, + function (e, t, i) { "use strict"; - var n = i(4) - , r = i(144) - , o = i(79); - i(80)("search", 1, function(e, t, i, a) { - return [function(i) { - var n = e(this) - , r = null == i ? void 0 : i[t]; - return void 0 !== r ? r.call(i, n) : new RegExp(i)[t](String(n)) - } - , function(e) { - var t = a(i, e, this); - if (t.done) - return t.value; - var s = n(e) - , c = String(this) - , u = s.lastIndex; - r(u, 0) || (s.lastIndex = 0); - var l = o(s, c); - return r(s.lastIndex, u) || (s.lastIndex = u), - null === l ? -1 : l.index - } - ] - }) -} -, function(e, t, i) { + var n = i(4), + r = i(144), + o = i(79); + i(80)("search", 1, function (e, t, i, a) { + return [ + function (i) { + var n = e(this), + r = null == i ? void 0 : i[t]; + return void 0 !== r ? r.call(i, n) : new RegExp(i)[t](String(n)); + }, + function (e) { + var t = a(i, e, this); + if (t.done) return t.value; + var s = n(e), + c = String(this), + u = s.lastIndex; + r(u, 0) || (s.lastIndex = 0); + var l = o(s, c); + return ( + r(s.lastIndex, u) || (s.lastIndex = u), null === l ? -1 : l.index + ); + }, + ]; + }); + }, + function (e, t, i) { "use strict"; - var n = i(111) - , r = i(4) - , o = i(67) - , a = i(119) - , s = i(10) - , c = i(79) - , u = i(118) - , l = Math.min - , h = [].push - , f = !!function() { + var n = i(111), + r = i(4), + o = i(67), + a = i(119), + s = i(10), + c = i(79), + u = i(118), + l = Math.min, + h = [].push, + f = !!(function () { try { - return new RegExp("x","y") + return new RegExp("x", "y"); } catch (e) {} - }(); - i(80)("split", 2, function(e, t, i, d) { - var p = i; - return "c" == "abbc".split(/(b)*/)[1] || 4 != "test".split(/(?:)/, -1).length || 2 != "ab".split(/(?:ab)*/).length || 4 != ".".split(/(.?)(.?)/).length || ".".split(/()()/).length > 1 || "".split(/.?/).length ? p = function(e, t) { - var r = String(this); - if (void 0 === e && 0 === t) - return []; - if (!n(e)) - return i.call(r, e, t); - for (var o, a, s, c = [], l = (e.ignoreCase ? "i" : "") + (e.multiline ? "m" : "") + (e.unicode ? "u" : "") + (e.sticky ? "y" : ""), f = 0, d = void 0 === t ? 4294967295 : t >>> 0, p = new RegExp(e.source,l + "g"); (o = u.call(p, r)) && !((a = p.lastIndex) > f && (c.push(r.slice(f, o.index)), - o.length > 1 && o.index < r.length && h.apply(c, o.slice(1)), - s = o[0].length, - f = a, - c.length >= d)); ) + })(); + i(80)("split", 2, function (e, t, i, d) { + var p = i; + return ( + "c" == "abbc".split(/(b)*/)[1] || + 4 != "test".split(/(?:)/, -1).length || + 2 != "ab".split(/(?:ab)*/).length || + 4 != ".".split(/(.?)(.?)/).length || + ".".split(/()()/).length > 1 || + "".split(/.?/).length + ? (p = function (e, t) { + var r = String(this); + if (void 0 === e && 0 === t) return []; + if (!n(e)) return i.call(r, e, t); + for ( + var o, + a, + s, + c = [], + l = + (e.ignoreCase ? "i" : "") + + (e.multiline ? "m" : "") + + (e.unicode ? "u" : "") + + (e.sticky ? "y" : ""), + f = 0, + d = void 0 === t ? 4294967295 : t >>> 0, + p = new RegExp(e.source, l + "g"); + (o = u.call(p, r)) && + !( + (a = p.lastIndex) > f && + (c.push(r.slice(f, o.index)), + o.length > 1 && o.index < r.length && h.apply(c, o.slice(1)), + (s = o[0].length), + (f = a), + c.length >= d) + ); + + ) p.lastIndex === o.index && p.lastIndex++; - return f === r.length ? !s && p.test("") || c.push("") : c.push(r.slice(f)), - c.length > d ? c.slice(0, d) : c - } - : "0".split(void 0, 0).length && (p = function(e, t) { - return void 0 === e && 0 === t ? [] : i.call(this, e, t) - } - ), - [function(i, n) { - var r = e(this) - , o = null == i ? void 0 : i[t]; - return void 0 !== o ? o.call(i, r, n) : p.call(String(r), i, n) - } - , function(e, t) { - var n = d(p, e, this, t, p !== i); - if (n.done) - return n.value; - var u = r(e) - , h = String(this) - , m = o(u, RegExp) - , g = u.unicode - , _ = (u.ignoreCase ? "i" : "") + (u.multiline ? "m" : "") + (u.unicode ? "u" : "") + (f ? "y" : "g") - , v = new m(f ? u : "^(?:" + u.source + ")",_) - , y = void 0 === t ? 4294967295 : t >>> 0; - if (0 === y) - return []; - if (0 === h.length) - return null === c(v, h) ? [h] : []; - for (var b = 0, E = 0, T = []; E < h.length; ) { - v.lastIndex = f ? E : 0; - var A, x = c(v, f ? h : h.slice(E)); - if (null === x || (A = l(s(v.lastIndex + (f ? 0 : E)), h.length)) === b) - E = a(h, E, g); - else { - if (T.push(h.slice(b, E)), - T.length === y) - return T; - for (var S = 1; S <= x.length - 1; S++) - if (T.push(x[S]), - T.length === y) - return T; - E = b = A - } - } - return T.push(h.slice(b)), - T - } - ] - }) -} -, function(e, t, i) { - var n = i(5) - , r = i(120).set - , o = n.MutationObserver || n.WebKitMutationObserver - , a = n.process - , s = n.Promise - , c = "process" == i(36)(a); - e.exports = function() { - var e, t, i, u = function() { - var n, r; - for (c && (n = a.domain) && n.exit(); e; ) { - r = e.fn, - e = e.next; - try { - r() - } catch (n) { - throw e ? i() : t = void 0, - n - } - } - t = void 0, - n && n.enter() - }; - if (c) - i = function() { - a.nextTick(u) - } - ; - else if (!o || n.navigator && n.navigator.standalone) - if (s && s.resolve) { - var l = s.resolve(void 0); - i = function() { - l.then(u) - } - } else - i = function() { - r.call(n, u) - } - ; - else { - var h = true - , f = document.createTextNode(""); - new o(u).observe(f, { - characterData: true + return ( + f === r.length + ? (!s && p.test("")) || c.push("") + : c.push(r.slice(f)), + c.length > d ? c.slice(0, d) : c + ); + }) + : "0".split(void 0, 0).length && + (p = function (e, t) { + return void 0 === e && 0 === t ? [] : i.call(this, e, t); }), - i = function() { - f.data = h = !h + [ + function (i, n) { + var r = e(this), + o = null == i ? void 0 : i[t]; + return void 0 !== o ? o.call(i, r, n) : p.call(String(r), i, n); + }, + function (e, t) { + var n = d(p, e, this, t, p !== i); + if (n.done) return n.value; + var u = r(e), + h = String(this), + m = o(u, RegExp), + g = u.unicode, + _ = + (u.ignoreCase ? "i" : "") + + (u.multiline ? "m" : "") + + (u.unicode ? "u" : "") + + (f ? "y" : "g"), + v = new m(f ? u : "^(?:" + u.source + ")", _), + y = void 0 === t ? 4294967295 : t >>> 0; + if (0 === y) return []; + if (0 === h.length) return null === c(v, h) ? [h] : []; + for (var b = 0, E = 0, T = []; E < h.length; ) { + v.lastIndex = f ? E : 0; + var A, + x = c(v, f ? h : h.slice(E)); + if ( + null === x || + (A = l(s(v.lastIndex + (f ? 0 : E)), h.length)) === b + ) + E = a(h, E, g); + else { + if ((T.push(h.slice(b, E)), T.length === y)) return T; + for (var S = 1; S <= x.length - 1; S++) + if ((T.push(x[S]), T.length === y)) return T; + E = b = A; + } } - } - return function(n) { - var r = { - fn: n, - next: void 0 - }; - t && (t.next = r), - e || (e = r, - i()), - t = r - } - } -} -, function(e, t) { - e.exports = function(e) { - try { - return { - e: false, - v: e() + return T.push(h.slice(b)), T; + }, + ] + ); + }); + }, + function (e, t, i) { + var n = i(5), + r = i(120).set, + o = n.MutationObserver || n.WebKitMutationObserver, + a = n.process, + s = n.Promise, + c = "process" == i(36)(a); + e.exports = function () { + var e, + t, + i, + u = function () { + var n, r; + for (c && (n = a.domain) && n.exit(); e; ) { + (r = e.fn), (e = e.next); + try { + r(); + } catch (n) { + throw (e ? i() : (t = void 0), n); } - } catch (e) { - return { - e: true, - v: e - } - } - } -} -, function(e, t, i) { + } + (t = void 0), n && n.enter(); + }; + if (c) + i = function () { + a.nextTick(u); + }; + else if (!o || (n.navigator && n.navigator.standalone)) + if (s && s.resolve) { + var l = s.resolve(void 0); + i = function () { + l.then(u); + }; + } else + i = function () { + r.call(n, u); + }; + else { + var h = true, + f = document.createTextNode(""); + new o(u).observe(f, { + characterData: true, + }), + (i = function () { + f.data = h = !h; + }); + } + return function (n) { + var r = { + fn: n, + next: void 0, + }; + t && (t.next = r), e || ((e = r), i()), (t = r); + }; + }; + }, + function (e, t) { + e.exports = function (e) { + try { + return { + e: false, + v: e(), + }; + } catch (e) { + return { + e: true, + v: e, + }; + } + }; + }, + function (e, t, i) { "use strict"; - var n = i(162) - , r = i(62); - e.exports = i(83)("Map", function(e) { - return function() { - return e(this, arguments.length > 0 ? arguments[0] : void 0) - } - }, { - get: function(e) { - var t = n.getEntry(r(this, "Map"), e); - return t && t.v + var n = i(162), + r = i(62); + e.exports = i(83)( + "Map", + function (e) { + return function () { + return e(this, arguments.length > 0 ? arguments[0] : void 0); + }; + }, + { + get: function (e) { + var t = n.getEntry(r(this, "Map"), e); + return t && t.v; }, - set: function(e, t) { - return n.def(r(this, "Map"), 0 === e ? 0 : e, t) - } - }, n, true) -} -, function(e, t, i) { - "use strict"; - var n = i(162) - , r = i(62); - e.exports = i(83)("Set", function(e) { - return function() { - return e(this, arguments.length > 0 ? arguments[0] : void 0) - } - }, { - add: function(e) { - return n.def(r(this, "Set"), e = 0 === e ? 0 : e, e) - } - }, n) -} -, function(e, t, i) { - "use strict"; - var n, r = i(31)(0), o = i(19), a = i(40), s = i(143), c = i(163), u = i(6), l = i(3), h = i(62), f = a.getWeak, d = Object.isExtensible, p = c.ufstore, m = {}, g = function(e) { - return function() { - return e(this, arguments.length > 0 ? arguments[0] : void 0) - } - }, _ = { - get: function(e) { - if (u(e)) { - var t = f(e); - return true === t ? p(h(this, "WeakMap")).get(e) : t ? t[this._i] : void 0 - } + set: function (e, t) { + return n.def(r(this, "Map"), 0 === e ? 0 : e, t); }, - set: function(e, t) { - return c.def(h(this, "WeakMap"), e, t) - } - }, v = e.exports = i(83)("WeakMap", g, _, c, true, true); - l(function() { - return 7 != (new v).set((Object.freeze || Object)(m), 7).get(m) - }) && (s((n = c.getConstructor(g, "WeakMap")).prototype, _), - a.NEED = true, - r(["delete", "has", "get", "set"], function(e) { - var t = v.prototype - , i = t[e]; - o(t, e, function(t, r) { - if (u(t) && !d(t)) { - this._f || (this._f = new n); - var o = this._f[e](t, r); - return "set" == e ? this : o - } - return i.call(this, t, r) - }) - })) -} -, function(e, t, i) { + }, + n, + true + ); + }, + function (e, t, i) { "use strict"; - var n = i(163) - , r = i(62); - i(83)("WeakSet", function(e) { - return function() { - return e(this, arguments.length > 0 ? arguments[0] : void 0) - } - }, { - add: function(e) { - return n.def(r(this, "WeakSet"), e, true) - } - }, n, false, true) -} -, function(e, t, i) { + var n = i(162), + r = i(62); + e.exports = i(83)( + "Set", + function (e) { + return function () { + return e(this, arguments.length > 0 ? arguments[0] : void 0); + }; + }, + { + add: function (e) { + return n.def(r(this, "Set"), (e = 0 === e ? 0 : e), e); + }, + }, + n + ); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(84) - , o = i(121) - , a = i(4) - , s = i(49) - , c = i(10) - , u = i(6) - , l = i(5).ArrayBuffer - , h = i(67) - , f = o.ArrayBuffer - , d = o.DataView - , p = r.ABV && l.isView - , m = f.prototype.slice - , g = r.VIEW; + var n, + r = i(31)(0), + o = i(19), + a = i(40), + s = i(143), + c = i(163), + u = i(6), + l = i(3), + h = i(62), + f = a.getWeak, + d = Object.isExtensible, + p = c.ufstore, + m = {}, + g = function (e) { + return function () { + return e(this, arguments.length > 0 ? arguments[0] : void 0); + }; + }, + _ = { + get: function (e) { + if (u(e)) { + var t = f(e); + return true === t + ? p(h(this, "WeakMap")).get(e) + : t + ? t[this._i] + : void 0; + } + }, + set: function (e, t) { + return c.def(h(this, "WeakMap"), e, t); + }, + }, + v = (e.exports = i(83)("WeakMap", g, _, c, true, true)); + l(function () { + return 7 != new v().set((Object.freeze || Object)(m), 7).get(m); + }) && + (s((n = c.getConstructor(g, "WeakMap")).prototype, _), + (a.NEED = true), + r(["delete", "has", "get", "set"], function (e) { + var t = v.prototype, + i = t[e]; + o(t, e, function (t, r) { + if (u(t) && !d(t)) { + this._f || (this._f = new n()); + var o = this._f[e](t, r); + return "set" == e ? this : o; + } + return i.call(this, t, r); + }); + })); + }, + function (e, t, i) { + "use strict"; + var n = i(163), + r = i(62); + i(83)( + "WeakSet", + function (e) { + return function () { + return e(this, arguments.length > 0 ? arguments[0] : void 0); + }; + }, + { + add: function (e) { + return n.def(r(this, "WeakSet"), e, true); + }, + }, + n, + false, + true + ); + }, + function (e, t, i) { + "use strict"; + var n = i(0), + r = i(84), + o = i(121), + a = i(4), + s = i(49), + c = i(10), + u = i(6), + l = i(5).ArrayBuffer, + h = i(67), + f = o.ArrayBuffer, + d = o.DataView, + p = r.ABV && l.isView, + m = f.prototype.slice, + g = r.VIEW; n(n.G + n.W + n.F * (l !== f), { - ArrayBuffer: f + ArrayBuffer: f, }), - n(n.S + n.F * !r.CONSTR, "ArrayBuffer", { - isView: function(e) { - return p && p(e) || u(e) && g in e + n(n.S + n.F * !r.CONSTR, "ArrayBuffer", { + isView: function (e) { + return (p && p(e)) || (u(e) && g in e); + }, + }), + n( + n.P + + n.U + + n.F * + i(3)(function () { + return !new f(2).slice(1, void 0).byteLength; + }), + "ArrayBuffer", + { + slice: function (e, t) { + if (void 0 !== m && void 0 === t) return m.call(a(this), e); + for ( + var i = a(this).byteLength, + n = s(e, i), + r = s(void 0 === t ? i : t, i), + o = new (h(this, f))(c(r - n)), + u = new d(this), + l = new d(o), + p = 0; + n < r; + + ) + l.setUint8(p++, u.getUint8(n++)); + return o; + }, } - }), - n(n.P + n.U + n.F * i(3)(function() { - return !new f(2).slice(1, void 0).byteLength - }), "ArrayBuffer", { - slice: function(e, t) { - if (void 0 !== m && void 0 === t) - return m.call(a(this), e); - for (var i = a(this).byteLength, n = s(e, i), r = s(void 0 === t ? i : t, i), o = new (h(this, f))(c(r - n)), u = new d(this), l = new d(o), p = 0; n < r; ) - l.setUint8(p++, u.getUint8(n++)); - return o - } - }), - i(59)("ArrayBuffer") -} -, function(e, t, i) { + ), + i(59)("ArrayBuffer"); + }, + function (e, t, i) { var n = i(0); n(n.G + n.W + n.F * !i(84).ABV, { - DataView: i(121).DataView - }) -} -, function(e, t, i) { - i(38)("Int8", 1, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }) -} -, function(e, t, i) { - i(38)("Uint8", 1, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }) -} -, function(e, t, i) { - i(38)("Uint8", 1, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }, true) -} -, function(e, t, i) { - i(38)("Int16", 2, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }) -} -, function(e, t, i) { - i(38)("Uint16", 2, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }) -} -, function(e, t, i) { - i(38)("Int32", 4, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }) -} -, function(e, t, i) { - i(38)("Uint32", 4, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }) -} -, function(e, t, i) { - i(38)("Float32", 4, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }) -} -, function(e, t, i) { - i(38)("Float64", 8, function(e) { - return function(t, i, n) { - return e(this, t, i, n) - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(35) - , o = i(4) - , a = (i(5).Reflect || {}).apply - , s = Function.apply; - n(n.S + n.F * !i(3)(function() { - a(function() {}) - }), "Reflect", { - apply: function(e, t, i) { - var n = r(e) - , c = o(i); - return a ? a(n, t, c) : s.call(n, t, c) - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(50) - , o = i(35) - , a = i(4) - , s = i(6) - , c = i(3) - , u = i(145) - , l = (i(5).Reflect || {}).construct - , h = c(function() { - function e() {} - return !(l(function() {}, [], e)instanceof e) - }) - , f = !c(function() { - l(function() {}) + DataView: i(121).DataView, }); + }, + function (e, t, i) { + i(38)("Int8", 1, function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }); + }, + function (e, t, i) { + i(38)("Uint8", 1, function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }); + }, + function (e, t, i) { + i(38)( + "Uint8", + 1, + function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }, + true + ); + }, + function (e, t, i) { + i(38)("Int16", 2, function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }); + }, + function (e, t, i) { + i(38)("Uint16", 2, function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }); + }, + function (e, t, i) { + i(38)("Int32", 4, function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }); + }, + function (e, t, i) { + i(38)("Uint32", 4, function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }); + }, + function (e, t, i) { + i(38)("Float32", 4, function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }); + }, + function (e, t, i) { + i(38)("Float64", 8, function (e) { + return function (t, i, n) { + return e(this, t, i, n); + }; + }); + }, + function (e, t, i) { + var n = i(0), + r = i(35), + o = i(4), + a = (i(5).Reflect || {}).apply, + s = Function.apply; + n( + n.S + + n.F * + !i(3)(function () { + a(function () {}); + }), + "Reflect", + { + apply: function (e, t, i) { + var n = r(e), + c = o(i); + return a ? a(n, t, c) : s.call(n, t, c); + }, + } + ); + }, + function (e, t, i) { + var n = i(0), + r = i(50), + o = i(35), + a = i(4), + s = i(6), + c = i(3), + u = i(145), + l = (i(5).Reflect || {}).construct, + h = c(function () { + function e() {} + return !(l(function () {}, [], e) instanceof e); + }), + f = !c(function () { + l(function () {}); + }); n(n.S + n.F * (h || f), "Reflect", { - construct: function(e, t) { - o(e), - a(t); - var i = arguments.length < 3 ? e : o(arguments[2]); - if (f && !h) - return l(e, t, i); - if (e == i) { - switch (t.length) { - case 0: - return new e; - case 1: - return new e(t[0]); - case 2: - return new e(t[0],t[1]); - case 3: - return new e(t[0],t[1],t[2]); - case 4: - return new e(t[0],t[1],t[2],t[3]) - } - var n = [null]; - return n.push.apply(n, t), - new (u.apply(e, n)) - } - var c = i.prototype - , d = r(s(c) ? c : Object.prototype) - , p = Function.apply.call(e, d, t); - return s(p) ? p : d + construct: function (e, t) { + o(e), a(t); + var i = arguments.length < 3 ? e : o(arguments[2]); + if (f && !h) return l(e, t, i); + if (e == i) { + switch (t.length) { + case 0: + return new e(); + case 1: + return new e(t[0]); + case 2: + return new e(t[0], t[1]); + case 3: + return new e(t[0], t[1], t[2]); + case 4: + return new e(t[0], t[1], t[2], t[3]); + } + var n = [null]; + return n.push.apply(n, t), new (u.apply(e, n))(); } - }) -} -, function(e, t, i) { - var n = i(12) - , r = i(0) - , o = i(4) - , a = i(39); - r(r.S + r.F * i(3)(function() { - Reflect.defineProperty(n.f({}, 1, { - value: 1 - }), 1, { - value: 2 - }) - }), "Reflect", { - defineProperty: function(e, t, i) { - o(e), - t = a(t, true), - o(i); - try { - return n.f(e, t, i), - true - } catch (e) { - return false - } - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(29).f - , o = i(4); + var c = i.prototype, + d = r(s(c) ? c : Object.prototype), + p = Function.apply.call(e, d, t); + return s(p) ? p : d; + }, + }); + }, + function (e, t, i) { + var n = i(12), + r = i(0), + o = i(4), + a = i(39); + r( + r.S + + r.F * + i(3)(function () { + Reflect.defineProperty( + n.f({}, 1, { + value: 1, + }), + 1, + { + value: 2, + } + ); + }), + "Reflect", + { + defineProperty: function (e, t, i) { + o(e), (t = a(t, true)), o(i); + try { + return n.f(e, t, i), true; + } catch (e) { + return false; + } + }, + } + ); + }, + function (e, t, i) { + var n = i(0), + r = i(29).f, + o = i(4); n(n.S, "Reflect", { - deleteProperty: function(e, t) { - var i = r(o(e), t); - return !(i && !i.configurable) && delete e[t] - } - }) -} -, function(e, t, i) { + deleteProperty: function (e, t) { + var i = r(o(e), t); + return !(i && !i.configurable) && delete e[t]; + }, + }); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(4) - , o = function(e) { - this._t = r(e), - this._i = 0; - var t, i = this._k = []; - for (t in e) - i.push(t) - }; - i(152)(o, "Object", function() { - var e, t = this._k; - do { - if (this._i >= t.length) - return { - value: void 0, - done: true - } - } while (!((e = t[this._i++])in this._t));return { - value: e, - done: false - } + var n = i(0), + r = i(4), + o = function (e) { + (this._t = r(e)), (this._i = 0); + var t, + i = (this._k = []); + for (t in e) i.push(t); + }; + i(152)(o, "Object", function () { + var e, + t = this._k; + do { + if (this._i >= t.length) + return { + value: void 0, + done: true, + }; + } while (!((e = t[this._i++]) in this._t)); + return { + value: e, + done: false, + }; }), - n(n.S, "Reflect", { - enumerate: function(e) { - return new o(e) - } - }) -} -, function(e, t, i) { - var n = i(29) - , r = i(52) - , o = i(22) - , a = i(0) - , s = i(6) - , c = i(4); + n(n.S, "Reflect", { + enumerate: function (e) { + return new o(e); + }, + }); + }, + function (e, t, i) { + var n = i(29), + r = i(52), + o = i(22), + a = i(0), + s = i(6), + c = i(4); a(a.S, "Reflect", { - get: function e(t, i) { - var a, u, l = arguments.length < 3 ? t : arguments[2]; - return c(t) === l ? t[i] : (a = n.f(t, i)) ? o(a, "value") ? a.value : void 0 !== a.get ? a.get.call(l) : void 0 : s(u = r(t)) ? e(u, i, l) : void 0 - } - }) -} -, function(e, t, i) { - var n = i(29) - , r = i(0) - , o = i(4); + get: function e(t, i) { + var a, + u, + l = arguments.length < 3 ? t : arguments[2]; + return c(t) === l + ? t[i] + : (a = n.f(t, i)) + ? o(a, "value") + ? a.value + : void 0 !== a.get + ? a.get.call(l) + : void 0 + : s((u = r(t))) + ? e(u, i, l) + : void 0; + }, + }); + }, + function (e, t, i) { + var n = i(29), + r = i(0), + o = i(4); r(r.S, "Reflect", { - getOwnPropertyDescriptor: function(e, t) { - return n.f(o(e), t) - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(52) - , o = i(4); + getOwnPropertyDescriptor: function (e, t) { + return n.f(o(e), t); + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(52), + o = i(4); n(n.S, "Reflect", { - getPrototypeOf: function(e) { - return r(o(e)) - } - }) -} -, function(e, t, i) { + getPrototypeOf: function (e) { + return r(o(e)); + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Reflect", { - has: function(e, t) { - return t in e - } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(4) - , o = Object.isExtensible; + has: function (e, t) { + return t in e; + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(4), + o = Object.isExtensible; n(n.S, "Reflect", { - isExtensible: function(e) { - return r(e), - !o || o(e) - } - }) -} -, function(e, t, i) { + isExtensible: function (e) { + return r(e), !o || o(e); + }, + }); + }, + function (e, t, i) { var n = i(0); n(n.S, "Reflect", { - ownKeys: i(165) - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(4) - , o = Object.preventExtensions; + ownKeys: i(165), + }); + }, + function (e, t, i) { + var n = i(0), + r = i(4), + o = Object.preventExtensions; n(n.S, "Reflect", { - preventExtensions: function(e) { - r(e); - try { - return o && o(e), - true - } catch (e) { - return false - } + preventExtensions: function (e) { + r(e); + try { + return o && o(e), true; + } catch (e) { + return false; } - }) -} -, function(e, t, i) { - var n = i(12) - , r = i(29) - , o = i(52) - , a = i(22) - , s = i(0) - , c = i(45) - , u = i(4) - , l = i(6); + }, + }); + }, + function (e, t, i) { + var n = i(12), + r = i(29), + o = i(52), + a = i(22), + s = i(0), + c = i(45), + u = i(4), + l = i(6); s(s.S, "Reflect", { - set: function e(t, i, s) { - var h, f, d = arguments.length < 4 ? t : arguments[3], p = r.f(u(t), i); - if (!p) { - if (l(f = o(t))) - return e(f, i, s, d); - p = c(0) - } - if (a(p, "value")) { - if (false === p.writable || !l(d)) - return false; - if (h = r.f(d, i)) { - if (h.get || h.set || false === h.writable) - return false; - h.value = s, - n.f(d, i, h) - } else - n.f(d, i, c(0, s)); - return true - } - return void 0 !== p.set && (p.set.call(d, s), - true) + set: function e(t, i, s) { + var h, + f, + d = arguments.length < 4 ? t : arguments[3], + p = r.f(u(t), i); + if (!p) { + if (l((f = o(t)))) return e(f, i, s, d); + p = c(0); } - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(102); - r && n(n.S, "Reflect", { - setPrototypeOf: function(e, t) { - r.check(e, t); - try { - return r.set(e, t), - true - } catch (e) { - return false - } + if (a(p, "value")) { + if (false === p.writable || !l(d)) return false; + if ((h = r.f(d, i))) { + if (h.get || h.set || false === h.writable) return false; + (h.value = s), n.f(d, i, h); + } else n.f(d, i, c(0, s)); + return true; } - }) -} -, function(e, t, i) { - i(374), - e.exports = i(14).Array.includes -} -, function(e, t, i) { + return void 0 !== p.set && (p.set.call(d, s), true); + }, + }); + }, + function (e, t, i) { + var n = i(0), + r = i(102); + r && + n(n.S, "Reflect", { + setPrototypeOf: function (e, t) { + r.check(e, t); + try { + return r.set(e, t), true; + } catch (e) { + return false; + } + }, + }); + }, + function (e, t, i) { + i(374), (e.exports = i(14).Array.includes); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(74)(true); + var n = i(0), + r = i(74)(true); n(n.P, "Array", { - includes: function(e) { - return r(this, e, arguments.length > 1 ? arguments[1] : void 0) - } + includes: function (e) { + return r(this, e, arguments.length > 1 ? arguments[1] : void 0); + }, }), - i(58)("includes") -} -, function(e, t, i) { - i(376), - e.exports = i(14).String.padStart -} -, function(e, t, i) { + i(58)("includes"); + }, + function (e, t, i) { + i(376), (e.exports = i(14).String.padStart); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(166) - , o = i(82); + var n = i(0), + r = i(166), + o = i(82); n(n.P + n.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(o), "String", { - padStart: function(e) { - return r(this, e, arguments.length > 1 ? arguments[1] : void 0, true) - } - }) -} -, function(e, t, i) { - i(378), - e.exports = i(14).String.padEnd -} -, function(e, t, i) { + padStart: function (e) { + return r(this, e, arguments.length > 1 ? arguments[1] : void 0, true); + }, + }); + }, + function (e, t, i) { + i(378), (e.exports = i(14).String.padEnd); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(166) - , o = i(82); + var n = i(0), + r = i(166), + o = i(82); n(n.P + n.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(o), "String", { - padEnd: function(e) { - return r(this, e, arguments.length > 1 ? arguments[1] : void 0, false) - } - }) -} -, function(e, t, i) { - i(380), - e.exports = i(97).f("asyncIterator") -} -, function(e, t, i) { - i(139)("asyncIterator") -} -, function(e, t, i) { - i(382), - e.exports = i(14).Object.getOwnPropertyDescriptors -} -, function(e, t, i) { - var n = i(0) - , r = i(165) - , o = i(24) - , a = i(29) - , s = i(114); + padEnd: function (e) { + return r(this, e, arguments.length > 1 ? arguments[1] : void 0, false); + }, + }); + }, + function (e, t, i) { + i(380), (e.exports = i(97).f("asyncIterator")); + }, + function (e, t, i) { + i(139)("asyncIterator"); + }, + function (e, t, i) { + i(382), (e.exports = i(14).Object.getOwnPropertyDescriptors); + }, + function (e, t, i) { + var n = i(0), + r = i(165), + o = i(24), + a = i(29), + s = i(114); n(n.S, "Object", { - getOwnPropertyDescriptors: function(e) { - for (var t, i, n = o(e), c = a.f, u = r(n), l = {}, h = 0; u.length > h; ) - void 0 !== (i = c(n, t = u[h++])) && s(l, t, i); - return l - } - }) -} -, function(e, t, i) { - i(384), - e.exports = i(14).Object.values -} -, function(e, t, i) { - var n = i(0) - , r = i(167)(false); + getOwnPropertyDescriptors: function (e) { + for ( + var t, i, n = o(e), c = a.f, u = r(n), l = {}, h = 0; + u.length > h; + + ) + void 0 !== (i = c(n, (t = u[h++]))) && s(l, t, i); + return l; + }, + }); + }, + function (e, t, i) { + i(384), (e.exports = i(14).Object.values); + }, + function (e, t, i) { + var n = i(0), + r = i(167)(false); n(n.S, "Object", { - values: function(e) { - return r(e) - } - }) -} -, function(e, t, i) { - i(386), - e.exports = i(14).Object.entries -} -, function(e, t, i) { - var n = i(0) - , r = i(167)(true); + values: function (e) { + return r(e); + }, + }); + }, + function (e, t, i) { + i(386), (e.exports = i(14).Object.entries); + }, + function (e, t, i) { + var n = i(0), + r = i(167)(true); n(n.S, "Object", { - entries: function(e) { - return r(e) - } - }) -} -, function(e, t, i) { + entries: function (e) { + return r(e); + }, + }); + }, + function (e, t, i) { "use strict"; - i(159), - i(388), - e.exports = i(14).Promise.finally -} -, function(e, t, i) { + i(159), i(388), (e.exports = i(14).Promise.finally); + }, + function (e, t, i) { "use strict"; - var n = i(0) - , r = i(14) - , o = i(5) - , a = i(67) - , s = i(161); + var n = i(0), + r = i(14), + o = i(5), + a = i(67), + s = i(161); n(n.P + n.R, "Promise", { - finally: function(e) { - var t = a(this, r.Promise || o.Promise) - , i = "function" == typeof e; - return this.then(i ? function(i) { - return s(t, e()).then(function() { - return i - }) - } - : e, i ? function(i) { - return s(t, e()).then(function() { - throw i - }) - } - : e) - } - }) -} -, function(e, t, i) { - i(390), - i(391), - i(392), - e.exports = i(14) -} -, function(e, t, i) { - var n = i(5) - , r = i(0) - , o = i(82) - , a = [].slice - , s = /MSIE .\./.test(o) - , c = function(e) { - return function(t, i) { - var n = arguments.length > 2 - , r = !!n && a.call(arguments, 2); - return e(n ? function() { - ("function" == typeof t ? t : Function(t)).apply(this, r) - } - : t, i) - } - }; + finally: function (e) { + var t = a(this, r.Promise || o.Promise), + i = "function" == typeof e; + return this.then( + i + ? function (i) { + return s(t, e()).then(function () { + return i; + }); + } + : e, + i + ? function (i) { + return s(t, e()).then(function () { + throw i; + }); + } + : e + ); + }, + }); + }, + function (e, t, i) { + i(390), i(391), i(392), (e.exports = i(14)); + }, + function (e, t, i) { + var n = i(5), + r = i(0), + o = i(82), + a = [].slice, + s = /MSIE .\./.test(o), + c = function (e) { + return function (t, i) { + var n = arguments.length > 2, + r = !!n && a.call(arguments, 2); + return e( + n + ? function () { + ("function" == typeof t ? t : Function(t)).apply(this, r); + } + : t, + i + ); + }; + }; r(r.G + r.B + r.F * s, { - setTimeout: c(n.setTimeout), - setInterval: c(n.setInterval) - }) -} -, function(e, t, i) { - var n = i(0) - , r = i(120); + setTimeout: c(n.setTimeout), + setInterval: c(n.setInterval), + }); + }, + function (e, t, i) { + var n = i(0), + r = i(120); n(n.G + n.B, { - setImmediate: r.set, - clearImmediate: r.clear - }) -} -, function(e, t, i) { - for (var n = i(117), r = i(48), o = i(19), a = i(5), s = i(23), c = i(57), u = i(8), l = u("iterator"), h = u("toStringTag"), f = c.Array, d = { - CSSRuleList: true, - CSSStyleDeclaration: false, - CSSValueList: false, - ClientRectList: false, - DOMRectList: false, - DOMStringList: false, - DOMTokenList: true, - DataTransferItemList: false, - FileList: false, - HTMLAllCollection: false, - HTMLCollection: false, - HTMLFormElement: false, - HTMLSelectElement: false, - MediaList: true, - MimeTypeArray: false, - NamedNodeMap: false, - NodeList: true, - PaintRequestList: false, - Plugin: false, - PluginArray: false, - SVGLengthList: false, - SVGNumberList: false, - SVGPathSegList: false, - SVGPointList: false, - SVGStringList: false, - SVGTransformList: false, - SourceBufferList: false, - StyleSheetList: true, - TextTrackCueList: false, - TextTrackList: false, - TouchList: false - }, p = r(d), m = 0; m < p.length; m++) { - var g, _ = p[m], v = d[_], y = a[_], b = y && y.prototype; - if (b && (b[l] || s(b, l, f), - b[h] || s(b, h, _), - c[_] = f, - v)) - for (g in n) - b[g] || o(b, g, n[g], true) + setImmediate: r.set, + clearImmediate: r.clear, + }); + }, + function (e, t, i) { + for ( + var n = i(117), + r = i(48), + o = i(19), + a = i(5), + s = i(23), + c = i(57), + u = i(8), + l = u("iterator"), + h = u("toStringTag"), + f = c.Array, + d = { + CSSRuleList: true, + CSSStyleDeclaration: false, + CSSValueList: false, + ClientRectList: false, + DOMRectList: false, + DOMStringList: false, + DOMTokenList: true, + DataTransferItemList: false, + FileList: false, + HTMLAllCollection: false, + HTMLCollection: false, + HTMLFormElement: false, + HTMLSelectElement: false, + MediaList: true, + MimeTypeArray: false, + NamedNodeMap: false, + NodeList: true, + PaintRequestList: false, + Plugin: false, + PluginArray: false, + SVGLengthList: false, + SVGNumberList: false, + SVGPathSegList: false, + SVGPointList: false, + SVGStringList: false, + SVGTransformList: false, + SourceBufferList: false, + StyleSheetList: true, + TextTrackCueList: false, + TextTrackList: false, + TouchList: false, + }, + p = r(d), + m = 0; + m < p.length; + m++ + ) { + var g, + _ = p[m], + v = d[_], + y = a[_], + b = y && y.prototype; + if (b && (b[l] || s(b, l, f), b[h] || s(b, h, _), (c[_] = f), v)) + for (g in n) b[g] || o(b, g, n[g], true); } -} -, function(e, t, i) { - (function(e, t) { - function i(e) { - return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - !function(n) { - "use strict"; - var r, o = Object.prototype, a = o.hasOwnProperty, s = "function" == typeof Symbol ? Symbol : {}, c = s.iterator || "@@iterator", u = s.asyncIterator || "@@asyncIterator", l = s.toStringTag || "@@toStringTag", h = "object" === i(e), f = n.regeneratorRuntime; - if (f) - h && (e.exports = f); - else { - (f = n.regeneratorRuntime = h ? e.exports : {}).wrap = T; - var d = "suspendedStart" - , p = "suspendedYield" - , m = "executing" - , g = "completed" - , _ = {} - , v = {}; - v[c] = function() { - return this - } - ; - var y = Object.getPrototypeOf - , b = y && y(y(D([]))); - b && b !== o && a.call(b, c) && (v = b); - var E = C.prototype = x.prototype = Object.create(v); - S.prototype = E.constructor = C, - C.constructor = S, - C[l] = S.displayName = "GeneratorFunction", - f.isGeneratorFunction = function(e) { - var t = "function" == typeof e && e.constructor; - return !!t && (t === S || "GeneratorFunction" === (t.displayName || t.name)) - } - , - f.mark = function(e) { - return Object.setPrototypeOf ? Object.setPrototypeOf(e, C) : (e.__proto__ = C, - l in e || (e[l] = "GeneratorFunction")), - e.prototype = Object.create(E), - e - } - , - f.awrap = function(e) { - return { - __await: e - } - } - , - P(R.prototype), - R.prototype[u] = function() { - return this - } - , - f.AsyncIterator = R, - f.async = function(e, t, i, n) { - var r = new R(T(e, t, i, n)); - return f.isGeneratorFunction(t) ? r : r.next().then(function(e) { - return e.done ? e.value : r.next() - }) - } - , - P(E), - E[l] = "Generator", - E[c] = function() { - return this - } - , - E.toString = function() { - return "[object Generator]" - } - , - f.keys = function(e) { - var t = []; - for (var i in e) - t.push(i); - return t.reverse(), - function i() { - for (; t.length; ) { - var n = t.pop(); - if (n in e) - return i.value = n, - i.done = false, - i - } - return i.done = true, - i - } - } - , - f.values = D, - I.prototype = { - constructor: I, - reset: function(e) { - if (this.prev = 0, - this.next = 0, - this.sent = this._sent = r, - this.done = false, - this.delegate = null, - this.method = "next", - this.arg = r, - this.tryEntries.forEach(w), - !e) - for (var t in this) - "t" === t.charAt(0) && a.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = r) - }, - stop: function() { - this.done = true; - var e = this.tryEntries[0].completion; - if ("throw" === e.type) - throw e.arg; - return this.rval - }, - dispatchException: function(e) { - if (this.done) - throw e; - var t = this; - function i(i, n) { - return s.type = "throw", - s.arg = e, - t.next = i, - n && (t.method = "next", - t.arg = r), - !!n - } - for (var n = this.tryEntries.length - 1; n >= 0; --n) { - var o = this.tryEntries[n] - , s = o.completion; - if ("root" === o.tryLoc) - return i("end"); - if (o.tryLoc <= this.prev) { - var c = a.call(o, "catchLoc") - , u = a.call(o, "finallyLoc"); - if (c && u) { - if (this.prev < o.catchLoc) - return i(o.catchLoc, true); - if (this.prev < o.finallyLoc) - return i(o.finallyLoc) - } else if (c) { - if (this.prev < o.catchLoc) - return i(o.catchLoc, true) - } else { - if (!u) - throw new Error("try statement without catch or finally"); - if (this.prev < o.finallyLoc) - return i(o.finallyLoc) - } - } - } - }, - abrupt: function(e, t) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var n = this.tryEntries[i]; - if (n.tryLoc <= this.prev && a.call(n, "finallyLoc") && this.prev < n.finallyLoc) { - var r = n; - break - } - } - r && ("break" === e || "continue" === e) && r.tryLoc <= t && t <= r.finallyLoc && (r = null); - var o = r ? r.completion : {}; - return o.type = e, - o.arg = t, - r ? (this.method = "next", - this.next = r.finallyLoc, - _) : this.complete(o) - }, - complete: function(e, t) { - if ("throw" === e.type) - throw e.arg; - return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, - this.method = "return", - this.next = "end") : "normal" === e.type && t && (this.next = t), - _ - }, - finish: function(e) { - for (var t = this.tryEntries.length - 1; t >= 0; --t) { - var i = this.tryEntries[t]; - if (i.finallyLoc === e) - return this.complete(i.completion, i.afterLoc), - w(i), - _ - } - }, - catch: function(e) { - for (var t = this.tryEntries.length - 1; t >= 0; --t) { - var i = this.tryEntries[t]; - if (i.tryLoc === e) { - var n = i.completion; - if ("throw" === n.type) { - var r = n.arg; - w(i) - } - return r - } - } - throw new Error("illegal catch attempt") - }, - delegateYield: function(e, t, i) { - return this.delegate = { - iterator: D(e), - resultName: t, - nextLoc: i - }, - "next" === this.method && (this.arg = r), - _ - } - } - } - function T(e, t, i, n) { - var r = t && t.prototype instanceof x ? t : x - , o = Object.create(r.prototype) - , a = new I(n || []); - return o._invoke = function(e, t, i) { - var n = d; - return function(r, o) { - if (n === m) - throw new Error("Generator is already running"); - if (n === g) { - if ("throw" === r) - throw o; - return L() - } - for (i.method = r, - i.arg = o; ; ) { - var a = i.delegate; - if (a) { - var s = M(a, i); - if (s) { - if (s === _) - continue; - return s - } - } - if ("next" === i.method) - i.sent = i._sent = i.arg; - else if ("throw" === i.method) { - if (n === d) - throw n = g, - i.arg; - i.dispatchException(i.arg) - } else - "return" === i.method && i.abrupt("return", i.arg); - n = m; - var c = A(e, t, i); - if ("normal" === c.type) { - if (n = i.done ? g : p, - c.arg === _) - continue; - return { - value: c.arg, - done: i.done - } - } - "throw" === c.type && (n = g, - i.method = "throw", - i.arg = c.arg) - } - } - }(e, i, a), - o - } - function A(e, t, i) { - try { - return { - type: "normal", - arg: e.call(t, i) - } - } catch (e) { - return { - type: "throw", - arg: e - } - } - } - function x() {} - function S() {} - function C() {} - function P(e) { - ["next", "throw", "return"].forEach(function(t) { - e[t] = function(e) { - return this._invoke(t, e) - } - }) - } - function R(e) { - var n; - this._invoke = function(r, o) { - function s() { - return new t(function(n, s) { - !function n(r, o, s, c) { - var u = A(e[r], e, o); - if ("throw" !== u.type) { - var l = u.arg - , h = l.value; - return h && "object" === i(h) && a.call(h, "__await") ? t.resolve(h.__await).then(function(e) { - n("next", e, s, c) - }, function(e) { - n("throw", e, s, c) - }) : t.resolve(h).then(function(e) { - l.value = e, - s(l) - }, function(e) { - return n("throw", e, s, c) - }) - } - c(u.arg) - }(r, o, n, s) - } - ) - } - return n = n ? n.then(s, s) : s() - } - } - function M(e, t) { - var i = e.iterator[t.method]; - if (i === r) { - if (t.delegate = null, - "throw" === t.method) { - if (e.iterator.return && (t.method = "return", - t.arg = r, - M(e, t), - "throw" === t.method)) - return _; - t.method = "throw", - t.arg = new TypeError("The iterator does not provide a 'throw' method") - } - return _ - } - var n = A(i, e.iterator, t.arg); - if ("throw" === n.type) - return t.method = "throw", - t.arg = n.arg, - t.delegate = null, - _; - var o = n.arg; - return o ? o.done ? (t[e.resultName] = o.value, - t.next = e.nextLoc, - "return" !== t.method && (t.method = "next", - t.arg = r), - t.delegate = null, - _) : o : (t.method = "throw", - t.arg = new TypeError("iterator result is not an object"), - t.delegate = null, - _) - } - function O(e) { - var t = { - tryLoc: e[0] - }; - 1 in e && (t.catchLoc = e[1]), - 2 in e && (t.finallyLoc = e[2], - t.afterLoc = e[3]), - this.tryEntries.push(t) - } - function w(e) { - var t = e.completion || {}; - t.type = "normal", - delete t.arg, - e.completion = t - } - function I(e) { - this.tryEntries = [{ - tryLoc: "root" - }], - e.forEach(O, this), - this.reset(true) - } - function D(e) { - if (e) { - var t = e[c]; - if (t) - return t.call(e); - if ("function" == typeof e.next) - return e; - if (!isNaN(e.length)) { - var i = -1 - , n = function t() { - for (; ++i < e.length; ) - if (a.call(e, i)) - return t.value = e[i], - t.done = false, - t; - return t.value = r, - t.done = true, - t - }; - return n.next = n - } - } - return { - next: L - } - } - function L() { - return { - value: r, - done: true - } - } - }(function() { - return this || "object" === ("undefined" == typeof self ? "undefined" : i(self)) && self - }() || Function("return this")()) - } - ).call(this, i(122)(e), i(41)) -} -, function(e, t, i) { - (function(n, r) { - var o, a, s; - function c(e) { - return (c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - /*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE - * @version 3.3.1 - */ - /*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE - * @version 3.3.1 - */ - s = function() { - "use strict"; - function e(e) { - return "function" == typeof e - } - var t = Array.isArray ? Array.isArray : function(e) { - return "[object Array]" === Object.prototype.toString.call(e) - } - , o = 0 - , a = void 0 - , s = void 0 - , u = function(e, t) { - g[o] = e, - g[o + 1] = t, - 2 === (o += 2) && (s ? s(_) : T()) - } - , l = "undefined" != typeof window ? window : void 0 - , h = l || {} - , f = h.MutationObserver || h.WebKitMutationObserver - , d = "undefined" == typeof self && void 0 !== n && "[object process]" === {}.toString.call(n) - , p = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts && "undefined" != typeof MessageChannel; - function m() { - var e = setTimeout; - return function() { - return e(_, 1) - } - } - var g = new Array(1e3); - function _() { - for (var e = 0; e < o; e += 2) { - (0, - g[e])(g[e + 1]), - g[e] = void 0, - g[e + 1] = void 0 - } - o = 0 - } - var v, y, b, E, T = void 0; - function A(e, t) { - var i = arguments - , n = this - , r = new this.constructor(C); - void 0 === r[S] && j(r); - var o, a = n._state; - return a ? (o = i[a - 1], - u(function() { - return G(a, r, o, n._result) - })) : N(n, r, e, t), - r - } - function x(e) { - if (e && "object" === c(e) && e.constructor === this) - return e; - var t = new this(C); - return D(t, e), - t - } - d ? T = function() { - return n.nextTick(_) - } - : f ? (y = 0, - b = new f(_), - E = document.createTextNode(""), - b.observe(E, { - characterData: true + }, + function (e, t, i) { + (function (e, t) { + function i(e) { + return (i = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + !(function (n) { + "use strict"; + var r, + o = Object.prototype, + a = o.hasOwnProperty, + s = "function" == typeof Symbol ? Symbol : {}, + c = s.iterator || "@@iterator", + u = s.asyncIterator || "@@asyncIterator", + l = s.toStringTag || "@@toStringTag", + h = "object" === i(e), + f = n.regeneratorRuntime; + if (f) h && (e.exports = f); + else { + (f = n.regeneratorRuntime = h ? e.exports : {}).wrap = T; + var d = "suspendedStart", + p = "suspendedYield", + m = "executing", + g = "completed", + _ = {}, + v = {}; + v[c] = function () { + return this; + }; + var y = Object.getPrototypeOf, + b = y && y(y(D([]))); + b && b !== o && a.call(b, c) && (v = b); + var E = (C.prototype = x.prototype = Object.create(v)); + (S.prototype = E.constructor = C), + (C.constructor = S), + (C[l] = S.displayName = "GeneratorFunction"), + (f.isGeneratorFunction = function (e) { + var t = "function" == typeof e && e.constructor; + return ( + !!t && + (t === S || "GeneratorFunction" === (t.displayName || t.name)) + ); }), - T = function() { - E.data = y = ++y % 2 - } - ) : p ? ((v = new MessageChannel).port1.onmessage = _, - T = function() { - return v.port2.postMessage(0) - } - ) : T = void 0 === l ? function() { - try { - var e = i(395); - return a = e.runOnLoop || e.runOnContext, - function() { - a(_) - } - } catch (e) { - return m() - } - }() : m(); - var S = Math.random().toString(36).substring(16); - function C() {} - var P = void 0 - , R = 1 - , M = 2 - , O = new U; - function w(e) { - try { - return e.then - } catch (e) { - return O.error = e, - O - } - } - function I(t, i, n) { - i.constructor === t.constructor && n === A && i.constructor.resolve === x ? function(e, t) { - t._state === R ? F(e, t._result) : t._state === M ? B(e, t._result) : N(t, void 0, function(t) { - return D(e, t) - }, function(t) { - return B(e, t) - }) - }(t, i) : n === O ? B(t, O.error) : void 0 === n ? F(t, i) : e(n) ? function(e, t, i) { - u(function(e) { - var n = false - , r = function(e, t, i, n) { - try { - e.call(t, i, n) - } catch (e) { - return e - } - }(i, t, function(i) { - n || (n = true, - t !== i ? D(e, i) : F(e, i)) - }, function(t) { - n || (n = true, - B(e, t)) - }, e._label); - !n && r && (n = true, - B(e, r)) - }, e) - }(t, i, n) : F(t, i) - } - function D(e, t) { - var i; - e === t ? B(e, new TypeError("You cannot resolve a promise with itself")) : "function" == typeof (i = t) || "object" === c(i) && null !== i ? I(e, t, w(t)) : F(e, t) - } - function L(e) { - e._onerror && e._onerror(e._result), - k(e) - } - function F(e, t) { - e._state === P && (e._result = t, - e._state = R, - 0 !== e._subscribers.length && u(k, e)) - } - function B(e, t) { - e._state === P && (e._state = M, - e._result = t, - u(L, e)) - } - function N(e, t, i, n) { - var r = e._subscribers - , o = r.length; - e._onerror = null, - r[o] = t, - r[o + R] = i, - r[o + M] = n, - 0 === o && e._state && u(k, e) - } - function k(e) { - var t = e._subscribers - , i = e._state; - if (0 !== t.length) { - for (var n = void 0, r = void 0, o = e._result, a = 0; a < t.length; a += 3) - n = t[a], - r = t[a + i], - n ? G(i, n, r, o) : r(o); - e._subscribers.length = 0 - } - } - function U() { - this.error = null - } - var V = new U; - function G(t, i, n, r) { - var o = e(n) - , a = void 0 - , s = void 0 - , c = void 0 - , u = void 0; - if (o) { - if ((a = function(e, t) { - try { - return e(t) - } catch (e) { - return V.error = e, - V - } - }(n, r)) === V ? (u = true, - s = a.error, - a = null) : c = true, - i === a) - return void B(i, new TypeError("A promises callback cannot return that same promise.")) - } else - a = r, - c = true; - i._state !== P || (o && c ? D(i, a) : u ? B(i, s) : t === R ? F(i, a) : t === M && B(i, a)) - } - var z = 0; - function j(e) { - e[S] = z++, - e._state = void 0, - e._result = void 0, - e._subscribers = [] - } - function H(e, i) { - this._instanceConstructor = e, - this.promise = new e(C), - this.promise[S] || j(this.promise), - t(i) ? (this._input = i, - this.length = i.length, - this._remaining = i.length, - this._result = new Array(this.length), - 0 === this.length ? F(this.promise, this._result) : (this.length = this.length || 0, - this._enumerate(), - 0 === this._remaining && F(this.promise, this._result))) : B(this.promise, new Error("Array Methods must be provided an Array")) - } - function W(e) { - this[S] = z++, - this._result = this._state = void 0, - this._subscribers = [], - C !== e && ("function" != typeof e && function() { - throw new TypeError("You must pass a resolver function as the first argument to the promise constructor") - }(), - this instanceof W ? function(e, t) { - try { - t(function(t) { - D(e, t) - }, function(t) { - B(e, t) - }) - } catch (t) { - B(e, t) - } - }(this, e) : function() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.") - }()) - } - function X() { - var e = void 0; - if (void 0 !== r) - e = r; - else if ("undefined" != typeof self) - e = self; - else - try { - e = Function("return this")() - } catch (e) { - throw new Error("polyfill failed because global object is unavailable in this environment") - } - var t = e.Promise; - if (t) { - var i = null; - try { - i = Object.prototype.toString.call(t.resolve()) - } catch (e) {} - if ("[object Promise]" === i && !t.cast) - return - } - e.Promise = W - } - return H.prototype._enumerate = function() { - for (var e = this.length, t = this._input, i = 0; this._state === P && i < e; i++) - this._eachEntry(t[i], i) - } - , - H.prototype._eachEntry = function(e, t) { - var i = this._instanceConstructor - , n = i.resolve; - if (n === x) { - var r = w(e); - if (r === A && e._state !== P) - this._settledAt(e._state, t, e._result); - else if ("function" != typeof r) - this._remaining--, - this._result[t] = e; - else if (i === W) { - var o = new i(C); - I(o, e, r), - this._willSettleAt(o, t) - } else - this._willSettleAt(new i(function(t) { - return t(e) - } - ), t) - } else - this._willSettleAt(n(e), t) - } - , - H.prototype._settledAt = function(e, t, i) { - var n = this.promise; - n._state === P && (this._remaining--, - e === M ? B(n, i) : this._result[t] = i), - 0 === this._remaining && F(n, this._result) - } - , - H.prototype._willSettleAt = function(e, t) { - var i = this; - N(e, void 0, function(e) { - return i._settledAt(R, t, e) - }, function(e) { - return i._settledAt(M, t, e) - }) - } - , - W.all = function(e) { - return new H(this,e).promise - } - , - W.race = function(e) { - var i = this; - return t(e) ? new i(function(t, n) { - for (var r = e.length, o = 0; o < r; o++) - i.resolve(e[o]).then(t, n) - } - ) : new i(function(e, t) { - return t(new TypeError("You must pass an array to race.")) + (f.mark = function (e) { + return ( + Object.setPrototypeOf + ? Object.setPrototypeOf(e, C) + : ((e.__proto__ = C), l in e || (e[l] = "GeneratorFunction")), + (e.prototype = Object.create(E)), + e + ); + }), + (f.awrap = function (e) { + return { + __await: e, + }; + }), + P(R.prototype), + (R.prototype[u] = function () { + return this; + }), + (f.AsyncIterator = R), + (f.async = function (e, t, i, n) { + var r = new R(T(e, t, i, n)); + return f.isGeneratorFunction(t) + ? r + : r.next().then(function (e) { + return e.done ? e.value : r.next(); + }); + }), + P(E), + (E[l] = "Generator"), + (E[c] = function () { + return this; + }), + (E.toString = function () { + return "[object Generator]"; + }), + (f.keys = function (e) { + var t = []; + for (var i in e) t.push(i); + return ( + t.reverse(), + function i() { + for (; t.length; ) { + var n = t.pop(); + if (n in e) return (i.value = n), (i.done = false), i; + } + return (i.done = true), i; } + ); + }), + (f.values = D), + (I.prototype = { + constructor: I, + reset: function (e) { + if ( + ((this.prev = 0), + (this.next = 0), + (this.sent = this._sent = r), + (this.done = false), + (this.delegate = null), + (this.method = "next"), + (this.arg = r), + this.tryEntries.forEach(w), + !e) ) - } - , - W.resolve = x, - W.reject = function(e) { - var t = new this(C); - return B(t, e), - t - } - , - W._setScheduler = function(e) { - s = e - } - , - W._setAsap = function(e) { - u = e - } - , - W._asap = u, - W.prototype = { - constructor: W, - then: A, - catch: function(e) { - return this.then(null, e) + for (var t in this) + "t" === t.charAt(0) && + a.call(this, t) && + !isNaN(+t.slice(1)) && + (this[t] = r); + }, + stop: function () { + this.done = true; + var e = this.tryEntries[0].completion; + if ("throw" === e.type) throw e.arg; + return this.rval; + }, + dispatchException: function (e) { + if (this.done) throw e; + var t = this; + function i(i, n) { + return ( + (s.type = "throw"), + (s.arg = e), + (t.next = i), + n && ((t.method = "next"), (t.arg = r)), + !!n + ); } - }, - X(), - W.polyfill = X, - W.Promise = W, - W + for (var n = this.tryEntries.length - 1; n >= 0; --n) { + var o = this.tryEntries[n], + s = o.completion; + if ("root" === o.tryLoc) return i("end"); + if (o.tryLoc <= this.prev) { + var c = a.call(o, "catchLoc"), + u = a.call(o, "finallyLoc"); + if (c && u) { + if (this.prev < o.catchLoc) return i(o.catchLoc, true); + if (this.prev < o.finallyLoc) return i(o.finallyLoc); + } else if (c) { + if (this.prev < o.catchLoc) return i(o.catchLoc, true); + } else { + if (!u) + throw new Error( + "try statement without catch or finally" + ); + if (this.prev < o.finallyLoc) return i(o.finallyLoc); + } + } + } + }, + abrupt: function (e, t) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var n = this.tryEntries[i]; + if ( + n.tryLoc <= this.prev && + a.call(n, "finallyLoc") && + this.prev < n.finallyLoc + ) { + var r = n; + break; + } + } + r && + ("break" === e || "continue" === e) && + r.tryLoc <= t && + t <= r.finallyLoc && + (r = null); + var o = r ? r.completion : {}; + return ( + (o.type = e), + (o.arg = t), + r + ? ((this.method = "next"), (this.next = r.finallyLoc), _) + : this.complete(o) + ); + }, + complete: function (e, t) { + if ("throw" === e.type) throw e.arg; + return ( + "break" === e.type || "continue" === e.type + ? (this.next = e.arg) + : "return" === e.type + ? ((this.rval = this.arg = e.arg), + (this.method = "return"), + (this.next = "end")) + : "normal" === e.type && t && (this.next = t), + _ + ); + }, + finish: function (e) { + for (var t = this.tryEntries.length - 1; t >= 0; --t) { + var i = this.tryEntries[t]; + if (i.finallyLoc === e) + return this.complete(i.completion, i.afterLoc), w(i), _; + } + }, + catch: function (e) { + for (var t = this.tryEntries.length - 1; t >= 0; --t) { + var i = this.tryEntries[t]; + if (i.tryLoc === e) { + var n = i.completion; + if ("throw" === n.type) { + var r = n.arg; + w(i); + } + return r; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function (e, t, i) { + return ( + (this.delegate = { + iterator: D(e), + resultName: t, + nextLoc: i, + }), + "next" === this.method && (this.arg = r), + _ + ); + }, + }); } - , - "object" === c(t) && void 0 !== e ? e.exports = s() : void 0 === (a = "function" == typeof (o = s) ? o.call(t, i, t, e) : o) || (e.exports = a) - } - ).call(this, i(27), i(15)) -} -, function(e, t) {} -, function(e, t, i) {} -, function(e, t) { + function T(e, t, i, n) { + var r = t && t.prototype instanceof x ? t : x, + o = Object.create(r.prototype), + a = new I(n || []); + return ( + (o._invoke = (function (e, t, i) { + var n = d; + return function (r, o) { + if (n === m) throw new Error("Generator is already running"); + if (n === g) { + if ("throw" === r) throw o; + return L(); + } + for (i.method = r, i.arg = o; ; ) { + var a = i.delegate; + if (a) { + var s = M(a, i); + if (s) { + if (s === _) continue; + return s; + } + } + if ("next" === i.method) i.sent = i._sent = i.arg; + else if ("throw" === i.method) { + if (n === d) throw ((n = g), i.arg); + i.dispatchException(i.arg); + } else "return" === i.method && i.abrupt("return", i.arg); + n = m; + var c = A(e, t, i); + if ("normal" === c.type) { + if (((n = i.done ? g : p), c.arg === _)) continue; + return { + value: c.arg, + done: i.done, + }; + } + "throw" === c.type && + ((n = g), (i.method = "throw"), (i.arg = c.arg)); + } + }; + })(e, i, a)), + o + ); + } + function A(e, t, i) { + try { + return { + type: "normal", + arg: e.call(t, i), + }; + } catch (e) { + return { + type: "throw", + arg: e, + }; + } + } + function x() {} + function S() {} + function C() {} + function P(e) { + ["next", "throw", "return"].forEach(function (t) { + e[t] = function (e) { + return this._invoke(t, e); + }; + }); + } + function R(e) { + var n; + this._invoke = function (r, o) { + function s() { + return new t(function (n, s) { + !(function n(r, o, s, c) { + var u = A(e[r], e, o); + if ("throw" !== u.type) { + var l = u.arg, + h = l.value; + return h && "object" === i(h) && a.call(h, "__await") + ? t.resolve(h.__await).then( + function (e) { + n("next", e, s, c); + }, + function (e) { + n("throw", e, s, c); + } + ) + : t.resolve(h).then( + function (e) { + (l.value = e), s(l); + }, + function (e) { + return n("throw", e, s, c); + } + ); + } + c(u.arg); + })(r, o, n, s); + }); + } + return (n = n ? n.then(s, s) : s()); + }; + } + function M(e, t) { + var i = e.iterator[t.method]; + if (i === r) { + if (((t.delegate = null), "throw" === t.method)) { + if ( + e.iterator.return && + ((t.method = "return"), + (t.arg = r), + M(e, t), + "throw" === t.method) + ) + return _; + (t.method = "throw"), + (t.arg = new TypeError( + "The iterator does not provide a 'throw' method" + )); + } + return _; + } + var n = A(i, e.iterator, t.arg); + if ("throw" === n.type) + return ( + (t.method = "throw"), (t.arg = n.arg), (t.delegate = null), _ + ); + var o = n.arg; + return o + ? o.done + ? ((t[e.resultName] = o.value), + (t.next = e.nextLoc), + "return" !== t.method && ((t.method = "next"), (t.arg = r)), + (t.delegate = null), + _) + : o + : ((t.method = "throw"), + (t.arg = new TypeError("iterator result is not an object")), + (t.delegate = null), + _); + } + function O(e) { + var t = { + tryLoc: e[0], + }; + 1 in e && (t.catchLoc = e[1]), + 2 in e && ((t.finallyLoc = e[2]), (t.afterLoc = e[3])), + this.tryEntries.push(t); + } + function w(e) { + var t = e.completion || {}; + (t.type = "normal"), delete t.arg, (e.completion = t); + } + function I(e) { + (this.tryEntries = [ + { + tryLoc: "root", + }, + ]), + e.forEach(O, this), + this.reset(true); + } + function D(e) { + if (e) { + var t = e[c]; + if (t) return t.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var i = -1, + n = function t() { + for (; ++i < e.length; ) + if (a.call(e, i)) + return (t.value = e[i]), (t.done = false), t; + return (t.value = r), (t.done = true), t; + }; + return (n.next = n); + } + } + return { + next: L, + }; + } + function L() { + return { + value: r, + done: true, + }; + } + })( + (function () { + return ( + this || + ("object" === + ("undefined" == typeof self ? "undefined" : i(self)) && + self) + ); + })() || Function("return this")() + ); + }.call(this, i(122)(e), i(41))); + }, + function (e, t, i) { + (function (n, r) { + var o, a, s; + function c(e) { + return (c = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + /*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version 3.3.1 + */ + /*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version 3.3.1 + */ + (s = function () { + "use strict"; + function e(e) { + return "function" == typeof e; + } + var t = Array.isArray + ? Array.isArray + : function (e) { + return "[object Array]" === Object.prototype.toString.call(e); + }, + o = 0, + a = void 0, + s = void 0, + u = function (e, t) { + (g[o] = e), (g[o + 1] = t), 2 === (o += 2) && (s ? s(_) : T()); + }, + l = "undefined" != typeof window ? window : void 0, + h = l || {}, + f = h.MutationObserver || h.WebKitMutationObserver, + d = + "undefined" == typeof self && + void 0 !== n && + "[object process]" === {}.toString.call(n), + p = + "undefined" != typeof Uint8ClampedArray && + "undefined" != typeof importScripts && + "undefined" != typeof MessageChannel; + function m() { + var e = setTimeout; + return function () { + return e(_, 1); + }; + } + var g = new Array(1e3); + function _() { + for (var e = 0; e < o; e += 2) { + (0, g[e])(g[e + 1]), (g[e] = void 0), (g[e + 1] = void 0); + } + o = 0; + } + var v, + y, + b, + E, + T = void 0; + function A(e, t) { + var i = arguments, + n = this, + r = new this.constructor(C); + void 0 === r[S] && j(r); + var o, + a = n._state; + return ( + a + ? ((o = i[a - 1]), + u(function () { + return G(a, r, o, n._result); + })) + : N(n, r, e, t), + r + ); + } + function x(e) { + if (e && "object" === c(e) && e.constructor === this) return e; + var t = new this(C); + return D(t, e), t; + } + d + ? (T = function () { + return n.nextTick(_); + }) + : f + ? ((y = 0), + (b = new f(_)), + (E = document.createTextNode("")), + b.observe(E, { + characterData: true, + }), + (T = function () { + E.data = y = ++y % 2; + })) + : p + ? (((v = new MessageChannel()).port1.onmessage = _), + (T = function () { + return v.port2.postMessage(0); + })) + : (T = + void 0 === l + ? (function () { + try { + var e = i(395); + return ( + (a = e.runOnLoop || e.runOnContext), + function () { + a(_); + } + ); + } catch (e) { + return m(); + } + })() + : m()); + var S = Math.random().toString(36).substring(16); + function C() {} + var P = void 0, + R = 1, + M = 2, + O = new U(); + function w(e) { + try { + return e.then; + } catch (e) { + return (O.error = e), O; + } + } + function I(t, i, n) { + i.constructor === t.constructor && + n === A && + i.constructor.resolve === x + ? (function (e, t) { + t._state === R + ? F(e, t._result) + : t._state === M + ? B(e, t._result) + : N( + t, + void 0, + function (t) { + return D(e, t); + }, + function (t) { + return B(e, t); + } + ); + })(t, i) + : n === O + ? B(t, O.error) + : void 0 === n + ? F(t, i) + : e(n) + ? (function (e, t, i) { + u(function (e) { + var n = false, + r = (function (e, t, i, n) { + try { + e.call(t, i, n); + } catch (e) { + return e; + } + })( + i, + t, + function (i) { + n || ((n = true), t !== i ? D(e, i) : F(e, i)); + }, + function (t) { + n || ((n = true), B(e, t)); + }, + e._label + ); + !n && r && ((n = true), B(e, r)); + }, e); + })(t, i, n) + : F(t, i); + } + function D(e, t) { + var i; + e === t + ? B(e, new TypeError("You cannot resolve a promise with itself")) + : "function" == typeof (i = t) || ("object" === c(i) && null !== i) + ? I(e, t, w(t)) + : F(e, t); + } + function L(e) { + e._onerror && e._onerror(e._result), k(e); + } + function F(e, t) { + e._state === P && + ((e._result = t), + (e._state = R), + 0 !== e._subscribers.length && u(k, e)); + } + function B(e, t) { + e._state === P && ((e._state = M), (e._result = t), u(L, e)); + } + function N(e, t, i, n) { + var r = e._subscribers, + o = r.length; + (e._onerror = null), + (r[o] = t), + (r[o + R] = i), + (r[o + M] = n), + 0 === o && e._state && u(k, e); + } + function k(e) { + var t = e._subscribers, + i = e._state; + if (0 !== t.length) { + for ( + var n = void 0, r = void 0, o = e._result, a = 0; + a < t.length; + a += 3 + ) + (n = t[a]), (r = t[a + i]), n ? G(i, n, r, o) : r(o); + e._subscribers.length = 0; + } + } + function U() { + this.error = null; + } + var V = new U(); + function G(t, i, n, r) { + var o = e(n), + a = void 0, + s = void 0, + c = void 0, + u = void 0; + if (o) { + if ( + ((a = (function (e, t) { + try { + return e(t); + } catch (e) { + return (V.error = e), V; + } + })(n, r)) === V + ? ((u = true), (s = a.error), (a = null)) + : (c = true), + i === a) + ) + return void B( + i, + new TypeError( + "A promises callback cannot return that same promise." + ) + ); + } else (a = r), (c = true); + i._state !== P || + (o && c + ? D(i, a) + : u + ? B(i, s) + : t === R + ? F(i, a) + : t === M && B(i, a)); + } + var z = 0; + function j(e) { + (e[S] = z++), + (e._state = void 0), + (e._result = void 0), + (e._subscribers = []); + } + function H(e, i) { + (this._instanceConstructor = e), + (this.promise = new e(C)), + this.promise[S] || j(this.promise), + t(i) + ? ((this._input = i), + (this.length = i.length), + (this._remaining = i.length), + (this._result = new Array(this.length)), + 0 === this.length + ? F(this.promise, this._result) + : ((this.length = this.length || 0), + this._enumerate(), + 0 === this._remaining && F(this.promise, this._result))) + : B( + this.promise, + new Error("Array Methods must be provided an Array") + ); + } + function W(e) { + (this[S] = z++), + (this._result = this._state = void 0), + (this._subscribers = []), + C !== e && + ("function" != typeof e && + (function () { + throw new TypeError( + "You must pass a resolver function as the first argument to the promise constructor" + ); + })(), + this instanceof W + ? (function (e, t) { + try { + t( + function (t) { + D(e, t); + }, + function (t) { + B(e, t); + } + ); + } catch (t) { + B(e, t); + } + })(this, e) + : (function () { + throw new TypeError( + "Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function." + ); + })()); + } + function X() { + var e = void 0; + if (void 0 !== r) e = r; + else if ("undefined" != typeof self) e = self; + else + try { + e = Function("return this")(); + } catch (e) { + throw new Error( + "polyfill failed because global object is unavailable in this environment" + ); + } + var t = e.Promise; + if (t) { + var i = null; + try { + i = Object.prototype.toString.call(t.resolve()); + } catch (e) {} + if ("[object Promise]" === i && !t.cast) return; + } + e.Promise = W; + } + return ( + (H.prototype._enumerate = function () { + for ( + var e = this.length, t = this._input, i = 0; + this._state === P && i < e; + i++ + ) + this._eachEntry(t[i], i); + }), + (H.prototype._eachEntry = function (e, t) { + var i = this._instanceConstructor, + n = i.resolve; + if (n === x) { + var r = w(e); + if (r === A && e._state !== P) + this._settledAt(e._state, t, e._result); + else if ("function" != typeof r) + this._remaining--, (this._result[t] = e); + else if (i === W) { + var o = new i(C); + I(o, e, r), this._willSettleAt(o, t); + } else + this._willSettleAt( + new i(function (t) { + return t(e); + }), + t + ); + } else this._willSettleAt(n(e), t); + }), + (H.prototype._settledAt = function (e, t, i) { + var n = this.promise; + n._state === P && + (this._remaining--, e === M ? B(n, i) : (this._result[t] = i)), + 0 === this._remaining && F(n, this._result); + }), + (H.prototype._willSettleAt = function (e, t) { + var i = this; + N( + e, + void 0, + function (e) { + return i._settledAt(R, t, e); + }, + function (e) { + return i._settledAt(M, t, e); + } + ); + }), + (W.all = function (e) { + return new H(this, e).promise; + }), + (W.race = function (e) { + var i = this; + return t(e) + ? new i(function (t, n) { + for (var r = e.length, o = 0; o < r; o++) + i.resolve(e[o]).then(t, n); + }) + : new i(function (e, t) { + return t(new TypeError("You must pass an array to race.")); + }); + }), + (W.resolve = x), + (W.reject = function (e) { + var t = new this(C); + return B(t, e), t; + }), + (W._setScheduler = function (e) { + s = e; + }), + (W._setAsap = function (e) { + u = e; + }), + (W._asap = u), + (W.prototype = { + constructor: W, + then: A, + catch: function (e) { + return this.then(null, e); + }, + }), + X(), + (W.polyfill = X), + (W.Promise = W), + W + ); + }), + "object" === c(t) && void 0 !== e + ? (e.exports = s()) + : void 0 === + (a = "function" == typeof (o = s) ? o.call(t, i, t, e) : o) || + (e.exports = a); + }.call(this, i(27), i(15))); + }, + function (e, t) {}, + function (e, t, i) {}, + function (e, t) { e.exports = { - backendBaseUrl: "https://9p1bb7fwdf.execute-api.us-east-1.amazonaws.com/prod" - } -} -, function(e, t, i) { + backendBaseUrl: + "https://9p1bb7fwdf.execute-api.us-east-1.amazonaws.com/prod", + }; + }, + function (e, t, i) { "use strict"; - t.byteLength = function(e) { - var t = u(e) - , i = t[0] - , n = t[1]; - return 3 * (i + n) / 4 - n - } - , - t.toByteArray = function(e) { - for (var t, i = u(e), n = i[0], a = i[1], s = new o(function(e, t, i) { - return 3 * (t + i) / 4 - i - }(0, n, a)), c = 0, l = a > 0 ? n - 4 : n, h = 0; h < l; h += 4) - t = r[e.charCodeAt(h)] << 18 | r[e.charCodeAt(h + 1)] << 12 | r[e.charCodeAt(h + 2)] << 6 | r[e.charCodeAt(h + 3)], - s[c++] = t >> 16 & 255, - s[c++] = t >> 8 & 255, - s[c++] = 255 & t; - 2 === a && (t = r[e.charCodeAt(h)] << 2 | r[e.charCodeAt(h + 1)] >> 4, - s[c++] = 255 & t); - 1 === a && (t = r[e.charCodeAt(h)] << 10 | r[e.charCodeAt(h + 1)] << 4 | r[e.charCodeAt(h + 2)] >> 2, - s[c++] = t >> 8 & 255, - s[c++] = 255 & t); - return s - } - , - t.fromByteArray = function(e) { - for (var t, i = e.length, r = i % 3, o = [], a = 0, s = i - r; a < s; a += 16383) - o.push(l(e, a, a + 16383 > s ? s : a + 16383)); - 1 === r ? (t = e[i - 1], - o.push(n[t >> 2] + n[t << 4 & 63] + "==")) : 2 === r && (t = (e[i - 2] << 8) + e[i - 1], - o.push(n[t >> 10] + n[t >> 4 & 63] + n[t << 2 & 63] + "=")); - return o.join("") - } - ; - for (var n = [], r = [], o = "undefined" != typeof Uint8Array ? Uint8Array : Array, a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s = 0, c = a.length; s < c; ++s) - n[s] = a[s], - r[a.charCodeAt(s)] = s; + (t.byteLength = function (e) { + var t = u(e), + i = t[0], + n = t[1]; + return (3 * (i + n)) / 4 - n; + }), + (t.toByteArray = function (e) { + for ( + var t, + i = u(e), + n = i[0], + a = i[1], + s = new o( + (function (e, t, i) { + return (3 * (t + i)) / 4 - i; + })(0, n, a) + ), + c = 0, + l = a > 0 ? n - 4 : n, + h = 0; + h < l; + h += 4 + ) + (t = + (r[e.charCodeAt(h)] << 18) | + (r[e.charCodeAt(h + 1)] << 12) | + (r[e.charCodeAt(h + 2)] << 6) | + r[e.charCodeAt(h + 3)]), + (s[c++] = (t >> 16) & 255), + (s[c++] = (t >> 8) & 255), + (s[c++] = 255 & t); + 2 === a && + ((t = (r[e.charCodeAt(h)] << 2) | (r[e.charCodeAt(h + 1)] >> 4)), + (s[c++] = 255 & t)); + 1 === a && + ((t = + (r[e.charCodeAt(h)] << 10) | + (r[e.charCodeAt(h + 1)] << 4) | + (r[e.charCodeAt(h + 2)] >> 2)), + (s[c++] = (t >> 8) & 255), + (s[c++] = 255 & t)); + return s; + }), + (t.fromByteArray = function (e) { + for ( + var t, i = e.length, r = i % 3, o = [], a = 0, s = i - r; + a < s; + a += 16383 + ) + o.push(l(e, a, a + 16383 > s ? s : a + 16383)); + 1 === r + ? ((t = e[i - 1]), o.push(n[t >> 2] + n[(t << 4) & 63] + "==")) + : 2 === r && + ((t = (e[i - 2] << 8) + e[i - 1]), + o.push(n[t >> 10] + n[(t >> 4) & 63] + n[(t << 2) & 63] + "=")); + return o.join(""); + }); + for ( + var n = [], + r = [], + o = "undefined" != typeof Uint8Array ? Uint8Array : Array, + a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + s = 0, + c = a.length; + s < c; + ++s + ) + (n[s] = a[s]), (r[a.charCodeAt(s)] = s); function u(e) { - var t = e.length; - if (t % 4 > 0) - throw new Error("Invalid string. Length must be a multiple of 4"); - var i = e.indexOf("="); - return -1 === i && (i = t), - [i, i === t ? 0 : 4 - i % 4] + var t = e.length; + if (t % 4 > 0) + throw new Error("Invalid string. Length must be a multiple of 4"); + var i = e.indexOf("="); + return -1 === i && (i = t), [i, i === t ? 0 : 4 - (i % 4)]; } function l(e, t, i) { - for (var r, o, a = [], s = t; s < i; s += 3) - r = (e[s] << 16 & 16711680) + (e[s + 1] << 8 & 65280) + (255 & e[s + 2]), - a.push(n[(o = r) >> 18 & 63] + n[o >> 12 & 63] + n[o >> 6 & 63] + n[63 & o]); - return a.join("") + for (var r, o, a = [], s = t; s < i; s += 3) + (r = + ((e[s] << 16) & 16711680) + + ((e[s + 1] << 8) & 65280) + + (255 & e[s + 2])), + a.push( + n[((o = r) >> 18) & 63] + + n[(o >> 12) & 63] + + n[(o >> 6) & 63] + + n[63 & o] + ); + return a.join(""); } - r["-".charCodeAt(0)] = 62, - r["_".charCodeAt(0)] = 63 -} -, function(e, t) { - t.read = function(e, t, i, n, r) { - var o, a, s = 8 * r - n - 1, c = (1 << s) - 1, u = c >> 1, l = -7, h = i ? r - 1 : 0, f = i ? -1 : 1, d = e[t + h]; - for (h += f, - o = d & (1 << -l) - 1, - d >>= -l, - l += s; l > 0; o = 256 * o + e[t + h], - h += f, - l -= 8) - ; - for (a = o & (1 << -l) - 1, - o >>= -l, - l += n; l > 0; a = 256 * a + e[t + h], - h += f, - l -= 8) - ; - if (0 === o) - o = 1 - u; - else { - if (o === c) - return a ? NaN : 1 / 0 * (d ? -1 : 1); - a += Math.pow(2, n), - o -= u - } - return (d ? -1 : 1) * a * Math.pow(2, o - n) - } - , - t.write = function(e, t, i, n, r, o) { - var a, s, c, u = 8 * o - r - 1, l = (1 << u) - 1, h = l >> 1, f = 23 === r ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = n ? 0 : o - 1, p = n ? 1 : -1, m = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0; - for (t = Math.abs(t), - isNaN(t) || t === 1 / 0 ? (s = isNaN(t) ? 1 : 0, - a = l) : (a = Math.floor(Math.log(t) / Math.LN2), - t * (c = Math.pow(2, -a)) < 1 && (a--, - c *= 2), - (t += a + h >= 1 ? f / c : f * Math.pow(2, 1 - h)) * c >= 2 && (a++, - c /= 2), - a + h >= l ? (s = 0, - a = l) : a + h >= 1 ? (s = (t * c - 1) * Math.pow(2, r), - a += h) : (s = t * Math.pow(2, h - 1) * Math.pow(2, r), - a = 0)); r >= 8; e[i + d] = 255 & s, - d += p, - s /= 256, - r -= 8) - ; - for (a = a << r | s, - u += r; u > 0; e[i + d] = 255 & a, - d += p, - a /= 256, - u -= 8) - ; - e[i + d - p] |= 128 * m - } -} -, function(e, t, i) { - (function(n) { - function r(e) { - return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - t.log = function() { - var e; - return "object" === ("undefined" == typeof console ? "undefined" : r(console)) && console.log && (e = console).log.apply(e, arguments) - } - , - t.formatArgs = function(t) { - if (t[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + t[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff), + (r["-".charCodeAt(0)] = 62), (r["_".charCodeAt(0)] = 63); + }, + function (e, t) { + (t.read = function (e, t, i, n, r) { + var o, + a, + s = 8 * r - n - 1, + c = (1 << s) - 1, + u = c >> 1, + l = -7, + h = i ? r - 1 : 0, + f = i ? -1 : 1, + d = e[t + h]; + for ( + h += f, o = d & ((1 << -l) - 1), d >>= -l, l += s; + l > 0; + o = 256 * o + e[t + h], h += f, l -= 8 + ); + for ( + a = o & ((1 << -l) - 1), o >>= -l, l += n; + l > 0; + a = 256 * a + e[t + h], h += f, l -= 8 + ); + if (0 === o) o = 1 - u; + else { + if (o === c) return a ? NaN : (1 / 0) * (d ? -1 : 1); + (a += Math.pow(2, n)), (o -= u); + } + return (d ? -1 : 1) * a * Math.pow(2, o - n); + }), + (t.write = function (e, t, i, n, r, o) { + var a, + s, + c, + u = 8 * o - r - 1, + l = (1 << u) - 1, + h = l >> 1, + f = 23 === r ? Math.pow(2, -24) - Math.pow(2, -77) : 0, + d = n ? 0 : o - 1, + p = n ? 1 : -1, + m = t < 0 || (0 === t && 1 / t < 0) ? 1 : 0; + for ( + t = Math.abs(t), + isNaN(t) || t === 1 / 0 + ? ((s = isNaN(t) ? 1 : 0), (a = l)) + : ((a = Math.floor(Math.log(t) / Math.LN2)), + t * (c = Math.pow(2, -a)) < 1 && (a--, (c *= 2)), + (t += a + h >= 1 ? f / c : f * Math.pow(2, 1 - h)) * c >= 2 && + (a++, (c /= 2)), + a + h >= l + ? ((s = 0), (a = l)) + : a + h >= 1 + ? ((s = (t * c - 1) * Math.pow(2, r)), (a += h)) + : ((s = t * Math.pow(2, h - 1) * Math.pow(2, r)), (a = 0))); + r >= 8; + e[i + d] = 255 & s, d += p, s /= 256, r -= 8 + ); + for ( + a = (a << r) | s, u += r; + u > 0; + e[i + d] = 255 & a, d += p, a /= 256, u -= 8 + ); + e[i + d - p] |= 128 * m; + }); + }, + function (e, t, i) { + (function (n) { + function r(e) { + return (r = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + (t.log = function () { + var e; + return ( + "object" === + ("undefined" == typeof console ? "undefined" : r(console)) && + console.log && + (e = console).log.apply(e, arguments) + ); + }), + (t.formatArgs = function (t) { + if ( + ((t[0] = + (this.useColors ? "%c" : "") + + this.namespace + + (this.useColors ? " %c" : " ") + + t[0] + + (this.useColors ? "%c " : " ") + + "+" + + e.exports.humanize(this.diff)), !this.useColors) - return; - var i = "color: " + this.color; - t.splice(1, 0, i, "color: inherit"); - var n = 0 - , r = 0; - t[0].replace(/%[a-zA-Z%]/g, function(e) { - "%%" !== e && (n++, - "%c" === e && (r = n)) - }), - t.splice(r, 0, i) - } - , - t.save = function(e) { - try { - e ? t.storage.setItem("debug", e) : t.storage.removeItem("debug") - } catch (e) {} - } - , - t.load = function() { - var e; - try { - e = t.storage.getItem("debug") - } catch (e) {} - !e && void 0 !== n && "env"in n && (e = n.env.DEBUG); - return e - } - , - t.useColors = function() { - if ("undefined" != typeof window && window.process && ("renderer" === window.process.type || window.process.__nwjs)) - return true; - if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) - return false; - return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/) - } - , - t.storage = function() { - try { - return localStorage - } catch (e) {} - }(), - t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], - e.exports = i(401)(t), - e.exports.formatters.j = function(e) { - try { - return JSON.stringify(e) - } catch (e) { - return "[UnexpectedJSONParseError]: " + e.message - } - } - } - ).call(this, i(27)) -} -, function(e, t, i) { - function n(e) { - return function(e) { - if (Array.isArray(e)) { - for (var t = 0, i = new Array(e.length); t < e.length; t++) - i[t] = e[t]; - return i - } - }(e) || function(e) { - if (Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e)) - return Array.from(e) - }(e) || function() { - throw new TypeError("Invalid attempt to spread non-iterable instance") - }() - } - e.exports = function(e) { - function t(e) { - for (var t = 0, i = 0; i < e.length; i++) - t = (t << 5) - t + e.charCodeAt(i), - t |= 0; - return r.colors[Math.abs(t) % r.colors.length] - } - function r(e) { - var i; - function n() { - for (var e = arguments.length, t = new Array(e), o = 0; o < e; o++) - t[o] = arguments[o]; - if (n.enabled) { - var a = n - , s = Number(new Date) - , c = s - (i || s); - a.diff = c, - a.prev = i, - a.curr = s, - i = s, - t[0] = r.coerce(t[0]), - "string" != typeof t[0] && t.unshift("%O"); - var u = 0; - t[0] = t[0].replace(/%([a-zA-Z%])/g, function(e, i) { - if ("%%" === e) - return e; - u++; - var n = r.formatters[i]; - if ("function" == typeof n) { - var o = t[u]; - e = n.call(a, o), - t.splice(u, 1), - u-- - } - return e - }), - r.formatArgs.call(a, t), - (a.log || r.log).apply(a, t) - } - } - return n.namespace = e, - n.enabled = r.enabled(e), - n.useColors = r.useColors(), - n.color = t(e), - n.destroy = o, - n.extend = a, - "function" == typeof r.init && r.init(n), - r.instances.push(n), - n - } - function o() { - var e = r.instances.indexOf(this); - return -1 !== e && (r.instances.splice(e, 1), - true) - } - function a(e, t) { - var i = r(this.namespace + (void 0 === t ? ":" : t) + e); - return i.log = this.log, - i - } - function s(e) { - return e.toString().substring(2, e.toString().length - 2).replace(/\.\*\?$/, "*") - } - return r.debug = r, - r.default = r, - r.coerce = function(e) { - return e instanceof Error ? e.stack || e.message : e - } - , - r.disable = function() { - var e = n(r.names.map(s)).concat(n(r.skips.map(s).map(function(e) { - return "-" + e - }))).join(","); - return r.enable(""), - e - } - , - r.enable = function(e) { - var t; - r.save(e), - r.names = [], - r.skips = []; - var i = ("string" == typeof e ? e : "").split(/[\s,]+/) - , n = i.length; - for (t = 0; t < n; t++) - i[t] && ("-" === (e = i[t].replace(/\*/g, ".*?"))[0] ? r.skips.push(new RegExp("^" + e.substr(1) + "$")) : r.names.push(new RegExp("^" + e + "$"))); - for (t = 0; t < r.instances.length; t++) { - var o = r.instances[t]; - o.enabled = r.enabled(o.namespace) - } - } - , - r.enabled = function(e) { - if ("*" === e[e.length - 1]) - return true; - var t, i; - for (t = 0, - i = r.skips.length; t < i; t++) - if (r.skips[t].test(e)) - return false; - for (t = 0, - i = r.names.length; t < i; t++) - if (r.names[t].test(e)) - return true; - return false - } - , - r.humanize = i(402), - Object.keys(e).forEach(function(t) { - r[t] = e[t] + ) + return; + var i = "color: " + this.color; + t.splice(1, 0, i, "color: inherit"); + var n = 0, + r = 0; + t[0].replace(/%[a-zA-Z%]/g, function (e) { + "%%" !== e && (n++, "%c" === e && (r = n)); + }), + t.splice(r, 0, i); }), - r.instances = [], - r.names = [], - r.skips = [], - r.formatters = {}, - r.selectColor = t, + (t.save = function (e) { + try { + e ? t.storage.setItem("debug", e) : t.storage.removeItem("debug"); + } catch (e) {} + }), + (t.load = function () { + var e; + try { + e = t.storage.getItem("debug"); + } catch (e) {} + !e && void 0 !== n && "env" in n && (e = n.env.DEBUG); + return e; + }), + (t.useColors = function () { + if ( + "undefined" != typeof window && + window.process && + ("renderer" === window.process.type || window.process.__nwjs) + ) + return true; + if ( + "undefined" != typeof navigator && + navigator.userAgent && + navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/) + ) + return false; + return ( + ("undefined" != typeof document && + document.documentElement && + document.documentElement.style && + document.documentElement.style.WebkitAppearance) || + ("undefined" != typeof window && + window.console && + (window.console.firebug || + (window.console.exception && window.console.table))) || + ("undefined" != typeof navigator && + navigator.userAgent && + navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && + parseInt(RegExp.$1, 10) >= 31) || + ("undefined" != typeof navigator && + navigator.userAgent && + navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)) + ); + }), + (t.storage = (function () { + try { + return localStorage; + } catch (e) {} + })()), + (t.colors = [ + "#0000CC", + "#0000FF", + "#0033CC", + "#0033FF", + "#0066CC", + "#0066FF", + "#0099CC", + "#0099FF", + "#00CC00", + "#00CC33", + "#00CC66", + "#00CC99", + "#00CCCC", + "#00CCFF", + "#3300CC", + "#3300FF", + "#3333CC", + "#3333FF", + "#3366CC", + "#3366FF", + "#3399CC", + "#3399FF", + "#33CC00", + "#33CC33", + "#33CC66", + "#33CC99", + "#33CCCC", + "#33CCFF", + "#6600CC", + "#6600FF", + "#6633CC", + "#6633FF", + "#66CC00", + "#66CC33", + "#9900CC", + "#9900FF", + "#9933CC", + "#9933FF", + "#99CC00", + "#99CC33", + "#CC0000", + "#CC0033", + "#CC0066", + "#CC0099", + "#CC00CC", + "#CC00FF", + "#CC3300", + "#CC3333", + "#CC3366", + "#CC3399", + "#CC33CC", + "#CC33FF", + "#CC6600", + "#CC6633", + "#CC9900", + "#CC9933", + "#CCCC00", + "#CCCC33", + "#FF0000", + "#FF0033", + "#FF0066", + "#FF0099", + "#FF00CC", + "#FF00FF", + "#FF3300", + "#FF3333", + "#FF3366", + "#FF3399", + "#FF33CC", + "#FF33FF", + "#FF6600", + "#FF6633", + "#FF9900", + "#FF9933", + "#FFCC00", + "#FFCC33", + ]), + (e.exports = i(401)(t)), + (e.exports.formatters.j = function (e) { + try { + return JSON.stringify(e); + } catch (e) { + return "[UnexpectedJSONParseError]: " + e.message; + } + }); + }.call(this, i(27))); + }, + function (e, t, i) { + function n(e) { + return ( + (function (e) { + if (Array.isArray(e)) { + for (var t = 0, i = new Array(e.length); t < e.length; t++) + i[t] = e[t]; + return i; + } + })(e) || + (function (e) { + if ( + Symbol.iterator in Object(e) || + "[object Arguments]" === Object.prototype.toString.call(e) + ) + return Array.from(e); + })(e) || + (function () { + throw new TypeError( + "Invalid attempt to spread non-iterable instance" + ); + })() + ); + } + e.exports = function (e) { + function t(e) { + for (var t = 0, i = 0; i < e.length; i++) + (t = (t << 5) - t + e.charCodeAt(i)), (t |= 0); + return r.colors[Math.abs(t) % r.colors.length]; + } + function r(e) { + var i; + function n() { + for (var e = arguments.length, t = new Array(e), o = 0; o < e; o++) + t[o] = arguments[o]; + if (n.enabled) { + var a = n, + s = Number(new Date()), + c = s - (i || s); + (a.diff = c), + (a.prev = i), + (a.curr = s), + (i = s), + (t[0] = r.coerce(t[0])), + "string" != typeof t[0] && t.unshift("%O"); + var u = 0; + (t[0] = t[0].replace(/%([a-zA-Z%])/g, function (e, i) { + if ("%%" === e) return e; + u++; + var n = r.formatters[i]; + if ("function" == typeof n) { + var o = t[u]; + (e = n.call(a, o)), t.splice(u, 1), u--; + } + return e; + })), + r.formatArgs.call(a, t), + (a.log || r.log).apply(a, t); + } + } + return ( + (n.namespace = e), + (n.enabled = r.enabled(e)), + (n.useColors = r.useColors()), + (n.color = t(e)), + (n.destroy = o), + (n.extend = a), + "function" == typeof r.init && r.init(n), + r.instances.push(n), + n + ); + } + function o() { + var e = r.instances.indexOf(this); + return -1 !== e && (r.instances.splice(e, 1), true); + } + function a(e, t) { + var i = r(this.namespace + (void 0 === t ? ":" : t) + e); + return (i.log = this.log), i; + } + function s(e) { + return e + .toString() + .substring(2, e.toString().length - 2) + .replace(/\.\*\?$/, "*"); + } + return ( + (r.debug = r), + (r.default = r), + (r.coerce = function (e) { + return e instanceof Error ? e.stack || e.message : e; + }), + (r.disable = function () { + var e = n(r.names.map(s)) + .concat( + n( + r.skips.map(s).map(function (e) { + return "-" + e; + }) + ) + ) + .join(","); + return r.enable(""), e; + }), + (r.enable = function (e) { + var t; + r.save(e), (r.names = []), (r.skips = []); + var i = ("string" == typeof e ? e : "").split(/[\s,]+/), + n = i.length; + for (t = 0; t < n; t++) + i[t] && + ("-" === (e = i[t].replace(/\*/g, ".*?"))[0] + ? r.skips.push(new RegExp("^" + e.substr(1) + "$")) + : r.names.push(new RegExp("^" + e + "$"))); + for (t = 0; t < r.instances.length; t++) { + var o = r.instances[t]; + o.enabled = r.enabled(o.namespace); + } + }), + (r.enabled = function (e) { + if ("*" === e[e.length - 1]) return true; + var t, i; + for (t = 0, i = r.skips.length; t < i; t++) + if (r.skips[t].test(e)) return false; + for (t = 0, i = r.names.length; t < i; t++) + if (r.names[t].test(e)) return true; + return false; + }), + (r.humanize = i(402)), + Object.keys(e).forEach(function (t) { + r[t] = e[t]; + }), + (r.instances = []), + (r.names = []), + (r.skips = []), + (r.formatters = {}), + (r.selectColor = t), r.enable(r.load()), r - } -} -, function(e, t) { + ); + }; + }, + function (e, t) { function i(e) { - return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - var n = 1e3 - , r = 60 * n - , o = 60 * r - , a = 24 * o - , s = 7 * a - , c = 365.25 * a; - function u(e, t, i, n) { - var r = t >= 1.5 * i; - return Math.round(e / i) + " " + n + (r ? "s" : "") - } - e.exports = function(e, t) { - t = t || {}; - var l = i(e); - if ("string" === l && e.length > 0) - return function(e) { - if ((e = String(e)).length > 100) - return; - var t = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e); - if (!t) - return; - var i = parseFloat(t[1]); - switch ((t[2] || "ms").toLowerCase()) { - case "years": - case "year": - case "yrs": - case "yr": - case "y": - return i * c; - case "weeks": - case "week": - case "w": - return i * s; - case "days": - case "day": - case "d": - return i * a; - case "hours": - case "hour": - case "hrs": - case "hr": - case "h": - return i * o; - case "minutes": - case "minute": - case "mins": - case "min": - case "m": - return i * r; - case "seconds": - case "second": - case "secs": - case "sec": - case "s": - return i * n; - case "milliseconds": - case "millisecond": - case "msecs": - case "msec": - case "ms": - return i; - default: - return - } - }(e); - if ("number" === l && false === isNaN(e)) - return t.long ? function(e) { - var t = Math.abs(e); - if (t >= a) - return u(e, t, a, "day"); - if (t >= o) - return u(e, t, o, "hour"); - if (t >= r) - return u(e, t, r, "minute"); - if (t >= n) - return u(e, t, n, "second"); - return e + " ms" - }(e) : function(e) { - var t = Math.abs(e); - if (t >= a) - return Math.round(e / a) + "d"; - if (t >= o) - return Math.round(e / o) + "h"; - if (t >= r) - return Math.round(e / r) + "m"; - if (t >= n) - return Math.round(e / n) + "s"; - return e + "ms" - }(e); - throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e)) - } -} -, function(e, t) { - e.exports = function() { - if ("undefined" == typeof window) - return null; - var e = { - RTCPeerConnection: window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection, - RTCSessionDescription: window.RTCSessionDescription || window.mozRTCSessionDescription || window.webkitRTCSessionDescription, - RTCIceCandidate: window.RTCIceCandidate || window.mozRTCIceCandidate || window.webkitRTCIceCandidate - }; - return e.RTCPeerConnection ? e : null - } -} -, function(e, t) {} -, function(e, t, i) { - "use strict"; - var n = i(2).Buffer - , r = i(406); - e.exports = function() { - function e() { - !function(e, t) { - if (!(e instanceof t)) - throw new TypeError("Cannot call a class as a function") - }(this, e), - this.head = null, - this.tail = null, - this.length = 0 - } - return e.prototype.push = function(e) { - var t = { - data: e, - next: null - }; - this.length > 0 ? this.tail.next = t : this.head = t, - this.tail = t, - ++this.length - } - , - e.prototype.unshift = function(e) { - var t = { - data: e, - next: this.head - }; - 0 === this.length && (this.tail = t), - this.head = t, - ++this.length - } - , - e.prototype.shift = function() { - if (0 !== this.length) { - var e = this.head.data; - return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, - --this.length, - e + return (i = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; } - } - , - e.prototype.clear = function() { - this.head = this.tail = null, - this.length = 0 - } - , - e.prototype.join = function(e) { - if (0 === this.length) - return ""; - for (var t = this.head, i = "" + t.data; t = t.next; ) - i += e + t.data; - return i - } - , - e.prototype.concat = function(e) { - if (0 === this.length) - return n.alloc(0); - if (1 === this.length) - return this.head.data; - for (var t, i, r, o = n.allocUnsafe(e >>> 0), a = this.head, s = 0; a; ) - t = a.data, - i = o, - r = s, - t.copy(i, r), - s += a.data.length, - a = a.next; - return o - } - , - e - }(), - r && r.inspect && r.inspect.custom && (e.exports.prototype[r.inspect.custom] = function() { - var e = r.inspect({ - length: this.length - }); - return this.constructor.name + " " + e + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - ) -} -, function(e, t) {} -, function(e, t, i) { - (function(e) { - var n = void 0 !== e && e || "undefined" != typeof self && self || window - , r = Function.prototype.apply; - function o(e, t) { - this._id = e, - this._clearFn = t - } - t.setTimeout = function() { - return new o(r.call(setTimeout, n, arguments),clearTimeout) - } - , - t.setInterval = function() { - return new o(r.call(setInterval, n, arguments),clearInterval) - } - , - t.clearTimeout = t.clearInterval = function(e) { - e && e.close() - } - , - o.prototype.unref = o.prototype.ref = function() {} - , - o.prototype.close = function() { - this._clearFn.call(n, this._id) - } - , - t.enroll = function(e, t) { - clearTimeout(e._idleTimeoutId), - e._idleTimeout = t - } - , - t.unenroll = function(e) { - clearTimeout(e._idleTimeoutId), - e._idleTimeout = -1 - } - , - t._unrefActive = t.active = function(e) { + var n = 1e3, + r = 60 * n, + o = 60 * r, + a = 24 * o, + s = 7 * a, + c = 365.25 * a; + function u(e, t, i, n) { + var r = t >= 1.5 * i; + return Math.round(e / i) + " " + n + (r ? "s" : ""); + } + e.exports = function (e, t) { + t = t || {}; + var l = i(e); + if ("string" === l && e.length > 0) + return (function (e) { + if ((e = String(e)).length > 100) return; + var t = + /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + e + ); + if (!t) return; + var i = parseFloat(t[1]); + switch ((t[2] || "ms").toLowerCase()) { + case "years": + case "year": + case "yrs": + case "yr": + case "y": + return i * c; + case "weeks": + case "week": + case "w": + return i * s; + case "days": + case "day": + case "d": + return i * a; + case "hours": + case "hour": + case "hrs": + case "hr": + case "h": + return i * o; + case "minutes": + case "minute": + case "mins": + case "min": + case "m": + return i * r; + case "seconds": + case "second": + case "secs": + case "sec": + case "s": + return i * n; + case "milliseconds": + case "millisecond": + case "msecs": + case "msec": + case "ms": + return i; + default: + return; + } + })(e); + if ("number" === l && false === isNaN(e)) + return t.long + ? (function (e) { + var t = Math.abs(e); + if (t >= a) return u(e, t, a, "day"); + if (t >= o) return u(e, t, o, "hour"); + if (t >= r) return u(e, t, r, "minute"); + if (t >= n) return u(e, t, n, "second"); + return e + " ms"; + })(e) + : (function (e) { + var t = Math.abs(e); + if (t >= a) return Math.round(e / a) + "d"; + if (t >= o) return Math.round(e / o) + "h"; + if (t >= r) return Math.round(e / r) + "m"; + if (t >= n) return Math.round(e / n) + "s"; + return e + "ms"; + })(e); + throw new Error( + "val is not a non-empty string or a valid number. val=" + + JSON.stringify(e) + ); + }; + }, + function (e, t) { + e.exports = function () { + if ("undefined" == typeof window) return null; + var e = { + RTCPeerConnection: + window.RTCPeerConnection || + window.mozRTCPeerConnection || + window.webkitRTCPeerConnection, + RTCSessionDescription: + window.RTCSessionDescription || + window.mozRTCSessionDescription || + window.webkitRTCSessionDescription, + RTCIceCandidate: + window.RTCIceCandidate || + window.mozRTCIceCandidate || + window.webkitRTCIceCandidate, + }; + return e.RTCPeerConnection ? e : null; + }; + }, + function (e, t) {}, + function (e, t, i) { + "use strict"; + var n = i(2).Buffer, + r = i(406); + (e.exports = (function () { + function e() { + !(function (e, t) { + if (!(e instanceof t)) + throw new TypeError("Cannot call a class as a function"); + })(this, e), + (this.head = null), + (this.tail = null), + (this.length = 0); + } + return ( + (e.prototype.push = function (e) { + var t = { + data: e, + next: null, + }; + this.length > 0 ? (this.tail.next = t) : (this.head = t), + (this.tail = t), + ++this.length; + }), + (e.prototype.unshift = function (e) { + var t = { + data: e, + next: this.head, + }; + 0 === this.length && (this.tail = t), (this.head = t), ++this.length; + }), + (e.prototype.shift = function () { + if (0 !== this.length) { + var e = this.head.data; + return ( + 1 === this.length + ? (this.head = this.tail = null) + : (this.head = this.head.next), + --this.length, + e + ); + } + }), + (e.prototype.clear = function () { + (this.head = this.tail = null), (this.length = 0); + }), + (e.prototype.join = function (e) { + if (0 === this.length) return ""; + for (var t = this.head, i = "" + t.data; (t = t.next); ) + i += e + t.data; + return i; + }), + (e.prototype.concat = function (e) { + if (0 === this.length) return n.alloc(0); + if (1 === this.length) return this.head.data; + for ( + var t, i, r, o = n.allocUnsafe(e >>> 0), a = this.head, s = 0; + a; + + ) + (t = a.data), + (i = o), + (r = s), + t.copy(i, r), + (s += a.data.length), + (a = a.next); + return o; + }), + e + ); + })()), + r && + r.inspect && + r.inspect.custom && + (e.exports.prototype[r.inspect.custom] = function () { + var e = r.inspect({ + length: this.length, + }); + return this.constructor.name + " " + e; + }); + }, + function (e, t) {}, + function (e, t, i) { + (function (e) { + var n = + (void 0 !== e && e) || ("undefined" != typeof self && self) || window, + r = Function.prototype.apply; + function o(e, t) { + (this._id = e), (this._clearFn = t); + } + (t.setTimeout = function () { + return new o(r.call(setTimeout, n, arguments), clearTimeout); + }), + (t.setInterval = function () { + return new o(r.call(setInterval, n, arguments), clearInterval); + }), + (t.clearTimeout = t.clearInterval = + function (e) { + e && e.close(); + }), + (o.prototype.unref = o.prototype.ref = function () {}), + (o.prototype.close = function () { + this._clearFn.call(n, this._id); + }), + (t.enroll = function (e, t) { + clearTimeout(e._idleTimeoutId), (e._idleTimeout = t); + }), + (t.unenroll = function (e) { + clearTimeout(e._idleTimeoutId), (e._idleTimeout = -1); + }), + (t._unrefActive = t.active = + function (e) { clearTimeout(e._idleTimeoutId); var t = e._idleTimeout; - t >= 0 && (e._idleTimeoutId = setTimeout(function() { - e._onTimeout && e._onTimeout() - }, t)) - } - , + t >= 0 && + (e._idleTimeoutId = setTimeout(function () { + e._onTimeout && e._onTimeout(); + }, t)); + }), i(408), - t.setImmediate = "undefined" != typeof self && self.setImmediate || void 0 !== e && e.setImmediate || this && this.setImmediate, - t.clearImmediate = "undefined" != typeof self && self.clearImmediate || void 0 !== e && e.clearImmediate || this && this.clearImmediate - } - ).call(this, i(15)) -} -, function(e, t, i) { - (function(e, t) { - !function(e, i) { - "use strict"; - if (!e.setImmediate) { - var n, r, o, a, s, c = 1, u = {}, l = false, h = e.document, f = Object.getPrototypeOf && Object.getPrototypeOf(e); - f = f && f.setTimeout ? f : e, - "[object process]" === {}.toString.call(e.process) ? n = function(e) { - t.nextTick(function() { - p(e) - }) - } - : !function() { - if (e.postMessage && !e.importScripts) { - var t = true - , i = e.onmessage; - return e.onmessage = function() { - t = false - } - , - e.postMessage("", "*"), - e.onmessage = i, - t - } - }() ? e.MessageChannel ? ((o = new MessageChannel).port1.onmessage = function(e) { - p(e.data) - } - , - n = function(e) { - o.port2.postMessage(e) - } - ) : h && "onreadystatechange"in h.createElement("script") ? (r = h.documentElement, - n = function(e) { + (t.setImmediate = + ("undefined" != typeof self && self.setImmediate) || + (void 0 !== e && e.setImmediate) || + (this && this.setImmediate)), + (t.clearImmediate = + ("undefined" != typeof self && self.clearImmediate) || + (void 0 !== e && e.clearImmediate) || + (this && this.clearImmediate)); + }.call(this, i(15))); + }, + function (e, t, i) { + (function (e, t) { + !(function (e, i) { + "use strict"; + if (!e.setImmediate) { + var n, + r, + o, + a, + s, + c = 1, + u = {}, + l = false, + h = e.document, + f = Object.getPrototypeOf && Object.getPrototypeOf(e); + (f = f && f.setTimeout ? f : e), + "[object process]" === {}.toString.call(e.process) + ? (n = function (e) { + t.nextTick(function () { + p(e); + }); + }) + : !(function () { + if (e.postMessage && !e.importScripts) { + var t = true, + i = e.onmessage; + return ( + (e.onmessage = function () { + t = false; + }), + e.postMessage("", "*"), + (e.onmessage = i), + t + ); + } + })() + ? e.MessageChannel + ? (((o = new MessageChannel()).port1.onmessage = function (e) { + p(e.data); + }), + (n = function (e) { + o.port2.postMessage(e); + })) + : h && "onreadystatechange" in h.createElement("script") + ? ((r = h.documentElement), + (n = function (e) { var t = h.createElement("script"); - t.onreadystatechange = function() { - p(e), - t.onreadystatechange = null, + (t.onreadystatechange = function () { + p(e), + (t.onreadystatechange = null), r.removeChild(t), - t = null - } - , - r.appendChild(t) - } - ) : n = function(e) { - setTimeout(p, 0, e) - } - : (a = "setImmediate$" + Math.random() + "$", - s = function(t) { - t.source === e && "string" == typeof t.data && 0 === t.data.indexOf(a) && p(+t.data.slice(a.length)) - } - , - e.addEventListener ? e.addEventListener("message", s, false) : e.attachEvent("onmessage", s), - n = function(t) { - e.postMessage(a + t, "*") - } - ), - f.setImmediate = function(e) { - "function" != typeof e && (e = new Function("" + e)); - for (var t = new Array(arguments.length - 1), i = 0; i < t.length; i++) - t[i] = arguments[i + 1]; - var r = { - callback: e, - args: t - }; - return u[c] = r, - n(c), - c++ - } - , - f.clearImmediate = d - } - function d(e) { - delete u[e] - } - function p(e) { - if (l) + (t = null); + }), + r.appendChild(t); + })) + : (n = function (e) { setTimeout(p, 0, e); - else { - var t = u[e]; - if (t) { - l = true; - try { - !function(e) { - var t = e.callback - , n = e.args; - switch (n.length) { - case 0: - t(); - break; - case 1: - t(n[0]); - break; - case 2: - t(n[0], n[1]); - break; - case 3: - t(n[0], n[1], n[2]); - break; - default: - t.apply(i, n) - } - }(t) - } finally { - d(e), - l = false - } - } - } - } - }("undefined" == typeof self ? void 0 === e ? this : e : self) - } - ).call(this, i(15), i(27)) -} -, function(e, t, i) { - (function(t) { - function i(e) { - try { - if (!t.localStorage) - return false - } catch (e) { - return false - } - var i = t.localStorage[e]; - return null != i && "true" === String(i).toLowerCase() + }) + : ((a = "setImmediate$" + Math.random() + "$"), + (s = function (t) { + t.source === e && + "string" == typeof t.data && + 0 === t.data.indexOf(a) && + p(+t.data.slice(a.length)); + }), + e.addEventListener + ? e.addEventListener("message", s, false) + : e.attachEvent("onmessage", s), + (n = function (t) { + e.postMessage(a + t, "*"); + })), + (f.setImmediate = function (e) { + "function" != typeof e && (e = new Function("" + e)); + for ( + var t = new Array(arguments.length - 1), i = 0; + i < t.length; + i++ + ) + t[i] = arguments[i + 1]; + var r = { + callback: e, + args: t, + }; + return (u[c] = r), n(c), c++; + }), + (f.clearImmediate = d); } - e.exports = function(e, t) { - if (i("noDeprecation")) - return e; - var n = false; - return function() { - if (!n) { - if (i("throwDeprecation")) - throw new Error(t); - i("traceDeprecation") ? console.trace(t) : console.warn(t), - n = true - } - return e.apply(this, arguments) - } + function d(e) { + delete u[e]; } - } - ).call(this, i(15)) -} -, function(e, t, i) { + function p(e) { + if (l) setTimeout(p, 0, e); + else { + var t = u[e]; + if (t) { + l = true; + try { + !(function (e) { + var t = e.callback, + n = e.args; + switch (n.length) { + case 0: + t(); + break; + case 1: + t(n[0]); + break; + case 2: + t(n[0], n[1]); + break; + case 3: + t(n[0], n[1], n[2]); + break; + default: + t.apply(i, n); + } + })(t); + } finally { + d(e), (l = false); + } + } + } + } + })("undefined" == typeof self ? (void 0 === e ? this : e) : self); + }.call(this, i(15), i(27))); + }, + function (e, t, i) { + (function (t) { + function i(e) { + try { + if (!t.localStorage) return false; + } catch (e) { + return false; + } + var i = t.localStorage[e]; + return null != i && "true" === String(i).toLowerCase(); + } + e.exports = function (e, t) { + if (i("noDeprecation")) return e; + var n = false; + return function () { + if (!n) { + if (i("throwDeprecation")) throw new Error(t); + i("traceDeprecation") ? console.trace(t) : console.warn(t), + (n = true); + } + return e.apply(this, arguments); + }; + }; + }.call(this, i(15))); + }, + function (e, t, i) { "use strict"; e.exports = o; - var n = i(172) - , r = i(68); + var n = i(172), + r = i(68); function o(e) { - if (!(this instanceof o)) - return new o(e); - n.call(this, e) + if (!(this instanceof o)) return new o(e); + n.call(this, e); } - r.inherits = i(1), - r.inherits(o, n), - o.prototype._transform = function(e, t, i) { - i(null, e) - } -} -, function(e, t, i) { - (function(e, i, n) { - var r, o, a, s; - function c(e) { - return (c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e + (r.inherits = i(1)), + r.inherits(o, n), + (o.prototype._transform = function (e, t, i) { + i(null, e); + }); + }, + function (e, t, i) { + (function (e, i, n) { + var r, o, a, s; + function c(e) { + return (c = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + "undefined" != typeof self && self, + (s = function () { + return (function (e) { + var t = {}; + function i(n) { + if (t[n]) return t[n].exports; + var r = (t[n] = { + i: n, + l: false, + exports: {}, + }); + return ( + e[n].call(r.exports, r, r.exports, i), (r.l = true), r.exports + ); } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) - } - "undefined" != typeof self && self, - s = function() { - return function(e) { - var t = {}; - function i(n) { - if (t[n]) - return t[n].exports; - var r = t[n] = { - i: n, - l: false, - exports: {} - }; - return e[n].call(r.exports, r, r.exports, i), - r.l = true, - r.exports - } - return i.m = e, - i.c = t, - i.d = function(e, t, n) { - i.o(e, t) || Object.defineProperty(e, t, { - enumerable: true, - get: n - }) - } - , - i.r = function(e) { - "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { - value: "Module" - }), - Object.defineProperty(e, "__esModule", { - value: true - }) - } - , - i.t = function(e, t) { - if (1 & t && (e = i(e)), - 8 & t) + return ( + (i.m = e), + (i.c = t), + (i.d = function (e, t, n) { + i.o(e, t) || + Object.defineProperty(e, t, { + enumerable: true, + get: n, + }); + }), + (i.r = function (e) { + "undefined" != typeof Symbol && + Symbol.toStringTag && + Object.defineProperty(e, Symbol.toStringTag, { + value: "Module", + }), + Object.defineProperty(e, "__esModule", { + value: true, + }); + }), + (i.t = function (e, t) { + if ((1 & t && (e = i(e)), 8 & t)) return e; + if (4 & t && "object" == c(e) && e && e.__esModule) return e; + var n = Object.create(null); + if ( + (i.r(n), + Object.defineProperty(n, "default", { + enumerable: true, + value: e, + }), + 2 & t && "string" != typeof e) + ) + for (var r in e) + i.d( + n, + r, + function (t) { + return e[t]; + }.bind(null, r) + ); + return n; + }), + (i.n = function (e) { + var t = + e && e.__esModule + ? function () { + return e.default; + } + : function () { return e; - if (4 & t && "object" == c(e) && e && e.__esModule) - return e; - var n = Object.create(null); - if (i.r(n), - Object.defineProperty(n, "default", { - enumerable: true, - value: e - }), - 2 & t && "string" != typeof e) - for (var r in e) - i.d(n, r, function(t) { - return e[t] - } - .bind(null, r)); - return n - } - , - i.n = function(e) { - var t = e && e.__esModule ? function() { - return e.default - } - : function() { - return e - } - ; - return i.d(t, "a", t), - t - } - , - i.o = function(e, t) { - return Object.prototype.hasOwnProperty.call(e, t) - } - , - i.p = "", - i(i.s = 129) - }([function(e, t, i) { - "use strict"; - i.d(t, "u", function() { - return a + }; + return i.d(t, "a", t), t; + }), + (i.o = function (e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + }), + (i.p = ""), + i((i.s = 129)) + ); + })([ + function (e, t, i) { + "use strict"; + i.d(t, "u", function () { + return a; + }), + i.d(t, "v", function () { + return s; }), - i.d(t, "v", function() { - return s + i.d(t, "h", function () { + return c; }), - i.d(t, "h", function() { - return c + i.d(t, "e", function () { + return u; }), - i.d(t, "e", function() { - return u + i.d(t, "f", function () { + return l; }), - i.d(t, "f", function() { - return l + i.d(t, "w", function () { + return h; }), - i.d(t, "w", function() { - return h + i.d(t, "x", function () { + return f; }), - i.d(t, "x", function() { - return f + i.d(t, "y", function () { + return d; }), - i.d(t, "y", function() { - return d + i.d(t, "r", function () { + return p; }), - i.d(t, "r", function() { - return p + i.d(t, "q", function () { + return m; }), - i.d(t, "q", function() { - return m + i.d(t, "j", function () { + return g; }), - i.d(t, "j", function() { - return g + i.d(t, "n", function () { + return _; }), - i.d(t, "n", function() { - return _ + i.d(t, "z", function () { + return v; }), - i.d(t, "z", function() { - return v + i.d(t, "i", function () { + return y; }), - i.d(t, "i", function() { - return y + i.d(t, "s", function () { + return n; }), - i.d(t, "s", function() { - return n + i.d(t, "c", function () { + return E; }), - i.d(t, "c", function() { - return E + i.d(t, "d", function () { + return T; }), - i.d(t, "d", function() { - return T + i.d(t, "k", function () { + return b; }), - i.d(t, "k", function() { - return b + i.d(t, "a", function () { + return A; }), - i.d(t, "a", function() { - return A + i.d(t, "b", function () { + return x; }), - i.d(t, "b", function() { - return x + i.d(t, "l", function () { + return S; }), - i.d(t, "l", function() { - return S + i.d(t, "m", function () { + return C; }), - i.d(t, "m", function() { - return C + i.d(t, "g", function () { + return P; }), - i.d(t, "g", function() { - return P + i.d(t, "p", function () { + return R; }), - i.d(t, "p", function() { - return R + i.d(t, "o", function () { + return M; }), - i.d(t, "o", function() { - return M - }), - i.d(t, "t", function() { - return O + i.d(t, "t", function () { + return O; }); - var n, r = i(34), o = i(12), a = 1 / 2.2, s = 2.2, c = .001, u = function() { - function e(e, t, i) { - void 0 === e && (e = 0), - void 0 === t && (t = 0), - void 0 === i && (i = 0), - this.r = e, - this.g = t, - this.b = i - } - return e.prototype.toString = function() { - return "{R: " + this.r + " G:" + this.g + " B:" + this.b + "}" - } - , - e.prototype.getClassName = function() { - return "Color3" - } - , - e.prototype.getHashCode = function() { - var e = this.r || 0; - return 397 * (e = 397 * e ^ (this.g || 0)) ^ (this.b || 0) - } - , - e.prototype.toArray = function(e, t) { - return void 0 === t && (t = 0), - e[t] = this.r, - e[t + 1] = this.g, - e[t + 2] = this.b, - this - } - , - e.prototype.toColor4 = function(e) { - return void 0 === e && (e = 1), - new l(this.r,this.g,this.b,e) - } - , - e.prototype.asArray = function() { - var e = new Array; - return this.toArray(e, 0), - e - } - , - e.prototype.toLuminance = function() { - return .3 * this.r + .59 * this.g + .11 * this.b - } - , - e.prototype.multiply = function(t) { - return new e(this.r * t.r,this.g * t.g,this.b * t.b) - } - , - e.prototype.multiplyToRef = function(e, t) { - return t.r = this.r * e.r, - t.g = this.g * e.g, - t.b = this.b * e.b, - this - } - , - e.prototype.equals = function(e) { - return e && this.r === e.r && this.g === e.g && this.b === e.b - } - , - e.prototype.equalsFloats = function(e, t, i) { - return this.r === e && this.g === t && this.b === i - } - , - e.prototype.scale = function(t) { - return new e(this.r * t,this.g * t,this.b * t) - } - , - e.prototype.scaleToRef = function(e, t) { - return t.r = this.r * e, - t.g = this.g * e, - t.b = this.b * e, - this - } - , - e.prototype.scaleAndAddToRef = function(e, t) { - return t.r += this.r * e, - t.g += this.g * e, - t.b += this.b * e, - this - } - , - e.prototype.clampToRef = function(e, t, i) { - return void 0 === e && (e = 0), - void 0 === t && (t = 1), - i.r = o.a.Clamp(this.r, e, t), - i.g = o.a.Clamp(this.g, e, t), - i.b = o.a.Clamp(this.b, e, t), - this - } - , - e.prototype.add = function(t) { - return new e(this.r + t.r,this.g + t.g,this.b + t.b) - } - , - e.prototype.addToRef = function(e, t) { - return t.r = this.r + e.r, - t.g = this.g + e.g, - t.b = this.b + e.b, - this - } - , - e.prototype.subtract = function(t) { - return new e(this.r - t.r,this.g - t.g,this.b - t.b) - } - , - e.prototype.subtractToRef = function(e, t) { - return t.r = this.r - e.r, - t.g = this.g - e.g, - t.b = this.b - e.b, - this - } - , - e.prototype.clone = function() { - return new e(this.r,this.g,this.b) - } - , - e.prototype.copyFrom = function(e) { - return this.r = e.r, - this.g = e.g, - this.b = e.b, - this - } - , - e.prototype.copyFromFloats = function(e, t, i) { - return this.r = e, - this.g = t, - this.b = i, - this - } - , - e.prototype.set = function(e, t, i) { - return this.copyFromFloats(e, t, i) - } - , - e.prototype.toHexString = function() { - var e = 255 * this.r | 0 - , t = 255 * this.g | 0 - , i = 255 * this.b | 0; - return "#" + o.a.ToHex(e) + o.a.ToHex(t) + o.a.ToHex(i) - } - , - e.prototype.toLinearSpace = function() { - var t = new e; - return this.toLinearSpaceToRef(t), - t - } - , - e.prototype.toLinearSpaceToRef = function(e) { - return e.r = Math.pow(this.r, s), - e.g = Math.pow(this.g, s), - e.b = Math.pow(this.b, s), - this - } - , - e.prototype.toGammaSpace = function() { - var t = new e; - return this.toGammaSpaceToRef(t), - t - } - , - e.prototype.toGammaSpaceToRef = function(e) { - return e.r = Math.pow(this.r, a), - e.g = Math.pow(this.g, a), - e.b = Math.pow(this.b, a), - this - } - , - e.FromHexString = function(t) { - if ("#" !== t.substring(0, 1) || 7 !== t.length) - return new e(0,0,0); - var i = parseInt(t.substring(1, 3), 16) - , n = parseInt(t.substring(3, 5), 16) - , r = parseInt(t.substring(5, 7), 16); - return e.FromInts(i, n, r) - } - , - e.FromArray = function(t, i) { - return void 0 === i && (i = 0), - new e(t[i],t[i + 1],t[i + 2]) - } - , - e.FromInts = function(t, i, n) { - return new e(t / 255,i / 255,n / 255) - } - , - e.Lerp = function(t, i, n) { - var r = new e(0,0,0); - return e.LerpToRef(t, i, n, r), - r - } - , - e.LerpToRef = function(e, t, i, n) { - n.r = e.r + (t.r - e.r) * i, - n.g = e.g + (t.g - e.g) * i, - n.b = e.b + (t.b - e.b) * i - } - , - e.Red = function() { - return new e(1,0,0) - } - , - e.Green = function() { - return new e(0,1,0) - } - , - e.Blue = function() { - return new e(0,0,1) - } - , - e.Black = function() { - return new e(0,0,0) - } - , - Object.defineProperty(e, "BlackReadOnly", { - get: function() { - return e._BlackReadOnly - }, - enumerable: true, - configurable: true + var n, + r = i(34), + o = i(12), + a = 1 / 2.2, + s = 2.2, + c = 0.001, + u = (function () { + function e(e, t, i) { + void 0 === e && (e = 0), + void 0 === t && (t = 0), + void 0 === i && (i = 0), + (this.r = e), + (this.g = t), + (this.b = i); + } + return ( + (e.prototype.toString = function () { + return ( + "{R: " + this.r + " G:" + this.g + " B:" + this.b + "}" + ); }), - e.White = function() { - return new e(1,1,1) - } - , - e.Purple = function() { - return new e(.5,0,.5) - } - , - e.Magenta = function() { - return new e(1,0,1) - } - , - e.Yellow = function() { - return new e(1,1,0) - } - , - e.Gray = function() { - return new e(.5,.5,.5) - } - , - e.Teal = function() { - return new e(0,1,1) - } - , - e.Random = function() { - return new e(Math.random(),Math.random(),Math.random()) - } - , - e._BlackReadOnly = e.Black(), - e - }(), l = function() { - function e(e, t, i, n) { - void 0 === e && (e = 0), + (e.prototype.getClassName = function () { + return "Color3"; + }), + (e.prototype.getHashCode = function () { + var e = this.r || 0; + return ( + (397 * (e = (397 * e) ^ (this.g || 0))) ^ (this.b || 0) + ); + }), + (e.prototype.toArray = function (e, t) { + return ( void 0 === t && (t = 0), - void 0 === i && (i = 0), - void 0 === n && (n = 1), - this.r = e, - this.g = t, - this.b = i, - this.a = n - } - return e.prototype.addInPlace = function(e) { - return this.r += e.r, - this.g += e.g, - this.b += e.b, - this.a += e.a, + (e[t] = this.r), + (e[t + 1] = this.g), + (e[t + 2] = this.b), this - } - , - e.prototype.asArray = function() { - var e = new Array; - return this.toArray(e, 0), - e - } - , - e.prototype.toArray = function(e, t) { - return void 0 === t && (t = 0), - e[t] = this.r, - e[t + 1] = this.g, - e[t + 2] = this.b, - e[t + 3] = this.a, + ); + }), + (e.prototype.toColor4 = function (e) { + return ( + void 0 === e && (e = 1), + new l(this.r, this.g, this.b, e) + ); + }), + (e.prototype.asArray = function () { + var e = new Array(); + return this.toArray(e, 0), e; + }), + (e.prototype.toLuminance = function () { + return 0.3 * this.r + 0.59 * this.g + 0.11 * this.b; + }), + (e.prototype.multiply = function (t) { + return new e(this.r * t.r, this.g * t.g, this.b * t.b); + }), + (e.prototype.multiplyToRef = function (e, t) { + return ( + (t.r = this.r * e.r), + (t.g = this.g * e.g), + (t.b = this.b * e.b), this - } - , - e.prototype.equals = function(e) { - return e && this.r === e.r && this.g === e.g && this.b === e.b && this.a === e.a - } - , - e.prototype.add = function(t) { - return new e(this.r + t.r,this.g + t.g,this.b + t.b,this.a + t.a) - } - , - e.prototype.subtract = function(t) { - return new e(this.r - t.r,this.g - t.g,this.b - t.b,this.a - t.a) - } - , - e.prototype.subtractToRef = function(e, t) { - return t.r = this.r - e.r, - t.g = this.g - e.g, - t.b = this.b - e.b, - t.a = this.a - e.a, + ); + }), + (e.prototype.equals = function (e) { + return ( + e && this.r === e.r && this.g === e.g && this.b === e.b + ); + }), + (e.prototype.equalsFloats = function (e, t, i) { + return this.r === e && this.g === t && this.b === i; + }), + (e.prototype.scale = function (t) { + return new e(this.r * t, this.g * t, this.b * t); + }), + (e.prototype.scaleToRef = function (e, t) { + return ( + (t.r = this.r * e), + (t.g = this.g * e), + (t.b = this.b * e), this - } - , - e.prototype.scale = function(t) { - return new e(this.r * t,this.g * t,this.b * t,this.a * t) - } - , - e.prototype.scaleToRef = function(e, t) { - return t.r = this.r * e, - t.g = this.g * e, - t.b = this.b * e, - t.a = this.a * e, + ); + }), + (e.prototype.scaleAndAddToRef = function (e, t) { + return ( + (t.r += this.r * e), + (t.g += this.g * e), + (t.b += this.b * e), this - } - , - e.prototype.scaleAndAddToRef = function(e, t) { - return t.r += this.r * e, - t.g += this.g * e, - t.b += this.b * e, - t.a += this.a * e, - this - } - , - e.prototype.clampToRef = function(e, t, i) { - return void 0 === e && (e = 0), + ); + }), + (e.prototype.clampToRef = function (e, t, i) { + return ( + void 0 === e && (e = 0), void 0 === t && (t = 1), - i.r = o.a.Clamp(this.r, e, t), - i.g = o.a.Clamp(this.g, e, t), - i.b = o.a.Clamp(this.b, e, t), - i.a = o.a.Clamp(this.a, e, t), + (i.r = o.a.Clamp(this.r, e, t)), + (i.g = o.a.Clamp(this.g, e, t)), + (i.b = o.a.Clamp(this.b, e, t)), this - } - , - e.prototype.multiply = function(t) { - return new e(this.r * t.r,this.g * t.g,this.b * t.b,this.a * t.a) - } - , - e.prototype.multiplyToRef = function(e, t) { - return t.r = this.r * e.r, - t.g = this.g * e.g, - t.b = this.b * e.b, - t.a = this.a * e.a, - t - } - , - e.prototype.toString = function() { - return "{R: " + this.r + " G:" + this.g + " B:" + this.b + " A:" + this.a + "}" - } - , - e.prototype.getClassName = function() { - return "Color4" - } - , - e.prototype.getHashCode = function() { - var e = this.r || 0; - return 397 * (e = 397 * (e = 397 * e ^ (this.g || 0)) ^ (this.b || 0)) ^ (this.a || 0) - } - , - e.prototype.clone = function() { - return new e(this.r,this.g,this.b,this.a) - } - , - e.prototype.copyFrom = function(e) { - return this.r = e.r, - this.g = e.g, - this.b = e.b, - this.a = e.a, + ); + }), + (e.prototype.add = function (t) { + return new e(this.r + t.r, this.g + t.g, this.b + t.b); + }), + (e.prototype.addToRef = function (e, t) { + return ( + (t.r = this.r + e.r), + (t.g = this.g + e.g), + (t.b = this.b + e.b), this - } - , - e.prototype.copyFromFloats = function(e, t, i, n) { - return this.r = e, - this.g = t, - this.b = i, - this.a = n, + ); + }), + (e.prototype.subtract = function (t) { + return new e(this.r - t.r, this.g - t.g, this.b - t.b); + }), + (e.prototype.subtractToRef = function (e, t) { + return ( + (t.r = this.r - e.r), + (t.g = this.g - e.g), + (t.b = this.b - e.b), this - } - , - e.prototype.set = function(e, t, i, n) { - return this.copyFromFloats(e, t, i, n) - } - , - e.prototype.toHexString = function() { - var e = 255 * this.r | 0 - , t = 255 * this.g | 0 - , i = 255 * this.b | 0 - , n = 255 * this.a | 0; - return "#" + o.a.ToHex(e) + o.a.ToHex(t) + o.a.ToHex(i) + o.a.ToHex(n) - } - , - e.prototype.toLinearSpace = function() { - var t = new e; - return this.toLinearSpaceToRef(t), - t - } - , - e.prototype.toLinearSpaceToRef = function(e) { - return e.r = Math.pow(this.r, s), - e.g = Math.pow(this.g, s), - e.b = Math.pow(this.b, s), - e.a = this.a, + ); + }), + (e.prototype.clone = function () { + return new e(this.r, this.g, this.b); + }), + (e.prototype.copyFrom = function (e) { + return ( + (this.r = e.r), (this.g = e.g), (this.b = e.b), this + ); + }), + (e.prototype.copyFromFloats = function (e, t, i) { + return (this.r = e), (this.g = t), (this.b = i), this; + }), + (e.prototype.set = function (e, t, i) { + return this.copyFromFloats(e, t, i); + }), + (e.prototype.toHexString = function () { + var e = (255 * this.r) | 0, + t = (255 * this.g) | 0, + i = (255 * this.b) | 0; + return "#" + o.a.ToHex(e) + o.a.ToHex(t) + o.a.ToHex(i); + }), + (e.prototype.toLinearSpace = function () { + var t = new e(); + return this.toLinearSpaceToRef(t), t; + }), + (e.prototype.toLinearSpaceToRef = function (e) { + return ( + (e.r = Math.pow(this.r, s)), + (e.g = Math.pow(this.g, s)), + (e.b = Math.pow(this.b, s)), this - } - , - e.prototype.toGammaSpace = function() { - var t = new e; - return this.toGammaSpaceToRef(t), - t - } - , - e.prototype.toGammaSpaceToRef = function(e) { - return e.r = Math.pow(this.r, a), - e.g = Math.pow(this.g, a), - e.b = Math.pow(this.b, a), - e.a = this.a, + ); + }), + (e.prototype.toGammaSpace = function () { + var t = new e(); + return this.toGammaSpaceToRef(t), t; + }), + (e.prototype.toGammaSpaceToRef = function (e) { + return ( + (e.r = Math.pow(this.r, a)), + (e.g = Math.pow(this.g, a)), + (e.b = Math.pow(this.b, a)), this - } - , - e.FromHexString = function(t) { - if ("#" !== t.substring(0, 1) || 9 !== t.length) - return new e(0,0,0,0); - var i = parseInt(t.substring(1, 3), 16) - , n = parseInt(t.substring(3, 5), 16) - , r = parseInt(t.substring(5, 7), 16) - , o = parseInt(t.substring(7, 9), 16); - return e.FromInts(i, n, r, o) - } - , - e.Lerp = function(t, i, n) { - var r = new e(0,0,0,0); - return e.LerpToRef(t, i, n, r), - r - } - , - e.LerpToRef = function(e, t, i, n) { - n.r = e.r + (t.r - e.r) * i, - n.g = e.g + (t.g - e.g) * i, - n.b = e.b + (t.b - e.b) * i, - n.a = e.a + (t.a - e.a) * i - } - , - e.FromColor3 = function(t, i) { - return void 0 === i && (i = 1), - new e(t.r,t.g,t.b,i) - } - , - e.FromArray = function(t, i) { - return void 0 === i && (i = 0), - new e(t[i],t[i + 1],t[i + 2],t[i + 3]) - } - , - e.FromInts = function(t, i, n, r) { - return new e(t / 255,i / 255,n / 255,r / 255) - } - , - e.CheckColors4 = function(e, t) { - if (e.length === 3 * t) { - for (var i = [], n = 0; n < e.length; n += 3) { - var r = n / 3 * 4; - i[r] = e[n], - i[r + 1] = e[n + 1], - i[r + 2] = e[n + 2], - i[r + 3] = 1 - } - return i - } - return e - } - , + ); + }), + (e.FromHexString = function (t) { + if ("#" !== t.substring(0, 1) || 7 !== t.length) + return new e(0, 0, 0); + var i = parseInt(t.substring(1, 3), 16), + n = parseInt(t.substring(3, 5), 16), + r = parseInt(t.substring(5, 7), 16); + return e.FromInts(i, n, r); + }), + (e.FromArray = function (t, i) { + return ( + void 0 === i && (i = 0), new e(t[i], t[i + 1], t[i + 2]) + ); + }), + (e.FromInts = function (t, i, n) { + return new e(t / 255, i / 255, n / 255); + }), + (e.Lerp = function (t, i, n) { + var r = new e(0, 0, 0); + return e.LerpToRef(t, i, n, r), r; + }), + (e.LerpToRef = function (e, t, i, n) { + (n.r = e.r + (t.r - e.r) * i), + (n.g = e.g + (t.g - e.g) * i), + (n.b = e.b + (t.b - e.b) * i); + }), + (e.Red = function () { + return new e(1, 0, 0); + }), + (e.Green = function () { + return new e(0, 1, 0); + }), + (e.Blue = function () { + return new e(0, 0, 1); + }), + (e.Black = function () { + return new e(0, 0, 0); + }), + Object.defineProperty(e, "BlackReadOnly", { + get: function () { + return e._BlackReadOnly; + }, + enumerable: true, + configurable: true, + }), + (e.White = function () { + return new e(1, 1, 1); + }), + (e.Purple = function () { + return new e(0.5, 0, 0.5); + }), + (e.Magenta = function () { + return new e(1, 0, 1); + }), + (e.Yellow = function () { + return new e(1, 1, 0); + }), + (e.Gray = function () { + return new e(0.5, 0.5, 0.5); + }), + (e.Teal = function () { + return new e(0, 1, 1); + }), + (e.Random = function () { + return new e(Math.random(), Math.random(), Math.random()); + }), + (e._BlackReadOnly = e.Black()), e - }(), h = function() { - function e(e, t) { - void 0 === e && (e = 0), + ); + })(), + l = (function () { + function e(e, t, i, n) { + void 0 === e && (e = 0), + void 0 === t && (t = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 1), + (this.r = e), + (this.g = t), + (this.b = i), + (this.a = n); + } + return ( + (e.prototype.addInPlace = function (e) { + return ( + (this.r += e.r), + (this.g += e.g), + (this.b += e.b), + (this.a += e.a), + this + ); + }), + (e.prototype.asArray = function () { + var e = new Array(); + return this.toArray(e, 0), e; + }), + (e.prototype.toArray = function (e, t) { + return ( void 0 === t && (t = 0), - this.x = e, - this.y = t - } - return e.prototype.toString = function() { - return "{X: " + this.x + " Y:" + this.y + "}" - } - , - e.prototype.getClassName = function() { - return "Vector2" - } - , - e.prototype.getHashCode = function() { - var e = this.x || 0; - return 397 * e ^ (this.y || 0) - } - , - e.prototype.toArray = function(e, t) { - return void 0 === t && (t = 0), - e[t] = this.x, - e[t + 1] = this.y, + (e[t] = this.r), + (e[t + 1] = this.g), + (e[t + 2] = this.b), + (e[t + 3] = this.a), this - } - , - e.prototype.asArray = function() { - var e = new Array; - return this.toArray(e, 0), - e - } - , - e.prototype.copyFrom = function(e) { - return this.x = e.x, - this.y = e.y, + ); + }), + (e.prototype.equals = function (e) { + return ( + e && + this.r === e.r && + this.g === e.g && + this.b === e.b && + this.a === e.a + ); + }), + (e.prototype.add = function (t) { + return new e( + this.r + t.r, + this.g + t.g, + this.b + t.b, + this.a + t.a + ); + }), + (e.prototype.subtract = function (t) { + return new e( + this.r - t.r, + this.g - t.g, + this.b - t.b, + this.a - t.a + ); + }), + (e.prototype.subtractToRef = function (e, t) { + return ( + (t.r = this.r - e.r), + (t.g = this.g - e.g), + (t.b = this.b - e.b), + (t.a = this.a - e.a), this - } - , - e.prototype.copyFromFloats = function(e, t) { - return this.x = e, - this.y = t, + ); + }), + (e.prototype.scale = function (t) { + return new e( + this.r * t, + this.g * t, + this.b * t, + this.a * t + ); + }), + (e.prototype.scaleToRef = function (e, t) { + return ( + (t.r = this.r * e), + (t.g = this.g * e), + (t.b = this.b * e), + (t.a = this.a * e), this - } - , - e.prototype.set = function(e, t) { - return this.copyFromFloats(e, t) - } - , - e.prototype.add = function(t) { - return new e(this.x + t.x,this.y + t.y) - } - , - e.prototype.addToRef = function(e, t) { - return t.x = this.x + e.x, - t.y = this.y + e.y, + ); + }), + (e.prototype.scaleAndAddToRef = function (e, t) { + return ( + (t.r += this.r * e), + (t.g += this.g * e), + (t.b += this.b * e), + (t.a += this.a * e), this - } - , - e.prototype.addInPlace = function(e) { - return this.x += e.x, - this.y += e.y, + ); + }), + (e.prototype.clampToRef = function (e, t, i) { + return ( + void 0 === e && (e = 0), + void 0 === t && (t = 1), + (i.r = o.a.Clamp(this.r, e, t)), + (i.g = o.a.Clamp(this.g, e, t)), + (i.b = o.a.Clamp(this.b, e, t)), + (i.a = o.a.Clamp(this.a, e, t)), this - } - , - e.prototype.addVector3 = function(t) { - return new e(this.x + t.x,this.y + t.y) - } - , - e.prototype.subtract = function(t) { - return new e(this.x - t.x,this.y - t.y) - } - , - e.prototype.subtractToRef = function(e, t) { - return t.x = this.x - e.x, - t.y = this.y - e.y, - this - } - , - e.prototype.subtractInPlace = function(e) { - return this.x -= e.x, - this.y -= e.y, - this - } - , - e.prototype.multiplyInPlace = function(e) { - return this.x *= e.x, - this.y *= e.y, - this - } - , - e.prototype.multiply = function(t) { - return new e(this.x * t.x,this.y * t.y) - } - , - e.prototype.multiplyToRef = function(e, t) { - return t.x = this.x * e.x, - t.y = this.y * e.y, - this - } - , - e.prototype.multiplyByFloats = function(t, i) { - return new e(this.x * t,this.y * i) - } - , - e.prototype.divide = function(t) { - return new e(this.x / t.x,this.y / t.y) - } - , - e.prototype.divideToRef = function(e, t) { - return t.x = this.x / e.x, - t.y = this.y / e.y, - this - } - , - e.prototype.divideInPlace = function(e) { - return this.divideToRef(e, this) - } - , - e.prototype.negate = function() { - return new e(-this.x,-this.y) - } - , - e.prototype.scaleInPlace = function(e) { - return this.x *= e, - this.y *= e, - this - } - , - e.prototype.scale = function(t) { - var i = new e(0,0); - return this.scaleToRef(t, i), - i - } - , - e.prototype.scaleToRef = function(e, t) { - return t.x = this.x * e, - t.y = this.y * e, - this - } - , - e.prototype.scaleAndAddToRef = function(e, t) { - return t.x += this.x * e, - t.y += this.y * e, - this - } - , - e.prototype.equals = function(e) { - return e && this.x === e.x && this.y === e.y - } - , - e.prototype.equalsWithEpsilon = function(e, t) { - return void 0 === t && (t = c), - e && o.a.WithinEpsilon(this.x, e.x, t) && o.a.WithinEpsilon(this.y, e.y, t) - } - , - e.prototype.floor = function() { - return new e(Math.floor(this.x),Math.floor(this.y)) - } - , - e.prototype.fract = function() { - return new e(this.x - Math.floor(this.x),this.y - Math.floor(this.y)) - } - , - e.prototype.length = function() { - return Math.sqrt(this.x * this.x + this.y * this.y) - } - , - e.prototype.lengthSquared = function() { - return this.x * this.x + this.y * this.y - } - , - e.prototype.normalize = function() { - var e = this.length(); - if (0 === e) - return this; - var t = 1 / e; - return this.x *= t, - this.y *= t, - this - } - , - e.prototype.clone = function() { - return new e(this.x,this.y) - } - , - e.Zero = function() { - return new e(0,0) - } - , - e.One = function() { - return new e(1,1) - } - , - e.FromArray = function(t, i) { - return void 0 === i && (i = 0), - new e(t[i],t[i + 1]) - } - , - e.FromArrayToRef = function(e, t, i) { - i.x = e[t], - i.y = e[t + 1] - } - , - e.CatmullRom = function(t, i, n, r, o) { - var a = o * o - , s = o * a; - return new e(.5 * (2 * i.x + (-t.x + n.x) * o + (2 * t.x - 5 * i.x + 4 * n.x - r.x) * a + (-t.x + 3 * i.x - 3 * n.x + r.x) * s),.5 * (2 * i.y + (-t.y + n.y) * o + (2 * t.y - 5 * i.y + 4 * n.y - r.y) * a + (-t.y + 3 * i.y - 3 * n.y + r.y) * s)) - } - , - e.Clamp = function(t, i, n) { - var r = t.x; - r = (r = r > n.x ? n.x : r) < i.x ? i.x : r; - var o = t.y; - return new e(r,o = (o = o > n.y ? n.y : o) < i.y ? i.y : o) - } - , - e.Hermite = function(t, i, n, r, o) { - var a = o * o - , s = o * a - , c = 2 * s - 3 * a + 1 - , u = -2 * s + 3 * a - , l = s - 2 * a + o - , h = s - a; - return new e(t.x * c + n.x * u + i.x * l + r.x * h,t.y * c + n.y * u + i.y * l + r.y * h) - } - , - e.Lerp = function(t, i, n) { - return new e(t.x + (i.x - t.x) * n,t.y + (i.y - t.y) * n) - } - , - e.Dot = function(e, t) { - return e.x * t.x + e.y * t.y - } - , - e.Normalize = function(e) { - var t = e.clone(); - return t.normalize(), + ); + }), + (e.prototype.multiply = function (t) { + return new e( + this.r * t.r, + this.g * t.g, + this.b * t.b, + this.a * t.a + ); + }), + (e.prototype.multiplyToRef = function (e, t) { + return ( + (t.r = this.r * e.r), + (t.g = this.g * e.g), + (t.b = this.b * e.b), + (t.a = this.a * e.a), t - } - , - e.Minimize = function(t, i) { - return new e(t.x < i.x ? t.x : i.x,t.y < i.y ? t.y : i.y) - } - , - e.Maximize = function(t, i) { - return new e(t.x > i.x ? t.x : i.x,t.y > i.y ? t.y : i.y) - } - , - e.Transform = function(t, i) { - var n = e.Zero(); - return e.TransformToRef(t, i, n), - n - } - , - e.TransformToRef = function(e, t, i) { - var n = t.m - , r = e.x * n[0] + e.y * n[4] + n[12] - , o = e.x * n[1] + e.y * n[5] + n[13]; - i.x = r, - i.y = o - } - , - e.PointInTriangle = function(e, t, i, n) { - var r = .5 * (-i.y * n.x + t.y * (-i.x + n.x) + t.x * (i.y - n.y) + i.x * n.y) - , o = r < 0 ? -1 : 1 - , a = (t.y * n.x - t.x * n.y + (n.y - t.y) * e.x + (t.x - n.x) * e.y) * o - , s = (t.x * i.y - t.y * i.x + (t.y - i.y) * e.x + (i.x - t.x) * e.y) * o; - return a > 0 && s > 0 && a + s < 2 * r * o - } - , - e.Distance = function(t, i) { - return Math.sqrt(e.DistanceSquared(t, i)) - } - , - e.DistanceSquared = function(e, t) { - var i = e.x - t.x - , n = e.y - t.y; - return i * i + n * n - } - , - e.Center = function(e, t) { - var i = e.add(t); - return i.scaleInPlace(.5), - i - } - , - e.DistanceOfPointFromSegment = function(t, i, n) { - var r = e.DistanceSquared(i, n); - if (0 === r) - return e.Distance(t, i); - var o = n.subtract(i) - , a = Math.max(0, Math.min(1, e.Dot(t.subtract(i), o) / r)) - , s = i.add(o.multiplyByFloats(a, a)); - return e.Distance(t, s) - } - , - e - }(), f = function() { - function e(e, t, i) { - void 0 === e && (e = 0), - void 0 === t && (t = 0), + ); + }), + (e.prototype.toString = function () { + return ( + "{R: " + + this.r + + " G:" + + this.g + + " B:" + + this.b + + " A:" + + this.a + + "}" + ); + }), + (e.prototype.getClassName = function () { + return "Color4"; + }), + (e.prototype.getHashCode = function () { + var e = this.r || 0; + return ( + (397 * + (e = + (397 * (e = (397 * e) ^ (this.g || 0))) ^ + (this.b || 0))) ^ + (this.a || 0) + ); + }), + (e.prototype.clone = function () { + return new e(this.r, this.g, this.b, this.a); + }), + (e.prototype.copyFrom = function (e) { + return ( + (this.r = e.r), + (this.g = e.g), + (this.b = e.b), + (this.a = e.a), + this + ); + }), + (e.prototype.copyFromFloats = function (e, t, i, n) { + return ( + (this.r = e), + (this.g = t), + (this.b = i), + (this.a = n), + this + ); + }), + (e.prototype.set = function (e, t, i, n) { + return this.copyFromFloats(e, t, i, n); + }), + (e.prototype.toHexString = function () { + var e = (255 * this.r) | 0, + t = (255 * this.g) | 0, + i = (255 * this.b) | 0, + n = (255 * this.a) | 0; + return ( + "#" + + o.a.ToHex(e) + + o.a.ToHex(t) + + o.a.ToHex(i) + + o.a.ToHex(n) + ); + }), + (e.prototype.toLinearSpace = function () { + var t = new e(); + return this.toLinearSpaceToRef(t), t; + }), + (e.prototype.toLinearSpaceToRef = function (e) { + return ( + (e.r = Math.pow(this.r, s)), + (e.g = Math.pow(this.g, s)), + (e.b = Math.pow(this.b, s)), + (e.a = this.a), + this + ); + }), + (e.prototype.toGammaSpace = function () { + var t = new e(); + return this.toGammaSpaceToRef(t), t; + }), + (e.prototype.toGammaSpaceToRef = function (e) { + return ( + (e.r = Math.pow(this.r, a)), + (e.g = Math.pow(this.g, a)), + (e.b = Math.pow(this.b, a)), + (e.a = this.a), + this + ); + }), + (e.FromHexString = function (t) { + if ("#" !== t.substring(0, 1) || 9 !== t.length) + return new e(0, 0, 0, 0); + var i = parseInt(t.substring(1, 3), 16), + n = parseInt(t.substring(3, 5), 16), + r = parseInt(t.substring(5, 7), 16), + o = parseInt(t.substring(7, 9), 16); + return e.FromInts(i, n, r, o); + }), + (e.Lerp = function (t, i, n) { + var r = new e(0, 0, 0, 0); + return e.LerpToRef(t, i, n, r), r; + }), + (e.LerpToRef = function (e, t, i, n) { + (n.r = e.r + (t.r - e.r) * i), + (n.g = e.g + (t.g - e.g) * i), + (n.b = e.b + (t.b - e.b) * i), + (n.a = e.a + (t.a - e.a) * i); + }), + (e.FromColor3 = function (t, i) { + return void 0 === i && (i = 1), new e(t.r, t.g, t.b, i); + }), + (e.FromArray = function (t, i) { + return ( void 0 === i && (i = 0), - this.x = e, - this.y = t, - this.z = i - } - return e.prototype.toString = function() { - return "{X: " + this.x + " Y:" + this.y + " Z:" + this.z + "}" - } - , - e.prototype.getClassName = function() { - return "Vector3" - } - , - e.prototype.getHashCode = function() { - var e = this.x || 0; - return 397 * (e = 397 * e ^ (this.y || 0)) ^ (this.z || 0) - } - , - e.prototype.asArray = function() { - var e = []; - return this.toArray(e, 0), - e - } - , - e.prototype.toArray = function(e, t) { - return void 0 === t && (t = 0), - e[t] = this.x, - e[t + 1] = this.y, - e[t + 2] = this.z, + new e(t[i], t[i + 1], t[i + 2], t[i + 3]) + ); + }), + (e.FromInts = function (t, i, n, r) { + return new e(t / 255, i / 255, n / 255, r / 255); + }), + (e.CheckColors4 = function (e, t) { + if (e.length === 3 * t) { + for (var i = [], n = 0; n < e.length; n += 3) { + var r = (n / 3) * 4; + (i[r] = e[n]), + (i[r + 1] = e[n + 1]), + (i[r + 2] = e[n + 2]), + (i[r + 3] = 1); + } + return i; + } + return e; + }), + e + ); + })(), + h = (function () { + function e(e, t) { + void 0 === e && (e = 0), + void 0 === t && (t = 0), + (this.x = e), + (this.y = t); + } + return ( + (e.prototype.toString = function () { + return "{X: " + this.x + " Y:" + this.y + "}"; + }), + (e.prototype.getClassName = function () { + return "Vector2"; + }), + (e.prototype.getHashCode = function () { + var e = this.x || 0; + return (397 * e) ^ (this.y || 0); + }), + (e.prototype.toArray = function (e, t) { + return ( + void 0 === t && (t = 0), + (e[t] = this.x), + (e[t + 1] = this.y), this - } - , - e.prototype.toQuaternion = function() { - return m.RotationYawPitchRoll(this.y, this.x, this.z) - } - , - e.prototype.addInPlace = function(e) { - return this.addInPlaceFromFloats(e.x, e.y, e.z) - } - , - e.prototype.addInPlaceFromFloats = function(e, t, i) { - return this.x += e, - this.y += t, - this.z += i, + ); + }), + (e.prototype.asArray = function () { + var e = new Array(); + return this.toArray(e, 0), e; + }), + (e.prototype.copyFrom = function (e) { + return (this.x = e.x), (this.y = e.y), this; + }), + (e.prototype.copyFromFloats = function (e, t) { + return (this.x = e), (this.y = t), this; + }), + (e.prototype.set = function (e, t) { + return this.copyFromFloats(e, t); + }), + (e.prototype.add = function (t) { + return new e(this.x + t.x, this.y + t.y); + }), + (e.prototype.addToRef = function (e, t) { + return (t.x = this.x + e.x), (t.y = this.y + e.y), this; + }), + (e.prototype.addInPlace = function (e) { + return (this.x += e.x), (this.y += e.y), this; + }), + (e.prototype.addVector3 = function (t) { + return new e(this.x + t.x, this.y + t.y); + }), + (e.prototype.subtract = function (t) { + return new e(this.x - t.x, this.y - t.y); + }), + (e.prototype.subtractToRef = function (e, t) { + return (t.x = this.x - e.x), (t.y = this.y - e.y), this; + }), + (e.prototype.subtractInPlace = function (e) { + return (this.x -= e.x), (this.y -= e.y), this; + }), + (e.prototype.multiplyInPlace = function (e) { + return (this.x *= e.x), (this.y *= e.y), this; + }), + (e.prototype.multiply = function (t) { + return new e(this.x * t.x, this.y * t.y); + }), + (e.prototype.multiplyToRef = function (e, t) { + return (t.x = this.x * e.x), (t.y = this.y * e.y), this; + }), + (e.prototype.multiplyByFloats = function (t, i) { + return new e(this.x * t, this.y * i); + }), + (e.prototype.divide = function (t) { + return new e(this.x / t.x, this.y / t.y); + }), + (e.prototype.divideToRef = function (e, t) { + return (t.x = this.x / e.x), (t.y = this.y / e.y), this; + }), + (e.prototype.divideInPlace = function (e) { + return this.divideToRef(e, this); + }), + (e.prototype.negate = function () { + return new e(-this.x, -this.y); + }), + (e.prototype.scaleInPlace = function (e) { + return (this.x *= e), (this.y *= e), this; + }), + (e.prototype.scale = function (t) { + var i = new e(0, 0); + return this.scaleToRef(t, i), i; + }), + (e.prototype.scaleToRef = function (e, t) { + return (t.x = this.x * e), (t.y = this.y * e), this; + }), + (e.prototype.scaleAndAddToRef = function (e, t) { + return (t.x += this.x * e), (t.y += this.y * e), this; + }), + (e.prototype.equals = function (e) { + return e && this.x === e.x && this.y === e.y; + }), + (e.prototype.equalsWithEpsilon = function (e, t) { + return ( + void 0 === t && (t = c), + e && + o.a.WithinEpsilon(this.x, e.x, t) && + o.a.WithinEpsilon(this.y, e.y, t) + ); + }), + (e.prototype.floor = function () { + return new e(Math.floor(this.x), Math.floor(this.y)); + }), + (e.prototype.fract = function () { + return new e( + this.x - Math.floor(this.x), + this.y - Math.floor(this.y) + ); + }), + (e.prototype.length = function () { + return Math.sqrt(this.x * this.x + this.y * this.y); + }), + (e.prototype.lengthSquared = function () { + return this.x * this.x + this.y * this.y; + }), + (e.prototype.normalize = function () { + var e = this.length(); + if (0 === e) return this; + var t = 1 / e; + return (this.x *= t), (this.y *= t), this; + }), + (e.prototype.clone = function () { + return new e(this.x, this.y); + }), + (e.Zero = function () { + return new e(0, 0); + }), + (e.One = function () { + return new e(1, 1); + }), + (e.FromArray = function (t, i) { + return void 0 === i && (i = 0), new e(t[i], t[i + 1]); + }), + (e.FromArrayToRef = function (e, t, i) { + (i.x = e[t]), (i.y = e[t + 1]); + }), + (e.CatmullRom = function (t, i, n, r, o) { + var a = o * o, + s = o * a; + return new e( + 0.5 * + (2 * i.x + + (-t.x + n.x) * o + + (2 * t.x - 5 * i.x + 4 * n.x - r.x) * a + + (-t.x + 3 * i.x - 3 * n.x + r.x) * s), + 0.5 * + (2 * i.y + + (-t.y + n.y) * o + + (2 * t.y - 5 * i.y + 4 * n.y - r.y) * a + + (-t.y + 3 * i.y - 3 * n.y + r.y) * s) + ); + }), + (e.Clamp = function (t, i, n) { + var r = t.x; + r = (r = r > n.x ? n.x : r) < i.x ? i.x : r; + var o = t.y; + return new e( + r, + (o = (o = o > n.y ? n.y : o) < i.y ? i.y : o) + ); + }), + (e.Hermite = function (t, i, n, r, o) { + var a = o * o, + s = o * a, + c = 2 * s - 3 * a + 1, + u = -2 * s + 3 * a, + l = s - 2 * a + o, + h = s - a; + return new e( + t.x * c + n.x * u + i.x * l + r.x * h, + t.y * c + n.y * u + i.y * l + r.y * h + ); + }), + (e.Lerp = function (t, i, n) { + return new e( + t.x + (i.x - t.x) * n, + t.y + (i.y - t.y) * n + ); + }), + (e.Dot = function (e, t) { + return e.x * t.x + e.y * t.y; + }), + (e.Normalize = function (e) { + var t = e.clone(); + return t.normalize(), t; + }), + (e.Minimize = function (t, i) { + return new e( + t.x < i.x ? t.x : i.x, + t.y < i.y ? t.y : i.y + ); + }), + (e.Maximize = function (t, i) { + return new e( + t.x > i.x ? t.x : i.x, + t.y > i.y ? t.y : i.y + ); + }), + (e.Transform = function (t, i) { + var n = e.Zero(); + return e.TransformToRef(t, i, n), n; + }), + (e.TransformToRef = function (e, t, i) { + var n = t.m, + r = e.x * n[0] + e.y * n[4] + n[12], + o = e.x * n[1] + e.y * n[5] + n[13]; + (i.x = r), (i.y = o); + }), + (e.PointInTriangle = function (e, t, i, n) { + var r = + 0.5 * + (-i.y * n.x + + t.y * (-i.x + n.x) + + t.x * (i.y - n.y) + + i.x * n.y), + o = r < 0 ? -1 : 1, + a = + (t.y * n.x - + t.x * n.y + + (n.y - t.y) * e.x + + (t.x - n.x) * e.y) * + o, + s = + (t.x * i.y - + t.y * i.x + + (t.y - i.y) * e.x + + (i.x - t.x) * e.y) * + o; + return a > 0 && s > 0 && a + s < 2 * r * o; + }), + (e.Distance = function (t, i) { + return Math.sqrt(e.DistanceSquared(t, i)); + }), + (e.DistanceSquared = function (e, t) { + var i = e.x - t.x, + n = e.y - t.y; + return i * i + n * n; + }), + (e.Center = function (e, t) { + var i = e.add(t); + return i.scaleInPlace(0.5), i; + }), + (e.DistanceOfPointFromSegment = function (t, i, n) { + var r = e.DistanceSquared(i, n); + if (0 === r) return e.Distance(t, i); + var o = n.subtract(i), + a = Math.max( + 0, + Math.min(1, e.Dot(t.subtract(i), o) / r) + ), + s = i.add(o.multiplyByFloats(a, a)); + return e.Distance(t, s); + }), + e + ); + })(), + f = (function () { + function e(e, t, i) { + void 0 === e && (e = 0), + void 0 === t && (t = 0), + void 0 === i && (i = 0), + (this.x = e), + (this.y = t), + (this.z = i); + } + return ( + (e.prototype.toString = function () { + return ( + "{X: " + this.x + " Y:" + this.y + " Z:" + this.z + "}" + ); + }), + (e.prototype.getClassName = function () { + return "Vector3"; + }), + (e.prototype.getHashCode = function () { + var e = this.x || 0; + return ( + (397 * (e = (397 * e) ^ (this.y || 0))) ^ (this.z || 0) + ); + }), + (e.prototype.asArray = function () { + var e = []; + return this.toArray(e, 0), e; + }), + (e.prototype.toArray = function (e, t) { + return ( + void 0 === t && (t = 0), + (e[t] = this.x), + (e[t + 1] = this.y), + (e[t + 2] = this.z), this - } - , - e.prototype.add = function(t) { - return new e(this.x + t.x,this.y + t.y,this.z + t.z) - } - , - e.prototype.addToRef = function(e, t) { - return t.copyFromFloats(this.x + e.x, this.y + e.y, this.z + e.z) - } - , - e.prototype.subtractInPlace = function(e) { - return this.x -= e.x, - this.y -= e.y, - this.z -= e.z, - this - } - , - e.prototype.subtract = function(t) { - return new e(this.x - t.x,this.y - t.y,this.z - t.z) - } - , - e.prototype.subtractToRef = function(e, t) { - return this.subtractFromFloatsToRef(e.x, e.y, e.z, t) - } - , - e.prototype.subtractFromFloats = function(t, i, n) { - return new e(this.x - t,this.y - i,this.z - n) - } - , - e.prototype.subtractFromFloatsToRef = function(e, t, i, n) { - return n.copyFromFloats(this.x - e, this.y - t, this.z - i) - } - , - e.prototype.negate = function() { - return new e(-this.x,-this.y,-this.z) - } - , - e.prototype.scaleInPlace = function(e) { - return this.x *= e, - this.y *= e, - this.z *= e, - this - } - , - e.prototype.scale = function(t) { - return new e(this.x * t,this.y * t,this.z * t) - } - , - e.prototype.scaleToRef = function(e, t) { - return t.copyFromFloats(this.x * e, this.y * e, this.z * e) - } - , - e.prototype.scaleAndAddToRef = function(e, t) { - return t.addInPlaceFromFloats(this.x * e, this.y * e, this.z * e) - } - , - e.prototype.equals = function(e) { - return e && this.x === e.x && this.y === e.y && this.z === e.z - } - , - e.prototype.equalsWithEpsilon = function(e, t) { - return void 0 === t && (t = c), - e && o.a.WithinEpsilon(this.x, e.x, t) && o.a.WithinEpsilon(this.y, e.y, t) && o.a.WithinEpsilon(this.z, e.z, t) - } - , - e.prototype.equalsToFloats = function(e, t, i) { - return this.x === e && this.y === t && this.z === i - } - , - e.prototype.multiplyInPlace = function(e) { - return this.x *= e.x, - this.y *= e.y, - this.z *= e.z, - this - } - , - e.prototype.multiply = function(e) { - return this.multiplyByFloats(e.x, e.y, e.z) - } - , - e.prototype.multiplyToRef = function(e, t) { - return t.copyFromFloats(this.x * e.x, this.y * e.y, this.z * e.z) - } - , - e.prototype.multiplyByFloats = function(t, i, n) { - return new e(this.x * t,this.y * i,this.z * n) - } - , - e.prototype.divide = function(t) { - return new e(this.x / t.x,this.y / t.y,this.z / t.z) - } - , - e.prototype.divideToRef = function(e, t) { - return t.copyFromFloats(this.x / e.x, this.y / e.y, this.z / e.z) - } - , - e.prototype.divideInPlace = function(e) { - return this.divideToRef(e, this) - } - , - e.prototype.minimizeInPlace = function(e) { - return this.minimizeInPlaceFromFloats(e.x, e.y, e.z) - } - , - e.prototype.maximizeInPlace = function(e) { - return this.maximizeInPlaceFromFloats(e.x, e.y, e.z) - } - , - e.prototype.minimizeInPlaceFromFloats = function(e, t, i) { - return e < this.x && (this.x = e), + ); + }), + (e.prototype.toQuaternion = function () { + return m.RotationYawPitchRoll(this.y, this.x, this.z); + }), + (e.prototype.addInPlace = function (e) { + return this.addInPlaceFromFloats(e.x, e.y, e.z); + }), + (e.prototype.addInPlaceFromFloats = function (e, t, i) { + return (this.x += e), (this.y += t), (this.z += i), this; + }), + (e.prototype.add = function (t) { + return new e(this.x + t.x, this.y + t.y, this.z + t.z); + }), + (e.prototype.addToRef = function (e, t) { + return t.copyFromFloats( + this.x + e.x, + this.y + e.y, + this.z + e.z + ); + }), + (e.prototype.subtractInPlace = function (e) { + return ( + (this.x -= e.x), (this.y -= e.y), (this.z -= e.z), this + ); + }), + (e.prototype.subtract = function (t) { + return new e(this.x - t.x, this.y - t.y, this.z - t.z); + }), + (e.prototype.subtractToRef = function (e, t) { + return this.subtractFromFloatsToRef(e.x, e.y, e.z, t); + }), + (e.prototype.subtractFromFloats = function (t, i, n) { + return new e(this.x - t, this.y - i, this.z - n); + }), + (e.prototype.subtractFromFloatsToRef = function ( + e, + t, + i, + n + ) { + return n.copyFromFloats( + this.x - e, + this.y - t, + this.z - i + ); + }), + (e.prototype.negate = function () { + return new e(-this.x, -this.y, -this.z); + }), + (e.prototype.scaleInPlace = function (e) { + return (this.x *= e), (this.y *= e), (this.z *= e), this; + }), + (e.prototype.scale = function (t) { + return new e(this.x * t, this.y * t, this.z * t); + }), + (e.prototype.scaleToRef = function (e, t) { + return t.copyFromFloats( + this.x * e, + this.y * e, + this.z * e + ); + }), + (e.prototype.scaleAndAddToRef = function (e, t) { + return t.addInPlaceFromFloats( + this.x * e, + this.y * e, + this.z * e + ); + }), + (e.prototype.equals = function (e) { + return ( + e && this.x === e.x && this.y === e.y && this.z === e.z + ); + }), + (e.prototype.equalsWithEpsilon = function (e, t) { + return ( + void 0 === t && (t = c), + e && + o.a.WithinEpsilon(this.x, e.x, t) && + o.a.WithinEpsilon(this.y, e.y, t) && + o.a.WithinEpsilon(this.z, e.z, t) + ); + }), + (e.prototype.equalsToFloats = function (e, t, i) { + return this.x === e && this.y === t && this.z === i; + }), + (e.prototype.multiplyInPlace = function (e) { + return ( + (this.x *= e.x), (this.y *= e.y), (this.z *= e.z), this + ); + }), + (e.prototype.multiply = function (e) { + return this.multiplyByFloats(e.x, e.y, e.z); + }), + (e.prototype.multiplyToRef = function (e, t) { + return t.copyFromFloats( + this.x * e.x, + this.y * e.y, + this.z * e.z + ); + }), + (e.prototype.multiplyByFloats = function (t, i, n) { + return new e(this.x * t, this.y * i, this.z * n); + }), + (e.prototype.divide = function (t) { + return new e(this.x / t.x, this.y / t.y, this.z / t.z); + }), + (e.prototype.divideToRef = function (e, t) { + return t.copyFromFloats( + this.x / e.x, + this.y / e.y, + this.z / e.z + ); + }), + (e.prototype.divideInPlace = function (e) { + return this.divideToRef(e, this); + }), + (e.prototype.minimizeInPlace = function (e) { + return this.minimizeInPlaceFromFloats(e.x, e.y, e.z); + }), + (e.prototype.maximizeInPlace = function (e) { + return this.maximizeInPlaceFromFloats(e.x, e.y, e.z); + }), + (e.prototype.minimizeInPlaceFromFloats = function ( + e, + t, + i + ) { + return ( + e < this.x && (this.x = e), t < this.y && (this.y = t), i < this.z && (this.z = i), this - } - , - e.prototype.maximizeInPlaceFromFloats = function(e, t, i) { - return e > this.x && (this.x = e), + ); + }), + (e.prototype.maximizeInPlaceFromFloats = function ( + e, + t, + i + ) { + return ( + e > this.x && (this.x = e), t > this.y && (this.y = t), i > this.z && (this.z = i), this - } - , - e.prototype.isNonUniformWithinEpsilon = function(e) { - var t = Math.abs(this.x) - , i = Math.abs(this.y); - if (!o.a.WithinEpsilon(t, i, e)) - return true; - var n = Math.abs(this.z); - return !o.a.WithinEpsilon(t, n, e) || !o.a.WithinEpsilon(i, n, e) - } - , - Object.defineProperty(e.prototype, "isNonUniform", { - get: function() { - var e = Math.abs(this.x) - , t = Math.abs(this.y); - if (e !== t) - return true; - var i = Math.abs(this.z); - return e !== i || t !== i - }, - enumerable: true, - configurable: true + ); }), - e.prototype.floor = function() { - return new e(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z)) - } - , - e.prototype.fract = function() { - return new e(this.x - Math.floor(this.x),this.y - Math.floor(this.y),this.z - Math.floor(this.z)) - } - , - e.prototype.length = function() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z) - } - , - e.prototype.lengthSquared = function() { - return this.x * this.x + this.y * this.y + this.z * this.z - } - , - e.prototype.normalize = function() { - return this.normalizeFromLength(this.length()) - } - , - e.prototype.reorderInPlace = function(e) { - var t = this; - return "xyz" === (e = e.toLowerCase()) ? this : (w.Vector3[0].copyFrom(this), - ["x", "y", "z"].forEach(function(i, n) { - t[i] = w.Vector3[0][e[n]] - }), - this) - } - , - e.prototype.rotateByQuaternionToRef = function(t, i) { - return t.toRotationMatrix(w.Matrix[0]), + (e.prototype.isNonUniformWithinEpsilon = function (e) { + var t = Math.abs(this.x), + i = Math.abs(this.y); + if (!o.a.WithinEpsilon(t, i, e)) return true; + var n = Math.abs(this.z); + return ( + !o.a.WithinEpsilon(t, n, e) || + !o.a.WithinEpsilon(i, n, e) + ); + }), + Object.defineProperty(e.prototype, "isNonUniform", { + get: function () { + var e = Math.abs(this.x), + t = Math.abs(this.y); + if (e !== t) return true; + var i = Math.abs(this.z); + return e !== i || t !== i; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.floor = function () { + return new e( + Math.floor(this.x), + Math.floor(this.y), + Math.floor(this.z) + ); + }), + (e.prototype.fract = function () { + return new e( + this.x - Math.floor(this.x), + this.y - Math.floor(this.y), + this.z - Math.floor(this.z) + ); + }), + (e.prototype.length = function () { + return Math.sqrt( + this.x * this.x + this.y * this.y + this.z * this.z + ); + }), + (e.prototype.lengthSquared = function () { + return ( + this.x * this.x + this.y * this.y + this.z * this.z + ); + }), + (e.prototype.normalize = function () { + return this.normalizeFromLength(this.length()); + }), + (e.prototype.reorderInPlace = function (e) { + var t = this; + return "xyz" === (e = e.toLowerCase()) + ? this + : (w.Vector3[0].copyFrom(this), + ["x", "y", "z"].forEach(function (i, n) { + t[i] = w.Vector3[0][e[n]]; + }), + this); + }), + (e.prototype.rotateByQuaternionToRef = function (t, i) { + return ( + t.toRotationMatrix(w.Matrix[0]), e.TransformCoordinatesToRef(this, w.Matrix[0], i), i - } - , - e.prototype.rotateByQuaternionAroundPointToRef = function(e, t, i) { - return this.subtractToRef(t, w.Vector3[0]), + ); + }), + (e.prototype.rotateByQuaternionAroundPointToRef = function ( + e, + t, + i + ) { + return ( + this.subtractToRef(t, w.Vector3[0]), w.Vector3[0].rotateByQuaternionToRef(e, w.Vector3[0]), t.addToRef(w.Vector3[0], i), i - } - , - e.prototype.normalizeFromLength = function(e) { - return 0 === e || 1 === e ? this : this.scaleInPlace(1 / e) - } - , - e.prototype.normalizeToNew = function() { - var t = new e(0,0,0); - return this.normalizeToRef(t), - t - } - , - e.prototype.normalizeToRef = function(e) { - var t = this.length(); - return 0 === t || 1 === t ? e.copyFromFloats(this.x, this.y, this.z) : this.scaleToRef(1 / t, e) - } - , - e.prototype.clone = function() { - return new e(this.x,this.y,this.z) - } - , - e.prototype.copyFrom = function(e) { - return this.copyFromFloats(e.x, e.y, e.z) - } - , - e.prototype.copyFromFloats = function(e, t, i) { - return this.x = e, - this.y = t, - this.z = i, - this - } - , - e.prototype.set = function(e, t, i) { - return this.copyFromFloats(e, t, i) - } - , - e.prototype.setAll = function(e) { - return this.x = this.y = this.z = e, - this - } - , - e.GetClipFactor = function(t, i, n, r) { - var o = e.Dot(t, n) - r; - return o / (o - (e.Dot(i, n) - r)) - } - , - e.GetAngleBetweenVectors = function(t, i, n) { - var r = t.normalizeToRef(w.Vector3[1]) - , o = i.normalizeToRef(w.Vector3[2]) - , a = e.Dot(r, o) - , s = w.Vector3[3]; - return e.CrossToRef(r, o, s), - e.Dot(s, n) > 0 ? Math.acos(a) : -Math.acos(a) - } - , - e.FromArray = function(t, i) { - return void 0 === i && (i = 0), - new e(t[i],t[i + 1],t[i + 2]) - } - , - e.FromFloatArray = function(t, i) { - return e.FromArray(t, i) - } - , - e.FromArrayToRef = function(e, t, i) { - i.x = e[t], - i.y = e[t + 1], - i.z = e[t + 2] - } - , - e.FromFloatArrayToRef = function(t, i, n) { - return e.FromArrayToRef(t, i, n) - } - , - e.FromFloatsToRef = function(e, t, i, n) { - n.copyFromFloats(e, t, i) - } - , - e.Zero = function() { - return new e(0,0,0) - } - , - e.One = function() { - return new e(1,1,1) - } - , - e.Up = function() { - return new e(0,1,0) - } - , - Object.defineProperty(e, "UpReadOnly", { - get: function() { - return e._UpReadOnly - }, - enumerable: true, - configurable: true + ); }), - e.Down = function() { - return new e(0,-1,0) - } - , - e.Forward = function() { - return new e(0,0,1) - } - , - e.Backward = function() { - return new e(0,0,-1) - } - , - e.Right = function() { - return new e(1,0,0) - } - , - e.Left = function() { - return new e(-1,0,0) - } - , - e.TransformCoordinates = function(t, i) { - var n = e.Zero(); - return e.TransformCoordinatesToRef(t, i, n), + (e.prototype.normalizeFromLength = function (e) { + return 0 === e || 1 === e + ? this + : this.scaleInPlace(1 / e); + }), + (e.prototype.normalizeToNew = function () { + var t = new e(0, 0, 0); + return this.normalizeToRef(t), t; + }), + (e.prototype.normalizeToRef = function (e) { + var t = this.length(); + return 0 === t || 1 === t + ? e.copyFromFloats(this.x, this.y, this.z) + : this.scaleToRef(1 / t, e); + }), + (e.prototype.clone = function () { + return new e(this.x, this.y, this.z); + }), + (e.prototype.copyFrom = function (e) { + return this.copyFromFloats(e.x, e.y, e.z); + }), + (e.prototype.copyFromFloats = function (e, t, i) { + return (this.x = e), (this.y = t), (this.z = i), this; + }), + (e.prototype.set = function (e, t, i) { + return this.copyFromFloats(e, t, i); + }), + (e.prototype.setAll = function (e) { + return (this.x = this.y = this.z = e), this; + }), + (e.GetClipFactor = function (t, i, n, r) { + var o = e.Dot(t, n) - r; + return o / (o - (e.Dot(i, n) - r)); + }), + (e.GetAngleBetweenVectors = function (t, i, n) { + var r = t.normalizeToRef(w.Vector3[1]), + o = i.normalizeToRef(w.Vector3[2]), + a = e.Dot(r, o), + s = w.Vector3[3]; + return ( + e.CrossToRef(r, o, s), + e.Dot(s, n) > 0 ? Math.acos(a) : -Math.acos(a) + ); + }), + (e.FromArray = function (t, i) { + return ( + void 0 === i && (i = 0), new e(t[i], t[i + 1], t[i + 2]) + ); + }), + (e.FromFloatArray = function (t, i) { + return e.FromArray(t, i); + }), + (e.FromArrayToRef = function (e, t, i) { + (i.x = e[t]), (i.y = e[t + 1]), (i.z = e[t + 2]); + }), + (e.FromFloatArrayToRef = function (t, i, n) { + return e.FromArrayToRef(t, i, n); + }), + (e.FromFloatsToRef = function (e, t, i, n) { + n.copyFromFloats(e, t, i); + }), + (e.Zero = function () { + return new e(0, 0, 0); + }), + (e.One = function () { + return new e(1, 1, 1); + }), + (e.Up = function () { + return new e(0, 1, 0); + }), + Object.defineProperty(e, "UpReadOnly", { + get: function () { + return e._UpReadOnly; + }, + enumerable: true, + configurable: true, + }), + (e.Down = function () { + return new e(0, -1, 0); + }), + (e.Forward = function () { + return new e(0, 0, 1); + }), + (e.Backward = function () { + return new e(0, 0, -1); + }), + (e.Right = function () { + return new e(1, 0, 0); + }), + (e.Left = function () { + return new e(-1, 0, 0); + }), + (e.TransformCoordinates = function (t, i) { + var n = e.Zero(); + return e.TransformCoordinatesToRef(t, i, n), n; + }), + (e.TransformCoordinatesToRef = function (t, i, n) { + e.TransformCoordinatesFromFloatsToRef( + t.x, + t.y, + t.z, + i, n - } - , - e.TransformCoordinatesToRef = function(t, i, n) { - e.TransformCoordinatesFromFloatsToRef(t.x, t.y, t.z, i, n) - } - , - e.TransformCoordinatesFromFloatsToRef = function(e, t, i, n, r) { - var o = n.m - , a = e * o[0] + t * o[4] + i * o[8] + o[12] - , s = e * o[1] + t * o[5] + i * o[9] + o[13] - , c = e * o[2] + t * o[6] + i * o[10] + o[14] - , u = 1 / (e * o[3] + t * o[7] + i * o[11] + o[15]); - r.x = a * u, - r.y = s * u, - r.z = c * u - } - , - e.TransformNormal = function(t, i) { - var n = e.Zero(); - return e.TransformNormalToRef(t, i, n), - n - } - , - e.TransformNormalToRef = function(e, t, i) { - this.TransformNormalFromFloatsToRef(e.x, e.y, e.z, t, i) - } - , - e.TransformNormalFromFloatsToRef = function(e, t, i, n, r) { - var o = n.m; - r.x = e * o[0] + t * o[4] + i * o[8], - r.y = e * o[1] + t * o[5] + i * o[9], - r.z = e * o[2] + t * o[6] + i * o[10] - } - , - e.CatmullRom = function(t, i, n, r, o) { - var a = o * o - , s = o * a; - return new e(.5 * (2 * i.x + (-t.x + n.x) * o + (2 * t.x - 5 * i.x + 4 * n.x - r.x) * a + (-t.x + 3 * i.x - 3 * n.x + r.x) * s),.5 * (2 * i.y + (-t.y + n.y) * o + (2 * t.y - 5 * i.y + 4 * n.y - r.y) * a + (-t.y + 3 * i.y - 3 * n.y + r.y) * s),.5 * (2 * i.z + (-t.z + n.z) * o + (2 * t.z - 5 * i.z + 4 * n.z - r.z) * a + (-t.z + 3 * i.z - 3 * n.z + r.z) * s)) - } - , - e.Clamp = function(t, i, n) { - var r = new e; - return e.ClampToRef(t, i, n, r), - r - } - , - e.ClampToRef = function(e, t, i, n) { - var r = e.x; - r = (r = r > i.x ? i.x : r) < t.x ? t.x : r; - var o = e.y; - o = (o = o > i.y ? i.y : o) < t.y ? t.y : o; - var a = e.z; - a = (a = a > i.z ? i.z : a) < t.z ? t.z : a, - n.copyFromFloats(r, o, a) - } - , - e.Hermite = function(t, i, n, r, o) { - var a = o * o - , s = o * a - , c = 2 * s - 3 * a + 1 - , u = -2 * s + 3 * a - , l = s - 2 * a + o - , h = s - a; - return new e(t.x * c + n.x * u + i.x * l + r.x * h,t.y * c + n.y * u + i.y * l + r.y * h,t.z * c + n.z * u + i.z * l + r.z * h) - } - , - e.Lerp = function(t, i, n) { - var r = new e(0,0,0); - return e.LerpToRef(t, i, n, r), - r - } - , - e.LerpToRef = function(e, t, i, n) { - n.x = e.x + (t.x - e.x) * i, - n.y = e.y + (t.y - e.y) * i, - n.z = e.z + (t.z - e.z) * i - } - , - e.Dot = function(e, t) { - return e.x * t.x + e.y * t.y + e.z * t.z - } - , - e.Cross = function(t, i) { - var n = e.Zero(); - return e.CrossToRef(t, i, n), - n - } - , - e.CrossToRef = function(e, t, i) { - var n = e.y * t.z - e.z * t.y - , r = e.z * t.x - e.x * t.z - , o = e.x * t.y - e.y * t.x; - i.copyFromFloats(n, r, o) - } - , - e.Normalize = function(t) { - var i = e.Zero(); - return e.NormalizeToRef(t, i), - i - } - , - e.NormalizeToRef = function(e, t) { - e.normalizeToRef(t) - } - , - e.Project = function(t, i, n, r) { - var o = r.width - , a = r.height - , s = r.x - , c = r.y - , u = w.Matrix[1]; - g.FromValuesToRef(o / 2, 0, 0, 0, 0, -a / 2, 0, 0, 0, 0, .5, 0, s + o / 2, a / 2 + c, .5, 1, u); - var l = w.Matrix[0]; - return i.multiplyToRef(n, l), + ); + }), + (e.TransformCoordinatesFromFloatsToRef = function ( + e, + t, + i, + n, + r + ) { + var o = n.m, + a = e * o[0] + t * o[4] + i * o[8] + o[12], + s = e * o[1] + t * o[5] + i * o[9] + o[13], + c = e * o[2] + t * o[6] + i * o[10] + o[14], + u = 1 / (e * o[3] + t * o[7] + i * o[11] + o[15]); + (r.x = a * u), (r.y = s * u), (r.z = c * u); + }), + (e.TransformNormal = function (t, i) { + var n = e.Zero(); + return e.TransformNormalToRef(t, i, n), n; + }), + (e.TransformNormalToRef = function (e, t, i) { + this.TransformNormalFromFloatsToRef(e.x, e.y, e.z, t, i); + }), + (e.TransformNormalFromFloatsToRef = function ( + e, + t, + i, + n, + r + ) { + var o = n.m; + (r.x = e * o[0] + t * o[4] + i * o[8]), + (r.y = e * o[1] + t * o[5] + i * o[9]), + (r.z = e * o[2] + t * o[6] + i * o[10]); + }), + (e.CatmullRom = function (t, i, n, r, o) { + var a = o * o, + s = o * a; + return new e( + 0.5 * + (2 * i.x + + (-t.x + n.x) * o + + (2 * t.x - 5 * i.x + 4 * n.x - r.x) * a + + (-t.x + 3 * i.x - 3 * n.x + r.x) * s), + 0.5 * + (2 * i.y + + (-t.y + n.y) * o + + (2 * t.y - 5 * i.y + 4 * n.y - r.y) * a + + (-t.y + 3 * i.y - 3 * n.y + r.y) * s), + 0.5 * + (2 * i.z + + (-t.z + n.z) * o + + (2 * t.z - 5 * i.z + 4 * n.z - r.z) * a + + (-t.z + 3 * i.z - 3 * n.z + r.z) * s) + ); + }), + (e.Clamp = function (t, i, n) { + var r = new e(); + return e.ClampToRef(t, i, n, r), r; + }), + (e.ClampToRef = function (e, t, i, n) { + var r = e.x; + r = (r = r > i.x ? i.x : r) < t.x ? t.x : r; + var o = e.y; + o = (o = o > i.y ? i.y : o) < t.y ? t.y : o; + var a = e.z; + (a = (a = a > i.z ? i.z : a) < t.z ? t.z : a), + n.copyFromFloats(r, o, a); + }), + (e.Hermite = function (t, i, n, r, o) { + var a = o * o, + s = o * a, + c = 2 * s - 3 * a + 1, + u = -2 * s + 3 * a, + l = s - 2 * a + o, + h = s - a; + return new e( + t.x * c + n.x * u + i.x * l + r.x * h, + t.y * c + n.y * u + i.y * l + r.y * h, + t.z * c + n.z * u + i.z * l + r.z * h + ); + }), + (e.Lerp = function (t, i, n) { + var r = new e(0, 0, 0); + return e.LerpToRef(t, i, n, r), r; + }), + (e.LerpToRef = function (e, t, i, n) { + (n.x = e.x + (t.x - e.x) * i), + (n.y = e.y + (t.y - e.y) * i), + (n.z = e.z + (t.z - e.z) * i); + }), + (e.Dot = function (e, t) { + return e.x * t.x + e.y * t.y + e.z * t.z; + }), + (e.Cross = function (t, i) { + var n = e.Zero(); + return e.CrossToRef(t, i, n), n; + }), + (e.CrossToRef = function (e, t, i) { + var n = e.y * t.z - e.z * t.y, + r = e.z * t.x - e.x * t.z, + o = e.x * t.y - e.y * t.x; + i.copyFromFloats(n, r, o); + }), + (e.Normalize = function (t) { + var i = e.Zero(); + return e.NormalizeToRef(t, i), i; + }), + (e.NormalizeToRef = function (e, t) { + e.normalizeToRef(t); + }), + (e.Project = function (t, i, n, r) { + var o = r.width, + a = r.height, + s = r.x, + c = r.y, + u = w.Matrix[1]; + g.FromValuesToRef( + o / 2, + 0, + 0, + 0, + 0, + -a / 2, + 0, + 0, + 0, + 0, + 0.5, + 0, + s + o / 2, + a / 2 + c, + 0.5, + 1, + u + ); + var l = w.Matrix[0]; + return ( + i.multiplyToRef(n, l), l.multiplyToRef(u, l), e.TransformCoordinates(t, l) - } - , - e._UnprojectFromInvertedMatrixToRef = function(t, i, n) { - e.TransformCoordinatesToRef(t, i, n); - var r = i.m - , a = t.x * r[3] + t.y * r[7] + t.z * r[11] + r[15]; - o.a.WithinEpsilon(a, 1) && n.scaleInPlace(1 / a) - } - , - e.UnprojectFromTransform = function(t, i, n, r, o) { - var a = w.Matrix[0]; - r.multiplyToRef(o, a), + ); + }), + (e._UnprojectFromInvertedMatrixToRef = function (t, i, n) { + e.TransformCoordinatesToRef(t, i, n); + var r = i.m, + a = t.x * r[3] + t.y * r[7] + t.z * r[11] + r[15]; + o.a.WithinEpsilon(a, 1) && n.scaleInPlace(1 / a); + }), + (e.UnprojectFromTransform = function (t, i, n, r, o) { + var a = w.Matrix[0]; + r.multiplyToRef(o, a), a.invert(), - t.x = t.x / i * 2 - 1, - t.y = -(t.y / n * 2 - 1); - var s = new e; - return e._UnprojectFromInvertedMatrixToRef(t, a, s), - s - } - , - e.Unproject = function(t, i, n, r, o, a) { - var s = e.Zero(); - return e.UnprojectToRef(t, i, n, r, o, a, s), - s - } - , - e.UnprojectToRef = function(t, i, n, r, o, a, s) { - e.UnprojectFloatsToRef(t.x, t.y, t.z, i, n, r, o, a, s) - } - , - e.UnprojectFloatsToRef = function(t, i, n, r, o, a, s, c, u) { - var l = w.Matrix[0]; - a.multiplyToRef(s, l), - l.multiplyToRef(c, l), - l.invert(); - var h = w.Vector3[0]; - h.x = t / r * 2 - 1, - h.y = -(i / o * 2 - 1), - h.z = 2 * n - 1, - e._UnprojectFromInvertedMatrixToRef(h, l, u) - } - , - e.Minimize = function(e, t) { - var i = e.clone(); - return i.minimizeInPlace(t), - i - } - , - e.Maximize = function(e, t) { - var i = e.clone(); - return i.maximizeInPlace(t), - i - } - , - e.Distance = function(t, i) { - return Math.sqrt(e.DistanceSquared(t, i)) - } - , - e.DistanceSquared = function(e, t) { - var i = e.x - t.x - , n = e.y - t.y - , r = e.z - t.z; - return i * i + n * n + r * r - } - , - e.Center = function(e, t) { - var i = e.add(t); - return i.scaleInPlace(.5), - i - } - , - e.RotationFromAxis = function(t, i, n) { - var r = e.Zero(); - return e.RotationFromAxisToRef(t, i, n, r), - r - } - , - e.RotationFromAxisToRef = function(e, t, i, n) { - var r = w.Quaternion[0]; - m.RotationQuaternionFromAxisToRef(e, t, i, r), - r.toEulerAnglesToRef(n) - } - , - e._UpReadOnly = e.Up(), + (t.x = (t.x / i) * 2 - 1), + (t.y = -((t.y / n) * 2 - 1)); + var s = new e(); + return e._UnprojectFromInvertedMatrixToRef(t, a, s), s; + }), + (e.Unproject = function (t, i, n, r, o, a) { + var s = e.Zero(); + return e.UnprojectToRef(t, i, n, r, o, a, s), s; + }), + (e.UnprojectToRef = function (t, i, n, r, o, a, s) { + e.UnprojectFloatsToRef(t.x, t.y, t.z, i, n, r, o, a, s); + }), + (e.UnprojectFloatsToRef = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u + ) { + var l = w.Matrix[0]; + a.multiplyToRef(s, l), l.multiplyToRef(c, l), l.invert(); + var h = w.Vector3[0]; + (h.x = (t / r) * 2 - 1), + (h.y = -((i / o) * 2 - 1)), + (h.z = 2 * n - 1), + e._UnprojectFromInvertedMatrixToRef(h, l, u); + }), + (e.Minimize = function (e, t) { + var i = e.clone(); + return i.minimizeInPlace(t), i; + }), + (e.Maximize = function (e, t) { + var i = e.clone(); + return i.maximizeInPlace(t), i; + }), + (e.Distance = function (t, i) { + return Math.sqrt(e.DistanceSquared(t, i)); + }), + (e.DistanceSquared = function (e, t) { + var i = e.x - t.x, + n = e.y - t.y, + r = e.z - t.z; + return i * i + n * n + r * r; + }), + (e.Center = function (e, t) { + var i = e.add(t); + return i.scaleInPlace(0.5), i; + }), + (e.RotationFromAxis = function (t, i, n) { + var r = e.Zero(); + return e.RotationFromAxisToRef(t, i, n, r), r; + }), + (e.RotationFromAxisToRef = function (e, t, i, n) { + var r = w.Quaternion[0]; + m.RotationQuaternionFromAxisToRef(e, t, i, r), + r.toEulerAnglesToRef(n); + }), + (e._UpReadOnly = e.Up()), e - }(), d = function() { - function e(e, t, i, n) { - this.x = e, - this.y = t, - this.z = i, - this.w = n - } - return e.prototype.toString = function() { - return "{X: " + this.x + " Y:" + this.y + " Z:" + this.z + " W:" + this.w + "}" - } - , - e.prototype.getClassName = function() { - return "Vector4" - } - , - e.prototype.getHashCode = function() { - var e = this.x || 0; - return 397 * (e = 397 * (e = 397 * e ^ (this.y || 0)) ^ (this.z || 0)) ^ (this.w || 0) - } - , - e.prototype.asArray = function() { - var e = new Array; - return this.toArray(e, 0), - e - } - , - e.prototype.toArray = function(e, t) { - return void 0 === t && (t = 0), - e[t] = this.x, - e[t + 1] = this.y, - e[t + 2] = this.z, - e[t + 3] = this.w, + ); + })(), + d = (function () { + function e(e, t, i, n) { + (this.x = e), (this.y = t), (this.z = i), (this.w = n); + } + return ( + (e.prototype.toString = function () { + return ( + "{X: " + + this.x + + " Y:" + + this.y + + " Z:" + + this.z + + " W:" + + this.w + + "}" + ); + }), + (e.prototype.getClassName = function () { + return "Vector4"; + }), + (e.prototype.getHashCode = function () { + var e = this.x || 0; + return ( + (397 * + (e = + (397 * (e = (397 * e) ^ (this.y || 0))) ^ + (this.z || 0))) ^ + (this.w || 0) + ); + }), + (e.prototype.asArray = function () { + var e = new Array(); + return this.toArray(e, 0), e; + }), + (e.prototype.toArray = function (e, t) { + return ( + void 0 === t && (t = 0), + (e[t] = this.x), + (e[t + 1] = this.y), + (e[t + 2] = this.z), + (e[t + 3] = this.w), this - } - , - e.prototype.addInPlace = function(e) { - return this.x += e.x, - this.y += e.y, - this.z += e.z, - this.w += e.w, + ); + }), + (e.prototype.addInPlace = function (e) { + return ( + (this.x += e.x), + (this.y += e.y), + (this.z += e.z), + (this.w += e.w), this - } - , - e.prototype.add = function(t) { - return new e(this.x + t.x,this.y + t.y,this.z + t.z,this.w + t.w) - } - , - e.prototype.addToRef = function(e, t) { - return t.x = this.x + e.x, - t.y = this.y + e.y, - t.z = this.z + e.z, - t.w = this.w + e.w, + ); + }), + (e.prototype.add = function (t) { + return new e( + this.x + t.x, + this.y + t.y, + this.z + t.z, + this.w + t.w + ); + }), + (e.prototype.addToRef = function (e, t) { + return ( + (t.x = this.x + e.x), + (t.y = this.y + e.y), + (t.z = this.z + e.z), + (t.w = this.w + e.w), this - } - , - e.prototype.subtractInPlace = function(e) { - return this.x -= e.x, - this.y -= e.y, - this.z -= e.z, - this.w -= e.w, + ); + }), + (e.prototype.subtractInPlace = function (e) { + return ( + (this.x -= e.x), + (this.y -= e.y), + (this.z -= e.z), + (this.w -= e.w), this - } - , - e.prototype.subtract = function(t) { - return new e(this.x - t.x,this.y - t.y,this.z - t.z,this.w - t.w) - } - , - e.prototype.subtractToRef = function(e, t) { - return t.x = this.x - e.x, - t.y = this.y - e.y, - t.z = this.z - e.z, - t.w = this.w - e.w, + ); + }), + (e.prototype.subtract = function (t) { + return new e( + this.x - t.x, + this.y - t.y, + this.z - t.z, + this.w - t.w + ); + }), + (e.prototype.subtractToRef = function (e, t) { + return ( + (t.x = this.x - e.x), + (t.y = this.y - e.y), + (t.z = this.z - e.z), + (t.w = this.w - e.w), this - } - , - e.prototype.subtractFromFloats = function(t, i, n, r) { - return new e(this.x - t,this.y - i,this.z - n,this.w - r) - } - , - e.prototype.subtractFromFloatsToRef = function(e, t, i, n, r) { - return r.x = this.x - e, - r.y = this.y - t, - r.z = this.z - i, - r.w = this.w - n, + ); + }), + (e.prototype.subtractFromFloats = function (t, i, n, r) { + return new e( + this.x - t, + this.y - i, + this.z - n, + this.w - r + ); + }), + (e.prototype.subtractFromFloatsToRef = function ( + e, + t, + i, + n, + r + ) { + return ( + (r.x = this.x - e), + (r.y = this.y - t), + (r.z = this.z - i), + (r.w = this.w - n), this - } - , - e.prototype.negate = function() { - return new e(-this.x,-this.y,-this.z,-this.w) - } - , - e.prototype.scaleInPlace = function(e) { - return this.x *= e, - this.y *= e, - this.z *= e, - this.w *= e, + ); + }), + (e.prototype.negate = function () { + return new e(-this.x, -this.y, -this.z, -this.w); + }), + (e.prototype.scaleInPlace = function (e) { + return ( + (this.x *= e), + (this.y *= e), + (this.z *= e), + (this.w *= e), this - } - , - e.prototype.scale = function(t) { - return new e(this.x * t,this.y * t,this.z * t,this.w * t) - } - , - e.prototype.scaleToRef = function(e, t) { - return t.x = this.x * e, - t.y = this.y * e, - t.z = this.z * e, - t.w = this.w * e, + ); + }), + (e.prototype.scale = function (t) { + return new e( + this.x * t, + this.y * t, + this.z * t, + this.w * t + ); + }), + (e.prototype.scaleToRef = function (e, t) { + return ( + (t.x = this.x * e), + (t.y = this.y * e), + (t.z = this.z * e), + (t.w = this.w * e), this - } - , - e.prototype.scaleAndAddToRef = function(e, t) { - return t.x += this.x * e, - t.y += this.y * e, - t.z += this.z * e, - t.w += this.w * e, + ); + }), + (e.prototype.scaleAndAddToRef = function (e, t) { + return ( + (t.x += this.x * e), + (t.y += this.y * e), + (t.z += this.z * e), + (t.w += this.w * e), this - } - , - e.prototype.equals = function(e) { - return e && this.x === e.x && this.y === e.y && this.z === e.z && this.w === e.w - } - , - e.prototype.equalsWithEpsilon = function(e, t) { - return void 0 === t && (t = c), - e && o.a.WithinEpsilon(this.x, e.x, t) && o.a.WithinEpsilon(this.y, e.y, t) && o.a.WithinEpsilon(this.z, e.z, t) && o.a.WithinEpsilon(this.w, e.w, t) - } - , - e.prototype.equalsToFloats = function(e, t, i, n) { - return this.x === e && this.y === t && this.z === i && this.w === n - } - , - e.prototype.multiplyInPlace = function(e) { - return this.x *= e.x, - this.y *= e.y, - this.z *= e.z, - this.w *= e.w, + ); + }), + (e.prototype.equals = function (e) { + return ( + e && + this.x === e.x && + this.y === e.y && + this.z === e.z && + this.w === e.w + ); + }), + (e.prototype.equalsWithEpsilon = function (e, t) { + return ( + void 0 === t && (t = c), + e && + o.a.WithinEpsilon(this.x, e.x, t) && + o.a.WithinEpsilon(this.y, e.y, t) && + o.a.WithinEpsilon(this.z, e.z, t) && + o.a.WithinEpsilon(this.w, e.w, t) + ); + }), + (e.prototype.equalsToFloats = function (e, t, i, n) { + return ( + this.x === e && + this.y === t && + this.z === i && + this.w === n + ); + }), + (e.prototype.multiplyInPlace = function (e) { + return ( + (this.x *= e.x), + (this.y *= e.y), + (this.z *= e.z), + (this.w *= e.w), this - } - , - e.prototype.multiply = function(t) { - return new e(this.x * t.x,this.y * t.y,this.z * t.z,this.w * t.w) - } - , - e.prototype.multiplyToRef = function(e, t) { - return t.x = this.x * e.x, - t.y = this.y * e.y, - t.z = this.z * e.z, - t.w = this.w * e.w, + ); + }), + (e.prototype.multiply = function (t) { + return new e( + this.x * t.x, + this.y * t.y, + this.z * t.z, + this.w * t.w + ); + }), + (e.prototype.multiplyToRef = function (e, t) { + return ( + (t.x = this.x * e.x), + (t.y = this.y * e.y), + (t.z = this.z * e.z), + (t.w = this.w * e.w), this - } - , - e.prototype.multiplyByFloats = function(t, i, n, r) { - return new e(this.x * t,this.y * i,this.z * n,this.w * r) - } - , - e.prototype.divide = function(t) { - return new e(this.x / t.x,this.y / t.y,this.z / t.z,this.w / t.w) - } - , - e.prototype.divideToRef = function(e, t) { - return t.x = this.x / e.x, - t.y = this.y / e.y, - t.z = this.z / e.z, - t.w = this.w / e.w, + ); + }), + (e.prototype.multiplyByFloats = function (t, i, n, r) { + return new e( + this.x * t, + this.y * i, + this.z * n, + this.w * r + ); + }), + (e.prototype.divide = function (t) { + return new e( + this.x / t.x, + this.y / t.y, + this.z / t.z, + this.w / t.w + ); + }), + (e.prototype.divideToRef = function (e, t) { + return ( + (t.x = this.x / e.x), + (t.y = this.y / e.y), + (t.z = this.z / e.z), + (t.w = this.w / e.w), this - } - , - e.prototype.divideInPlace = function(e) { - return this.divideToRef(e, this) - } - , - e.prototype.minimizeInPlace = function(e) { - return e.x < this.x && (this.x = e.x), + ); + }), + (e.prototype.divideInPlace = function (e) { + return this.divideToRef(e, this); + }), + (e.prototype.minimizeInPlace = function (e) { + return ( + e.x < this.x && (this.x = e.x), e.y < this.y && (this.y = e.y), e.z < this.z && (this.z = e.z), e.w < this.w && (this.w = e.w), this - } - , - e.prototype.maximizeInPlace = function(e) { - return e.x > this.x && (this.x = e.x), + ); + }), + (e.prototype.maximizeInPlace = function (e) { + return ( + e.x > this.x && (this.x = e.x), e.y > this.y && (this.y = e.y), e.z > this.z && (this.z = e.z), e.w > this.w && (this.w = e.w), this - } - , - e.prototype.floor = function() { - return new e(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w)) - } - , - e.prototype.fract = function() { - return new e(this.x - Math.floor(this.x),this.y - Math.floor(this.y),this.z - Math.floor(this.z),this.w - Math.floor(this.w)) - } - , - e.prototype.length = function() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w) - } - , - e.prototype.lengthSquared = function() { - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w - } - , - e.prototype.normalize = function() { - var e = this.length(); - return 0 === e ? this : this.scaleInPlace(1 / e) - } - , - e.prototype.toVector3 = function() { - return new f(this.x,this.y,this.z) - } - , - e.prototype.clone = function() { - return new e(this.x,this.y,this.z,this.w) - } - , - e.prototype.copyFrom = function(e) { - return this.x = e.x, - this.y = e.y, - this.z = e.z, - this.w = e.w, + ); + }), + (e.prototype.floor = function () { + return new e( + Math.floor(this.x), + Math.floor(this.y), + Math.floor(this.z), + Math.floor(this.w) + ); + }), + (e.prototype.fract = function () { + return new e( + this.x - Math.floor(this.x), + this.y - Math.floor(this.y), + this.z - Math.floor(this.z), + this.w - Math.floor(this.w) + ); + }), + (e.prototype.length = function () { + return Math.sqrt( + this.x * this.x + + this.y * this.y + + this.z * this.z + + this.w * this.w + ); + }), + (e.prototype.lengthSquared = function () { + return ( + this.x * this.x + + this.y * this.y + + this.z * this.z + + this.w * this.w + ); + }), + (e.prototype.normalize = function () { + var e = this.length(); + return 0 === e ? this : this.scaleInPlace(1 / e); + }), + (e.prototype.toVector3 = function () { + return new f(this.x, this.y, this.z); + }), + (e.prototype.clone = function () { + return new e(this.x, this.y, this.z, this.w); + }), + (e.prototype.copyFrom = function (e) { + return ( + (this.x = e.x), + (this.y = e.y), + (this.z = e.z), + (this.w = e.w), this - } - , - e.prototype.copyFromFloats = function(e, t, i, n) { - return this.x = e, - this.y = t, - this.z = i, - this.w = n, + ); + }), + (e.prototype.copyFromFloats = function (e, t, i, n) { + return ( + (this.x = e), + (this.y = t), + (this.z = i), + (this.w = n), this - } - , - e.prototype.set = function(e, t, i, n) { - return this.copyFromFloats(e, t, i, n) - } - , - e.prototype.setAll = function(e) { - return this.x = this.y = this.z = this.w = e, - this - } - , - e.FromArray = function(t, i) { - return i || (i = 0), - new e(t[i],t[i + 1],t[i + 2],t[i + 3]) - } - , - e.FromArrayToRef = function(e, t, i) { - i.x = e[t], - i.y = e[t + 1], - i.z = e[t + 2], - i.w = e[t + 3] - } - , - e.FromFloatArrayToRef = function(t, i, n) { - e.FromArrayToRef(t, i, n) - } - , - e.FromFloatsToRef = function(e, t, i, n, r) { - r.x = e, - r.y = t, - r.z = i, - r.w = n - } - , - e.Zero = function() { - return new e(0,0,0,0) - } - , - e.One = function() { - return new e(1,1,1,1) - } - , - e.Normalize = function(t) { - var i = e.Zero(); - return e.NormalizeToRef(t, i), - i - } - , - e.NormalizeToRef = function(e, t) { - t.copyFrom(e), - t.normalize() - } - , - e.Minimize = function(e, t) { - var i = e.clone(); - return i.minimizeInPlace(t), - i - } - , - e.Maximize = function(e, t) { - var i = e.clone(); - return i.maximizeInPlace(t), - i - } - , - e.Distance = function(t, i) { - return Math.sqrt(e.DistanceSquared(t, i)) - } - , - e.DistanceSquared = function(e, t) { - var i = e.x - t.x - , n = e.y - t.y - , r = e.z - t.z - , o = e.w - t.w; - return i * i + n * n + r * r + o * o - } - , - e.Center = function(e, t) { - var i = e.add(t); - return i.scaleInPlace(.5), - i - } - , - e.TransformNormal = function(t, i) { - var n = e.Zero(); - return e.TransformNormalToRef(t, i, n), - n - } - , - e.TransformNormalToRef = function(e, t, i) { - var n = t.m - , r = e.x * n[0] + e.y * n[4] + e.z * n[8] - , o = e.x * n[1] + e.y * n[5] + e.z * n[9] - , a = e.x * n[2] + e.y * n[6] + e.z * n[10]; - i.x = r, - i.y = o, - i.z = a, - i.w = e.w - } - , - e.TransformNormalFromFloatsToRef = function(e, t, i, n, r, o) { - var a = r.m; - o.x = e * a[0] + t * a[4] + i * a[8], - o.y = e * a[1] + t * a[5] + i * a[9], - o.z = e * a[2] + t * a[6] + i * a[10], - o.w = n - } - , - e.FromVector3 = function(t, i) { - return void 0 === i && (i = 0), - new e(t.x,t.y,t.z,i) - } - , + ); + }), + (e.prototype.set = function (e, t, i, n) { + return this.copyFromFloats(e, t, i, n); + }), + (e.prototype.setAll = function (e) { + return (this.x = this.y = this.z = this.w = e), this; + }), + (e.FromArray = function (t, i) { + return ( + i || (i = 0), new e(t[i], t[i + 1], t[i + 2], t[i + 3]) + ); + }), + (e.FromArrayToRef = function (e, t, i) { + (i.x = e[t]), + (i.y = e[t + 1]), + (i.z = e[t + 2]), + (i.w = e[t + 3]); + }), + (e.FromFloatArrayToRef = function (t, i, n) { + e.FromArrayToRef(t, i, n); + }), + (e.FromFloatsToRef = function (e, t, i, n, r) { + (r.x = e), (r.y = t), (r.z = i), (r.w = n); + }), + (e.Zero = function () { + return new e(0, 0, 0, 0); + }), + (e.One = function () { + return new e(1, 1, 1, 1); + }), + (e.Normalize = function (t) { + var i = e.Zero(); + return e.NormalizeToRef(t, i), i; + }), + (e.NormalizeToRef = function (e, t) { + t.copyFrom(e), t.normalize(); + }), + (e.Minimize = function (e, t) { + var i = e.clone(); + return i.minimizeInPlace(t), i; + }), + (e.Maximize = function (e, t) { + var i = e.clone(); + return i.maximizeInPlace(t), i; + }), + (e.Distance = function (t, i) { + return Math.sqrt(e.DistanceSquared(t, i)); + }), + (e.DistanceSquared = function (e, t) { + var i = e.x - t.x, + n = e.y - t.y, + r = e.z - t.z, + o = e.w - t.w; + return i * i + n * n + r * r + o * o; + }), + (e.Center = function (e, t) { + var i = e.add(t); + return i.scaleInPlace(0.5), i; + }), + (e.TransformNormal = function (t, i) { + var n = e.Zero(); + return e.TransformNormalToRef(t, i, n), n; + }), + (e.TransformNormalToRef = function (e, t, i) { + var n = t.m, + r = e.x * n[0] + e.y * n[4] + e.z * n[8], + o = e.x * n[1] + e.y * n[5] + e.z * n[9], + a = e.x * n[2] + e.y * n[6] + e.z * n[10]; + (i.x = r), (i.y = o), (i.z = a), (i.w = e.w); + }), + (e.TransformNormalFromFloatsToRef = function ( + e, + t, + i, + n, + r, + o + ) { + var a = r.m; + (o.x = e * a[0] + t * a[4] + i * a[8]), + (o.y = e * a[1] + t * a[5] + i * a[9]), + (o.z = e * a[2] + t * a[6] + i * a[10]), + (o.w = n); + }), + (e.FromVector3 = function (t, i) { + return void 0 === i && (i = 0), new e(t.x, t.y, t.z, i); + }), e - }(), p = function() { - function e(e, t) { - this.width = e, - this.height = t - } - return e.prototype.toString = function() { - return "{W: " + this.width + ", H: " + this.height + "}" - } - , - e.prototype.getClassName = function() { - return "Size" - } - , - e.prototype.getHashCode = function() { - var e = this.width || 0; - return 397 * e ^ (this.height || 0) - } - , - e.prototype.copyFrom = function(e) { - this.width = e.width, - this.height = e.height - } - , - e.prototype.copyFromFloats = function(e, t) { - return this.width = e, - this.height = t, - this - } - , - e.prototype.set = function(e, t) { - return this.copyFromFloats(e, t) - } - , - e.prototype.multiplyByFloats = function(t, i) { - return new e(this.width * t,this.height * i) - } - , - e.prototype.clone = function() { - return new e(this.width,this.height) - } - , - e.prototype.equals = function(e) { - return !!e && this.width === e.width && this.height === e.height - } - , + ); + })(), + p = (function () { + function e(e, t) { + (this.width = e), (this.height = t); + } + return ( + (e.prototype.toString = function () { + return "{W: " + this.width + ", H: " + this.height + "}"; + }), + (e.prototype.getClassName = function () { + return "Size"; + }), + (e.prototype.getHashCode = function () { + var e = this.width || 0; + return (397 * e) ^ (this.height || 0); + }), + (e.prototype.copyFrom = function (e) { + (this.width = e.width), (this.height = e.height); + }), + (e.prototype.copyFromFloats = function (e, t) { + return (this.width = e), (this.height = t), this; + }), + (e.prototype.set = function (e, t) { + return this.copyFromFloats(e, t); + }), + (e.prototype.multiplyByFloats = function (t, i) { + return new e(this.width * t, this.height * i); + }), + (e.prototype.clone = function () { + return new e(this.width, this.height); + }), + (e.prototype.equals = function (e) { + return ( + !!e && + this.width === e.width && + this.height === e.height + ); + }), Object.defineProperty(e.prototype, "surface", { - get: function() { - return this.width * this.height - }, - enumerable: true, - configurable: true + get: function () { + return this.width * this.height; + }, + enumerable: true, + configurable: true, }), - e.Zero = function() { - return new e(0,0) - } - , - e.prototype.add = function(t) { - return new e(this.width + t.width,this.height + t.height) - } - , - e.prototype.subtract = function(t) { - return new e(this.width - t.width,this.height - t.height) - } - , - e.Lerp = function(t, i, n) { - return new e(t.width + (i.width - t.width) * n,t.height + (i.height - t.height) * n) - } - , - e - }(), m = function() { - function e(e, t, i, n) { - void 0 === e && (e = 0), - void 0 === t && (t = 0), - void 0 === i && (i = 0), - void 0 === n && (n = 1), - this.x = e, - this.y = t, - this.z = i, - this.w = n - } - return e.prototype.toString = function() { - return "{X: " + this.x + " Y:" + this.y + " Z:" + this.z + " W:" + this.w + "}" - } - , - e.prototype.getClassName = function() { - return "Quaternion" - } - , - e.prototype.getHashCode = function() { - var e = this.x || 0; - return 397 * (e = 397 * (e = 397 * e ^ (this.y || 0)) ^ (this.z || 0)) ^ (this.w || 0) - } - , - e.prototype.asArray = function() { - return [this.x, this.y, this.z, this.w] - } - , - e.prototype.equals = function(e) { - return e && this.x === e.x && this.y === e.y && this.z === e.z && this.w === e.w - } - , - e.prototype.clone = function() { - return new e(this.x,this.y,this.z,this.w) - } - , - e.prototype.copyFrom = function(e) { - return this.x = e.x, - this.y = e.y, - this.z = e.z, - this.w = e.w, - this - } - , - e.prototype.copyFromFloats = function(e, t, i, n) { - return this.x = e, - this.y = t, - this.z = i, - this.w = n, - this - } - , - e.prototype.set = function(e, t, i, n) { - return this.copyFromFloats(e, t, i, n) - } - , - e.prototype.add = function(t) { - return new e(this.x + t.x,this.y + t.y,this.z + t.z,this.w + t.w) - } - , - e.prototype.addInPlace = function(e) { - return this.x += e.x, - this.y += e.y, - this.z += e.z, - this.w += e.w, - this - } - , - e.prototype.subtract = function(t) { - return new e(this.x - t.x,this.y - t.y,this.z - t.z,this.w - t.w) - } - , - e.prototype.scale = function(t) { - return new e(this.x * t,this.y * t,this.z * t,this.w * t) - } - , - e.prototype.scaleToRef = function(e, t) { - return t.x = this.x * e, - t.y = this.y * e, - t.z = this.z * e, - t.w = this.w * e, - this - } - , - e.prototype.scaleInPlace = function(e) { - return this.x *= e, - this.y *= e, - this.z *= e, - this.w *= e, - this - } - , - e.prototype.scaleAndAddToRef = function(e, t) { - return t.x += this.x * e, - t.y += this.y * e, - t.z += this.z * e, - t.w += this.w * e, - this - } - , - e.prototype.multiply = function(t) { - var i = new e(0,0,0,1); - return this.multiplyToRef(t, i), - i - } - , - e.prototype.multiplyToRef = function(e, t) { - var i = this.x * e.w + this.y * e.z - this.z * e.y + this.w * e.x - , n = -this.x * e.z + this.y * e.w + this.z * e.x + this.w * e.y - , r = this.x * e.y - this.y * e.x + this.z * e.w + this.w * e.z - , o = -this.x * e.x - this.y * e.y - this.z * e.z + this.w * e.w; - return t.copyFromFloats(i, n, r, o), - this - } - , - e.prototype.multiplyInPlace = function(e) { - return this.multiplyToRef(e, this), - this - } - , - e.prototype.conjugateToRef = function(e) { - return e.copyFromFloats(-this.x, -this.y, -this.z, this.w), - this - } - , - e.prototype.conjugateInPlace = function() { - return this.x *= -1, - this.y *= -1, - this.z *= -1, - this - } - , - e.prototype.conjugate = function() { - return new e(-this.x,-this.y,-this.z,this.w) - } - , - e.prototype.length = function() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w) - } - , - e.prototype.normalize = function() { - var e = this.length(); - if (0 === e) - return this; - var t = 1 / e; - return this.x *= t, - this.y *= t, - this.z *= t, - this.w *= t, - this - } - , - e.prototype.toEulerAngles = function(e) { - void 0 === e && (e = "YZX"); - var t = f.Zero(); - return this.toEulerAnglesToRef(t), - t - } - , - e.prototype.toEulerAnglesToRef = function(e) { - var t = this.z - , i = this.x - , n = this.y - , r = this.w - , o = r * r - , a = t * t - , s = i * i - , c = n * n - , u = n * t - i * r; - return u < -.4999999 ? (e.y = 2 * Math.atan2(n, r), - e.x = Math.PI / 2, - e.z = 0) : u > .4999999 ? (e.y = 2 * Math.atan2(n, r), - e.x = -Math.PI / 2, - e.z = 0) : (e.z = Math.atan2(2 * (i * n + t * r), -a - s + c + o), - e.x = Math.asin(-2 * (t * n - i * r)), - e.y = Math.atan2(2 * (t * i + n * r), a - s - c + o)), - this - } - , - e.prototype.toRotationMatrix = function(e) { - return g.FromQuaternionToRef(this, e), - this - } - , - e.prototype.fromRotationMatrix = function(t) { - return e.FromRotationMatrixToRef(t, this), - this - } - , - e.FromRotationMatrix = function(t) { - var i = new e; - return e.FromRotationMatrixToRef(t, i), - i - } - , - e.FromRotationMatrixToRef = function(e, t) { - var i, n = e.m, r = n[0], o = n[4], a = n[8], s = n[1], c = n[5], u = n[9], l = n[2], h = n[6], f = n[10], d = r + c + f; - d > 0 ? (i = .5 / Math.sqrt(d + 1), - t.w = .25 / i, - t.x = (h - u) * i, - t.y = (a - l) * i, - t.z = (s - o) * i) : r > c && r > f ? (i = 2 * Math.sqrt(1 + r - c - f), - t.w = (h - u) / i, - t.x = .25 * i, - t.y = (o + s) / i, - t.z = (a + l) / i) : c > f ? (i = 2 * Math.sqrt(1 + c - r - f), - t.w = (a - l) / i, - t.x = (o + s) / i, - t.y = .25 * i, - t.z = (u + h) / i) : (i = 2 * Math.sqrt(1 + f - r - c), - t.w = (s - o) / i, - t.x = (a + l) / i, - t.y = (u + h) / i, - t.z = .25 * i) - } - , - e.Dot = function(e, t) { - return e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w - } - , - e.AreClose = function(t, i) { - return e.Dot(t, i) >= 0 - } - , - e.Zero = function() { - return new e(0,0,0,0) - } - , - e.Inverse = function(t) { - return new e(-t.x,-t.y,-t.z,t.w) - } - , - e.InverseToRef = function(e, t) { - return t.set(-e.x, -e.y, -e.z, e.w), - t - } - , - e.Identity = function() { - return new e(0,0,0,1) - } - , - e.IsIdentity = function(e) { - return e && 0 === e.x && 0 === e.y && 0 === e.z && 1 === e.w - } - , - e.RotationAxis = function(t, i) { - return e.RotationAxisToRef(t, i, new e) - } - , - e.RotationAxisToRef = function(e, t, i) { - var n = Math.sin(t / 2); - return e.normalize(), - i.w = Math.cos(t / 2), - i.x = e.x * n, - i.y = e.y * n, - i.z = e.z * n, - i - } - , - e.FromArray = function(t, i) { - return i || (i = 0), - new e(t[i],t[i + 1],t[i + 2],t[i + 3]) - } - , - e.FromEulerAngles = function(t, i, n) { - var r = new e; - return e.RotationYawPitchRollToRef(i, t, n, r), - r - } - , - e.FromEulerAnglesToRef = function(t, i, n, r) { - return e.RotationYawPitchRollToRef(i, t, n, r), - r - } - , - e.FromEulerVector = function(t) { - var i = new e; - return e.RotationYawPitchRollToRef(t.y, t.x, t.z, i), - i - } - , - e.FromEulerVectorToRef = function(t, i) { - return e.RotationYawPitchRollToRef(t.y, t.x, t.z, i), - i - } - , - e.RotationYawPitchRoll = function(t, i, n) { - var r = new e; - return e.RotationYawPitchRollToRef(t, i, n, r), - r - } - , - e.RotationYawPitchRollToRef = function(e, t, i, n) { - var r = .5 * i - , o = .5 * t - , a = .5 * e - , s = Math.sin(r) - , c = Math.cos(r) - , u = Math.sin(o) - , l = Math.cos(o) - , h = Math.sin(a) - , f = Math.cos(a); - n.x = f * u * c + h * l * s, - n.y = h * l * c - f * u * s, - n.z = f * l * s - h * u * c, - n.w = f * l * c + h * u * s - } - , - e.RotationAlphaBetaGamma = function(t, i, n) { - var r = new e; - return e.RotationAlphaBetaGammaToRef(t, i, n, r), - r - } - , - e.RotationAlphaBetaGammaToRef = function(e, t, i, n) { - var r = .5 * (i + e) - , o = .5 * (i - e) - , a = .5 * t; - n.x = Math.cos(o) * Math.sin(a), - n.y = Math.sin(o) * Math.sin(a), - n.z = Math.sin(r) * Math.cos(a), - n.w = Math.cos(r) * Math.cos(a) - } - , - e.RotationQuaternionFromAxis = function(t, i, n) { - var r = new e(0,0,0,0); - return e.RotationQuaternionFromAxisToRef(t, i, n, r), - r - } - , - e.RotationQuaternionFromAxisToRef = function(t, i, n, r) { - var o = w.Matrix[0]; - g.FromXYZAxesToRef(t.normalize(), i.normalize(), n.normalize(), o), - e.FromRotationMatrixToRef(o, r) - } - , - e.Slerp = function(t, i, n) { - var r = e.Identity(); - return e.SlerpToRef(t, i, n, r), - r - } - , - e.SlerpToRef = function(e, t, i, n) { - var r, o, a = e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w, s = false; - if (a < 0 && (s = true, - a = -a), - a > .999999) - o = 1 - i, - r = s ? -i : i; - else { - var c = Math.acos(a) - , u = 1 / Math.sin(c); - o = Math.sin((1 - i) * c) * u, - r = s ? -Math.sin(i * c) * u : Math.sin(i * c) * u - } - n.x = o * e.x + r * t.x, - n.y = o * e.y + r * t.y, - n.z = o * e.z + r * t.z, - n.w = o * e.w + r * t.w - } - , - e.Hermite = function(t, i, n, r, o) { - var a = o * o - , s = o * a - , c = 2 * s - 3 * a + 1 - , u = -2 * s + 3 * a - , l = s - 2 * a + o - , h = s - a; - return new e(t.x * c + n.x * u + i.x * l + r.x * h,t.y * c + n.y * u + i.y * l + r.y * h,t.z * c + n.z * u + i.z * l + r.z * h,t.w * c + n.w * u + i.w * l + r.w * h) - } - , - e - }(), g = function() { - function e() { - this._isIdentity = false, - this._isIdentityDirty = true, - this._isIdentity3x2 = true, - this._isIdentity3x2Dirty = true, - this.updateFlag = -1, - this._m = new Float32Array(16), - this._updateIdentityStatus(false) - } - return Object.defineProperty(e.prototype, "m", { - get: function() { - return this._m - }, - enumerable: true, - configurable: true + (e.Zero = function () { + return new e(0, 0); }), - e.prototype._markAsUpdated = function() { - this.updateFlag = e._updateFlagSeed++, - this._isIdentity = false, - this._isIdentity3x2 = false, - this._isIdentityDirty = true, - this._isIdentity3x2Dirty = true - } - , - e.prototype._updateIdentityStatus = function(t, i, n, r) { - void 0 === i && (i = false), + (e.prototype.add = function (t) { + return new e( + this.width + t.width, + this.height + t.height + ); + }), + (e.prototype.subtract = function (t) { + return new e( + this.width - t.width, + this.height - t.height + ); + }), + (e.Lerp = function (t, i, n) { + return new e( + t.width + (i.width - t.width) * n, + t.height + (i.height - t.height) * n + ); + }), + e + ); + })(), + m = (function () { + function e(e, t, i, n) { + void 0 === e && (e = 0), + void 0 === t && (t = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 1), + (this.x = e), + (this.y = t), + (this.z = i), + (this.w = n); + } + return ( + (e.prototype.toString = function () { + return ( + "{X: " + + this.x + + " Y:" + + this.y + + " Z:" + + this.z + + " W:" + + this.w + + "}" + ); + }), + (e.prototype.getClassName = function () { + return "Quaternion"; + }), + (e.prototype.getHashCode = function () { + var e = this.x || 0; + return ( + (397 * + (e = + (397 * (e = (397 * e) ^ (this.y || 0))) ^ + (this.z || 0))) ^ + (this.w || 0) + ); + }), + (e.prototype.asArray = function () { + return [this.x, this.y, this.z, this.w]; + }), + (e.prototype.equals = function (e) { + return ( + e && + this.x === e.x && + this.y === e.y && + this.z === e.z && + this.w === e.w + ); + }), + (e.prototype.clone = function () { + return new e(this.x, this.y, this.z, this.w); + }), + (e.prototype.copyFrom = function (e) { + return ( + (this.x = e.x), + (this.y = e.y), + (this.z = e.z), + (this.w = e.w), + this + ); + }), + (e.prototype.copyFromFloats = function (e, t, i, n) { + return ( + (this.x = e), + (this.y = t), + (this.z = i), + (this.w = n), + this + ); + }), + (e.prototype.set = function (e, t, i, n) { + return this.copyFromFloats(e, t, i, n); + }), + (e.prototype.add = function (t) { + return new e( + this.x + t.x, + this.y + t.y, + this.z + t.z, + this.w + t.w + ); + }), + (e.prototype.addInPlace = function (e) { + return ( + (this.x += e.x), + (this.y += e.y), + (this.z += e.z), + (this.w += e.w), + this + ); + }), + (e.prototype.subtract = function (t) { + return new e( + this.x - t.x, + this.y - t.y, + this.z - t.z, + this.w - t.w + ); + }), + (e.prototype.scale = function (t) { + return new e( + this.x * t, + this.y * t, + this.z * t, + this.w * t + ); + }), + (e.prototype.scaleToRef = function (e, t) { + return ( + (t.x = this.x * e), + (t.y = this.y * e), + (t.z = this.z * e), + (t.w = this.w * e), + this + ); + }), + (e.prototype.scaleInPlace = function (e) { + return ( + (this.x *= e), + (this.y *= e), + (this.z *= e), + (this.w *= e), + this + ); + }), + (e.prototype.scaleAndAddToRef = function (e, t) { + return ( + (t.x += this.x * e), + (t.y += this.y * e), + (t.z += this.z * e), + (t.w += this.w * e), + this + ); + }), + (e.prototype.multiply = function (t) { + var i = new e(0, 0, 0, 1); + return this.multiplyToRef(t, i), i; + }), + (e.prototype.multiplyToRef = function (e, t) { + var i = + this.x * e.w + + this.y * e.z - + this.z * e.y + + this.w * e.x, + n = + -this.x * e.z + + this.y * e.w + + this.z * e.x + + this.w * e.y, + r = + this.x * e.y - + this.y * e.x + + this.z * e.w + + this.w * e.z, + o = + -this.x * e.x - + this.y * e.y - + this.z * e.z + + this.w * e.w; + return t.copyFromFloats(i, n, r, o), this; + }), + (e.prototype.multiplyInPlace = function (e) { + return this.multiplyToRef(e, this), this; + }), + (e.prototype.conjugateToRef = function (e) { + return ( + e.copyFromFloats(-this.x, -this.y, -this.z, this.w), + this + ); + }), + (e.prototype.conjugateInPlace = function () { + return ( + (this.x *= -1), (this.y *= -1), (this.z *= -1), this + ); + }), + (e.prototype.conjugate = function () { + return new e(-this.x, -this.y, -this.z, this.w); + }), + (e.prototype.length = function () { + return Math.sqrt( + this.x * this.x + + this.y * this.y + + this.z * this.z + + this.w * this.w + ); + }), + (e.prototype.normalize = function () { + var e = this.length(); + if (0 === e) return this; + var t = 1 / e; + return ( + (this.x *= t), + (this.y *= t), + (this.z *= t), + (this.w *= t), + this + ); + }), + (e.prototype.toEulerAngles = function (e) { + void 0 === e && (e = "YZX"); + var t = f.Zero(); + return this.toEulerAnglesToRef(t), t; + }), + (e.prototype.toEulerAnglesToRef = function (e) { + var t = this.z, + i = this.x, + n = this.y, + r = this.w, + o = r * r, + a = t * t, + s = i * i, + c = n * n, + u = n * t - i * r; + return ( + u < -0.4999999 + ? ((e.y = 2 * Math.atan2(n, r)), + (e.x = Math.PI / 2), + (e.z = 0)) + : u > 0.4999999 + ? ((e.y = 2 * Math.atan2(n, r)), + (e.x = -Math.PI / 2), + (e.z = 0)) + : ((e.z = Math.atan2( + 2 * (i * n + t * r), + -a - s + c + o + )), + (e.x = Math.asin(-2 * (t * n - i * r))), + (e.y = Math.atan2( + 2 * (t * i + n * r), + a - s - c + o + ))), + this + ); + }), + (e.prototype.toRotationMatrix = function (e) { + return g.FromQuaternionToRef(this, e), this; + }), + (e.prototype.fromRotationMatrix = function (t) { + return e.FromRotationMatrixToRef(t, this), this; + }), + (e.FromRotationMatrix = function (t) { + var i = new e(); + return e.FromRotationMatrixToRef(t, i), i; + }), + (e.FromRotationMatrixToRef = function (e, t) { + var i, + n = e.m, + r = n[0], + o = n[4], + a = n[8], + s = n[1], + c = n[5], + u = n[9], + l = n[2], + h = n[6], + f = n[10], + d = r + c + f; + d > 0 + ? ((i = 0.5 / Math.sqrt(d + 1)), + (t.w = 0.25 / i), + (t.x = (h - u) * i), + (t.y = (a - l) * i), + (t.z = (s - o) * i)) + : r > c && r > f + ? ((i = 2 * Math.sqrt(1 + r - c - f)), + (t.w = (h - u) / i), + (t.x = 0.25 * i), + (t.y = (o + s) / i), + (t.z = (a + l) / i)) + : c > f + ? ((i = 2 * Math.sqrt(1 + c - r - f)), + (t.w = (a - l) / i), + (t.x = (o + s) / i), + (t.y = 0.25 * i), + (t.z = (u + h) / i)) + : ((i = 2 * Math.sqrt(1 + f - r - c)), + (t.w = (s - o) / i), + (t.x = (a + l) / i), + (t.y = (u + h) / i), + (t.z = 0.25 * i)); + }), + (e.Dot = function (e, t) { + return e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w; + }), + (e.AreClose = function (t, i) { + return e.Dot(t, i) >= 0; + }), + (e.Zero = function () { + return new e(0, 0, 0, 0); + }), + (e.Inverse = function (t) { + return new e(-t.x, -t.y, -t.z, t.w); + }), + (e.InverseToRef = function (e, t) { + return t.set(-e.x, -e.y, -e.z, e.w), t; + }), + (e.Identity = function () { + return new e(0, 0, 0, 1); + }), + (e.IsIdentity = function (e) { + return ( + e && 0 === e.x && 0 === e.y && 0 === e.z && 1 === e.w + ); + }), + (e.RotationAxis = function (t, i) { + return e.RotationAxisToRef(t, i, new e()); + }), + (e.RotationAxisToRef = function (e, t, i) { + var n = Math.sin(t / 2); + return ( + e.normalize(), + (i.w = Math.cos(t / 2)), + (i.x = e.x * n), + (i.y = e.y * n), + (i.z = e.z * n), + i + ); + }), + (e.FromArray = function (t, i) { + return ( + i || (i = 0), new e(t[i], t[i + 1], t[i + 2], t[i + 3]) + ); + }), + (e.FromEulerAngles = function (t, i, n) { + var r = new e(); + return e.RotationYawPitchRollToRef(i, t, n, r), r; + }), + (e.FromEulerAnglesToRef = function (t, i, n, r) { + return e.RotationYawPitchRollToRef(i, t, n, r), r; + }), + (e.FromEulerVector = function (t) { + var i = new e(); + return e.RotationYawPitchRollToRef(t.y, t.x, t.z, i), i; + }), + (e.FromEulerVectorToRef = function (t, i) { + return e.RotationYawPitchRollToRef(t.y, t.x, t.z, i), i; + }), + (e.RotationYawPitchRoll = function (t, i, n) { + var r = new e(); + return e.RotationYawPitchRollToRef(t, i, n, r), r; + }), + (e.RotationYawPitchRollToRef = function (e, t, i, n) { + var r = 0.5 * i, + o = 0.5 * t, + a = 0.5 * e, + s = Math.sin(r), + c = Math.cos(r), + u = Math.sin(o), + l = Math.cos(o), + h = Math.sin(a), + f = Math.cos(a); + (n.x = f * u * c + h * l * s), + (n.y = h * l * c - f * u * s), + (n.z = f * l * s - h * u * c), + (n.w = f * l * c + h * u * s); + }), + (e.RotationAlphaBetaGamma = function (t, i, n) { + var r = new e(); + return e.RotationAlphaBetaGammaToRef(t, i, n, r), r; + }), + (e.RotationAlphaBetaGammaToRef = function (e, t, i, n) { + var r = 0.5 * (i + e), + o = 0.5 * (i - e), + a = 0.5 * t; + (n.x = Math.cos(o) * Math.sin(a)), + (n.y = Math.sin(o) * Math.sin(a)), + (n.z = Math.sin(r) * Math.cos(a)), + (n.w = Math.cos(r) * Math.cos(a)); + }), + (e.RotationQuaternionFromAxis = function (t, i, n) { + var r = new e(0, 0, 0, 0); + return e.RotationQuaternionFromAxisToRef(t, i, n, r), r; + }), + (e.RotationQuaternionFromAxisToRef = function (t, i, n, r) { + var o = w.Matrix[0]; + g.FromXYZAxesToRef( + t.normalize(), + i.normalize(), + n.normalize(), + o + ), + e.FromRotationMatrixToRef(o, r); + }), + (e.Slerp = function (t, i, n) { + var r = e.Identity(); + return e.SlerpToRef(t, i, n, r), r; + }), + (e.SlerpToRef = function (e, t, i, n) { + var r, + o, + a = e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w, + s = false; + if ((a < 0 && ((s = true), (a = -a)), a > 0.999999)) + (o = 1 - i), (r = s ? -i : i); + else { + var c = Math.acos(a), + u = 1 / Math.sin(c); + (o = Math.sin((1 - i) * c) * u), + (r = s ? -Math.sin(i * c) * u : Math.sin(i * c) * u); + } + (n.x = o * e.x + r * t.x), + (n.y = o * e.y + r * t.y), + (n.z = o * e.z + r * t.z), + (n.w = o * e.w + r * t.w); + }), + (e.Hermite = function (t, i, n, r, o) { + var a = o * o, + s = o * a, + c = 2 * s - 3 * a + 1, + u = -2 * s + 3 * a, + l = s - 2 * a + o, + h = s - a; + return new e( + t.x * c + n.x * u + i.x * l + r.x * h, + t.y * c + n.y * u + i.y * l + r.y * h, + t.z * c + n.z * u + i.z * l + r.z * h, + t.w * c + n.w * u + i.w * l + r.w * h + ); + }), + e + ); + })(), + g = (function () { + function e() { + (this._isIdentity = false), + (this._isIdentityDirty = true), + (this._isIdentity3x2 = true), + (this._isIdentity3x2Dirty = true), + (this.updateFlag = -1), + (this._m = new Float32Array(16)), + this._updateIdentityStatus(false); + } + return ( + Object.defineProperty(e.prototype, "m", { + get: function () { + return this._m; + }, + enumerable: true, + configurable: true, + }), + (e.prototype._markAsUpdated = function () { + (this.updateFlag = e._updateFlagSeed++), + (this._isIdentity = false), + (this._isIdentity3x2 = false), + (this._isIdentityDirty = true), + (this._isIdentity3x2Dirty = true); + }), + (e.prototype._updateIdentityStatus = function (t, i, n, r) { + void 0 === i && (i = false), void 0 === n && (n = false), void 0 === r && (r = true), - this.updateFlag = e._updateFlagSeed++, - this._isIdentity = t, - this._isIdentity3x2 = t || n, - this._isIdentityDirty = !this._isIdentity && i, - this._isIdentity3x2Dirty = !this._isIdentity3x2 && r - } - , - e.prototype.isIdentity = function() { - if (this._isIdentityDirty) { - this._isIdentityDirty = false; - var e = this._m; - this._isIdentity = 1 === e[0] && 0 === e[1] && 0 === e[2] && 0 === e[3] && 0 === e[4] && 1 === e[5] && 0 === e[6] && 0 === e[7] && 0 === e[8] && 0 === e[9] && 1 === e[10] && 0 === e[11] && 0 === e[12] && 0 === e[13] && 0 === e[14] && 1 === e[15] - } - return this._isIdentity - } - , - e.prototype.isIdentityAs3x2 = function() { - return this._isIdentity3x2Dirty && (this._isIdentity3x2Dirty = false, - 1 !== this._m[0] || 1 !== this._m[5] || 1 !== this._m[15] ? this._isIdentity3x2 = false : 0 !== this._m[1] || 0 !== this._m[2] || 0 !== this._m[3] || 0 !== this._m[4] || 0 !== this._m[6] || 0 !== this._m[7] || 0 !== this._m[8] || 0 !== this._m[9] || 0 !== this._m[10] || 0 !== this._m[11] || 0 !== this._m[12] || 0 !== this._m[13] || 0 !== this._m[14] ? this._isIdentity3x2 = false : this._isIdentity3x2 = true), + (this.updateFlag = e._updateFlagSeed++), + (this._isIdentity = t), + (this._isIdentity3x2 = t || n), + (this._isIdentityDirty = !this._isIdentity && i), + (this._isIdentity3x2Dirty = !this._isIdentity3x2 && r); + }), + (e.prototype.isIdentity = function () { + if (this._isIdentityDirty) { + this._isIdentityDirty = false; + var e = this._m; + this._isIdentity = + 1 === e[0] && + 0 === e[1] && + 0 === e[2] && + 0 === e[3] && + 0 === e[4] && + 1 === e[5] && + 0 === e[6] && + 0 === e[7] && + 0 === e[8] && + 0 === e[9] && + 1 === e[10] && + 0 === e[11] && + 0 === e[12] && + 0 === e[13] && + 0 === e[14] && + 1 === e[15]; + } + return this._isIdentity; + }), + (e.prototype.isIdentityAs3x2 = function () { + return ( + this._isIdentity3x2Dirty && + ((this._isIdentity3x2Dirty = false), + 1 !== this._m[0] || + 1 !== this._m[5] || + 1 !== this._m[15] + ? (this._isIdentity3x2 = false) + : 0 !== this._m[1] || + 0 !== this._m[2] || + 0 !== this._m[3] || + 0 !== this._m[4] || + 0 !== this._m[6] || + 0 !== this._m[7] || + 0 !== this._m[8] || + 0 !== this._m[9] || + 0 !== this._m[10] || + 0 !== this._m[11] || + 0 !== this._m[12] || + 0 !== this._m[13] || + 0 !== this._m[14] + ? (this._isIdentity3x2 = false) + : (this._isIdentity3x2 = true)), this._isIdentity3x2 - } - , - e.prototype.determinant = function() { - if (true === this._isIdentity) - return 1; - var e = this._m - , t = e[0] - , i = e[1] - , n = e[2] - , r = e[3] - , o = e[4] - , a = e[5] - , s = e[6] - , c = e[7] - , u = e[8] - , l = e[9] - , h = e[10] - , f = e[11] - , d = e[12] - , p = e[13] - , m = e[14] - , g = e[15] - , _ = h * g - m * f - , v = l * g - p * f - , y = l * m - p * h - , b = u * g - d * f - , E = u * m - h * d - , T = u * p - d * l; - return t * +(a * _ - s * v + c * y) + i * -(o * _ - s * b + c * E) + n * +(o * v - a * b + c * T) + r * -(o * y - a * E + s * T) - } - , - e.prototype.toArray = function() { - return this._m - } - , - e.prototype.asArray = function() { - return this._m - } - , - e.prototype.invert = function() { - return this.invertToRef(this), - this - } - , - e.prototype.reset = function() { - return e.FromValuesToRef(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this), + ); + }), + (e.prototype.determinant = function () { + if (true === this._isIdentity) return 1; + var e = this._m, + t = e[0], + i = e[1], + n = e[2], + r = e[3], + o = e[4], + a = e[5], + s = e[6], + c = e[7], + u = e[8], + l = e[9], + h = e[10], + f = e[11], + d = e[12], + p = e[13], + m = e[14], + g = e[15], + _ = h * g - m * f, + v = l * g - p * f, + y = l * m - p * h, + b = u * g - d * f, + E = u * m - h * d, + T = u * p - d * l; + return ( + t * +(a * _ - s * v + c * y) + + i * -(o * _ - s * b + c * E) + + n * +(o * v - a * b + c * T) + + r * -(o * y - a * E + s * T) + ); + }), + (e.prototype.toArray = function () { + return this._m; + }), + (e.prototype.asArray = function () { + return this._m; + }), + (e.prototype.invert = function () { + return this.invertToRef(this), this; + }), + (e.prototype.reset = function () { + return ( + e.FromValuesToRef( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + this + ), this._updateIdentityStatus(false), this - } - , - e.prototype.add = function(t) { - var i = new e; - return this.addToRef(t, i), - i - } - , - e.prototype.addToRef = function(e, t) { - for (var i = this._m, n = t._m, r = e.m, o = 0; o < 16; o++) - n[o] = i[o] + r[o]; - return t._markAsUpdated(), + ); + }), + (e.prototype.add = function (t) { + var i = new e(); + return this.addToRef(t, i), i; + }), + (e.prototype.addToRef = function (e, t) { + for ( + var i = this._m, n = t._m, r = e.m, o = 0; + o < 16; + o++ + ) + n[o] = i[o] + r[o]; + return t._markAsUpdated(), this; + }), + (e.prototype.addToSelf = function (e) { + for (var t = this._m, i = e.m, n = 0; n < 16; n++) + t[n] += i[n]; + return this._markAsUpdated(), this; + }), + (e.prototype.invertToRef = function (t) { + if (true === this._isIdentity) + return e.IdentityToRef(t), this; + var i = this._m, + n = i[0], + r = i[1], + o = i[2], + a = i[3], + s = i[4], + c = i[5], + u = i[6], + l = i[7], + h = i[8], + f = i[9], + d = i[10], + p = i[11], + m = i[12], + g = i[13], + _ = i[14], + v = i[15], + y = d * v - _ * p, + b = f * v - g * p, + E = f * _ - g * d, + T = h * v - m * p, + A = h * _ - d * m, + x = h * g - m * f, + S = +(c * y - u * b + l * E), + C = -(s * y - u * T + l * A), + P = +(s * b - c * T + l * x), + R = -(s * E - c * A + u * x), + M = n * S + r * C + o * P + a * R; + if (0 === M) return t.copyFrom(this), this; + var O = 1 / M, + w = u * v - _ * l, + I = c * v - g * l, + D = c * _ - g * u, + L = s * v - m * l, + F = s * _ - m * u, + B = s * g - m * c, + N = u * p - d * l, + k = c * p - f * l, + U = c * d - f * u, + V = s * p - h * l, + G = s * d - h * u, + z = s * f - h * c, + j = -(r * y - o * b + a * E), + H = +(n * y - o * T + a * A), + W = -(n * b - r * T + a * x), + X = +(n * E - r * A + o * x), + Y = +(r * w - o * I + a * D), + K = -(n * w - o * L + a * F), + Q = +(n * I - r * L + a * B), + q = -(n * D - r * F + o * B), + Z = -(r * N - o * k + a * U), + J = +(n * N - o * V + a * G), + $ = -(n * k - r * V + a * z), + ee = +(n * U - r * G + o * z); + return ( + e.FromValuesToRef( + S * O, + j * O, + Y * O, + Z * O, + C * O, + H * O, + K * O, + J * O, + P * O, + W * O, + Q * O, + $ * O, + R * O, + X * O, + q * O, + ee * O, + t + ), this - } - , - e.prototype.addToSelf = function(e) { - for (var t = this._m, i = e.m, n = 0; n < 16; n++) - t[n] += i[n]; - return this._markAsUpdated(), - this - } - , - e.prototype.invertToRef = function(t) { - if (true === this._isIdentity) - return e.IdentityToRef(t), - this; - var i = this._m - , n = i[0] - , r = i[1] - , o = i[2] - , a = i[3] - , s = i[4] - , c = i[5] - , u = i[6] - , l = i[7] - , h = i[8] - , f = i[9] - , d = i[10] - , p = i[11] - , m = i[12] - , g = i[13] - , _ = i[14] - , v = i[15] - , y = d * v - _ * p - , b = f * v - g * p - , E = f * _ - g * d - , T = h * v - m * p - , A = h * _ - d * m - , x = h * g - m * f - , S = +(c * y - u * b + l * E) - , C = -(s * y - u * T + l * A) - , P = +(s * b - c * T + l * x) - , R = -(s * E - c * A + u * x) - , M = n * S + r * C + o * P + a * R; - if (0 === M) - return t.copyFrom(this), - this; - var O = 1 / M - , w = u * v - _ * l - , I = c * v - g * l - , D = c * _ - g * u - , L = s * v - m * l - , F = s * _ - m * u - , B = s * g - m * c - , N = u * p - d * l - , k = c * p - f * l - , U = c * d - f * u - , V = s * p - h * l - , G = s * d - h * u - , z = s * f - h * c - , j = -(r * y - o * b + a * E) - , H = +(n * y - o * T + a * A) - , W = -(n * b - r * T + a * x) - , X = +(n * E - r * A + o * x) - , Y = +(r * w - o * I + a * D) - , K = -(n * w - o * L + a * F) - , Q = +(n * I - r * L + a * B) - , q = -(n * D - r * F + o * B) - , Z = -(r * N - o * k + a * U) - , J = +(n * N - o * V + a * G) - , $ = -(n * k - r * V + a * z) - , ee = +(n * U - r * G + o * z); - return e.FromValuesToRef(S * O, j * O, Y * O, Z * O, C * O, H * O, K * O, J * O, P * O, W * O, Q * O, $ * O, R * O, X * O, q * O, ee * O, t), - this - } - , - e.prototype.addAtIndex = function(e, t) { - return this._m[e] += t, + ); + }), + (e.prototype.addAtIndex = function (e, t) { + return (this._m[e] += t), this._markAsUpdated(), this; + }), + (e.prototype.multiplyAtIndex = function (e, t) { + return (this._m[e] *= t), this._markAsUpdated(), this; + }), + (e.prototype.setTranslationFromFloats = function (e, t, i) { + return ( + (this._m[12] = e), + (this._m[13] = t), + (this._m[14] = i), this._markAsUpdated(), this - } - , - e.prototype.multiplyAtIndex = function(e, t) { - return this._m[e] *= t, + ); + }), + (e.prototype.addTranslationFromFloats = function (e, t, i) { + return ( + (this._m[12] += e), + (this._m[13] += t), + (this._m[14] += i), this._markAsUpdated(), this - } - , - e.prototype.setTranslationFromFloats = function(e, t, i) { - return this._m[12] = e, - this._m[13] = t, - this._m[14] = i, - this._markAsUpdated(), + ); + }), + (e.prototype.setTranslation = function (e) { + return this.setTranslationFromFloats(e.x, e.y, e.z); + }), + (e.prototype.getTranslation = function () { + return new f(this._m[12], this._m[13], this._m[14]); + }), + (e.prototype.getTranslationToRef = function (e) { + return ( + (e.x = this._m[12]), + (e.y = this._m[13]), + (e.z = this._m[14]), this - } - , - e.prototype.addTranslationFromFloats = function(e, t, i) { - return this._m[12] += e, - this._m[13] += t, - this._m[14] += i, - this._markAsUpdated(), + ); + }), + (e.prototype.removeRotationAndScaling = function () { + var t = this.m; + return ( + e.FromValuesToRef( + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + t[12], + t[13], + t[14], + t[15], + this + ), + this._updateIdentityStatus( + 0 === t[12] && + 0 === t[13] && + 0 === t[14] && + 1 === t[15] + ), this - } - , - e.prototype.setTranslation = function(e) { - return this.setTranslationFromFloats(e.x, e.y, e.z) - } - , - e.prototype.getTranslation = function() { - return new f(this._m[12],this._m[13],this._m[14]) - } - , - e.prototype.getTranslationToRef = function(e) { - return e.x = this._m[12], - e.y = this._m[13], - e.z = this._m[14], + ); + }), + (e.prototype.multiply = function (t) { + var i = new e(); + return this.multiplyToRef(t, i), i; + }), + (e.prototype.copyFrom = function (e) { + e.copyToArray(this._m); + var t = e; + return ( + this._updateIdentityStatus( + t._isIdentity, + t._isIdentityDirty, + t._isIdentity3x2, + t._isIdentity3x2Dirty + ), this - } - , - e.prototype.removeRotationAndScaling = function() { - var t = this.m; - return e.FromValuesToRef(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, t[12], t[13], t[14], t[15], this), - this._updateIdentityStatus(0 === t[12] && 0 === t[13] && 0 === t[14] && 1 === t[15]), + ); + }), + (e.prototype.copyToArray = function (e, t) { + void 0 === t && (t = 0); + for (var i = 0; i < 16; i++) e[t + i] = this._m[i]; + return this; + }), + (e.prototype.multiplyToRef = function (e, t) { + return this._isIdentity + ? (t.copyFrom(e), this) + : e._isIdentity + ? (t.copyFrom(this), this) + : (this.multiplyToArray(e, t._m, 0), + t._markAsUpdated(), + this); + }), + (e.prototype.multiplyToArray = function (e, t, i) { + var n = this._m, + r = e.m, + o = n[0], + a = n[1], + s = n[2], + c = n[3], + u = n[4], + l = n[5], + h = n[6], + f = n[7], + d = n[8], + p = n[9], + m = n[10], + g = n[11], + _ = n[12], + v = n[13], + y = n[14], + b = n[15], + E = r[0], + T = r[1], + A = r[2], + x = r[3], + S = r[4], + C = r[5], + P = r[6], + R = r[7], + M = r[8], + O = r[9], + w = r[10], + I = r[11], + D = r[12], + L = r[13], + F = r[14], + B = r[15]; + return ( + (t[i] = o * E + a * S + s * M + c * D), + (t[i + 1] = o * T + a * C + s * O + c * L), + (t[i + 2] = o * A + a * P + s * w + c * F), + (t[i + 3] = o * x + a * R + s * I + c * B), + (t[i + 4] = u * E + l * S + h * M + f * D), + (t[i + 5] = u * T + l * C + h * O + f * L), + (t[i + 6] = u * A + l * P + h * w + f * F), + (t[i + 7] = u * x + l * R + h * I + f * B), + (t[i + 8] = d * E + p * S + m * M + g * D), + (t[i + 9] = d * T + p * C + m * O + g * L), + (t[i + 10] = d * A + p * P + m * w + g * F), + (t[i + 11] = d * x + p * R + m * I + g * B), + (t[i + 12] = _ * E + v * S + y * M + b * D), + (t[i + 13] = _ * T + v * C + y * O + b * L), + (t[i + 14] = _ * A + v * P + y * w + b * F), + (t[i + 15] = _ * x + v * R + y * I + b * B), this - } - , - e.prototype.multiply = function(t) { - var i = new e; - return this.multiplyToRef(t, i), - i - } - , - e.prototype.copyFrom = function(e) { - e.copyToArray(this._m); - var t = e; - return this._updateIdentityStatus(t._isIdentity, t._isIdentityDirty, t._isIdentity3x2, t._isIdentity3x2Dirty), - this - } - , - e.prototype.copyToArray = function(e, t) { - void 0 === t && (t = 0); - for (var i = 0; i < 16; i++) - e[t + i] = this._m[i]; - return this - } - , - e.prototype.multiplyToRef = function(e, t) { - return this._isIdentity ? (t.copyFrom(e), - this) : e._isIdentity ? (t.copyFrom(this), - this) : (this.multiplyToArray(e, t._m, 0), - t._markAsUpdated(), - this) - } - , - e.prototype.multiplyToArray = function(e, t, i) { - var n = this._m - , r = e.m - , o = n[0] - , a = n[1] - , s = n[2] - , c = n[3] - , u = n[4] - , l = n[5] - , h = n[6] - , f = n[7] - , d = n[8] - , p = n[9] - , m = n[10] - , g = n[11] - , _ = n[12] - , v = n[13] - , y = n[14] - , b = n[15] - , E = r[0] - , T = r[1] - , A = r[2] - , x = r[3] - , S = r[4] - , C = r[5] - , P = r[6] - , R = r[7] - , M = r[8] - , O = r[9] - , w = r[10] - , I = r[11] - , D = r[12] - , L = r[13] - , F = r[14] - , B = r[15]; - return t[i] = o * E + a * S + s * M + c * D, - t[i + 1] = o * T + a * C + s * O + c * L, - t[i + 2] = o * A + a * P + s * w + c * F, - t[i + 3] = o * x + a * R + s * I + c * B, - t[i + 4] = u * E + l * S + h * M + f * D, - t[i + 5] = u * T + l * C + h * O + f * L, - t[i + 6] = u * A + l * P + h * w + f * F, - t[i + 7] = u * x + l * R + h * I + f * B, - t[i + 8] = d * E + p * S + m * M + g * D, - t[i + 9] = d * T + p * C + m * O + g * L, - t[i + 10] = d * A + p * P + m * w + g * F, - t[i + 11] = d * x + p * R + m * I + g * B, - t[i + 12] = _ * E + v * S + y * M + b * D, - t[i + 13] = _ * T + v * C + y * O + b * L, - t[i + 14] = _ * A + v * P + y * w + b * F, - t[i + 15] = _ * x + v * R + y * I + b * B, - this - } - , - e.prototype.equals = function(e) { - var t = e; - if (!t) - return false; - if ((this._isIdentity || t._isIdentity) && !this._isIdentityDirty && !t._isIdentityDirty) - return this._isIdentity && t._isIdentity; - var i = this.m - , n = t.m; - return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5] && i[6] === n[6] && i[7] === n[7] && i[8] === n[8] && i[9] === n[9] && i[10] === n[10] && i[11] === n[11] && i[12] === n[12] && i[13] === n[13] && i[14] === n[14] && i[15] === n[15] - } - , - e.prototype.clone = function() { - var t = new e; - return t.copyFrom(this), - t - } - , - e.prototype.getClassName = function() { - return "Matrix" - } - , - e.prototype.getHashCode = function() { - for (var e = this._m[0] || 0, t = 1; t < 16; t++) - e = 397 * e ^ (this._m[t] || 0); - return e - } - , - e.prototype.decompose = function(t, i, n) { - if (this._isIdentity) - return n && n.setAll(0), - t && t.setAll(1), - i && i.copyFromFloats(0, 0, 0, 1), - true; - var r = this._m; - if (n && n.copyFromFloats(r[12], r[13], r[14]), - (t = t || w.Vector3[0]).x = Math.sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]), - t.y = Math.sqrt(r[4] * r[4] + r[5] * r[5] + r[6] * r[6]), - t.z = Math.sqrt(r[8] * r[8] + r[9] * r[9] + r[10] * r[10]), + ); + }), + (e.prototype.equals = function (e) { + var t = e; + if (!t) return false; + if ( + (this._isIdentity || t._isIdentity) && + !this._isIdentityDirty && + !t._isIdentityDirty + ) + return this._isIdentity && t._isIdentity; + var i = this.m, + n = t.m; + return ( + i[0] === n[0] && + i[1] === n[1] && + i[2] === n[2] && + i[3] === n[3] && + i[4] === n[4] && + i[5] === n[5] && + i[6] === n[6] && + i[7] === n[7] && + i[8] === n[8] && + i[9] === n[9] && + i[10] === n[10] && + i[11] === n[11] && + i[12] === n[12] && + i[13] === n[13] && + i[14] === n[14] && + i[15] === n[15] + ); + }), + (e.prototype.clone = function () { + var t = new e(); + return t.copyFrom(this), t; + }), + (e.prototype.getClassName = function () { + return "Matrix"; + }), + (e.prototype.getHashCode = function () { + for (var e = this._m[0] || 0, t = 1; t < 16; t++) + e = (397 * e) ^ (this._m[t] || 0); + return e; + }), + (e.prototype.decompose = function (t, i, n) { + if (this._isIdentity) + return ( + n && n.setAll(0), + t && t.setAll(1), + i && i.copyFromFloats(0, 0, 0, 1), + true + ); + var r = this._m; + if ( + (n && n.copyFromFloats(r[12], r[13], r[14]), + ((t = t || w.Vector3[0]).x = Math.sqrt( + r[0] * r[0] + r[1] * r[1] + r[2] * r[2] + )), + (t.y = Math.sqrt( + r[4] * r[4] + r[5] * r[5] + r[6] * r[6] + )), + (t.z = Math.sqrt( + r[8] * r[8] + r[9] * r[9] + r[10] * r[10] + )), this.determinant() <= 0 && (t.y *= -1), 0 === t.x || 0 === t.y || 0 === t.z) - return i && i.copyFromFloats(0, 0, 0, 1), - false; - if (i) { - var o = 1 / t.x - , a = 1 / t.y - , s = 1 / t.z; - e.FromValuesToRef(r[0] * o, r[1] * o, r[2] * o, 0, r[4] * a, r[5] * a, r[6] * a, 0, r[8] * s, r[9] * s, r[10] * s, 0, 0, 0, 0, 1, w.Matrix[0]), - m.FromRotationMatrixToRef(w.Matrix[0], i) - } - return true - } - , - e.prototype.getRow = function(e) { - if (e < 0 || e > 3) - return null; - var t = 4 * e; - return new d(this._m[t + 0],this._m[t + 1],this._m[t + 2],this._m[t + 3]) - } - , - e.prototype.setRow = function(e, t) { - return this.setRowFromFloats(e, t.x, t.y, t.z, t.w) - } - , - e.prototype.transpose = function() { - return e.Transpose(this) - } - , - e.prototype.transposeToRef = function(t) { - return e.TransposeToRef(this, t), - this - } - , - e.prototype.setRowFromFloats = function(e, t, i, n, r) { - if (e < 0 || e > 3) - return this; - var o = 4 * e; - return this._m[o + 0] = t, - this._m[o + 1] = i, - this._m[o + 2] = n, - this._m[o + 3] = r, + ) + return i && i.copyFromFloats(0, 0, 0, 1), false; + if (i) { + var o = 1 / t.x, + a = 1 / t.y, + s = 1 / t.z; + e.FromValuesToRef( + r[0] * o, + r[1] * o, + r[2] * o, + 0, + r[4] * a, + r[5] * a, + r[6] * a, + 0, + r[8] * s, + r[9] * s, + r[10] * s, + 0, + 0, + 0, + 0, + 1, + w.Matrix[0] + ), + m.FromRotationMatrixToRef(w.Matrix[0], i); + } + return true; + }), + (e.prototype.getRow = function (e) { + if (e < 0 || e > 3) return null; + var t = 4 * e; + return new d( + this._m[t + 0], + this._m[t + 1], + this._m[t + 2], + this._m[t + 3] + ); + }), + (e.prototype.setRow = function (e, t) { + return this.setRowFromFloats(e, t.x, t.y, t.z, t.w); + }), + (e.prototype.transpose = function () { + return e.Transpose(this); + }), + (e.prototype.transposeToRef = function (t) { + return e.TransposeToRef(this, t), this; + }), + (e.prototype.setRowFromFloats = function (e, t, i, n, r) { + if (e < 0 || e > 3) return this; + var o = 4 * e; + return ( + (this._m[o + 0] = t), + (this._m[o + 1] = i), + (this._m[o + 2] = n), + (this._m[o + 3] = r), this._markAsUpdated(), this - } - , - e.prototype.scale = function(t) { - var i = new e; - return this.scaleToRef(t, i), - i - } - , - e.prototype.scaleToRef = function(e, t) { - for (var i = 0; i < 16; i++) - t._m[i] = this._m[i] * e; - return t._markAsUpdated(), - this - } - , - e.prototype.scaleAndAddToRef = function(e, t) { - for (var i = 0; i < 16; i++) - t._m[i] += this._m[i] * e; - return t._markAsUpdated(), - this - } - , - e.prototype.toNormalMatrix = function(t) { - var i = w.Matrix[0]; - this.invertToRef(i), - i.transposeToRef(t); - var n = t._m; - e.FromValuesToRef(n[0], n[1], n[2], 0, n[4], n[5], n[6], 0, n[8], n[9], n[10], 0, 0, 0, 0, 1, t) - } - , - e.prototype.getRotationMatrix = function() { - var t = new e; - return this.getRotationMatrixToRef(t), - t - } - , - e.prototype.getRotationMatrixToRef = function(t) { - var i = w.Vector3[0]; - if (!this.decompose(i)) - return e.IdentityToRef(t), - this; - var n = this._m - , r = 1 / i.x - , o = 1 / i.y - , a = 1 / i.z; - return e.FromValuesToRef(n[0] * r, n[1] * r, n[2] * r, 0, n[4] * o, n[5] * o, n[6] * o, 0, n[8] * a, n[9] * a, n[10] * a, 0, 0, 0, 0, 1, t), - this - } - , - e.prototype.toggleModelMatrixHandInPlace = function() { - var e = this._m; - e[2] *= -1, - e[6] *= -1, - e[8] *= -1, - e[9] *= -1, - e[14] *= -1, - this._markAsUpdated() - } - , - e.prototype.toggleProjectionMatrixHandInPlace = function() { - var e = this._m; - e[8] *= -1, - e[9] *= -1, - e[10] *= -1, - e[11] *= -1, - this._markAsUpdated() - } - , - e.FromArray = function(t, i) { - void 0 === i && (i = 0); - var n = new e; - return e.FromArrayToRef(t, i, n), - n - } - , - e.FromArrayToRef = function(e, t, i) { - for (var n = 0; n < 16; n++) - i._m[n] = e[n + t]; - i._markAsUpdated() - } - , - e.FromFloat32ArrayToRefScaled = function(e, t, i, n) { - for (var r = 0; r < 16; r++) - n._m[r] = e[r + t] * i; - n._markAsUpdated() - } - , - Object.defineProperty(e, "IdentityReadOnly", { - get: function() { - return e._identityReadOnly - }, - enumerable: true, - configurable: true + ); }), - e.FromValuesToRef = function(e, t, i, n, r, o, a, s, c, u, l, h, f, d, p, m, g) { - var _ = g._m; - _[0] = e, - _[1] = t, - _[2] = i, - _[3] = n, - _[4] = r, - _[5] = o, - _[6] = a, - _[7] = s, - _[8] = c, - _[9] = u, - _[10] = l, - _[11] = h, - _[12] = f, - _[13] = d, - _[14] = p, - _[15] = m, - g._markAsUpdated() - } - , - e.FromValues = function(t, i, n, r, o, a, s, c, u, l, h, f, d, p, m, g) { - var _ = new e - , v = _._m; - return v[0] = t, - v[1] = i, - v[2] = n, - v[3] = r, - v[4] = o, - v[5] = a, - v[6] = s, - v[7] = c, - v[8] = u, - v[9] = l, - v[10] = h, - v[11] = f, - v[12] = d, - v[13] = p, - v[14] = m, - v[15] = g, + (e.prototype.scale = function (t) { + var i = new e(); + return this.scaleToRef(t, i), i; + }), + (e.prototype.scaleToRef = function (e, t) { + for (var i = 0; i < 16; i++) t._m[i] = this._m[i] * e; + return t._markAsUpdated(), this; + }), + (e.prototype.scaleAndAddToRef = function (e, t) { + for (var i = 0; i < 16; i++) t._m[i] += this._m[i] * e; + return t._markAsUpdated(), this; + }), + (e.prototype.toNormalMatrix = function (t) { + var i = w.Matrix[0]; + this.invertToRef(i), i.transposeToRef(t); + var n = t._m; + e.FromValuesToRef( + n[0], + n[1], + n[2], + 0, + n[4], + n[5], + n[6], + 0, + n[8], + n[9], + n[10], + 0, + 0, + 0, + 0, + 1, + t + ); + }), + (e.prototype.getRotationMatrix = function () { + var t = new e(); + return this.getRotationMatrixToRef(t), t; + }), + (e.prototype.getRotationMatrixToRef = function (t) { + var i = w.Vector3[0]; + if (!this.decompose(i)) return e.IdentityToRef(t), this; + var n = this._m, + r = 1 / i.x, + o = 1 / i.y, + a = 1 / i.z; + return ( + e.FromValuesToRef( + n[0] * r, + n[1] * r, + n[2] * r, + 0, + n[4] * o, + n[5] * o, + n[6] * o, + 0, + n[8] * a, + n[9] * a, + n[10] * a, + 0, + 0, + 0, + 0, + 1, + t + ), + this + ); + }), + (e.prototype.toggleModelMatrixHandInPlace = function () { + var e = this._m; + (e[2] *= -1), + (e[6] *= -1), + (e[8] *= -1), + (e[9] *= -1), + (e[14] *= -1), + this._markAsUpdated(); + }), + (e.prototype.toggleProjectionMatrixHandInPlace = + function () { + var e = this._m; + (e[8] *= -1), + (e[9] *= -1), + (e[10] *= -1), + (e[11] *= -1), + this._markAsUpdated(); + }), + (e.FromArray = function (t, i) { + void 0 === i && (i = 0); + var n = new e(); + return e.FromArrayToRef(t, i, n), n; + }), + (e.FromArrayToRef = function (e, t, i) { + for (var n = 0; n < 16; n++) i._m[n] = e[n + t]; + i._markAsUpdated(); + }), + (e.FromFloat32ArrayToRefScaled = function (e, t, i, n) { + for (var r = 0; r < 16; r++) n._m[r] = e[r + t] * i; + n._markAsUpdated(); + }), + Object.defineProperty(e, "IdentityReadOnly", { + get: function () { + return e._identityReadOnly; + }, + enumerable: true, + configurable: true, + }), + (e.FromValuesToRef = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u, + l, + h, + f, + d, + p, + m, + g + ) { + var _ = g._m; + (_[0] = e), + (_[1] = t), + (_[2] = i), + (_[3] = n), + (_[4] = r), + (_[5] = o), + (_[6] = a), + (_[7] = s), + (_[8] = c), + (_[9] = u), + (_[10] = l), + (_[11] = h), + (_[12] = f), + (_[13] = d), + (_[14] = p), + (_[15] = m), + g._markAsUpdated(); + }), + (e.FromValues = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u, + l, + h, + f, + d, + p, + m, + g + ) { + var _ = new e(), + v = _._m; + return ( + (v[0] = t), + (v[1] = i), + (v[2] = n), + (v[3] = r), + (v[4] = o), + (v[5] = a), + (v[6] = s), + (v[7] = c), + (v[8] = u), + (v[9] = l), + (v[10] = h), + (v[11] = f), + (v[12] = d), + (v[13] = p), + (v[14] = m), + (v[15] = g), _._markAsUpdated(), _ - } - , - e.Compose = function(t, i, n) { - var r = new e; - return e.ComposeToRef(t, i, n, r), - r - } - , - e.ComposeToRef = function(e, t, i, n) { - var r = n._m - , o = t.x - , a = t.y - , s = t.z - , c = t.w - , u = o + o - , l = a + a - , h = s + s - , f = o * u - , d = o * l - , p = o * h - , m = a * l - , g = a * h - , _ = s * h - , v = c * u - , y = c * l - , b = c * h - , E = e.x - , T = e.y - , A = e.z; - r[0] = (1 - (m + _)) * E, - r[1] = (d + b) * E, - r[2] = (p - y) * E, - r[3] = 0, - r[4] = (d - b) * T, - r[5] = (1 - (f + _)) * T, - r[6] = (g + v) * T, - r[7] = 0, - r[8] = (p + y) * A, - r[9] = (g - v) * A, - r[10] = (1 - (f + m)) * A, - r[11] = 0, - r[12] = i.x, - r[13] = i.y, - r[14] = i.z, - r[15] = 1, - n._markAsUpdated() - } - , - e.Identity = function() { - var t = e.FromValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - return t._updateIdentityStatus(true), + ); + }), + (e.Compose = function (t, i, n) { + var r = new e(); + return e.ComposeToRef(t, i, n, r), r; + }), + (e.ComposeToRef = function (e, t, i, n) { + var r = n._m, + o = t.x, + a = t.y, + s = t.z, + c = t.w, + u = o + o, + l = a + a, + h = s + s, + f = o * u, + d = o * l, + p = o * h, + m = a * l, + g = a * h, + _ = s * h, + v = c * u, + y = c * l, + b = c * h, + E = e.x, + T = e.y, + A = e.z; + (r[0] = (1 - (m + _)) * E), + (r[1] = (d + b) * E), + (r[2] = (p - y) * E), + (r[3] = 0), + (r[4] = (d - b) * T), + (r[5] = (1 - (f + _)) * T), + (r[6] = (g + v) * T), + (r[7] = 0), + (r[8] = (p + y) * A), + (r[9] = (g - v) * A), + (r[10] = (1 - (f + m)) * A), + (r[11] = 0), + (r[12] = i.x), + (r[13] = i.y), + (r[14] = i.z), + (r[15] = 1), + n._markAsUpdated(); + }), + (e.Identity = function () { + var t = e.FromValues( + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ); + return t._updateIdentityStatus(true), t; + }), + (e.IdentityToRef = function (t) { + e.FromValuesToRef( + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, t - } - , - e.IdentityToRef = function(t) { - e.FromValuesToRef(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, t), - t._updateIdentityStatus(true) - } - , - e.Zero = function() { - var t = e.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - return t._updateIdentityStatus(false), - t - } - , - e.RotationX = function(t) { - var i = new e; - return e.RotationXToRef(t, i), + ), + t._updateIdentityStatus(true); + }), + (e.Zero = function () { + var t = e.FromValues( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ); + return t._updateIdentityStatus(false), t; + }), + (e.RotationX = function (t) { + var i = new e(); + return e.RotationXToRef(t, i), i; + }), + (e.Invert = function (t) { + var i = new e(); + return t.invertToRef(i), i; + }), + (e.RotationXToRef = function (t, i) { + var n = Math.sin(t), + r = Math.cos(t); + e.FromValuesToRef( + 1, + 0, + 0, + 0, + 0, + r, + n, + 0, + 0, + -n, + r, + 0, + 0, + 0, + 0, + 1, i - } - , - e.Invert = function(t) { - var i = new e; - return t.invertToRef(i), + ), + i._updateIdentityStatus(1 === r && 0 === n); + }), + (e.RotationY = function (t) { + var i = new e(); + return e.RotationYToRef(t, i), i; + }), + (e.RotationYToRef = function (t, i) { + var n = Math.sin(t), + r = Math.cos(t); + e.FromValuesToRef( + r, + 0, + -n, + 0, + 0, + 1, + 0, + 0, + n, + 0, + r, + 0, + 0, + 0, + 0, + 1, i - } - , - e.RotationXToRef = function(t, i) { - var n = Math.sin(t) - , r = Math.cos(t); - e.FromValuesToRef(1, 0, 0, 0, 0, r, n, 0, 0, -n, r, 0, 0, 0, 0, 1, i), - i._updateIdentityStatus(1 === r && 0 === n) - } - , - e.RotationY = function(t) { - var i = new e; - return e.RotationYToRef(t, i), + ), + i._updateIdentityStatus(1 === r && 0 === n); + }), + (e.RotationZ = function (t) { + var i = new e(); + return e.RotationZToRef(t, i), i; + }), + (e.RotationZToRef = function (t, i) { + var n = Math.sin(t), + r = Math.cos(t); + e.FromValuesToRef( + r, + n, + 0, + 0, + -n, + r, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, i - } - , - e.RotationYToRef = function(t, i) { - var n = Math.sin(t) - , r = Math.cos(t); - e.FromValuesToRef(r, 0, -n, 0, 0, 1, 0, 0, n, 0, r, 0, 0, 0, 0, 1, i), - i._updateIdentityStatus(1 === r && 0 === n) - } - , - e.RotationZ = function(t) { - var i = new e; - return e.RotationZToRef(t, i), - i - } - , - e.RotationZToRef = function(t, i) { - var n = Math.sin(t) - , r = Math.cos(t); - e.FromValuesToRef(r, n, 0, 0, -n, r, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, i), - i._updateIdentityStatus(1 === r && 0 === n) - } - , - e.RotationAxis = function(t, i) { - var n = new e; - return e.RotationAxisToRef(t, i, n), - n - } - , - e.RotationAxisToRef = function(e, t, i) { - var n = Math.sin(-t) - , r = Math.cos(-t) - , o = 1 - r; - e.normalize(); - var a = i._m; - a[0] = e.x * e.x * o + r, - a[1] = e.x * e.y * o - e.z * n, - a[2] = e.x * e.z * o + e.y * n, - a[3] = 0, - a[4] = e.y * e.x * o + e.z * n, - a[5] = e.y * e.y * o + r, - a[6] = e.y * e.z * o - e.x * n, - a[7] = 0, - a[8] = e.z * e.x * o - e.y * n, - a[9] = e.z * e.y * o + e.x * n, - a[10] = e.z * e.z * o + r, - a[11] = 0, - a[12] = 0, - a[13] = 0, - a[14] = 0, - a[15] = 1, - i._markAsUpdated() - } - , - e.RotationAlignToRef = function(e, t, i) { - var n = f.Cross(t, e) - , r = f.Dot(t, e) - , o = 1 / (1 + r) - , a = i._m; - a[0] = n.x * n.x * o + r, - a[1] = n.y * n.x * o - n.z, - a[2] = n.z * n.x * o + n.y, - a[3] = 0, - a[4] = n.x * n.y * o + n.z, - a[5] = n.y * n.y * o + r, - a[6] = n.z * n.y * o - n.x, - a[7] = 0, - a[8] = n.x * n.z * o - n.y, - a[9] = n.y * n.z * o + n.x, - a[10] = n.z * n.z * o + r, - a[11] = 0, - a[12] = 0, - a[13] = 0, - a[14] = 0, - a[15] = 1, - i._markAsUpdated() - } - , - e.RotationYawPitchRoll = function(t, i, n) { - var r = new e; - return e.RotationYawPitchRollToRef(t, i, n, r), + ), + i._updateIdentityStatus(1 === r && 0 === n); + }), + (e.RotationAxis = function (t, i) { + var n = new e(); + return e.RotationAxisToRef(t, i, n), n; + }), + (e.RotationAxisToRef = function (e, t, i) { + var n = Math.sin(-t), + r = Math.cos(-t), + o = 1 - r; + e.normalize(); + var a = i._m; + (a[0] = e.x * e.x * o + r), + (a[1] = e.x * e.y * o - e.z * n), + (a[2] = e.x * e.z * o + e.y * n), + (a[3] = 0), + (a[4] = e.y * e.x * o + e.z * n), + (a[5] = e.y * e.y * o + r), + (a[6] = e.y * e.z * o - e.x * n), + (a[7] = 0), + (a[8] = e.z * e.x * o - e.y * n), + (a[9] = e.z * e.y * o + e.x * n), + (a[10] = e.z * e.z * o + r), + (a[11] = 0), + (a[12] = 0), + (a[13] = 0), + (a[14] = 0), + (a[15] = 1), + i._markAsUpdated(); + }), + (e.RotationAlignToRef = function (e, t, i) { + var n = f.Cross(t, e), + r = f.Dot(t, e), + o = 1 / (1 + r), + a = i._m; + (a[0] = n.x * n.x * o + r), + (a[1] = n.y * n.x * o - n.z), + (a[2] = n.z * n.x * o + n.y), + (a[3] = 0), + (a[4] = n.x * n.y * o + n.z), + (a[5] = n.y * n.y * o + r), + (a[6] = n.z * n.y * o - n.x), + (a[7] = 0), + (a[8] = n.x * n.z * o - n.y), + (a[9] = n.y * n.z * o + n.x), + (a[10] = n.z * n.z * o + r), + (a[11] = 0), + (a[12] = 0), + (a[13] = 0), + (a[14] = 0), + (a[15] = 1), + i._markAsUpdated(); + }), + (e.RotationYawPitchRoll = function (t, i, n) { + var r = new e(); + return e.RotationYawPitchRollToRef(t, i, n, r), r; + }), + (e.RotationYawPitchRollToRef = function (e, t, i, n) { + m.RotationYawPitchRollToRef(e, t, i, w.Quaternion[0]), + w.Quaternion[0].toRotationMatrix(n); + }), + (e.Scaling = function (t, i, n) { + var r = new e(); + return e.ScalingToRef(t, i, n, r), r; + }), + (e.ScalingToRef = function (t, i, n, r) { + e.FromValuesToRef( + t, + 0, + 0, + 0, + 0, + i, + 0, + 0, + 0, + 0, + n, + 0, + 0, + 0, + 0, + 1, r - } - , - e.RotationYawPitchRollToRef = function(e, t, i, n) { - m.RotationYawPitchRollToRef(e, t, i, w.Quaternion[0]), - w.Quaternion[0].toRotationMatrix(n) - } - , - e.Scaling = function(t, i, n) { - var r = new e; - return e.ScalingToRef(t, i, n, r), + ), + r._updateIdentityStatus(1 === t && 1 === i && 1 === n); + }), + (e.Translation = function (t, i, n) { + var r = new e(); + return e.TranslationToRef(t, i, n, r), r; + }), + (e.TranslationToRef = function (t, i, n, r) { + e.FromValuesToRef( + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + t, + i, + n, + 1, r - } - , - e.ScalingToRef = function(t, i, n, r) { - e.FromValuesToRef(t, 0, 0, 0, 0, i, 0, 0, 0, 0, n, 0, 0, 0, 0, 1, r), - r._updateIdentityStatus(1 === t && 1 === i && 1 === n) - } - , - e.Translation = function(t, i, n) { - var r = new e; - return e.TranslationToRef(t, i, n, r), - r - } - , - e.TranslationToRef = function(t, i, n, r) { - e.FromValuesToRef(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, t, i, n, 1, r), - r._updateIdentityStatus(0 === t && 0 === i && 0 === n) - } - , - e.Lerp = function(t, i, n) { - var r = new e; - return e.LerpToRef(t, i, n, r), - r - } - , - e.LerpToRef = function(e, t, i, n) { - for (var r = n._m, o = e.m, a = t.m, s = 0; s < 16; s++) - r[s] = o[s] * (1 - i) + a[s] * i; - n._markAsUpdated() - } - , - e.DecomposeLerp = function(t, i, n) { - var r = new e; - return e.DecomposeLerpToRef(t, i, n, r), - r - } - , - e.DecomposeLerpToRef = function(t, i, n, r) { - var o = w.Vector3[0] - , a = w.Quaternion[0] - , s = w.Vector3[1]; - t.decompose(o, a, s); - var c = w.Vector3[2] - , u = w.Quaternion[1] - , l = w.Vector3[3]; - i.decompose(c, u, l); - var h = w.Vector3[4]; - f.LerpToRef(o, c, n, h); - var d = w.Quaternion[2]; - m.SlerpToRef(a, u, n, d); - var p = w.Vector3[5]; - f.LerpToRef(s, l, n, p), - e.ComposeToRef(h, d, p, r) - } - , - e.LookAtLH = function(t, i, n) { - var r = new e; - return e.LookAtLHToRef(t, i, n, r), - r - } - , - e.LookAtLHToRef = function(t, i, n, r) { - var o = w.Vector3[0] - , a = w.Vector3[1] - , s = w.Vector3[2]; - i.subtractToRef(t, s), + ), + r._updateIdentityStatus(0 === t && 0 === i && 0 === n); + }), + (e.Lerp = function (t, i, n) { + var r = new e(); + return e.LerpToRef(t, i, n, r), r; + }), + (e.LerpToRef = function (e, t, i, n) { + for (var r = n._m, o = e.m, a = t.m, s = 0; s < 16; s++) + r[s] = o[s] * (1 - i) + a[s] * i; + n._markAsUpdated(); + }), + (e.DecomposeLerp = function (t, i, n) { + var r = new e(); + return e.DecomposeLerpToRef(t, i, n, r), r; + }), + (e.DecomposeLerpToRef = function (t, i, n, r) { + var o = w.Vector3[0], + a = w.Quaternion[0], + s = w.Vector3[1]; + t.decompose(o, a, s); + var c = w.Vector3[2], + u = w.Quaternion[1], + l = w.Vector3[3]; + i.decompose(c, u, l); + var h = w.Vector3[4]; + f.LerpToRef(o, c, n, h); + var d = w.Quaternion[2]; + m.SlerpToRef(a, u, n, d); + var p = w.Vector3[5]; + f.LerpToRef(s, l, n, p), e.ComposeToRef(h, d, p, r); + }), + (e.LookAtLH = function (t, i, n) { + var r = new e(); + return e.LookAtLHToRef(t, i, n, r), r; + }), + (e.LookAtLHToRef = function (t, i, n, r) { + var o = w.Vector3[0], + a = w.Vector3[1], + s = w.Vector3[2]; + i.subtractToRef(t, s), s.normalize(), f.CrossToRef(n, s, o); - var c = o.lengthSquared(); - 0 === c ? o.x = 1 : o.normalizeFromLength(Math.sqrt(c)), + var c = o.lengthSquared(); + 0 === c ? (o.x = 1) : o.normalizeFromLength(Math.sqrt(c)), f.CrossToRef(s, o, a), a.normalize(); - var u = -f.Dot(o, t) - , l = -f.Dot(a, t) - , h = -f.Dot(s, t); - e.FromValuesToRef(o.x, a.x, s.x, 0, o.y, a.y, s.y, 0, o.z, a.z, s.z, 0, u, l, h, 1, r) - } - , - e.LookAtRH = function(t, i, n) { - var r = new e; - return e.LookAtRHToRef(t, i, n, r), + var u = -f.Dot(o, t), + l = -f.Dot(a, t), + h = -f.Dot(s, t); + e.FromValuesToRef( + o.x, + a.x, + s.x, + 0, + o.y, + a.y, + s.y, + 0, + o.z, + a.z, + s.z, + 0, + u, + l, + h, + 1, r - } - , - e.LookAtRHToRef = function(t, i, n, r) { - var o = w.Vector3[0] - , a = w.Vector3[1] - , s = w.Vector3[2]; - t.subtractToRef(i, s), + ); + }), + (e.LookAtRH = function (t, i, n) { + var r = new e(); + return e.LookAtRHToRef(t, i, n, r), r; + }), + (e.LookAtRHToRef = function (t, i, n, r) { + var o = w.Vector3[0], + a = w.Vector3[1], + s = w.Vector3[2]; + t.subtractToRef(i, s), s.normalize(), f.CrossToRef(n, s, o); - var c = o.lengthSquared(); - 0 === c ? o.x = 1 : o.normalizeFromLength(Math.sqrt(c)), + var c = o.lengthSquared(); + 0 === c ? (o.x = 1) : o.normalizeFromLength(Math.sqrt(c)), f.CrossToRef(s, o, a), a.normalize(); - var u = -f.Dot(o, t) - , l = -f.Dot(a, t) - , h = -f.Dot(s, t); - e.FromValuesToRef(o.x, a.x, s.x, 0, o.y, a.y, s.y, 0, o.z, a.z, s.z, 0, u, l, h, 1, r) - } - , - e.OrthoLH = function(t, i, n, r) { - var o = new e; - return e.OrthoLHToRef(t, i, n, r, o), + var u = -f.Dot(o, t), + l = -f.Dot(a, t), + h = -f.Dot(s, t); + e.FromValuesToRef( + o.x, + a.x, + s.x, + 0, + o.y, + a.y, + s.y, + 0, + o.z, + a.z, + s.z, + 0, + u, + l, + h, + 1, + r + ); + }), + (e.OrthoLH = function (t, i, n, r) { + var o = new e(); + return e.OrthoLHToRef(t, i, n, r, o), o; + }), + (e.OrthoLHToRef = function (t, i, n, r, o) { + var a = 2 / t, + s = 2 / i, + c = 2 / (r - n), + u = -(r + n) / (r - n); + e.FromValuesToRef( + a, + 0, + 0, + 0, + 0, + s, + 0, + 0, + 0, + 0, + c, + 0, + 0, + 0, + u, + 1, o - } - , - e.OrthoLHToRef = function(t, i, n, r, o) { - var a = 2 / t - , s = 2 / i - , c = 2 / (r - n) - , u = -(r + n) / (r - n); - e.FromValuesToRef(a, 0, 0, 0, 0, s, 0, 0, 0, 0, c, 0, 0, 0, u, 1, o), - o._updateIdentityStatus(1 === a && 1 === s && 1 === c && 0 === u) - } - , - e.OrthoOffCenterLH = function(t, i, n, r, o, a) { - var s = new e; - return e.OrthoOffCenterLHToRef(t, i, n, r, o, a, s), + ), + o._updateIdentityStatus( + 1 === a && 1 === s && 1 === c && 0 === u + ); + }), + (e.OrthoOffCenterLH = function (t, i, n, r, o, a) { + var s = new e(); + return e.OrthoOffCenterLHToRef(t, i, n, r, o, a, s), s; + }), + (e.OrthoOffCenterLHToRef = function (t, i, n, r, o, a, s) { + var c = 2 / (i - t), + u = 2 / (r - n), + l = 2 / (a - o), + h = -(a + o) / (a - o), + f = (t + i) / (t - i), + d = (r + n) / (n - r); + e.FromValuesToRef( + c, + 0, + 0, + 0, + 0, + u, + 0, + 0, + 0, + 0, + l, + 0, + f, + d, + h, + 1, s - } - , - e.OrthoOffCenterLHToRef = function(t, i, n, r, o, a, s) { - var c = 2 / (i - t) - , u = 2 / (r - n) - , l = 2 / (a - o) - , h = -(a + o) / (a - o) - , f = (t + i) / (t - i) - , d = (r + n) / (n - r); - e.FromValuesToRef(c, 0, 0, 0, 0, u, 0, 0, 0, 0, l, 0, f, d, h, 1, s), - s._markAsUpdated() - } - , - e.OrthoOffCenterRH = function(t, i, n, r, o, a) { - var s = new e; - return e.OrthoOffCenterRHToRef(t, i, n, r, o, a, s), - s - } - , - e.OrthoOffCenterRHToRef = function(t, i, n, r, o, a, s) { - e.OrthoOffCenterLHToRef(t, i, n, r, o, a, s), - s._m[10] *= -1 - } - , - e.PerspectiveLH = function(t, i, n, r) { - var o = new e - , a = 2 * n / t - , s = 2 * n / i - , c = (r + n) / (r - n) - , u = -2 * r * n / (r - n); - return e.FromValuesToRef(a, 0, 0, 0, 0, s, 0, 0, 0, 0, c, 1, 0, 0, u, 0, o), + ), + s._markAsUpdated(); + }), + (e.OrthoOffCenterRH = function (t, i, n, r, o, a) { + var s = new e(); + return e.OrthoOffCenterRHToRef(t, i, n, r, o, a, s), s; + }), + (e.OrthoOffCenterRHToRef = function (t, i, n, r, o, a, s) { + e.OrthoOffCenterLHToRef(t, i, n, r, o, a, s), + (s._m[10] *= -1); + }), + (e.PerspectiveLH = function (t, i, n, r) { + var o = new e(), + a = (2 * n) / t, + s = (2 * n) / i, + c = (r + n) / (r - n), + u = (-2 * r * n) / (r - n); + return ( + e.FromValuesToRef( + a, + 0, + 0, + 0, + 0, + s, + 0, + 0, + 0, + 0, + c, + 1, + 0, + 0, + u, + 0, + o + ), o._updateIdentityStatus(false), o - } - , - e.PerspectiveFovLH = function(t, i, n, r) { - var o = new e; - return e.PerspectiveFovLHToRef(t, i, n, r, o), + ); + }), + (e.PerspectiveFovLH = function (t, i, n, r) { + var o = new e(); + return e.PerspectiveFovLHToRef(t, i, n, r, o), o; + }), + (e.PerspectiveFovLHToRef = function (t, i, n, r, o, a) { + void 0 === a && (a = true); + var s = n, + c = r, + u = 1 / Math.tan(0.5 * t), + l = a ? u / i : u, + h = a ? u : u * i, + f = (c + s) / (c - s), + d = (-2 * c * s) / (c - s); + e.FromValuesToRef( + l, + 0, + 0, + 0, + 0, + h, + 0, + 0, + 0, + 0, + f, + 1, + 0, + 0, + d, + 0, o - } - , - e.PerspectiveFovLHToRef = function(t, i, n, r, o, a) { - void 0 === a && (a = true); - var s = n - , c = r - , u = 1 / Math.tan(.5 * t) - , l = a ? u / i : u - , h = a ? u : u * i - , f = (c + s) / (c - s) - , d = -2 * c * s / (c - s); - e.FromValuesToRef(l, 0, 0, 0, 0, h, 0, 0, 0, 0, f, 1, 0, 0, d, 0, o), - o._updateIdentityStatus(false) - } - , - e.PerspectiveFovRH = function(t, i, n, r) { - var o = new e; - return e.PerspectiveFovRHToRef(t, i, n, r, o), + ), + o._updateIdentityStatus(false); + }), + (e.PerspectiveFovRH = function (t, i, n, r) { + var o = new e(); + return e.PerspectiveFovRHToRef(t, i, n, r, o), o; + }), + (e.PerspectiveFovRHToRef = function (t, i, n, r, o, a) { + void 0 === a && (a = true); + var s = n, + c = r, + u = 1 / Math.tan(0.5 * t), + l = a ? u / i : u, + h = a ? u : u * i, + f = -(c + s) / (c - s), + d = (-2 * c * s) / (c - s); + e.FromValuesToRef( + l, + 0, + 0, + 0, + 0, + h, + 0, + 0, + 0, + 0, + f, + -1, + 0, + 0, + d, + 0, o - } - , - e.PerspectiveFovRHToRef = function(t, i, n, r, o, a) { - void 0 === a && (a = true); - var s = n - , c = r - , u = 1 / Math.tan(.5 * t) - , l = a ? u / i : u - , h = a ? u : u * i - , f = -(c + s) / (c - s) - , d = -2 * c * s / (c - s); - e.FromValuesToRef(l, 0, 0, 0, 0, h, 0, 0, 0, 0, f, -1, 0, 0, d, 0, o), - o._updateIdentityStatus(false) - } - , - e.PerspectiveFovWebVRToRef = function(e, t, i, n, r) { - void 0 === r && (r = false); - var o = r ? -1 : 1 - , a = Math.tan(e.upDegrees * Math.PI / 180) - , s = Math.tan(e.downDegrees * Math.PI / 180) - , c = Math.tan(e.leftDegrees * Math.PI / 180) - , u = Math.tan(e.rightDegrees * Math.PI / 180) - , l = 2 / (c + u) - , h = 2 / (a + s) - , f = n._m; - f[0] = l, - f[1] = f[2] = f[3] = f[4] = 0, - f[5] = h, - f[6] = f[7] = 0, - f[8] = (c - u) * l * .5, - f[9] = -(a - s) * h * .5, - f[10] = -i / (t - i), - f[11] = 1 * o, - f[12] = f[13] = f[15] = 0, - f[14] = -2 * i * t / (i - t), - n._markAsUpdated() - } - , - e.GetFinalMatrix = function(t, i, n, r, o, a) { - var s = t.width - , c = t.height - , u = t.x - , l = t.y - , h = e.FromValues(s / 2, 0, 0, 0, 0, -c / 2, 0, 0, 0, 0, a - o, 0, u + s / 2, c / 2 + l, o, 1) - , f = w.Matrix[0]; - return i.multiplyToRef(n, f), + ), + o._updateIdentityStatus(false); + }), + (e.PerspectiveFovWebVRToRef = function (e, t, i, n, r) { + void 0 === r && (r = false); + var o = r ? -1 : 1, + a = Math.tan((e.upDegrees * Math.PI) / 180), + s = Math.tan((e.downDegrees * Math.PI) / 180), + c = Math.tan((e.leftDegrees * Math.PI) / 180), + u = Math.tan((e.rightDegrees * Math.PI) / 180), + l = 2 / (c + u), + h = 2 / (a + s), + f = n._m; + (f[0] = l), + (f[1] = f[2] = f[3] = f[4] = 0), + (f[5] = h), + (f[6] = f[7] = 0), + (f[8] = (c - u) * l * 0.5), + (f[9] = -(a - s) * h * 0.5), + (f[10] = -i / (t - i)), + (f[11] = 1 * o), + (f[12] = f[13] = f[15] = 0), + (f[14] = (-2 * i * t) / (i - t)), + n._markAsUpdated(); + }), + (e.GetFinalMatrix = function (t, i, n, r, o, a) { + var s = t.width, + c = t.height, + u = t.x, + l = t.y, + h = e.FromValues( + s / 2, + 0, + 0, + 0, + 0, + -c / 2, + 0, + 0, + 0, + 0, + a - o, + 0, + u + s / 2, + c / 2 + l, + o, + 1 + ), + f = w.Matrix[0]; + return ( + i.multiplyToRef(n, f), f.multiplyToRef(r, f), f.multiply(h) - } - , - e.GetAsMatrix2x2 = function(e) { - var t = e.m; - return new Float32Array([t[0], t[1], t[4], t[5]]) - } - , - e.GetAsMatrix3x3 = function(e) { - var t = e.m; - return new Float32Array([t[0], t[1], t[2], t[4], t[5], t[6], t[8], t[9], t[10]]) - } - , - e.Transpose = function(t) { - var i = new e; - return e.TransposeToRef(t, i), + ); + }), + (e.GetAsMatrix2x2 = function (e) { + var t = e.m; + return new Float32Array([t[0], t[1], t[4], t[5]]); + }), + (e.GetAsMatrix3x3 = function (e) { + var t = e.m; + return new Float32Array([ + t[0], + t[1], + t[2], + t[4], + t[5], + t[6], + t[8], + t[9], + t[10], + ]); + }), + (e.Transpose = function (t) { + var i = new e(); + return e.TransposeToRef(t, i), i; + }), + (e.TransposeToRef = function (e, t) { + var i = t._m, + n = e.m; + (i[0] = n[0]), + (i[1] = n[4]), + (i[2] = n[8]), + (i[3] = n[12]), + (i[4] = n[1]), + (i[5] = n[5]), + (i[6] = n[9]), + (i[7] = n[13]), + (i[8] = n[2]), + (i[9] = n[6]), + (i[10] = n[10]), + (i[11] = n[14]), + (i[12] = n[3]), + (i[13] = n[7]), + (i[14] = n[11]), + (i[15] = n[15]), + t._updateIdentityStatus( + e._isIdentity, + e._isIdentityDirty + ); + }), + (e.Reflection = function (t) { + var i = new e(); + return e.ReflectionToRef(t, i), i; + }), + (e.ReflectionToRef = function (t, i) { + t.normalize(); + var n = t.normal.x, + r = t.normal.y, + o = t.normal.z, + a = -2 * n, + s = -2 * r, + c = -2 * o; + e.FromValuesToRef( + a * n + 1, + s * n, + c * n, + 0, + a * r, + s * r + 1, + c * r, + 0, + a * o, + s * o, + c * o + 1, + 0, + a * t.d, + s * t.d, + c * t.d, + 1, i - } - , - e.TransposeToRef = function(e, t) { - var i = t._m - , n = e.m; - i[0] = n[0], - i[1] = n[4], - i[2] = n[8], - i[3] = n[12], - i[4] = n[1], - i[5] = n[5], - i[6] = n[9], - i[7] = n[13], - i[8] = n[2], - i[9] = n[6], - i[10] = n[10], - i[11] = n[14], - i[12] = n[3], - i[13] = n[7], - i[14] = n[11], - i[15] = n[15], - t._updateIdentityStatus(e._isIdentity, e._isIdentityDirty) - } - , - e.Reflection = function(t) { - var i = new e; - return e.ReflectionToRef(t, i), - i - } - , - e.ReflectionToRef = function(t, i) { - t.normalize(); - var n = t.normal.x - , r = t.normal.y - , o = t.normal.z - , a = -2 * n - , s = -2 * r - , c = -2 * o; - e.FromValuesToRef(a * n + 1, s * n, c * n, 0, a * r, s * r + 1, c * r, 0, a * o, s * o, c * o + 1, 0, a * t.d, s * t.d, c * t.d, 1, i) - } - , - e.FromXYZAxesToRef = function(t, i, n, r) { - e.FromValuesToRef(t.x, t.y, t.z, 0, i.x, i.y, i.z, 0, n.x, n.y, n.z, 0, 0, 0, 0, 1, r) - } - , - e.FromQuaternionToRef = function(e, t) { - var i = e.x * e.x - , n = e.y * e.y - , r = e.z * e.z - , o = e.x * e.y - , a = e.z * e.w - , s = e.z * e.x - , c = e.y * e.w - , u = e.y * e.z - , l = e.x * e.w; - t._m[0] = 1 - 2 * (n + r), - t._m[1] = 2 * (o + a), - t._m[2] = 2 * (s - c), - t._m[3] = 0, - t._m[4] = 2 * (o - a), - t._m[5] = 1 - 2 * (r + i), - t._m[6] = 2 * (u + l), - t._m[7] = 0, - t._m[8] = 2 * (s + c), - t._m[9] = 2 * (u - l), - t._m[10] = 1 - 2 * (n + i), - t._m[11] = 0, - t._m[12] = 0, - t._m[13] = 0, - t._m[14] = 0, - t._m[15] = 1, - t._markAsUpdated() - } - , - e._updateFlagSeed = 0, - e._identityReadOnly = e.Identity(), - e - }(), _ = function() { - function e(e, t, i, n) { - this.normal = new f(e,t,i), - this.d = n - } - return e.prototype.asArray = function() { - return [this.normal.x, this.normal.y, this.normal.z, this.d] - } - , - e.prototype.clone = function() { - return new e(this.normal.x,this.normal.y,this.normal.z,this.d) - } - , - e.prototype.getClassName = function() { - return "Plane" - } - , - e.prototype.getHashCode = function() { - var e = this.normal.getHashCode(); - return 397 * e ^ (this.d || 0) - } - , - e.prototype.normalize = function() { - var e = Math.sqrt(this.normal.x * this.normal.x + this.normal.y * this.normal.y + this.normal.z * this.normal.z) - , t = 0; - return 0 !== e && (t = 1 / e), - this.normal.x *= t, - this.normal.y *= t, - this.normal.z *= t, - this.d *= t, - this - } - , - e.prototype.transform = function(t) { - var i = w.Matrix[0]; - g.TransposeToRef(t, i); - var n = i.m - , r = this.normal.x - , o = this.normal.y - , a = this.normal.z - , s = this.d; - return new e(r * n[0] + o * n[1] + a * n[2] + s * n[3],r * n[4] + o * n[5] + a * n[6] + s * n[7],r * n[8] + o * n[9] + a * n[10] + s * n[11],r * n[12] + o * n[13] + a * n[14] + s * n[15]) - } - , - e.prototype.dotCoordinate = function(e) { - return this.normal.x * e.x + this.normal.y * e.y + this.normal.z * e.z + this.d - } - , - e.prototype.copyFromPoints = function(e, t, i) { - var n, r = t.x - e.x, o = t.y - e.y, a = t.z - e.z, s = i.x - e.x, c = i.y - e.y, u = i.z - e.z, l = o * u - a * c, h = a * s - r * u, f = r * c - o * s, d = Math.sqrt(l * l + h * h + f * f); - return n = 0 !== d ? 1 / d : 0, - this.normal.x = l * n, - this.normal.y = h * n, - this.normal.z = f * n, - this.d = -(this.normal.x * e.x + this.normal.y * e.y + this.normal.z * e.z), - this - } - , - e.prototype.isFrontFacingTo = function(e, t) { - return f.Dot(this.normal, e) <= t - } - , - e.prototype.signedDistanceTo = function(e) { - return f.Dot(e, this.normal) + this.d - } - , - e.FromArray = function(t) { - return new e(t[0],t[1],t[2],t[3]) - } - , - e.FromPoints = function(t, i, n) { - var r = new e(0,0,0,0); - return r.copyFromPoints(t, i, n), + ); + }), + (e.FromXYZAxesToRef = function (t, i, n, r) { + e.FromValuesToRef( + t.x, + t.y, + t.z, + 0, + i.x, + i.y, + i.z, + 0, + n.x, + n.y, + n.z, + 0, + 0, + 0, + 0, + 1, r - } - , - e.FromPositionAndNormal = function(t, i) { - var n = new e(0,0,0,0); - return i.normalize(), - n.normal = i, - n.d = -(i.x * t.x + i.y * t.y + i.z * t.z), - n - } - , - e.SignedDistanceToPlaneFromPositionAndNormal = function(e, t, i) { - var n = -(t.x * e.x + t.y * e.y + t.z * e.z); - return f.Dot(i, t) + n - } - , + ); + }), + (e.FromQuaternionToRef = function (e, t) { + var i = e.x * e.x, + n = e.y * e.y, + r = e.z * e.z, + o = e.x * e.y, + a = e.z * e.w, + s = e.z * e.x, + c = e.y * e.w, + u = e.y * e.z, + l = e.x * e.w; + (t._m[0] = 1 - 2 * (n + r)), + (t._m[1] = 2 * (o + a)), + (t._m[2] = 2 * (s - c)), + (t._m[3] = 0), + (t._m[4] = 2 * (o - a)), + (t._m[5] = 1 - 2 * (r + i)), + (t._m[6] = 2 * (u + l)), + (t._m[7] = 0), + (t._m[8] = 2 * (s + c)), + (t._m[9] = 2 * (u - l)), + (t._m[10] = 1 - 2 * (n + i)), + (t._m[11] = 0), + (t._m[12] = 0), + (t._m[13] = 0), + (t._m[14] = 0), + (t._m[15] = 1), + t._markAsUpdated(); + }), + (e._updateFlagSeed = 0), + (e._identityReadOnly = e.Identity()), e - }(), v = function() { - function e(e, t, i, n) { - this.x = e, - this.y = t, - this.width = i, - this.height = n - } - return e.prototype.toGlobal = function(t, i) { - return new e(this.x * t,this.y * i,this.width * t,this.height * i) - } - , - e.prototype.toGlobalToRef = function(e, t, i) { - return i.x = this.x * e, - i.y = this.y * t, - i.width = this.width * e, - i.height = this.height * t, + ); + })(), + _ = (function () { + function e(e, t, i, n) { + (this.normal = new f(e, t, i)), (this.d = n); + } + return ( + (e.prototype.asArray = function () { + return [ + this.normal.x, + this.normal.y, + this.normal.z, + this.d, + ]; + }), + (e.prototype.clone = function () { + return new e( + this.normal.x, + this.normal.y, + this.normal.z, + this.d + ); + }), + (e.prototype.getClassName = function () { + return "Plane"; + }), + (e.prototype.getHashCode = function () { + var e = this.normal.getHashCode(); + return (397 * e) ^ (this.d || 0); + }), + (e.prototype.normalize = function () { + var e = Math.sqrt( + this.normal.x * this.normal.x + + this.normal.y * this.normal.y + + this.normal.z * this.normal.z + ), + t = 0; + return ( + 0 !== e && (t = 1 / e), + (this.normal.x *= t), + (this.normal.y *= t), + (this.normal.z *= t), + (this.d *= t), this - } - , - e.prototype.clone = function() { - return new e(this.x,this.y,this.width,this.height) - } - , + ); + }), + (e.prototype.transform = function (t) { + var i = w.Matrix[0]; + g.TransposeToRef(t, i); + var n = i.m, + r = this.normal.x, + o = this.normal.y, + a = this.normal.z, + s = this.d; + return new e( + r * n[0] + o * n[1] + a * n[2] + s * n[3], + r * n[4] + o * n[5] + a * n[6] + s * n[7], + r * n[8] + o * n[9] + a * n[10] + s * n[11], + r * n[12] + o * n[13] + a * n[14] + s * n[15] + ); + }), + (e.prototype.dotCoordinate = function (e) { + return ( + this.normal.x * e.x + + this.normal.y * e.y + + this.normal.z * e.z + + this.d + ); + }), + (e.prototype.copyFromPoints = function (e, t, i) { + var n, + r = t.x - e.x, + o = t.y - e.y, + a = t.z - e.z, + s = i.x - e.x, + c = i.y - e.y, + u = i.z - e.z, + l = o * u - a * c, + h = a * s - r * u, + f = r * c - o * s, + d = Math.sqrt(l * l + h * h + f * f); + return ( + (n = 0 !== d ? 1 / d : 0), + (this.normal.x = l * n), + (this.normal.y = h * n), + (this.normal.z = f * n), + (this.d = -( + this.normal.x * e.x + + this.normal.y * e.y + + this.normal.z * e.z + )), + this + ); + }), + (e.prototype.isFrontFacingTo = function (e, t) { + return f.Dot(this.normal, e) <= t; + }), + (e.prototype.signedDistanceTo = function (e) { + return f.Dot(e, this.normal) + this.d; + }), + (e.FromArray = function (t) { + return new e(t[0], t[1], t[2], t[3]); + }), + (e.FromPoints = function (t, i, n) { + var r = new e(0, 0, 0, 0); + return r.copyFromPoints(t, i, n), r; + }), + (e.FromPositionAndNormal = function (t, i) { + var n = new e(0, 0, 0, 0); + return ( + i.normalize(), + (n.normal = i), + (n.d = -(i.x * t.x + i.y * t.y + i.z * t.z)), + n + ); + }), + (e.SignedDistanceToPlaneFromPositionAndNormal = function ( + e, + t, + i + ) { + var n = -(t.x * e.x + t.y * e.y + t.z * e.z); + return f.Dot(i, t) + n; + }), e - }(), y = function() { - function e() {} - return e.GetPlanes = function(t) { - for (var i = [], n = 0; n < 6; n++) - i.push(new _(0,0,0,0)); - return e.GetPlanesToRef(t, i), - i - } - , - e.GetNearPlaneToRef = function(e, t) { - var i = e.m; - t.normal.x = i[3] + i[2], - t.normal.y = i[7] + i[6], - t.normal.z = i[11] + i[10], - t.d = i[15] + i[14], - t.normalize() - } - , - e.GetFarPlaneToRef = function(e, t) { - var i = e.m; - t.normal.x = i[3] - i[2], - t.normal.y = i[7] - i[6], - t.normal.z = i[11] - i[10], - t.d = i[15] - i[14], - t.normalize() - } - , - e.GetLeftPlaneToRef = function(e, t) { - var i = e.m; - t.normal.x = i[3] + i[0], - t.normal.y = i[7] + i[4], - t.normal.z = i[11] + i[8], - t.d = i[15] + i[12], - t.normalize() - } - , - e.GetRightPlaneToRef = function(e, t) { - var i = e.m; - t.normal.x = i[3] - i[0], - t.normal.y = i[7] - i[4], - t.normal.z = i[11] - i[8], - t.d = i[15] - i[12], - t.normalize() - } - , - e.GetTopPlaneToRef = function(e, t) { - var i = e.m; - t.normal.x = i[3] - i[1], - t.normal.y = i[7] - i[5], - t.normal.z = i[11] - i[9], - t.d = i[15] - i[13], - t.normalize() - } - , - e.GetBottomPlaneToRef = function(e, t) { - var i = e.m; - t.normal.x = i[3] + i[1], - t.normal.y = i[7] + i[5], - t.normal.z = i[11] + i[9], - t.d = i[15] + i[13], - t.normalize() - } - , - e.GetPlanesToRef = function(t, i) { - e.GetNearPlaneToRef(t, i[0]), + ); + })(), + v = (function () { + function e(e, t, i, n) { + (this.x = e), + (this.y = t), + (this.width = i), + (this.height = n); + } + return ( + (e.prototype.toGlobal = function (t, i) { + return new e( + this.x * t, + this.y * i, + this.width * t, + this.height * i + ); + }), + (e.prototype.toGlobalToRef = function (e, t, i) { + return ( + (i.x = this.x * e), + (i.y = this.y * t), + (i.width = this.width * e), + (i.height = this.height * t), + this + ); + }), + (e.prototype.clone = function () { + return new e(this.x, this.y, this.width, this.height); + }), + e + ); + })(), + y = (function () { + function e() {} + return ( + (e.GetPlanes = function (t) { + for (var i = [], n = 0; n < 6; n++) + i.push(new _(0, 0, 0, 0)); + return e.GetPlanesToRef(t, i), i; + }), + (e.GetNearPlaneToRef = function (e, t) { + var i = e.m; + (t.normal.x = i[3] + i[2]), + (t.normal.y = i[7] + i[6]), + (t.normal.z = i[11] + i[10]), + (t.d = i[15] + i[14]), + t.normalize(); + }), + (e.GetFarPlaneToRef = function (e, t) { + var i = e.m; + (t.normal.x = i[3] - i[2]), + (t.normal.y = i[7] - i[6]), + (t.normal.z = i[11] - i[10]), + (t.d = i[15] - i[14]), + t.normalize(); + }), + (e.GetLeftPlaneToRef = function (e, t) { + var i = e.m; + (t.normal.x = i[3] + i[0]), + (t.normal.y = i[7] + i[4]), + (t.normal.z = i[11] + i[8]), + (t.d = i[15] + i[12]), + t.normalize(); + }), + (e.GetRightPlaneToRef = function (e, t) { + var i = e.m; + (t.normal.x = i[3] - i[0]), + (t.normal.y = i[7] - i[4]), + (t.normal.z = i[11] - i[8]), + (t.d = i[15] - i[12]), + t.normalize(); + }), + (e.GetTopPlaneToRef = function (e, t) { + var i = e.m; + (t.normal.x = i[3] - i[1]), + (t.normal.y = i[7] - i[5]), + (t.normal.z = i[11] - i[9]), + (t.d = i[15] - i[13]), + t.normalize(); + }), + (e.GetBottomPlaneToRef = function (e, t) { + var i = e.m; + (t.normal.x = i[3] + i[1]), + (t.normal.y = i[7] + i[5]), + (t.normal.z = i[11] + i[9]), + (t.d = i[15] + i[13]), + t.normalize(); + }), + (e.GetPlanesToRef = function (t, i) { + e.GetNearPlaneToRef(t, i[0]), e.GetFarPlaneToRef(t, i[1]), e.GetLeftPlaneToRef(t, i[2]), e.GetRightPlaneToRef(t, i[3]), e.GetTopPlaneToRef(t, i[4]), - e.GetBottomPlaneToRef(t, i[5]) - } - , + e.GetBottomPlaneToRef(t, i[5]); + }), e - }(); - !function(e) { - e[e.LOCAL = 0] = "LOCAL", - e[e.WORLD = 1] = "WORLD", - e[e.BONE = 2] = "BONE" - }(n || (n = {})); - var b, E = function() { - function e() {} - return e.X = new f(1,0,0), - e.Y = new f(0,1,0), - e.Z = new f(0,0,1), + ); + })(); + !(function (e) { + (e[(e.LOCAL = 0)] = "LOCAL"), + (e[(e.WORLD = 1)] = "WORLD"), + (e[(e.BONE = 2)] = "BONE"); + })(n || (n = {})); + var b, + E = (function () { + function e() {} + return ( + (e.X = new f(1, 0, 0)), + (e.Y = new f(0, 1, 0)), + (e.Z = new f(0, 0, 1)), e - }(), T = function() { - function e() {} - return e.Interpolate = function(e, t, i, n, r) { - for (var o = 1 - 3 * n + 3 * t, a = 3 * n - 6 * t, s = 3 * t, c = e, u = 0; u < 5; u++) { - var l = c * c; - c -= 1 / (3 * o * l + 2 * a * c + s) * (o * (l * c) + a * l + s * c - e), - c = Math.min(1, Math.max(0, c)) - } - return 3 * Math.pow(1 - c, 2) * c * i + 3 * (1 - c) * Math.pow(c, 2) * r + Math.pow(c, 3) - } - , + ); + })(), + T = (function () { + function e() {} + return ( + (e.Interpolate = function (e, t, i, n, r) { + for ( + var o = 1 - 3 * n + 3 * t, + a = 3 * n - 6 * t, + s = 3 * t, + c = e, + u = 0; + u < 5; + u++ + ) { + var l = c * c; + (c -= + (1 / (3 * o * l + 2 * a * c + s)) * + (o * (l * c) + a * l + s * c - e)), + (c = Math.min(1, Math.max(0, c))); + } + return ( + 3 * Math.pow(1 - c, 2) * c * i + + 3 * (1 - c) * Math.pow(c, 2) * r + + Math.pow(c, 3) + ); + }), e - }(); - !function(e) { - e[e.CW = 0] = "CW", - e[e.CCW = 1] = "CCW" - }(b || (b = {})); - var A = function() { - function e(e) { - this._radians = e, - this._radians < 0 && (this._radians += 2 * Math.PI) - } - return e.prototype.degrees = function() { - return 180 * this._radians / Math.PI - } - , - e.prototype.radians = function() { - return this._radians - } - , - e.BetweenTwoPoints = function(t, i) { - var n = i.subtract(t); - return new e(Math.atan2(n.y, n.x)) - } - , - e.FromRadians = function(t) { - return new e(t) - } - , - e.FromDegrees = function(t) { - return new e(t * Math.PI / 180) - } - , + ); + })(); + !(function (e) { + (e[(e.CW = 0)] = "CW"), (e[(e.CCW = 1)] = "CCW"); + })(b || (b = {})); + var A = (function () { + function e(e) { + (this._radians = e), + this._radians < 0 && (this._radians += 2 * Math.PI); + } + return ( + (e.prototype.degrees = function () { + return (180 * this._radians) / Math.PI; + }), + (e.prototype.radians = function () { + return this._radians; + }), + (e.BetweenTwoPoints = function (t, i) { + var n = i.subtract(t); + return new e(Math.atan2(n.y, n.x)); + }), + (e.FromRadians = function (t) { + return new e(t); + }), + (e.FromDegrees = function (t) { + return new e((t * Math.PI) / 180); + }), e - }() - , x = function(e, t, i) { - this.startPoint = e, - this.midPoint = t, - this.endPoint = i; - var n = Math.pow(t.x, 2) + Math.pow(t.y, 2) - , r = (Math.pow(e.x, 2) + Math.pow(e.y, 2) - n) / 2 - , o = (n - Math.pow(i.x, 2) - Math.pow(i.y, 2)) / 2 - , a = (e.x - t.x) * (t.y - i.y) - (t.x - i.x) * (e.y - t.y); - this.centerPoint = new h((r * (t.y - i.y) - o * (e.y - t.y)) / a,((e.x - t.x) * o - (t.x - i.x) * r) / a), - this.radius = this.centerPoint.subtract(this.startPoint).length(), - this.startAngle = A.BetweenTwoPoints(this.centerPoint, this.startPoint); - var s = this.startAngle.degrees() - , c = A.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees() - , u = A.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees(); - c - s > 180 && (c -= 360), + ); + })(), + x = function (e, t, i) { + (this.startPoint = e), + (this.midPoint = t), + (this.endPoint = i); + var n = Math.pow(t.x, 2) + Math.pow(t.y, 2), + r = (Math.pow(e.x, 2) + Math.pow(e.y, 2) - n) / 2, + o = (n - Math.pow(i.x, 2) - Math.pow(i.y, 2)) / 2, + a = (e.x - t.x) * (t.y - i.y) - (t.x - i.x) * (e.y - t.y); + (this.centerPoint = new h( + (r * (t.y - i.y) - o * (e.y - t.y)) / a, + ((e.x - t.x) * o - (t.x - i.x) * r) / a + )), + (this.radius = this.centerPoint + .subtract(this.startPoint) + .length()), + (this.startAngle = A.BetweenTwoPoints( + this.centerPoint, + this.startPoint + )); + var s = this.startAngle.degrees(), + c = A.BetweenTwoPoints( + this.centerPoint, + this.midPoint + ).degrees(), + u = A.BetweenTwoPoints( + this.centerPoint, + this.endPoint + ).degrees(); + c - s > 180 && (c -= 360), c - s < -180 && (c += 360), u - c > 180 && (u -= 360), u - c < -180 && (u += 360), - this.orientation = c - s < 0 ? b.CW : b.CCW, - this.angle = A.FromDegrees(this.orientation === b.CW ? s - u : u - s) - } - , S = function() { - function e(e, t) { - this._points = new Array, - this._length = 0, - this.closed = false, - this._points.push(new h(e,t)) - } - return e.prototype.addLineTo = function(e, t) { - if (this.closed) - return this; - var i = new h(e,t) - , n = this._points[this._points.length - 1]; - return this._points.push(i), - this._length += i.subtract(n).length(), + (this.orientation = c - s < 0 ? b.CW : b.CCW), + (this.angle = A.FromDegrees( + this.orientation === b.CW ? s - u : u - s + )); + }, + S = (function () { + function e(e, t) { + (this._points = new Array()), + (this._length = 0), + (this.closed = false), + this._points.push(new h(e, t)); + } + return ( + (e.prototype.addLineTo = function (e, t) { + if (this.closed) return this; + var i = new h(e, t), + n = this._points[this._points.length - 1]; + return ( + this._points.push(i), + (this._length += i.subtract(n).length()), this - } - , - e.prototype.addArcTo = function(e, t, i, n, r) { - if (void 0 === r && (r = 36), - this.closed) - return this; - var o = this._points[this._points.length - 1] - , a = new h(e,t) - , s = new h(i,n) - , c = new x(o,a,s) - , u = c.angle.radians() / r; - c.orientation === b.CW && (u *= -1); - for (var l = c.startAngle.radians() + u, f = 0; f < r; f++) { - var d = Math.cos(l) * c.radius + c.centerPoint.x - , p = Math.sin(l) * c.radius + c.centerPoint.y; - this.addLineTo(d, p), - l += u + ); + }), + (e.prototype.addArcTo = function (e, t, i, n, r) { + if ((void 0 === r && (r = 36), this.closed)) return this; + var o = this._points[this._points.length - 1], + a = new h(e, t), + s = new h(i, n), + c = new x(o, a, s), + u = c.angle.radians() / r; + c.orientation === b.CW && (u *= -1); + for ( + var l = c.startAngle.radians() + u, f = 0; + f < r; + f++ + ) { + var d = Math.cos(l) * c.radius + c.centerPoint.x, + p = Math.sin(l) * c.radius + c.centerPoint.y; + this.addLineTo(d, p), (l += u); + } + return this; + }), + (e.prototype.close = function () { + return (this.closed = true), this; + }), + (e.prototype.length = function () { + var e = this._length; + if (!this.closed) { + var t = this._points[this._points.length - 1]; + e += this._points[0].subtract(t).length(); + } + return e; + }), + (e.prototype.getPoints = function () { + return this._points; + }), + (e.prototype.getPointAtLengthPosition = function (e) { + if (e < 0 || e > 1) return h.Zero(); + for ( + var t = e * this.length(), i = 0, n = 0; + n < this._points.length; + n++ + ) { + var r = (n + 1) % this._points.length, + o = this._points[n], + a = this._points[r].subtract(o), + s = a.length() + i; + if (t >= i && t <= s) { + var c = a.normalize(), + u = t - i; + return new h(o.x + c.x * u, o.y + c.y * u); } - return this - } - , - e.prototype.close = function() { - return this.closed = true, - this - } - , - e.prototype.length = function() { - var e = this._length; - if (!this.closed) { - var t = this._points[this._points.length - 1]; - e += this._points[0].subtract(t).length() - } - return e - } - , - e.prototype.getPoints = function() { - return this._points - } - , - e.prototype.getPointAtLengthPosition = function(e) { - if (e < 0 || e > 1) - return h.Zero(); - for (var t = e * this.length(), i = 0, n = 0; n < this._points.length; n++) { - var r = (n + 1) % this._points.length - , o = this._points[n] - , a = this._points[r].subtract(o) - , s = a.length() + i; - if (t >= i && t <= s) { - var c = a.normalize() - , u = t - i; - return new h(o.x + c.x * u,o.y + c.y * u) - } - i = s - } - return h.Zero() - } - , - e.StartingAt = function(t, i) { - return new e(t,i) - } - , + i = s; + } + return h.Zero(); + }), + (e.StartingAt = function (t, i) { + return new e(t, i); + }), e - }() - , C = function() { - function e(e, t, i) { - void 0 === t && (t = null), - this.path = e, - this._curve = new Array, - this._distances = new Array, - this._tangents = new Array, - this._normals = new Array, - this._binormals = new Array; - for (var n = 0; n < e.length; n++) - this._curve[n] = e[n].clone(); - this._raw = i || false, - this._compute(t) - } - return e.prototype.getCurve = function() { - return this._curve - } - , - e.prototype.getTangents = function() { - return this._tangents - } - , - e.prototype.getNormals = function() { - return this._normals - } - , - e.prototype.getBinormals = function() { - return this._binormals - } - , - e.prototype.getDistances = function() { - return this._distances - } - , - e.prototype.update = function(e, t) { - void 0 === t && (t = null); - for (var i = 0; i < e.length; i++) - this._curve[i].x = e[i].x, - this._curve[i].y = e[i].y, - this._curve[i].z = e[i].z; - return this._compute(t), - this - } - , - e.prototype._compute = function(e) { - var t = this._curve.length; - this._tangents[0] = this._getFirstNonNullVector(0), + ); + })(), + C = (function () { + function e(e, t, i) { + void 0 === t && (t = null), + (this.path = e), + (this._curve = new Array()), + (this._distances = new Array()), + (this._tangents = new Array()), + (this._normals = new Array()), + (this._binormals = new Array()); + for (var n = 0; n < e.length; n++) + this._curve[n] = e[n].clone(); + (this._raw = i || false), this._compute(t); + } + return ( + (e.prototype.getCurve = function () { + return this._curve; + }), + (e.prototype.getTangents = function () { + return this._tangents; + }), + (e.prototype.getNormals = function () { + return this._normals; + }), + (e.prototype.getBinormals = function () { + return this._binormals; + }), + (e.prototype.getDistances = function () { + return this._distances; + }), + (e.prototype.update = function (e, t) { + void 0 === t && (t = null); + for (var i = 0; i < e.length; i++) + (this._curve[i].x = e[i].x), + (this._curve[i].y = e[i].y), + (this._curve[i].z = e[i].z); + return this._compute(t), this; + }), + (e.prototype._compute = function (e) { + var t = this._curve.length; + (this._tangents[0] = this._getFirstNonNullVector(0)), this._raw || this._tangents[0].normalize(), - this._tangents[t - 1] = this._curve[t - 1].subtract(this._curve[t - 2]), + (this._tangents[t - 1] = this._curve[t - 1].subtract( + this._curve[t - 2] + )), this._raw || this._tangents[t - 1].normalize(); - var i, n, r, o, a = this._tangents[0], s = this._normalVector(a, e); - this._normals[0] = s, + var i, + n, + r, + o, + a = this._tangents[0], + s = this._normalVector(a, e); + (this._normals[0] = s), this._raw || this._normals[0].normalize(), - this._binormals[0] = f.Cross(a, this._normals[0]), + (this._binormals[0] = f.Cross(a, this._normals[0])), this._raw || this._binormals[0].normalize(), - this._distances[0] = 0; - for (var c = 1; c < t; c++) - i = this._getLastNonNullVector(c), - c < t - 1 && (n = this._getFirstNonNullVector(c), - this._tangents[c] = i.add(n), + (this._distances[0] = 0); + for (var c = 1; c < t; c++) + (i = this._getLastNonNullVector(c)), + c < t - 1 && + ((n = this._getFirstNonNullVector(c)), + (this._tangents[c] = i.add(n)), this._tangents[c].normalize()), - this._distances[c] = this._distances[c - 1] + i.length(), - r = this._tangents[c], - o = this._binormals[c - 1], - this._normals[c] = f.Cross(o, r), - this._raw || this._normals[c].normalize(), - this._binormals[c] = f.Cross(r, this._normals[c]), - this._raw || this._binormals[c].normalize() - } - , - e.prototype._getFirstNonNullVector = function(e) { - for (var t = 1, i = this._curve[e + t].subtract(this._curve[e]); 0 === i.length() && e + t + 1 < this._curve.length; ) - t++, - i = this._curve[e + t].subtract(this._curve[e]); - return i - } - , - e.prototype._getLastNonNullVector = function(e) { - for (var t = 1, i = this._curve[e].subtract(this._curve[e - t]); 0 === i.length() && e > t + 1; ) - t++, - i = this._curve[e].subtract(this._curve[e - t]); - return i - } - , - e.prototype._normalVector = function(e, t) { - var i, n, r = e.length(); - return 0 === r && (r = 1), - null == t ? (n = o.a.WithinEpsilon(Math.abs(e.y) / r, 1, c) ? o.a.WithinEpsilon(Math.abs(e.x) / r, 1, c) ? o.a.WithinEpsilon(Math.abs(e.z) / r, 1, c) ? f.Zero() : new f(0,0,1) : new f(1,0,0) : new f(0,-1,0), - i = f.Cross(e, n)) : (i = f.Cross(e, t), - f.CrossToRef(i, e, i)), + (this._distances[c] = + this._distances[c - 1] + i.length()), + (r = this._tangents[c]), + (o = this._binormals[c - 1]), + (this._normals[c] = f.Cross(o, r)), + this._raw || this._normals[c].normalize(), + (this._binormals[c] = f.Cross(r, this._normals[c])), + this._raw || this._binormals[c].normalize(); + }), + (e.prototype._getFirstNonNullVector = function (e) { + for ( + var t = 1, + i = this._curve[e + t].subtract(this._curve[e]); + 0 === i.length() && e + t + 1 < this._curve.length; + + ) + t++, (i = this._curve[e + t].subtract(this._curve[e])); + return i; + }), + (e.prototype._getLastNonNullVector = function (e) { + for ( + var t = 1, + i = this._curve[e].subtract(this._curve[e - t]); + 0 === i.length() && e > t + 1; + + ) + t++, (i = this._curve[e].subtract(this._curve[e - t])); + return i; + }), + (e.prototype._normalVector = function (e, t) { + var i, + n, + r = e.length(); + return ( + 0 === r && (r = 1), + null == t + ? ((n = o.a.WithinEpsilon(Math.abs(e.y) / r, 1, c) + ? o.a.WithinEpsilon(Math.abs(e.x) / r, 1, c) + ? o.a.WithinEpsilon(Math.abs(e.z) / r, 1, c) + ? f.Zero() + : new f(0, 0, 1) + : new f(1, 0, 0) + : new f(0, -1, 0)), + (i = f.Cross(e, n))) + : ((i = f.Cross(e, t)), f.CrossToRef(i, e, i)), i.normalize(), i - } - , + ); + }), e - }() - , P = function() { - function e(e) { - this._length = 0, - this._points = e, - this._length = this._computeLength(e) - } - return e.CreateQuadraticBezier = function(t, i, n, r) { - r = r > 2 ? r : 3; - for (var o = new Array, a = function(e, t, i, n) { - return (1 - e) * (1 - e) * t + 2 * e * (1 - e) * i + e * e * n - }, s = 0; s <= r; s++) - o.push(new f(a(s / r, t.x, i.x, n.x),a(s / r, t.y, i.y, n.y),a(s / r, t.z, i.z, n.z))); - return new e(o) - } - , - e.CreateCubicBezier = function(t, i, n, r, o) { - o = o > 3 ? o : 4; - for (var a = new Array, s = function(e, t, i, n, r) { - return (1 - e) * (1 - e) * (1 - e) * t + 3 * e * (1 - e) * (1 - e) * i + 3 * e * e * (1 - e) * n + e * e * e * r - }, c = 0; c <= o; c++) - a.push(new f(s(c / o, t.x, i.x, n.x, r.x),s(c / o, t.y, i.y, n.y, r.y),s(c / o, t.z, i.z, n.z, r.z))); - return new e(a) - } - , - e.CreateHermiteSpline = function(t, i, n, r, o) { - for (var a = new Array, s = 1 / o, c = 0; c <= o; c++) - a.push(f.Hermite(t, i, n, r, c * s)); - return new e(a) - } - , - e.CreateCatmullRomSpline = function(t, i, n) { - var r = new Array - , o = 1 / i - , a = 0; - if (n) { - for (var s = t.length, c = 0; c < s; c++) { - a = 0; - for (var u = 0; u < i; u++) - r.push(f.CatmullRom(t[c % s], t[(c + 1) % s], t[(c + 2) % s], t[(c + 3) % s], a)), - a += o - } - r.push(r[0]) - } else { - var l = new Array; - for (l.push(t[0].clone()), + ); + })(), + P = (function () { + function e(e) { + (this._length = 0), + (this._points = e), + (this._length = this._computeLength(e)); + } + return ( + (e.CreateQuadraticBezier = function (t, i, n, r) { + r = r > 2 ? r : 3; + for ( + var o = new Array(), + a = function (e, t, i, n) { + return ( + (1 - e) * (1 - e) * t + + 2 * e * (1 - e) * i + + e * e * n + ); + }, + s = 0; + s <= r; + s++ + ) + o.push( + new f( + a(s / r, t.x, i.x, n.x), + a(s / r, t.y, i.y, n.y), + a(s / r, t.z, i.z, n.z) + ) + ); + return new e(o); + }), + (e.CreateCubicBezier = function (t, i, n, r, o) { + o = o > 3 ? o : 4; + for ( + var a = new Array(), + s = function (e, t, i, n, r) { + return ( + (1 - e) * (1 - e) * (1 - e) * t + + 3 * e * (1 - e) * (1 - e) * i + + 3 * e * e * (1 - e) * n + + e * e * e * r + ); + }, + c = 0; + c <= o; + c++ + ) + a.push( + new f( + s(c / o, t.x, i.x, n.x, r.x), + s(c / o, t.y, i.y, n.y, r.y), + s(c / o, t.z, i.z, n.z, r.z) + ) + ); + return new e(a); + }), + (e.CreateHermiteSpline = function (t, i, n, r, o) { + for (var a = new Array(), s = 1 / o, c = 0; c <= o; c++) + a.push(f.Hermite(t, i, n, r, c * s)); + return new e(a); + }), + (e.CreateCatmullRomSpline = function (t, i, n) { + var r = new Array(), + o = 1 / i, + a = 0; + if (n) { + for (var s = t.length, c = 0; c < s; c++) { + a = 0; + for (var u = 0; u < i; u++) + r.push( + f.CatmullRom( + t[c % s], + t[(c + 1) % s], + t[(c + 2) % s], + t[(c + 3) % s], + a + ) + ), + (a += o); + } + r.push(r[0]); + } else { + var l = new Array(); + for ( + l.push(t[0].clone()), Array.prototype.push.apply(l, t), l.push(t[t.length - 1].clone()), - c = 0; c < l.length - 3; c++) - for (a = 0, - u = 0; u < i; u++) - r.push(f.CatmullRom(l[c], l[c + 1], l[c + 2], l[c + 3], a)), - a += o; - c--, - r.push(f.CatmullRom(l[c], l[c + 1], l[c + 2], l[c + 3], a)) - } - return new e(r) - } - , - e.prototype.getPoints = function() { - return this._points - } - , - e.prototype.length = function() { - return this._length - } - , - e.prototype.continue = function(t) { - for (var i = this._points[this._points.length - 1], n = this._points.slice(), r = t.getPoints(), o = 1; o < r.length; o++) - n.push(r[o].subtract(r[0]).add(i)); - return new e(n) - } - , - e.prototype._computeLength = function(e) { - for (var t = 0, i = 1; i < e.length; i++) - t += e[i].subtract(e[i - 1]).length(); - return t - } - , - e - }() - , R = function() { - function e(e, t) { - void 0 === e && (e = f.Zero()), - void 0 === t && (t = f.Up()), - this.position = e, - this.normal = t - } - return e.prototype.clone = function() { - return new e(this.position.clone(),this.normal.clone()) - } - , - e - }() - , M = function() { - function e(e, t, i) { - void 0 === e && (e = f.Zero()), - void 0 === t && (t = f.Up()), - void 0 === i && (i = h.Zero()), - this.position = e, - this.normal = t, - this.uv = i - } - return e.prototype.clone = function() { - return new e(this.position.clone(),this.normal.clone(),this.uv.clone()) - } - , - e - }() - , O = function() { - function e() {} - return e.Color3 = r.a.BuildArray(3, u.Black), - e.Color4 = r.a.BuildArray(3, function() { - return new l(0,0,0,0) + c = 0; + c < l.length - 3; + c++ + ) + for (a = 0, u = 0; u < i; u++) + r.push( + f.CatmullRom( + l[c], + l[c + 1], + l[c + 2], + l[c + 3], + a + ) + ), + (a += o); + c--, + r.push( + f.CatmullRom(l[c], l[c + 1], l[c + 2], l[c + 3], a) + ); + } + return new e(r); + }), + (e.prototype.getPoints = function () { + return this._points; + }), + (e.prototype.length = function () { + return this._length; + }), + (e.prototype.continue = function (t) { + for ( + var i = this._points[this._points.length - 1], + n = this._points.slice(), + r = t.getPoints(), + o = 1; + o < r.length; + o++ + ) + n.push(r[o].subtract(r[0]).add(i)); + return new e(n); + }), + (e.prototype._computeLength = function (e) { + for (var t = 0, i = 1; i < e.length; i++) + t += e[i].subtract(e[i - 1]).length(); + return t; }), - e.Vector2 = r.a.BuildArray(3, h.Zero), - e.Vector3 = r.a.BuildArray(13, f.Zero), - e.Vector4 = r.a.BuildArray(3, d.Zero), - e.Quaternion = r.a.BuildArray(2, m.Zero), - e.Matrix = r.a.BuildArray(8, g.Identity), e - }() - , w = function() { - function e() {} - return e.Vector3 = r.a.BuildArray(6, f.Zero), - e.Matrix = r.a.BuildArray(2, g.Identity), - e.Quaternion = r.a.BuildArray(3, m.Zero), + ); + })(), + R = (function () { + function e(e, t) { + void 0 === e && (e = f.Zero()), + void 0 === t && (t = f.Up()), + (this.position = e), + (this.normal = t); + } + return ( + (e.prototype.clone = function () { + return new e(this.position.clone(), this.normal.clone()); + }), e - }() - } - , function(e, t, n) { - "use strict"; - n.d(t, "d", function() { - return o + ); + })(), + M = (function () { + function e(e, t, i) { + void 0 === e && (e = f.Zero()), + void 0 === t && (t = f.Up()), + void 0 === i && (i = h.Zero()), + (this.position = e), + (this.normal = t), + (this.uv = i); + } + return ( + (e.prototype.clone = function () { + return new e( + this.position.clone(), + this.normal.clone(), + this.uv.clone() + ); + }), + e + ); + })(), + O = (function () { + function e() {} + return ( + (e.Color3 = r.a.BuildArray(3, u.Black)), + (e.Color4 = r.a.BuildArray(3, function () { + return new l(0, 0, 0, 0); + })), + (e.Vector2 = r.a.BuildArray(3, h.Zero)), + (e.Vector3 = r.a.BuildArray(13, f.Zero)), + (e.Vector4 = r.a.BuildArray(3, d.Zero)), + (e.Quaternion = r.a.BuildArray(2, m.Zero)), + (e.Matrix = r.a.BuildArray(8, g.Identity)), + e + ); + })(), + w = (function () { + function e() {} + return ( + (e.Vector3 = r.a.BuildArray(6, f.Zero)), + (e.Matrix = r.a.BuildArray(2, g.Identity)), + (e.Quaternion = r.a.BuildArray(3, m.Zero)), + e + ); + })(); + }, + function (e, t, n) { + "use strict"; + n.d(t, "d", function () { + return o; + }), + n.d(t, "a", function () { + return a; }), - n.d(t, "a", function() { - return a + n.d(t, "c", function () { + return s; }), - n.d(t, "c", function() { - return s + n.d(t, "b", function () { + return u; }), - n.d(t, "b", function() { - return u - }), - n.d(t, "e", function() { - return l + n.d(t, "e", function () { + return l; }); - /*! ***************************************************************************** + /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the @@ -24880,2012 +29453,2565 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ - var r = function(e, t) { - return (r = Object.setPrototypeOf || { - __proto__: [] - }instanceof Array && function(e, t) { - e.__proto__ = t - } - || function(e, t) { - for (var i in t) - t.hasOwnProperty(i) && (e[i] = t[i]) - } - )(e, t) - }; - function o(e, t) { - function i() { - this.constructor = e - } - r(e, t), - e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, - new i) + var r = function (e, t) { + return (r = + Object.setPrototypeOf || + ({ + __proto__: [], + } instanceof Array && + function (e, t) { + e.__proto__ = t; + }) || + function (e, t) { + for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i]); + })(e, t); + }; + function o(e, t) { + function i() { + this.constructor = e; } - var a = function() { - return (a = Object.assign || function(e) { - for (var t, i = 1, n = arguments.length; i < n; i++) - for (var r in t = arguments[i]) - Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); - return e + r(e, t), + (e.prototype = + null === t + ? Object.create(t) + : ((i.prototype = t.prototype), new i())); + } + var a = function () { + return (a = + Object.assign || + function (e) { + for (var t, i = 1, n = arguments.length; i < n; i++) + for (var r in (t = arguments[i])) + Object.prototype.hasOwnProperty.call(t, r) && + (e[r] = t[r]); + return e; + }).apply(this, arguments); + }; + function s(e, t, i, n) { + var r, + o = arguments.length, + a = + o < 3 + ? t + : null === n + ? (n = Object.getOwnPropertyDescriptor(t, i)) + : n; + if ( + "object" == + ("undefined" == typeof Reflect + ? "undefined" + : c(Reflect)) && + "function" == typeof Reflect.decorate + ) + a = Reflect.decorate(e, t, i, n); + else + for (var s = e.length - 1; s >= 0; s--) + (r = e[s]) && + (a = (o < 3 ? r(a) : o > 3 ? r(t, i, a) : r(t, i)) || a); + return o > 3 && a && Object.defineProperty(t, i, a), a; + } + function u(e, t, n, r) { + return new (n || (n = i))(function (i, o) { + function a(e) { + try { + c(r.next(e)); + } catch (e) { + o(e); } - ).apply(this, arguments) - }; - function s(e, t, i, n) { - var r, o = arguments.length, a = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, i) : n; - if ("object" == ("undefined" == typeof Reflect ? "undefined" : c(Reflect)) && "function" == typeof Reflect.decorate) - a = Reflect.decorate(e, t, i, n); - else - for (var s = e.length - 1; s >= 0; s--) - (r = e[s]) && (a = (o < 3 ? r(a) : o > 3 ? r(t, i, a) : r(t, i)) || a); - return o > 3 && a && Object.defineProperty(t, i, a), - a - } - function u(e, t, n, r) { - return new (n || (n = i))(function(i, o) { - function a(e) { - try { - c(r.next(e)) - } catch (e) { - o(e) - } - } - function s(e) { - try { - c(r.throw(e)) - } catch (e) { - o(e) - } - } - function c(e) { - e.done ? i(e.value) : new n(function(t) { - t(e.value) - } - ).then(a, s) - } - c((r = r.apply(e, t || [])).next()) + } + function s(e) { + try { + c(r.throw(e)); + } catch (e) { + o(e); } - ) - } - function l(e, t) { - var i, n, r, o, a = { - label: 0, - sent: function() { - if (1 & r[0]) - throw r[1]; - return r[1] - }, - trys: [], - ops: [] - }; - return o = { - next: s(0), - throw: s(1), - return: s(2) + } + function c(e) { + e.done + ? i(e.value) + : new n(function (t) { + t(e.value); + }).then(a, s); + } + c((r = r.apply(e, t || [])).next()); + }); + } + function l(e, t) { + var i, + n, + r, + o, + a = { + label: 0, + sent: function () { + if (1 & r[0]) throw r[1]; + return r[1]; }, - "function" == typeof Symbol && (o[Symbol.iterator] = function() { - return this - } - ), - o; - function s(o) { - return function(s) { - return function(o) { - if (i) - throw new TypeError("Generator is already executing."); - for (; a; ) - try { - if (i = 1, - n && (r = 2 & o[0] ? n.return : o[0] ? n.throw || ((r = n.return) && r.call(n), - 0) : n.next) && !(r = r.call(n, o[1])).done) - return r; - switch (n = 0, - r && (o = [2 & o[0], r.value]), - o[0]) { - case 0: - case 1: - r = o; - break; - case 4: - return a.label++, - { - value: o[1], - done: false - }; - case 5: - a.label++, - n = o[1], - o = [0]; - continue; - case 7: - o = a.ops.pop(), - a.trys.pop(); - continue; - default: - if (!(r = (r = a.trys).length > 0 && r[r.length - 1]) && (6 === o[0] || 2 === o[0])) { - a = 0; - continue - } - if (3 === o[0] && (!r || o[1] > r[0] && o[1] < r[3])) { - a.label = o[1]; - break - } - if (6 === o[0] && a.label < r[1]) { - a.label = r[1], - r = o; - break - } - if (r && a.label < r[2]) { - a.label = r[2], - a.ops.push(o); - break - } - r[2] && a.ops.pop(), - a.trys.pop(); - continue - } - o = t.call(e, a) - } catch (e) { - o = [6, e], - n = 0 - } finally { - i = r = 0 - } - if (5 & o[0]) - throw o[1]; - return { - value: o[0] ? o[1] : void 0, - done: true - } - }([o, s]) - } - } - } - } - , function(e, t, i) { - "use strict"; - i.d(t, "b", function() { - return h - }), - i.d(t, "c", function() { - return f - }), - i.d(t, "m", function() { - return d - }), - i.d(t, "e", function() { - return p - }), - i.d(t, "h", function() { - return m - }), - i.d(t, "n", function() { - return g - }), - i.d(t, "o", function() { - return _ - }), - i.d(t, "k", function() { - return v - }), - i.d(t, "g", function() { - return y - }), - i.d(t, "f", function() { - return b - }), - i.d(t, "i", function() { - return E - }), - i.d(t, "l", function() { - return T - }), - i.d(t, "j", function() { - return A - }), - i.d(t, "d", function() { - return x - }), - i.d(t, "a", function() { - return S - }); - var n = i(29) - , r = i(0) - , o = i(19) - , a = {} - , s = {} - , c = function(e, t, i) { - var r = e(); - n.a && n.a.AddTagsTo(r, t.tags); - var o = u(r); - for (var a in o) { - var s = o[a] - , c = t[a] - , l = s.type; - if (null != c && "uniqueId" !== a) - switch (l) { - case 0: - case 6: - case 11: - r[a] = c; - break; - case 1: - r[a] = i || c.isRenderTarget ? c : c.clone(); - break; - case 2: - case 3: - case 4: - case 5: - case 7: - case 10: - case 12: - r[a] = i ? c : c.clone() - } - } - return r - }; - function u(e) { - var t = e.getClassName(); - if (s[t]) - return s[t]; - s[t] = {}; - for (var i = s[t], n = e, r = t; r; ) { - var o = a[r]; - for (var c in o) - i[c] = o[c]; - var u = void 0 - , l = false; - do { - if (!(u = Object.getPrototypeOf(n)).getClassName) { - l = true; - break - } - if (u.getClassName() !== r) - break; - n = u - } while (u);if (l) - break; - r = u.getClassName(), - n = u - } - return i - } - function l(e, t) { - return function(i, n) { - var r = function(e) { - var t = i.getClassName(); - return a[t] || (a[t] = {}), - a[t] - }(); - r[n] || (r[n] = { - type: e, - sourceName: t - }) - } - } - function h(e, t) { - return void 0 === t && (t = null), - function(e, t) { - return void 0 === t && (t = null), - function(i, n) { - var r = t || "_" + n; - Object.defineProperty(i, n, { - get: function() { - return this[r] - }, - set: function(t) { - this[r] !== t && (this[r] = t, - i[e].apply(this)) - }, - enumerable: true, - configurable: true - }) - } - }(e, t) - } - function f(e) { - return l(0, e) - } - function d(e) { - return l(1, e) - } - function p(e) { - return l(2, e) - } - function m(e) { - return l(3, e) - } - function g(e) { - return l(4, e) - } - function _(e) { - return l(5, e) - } - function v(e) { - return l(6, e) - } - function y(e) { - return l(7, e) - } - function b(e) { - return l(8, e) - } - function E(e) { - return l(9, e) - } - function T(e) { - return l(10, e) - } - function A(e) { - return l(12, e) - } - function x(e) { - return l(11, e) - } - var S = function() { - function e() {} - return e.AppendSerializedAnimations = function(e, t) { - if (e.animations) { - t.animations = []; - for (var i = 0; i < e.animations.length; i++) { - var n = e.animations[i]; - t.animations.push(n.serialize()) - } - } - } - , - e.Serialize = function(e, t) { - t || (t = {}), - n.a && (t.tags = n.a.GetTags(e)); - var i = u(e); - for (var r in i) { - var o = i[r] - , a = o.sourceName || r - , s = o.type - , c = e[r]; - if (null != c) - switch (s) { - case 0: - t[a] = c; - break; - case 1: - t[a] = c.serialize(); - break; - case 2: - t[a] = c.asArray(); - break; - case 3: - t[a] = c.serialize(); - break; - case 4: - case 5: - t[a] = c.asArray(); - break; - case 6: - t[a] = c.id; - break; - case 7: - t[a] = c.serialize(); - break; - case 8: - t[a] = c.asArray(); - break; - case 9: - t[a] = c.serialize(); - break; - case 10: - t[a] = c.asArray(); - break; - case 11: - t[a] = c.id; - case 12: - t[a] = c.asArray() - } - } - return t - } - , - e.Parse = function(t, i, o, a) { - void 0 === a && (a = null); - var s = t(); - a || (a = ""), - n.a && n.a.AddTagsTo(s, i.tags); - var c = u(s); - for (var l in c) { - var h = c[l] - , f = i[h.sourceName || l] - , d = h.type; - if (null != f) { - var p = s; - switch (d) { - case 0: - p[l] = f; - break; - case 1: - o && (p[l] = e._TextureParser(f, o, a)); - break; - case 2: - p[l] = r.e.FromArray(f); - break; - case 3: - p[l] = e._FresnelParametersParser(f); - break; - case 4: - p[l] = r.w.FromArray(f); - break; - case 5: - p[l] = r.x.FromArray(f); - break; - case 6: - o && (p[l] = o.getLastMeshByID(f)); - break; - case 7: - p[l] = e._ColorCurvesParser(f); - break; - case 8: - p[l] = r.f.FromArray(f); - break; - case 9: - p[l] = e._ImageProcessingConfigurationParser(f); - break; - case 10: - p[l] = r.q.FromArray(f); - break; - case 11: - o && (p[l] = o.getCameraByID(f)); - case 12: - p[l] = r.j.FromArray(f) - } - } - } - return s - } - , - e.Clone = function(e, t) { - return c(e, t, false) - } - , - e.Instanciate = function(e, t) { - return c(e, t, true) - } - , - e._ImageProcessingConfigurationParser = function(e) { - throw o.a.WarnImport("ImageProcessingConfiguration") - } - , - e._FresnelParametersParser = function(e) { - throw o.a.WarnImport("FresnelParameters") - } - , - e._ColorCurvesParser = function(e) { - throw o.a.WarnImport("ColorCurves") - } - , - e._TextureParser = function(e, t, i) { - throw o.a.WarnImport("Texture") - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return e.ALPHA_DISABLE = 0, - e.ALPHA_ADD = 1, - e.ALPHA_COMBINE = 2, - e.ALPHA_SUBTRACT = 3, - e.ALPHA_MULTIPLY = 4, - e.ALPHA_MAXIMIZED = 5, - e.ALPHA_ONEONE = 6, - e.ALPHA_PREMULTIPLIED = 7, - e.ALPHA_PREMULTIPLIED_PORTERDUFF = 8, - e.ALPHA_INTERPOLATE = 9, - e.ALPHA_SCREENMODE = 10, - e.DELAYLOADSTATE_NONE = 0, - e.DELAYLOADSTATE_LOADED = 1, - e.DELAYLOADSTATE_LOADING = 2, - e.DELAYLOADSTATE_NOTLOADED = 4, - e.NEVER = 512, - e.ALWAYS = 519, - e.LESS = 513, - e.EQUAL = 514, - e.LEQUAL = 515, - e.GREATER = 516, - e.GEQUAL = 518, - e.NOTEQUAL = 517, - e.KEEP = 7680, - e.REPLACE = 7681, - e.INCR = 7682, - e.DECR = 7683, - e.INVERT = 5386, - e.INCR_WRAP = 34055, - e.DECR_WRAP = 34056, - e.TEXTURE_CLAMP_ADDRESSMODE = 0, - e.TEXTURE_WRAP_ADDRESSMODE = 1, - e.TEXTURE_MIRROR_ADDRESSMODE = 2, - e.TEXTUREFORMAT_ALPHA = 0, - e.TEXTUREFORMAT_LUMINANCE = 1, - e.TEXTUREFORMAT_LUMINANCE_ALPHA = 2, - e.TEXTUREFORMAT_RGB = 4, - e.TEXTUREFORMAT_RGBA = 5, - e.TEXTUREFORMAT_RED = 6, - e.TEXTUREFORMAT_R = 6, - e.TEXTUREFORMAT_RG = 7, - e.TEXTUREFORMAT_RED_INTEGER = 8, - e.TEXTUREFORMAT_R_INTEGER = 8, - e.TEXTUREFORMAT_RG_INTEGER = 9, - e.TEXTUREFORMAT_RGB_INTEGER = 10, - e.TEXTUREFORMAT_RGBA_INTEGER = 11, - e.TEXTURETYPE_UNSIGNED_BYTE = 0, - e.TEXTURETYPE_UNSIGNED_INT = 0, - e.TEXTURETYPE_FLOAT = 1, - e.TEXTURETYPE_HALF_FLOAT = 2, - e.TEXTURETYPE_BYTE = 3, - e.TEXTURETYPE_SHORT = 4, - e.TEXTURETYPE_UNSIGNED_SHORT = 5, - e.TEXTURETYPE_INT = 6, - e.TEXTURETYPE_UNSIGNED_INTEGER = 7, - e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8, - e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9, - e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10, - e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11, - e.TEXTURETYPE_UNSIGNED_INT_24_8 = 12, - e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13, - e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14, - e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15, - e.TEXTURE_NEAREST_SAMPLINGMODE = 1, - e.TEXTURE_BILINEAR_SAMPLINGMODE = 2, - e.TEXTURE_TRILINEAR_SAMPLINGMODE = 3, - e.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 1, - e.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 2, - e.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3, - e.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4, - e.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5, - e.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6, - e.TEXTURE_NEAREST_LINEAR = 7, - e.TEXTURE_NEAREST_NEAREST = 8, - e.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9, - e.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10, - e.TEXTURE_LINEAR_LINEAR = 11, - e.TEXTURE_LINEAR_NEAREST = 12, - e.TEXTURE_EXPLICIT_MODE = 0, - e.TEXTURE_SPHERICAL_MODE = 1, - e.TEXTURE_PLANAR_MODE = 2, - e.TEXTURE_CUBIC_MODE = 3, - e.TEXTURE_PROJECTION_MODE = 4, - e.TEXTURE_SKYBOX_MODE = 5, - e.TEXTURE_INVCUBIC_MODE = 6, - e.TEXTURE_EQUIRECTANGULAR_MODE = 7, - e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8, - e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9, - e.SCALEMODE_FLOOR = 1, - e.SCALEMODE_NEAREST = 2, - e.SCALEMODE_CEILING = 3, - e.MATERIAL_TextureDirtyFlag = 1, - e.MATERIAL_LightDirtyFlag = 2, - e.MATERIAL_FresnelDirtyFlag = 4, - e.MATERIAL_AttributesDirtyFlag = 8, - e.MATERIAL_MiscDirtyFlag = 16, - e.MATERIAL_AllDirtyFlag = 31, - e.MATERIAL_TriangleFillMode = 0, - e.MATERIAL_WireFrameFillMode = 1, - e.MATERIAL_PointFillMode = 2, - e.MATERIAL_PointListDrawMode = 3, - e.MATERIAL_LineListDrawMode = 4, - e.MATERIAL_LineLoopDrawMode = 5, - e.MATERIAL_LineStripDrawMode = 6, - e.MATERIAL_TriangleStripDrawMode = 7, - e.MATERIAL_TriangleFanDrawMode = 8, - e.MATERIAL_ClockWiseSideOrientation = 0, - e.MATERIAL_CounterClockWiseSideOrientation = 1, - e.ACTION_NothingTrigger = 0, - e.ACTION_OnPickTrigger = 1, - e.ACTION_OnLeftPickTrigger = 2, - e.ACTION_OnRightPickTrigger = 3, - e.ACTION_OnCenterPickTrigger = 4, - e.ACTION_OnPickDownTrigger = 5, - e.ACTION_OnDoublePickTrigger = 6, - e.ACTION_OnPickUpTrigger = 7, - e.ACTION_OnPickOutTrigger = 16, - e.ACTION_OnLongPressTrigger = 8, - e.ACTION_OnPointerOverTrigger = 9, - e.ACTION_OnPointerOutTrigger = 10, - e.ACTION_OnEveryFrameTrigger = 11, - e.ACTION_OnIntersectionEnterTrigger = 12, - e.ACTION_OnIntersectionExitTrigger = 13, - e.ACTION_OnKeyDownTrigger = 14, - e.ACTION_OnKeyUpTrigger = 15, - e.PARTICLES_BILLBOARDMODE_Y = 2, - e.PARTICLES_BILLBOARDMODE_ALL = 7, - e.PARTICLES_BILLBOARDMODE_STRETCHED = 8, - e.PARTICLES_BaseAssetsUrl = "https://assets.babylonjs.com/particles", - e.MESHES_CULLINGSTRATEGY_STANDARD = 0, - e.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1, - e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2, - e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3, - e.SCENELOADER_NO_LOGGING = 0, - e.SCENELOADER_MINIMAL_LOGGING = 1, - e.SCENELOADER_SUMMARY_LOGGING = 2, - e.SCENELOADER_DETAILED_LOGGING = 3, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }), - i.d(t, "b", function() { - return r - }); - var n = function() { - function e(e, t, i, n, r, o, a) { - void 0 === n && (n = 0), - void 0 === r && (r = false), - void 0 === o && (o = false), - void 0 === a && (a = false), - e.getScene ? this._engine = e.getScene().getEngine() : this._engine = e, - this._updatable = i, - this._instanced = o, - this._data = t, - this.byteStride = a ? n : n * Float32Array.BYTES_PER_ELEMENT, - r || this.create() - } - return e.prototype.createVertexBuffer = function(e, t, i, n, o, a) { - void 0 === a && (a = false); - var s = a ? t : t * Float32Array.BYTES_PER_ELEMENT - , c = n ? a ? n : n * Float32Array.BYTES_PER_ELEMENT : this.byteStride; - return new r(this._engine,this,e,this._updatable,true,c,void 0 === o ? this._instanced : o,s,i,void 0,void 0,true) - } - , - e.prototype.isUpdatable = function() { - return this._updatable - } - , - e.prototype.getData = function() { - return this._data - } - , - e.prototype.getBuffer = function() { - return this._buffer - } - , - e.prototype.getStrideSize = function() { - return this.byteStride / Float32Array.BYTES_PER_ELEMENT - } - , - e.prototype.create = function(e) { - void 0 === e && (e = null), - !e && this._buffer || (e = e || this._data) && (this._buffer ? this._updatable && (this._engine.updateDynamicVertexBuffer(this._buffer, e), - this._data = e) : this._updatable ? (this._buffer = this._engine.createDynamicVertexBuffer(e), - this._data = e) : this._buffer = this._engine.createVertexBuffer(e)) - } - , - e.prototype._rebuild = function() { - this._buffer = null, - this.create(this._data) - } - , - e.prototype.update = function(e) { - this.create(e) - } - , - e.prototype.updateDirectly = function(e, t, i, n) { - void 0 === n && (n = false), - this._buffer && this._updatable && (this._engine.updateDynamicVertexBuffer(this._buffer, e, n ? t : t * Float32Array.BYTES_PER_ELEMENT, i ? i * this.byteStride : void 0), - this._data = null) - } - , - e.prototype.dispose = function() { - this._buffer && this._engine._releaseBuffer(this._buffer) && (this._buffer = null) - } - , - e - }() - , r = function() { - function e(t, i, r, o, a, s, c, u, l, h, f, d) { - if (void 0 === f && (f = false), - void 0 === d && (d = false), - i instanceof n ? (this._buffer = i, - this._ownsBuffer = false) : (this._buffer = new n(t,i,o,s,a,c,d), - this._ownsBuffer = true), - this._kind = r, - null == h) { - var p = this.getData(); - this.type = e.FLOAT, - p instanceof Int8Array ? this.type = e.BYTE : p instanceof Uint8Array ? this.type = e.UNSIGNED_BYTE : p instanceof Int16Array ? this.type = e.SHORT : p instanceof Uint16Array ? this.type = e.UNSIGNED_SHORT : p instanceof Int32Array ? this.type = e.INT : p instanceof Uint32Array && (this.type = e.UNSIGNED_INT) - } else - this.type = h; - var m = e.GetTypeByteLength(this.type); - d ? (this._size = l || (s ? s / m : e.DeduceStride(r)), - this.byteStride = s || this._buffer.byteStride || this._size * m, - this.byteOffset = u || 0) : (this._size = l || s || e.DeduceStride(r), - this.byteStride = s ? s * m : this._buffer.byteStride || this._size * m, - this.byteOffset = (u || 0) * m), - this.normalized = f, - this._instanced = void 0 !== c && c, - this._instanceDivisor = c ? 1 : 0 - } - return Object.defineProperty(e.prototype, "instanceDivisor", { - get: function() { - return this._instanceDivisor - }, - set: function(e) { - this._instanceDivisor = e, - this._instanced = 0 != e - }, - enumerable: true, - configurable: true + trys: [], + ops: [], + }; + return ( + (o = { + next: s(0), + throw: s(1), + return: s(2), + }), + "function" == typeof Symbol && + (o[Symbol.iterator] = function () { + return this; }), - e.prototype._rebuild = function() { - this._buffer && this._buffer._rebuild() + o + ); + function s(o) { + return function (s) { + return (function (o) { + if (i) + throw new TypeError("Generator is already executing."); + for (; a; ) + try { + if ( + ((i = 1), + n && + (r = + 2 & o[0] + ? n.return + : o[0] + ? n.throw || ((r = n.return) && r.call(n), 0) + : n.next) && + !(r = r.call(n, o[1])).done) + ) + return r; + switch ( + ((n = 0), r && (o = [2 & o[0], r.value]), o[0]) + ) { + case 0: + case 1: + r = o; + break; + case 4: + return ( + a.label++, + { + value: o[1], + done: false, + } + ); + case 5: + a.label++, (n = o[1]), (o = [0]); + continue; + case 7: + (o = a.ops.pop()), a.trys.pop(); + continue; + default: + if ( + !(r = + (r = a.trys).length > 0 && r[r.length - 1]) && + (6 === o[0] || 2 === o[0]) + ) { + a = 0; + continue; + } + if ( + 3 === o[0] && + (!r || (o[1] > r[0] && o[1] < r[3])) + ) { + a.label = o[1]; + break; + } + if (6 === o[0] && a.label < r[1]) { + (a.label = r[1]), (r = o); + break; + } + if (r && a.label < r[2]) { + (a.label = r[2]), a.ops.push(o); + break; + } + r[2] && a.ops.pop(), a.trys.pop(); + continue; + } + o = t.call(e, a); + } catch (e) { + (o = [6, e]), (n = 0); + } finally { + i = r = 0; + } + if (5 & o[0]) throw o[1]; + return { + value: o[0] ? o[1] : void 0, + done: true, + }; + })([o, s]); + }; + } + } + }, + function (e, t, i) { + "use strict"; + i.d(t, "b", function () { + return h; + }), + i.d(t, "c", function () { + return f; + }), + i.d(t, "m", function () { + return d; + }), + i.d(t, "e", function () { + return p; + }), + i.d(t, "h", function () { + return m; + }), + i.d(t, "n", function () { + return g; + }), + i.d(t, "o", function () { + return _; + }), + i.d(t, "k", function () { + return v; + }), + i.d(t, "g", function () { + return y; + }), + i.d(t, "f", function () { + return b; + }), + i.d(t, "i", function () { + return E; + }), + i.d(t, "l", function () { + return T; + }), + i.d(t, "j", function () { + return A; + }), + i.d(t, "d", function () { + return x; + }), + i.d(t, "a", function () { + return S; + }); + var n = i(29), + r = i(0), + o = i(19), + a = {}, + s = {}, + c = function (e, t, i) { + var r = e(); + n.a && n.a.AddTagsTo(r, t.tags); + var o = u(r); + for (var a in o) { + var s = o[a], + c = t[a], + l = s.type; + if (null != c && "uniqueId" !== a) + switch (l) { + case 0: + case 6: + case 11: + r[a] = c; + break; + case 1: + r[a] = i || c.isRenderTarget ? c : c.clone(); + break; + case 2: + case 3: + case 4: + case 5: + case 7: + case 10: + case 12: + r[a] = i ? c : c.clone(); + } + } + return r; + }; + function u(e) { + var t = e.getClassName(); + if (s[t]) return s[t]; + s[t] = {}; + for (var i = s[t], n = e, r = t; r; ) { + var o = a[r]; + for (var c in o) i[c] = o[c]; + var u = void 0, + l = false; + do { + if (!(u = Object.getPrototypeOf(n)).getClassName) { + l = true; + break; } - , - e.prototype.getKind = function() { - return this._kind + if (u.getClassName() !== r) break; + n = u; + } while (u); + if (l) break; + (r = u.getClassName()), (n = u); + } + return i; + } + function l(e, t) { + return function (i, n) { + var r = (function (e) { + var t = i.getClassName(); + return a[t] || (a[t] = {}), a[t]; + })(); + r[n] || + (r[n] = { + type: e, + sourceName: t, + }); + }; + } + function h(e, t) { + return ( + void 0 === t && (t = null), + (function (e, t) { + return ( + void 0 === t && (t = null), + function (i, n) { + var r = t || "_" + n; + Object.defineProperty(i, n, { + get: function () { + return this[r]; + }, + set: function (t) { + this[r] !== t && ((this[r] = t), i[e].apply(this)); + }, + enumerable: true, + configurable: true, + }); + } + ); + })(e, t) + ); + } + function f(e) { + return l(0, e); + } + function d(e) { + return l(1, e); + } + function p(e) { + return l(2, e); + } + function m(e) { + return l(3, e); + } + function g(e) { + return l(4, e); + } + function _(e) { + return l(5, e); + } + function v(e) { + return l(6, e); + } + function y(e) { + return l(7, e); + } + function b(e) { + return l(8, e); + } + function E(e) { + return l(9, e); + } + function T(e) { + return l(10, e); + } + function A(e) { + return l(12, e); + } + function x(e) { + return l(11, e); + } + var S = (function () { + function e() {} + return ( + (e.AppendSerializedAnimations = function (e, t) { + if (e.animations) { + t.animations = []; + for (var i = 0; i < e.animations.length; i++) { + var n = e.animations[i]; + t.animations.push(n.serialize()); + } } - , - e.prototype.isUpdatable = function() { - return this._buffer.isUpdatable() + }), + (e.Serialize = function (e, t) { + t || (t = {}), n.a && (t.tags = n.a.GetTags(e)); + var i = u(e); + for (var r in i) { + var o = i[r], + a = o.sourceName || r, + s = o.type, + c = e[r]; + if (null != c) + switch (s) { + case 0: + t[a] = c; + break; + case 1: + t[a] = c.serialize(); + break; + case 2: + t[a] = c.asArray(); + break; + case 3: + t[a] = c.serialize(); + break; + case 4: + case 5: + t[a] = c.asArray(); + break; + case 6: + t[a] = c.id; + break; + case 7: + t[a] = c.serialize(); + break; + case 8: + t[a] = c.asArray(); + break; + case 9: + t[a] = c.serialize(); + break; + case 10: + t[a] = c.asArray(); + break; + case 11: + t[a] = c.id; + case 12: + t[a] = c.asArray(); + } } - , - e.prototype.getData = function() { - return this._buffer.getData() + return t; + }), + (e.Parse = function (t, i, o, a) { + void 0 === a && (a = null); + var s = t(); + a || (a = ""), n.a && n.a.AddTagsTo(s, i.tags); + var c = u(s); + for (var l in c) { + var h = c[l], + f = i[h.sourceName || l], + d = h.type; + if (null != f) { + var p = s; + switch (d) { + case 0: + p[l] = f; + break; + case 1: + o && (p[l] = e._TextureParser(f, o, a)); + break; + case 2: + p[l] = r.e.FromArray(f); + break; + case 3: + p[l] = e._FresnelParametersParser(f); + break; + case 4: + p[l] = r.w.FromArray(f); + break; + case 5: + p[l] = r.x.FromArray(f); + break; + case 6: + o && (p[l] = o.getLastMeshByID(f)); + break; + case 7: + p[l] = e._ColorCurvesParser(f); + break; + case 8: + p[l] = r.f.FromArray(f); + break; + case 9: + p[l] = e._ImageProcessingConfigurationParser(f); + break; + case 10: + p[l] = r.q.FromArray(f); + break; + case 11: + o && (p[l] = o.getCameraByID(f)); + case 12: + p[l] = r.j.FromArray(f); + } + } } - , - e.prototype.getBuffer = function() { - return this._buffer.getBuffer() - } - , - e.prototype.getStrideSize = function() { - return this.byteStride / e.GetTypeByteLength(this.type) - } - , - e.prototype.getOffset = function() { - return this.byteOffset / e.GetTypeByteLength(this.type) - } - , - e.prototype.getSize = function() { - return this._size - } - , - e.prototype.getIsInstanced = function() { - return this._instanced - } - , - e.prototype.getInstanceDivisor = function() { - return this._instanceDivisor - } - , - e.prototype.create = function(e) { - this._buffer.create(e) - } - , - e.prototype.update = function(e) { - this._buffer.update(e) - } - , - e.prototype.updateDirectly = function(e, t, i) { - void 0 === i && (i = false), - this._buffer.updateDirectly(e, t, void 0, i) - } - , - e.prototype.dispose = function() { - this._ownsBuffer && this._buffer.dispose() - } - , - e.prototype.forEach = function(t, i) { - e.ForEach(this._buffer.getData(), this.byteOffset, this.byteStride, this._size, this.type, t, this.normalized, i) - } - , - e.DeduceStride = function(t) { - switch (t) { + return s; + }), + (e.Clone = function (e, t) { + return c(e, t, false); + }), + (e.Instanciate = function (e, t) { + return c(e, t, true); + }), + (e._ImageProcessingConfigurationParser = function (e) { + throw o.a.WarnImport("ImageProcessingConfiguration"); + }), + (e._FresnelParametersParser = function (e) { + throw o.a.WarnImport("FresnelParameters"); + }), + (e._ColorCurvesParser = function (e) { + throw o.a.WarnImport("ColorCurves"); + }), + (e._TextureParser = function (e, t, i) { + throw o.a.WarnImport("Texture"); + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + (e.ALPHA_DISABLE = 0), + (e.ALPHA_ADD = 1), + (e.ALPHA_COMBINE = 2), + (e.ALPHA_SUBTRACT = 3), + (e.ALPHA_MULTIPLY = 4), + (e.ALPHA_MAXIMIZED = 5), + (e.ALPHA_ONEONE = 6), + (e.ALPHA_PREMULTIPLIED = 7), + (e.ALPHA_PREMULTIPLIED_PORTERDUFF = 8), + (e.ALPHA_INTERPOLATE = 9), + (e.ALPHA_SCREENMODE = 10), + (e.DELAYLOADSTATE_NONE = 0), + (e.DELAYLOADSTATE_LOADED = 1), + (e.DELAYLOADSTATE_LOADING = 2), + (e.DELAYLOADSTATE_NOTLOADED = 4), + (e.NEVER = 512), + (e.ALWAYS = 519), + (e.LESS = 513), + (e.EQUAL = 514), + (e.LEQUAL = 515), + (e.GREATER = 516), + (e.GEQUAL = 518), + (e.NOTEQUAL = 517), + (e.KEEP = 7680), + (e.REPLACE = 7681), + (e.INCR = 7682), + (e.DECR = 7683), + (e.INVERT = 5386), + (e.INCR_WRAP = 34055), + (e.DECR_WRAP = 34056), + (e.TEXTURE_CLAMP_ADDRESSMODE = 0), + (e.TEXTURE_WRAP_ADDRESSMODE = 1), + (e.TEXTURE_MIRROR_ADDRESSMODE = 2), + (e.TEXTUREFORMAT_ALPHA = 0), + (e.TEXTUREFORMAT_LUMINANCE = 1), + (e.TEXTUREFORMAT_LUMINANCE_ALPHA = 2), + (e.TEXTUREFORMAT_RGB = 4), + (e.TEXTUREFORMAT_RGBA = 5), + (e.TEXTUREFORMAT_RED = 6), + (e.TEXTUREFORMAT_R = 6), + (e.TEXTUREFORMAT_RG = 7), + (e.TEXTUREFORMAT_RED_INTEGER = 8), + (e.TEXTUREFORMAT_R_INTEGER = 8), + (e.TEXTUREFORMAT_RG_INTEGER = 9), + (e.TEXTUREFORMAT_RGB_INTEGER = 10), + (e.TEXTUREFORMAT_RGBA_INTEGER = 11), + (e.TEXTURETYPE_UNSIGNED_BYTE = 0), + (e.TEXTURETYPE_UNSIGNED_INT = 0), + (e.TEXTURETYPE_FLOAT = 1), + (e.TEXTURETYPE_HALF_FLOAT = 2), + (e.TEXTURETYPE_BYTE = 3), + (e.TEXTURETYPE_SHORT = 4), + (e.TEXTURETYPE_UNSIGNED_SHORT = 5), + (e.TEXTURETYPE_INT = 6), + (e.TEXTURETYPE_UNSIGNED_INTEGER = 7), + (e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8), + (e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9), + (e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10), + (e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11), + (e.TEXTURETYPE_UNSIGNED_INT_24_8 = 12), + (e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13), + (e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14), + (e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15), + (e.TEXTURE_NEAREST_SAMPLINGMODE = 1), + (e.TEXTURE_BILINEAR_SAMPLINGMODE = 2), + (e.TEXTURE_TRILINEAR_SAMPLINGMODE = 3), + (e.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 1), + (e.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 2), + (e.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3), + (e.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4), + (e.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5), + (e.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6), + (e.TEXTURE_NEAREST_LINEAR = 7), + (e.TEXTURE_NEAREST_NEAREST = 8), + (e.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9), + (e.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10), + (e.TEXTURE_LINEAR_LINEAR = 11), + (e.TEXTURE_LINEAR_NEAREST = 12), + (e.TEXTURE_EXPLICIT_MODE = 0), + (e.TEXTURE_SPHERICAL_MODE = 1), + (e.TEXTURE_PLANAR_MODE = 2), + (e.TEXTURE_CUBIC_MODE = 3), + (e.TEXTURE_PROJECTION_MODE = 4), + (e.TEXTURE_SKYBOX_MODE = 5), + (e.TEXTURE_INVCUBIC_MODE = 6), + (e.TEXTURE_EQUIRECTANGULAR_MODE = 7), + (e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8), + (e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9), + (e.SCALEMODE_FLOOR = 1), + (e.SCALEMODE_NEAREST = 2), + (e.SCALEMODE_CEILING = 3), + (e.MATERIAL_TextureDirtyFlag = 1), + (e.MATERIAL_LightDirtyFlag = 2), + (e.MATERIAL_FresnelDirtyFlag = 4), + (e.MATERIAL_AttributesDirtyFlag = 8), + (e.MATERIAL_MiscDirtyFlag = 16), + (e.MATERIAL_AllDirtyFlag = 31), + (e.MATERIAL_TriangleFillMode = 0), + (e.MATERIAL_WireFrameFillMode = 1), + (e.MATERIAL_PointFillMode = 2), + (e.MATERIAL_PointListDrawMode = 3), + (e.MATERIAL_LineListDrawMode = 4), + (e.MATERIAL_LineLoopDrawMode = 5), + (e.MATERIAL_LineStripDrawMode = 6), + (e.MATERIAL_TriangleStripDrawMode = 7), + (e.MATERIAL_TriangleFanDrawMode = 8), + (e.MATERIAL_ClockWiseSideOrientation = 0), + (e.MATERIAL_CounterClockWiseSideOrientation = 1), + (e.ACTION_NothingTrigger = 0), + (e.ACTION_OnPickTrigger = 1), + (e.ACTION_OnLeftPickTrigger = 2), + (e.ACTION_OnRightPickTrigger = 3), + (e.ACTION_OnCenterPickTrigger = 4), + (e.ACTION_OnPickDownTrigger = 5), + (e.ACTION_OnDoublePickTrigger = 6), + (e.ACTION_OnPickUpTrigger = 7), + (e.ACTION_OnPickOutTrigger = 16), + (e.ACTION_OnLongPressTrigger = 8), + (e.ACTION_OnPointerOverTrigger = 9), + (e.ACTION_OnPointerOutTrigger = 10), + (e.ACTION_OnEveryFrameTrigger = 11), + (e.ACTION_OnIntersectionEnterTrigger = 12), + (e.ACTION_OnIntersectionExitTrigger = 13), + (e.ACTION_OnKeyDownTrigger = 14), + (e.ACTION_OnKeyUpTrigger = 15), + (e.PARTICLES_BILLBOARDMODE_Y = 2), + (e.PARTICLES_BILLBOARDMODE_ALL = 7), + (e.PARTICLES_BILLBOARDMODE_STRETCHED = 8), + (e.PARTICLES_BaseAssetsUrl = + "https://assets.babylonjs.com/particles"), + (e.MESHES_CULLINGSTRATEGY_STANDARD = 0), + (e.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1), + (e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2), + (e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3), + (e.SCENELOADER_NO_LOGGING = 0), + (e.SCENELOADER_MINIMAL_LOGGING = 1), + (e.SCENELOADER_SUMMARY_LOGGING = 2), + (e.SCENELOADER_DETAILED_LOGGING = 3), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }), + i.d(t, "b", function () { + return r; + }); + var n = (function () { + function e(e, t, i, n, r, o, a) { + void 0 === n && (n = 0), + void 0 === r && (r = false), + void 0 === o && (o = false), + void 0 === a && (a = false), + e.getScene + ? (this._engine = e.getScene().getEngine()) + : (this._engine = e), + (this._updatable = i), + (this._instanced = o), + (this._data = t), + (this.byteStride = a + ? n + : n * Float32Array.BYTES_PER_ELEMENT), + r || this.create(); + } + return ( + (e.prototype.createVertexBuffer = function ( + e, + t, + i, + n, + o, + a + ) { + void 0 === a && (a = false); + var s = a ? t : t * Float32Array.BYTES_PER_ELEMENT, + c = n + ? a + ? n + : n * Float32Array.BYTES_PER_ELEMENT + : this.byteStride; + return new r( + this._engine, + this, + e, + this._updatable, + true, + c, + void 0 === o ? this._instanced : o, + s, + i, + void 0, + void 0, + true + ); + }), + (e.prototype.isUpdatable = function () { + return this._updatable; + }), + (e.prototype.getData = function () { + return this._data; + }), + (e.prototype.getBuffer = function () { + return this._buffer; + }), + (e.prototype.getStrideSize = function () { + return this.byteStride / Float32Array.BYTES_PER_ELEMENT; + }), + (e.prototype.create = function (e) { + void 0 === e && (e = null), + (!e && this._buffer) || + ((e = e || this._data) && + (this._buffer + ? this._updatable && + (this._engine.updateDynamicVertexBuffer( + this._buffer, + e + ), + (this._data = e)) + : this._updatable + ? ((this._buffer = + this._engine.createDynamicVertexBuffer(e)), + (this._data = e)) + : (this._buffer = + this._engine.createVertexBuffer(e)))); + }), + (e.prototype._rebuild = function () { + (this._buffer = null), this.create(this._data); + }), + (e.prototype.update = function (e) { + this.create(e); + }), + (e.prototype.updateDirectly = function (e, t, i, n) { + void 0 === n && (n = false), + this._buffer && + this._updatable && + (this._engine.updateDynamicVertexBuffer( + this._buffer, + e, + n ? t : t * Float32Array.BYTES_PER_ELEMENT, + i ? i * this.byteStride : void 0 + ), + (this._data = null)); + }), + (e.prototype.dispose = function () { + this._buffer && + this._engine._releaseBuffer(this._buffer) && + (this._buffer = null); + }), + e + ); + })(), + r = (function () { + function e(t, i, r, o, a, s, c, u, l, h, f, d) { + if ( + (void 0 === f && (f = false), + void 0 === d && (d = false), + i instanceof n + ? ((this._buffer = i), (this._ownsBuffer = false)) + : ((this._buffer = new n(t, i, o, s, a, c, d)), + (this._ownsBuffer = true)), + (this._kind = r), + null == h) + ) { + var p = this.getData(); + (this.type = e.FLOAT), + p instanceof Int8Array + ? (this.type = e.BYTE) + : p instanceof Uint8Array + ? (this.type = e.UNSIGNED_BYTE) + : p instanceof Int16Array + ? (this.type = e.SHORT) + : p instanceof Uint16Array + ? (this.type = e.UNSIGNED_SHORT) + : p instanceof Int32Array + ? (this.type = e.INT) + : p instanceof Uint32Array && + (this.type = e.UNSIGNED_INT); + } else this.type = h; + var m = e.GetTypeByteLength(this.type); + d + ? ((this._size = l || (s ? s / m : e.DeduceStride(r))), + (this.byteStride = + s || this._buffer.byteStride || this._size * m), + (this.byteOffset = u || 0)) + : ((this._size = l || s || e.DeduceStride(r)), + (this.byteStride = s + ? s * m + : this._buffer.byteStride || this._size * m), + (this.byteOffset = (u || 0) * m)), + (this.normalized = f), + (this._instanced = void 0 !== c && c), + (this._instanceDivisor = c ? 1 : 0); + } + return ( + Object.defineProperty(e.prototype, "instanceDivisor", { + get: function () { + return this._instanceDivisor; + }, + set: function (e) { + (this._instanceDivisor = e), (this._instanced = 0 != e); + }, + enumerable: true, + configurable: true, + }), + (e.prototype._rebuild = function () { + this._buffer && this._buffer._rebuild(); + }), + (e.prototype.getKind = function () { + return this._kind; + }), + (e.prototype.isUpdatable = function () { + return this._buffer.isUpdatable(); + }), + (e.prototype.getData = function () { + return this._buffer.getData(); + }), + (e.prototype.getBuffer = function () { + return this._buffer.getBuffer(); + }), + (e.prototype.getStrideSize = function () { + return this.byteStride / e.GetTypeByteLength(this.type); + }), + (e.prototype.getOffset = function () { + return this.byteOffset / e.GetTypeByteLength(this.type); + }), + (e.prototype.getSize = function () { + return this._size; + }), + (e.prototype.getIsInstanced = function () { + return this._instanced; + }), + (e.prototype.getInstanceDivisor = function () { + return this._instanceDivisor; + }), + (e.prototype.create = function (e) { + this._buffer.create(e); + }), + (e.prototype.update = function (e) { + this._buffer.update(e); + }), + (e.prototype.updateDirectly = function (e, t, i) { + void 0 === i && (i = false), + this._buffer.updateDirectly(e, t, void 0, i); + }), + (e.prototype.dispose = function () { + this._ownsBuffer && this._buffer.dispose(); + }), + (e.prototype.forEach = function (t, i) { + e.ForEach( + this._buffer.getData(), + this.byteOffset, + this.byteStride, + this._size, + this.type, + t, + this.normalized, + i + ); + }), + (e.DeduceStride = function (t) { + switch (t) { case e.UVKind: case e.UV2Kind: case e.UV3Kind: case e.UV4Kind: case e.UV5Kind: case e.UV6Kind: - return 2; + return 2; case e.NormalKind: case e.PositionKind: - return 3; + return 3; case e.ColorKind: case e.MatricesIndicesKind: case e.MatricesIndicesExtraKind: case e.MatricesWeightsKind: case e.MatricesWeightsExtraKind: case e.TangentKind: - return 4; + return 4; default: - throw new Error("Invalid kind '" + t + "'") - } - } - , - e.GetTypeByteLength = function(t) { - switch (t) { + throw new Error("Invalid kind '" + t + "'"); + } + }), + (e.GetTypeByteLength = function (t) { + switch (t) { case e.BYTE: case e.UNSIGNED_BYTE: - return 1; + return 1; case e.SHORT: case e.UNSIGNED_SHORT: - return 2; + return 2; case e.INT: case e.FLOAT: - return 4; + return 4; default: - throw new Error("Invalid type '" + t + "'") - } - } - , - e.ForEach = function(t, i, n, r, o, a, s, c) { - if (t instanceof Array) - for (var u = i / 4, l = n / 4, h = 0; h < a; h += r) { - for (var f = 0; f < r; f++) - c(t[u + f], h + f); - u += l - } - else { - var d = t instanceof ArrayBuffer ? new DataView(t) : new DataView(t.buffer,t.byteOffset,t.byteLength) - , p = e.GetTypeByteLength(o); - for (h = 0; h < a; h += r) { - var m = i; - for (f = 0; f < r; f++) - c(e._GetFloatValue(d, o, m, s), h + f), - m += p; - i += n - } - } - } - , - e._GetFloatValue = function(t, i, n, r) { - switch (i) { - case e.BYTE: - var o = t.getInt8(n); - return r && (o = Math.max(o / 127, -1)), - o; - case e.UNSIGNED_BYTE: - return o = t.getUint8(n), - r && (o /= 255), - o; - case e.SHORT: - return o = t.getInt16(n, true), - r && (o = Math.max(o / 16383, -1)), - o; - case e.UNSIGNED_SHORT: - return o = t.getUint16(n, true), - r && (o /= 65535), - o; - case e.FLOAT: - return t.getFloat32(n, true); - default: - throw new Error("Invalid component type " + i) - } - } - , - e.BYTE = 5120, - e.UNSIGNED_BYTE = 5121, - e.SHORT = 5122, - e.UNSIGNED_SHORT = 5123, - e.INT = 5124, - e.UNSIGNED_INT = 5125, - e.FLOAT = 5126, - e.PositionKind = "position", - e.NormalKind = "normal", - e.TangentKind = "tangent", - e.UVKind = "uv", - e.UV2Kind = "uv2", - e.UV3Kind = "uv3", - e.UV4Kind = "uv4", - e.UV5Kind = "uv5", - e.UV6Kind = "uv6", - e.ColorKind = "color", - e.MatricesIndicesKind = "matricesIndices", - e.MatricesWeightsKind = "matricesWeights", - e.MatricesIndicesExtraKind = "matricesIndicesExtra", - e.MatricesWeightsExtraKind = "matricesWeightsExtra", - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "c", function() { - return s - }), - i.d(t, "b", function() { - return c - }), - i.d(t, "a", function() { - return u - }); - var n = i(8) - , r = i(3) - , o = i(35) - , a = i(6) - , s = function() { - function e() { - this._defines = {}, - this._currentRank = 32, - this._maxRank = -1, - this._mesh = null - } - return e.prototype.unBindMesh = function() { - this._mesh = null - } - , - e.prototype.addFallback = function(e, t) { - this._defines[e] || (e < this._currentRank && (this._currentRank = e), - e > this._maxRank && (this._maxRank = e), - this._defines[e] = new Array), - this._defines[e].push(t) - } - , - e.prototype.addCPUSkinningFallback = function(e, t) { - this._mesh = t, - e < this._currentRank && (this._currentRank = e), - e > this._maxRank && (this._maxRank = e) - } - , - Object.defineProperty(e.prototype, "isMoreFallbacks", { - get: function() { - return this._currentRank <= this._maxRank - }, - enumerable: true, - configurable: true + throw new Error("Invalid type '" + t + "'"); + } }), - e.prototype.reduce = function(e, t) { - if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0 && this._mesh.material) { - this._mesh.computeBonesUsingShaders = false, - e = e.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0"), - t._bonesComputationForcedToCPU = true; - for (var i = this._mesh.getScene(), n = 0; n < i.meshes.length; n++) { - var r = i.meshes[n]; - if (r.material && r.computeBonesUsingShaders && 0 !== r.numBoneInfluencers) - if (r.material.getEffect() === t) - r.computeBonesUsingShaders = false; - else if (r.subMeshes) - for (var o = 0, a = r.subMeshes; o < a.length; o++) - if (a[o].effect === t) { - r.computeBonesUsingShaders = false; - break - } - } - } else { - var s = this._defines[this._currentRank]; - if (s) - for (n = 0; n < s.length; n++) - e = e.replace("#define " + s[n], ""); - this._currentRank++ + (e.ForEach = function (t, i, n, r, o, a, s, c) { + if (t instanceof Array) + for (var u = i / 4, l = n / 4, h = 0; h < a; h += r) { + for (var f = 0; f < r; f++) c(t[u + f], h + f); + u += l; } - return e - } - , + else { + var d = + t instanceof ArrayBuffer + ? new DataView(t) + : new DataView( + t.buffer, + t.byteOffset, + t.byteLength + ), + p = e.GetTypeByteLength(o); + for (h = 0; h < a; h += r) { + var m = i; + for (f = 0; f < r; f++) + c(e._GetFloatValue(d, o, m, s), h + f), (m += p); + i += n; + } + } + }), + (e._GetFloatValue = function (t, i, n, r) { + switch (i) { + case e.BYTE: + var o = t.getInt8(n); + return r && (o = Math.max(o / 127, -1)), o; + case e.UNSIGNED_BYTE: + return (o = t.getUint8(n)), r && (o /= 255), o; + case e.SHORT: + return ( + (o = t.getInt16(n, true)), + r && (o = Math.max(o / 16383, -1)), + o + ); + case e.UNSIGNED_SHORT: + return ( + (o = t.getUint16(n, true)), r && (o /= 65535), o + ); + case e.FLOAT: + return t.getFloat32(n, true); + default: + throw new Error("Invalid component type " + i); + } + }), + (e.BYTE = 5120), + (e.UNSIGNED_BYTE = 5121), + (e.SHORT = 5122), + (e.UNSIGNED_SHORT = 5123), + (e.INT = 5124), + (e.UNSIGNED_INT = 5125), + (e.FLOAT = 5126), + (e.PositionKind = "position"), + (e.NormalKind = "normal"), + (e.TangentKind = "tangent"), + (e.UVKind = "uv"), + (e.UV2Kind = "uv2"), + (e.UV3Kind = "uv3"), + (e.UV4Kind = "uv4"), + (e.UV5Kind = "uv5"), + (e.UV6Kind = "uv6"), + (e.ColorKind = "color"), + (e.MatricesIndicesKind = "matricesIndices"), + (e.MatricesWeightsKind = "matricesWeights"), + (e.MatricesIndicesExtraKind = "matricesIndicesExtra"), + (e.MatricesWeightsExtraKind = "matricesWeightsExtra"), e - }() - , c = function() {} - , u = function() { - function e(t, i, r, o, a, s, c, u, l, h) { - var f, d, p = this; - if (void 0 === o && (o = null), - void 0 === s && (s = null), - void 0 === c && (c = null), - void 0 === u && (u = null), - void 0 === l && (l = null), - this.name = null, - this.defines = "", - this.onCompiled = null, - this.onError = null, - this.onBind = null, - this.uniqueId = 0, - this.onCompileObservable = new n.c, - this.onErrorObservable = new n.c, - this._onBindObservable = null, - this._bonesComputationForcedToCPU = false, - this._uniformBuffersNames = {}, - this._samplers = {}, - this._isReady = false, - this._compilationError = "", - this._uniforms = {}, - this._key = "", - this._fallbacks = null, - this._vertexSourceCode = "", - this._fragmentSourceCode = "", - this._vertexSourceCodeOverride = "", - this._fragmentSourceCodeOverride = "", - this._transformFeedbackVaryings = null, - this._pipelineContext = null, - this._valueCache = {}, - this.name = t, - i.attributes) { - var m = i; - if (this._engine = r, - this._attributesNames = m.attributes, - this._uniformsNames = m.uniformsNames.concat(m.samplers), - this._samplerList = m.samplers.slice(), - this.defines = m.defines, - this.onError = m.onError, - this.onCompiled = m.onCompiled, - this._fallbacks = m.fallbacks, - this._indexParameters = m.indexParameters, - this._transformFeedbackVaryings = m.transformFeedbackVaryings, - m.uniformBuffersNames) - for (var g = 0; g < m.uniformBuffersNames.length; g++) - this._uniformBuffersNames[m.uniformBuffersNames[g]] = g - } else - this._engine = a, - this.defines = null == s ? "" : s, - this._uniformsNames = r.concat(o), - this._samplerList = o ? o.slice() : [], - this._attributesNames = i, - this.onError = l, - this.onCompiled = u, - this._indexParameters = h, - this._fallbacks = c; - this.uniqueId = e._uniqueIdSeed++, - t.vertexElement ? (f = document.getElementById(t.vertexElement)) || (f = t.vertexElement) : f = t.vertex || t, - t.fragmentElement ? (d = document.getElementById(t.fragmentElement)) || (d = t.fragmentElement) : d = t.fragment || t, - this._loadVertexShader(f, function(e) { - p._processIncludes(e, function(e) { - p._processShaderConversion(e, false, function(e) { - p._loadFragmentShader(d, function(i) { - p._processIncludes(i, function(i) { - p._processShaderConversion(i, true, function(i) { - if (t) { - var n = t.vertexElement || t.vertex || t - , r = t.fragmentElement || t.fragment || t; - p._vertexSourceCode = "#define SHADER_NAME vertex:" + n + "\n" + e, - p._fragmentSourceCode = "#define SHADER_NAME fragment:" + r + "\n" + i - } else - p._vertexSourceCode = e, - p._fragmentSourceCode = i; - p._prepareEffect() - }) - }) - }) - }) - }) - }) - } - return Object.defineProperty(e.prototype, "onBindObservable", { - get: function() { - return this._onBindObservable || (this._onBindObservable = new n.c), - this._onBindObservable - }, - enumerable: true, - configurable: true + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "c", function () { + return s; + }), + i.d(t, "b", function () { + return c; + }), + i.d(t, "a", function () { + return u; + }); + var n = i(8), + r = i(3), + o = i(35), + a = i(6), + s = (function () { + function e() { + (this._defines = {}), + (this._currentRank = 32), + (this._maxRank = -1), + (this._mesh = null); + } + return ( + (e.prototype.unBindMesh = function () { + this._mesh = null; + }), + (e.prototype.addFallback = function (e, t) { + this._defines[e] || + (e < this._currentRank && (this._currentRank = e), + e > this._maxRank && (this._maxRank = e), + (this._defines[e] = new Array())), + this._defines[e].push(t); + }), + (e.prototype.addCPUSkinningFallback = function (e, t) { + (this._mesh = t), + e < this._currentRank && (this._currentRank = e), + e > this._maxRank && (this._maxRank = e); + }), + Object.defineProperty(e.prototype, "isMoreFallbacks", { + get: function () { + return this._currentRank <= this._maxRank; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.reduce = function (e, t) { + if ( + this._mesh && + this._mesh.computeBonesUsingShaders && + this._mesh.numBoneInfluencers > 0 && + this._mesh.material + ) { + (this._mesh.computeBonesUsingShaders = false), + (e = e.replace( + "#define NUM_BONE_INFLUENCERS " + + this._mesh.numBoneInfluencers, + "#define NUM_BONE_INFLUENCERS 0" + )), + (t._bonesComputationForcedToCPU = true); + for ( + var i = this._mesh.getScene(), n = 0; + n < i.meshes.length; + n++ + ) { + var r = i.meshes[n]; + if ( + r.material && + r.computeBonesUsingShaders && + 0 !== r.numBoneInfluencers + ) + if (r.material.getEffect() === t) + r.computeBonesUsingShaders = false; + else if (r.subMeshes) + for ( + var o = 0, a = r.subMeshes; + o < a.length; + o++ + ) + if (a[o].effect === t) { + r.computeBonesUsingShaders = false; + break; + } + } + } else { + var s = this._defines[this._currentRank]; + if (s) + for (n = 0; n < s.length; n++) + e = e.replace("#define " + s[n], ""); + this._currentRank++; + } + return e; + }), + e + ); + })(), + c = function () {}, + u = (function () { + function e(t, i, r, o, a, s, c, u, l, h) { + var f, + d, + p = this; + if ( + (void 0 === o && (o = null), + void 0 === s && (s = null), + void 0 === c && (c = null), + void 0 === u && (u = null), + void 0 === l && (l = null), + (this.name = null), + (this.defines = ""), + (this.onCompiled = null), + (this.onError = null), + (this.onBind = null), + (this.uniqueId = 0), + (this.onCompileObservable = new n.c()), + (this.onErrorObservable = new n.c()), + (this._onBindObservable = null), + (this._bonesComputationForcedToCPU = false), + (this._uniformBuffersNames = {}), + (this._samplers = {}), + (this._isReady = false), + (this._compilationError = ""), + (this._uniforms = {}), + (this._key = ""), + (this._fallbacks = null), + (this._vertexSourceCode = ""), + (this._fragmentSourceCode = ""), + (this._vertexSourceCodeOverride = ""), + (this._fragmentSourceCodeOverride = ""), + (this._transformFeedbackVaryings = null), + (this._pipelineContext = null), + (this._valueCache = {}), + (this.name = t), + i.attributes) + ) { + var m = i; + if ( + ((this._engine = r), + (this._attributesNames = m.attributes), + (this._uniformsNames = m.uniformsNames.concat( + m.samplers + )), + (this._samplerList = m.samplers.slice()), + (this.defines = m.defines), + (this.onError = m.onError), + (this.onCompiled = m.onCompiled), + (this._fallbacks = m.fallbacks), + (this._indexParameters = m.indexParameters), + (this._transformFeedbackVaryings = + m.transformFeedbackVaryings), + m.uniformBuffersNames) + ) + for (var g = 0; g < m.uniformBuffersNames.length; g++) + this._uniformBuffersNames[m.uniformBuffersNames[g]] = + g; + } else + (this._engine = a), + (this.defines = null == s ? "" : s), + (this._uniformsNames = r.concat(o)), + (this._samplerList = o ? o.slice() : []), + (this._attributesNames = i), + (this.onError = l), + (this.onCompiled = u), + (this._indexParameters = h), + (this._fallbacks = c); + (this.uniqueId = e._uniqueIdSeed++), + t.vertexElement + ? (f = document.getElementById(t.vertexElement)) || + (f = t.vertexElement) + : (f = t.vertex || t), + t.fragmentElement + ? (d = document.getElementById(t.fragmentElement)) || + (d = t.fragmentElement) + : (d = t.fragment || t), + this._loadVertexShader(f, function (e) { + p._processIncludes(e, function (e) { + p._processShaderConversion(e, false, function (e) { + p._loadFragmentShader(d, function (i) { + p._processIncludes(i, function (i) { + p._processShaderConversion( + i, + true, + function (i) { + if (t) { + var n = t.vertexElement || t.vertex || t, + r = + t.fragmentElement || t.fragment || t; + (p._vertexSourceCode = + "#define SHADER_NAME vertex:" + + n + + "\n" + + e), + (p._fragmentSourceCode = + "#define SHADER_NAME fragment:" + + r + + "\n" + + i); + } else + (p._vertexSourceCode = e), + (p._fragmentSourceCode = i); + p._prepareEffect(); + } + ); + }); + }); + }); + }); + }); + } + return ( + Object.defineProperty(e.prototype, "onBindObservable", { + get: function () { + return ( + this._onBindObservable || + (this._onBindObservable = new n.c()), + this._onBindObservable + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "key", { - get: function() { - return this._key - }, - enumerable: true, - configurable: true + get: function () { + return this._key; + }, + enumerable: true, + configurable: true, }), - e.prototype.isReady = function() { - return !!this._isReady || !!this._pipelineContext && this._pipelineContext.isReady - } - , - e.prototype.getEngine = function() { - return this._engine - } - , - e.prototype.getPipelineContext = function() { - return this._pipelineContext - } - , - e.prototype.getAttributesNames = function() { - return this._attributesNames - } - , - e.prototype.getAttributeLocation = function(e) { - return this._attributes[e] - } - , - e.prototype.getAttributeLocationByName = function(e) { - var t = this._attributesNames.indexOf(e); - return this._attributes[t] - } - , - e.prototype.getAttributesCount = function() { - return this._attributes.length - } - , - e.prototype.getUniformIndex = function(e) { - return this._uniformsNames.indexOf(e) - } - , - e.prototype.getUniform = function(e) { - return this._uniforms[e] - } - , - e.prototype.getSamplers = function() { - return this._samplerList - } - , - e.prototype.getCompilationError = function() { - return this._compilationError - } - , - e.prototype.executeWhenCompiled = function(e) { - var t = this; - this.isReady() ? e(this) : (this.onCompileObservable.add(function(t) { - e(t) - }), - this._pipelineContext && !this._pipelineContext.isAsync || setTimeout(function() { - t._checkIsReady() - }, 16)) - } - , - e.prototype._checkIsReady = function() { - var e = this; - this.isReady() || setTimeout(function() { - e._checkIsReady() - }, 16) - } - , - e.prototype._loadVertexShader = function(t, i) { - var n; - o.a.IsWindowObjectExist() && t instanceof HTMLElement ? i(o.a.GetDOMTextContent(t)) : "base64:" !== t.substr(0, 7) ? e.ShadersStore[t + "VertexShader"] ? i(e.ShadersStore[t + "VertexShader"]) : (n = "." === t[0] || "/" === t[0] || t.indexOf("http") > -1 ? t : e.ShadersRepository + t, - this._engine._loadFile(n + ".vertex.fx", i)) : i(window.atob(t.substr(7))) - } - , - e.prototype._loadFragmentShader = function(t, i) { - var n; - o.a.IsWindowObjectExist() && t instanceof HTMLElement ? i(o.a.GetDOMTextContent(t)) : "base64:" !== t.substr(0, 7) ? e.ShadersStore[t + "PixelShader"] ? i(e.ShadersStore[t + "PixelShader"]) : e.ShadersStore[t + "FragmentShader"] ? i(e.ShadersStore[t + "FragmentShader"]) : (n = "." === t[0] || "/" === t[0] || t.indexOf("http") > -1 ? t : e.ShadersRepository + t, - this._engine._loadFile(n + ".fragment.fx", i)) : i(window.atob(t.substr(7))) - } - , - e.prototype._dumpShadersSource = function(e, t, i) { - var n = (this._engine.webGLVersion > 1 ? "#version 300 es\n#define WEBGL2 \n" : "") + (i ? i + "\n" : ""); - t = n + t; - var r = 2 - , o = /\n/gm - , s = "\n1\t" + (e = n + e).replace(o, function() { - return "\n" + r++ + "\t" + (e.prototype.isReady = function () { + return ( + !!this._isReady || + (!!this._pipelineContext && + this._pipelineContext.isReady) + ); + }), + (e.prototype.getEngine = function () { + return this._engine; + }), + (e.prototype.getPipelineContext = function () { + return this._pipelineContext; + }), + (e.prototype.getAttributesNames = function () { + return this._attributesNames; + }), + (e.prototype.getAttributeLocation = function (e) { + return this._attributes[e]; + }), + (e.prototype.getAttributeLocationByName = function (e) { + var t = this._attributesNames.indexOf(e); + return this._attributes[t]; + }), + (e.prototype.getAttributesCount = function () { + return this._attributes.length; + }), + (e.prototype.getUniformIndex = function (e) { + return this._uniformsNames.indexOf(e); + }), + (e.prototype.getUniform = function (e) { + return this._uniforms[e]; + }), + (e.prototype.getSamplers = function () { + return this._samplerList; + }), + (e.prototype.getCompilationError = function () { + return this._compilationError; + }), + (e.prototype.executeWhenCompiled = function (e) { + var t = this; + this.isReady() + ? e(this) + : (this.onCompileObservable.add(function (t) { + e(t); + }), + (this._pipelineContext && + !this._pipelineContext.isAsync) || + setTimeout(function () { + t._checkIsReady(); + }, 16)); + }), + (e.prototype._checkIsReady = function () { + var e = this; + this.isReady() || + setTimeout(function () { + e._checkIsReady(); + }, 16); + }), + (e.prototype._loadVertexShader = function (t, i) { + var n; + o.a.IsWindowObjectExist() && t instanceof HTMLElement + ? i(o.a.GetDOMTextContent(t)) + : "base64:" !== t.substr(0, 7) + ? e.ShadersStore[t + "VertexShader"] + ? i(e.ShadersStore[t + "VertexShader"]) + : ((n = + "." === t[0] || + "/" === t[0] || + t.indexOf("http") > -1 + ? t + : e.ShadersRepository + t), + this._engine._loadFile(n + ".vertex.fx", i)) + : i(window.atob(t.substr(7))); + }), + (e.prototype._loadFragmentShader = function (t, i) { + var n; + o.a.IsWindowObjectExist() && t instanceof HTMLElement + ? i(o.a.GetDOMTextContent(t)) + : "base64:" !== t.substr(0, 7) + ? e.ShadersStore[t + "PixelShader"] + ? i(e.ShadersStore[t + "PixelShader"]) + : e.ShadersStore[t + "FragmentShader"] + ? i(e.ShadersStore[t + "FragmentShader"]) + : ((n = + "." === t[0] || + "/" === t[0] || + t.indexOf("http") > -1 + ? t + : e.ShadersRepository + t), + this._engine._loadFile(n + ".fragment.fx", i)) + : i(window.atob(t.substr(7))); + }), + (e.prototype._dumpShadersSource = function (e, t, i) { + var n = + (this._engine.webGLVersion > 1 + ? "#version 300 es\n#define WEBGL2 \n" + : "") + (i ? i + "\n" : ""); + t = n + t; + var r = 2, + o = /\n/gm, + s = + "\n1\t" + + (e = n + e).replace(o, function () { + return "\n" + r++ + "\t"; + }); + r = 2; + var c = + "\n1\t" + + t.replace(o, function () { + return "\n" + r++ + "\t"; }); - r = 2; - var c = "\n1\t" + t.replace(o, function() { - return "\n" + r++ + "\t" - }); - this.name.vertexElement ? (a.a.Error("Vertex shader: " + this.name.vertexElement + s), - a.a.Error("Fragment shader: " + this.name.fragmentElement + c)) : this.name.vertex ? (a.a.Error("Vertex shader: " + this.name.vertex + s), - a.a.Error("Fragment shader: " + this.name.fragment + c)) : (a.a.Error("Vertex shader: " + this.name + s), - a.a.Error("Fragment shader: " + this.name + c)) - } - , - e.prototype._processShaderConversion = function(e, t, i) { - var n = this._processPrecision(e); - if (1 != this._engine.webGLVersion) - if (-1 === n.indexOf("#version 3")) { - var r = -1 !== n.search(/#extension.+GL_EXT_draw_buffers.+require/) - , o = n.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g, ""); - o = (o = (o = (o = o.replace(/varying(?![\n\r])\s/g, t ? "in " : "out ")).replace(/attribute[ \t]/g, "in ")).replace(/[ \t]attribute/g, " in")).replace(/texture2D\s*\(/g, "texture("), - t && (o = (o = (o = (o = (o = (o = (o = o.replace(/texture2DLodEXT\s*\(/g, "textureLod(")).replace(/textureCubeLodEXT\s*\(/g, "textureLod(")).replace(/textureCube\s*\(/g, "texture(")).replace(/gl_FragDepthEXT/g, "gl_FragDepth")).replace(/gl_FragColor/g, "glFragColor")).replace(/gl_FragData/g, "glFragData")).replace(/void\s+?main\s*\(/g, (r ? "" : "out vec4 glFragColor;\n") + "void main(")), - -1 !== this.defines.indexOf("#define MULTIVIEW\n") && !t && (o = "#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n" + o), - i(o) - } else - i(n.replace("#version 300 es", "")); - else - i(n) - } - , - e.prototype._processIncludes = function(t, i) { - for (var n = this, r = /#include<(.+)>(\((.*)\))*(\[(.*)\])*/g, o = r.exec(t), a = new String(t); null != o; ) { - var s = o[1]; - if (-1 !== s.indexOf("__decl__") && (s = s.replace(/__decl__/, ""), - this._engine.supportsUniformBuffers && (s = (s = s.replace(/Vertex/, "Ubo")).replace(/Fragment/, "Ubo")), - s += "Declaration"), - !e.IncludesShadersStore[s]) { - var c = e.ShadersRepository + "ShadersInclude/" + s + ".fx"; - return void this._engine._loadFile(c, function(t) { - e.IncludesShadersStore[s] = t, - n._processIncludes(a, i) - }) - } - var u = e.IncludesShadersStore[s]; - if (o[2]) - for (var l = o[3].split(","), h = 0; h < l.length; h += 2) { - var f = new RegExp(l[h],"g") - , d = l[h + 1]; - u = u.replace(f, d) + this.name.vertexElement + ? (a.a.Error( + "Vertex shader: " + this.name.vertexElement + s + ), + a.a.Error( + "Fragment shader: " + this.name.fragmentElement + c + )) + : this.name.vertex + ? (a.a.Error("Vertex shader: " + this.name.vertex + s), + a.a.Error( + "Fragment shader: " + this.name.fragment + c + )) + : (a.a.Error("Vertex shader: " + this.name + s), + a.a.Error("Fragment shader: " + this.name + c)); + }), + (e.prototype._processShaderConversion = function (e, t, i) { + var n = this._processPrecision(e); + if (1 != this._engine.webGLVersion) + if (-1 === n.indexOf("#version 3")) { + var r = + -1 !== + n.search( + /#extension.+GL_EXT_draw_buffers.+require/ + ), + o = n.replace( + /#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g, + "" + ); + (o = (o = (o = (o = o.replace( + /varying(?![\n\r])\s/g, + t ? "in " : "out " + )).replace(/attribute[ \t]/g, "in ")).replace( + /[ \t]attribute/g, + " in" + )).replace(/texture2D\s*\(/g, "texture(")), + t && + (o = (o = (o = (o = (o = (o = (o = o.replace( + /texture2DLodEXT\s*\(/g, + "textureLod(" + )).replace( + /textureCubeLodEXT\s*\(/g, + "textureLod(" + )).replace( + /textureCube\s*\(/g, + "texture(" + )).replace( + /gl_FragDepthEXT/g, + "gl_FragDepth" + )).replace( + /gl_FragColor/g, + "glFragColor" + )).replace(/gl_FragData/g, "glFragData")).replace( + /void\s+?main\s*\(/g, + (r ? "" : "out vec4 glFragColor;\n") + + "void main(" + )), + -1 !== + this.defines.indexOf("#define MULTIVIEW\n") && + !t && + (o = + "#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n" + + o), + i(o); + } else i(n.replace("#version 300 es", "")); + else i(n); + }), + (e.prototype._processIncludes = function (t, i) { + for ( + var n = this, + r = /#include<(.+)>(\((.*)\))*(\[(.*)\])*/g, + o = r.exec(t), + a = new String(t); + null != o; + + ) { + var s = o[1]; + if ( + (-1 !== s.indexOf("__decl__") && + ((s = s.replace(/__decl__/, "")), + this._engine.supportsUniformBuffers && + (s = (s = s.replace(/Vertex/, "Ubo")).replace( + /Fragment/, + "Ubo" + )), + (s += "Declaration")), + !e.IncludesShadersStore[s]) + ) { + var c = + e.ShadersRepository + "ShadersInclude/" + s + ".fx"; + return void this._engine._loadFile(c, function (t) { + (e.IncludesShadersStore[s] = t), + n._processIncludes(a, i); + }); + } + var u = e.IncludesShadersStore[s]; + if (o[2]) + for ( + var l = o[3].split(","), h = 0; + h < l.length; + h += 2 + ) { + var f = new RegExp(l[h], "g"), + d = l[h + 1]; + u = u.replace(f, d); + } + if (o[4]) { + var p = o[5]; + if (-1 !== p.indexOf("..")) { + var m = p.split(".."), + g = parseInt(m[0]), + _ = parseInt(m[1]), + v = u.slice(0); + (u = ""), + isNaN(_) && (_ = this._indexParameters[m[1]]); + for (var y = g; y < _; y++) + this._engine.supportsUniformBuffers || + (v = v.replace( + /light\{X\}.(\w*)/g, + function (e, t) { + return t + "{X}"; + } + )), + (u += v.replace(/\{X\}/g, y.toString()) + "\n"); + } else + this._engine.supportsUniformBuffers || + (u = u.replace( + /light\{X\}.(\w*)/g, + function (e, t) { + return t + "{X}"; } - if (o[4]) { - var p = o[5]; - if (-1 !== p.indexOf("..")) { - var m = p.split("..") - , g = parseInt(m[0]) - , _ = parseInt(m[1]) - , v = u.slice(0); - u = "", - isNaN(_) && (_ = this._indexParameters[m[1]]); - for (var y = g; y < _; y++) - this._engine.supportsUniformBuffers || (v = v.replace(/light\{X\}.(\w*)/g, function(e, t) { - return t + "{X}" - })), - u += v.replace(/\{X\}/g, y.toString()) + "\n" - } else - this._engine.supportsUniformBuffers || (u = u.replace(/light\{X\}.(\w*)/g, function(e, t) { - return t + "{X}" - })), - u = u.replace(/\{X\}/g, p) - } - a = a.replace(o[0], u), - o = r.exec(t) + )), + (u = u.replace(/\{X\}/g, p)); } - i(a) - } - , - e.prototype._processPrecision = function(e) { - var t = this._engine._shouldUseHighPrecisionShader; - return -1 === e.indexOf("precision highp float") ? e = t ? "precision highp float;\n" + e : "precision mediump float;\n" + e : t || (e = e.replace("precision highp float", "precision mediump float")), + (a = a.replace(o[0], u)), (o = r.exec(t)); + } + i(a); + }), + (e.prototype._processPrecision = function (e) { + var t = this._engine._shouldUseHighPrecisionShader; + return ( + -1 === e.indexOf("precision highp float") + ? (e = t + ? "precision highp float;\n" + e + : "precision mediump float;\n" + e) + : t || + (e = e.replace( + "precision highp float", + "precision mediump float" + )), e - } - , - e.prototype._rebuildProgram = function(e, t, i, n) { - var o = this; - this._isReady = false, - this._vertexSourceCodeOverride = e, - this._fragmentSourceCodeOverride = t, - this.onError = function(e, t) { - n && n(t) - } - , - this.onCompiled = function() { - for (var e = o.getEngine().scenes, t = 0; t < e.length; t++) - e[t].markAllMaterialsAsDirty(r.a.MATERIAL_AllDirtyFlag); - o._pipelineContext._handlesSpectorRebuildCallback(i) - } - , - this._fallbacks = null, - this._prepareEffect() - } - , - e.prototype._prepareEffect = function() { - var e = this - , t = this._attributesNames - , i = this.defines - , n = this._fallbacks; - this._valueCache = {}; - var r = this._pipelineContext; - try { - var o = this._engine; - this._pipelineContext = o.createPipelineContext(); - var s = this._rebuildProgram.bind(this); - this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? o._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, true, s, null, this._transformFeedbackVaryings) : o._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, false, s, i, this._transformFeedbackVaryings), - o._executeWhenRenderingStateIsCompiled(this._pipelineContext, function() { - if (o.supportsUniformBuffers) - for (var i in e._uniformBuffersNames) - e.bindUniformBlock(i, e._uniformBuffersNames[i]); - var n; - for (o.getUniforms(e._pipelineContext, e._uniformsNames).forEach(function(t, i) { - e._uniforms[e._uniformsNames[i]] = t - }), - e._attributes = o.getAttributes(e._pipelineContext, t), - n = 0; n < e._samplerList.length; n++) - null == e.getUniform(e._samplerList[n]) && (e._samplerList.splice(n, 1), - n--); - e._samplerList.forEach(function(t, i) { - e._samplers[t] = i - }), + ); + }), + (e.prototype._rebuildProgram = function (e, t, i, n) { + var o = this; + (this._isReady = false), + (this._vertexSourceCodeOverride = e), + (this._fragmentSourceCodeOverride = t), + (this.onError = function (e, t) { + n && n(t); + }), + (this.onCompiled = function () { + for ( + var e = o.getEngine().scenes, t = 0; + t < e.length; + t++ + ) + e[t].markAllMaterialsAsDirty( + r.a.MATERIAL_AllDirtyFlag + ); + o._pipelineContext._handlesSpectorRebuildCallback(i); + }), + (this._fallbacks = null), + this._prepareEffect(); + }), + (e.prototype._prepareEffect = function () { + var e = this, + t = this._attributesNames, + i = this.defines, + n = this._fallbacks; + this._valueCache = {}; + var r = this._pipelineContext; + try { + var o = this._engine; + this._pipelineContext = o.createPipelineContext(); + var s = this._rebuildProgram.bind(this); + this._vertexSourceCodeOverride && + this._fragmentSourceCodeOverride + ? o._preparePipelineContext( + this._pipelineContext, + this._vertexSourceCodeOverride, + this._fragmentSourceCodeOverride, + true, + s, + null, + this._transformFeedbackVaryings + ) + : o._preparePipelineContext( + this._pipelineContext, + this._vertexSourceCode, + this._fragmentSourceCode, + false, + s, + i, + this._transformFeedbackVaryings + ), + o._executeWhenRenderingStateIsCompiled( + this._pipelineContext, + function () { + if (o.supportsUniformBuffers) + for (var i in e._uniformBuffersNames) + e.bindUniformBlock( + i, + e._uniformBuffersNames[i] + ); + var n; + for ( + o + .getUniforms( + e._pipelineContext, + e._uniformsNames + ) + .forEach(function (t, i) { + e._uniforms[e._uniformsNames[i]] = t; + }), + e._attributes = o.getAttributes( + e._pipelineContext, + t + ), + n = 0; + n < e._samplerList.length; + n++ + ) + null == e.getUniform(e._samplerList[n]) && + (e._samplerList.splice(n, 1), n--); + e._samplerList.forEach(function (t, i) { + e._samplers[t] = i; + }), o.bindSamplers(e), - e._compilationError = "", - e._isReady = true, + (e._compilationError = ""), + (e._isReady = true), e.onCompiled && e.onCompiled(e), e.onCompileObservable.notifyObservers(e), e.onCompileObservable.clear(), e._fallbacks && e._fallbacks.unBindMesh(), - r && e.getEngine()._deletePipelineContext(r) - }), - this._pipelineContext.isAsync && this._checkIsReady() - } catch (e) { - this._compilationError = e.message, - a.a.Error("Unable to compile effect:"), - a.a.Error("Uniforms: " + this._uniformsNames.map(function(e) { - return " " + e - })), - a.a.Error("Attributes: " + t.map(function(e) { - return " " + e - })), - a.a.Error("Error: " + this._compilationError), - r && (this._pipelineContext = r, - this._isReady = true, - this.onError && this.onError(this, this._compilationError), + r && e.getEngine()._deletePipelineContext(r); + } + ), + this._pipelineContext.isAsync && this._checkIsReady(); + } catch (e) { + (this._compilationError = e.message), + a.a.Error("Unable to compile effect:"), + a.a.Error( + "Uniforms: " + + this._uniformsNames.map(function (e) { + return " " + e; + }) + ), + a.a.Error( + "Attributes: " + + t.map(function (e) { + return " " + e; + }) + ), + a.a.Error("Error: " + this._compilationError), + r && + ((this._pipelineContext = r), + (this._isReady = true), + this.onError && + this.onError(this, this._compilationError), this.onErrorObservable.notifyObservers(this)), - n && n.isMoreFallbacks ? (a.a.Error("Trying next fallback."), - this.defines = n.reduce(this.defines, this), - this._prepareEffect()) : (this.onError && this.onError(this, this._compilationError), - this.onErrorObservable.notifyObservers(this), - this.onErrorObservable.clear(), - this._fallbacks && this._fallbacks.unBindMesh()) - } - } - , - Object.defineProperty(e.prototype, "isSupported", { - get: function() { - return "" === this._compilationError - }, - enumerable: true, - configurable: true + n && n.isMoreFallbacks + ? (a.a.Error("Trying next fallback."), + (this.defines = n.reduce(this.defines, this)), + this._prepareEffect()) + : (this.onError && + this.onError(this, this._compilationError), + this.onErrorObservable.notifyObservers(this), + this.onErrorObservable.clear(), + this._fallbacks && this._fallbacks.unBindMesh()); + } }), - e.prototype._bindTexture = function(e, t) { - this._engine._bindTexture(this._samplers[e], t) - } - , - e.prototype.setTexture = function(e, t) { - this._engine.setTexture(this._samplers[e], this._uniforms[e], t) - } - , - e.prototype.setDepthStencilTexture = function(e, t) { - this._engine.setDepthStencilTexture(this._samplers[e], this._uniforms[e], t) - } - , - e.prototype.setTextureArray = function(e, t) { - var i = e + "Ex"; - if (-1 === this._samplerList.indexOf(i)) - for (var n = this._samplers[e], r = 1; r < t.length; r++) - this._samplerList.splice(n + r, 0, i), - this._samplers[i] = n + r; - this._engine.setTextureArray(this._samplers[e], this._uniforms[e], t) - } - , - e.prototype.setTextureFromPostProcess = function(e, t) { - this._engine.setTextureFromPostProcess(this._samplers[e], t) - } - , - e.prototype.setTextureFromPostProcessOutput = function(e, t) { - this._engine.setTextureFromPostProcessOutput(this._samplers[e], t) - } - , - e.prototype._cacheMatrix = function(e, t) { - var i = this._valueCache[e] - , n = t.updateFlag; - return (void 0 === i || i !== n) && (this._valueCache[e] = n, - true) - } - , - e.prototype._cacheFloat2 = function(e, t, i) { - var n = this._valueCache[e]; - if (!n) - return n = [t, i], - this._valueCache[e] = n, - true; - var r = false; - return n[0] !== t && (n[0] = t, - r = true), - n[1] !== i && (n[1] = i, - r = true), + Object.defineProperty(e.prototype, "isSupported", { + get: function () { + return "" === this._compilationError; + }, + enumerable: true, + configurable: true, + }), + (e.prototype._bindTexture = function (e, t) { + this._engine._bindTexture(this._samplers[e], t); + }), + (e.prototype.setTexture = function (e, t) { + this._engine.setTexture( + this._samplers[e], + this._uniforms[e], + t + ); + }), + (e.prototype.setDepthStencilTexture = function (e, t) { + this._engine.setDepthStencilTexture( + this._samplers[e], + this._uniforms[e], + t + ); + }), + (e.prototype.setTextureArray = function (e, t) { + var i = e + "Ex"; + if (-1 === this._samplerList.indexOf(i)) + for ( + var n = this._samplers[e], r = 1; + r < t.length; + r++ + ) + this._samplerList.splice(n + r, 0, i), + (this._samplers[i] = n + r); + this._engine.setTextureArray( + this._samplers[e], + this._uniforms[e], + t + ); + }), + (e.prototype.setTextureFromPostProcess = function (e, t) { + this._engine.setTextureFromPostProcess( + this._samplers[e], + t + ); + }), + (e.prototype.setTextureFromPostProcessOutput = function ( + e, + t + ) { + this._engine.setTextureFromPostProcessOutput( + this._samplers[e], + t + ); + }), + (e.prototype._cacheMatrix = function (e, t) { + var i = this._valueCache[e], + n = t.updateFlag; + return ( + (void 0 === i || i !== n) && + ((this._valueCache[e] = n), true) + ); + }), + (e.prototype._cacheFloat2 = function (e, t, i) { + var n = this._valueCache[e]; + if (!n) + return (n = [t, i]), (this._valueCache[e] = n), true; + var r = false; + return ( + n[0] !== t && ((n[0] = t), (r = true)), + n[1] !== i && ((n[1] = i), (r = true)), r - } - , - e.prototype._cacheFloat3 = function(e, t, i, n) { - var r = this._valueCache[e]; - if (!r) - return r = [t, i, n], - this._valueCache[e] = r, - true; - var o = false; - return r[0] !== t && (r[0] = t, - o = true), - r[1] !== i && (r[1] = i, - o = true), - r[2] !== n && (r[2] = n, - o = true), + ); + }), + (e.prototype._cacheFloat3 = function (e, t, i, n) { + var r = this._valueCache[e]; + if (!r) + return (r = [t, i, n]), (this._valueCache[e] = r), true; + var o = false; + return ( + r[0] !== t && ((r[0] = t), (o = true)), + r[1] !== i && ((r[1] = i), (o = true)), + r[2] !== n && ((r[2] = n), (o = true)), o - } - , - e.prototype._cacheFloat4 = function(e, t, i, n, r) { - var o = this._valueCache[e]; - if (!o) - return o = [t, i, n, r], - this._valueCache[e] = o, - true; - var a = false; - return o[0] !== t && (o[0] = t, - a = true), - o[1] !== i && (o[1] = i, - a = true), - o[2] !== n && (o[2] = n, - a = true), - o[3] !== r && (o[3] = r, - a = true), + ); + }), + (e.prototype._cacheFloat4 = function (e, t, i, n, r) { + var o = this._valueCache[e]; + if (!o) + return ( + (o = [t, i, n, r]), (this._valueCache[e] = o), true + ); + var a = false; + return ( + o[0] !== t && ((o[0] = t), (a = true)), + o[1] !== i && ((o[1] = i), (a = true)), + o[2] !== n && ((o[2] = n), (a = true)), + o[3] !== r && ((o[3] = r), (a = true)), a - } - , - e.prototype.bindUniformBuffer = function(t, i) { - var n = this._uniformBuffersNames[i]; - void 0 !== n && e._baseCache[n] !== t && (e._baseCache[n] = t, - this._engine.bindUniformBufferBase(t, n)) - } - , - e.prototype.bindUniformBlock = function(e, t) { - this._engine.bindUniformBlock(this._pipelineContext, e, t) - } - , - e.prototype.setInt = function(e, t) { - var i = this._valueCache[e]; - return void 0 !== i && i === t ? this : (this._valueCache[e] = t, - this._engine.setInt(this._uniforms[e], t), - this) - } - , - e.prototype.setIntArray = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.bindUniformBuffer = function (t, i) { + var n = this._uniformBuffersNames[i]; + void 0 !== n && + e._baseCache[n] !== t && + ((e._baseCache[n] = t), + this._engine.bindUniformBufferBase(t, n)); + }), + (e.prototype.bindUniformBlock = function (e, t) { + this._engine.bindUniformBlock( + this._pipelineContext, + e, + t + ); + }), + (e.prototype.setInt = function (e, t) { + var i = this._valueCache[e]; + return void 0 !== i && i === t + ? this + : ((this._valueCache[e] = t), + this._engine.setInt(this._uniforms[e], t), + this); + }), + (e.prototype.setIntArray = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setIntArray(this._uniforms[e], t), this - } - , - e.prototype.setIntArray2 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setIntArray2 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setIntArray2(this._uniforms[e], t), this - } - , - e.prototype.setIntArray3 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setIntArray3 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setIntArray3(this._uniforms[e], t), this - } - , - e.prototype.setIntArray4 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setIntArray4 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setIntArray4(this._uniforms[e], t), this - } - , - e.prototype.setFloatArray = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setFloatArray = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setFloatArray(this._uniforms[e], t), this - } - , - e.prototype.setFloatArray2 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setFloatArray2 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setFloatArray2(this._uniforms[e], t), this - } - , - e.prototype.setFloatArray3 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setFloatArray3 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setFloatArray3(this._uniforms[e], t), this - } - , - e.prototype.setFloatArray4 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setFloatArray4 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setFloatArray4(this._uniforms[e], t), this - } - , - e.prototype.setArray = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setArray = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setArray(this._uniforms[e], t), this - } - , - e.prototype.setArray2 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setArray2 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setArray2(this._uniforms[e], t), this - } - , - e.prototype.setArray3 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setArray3 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setArray3(this._uniforms[e], t), this - } - , - e.prototype.setArray4 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setArray4 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setArray4(this._uniforms[e], t), this - } - , - e.prototype.setMatrices = function(e, t) { - return t ? (this._valueCache[e] = null, - this._engine.setMatrices(this._uniforms[e], t), - this) : this - } - , - e.prototype.setMatrix = function(e, t) { - return this._cacheMatrix(e, t) && this._engine.setMatrix(this._uniforms[e], t), + ); + }), + (e.prototype.setMatrices = function (e, t) { + return t + ? ((this._valueCache[e] = null), + this._engine.setMatrices(this._uniforms[e], t), + this) + : this; + }), + (e.prototype.setMatrix = function (e, t) { + return ( + this._cacheMatrix(e, t) && + this._engine.setMatrix(this._uniforms[e], t), this - } - , - e.prototype.setMatrix3x3 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setMatrix3x3 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setMatrix3x3(this._uniforms[e], t), this - } - , - e.prototype.setMatrix2x2 = function(e, t) { - return this._valueCache[e] = null, + ); + }), + (e.prototype.setMatrix2x2 = function (e, t) { + return ( + (this._valueCache[e] = null), this._engine.setMatrix2x2(this._uniforms[e], t), this - } - , - e.prototype.setFloat = function(e, t) { - var i = this._valueCache[e]; - return void 0 !== i && i === t ? this : (this._valueCache[e] = t, - this._engine.setFloat(this._uniforms[e], t), - this) - } - , - e.prototype.setBool = function(e, t) { - var i = this._valueCache[e]; - return void 0 !== i && i === t ? this : (this._valueCache[e] = t, - this._engine.setBool(this._uniforms[e], t ? 1 : 0), - this) - } - , - e.prototype.setVector2 = function(e, t) { - return this._cacheFloat2(e, t.x, t.y) && this._engine.setFloat2(this._uniforms[e], t.x, t.y), - this - } - , - e.prototype.setFloat2 = function(e, t, i) { - return this._cacheFloat2(e, t, i) && this._engine.setFloat2(this._uniforms[e], t, i), - this - } - , - e.prototype.setVector3 = function(e, t) { - return this._cacheFloat3(e, t.x, t.y, t.z) && this._engine.setFloat3(this._uniforms[e], t.x, t.y, t.z), - this - } - , - e.prototype.setFloat3 = function(e, t, i, n) { - return this._cacheFloat3(e, t, i, n) && this._engine.setFloat3(this._uniforms[e], t, i, n), - this - } - , - e.prototype.setVector4 = function(e, t) { - return this._cacheFloat4(e, t.x, t.y, t.z, t.w) && this._engine.setFloat4(this._uniforms[e], t.x, t.y, t.z, t.w), - this - } - , - e.prototype.setFloat4 = function(e, t, i, n, r) { - return this._cacheFloat4(e, t, i, n, r) && this._engine.setFloat4(this._uniforms[e], t, i, n, r), - this - } - , - e.prototype.setColor3 = function(e, t) { - return this._cacheFloat3(e, t.r, t.g, t.b) && this._engine.setColor3(this._uniforms[e], t), - this - } - , - e.prototype.setColor4 = function(e, t, i) { - return this._cacheFloat4(e, t.r, t.g, t.b, i) && this._engine.setColor4(this._uniforms[e], t, i), - this - } - , - e.prototype.setDirectColor4 = function(e, t) { - return this._cacheFloat4(e, t.r, t.g, t.b, t.a) && this._engine.setDirectColor4(this._uniforms[e], t), - this - } - , - e.prototype.dispose = function() { - this._engine._releaseEffect(this) - } - , - e.RegisterShader = function(t, i, n) { - i && (e.ShadersStore[t + "PixelShader"] = i), - n && (e.ShadersStore[t + "VertexShader"] = n) - } - , - e.ResetCache = function() { - e._baseCache = {} - } - , - e.ShadersRepository = "src/Shaders/", - e._uniqueIdSeed = 0, - e._baseCache = {}, - e.ShadersStore = {}, - e.IncludesShadersStore = {}, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return e._AddLogEntry = function(t) { - e._LogCache = t + e._LogCache, - e.OnNewCacheEntry && e.OnNewCacheEntry(t) - } - , - e._FormatMessage = function(e) { - var t = function(e) { - return e < 10 ? "0" + e : "" + e - } - , i = new Date; - return "[" + t(i.getHours()) + ":" + t(i.getMinutes()) + ":" + t(i.getSeconds()) + "]: " + e - } - , - e._LogDisabled = function(e) {} - , - e._LogEnabled = function(t) { - var i = e._FormatMessage(t); - console.log("BJS - " + i); - var n = "
" + i + "

"; - e._AddLogEntry(n) - } - , - e._WarnDisabled = function(e) {} - , - e._WarnEnabled = function(t) { - var i = e._FormatMessage(t); - console.warn("BJS - " + i); - var n = "
" + i + "

"; - e._AddLogEntry(n) - } - , - e._ErrorDisabled = function(e) {} - , - e._ErrorEnabled = function(t) { - e.errorsCount++; - var i = e._FormatMessage(t); - console.error("BJS - " + i); - var n = "
" + i + "

"; - e._AddLogEntry(n) - } - , - Object.defineProperty(e, "LogCache", { - get: function() { - return e._LogCache - }, - enumerable: true, - configurable: true + ); }), - e.ClearLogCache = function() { - e._LogCache = "", - e.errorsCount = 0 - } - , - Object.defineProperty(e, "LogLevels", { - set: function(t) { - (t & e.MessageLogLevel) === e.MessageLogLevel ? e.Log = e._LogEnabled : e.Log = e._LogDisabled, - (t & e.WarningLogLevel) === e.WarningLogLevel ? e.Warn = e._WarnEnabled : e.Warn = e._WarnDisabled, - (t & e.ErrorLogLevel) === e.ErrorLogLevel ? e.Error = e._ErrorEnabled : e.Error = e._ErrorDisabled - }, - enumerable: true, - configurable: true + (e.prototype.setFloat = function (e, t) { + var i = this._valueCache[e]; + return void 0 !== i && i === t + ? this + : ((this._valueCache[e] = t), + this._engine.setFloat(this._uniforms[e], t), + this); }), - e.NoneLogLevel = 0, - e.MessageLogLevel = 1, - e.WarningLogLevel = 2, - e.ErrorLogLevel = 4, - e.AllLogLevel = 7, - e._LogCache = "", - e.errorsCount = 0, - e.Log = e._LogEnabled, - e.Warn = e._WarnEnabled, - e.Error = e._ErrorEnabled, + (e.prototype.setBool = function (e, t) { + var i = this._valueCache[e]; + return void 0 !== i && i === t + ? this + : ((this._valueCache[e] = t), + this._engine.setBool(this._uniforms[e], t ? 1 : 0), + this); + }), + (e.prototype.setVector2 = function (e, t) { + return ( + this._cacheFloat2(e, t.x, t.y) && + this._engine.setFloat2(this._uniforms[e], t.x, t.y), + this + ); + }), + (e.prototype.setFloat2 = function (e, t, i) { + return ( + this._cacheFloat2(e, t, i) && + this._engine.setFloat2(this._uniforms[e], t, i), + this + ); + }), + (e.prototype.setVector3 = function (e, t) { + return ( + this._cacheFloat3(e, t.x, t.y, t.z) && + this._engine.setFloat3( + this._uniforms[e], + t.x, + t.y, + t.z + ), + this + ); + }), + (e.prototype.setFloat3 = function (e, t, i, n) { + return ( + this._cacheFloat3(e, t, i, n) && + this._engine.setFloat3(this._uniforms[e], t, i, n), + this + ); + }), + (e.prototype.setVector4 = function (e, t) { + return ( + this._cacheFloat4(e, t.x, t.y, t.z, t.w) && + this._engine.setFloat4( + this._uniforms[e], + t.x, + t.y, + t.z, + t.w + ), + this + ); + }), + (e.prototype.setFloat4 = function (e, t, i, n, r) { + return ( + this._cacheFloat4(e, t, i, n, r) && + this._engine.setFloat4(this._uniforms[e], t, i, n, r), + this + ); + }), + (e.prototype.setColor3 = function (e, t) { + return ( + this._cacheFloat3(e, t.r, t.g, t.b) && + this._engine.setColor3(this._uniforms[e], t), + this + ); + }), + (e.prototype.setColor4 = function (e, t, i) { + return ( + this._cacheFloat4(e, t.r, t.g, t.b, i) && + this._engine.setColor4(this._uniforms[e], t, i), + this + ); + }), + (e.prototype.setDirectColor4 = function (e, t) { + return ( + this._cacheFloat4(e, t.r, t.g, t.b, t.a) && + this._engine.setDirectColor4(this._uniforms[e], t), + this + ); + }), + (e.prototype.dispose = function () { + this._engine._releaseEffect(this); + }), + (e.RegisterShader = function (t, i, n) { + i && (e.ShadersStore[t + "PixelShader"] = i), + n && (e.ShadersStore[t + "VertexShader"] = n); + }), + (e.ResetCache = function () { + e._baseCache = {}; + }), + (e.ShadersRepository = "src/Shaders/"), + (e._uniqueIdSeed = 0), + (e._baseCache = {}), + (e.ShadersStore = {}), + (e.IncludesShadersStore = {}), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return f - }); - var n = i(1) - , r = i(2) - , o = i(8) - , a = i(9) - , s = i(0) - , c = i(44) - , u = i(3) - , l = i(22) - , h = i(19) - , f = function(e) { - function t(i, n, r, s, c, l, h, f, d, p) { - void 0 === r && (r = false), - void 0 === s && (s = true), - void 0 === c && (c = t.TRILINEAR_SAMPLINGMODE), - void 0 === l && (l = null), - void 0 === h && (h = null), - void 0 === f && (f = null), - void 0 === d && (d = false); - var m = e.call(this, n) || this; - if (m.url = null, - m.uOffset = 0, - m.vOffset = 0, - m.uScale = 1, - m.vScale = 1, - m.uAng = 0, - m.vAng = 0, - m.wAng = 0, - m.uRotationCenter = .5, - m.vRotationCenter = .5, - m.wRotationCenter = .5, - m.inspectableCustomProperties = null, - m._noMipmap = false, - m._invertY = false, - m._rowGenerationMatrix = null, - m._cachedTextureMatrix = null, - m._projectionModeMatrix = null, - m._t0 = null, - m._t1 = null, - m._t2 = null, - m._cachedUOffset = -1, - m._cachedVOffset = -1, - m._cachedUScale = 0, - m._cachedVScale = 0, - m._cachedUAng = -1, - m._cachedVAng = -1, - m._cachedWAng = -1, - m._cachedProjectionMatrixId = -1, - m._cachedCoordinatesMode = -1, - m._initialSamplingMode = t.BILINEAR_SAMPLINGMODE, - m._buffer = null, - m._deleteBuffer = false, - m._format = null, - m._delayedOnLoad = null, - m._delayedOnError = null, - m.onLoadObservable = new o.c, - m._isBlocking = true, - m.name = i || "", - m.url = i, - m._noMipmap = r, - m._invertY = s, - m._initialSamplingMode = c, - m._buffer = f, - m._deleteBuffer = d, - p && (m._format = p), - !(n = m.getScene())) - return m; - n.getEngine().onBeforeTextureInitObservable.notifyObservers(m); - var g = function() { - m._texture && m._texture._invertVScale && (m.vScale = -1), - m.onLoadObservable.hasObservers() && m.onLoadObservable.notifyObservers(m), - l && l(), - !m.isBlocking && n && n.resetCachedMaterial() - }; - return m.url ? (m._texture = m._getFromCache(m.url, r, c, s), - m._texture ? m._texture.isReady ? a.h.SetImmediate(function() { - return g() - }) : m._texture.onLoadedObservable.add(g) : n.useDelayedTextureLoading ? (m.delayLoadState = u.a.DELAYLOADSTATE_NOTLOADED, - m._delayedOnLoad = g, - m._delayedOnError = h) : (m._texture = n.getEngine().createTexture(m.url, r, s, n, c, g, h, m._buffer, void 0, m._format), - d && delete m._buffer), - m) : (m._delayedOnLoad = g, - m._delayedOnError = h, + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + (e._AddLogEntry = function (t) { + (e._LogCache = t + e._LogCache), + e.OnNewCacheEntry && e.OnNewCacheEntry(t); + }), + (e._FormatMessage = function (e) { + var t = function (e) { + return e < 10 ? "0" + e : "" + e; + }, + i = new Date(); + return ( + "[" + + t(i.getHours()) + + ":" + + t(i.getMinutes()) + + ":" + + t(i.getSeconds()) + + "]: " + + e + ); + }), + (e._LogDisabled = function (e) {}), + (e._LogEnabled = function (t) { + var i = e._FormatMessage(t); + console.log("BJS - " + i); + var n = "
" + i + "

"; + e._AddLogEntry(n); + }), + (e._WarnDisabled = function (e) {}), + (e._WarnEnabled = function (t) { + var i = e._FormatMessage(t); + console.warn("BJS - " + i); + var n = "
" + i + "

"; + e._AddLogEntry(n); + }), + (e._ErrorDisabled = function (e) {}), + (e._ErrorEnabled = function (t) { + e.errorsCount++; + var i = e._FormatMessage(t); + console.error("BJS - " + i); + var n = "
" + i + "

"; + e._AddLogEntry(n); + }), + Object.defineProperty(e, "LogCache", { + get: function () { + return e._LogCache; + }, + enumerable: true, + configurable: true, + }), + (e.ClearLogCache = function () { + (e._LogCache = ""), (e.errorsCount = 0); + }), + Object.defineProperty(e, "LogLevels", { + set: function (t) { + (t & e.MessageLogLevel) === e.MessageLogLevel + ? (e.Log = e._LogEnabled) + : (e.Log = e._LogDisabled), + (t & e.WarningLogLevel) === e.WarningLogLevel + ? (e.Warn = e._WarnEnabled) + : (e.Warn = e._WarnDisabled), + (t & e.ErrorLogLevel) === e.ErrorLogLevel + ? (e.Error = e._ErrorEnabled) + : (e.Error = e._ErrorDisabled); + }, + enumerable: true, + configurable: true, + }), + (e.NoneLogLevel = 0), + (e.MessageLogLevel = 1), + (e.WarningLogLevel = 2), + (e.ErrorLogLevel = 4), + (e.AllLogLevel = 7), + (e._LogCache = ""), + (e.errorsCount = 0), + (e.Log = e._LogEnabled), + (e.Warn = e._WarnEnabled), + (e.Error = e._ErrorEnabled), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return f; + }); + var n = i(1), + r = i(2), + o = i(8), + a = i(9), + s = i(0), + c = i(44), + u = i(3), + l = i(22), + h = i(19), + f = (function (e) { + function t(i, n, r, s, c, l, h, f, d, p) { + void 0 === r && (r = false), + void 0 === s && (s = true), + void 0 === c && (c = t.TRILINEAR_SAMPLINGMODE), + void 0 === l && (l = null), + void 0 === h && (h = null), + void 0 === f && (f = null), + void 0 === d && (d = false); + var m = e.call(this, n) || this; + if ( + ((m.url = null), + (m.uOffset = 0), + (m.vOffset = 0), + (m.uScale = 1), + (m.vScale = 1), + (m.uAng = 0), + (m.vAng = 0), + (m.wAng = 0), + (m.uRotationCenter = 0.5), + (m.vRotationCenter = 0.5), + (m.wRotationCenter = 0.5), + (m.inspectableCustomProperties = null), + (m._noMipmap = false), + (m._invertY = false), + (m._rowGenerationMatrix = null), + (m._cachedTextureMatrix = null), + (m._projectionModeMatrix = null), + (m._t0 = null), + (m._t1 = null), + (m._t2 = null), + (m._cachedUOffset = -1), + (m._cachedVOffset = -1), + (m._cachedUScale = 0), + (m._cachedVScale = 0), + (m._cachedUAng = -1), + (m._cachedVAng = -1), + (m._cachedWAng = -1), + (m._cachedProjectionMatrixId = -1), + (m._cachedCoordinatesMode = -1), + (m._initialSamplingMode = t.BILINEAR_SAMPLINGMODE), + (m._buffer = null), + (m._deleteBuffer = false), + (m._format = null), + (m._delayedOnLoad = null), + (m._delayedOnError = null), + (m.onLoadObservable = new o.c()), + (m._isBlocking = true), + (m.name = i || ""), + (m.url = i), + (m._noMipmap = r), + (m._invertY = s), + (m._initialSamplingMode = c), + (m._buffer = f), + (m._deleteBuffer = d), + p && (m._format = p), + !(n = m.getScene())) + ) + return m; + n.getEngine().onBeforeTextureInitObservable.notifyObservers( + m + ); + var g = function () { + m._texture && m._texture._invertVScale && (m.vScale = -1), + m.onLoadObservable.hasObservers() && + m.onLoadObservable.notifyObservers(m), + l && l(), + !m.isBlocking && n && n.resetCachedMaterial(); + }; + return m.url + ? ((m._texture = m._getFromCache(m.url, r, c, s)), + m._texture + ? m._texture.isReady + ? a.h.SetImmediate(function () { + return g(); + }) + : m._texture.onLoadedObservable.add(g) + : n.useDelayedTextureLoading + ? ((m.delayLoadState = u.a.DELAYLOADSTATE_NOTLOADED), + (m._delayedOnLoad = g), + (m._delayedOnError = h)) + : ((m._texture = n + .getEngine() + .createTexture( + m.url, + r, + s, + n, + c, + g, + h, + m._buffer, + void 0, + m._format + )), + d && delete m._buffer), m) - } - return n.d(t, e), + : ((m._delayedOnLoad = g), (m._delayedOnError = h), m); + } + return ( + n.d(t, e), Object.defineProperty(t.prototype, "noMipmap", { - get: function() { - return this._noMipmap - }, - enumerable: true, - configurable: true + get: function () { + return this._noMipmap; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "isBlocking", { - get: function() { - return this._isBlocking - }, - set: function(e) { - this._isBlocking = e - }, - enumerable: true, - configurable: true + get: function () { + return this._isBlocking; + }, + set: function (e) { + this._isBlocking = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "samplingMode", { - get: function() { - return this._texture ? this._texture.samplingMode : this._initialSamplingMode - }, - enumerable: true, - configurable: true + get: function () { + return this._texture + ? this._texture.samplingMode + : this._initialSamplingMode; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "invertY", { - get: function() { - return this._invertY - }, - enumerable: true, - configurable: true + get: function () { + return this._invertY; + }, + enumerable: true, + configurable: true, }), - t.prototype.updateURL = function(e, t, i) { - void 0 === t && (t = null), - this.url && (this.releaseInternalTexture(), - this.getScene().markAllMaterialsAsDirty(u.a.MATERIAL_TextureDirtyFlag)), - this.url = e, - this._buffer = t, - this.delayLoadState = u.a.DELAYLOADSTATE_NOTLOADED, + (t.prototype.updateURL = function (e, t, i) { + void 0 === t && (t = null), + this.url && + (this.releaseInternalTexture(), + this.getScene().markAllMaterialsAsDirty( + u.a.MATERIAL_TextureDirtyFlag + )), + (this.url = e), + (this._buffer = t), + (this.delayLoadState = u.a.DELAYLOADSTATE_NOTLOADED), i && (this._delayedOnLoad = i), - this.delayLoad() - } - , - t.prototype.delayLoad = function() { - if (this.delayLoadState === u.a.DELAYLOADSTATE_NOTLOADED) { - var e = this.getScene(); - e && (this.delayLoadState = u.a.DELAYLOADSTATE_LOADED, - this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY), - this._texture ? this._delayedOnLoad && (this._texture.isReady ? a.h.SetImmediate(this._delayedOnLoad) : this._texture.onLoadedObservable.add(this._delayedOnLoad)) : (this._texture = e.getEngine().createTexture(this.url, this._noMipmap, this._invertY, e, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format), - this._deleteBuffer && delete this._buffer), - this._delayedOnLoad = null, - this._delayedOnError = null) - } - } - , - t.prototype._prepareRowForTextureGeneration = function(e, t, i, n) { - e *= this.uScale, - t *= this.vScale, - e -= this.uRotationCenter * this.uScale, - t -= this.vRotationCenter * this.vScale, - i -= this.wRotationCenter, - s.x.TransformCoordinatesFromFloatsToRef(e, t, i, this._rowGenerationMatrix, n), - n.x += this.uRotationCenter * this.uScale + this.uOffset, - n.y += this.vRotationCenter * this.vScale + this.vOffset, - n.z += this.wRotationCenter - } - , - t.prototype.getTextureMatrix = function() { - var e = this; - if (this.uOffset === this._cachedUOffset && this.vOffset === this._cachedVOffset && this.uScale === this._cachedUScale && this.vScale === this._cachedVScale && this.uAng === this._cachedUAng && this.vAng === this._cachedVAng && this.wAng === this._cachedWAng) - return this._cachedTextureMatrix; - this._cachedUOffset = this.uOffset, - this._cachedVOffset = this.vOffset, - this._cachedUScale = this.uScale, - this._cachedVScale = this.vScale, - this._cachedUAng = this.uAng, - this._cachedVAng = this.vAng, - this._cachedWAng = this.wAng, - this._cachedTextureMatrix || (this._cachedTextureMatrix = s.j.Zero(), - this._rowGenerationMatrix = new s.j, - this._t0 = s.x.Zero(), - this._t1 = s.x.Zero(), - this._t2 = s.x.Zero()), - s.j.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix), + this.delayLoad(); + }), + (t.prototype.delayLoad = function () { + if ( + this.delayLoadState === u.a.DELAYLOADSTATE_NOTLOADED + ) { + var e = this.getScene(); + e && + ((this.delayLoadState = u.a.DELAYLOADSTATE_LOADED), + (this._texture = this._getFromCache( + this.url, + this._noMipmap, + this.samplingMode, + this._invertY + )), + this._texture + ? this._delayedOnLoad && + (this._texture.isReady + ? a.h.SetImmediate(this._delayedOnLoad) + : this._texture.onLoadedObservable.add( + this._delayedOnLoad + )) + : ((this._texture = e + .getEngine() + .createTexture( + this.url, + this._noMipmap, + this._invertY, + e, + this.samplingMode, + this._delayedOnLoad, + this._delayedOnError, + this._buffer, + null, + this._format + )), + this._deleteBuffer && delete this._buffer), + (this._delayedOnLoad = null), + (this._delayedOnError = null)); + } + }), + (t.prototype._prepareRowForTextureGeneration = function ( + e, + t, + i, + n + ) { + (e *= this.uScale), + (t *= this.vScale), + (e -= this.uRotationCenter * this.uScale), + (t -= this.vRotationCenter * this.vScale), + (i -= this.wRotationCenter), + s.x.TransformCoordinatesFromFloatsToRef( + e, + t, + i, + this._rowGenerationMatrix, + n + ), + (n.x += + this.uRotationCenter * this.uScale + this.uOffset), + (n.y += + this.vRotationCenter * this.vScale + this.vOffset), + (n.z += this.wRotationCenter); + }), + (t.prototype.getTextureMatrix = function () { + var e = this; + if ( + this.uOffset === this._cachedUOffset && + this.vOffset === this._cachedVOffset && + this.uScale === this._cachedUScale && + this.vScale === this._cachedVScale && + this.uAng === this._cachedUAng && + this.vAng === this._cachedVAng && + this.wAng === this._cachedWAng + ) + return this._cachedTextureMatrix; + (this._cachedUOffset = this.uOffset), + (this._cachedVOffset = this.vOffset), + (this._cachedUScale = this.uScale), + (this._cachedVScale = this.vScale), + (this._cachedUAng = this.uAng), + (this._cachedVAng = this.vAng), + (this._cachedWAng = this.wAng), + this._cachedTextureMatrix || + ((this._cachedTextureMatrix = s.j.Zero()), + (this._rowGenerationMatrix = new s.j()), + (this._t0 = s.x.Zero()), + (this._t1 = s.x.Zero()), + (this._t2 = s.x.Zero())), + s.j.RotationYawPitchRollToRef( + this.vAng, + this.uAng, + this.wAng, + this._rowGenerationMatrix + ), this._prepareRowForTextureGeneration(0, 0, 0, this._t0), this._prepareRowForTextureGeneration(1, 0, 0, this._t1), this._prepareRowForTextureGeneration(0, 1, 0, this._t2), this._t1.subtractInPlace(this._t0), this._t2.subtractInPlace(this._t0), - s.j.FromValuesToRef(this._t1.x, this._t1.y, this._t1.z, 0, this._t2.x, this._t2.y, this._t2.z, 0, this._t0.x, this._t0.y, this._t0.z, 0, 0, 0, 0, 1, this._cachedTextureMatrix); - var t = this.getScene(); - return t ? (t.markAllMaterialsAsDirty(u.a.MATERIAL_TextureDirtyFlag, function(t) { - return t.hasTexture(e) - }), - this._cachedTextureMatrix) : this._cachedTextureMatrix - } - , - t.prototype.getReflectionTextureMatrix = function() { - var e = this - , i = this.getScene(); - if (!i) - return this._cachedTextureMatrix; - if (this.uOffset === this._cachedUOffset && this.vOffset === this._cachedVOffset && this.uScale === this._cachedUScale && this.vScale === this._cachedVScale && this.coordinatesMode === this._cachedCoordinatesMode) { - if (this.coordinatesMode !== t.PROJECTION_MODE) - return this._cachedTextureMatrix; - if (this._cachedProjectionMatrixId === i.getProjectionMatrix().updateFlag) - return this._cachedTextureMatrix - } - switch (this._cachedTextureMatrix || (this._cachedTextureMatrix = s.j.Zero()), - this._projectionModeMatrix || (this._projectionModeMatrix = s.j.Zero()), - this._cachedUOffset = this.uOffset, - this._cachedVOffset = this.vOffset, - this._cachedUScale = this.uScale, - this._cachedVScale = this.vScale, - this._cachedCoordinatesMode = this.coordinatesMode, - this.coordinatesMode) { + s.j.FromValuesToRef( + this._t1.x, + this._t1.y, + this._t1.z, + 0, + this._t2.x, + this._t2.y, + this._t2.z, + 0, + this._t0.x, + this._t0.y, + this._t0.z, + 0, + 0, + 0, + 0, + 1, + this._cachedTextureMatrix + ); + var t = this.getScene(); + return t + ? (t.markAllMaterialsAsDirty( + u.a.MATERIAL_TextureDirtyFlag, + function (t) { + return t.hasTexture(e); + } + ), + this._cachedTextureMatrix) + : this._cachedTextureMatrix; + }), + (t.prototype.getReflectionTextureMatrix = function () { + var e = this, + i = this.getScene(); + if (!i) return this._cachedTextureMatrix; + if ( + this.uOffset === this._cachedUOffset && + this.vOffset === this._cachedVOffset && + this.uScale === this._cachedUScale && + this.vScale === this._cachedVScale && + this.coordinatesMode === this._cachedCoordinatesMode + ) { + if (this.coordinatesMode !== t.PROJECTION_MODE) + return this._cachedTextureMatrix; + if ( + this._cachedProjectionMatrixId === + i.getProjectionMatrix().updateFlag + ) + return this._cachedTextureMatrix; + } + switch ( + (this._cachedTextureMatrix || + (this._cachedTextureMatrix = s.j.Zero()), + this._projectionModeMatrix || + (this._projectionModeMatrix = s.j.Zero()), + (this._cachedUOffset = this.uOffset), + (this._cachedVOffset = this.vOffset), + (this._cachedUScale = this.uScale), + (this._cachedVScale = this.vScale), + (this._cachedCoordinatesMode = this.coordinatesMode), + this.coordinatesMode) + ) { case t.PLANAR_MODE: - s.j.IdentityToRef(this._cachedTextureMatrix), - this._cachedTextureMatrix[0] = this.uScale, - this._cachedTextureMatrix[5] = this.vScale, - this._cachedTextureMatrix[12] = this.uOffset, - this._cachedTextureMatrix[13] = this.vOffset; - break; + s.j.IdentityToRef(this._cachedTextureMatrix), + (this._cachedTextureMatrix[0] = this.uScale), + (this._cachedTextureMatrix[5] = this.vScale), + (this._cachedTextureMatrix[12] = this.uOffset), + (this._cachedTextureMatrix[13] = this.vOffset); + break; case t.PROJECTION_MODE: - s.j.FromValuesToRef(.5, 0, 0, 0, 0, -.5, 0, 0, 0, 0, 0, 0, .5, .5, 1, 1, this._projectionModeMatrix); - var n = i.getProjectionMatrix(); - this._cachedProjectionMatrixId = n.updateFlag, - n.multiplyToRef(this._projectionModeMatrix, this._cachedTextureMatrix); - break; + s.j.FromValuesToRef( + 0.5, + 0, + 0, + 0, + 0, + -0.5, + 0, + 0, + 0, + 0, + 0, + 0, + 0.5, + 0.5, + 1, + 1, + this._projectionModeMatrix + ); + var n = i.getProjectionMatrix(); + (this._cachedProjectionMatrixId = n.updateFlag), + n.multiplyToRef( + this._projectionModeMatrix, + this._cachedTextureMatrix + ); + break; default: - s.j.IdentityToRef(this._cachedTextureMatrix) - } - return i.markAllMaterialsAsDirty(u.a.MATERIAL_TextureDirtyFlag, function(t) { - return -1 !== t.getActiveTextures().indexOf(e) - }), + s.j.IdentityToRef(this._cachedTextureMatrix); + } + return ( + i.markAllMaterialsAsDirty( + u.a.MATERIAL_TextureDirtyFlag, + function (t) { + return -1 !== t.getActiveTextures().indexOf(e); + } + ), this._cachedTextureMatrix - } - , - t.prototype.clone = function() { - var e = this; - return r.a.Clone(function() { - return new t(e._texture ? e._texture.url : null,e.getScene(),e._noMipmap,e._invertY,e.samplingMode,void 0,void 0,e._texture ? e._texture._buffer : void 0) - }, this) - } - , - t.prototype.serialize = function() { - var t = e.prototype.serialize.call(this); - return "string" == typeof this._buffer && "data:" === this._buffer.substr(0, 5) && (t.base64String = this._buffer, - t.name = t.name.replace("data:", "")), - t.invertY = this._invertY, - t.samplingMode = this.samplingMode, + ); + }), + (t.prototype.clone = function () { + var e = this; + return r.a.Clone(function () { + return new t( + e._texture ? e._texture.url : null, + e.getScene(), + e._noMipmap, + e._invertY, + e.samplingMode, + void 0, + void 0, + e._texture ? e._texture._buffer : void 0 + ); + }, this); + }), + (t.prototype.serialize = function () { + var t = e.prototype.serialize.call(this); + return ( + "string" == typeof this._buffer && + "data:" === this._buffer.substr(0, 5) && + ((t.base64String = this._buffer), + (t.name = t.name.replace("data:", ""))), + (t.invertY = this._invertY), + (t.samplingMode = this.samplingMode), t - } - , - t.prototype.getClassName = function() { - return "Texture" - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), + ); + }), + (t.prototype.getClassName = function () { + return "Texture"; + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), this.onLoadObservable.clear(), - this._delayedOnLoad = null, - this._delayedOnError = null - } - , - t.Parse = function(e, i, n) { - if (e.customType) { - var o = a.h.Instantiate(e.customType).Parse(e, i, n); - return e.samplingMode && o.updateSamplingMode && o._samplingMode && o._samplingMode !== e.samplingMode && o.updateSamplingMode(e.samplingMode), - o + (this._delayedOnLoad = null), + (this._delayedOnError = null); + }), + (t.Parse = function (e, i, n) { + if (e.customType) { + var o = a.h.Instantiate(e.customType).Parse(e, i, n); + return ( + e.samplingMode && + o.updateSamplingMode && + o._samplingMode && + o._samplingMode !== e.samplingMode && + o.updateSamplingMode(e.samplingMode), + o + ); + } + if (e.isCube && !e.isRenderTarget) + return t._CubeTextureParser(e, i, n); + if (!e.name && !e.isRenderTarget) return null; + var c = r.a.Parse( + function () { + var r, + o = true; + if ((e.noMipmap && (o = false), e.mirrorPlane)) { + var a = t._CreateMirror( + e.name, + e.renderTargetSize, + i, + o + ); + return ( + (a._waitingRenderList = e.renderList), + (a.mirrorPlane = s.n.FromArray(e.mirrorPlane)), + a + ); + } + if (e.isRenderTarget) { + var c = null; + if (e.isCube) { + if (i.reflectionProbes) + for ( + var u = 0; + u < i.reflectionProbes.length; + u++ + ) { + var l = i.reflectionProbes[u]; + if (l.name === e.name) return l.cubeTexture; + } + } else + (c = t._CreateRenderTargetTexture( + e.name, + e.renderTargetSize, + i, + o + ))._waitingRenderList = e.renderList; + return c; + } + if (e.base64String) + r = t.CreateFromBase64String( + e.base64String, + e.name, + i, + !o + ); + else { + var h = n + e.name; + t.UseSerializedUrlIfAny && e.url && (h = e.url), + (r = new t(h, i, !o, e.invertY)); + } + return r; + }, + e, + i + ); + if (e.samplingMode) { + var u = e.samplingMode; + c && c.samplingMode !== u && c.updateSamplingMode(u); + } + if (c && e.animations) + for (var h = 0; h < e.animations.length; h++) { + var f = e.animations[h], + d = l.a.GetClass("BABYLON.Animation"); + d && c.animations.push(d.Parse(f)); } - if (e.isCube && !e.isRenderTarget) - return t._CubeTextureParser(e, i, n); - if (!e.name && !e.isRenderTarget) - return null; - var c = r.a.Parse(function() { - var r, o = true; - if (e.noMipmap && (o = false), - e.mirrorPlane) { - var a = t._CreateMirror(e.name, e.renderTargetSize, i, o); - return a._waitingRenderList = e.renderList, - a.mirrorPlane = s.n.FromArray(e.mirrorPlane), - a - } - if (e.isRenderTarget) { - var c = null; - if (e.isCube) { - if (i.reflectionProbes) - for (var u = 0; u < i.reflectionProbes.length; u++) { - var l = i.reflectionProbes[u]; - if (l.name === e.name) - return l.cubeTexture - } - } else - (c = t._CreateRenderTargetTexture(e.name, e.renderTargetSize, i, o))._waitingRenderList = e.renderList; - return c - } - if (e.base64String) - r = t.CreateFromBase64String(e.base64String, e.name, i, !o); - else { - var h = n + e.name; - t.UseSerializedUrlIfAny && e.url && (h = e.url), - r = new t(h,i,!o,e.invertY) - } - return r - }, e, i); - if (e.samplingMode) { - var u = e.samplingMode; - c && c.samplingMode !== u && c.updateSamplingMode(u) - } - if (c && e.animations) - for (var h = 0; h < e.animations.length; h++) { - var f = e.animations[h] - , d = l.a.GetClass("BABYLON.Animation"); - d && c.animations.push(d.Parse(f)) - } - return c - } - , - t.CreateFromBase64String = function(e, i, n, r, o, a, s, c, l) { - return void 0 === a && (a = t.TRILINEAR_SAMPLINGMODE), + return c; + }), + (t.CreateFromBase64String = function ( + e, + i, + n, + r, + o, + a, + s, + c, + l + ) { + return ( + void 0 === a && (a = t.TRILINEAR_SAMPLINGMODE), void 0 === s && (s = null), void 0 === c && (c = null), void 0 === l && (l = u.a.TEXTUREFORMAT_RGBA), - new t("data:" + i,n,r,o,a,s,c,e,false,l) - } - , - t.LoadFromDataString = function(e, i, n, r, o, a, s, c, l, h) { - return void 0 === r && (r = false), + new t("data:" + i, n, r, o, a, s, c, e, false, l) + ); + }), + (t.LoadFromDataString = function ( + e, + i, + n, + r, + o, + a, + s, + c, + l, + h + ) { + return ( + void 0 === r && (r = false), void 0 === o && (o = false), void 0 === a && (a = true), void 0 === s && (s = t.TRILINEAR_SAMPLINGMODE), @@ -26893,50 +32019,59 @@ and limitations under the License. void 0 === l && (l = null), void 0 === h && (h = u.a.TEXTUREFORMAT_RGBA), "data:" !== e.substr(0, 5) && (e = "data:" + e), - new t(e,n,o,a,s,c,l,i,r,h) - } - , - t._CubeTextureParser = function(e, t, i) { - throw h.a.WarnImport("CubeTexture") - } - , - t._CreateMirror = function(e, t, i, n) { - throw h.a.WarnImport("MirrorTexture") - } - , - t._CreateRenderTargetTexture = function(e, t, i, n) { - throw h.a.WarnImport("RenderTargetTexture") - } - , - t.NEAREST_SAMPLINGMODE = u.a.TEXTURE_NEAREST_SAMPLINGMODE, - t.NEAREST_NEAREST_MIPLINEAR = u.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR, - t.BILINEAR_SAMPLINGMODE = u.a.TEXTURE_BILINEAR_SAMPLINGMODE, - t.LINEAR_LINEAR_MIPNEAREST = u.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST, - t.TRILINEAR_SAMPLINGMODE = u.a.TEXTURE_TRILINEAR_SAMPLINGMODE, - t.LINEAR_LINEAR_MIPLINEAR = u.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR, - t.NEAREST_NEAREST_MIPNEAREST = u.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST, - t.NEAREST_LINEAR_MIPNEAREST = u.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST, - t.NEAREST_LINEAR_MIPLINEAR = u.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR, - t.NEAREST_LINEAR = u.a.TEXTURE_NEAREST_LINEAR, - t.NEAREST_NEAREST = u.a.TEXTURE_NEAREST_NEAREST, - t.LINEAR_NEAREST_MIPNEAREST = u.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST, - t.LINEAR_NEAREST_MIPLINEAR = u.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR, - t.LINEAR_LINEAR = u.a.TEXTURE_LINEAR_LINEAR, - t.LINEAR_NEAREST = u.a.TEXTURE_LINEAR_NEAREST, - t.EXPLICIT_MODE = u.a.TEXTURE_EXPLICIT_MODE, - t.SPHERICAL_MODE = u.a.TEXTURE_SPHERICAL_MODE, - t.PLANAR_MODE = u.a.TEXTURE_PLANAR_MODE, - t.CUBIC_MODE = u.a.TEXTURE_CUBIC_MODE, - t.PROJECTION_MODE = u.a.TEXTURE_PROJECTION_MODE, - t.SKYBOX_MODE = u.a.TEXTURE_SKYBOX_MODE, - t.INVCUBIC_MODE = u.a.TEXTURE_INVCUBIC_MODE, - t.EQUIRECTANGULAR_MODE = u.a.TEXTURE_EQUIRECTANGULAR_MODE, - t.FIXED_EQUIRECTANGULAR_MODE = u.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE, - t.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = u.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE, - t.CLAMP_ADDRESSMODE = u.a.TEXTURE_CLAMP_ADDRESSMODE, - t.WRAP_ADDRESSMODE = u.a.TEXTURE_WRAP_ADDRESSMODE, - t.MIRROR_ADDRESSMODE = u.a.TEXTURE_MIRROR_ADDRESSMODE, - t.UseSerializedUrlIfAny = false, + new t(e, n, o, a, s, c, l, i, r, h) + ); + }), + (t._CubeTextureParser = function (e, t, i) { + throw h.a.WarnImport("CubeTexture"); + }), + (t._CreateMirror = function (e, t, i, n) { + throw h.a.WarnImport("MirrorTexture"); + }), + (t._CreateRenderTargetTexture = function (e, t, i, n) { + throw h.a.WarnImport("RenderTargetTexture"); + }), + (t.NEAREST_SAMPLINGMODE = u.a.TEXTURE_NEAREST_SAMPLINGMODE), + (t.NEAREST_NEAREST_MIPLINEAR = + u.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR), + (t.BILINEAR_SAMPLINGMODE = + u.a.TEXTURE_BILINEAR_SAMPLINGMODE), + (t.LINEAR_LINEAR_MIPNEAREST = + u.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST), + (t.TRILINEAR_SAMPLINGMODE = + u.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + (t.LINEAR_LINEAR_MIPLINEAR = + u.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR), + (t.NEAREST_NEAREST_MIPNEAREST = + u.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST), + (t.NEAREST_LINEAR_MIPNEAREST = + u.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST), + (t.NEAREST_LINEAR_MIPLINEAR = + u.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR), + (t.NEAREST_LINEAR = u.a.TEXTURE_NEAREST_LINEAR), + (t.NEAREST_NEAREST = u.a.TEXTURE_NEAREST_NEAREST), + (t.LINEAR_NEAREST_MIPNEAREST = + u.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST), + (t.LINEAR_NEAREST_MIPLINEAR = + u.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR), + (t.LINEAR_LINEAR = u.a.TEXTURE_LINEAR_LINEAR), + (t.LINEAR_NEAREST = u.a.TEXTURE_LINEAR_NEAREST), + (t.EXPLICIT_MODE = u.a.TEXTURE_EXPLICIT_MODE), + (t.SPHERICAL_MODE = u.a.TEXTURE_SPHERICAL_MODE), + (t.PLANAR_MODE = u.a.TEXTURE_PLANAR_MODE), + (t.CUBIC_MODE = u.a.TEXTURE_CUBIC_MODE), + (t.PROJECTION_MODE = u.a.TEXTURE_PROJECTION_MODE), + (t.SKYBOX_MODE = u.a.TEXTURE_SKYBOX_MODE), + (t.INVCUBIC_MODE = u.a.TEXTURE_INVCUBIC_MODE), + (t.EQUIRECTANGULAR_MODE = u.a.TEXTURE_EQUIRECTANGULAR_MODE), + (t.FIXED_EQUIRECTANGULAR_MODE = + u.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE), + (t.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = + u.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE), + (t.CLAMP_ADDRESSMODE = u.a.TEXTURE_CLAMP_ADDRESSMODE), + (t.WRAP_ADDRESSMODE = u.a.TEXTURE_WRAP_ADDRESSMODE), + (t.MIRROR_ADDRESSMODE = u.a.TEXTURE_MIRROR_ADDRESSMODE), + (t.UseSerializedUrlIfAny = false), n.c([Object(r.c)()], t.prototype, "url", void 0), n.c([Object(r.c)()], t.prototype, "uOffset", void 0), n.c([Object(r.c)()], t.prototype, "vOffset", void 0), @@ -26945,3034 +32080,3980 @@ and limitations under the License. n.c([Object(r.c)()], t.prototype, "uAng", void 0), n.c([Object(r.c)()], t.prototype, "vAng", void 0), n.c([Object(r.c)()], t.prototype, "wAng", void 0), - n.c([Object(r.c)()], t.prototype, "uRotationCenter", void 0), - n.c([Object(r.c)()], t.prototype, "vRotationCenter", void 0), - n.c([Object(r.c)()], t.prototype, "wRotationCenter", void 0), + n.c( + [Object(r.c)()], + t.prototype, + "uRotationCenter", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "vRotationCenter", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "wRotationCenter", + void 0 + ), n.c([Object(r.c)()], t.prototype, "isBlocking", null), t - }(c.a); - r.a._TextureParser = f.Parse - } - , function(e, t, n) { - "use strict"; - n.d(t, "a", function() { - return r + ); + })(c.a); + r.a._TextureParser = f.Parse; + }, + function (e, t, n) { + "use strict"; + n.d(t, "a", function () { + return r; + }), + n.d(t, "d", function () { + return o; }), - n.d(t, "d", function() { - return o + n.d(t, "b", function () { + return a; }), - n.d(t, "b", function() { - return a - }), - n.d(t, "c", function() { - return s + n.d(t, "c", function () { + return s; }); - var r = function() { - function e(e, t, i, n) { + var r = (function () { + function e(e, t, i, n) { + void 0 === t && (t = false), this.initalize(e, t, i, n); + } + return ( + (e.prototype.initalize = function (e, t, i, n) { + return ( void 0 === t && (t = false), - this.initalize(e, t, i, n) - } - return e.prototype.initalize = function(e, t, i, n) { - return void 0 === t && (t = false), - this.mask = e, - this.skipNextObservers = t, - this.target = i, - this.currentTarget = n, + (this.mask = e), + (this.skipNextObservers = t), + (this.target = i), + (this.currentTarget = n), this - } - , + ); + }), e - }() - , o = function(e, t, i) { - void 0 === i && (i = null), - this.callback = e, - this.mask = t, - this.scope = i, - this._willBeUnregistered = false, - this.unregisterOnNextCall = false - } - , a = function() { - function e() {} - return e.prototype.dispose = function() { - if (this._observers && this._observables) - for (var e = 0; e < this._observers.length; e++) - this._observables[e].remove(this._observers[e]); - this._observers = null, - this._observables = null - } - , - e.Watch = function(t, i, n, r) { - void 0 === n && (n = -1), - void 0 === r && (r = null); - var o = new e; - o._observers = new Array, - o._observables = t; - for (var a = 0, s = t; a < s.length; a++) { - var c = s[a].add(i, n, false, r); - c && o._observers.push(c) - } - return o - } - , + ); + })(), + o = function (e, t, i) { + void 0 === i && (i = null), + (this.callback = e), + (this.mask = t), + (this.scope = i), + (this._willBeUnregistered = false), + (this.unregisterOnNextCall = false); + }, + a = (function () { + function e() {} + return ( + (e.prototype.dispose = function () { + if (this._observers && this._observables) + for (var e = 0; e < this._observers.length; e++) + this._observables[e].remove(this._observers[e]); + (this._observers = null), (this._observables = null); + }), + (e.Watch = function (t, i, n, r) { + void 0 === n && (n = -1), void 0 === r && (r = null); + var o = new e(); + (o._observers = new Array()), (o._observables = t); + for (var a = 0, s = t; a < s.length; a++) { + var c = s[a].add(i, n, false, r); + c && o._observers.push(c); + } + return o; + }), e - }() - , s = function() { - function e(e) { - this._observers = new Array, - this._eventState = new r(0), - e && (this._onObserverAdded = e) - } - return e.prototype.add = function(e, t, i, n, r) { - if (void 0 === t && (t = -1), + ); + })(), + s = (function () { + function e(e) { + (this._observers = new Array()), + (this._eventState = new r(0)), + e && (this._onObserverAdded = e); + } + return ( + (e.prototype.add = function (e, t, i, n, r) { + if ( + (void 0 === t && (t = -1), void 0 === i && (i = false), void 0 === n && (n = null), void 0 === r && (r = false), !e) - return null; - var a = new o(e,t,n); - return a.unregisterOnNextCall = r, - i ? this._observers.unshift(a) : this._observers.push(a), + ) + return null; + var a = new o(e, t, n); + return ( + (a.unregisterOnNextCall = r), + i + ? this._observers.unshift(a) + : this._observers.push(a), this._onObserverAdded && this._onObserverAdded(a), a - } - , - e.prototype.addOnce = function(e) { - return this.add(e, void 0, void 0, void 0, true) - } - , - e.prototype.remove = function(e) { - return !!e && -1 !== this._observers.indexOf(e) && (this._deferUnregister(e), - true) - } - , - e.prototype.removeCallback = function(e, t) { - for (var i = 0; i < this._observers.length; i++) - if (this._observers[i].callback === e && (!t || t === this._observers[i].scope)) - return this._deferUnregister(this._observers[i]), - true; - return false - } - , - e.prototype._deferUnregister = function(e) { - var t = this; - e.unregisterOnNextCall = false, - e._willBeUnregistered = true, - setTimeout(function() { - t._remove(e) - }, 0) - } - , - e.prototype._remove = function(e) { - if (!e) - return false; - var t = this._observers.indexOf(e); - return -1 !== t && (this._observers.splice(t, 1), - true) - } - , - e.prototype.makeObserverTopPriority = function(e) { - this._remove(e), - this._observers.unshift(e) - } - , - e.prototype.makeObserverBottomPriority = function(e) { - this._remove(e), - this._observers.push(e) - } - , - e.prototype.notifyObservers = function(e, t, i, n) { - if (void 0 === t && (t = -1), - !this._observers.length) - return true; - var r = this._eventState; - r.mask = t, - r.target = i, - r.currentTarget = n, - r.skipNextObservers = false, - r.lastReturnValue = e; - for (var o = 0, a = this._observers; o < a.length; o++) { - var s = a[o]; - if (!s._willBeUnregistered && (s.mask & t && (s.scope ? r.lastReturnValue = s.callback.apply(s.scope, [e, r]) : r.lastReturnValue = s.callback(e, r), + ); + }), + (e.prototype.addOnce = function (e) { + return this.add(e, void 0, void 0, void 0, true); + }), + (e.prototype.remove = function (e) { + return ( + !!e && + -1 !== this._observers.indexOf(e) && + (this._deferUnregister(e), true) + ); + }), + (e.prototype.removeCallback = function (e, t) { + for (var i = 0; i < this._observers.length; i++) + if ( + this._observers[i].callback === e && + (!t || t === this._observers[i].scope) + ) + return ( + this._deferUnregister(this._observers[i]), true + ); + return false; + }), + (e.prototype._deferUnregister = function (e) { + var t = this; + (e.unregisterOnNextCall = false), + (e._willBeUnregistered = true), + setTimeout(function () { + t._remove(e); + }, 0); + }), + (e.prototype._remove = function (e) { + if (!e) return false; + var t = this._observers.indexOf(e); + return -1 !== t && (this._observers.splice(t, 1), true); + }), + (e.prototype.makeObserverTopPriority = function (e) { + this._remove(e), this._observers.unshift(e); + }), + (e.prototype.makeObserverBottomPriority = function (e) { + this._remove(e), this._observers.push(e); + }), + (e.prototype.notifyObservers = function (e, t, i, n) { + if ((void 0 === t && (t = -1), !this._observers.length)) + return true; + var r = this._eventState; + (r.mask = t), + (r.target = i), + (r.currentTarget = n), + (r.skipNextObservers = false), + (r.lastReturnValue = e); + for (var o = 0, a = this._observers; o < a.length; o++) { + var s = a[o]; + if ( + !s._willBeUnregistered && + (s.mask & t && + (s.scope + ? (r.lastReturnValue = s.callback.apply(s.scope, [ + e, + r, + ])) + : (r.lastReturnValue = s.callback(e, r)), s.unregisterOnNextCall && this._deferUnregister(s)), - r.skipNextObservers)) - return false - } - return true - } - , - e.prototype.notifyObserversWithPromise = function(e, t, n, r) { - var o = this; - void 0 === t && (t = -1); - var a = i.resolve(e); - if (!this._observers.length) - return a; - var s = this._eventState; - return s.mask = t, - s.target = n, - s.currentTarget = r, - s.skipNextObservers = false, - this._observers.forEach(function(i) { - s.skipNextObservers || i._willBeUnregistered || i.mask & t && (a = i.scope ? a.then(function(t) { - return s.lastReturnValue = t, - i.callback.apply(i.scope, [e, s]) - }) : a.then(function(t) { - return s.lastReturnValue = t, - i.callback(e, s) - }), - i.unregisterOnNextCall && o._deferUnregister(i)) + r.skipNextObservers) + ) + return false; + } + return true; + }), + (e.prototype.notifyObserversWithPromise = function ( + e, + t, + n, + r + ) { + var o = this; + void 0 === t && (t = -1); + var a = i.resolve(e); + if (!this._observers.length) return a; + var s = this._eventState; + return ( + (s.mask = t), + (s.target = n), + (s.currentTarget = r), + (s.skipNextObservers = false), + this._observers.forEach(function (i) { + s.skipNextObservers || + i._willBeUnregistered || + (i.mask & t && + ((a = i.scope + ? a.then(function (t) { + return ( + (s.lastReturnValue = t), + i.callback.apply(i.scope, [e, s]) + ); + }) + : a.then(function (t) { + return ( + (s.lastReturnValue = t), i.callback(e, s) + ); + })), + i.unregisterOnNextCall && o._deferUnregister(i))); }), - a.then(function() { - return e + a.then(function () { + return e; }) - } - , - e.prototype.notifyObserver = function(e, t, i) { - void 0 === i && (i = -1); - var n = this._eventState; - n.mask = i, - n.skipNextObservers = false, - e.callback(t, n) - } - , - e.prototype.hasObservers = function() { - return this._observers.length > 0 - } - , - e.prototype.clear = function() { - this._observers = new Array, - this._onObserverAdded = null - } - , - e.prototype.clone = function() { - var t = new e; - return t._observers = this._observers.slice(0), - t - } - , - e.prototype.hasSpecificMask = function(e) { - void 0 === e && (e = -1); - for (var t = 0, i = this._observers; t < i.length; t++) { - var n = i[t]; - if (n.mask & e || n.mask === e) - return true - } - return false - } - , + ); + }), + (e.prototype.notifyObserver = function (e, t, i) { + void 0 === i && (i = -1); + var n = this._eventState; + (n.mask = i), + (n.skipNextObservers = false), + e.callback(t, n); + }), + (e.prototype.hasObservers = function () { + return this._observers.length > 0; + }), + (e.prototype.clear = function () { + (this._observers = new Array()), + (this._onObserverAdded = null); + }), + (e.prototype.clone = function () { + var t = new e(); + return (t._observers = this._observers.slice(0)), t; + }), + (e.prototype.hasSpecificMask = function (e) { + void 0 === e && (e = -1); + for (var t = 0, i = this._observers; t < i.length; t++) { + var n = i[t]; + if (n.mask & e || n.mask === e) return true; + } + return false; + }), e - }() - } - , function(e, t, n) { - "use strict"; - n.d(t, "c", function() { - return v + ); + })(); + }, + function (e, t, n) { + "use strict"; + n.d(t, "c", function () { + return v; + }), + n.d(t, "b", function () { + return y; }), - n.d(t, "b", function() { - return y + n.d(t, "d", function () { + return b; }), - n.d(t, "d", function() { - return b + n.d(t, "e", function () { + return E; }), - n.d(t, "e", function() { - return E + n.d(t, "g", function () { + return T; }), - n.d(t, "g", function() { - return T + n.d(t, "h", function () { + return A; }), - n.d(t, "h", function() { - return A + n.d(t, "f", function () { + return x; }), - n.d(t, "f", function() { - return x + n.d(t, "i", function () { + return S; }), - n.d(t, "i", function() { - return S - }), - n.d(t, "a", function() { - return C + n.d(t, "a", function () { + return C; }); - var r = n(1) - , o = n(0) - , a = n(12) - , s = n(8) - , u = n(59) - , l = n(3) - , h = n(35) - , f = n(6) - , d = n(22) - , p = n(32) - , m = n(47) - , g = n(19) - , _ = n(60) - , v = function() { - function e() {} - return e.prototype.getColorToRef = function(e) { - this.color2 ? o.f.LerpToRef(this.color1, this.color2, Math.random(), e) : e.copyFrom(this.color1) - } - , + var r = n(1), + o = n(0), + a = n(12), + s = n(8), + u = n(59), + l = n(3), + h = n(35), + f = n(6), + d = n(22), + p = n(32), + m = n(47), + g = n(19), + _ = n(60), + v = (function () { + function e() {} + return ( + (e.prototype.getColorToRef = function (e) { + this.color2 + ? o.f.LerpToRef( + this.color1, + this.color2, + Math.random(), + e + ) + : e.copyFrom(this.color1); + }), e - }() - , y = function() {} - , b = function() { - function e() {} - return e.prototype.getFactor = function() { - return void 0 === this.factor2 ? this.factor1 : a.a.Lerp(this.factor1, this.factor2, Math.random()) - } - , + ); + })(), + y = function () {}, + b = (function () { + function e() {} + return ( + (e.prototype.getFactor = function () { + return void 0 === this.factor2 + ? this.factor1 + : a.a.Lerp(this.factor1, this.factor2, Math.random()); + }), e - }() - , E = function(e) { - function t(i, n) { - var r = e.call(this, i) || this; - return r.request = n, - r.name = "LoadFileError", - t._setPrototypeOf(r, t.prototype), - r - } - return r.d(t, e), - t._setPrototypeOf = Object.setPrototypeOf || function(e, t) { - return e.__proto__ = t, - e - } - , + ); + })(), + E = (function (e) { + function t(i, n) { + var r = e.call(this, i) || this; + return ( + (r.request = n), + (r.name = "LoadFileError"), + t._setPrototypeOf(r, t.prototype), + r + ); + } + return ( + r.d(t, e), + (t._setPrototypeOf = + Object.setPrototypeOf || + function (e, t) { + return (e.__proto__ = t), e; + }), t - }(Error) - , T = function() { - function e() {} - return e.ExponentialBackoff = function(e, t) { - return void 0 === e && (e = 3), + ); + })(Error), + T = (function () { + function e() {} + return ( + (e.ExponentialBackoff = function (e, t) { + return ( + void 0 === e && (e = 3), void 0 === t && (t = 500), - function(i, n, r) { - return 0 !== n.status || r >= e || -1 !== i.indexOf("file:") ? -1 : Math.pow(2, r) * t + function (i, n, r) { + return 0 !== n.status || + r >= e || + -1 !== i.indexOf("file:") + ? -1 + : Math.pow(2, r) * t; } - } - , + ); + }), e - }() - , A = function() { - function e() {} - return e.FetchToRef = function(e, t, i, n, r, o) { - var a = 4 * ((Math.abs(e) * i % i | 0) + (Math.abs(t) * n % n | 0) * i); - o.r = r[a] / 255, - o.g = r[a + 1] / 255, - o.b = r[a + 2] / 255, - o.a = r[a + 3] / 255 - } - , - e.Mix = function(e, t, i) { - return e * (1 - i) + t * i - } - , - e.Instantiate = function(t) { - if (e.RegisteredExternalClasses && e.RegisteredExternalClasses[t]) - return e.RegisteredExternalClasses[t]; - var i = d.a.GetClass(t); - if (i) - return i; - f.a.Warn(t + " not found, you may have missed an import."); - for (var n = t.split("."), r = window || this, o = 0, a = n.length; o < a; o++) - r = r[n[o]]; - return "function" != typeof r ? null : r - } - , - e.Slice = function(e, t, i) { - return e.slice ? e.slice(t, i) : Array.prototype.slice.call(e, t, i) - } - , - e.SetImmediate = function(e) { - h.a.IsWindowObjectExist() && window.setImmediate ? window.setImmediate(e) : setTimeout(e, 1) - } - , - e.IsExponentOfTwo = function(e) { - var t = 1; - do { - t *= 2 - } while (t < e);return t === e - } - , - e.FloatRound = function(t) { - return Math.fround ? Math.fround(t) : e._tmpFloatArray[0] = t - } - , - e.CeilingPOT = function(e) { - return e--, - e |= e >> 1, - e |= e >> 2, - e |= e >> 4, - e |= e >> 8, - e |= e >> 16, + ); + })(), + A = (function () { + function e() {} + return ( + (e.FetchToRef = function (e, t, i, n, r, o) { + var a = + 4 * + (((Math.abs(e) * i) % i | 0) + + ((Math.abs(t) * n) % n | 0) * i); + (o.r = r[a] / 255), + (o.g = r[a + 1] / 255), + (o.b = r[a + 2] / 255), + (o.a = r[a + 3] / 255); + }), + (e.Mix = function (e, t, i) { + return e * (1 - i) + t * i; + }), + (e.Instantiate = function (t) { + if ( + e.RegisteredExternalClasses && + e.RegisteredExternalClasses[t] + ) + return e.RegisteredExternalClasses[t]; + var i = d.a.GetClass(t); + if (i) return i; + f.a.Warn( + t + " not found, you may have missed an import." + ); + for ( + var n = t.split("."), + r = window || this, + o = 0, + a = n.length; + o < a; + o++ + ) + r = r[n[o]]; + return "function" != typeof r ? null : r; + }), + (e.Slice = function (e, t, i) { + return e.slice + ? e.slice(t, i) + : Array.prototype.slice.call(e, t, i); + }), + (e.SetImmediate = function (e) { + h.a.IsWindowObjectExist() && window.setImmediate + ? window.setImmediate(e) + : setTimeout(e, 1); + }), + (e.IsExponentOfTwo = function (e) { + var t = 1; + do { + t *= 2; + } while (t < e); + return t === e; + }), + (e.FloatRound = function (t) { + return Math.fround + ? Math.fround(t) + : (e._tmpFloatArray[0] = t); + }), + (e.CeilingPOT = function (e) { + return ( + e--, + (e |= e >> 1), + (e |= e >> 2), + (e |= e >> 4), + (e |= e >> 8), + (e |= e >> 16), ++e - } - , - e.FloorPOT = function(e) { - return e |= e >> 1, - e |= e >> 2, - e |= e >> 4, - e |= e >> 8, + ); + }), + (e.FloorPOT = function (e) { + return ( + (e |= e >> 1), + (e |= e >> 2), + (e |= e >> 4), + (e |= e >> 8), (e |= e >> 16) - (e >> 1) - } - , - e.NearestPOT = function(t) { - var i = e.CeilingPOT(t) - , n = e.FloorPOT(t); - return i - t > t - n ? n : i - } - , - e.GetExponentOfTwo = function(t, i, n) { - var r; - switch (void 0 === n && (n = l.a.SCALEMODE_NEAREST), - n) { + ); + }), + (e.NearestPOT = function (t) { + var i = e.CeilingPOT(t), + n = e.FloorPOT(t); + return i - t > t - n ? n : i; + }), + (e.GetExponentOfTwo = function (t, i, n) { + var r; + switch ( + (void 0 === n && (n = l.a.SCALEMODE_NEAREST), n) + ) { case l.a.SCALEMODE_FLOOR: - r = e.FloorPOT(t); - break; + r = e.FloorPOT(t); + break; case l.a.SCALEMODE_NEAREST: - r = e.NearestPOT(t); - break; + r = e.NearestPOT(t); + break; case l.a.SCALEMODE_CEILING: default: - r = e.CeilingPOT(t) - } - return Math.min(r, i) - } - , - e.GetFilename = function(e) { - var t = e.lastIndexOf("/"); - return t < 0 ? e : e.substring(t + 1) - } - , - e.GetFolderPath = function(e, t) { - void 0 === t && (t = false); - var i = e.lastIndexOf("/"); - return i < 0 ? t ? e : "" : e.substring(0, i + 1) - } - , - e.ToDegrees = function(e) { - return 180 * e / Math.PI - } - , - e.ToRadians = function(e) { - return e * Math.PI / 180 - } - , - e.EncodeArrayBufferTobase64 = function(e) { - for (var t, i, n, r, o, a, s, c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", u = "", l = 0, h = new Uint8Array(e); l < h.length; ) - r = (t = h[l++]) >> 2, - o = (3 & t) << 4 | (i = l < h.length ? h[l++] : Number.NaN) >> 4, - a = (15 & i) << 2 | (n = l < h.length ? h[l++] : Number.NaN) >> 6, - s = 63 & n, - isNaN(i) ? a = s = 64 : isNaN(n) && (s = 64), - u += c.charAt(r) + c.charAt(o) + c.charAt(a) + c.charAt(s); - return "data:image/png;base64," + u - } - , - e.ExtractMinAndMaxIndexed = function(e, t, i, n, r) { - void 0 === r && (r = null); - for (var a = new o.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), s = new o.x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE), c = i; c < i + n; c++) { - var u = 3 * t[c] - , l = e[u] - , h = e[u + 1] - , f = e[u + 2]; - a.minimizeInPlaceFromFloats(l, h, f), - s.maximizeInPlaceFromFloats(l, h, f) - } - return r && (a.x -= a.x * r.x + r.y, - a.y -= a.y * r.x + r.y, - a.z -= a.z * r.x + r.y, - s.x += s.x * r.x + r.y, - s.y += s.y * r.x + r.y, - s.z += s.z * r.x + r.y), + r = e.CeilingPOT(t); + } + return Math.min(r, i); + }), + (e.GetFilename = function (e) { + var t = e.lastIndexOf("/"); + return t < 0 ? e : e.substring(t + 1); + }), + (e.GetFolderPath = function (e, t) { + void 0 === t && (t = false); + var i = e.lastIndexOf("/"); + return i < 0 ? (t ? e : "") : e.substring(0, i + 1); + }), + (e.ToDegrees = function (e) { + return (180 * e) / Math.PI; + }), + (e.ToRadians = function (e) { + return (e * Math.PI) / 180; + }), + (e.EncodeArrayBufferTobase64 = function (e) { + for ( + var t, + i, + n, + r, + o, + a, + s, + c = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + u = "", + l = 0, + h = new Uint8Array(e); + l < h.length; + + ) + (r = (t = h[l++]) >> 2), + (o = + ((3 & t) << 4) | + ((i = l < h.length ? h[l++] : Number.NaN) >> 4)), + (a = + ((15 & i) << 2) | + ((n = l < h.length ? h[l++] : Number.NaN) >> 6)), + (s = 63 & n), + isNaN(i) ? (a = s = 64) : isNaN(n) && (s = 64), + (u += + c.charAt(r) + + c.charAt(o) + + c.charAt(a) + + c.charAt(s)); + return "data:image/png;base64," + u; + }), + (e.ExtractMinAndMaxIndexed = function (e, t, i, n, r) { + void 0 === r && (r = null); + for ( + var a = new o.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + ), + s = new o.x( + -Number.MAX_VALUE, + -Number.MAX_VALUE, + -Number.MAX_VALUE + ), + c = i; + c < i + n; + c++ + ) { + var u = 3 * t[c], + l = e[u], + h = e[u + 1], + f = e[u + 2]; + a.minimizeInPlaceFromFloats(l, h, f), + s.maximizeInPlaceFromFloats(l, h, f); + } + return ( + r && + ((a.x -= a.x * r.x + r.y), + (a.y -= a.y * r.x + r.y), + (a.z -= a.z * r.x + r.y), + (s.x += s.x * r.x + r.y), + (s.y += s.y * r.x + r.y), + (s.z += s.z * r.x + r.y)), { - minimum: a, - maximum: s + minimum: a, + maximum: s, } - } - , - e.ExtractMinAndMax = function(e, t, i, n, r) { - void 0 === n && (n = null); - var a = new o.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE) - , s = new o.x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE); - r || (r = 3); - for (var c = t, u = t * r; c < t + i; c++, - u += r) { - var l = e[u] - , h = e[u + 1] - , f = e[u + 2]; - a.minimizeInPlaceFromFloats(l, h, f), - s.maximizeInPlaceFromFloats(l, h, f) - } - return n && (a.x -= a.x * n.x + n.y, - a.y -= a.y * n.x + n.y, - a.z -= a.z * n.x + n.y, - s.x += s.x * n.x + n.y, - s.y += s.y * n.x + n.y, - s.z += s.z * n.x + n.y), + ); + }), + (e.ExtractMinAndMax = function (e, t, i, n, r) { + void 0 === n && (n = null); + var a = new o.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + ), + s = new o.x( + -Number.MAX_VALUE, + -Number.MAX_VALUE, + -Number.MAX_VALUE + ); + r || (r = 3); + for (var c = t, u = t * r; c < t + i; c++, u += r) { + var l = e[u], + h = e[u + 1], + f = e[u + 2]; + a.minimizeInPlaceFromFloats(l, h, f), + s.maximizeInPlaceFromFloats(l, h, f); + } + return ( + n && + ((a.x -= a.x * n.x + n.y), + (a.y -= a.y * n.x + n.y), + (a.z -= a.z * n.x + n.y), + (s.x += s.x * n.x + n.y), + (s.y += s.y * n.x + n.y), + (s.z += s.z * n.x + n.y)), { - minimum: a, - maximum: s + minimum: a, + maximum: s, } - } - , - e.MakeArray = function(e, t) { - return true === t || void 0 !== e && null != e ? Array.isArray(e) ? e : [e] : null - } - , - e.GetPointerPrefix = function() { - var e = "pointer"; - return !h.a.IsWindowObjectExist() || window.PointerEvent || navigator.pointerEnabled || (e = "mouse"), + ); + }), + (e.MakeArray = function (e, t) { + return true === t || (void 0 !== e && null != e) + ? Array.isArray(e) + ? e + : [e] + : null; + }), + (e.GetPointerPrefix = function () { + var e = "pointer"; + return ( + !h.a.IsWindowObjectExist() || + window.PointerEvent || + navigator.pointerEnabled || + (e = "mouse"), e - } - , - e.QueueNewFrame = function(e, t) { - return h.a.IsWindowObjectExist() ? (t || (t = window), - t.requestAnimationFrame ? t.requestAnimationFrame(e) : t.msRequestAnimationFrame ? t.msRequestAnimationFrame(e) : t.webkitRequestAnimationFrame ? t.webkitRequestAnimationFrame(e) : t.mozRequestAnimationFrame ? t.mozRequestAnimationFrame(e) : t.oRequestAnimationFrame ? t.oRequestAnimationFrame(e) : window.setTimeout(e, 16)) : setTimeout(e, 16) - } - , - e.RequestFullscreen = function(e) { - var t = e.requestFullscreen || e.msRequestFullscreen || e.webkitRequestFullscreen || e.mozRequestFullScreen; - t && t.call(e) - } - , - e.ExitFullscreen = function() { - var e = document; - document.exitFullscreen ? document.exitFullscreen() : e.mozCancelFullScreen ? e.mozCancelFullScreen() : e.webkitCancelFullScreen ? e.webkitCancelFullScreen() : e.msCancelFullScreen && e.msCancelFullScreen() - } - , - e.SetCorsBehavior = function(t, i) { - if ((!t || 0 !== t.indexOf("data:")) && e.CorsBehavior) - if ("string" == typeof e.CorsBehavior || e.CorsBehavior instanceof String) - i.crossOrigin = e.CorsBehavior; - else { - var n = e.CorsBehavior(t); - n && (i.crossOrigin = n) - } - } - , - e.CleanUrl = function(e) { - return e.replace(/#/gm, "%23") - } - , - e.LoadImage = function(t, i, n, r) { - var o, a = false; - t instanceof ArrayBuffer ? (o = URL.createObjectURL(new Blob([t])), - a = true) : t instanceof Blob ? (o = URL.createObjectURL(t), - a = true) : (o = e.CleanUrl(t), - o = e.PreprocessUrl(t)); - var s = new Image; - e.SetCorsBehavior(o, s); - var c = function e() { - s.removeEventListener("load", e), + ); + }), + (e.QueueNewFrame = function (e, t) { + return h.a.IsWindowObjectExist() + ? (t || (t = window), + t.requestAnimationFrame + ? t.requestAnimationFrame(e) + : t.msRequestAnimationFrame + ? t.msRequestAnimationFrame(e) + : t.webkitRequestAnimationFrame + ? t.webkitRequestAnimationFrame(e) + : t.mozRequestAnimationFrame + ? t.mozRequestAnimationFrame(e) + : t.oRequestAnimationFrame + ? t.oRequestAnimationFrame(e) + : window.setTimeout(e, 16)) + : setTimeout(e, 16); + }), + (e.RequestFullscreen = function (e) { + var t = + e.requestFullscreen || + e.msRequestFullscreen || + e.webkitRequestFullscreen || + e.mozRequestFullScreen; + t && t.call(e); + }), + (e.ExitFullscreen = function () { + var e = document; + document.exitFullscreen + ? document.exitFullscreen() + : e.mozCancelFullScreen + ? e.mozCancelFullScreen() + : e.webkitCancelFullScreen + ? e.webkitCancelFullScreen() + : e.msCancelFullScreen && e.msCancelFullScreen(); + }), + (e.SetCorsBehavior = function (t, i) { + if ((!t || 0 !== t.indexOf("data:")) && e.CorsBehavior) + if ( + "string" == typeof e.CorsBehavior || + e.CorsBehavior instanceof String + ) + i.crossOrigin = e.CorsBehavior; + else { + var n = e.CorsBehavior(t); + n && (i.crossOrigin = n); + } + }), + (e.CleanUrl = function (e) { + return e.replace(/#/gm, "%23"); + }), + (e.LoadImage = function (t, i, n, r) { + var o, + a = false; + t instanceof ArrayBuffer + ? ((o = URL.createObjectURL(new Blob([t]))), (a = true)) + : t instanceof Blob + ? ((o = URL.createObjectURL(t)), (a = true)) + : ((o = e.CleanUrl(t)), (o = e.PreprocessUrl(t))); + var s = new Image(); + e.SetCorsBehavior(o, s); + var c = function e() { + s.removeEventListener("load", e), s.removeEventListener("error", l), i(s), - a && s.src && URL.revokeObjectURL(s.src) - } - , l = function e(i) { - s.removeEventListener("load", c), + a && s.src && URL.revokeObjectURL(s.src); + }, + l = function e(i) { + s.removeEventListener("load", c), s.removeEventListener("error", e), f.a.Error("Error while trying to load image: " + t), n && n("Error while trying to load image: " + t, i), - a && s.src && URL.revokeObjectURL(s.src) + a && s.src && URL.revokeObjectURL(s.src); }; - s.addEventListener("load", c), + s.addEventListener("load", c), s.addEventListener("error", l); - var h = function() { - s.src = o - }; - if ("data:" !== o.substr(0, 5) && r && r.enableTexturesOffline) - r.open(function() { - r && r.loadImage(o, s) - }, h); - else { - if (-1 !== o.indexOf("file:")) { - var d = decodeURIComponent(o.substring(5).toLowerCase()); - if (u.a.FilesToLoad[d]) { - try { - var p; - try { - p = URL.createObjectURL(u.a.FilesToLoad[d]) - } catch (e) { - p = URL.createObjectURL(u.a.FilesToLoad[d]) - } - s.src = p, - a = true - } catch (e) { - s.src = "" - } - return s - } + var h = function () { + s.src = o; + }; + if ( + "data:" !== o.substr(0, 5) && + r && + r.enableTexturesOffline + ) + r.open(function () { + r && r.loadImage(o, s); + }, h); + else { + if (-1 !== o.indexOf("file:")) { + var d = decodeURIComponent( + o.substring(5).toLowerCase() + ); + if (u.a.FilesToLoad[d]) { + try { + var p; + try { + p = URL.createObjectURL(u.a.FilesToLoad[d]); + } catch (e) { + p = URL.createObjectURL(u.a.FilesToLoad[d]); + } + (s.src = p), (a = true); + } catch (e) { + s.src = ""; } - h() + return s; + } } - return s - } - , - e.LoadFile = function(t, i, n, r, o, a) { - if (t = e.CleanUrl(t), - -1 !== (t = e.PreprocessUrl(t)).indexOf("file:")) { - var c = decodeURIComponent(t.substring(5).toLowerCase()); - if (u.a.FilesToLoad[c]) - return e.ReadFile(u.a.FilesToLoad[c], i, n, o) - } - var l = e.BaseUrl + t - , f = false - , d = { - onCompleteObservable: new s.c, - abort: function() { - return f = true - } - } - , p = function() { - var t = new _.a - , r = null; - d.abort = function() { - f = true, - t.readyState !== (XMLHttpRequest.DONE || 4) && t.abort(), - null !== r && (clearTimeout(r), - r = null) - } - ; - !function s(c) { - t.open("GET", l), - o && (t.responseType = "arraybuffer"), - n && t.addEventListener("progress", n); - var u = function e() { - t.removeEventListener("loadend", e), - d.onCompleteObservable.notifyObservers(d), - d.onCompleteObservable.clear() - }; - t.addEventListener("loadend", u); - t.addEventListener("readystatechange", function n() { - if (!f && t.readyState === (XMLHttpRequest.DONE || 4)) { - if (t.removeEventListener("readystatechange", n), - t.status >= 200 && t.status < 300 || 0 === t.status && (!h.a.IsWindowObjectExist() || e.IsFileURL())) - return void i(o ? t.response : t.responseText, t.responseURL); - var d = e.DefaultRetryStrategy; - if (d) { - var p = d(l, t, c); - if (-1 !== p) - return t.removeEventListener("loadend", u), - t = new _.a, - void (r = setTimeout(function() { - return s(c + 1) - }, p)) - } - var m = new E("Error status: " + t.status + " " + t.statusText + " - Unable to load " + l,t); - if (!a) - throw m; - a(t, m) - } - }), - t.send() - }(0) - }; - if (r && r.enableSceneOffline) { - var m = function(e) { - e && e.status > 400 ? a && a(e) : f || p() + h(); + } + return s; + }), + (e.LoadFile = function (t, i, n, r, o, a) { + if ( + ((t = e.CleanUrl(t)), + -1 !== (t = e.PreprocessUrl(t)).indexOf("file:")) + ) { + var c = decodeURIComponent( + t.substring(5).toLowerCase() + ); + if (u.a.FilesToLoad[c]) + return e.ReadFile(u.a.FilesToLoad[c], i, n, o); + } + var l = e.BaseUrl + t, + f = false, + d = { + onCompleteObservable: new s.c(), + abort: function () { + return (f = true); + }, + }, + p = function () { + var t = new _.a(), + r = null; + d.abort = function () { + (f = true), + t.readyState !== (XMLHttpRequest.DONE || 4) && + t.abort(), + null !== r && (clearTimeout(r), (r = null)); + }; + !(function s(c) { + t.open("GET", l), + o && (t.responseType = "arraybuffer"), + n && t.addEventListener("progress", n); + var u = function e() { + t.removeEventListener("loadend", e), + d.onCompleteObservable.notifyObservers(d), + d.onCompleteObservable.clear(); }; - r.open(function() { - f || r && r.loadFile(t, function(e) { - f || i(e), - d.onCompleteObservable.notifyObservers(d) - }, n ? function(e) { - f || n(e) + t.addEventListener("loadend", u); + t.addEventListener( + "readystatechange", + function n() { + if ( + !f && + t.readyState === (XMLHttpRequest.DONE || 4) + ) { + if ( + (t.removeEventListener( + "readystatechange", + n + ), + (t.status >= 200 && t.status < 300) || + (0 === t.status && + (!h.a.IsWindowObjectExist() || + e.IsFileURL()))) + ) + return void i( + o ? t.response : t.responseText, + t.responseURL + ); + var d = e.DefaultRetryStrategy; + if (d) { + var p = d(l, t, c); + if (-1 !== p) + return ( + t.removeEventListener("loadend", u), + (t = new _.a()), + void (r = setTimeout(function () { + return s(c + 1); + }, p)) + ); + } + var m = new E( + "Error status: " + + t.status + + " " + + t.statusText + + " - Unable to load " + + l, + t + ); + if (!a) throw m; + a(t, m); } - : void 0, m, o) - }, m) - } else - p(); - return d - } - , - e.LoadScript = function(e, t, i, n) { - if (h.a.IsWindowObjectExist()) { - var r = document.getElementsByTagName("head")[0] - , o = document.createElement("script"); - o.setAttribute("type", "text/javascript"), - o.setAttribute("src", e), - n && (o.id = n), - o.onload = function() { - t && t() - } - , - o.onerror = function(t) { - i && i("Unable to load script '" + e + "'", t) - } - , - r.appendChild(o) - } - } - , - e.LoadScriptAsync = function(e, t) { - return new i(function(i, n) { - if (h.a.IsWindowObjectExist()) { - var r = document.getElementsByTagName("head")[0] - , o = document.createElement("script"); - o.setAttribute("type", "text/javascript"), - o.setAttribute("src", e), - t && (o.id = t), - o.onload = function() { - i(true) - } - , - o.onerror = function(e) { - i(false) - } - , - r.appendChild(o) - } else - i(false) - } - ) - } - , - e.ReadFileAsDataURL = function(e, t, i) { - var n = new FileReader - , r = { - onCompleteObservable: new s.c, - abort: function() { - return n.abort() - } + } + ), + t.send(); + })(0); }; - return n.onloadend = function(e) { - r.onCompleteObservable.notifyObservers(r) - } - , - n.onload = function(e) { - t(e.target.result) - } - , - n.onprogress = i, + if (r && r.enableSceneOffline) { + var m = function (e) { + e && e.status > 400 ? a && a(e) : f || p(); + }; + r.open(function () { + f || + (r && + r.loadFile( + t, + function (e) { + f || i(e), + d.onCompleteObservable.notifyObservers(d); + }, + n + ? function (e) { + f || n(e); + } + : void 0, + m, + o + )); + }, m); + } else p(); + return d; + }), + (e.LoadScript = function (e, t, i, n) { + if (h.a.IsWindowObjectExist()) { + var r = document.getElementsByTagName("head")[0], + o = document.createElement("script"); + o.setAttribute("type", "text/javascript"), + o.setAttribute("src", e), + n && (o.id = n), + (o.onload = function () { + t && t(); + }), + (o.onerror = function (t) { + i && i("Unable to load script '" + e + "'", t); + }), + r.appendChild(o); + } + }), + (e.LoadScriptAsync = function (e, t) { + return new i(function (i, n) { + if (h.a.IsWindowObjectExist()) { + var r = document.getElementsByTagName("head")[0], + o = document.createElement("script"); + o.setAttribute("type", "text/javascript"), + o.setAttribute("src", e), + t && (o.id = t), + (o.onload = function () { + i(true); + }), + (o.onerror = function (e) { + i(false); + }), + r.appendChild(o); + } else i(false); + }); + }), + (e.ReadFileAsDataURL = function (e, t, i) { + var n = new FileReader(), + r = { + onCompleteObservable: new s.c(), + abort: function () { + return n.abort(); + }, + }; + return ( + (n.onloadend = function (e) { + r.onCompleteObservable.notifyObservers(r); + }), + (n.onload = function (e) { + t(e.target.result); + }), + (n.onprogress = i), n.readAsDataURL(e), r - } - , - e.ReadFile = function(e, t, i, n) { - var r = new FileReader - , o = { - onCompleteObservable: new s.c, - abort: function() { - return r.abort() - } + ); + }), + (e.ReadFile = function (e, t, i, n) { + var r = new FileReader(), + o = { + onCompleteObservable: new s.c(), + abort: function () { + return r.abort(); + }, }; - return r.onloadend = function(e) { - return o.onCompleteObservable.notifyObservers(o) - } - , - r.onerror = function(i) { - f.a.Log("Error while reading file: " + e.name), - t(JSON.stringify({ + return ( + (r.onloadend = function (e) { + return o.onCompleteObservable.notifyObservers(o); + }), + (r.onerror = function (i) { + f.a.Log("Error while reading file: " + e.name), + t( + JSON.stringify({ autoClear: true, clearColor: [1, 0, 0], ambientColor: [0, 0, 0], gravity: [0, -9.807, 0], meshes: [], cameras: [], - lights: [] - })) - } - , - r.onload = function(e) { - t(e.target.result) - } - , + lights: [], + }) + ); + }), + (r.onload = function (e) { + t(e.target.result); + }), i && (r.onprogress = i), n ? r.readAsArrayBuffer(e) : r.readAsText(e), o - } - , - e.FileAsURL = function(e) { - var t = new Blob([e]); - return (window.URL || window.webkitURL).createObjectURL(t) - } - , - e.Format = function(e, t) { - return void 0 === t && (t = 2), - e.toFixed(t) - } - , - e.CheckExtends = function(e, t, i) { - t.minimizeInPlace(e), - i.maximizeInPlace(e) - } - , - e.DeepCopy = function(e, t, i, n) { - p.a.DeepCopy(e, t, i, n) - } - , - e.IsEmpty = function(e) { - for (var t in e) - if (e.hasOwnProperty(t)) - return false; - return true - } - , - e.EndsWith = function(e, t) { - return -1 !== e.indexOf(t, e.length - t.length) - } - , - e.RegisterTopRootEvents = function(e) { - for (var t = 0; t < e.length; t++) { - var i = e[t]; - window.addEventListener(i.name, i.handler, false); - try { - window.parent && window.parent.addEventListener(i.name, i.handler, false) - } catch (e) {} + ); + }), + (e.FileAsURL = function (e) { + var t = new Blob([e]); + return (window.URL || window.webkitURL).createObjectURL( + t + ); + }), + (e.Format = function (e, t) { + return void 0 === t && (t = 2), e.toFixed(t); + }), + (e.CheckExtends = function (e, t, i) { + t.minimizeInPlace(e), i.maximizeInPlace(e); + }), + (e.DeepCopy = function (e, t, i, n) { + p.a.DeepCopy(e, t, i, n); + }), + (e.IsEmpty = function (e) { + for (var t in e) if (e.hasOwnProperty(t)) return false; + return true; + }), + (e.EndsWith = function (e, t) { + return -1 !== e.indexOf(t, e.length - t.length); + }), + (e.RegisterTopRootEvents = function (e) { + for (var t = 0; t < e.length; t++) { + var i = e[t]; + window.addEventListener(i.name, i.handler, false); + try { + window.parent && + window.parent.addEventListener( + i.name, + i.handler, + false + ); + } catch (e) {} + } + }), + (e.UnregisterTopRootEvents = function (e) { + for (var t = 0; t < e.length; t++) { + var i = e[t]; + window.removeEventListener(i.name, i.handler); + try { + window.parent && + window.parent.removeEventListener( + i.name, + i.handler + ); + } catch (e) {} + } + }), + (e.DumpFramebuffer = function (t, i, n, r, o, a) { + void 0 === o && (o = "image/png"); + for ( + var s = 4 * t, + c = i / 2, + u = n.readPixels(0, 0, t, i), + l = 0; + l < c; + l++ + ) + for (var h = 0; h < s; h++) { + var f = h + l * s, + d = h + (i - l - 1) * s, + p = u[f]; + (u[f] = u[d]), (u[d] = p); } - } - , - e.UnregisterTopRootEvents = function(e) { - for (var t = 0; t < e.length; t++) { - var i = e[t]; - window.removeEventListener(i.name, i.handler); - try { - window.parent && window.parent.removeEventListener(i.name, i.handler) - } catch (e) {} - } - } - , - e.DumpFramebuffer = function(t, i, n, r, o, a) { - void 0 === o && (o = "image/png"); - for (var s = 4 * t, c = i / 2, u = n.readPixels(0, 0, t, i), l = 0; l < c; l++) - for (var h = 0; h < s; h++) { - var f = h + l * s - , d = h + (i - l - 1) * s - , p = u[f]; - u[f] = u[d], - u[d] = p - } - e._ScreenshotCanvas || (e._ScreenshotCanvas = document.createElement("canvas")), - e._ScreenshotCanvas.width = t, - e._ScreenshotCanvas.height = i; - var m = e._ScreenshotCanvas.getContext("2d"); - if (m) { - var g = m.createImageData(t, i); - g.data.set(u), - m.putImageData(g, 0, 0), - e.EncodeScreenshotCanvasData(r, o, a) - } - } - , - e.ToBlob = function(e, t, i) { - void 0 === i && (i = "image/png"), - e.toBlob || (e.toBlob = function(e, t, i) { + e._ScreenshotCanvas || + (e._ScreenshotCanvas = + document.createElement("canvas")), + (e._ScreenshotCanvas.width = t), + (e._ScreenshotCanvas.height = i); + var m = e._ScreenshotCanvas.getContext("2d"); + if (m) { + var g = m.createImageData(t, i); + g.data.set(u), + m.putImageData(g, 0, 0), + e.EncodeScreenshotCanvasData(r, o, a); + } + }), + (e.ToBlob = function (e, t, i) { + void 0 === i && (i = "image/png"), + e.toBlob || + (e.toBlob = function (e, t, i) { var n = this; - setTimeout(function() { - for (var r = atob(n.toDataURL(t, i).split(",")[1]), o = r.length, a = new Uint8Array(o), s = 0; s < o; s++) - a[s] = r.charCodeAt(s); - e(new Blob([a])) - }) - } - ), - e.toBlob(function(e) { - t(e) - }, i) - } - , - e.EncodeScreenshotCanvasData = function(t, i, n) { - void 0 === i && (i = "image/png"), - t ? t(e._ScreenshotCanvas.toDataURL(i)) : this.ToBlob(e._ScreenshotCanvas, function(t) { - if ("download"in document.createElement("a")) { - if (!n) { - var i = new Date - , r = (i.getFullYear() + "-" + (i.getMonth() + 1)).slice(2) + "-" + i.getDate() + "_" + i.getHours() + "-" + ("0" + i.getMinutes()).slice(-2); - n = "screenshot_" + r + ".png" + setTimeout(function () { + for ( + var r = atob(n.toDataURL(t, i).split(",")[1]), + o = r.length, + a = new Uint8Array(o), + s = 0; + s < o; + s++ + ) + a[s] = r.charCodeAt(s); + e(new Blob([a])); + }); + }), + e.toBlob(function (e) { + t(e); + }, i); + }), + (e.EncodeScreenshotCanvasData = function (t, i, n) { + void 0 === i && (i = "image/png"), + t + ? t(e._ScreenshotCanvas.toDataURL(i)) + : this.ToBlob( + e._ScreenshotCanvas, + function (t) { + if ("download" in document.createElement("a")) { + if (!n) { + var i = new Date(), + r = + ( + i.getFullYear() + + "-" + + (i.getMonth() + 1) + ).slice(2) + + "-" + + i.getDate() + + "_" + + i.getHours() + + "-" + + ("0" + i.getMinutes()).slice(-2); + n = "screenshot_" + r + ".png"; + } + e.Download(t, n); + } else { + var o = URL.createObjectURL(t), + a = window.open(""); + if (!a) return; + var s = a.document.createElement("img"); + (s.onload = function () { + URL.revokeObjectURL(o); + }), + (s.src = o), + a.document.body.appendChild(s); } - e.Download(t, n) - } else { - var o = URL.createObjectURL(t) - , a = window.open(""); - if (!a) - return; - var s = a.document.createElement("img"); - s.onload = function() { - URL.revokeObjectURL(o) - } - , - s.src = o, - a.document.body.appendChild(s) - } - }, i) - } - , - e.Download = function(e, t) { - if (navigator && navigator.msSaveBlob) - navigator.msSaveBlob(e, t); - else { - var i = window.URL.createObjectURL(e) - , n = document.createElement("a"); - document.body.appendChild(n), - n.style.display = "none", - n.href = i, - n.download = t, - n.addEventListener("click", function() { - n.parentElement && n.parentElement.removeChild(n) - }), - n.click(), - window.URL.revokeObjectURL(i) - } - } - , - e.CreateScreenshot = function(e, t, i, n, r) { - throw void 0 === r && (r = "image/png"), - g.a.WarnImport("ScreenshotTools") - } - , - e.CreateScreenshotUsingRenderTarget = function(e, t, i, n, r, o, a, s) { - throw void 0 === r && (r = "image/png"), + }, + i + ); + }), + (e.Download = function (e, t) { + if (navigator && navigator.msSaveBlob) + navigator.msSaveBlob(e, t); + else { + var i = window.URL.createObjectURL(e), + n = document.createElement("a"); + document.body.appendChild(n), + (n.style.display = "none"), + (n.href = i), + (n.download = t), + n.addEventListener("click", function () { + n.parentElement && n.parentElement.removeChild(n); + }), + n.click(), + window.URL.revokeObjectURL(i); + } + }), + (e.CreateScreenshot = function (e, t, i, n, r) { + throw ( + (void 0 === r && (r = "image/png"), + g.a.WarnImport("ScreenshotTools")) + ); + }), + (e.CreateScreenshotUsingRenderTarget = function ( + e, + t, + i, + n, + r, + o, + a, + s + ) { + throw ( + (void 0 === r && (r = "image/png"), void 0 === o && (o = 1), void 0 === a && (a = false), - g.a.WarnImport("ScreenshotTools") - } - , - e.RandomId = function() { - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) { - var t = 16 * Math.random() | 0; - return ("x" === e ? t : 3 & t | 8).toString(16) - }) - } - , - e.IsBase64 = function(e) { - return !(e.length < 5) && "data:" === e.substr(0, 5) - } - , - e.DecodeBase64 = function(e) { - for (var t = atob(e.split(",")[1]), i = t.length, n = new Uint8Array(new ArrayBuffer(i)), r = 0; r < i; r++) - n[r] = t.charCodeAt(r); - return n.buffer - } - , - e.GetAbsoluteUrl = function(e) { - var t = document.createElement("a"); - return t.href = e, - t.href - } - , + g.a.WarnImport("ScreenshotTools")) + ); + }), + (e.RandomId = function () { + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( + /[xy]/g, + function (e) { + var t = (16 * Math.random()) | 0; + return ("x" === e ? t : (3 & t) | 8).toString(16); + } + ); + }), + (e.IsBase64 = function (e) { + return !(e.length < 5) && "data:" === e.substr(0, 5); + }), + (e.DecodeBase64 = function (e) { + for ( + var t = atob(e.split(",")[1]), + i = t.length, + n = new Uint8Array(new ArrayBuffer(i)), + r = 0; + r < i; + r++ + ) + n[r] = t.charCodeAt(r); + return n.buffer; + }), + (e.GetAbsoluteUrl = function (e) { + var t = document.createElement("a"); + return (t.href = e), t.href; + }), Object.defineProperty(e, "errorsCount", { - get: function() { - return f.a.errorsCount - }, - enumerable: true, - configurable: true + get: function () { + return f.a.errorsCount; + }, + enumerable: true, + configurable: true, + }), + (e.Log = function (e) { + f.a.Log(e); + }), + (e.Warn = function (e) { + f.a.Warn(e); + }), + (e.Error = function (e) { + f.a.Error(e); }), - e.Log = function(e) { - f.a.Log(e) - } - , - e.Warn = function(e) { - f.a.Warn(e) - } - , - e.Error = function(e) { - f.a.Error(e) - } - , Object.defineProperty(e, "LogCache", { - get: function() { - return f.a.LogCache - }, - enumerable: true, - configurable: true + get: function () { + return f.a.LogCache; + }, + enumerable: true, + configurable: true, + }), + (e.ClearLogCache = function () { + f.a.ClearLogCache(); }), - e.ClearLogCache = function() { - f.a.ClearLogCache() - } - , Object.defineProperty(e, "LogLevels", { - set: function(e) { - f.a.LogLevels = e - }, - enumerable: true, - configurable: true + set: function (e) { + f.a.LogLevels = e; + }, + enumerable: true, + configurable: true, + }), + (e.IsFileURL = function () { + return "file:" === location.protocol; }), - e.IsFileURL = function() { - return "file:" === location.protocol - } - , Object.defineProperty(e, "PerformanceLogLevel", { - set: function(t) { - return (t & e.PerformanceUserMarkLogLevel) === e.PerformanceUserMarkLogLevel ? (e.StartPerformanceCounter = e._StartUserMark, - void (e.EndPerformanceCounter = e._EndUserMark)) : (t & e.PerformanceConsoleLogLevel) === e.PerformanceConsoleLogLevel ? (e.StartPerformanceCounter = e._StartPerformanceConsole, - void (e.EndPerformanceCounter = e._EndPerformanceConsole)) : (e.StartPerformanceCounter = e._StartPerformanceCounterDisabled, - void (e.EndPerformanceCounter = e._EndPerformanceCounterDisabled)) - }, - enumerable: true, - configurable: true + set: function (t) { + return (t & e.PerformanceUserMarkLogLevel) === + e.PerformanceUserMarkLogLevel + ? ((e.StartPerformanceCounter = e._StartUserMark), + void (e.EndPerformanceCounter = e._EndUserMark)) + : (t & e.PerformanceConsoleLogLevel) === + e.PerformanceConsoleLogLevel + ? ((e.StartPerformanceCounter = + e._StartPerformanceConsole), + void (e.EndPerformanceCounter = + e._EndPerformanceConsole)) + : ((e.StartPerformanceCounter = + e._StartPerformanceCounterDisabled), + void (e.EndPerformanceCounter = + e._EndPerformanceCounterDisabled)); + }, + enumerable: true, + configurable: true, + }), + (e._StartPerformanceCounterDisabled = function (e, t) {}), + (e._EndPerformanceCounterDisabled = function (e, t) {}), + (e._StartUserMark = function (t, i) { + if ((void 0 === i && (i = true), !e._performance)) { + if (!h.a.IsWindowObjectExist()) return; + e._performance = window.performance; + } + i && + e._performance.mark && + e._performance.mark(t + "-Begin"); + }), + (e._EndUserMark = function (t, i) { + void 0 === i && (i = true), + i && + e._performance.mark && + (e._performance.mark(t + "-End"), + e._performance.measure(t, t + "-Begin", t + "-End")); + }), + (e._StartPerformanceConsole = function (t, i) { + void 0 === i && (i = true), + i && + (e._StartUserMark(t, i), + console.time && console.time(t)); + }), + (e._EndPerformanceConsole = function (t, i) { + void 0 === i && (i = true), + i && + (e._EndUserMark(t, i), + console.time && console.timeEnd(t)); }), - e._StartPerformanceCounterDisabled = function(e, t) {} - , - e._EndPerformanceCounterDisabled = function(e, t) {} - , - e._StartUserMark = function(t, i) { - if (void 0 === i && (i = true), - !e._performance) { - if (!h.a.IsWindowObjectExist()) - return; - e._performance = window.performance - } - i && e._performance.mark && e._performance.mark(t + "-Begin") - } - , - e._EndUserMark = function(t, i) { - void 0 === i && (i = true), - i && e._performance.mark && (e._performance.mark(t + "-End"), - e._performance.measure(t, t + "-Begin", t + "-End")) - } - , - e._StartPerformanceConsole = function(t, i) { - void 0 === i && (i = true), - i && (e._StartUserMark(t, i), - console.time && console.time(t)) - } - , - e._EndPerformanceConsole = function(t, i) { - void 0 === i && (i = true), - i && (e._EndUserMark(t, i), - console.time && console.timeEnd(t)) - } - , Object.defineProperty(e, "Now", { - get: function() { - return m.a.Now - }, - enumerable: true, - configurable: true + get: function () { + return m.a.Now; + }, + enumerable: true, + configurable: true, }), - e.GetClassName = function(e, t) { - void 0 === t && (t = false); - var i = null; - return !t && e.getClassName ? i = e.getClassName() : (e instanceof Object && (i = (t ? e : Object.getPrototypeOf(e)).constructor.__bjsclassName__), - i || (i = c(e))), + (e.GetClassName = function (e, t) { + void 0 === t && (t = false); + var i = null; + return ( + !t && e.getClassName + ? (i = e.getClassName()) + : (e instanceof Object && + (i = (t ? e : Object.getPrototypeOf(e)) + .constructor.__bjsclassName__), + i || (i = c(e))), i - } - , - e.First = function(e, t) { - for (var i = 0, n = e; i < n.length; i++) { - var r = n[i]; - if (t(r)) - return r + ); + }), + (e.First = function (e, t) { + for (var i = 0, n = e; i < n.length; i++) { + var r = n[i]; + if (t(r)) return r; + } + return null; + }), + (e.getFullClassName = function (e, t) { + void 0 === t && (t = false); + var i = null, + n = null; + if (!t && e.getClassName) i = e.getClassName(); + else { + if (e instanceof Object) { + var r = t ? e : Object.getPrototypeOf(e); + (i = r.constructor.__bjsclassName__), + (n = r.constructor.__bjsmoduleName__); } - return null - } - , - e.getFullClassName = function(e, t) { - void 0 === t && (t = false); - var i = null - , n = null; - if (!t && e.getClassName) - i = e.getClassName(); - else { - if (e instanceof Object) { - var r = t ? e : Object.getPrototypeOf(e); - i = r.constructor.__bjsclassName__, - n = r.constructor.__bjsmoduleName__ - } - i || (i = c(e)) - } - return i ? (null != n ? n + "." : "") + i : null - } - , - e.DelayAsync = function(e) { - return new i(function(t) { - setTimeout(function() { - t() - }, e) - } - ) - } - , - e.GetCurrentGradient = function(e, t, i) { - for (var n = 0; n < t.length - 1; n++) { - var r = t[n] - , o = t[n + 1]; - if (e >= r.gradient && e <= o.gradient) - return void i(r, o, (e - r.gradient) / (o.gradient - r.gradient)) - } - var a = t.length - 1; - i(t[a], t[a], 1) - } - , - e.BaseUrl = "", - e.UseCustomRequestHeaders = false, - e.CustomRequestHeaders = _.a.CustomRequestHeaders, - e.DefaultRetryStrategy = T.ExponentialBackoff(), - e.CorsBehavior = "anonymous", - e.UseFallbackTexture = true, - e.RegisteredExternalClasses = {}, - e.fallbackTexture = "data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z", - e._tmpFloatArray = new Float32Array(1), - e.GetDOMTextContent = h.a.GetDOMTextContent, - e.PreprocessUrl = function(e) { - return e - } - , - e.NoneLogLevel = f.a.NoneLogLevel, - e.MessageLogLevel = f.a.MessageLogLevel, - e.WarningLogLevel = f.a.WarningLogLevel, - e.ErrorLogLevel = f.a.ErrorLogLevel, - e.AllLogLevel = f.a.AllLogLevel, - e.IsWindowObjectExist = h.a.IsWindowObjectExist, - e.PerformanceNoneLogLevel = 0, - e.PerformanceUserMarkLogLevel = 1, - e.PerformanceConsoleLogLevel = 2, - e.StartPerformanceCounter = e._StartPerformanceCounterDisabled, - e.EndPerformanceCounter = e._EndPerformanceCounterDisabled, + i || (i = c(e)); + } + return i ? (null != n ? n + "." : "") + i : null; + }), + (e.DelayAsync = function (e) { + return new i(function (t) { + setTimeout(function () { + t(); + }, e); + }); + }), + (e.GetCurrentGradient = function (e, t, i) { + for (var n = 0; n < t.length - 1; n++) { + var r = t[n], + o = t[n + 1]; + if (e >= r.gradient && e <= o.gradient) + return void i( + r, + o, + (e - r.gradient) / (o.gradient - r.gradient) + ); + } + var a = t.length - 1; + i(t[a], t[a], 1); + }), + (e.BaseUrl = ""), + (e.UseCustomRequestHeaders = false), + (e.CustomRequestHeaders = _.a.CustomRequestHeaders), + (e.DefaultRetryStrategy = T.ExponentialBackoff()), + (e.CorsBehavior = "anonymous"), + (e.UseFallbackTexture = true), + (e.RegisteredExternalClasses = {}), + (e.fallbackTexture = + "data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z"), + (e._tmpFloatArray = new Float32Array(1)), + (e.GetDOMTextContent = h.a.GetDOMTextContent), + (e.PreprocessUrl = function (e) { + return e; + }), + (e.NoneLogLevel = f.a.NoneLogLevel), + (e.MessageLogLevel = f.a.MessageLogLevel), + (e.WarningLogLevel = f.a.WarningLogLevel), + (e.ErrorLogLevel = f.a.ErrorLogLevel), + (e.AllLogLevel = f.a.AllLogLevel), + (e.IsWindowObjectExist = h.a.IsWindowObjectExist), + (e.PerformanceNoneLogLevel = 0), + (e.PerformanceUserMarkLogLevel = 1), + (e.PerformanceConsoleLogLevel = 2), + (e.StartPerformanceCounter = + e._StartPerformanceCounterDisabled), + (e.EndPerformanceCounter = + e._EndPerformanceCounterDisabled), e - }() - , x = function() { - function e() { - this._startMonitoringTime = 0, - this._min = 0, - this._max = 0, - this._average = 0, - this._lastSecAverage = 0, - this._current = 0, - this._totalValueCount = 0, - this._totalAccumulated = 0, - this._lastSecAccumulated = 0, - this._lastSecTime = 0, - this._lastSecValueCount = 0 - } - return Object.defineProperty(e.prototype, "min", { - get: function() { - return this._min - }, - enumerable: true, - configurable: true + ); + })(), + x = (function () { + function e() { + (this._startMonitoringTime = 0), + (this._min = 0), + (this._max = 0), + (this._average = 0), + (this._lastSecAverage = 0), + (this._current = 0), + (this._totalValueCount = 0), + (this._totalAccumulated = 0), + (this._lastSecAccumulated = 0), + (this._lastSecTime = 0), + (this._lastSecValueCount = 0); + } + return ( + Object.defineProperty(e.prototype, "min", { + get: function () { + return this._min; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "max", { - get: function() { - return this._max - }, - enumerable: true, - configurable: true + get: function () { + return this._max; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "average", { - get: function() { - return this._average - }, - enumerable: true, - configurable: true + get: function () { + return this._average; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "lastSecAverage", { - get: function() { - return this._lastSecAverage - }, - enumerable: true, - configurable: true + get: function () { + return this._lastSecAverage; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "current", { - get: function() { - return this._current - }, - enumerable: true, - configurable: true + get: function () { + return this._current; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "total", { - get: function() { - return this._totalAccumulated - }, - enumerable: true, - configurable: true + get: function () { + return this._totalAccumulated; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "count", { - get: function() { - return this._totalValueCount - }, - enumerable: true, - configurable: true + get: function () { + return this._totalValueCount; + }, + enumerable: true, + configurable: true, }), - e.prototype.fetchNewFrame = function() { - this._totalValueCount++, - this._current = 0, - this._lastSecValueCount++ - } - , - e.prototype.addCount = function(t, i) { - e.Enabled && (this._current += t, - i && this._fetchResult()) - } - , - e.prototype.beginMonitoring = function() { - e.Enabled && (this._startMonitoringTime = m.a.Now) - } - , - e.prototype.endMonitoring = function(t) { - if (void 0 === t && (t = true), - e.Enabled) { - t && this.fetchNewFrame(); - var i = m.a.Now; - this._current = i - this._startMonitoringTime, - t && this._fetchResult() - } - } - , - e.prototype._fetchResult = function() { - this._totalAccumulated += this._current, - this._lastSecAccumulated += this._current, - this._min = Math.min(this._min, this._current), - this._max = Math.max(this._max, this._current), - this._average = this._totalAccumulated / this._totalValueCount; - var e = m.a.Now; - e - this._lastSecTime > 1e3 && (this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount, - this._lastSecTime = e, - this._lastSecAccumulated = 0, - this._lastSecValueCount = 0) - } - , - e.Enabled = true, + (e.prototype.fetchNewFrame = function () { + this._totalValueCount++, + (this._current = 0), + this._lastSecValueCount++; + }), + (e.prototype.addCount = function (t, i) { + e.Enabled && + ((this._current += t), i && this._fetchResult()); + }), + (e.prototype.beginMonitoring = function () { + e.Enabled && (this._startMonitoringTime = m.a.Now); + }), + (e.prototype.endMonitoring = function (t) { + if ((void 0 === t && (t = true), e.Enabled)) { + t && this.fetchNewFrame(); + var i = m.a.Now; + (this._current = i - this._startMonitoringTime), + t && this._fetchResult(); + } + }), + (e.prototype._fetchResult = function () { + (this._totalAccumulated += this._current), + (this._lastSecAccumulated += this._current), + (this._min = Math.min(this._min, this._current)), + (this._max = Math.max(this._max, this._current)), + (this._average = + this._totalAccumulated / this._totalValueCount); + var e = m.a.Now; + e - this._lastSecTime > 1e3 && + ((this._lastSecAverage = + this._lastSecAccumulated / this._lastSecValueCount), + (this._lastSecTime = e), + (this._lastSecAccumulated = 0), + (this._lastSecValueCount = 0)); + }), + (e.Enabled = true), e - }(); - function S(e, t) { - return function(i) { - i.__bjsclassName__ = e, - i.__bjsmoduleName__ = null != t ? t : null - } + ); + })(); + function S(e, t) { + return function (i) { + (i.__bjsclassName__ = e), + (i.__bjsmoduleName__ = null != t ? t : null); + }; + } + var C = (function () { + function e(e, t, i, n) { + void 0 === n && (n = 0), + (this.iterations = e), + (this.index = n - 1), + (this._done = false), + (this._fn = t), + (this._successCallback = i); } - var C = function() { - function e(e, t, i, n) { - void 0 === n && (n = 0), - this.iterations = e, - this.index = n - 1, - this._done = false, - this._fn = t, - this._successCallback = i - } - return e.prototype.executeNext = function() { - this._done || (this.index + 1 < this.iterations ? (++this.index, - this._fn(this)) : this.breakLoop()) - } - , - e.prototype.breakLoop = function() { - this._done = true, - this._successCallback() - } - , - e.Run = function(t, i, n, r) { - void 0 === r && (r = 0); - var o = new e(t,i,n,r); - return o.executeNext(), - o - } - , - e.SyncAsyncForLoop = function(t, i, n, r, o, a) { - return void 0 === a && (a = 0), - e.Run(Math.ceil(t / i), function(e) { - o && o() ? e.breakLoop() : setTimeout(function() { + return ( + (e.prototype.executeNext = function () { + this._done || + (this.index + 1 < this.iterations + ? (++this.index, this._fn(this)) + : this.breakLoop()); + }), + (e.prototype.breakLoop = function () { + (this._done = true), this._successCallback(); + }), + (e.Run = function (t, i, n, r) { + void 0 === r && (r = 0); + var o = new e(t, i, n, r); + return o.executeNext(), o; + }), + (e.SyncAsyncForLoop = function (t, i, n, r, o, a) { + return ( + void 0 === a && (a = 0), + e.Run( + Math.ceil(t / i), + function (e) { + o && o() + ? e.breakLoop() + : setTimeout(function () { for (var r = 0; r < i; ++r) { - var a = e.index * i + r; - if (a >= t) - break; - if (n(a), - o && o()) { - e.breakLoop(); - break - } + var a = e.index * i + r; + if (a >= t) break; + if ((n(a), o && o())) { + e.breakLoop(); + break; + } } - e.executeNext() - }, a) - }, r) - } - , - e - }() - } - , function(e, t, n) { - "use strict"; - n.d(t, "d", function() { - return C - }), - n.d(t, "a", function() { - return P - }), - n.d(t, "c", function() { - return R - }), - n.d(t, "b", function() { - return M - }); - var r = n(1) - , o = n(8) - , a = n(105) - , s = n(61) - , u = n(106) - , l = n(9) - , h = n(0) - , f = n(12) - , d = n(5) - , p = n(20) - , m = n(26) - , g = n(94) - , _ = n(3) - , v = n(35) - , y = n(6) - , b = n(23) - , E = n(92) - , T = n(19) - , A = n(107) - , x = n(73) - , S = function() {} - , C = function() {} - , P = function() {} - , R = function() {} - , M = function() { - function e(t, i, n, r) { - var s = this; - void 0 === r && (r = false), - this.forcePOTTextures = false, - this.isFullscreen = false, - this.isPointerLock = false, - this.cullBackFaces = true, - this.renderEvenInBackground = true, - this.preventCacheWipeBetweenFrames = false, - this.enableOfflineSupport = false, - this.disableManifestCheck = false, - this.scenes = new Array, - this.onNewSceneAddedObservable = new o.c, - this.postProcesses = new Array, - this.validateShaderPrograms = false, - this.onResizeObservable = new o.c, - this.onCanvasBlurObservable = new o.c, - this.onCanvasFocusObservable = new o.c, - this.onCanvasPointerOutObservable = new o.c, - this.onBeforeTextureInitObservable = new o.c, - this.disableUniformBuffers = false, - this._uniformBuffers = new Array, - this.onBeginFrameObservable = new o.c, - this.customAnimationFrameRequester = null, - this.onEndFrameObservable = new o.c, - this.onBeforeShaderCompilationObservable = new o.c, - this.onAfterShaderCompilationObservable = new o.c, - this._windowIsBackground = false, - this._webGLVersion = 1, - this._highPrecisionShadersAllowed = true, - this._badOS = false, - this._badDesktopOS = false, - this._colorWrite = true, - this._drawCalls = new l.f, - this._renderingQueueLaunched = false, - this._activeRenderLoops = new Array, - this._deterministicLockstep = false, - this._lockstepMaxSteps = 4, - this.onContextLostObservable = new o.c, - this.onContextRestoredObservable = new o.c, - this._contextWasLost = false, - this._doNotHandleContextLost = false, - this._performanceMonitor = new a.a, - this._fps = 60, - this._deltaTime = 0, - this.disablePerformanceMonitorInBackground = false, - this.disableVertexArrayObjects = false, - this._depthCullingState = new g.b, - this._stencilState = new g.c, - this._alphaState = new g.a, - this._alphaMode = e.ALPHA_DISABLE, - this._internalTexturesCache = new Array, - this._activeChannel = 0, - this._currentTextureChannel = -1, - this._boundTexturesCache = {}, - this._compiledEffects = {}, - this._vertexAttribArraysEnabled = [], - this._uintIndicesCurrentlySet = false, - this._currentBoundBuffer = new Array, - this._currentFramebuffer = null, - this._currentBufferPointers = new Array, - this._currentInstanceLocations = new Array, - this._currentInstanceBuffers = new Array, - this._vaoRecordInProgress = false, - this._mustWipeVertexAttributes = false, - this._nextFreeTextureSlots = new Array, - this._maxSimultaneousTextures = 0, - this._activeRequests = new Array, - this._texturesSupported = new Array, - this.premultipliedAlpha = true, - this._viewportCached = new h.y(0,0,0,0), - this._unpackFlipYCached = null, - this.enableUnpackFlipYCached = true, - this._boundUniforms = {}, - u.a.Apply(); - var c = null; - if (e.Instances.push(this), - t) { - if (n = n || {}, - t.getContext) { - if (c = t, - this._renderingCanvas = c, - null != i && (n.antialias = i), - void 0 === n.deterministicLockstep && (n.deterministicLockstep = false), - void 0 === n.lockstepMaxSteps && (n.lockstepMaxSteps = 4), - void 0 === n.preserveDrawingBuffer && (n.preserveDrawingBuffer = false), - void 0 === n.audioEngine && (n.audioEngine = true), - void 0 === n.stencil && (n.stencil = true), - false === n.premultipliedAlpha && (this.premultipliedAlpha = false), - this._deterministicLockstep = n.deterministicLockstep, - this._lockstepMaxSteps = n.lockstepMaxSteps, - this._doNotHandleContextLost = !!n.doNotHandleContextLost, - navigator && navigator.userAgent) - for (var f = navigator.userAgent, d = 0, p = e.ExceptionList; d < p.length; d++) { - var m = p[d] - , _ = m.key - , b = m.targets; - if (new RegExp(_).test(f)) { - if (m.capture && m.captureConstraint) { - var E = m.capture - , T = m.captureConstraint - , A = new RegExp(E).exec(f); - if (A && A.length > 0 && parseInt(A[A.length - 1]) >= T) - continue - } - for (var x = 0, C = b; x < C.length; x++) - switch (C[x]) { - case "uniformBuffer": - this.disableUniformBuffers = true; - break; - case "vao": - this.disableVertexArrayObjects = true - } - } - } - if (!n.disableWebGL2Support) - try { - this._gl = c.getContext("webgl2", n) || c.getContext("experimental-webgl2", n), - this._gl && (this._webGLVersion = 2, - this._gl.deleteQuery || (this._webGLVersion = 1)) - } catch (e) {} - if (!this._gl) { - if (!c) - throw new Error("The provided canvas is null or undefined."); - try { - this._gl = c.getContext("webgl", n) || c.getContext("experimental-webgl", n) - } catch (e) { - throw new Error("WebGL not supported") - } - } - if (!this._gl) - throw new Error("WebGL not supported"); - this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE), - this._onCanvasFocus = function() { - s.onCanvasFocusObservable.notifyObservers(s) - } - , - this._onCanvasBlur = function() { - s.onCanvasBlurObservable.notifyObservers(s) - } - , - c.addEventListener("focus", this._onCanvasFocus), - c.addEventListener("blur", this._onCanvasBlur), - this._onBlur = function() { - s.disablePerformanceMonitorInBackground && s._performanceMonitor.disable(), - s._windowIsBackground = true - } - , - this._onFocus = function() { - s.disablePerformanceMonitorInBackground && s._performanceMonitor.enable(), - s._windowIsBackground = false - } - , - this._onCanvasPointerOut = function(e) { - s.onCanvasPointerOutObservable.notifyObservers(e) - } - , - v.a.IsWindowObjectExist() && (window.addEventListener("blur", this._onBlur), - window.addEventListener("focus", this._onFocus)), - c.addEventListener("pointerout", this._onCanvasPointerOut), - this._doNotHandleContextLost || (this._onContextLost = function(e) { - e.preventDefault(), - s._contextWasLost = true, - y.a.Warn("WebGL context lost."), - s.onContextLostObservable.notifyObservers(s) - } - , - this._onContextRestored = function() { - setTimeout(function() { - s._initGLContext(), - s._rebuildEffects(), - s._rebuildInternalTextures(), - s._rebuildBuffers(), - s.wipeCaches(true), - y.a.Warn("WebGL context successfully restored."), - s.onContextRestoredObservable.notifyObservers(s), - s._contextWasLost = false - }, 0) - } - , - c.addEventListener("webglcontextlost", this._onContextLost, false), - c.addEventListener("webglcontextrestored", this._onContextRestored, false)), - n.doNotHandleTouchAction || this._disableTouchAction() - } else { - this._gl = t, - this._renderingCanvas = this._gl.canvas, - this._gl.renderbufferStorageMultisample && (this._webGLVersion = 2); - var P = this._gl.getContextAttributes(); - P && (n.stencil = P.stencil) - } - void 0 !== n.useHighPrecisionFloats && (this._highPrecisionShadersAllowed = n.useHighPrecisionFloats); - var R = v.a.IsWindowObjectExist() && window.devicePixelRatio || 1 - , M = n.limitDeviceRatio || R; - if (this._hardwareScalingLevel = r ? 1 / Math.min(M, R) : 1, - this.resize(), - this._isStencilEnable = !!n.stencil, - this._initGLContext(), - c) { - var O = document; - this._onFullscreenChange = function() { - void 0 !== O.fullscreen ? s.isFullscreen = O.fullscreen : void 0 !== O.mozFullScreen ? s.isFullscreen = O.mozFullScreen : void 0 !== O.webkitIsFullScreen ? s.isFullscreen = O.webkitIsFullScreen : void 0 !== O.msIsFullScreen && (s.isFullscreen = O.msIsFullScreen), - s.isFullscreen && s._pointerLockRequested && c && (c.requestPointerLock = c.requestPointerLock || c.msRequestPointerLock || c.mozRequestPointerLock || c.webkitRequestPointerLock, - c.requestPointerLock && c.requestPointerLock()) - } - , - document.addEventListener("fullscreenchange", this._onFullscreenChange, false), - document.addEventListener("mozfullscreenchange", this._onFullscreenChange, false), - document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, false), - document.addEventListener("msfullscreenchange", this._onFullscreenChange, false), - this._onPointerLockChange = function() { - s.isPointerLock = O.mozPointerLockElement === c || O.webkitPointerLockElement === c || O.msPointerLockElement === c || O.pointerLockElement === c - } - , - document.addEventListener("pointerlockchange", this._onPointerLockChange, false), - document.addEventListener("mspointerlockchange", this._onPointerLockChange, false), - document.addEventListener("mozpointerlockchange", this._onPointerLockChange, false), - document.addEventListener("webkitpointerlockchange", this._onPointerLockChange, false), - this._connectVREvents(c, O) - } - !e.audioEngine && n.audioEngine && e.AudioEngineFactory && (e.audioEngine = e.AudioEngineFactory(this.getRenderingCanvas())); - for (var w = 0; w < this._caps.maxVertexAttribs; w++) - this._currentBufferPointers[w] = new S; - this._prepareVRComponent(), - n.autoEnableWebVR && this.initWebVR(), - this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent), - this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), - console.log("Babylon.js v" + e.Version + " - " + this.description), - this.enableOfflineSupport = void 0 !== e.OfflineProviderFactory - } - } - return Object.defineProperty(e, "Instances", { - get: function() { - return b.a.Instances + e.executeNext(); + }, a); }, - enumerable: true, - configurable: true + r + ) + ); + }), + e + ); + })(); + }, + function (e, t, n) { + "use strict"; + n.d(t, "d", function () { + return C; + }), + n.d(t, "a", function () { + return P; + }), + n.d(t, "c", function () { + return R; + }), + n.d(t, "b", function () { + return M; + }); + var r = n(1), + o = n(8), + a = n(105), + s = n(61), + u = n(106), + l = n(9), + h = n(0), + f = n(12), + d = n(5), + p = n(20), + m = n(26), + g = n(94), + _ = n(3), + v = n(35), + y = n(6), + b = n(23), + E = n(92), + T = n(19), + A = n(107), + x = n(73), + S = function () {}, + C = function () {}, + P = function () {}, + R = function () {}, + M = (function () { + function e(t, i, n, r) { + var s = this; + void 0 === r && (r = false), + (this.forcePOTTextures = false), + (this.isFullscreen = false), + (this.isPointerLock = false), + (this.cullBackFaces = true), + (this.renderEvenInBackground = true), + (this.preventCacheWipeBetweenFrames = false), + (this.enableOfflineSupport = false), + (this.disableManifestCheck = false), + (this.scenes = new Array()), + (this.onNewSceneAddedObservable = new o.c()), + (this.postProcesses = new Array()), + (this.validateShaderPrograms = false), + (this.onResizeObservable = new o.c()), + (this.onCanvasBlurObservable = new o.c()), + (this.onCanvasFocusObservable = new o.c()), + (this.onCanvasPointerOutObservable = new o.c()), + (this.onBeforeTextureInitObservable = new o.c()), + (this.disableUniformBuffers = false), + (this._uniformBuffers = new Array()), + (this.onBeginFrameObservable = new o.c()), + (this.customAnimationFrameRequester = null), + (this.onEndFrameObservable = new o.c()), + (this.onBeforeShaderCompilationObservable = new o.c()), + (this.onAfterShaderCompilationObservable = new o.c()), + (this._windowIsBackground = false), + (this._webGLVersion = 1), + (this._highPrecisionShadersAllowed = true), + (this._badOS = false), + (this._badDesktopOS = false), + (this._colorWrite = true), + (this._drawCalls = new l.f()), + (this._renderingQueueLaunched = false), + (this._activeRenderLoops = new Array()), + (this._deterministicLockstep = false), + (this._lockstepMaxSteps = 4), + (this.onContextLostObservable = new o.c()), + (this.onContextRestoredObservable = new o.c()), + (this._contextWasLost = false), + (this._doNotHandleContextLost = false), + (this._performanceMonitor = new a.a()), + (this._fps = 60), + (this._deltaTime = 0), + (this.disablePerformanceMonitorInBackground = false), + (this.disableVertexArrayObjects = false), + (this._depthCullingState = new g.b()), + (this._stencilState = new g.c()), + (this._alphaState = new g.a()), + (this._alphaMode = e.ALPHA_DISABLE), + (this._internalTexturesCache = new Array()), + (this._activeChannel = 0), + (this._currentTextureChannel = -1), + (this._boundTexturesCache = {}), + (this._compiledEffects = {}), + (this._vertexAttribArraysEnabled = []), + (this._uintIndicesCurrentlySet = false), + (this._currentBoundBuffer = new Array()), + (this._currentFramebuffer = null), + (this._currentBufferPointers = new Array()), + (this._currentInstanceLocations = new Array()), + (this._currentInstanceBuffers = new Array()), + (this._vaoRecordInProgress = false), + (this._mustWipeVertexAttributes = false), + (this._nextFreeTextureSlots = new Array()), + (this._maxSimultaneousTextures = 0), + (this._activeRequests = new Array()), + (this._texturesSupported = new Array()), + (this.premultipliedAlpha = true), + (this._viewportCached = new h.y(0, 0, 0, 0)), + (this._unpackFlipYCached = null), + (this.enableUnpackFlipYCached = true), + (this._boundUniforms = {}), + u.a.Apply(); + var c = null; + if ((e.Instances.push(this), t)) { + if (((n = n || {}), t.getContext)) { + if ( + ((c = t), + (this._renderingCanvas = c), + null != i && (n.antialias = i), + void 0 === n.deterministicLockstep && + (n.deterministicLockstep = false), + void 0 === n.lockstepMaxSteps && + (n.lockstepMaxSteps = 4), + void 0 === n.preserveDrawingBuffer && + (n.preserveDrawingBuffer = false), + void 0 === n.audioEngine && (n.audioEngine = true), + void 0 === n.stencil && (n.stencil = true), + false === n.premultipliedAlpha && + (this.premultipliedAlpha = false), + (this._deterministicLockstep = + n.deterministicLockstep), + (this._lockstepMaxSteps = n.lockstepMaxSteps), + (this._doNotHandleContextLost = + !!n.doNotHandleContextLost), + navigator && navigator.userAgent) + ) + for ( + var f = navigator.userAgent, + d = 0, + p = e.ExceptionList; + d < p.length; + d++ + ) { + var m = p[d], + _ = m.key, + b = m.targets; + if (new RegExp(_).test(f)) { + if (m.capture && m.captureConstraint) { + var E = m.capture, + T = m.captureConstraint, + A = new RegExp(E).exec(f); + if ( + A && + A.length > 0 && + parseInt(A[A.length - 1]) >= T + ) + continue; + } + for (var x = 0, C = b; x < C.length; x++) + switch (C[x]) { + case "uniformBuffer": + this.disableUniformBuffers = true; + break; + case "vao": + this.disableVertexArrayObjects = true; + } + } + } + if (!n.disableWebGL2Support) + try { + (this._gl = + c.getContext("webgl2", n) || + c.getContext("experimental-webgl2", n)), + this._gl && + ((this._webGLVersion = 2), + this._gl.deleteQuery || + (this._webGLVersion = 1)); + } catch (e) {} + if (!this._gl) { + if (!c) + throw new Error( + "The provided canvas is null or undefined." + ); + try { + this._gl = + c.getContext("webgl", n) || + c.getContext("experimental-webgl", n); + } catch (e) { + throw new Error("WebGL not supported"); + } + } + if (!this._gl) throw new Error("WebGL not supported"); + this._gl.pixelStorei( + this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, + this._gl.NONE + ), + (this._onCanvasFocus = function () { + s.onCanvasFocusObservable.notifyObservers(s); + }), + (this._onCanvasBlur = function () { + s.onCanvasBlurObservable.notifyObservers(s); + }), + c.addEventListener("focus", this._onCanvasFocus), + c.addEventListener("blur", this._onCanvasBlur), + (this._onBlur = function () { + s.disablePerformanceMonitorInBackground && + s._performanceMonitor.disable(), + (s._windowIsBackground = true); + }), + (this._onFocus = function () { + s.disablePerformanceMonitorInBackground && + s._performanceMonitor.enable(), + (s._windowIsBackground = false); + }), + (this._onCanvasPointerOut = function (e) { + s.onCanvasPointerOutObservable.notifyObservers(e); + }), + v.a.IsWindowObjectExist() && + (window.addEventListener("blur", this._onBlur), + window.addEventListener("focus", this._onFocus)), + c.addEventListener( + "pointerout", + this._onCanvasPointerOut + ), + this._doNotHandleContextLost || + ((this._onContextLost = function (e) { + e.preventDefault(), + (s._contextWasLost = true), + y.a.Warn("WebGL context lost."), + s.onContextLostObservable.notifyObservers(s); + }), + (this._onContextRestored = function () { + setTimeout(function () { + s._initGLContext(), + s._rebuildEffects(), + s._rebuildInternalTextures(), + s._rebuildBuffers(), + s.wipeCaches(true), + y.a.Warn( + "WebGL context successfully restored." + ), + s.onContextRestoredObservable.notifyObservers( + s + ), + (s._contextWasLost = false); + }, 0); + }), + c.addEventListener( + "webglcontextlost", + this._onContextLost, + false + ), + c.addEventListener( + "webglcontextrestored", + this._onContextRestored, + false + )), + n.doNotHandleTouchAction || + this._disableTouchAction(); + } else { + (this._gl = t), + (this._renderingCanvas = this._gl.canvas), + this._gl.renderbufferStorageMultisample && + (this._webGLVersion = 2); + var P = this._gl.getContextAttributes(); + P && (n.stencil = P.stencil); + } + void 0 !== n.useHighPrecisionFloats && + (this._highPrecisionShadersAllowed = + n.useHighPrecisionFloats); + var R = + (v.a.IsWindowObjectExist() && + window.devicePixelRatio) || + 1, + M = n.limitDeviceRatio || R; + if ( + ((this._hardwareScalingLevel = r + ? 1 / Math.min(M, R) + : 1), + this.resize(), + (this._isStencilEnable = !!n.stencil), + this._initGLContext(), + c) + ) { + var O = document; + (this._onFullscreenChange = function () { + void 0 !== O.fullscreen + ? (s.isFullscreen = O.fullscreen) + : void 0 !== O.mozFullScreen + ? (s.isFullscreen = O.mozFullScreen) + : void 0 !== O.webkitIsFullScreen + ? (s.isFullscreen = O.webkitIsFullScreen) + : void 0 !== O.msIsFullScreen && + (s.isFullscreen = O.msIsFullScreen), + s.isFullscreen && + s._pointerLockRequested && + c && + ((c.requestPointerLock = + c.requestPointerLock || + c.msRequestPointerLock || + c.mozRequestPointerLock || + c.webkitRequestPointerLock), + c.requestPointerLock && c.requestPointerLock()); + }), + document.addEventListener( + "fullscreenchange", + this._onFullscreenChange, + false + ), + document.addEventListener( + "mozfullscreenchange", + this._onFullscreenChange, + false + ), + document.addEventListener( + "webkitfullscreenchange", + this._onFullscreenChange, + false + ), + document.addEventListener( + "msfullscreenchange", + this._onFullscreenChange, + false + ), + (this._onPointerLockChange = function () { + s.isPointerLock = + O.mozPointerLockElement === c || + O.webkitPointerLockElement === c || + O.msPointerLockElement === c || + O.pointerLockElement === c; + }), + document.addEventListener( + "pointerlockchange", + this._onPointerLockChange, + false + ), + document.addEventListener( + "mspointerlockchange", + this._onPointerLockChange, + false + ), + document.addEventListener( + "mozpointerlockchange", + this._onPointerLockChange, + false + ), + document.addEventListener( + "webkitpointerlockchange", + this._onPointerLockChange, + false + ), + this._connectVREvents(c, O); + } + !e.audioEngine && + n.audioEngine && + e.AudioEngineFactory && + (e.audioEngine = e.AudioEngineFactory( + this.getRenderingCanvas() + )); + for (var w = 0; w < this._caps.maxVertexAttribs; w++) + this._currentBufferPointers[w] = new S(); + this._prepareVRComponent(), + n.autoEnableWebVR && this.initWebVR(), + (this._badOS = + /iPad/i.test(navigator.userAgent) || + /iPhone/i.test(navigator.userAgent)), + (this._badDesktopOS = + /^((?!chrome|android).)*safari/i.test( + navigator.userAgent + )), + console.log( + "Babylon.js v" + e.Version + " - " + this.description + ), + (this.enableOfflineSupport = + void 0 !== e.OfflineProviderFactory); + } + } + return ( + Object.defineProperty(e, "Instances", { + get: function () { + return b.a.Instances; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "LastCreatedEngine", { - get: function() { - return b.a.LastCreatedEngine - }, - enumerable: true, - configurable: true + get: function () { + return b.a.LastCreatedEngine; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "LastCreatedScene", { - get: function() { - return b.a.LastCreatedScene - }, - enumerable: true, - configurable: true + get: function () { + return b.a.LastCreatedScene; + }, + enumerable: true, + configurable: true, + }), + (e.MarkAllMaterialsAsDirty = function (t, i) { + for (var n = 0; n < e.Instances.length; n++) + for ( + var r = e.Instances[n], o = 0; + o < r.scenes.length; + o++ + ) + r.scenes[o].markAllMaterialsAsDirty(t, i); }), - e.MarkAllMaterialsAsDirty = function(t, i) { - for (var n = 0; n < e.Instances.length; n++) - for (var r = e.Instances[n], o = 0; o < r.scenes.length; o++) - r.scenes[o].markAllMaterialsAsDirty(t, i) - } - , Object.defineProperty(e, "NpmPackage", { - get: function() { - return "babylonjs@4.0.3" - }, - enumerable: true, - configurable: true + get: function () { + return "babylonjs@4.0.3"; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "Version", { - get: function() { - return "4.0.3" - }, - enumerable: true, - configurable: true + get: function () { + return "4.0.3"; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "description", { - get: function() { - var e = "WebGL" + this.webGLVersion; - return this._caps.parallelShaderCompile && (e += " - Parallel shader compilation"), - e - }, - enumerable: true, - configurable: true + get: function () { + var e = "WebGL" + this.webGLVersion; + return ( + this._caps.parallelShaderCompile && + (e += " - Parallel shader compilation"), + e + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ShadersRepository", { - get: function() { - return d.a.ShadersRepository - }, - set: function(e) { - d.a.ShadersRepository = e + get: function () { + return d.a.ShadersRepository; + }, + set: function (e) { + d.a.ShadersRepository = e; + }, + enumerable: true, + configurable: true, + }), + (e.DefaultLoadingScreenFactory = function (e) { + throw T.a.WarnImport("LoadingScreen"); + }), + Object.defineProperty( + e.prototype, + "supportsUniformBuffers", + { + get: function () { + return ( + this.webGLVersion > 1 && !this.disableUniformBuffers + ); }, enumerable: true, - configurable: true - }), - e.DefaultLoadingScreenFactory = function(e) { - throw T.a.WarnImport("LoadingScreen") - } - , - Object.defineProperty(e.prototype, "supportsUniformBuffers", { - get: function() { - return this.webGLVersion > 1 && !this.disableUniformBuffers + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "_shouldUseHighPrecisionShader", + { + get: function () { + return ( + this._caps.highPrecisionShaderSupported && + this._highPrecisionShadersAllowed + ); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "_shouldUseHighPrecisionShader", { - get: function() { - return this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "needPOTTextures", { - get: function() { - return this._webGLVersion < 2 || this.forcePOTTextures + get: function () { + return this._webGLVersion < 2 || this.forcePOTTextures; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "doNotHandleContextLost", + { + get: function () { + return this._doNotHandleContextLost; + }, + set: function (e) { + this._doNotHandleContextLost = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "doNotHandleContextLost", { - get: function() { - return this._doNotHandleContextLost - }, - set: function(e) { - this._doNotHandleContextLost = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "performanceMonitor", { - get: function() { - return this._performanceMonitor - }, - enumerable: true, - configurable: true + get: function () { + return this._performanceMonitor; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "texturesSupported", { - get: function() { - return this._texturesSupported - }, - enumerable: true, - configurable: true + get: function () { + return this._texturesSupported; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "textureFormatInUse", { - get: function() { - return this._textureFormatInUse - }, - enumerable: true, - configurable: true + get: function () { + return this._textureFormatInUse; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "currentViewport", { - get: function() { - return this._cachedViewport - }, - enumerable: true, - configurable: true + get: function () { + return this._cachedViewport; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "emptyTexture", { - get: function() { - return this._emptyTexture || (this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, e.TEXTUREFORMAT_RGBA, false, false, e.TEXTURE_NEAREST_SAMPLINGMODE)), - this._emptyTexture - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._emptyTexture || + (this._emptyTexture = this.createRawTexture( + new Uint8Array(4), + 1, + 1, + e.TEXTUREFORMAT_RGBA, + false, + false, + e.TEXTURE_NEAREST_SAMPLINGMODE + )), + this._emptyTexture + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "emptyTexture3D", { - get: function() { - return this._emptyTexture3D || (this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, e.TEXTUREFORMAT_RGBA, false, false, e.TEXTURE_NEAREST_SAMPLINGMODE)), - this._emptyTexture3D - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._emptyTexture3D || + (this._emptyTexture3D = this.createRawTexture3D( + new Uint8Array(4), + 1, + 1, + 1, + e.TEXTUREFORMAT_RGBA, + false, + false, + e.TEXTURE_NEAREST_SAMPLINGMODE + )), + this._emptyTexture3D + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "emptyCubeTexture", { - get: function() { - if (!this._emptyCubeTexture) { - var t = new Uint8Array(4) - , i = [t, t, t, t, t, t]; - this._emptyCubeTexture = this.createRawCubeTexture(i, 1, e.TEXTUREFORMAT_RGBA, e.TEXTURETYPE_UNSIGNED_INT, false, false, e.TEXTURE_NEAREST_SAMPLINGMODE) - } - return this._emptyCubeTexture - }, - enumerable: true, - configurable: true + get: function () { + if (!this._emptyCubeTexture) { + var t = new Uint8Array(4), + i = [t, t, t, t, t, t]; + this._emptyCubeTexture = this.createRawCubeTexture( + i, + 1, + e.TEXTUREFORMAT_RGBA, + e.TEXTURETYPE_UNSIGNED_INT, + false, + false, + e.TEXTURE_NEAREST_SAMPLINGMODE + ); + } + return this._emptyCubeTexture; + }, + enumerable: true, + configurable: true, }), - e.prototype.initWebVR = function() { - throw T.a.WarnImport("WebVRCamera") - } - , - e.prototype._prepareVRComponent = function() {} - , - e.prototype._connectVREvents = function(e, t) {} - , - e.prototype._submitVRFrame = function() {} - , - e.prototype.disableVR = function() {} - , - e.prototype.isVRPresenting = function() { - return false - } - , - e.prototype._requestVRFrame = function() {} - , - e.prototype._disableTouchAction = function() { - this._renderingCanvas && (this._renderingCanvas.setAttribute("touch-action", "none"), - this._renderingCanvas.style.touchAction = "none", - this._renderingCanvas.style.msTouchAction = "none") - } - , - e.prototype._rebuildInternalTextures = function() { - for (var e = 0, t = this._internalTexturesCache.slice(); e < t.length; e++) - t[e]._rebuild() - } - , - e.prototype._rebuildEffects = function() { - for (var e in this._compiledEffects) - this._compiledEffects[e]._prepareEffect(); - d.a.ResetCache() - } - , - e.prototype.areAllEffectsReady = function() { - for (var e in this._compiledEffects) - if (!this._compiledEffects[e].isReady()) - return false; - return true - } - , - e.prototype._rebuildBuffers = function() { - for (var e = 0, t = this.scenes; e < t.length; e++) { - var i = t[e]; - i.resetCachedMaterial(), - i._rebuildGeometries(), - i._rebuildTextures() - } - for (var n = 0, r = this._uniformBuffers; n < r.length; n++) - r[n]._rebuild() - } - , - e.prototype._initGLContext = function() { - this._caps = new R, - this._caps.maxTexturesImageUnits = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS), - this._caps.maxCombinedTexturesImageUnits = this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS), - this._caps.maxVertexTextureImageUnits = this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS), - this._caps.maxTextureSize = this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE), - this._caps.maxCubemapTextureSize = this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE), - this._caps.maxRenderTextureSize = this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE), - this._caps.maxVertexAttribs = this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS), - this._caps.maxVaryingVectors = this._gl.getParameter(this._gl.MAX_VARYING_VECTORS), - this._caps.maxFragmentUniformVectors = this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS), - this._caps.maxVertexUniformVectors = this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS), - this._glVersion = this._gl.getParameter(this._gl.VERSION); - var e = this._gl.getExtension("WEBGL_debug_renderer_info"); - if (null != e && (this._glRenderer = this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL), - this._glVendor = this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)), + (e.prototype.initWebVR = function () { + throw T.a.WarnImport("WebVRCamera"); + }), + (e.prototype._prepareVRComponent = function () {}), + (e.prototype._connectVREvents = function (e, t) {}), + (e.prototype._submitVRFrame = function () {}), + (e.prototype.disableVR = function () {}), + (e.prototype.isVRPresenting = function () { + return false; + }), + (e.prototype._requestVRFrame = function () {}), + (e.prototype._disableTouchAction = function () { + this._renderingCanvas && + (this._renderingCanvas.setAttribute( + "touch-action", + "none" + ), + (this._renderingCanvas.style.touchAction = "none"), + (this._renderingCanvas.style.msTouchAction = "none")); + }), + (e.prototype._rebuildInternalTextures = function () { + for ( + var e = 0, t = this._internalTexturesCache.slice(); + e < t.length; + e++ + ) + t[e]._rebuild(); + }), + (e.prototype._rebuildEffects = function () { + for (var e in this._compiledEffects) + this._compiledEffects[e]._prepareEffect(); + d.a.ResetCache(); + }), + (e.prototype.areAllEffectsReady = function () { + for (var e in this._compiledEffects) + if (!this._compiledEffects[e].isReady()) return false; + return true; + }), + (e.prototype._rebuildBuffers = function () { + for (var e = 0, t = this.scenes; e < t.length; e++) { + var i = t[e]; + i.resetCachedMaterial(), + i._rebuildGeometries(), + i._rebuildTextures(); + } + for ( + var n = 0, r = this._uniformBuffers; + n < r.length; + n++ + ) + r[n]._rebuild(); + }), + (e.prototype._initGLContext = function () { + (this._caps = new R()), + (this._caps.maxTexturesImageUnits = + this._gl.getParameter( + this._gl.MAX_TEXTURE_IMAGE_UNITS + )), + (this._caps.maxCombinedTexturesImageUnits = + this._gl.getParameter( + this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS + )), + (this._caps.maxVertexTextureImageUnits = + this._gl.getParameter( + this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS + )), + (this._caps.maxTextureSize = this._gl.getParameter( + this._gl.MAX_TEXTURE_SIZE + )), + (this._caps.maxCubemapTextureSize = + this._gl.getParameter( + this._gl.MAX_CUBE_MAP_TEXTURE_SIZE + )), + (this._caps.maxRenderTextureSize = + this._gl.getParameter( + this._gl.MAX_RENDERBUFFER_SIZE + )), + (this._caps.maxVertexAttribs = this._gl.getParameter( + this._gl.MAX_VERTEX_ATTRIBS + )), + (this._caps.maxVaryingVectors = this._gl.getParameter( + this._gl.MAX_VARYING_VECTORS + )), + (this._caps.maxFragmentUniformVectors = + this._gl.getParameter( + this._gl.MAX_FRAGMENT_UNIFORM_VECTORS + )), + (this._caps.maxVertexUniformVectors = + this._gl.getParameter( + this._gl.MAX_VERTEX_UNIFORM_VECTORS + )), + (this._glVersion = this._gl.getParameter( + this._gl.VERSION + )); + var e = this._gl.getExtension( + "WEBGL_debug_renderer_info" + ); + if ( + (null != e && + ((this._glRenderer = this._gl.getParameter( + e.UNMASKED_RENDERER_WEBGL + )), + (this._glVendor = this._gl.getParameter( + e.UNMASKED_VENDOR_WEBGL + ))), this._glVendor || (this._glVendor = "Unknown vendor"), - this._glRenderer || (this._glRenderer = "Unknown renderer"), - this._gl.HALF_FLOAT_OES = 36193, - 34842 !== this._gl.RGBA16F && (this._gl.RGBA16F = 34842), - 34836 !== this._gl.RGBA32F && (this._gl.RGBA32F = 34836), - 35056 !== this._gl.DEPTH24_STENCIL8 && (this._gl.DEPTH24_STENCIL8 = 35056), - this._caps.standardDerivatives = this._webGLVersion > 1 || null !== this._gl.getExtension("OES_standard_derivatives"), - this._caps.astc = this._gl.getExtension("WEBGL_compressed_texture_astc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"), - this._caps.s3tc = this._gl.getExtension("WEBGL_compressed_texture_s3tc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"), - this._caps.pvrtc = this._gl.getExtension("WEBGL_compressed_texture_pvrtc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"), - this._caps.etc1 = this._gl.getExtension("WEBGL_compressed_texture_etc1") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"), - this._caps.etc2 = this._gl.getExtension("WEBGL_compressed_texture_etc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc") || this._gl.getExtension("WEBGL_compressed_texture_es3_0"), - this._caps.textureAnisotropicFilterExtension = this._gl.getExtension("EXT_texture_filter_anisotropic") || this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"), - this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0, - this._caps.uintIndices = this._webGLVersion > 1 || null !== this._gl.getExtension("OES_element_index_uint"), - this._caps.fragmentDepthSupported = this._webGLVersion > 1 || null !== this._gl.getExtension("EXT_frag_depth"), - this._caps.highPrecisionShaderSupported = false, - this._caps.timerQuery = this._gl.getExtension("EXT_disjoint_timer_query_webgl2") || this._gl.getExtension("EXT_disjoint_timer_query"), - this._caps.timerQuery && (1 === this._webGLVersion && (this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)), - this._caps.canUseTimestampForTimerQuery = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT) > 0), - this._caps.colorBufferFloat = this._webGLVersion > 1 && this._gl.getExtension("EXT_color_buffer_float"), - this._caps.textureFloat = !!(this._webGLVersion > 1 || this._gl.getExtension("OES_texture_float")), - this._caps.textureFloatLinearFiltering = !(!this._caps.textureFloat || !this._gl.getExtension("OES_texture_float_linear")), - this._caps.textureFloatRender = !(!this._caps.textureFloat || !this._canRenderToFloatFramebuffer()), - this._caps.textureHalfFloat = !!(this._webGLVersion > 1 || this._gl.getExtension("OES_texture_half_float")), - this._caps.textureHalfFloatLinearFiltering = !!(this._webGLVersion > 1 || this._caps.textureHalfFloat && this._gl.getExtension("OES_texture_half_float_linear")), - this._webGLVersion > 1 && (this._gl.HALF_FLOAT_OES = 5131), - this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer(), - this._caps.textureLOD = !!(this._webGLVersion > 1 || this._gl.getExtension("EXT_shader_texture_lod")), - this._caps.multiview = this._gl.getExtension("OVR_multiview2"), + this._glRenderer || + (this._glRenderer = "Unknown renderer"), + (this._gl.HALF_FLOAT_OES = 36193), + 34842 !== this._gl.RGBA16F && + (this._gl.RGBA16F = 34842), + 34836 !== this._gl.RGBA32F && + (this._gl.RGBA32F = 34836), + 35056 !== this._gl.DEPTH24_STENCIL8 && + (this._gl.DEPTH24_STENCIL8 = 35056), + (this._caps.standardDerivatives = + this._webGLVersion > 1 || + null !== + this._gl.getExtension("OES_standard_derivatives")), + (this._caps.astc = + this._gl.getExtension( + "WEBGL_compressed_texture_astc" + ) || + this._gl.getExtension( + "WEBKIT_WEBGL_compressed_texture_astc" + )), + (this._caps.s3tc = + this._gl.getExtension( + "WEBGL_compressed_texture_s3tc" + ) || + this._gl.getExtension( + "WEBKIT_WEBGL_compressed_texture_s3tc" + )), + (this._caps.pvrtc = + this._gl.getExtension( + "WEBGL_compressed_texture_pvrtc" + ) || + this._gl.getExtension( + "WEBKIT_WEBGL_compressed_texture_pvrtc" + )), + (this._caps.etc1 = + this._gl.getExtension( + "WEBGL_compressed_texture_etc1" + ) || + this._gl.getExtension( + "WEBKIT_WEBGL_compressed_texture_etc1" + )), + (this._caps.etc2 = + this._gl.getExtension( + "WEBGL_compressed_texture_etc" + ) || + this._gl.getExtension( + "WEBKIT_WEBGL_compressed_texture_etc" + ) || + this._gl.getExtension( + "WEBGL_compressed_texture_es3_0" + )), + (this._caps.textureAnisotropicFilterExtension = + this._gl.getExtension( + "EXT_texture_filter_anisotropic" + ) || + this._gl.getExtension( + "WEBKIT_EXT_texture_filter_anisotropic" + ) || + this._gl.getExtension( + "MOZ_EXT_texture_filter_anisotropic" + )), + (this._caps.maxAnisotropy = this._caps + .textureAnisotropicFilterExtension + ? this._gl.getParameter( + this._caps.textureAnisotropicFilterExtension + .MAX_TEXTURE_MAX_ANISOTROPY_EXT + ) + : 0), + (this._caps.uintIndices = + this._webGLVersion > 1 || + null !== + this._gl.getExtension("OES_element_index_uint")), + (this._caps.fragmentDepthSupported = + this._webGLVersion > 1 || + null !== this._gl.getExtension("EXT_frag_depth")), + (this._caps.highPrecisionShaderSupported = false), + (this._caps.timerQuery = + this._gl.getExtension( + "EXT_disjoint_timer_query_webgl2" + ) || + this._gl.getExtension("EXT_disjoint_timer_query")), + this._caps.timerQuery && + (1 === this._webGLVersion && + (this._gl.getQuery = + this._caps.timerQuery.getQueryEXT.bind( + this._caps.timerQuery + )), + (this._caps.canUseTimestampForTimerQuery = + this._gl.getQuery( + this._caps.timerQuery.TIMESTAMP_EXT, + this._caps.timerQuery.QUERY_COUNTER_BITS_EXT + ) > 0)), + (this._caps.colorBufferFloat = + this._webGLVersion > 1 && + this._gl.getExtension("EXT_color_buffer_float")), + (this._caps.textureFloat = !!( + this._webGLVersion > 1 || + this._gl.getExtension("OES_texture_float") + )), + (this._caps.textureFloatLinearFiltering = !( + !this._caps.textureFloat || + !this._gl.getExtension("OES_texture_float_linear") + )), + (this._caps.textureFloatRender = !( + !this._caps.textureFloat || + !this._canRenderToFloatFramebuffer() + )), + (this._caps.textureHalfFloat = !!( + this._webGLVersion > 1 || + this._gl.getExtension("OES_texture_half_float") + )), + (this._caps.textureHalfFloatLinearFiltering = !!( + this._webGLVersion > 1 || + (this._caps.textureHalfFloat && + this._gl.getExtension( + "OES_texture_half_float_linear" + )) + )), + this._webGLVersion > 1 && + (this._gl.HALF_FLOAT_OES = 5131), + (this._caps.textureHalfFloatRender = + this._caps.textureHalfFloat && + this._canRenderToHalfFloatFramebuffer()), + (this._caps.textureLOD = !!( + this._webGLVersion > 1 || + this._gl.getExtension("EXT_shader_texture_lod") + )), + (this._caps.multiview = + this._gl.getExtension("OVR_multiview2")), this._webGLVersion > 1) - this._caps.drawBuffersExtension = true; - else { - var t = this._gl.getExtension("WEBGL_draw_buffers"); - if (null !== t) { - this._caps.drawBuffersExtension = true, - this._gl.drawBuffers = t.drawBuffersWEBGL.bind(t), - this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER; - for (var i = 0; i < 16; i++) - this._gl["COLOR_ATTACHMENT" + i + "_WEBGL"] = t["COLOR_ATTACHMENT" + i + "_WEBGL"] - } else - this._caps.drawBuffersExtension = false - } - if (this._caps.parallelShaderCompile = this._gl.getExtension("KHR_parallel_shader_compile"), + ) + this._caps.drawBuffersExtension = true; + else { + var t = this._gl.getExtension("WEBGL_draw_buffers"); + if (null !== t) { + (this._caps.drawBuffersExtension = true), + (this._gl.drawBuffers = t.drawBuffersWEBGL.bind(t)), + (this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER); + for (var i = 0; i < 16; i++) + this._gl["COLOR_ATTACHMENT" + i + "_WEBGL"] = + t["COLOR_ATTACHMENT" + i + "_WEBGL"]; + } else this._caps.drawBuffersExtension = false; + } + if ( + ((this._caps.parallelShaderCompile = + this._gl.getExtension("KHR_parallel_shader_compile")), this._webGLVersion > 1) - this._caps.depthTextureExtension = true; - else { - var n = this._gl.getExtension("WEBGL_depth_texture"); - null != n && (this._caps.depthTextureExtension = true, - this._gl.UNSIGNED_INT_24_8 = n.UNSIGNED_INT_24_8_WEBGL) - } - if (this.disableVertexArrayObjects) - this._caps.vertexArrayObject = false; - else if (this._webGLVersion > 1) - this._caps.vertexArrayObject = true; - else { - var r = this._gl.getExtension("OES_vertex_array_object"); - null != r ? (this._caps.vertexArrayObject = true, - this._gl.createVertexArray = r.createVertexArrayOES.bind(r), - this._gl.bindVertexArray = r.bindVertexArrayOES.bind(r), - this._gl.deleteVertexArray = r.deleteVertexArrayOES.bind(r)) : this._caps.vertexArrayObject = false - } - if (this._webGLVersion > 1) - this._caps.instancedArrays = true; - else { - var o = this._gl.getExtension("ANGLE_instanced_arrays"); - null != o ? (this._caps.instancedArrays = true, - this._gl.drawArraysInstanced = o.drawArraysInstancedANGLE.bind(o), - this._gl.drawElementsInstanced = o.drawElementsInstancedANGLE.bind(o), - this._gl.vertexAttribDivisor = o.vertexAttribDivisorANGLE.bind(o)) : this._caps.instancedArrays = false - } - if (this._caps.astc && this.texturesSupported.push("-astc.ktx"), - this._caps.s3tc && this.texturesSupported.push("-dxt.ktx"), - this._caps.pvrtc && this.texturesSupported.push("-pvrtc.ktx"), - this._caps.etc2 && this.texturesSupported.push("-etc2.ktx"), - this._caps.etc1 && this.texturesSupported.push("-etc1.ktx"), - this._gl.getShaderPrecisionFormat) { - var a = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT) - , s = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT); - a && s && (this._caps.highPrecisionShaderSupported = 0 !== a.precision && 0 !== s.precision) - } - this.setDepthBuffer(true), + ) + this._caps.depthTextureExtension = true; + else { + var n = this._gl.getExtension("WEBGL_depth_texture"); + null != n && + ((this._caps.depthTextureExtension = true), + (this._gl.UNSIGNED_INT_24_8 = + n.UNSIGNED_INT_24_8_WEBGL)); + } + if (this.disableVertexArrayObjects) + this._caps.vertexArrayObject = false; + else if (this._webGLVersion > 1) + this._caps.vertexArrayObject = true; + else { + var r = this._gl.getExtension( + "OES_vertex_array_object" + ); + null != r + ? ((this._caps.vertexArrayObject = true), + (this._gl.createVertexArray = + r.createVertexArrayOES.bind(r)), + (this._gl.bindVertexArray = + r.bindVertexArrayOES.bind(r)), + (this._gl.deleteVertexArray = + r.deleteVertexArrayOES.bind(r))) + : (this._caps.vertexArrayObject = false); + } + if (this._webGLVersion > 1) + this._caps.instancedArrays = true; + else { + var o = this._gl.getExtension("ANGLE_instanced_arrays"); + null != o + ? ((this._caps.instancedArrays = true), + (this._gl.drawArraysInstanced = + o.drawArraysInstancedANGLE.bind(o)), + (this._gl.drawElementsInstanced = + o.drawElementsInstancedANGLE.bind(o)), + (this._gl.vertexAttribDivisor = + o.vertexAttribDivisorANGLE.bind(o))) + : (this._caps.instancedArrays = false); + } + if ( + (this._caps.astc && + this.texturesSupported.push("-astc.ktx"), + this._caps.s3tc && + this.texturesSupported.push("-dxt.ktx"), + this._caps.pvrtc && + this.texturesSupported.push("-pvrtc.ktx"), + this._caps.etc2 && + this.texturesSupported.push("-etc2.ktx"), + this._caps.etc1 && + this.texturesSupported.push("-etc1.ktx"), + this._gl.getShaderPrecisionFormat) + ) { + var a = this._gl.getShaderPrecisionFormat( + this._gl.VERTEX_SHADER, + this._gl.HIGH_FLOAT + ), + s = this._gl.getShaderPrecisionFormat( + this._gl.FRAGMENT_SHADER, + this._gl.HIGH_FLOAT + ); + a && + s && + (this._caps.highPrecisionShaderSupported = + 0 !== a.precision && 0 !== s.precision); + } + this.setDepthBuffer(true), this.setDepthFunctionToLessOrEqual(), this.setDepthWrite(true), - this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits; - for (var c = 0; c < this._maxSimultaneousTextures; c++) - this._nextFreeTextureSlots.push(c) - } - , + (this._maxSimultaneousTextures = + this._caps.maxCombinedTexturesImageUnits); + for (var c = 0; c < this._maxSimultaneousTextures; c++) + this._nextFreeTextureSlots.push(c); + }), Object.defineProperty(e.prototype, "webGLVersion", { - get: function() { - return this._webGLVersion - }, - enumerable: true, - configurable: true + get: function () { + return this._webGLVersion; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isStencilEnable", { - get: function() { - return this._isStencilEnable - }, - enumerable: true, - configurable: true + get: function () { + return this._isStencilEnable; + }, + enumerable: true, + configurable: true, }), - e.prototype._prepareWorkingCanvas = function() { - if (!this._workingCanvas) { - this._workingCanvas = document.createElement("canvas"); - var e = this._workingCanvas.getContext("2d"); - e && (this._workingContext = e) - } - } - , - e.prototype.resetTextureCache = function() { - for (var e in this._boundTexturesCache) - this._boundTexturesCache.hasOwnProperty(e) && (this._boundTexturesCache[e] = null); - this._currentTextureChannel = -1 - } - , - e.prototype.isDeterministicLockStep = function() { - return this._deterministicLockstep - } - , - e.prototype.getLockstepMaxSteps = function() { - return this._lockstepMaxSteps - } - , - e.prototype.getGlInfo = function() { - return { - vendor: this._glVendor, - renderer: this._glRenderer, - version: this._glVersion - } - } - , - e.prototype.getAspectRatio = function(e, t) { - void 0 === t && (t = false); - var i = e.viewport; - return this.getRenderWidth(t) * i.width / (this.getRenderHeight(t) * i.height) - } - , - e.prototype.getScreenAspectRatio = function() { - return this.getRenderWidth(true) / this.getRenderHeight(true) - } - , - e.prototype.getRenderWidth = function(e) { - return void 0 === e && (e = false), - !e && this._currentRenderTarget ? this._currentRenderTarget.width : this._gl.drawingBufferWidth - } - , - e.prototype.getRenderHeight = function(e) { - return void 0 === e && (e = false), - !e && this._currentRenderTarget ? this._currentRenderTarget.height : this._gl.drawingBufferHeight - } - , - e.prototype.getRenderingCanvas = function() { - return this._renderingCanvas - } - , - e.prototype.getRenderingCanvasClientRect = function() { - return this._renderingCanvas ? this._renderingCanvas.getBoundingClientRect() : null - } - , - e.prototype.setHardwareScalingLevel = function(e) { - this._hardwareScalingLevel = e, - this.resize() - } - , - e.prototype.getHardwareScalingLevel = function() { - return this._hardwareScalingLevel - } - , - e.prototype.getLoadedTexturesCache = function() { - return this._internalTexturesCache - } - , - e.prototype.getCaps = function() { - return this._caps - } - , - e.prototype.getDepthFunction = function() { - return this._depthCullingState.depthFunc - } - , - e.prototype.setDepthFunction = function(e) { - this._depthCullingState.depthFunc = e - } - , - e.prototype.setDepthFunctionToGreater = function() { - this._depthCullingState.depthFunc = this._gl.GREATER - } - , - e.prototype.setDepthFunctionToGreaterOrEqual = function() { - this._depthCullingState.depthFunc = this._gl.GEQUAL - } - , - e.prototype.setDepthFunctionToLess = function() { - this._depthCullingState.depthFunc = this._gl.LESS - } - , - e.prototype.cacheStencilState = function() { - this._cachedStencilBuffer = this.getStencilBuffer(), - this._cachedStencilFunction = this.getStencilFunction(), - this._cachedStencilMask = this.getStencilMask(), - this._cachedStencilOperationPass = this.getStencilOperationPass(), - this._cachedStencilOperationFail = this.getStencilOperationFail(), - this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail(), - this._cachedStencilReference = this.getStencilFunctionReference() - } - , - e.prototype.restoreStencilState = function() { - this.setStencilFunction(this._cachedStencilFunction), + (e.prototype._prepareWorkingCanvas = function () { + if (!this._workingCanvas) { + this._workingCanvas = document.createElement("canvas"); + var e = this._workingCanvas.getContext("2d"); + e && (this._workingContext = e); + } + }), + (e.prototype.resetTextureCache = function () { + for (var e in this._boundTexturesCache) + this._boundTexturesCache.hasOwnProperty(e) && + (this._boundTexturesCache[e] = null); + this._currentTextureChannel = -1; + }), + (e.prototype.isDeterministicLockStep = function () { + return this._deterministicLockstep; + }), + (e.prototype.getLockstepMaxSteps = function () { + return this._lockstepMaxSteps; + }), + (e.prototype.getGlInfo = function () { + return { + vendor: this._glVendor, + renderer: this._glRenderer, + version: this._glVersion, + }; + }), + (e.prototype.getAspectRatio = function (e, t) { + void 0 === t && (t = false); + var i = e.viewport; + return ( + (this.getRenderWidth(t) * i.width) / + (this.getRenderHeight(t) * i.height) + ); + }), + (e.prototype.getScreenAspectRatio = function () { + return ( + this.getRenderWidth(true) / this.getRenderHeight(true) + ); + }), + (e.prototype.getRenderWidth = function (e) { + return ( + void 0 === e && (e = false), + !e && this._currentRenderTarget + ? this._currentRenderTarget.width + : this._gl.drawingBufferWidth + ); + }), + (e.prototype.getRenderHeight = function (e) { + return ( + void 0 === e && (e = false), + !e && this._currentRenderTarget + ? this._currentRenderTarget.height + : this._gl.drawingBufferHeight + ); + }), + (e.prototype.getRenderingCanvas = function () { + return this._renderingCanvas; + }), + (e.prototype.getRenderingCanvasClientRect = function () { + return this._renderingCanvas + ? this._renderingCanvas.getBoundingClientRect() + : null; + }), + (e.prototype.setHardwareScalingLevel = function (e) { + (this._hardwareScalingLevel = e), this.resize(); + }), + (e.prototype.getHardwareScalingLevel = function () { + return this._hardwareScalingLevel; + }), + (e.prototype.getLoadedTexturesCache = function () { + return this._internalTexturesCache; + }), + (e.prototype.getCaps = function () { + return this._caps; + }), + (e.prototype.getDepthFunction = function () { + return this._depthCullingState.depthFunc; + }), + (e.prototype.setDepthFunction = function (e) { + this._depthCullingState.depthFunc = e; + }), + (e.prototype.setDepthFunctionToGreater = function () { + this._depthCullingState.depthFunc = this._gl.GREATER; + }), + (e.prototype.setDepthFunctionToGreaterOrEqual = + function () { + this._depthCullingState.depthFunc = this._gl.GEQUAL; + }), + (e.prototype.setDepthFunctionToLess = function () { + this._depthCullingState.depthFunc = this._gl.LESS; + }), + (e.prototype.cacheStencilState = function () { + (this._cachedStencilBuffer = this.getStencilBuffer()), + (this._cachedStencilFunction = + this.getStencilFunction()), + (this._cachedStencilMask = this.getStencilMask()), + (this._cachedStencilOperationPass = + this.getStencilOperationPass()), + (this._cachedStencilOperationFail = + this.getStencilOperationFail()), + (this._cachedStencilOperationDepthFail = + this.getStencilOperationDepthFail()), + (this._cachedStencilReference = + this.getStencilFunctionReference()); + }), + (e.prototype.restoreStencilState = function () { + this.setStencilFunction(this._cachedStencilFunction), this.setStencilMask(this._cachedStencilMask), this.setStencilBuffer(this._cachedStencilBuffer), - this.setStencilOperationPass(this._cachedStencilOperationPass), - this.setStencilOperationFail(this._cachedStencilOperationFail), - this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail), - this.setStencilFunctionReference(this._cachedStencilReference) - } - , - e.prototype.setDepthFunctionToLessOrEqual = function() { - this._depthCullingState.depthFunc = this._gl.LEQUAL - } - , - e.prototype.getStencilBuffer = function() { - return this._stencilState.stencilTest - } - , - e.prototype.setStencilBuffer = function(e) { - this._stencilState.stencilTest = e - } - , - e.prototype.getStencilMask = function() { - return this._stencilState.stencilMask - } - , - e.prototype.setStencilMask = function(e) { - this._stencilState.stencilMask = e - } - , - e.prototype.getStencilFunction = function() { - return this._stencilState.stencilFunc - } - , - e.prototype.getStencilFunctionReference = function() { - return this._stencilState.stencilFuncRef - } - , - e.prototype.getStencilFunctionMask = function() { - return this._stencilState.stencilFuncMask - } - , - e.prototype.setStencilFunction = function(e) { - this._stencilState.stencilFunc = e - } - , - e.prototype.setStencilFunctionReference = function(e) { - this._stencilState.stencilFuncRef = e - } - , - e.prototype.setStencilFunctionMask = function(e) { - this._stencilState.stencilFuncMask = e - } - , - e.prototype.getStencilOperationFail = function() { - return this._stencilState.stencilOpStencilFail - } - , - e.prototype.getStencilOperationDepthFail = function() { - return this._stencilState.stencilOpDepthFail - } - , - e.prototype.getStencilOperationPass = function() { - return this._stencilState.stencilOpStencilDepthPass - } - , - e.prototype.setStencilOperationFail = function(e) { - this._stencilState.stencilOpStencilFail = e - } - , - e.prototype.setStencilOperationDepthFail = function(e) { - this._stencilState.stencilOpDepthFail = e - } - , - e.prototype.setStencilOperationPass = function(e) { - this._stencilState.stencilOpStencilDepthPass = e - } - , - e.prototype.setDitheringState = function(e) { - e ? this._gl.enable(this._gl.DITHER) : this._gl.disable(this._gl.DITHER) - } - , - e.prototype.setRasterizerState = function(e) { - e ? this._gl.disable(this._gl.RASTERIZER_DISCARD) : this._gl.enable(this._gl.RASTERIZER_DISCARD) - } - , - e.prototype.stopRenderLoop = function(e) { - if (e) { - var t = this._activeRenderLoops.indexOf(e); - t >= 0 && this._activeRenderLoops.splice(t, 1) - } else - this._activeRenderLoops = [] - } - , - e.prototype._renderLoop = function() { - if (!this._contextWasLost) { - var e = true; - if (!this.renderEvenInBackground && this._windowIsBackground && (e = false), - e) { - this.beginFrame(); - for (var t = 0; t < this._activeRenderLoops.length; t++) - (0, - this._activeRenderLoops[t])(); - this.endFrame() - } + this.setStencilOperationPass( + this._cachedStencilOperationPass + ), + this.setStencilOperationFail( + this._cachedStencilOperationFail + ), + this.setStencilOperationDepthFail( + this._cachedStencilOperationDepthFail + ), + this.setStencilFunctionReference( + this._cachedStencilReference + ); + }), + (e.prototype.setDepthFunctionToLessOrEqual = function () { + this._depthCullingState.depthFunc = this._gl.LEQUAL; + }), + (e.prototype.getStencilBuffer = function () { + return this._stencilState.stencilTest; + }), + (e.prototype.setStencilBuffer = function (e) { + this._stencilState.stencilTest = e; + }), + (e.prototype.getStencilMask = function () { + return this._stencilState.stencilMask; + }), + (e.prototype.setStencilMask = function (e) { + this._stencilState.stencilMask = e; + }), + (e.prototype.getStencilFunction = function () { + return this._stencilState.stencilFunc; + }), + (e.prototype.getStencilFunctionReference = function () { + return this._stencilState.stencilFuncRef; + }), + (e.prototype.getStencilFunctionMask = function () { + return this._stencilState.stencilFuncMask; + }), + (e.prototype.setStencilFunction = function (e) { + this._stencilState.stencilFunc = e; + }), + (e.prototype.setStencilFunctionReference = function (e) { + this._stencilState.stencilFuncRef = e; + }), + (e.prototype.setStencilFunctionMask = function (e) { + this._stencilState.stencilFuncMask = e; + }), + (e.prototype.getStencilOperationFail = function () { + return this._stencilState.stencilOpStencilFail; + }), + (e.prototype.getStencilOperationDepthFail = function () { + return this._stencilState.stencilOpDepthFail; + }), + (e.prototype.getStencilOperationPass = function () { + return this._stencilState.stencilOpStencilDepthPass; + }), + (e.prototype.setStencilOperationFail = function (e) { + this._stencilState.stencilOpStencilFail = e; + }), + (e.prototype.setStencilOperationDepthFail = function (e) { + this._stencilState.stencilOpDepthFail = e; + }), + (e.prototype.setStencilOperationPass = function (e) { + this._stencilState.stencilOpStencilDepthPass = e; + }), + (e.prototype.setDitheringState = function (e) { + e + ? this._gl.enable(this._gl.DITHER) + : this._gl.disable(this._gl.DITHER); + }), + (e.prototype.setRasterizerState = function (e) { + e + ? this._gl.disable(this._gl.RASTERIZER_DISCARD) + : this._gl.enable(this._gl.RASTERIZER_DISCARD); + }), + (e.prototype.stopRenderLoop = function (e) { + if (e) { + var t = this._activeRenderLoops.indexOf(e); + t >= 0 && this._activeRenderLoops.splice(t, 1); + } else this._activeRenderLoops = []; + }), + (e.prototype._renderLoop = function () { + if (!this._contextWasLost) { + var e = true; + if ( + (!this.renderEvenInBackground && + this._windowIsBackground && + (e = false), + e) + ) { + this.beginFrame(); + for ( + var t = 0; + t < this._activeRenderLoops.length; + t++ + ) + (0, this._activeRenderLoops[t])(); + this.endFrame(); } - this._activeRenderLoops.length > 0 ? this.customAnimationFrameRequester ? (this.customAnimationFrameRequester.requestID = l.h.QueueNewFrame(this.customAnimationFrameRequester.renderFunction || this._bindedRenderFunction, this.customAnimationFrameRequester), - this._frameHandler = this.customAnimationFrameRequester.requestID) : this.isVRPresenting() ? this._requestVRFrame() : this._frameHandler = l.h.QueueNewFrame(this._bindedRenderFunction) : this._renderingQueueLaunched = false - } - , - e.prototype.runRenderLoop = function(e) { - -1 === this._activeRenderLoops.indexOf(e) && (this._activeRenderLoops.push(e), - this._renderingQueueLaunched || (this._renderingQueueLaunched = true, - this._bindedRenderFunction = this._renderLoop.bind(this), - this._frameHandler = l.h.QueueNewFrame(this._bindedRenderFunction))) - } - , - e.prototype.switchFullscreen = function(e) { - this.isFullscreen ? this.exitFullscreen() : this.enterFullscreen(e) - } - , - e.prototype.enterFullscreen = function(e) { - this.isFullscreen || (this._pointerLockRequested = e, - this._renderingCanvas && l.h.RequestFullscreen(this._renderingCanvas)) - } - , - e.prototype.exitFullscreen = function() { - this.isFullscreen && l.h.ExitFullscreen() - } - , - e.prototype.clear = function(e, t, i, n) { - void 0 === n && (n = false), - this.applyStates(); - var r = 0; - t && e && (this._gl.clearColor(e.r, e.g, e.b, void 0 !== e.a ? e.a : 1), - r |= this._gl.COLOR_BUFFER_BIT), - i && (this._gl.clearDepth(1), - r |= this._gl.DEPTH_BUFFER_BIT), - n && (this._gl.clearStencil(0), - r |= this._gl.STENCIL_BUFFER_BIT), - this._gl.clear(r) - } - , - e.prototype.scissorClear = function(e, t, i, n, r) { - this.enableScissor(e, t, i, n), + } + this._activeRenderLoops.length > 0 + ? this.customAnimationFrameRequester + ? ((this.customAnimationFrameRequester.requestID = + l.h.QueueNewFrame( + this.customAnimationFrameRequester + .renderFunction || this._bindedRenderFunction, + this.customAnimationFrameRequester + )), + (this._frameHandler = + this.customAnimationFrameRequester.requestID)) + : this.isVRPresenting() + ? this._requestVRFrame() + : (this._frameHandler = l.h.QueueNewFrame( + this._bindedRenderFunction + )) + : (this._renderingQueueLaunched = false); + }), + (e.prototype.runRenderLoop = function (e) { + -1 === this._activeRenderLoops.indexOf(e) && + (this._activeRenderLoops.push(e), + this._renderingQueueLaunched || + ((this._renderingQueueLaunched = true), + (this._bindedRenderFunction = + this._renderLoop.bind(this)), + (this._frameHandler = l.h.QueueNewFrame( + this._bindedRenderFunction + )))); + }), + (e.prototype.switchFullscreen = function (e) { + this.isFullscreen + ? this.exitFullscreen() + : this.enterFullscreen(e); + }), + (e.prototype.enterFullscreen = function (e) { + this.isFullscreen || + ((this._pointerLockRequested = e), + this._renderingCanvas && + l.h.RequestFullscreen(this._renderingCanvas)); + }), + (e.prototype.exitFullscreen = function () { + this.isFullscreen && l.h.ExitFullscreen(); + }), + (e.prototype.clear = function (e, t, i, n) { + void 0 === n && (n = false), this.applyStates(); + var r = 0; + t && + e && + (this._gl.clearColor( + e.r, + e.g, + e.b, + void 0 !== e.a ? e.a : 1 + ), + (r |= this._gl.COLOR_BUFFER_BIT)), + i && + (this._gl.clearDepth(1), + (r |= this._gl.DEPTH_BUFFER_BIT)), + n && + (this._gl.clearStencil(0), + (r |= this._gl.STENCIL_BUFFER_BIT)), + this._gl.clear(r); + }), + (e.prototype.scissorClear = function (e, t, i, n, r) { + this.enableScissor(e, t, i, n), this.clear(r, true, true, true), - this.disableScissor() - } - , - e.prototype.enableScissor = function(e, t, i, n) { - var r = this._gl; - r.enable(r.SCISSOR_TEST), - r.scissor(e, t, i, n) - } - , - e.prototype.disableScissor = function() { - var e = this._gl; - e.disable(e.SCISSOR_TEST) - } - , - e.prototype._viewport = function(e, t, i, n) { - e === this._viewportCached.x && t === this._viewportCached.y && i === this._viewportCached.z && n === this._viewportCached.w || (this._viewportCached.x = e, - this._viewportCached.y = t, - this._viewportCached.z = i, - this._viewportCached.w = n, - this._gl.viewport(e, t, i, n)) - } - , - e.prototype.setViewport = function(e, t, i) { - var n = t || this.getRenderWidth() - , r = i || this.getRenderHeight() - , o = e.x || 0 - , a = e.y || 0; - this._cachedViewport = e, - this._viewport(o * n, a * r, n * e.width, r * e.height) - } - , - e.prototype.setDirectViewport = function(e, t, i, n) { - var r = this._cachedViewport; - return this._cachedViewport = null, + this.disableScissor(); + }), + (e.prototype.enableScissor = function (e, t, i, n) { + var r = this._gl; + r.enable(r.SCISSOR_TEST), r.scissor(e, t, i, n); + }), + (e.prototype.disableScissor = function () { + var e = this._gl; + e.disable(e.SCISSOR_TEST); + }), + (e.prototype._viewport = function (e, t, i, n) { + (e === this._viewportCached.x && + t === this._viewportCached.y && + i === this._viewportCached.z && + n === this._viewportCached.w) || + ((this._viewportCached.x = e), + (this._viewportCached.y = t), + (this._viewportCached.z = i), + (this._viewportCached.w = n), + this._gl.viewport(e, t, i, n)); + }), + (e.prototype.setViewport = function (e, t, i) { + var n = t || this.getRenderWidth(), + r = i || this.getRenderHeight(), + o = e.x || 0, + a = e.y || 0; + (this._cachedViewport = e), + this._viewport(o * n, a * r, n * e.width, r * e.height); + }), + (e.prototype.setDirectViewport = function (e, t, i, n) { + var r = this._cachedViewport; + return ( + (this._cachedViewport = null), this._viewport(e, t, i, n), r - } - , - e.prototype.beginFrame = function() { - this.onBeginFrameObservable.notifyObservers(this), - this._measureFps() - } - , - e.prototype.endFrame = function() { - this._badOS && this.flushFramebuffer(), + ); + }), + (e.prototype.beginFrame = function () { + this.onBeginFrameObservable.notifyObservers(this), + this._measureFps(); + }), + (e.prototype.endFrame = function () { + this._badOS && this.flushFramebuffer(), this._submitVRFrame(), - this.onEndFrameObservable.notifyObservers(this) - } - , - e.prototype.resize = function() { - if (!this.isVRPresenting()) { - var e = this._renderingCanvas ? this._renderingCanvas.clientWidth : window.innerWidth - , t = this._renderingCanvas ? this._renderingCanvas.clientHeight : window.innerHeight; - this.setSize(e / this._hardwareScalingLevel, t / this._hardwareScalingLevel) - } - } - , - e.prototype.setSize = function(e, t) { - if (this._renderingCanvas && (this._renderingCanvas.width !== e || this._renderingCanvas.height !== t)) { - this._renderingCanvas.width = e, - this._renderingCanvas.height = t; - for (var i = 0; i < this.scenes.length; i++) - for (var n = this.scenes[i], r = 0; r < n.cameras.length; r++) - n.cameras[r]._currentRenderId = 0; - this.onResizeObservable.hasObservers && this.onResizeObservable.notifyObservers(this) - } - } - , - e.prototype.bindFramebuffer = function(e, t, i, n, r, o, a) { - void 0 === a && (a = 0), - this._currentRenderTarget && this.unBindFramebuffer(this._currentRenderTarget), - this._currentRenderTarget = e, - this._bindUnboundFramebuffer(e._MSAAFramebuffer ? e._MSAAFramebuffer : e._framebuffer); - var s = this._gl; - e.isCube && (void 0 === t && (t = 0), - s.framebufferTexture2D(s.FRAMEBUFFER, s.COLOR_ATTACHMENT0, s.TEXTURE_CUBE_MAP_POSITIVE_X + t, e._webGLTexture, a), - o && (o._generateStencilBuffer ? s.framebufferTexture2D(s.FRAMEBUFFER, s.DEPTH_STENCIL_ATTACHMENT, s.TEXTURE_CUBE_MAP_POSITIVE_X + t, o._webGLTexture, a) : s.framebufferTexture2D(s.FRAMEBUFFER, s.DEPTH_ATTACHMENT, s.TEXTURE_CUBE_MAP_POSITIVE_X + t, o._webGLTexture, a))), - this._cachedViewport && !r ? this.setViewport(this._cachedViewport, i, n) : (i || (i = e.width, - a && (i /= Math.pow(2, a))), - n || (n = e.height, - a && (n /= Math.pow(2, a))), - this._viewport(0, 0, i, n)), - this.wipeCaches() - } - , - e.prototype._bindUnboundFramebuffer = function(e) { - this._currentFramebuffer !== e && (this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, e), - this._currentFramebuffer = e) - } - , - e.prototype.unBindFramebuffer = function(e, t, i) { - void 0 === t && (t = false), - this._currentRenderTarget = null; - var n = this._gl; - e._MSAAFramebuffer && (n.bindFramebuffer(n.READ_FRAMEBUFFER, e._MSAAFramebuffer), + this.onEndFrameObservable.notifyObservers(this); + }), + (e.prototype.resize = function () { + if (!this.isVRPresenting()) { + var e = this._renderingCanvas + ? this._renderingCanvas.clientWidth + : window.innerWidth, + t = this._renderingCanvas + ? this._renderingCanvas.clientHeight + : window.innerHeight; + this.setSize( + e / this._hardwareScalingLevel, + t / this._hardwareScalingLevel + ); + } + }), + (e.prototype.setSize = function (e, t) { + if ( + this._renderingCanvas && + (this._renderingCanvas.width !== e || + this._renderingCanvas.height !== t) + ) { + (this._renderingCanvas.width = e), + (this._renderingCanvas.height = t); + for (var i = 0; i < this.scenes.length; i++) + for ( + var n = this.scenes[i], r = 0; + r < n.cameras.length; + r++ + ) + n.cameras[r]._currentRenderId = 0; + this.onResizeObservable.hasObservers && + this.onResizeObservable.notifyObservers(this); + } + }), + (e.prototype.bindFramebuffer = function ( + e, + t, + i, + n, + r, + o, + a + ) { + void 0 === a && (a = 0), + this._currentRenderTarget && + this.unBindFramebuffer(this._currentRenderTarget), + (this._currentRenderTarget = e), + this._bindUnboundFramebuffer( + e._MSAAFramebuffer + ? e._MSAAFramebuffer + : e._framebuffer + ); + var s = this._gl; + e.isCube && + (void 0 === t && (t = 0), + s.framebufferTexture2D( + s.FRAMEBUFFER, + s.COLOR_ATTACHMENT0, + s.TEXTURE_CUBE_MAP_POSITIVE_X + t, + e._webGLTexture, + a + ), + o && + (o._generateStencilBuffer + ? s.framebufferTexture2D( + s.FRAMEBUFFER, + s.DEPTH_STENCIL_ATTACHMENT, + s.TEXTURE_CUBE_MAP_POSITIVE_X + t, + o._webGLTexture, + a + ) + : s.framebufferTexture2D( + s.FRAMEBUFFER, + s.DEPTH_ATTACHMENT, + s.TEXTURE_CUBE_MAP_POSITIVE_X + t, + o._webGLTexture, + a + ))), + this._cachedViewport && !r + ? this.setViewport(this._cachedViewport, i, n) + : (i || ((i = e.width), a && (i /= Math.pow(2, a))), + n || ((n = e.height), a && (n /= Math.pow(2, a))), + this._viewport(0, 0, i, n)), + this.wipeCaches(); + }), + (e.prototype._bindUnboundFramebuffer = function (e) { + this._currentFramebuffer !== e && + (this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, e), + (this._currentFramebuffer = e)); + }), + (e.prototype.unBindFramebuffer = function (e, t, i) { + void 0 === t && (t = false), + (this._currentRenderTarget = null); + var n = this._gl; + e._MSAAFramebuffer && + (n.bindFramebuffer( + n.READ_FRAMEBUFFER, + e._MSAAFramebuffer + ), n.bindFramebuffer(n.DRAW_FRAMEBUFFER, e._framebuffer), - n.blitFramebuffer(0, 0, e.width, e.height, 0, 0, e.width, e.height, n.COLOR_BUFFER_BIT, n.NEAREST)), - !e.generateMipMaps || t || e.isCube || (this._bindTextureDirectly(n.TEXTURE_2D, e, true), - n.generateMipmap(n.TEXTURE_2D), - this._bindTextureDirectly(n.TEXTURE_2D, null)), - i && (e._MSAAFramebuffer && this._bindUnboundFramebuffer(e._framebuffer), - i()), - this._bindUnboundFramebuffer(null) - } - , - e.prototype.generateMipMapsForCubemap = function(e) { - if (e.generateMipMaps) { - var t = this._gl; - this._bindTextureDirectly(t.TEXTURE_CUBE_MAP, e, true), - t.generateMipmap(t.TEXTURE_CUBE_MAP), - this._bindTextureDirectly(t.TEXTURE_CUBE_MAP, null) - } - } - , - e.prototype.flushFramebuffer = function() { - this._gl.flush() - } - , - e.prototype.restoreDefaultFramebuffer = function() { - this._currentRenderTarget ? this.unBindFramebuffer(this._currentRenderTarget) : this._bindUnboundFramebuffer(null), - this._cachedViewport && this.setViewport(this._cachedViewport), - this.wipeCaches() - } - , - e.prototype.createUniformBuffer = function(e) { - var t = this._gl.createBuffer(); - if (!t) - throw new Error("Unable to create uniform buffer"); - var i = new x.a(t); - return this.bindUniformBuffer(i), - e instanceof Float32Array ? this._gl.bufferData(this._gl.UNIFORM_BUFFER, e, this._gl.STATIC_DRAW) : this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(e), this._gl.STATIC_DRAW), + n.blitFramebuffer( + 0, + 0, + e.width, + e.height, + 0, + 0, + e.width, + e.height, + n.COLOR_BUFFER_BIT, + n.NEAREST + )), + !e.generateMipMaps || + t || + e.isCube || + (this._bindTextureDirectly(n.TEXTURE_2D, e, true), + n.generateMipmap(n.TEXTURE_2D), + this._bindTextureDirectly(n.TEXTURE_2D, null)), + i && + (e._MSAAFramebuffer && + this._bindUnboundFramebuffer(e._framebuffer), + i()), + this._bindUnboundFramebuffer(null); + }), + (e.prototype.generateMipMapsForCubemap = function (e) { + if (e.generateMipMaps) { + var t = this._gl; + this._bindTextureDirectly(t.TEXTURE_CUBE_MAP, e, true), + t.generateMipmap(t.TEXTURE_CUBE_MAP), + this._bindTextureDirectly(t.TEXTURE_CUBE_MAP, null); + } + }), + (e.prototype.flushFramebuffer = function () { + this._gl.flush(); + }), + (e.prototype.restoreDefaultFramebuffer = function () { + this._currentRenderTarget + ? this.unBindFramebuffer(this._currentRenderTarget) + : this._bindUnboundFramebuffer(null), + this._cachedViewport && + this.setViewport(this._cachedViewport), + this.wipeCaches(); + }), + (e.prototype.createUniformBuffer = function (e) { + var t = this._gl.createBuffer(); + if (!t) + throw new Error("Unable to create uniform buffer"); + var i = new x.a(t); + return ( + this.bindUniformBuffer(i), + e instanceof Float32Array + ? this._gl.bufferData( + this._gl.UNIFORM_BUFFER, + e, + this._gl.STATIC_DRAW + ) + : this._gl.bufferData( + this._gl.UNIFORM_BUFFER, + new Float32Array(e), + this._gl.STATIC_DRAW + ), this.bindUniformBuffer(null), - i.references = 1, + (i.references = 1), i - } - , - e.prototype.createDynamicUniformBuffer = function(e) { - var t = this._gl.createBuffer(); - if (!t) - throw new Error("Unable to create dynamic uniform buffer"); - var i = new x.a(t); - return this.bindUniformBuffer(i), - e instanceof Float32Array ? this._gl.bufferData(this._gl.UNIFORM_BUFFER, e, this._gl.DYNAMIC_DRAW) : this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(e), this._gl.DYNAMIC_DRAW), + ); + }), + (e.prototype.createDynamicUniformBuffer = function (e) { + var t = this._gl.createBuffer(); + if (!t) + throw new Error( + "Unable to create dynamic uniform buffer" + ); + var i = new x.a(t); + return ( + this.bindUniformBuffer(i), + e instanceof Float32Array + ? this._gl.bufferData( + this._gl.UNIFORM_BUFFER, + e, + this._gl.DYNAMIC_DRAW + ) + : this._gl.bufferData( + this._gl.UNIFORM_BUFFER, + new Float32Array(e), + this._gl.DYNAMIC_DRAW + ), this.bindUniformBuffer(null), - i.references = 1, + (i.references = 1), i - } - , - e.prototype.updateUniformBuffer = function(e, t, i, n) { - this.bindUniformBuffer(e), + ); + }), + (e.prototype.updateUniformBuffer = function (e, t, i, n) { + this.bindUniformBuffer(e), void 0 === i && (i = 0), - void 0 === n ? t instanceof Float32Array ? this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, i, t) : this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, i, new Float32Array(t)) : t instanceof Float32Array ? this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, t.subarray(i, i + n)) : this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(t).subarray(i, i + n)), - this.bindUniformBuffer(null) - } - , - e.prototype._resetVertexBufferBinding = function() { - this.bindArrayBuffer(null), - this._cachedVertexBuffers = null - } - , - e.prototype.createVertexBuffer = function(e) { - var t = this._gl.createBuffer(); - if (!t) - throw new Error("Unable to create vertex buffer"); - var i = new x.a(t); - return this.bindArrayBuffer(i), - e instanceof Array ? this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(e), this._gl.STATIC_DRAW) : this._gl.bufferData(this._gl.ARRAY_BUFFER, e, this._gl.STATIC_DRAW), + void 0 === n + ? t instanceof Float32Array + ? this._gl.bufferSubData( + this._gl.UNIFORM_BUFFER, + i, + t + ) + : this._gl.bufferSubData( + this._gl.UNIFORM_BUFFER, + i, + new Float32Array(t) + ) + : t instanceof Float32Array + ? this._gl.bufferSubData( + this._gl.UNIFORM_BUFFER, + 0, + t.subarray(i, i + n) + ) + : this._gl.bufferSubData( + this._gl.UNIFORM_BUFFER, + 0, + new Float32Array(t).subarray(i, i + n) + ), + this.bindUniformBuffer(null); + }), + (e.prototype._resetVertexBufferBinding = function () { + this.bindArrayBuffer(null), + (this._cachedVertexBuffers = null); + }), + (e.prototype.createVertexBuffer = function (e) { + var t = this._gl.createBuffer(); + if (!t) throw new Error("Unable to create vertex buffer"); + var i = new x.a(t); + return ( + this.bindArrayBuffer(i), + e instanceof Array + ? this._gl.bufferData( + this._gl.ARRAY_BUFFER, + new Float32Array(e), + this._gl.STATIC_DRAW + ) + : this._gl.bufferData( + this._gl.ARRAY_BUFFER, + e, + this._gl.STATIC_DRAW + ), this._resetVertexBufferBinding(), - i.references = 1, + (i.references = 1), i - } - , - e.prototype.createDynamicVertexBuffer = function(e) { - var t = this._gl.createBuffer(); - if (!t) - throw new Error("Unable to create dynamic vertex buffer"); - var i = new x.a(t); - return this.bindArrayBuffer(i), - e instanceof Array ? this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(e), this._gl.DYNAMIC_DRAW) : this._gl.bufferData(this._gl.ARRAY_BUFFER, e, this._gl.DYNAMIC_DRAW), + ); + }), + (e.prototype.createDynamicVertexBuffer = function (e) { + var t = this._gl.createBuffer(); + if (!t) + throw new Error( + "Unable to create dynamic vertex buffer" + ); + var i = new x.a(t); + return ( + this.bindArrayBuffer(i), + e instanceof Array + ? this._gl.bufferData( + this._gl.ARRAY_BUFFER, + new Float32Array(e), + this._gl.DYNAMIC_DRAW + ) + : this._gl.bufferData( + this._gl.ARRAY_BUFFER, + e, + this._gl.DYNAMIC_DRAW + ), this._resetVertexBufferBinding(), - i.references = 1, + (i.references = 1), i - } - , - e.prototype.updateDynamicIndexBuffer = function(e, t, i) { - var n; - void 0 === i && (i = 0), - this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null, + ); + }), + (e.prototype.updateDynamicIndexBuffer = function (e, t, i) { + var n; + void 0 === i && (i = 0), + (this._currentBoundBuffer[ + this._gl.ELEMENT_ARRAY_BUFFER + ] = null), this.bindIndexBuffer(e), - n = t instanceof Uint16Array || t instanceof Uint32Array ? t : e.is32Bits ? new Uint32Array(t) : new Uint16Array(t), - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, n, this._gl.DYNAMIC_DRAW), - this._resetIndexBufferBinding() - } - , - e.prototype.updateDynamicVertexBuffer = function(e, t, i, n) { - this.bindArrayBuffer(e), + (n = + t instanceof Uint16Array || t instanceof Uint32Array + ? t + : e.is32Bits + ? new Uint32Array(t) + : new Uint16Array(t)), + this._gl.bufferData( + this._gl.ELEMENT_ARRAY_BUFFER, + n, + this._gl.DYNAMIC_DRAW + ), + this._resetIndexBufferBinding(); + }), + (e.prototype.updateDynamicVertexBuffer = function ( + e, + t, + i, + n + ) { + this.bindArrayBuffer(e), void 0 === i && (i = 0), - void 0 === n ? t instanceof Array ? this._gl.bufferSubData(this._gl.ARRAY_BUFFER, i, new Float32Array(t)) : this._gl.bufferSubData(this._gl.ARRAY_BUFFER, i, t) : t instanceof Array ? this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(t).subarray(i, i + n)) : (t = t instanceof ArrayBuffer ? new Uint8Array(t,i,n) : new Uint8Array(t.buffer,t.byteOffset + i,n), - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, t)), - this._resetVertexBufferBinding() - } - , - e.prototype._resetIndexBufferBinding = function() { - this.bindIndexBuffer(null), - this._cachedIndexBuffer = null - } - , - e.prototype.createIndexBuffer = function(e, t) { - var i, n = this._gl.createBuffer(), r = new x.a(n); - if (!n) - throw new Error("Unable to create index buffer"); - this.bindIndexBuffer(r); - var o = false; - if (e instanceof Uint16Array) - i = e; - else if (this._caps.uintIndices) - if (e instanceof Uint32Array) - i = e, - o = true; - else { - for (var a = 0; a < e.length; a++) - if (e[a] > 65535) { - o = true; - break - } - i = o ? new Uint32Array(e) : new Uint16Array(e) + void 0 === n + ? t instanceof Array + ? this._gl.bufferSubData( + this._gl.ARRAY_BUFFER, + i, + new Float32Array(t) + ) + : this._gl.bufferSubData( + this._gl.ARRAY_BUFFER, + i, + t + ) + : t instanceof Array + ? this._gl.bufferSubData( + this._gl.ARRAY_BUFFER, + 0, + new Float32Array(t).subarray(i, i + n) + ) + : ((t = + t instanceof ArrayBuffer + ? new Uint8Array(t, i, n) + : new Uint8Array( + t.buffer, + t.byteOffset + i, + n + )), + this._gl.bufferSubData( + this._gl.ARRAY_BUFFER, + 0, + t + )), + this._resetVertexBufferBinding(); + }), + (e.prototype._resetIndexBufferBinding = function () { + this.bindIndexBuffer(null), + (this._cachedIndexBuffer = null); + }), + (e.prototype.createIndexBuffer = function (e, t) { + var i, + n = this._gl.createBuffer(), + r = new x.a(n); + if (!n) throw new Error("Unable to create index buffer"); + this.bindIndexBuffer(r); + var o = false; + if (e instanceof Uint16Array) i = e; + else if (this._caps.uintIndices) + if (e instanceof Uint32Array) (i = e), (o = true); + else { + for (var a = 0; a < e.length; a++) + if (e[a] > 65535) { + o = true; + break; } - else - i = new Uint16Array(e); - return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, i, t ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW), + i = o ? new Uint32Array(e) : new Uint16Array(e); + } + else i = new Uint16Array(e); + return ( + this._gl.bufferData( + this._gl.ELEMENT_ARRAY_BUFFER, + i, + t ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW + ), this._resetIndexBufferBinding(), - r.references = 1, - r.is32Bits = o, + (r.references = 1), + (r.is32Bits = o), r - } - , - e.prototype.bindArrayBuffer = function(e) { - this._vaoRecordInProgress || this._unbindVertexArrayObject(), - this.bindBuffer(e, this._gl.ARRAY_BUFFER) - } - , - e.prototype.bindUniformBuffer = function(e) { - this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, e ? e.underlyingResource : null) - } - , - e.prototype.bindUniformBufferBase = function(e, t) { - this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, t, e ? e.underlyingResource : null) - } - , - e.prototype.bindUniformBlock = function(e, t, i) { - var n = e.program - , r = this._gl.getUniformBlockIndex(n, t); - this._gl.uniformBlockBinding(n, r, i) - } - , - e.prototype.bindIndexBuffer = function(e) { - this._vaoRecordInProgress || this._unbindVertexArrayObject(), - this.bindBuffer(e, this._gl.ELEMENT_ARRAY_BUFFER) - } - , - e.prototype.bindBuffer = function(e, t) { - (this._vaoRecordInProgress || this._currentBoundBuffer[t] !== e) && (this._gl.bindBuffer(t, e ? e.underlyingResource : null), - this._currentBoundBuffer[t] = e) - } - , - e.prototype.updateArrayBuffer = function(e) { - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, e) - } - , - e.prototype._vertexAttribPointer = function(e, t, i, n, r, o, a) { - var s = this._currentBufferPointers[t] - , c = false; - s.active ? (s.buffer !== e && (s.buffer = e, - c = true), - s.size !== i && (s.size = i, - c = true), - s.type !== n && (s.type = n, - c = true), - s.normalized !== r && (s.normalized = r, - c = true), - s.stride !== o && (s.stride = o, - c = true), - s.offset !== a && (s.offset = a, - c = true)) : (c = true, - s.active = true, - s.index = t, - s.size = i, - s.type = n, - s.normalized = r, - s.stride = o, - s.offset = a, - s.buffer = e), - (c || this._vaoRecordInProgress) && (this.bindArrayBuffer(e), - this._gl.vertexAttribPointer(t, i, n, r, o, a)) - } - , - e.prototype._bindIndexBufferWithCache = function(e) { - null != e && this._cachedIndexBuffer !== e && (this._cachedIndexBuffer = e, + ); + }), + (e.prototype.bindArrayBuffer = function (e) { + this._vaoRecordInProgress || + this._unbindVertexArrayObject(), + this.bindBuffer(e, this._gl.ARRAY_BUFFER); + }), + (e.prototype.bindUniformBuffer = function (e) { + this._gl.bindBuffer( + this._gl.UNIFORM_BUFFER, + e ? e.underlyingResource : null + ); + }), + (e.prototype.bindUniformBufferBase = function (e, t) { + this._gl.bindBufferBase( + this._gl.UNIFORM_BUFFER, + t, + e ? e.underlyingResource : null + ); + }), + (e.prototype.bindUniformBlock = function (e, t, i) { + var n = e.program, + r = this._gl.getUniformBlockIndex(n, t); + this._gl.uniformBlockBinding(n, r, i); + }), + (e.prototype.bindIndexBuffer = function (e) { + this._vaoRecordInProgress || + this._unbindVertexArrayObject(), + this.bindBuffer(e, this._gl.ELEMENT_ARRAY_BUFFER); + }), + (e.prototype.bindBuffer = function (e, t) { + (this._vaoRecordInProgress || + this._currentBoundBuffer[t] !== e) && + (this._gl.bindBuffer( + t, + e ? e.underlyingResource : null + ), + (this._currentBoundBuffer[t] = e)); + }), + (e.prototype.updateArrayBuffer = function (e) { + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, e); + }), + (e.prototype._vertexAttribPointer = function ( + e, + t, + i, + n, + r, + o, + a + ) { + var s = this._currentBufferPointers[t], + c = false; + s.active + ? (s.buffer !== e && ((s.buffer = e), (c = true)), + s.size !== i && ((s.size = i), (c = true)), + s.type !== n && ((s.type = n), (c = true)), + s.normalized !== r && + ((s.normalized = r), (c = true)), + s.stride !== o && ((s.stride = o), (c = true)), + s.offset !== a && ((s.offset = a), (c = true))) + : ((c = true), + (s.active = true), + (s.index = t), + (s.size = i), + (s.type = n), + (s.normalized = r), + (s.stride = o), + (s.offset = a), + (s.buffer = e)), + (c || this._vaoRecordInProgress) && + (this.bindArrayBuffer(e), + this._gl.vertexAttribPointer(t, i, n, r, o, a)); + }), + (e.prototype._bindIndexBufferWithCache = function (e) { + null != e && + this._cachedIndexBuffer !== e && + ((this._cachedIndexBuffer = e), this.bindIndexBuffer(e), - this._uintIndicesCurrentlySet = e.is32Bits) - } - , - e.prototype._bindVertexBuffersAttributes = function(e, t) { - var i = t.getAttributesNames(); - this._vaoRecordInProgress || this._unbindVertexArrayObject(), + (this._uintIndicesCurrentlySet = e.is32Bits)); + }), + (e.prototype._bindVertexBuffersAttributes = function ( + e, + t + ) { + var i = t.getAttributesNames(); + this._vaoRecordInProgress || + this._unbindVertexArrayObject(), this.unbindAllAttributes(); - for (var n = 0; n < i.length; n++) { - var r = t.getAttributeLocation(n); - if (r >= 0) { - var o = e[i[n]]; - if (!o) - continue; - this._gl.enableVertexAttribArray(r), - this._vaoRecordInProgress || (this._vertexAttribArraysEnabled[r] = true); - var a = o.getBuffer(); - a && (this._vertexAttribPointer(a, r, o.getSize(), o.type, o.normalized, o.byteStride, o.byteOffset), - o.getIsInstanced() && (this._gl.vertexAttribDivisor(r, o.getInstanceDivisor()), - this._vaoRecordInProgress || (this._currentInstanceLocations.push(r), - this._currentInstanceBuffers.push(a)))) - } + for (var n = 0; n < i.length; n++) { + var r = t.getAttributeLocation(n); + if (r >= 0) { + var o = e[i[n]]; + if (!o) continue; + this._gl.enableVertexAttribArray(r), + this._vaoRecordInProgress || + (this._vertexAttribArraysEnabled[r] = true); + var a = o.getBuffer(); + a && + (this._vertexAttribPointer( + a, + r, + o.getSize(), + o.type, + o.normalized, + o.byteStride, + o.byteOffset + ), + o.getIsInstanced() && + (this._gl.vertexAttribDivisor( + r, + o.getInstanceDivisor() + ), + this._vaoRecordInProgress || + (this._currentInstanceLocations.push(r), + this._currentInstanceBuffers.push(a)))); } - } - , - e.prototype.recordVertexArrayObject = function(e, t, i) { - var n = this._gl.createVertexArray(); - return this._vaoRecordInProgress = true, + } + }), + (e.prototype.recordVertexArrayObject = function (e, t, i) { + var n = this._gl.createVertexArray(); + return ( + (this._vaoRecordInProgress = true), this._gl.bindVertexArray(n), - this._mustWipeVertexAttributes = true, + (this._mustWipeVertexAttributes = true), this._bindVertexBuffersAttributes(e, i), this.bindIndexBuffer(t), - this._vaoRecordInProgress = false, + (this._vaoRecordInProgress = false), this._gl.bindVertexArray(null), n - } - , - e.prototype.bindVertexArrayObject = function(e, t) { - this._cachedVertexArrayObject !== e && (this._cachedVertexArrayObject = e, + ); + }), + (e.prototype.bindVertexArrayObject = function (e, t) { + this._cachedVertexArrayObject !== e && + ((this._cachedVertexArrayObject = e), this._gl.bindVertexArray(e), - this._cachedVertexBuffers = null, - this._cachedIndexBuffer = null, - this._uintIndicesCurrentlySet = null != t && t.is32Bits, - this._mustWipeVertexAttributes = true) - } - , - e.prototype.bindBuffersDirectly = function(e, t, i, n, r) { - if (this._cachedVertexBuffers !== e || this._cachedEffectForVertexBuffers !== r) { - this._cachedVertexBuffers = e, - this._cachedEffectForVertexBuffers = r; - var o = r.getAttributesCount(); - this._unbindVertexArrayObject(), - this.unbindAllAttributes(); - for (var a = 0, s = 0; s < o; s++) - if (s < i.length) { - var c = r.getAttributeLocation(s); - c >= 0 && (this._gl.enableVertexAttribArray(c), - this._vertexAttribArraysEnabled[c] = true, - this._vertexAttribPointer(e, c, i[s], this._gl.FLOAT, false, n, a)), - a += 4 * i[s] - } - } - this._bindIndexBufferWithCache(t) - } - , - e.prototype._unbindVertexArrayObject = function() { - this._cachedVertexArrayObject && (this._cachedVertexArrayObject = null, - this._gl.bindVertexArray(null)) - } - , - e.prototype.bindBuffers = function(e, t, i) { - this._cachedVertexBuffers === e && this._cachedEffectForVertexBuffers === i || (this._cachedVertexBuffers = e, - this._cachedEffectForVertexBuffers = i, - this._bindVertexBuffersAttributes(e, i)), - this._bindIndexBufferWithCache(t) - } - , - e.prototype.unbindInstanceAttributes = function() { - for (var e, t = 0, i = this._currentInstanceLocations.length; t < i; t++) { - var n = this._currentInstanceBuffers[t]; - e != n && n.references && (e = n, - this.bindArrayBuffer(n)); - var r = this._currentInstanceLocations[t]; - this._gl.vertexAttribDivisor(r, 0) - } - this._currentInstanceBuffers.length = 0, - this._currentInstanceLocations.length = 0 - } - , - e.prototype.releaseVertexArrayObject = function(e) { - this._gl.deleteVertexArray(e) - } - , - e.prototype._releaseBuffer = function(e) { - return e.references--, - 0 === e.references && (this._gl.deleteBuffer(e.underlyingResource), - true) - } - , - e.prototype.createInstancesBuffer = function(e) { - var t = this._gl.createBuffer(); - if (!t) - throw new Error("Unable to create instance buffer"); - var i = new x.a(t); - return i.capacity = e, - this.bindArrayBuffer(i), - this._gl.bufferData(this._gl.ARRAY_BUFFER, e, this._gl.DYNAMIC_DRAW), - i - } - , - e.prototype.deleteInstancesBuffer = function(e) { - this._gl.deleteBuffer(e) - } - , - e.prototype.updateAndBindInstancesBuffer = function(e, t, i) { - if (this.bindArrayBuffer(e), - t && this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, t), - void 0 !== i[0].index) { - for (var n = 0, r = 0; r < i.length; r++) - n += 4 * (o = i[r]).attributeSize; - for (r = 0; r < i.length; r++) { - var o = i[r]; - this._vertexAttribArraysEnabled[o.index] || (this._gl.enableVertexAttribArray(o.index), - this._vertexAttribArraysEnabled[o.index] = true), - this._vertexAttribPointer(e, o.index, o.attributeSize, o.attribyteType || this._gl.FLOAT, o.normalized || false, n, o.offset), - this._gl.vertexAttribDivisor(o.index, 1), - this._currentInstanceLocations.push(o.index), - this._currentInstanceBuffers.push(e) - } - } else - for (var a = 0; a < 4; a++) { - var s = i[a]; - this._vertexAttribArraysEnabled[s] || (this._gl.enableVertexAttribArray(s), - this._vertexAttribArraysEnabled[s] = true), - this._vertexAttribPointer(e, s, 4, this._gl.FLOAT, false, 64, 16 * a), - this._gl.vertexAttribDivisor(s, 1), - this._currentInstanceLocations.push(s), - this._currentInstanceBuffers.push(e) - } - } - , - e.prototype.applyStates = function() { - this._depthCullingState.apply(this._gl), - this._stencilState.apply(this._gl), - this._alphaState.apply(this._gl) - } - , - e.prototype.draw = function(e, t, i, n) { - this.drawElementsType(e ? p.a.TriangleFillMode : p.a.WireFrameFillMode, t, i, n) - } - , - e.prototype.drawPointClouds = function(e, t, i) { - this.drawArraysType(p.a.PointFillMode, e, t, i) - } - , - e.prototype.drawUnIndexed = function(e, t, i, n) { - this.drawArraysType(e ? p.a.TriangleFillMode : p.a.WireFrameFillMode, t, i, n) - } - , - e.prototype.drawElementsType = function(e, t, i, n) { - this.applyStates(), - this._drawCalls.addCount(1, false); - var r = this._drawMode(e) - , o = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT - , a = this._uintIndicesCurrentlySet ? 4 : 2; - n ? this._gl.drawElementsInstanced(r, i, o, t * a, n) : this._gl.drawElements(r, i, o, t * a) - } - , - e.prototype.drawArraysType = function(e, t, i, n) { - this.applyStates(), - this._drawCalls.addCount(1, false); - var r = this._drawMode(e); - n ? this._gl.drawArraysInstanced(r, t, i, n) : this._gl.drawArrays(r, t, i) - } - , - e.prototype._drawMode = function(e) { - switch (e) { - case p.a.TriangleFillMode: - return this._gl.TRIANGLES; - case p.a.PointFillMode: - return this._gl.POINTS; - case p.a.WireFrameFillMode: - return this._gl.LINES; - case p.a.PointListDrawMode: - return this._gl.POINTS; - case p.a.LineListDrawMode: - return this._gl.LINES; - case p.a.LineLoopDrawMode: - return this._gl.LINE_LOOP; - case p.a.LineStripDrawMode: - return this._gl.LINE_STRIP; - case p.a.TriangleStripDrawMode: - return this._gl.TRIANGLE_STRIP; - case p.a.TriangleFanDrawMode: - return this._gl.TRIANGLE_FAN; - default: - return this._gl.TRIANGLES - } - } - , - e.prototype._releaseEffect = function(e) { - this._compiledEffects[e._key] && (delete this._compiledEffects[e._key], - this._deletePipelineContext(e.getPipelineContext())) - } - , - e.prototype._deletePipelineContext = function(e) { - var t = e; - t && t.program && (t.program.__SPECTOR_rebuildProgram = null, - t.transformFeedback && (this.deleteTransformFeedback(t.transformFeedback), - t.transformFeedback = null), - this._gl.deleteProgram(t.program)) - } - , - e.prototype.createEffect = function(e, t, i, n, r, o, a, s, c) { - var u = (e.vertexElement || e.vertex || e) + "+" + (e.fragmentElement || e.fragment || e) + "@" + (r || t.defines); - if (this._compiledEffects[u]) { - var l = this._compiledEffects[u]; - return a && l.isReady() && a(l), - l - } - var h = new d.a(e,t,i,n,this,r,o,a,s,c); - return h._key = u, - this._compiledEffects[u] = h, - h - } - , - e.prototype._compileShader = function(e, t, i, n) { - return this._compileRawShader(n + (i ? i + "\n" : "") + e, t) - } - , - e.prototype._compileRawShader = function(e, t) { - var i = this._gl - , n = i.createShader("vertex" === t ? i.VERTEX_SHADER : i.FRAGMENT_SHADER); - if (!n) - throw new Error("Something went wrong while compile the shader."); - return i.shaderSource(n, e), - i.compileShader(n), - n - } - , - e.prototype.createRawShaderProgram = function(e, t, i, n, r) { - void 0 === r && (r = null), - n = n || this._gl; - var o = this._compileRawShader(t, "vertex") - , a = this._compileRawShader(i, "fragment"); - return this._createShaderProgram(e, o, a, n, r) - } - , - e.prototype.createShaderProgram = function(e, t, i, n, r, o) { - void 0 === o && (o = null), - r = r || this._gl, - this.onBeforeShaderCompilationObservable.notifyObservers(this); - var a = this._webGLVersion > 1 ? "#version 300 es\n#define WEBGL2 \n" : "" - , s = this._compileShader(t, "vertex", n, a) - , c = this._compileShader(i, "fragment", n, a) - , u = this._createShaderProgram(e, s, c, r, o); - return this.onAfterShaderCompilationObservable.notifyObservers(this), - u - } - , - e.prototype.createPipelineContext = function() { - var e = new A.a; - return e.engine = this, - this._caps.parallelShaderCompile && (e.isParallelCompiled = true), - e - } - , - e.prototype._createShaderProgram = function(e, t, i, n, r) { - void 0 === r && (r = null); - var o = n.createProgram(); - if (e.program = o, - !o) - throw new Error("Unable to create program"); - if (n.attachShader(o, t), - n.attachShader(o, i), - this.webGLVersion > 1 && r) { - var a = this.createTransformFeedback(); - this.bindTransformFeedback(a), - this.setTranformFeedbackVaryings(o, r), - e.transformFeedback = a - } - return n.linkProgram(o), - this.webGLVersion > 1 && r && this.bindTransformFeedback(null), - e.context = n, - e.vertexShader = t, - e.fragmentShader = i, - e.isParallelCompiled || this._finalizePipelineContext(e), - o - } - , - e.prototype._finalizePipelineContext = function(e) { - var t = e.context - , i = e.vertexShader - , n = e.fragmentShader - , r = e.program; - if (!t.getProgramParameter(r, t.LINK_STATUS)) { - var o, a; - if (!this._gl.getShaderParameter(i, this._gl.COMPILE_STATUS) && (o = this._gl.getShaderInfoLog(i))) - throw new Error(o); - if (!this._gl.getShaderParameter(n, this._gl.COMPILE_STATUS) && (o = this._gl.getShaderInfoLog(n))) - throw new Error(o); - if (a = t.getProgramInfoLog(r)) - throw new Error(a) - } - if (this.validateShaderPrograms && (t.validateProgram(r), - !t.getProgramParameter(r, t.VALIDATE_STATUS) && (a = t.getProgramInfoLog(r)))) - throw new Error(a); - t.deleteShader(i), - t.deleteShader(n), - e.vertexShader = void 0, - e.fragmentShader = void 0, - e.onCompiled && (e.onCompiled(), - e.onCompiled = void 0) - } - , - e.prototype._preparePipelineContext = function(e, t, i, n, r, o, a) { - var s = e; - s.program = n ? this.createRawShaderProgram(s, t, i, void 0, a) : this.createShaderProgram(s, t, i, o, void 0, a), - s.program.__SPECTOR_rebuildProgram = r - } - , - e.prototype._isRenderingStateCompiled = function(e) { - var t = e; - return !!this._gl.getProgramParameter(t.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR) && (this._finalizePipelineContext(t), - true) - } - , - e.prototype._executeWhenRenderingStateIsCompiled = function(e, t) { - var i = e; - i.isParallelCompiled ? i.onCompiled = t : t() - } - , - e.prototype.getUniforms = function(e, t) { - for (var i = new Array, n = e, r = 0; r < t.length; r++) - i.push(this._gl.getUniformLocation(n.program, t[r])); - return i - } - , - e.prototype.getAttributes = function(e, t) { - for (var i = [], n = e, r = 0; r < t.length; r++) - try { - i.push(this._gl.getAttribLocation(n.program, t[r])) - } catch (e) { - i.push(-1) - } - return i - } - , - e.prototype.enableEffect = function(e) { - e && e !== this._currentEffect && (this.bindSamplers(e), - this._currentEffect = e, - e.onBind && e.onBind(e), - e._onBindObservable && e._onBindObservable.notifyObservers(e)) - } - , - e.prototype.setIntArray = function(e, t) { - e && this._gl.uniform1iv(e, t) - } - , - e.prototype.setIntArray2 = function(e, t) { - e && t.length % 2 == 0 && this._gl.uniform2iv(e, t) - } - , - e.prototype.setIntArray3 = function(e, t) { - e && t.length % 3 == 0 && this._gl.uniform3iv(e, t) - } - , - e.prototype.setIntArray4 = function(e, t) { - e && t.length % 4 == 0 && this._gl.uniform4iv(e, t) - } - , - e.prototype.setFloatArray = function(e, t) { - e && this._gl.uniform1fv(e, t) - } - , - e.prototype.setFloatArray2 = function(e, t) { - e && t.length % 2 == 0 && this._gl.uniform2fv(e, t) - } - , - e.prototype.setFloatArray3 = function(e, t) { - e && t.length % 3 == 0 && this._gl.uniform3fv(e, t) - } - , - e.prototype.setFloatArray4 = function(e, t) { - e && t.length % 4 == 0 && this._gl.uniform4fv(e, t) - } - , - e.prototype.setArray = function(e, t) { - e && this._gl.uniform1fv(e, t) - } - , - e.prototype.setArray2 = function(e, t) { - e && t.length % 2 == 0 && this._gl.uniform2fv(e, t) - } - , - e.prototype.setArray3 = function(e, t) { - e && t.length % 3 == 0 && this._gl.uniform3fv(e, t) - } - , - e.prototype.setArray4 = function(e, t) { - e && t.length % 4 == 0 && this._gl.uniform4fv(e, t) - } - , - e.prototype.setMatrices = function(e, t) { - e && this._gl.uniformMatrix4fv(e, false, t) - } - , - e.prototype.setMatrix = function(e, t) { - e && this._gl.uniformMatrix4fv(e, false, t.toArray()) - } - , - e.prototype.setMatrix3x3 = function(e, t) { - e && this._gl.uniformMatrix3fv(e, false, t) - } - , - e.prototype.setMatrix2x2 = function(e, t) { - e && this._gl.uniformMatrix2fv(e, false, t) - } - , - e.prototype.setInt = function(e, t) { - e && this._gl.uniform1i(e, t) - } - , - e.prototype.setFloat = function(e, t) { - e && this._gl.uniform1f(e, t) - } - , - e.prototype.setFloat2 = function(e, t, i) { - e && this._gl.uniform2f(e, t, i) - } - , - e.prototype.setFloat3 = function(e, t, i, n) { - e && this._gl.uniform3f(e, t, i, n) - } - , - e.prototype.setBool = function(e, t) { - e && this._gl.uniform1i(e, t) - } - , - e.prototype.setFloat4 = function(e, t, i, n, r) { - e && this._gl.uniform4f(e, t, i, n, r) - } - , - e.prototype.setColor3 = function(e, t) { - e && this._gl.uniform3f(e, t.r, t.g, t.b) - } - , - e.prototype.setColor4 = function(e, t, i) { - e && this._gl.uniform4f(e, t.r, t.g, t.b, i) - } - , - e.prototype.setDirectColor4 = function(e, t) { - e && this._gl.uniform4f(e, t.r, t.g, t.b, t.a) - } - , - e.prototype.setState = function(e, t, i, n) { - void 0 === t && (t = 0), - void 0 === n && (n = false), - (this._depthCullingState.cull !== e || i) && (this._depthCullingState.cull = e); - var r = this.cullBackFaces ? this._gl.BACK : this._gl.FRONT; - (this._depthCullingState.cullFace !== r || i) && (this._depthCullingState.cullFace = r), - this.setZOffset(t); - var o = n ? this._gl.CW : this._gl.CCW; - (this._depthCullingState.frontFace !== o || i) && (this._depthCullingState.frontFace = o) - } - , - e.prototype.setZOffset = function(e) { - this._depthCullingState.zOffset = e - } - , - e.prototype.getZOffset = function() { - return this._depthCullingState.zOffset - } - , - e.prototype.setDepthBuffer = function(e) { - this._depthCullingState.depthTest = e - } - , - e.prototype.getDepthWrite = function() { - return this._depthCullingState.depthMask - } - , - e.prototype.setDepthWrite = function(e) { - this._depthCullingState.depthMask = e - } - , - e.prototype.setColorWrite = function(e) { - this._gl.colorMask(e, e, e, e), - this._colorWrite = e - } - , - e.prototype.getColorWrite = function() { - return this._colorWrite - } - , - e.prototype.setAlphaConstants = function(e, t, i, n) { - this._alphaState.setAlphaBlendConstants(e, t, i, n) - } - , - e.prototype.setAlphaMode = function(t, i) { - if (void 0 === i && (i = false), - this._alphaMode !== t) { - switch (t) { - case e.ALPHA_DISABLE: - this._alphaState.alphaBlend = false; - break; - case e.ALPHA_PREMULTIPLIED: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_PREMULTIPLIED_PORTERDUFF: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_COMBINE: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_ONEONE: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_ADD: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_SUBTRACT: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_MULTIPLY: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_MAXIMIZED: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_INTERPOLATE: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA), - this._alphaState.alphaBlend = true; - break; - case e.ALPHA_SCREENMODE: - this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA), - this._alphaState.alphaBlend = true - } - i || this.setDepthWrite(t === e.ALPHA_DISABLE), - this._alphaMode = t - } - } - , - e.prototype.getAlphaMode = function() { - return this._alphaMode - } - , - e.prototype.clearInternalTexturesCache = function() { - this._internalTexturesCache = [] - } - , - e.prototype.wipeCaches = function(e) { - this.preventCacheWipeBetweenFrames && !e || (this._currentEffect = null, - this._viewportCached.x = 0, - this._viewportCached.y = 0, - this._viewportCached.z = 0, - this._viewportCached.w = 0, - e && (this.resetTextureCache(), - this._currentProgram = null, - this._stencilState.reset(), - this._depthCullingState.reset(), - this.setDepthFunctionToLessOrEqual(), - this._alphaState.reset(), - this._unpackFlipYCached = null), - this._resetVertexBufferBinding(), - this._cachedIndexBuffer = null, - this._cachedEffectForVertexBuffers = null, + (this._cachedVertexBuffers = null), + (this._cachedIndexBuffer = null), + (this._uintIndicesCurrentlySet = + null != t && t.is32Bits), + (this._mustWipeVertexAttributes = true)); + }), + (e.prototype.bindBuffersDirectly = function ( + e, + t, + i, + n, + r + ) { + if ( + this._cachedVertexBuffers !== e || + this._cachedEffectForVertexBuffers !== r + ) { + (this._cachedVertexBuffers = e), + (this._cachedEffectForVertexBuffers = r); + var o = r.getAttributesCount(); this._unbindVertexArrayObject(), - this.bindIndexBuffer(null)) - } - , - e.prototype.setTextureFormatToUse = function(e) { - for (var t = 0, i = this.texturesSupported.length; t < i; t++) - for (var n = 0, r = e.length; n < r; n++) - if (this._texturesSupported[t] === e[n].toLowerCase()) - return this._textureFormatInUse = this._texturesSupported[t]; - return this._textureFormatInUse = null, - null - } - , - e.prototype._getSamplingParameters = function(t, i) { - var n = this._gl - , r = n.NEAREST - , o = n.NEAREST; + this.unbindAllAttributes(); + for (var a = 0, s = 0; s < o; s++) + if (s < i.length) { + var c = r.getAttributeLocation(s); + c >= 0 && + (this._gl.enableVertexAttribArray(c), + (this._vertexAttribArraysEnabled[c] = true), + this._vertexAttribPointer( + e, + c, + i[s], + this._gl.FLOAT, + false, + n, + a + )), + (a += 4 * i[s]); + } + } + this._bindIndexBufferWithCache(t); + }), + (e.prototype._unbindVertexArrayObject = function () { + this._cachedVertexArrayObject && + ((this._cachedVertexArrayObject = null), + this._gl.bindVertexArray(null)); + }), + (e.prototype.bindBuffers = function (e, t, i) { + (this._cachedVertexBuffers === e && + this._cachedEffectForVertexBuffers === i) || + ((this._cachedVertexBuffers = e), + (this._cachedEffectForVertexBuffers = i), + this._bindVertexBuffersAttributes(e, i)), + this._bindIndexBufferWithCache(t); + }), + (e.prototype.unbindInstanceAttributes = function () { + for ( + var e, t = 0, i = this._currentInstanceLocations.length; + t < i; + t++ + ) { + var n = this._currentInstanceBuffers[t]; + e != n && + n.references && + ((e = n), this.bindArrayBuffer(n)); + var r = this._currentInstanceLocations[t]; + this._gl.vertexAttribDivisor(r, 0); + } + (this._currentInstanceBuffers.length = 0), + (this._currentInstanceLocations.length = 0); + }), + (e.prototype.releaseVertexArrayObject = function (e) { + this._gl.deleteVertexArray(e); + }), + (e.prototype._releaseBuffer = function (e) { + return ( + e.references--, + 0 === e.references && + (this._gl.deleteBuffer(e.underlyingResource), true) + ); + }), + (e.prototype.createInstancesBuffer = function (e) { + var t = this._gl.createBuffer(); + if (!t) + throw new Error("Unable to create instance buffer"); + var i = new x.a(t); + return ( + (i.capacity = e), + this.bindArrayBuffer(i), + this._gl.bufferData( + this._gl.ARRAY_BUFFER, + e, + this._gl.DYNAMIC_DRAW + ), + i + ); + }), + (e.prototype.deleteInstancesBuffer = function (e) { + this._gl.deleteBuffer(e); + }), + (e.prototype.updateAndBindInstancesBuffer = function ( + e, + t, + i + ) { + if ( + (this.bindArrayBuffer(e), + t && + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, t), + void 0 !== i[0].index) + ) { + for (var n = 0, r = 0; r < i.length; r++) + n += 4 * (o = i[r]).attributeSize; + for (r = 0; r < i.length; r++) { + var o = i[r]; + this._vertexAttribArraysEnabled[o.index] || + (this._gl.enableVertexAttribArray(o.index), + (this._vertexAttribArraysEnabled[o.index] = true)), + this._vertexAttribPointer( + e, + o.index, + o.attributeSize, + o.attribyteType || this._gl.FLOAT, + o.normalized || false, + n, + o.offset + ), + this._gl.vertexAttribDivisor(o.index, 1), + this._currentInstanceLocations.push(o.index), + this._currentInstanceBuffers.push(e); + } + } else + for (var a = 0; a < 4; a++) { + var s = i[a]; + this._vertexAttribArraysEnabled[s] || + (this._gl.enableVertexAttribArray(s), + (this._vertexAttribArraysEnabled[s] = true)), + this._vertexAttribPointer( + e, + s, + 4, + this._gl.FLOAT, + false, + 64, + 16 * a + ), + this._gl.vertexAttribDivisor(s, 1), + this._currentInstanceLocations.push(s), + this._currentInstanceBuffers.push(e); + } + }), + (e.prototype.applyStates = function () { + this._depthCullingState.apply(this._gl), + this._stencilState.apply(this._gl), + this._alphaState.apply(this._gl); + }), + (e.prototype.draw = function (e, t, i, n) { + this.drawElementsType( + e ? p.a.TriangleFillMode : p.a.WireFrameFillMode, + t, + i, + n + ); + }), + (e.prototype.drawPointClouds = function (e, t, i) { + this.drawArraysType(p.a.PointFillMode, e, t, i); + }), + (e.prototype.drawUnIndexed = function (e, t, i, n) { + this.drawArraysType( + e ? p.a.TriangleFillMode : p.a.WireFrameFillMode, + t, + i, + n + ); + }), + (e.prototype.drawElementsType = function (e, t, i, n) { + this.applyStates(), this._drawCalls.addCount(1, false); + var r = this._drawMode(e), + o = this._uintIndicesCurrentlySet + ? this._gl.UNSIGNED_INT + : this._gl.UNSIGNED_SHORT, + a = this._uintIndicesCurrentlySet ? 4 : 2; + n + ? this._gl.drawElementsInstanced(r, i, o, t * a, n) + : this._gl.drawElements(r, i, o, t * a); + }), + (e.prototype.drawArraysType = function (e, t, i, n) { + this.applyStates(), this._drawCalls.addCount(1, false); + var r = this._drawMode(e); + n + ? this._gl.drawArraysInstanced(r, t, i, n) + : this._gl.drawArrays(r, t, i); + }), + (e.prototype._drawMode = function (e) { + switch (e) { + case p.a.TriangleFillMode: + return this._gl.TRIANGLES; + case p.a.PointFillMode: + return this._gl.POINTS; + case p.a.WireFrameFillMode: + return this._gl.LINES; + case p.a.PointListDrawMode: + return this._gl.POINTS; + case p.a.LineListDrawMode: + return this._gl.LINES; + case p.a.LineLoopDrawMode: + return this._gl.LINE_LOOP; + case p.a.LineStripDrawMode: + return this._gl.LINE_STRIP; + case p.a.TriangleStripDrawMode: + return this._gl.TRIANGLE_STRIP; + case p.a.TriangleFanDrawMode: + return this._gl.TRIANGLE_FAN; + default: + return this._gl.TRIANGLES; + } + }), + (e.prototype._releaseEffect = function (e) { + this._compiledEffects[e._key] && + (delete this._compiledEffects[e._key], + this._deletePipelineContext(e.getPipelineContext())); + }), + (e.prototype._deletePipelineContext = function (e) { + var t = e; + t && + t.program && + ((t.program.__SPECTOR_rebuildProgram = null), + t.transformFeedback && + (this.deleteTransformFeedback(t.transformFeedback), + (t.transformFeedback = null)), + this._gl.deleteProgram(t.program)); + }), + (e.prototype.createEffect = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u = + (e.vertexElement || e.vertex || e) + + "+" + + (e.fragmentElement || e.fragment || e) + + "@" + + (r || t.defines); + if (this._compiledEffects[u]) { + var l = this._compiledEffects[u]; + return a && l.isReady() && a(l), l; + } + var h = new d.a(e, t, i, n, this, r, o, a, s, c); + return (h._key = u), (this._compiledEffects[u] = h), h; + }), + (e.prototype._compileShader = function (e, t, i, n) { + return this._compileRawShader( + n + (i ? i + "\n" : "") + e, + t + ); + }), + (e.prototype._compileRawShader = function (e, t) { + var i = this._gl, + n = i.createShader( + "vertex" === t ? i.VERTEX_SHADER : i.FRAGMENT_SHADER + ); + if (!n) + throw new Error( + "Something went wrong while compile the shader." + ); + return i.shaderSource(n, e), i.compileShader(n), n; + }), + (e.prototype.createRawShaderProgram = function ( + e, + t, + i, + n, + r + ) { + void 0 === r && (r = null), (n = n || this._gl); + var o = this._compileRawShader(t, "vertex"), + a = this._compileRawShader(i, "fragment"); + return this._createShaderProgram(e, o, a, n, r); + }), + (e.prototype.createShaderProgram = function ( + e, + t, + i, + n, + r, + o + ) { + void 0 === o && (o = null), + (r = r || this._gl), + this.onBeforeShaderCompilationObservable.notifyObservers( + this + ); + var a = + this._webGLVersion > 1 + ? "#version 300 es\n#define WEBGL2 \n" + : "", + s = this._compileShader(t, "vertex", n, a), + c = this._compileShader(i, "fragment", n, a), + u = this._createShaderProgram(e, s, c, r, o); + return ( + this.onAfterShaderCompilationObservable.notifyObservers( + this + ), + u + ); + }), + (e.prototype.createPipelineContext = function () { + var e = new A.a(); + return ( + (e.engine = this), + this._caps.parallelShaderCompile && + (e.isParallelCompiled = true), + e + ); + }), + (e.prototype._createShaderProgram = function ( + e, + t, + i, + n, + r + ) { + void 0 === r && (r = null); + var o = n.createProgram(); + if (((e.program = o), !o)) + throw new Error("Unable to create program"); + if ( + (n.attachShader(o, t), + n.attachShader(o, i), + this.webGLVersion > 1 && r) + ) { + var a = this.createTransformFeedback(); + this.bindTransformFeedback(a), + this.setTranformFeedbackVaryings(o, r), + (e.transformFeedback = a); + } + return ( + n.linkProgram(o), + this.webGLVersion > 1 && + r && + this.bindTransformFeedback(null), + (e.context = n), + (e.vertexShader = t), + (e.fragmentShader = i), + e.isParallelCompiled || + this._finalizePipelineContext(e), + o + ); + }), + (e.prototype._finalizePipelineContext = function (e) { + var t = e.context, + i = e.vertexShader, + n = e.fragmentShader, + r = e.program; + if (!t.getProgramParameter(r, t.LINK_STATUS)) { + var o, a; + if ( + !this._gl.getShaderParameter( + i, + this._gl.COMPILE_STATUS + ) && + (o = this._gl.getShaderInfoLog(i)) + ) + throw new Error(o); + if ( + !this._gl.getShaderParameter( + n, + this._gl.COMPILE_STATUS + ) && + (o = this._gl.getShaderInfoLog(n)) + ) + throw new Error(o); + if ((a = t.getProgramInfoLog(r))) throw new Error(a); + } + if ( + this.validateShaderPrograms && + (t.validateProgram(r), + !t.getProgramParameter(r, t.VALIDATE_STATUS) && + (a = t.getProgramInfoLog(r))) + ) + throw new Error(a); + t.deleteShader(i), + t.deleteShader(n), + (e.vertexShader = void 0), + (e.fragmentShader = void 0), + e.onCompiled && + (e.onCompiled(), (e.onCompiled = void 0)); + }), + (e.prototype._preparePipelineContext = function ( + e, + t, + i, + n, + r, + o, + a + ) { + var s = e; + (s.program = n + ? this.createRawShaderProgram(s, t, i, void 0, a) + : this.createShaderProgram(s, t, i, o, void 0, a)), + (s.program.__SPECTOR_rebuildProgram = r); + }), + (e.prototype._isRenderingStateCompiled = function (e) { + var t = e; + return ( + !!this._gl.getProgramParameter( + t.program, + this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR + ) && (this._finalizePipelineContext(t), true) + ); + }), + (e.prototype._executeWhenRenderingStateIsCompiled = + function (e, t) { + var i = e; + i.isParallelCompiled ? (i.onCompiled = t) : t(); + }), + (e.prototype.getUniforms = function (e, t) { + for (var i = new Array(), n = e, r = 0; r < t.length; r++) + i.push(this._gl.getUniformLocation(n.program, t[r])); + return i; + }), + (e.prototype.getAttributes = function (e, t) { + for (var i = [], n = e, r = 0; r < t.length; r++) + try { + i.push(this._gl.getAttribLocation(n.program, t[r])); + } catch (e) { + i.push(-1); + } + return i; + }), + (e.prototype.enableEffect = function (e) { + e && + e !== this._currentEffect && + (this.bindSamplers(e), + (this._currentEffect = e), + e.onBind && e.onBind(e), + e._onBindObservable && + e._onBindObservable.notifyObservers(e)); + }), + (e.prototype.setIntArray = function (e, t) { + e && this._gl.uniform1iv(e, t); + }), + (e.prototype.setIntArray2 = function (e, t) { + e && t.length % 2 == 0 && this._gl.uniform2iv(e, t); + }), + (e.prototype.setIntArray3 = function (e, t) { + e && t.length % 3 == 0 && this._gl.uniform3iv(e, t); + }), + (e.prototype.setIntArray4 = function (e, t) { + e && t.length % 4 == 0 && this._gl.uniform4iv(e, t); + }), + (e.prototype.setFloatArray = function (e, t) { + e && this._gl.uniform1fv(e, t); + }), + (e.prototype.setFloatArray2 = function (e, t) { + e && t.length % 2 == 0 && this._gl.uniform2fv(e, t); + }), + (e.prototype.setFloatArray3 = function (e, t) { + e && t.length % 3 == 0 && this._gl.uniform3fv(e, t); + }), + (e.prototype.setFloatArray4 = function (e, t) { + e && t.length % 4 == 0 && this._gl.uniform4fv(e, t); + }), + (e.prototype.setArray = function (e, t) { + e && this._gl.uniform1fv(e, t); + }), + (e.prototype.setArray2 = function (e, t) { + e && t.length % 2 == 0 && this._gl.uniform2fv(e, t); + }), + (e.prototype.setArray3 = function (e, t) { + e && t.length % 3 == 0 && this._gl.uniform3fv(e, t); + }), + (e.prototype.setArray4 = function (e, t) { + e && t.length % 4 == 0 && this._gl.uniform4fv(e, t); + }), + (e.prototype.setMatrices = function (e, t) { + e && this._gl.uniformMatrix4fv(e, false, t); + }), + (e.prototype.setMatrix = function (e, t) { + e && this._gl.uniformMatrix4fv(e, false, t.toArray()); + }), + (e.prototype.setMatrix3x3 = function (e, t) { + e && this._gl.uniformMatrix3fv(e, false, t); + }), + (e.prototype.setMatrix2x2 = function (e, t) { + e && this._gl.uniformMatrix2fv(e, false, t); + }), + (e.prototype.setInt = function (e, t) { + e && this._gl.uniform1i(e, t); + }), + (e.prototype.setFloat = function (e, t) { + e && this._gl.uniform1f(e, t); + }), + (e.prototype.setFloat2 = function (e, t, i) { + e && this._gl.uniform2f(e, t, i); + }), + (e.prototype.setFloat3 = function (e, t, i, n) { + e && this._gl.uniform3f(e, t, i, n); + }), + (e.prototype.setBool = function (e, t) { + e && this._gl.uniform1i(e, t); + }), + (e.prototype.setFloat4 = function (e, t, i, n, r) { + e && this._gl.uniform4f(e, t, i, n, r); + }), + (e.prototype.setColor3 = function (e, t) { + e && this._gl.uniform3f(e, t.r, t.g, t.b); + }), + (e.prototype.setColor4 = function (e, t, i) { + e && this._gl.uniform4f(e, t.r, t.g, t.b, i); + }), + (e.prototype.setDirectColor4 = function (e, t) { + e && this._gl.uniform4f(e, t.r, t.g, t.b, t.a); + }), + (e.prototype.setState = function (e, t, i, n) { + void 0 === t && (t = 0), + void 0 === n && (n = false), + (this._depthCullingState.cull !== e || i) && + (this._depthCullingState.cull = e); + var r = this.cullBackFaces + ? this._gl.BACK + : this._gl.FRONT; + (this._depthCullingState.cullFace !== r || i) && + (this._depthCullingState.cullFace = r), + this.setZOffset(t); + var o = n ? this._gl.CW : this._gl.CCW; + (this._depthCullingState.frontFace !== o || i) && + (this._depthCullingState.frontFace = o); + }), + (e.prototype.setZOffset = function (e) { + this._depthCullingState.zOffset = e; + }), + (e.prototype.getZOffset = function () { + return this._depthCullingState.zOffset; + }), + (e.prototype.setDepthBuffer = function (e) { + this._depthCullingState.depthTest = e; + }), + (e.prototype.getDepthWrite = function () { + return this._depthCullingState.depthMask; + }), + (e.prototype.setDepthWrite = function (e) { + this._depthCullingState.depthMask = e; + }), + (e.prototype.setColorWrite = function (e) { + this._gl.colorMask(e, e, e, e), (this._colorWrite = e); + }), + (e.prototype.getColorWrite = function () { + return this._colorWrite; + }), + (e.prototype.setAlphaConstants = function (e, t, i, n) { + this._alphaState.setAlphaBlendConstants(e, t, i, n); + }), + (e.prototype.setAlphaMode = function (t, i) { + if ( + (void 0 === i && (i = false), this._alphaMode !== t) + ) { switch (t) { + case e.ALPHA_DISABLE: + this._alphaState.alphaBlend = false; + break; + case e.ALPHA_PREMULTIPLIED: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.ONE, + this._gl.ONE_MINUS_SRC_ALPHA, + this._gl.ONE, + this._gl.ONE + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_PREMULTIPLIED_PORTERDUFF: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.ONE, + this._gl.ONE_MINUS_SRC_ALPHA, + this._gl.ONE, + this._gl.ONE_MINUS_SRC_ALPHA + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_COMBINE: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.SRC_ALPHA, + this._gl.ONE_MINUS_SRC_ALPHA, + this._gl.ONE, + this._gl.ONE + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_ONEONE: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.ONE, + this._gl.ONE, + this._gl.ZERO, + this._gl.ONE + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_ADD: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.SRC_ALPHA, + this._gl.ONE, + this._gl.ZERO, + this._gl.ONE + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_SUBTRACT: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.ZERO, + this._gl.ONE_MINUS_SRC_COLOR, + this._gl.ONE, + this._gl.ONE + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_MULTIPLY: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.DST_COLOR, + this._gl.ZERO, + this._gl.ONE, + this._gl.ONE + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_MAXIMIZED: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.SRC_ALPHA, + this._gl.ONE_MINUS_SRC_COLOR, + this._gl.ONE, + this._gl.ONE + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_INTERPOLATE: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.CONSTANT_COLOR, + this._gl.ONE_MINUS_CONSTANT_COLOR, + this._gl.CONSTANT_ALPHA, + this._gl.ONE_MINUS_CONSTANT_ALPHA + ), + (this._alphaState.alphaBlend = true); + break; + case e.ALPHA_SCREENMODE: + this._alphaState.setAlphaBlendFunctionParameters( + this._gl.ONE, + this._gl.ONE_MINUS_SRC_COLOR, + this._gl.ONE, + this._gl.ONE_MINUS_SRC_ALPHA + ), + (this._alphaState.alphaBlend = true); + } + i || this.setDepthWrite(t === e.ALPHA_DISABLE), + (this._alphaMode = t); + } + }), + (e.prototype.getAlphaMode = function () { + return this._alphaMode; + }), + (e.prototype.clearInternalTexturesCache = function () { + this._internalTexturesCache = []; + }), + (e.prototype.wipeCaches = function (e) { + (this.preventCacheWipeBetweenFrames && !e) || + ((this._currentEffect = null), + (this._viewportCached.x = 0), + (this._viewportCached.y = 0), + (this._viewportCached.z = 0), + (this._viewportCached.w = 0), + e && + (this.resetTextureCache(), + (this._currentProgram = null), + this._stencilState.reset(), + this._depthCullingState.reset(), + this.setDepthFunctionToLessOrEqual(), + this._alphaState.reset(), + (this._unpackFlipYCached = null)), + this._resetVertexBufferBinding(), + (this._cachedIndexBuffer = null), + (this._cachedEffectForVertexBuffers = null), + this._unbindVertexArrayObject(), + this.bindIndexBuffer(null)); + }), + (e.prototype.setTextureFormatToUse = function (e) { + for ( + var t = 0, i = this.texturesSupported.length; + t < i; + t++ + ) + for (var n = 0, r = e.length; n < r; n++) + if (this._texturesSupported[t] === e[n].toLowerCase()) + return (this._textureFormatInUse = + this._texturesSupported[t]); + return (this._textureFormatInUse = null), null; + }), + (e.prototype._getSamplingParameters = function (t, i) { + var n = this._gl, + r = n.NEAREST, + o = n.NEAREST; + switch (t) { case e.TEXTURE_BILINEAR_SAMPLINGMODE: - r = n.LINEAR, - o = i ? n.LINEAR_MIPMAP_NEAREST : n.LINEAR; - break; + (r = n.LINEAR), + (o = i ? n.LINEAR_MIPMAP_NEAREST : n.LINEAR); + break; case e.TEXTURE_TRILINEAR_SAMPLINGMODE: - r = n.LINEAR, - o = i ? n.LINEAR_MIPMAP_LINEAR : n.LINEAR; - break; + (r = n.LINEAR), + (o = i ? n.LINEAR_MIPMAP_LINEAR : n.LINEAR); + break; case e.TEXTURE_NEAREST_SAMPLINGMODE: - r = n.NEAREST, - o = i ? n.NEAREST_MIPMAP_LINEAR : n.NEAREST; - break; + (r = n.NEAREST), + (o = i ? n.NEAREST_MIPMAP_LINEAR : n.NEAREST); + break; case e.TEXTURE_NEAREST_NEAREST_MIPNEAREST: - r = n.NEAREST, - o = i ? n.NEAREST_MIPMAP_NEAREST : n.NEAREST; - break; + (r = n.NEAREST), + (o = i ? n.NEAREST_MIPMAP_NEAREST : n.NEAREST); + break; case e.TEXTURE_NEAREST_LINEAR_MIPNEAREST: - r = n.NEAREST, - o = i ? n.LINEAR_MIPMAP_NEAREST : n.LINEAR; - break; + (r = n.NEAREST), + (o = i ? n.LINEAR_MIPMAP_NEAREST : n.LINEAR); + break; case e.TEXTURE_NEAREST_LINEAR_MIPLINEAR: - r = n.NEAREST, - o = i ? n.LINEAR_MIPMAP_LINEAR : n.LINEAR; - break; + (r = n.NEAREST), + (o = i ? n.LINEAR_MIPMAP_LINEAR : n.LINEAR); + break; case e.TEXTURE_NEAREST_LINEAR: - r = n.NEAREST, - o = n.LINEAR; - break; + (r = n.NEAREST), (o = n.LINEAR); + break; case e.TEXTURE_NEAREST_NEAREST: - r = n.NEAREST, - o = n.NEAREST; - break; + (r = n.NEAREST), (o = n.NEAREST); + break; case e.TEXTURE_LINEAR_NEAREST_MIPNEAREST: - r = n.LINEAR, - o = i ? n.NEAREST_MIPMAP_NEAREST : n.NEAREST; - break; + (r = n.LINEAR), + (o = i ? n.NEAREST_MIPMAP_NEAREST : n.NEAREST); + break; case e.TEXTURE_LINEAR_NEAREST_MIPLINEAR: - r = n.LINEAR, - o = i ? n.NEAREST_MIPMAP_LINEAR : n.NEAREST; - break; + (r = n.LINEAR), + (o = i ? n.NEAREST_MIPMAP_LINEAR : n.NEAREST); + break; case e.TEXTURE_LINEAR_LINEAR: - r = n.LINEAR, - o = n.LINEAR; - break; + (r = n.LINEAR), (o = n.LINEAR); + break; case e.TEXTURE_LINEAR_NEAREST: - r = n.LINEAR, - o = n.NEAREST - } - return { - min: o, - mag: r - } - } - , - e.prototype._createTexture = function() { - var e = this._gl.createTexture(); - if (!e) - throw new Error("Unable to create texture"); - return e - } - , - e.prototype.createTexture = function(t, i, n, r, o, a, s, c, u, h, f, d) { - var p = this; - void 0 === o && (o = e.TEXTURE_TRILINEAR_SAMPLINGMODE), + (r = n.LINEAR), (o = n.NEAREST); + } + return { + min: o, + mag: r, + }; + }), + (e.prototype._createTexture = function () { + var e = this._gl.createTexture(); + if (!e) throw new Error("Unable to create texture"); + return e; + }), + (e.prototype.createTexture = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u, + h, + f, + d + ) { + var p = this; + void 0 === o && (o = e.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === a && (a = null), void 0 === s && (s = null), void 0 === c && (c = null), @@ -29980,805 +36061,1713 @@ and limitations under the License. void 0 === h && (h = null), void 0 === f && (f = null), void 0 === d && (d = []); - for (var g = String(t), _ = "data:" === g.substr(0, 5), v = "blob:" === g.substr(0, 5), y = _ && -1 !== g.indexOf(";base64,"), b = u || new m.a(this,m.a.DATASOURCE_URL), E = g.lastIndexOf("."), T = f || (E > -1 ? g.substring(E).toLowerCase() : ""), A = null, x = 0, S = e._TextureLoaders; x < S.length; x++) { - var C = S[x]; - if (-1 === d.indexOf(C) && C.canLoad(T, this._textureFormatInUse, u, y, !!c)) { - A = C; - break - } + for ( + var g = String(t), + _ = "data:" === g.substr(0, 5), + v = "blob:" === g.substr(0, 5), + y = _ && -1 !== g.indexOf(";base64,"), + b = u || new m.a(this, m.a.DATASOURCE_URL), + E = g.lastIndexOf("."), + T = f || (E > -1 ? g.substring(E).toLowerCase() : ""), + A = null, + x = 0, + S = e._TextureLoaders; + x < S.length; + x++ + ) { + var C = S[x]; + if ( + -1 === d.indexOf(C) && + C.canLoad(T, this._textureFormatInUse, u, y, !!c) + ) { + A = C; + break; } - A && (g = A.transformUrl(g, this._textureFormatInUse)), + } + A && (g = A.transformUrl(g, this._textureFormatInUse)), r && r._addPendingData(b), - b.url = g, - b.generateMipMaps = !i, - b.samplingMode = o, - b.invertY = n, + (b.url = g), + (b.generateMipMaps = !i), + (b.samplingMode = o), + (b.invertY = n), this._doNotHandleContextLost || (b._buffer = c); - var P = null; - a && !u && (P = b.onLoadedObservable.add(a)), + var P = null; + a && !u && (P = b.onLoadedObservable.add(a)), u || this._internalTexturesCache.push(b); - var R = function(e, n) { - r && r._removePendingData(b); - var a = false; - A && A.getFallbackTextureUrl(g, p._textureFormatInUse) && (a = true, - d.push(A), - l.h.Warn(A.constructor.name + " failed when trying to load " + b.url + ", falling back to the next supported loader"), - p.createTexture(t, i, b.invertY, r, o, null, null, c, b, void 0, void 0, d)), - a || (P && b.onLoadedObservable.remove(P), - l.h.UseFallbackTexture && p.createTexture(l.h.fallbackTexture, i, b.invertY, r, o, null, null, c, b)), - s && s(e || "Unknown error", n) + var R = function (e, n) { + r && r._removePendingData(b); + var a = false; + A && + A.getFallbackTextureUrl(g, p._textureFormatInUse) && + ((a = true), + d.push(A), + l.h.Warn( + A.constructor.name + + " failed when trying to load " + + b.url + + ", falling back to the next supported loader" + ), + p.createTexture( + t, + i, + b.invertY, + r, + o, + null, + null, + c, + b, + void 0, + void 0, + d + )), + a || + (P && b.onLoadedObservable.remove(P), + l.h.UseFallbackTexture && + p.createTexture( + l.h.fallbackTexture, + i, + b.invertY, + r, + o, + null, + null, + c, + b + )), + s && s(e || "Unknown error", n); + }; + if (A) { + var M = function (e) { + A.loadData(e, b, function (e, t, i, n, a, s) { + s + ? R("TextureLoader failed to load data") + : p._prepareWebGLTexture( + b, + r, + e, + t, + b.invertY, + !i, + n, + function () { + return a(), false; + }, + o + ); + }); }; - if (A) { - var M = function(e) { - A.loadData(e, b, function(e, t, i, n, a, s) { - s ? R("TextureLoader failed to load data") : p._prepareWebGLTexture(b, r, e, t, b.invertY, !i, n, function() { - return a(), - false - }, o) - }) - }; - c ? M(c) : this._loadFile(g, M, void 0, r ? r.offlineProvider : void 0, true, function(e, t) { - R("Unable to load " + (e && e.responseURL, - t)) - }) - } else { - var O = function(t) { - v && !p._doNotHandleContextLost && (b._buffer = t), - p._prepareWebGLTexture(b, r, t.width, t.height, b.invertY, i, false, function(i, n, o) { - var a = p._gl - , s = t.width === i && t.height === n - , c = h ? p._getInternalFormat(h) : ".jpg" === T ? a.RGB : a.RGBA; - if (s) - return a.texImage2D(a.TEXTURE_2D, 0, c, c, a.UNSIGNED_BYTE, t), - false; - var u = p._caps.maxTextureSize; - if (t.width > u || t.height > u || null === e._RescalePostProcessFactory) - return p._prepareWorkingCanvas(), - !(!p._workingCanvas || !p._workingContext || (p._workingCanvas.width = i, - p._workingCanvas.height = n, - p._workingContext.drawImage(t, 0, 0, t.width, t.height, 0, 0, i, n), - a.texImage2D(a.TEXTURE_2D, 0, c, c, a.UNSIGNED_BYTE, p._workingCanvas), - b.width = i, - b.height = n, - 1)); - var l = new m.a(p,m.a.DATASOURCE_TEMP); - return p._bindTextureDirectly(a.TEXTURE_2D, l, true), - a.texImage2D(a.TEXTURE_2D, 0, c, c, a.UNSIGNED_BYTE, t), - a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER, a.LINEAR), - a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, a.LINEAR), - a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE), - a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE), - p._rescaleTexture(l, b, r, c, function() { - p._releaseTexture(l), - p._bindTextureDirectly(a.TEXTURE_2D, b, true), - o() - }), - true - }, o) - }; - !_ || y ? c instanceof HTMLImageElement ? O(c) : l.h.LoadImage(g, O, R, r ? r.offlineProvider : null) : "string" == typeof c || c instanceof ArrayBuffer || c instanceof Blob ? l.h.LoadImage(c, O, R, r ? r.offlineProvider : null) : O(c) - } - return b - } - , - e.prototype._rescaleTexture = function(t, i, n, r, o) { - var a = this - , s = this.createRenderTargetTexture({ + c + ? M(c) + : this._loadFile( + g, + M, + void 0, + r ? r.offlineProvider : void 0, + true, + function (e, t) { + R("Unable to load " + (e && e.responseURL, t)); + } + ); + } else { + var O = function (t) { + v && !p._doNotHandleContextLost && (b._buffer = t), + p._prepareWebGLTexture( + b, + r, + t.width, + t.height, + b.invertY, + i, + false, + function (i, n, o) { + var a = p._gl, + s = t.width === i && t.height === n, + c = h + ? p._getInternalFormat(h) + : ".jpg" === T + ? a.RGB + : a.RGBA; + if (s) + return ( + a.texImage2D( + a.TEXTURE_2D, + 0, + c, + c, + a.UNSIGNED_BYTE, + t + ), + false + ); + var u = p._caps.maxTextureSize; + if ( + t.width > u || + t.height > u || + null === e._RescalePostProcessFactory + ) + return ( + p._prepareWorkingCanvas(), + !( + !p._workingCanvas || + !p._workingContext || + ((p._workingCanvas.width = i), + (p._workingCanvas.height = n), + p._workingContext.drawImage( + t, + 0, + 0, + t.width, + t.height, + 0, + 0, + i, + n + ), + a.texImage2D( + a.TEXTURE_2D, + 0, + c, + c, + a.UNSIGNED_BYTE, + p._workingCanvas + ), + (b.width = i), + (b.height = n), + 1) + ) + ); + var l = new m.a(p, m.a.DATASOURCE_TEMP); + return ( + p._bindTextureDirectly(a.TEXTURE_2D, l, true), + a.texImage2D( + a.TEXTURE_2D, + 0, + c, + c, + a.UNSIGNED_BYTE, + t + ), + a.texParameteri( + a.TEXTURE_2D, + a.TEXTURE_MAG_FILTER, + a.LINEAR + ), + a.texParameteri( + a.TEXTURE_2D, + a.TEXTURE_MIN_FILTER, + a.LINEAR + ), + a.texParameteri( + a.TEXTURE_2D, + a.TEXTURE_WRAP_S, + a.CLAMP_TO_EDGE + ), + a.texParameteri( + a.TEXTURE_2D, + a.TEXTURE_WRAP_T, + a.CLAMP_TO_EDGE + ), + p._rescaleTexture(l, b, r, c, function () { + p._releaseTexture(l), + p._bindTextureDirectly( + a.TEXTURE_2D, + b, + true + ), + o(); + }), + true + ); + }, + o + ); + }; + !_ || y + ? c instanceof HTMLImageElement + ? O(c) + : l.h.LoadImage( + g, + O, + R, + r ? r.offlineProvider : null + ) + : "string" == typeof c || + c instanceof ArrayBuffer || + c instanceof Blob + ? l.h.LoadImage(c, O, R, r ? r.offlineProvider : null) + : O(c); + } + return b; + }), + (e.prototype._rescaleTexture = function (t, i, n, r, o) { + var a = this, + s = this.createRenderTargetTexture( + { width: i.width, - height: i.height - }, { + height: i.height, + }, + { generateMipMaps: false, type: e.TEXTURETYPE_UNSIGNED_INT, samplingMode: e.TEXTURE_BILINEAR_SAMPLINGMODE, generateDepthBuffer: false, - generateStencilBuffer: false - }); - !this._rescalePostProcess && e._RescalePostProcessFactory && (this._rescalePostProcess = e._RescalePostProcessFactory(this)), - this._rescalePostProcess.getEffect().executeWhenCompiled(function() { - a._rescalePostProcess.onApply = function(e) { - e._bindTexture("textureSampler", t) - } - ; + generateStencilBuffer: false, + } + ); + !this._rescalePostProcess && + e._RescalePostProcessFactory && + (this._rescalePostProcess = + e._RescalePostProcessFactory(this)), + this._rescalePostProcess + .getEffect() + .executeWhenCompiled(function () { + a._rescalePostProcess.onApply = function (e) { + e._bindTexture("textureSampler", t); + }; var e = n; e || (e = a.scenes[a.scenes.length - 1]), - e.postProcessManager.directRender([a._rescalePostProcess], s, true), - a._bindTextureDirectly(a._gl.TEXTURE_2D, i, true), - a._gl.copyTexImage2D(a._gl.TEXTURE_2D, 0, r, 0, 0, i.width, i.height, 0), - a.unBindFramebuffer(s), - a._releaseTexture(s), - o && o() - }) - } - , - e.prototype.createRawTexture = function(t, i, n, r, o, a, s, c, u) { - throw void 0 === c && (c = null), + e.postProcessManager.directRender( + [a._rescalePostProcess], + s, + true + ), + a._bindTextureDirectly(a._gl.TEXTURE_2D, i, true), + a._gl.copyTexImage2D( + a._gl.TEXTURE_2D, + 0, + r, + 0, + 0, + i.width, + i.height, + 0 + ), + a.unBindFramebuffer(s), + a._releaseTexture(s), + o && o(); + }); + }), + (e.prototype.createRawTexture = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u + ) { + throw ( + (void 0 === c && (c = null), void 0 === u && (u = e.TEXTURETYPE_UNSIGNED_INT), - T.a.WarnImport("Engine.RawTexture") - } - , - e.prototype._unpackFlipY = function(e) { - this._unpackFlipYCached !== e && (this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, e ? 1 : 0), - this.enableUnpackFlipYCached && (this._unpackFlipYCached = e)) - } - , - e.prototype._getUnpackAlignement = function() { - return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT) - } - , - e.prototype.createDynamicTexture = function(e, t, i, n) { - var r = new m.a(this,m.a.DATASOURCE_DYNAMIC); - return r.baseWidth = e, - r.baseHeight = t, - i && (e = this.needPOTTextures ? l.h.GetExponentOfTwo(e, this._caps.maxTextureSize) : e, - t = this.needPOTTextures ? l.h.GetExponentOfTwo(t, this._caps.maxTextureSize) : t), - r.width = e, - r.height = t, - r.isReady = false, - r.generateMipMaps = i, - r.samplingMode = n, + T.a.WarnImport("Engine.RawTexture")) + ); + }), + (e.prototype._unpackFlipY = function (e) { + this._unpackFlipYCached !== e && + (this._gl.pixelStorei( + this._gl.UNPACK_FLIP_Y_WEBGL, + e ? 1 : 0 + ), + this.enableUnpackFlipYCached && + (this._unpackFlipYCached = e)); + }), + (e.prototype._getUnpackAlignement = function () { + return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT); + }), + (e.prototype.createDynamicTexture = function (e, t, i, n) { + var r = new m.a(this, m.a.DATASOURCE_DYNAMIC); + return ( + (r.baseWidth = e), + (r.baseHeight = t), + i && + ((e = this.needPOTTextures + ? l.h.GetExponentOfTwo(e, this._caps.maxTextureSize) + : e), + (t = this.needPOTTextures + ? l.h.GetExponentOfTwo(t, this._caps.maxTextureSize) + : t)), + (r.width = e), + (r.height = t), + (r.isReady = false), + (r.generateMipMaps = i), + (r.samplingMode = n), this.updateTextureSamplingMode(n, r), this._internalTexturesCache.push(r), r - } - , - e.prototype.updateTextureSamplingMode = function(e, t) { - var i = this._getSamplingParameters(e, t.generateMipMaps); - t.isCube ? (this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MAG_FILTER, i.mag, t), - this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MIN_FILTER, i.min), - this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null)) : t.is3D ? (this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_MAG_FILTER, i.mag, t), - this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_MIN_FILTER, i.min), - this._bindTextureDirectly(this._gl.TEXTURE_3D, null)) : (this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, i.mag, t), - this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, i.min), - this._bindTextureDirectly(this._gl.TEXTURE_2D, null)), - t.samplingMode = e - } - , - e.prototype.updateDynamicTexture = function(e, t, i, n, r, o) { - if (void 0 === n && (n = false), + ); + }), + (e.prototype.updateTextureSamplingMode = function (e, t) { + var i = this._getSamplingParameters(e, t.generateMipMaps); + t.isCube + ? (this._setTextureParameterInteger( + this._gl.TEXTURE_CUBE_MAP, + this._gl.TEXTURE_MAG_FILTER, + i.mag, + t + ), + this._setTextureParameterInteger( + this._gl.TEXTURE_CUBE_MAP, + this._gl.TEXTURE_MIN_FILTER, + i.min + ), + this._bindTextureDirectly( + this._gl.TEXTURE_CUBE_MAP, + null + )) + : t.is3D + ? (this._setTextureParameterInteger( + this._gl.TEXTURE_3D, + this._gl.TEXTURE_MAG_FILTER, + i.mag, + t + ), + this._setTextureParameterInteger( + this._gl.TEXTURE_3D, + this._gl.TEXTURE_MIN_FILTER, + i.min + ), + this._bindTextureDirectly(this._gl.TEXTURE_3D, null)) + : (this._setTextureParameterInteger( + this._gl.TEXTURE_2D, + this._gl.TEXTURE_MAG_FILTER, + i.mag, + t + ), + this._setTextureParameterInteger( + this._gl.TEXTURE_2D, + this._gl.TEXTURE_MIN_FILTER, + i.min + ), + this._bindTextureDirectly(this._gl.TEXTURE_2D, null)), + (t.samplingMode = e); + }), + (e.prototype.updateDynamicTexture = function ( + e, + t, + i, + n, + r, + o + ) { + if ( + (void 0 === n && (n = false), void 0 === o && (o = false), - e) { - this._bindTextureDirectly(this._gl.TEXTURE_2D, e, true, o), - this._unpackFlipY(i), - n && this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1); - var a = r ? this._getInternalFormat(r) : this._gl.RGBA; - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, a, a, this._gl.UNSIGNED_BYTE, t), - e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), - this._bindTextureDirectly(this._gl.TEXTURE_2D, null), - n && this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), - e.isReady = true - } - } - , - e.prototype.updateVideoTexture = function(e, t, i) { - if (e && !e._isDisabled) { - var n = this._bindTextureDirectly(this._gl.TEXTURE_2D, e, true); - this._unpackFlipY(!i); - try { - if (void 0 === this._videoTextureSupported && (this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, t), - 0 !== this._gl.getError() ? this._videoTextureSupported = false : this._videoTextureSupported = true), - this._videoTextureSupported) - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, t); - else { - if (!e._workingCanvas) { - e._workingCanvas = document.createElement("canvas"); - var r = e._workingCanvas.getContext("2d"); - if (!r) - throw new Error("Unable to get 2d context"); - e._workingContext = r, - e._workingCanvas.width = e.width, - e._workingCanvas.height = e.height - } - e._workingContext.drawImage(t, 0, 0, t.videoWidth, t.videoHeight, 0, 0, e.width, e.height), - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, e._workingCanvas) - } - e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), - n || this._bindTextureDirectly(this._gl.TEXTURE_2D, null), - e.isReady = true - } catch (t) { - e._isDisabled = true + e) + ) { + this._bindTextureDirectly( + this._gl.TEXTURE_2D, + e, + true, + o + ), + this._unpackFlipY(i), + n && + this._gl.pixelStorei( + this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, + 1 + ); + var a = r ? this._getInternalFormat(r) : this._gl.RGBA; + this._gl.texImage2D( + this._gl.TEXTURE_2D, + 0, + a, + a, + this._gl.UNSIGNED_BYTE, + t + ), + e.generateMipMaps && + this._gl.generateMipmap(this._gl.TEXTURE_2D), + this._bindTextureDirectly(this._gl.TEXTURE_2D, null), + n && + this._gl.pixelStorei( + this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, + 0 + ), + (e.isReady = true); + } + }), + (e.prototype.updateVideoTexture = function (e, t, i) { + if (e && !e._isDisabled) { + var n = this._bindTextureDirectly( + this._gl.TEXTURE_2D, + e, + true + ); + this._unpackFlipY(!i); + try { + if ( + (void 0 === this._videoTextureSupported && + (this._gl.texImage2D( + this._gl.TEXTURE_2D, + 0, + this._gl.RGBA, + this._gl.RGBA, + this._gl.UNSIGNED_BYTE, + t + ), + 0 !== this._gl.getError() + ? (this._videoTextureSupported = false) + : (this._videoTextureSupported = true)), + this._videoTextureSupported) + ) + this._gl.texImage2D( + this._gl.TEXTURE_2D, + 0, + this._gl.RGBA, + this._gl.RGBA, + this._gl.UNSIGNED_BYTE, + t + ); + else { + if (!e._workingCanvas) { + e._workingCanvas = + document.createElement("canvas"); + var r = e._workingCanvas.getContext("2d"); + if (!r) + throw new Error("Unable to get 2d context"); + (e._workingContext = r), + (e._workingCanvas.width = e.width), + (e._workingCanvas.height = e.height); } + e._workingContext.drawImage( + t, + 0, + 0, + t.videoWidth, + t.videoHeight, + 0, + 0, + e.width, + e.height + ), + this._gl.texImage2D( + this._gl.TEXTURE_2D, + 0, + this._gl.RGBA, + this._gl.RGBA, + this._gl.UNSIGNED_BYTE, + e._workingCanvas + ); + } + e.generateMipMaps && + this._gl.generateMipmap(this._gl.TEXTURE_2D), + n || + this._bindTextureDirectly( + this._gl.TEXTURE_2D, + null + ), + (e.isReady = true); + } catch (t) { + e._isDisabled = true; } - } - , - e.prototype.updateTextureComparisonFunction = function(t, i) { - if (1 !== this.webGLVersion) { - var n = this._gl; - t.isCube ? (this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, t, true), - 0 === i ? (n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_COMPARE_FUNC, e.LEQUAL), - n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_COMPARE_MODE, n.NONE)) : (n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_COMPARE_FUNC, i), - n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_COMPARE_MODE, n.COMPARE_REF_TO_TEXTURE)), - this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null)) : (this._bindTextureDirectly(this._gl.TEXTURE_2D, t, true), - 0 === i ? (n.texParameteri(n.TEXTURE_2D, n.TEXTURE_COMPARE_FUNC, e.LEQUAL), - n.texParameteri(n.TEXTURE_2D, n.TEXTURE_COMPARE_MODE, n.NONE)) : (n.texParameteri(n.TEXTURE_2D, n.TEXTURE_COMPARE_FUNC, i), - n.texParameteri(n.TEXTURE_2D, n.TEXTURE_COMPARE_MODE, n.COMPARE_REF_TO_TEXTURE)), - this._bindTextureDirectly(this._gl.TEXTURE_2D, null)), - t._comparisonFunction = i - } else - y.a.Error("WebGL 1 does not support texture comparison.") - } - , - e.prototype._setupDepthStencilTexture = function(t, i, n, r, o) { - var a = i.width || i - , s = i.height || i; - t.baseWidth = a, - t.baseHeight = s, - t.width = a, - t.height = s, - t.isReady = true, - t.samples = 1, - t.generateMipMaps = false, - t._generateDepthBuffer = true, - t._generateStencilBuffer = n, - t.samplingMode = r ? e.TEXTURE_BILINEAR_SAMPLINGMODE : e.TEXTURE_NEAREST_SAMPLINGMODE, - t.type = e.TEXTURETYPE_UNSIGNED_INT, - t._comparisonFunction = o; - var c = this._gl - , u = t.isCube ? c.TEXTURE_CUBE_MAP : c.TEXTURE_2D - , l = this._getSamplingParameters(t.samplingMode, false); - c.texParameteri(u, c.TEXTURE_MAG_FILTER, l.mag), + } + }), + (e.prototype.updateTextureComparisonFunction = function ( + t, + i + ) { + if (1 !== this.webGLVersion) { + var n = this._gl; + t.isCube + ? (this._bindTextureDirectly( + this._gl.TEXTURE_CUBE_MAP, + t, + true + ), + 0 === i + ? (n.texParameteri( + n.TEXTURE_CUBE_MAP, + n.TEXTURE_COMPARE_FUNC, + e.LEQUAL + ), + n.texParameteri( + n.TEXTURE_CUBE_MAP, + n.TEXTURE_COMPARE_MODE, + n.NONE + )) + : (n.texParameteri( + n.TEXTURE_CUBE_MAP, + n.TEXTURE_COMPARE_FUNC, + i + ), + n.texParameteri( + n.TEXTURE_CUBE_MAP, + n.TEXTURE_COMPARE_MODE, + n.COMPARE_REF_TO_TEXTURE + )), + this._bindTextureDirectly( + this._gl.TEXTURE_CUBE_MAP, + null + )) + : (this._bindTextureDirectly( + this._gl.TEXTURE_2D, + t, + true + ), + 0 === i + ? (n.texParameteri( + n.TEXTURE_2D, + n.TEXTURE_COMPARE_FUNC, + e.LEQUAL + ), + n.texParameteri( + n.TEXTURE_2D, + n.TEXTURE_COMPARE_MODE, + n.NONE + )) + : (n.texParameteri( + n.TEXTURE_2D, + n.TEXTURE_COMPARE_FUNC, + i + ), + n.texParameteri( + n.TEXTURE_2D, + n.TEXTURE_COMPARE_MODE, + n.COMPARE_REF_TO_TEXTURE + )), + this._bindTextureDirectly( + this._gl.TEXTURE_2D, + null + )), + (t._comparisonFunction = i); + } else + y.a.Error( + "WebGL 1 does not support texture comparison." + ); + }), + (e.prototype._setupDepthStencilTexture = function ( + t, + i, + n, + r, + o + ) { + var a = i.width || i, + s = i.height || i; + (t.baseWidth = a), + (t.baseHeight = s), + (t.width = a), + (t.height = s), + (t.isReady = true), + (t.samples = 1), + (t.generateMipMaps = false), + (t._generateDepthBuffer = true), + (t._generateStencilBuffer = n), + (t.samplingMode = r + ? e.TEXTURE_BILINEAR_SAMPLINGMODE + : e.TEXTURE_NEAREST_SAMPLINGMODE), + (t.type = e.TEXTURETYPE_UNSIGNED_INT), + (t._comparisonFunction = o); + var c = this._gl, + u = t.isCube ? c.TEXTURE_CUBE_MAP : c.TEXTURE_2D, + l = this._getSamplingParameters(t.samplingMode, false); + c.texParameteri(u, c.TEXTURE_MAG_FILTER, l.mag), c.texParameteri(u, c.TEXTURE_MIN_FILTER, l.min), c.texParameteri(u, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE), c.texParameteri(u, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE), - 0 === o ? (c.texParameteri(u, c.TEXTURE_COMPARE_FUNC, e.LEQUAL), - c.texParameteri(u, c.TEXTURE_COMPARE_MODE, c.NONE)) : (c.texParameteri(u, c.TEXTURE_COMPARE_FUNC, o), - c.texParameteri(u, c.TEXTURE_COMPARE_MODE, c.COMPARE_REF_TO_TEXTURE)) - } - , - e.prototype.createDepthStencilTexture = function(e, t) { - if (t.isCube) { - var i = e.width || e; - return this._createDepthStencilCubeTexture(i, t) - } - return this._createDepthStencilTexture(e, t) - } - , - e.prototype._createDepthStencilTexture = function(e, t) { - var i = new m.a(this,m.a.DATASOURCE_DEPTHTEXTURE); - if (!this._caps.depthTextureExtension) - return y.a.Error("Depth texture is not supported by your browser or hardware."), - i; - var n = r.a({ + 0 === o + ? (c.texParameteri( + u, + c.TEXTURE_COMPARE_FUNC, + e.LEQUAL + ), + c.texParameteri(u, c.TEXTURE_COMPARE_MODE, c.NONE)) + : (c.texParameteri(u, c.TEXTURE_COMPARE_FUNC, o), + c.texParameteri( + u, + c.TEXTURE_COMPARE_MODE, + c.COMPARE_REF_TO_TEXTURE + )); + }), + (e.prototype.createDepthStencilTexture = function (e, t) { + if (t.isCube) { + var i = e.width || e; + return this._createDepthStencilCubeTexture(i, t); + } + return this._createDepthStencilTexture(e, t); + }), + (e.prototype._createDepthStencilTexture = function (e, t) { + var i = new m.a(this, m.a.DATASOURCE_DEPTHTEXTURE); + if (!this._caps.depthTextureExtension) + return ( + y.a.Error( + "Depth texture is not supported by your browser or hardware." + ), + i + ); + var n = r.a( + { bilinearFiltering: false, comparisonFunction: 0, - generateStencil: false - }, t) - , o = this._gl; - return this._bindTextureDirectly(o.TEXTURE_2D, i, true), - this._setupDepthStencilTexture(i, e, n.generateStencil, n.bilinearFiltering, n.comparisonFunction), - this.webGLVersion > 1 ? n.generateStencil ? o.texImage2D(o.TEXTURE_2D, 0, o.DEPTH24_STENCIL8, i.width, i.height, 0, o.DEPTH_STENCIL, o.UNSIGNED_INT_24_8, null) : o.texImage2D(o.TEXTURE_2D, 0, o.DEPTH_COMPONENT24, i.width, i.height, 0, o.DEPTH_COMPONENT, o.UNSIGNED_INT, null) : n.generateStencil ? o.texImage2D(o.TEXTURE_2D, 0, o.DEPTH_STENCIL, i.width, i.height, 0, o.DEPTH_STENCIL, o.UNSIGNED_INT_24_8, null) : o.texImage2D(o.TEXTURE_2D, 0, o.DEPTH_COMPONENT, i.width, i.height, 0, o.DEPTH_COMPONENT, o.UNSIGNED_INT, null), + generateStencil: false, + }, + t + ), + o = this._gl; + return ( + this._bindTextureDirectly(o.TEXTURE_2D, i, true), + this._setupDepthStencilTexture( + i, + e, + n.generateStencil, + n.bilinearFiltering, + n.comparisonFunction + ), + this.webGLVersion > 1 + ? n.generateStencil + ? o.texImage2D( + o.TEXTURE_2D, + 0, + o.DEPTH24_STENCIL8, + i.width, + i.height, + 0, + o.DEPTH_STENCIL, + o.UNSIGNED_INT_24_8, + null + ) + : o.texImage2D( + o.TEXTURE_2D, + 0, + o.DEPTH_COMPONENT24, + i.width, + i.height, + 0, + o.DEPTH_COMPONENT, + o.UNSIGNED_INT, + null + ) + : n.generateStencil + ? o.texImage2D( + o.TEXTURE_2D, + 0, + o.DEPTH_STENCIL, + i.width, + i.height, + 0, + o.DEPTH_STENCIL, + o.UNSIGNED_INT_24_8, + null + ) + : o.texImage2D( + o.TEXTURE_2D, + 0, + o.DEPTH_COMPONENT, + i.width, + i.height, + 0, + o.DEPTH_COMPONENT, + o.UNSIGNED_INT, + null + ), this._bindTextureDirectly(o.TEXTURE_2D, null), i - } - , - e.prototype.setFrameBufferDepthStencilTexture = function(e) { - var t = e.getInternalTexture(); - if (t && t._framebuffer && e.depthStencilTexture) { - var i = this._gl - , n = e.depthStencilTexture; - this._bindUnboundFramebuffer(t._framebuffer), - n.isCube ? n._generateStencilBuffer ? i.framebufferTexture2D(i.FRAMEBUFFER, i.DEPTH_STENCIL_ATTACHMENT, i.TEXTURE_CUBE_MAP_POSITIVE_X, n._webGLTexture, 0) : i.framebufferTexture2D(i.FRAMEBUFFER, i.DEPTH_ATTACHMENT, i.TEXTURE_CUBE_MAP_POSITIVE_X, n._webGLTexture, 0) : n._generateStencilBuffer ? i.framebufferTexture2D(i.FRAMEBUFFER, i.DEPTH_STENCIL_ATTACHMENT, i.TEXTURE_2D, n._webGLTexture, 0) : i.framebufferTexture2D(i.FRAMEBUFFER, i.DEPTH_ATTACHMENT, i.TEXTURE_2D, n._webGLTexture, 0), - this._bindUnboundFramebuffer(null) - } - } - , - e.prototype.createRenderTargetTexture = function(t, i) { - var n = new E.a; - void 0 !== i && "object" == c(i) ? (n.generateMipMaps = i.generateMipMaps, - n.generateDepthBuffer = void 0 === i.generateDepthBuffer || i.generateDepthBuffer, - n.generateStencilBuffer = n.generateDepthBuffer && i.generateStencilBuffer, - n.type = void 0 === i.type ? e.TEXTURETYPE_UNSIGNED_INT : i.type, - n.samplingMode = void 0 === i.samplingMode ? e.TEXTURE_TRILINEAR_SAMPLINGMODE : i.samplingMode, - n.format = void 0 === i.format ? e.TEXTUREFORMAT_RGBA : i.format) : (n.generateMipMaps = i, - n.generateDepthBuffer = true, - n.generateStencilBuffer = false, - n.type = e.TEXTURETYPE_UNSIGNED_INT, - n.samplingMode = e.TEXTURE_TRILINEAR_SAMPLINGMODE, - n.format = e.TEXTUREFORMAT_RGBA), - (n.type !== e.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (n.type !== e.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (n.samplingMode = e.TEXTURE_NEAREST_SAMPLINGMODE); - var r = this._gl - , o = new m.a(this,m.a.DATASOURCE_RENDERTARGET); - this._bindTextureDirectly(r.TEXTURE_2D, o, true); - var a = t.width || t - , s = t.height || t - , u = this._getSamplingParameters(n.samplingMode, !!n.generateMipMaps); - n.type !== e.TEXTURETYPE_FLOAT || this._caps.textureFloat || (n.type = e.TEXTURETYPE_UNSIGNED_INT, - y.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")), - r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, u.mag), - r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, u.min), - r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), - r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), - r.texImage2D(r.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(n.type, n.format), a, s, 0, this._getInternalFormat(n.format), this._getWebGLTextureType(n.type), null); - var l = this._currentFramebuffer - , h = r.createFramebuffer(); - return this._bindUnboundFramebuffer(h), - r.framebufferTexture2D(r.FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, o._webGLTexture, 0), - o._depthStencilBuffer = this._setupFramebufferDepthAttachments(!!n.generateStencilBuffer, n.generateDepthBuffer, a, s), - n.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), + ); + }), + (e.prototype.setFrameBufferDepthStencilTexture = function ( + e + ) { + var t = e.getInternalTexture(); + if (t && t._framebuffer && e.depthStencilTexture) { + var i = this._gl, + n = e.depthStencilTexture; + this._bindUnboundFramebuffer(t._framebuffer), + n.isCube + ? n._generateStencilBuffer + ? i.framebufferTexture2D( + i.FRAMEBUFFER, + i.DEPTH_STENCIL_ATTACHMENT, + i.TEXTURE_CUBE_MAP_POSITIVE_X, + n._webGLTexture, + 0 + ) + : i.framebufferTexture2D( + i.FRAMEBUFFER, + i.DEPTH_ATTACHMENT, + i.TEXTURE_CUBE_MAP_POSITIVE_X, + n._webGLTexture, + 0 + ) + : n._generateStencilBuffer + ? i.framebufferTexture2D( + i.FRAMEBUFFER, + i.DEPTH_STENCIL_ATTACHMENT, + i.TEXTURE_2D, + n._webGLTexture, + 0 + ) + : i.framebufferTexture2D( + i.FRAMEBUFFER, + i.DEPTH_ATTACHMENT, + i.TEXTURE_2D, + n._webGLTexture, + 0 + ), + this._bindUnboundFramebuffer(null); + } + }), + (e.prototype.createRenderTargetTexture = function (t, i) { + var n = new E.a(); + void 0 !== i && "object" == c(i) + ? ((n.generateMipMaps = i.generateMipMaps), + (n.generateDepthBuffer = + void 0 === i.generateDepthBuffer || + i.generateDepthBuffer), + (n.generateStencilBuffer = + n.generateDepthBuffer && i.generateStencilBuffer), + (n.type = + void 0 === i.type + ? e.TEXTURETYPE_UNSIGNED_INT + : i.type), + (n.samplingMode = + void 0 === i.samplingMode + ? e.TEXTURE_TRILINEAR_SAMPLINGMODE + : i.samplingMode), + (n.format = + void 0 === i.format + ? e.TEXTUREFORMAT_RGBA + : i.format)) + : ((n.generateMipMaps = i), + (n.generateDepthBuffer = true), + (n.generateStencilBuffer = false), + (n.type = e.TEXTURETYPE_UNSIGNED_INT), + (n.samplingMode = e.TEXTURE_TRILINEAR_SAMPLINGMODE), + (n.format = e.TEXTUREFORMAT_RGBA)), + ((n.type !== e.TEXTURETYPE_FLOAT || + this._caps.textureFloatLinearFiltering) && + (n.type !== e.TEXTURETYPE_HALF_FLOAT || + this._caps.textureHalfFloatLinearFiltering)) || + (n.samplingMode = e.TEXTURE_NEAREST_SAMPLINGMODE); + var r = this._gl, + o = new m.a(this, m.a.DATASOURCE_RENDERTARGET); + this._bindTextureDirectly(r.TEXTURE_2D, o, true); + var a = t.width || t, + s = t.height || t, + u = this._getSamplingParameters( + n.samplingMode, + !!n.generateMipMaps + ); + n.type !== e.TEXTURETYPE_FLOAT || + this._caps.textureFloat || + ((n.type = e.TEXTURETYPE_UNSIGNED_INT), + y.a.Warn( + "Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type" + )), + r.texParameteri( + r.TEXTURE_2D, + r.TEXTURE_MAG_FILTER, + u.mag + ), + r.texParameteri( + r.TEXTURE_2D, + r.TEXTURE_MIN_FILTER, + u.min + ), + r.texParameteri( + r.TEXTURE_2D, + r.TEXTURE_WRAP_S, + r.CLAMP_TO_EDGE + ), + r.texParameteri( + r.TEXTURE_2D, + r.TEXTURE_WRAP_T, + r.CLAMP_TO_EDGE + ), + r.texImage2D( + r.TEXTURE_2D, + 0, + this._getRGBABufferInternalSizedFormat( + n.type, + n.format + ), + a, + s, + 0, + this._getInternalFormat(n.format), + this._getWebGLTextureType(n.type), + null + ); + var l = this._currentFramebuffer, + h = r.createFramebuffer(); + return ( + this._bindUnboundFramebuffer(h), + r.framebufferTexture2D( + r.FRAMEBUFFER, + r.COLOR_ATTACHMENT0, + r.TEXTURE_2D, + o._webGLTexture, + 0 + ), + (o._depthStencilBuffer = + this._setupFramebufferDepthAttachments( + !!n.generateStencilBuffer, + n.generateDepthBuffer, + a, + s + )), + n.generateMipMaps && + this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(r.TEXTURE_2D, null), r.bindRenderbuffer(r.RENDERBUFFER, null), this._bindUnboundFramebuffer(l), - o._framebuffer = h, - o.baseWidth = a, - o.baseHeight = s, - o.width = a, - o.height = s, - o.isReady = true, - o.samples = 1, - o.generateMipMaps = !!n.generateMipMaps, - o.samplingMode = n.samplingMode, - o.type = n.type, - o.format = n.format, - o._generateDepthBuffer = n.generateDepthBuffer, - o._generateStencilBuffer = !!n.generateStencilBuffer, + (o._framebuffer = h), + (o.baseWidth = a), + (o.baseHeight = s), + (o.width = a), + (o.height = s), + (o.isReady = true), + (o.samples = 1), + (o.generateMipMaps = !!n.generateMipMaps), + (o.samplingMode = n.samplingMode), + (o.type = n.type), + (o.format = n.format), + (o._generateDepthBuffer = n.generateDepthBuffer), + (o._generateStencilBuffer = !!n.generateStencilBuffer), this._internalTexturesCache.push(o), o - } - , - e.prototype._setupFramebufferDepthAttachments = function(e, t, i, n, r) { - void 0 === r && (r = 1); - var o = null - , a = this._gl; - return e ? (o = a.createRenderbuffer(), - a.bindRenderbuffer(a.RENDERBUFFER, o), - r > 1 ? a.renderbufferStorageMultisample(a.RENDERBUFFER, r, a.DEPTH24_STENCIL8, i, n) : a.renderbufferStorage(a.RENDERBUFFER, a.DEPTH_STENCIL, i, n), - a.framebufferRenderbuffer(a.FRAMEBUFFER, a.DEPTH_STENCIL_ATTACHMENT, a.RENDERBUFFER, o)) : t && (o = a.createRenderbuffer(), - a.bindRenderbuffer(a.RENDERBUFFER, o), - r > 1 ? a.renderbufferStorageMultisample(a.RENDERBUFFER, r, a.DEPTH_COMPONENT16, i, n) : a.renderbufferStorage(a.RENDERBUFFER, a.DEPTH_COMPONENT16, i, n), - a.framebufferRenderbuffer(a.FRAMEBUFFER, a.DEPTH_ATTACHMENT, a.RENDERBUFFER, o)), + ); + }), + (e.prototype._setupFramebufferDepthAttachments = function ( + e, + t, + i, + n, + r + ) { + void 0 === r && (r = 1); + var o = null, + a = this._gl; + return ( + e + ? ((o = a.createRenderbuffer()), + a.bindRenderbuffer(a.RENDERBUFFER, o), + r > 1 + ? a.renderbufferStorageMultisample( + a.RENDERBUFFER, + r, + a.DEPTH24_STENCIL8, + i, + n + ) + : a.renderbufferStorage( + a.RENDERBUFFER, + a.DEPTH_STENCIL, + i, + n + ), + a.framebufferRenderbuffer( + a.FRAMEBUFFER, + a.DEPTH_STENCIL_ATTACHMENT, + a.RENDERBUFFER, + o + )) + : t && + ((o = a.createRenderbuffer()), + a.bindRenderbuffer(a.RENDERBUFFER, o), + r > 1 + ? a.renderbufferStorageMultisample( + a.RENDERBUFFER, + r, + a.DEPTH_COMPONENT16, + i, + n + ) + : a.renderbufferStorage( + a.RENDERBUFFER, + a.DEPTH_COMPONENT16, + i, + n + ), + a.framebufferRenderbuffer( + a.FRAMEBUFFER, + a.DEPTH_ATTACHMENT, + a.RENDERBUFFER, + o + )), o - } - , - e.prototype.updateRenderTargetTextureSampleCount = function(e, t) { - if (this.webGLVersion < 2 || !e) - return 1; - if (e.samples === t) - return t; + ); + }), + (e.prototype.updateRenderTargetTextureSampleCount = + function (e, t) { + if (this.webGLVersion < 2 || !e) return 1; + if (e.samples === t) return t; var i = this._gl; - if (t = Math.min(t, i.getParameter(i.MAX_SAMPLES)), - e._depthStencilBuffer && (i.deleteRenderbuffer(e._depthStencilBuffer), - e._depthStencilBuffer = null), - e._MSAAFramebuffer && (i.deleteFramebuffer(e._MSAAFramebuffer), - e._MSAAFramebuffer = null), - e._MSAARenderBuffer && (i.deleteRenderbuffer(e._MSAARenderBuffer), - e._MSAARenderBuffer = null), - t > 1) { - var n = i.createFramebuffer(); - if (!n) - throw new Error("Unable to create multi sampled framebuffer"); - e._MSAAFramebuffer = n, + if ( + ((t = Math.min(t, i.getParameter(i.MAX_SAMPLES))), + e._depthStencilBuffer && + (i.deleteRenderbuffer(e._depthStencilBuffer), + (e._depthStencilBuffer = null)), + e._MSAAFramebuffer && + (i.deleteFramebuffer(e._MSAAFramebuffer), + (e._MSAAFramebuffer = null)), + e._MSAARenderBuffer && + (i.deleteRenderbuffer(e._MSAARenderBuffer), + (e._MSAARenderBuffer = null)), + t > 1) + ) { + var n = i.createFramebuffer(); + if (!n) + throw new Error( + "Unable to create multi sampled framebuffer" + ); + (e._MSAAFramebuffer = n), this._bindUnboundFramebuffer(e._MSAAFramebuffer); - var r = i.createRenderbuffer(); - if (!r) - throw new Error("Unable to create multi sampled framebuffer"); - i.bindRenderbuffer(i.RENDERBUFFER, r), - i.renderbufferStorageMultisample(i.RENDERBUFFER, t, this._getRGBAMultiSampleBufferFormat(e.type), e.width, e.height), - i.framebufferRenderbuffer(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.RENDERBUFFER, r), - e._MSAARenderBuffer = r - } else - this._bindUnboundFramebuffer(e._framebuffer); - return e.samples = t, - e._depthStencilBuffer = this._setupFramebufferDepthAttachments(e._generateStencilBuffer, e._generateDepthBuffer, e.width, e.height, t), - i.bindRenderbuffer(i.RENDERBUFFER, null), - this._bindUnboundFramebuffer(null), - t - } - , - e.prototype._uploadCompressedDataToTextureDirectly = function(e, t, i, n, r, o, a) { - void 0 === o && (o = 0), - void 0 === a && (a = 0); - var s = this._gl - , c = s.TEXTURE_2D; + var r = i.createRenderbuffer(); + if (!r) + throw new Error( + "Unable to create multi sampled framebuffer" + ); + i.bindRenderbuffer(i.RENDERBUFFER, r), + i.renderbufferStorageMultisample( + i.RENDERBUFFER, + t, + this._getRGBAMultiSampleBufferFormat(e.type), + e.width, + e.height + ), + i.framebufferRenderbuffer( + i.FRAMEBUFFER, + i.COLOR_ATTACHMENT0, + i.RENDERBUFFER, + r + ), + (e._MSAARenderBuffer = r); + } else this._bindUnboundFramebuffer(e._framebuffer); + return ( + (e.samples = t), + (e._depthStencilBuffer = + this._setupFramebufferDepthAttachments( + e._generateStencilBuffer, + e._generateDepthBuffer, + e.width, + e.height, + t + )), + i.bindRenderbuffer(i.RENDERBUFFER, null), + this._bindUnboundFramebuffer(null), + t + ); + }), + (e.prototype._uploadCompressedDataToTextureDirectly = + function (e, t, i, n, r, o, a) { + void 0 === o && (o = 0), void 0 === a && (a = 0); + var s = this._gl, + c = s.TEXTURE_2D; e.isCube && (c = s.TEXTURE_CUBE_MAP_POSITIVE_X + o), - this._gl.compressedTexImage2D(c, a, t, i, n, 0, r) - } - , - e.prototype._uploadDataToTextureDirectly = function(e, t, i, n) { - void 0 === i && (i = 0), - void 0 === n && (n = 0); - var r = this._gl - , o = this._getWebGLTextureType(e.type) - , a = this._getInternalFormat(e.format) - , s = this._getRGBABufferInternalSizedFormat(e.type, a); - this._unpackFlipY(e.invertY); - var c = r.TEXTURE_2D; - e.isCube && (c = r.TEXTURE_CUBE_MAP_POSITIVE_X + i); - var u = Math.round(f.a.Log2(e.width)) - , l = Math.round(f.a.Log2(e.height)) - , h = Math.pow(2, Math.max(u - n, 0)) - , d = Math.pow(2, Math.max(l - n, 0)); - r.texImage2D(c, n, s, h, d, 0, a, o, t) - } - , - e.prototype._uploadArrayBufferViewToTexture = function(e, t, i, n) { - void 0 === i && (i = 0), - void 0 === n && (n = 0); - var r = this._gl - , o = e.isCube ? r.TEXTURE_CUBE_MAP : r.TEXTURE_2D; - this._bindTextureDirectly(o, e, true), + this._gl.compressedTexImage2D(c, a, t, i, n, 0, r); + }), + (e.prototype._uploadDataToTextureDirectly = function ( + e, + t, + i, + n + ) { + void 0 === i && (i = 0), void 0 === n && (n = 0); + var r = this._gl, + o = this._getWebGLTextureType(e.type), + a = this._getInternalFormat(e.format), + s = this._getRGBABufferInternalSizedFormat(e.type, a); + this._unpackFlipY(e.invertY); + var c = r.TEXTURE_2D; + e.isCube && (c = r.TEXTURE_CUBE_MAP_POSITIVE_X + i); + var u = Math.round(f.a.Log2(e.width)), + l = Math.round(f.a.Log2(e.height)), + h = Math.pow(2, Math.max(u - n, 0)), + d = Math.pow(2, Math.max(l - n, 0)); + r.texImage2D(c, n, s, h, d, 0, a, o, t); + }), + (e.prototype._uploadArrayBufferViewToTexture = function ( + e, + t, + i, + n + ) { + void 0 === i && (i = 0), void 0 === n && (n = 0); + var r = this._gl, + o = e.isCube ? r.TEXTURE_CUBE_MAP : r.TEXTURE_2D; + this._bindTextureDirectly(o, e, true), this._uploadDataToTextureDirectly(e, t, i, n), - this._bindTextureDirectly(o, null, true) - } - , - e.prototype._uploadImageToTexture = function(e, t, i, n) { - void 0 === i && (i = 0), - void 0 === n && (n = 0); - var r = this._gl - , o = this._getWebGLTextureType(e.type) - , a = this._getInternalFormat(e.format) - , s = this._getRGBABufferInternalSizedFormat(e.type, a) - , c = e.isCube ? r.TEXTURE_CUBE_MAP : r.TEXTURE_2D; - this._bindTextureDirectly(c, e, true), + this._bindTextureDirectly(o, null, true); + }), + (e.prototype._uploadImageToTexture = function (e, t, i, n) { + void 0 === i && (i = 0), void 0 === n && (n = 0); + var r = this._gl, + o = this._getWebGLTextureType(e.type), + a = this._getInternalFormat(e.format), + s = this._getRGBABufferInternalSizedFormat(e.type, a), + c = e.isCube ? r.TEXTURE_CUBE_MAP : r.TEXTURE_2D; + this._bindTextureDirectly(c, e, true), this._unpackFlipY(e.invertY); - var u = r.TEXTURE_2D; - e.isCube && (u = r.TEXTURE_CUBE_MAP_POSITIVE_X + i), + var u = r.TEXTURE_2D; + e.isCube && (u = r.TEXTURE_CUBE_MAP_POSITIVE_X + i), r.texImage2D(u, n, s, a, o, t), - this._bindTextureDirectly(c, null, true) - } - , - e.prototype._setCubeMapTextureParams = function(e) { - var t = this._gl; - t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MAG_FILTER, t.LINEAR), - t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MIN_FILTER, e ? t.LINEAR_MIPMAP_LINEAR : t.LINEAR), - t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), - t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), - this._bindTextureDirectly(t.TEXTURE_CUBE_MAP, null) - } - , - e.prototype.createRawCubeTexture = function(e, t, i, n, r, o, a, s) { - throw void 0 === s && (s = null), - T.a.WarnImport("Engine.RawTexture") - } - , - e.prototype.createRawTexture3D = function(t, i, n, r, o, a, s, c, u, l) { - throw void 0 === u && (u = null), + this._bindTextureDirectly(c, null, true); + }), + (e.prototype._setCubeMapTextureParams = function (e) { + var t = this._gl; + t.texParameteri( + t.TEXTURE_CUBE_MAP, + t.TEXTURE_MAG_FILTER, + t.LINEAR + ), + t.texParameteri( + t.TEXTURE_CUBE_MAP, + t.TEXTURE_MIN_FILTER, + e ? t.LINEAR_MIPMAP_LINEAR : t.LINEAR + ), + t.texParameteri( + t.TEXTURE_CUBE_MAP, + t.TEXTURE_WRAP_S, + t.CLAMP_TO_EDGE + ), + t.texParameteri( + t.TEXTURE_CUBE_MAP, + t.TEXTURE_WRAP_T, + t.CLAMP_TO_EDGE + ), + this._bindTextureDirectly(t.TEXTURE_CUBE_MAP, null); + }), + (e.prototype.createRawCubeTexture = function ( + e, + t, + i, + n, + r, + o, + a, + s + ) { + throw ( + (void 0 === s && (s = null), + T.a.WarnImport("Engine.RawTexture")) + ); + }), + (e.prototype.createRawTexture3D = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u, + l + ) { + throw ( + (void 0 === u && (u = null), void 0 === l && (l = e.TEXTURETYPE_UNSIGNED_INT), - T.a.WarnImport("Engine.RawTexture") - } - , - e.prototype._prepareWebGLTextureContinuation = function(e, t, i, n, r) { - var o = this._gl; - if (o) { - var a = this._getSamplingParameters(r, !i); - o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MAG_FILTER, a.mag), - o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MIN_FILTER, a.min), - i || n || o.generateMipmap(o.TEXTURE_2D), - this._bindTextureDirectly(o.TEXTURE_2D, null), - t && t._removePendingData(e), - e.onLoadedObservable.notifyObservers(e), - e.onLoadedObservable.clear() + T.a.WarnImport("Engine.RawTexture")) + ); + }), + (e.prototype._prepareWebGLTextureContinuation = function ( + e, + t, + i, + n, + r + ) { + var o = this._gl; + if (o) { + var a = this._getSamplingParameters(r, !i); + o.texParameteri( + o.TEXTURE_2D, + o.TEXTURE_MAG_FILTER, + a.mag + ), + o.texParameteri( + o.TEXTURE_2D, + o.TEXTURE_MIN_FILTER, + a.min + ), + i || n || o.generateMipmap(o.TEXTURE_2D), + this._bindTextureDirectly(o.TEXTURE_2D, null), + t && t._removePendingData(e), + e.onLoadedObservable.notifyObservers(e), + e.onLoadedObservable.clear(); + } + }), + (e.prototype._prepareWebGLTexture = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u + ) { + var h = this; + void 0 === u && (u = e.TEXTURE_TRILINEAR_SAMPLINGMODE); + var f = this.getCaps().maxTextureSize, + d = Math.min( + f, + this.needPOTTextures ? l.h.GetExponentOfTwo(n, f) : n + ), + p = Math.min( + f, + this.needPOTTextures ? l.h.GetExponentOfTwo(r, f) : r + ), + m = this._gl; + m && + (t._webGLTexture + ? (this._bindTextureDirectly(m.TEXTURE_2D, t, true), + this._unpackFlipY(void 0 === o || !!o), + (t.baseWidth = n), + (t.baseHeight = r), + (t.width = d), + (t.height = p), + (t.isReady = true), + c(d, p, function () { + h._prepareWebGLTextureContinuation(t, i, a, s, u); + }) || + this._prepareWebGLTextureContinuation( + t, + i, + a, + s, + u + )) + : i && i._removePendingData(t)); + }), + (e.prototype._convertRGBtoRGBATextureData = function ( + t, + i, + n, + r + ) { + var o; + o = + r === e.TEXTURETYPE_FLOAT + ? new Float32Array(i * n * 4) + : new Uint32Array(i * n * 4); + for (var a = 0; a < i; a++) + for (var s = 0; s < n; s++) { + var c = 3 * (s * i + a), + u = 4 * (s * i + a); + (o[u + 0] = t[c + 0]), + (o[u + 1] = t[c + 1]), + (o[u + 2] = t[c + 2]), + (o[u + 3] = 1); } - } - , - e.prototype._prepareWebGLTexture = function(t, i, n, r, o, a, s, c, u) { - var h = this; - void 0 === u && (u = e.TEXTURE_TRILINEAR_SAMPLINGMODE); - var f = this.getCaps().maxTextureSize - , d = Math.min(f, this.needPOTTextures ? l.h.GetExponentOfTwo(n, f) : n) - , p = Math.min(f, this.needPOTTextures ? l.h.GetExponentOfTwo(r, f) : r) - , m = this._gl; - m && (t._webGLTexture ? (this._bindTextureDirectly(m.TEXTURE_2D, t, true), - this._unpackFlipY(void 0 === o || !!o), - t.baseWidth = n, - t.baseHeight = r, - t.width = d, - t.height = p, - t.isReady = true, - c(d, p, function() { - h._prepareWebGLTextureContinuation(t, i, a, s, u) - }) || this._prepareWebGLTextureContinuation(t, i, a, s, u)) : i && i._removePendingData(t)) - } - , - e.prototype._convertRGBtoRGBATextureData = function(t, i, n, r) { - var o; - o = r === e.TEXTURETYPE_FLOAT ? new Float32Array(i * n * 4) : new Uint32Array(i * n * 4); - for (var a = 0; a < i; a++) - for (var s = 0; s < n; s++) { - var c = 3 * (s * i + a) - , u = 4 * (s * i + a); - o[u + 0] = t[c + 0], - o[u + 1] = t[c + 1], - o[u + 2] = t[c + 2], - o[u + 3] = 1 - } - return o - } - , - e.prototype._releaseFramebufferObjects = function(e) { - var t = this._gl; - e._framebuffer && (t.deleteFramebuffer(e._framebuffer), - e._framebuffer = null), - e._depthStencilBuffer && (t.deleteRenderbuffer(e._depthStencilBuffer), - e._depthStencilBuffer = null), - e._MSAAFramebuffer && (t.deleteFramebuffer(e._MSAAFramebuffer), - e._MSAAFramebuffer = null), - e._MSAARenderBuffer && (t.deleteRenderbuffer(e._MSAARenderBuffer), - e._MSAARenderBuffer = null) - } - , - e.prototype._releaseTexture = function(e) { - var t = this._gl; - this._releaseFramebufferObjects(e), + return o; + }), + (e.prototype._releaseFramebufferObjects = function (e) { + var t = this._gl; + e._framebuffer && + (t.deleteFramebuffer(e._framebuffer), + (e._framebuffer = null)), + e._depthStencilBuffer && + (t.deleteRenderbuffer(e._depthStencilBuffer), + (e._depthStencilBuffer = null)), + e._MSAAFramebuffer && + (t.deleteFramebuffer(e._MSAAFramebuffer), + (e._MSAAFramebuffer = null)), + e._MSAARenderBuffer && + (t.deleteRenderbuffer(e._MSAARenderBuffer), + (e._MSAARenderBuffer = null)); + }), + (e.prototype._releaseTexture = function (e) { + var t = this._gl; + this._releaseFramebufferObjects(e), t.deleteTexture(e._webGLTexture), this.unbindAllTextures(); - var i = this._internalTexturesCache.indexOf(e); - -1 !== i && this._internalTexturesCache.splice(i, 1), + var i = this._internalTexturesCache.indexOf(e); + -1 !== i && this._internalTexturesCache.splice(i, 1), e._lodTextureHigh && e._lodTextureHigh.dispose(), e._lodTextureMid && e._lodTextureMid.dispose(), e._lodTextureLow && e._lodTextureLow.dispose(), - this.scenes.forEach(function(t) { - t.postProcesses.forEach(function(t) { - t._outputTexture == e && (t._outputTexture = null) - }), - t.cameras.forEach(function(t) { - t._postProcesses.forEach(function(t) { - t && t._outputTexture == e && (t._outputTexture = null) - }) - }) - }) - } - , - e.prototype.setProgram = function(e) { - this._currentProgram !== e && (this._gl.useProgram(e), - this._currentProgram = e) - } - , - e.prototype.bindSamplers = function(e) { - var t = e.getPipelineContext(); - this.setProgram(t.program); - for (var i = e.getSamplers(), n = 0; n < i.length; n++) { - var r = e.getUniform(i[n]); - r && (this._boundUniforms[n] = r) - } - this._currentEffect = null - } - , - e.prototype._activateCurrentTexture = function() { - this._currentTextureChannel !== this._activeChannel && (this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel), - this._currentTextureChannel = this._activeChannel) - } - , - e.prototype._bindTextureDirectly = function(e, t, i, n) { - void 0 === i && (i = false), - void 0 === n && (n = false); - var r = false - , o = t && t._associatedChannel > -1; - return i && o && (this._activeChannel = t._associatedChannel), - this._boundTexturesCache[this._activeChannel] !== t || n ? (this._activateCurrentTexture(), - t && t.isMultiview ? this._gl.bindTexture(e, t ? t._colorTextureArray : null) : this._gl.bindTexture(e, t ? t._webGLTexture : null), - this._boundTexturesCache[this._activeChannel] = t, - t && (t._associatedChannel = this._activeChannel)) : i && (r = true, - this._activateCurrentTexture()), - o && !i && this._bindSamplerUniformToChannel(t._associatedChannel, this._activeChannel), + this.scenes.forEach(function (t) { + t.postProcesses.forEach(function (t) { + t._outputTexture == e && (t._outputTexture = null); + }), + t.cameras.forEach(function (t) { + t._postProcesses.forEach(function (t) { + t && + t._outputTexture == e && + (t._outputTexture = null); + }); + }); + }); + }), + (e.prototype.setProgram = function (e) { + this._currentProgram !== e && + (this._gl.useProgram(e), (this._currentProgram = e)); + }), + (e.prototype.bindSamplers = function (e) { + var t = e.getPipelineContext(); + this.setProgram(t.program); + for (var i = e.getSamplers(), n = 0; n < i.length; n++) { + var r = e.getUniform(i[n]); + r && (this._boundUniforms[n] = r); + } + this._currentEffect = null; + }), + (e.prototype._activateCurrentTexture = function () { + this._currentTextureChannel !== this._activeChannel && + (this._gl.activeTexture( + this._gl.TEXTURE0 + this._activeChannel + ), + (this._currentTextureChannel = this._activeChannel)); + }), + (e.prototype._bindTextureDirectly = function (e, t, i, n) { + void 0 === i && (i = false), void 0 === n && (n = false); + var r = false, + o = t && t._associatedChannel > -1; + return ( + i && o && (this._activeChannel = t._associatedChannel), + this._boundTexturesCache[this._activeChannel] !== t || n + ? (this._activateCurrentTexture(), + t && t.isMultiview + ? this._gl.bindTexture( + e, + t ? t._colorTextureArray : null + ) + : this._gl.bindTexture( + e, + t ? t._webGLTexture : null + ), + (this._boundTexturesCache[this._activeChannel] = t), + t && (t._associatedChannel = this._activeChannel)) + : i && ((r = true), this._activateCurrentTexture()), + o && + !i && + this._bindSamplerUniformToChannel( + t._associatedChannel, + this._activeChannel + ), r - } - , - e.prototype._bindTexture = function(e, t) { - void 0 !== e && (t && (t._associatedChannel = e), - this._activeChannel = e, - this._bindTextureDirectly(this._gl.TEXTURE_2D, t)) - } - , - e.prototype.setTextureFromPostProcess = function(e, t) { - this._bindTexture(e, t ? t._textures.data[t._currentRenderTextureInd] : null) - } - , - e.prototype.setTextureFromPostProcessOutput = function(e, t) { - this._bindTexture(e, t ? t._outputTexture : null) - } - , - e.prototype.unbindAllTextures = function() { - for (var e = 0; e < this._maxSimultaneousTextures; e++) - this._activeChannel = e, - this._bindTextureDirectly(this._gl.TEXTURE_2D, null), - this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), - this.webGLVersion > 1 && this._bindTextureDirectly(this._gl.TEXTURE_3D, null) - } - , - e.prototype.setTexture = function(e, t, i) { - void 0 !== e && (t && (this._boundUniforms[e] = t), - this._setTexture(e, i)) - } - , - e.prototype.setDepthStencilTexture = function(e, t, i) { - void 0 !== e && (t && (this._boundUniforms[e] = t), - i && i.depthStencilTexture ? this._setTexture(e, i, false, true) : this._setTexture(e, null)) - } - , - e.prototype._bindSamplerUniformToChannel = function(e, t) { - var i = this._boundUniforms[e]; - i._currentState !== t && (this._gl.uniform1i(i, t), - i._currentState = t) - } - , - e.prototype._getTextureWrapMode = function(t) { - switch (t) { + ); + }), + (e.prototype._bindTexture = function (e, t) { + void 0 !== e && + (t && (t._associatedChannel = e), + (this._activeChannel = e), + this._bindTextureDirectly(this._gl.TEXTURE_2D, t)); + }), + (e.prototype.setTextureFromPostProcess = function (e, t) { + this._bindTexture( + e, + t ? t._textures.data[t._currentRenderTextureInd] : null + ); + }), + (e.prototype.setTextureFromPostProcessOutput = function ( + e, + t + ) { + this._bindTexture(e, t ? t._outputTexture : null); + }), + (e.prototype.unbindAllTextures = function () { + for (var e = 0; e < this._maxSimultaneousTextures; e++) + (this._activeChannel = e), + this._bindTextureDirectly(this._gl.TEXTURE_2D, null), + this._bindTextureDirectly( + this._gl.TEXTURE_CUBE_MAP, + null + ), + this.webGLVersion > 1 && + this._bindTextureDirectly( + this._gl.TEXTURE_3D, + null + ); + }), + (e.prototype.setTexture = function (e, t, i) { + void 0 !== e && + (t && (this._boundUniforms[e] = t), + this._setTexture(e, i)); + }), + (e.prototype.setDepthStencilTexture = function (e, t, i) { + void 0 !== e && + (t && (this._boundUniforms[e] = t), + i && i.depthStencilTexture + ? this._setTexture(e, i, false, true) + : this._setTexture(e, null)); + }), + (e.prototype._bindSamplerUniformToChannel = function ( + e, + t + ) { + var i = this._boundUniforms[e]; + i._currentState !== t && + (this._gl.uniform1i(i, t), (i._currentState = t)); + }), + (e.prototype._getTextureWrapMode = function (t) { + switch (t) { case e.TEXTURE_WRAP_ADDRESSMODE: - return this._gl.REPEAT; + return this._gl.REPEAT; case e.TEXTURE_CLAMP_ADDRESSMODE: - return this._gl.CLAMP_TO_EDGE; + return this._gl.CLAMP_TO_EDGE; case e.TEXTURE_MIRROR_ADDRESSMODE: - return this._gl.MIRRORED_REPEAT - } - return this._gl.REPEAT - } - , - e.prototype._setTexture = function(t, i, n, r) { - if (void 0 === n && (n = false), + return this._gl.MIRRORED_REPEAT; + } + return this._gl.REPEAT; + }), + (e.prototype._setTexture = function (t, i, n, r) { + if ( + (void 0 === n && (n = false), void 0 === r && (r = false), !i) - return null != this._boundTexturesCache[t] && (this._activeChannel = t, - this._bindTextureDirectly(this._gl.TEXTURE_2D, null), - this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), - this.webGLVersion > 1 && this._bindTextureDirectly(this._gl.TEXTURE_3D, null)), - false; - if (i.video) - this._activeChannel = t, - i.update(); - else if (i.delayLoadState === e.DELAYLOADSTATE_NOTLOADED) - return i.delayLoad(), - false; - var o; - o = r ? i.depthStencilTexture : i.isReady() ? i.getInternalTexture() : i.isCube ? this.emptyCubeTexture : i.is3D ? this.emptyTexture3D : this.emptyTexture, + ) + return ( + null != this._boundTexturesCache[t] && + ((this._activeChannel = t), + this._bindTextureDirectly( + this._gl.TEXTURE_2D, + null + ), + this._bindTextureDirectly( + this._gl.TEXTURE_CUBE_MAP, + null + ), + this.webGLVersion > 1 && + this._bindTextureDirectly( + this._gl.TEXTURE_3D, + null + )), + false + ); + if (i.video) (this._activeChannel = t), i.update(); + else if (i.delayLoadState === e.DELAYLOADSTATE_NOTLOADED) + return i.delayLoad(), false; + var o; + (o = r + ? i.depthStencilTexture + : i.isReady() + ? i.getInternalTexture() + : i.isCube + ? this.emptyCubeTexture + : i.is3D + ? this.emptyTexture3D + : this.emptyTexture), !n && o && (o._associatedChannel = t); - var a = true; - if (this._boundTexturesCache[t] === o && (n || this._bindSamplerUniformToChannel(o._associatedChannel, t), - a = false), - this._activeChannel = t, + var a = true; + if ( + (this._boundTexturesCache[t] === o && + (n || + this._bindSamplerUniformToChannel( + o._associatedChannel, + t + ), + (a = false)), + (this._activeChannel = t), o && o.isMultiview) - a && this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, o, n); - else if (o && o.is3D) - a && this._bindTextureDirectly(this._gl.TEXTURE_3D, o, n), - o && o._cachedWrapU !== i.wrapU && (o._cachedWrapU = i.wrapU, - this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(i.wrapU), o)), - o && o._cachedWrapV !== i.wrapV && (o._cachedWrapV = i.wrapV, - this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(i.wrapV), o)), - o && o._cachedWrapR !== i.wrapR && (o._cachedWrapR = i.wrapR, - this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(i.wrapR), o)), - this._setAnisotropicLevel(this._gl.TEXTURE_3D, i); - else if (o && o.isCube) { - if (a && this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, o, n), - o._cachedCoordinatesMode !== i.coordinatesMode) { - o._cachedCoordinatesMode = i.coordinatesMode; - var s = i.coordinatesMode !== e.TEXTURE_CUBIC_MODE && i.coordinatesMode !== e.TEXTURE_SKYBOX_MODE ? this._gl.REPEAT : this._gl.CLAMP_TO_EDGE; - this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_S, s, o), - this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_T, s) - } - this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP, i) - } else - a && this._bindTextureDirectly(this._gl.TEXTURE_2D, o, n), - o && o._cachedWrapU !== i.wrapU && (o._cachedWrapU = i.wrapU, - this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(i.wrapU), o)), - o && o._cachedWrapV !== i.wrapV && (o._cachedWrapV = i.wrapV, - this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(i.wrapV), o)), - this._setAnisotropicLevel(this._gl.TEXTURE_2D, i); - return true - } - , - e.prototype.setTextureArray = function(e, t, i) { - if (void 0 !== e && t) { - this._textureUnits && this._textureUnits.length === i.length || (this._textureUnits = new Int32Array(i.length)); - for (var n = 0; n < i.length; n++) { - var r = i[n].getInternalTexture(); - r ? (this._textureUnits[e + n] = e + n, - r._associatedChannel = e + n) : this._textureUnits[e + n] = -1 - } - this._gl.uniform1iv(t, this._textureUnits); - for (var o = 0; o < i.length; o++) - this._setTexture(this._textureUnits[o], i[o], true) + ) + a && + this._bindTextureDirectly( + this._gl.TEXTURE_2D_ARRAY, + o, + n + ); + else if (o && o.is3D) + a && + this._bindTextureDirectly(this._gl.TEXTURE_3D, o, n), + o && + o._cachedWrapU !== i.wrapU && + ((o._cachedWrapU = i.wrapU), + this._setTextureParameterInteger( + this._gl.TEXTURE_3D, + this._gl.TEXTURE_WRAP_S, + this._getTextureWrapMode(i.wrapU), + o + )), + o && + o._cachedWrapV !== i.wrapV && + ((o._cachedWrapV = i.wrapV), + this._setTextureParameterInteger( + this._gl.TEXTURE_3D, + this._gl.TEXTURE_WRAP_T, + this._getTextureWrapMode(i.wrapV), + o + )), + o && + o._cachedWrapR !== i.wrapR && + ((o._cachedWrapR = i.wrapR), + this._setTextureParameterInteger( + this._gl.TEXTURE_3D, + this._gl.TEXTURE_WRAP_R, + this._getTextureWrapMode(i.wrapR), + o + )), + this._setAnisotropicLevel(this._gl.TEXTURE_3D, i); + else if (o && o.isCube) { + if ( + (a && + this._bindTextureDirectly( + this._gl.TEXTURE_CUBE_MAP, + o, + n + ), + o._cachedCoordinatesMode !== i.coordinatesMode) + ) { + o._cachedCoordinatesMode = i.coordinatesMode; + var s = + i.coordinatesMode !== e.TEXTURE_CUBIC_MODE && + i.coordinatesMode !== e.TEXTURE_SKYBOX_MODE + ? this._gl.REPEAT + : this._gl.CLAMP_TO_EDGE; + this._setTextureParameterInteger( + this._gl.TEXTURE_CUBE_MAP, + this._gl.TEXTURE_WRAP_S, + s, + o + ), + this._setTextureParameterInteger( + this._gl.TEXTURE_CUBE_MAP, + this._gl.TEXTURE_WRAP_T, + s + ); } - } - , - e.prototype._setAnisotropicLevel = function(t, i) { - var n = i.getInternalTexture(); - if (n) { - var r = this._caps.textureAnisotropicFilterExtension - , o = i.anisotropicFilteringLevel; - n.samplingMode !== e.TEXTURE_LINEAR_LINEAR_MIPNEAREST && n.samplingMode !== e.TEXTURE_LINEAR_LINEAR_MIPLINEAR && n.samplingMode !== e.TEXTURE_LINEAR_LINEAR && (o = 1), - r && n._cachedAnisotropicFilteringLevel !== o && (this._setTextureParameterFloat(t, r.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(o, this._caps.maxAnisotropy), n), - n._cachedAnisotropicFilteringLevel = o) + this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP, i); + } else + a && + this._bindTextureDirectly(this._gl.TEXTURE_2D, o, n), + o && + o._cachedWrapU !== i.wrapU && + ((o._cachedWrapU = i.wrapU), + this._setTextureParameterInteger( + this._gl.TEXTURE_2D, + this._gl.TEXTURE_WRAP_S, + this._getTextureWrapMode(i.wrapU), + o + )), + o && + o._cachedWrapV !== i.wrapV && + ((o._cachedWrapV = i.wrapV), + this._setTextureParameterInteger( + this._gl.TEXTURE_2D, + this._gl.TEXTURE_WRAP_T, + this._getTextureWrapMode(i.wrapV), + o + )), + this._setAnisotropicLevel(this._gl.TEXTURE_2D, i); + return true; + }), + (e.prototype.setTextureArray = function (e, t, i) { + if (void 0 !== e && t) { + (this._textureUnits && + this._textureUnits.length === i.length) || + (this._textureUnits = new Int32Array(i.length)); + for (var n = 0; n < i.length; n++) { + var r = i[n].getInternalTexture(); + r + ? ((this._textureUnits[e + n] = e + n), + (r._associatedChannel = e + n)) + : (this._textureUnits[e + n] = -1); } - } - , - e.prototype._setTextureParameterFloat = function(e, t, i, n) { - this._bindTextureDirectly(e, n, true, true), - this._gl.texParameterf(e, t, i) - } - , - e.prototype._setTextureParameterInteger = function(e, t, i, n) { - n && this._bindTextureDirectly(e, n, true, true), - this._gl.texParameteri(e, t, i) - } - , - e.prototype.readPixels = function(e, t, i, n) { - var r = new Uint8Array(n * i * 4); - return this._gl.readPixels(e, t, i, n, this._gl.RGBA, this._gl.UNSIGNED_BYTE, r), + this._gl.uniform1iv(t, this._textureUnits); + for (var o = 0; o < i.length; o++) + this._setTexture(this._textureUnits[o], i[o], true); + } + }), + (e.prototype._setAnisotropicLevel = function (t, i) { + var n = i.getInternalTexture(); + if (n) { + var r = this._caps.textureAnisotropicFilterExtension, + o = i.anisotropicFilteringLevel; + n.samplingMode !== e.TEXTURE_LINEAR_LINEAR_MIPNEAREST && + n.samplingMode !== + e.TEXTURE_LINEAR_LINEAR_MIPLINEAR && + n.samplingMode !== e.TEXTURE_LINEAR_LINEAR && + (o = 1), + r && + n._cachedAnisotropicFilteringLevel !== o && + (this._setTextureParameterFloat( + t, + r.TEXTURE_MAX_ANISOTROPY_EXT, + Math.min(o, this._caps.maxAnisotropy), + n + ), + (n._cachedAnisotropicFilteringLevel = o)); + } + }), + (e.prototype._setTextureParameterFloat = function ( + e, + t, + i, + n + ) { + this._bindTextureDirectly(e, n, true, true), + this._gl.texParameterf(e, t, i); + }), + (e.prototype._setTextureParameterInteger = function ( + e, + t, + i, + n + ) { + n && this._bindTextureDirectly(e, n, true, true), + this._gl.texParameteri(e, t, i); + }), + (e.prototype.readPixels = function (e, t, i, n) { + var r = new Uint8Array(n * i * 4); + return ( + this._gl.readPixels( + e, + t, + i, + n, + this._gl.RGBA, + this._gl.UNSIGNED_BYTE, + r + ), r - } - , - e.prototype.addExternalData = function(e, t) { - return this._externalData || (this._externalData = new s.a), + ); + }), + (e.prototype.addExternalData = function (e, t) { + return ( + this._externalData || (this._externalData = new s.a()), this._externalData.add(e, t) - } - , - e.prototype.getExternalData = function(e) { - return this._externalData || (this._externalData = new s.a), + ); + }), + (e.prototype.getExternalData = function (e) { + return ( + this._externalData || (this._externalData = new s.a()), this._externalData.get(e) - } - , - e.prototype.getOrAddExternalDataWithFactory = function(e, t) { - return this._externalData || (this._externalData = new s.a), + ); + }), + (e.prototype.getOrAddExternalDataWithFactory = function ( + e, + t + ) { + return ( + this._externalData || (this._externalData = new s.a()), this._externalData.getOrAddWithFactory(e, t) - } - , - e.prototype.removeExternalData = function(e) { - return this._externalData || (this._externalData = new s.a), + ); + }), + (e.prototype.removeExternalData = function (e) { + return ( + this._externalData || (this._externalData = new s.a()), this._externalData.remove(e) - } - , - e.prototype.unbindAllAttributes = function() { - if (this._mustWipeVertexAttributes) { - this._mustWipeVertexAttributes = false; - for (var e = 0; e < this._caps.maxVertexAttribs; e++) - this._gl.disableVertexAttribArray(e), - this._vertexAttribArraysEnabled[e] = false, - this._currentBufferPointers[e].active = false - } else { - e = 0; - for (var t = this._vertexAttribArraysEnabled.length; e < t; e++) - e >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[e] || (this._gl.disableVertexAttribArray(e), - this._vertexAttribArraysEnabled[e] = false, - this._currentBufferPointers[e].active = false) - } - } - , - e.prototype.releaseEffects = function() { - for (var e in this._compiledEffects) { - var t = this._compiledEffects[e].getPipelineContext(); - this._deletePipelineContext(t) - } - this._compiledEffects = {} - } - , - e.prototype.dispose = function() { - for (this.hideLoadingUI(), - this.stopRenderLoop(), - this.onNewSceneAddedObservable.clear(); this.postProcesses.length; ) - this.postProcesses[0].dispose(); - for (this._emptyTexture && (this._releaseTexture(this._emptyTexture), - this._emptyTexture = null), - this._emptyCubeTexture && (this._releaseTexture(this._emptyCubeTexture), - this._emptyCubeTexture = null), - this._rescalePostProcess && this._rescalePostProcess.dispose(); this.scenes.length; ) - this.scenes[0].dispose(); - 1 === e.Instances.length && e.audioEngine && e.audioEngine.dispose(), + ); + }), + (e.prototype.unbindAllAttributes = function () { + if (this._mustWipeVertexAttributes) { + this._mustWipeVertexAttributes = false; + for (var e = 0; e < this._caps.maxVertexAttribs; e++) + this._gl.disableVertexAttribArray(e), + (this._vertexAttribArraysEnabled[e] = false), + (this._currentBufferPointers[e].active = false); + } else { + e = 0; + for ( + var t = this._vertexAttribArraysEnabled.length; + e < t; + e++ + ) + e >= this._caps.maxVertexAttribs || + !this._vertexAttribArraysEnabled[e] || + (this._gl.disableVertexAttribArray(e), + (this._vertexAttribArraysEnabled[e] = false), + (this._currentBufferPointers[e].active = false)); + } + }), + (e.prototype.releaseEffects = function () { + for (var e in this._compiledEffects) { + var t = this._compiledEffects[e].getPipelineContext(); + this._deletePipelineContext(t); + } + this._compiledEffects = {}; + }), + (e.prototype.dispose = function () { + for ( + this.hideLoadingUI(), + this.stopRenderLoop(), + this.onNewSceneAddedObservable.clear(); + this.postProcesses.length; + + ) + this.postProcesses[0].dispose(); + for ( + this._emptyTexture && + (this._releaseTexture(this._emptyTexture), + (this._emptyTexture = null)), + this._emptyCubeTexture && + (this._releaseTexture(this._emptyCubeTexture), + (this._emptyCubeTexture = null)), + this._rescalePostProcess && + this._rescalePostProcess.dispose(); + this.scenes.length; + + ) + this.scenes[0].dispose(); + 1 === e.Instances.length && + e.audioEngine && + e.audioEngine.dispose(), this.releaseEffects(), this.unbindAllAttributes(), - this._boundUniforms = [], - this._dummyFramebuffer && this._gl.deleteFramebuffer(this._dummyFramebuffer), + (this._boundUniforms = []), + this._dummyFramebuffer && + this._gl.deleteFramebuffer(this._dummyFramebuffer), this.disableVR(), - v.a.IsWindowObjectExist() && (window.removeEventListener("blur", this._onBlur), - window.removeEventListener("focus", this._onFocus), - this._renderingCanvas && (this._renderingCanvas.removeEventListener("focus", this._onCanvasFocus), - this._renderingCanvas.removeEventListener("blur", this._onCanvasBlur), - this._renderingCanvas.removeEventListener("pointerout", this._onCanvasPointerOut), - this._doNotHandleContextLost || (this._renderingCanvas.removeEventListener("webglcontextlost", this._onContextLost), - this._renderingCanvas.removeEventListener("webglcontextrestored", this._onContextRestored))), - document.removeEventListener("fullscreenchange", this._onFullscreenChange), - document.removeEventListener("mozfullscreenchange", this._onFullscreenChange), - document.removeEventListener("webkitfullscreenchange", this._onFullscreenChange), - document.removeEventListener("msfullscreenchange", this._onFullscreenChange), - document.removeEventListener("pointerlockchange", this._onPointerLockChange), - document.removeEventListener("mspointerlockchange", this._onPointerLockChange), - document.removeEventListener("mozpointerlockchange", this._onPointerLockChange), - document.removeEventListener("webkitpointerlockchange", this._onPointerLockChange)); - var t = e.Instances.indexOf(this); - t >= 0 && e.Instances.splice(t, 1), - this._workingCanvas = null, - this._workingContext = null, - this._currentBufferPointers = [], - this._renderingCanvas = null, - this._currentProgram = null, - this._bindedRenderFunction = null, + v.a.IsWindowObjectExist() && + (window.removeEventListener("blur", this._onBlur), + window.removeEventListener("focus", this._onFocus), + this._renderingCanvas && + (this._renderingCanvas.removeEventListener( + "focus", + this._onCanvasFocus + ), + this._renderingCanvas.removeEventListener( + "blur", + this._onCanvasBlur + ), + this._renderingCanvas.removeEventListener( + "pointerout", + this._onCanvasPointerOut + ), + this._doNotHandleContextLost || + (this._renderingCanvas.removeEventListener( + "webglcontextlost", + this._onContextLost + ), + this._renderingCanvas.removeEventListener( + "webglcontextrestored", + this._onContextRestored + ))), + document.removeEventListener( + "fullscreenchange", + this._onFullscreenChange + ), + document.removeEventListener( + "mozfullscreenchange", + this._onFullscreenChange + ), + document.removeEventListener( + "webkitfullscreenchange", + this._onFullscreenChange + ), + document.removeEventListener( + "msfullscreenchange", + this._onFullscreenChange + ), + document.removeEventListener( + "pointerlockchange", + this._onPointerLockChange + ), + document.removeEventListener( + "mspointerlockchange", + this._onPointerLockChange + ), + document.removeEventListener( + "mozpointerlockchange", + this._onPointerLockChange + ), + document.removeEventListener( + "webkitpointerlockchange", + this._onPointerLockChange + )); + var t = e.Instances.indexOf(this); + t >= 0 && e.Instances.splice(t, 1), + (this._workingCanvas = null), + (this._workingContext = null), + (this._currentBufferPointers = []), + (this._renderingCanvas = null), + (this._currentProgram = null), + (this._bindedRenderFunction = null), this.onResizeObservable.clear(), this.onCanvasBlurObservable.clear(), this.onCanvasFocusObservable.clear(), @@ -30786,2707 +37775,3838 @@ and limitations under the License. this.onBeginFrameObservable.clear(), this.onEndFrameObservable.clear(), d.a.ResetCache(); - for (var i = 0, n = this._activeRequests; i < n.length; i++) - n[i].abort() - } - , - e.prototype.displayLoadingUI = function() { - if (v.a.IsWindowObjectExist()) { - var e = this.loadingScreen; - e && e.displayLoadingUI() - } - } - , - e.prototype.hideLoadingUI = function() { - if (v.a.IsWindowObjectExist()) { - var e = this._loadingScreen; - e && e.hideLoadingUI() - } - } - , + for ( + var i = 0, n = this._activeRequests; + i < n.length; + i++ + ) + n[i].abort(); + }), + (e.prototype.displayLoadingUI = function () { + if (v.a.IsWindowObjectExist()) { + var e = this.loadingScreen; + e && e.displayLoadingUI(); + } + }), + (e.prototype.hideLoadingUI = function () { + if (v.a.IsWindowObjectExist()) { + var e = this._loadingScreen; + e && e.hideLoadingUI(); + } + }), Object.defineProperty(e.prototype, "loadingScreen", { - get: function() { - return !this._loadingScreen && this._renderingCanvas && (this._loadingScreen = e.DefaultLoadingScreenFactory(this._renderingCanvas)), - this._loadingScreen - }, - set: function(e) { - this._loadingScreen = e - }, - enumerable: true, - configurable: true + get: function () { + return ( + !this._loadingScreen && + this._renderingCanvas && + (this._loadingScreen = + e.DefaultLoadingScreenFactory( + this._renderingCanvas + )), + this._loadingScreen + ); + }, + set: function (e) { + this._loadingScreen = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "loadingUIText", { - set: function(e) { - this.loadingScreen.loadingUIText = e + set: function (e) { + this.loadingScreen.loadingUIText = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "loadingUIBackgroundColor", + { + set: function (e) { + this.loadingScreen.loadingUIBackgroundColor = e; }, enumerable: true, - configurable: true + configurable: true, + } + ), + (e.prototype.attachContextLostEvent = function (e) { + this._renderingCanvas && + this._renderingCanvas.addEventListener( + "webglcontextlost", + e, + false + ); }), - Object.defineProperty(e.prototype, "loadingUIBackgroundColor", { - set: function(e) { - this.loadingScreen.loadingUIBackgroundColor = e - }, - enumerable: true, - configurable: true + (e.prototype.attachContextRestoredEvent = function (e) { + this._renderingCanvas && + this._renderingCanvas.addEventListener( + "webglcontextrestored", + e, + false + ); }), - e.prototype.attachContextLostEvent = function(e) { - this._renderingCanvas && this._renderingCanvas.addEventListener("webglcontextlost", e, false) - } - , - e.prototype.attachContextRestoredEvent = function(e) { - this._renderingCanvas && this._renderingCanvas.addEventListener("webglcontextrestored", e, false) - } - , - e.prototype.getVertexShaderSource = function(e) { - var t = this._gl.getAttachedShaders(e); - return t ? this._gl.getShaderSource(t[0]) : null - } - , - e.prototype.getFragmentShaderSource = function(e) { - var t = this._gl.getAttachedShaders(e); - return t ? this._gl.getShaderSource(t[1]) : null - } - , - e.prototype.getError = function() { - return this._gl.getError() - } - , - e.prototype.getFps = function() { - return this._fps - } - , - e.prototype.getDeltaTime = function() { - return this._deltaTime - } - , - e.prototype._measureFps = function() { - this._performanceMonitor.sampleFrame(), - this._fps = this._performanceMonitor.averageFPS, - this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0 - } - , - e.prototype._readTexturePixels = function(e, t, i, n, r, o) { - void 0 === n && (n = -1), + (e.prototype.getVertexShaderSource = function (e) { + var t = this._gl.getAttachedShaders(e); + return t ? this._gl.getShaderSource(t[0]) : null; + }), + (e.prototype.getFragmentShaderSource = function (e) { + var t = this._gl.getAttachedShaders(e); + return t ? this._gl.getShaderSource(t[1]) : null; + }), + (e.prototype.getError = function () { + return this._gl.getError(); + }), + (e.prototype.getFps = function () { + return this._fps; + }), + (e.prototype.getDeltaTime = function () { + return this._deltaTime; + }), + (e.prototype._measureFps = function () { + this._performanceMonitor.sampleFrame(), + (this._fps = this._performanceMonitor.averageFPS), + (this._deltaTime = + this._performanceMonitor.instantaneousFrameTime || 0); + }), + (e.prototype._readTexturePixels = function ( + e, + t, + i, + n, + r, + o + ) { + void 0 === n && (n = -1), void 0 === r && (r = 0), void 0 === o && (o = null); - var a = this._gl; - if (!this._dummyFramebuffer) { - var s = a.createFramebuffer(); - if (!s) - throw new Error("Unable to create dummy framebuffer"); - this._dummyFramebuffer = s - } - a.bindFramebuffer(a.FRAMEBUFFER, this._dummyFramebuffer), - n > -1 ? a.framebufferTexture2D(a.FRAMEBUFFER, a.COLOR_ATTACHMENT0, a.TEXTURE_CUBE_MAP_POSITIVE_X + n, e._webGLTexture, r) : a.framebufferTexture2D(a.FRAMEBUFFER, a.COLOR_ATTACHMENT0, a.TEXTURE_2D, e._webGLTexture, r); - var c = void 0 !== e.type ? this._getWebGLTextureType(e.type) : a.UNSIGNED_BYTE; - switch (c) { + var a = this._gl; + if (!this._dummyFramebuffer) { + var s = a.createFramebuffer(); + if (!s) + throw new Error("Unable to create dummy framebuffer"); + this._dummyFramebuffer = s; + } + a.bindFramebuffer(a.FRAMEBUFFER, this._dummyFramebuffer), + n > -1 + ? a.framebufferTexture2D( + a.FRAMEBUFFER, + a.COLOR_ATTACHMENT0, + a.TEXTURE_CUBE_MAP_POSITIVE_X + n, + e._webGLTexture, + r + ) + : a.framebufferTexture2D( + a.FRAMEBUFFER, + a.COLOR_ATTACHMENT0, + a.TEXTURE_2D, + e._webGLTexture, + r + ); + var c = + void 0 !== e.type + ? this._getWebGLTextureType(e.type) + : a.UNSIGNED_BYTE; + switch (c) { case a.UNSIGNED_BYTE: - o || (o = new Uint8Array(4 * t * i)), - c = a.UNSIGNED_BYTE; - break; + o || (o = new Uint8Array(4 * t * i)), + (c = a.UNSIGNED_BYTE); + break; default: - o || (o = new Float32Array(4 * t * i)), - c = a.FLOAT - } - return a.readPixels(0, 0, t, i, a.RGBA, c, o), - a.bindFramebuffer(a.FRAMEBUFFER, this._currentFramebuffer), + o || (o = new Float32Array(4 * t * i)), (c = a.FLOAT); + } + return ( + a.readPixels(0, 0, t, i, a.RGBA, c, o), + a.bindFramebuffer( + a.FRAMEBUFFER, + this._currentFramebuffer + ), o - } - , - e.prototype._canRenderToFloatFramebuffer = function() { - return this._webGLVersion > 1 ? this._caps.colorBufferFloat : this._canRenderToFramebuffer(e.TEXTURETYPE_FLOAT) - } - , - e.prototype._canRenderToHalfFloatFramebuffer = function() { - return this._webGLVersion > 1 ? this._caps.colorBufferFloat : this._canRenderToFramebuffer(e.TEXTURETYPE_HALF_FLOAT) - } - , - e.prototype._canRenderToFramebuffer = function(e) { - for (var t = this._gl; t.getError() !== t.NO_ERROR; ) - ; - var i = true - , n = t.createTexture(); - t.bindTexture(t.TEXTURE_2D, n), - t.texImage2D(t.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(e), 1, 1, 0, t.RGBA, this._getWebGLTextureType(e), null), - t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.NEAREST), - t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.NEAREST); - var r = t.createFramebuffer(); - t.bindFramebuffer(t.FRAMEBUFFER, r), - t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, n, 0); - var o = t.checkFramebufferStatus(t.FRAMEBUFFER); - if ((i = (i = i && o === t.FRAMEBUFFER_COMPLETE) && t.getError() === t.NO_ERROR) && (t.clear(t.COLOR_BUFFER_BIT), - i = i && t.getError() === t.NO_ERROR), - i) { - t.bindFramebuffer(t.FRAMEBUFFER, null); - var a = t.RGBA - , s = t.UNSIGNED_BYTE - , c = new Uint8Array(4); - t.readPixels(0, 0, 1, 1, a, s, c), - i = i && t.getError() === t.NO_ERROR - } - for (t.deleteTexture(n), - t.deleteFramebuffer(r), - t.bindFramebuffer(t.FRAMEBUFFER, null); !i && t.getError() !== t.NO_ERROR; ) - ; - return i - } - , - e.prototype._getWebGLTextureType = function(t) { - if (1 === this._webGLVersion) { - switch (t) { - case e.TEXTURETYPE_FLOAT: - return this._gl.FLOAT; - case e.TEXTURETYPE_HALF_FLOAT: - return this._gl.HALF_FLOAT_OES; - case e.TEXTURETYPE_UNSIGNED_BYTE: - return this._gl.UNSIGNED_BYTE - } - return this._gl.UNSIGNED_BYTE - } + ); + }), + (e.prototype._canRenderToFloatFramebuffer = function () { + return this._webGLVersion > 1 + ? this._caps.colorBufferFloat + : this._canRenderToFramebuffer(e.TEXTURETYPE_FLOAT); + }), + (e.prototype._canRenderToHalfFloatFramebuffer = + function () { + return this._webGLVersion > 1 + ? this._caps.colorBufferFloat + : this._canRenderToFramebuffer( + e.TEXTURETYPE_HALF_FLOAT + ); + }), + (e.prototype._canRenderToFramebuffer = function (e) { + for (var t = this._gl; t.getError() !== t.NO_ERROR; ); + var i = true, + n = t.createTexture(); + t.bindTexture(t.TEXTURE_2D, n), + t.texImage2D( + t.TEXTURE_2D, + 0, + this._getRGBABufferInternalSizedFormat(e), + 1, + 1, + 0, + t.RGBA, + this._getWebGLTextureType(e), + null + ), + t.texParameteri( + t.TEXTURE_2D, + t.TEXTURE_MIN_FILTER, + t.NEAREST + ), + t.texParameteri( + t.TEXTURE_2D, + t.TEXTURE_MAG_FILTER, + t.NEAREST + ); + var r = t.createFramebuffer(); + t.bindFramebuffer(t.FRAMEBUFFER, r), + t.framebufferTexture2D( + t.FRAMEBUFFER, + t.COLOR_ATTACHMENT0, + t.TEXTURE_2D, + n, + 0 + ); + var o = t.checkFramebufferStatus(t.FRAMEBUFFER); + if ( + ((i = + (i = i && o === t.FRAMEBUFFER_COMPLETE) && + t.getError() === t.NO_ERROR) && + (t.clear(t.COLOR_BUFFER_BIT), + (i = i && t.getError() === t.NO_ERROR)), + i) + ) { + t.bindFramebuffer(t.FRAMEBUFFER, null); + var a = t.RGBA, + s = t.UNSIGNED_BYTE, + c = new Uint8Array(4); + t.readPixels(0, 0, 1, 1, a, s, c), + (i = i && t.getError() === t.NO_ERROR); + } + for ( + t.deleteTexture(n), + t.deleteFramebuffer(r), + t.bindFramebuffer(t.FRAMEBUFFER, null); + !i && t.getError() !== t.NO_ERROR; + + ); + return i; + }), + (e.prototype._getWebGLTextureType = function (t) { + if (1 === this._webGLVersion) { switch (t) { - case e.TEXTURETYPE_BYTE: - return this._gl.BYTE; - case e.TEXTURETYPE_UNSIGNED_BYTE: - return this._gl.UNSIGNED_BYTE; - case e.TEXTURETYPE_SHORT: - return this._gl.SHORT; - case e.TEXTURETYPE_UNSIGNED_SHORT: - return this._gl.UNSIGNED_SHORT; - case e.TEXTURETYPE_INT: - return this._gl.INT; - case e.TEXTURETYPE_UNSIGNED_INTEGER: - return this._gl.UNSIGNED_INT; - case e.TEXTURETYPE_FLOAT: + case e.TEXTURETYPE_FLOAT: return this._gl.FLOAT; - case e.TEXTURETYPE_HALF_FLOAT: - return this._gl.HALF_FLOAT; - case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4: - return this._gl.UNSIGNED_SHORT_4_4_4_4; - case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1: - return this._gl.UNSIGNED_SHORT_5_5_5_1; - case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5: - return this._gl.UNSIGNED_SHORT_5_6_5; - case e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV: - return this._gl.UNSIGNED_INT_2_10_10_10_REV; - case e.TEXTURETYPE_UNSIGNED_INT_24_8: - return this._gl.UNSIGNED_INT_24_8; - case e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV: - return this._gl.UNSIGNED_INT_10F_11F_11F_REV; - case e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV: - return this._gl.UNSIGNED_INT_5_9_9_9_REV; - case e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV: - return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV + case e.TEXTURETYPE_HALF_FLOAT: + return this._gl.HALF_FLOAT_OES; + case e.TEXTURETYPE_UNSIGNED_BYTE: + return this._gl.UNSIGNED_BYTE; } - return this._gl.UNSIGNED_BYTE - } - , - e.prototype._getInternalFormat = function(t) { - var i = this._gl.RGBA; - switch (t) { - case e.TEXTUREFORMAT_ALPHA: - i = this._gl.ALPHA; - break; - case e.TEXTUREFORMAT_LUMINANCE: - i = this._gl.LUMINANCE; - break; - case e.TEXTUREFORMAT_LUMINANCE_ALPHA: - i = this._gl.LUMINANCE_ALPHA; - break; - case e.TEXTUREFORMAT_RED: - i = this._gl.RED; - break; - case e.TEXTUREFORMAT_RG: - i = this._gl.RG; - break; - case e.TEXTUREFORMAT_RGB: - i = this._gl.RGB; - break; - case e.TEXTUREFORMAT_RGBA: - i = this._gl.RGBA - } - if (this._webGLVersion > 1) - switch (t) { - case e.TEXTUREFORMAT_RED_INTEGER: - i = this._gl.RED_INTEGER; - break; - case e.TEXTUREFORMAT_RG_INTEGER: - i = this._gl.RG_INTEGER; - break; - case e.TEXTUREFORMAT_RGB_INTEGER: - i = this._gl.RGB_INTEGER; - break; - case e.TEXTUREFORMAT_RGBA_INTEGER: - i = this._gl.RGBA_INTEGER - } - return i - } - , - e.prototype._getRGBABufferInternalSizedFormat = function(t, i) { - if (1 === this._webGLVersion) { - if (void 0 !== i) - switch (i) { - case e.TEXTUREFORMAT_ALPHA: - return this._gl.ALPHA; - case e.TEXTUREFORMAT_LUMINANCE: - return this._gl.LUMINANCE; - case e.TEXTUREFORMAT_LUMINANCE_ALPHA: - return this._gl.LUMINANCE_ALPHA - } - return this._gl.RGBA - } - switch (t) { + return this._gl.UNSIGNED_BYTE; + } + switch (t) { case e.TEXTURETYPE_BYTE: - switch (i) { - case e.TEXTUREFORMAT_RED: - return this._gl.R8_SNORM; - case e.TEXTUREFORMAT_RG: - return this._gl.RG8_SNORM; - case e.TEXTUREFORMAT_RGB: - return this._gl.RGB8_SNORM; - case e.TEXTUREFORMAT_RED_INTEGER: - return this._gl.R8I; - case e.TEXTUREFORMAT_RG_INTEGER: - return this._gl.RG8I; - case e.TEXTUREFORMAT_RGB_INTEGER: - return this._gl.RGB8I; - case e.TEXTUREFORMAT_RGBA_INTEGER: - return this._gl.RGBA8I; - default: - return this._gl.RGBA8_SNORM - } + return this._gl.BYTE; case e.TEXTURETYPE_UNSIGNED_BYTE: - switch (i) { - case e.TEXTUREFORMAT_RED: - return this._gl.R8; - case e.TEXTUREFORMAT_RG: - return this._gl.RG8; - case e.TEXTUREFORMAT_RGB: - return this._gl.RGB8; - case e.TEXTUREFORMAT_RGBA: - return this._gl.RGBA8; - case e.TEXTUREFORMAT_RED_INTEGER: - return this._gl.R8UI; - case e.TEXTUREFORMAT_RG_INTEGER: - return this._gl.RG8UI; - case e.TEXTUREFORMAT_RGB_INTEGER: - return this._gl.RGB8UI; - case e.TEXTUREFORMAT_RGBA_INTEGER: - return this._gl.RGBA8UI; - case e.TEXTUREFORMAT_ALPHA: - return this._gl.ALPHA; - case e.TEXTUREFORMAT_LUMINANCE: - return this._gl.LUMINANCE; - case e.TEXTUREFORMAT_LUMINANCE_ALPHA: - return this._gl.LUMINANCE_ALPHA; - default: - return this._gl.RGBA8 - } + return this._gl.UNSIGNED_BYTE; case e.TEXTURETYPE_SHORT: - switch (i) { - case e.TEXTUREFORMAT_RED_INTEGER: - return this._gl.R16I; - case e.TEXTUREFORMAT_RG_INTEGER: - return this._gl.RG16I; - case e.TEXTUREFORMAT_RGB_INTEGER: - return this._gl.RGB16I; - case e.TEXTUREFORMAT_RGBA_INTEGER: - default: - return this._gl.RGBA16I - } + return this._gl.SHORT; case e.TEXTURETYPE_UNSIGNED_SHORT: - switch (i) { - case e.TEXTUREFORMAT_RED_INTEGER: - return this._gl.R16UI; - case e.TEXTUREFORMAT_RG_INTEGER: - return this._gl.RG16UI; - case e.TEXTUREFORMAT_RGB_INTEGER: - return this._gl.RGB16UI; - case e.TEXTUREFORMAT_RGBA_INTEGER: - default: - return this._gl.RGBA16UI - } + return this._gl.UNSIGNED_SHORT; case e.TEXTURETYPE_INT: - switch (i) { - case e.TEXTUREFORMAT_RED_INTEGER: - return this._gl.R32I; - case e.TEXTUREFORMAT_RG_INTEGER: - return this._gl.RG32I; - case e.TEXTUREFORMAT_RGB_INTEGER: - return this._gl.RGB32I; - case e.TEXTUREFORMAT_RGBA_INTEGER: - default: - return this._gl.RGBA32I - } + return this._gl.INT; case e.TEXTURETYPE_UNSIGNED_INTEGER: - switch (i) { - case e.TEXTUREFORMAT_RED_INTEGER: - return this._gl.R32UI; - case e.TEXTUREFORMAT_RG_INTEGER: - return this._gl.RG32UI; - case e.TEXTUREFORMAT_RGB_INTEGER: - return this._gl.RGB32UI; - case e.TEXTUREFORMAT_RGBA_INTEGER: - default: - return this._gl.RGBA32UI - } + return this._gl.UNSIGNED_INT; case e.TEXTURETYPE_FLOAT: - switch (i) { - case e.TEXTUREFORMAT_RED: - return this._gl.R32F; - case e.TEXTUREFORMAT_RG: - return this._gl.RG32F; - case e.TEXTUREFORMAT_RGB: - return this._gl.RGB32F; - case e.TEXTUREFORMAT_RGBA: - default: - return this._gl.RGBA32F - } + return this._gl.FLOAT; case e.TEXTURETYPE_HALF_FLOAT: - switch (i) { - case e.TEXTUREFORMAT_RED: - return this._gl.R16F; - case e.TEXTUREFORMAT_RG: - return this._gl.RG16F; - case e.TEXTUREFORMAT_RGB: - return this._gl.RGB16F; - case e.TEXTUREFORMAT_RGBA: - default: - return this._gl.RGBA16F - } - case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5: - return this._gl.RGB565; - case e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV: - return this._gl.R11F_G11F_B10F; - case e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV: - return this._gl.RGB9_E5; + return this._gl.HALF_FLOAT; case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4: - return this._gl.RGBA4; + return this._gl.UNSIGNED_SHORT_4_4_4_4; case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1: - return this._gl.RGB5_A1; + return this._gl.UNSIGNED_SHORT_5_5_5_1; + case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5: + return this._gl.UNSIGNED_SHORT_5_6_5; case e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV: - switch (i) { - case e.TEXTUREFORMAT_RGBA: - return this._gl.RGB10_A2; - case e.TEXTUREFORMAT_RGBA_INTEGER: - return this._gl.RGB10_A2UI; - default: - return this._gl.RGB10_A2 - } + return this._gl.UNSIGNED_INT_2_10_10_10_REV; + case e.TEXTURETYPE_UNSIGNED_INT_24_8: + return this._gl.UNSIGNED_INT_24_8; + case e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV: + return this._gl.UNSIGNED_INT_10F_11F_11F_REV; + case e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV: + return this._gl.UNSIGNED_INT_5_9_9_9_REV; + case e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV: + return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV; + } + return this._gl.UNSIGNED_BYTE; + }), + (e.prototype._getInternalFormat = function (t) { + var i = this._gl.RGBA; + switch (t) { + case e.TEXTUREFORMAT_ALPHA: + i = this._gl.ALPHA; + break; + case e.TEXTUREFORMAT_LUMINANCE: + i = this._gl.LUMINANCE; + break; + case e.TEXTUREFORMAT_LUMINANCE_ALPHA: + i = this._gl.LUMINANCE_ALPHA; + break; + case e.TEXTUREFORMAT_RED: + i = this._gl.RED; + break; + case e.TEXTUREFORMAT_RG: + i = this._gl.RG; + break; + case e.TEXTUREFORMAT_RGB: + i = this._gl.RGB; + break; + case e.TEXTUREFORMAT_RGBA: + i = this._gl.RGBA; + } + if (this._webGLVersion > 1) + switch (t) { + case e.TEXTUREFORMAT_RED_INTEGER: + i = this._gl.RED_INTEGER; + break; + case e.TEXTUREFORMAT_RG_INTEGER: + i = this._gl.RG_INTEGER; + break; + case e.TEXTUREFORMAT_RGB_INTEGER: + i = this._gl.RGB_INTEGER; + break; + case e.TEXTUREFORMAT_RGBA_INTEGER: + i = this._gl.RGBA_INTEGER; } - return this._gl.RGBA8 - } - , - e.prototype._getRGBAMultiSampleBufferFormat = function(t) { - return t === e.TEXTURETYPE_FLOAT ? this._gl.RGBA32F : t === e.TEXTURETYPE_HALF_FLOAT ? this._gl.RGBA16F : this._gl.RGBA8 - } - , - e.prototype._loadFile = function(e, t, i, n, r, o) { - var a = this - , s = l.h.LoadFile(e, t, i, n, r, o); - return this._activeRequests.push(s), - s.onCompleteObservable.add(function(e) { - a._activeRequests.splice(a._activeRequests.indexOf(e), 1) + return i; + }), + (e.prototype._getRGBABufferInternalSizedFormat = function ( + t, + i + ) { + if (1 === this._webGLVersion) { + if (void 0 !== i) + switch (i) { + case e.TEXTUREFORMAT_ALPHA: + return this._gl.ALPHA; + case e.TEXTUREFORMAT_LUMINANCE: + return this._gl.LUMINANCE; + case e.TEXTUREFORMAT_LUMINANCE_ALPHA: + return this._gl.LUMINANCE_ALPHA; + } + return this._gl.RGBA; + } + switch (t) { + case e.TEXTURETYPE_BYTE: + switch (i) { + case e.TEXTUREFORMAT_RED: + return this._gl.R8_SNORM; + case e.TEXTUREFORMAT_RG: + return this._gl.RG8_SNORM; + case e.TEXTUREFORMAT_RGB: + return this._gl.RGB8_SNORM; + case e.TEXTUREFORMAT_RED_INTEGER: + return this._gl.R8I; + case e.TEXTUREFORMAT_RG_INTEGER: + return this._gl.RG8I; + case e.TEXTUREFORMAT_RGB_INTEGER: + return this._gl.RGB8I; + case e.TEXTUREFORMAT_RGBA_INTEGER: + return this._gl.RGBA8I; + default: + return this._gl.RGBA8_SNORM; + } + case e.TEXTURETYPE_UNSIGNED_BYTE: + switch (i) { + case e.TEXTUREFORMAT_RED: + return this._gl.R8; + case e.TEXTUREFORMAT_RG: + return this._gl.RG8; + case e.TEXTUREFORMAT_RGB: + return this._gl.RGB8; + case e.TEXTUREFORMAT_RGBA: + return this._gl.RGBA8; + case e.TEXTUREFORMAT_RED_INTEGER: + return this._gl.R8UI; + case e.TEXTUREFORMAT_RG_INTEGER: + return this._gl.RG8UI; + case e.TEXTUREFORMAT_RGB_INTEGER: + return this._gl.RGB8UI; + case e.TEXTUREFORMAT_RGBA_INTEGER: + return this._gl.RGBA8UI; + case e.TEXTUREFORMAT_ALPHA: + return this._gl.ALPHA; + case e.TEXTUREFORMAT_LUMINANCE: + return this._gl.LUMINANCE; + case e.TEXTUREFORMAT_LUMINANCE_ALPHA: + return this._gl.LUMINANCE_ALPHA; + default: + return this._gl.RGBA8; + } + case e.TEXTURETYPE_SHORT: + switch (i) { + case e.TEXTUREFORMAT_RED_INTEGER: + return this._gl.R16I; + case e.TEXTUREFORMAT_RG_INTEGER: + return this._gl.RG16I; + case e.TEXTUREFORMAT_RGB_INTEGER: + return this._gl.RGB16I; + case e.TEXTUREFORMAT_RGBA_INTEGER: + default: + return this._gl.RGBA16I; + } + case e.TEXTURETYPE_UNSIGNED_SHORT: + switch (i) { + case e.TEXTUREFORMAT_RED_INTEGER: + return this._gl.R16UI; + case e.TEXTUREFORMAT_RG_INTEGER: + return this._gl.RG16UI; + case e.TEXTUREFORMAT_RGB_INTEGER: + return this._gl.RGB16UI; + case e.TEXTUREFORMAT_RGBA_INTEGER: + default: + return this._gl.RGBA16UI; + } + case e.TEXTURETYPE_INT: + switch (i) { + case e.TEXTUREFORMAT_RED_INTEGER: + return this._gl.R32I; + case e.TEXTUREFORMAT_RG_INTEGER: + return this._gl.RG32I; + case e.TEXTUREFORMAT_RGB_INTEGER: + return this._gl.RGB32I; + case e.TEXTUREFORMAT_RGBA_INTEGER: + default: + return this._gl.RGBA32I; + } + case e.TEXTURETYPE_UNSIGNED_INTEGER: + switch (i) { + case e.TEXTUREFORMAT_RED_INTEGER: + return this._gl.R32UI; + case e.TEXTUREFORMAT_RG_INTEGER: + return this._gl.RG32UI; + case e.TEXTUREFORMAT_RGB_INTEGER: + return this._gl.RGB32UI; + case e.TEXTUREFORMAT_RGBA_INTEGER: + default: + return this._gl.RGBA32UI; + } + case e.TEXTURETYPE_FLOAT: + switch (i) { + case e.TEXTUREFORMAT_RED: + return this._gl.R32F; + case e.TEXTUREFORMAT_RG: + return this._gl.RG32F; + case e.TEXTUREFORMAT_RGB: + return this._gl.RGB32F; + case e.TEXTUREFORMAT_RGBA: + default: + return this._gl.RGBA32F; + } + case e.TEXTURETYPE_HALF_FLOAT: + switch (i) { + case e.TEXTUREFORMAT_RED: + return this._gl.R16F; + case e.TEXTUREFORMAT_RG: + return this._gl.RG16F; + case e.TEXTUREFORMAT_RGB: + return this._gl.RGB16F; + case e.TEXTUREFORMAT_RGBA: + default: + return this._gl.RGBA16F; + } + case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5: + return this._gl.RGB565; + case e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV: + return this._gl.R11F_G11F_B10F; + case e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV: + return this._gl.RGB9_E5; + case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4: + return this._gl.RGBA4; + case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1: + return this._gl.RGB5_A1; + case e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV: + switch (i) { + case e.TEXTUREFORMAT_RGBA: + return this._gl.RGB10_A2; + case e.TEXTUREFORMAT_RGBA_INTEGER: + return this._gl.RGB10_A2UI; + default: + return this._gl.RGB10_A2; + } + } + return this._gl.RGBA8; + }), + (e.prototype._getRGBAMultiSampleBufferFormat = function ( + t + ) { + return t === e.TEXTURETYPE_FLOAT + ? this._gl.RGBA32F + : t === e.TEXTURETYPE_HALF_FLOAT + ? this._gl.RGBA16F + : this._gl.RGBA8; + }), + (e.prototype._loadFile = function (e, t, i, n, r, o) { + var a = this, + s = l.h.LoadFile(e, t, i, n, r, o); + return ( + this._activeRequests.push(s), + s.onCompleteObservable.add(function (e) { + a._activeRequests.splice( + a._activeRequests.indexOf(e), + 1 + ); }), s - } - , - e.prototype._loadFileAsync = function(e, t, n) { - var r = this; - return new i(function(i, o) { - r._loadFile(e, function(e) { - i(e) - }, void 0, t, n, function(e, t) { - o(t) - }) - } - ) - } - , - e.isSupported = function() { - try { - var e = document.createElement("canvas"); - return null != (e.getContext("webgl") || e.getContext("experimental-webgl")) && !!window.WebGLRenderingContext - } catch (e) { - return false - } - } - , - e.ExceptionList = [{ + ); + }), + (e.prototype._loadFileAsync = function (e, t, n) { + var r = this; + return new i(function (i, o) { + r._loadFile( + e, + function (e) { + i(e); + }, + void 0, + t, + n, + function (e, t) { + o(t); + } + ); + }); + }), + (e.isSupported = function () { + try { + var e = document.createElement("canvas"); + return ( + null != + (e.getContext("webgl") || + e.getContext("experimental-webgl")) && + !!window.WebGLRenderingContext + ); + } catch (e) { + return false; + } + }), + (e.ExceptionList = [ + { key: "Chrome/63.0", capture: "63\\.0\\.3239\\.(\\d+)", captureConstraint: 108, - targets: ["uniformBuffer"] - }, { + targets: ["uniformBuffer"], + }, + { key: "Firefox/58", capture: null, captureConstraint: null, - targets: ["uniformBuffer"] - }, { + targets: ["uniformBuffer"], + }, + { key: "Firefox/59", capture: null, captureConstraint: null, - targets: ["uniformBuffer"] - }, { + targets: ["uniformBuffer"], + }, + { key: "Chrome/72.+?Mobile", capture: null, captureConstraint: null, - targets: ["vao"] - }, { + targets: ["vao"], + }, + { key: "Chrome/73.+?Mobile", capture: null, captureConstraint: null, - targets: ["vao"] - }, { + targets: ["vao"], + }, + { key: "Chrome/74.+?Mobile", capture: null, captureConstraint: null, - targets: ["vao"] - }, { + targets: ["vao"], + }, + { key: "Mac OS.+Chrome/71", capture: null, captureConstraint: null, - targets: ["vao"] - }, { + targets: ["vao"], + }, + { key: "Mac OS.+Chrome/72", capture: null, captureConstraint: null, - targets: ["vao"] - }], - e._TextureLoaders = [], - e.ALPHA_DISABLE = _.a.ALPHA_DISABLE, - e.ALPHA_ADD = _.a.ALPHA_ADD, - e.ALPHA_COMBINE = _.a.ALPHA_COMBINE, - e.ALPHA_SUBTRACT = _.a.ALPHA_SUBTRACT, - e.ALPHA_MULTIPLY = _.a.ALPHA_MULTIPLY, - e.ALPHA_MAXIMIZED = _.a.ALPHA_MAXIMIZED, - e.ALPHA_ONEONE = _.a.ALPHA_ONEONE, - e.ALPHA_PREMULTIPLIED = _.a.ALPHA_PREMULTIPLIED, - e.ALPHA_PREMULTIPLIED_PORTERDUFF = _.a.ALPHA_PREMULTIPLIED_PORTERDUFF, - e.ALPHA_INTERPOLATE = _.a.ALPHA_INTERPOLATE, - e.ALPHA_SCREENMODE = _.a.ALPHA_SCREENMODE, - e.DELAYLOADSTATE_NONE = _.a.DELAYLOADSTATE_NONE, - e.DELAYLOADSTATE_LOADED = _.a.DELAYLOADSTATE_LOADED, - e.DELAYLOADSTATE_LOADING = _.a.DELAYLOADSTATE_LOADING, - e.DELAYLOADSTATE_NOTLOADED = _.a.DELAYLOADSTATE_NOTLOADED, - e.NEVER = _.a.NEVER, - e.ALWAYS = _.a.ALWAYS, - e.LESS = _.a.LESS, - e.EQUAL = _.a.EQUAL, - e.LEQUAL = _.a.LEQUAL, - e.GREATER = _.a.GREATER, - e.GEQUAL = _.a.GEQUAL, - e.NOTEQUAL = _.a.NOTEQUAL, - e.KEEP = _.a.KEEP, - e.REPLACE = _.a.REPLACE, - e.INCR = _.a.INCR, - e.DECR = _.a.DECR, - e.INVERT = _.a.INVERT, - e.INCR_WRAP = _.a.INCR_WRAP, - e.DECR_WRAP = _.a.DECR_WRAP, - e.TEXTURE_CLAMP_ADDRESSMODE = _.a.TEXTURE_CLAMP_ADDRESSMODE, - e.TEXTURE_WRAP_ADDRESSMODE = _.a.TEXTURE_WRAP_ADDRESSMODE, - e.TEXTURE_MIRROR_ADDRESSMODE = _.a.TEXTURE_MIRROR_ADDRESSMODE, - e.TEXTUREFORMAT_ALPHA = _.a.TEXTUREFORMAT_ALPHA, - e.TEXTUREFORMAT_LUMINANCE = _.a.TEXTUREFORMAT_LUMINANCE, - e.TEXTUREFORMAT_LUMINANCE_ALPHA = _.a.TEXTUREFORMAT_LUMINANCE_ALPHA, - e.TEXTUREFORMAT_RGB = _.a.TEXTUREFORMAT_RGB, - e.TEXTUREFORMAT_RGBA = _.a.TEXTUREFORMAT_RGBA, - e.TEXTUREFORMAT_RED = _.a.TEXTUREFORMAT_RED, - e.TEXTUREFORMAT_R = _.a.TEXTUREFORMAT_R, - e.TEXTUREFORMAT_RG = _.a.TEXTUREFORMAT_RG, - e.TEXTUREFORMAT_RED_INTEGER = _.a.TEXTUREFORMAT_RED_INTEGER, - e.TEXTUREFORMAT_R_INTEGER = _.a.TEXTUREFORMAT_R_INTEGER, - e.TEXTUREFORMAT_RG_INTEGER = _.a.TEXTUREFORMAT_RG_INTEGER, - e.TEXTUREFORMAT_RGB_INTEGER = _.a.TEXTUREFORMAT_RGB_INTEGER, - e.TEXTUREFORMAT_RGBA_INTEGER = _.a.TEXTUREFORMAT_RGBA_INTEGER, - e.TEXTURETYPE_UNSIGNED_BYTE = _.a.TEXTURETYPE_UNSIGNED_BYTE, - e.TEXTURETYPE_UNSIGNED_INT = _.a.TEXTURETYPE_UNSIGNED_INT, - e.TEXTURETYPE_FLOAT = _.a.TEXTURETYPE_FLOAT, - e.TEXTURETYPE_HALF_FLOAT = _.a.TEXTURETYPE_HALF_FLOAT, - e.TEXTURETYPE_BYTE = _.a.TEXTURETYPE_BYTE, - e.TEXTURETYPE_SHORT = _.a.TEXTURETYPE_SHORT, - e.TEXTURETYPE_UNSIGNED_SHORT = _.a.TEXTURETYPE_UNSIGNED_SHORT, - e.TEXTURETYPE_INT = _.a.TEXTURETYPE_INT, - e.TEXTURETYPE_UNSIGNED_INTEGER = _.a.TEXTURETYPE_UNSIGNED_INTEGER, - e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = _.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4, - e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = _.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1, - e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = _.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5, - e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = _.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV, - e.TEXTURETYPE_UNSIGNED_INT_24_8 = _.a.TEXTURETYPE_UNSIGNED_INT_24_8, - e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = _.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV, - e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = _.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV, - e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = _.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV, - e.TEXTURE_NEAREST_SAMPLINGMODE = _.a.TEXTURE_NEAREST_SAMPLINGMODE, - e.TEXTURE_BILINEAR_SAMPLINGMODE = _.a.TEXTURE_BILINEAR_SAMPLINGMODE, - e.TEXTURE_TRILINEAR_SAMPLINGMODE = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, - e.TEXTURE_NEAREST_NEAREST_MIPLINEAR = _.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR, - e.TEXTURE_LINEAR_LINEAR_MIPNEAREST = _.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST, - e.TEXTURE_LINEAR_LINEAR_MIPLINEAR = _.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR, - e.TEXTURE_NEAREST_NEAREST_MIPNEAREST = _.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST, - e.TEXTURE_NEAREST_LINEAR_MIPNEAREST = _.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST, - e.TEXTURE_NEAREST_LINEAR_MIPLINEAR = _.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR, - e.TEXTURE_NEAREST_LINEAR = _.a.TEXTURE_NEAREST_LINEAR, - e.TEXTURE_NEAREST_NEAREST = _.a.TEXTURE_NEAREST_NEAREST, - e.TEXTURE_LINEAR_NEAREST_MIPNEAREST = _.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST, - e.TEXTURE_LINEAR_NEAREST_MIPLINEAR = _.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR, - e.TEXTURE_LINEAR_LINEAR = _.a.TEXTURE_LINEAR_LINEAR, - e.TEXTURE_LINEAR_NEAREST = _.a.TEXTURE_LINEAR_NEAREST, - e.TEXTURE_EXPLICIT_MODE = _.a.TEXTURE_EXPLICIT_MODE, - e.TEXTURE_SPHERICAL_MODE = _.a.TEXTURE_SPHERICAL_MODE, - e.TEXTURE_PLANAR_MODE = _.a.TEXTURE_PLANAR_MODE, - e.TEXTURE_CUBIC_MODE = _.a.TEXTURE_CUBIC_MODE, - e.TEXTURE_PROJECTION_MODE = _.a.TEXTURE_PROJECTION_MODE, - e.TEXTURE_SKYBOX_MODE = _.a.TEXTURE_SKYBOX_MODE, - e.TEXTURE_INVCUBIC_MODE = _.a.TEXTURE_INVCUBIC_MODE, - e.TEXTURE_EQUIRECTANGULAR_MODE = _.a.TEXTURE_EQUIRECTANGULAR_MODE, - e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = _.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE, - e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = _.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE, - e.SCALEMODE_FLOOR = _.a.SCALEMODE_FLOOR, - e.SCALEMODE_NEAREST = _.a.SCALEMODE_NEAREST, - e.SCALEMODE_CEILING = _.a.SCALEMODE_CEILING, - e.CollisionsEpsilon = .001, - e._RescalePostProcessFactory = null, + targets: ["vao"], + }, + ]), + (e._TextureLoaders = []), + (e.ALPHA_DISABLE = _.a.ALPHA_DISABLE), + (e.ALPHA_ADD = _.a.ALPHA_ADD), + (e.ALPHA_COMBINE = _.a.ALPHA_COMBINE), + (e.ALPHA_SUBTRACT = _.a.ALPHA_SUBTRACT), + (e.ALPHA_MULTIPLY = _.a.ALPHA_MULTIPLY), + (e.ALPHA_MAXIMIZED = _.a.ALPHA_MAXIMIZED), + (e.ALPHA_ONEONE = _.a.ALPHA_ONEONE), + (e.ALPHA_PREMULTIPLIED = _.a.ALPHA_PREMULTIPLIED), + (e.ALPHA_PREMULTIPLIED_PORTERDUFF = + _.a.ALPHA_PREMULTIPLIED_PORTERDUFF), + (e.ALPHA_INTERPOLATE = _.a.ALPHA_INTERPOLATE), + (e.ALPHA_SCREENMODE = _.a.ALPHA_SCREENMODE), + (e.DELAYLOADSTATE_NONE = _.a.DELAYLOADSTATE_NONE), + (e.DELAYLOADSTATE_LOADED = _.a.DELAYLOADSTATE_LOADED), + (e.DELAYLOADSTATE_LOADING = _.a.DELAYLOADSTATE_LOADING), + (e.DELAYLOADSTATE_NOTLOADED = _.a.DELAYLOADSTATE_NOTLOADED), + (e.NEVER = _.a.NEVER), + (e.ALWAYS = _.a.ALWAYS), + (e.LESS = _.a.LESS), + (e.EQUAL = _.a.EQUAL), + (e.LEQUAL = _.a.LEQUAL), + (e.GREATER = _.a.GREATER), + (e.GEQUAL = _.a.GEQUAL), + (e.NOTEQUAL = _.a.NOTEQUAL), + (e.KEEP = _.a.KEEP), + (e.REPLACE = _.a.REPLACE), + (e.INCR = _.a.INCR), + (e.DECR = _.a.DECR), + (e.INVERT = _.a.INVERT), + (e.INCR_WRAP = _.a.INCR_WRAP), + (e.DECR_WRAP = _.a.DECR_WRAP), + (e.TEXTURE_CLAMP_ADDRESSMODE = + _.a.TEXTURE_CLAMP_ADDRESSMODE), + (e.TEXTURE_WRAP_ADDRESSMODE = _.a.TEXTURE_WRAP_ADDRESSMODE), + (e.TEXTURE_MIRROR_ADDRESSMODE = + _.a.TEXTURE_MIRROR_ADDRESSMODE), + (e.TEXTUREFORMAT_ALPHA = _.a.TEXTUREFORMAT_ALPHA), + (e.TEXTUREFORMAT_LUMINANCE = _.a.TEXTUREFORMAT_LUMINANCE), + (e.TEXTUREFORMAT_LUMINANCE_ALPHA = + _.a.TEXTUREFORMAT_LUMINANCE_ALPHA), + (e.TEXTUREFORMAT_RGB = _.a.TEXTUREFORMAT_RGB), + (e.TEXTUREFORMAT_RGBA = _.a.TEXTUREFORMAT_RGBA), + (e.TEXTUREFORMAT_RED = _.a.TEXTUREFORMAT_RED), + (e.TEXTUREFORMAT_R = _.a.TEXTUREFORMAT_R), + (e.TEXTUREFORMAT_RG = _.a.TEXTUREFORMAT_RG), + (e.TEXTUREFORMAT_RED_INTEGER = + _.a.TEXTUREFORMAT_RED_INTEGER), + (e.TEXTUREFORMAT_R_INTEGER = _.a.TEXTUREFORMAT_R_INTEGER), + (e.TEXTUREFORMAT_RG_INTEGER = _.a.TEXTUREFORMAT_RG_INTEGER), + (e.TEXTUREFORMAT_RGB_INTEGER = + _.a.TEXTUREFORMAT_RGB_INTEGER), + (e.TEXTUREFORMAT_RGBA_INTEGER = + _.a.TEXTUREFORMAT_RGBA_INTEGER), + (e.TEXTURETYPE_UNSIGNED_BYTE = + _.a.TEXTURETYPE_UNSIGNED_BYTE), + (e.TEXTURETYPE_UNSIGNED_INT = _.a.TEXTURETYPE_UNSIGNED_INT), + (e.TEXTURETYPE_FLOAT = _.a.TEXTURETYPE_FLOAT), + (e.TEXTURETYPE_HALF_FLOAT = _.a.TEXTURETYPE_HALF_FLOAT), + (e.TEXTURETYPE_BYTE = _.a.TEXTURETYPE_BYTE), + (e.TEXTURETYPE_SHORT = _.a.TEXTURETYPE_SHORT), + (e.TEXTURETYPE_UNSIGNED_SHORT = + _.a.TEXTURETYPE_UNSIGNED_SHORT), + (e.TEXTURETYPE_INT = _.a.TEXTURETYPE_INT), + (e.TEXTURETYPE_UNSIGNED_INTEGER = + _.a.TEXTURETYPE_UNSIGNED_INTEGER), + (e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = + _.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4), + (e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = + _.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1), + (e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = + _.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5), + (e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = + _.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV), + (e.TEXTURETYPE_UNSIGNED_INT_24_8 = + _.a.TEXTURETYPE_UNSIGNED_INT_24_8), + (e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = + _.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV), + (e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = + _.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV), + (e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = + _.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV), + (e.TEXTURE_NEAREST_SAMPLINGMODE = + _.a.TEXTURE_NEAREST_SAMPLINGMODE), + (e.TEXTURE_BILINEAR_SAMPLINGMODE = + _.a.TEXTURE_BILINEAR_SAMPLINGMODE), + (e.TEXTURE_TRILINEAR_SAMPLINGMODE = + _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + (e.TEXTURE_NEAREST_NEAREST_MIPLINEAR = + _.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR), + (e.TEXTURE_LINEAR_LINEAR_MIPNEAREST = + _.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST), + (e.TEXTURE_LINEAR_LINEAR_MIPLINEAR = + _.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR), + (e.TEXTURE_NEAREST_NEAREST_MIPNEAREST = + _.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST), + (e.TEXTURE_NEAREST_LINEAR_MIPNEAREST = + _.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST), + (e.TEXTURE_NEAREST_LINEAR_MIPLINEAR = + _.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR), + (e.TEXTURE_NEAREST_LINEAR = _.a.TEXTURE_NEAREST_LINEAR), + (e.TEXTURE_NEAREST_NEAREST = _.a.TEXTURE_NEAREST_NEAREST), + (e.TEXTURE_LINEAR_NEAREST_MIPNEAREST = + _.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST), + (e.TEXTURE_LINEAR_NEAREST_MIPLINEAR = + _.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR), + (e.TEXTURE_LINEAR_LINEAR = _.a.TEXTURE_LINEAR_LINEAR), + (e.TEXTURE_LINEAR_NEAREST = _.a.TEXTURE_LINEAR_NEAREST), + (e.TEXTURE_EXPLICIT_MODE = _.a.TEXTURE_EXPLICIT_MODE), + (e.TEXTURE_SPHERICAL_MODE = _.a.TEXTURE_SPHERICAL_MODE), + (e.TEXTURE_PLANAR_MODE = _.a.TEXTURE_PLANAR_MODE), + (e.TEXTURE_CUBIC_MODE = _.a.TEXTURE_CUBIC_MODE), + (e.TEXTURE_PROJECTION_MODE = _.a.TEXTURE_PROJECTION_MODE), + (e.TEXTURE_SKYBOX_MODE = _.a.TEXTURE_SKYBOX_MODE), + (e.TEXTURE_INVCUBIC_MODE = _.a.TEXTURE_INVCUBIC_MODE), + (e.TEXTURE_EQUIRECTANGULAR_MODE = + _.a.TEXTURE_EQUIRECTANGULAR_MODE), + (e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = + _.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE), + (e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = + _.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE), + (e.SCALEMODE_FLOOR = _.a.SCALEMODE_FLOOR), + (e.SCALEMODE_NEAREST = _.a.SCALEMODE_NEAREST), + (e.SCALEMODE_CEILING = _.a.SCALEMODE_CEILING), + (e.CollisionsEpsilon = 0.001), + (e._RescalePostProcessFactory = null), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "b", function() { - return C + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "b", function () { + return C; + }), + i.d(t, "c", function () { + return R; }), - i.d(t, "c", function() { - return R - }), - i.d(t, "a", function() { - return O + i.d(t, "a", function () { + return O; }); - var n = i(1) - , r = i(8) - , o = i(9) - , a = i(32) - , s = i(29) - , c = i(0) - , u = i(25) - , l = i(4) - , h = i(13) - , f = i(57) - , d = i(24) - , p = i(49) - , m = i(43) - , g = i(20) - , _ = i(66) - , v = i(55) - , y = i(3) - , b = i(2) - , E = i(6) - , T = i(22) - , A = i(19) - , x = i(14) - , S = i(110) - , C = function() {} - , P = function() { - this.visibleInstances = {}, - this.batchCache = new R, - this.instancesBufferSize = 2048 - } - , R = function() { - this.mustReturn = false, - this.visibleInstances = new Array, - this.renderSelf = new Array, - this.hardwareInstancedRendering = new Array - } - , M = function() { - this._areNormalsFrozen = false, - this._source = null, - this.meshMap = null, - this._preActivateId = -1, - this._LODLevels = new Array, - this._morphTargetManager = null - } - , O = function(e) { - function t(i, n, r, o, c, u) { - void 0 === n && (n = null), - void 0 === r && (r = null), - void 0 === o && (o = null), - void 0 === u && (u = true); - var l = e.call(this, i, n) || this; - if (l._internalMeshDataInfo = new M, - l.delayLoadState = y.a.DELAYLOADSTATE_NONE, - l.instances = new Array, - l._creationDataStorage = null, - l._geometry = null, - l._instanceDataStorage = new P, - l._effectiveMaterial = null, - l._shouldGenerateFlatShading = false, - l._originalBuilderSideOrientation = t.DEFAULTSIDE, - l.overrideMaterialSideOrientation = null, - n = l.getScene(), - o) { - if (o._geometry && o._geometry.applyToMesh(l), - a.a.DeepCopy(o, l, ["name", "material", "skeleton", "instances", "parent", "uniqueId", "source", "metadata", "hasLODLevels", "geometry", "isBlocked", "areNormalsFrozen", "onBeforeDrawObservable", "onBeforeRenderObservable", "onAfterRenderObservable", "onBeforeDraw", "onAfterWorldMatrixUpdateObservable", "onCollideObservable", "onCollisionPositionChangeObservable", "onRebuildObservable", "onDisposeObservable"], ["_poseMatrix"]), - l._internalMeshDataInfo._source = o, - n.useClonedMeshhMap && (o._internalMeshDataInfo.meshMap || (o._internalMeshDataInfo.meshMap = {}), - o._internalMeshDataInfo.meshMap[l.uniqueId] = l), - l._originalBuilderSideOrientation = o._originalBuilderSideOrientation, - l._creationDataStorage = o._creationDataStorage, - o._ranges) { - var h = o._ranges; - for (var i in h) - h.hasOwnProperty(i) && h[i] && l.createAnimationRange(i, h[i].from, h[i].to) - } - var f; - if (o.metadata && o.metadata.clone ? l.metadata = o.metadata.clone() : l.metadata = o.metadata, - s.a && s.a.HasTags(o) && s.a.AddTagsTo(l, s.a.GetTags(o, true)), - l.parent = o.parent, - l.setPivotMatrix(o.getPivotMatrix()), - l.id = i + "." + o.id, - l.material = o.material, - !c) - for (var d = o.getDescendants(true), p = 0; p < d.length; p++) { - var m = d[p]; - m.clone && m.clone(i + "." + m.name, l) - } - if (n.getPhysicsEngine) { - var g = n.getPhysicsEngine(); - if (u && g) { - var _ = g.getImpostorForPhysicsObject(o); - _ && (l.physicsImpostor = _.clone(l)) - } - } - for (f = 0; f < n.particleSystems.length; f++) { - var v = n.particleSystems[f]; - v.emitter === o && v.clone(v.name, l) - } - l.refreshBoundingInfo(), - l.computeWorldMatrix(true) + var n = i(1), + r = i(8), + o = i(9), + a = i(32), + s = i(29), + c = i(0), + u = i(25), + l = i(4), + h = i(13), + f = i(57), + d = i(24), + p = i(49), + m = i(43), + g = i(20), + _ = i(66), + v = i(55), + y = i(3), + b = i(2), + E = i(6), + T = i(22), + A = i(19), + x = i(14), + S = i(110), + C = function () {}, + P = function () { + (this.visibleInstances = {}), + (this.batchCache = new R()), + (this.instancesBufferSize = 2048); + }, + R = function () { + (this.mustReturn = false), + (this.visibleInstances = new Array()), + (this.renderSelf = new Array()), + (this.hardwareInstancedRendering = new Array()); + }, + M = function () { + (this._areNormalsFrozen = false), + (this._source = null), + (this.meshMap = null), + (this._preActivateId = -1), + (this._LODLevels = new Array()), + (this._morphTargetManager = null); + }, + O = (function (e) { + function t(i, n, r, o, c, u) { + void 0 === n && (n = null), + void 0 === r && (r = null), + void 0 === o && (o = null), + void 0 === u && (u = true); + var l = e.call(this, i, n) || this; + if ( + ((l._internalMeshDataInfo = new M()), + (l.delayLoadState = y.a.DELAYLOADSTATE_NONE), + (l.instances = new Array()), + (l._creationDataStorage = null), + (l._geometry = null), + (l._instanceDataStorage = new P()), + (l._effectiveMaterial = null), + (l._shouldGenerateFlatShading = false), + (l._originalBuilderSideOrientation = t.DEFAULTSIDE), + (l.overrideMaterialSideOrientation = null), + (n = l.getScene()), + o) + ) { + if ( + (o._geometry && o._geometry.applyToMesh(l), + a.a.DeepCopy( + o, + l, + [ + "name", + "material", + "skeleton", + "instances", + "parent", + "uniqueId", + "source", + "metadata", + "hasLODLevels", + "geometry", + "isBlocked", + "areNormalsFrozen", + "onBeforeDrawObservable", + "onBeforeRenderObservable", + "onAfterRenderObservable", + "onBeforeDraw", + "onAfterWorldMatrixUpdateObservable", + "onCollideObservable", + "onCollisionPositionChangeObservable", + "onRebuildObservable", + "onDisposeObservable", + ], + ["_poseMatrix"] + ), + (l._internalMeshDataInfo._source = o), + n.useClonedMeshhMap && + (o._internalMeshDataInfo.meshMap || + (o._internalMeshDataInfo.meshMap = {}), + (o._internalMeshDataInfo.meshMap[l.uniqueId] = l)), + (l._originalBuilderSideOrientation = + o._originalBuilderSideOrientation), + (l._creationDataStorage = o._creationDataStorage), + o._ranges) + ) { + var h = o._ranges; + for (var i in h) + h.hasOwnProperty(i) && + h[i] && + l.createAnimationRange(i, h[i].from, h[i].to); + } + var f; + if ( + (o.metadata && o.metadata.clone + ? (l.metadata = o.metadata.clone()) + : (l.metadata = o.metadata), + s.a && + s.a.HasTags(o) && + s.a.AddTagsTo(l, s.a.GetTags(o, true)), + (l.parent = o.parent), + l.setPivotMatrix(o.getPivotMatrix()), + (l.id = i + "." + o.id), + (l.material = o.material), + !c) + ) + for ( + var d = o.getDescendants(true), p = 0; + p < d.length; + p++ + ) { + var m = d[p]; + m.clone && m.clone(i + "." + m.name, l); } - return null !== r && (l.parent = r), - l._instanceDataStorage.hardwareInstancedRendering = l.getEngine().getCaps().instancedArrays, - l + if (n.getPhysicsEngine) { + var g = n.getPhysicsEngine(); + if (u && g) { + var _ = g.getImpostorForPhysicsObject(o); + _ && (l.physicsImpostor = _.clone(l)); + } + } + for (f = 0; f < n.particleSystems.length; f++) { + var v = n.particleSystems[f]; + v.emitter === o && v.clone(v.name, l); + } + l.refreshBoundingInfo(), l.computeWorldMatrix(true); } - return n.d(t, e), - t._GetDefaultSideOrientation = function(e) { - return e || t.FRONTSIDE - } - , - Object.defineProperty(t.prototype, "onBeforeRenderObservable", { - get: function() { - return this._internalMeshDataInfo._onBeforeRenderObservable || (this._internalMeshDataInfo._onBeforeRenderObservable = new r.c), + return ( + null !== r && (l.parent = r), + (l._instanceDataStorage.hardwareInstancedRendering = l + .getEngine() + .getCaps().instancedArrays), + l + ); + } + return ( + n.d(t, e), + (t._GetDefaultSideOrientation = function (e) { + return e || t.FRONTSIDE; + }), + Object.defineProperty( + t.prototype, + "onBeforeRenderObservable", + { + get: function () { + return ( + this._internalMeshDataInfo + ._onBeforeRenderObservable || + (this._internalMeshDataInfo._onBeforeRenderObservable = + new r.c()), this._internalMeshDataInfo._onBeforeRenderObservable + ); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onBeforeBindObservable", { - get: function() { - return this._internalMeshDataInfo._onBeforeBindObservable || (this._internalMeshDataInfo._onBeforeBindObservable = new r.c), + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onBeforeBindObservable", + { + get: function () { + return ( + this._internalMeshDataInfo + ._onBeforeBindObservable || + (this._internalMeshDataInfo._onBeforeBindObservable = + new r.c()), this._internalMeshDataInfo._onBeforeBindObservable + ); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onAfterRenderObservable", { - get: function() { - return this._internalMeshDataInfo._onAfterRenderObservable || (this._internalMeshDataInfo._onAfterRenderObservable = new r.c), + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onAfterRenderObservable", + { + get: function () { + return ( + this._internalMeshDataInfo + ._onAfterRenderObservable || + (this._internalMeshDataInfo._onAfterRenderObservable = + new r.c()), this._internalMeshDataInfo._onAfterRenderObservable + ); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onBeforeDrawObservable", { - get: function() { - return this._internalMeshDataInfo._onBeforeDrawObservable || (this._internalMeshDataInfo._onBeforeDrawObservable = new r.c), + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onBeforeDrawObservable", + { + get: function () { + return ( + this._internalMeshDataInfo + ._onBeforeDrawObservable || + (this._internalMeshDataInfo._onBeforeDrawObservable = + new r.c()), this._internalMeshDataInfo._onBeforeDrawObservable + ); }, enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "onBeforeDraw", { - set: function(e) { - this._onBeforeDrawObserver && this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver), - this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(e) - }, - enumerable: true, - configurable: true + set: function (e) { + this._onBeforeDrawObserver && + this.onBeforeDrawObservable.remove( + this._onBeforeDrawObserver + ), + (this._onBeforeDrawObserver = + this.onBeforeDrawObservable.add(e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "morphTargetManager", { - get: function() { - return this._internalMeshDataInfo._morphTargetManager - }, - set: function(e) { - this._internalMeshDataInfo._morphTargetManager !== e && (this._internalMeshDataInfo._morphTargetManager = e, - this._syncGeometryWithMorphTargetManager()) - }, - enumerable: true, - configurable: true + get: function () { + return this._internalMeshDataInfo._morphTargetManager; + }, + set: function (e) { + this._internalMeshDataInfo._morphTargetManager !== e && + ((this._internalMeshDataInfo._morphTargetManager = e), + this._syncGeometryWithMorphTargetManager()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "source", { - get: function() { - return this._internalMeshDataInfo._source - }, - enumerable: true, - configurable: true + get: function () { + return this._internalMeshDataInfo._source; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "isUnIndexed", { - get: function() { - return this._unIndexed - }, - set: function(e) { - this._unIndexed !== e && (this._unIndexed = e, - this._markSubMeshesAsAttributesDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._unIndexed; + }, + set: function (e) { + this._unIndexed !== e && + ((this._unIndexed = e), + this._markSubMeshesAsAttributesDirty()); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "Mesh"; }), - t.prototype.getClassName = function() { - return "Mesh" - } - , Object.defineProperty(t.prototype, "_isMesh", { - get: function() { - return true - }, - enumerable: true, - configurable: true + get: function () { + return true; + }, + enumerable: true, + configurable: true, }), - t.prototype.toString = function(t) { - var i = e.prototype.toString.call(this, t); - if (i += ", n vertices: " + this.getTotalVertices(), - i += ", parent: " + (this._waitingParentId ? this._waitingParentId : this.parent ? this.parent.name : "NONE"), + (t.prototype.toString = function (t) { + var i = e.prototype.toString.call(this, t); + if ( + ((i += ", n vertices: " + this.getTotalVertices()), + (i += + ", parent: " + + (this._waitingParentId + ? this._waitingParentId + : this.parent + ? this.parent.name + : "NONE")), this.animations) - for (var n = 0; n < this.animations.length; n++) - i += ", animation[0]: " + this.animations[n].toString(t); - if (t) - if (this._geometry) { - var r = this.getIndices() - , o = this.getVerticesData(l.b.PositionKind); - o && r && (i += ", flat shading: " + (o.length / 3 === r.length ? "YES" : "NO")) - } else - i += ", flat shading: UNKNOWN"; - return i - } - , - t.prototype._unBindEffect = function() { - e.prototype._unBindEffect.call(this); - for (var t = 0, i = this.instances; t < i.length; t++) - i[t]._unBindEffect() - } - , - Object.defineProperty(t.prototype, "hasLODLevels", { - get: function() { - return this._internalMeshDataInfo._LODLevels.length > 0 - }, - enumerable: true, - configurable: true + ) + for (var n = 0; n < this.animations.length; n++) + i += + ", animation[0]: " + this.animations[n].toString(t); + if (t) + if (this._geometry) { + var r = this.getIndices(), + o = this.getVerticesData(l.b.PositionKind); + o && + r && + (i += + ", flat shading: " + + (o.length / 3 === r.length ? "YES" : "NO")); + } else i += ", flat shading: UNKNOWN"; + return i; }), - t.prototype.getLODLevels = function() { - return this._internalMeshDataInfo._LODLevels - } - , - t.prototype._sortLODLevels = function() { - this._internalMeshDataInfo._LODLevels.sort(function(e, t) { - return e.distance < t.distance ? 1 : e.distance > t.distance ? -1 : 0 - }) - } - , - t.prototype.addLODLevel = function(e, t) { - if (t && t._masterMesh) - return E.a.Warn("You cannot use a mesh as LOD level twice"), - this; - var i = new S.a(e,t); - return this._internalMeshDataInfo._LODLevels.push(i), + (t.prototype._unBindEffect = function () { + e.prototype._unBindEffect.call(this); + for (var t = 0, i = this.instances; t < i.length; t++) + i[t]._unBindEffect(); + }), + Object.defineProperty(t.prototype, "hasLODLevels", { + get: function () { + return this._internalMeshDataInfo._LODLevels.length > 0; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getLODLevels = function () { + return this._internalMeshDataInfo._LODLevels; + }), + (t.prototype._sortLODLevels = function () { + this._internalMeshDataInfo._LODLevels.sort(function ( + e, + t + ) { + return e.distance < t.distance + ? 1 + : e.distance > t.distance + ? -1 + : 0; + }); + }), + (t.prototype.addLODLevel = function (e, t) { + if (t && t._masterMesh) + return ( + E.a.Warn("You cannot use a mesh as LOD level twice"), + this + ); + var i = new S.a(e, t); + return ( + this._internalMeshDataInfo._LODLevels.push(i), t && (t._masterMesh = this), this._sortLODLevels(), this - } - , - t.prototype.getLODLevelAtDistance = function(e) { - for (var t = this._internalMeshDataInfo, i = 0; i < t._LODLevels.length; i++) { - var n = t._LODLevels[i]; - if (n.distance === e) - return n.mesh - } - return null - } - , - t.prototype.removeLODLevel = function(e) { - for (var t = this._internalMeshDataInfo, i = 0; i < t._LODLevels.length; i++) - t._LODLevels[i].mesh === e && (t._LODLevels.splice(i, 1), - e && (e._masterMesh = null)); - return this._sortLODLevels(), + ); + }), + (t.prototype.getLODLevelAtDistance = function (e) { + for ( + var t = this._internalMeshDataInfo, i = 0; + i < t._LODLevels.length; + i++ + ) { + var n = t._LODLevels[i]; + if (n.distance === e) return n.mesh; + } + return null; + }), + (t.prototype.removeLODLevel = function (e) { + for ( + var t = this._internalMeshDataInfo, i = 0; + i < t._LODLevels.length; + i++ + ) + t._LODLevels[i].mesh === e && + (t._LODLevels.splice(i, 1), + e && (e._masterMesh = null)); + return this._sortLODLevels(), this; + }), + (t.prototype.getLOD = function (e, t) { + var i = this._internalMeshDataInfo; + if (!i._LODLevels || 0 === i._LODLevels.length) + return this; + var n = ( + t || this.getBoundingInfo().boundingSphere + ).centerWorld + .subtract(e.globalPosition) + .length(); + if (i._LODLevels[i._LODLevels.length - 1].distance > n) + return ( + this.onLODLevelSelection && + this.onLODLevelSelection( + n, + this, + i._LODLevels[i._LODLevels.length - 1].mesh + ), + this + ); + for (var r = 0; r < i._LODLevels.length; r++) { + var o = i._LODLevels[r]; + if (o.distance < n) + return ( + o.mesh && + (o.mesh._preActivate(), + o.mesh._updateSubMeshesBoundingInfo( + this.worldMatrixFromCache + )), + this.onLODLevelSelection && + this.onLODLevelSelection(n, this, o.mesh), + o.mesh + ); + } + return ( + this.onLODLevelSelection && + this.onLODLevelSelection(n, this, this), this - } - , - t.prototype.getLOD = function(e, t) { - var i = this._internalMeshDataInfo; - if (!i._LODLevels || 0 === i._LODLevels.length) - return this; - var n = (t || this.getBoundingInfo().boundingSphere).centerWorld.subtract(e.globalPosition).length(); - if (i._LODLevels[i._LODLevels.length - 1].distance > n) - return this.onLODLevelSelection && this.onLODLevelSelection(n, this, i._LODLevels[i._LODLevels.length - 1].mesh), - this; - for (var r = 0; r < i._LODLevels.length; r++) { - var o = i._LODLevels[r]; - if (o.distance < n) - return o.mesh && (o.mesh._preActivate(), - o.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache)), - this.onLODLevelSelection && this.onLODLevelSelection(n, this, o.mesh), - o.mesh - } - return this.onLODLevelSelection && this.onLODLevelSelection(n, this, this), - this - } - , + ); + }), Object.defineProperty(t.prototype, "geometry", { - get: function() { - return this._geometry - }, - enumerable: true, - configurable: true + get: function () { + return this._geometry; + }, + enumerable: true, + configurable: true, }), - t.prototype.getTotalVertices = function() { - return null === this._geometry || void 0 === this._geometry ? 0 : this._geometry.getTotalVertices() - } - , - t.prototype.getVerticesData = function(e, t, i) { - return this._geometry ? this._geometry.getVerticesData(e, t, i) : null - } - , - t.prototype.getVertexBuffer = function(e) { - return this._geometry ? this._geometry.getVertexBuffer(e) : null - } - , - t.prototype.isVerticesDataPresent = function(e) { - return this._geometry ? this._geometry.isVerticesDataPresent(e) : !!this._delayInfo && -1 !== this._delayInfo.indexOf(e) - } - , - t.prototype.isVertexBufferUpdatable = function(e) { - return this._geometry ? this._geometry.isVertexBufferUpdatable(e) : !!this._delayInfo && -1 !== this._delayInfo.indexOf(e) - } - , - t.prototype.getVerticesDataKinds = function() { - if (!this._geometry) { - var e = new Array; - return this._delayInfo && this._delayInfo.forEach(function(t) { - e.push(t) + (t.prototype.getTotalVertices = function () { + return null === this._geometry || + void 0 === this._geometry + ? 0 + : this._geometry.getTotalVertices(); + }), + (t.prototype.getVerticesData = function (e, t, i) { + return this._geometry + ? this._geometry.getVerticesData(e, t, i) + : null; + }), + (t.prototype.getVertexBuffer = function (e) { + return this._geometry + ? this._geometry.getVertexBuffer(e) + : null; + }), + (t.prototype.isVerticesDataPresent = function (e) { + return this._geometry + ? this._geometry.isVerticesDataPresent(e) + : !!this._delayInfo && + -1 !== this._delayInfo.indexOf(e); + }), + (t.prototype.isVertexBufferUpdatable = function (e) { + return this._geometry + ? this._geometry.isVertexBufferUpdatable(e) + : !!this._delayInfo && + -1 !== this._delayInfo.indexOf(e); + }), + (t.prototype.getVerticesDataKinds = function () { + if (!this._geometry) { + var e = new Array(); + return ( + this._delayInfo && + this._delayInfo.forEach(function (t) { + e.push(t); }), - e - } - return this._geometry.getVerticesDataKinds() - } - , - t.prototype.getTotalIndices = function() { - return this._geometry ? this._geometry.getTotalIndices() : 0 - } - , - t.prototype.getIndices = function(e, t) { - return this._geometry ? this._geometry.getIndices(e, t) : [] - } - , - Object.defineProperty(t.prototype, "isBlocked", { - get: function() { - return null !== this._masterMesh && void 0 !== this._masterMesh - }, - enumerable: true, - configurable: true + e + ); + } + return this._geometry.getVerticesDataKinds(); }), - t.prototype.isReady = function(t, i) { - if (void 0 === t && (t = false), + (t.prototype.getTotalIndices = function () { + return this._geometry + ? this._geometry.getTotalIndices() + : 0; + }), + (t.prototype.getIndices = function (e, t) { + return this._geometry + ? this._geometry.getIndices(e, t) + : []; + }), + Object.defineProperty(t.prototype, "isBlocked", { + get: function () { + return ( + null !== this._masterMesh && + void 0 !== this._masterMesh + ); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.isReady = function (t, i) { + if ( + (void 0 === t && (t = false), void 0 === i && (i = false), this.delayLoadState === y.a.DELAYLOADSTATE_LOADING) - return false; - if (!e.prototype.isReady.call(this, t)) - return false; - if (!this.subMeshes || 0 === this.subMeshes.length) - return true; - if (!t) - return true; - var n = this.getEngine() - , r = this.getScene() - , o = i || n.getCaps().instancedArrays && this.instances.length > 0; - this.computeWorldMatrix(); - var a = this.material || r.defaultMaterial; - if (a) - if (a._storeEffectOnSubMeshes) - for (var s = 0, c = this.subMeshes; s < c.length; s++) { - var u = (m = c[s]).getMaterial(); - if (u) - if (u._storeEffectOnSubMeshes) { - if (!u.isReadyForSubMesh(this, m, o)) - return false - } else if (!u.isReady(this, o)) - return false - } - else if (!a.isReady(this, o)) - return false; - for (var l = 0, h = this.lightSources; l < h.length; l++) { - var f = h[l].getShadowGenerator(); - if (f) - for (var d = 0, p = this.subMeshes; d < p.length; d++) { - var m = p[d]; - if (!f.isReady(m, o)) - return false - } - } - for (var g = 0, _ = this._internalMeshDataInfo._LODLevels; g < _.length; g++) { - var v = _[g]; - if (v.mesh && !v.mesh.isReady(o)) - return false - } - return true - } - , + ) + return false; + if (!e.prototype.isReady.call(this, t)) return false; + if (!this.subMeshes || 0 === this.subMeshes.length) + return true; + if (!t) return true; + var n = this.getEngine(), + r = this.getScene(), + o = + i || + (n.getCaps().instancedArrays && + this.instances.length > 0); + this.computeWorldMatrix(); + var a = this.material || r.defaultMaterial; + if (a) + if (a._storeEffectOnSubMeshes) + for ( + var s = 0, c = this.subMeshes; + s < c.length; + s++ + ) { + var u = (m = c[s]).getMaterial(); + if (u) + if (u._storeEffectOnSubMeshes) { + if (!u.isReadyForSubMesh(this, m, o)) + return false; + } else if (!u.isReady(this, o)) return false; + } + else if (!a.isReady(this, o)) return false; + for ( + var l = 0, h = this.lightSources; + l < h.length; + l++ + ) { + var f = h[l].getShadowGenerator(); + if (f) + for ( + var d = 0, p = this.subMeshes; + d < p.length; + d++ + ) { + var m = p[d]; + if (!f.isReady(m, o)) return false; + } + } + for ( + var g = 0, _ = this._internalMeshDataInfo._LODLevels; + g < _.length; + g++ + ) { + var v = _[g]; + if (v.mesh && !v.mesh.isReady(o)) return false; + } + return true; + }), Object.defineProperty(t.prototype, "areNormalsFrozen", { - get: function() { - return this._internalMeshDataInfo._areNormalsFrozen + get: function () { + return this._internalMeshDataInfo._areNormalsFrozen; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.freezeNormals = function () { + return ( + (this._internalMeshDataInfo._areNormalsFrozen = true), + this + ); + }), + (t.prototype.unfreezeNormals = function () { + return ( + (this._internalMeshDataInfo._areNormalsFrozen = false), + this + ); + }), + Object.defineProperty( + t.prototype, + "overridenInstanceCount", + { + set: function (e) { + this._instanceDataStorage.overridenInstanceCount = e; }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype._preActivate = function () { + var e = this._internalMeshDataInfo, + t = this.getScene().getRenderId(); + return e._preActivateId === t + ? this + : ((e._preActivateId = t), + (this._instanceDataStorage.visibleInstances = null), + this); }), - t.prototype.freezeNormals = function() { - return this._internalMeshDataInfo._areNormalsFrozen = true, - this - } - , - t.prototype.unfreezeNormals = function() { - return this._internalMeshDataInfo._areNormalsFrozen = false, - this - } - , - Object.defineProperty(t.prototype, "overridenInstanceCount", { - set: function(e) { - this._instanceDataStorage.overridenInstanceCount = e - }, - enumerable: true, - configurable: true - }), - t.prototype._preActivate = function() { - var e = this._internalMeshDataInfo - , t = this.getScene().getRenderId(); - return e._preActivateId === t ? this : (e._preActivateId = t, - this._instanceDataStorage.visibleInstances = null, - this) - } - , - t.prototype._preActivateForIntermediateRendering = function(e) { - return this._instanceDataStorage.visibleInstances && (this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = e), - this - } - , - t.prototype._registerInstanceForRenderId = function(e, t) { - return this._instanceDataStorage.visibleInstances || (this._instanceDataStorage.visibleInstances = { + (t.prototype._preActivateForIntermediateRendering = + function (e) { + return ( + this._instanceDataStorage.visibleInstances && + (this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = + e), + this + ); + }), + (t.prototype._registerInstanceForRenderId = function ( + e, + t + ) { + return ( + this._instanceDataStorage.visibleInstances || + (this._instanceDataStorage.visibleInstances = { defaultRenderId: t, - selfDefaultRenderId: this._renderId - }), - this._instanceDataStorage.visibleInstances[t] || (this._instanceDataStorage.visibleInstances[t] = new Array), + selfDefaultRenderId: this._renderId, + }), + this._instanceDataStorage.visibleInstances[t] || + (this._instanceDataStorage.visibleInstances[t] = + new Array()), this._instanceDataStorage.visibleInstances[t].push(e), this - } - , - t.prototype.refreshBoundingInfo = function(e) { - if (void 0 === e && (e = false), + ); + }), + (t.prototype.refreshBoundingInfo = function (e) { + if ( + (void 0 === e && (e = false), this._boundingInfo && this._boundingInfo.isLocked) - return this; - var t = this.geometry ? this.geometry.boundingBias : null; - return this._refreshBoundingInfo(this._getPositionData(e), t), + ) + return this; + var t = this.geometry ? this.geometry.boundingBias : null; + return ( + this._refreshBoundingInfo(this._getPositionData(e), t), this - } - , - t.prototype._createGlobalSubMesh = function(e) { - var t = this.getTotalVertices(); - if (!t || !this.getIndices()) - return null; - if (this.subMeshes && this.subMeshes.length > 0) { - var i = this.getIndices(); - if (!i) - return null; - var n = i.length - , r = false; - if (e) - r = true; - else - for (var o = 0, a = this.subMeshes; o < a.length; o++) { - var s = a[o]; - if (s.indexStart + s.indexCount >= n) { - r = true; - break - } - if (s.verticesStart + s.verticesCount >= t) { - r = true; - break - } - } - if (!r) - return this.subMeshes[0] - } - return this.releaseSubMeshes(), - new p.b(0,0,t,0,this.getTotalIndices(),this) - } - , - t.prototype.subdivide = function(e) { - if (!(e < 1)) { - for (var t = this.getTotalIndices(), i = t / e | 0, n = 0; i % 3 != 0; ) - i++; - this.releaseSubMeshes(); - for (var r = 0; r < e && !(n >= t); r++) - p.b.CreateFromIndices(0, n, Math.min(i, t - n), this), - n += i; - this.synchronizeInstances() - } - } - , - t.prototype.setVerticesData = function(e, t, i, n) { - if (void 0 === i && (i = false), - this._geometry) - this._geometry.setVerticesData(e, t, i, n); - else { - var r = new h.a; - r.set(t, e); - var o = this.getScene(); - new f.a(f.a.RandomId(),o,r,i,this) - } - return this - } - , - t.prototype.markVerticesDataAsUpdatable = function(e, t) { - void 0 === t && (t = true); - var i = this.getVertexBuffer(e); - i && i.isUpdatable() !== t && this.setVerticesData(e, this.getVerticesData(e), t) - } - , - t.prototype.setVerticesBuffer = function(e) { - return this._geometry || (this._geometry = f.a.CreateGeometryForMesh(this)), + ); + }), + (t.prototype._createGlobalSubMesh = function (e) { + var t = this.getTotalVertices(); + if (!t || !this.getIndices()) return null; + if (this.subMeshes && this.subMeshes.length > 0) { + var i = this.getIndices(); + if (!i) return null; + var n = i.length, + r = false; + if (e) r = true; + else + for ( + var o = 0, a = this.subMeshes; + o < a.length; + o++ + ) { + var s = a[o]; + if (s.indexStart + s.indexCount >= n) { + r = true; + break; + } + if (s.verticesStart + s.verticesCount >= t) { + r = true; + break; + } + } + if (!r) return this.subMeshes[0]; + } + return ( + this.releaseSubMeshes(), + new p.b(0, 0, t, 0, this.getTotalIndices(), this) + ); + }), + (t.prototype.subdivide = function (e) { + if (!(e < 1)) { + for ( + var t = this.getTotalIndices(), + i = (t / e) | 0, + n = 0; + i % 3 != 0; + + ) + i++; + this.releaseSubMeshes(); + for (var r = 0; r < e && !(n >= t); r++) + p.b.CreateFromIndices(0, n, Math.min(i, t - n), this), + (n += i); + this.synchronizeInstances(); + } + }), + (t.prototype.setVerticesData = function (e, t, i, n) { + if ((void 0 === i && (i = false), this._geometry)) + this._geometry.setVerticesData(e, t, i, n); + else { + var r = new h.a(); + r.set(t, e); + var o = this.getScene(); + new f.a(f.a.RandomId(), o, r, i, this); + } + return this; + }), + (t.prototype.markVerticesDataAsUpdatable = function (e, t) { + void 0 === t && (t = true); + var i = this.getVertexBuffer(e); + i && + i.isUpdatable() !== t && + this.setVerticesData(e, this.getVerticesData(e), t); + }), + (t.prototype.setVerticesBuffer = function (e) { + return ( + this._geometry || + (this._geometry = f.a.CreateGeometryForMesh(this)), this._geometry.setVerticesBuffer(e), this - } - , - t.prototype.updateVerticesData = function(e, t, i, n) { - return this._geometry ? (n ? (this.makeGeometryUnique(), - this.updateVerticesData(e, t, i, false)) : this._geometry.updateVerticesData(e, t, i), - this) : this - } - , - t.prototype.updateMeshPositions = function(e, t) { - void 0 === t && (t = true); - var i = this.getVerticesData(l.b.PositionKind); - if (!i) - return this; - if (e(i), - this.updateVerticesData(l.b.PositionKind, i, false, false), - t) { - var n = this.getIndices() - , r = this.getVerticesData(l.b.NormalKind); - if (!r) - return this; - h.a.ComputeNormals(i, n, r), - this.updateVerticesData(l.b.NormalKind, r, false, false) - } - return this - } - , - t.prototype.makeGeometryUnique = function() { - if (!this._geometry) - return this; - var e = this._geometry - , t = this._geometry.copy(f.a.RandomId()); - return e.releaseForMesh(this, true), - t.applyToMesh(this), - this - } - , - t.prototype.setIndices = function(e, t, i) { - if (void 0 === t && (t = null), + ); + }), + (t.prototype.updateVerticesData = function (e, t, i, n) { + return this._geometry + ? (n + ? (this.makeGeometryUnique(), + this.updateVerticesData(e, t, i, false)) + : this._geometry.updateVerticesData(e, t, i), + this) + : this; + }), + (t.prototype.updateMeshPositions = function (e, t) { + void 0 === t && (t = true); + var i = this.getVerticesData(l.b.PositionKind); + if (!i) return this; + if ( + (e(i), + this.updateVerticesData( + l.b.PositionKind, + i, + false, + false + ), + t) + ) { + var n = this.getIndices(), + r = this.getVerticesData(l.b.NormalKind); + if (!r) return this; + h.a.ComputeNormals(i, n, r), + this.updateVerticesData( + l.b.NormalKind, + r, + false, + false + ); + } + return this; + }), + (t.prototype.makeGeometryUnique = function () { + if (!this._geometry) return this; + var e = this._geometry, + t = this._geometry.copy(f.a.RandomId()); + return ( + e.releaseForMesh(this, true), t.applyToMesh(this), this + ); + }), + (t.prototype.setIndices = function (e, t, i) { + if ( + (void 0 === t && (t = null), void 0 === i && (i = false), this._geometry) - this._geometry.setIndices(e, t, i); - else { - var n = new h.a; - n.indices = e; - var r = this.getScene(); - new f.a(f.a.RandomId(),r,n,i,this) - } - return this - } - , - t.prototype.updateIndices = function(e, t, i) { - return void 0 === i && (i = false), - this._geometry ? (this._geometry.updateIndices(e, t, i), - this) : this - } - , - t.prototype.toLeftHanded = function() { - return this._geometry ? (this._geometry.toLeftHanded(), - this) : this - } - , - t.prototype._bind = function(e, t, i) { - if (!this._geometry) - return this; - var n, r = this.getScene().getEngine(); - if (this._unIndexed) + ) + this._geometry.setIndices(e, t, i); + else { + var n = new h.a(); + n.indices = e; + var r = this.getScene(); + new f.a(f.a.RandomId(), r, n, i, this); + } + return this; + }), + (t.prototype.updateIndices = function (e, t, i) { + return ( + void 0 === i && (i = false), + this._geometry + ? (this._geometry.updateIndices(e, t, i), this) + : this + ); + }), + (t.prototype.toLeftHanded = function () { + return this._geometry + ? (this._geometry.toLeftHanded(), this) + : this; + }), + (t.prototype._bind = function (e, t, i) { + if (!this._geometry) return this; + var n, + r = this.getScene().getEngine(); + if (this._unIndexed) n = null; + else + switch (i) { + case g.a.PointFillMode: n = null; - else - switch (i) { - case g.a.PointFillMode: - n = null; - break; - case g.a.WireFrameFillMode: - n = e._getLinesIndexBuffer(this.getIndices(), r); - break; - default: - case g.a.TriangleFillMode: - n = this._geometry.getIndexBuffer() - } - return this._geometry._bind(t, n), - this - } - , - t.prototype._draw = function(e, t, i) { - if (!this._geometry || !this._geometry.getVertexBuffers() || !this._unIndexed && !this._geometry.getIndexBuffer()) - return this; - this._internalMeshDataInfo._onBeforeDrawObservable && this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this); - var n = this.getScene().getEngine(); - return this._unIndexed || t == g.a.PointFillMode ? n.drawArraysType(t, e.verticesStart, e.verticesCount, i) : t == g.a.WireFrameFillMode ? n.drawElementsType(t, 0, e._linesIndexCount, i) : n.drawElementsType(t, e.indexStart, e.indexCount, i), - this - } - , - t.prototype.registerBeforeRender = function(e) { - return this.onBeforeRenderObservable.add(e), - this - } - , - t.prototype.unregisterBeforeRender = function(e) { - return this.onBeforeRenderObservable.removeCallback(e), - this - } - , - t.prototype.registerAfterRender = function(e) { - return this.onAfterRenderObservable.add(e), - this - } - , - t.prototype.unregisterAfterRender = function(e) { - return this.onAfterRenderObservable.removeCallback(e), - this - } - , - t.prototype._getInstancesRenderList = function(e) { - if (this._instanceDataStorage.isFrozen && this._instanceDataStorage.previousBatch) - return this._instanceDataStorage.previousBatch; - var t = this.getScene() - , i = t._isInIntermediateRendering() - , n = i ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate : this._internalAbstractMeshDataInfo._onlyForInstances - , r = this._instanceDataStorage.batchCache; - if (r.mustReturn = false, - r.renderSelf[e] = !n && this.isEnabled() && this.isVisible, - r.visibleInstances[e] = null, - this._instanceDataStorage.visibleInstances) { - var o = this._instanceDataStorage.visibleInstances - , a = t.getRenderId() - , s = i ? o.intermediateDefaultRenderId : o.defaultRenderId; - r.visibleInstances[e] = o[a], - !r.visibleInstances[e] && s && (r.visibleInstances[e] = o[s]) + break; + case g.a.WireFrameFillMode: + n = e._getLinesIndexBuffer(this.getIndices(), r); + break; + default: + case g.a.TriangleFillMode: + n = this._geometry.getIndexBuffer(); } - return r.hardwareInstancedRendering[e] = this._instanceDataStorage.hardwareInstancedRendering && null !== r.visibleInstances[e] && void 0 !== r.visibleInstances[e], - this._instanceDataStorage.previousBatch = r, + return this._geometry._bind(t, n), this; + }), + (t.prototype._draw = function (e, t, i) { + if ( + !this._geometry || + !this._geometry.getVertexBuffers() || + (!this._unIndexed && !this._geometry.getIndexBuffer()) + ) + return this; + this._internalMeshDataInfo._onBeforeDrawObservable && + this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers( + this + ); + var n = this.getScene().getEngine(); + return ( + this._unIndexed || t == g.a.PointFillMode + ? n.drawArraysType( + t, + e.verticesStart, + e.verticesCount, + i + ) + : t == g.a.WireFrameFillMode + ? n.drawElementsType(t, 0, e._linesIndexCount, i) + : n.drawElementsType( + t, + e.indexStart, + e.indexCount, + i + ), + this + ); + }), + (t.prototype.registerBeforeRender = function (e) { + return this.onBeforeRenderObservable.add(e), this; + }), + (t.prototype.unregisterBeforeRender = function (e) { + return ( + this.onBeforeRenderObservable.removeCallback(e), this + ); + }), + (t.prototype.registerAfterRender = function (e) { + return this.onAfterRenderObservable.add(e), this; + }), + (t.prototype.unregisterAfterRender = function (e) { + return ( + this.onAfterRenderObservable.removeCallback(e), this + ); + }), + (t.prototype._getInstancesRenderList = function (e) { + if ( + this._instanceDataStorage.isFrozen && + this._instanceDataStorage.previousBatch + ) + return this._instanceDataStorage.previousBatch; + var t = this.getScene(), + i = t._isInIntermediateRendering(), + n = i + ? this._internalAbstractMeshDataInfo + ._onlyForInstancesIntermediate + : this._internalAbstractMeshDataInfo + ._onlyForInstances, + r = this._instanceDataStorage.batchCache; + if ( + ((r.mustReturn = false), + (r.renderSelf[e] = + !n && this.isEnabled() && this.isVisible), + (r.visibleInstances[e] = null), + this._instanceDataStorage.visibleInstances) + ) { + var o = this._instanceDataStorage.visibleInstances, + a = t.getRenderId(), + s = i + ? o.intermediateDefaultRenderId + : o.defaultRenderId; + (r.visibleInstances[e] = o[a]), + !r.visibleInstances[e] && + s && + (r.visibleInstances[e] = o[s]); + } + return ( + (r.hardwareInstancedRendering[e] = + this._instanceDataStorage + .hardwareInstancedRendering && + null !== r.visibleInstances[e] && + void 0 !== r.visibleInstances[e]), + (this._instanceDataStorage.previousBatch = r), r - } - , - t.prototype._renderWithInstances = function(e, t, i, n, r) { - var o = i.visibleInstances[e._id]; - if (!o) - return this; - for (var a = this._instanceDataStorage, s = a.instancesBufferSize, c = a.instancesBuffer, u = 16 * (o.length + 1) * 4; a.instancesBufferSize < u; ) - a.instancesBufferSize *= 2; - a.instancesData && s == a.instancesBufferSize || (a.instancesData = new Float32Array(a.instancesBufferSize / 4)); - var h = 0 - , f = 0 - , d = this._effectiveMesh.getWorldMatrix(); - if (i.renderSelf[e._id] && (d.copyToArray(a.instancesData, h), - h += 16, - f++), + ); + }), + (t.prototype._renderWithInstances = function ( + e, + t, + i, + n, + r + ) { + var o = i.visibleInstances[e._id]; + if (!o) return this; + for ( + var a = this._instanceDataStorage, + s = a.instancesBufferSize, + c = a.instancesBuffer, + u = 16 * (o.length + 1) * 4; + a.instancesBufferSize < u; + + ) + a.instancesBufferSize *= 2; + (a.instancesData && s == a.instancesBufferSize) || + (a.instancesData = new Float32Array( + a.instancesBufferSize / 4 + )); + var h = 0, + f = 0, + d = this._effectiveMesh.getWorldMatrix(); + if ( + (i.renderSelf[e._id] && + (d.copyToArray(a.instancesData, h), (h += 16), f++), o) - for (var p = 0; p < o.length; p++) - o[p].getWorldMatrix().copyToArray(a.instancesData, h), - h += 16, - f++; - return c && s == a.instancesBufferSize ? c.updateDirectly(a.instancesData, 0, f) : (c && c.dispose(), - c = new l.a(r,a.instancesData,true,16,false,true), - a.instancesBuffer = c, - this.setVerticesBuffer(c.createVertexBuffer("world0", 0, 4)), - this.setVerticesBuffer(c.createVertexBuffer("world1", 4, 4)), - this.setVerticesBuffer(c.createVertexBuffer("world2", 8, 4)), - this.setVerticesBuffer(c.createVertexBuffer("world3", 12, 4))), + ) + for (var p = 0; p < o.length; p++) + o[p].getWorldMatrix().copyToArray(a.instancesData, h), + (h += 16), + f++; + return ( + c && s == a.instancesBufferSize + ? c.updateDirectly(a.instancesData, 0, f) + : (c && c.dispose(), + (c = new l.a( + r, + a.instancesData, + true, + 16, + false, + true + )), + (a.instancesBuffer = c), + this.setVerticesBuffer( + c.createVertexBuffer("world0", 0, 4) + ), + this.setVerticesBuffer( + c.createVertexBuffer("world1", 4, 4) + ), + this.setVerticesBuffer( + c.createVertexBuffer("world2", 8, 4) + ), + this.setVerticesBuffer( + c.createVertexBuffer("world3", 12, 4) + )), this._bind(e, n, t), this._draw(e, t, f), r.unbindInstanceAttributes(), this - } - , - t.prototype._processRendering = function(e, t, i, n, r, o, a) { - var s = this.getScene().getEngine(); - if (r) - this._renderWithInstances(e, i, n, t, s); - else { - n.renderSelf[e._id] && (o && o(false, this._effectiveMesh.getWorldMatrix(), a), - this._draw(e, i, this._instanceDataStorage.overridenInstanceCount)); - var c = n.visibleInstances[e._id]; - if (c) - for (var u = 0; u < c.length; u++) { - var l = c[u].getWorldMatrix(); - o && o(true, l, a), - this._draw(e, i) - } - } - return this - } - , - t.prototype._freeze = function() { - if (this._instanceDataStorage.isFrozen = true, + ); + }), + (t.prototype._processRendering = function ( + e, + t, + i, + n, + r, + o, + a + ) { + var s = this.getScene().getEngine(); + if (r) this._renderWithInstances(e, i, n, t, s); + else { + n.renderSelf[e._id] && + (o && + o(false, this._effectiveMesh.getWorldMatrix(), a), + this._draw( + e, + i, + this._instanceDataStorage.overridenInstanceCount + )); + var c = n.visibleInstances[e._id]; + if (c) + for (var u = 0; u < c.length; u++) { + var l = c[u].getWorldMatrix(); + o && o(true, l, a), this._draw(e, i); + } + } + return this; + }), + (t.prototype._freeze = function () { + if ( + ((this._instanceDataStorage.isFrozen = true), this.subMeshes) - for (var e = 0; e < this.subMeshes.length; e++) - this._getInstancesRenderList(e) - } - , - t.prototype._unFreeze = function() { - this._instanceDataStorage.isFrozen = false - } - , - t.prototype.render = function(e, t) { - var i = this.getScene(); - if (i._isInIntermediateRendering() ? this._internalAbstractMeshDataInfo._isActiveIntermediate = false : this._internalAbstractMeshDataInfo._isActive = false, + ) + for (var e = 0; e < this.subMeshes.length; e++) + this._getInstancesRenderList(e); + }), + (t.prototype._unFreeze = function () { + this._instanceDataStorage.isFrozen = false; + }), + (t.prototype.render = function (e, t) { + var i = this.getScene(); + if ( + (i._isInIntermediateRendering() + ? (this._internalAbstractMeshDataInfo._isActiveIntermediate = false) + : (this._internalAbstractMeshDataInfo._isActive = false), this._checkOcclusionQuery()) + ) + return this; + var n = this._getInstancesRenderList(e._id); + if (n.mustReturn) return this; + if ( + !this._geometry || + !this._geometry.getVertexBuffers() || + (!this._unIndexed && !this._geometry.getIndexBuffer()) + ) + return this; + this._internalMeshDataInfo._onBeforeRenderObservable && + this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers( + this + ); + var r, + o = i.getEngine(), + a = n.hardwareInstancedRendering[e._id], + s = this._instanceDataStorage, + c = e.getMaterial(); + if (!c) return this; + if ( + !s.isFrozen || + !this._effectiveMaterial || + this._effectiveMaterial !== c + ) + if ( + ((this._effectiveMaterial = c), + this._effectiveMaterial._storeEffectOnSubMeshes) + ) { + if ( + !this._effectiveMaterial.isReadyForSubMesh( + this, + e, + a + ) + ) return this; - var n = this._getInstancesRenderList(e._id); - if (n.mustReturn) - return this; - if (!this._geometry || !this._geometry.getVertexBuffers() || !this._unIndexed && !this._geometry.getIndexBuffer()) - return this; - this._internalMeshDataInfo._onBeforeRenderObservable && this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this); - var r, o = i.getEngine(), a = n.hardwareInstancedRendering[e._id], s = this._instanceDataStorage, c = e.getMaterial(); - if (!c) - return this; - if (!s.isFrozen || !this._effectiveMaterial || this._effectiveMaterial !== c) - if (this._effectiveMaterial = c, - this._effectiveMaterial._storeEffectOnSubMeshes) { - if (!this._effectiveMaterial.isReadyForSubMesh(this, e, a)) - return this - } else if (!this._effectiveMaterial.isReady(this, a)) - return this; - t && o.setAlphaMode(this._effectiveMaterial.alphaMode); - for (var u = 0, l = i._beforeRenderingMeshStage; u < l.length; u++) - l[u].action(this, e, n); - if (!(r = this._effectiveMaterial._storeEffectOnSubMeshes ? e.effect : this._effectiveMaterial.getEffect())) - return this; - var h, f = this._effectiveMesh; - s.isFrozen ? h = s.sideOrientation : (null == (h = this.overrideMaterialSideOrientation) && (h = this._effectiveMaterial.sideOrientation, - f._getWorldMatrixDeterminant() < 0 && (h = h === g.a.ClockWiseSideOrientation ? g.a.CounterClockWiseSideOrientation : g.a.ClockWiseSideOrientation)), - s.sideOrientation = h); - var d = this._effectiveMaterial._preBind(r, h); - this._effectiveMaterial.forceDepthWrite && o.setDepthWrite(true); - var p = i.forcePointsCloud ? g.a.PointFillMode : i.forceWireframe ? g.a.WireFrameFillMode : this._effectiveMaterial.fillMode; - this._internalMeshDataInfo._onBeforeBindObservable && this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this), + } else if (!this._effectiveMaterial.isReady(this, a)) + return this; + t && o.setAlphaMode(this._effectiveMaterial.alphaMode); + for ( + var u = 0, l = i._beforeRenderingMeshStage; + u < l.length; + u++ + ) + l[u].action(this, e, n); + if ( + !(r = this._effectiveMaterial._storeEffectOnSubMeshes + ? e.effect + : this._effectiveMaterial.getEffect()) + ) + return this; + var h, + f = this._effectiveMesh; + s.isFrozen + ? (h = s.sideOrientation) + : (null == (h = this.overrideMaterialSideOrientation) && + ((h = this._effectiveMaterial.sideOrientation), + f._getWorldMatrixDeterminant() < 0 && + (h = + h === g.a.ClockWiseSideOrientation + ? g.a.CounterClockWiseSideOrientation + : g.a.ClockWiseSideOrientation)), + (s.sideOrientation = h)); + var d = this._effectiveMaterial._preBind(r, h); + this._effectiveMaterial.forceDepthWrite && + o.setDepthWrite(true); + var p = i.forcePointsCloud + ? g.a.PointFillMode + : i.forceWireframe + ? g.a.WireFrameFillMode + : this._effectiveMaterial.fillMode; + this._internalMeshDataInfo._onBeforeBindObservable && + this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers( + this + ), a || this._bind(e, r, p); - var m = f.getWorldMatrix(); - this._effectiveMaterial._storeEffectOnSubMeshes ? this._effectiveMaterial.bindForSubMesh(m, this, e) : this._effectiveMaterial.bind(m, this), - !this._effectiveMaterial.backFaceCulling && this._effectiveMaterial.separateCullingPass && (o.setState(true, this._effectiveMaterial.zOffset, false, !d), - this._processRendering(e, r, p, n, a, this._onBeforeDraw, this._effectiveMaterial), - o.setState(true, this._effectiveMaterial.zOffset, false, d)), - this._processRendering(e, r, p, n, a, this._onBeforeDraw, this._effectiveMaterial), + var m = f.getWorldMatrix(); + this._effectiveMaterial._storeEffectOnSubMeshes + ? this._effectiveMaterial.bindForSubMesh(m, this, e) + : this._effectiveMaterial.bind(m, this), + !this._effectiveMaterial.backFaceCulling && + this._effectiveMaterial.separateCullingPass && + (o.setState( + true, + this._effectiveMaterial.zOffset, + false, + !d + ), + this._processRendering( + e, + r, + p, + n, + a, + this._onBeforeDraw, + this._effectiveMaterial + ), + o.setState( + true, + this._effectiveMaterial.zOffset, + false, + d + )), + this._processRendering( + e, + r, + p, + n, + a, + this._onBeforeDraw, + this._effectiveMaterial + ), this._effectiveMaterial.unbind(); - for (var _ = 0, v = i._afterRenderingMeshStage; _ < v.length; _++) - v[_].action(this, e, n); - return this._internalMeshDataInfo._onAfterRenderObservable && this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this), + for ( + var _ = 0, v = i._afterRenderingMeshStage; + _ < v.length; + _++ + ) + v[_].action(this, e, n); + return ( + this._internalMeshDataInfo._onAfterRenderObservable && + this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers( + this + ), this - } - , - t.prototype._onBeforeDraw = function(e, t, i) { - e && i && i.bindOnlyWorldMatrix(t) - } - , - t.prototype.cleanMatrixWeights = function() { - this.isVerticesDataPresent(l.b.MatricesWeightsKind) && (this.isVerticesDataPresent(l.b.MatricesWeightsExtraKind) ? this.normalizeSkinWeightsAndExtra() : this.normalizeSkinFourWeights()) - } - , - t.prototype.normalizeSkinFourWeights = function() { - for (var e = this.getVerticesData(l.b.MatricesWeightsKind), t = e.length, i = 0; i < t; i += 4) { - var n = e[i] + e[i + 1] + e[i + 2] + e[i + 3]; - if (0 === n) - e[i] = 1; - else { - var r = 1 / n; - e[i] *= r, - e[i + 1] *= r, - e[i + 2] *= r, - e[i + 3] *= r - } + ); + }), + (t.prototype._onBeforeDraw = function (e, t, i) { + e && i && i.bindOnlyWorldMatrix(t); + }), + (t.prototype.cleanMatrixWeights = function () { + this.isVerticesDataPresent(l.b.MatricesWeightsKind) && + (this.isVerticesDataPresent( + l.b.MatricesWeightsExtraKind + ) + ? this.normalizeSkinWeightsAndExtra() + : this.normalizeSkinFourWeights()); + }), + (t.prototype.normalizeSkinFourWeights = function () { + for ( + var e = this.getVerticesData(l.b.MatricesWeightsKind), + t = e.length, + i = 0; + i < t; + i += 4 + ) { + var n = e[i] + e[i + 1] + e[i + 2] + e[i + 3]; + if (0 === n) e[i] = 1; + else { + var r = 1 / n; + (e[i] *= r), + (e[i + 1] *= r), + (e[i + 2] *= r), + (e[i + 3] *= r); } - this.setVerticesData(l.b.MatricesWeightsKind, e) - } - , - t.prototype.normalizeSkinWeightsAndExtra = function() { - for (var e = this.getVerticesData(l.b.MatricesWeightsExtraKind), t = this.getVerticesData(l.b.MatricesWeightsKind), i = t.length, n = 0; n < i; n += 4) { - var r = t[n] + t[n + 1] + t[n + 2] + t[n + 3]; - if (0 === (r += e[n] + e[n + 1] + e[n + 2] + e[n + 3])) - t[n] = 1; - else { - var o = 1 / r; - t[n] *= o, - t[n + 1] *= o, - t[n + 2] *= o, - t[n + 3] *= o, - e[n] *= o, - e[n + 1] *= o, - e[n + 2] *= o, - e[n + 3] *= o - } + } + this.setVerticesData(l.b.MatricesWeightsKind, e); + }), + (t.prototype.normalizeSkinWeightsAndExtra = function () { + for ( + var e = this.getVerticesData( + l.b.MatricesWeightsExtraKind + ), + t = this.getVerticesData(l.b.MatricesWeightsKind), + i = t.length, + n = 0; + n < i; + n += 4 + ) { + var r = t[n] + t[n + 1] + t[n + 2] + t[n + 3]; + if (0 === (r += e[n] + e[n + 1] + e[n + 2] + e[n + 3])) + t[n] = 1; + else { + var o = 1 / r; + (t[n] *= o), + (t[n + 1] *= o), + (t[n + 2] *= o), + (t[n + 3] *= o), + (e[n] *= o), + (e[n + 1] *= o), + (e[n + 2] *= o), + (e[n + 3] *= o); } - this.setVerticesData(l.b.MatricesWeightsKind, t), - this.setVerticesData(l.b.MatricesWeightsKind, e) - } - , - t.prototype.validateSkinning = function() { - var e = this.getVerticesData(l.b.MatricesWeightsExtraKind) - , t = this.getVerticesData(l.b.MatricesWeightsKind); - if (null === t || null == this.skeleton) - return { - skinned: false, - valid: true, - report: "not skinned" - }; - for (var i = t.length, n = 0, r = 0, o = 0, a = 0, s = null === e ? 4 : 8, c = new Array, u = 0; u <= s; u++) - c[u] = 0; - for (u = 0; u < i; u += 4) { - for (var h = t[u], f = h, d = 0 === f ? 0 : 1, p = 1; p < s; p++) { - var m = p < 4 ? t[u + p] : e[u + p - 4]; - m > h && n++, - 0 !== m && d++, - f += m, - h = m - } - if (c[d]++, - d > o && (o = d), - 0 === f) - r++; - else { - var g = 1 / f - , _ = 0; - for (p = 0; p < s; p++) - _ += p < 4 ? Math.abs(t[u + p] - t[u + p] * g) : Math.abs(e[u + p - 4] - e[u + p - 4] * g); - _ > .001 && a++ - } - } - var v = this.skeleton.bones.length - , y = this.getVerticesData(l.b.MatricesIndicesKind) - , b = this.getVerticesData(l.b.MatricesIndicesExtraKind) - , E = 0; - for (u = 0; u < i; u++) - for (p = 0; p < s; p++) { - var T = p < 4 ? y[p] : b[p - 4]; - (T >= v || T < 0) && E++ - } + } + this.setVerticesData(l.b.MatricesWeightsKind, t), + this.setVerticesData(l.b.MatricesWeightsKind, e); + }), + (t.prototype.validateSkinning = function () { + var e = this.getVerticesData( + l.b.MatricesWeightsExtraKind + ), + t = this.getVerticesData(l.b.MatricesWeightsKind); + if (null === t || null == this.skeleton) return { - skinned: true, - valid: 0 === r && 0 === a && 0 === E, - report: "Number of Weights = " + i / 4 + "\nMaximum influences = " + o + "\nMissing Weights = " + r + "\nNot Sorted = " + n + "\nNot Normalized = " + a + "\nWeightCounts = [" + c + "]\nNumber of bones = " + v + "\nBad Bone Indices = " + E + skinned: false, + valid: true, + report: "not skinned", + }; + for ( + var i = t.length, + n = 0, + r = 0, + o = 0, + a = 0, + s = null === e ? 4 : 8, + c = new Array(), + u = 0; + u <= s; + u++ + ) + c[u] = 0; + for (u = 0; u < i; u += 4) { + for ( + var h = t[u], f = h, d = 0 === f ? 0 : 1, p = 1; + p < s; + p++ + ) { + var m = p < 4 ? t[u + p] : e[u + p - 4]; + m > h && n++, 0 !== m && d++, (f += m), (h = m); } - } - , - t.prototype._checkDelayState = function() { - var e = this.getScene(); - return this._geometry ? this._geometry.load(e) : this.delayLoadState === y.a.DELAYLOADSTATE_NOTLOADED && (this.delayLoadState = y.a.DELAYLOADSTATE_LOADING, - this._queueLoad(e)), + if ((c[d]++, d > o && (o = d), 0 === f)) r++; + else { + var g = 1 / f, + _ = 0; + for (p = 0; p < s; p++) + _ += + p < 4 + ? Math.abs(t[u + p] - t[u + p] * g) + : Math.abs(e[u + p - 4] - e[u + p - 4] * g); + _ > 0.001 && a++; + } + } + var v = this.skeleton.bones.length, + y = this.getVerticesData(l.b.MatricesIndicesKind), + b = this.getVerticesData(l.b.MatricesIndicesExtraKind), + E = 0; + for (u = 0; u < i; u++) + for (p = 0; p < s; p++) { + var T = p < 4 ? y[p] : b[p - 4]; + (T >= v || T < 0) && E++; + } + return { + skinned: true, + valid: 0 === r && 0 === a && 0 === E, + report: + "Number of Weights = " + + i / 4 + + "\nMaximum influences = " + + o + + "\nMissing Weights = " + + r + + "\nNot Sorted = " + + n + + "\nNot Normalized = " + + a + + "\nWeightCounts = [" + + c + + "]\nNumber of bones = " + + v + + "\nBad Bone Indices = " + + E, + }; + }), + (t.prototype._checkDelayState = function () { + var e = this.getScene(); + return ( + this._geometry + ? this._geometry.load(e) + : this.delayLoadState === + y.a.DELAYLOADSTATE_NOTLOADED && + ((this.delayLoadState = y.a.DELAYLOADSTATE_LOADING), + this._queueLoad(e)), this - } - , - t.prototype._queueLoad = function(e) { - var t = this; - e._addPendingData(this); - var i = -1 !== this.delayLoadingFile.indexOf(".babylonbinarymeshdata"); - return o.h.LoadFile(this.delayLoadingFile, function(i) { - i instanceof ArrayBuffer ? t._delayLoadingFunction(i, t) : t._delayLoadingFunction(JSON.parse(i), t), - t.instances.forEach(function(e) { - e.refreshBoundingInfo(), - e._syncSubMeshes() - }), - t.delayLoadState = y.a.DELAYLOADSTATE_LOADED, - e._removePendingData(t) - }, function() {}, e.offlineProvider, i), + ); + }), + (t.prototype._queueLoad = function (e) { + var t = this; + e._addPendingData(this); + var i = + -1 !== + this.delayLoadingFile.indexOf(".babylonbinarymeshdata"); + return ( + o.h.LoadFile( + this.delayLoadingFile, + function (i) { + i instanceof ArrayBuffer + ? t._delayLoadingFunction(i, t) + : t._delayLoadingFunction(JSON.parse(i), t), + t.instances.forEach(function (e) { + e.refreshBoundingInfo(), e._syncSubMeshes(); + }), + (t.delayLoadState = y.a.DELAYLOADSTATE_LOADED), + e._removePendingData(t); + }, + function () {}, + e.offlineProvider, + i + ), this - } - , - t.prototype.isInFrustum = function(t) { - return this.delayLoadState !== y.a.DELAYLOADSTATE_LOADING && !!e.prototype.isInFrustum.call(this, t) && (this._checkDelayState(), - true) - } - , - t.prototype.setMaterialByID = function(e) { - var t, i = this.getScene().materials; - for (t = i.length - 1; t > -1; t--) - if (i[t].id === e) - return this.material = i[t], - this; - var n = this.getScene().multiMaterials; - for (t = n.length - 1; t > -1; t--) - if (n[t].id === e) - return this.material = n[t], - this; - return this - } - , - t.prototype.getAnimatables = function() { - var e = new Array; - return this.material && e.push(this.material), + ); + }), + (t.prototype.isInFrustum = function (t) { + return ( + this.delayLoadState !== y.a.DELAYLOADSTATE_LOADING && + !!e.prototype.isInFrustum.call(this, t) && + (this._checkDelayState(), true) + ); + }), + (t.prototype.setMaterialByID = function (e) { + var t, + i = this.getScene().materials; + for (t = i.length - 1; t > -1; t--) + if (i[t].id === e) return (this.material = i[t]), this; + var n = this.getScene().multiMaterials; + for (t = n.length - 1; t > -1; t--) + if (n[t].id === e) return (this.material = n[t]), this; + return this; + }), + (t.prototype.getAnimatables = function () { + var e = new Array(); + return ( + this.material && e.push(this.material), this.skeleton && e.push(this.skeleton), e - } - , - t.prototype.bakeTransformIntoVertices = function(e) { - if (!this.isVerticesDataPresent(l.b.PositionKind)) - return this; - var t = this.subMeshes.splice(0); - this._resetPointsArrayCache(); - var i, n = this.getVerticesData(l.b.PositionKind), r = new Array; - for (i = 0; i < n.length; i += 3) - c.x.TransformCoordinates(c.x.FromArray(n, i), e).toArray(r, i); - if (this.setVerticesData(l.b.PositionKind, r, this.getVertexBuffer(l.b.PositionKind).isUpdatable()), - this.isVerticesDataPresent(l.b.NormalKind)) { - for (n = this.getVerticesData(l.b.NormalKind), - r = [], - i = 0; i < n.length; i += 3) - c.x.TransformNormal(c.x.FromArray(n, i), e).normalize().toArray(r, i); - this.setVerticesData(l.b.NormalKind, r, this.getVertexBuffer(l.b.NormalKind).isUpdatable()) - } - return e.m[0] * e.m[5] * e.m[10] < 0 && this.flipFaces(), - this.releaseSubMeshes(), - this.subMeshes = t, - this - } - , - t.prototype.bakeCurrentTransformIntoVertices = function() { - return this.bakeTransformIntoVertices(this.computeWorldMatrix(true)), - this.scaling.copyFromFloats(1, 1, 1), - this.position.copyFromFloats(0, 0, 0), - this.rotation.copyFromFloats(0, 0, 0), - this.rotationQuaternion && (this.rotationQuaternion = c.q.Identity()), - this._worldMatrix = c.j.Identity(), - this - } - , - Object.defineProperty(t.prototype, "_positions", { - get: function() { - return this._geometry ? this._geometry._positions : null - }, - enumerable: true, - configurable: true + ); }), - t.prototype._resetPointsArrayCache = function() { - return this._geometry && this._geometry._resetPointsArrayCache(), + (t.prototype.bakeTransformIntoVertices = function (e) { + if (!this.isVerticesDataPresent(l.b.PositionKind)) + return this; + var t = this.subMeshes.splice(0); + this._resetPointsArrayCache(); + var i, + n = this.getVerticesData(l.b.PositionKind), + r = new Array(); + for (i = 0; i < n.length; i += 3) + c.x + .TransformCoordinates(c.x.FromArray(n, i), e) + .toArray(r, i); + if ( + (this.setVerticesData( + l.b.PositionKind, + r, + this.getVertexBuffer(l.b.PositionKind).isUpdatable() + ), + this.isVerticesDataPresent(l.b.NormalKind)) + ) { + for ( + n = this.getVerticesData(l.b.NormalKind), + r = [], + i = 0; + i < n.length; + i += 3 + ) + c.x + .TransformNormal(c.x.FromArray(n, i), e) + .normalize() + .toArray(r, i); + this.setVerticesData( + l.b.NormalKind, + r, + this.getVertexBuffer(l.b.NormalKind).isUpdatable() + ); + } + return ( + e.m[0] * e.m[5] * e.m[10] < 0 && this.flipFaces(), + this.releaseSubMeshes(), + (this.subMeshes = t), this - } - , - t.prototype._generatePointsArray = function() { - return !!this._geometry && this._geometry._generatePointsArray() - } - , - t.prototype.clone = function(e, i, n, r) { - return void 0 === e && (e = ""), + ); + }), + (t.prototype.bakeCurrentTransformIntoVertices = + function () { + return ( + this.bakeTransformIntoVertices( + this.computeWorldMatrix(true) + ), + this.scaling.copyFromFloats(1, 1, 1), + this.position.copyFromFloats(0, 0, 0), + this.rotation.copyFromFloats(0, 0, 0), + this.rotationQuaternion && + (this.rotationQuaternion = c.q.Identity()), + (this._worldMatrix = c.j.Identity()), + this + ); + }), + Object.defineProperty(t.prototype, "_positions", { + get: function () { + return this._geometry + ? this._geometry._positions + : null; + }, + enumerable: true, + configurable: true, + }), + (t.prototype._resetPointsArrayCache = function () { + return ( + this._geometry && + this._geometry._resetPointsArrayCache(), + this + ); + }), + (t.prototype._generatePointsArray = function () { + return ( + !!this._geometry && + this._geometry._generatePointsArray() + ); + }), + (t.prototype.clone = function (e, i, n, r) { + return ( + void 0 === e && (e = ""), void 0 === r && (r = true), - new t(e,this.getScene(),i,this,n,r) - } - , - t.prototype.dispose = function(t, i) { - void 0 === i && (i = false), - this.morphTargetManager = null, - this._geometry && this._geometry.releaseForMesh(this, true); - var n = this._internalMeshDataInfo; - if (n._onBeforeDrawObservable && n._onBeforeDrawObservable.clear(), - n._onBeforeBindObservable && n._onBeforeBindObservable.clear(), - n._onBeforeRenderObservable && n._onBeforeRenderObservable.clear(), - n._onAfterRenderObservable && n._onAfterRenderObservable.clear(), - this._scene.useClonedMeshhMap) { - if (n.meshMap) - for (var r in n.meshMap) - (s = n.meshMap[r]) && (s._internalMeshDataInfo._source = null, - n.meshMap[r] = void 0); - n._source && n._source._internalMeshDataInfo.meshMap && (n._source._internalMeshDataInfo.meshMap[this.uniqueId] = void 0) - } else - for (var o = 0, a = this.getScene().meshes; o < a.length; o++) { - var s; - (s = a[o])._internalMeshDataInfo && s._internalMeshDataInfo._source && s._internalMeshDataInfo._source === this && (s._internalMeshDataInfo._source = null) - } - for (n._source = null, - this._instanceDataStorage.instancesBuffer && (this._instanceDataStorage.instancesBuffer.dispose(), - this._instanceDataStorage.instancesBuffer = null); this.instances.length; ) - this.instances[0].dispose(); - e.prototype.dispose.call(this, t, i) - } - , - t.prototype.applyDisplacementMap = function(e, t, i, n, r, a, s) { - var c = this; - void 0 === s && (s = false); - var u = this.getScene(); - return o.h.LoadImage(e, function(e) { - var o = document.createElement("canvas") - , u = o.getContext("2d") - , l = e.width - , h = e.height; - o.width = l, - o.height = h, - u.drawImage(e, 0, 0); + new t(e, this.getScene(), i, this, n, r) + ); + }), + (t.prototype.dispose = function (t, i) { + void 0 === i && (i = false), + (this.morphTargetManager = null), + this._geometry && + this._geometry.releaseForMesh(this, true); + var n = this._internalMeshDataInfo; + if ( + (n._onBeforeDrawObservable && + n._onBeforeDrawObservable.clear(), + n._onBeforeBindObservable && + n._onBeforeBindObservable.clear(), + n._onBeforeRenderObservable && + n._onBeforeRenderObservable.clear(), + n._onAfterRenderObservable && + n._onAfterRenderObservable.clear(), + this._scene.useClonedMeshhMap) + ) { + if (n.meshMap) + for (var r in n.meshMap) + (s = n.meshMap[r]) && + ((s._internalMeshDataInfo._source = null), + (n.meshMap[r] = void 0)); + n._source && + n._source._internalMeshDataInfo.meshMap && + (n._source._internalMeshDataInfo.meshMap[ + this.uniqueId + ] = void 0); + } else + for ( + var o = 0, a = this.getScene().meshes; + o < a.length; + o++ + ) { + var s; + (s = a[o])._internalMeshDataInfo && + s._internalMeshDataInfo._source && + s._internalMeshDataInfo._source === this && + (s._internalMeshDataInfo._source = null); + } + for ( + n._source = null, + this._instanceDataStorage.instancesBuffer && + (this._instanceDataStorage.instancesBuffer.dispose(), + (this._instanceDataStorage.instancesBuffer = null)); + this.instances.length; + + ) + this.instances[0].dispose(); + e.prototype.dispose.call(this, t, i); + }), + (t.prototype.applyDisplacementMap = function ( + e, + t, + i, + n, + r, + a, + s + ) { + var c = this; + void 0 === s && (s = false); + var u = this.getScene(); + return ( + o.h.LoadImage( + e, + function (e) { + var o = document.createElement("canvas"), + u = o.getContext("2d"), + l = e.width, + h = e.height; + (o.width = l), (o.height = h), u.drawImage(e, 0, 0); var f = u.getImageData(0, 0, l, h).data; - c.applyDisplacementMapFromBuffer(f, l, h, t, i, r, a, s), - n && n(c) - }, function() {}, u.offlineProvider), + c.applyDisplacementMapFromBuffer( + f, + l, + h, + t, + i, + r, + a, + s + ), + n && n(c); + }, + function () {}, + u.offlineProvider + ), this - } - , - t.prototype.applyDisplacementMapFromBuffer = function(e, t, i, n, r, o, a, s) { - if (void 0 === s && (s = false), - !this.isVerticesDataPresent(l.b.PositionKind) || !this.isVerticesDataPresent(l.b.NormalKind) || !this.isVerticesDataPresent(l.b.UVKind)) - return E.a.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"), - this; - var u = this.getVerticesData(l.b.PositionKind, true, true) - , f = this.getVerticesData(l.b.NormalKind) - , d = this.getVerticesData(l.b.UVKind) - , p = c.x.Zero() - , m = c.x.Zero() - , g = c.w.Zero(); - o = o || c.w.Zero(), - a = a || new c.w(1,1); - for (var _ = 0; _ < u.length; _ += 3) { - c.x.FromArrayToRef(u, _, p), - c.x.FromArrayToRef(f, _, m), - c.w.FromArrayToRef(d, _ / 3 * 2, g); - var v = 4 * ((Math.abs(g.x * a.x + o.x) * t % t | 0) + (Math.abs(g.y * a.y + o.y) * i % i | 0) * t) - , y = e[v] / 255 * .3 + e[v + 1] / 255 * .59 + e[v + 2] / 255 * .11; - m.normalize(), - m.scaleInPlace(n + (r - n) * y), - (p = p.add(m)).toArray(u, _) - } - return h.a.ComputeNormals(u, this.getIndices(), f), - s ? (this.setVerticesData(l.b.PositionKind, u), - this.setVerticesData(l.b.NormalKind, f)) : (this.updateVerticesData(l.b.PositionKind, u), - this.updateVerticesData(l.b.NormalKind, f)), + ); + }), + (t.prototype.applyDisplacementMapFromBuffer = function ( + e, + t, + i, + n, + r, + o, + a, + s + ) { + if ( + (void 0 === s && (s = false), + !this.isVerticesDataPresent(l.b.PositionKind) || + !this.isVerticesDataPresent(l.b.NormalKind) || + !this.isVerticesDataPresent(l.b.UVKind)) + ) + return ( + E.a.Warn( + "Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing" + ), + this + ); + var u = this.getVerticesData( + l.b.PositionKind, + true, + true + ), + f = this.getVerticesData(l.b.NormalKind), + d = this.getVerticesData(l.b.UVKind), + p = c.x.Zero(), + m = c.x.Zero(), + g = c.w.Zero(); + (o = o || c.w.Zero()), (a = a || new c.w(1, 1)); + for (var _ = 0; _ < u.length; _ += 3) { + c.x.FromArrayToRef(u, _, p), + c.x.FromArrayToRef(f, _, m), + c.w.FromArrayToRef(d, (_ / 3) * 2, g); + var v = + 4 * + (((Math.abs(g.x * a.x + o.x) * t) % t | 0) + + ((Math.abs(g.y * a.y + o.y) * i) % i | 0) * t), + y = + (e[v] / 255) * 0.3 + + (e[v + 1] / 255) * 0.59 + + (e[v + 2] / 255) * 0.11; + m.normalize(), + m.scaleInPlace(n + (r - n) * y), + (p = p.add(m)).toArray(u, _); + } + return ( + h.a.ComputeNormals(u, this.getIndices(), f), + s + ? (this.setVerticesData(l.b.PositionKind, u), + this.setVerticesData(l.b.NormalKind, f)) + : (this.updateVerticesData(l.b.PositionKind, u), + this.updateVerticesData(l.b.NormalKind, f)), this - } - , - t.prototype.convertToFlatShadedMesh = function() { - var e, t, i = this.getVerticesDataKinds(), n = {}, r = {}, o = {}, a = false; - for (e = 0; e < i.length; e++) { - t = i[e]; - var s = this.getVertexBuffer(t); - t !== l.b.NormalKind ? (n[t] = s, - r[t] = n[t].getData(), - o[t] = []) : (a = s.isUpdatable(), - i.splice(e, 1), - e--) - } - var u, h = this.subMeshes.slice(0), f = this.getIndices(), d = this.getTotalIndices(); - for (u = 0; u < d; u++) { - var m = f[u]; - for (e = 0; e < i.length; e++) - for (var g = n[t = i[e]].getStrideSize(), _ = 0; _ < g; _++) - o[t].push(r[t][m * g + _]) - } - var v = [] - , y = o[l.b.PositionKind]; - for (u = 0; u < d; u += 3) { - f[u] = u, - f[u + 1] = u + 1, - f[u + 2] = u + 2; - for (var b = c.x.FromArray(y, 3 * u), E = c.x.FromArray(y, 3 * (u + 1)), T = c.x.FromArray(y, 3 * (u + 2)), A = b.subtract(E), x = T.subtract(E), S = c.x.Normalize(c.x.Cross(A, x)), C = 0; C < 3; C++) - v.push(S.x), - v.push(S.y), - v.push(S.z) - } - for (this.setIndices(f), - this.setVerticesData(l.b.NormalKind, v, a), - e = 0; e < i.length; e++) - t = i[e], - this.setVerticesData(t, o[t], n[t].isUpdatable()); - this.releaseSubMeshes(); - for (var P = 0; P < h.length; P++) { - var R = h[P]; - p.b.AddToMesh(R.materialIndex, R.indexStart, R.indexCount, R.indexStart, R.indexCount, this) - } - return this.synchronizeInstances(), - this - } - , - t.prototype.convertToUnIndexedMesh = function() { - var e, t, i = this.getVerticesDataKinds(), n = {}, r = {}, o = {}; - for (e = 0; e < i.length; e++) { - t = i[e]; - var a = this.getVertexBuffer(t); - n[t] = a, - r[t] = n[t].getData(), - o[t] = [] - } - var s, c = this.subMeshes.slice(0), u = this.getIndices(), l = this.getTotalIndices(); - for (s = 0; s < l; s++) { - var h = u[s]; - for (e = 0; e < i.length; e++) - for (var f = n[t = i[e]].getStrideSize(), d = 0; d < f; d++) - o[t].push(r[t][h * f + d]) - } - for (s = 0; s < l; s += 3) - u[s] = s, - u[s + 1] = s + 1, - u[s + 2] = s + 2; - for (this.setIndices(u), - e = 0; e < i.length; e++) - t = i[e], - this.setVerticesData(t, o[t], n[t].isUpdatable()); - this.releaseSubMeshes(); - for (var m = 0; m < c.length; m++) { - var g = c[m]; - p.b.AddToMesh(g.materialIndex, g.indexStart, g.indexCount, g.indexStart, g.indexCount, this) - } - return this._unIndexed = true, + ); + }), + (t.prototype.convertToFlatShadedMesh = function () { + var e, + t, + i = this.getVerticesDataKinds(), + n = {}, + r = {}, + o = {}, + a = false; + for (e = 0; e < i.length; e++) { + t = i[e]; + var s = this.getVertexBuffer(t); + t !== l.b.NormalKind + ? ((n[t] = s), (r[t] = n[t].getData()), (o[t] = [])) + : ((a = s.isUpdatable()), i.splice(e, 1), e--); + } + var u, + h = this.subMeshes.slice(0), + f = this.getIndices(), + d = this.getTotalIndices(); + for (u = 0; u < d; u++) { + var m = f[u]; + for (e = 0; e < i.length; e++) + for ( + var g = n[(t = i[e])].getStrideSize(), _ = 0; + _ < g; + _++ + ) + o[t].push(r[t][m * g + _]); + } + var v = [], + y = o[l.b.PositionKind]; + for (u = 0; u < d; u += 3) { + (f[u] = u), (f[u + 1] = u + 1), (f[u + 2] = u + 2); + for ( + var b = c.x.FromArray(y, 3 * u), + E = c.x.FromArray(y, 3 * (u + 1)), + T = c.x.FromArray(y, 3 * (u + 2)), + A = b.subtract(E), + x = T.subtract(E), + S = c.x.Normalize(c.x.Cross(A, x)), + C = 0; + C < 3; + C++ + ) + v.push(S.x), v.push(S.y), v.push(S.z); + } + for ( + this.setIndices(f), + this.setVerticesData(l.b.NormalKind, v, a), + e = 0; + e < i.length; + e++ + ) + (t = i[e]), + this.setVerticesData(t, o[t], n[t].isUpdatable()); + this.releaseSubMeshes(); + for (var P = 0; P < h.length; P++) { + var R = h[P]; + p.b.AddToMesh( + R.materialIndex, + R.indexStart, + R.indexCount, + R.indexStart, + R.indexCount, + this + ); + } + return this.synchronizeInstances(), this; + }), + (t.prototype.convertToUnIndexedMesh = function () { + var e, + t, + i = this.getVerticesDataKinds(), + n = {}, + r = {}, + o = {}; + for (e = 0; e < i.length; e++) { + t = i[e]; + var a = this.getVertexBuffer(t); + (n[t] = a), (r[t] = n[t].getData()), (o[t] = []); + } + var s, + c = this.subMeshes.slice(0), + u = this.getIndices(), + l = this.getTotalIndices(); + for (s = 0; s < l; s++) { + var h = u[s]; + for (e = 0; e < i.length; e++) + for ( + var f = n[(t = i[e])].getStrideSize(), d = 0; + d < f; + d++ + ) + o[t].push(r[t][h * f + d]); + } + for (s = 0; s < l; s += 3) + (u[s] = s), (u[s + 1] = s + 1), (u[s + 2] = s + 2); + for (this.setIndices(u), e = 0; e < i.length; e++) + (t = i[e]), + this.setVerticesData(t, o[t], n[t].isUpdatable()); + this.releaseSubMeshes(); + for (var m = 0; m < c.length; m++) { + var g = c[m]; + p.b.AddToMesh( + g.materialIndex, + g.indexStart, + g.indexCount, + g.indexStart, + g.indexCount, + this + ); + } + return ( + (this._unIndexed = true), this.synchronizeInstances(), this - } - , - t.prototype.flipFaces = function(e) { - void 0 === e && (e = false); - var t, i, n = h.a.ExtractFromMesh(this); - if (e && this.isVerticesDataPresent(l.b.NormalKind) && n.normals) - for (t = 0; t < n.normals.length; t++) - n.normals[t] *= -1; - if (n.indices) - for (t = 0; t < n.indices.length; t += 3) - i = n.indices[t + 1], - n.indices[t + 1] = n.indices[t + 2], - n.indices[t + 2] = i; - return n.applyToMesh(this), - this - } - , - t.prototype.increaseVertices = function(e) { - var t = h.a.ExtractFromMesh(this) - , i = t.uvs - , n = t.indices - , r = t.positions - , o = t.normals; - if (null === n || null === r || null === o || null === i) - E.a.Warn("VertexData contains null entries"); - else { - for (var a, s, u = e + 1, l = new Array, f = 0; f < u + 1; f++) - l[f] = new Array; - var d, p = new c.x(0,0,0), m = new c.x(0,0,0), g = new c.w(0,0), _ = new Array, v = new Array, y = new Array, b = r.length, T = i.length; - for (f = 0; f < n.length; f += 3) { - v[0] = n[f], - v[1] = n[f + 1], - v[2] = n[f + 2]; - for (var A = 0; A < 3; A++) - if (a = v[A], - s = v[(A + 1) % 3], - void 0 === y[a] && void 0 === y[s] ? (y[a] = new Array, - y[s] = new Array) : (void 0 === y[a] && (y[a] = new Array), - void 0 === y[s] && (y[s] = new Array)), - void 0 === y[a][s] && void 0 === y[s][a]) { - y[a][s] = [], - p.x = (r[3 * s] - r[3 * a]) / u, - p.y = (r[3 * s + 1] - r[3 * a + 1]) / u, - p.z = (r[3 * s + 2] - r[3 * a + 2]) / u, - m.x = (o[3 * s] - o[3 * a]) / u, - m.y = (o[3 * s + 1] - o[3 * a + 1]) / u, - m.z = (o[3 * s + 2] - o[3 * a + 2]) / u, - g.x = (i[2 * s] - i[2 * a]) / u, - g.y = (i[2 * s + 1] - i[2 * a + 1]) / u, - y[a][s].push(a); - for (var x = 1; x < u; x++) - y[a][s].push(r.length / 3), - r[b] = r[3 * a] + x * p.x, - o[b++] = o[3 * a] + x * m.x, - r[b] = r[3 * a + 1] + x * p.y, - o[b++] = o[3 * a + 1] + x * m.y, - r[b] = r[3 * a + 2] + x * p.z, - o[b++] = o[3 * a + 2] + x * m.z, - i[T++] = i[2 * a] + x * g.x, - i[T++] = i[2 * a + 1] + x * g.y; - y[a][s].push(s), - y[s][a] = new Array, - d = y[a][s].length; - for (var S = 0; S < d; S++) - y[s][a][S] = y[a][s][d - 1 - S] - } - for (l[0][0] = n[f], - l[1][0] = y[n[f]][n[f + 1]][1], - l[1][1] = y[n[f]][n[f + 2]][1], - x = 2; x < u; x++) - for (l[x][0] = y[n[f]][n[f + 1]][x], - l[x][x] = y[n[f]][n[f + 2]][x], - p.x = (r[3 * l[x][x]] - r[3 * l[x][0]]) / x, - p.y = (r[3 * l[x][x] + 1] - r[3 * l[x][0] + 1]) / x, - p.z = (r[3 * l[x][x] + 2] - r[3 * l[x][0] + 2]) / x, - m.x = (o[3 * l[x][x]] - o[3 * l[x][0]]) / x, - m.y = (o[3 * l[x][x] + 1] - o[3 * l[x][0] + 1]) / x, - m.z = (o[3 * l[x][x] + 2] - o[3 * l[x][0] + 2]) / x, - g.x = (i[2 * l[x][x]] - i[2 * l[x][0]]) / x, - g.y = (i[2 * l[x][x] + 1] - i[2 * l[x][0] + 1]) / x, - A = 1; A < x; A++) - l[x][A] = r.length / 3, - r[b] = r[3 * l[x][0]] + A * p.x, - o[b++] = o[3 * l[x][0]] + A * m.x, - r[b] = r[3 * l[x][0] + 1] + A * p.y, - o[b++] = o[3 * l[x][0] + 1] + A * m.y, - r[b] = r[3 * l[x][0] + 2] + A * p.z, - o[b++] = o[3 * l[x][0] + 2] + A * m.z, - i[T++] = i[2 * l[x][0]] + A * g.x, - i[T++] = i[2 * l[x][0] + 1] + A * g.y; - for (l[u] = y[n[f + 1]][n[f + 2]], - _.push(l[0][0], l[1][0], l[1][1]), - x = 1; x < u; x++) { - for (A = 0; A < x; A++) - _.push(l[x][A], l[x + 1][A], l[x + 1][A + 1]), - _.push(l[x][A], l[x + 1][A + 1], l[x][A + 1]); - _.push(l[x][A], l[x + 1][A], l[x + 1][A + 1]) - } + ); + }), + (t.prototype.flipFaces = function (e) { + void 0 === e && (e = false); + var t, + i, + n = h.a.ExtractFromMesh(this); + if ( + e && + this.isVerticesDataPresent(l.b.NormalKind) && + n.normals + ) + for (t = 0; t < n.normals.length; t++) + n.normals[t] *= -1; + if (n.indices) + for (t = 0; t < n.indices.length; t += 3) + (i = n.indices[t + 1]), + (n.indices[t + 1] = n.indices[t + 2]), + (n.indices[t + 2] = i); + return n.applyToMesh(this), this; + }), + (t.prototype.increaseVertices = function (e) { + var t = h.a.ExtractFromMesh(this), + i = t.uvs, + n = t.indices, + r = t.positions, + o = t.normals; + if (null === n || null === r || null === o || null === i) + E.a.Warn("VertexData contains null entries"); + else { + for ( + var a, s, u = e + 1, l = new Array(), f = 0; + f < u + 1; + f++ + ) + l[f] = new Array(); + var d, + p = new c.x(0, 0, 0), + m = new c.x(0, 0, 0), + g = new c.w(0, 0), + _ = new Array(), + v = new Array(), + y = new Array(), + b = r.length, + T = i.length; + for (f = 0; f < n.length; f += 3) { + (v[0] = n[f]), (v[1] = n[f + 1]), (v[2] = n[f + 2]); + for (var A = 0; A < 3; A++) + if ( + ((a = v[A]), + (s = v[(A + 1) % 3]), + void 0 === y[a] && void 0 === y[s] + ? ((y[a] = new Array()), (y[s] = new Array())) + : (void 0 === y[a] && (y[a] = new Array()), + void 0 === y[s] && (y[s] = new Array())), + void 0 === y[a][s] && void 0 === y[s][a]) + ) { + (y[a][s] = []), + (p.x = (r[3 * s] - r[3 * a]) / u), + (p.y = (r[3 * s + 1] - r[3 * a + 1]) / u), + (p.z = (r[3 * s + 2] - r[3 * a + 2]) / u), + (m.x = (o[3 * s] - o[3 * a]) / u), + (m.y = (o[3 * s + 1] - o[3 * a + 1]) / u), + (m.z = (o[3 * s + 2] - o[3 * a + 2]) / u), + (g.x = (i[2 * s] - i[2 * a]) / u), + (g.y = (i[2 * s + 1] - i[2 * a + 1]) / u), + y[a][s].push(a); + for (var x = 1; x < u; x++) + y[a][s].push(r.length / 3), + (r[b] = r[3 * a] + x * p.x), + (o[b++] = o[3 * a] + x * m.x), + (r[b] = r[3 * a + 1] + x * p.y), + (o[b++] = o[3 * a + 1] + x * m.y), + (r[b] = r[3 * a + 2] + x * p.z), + (o[b++] = o[3 * a + 2] + x * m.z), + (i[T++] = i[2 * a] + x * g.x), + (i[T++] = i[2 * a + 1] + x * g.y); + y[a][s].push(s), + (y[s][a] = new Array()), + (d = y[a][s].length); + for (var S = 0; S < d; S++) + y[s][a][S] = y[a][s][d - 1 - S]; } - t.indices = _, - t.applyToMesh(this) + for ( + l[0][0] = n[f], + l[1][0] = y[n[f]][n[f + 1]][1], + l[1][1] = y[n[f]][n[f + 2]][1], + x = 2; + x < u; + x++ + ) + for ( + l[x][0] = y[n[f]][n[f + 1]][x], + l[x][x] = y[n[f]][n[f + 2]][x], + p.x = (r[3 * l[x][x]] - r[3 * l[x][0]]) / x, + p.y = + (r[3 * l[x][x] + 1] - r[3 * l[x][0] + 1]) / x, + p.z = + (r[3 * l[x][x] + 2] - r[3 * l[x][0] + 2]) / x, + m.x = (o[3 * l[x][x]] - o[3 * l[x][0]]) / x, + m.y = + (o[3 * l[x][x] + 1] - o[3 * l[x][0] + 1]) / x, + m.z = + (o[3 * l[x][x] + 2] - o[3 * l[x][0] + 2]) / x, + g.x = (i[2 * l[x][x]] - i[2 * l[x][0]]) / x, + g.y = + (i[2 * l[x][x] + 1] - i[2 * l[x][0] + 1]) / x, + A = 1; + A < x; + A++ + ) + (l[x][A] = r.length / 3), + (r[b] = r[3 * l[x][0]] + A * p.x), + (o[b++] = o[3 * l[x][0]] + A * m.x), + (r[b] = r[3 * l[x][0] + 1] + A * p.y), + (o[b++] = o[3 * l[x][0] + 1] + A * m.y), + (r[b] = r[3 * l[x][0] + 2] + A * p.z), + (o[b++] = o[3 * l[x][0] + 2] + A * m.z), + (i[T++] = i[2 * l[x][0]] + A * g.x), + (i[T++] = i[2 * l[x][0] + 1] + A * g.y); + for ( + l[u] = y[n[f + 1]][n[f + 2]], + _.push(l[0][0], l[1][0], l[1][1]), + x = 1; + x < u; + x++ + ) { + for (A = 0; A < x; A++) + _.push(l[x][A], l[x + 1][A], l[x + 1][A + 1]), + _.push(l[x][A], l[x + 1][A + 1], l[x][A + 1]); + _.push(l[x][A], l[x + 1][A], l[x + 1][A + 1]); + } } - } - , - t.prototype.forceSharedVertices = function() { - var e = h.a.ExtractFromMesh(this) - , t = e.uvs - , i = e.indices - , n = e.positions - , r = e.normals; - if (null === i || null === n || null === r || null === t) - E.a.Warn("VertexData contains null entries"); - else { - for (var o, a, s = new Array, c = new Array, u = new Array, l = new Array, f = 0, d = new Array, p = 0; p < i.length; p += 3) { - a = [i[p], i[p + 1], i[p + 2]], - l = new Array; - for (var m = 0; m < 3; m++) { - l[m] = ""; - for (var g = 0; g < 3; g++) - Math.abs(n[3 * a[m] + g]) < 1e-8 && (n[3 * a[m] + g] = 0), - l[m] += n[3 * a[m] + g] + "|"; - l[m] = l[m].slice(0, -1) - } - if (l[0] != l[1] && l[0] != l[2] && l[1] != l[2]) - for (m = 0; m < 3; m++) { - if ((o = d.indexOf(l[m])) < 0) { - for (d.push(l[m]), - o = f++, - g = 0; g < 3; g++) - s.push(n[3 * a[m] + g]); - for (g = 0; g < 2; g++) - u.push(t[2 * a[m] + g]) - } - c.push(o) - } + (t.indices = _), t.applyToMesh(this); + } + }), + (t.prototype.forceSharedVertices = function () { + var e = h.a.ExtractFromMesh(this), + t = e.uvs, + i = e.indices, + n = e.positions, + r = e.normals; + if (null === i || null === n || null === r || null === t) + E.a.Warn("VertexData contains null entries"); + else { + for ( + var o, + a, + s = new Array(), + c = new Array(), + u = new Array(), + l = new Array(), + f = 0, + d = new Array(), + p = 0; + p < i.length; + p += 3 + ) { + (a = [i[p], i[p + 1], i[p + 2]]), (l = new Array()); + for (var m = 0; m < 3; m++) { + l[m] = ""; + for (var g = 0; g < 3; g++) + Math.abs(n[3 * a[m] + g]) < 1e-8 && + (n[3 * a[m] + g] = 0), + (l[m] += n[3 * a[m] + g] + "|"); + l[m] = l[m].slice(0, -1); + } + if (l[0] != l[1] && l[0] != l[2] && l[1] != l[2]) + for (m = 0; m < 3; m++) { + if ((o = d.indexOf(l[m])) < 0) { + for (d.push(l[m]), o = f++, g = 0; g < 3; g++) + s.push(n[3 * a[m] + g]); + for (g = 0; g < 2; g++) u.push(t[2 * a[m] + g]); + } + c.push(o); } - var _ = new Array; - h.a.ComputeNormals(s, c, _), - e.positions = s, - e.indices = c, - e.normals = _, - e.uvs = u, - e.applyToMesh(this) } - } - , - t._instancedMeshFactory = function(e, t) { - throw A.a.WarnImport("InstancedMesh") - } - , - t._PhysicsImpostorParser = function(e, t, i) { - throw A.a.WarnImport("PhysicsImpostor") - } - , - t.prototype.createInstance = function(e) { - return t._instancedMeshFactory(e, this) - } - , - t.prototype.synchronizeInstances = function() { - for (var e = 0; e < this.instances.length; e++) - this.instances[e]._syncSubMeshes(); - return this - } - , - t.prototype.optimizeIndices = function(e) { - var t = this - , i = this.getIndices() - , n = this.getVerticesData(l.b.PositionKind); - if (!n || !i) - return this; - for (var r = new Array, a = 0; a < n.length; a += 3) - r.push(c.x.FromArray(n, a)); - var s = new Array; - return o.a.SyncAsyncForLoop(r.length, 40, function(e) { - for (var t = r.length - 1 - e, i = r[t], n = 0; n < t; ++n) { - var o = r[n]; - if (i.equals(o)) { - s[t] = n; - break - } + var _ = new Array(); + h.a.ComputeNormals(s, c, _), + (e.positions = s), + (e.indices = c), + (e.normals = _), + (e.uvs = u), + e.applyToMesh(this); + } + }), + (t._instancedMeshFactory = function (e, t) { + throw A.a.WarnImport("InstancedMesh"); + }), + (t._PhysicsImpostorParser = function (e, t, i) { + throw A.a.WarnImport("PhysicsImpostor"); + }), + (t.prototype.createInstance = function (e) { + return t._instancedMeshFactory(e, this); + }), + (t.prototype.synchronizeInstances = function () { + for (var e = 0; e < this.instances.length; e++) + this.instances[e]._syncSubMeshes(); + return this; + }), + (t.prototype.optimizeIndices = function (e) { + var t = this, + i = this.getIndices(), + n = this.getVerticesData(l.b.PositionKind); + if (!n || !i) return this; + for (var r = new Array(), a = 0; a < n.length; a += 3) + r.push(c.x.FromArray(n, a)); + var s = new Array(); + return ( + o.a.SyncAsyncForLoop( + r.length, + 40, + function (e) { + for ( + var t = r.length - 1 - e, i = r[t], n = 0; + n < t; + ++n + ) { + var o = r[n]; + if (i.equals(o)) { + s[t] = n; + break; + } } - }, function() { + }, + function () { for (var n = 0; n < i.length; ++n) - i[n] = s[i[n]] || i[n]; + i[n] = s[i[n]] || i[n]; var r = t.subMeshes.slice(0); - t.setIndices(i), - t.subMeshes = r, - e && e(t) - }), + t.setIndices(i), (t.subMeshes = r), e && e(t); + } + ), this - } - , - t.prototype.serialize = function(e) { - e.name = this.name, - e.id = this.id, - e.type = this.getClassName(), - s.a && s.a.HasTags(this) && (e.tags = s.a.GetTags(this)), - e.position = this.position.asArray(), - this.rotationQuaternion ? e.rotationQuaternion = this.rotationQuaternion.asArray() : this.rotation && (e.rotation = this.rotation.asArray()), - e.scaling = this.scaling.asArray(), - this._postMultiplyPivotMatrix ? e.pivotMatrix = this.getPivotMatrix().asArray() : e.localMatrix = this.getPivotMatrix().asArray(), - e.isEnabled = this.isEnabled(false), - e.isVisible = this.isVisible, - e.infiniteDistance = this.infiniteDistance, - e.pickable = this.isPickable, - e.receiveShadows = this.receiveShadows, - e.billboardMode = this.billboardMode, - e.visibility = this.visibility, - e.checkCollisions = this.checkCollisions, - e.isBlocker = this.isBlocker, + ); + }), + (t.prototype.serialize = function (e) { + (e.name = this.name), + (e.id = this.id), + (e.type = this.getClassName()), + s.a && + s.a.HasTags(this) && + (e.tags = s.a.GetTags(this)), + (e.position = this.position.asArray()), + this.rotationQuaternion + ? (e.rotationQuaternion = + this.rotationQuaternion.asArray()) + : this.rotation && + (e.rotation = this.rotation.asArray()), + (e.scaling = this.scaling.asArray()), + this._postMultiplyPivotMatrix + ? (e.pivotMatrix = this.getPivotMatrix().asArray()) + : (e.localMatrix = this.getPivotMatrix().asArray()), + (e.isEnabled = this.isEnabled(false)), + (e.isVisible = this.isVisible), + (e.infiniteDistance = this.infiniteDistance), + (e.pickable = this.isPickable), + (e.receiveShadows = this.receiveShadows), + (e.billboardMode = this.billboardMode), + (e.visibility = this.visibility), + (e.checkCollisions = this.checkCollisions), + (e.isBlocker = this.isBlocker), this.parent && (e.parentId = this.parent.id), - e.isUnIndexed = this.isUnIndexed; - var t = this._geometry; - if (t) { - var i = t.id; - e.geometryId = i, - e.subMeshes = []; - for (var n = 0; n < this.subMeshes.length; n++) { - var r = this.subMeshes[n]; - e.subMeshes.push({ - materialIndex: r.materialIndex, - verticesStart: r.verticesStart, - verticesCount: r.verticesCount, - indexStart: r.indexStart, - indexCount: r.indexCount - }) - } + (e.isUnIndexed = this.isUnIndexed); + var t = this._geometry; + if (t) { + var i = t.id; + (e.geometryId = i), (e.subMeshes = []); + for (var n = 0; n < this.subMeshes.length; n++) { + var r = this.subMeshes[n]; + e.subMeshes.push({ + materialIndex: r.materialIndex, + verticesStart: r.verticesStart, + verticesCount: r.verticesCount, + indexStart: r.indexStart, + indexCount: r.indexCount, + }); } - if (this.material ? e.materialId = this.material.id : this.material = null, - this.morphTargetManager && (e.morphTargetManagerId = this.morphTargetManager.uniqueId), + } + if ( + (this.material + ? (e.materialId = this.material.id) + : (this.material = null), + this.morphTargetManager && + (e.morphTargetManagerId = + this.morphTargetManager.uniqueId), this.skeleton && (e.skeletonId = this.skeleton.id), - this.getScene()._getComponent(x.a.NAME_PHYSICSENGINE)) { - var o = this.getPhysicsImpostor(); - o && (e.physicsMass = o.getParam("mass"), - e.physicsFriction = o.getParam("friction"), - e.physicsRestitution = o.getParam("mass"), - e.physicsImpostor = o.type) + this.getScene()._getComponent(x.a.NAME_PHYSICSENGINE)) + ) { + var o = this.getPhysicsImpostor(); + o && + ((e.physicsMass = o.getParam("mass")), + (e.physicsFriction = o.getParam("friction")), + (e.physicsRestitution = o.getParam("mass")), + (e.physicsImpostor = o.type)); + } + this.metadata && (e.metadata = this.metadata), + (e.instances = []); + for (var a = 0; a < this.instances.length; a++) { + var c = this.instances[a]; + if (!c.doNotSerialize) { + var u = { + name: c.name, + id: c.id, + position: c.position.asArray(), + scaling: c.scaling.asArray(), + }; + c.parent && (u.parentId = c.parent.id), + c.rotationQuaternion + ? (u.rotationQuaternion = + c.rotationQuaternion.asArray()) + : c.rotation && + (u.rotation = c.rotation.asArray()), + e.instances.push(u), + b.a.AppendSerializedAnimations(c, u), + (u.ranges = c.serializeAnimationRanges()); } - this.metadata && (e.metadata = this.metadata), - e.instances = []; - for (var a = 0; a < this.instances.length; a++) { - var c = this.instances[a]; - if (!c.doNotSerialize) { - var u = { - name: c.name, - id: c.id, - position: c.position.asArray(), - scaling: c.scaling.asArray() - }; - c.parent && (u.parentId = c.parent.id), - c.rotationQuaternion ? u.rotationQuaternion = c.rotationQuaternion.asArray() : c.rotation && (u.rotation = c.rotation.asArray()), - e.instances.push(u), - b.a.AppendSerializedAnimations(c, u), - u.ranges = c.serializeAnimationRanges() - } - } - b.a.AppendSerializedAnimations(this, e), - e.ranges = this.serializeAnimationRanges(), - e.layerMask = this.layerMask, - e.alphaIndex = this.alphaIndex, - e.hasVertexAlpha = this.hasVertexAlpha, - e.overlayAlpha = this.overlayAlpha, - e.overlayColor = this.overlayColor.asArray(), - e.renderOverlay = this.renderOverlay, - e.applyFog = this.applyFog, - this.actionManager && (e.actions = this.actionManager.serialize(this.name)) - } - , - t.prototype._syncGeometryWithMorphTargetManager = function() { + } + b.a.AppendSerializedAnimations(this, e), + (e.ranges = this.serializeAnimationRanges()), + (e.layerMask = this.layerMask), + (e.alphaIndex = this.alphaIndex), + (e.hasVertexAlpha = this.hasVertexAlpha), + (e.overlayAlpha = this.overlayAlpha), + (e.overlayColor = this.overlayColor.asArray()), + (e.renderOverlay = this.renderOverlay), + (e.applyFog = this.applyFog), + this.actionManager && + (e.actions = this.actionManager.serialize(this.name)); + }), + (t.prototype._syncGeometryWithMorphTargetManager = + function () { if (this.geometry) { - this._markSubMeshesAsAttributesDirty(); - var e = this._internalMeshDataInfo._morphTargetManager; - if (e && e.vertexCount) { - if (e.vertexCount !== this.getTotalVertices()) - return E.a.Error("Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count."), - void (this.morphTargetManager = null); - for (var t = 0; t < e.numInfluencers; t++) { - var i = e.getActiveTarget(t) - , n = i.getPositions(); - if (!n) - return void E.a.Error("Invalid morph target. Target must have positions."); - this.geometry.setVerticesData(l.b.PositionKind + t, n, false, 3); - var r = i.getNormals(); - r && this.geometry.setVerticesData(l.b.NormalKind + t, r, false, 3); - var o = i.getTangents(); - o && this.geometry.setVerticesData(l.b.TangentKind + t, o, false, 3) - } - } else - for (t = 0; this.geometry.isVerticesDataPresent(l.b.PositionKind + t); ) - this.geometry.removeVerticesData(l.b.PositionKind + t), - this.geometry.isVerticesDataPresent(l.b.NormalKind + t) && this.geometry.removeVerticesData(l.b.NormalKind + t), - this.geometry.isVerticesDataPresent(l.b.TangentKind + t) && this.geometry.removeVerticesData(l.b.TangentKind + t), - t++ + this._markSubMeshesAsAttributesDirty(); + var e = + this._internalMeshDataInfo._morphTargetManager; + if (e && e.vertexCount) { + if (e.vertexCount !== this.getTotalVertices()) + return ( + E.a.Error( + "Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count." + ), + void (this.morphTargetManager = null) + ); + for (var t = 0; t < e.numInfluencers; t++) { + var i = e.getActiveTarget(t), + n = i.getPositions(); + if (!n) + return void E.a.Error( + "Invalid morph target. Target must have positions." + ); + this.geometry.setVerticesData( + l.b.PositionKind + t, + n, + false, + 3 + ); + var r = i.getNormals(); + r && + this.geometry.setVerticesData( + l.b.NormalKind + t, + r, + false, + 3 + ); + var o = i.getTangents(); + o && + this.geometry.setVerticesData( + l.b.TangentKind + t, + o, + false, + 3 + ); + } + } else + for ( + t = 0; + this.geometry.isVerticesDataPresent( + l.b.PositionKind + t + ); + + ) + this.geometry.removeVerticesData( + l.b.PositionKind + t + ), + this.geometry.isVerticesDataPresent( + l.b.NormalKind + t + ) && + this.geometry.removeVerticesData( + l.b.NormalKind + t + ), + this.geometry.isVerticesDataPresent( + l.b.TangentKind + t + ) && + this.geometry.removeVerticesData( + l.b.TangentKind + t + ), + t++; } - } - , - t.Parse = function(e, i, n) { - var r; - if ((r = e.type && "GroundMesh" === e.type ? t._GroundMeshParser(e, i) : new t(e.name,i)).id = e.id, + }), + (t.Parse = function (e, i, n) { + var r; + if ( + (((r = + e.type && "GroundMesh" === e.type + ? t._GroundMeshParser(e, i) + : new t(e.name, i)).id = e.id), s.a && s.a.AddTagsTo(r, e.tags), - r.position = c.x.FromArray(e.position), + (r.position = c.x.FromArray(e.position)), void 0 !== e.metadata && (r.metadata = e.metadata), - e.rotationQuaternion ? r.rotationQuaternion = c.q.FromArray(e.rotationQuaternion) : e.rotation && (r.rotation = c.x.FromArray(e.rotation)), - r.scaling = c.x.FromArray(e.scaling), - e.localMatrix ? r.setPreTransformMatrix(c.j.FromArray(e.localMatrix)) : e.pivotMatrix && r.setPivotMatrix(c.j.FromArray(e.pivotMatrix)), + e.rotationQuaternion + ? (r.rotationQuaternion = c.q.FromArray( + e.rotationQuaternion + )) + : e.rotation && + (r.rotation = c.x.FromArray(e.rotation)), + (r.scaling = c.x.FromArray(e.scaling)), + e.localMatrix + ? r.setPreTransformMatrix( + c.j.FromArray(e.localMatrix) + ) + : e.pivotMatrix && + r.setPivotMatrix(c.j.FromArray(e.pivotMatrix)), r.setEnabled(e.isEnabled), - r.isVisible = e.isVisible, - r.infiniteDistance = e.infiniteDistance, - r.showBoundingBox = e.showBoundingBox, - r.showSubMeshesBoundingBox = e.showSubMeshesBoundingBox, + (r.isVisible = e.isVisible), + (r.infiniteDistance = e.infiniteDistance), + (r.showBoundingBox = e.showBoundingBox), + (r.showSubMeshesBoundingBox = + e.showSubMeshesBoundingBox), void 0 !== e.applyFog && (r.applyFog = e.applyFog), void 0 !== e.pickable && (r.isPickable = e.pickable), - void 0 !== e.alphaIndex && (r.alphaIndex = e.alphaIndex), - r.receiveShadows = e.receiveShadows, - r.billboardMode = e.billboardMode, - void 0 !== e.visibility && (r.visibility = e.visibility), - r.checkCollisions = e.checkCollisions, + void 0 !== e.alphaIndex && + (r.alphaIndex = e.alphaIndex), + (r.receiveShadows = e.receiveShadows), + (r.billboardMode = e.billboardMode), + void 0 !== e.visibility && + (r.visibility = e.visibility), + (r.checkCollisions = e.checkCollisions), void 0 !== e.isBlocker && (r.isBlocker = e.isBlocker), - r._shouldGenerateFlatShading = e.useFlatShading, - e.freezeWorldMatrix && (r._waitingData.freezeWorldMatrix = e.freezeWorldMatrix), + (r._shouldGenerateFlatShading = e.useFlatShading), + e.freezeWorldMatrix && + (r._waitingData.freezeWorldMatrix = + e.freezeWorldMatrix), e.parentId && (r._waitingParentId = e.parentId), - void 0 !== e.actions && (r._waitingData.actions = e.actions), - void 0 !== e.overlayAlpha && (r.overlayAlpha = e.overlayAlpha), - void 0 !== e.overlayColor && (r.overlayColor = c.e.FromArray(e.overlayColor)), - void 0 !== e.renderOverlay && (r.renderOverlay = e.renderOverlay), - r.isUnIndexed = !!e.isUnIndexed, - r.hasVertexAlpha = e.hasVertexAlpha, - e.delayLoadingFile ? (r.delayLoadState = y.a.DELAYLOADSTATE_NOTLOADED, - r.delayLoadingFile = n + e.delayLoadingFile, - r._boundingInfo = new m.a(c.x.FromArray(e.boundingBoxMinimum),c.x.FromArray(e.boundingBoxMaximum)), - e._binaryInfo && (r._binaryInfo = e._binaryInfo), - r._delayInfo = [], - e.hasUVs && r._delayInfo.push(l.b.UVKind), - e.hasUVs2 && r._delayInfo.push(l.b.UV2Kind), - e.hasUVs3 && r._delayInfo.push(l.b.UV3Kind), - e.hasUVs4 && r._delayInfo.push(l.b.UV4Kind), - e.hasUVs5 && r._delayInfo.push(l.b.UV5Kind), - e.hasUVs6 && r._delayInfo.push(l.b.UV6Kind), - e.hasColors && r._delayInfo.push(l.b.ColorKind), - e.hasMatricesIndices && r._delayInfo.push(l.b.MatricesIndicesKind), - e.hasMatricesWeights && r._delayInfo.push(l.b.MatricesWeightsKind), - r._delayLoadingFunction = f.a._ImportGeometry, - v.a.ForceFullSceneLoadingForIncremental && r._checkDelayState()) : f.a._ImportGeometry(e, r), - e.materialId ? r.setMaterialByID(e.materialId) : r.material = null, - e.morphTargetManagerId > -1 && (r.morphTargetManager = i.getMorphTargetManagerById(e.morphTargetManagerId)), - e.skeletonId > -1 && (r.skeleton = i.getLastSkeletonByID(e.skeletonId), - e.numBoneInfluencers && (r.numBoneInfluencers = e.numBoneInfluencers)), - e.animations) { - for (var o = 0; o < e.animations.length; o++) { - var a = e.animations[o]; - (g = T.a.GetClass("BABYLON.Animation")) && r.animations.push(g.Parse(a)) - } - u.a.ParseAnimationRanges(r, e, i) + void 0 !== e.actions && + (r._waitingData.actions = e.actions), + void 0 !== e.overlayAlpha && + (r.overlayAlpha = e.overlayAlpha), + void 0 !== e.overlayColor && + (r.overlayColor = c.e.FromArray(e.overlayColor)), + void 0 !== e.renderOverlay && + (r.renderOverlay = e.renderOverlay), + (r.isUnIndexed = !!e.isUnIndexed), + (r.hasVertexAlpha = e.hasVertexAlpha), + e.delayLoadingFile + ? ((r.delayLoadState = y.a.DELAYLOADSTATE_NOTLOADED), + (r.delayLoadingFile = n + e.delayLoadingFile), + (r._boundingInfo = new m.a( + c.x.FromArray(e.boundingBoxMinimum), + c.x.FromArray(e.boundingBoxMaximum) + )), + e._binaryInfo && (r._binaryInfo = e._binaryInfo), + (r._delayInfo = []), + e.hasUVs && r._delayInfo.push(l.b.UVKind), + e.hasUVs2 && r._delayInfo.push(l.b.UV2Kind), + e.hasUVs3 && r._delayInfo.push(l.b.UV3Kind), + e.hasUVs4 && r._delayInfo.push(l.b.UV4Kind), + e.hasUVs5 && r._delayInfo.push(l.b.UV5Kind), + e.hasUVs6 && r._delayInfo.push(l.b.UV6Kind), + e.hasColors && r._delayInfo.push(l.b.ColorKind), + e.hasMatricesIndices && + r._delayInfo.push(l.b.MatricesIndicesKind), + e.hasMatricesWeights && + r._delayInfo.push(l.b.MatricesWeightsKind), + (r._delayLoadingFunction = f.a._ImportGeometry), + v.a.ForceFullSceneLoadingForIncremental && + r._checkDelayState()) + : f.a._ImportGeometry(e, r), + e.materialId + ? r.setMaterialByID(e.materialId) + : (r.material = null), + e.morphTargetManagerId > -1 && + (r.morphTargetManager = i.getMorphTargetManagerById( + e.morphTargetManagerId + )), + e.skeletonId > -1 && + ((r.skeleton = i.getLastSkeletonByID(e.skeletonId)), + e.numBoneInfluencers && + (r.numBoneInfluencers = e.numBoneInfluencers)), + e.animations) + ) { + for (var o = 0; o < e.animations.length; o++) { + var a = e.animations[o]; + (g = T.a.GetClass("BABYLON.Animation")) && + r.animations.push(g.Parse(a)); } - if (e.autoAnimate && i.beginAnimation(r, e.autoAnimateFrom, e.autoAnimateTo, e.autoAnimateLoop, e.autoAnimateSpeed || 1), - e.layerMask && !isNaN(e.layerMask) ? r.layerMask = Math.abs(parseInt(e.layerMask)) : r.layerMask = 268435455, + u.a.ParseAnimationRanges(r, e, i); + } + if ( + (e.autoAnimate && + i.beginAnimation( + r, + e.autoAnimateFrom, + e.autoAnimateTo, + e.autoAnimateLoop, + e.autoAnimateSpeed || 1 + ), + e.layerMask && !isNaN(e.layerMask) + ? (r.layerMask = Math.abs(parseInt(e.layerMask))) + : (r.layerMask = 268435455), e.physicsImpostor && t._PhysicsImpostorParser(i, r, e), - e.lodMeshIds && (r._waitingData.lods = { + e.lodMeshIds && + (r._waitingData.lods = { ids: e.lodMeshIds, distances: e.lodDistances ? e.lodDistances : null, - coverages: e.lodCoverages ? e.lodCoverages : null - }), + coverages: e.lodCoverages ? e.lodCoverages : null, + }), e.instances) - for (var h = 0; h < e.instances.length; h++) { - var d = e.instances[h] - , p = r.createInstance(d.name); - if (d.id && (p.id = d.id), - s.a && (d.tags ? s.a.AddTagsTo(p, d.tags) : s.a.AddTagsTo(p, e.tags)), - p.position = c.x.FromArray(d.position), - void 0 !== d.metadata && (p.metadata = d.metadata), - d.parentId && (p._waitingParentId = d.parentId), - d.rotationQuaternion ? p.rotationQuaternion = c.q.FromArray(d.rotationQuaternion) : d.rotation && (p.rotation = c.x.FromArray(d.rotation)), - p.scaling = c.x.FromArray(d.scaling), - null != d.checkCollisions && null != d.checkCollisions && (p.checkCollisions = d.checkCollisions), - null != d.pickable && null != d.pickable && (p.isPickable = d.pickable), - null != d.showBoundingBox && null != d.showBoundingBox && (p.showBoundingBox = d.showBoundingBox), - null != d.showSubMeshesBoundingBox && null != d.showSubMeshesBoundingBox && (p.showSubMeshesBoundingBox = d.showSubMeshesBoundingBox), - null != d.alphaIndex && null != d.showSubMeshesBoundingBox && (p.alphaIndex = d.alphaIndex), - d.physicsImpostor && t._PhysicsImpostorParser(i, p, d), - d.animations) { - for (o = 0; o < d.animations.length; o++) { - var g; - a = d.animations[o], - (g = T.a.GetClass("BABYLON.Animation")) && p.animations.push(g.Parse(a)) - } - u.a.ParseAnimationRanges(p, d, i), - d.autoAnimate && i.beginAnimation(p, d.autoAnimateFrom, d.autoAnimateTo, d.autoAnimateLoop, d.autoAnimateSpeed || 1) - } + ) + for (var h = 0; h < e.instances.length; h++) { + var d = e.instances[h], + p = r.createInstance(d.name); + if ( + (d.id && (p.id = d.id), + s.a && + (d.tags + ? s.a.AddTagsTo(p, d.tags) + : s.a.AddTagsTo(p, e.tags)), + (p.position = c.x.FromArray(d.position)), + void 0 !== d.metadata && (p.metadata = d.metadata), + d.parentId && (p._waitingParentId = d.parentId), + d.rotationQuaternion + ? (p.rotationQuaternion = c.q.FromArray( + d.rotationQuaternion + )) + : d.rotation && + (p.rotation = c.x.FromArray(d.rotation)), + (p.scaling = c.x.FromArray(d.scaling)), + null != d.checkCollisions && + null != d.checkCollisions && + (p.checkCollisions = d.checkCollisions), + null != d.pickable && + null != d.pickable && + (p.isPickable = d.pickable), + null != d.showBoundingBox && + null != d.showBoundingBox && + (p.showBoundingBox = d.showBoundingBox), + null != d.showSubMeshesBoundingBox && + null != d.showSubMeshesBoundingBox && + (p.showSubMeshesBoundingBox = + d.showSubMeshesBoundingBox), + null != d.alphaIndex && + null != d.showSubMeshesBoundingBox && + (p.alphaIndex = d.alphaIndex), + d.physicsImpostor && + t._PhysicsImpostorParser(i, p, d), + d.animations) + ) { + for (o = 0; o < d.animations.length; o++) { + var g; + (a = d.animations[o]), + (g = T.a.GetClass("BABYLON.Animation")) && + p.animations.push(g.Parse(a)); } - return r - } - , - t.CreateRibbon = function(e, t, i, n, r, o, a, s, c) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateDisc = function(e, t, i, n, r, o) { - throw void 0 === n && (n = null), - A.a.WarnImport("MeshBuilder") - } - , - t.CreateBox = function(e, t, i, n, r) { - throw void 0 === i && (i = null), - A.a.WarnImport("MeshBuilder") - } - , - t.CreateSphere = function(e, t, i, n, r, o) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateHemisphere = function(e, t, i, n) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateCylinder = function(e, t, i, n, r, o, a, s, c) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateTorus = function(e, t, i, n, r, o, a) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateTorusKnot = function(e, t, i, n, r, o, a, s, c, u) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateLines = function(e, t, i, n, r) { - throw void 0 === i && (i = null), + u.a.ParseAnimationRanges(p, d, i), + d.autoAnimate && + i.beginAnimation( + p, + d.autoAnimateFrom, + d.autoAnimateTo, + d.autoAnimateLoop, + d.autoAnimateSpeed || 1 + ); + } + } + return r; + }), + (t.CreateRibbon = function (e, t, i, n, r, o, a, s, c) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateDisc = function (e, t, i, n, r, o) { + throw ( + (void 0 === n && (n = null), + A.a.WarnImport("MeshBuilder")) + ); + }), + (t.CreateBox = function (e, t, i, n, r) { + throw ( + (void 0 === i && (i = null), + A.a.WarnImport("MeshBuilder")) + ); + }), + (t.CreateSphere = function (e, t, i, n, r, o) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateHemisphere = function (e, t, i, n) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateCylinder = function (e, t, i, n, r, o, a, s, c) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateTorus = function (e, t, i, n, r, o, a) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateTorusKnot = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u + ) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateLines = function (e, t, i, n, r) { + throw ( + (void 0 === i && (i = null), void 0 === n && (n = false), void 0 === r && (r = null), - A.a.WarnImport("MeshBuilder") - } - , - t.CreateDashedLines = function(e, t, i, n, r, o, a, s) { - throw void 0 === o && (o = null), - A.a.WarnImport("MeshBuilder") - } - , - t.CreatePolygon = function(e, t, i, n, r, o, a) { - throw void 0 === a && (a = earcut), - A.a.WarnImport("MeshBuilder") - } - , - t.ExtrudePolygon = function(e, t, i, n, r, o, a, s) { - throw void 0 === s && (s = earcut), - A.a.WarnImport("MeshBuilder") - } - , - t.ExtrudeShape = function(e, t, i, n, r, o, a, s, c, u) { - throw void 0 === a && (a = null), - A.a.WarnImport("MeshBuilder") - } - , - t.ExtrudeShapeCustom = function(e, t, i, n, r, o, a, s, c, u, l, h) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateLathe = function(e, t, i, n, r, o, a) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreatePlane = function(e, t, i, n, r) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateGround = function(e, t, i, n, r, o) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateTiledGround = function(e, t, i, n, r, o, a, s, c) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateGroundFromHeightMap = function(e, t, i, n, r, o, a, s, c, u, l) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateTube = function(e, t, i, n, r, o, a, s, c, u) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreatePolyhedron = function(e, t, i) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateIcoSphere = function(e, t, i) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.CreateDecal = function(e, t, i, n, r, o) { - throw A.a.WarnImport("MeshBuilder") - } - , - t.prototype.setPositionsForCPUSkinning = function() { - var e = this._internalMeshDataInfo; - if (!e._sourcePositions) { - var t = this.getVerticesData(l.b.PositionKind); - if (!t) - return e._sourcePositions; - e._sourcePositions = new Float32Array(t), - this.isVertexBufferUpdatable(l.b.PositionKind) || this.setVerticesData(l.b.PositionKind, t, true) - } - return e._sourcePositions - } - , - t.prototype.setNormalsForCPUSkinning = function() { - var e = this._internalMeshDataInfo; - if (!e._sourceNormals) { - var t = this.getVerticesData(l.b.NormalKind); - if (!t) - return e._sourceNormals; - e._sourceNormals = new Float32Array(t), - this.isVertexBufferUpdatable(l.b.NormalKind) || this.setVerticesData(l.b.NormalKind, t, true) - } - return e._sourceNormals - } - , - t.prototype.applySkeleton = function(e) { - if (!this.geometry) - return this; - if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId()) - return this; - if (this.geometry._softwareSkinningFrameId = this.getScene().getFrameId(), + A.a.WarnImport("MeshBuilder")) + ); + }), + (t.CreateDashedLines = function (e, t, i, n, r, o, a, s) { + throw ( + (void 0 === o && (o = null), + A.a.WarnImport("MeshBuilder")) + ); + }), + (t.CreatePolygon = function (e, t, i, n, r, o, a) { + throw ( + (void 0 === a && (a = earcut), + A.a.WarnImport("MeshBuilder")) + ); + }), + (t.ExtrudePolygon = function (e, t, i, n, r, o, a, s) { + throw ( + (void 0 === s && (s = earcut), + A.a.WarnImport("MeshBuilder")) + ); + }), + (t.ExtrudeShape = function (e, t, i, n, r, o, a, s, c, u) { + throw ( + (void 0 === a && (a = null), + A.a.WarnImport("MeshBuilder")) + ); + }), + (t.ExtrudeShapeCustom = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u, + l, + h + ) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateLathe = function (e, t, i, n, r, o, a) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreatePlane = function (e, t, i, n, r) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateGround = function (e, t, i, n, r, o) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateTiledGround = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateGroundFromHeightMap = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u, + l + ) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateTube = function (e, t, i, n, r, o, a, s, c, u) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreatePolyhedron = function (e, t, i) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateIcoSphere = function (e, t, i) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.CreateDecal = function (e, t, i, n, r, o) { + throw A.a.WarnImport("MeshBuilder"); + }), + (t.prototype.setPositionsForCPUSkinning = function () { + var e = this._internalMeshDataInfo; + if (!e._sourcePositions) { + var t = this.getVerticesData(l.b.PositionKind); + if (!t) return e._sourcePositions; + (e._sourcePositions = new Float32Array(t)), + this.isVertexBufferUpdatable(l.b.PositionKind) || + this.setVerticesData(l.b.PositionKind, t, true); + } + return e._sourcePositions; + }), + (t.prototype.setNormalsForCPUSkinning = function () { + var e = this._internalMeshDataInfo; + if (!e._sourceNormals) { + var t = this.getVerticesData(l.b.NormalKind); + if (!t) return e._sourceNormals; + (e._sourceNormals = new Float32Array(t)), + this.isVertexBufferUpdatable(l.b.NormalKind) || + this.setVerticesData(l.b.NormalKind, t, true); + } + return e._sourceNormals; + }), + (t.prototype.applySkeleton = function (e) { + if (!this.geometry) return this; + if ( + this.geometry._softwareSkinningFrameId == + this.getScene().getFrameId() + ) + return this; + if ( + ((this.geometry._softwareSkinningFrameId = + this.getScene().getFrameId()), !this.isVerticesDataPresent(l.b.PositionKind)) - return this; - if (!this.isVerticesDataPresent(l.b.NormalKind)) - return this; - if (!this.isVerticesDataPresent(l.b.MatricesIndicesKind)) - return this; - if (!this.isVerticesDataPresent(l.b.MatricesWeightsKind)) - return this; - var t = this._internalMeshDataInfo; - if (!t._sourcePositions) { - var i = this.subMeshes.slice(); - this.setPositionsForCPUSkinning(), - this.subMeshes = i - } - t._sourceNormals || this.setNormalsForCPUSkinning(); - var n = this.getVerticesData(l.b.PositionKind); - if (!n) - return this; - n instanceof Float32Array || (n = new Float32Array(n)); - var r = this.getVerticesData(l.b.NormalKind); - if (!r) - return this; - r instanceof Float32Array || (r = new Float32Array(r)); - var o = this.getVerticesData(l.b.MatricesIndicesKind) - , a = this.getVerticesData(l.b.MatricesWeightsKind); - if (!a || !o) - return this; - for (var s, u = this.numBoneInfluencers > 4, h = u ? this.getVerticesData(l.b.MatricesIndicesExtraKind) : null, f = u ? this.getVerticesData(l.b.MatricesWeightsExtraKind) : null, d = e.getTransformMatrices(this), p = c.x.Zero(), m = new c.j, g = new c.j, _ = 0, v = 0; v < n.length; v += 3, - _ += 4) { - var y; - for (s = 0; s < 4; s++) - (y = a[_ + s]) > 0 && (c.j.FromFloat32ArrayToRefScaled(d, Math.floor(16 * o[_ + s]), y, g), - m.addToSelf(g)); - if (u) - for (s = 0; s < 4; s++) - (y = f[_ + s]) > 0 && (c.j.FromFloat32ArrayToRefScaled(d, Math.floor(16 * h[_ + s]), y, g), - m.addToSelf(g)); - c.x.TransformCoordinatesFromFloatsToRef(t._sourcePositions[v], t._sourcePositions[v + 1], t._sourcePositions[v + 2], m, p), - p.toArray(n, v), - c.x.TransformNormalFromFloatsToRef(t._sourceNormals[v], t._sourceNormals[v + 1], t._sourceNormals[v + 2], m, p), - p.toArray(r, v), - m.reset() - } - return this.updateVerticesData(l.b.PositionKind, n), + ) + return this; + if (!this.isVerticesDataPresent(l.b.NormalKind)) + return this; + if (!this.isVerticesDataPresent(l.b.MatricesIndicesKind)) + return this; + if (!this.isVerticesDataPresent(l.b.MatricesWeightsKind)) + return this; + var t = this._internalMeshDataInfo; + if (!t._sourcePositions) { + var i = this.subMeshes.slice(); + this.setPositionsForCPUSkinning(), (this.subMeshes = i); + } + t._sourceNormals || this.setNormalsForCPUSkinning(); + var n = this.getVerticesData(l.b.PositionKind); + if (!n) return this; + n instanceof Float32Array || (n = new Float32Array(n)); + var r = this.getVerticesData(l.b.NormalKind); + if (!r) return this; + r instanceof Float32Array || (r = new Float32Array(r)); + var o = this.getVerticesData(l.b.MatricesIndicesKind), + a = this.getVerticesData(l.b.MatricesWeightsKind); + if (!a || !o) return this; + for ( + var s, + u = this.numBoneInfluencers > 4, + h = u + ? this.getVerticesData(l.b.MatricesIndicesExtraKind) + : null, + f = u + ? this.getVerticesData(l.b.MatricesWeightsExtraKind) + : null, + d = e.getTransformMatrices(this), + p = c.x.Zero(), + m = new c.j(), + g = new c.j(), + _ = 0, + v = 0; + v < n.length; + v += 3, _ += 4 + ) { + var y; + for (s = 0; s < 4; s++) + (y = a[_ + s]) > 0 && + (c.j.FromFloat32ArrayToRefScaled( + d, + Math.floor(16 * o[_ + s]), + y, + g + ), + m.addToSelf(g)); + if (u) + for (s = 0; s < 4; s++) + (y = f[_ + s]) > 0 && + (c.j.FromFloat32ArrayToRefScaled( + d, + Math.floor(16 * h[_ + s]), + y, + g + ), + m.addToSelf(g)); + c.x.TransformCoordinatesFromFloatsToRef( + t._sourcePositions[v], + t._sourcePositions[v + 1], + t._sourcePositions[v + 2], + m, + p + ), + p.toArray(n, v), + c.x.TransformNormalFromFloatsToRef( + t._sourceNormals[v], + t._sourceNormals[v + 1], + t._sourceNormals[v + 2], + m, + p + ), + p.toArray(r, v), + m.reset(); + } + return ( + this.updateVerticesData(l.b.PositionKind, n), this.updateVerticesData(l.b.NormalKind, r), this - } - , - t.MinMax = function(e) { - var t = null - , i = null; - return e.forEach(function(e) { - var n = e.getBoundingInfo().boundingBox; - t && i ? (t.minimizeInPlace(n.minimumWorld), - i.maximizeInPlace(n.maximumWorld)) : (t = n.minimumWorld, - i = n.maximumWorld) + ); + }), + (t.MinMax = function (e) { + var t = null, + i = null; + return ( + e.forEach(function (e) { + var n = e.getBoundingInfo().boundingBox; + t && i + ? (t.minimizeInPlace(n.minimumWorld), + i.maximizeInPlace(n.maximumWorld)) + : ((t = n.minimumWorld), (i = n.maximumWorld)); }), - t && i ? { - min: t, - max: i - } : { - min: c.x.Zero(), - max: c.x.Zero() - } - } - , - t.Center = function(e) { - var i = e instanceof Array ? t.MinMax(e) : e; - return c.x.Center(i.min, i.max) - } - , - t.MergeMeshes = function(e, i, n, r, o, a) { - var s; - if (void 0 === i && (i = true), - !n) { - var c = 0; - for (s = 0; s < e.length; s++) - if (e[s] && (c += e[s].getTotalVertices()) > 65536) - return E.a.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"), - null - } - if (a) { - var u, l, f = null; - o = false - } - var d, m = new Array, g = new Array, v = null, y = new Array, b = null; + t && i + ? { + min: t, + max: i, + } + : { + min: c.x.Zero(), + max: c.x.Zero(), + } + ); + }), + (t.Center = function (e) { + var i = e instanceof Array ? t.MinMax(e) : e; + return c.x.Center(i.min, i.max); + }), + (t.MergeMeshes = function (e, i, n, r, o, a) { + var s; + if ((void 0 === i && (i = true), !n)) { + var c = 0; for (s = 0; s < e.length; s++) - if (e[s]) { - var T = e[s]; - if (T.isAnInstance) - return E.a.Warn("Cannot merge instance meshes."), - null; - var A = T.computeWorldMatrix(true); - if ((d = h.a.ExtractFromMesh(T, true, true)).transform(A), - v ? v.merge(d, n) : (v = d, - b = T), - o && y.push(T.getTotalIndices()), - a) - if (T.material) { - var x = T.material; - if (x instanceof _.a) { - for (l = 0; l < x.subMaterials.length; l++) - m.indexOf(x.subMaterials[l]) < 0 && m.push(x.subMaterials[l]); - for (u = 0; u < T.subMeshes.length; u++) - g.push(m.indexOf(x.subMaterials[T.subMeshes[u].materialIndex])), - y.push(T.subMeshes[u].indexCount) - } else - for (m.indexOf(x) < 0 && m.push(x), - u = 0; u < T.subMeshes.length; u++) - g.push(m.indexOf(x)), - y.push(T.subMeshes[u].indexCount) - } else - for (u = 0; u < T.subMeshes.length; u++) - g.push(0), - y.push(T.subMeshes[u].indexCount) - } - if (b = b, - r || (r = new t(b.name + "_merged",b.getScene())), + if (e[s] && (c += e[s].getTotalVertices()) > 65536) + return ( + E.a.Warn( + "Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices" + ), + null + ); + } + if (a) { + var u, + l, + f = null; + o = false; + } + var d, + m = new Array(), + g = new Array(), + v = null, + y = new Array(), + b = null; + for (s = 0; s < e.length; s++) + if (e[s]) { + var T = e[s]; + if (T.isAnInstance) + return ( + E.a.Warn("Cannot merge instance meshes."), null + ); + var A = T.computeWorldMatrix(true); + if ( + ((d = h.a.ExtractFromMesh(T, true, true)).transform( + A + ), + v ? v.merge(d, n) : ((v = d), (b = T)), + o && y.push(T.getTotalIndices()), + a) + ) + if (T.material) { + var x = T.material; + if (x instanceof _.a) { + for (l = 0; l < x.subMaterials.length; l++) + m.indexOf(x.subMaterials[l]) < 0 && + m.push(x.subMaterials[l]); + for (u = 0; u < T.subMeshes.length; u++) + g.push( + m.indexOf( + x.subMaterials[ + T.subMeshes[u].materialIndex + ] + ) + ), + y.push(T.subMeshes[u].indexCount); + } else + for ( + m.indexOf(x) < 0 && m.push(x), u = 0; + u < T.subMeshes.length; + u++ + ) + g.push(m.indexOf(x)), + y.push(T.subMeshes[u].indexCount); + } else + for (u = 0; u < T.subMeshes.length; u++) + g.push(0), y.push(T.subMeshes[u].indexCount); + } + if ( + ((b = b), + r || (r = new t(b.name + "_merged", b.getScene())), v.applyToMesh(r), - r.checkCollisions = b.checkCollisions, + (r.checkCollisions = b.checkCollisions), i) - for (s = 0; s < e.length; s++) - e[s] && e[s].dispose(); - if (o || a) { - r.releaseSubMeshes(), - s = 0; - for (var S = 0; s < y.length; ) - p.b.CreateFromIndices(0, S, y[s], r), - S += y[s], - s++ + ) + for (s = 0; s < e.length; s++) e[s] && e[s].dispose(); + if (o || a) { + r.releaseSubMeshes(), (s = 0); + for (var S = 0; s < y.length; ) + p.b.CreateFromIndices(0, S, y[s], r), + (S += y[s]), + s++; + } + if (a) { + for ( + (f = new _.a( + b.name + "_merged", + b.getScene() + )).subMaterials = m, + u = 0; + u < r.subMeshes.length; + u++ + ) + r.subMeshes[u].materialIndex = g[u]; + r.material = f; + } else r.material = b.material; + return r; + }), + (t.prototype.addInstance = function (e) { + (e._indexInSourceMeshInstanceArray = + this.instances.length), + this.instances.push(e); + }), + (t.prototype.removeInstance = function (e) { + var t = e._indexInSourceMeshInstanceArray; + if (-1 != t) { + if (t !== this.instances.length - 1) { + var i = this.instances[this.instances.length - 1]; + (this.instances[t] = i), + (i._indexInSourceMeshInstanceArray = t); } - if (a) { - for ((f = new _.a(b.name + "_merged",b.getScene())).subMaterials = m, - u = 0; u < r.subMeshes.length; u++) - r.subMeshes[u].materialIndex = g[u]; - r.material = f - } else - r.material = b.material; - return r - } - , - t.prototype.addInstance = function(e) { - e._indexInSourceMeshInstanceArray = this.instances.length, - this.instances.push(e) - } - , - t.prototype.removeInstance = function(e) { - var t = e._indexInSourceMeshInstanceArray; - if (-1 != t) { - if (t !== this.instances.length - 1) { - var i = this.instances[this.instances.length - 1]; - this.instances[t] = i, - i._indexInSourceMeshInstanceArray = t - } - e._indexInSourceMeshInstanceArray = -1, - this.instances.pop() - } - } - , - t.FRONTSIDE = h.a.FRONTSIDE, - t.BACKSIDE = h.a.BACKSIDE, - t.DOUBLESIDE = h.a.DOUBLESIDE, - t.DEFAULTSIDE = h.a.DEFAULTSIDE, - t.NO_CAP = 0, - t.CAP_START = 1, - t.CAP_END = 2, - t.CAP_ALL = 3, - t._GroundMeshParser = function(e, t) { - throw A.a.WarnImport("GroundMesh") - } - , + (e._indexInSourceMeshInstanceArray = -1), + this.instances.pop(); + } + }), + (t.FRONTSIDE = h.a.FRONTSIDE), + (t.BACKSIDE = h.a.BACKSIDE), + (t.DOUBLESIDE = h.a.DOUBLESIDE), + (t.DEFAULTSIDE = h.a.DEFAULTSIDE), + (t.NO_CAP = 0), + (t.CAP_START = 1), + (t.CAP_END = 2), + (t.CAP_ALL = 3), + (t._GroundMeshParser = function (e, t) { + throw A.a.WarnImport("GroundMesh"); + }), t - }(d.a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return e.WithinEpsilon = function(e, t, i) { - void 0 === i && (i = 1.401298e-45); - var n = e - t; - return -i <= n && n <= i - } - , - e.ToHex = function(e) { - var t = e.toString(16); - return e <= 15 ? ("0" + t).toUpperCase() : t.toUpperCase() - } - , - e.Sign = function(e) { - return 0 == (e = +e) || isNaN(e) ? e : e > 0 ? 1 : -1 - } - , - e.Clamp = function(e, t, i) { - return void 0 === t && (t = 0), - void 0 === i && (i = 1), - Math.min(i, Math.max(t, e)) - } - , - e.Log2 = function(e) { - return Math.log(e) * Math.LOG2E - } - , - e.Repeat = function(e, t) { - return e - Math.floor(e / t) * t - } - , - e.Normalize = function(e, t, i) { - return (e - t) / (i - t) - } - , - e.Denormalize = function(e, t, i) { - return e * (i - t) + t - } - , - e.DeltaAngle = function(t, i) { - var n = e.Repeat(i - t, 360); - return n > 180 && (n -= 360), - n - } - , - e.PingPong = function(t, i) { - var n = e.Repeat(t, 2 * i); - return i - Math.abs(n - i) - } - , - e.SmoothStep = function(t, i, n) { - var r = e.Clamp(n); - return i * (r = -2 * r * r * r + 3 * r * r) + t * (1 - r) - } - , - e.MoveTowards = function(t, i, n) { - return Math.abs(i - t) <= n ? i : t + e.Sign(i - t) * n - } - , - e.MoveTowardsAngle = function(t, i, n) { - var r = e.DeltaAngle(t, i) - , o = 0; - return -n < r && r < n ? o = i : (i = t + r, - o = e.MoveTowards(t, i, n)), - o - } - , - e.Lerp = function(e, t, i) { - return e + (t - e) * i - } - , - e.LerpAngle = function(t, i, n) { - var r = e.Repeat(i - t, 360); - return r > 180 && (r -= 360), - t + r * e.Clamp(n) - } - , - e.InverseLerp = function(t, i, n) { - return t != i ? e.Clamp((n - t) / (i - t)) : 0 - } - , - e.Hermite = function(e, t, i, n, r) { - var o = r * r - , a = r * o; - return e * (2 * a - 3 * o + 1) + i * (-2 * a + 3 * o) + t * (a - 2 * o + r) + n * (a - o) - } - , - e.RandomRange = function(e, t) { - return e === t ? e : Math.random() * (t - e) + e - } - , - e.RangeToPercent = function(e, t, i) { - return (e - t) / (i - t) - } - , - e.PercentToRange = function(e, t, i) { - return (i - t) * e + t - } - , - e.NormalizeRadians = function(t) { - return t - e.TwoPi * Math.floor((t + Math.PI) / e.TwoPi) - } - , - e.TwoPi = 2 * Math.PI, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return a - }); - var n = i(0) - , r = i(4) - , o = i(19) - , a = function() { - function e() {} - return e.prototype.set = function(e, t) { - switch (t) { + ); + })(d.a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + (e.WithinEpsilon = function (e, t, i) { + void 0 === i && (i = 1.401298e-45); + var n = e - t; + return -i <= n && n <= i; + }), + (e.ToHex = function (e) { + var t = e.toString(16); + return e <= 15 ? ("0" + t).toUpperCase() : t.toUpperCase(); + }), + (e.Sign = function (e) { + return 0 == (e = +e) || isNaN(e) ? e : e > 0 ? 1 : -1; + }), + (e.Clamp = function (e, t, i) { + return ( + void 0 === t && (t = 0), + void 0 === i && (i = 1), + Math.min(i, Math.max(t, e)) + ); + }), + (e.Log2 = function (e) { + return Math.log(e) * Math.LOG2E; + }), + (e.Repeat = function (e, t) { + return e - Math.floor(e / t) * t; + }), + (e.Normalize = function (e, t, i) { + return (e - t) / (i - t); + }), + (e.Denormalize = function (e, t, i) { + return e * (i - t) + t; + }), + (e.DeltaAngle = function (t, i) { + var n = e.Repeat(i - t, 360); + return n > 180 && (n -= 360), n; + }), + (e.PingPong = function (t, i) { + var n = e.Repeat(t, 2 * i); + return i - Math.abs(n - i); + }), + (e.SmoothStep = function (t, i, n) { + var r = e.Clamp(n); + return i * (r = -2 * r * r * r + 3 * r * r) + t * (1 - r); + }), + (e.MoveTowards = function (t, i, n) { + return Math.abs(i - t) <= n ? i : t + e.Sign(i - t) * n; + }), + (e.MoveTowardsAngle = function (t, i, n) { + var r = e.DeltaAngle(t, i), + o = 0; + return ( + -n < r && r < n + ? (o = i) + : ((i = t + r), (o = e.MoveTowards(t, i, n))), + o + ); + }), + (e.Lerp = function (e, t, i) { + return e + (t - e) * i; + }), + (e.LerpAngle = function (t, i, n) { + var r = e.Repeat(i - t, 360); + return r > 180 && (r -= 360), t + r * e.Clamp(n); + }), + (e.InverseLerp = function (t, i, n) { + return t != i ? e.Clamp((n - t) / (i - t)) : 0; + }), + (e.Hermite = function (e, t, i, n, r) { + var o = r * r, + a = r * o; + return ( + e * (2 * a - 3 * o + 1) + + i * (-2 * a + 3 * o) + + t * (a - 2 * o + r) + + n * (a - o) + ); + }), + (e.RandomRange = function (e, t) { + return e === t ? e : Math.random() * (t - e) + e; + }), + (e.RangeToPercent = function (e, t, i) { + return (e - t) / (i - t); + }), + (e.PercentToRange = function (e, t, i) { + return (i - t) * e + t; + }), + (e.NormalizeRadians = function (t) { + return t - e.TwoPi * Math.floor((t + Math.PI) / e.TwoPi); + }), + (e.TwoPi = 2 * Math.PI), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return a; + }); + var n = i(0), + r = i(4), + o = i(19), + a = (function () { + function e() {} + return ( + (e.prototype.set = function (e, t) { + switch (t) { case r.b.PositionKind: - this.positions = e; - break; + this.positions = e; + break; case r.b.NormalKind: - this.normals = e; - break; + this.normals = e; + break; case r.b.TangentKind: - this.tangents = e; - break; + this.tangents = e; + break; case r.b.UVKind: - this.uvs = e; - break; + this.uvs = e; + break; case r.b.UV2Kind: - this.uvs2 = e; - break; + this.uvs2 = e; + break; case r.b.UV3Kind: - this.uvs3 = e; - break; + this.uvs3 = e; + break; case r.b.UV4Kind: - this.uvs4 = e; - break; + this.uvs4 = e; + break; case r.b.UV5Kind: - this.uvs5 = e; - break; + this.uvs5 = e; + break; case r.b.UV6Kind: - this.uvs6 = e; - break; + this.uvs6 = e; + break; case r.b.ColorKind: - this.colors = e; - break; + this.colors = e; + break; case r.b.MatricesIndicesKind: - this.matricesIndices = e; - break; + this.matricesIndices = e; + break; case r.b.MatricesWeightsKind: - this.matricesWeights = e; - break; + this.matricesWeights = e; + break; case r.b.MatricesIndicesExtraKind: - this.matricesIndicesExtra = e; - break; + this.matricesIndicesExtra = e; + break; case r.b.MatricesWeightsExtraKind: - this.matricesWeightsExtra = e - } - } - , - e.prototype.applyToMesh = function(e, t) { - return this._applyTo(e, t), - this - } - , - e.prototype.applyToGeometry = function(e, t) { - return this._applyTo(e, t), - this - } - , - e.prototype.updateMesh = function(e) { - return this._update(e), - this - } - , - e.prototype.updateGeometry = function(e) { - return this._update(e), - this - } - , - e.prototype._applyTo = function(e, t) { - return void 0 === t && (t = false), - this.positions && e.setVerticesData(r.b.PositionKind, this.positions, t), - this.normals && e.setVerticesData(r.b.NormalKind, this.normals, t), - this.tangents && e.setVerticesData(r.b.TangentKind, this.tangents, t), + this.matricesWeightsExtra = e; + } + }), + (e.prototype.applyToMesh = function (e, t) { + return this._applyTo(e, t), this; + }), + (e.prototype.applyToGeometry = function (e, t) { + return this._applyTo(e, t), this; + }), + (e.prototype.updateMesh = function (e) { + return this._update(e), this; + }), + (e.prototype.updateGeometry = function (e) { + return this._update(e), this; + }), + (e.prototype._applyTo = function (e, t) { + return ( + void 0 === t && (t = false), + this.positions && + e.setVerticesData( + r.b.PositionKind, + this.positions, + t + ), + this.normals && + e.setVerticesData(r.b.NormalKind, this.normals, t), + this.tangents && + e.setVerticesData(r.b.TangentKind, this.tangents, t), this.uvs && e.setVerticesData(r.b.UVKind, this.uvs, t), - this.uvs2 && e.setVerticesData(r.b.UV2Kind, this.uvs2, t), - this.uvs3 && e.setVerticesData(r.b.UV3Kind, this.uvs3, t), - this.uvs4 && e.setVerticesData(r.b.UV4Kind, this.uvs4, t), - this.uvs5 && e.setVerticesData(r.b.UV5Kind, this.uvs5, t), - this.uvs6 && e.setVerticesData(r.b.UV6Kind, this.uvs6, t), - this.colors && e.setVerticesData(r.b.ColorKind, this.colors, t), - this.matricesIndices && e.setVerticesData(r.b.MatricesIndicesKind, this.matricesIndices, t), - this.matricesWeights && e.setVerticesData(r.b.MatricesWeightsKind, this.matricesWeights, t), - this.matricesIndicesExtra && e.setVerticesData(r.b.MatricesIndicesExtraKind, this.matricesIndicesExtra, t), - this.matricesWeightsExtra && e.setVerticesData(r.b.MatricesWeightsExtraKind, this.matricesWeightsExtra, t), - this.indices ? e.setIndices(this.indices, null, t) : e.setIndices([], null), + this.uvs2 && + e.setVerticesData(r.b.UV2Kind, this.uvs2, t), + this.uvs3 && + e.setVerticesData(r.b.UV3Kind, this.uvs3, t), + this.uvs4 && + e.setVerticesData(r.b.UV4Kind, this.uvs4, t), + this.uvs5 && + e.setVerticesData(r.b.UV5Kind, this.uvs5, t), + this.uvs6 && + e.setVerticesData(r.b.UV6Kind, this.uvs6, t), + this.colors && + e.setVerticesData(r.b.ColorKind, this.colors, t), + this.matricesIndices && + e.setVerticesData( + r.b.MatricesIndicesKind, + this.matricesIndices, + t + ), + this.matricesWeights && + e.setVerticesData( + r.b.MatricesWeightsKind, + this.matricesWeights, + t + ), + this.matricesIndicesExtra && + e.setVerticesData( + r.b.MatricesIndicesExtraKind, + this.matricesIndicesExtra, + t + ), + this.matricesWeightsExtra && + e.setVerticesData( + r.b.MatricesWeightsExtraKind, + this.matricesWeightsExtra, + t + ), + this.indices + ? e.setIndices(this.indices, null, t) + : e.setIndices([], null), this - } - , - e.prototype._update = function(e, t, i) { - return this.positions && e.updateVerticesData(r.b.PositionKind, this.positions, t, i), - this.normals && e.updateVerticesData(r.b.NormalKind, this.normals, t, i), - this.tangents && e.updateVerticesData(r.b.TangentKind, this.tangents, t, i), - this.uvs && e.updateVerticesData(r.b.UVKind, this.uvs, t, i), - this.uvs2 && e.updateVerticesData(r.b.UV2Kind, this.uvs2, t, i), - this.uvs3 && e.updateVerticesData(r.b.UV3Kind, this.uvs3, t, i), - this.uvs4 && e.updateVerticesData(r.b.UV4Kind, this.uvs4, t, i), - this.uvs5 && e.updateVerticesData(r.b.UV5Kind, this.uvs5, t, i), - this.uvs6 && e.updateVerticesData(r.b.UV6Kind, this.uvs6, t, i), - this.colors && e.updateVerticesData(r.b.ColorKind, this.colors, t, i), - this.matricesIndices && e.updateVerticesData(r.b.MatricesIndicesKind, this.matricesIndices, t, i), - this.matricesWeights && e.updateVerticesData(r.b.MatricesWeightsKind, this.matricesWeights, t, i), - this.matricesIndicesExtra && e.updateVerticesData(r.b.MatricesIndicesExtraKind, this.matricesIndicesExtra, t, i), - this.matricesWeightsExtra && e.updateVerticesData(r.b.MatricesWeightsExtraKind, this.matricesWeightsExtra, t, i), + ); + }), + (e.prototype._update = function (e, t, i) { + return ( + this.positions && + e.updateVerticesData( + r.b.PositionKind, + this.positions, + t, + i + ), + this.normals && + e.updateVerticesData( + r.b.NormalKind, + this.normals, + t, + i + ), + this.tangents && + e.updateVerticesData( + r.b.TangentKind, + this.tangents, + t, + i + ), + this.uvs && + e.updateVerticesData(r.b.UVKind, this.uvs, t, i), + this.uvs2 && + e.updateVerticesData(r.b.UV2Kind, this.uvs2, t, i), + this.uvs3 && + e.updateVerticesData(r.b.UV3Kind, this.uvs3, t, i), + this.uvs4 && + e.updateVerticesData(r.b.UV4Kind, this.uvs4, t, i), + this.uvs5 && + e.updateVerticesData(r.b.UV5Kind, this.uvs5, t, i), + this.uvs6 && + e.updateVerticesData(r.b.UV6Kind, this.uvs6, t, i), + this.colors && + e.updateVerticesData( + r.b.ColorKind, + this.colors, + t, + i + ), + this.matricesIndices && + e.updateVerticesData( + r.b.MatricesIndicesKind, + this.matricesIndices, + t, + i + ), + this.matricesWeights && + e.updateVerticesData( + r.b.MatricesWeightsKind, + this.matricesWeights, + t, + i + ), + this.matricesIndicesExtra && + e.updateVerticesData( + r.b.MatricesIndicesExtraKind, + this.matricesIndicesExtra, + t, + i + ), + this.matricesWeightsExtra && + e.updateVerticesData( + r.b.MatricesWeightsExtraKind, + this.matricesWeightsExtra, + t, + i + ), this.indices && e.setIndices(this.indices, null), this - } - , - e.prototype.transform = function(e) { - var t, i = e.m[0] * e.m[5] * e.m[10] < 0, r = n.x.Zero(); - if (this.positions) { - var o = n.x.Zero(); - for (t = 0; t < this.positions.length; t += 3) - n.x.FromArrayToRef(this.positions, t, o), - n.x.TransformCoordinatesToRef(o, e, r), - this.positions[t] = r.x, - this.positions[t + 1] = r.y, - this.positions[t + 2] = r.z + ); + }), + (e.prototype.transform = function (e) { + var t, + i = e.m[0] * e.m[5] * e.m[10] < 0, + r = n.x.Zero(); + if (this.positions) { + var o = n.x.Zero(); + for (t = 0; t < this.positions.length; t += 3) + n.x.FromArrayToRef(this.positions, t, o), + n.x.TransformCoordinatesToRef(o, e, r), + (this.positions[t] = r.x), + (this.positions[t + 1] = r.y), + (this.positions[t + 2] = r.z); + } + if (this.normals) { + var a = n.x.Zero(); + for (t = 0; t < this.normals.length; t += 3) + n.x.FromArrayToRef(this.normals, t, a), + n.x.TransformNormalToRef(a, e, r), + (this.normals[t] = r.x), + (this.normals[t + 1] = r.y), + (this.normals[t + 2] = r.z); + } + if (this.tangents) { + var s = n.y.Zero(), + c = n.y.Zero(); + for (t = 0; t < this.tangents.length; t += 4) + n.y.FromArrayToRef(this.tangents, t, s), + n.y.TransformNormalToRef(s, e, c), + (this.tangents[t] = c.x), + (this.tangents[t + 1] = c.y), + (this.tangents[t + 2] = c.z), + (this.tangents[t + 3] = c.w); + } + if (i && this.indices) + for (t = 0; t < this.indices.length; t += 3) { + var u = this.indices[t + 1]; + (this.indices[t + 1] = this.indices[t + 2]), + (this.indices[t + 2] = u); } - if (this.normals) { - var a = n.x.Zero(); - for (t = 0; t < this.normals.length; t += 3) - n.x.FromArrayToRef(this.normals, t, a), - n.x.TransformNormalToRef(a, e, r), - this.normals[t] = r.x, - this.normals[t + 1] = r.y, - this.normals[t + 2] = r.z - } - if (this.tangents) { - var s = n.y.Zero() - , c = n.y.Zero(); - for (t = 0; t < this.tangents.length; t += 4) - n.y.FromArrayToRef(this.tangents, t, s), - n.y.TransformNormalToRef(s, e, c), - this.tangents[t] = c.x, - this.tangents[t + 1] = c.y, - this.tangents[t + 2] = c.z, - this.tangents[t + 3] = c.w - } - if (i && this.indices) - for (t = 0; t < this.indices.length; t += 3) { - var u = this.indices[t + 1]; - this.indices[t + 1] = this.indices[t + 2], - this.indices[t + 2] = u - } - return this - } - , - e.prototype.merge = function(e, t) { - if (void 0 === t && (t = false), + return this; + }), + (e.prototype.merge = function (e, t) { + if ( + (void 0 === t && (t = false), this._validate(), e._validate(), - !this.normals != !e.normals || !this.tangents != !e.tangents || !this.uvs != !e.uvs || !this.uvs2 != !e.uvs2 || !this.uvs3 != !e.uvs3 || !this.uvs4 != !e.uvs4 || !this.uvs5 != !e.uvs5 || !this.uvs6 != !e.uvs6 || !this.colors != !e.colors || !this.matricesIndices != !e.matricesIndices || !this.matricesWeights != !e.matricesWeights || !this.matricesIndicesExtra != !e.matricesIndicesExtra || !this.matricesWeightsExtra != !e.matricesWeightsExtra) - throw new Error("Cannot merge vertex data that do not have the same set of attributes"); - if (e.indices) { - this.indices || (this.indices = []); - var i = this.positions ? this.positions.length / 3 : 0; - if (void 0 !== this.indices.BYTES_PER_ELEMENT) { - var n = this.indices.length + e.indices.length - , r = t || this.indices instanceof Uint32Array ? new Uint32Array(n) : new Uint16Array(n); - r.set(this.indices); - for (var o = this.indices.length, a = 0; a < e.indices.length; a++) - r[o + a] = e.indices[a] + i; - this.indices = r - } else - for (a = 0; a < e.indices.length; a++) - this.indices.push(e.indices[a] + i) - } - return this.positions = this._mergeElement(this.positions, e.positions), - this.normals = this._mergeElement(this.normals, e.normals), - this.tangents = this._mergeElement(this.tangents, e.tangents), - this.uvs = this._mergeElement(this.uvs, e.uvs), - this.uvs2 = this._mergeElement(this.uvs2, e.uvs2), - this.uvs3 = this._mergeElement(this.uvs3, e.uvs3), - this.uvs4 = this._mergeElement(this.uvs4, e.uvs4), - this.uvs5 = this._mergeElement(this.uvs5, e.uvs5), - this.uvs6 = this._mergeElement(this.uvs6, e.uvs6), - this.colors = this._mergeElement(this.colors, e.colors), - this.matricesIndices = this._mergeElement(this.matricesIndices, e.matricesIndices), - this.matricesWeights = this._mergeElement(this.matricesWeights, e.matricesWeights), - this.matricesIndicesExtra = this._mergeElement(this.matricesIndicesExtra, e.matricesIndicesExtra), - this.matricesWeightsExtra = this._mergeElement(this.matricesWeightsExtra, e.matricesWeightsExtra), + !this.normals != !e.normals || + !this.tangents != !e.tangents || + !this.uvs != !e.uvs || + !this.uvs2 != !e.uvs2 || + !this.uvs3 != !e.uvs3 || + !this.uvs4 != !e.uvs4 || + !this.uvs5 != !e.uvs5 || + !this.uvs6 != !e.uvs6 || + !this.colors != !e.colors || + !this.matricesIndices != !e.matricesIndices || + !this.matricesWeights != !e.matricesWeights || + !this.matricesIndicesExtra != + !e.matricesIndicesExtra || + !this.matricesWeightsExtra != !e.matricesWeightsExtra) + ) + throw new Error( + "Cannot merge vertex data that do not have the same set of attributes" + ); + if (e.indices) { + this.indices || (this.indices = []); + var i = this.positions ? this.positions.length / 3 : 0; + if (void 0 !== this.indices.BYTES_PER_ELEMENT) { + var n = this.indices.length + e.indices.length, + r = + t || this.indices instanceof Uint32Array + ? new Uint32Array(n) + : new Uint16Array(n); + r.set(this.indices); + for ( + var o = this.indices.length, a = 0; + a < e.indices.length; + a++ + ) + r[o + a] = e.indices[a] + i; + this.indices = r; + } else + for (a = 0; a < e.indices.length; a++) + this.indices.push(e.indices[a] + i); + } + return ( + (this.positions = this._mergeElement( + this.positions, + e.positions + )), + (this.normals = this._mergeElement( + this.normals, + e.normals + )), + (this.tangents = this._mergeElement( + this.tangents, + e.tangents + )), + (this.uvs = this._mergeElement(this.uvs, e.uvs)), + (this.uvs2 = this._mergeElement(this.uvs2, e.uvs2)), + (this.uvs3 = this._mergeElement(this.uvs3, e.uvs3)), + (this.uvs4 = this._mergeElement(this.uvs4, e.uvs4)), + (this.uvs5 = this._mergeElement(this.uvs5, e.uvs5)), + (this.uvs6 = this._mergeElement(this.uvs6, e.uvs6)), + (this.colors = this._mergeElement( + this.colors, + e.colors + )), + (this.matricesIndices = this._mergeElement( + this.matricesIndices, + e.matricesIndices + )), + (this.matricesWeights = this._mergeElement( + this.matricesWeights, + e.matricesWeights + )), + (this.matricesIndicesExtra = this._mergeElement( + this.matricesIndicesExtra, + e.matricesIndicesExtra + )), + (this.matricesWeightsExtra = this._mergeElement( + this.matricesWeightsExtra, + e.matricesWeightsExtra + )), this - } - , - e.prototype._mergeElement = function(e, t) { - if (!e) - return t; - if (!t) - return e; - var i = t.length + e.length - , n = e instanceof Float32Array - , r = t instanceof Float32Array; - if (n) { - var o = new Float32Array(i); - return o.set(e), - o.set(t, e.length), - o - } - if (r) { - var a = e.slice(0) - , s = 0; - for (i = t.length; s < i; s++) - a.push(t[s]); - return a - } - return e.concat(t) - } - , - e.prototype._validate = function() { - if (!this.positions) - throw new Error("Positions are required"); - var e = function(e, t) { - var i = r.b.DeduceStride(e); - if (t.length % i != 0) - throw new Error("The " + e + "s array count must be a multiple of " + i); - return t.length / i - } - , t = e(r.b.PositionKind, this.positions) - , i = function(i, n) { - var r = e(i, n); - if (r !== t) - throw new Error("The " + i + "s element count (" + r + ") does not match the positions count (" + t + ")") + ); + }), + (e.prototype._mergeElement = function (e, t) { + if (!e) return t; + if (!t) return e; + var i = t.length + e.length, + n = e instanceof Float32Array, + r = t instanceof Float32Array; + if (n) { + var o = new Float32Array(i); + return o.set(e), o.set(t, e.length), o; + } + if (r) { + var a = e.slice(0), + s = 0; + for (i = t.length; s < i; s++) a.push(t[s]); + return a; + } + return e.concat(t); + }), + (e.prototype._validate = function () { + if (!this.positions) + throw new Error("Positions are required"); + var e = function (e, t) { + var i = r.b.DeduceStride(e); + if (t.length % i != 0) + throw new Error( + "The " + + e + + "s array count must be a multiple of " + + i + ); + return t.length / i; + }, + t = e(r.b.PositionKind, this.positions), + i = function (i, n) { + var r = e(i, n); + if (r !== t) + throw new Error( + "The " + + i + + "s element count (" + + r + + ") does not match the positions count (" + + t + + ")" + ); }; - this.normals && i(r.b.NormalKind, this.normals), + this.normals && i(r.b.NormalKind, this.normals), this.tangents && i(r.b.TangentKind, this.tangents), this.uvs && i(r.b.UVKind, this.uvs), this.uvs2 && i(r.b.UV2Kind, this.uvs2), @@ -33495,15 +41615,25 @@ and limitations under the License. this.uvs5 && i(r.b.UV5Kind, this.uvs5), this.uvs6 && i(r.b.UV6Kind, this.uvs6), this.colors && i(r.b.ColorKind, this.colors), - this.matricesIndices && i(r.b.MatricesIndicesKind, this.matricesIndices), - this.matricesWeights && i(r.b.MatricesWeightsKind, this.matricesWeights), - this.matricesIndicesExtra && i(r.b.MatricesIndicesExtraKind, this.matricesIndicesExtra), - this.matricesWeightsExtra && i(r.b.MatricesWeightsExtraKind, this.matricesWeightsExtra) - } - , - e.prototype.serialize = function() { - var e = this.serialize(); - return this.positions && (e.positions = this.positions), + this.matricesIndices && + i(r.b.MatricesIndicesKind, this.matricesIndices), + this.matricesWeights && + i(r.b.MatricesWeightsKind, this.matricesWeights), + this.matricesIndicesExtra && + i( + r.b.MatricesIndicesExtraKind, + this.matricesIndicesExtra + ), + this.matricesWeightsExtra && + i( + r.b.MatricesWeightsExtraKind, + this.matricesWeightsExtra + ); + }), + (e.prototype.serialize = function () { + var e = this.serialize(); + return ( + this.positions && (e.positions = this.positions), this.normals && (e.normals = this.normals), this.tangents && (e.tangents = this.tangents), this.uvs && (e.uvs = this.uvs), @@ -33513,4705 +41643,6047 @@ and limitations under the License. this.uvs5 && (e.uvs5 = this.uvs5), this.uvs6 && (e.uvs6 = this.uvs6), this.colors && (e.colors = this.colors), - this.matricesIndices && (e.matricesIndices = this.matricesIndices, - e.matricesIndices._isExpanded = true), - this.matricesWeights && (e.matricesWeights = this.matricesWeights), - this.matricesIndicesExtra && (e.matricesIndicesExtra = this.matricesIndicesExtra, - e.matricesIndicesExtra._isExpanded = true), - this.matricesWeightsExtra && (e.matricesWeightsExtra = this.matricesWeightsExtra), - e.indices = this.indices, + this.matricesIndices && + ((e.matricesIndices = this.matricesIndices), + (e.matricesIndices._isExpanded = true)), + this.matricesWeights && + (e.matricesWeights = this.matricesWeights), + this.matricesIndicesExtra && + ((e.matricesIndicesExtra = this.matricesIndicesExtra), + (e.matricesIndicesExtra._isExpanded = true)), + this.matricesWeightsExtra && + (e.matricesWeightsExtra = this.matricesWeightsExtra), + (e.indices = this.indices), e - } - , - e.ExtractFromMesh = function(t, i, n) { - return e._ExtractFrom(t, i, n) - } - , - e.ExtractFromGeometry = function(t, i, n) { - return e._ExtractFrom(t, i, n) - } - , - e._ExtractFrom = function(t, i, n) { - var o = new e; - return t.isVerticesDataPresent(r.b.PositionKind) && (o.positions = t.getVerticesData(r.b.PositionKind, i, n)), - t.isVerticesDataPresent(r.b.NormalKind) && (o.normals = t.getVerticesData(r.b.NormalKind, i, n)), - t.isVerticesDataPresent(r.b.TangentKind) && (o.tangents = t.getVerticesData(r.b.TangentKind, i, n)), - t.isVerticesDataPresent(r.b.UVKind) && (o.uvs = t.getVerticesData(r.b.UVKind, i, n)), - t.isVerticesDataPresent(r.b.UV2Kind) && (o.uvs2 = t.getVerticesData(r.b.UV2Kind, i, n)), - t.isVerticesDataPresent(r.b.UV3Kind) && (o.uvs3 = t.getVerticesData(r.b.UV3Kind, i, n)), - t.isVerticesDataPresent(r.b.UV4Kind) && (o.uvs4 = t.getVerticesData(r.b.UV4Kind, i, n)), - t.isVerticesDataPresent(r.b.UV5Kind) && (o.uvs5 = t.getVerticesData(r.b.UV5Kind, i, n)), - t.isVerticesDataPresent(r.b.UV6Kind) && (o.uvs6 = t.getVerticesData(r.b.UV6Kind, i, n)), - t.isVerticesDataPresent(r.b.ColorKind) && (o.colors = t.getVerticesData(r.b.ColorKind, i, n)), - t.isVerticesDataPresent(r.b.MatricesIndicesKind) && (o.matricesIndices = t.getVerticesData(r.b.MatricesIndicesKind, i, n)), - t.isVerticesDataPresent(r.b.MatricesWeightsKind) && (o.matricesWeights = t.getVerticesData(r.b.MatricesWeightsKind, i, n)), - t.isVerticesDataPresent(r.b.MatricesIndicesExtraKind) && (o.matricesIndicesExtra = t.getVerticesData(r.b.MatricesIndicesExtraKind, i, n)), - t.isVerticesDataPresent(r.b.MatricesWeightsExtraKind) && (o.matricesWeightsExtra = t.getVerticesData(r.b.MatricesWeightsExtraKind, i, n)), - o.indices = t.getIndices(i, n), + ); + }), + (e.ExtractFromMesh = function (t, i, n) { + return e._ExtractFrom(t, i, n); + }), + (e.ExtractFromGeometry = function (t, i, n) { + return e._ExtractFrom(t, i, n); + }), + (e._ExtractFrom = function (t, i, n) { + var o = new e(); + return ( + t.isVerticesDataPresent(r.b.PositionKind) && + (o.positions = t.getVerticesData( + r.b.PositionKind, + i, + n + )), + t.isVerticesDataPresent(r.b.NormalKind) && + (o.normals = t.getVerticesData(r.b.NormalKind, i, n)), + t.isVerticesDataPresent(r.b.TangentKind) && + (o.tangents = t.getVerticesData( + r.b.TangentKind, + i, + n + )), + t.isVerticesDataPresent(r.b.UVKind) && + (o.uvs = t.getVerticesData(r.b.UVKind, i, n)), + t.isVerticesDataPresent(r.b.UV2Kind) && + (o.uvs2 = t.getVerticesData(r.b.UV2Kind, i, n)), + t.isVerticesDataPresent(r.b.UV3Kind) && + (o.uvs3 = t.getVerticesData(r.b.UV3Kind, i, n)), + t.isVerticesDataPresent(r.b.UV4Kind) && + (o.uvs4 = t.getVerticesData(r.b.UV4Kind, i, n)), + t.isVerticesDataPresent(r.b.UV5Kind) && + (o.uvs5 = t.getVerticesData(r.b.UV5Kind, i, n)), + t.isVerticesDataPresent(r.b.UV6Kind) && + (o.uvs6 = t.getVerticesData(r.b.UV6Kind, i, n)), + t.isVerticesDataPresent(r.b.ColorKind) && + (o.colors = t.getVerticesData(r.b.ColorKind, i, n)), + t.isVerticesDataPresent(r.b.MatricesIndicesKind) && + (o.matricesIndices = t.getVerticesData( + r.b.MatricesIndicesKind, + i, + n + )), + t.isVerticesDataPresent(r.b.MatricesWeightsKind) && + (o.matricesWeights = t.getVerticesData( + r.b.MatricesWeightsKind, + i, + n + )), + t.isVerticesDataPresent(r.b.MatricesIndicesExtraKind) && + (o.matricesIndicesExtra = t.getVerticesData( + r.b.MatricesIndicesExtraKind, + i, + n + )), + t.isVerticesDataPresent(r.b.MatricesWeightsExtraKind) && + (o.matricesWeightsExtra = t.getVerticesData( + r.b.MatricesWeightsExtraKind, + i, + n + )), + (o.indices = t.getIndices(i, n)), o - } - , - e.CreateRibbon = function(e) { - throw o.a.WarnImport("ribbonBuilder") - } - , - e.CreateBox = function(e) { - throw o.a.WarnImport("boxBuilder") - } - , - e.CreateSphere = function(e) { - throw o.a.WarnImport("sphereBuilder") - } - , - e.CreateCylinder = function(e) { - throw o.a.WarnImport("cylinderBuilder") - } - , - e.CreateTorus = function(e) { - throw o.a.WarnImport("torusBuilder") - } - , - e.CreateLineSystem = function(e) { - throw o.a.WarnImport("linesBuilder") - } - , - e.CreateDashedLines = function(e) { - throw o.a.WarnImport("linesBuilder") - } - , - e.CreateGround = function(e) { - throw o.a.WarnImport("groundBuilder") - } - , - e.CreateTiledGround = function(e) { - throw o.a.WarnImport("groundBuilder") - } - , - e.CreateGroundFromHeightMap = function(e) { - throw o.a.WarnImport("groundBuilder") - } - , - e.CreatePlane = function(e) { - throw o.a.WarnImport("planeBuilder") - } - , - e.CreateDisc = function(e) { - throw o.a.WarnImport("discBuilder") - } - , - e.CreatePolygon = function(e, t, i, n, r, a) { - throw o.a.WarnImport("polygonBuilder") - } - , - e.CreateIcoSphere = function(e) { - throw o.a.WarnImport("icoSphereBuilder") - } - , - e.CreatePolyhedron = function(e) { - throw o.a.WarnImport("polyhedronBuilder") - } - , - e.CreateTorusKnot = function(e) { - throw o.a.WarnImport("torusKnotBuilder") - } - , - e.ComputeNormals = function(e, t, i, r) { - var o = 0 - , a = 0 - , s = 0 - , c = 0 - , u = 0 - , l = 0 - , h = 0 - , f = 0 - , d = 0 - , p = 0 - , m = 0 - , g = 0 - , _ = 0 - , v = 0 - , y = 0 - , b = 0 - , E = 0 - , T = 0 - , A = 0 - , x = 0 - , S = false - , C = false - , P = false - , R = false - , M = 1 - , O = 0 - , w = null; - if (r && (S = !!r.facetNormals, - C = !!r.facetPositions, - P = !!r.facetPartitioning, - M = true === r.useRightHandedSystem ? -1 : 1, - O = r.ratio || 0, - R = !!r.depthSort, - w = r.distanceTo, - R)) { - void 0 === w && (w = n.x.Zero()); - var I = r.depthSortedFacets - } - var D = 0 - , L = 0 - , F = 0 - , B = 0; - if (P && r && r.bbSize) { - var N = 0 - , k = 0 - , U = 0 - , V = 0 - , G = 0 - , z = 0 - , j = 0 - , H = 0 - , W = 0 - , X = 0 - , Y = 0 - , K = 0 - , Q = 0 - , q = 0 - , Z = 0 - , J = 0 - , $ = r.bbSize.x > r.bbSize.y ? r.bbSize.x : r.bbSize.y; - $ = $ > r.bbSize.z ? $ : r.bbSize.z, - D = r.subDiv.X * O / r.bbSize.x, - L = r.subDiv.Y * O / r.bbSize.y, - F = r.subDiv.Z * O / r.bbSize.z, - B = r.subDiv.max * r.subDiv.max, - r.facetPartitioning.length = 0 - } - for (o = 0; o < e.length; o++) - i[o] = 0; - var ee = t.length / 3 | 0; - for (o = 0; o < ee; o++) { - if (_ = 1 + (g = 3 * t[3 * o]), - v = g + 2, - b = 1 + (y = 3 * t[3 * o + 1]), - E = y + 2, - A = 1 + (T = 3 * t[3 * o + 2]), - x = T + 2, - a = e[g] - e[y], - s = e[_] - e[b], - c = e[v] - e[E], - u = e[T] - e[y], - l = e[A] - e[b], - f = M * (s * (h = e[x] - e[E]) - c * l), - d = M * (c * u - a * h), - p = M * (a * l - s * u), - f /= m = 0 === (m = Math.sqrt(f * f + d * d + p * p)) ? 1 : m, - d /= m, - p /= m, - S && r && (r.facetNormals[o].x = f, - r.facetNormals[o].y = d, - r.facetNormals[o].z = p), - C && r && (r.facetPositions[o].x = (e[g] + e[y] + e[T]) / 3, - r.facetPositions[o].y = (e[_] + e[b] + e[A]) / 3, - r.facetPositions[o].z = (e[v] + e[E] + e[x]) / 3), - P && r && (N = Math.floor((r.facetPositions[o].x - r.bInfo.minimum.x * O) * D), - k = Math.floor((r.facetPositions[o].y - r.bInfo.minimum.y * O) * L), - U = Math.floor((r.facetPositions[o].z - r.bInfo.minimum.z * O) * F), - V = Math.floor((e[g] - r.bInfo.minimum.x * O) * D), - G = Math.floor((e[_] - r.bInfo.minimum.y * O) * L), - z = Math.floor((e[v] - r.bInfo.minimum.z * O) * F), - j = Math.floor((e[y] - r.bInfo.minimum.x * O) * D), - H = Math.floor((e[b] - r.bInfo.minimum.y * O) * L), - W = Math.floor((e[E] - r.bInfo.minimum.z * O) * F), - X = Math.floor((e[T] - r.bInfo.minimum.x * O) * D), - Y = Math.floor((e[A] - r.bInfo.minimum.y * O) * L), - K = Math.floor((e[x] - r.bInfo.minimum.z * O) * F), - q = V + r.subDiv.max * G + B * z, - Z = j + r.subDiv.max * H + B * W, - J = X + r.subDiv.max * Y + B * K, - Q = N + r.subDiv.max * k + B * U, - r.facetPartitioning[Q] = r.facetPartitioning[Q] ? r.facetPartitioning[Q] : new Array, - r.facetPartitioning[q] = r.facetPartitioning[q] ? r.facetPartitioning[q] : new Array, - r.facetPartitioning[Z] = r.facetPartitioning[Z] ? r.facetPartitioning[Z] : new Array, - r.facetPartitioning[J] = r.facetPartitioning[J] ? r.facetPartitioning[J] : new Array, + ); + }), + (e.CreateRibbon = function (e) { + throw o.a.WarnImport("ribbonBuilder"); + }), + (e.CreateBox = function (e) { + throw o.a.WarnImport("boxBuilder"); + }), + (e.CreateSphere = function (e) { + throw o.a.WarnImport("sphereBuilder"); + }), + (e.CreateCylinder = function (e) { + throw o.a.WarnImport("cylinderBuilder"); + }), + (e.CreateTorus = function (e) { + throw o.a.WarnImport("torusBuilder"); + }), + (e.CreateLineSystem = function (e) { + throw o.a.WarnImport("linesBuilder"); + }), + (e.CreateDashedLines = function (e) { + throw o.a.WarnImport("linesBuilder"); + }), + (e.CreateGround = function (e) { + throw o.a.WarnImport("groundBuilder"); + }), + (e.CreateTiledGround = function (e) { + throw o.a.WarnImport("groundBuilder"); + }), + (e.CreateGroundFromHeightMap = function (e) { + throw o.a.WarnImport("groundBuilder"); + }), + (e.CreatePlane = function (e) { + throw o.a.WarnImport("planeBuilder"); + }), + (e.CreateDisc = function (e) { + throw o.a.WarnImport("discBuilder"); + }), + (e.CreatePolygon = function (e, t, i, n, r, a) { + throw o.a.WarnImport("polygonBuilder"); + }), + (e.CreateIcoSphere = function (e) { + throw o.a.WarnImport("icoSphereBuilder"); + }), + (e.CreatePolyhedron = function (e) { + throw o.a.WarnImport("polyhedronBuilder"); + }), + (e.CreateTorusKnot = function (e) { + throw o.a.WarnImport("torusKnotBuilder"); + }), + (e.ComputeNormals = function (e, t, i, r) { + var o = 0, + a = 0, + s = 0, + c = 0, + u = 0, + l = 0, + h = 0, + f = 0, + d = 0, + p = 0, + m = 0, + g = 0, + _ = 0, + v = 0, + y = 0, + b = 0, + E = 0, + T = 0, + A = 0, + x = 0, + S = false, + C = false, + P = false, + R = false, + M = 1, + O = 0, + w = null; + if ( + r && + ((S = !!r.facetNormals), + (C = !!r.facetPositions), + (P = !!r.facetPartitioning), + (M = true === r.useRightHandedSystem ? -1 : 1), + (O = r.ratio || 0), + (R = !!r.depthSort), + (w = r.distanceTo), + R) + ) { + void 0 === w && (w = n.x.Zero()); + var I = r.depthSortedFacets; + } + var D = 0, + L = 0, + F = 0, + B = 0; + if (P && r && r.bbSize) { + var N = 0, + k = 0, + U = 0, + V = 0, + G = 0, + z = 0, + j = 0, + H = 0, + W = 0, + X = 0, + Y = 0, + K = 0, + Q = 0, + q = 0, + Z = 0, + J = 0, + $ = r.bbSize.x > r.bbSize.y ? r.bbSize.x : r.bbSize.y; + ($ = $ > r.bbSize.z ? $ : r.bbSize.z), + (D = (r.subDiv.X * O) / r.bbSize.x), + (L = (r.subDiv.Y * O) / r.bbSize.y), + (F = (r.subDiv.Z * O) / r.bbSize.z), + (B = r.subDiv.max * r.subDiv.max), + (r.facetPartitioning.length = 0); + } + for (o = 0; o < e.length; o++) i[o] = 0; + var ee = (t.length / 3) | 0; + for (o = 0; o < ee; o++) { + if ( + ((_ = 1 + (g = 3 * t[3 * o])), + (v = g + 2), + (b = 1 + (y = 3 * t[3 * o + 1])), + (E = y + 2), + (A = 1 + (T = 3 * t[3 * o + 2])), + (x = T + 2), + (a = e[g] - e[y]), + (s = e[_] - e[b]), + (c = e[v] - e[E]), + (u = e[T] - e[y]), + (l = e[A] - e[b]), + (f = M * (s * (h = e[x] - e[E]) - c * l)), + (d = M * (c * u - a * h)), + (p = M * (a * l - s * u)), + (f /= m = + 0 === (m = Math.sqrt(f * f + d * d + p * p)) + ? 1 + : m), + (d /= m), + (p /= m), + S && + r && + ((r.facetNormals[o].x = f), + (r.facetNormals[o].y = d), + (r.facetNormals[o].z = p)), + C && + r && + ((r.facetPositions[o].x = (e[g] + e[y] + e[T]) / 3), + (r.facetPositions[o].y = (e[_] + e[b] + e[A]) / 3), + (r.facetPositions[o].z = (e[v] + e[E] + e[x]) / 3)), + P && + r && + ((N = Math.floor( + (r.facetPositions[o].x - r.bInfo.minimum.x * O) * + D + )), + (k = Math.floor( + (r.facetPositions[o].y - r.bInfo.minimum.y * O) * + L + )), + (U = Math.floor( + (r.facetPositions[o].z - r.bInfo.minimum.z * O) * + F + )), + (V = Math.floor( + (e[g] - r.bInfo.minimum.x * O) * D + )), + (G = Math.floor( + (e[_] - r.bInfo.minimum.y * O) * L + )), + (z = Math.floor( + (e[v] - r.bInfo.minimum.z * O) * F + )), + (j = Math.floor( + (e[y] - r.bInfo.minimum.x * O) * D + )), + (H = Math.floor( + (e[b] - r.bInfo.minimum.y * O) * L + )), + (W = Math.floor( + (e[E] - r.bInfo.minimum.z * O) * F + )), + (X = Math.floor( + (e[T] - r.bInfo.minimum.x * O) * D + )), + (Y = Math.floor( + (e[A] - r.bInfo.minimum.y * O) * L + )), + (K = Math.floor( + (e[x] - r.bInfo.minimum.z * O) * F + )), + (q = V + r.subDiv.max * G + B * z), + (Z = j + r.subDiv.max * H + B * W), + (J = X + r.subDiv.max * Y + B * K), + (Q = N + r.subDiv.max * k + B * U), + (r.facetPartitioning[Q] = r.facetPartitioning[Q] + ? r.facetPartitioning[Q] + : new Array()), + (r.facetPartitioning[q] = r.facetPartitioning[q] + ? r.facetPartitioning[q] + : new Array()), + (r.facetPartitioning[Z] = r.facetPartitioning[Z] + ? r.facetPartitioning[Z] + : new Array()), + (r.facetPartitioning[J] = r.facetPartitioning[J] + ? r.facetPartitioning[J] + : new Array()), r.facetPartitioning[q].push(o), Z != q && r.facetPartitioning[Z].push(o), J != Z && J != q && r.facetPartitioning[J].push(o), - Q != q && Q != Z && Q != J && r.facetPartitioning[Q].push(o)), - R && r && r.facetPositions) { - var te = I[o]; - te.ind = 3 * o, - te.sqDistance = n.x.DistanceSquared(r.facetPositions[o], w) - } - i[g] += f, - i[_] += d, - i[v] += p, - i[y] += f, - i[b] += d, - i[E] += p, - i[T] += f, - i[A] += d, - i[x] += p + Q != q && + Q != Z && + Q != J && + r.facetPartitioning[Q].push(o)), + R && r && r.facetPositions) + ) { + var te = I[o]; + (te.ind = 3 * o), + (te.sqDistance = n.x.DistanceSquared( + r.facetPositions[o], + w + )); } - for (o = 0; o < i.length / 3; o++) - f = i[3 * o], - d = i[3 * o + 1], - p = i[3 * o + 2], - f /= m = 0 === (m = Math.sqrt(f * f + d * d + p * p)) ? 1 : m, - d /= m, - p /= m, - i[3 * o] = f, - i[3 * o + 1] = d, - i[3 * o + 2] = p - } - , - e._ComputeSides = function(t, i, r, o, a, s, c) { - var u, l, h = r.length, f = o.length; - switch (t = t || e.DEFAULTSIDE) { + (i[g] += f), + (i[_] += d), + (i[v] += p), + (i[y] += f), + (i[b] += d), + (i[E] += p), + (i[T] += f), + (i[A] += d), + (i[x] += p); + } + for (o = 0; o < i.length / 3; o++) + (f = i[3 * o]), + (d = i[3 * o + 1]), + (p = i[3 * o + 2]), + (f /= m = + 0 === (m = Math.sqrt(f * f + d * d + p * p)) + ? 1 + : m), + (d /= m), + (p /= m), + (i[3 * o] = f), + (i[3 * o + 1] = d), + (i[3 * o + 2] = p); + }), + (e._ComputeSides = function (t, i, r, o, a, s, c) { + var u, + l, + h = r.length, + f = o.length; + switch ((t = t || e.DEFAULTSIDE)) { case e.FRONTSIDE: - break; + break; case e.BACKSIDE: - var d; - for (u = 0; u < h; u += 3) - d = r[u], - r[u] = r[u + 2], - r[u + 2] = d; - for (l = 0; l < f; l++) - o[l] = -o[l]; - break; + var d; + for (u = 0; u < h; u += 3) + (d = r[u]), (r[u] = r[u + 2]), (r[u + 2] = d); + for (l = 0; l < f; l++) o[l] = -o[l]; + break; case e.DOUBLESIDE: - for (var p = i.length, m = p / 3, g = 0; g < p; g++) - i[p + g] = i[g]; - for (u = 0; u < h; u += 3) - r[u + h] = r[u + 2] + m, - r[u + 1 + h] = r[u + 1] + m, - r[u + 2 + h] = r[u] + m; - for (l = 0; l < f; l++) - o[f + l] = -o[l]; - var _ = a.length - , v = 0; - for (v = 0; v < _; v++) - a[v + _] = a[v]; - for (s = s || new n.y(0,0,1,1), - c = c || new n.y(0,0,1,1), - v = 0, - u = 0; u < _ / 2; u++) - a[v] = s.x + (s.z - s.x) * a[v], - a[v + 1] = s.y + (s.w - s.y) * a[v + 1], - a[v + _] = c.x + (c.z - c.x) * a[v + _], - a[v + _ + 1] = c.y + (c.w - c.y) * a[v + _ + 1], - v += 2 - } - } - , - e.ImportVertexData = function(t, i) { - var o = new e - , a = t.positions; - a && o.set(a, r.b.PositionKind); - var s = t.normals; - s && o.set(s, r.b.NormalKind); - var c = t.tangents; - c && o.set(c, r.b.TangentKind); - var u = t.uvs; - u && o.set(u, r.b.UVKind); - var l = t.uv2s; - l && o.set(l, r.b.UV2Kind); - var h = t.uv3s; - h && o.set(h, r.b.UV3Kind); - var f = t.uv4s; - f && o.set(f, r.b.UV4Kind); - var d = t.uv5s; - d && o.set(d, r.b.UV5Kind); - var p = t.uv6s; - p && o.set(p, r.b.UV6Kind); - var m = t.colors; - m && o.set(n.f.CheckColors4(m, a.length / 3), r.b.ColorKind); - var g = t.matricesIndices; - g && o.set(g, r.b.MatricesIndicesKind); - var _ = t.matricesWeights; - _ && o.set(_, r.b.MatricesWeightsKind); - var v = t.indices; - v && (o.indices = v), - i.setAllVerticesData(o, t.updatable) - } - , - e.FRONTSIDE = 0, - e.BACKSIDE = 1, - e.DOUBLESIDE = 2, - e.DEFAULTSIDE = 0, + for (var p = i.length, m = p / 3, g = 0; g < p; g++) + i[p + g] = i[g]; + for (u = 0; u < h; u += 3) + (r[u + h] = r[u + 2] + m), + (r[u + 1 + h] = r[u + 1] + m), + (r[u + 2 + h] = r[u] + m); + for (l = 0; l < f; l++) o[f + l] = -o[l]; + var _ = a.length, + v = 0; + for (v = 0; v < _; v++) a[v + _] = a[v]; + for ( + s = s || new n.y(0, 0, 1, 1), + c = c || new n.y(0, 0, 1, 1), + v = 0, + u = 0; + u < _ / 2; + u++ + ) + (a[v] = s.x + (s.z - s.x) * a[v]), + (a[v + 1] = s.y + (s.w - s.y) * a[v + 1]), + (a[v + _] = c.x + (c.z - c.x) * a[v + _]), + (a[v + _ + 1] = c.y + (c.w - c.y) * a[v + _ + 1]), + (v += 2); + } + }), + (e.ImportVertexData = function (t, i) { + var o = new e(), + a = t.positions; + a && o.set(a, r.b.PositionKind); + var s = t.normals; + s && o.set(s, r.b.NormalKind); + var c = t.tangents; + c && o.set(c, r.b.TangentKind); + var u = t.uvs; + u && o.set(u, r.b.UVKind); + var l = t.uv2s; + l && o.set(l, r.b.UV2Kind); + var h = t.uv3s; + h && o.set(h, r.b.UV3Kind); + var f = t.uv4s; + f && o.set(f, r.b.UV4Kind); + var d = t.uv5s; + d && o.set(d, r.b.UV5Kind); + var p = t.uv6s; + p && o.set(p, r.b.UV6Kind); + var m = t.colors; + m && + o.set(n.f.CheckColors4(m, a.length / 3), r.b.ColorKind); + var g = t.matricesIndices; + g && o.set(g, r.b.MatricesIndicesKind); + var _ = t.matricesWeights; + _ && o.set(_, r.b.MatricesWeightsKind); + var v = t.indices; + v && (o.indices = v), + i.setAllVerticesData(o, t.updatable); + }), + (e.FRONTSIDE = 0), + (e.BACKSIDE = 1), + (e.DOUBLESIDE = 2), + (e.DEFAULTSIDE = 0), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }), - i.d(t, "b", function() { - return o + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }), + i.d(t, "b", function () { + return o; }); - var n = i(1) - , r = function() { - function e() {} - return e.NAME_EFFECTLAYER = "EffectLayer", - e.NAME_LAYER = "Layer", - e.NAME_LENSFLARESYSTEM = "LensFlareSystem", - e.NAME_BOUNDINGBOXRENDERER = "BoundingBoxRenderer", - e.NAME_PARTICLESYSTEM = "ParticleSystem", - e.NAME_GAMEPAD = "Gamepad", - e.NAME_SIMPLIFICATIONQUEUE = "SimplificationQueue", - e.NAME_GEOMETRYBUFFERRENDERER = "GeometryBufferRenderer", - e.NAME_DEPTHRENDERER = "DepthRenderer", - e.NAME_POSTPROCESSRENDERPIPELINEMANAGER = "PostProcessRenderPipelineManager", - e.NAME_SPRITE = "Sprite", - e.NAME_OUTLINERENDERER = "Outline", - e.NAME_PROCEDURALTEXTURE = "ProceduralTexture", - e.NAME_SHADOWGENERATOR = "ShadowGenerator", - e.NAME_OCTREE = "Octree", - e.NAME_PHYSICSENGINE = "PhysicsEngine", - e.NAME_AUDIO = "Audio", - e.STEP_ISREADYFORMESH_EFFECTLAYER = 0, - e.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0, - e.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0, - e.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER = 0, - e.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1, - e.STEP_BEFORECAMERADRAW_EFFECTLAYER = 0, - e.STEP_BEFORECAMERADRAW_LAYER = 1, - e.STEP_BEFORERENDERTARGETDRAW_LAYER = 0, - e.STEP_BEFORERENDERINGMESH_OUTLINE = 0, - e.STEP_AFTERRENDERINGMESH_OUTLINE = 0, - e.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0, - e.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1, - e.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0, - e.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1, - e.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0, - e.STEP_AFTERRENDERTARGETDRAW_LAYER = 0, - e.STEP_AFTERCAMERADRAW_EFFECTLAYER = 0, - e.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 1, - e.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 2, - e.STEP_AFTERCAMERADRAW_LAYER = 3, - e.STEP_AFTERRENDER_AUDIO = 0, - e.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 0, - e.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1, - e.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 2, - e.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3, - e.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0, - e.STEP_POINTERMOVE_SPRITE = 0, - e.STEP_POINTERDOWN_SPRITE = 0, - e.STEP_POINTERUP_SPRITE = 0, + var n = i(1), + r = (function () { + function e() {} + return ( + (e.NAME_EFFECTLAYER = "EffectLayer"), + (e.NAME_LAYER = "Layer"), + (e.NAME_LENSFLARESYSTEM = "LensFlareSystem"), + (e.NAME_BOUNDINGBOXRENDERER = "BoundingBoxRenderer"), + (e.NAME_PARTICLESYSTEM = "ParticleSystem"), + (e.NAME_GAMEPAD = "Gamepad"), + (e.NAME_SIMPLIFICATIONQUEUE = "SimplificationQueue"), + (e.NAME_GEOMETRYBUFFERRENDERER = "GeometryBufferRenderer"), + (e.NAME_DEPTHRENDERER = "DepthRenderer"), + (e.NAME_POSTPROCESSRENDERPIPELINEMANAGER = + "PostProcessRenderPipelineManager"), + (e.NAME_SPRITE = "Sprite"), + (e.NAME_OUTLINERENDERER = "Outline"), + (e.NAME_PROCEDURALTEXTURE = "ProceduralTexture"), + (e.NAME_SHADOWGENERATOR = "ShadowGenerator"), + (e.NAME_OCTREE = "Octree"), + (e.NAME_PHYSICSENGINE = "PhysicsEngine"), + (e.NAME_AUDIO = "Audio"), + (e.STEP_ISREADYFORMESH_EFFECTLAYER = 0), + (e.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0), + (e.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0), + (e.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER = 0), + (e.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1), + (e.STEP_BEFORECAMERADRAW_EFFECTLAYER = 0), + (e.STEP_BEFORECAMERADRAW_LAYER = 1), + (e.STEP_BEFORERENDERTARGETDRAW_LAYER = 0), + (e.STEP_BEFORERENDERINGMESH_OUTLINE = 0), + (e.STEP_AFTERRENDERINGMESH_OUTLINE = 0), + (e.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0), + (e.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1), + (e.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0), + (e.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1), + (e.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0), + (e.STEP_AFTERRENDERTARGETDRAW_LAYER = 0), + (e.STEP_AFTERCAMERADRAW_EFFECTLAYER = 0), + (e.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 1), + (e.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 2), + (e.STEP_AFTERCAMERADRAW_LAYER = 3), + (e.STEP_AFTERRENDER_AUDIO = 0), + (e.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 0), + (e.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1), + (e.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 2), + (e.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3), + (e.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0), + (e.STEP_POINTERMOVE_SPRITE = 0), + (e.STEP_POINTERDOWN_SPRITE = 0), + (e.STEP_POINTERUP_SPRITE = 0), e - }() - , o = function(e) { - function t(t) { - return e.apply(this, t) || this - } - return n.d(t, e), - t.Create = function() { - return Object.create(t.prototype) - } - , - t.prototype.registerStep = function(e, t, i) { - var n = 0; - for (Number.MAX_VALUE; n < this.length && !(e < this[n].index); n++) - ; - this.splice(n, 0, { - index: e, - component: t, - action: i.bind(t) - }) - } - , - t.prototype.clear = function() { - this.length = 0 - } - , + ); + })(), + o = (function (e) { + function t(t) { + return e.apply(this, t) || this; + } + return ( + n.d(t, e), + (t.Create = function () { + return Object.create(t.prototype); + }), + (t.prototype.registerStep = function (e, t, i) { + var n = 0; + for ( + Number.MAX_VALUE; + n < this.length && !(e < this[n].index); + n++ + ); + this.splice(n, 0, { + index: e, + component: t, + action: i.bind(t), + }); + }), + (t.prototype.clear = function () { + this.length = 0; + }), t - }(Array) - } - , function(e, t, getterFunc) { - "use strict"; - getterFunc.d(t, "a", function() { - return u - }); + ); + })(Array); + }, + function (e, t, getterFunc) { + "use strict"; + getterFunc.d(t, "a", function () { + return u; + }); - var n = getterFunc(6); - var vec3Math = getterFunc(16); - var o = getterFunc(0); - var a = getterFunc(23); - var s = getterFunc(4); - var c = getterFunc(38); + var n = getterFunc(6); + var vec3Math = getterFunc(16); + var o = getterFunc(0); + var a = getterFunc(23); + var s = getterFunc(4); + var c = getterFunc(38); - var u = function() { - function e() {} - return e.BindEyePosition = function(e, t) { - if (t._forcedViewPosition) - e.setVector3("vEyePosition", t._forcedViewPosition); - else { - var i = t.activeCamera.globalPosition; - i || (i = t.activeCamera.devicePosition), - e.setVector3("vEyePosition", t._mirroredCameraPosition ? t._mirroredCameraPosition : i) + var u = (function () { + function e() {} + return ( + (e.BindEyePosition = function (e, t) { + if (t._forcedViewPosition) + e.setVector3("vEyePosition", t._forcedViewPosition); + else { + var i = t.activeCamera.globalPosition; + i || (i = t.activeCamera.devicePosition), + e.setVector3( + "vEyePosition", + t._mirroredCameraPosition + ? t._mirroredCameraPosition + : i + ); + } + }), + (e.PrepareDefinesForMergedUV = function (e, t, i) { + (t._needUVs = true), + (t[i] = true), + e.getTextureMatrix().isIdentityAs3x2() + ? ((t[i + "DIRECTUV"] = e.coordinatesIndex + 1), + 0 === e.coordinatesIndex + ? (t.MAINUV1 = true) + : (t.MAINUV2 = true)) + : (t[i + "DIRECTUV"] = 0); + }), + (e.BindTextureMatrix = function (e, t, i) { + var n = e.getTextureMatrix(); + n.isIdentityAs3x2() || t.updateMatrix(i + "Matrix", n); + }), + (e.PrepareDefinesForMisc = function (e, t, i, n, o, a, s) { + s._areMiscDirty && + ((s.LOGARITHMICDEPTH = i), + (s.POINTSIZE = n), + (s.FOG = + t.fogEnabled && + e.applyFog && + t.fogMode !== vec3Math.a.FOGMODE_NONE && + o), + (s.NONUNIFORMSCALING = e.nonUniformScaling), + (s.ALPHATEST = a)); + }), + (e.PrepareDefinesForFrameBoundValues = function ( + e, + t, + i, + n, + r + ) { + void 0 === r && (r = null); + var o, + a, + s, + c, + u = false; + (o = + null == r + ? void 0 !== e.clipPlane && null !== e.clipPlane + : r), + (a = + null == r + ? void 0 !== e.clipPlane2 && null !== e.clipPlane2 + : r), + (s = + null == r + ? void 0 !== e.clipPlane3 && null !== e.clipPlane3 + : r), + (c = + null == r + ? void 0 !== e.clipPlane4 && null !== e.clipPlane4 + : r), + i.CLIPPLANE !== o && ((i.CLIPPLANE = o), (u = true)), + i.CLIPPLANE2 !== a && ((i.CLIPPLANE2 = a), (u = true)), + i.CLIPPLANE3 !== s && ((i.CLIPPLANE3 = s), (u = true)), + i.CLIPPLANE4 !== c && ((i.CLIPPLANE4 = c), (u = true)), + i.DEPTHPREPASS !== !t.getColorWrite() && + ((i.DEPTHPREPASS = !i.DEPTHPREPASS), (u = true)), + i.INSTANCES !== n && ((i.INSTANCES = n), (u = true)), + u && i.markAsUnprocessed(); + }), + (e.PrepareDefinesForAttributes = function (e, t, i, n, r, o) { + if ( + (void 0 === r && (r = false), + void 0 === o && (o = true), + !t._areAttributesDirty && + t._needNormals === t._normals && + t._needUVs === t._uvs) + ) + return false; + if ( + ((t._normals = t._needNormals), + (t._uvs = t._needUVs), + (t.NORMAL = + t._needNormals && + e.isVerticesDataPresent(s.b.NormalKind)), + t._needNormals && + e.isVerticesDataPresent(s.b.TangentKind) && + (t.TANGENT = true), + t._needUVs + ? ((t.UV1 = e.isVerticesDataPresent(s.b.UVKind)), + (t.UV2 = e.isVerticesDataPresent(s.b.UV2Kind))) + : ((t.UV1 = false), (t.UV2 = false)), + i) + ) { + var a = + e.useVertexColors && + e.isVerticesDataPresent(s.b.ColorKind); + (t.VERTEXCOLOR = a), + (t.VERTEXALPHA = e.hasVertexAlpha && a && o); + } + if (n) + if ( + e.useBones && + e.computeBonesUsingShaders && + e.skeleton + ) { + t.NUM_BONE_INFLUENCERS = e.numBoneInfluencers; + var c = void 0 !== t.BONETEXTURE; + e.skeleton.isUsingTextureForMatrices && c + ? (t.BONETEXTURE = true) + : ((t.BonesPerMesh = e.skeleton.bones.length + 1), + (t.BONETEXTURE = !c && void 0)); + } else (t.NUM_BONE_INFLUENCERS = 0), (t.BonesPerMesh = 0); + if (r) { + var u = e.morphTargetManager; + u + ? ((t.MORPHTARGETS_TANGENT = + u.supportsTangents && t.TANGENT), + (t.MORPHTARGETS_NORMAL = + u.supportsNormals && t.NORMAL), + (t.MORPHTARGETS = u.numInfluencers > 0), + (t.NUM_MORPH_INFLUENCERS = u.numInfluencers)) + : ((t.MORPHTARGETS_TANGENT = false), + (t.MORPHTARGETS_NORMAL = false), + (t.MORPHTARGETS = false), + (t.NUM_MORPH_INFLUENCERS = 0)); + } + return true; + }), + (e.PrepareDefinesForMultiview = function (e, t) { + if (e.activeCamera) { + var i = t.MULTIVIEW; + (t.MULTIVIEW = + null !== e.activeCamera.outputRenderTarget && + e.activeCamera.outputRenderTarget.getViewCount() > 1), + t.MULTIVIEW != i && t.markAsUnprocessed(); + } + }), + (e.PrepareDefinesForLights = function (e, t, i, n, r, o) { + if ( + (void 0 === r && (r = 4), + void 0 === o && (o = false), + !i._areLightsDirty) + ) + return i._needNormals; + var a = 0, + s = false, + u = false, + l = false, + h = false, + f = false; + if (e.lightsEnabled && !o) + for (var d = 0, p = t.lightSources; d < p.length; d++) { + var m = p[d]; + switch ( + ((s = true), + void 0 === i["LIGHT" + a] && (u = true), + (i["LIGHT" + a] = true), + (i["SPOTLIGHT" + a] = false), + (i["HEMILIGHT" + a] = false), + (i["POINTLIGHT" + a] = false), + (i["DIRLIGHT" + a] = false), + m.prepareLightSpecificDefines(i, a), + (i["LIGHT_FALLOFF_PHYSICAL" + a] = false), + (i["LIGHT_FALLOFF_GLTF" + a] = false), + (i["LIGHT_FALLOFF_STANDARD" + a] = false), + m.falloffType) + ) { + case c.a.FALLOFF_GLTF: + i["LIGHT_FALLOFF_GLTF" + a] = true; + break; + case c.a.FALLOFF_PHYSICAL: + i["LIGHT_FALLOFF_PHYSICAL" + a] = true; + break; + case c.a.FALLOFF_STANDARD: + i["LIGHT_FALLOFF_STANDARD" + a] = true; } - } - , - e.PrepareDefinesForMergedUV = function(e, t, i) { - t._needUVs = true, - t[i] = true, - e.getTextureMatrix().isIdentityAs3x2() ? (t[i + "DIRECTUV"] = e.coordinatesIndex + 1, - 0 === e.coordinatesIndex ? t.MAINUV1 = true : t.MAINUV2 = true) : t[i + "DIRECTUV"] = 0 - } - , - e.BindTextureMatrix = function(e, t, i) { - var n = e.getTextureMatrix(); - n.isIdentityAs3x2() || t.updateMatrix(i + "Matrix", n) - } - , - e.PrepareDefinesForMisc = function(e, t, i, n, o, a, s) { - s._areMiscDirty && (s.LOGARITHMICDEPTH = i, - s.POINTSIZE = n, - s.FOG = t.fogEnabled && e.applyFog && t.fogMode !== vec3Math.a.FOGMODE_NONE && o, - s.NONUNIFORMSCALING = e.nonUniformScaling, - s.ALPHATEST = a) - } - , - e.PrepareDefinesForFrameBoundValues = function(e, t, i, n, r) { - void 0 === r && (r = null); - var o, a, s, c, u = false; - o = null == r ? void 0 !== e.clipPlane && null !== e.clipPlane : r, - a = null == r ? void 0 !== e.clipPlane2 && null !== e.clipPlane2 : r, - s = null == r ? void 0 !== e.clipPlane3 && null !== e.clipPlane3 : r, - c = null == r ? void 0 !== e.clipPlane4 && null !== e.clipPlane4 : r, - i.CLIPPLANE !== o && (i.CLIPPLANE = o, - u = true), - i.CLIPPLANE2 !== a && (i.CLIPPLANE2 = a, - u = true), - i.CLIPPLANE3 !== s && (i.CLIPPLANE3 = s, - u = true), - i.CLIPPLANE4 !== c && (i.CLIPPLANE4 = c, - u = true), - i.DEPTHPREPASS !== !t.getColorWrite() && (i.DEPTHPREPASS = !i.DEPTHPREPASS, - u = true), - i.INSTANCES !== n && (i.INSTANCES = n, - u = true), - u && i.markAsUnprocessed() - } - , - e.PrepareDefinesForAttributes = function(e, t, i, n, r, o) { - if (void 0 === r && (r = false), - void 0 === o && (o = true), - !t._areAttributesDirty && t._needNormals === t._normals && t._needUVs === t._uvs) - return false; - if (t._normals = t._needNormals, - t._uvs = t._needUVs, - t.NORMAL = t._needNormals && e.isVerticesDataPresent(s.b.NormalKind), - t._needNormals && e.isVerticesDataPresent(s.b.TangentKind) && (t.TANGENT = true), - t._needUVs ? (t.UV1 = e.isVerticesDataPresent(s.b.UVKind), - t.UV2 = e.isVerticesDataPresent(s.b.UV2Kind)) : (t.UV1 = false, - t.UV2 = false), - i) { - var a = e.useVertexColors && e.isVerticesDataPresent(s.b.ColorKind); - t.VERTEXCOLOR = a, - t.VERTEXALPHA = e.hasVertexAlpha && a && o + if ( + (n && !m.specular.equalsFloats(0, 0, 0) && (f = true), + (i["SHADOW" + a] = false), + (i["SHADOWPCF" + a] = false), + (i["SHADOWPCSS" + a] = false), + (i["SHADOWPOISSON" + a] = false), + (i["SHADOWESM" + a] = false), + (i["SHADOWCUBE" + a] = false), + (i["SHADOWLOWQUALITY" + a] = false), + (i["SHADOWMEDIUMQUALITY" + a] = false), + t && + t.receiveShadows && + e.shadowsEnabled && + m.shadowEnabled) + ) { + var g = m.getShadowGenerator(); + if (g) { + var _ = g.getShadowMap(); + _ && + _.renderList && + _.renderList.length > 0 && + ((h = true), g.prepareDefines(i, a)); + } } - if (n) - if (e.useBones && e.computeBonesUsingShaders && e.skeleton) { - t.NUM_BONE_INFLUENCERS = e.numBoneInfluencers; - var c = void 0 !== t.BONETEXTURE; - e.skeleton.isUsingTextureForMatrices && c ? t.BONETEXTURE = true : (t.BonesPerMesh = e.skeleton.bones.length + 1, - t.BONETEXTURE = !c && void 0) - } else - t.NUM_BONE_INFLUENCERS = 0, - t.BonesPerMesh = 0; - if (r) { - var u = e.morphTargetManager; - u ? (t.MORPHTARGETS_TANGENT = u.supportsTangents && t.TANGENT, - t.MORPHTARGETS_NORMAL = u.supportsNormals && t.NORMAL, - t.MORPHTARGETS = u.numInfluencers > 0, - t.NUM_MORPH_INFLUENCERS = u.numInfluencers) : (t.MORPHTARGETS_TANGENT = false, - t.MORPHTARGETS_NORMAL = false, - t.MORPHTARGETS = false, - t.NUM_MORPH_INFLUENCERS = 0) - } - return true + if ( + (m.lightmapMode != c.a.LIGHTMAP_DEFAULT + ? ((l = true), + (i["LIGHTMAPEXCLUDED" + a] = true), + (i["LIGHTMAPNOSPECULAR" + a] = + m.lightmapMode == c.a.LIGHTMAP_SHADOWSONLY)) + : ((i["LIGHTMAPEXCLUDED" + a] = false), + (i["LIGHTMAPNOSPECULAR" + a] = false)), + ++a === r) + ) + break; + } + (i.SPECULARTERM = f), (i.SHADOWS = h); + for (var v = a; v < r; v++) + void 0 !== i["LIGHT" + v] && + ((i["LIGHT" + v] = false), + (i["HEMILIGHT" + v] = false), + (i["POINTLIGHT" + v] = false), + (i["DIRLIGHT" + v] = false), + (i["SPOTLIGHT" + v] = false), + (i["SHADOW" + v] = false), + (i["SHADOWPCF" + v] = false), + (i["SHADOWPCSS" + v] = false), + (i["SHADOWPOISSON" + v] = false), + (i["SHADOWESM" + v] = false), + (i["SHADOWCUBE" + v] = false), + (i["SHADOWLOWQUALITY" + v] = false), + (i["SHADOWMEDIUMQUALITY" + v] = false)); + var y = e.getEngine().getCaps(); + return ( + void 0 === i.SHADOWFLOAT && (u = true), + (i.SHADOWFLOAT = + h && + ((y.textureFloatRender && + y.textureFloatLinearFiltering) || + (y.textureHalfFloatRender && + y.textureHalfFloatLinearFiltering))), + (i.LIGHTMAPEXCLUDED = l), + u && i.rebuild(), + s + ); + }), + (e.PrepareUniformsAndSamplersList = function (e, t, i, n) { + var r; + void 0 === n && (n = 4); + var o = null; + if (e.uniformsNames) { + var a = e; + (r = a.uniformsNames), + (o = a.uniformBuffersNames), + (t = a.samplers), + (i = a.defines), + (n = a.maxSimultaneousLights); + } else (r = e), t || (t = []); + for (var s = 0; s < n && i["LIGHT" + s]; s++) + r.push( + "vLightData" + s, + "vLightDiffuse" + s, + "vLightSpecular" + s, + "vLightDirection" + s, + "vLightFalloff" + s, + "vLightGround" + s, + "lightMatrix" + s, + "shadowsInfo" + s, + "depthValues" + s + ), + o && o.push("Light" + s), + t.push("shadowSampler" + s), + t.push("depthSampler" + s), + i["PROJECTEDLIGHTTEXTURE" + s] && + (t.push("projectionLightSampler" + s), + r.push("textureProjectionMatrix" + s)); + i.NUM_MORPH_INFLUENCERS && r.push("morphTargetInfluences"); + }), + (e.HandleFallbacksForShadows = function (e, t, i, n) { + void 0 === i && (i = 4), void 0 === n && (n = 0); + for (var r = 0, o = 0; o < i && e["LIGHT" + o]; o++) + o > 0 && ((r = n + o), t.addFallback(r, "LIGHT" + o)), + e.SHADOWS || + (e["SHADOW" + o] && t.addFallback(n, "SHADOW" + o), + e["SHADOWPCF" + o] && + t.addFallback(n, "SHADOWPCF" + o), + e["SHADOWPCSS" + o] && + t.addFallback(n, "SHADOWPCSS" + o), + e["SHADOWPOISSON" + o] && + t.addFallback(n, "SHADOWPOISSON" + o), + e["SHADOWESM" + o] && + t.addFallback(n, "SHADOWESM" + o)); + return r++; + }), + (e.PrepareAttributesForMorphTargets = function (e, t, i) { + var r = i.NUM_MORPH_INFLUENCERS; + if (r > 0 && a.a.LastCreatedEngine) + for ( + var o = + a.a.LastCreatedEngine.getCaps().maxVertexAttribs, + c = t.morphTargetManager, + u = c && c.supportsNormals && i.NORMAL, + l = c && c.supportsTangents && i.TANGENT, + h = 0; + h < r; + h++ + ) + e.push(s.b.PositionKind + h), + u && e.push(s.b.NormalKind + h), + l && e.push(s.b.TangentKind + h), + e.length > o && + n.a.Error( + "Cannot add more vertex attributes for mesh " + + t.name + ); + }), + (e.PrepareAttributesForBones = function (e, t, i, n) { + i.NUM_BONE_INFLUENCERS > 0 && + (n.addCPUSkinningFallback(0, t), + e.push(s.b.MatricesIndicesKind), + e.push(s.b.MatricesWeightsKind), + i.NUM_BONE_INFLUENCERS > 4 && + (e.push(s.b.MatricesIndicesExtraKind), + e.push(s.b.MatricesWeightsExtraKind))); + }), + (e.PrepareAttributesForInstances = function (e, t) { + t.INSTANCES && + (e.push("world0"), + e.push("world1"), + e.push("world2"), + e.push("world3")); + }), + (e.BindLightShadow = function (e, t, i, n) { + if (e.shadowEnabled && t.receiveShadows) { + var r = e.getShadowGenerator(); + r && r.bindShadowLight(i, n); } - , - e.PrepareDefinesForMultiview = function(e, t) { - if (e.activeCamera) { - var i = t.MULTIVIEW; - t.MULTIVIEW = null !== e.activeCamera.outputRenderTarget && e.activeCamera.outputRenderTarget.getViewCount() > 1, - t.MULTIVIEW != i && t.markAsUnprocessed() - } + }), + (e.BindLightProperties = function (e, t, i) { + e.transferToEffect(t, i + ""); + }), + (e.BindLights = function (t, i, n, r, a, s) { + void 0 === a && (a = 4), void 0 === s && (s = false); + for ( + var c = Math.min(i.lightSources.length, a), u = 0; + u < c; + u++ + ) { + var l = i.lightSources[u], + h = u.toString(), + f = l.getScaledIntensity(); + l._uniformBuffer.bindToEffect(n, "Light" + u), + e.BindLightProperties(l, n, u), + l.diffuse.scaleToRef(f, o.t.Color3[0]), + l._uniformBuffer.updateColor4( + "vLightDiffuse", + o.t.Color3[0], + s ? l.radius : l.range, + h + ), + r.SPECULARTERM && + (l.specular.scaleToRef(f, o.t.Color3[1]), + l._uniformBuffer.updateColor3( + "vLightSpecular", + o.t.Color3[1], + h + )), + t.shadowsEnabled && this.BindLightShadow(l, i, h, n), + l._uniformBuffer.update(); } - , - e.PrepareDefinesForLights = function(e, t, i, n, r, o) { - if (void 0 === r && (r = 4), - void 0 === o && (o = false), - !i._areLightsDirty) - return i._needNormals; - var a = 0 - , s = false - , u = false - , l = false - , h = false - , f = false; - if (e.lightsEnabled && !o) - for (var d = 0, p = t.lightSources; d < p.length; d++) { - var m = p[d]; - switch (s = true, - void 0 === i["LIGHT" + a] && (u = true), - i["LIGHT" + a] = true, - i["SPOTLIGHT" + a] = false, - i["HEMILIGHT" + a] = false, - i["POINTLIGHT" + a] = false, - i["DIRLIGHT" + a] = false, - m.prepareLightSpecificDefines(i, a), - i["LIGHT_FALLOFF_PHYSICAL" + a] = false, - i["LIGHT_FALLOFF_GLTF" + a] = false, - i["LIGHT_FALLOFF_STANDARD" + a] = false, - m.falloffType) { - case c.a.FALLOFF_GLTF: - i["LIGHT_FALLOFF_GLTF" + a] = true; - break; - case c.a.FALLOFF_PHYSICAL: - i["LIGHT_FALLOFF_PHYSICAL" + a] = true; - break; - case c.a.FALLOFF_STANDARD: - i["LIGHT_FALLOFF_STANDARD" + a] = true - } - if (n && !m.specular.equalsFloats(0, 0, 0) && (f = true), - i["SHADOW" + a] = false, - i["SHADOWPCF" + a] = false, - i["SHADOWPCSS" + a] = false, - i["SHADOWPOISSON" + a] = false, - i["SHADOWESM" + a] = false, - i["SHADOWCUBE" + a] = false, - i["SHADOWLOWQUALITY" + a] = false, - i["SHADOWMEDIUMQUALITY" + a] = false, - t && t.receiveShadows && e.shadowsEnabled && m.shadowEnabled) { - var g = m.getShadowGenerator(); - if (g) { - var _ = g.getShadowMap(); - _ && _.renderList && _.renderList.length > 0 && (h = true, - g.prepareDefines(i, a)) - } - } - if (m.lightmapMode != c.a.LIGHTMAP_DEFAULT ? (l = true, - i["LIGHTMAPEXCLUDED" + a] = true, - i["LIGHTMAPNOSPECULAR" + a] = m.lightmapMode == c.a.LIGHTMAP_SHADOWSONLY) : (i["LIGHTMAPEXCLUDED" + a] = false, - i["LIGHTMAPNOSPECULAR" + a] = false), - ++a === r) - break - } - i.SPECULARTERM = f, - i.SHADOWS = h; - for (var v = a; v < r; v++) - void 0 !== i["LIGHT" + v] && (i["LIGHT" + v] = false, - i["HEMILIGHT" + v] = false, - i["POINTLIGHT" + v] = false, - i["DIRLIGHT" + v] = false, - i["SPOTLIGHT" + v] = false, - i["SHADOW" + v] = false, - i["SHADOWPCF" + v] = false, - i["SHADOWPCSS" + v] = false, - i["SHADOWPOISSON" + v] = false, - i["SHADOWESM" + v] = false, - i["SHADOWCUBE" + v] = false, - i["SHADOWLOWQUALITY" + v] = false, - i["SHADOWMEDIUMQUALITY" + v] = false); - var y = e.getEngine().getCaps(); - return void 0 === i.SHADOWFLOAT && (u = true), - i.SHADOWFLOAT = h && (y.textureFloatRender && y.textureFloatLinearFiltering || y.textureHalfFloatRender && y.textureHalfFloatLinearFiltering), - i.LIGHTMAPEXCLUDED = l, - u && i.rebuild(), - s + }), + (e.BindFogParameters = function (e, t, i, n) { + void 0 === n && (n = false), + e.fogEnabled && + t.applyFog && + e.fogMode !== vec3Math.a.FOGMODE_NONE && + (i.setFloat4( + "vFogInfos", + e.fogMode, + e.fogStart, + e.fogEnd, + e.fogDensity + ), + n + ? (e.fogColor.toLinearSpaceToRef(this._tempFogColor), + i.setColor3("vFogColor", this._tempFogColor)) + : i.setColor3("vFogColor", e.fogColor)); + }), + (e.BindBonesParameters = function (e, t) { + if ( + t && + e && + (e.computeBonesUsingShaders && + t._bonesComputationForcedToCPU && + (e.computeBonesUsingShaders = false), + e.useBones && e.computeBonesUsingShaders && e.skeleton) + ) { + var i = e.skeleton; + if ( + i.isUsingTextureForMatrices && + t.getUniformIndex("boneTextureWidth") > -1 + ) { + var n = i.getTransformMatrixTexture(); + t.setTexture("boneSampler", n), + t.setFloat( + "boneTextureWidth", + 4 * (i.bones.length + 1) + ); + } else { + var r = i.getTransformMatrices(e); + r && t.setMatrices("mBones", r); + } } - , - e.PrepareUniformsAndSamplersList = function(e, t, i, n) { - var r; - void 0 === n && (n = 4); - var o = null; - if (e.uniformsNames) { - var a = e; - r = a.uniformsNames, - o = a.uniformBuffersNames, - t = a.samplers, - i = a.defines, - n = a.maxSimultaneousLights - } else - r = e, - t || (t = []); - for (var s = 0; s < n && i["LIGHT" + s]; s++) - r.push("vLightData" + s, "vLightDiffuse" + s, "vLightSpecular" + s, "vLightDirection" + s, "vLightFalloff" + s, "vLightGround" + s, "lightMatrix" + s, "shadowsInfo" + s, "depthValues" + s), - o && o.push("Light" + s), - t.push("shadowSampler" + s), - t.push("depthSampler" + s), - i["PROJECTEDLIGHTTEXTURE" + s] && (t.push("projectionLightSampler" + s), - r.push("textureProjectionMatrix" + s)); - i.NUM_MORPH_INFLUENCERS && r.push("morphTargetInfluences") + }), + (e.BindMorphTargetParameters = function (e, t) { + var i = e.morphTargetManager; + e && + i && + t.setFloatArray("morphTargetInfluences", i.influences); + }), + (e.BindLogDepth = function (e, t, i) { + e.LOGARITHMICDEPTH && + t.setFloat( + "logarithmicDepthConstant", + 2 / (Math.log(i.activeCamera.maxZ + 1) / Math.LN2) + ); + }), + (e.BindClipPlane = function (e, t) { + if (t.clipPlane) { + var i = t.clipPlane; + e.setFloat4( + "vClipPlane", + i.normal.x, + i.normal.y, + i.normal.z, + i.d + ); } - , - e.HandleFallbacksForShadows = function(e, t, i, n) { - void 0 === i && (i = 4), - void 0 === n && (n = 0); - for (var r = 0, o = 0; o < i && e["LIGHT" + o]; o++) - o > 0 && (r = n + o, - t.addFallback(r, "LIGHT" + o)), - e.SHADOWS || (e["SHADOW" + o] && t.addFallback(n, "SHADOW" + o), - e["SHADOWPCF" + o] && t.addFallback(n, "SHADOWPCF" + o), - e["SHADOWPCSS" + o] && t.addFallback(n, "SHADOWPCSS" + o), - e["SHADOWPOISSON" + o] && t.addFallback(n, "SHADOWPOISSON" + o), - e["SHADOWESM" + o] && t.addFallback(n, "SHADOWESM" + o)); - return r++ - } - , - e.PrepareAttributesForMorphTargets = function(e, t, i) { - var r = i.NUM_MORPH_INFLUENCERS; - if (r > 0 && a.a.LastCreatedEngine) - for (var o = a.a.LastCreatedEngine.getCaps().maxVertexAttribs, c = t.morphTargetManager, u = c && c.supportsNormals && i.NORMAL, l = c && c.supportsTangents && i.TANGENT, h = 0; h < r; h++) - e.push(s.b.PositionKind + h), - u && e.push(s.b.NormalKind + h), - l && e.push(s.b.TangentKind + h), - e.length > o && n.a.Error("Cannot add more vertex attributes for mesh " + t.name) - } - , - e.PrepareAttributesForBones = function(e, t, i, n) { - i.NUM_BONE_INFLUENCERS > 0 && (n.addCPUSkinningFallback(0, t), - e.push(s.b.MatricesIndicesKind), - e.push(s.b.MatricesWeightsKind), - i.NUM_BONE_INFLUENCERS > 4 && (e.push(s.b.MatricesIndicesExtraKind), - e.push(s.b.MatricesWeightsExtraKind))) - } - , - e.PrepareAttributesForInstances = function(e, t) { - t.INSTANCES && (e.push("world0"), - e.push("world1"), - e.push("world2"), - e.push("world3")) - } - , - e.BindLightShadow = function(e, t, i, n) { - if (e.shadowEnabled && t.receiveShadows) { - var r = e.getShadowGenerator(); - r && r.bindShadowLight(i, n) - } - } - , - e.BindLightProperties = function(e, t, i) { - e.transferToEffect(t, i + "") - } - , - e.BindLights = function(t, i, n, r, a, s) { - void 0 === a && (a = 4), - void 0 === s && (s = false); - for (var c = Math.min(i.lightSources.length, a), u = 0; u < c; u++) { - var l = i.lightSources[u] - , h = u.toString() - , f = l.getScaledIntensity(); - l._uniformBuffer.bindToEffect(n, "Light" + u), - e.BindLightProperties(l, n, u), - l.diffuse.scaleToRef(f, o.t.Color3[0]), - l._uniformBuffer.updateColor4("vLightDiffuse", o.t.Color3[0], s ? l.radius : l.range, h), - r.SPECULARTERM && (l.specular.scaleToRef(f, o.t.Color3[1]), - l._uniformBuffer.updateColor3("vLightSpecular", o.t.Color3[1], h)), - t.shadowsEnabled && this.BindLightShadow(l, i, h, n), - l._uniformBuffer.update() - } - } - , - e.BindFogParameters = function(e, t, i, n) { - void 0 === n && (n = false), - e.fogEnabled && t.applyFog && e.fogMode !== vec3Math.a.FOGMODE_NONE && (i.setFloat4("vFogInfos", e.fogMode, e.fogStart, e.fogEnd, e.fogDensity), - n ? (e.fogColor.toLinearSpaceToRef(this._tempFogColor), - i.setColor3("vFogColor", this._tempFogColor)) : i.setColor3("vFogColor", e.fogColor)) - } - , - e.BindBonesParameters = function(e, t) { - if (t && e && (e.computeBonesUsingShaders && t._bonesComputationForcedToCPU && (e.computeBonesUsingShaders = false), - e.useBones && e.computeBonesUsingShaders && e.skeleton)) { - var i = e.skeleton; - if (i.isUsingTextureForMatrices && t.getUniformIndex("boneTextureWidth") > -1) { - var n = i.getTransformMatrixTexture(); - t.setTexture("boneSampler", n), - t.setFloat("boneTextureWidth", 4 * (i.bones.length + 1)) - } else { - var r = i.getTransformMatrices(e); - r && t.setMatrices("mBones", r) - } - } - } - , - e.BindMorphTargetParameters = function(e, t) { - var i = e.morphTargetManager; - e && i && t.setFloatArray("morphTargetInfluences", i.influences) - } - , - e.BindLogDepth = function(e, t, i) { - e.LOGARITHMICDEPTH && t.setFloat("logarithmicDepthConstant", 2 / (Math.log(i.activeCamera.maxZ + 1) / Math.LN2)) - } - , - e.BindClipPlane = function(e, t) { - if (t.clipPlane) { - var i = t.clipPlane; - e.setFloat4("vClipPlane", i.normal.x, i.normal.y, i.normal.z, i.d) - } - t.clipPlane2 && (i = t.clipPlane2, - e.setFloat4("vClipPlane2", i.normal.x, i.normal.y, i.normal.z, i.d)), - t.clipPlane3 && (i = t.clipPlane3, - e.setFloat4("vClipPlane3", i.normal.x, i.normal.y, i.normal.z, i.d)), - t.clipPlane4 && (i = t.clipPlane4, - e.setFloat4("vClipPlane4", i.normal.x, i.normal.y, i.normal.z, i.d)) - } - , - e._tempFogColor = o.e.Black(), - e - }() - } - , function(e, t, n) { - "use strict"; - var r = n(1) - , o = n(9) - , a = n(47) - , s = n(8) - , c = n(28) - , u = n(61) - , l = n(29) - , h = n(0) - , f = n(42) - , d = n(24) - , p = n(21) - , m = n(30) - , g = n(31) - , _ = n(63) - , v = n(38) - , y = n(50) - , b = n(36) - , E = n(83) - , T = n(91) - , A = n(14) - , x = n(3) - , S = n(35) - , C = n(6) - , P = n(23) - , R = n(19) - , M = n(17) - , O = n(79) - , w = n(51) - , I = function() { - function e() { - this._singleClick = false, - this._doubleClick = false, - this._hasSwiped = false, - this._ignore = false - } - return Object.defineProperty(e.prototype, "singleClick", { - get: function() { - return this._singleClick - }, - set: function(e) { - this._singleClick = e - }, - enumerable: true, - configurable: true + t.clipPlane2 && + ((i = t.clipPlane2), + e.setFloat4( + "vClipPlane2", + i.normal.x, + i.normal.y, + i.normal.z, + i.d + )), + t.clipPlane3 && + ((i = t.clipPlane3), + e.setFloat4( + "vClipPlane3", + i.normal.x, + i.normal.y, + i.normal.z, + i.d + )), + t.clipPlane4 && + ((i = t.clipPlane4), + e.setFloat4( + "vClipPlane4", + i.normal.x, + i.normal.y, + i.normal.z, + i.d + )); + }), + (e._tempFogColor = o.e.Black()), + e + ); + })(); + }, + function (e, t, n) { + "use strict"; + var r = n(1), + o = n(9), + a = n(47), + s = n(8), + c = n(28), + u = n(61), + l = n(29), + h = n(0), + f = n(42), + d = n(24), + p = n(21), + m = n(30), + g = n(31), + _ = n(63), + v = n(38), + y = n(50), + b = n(36), + E = n(83), + T = n(91), + A = n(14), + x = n(3), + S = n(35), + C = n(6), + P = n(23), + R = n(19), + M = n(17), + O = n(79), + w = n(51), + I = (function () { + function e() { + (this._singleClick = false), + (this._doubleClick = false), + (this._hasSwiped = false), + (this._ignore = false); + } + return ( + Object.defineProperty(e.prototype, "singleClick", { + get: function () { + return this._singleClick; + }, + set: function (e) { + this._singleClick = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "doubleClick", { - get: function() { - return this._doubleClick - }, - set: function(e) { - this._doubleClick = e - }, - enumerable: true, - configurable: true + get: function () { + return this._doubleClick; + }, + set: function (e) { + this._doubleClick = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "hasSwiped", { - get: function() { - return this._hasSwiped - }, - set: function(e) { - this._hasSwiped = e - }, - enumerable: true, - configurable: true + get: function () { + return this._hasSwiped; + }, + set: function (e) { + this._hasSwiped = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "ignore", { - get: function() { - return this._ignore - }, - set: function(e) { - this._ignore = e - }, - enumerable: true, - configurable: true + get: function () { + return this._ignore; + }, + set: function (e) { + this._ignore = e; + }, + enumerable: true, + configurable: true, }), e - }() - , D = function() { - function e(e) { - this._wheelEventName = "", - this._meshPickProceed = false, - this._currentPickResult = null, - this._previousPickResult = null, - this._totalPointersPressed = 0, - this._doubleClickOccured = false, - this._pointerX = 0, - this._pointerY = 0, - this._startingPointerPosition = new h.w(0,0), - this._previousStartingPointerPosition = new h.w(0,0), - this._startingPointerTime = 0, - this._previousStartingPointerTime = 0, - this._pointerCaptures = {}, - this._scene = e - } - return Object.defineProperty(e.prototype, "meshUnderPointer", { - get: function() { - return this._pointerOverMesh - }, - enumerable: true, - configurable: true + ); + })(), + D = (function () { + function e(e) { + (this._wheelEventName = ""), + (this._meshPickProceed = false), + (this._currentPickResult = null), + (this._previousPickResult = null), + (this._totalPointersPressed = 0), + (this._doubleClickOccured = false), + (this._pointerX = 0), + (this._pointerY = 0), + (this._startingPointerPosition = new h.w(0, 0)), + (this._previousStartingPointerPosition = new h.w(0, 0)), + (this._startingPointerTime = 0), + (this._previousStartingPointerTime = 0), + (this._pointerCaptures = {}), + (this._scene = e); + } + return ( + Object.defineProperty(e.prototype, "meshUnderPointer", { + get: function () { + return this._pointerOverMesh; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "unTranslatedPointer", { - get: function() { - return new h.w(this._unTranslatedPointerX,this._unTranslatedPointerY) - }, - enumerable: true, - configurable: true + get: function () { + return new h.w( + this._unTranslatedPointerX, + this._unTranslatedPointerY + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "pointerX", { - get: function() { - return this._pointerX - }, - set: function(e) { - this._pointerX = e - }, - enumerable: true, - configurable: true + get: function () { + return this._pointerX; + }, + set: function (e) { + this._pointerX = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "pointerY", { - get: function() { - return this._pointerY - }, - set: function(e) { - this._pointerY = e - }, - enumerable: true, - configurable: true + get: function () { + return this._pointerY; + }, + set: function (e) { + this._pointerY = e; + }, + enumerable: true, + configurable: true, }), - e.prototype._updatePointerPosition = function(e) { - var t = this._scene.getEngine().getRenderingCanvasClientRect(); - t && (this._pointerX = e.clientX - t.left, - this._pointerY = e.clientY - t.top, - this._unTranslatedPointerX = this._pointerX, - this._unTranslatedPointerY = this._pointerY) - } - , - e.prototype._processPointerMove = function(e, t) { - var i = this._scene - , n = i.getEngine().getRenderingCanvas(); - if (n) { - n.tabIndex = 1, - n.style.cursor = i.defaultCursor; - var r = !!(e && e.hit && e.pickedMesh); - r ? (i.setPointerOverMesh(e.pickedMesh), - this._pointerOverMesh && this._pointerOverMesh.actionManager && this._pointerOverMesh.actionManager.hasPointerTriggers && (this._pointerOverMesh.actionManager.hoverCursor ? n.style.cursor = this._pointerOverMesh.actionManager.hoverCursor : n.style.cursor = i.hoverCursor)) : i.setPointerOverMesh(null); - for (var o = 0, a = i._pointerMoveStage; o < a.length; o++) - e = a[o].action(this._unTranslatedPointerX, this._unTranslatedPointerY, e, r, n); - if (e) { - var s = t.type === this._wheelEventName ? M.a.POINTERWHEEL : M.a.POINTERMOVE; - if (i.onPointerMove && i.onPointerMove(t, e, s), - i.onPointerObservable.hasObservers()) { - var c = new M.b(s,t,e); - this._setRayOnPointerInfo(c), - i.onPointerObservable.notifyObservers(c, s) - } - } + (e.prototype._updatePointerPosition = function (e) { + var t = this._scene + .getEngine() + .getRenderingCanvasClientRect(); + t && + ((this._pointerX = e.clientX - t.left), + (this._pointerY = e.clientY - t.top), + (this._unTranslatedPointerX = this._pointerX), + (this._unTranslatedPointerY = this._pointerY)); + }), + (e.prototype._processPointerMove = function (e, t) { + var i = this._scene, + n = i.getEngine().getRenderingCanvas(); + if (n) { + (n.tabIndex = 1), (n.style.cursor = i.defaultCursor); + var r = !!(e && e.hit && e.pickedMesh); + r + ? (i.setPointerOverMesh(e.pickedMesh), + this._pointerOverMesh && + this._pointerOverMesh.actionManager && + this._pointerOverMesh.actionManager + .hasPointerTriggers && + (this._pointerOverMesh.actionManager.hoverCursor + ? (n.style.cursor = + this._pointerOverMesh.actionManager.hoverCursor) + : (n.style.cursor = i.hoverCursor))) + : i.setPointerOverMesh(null); + for ( + var o = 0, a = i._pointerMoveStage; + o < a.length; + o++ + ) + e = a[o].action( + this._unTranslatedPointerX, + this._unTranslatedPointerY, + e, + r, + n + ); + if (e) { + var s = + t.type === this._wheelEventName + ? M.a.POINTERWHEEL + : M.a.POINTERMOVE; + if ( + (i.onPointerMove && i.onPointerMove(t, e, s), + i.onPointerObservable.hasObservers()) + ) { + var c = new M.b(s, t, e); + this._setRayOnPointerInfo(c), + i.onPointerObservable.notifyObservers(c, s); + } } - } - , - e.prototype._setRayOnPointerInfo = function(e) { - var t = this._scene; - e.pickInfo && !e.pickInfo._pickingUnavailable && (e.pickInfo.ray || (e.pickInfo.ray = t.createPickingRay(e.event.offsetX, e.event.offsetY, h.j.Identity(), t.activeCamera))) - } - , - e.prototype._checkPrePointerObservable = function(e, t, i) { - var n = this._scene - , r = new M.d(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY); - return e && (r.ray = e.ray), + } + }), + (e.prototype._setRayOnPointerInfo = function (e) { + var t = this._scene; + e.pickInfo && + !e.pickInfo._pickingUnavailable && + (e.pickInfo.ray || + (e.pickInfo.ray = t.createPickingRay( + e.event.offsetX, + e.event.offsetY, + h.j.Identity(), + t.activeCamera + ))); + }), + (e.prototype._checkPrePointerObservable = function ( + e, + t, + i + ) { + var n = this._scene, + r = new M.d( + i, + t, + this._unTranslatedPointerX, + this._unTranslatedPointerY + ); + return ( + e && (r.ray = e.ray), n.onPrePointerObservable.notifyObservers(r, i), !!r.skipOnPointerObservable - } - , - e.prototype.simulatePointerMove = function(e, t) { - var i = new PointerEvent("pointermove",t); - this._checkPrePointerObservable(e, i, M.a.POINTERMOVE) || this._processPointerMove(e, i) - } - , - e.prototype.simulatePointerDown = function(e, t) { - var i = new PointerEvent("pointerdown",t); - this._checkPrePointerObservable(e, i, M.a.POINTERDOWN) || this._processPointerDown(e, i) - } - , - e.prototype._processPointerDown = function(t, i) { - var n = this - , r = this._scene; - if (t && t.hit && t.pickedMesh) { - this._pickedDownMesh = t.pickedMesh; - var o = t.pickedMesh.actionManager; - if (o) { - if (o.hasPickTriggers) - switch (o.processTrigger(x.a.ACTION_OnPickDownTrigger, b.a.CreateNew(t.pickedMesh, i)), - i.button) { - case 0: - o.processTrigger(x.a.ACTION_OnLeftPickTrigger, b.a.CreateNew(t.pickedMesh, i)); - break; - case 1: - o.processTrigger(x.a.ACTION_OnCenterPickTrigger, b.a.CreateNew(t.pickedMesh, i)); - break; - case 2: - o.processTrigger(x.a.ACTION_OnRightPickTrigger, b.a.CreateNew(t.pickedMesh, i)) - } - o.hasSpecificTrigger(x.a.ACTION_OnLongPressTrigger) && window.setTimeout(function() { - var t = r.pick(n._unTranslatedPointerX, n._unTranslatedPointerY, function(e) { - return e.isPickable && e.isVisible && e.isReady() && e.actionManager && e.actionManager.hasSpecificTrigger(x.a.ACTION_OnLongPressTrigger) && e == n._pickedDownMesh - }, false, r.cameraToUseForPointers); - t && t.hit && t.pickedMesh && o && 0 !== n._totalPointersPressed && Date.now() - n._startingPointerTime > e.LongPressDelay && !n._isPointerSwiping() && (n._startingPointerTime = 0, - o.processTrigger(x.a.ACTION_OnLongPressTrigger, b.a.CreateNew(t.pickedMesh, i))) - }, e.LongPressDelay) - } - } else - for (var a = 0, s = r._pointerDownStage; a < s.length; a++) - t = s[a].action(this._unTranslatedPointerX, this._unTranslatedPointerY, t, i); - if (t) { - var c = M.a.POINTERDOWN; - if (r.onPointerDown && r.onPointerDown(i, t, c), - r.onPointerObservable.hasObservers()) { - var u = new M.b(c,i,t); - this._setRayOnPointerInfo(u), - r.onPointerObservable.notifyObservers(u, c) + ); + }), + (e.prototype.simulatePointerMove = function (e, t) { + var i = new PointerEvent("pointermove", t); + this._checkPrePointerObservable(e, i, M.a.POINTERMOVE) || + this._processPointerMove(e, i); + }), + (e.prototype.simulatePointerDown = function (e, t) { + var i = new PointerEvent("pointerdown", t); + this._checkPrePointerObservable(e, i, M.a.POINTERDOWN) || + this._processPointerDown(e, i); + }), + (e.prototype._processPointerDown = function (t, i) { + var n = this, + r = this._scene; + if (t && t.hit && t.pickedMesh) { + this._pickedDownMesh = t.pickedMesh; + var o = t.pickedMesh.actionManager; + if (o) { + if (o.hasPickTriggers) + switch ( + (o.processTrigger( + x.a.ACTION_OnPickDownTrigger, + b.a.CreateNew(t.pickedMesh, i) + ), + i.button) + ) { + case 0: + o.processTrigger( + x.a.ACTION_OnLeftPickTrigger, + b.a.CreateNew(t.pickedMesh, i) + ); + break; + case 1: + o.processTrigger( + x.a.ACTION_OnCenterPickTrigger, + b.a.CreateNew(t.pickedMesh, i) + ); + break; + case 2: + o.processTrigger( + x.a.ACTION_OnRightPickTrigger, + b.a.CreateNew(t.pickedMesh, i) + ); } + o.hasSpecificTrigger(x.a.ACTION_OnLongPressTrigger) && + window.setTimeout(function () { + var t = r.pick( + n._unTranslatedPointerX, + n._unTranslatedPointerY, + function (e) { + return ( + e.isPickable && + e.isVisible && + e.isReady() && + e.actionManager && + e.actionManager.hasSpecificTrigger( + x.a.ACTION_OnLongPressTrigger + ) && + e == n._pickedDownMesh + ); + }, + false, + r.cameraToUseForPointers + ); + t && + t.hit && + t.pickedMesh && + o && + 0 !== n._totalPointersPressed && + Date.now() - n._startingPointerTime > + e.LongPressDelay && + !n._isPointerSwiping() && + ((n._startingPointerTime = 0), + o.processTrigger( + x.a.ACTION_OnLongPressTrigger, + b.a.CreateNew(t.pickedMesh, i) + )); + }, e.LongPressDelay); } - } - , - e.prototype._isPointerSwiping = function() { - return Math.abs(this._startingPointerPosition.x - this._pointerX) > e.DragMovementThreshold || Math.abs(this._startingPointerPosition.y - this._pointerY) > e.DragMovementThreshold - } - , - e.prototype.simulatePointerUp = function(e, t, i) { - var n = new PointerEvent("pointerup",t) - , r = new I; - i ? r.doubleClick = true : r.singleClick = true, - this._checkPrePointerObservable(e, n, M.a.POINTERUP) || this._processPointerUp(e, n, r) - } - , - e.prototype._processPointerUp = function(e, t, i) { - var n = this._scene; - if (e && e && e.pickedMesh) { - if (this._pickedUpMesh = e.pickedMesh, - this._pickedDownMesh === this._pickedUpMesh && (n.onPointerPick && n.onPointerPick(t, e), - i.singleClick && !i.ignore && n.onPointerObservable.hasObservers())) { - var r = M.a.POINTERPICK - , o = new M.b(r,t,e); - this._setRayOnPointerInfo(o), - n.onPointerObservable.notifyObservers(o, r) - } - var a = e.pickedMesh._getActionManagerForTrigger(); - if (a && !i.ignore) { - a.processTrigger(x.a.ACTION_OnPickUpTrigger, b.a.CreateNew(e.pickedMesh, t)), - !i.hasSwiped && i.singleClick && a.processTrigger(x.a.ACTION_OnPickTrigger, b.a.CreateNew(e.pickedMesh, t)); - var s = e.pickedMesh._getActionManagerForTrigger(x.a.ACTION_OnDoublePickTrigger); - i.doubleClick && s && s.processTrigger(x.a.ACTION_OnDoublePickTrigger, b.a.CreateNew(e.pickedMesh, t)) - } - } else if (!i.ignore) - for (var c = 0, u = n._pointerUpStage; c < u.length; c++) - e = u[c].action(this._unTranslatedPointerX, this._unTranslatedPointerY, e, t); - if (this._pickedDownMesh && this._pickedDownMesh !== this._pickedUpMesh) { - var l = this._pickedDownMesh._getActionManagerForTrigger(x.a.ACTION_OnPickOutTrigger); - l && l.processTrigger(x.a.ACTION_OnPickOutTrigger, b.a.CreateNew(this._pickedDownMesh, t)) + } else + for ( + var a = 0, s = r._pointerDownStage; + a < s.length; + a++ + ) + t = s[a].action( + this._unTranslatedPointerX, + this._unTranslatedPointerY, + t, + i + ); + if (t) { + var c = M.a.POINTERDOWN; + if ( + (r.onPointerDown && r.onPointerDown(i, t, c), + r.onPointerObservable.hasObservers()) + ) { + var u = new M.b(c, i, t); + this._setRayOnPointerInfo(u), + r.onPointerObservable.notifyObservers(u, c); } - var h = 0; - n.onPointerObservable.hasObservers() && (i.ignore || i.hasSwiped || (i.singleClick && n.onPointerObservable.hasSpecificMask(M.a.POINTERTAP) ? h = M.a.POINTERTAP : i.doubleClick && n.onPointerObservable.hasSpecificMask(M.a.POINTERDOUBLETAP) && (h = M.a.POINTERDOUBLETAP), - !h) || (o = new M.b(h,t,e), - this._setRayOnPointerInfo(o), - n.onPointerObservable.notifyObservers(o, h)), - i.ignore || (h = M.a.POINTERUP, - o = new M.b(h,t,e), - this._setRayOnPointerInfo(o), - n.onPointerObservable.notifyObservers(o, h))), - n.onPointerUp && !i.ignore && n.onPointerUp(t, e, h) - } - , - e.prototype.isPointerCaptured = function(e) { - return void 0 === e && (e = 0), - this._pointerCaptures[e] - } - , - e.prototype.attachControl = function(t, i, n) { - var r = this; - void 0 === t && (t = true), + } + }), + (e.prototype._isPointerSwiping = function () { + return ( + Math.abs( + this._startingPointerPosition.x - this._pointerX + ) > e.DragMovementThreshold || + Math.abs( + this._startingPointerPosition.y - this._pointerY + ) > e.DragMovementThreshold + ); + }), + (e.prototype.simulatePointerUp = function (e, t, i) { + var n = new PointerEvent("pointerup", t), + r = new I(); + i ? (r.doubleClick = true) : (r.singleClick = true), + this._checkPrePointerObservable(e, n, M.a.POINTERUP) || + this._processPointerUp(e, n, r); + }), + (e.prototype._processPointerUp = function (e, t, i) { + var n = this._scene; + if (e && e && e.pickedMesh) { + if ( + ((this._pickedUpMesh = e.pickedMesh), + this._pickedDownMesh === this._pickedUpMesh && + (n.onPointerPick && n.onPointerPick(t, e), + i.singleClick && + !i.ignore && + n.onPointerObservable.hasObservers())) + ) { + var r = M.a.POINTERPICK, + o = new M.b(r, t, e); + this._setRayOnPointerInfo(o), + n.onPointerObservable.notifyObservers(o, r); + } + var a = e.pickedMesh._getActionManagerForTrigger(); + if (a && !i.ignore) { + a.processTrigger( + x.a.ACTION_OnPickUpTrigger, + b.a.CreateNew(e.pickedMesh, t) + ), + !i.hasSwiped && + i.singleClick && + a.processTrigger( + x.a.ACTION_OnPickTrigger, + b.a.CreateNew(e.pickedMesh, t) + ); + var s = e.pickedMesh._getActionManagerForTrigger( + x.a.ACTION_OnDoublePickTrigger + ); + i.doubleClick && + s && + s.processTrigger( + x.a.ACTION_OnDoublePickTrigger, + b.a.CreateNew(e.pickedMesh, t) + ); + } + } else if (!i.ignore) + for ( + var c = 0, u = n._pointerUpStage; + c < u.length; + c++ + ) + e = u[c].action( + this._unTranslatedPointerX, + this._unTranslatedPointerY, + e, + t + ); + if ( + this._pickedDownMesh && + this._pickedDownMesh !== this._pickedUpMesh + ) { + var l = + this._pickedDownMesh._getActionManagerForTrigger( + x.a.ACTION_OnPickOutTrigger + ); + l && + l.processTrigger( + x.a.ACTION_OnPickOutTrigger, + b.a.CreateNew(this._pickedDownMesh, t) + ); + } + var h = 0; + n.onPointerObservable.hasObservers() && + (i.ignore || + i.hasSwiped || + (i.singleClick && + n.onPointerObservable.hasSpecificMask(M.a.POINTERTAP) + ? (h = M.a.POINTERTAP) + : i.doubleClick && + n.onPointerObservable.hasSpecificMask( + M.a.POINTERDOUBLETAP + ) && + (h = M.a.POINTERDOUBLETAP), + !h) || + ((o = new M.b(h, t, e)), + this._setRayOnPointerInfo(o), + n.onPointerObservable.notifyObservers(o, h)), + i.ignore || + ((h = M.a.POINTERUP), + (o = new M.b(h, t, e)), + this._setRayOnPointerInfo(o), + n.onPointerObservable.notifyObservers(o, h))), + n.onPointerUp && !i.ignore && n.onPointerUp(t, e, h); + }), + (e.prototype.isPointerCaptured = function (e) { + return void 0 === e && (e = 0), this._pointerCaptures[e]; + }), + (e.prototype.attachControl = function (t, i, n) { + var r = this; + void 0 === t && (t = true), void 0 === i && (i = true), void 0 === n && (n = true); - var a = this._scene - , s = a.getEngine().getRenderingCanvas(); - if (s) { - var c = a.getEngine(); - this._initActionManager = function(e, t) { - if (!r._meshPickProceed) { - var i = a.pick(r._unTranslatedPointerX, r._unTranslatedPointerY, a.pointerDownPredicate, false, a.cameraToUseForPointers); - r._currentPickResult = i, - i && (e = i.hit && i.pickedMesh ? i.pickedMesh._getActionManagerForTrigger() : null), - r._meshPickProceed = true - } - return e + var a = this._scene, + s = a.getEngine().getRenderingCanvas(); + if (s) { + var c = a.getEngine(); + (this._initActionManager = function (e, t) { + if (!r._meshPickProceed) { + var i = a.pick( + r._unTranslatedPointerX, + r._unTranslatedPointerY, + a.pointerDownPredicate, + false, + a.cameraToUseForPointers + ); + (r._currentPickResult = i), + i && + (e = + i.hit && i.pickedMesh + ? i.pickedMesh._getActionManagerForTrigger() + : null), + (r._meshPickProceed = true); + } + return e; + }), + (this._delayedSimpleClick = function (t, i, n) { + ((Date.now() - r._previousStartingPointerTime > + e.DoubleClickDelay && + !r._doubleClickOccured) || + t !== r._previousButtonPressed) && + ((r._doubleClickOccured = false), + (i.singleClick = true), + (i.ignore = false), + n(i, r._currentPickResult)); + }), + (this._initClickEvent = function (t, i, n, o) { + var a = new I(); + r._currentPickResult = null; + var s = null, + c = + t.hasSpecificMask(M.a.POINTERPICK) || + i.hasSpecificMask(M.a.POINTERPICK) || + t.hasSpecificMask(M.a.POINTERTAP) || + i.hasSpecificMask(M.a.POINTERTAP) || + t.hasSpecificMask(M.a.POINTERDOUBLETAP) || + i.hasSpecificMask(M.a.POINTERDOUBLETAP); + !c && + O.a && + (s = r._initActionManager(s, a)) && + (c = s.hasPickTriggers); + var u = false; + if (c) { + var l = n.button; + if ( + ((a.hasSwiped = r._isPointerSwiping()), + !a.hasSwiped) + ) { + var h = !e.ExclusiveDoubleClickMode; + h || + ((h = + !t.hasSpecificMask(M.a.POINTERDOUBLETAP) && + !i.hasSpecificMask(M.a.POINTERDOUBLETAP)) && + !O.a.HasSpecificTrigger( + x.a.ACTION_OnDoublePickTrigger + ) && + (s = r._initActionManager(s, a)) && + (h = !s.hasSpecificTrigger( + x.a.ACTION_OnDoublePickTrigger + ))), + h + ? (Date.now() - + r._previousStartingPointerTime > + e.DoubleClickDelay || + l !== r._previousButtonPressed) && + ((a.singleClick = true), + o(a, r._currentPickResult), + (u = true)) + : ((r._previousDelayedSimpleClickTimeout = + r._delayedSimpleClickTimeout), + (r._delayedSimpleClickTimeout = + window.setTimeout( + r._delayedSimpleClick.bind( + r, + l, + a, + o + ), + e.DoubleClickDelay + ))); + var f = + t.hasSpecificMask(M.a.POINTERDOUBLETAP) || + i.hasSpecificMask(M.a.POINTERDOUBLETAP); + !f && + O.a.HasSpecificTrigger( + x.a.ACTION_OnDoublePickTrigger + ) && + (s = r._initActionManager(s, a)) && + (f = s.hasSpecificTrigger( + x.a.ACTION_OnDoublePickTrigger + )), + f && + (l === r._previousButtonPressed && + Date.now() - + r._previousStartingPointerTime < + e.DoubleClickDelay && + !r._doubleClickOccured + ? (a.hasSwiped || r._isPointerSwiping() + ? ((r._doubleClickOccured = false), + (r._previousStartingPointerTime = + r._startingPointerTime), + (r._previousStartingPointerPosition.x = + r._startingPointerPosition.x), + (r._previousStartingPointerPosition.y = + r._startingPointerPosition.y), + (r._previousButtonPressed = l), + e.ExclusiveDoubleClickMode + ? (r._previousDelayedSimpleClickTimeout && + clearTimeout( + r._previousDelayedSimpleClickTimeout + ), + (r._previousDelayedSimpleClickTimeout = + r._delayedSimpleClickTimeout), + o(a, r._previousPickResult)) + : o(a, r._currentPickResult)) + : ((r._previousStartingPointerTime = 0), + (r._doubleClickOccured = true), + (a.doubleClick = true), + (a.ignore = false), + e.ExclusiveDoubleClickMode && + r._previousDelayedSimpleClickTimeout && + clearTimeout( + r._previousDelayedSimpleClickTimeout + ), + (r._previousDelayedSimpleClickTimeout = + r._delayedSimpleClickTimeout), + o(a, r._currentPickResult)), + (u = true)) + : ((r._doubleClickOccured = false), + (r._previousStartingPointerTime = + r._startingPointerTime), + (r._previousStartingPointerPosition.x = + r._startingPointerPosition.x), + (r._previousStartingPointerPosition.y = + r._startingPointerPosition.y), + (r._previousButtonPressed = l))); + } } - , - this._delayedSimpleClick = function(t, i, n) { - (Date.now() - r._previousStartingPointerTime > e.DoubleClickDelay && !r._doubleClickOccured || t !== r._previousButtonPressed) && (r._doubleClickOccured = false, - i.singleClick = true, - i.ignore = false, - n(i, r._currentPickResult)) + u || o(a, r._currentPickResult); + }), + (this._onPointerMove = function (e) { + if ( + (r._updatePointerPosition(e), + !r._checkPrePointerObservable( + null, + e, + e.type === r._wheelEventName + ? M.a.POINTERWHEEL + : M.a.POINTERMOVE + ) && + (a.cameraToUseForPointers || a.activeCamera)) + ) { + a.pointerMovePredicate || + (a.pointerMovePredicate = function (e) { + return ( + e.isPickable && + e.isVisible && + e.isReady() && + e.isEnabled() && + (e.enablePointerMoveEvents || + a.constantlyUpdateMeshUnderPointer || + (null !== e.actionManager && + void 0 !== e.actionManager)) && + (!a.cameraToUseForPointers || + 0 != + (a.cameraToUseForPointers.layerMask & + e.layerMask)) + ); + }); + var t = a.pick( + r._unTranslatedPointerX, + r._unTranslatedPointerY, + a.pointerMovePredicate, + false, + a.cameraToUseForPointers + ); + r._processPointerMove(t, e); } - , - this._initClickEvent = function(t, i, n, o) { - var a = new I; - r._currentPickResult = null; - var s = null - , c = t.hasSpecificMask(M.a.POINTERPICK) || i.hasSpecificMask(M.a.POINTERPICK) || t.hasSpecificMask(M.a.POINTERTAP) || i.hasSpecificMask(M.a.POINTERTAP) || t.hasSpecificMask(M.a.POINTERDOUBLETAP) || i.hasSpecificMask(M.a.POINTERDOUBLETAP); - !c && O.a && (s = r._initActionManager(s, a)) && (c = s.hasPickTriggers); - var u = false; - if (c) { - var l = n.button; - if (a.hasSwiped = r._isPointerSwiping(), - !a.hasSwiped) { - var h = !e.ExclusiveDoubleClickMode; - h || (h = !t.hasSpecificMask(M.a.POINTERDOUBLETAP) && !i.hasSpecificMask(M.a.POINTERDOUBLETAP)) && !O.a.HasSpecificTrigger(x.a.ACTION_OnDoublePickTrigger) && (s = r._initActionManager(s, a)) && (h = !s.hasSpecificTrigger(x.a.ACTION_OnDoublePickTrigger)), - h ? (Date.now() - r._previousStartingPointerTime > e.DoubleClickDelay || l !== r._previousButtonPressed) && (a.singleClick = true, - o(a, r._currentPickResult), - u = true) : (r._previousDelayedSimpleClickTimeout = r._delayedSimpleClickTimeout, - r._delayedSimpleClickTimeout = window.setTimeout(r._delayedSimpleClick.bind(r, l, a, o), e.DoubleClickDelay)); - var f = t.hasSpecificMask(M.a.POINTERDOUBLETAP) || i.hasSpecificMask(M.a.POINTERDOUBLETAP); - !f && O.a.HasSpecificTrigger(x.a.ACTION_OnDoublePickTrigger) && (s = r._initActionManager(s, a)) && (f = s.hasSpecificTrigger(x.a.ACTION_OnDoublePickTrigger)), - f && (l === r._previousButtonPressed && Date.now() - r._previousStartingPointerTime < e.DoubleClickDelay && !r._doubleClickOccured ? (a.hasSwiped || r._isPointerSwiping() ? (r._doubleClickOccured = false, - r._previousStartingPointerTime = r._startingPointerTime, - r._previousStartingPointerPosition.x = r._startingPointerPosition.x, - r._previousStartingPointerPosition.y = r._startingPointerPosition.y, - r._previousButtonPressed = l, - e.ExclusiveDoubleClickMode ? (r._previousDelayedSimpleClickTimeout && clearTimeout(r._previousDelayedSimpleClickTimeout), - r._previousDelayedSimpleClickTimeout = r._delayedSimpleClickTimeout, - o(a, r._previousPickResult)) : o(a, r._currentPickResult)) : (r._previousStartingPointerTime = 0, - r._doubleClickOccured = true, - a.doubleClick = true, - a.ignore = false, - e.ExclusiveDoubleClickMode && r._previousDelayedSimpleClickTimeout && clearTimeout(r._previousDelayedSimpleClickTimeout), - r._previousDelayedSimpleClickTimeout = r._delayedSimpleClickTimeout, - o(a, r._currentPickResult)), - u = true) : (r._doubleClickOccured = false, - r._previousStartingPointerTime = r._startingPointerTime, - r._previousStartingPointerPosition.x = r._startingPointerPosition.x, - r._previousStartingPointerPosition.y = r._startingPointerPosition.y, - r._previousButtonPressed = l)) - } - } - u || o(a, r._currentPickResult) - } - , - this._onPointerMove = function(e) { - if (r._updatePointerPosition(e), - !r._checkPrePointerObservable(null, e, e.type === r._wheelEventName ? M.a.POINTERWHEEL : M.a.POINTERMOVE) && (a.cameraToUseForPointers || a.activeCamera)) { - a.pointerMovePredicate || (a.pointerMovePredicate = function(e) { - return e.isPickable && e.isVisible && e.isReady() && e.isEnabled() && (e.enablePointerMoveEvents || a.constantlyUpdateMeshUnderPointer || null !== e.actionManager && void 0 !== e.actionManager) && (!a.cameraToUseForPointers || 0 != (a.cameraToUseForPointers.layerMask & e.layerMask)) - } + }), + (this._onPointerDown = function (e) { + if ( + (r._totalPointersPressed++, + (r._pickedDownMesh = null), + (r._meshPickProceed = false), + r._updatePointerPosition(e), + a.preventDefaultOnPointerDown && + s && + (e.preventDefault(), s.focus()), + (r._startingPointerPosition.x = r._pointerX), + (r._startingPointerPosition.y = r._pointerY), + (r._startingPointerTime = Date.now()), + !r._checkPrePointerObservable( + null, + e, + M.a.POINTERDOWN + ) && + (a.cameraToUseForPointers || a.activeCamera)) + ) { + (r._pointerCaptures[e.pointerId] = true), + a.pointerDownPredicate || + (a.pointerDownPredicate = function (e) { + return ( + e.isPickable && + e.isVisible && + e.isReady() && + e.isEnabled() && + (!a.cameraToUseForPointers || + 0 != + (a.cameraToUseForPointers.layerMask & + e.layerMask)) ); - var t = a.pick(r._unTranslatedPointerX, r._unTranslatedPointerY, a.pointerMovePredicate, false, a.cameraToUseForPointers); - r._processPointerMove(t, e) - } + }), + (r._pickedDownMesh = null); + var t = a.pick( + r._unTranslatedPointerX, + r._unTranslatedPointerY, + a.pointerDownPredicate, + false, + a.cameraToUseForPointers + ); + r._processPointerDown(t, e); } - , - this._onPointerDown = function(e) { - if (r._totalPointersPressed++, - r._pickedDownMesh = null, - r._meshPickProceed = false, - r._updatePointerPosition(e), - a.preventDefaultOnPointerDown && s && (e.preventDefault(), - s.focus()), - r._startingPointerPosition.x = r._pointerX, - r._startingPointerPosition.y = r._pointerY, - r._startingPointerTime = Date.now(), - !r._checkPrePointerObservable(null, e, M.a.POINTERDOWN) && (a.cameraToUseForPointers || a.activeCamera)) { - r._pointerCaptures[e.pointerId] = true, - a.pointerDownPredicate || (a.pointerDownPredicate = function(e) { - return e.isPickable && e.isVisible && e.isReady() && e.isEnabled() && (!a.cameraToUseForPointers || 0 != (a.cameraToUseForPointers.layerMask & e.layerMask)) + }), + (this._onPointerUp = function (e) { + 0 !== r._totalPointersPressed && + (r._totalPointersPressed--, + (r._pickedUpMesh = null), + (r._meshPickProceed = false), + r._updatePointerPosition(e), + a.preventDefaultOnPointerUp && + s && + (e.preventDefault(), s.focus()), + r._initClickEvent( + a.onPrePointerObservable, + a.onPointerObservable, + e, + function (t, i) { + if ( + a.onPrePointerObservable.hasObservers() && + !t.ignore + ) { + if (!t.hasSwiped) { + if ( + t.singleClick && + a.onPrePointerObservable.hasSpecificMask( + M.a.POINTERTAP + ) && + r._checkPrePointerObservable( + null, + e, + M.a.POINTERTAP + ) + ) + return; + if ( + t.doubleClick && + a.onPrePointerObservable.hasSpecificMask( + M.a.POINTERDOUBLETAP + ) && + r._checkPrePointerObservable( + null, + e, + M.a.POINTERDOUBLETAP + ) + ) + return; } - ), - r._pickedDownMesh = null; - var t = a.pick(r._unTranslatedPointerX, r._unTranslatedPointerY, a.pointerDownPredicate, false, a.cameraToUseForPointers); - r._processPointerDown(t, e) + if ( + r._checkPrePointerObservable( + null, + e, + M.a.POINTERUP + ) + ) + return; + } + r._pointerCaptures[e.pointerId] && + ((r._pointerCaptures[e.pointerId] = false), + (a.cameraToUseForPointers || + a.activeCamera) && + (a.pointerUpPredicate || + (a.pointerUpPredicate = function (e) { + return ( + e.isPickable && + e.isVisible && + e.isReady() && + e.isEnabled() && + (!a.cameraToUseForPointers || + 0 != + (a.cameraToUseForPointers + .layerMask & + e.layerMask)) + ); + }), + !r._meshPickProceed && + ((O.a && O.a.HasTriggers) || + a.onPointerObservable.hasObservers()) && + r._initActionManager(null, t), + i || (i = r._currentPickResult), + r._processPointerUp(i, e, t), + (r._previousPickResult = + r._currentPickResult))); } + )); + }), + (this._onKeyDown = function (e) { + var t = w.a.KEYDOWN; + if (a.onPreKeyboardObservable.hasObservers()) { + var i = new w.c(t, e); + if ( + (a.onPreKeyboardObservable.notifyObservers( + i, + t + ), + i.skipOnPointerObservable) + ) + return; } - , - this._onPointerUp = function(e) { - 0 !== r._totalPointersPressed && (r._totalPointersPressed--, - r._pickedUpMesh = null, - r._meshPickProceed = false, - r._updatePointerPosition(e), - a.preventDefaultOnPointerUp && s && (e.preventDefault(), - s.focus()), - r._initClickEvent(a.onPrePointerObservable, a.onPointerObservable, e, function(t, i) { - if (a.onPrePointerObservable.hasObservers() && !t.ignore) { - if (!t.hasSwiped) { - if (t.singleClick && a.onPrePointerObservable.hasSpecificMask(M.a.POINTERTAP) && r._checkPrePointerObservable(null, e, M.a.POINTERTAP)) - return; - if (t.doubleClick && a.onPrePointerObservable.hasSpecificMask(M.a.POINTERDOUBLETAP) && r._checkPrePointerObservable(null, e, M.a.POINTERDOUBLETAP)) - return - } - if (r._checkPrePointerObservable(null, e, M.a.POINTERUP)) - return - } - r._pointerCaptures[e.pointerId] && (r._pointerCaptures[e.pointerId] = false, - (a.cameraToUseForPointers || a.activeCamera) && (a.pointerUpPredicate || (a.pointerUpPredicate = function(e) { - return e.isPickable && e.isVisible && e.isReady() && e.isEnabled() && (!a.cameraToUseForPointers || 0 != (a.cameraToUseForPointers.layerMask & e.layerMask)) - } - ), - !r._meshPickProceed && (O.a && O.a.HasTriggers || a.onPointerObservable.hasObservers()) && r._initActionManager(null, t), - i || (i = r._currentPickResult), - r._processPointerUp(i, e, t), - r._previousPickResult = r._currentPickResult)) - })) + a.onKeyboardObservable.hasObservers() && + ((i = new w.b(t, e)), + a.onKeyboardObservable.notifyObservers(i, t)), + a.actionManager && + a.actionManager.processTrigger( + x.a.ACTION_OnKeyDownTrigger, + b.a.CreateNewFromScene(a, e) + ); + }), + (this._onKeyUp = function (e) { + var t = w.a.KEYUP; + if (a.onPreKeyboardObservable.hasObservers()) { + var i = new w.c(t, e); + if ( + (a.onPreKeyboardObservable.notifyObservers( + i, + t + ), + i.skipOnPointerObservable) + ) + return; } - , - this._onKeyDown = function(e) { - var t = w.a.KEYDOWN; - if (a.onPreKeyboardObservable.hasObservers()) { - var i = new w.c(t,e); - if (a.onPreKeyboardObservable.notifyObservers(i, t), - i.skipOnPointerObservable) - return - } - a.onKeyboardObservable.hasObservers() && (i = new w.b(t,e), - a.onKeyboardObservable.notifyObservers(i, t)), - a.actionManager && a.actionManager.processTrigger(x.a.ACTION_OnKeyDownTrigger, b.a.CreateNewFromScene(a, e)) - } - , - this._onKeyUp = function(e) { - var t = w.a.KEYUP; - if (a.onPreKeyboardObservable.hasObservers()) { - var i = new w.c(t,e); - if (a.onPreKeyboardObservable.notifyObservers(i, t), - i.skipOnPointerObservable) - return - } - a.onKeyboardObservable.hasObservers() && (i = new w.b(t,e), - a.onKeyboardObservable.notifyObservers(i, t)), - a.actionManager && a.actionManager.processTrigger(x.a.ACTION_OnKeyUpTrigger, b.a.CreateNewFromScene(a, e)) - } - , - this._onCanvasFocusObserver = c.onCanvasFocusObservable.add(function() { - s && (s.addEventListener("keydown", r._onKeyDown, false), - s.addEventListener("keyup", r._onKeyUp, false)) - }), - this._onCanvasBlurObserver = c.onCanvasBlurObservable.add(function() { - s && (s.removeEventListener("keydown", r._onKeyDown), - s.removeEventListener("keyup", r._onKeyUp)) - }); - var u = o.h.GetPointerPrefix(); - n && (s.addEventListener(u + "move", this._onPointerMove, false), - this._wheelEventName = "onwheel"in document.createElement("div") ? "wheel" : void 0 !== document.onmousewheel ? "mousewheel" : "DOMMouseScroll", - s.addEventListener(this._wheelEventName, this._onPointerMove, false)), - i && s.addEventListener(u + "down", this._onPointerDown, false), - t && window.addEventListener(u + "up", this._onPointerUp, false) - } - } - , - e.prototype.detachControl = function() { - var e = o.h.GetPointerPrefix() - , t = this._scene.getEngine().getRenderingCanvas() - , i = this._scene.getEngine(); - t && (t.removeEventListener(e + "move", this._onPointerMove), + a.onKeyboardObservable.hasObservers() && + ((i = new w.b(t, e)), + a.onKeyboardObservable.notifyObservers(i, t)), + a.actionManager && + a.actionManager.processTrigger( + x.a.ACTION_OnKeyUpTrigger, + b.a.CreateNewFromScene(a, e) + ); + }), + (this._onCanvasFocusObserver = + c.onCanvasFocusObservable.add(function () { + s && + (s.addEventListener( + "keydown", + r._onKeyDown, + false + ), + s.addEventListener("keyup", r._onKeyUp, false)); + })), + (this._onCanvasBlurObserver = + c.onCanvasBlurObservable.add(function () { + s && + (s.removeEventListener("keydown", r._onKeyDown), + s.removeEventListener("keyup", r._onKeyUp)); + })); + var u = o.h.GetPointerPrefix(); + n && + (s.addEventListener( + u + "move", + this._onPointerMove, + false + ), + (this._wheelEventName = + "onwheel" in document.createElement("div") + ? "wheel" + : void 0 !== document.onmousewheel + ? "mousewheel" + : "DOMMouseScroll"), + s.addEventListener( + this._wheelEventName, + this._onPointerMove, + false + )), + i && + s.addEventListener( + u + "down", + this._onPointerDown, + false + ), + t && + window.addEventListener( + u + "up", + this._onPointerUp, + false + ); + } + }), + (e.prototype.detachControl = function () { + var e = o.h.GetPointerPrefix(), + t = this._scene.getEngine().getRenderingCanvas(), + i = this._scene.getEngine(); + t && + (t.removeEventListener(e + "move", this._onPointerMove), t.removeEventListener(e + "down", this._onPointerDown), window.removeEventListener(e + "up", this._onPointerUp), - this._onCanvasBlurObserver && i.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), - this._onCanvasFocusObserver && i.onCanvasFocusObservable.remove(this._onCanvasFocusObserver), + this._onCanvasBlurObserver && + i.onCanvasBlurObservable.remove( + this._onCanvasBlurObserver + ), + this._onCanvasFocusObserver && + i.onCanvasFocusObservable.remove( + this._onCanvasFocusObserver + ), t.removeEventListener("keydown", this._onKeyDown), t.removeEventListener("keyup", this._onKeyUp), - t.style.cursor = this._scene.defaultCursor) - } - , - e.prototype.setPointerOverMesh = function(e) { - var t; - this._pointerOverMesh !== e && (this._pointerOverMesh && (t = this._pointerOverMesh._getActionManagerForTrigger(x.a.ACTION_OnPointerOutTrigger)) && t.processTrigger(x.a.ACTION_OnPointerOutTrigger, b.a.CreateNew(this._pointerOverMesh)), - this._pointerOverMesh = e, - this._pointerOverMesh && (t = this._pointerOverMesh._getActionManagerForTrigger(x.a.ACTION_OnPointerOverTrigger)) && t.processTrigger(x.a.ACTION_OnPointerOverTrigger, b.a.CreateNew(this._pointerOverMesh))) - } - , - e.prototype.getPointerOverMesh = function() { - return this._pointerOverMesh - } - , - e.DragMovementThreshold = 10, - e.LongPressDelay = 500, - e.DoubleClickDelay = 300, - e.ExclusiveDoubleClickMode = false, + (t.style.cursor = this._scene.defaultCursor)); + }), + (e.prototype.setPointerOverMesh = function (e) { + var t; + this._pointerOverMesh !== e && + (this._pointerOverMesh && + (t = + this._pointerOverMesh._getActionManagerForTrigger( + x.a.ACTION_OnPointerOutTrigger + )) && + t.processTrigger( + x.a.ACTION_OnPointerOutTrigger, + b.a.CreateNew(this._pointerOverMesh) + ), + (this._pointerOverMesh = e), + this._pointerOverMesh && + (t = + this._pointerOverMesh._getActionManagerForTrigger( + x.a.ACTION_OnPointerOverTrigger + )) && + t.processTrigger( + x.a.ACTION_OnPointerOverTrigger, + b.a.CreateNew(this._pointerOverMesh) + )); + }), + (e.prototype.getPointerOverMesh = function () { + return this._pointerOverMesh; + }), + (e.DragMovementThreshold = 10), + (e.LongPressDelay = 500), + (e.DoubleClickDelay = 300), + (e.ExclusiveDoubleClickMode = false), e - }(); - n.d(t, "a", function() { - return L - }); - var L = function(e) { - function t(i, n) { - var r = e.call(this) || this; - return r._inputManager = new D(r), - r.cameraToUseForPointers = null, - r._isScene = true, - r.autoClear = true, - r.autoClearDepthAndStencil = true, - r.clearColor = new h.f(.2,.2,.3,1), - r.ambientColor = new h.e(0,0,0), - r._forceWireframe = false, - r._forcePointsCloud = false, - r.animationsEnabled = true, - r._animationPropertiesOverride = null, - r.useConstantAnimationDeltaTime = false, - r.constantlyUpdateMeshUnderPointer = false, - r.hoverCursor = "pointer", - r.defaultCursor = "", - r.preventDefaultOnPointerDown = true, - r.preventDefaultOnPointerUp = true, - r.metadata = null, - r.reservedDataStore = null, - r.disableOfflineSupportExceptionRules = new Array, - r.onDisposeObservable = new s.c, - r._onDisposeObserver = null, - r.onBeforeRenderObservable = new s.c, - r._onBeforeRenderObserver = null, - r.onAfterRenderObservable = new s.c, - r._onAfterRenderObserver = null, - r.onBeforeAnimationsObservable = new s.c, - r.onAfterAnimationsObservable = new s.c, - r.onBeforeDrawPhaseObservable = new s.c, - r.onAfterDrawPhaseObservable = new s.c, - r.onReadyObservable = new s.c, - r.onBeforeCameraRenderObservable = new s.c, - r._onBeforeCameraRenderObserver = null, - r.onAfterCameraRenderObservable = new s.c, - r._onAfterCameraRenderObserver = null, - r.onBeforeActiveMeshesEvaluationObservable = new s.c, - r.onAfterActiveMeshesEvaluationObservable = new s.c, - r.onBeforeParticlesRenderingObservable = new s.c, - r.onAfterParticlesRenderingObservable = new s.c, - r.onDataLoadedObservable = new s.c, - r.onNewCameraAddedObservable = new s.c, - r.onCameraRemovedObservable = new s.c, - r.onNewLightAddedObservable = new s.c, - r.onLightRemovedObservable = new s.c, - r.onNewGeometryAddedObservable = new s.c, - r.onGeometryRemovedObservable = new s.c, - r.onNewTransformNodeAddedObservable = new s.c, - r.onTransformNodeRemovedObservable = new s.c, - r.onNewMeshAddedObservable = new s.c, - r.onMeshRemovedObservable = new s.c, - r.onNewSkeletonAddedObservable = new s.c, - r.onSkeletonRemovedObservable = new s.c, - r.onNewMaterialAddedObservable = new s.c, - r.onMaterialRemovedObservable = new s.c, - r.onNewTextureAddedObservable = new s.c, - r.onTextureRemovedObservable = new s.c, - r.onBeforeRenderTargetsRenderObservable = new s.c, - r.onAfterRenderTargetsRenderObservable = new s.c, - r.onBeforeStepObservable = new s.c, - r.onAfterStepObservable = new s.c, - r.onActiveCameraChanged = new s.c, - r.onBeforeRenderingGroupObservable = new s.c, - r.onAfterRenderingGroupObservable = new s.c, - r.onMeshImportedObservable = new s.c, - r._registeredForLateAnimationBindings = new c.b(256), - r.onPrePointerObservable = new s.c, - r.onPointerObservable = new s.c, - r.onPreKeyboardObservable = new s.c, - r.onKeyboardObservable = new s.c, - r._useRightHandedSystem = false, - r._timeAccumulator = 0, - r._currentStepId = 0, - r._currentInternalStep = 0, - r._fogEnabled = true, - r._fogMode = t.FOGMODE_NONE, - r.fogColor = new h.e(.2,.2,.3), - r.fogDensity = .1, - r.fogStart = 0, - r.fogEnd = 1e3, - r._shadowsEnabled = true, - r._lightsEnabled = true, - r.activeCameras = new Array, - r._texturesEnabled = true, - r.particlesEnabled = true, - r.spritesEnabled = true, - r._skeletonsEnabled = true, - r.lensFlaresEnabled = true, - r.collisionsEnabled = true, - r.gravity = new h.x(0,-9.807,0), - r.postProcessesEnabled = true, - r.postProcesses = new Array, - r.renderTargetsEnabled = true, - r.dumpNextRenderTargets = false, - r.customRenderTargets = new Array, - r.importedMeshesFiles = new Array, - r.probesEnabled = true, - r._meshesForIntersections = new c.b(256), - r.proceduralTexturesEnabled = true, - r._totalVertices = new o.f, - r._activeIndices = new o.f, - r._activeParticles = new o.f, - r._activeBones = new o.f, - r._animationTime = 0, - r.animationTimeScale = 1, - r._renderId = 0, - r._frameId = 0, - r._executeWhenReadyTimeoutId = -1, - r._intermediateRendering = false, - r._viewUpdateFlag = -1, - r._projectionUpdateFlag = -1, - r._toBeDisposed = new Array(256), - r._activeRequests = new Array, - r._pendingData = new Array, - r._isDisposed = false, - r.dispatchAllSubMeshesOfActiveMeshes = false, - r._activeMeshes = new c.a(256), - r._processedMaterials = new c.a(256), - r._renderTargets = new c.b(256), - r._activeParticleSystems = new c.a(256), - r._activeSkeletons = new c.b(32), - r._softwareSkinnedMeshes = new c.b(32), - r._activeAnimatables = new Array, - r._transformMatrix = h.j.Zero(), - r.requireLightSorting = false, - r._components = [], - r._serializableComponents = [], - r._transientComponents = [], - r._beforeCameraUpdateStage = A.b.Create(), - r._beforeClearStage = A.b.Create(), - r._gatherRenderTargetsStage = A.b.Create(), - r._gatherActiveCameraRenderTargetsStage = A.b.Create(), - r._isReadyForMeshStage = A.b.Create(), - r._beforeEvaluateActiveMeshStage = A.b.Create(), - r._evaluateSubMeshStage = A.b.Create(), - r._activeMeshStage = A.b.Create(), - r._cameraDrawRenderTargetStage = A.b.Create(), - r._beforeCameraDrawStage = A.b.Create(), - r._beforeRenderTargetDrawStage = A.b.Create(), - r._beforeRenderingGroupDrawStage = A.b.Create(), - r._beforeRenderingMeshStage = A.b.Create(), - r._afterRenderingMeshStage = A.b.Create(), - r._afterRenderingGroupDrawStage = A.b.Create(), - r._afterCameraDrawStage = A.b.Create(), - r._afterRenderTargetDrawStage = A.b.Create(), - r._afterRenderStage = A.b.Create(), - r._pointerMoveStage = A.b.Create(), - r._pointerDownStage = A.b.Create(), - r._pointerUpStage = A.b.Create(), - r.geometriesByUniqueId = null, - r._defaultMeshCandidates = { - data: [], - length: 0 - }, - r._defaultSubMeshCandidates = { - data: [], - length: 0 - }, - r._preventFreeActiveMeshesAndRenderingGroups = false, - r._activeMeshesFrozen = false, - r._allowPostProcessClearColor = true, - r.getDeterministicFrameTime = function() { - return 1e3 / 60 - } - , - r._blockMaterialDirtyMechanism = false, - r._engine = i || P.a.LastCreatedEngine, - n && n.virtual || (P.a._LastCreatedScene = r, - r._engine.scenes.push(r)), - r._uid = null, - r._renderingManager = new T.b(r), - E.a && (r.postProcessManager = new E.a(r)), - S.a.IsWindowObjectExist() && r.attachControl(), - r._createUbo(), - g.a && (r._imageProcessingConfiguration = new g.a), - r.setDefaultCandidateProviders(), - n && true === n.useGeometryUniqueIdsMap && (r.geometriesByUniqueId = {}), - r.useMaterialMeshMap = n && n.useGeometryUniqueIdsMap || false, - r.useClonedMeshhMap = n && n.useClonedMeshhMap || false, - n && n.virtual || r._engine.onNewSceneAddedObservable.notifyObservers(r), - r - } - return r.d(t, e), - t.DefaultMaterialFactory = function(e) { - throw R.a.WarnImport("StandardMaterial") - } - , - t.CollisionCoordinatorFactory = function() { - throw R.a.WarnImport("DefaultCollisionCoordinator") - } - , - Object.defineProperty(t.prototype, "environmentTexture", { - get: function() { - return this._environmentTexture - }, - set: function(e) { - this._environmentTexture !== e && (this._environmentTexture = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + ); + })(); + n.d(t, "a", function () { + return L; + }); + var L = (function (e) { + function t(i, n) { + var r = e.call(this) || this; + return ( + (r._inputManager = new D(r)), + (r.cameraToUseForPointers = null), + (r._isScene = true), + (r.autoClear = true), + (r.autoClearDepthAndStencil = true), + (r.clearColor = new h.f(0.2, 0.2, 0.3, 1)), + (r.ambientColor = new h.e(0, 0, 0)), + (r._forceWireframe = false), + (r._forcePointsCloud = false), + (r.animationsEnabled = true), + (r._animationPropertiesOverride = null), + (r.useConstantAnimationDeltaTime = false), + (r.constantlyUpdateMeshUnderPointer = false), + (r.hoverCursor = "pointer"), + (r.defaultCursor = ""), + (r.preventDefaultOnPointerDown = true), + (r.preventDefaultOnPointerUp = true), + (r.metadata = null), + (r.reservedDataStore = null), + (r.disableOfflineSupportExceptionRules = new Array()), + (r.onDisposeObservable = new s.c()), + (r._onDisposeObserver = null), + (r.onBeforeRenderObservable = new s.c()), + (r._onBeforeRenderObserver = null), + (r.onAfterRenderObservable = new s.c()), + (r._onAfterRenderObserver = null), + (r.onBeforeAnimationsObservable = new s.c()), + (r.onAfterAnimationsObservable = new s.c()), + (r.onBeforeDrawPhaseObservable = new s.c()), + (r.onAfterDrawPhaseObservable = new s.c()), + (r.onReadyObservable = new s.c()), + (r.onBeforeCameraRenderObservable = new s.c()), + (r._onBeforeCameraRenderObserver = null), + (r.onAfterCameraRenderObservable = new s.c()), + (r._onAfterCameraRenderObserver = null), + (r.onBeforeActiveMeshesEvaluationObservable = new s.c()), + (r.onAfterActiveMeshesEvaluationObservable = new s.c()), + (r.onBeforeParticlesRenderingObservable = new s.c()), + (r.onAfterParticlesRenderingObservable = new s.c()), + (r.onDataLoadedObservable = new s.c()), + (r.onNewCameraAddedObservable = new s.c()), + (r.onCameraRemovedObservable = new s.c()), + (r.onNewLightAddedObservable = new s.c()), + (r.onLightRemovedObservable = new s.c()), + (r.onNewGeometryAddedObservable = new s.c()), + (r.onGeometryRemovedObservable = new s.c()), + (r.onNewTransformNodeAddedObservable = new s.c()), + (r.onTransformNodeRemovedObservable = new s.c()), + (r.onNewMeshAddedObservable = new s.c()), + (r.onMeshRemovedObservable = new s.c()), + (r.onNewSkeletonAddedObservable = new s.c()), + (r.onSkeletonRemovedObservable = new s.c()), + (r.onNewMaterialAddedObservable = new s.c()), + (r.onMaterialRemovedObservable = new s.c()), + (r.onNewTextureAddedObservable = new s.c()), + (r.onTextureRemovedObservable = new s.c()), + (r.onBeforeRenderTargetsRenderObservable = new s.c()), + (r.onAfterRenderTargetsRenderObservable = new s.c()), + (r.onBeforeStepObservable = new s.c()), + (r.onAfterStepObservable = new s.c()), + (r.onActiveCameraChanged = new s.c()), + (r.onBeforeRenderingGroupObservable = new s.c()), + (r.onAfterRenderingGroupObservable = new s.c()), + (r.onMeshImportedObservable = new s.c()), + (r._registeredForLateAnimationBindings = new c.b(256)), + (r.onPrePointerObservable = new s.c()), + (r.onPointerObservable = new s.c()), + (r.onPreKeyboardObservable = new s.c()), + (r.onKeyboardObservable = new s.c()), + (r._useRightHandedSystem = false), + (r._timeAccumulator = 0), + (r._currentStepId = 0), + (r._currentInternalStep = 0), + (r._fogEnabled = true), + (r._fogMode = t.FOGMODE_NONE), + (r.fogColor = new h.e(0.2, 0.2, 0.3)), + (r.fogDensity = 0.1), + (r.fogStart = 0), + (r.fogEnd = 1e3), + (r._shadowsEnabled = true), + (r._lightsEnabled = true), + (r.activeCameras = new Array()), + (r._texturesEnabled = true), + (r.particlesEnabled = true), + (r.spritesEnabled = true), + (r._skeletonsEnabled = true), + (r.lensFlaresEnabled = true), + (r.collisionsEnabled = true), + (r.gravity = new h.x(0, -9.807, 0)), + (r.postProcessesEnabled = true), + (r.postProcesses = new Array()), + (r.renderTargetsEnabled = true), + (r.dumpNextRenderTargets = false), + (r.customRenderTargets = new Array()), + (r.importedMeshesFiles = new Array()), + (r.probesEnabled = true), + (r._meshesForIntersections = new c.b(256)), + (r.proceduralTexturesEnabled = true), + (r._totalVertices = new o.f()), + (r._activeIndices = new o.f()), + (r._activeParticles = new o.f()), + (r._activeBones = new o.f()), + (r._animationTime = 0), + (r.animationTimeScale = 1), + (r._renderId = 0), + (r._frameId = 0), + (r._executeWhenReadyTimeoutId = -1), + (r._intermediateRendering = false), + (r._viewUpdateFlag = -1), + (r._projectionUpdateFlag = -1), + (r._toBeDisposed = new Array(256)), + (r._activeRequests = new Array()), + (r._pendingData = new Array()), + (r._isDisposed = false), + (r.dispatchAllSubMeshesOfActiveMeshes = false), + (r._activeMeshes = new c.a(256)), + (r._processedMaterials = new c.a(256)), + (r._renderTargets = new c.b(256)), + (r._activeParticleSystems = new c.a(256)), + (r._activeSkeletons = new c.b(32)), + (r._softwareSkinnedMeshes = new c.b(32)), + (r._activeAnimatables = new Array()), + (r._transformMatrix = h.j.Zero()), + (r.requireLightSorting = false), + (r._components = []), + (r._serializableComponents = []), + (r._transientComponents = []), + (r._beforeCameraUpdateStage = A.b.Create()), + (r._beforeClearStage = A.b.Create()), + (r._gatherRenderTargetsStage = A.b.Create()), + (r._gatherActiveCameraRenderTargetsStage = A.b.Create()), + (r._isReadyForMeshStage = A.b.Create()), + (r._beforeEvaluateActiveMeshStage = A.b.Create()), + (r._evaluateSubMeshStage = A.b.Create()), + (r._activeMeshStage = A.b.Create()), + (r._cameraDrawRenderTargetStage = A.b.Create()), + (r._beforeCameraDrawStage = A.b.Create()), + (r._beforeRenderTargetDrawStage = A.b.Create()), + (r._beforeRenderingGroupDrawStage = A.b.Create()), + (r._beforeRenderingMeshStage = A.b.Create()), + (r._afterRenderingMeshStage = A.b.Create()), + (r._afterRenderingGroupDrawStage = A.b.Create()), + (r._afterCameraDrawStage = A.b.Create()), + (r._afterRenderTargetDrawStage = A.b.Create()), + (r._afterRenderStage = A.b.Create()), + (r._pointerMoveStage = A.b.Create()), + (r._pointerDownStage = A.b.Create()), + (r._pointerUpStage = A.b.Create()), + (r.geometriesByUniqueId = null), + (r._defaultMeshCandidates = { + data: [], + length: 0, }), - Object.defineProperty(t.prototype, "imageProcessingConfiguration", { - get: function() { - return this._imageProcessingConfiguration - }, - enumerable: true, - configurable: true + (r._defaultSubMeshCandidates = { + data: [], + length: 0, }), - Object.defineProperty(t.prototype, "forceWireframe", { - get: function() { - return this._forceWireframe - }, - set: function(e) { - this._forceWireframe !== e && (this._forceWireframe = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_MiscDirtyFlag)) - }, - enumerable: true, - configurable: true + (r._preventFreeActiveMeshesAndRenderingGroups = false), + (r._activeMeshesFrozen = false), + (r._allowPostProcessClearColor = true), + (r.getDeterministicFrameTime = function () { + return 1e3 / 60; }), - Object.defineProperty(t.prototype, "forcePointsCloud", { - get: function() { - return this._forcePointsCloud - }, - set: function(e) { - this._forcePointsCloud !== e && (this._forcePointsCloud = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_MiscDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "animationPropertiesOverride", { - get: function() { - return this._animationPropertiesOverride - }, - set: function(e) { - this._animationPropertiesOverride = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onDispose", { - set: function(e) { - this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), - this._onDisposeObserver = this.onDisposeObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "beforeRender", { - set: function(e) { - this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), - e && (this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "afterRender", { - set: function(e) { - this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), - e && (this._onAfterRenderObserver = this.onAfterRenderObservable.add(e)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "beforeCameraRender", { - set: function(e) { - this._onBeforeCameraRenderObserver && this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), - this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "afterCameraRender", { - set: function(e) { - this._onAfterCameraRenderObserver && this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver), - this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "unTranslatedPointer", { - get: function() { - return this._inputManager.unTranslatedPointer - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t, "DragMovementThreshold", { - get: function() { - return D.DragMovementThreshold - }, - set: function(e) { - D.DragMovementThreshold = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t, "LongPressDelay", { - get: function() { - return D.LongPressDelay - }, - set: function(e) { - D.LongPressDelay = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t, "DoubleClickDelay", { - get: function() { - return D.DoubleClickDelay - }, - set: function(e) { - D.DoubleClickDelay = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t, "ExclusiveDoubleClickMode", { - get: function() { - return D.ExclusiveDoubleClickMode - }, - set: function(e) { - D.ExclusiveDoubleClickMode = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "useRightHandedSystem", { - get: function() { - return this._useRightHandedSystem - }, - set: function(e) { - this._useRightHandedSystem !== e && (this._useRightHandedSystem = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_MiscDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - t.prototype.setStepId = function(e) { - this._currentStepId = e - } - , - t.prototype.getStepId = function() { - return this._currentStepId - } - , - t.prototype.getInternalStep = function() { - return this._currentInternalStep - } - , - Object.defineProperty(t.prototype, "fogEnabled", { - get: function() { - return this._fogEnabled - }, - set: function(e) { - this._fogEnabled !== e && (this._fogEnabled = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_MiscDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "fogMode", { - get: function() { - return this._fogMode - }, - set: function(e) { - this._fogMode !== e && (this._fogMode = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_MiscDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "shadowsEnabled", { - get: function() { - return this._shadowsEnabled - }, - set: function(e) { - this._shadowsEnabled !== e && (this._shadowsEnabled = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_LightDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "lightsEnabled", { - get: function() { - return this._lightsEnabled - }, - set: function(e) { - this._lightsEnabled !== e && (this._lightsEnabled = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_LightDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "activeCamera", { - get: function() { - return this._activeCamera - }, - set: function(e) { - e !== this._activeCamera && (this._activeCamera = e, - this.onActiveCameraChanged.notifyObservers(this)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "defaultMaterial", { - get: function() { - return this._defaultMaterial || (this._defaultMaterial = t.DefaultMaterialFactory(this)), - this._defaultMaterial - }, - set: function(e) { - this._defaultMaterial = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "texturesEnabled", { - get: function() { - return this._texturesEnabled - }, - set: function(e) { - this._texturesEnabled !== e && (this._texturesEnabled = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "skeletonsEnabled", { - get: function() { - return this._skeletonsEnabled - }, - set: function(e) { - this._skeletonsEnabled !== e && (this._skeletonsEnabled = e, - this.markAllMaterialsAsDirty(x.a.MATERIAL_AttributesDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "collisionCoordinator", { - get: function() { - return this._collisionCoordinator || (this._collisionCoordinator = t.CollisionCoordinatorFactory(), - this._collisionCoordinator.init(this)), - this._collisionCoordinator - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "frustumPlanes", { - get: function() { - return this._frustumPlanes - }, - enumerable: true, - configurable: true - }), - t.prototype._registerTransientComponents = function() { - if (this._transientComponents.length > 0) { - for (var e = 0, t = this._transientComponents; e < t.length; e++) - t[e].register(); - this._transientComponents = [] - } - } - , - t.prototype._addComponent = function(e) { - this._components.push(e), - this._transientComponents.push(e); - var t = e; - t.addFromContainer && this._serializableComponents.push(t) - } - , - t.prototype._getComponent = function(e) { - for (var t = 0, i = this._components; t < i.length; t++) { - var n = i[t]; - if (n.name === e) - return n - } - return null - } - , - t.prototype.getClassName = function() { - return "Scene" - } - , - t.prototype._getDefaultMeshCandidates = function() { - return this._defaultMeshCandidates.data = this.meshes, - this._defaultMeshCandidates.length = this.meshes.length, - this._defaultMeshCandidates - } - , - t.prototype._getDefaultSubMeshCandidates = function(e) { - return this._defaultSubMeshCandidates.data = e.subMeshes, - this._defaultSubMeshCandidates.length = e.subMeshes.length, - this._defaultSubMeshCandidates - } - , - t.prototype.setDefaultCandidateProviders = function() { - this.getActiveMeshCandidates = this._getDefaultMeshCandidates.bind(this), - this.getActiveSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this), - this.getIntersectingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this), - this.getCollidingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this) - } - , - Object.defineProperty(t.prototype, "meshUnderPointer", { - get: function() { - return this._inputManager.meshUnderPointer - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "pointerX", { - get: function() { - return this._inputManager.pointerX - }, - set: function(e) { - this._inputManager.pointerX = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "pointerY", { - get: function() { - return this._inputManager.pointerY - }, - set: function(e) { - this._inputManager.pointerY = e - }, - enumerable: true, - configurable: true - }), - t.prototype.getCachedMaterial = function() { - return this._cachedMaterial - } - , - t.prototype.getCachedEffect = function() { - return this._cachedEffect - } - , - t.prototype.getCachedVisibility = function() { - return this._cachedVisibility - } - , - t.prototype.isCachedMaterialInvalid = function(e, t, i) { - return void 0 === i && (i = 1), - this._cachedEffect !== t || this._cachedMaterial !== e || this._cachedVisibility !== i - } - , - t.prototype.getEngine = function() { - return this._engine - } - , - t.prototype.getTotalVertices = function() { - return this._totalVertices.current - } - , - Object.defineProperty(t.prototype, "totalVerticesPerfCounter", { - get: function() { - return this._totalVertices - }, - enumerable: true, - configurable: true - }), - t.prototype.getActiveIndices = function() { - return this._activeIndices.current - } - , - Object.defineProperty(t.prototype, "totalActiveIndicesPerfCounter", { - get: function() { - return this._activeIndices - }, - enumerable: true, - configurable: true - }), - t.prototype.getActiveParticles = function() { - return this._activeParticles.current - } - , - Object.defineProperty(t.prototype, "activeParticlesPerfCounter", { - get: function() { - return this._activeParticles - }, - enumerable: true, - configurable: true - }), - t.prototype.getActiveBones = function() { - return this._activeBones.current - } - , - Object.defineProperty(t.prototype, "activeBonesPerfCounter", { - get: function() { - return this._activeBones - }, - enumerable: true, - configurable: true - }), - t.prototype.getActiveMeshes = function() { - return this._activeMeshes - } - , - t.prototype.getAnimationRatio = function() { - return void 0 !== this._animationRatio ? this._animationRatio : 1 - } - , - t.prototype.getRenderId = function() { - return this._renderId - } - , - t.prototype.getFrameId = function() { - return this._frameId - } - , - t.prototype.incrementRenderId = function() { - this._renderId++ - } - , - t.prototype._createUbo = function() { - this._sceneUbo = new _.a(this._engine,void 0,true), - this._sceneUbo.addUniform("viewProjection", 16), - this._sceneUbo.addUniform("view", 16) - } - , - t.prototype.simulatePointerMove = function(e, t) { - return this._inputManager.simulatePointerMove(e, t), - this - } - , - t.prototype.simulatePointerDown = function(e, t) { - return this._inputManager.simulatePointerDown(e, t), - this - } - , - t.prototype.simulatePointerUp = function(e, t, i) { - return this._inputManager.simulatePointerUp(e, t, i), - this - } - , - t.prototype.isPointerCaptured = function(e) { - return void 0 === e && (e = 0), - this._inputManager.isPointerCaptured(e) - } - , - t.prototype.attachControl = function(e, t, i) { - void 0 === e && (e = true), - void 0 === t && (t = true), - void 0 === i && (i = true), - this._inputManager.attachControl(e, t, i) - } - , - t.prototype.detachControl = function() { - this._inputManager.detachControl() - } - , - t.prototype.isReady = function() { - if (this._isDisposed) - return false; - var e, t = this.getEngine(); - if (!t.areAllEffectsReady()) - return false; - if (this._pendingData.length > 0) - return false; - for (e = 0; e < this.meshes.length; e++) { - var i = this.meshes[e]; - if (i.isEnabled() && i.subMeshes && 0 !== i.subMeshes.length) { - if (!i.isReady(true)) - return false; - for (var n = "InstancedMesh" === i.getClassName() || "InstancedLinesMesh" === i.getClassName() || t.getCaps().instancedArrays && i.instances.length > 0, r = 0, o = this._isReadyForMeshStage; r < o.length; r++) - if (!o[r].action(i, n)) - return false - } - } - for (e = 0; e < this.geometries.length; e++) - if (this.geometries[e].delayLoadState === x.a.DELAYLOADSTATE_LOADING) - return false; - if (this.activeCameras && this.activeCameras.length > 0) { - for (var a = 0, s = this.activeCameras; a < s.length; a++) - if (!s[a].isReady(true)) - return false - } else if (this.activeCamera && !this.activeCamera.isReady(true)) - return false; - for (var c = 0, u = this.particleSystems; c < u.length; c++) - if (!u[c].isReady()) - return false; - return true - } - , - t.prototype.resetCachedMaterial = function() { - this._cachedMaterial = null, - this._cachedEffect = null, - this._cachedVisibility = null - } - , - t.prototype.registerBeforeRender = function(e) { - this.onBeforeRenderObservable.add(e) - } - , - t.prototype.unregisterBeforeRender = function(e) { - this.onBeforeRenderObservable.removeCallback(e) - } - , - t.prototype.registerAfterRender = function(e) { - this.onAfterRenderObservable.add(e) - } - , - t.prototype.unregisterAfterRender = function(e) { - this.onAfterRenderObservable.removeCallback(e) - } - , - t.prototype._executeOnceBeforeRender = function(e) { - var t = this; - this.registerBeforeRender(function i() { - e(), - setTimeout(function() { - t.unregisterBeforeRender(i) - }) - }) - } - , - t.prototype.executeOnceBeforeRender = function(e, t) { - var i = this; - void 0 !== t ? setTimeout(function() { - i._executeOnceBeforeRender(e) - }, t) : this._executeOnceBeforeRender(e) - } - , - t.prototype._addPendingData = function(e) { - this._pendingData.push(e) - } - , - t.prototype._removePendingData = function(e) { - var t = this.isLoading - , i = this._pendingData.indexOf(e); - -1 !== i && this._pendingData.splice(i, 1), - t && !this.isLoading && this.onDataLoadedObservable.notifyObservers(this) - } - , - t.prototype.getWaitingItemsCount = function() { - return this._pendingData.length - } - , - Object.defineProperty(t.prototype, "isLoading", { - get: function() { - return this._pendingData.length > 0 - }, - enumerable: true, - configurable: true - }), - t.prototype.executeWhenReady = function(e) { - var t = this; - this.onReadyObservable.add(e), - -1 === this._executeWhenReadyTimeoutId && (this._executeWhenReadyTimeoutId = setTimeout(function() { - t._checkIsReady() - }, 150)) - } - , - t.prototype.whenReadyAsync = function() { - var e = this; - return new i(function(t) { - e.executeWhenReady(function() { - t() - }) - } - ) - } - , - t.prototype._checkIsReady = function() { - var e = this; - if (this._registerTransientComponents(), - this.isReady()) - return this.onReadyObservable.notifyObservers(this), - this.onReadyObservable.clear(), - void (this._executeWhenReadyTimeoutId = -1); - this._executeWhenReadyTimeoutId = setTimeout(function() { - e._checkIsReady() - }, 150) - } - , - Object.defineProperty(t.prototype, "animatables", { - get: function() { - return this._activeAnimatables - }, - enumerable: true, - configurable: true - }), - t.prototype.resetLastAnimationTimeFrame = function() { - this._animationTimeLast = a.a.Now - } - , - t.prototype.getViewMatrix = function() { - return this._viewMatrix - } - , - t.prototype.getProjectionMatrix = function() { - return this._projectionMatrix - } - , - t.prototype.getTransformMatrix = function() { - return this._transformMatrix - } - , - t.prototype.setTransformMatrix = function(e, t, i, n) { - this._viewUpdateFlag === e.updateFlag && this._projectionUpdateFlag === t.updateFlag || (this._viewUpdateFlag = e.updateFlag, - this._projectionUpdateFlag = t.updateFlag, - this._viewMatrix = e, - this._projectionMatrix = t, - this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix), - this._frustumPlanes ? h.i.GetPlanesToRef(this._transformMatrix, this._frustumPlanes) : this._frustumPlanes = h.i.GetPlanes(this._transformMatrix), - this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo ? this._updateMultiviewUbo(i, n) : this._sceneUbo.useUbo && (this._sceneUbo.updateMatrix("viewProjection", this._transformMatrix), - this._sceneUbo.updateMatrix("view", this._viewMatrix), - this._sceneUbo.update())) - } - , - t.prototype.getSceneUniformBuffer = function() { - return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo - } - , - t.prototype.getUniqueId = function() { - var e = t._uniqueIdCounter; - return t._uniqueIdCounter++, - e - } - , - t.prototype.addMesh = function(e, t) { - var i = this; - void 0 === t && (t = false), - this.meshes.push(e), - e._resyncLightSources(), - this.onNewMeshAddedObservable.notifyObservers(e), - t && e.getChildMeshes().forEach(function(e) { - i.addMesh(e) - }) - } - , - t.prototype.removeMesh = function(e, t) { - var i = this; - void 0 === t && (t = false); - var n = this.meshes.indexOf(e); - return -1 !== n && (this.meshes[n] = this.meshes[this.meshes.length - 1], - this.meshes.pop()), - this.onMeshRemovedObservable.notifyObservers(e), - t && e.getChildMeshes().forEach(function(e) { - i.removeMesh(e) - }), - n - } - , - t.prototype.addTransformNode = function(e) { - e._indexInSceneTransformNodesArray = this.transformNodes.length, - this.transformNodes.push(e), - this.onNewTransformNodeAddedObservable.notifyObservers(e) - } - , - t.prototype.removeTransformNode = function(e) { - var t = e._indexInSceneTransformNodesArray; - if (-1 !== t) { - if (t !== this.transformNodes.length - 1) { - var i = this.transformNodes[this.transformNodes.length - 1]; - this.transformNodes[t] = i, - i._indexInSceneTransformNodesArray = t - } - e._indexInSceneTransformNodesArray = -1, - this.transformNodes.pop() - } - return this.onTransformNodeRemovedObservable.notifyObservers(e), - t - } - , - t.prototype.removeSkeleton = function(e) { - var t = this.skeletons.indexOf(e); - return -1 !== t && (this.skeletons.splice(t, 1), - this.onSkeletonRemovedObservable.notifyObservers(e)), - t - } - , - t.prototype.removeMorphTargetManager = function(e) { - var t = this.morphTargetManagers.indexOf(e); - return -1 !== t && this.morphTargetManagers.splice(t, 1), - t - } - , - t.prototype.removeLight = function(e) { - var t = this.lights.indexOf(e); - if (-1 !== t) { - for (var i = 0, n = this.meshes; i < n.length; i++) - n[i]._removeLightSource(e); - this.lights.splice(t, 1), - this.sortLightsByPriority() - } - return this.onLightRemovedObservable.notifyObservers(e), - t - } - , - t.prototype.removeCamera = function(e) { - var t = this.cameras.indexOf(e); - -1 !== t && this.cameras.splice(t, 1); - var i = this.activeCameras.indexOf(e); - return -1 !== i && this.activeCameras.splice(i, 1), - this.activeCamera === e && (this.cameras.length > 0 ? this.activeCamera = this.cameras[0] : this.activeCamera = null), - this.onCameraRemovedObservable.notifyObservers(e), - t - } - , - t.prototype.removeParticleSystem = function(e) { - var t = this.particleSystems.indexOf(e); - return -1 !== t && this.particleSystems.splice(t, 1), - t - } - , - t.prototype.removeAnimation = function(e) { - var t = this.animations.indexOf(e); - return -1 !== t && this.animations.splice(t, 1), - t - } - , - t.prototype.stopAnimation = function(e, t, i) {} - , - t.prototype.removeAnimationGroup = function(e) { - var t = this.animationGroups.indexOf(e); - return -1 !== t && this.animationGroups.splice(t, 1), - t - } - , - t.prototype.removeMultiMaterial = function(e) { - var t = this.multiMaterials.indexOf(e); - return -1 !== t && this.multiMaterials.splice(t, 1), - t - } - , - t.prototype.removeMaterial = function(e) { - var t = e._indexInSceneMaterialArray; - if (-1 !== t && t < this.materials.length) { - if (t !== this.materials.length - 1) { - var i = this.materials[this.materials.length - 1]; - this.materials[t] = i, - i._indexInSceneMaterialArray = t - } - e._indexInSceneMaterialArray = -1, - this.materials.pop() - } - return this.onMaterialRemovedObservable.notifyObservers(e), - t - } - , - t.prototype.removeActionManager = function(e) { - var t = this.actionManagers.indexOf(e); - return -1 !== t && this.actionManagers.splice(t, 1), - t - } - , - t.prototype.removeTexture = function(e) { - var t = this.textures.indexOf(e); - return -1 !== t && this.textures.splice(t, 1), - this.onTextureRemovedObservable.notifyObservers(e), - t - } - , - t.prototype.addLight = function(e) { - this.lights.push(e), - this.sortLightsByPriority(); - for (var t = 0, i = this.meshes; t < i.length; t++) { - var n = i[t]; - -1 === n.lightSources.indexOf(e) && (n.lightSources.push(e), - n._resyncLightSources()) - } - this.onNewLightAddedObservable.notifyObservers(e) - } - , - t.prototype.sortLightsByPriority = function() { - this.requireLightSorting && this.lights.sort(v.a.CompareLightsPriority) - } - , - t.prototype.addCamera = function(e) { - this.cameras.push(e), - this.onNewCameraAddedObservable.notifyObservers(e) - } - , - t.prototype.addSkeleton = function(e) { - this.skeletons.push(e), - this.onNewSkeletonAddedObservable.notifyObservers(e) - } - , - t.prototype.addParticleSystem = function(e) { - this.particleSystems.push(e) - } - , - t.prototype.addAnimation = function(e) { - this.animations.push(e) - } - , - t.prototype.addAnimationGroup = function(e) { - this.animationGroups.push(e) - } - , - t.prototype.addMultiMaterial = function(e) { - this.multiMaterials.push(e) - } - , - t.prototype.addMaterial = function(e) { - e._indexInSceneMaterialArray = this.materials.length, - this.materials.push(e), - this.onNewMaterialAddedObservable.notifyObservers(e) - } - , - t.prototype.addMorphTargetManager = function(e) { - this.morphTargetManagers.push(e) - } - , - t.prototype.addGeometry = function(e) { - this.geometriesByUniqueId && (this.geometriesByUniqueId[e.uniqueId] = this.geometries.length), - this.geometries.push(e) - } - , - t.prototype.addActionManager = function(e) { - this.actionManagers.push(e) - } - , - t.prototype.addTexture = function(e) { - this.textures.push(e), - this.onNewTextureAddedObservable.notifyObservers(e) - } - , - t.prototype.switchActiveCamera = function(e, t) { - void 0 === t && (t = true); - var i = this._engine.getRenderingCanvas(); - i && (this.activeCamera && this.activeCamera.detachControl(i), - this.activeCamera = e, - t && e.attachControl(i)) - } - , - t.prototype.setActiveCameraByID = function(e) { - var t = this.getCameraByID(e); - return t ? (this.activeCamera = t, - t) : null - } - , - t.prototype.setActiveCameraByName = function(e) { - var t = this.getCameraByName(e); - return t ? (this.activeCamera = t, - t) : null - } - , - t.prototype.getAnimationGroupByName = function(e) { - for (var t = 0; t < this.animationGroups.length; t++) - if (this.animationGroups[t].name === e) - return this.animationGroups[t]; - return null - } - , - t.prototype.getMaterialByUniqueID = function(e) { - for (var t = 0; t < this.materials.length; t++) - if (this.materials[t].uniqueId === e) - return this.materials[t]; - return null - } - , - t.prototype.getMaterialByID = function(e) { - for (var t = 0; t < this.materials.length; t++) - if (this.materials[t].id === e) - return this.materials[t]; - return null - } - , - t.prototype.getMaterialByName = function(e) { - for (var t = 0; t < this.materials.length; t++) - if (this.materials[t].name === e) - return this.materials[t]; - return null - } - , - t.prototype.getCameraByID = function(e) { - for (var t = 0; t < this.cameras.length; t++) - if (this.cameras[t].id === e) - return this.cameras[t]; - return null - } - , - t.prototype.getCameraByUniqueID = function(e) { - for (var t = 0; t < this.cameras.length; t++) - if (this.cameras[t].uniqueId === e) - return this.cameras[t]; - return null - } - , - t.prototype.getCameraByName = function(e) { - for (var t = 0; t < this.cameras.length; t++) - if (this.cameras[t].name === e) - return this.cameras[t]; - return null - } - , - t.prototype.getBoneByID = function(e) { - for (var t = 0; t < this.skeletons.length; t++) - for (var i = this.skeletons[t], n = 0; n < i.bones.length; n++) - if (i.bones[n].id === e) - return i.bones[n]; - return null - } - , - t.prototype.getBoneByName = function(e) { - for (var t = 0; t < this.skeletons.length; t++) - for (var i = this.skeletons[t], n = 0; n < i.bones.length; n++) - if (i.bones[n].name === e) - return i.bones[n]; - return null - } - , - t.prototype.getLightByName = function(e) { - for (var t = 0; t < this.lights.length; t++) - if (this.lights[t].name === e) - return this.lights[t]; - return null - } - , - t.prototype.getLightByID = function(e) { - for (var t = 0; t < this.lights.length; t++) - if (this.lights[t].id === e) - return this.lights[t]; - return null - } - , - t.prototype.getLightByUniqueID = function(e) { - for (var t = 0; t < this.lights.length; t++) - if (this.lights[t].uniqueId === e) - return this.lights[t]; - return null - } - , - t.prototype.getParticleSystemByID = function(e) { - for (var t = 0; t < this.particleSystems.length; t++) - if (this.particleSystems[t].id === e) - return this.particleSystems[t]; - return null - } - , - t.prototype.getGeometryByID = function(e) { - for (var t = 0; t < this.geometries.length; t++) - if (this.geometries[t].id === e) - return this.geometries[t]; - return null - } - , - t.prototype._getGeometryByUniqueID = function(e) { - if (this.geometriesByUniqueId) { - var t = this.geometriesByUniqueId[e]; - if (void 0 !== t) - return this.geometries[t] - } else - for (var i = 0; i < this.geometries.length; i++) - if (this.geometries[i].uniqueId === e) - return this.geometries[i]; - return null - } - , - t.prototype.pushGeometry = function(e, t) { - return !(!t && this._getGeometryByUniqueID(e.uniqueId) || (this.addGeometry(e), - this.onNewGeometryAddedObservable.notifyObservers(e), - 0)) - } - , - t.prototype.removeGeometry = function(e) { - var t; - if (this.geometriesByUniqueId) { - if (void 0 === (t = this.geometriesByUniqueId[e.uniqueId])) - return false - } else if ((t = this.geometries.indexOf(e)) < 0) - return false; - if (t !== this.geometries.length - 1) { - var i = this.geometries[this.geometries.length - 1]; - this.geometries[t] = i, - this.geometriesByUniqueId && (this.geometriesByUniqueId[i.uniqueId] = t, - this.geometriesByUniqueId[e.uniqueId] = void 0) - } - return this.geometries.pop(), - this.onGeometryRemovedObservable.notifyObservers(e), - true - } - , - t.prototype.getGeometries = function() { - return this.geometries - } - , - t.prototype.getMeshByID = function(e) { - for (var t = 0; t < this.meshes.length; t++) - if (this.meshes[t].id === e) - return this.meshes[t]; - return null - } - , - t.prototype.getMeshesByID = function(e) { - return this.meshes.filter(function(t) { - return t.id === e - }) - } - , - t.prototype.getTransformNodeByID = function(e) { - for (var t = 0; t < this.transformNodes.length; t++) - if (this.transformNodes[t].id === e) - return this.transformNodes[t]; - return null - } - , - t.prototype.getTransformNodeByUniqueID = function(e) { - for (var t = 0; t < this.transformNodes.length; t++) - if (this.transformNodes[t].uniqueId === e) - return this.transformNodes[t]; - return null - } - , - t.prototype.getTransformNodesByID = function(e) { - return this.transformNodes.filter(function(t) { - return t.id === e - }) - } - , - t.prototype.getMeshByUniqueID = function(e) { - for (var t = 0; t < this.meshes.length; t++) - if (this.meshes[t].uniqueId === e) - return this.meshes[t]; - return null - } - , - t.prototype.getLastMeshByID = function(e) { - for (var t = this.meshes.length - 1; t >= 0; t--) - if (this.meshes[t].id === e) - return this.meshes[t]; - return null - } - , - t.prototype.getLastEntryByID = function(e) { - var t; - for (t = this.meshes.length - 1; t >= 0; t--) - if (this.meshes[t].id === e) - return this.meshes[t]; - for (t = this.transformNodes.length - 1; t >= 0; t--) - if (this.transformNodes[t].id === e) - return this.transformNodes[t]; - for (t = this.cameras.length - 1; t >= 0; t--) - if (this.cameras[t].id === e) - return this.cameras[t]; - for (t = this.lights.length - 1; t >= 0; t--) - if (this.lights[t].id === e) - return this.lights[t]; - return null - } - , - t.prototype.getNodeByID = function(e) { - var t = this.getMeshByID(e); - if (t) - return t; - var i = this.getTransformNodeByID(e); - if (i) - return i; - var n = this.getLightByID(e); - if (n) - return n; - var r = this.getCameraByID(e); - return r || (this.getBoneByID(e) || null) - } - , - t.prototype.getNodeByName = function(e) { - var t = this.getMeshByName(e); - if (t) - return t; - var i = this.getTransformNodeByName(e); - if (i) - return i; - var n = this.getLightByName(e); - if (n) - return n; - var r = this.getCameraByName(e); - return r || (this.getBoneByName(e) || null) - } - , - t.prototype.getMeshByName = function(e) { - for (var t = 0; t < this.meshes.length; t++) - if (this.meshes[t].name === e) - return this.meshes[t]; - return null - } - , - t.prototype.getTransformNodeByName = function(e) { - for (var t = 0; t < this.transformNodes.length; t++) - if (this.transformNodes[t].name === e) - return this.transformNodes[t]; - return null - } - , - t.prototype.getLastSkeletonByID = function(e) { - for (var t = this.skeletons.length - 1; t >= 0; t--) - if (this.skeletons[t].id === e) - return this.skeletons[t]; - return null - } - , - t.prototype.getSkeletonByUniqueId = function(e) { - for (var t = 0; t < this.skeletons.length; t++) - if (this.skeletons[t].uniqueId === e) - return this.skeletons[t]; - return null - } - , - t.prototype.getSkeletonById = function(e) { - for (var t = 0; t < this.skeletons.length; t++) - if (this.skeletons[t].id === e) - return this.skeletons[t]; - return null - } - , - t.prototype.getSkeletonByName = function(e) { - for (var t = 0; t < this.skeletons.length; t++) - if (this.skeletons[t].name === e) - return this.skeletons[t]; - return null - } - , - t.prototype.getMorphTargetManagerById = function(e) { - for (var t = 0; t < this.morphTargetManagers.length; t++) - if (this.morphTargetManagers[t].uniqueId === e) - return this.morphTargetManagers[t]; - return null - } - , - t.prototype.getMorphTargetById = function(e) { - for (var t = 0; t < this.morphTargetManagers.length; ++t) - for (var i = this.morphTargetManagers[t], n = 0; n < i.numTargets; ++n) { - var r = i.getTarget(n); - if (r.id === e) - return r - } - return null - } - , - t.prototype.isActiveMesh = function(e) { - return -1 !== this._activeMeshes.indexOf(e) - } - , - Object.defineProperty(t.prototype, "uid", { - get: function() { - return this._uid || (this._uid = o.h.RandomId()), - this._uid - }, - enumerable: true, - configurable: true - }), - t.prototype.addExternalData = function(e, t) { - return this._externalData || (this._externalData = new u.a), - this._externalData.add(e, t) - } - , - t.prototype.getExternalData = function(e) { - return this._externalData ? this._externalData.get(e) : null - } - , - t.prototype.getOrAddExternalDataWithFactory = function(e, t) { - return this._externalData || (this._externalData = new u.a), - this._externalData.getOrAddWithFactory(e, t) - } - , - t.prototype.removeExternalData = function(e) { - return this._externalData.remove(e) - } - , - t.prototype._evaluateSubMesh = function(e, t, i) { - if (i.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || t.alwaysSelectAsActiveMesh || 1 === t.subMeshes.length || e.isInFrustum(this._frustumPlanes)) { - for (var n = 0, r = this._evaluateSubMeshStage; n < r.length; n++) - r[n].action(t, e); - var o = e.getMaterial(); - null != o && (o.hasRenderTargetTextures && null != o.getRenderTargetTextures && -1 === this._processedMaterials.indexOf(o) && (this._processedMaterials.push(o), - this._renderTargets.concatWithNoDuplicate(o.getRenderTargetTextures())), - this._activeIndices.addCount(e.indexCount, false), - this._renderingManager.dispatch(e, t, o)) - } - } - , - t.prototype.freeProcessedMaterials = function() { - this._processedMaterials.dispose() - } - , - Object.defineProperty(t.prototype, "blockfreeActiveMeshesAndRenderingGroups", { - get: function() { - return this._preventFreeActiveMeshesAndRenderingGroups - }, - set: function(e) { - this._preventFreeActiveMeshesAndRenderingGroups !== e && (e && (this.freeActiveMeshes(), - this.freeRenderingGroups()), - this._preventFreeActiveMeshesAndRenderingGroups = e) - }, - enumerable: true, - configurable: true - }), - t.prototype.freeActiveMeshes = function() { - if (!this.blockfreeActiveMeshesAndRenderingGroups && (this._activeMeshes.dispose(), - this.activeCamera && this.activeCamera._activeMeshes && this.activeCamera._activeMeshes.dispose(), - this.activeCameras)) - for (var e = 0; e < this.activeCameras.length; e++) { - var t = this.activeCameras[e]; - t && t._activeMeshes && t._activeMeshes.dispose() - } - } - , - t.prototype.freeRenderingGroups = function() { - if (!this.blockfreeActiveMeshesAndRenderingGroups && (this._renderingManager && this._renderingManager.freeRenderingGroups(), - this.textures)) - for (var e = 0; e < this.textures.length; e++) { - var t = this.textures[e]; - t && t.renderList && t.freeRenderingGroups() - } - } - , - t.prototype._isInIntermediateRendering = function() { - return this._intermediateRendering - } - , - t.prototype.freezeActiveMeshes = function() { - if (!this.activeCamera) - return this; - this._frustumPlanes || this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix()), - this._evaluateActiveMeshes(), - this._activeMeshesFrozen = true; - for (var e = 0; e < this._activeMeshes.length; e++) - this._activeMeshes.data[e]._freeze(); - return this - } - , - t.prototype.unfreezeActiveMeshes = function() { - for (var e = 0; e < this._activeMeshes.length; e++) - this._activeMeshes.data[e]._unFreeze(); - return this._activeMeshesFrozen = false, - this - } - , - t.prototype._evaluateActiveMeshes = function() { - if (this._activeMeshesFrozen && this._activeMeshes.length) - for (var e = this._activeMeshes.length, t = 0; t < e; t++) - (a = this._activeMeshes.data[t]).computeWorldMatrix(); - else if (this.activeCamera) { - this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this), - this.activeCamera._activeMeshes.reset(), - this._activeMeshes.reset(), - this._renderingManager.reset(), - this._processedMaterials.reset(), - this._activeParticleSystems.reset(), - this._activeSkeletons.reset(), - this._softwareSkinnedMeshes.reset(); - for (var i = 0, n = this._beforeEvaluateActiveMeshStage; i < n.length; i++) - n[i].action(); - var r = this.getActiveMeshCandidates() - , o = r.length; - for (t = 0; t < o; t++) { - var a; - if (!(a = r.data[t]).isBlocked && (this._totalVertices.addCount(a.getTotalVertices(), false), - a.isReady() && a.isEnabled() && 0 !== a.scaling.lengthSquared())) { - a.computeWorldMatrix(), - a.actionManager && a.actionManager.hasSpecificTriggers2(x.a.ACTION_OnIntersectionEnterTrigger, x.a.ACTION_OnIntersectionExitTrigger) && this._meshesForIntersections.pushNoDuplicate(a); - var s = this.customLODSelector ? this.customLODSelector(a, this.activeCamera) : a.getLOD(this.activeCamera); - null != s && (s !== a && s.billboardMode !== f.a.BILLBOARDMODE_NONE && s.computeWorldMatrix(), - a._preActivate(), - a.isVisible && a.visibility > 0 && 0 != (a.layerMask & this.activeCamera.layerMask) && (a.alwaysSelectAsActiveMesh || a.isInFrustum(this._frustumPlanes)) && (this._activeMeshes.push(a), - this.activeCamera._activeMeshes.push(a), - s !== a && s._activate(this._renderId, false), - a._activate(this._renderId, false) && (a.isAnInstance || (s._internalAbstractMeshDataInfo._onlyForInstances = false), - s._internalAbstractMeshDataInfo._isActive = true, - this._activeMesh(a, s)), - a._postActivate())) - } - } - if (this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this), - this.particlesEnabled) { - this.onBeforeParticlesRenderingObservable.notifyObservers(this); - for (var c = 0; c < this.particleSystems.length; c++) { - var u = this.particleSystems[c]; - if (u.isStarted() && u.emitter) { - var l = u.emitter; - l.position && !l.isEnabled() || (this._activeParticleSystems.push(u), - u.animate(), - this._renderingManager.dispatchParticles(u)) - } - } - this.onAfterParticlesRenderingObservable.notifyObservers(this) - } - } - } - , - t.prototype._activeMesh = function(e, t) { - this._skeletonsEnabled && null !== t.skeleton && void 0 !== t.skeleton && (this._activeSkeletons.pushNoDuplicate(t.skeleton) && t.skeleton.prepare(), - t.computeBonesUsingShaders || this._softwareSkinnedMeshes.pushNoDuplicate(t)); - for (var i = 0, n = this._activeMeshStage; i < n.length; i++) - n[i].action(e, t); - if (null != t && void 0 !== t.subMeshes && null !== t.subMeshes && t.subMeshes.length > 0) - for (var r = this.getActiveSubMeshCandidates(t), o = r.length, a = 0; a < o; a++) { - var s = r.data[a]; - this._evaluateSubMesh(s, t, e) - } - } - , - t.prototype.updateTransformMatrix = function(e) { - this.activeCamera && this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(e)) - } - , - t.prototype._bindFrameBuffer = function() { - if (this.activeCamera && this.activeCamera._multiviewTexture) - this.activeCamera._multiviewTexture._bindFrameBuffer(); - else if (this.activeCamera && this.activeCamera.outputRenderTarget) - if (this.getEngine().getCaps().multiview && this.activeCamera.outputRenderTarget && this.activeCamera.outputRenderTarget.getViewCount() > 1) - this.activeCamera.outputRenderTarget._bindFrameBuffer(); - else { - var e = this.activeCamera.outputRenderTarget.getInternalTexture(); - e ? this.getEngine().bindFramebuffer(e) : C.a.Error("Camera contains invalid customDefaultRenderTarget") - } - else - this.getEngine().restoreDefaultFramebuffer() - } - , - t.prototype._renderForCamera = function(e, t) { - if (!e || !e._skipRendering) { - var i = this._engine; - if (this._activeCamera = e, - !this.activeCamera) - throw new Error("Active camera not set"); - i.setViewport(this.activeCamera.viewport), - this.resetCachedMaterial(), - this._renderId++, - this.getEngine().getCaps().multiview && e.outputRenderTarget && e.outputRenderTarget.getViewCount() > 1 ? this.setTransformMatrix(e._rigCameras[0].getViewMatrix(), e._rigCameras[0].getProjectionMatrix(), e._rigCameras[1].getViewMatrix(), e._rigCameras[1].getProjectionMatrix()) : this.updateTransformMatrix(), - this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera), - this._evaluateActiveMeshes(); - for (var n = 0; n < this._softwareSkinnedMeshes.length; n++) { - var r = this._softwareSkinnedMeshes.data[n]; - r.applySkeleton(r.skeleton) - } - this.onBeforeRenderTargetsRenderObservable.notifyObservers(this), - e.customRenderTargets && e.customRenderTargets.length > 0 && this._renderTargets.concatWithNoDuplicate(e.customRenderTargets), - t && t.customRenderTargets && t.customRenderTargets.length > 0 && this._renderTargets.concatWithNoDuplicate(t.customRenderTargets); - for (var a = 0, s = this._gatherActiveCameraRenderTargetsStage; a < s.length; a++) - s[a].action(this._renderTargets); - if (this.renderTargetsEnabled) { - this._intermediateRendering = true; - var c = false; - if (this._renderTargets.length > 0) { - o.h.StartPerformanceCounter("Render targets", this._renderTargets.length > 0); - for (var u = 0; u < this._renderTargets.length; u++) { - var l = this._renderTargets.data[u]; - if (l._shouldRender()) { - this._renderId++; - var h = l.activeCamera && l.activeCamera !== this.activeCamera; - l.render(h, this.dumpNextRenderTargets), - c = true - } - } - o.h.EndPerformanceCounter("Render targets", this._renderTargets.length > 0), - this._renderId++ - } - for (var f = 0, d = this._cameraDrawRenderTargetStage; f < d.length; f++) - c = d[f].action(this.activeCamera) || c; - this._intermediateRendering = false, - c && this._bindFrameBuffer() - } - this.onAfterRenderTargetsRenderObservable.notifyObservers(this), - this.postProcessManager && !e._multiviewTexture && this.postProcessManager._prepareFrame(); - for (var p = 0, m = this._beforeCameraDrawStage; p < m.length; p++) - m[p].action(this.activeCamera); - this.onBeforeDrawPhaseObservable.notifyObservers(this), - this._renderingManager.render(null, null, true, true), - this.onAfterDrawPhaseObservable.notifyObservers(this); - for (var g = 0, _ = this._afterCameraDrawStage; g < _.length; g++) - _[g].action(this.activeCamera); - this.postProcessManager && !e._multiviewTexture && this.postProcessManager._finalizeFrame(e.isIntermediate), - this._renderTargets.reset(), - this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera) - } - } - , - t.prototype._processSubCameras = function(e) { - if (e.cameraRigMode === p.a.RIG_MODE_NONE || e.outputRenderTarget && e.outputRenderTarget.getViewCount() > 1 && this.getEngine().getCaps().multiview) - this._renderForCamera(e); - else { - if (e._useMultiviewToSingleView) - this._renderMultiviewToSingleView(e); - else - for (var t = 0; t < e._rigCameras.length; t++) - this._renderForCamera(e._rigCameras[t], e); - this._activeCamera = e, - this.setTransformMatrix(this._activeCamera.getViewMatrix(), this._activeCamera.getProjectionMatrix()) - } - } - , - t.prototype._checkIntersections = function() { - for (var e = 0; e < this._meshesForIntersections.length; e++) { - var t = this._meshesForIntersections.data[e]; - if (t.actionManager) - for (var i = 0; t.actionManager && i < t.actionManager.actions.length; i++) { - var n = t.actionManager.actions[i]; - if (n.trigger === x.a.ACTION_OnIntersectionEnterTrigger || n.trigger === x.a.ACTION_OnIntersectionExitTrigger) { - var r = n.getTriggerParameter() - , o = r instanceof d.a ? r : r.mesh - , a = o.intersectsMesh(t, r.usePreciseIntersection) - , s = t._intersectionsInProgress.indexOf(o); - a && -1 === s ? n.trigger === x.a.ACTION_OnIntersectionEnterTrigger ? (n._executeCurrent(b.a.CreateNew(t, void 0, o)), - t._intersectionsInProgress.push(o)) : n.trigger === x.a.ACTION_OnIntersectionExitTrigger && t._intersectionsInProgress.push(o) : !a && s > -1 && (n.trigger === x.a.ACTION_OnIntersectionExitTrigger && n._executeCurrent(b.a.CreateNew(t, void 0, o)), - t.actionManager.hasSpecificTrigger(x.a.ACTION_OnIntersectionExitTrigger, function(e) { - var t = e instanceof d.a ? e : e.mesh; - return o === t - }) && n.trigger !== x.a.ACTION_OnIntersectionExitTrigger || t._intersectionsInProgress.splice(s, 1)) - } - } - } - } - , - t.prototype._advancePhysicsEngineStep = function(e) {} - , - t.prototype._animate = function() {} - , - t.prototype.animate = function() { - if (this._engine.isDeterministicLockStep()) { - var e = Math.max(t.MinDeltaTime, Math.min(this._engine.getDeltaTime(), t.MaxDeltaTime)) + this._timeAccumulator - , i = this.getDeterministicFrameTime() - , n = 0 - , r = this._engine.getLockstepMaxSteps() - , o = Math.floor(e / 60); - o = Math.min(o, r); - do { - this.onBeforeStepObservable.notifyObservers(this), - this._animationRatio = .06 * i, - this._animate(), - this.onAfterAnimationsObservable.notifyObservers(this), - this._advancePhysicsEngineStep(i), - this.onAfterStepObservable.notifyObservers(this), - this._currentStepId++, - n++, - e -= i - } while (e > 0 && n < o);this._timeAccumulator = e < 0 ? 0 : e - } else - e = this.useConstantAnimationDeltaTime ? 16 : Math.max(t.MinDeltaTime, Math.min(this._engine.getDeltaTime(), t.MaxDeltaTime)), - this._animationRatio = .06 * e, - this._animate(), - this.onAfterAnimationsObservable.notifyObservers(this), - this._advancePhysicsEngineStep(e) - } - , - t.prototype.render = function(e, t) { - if (void 0 === e && (e = true), - void 0 === t && (t = false), - !this.isDisposed) { - this._frameId++, - this._registerTransientComponents(), - this._activeParticles.fetchNewFrame(), - this._totalVertices.fetchNewFrame(), - this._activeIndices.fetchNewFrame(), - this._activeBones.fetchNewFrame(), - this._meshesForIntersections.reset(), - this.resetCachedMaterial(), - this.onBeforeAnimationsObservable.notifyObservers(this), - this.actionManager && this.actionManager.processTrigger(x.a.ACTION_OnEveryFrameTrigger), - t || this.animate(); - for (var i = 0, n = this._beforeCameraUpdateStage; i < n.length; i++) - n[i].action(); - if (e) - if (this.activeCameras.length > 0) - for (var r = 0; r < this.activeCameras.length; r++) { - var a = this.activeCameras[r]; - if (a.update(), - a.cameraRigMode !== p.a.RIG_MODE_NONE) - for (var s = 0; s < a._rigCameras.length; s++) - a._rigCameras[s].update() - } - else if (this.activeCamera && (this.activeCamera.update(), - this.activeCamera.cameraRigMode !== p.a.RIG_MODE_NONE)) - for (s = 0; s < this.activeCamera._rigCameras.length; s++) - this.activeCamera._rigCameras[s].update(); - this.onBeforeRenderObservable.notifyObservers(this), - this.onBeforeRenderTargetsRenderObservable.notifyObservers(this); - var c = this.getEngine() - , u = this.activeCamera; - if (this.renderTargetsEnabled) { - o.h.StartPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0), - this._intermediateRendering = true; - for (var l = 0; l < this.customRenderTargets.length; l++) { - var h = this.customRenderTargets[l]; - if (h._shouldRender()) { - if (this._renderId++, - this.activeCamera = h.activeCamera || this.activeCamera, - !this.activeCamera) - throw new Error("Active camera not set"); - c.setViewport(this.activeCamera.viewport), - this.updateTransformMatrix(), - h.render(u !== this.activeCamera, this.dumpNextRenderTargets) - } - } - o.h.EndPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0), - this._intermediateRendering = false, - this._renderId++ - } - this.activeCamera = u, - this._bindFrameBuffer(), - this.onAfterRenderTargetsRenderObservable.notifyObservers(this); - for (var f = 0, d = this._beforeClearStage; f < d.length; f++) - d[f].action(); - (this.autoClearDepthAndStencil || this.autoClear) && this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil); - for (var m = 0, g = this._gatherRenderTargetsStage; m < g.length; m++) - g[m].action(this._renderTargets); - if (this.activeCameras.length > 0) - for (r = 0; r < this.activeCameras.length; r++) - r > 0 && this._engine.clear(null, false, true, true), - this._processSubCameras(this.activeCameras[r]); - else { - if (!this.activeCamera) - throw new Error("No camera defined"); - this._processSubCameras(this.activeCamera) - } - this._checkIntersections(); - for (var _ = 0, v = this._afterRenderStage; _ < v.length; _++) - v[_].action(); - if (this.afterRender && this.afterRender(), - this.onAfterRenderObservable.notifyObservers(this), - this._toBeDisposed.length) { - for (s = 0; s < this._toBeDisposed.length; s++) { - var y = this._toBeDisposed[s]; - y && y.dispose() - } - this._toBeDisposed = [] - } - this.dumpNextRenderTargets && (this.dumpNextRenderTargets = false), - this._activeBones.addCount(0, true), - this._activeIndices.addCount(0, true), - this._activeParticles.addCount(0, true) - } - } - , - t.prototype.freezeMaterials = function() { - for (var e = 0; e < this.materials.length; e++) - this.materials[e].freeze() - } - , - t.prototype.unfreezeMaterials = function() { - for (var e = 0; e < this.materials.length; e++) - this.materials[e].unfreeze() - } - , - t.prototype.dispose = function() { - this.beforeRender = null, - this.afterRender = null, - this.skeletons = [], - this.morphTargetManagers = [], - this._transientComponents = [], - this._isReadyForMeshStage.clear(), - this._beforeEvaluateActiveMeshStage.clear(), - this._evaluateSubMeshStage.clear(), - this._activeMeshStage.clear(), - this._cameraDrawRenderTargetStage.clear(), - this._beforeCameraDrawStage.clear(), - this._beforeRenderTargetDrawStage.clear(), - this._beforeRenderingGroupDrawStage.clear(), - this._beforeRenderingMeshStage.clear(), - this._afterRenderingMeshStage.clear(), - this._afterRenderingGroupDrawStage.clear(), - this._afterCameraDrawStage.clear(), - this._afterRenderTargetDrawStage.clear(), - this._afterRenderStage.clear(), - this._beforeCameraUpdateStage.clear(), - this._beforeClearStage.clear(), - this._gatherRenderTargetsStage.clear(), - this._gatherActiveCameraRenderTargetsStage.clear(), - this._pointerMoveStage.clear(), - this._pointerDownStage.clear(), - this._pointerUpStage.clear(); - for (var e = 0, t = this._components; e < t.length; e++) - t[e].dispose(); - this.importedMeshesFiles = new Array, - this.stopAllAnimations && this.stopAllAnimations(), - this.resetCachedMaterial(), - this.activeCamera && (this.activeCamera._activeMeshes.dispose(), - this.activeCamera = null), - this._activeMeshes.dispose(), - this._renderingManager.dispose(), - this._processedMaterials.dispose(), - this._activeParticleSystems.dispose(), - this._activeSkeletons.dispose(), - this._softwareSkinnedMeshes.dispose(), - this._renderTargets.dispose(), - this._registeredForLateAnimationBindings.dispose(), - this._meshesForIntersections.dispose(), - this._toBeDisposed = []; - for (var i = 0, n = this._activeRequests; i < n.length; i++) - n[i].abort(); - this.onDisposeObservable.notifyObservers(this), - this.onDisposeObservable.clear(), - this.onBeforeRenderObservable.clear(), - this.onAfterRenderObservable.clear(), - this.onBeforeRenderTargetsRenderObservable.clear(), - this.onAfterRenderTargetsRenderObservable.clear(), - this.onAfterStepObservable.clear(), - this.onBeforeStepObservable.clear(), - this.onBeforeActiveMeshesEvaluationObservable.clear(), - this.onAfterActiveMeshesEvaluationObservable.clear(), - this.onBeforeParticlesRenderingObservable.clear(), - this.onAfterParticlesRenderingObservable.clear(), - this.onBeforeDrawPhaseObservable.clear(), - this.onAfterDrawPhaseObservable.clear(), - this.onBeforeAnimationsObservable.clear(), - this.onAfterAnimationsObservable.clear(), - this.onDataLoadedObservable.clear(), - this.onBeforeRenderingGroupObservable.clear(), - this.onAfterRenderingGroupObservable.clear(), - this.onMeshImportedObservable.clear(), - this.onBeforeCameraRenderObservable.clear(), - this.onAfterCameraRenderObservable.clear(), - this.onReadyObservable.clear(), - this.onNewCameraAddedObservable.clear(), - this.onCameraRemovedObservable.clear(), - this.onNewLightAddedObservable.clear(), - this.onLightRemovedObservable.clear(), - this.onNewGeometryAddedObservable.clear(), - this.onGeometryRemovedObservable.clear(), - this.onNewTransformNodeAddedObservable.clear(), - this.onTransformNodeRemovedObservable.clear(), - this.onNewMeshAddedObservable.clear(), - this.onMeshRemovedObservable.clear(), - this.onNewSkeletonAddedObservable.clear(), - this.onSkeletonRemovedObservable.clear(), - this.onNewMaterialAddedObservable.clear(), - this.onMaterialRemovedObservable.clear(), - this.onNewTextureAddedObservable.clear(), - this.onTextureRemovedObservable.clear(), - this.onPrePointerObservable.clear(), - this.onPointerObservable.clear(), - this.onPreKeyboardObservable.clear(), - this.onKeyboardObservable.clear(), - this.onActiveCameraChanged.clear(), - this.detachControl(); - var r, o = this._engine.getRenderingCanvas(); - if (o) - for (r = 0; r < this.cameras.length; r++) - this.cameras[r].detachControl(o); - for (; this.animationGroups.length; ) - this.animationGroups[0].dispose(); - for (; this.lights.length; ) - this.lights[0].dispose(); - for (; this.meshes.length; ) - this.meshes[0].dispose(true); - for (; this.transformNodes.length; ) - this.transformNodes[0].dispose(true); - for (; this.cameras.length; ) - this.cameras[0].dispose(); - for (this._defaultMaterial && this._defaultMaterial.dispose(); this.multiMaterials.length; ) - this.multiMaterials[0].dispose(); - for (; this.materials.length; ) - this.materials[0].dispose(); - for (; this.particleSystems.length; ) - this.particleSystems[0].dispose(); - for (; this.postProcesses.length; ) - this.postProcesses[0].dispose(); - for (; this.textures.length; ) - this.textures[0].dispose(); - this._sceneUbo.dispose(), - this._multiviewSceneUbo && this._multiviewSceneUbo.dispose(), - this.postProcessManager.dispose(), - (r = this._engine.scenes.indexOf(this)) > -1 && this._engine.scenes.splice(r, 1), - this._engine.wipeCaches(true), - this._isDisposed = true - } - , - Object.defineProperty(t.prototype, "isDisposed", { - get: function() { - return this._isDisposed - }, - enumerable: true, - configurable: true - }), - t.prototype.clearCachedVertexData = function() { - for (var e = 0; e < this.meshes.length; e++) { - var t = this.meshes[e].geometry; - if (t) - for (var i in t._indices = [], - t._vertexBuffers) - t._vertexBuffers.hasOwnProperty(i) && (t._vertexBuffers[i]._buffer._data = null) - } - } - , - t.prototype.cleanCachedTextureBuffer = function() { - for (var e = 0, t = this.textures; e < t.length; e++) { - var i = t[e]; - i._buffer && (i._buffer = null) - } - } - , - t.prototype.getWorldExtends = function(e) { - var t = new h.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE) - , i = new h.x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE); - return e = e || function() { - return true - } - , - this.meshes.filter(e).forEach(function(e) { - if (e.computeWorldMatrix(true), - e.subMeshes && 0 !== e.subMeshes.length && !e.infiniteDistance) { - var n = e.getBoundingInfo() - , r = n.boundingBox.minimumWorld - , a = n.boundingBox.maximumWorld; - o.h.CheckExtends(r, t, i), - o.h.CheckExtends(a, t, i) - } - }), - { - min: t, - max: i - } - } - , - t.prototype.createPickingRay = function(e, t, i, n, r) { - throw void 0 === r && (r = false), - R.a.WarnImport("Ray") - } - , - t.prototype.createPickingRayToRef = function(e, t, i, n, r, o) { - throw void 0 === o && (o = false), - R.a.WarnImport("Ray") - } - , - t.prototype.createPickingRayInCameraSpace = function(e, t, i) { - throw R.a.WarnImport("Ray") - } - , - t.prototype.createPickingRayInCameraSpaceToRef = function(e, t, i, n) { - throw R.a.WarnImport("Ray") - } - , - t.prototype.pick = function(e, t, i, n, r, o) { - var a = new y.a; - return a._pickingUnavailable = true, - a - } - , - t.prototype.pickWithRay = function(e, t, i, n) { - throw R.a.WarnImport("Ray") - } - , - t.prototype.multiPick = function(e, t, i, n, r) { - throw R.a.WarnImport("Ray") - } - , - t.prototype.multiPickWithRay = function(e, t, i) { - throw R.a.WarnImport("Ray") - } - , - t.prototype.setPointerOverMesh = function(e) { - this._inputManager.setPointerOverMesh(e) - } - , - t.prototype.getPointerOverMesh = function() { - return this._inputManager.getPointerOverMesh() - } - , - t.prototype._rebuildGeometries = function() { - for (var e = 0, t = this.geometries; e < t.length; e++) - t[e]._rebuild(); - for (var i = 0, n = this.meshes; i < n.length; i++) - n[i]._rebuild(); - this.postProcessManager && this.postProcessManager._rebuild(); - for (var r = 0, o = this._components; r < o.length; r++) - o[r].rebuild(); - for (var a = 0, s = this.particleSystems; a < s.length; a++) - s[a].rebuild() - } - , - t.prototype._rebuildTextures = function() { - for (var e = 0, t = this.textures; e < t.length; e++) - t[e]._rebuild(); - this.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag) - } - , - t.prototype._getByTags = function(e, t, i) { - if (void 0 === t) - return e; - var n = []; - for (var r in i = i || function(e) {} - , - e) { - var o = e[r]; - l.a && l.a.MatchesQuery(o, t) && (n.push(o), - i(o)) - } - return n - } - , - t.prototype.getMeshesByTags = function(e, t) { - return this._getByTags(this.meshes, e, t) - } - , - t.prototype.getCamerasByTags = function(e, t) { - return this._getByTags(this.cameras, e, t) - } - , - t.prototype.getLightsByTags = function(e, t) { - return this._getByTags(this.lights, e, t) - } - , - t.prototype.getMaterialByTags = function(e, t) { - return this._getByTags(this.materials, e, t).concat(this._getByTags(this.multiMaterials, e, t)) - } - , - t.prototype.setRenderingOrder = function(e, t, i, n) { - void 0 === t && (t = null), - void 0 === i && (i = null), - void 0 === n && (n = null), - this._renderingManager.setRenderingOrder(e, t, i, n) - } - , - t.prototype.setRenderingAutoClearDepthStencil = function(e, t, i, n) { - void 0 === i && (i = true), - void 0 === n && (n = true), - this._renderingManager.setRenderingAutoClearDepthStencil(e, t, i, n) - } - , - t.prototype.getAutoClearDepthStencilSetup = function(e) { - return this._renderingManager.getAutoClearDepthStencilSetup(e) - } - , - Object.defineProperty(t.prototype, "blockMaterialDirtyMechanism", { - get: function() { - return this._blockMaterialDirtyMechanism - }, - set: function(e) { - this._blockMaterialDirtyMechanism !== e && (this._blockMaterialDirtyMechanism = e, - e || this.markAllMaterialsAsDirty(x.a.MATERIAL_AllDirtyFlag)) - }, - enumerable: true, - configurable: true - }), - t.prototype.markAllMaterialsAsDirty = function(e, t) { - if (!this._blockMaterialDirtyMechanism) - for (var i = 0, n = this.materials; i < n.length; i++) { - var r = n[i]; - t && !t(r) || r.markAsDirty(e) - } - } - , - t.prototype._loadFile = function(e, t, i, n, r, a) { - var s = this - , c = o.h.LoadFile(e, t, i, n ? this.offlineProvider : void 0, r, a); - return this._activeRequests.push(c), - c.onCompleteObservable.add(function(e) { - s._activeRequests.splice(s._activeRequests.indexOf(e), 1) - }), - c - } - , - t.prototype._loadFileAsync = function(e, t, n) { - var r = this; - return new i(function(i, o) { - r._loadFile(e, function(e) { - i(e) - }, void 0, t, n, function(e, t) { - o(t) - }) - } - ) - } - , - t._uniqueIdCounter = 0, - t.FOGMODE_NONE = 0, - t.FOGMODE_EXP = 1, - t.FOGMODE_EXP2 = 2, - t.FOGMODE_LINEAR = 3, - t.MinDeltaTime = 1, - t.MaxDeltaTime = 1e3, - t - }(m.a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return o - }), - i.d(t, "c", function() { - return a - }), - i.d(t, "d", function() { - return s - }), - i.d(t, "b", function() { - return c - }); - var n = i(1) - , r = i(0) - , o = function() { - function e() {} - return e.POINTERDOWN = 1, - e.POINTERUP = 2, - e.POINTERMOVE = 4, - e.POINTERWHEEL = 8, - e.POINTERPICK = 16, - e.POINTERTAP = 32, - e.POINTERDOUBLETAP = 64, - e - }() - , a = function(e, t) { - this.type = e, - this.event = t + (r._blockMaterialDirtyMechanism = false), + (r._engine = i || P.a.LastCreatedEngine), + (n && n.virtual) || + ((P.a._LastCreatedScene = r), r._engine.scenes.push(r)), + (r._uid = null), + (r._renderingManager = new T.b(r)), + E.a && (r.postProcessManager = new E.a(r)), + S.a.IsWindowObjectExist() && r.attachControl(), + r._createUbo(), + g.a && (r._imageProcessingConfiguration = new g.a()), + r.setDefaultCandidateProviders(), + n && + true === n.useGeometryUniqueIdsMap && + (r.geometriesByUniqueId = {}), + (r.useMaterialMeshMap = + (n && n.useGeometryUniqueIdsMap) || false), + (r.useClonedMeshhMap = (n && n.useClonedMeshhMap) || false), + (n && n.virtual) || + r._engine.onNewSceneAddedObservable.notifyObservers(r), + r + ); } - , s = function(e) { - function t(t, i, n, o) { - var a = e.call(this, t, i) || this; - return a.ray = null, - a.skipOnPointerObservable = false, - a.localPosition = new r.w(n,o), + return ( + r.d(t, e), + (t.DefaultMaterialFactory = function (e) { + throw R.a.WarnImport("StandardMaterial"); + }), + (t.CollisionCoordinatorFactory = function () { + throw R.a.WarnImport("DefaultCollisionCoordinator"); + }), + Object.defineProperty(t.prototype, "environmentTexture", { + get: function () { + return this._environmentTexture; + }, + set: function (e) { + this._environmentTexture !== e && + ((this._environmentTexture = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "imageProcessingConfiguration", + { + get: function () { + return this._imageProcessingConfiguration; + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty(t.prototype, "forceWireframe", { + get: function () { + return this._forceWireframe; + }, + set: function (e) { + this._forceWireframe !== e && + ((this._forceWireframe = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_MiscDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "forcePointsCloud", { + get: function () { + return this._forcePointsCloud; + }, + set: function (e) { + this._forcePointsCloud !== e && + ((this._forcePointsCloud = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_MiscDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "animationPropertiesOverride", + { + get: function () { + return this._animationPropertiesOverride; + }, + set: function (e) { + this._animationPropertiesOverride = e; + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty(t.prototype, "onDispose", { + set: function (e) { + this._onDisposeObserver && + this.onDisposeObservable.remove( + this._onDisposeObserver + ), + (this._onDisposeObserver = + this.onDisposeObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "beforeRender", { + set: function (e) { + this._onBeforeRenderObserver && + this.onBeforeRenderObservable.remove( + this._onBeforeRenderObserver + ), + e && + (this._onBeforeRenderObserver = + this.onBeforeRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "afterRender", { + set: function (e) { + this._onAfterRenderObserver && + this.onAfterRenderObservable.remove( + this._onAfterRenderObserver + ), + e && + (this._onAfterRenderObserver = + this.onAfterRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "beforeCameraRender", { + set: function (e) { + this._onBeforeCameraRenderObserver && + this.onBeforeCameraRenderObservable.remove( + this._onBeforeCameraRenderObserver + ), + (this._onBeforeCameraRenderObserver = + this.onBeforeCameraRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "afterCameraRender", { + set: function (e) { + this._onAfterCameraRenderObserver && + this.onAfterCameraRenderObservable.remove( + this._onAfterCameraRenderObserver + ), + (this._onAfterCameraRenderObserver = + this.onAfterCameraRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "unTranslatedPointer", { + get: function () { + return this._inputManager.unTranslatedPointer; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t, "DragMovementThreshold", { + get: function () { + return D.DragMovementThreshold; + }, + set: function (e) { + D.DragMovementThreshold = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t, "LongPressDelay", { + get: function () { + return D.LongPressDelay; + }, + set: function (e) { + D.LongPressDelay = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t, "DoubleClickDelay", { + get: function () { + return D.DoubleClickDelay; + }, + set: function (e) { + D.DoubleClickDelay = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t, "ExclusiveDoubleClickMode", { + get: function () { + return D.ExclusiveDoubleClickMode; + }, + set: function (e) { + D.ExclusiveDoubleClickMode = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "useRightHandedSystem", { + get: function () { + return this._useRightHandedSystem; + }, + set: function (e) { + this._useRightHandedSystem !== e && + ((this._useRightHandedSystem = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_MiscDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.setStepId = function (e) { + this._currentStepId = e; + }), + (t.prototype.getStepId = function () { + return this._currentStepId; + }), + (t.prototype.getInternalStep = function () { + return this._currentInternalStep; + }), + Object.defineProperty(t.prototype, "fogEnabled", { + get: function () { + return this._fogEnabled; + }, + set: function (e) { + this._fogEnabled !== e && + ((this._fogEnabled = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_MiscDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "fogMode", { + get: function () { + return this._fogMode; + }, + set: function (e) { + this._fogMode !== e && + ((this._fogMode = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_MiscDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "shadowsEnabled", { + get: function () { + return this._shadowsEnabled; + }, + set: function (e) { + this._shadowsEnabled !== e && + ((this._shadowsEnabled = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_LightDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "lightsEnabled", { + get: function () { + return this._lightsEnabled; + }, + set: function (e) { + this._lightsEnabled !== e && + ((this._lightsEnabled = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_LightDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "activeCamera", { + get: function () { + return this._activeCamera; + }, + set: function (e) { + e !== this._activeCamera && + ((this._activeCamera = e), + this.onActiveCameraChanged.notifyObservers(this)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "defaultMaterial", { + get: function () { + return ( + this._defaultMaterial || + (this._defaultMaterial = + t.DefaultMaterialFactory(this)), + this._defaultMaterial + ); + }, + set: function (e) { + this._defaultMaterial = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "texturesEnabled", { + get: function () { + return this._texturesEnabled; + }, + set: function (e) { + this._texturesEnabled !== e && + ((this._texturesEnabled = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "skeletonsEnabled", { + get: function () { + return this._skeletonsEnabled; + }, + set: function (e) { + this._skeletonsEnabled !== e && + ((this._skeletonsEnabled = e), + this.markAllMaterialsAsDirty( + x.a.MATERIAL_AttributesDirtyFlag + )); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "collisionCoordinator", { + get: function () { + return ( + this._collisionCoordinator || + ((this._collisionCoordinator = + t.CollisionCoordinatorFactory()), + this._collisionCoordinator.init(this)), + this._collisionCoordinator + ); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "frustumPlanes", { + get: function () { + return this._frustumPlanes; + }, + enumerable: true, + configurable: true, + }), + (t.prototype._registerTransientComponents = function () { + if (this._transientComponents.length > 0) { + for ( + var e = 0, t = this._transientComponents; + e < t.length; + e++ + ) + t[e].register(); + this._transientComponents = []; + } + }), + (t.prototype._addComponent = function (e) { + this._components.push(e), this._transientComponents.push(e); + var t = e; + t.addFromContainer && this._serializableComponents.push(t); + }), + (t.prototype._getComponent = function (e) { + for (var t = 0, i = this._components; t < i.length; t++) { + var n = i[t]; + if (n.name === e) return n; + } + return null; + }), + (t.prototype.getClassName = function () { + return "Scene"; + }), + (t.prototype._getDefaultMeshCandidates = function () { + return ( + (this._defaultMeshCandidates.data = this.meshes), + (this._defaultMeshCandidates.length = this.meshes.length), + this._defaultMeshCandidates + ); + }), + (t.prototype._getDefaultSubMeshCandidates = function (e) { + return ( + (this._defaultSubMeshCandidates.data = e.subMeshes), + (this._defaultSubMeshCandidates.length = + e.subMeshes.length), + this._defaultSubMeshCandidates + ); + }), + (t.prototype.setDefaultCandidateProviders = function () { + (this.getActiveMeshCandidates = + this._getDefaultMeshCandidates.bind(this)), + (this.getActiveSubMeshCandidates = + this._getDefaultSubMeshCandidates.bind(this)), + (this.getIntersectingSubMeshCandidates = + this._getDefaultSubMeshCandidates.bind(this)), + (this.getCollidingSubMeshCandidates = + this._getDefaultSubMeshCandidates.bind(this)); + }), + Object.defineProperty(t.prototype, "meshUnderPointer", { + get: function () { + return this._inputManager.meshUnderPointer; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "pointerX", { + get: function () { + return this._inputManager.pointerX; + }, + set: function (e) { + this._inputManager.pointerX = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "pointerY", { + get: function () { + return this._inputManager.pointerY; + }, + set: function (e) { + this._inputManager.pointerY = e; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getCachedMaterial = function () { + return this._cachedMaterial; + }), + (t.prototype.getCachedEffect = function () { + return this._cachedEffect; + }), + (t.prototype.getCachedVisibility = function () { + return this._cachedVisibility; + }), + (t.prototype.isCachedMaterialInvalid = function (e, t, i) { + return ( + void 0 === i && (i = 1), + this._cachedEffect !== t || + this._cachedMaterial !== e || + this._cachedVisibility !== i + ); + }), + (t.prototype.getEngine = function () { + return this._engine; + }), + (t.prototype.getTotalVertices = function () { + return this._totalVertices.current; + }), + Object.defineProperty( + t.prototype, + "totalVerticesPerfCounter", + { + get: function () { + return this._totalVertices; + }, + enumerable: true, + configurable: true, + } + ), + (t.prototype.getActiveIndices = function () { + return this._activeIndices.current; + }), + Object.defineProperty( + t.prototype, + "totalActiveIndicesPerfCounter", + { + get: function () { + return this._activeIndices; + }, + enumerable: true, + configurable: true, + } + ), + (t.prototype.getActiveParticles = function () { + return this._activeParticles.current; + }), + Object.defineProperty( + t.prototype, + "activeParticlesPerfCounter", + { + get: function () { + return this._activeParticles; + }, + enumerable: true, + configurable: true, + } + ), + (t.prototype.getActiveBones = function () { + return this._activeBones.current; + }), + Object.defineProperty(t.prototype, "activeBonesPerfCounter", { + get: function () { + return this._activeBones; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getActiveMeshes = function () { + return this._activeMeshes; + }), + (t.prototype.getAnimationRatio = function () { + return void 0 !== this._animationRatio + ? this._animationRatio + : 1; + }), + (t.prototype.getRenderId = function () { + return this._renderId; + }), + (t.prototype.getFrameId = function () { + return this._frameId; + }), + (t.prototype.incrementRenderId = function () { + this._renderId++; + }), + (t.prototype._createUbo = function () { + (this._sceneUbo = new _.a(this._engine, void 0, true)), + this._sceneUbo.addUniform("viewProjection", 16), + this._sceneUbo.addUniform("view", 16); + }), + (t.prototype.simulatePointerMove = function (e, t) { + return this._inputManager.simulatePointerMove(e, t), this; + }), + (t.prototype.simulatePointerDown = function (e, t) { + return this._inputManager.simulatePointerDown(e, t), this; + }), + (t.prototype.simulatePointerUp = function (e, t, i) { + return this._inputManager.simulatePointerUp(e, t, i), this; + }), + (t.prototype.isPointerCaptured = function (e) { + return ( + void 0 === e && (e = 0), + this._inputManager.isPointerCaptured(e) + ); + }), + (t.prototype.attachControl = function (e, t, i) { + void 0 === e && (e = true), + void 0 === t && (t = true), + void 0 === i && (i = true), + this._inputManager.attachControl(e, t, i); + }), + (t.prototype.detachControl = function () { + this._inputManager.detachControl(); + }), + (t.prototype.isReady = function () { + if (this._isDisposed) return false; + var e, + t = this.getEngine(); + if (!t.areAllEffectsReady()) return false; + if (this._pendingData.length > 0) return false; + for (e = 0; e < this.meshes.length; e++) { + var i = this.meshes[e]; + if ( + i.isEnabled() && + i.subMeshes && + 0 !== i.subMeshes.length + ) { + if (!i.isReady(true)) return false; + for ( + var n = + "InstancedMesh" === i.getClassName() || + "InstancedLinesMesh" === i.getClassName() || + (t.getCaps().instancedArrays && + i.instances.length > 0), + r = 0, + o = this._isReadyForMeshStage; + r < o.length; + r++ + ) + if (!o[r].action(i, n)) return false; + } + } + for (e = 0; e < this.geometries.length; e++) + if ( + this.geometries[e].delayLoadState === + x.a.DELAYLOADSTATE_LOADING + ) + return false; + if (this.activeCameras && this.activeCameras.length > 0) { + for (var a = 0, s = this.activeCameras; a < s.length; a++) + if (!s[a].isReady(true)) return false; + } else if ( + this.activeCamera && + !this.activeCamera.isReady(true) + ) + return false; + for (var c = 0, u = this.particleSystems; c < u.length; c++) + if (!u[c].isReady()) return false; + return true; + }), + (t.prototype.resetCachedMaterial = function () { + (this._cachedMaterial = null), + (this._cachedEffect = null), + (this._cachedVisibility = null); + }), + (t.prototype.registerBeforeRender = function (e) { + this.onBeforeRenderObservable.add(e); + }), + (t.prototype.unregisterBeforeRender = function (e) { + this.onBeforeRenderObservable.removeCallback(e); + }), + (t.prototype.registerAfterRender = function (e) { + this.onAfterRenderObservable.add(e); + }), + (t.prototype.unregisterAfterRender = function (e) { + this.onAfterRenderObservable.removeCallback(e); + }), + (t.prototype._executeOnceBeforeRender = function (e) { + var t = this; + this.registerBeforeRender(function i() { + e(), + setTimeout(function () { + t.unregisterBeforeRender(i); + }); + }); + }), + (t.prototype.executeOnceBeforeRender = function (e, t) { + var i = this; + void 0 !== t + ? setTimeout(function () { + i._executeOnceBeforeRender(e); + }, t) + : this._executeOnceBeforeRender(e); + }), + (t.prototype._addPendingData = function (e) { + this._pendingData.push(e); + }), + (t.prototype._removePendingData = function (e) { + var t = this.isLoading, + i = this._pendingData.indexOf(e); + -1 !== i && this._pendingData.splice(i, 1), + t && + !this.isLoading && + this.onDataLoadedObservable.notifyObservers(this); + }), + (t.prototype.getWaitingItemsCount = function () { + return this._pendingData.length; + }), + Object.defineProperty(t.prototype, "isLoading", { + get: function () { + return this._pendingData.length > 0; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.executeWhenReady = function (e) { + var t = this; + this.onReadyObservable.add(e), + -1 === this._executeWhenReadyTimeoutId && + (this._executeWhenReadyTimeoutId = setTimeout( + function () { + t._checkIsReady(); + }, + 150 + )); + }), + (t.prototype.whenReadyAsync = function () { + var e = this; + return new i(function (t) { + e.executeWhenReady(function () { + t(); + }); + }); + }), + (t.prototype._checkIsReady = function () { + var e = this; + if ((this._registerTransientComponents(), this.isReady())) + return ( + this.onReadyObservable.notifyObservers(this), + this.onReadyObservable.clear(), + void (this._executeWhenReadyTimeoutId = -1) + ); + this._executeWhenReadyTimeoutId = setTimeout(function () { + e._checkIsReady(); + }, 150); + }), + Object.defineProperty(t.prototype, "animatables", { + get: function () { + return this._activeAnimatables; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.resetLastAnimationTimeFrame = function () { + this._animationTimeLast = a.a.Now; + }), + (t.prototype.getViewMatrix = function () { + return this._viewMatrix; + }), + (t.prototype.getProjectionMatrix = function () { + return this._projectionMatrix; + }), + (t.prototype.getTransformMatrix = function () { + return this._transformMatrix; + }), + (t.prototype.setTransformMatrix = function (e, t, i, n) { + (this._viewUpdateFlag === e.updateFlag && + this._projectionUpdateFlag === t.updateFlag) || + ((this._viewUpdateFlag = e.updateFlag), + (this._projectionUpdateFlag = t.updateFlag), + (this._viewMatrix = e), + (this._projectionMatrix = t), + this._viewMatrix.multiplyToRef( + this._projectionMatrix, + this._transformMatrix + ), + this._frustumPlanes + ? h.i.GetPlanesToRef( + this._transformMatrix, + this._frustumPlanes + ) + : (this._frustumPlanes = h.i.GetPlanes( + this._transformMatrix + )), + this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo + ? this._updateMultiviewUbo(i, n) + : this._sceneUbo.useUbo && + (this._sceneUbo.updateMatrix( + "viewProjection", + this._transformMatrix + ), + this._sceneUbo.updateMatrix("view", this._viewMatrix), + this._sceneUbo.update())); + }), + (t.prototype.getSceneUniformBuffer = function () { + return this._multiviewSceneUbo + ? this._multiviewSceneUbo + : this._sceneUbo; + }), + (t.prototype.getUniqueId = function () { + var e = t._uniqueIdCounter; + return t._uniqueIdCounter++, e; + }), + (t.prototype.addMesh = function (e, t) { + var i = this; + void 0 === t && (t = false), + this.meshes.push(e), + e._resyncLightSources(), + this.onNewMeshAddedObservable.notifyObservers(e), + t && + e.getChildMeshes().forEach(function (e) { + i.addMesh(e); + }); + }), + (t.prototype.removeMesh = function (e, t) { + var i = this; + void 0 === t && (t = false); + var n = this.meshes.indexOf(e); + return ( + -1 !== n && + ((this.meshes[n] = this.meshes[this.meshes.length - 1]), + this.meshes.pop()), + this.onMeshRemovedObservable.notifyObservers(e), + t && + e.getChildMeshes().forEach(function (e) { + i.removeMesh(e); + }), + n + ); + }), + (t.prototype.addTransformNode = function (e) { + (e._indexInSceneTransformNodesArray = + this.transformNodes.length), + this.transformNodes.push(e), + this.onNewTransformNodeAddedObservable.notifyObservers(e); + }), + (t.prototype.removeTransformNode = function (e) { + var t = e._indexInSceneTransformNodesArray; + if (-1 !== t) { + if (t !== this.transformNodes.length - 1) { + var i = + this.transformNodes[this.transformNodes.length - 1]; + (this.transformNodes[t] = i), + (i._indexInSceneTransformNodesArray = t); + } + (e._indexInSceneTransformNodesArray = -1), + this.transformNodes.pop(); + } + return ( + this.onTransformNodeRemovedObservable.notifyObservers(e), + t + ); + }), + (t.prototype.removeSkeleton = function (e) { + var t = this.skeletons.indexOf(e); + return ( + -1 !== t && + (this.skeletons.splice(t, 1), + this.onSkeletonRemovedObservable.notifyObservers(e)), + t + ); + }), + (t.prototype.removeMorphTargetManager = function (e) { + var t = this.morphTargetManagers.indexOf(e); + return -1 !== t && this.morphTargetManagers.splice(t, 1), t; + }), + (t.prototype.removeLight = function (e) { + var t = this.lights.indexOf(e); + if (-1 !== t) { + for (var i = 0, n = this.meshes; i < n.length; i++) + n[i]._removeLightSource(e); + this.lights.splice(t, 1), this.sortLightsByPriority(); + } + return this.onLightRemovedObservable.notifyObservers(e), t; + }), + (t.prototype.removeCamera = function (e) { + var t = this.cameras.indexOf(e); + -1 !== t && this.cameras.splice(t, 1); + var i = this.activeCameras.indexOf(e); + return ( + -1 !== i && this.activeCameras.splice(i, 1), + this.activeCamera === e && + (this.cameras.length > 0 + ? (this.activeCamera = this.cameras[0]) + : (this.activeCamera = null)), + this.onCameraRemovedObservable.notifyObservers(e), + t + ); + }), + (t.prototype.removeParticleSystem = function (e) { + var t = this.particleSystems.indexOf(e); + return -1 !== t && this.particleSystems.splice(t, 1), t; + }), + (t.prototype.removeAnimation = function (e) { + var t = this.animations.indexOf(e); + return -1 !== t && this.animations.splice(t, 1), t; + }), + (t.prototype.stopAnimation = function (e, t, i) {}), + (t.prototype.removeAnimationGroup = function (e) { + var t = this.animationGroups.indexOf(e); + return -1 !== t && this.animationGroups.splice(t, 1), t; + }), + (t.prototype.removeMultiMaterial = function (e) { + var t = this.multiMaterials.indexOf(e); + return -1 !== t && this.multiMaterials.splice(t, 1), t; + }), + (t.prototype.removeMaterial = function (e) { + var t = e._indexInSceneMaterialArray; + if (-1 !== t && t < this.materials.length) { + if (t !== this.materials.length - 1) { + var i = this.materials[this.materials.length - 1]; + (this.materials[t] = i), + (i._indexInSceneMaterialArray = t); + } + (e._indexInSceneMaterialArray = -1), this.materials.pop(); + } + return ( + this.onMaterialRemovedObservable.notifyObservers(e), t + ); + }), + (t.prototype.removeActionManager = function (e) { + var t = this.actionManagers.indexOf(e); + return -1 !== t && this.actionManagers.splice(t, 1), t; + }), + (t.prototype.removeTexture = function (e) { + var t = this.textures.indexOf(e); + return ( + -1 !== t && this.textures.splice(t, 1), + this.onTextureRemovedObservable.notifyObservers(e), + t + ); + }), + (t.prototype.addLight = function (e) { + this.lights.push(e), this.sortLightsByPriority(); + for (var t = 0, i = this.meshes; t < i.length; t++) { + var n = i[t]; + -1 === n.lightSources.indexOf(e) && + (n.lightSources.push(e), n._resyncLightSources()); + } + this.onNewLightAddedObservable.notifyObservers(e); + }), + (t.prototype.sortLightsByPriority = function () { + this.requireLightSorting && + this.lights.sort(v.a.CompareLightsPriority); + }), + (t.prototype.addCamera = function (e) { + this.cameras.push(e), + this.onNewCameraAddedObservable.notifyObservers(e); + }), + (t.prototype.addSkeleton = function (e) { + this.skeletons.push(e), + this.onNewSkeletonAddedObservable.notifyObservers(e); + }), + (t.prototype.addParticleSystem = function (e) { + this.particleSystems.push(e); + }), + (t.prototype.addAnimation = function (e) { + this.animations.push(e); + }), + (t.prototype.addAnimationGroup = function (e) { + this.animationGroups.push(e); + }), + (t.prototype.addMultiMaterial = function (e) { + this.multiMaterials.push(e); + }), + (t.prototype.addMaterial = function (e) { + (e._indexInSceneMaterialArray = this.materials.length), + this.materials.push(e), + this.onNewMaterialAddedObservable.notifyObservers(e); + }), + (t.prototype.addMorphTargetManager = function (e) { + this.morphTargetManagers.push(e); + }), + (t.prototype.addGeometry = function (e) { + this.geometriesByUniqueId && + (this.geometriesByUniqueId[e.uniqueId] = + this.geometries.length), + this.geometries.push(e); + }), + (t.prototype.addActionManager = function (e) { + this.actionManagers.push(e); + }), + (t.prototype.addTexture = function (e) { + this.textures.push(e), + this.onNewTextureAddedObservable.notifyObservers(e); + }), + (t.prototype.switchActiveCamera = function (e, t) { + void 0 === t && (t = true); + var i = this._engine.getRenderingCanvas(); + i && + (this.activeCamera && this.activeCamera.detachControl(i), + (this.activeCamera = e), + t && e.attachControl(i)); + }), + (t.prototype.setActiveCameraByID = function (e) { + var t = this.getCameraByID(e); + return t ? ((this.activeCamera = t), t) : null; + }), + (t.prototype.setActiveCameraByName = function (e) { + var t = this.getCameraByName(e); + return t ? ((this.activeCamera = t), t) : null; + }), + (t.prototype.getAnimationGroupByName = function (e) { + for (var t = 0; t < this.animationGroups.length; t++) + if (this.animationGroups[t].name === e) + return this.animationGroups[t]; + return null; + }), + (t.prototype.getMaterialByUniqueID = function (e) { + for (var t = 0; t < this.materials.length; t++) + if (this.materials[t].uniqueId === e) + return this.materials[t]; + return null; + }), + (t.prototype.getMaterialByID = function (e) { + for (var t = 0; t < this.materials.length; t++) + if (this.materials[t].id === e) return this.materials[t]; + return null; + }), + (t.prototype.getMaterialByName = function (e) { + for (var t = 0; t < this.materials.length; t++) + if (this.materials[t].name === e) + return this.materials[t]; + return null; + }), + (t.prototype.getCameraByID = function (e) { + for (var t = 0; t < this.cameras.length; t++) + if (this.cameras[t].id === e) return this.cameras[t]; + return null; + }), + (t.prototype.getCameraByUniqueID = function (e) { + for (var t = 0; t < this.cameras.length; t++) + if (this.cameras[t].uniqueId === e) + return this.cameras[t]; + return null; + }), + (t.prototype.getCameraByName = function (e) { + for (var t = 0; t < this.cameras.length; t++) + if (this.cameras[t].name === e) return this.cameras[t]; + return null; + }), + (t.prototype.getBoneByID = function (e) { + for (var t = 0; t < this.skeletons.length; t++) + for ( + var i = this.skeletons[t], n = 0; + n < i.bones.length; + n++ + ) + if (i.bones[n].id === e) return i.bones[n]; + return null; + }), + (t.prototype.getBoneByName = function (e) { + for (var t = 0; t < this.skeletons.length; t++) + for ( + var i = this.skeletons[t], n = 0; + n < i.bones.length; + n++ + ) + if (i.bones[n].name === e) return i.bones[n]; + return null; + }), + (t.prototype.getLightByName = function (e) { + for (var t = 0; t < this.lights.length; t++) + if (this.lights[t].name === e) return this.lights[t]; + return null; + }), + (t.prototype.getLightByID = function (e) { + for (var t = 0; t < this.lights.length; t++) + if (this.lights[t].id === e) return this.lights[t]; + return null; + }), + (t.prototype.getLightByUniqueID = function (e) { + for (var t = 0; t < this.lights.length; t++) + if (this.lights[t].uniqueId === e) return this.lights[t]; + return null; + }), + (t.prototype.getParticleSystemByID = function (e) { + for (var t = 0; t < this.particleSystems.length; t++) + if (this.particleSystems[t].id === e) + return this.particleSystems[t]; + return null; + }), + (t.prototype.getGeometryByID = function (e) { + for (var t = 0; t < this.geometries.length; t++) + if (this.geometries[t].id === e) + return this.geometries[t]; + return null; + }), + (t.prototype._getGeometryByUniqueID = function (e) { + if (this.geometriesByUniqueId) { + var t = this.geometriesByUniqueId[e]; + if (void 0 !== t) return this.geometries[t]; + } else + for (var i = 0; i < this.geometries.length; i++) + if (this.geometries[i].uniqueId === e) + return this.geometries[i]; + return null; + }), + (t.prototype.pushGeometry = function (e, t) { + return !( + (!t && this._getGeometryByUniqueID(e.uniqueId)) || + (this.addGeometry(e), + this.onNewGeometryAddedObservable.notifyObservers(e), + 0) + ); + }), + (t.prototype.removeGeometry = function (e) { + var t; + if (this.geometriesByUniqueId) { + if ( + void 0 === (t = this.geometriesByUniqueId[e.uniqueId]) + ) + return false; + } else if ((t = this.geometries.indexOf(e)) < 0) + return false; + if (t !== this.geometries.length - 1) { + var i = this.geometries[this.geometries.length - 1]; + (this.geometries[t] = i), + this.geometriesByUniqueId && + ((this.geometriesByUniqueId[i.uniqueId] = t), + (this.geometriesByUniqueId[e.uniqueId] = void 0)); + } + return ( + this.geometries.pop(), + this.onGeometryRemovedObservable.notifyObservers(e), + true + ); + }), + (t.prototype.getGeometries = function () { + return this.geometries; + }), + (t.prototype.getMeshByID = function (e) { + for (var t = 0; t < this.meshes.length; t++) + if (this.meshes[t].id === e) return this.meshes[t]; + return null; + }), + (t.prototype.getMeshesByID = function (e) { + return this.meshes.filter(function (t) { + return t.id === e; + }); + }), + (t.prototype.getTransformNodeByID = function (e) { + for (var t = 0; t < this.transformNodes.length; t++) + if (this.transformNodes[t].id === e) + return this.transformNodes[t]; + return null; + }), + (t.prototype.getTransformNodeByUniqueID = function (e) { + for (var t = 0; t < this.transformNodes.length; t++) + if (this.transformNodes[t].uniqueId === e) + return this.transformNodes[t]; + return null; + }), + (t.prototype.getTransformNodesByID = function (e) { + return this.transformNodes.filter(function (t) { + return t.id === e; + }); + }), + (t.prototype.getMeshByUniqueID = function (e) { + for (var t = 0; t < this.meshes.length; t++) + if (this.meshes[t].uniqueId === e) return this.meshes[t]; + return null; + }), + (t.prototype.getLastMeshByID = function (e) { + for (var t = this.meshes.length - 1; t >= 0; t--) + if (this.meshes[t].id === e) return this.meshes[t]; + return null; + }), + (t.prototype.getLastEntryByID = function (e) { + var t; + for (t = this.meshes.length - 1; t >= 0; t--) + if (this.meshes[t].id === e) return this.meshes[t]; + for (t = this.transformNodes.length - 1; t >= 0; t--) + if (this.transformNodes[t].id === e) + return this.transformNodes[t]; + for (t = this.cameras.length - 1; t >= 0; t--) + if (this.cameras[t].id === e) return this.cameras[t]; + for (t = this.lights.length - 1; t >= 0; t--) + if (this.lights[t].id === e) return this.lights[t]; + return null; + }), + (t.prototype.getNodeByID = function (e) { + var t = this.getMeshByID(e); + if (t) return t; + var i = this.getTransformNodeByID(e); + if (i) return i; + var n = this.getLightByID(e); + if (n) return n; + var r = this.getCameraByID(e); + return r || this.getBoneByID(e) || null; + }), + (t.prototype.getNodeByName = function (e) { + var t = this.getMeshByName(e); + if (t) return t; + var i = this.getTransformNodeByName(e); + if (i) return i; + var n = this.getLightByName(e); + if (n) return n; + var r = this.getCameraByName(e); + return r || this.getBoneByName(e) || null; + }), + (t.prototype.getMeshByName = function (e) { + for (var t = 0; t < this.meshes.length; t++) + if (this.meshes[t].name === e) return this.meshes[t]; + return null; + }), + (t.prototype.getTransformNodeByName = function (e) { + for (var t = 0; t < this.transformNodes.length; t++) + if (this.transformNodes[t].name === e) + return this.transformNodes[t]; + return null; + }), + (t.prototype.getLastSkeletonByID = function (e) { + for (var t = this.skeletons.length - 1; t >= 0; t--) + if (this.skeletons[t].id === e) return this.skeletons[t]; + return null; + }), + (t.prototype.getSkeletonByUniqueId = function (e) { + for (var t = 0; t < this.skeletons.length; t++) + if (this.skeletons[t].uniqueId === e) + return this.skeletons[t]; + return null; + }), + (t.prototype.getSkeletonById = function (e) { + for (var t = 0; t < this.skeletons.length; t++) + if (this.skeletons[t].id === e) return this.skeletons[t]; + return null; + }), + (t.prototype.getSkeletonByName = function (e) { + for (var t = 0; t < this.skeletons.length; t++) + if (this.skeletons[t].name === e) + return this.skeletons[t]; + return null; + }), + (t.prototype.getMorphTargetManagerById = function (e) { + for (var t = 0; t < this.morphTargetManagers.length; t++) + if (this.morphTargetManagers[t].uniqueId === e) + return this.morphTargetManagers[t]; + return null; + }), + (t.prototype.getMorphTargetById = function (e) { + for (var t = 0; t < this.morphTargetManagers.length; ++t) + for ( + var i = this.morphTargetManagers[t], n = 0; + n < i.numTargets; + ++n + ) { + var r = i.getTarget(n); + if (r.id === e) return r; + } + return null; + }), + (t.prototype.isActiveMesh = function (e) { + return -1 !== this._activeMeshes.indexOf(e); + }), + Object.defineProperty(t.prototype, "uid", { + get: function () { + return ( + this._uid || (this._uid = o.h.RandomId()), this._uid + ); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.addExternalData = function (e, t) { + return ( + this._externalData || (this._externalData = new u.a()), + this._externalData.add(e, t) + ); + }), + (t.prototype.getExternalData = function (e) { + return this._externalData + ? this._externalData.get(e) + : null; + }), + (t.prototype.getOrAddExternalDataWithFactory = function ( + e, + t + ) { + return ( + this._externalData || (this._externalData = new u.a()), + this._externalData.getOrAddWithFactory(e, t) + ); + }), + (t.prototype.removeExternalData = function (e) { + return this._externalData.remove(e); + }), + (t.prototype._evaluateSubMesh = function (e, t, i) { + if ( + i.isAnInstance || + this.dispatchAllSubMeshesOfActiveMeshes || + t.alwaysSelectAsActiveMesh || + 1 === t.subMeshes.length || + e.isInFrustum(this._frustumPlanes) + ) { + for ( + var n = 0, r = this._evaluateSubMeshStage; + n < r.length; + n++ + ) + r[n].action(t, e); + var o = e.getMaterial(); + null != o && + (o.hasRenderTargetTextures && + null != o.getRenderTargetTextures && + -1 === this._processedMaterials.indexOf(o) && + (this._processedMaterials.push(o), + this._renderTargets.concatWithNoDuplicate( + o.getRenderTargetTextures() + )), + this._activeIndices.addCount(e.indexCount, false), + this._renderingManager.dispatch(e, t, o)); + } + }), + (t.prototype.freeProcessedMaterials = function () { + this._processedMaterials.dispose(); + }), + Object.defineProperty( + t.prototype, + "blockfreeActiveMeshesAndRenderingGroups", + { + get: function () { + return this._preventFreeActiveMeshesAndRenderingGroups; + }, + set: function (e) { + this._preventFreeActiveMeshesAndRenderingGroups !== e && + (e && + (this.freeActiveMeshes(), + this.freeRenderingGroups()), + (this._preventFreeActiveMeshesAndRenderingGroups = + e)); + }, + enumerable: true, + configurable: true, + } + ), + (t.prototype.freeActiveMeshes = function () { + if ( + !this.blockfreeActiveMeshesAndRenderingGroups && + (this._activeMeshes.dispose(), + this.activeCamera && + this.activeCamera._activeMeshes && + this.activeCamera._activeMeshes.dispose(), + this.activeCameras) + ) + for (var e = 0; e < this.activeCameras.length; e++) { + var t = this.activeCameras[e]; + t && t._activeMeshes && t._activeMeshes.dispose(); + } + }), + (t.prototype.freeRenderingGroups = function () { + if ( + !this.blockfreeActiveMeshesAndRenderingGroups && + (this._renderingManager && + this._renderingManager.freeRenderingGroups(), + this.textures) + ) + for (var e = 0; e < this.textures.length; e++) { + var t = this.textures[e]; + t && t.renderList && t.freeRenderingGroups(); + } + }), + (t.prototype._isInIntermediateRendering = function () { + return this._intermediateRendering; + }), + (t.prototype.freezeActiveMeshes = function () { + if (!this.activeCamera) return this; + this._frustumPlanes || + this.setTransformMatrix( + this.activeCamera.getViewMatrix(), + this.activeCamera.getProjectionMatrix() + ), + this._evaluateActiveMeshes(), + (this._activeMeshesFrozen = true); + for (var e = 0; e < this._activeMeshes.length; e++) + this._activeMeshes.data[e]._freeze(); + return this; + }), + (t.prototype.unfreezeActiveMeshes = function () { + for (var e = 0; e < this._activeMeshes.length; e++) + this._activeMeshes.data[e]._unFreeze(); + return (this._activeMeshesFrozen = false), this; + }), + (t.prototype._evaluateActiveMeshes = function () { + if (this._activeMeshesFrozen && this._activeMeshes.length) + for (var e = this._activeMeshes.length, t = 0; t < e; t++) + (a = this._activeMeshes.data[t]).computeWorldMatrix(); + else if (this.activeCamera) { + this.onBeforeActiveMeshesEvaluationObservable.notifyObservers( + this + ), + this.activeCamera._activeMeshes.reset(), + this._activeMeshes.reset(), + this._renderingManager.reset(), + this._processedMaterials.reset(), + this._activeParticleSystems.reset(), + this._activeSkeletons.reset(), + this._softwareSkinnedMeshes.reset(); + for ( + var i = 0, n = this._beforeEvaluateActiveMeshStage; + i < n.length; + i++ + ) + n[i].action(); + var r = this.getActiveMeshCandidates(), + o = r.length; + for (t = 0; t < o; t++) { + var a; + if ( + !(a = r.data[t]).isBlocked && + (this._totalVertices.addCount( + a.getTotalVertices(), + false + ), + a.isReady() && + a.isEnabled() && + 0 !== a.scaling.lengthSquared()) + ) { + a.computeWorldMatrix(), + a.actionManager && + a.actionManager.hasSpecificTriggers2( + x.a.ACTION_OnIntersectionEnterTrigger, + x.a.ACTION_OnIntersectionExitTrigger + ) && + this._meshesForIntersections.pushNoDuplicate(a); + var s = this.customLODSelector + ? this.customLODSelector(a, this.activeCamera) + : a.getLOD(this.activeCamera); + null != s && + (s !== a && + s.billboardMode !== f.a.BILLBOARDMODE_NONE && + s.computeWorldMatrix(), + a._preActivate(), + a.isVisible && + a.visibility > 0 && + 0 != + (a.layerMask & this.activeCamera.layerMask) && + (a.alwaysSelectAsActiveMesh || + a.isInFrustum(this._frustumPlanes)) && + (this._activeMeshes.push(a), + this.activeCamera._activeMeshes.push(a), + s !== a && s._activate(this._renderId, false), + a._activate(this._renderId, false) && + (a.isAnInstance || + (s._internalAbstractMeshDataInfo._onlyForInstances = false), + (s._internalAbstractMeshDataInfo._isActive = true), + this._activeMesh(a, s)), + a._postActivate())); + } + } + if ( + (this.onAfterActiveMeshesEvaluationObservable.notifyObservers( + this + ), + this.particlesEnabled) + ) { + this.onBeforeParticlesRenderingObservable.notifyObservers( + this + ); + for (var c = 0; c < this.particleSystems.length; c++) { + var u = this.particleSystems[c]; + if (u.isStarted() && u.emitter) { + var l = u.emitter; + (l.position && !l.isEnabled()) || + (this._activeParticleSystems.push(u), + u.animate(), + this._renderingManager.dispatchParticles(u)); + } + } + this.onAfterParticlesRenderingObservable.notifyObservers( + this + ); + } + } + }), + (t.prototype._activeMesh = function (e, t) { + this._skeletonsEnabled && + null !== t.skeleton && + void 0 !== t.skeleton && + (this._activeSkeletons.pushNoDuplicate(t.skeleton) && + t.skeleton.prepare(), + t.computeBonesUsingShaders || + this._softwareSkinnedMeshes.pushNoDuplicate(t)); + for ( + var i = 0, n = this._activeMeshStage; + i < n.length; + i++ + ) + n[i].action(e, t); + if ( + null != t && + void 0 !== t.subMeshes && + null !== t.subMeshes && + t.subMeshes.length > 0 + ) + for ( + var r = this.getActiveSubMeshCandidates(t), + o = r.length, + a = 0; + a < o; + a++ + ) { + var s = r.data[a]; + this._evaluateSubMesh(s, t, e); + } + }), + (t.prototype.updateTransformMatrix = function (e) { + this.activeCamera && + this.setTransformMatrix( + this.activeCamera.getViewMatrix(), + this.activeCamera.getProjectionMatrix(e) + ); + }), + (t.prototype._bindFrameBuffer = function () { + if ( + this.activeCamera && + this.activeCamera._multiviewTexture + ) + this.activeCamera._multiviewTexture._bindFrameBuffer(); + else if ( + this.activeCamera && + this.activeCamera.outputRenderTarget + ) + if ( + this.getEngine().getCaps().multiview && + this.activeCamera.outputRenderTarget && + this.activeCamera.outputRenderTarget.getViewCount() > 1 + ) + this.activeCamera.outputRenderTarget._bindFrameBuffer(); + else { + var e = + this.activeCamera.outputRenderTarget.getInternalTexture(); + e + ? this.getEngine().bindFramebuffer(e) + : C.a.Error( + "Camera contains invalid customDefaultRenderTarget" + ); + } + else this.getEngine().restoreDefaultFramebuffer(); + }), + (t.prototype._renderForCamera = function (e, t) { + if (!e || !e._skipRendering) { + var i = this._engine; + if (((this._activeCamera = e), !this.activeCamera)) + throw new Error("Active camera not set"); + i.setViewport(this.activeCamera.viewport), + this.resetCachedMaterial(), + this._renderId++, + this.getEngine().getCaps().multiview && + e.outputRenderTarget && + e.outputRenderTarget.getViewCount() > 1 + ? this.setTransformMatrix( + e._rigCameras[0].getViewMatrix(), + e._rigCameras[0].getProjectionMatrix(), + e._rigCameras[1].getViewMatrix(), + e._rigCameras[1].getProjectionMatrix() + ) + : this.updateTransformMatrix(), + this.onBeforeCameraRenderObservable.notifyObservers( + this.activeCamera + ), + this._evaluateActiveMeshes(); + for ( + var n = 0; + n < this._softwareSkinnedMeshes.length; + n++ + ) { + var r = this._softwareSkinnedMeshes.data[n]; + r.applySkeleton(r.skeleton); + } + this.onBeforeRenderTargetsRenderObservable.notifyObservers( + this + ), + e.customRenderTargets && + e.customRenderTargets.length > 0 && + this._renderTargets.concatWithNoDuplicate( + e.customRenderTargets + ), + t && + t.customRenderTargets && + t.customRenderTargets.length > 0 && + this._renderTargets.concatWithNoDuplicate( + t.customRenderTargets + ); + for ( + var a = 0, + s = this._gatherActiveCameraRenderTargetsStage; + a < s.length; + a++ + ) + s[a].action(this._renderTargets); + if (this.renderTargetsEnabled) { + this._intermediateRendering = true; + var c = false; + if (this._renderTargets.length > 0) { + o.h.StartPerformanceCounter( + "Render targets", + this._renderTargets.length > 0 + ); + for (var u = 0; u < this._renderTargets.length; u++) { + var l = this._renderTargets.data[u]; + if (l._shouldRender()) { + this._renderId++; + var h = + l.activeCamera && + l.activeCamera !== this.activeCamera; + l.render(h, this.dumpNextRenderTargets), + (c = true); + } + } + o.h.EndPerformanceCounter( + "Render targets", + this._renderTargets.length > 0 + ), + this._renderId++; + } + for ( + var f = 0, d = this._cameraDrawRenderTargetStage; + f < d.length; + f++ + ) + c = d[f].action(this.activeCamera) || c; + (this._intermediateRendering = false), + c && this._bindFrameBuffer(); + } + this.onAfterRenderTargetsRenderObservable.notifyObservers( + this + ), + this.postProcessManager && + !e._multiviewTexture && + this.postProcessManager._prepareFrame(); + for ( + var p = 0, m = this._beforeCameraDrawStage; + p < m.length; + p++ + ) + m[p].action(this.activeCamera); + this.onBeforeDrawPhaseObservable.notifyObservers(this), + this._renderingManager.render(null, null, true, true), + this.onAfterDrawPhaseObservable.notifyObservers(this); + for ( + var g = 0, _ = this._afterCameraDrawStage; + g < _.length; + g++ + ) + _[g].action(this.activeCamera); + this.postProcessManager && + !e._multiviewTexture && + this.postProcessManager._finalizeFrame( + e.isIntermediate + ), + this._renderTargets.reset(), + this.onAfterCameraRenderObservable.notifyObservers( + this.activeCamera + ); + } + }), + (t.prototype._processSubCameras = function (e) { + if ( + e.cameraRigMode === p.a.RIG_MODE_NONE || + (e.outputRenderTarget && + e.outputRenderTarget.getViewCount() > 1 && + this.getEngine().getCaps().multiview) + ) + this._renderForCamera(e); + else { + if (e._useMultiviewToSingleView) + this._renderMultiviewToSingleView(e); + else + for (var t = 0; t < e._rigCameras.length; t++) + this._renderForCamera(e._rigCameras[t], e); + (this._activeCamera = e), + this.setTransformMatrix( + this._activeCamera.getViewMatrix(), + this._activeCamera.getProjectionMatrix() + ); + } + }), + (t.prototype._checkIntersections = function () { + for ( + var e = 0; + e < this._meshesForIntersections.length; + e++ + ) { + var t = this._meshesForIntersections.data[e]; + if (t.actionManager) + for ( + var i = 0; + t.actionManager && i < t.actionManager.actions.length; + i++ + ) { + var n = t.actionManager.actions[i]; + if ( + n.trigger === + x.a.ACTION_OnIntersectionEnterTrigger || + n.trigger === x.a.ACTION_OnIntersectionExitTrigger + ) { + var r = n.getTriggerParameter(), + o = r instanceof d.a ? r : r.mesh, + a = o.intersectsMesh(t, r.usePreciseIntersection), + s = t._intersectionsInProgress.indexOf(o); + a && -1 === s + ? n.trigger === + x.a.ACTION_OnIntersectionEnterTrigger + ? (n._executeCurrent( + b.a.CreateNew(t, void 0, o) + ), + t._intersectionsInProgress.push(o)) + : n.trigger === + x.a.ACTION_OnIntersectionExitTrigger && + t._intersectionsInProgress.push(o) + : !a && + s > -1 && + (n.trigger === + x.a.ACTION_OnIntersectionExitTrigger && + n._executeCurrent( + b.a.CreateNew(t, void 0, o) + ), + (t.actionManager.hasSpecificTrigger( + x.a.ACTION_OnIntersectionExitTrigger, + function (e) { + var t = e instanceof d.a ? e : e.mesh; + return o === t; + } + ) && + n.trigger !== + x.a.ACTION_OnIntersectionExitTrigger) || + t._intersectionsInProgress.splice(s, 1)); + } + } + } + }), + (t.prototype._advancePhysicsEngineStep = function (e) {}), + (t.prototype._animate = function () {}), + (t.prototype.animate = function () { + if (this._engine.isDeterministicLockStep()) { + var e = + Math.max( + t.MinDeltaTime, + Math.min( + this._engine.getDeltaTime(), + t.MaxDeltaTime + ) + ) + this._timeAccumulator, + i = this.getDeterministicFrameTime(), + n = 0, + r = this._engine.getLockstepMaxSteps(), + o = Math.floor(e / 60); + o = Math.min(o, r); + do { + this.onBeforeStepObservable.notifyObservers(this), + (this._animationRatio = 0.06 * i), + this._animate(), + this.onAfterAnimationsObservable.notifyObservers( + this + ), + this._advancePhysicsEngineStep(i), + this.onAfterStepObservable.notifyObservers(this), + this._currentStepId++, + n++, + (e -= i); + } while (e > 0 && n < o); + this._timeAccumulator = e < 0 ? 0 : e; + } else + (e = this.useConstantAnimationDeltaTime + ? 16 + : Math.max( + t.MinDeltaTime, + Math.min( + this._engine.getDeltaTime(), + t.MaxDeltaTime + ) + )), + (this._animationRatio = 0.06 * e), + this._animate(), + this.onAfterAnimationsObservable.notifyObservers(this), + this._advancePhysicsEngineStep(e); + }), + (t.prototype.render = function (e, t) { + if ( + (void 0 === e && (e = true), + void 0 === t && (t = false), + !this.isDisposed) + ) { + this._frameId++, + this._registerTransientComponents(), + this._activeParticles.fetchNewFrame(), + this._totalVertices.fetchNewFrame(), + this._activeIndices.fetchNewFrame(), + this._activeBones.fetchNewFrame(), + this._meshesForIntersections.reset(), + this.resetCachedMaterial(), + this.onBeforeAnimationsObservable.notifyObservers(this), + this.actionManager && + this.actionManager.processTrigger( + x.a.ACTION_OnEveryFrameTrigger + ), + t || this.animate(); + for ( + var i = 0, n = this._beforeCameraUpdateStage; + i < n.length; + i++ + ) + n[i].action(); + if (e) + if (this.activeCameras.length > 0) + for (var r = 0; r < this.activeCameras.length; r++) { + var a = this.activeCameras[r]; + if ( + (a.update(), + a.cameraRigMode !== p.a.RIG_MODE_NONE) + ) + for (var s = 0; s < a._rigCameras.length; s++) + a._rigCameras[s].update(); + } + else if ( + this.activeCamera && + (this.activeCamera.update(), + this.activeCamera.cameraRigMode !== p.a.RIG_MODE_NONE) + ) + for ( + s = 0; + s < this.activeCamera._rigCameras.length; + s++ + ) + this.activeCamera._rigCameras[s].update(); + this.onBeforeRenderObservable.notifyObservers(this), + this.onBeforeRenderTargetsRenderObservable.notifyObservers( + this + ); + var c = this.getEngine(), + u = this.activeCamera; + if (this.renderTargetsEnabled) { + o.h.StartPerformanceCounter( + "Custom render targets", + this.customRenderTargets.length > 0 + ), + (this._intermediateRendering = true); + for ( + var l = 0; + l < this.customRenderTargets.length; + l++ + ) { + var h = this.customRenderTargets[l]; + if (h._shouldRender()) { + if ( + (this._renderId++, + (this.activeCamera = + h.activeCamera || this.activeCamera), + !this.activeCamera) + ) + throw new Error("Active camera not set"); + c.setViewport(this.activeCamera.viewport), + this.updateTransformMatrix(), + h.render( + u !== this.activeCamera, + this.dumpNextRenderTargets + ); + } + } + o.h.EndPerformanceCounter( + "Custom render targets", + this.customRenderTargets.length > 0 + ), + (this._intermediateRendering = false), + this._renderId++; + } + (this.activeCamera = u), + this._bindFrameBuffer(), + this.onAfterRenderTargetsRenderObservable.notifyObservers( + this + ); + for ( + var f = 0, d = this._beforeClearStage; + f < d.length; + f++ + ) + d[f].action(); + (this.autoClearDepthAndStencil || this.autoClear) && + this._engine.clear( + this.clearColor, + this.autoClear || + this.forceWireframe || + this.forcePointsCloud, + this.autoClearDepthAndStencil, + this.autoClearDepthAndStencil + ); + for ( + var m = 0, g = this._gatherRenderTargetsStage; + m < g.length; + m++ + ) + g[m].action(this._renderTargets); + if (this.activeCameras.length > 0) + for (r = 0; r < this.activeCameras.length; r++) + r > 0 && this._engine.clear(null, false, true, true), + this._processSubCameras(this.activeCameras[r]); + else { + if (!this.activeCamera) + throw new Error("No camera defined"); + this._processSubCameras(this.activeCamera); + } + this._checkIntersections(); + for ( + var _ = 0, v = this._afterRenderStage; + _ < v.length; + _++ + ) + v[_].action(); + if ( + (this.afterRender && this.afterRender(), + this.onAfterRenderObservable.notifyObservers(this), + this._toBeDisposed.length) + ) { + for (s = 0; s < this._toBeDisposed.length; s++) { + var y = this._toBeDisposed[s]; + y && y.dispose(); + } + this._toBeDisposed = []; + } + this.dumpNextRenderTargets && + (this.dumpNextRenderTargets = false), + this._activeBones.addCount(0, true), + this._activeIndices.addCount(0, true), + this._activeParticles.addCount(0, true); + } + }), + (t.prototype.freezeMaterials = function () { + for (var e = 0; e < this.materials.length; e++) + this.materials[e].freeze(); + }), + (t.prototype.unfreezeMaterials = function () { + for (var e = 0; e < this.materials.length; e++) + this.materials[e].unfreeze(); + }), + (t.prototype.dispose = function () { + (this.beforeRender = null), + (this.afterRender = null), + (this.skeletons = []), + (this.morphTargetManagers = []), + (this._transientComponents = []), + this._isReadyForMeshStage.clear(), + this._beforeEvaluateActiveMeshStage.clear(), + this._evaluateSubMeshStage.clear(), + this._activeMeshStage.clear(), + this._cameraDrawRenderTargetStage.clear(), + this._beforeCameraDrawStage.clear(), + this._beforeRenderTargetDrawStage.clear(), + this._beforeRenderingGroupDrawStage.clear(), + this._beforeRenderingMeshStage.clear(), + this._afterRenderingMeshStage.clear(), + this._afterRenderingGroupDrawStage.clear(), + this._afterCameraDrawStage.clear(), + this._afterRenderTargetDrawStage.clear(), + this._afterRenderStage.clear(), + this._beforeCameraUpdateStage.clear(), + this._beforeClearStage.clear(), + this._gatherRenderTargetsStage.clear(), + this._gatherActiveCameraRenderTargetsStage.clear(), + this._pointerMoveStage.clear(), + this._pointerDownStage.clear(), + this._pointerUpStage.clear(); + for (var e = 0, t = this._components; e < t.length; e++) + t[e].dispose(); + (this.importedMeshesFiles = new Array()), + this.stopAllAnimations && this.stopAllAnimations(), + this.resetCachedMaterial(), + this.activeCamera && + (this.activeCamera._activeMeshes.dispose(), + (this.activeCamera = null)), + this._activeMeshes.dispose(), + this._renderingManager.dispose(), + this._processedMaterials.dispose(), + this._activeParticleSystems.dispose(), + this._activeSkeletons.dispose(), + this._softwareSkinnedMeshes.dispose(), + this._renderTargets.dispose(), + this._registeredForLateAnimationBindings.dispose(), + this._meshesForIntersections.dispose(), + (this._toBeDisposed = []); + for (var i = 0, n = this._activeRequests; i < n.length; i++) + n[i].abort(); + this.onDisposeObservable.notifyObservers(this), + this.onDisposeObservable.clear(), + this.onBeforeRenderObservable.clear(), + this.onAfterRenderObservable.clear(), + this.onBeforeRenderTargetsRenderObservable.clear(), + this.onAfterRenderTargetsRenderObservable.clear(), + this.onAfterStepObservable.clear(), + this.onBeforeStepObservable.clear(), + this.onBeforeActiveMeshesEvaluationObservable.clear(), + this.onAfterActiveMeshesEvaluationObservable.clear(), + this.onBeforeParticlesRenderingObservable.clear(), + this.onAfterParticlesRenderingObservable.clear(), + this.onBeforeDrawPhaseObservable.clear(), + this.onAfterDrawPhaseObservable.clear(), + this.onBeforeAnimationsObservable.clear(), + this.onAfterAnimationsObservable.clear(), + this.onDataLoadedObservable.clear(), + this.onBeforeRenderingGroupObservable.clear(), + this.onAfterRenderingGroupObservable.clear(), + this.onMeshImportedObservable.clear(), + this.onBeforeCameraRenderObservable.clear(), + this.onAfterCameraRenderObservable.clear(), + this.onReadyObservable.clear(), + this.onNewCameraAddedObservable.clear(), + this.onCameraRemovedObservable.clear(), + this.onNewLightAddedObservable.clear(), + this.onLightRemovedObservable.clear(), + this.onNewGeometryAddedObservable.clear(), + this.onGeometryRemovedObservable.clear(), + this.onNewTransformNodeAddedObservable.clear(), + this.onTransformNodeRemovedObservable.clear(), + this.onNewMeshAddedObservable.clear(), + this.onMeshRemovedObservable.clear(), + this.onNewSkeletonAddedObservable.clear(), + this.onSkeletonRemovedObservable.clear(), + this.onNewMaterialAddedObservable.clear(), + this.onMaterialRemovedObservable.clear(), + this.onNewTextureAddedObservable.clear(), + this.onTextureRemovedObservable.clear(), + this.onPrePointerObservable.clear(), + this.onPointerObservable.clear(), + this.onPreKeyboardObservable.clear(), + this.onKeyboardObservable.clear(), + this.onActiveCameraChanged.clear(), + this.detachControl(); + var r, + o = this._engine.getRenderingCanvas(); + if (o) + for (r = 0; r < this.cameras.length; r++) + this.cameras[r].detachControl(o); + for (; this.animationGroups.length; ) + this.animationGroups[0].dispose(); + for (; this.lights.length; ) this.lights[0].dispose(); + for (; this.meshes.length; ) this.meshes[0].dispose(true); + for (; this.transformNodes.length; ) + this.transformNodes[0].dispose(true); + for (; this.cameras.length; ) this.cameras[0].dispose(); + for ( + this._defaultMaterial && this._defaultMaterial.dispose(); + this.multiMaterials.length; + + ) + this.multiMaterials[0].dispose(); + for (; this.materials.length; ) this.materials[0].dispose(); + for (; this.particleSystems.length; ) + this.particleSystems[0].dispose(); + for (; this.postProcesses.length; ) + this.postProcesses[0].dispose(); + for (; this.textures.length; ) this.textures[0].dispose(); + this._sceneUbo.dispose(), + this._multiviewSceneUbo && + this._multiviewSceneUbo.dispose(), + this.postProcessManager.dispose(), + (r = this._engine.scenes.indexOf(this)) > -1 && + this._engine.scenes.splice(r, 1), + this._engine.wipeCaches(true), + (this._isDisposed = true); + }), + Object.defineProperty(t.prototype, "isDisposed", { + get: function () { + return this._isDisposed; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.clearCachedVertexData = function () { + for (var e = 0; e < this.meshes.length; e++) { + var t = this.meshes[e].geometry; + if (t) + for (var i in ((t._indices = []), t._vertexBuffers)) + t._vertexBuffers.hasOwnProperty(i) && + (t._vertexBuffers[i]._buffer._data = null); + } + }), + (t.prototype.cleanCachedTextureBuffer = function () { + for (var e = 0, t = this.textures; e < t.length; e++) { + var i = t[e]; + i._buffer && (i._buffer = null); + } + }), + (t.prototype.getWorldExtends = function (e) { + var t = new h.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + ), + i = new h.x( + -Number.MAX_VALUE, + -Number.MAX_VALUE, + -Number.MAX_VALUE + ); + return ( + (e = + e || + function () { + return true; + }), + this.meshes.filter(e).forEach(function (e) { + if ( + (e.computeWorldMatrix(true), + e.subMeshes && + 0 !== e.subMeshes.length && + !e.infiniteDistance) + ) { + var n = e.getBoundingInfo(), + r = n.boundingBox.minimumWorld, + a = n.boundingBox.maximumWorld; + o.h.CheckExtends(r, t, i), o.h.CheckExtends(a, t, i); + } + }), + { + min: t, + max: i, + } + ); + }), + (t.prototype.createPickingRay = function (e, t, i, n, r) { + throw (void 0 === r && (r = false), R.a.WarnImport("Ray")); + }), + (t.prototype.createPickingRayToRef = function ( + e, + t, + i, + n, + r, + o + ) { + throw (void 0 === o && (o = false), R.a.WarnImport("Ray")); + }), + (t.prototype.createPickingRayInCameraSpace = function ( + e, + t, + i + ) { + throw R.a.WarnImport("Ray"); + }), + (t.prototype.createPickingRayInCameraSpaceToRef = function ( + e, + t, + i, + n + ) { + throw R.a.WarnImport("Ray"); + }), + (t.prototype.pick = function (e, t, i, n, r, o) { + var a = new y.a(); + return (a._pickingUnavailable = true), a; + }), + (t.prototype.pickWithRay = function (e, t, i, n) { + throw R.a.WarnImport("Ray"); + }), + (t.prototype.multiPick = function (e, t, i, n, r) { + throw R.a.WarnImport("Ray"); + }), + (t.prototype.multiPickWithRay = function (e, t, i) { + throw R.a.WarnImport("Ray"); + }), + (t.prototype.setPointerOverMesh = function (e) { + this._inputManager.setPointerOverMesh(e); + }), + (t.prototype.getPointerOverMesh = function () { + return this._inputManager.getPointerOverMesh(); + }), + (t.prototype._rebuildGeometries = function () { + for (var e = 0, t = this.geometries; e < t.length; e++) + t[e]._rebuild(); + for (var i = 0, n = this.meshes; i < n.length; i++) + n[i]._rebuild(); + this.postProcessManager && + this.postProcessManager._rebuild(); + for (var r = 0, o = this._components; r < o.length; r++) + o[r].rebuild(); + for (var a = 0, s = this.particleSystems; a < s.length; a++) + s[a].rebuild(); + }), + (t.prototype._rebuildTextures = function () { + for (var e = 0, t = this.textures; e < t.length; e++) + t[e]._rebuild(); + this.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag); + }), + (t.prototype._getByTags = function (e, t, i) { + if (void 0 === t) return e; + var n = []; + for (var r in ((i = i || function (e) {}), e)) { + var o = e[r]; + l.a && l.a.MatchesQuery(o, t) && (n.push(o), i(o)); + } + return n; + }), + (t.prototype.getMeshesByTags = function (e, t) { + return this._getByTags(this.meshes, e, t); + }), + (t.prototype.getCamerasByTags = function (e, t) { + return this._getByTags(this.cameras, e, t); + }), + (t.prototype.getLightsByTags = function (e, t) { + return this._getByTags(this.lights, e, t); + }), + (t.prototype.getMaterialByTags = function (e, t) { + return this._getByTags(this.materials, e, t).concat( + this._getByTags(this.multiMaterials, e, t) + ); + }), + (t.prototype.setRenderingOrder = function (e, t, i, n) { + void 0 === t && (t = null), + void 0 === i && (i = null), + void 0 === n && (n = null), + this._renderingManager.setRenderingOrder(e, t, i, n); + }), + (t.prototype.setRenderingAutoClearDepthStencil = function ( + e, + t, + i, + n + ) { + void 0 === i && (i = true), + void 0 === n && (n = true), + this._renderingManager.setRenderingAutoClearDepthStencil( + e, + t, + i, + n + ); + }), + (t.prototype.getAutoClearDepthStencilSetup = function (e) { + return this._renderingManager.getAutoClearDepthStencilSetup( + e + ); + }), + Object.defineProperty( + t.prototype, + "blockMaterialDirtyMechanism", + { + get: function () { + return this._blockMaterialDirtyMechanism; + }, + set: function (e) { + this._blockMaterialDirtyMechanism !== e && + ((this._blockMaterialDirtyMechanism = e), + e || + this.markAllMaterialsAsDirty( + x.a.MATERIAL_AllDirtyFlag + )); + }, + enumerable: true, + configurable: true, + } + ), + (t.prototype.markAllMaterialsAsDirty = function (e, t) { + if (!this._blockMaterialDirtyMechanism) + for (var i = 0, n = this.materials; i < n.length; i++) { + var r = n[i]; + (t && !t(r)) || r.markAsDirty(e); + } + }), + (t.prototype._loadFile = function (e, t, i, n, r, a) { + var s = this, + c = o.h.LoadFile( + e, + t, + i, + n ? this.offlineProvider : void 0, + r, a - } - return n.d(t, e), - t - }(a) - , c = function(e) { - function t(t, i, n) { - var r = e.call(this, t, i) || this; - return r.pickInfo = n, - r - } - return n.d(t, e), - t - }(a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return o + ); + return ( + this._activeRequests.push(c), + c.onCompleteObservable.add(function (e) { + s._activeRequests.splice( + s._activeRequests.indexOf(e), + 1 + ); + }), + c + ); + }), + (t.prototype._loadFileAsync = function (e, t, n) { + var r = this; + return new i(function (i, o) { + r._loadFile( + e, + function (e) { + i(e); + }, + void 0, + t, + n, + function (e, t) { + o(t); + } + ); + }); + }), + (t._uniqueIdCounter = 0), + (t.FOGMODE_NONE = 0), + (t.FOGMODE_EXP = 1), + (t.FOGMODE_EXP2 = 2), + (t.FOGMODE_LINEAR = 3), + (t.MinDeltaTime = 1), + (t.MaxDeltaTime = 1e3), + t + ); + })(m.a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return o; + }), + i.d(t, "c", function () { + return a; + }), + i.d(t, "d", function () { + return s; + }), + i.d(t, "b", function () { + return c; }); - var n = i(10) - , r = i(3) - , o = function() { - function e() {} - return Object.defineProperty(e, "DiffuseTextureEnabled", { - get: function() { - return this._DiffuseTextureEnabled - }, - set: function(e) { - this._DiffuseTextureEnabled !== e && (this._DiffuseTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + var n = i(1), + r = i(0), + o = (function () { + function e() {} + return ( + (e.POINTERDOWN = 1), + (e.POINTERUP = 2), + (e.POINTERMOVE = 4), + (e.POINTERWHEEL = 8), + (e.POINTERPICK = 16), + (e.POINTERTAP = 32), + (e.POINTERDOUBLETAP = 64), + e + ); + })(), + a = function (e, t) { + (this.type = e), (this.event = t); + }, + s = (function (e) { + function t(t, i, n, o) { + var a = e.call(this, t, i) || this; + return ( + (a.ray = null), + (a.skipOnPointerObservable = false), + (a.localPosition = new r.w(n, o)), + a + ); + } + return n.d(t, e), t; + })(a), + c = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, i) || this; + return (r.pickInfo = n), r; + } + return n.d(t, e), t; + })(a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return o; + }); + var n = i(10), + r = i(3), + o = (function () { + function e() {} + return ( + Object.defineProperty(e, "DiffuseTextureEnabled", { + get: function () { + return this._DiffuseTextureEnabled; + }, + set: function (e) { + this._DiffuseTextureEnabled !== e && + ((this._DiffuseTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "AmbientTextureEnabled", { - get: function() { - return this._AmbientTextureEnabled - }, - set: function(e) { - this._AmbientTextureEnabled !== e && (this._AmbientTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._AmbientTextureEnabled; + }, + set: function (e) { + this._AmbientTextureEnabled !== e && + ((this._AmbientTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "OpacityTextureEnabled", { - get: function() { - return this._OpacityTextureEnabled - }, - set: function(e) { - this._OpacityTextureEnabled !== e && (this._OpacityTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._OpacityTextureEnabled; + }, + set: function (e) { + this._OpacityTextureEnabled !== e && + ((this._OpacityTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ReflectionTextureEnabled", { - get: function() { - return this._ReflectionTextureEnabled - }, - set: function(e) { - this._ReflectionTextureEnabled !== e && (this._ReflectionTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._ReflectionTextureEnabled; + }, + set: function (e) { + this._ReflectionTextureEnabled !== e && + ((this._ReflectionTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "EmissiveTextureEnabled", { - get: function() { - return this._EmissiveTextureEnabled - }, - set: function(e) { - this._EmissiveTextureEnabled !== e && (this._EmissiveTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._EmissiveTextureEnabled; + }, + set: function (e) { + this._EmissiveTextureEnabled !== e && + ((this._EmissiveTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "SpecularTextureEnabled", { - get: function() { - return this._SpecularTextureEnabled - }, - set: function(e) { - this._SpecularTextureEnabled !== e && (this._SpecularTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._SpecularTextureEnabled; + }, + set: function (e) { + this._SpecularTextureEnabled !== e && + ((this._SpecularTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "BumpTextureEnabled", { - get: function() { - return this._BumpTextureEnabled - }, - set: function(e) { - this._BumpTextureEnabled !== e && (this._BumpTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._BumpTextureEnabled; + }, + set: function (e) { + this._BumpTextureEnabled !== e && + ((this._BumpTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "LightmapTextureEnabled", { - get: function() { - return this._LightmapTextureEnabled - }, - set: function(e) { - this._LightmapTextureEnabled !== e && (this._LightmapTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._LightmapTextureEnabled; + }, + set: function (e) { + this._LightmapTextureEnabled !== e && + ((this._LightmapTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "RefractionTextureEnabled", { - get: function() { - return this._RefractionTextureEnabled - }, - set: function(e) { - this._RefractionTextureEnabled !== e && (this._RefractionTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._RefractionTextureEnabled; + }, + set: function (e) { + this._RefractionTextureEnabled !== e && + ((this._RefractionTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ColorGradingTextureEnabled", { - get: function() { - return this._ColorGradingTextureEnabled - }, - set: function(e) { - this._ColorGradingTextureEnabled !== e && (this._ColorGradingTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._ColorGradingTextureEnabled; + }, + set: function (e) { + this._ColorGradingTextureEnabled !== e && + ((this._ColorGradingTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "FresnelEnabled", { - get: function() { - return this._FresnelEnabled - }, - set: function(e) { - this._FresnelEnabled !== e && (this._FresnelEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_FresnelDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._FresnelEnabled; + }, + set: function (e) { + this._FresnelEnabled !== e && + ((this._FresnelEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_FresnelDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ClearCoatTextureEnabled", { - get: function() { - return this._ClearCoatTextureEnabled - }, - set: function(e) { - this._ClearCoatTextureEnabled !== e && (this._ClearCoatTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._ClearCoatTextureEnabled; + }, + set: function (e) { + this._ClearCoatTextureEnabled !== e && + ((this._ClearCoatTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ClearCoatBumpTextureEnabled", { - get: function() { - return this._ClearCoatBumpTextureEnabled - }, - set: function(e) { - this._ClearCoatBumpTextureEnabled !== e && (this._ClearCoatBumpTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._ClearCoatBumpTextureEnabled; + }, + set: function (e) { + this._ClearCoatBumpTextureEnabled !== e && + ((this._ClearCoatBumpTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ClearCoatTintTextureEnabled", { - get: function() { - return this._ClearCoatTintTextureEnabled - }, - set: function(e) { - this._ClearCoatTintTextureEnabled !== e && (this._ClearCoatTintTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._ClearCoatTintTextureEnabled; + }, + set: function (e) { + this._ClearCoatTintTextureEnabled !== e && + ((this._ClearCoatTintTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "SheenTextureEnabled", { - get: function() { - return this._SheenTextureEnabled - }, - set: function(e) { - this._SheenTextureEnabled !== e && (this._SheenTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._SheenTextureEnabled; + }, + set: function (e) { + this._SheenTextureEnabled !== e && + ((this._SheenTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "AnisotropicTextureEnabled", { - get: function() { - return this._AnisotropicTextureEnabled - }, - set: function(e) { - this._AnisotropicTextureEnabled !== e && (this._AnisotropicTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._AnisotropicTextureEnabled; + }, + set: function (e) { + this._AnisotropicTextureEnabled !== e && + ((this._AnisotropicTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ThicknessTextureEnabled", { - get: function() { - return this._ThicknessTextureEnabled - }, - set: function(e) { - this._ThicknessTextureEnabled !== e && (this._ThicknessTextureEnabled = e, - n.b.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._ThicknessTextureEnabled; + }, + set: function (e) { + this._ThicknessTextureEnabled !== e && + ((this._ThicknessTextureEnabled = e), + n.b.MarkAllMaterialsAsDirty( + r.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), - e._DiffuseTextureEnabled = true, - e._AmbientTextureEnabled = true, - e._OpacityTextureEnabled = true, - e._ReflectionTextureEnabled = true, - e._EmissiveTextureEnabled = true, - e._SpecularTextureEnabled = true, - e._BumpTextureEnabled = true, - e._LightmapTextureEnabled = true, - e._RefractionTextureEnabled = true, - e._ColorGradingTextureEnabled = true, - e._FresnelEnabled = true, - e._ClearCoatTextureEnabled = true, - e._ClearCoatBumpTextureEnabled = true, - e._ClearCoatTintTextureEnabled = true, - e._SheenTextureEnabled = true, - e._AnisotropicTextureEnabled = true, - e._ThicknessTextureEnabled = true, + (e._DiffuseTextureEnabled = true), + (e._AmbientTextureEnabled = true), + (e._OpacityTextureEnabled = true), + (e._ReflectionTextureEnabled = true), + (e._EmissiveTextureEnabled = true), + (e._SpecularTextureEnabled = true), + (e._BumpTextureEnabled = true), + (e._LightmapTextureEnabled = true), + (e._RefractionTextureEnabled = true), + (e._ColorGradingTextureEnabled = true), + (e._FresnelEnabled = true), + (e._ClearCoatTextureEnabled = true), + (e._ClearCoatBumpTextureEnabled = true), + (e._ClearCoatTintTextureEnabled = true), + (e._SheenTextureEnabled = true), + (e._AnisotropicTextureEnabled = true), + (e._ThicknessTextureEnabled = true), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return e.WarnImport = function(e) { - return e + " needs to be imported before as it contains a side-effect required by your code." - } - , - e - }() - } - , function(e, t, n) { - "use strict"; - n.d(t, "a", function() { - return p - }); - var r = n(1) - , o = n(2) - , a = n(9) - , s = n(8) - , c = n(0) - , u = n(23) - , l = n(49) - , h = n(63) - , f = n(3) - , d = n(6) - , p = function() { - function e(t, i, n) { - this.metadata = null, - this.reservedDataStore = null, - this.checkReadyOnEveryCall = false, - this.checkReadyOnlyOnce = false, - this.state = "", - this._alpha = 1, - this._backFaceCulling = true, - this.onCompiled = null, - this.onError = null, - this.getRenderTargetTextures = null, - this.doNotSerialize = false, - this._storeEffectOnSubMeshes = false, - this.animations = null, - this.onDisposeObservable = new s.c, - this._onDisposeObserver = null, - this._onUnBindObservable = null, - this._onBindObserver = null, - this._alphaMode = f.a.ALPHA_COMBINE, - this._needDepthPrePass = false, - this.disableDepthWrite = false, - this.forceDepthWrite = false, - this.separateCullingPass = false, - this._fogEnabled = true, - this.pointSize = 1, - this.zOffset = 0, - this._effect = null, - this._wasPreviouslyReady = false, - this._useUBO = false, - this._fillMode = e.TriangleFillMode, - this._cachedDepthWriteState = false, - this._indexInSceneMaterialArray = -1, - this.meshMap = null, - this.name = t, - this.id = t || a.h.RandomId(), - this._scene = i || u.a.LastCreatedScene, - this.uniqueId = this._scene.getUniqueId(), - this._scene.useRightHandedSystem ? this.sideOrientation = e.ClockWiseSideOrientation : this.sideOrientation = e.CounterClockWiseSideOrientation, - this._uniformBuffer = new h.a(this._scene.getEngine()), - this._useUBO = this.getScene().getEngine().supportsUniformBuffers, - n || this._scene.addMaterial(this), - this._scene.useMaterialMeshMap && (this.meshMap = {}) - } - return Object.defineProperty(e.prototype, "alpha", { - get: function() { - return this._alpha - }, - set: function(t) { - this._alpha !== t && (this._alpha = t, - this.markAsDirty(e.MiscDirtyFlag)) - }, - enumerable: true, - configurable: true + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + (e.WarnImport = function (e) { + return ( + e + + " needs to be imported before as it contains a side-effect required by your code." + ); + }), + e + ); + })(); + }, + function (e, t, n) { + "use strict"; + n.d(t, "a", function () { + return p; + }); + var r = n(1), + o = n(2), + a = n(9), + s = n(8), + c = n(0), + u = n(23), + l = n(49), + h = n(63), + f = n(3), + d = n(6), + p = (function () { + function e(t, i, n) { + (this.metadata = null), + (this.reservedDataStore = null), + (this.checkReadyOnEveryCall = false), + (this.checkReadyOnlyOnce = false), + (this.state = ""), + (this._alpha = 1), + (this._backFaceCulling = true), + (this.onCompiled = null), + (this.onError = null), + (this.getRenderTargetTextures = null), + (this.doNotSerialize = false), + (this._storeEffectOnSubMeshes = false), + (this.animations = null), + (this.onDisposeObservable = new s.c()), + (this._onDisposeObserver = null), + (this._onUnBindObservable = null), + (this._onBindObserver = null), + (this._alphaMode = f.a.ALPHA_COMBINE), + (this._needDepthPrePass = false), + (this.disableDepthWrite = false), + (this.forceDepthWrite = false), + (this.separateCullingPass = false), + (this._fogEnabled = true), + (this.pointSize = 1), + (this.zOffset = 0), + (this._effect = null), + (this._wasPreviouslyReady = false), + (this._useUBO = false), + (this._fillMode = e.TriangleFillMode), + (this._cachedDepthWriteState = false), + (this._indexInSceneMaterialArray = -1), + (this.meshMap = null), + (this.name = t), + (this.id = t || a.h.RandomId()), + (this._scene = i || u.a.LastCreatedScene), + (this.uniqueId = this._scene.getUniqueId()), + this._scene.useRightHandedSystem + ? (this.sideOrientation = e.ClockWiseSideOrientation) + : (this.sideOrientation = + e.CounterClockWiseSideOrientation), + (this._uniformBuffer = new h.a(this._scene.getEngine())), + (this._useUBO = + this.getScene().getEngine().supportsUniformBuffers), + n || this._scene.addMaterial(this), + this._scene.useMaterialMeshMap && (this.meshMap = {}); + } + return ( + Object.defineProperty(e.prototype, "alpha", { + get: function () { + return this._alpha; + }, + set: function (t) { + this._alpha !== t && + ((this._alpha = t), + this.markAsDirty(e.MiscDirtyFlag)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "backFaceCulling", { - get: function() { - return this._backFaceCulling - }, - set: function(t) { - this._backFaceCulling !== t && (this._backFaceCulling = t, - this.markAsDirty(e.TextureDirtyFlag)) + get: function () { + return this._backFaceCulling; + }, + set: function (t) { + this._backFaceCulling !== t && + ((this._backFaceCulling = t), + this.markAsDirty(e.TextureDirtyFlag)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "hasRenderTargetTextures", + { + get: function () { + return false; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "hasRenderTargetTextures", { - get: function() { - return false - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "onDispose", { - set: function(e) { - this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), - this._onDisposeObserver = this.onDisposeObservable.add(e) - }, - enumerable: true, - configurable: true + set: function (e) { + this._onDisposeObserver && + this.onDisposeObservable.remove( + this._onDisposeObserver + ), + (this._onDisposeObserver = + this.onDisposeObservable.add(e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "onBindObservable", { - get: function() { - return this._onBindObservable || (this._onBindObservable = new s.c), - this._onBindObservable - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._onBindObservable || + (this._onBindObservable = new s.c()), + this._onBindObservable + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "onBind", { - set: function(e) { - this._onBindObserver && this.onBindObservable.remove(this._onBindObserver), - this._onBindObserver = this.onBindObservable.add(e) - }, - enumerable: true, - configurable: true + set: function (e) { + this._onBindObserver && + this.onBindObservable.remove(this._onBindObserver), + (this._onBindObserver = this.onBindObservable.add(e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "onUnBindObservable", { - get: function() { - return this._onUnBindObservable || (this._onUnBindObservable = new s.c), - this._onUnBindObservable - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._onUnBindObservable || + (this._onUnBindObservable = new s.c()), + this._onUnBindObservable + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "alphaMode", { - get: function() { - return this._alphaMode - }, - set: function(t) { - this._alphaMode !== t && (this._alphaMode = t, - this.markAsDirty(e.TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._alphaMode; + }, + set: function (t) { + this._alphaMode !== t && + ((this._alphaMode = t), + this.markAsDirty(e.TextureDirtyFlag)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "needDepthPrePass", { - get: function() { - return this._needDepthPrePass - }, - set: function(e) { - this._needDepthPrePass !== e && (this._needDepthPrePass = e, - this._needDepthPrePass && (this.checkReadyOnEveryCall = true)) - }, - enumerable: true, - configurable: true + get: function () { + return this._needDepthPrePass; + }, + set: function (e) { + this._needDepthPrePass !== e && + ((this._needDepthPrePass = e), + this._needDepthPrePass && + (this.checkReadyOnEveryCall = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "fogEnabled", { - get: function() { - return this._fogEnabled - }, - set: function(t) { - this._fogEnabled !== t && (this._fogEnabled = t, - this.markAsDirty(e.MiscDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._fogEnabled; + }, + set: function (t) { + this._fogEnabled !== t && + ((this._fogEnabled = t), + this.markAsDirty(e.MiscDirtyFlag)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "wireframe", { - get: function() { - switch (this._fillMode) { - case e.WireFrameFillMode: - case e.LineListDrawMode: - case e.LineLoopDrawMode: - case e.LineStripDrawMode: - return true - } - return this._scene.forceWireframe - }, - set: function(t) { - this.fillMode = t ? e.WireFrameFillMode : e.TriangleFillMode - }, - enumerable: true, - configurable: true + get: function () { + switch (this._fillMode) { + case e.WireFrameFillMode: + case e.LineListDrawMode: + case e.LineLoopDrawMode: + case e.LineStripDrawMode: + return true; + } + return this._scene.forceWireframe; + }, + set: function (t) { + this.fillMode = t + ? e.WireFrameFillMode + : e.TriangleFillMode; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "pointsCloud", { - get: function() { - switch (this._fillMode) { - case e.PointFillMode: - case e.PointListDrawMode: - return true - } - return this._scene.forcePointsCloud - }, - set: function(t) { - this.fillMode = t ? e.PointFillMode : e.TriangleFillMode - }, - enumerable: true, - configurable: true + get: function () { + switch (this._fillMode) { + case e.PointFillMode: + case e.PointListDrawMode: + return true; + } + return this._scene.forcePointsCloud; + }, + set: function (t) { + this.fillMode = t + ? e.PointFillMode + : e.TriangleFillMode; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "fillMode", { - get: function() { - return this._fillMode - }, - set: function(t) { - this._fillMode !== t && (this._fillMode = t, - this.markAsDirty(e.MiscDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._fillMode; + }, + set: function (t) { + this._fillMode !== t && + ((this._fillMode = t), + this.markAsDirty(e.MiscDirtyFlag)); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.toString = function (e) { + return "Name: " + this.name; + }), + (e.prototype.getClassName = function () { + return "Material"; }), - e.prototype.toString = function(e) { - return "Name: " + this.name - } - , - e.prototype.getClassName = function() { - return "Material" - } - , Object.defineProperty(e.prototype, "isFrozen", { - get: function() { - return this.checkReadyOnlyOnce - }, - enumerable: true, - configurable: true + get: function () { + return this.checkReadyOnlyOnce; + }, + enumerable: true, + configurable: true, }), - e.prototype.freeze = function() { - this.checkReadyOnlyOnce = true - } - , - e.prototype.unfreeze = function() { - this.checkReadyOnlyOnce = false - } - , - e.prototype.isReady = function(e, t) { - return true - } - , - e.prototype.isReadyForSubMesh = function(e, t, i) { - return false - } - , - e.prototype.getEffect = function() { - return this._effect - } - , - e.prototype.getScene = function() { - return this._scene - } - , - e.prototype.needAlphaBlending = function() { - return this.alpha < 1 - } - , - e.prototype.needAlphaBlendingForMesh = function(e) { - return this.needAlphaBlending() || e.visibility < 1 || e.hasVertexAlpha - } - , - e.prototype.needAlphaTesting = function() { - return false - } - , - e.prototype.getAlphaTestTexture = function() { - return null - } - , - e.prototype.markDirty = function() { - this._wasPreviouslyReady = false - } - , - e.prototype._preBind = function(t, i) { - void 0 === i && (i = null); - var n = this._scene.getEngine() - , r = (null == i ? this.sideOrientation : i) === e.ClockWiseSideOrientation; - return n.enableEffect(t || this._effect), - n.setState(this.backFaceCulling, this.zOffset, false, r), + (e.prototype.freeze = function () { + this.checkReadyOnlyOnce = true; + }), + (e.prototype.unfreeze = function () { + this.checkReadyOnlyOnce = false; + }), + (e.prototype.isReady = function (e, t) { + return true; + }), + (e.prototype.isReadyForSubMesh = function (e, t, i) { + return false; + }), + (e.prototype.getEffect = function () { + return this._effect; + }), + (e.prototype.getScene = function () { + return this._scene; + }), + (e.prototype.needAlphaBlending = function () { + return this.alpha < 1; + }), + (e.prototype.needAlphaBlendingForMesh = function (e) { + return ( + this.needAlphaBlending() || + e.visibility < 1 || + e.hasVertexAlpha + ); + }), + (e.prototype.needAlphaTesting = function () { + return false; + }), + (e.prototype.getAlphaTestTexture = function () { + return null; + }), + (e.prototype.markDirty = function () { + this._wasPreviouslyReady = false; + }), + (e.prototype._preBind = function (t, i) { + void 0 === i && (i = null); + var n = this._scene.getEngine(), + r = + (null == i ? this.sideOrientation : i) === + e.ClockWiseSideOrientation; + return ( + n.enableEffect(t || this._effect), + n.setState( + this.backFaceCulling, + this.zOffset, + false, + r + ), r - } - , - e.prototype.bind = function(e, t) {} - , - e.prototype.bindForSubMesh = function(e, t, i) {} - , - e.prototype.bindOnlyWorldMatrix = function(e) {} - , - e.prototype.bindSceneUniformBuffer = function(e, t) { - t.bindToEffect(e, "Scene") - } - , - e.prototype.bindView = function(e) { - this._useUBO ? this.bindSceneUniformBuffer(e, this.getScene().getSceneUniformBuffer()) : e.setMatrix("view", this.getScene().getViewMatrix()) - } - , - e.prototype.bindViewProjection = function(e) { - this._useUBO ? this.bindSceneUniformBuffer(e, this.getScene().getSceneUniformBuffer()) : e.setMatrix("viewProjection", this.getScene().getTransformMatrix()) - } - , - e.prototype._shouldTurnAlphaTestOn = function(e) { - return !this.needAlphaBlendingForMesh(e) && this.needAlphaTesting() - } - , - e.prototype._afterBind = function(e) { - if (this._scene._cachedMaterial = this, - this._scene._cachedVisibility = e ? e.visibility : 1, - this._onBindObservable && e && this._onBindObservable.notifyObservers(e), - this.disableDepthWrite) { - var t = this._scene.getEngine(); - this._cachedDepthWriteState = t.getDepthWrite(), - t.setDepthWrite(false) + ); + }), + (e.prototype.bind = function (e, t) {}), + (e.prototype.bindForSubMesh = function (e, t, i) {}), + (e.prototype.bindOnlyWorldMatrix = function (e) {}), + (e.prototype.bindSceneUniformBuffer = function (e, t) { + t.bindToEffect(e, "Scene"); + }), + (e.prototype.bindView = function (e) { + this._useUBO + ? this.bindSceneUniformBuffer( + e, + this.getScene().getSceneUniformBuffer() + ) + : e.setMatrix("view", this.getScene().getViewMatrix()); + }), + (e.prototype.bindViewProjection = function (e) { + this._useUBO + ? this.bindSceneUniformBuffer( + e, + this.getScene().getSceneUniformBuffer() + ) + : e.setMatrix( + "viewProjection", + this.getScene().getTransformMatrix() + ); + }), + (e.prototype._shouldTurnAlphaTestOn = function (e) { + return ( + !this.needAlphaBlendingForMesh(e) && + this.needAlphaTesting() + ); + }), + (e.prototype._afterBind = function (e) { + if ( + ((this._scene._cachedMaterial = this), + (this._scene._cachedVisibility = e ? e.visibility : 1), + this._onBindObservable && + e && + this._onBindObservable.notifyObservers(e), + this.disableDepthWrite) + ) { + var t = this._scene.getEngine(); + (this._cachedDepthWriteState = t.getDepthWrite()), + t.setDepthWrite(false); + } + }), + (e.prototype.unbind = function () { + this._onUnBindObservable && + this._onUnBindObservable.notifyObservers(this), + this.disableDepthWrite && + this._scene + .getEngine() + .setDepthWrite(this._cachedDepthWriteState); + }), + (e.prototype.getActiveTextures = function () { + return []; + }), + (e.prototype.hasTexture = function (e) { + return false; + }), + (e.prototype.clone = function (e) { + return null; + }), + (e.prototype.getBindedMeshes = function () { + var e = this; + if (this.meshMap) { + var t = new Array(); + for (var i in this.meshMap) { + var n = this.meshMap[i]; + n && t.push(n); } - } - , - e.prototype.unbind = function() { - this._onUnBindObservable && this._onUnBindObservable.notifyObservers(this), - this.disableDepthWrite && this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState) - } - , - e.prototype.getActiveTextures = function() { - return [] - } - , - e.prototype.hasTexture = function(e) { - return false - } - , - e.prototype.clone = function(e) { - return null - } - , - e.prototype.getBindedMeshes = function() { - var e = this; - if (this.meshMap) { - var t = new Array; - for (var i in this.meshMap) { - var n = this.meshMap[i]; - n && t.push(n) - } - return t + return t; + } + return this._scene.meshes.filter(function (t) { + return t.material === e; + }); + }), + (e.prototype.forceCompilation = function (e, t, i) { + var n = this, + o = r.a( + { + clipPlane: false, + }, + i + ), + a = new l.a(), + s = this.getScene(); + !(function i() { + if (n._scene && n._scene.getEngine()) { + a._materialDefines && + (a._materialDefines._renderId = -1); + var r = s.clipPlane; + o.clipPlane && (s.clipPlane = new c.n(0, 0, 0, 1)), + n._storeEffectOnSubMeshes + ? n.isReadyForSubMesh(e, a) + ? t && t(n) + : setTimeout(i, 16) + : n.isReady() + ? t && t(n) + : setTimeout(i, 16), + o.clipPlane && (s.clipPlane = r); } - return this._scene.meshes.filter(function(t) { - return t.material === e - }) - } - , - e.prototype.forceCompilation = function(e, t, i) { - var n = this - , o = r.a({ - clipPlane: false - }, i) - , a = new l.a - , s = this.getScene(); - !function i() { - if (n._scene && n._scene.getEngine()) { - a._materialDefines && (a._materialDefines._renderId = -1); - var r = s.clipPlane; - o.clipPlane && (s.clipPlane = new c.n(0,0,0,1)), - n._storeEffectOnSubMeshes ? n.isReadyForSubMesh(e, a) ? t && t(n) : setTimeout(i, 16) : n.isReady() ? t && t(n) : setTimeout(i, 16), - o.clipPlane && (s.clipPlane = r) + })(); + }), + (e.prototype.forceCompilationAsync = function (e, t) { + var n = this; + return new i(function (i) { + n.forceCompilation( + e, + function () { + i(); + }, + t + ); + }); + }), + (e.prototype.markAsDirty = function (t) { + this.getScene().blockMaterialDirtyMechanism || + ((e._DirtyCallbackArray.length = 0), + t & e.TextureDirtyFlag && + e._DirtyCallbackArray.push(e._TextureDirtyCallBack), + t & e.LightDirtyFlag && + e._DirtyCallbackArray.push(e._LightsDirtyCallBack), + t & e.FresnelDirtyFlag && + e._DirtyCallbackArray.push(e._FresnelDirtyCallBack), + t & e.AttributesDirtyFlag && + e._DirtyCallbackArray.push(e._AttributeDirtyCallBack), + t & e.MiscDirtyFlag && + e._DirtyCallbackArray.push(e._MiscDirtyCallBack), + e._DirtyCallbackArray.length && + this._markAllSubMeshesAsDirty(e._RunDirtyCallBacks), + this.getScene().resetCachedMaterial()); + }), + (e.prototype._markAllSubMeshesAsDirty = function (e) { + if (!this.getScene().blockMaterialDirtyMechanism) + for ( + var t = 0, i = this.getScene().meshes; + t < i.length; + t++ + ) { + var n = i[t]; + if (n.subMeshes) + for ( + var r = 0, o = n.subMeshes; + r < o.length; + r++ + ) { + var a = o[r]; + a.getMaterial() === this && + a._materialDefines && + e(a._materialDefines); } - }() - } - , - e.prototype.forceCompilationAsync = function(e, t) { - var n = this; - return new i(function(i) { - n.forceCompilation(e, function() { - i() - }, t) } - ) - } - , - e.prototype.markAsDirty = function(t) { - this.getScene().blockMaterialDirtyMechanism || (e._DirtyCallbackArray.length = 0, - t & e.TextureDirtyFlag && e._DirtyCallbackArray.push(e._TextureDirtyCallBack), - t & e.LightDirtyFlag && e._DirtyCallbackArray.push(e._LightsDirtyCallBack), - t & e.FresnelDirtyFlag && e._DirtyCallbackArray.push(e._FresnelDirtyCallBack), - t & e.AttributesDirtyFlag && e._DirtyCallbackArray.push(e._AttributeDirtyCallBack), - t & e.MiscDirtyFlag && e._DirtyCallbackArray.push(e._MiscDirtyCallBack), - e._DirtyCallbackArray.length && this._markAllSubMeshesAsDirty(e._RunDirtyCallBacks), - this.getScene().resetCachedMaterial()) - } - , - e.prototype._markAllSubMeshesAsDirty = function(e) { - if (!this.getScene().blockMaterialDirtyMechanism) - for (var t = 0, i = this.getScene().meshes; t < i.length; t++) { - var n = i[t]; - if (n.subMeshes) - for (var r = 0, o = n.subMeshes; r < o.length; r++) { - var a = o[r]; - a.getMaterial() === this && a._materialDefines && e(a._materialDefines) - } - } - } - , - e.prototype._markAllSubMeshesAsImageProcessingDirty = function() { - this._markAllSubMeshesAsDirty(e._ImageProcessingDirtyCallBack) - } - , - e.prototype._markAllSubMeshesAsTexturesDirty = function() { - this._markAllSubMeshesAsDirty(e._TextureDirtyCallBack) - } - , - e.prototype._markAllSubMeshesAsFresnelDirty = function() { - this._markAllSubMeshesAsDirty(e._FresnelDirtyCallBack) - } - , - e.prototype._markAllSubMeshesAsFresnelAndMiscDirty = function() { - this._markAllSubMeshesAsDirty(e._FresnelAndMiscDirtyCallBack) - } - , - e.prototype._markAllSubMeshesAsLightsDirty = function() { - this._markAllSubMeshesAsDirty(e._LightsDirtyCallBack) - } - , - e.prototype._markAllSubMeshesAsAttributesDirty = function() { - this._markAllSubMeshesAsDirty(e._AttributeDirtyCallBack) - } - , - e.prototype._markAllSubMeshesAsMiscDirty = function() { - this._markAllSubMeshesAsDirty(e._MiscDirtyCallBack) - } - , - e.prototype._markAllSubMeshesAsTexturesAndMiscDirty = function() { - this._markAllSubMeshesAsDirty(e._TextureAndMiscDirtyCallBack) - } - , - e.prototype.dispose = function(e, t, i) { - var n = this.getScene(); - if (n.stopAnimation(this), + }), + (e.prototype._markAllSubMeshesAsImageProcessingDirty = + function () { + this._markAllSubMeshesAsDirty( + e._ImageProcessingDirtyCallBack + ); + }), + (e.prototype._markAllSubMeshesAsTexturesDirty = + function () { + this._markAllSubMeshesAsDirty(e._TextureDirtyCallBack); + }), + (e.prototype._markAllSubMeshesAsFresnelDirty = function () { + this._markAllSubMeshesAsDirty(e._FresnelDirtyCallBack); + }), + (e.prototype._markAllSubMeshesAsFresnelAndMiscDirty = + function () { + this._markAllSubMeshesAsDirty( + e._FresnelAndMiscDirtyCallBack + ); + }), + (e.prototype._markAllSubMeshesAsLightsDirty = function () { + this._markAllSubMeshesAsDirty(e._LightsDirtyCallBack); + }), + (e.prototype._markAllSubMeshesAsAttributesDirty = + function () { + this._markAllSubMeshesAsDirty( + e._AttributeDirtyCallBack + ); + }), + (e.prototype._markAllSubMeshesAsMiscDirty = function () { + this._markAllSubMeshesAsDirty(e._MiscDirtyCallBack); + }), + (e.prototype._markAllSubMeshesAsTexturesAndMiscDirty = + function () { + this._markAllSubMeshesAsDirty( + e._TextureAndMiscDirtyCallBack + ); + }), + (e.prototype.dispose = function (e, t, i) { + var n = this.getScene(); + if ( + (n.stopAnimation(this), n.freeProcessedMaterials(), n.removeMaterial(this), true !== i) - if (this.meshMap) - for (var r in this.meshMap) - (s = this.meshMap[r]) && (s.material = null, - this.releaseVertexArrayObject(s, e)); - else - for (var o = 0, a = n.meshes; o < a.length; o++) { - var s; - (s = a[o]).material !== this || s.sourceMesh || (s.material = null, - this.releaseVertexArrayObject(s, e)) - } - this._uniformBuffer.dispose(), - e && this._effect && (this._storeEffectOnSubMeshes || this._effect.dispose(), - this._effect = null), + ) + if (this.meshMap) + for (var r in this.meshMap) + (s = this.meshMap[r]) && + ((s.material = null), + this.releaseVertexArrayObject(s, e)); + else + for (var o = 0, a = n.meshes; o < a.length; o++) { + var s; + (s = a[o]).material !== this || + s.sourceMesh || + ((s.material = null), + this.releaseVertexArrayObject(s, e)); + } + this._uniformBuffer.dispose(), + e && + this._effect && + (this._storeEffectOnSubMeshes || + this._effect.dispose(), + (this._effect = null)), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), - this._onBindObservable && this._onBindObservable.clear(), - this._onUnBindObservable && this._onUnBindObservable.clear() - } - , - e.prototype.releaseVertexArrayObject = function(e, t) { - if (e.geometry) { - var i = e.geometry; - if (this._storeEffectOnSubMeshes) - for (var n = 0, r = e.subMeshes; n < r.length; n++) { - var o = r[n]; - i._releaseVertexArrayObject(o._materialEffect), - t && o._materialEffect && o._materialEffect.dispose() - } - else - i._releaseVertexArrayObject(this._effect) - } - } - , - e.prototype.serialize = function() { - return o.a.Serialize(this) - } - , - e.Parse = function(e, t, i) { - if (e.customType) { - if ("BABYLON.PBRMaterial" === e.customType && e.overloadedAlbedo && (e.customType = "BABYLON.LegacyPBRMaterial", - !BABYLON.LegacyPBRMaterial)) - return d.a.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."), - null - } else - e.customType = "BABYLON.StandardMaterial"; - return a.h.Instantiate(e.customType).Parse(e, t, i) - } - , - e.TriangleFillMode = f.a.MATERIAL_TriangleFillMode, - e.WireFrameFillMode = f.a.MATERIAL_WireFrameFillMode, - e.PointFillMode = f.a.MATERIAL_PointFillMode, - e.PointListDrawMode = f.a.MATERIAL_PointListDrawMode, - e.LineListDrawMode = f.a.MATERIAL_LineListDrawMode, - e.LineLoopDrawMode = f.a.MATERIAL_LineLoopDrawMode, - e.LineStripDrawMode = f.a.MATERIAL_LineStripDrawMode, - e.TriangleStripDrawMode = f.a.MATERIAL_TriangleStripDrawMode, - e.TriangleFanDrawMode = f.a.MATERIAL_TriangleFanDrawMode, - e.ClockWiseSideOrientation = f.a.MATERIAL_ClockWiseSideOrientation, - e.CounterClockWiseSideOrientation = f.a.MATERIAL_CounterClockWiseSideOrientation, - e.TextureDirtyFlag = f.a.MATERIAL_TextureDirtyFlag, - e.LightDirtyFlag = f.a.MATERIAL_LightDirtyFlag, - e.FresnelDirtyFlag = f.a.MATERIAL_FresnelDirtyFlag, - e.AttributesDirtyFlag = f.a.MATERIAL_AttributesDirtyFlag, - e.MiscDirtyFlag = f.a.MATERIAL_MiscDirtyFlag, - e.AllDirtyFlag = f.a.MATERIAL_AllDirtyFlag, - e._ImageProcessingDirtyCallBack = function(e) { - return e.markAsImageProcessingDirty() - } - , - e._TextureDirtyCallBack = function(e) { - return e.markAsTexturesDirty() - } - , - e._FresnelDirtyCallBack = function(e) { - return e.markAsFresnelDirty() - } - , - e._MiscDirtyCallBack = function(e) { - return e.markAsMiscDirty() - } - , - e._LightsDirtyCallBack = function(e) { - return e.markAsLightDirty() - } - , - e._AttributeDirtyCallBack = function(e) { - return e.markAsAttributesDirty() - } - , - e._FresnelAndMiscDirtyCallBack = function(t) { - e._FresnelDirtyCallBack(t), - e._MiscDirtyCallBack(t) - } - , - e._TextureAndMiscDirtyCallBack = function(t) { - e._TextureDirtyCallBack(t), - e._MiscDirtyCallBack(t) - } - , - e._DirtyCallbackArray = [], - e._RunDirtyCallBacks = function(t) { - for (var i = 0, n = e._DirtyCallbackArray; i < n.length; i++) - (0, - n[i])(t) - } - , + this._onBindObservable && + this._onBindObservable.clear(), + this._onUnBindObservable && + this._onUnBindObservable.clear(); + }), + (e.prototype.releaseVertexArrayObject = function (e, t) { + if (e.geometry) { + var i = e.geometry; + if (this._storeEffectOnSubMeshes) + for (var n = 0, r = e.subMeshes; n < r.length; n++) { + var o = r[n]; + i._releaseVertexArrayObject(o._materialEffect), + t && + o._materialEffect && + o._materialEffect.dispose(); + } + else i._releaseVertexArrayObject(this._effect); + } + }), + (e.prototype.serialize = function () { + return o.a.Serialize(this); + }), + (e.Parse = function (e, t, i) { + if (e.customType) { + if ( + "BABYLON.PBRMaterial" === e.customType && + e.overloadedAlbedo && + ((e.customType = "BABYLON.LegacyPBRMaterial"), + !BABYLON.LegacyPBRMaterial) + ) + return ( + d.a.Error( + "Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library." + ), + null + ); + } else e.customType = "BABYLON.StandardMaterial"; + return a.h.Instantiate(e.customType).Parse(e, t, i); + }), + (e.TriangleFillMode = f.a.MATERIAL_TriangleFillMode), + (e.WireFrameFillMode = f.a.MATERIAL_WireFrameFillMode), + (e.PointFillMode = f.a.MATERIAL_PointFillMode), + (e.PointListDrawMode = f.a.MATERIAL_PointListDrawMode), + (e.LineListDrawMode = f.a.MATERIAL_LineListDrawMode), + (e.LineLoopDrawMode = f.a.MATERIAL_LineLoopDrawMode), + (e.LineStripDrawMode = f.a.MATERIAL_LineStripDrawMode), + (e.TriangleStripDrawMode = + f.a.MATERIAL_TriangleStripDrawMode), + (e.TriangleFanDrawMode = f.a.MATERIAL_TriangleFanDrawMode), + (e.ClockWiseSideOrientation = + f.a.MATERIAL_ClockWiseSideOrientation), + (e.CounterClockWiseSideOrientation = + f.a.MATERIAL_CounterClockWiseSideOrientation), + (e.TextureDirtyFlag = f.a.MATERIAL_TextureDirtyFlag), + (e.LightDirtyFlag = f.a.MATERIAL_LightDirtyFlag), + (e.FresnelDirtyFlag = f.a.MATERIAL_FresnelDirtyFlag), + (e.AttributesDirtyFlag = f.a.MATERIAL_AttributesDirtyFlag), + (e.MiscDirtyFlag = f.a.MATERIAL_MiscDirtyFlag), + (e.AllDirtyFlag = f.a.MATERIAL_AllDirtyFlag), + (e._ImageProcessingDirtyCallBack = function (e) { + return e.markAsImageProcessingDirty(); + }), + (e._TextureDirtyCallBack = function (e) { + return e.markAsTexturesDirty(); + }), + (e._FresnelDirtyCallBack = function (e) { + return e.markAsFresnelDirty(); + }), + (e._MiscDirtyCallBack = function (e) { + return e.markAsMiscDirty(); + }), + (e._LightsDirtyCallBack = function (e) { + return e.markAsLightDirty(); + }), + (e._AttributeDirtyCallBack = function (e) { + return e.markAsAttributesDirty(); + }), + (e._FresnelAndMiscDirtyCallBack = function (t) { + e._FresnelDirtyCallBack(t), e._MiscDirtyCallBack(t); + }), + (e._TextureAndMiscDirtyCallBack = function (t) { + e._TextureDirtyCallBack(t), e._MiscDirtyCallBack(t); + }), + (e._DirtyCallbackArray = []), + (e._RunDirtyCallBacks = function (t) { + for ( + var i = 0, n = e._DirtyCallbackArray; + i < n.length; + i++ + ) + (0, n[i])(t); + }), r.c([Object(o.c)()], e.prototype, "id", void 0), r.c([Object(o.c)()], e.prototype, "uniqueId", void 0), r.c([Object(o.c)()], e.prototype, "name", void 0), - r.c([Object(o.c)()], e.prototype, "checkReadyOnEveryCall", void 0), - r.c([Object(o.c)()], e.prototype, "checkReadyOnlyOnce", void 0), + r.c( + [Object(o.c)()], + e.prototype, + "checkReadyOnEveryCall", + void 0 + ), + r.c( + [Object(o.c)()], + e.prototype, + "checkReadyOnlyOnce", + void 0 + ), r.c([Object(o.c)()], e.prototype, "state", void 0), r.c([Object(o.c)("alpha")], e.prototype, "_alpha", void 0), - r.c([Object(o.c)("backFaceCulling")], e.prototype, "_backFaceCulling", void 0), - r.c([Object(o.c)()], e.prototype, "sideOrientation", void 0), - r.c([Object(o.c)("alphaMode")], e.prototype, "_alphaMode", void 0), - r.c([Object(o.c)()], e.prototype, "_needDepthPrePass", void 0), - r.c([Object(o.c)()], e.prototype, "disableDepthWrite", void 0), - r.c([Object(o.c)()], e.prototype, "forceDepthWrite", void 0), - r.c([Object(o.c)()], e.prototype, "separateCullingPass", void 0), - r.c([Object(o.c)("fogEnabled")], e.prototype, "_fogEnabled", void 0), + r.c( + [Object(o.c)("backFaceCulling")], + e.prototype, + "_backFaceCulling", + void 0 + ), + r.c( + [Object(o.c)()], + e.prototype, + "sideOrientation", + void 0 + ), + r.c( + [Object(o.c)("alphaMode")], + e.prototype, + "_alphaMode", + void 0 + ), + r.c( + [Object(o.c)()], + e.prototype, + "_needDepthPrePass", + void 0 + ), + r.c( + [Object(o.c)()], + e.prototype, + "disableDepthWrite", + void 0 + ), + r.c( + [Object(o.c)()], + e.prototype, + "forceDepthWrite", + void 0 + ), + r.c( + [Object(o.c)()], + e.prototype, + "separateCullingPass", + void 0 + ), + r.c( + [Object(o.c)("fogEnabled")], + e.prototype, + "_fogEnabled", + void 0 + ), r.c([Object(o.c)()], e.prototype, "pointSize", void 0), r.c([Object(o.c)()], e.prototype, "zOffset", void 0), r.c([Object(o.c)()], e.prototype, "wireframe", null), r.c([Object(o.c)()], e.prototype, "pointsCloud", null), r.c([Object(o.c)()], e.prototype, "fillMode", null), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return d - }); - var n = i(1) - , r = i(2) - , o = i(28) - , a = i(9) - , s = i(8) - , c = i(0) - , u = i(25) - , l = i(6) - , h = i(22) - , f = i(19) - , d = function(e) { - function t(i, n, r, a) { - void 0 === a && (a = true); - var u = e.call(this, i, r) || this; - return u._position = c.x.Zero(), - u.upVector = c.x.Up(), - u.orthoLeft = null, - u.orthoRight = null, - u.orthoBottom = null, - u.orthoTop = null, - u.fov = .8, - u.minZ = 1, - u.maxZ = 1e4, - u.inertia = .9, - u.mode = t.PERSPECTIVE_CAMERA, - u.isIntermediate = false, - u.viewport = new c.z(0,0,1,1), - u.layerMask = 268435455, - u.fovMode = t.FOVMODE_VERTICAL_FIXED, - u.cameraRigMode = t.RIG_MODE_NONE, - u.customRenderTargets = new Array, - u.outputRenderTarget = null, - u.onViewMatrixChangedObservable = new s.c, - u.onProjectionMatrixChangedObservable = new s.c, - u.onAfterCheckInputsObservable = new s.c, - u.onRestoreStateObservable = new s.c, - u._rigCameras = new Array, - u._webvrViewMatrix = c.j.Identity(), - u._skipRendering = false, - u._projectionMatrix = new c.j, - u._postProcesses = new Array, - u._activeMeshes = new o.a(256), - u._globalPosition = c.x.Zero(), - u._computedViewMatrix = c.j.Identity(), - u._doNotComputeProjectionMatrix = false, - u._transformMatrix = c.j.Zero(), - u._refreshFrustumPlanes = true, - u._isCamera = true, - u._isLeftCamera = false, - u._isRightCamera = true, - u.getScene().addCamera(u), - a && !u.getScene().activeCamera && (u.getScene().activeCamera = u), - u.position = n, - u - } - return n.d(t, e), + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return d; + }); + var n = i(1), + r = i(2), + o = i(28), + a = i(9), + s = i(8), + c = i(0), + u = i(25), + l = i(6), + h = i(22), + f = i(19), + d = (function (e) { + function t(i, n, r, a) { + void 0 === a && (a = true); + var u = e.call(this, i, r) || this; + return ( + (u._position = c.x.Zero()), + (u.upVector = c.x.Up()), + (u.orthoLeft = null), + (u.orthoRight = null), + (u.orthoBottom = null), + (u.orthoTop = null), + (u.fov = 0.8), + (u.minZ = 1), + (u.maxZ = 1e4), + (u.inertia = 0.9), + (u.mode = t.PERSPECTIVE_CAMERA), + (u.isIntermediate = false), + (u.viewport = new c.z(0, 0, 1, 1)), + (u.layerMask = 268435455), + (u.fovMode = t.FOVMODE_VERTICAL_FIXED), + (u.cameraRigMode = t.RIG_MODE_NONE), + (u.customRenderTargets = new Array()), + (u.outputRenderTarget = null), + (u.onViewMatrixChangedObservable = new s.c()), + (u.onProjectionMatrixChangedObservable = new s.c()), + (u.onAfterCheckInputsObservable = new s.c()), + (u.onRestoreStateObservable = new s.c()), + (u._rigCameras = new Array()), + (u._webvrViewMatrix = c.j.Identity()), + (u._skipRendering = false), + (u._projectionMatrix = new c.j()), + (u._postProcesses = new Array()), + (u._activeMeshes = new o.a(256)), + (u._globalPosition = c.x.Zero()), + (u._computedViewMatrix = c.j.Identity()), + (u._doNotComputeProjectionMatrix = false), + (u._transformMatrix = c.j.Zero()), + (u._refreshFrustumPlanes = true), + (u._isCamera = true), + (u._isLeftCamera = false), + (u._isRightCamera = true), + u.getScene().addCamera(u), + a && + !u.getScene().activeCamera && + (u.getScene().activeCamera = u), + (u.position = n), + u + ); + } + return ( + n.d(t, e), Object.defineProperty(t.prototype, "position", { - get: function() { - return this._position - }, - set: function(e) { - this._position = e - }, - enumerable: true, - configurable: true + get: function () { + return this._position; + }, + set: function (e) { + this._position = e; + }, + enumerable: true, + configurable: true, }), - t.prototype.storeState = function() { - return this._stateStored = true, - this._storedFov = this.fov, + (t.prototype.storeState = function () { + return ( + (this._stateStored = true), + (this._storedFov = this.fov), this - } - , - t.prototype._restoreStateValues = function() { - return !!this._stateStored && (this.fov = this._storedFov, - true) - } - , - t.prototype.restoreState = function() { - return !!this._restoreStateValues() && (this.onRestoreStateObservable.notifyObservers(this), - true) - } - , - t.prototype.getClassName = function() { - return "Camera" - } - , - t.prototype.toString = function(e) { - var t = "Name: " + this.name; - if (t += ", type: " + this.getClassName(), - this.animations) - for (var i = 0; i < this.animations.length; i++) - t += ", animation[0]: " + this.animations[i].toString(e); - return t - } - , - Object.defineProperty(t.prototype, "globalPosition", { - get: function() { - return this._globalPosition - }, - enumerable: true, - configurable: true + ); }), - t.prototype.getActiveMeshes = function() { - return this._activeMeshes - } - , - t.prototype.isActiveMesh = function(e) { - return -1 !== this._activeMeshes.indexOf(e) - } - , - t.prototype.isReady = function(t) { - if (void 0 === t && (t = false), - t) - for (var i = 0, n = this._postProcesses; i < n.length; i++) { - var r = n[i]; - if (r && !r.isReady()) - return false - } - return e.prototype.isReady.call(this, t) - } - , - t.prototype._initCache = function() { - e.prototype._initCache.call(this), - this._cache.position = new c.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), - this._cache.upVector = new c.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), - this._cache.mode = void 0, - this._cache.minZ = void 0, - this._cache.maxZ = void 0, - this._cache.fov = void 0, - this._cache.fovMode = void 0, - this._cache.aspectRatio = void 0, - this._cache.orthoLeft = void 0, - this._cache.orthoRight = void 0, - this._cache.orthoBottom = void 0, - this._cache.orthoTop = void 0, - this._cache.renderWidth = void 0, - this._cache.renderHeight = void 0 - } - , - t.prototype._updateCache = function(t) { - t || e.prototype._updateCache.call(this), + (t.prototype._restoreStateValues = function () { + return ( + !!this._stateStored && + ((this.fov = this._storedFov), true) + ); + }), + (t.prototype.restoreState = function () { + return ( + !!this._restoreStateValues() && + (this.onRestoreStateObservable.notifyObservers(this), + true) + ); + }), + (t.prototype.getClassName = function () { + return "Camera"; + }), + (t.prototype.toString = function (e) { + var t = "Name: " + this.name; + if ( + ((t += ", type: " + this.getClassName()), + this.animations) + ) + for (var i = 0; i < this.animations.length; i++) + t += + ", animation[0]: " + this.animations[i].toString(e); + return t; + }), + Object.defineProperty(t.prototype, "globalPosition", { + get: function () { + return this._globalPosition; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getActiveMeshes = function () { + return this._activeMeshes; + }), + (t.prototype.isActiveMesh = function (e) { + return -1 !== this._activeMeshes.indexOf(e); + }), + (t.prototype.isReady = function (t) { + if ((void 0 === t && (t = false), t)) + for ( + var i = 0, n = this._postProcesses; + i < n.length; + i++ + ) { + var r = n[i]; + if (r && !r.isReady()) return false; + } + return e.prototype.isReady.call(this, t); + }), + (t.prototype._initCache = function () { + e.prototype._initCache.call(this), + (this._cache.position = new c.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )), + (this._cache.upVector = new c.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )), + (this._cache.mode = void 0), + (this._cache.minZ = void 0), + (this._cache.maxZ = void 0), + (this._cache.fov = void 0), + (this._cache.fovMode = void 0), + (this._cache.aspectRatio = void 0), + (this._cache.orthoLeft = void 0), + (this._cache.orthoRight = void 0), + (this._cache.orthoBottom = void 0), + (this._cache.orthoTop = void 0), + (this._cache.renderWidth = void 0), + (this._cache.renderHeight = void 0); + }), + (t.prototype._updateCache = function (t) { + t || e.prototype._updateCache.call(this), this._cache.position.copyFrom(this.position), - this._cache.upVector.copyFrom(this.upVector) - } - , - t.prototype._isSynchronized = function() { - return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix() - } - , - t.prototype._isSynchronizedViewMatrix = function() { - return !!e.prototype._isSynchronized.call(this) && this._cache.position.equals(this.position) && this._cache.upVector.equals(this.upVector) && this.isSynchronizedWithParent() - } - , - t.prototype._isSynchronizedProjectionMatrix = function() { - var e = this._cache.mode === this.mode && this._cache.minZ === this.minZ && this._cache.maxZ === this.maxZ; - if (!e) - return false; - var i = this.getEngine(); - return this.mode === t.PERSPECTIVE_CAMERA ? this._cache.fov === this.fov && this._cache.fovMode === this.fovMode && this._cache.aspectRatio === i.getAspectRatio(this) : this._cache.orthoLeft === this.orthoLeft && this._cache.orthoRight === this.orthoRight && this._cache.orthoBottom === this.orthoBottom && this._cache.orthoTop === this.orthoTop && this._cache.renderWidth === i.getRenderWidth() && this._cache.renderHeight === i.getRenderHeight() - } - , - t.prototype.attachControl = function(e, t) {} - , - t.prototype.detachControl = function(e) {} - , - t.prototype.update = function() { - this._checkInputs(), - this.cameraRigMode !== t.RIG_MODE_NONE && this._updateRigCameras() - } - , - t.prototype._checkInputs = function() { - this.onAfterCheckInputsObservable.notifyObservers(this) - } - , + this._cache.upVector.copyFrom(this.upVector); + }), + (t.prototype._isSynchronized = function () { + return ( + this._isSynchronizedViewMatrix() && + this._isSynchronizedProjectionMatrix() + ); + }), + (t.prototype._isSynchronizedViewMatrix = function () { + return ( + !!e.prototype._isSynchronized.call(this) && + this._cache.position.equals(this.position) && + this._cache.upVector.equals(this.upVector) && + this.isSynchronizedWithParent() + ); + }), + (t.prototype._isSynchronizedProjectionMatrix = function () { + var e = + this._cache.mode === this.mode && + this._cache.minZ === this.minZ && + this._cache.maxZ === this.maxZ; + if (!e) return false; + var i = this.getEngine(); + return this.mode === t.PERSPECTIVE_CAMERA + ? this._cache.fov === this.fov && + this._cache.fovMode === this.fovMode && + this._cache.aspectRatio === i.getAspectRatio(this) + : this._cache.orthoLeft === this.orthoLeft && + this._cache.orthoRight === this.orthoRight && + this._cache.orthoBottom === this.orthoBottom && + this._cache.orthoTop === this.orthoTop && + this._cache.renderWidth === i.getRenderWidth() && + this._cache.renderHeight === i.getRenderHeight(); + }), + (t.prototype.attachControl = function (e, t) {}), + (t.prototype.detachControl = function (e) {}), + (t.prototype.update = function () { + this._checkInputs(), + this.cameraRigMode !== t.RIG_MODE_NONE && + this._updateRigCameras(); + }), + (t.prototype._checkInputs = function () { + this.onAfterCheckInputsObservable.notifyObservers(this); + }), Object.defineProperty(t.prototype, "rigCameras", { - get: function() { - return this._rigCameras - }, - enumerable: true, - configurable: true + get: function () { + return this._rigCameras; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rigPostProcess", { - get: function() { - return this._rigPostProcess - }, - enumerable: true, - configurable: true + get: function () { + return this._rigPostProcess; + }, + enumerable: true, + configurable: true, }), - t.prototype._getFirstPostProcess = function() { - for (var e = 0; e < this._postProcesses.length; e++) - if (null !== this._postProcesses[e]) - return this._postProcesses[e]; - return null - } - , - t.prototype._cascadePostProcessesToRigCams = function() { - var e = this._getFirstPostProcess(); - e && e.markTextureDirty(); - for (var t = 0, i = this._rigCameras.length; t < i; t++) { - var n = this._rigCameras[t] - , r = n._rigPostProcess; - r ? ("pass" === r.getEffectName() && (n.isIntermediate = 0 === this._postProcesses.length), - n._postProcesses = this._postProcesses.slice(0).concat(r), - r.markTextureDirty()) : n._postProcesses = this._postProcesses.slice(0) - } - } - , - t.prototype.attachPostProcess = function(e, t) { - return void 0 === t && (t = null), - !e.isReusable() && this._postProcesses.indexOf(e) > -1 ? (l.a.Error("You're trying to reuse a post process not defined as reusable."), - 0) : (null == t || t < 0 ? this._postProcesses.push(e) : null === this._postProcesses[t] ? this._postProcesses[t] = e : this._postProcesses.splice(t, 0, e), - this._cascadePostProcessesToRigCams(), - this._postProcesses.indexOf(e)) - } - , - t.prototype.detachPostProcess = function(e) { - var t = this._postProcesses.indexOf(e); - -1 !== t && (this._postProcesses[t] = null), - this._cascadePostProcessesToRigCams() - } - , - t.prototype.getWorldMatrix = function() { - return this._isSynchronizedViewMatrix() ? this._worldMatrix : (this.getViewMatrix(), - this._worldMatrix) - } - , - t.prototype._getViewMatrix = function() { - return c.j.Identity() - } - , - t.prototype.getViewMatrix = function(e) { - return !e && this._isSynchronizedViewMatrix() ? this._computedViewMatrix : (this.updateCache(), - this._computedViewMatrix = this._getViewMatrix(), - this._currentRenderId = this.getScene().getRenderId(), - this._childUpdateId++, - this._refreshFrustumPlanes = true, - this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix && this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix), - this.parent && this.parent.onViewMatrixChangedObservable && this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent), - this.onViewMatrixChangedObservable.notifyObservers(this), - this._computedViewMatrix.invertToRef(this._worldMatrix), - this._computedViewMatrix) - } - , - t.prototype.freezeProjectionMatrix = function(e) { - this._doNotComputeProjectionMatrix = true, - void 0 !== e && (this._projectionMatrix = e) - } - , - t.prototype.unfreezeProjectionMatrix = function() { - this._doNotComputeProjectionMatrix = false - } - , - t.prototype.getProjectionMatrix = function(e) { - if (this._doNotComputeProjectionMatrix || !e && this._isSynchronizedProjectionMatrix()) - return this._projectionMatrix; - this._cache.mode = this.mode, - this._cache.minZ = this.minZ, - this._cache.maxZ = this.maxZ, - this._refreshFrustumPlanes = true; - var i = this.getEngine() - , n = this.getScene(); - if (this.mode === t.PERSPECTIVE_CAMERA) - this._cache.fov = this.fov, - this._cache.fovMode = this.fovMode, - this._cache.aspectRatio = i.getAspectRatio(this), - this.minZ <= 0 && (this.minZ = .1), - n.useRightHandedSystem ? c.j.PerspectiveFovRHToRef(this.fov, i.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === t.FOVMODE_VERTICAL_FIXED) : c.j.PerspectiveFovLHToRef(this.fov, i.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === t.FOVMODE_VERTICAL_FIXED); - else { - var r = i.getRenderWidth() / 2 - , o = i.getRenderHeight() / 2; - n.useRightHandedSystem ? c.j.OrthoOffCenterRHToRef(this.orthoLeft || -r, this.orthoRight || r, this.orthoBottom || -o, this.orthoTop || o, this.minZ, this.maxZ, this._projectionMatrix) : c.j.OrthoOffCenterLHToRef(this.orthoLeft || -r, this.orthoRight || r, this.orthoBottom || -o, this.orthoTop || o, this.minZ, this.maxZ, this._projectionMatrix), - this._cache.orthoLeft = this.orthoLeft, - this._cache.orthoRight = this.orthoRight, - this._cache.orthoBottom = this.orthoBottom, - this._cache.orthoTop = this.orthoTop, - this._cache.renderWidth = i.getRenderWidth(), - this._cache.renderHeight = i.getRenderHeight() - } - return this.onProjectionMatrixChangedObservable.notifyObservers(this), + (t.prototype._getFirstPostProcess = function () { + for (var e = 0; e < this._postProcesses.length; e++) + if (null !== this._postProcesses[e]) + return this._postProcesses[e]; + return null; + }), + (t.prototype._cascadePostProcessesToRigCams = function () { + var e = this._getFirstPostProcess(); + e && e.markTextureDirty(); + for (var t = 0, i = this._rigCameras.length; t < i; t++) { + var n = this._rigCameras[t], + r = n._rigPostProcess; + r + ? ("pass" === r.getEffectName() && + (n.isIntermediate = + 0 === this._postProcesses.length), + (n._postProcesses = this._postProcesses + .slice(0) + .concat(r)), + r.markTextureDirty()) + : (n._postProcesses = this._postProcesses.slice(0)); + } + }), + (t.prototype.attachPostProcess = function (e, t) { + return ( + void 0 === t && (t = null), + !e.isReusable() && this._postProcesses.indexOf(e) > -1 + ? (l.a.Error( + "You're trying to reuse a post process not defined as reusable." + ), + 0) + : (null == t || t < 0 + ? this._postProcesses.push(e) + : null === this._postProcesses[t] + ? (this._postProcesses[t] = e) + : this._postProcesses.splice(t, 0, e), + this._cascadePostProcessesToRigCams(), + this._postProcesses.indexOf(e)) + ); + }), + (t.prototype.detachPostProcess = function (e) { + var t = this._postProcesses.indexOf(e); + -1 !== t && (this._postProcesses[t] = null), + this._cascadePostProcessesToRigCams(); + }), + (t.prototype.getWorldMatrix = function () { + return this._isSynchronizedViewMatrix() + ? this._worldMatrix + : (this.getViewMatrix(), this._worldMatrix); + }), + (t.prototype._getViewMatrix = function () { + return c.j.Identity(); + }), + (t.prototype.getViewMatrix = function (e) { + return !e && this._isSynchronizedViewMatrix() + ? this._computedViewMatrix + : (this.updateCache(), + (this._computedViewMatrix = this._getViewMatrix()), + (this._currentRenderId = + this.getScene().getRenderId()), + this._childUpdateId++, + (this._refreshFrustumPlanes = true), + this._cameraRigParams && + this._cameraRigParams.vrPreViewMatrix && + this._computedViewMatrix.multiplyToRef( + this._cameraRigParams.vrPreViewMatrix, + this._computedViewMatrix + ), + this.parent && + this.parent.onViewMatrixChangedObservable && + this.parent.onViewMatrixChangedObservable.notifyObservers( + this.parent + ), + this.onViewMatrixChangedObservable.notifyObservers( + this + ), + this._computedViewMatrix.invertToRef( + this._worldMatrix + ), + this._computedViewMatrix); + }), + (t.prototype.freezeProjectionMatrix = function (e) { + (this._doNotComputeProjectionMatrix = true), + void 0 !== e && (this._projectionMatrix = e); + }), + (t.prototype.unfreezeProjectionMatrix = function () { + this._doNotComputeProjectionMatrix = false; + }), + (t.prototype.getProjectionMatrix = function (e) { + if ( + this._doNotComputeProjectionMatrix || + (!e && this._isSynchronizedProjectionMatrix()) + ) + return this._projectionMatrix; + (this._cache.mode = this.mode), + (this._cache.minZ = this.minZ), + (this._cache.maxZ = this.maxZ), + (this._refreshFrustumPlanes = true); + var i = this.getEngine(), + n = this.getScene(); + if (this.mode === t.PERSPECTIVE_CAMERA) + (this._cache.fov = this.fov), + (this._cache.fovMode = this.fovMode), + (this._cache.aspectRatio = i.getAspectRatio(this)), + this.minZ <= 0 && (this.minZ = 0.1), + n.useRightHandedSystem + ? c.j.PerspectiveFovRHToRef( + this.fov, + i.getAspectRatio(this), + this.minZ, + this.maxZ, + this._projectionMatrix, + this.fovMode === t.FOVMODE_VERTICAL_FIXED + ) + : c.j.PerspectiveFovLHToRef( + this.fov, + i.getAspectRatio(this), + this.minZ, + this.maxZ, + this._projectionMatrix, + this.fovMode === t.FOVMODE_VERTICAL_FIXED + ); + else { + var r = i.getRenderWidth() / 2, + o = i.getRenderHeight() / 2; + n.useRightHandedSystem + ? c.j.OrthoOffCenterRHToRef( + this.orthoLeft || -r, + this.orthoRight || r, + this.orthoBottom || -o, + this.orthoTop || o, + this.minZ, + this.maxZ, + this._projectionMatrix + ) + : c.j.OrthoOffCenterLHToRef( + this.orthoLeft || -r, + this.orthoRight || r, + this.orthoBottom || -o, + this.orthoTop || o, + this.minZ, + this.maxZ, + this._projectionMatrix + ), + (this._cache.orthoLeft = this.orthoLeft), + (this._cache.orthoRight = this.orthoRight), + (this._cache.orthoBottom = this.orthoBottom), + (this._cache.orthoTop = this.orthoTop), + (this._cache.renderWidth = i.getRenderWidth()), + (this._cache.renderHeight = i.getRenderHeight()); + } + return ( + this.onProjectionMatrixChangedObservable.notifyObservers( + this + ), this._projectionMatrix - } - , - t.prototype.getTransformationMatrix = function() { - return this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix), + ); + }), + (t.prototype.getTransformationMatrix = function () { + return ( + this._computedViewMatrix.multiplyToRef( + this._projectionMatrix, + this._transformMatrix + ), this._transformMatrix - } - , - t.prototype._updateFrustumPlanes = function() { - this._refreshFrustumPlanes && (this.getTransformationMatrix(), - this._frustumPlanes ? c.i.GetPlanesToRef(this._transformMatrix, this._frustumPlanes) : this._frustumPlanes = c.i.GetPlanes(this._transformMatrix), - this._refreshFrustumPlanes = false) - } - , - t.prototype.isInFrustum = function(e, t) { - if (void 0 === t && (t = false), + ); + }), + (t.prototype._updateFrustumPlanes = function () { + this._refreshFrustumPlanes && + (this.getTransformationMatrix(), + this._frustumPlanes + ? c.i.GetPlanesToRef( + this._transformMatrix, + this._frustumPlanes + ) + : (this._frustumPlanes = c.i.GetPlanes( + this._transformMatrix + )), + (this._refreshFrustumPlanes = false)); + }), + (t.prototype.isInFrustum = function (e, t) { + if ( + (void 0 === t && (t = false), + this._updateFrustumPlanes(), + t && this.rigCameras.length > 0) + ) { + var i = false; + return ( + this.rigCameras.forEach(function (t) { + t._updateFrustumPlanes(), + (i = i || e.isInFrustum(t._frustumPlanes)); + }), + i + ); + } + return e.isInFrustum(this._frustumPlanes); + }), + (t.prototype.isCompletelyInFrustum = function (e) { + return ( this._updateFrustumPlanes(), - t && this.rigCameras.length > 0) { - var i = false; - return this.rigCameras.forEach(function(t) { - t._updateFrustumPlanes(), - i = i || e.isInFrustum(t._frustumPlanes) - }), - i - } - return e.isInFrustum(this._frustumPlanes) - } - , - t.prototype.isCompletelyInFrustum = function(e) { - return this._updateFrustumPlanes(), e.isCompletelyInFrustum(this._frustumPlanes) - } - , - t.prototype.getForwardRay = function(e, t, i) { - throw void 0 === e && (e = 100), - f.a.WarnImport("Ray") - } - , - t.prototype.dispose = function(i, n) { - for (void 0 === n && (n = false), - this.onViewMatrixChangedObservable.clear(), - this.onProjectionMatrixChangedObservable.clear(), - this.onAfterCheckInputsObservable.clear(), - this.onRestoreStateObservable.clear(), - this.inputs && this.inputs.clear(), - this.getScene().stopAnimation(this), - this.getScene().removeCamera(this); this._rigCameras.length > 0; ) { - var r = this._rigCameras.pop(); - r && r.dispose() + ); + }), + (t.prototype.getForwardRay = function (e, t, i) { + throw (void 0 === e && (e = 100), f.a.WarnImport("Ray")); + }), + (t.prototype.dispose = function (i, n) { + for ( + void 0 === n && (n = false), + this.onViewMatrixChangedObservable.clear(), + this.onProjectionMatrixChangedObservable.clear(), + this.onAfterCheckInputsObservable.clear(), + this.onRestoreStateObservable.clear(), + this.inputs && this.inputs.clear(), + this.getScene().stopAnimation(this), + this.getScene().removeCamera(this); + this._rigCameras.length > 0; + + ) { + var r = this._rigCameras.pop(); + r && r.dispose(); + } + if (this._rigPostProcess) + this._rigPostProcess.dispose(this), + (this._rigPostProcess = null), + (this._postProcesses = []); + else if (this.cameraRigMode !== t.RIG_MODE_NONE) + (this._rigPostProcess = null), + (this._postProcesses = []); + else + for (var o = this._postProcesses.length; --o >= 0; ) { + var a = this._postProcesses[o]; + a && a.dispose(this); } - if (this._rigPostProcess) - this._rigPostProcess.dispose(this), - this._rigPostProcess = null, - this._postProcesses = []; - else if (this.cameraRigMode !== t.RIG_MODE_NONE) - this._rigPostProcess = null, - this._postProcesses = []; - else - for (var o = this._postProcesses.length; --o >= 0; ) { - var a = this._postProcesses[o]; - a && a.dispose(this) - } - for (o = this.customRenderTargets.length; --o >= 0; ) - this.customRenderTargets[o].dispose(); - this.customRenderTargets = [], + for (o = this.customRenderTargets.length; --o >= 0; ) + this.customRenderTargets[o].dispose(); + (this.customRenderTargets = []), this._activeMeshes.dispose(), - e.prototype.dispose.call(this, i, n) - } - , + e.prototype.dispose.call(this, i, n); + }), Object.defineProperty(t.prototype, "isLeftCamera", { - get: function() { - return this._isLeftCamera - }, - enumerable: true, - configurable: true + get: function () { + return this._isLeftCamera; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "isRightCamera", { - get: function() { - return this._isRightCamera - }, - enumerable: true, - configurable: true + get: function () { + return this._isRightCamera; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "leftCamera", { - get: function() { - return this._rigCameras.length < 1 ? null : this._rigCameras[0] - }, - enumerable: true, - configurable: true + get: function () { + return this._rigCameras.length < 1 + ? null + : this._rigCameras[0]; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rightCamera", { - get: function() { - return this._rigCameras.length < 2 ? null : this._rigCameras[1] - }, - enumerable: true, - configurable: true + get: function () { + return this._rigCameras.length < 2 + ? null + : this._rigCameras[1]; + }, + enumerable: true, + configurable: true, }), - t.prototype.getLeftTarget = function() { - return this._rigCameras.length < 1 ? null : this._rigCameras[0].getTarget() - } - , - t.prototype.getRightTarget = function() { - return this._rigCameras.length < 2 ? null : this._rigCameras[1].getTarget() - } - , - t.prototype.setCameraRigMode = function(e, i) { - if (this.cameraRigMode !== e) { - for (; this._rigCameras.length > 0; ) { - var n = this._rigCameras.pop(); - n && n.dispose() - } - if (this.cameraRigMode = e, - this._cameraRigParams = {}, - this._cameraRigParams.interaxialDistance = i.interaxialDistance || .0637, - this._cameraRigParams.stereoHalfAngle = a.h.ToRadians(this._cameraRigParams.interaxialDistance / .0637), - this.cameraRigMode !== t.RIG_MODE_NONE) { - var r = this.createRigCamera(this.name + "_L", 0); - r && (r._isLeftCamera = true); - var o = this.createRigCamera(this.name + "_R", 1); - o && (o._isRightCamera = true), - r && o && (this._rigCameras.push(r), - this._rigCameras.push(o)) - } - switch (this.cameraRigMode) { - case t.RIG_MODE_STEREOSCOPIC_ANAGLYPH: - t._setStereoscopicAnaglyphRigMode(this); - break; - case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: - case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: - case t.RIG_MODE_STEREOSCOPIC_OVERUNDER: - t._setStereoscopicRigMode(this); - break; - case t.RIG_MODE_VR: - t._setVRRigMode(this, i); - break; - case t.RIG_MODE_WEBVR: - t._setWebVRRigMode(this, i) - } - this._cascadePostProcessesToRigCams(), - this.update() + (t.prototype.getLeftTarget = function () { + return this._rigCameras.length < 1 + ? null + : this._rigCameras[0].getTarget(); + }), + (t.prototype.getRightTarget = function () { + return this._rigCameras.length < 2 + ? null + : this._rigCameras[1].getTarget(); + }), + (t.prototype.setCameraRigMode = function (e, i) { + if (this.cameraRigMode !== e) { + for (; this._rigCameras.length > 0; ) { + var n = this._rigCameras.pop(); + n && n.dispose(); } - } - , - t._setStereoscopicRigMode = function(e) { - throw "Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode" - } - , - t._setStereoscopicAnaglyphRigMode = function(e) { - throw "Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode" - } - , - t._setVRRigMode = function(e, t) { - throw "Import Cameras/RigModes/vrRigMode before using VR rig mode" - } - , - t._setWebVRRigMode = function(e, t) { - throw "Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode" - } - , - t.prototype._getVRProjectionMatrix = function() { - return c.j.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.maxZ, this._cameraRigParams.vrWorkMatrix), - this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix), + if ( + ((this.cameraRigMode = e), + (this._cameraRigParams = {}), + (this._cameraRigParams.interaxialDistance = + i.interaxialDistance || 0.0637), + (this._cameraRigParams.stereoHalfAngle = + a.h.ToRadians( + this._cameraRigParams.interaxialDistance / 0.0637 + )), + this.cameraRigMode !== t.RIG_MODE_NONE) + ) { + var r = this.createRigCamera(this.name + "_L", 0); + r && (r._isLeftCamera = true); + var o = this.createRigCamera(this.name + "_R", 1); + o && (o._isRightCamera = true), + r && + o && + (this._rigCameras.push(r), + this._rigCameras.push(o)); + } + switch (this.cameraRigMode) { + case t.RIG_MODE_STEREOSCOPIC_ANAGLYPH: + t._setStereoscopicAnaglyphRigMode(this); + break; + case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: + case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: + case t.RIG_MODE_STEREOSCOPIC_OVERUNDER: + t._setStereoscopicRigMode(this); + break; + case t.RIG_MODE_VR: + t._setVRRigMode(this, i); + break; + case t.RIG_MODE_WEBVR: + t._setWebVRRigMode(this, i); + } + this._cascadePostProcessesToRigCams(), this.update(); + } + }), + (t._setStereoscopicRigMode = function (e) { + throw "Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode"; + }), + (t._setStereoscopicAnaglyphRigMode = function (e) { + throw "Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode"; + }), + (t._setVRRigMode = function (e, t) { + throw "Import Cameras/RigModes/vrRigMode before using VR rig mode"; + }), + (t._setWebVRRigMode = function (e, t) { + throw "Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode"; + }), + (t.prototype._getVRProjectionMatrix = function () { + return ( + c.j.PerspectiveFovLHToRef( + this._cameraRigParams.vrMetrics.aspectRatioFov, + this._cameraRigParams.vrMetrics.aspectRatio, + this.minZ, + this.maxZ, + this._cameraRigParams.vrWorkMatrix + ), + this._cameraRigParams.vrWorkMatrix.multiplyToRef( + this._cameraRigParams.vrHMatrix, + this._projectionMatrix + ), this._projectionMatrix - } - , - t.prototype._updateCameraRotationMatrix = function() {} - , - t.prototype._updateWebVRCameraRotationMatrix = function() {} - , - t.prototype._getWebVRProjectionMatrix = function() { - return c.j.Identity() - } - , - t.prototype._getWebVRViewMatrix = function() { - return c.j.Identity() - } - , - t.prototype.setCameraRigParameter = function(e, t) { - this._cameraRigParams || (this._cameraRigParams = {}), - this._cameraRigParams[e] = t, - "interaxialDistance" === e && (this._cameraRigParams.stereoHalfAngle = a.h.ToRadians(t / .0637)) - } - , - t.prototype.createRigCamera = function(e, t) { - return null - } - , - t.prototype._updateRigCameras = function() { - for (var e = 0; e < this._rigCameras.length; e++) - this._rigCameras[e].minZ = this.minZ, - this._rigCameras[e].maxZ = this.maxZ, - this._rigCameras[e].fov = this.fov, - this._rigCameras[e].upVector.copyFrom(this.upVector); - this.cameraRigMode === t.RIG_MODE_STEREOSCOPIC_ANAGLYPH && (this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport) - } - , - t.prototype._setupInputs = function() {} - , - t.prototype.serialize = function() { - var e = r.a.Serialize(this); - return e.type = this.getClassName(), + ); + }), + (t.prototype._updateCameraRotationMatrix = function () {}), + (t.prototype._updateWebVRCameraRotationMatrix = + function () {}), + (t.prototype._getWebVRProjectionMatrix = function () { + return c.j.Identity(); + }), + (t.prototype._getWebVRViewMatrix = function () { + return c.j.Identity(); + }), + (t.prototype.setCameraRigParameter = function (e, t) { + this._cameraRigParams || (this._cameraRigParams = {}), + (this._cameraRigParams[e] = t), + "interaxialDistance" === e && + (this._cameraRigParams.stereoHalfAngle = + a.h.ToRadians(t / 0.0637)); + }), + (t.prototype.createRigCamera = function (e, t) { + return null; + }), + (t.prototype._updateRigCameras = function () { + for (var e = 0; e < this._rigCameras.length; e++) + (this._rigCameras[e].minZ = this.minZ), + (this._rigCameras[e].maxZ = this.maxZ), + (this._rigCameras[e].fov = this.fov), + this._rigCameras[e].upVector.copyFrom(this.upVector); + this.cameraRigMode === t.RIG_MODE_STEREOSCOPIC_ANAGLYPH && + (this._rigCameras[0].viewport = + this._rigCameras[1].viewport = + this.viewport); + }), + (t.prototype._setupInputs = function () {}), + (t.prototype.serialize = function () { + var e = r.a.Serialize(this); + return ( + (e.type = this.getClassName()), this.parent && (e.parentId = this.parent.id), this.inputs && this.inputs.serialize(e), r.a.AppendSerializedAnimations(this, e), - e.ranges = this.serializeAnimationRanges(), + (e.ranges = this.serializeAnimationRanges()), e - } - , - t.prototype.clone = function(e) { - return r.a.Clone(t.GetConstructorFromName(this.getClassName(), e, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this) - } - , - t.prototype.getDirection = function(e) { - var t = c.x.Zero(); - return this.getDirectionToRef(e, t), - t - } - , - t.prototype.getDirectionToRef = function(e, t) { - c.x.TransformNormalToRef(e, this.getWorldMatrix(), t) - } - , - t.GetConstructorFromName = function(e, i, n, r, o) { - return void 0 === r && (r = 0), + ); + }), + (t.prototype.clone = function (e) { + return r.a.Clone( + t.GetConstructorFromName( + this.getClassName(), + e, + this.getScene(), + this.interaxialDistance, + this.isStereoscopicSideBySide + ), + this + ); + }), + (t.prototype.getDirection = function (e) { + var t = c.x.Zero(); + return this.getDirectionToRef(e, t), t; + }), + (t.prototype.getDirectionToRef = function (e, t) { + c.x.TransformNormalToRef(e, this.getWorldMatrix(), t); + }), + (t.GetConstructorFromName = function (e, i, n, r, o) { + return ( + void 0 === r && (r = 0), void 0 === o && (o = true), u.a.Construct(e, i, n, { - interaxial_distance: r, - isStereoscopicSideBySide: o - }) || function() { - return t._createDefaultParsedCamera(i, n) - } - } - , - t.prototype.computeWorldMatrix = function() { - return this.getWorldMatrix() - } - , - t.Parse = function(e, i) { - var n = e.type - , o = t.GetConstructorFromName(n, e.name, i, e.interaxial_distance, e.isStereoscopicSideBySide) - , a = r.a.Parse(o, e, i); - if (e.parentId && (a._waitingParentId = e.parentId), - a.inputs && (a.inputs.parse(e), - a._setupInputs()), - a.setPosition && (a.position.copyFromFloats(0, 0, 0), - a.setPosition(c.x.FromArray(e.position))), - e.target && a.setTarget && a.setTarget(c.x.FromArray(e.target)), - e.cameraRigMode) { - var s = e.interaxial_distance ? { - interaxialDistance: e.interaxial_distance - } : {}; - a.setCameraRigMode(e.cameraRigMode, s) - } - if (e.animations) { - for (var l = 0; l < e.animations.length; l++) { - var f = e.animations[l] - , d = h.a.GetClass("BABYLON.Animation"); - d && a.animations.push(d.Parse(f)) + interaxial_distance: r, + isStereoscopicSideBySide: o, + }) || + function () { + return t._createDefaultParsedCamera(i, n); + } + ); + }), + (t.prototype.computeWorldMatrix = function () { + return this.getWorldMatrix(); + }), + (t.Parse = function (e, i) { + var n = e.type, + o = t.GetConstructorFromName( + n, + e.name, + i, + e.interaxial_distance, + e.isStereoscopicSideBySide + ), + a = r.a.Parse(o, e, i); + if ( + (e.parentId && (a._waitingParentId = e.parentId), + a.inputs && (a.inputs.parse(e), a._setupInputs()), + a.setPosition && + (a.position.copyFromFloats(0, 0, 0), + a.setPosition(c.x.FromArray(e.position))), + e.target && + a.setTarget && + a.setTarget(c.x.FromArray(e.target)), + e.cameraRigMode) + ) { + var s = e.interaxial_distance + ? { + interaxialDistance: e.interaxial_distance, } - u.a.ParseAnimationRanges(a, e, i) + : {}; + a.setCameraRigMode(e.cameraRigMode, s); + } + if (e.animations) { + for (var l = 0; l < e.animations.length; l++) { + var f = e.animations[l], + d = h.a.GetClass("BABYLON.Animation"); + d && a.animations.push(d.Parse(f)); } - return e.autoAnimate && i.beginAnimation(a, e.autoAnimateFrom, e.autoAnimateTo, e.autoAnimateLoop, e.autoAnimateSpeed || 1), + u.a.ParseAnimationRanges(a, e, i); + } + return ( + e.autoAnimate && + i.beginAnimation( + a, + e.autoAnimateFrom, + e.autoAnimateTo, + e.autoAnimateLoop, + e.autoAnimateSpeed || 1 + ), a - } - , - t._createDefaultParsedCamera = function(e, t) { - throw f.a.WarnImport("UniversalCamera") - } - , - t.PERSPECTIVE_CAMERA = 0, - t.ORTHOGRAPHIC_CAMERA = 1, - t.FOVMODE_VERTICAL_FIXED = 0, - t.FOVMODE_HORIZONTAL_FIXED = 1, - t.RIG_MODE_NONE = 0, - t.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10, - t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11, - t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12, - t.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13, - t.RIG_MODE_VR = 20, - t.RIG_MODE_WEBVR = 21, - t.RIG_MODE_CUSTOM = 22, - t.ForceAttachControlToAlwaysPreventDefault = false, - n.c([Object(r.o)("position")], t.prototype, "_position", void 0), + ); + }), + (t._createDefaultParsedCamera = function (e, t) { + throw f.a.WarnImport("UniversalCamera"); + }), + (t.PERSPECTIVE_CAMERA = 0), + (t.ORTHOGRAPHIC_CAMERA = 1), + (t.FOVMODE_VERTICAL_FIXED = 0), + (t.FOVMODE_HORIZONTAL_FIXED = 1), + (t.RIG_MODE_NONE = 0), + (t.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10), + (t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11), + (t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12), + (t.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13), + (t.RIG_MODE_VR = 20), + (t.RIG_MODE_WEBVR = 21), + (t.RIG_MODE_CUSTOM = 22), + (t.ForceAttachControlToAlwaysPreventDefault = false), + n.c( + [Object(r.o)("position")], + t.prototype, + "_position", + void 0 + ), n.c([Object(r.o)()], t.prototype, "upVector", void 0), n.c([Object(r.c)()], t.prototype, "orthoLeft", void 0), n.c([Object(r.c)()], t.prototype, "orthoRight", void 0), @@ -38225,2960 +47697,3890 @@ and limitations under the License. n.c([Object(r.c)()], t.prototype, "layerMask", void 0), n.c([Object(r.c)()], t.prototype, "fovMode", void 0), n.c([Object(r.c)()], t.prototype, "cameraRigMode", void 0), - n.c([Object(r.c)()], t.prototype, "interaxialDistance", void 0), - n.c([Object(r.c)()], t.prototype, "isStereoscopicSideBySide", void 0), + n.c( + [Object(r.c)()], + t.prototype, + "interaxialDistance", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "isStereoscopicSideBySide", + void 0 + ), t - }(u.a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return e.GetClass = function(e) { - return this.RegisteredTypes && this.RegisteredTypes[e] ? this.RegisteredTypes[e] : null - } - , - e.RegisteredTypes = {}, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return Object.defineProperty(e, "LastCreatedEngine", { - get: function() { - return 0 === this.Instances.length ? null : this.Instances[this.Instances.length - 1] - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e, "LastCreatedScene", { - get: function() { - return this._LastCreatedScene - }, - enumerable: true, - configurable: true - }), - e.Instances = new Array, - e._LastCreatedScene = null, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return v - }); - var n = i(1) - , r = i(9) - , o = i(8) - , a = i(0) - , s = i(10) - , c = i(4) - , u = i(13) - , l = i(42) - , h = i(50) - , f = i(43) - , d = i(3) - , p = i(108) - , m = i(19) - , g = function() { - this.facetNb = 0, - this.partitioningSubdivisions = 10, - this.partitioningBBoxRatio = 1.01, - this.facetDataEnabled = false, - this.facetParameters = {}, - this.bbSize = a.x.Zero(), - this.subDiv = { - max: 1, - X: 1, - Y: 1, - Z: 1 + ); + })(u.a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + (e.GetClass = function (e) { + return this.RegisteredTypes && this.RegisteredTypes[e] + ? this.RegisteredTypes[e] + : null; + }), + (e.RegisteredTypes = {}), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + Object.defineProperty(e, "LastCreatedEngine", { + get: function () { + return 0 === this.Instances.length + ? null + : this.Instances[this.Instances.length - 1]; }, - this.facetDepthSort = false, - this.facetDepthSortEnabled = false - } - , _ = function() { - this._hasVertexAlpha = false, - this._useVertexColors = true, - this._numBoneInfluencers = 4, - this._applyFog = true, - this._receiveShadows = false, - this._facetData = new g, - this._visibility = 1, - this._skeleton = null, - this._layerMask = 268435455, - this._computeBonesUsingShaders = true, - this._isActive = false, - this._onlyForInstances = false, - this._isActiveIntermediate = false, - this._onlyForInstancesIntermediate = false - } - , v = function(e) { - function t(i, n) { - void 0 === n && (n = null); - var r = e.call(this, i, n, false) || this; - return r._internalAbstractMeshDataInfo = new _, - r.cullingStrategy = t.CULLINGSTRATEGY_STANDARD, - r.onCollideObservable = new o.c, - r.onCollisionPositionChangeObservable = new o.c, - r.onMaterialChangedObservable = new o.c, - r.definedFacingForward = true, - r._occlusionQuery = null, - r._renderingGroup = null, - r.alphaIndex = Number.MAX_VALUE, - r.isVisible = true, - r.isPickable = true, - r.showSubMeshesBoundingBox = false, - r.isBlocker = false, - r.enablePointerMoveEvents = false, - r.renderingGroupId = 0, - r._material = null, - r.outlineColor = a.e.Red(), - r.outlineWidth = .02, - r.overlayColor = a.e.Red(), - r.overlayAlpha = .5, - r.useOctreeForRenderingSelection = true, - r.useOctreeForPicking = true, - r.useOctreeForCollisions = true, - r.alwaysSelectAsActiveMesh = false, - r.doNotSyncBoundingInfo = false, - r.actionManager = null, - r._meshCollisionData = new p.a, - r.ellipsoid = new a.x(.5,1,.5), - r.ellipsoidOffset = new a.x(0,0,0), - r.edgesWidth = 1, - r.edgesColor = new a.f(1,0,0,1), - r._edgesRenderer = null, - r._masterMesh = null, - r._boundingInfo = null, - r._renderId = 0, - r._intersectionsInProgress = new Array, - r._unIndexed = false, - r._lightSources = new Array, - r._waitingData = { - lods: null, - actions: null, - freezeWorldMatrix: null - }, - r._bonesTransformMatrices = null, - r.onRebuildObservable = new o.c, - r._onCollisionPositionChange = function(e, t, i) { - void 0 === i && (i = null), - t.subtractToRef(r._meshCollisionData._oldPositionForCollisions, r._meshCollisionData._diffPositionForCollisions), - r._meshCollisionData._diffPositionForCollisions.length() > s.b.CollisionsEpsilon && r.position.addInPlace(r._meshCollisionData._diffPositionForCollisions), - i && r.onCollideObservable.notifyObservers(i), - r.onCollisionPositionChangeObservable.notifyObservers(r.position) - } - , - r.getScene().addMesh(r), - r._resyncLightSources(), - r - } - return n.d(t, e), + enumerable: true, + configurable: true, + }), + Object.defineProperty(e, "LastCreatedScene", { + get: function () { + return this._LastCreatedScene; + }, + enumerable: true, + configurable: true, + }), + (e.Instances = new Array()), + (e._LastCreatedScene = null), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return v; + }); + var n = i(1), + r = i(9), + o = i(8), + a = i(0), + s = i(10), + c = i(4), + u = i(13), + l = i(42), + h = i(50), + f = i(43), + d = i(3), + p = i(108), + m = i(19), + g = function () { + (this.facetNb = 0), + (this.partitioningSubdivisions = 10), + (this.partitioningBBoxRatio = 1.01), + (this.facetDataEnabled = false), + (this.facetParameters = {}), + (this.bbSize = a.x.Zero()), + (this.subDiv = { + max: 1, + X: 1, + Y: 1, + Z: 1, + }), + (this.facetDepthSort = false), + (this.facetDepthSortEnabled = false); + }, + _ = function () { + (this._hasVertexAlpha = false), + (this._useVertexColors = true), + (this._numBoneInfluencers = 4), + (this._applyFog = true), + (this._receiveShadows = false), + (this._facetData = new g()), + (this._visibility = 1), + (this._skeleton = null), + (this._layerMask = 268435455), + (this._computeBonesUsingShaders = true), + (this._isActive = false), + (this._onlyForInstances = false), + (this._isActiveIntermediate = false), + (this._onlyForInstancesIntermediate = false); + }, + v = (function (e) { + function t(i, n) { + void 0 === n && (n = null); + var r = e.call(this, i, n, false) || this; + return ( + (r._internalAbstractMeshDataInfo = new _()), + (r.cullingStrategy = t.CULLINGSTRATEGY_STANDARD), + (r.onCollideObservable = new o.c()), + (r.onCollisionPositionChangeObservable = new o.c()), + (r.onMaterialChangedObservable = new o.c()), + (r.definedFacingForward = true), + (r._occlusionQuery = null), + (r._renderingGroup = null), + (r.alphaIndex = Number.MAX_VALUE), + (r.isVisible = true), + (r.isPickable = true), + (r.showSubMeshesBoundingBox = false), + (r.isBlocker = false), + (r.enablePointerMoveEvents = false), + (r.renderingGroupId = 0), + (r._material = null), + (r.outlineColor = a.e.Red()), + (r.outlineWidth = 0.02), + (r.overlayColor = a.e.Red()), + (r.overlayAlpha = 0.5), + (r.useOctreeForRenderingSelection = true), + (r.useOctreeForPicking = true), + (r.useOctreeForCollisions = true), + (r.alwaysSelectAsActiveMesh = false), + (r.doNotSyncBoundingInfo = false), + (r.actionManager = null), + (r._meshCollisionData = new p.a()), + (r.ellipsoid = new a.x(0.5, 1, 0.5)), + (r.ellipsoidOffset = new a.x(0, 0, 0)), + (r.edgesWidth = 1), + (r.edgesColor = new a.f(1, 0, 0, 1)), + (r._edgesRenderer = null), + (r._masterMesh = null), + (r._boundingInfo = null), + (r._renderId = 0), + (r._intersectionsInProgress = new Array()), + (r._unIndexed = false), + (r._lightSources = new Array()), + (r._waitingData = { + lods: null, + actions: null, + freezeWorldMatrix: null, + }), + (r._bonesTransformMatrices = null), + (r.onRebuildObservable = new o.c()), + (r._onCollisionPositionChange = function (e, t, i) { + void 0 === i && (i = null), + t.subtractToRef( + r._meshCollisionData._oldPositionForCollisions, + r._meshCollisionData._diffPositionForCollisions + ), + r._meshCollisionData._diffPositionForCollisions.length() > + s.b.CollisionsEpsilon && + r.position.addInPlace( + r._meshCollisionData._diffPositionForCollisions + ), + i && r.onCollideObservable.notifyObservers(i), + r.onCollisionPositionChangeObservable.notifyObservers( + r.position + ); + }), + r.getScene().addMesh(r), + r._resyncLightSources(), + r + ); + } + return ( + n.d(t, e), Object.defineProperty(t, "BILLBOARDMODE_NONE", { - get: function() { - return l.a.BILLBOARDMODE_NONE - }, - enumerable: true, - configurable: true + get: function () { + return l.a.BILLBOARDMODE_NONE; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "BILLBOARDMODE_X", { - get: function() { - return l.a.BILLBOARDMODE_X - }, - enumerable: true, - configurable: true + get: function () { + return l.a.BILLBOARDMODE_X; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "BILLBOARDMODE_Y", { - get: function() { - return l.a.BILLBOARDMODE_Y - }, - enumerable: true, - configurable: true + get: function () { + return l.a.BILLBOARDMODE_Y; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "BILLBOARDMODE_Z", { - get: function() { - return l.a.BILLBOARDMODE_Z - }, - enumerable: true, - configurable: true + get: function () { + return l.a.BILLBOARDMODE_Z; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "BILLBOARDMODE_ALL", { - get: function() { - return l.a.BILLBOARDMODE_ALL - }, - enumerable: true, - configurable: true + get: function () { + return l.a.BILLBOARDMODE_ALL; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "facetNb", { - get: function() { - return this._internalAbstractMeshDataInfo._facetData.facetNb + get: function () { + return this._internalAbstractMeshDataInfo._facetData + .facetNb; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "partitioningSubdivisions", + { + get: function () { + return this._internalAbstractMeshDataInfo._facetData + .partitioningSubdivisions; + }, + set: function (e) { + this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "partitioningSubdivisions", { - get: function() { - return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "partitioningBBoxRatio", + { + get: function () { + return this._internalAbstractMeshDataInfo._facetData + .partitioningBBoxRatio; }, - set: function(e) { - this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = e + set: function (e) { + this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "partitioningBBoxRatio", { - get: function() { - return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio - }, - set: function(e) { - this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "mustDepthSortFacets", { - get: function() { - return this._internalAbstractMeshDataInfo._facetData.facetDepthSort - }, - set: function(e) { - this._internalAbstractMeshDataInfo._facetData.facetDepthSort = e - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo._facetData + .facetDepthSort; + }, + set: function (e) { + this._internalAbstractMeshDataInfo._facetData.facetDepthSort = + e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "facetDepthSortFrom", { - get: function() { - return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom - }, - set: function(e) { - this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = e - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo._facetData + .facetDepthSortFrom; + }, + set: function (e) { + this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = + e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "isFacetDataEnabled", { - get: function() { - return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo._facetData + .facetDataEnabled; + }, + enumerable: true, + configurable: true, + }), + (t.prototype._updateNonUniformScalingState = function (t) { + return ( + !!e.prototype._updateNonUniformScalingState.call( + this, + t + ) && (this._markSubMeshesAsMiscDirty(), true) + ); }), - t.prototype._updateNonUniformScalingState = function(t) { - return !!e.prototype._updateNonUniformScalingState.call(this, t) && (this._markSubMeshesAsMiscDirty(), - true) - } - , Object.defineProperty(t.prototype, "onCollide", { - set: function(e) { - this._meshCollisionData._onCollideObserver && this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver), - this._meshCollisionData._onCollideObserver = this.onCollideObservable.add(e) + set: function (e) { + this._meshCollisionData._onCollideObserver && + this.onCollideObservable.remove( + this._meshCollisionData._onCollideObserver + ), + (this._meshCollisionData._onCollideObserver = + this.onCollideObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "onCollisionPositionChange", + { + set: function (e) { + this._meshCollisionData + ._onCollisionPositionChangeObserver && + this.onCollisionPositionChangeObservable.remove( + this._meshCollisionData + ._onCollisionPositionChangeObserver + ), + (this._meshCollisionData._onCollisionPositionChangeObserver = + this.onCollisionPositionChangeObservable.add(e)); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onCollisionPositionChange", { - set: function(e) { - this._meshCollisionData._onCollisionPositionChangeObserver && this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver), - this._meshCollisionData._onCollisionPositionChangeObserver = this.onCollisionPositionChangeObservable.add(e) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "visibility", { - get: function() { - return this._internalAbstractMeshDataInfo._visibility - }, - set: function(e) { - this._internalAbstractMeshDataInfo._visibility !== e && (this._internalAbstractMeshDataInfo._visibility = e, - this._markSubMeshesAsMiscDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo._visibility; + }, + set: function (e) { + this._internalAbstractMeshDataInfo._visibility !== e && + ((this._internalAbstractMeshDataInfo._visibility = e), + this._markSubMeshesAsMiscDirty()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "material", { - get: function() { - return this._material - }, - set: function(e) { - this._material !== e && (this._material && this._material.meshMap && (this._material.meshMap[this.uniqueId] = void 0), - this._material = e, - e && e.meshMap && (e.meshMap[this.uniqueId] = this), - this.onMaterialChangedObservable.hasObservers && this.onMaterialChangedObservable.notifyObservers(this), - this.subMeshes && this._unBindEffect()) - }, - enumerable: true, - configurable: true + get: function () { + return this._material; + }, + set: function (e) { + this._material !== e && + (this._material && + this._material.meshMap && + (this._material.meshMap[this.uniqueId] = void 0), + (this._material = e), + e && e.meshMap && (e.meshMap[this.uniqueId] = this), + this.onMaterialChangedObservable.hasObservers && + this.onMaterialChangedObservable.notifyObservers( + this + ), + this.subMeshes && this._unBindEffect()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "receiveShadows", { - get: function() { - return this._internalAbstractMeshDataInfo._receiveShadows - }, - set: function(e) { - this._internalAbstractMeshDataInfo._receiveShadows !== e && (this._internalAbstractMeshDataInfo._receiveShadows = e, - this._markSubMeshesAsLightDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo + ._receiveShadows; + }, + set: function (e) { + this._internalAbstractMeshDataInfo._receiveShadows !== + e && + ((this._internalAbstractMeshDataInfo._receiveShadows = + e), + this._markSubMeshesAsLightDirty()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "hasVertexAlpha", { - get: function() { - return this._internalAbstractMeshDataInfo._hasVertexAlpha - }, - set: function(e) { - this._internalAbstractMeshDataInfo._hasVertexAlpha !== e && (this._internalAbstractMeshDataInfo._hasVertexAlpha = e, - this._markSubMeshesAsAttributesDirty(), - this._markSubMeshesAsMiscDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo + ._hasVertexAlpha; + }, + set: function (e) { + this._internalAbstractMeshDataInfo._hasVertexAlpha !== + e && + ((this._internalAbstractMeshDataInfo._hasVertexAlpha = + e), + this._markSubMeshesAsAttributesDirty(), + this._markSubMeshesAsMiscDirty()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "useVertexColors", { - get: function() { - return this._internalAbstractMeshDataInfo._useVertexColors + get: function () { + return this._internalAbstractMeshDataInfo + ._useVertexColors; + }, + set: function (e) { + this._internalAbstractMeshDataInfo._useVertexColors !== + e && + ((this._internalAbstractMeshDataInfo._useVertexColors = + e), + this._markSubMeshesAsAttributesDirty()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "computeBonesUsingShaders", + { + get: function () { + return this._internalAbstractMeshDataInfo + ._computeBonesUsingShaders; }, - set: function(e) { - this._internalAbstractMeshDataInfo._useVertexColors !== e && (this._internalAbstractMeshDataInfo._useVertexColors = e, - this._markSubMeshesAsAttributesDirty()) + set: function (e) { + this._internalAbstractMeshDataInfo + ._computeBonesUsingShaders !== e && + ((this._internalAbstractMeshDataInfo._computeBonesUsingShaders = + e), + this._markSubMeshesAsAttributesDirty()); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "computeBonesUsingShaders", { - get: function() { - return this._internalAbstractMeshDataInfo._computeBonesUsingShaders - }, - set: function(e) { - this._internalAbstractMeshDataInfo._computeBonesUsingShaders !== e && (this._internalAbstractMeshDataInfo._computeBonesUsingShaders = e, - this._markSubMeshesAsAttributesDirty()) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "numBoneInfluencers", { - get: function() { - return this._internalAbstractMeshDataInfo._numBoneInfluencers - }, - set: function(e) { - this._internalAbstractMeshDataInfo._numBoneInfluencers !== e && (this._internalAbstractMeshDataInfo._numBoneInfluencers = e, - this._markSubMeshesAsAttributesDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo + ._numBoneInfluencers; + }, + set: function (e) { + this._internalAbstractMeshDataInfo + ._numBoneInfluencers !== e && + ((this._internalAbstractMeshDataInfo._numBoneInfluencers = + e), + this._markSubMeshesAsAttributesDirty()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "applyFog", { - get: function() { - return this._internalAbstractMeshDataInfo._applyFog - }, - set: function(e) { - this._internalAbstractMeshDataInfo._applyFog !== e && (this._internalAbstractMeshDataInfo._applyFog = e, - this._markSubMeshesAsMiscDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo._applyFog; + }, + set: function (e) { + this._internalAbstractMeshDataInfo._applyFog !== e && + ((this._internalAbstractMeshDataInfo._applyFog = e), + this._markSubMeshesAsMiscDirty()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "layerMask", { - get: function() { - return this._internalAbstractMeshDataInfo._layerMask - }, - set: function(e) { - e !== this._internalAbstractMeshDataInfo._layerMask && (this._internalAbstractMeshDataInfo._layerMask = e, - this._resyncLightSources()) - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo._layerMask; + }, + set: function (e) { + e !== this._internalAbstractMeshDataInfo._layerMask && + ((this._internalAbstractMeshDataInfo._layerMask = e), + this._resyncLightSources()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "collisionMask", { - get: function() { - return this._meshCollisionData._collisionMask - }, - set: function(e) { - this._meshCollisionData._collisionMask = isNaN(e) ? -1 : e - }, - enumerable: true, - configurable: true + get: function () { + return this._meshCollisionData._collisionMask; + }, + set: function (e) { + this._meshCollisionData._collisionMask = isNaN(e) + ? -1 + : e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "collisionGroup", { - get: function() { - return this._meshCollisionData._collisionGroup - }, - set: function(e) { - this._meshCollisionData._collisionGroup = isNaN(e) ? -1 : e - }, - enumerable: true, - configurable: true + get: function () { + return this._meshCollisionData._collisionGroup; + }, + set: function (e) { + this._meshCollisionData._collisionGroup = isNaN(e) + ? -1 + : e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "lightSources", { - get: function() { - return this._lightSources - }, - enumerable: true, - configurable: true + get: function () { + return this._lightSources; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "_positions", { - get: function() { - return null - }, - enumerable: true, - configurable: true + get: function () { + return null; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "skeleton", { - get: function() { - return this._internalAbstractMeshDataInfo._skeleton - }, - set: function(e) { - var t = this._internalAbstractMeshDataInfo._skeleton; - t && t.needInitialSkinMatrix && t._unregisterMeshWithPoseMatrix(this), - e && e.needInitialSkinMatrix && e._registerMeshWithPoseMatrix(this), - this._internalAbstractMeshDataInfo._skeleton = e, - this._internalAbstractMeshDataInfo._skeleton || (this._bonesTransformMatrices = null), - this._markSubMeshesAsAttributesDirty() - }, - enumerable: true, - configurable: true + get: function () { + return this._internalAbstractMeshDataInfo._skeleton; + }, + set: function (e) { + var t = this._internalAbstractMeshDataInfo._skeleton; + t && + t.needInitialSkinMatrix && + t._unregisterMeshWithPoseMatrix(this), + e && + e.needInitialSkinMatrix && + e._registerMeshWithPoseMatrix(this), + (this._internalAbstractMeshDataInfo._skeleton = e), + this._internalAbstractMeshDataInfo._skeleton || + (this._bonesTransformMatrices = null), + this._markSubMeshesAsAttributesDirty(); + }, + enumerable: true, + configurable: true, }), - t.prototype.getClassName = function() { - return "AbstractMesh" - } - , - t.prototype.toString = function(e) { - var t = "Name: " + this.name + ", isInstance: " + ("InstancedMesh" !== this.getClassName() ? "YES" : "NO"); - t += ", # of submeshes: " + (this.subMeshes ? this.subMeshes.length : 0); - var i = this._internalAbstractMeshDataInfo._skeleton; - return i && (t += ", skeleton: " + i.name), - e && (t += ", billboard mode: " + ["NONE", "X", "Y", null, "Z", null, null, "ALL"][this.billboardMode], - t += ", freeze wrld mat: " + (this._isWorldMatrixFrozen || this._waitingData.freezeWorldMatrix ? "YES" : "NO")), + (t.prototype.getClassName = function () { + return "AbstractMesh"; + }), + (t.prototype.toString = function (e) { + var t = + "Name: " + + this.name + + ", isInstance: " + + ("InstancedMesh" !== this.getClassName() + ? "YES" + : "NO"); + t += + ", # of submeshes: " + + (this.subMeshes ? this.subMeshes.length : 0); + var i = this._internalAbstractMeshDataInfo._skeleton; + return ( + i && (t += ", skeleton: " + i.name), + e && + ((t += + ", billboard mode: " + + ["NONE", "X", "Y", null, "Z", null, null, "ALL"][ + this.billboardMode + ]), + (t += + ", freeze wrld mat: " + + (this._isWorldMatrixFrozen || + this._waitingData.freezeWorldMatrix + ? "YES" + : "NO"))), t - } - , - t.prototype._getEffectiveParent = function() { - return this._masterMesh && this.billboardMode !== l.a.BILLBOARDMODE_NONE ? this._masterMesh : e.prototype._getEffectiveParent.call(this) - } - , - t.prototype._getActionManagerForTrigger = function(e, t) { - if (void 0 === t && (t = true), - this.actionManager && (t || this.actionManager.isRecursive)) { - if (!e) - return this.actionManager; - if (this.actionManager.hasSpecificTrigger(e)) - return this.actionManager - } - return this.parent ? this.parent._getActionManagerForTrigger(e, false) : null - } - , - t.prototype._rebuild = function() { - if (this.onRebuildObservable.notifyObservers(this), + ); + }), + (t.prototype._getEffectiveParent = function () { + return this._masterMesh && + this.billboardMode !== l.a.BILLBOARDMODE_NONE + ? this._masterMesh + : e.prototype._getEffectiveParent.call(this); + }), + (t.prototype._getActionManagerForTrigger = function (e, t) { + if ( + (void 0 === t && (t = true), + this.actionManager && + (t || this.actionManager.isRecursive)) + ) { + if (!e) return this.actionManager; + if (this.actionManager.hasSpecificTrigger(e)) + return this.actionManager; + } + return this.parent + ? this.parent._getActionManagerForTrigger(e, false) + : null; + }), + (t.prototype._rebuild = function () { + if ( + (this.onRebuildObservable.notifyObservers(this), this._occlusionQuery && (this._occlusionQuery = null), this.subMeshes) - for (var e = 0, t = this.subMeshes; e < t.length; e++) - t[e]._rebuild() - } - , - t.prototype._resyncLightSources = function() { - this._lightSources.length = 0; - for (var e = 0, t = this.getScene().lights; e < t.length; e++) { - var i = t[e]; - i.isEnabled() && i.canAffectMesh(this) && this._lightSources.push(i) - } - this._markSubMeshesAsLightDirty() - } - , - t.prototype._resyncLighSource = function(e) { - var t = e.isEnabled() && e.canAffectMesh(this) - , i = this._lightSources.indexOf(e); - if (-1 === i) { - if (!t) - return; - this._lightSources.push(e) - } else { - if (t) - return; - this._lightSources.splice(i, 1) - } - this._markSubMeshesAsLightDirty() - } - , - t.prototype._unBindEffect = function() { + ) for (var e = 0, t = this.subMeshes; e < t.length; e++) - t[e].setEffect(null) - } - , - t.prototype._removeLightSource = function(e) { - var t = this._lightSources.indexOf(e); - -1 !== t && (this._lightSources.splice(t, 1), - this._markSubMeshesAsLightDirty()) - } - , - t.prototype._markSubMeshesAsDirty = function(e) { - if (this.subMeshes) - for (var t = 0, i = this.subMeshes; t < i.length; t++) { - var n = i[t]; - n._materialDefines && e(n._materialDefines) - } - } - , - t.prototype._markSubMeshesAsLightDirty = function() { - this._markSubMeshesAsDirty(function(e) { - return e.markAsLightDirty() - }) - } - , - t.prototype._markSubMeshesAsAttributesDirty = function() { - this._markSubMeshesAsDirty(function(e) { - return e.markAsAttributesDirty() - }) - } - , - t.prototype._markSubMeshesAsMiscDirty = function() { - if (this.subMeshes) - for (var e = 0, t = this.subMeshes; e < t.length; e++) { - var i = t[e].getMaterial(); - i && i.markAsDirty(d.a.MATERIAL_MiscDirtyFlag) - } - } - , + t[e]._rebuild(); + }), + (t.prototype._resyncLightSources = function () { + this._lightSources.length = 0; + for ( + var e = 0, t = this.getScene().lights; + e < t.length; + e++ + ) { + var i = t[e]; + i.isEnabled() && + i.canAffectMesh(this) && + this._lightSources.push(i); + } + this._markSubMeshesAsLightDirty(); + }), + (t.prototype._resyncLighSource = function (e) { + var t = e.isEnabled() && e.canAffectMesh(this), + i = this._lightSources.indexOf(e); + if (-1 === i) { + if (!t) return; + this._lightSources.push(e); + } else { + if (t) return; + this._lightSources.splice(i, 1); + } + this._markSubMeshesAsLightDirty(); + }), + (t.prototype._unBindEffect = function () { + for (var e = 0, t = this.subMeshes; e < t.length; e++) + t[e].setEffect(null); + }), + (t.prototype._removeLightSource = function (e) { + var t = this._lightSources.indexOf(e); + -1 !== t && + (this._lightSources.splice(t, 1), + this._markSubMeshesAsLightDirty()); + }), + (t.prototype._markSubMeshesAsDirty = function (e) { + if (this.subMeshes) + for (var t = 0, i = this.subMeshes; t < i.length; t++) { + var n = i[t]; + n._materialDefines && e(n._materialDefines); + } + }), + (t.prototype._markSubMeshesAsLightDirty = function () { + this._markSubMeshesAsDirty(function (e) { + return e.markAsLightDirty(); + }); + }), + (t.prototype._markSubMeshesAsAttributesDirty = function () { + this._markSubMeshesAsDirty(function (e) { + return e.markAsAttributesDirty(); + }); + }), + (t.prototype._markSubMeshesAsMiscDirty = function () { + if (this.subMeshes) + for (var e = 0, t = this.subMeshes; e < t.length; e++) { + var i = t[e].getMaterial(); + i && i.markAsDirty(d.a.MATERIAL_MiscDirtyFlag); + } + }), Object.defineProperty(t.prototype, "scaling", { - get: function() { - return this._scaling - }, - set: function(e) { - this._scaling = e, - this.physicsImpostor && this.physicsImpostor.forceUpdate() - }, - enumerable: true, - configurable: true + get: function () { + return this._scaling; + }, + set: function (e) { + (this._scaling = e), + this.physicsImpostor && + this.physicsImpostor.forceUpdate(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "isBlocked", { - get: function() { - return false - }, - enumerable: true, - configurable: true + get: function () { + return false; + }, + enumerable: true, + configurable: true, }), - t.prototype.getLOD = function(e) { - return this - } - , - t.prototype.getTotalVertices = function() { - return 0 - } - , - t.prototype.getTotalIndices = function() { - return 0 - } - , - t.prototype.getIndices = function() { - return null - } - , - t.prototype.getVerticesData = function(e) { - return null - } - , - t.prototype.setVerticesData = function(e, t, i, n) { - return this - } - , - t.prototype.updateVerticesData = function(e, t, i, n) { - return this - } - , - t.prototype.setIndices = function(e, t) { - return this - } - , - t.prototype.isVerticesDataPresent = function(e) { - return false - } - , - t.prototype.getBoundingInfo = function() { - return this._masterMesh ? this._masterMesh.getBoundingInfo() : (this._boundingInfo || this._updateBoundingInfo(), - this._boundingInfo) - } - , - t.prototype.normalizeToUnitCube = function(e, t) { - void 0 === e && (e = true), - void 0 === t && (t = false); - var i = null - , n = null; - t && (this.rotationQuaternion ? (n = this.rotationQuaternion.clone(), - this.rotationQuaternion.copyFromFloats(0, 0, 0, 1)) : this.rotation && (i = this.rotation.clone(), - this.rotation.copyFromFloats(0, 0, 0))); - var r = this.getHierarchyBoundingVectors(e) - , o = r.max.subtract(r.min) - , a = Math.max(o.x, o.y, o.z); - if (0 === a) - return this; - var s = 1 / a; - return this.scaling.scaleInPlace(s), - t && (this.rotationQuaternion && n ? this.rotationQuaternion.copyFrom(n) : this.rotation && i && this.rotation.copyFrom(i)), + (t.prototype.getLOD = function (e) { + return this; + }), + (t.prototype.getTotalVertices = function () { + return 0; + }), + (t.prototype.getTotalIndices = function () { + return 0; + }), + (t.prototype.getIndices = function () { + return null; + }), + (t.prototype.getVerticesData = function (e) { + return null; + }), + (t.prototype.setVerticesData = function (e, t, i, n) { + return this; + }), + (t.prototype.updateVerticesData = function (e, t, i, n) { + return this; + }), + (t.prototype.setIndices = function (e, t) { + return this; + }), + (t.prototype.isVerticesDataPresent = function (e) { + return false; + }), + (t.prototype.getBoundingInfo = function () { + return this._masterMesh + ? this._masterMesh.getBoundingInfo() + : (this._boundingInfo || this._updateBoundingInfo(), + this._boundingInfo); + }), + (t.prototype.normalizeToUnitCube = function (e, t) { + void 0 === e && (e = true), void 0 === t && (t = false); + var i = null, + n = null; + t && + (this.rotationQuaternion + ? ((n = this.rotationQuaternion.clone()), + this.rotationQuaternion.copyFromFloats(0, 0, 0, 1)) + : this.rotation && + ((i = this.rotation.clone()), + this.rotation.copyFromFloats(0, 0, 0))); + var r = this.getHierarchyBoundingVectors(e), + o = r.max.subtract(r.min), + a = Math.max(o.x, o.y, o.z); + if (0 === a) return this; + var s = 1 / a; + return ( + this.scaling.scaleInPlace(s), + t && + (this.rotationQuaternion && n + ? this.rotationQuaternion.copyFrom(n) + : this.rotation && i && this.rotation.copyFrom(i)), this - } - , - t.prototype.setBoundingInfo = function(e) { - return this._boundingInfo = e, - this - } - , + ); + }), + (t.prototype.setBoundingInfo = function (e) { + return (this._boundingInfo = e), this; + }), Object.defineProperty(t.prototype, "useBones", { - get: function() { - return this.skeleton && this.getScene().skeletonsEnabled && this.isVerticesDataPresent(c.b.MatricesIndicesKind) && this.isVerticesDataPresent(c.b.MatricesWeightsKind) - }, - enumerable: true, - configurable: true + get: function () { + return ( + this.skeleton && + this.getScene().skeletonsEnabled && + this.isVerticesDataPresent(c.b.MatricesIndicesKind) && + this.isVerticesDataPresent(c.b.MatricesWeightsKind) + ); + }, + enumerable: true, + configurable: true, + }), + (t.prototype._preActivate = function () {}), + (t.prototype._preActivateForIntermediateRendering = + function (e) {}), + (t.prototype._activate = function (e, t) { + return (this._renderId = e), true; + }), + (t.prototype._postActivate = function () {}), + (t.prototype._freeze = function () {}), + (t.prototype._unFreeze = function () {}), + (t.prototype.getWorldMatrix = function () { + return this._masterMesh && + this.billboardMode === l.a.BILLBOARDMODE_NONE + ? this._masterMesh.getWorldMatrix() + : e.prototype.getWorldMatrix.call(this); + }), + (t.prototype._getWorldMatrixDeterminant = function () { + return this._masterMesh + ? this._masterMesh._getWorldMatrixDeterminant() + : e.prototype._getWorldMatrixDeterminant.call(this); }), - t.prototype._preActivate = function() {} - , - t.prototype._preActivateForIntermediateRendering = function(e) {} - , - t.prototype._activate = function(e, t) { - return this._renderId = e, - true - } - , - t.prototype._postActivate = function() {} - , - t.prototype._freeze = function() {} - , - t.prototype._unFreeze = function() {} - , - t.prototype.getWorldMatrix = function() { - return this._masterMesh && this.billboardMode === l.a.BILLBOARDMODE_NONE ? this._masterMesh.getWorldMatrix() : e.prototype.getWorldMatrix.call(this) - } - , - t.prototype._getWorldMatrixDeterminant = function() { - return this._masterMesh ? this._masterMesh._getWorldMatrixDeterminant() : e.prototype._getWorldMatrixDeterminant.call(this) - } - , Object.defineProperty(t.prototype, "isAnInstance", { - get: function() { - return false - }, - enumerable: true, - configurable: true + get: function () { + return false; + }, + enumerable: true, + configurable: true, }), - t.prototype.movePOV = function(e, t, i) { - return this.position.addInPlace(this.calcMovePOV(e, t, i)), + (t.prototype.movePOV = function (e, t, i) { + return ( + this.position.addInPlace(this.calcMovePOV(e, t, i)), this - } - , - t.prototype.calcMovePOV = function(e, t, i) { - var n = new a.j; - (this.rotationQuaternion ? this.rotationQuaternion : a.q.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z)).toRotationMatrix(n); - var r = a.x.Zero() - , o = this.definedFacingForward ? -1 : 1; - return a.x.TransformCoordinatesFromFloatsToRef(e * o, t, i * o, n, r), + ); + }), + (t.prototype.calcMovePOV = function (e, t, i) { + var n = new a.j(); + (this.rotationQuaternion + ? this.rotationQuaternion + : a.q.RotationYawPitchRoll( + this.rotation.y, + this.rotation.x, + this.rotation.z + ) + ).toRotationMatrix(n); + var r = a.x.Zero(), + o = this.definedFacingForward ? -1 : 1; + return ( + a.x.TransformCoordinatesFromFloatsToRef( + e * o, + t, + i * o, + n, + r + ), r - } - , - t.prototype.rotatePOV = function(e, t, i) { - return this.rotation.addInPlace(this.calcRotatePOV(e, t, i)), - this - } - , - t.prototype.calcRotatePOV = function(e, t, i) { - var n = this.definedFacingForward ? 1 : -1; - return new a.x(e * n,t,i * n) - } - , - t.prototype.refreshBoundingInfo = function(e) { - return void 0 === e && (e = false), - this._boundingInfo && this._boundingInfo.isLocked ? this : (this._refreshBoundingInfo(this._getPositionData(e), null), - this) - } - , - t.prototype._refreshBoundingInfo = function(e, t) { - if (e) { - var i = r.h.ExtractMinAndMax(e, 0, this.getTotalVertices(), t); - this._boundingInfo ? this._boundingInfo.reConstruct(i.minimum, i.maximum) : this._boundingInfo = new f.a(i.minimum,i.maximum) - } - if (this.subMeshes) - for (var n = 0; n < this.subMeshes.length; n++) - this.subMeshes[n].refreshBoundingInfo(e); - this._updateBoundingInfo() - } - , - t.prototype._getPositionData = function(e) { - var t = this.getVerticesData(c.b.PositionKind); - if (t && e && this.skeleton) { - t = r.h.Slice(t), - this._generatePointsArray(); - var i = this.getVerticesData(c.b.MatricesIndicesKind) - , n = this.getVerticesData(c.b.MatricesWeightsKind); - if (n && i) { - var o = this.numBoneInfluencers > 4 - , s = o ? this.getVerticesData(c.b.MatricesIndicesExtraKind) : null - , u = o ? this.getVerticesData(c.b.MatricesWeightsExtraKind) : null; - this.skeleton.prepare(); - for (var l = this.skeleton.getTransformMatrices(this), h = a.t.Vector3[0], f = a.t.Matrix[0], d = a.t.Matrix[1], p = 0, m = 0; m < t.length; m += 3, - p += 4) { - var g, _; - for (f.reset(), - g = 0; g < 4; g++) - (_ = n[p + g]) > 0 && (a.j.FromFloat32ArrayToRefScaled(l, Math.floor(16 * i[p + g]), _, d), - f.addToSelf(d)); - if (o) - for (g = 0; g < 4; g++) - (_ = u[p + g]) > 0 && (a.j.FromFloat32ArrayToRefScaled(l, Math.floor(16 * s[p + g]), _, d), - f.addToSelf(d)); - a.x.TransformCoordinatesFromFloatsToRef(t[m], t[m + 1], t[m + 2], f, h), - h.toArray(t, m), - this._positions && this._positions[m / 3].copyFrom(h) - } - } - } - return t - } - , - t.prototype._updateBoundingInfo = function() { - var e = this._effectiveMesh; - return this._boundingInfo ? this._boundingInfo.update(e.worldMatrixFromCache) : this._boundingInfo = new f.a(this.absolutePosition,this.absolutePosition,e.worldMatrixFromCache), - this._updateSubMeshesBoundingInfo(e.worldMatrixFromCache), - this - } - , - t.prototype._updateSubMeshesBoundingInfo = function(e) { - if (!this.subMeshes) - return this; - for (var t = this.subMeshes.length, i = 0; i < t; i++) { - var n = this.subMeshes[i]; - (t > 1 || !n.IsGlobal) && n.updateBoundingInfo(e) - } - return this - } - , - t.prototype._afterComputeWorldMatrix = function() { - this.doNotSyncBoundingInfo || this._updateBoundingInfo() - } - , - Object.defineProperty(t.prototype, "_effectiveMesh", { - get: function() { - return this.skeleton && this.skeleton.overrideMesh || this - }, - enumerable: true, - configurable: true + ); }), - t.prototype.isInFrustum = function(e) { - return null !== this._boundingInfo && this._boundingInfo.isInFrustum(e, this.cullingStrategy) - } - , - t.prototype.isCompletelyInFrustum = function(e) { - return null !== this._boundingInfo && this._boundingInfo.isCompletelyInFrustum(e) - } - , - t.prototype.intersectsMesh = function(e, t, i) { - if (void 0 === t && (t = false), + (t.prototype.rotatePOV = function (e, t, i) { + return ( + this.rotation.addInPlace(this.calcRotatePOV(e, t, i)), + this + ); + }), + (t.prototype.calcRotatePOV = function (e, t, i) { + var n = this.definedFacingForward ? 1 : -1; + return new a.x(e * n, t, i * n); + }), + (t.prototype.refreshBoundingInfo = function (e) { + return ( + void 0 === e && (e = false), + this._boundingInfo && this._boundingInfo.isLocked + ? this + : (this._refreshBoundingInfo( + this._getPositionData(e), + null + ), + this) + ); + }), + (t.prototype._refreshBoundingInfo = function (e, t) { + if (e) { + var i = r.h.ExtractMinAndMax( + e, + 0, + this.getTotalVertices(), + t + ); + this._boundingInfo + ? this._boundingInfo.reConstruct(i.minimum, i.maximum) + : (this._boundingInfo = new f.a( + i.minimum, + i.maximum + )); + } + if (this.subMeshes) + for (var n = 0; n < this.subMeshes.length; n++) + this.subMeshes[n].refreshBoundingInfo(e); + this._updateBoundingInfo(); + }), + (t.prototype._getPositionData = function (e) { + var t = this.getVerticesData(c.b.PositionKind); + if (t && e && this.skeleton) { + (t = r.h.Slice(t)), this._generatePointsArray(); + var i = this.getVerticesData(c.b.MatricesIndicesKind), + n = this.getVerticesData(c.b.MatricesWeightsKind); + if (n && i) { + var o = this.numBoneInfluencers > 4, + s = o + ? this.getVerticesData( + c.b.MatricesIndicesExtraKind + ) + : null, + u = o + ? this.getVerticesData( + c.b.MatricesWeightsExtraKind + ) + : null; + this.skeleton.prepare(); + for ( + var l = this.skeleton.getTransformMatrices(this), + h = a.t.Vector3[0], + f = a.t.Matrix[0], + d = a.t.Matrix[1], + p = 0, + m = 0; + m < t.length; + m += 3, p += 4 + ) { + var g, _; + for (f.reset(), g = 0; g < 4; g++) + (_ = n[p + g]) > 0 && + (a.j.FromFloat32ArrayToRefScaled( + l, + Math.floor(16 * i[p + g]), + _, + d + ), + f.addToSelf(d)); + if (o) + for (g = 0; g < 4; g++) + (_ = u[p + g]) > 0 && + (a.j.FromFloat32ArrayToRefScaled( + l, + Math.floor(16 * s[p + g]), + _, + d + ), + f.addToSelf(d)); + a.x.TransformCoordinatesFromFloatsToRef( + t[m], + t[m + 1], + t[m + 2], + f, + h + ), + h.toArray(t, m), + this._positions && + this._positions[m / 3].copyFrom(h); + } + } + } + return t; + }), + (t.prototype._updateBoundingInfo = function () { + var e = this._effectiveMesh; + return ( + this._boundingInfo + ? this._boundingInfo.update(e.worldMatrixFromCache) + : (this._boundingInfo = new f.a( + this.absolutePosition, + this.absolutePosition, + e.worldMatrixFromCache + )), + this._updateSubMeshesBoundingInfo( + e.worldMatrixFromCache + ), + this + ); + }), + (t.prototype._updateSubMeshesBoundingInfo = function (e) { + if (!this.subMeshes) return this; + for (var t = this.subMeshes.length, i = 0; i < t; i++) { + var n = this.subMeshes[i]; + (t > 1 || !n.IsGlobal) && n.updateBoundingInfo(e); + } + return this; + }), + (t.prototype._afterComputeWorldMatrix = function () { + this.doNotSyncBoundingInfo || this._updateBoundingInfo(); + }), + Object.defineProperty(t.prototype, "_effectiveMesh", { + get: function () { + return ( + (this.skeleton && this.skeleton.overrideMesh) || this + ); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.isInFrustum = function (e) { + return ( + null !== this._boundingInfo && + this._boundingInfo.isInFrustum(e, this.cullingStrategy) + ); + }), + (t.prototype.isCompletelyInFrustum = function (e) { + return ( + null !== this._boundingInfo && + this._boundingInfo.isCompletelyInFrustum(e) + ); + }), + (t.prototype.intersectsMesh = function (e, t, i) { + if ( + (void 0 === t && (t = false), !this._boundingInfo || !e._boundingInfo) - return false; - if (this._boundingInfo.intersects(e._boundingInfo, t)) - return true; - if (i) - for (var n = 0, r = this.getChildMeshes(); n < r.length; n++) - if (r[n].intersectsMesh(e, t, true)) - return true; - return false - } - , - t.prototype.intersectsPoint = function(e) { - return !!this._boundingInfo && this._boundingInfo.intersectsPoint(e) - } - , + ) + return false; + if (this._boundingInfo.intersects(e._boundingInfo, t)) + return true; + if (i) + for ( + var n = 0, r = this.getChildMeshes(); + n < r.length; + n++ + ) + if (r[n].intersectsMesh(e, t, true)) return true; + return false; + }), + (t.prototype.intersectsPoint = function (e) { + return ( + !!this._boundingInfo && + this._boundingInfo.intersectsPoint(e) + ); + }), Object.defineProperty(t.prototype, "checkCollisions", { - get: function() { - return this._meshCollisionData._checkCollisions - }, - set: function(e) { - this._meshCollisionData._checkCollisions = e - }, - enumerable: true, - configurable: true + get: function () { + return this._meshCollisionData._checkCollisions; + }, + set: function (e) { + this._meshCollisionData._checkCollisions = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "collider", { - get: function() { - return this._meshCollisionData._collider - }, - enumerable: true, - configurable: true + get: function () { + return this._meshCollisionData._collider; + }, + enumerable: true, + configurable: true, }), - t.prototype.moveWithCollisions = function(e) { - this.getAbsolutePosition().addToRef(this.ellipsoidOffset, this._meshCollisionData._oldPositionForCollisions); - var t = this.getScene().collisionCoordinator; - return this._meshCollisionData._collider || (this._meshCollisionData._collider = t.createCollider()), - this._meshCollisionData._collider._radius = this.ellipsoid, - t.getNewPosition(this._meshCollisionData._oldPositionForCollisions, e, this._meshCollisionData._collider, 3, this, this._onCollisionPositionChange, this.uniqueId), + (t.prototype.moveWithCollisions = function (e) { + this.getAbsolutePosition().addToRef( + this.ellipsoidOffset, + this._meshCollisionData._oldPositionForCollisions + ); + var t = this.getScene().collisionCoordinator; + return ( + this._meshCollisionData._collider || + (this._meshCollisionData._collider = + t.createCollider()), + (this._meshCollisionData._collider._radius = + this.ellipsoid), + t.getNewPosition( + this._meshCollisionData._oldPositionForCollisions, + e, + this._meshCollisionData._collider, + 3, + this, + this._onCollisionPositionChange, + this.uniqueId + ), this - } - , - t.prototype._collideForSubMesh = function(e, t, i) { - if (this._generatePointsArray(), - !this._positions) - return this; - if (!e._lastColliderWorldVertices || !e._lastColliderTransformMatrix.equals(t)) { - e._lastColliderTransformMatrix = t.clone(), - e._lastColliderWorldVertices = [], - e._trianglePlanes = []; - for (var n = e.verticesStart, r = e.verticesStart + e.verticesCount, o = n; o < r; o++) - e._lastColliderWorldVertices.push(a.x.TransformCoordinates(this._positions[o], t)) - } - return i._collide(e._trianglePlanes, e._lastColliderWorldVertices, this.getIndices(), e.indexStart, e.indexStart + e.indexCount, e.verticesStart, !!e.getMaterial()), + ); + }), + (t.prototype._collideForSubMesh = function (e, t, i) { + if ((this._generatePointsArray(), !this._positions)) + return this; + if ( + !e._lastColliderWorldVertices || + !e._lastColliderTransformMatrix.equals(t) + ) { + (e._lastColliderTransformMatrix = t.clone()), + (e._lastColliderWorldVertices = []), + (e._trianglePlanes = []); + for ( + var n = e.verticesStart, + r = e.verticesStart + e.verticesCount, + o = n; + o < r; + o++ + ) + e._lastColliderWorldVertices.push( + a.x.TransformCoordinates(this._positions[o], t) + ); + } + return ( + i._collide( + e._trianglePlanes, + e._lastColliderWorldVertices, + this.getIndices(), + e.indexStart, + e.indexStart + e.indexCount, + e.verticesStart, + !!e.getMaterial() + ), i.collisionFound && (i.collidedMesh = this), this - } - , - t.prototype._processCollisionsForSubMeshes = function(e, t) { - for (var i = this._scene.getCollidingSubMeshCandidates(this, e), n = i.length, r = 0; r < n; r++) { - var o = i.data[r]; - n > 1 && !o._checkCollision(e) || this._collideForSubMesh(o, t, e) - } - return this - } - , - t.prototype._checkCollision = function(e) { - if (!this._boundingInfo || !this._boundingInfo._checkCollision(e)) - return this; - var t = a.t.Matrix[0] - , i = a.t.Matrix[1]; - return a.j.ScalingToRef(1 / e._radius.x, 1 / e._radius.y, 1 / e._radius.z, t), + ); + }), + (t.prototype._processCollisionsForSubMeshes = function ( + e, + t + ) { + for ( + var i = this._scene.getCollidingSubMeshCandidates( + this, + e + ), + n = i.length, + r = 0; + r < n; + r++ + ) { + var o = i.data[r]; + (n > 1 && !o._checkCollision(e)) || + this._collideForSubMesh(o, t, e); + } + return this; + }), + (t.prototype._checkCollision = function (e) { + if ( + !this._boundingInfo || + !this._boundingInfo._checkCollision(e) + ) + return this; + var t = a.t.Matrix[0], + i = a.t.Matrix[1]; + return ( + a.j.ScalingToRef( + 1 / e._radius.x, + 1 / e._radius.y, + 1 / e._radius.z, + t + ), this.worldMatrixFromCache.multiplyToRef(t, i), this._processCollisionsForSubMeshes(e, i), this - } - , - t.prototype._generatePointsArray = function() { - return false - } - , - t.prototype.intersects = function(e, t, i) { - var n = new h.a - , r = "InstancedLinesMesh" === this.getClassName() || "LinesMesh" === this.getClassName() ? this.intersectionThreshold : 0 - , o = this._boundingInfo; - if (!(this.subMeshes && o && e.intersectsSphere(o.boundingSphere, r) && e.intersectsBox(o.boundingBox, r))) - return n; - if (!this._generatePointsArray()) - return n; - for (var s = null, c = this._scene.getIntersectingSubMeshCandidates(this, e), u = c.length, l = 0; l < u; l++) { - var f = c.data[l]; - if (!(u > 1) || f.canIntersects(e)) { - var d = f.intersects(e, this._positions, this.getIndices(), t, i); - if (d && (t || !s || d.distance < s.distance) && ((s = d).subMeshId = l, - t)) - break - } + ); + }), + (t.prototype._generatePointsArray = function () { + return false; + }), + (t.prototype.intersects = function (e, t, i) { + var n = new h.a(), + r = + "InstancedLinesMesh" === this.getClassName() || + "LinesMesh" === this.getClassName() + ? this.intersectionThreshold + : 0, + o = this._boundingInfo; + if ( + !( + this.subMeshes && + o && + e.intersectsSphere(o.boundingSphere, r) && + e.intersectsBox(o.boundingBox, r) + ) + ) + return n; + if (!this._generatePointsArray()) return n; + for ( + var s = null, + c = this._scene.getIntersectingSubMeshCandidates( + this, + e + ), + u = c.length, + l = 0; + l < u; + l++ + ) { + var f = c.data[l]; + if (!(u > 1) || f.canIntersects(e)) { + var d = f.intersects( + e, + this._positions, + this.getIndices(), + t, + i + ); + if ( + d && + (t || !s || d.distance < s.distance) && + (((s = d).subMeshId = l), t) + ) + break; } - if (s) { - var p = this.getWorldMatrix() - , m = a.t.Vector3[0] - , g = a.t.Vector3[1]; - a.x.TransformCoordinatesToRef(e.origin, p, m), - e.direction.scaleToRef(s.distance, g); - var _ = a.x.TransformNormal(g, p).addInPlace(m); - return n.hit = true, - n.distance = a.x.Distance(m, _), - n.pickedPoint = _, - n.pickedMesh = this, - n.bu = s.bu || 0, - n.bv = s.bv || 0, - n.faceId = s.faceId, - n.subMeshId = s.subMeshId, - n - } - return n - } - , - t.prototype.clone = function(e, t, i) { - return null - } - , - t.prototype.releaseSubMeshes = function() { - if (this.subMeshes) - for (; this.subMeshes.length; ) - this.subMeshes[0].dispose(); - else - this.subMeshes = new Array; - return this - } - , - t.prototype.dispose = function(t, i) { - var n, r = this; - for (void 0 === i && (i = false), - this.getScene().freeActiveMeshes(), - this.getScene().freeRenderingGroups(), - void 0 !== this.actionManager && null !== this.actionManager && (this.actionManager.dispose(), - this.actionManager = null), - this._internalAbstractMeshDataInfo._skeleton = null, - n = 0; n < this._intersectionsInProgress.length; n++) { - var o = this._intersectionsInProgress[n] - , a = o._intersectionsInProgress.indexOf(this); - o._intersectionsInProgress.splice(a, 1) - } - this._intersectionsInProgress = [], - this.getScene().lights.forEach(function(e) { - var t = e.includedOnlyMeshes.indexOf(r); - -1 !== t && e.includedOnlyMeshes.splice(t, 1), - -1 !== (t = e.excludedMeshes.indexOf(r)) && e.excludedMeshes.splice(t, 1); - var i = e.getShadowGenerator(); - if (i) { - var n = i.getShadowMap(); - n && n.renderList && -1 !== (t = n.renderList.indexOf(r)) && n.renderList.splice(t, 1) - } + } + if (s) { + var p = this.getWorldMatrix(), + m = a.t.Vector3[0], + g = a.t.Vector3[1]; + a.x.TransformCoordinatesToRef(e.origin, p, m), + e.direction.scaleToRef(s.distance, g); + var _ = a.x.TransformNormal(g, p).addInPlace(m); + return ( + (n.hit = true), + (n.distance = a.x.Distance(m, _)), + (n.pickedPoint = _), + (n.pickedMesh = this), + (n.bu = s.bu || 0), + (n.bv = s.bv || 0), + (n.faceId = s.faceId), + (n.subMeshId = s.subMeshId), + n + ); + } + return n; + }), + (t.prototype.clone = function (e, t, i) { + return null; + }), + (t.prototype.releaseSubMeshes = function () { + if (this.subMeshes) + for (; this.subMeshes.length; ) + this.subMeshes[0].dispose(); + else this.subMeshes = new Array(); + return this; + }), + (t.prototype.dispose = function (t, i) { + var n, + r = this; + for ( + void 0 === i && (i = false), + this.getScene().freeActiveMeshes(), + this.getScene().freeRenderingGroups(), + void 0 !== this.actionManager && + null !== this.actionManager && + (this.actionManager.dispose(), + (this.actionManager = null)), + this._internalAbstractMeshDataInfo._skeleton = null, + n = 0; + n < this._intersectionsInProgress.length; + n++ + ) { + var o = this._intersectionsInProgress[n], + a = o._intersectionsInProgress.indexOf(this); + o._intersectionsInProgress.splice(a, 1); + } + (this._intersectionsInProgress = []), + this.getScene().lights.forEach(function (e) { + var t = e.includedOnlyMeshes.indexOf(r); + -1 !== t && e.includedOnlyMeshes.splice(t, 1), + -1 !== (t = e.excludedMeshes.indexOf(r)) && + e.excludedMeshes.splice(t, 1); + var i = e.getShadowGenerator(); + if (i) { + var n = i.getShadowMap(); + n && + n.renderList && + -1 !== (t = n.renderList.indexOf(r)) && + n.renderList.splice(t, 1); + } }), - "InstancedMesh" === this.getClassName() && "InstancedLinesMesh" === this.getClassName() || this.releaseSubMeshes(); - var s = this.getScene().getEngine(); - if (this._occlusionQuery && (this.isOcclusionQueryInProgress = false, - s.deleteQuery(this._occlusionQuery), - this._occlusionQuery = null), + ("InstancedMesh" === this.getClassName() && + "InstancedLinesMesh" === this.getClassName()) || + this.releaseSubMeshes(); + var s = this.getScene().getEngine(); + if ( + (this._occlusionQuery && + ((this.isOcclusionQueryInProgress = false), + s.deleteQuery(this._occlusionQuery), + (this._occlusionQuery = null)), s.wipeCaches(), this.getScene().removeMesh(this), - i && this.material && ("MultiMaterial" === this.material.getClassName() ? this.material.dispose(false, true, true) : this.material.dispose(false, true)), + i && + this.material && + ("MultiMaterial" === this.material.getClassName() + ? this.material.dispose(false, true, true) + : this.material.dispose(false, true)), !t) - for (n = 0; n < this.getScene().particleSystems.length; n++) - this.getScene().particleSystems[n].emitter === this && (this.getScene().particleSystems[n].dispose(), - n--); - this._internalAbstractMeshDataInfo._facetData.facetDataEnabled && this.disableFacetData(), + ) + for ( + n = 0; + n < this.getScene().particleSystems.length; + n++ + ) + this.getScene().particleSystems[n].emitter === this && + (this.getScene().particleSystems[n].dispose(), n--); + this._internalAbstractMeshDataInfo._facetData + .facetDataEnabled && this.disableFacetData(), this.onAfterWorldMatrixUpdateObservable.clear(), this.onCollideObservable.clear(), this.onCollisionPositionChangeObservable.clear(), this.onRebuildObservable.clear(), - e.prototype.dispose.call(this, t, i) - } - , - t.prototype.addChild = function(e) { - return e.setParent(this), - this - } - , - t.prototype.removeChild = function(e) { - return e.setParent(null), - this - } - , - t.prototype._initFacetData = function() { - var e = this._internalAbstractMeshDataInfo._facetData; - e.facetNormals || (e.facetNormals = new Array), - e.facetPositions || (e.facetPositions = new Array), - e.facetPartitioning || (e.facetPartitioning = new Array), - e.facetNb = this.getIndices().length / 3 | 0, - e.partitioningSubdivisions = e.partitioningSubdivisions ? e.partitioningSubdivisions : 10, - e.partitioningBBoxRatio = e.partitioningBBoxRatio ? e.partitioningBBoxRatio : 1.01; - for (var t = 0; t < e.facetNb; t++) - e.facetNormals[t] = a.x.Zero(), - e.facetPositions[t] = a.x.Zero(); - return e.facetDataEnabled = true, - this - } - , - t.prototype.updateFacetData = function() { - var e = this._internalAbstractMeshDataInfo._facetData; - e.facetDataEnabled || this._initFacetData(); - var t = this.getVerticesData(c.b.PositionKind) - , i = this.getIndices() - , n = this.getVerticesData(c.b.NormalKind) - , r = this.getBoundingInfo(); - if (e.facetDepthSort && !e.facetDepthSortEnabled) { - if (e.facetDepthSortEnabled = true, - i instanceof Uint16Array) - e.depthSortedIndices = new Uint16Array(i); - else if (i instanceof Uint32Array) - e.depthSortedIndices = new Uint32Array(i); - else { - for (var o = false, s = 0; s < i.length; s++) - if (i[s] > 65535) { - o = true; - break - } - e.depthSortedIndices = o ? new Uint32Array(i) : new Uint16Array(i) + e.prototype.dispose.call(this, t, i); + }), + (t.prototype.addChild = function (e) { + return e.setParent(this), this; + }), + (t.prototype.removeChild = function (e) { + return e.setParent(null), this; + }), + (t.prototype._initFacetData = function () { + var e = this._internalAbstractMeshDataInfo._facetData; + e.facetNormals || (e.facetNormals = new Array()), + e.facetPositions || (e.facetPositions = new Array()), + e.facetPartitioning || + (e.facetPartitioning = new Array()), + (e.facetNb = (this.getIndices().length / 3) | 0), + (e.partitioningSubdivisions = e.partitioningSubdivisions + ? e.partitioningSubdivisions + : 10), + (e.partitioningBBoxRatio = e.partitioningBBoxRatio + ? e.partitioningBBoxRatio + : 1.01); + for (var t = 0; t < e.facetNb; t++) + (e.facetNormals[t] = a.x.Zero()), + (e.facetPositions[t] = a.x.Zero()); + return (e.facetDataEnabled = true), this; + }), + (t.prototype.updateFacetData = function () { + var e = this._internalAbstractMeshDataInfo._facetData; + e.facetDataEnabled || this._initFacetData(); + var t = this.getVerticesData(c.b.PositionKind), + i = this.getIndices(), + n = this.getVerticesData(c.b.NormalKind), + r = this.getBoundingInfo(); + if (e.facetDepthSort && !e.facetDepthSortEnabled) { + if ( + ((e.facetDepthSortEnabled = true), + i instanceof Uint16Array) + ) + e.depthSortedIndices = new Uint16Array(i); + else if (i instanceof Uint32Array) + e.depthSortedIndices = new Uint32Array(i); + else { + for (var o = false, s = 0; s < i.length; s++) + if (i[s] > 65535) { + o = true; + break; } - if (e.facetDepthSortFunction = function(e, t) { - return t.sqDistance - e.sqDistance - } - , - !e.facetDepthSortFrom) { - var l = this.getScene().activeCamera; - e.facetDepthSortFrom = l ? l.position : a.x.Zero() - } - e.depthSortedFacets = []; - for (var h = 0; h < e.facetNb; h++) { - var f = { - ind: 3 * h, - sqDistance: 0 - }; - e.depthSortedFacets.push(f) - } - e.invertedMatrix = a.j.Identity(), - e.facetDepthSortOrigin = a.x.Zero() + e.depthSortedIndices = o + ? new Uint32Array(i) + : new Uint16Array(i); } - e.bbSize.x = r.maximum.x - r.minimum.x > a.h ? r.maximum.x - r.minimum.x : a.h, - e.bbSize.y = r.maximum.y - r.minimum.y > a.h ? r.maximum.y - r.minimum.y : a.h, - e.bbSize.z = r.maximum.z - r.minimum.z > a.h ? r.maximum.z - r.minimum.z : a.h; - var d = e.bbSize.x > e.bbSize.y ? e.bbSize.x : e.bbSize.y; - if (d = d > e.bbSize.z ? d : e.bbSize.z, - e.subDiv.max = e.partitioningSubdivisions, - e.subDiv.X = Math.floor(e.subDiv.max * e.bbSize.x / d), - e.subDiv.Y = Math.floor(e.subDiv.max * e.bbSize.y / d), - e.subDiv.Z = Math.floor(e.subDiv.max * e.bbSize.z / d), - e.subDiv.X = e.subDiv.X < 1 ? 1 : e.subDiv.X, - e.subDiv.Y = e.subDiv.Y < 1 ? 1 : e.subDiv.Y, - e.subDiv.Z = e.subDiv.Z < 1 ? 1 : e.subDiv.Z, - e.facetParameters.facetNormals = this.getFacetLocalNormals(), - e.facetParameters.facetPositions = this.getFacetLocalPositions(), - e.facetParameters.facetPartitioning = this.getFacetLocalPartitioning(), - e.facetParameters.bInfo = r, - e.facetParameters.bbSize = e.bbSize, - e.facetParameters.subDiv = e.subDiv, - e.facetParameters.ratio = this.partitioningBBoxRatio, - e.facetParameters.depthSort = e.facetDepthSort, - e.facetDepthSort && e.facetDepthSortEnabled && (this.computeWorldMatrix(true), - this._worldMatrix.invertToRef(e.invertedMatrix), - a.x.TransformCoordinatesToRef(e.facetDepthSortFrom, e.invertedMatrix, e.facetDepthSortOrigin), - e.facetParameters.distanceTo = e.facetDepthSortOrigin), - e.facetParameters.depthSortedFacets = e.depthSortedFacets, + if ( + ((e.facetDepthSortFunction = function (e, t) { + return t.sqDistance - e.sqDistance; + }), + !e.facetDepthSortFrom) + ) { + var l = this.getScene().activeCamera; + e.facetDepthSortFrom = l ? l.position : a.x.Zero(); + } + e.depthSortedFacets = []; + for (var h = 0; h < e.facetNb; h++) { + var f = { + ind: 3 * h, + sqDistance: 0, + }; + e.depthSortedFacets.push(f); + } + (e.invertedMatrix = a.j.Identity()), + (e.facetDepthSortOrigin = a.x.Zero()); + } + (e.bbSize.x = + r.maximum.x - r.minimum.x > a.h + ? r.maximum.x - r.minimum.x + : a.h), + (e.bbSize.y = + r.maximum.y - r.minimum.y > a.h + ? r.maximum.y - r.minimum.y + : a.h), + (e.bbSize.z = + r.maximum.z - r.minimum.z > a.h + ? r.maximum.z - r.minimum.z + : a.h); + var d = e.bbSize.x > e.bbSize.y ? e.bbSize.x : e.bbSize.y; + if ( + ((d = d > e.bbSize.z ? d : e.bbSize.z), + (e.subDiv.max = e.partitioningSubdivisions), + (e.subDiv.X = Math.floor( + (e.subDiv.max * e.bbSize.x) / d + )), + (e.subDiv.Y = Math.floor( + (e.subDiv.max * e.bbSize.y) / d + )), + (e.subDiv.Z = Math.floor( + (e.subDiv.max * e.bbSize.z) / d + )), + (e.subDiv.X = e.subDiv.X < 1 ? 1 : e.subDiv.X), + (e.subDiv.Y = e.subDiv.Y < 1 ? 1 : e.subDiv.Y), + (e.subDiv.Z = e.subDiv.Z < 1 ? 1 : e.subDiv.Z), + (e.facetParameters.facetNormals = + this.getFacetLocalNormals()), + (e.facetParameters.facetPositions = + this.getFacetLocalPositions()), + (e.facetParameters.facetPartitioning = + this.getFacetLocalPartitioning()), + (e.facetParameters.bInfo = r), + (e.facetParameters.bbSize = e.bbSize), + (e.facetParameters.subDiv = e.subDiv), + (e.facetParameters.ratio = this.partitioningBBoxRatio), + (e.facetParameters.depthSort = e.facetDepthSort), + e.facetDepthSort && + e.facetDepthSortEnabled && + (this.computeWorldMatrix(true), + this._worldMatrix.invertToRef(e.invertedMatrix), + a.x.TransformCoordinatesToRef( + e.facetDepthSortFrom, + e.invertedMatrix, + e.facetDepthSortOrigin + ), + (e.facetParameters.distanceTo = + e.facetDepthSortOrigin)), + (e.facetParameters.depthSortedFacets = + e.depthSortedFacets), u.a.ComputeNormals(t, i, n, e.facetParameters), - e.facetDepthSort && e.facetDepthSortEnabled) { - e.depthSortedFacets.sort(e.facetDepthSortFunction); - var p = e.depthSortedIndices.length / 3 | 0; - for (h = 0; h < p; h++) { - var m = e.depthSortedFacets[h].ind; - e.depthSortedIndices[3 * h] = i[m], - e.depthSortedIndices[3 * h + 1] = i[m + 1], - e.depthSortedIndices[3 * h + 2] = i[m + 2] - } - this.updateIndices(e.depthSortedIndices, void 0, true) + e.facetDepthSort && e.facetDepthSortEnabled) + ) { + e.depthSortedFacets.sort(e.facetDepthSortFunction); + var p = (e.depthSortedIndices.length / 3) | 0; + for (h = 0; h < p; h++) { + var m = e.depthSortedFacets[h].ind; + (e.depthSortedIndices[3 * h] = i[m]), + (e.depthSortedIndices[3 * h + 1] = i[m + 1]), + (e.depthSortedIndices[3 * h + 2] = i[m + 2]); } - return this - } - , - t.prototype.getFacetLocalNormals = function() { - var e = this._internalAbstractMeshDataInfo._facetData; - return e.facetNormals || this.updateFacetData(), - e.facetNormals - } - , - t.prototype.getFacetLocalPositions = function() { - var e = this._internalAbstractMeshDataInfo._facetData; - return e.facetPositions || this.updateFacetData(), + this.updateIndices(e.depthSortedIndices, void 0, true); + } + return this; + }), + (t.prototype.getFacetLocalNormals = function () { + var e = this._internalAbstractMeshDataInfo._facetData; + return ( + e.facetNormals || this.updateFacetData(), e.facetNormals + ); + }), + (t.prototype.getFacetLocalPositions = function () { + var e = this._internalAbstractMeshDataInfo._facetData; + return ( + e.facetPositions || this.updateFacetData(), e.facetPositions - } - , - t.prototype.getFacetLocalPartitioning = function() { - var e = this._internalAbstractMeshDataInfo._facetData; - return e.facetPartitioning || this.updateFacetData(), + ); + }), + (t.prototype.getFacetLocalPartitioning = function () { + var e = this._internalAbstractMeshDataInfo._facetData; + return ( + e.facetPartitioning || this.updateFacetData(), e.facetPartitioning - } - , - t.prototype.getFacetPosition = function(e) { - var t = a.x.Zero(); - return this.getFacetPositionToRef(e, t), - t - } - , - t.prototype.getFacetPositionToRef = function(e, t) { - var i = this.getFacetLocalPositions()[e] - , n = this.getWorldMatrix(); - return a.x.TransformCoordinatesToRef(i, n, t), + ); + }), + (t.prototype.getFacetPosition = function (e) { + var t = a.x.Zero(); + return this.getFacetPositionToRef(e, t), t; + }), + (t.prototype.getFacetPositionToRef = function (e, t) { + var i = this.getFacetLocalPositions()[e], + n = this.getWorldMatrix(); + return a.x.TransformCoordinatesToRef(i, n, t), this; + }), + (t.prototype.getFacetNormal = function (e) { + var t = a.x.Zero(); + return this.getFacetNormalToRef(e, t), t; + }), + (t.prototype.getFacetNormalToRef = function (e, t) { + var i = this.getFacetLocalNormals()[e]; + return ( + a.x.TransformNormalToRef(i, this.getWorldMatrix(), t), this - } - , - t.prototype.getFacetNormal = function(e) { - var t = a.x.Zero(); - return this.getFacetNormalToRef(e, t), - t - } - , - t.prototype.getFacetNormalToRef = function(e, t) { - var i = this.getFacetLocalNormals()[e]; - return a.x.TransformNormalToRef(i, this.getWorldMatrix(), t), - this - } - , - t.prototype.getFacetsAtLocalCoordinates = function(e, t, i) { - var n = this.getBoundingInfo() - , r = this._internalAbstractMeshDataInfo._facetData - , o = Math.floor((e - n.minimum.x * r.partitioningBBoxRatio) * r.subDiv.X * r.partitioningBBoxRatio / r.bbSize.x) - , a = Math.floor((t - n.minimum.y * r.partitioningBBoxRatio) * r.subDiv.Y * r.partitioningBBoxRatio / r.bbSize.y) - , s = Math.floor((i - n.minimum.z * r.partitioningBBoxRatio) * r.subDiv.Z * r.partitioningBBoxRatio / r.bbSize.z); - return o < 0 || o > r.subDiv.max || a < 0 || a > r.subDiv.max || s < 0 || s > r.subDiv.max ? null : r.facetPartitioning[o + r.subDiv.max * a + r.subDiv.max * r.subDiv.max * s] - } - , - t.prototype.getClosestFacetAtCoordinates = function(e, t, i, n, r, o) { - void 0 === r && (r = false), - void 0 === o && (o = true); - var s = this.getWorldMatrix() - , c = a.t.Matrix[5]; - s.invertToRef(c); - var u = a.t.Vector3[8]; - a.x.TransformCoordinatesFromFloatsToRef(e, t, i, c, u); - var l = this.getClosestFacetAtLocalCoordinates(u.x, u.y, u.z, n, r, o); - return n && a.x.TransformCoordinatesFromFloatsToRef(n.x, n.y, n.z, s, n), + ); + }), + (t.prototype.getFacetsAtLocalCoordinates = function ( + e, + t, + i + ) { + var n = this.getBoundingInfo(), + r = this._internalAbstractMeshDataInfo._facetData, + o = Math.floor( + ((e - n.minimum.x * r.partitioningBBoxRatio) * + r.subDiv.X * + r.partitioningBBoxRatio) / + r.bbSize.x + ), + a = Math.floor( + ((t - n.minimum.y * r.partitioningBBoxRatio) * + r.subDiv.Y * + r.partitioningBBoxRatio) / + r.bbSize.y + ), + s = Math.floor( + ((i - n.minimum.z * r.partitioningBBoxRatio) * + r.subDiv.Z * + r.partitioningBBoxRatio) / + r.bbSize.z + ); + return o < 0 || + o > r.subDiv.max || + a < 0 || + a > r.subDiv.max || + s < 0 || + s > r.subDiv.max + ? null + : r.facetPartitioning[ + o + + r.subDiv.max * a + + r.subDiv.max * r.subDiv.max * s + ]; + }), + (t.prototype.getClosestFacetAtCoordinates = function ( + e, + t, + i, + n, + r, + o + ) { + void 0 === r && (r = false), void 0 === o && (o = true); + var s = this.getWorldMatrix(), + c = a.t.Matrix[5]; + s.invertToRef(c); + var u = a.t.Vector3[8]; + a.x.TransformCoordinatesFromFloatsToRef(e, t, i, c, u); + var l = this.getClosestFacetAtLocalCoordinates( + u.x, + u.y, + u.z, + n, + r, + o + ); + return ( + n && + a.x.TransformCoordinatesFromFloatsToRef( + n.x, + n.y, + n.z, + s, + n + ), l - } - , - t.prototype.getClosestFacetAtLocalCoordinates = function(e, t, i, n, r, o) { - void 0 === r && (r = false), - void 0 === o && (o = true); - var a = null - , s = 0 - , c = 0 - , u = 0 - , l = 0 - , h = 0 - , f = 0 - , d = 0 - , p = 0 - , m = this.getFacetLocalPositions() - , g = this.getFacetLocalNormals() - , _ = this.getFacetsAtLocalCoordinates(e, t, i); - if (!_) - return null; - for (var v, y, b, E = Number.MAX_VALUE, T = E, A = 0; A < _.length; A++) - y = g[v = _[A]], - l = (e - (b = m[v]).x) * y.x + (t - b.y) * y.y + (i - b.z) * y.z, - (!r || r && o && l >= 0 || r && !o && l <= 0) && (l = y.x * b.x + y.y * b.y + y.z * b.z, - h = -(y.x * e + y.y * t + y.z * i - l) / (y.x * y.x + y.y * y.y + y.z * y.z), - (T = (s = (f = e + y.x * h) - e) * s + (c = (d = t + y.y * h) - t) * c + (u = (p = i + y.z * h) - i) * u) < E && (E = T, - a = v, - n && (n.x = f, - n.y = d, - n.z = p))); - return a - } - , - t.prototype.getFacetDataParameters = function() { - return this._internalAbstractMeshDataInfo._facetData.facetParameters - } - , - t.prototype.disableFacetData = function() { - var e = this._internalAbstractMeshDataInfo._facetData; - return e.facetDataEnabled && (e.facetDataEnabled = false, - e.facetPositions = new Array, - e.facetNormals = new Array, - e.facetPartitioning = new Array, - e.facetParameters = null, - e.depthSortedIndices = new Uint32Array(0)), + ); + }), + (t.prototype.getClosestFacetAtLocalCoordinates = function ( + e, + t, + i, + n, + r, + o + ) { + void 0 === r && (r = false), void 0 === o && (o = true); + var a = null, + s = 0, + c = 0, + u = 0, + l = 0, + h = 0, + f = 0, + d = 0, + p = 0, + m = this.getFacetLocalPositions(), + g = this.getFacetLocalNormals(), + _ = this.getFacetsAtLocalCoordinates(e, t, i); + if (!_) return null; + for ( + var v, y, b, E = Number.MAX_VALUE, T = E, A = 0; + A < _.length; + A++ + ) + (y = g[(v = _[A])]), + (l = + (e - (b = m[v]).x) * y.x + + (t - b.y) * y.y + + (i - b.z) * y.z), + (!r || (r && o && l >= 0) || (r && !o && l <= 0)) && + ((l = y.x * b.x + y.y * b.y + y.z * b.z), + (h = + -(y.x * e + y.y * t + y.z * i - l) / + (y.x * y.x + y.y * y.y + y.z * y.z)), + (T = + (s = (f = e + y.x * h) - e) * s + + (c = (d = t + y.y * h) - t) * c + + (u = (p = i + y.z * h) - i) * u) < E && + ((E = T), + (a = v), + n && ((n.x = f), (n.y = d), (n.z = p)))); + return a; + }), + (t.prototype.getFacetDataParameters = function () { + return this._internalAbstractMeshDataInfo._facetData + .facetParameters; + }), + (t.prototype.disableFacetData = function () { + var e = this._internalAbstractMeshDataInfo._facetData; + return ( + e.facetDataEnabled && + ((e.facetDataEnabled = false), + (e.facetPositions = new Array()), + (e.facetNormals = new Array()), + (e.facetPartitioning = new Array()), + (e.facetParameters = null), + (e.depthSortedIndices = new Uint32Array(0))), this - } - , - t.prototype.updateIndices = function(e, t, i) { - return void 0 === i && (i = false), - this - } - , - t.prototype.createNormals = function(e) { - var t, i = this.getVerticesData(c.b.PositionKind), n = this.getIndices(); - return t = this.isVerticesDataPresent(c.b.NormalKind) ? this.getVerticesData(c.b.NormalKind) : [], + ); + }), + (t.prototype.updateIndices = function (e, t, i) { + return void 0 === i && (i = false), this; + }), + (t.prototype.createNormals = function (e) { + var t, + i = this.getVerticesData(c.b.PositionKind), + n = this.getIndices(); + return ( + (t = this.isVerticesDataPresent(c.b.NormalKind) + ? this.getVerticesData(c.b.NormalKind) + : []), u.a.ComputeNormals(i, n, t, { - useRightHandedSystem: this.getScene().useRightHandedSystem + useRightHandedSystem: + this.getScene().useRightHandedSystem, }), this.setVerticesData(c.b.NormalKind, t, e), this - } - , - t.prototype.alignWithNormal = function(e, t) { - t || (t = a.c.Y); - var i = a.t.Vector3[0] - , n = a.t.Vector3[1]; - return a.x.CrossToRef(t, e, n), + ); + }), + (t.prototype.alignWithNormal = function (e, t) { + t || (t = a.c.Y); + var i = a.t.Vector3[0], + n = a.t.Vector3[1]; + return ( + a.x.CrossToRef(t, e, n), a.x.CrossToRef(e, n, i), - this.rotationQuaternion ? a.q.RotationQuaternionFromAxisToRef(i, e, n, this.rotationQuaternion) : a.x.RotationFromAxisToRef(i, e, n, this.rotation), + this.rotationQuaternion + ? a.q.RotationQuaternionFromAxisToRef( + i, + e, + n, + this.rotationQuaternion + ) + : a.x.RotationFromAxisToRef(i, e, n, this.rotation), this - } - , - t.prototype._checkOcclusionQuery = function() { - return false - } - , - t.prototype.disableEdgesRendering = function() { - throw m.a.WarnImport("EdgesRenderer") - } - , - t.prototype.enableEdgesRendering = function(e, t) { - throw m.a.WarnImport("EdgesRenderer") - } - , - t.OCCLUSION_TYPE_NONE = 0, - t.OCCLUSION_TYPE_OPTIMISTIC = 1, - t.OCCLUSION_TYPE_STRICT = 2, - t.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0, - t.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1, - t.CULLINGSTRATEGY_STANDARD = d.a.MESHES_CULLINGSTRATEGY_STANDARD, - t.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = d.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY, - t.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = d.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION, - t.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = d.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY, + ); + }), + (t.prototype._checkOcclusionQuery = function () { + return false; + }), + (t.prototype.disableEdgesRendering = function () { + throw m.a.WarnImport("EdgesRenderer"); + }), + (t.prototype.enableEdgesRendering = function (e, t) { + throw m.a.WarnImport("EdgesRenderer"); + }), + (t.OCCLUSION_TYPE_NONE = 0), + (t.OCCLUSION_TYPE_OPTIMISTIC = 1), + (t.OCCLUSION_TYPE_STRICT = 2), + (t.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0), + (t.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1), + (t.CULLINGSTRATEGY_STANDARD = + d.a.MESHES_CULLINGSTRATEGY_STANDARD), + (t.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = + d.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY), + (t.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = + d.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION), + (t.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = + d.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY), t - }(l.a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return l - }); - var n = i(1) - , r = i(0) - , o = i(2) - , a = i(8) - , s = i(23) - , c = i(19) - , u = i(9) - , l = function() { - function e(e, t, i) { - void 0 === t && (t = null), - void 0 === i && (i = true), - this.state = "", - this.metadata = null, - this.reservedDataStore = null, - this.doNotSerialize = false, - this._isDisposed = false, - this.animations = new Array, - this._ranges = {}, - this.onReady = null, - this._isEnabled = true, - this._isParentEnabled = true, - this._isReady = true, - this._currentRenderId = -1, - this._parentUpdateId = -1, - this._childUpdateId = -1, - this._waitingParentId = null, - this._cache = {}, - this._parentNode = null, - this._children = null, - this._worldMatrix = r.j.Identity(), - this._worldMatrixDeterminant = 0, - this._worldMatrixDeterminantIsDirty = true, - this._sceneRootNodesIndex = -1, - this._animationPropertiesOverride = null, - this._isNode = true, - this.onDisposeObservable = new a.c, - this._onDisposeObserver = null, - this._behaviors = new Array, - this.name = e, - this.id = e, - this._scene = t || s.a.LastCreatedScene, - this.uniqueId = this._scene.getUniqueId(), - this._initCache(), - i && this.addToSceneRootNodes() - } - return e.AddNodeConstructor = function(e, t) { - this._NodeConstructors[e] = t - } - , - e.Construct = function(e, t, i, n) { - var r = this._NodeConstructors[e]; - return r ? r(t, i, n) : null - } - , - e.prototype.isDisposed = function() { - return this._isDisposed - } - , + ); + })(l.a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return l; + }); + var n = i(1), + r = i(0), + o = i(2), + a = i(8), + s = i(23), + c = i(19), + u = i(9), + l = (function () { + function e(e, t, i) { + void 0 === t && (t = null), + void 0 === i && (i = true), + (this.state = ""), + (this.metadata = null), + (this.reservedDataStore = null), + (this.doNotSerialize = false), + (this._isDisposed = false), + (this.animations = new Array()), + (this._ranges = {}), + (this.onReady = null), + (this._isEnabled = true), + (this._isParentEnabled = true), + (this._isReady = true), + (this._currentRenderId = -1), + (this._parentUpdateId = -1), + (this._childUpdateId = -1), + (this._waitingParentId = null), + (this._cache = {}), + (this._parentNode = null), + (this._children = null), + (this._worldMatrix = r.j.Identity()), + (this._worldMatrixDeterminant = 0), + (this._worldMatrixDeterminantIsDirty = true), + (this._sceneRootNodesIndex = -1), + (this._animationPropertiesOverride = null), + (this._isNode = true), + (this.onDisposeObservable = new a.c()), + (this._onDisposeObserver = null), + (this._behaviors = new Array()), + (this.name = e), + (this.id = e), + (this._scene = t || s.a.LastCreatedScene), + (this.uniqueId = this._scene.getUniqueId()), + this._initCache(), + i && this.addToSceneRootNodes(); + } + return ( + (e.AddNodeConstructor = function (e, t) { + this._NodeConstructors[e] = t; + }), + (e.Construct = function (e, t, i, n) { + var r = this._NodeConstructors[e]; + return r ? r(t, i, n) : null; + }), + (e.prototype.isDisposed = function () { + return this._isDisposed; + }), Object.defineProperty(e.prototype, "parent", { - get: function() { - return this._parentNode - }, - set: function(e) { - if (this._parentNode !== e) { - var t = this._parentNode; - if (this._parentNode && void 0 !== this._parentNode._children && null !== this._parentNode._children) { - var i = this._parentNode._children.indexOf(this); - -1 !== i && this._parentNode._children.splice(i, 1), - e || this._isDisposed || this.addToSceneRootNodes() - } - this._parentNode = e, - this._parentNode && (void 0 !== this._parentNode._children && null !== this._parentNode._children || (this._parentNode._children = new Array), - this._parentNode._children.push(this), - t || this.removeFromSceneRootNodes()), - this._syncParentEnabledState() - } - }, - enumerable: true, - configurable: true - }), - e.prototype.addToSceneRootNodes = function() { - -1 === this._sceneRootNodesIndex && (this._sceneRootNodesIndex = this._scene.rootNodes.length, - this._scene.rootNodes.push(this)) - } - , - e.prototype.removeFromSceneRootNodes = function() { - if (-1 !== this._sceneRootNodesIndex) { - var e = this._scene.rootNodes - , t = e.length - 1; - e[this._sceneRootNodesIndex] = e[t], - e[this._sceneRootNodesIndex]._sceneRootNodesIndex = this._sceneRootNodesIndex, - this._scene.rootNodes.pop(), - this._sceneRootNodesIndex = -1 + get: function () { + return this._parentNode; + }, + set: function (e) { + if (this._parentNode !== e) { + var t = this._parentNode; + if ( + this._parentNode && + void 0 !== this._parentNode._children && + null !== this._parentNode._children + ) { + var i = this._parentNode._children.indexOf(this); + -1 !== i && this._parentNode._children.splice(i, 1), + e || + this._isDisposed || + this.addToSceneRootNodes(); + } + (this._parentNode = e), + this._parentNode && + ((void 0 !== this._parentNode._children && + null !== this._parentNode._children) || + (this._parentNode._children = new Array()), + this._parentNode._children.push(this), + t || this.removeFromSceneRootNodes()), + this._syncParentEnabledState(); } - } - , - Object.defineProperty(e.prototype, "animationPropertiesOverride", { - get: function() { - return this._animationPropertiesOverride ? this._animationPropertiesOverride : this._scene.animationPropertiesOverride + }, + enumerable: true, + configurable: true, + }), + (e.prototype.addToSceneRootNodes = function () { + -1 === this._sceneRootNodesIndex && + ((this._sceneRootNodesIndex = + this._scene.rootNodes.length), + this._scene.rootNodes.push(this)); + }), + (e.prototype.removeFromSceneRootNodes = function () { + if (-1 !== this._sceneRootNodesIndex) { + var e = this._scene.rootNodes, + t = e.length - 1; + (e[this._sceneRootNodesIndex] = e[t]), + (e[this._sceneRootNodesIndex]._sceneRootNodesIndex = + this._sceneRootNodesIndex), + this._scene.rootNodes.pop(), + (this._sceneRootNodesIndex = -1); + } + }), + Object.defineProperty( + e.prototype, + "animationPropertiesOverride", + { + get: function () { + return this._animationPropertiesOverride + ? this._animationPropertiesOverride + : this._scene.animationPropertiesOverride; }, - set: function(e) { - this._animationPropertiesOverride = e + set: function (e) { + this._animationPropertiesOverride = e; }, enumerable: true, - configurable: true + configurable: true, + } + ), + (e.prototype.getClassName = function () { + return "Node"; }), - e.prototype.getClassName = function() { - return "Node" - } - , Object.defineProperty(e.prototype, "onDispose", { - set: function(e) { - this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), - this._onDisposeObserver = this.onDisposeObservable.add(e) - }, - enumerable: true, - configurable: true + set: function (e) { + this._onDisposeObserver && + this.onDisposeObservable.remove( + this._onDisposeObserver + ), + (this._onDisposeObserver = + this.onDisposeObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getScene = function () { + return this._scene; + }), + (e.prototype.getEngine = function () { + return this._scene.getEngine(); + }), + (e.prototype.addBehavior = function (e, t) { + var i = this; + return ( + void 0 === t && (t = false), + -1 !== this._behaviors.indexOf(e) + ? this + : (e.init(), + this._scene.isLoading && !t + ? this._scene.onDataLoadedObservable.addOnce( + function () { + e.attach(i); + } + ) + : e.attach(this), + this._behaviors.push(e), + this) + ); + }), + (e.prototype.removeBehavior = function (e) { + var t = this._behaviors.indexOf(e); + return -1 === t + ? this + : (this._behaviors[t].detach(), + this._behaviors.splice(t, 1), + this); }), - e.prototype.getScene = function() { - return this._scene - } - , - e.prototype.getEngine = function() { - return this._scene.getEngine() - } - , - e.prototype.addBehavior = function(e, t) { - var i = this; - return void 0 === t && (t = false), - -1 !== this._behaviors.indexOf(e) ? this : (e.init(), - this._scene.isLoading && !t ? this._scene.onDataLoadedObservable.addOnce(function() { - e.attach(i) - }) : e.attach(this), - this._behaviors.push(e), - this) - } - , - e.prototype.removeBehavior = function(e) { - var t = this._behaviors.indexOf(e); - return -1 === t ? this : (this._behaviors[t].detach(), - this._behaviors.splice(t, 1), - this) - } - , Object.defineProperty(e.prototype, "behaviors", { - get: function() { - return this._behaviors - }, - enumerable: true, - configurable: true + get: function () { + return this._behaviors; + }, + enumerable: true, + configurable: true, }), - e.prototype.getBehaviorByName = function(e) { - for (var t = 0, i = this._behaviors; t < i.length; t++) { - var n = i[t]; - if (n.name === e) - return n - } - return null - } - , - e.prototype.getWorldMatrix = function() { - return this._currentRenderId !== this._scene.getRenderId() && this.computeWorldMatrix(), + (e.prototype.getBehaviorByName = function (e) { + for (var t = 0, i = this._behaviors; t < i.length; t++) { + var n = i[t]; + if (n.name === e) return n; + } + return null; + }), + (e.prototype.getWorldMatrix = function () { + return ( + this._currentRenderId !== this._scene.getRenderId() && + this.computeWorldMatrix(), this._worldMatrix - } - , - e.prototype._getWorldMatrixDeterminant = function() { - return this._worldMatrixDeterminantIsDirty && (this._worldMatrixDeterminantIsDirty = false, - this._worldMatrixDeterminant = this._worldMatrix.determinant()), - this._worldMatrixDeterminant - } - , - Object.defineProperty(e.prototype, "worldMatrixFromCache", { - get: function() { - return this._worldMatrix - }, - enumerable: true, - configurable: true + ); }), - e.prototype._initCache = function() { - this._cache = {}, - this._cache.parent = void 0 - } - , - e.prototype.updateCache = function(e) { - !e && this.isSynchronized() || (this._cache.parent = this.parent, - this._updateCache()) - } - , - e.prototype._getActionManagerForTrigger = function(e, t) { - return void 0 === t && (t = true), - this.parent ? this.parent._getActionManagerForTrigger(e, false) : null - } - , - e.prototype._updateCache = function(e) {} - , - e.prototype._isSynchronized = function() { - return true - } - , - e.prototype._markSyncedWithParent = function() { - this._parentNode && (this._parentUpdateId = this._parentNode._childUpdateId) - } - , - e.prototype.isSynchronizedWithParent = function() { - return !this._parentNode || this._parentUpdateId === this._parentNode._childUpdateId && this._parentNode.isSynchronized() - } - , - e.prototype.isSynchronized = function() { - return this._cache.parent != this._parentNode ? (this._cache.parent = this._parentNode, - false) : !(this._parentNode && !this.isSynchronizedWithParent()) && this._isSynchronized() - } - , - e.prototype.isReady = function(e) { - return void 0 === e && (e = false), - this._isReady - } - , - e.prototype.isEnabled = function(e) { - return void 0 === e && (e = true), - false === e ? this._isEnabled : !!this._isEnabled && this._isParentEnabled - } - , - e.prototype._syncParentEnabledState = function() { - this._isParentEnabled = !this._parentNode || this._parentNode.isEnabled(), - this._children && this._children.forEach(function(e) { - e._syncParentEnabledState() - }) - } - , - e.prototype.setEnabled = function(e) { - this._isEnabled = e, - this._syncParentEnabledState() - } - , - e.prototype.isDescendantOf = function(e) { - return !!this.parent && (this.parent === e || this.parent.isDescendantOf(e)) - } - , - e.prototype._getDescendants = function(e, t, i) { - if (void 0 === t && (t = false), - this._children) - for (var n = 0; n < this._children.length; n++) { - var r = this._children[n]; - i && !i(r) || e.push(r), - t || r._getDescendants(e, false, i) - } - } - , - e.prototype.getDescendants = function(e, t) { - var i = new Array; - return this._getDescendants(i, e, t), - i - } - , - e.prototype.getChildMeshes = function(e, t) { - var i = []; - return this._getDescendants(i, e, function(e) { - return (!t || t(e)) && void 0 !== e.cullingStrategy + (e.prototype._getWorldMatrixDeterminant = function () { + return ( + this._worldMatrixDeterminantIsDirty && + ((this._worldMatrixDeterminantIsDirty = false), + (this._worldMatrixDeterminant = + this._worldMatrix.determinant())), + this._worldMatrixDeterminant + ); + }), + Object.defineProperty(e.prototype, "worldMatrixFromCache", { + get: function () { + return this._worldMatrix; + }, + enumerable: true, + configurable: true, + }), + (e.prototype._initCache = function () { + (this._cache = {}), (this._cache.parent = void 0); + }), + (e.prototype.updateCache = function (e) { + (!e && this.isSynchronized()) || + ((this._cache.parent = this.parent), + this._updateCache()); + }), + (e.prototype._getActionManagerForTrigger = function (e, t) { + return ( + void 0 === t && (t = true), + this.parent + ? this.parent._getActionManagerForTrigger(e, false) + : null + ); + }), + (e.prototype._updateCache = function (e) {}), + (e.prototype._isSynchronized = function () { + return true; + }), + (e.prototype._markSyncedWithParent = function () { + this._parentNode && + (this._parentUpdateId = + this._parentNode._childUpdateId); + }), + (e.prototype.isSynchronizedWithParent = function () { + return ( + !this._parentNode || + (this._parentUpdateId === + this._parentNode._childUpdateId && + this._parentNode.isSynchronized()) + ); + }), + (e.prototype.isSynchronized = function () { + return this._cache.parent != this._parentNode + ? ((this._cache.parent = this._parentNode), false) + : !( + this._parentNode && !this.isSynchronizedWithParent() + ) && this._isSynchronized(); + }), + (e.prototype.isReady = function (e) { + return void 0 === e && (e = false), this._isReady; + }), + (e.prototype.isEnabled = function (e) { + return ( + void 0 === e && (e = true), + false === e + ? this._isEnabled + : !!this._isEnabled && this._isParentEnabled + ); + }), + (e.prototype._syncParentEnabledState = function () { + (this._isParentEnabled = + !this._parentNode || this._parentNode.isEnabled()), + this._children && + this._children.forEach(function (e) { + e._syncParentEnabledState(); + }); + }), + (e.prototype.setEnabled = function (e) { + (this._isEnabled = e), this._syncParentEnabledState(); + }), + (e.prototype.isDescendantOf = function (e) { + return ( + !!this.parent && + (this.parent === e || this.parent.isDescendantOf(e)) + ); + }), + (e.prototype._getDescendants = function (e, t, i) { + if ((void 0 === t && (t = false), this._children)) + for (var n = 0; n < this._children.length; n++) { + var r = this._children[n]; + (i && !i(r)) || e.push(r), + t || r._getDescendants(e, false, i); + } + }), + (e.prototype.getDescendants = function (e, t) { + var i = new Array(); + return this._getDescendants(i, e, t), i; + }), + (e.prototype.getChildMeshes = function (e, t) { + var i = []; + return ( + this._getDescendants(i, e, function (e) { + return (!t || t(e)) && void 0 !== e.cullingStrategy; }), i - } - , - e.prototype.getChildren = function(e, t) { - return void 0 === t && (t = true), - this.getDescendants(t, e) - } - , - e.prototype._setReady = function(e) { - e !== this._isReady && (e ? (this.onReady && this.onReady(this), - this._isReady = true) : this._isReady = false) - } - , - e.prototype.getAnimationByName = function(e) { - for (var t = 0; t < this.animations.length; t++) { - var i = this.animations[t]; - if (i.name === e) - return i + ); + }), + (e.prototype.getChildren = function (e, t) { + return ( + void 0 === t && (t = true), this.getDescendants(t, e) + ); + }), + (e.prototype._setReady = function (e) { + e !== this._isReady && + (e + ? (this.onReady && this.onReady(this), + (this._isReady = true)) + : (this._isReady = false)); + }), + (e.prototype.getAnimationByName = function (e) { + for (var t = 0; t < this.animations.length; t++) { + var i = this.animations[t]; + if (i.name === e) return i; + } + return null; + }), + (e.prototype.createAnimationRange = function (t, i, n) { + if (!this._ranges[t]) { + this._ranges[t] = e._AnimationRangeFactory(t, i, n); + for (var r = 0, o = this.animations.length; r < o; r++) + this.animations[r] && + this.animations[r].createRange(t, i, n); + } + }), + (e.prototype.deleteAnimationRange = function (e, t) { + void 0 === t && (t = true); + for (var i = 0, n = this.animations.length; i < n; i++) + this.animations[i] && + this.animations[i].deleteRange(e, t); + this._ranges[e] = null; + }), + (e.prototype.getAnimationRange = function (e) { + return this._ranges[e]; + }), + (e.prototype.getAnimationRanges = function () { + var e, + t = []; + for (e in this._ranges) t.push(this._ranges[e]); + return t; + }), + (e.prototype.beginAnimation = function (e, t, i, n) { + var r = this.getAnimationRange(e); + return r + ? this._scene.beginAnimation( + this, + r.from, + r.to, + t, + i, + n + ) + : null; + }), + (e.prototype.serializeAnimationRanges = function () { + var e = []; + for (var t in this._ranges) { + var i = this._ranges[t]; + if (i) { + var n = {}; + (n.name = t), + (n.from = i.from), + (n.to = i.to), + e.push(n); } - return null - } - , - e.prototype.createAnimationRange = function(t, i, n) { - if (!this._ranges[t]) { - this._ranges[t] = e._AnimationRangeFactory(t, i, n); - for (var r = 0, o = this.animations.length; r < o; r++) - this.animations[r] && this.animations[r].createRange(t, i, n) - } - } - , - e.prototype.deleteAnimationRange = function(e, t) { - void 0 === t && (t = true); - for (var i = 0, n = this.animations.length; i < n; i++) - this.animations[i] && this.animations[i].deleteRange(e, t); - this._ranges[e] = null - } - , - e.prototype.getAnimationRange = function(e) { - return this._ranges[e] - } - , - e.prototype.getAnimationRanges = function() { - var e, t = []; - for (e in this._ranges) - t.push(this._ranges[e]); - return t - } - , - e.prototype.beginAnimation = function(e, t, i, n) { - var r = this.getAnimationRange(e); - return r ? this._scene.beginAnimation(this, r.from, r.to, t, i, n) : null - } - , - e.prototype.serializeAnimationRanges = function() { - var e = []; - for (var t in this._ranges) { - var i = this._ranges[t]; - if (i) { - var n = {}; - n.name = t, - n.from = i.from, - n.to = i.to, - e.push(n) - } - } - return e - } - , - e.prototype.computeWorldMatrix = function(e) { - return this._worldMatrix || (this._worldMatrix = r.j.Identity()), + } + return e; + }), + (e.prototype.computeWorldMatrix = function (e) { + return ( + this._worldMatrix || + (this._worldMatrix = r.j.Identity()), this._worldMatrix - } - , - e.prototype.dispose = function(e, t) { - if (void 0 === t && (t = false), - this._isDisposed = true, + ); + }), + (e.prototype.dispose = function (e, t) { + if ( + (void 0 === t && (t = false), + (this._isDisposed = true), !e) - for (var i = 0, n = this.getDescendants(true); i < n.length; i++) - n[i].dispose(e, t); - this.parent ? this.parent = null : this.removeFromSceneRootNodes(), + ) + for ( + var i = 0, n = this.getDescendants(true); + i < n.length; + i++ + ) + n[i].dispose(e, t); + this.parent + ? (this.parent = null) + : this.removeFromSceneRootNodes(), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(); - for (var r = 0, o = this._behaviors; r < o.length; r++) - o[r].detach(); - this._behaviors = [] - } - , - e.ParseAnimationRanges = function(e, t, i) { - if (t.ranges) - for (var n = 0; n < t.ranges.length; n++) { - var r = t.ranges[n]; - e.createAnimationRange(r.name, r.from, r.to) - } - } - , - e.prototype.getHierarchyBoundingVectors = function(e, t) { - var i, n; - if (void 0 === e && (e = true), + for (var r = 0, o = this._behaviors; r < o.length; r++) + o[r].detach(); + this._behaviors = []; + }), + (e.ParseAnimationRanges = function (e, t, i) { + if (t.ranges) + for (var n = 0; n < t.ranges.length; n++) { + var r = t.ranges[n]; + e.createAnimationRange(r.name, r.from, r.to); + } + }), + (e.prototype.getHierarchyBoundingVectors = function (e, t) { + var i, n; + if ( + (void 0 === e && (e = true), void 0 === t && (t = null), this.getScene().incrementRenderId(), this.computeWorldMatrix(true), - this.getBoundingInfo && this.subMeshes) { - var o = this.getBoundingInfo(); - i = o.boundingBox.minimumWorld, - n = o.boundingBox.maximumWorld - } else - i = new r.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), - n = new r.x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE); - if (e) - for (var a = 0, s = this.getDescendants(false); a < s.length; a++) { - var c = s[a]; - if (c.computeWorldMatrix(true), - (!t || t(c)) && c.getBoundingInfo && 0 !== c.getTotalVertices()) { - var l = c.getBoundingInfo().boundingBox - , h = l.minimumWorld - , f = l.maximumWorld; - u.h.CheckExtends(h, i, n), - u.h.CheckExtends(f, i, n) - } - } - return { - min: i, - max: n + this.getBoundingInfo && this.subMeshes) + ) { + var o = this.getBoundingInfo(); + (i = o.boundingBox.minimumWorld), + (n = o.boundingBox.maximumWorld); + } else + (i = new r.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )), + (n = new r.x( + -Number.MAX_VALUE, + -Number.MAX_VALUE, + -Number.MAX_VALUE + )); + if (e) + for ( + var a = 0, s = this.getDescendants(false); + a < s.length; + a++ + ) { + var c = s[a]; + if ( + (c.computeWorldMatrix(true), + (!t || t(c)) && + c.getBoundingInfo && + 0 !== c.getTotalVertices()) + ) { + var l = c.getBoundingInfo().boundingBox, + h = l.minimumWorld, + f = l.maximumWorld; + u.h.CheckExtends(h, i, n), + u.h.CheckExtends(f, i, n); + } } - } - , - e._AnimationRangeFactory = function(e, t, i) { - throw c.a.WarnImport("AnimationRange") - } - , - e._NodeConstructors = {}, + return { + min: i, + max: n, + }; + }), + (e._AnimationRangeFactory = function (e, t, i) { + throw c.a.WarnImport("AnimationRange"); + }), + (e._NodeConstructors = {}), n.c([Object(o.c)()], e.prototype, "name", void 0), n.c([Object(o.c)()], e.prototype, "id", void 0), n.c([Object(o.c)()], e.prototype, "uniqueId", void 0), n.c([Object(o.c)()], e.prototype, "state", void 0), n.c([Object(o.c)()], e.prototype, "metadata", void 0), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return s - }); - var n = i(8) - , r = i(92) - , o = i(3) - , a = i(19) - , s = function() { - function e(t, i, r) { - void 0 === r && (r = false), - this.isReady = false, - this.isCube = false, - this.is3D = false, - this.isMultiview = false, - this.url = "", - this.samplingMode = -1, - this.generateMipMaps = false, - this.samples = 0, - this.type = -1, - this.format = -1, - this.onLoadedObservable = new n.c, - this.width = 0, - this.height = 0, - this.depth = 0, - this.baseWidth = 0, - this.baseHeight = 0, - this.baseDepth = 0, - this.invertY = false, - this._invertVScale = false, - this._associatedChannel = -1, - this._dataSource = e.DATASOURCE_UNKNOWN, - this._buffer = null, - this._bufferView = null, - this._bufferViewArray = null, - this._bufferViewArrayArray = null, - this._size = 0, - this._extension = "", - this._files = null, - this._workingCanvas = null, - this._workingContext = null, - this._framebuffer = null, - this._depthStencilBuffer = null, - this._MSAAFramebuffer = null, - this._MSAARenderBuffer = null, - this._attachments = null, - this._cachedCoordinatesMode = null, - this._cachedWrapU = null, - this._cachedWrapV = null, - this._cachedWrapR = null, - this._cachedAnisotropicFilteringLevel = null, - this._isDisabled = false, - this._compression = null, - this._generateStencilBuffer = false, - this._generateDepthBuffer = false, - this._comparisonFunction = 0, - this._sphericalPolynomial = null, - this._lodGenerationScale = 0, - this._lodGenerationOffset = 0, - this._colorTextureArray = null, - this._depthStencilTextureArray = null, - this._lodTextureHigh = null, - this._lodTextureMid = null, - this._lodTextureLow = null, - this._isRGBD = false, - this._webGLTexture = null, - this._references = 1, - this._engine = t, - this._dataSource = i, - r || (this._webGLTexture = t._createTexture()) - } - return e.prototype.getEngine = function() { - return this._engine - } - , + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return s; + }); + var n = i(8), + r = i(92), + o = i(3), + a = i(19), + s = (function () { + function e(t, i, r) { + void 0 === r && (r = false), + (this.isReady = false), + (this.isCube = false), + (this.is3D = false), + (this.isMultiview = false), + (this.url = ""), + (this.samplingMode = -1), + (this.generateMipMaps = false), + (this.samples = 0), + (this.type = -1), + (this.format = -1), + (this.onLoadedObservable = new n.c()), + (this.width = 0), + (this.height = 0), + (this.depth = 0), + (this.baseWidth = 0), + (this.baseHeight = 0), + (this.baseDepth = 0), + (this.invertY = false), + (this._invertVScale = false), + (this._associatedChannel = -1), + (this._dataSource = e.DATASOURCE_UNKNOWN), + (this._buffer = null), + (this._bufferView = null), + (this._bufferViewArray = null), + (this._bufferViewArrayArray = null), + (this._size = 0), + (this._extension = ""), + (this._files = null), + (this._workingCanvas = null), + (this._workingContext = null), + (this._framebuffer = null), + (this._depthStencilBuffer = null), + (this._MSAAFramebuffer = null), + (this._MSAARenderBuffer = null), + (this._attachments = null), + (this._cachedCoordinatesMode = null), + (this._cachedWrapU = null), + (this._cachedWrapV = null), + (this._cachedWrapR = null), + (this._cachedAnisotropicFilteringLevel = null), + (this._isDisabled = false), + (this._compression = null), + (this._generateStencilBuffer = false), + (this._generateDepthBuffer = false), + (this._comparisonFunction = 0), + (this._sphericalPolynomial = null), + (this._lodGenerationScale = 0), + (this._lodGenerationOffset = 0), + (this._colorTextureArray = null), + (this._depthStencilTextureArray = null), + (this._lodTextureHigh = null), + (this._lodTextureMid = null), + (this._lodTextureLow = null), + (this._isRGBD = false), + (this._webGLTexture = null), + (this._references = 1), + (this._engine = t), + (this._dataSource = i), + r || (this._webGLTexture = t._createTexture()); + } + return ( + (e.prototype.getEngine = function () { + return this._engine; + }), Object.defineProperty(e.prototype, "dataSource", { - get: function() { - return this._dataSource - }, - enumerable: true, - configurable: true + get: function () { + return this._dataSource; + }, + enumerable: true, + configurable: true, }), - e.prototype.incrementReferences = function() { - this._references++ - } - , - e.prototype.updateSize = function(e, t, i) { - void 0 === i && (i = 1), - this.width = e, - this.height = t, - this.depth = i, - this.baseWidth = e, - this.baseHeight = t, - this.baseDepth = i, - this._size = e * t * i - } - , - e.prototype._rebuild = function() { - var t, i = this; - switch (this.isReady = false, - this._cachedCoordinatesMode = null, - this._cachedWrapU = null, - this._cachedWrapV = null, - this._cachedAnisotropicFilteringLevel = null, - this._dataSource) { + (e.prototype.incrementReferences = function () { + this._references++; + }), + (e.prototype.updateSize = function (e, t, i) { + void 0 === i && (i = 1), + (this.width = e), + (this.height = t), + (this.depth = i), + (this.baseWidth = e), + (this.baseHeight = t), + (this.baseDepth = i), + (this._size = e * t * i); + }), + (e.prototype._rebuild = function () { + var t, + i = this; + switch ( + ((this.isReady = false), + (this._cachedCoordinatesMode = null), + (this._cachedWrapU = null), + (this._cachedWrapV = null), + (this._cachedAnisotropicFilteringLevel = null), + this._dataSource) + ) { case e.DATASOURCE_TEMP: - return; + return; case e.DATASOURCE_URL: - return void (t = this._engine.createTexture(this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, function() { - t._swapAndDie(i), - i.isReady = true - }, null, this._buffer, void 0, this.format)); + return void (t = this._engine.createTexture( + this.url, + !this.generateMipMaps, + this.invertY, + null, + this.samplingMode, + function () { + t._swapAndDie(i), (i.isReady = true); + }, + null, + this._buffer, + void 0, + this.format + )); case e.DATASOURCE_RAW: - return (t = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression))._swapAndDie(this), - void (this.isReady = true); + return ( + (t = this._engine.createRawTexture( + this._bufferView, + this.baseWidth, + this.baseHeight, + this.format, + this.generateMipMaps, + this.invertY, + this.samplingMode, + this._compression + ))._swapAndDie(this), + void (this.isReady = true) + ); case e.DATASOURCE_RAW3D: - return (t = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression))._swapAndDie(this), - void (this.isReady = true); + return ( + (t = this._engine.createRawTexture3D( + this._bufferView, + this.baseWidth, + this.baseHeight, + this.baseDepth, + this.format, + this.generateMipMaps, + this.invertY, + this.samplingMode, + this._compression + ))._swapAndDie(this), + void (this.isReady = true) + ); case e.DATASOURCE_DYNAMIC: - return (t = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode))._swapAndDie(this), - void this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas(), this.invertY, void 0, void 0, true); + return ( + (t = this._engine.createDynamicTexture( + this.baseWidth, + this.baseHeight, + this.generateMipMaps, + this.samplingMode + ))._swapAndDie(this), + void this._engine.updateDynamicTexture( + this, + this._engine.getRenderingCanvas(), + this.invertY, + void 0, + void 0, + true + ) + ); case e.DATASOURCE_RENDERTARGET: - var n = new r.a; - if (n.generateDepthBuffer = this._generateDepthBuffer, - n.generateMipMaps = this.generateMipMaps, - n.generateStencilBuffer = this._generateStencilBuffer, - n.samplingMode = this.samplingMode, - n.type = this.type, + var n = new r.a(); + if ( + ((n.generateDepthBuffer = + this._generateDepthBuffer), + (n.generateMipMaps = this.generateMipMaps), + (n.generateStencilBuffer = + this._generateStencilBuffer), + (n.samplingMode = this.samplingMode), + (n.type = this.type), this.isCube) - t = this._engine.createRenderTargetCubeTexture(this.width, n); - else { - var a = { - width: this.width, - height: this.height - }; - t = this._engine.createRenderTargetTexture(a, n) - } - return t._swapAndDie(this), - void (this.isReady = true); - case e.DATASOURCE_DEPTHTEXTURE: - var s = { - bilinearFiltering: this.samplingMode !== o.a.TEXTURE_BILINEAR_SAMPLINGMODE, - comparisonFunction: this._comparisonFunction, - generateStencil: this._generateStencilBuffer, - isCube: this.isCube + ) + t = this._engine.createRenderTargetCubeTexture( + this.width, + n + ); + else { + var a = { + width: this.width, + height: this.height, }; - return (t = this._engine.createDepthStencilTexture({ + t = this._engine.createRenderTargetTexture(a, n); + } + return ( + t._swapAndDie(this), void (this.isReady = true) + ); + case e.DATASOURCE_DEPTHTEXTURE: + var s = { + bilinearFiltering: + this.samplingMode !== + o.a.TEXTURE_BILINEAR_SAMPLINGMODE, + comparisonFunction: this._comparisonFunction, + generateStencil: this._generateStencilBuffer, + isCube: this.isCube, + }; + return ( + (t = this._engine.createDepthStencilTexture( + { width: this.width, - height: this.height - }, s))._swapAndDie(this), - void (this.isReady = true); + height: this.height, + }, + s + ))._swapAndDie(this), + void (this.isReady = true) + ); case e.DATASOURCE_CUBE: - return void (t = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function() { - t._swapAndDie(i), - i.isReady = true - }, null, this.format, this._extension)); + return void (t = this._engine.createCubeTexture( + this.url, + null, + this._files, + !this.generateMipMaps, + function () { + t._swapAndDie(i), (i.isReady = true); + }, + null, + this.format, + this._extension + )); case e.DATASOURCE_CUBERAW: - return (t = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression))._swapAndDie(this), - void (this.isReady = true); + return ( + (t = this._engine.createRawCubeTexture( + this._bufferViewArray, + this.width, + this.format, + this.type, + this.generateMipMaps, + this.invertY, + this.samplingMode, + this._compression + ))._swapAndDie(this), + void (this.isReady = true) + ); case e.DATASOURCE_CUBERAW_RGBD: - return t = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression), - void e._UpdateRGBDAsync(t, this._bufferViewArrayArray, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(function() { - t._swapAndDie(i), - i.isReady = true - }); + return ( + (t = this._engine.createRawCubeTexture( + null, + this.width, + this.format, + this.type, + this.generateMipMaps, + this.invertY, + this.samplingMode, + this._compression + )), + void e + ._UpdateRGBDAsync( + t, + this._bufferViewArrayArray, + this._sphericalPolynomial, + this._lodGenerationScale, + this._lodGenerationOffset + ) + .then(function () { + t._swapAndDie(i), (i.isReady = true); + }) + ); case e.DATASOURCE_CUBEPREFILTERED: - return void ((t = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function(e) { - e && e._swapAndDie(i), - i.isReady = true - }, null, this.format, this._extension))._sphericalPolynomial = this._sphericalPolynomial) - } - } - , - e.prototype._swapAndDie = function(e) { - e._webGLTexture = this._webGLTexture, - e._isRGBD = this._isRGBD, - this._framebuffer && (e._framebuffer = this._framebuffer), - this._depthStencilBuffer && (e._depthStencilBuffer = this._depthStencilBuffer), - this._lodTextureHigh && (e._lodTextureHigh && e._lodTextureHigh.dispose(), - e._lodTextureHigh = this._lodTextureHigh), - this._lodTextureMid && (e._lodTextureMid && e._lodTextureMid.dispose(), - e._lodTextureMid = this._lodTextureMid), - this._lodTextureLow && (e._lodTextureLow && e._lodTextureLow.dispose(), - e._lodTextureLow = this._lodTextureLow); - var t = this._engine.getLoadedTexturesCache() - , i = t.indexOf(this); - -1 !== i && t.splice(i, 1) - } - , - e.prototype.dispose = function() { - this._webGLTexture && (this._references--, - 0 === this._references && (this._engine._releaseTexture(this), - this._webGLTexture = null)) - } - , - e._UpdateRGBDAsync = function(e, t, i, n, r) { - throw a.a.WarnImport("environmentTextureTools") - } - , - e.DATASOURCE_UNKNOWN = 0, - e.DATASOURCE_URL = 1, - e.DATASOURCE_TEMP = 2, - e.DATASOURCE_RAW = 3, - e.DATASOURCE_DYNAMIC = 4, - e.DATASOURCE_RENDERTARGET = 5, - e.DATASOURCE_MULTIRENDERTARGET = 6, - e.DATASOURCE_CUBE = 7, - e.DATASOURCE_CUBERAW = 8, - e.DATASOURCE_CUBEPREFILTERED = 9, - e.DATASOURCE_RAW3D = 10, - e.DATASOURCE_DEPTHTEXTURE = 11, - e.DATASOURCE_CUBERAW_RGBD = 12, + return void ((t = + this._engine.createPrefilteredCubeTexture( + this.url, + null, + this._lodGenerationScale, + this._lodGenerationOffset, + function (e) { + e && e._swapAndDie(i), (i.isReady = true); + }, + null, + this.format, + this._extension + ))._sphericalPolynomial = + this._sphericalPolynomial); + } + }), + (e.prototype._swapAndDie = function (e) { + (e._webGLTexture = this._webGLTexture), + (e._isRGBD = this._isRGBD), + this._framebuffer && + (e._framebuffer = this._framebuffer), + this._depthStencilBuffer && + (e._depthStencilBuffer = this._depthStencilBuffer), + this._lodTextureHigh && + (e._lodTextureHigh && e._lodTextureHigh.dispose(), + (e._lodTextureHigh = this._lodTextureHigh)), + this._lodTextureMid && + (e._lodTextureMid && e._lodTextureMid.dispose(), + (e._lodTextureMid = this._lodTextureMid)), + this._lodTextureLow && + (e._lodTextureLow && e._lodTextureLow.dispose(), + (e._lodTextureLow = this._lodTextureLow)); + var t = this._engine.getLoadedTexturesCache(), + i = t.indexOf(this); + -1 !== i && t.splice(i, 1); + }), + (e.prototype.dispose = function () { + this._webGLTexture && + (this._references--, + 0 === this._references && + (this._engine._releaseTexture(this), + (this._webGLTexture = null))); + }), + (e._UpdateRGBDAsync = function (e, t, i, n, r) { + throw a.a.WarnImport("environmentTextureTools"); + }), + (e.DATASOURCE_UNKNOWN = 0), + (e.DATASOURCE_URL = 1), + (e.DATASOURCE_TEMP = 2), + (e.DATASOURCE_RAW = 3), + (e.DATASOURCE_DYNAMIC = 4), + (e.DATASOURCE_RENDERTARGET = 5), + (e.DATASOURCE_MULTIRENDERTARGET = 6), + (e.DATASOURCE_CUBE = 7), + (e.DATASOURCE_CUBERAW = 8), + (e.DATASOURCE_CUBEPREFILTERED = 9), + (e.DATASOURCE_RAW3D = 10), + (e.DATASOURCE_DEPTHTEXTURE = 11), + (e.DATASOURCE_CUBERAW_RGBD = 12), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return u - }); - var n = i(6) - , r = i(34) - , o = i(0) - , a = i(24) - , s = i(11) - , c = i(37); - s.a._PhysicsImpostorParser = function(e, t, i) { - return new u(t,i.physicsImpostor,{ - mass: i.physicsMass, - friction: i.physicsFriction, - restitution: i.physicsRestitution - },e) + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return u; + }); + var n = i(6), + r = i(34), + o = i(0), + a = i(24), + s = i(11), + c = i(37); + s.a._PhysicsImpostorParser = function (e, t, i) { + return new u( + t, + i.physicsImpostor, + { + mass: i.physicsMass, + friction: i.physicsFriction, + restitution: i.physicsRestitution, + }, + e + ); + }; + var u = (function () { + function e(e, t, i, r) { + var a = this; + void 0 === i && + (i = { + mass: 0, + }), + (this.object = e), + (this.type = t), + (this._options = i), + (this._scene = r), + (this._pluginData = {}), + (this._bodyUpdateRequired = false), + (this._onBeforePhysicsStepCallbacks = new Array()), + (this._onAfterPhysicsStepCallbacks = new Array()), + (this._onPhysicsCollideCallbacks = []), + (this._deltaPosition = o.x.Zero()), + (this._isDisposed = false), + (this.soft = false), + (this.segments = 0), + (this._tmpQuat = new o.q()), + (this._tmpQuat2 = new o.q()), + (this.beforeStep = function () { + a._physicsEngine && + (a.object.translate(a._deltaPosition, -1), + a._deltaRotationConjugated && + a.object.rotationQuaternion && + a.object.rotationQuaternion.multiplyToRef( + a._deltaRotationConjugated, + a.object.rotationQuaternion + ), + a.object.computeWorldMatrix(false), + a.object.parent && a.object.rotationQuaternion + ? (a.getParentsRotation(), + a._tmpQuat.multiplyToRef( + a.object.rotationQuaternion, + a._tmpQuat + )) + : a._tmpQuat.copyFrom( + a.object.rotationQuaternion || new o.q() + ), + a._options.disableBidirectionalTransformation || + (a.object.rotationQuaternion && + a._physicsEngine + .getPhysicsPlugin() + .setPhysicsBodyTransformation( + a, + a.object.getAbsolutePosition(), + a._tmpQuat + )), + a._onBeforePhysicsStepCallbacks.forEach(function (e) { + e(a); + })); + }), + (this.afterStep = function () { + a._physicsEngine && + (a._onAfterPhysicsStepCallbacks.forEach(function (e) { + e(a); + }), + a._physicsEngine + .getPhysicsPlugin() + .setTransformationFromPhysicsBody(a), + a.object.parent && + a.object.rotationQuaternion && + (a.getParentsRotation(), + a._tmpQuat.conjugateInPlace(), + a._tmpQuat.multiplyToRef( + a.object.rotationQuaternion, + a.object.rotationQuaternion + )), + a.object.setAbsolutePosition(a.object.position), + a._deltaRotation && + a.object.rotationQuaternion && + a.object.rotationQuaternion.multiplyToRef( + a._deltaRotation, + a.object.rotationQuaternion + ), + a.object.translate(a._deltaPosition, 1)); + }), + (this.onCollideEvent = null), + (this.onCollide = function (e) { + if ( + (a._onPhysicsCollideCallbacks.length || + a.onCollideEvent) && + a._physicsEngine + ) { + var t = a._physicsEngine.getImpostorWithPhysicsBody( + e.body + ); + t && + (a.onCollideEvent && a.onCollideEvent(a, t), + a._onPhysicsCollideCallbacks + .filter(function (e) { + return -1 !== e.otherImpostors.indexOf(t); + }) + .forEach(function (e) { + e.callback(a, t); + })); + } + }), + this.object + ? (!this._scene && + e.getScene && + (this._scene = e.getScene()), + this._scene && + (this.type > 100 && (this.soft = true), + (this._physicsEngine = + this._scene.getPhysicsEngine()), + this._physicsEngine + ? (this.object.rotationQuaternion || + (this.object.rotation + ? (this.object.rotationQuaternion = + o.q.RotationYawPitchRoll( + this.object.rotation.y, + this.object.rotation.x, + this.object.rotation.z + )) + : (this.object.rotationQuaternion = + new o.q())), + (this._options.mass = + void 0 === i.mass ? 0 : i.mass), + (this._options.friction = + void 0 === i.friction ? 0.2 : i.friction), + (this._options.restitution = + void 0 === i.restitution ? 0.2 : i.restitution), + this.soft && + ((this._options.mass = + this._options.mass > 0 + ? this._options.mass + : 1), + (this._options.pressure = + void 0 === i.pressure ? 200 : i.pressure), + (this._options.stiffness = + void 0 === i.stiffness ? 1 : i.stiffness), + (this._options.velocityIterations = + void 0 === i.velocityIterations + ? 20 + : i.velocityIterations), + (this._options.positionIterations = + void 0 === i.positionIterations + ? 20 + : i.positionIterations), + (this._options.fixedPoints = + void 0 === i.fixedPoints ? 0 : i.fixedPoints), + (this._options.margin = + void 0 === i.margin ? 0 : i.margin), + (this._options.damping = + void 0 === i.damping ? 0 : i.damping), + (this._options.path = + void 0 === i.path ? null : i.path), + (this._options.shape = + void 0 === i.shape ? null : i.shape)), + (this._joints = []), + !this.object.parent || this._options.ignoreParent + ? this._init() + : this.object.parent.physicsImpostor && + n.a.Warn( + "You must affect impostors to children before affecting impostor to parent." + )) + : n.a.Error( + "Physics not enabled. Please use scene.enablePhysics(...) before creating impostors." + ))) + : n.a.Error( + "No object was provided. A physics object is obligatory" + ); } - ; - var u = function() { - function e(e, t, i, r) { - var a = this; - void 0 === i && (i = { - mass: 0 - }), - this.object = e, - this.type = t, - this._options = i, - this._scene = r, - this._pluginData = {}, - this._bodyUpdateRequired = false, - this._onBeforePhysicsStepCallbacks = new Array, - this._onAfterPhysicsStepCallbacks = new Array, - this._onPhysicsCollideCallbacks = [], - this._deltaPosition = o.x.Zero(), - this._isDisposed = false, - this.soft = false, - this.segments = 0, - this._tmpQuat = new o.q, - this._tmpQuat2 = new o.q, - this.beforeStep = function() { - a._physicsEngine && (a.object.translate(a._deltaPosition, -1), - a._deltaRotationConjugated && a.object.rotationQuaternion && a.object.rotationQuaternion.multiplyToRef(a._deltaRotationConjugated, a.object.rotationQuaternion), - a.object.computeWorldMatrix(false), - a.object.parent && a.object.rotationQuaternion ? (a.getParentsRotation(), - a._tmpQuat.multiplyToRef(a.object.rotationQuaternion, a._tmpQuat)) : a._tmpQuat.copyFrom(a.object.rotationQuaternion || new o.q), - a._options.disableBidirectionalTransformation || a.object.rotationQuaternion && a._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(a, a.object.getAbsolutePosition(), a._tmpQuat), - a._onBeforePhysicsStepCallbacks.forEach(function(e) { - e(a) - })) - } - , - this.afterStep = function() { - a._physicsEngine && (a._onAfterPhysicsStepCallbacks.forEach(function(e) { - e(a) - }), - a._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(a), - a.object.parent && a.object.rotationQuaternion && (a.getParentsRotation(), - a._tmpQuat.conjugateInPlace(), - a._tmpQuat.multiplyToRef(a.object.rotationQuaternion, a.object.rotationQuaternion)), - a.object.setAbsolutePosition(a.object.position), - a._deltaRotation && a.object.rotationQuaternion && a.object.rotationQuaternion.multiplyToRef(a._deltaRotation, a.object.rotationQuaternion), - a.object.translate(a._deltaPosition, 1)) - } - , - this.onCollideEvent = null, - this.onCollide = function(e) { - if ((a._onPhysicsCollideCallbacks.length || a.onCollideEvent) && a._physicsEngine) { - var t = a._physicsEngine.getImpostorWithPhysicsBody(e.body); - t && (a.onCollideEvent && a.onCollideEvent(a, t), - a._onPhysicsCollideCallbacks.filter(function(e) { - return -1 !== e.otherImpostors.indexOf(t) - }).forEach(function(e) { - e.callback(a, t) - })) - } - } - , - this.object ? (!this._scene && e.getScene && (this._scene = e.getScene()), - this._scene && (this.type > 100 && (this.soft = true), - this._physicsEngine = this._scene.getPhysicsEngine(), - this._physicsEngine ? (this.object.rotationQuaternion || (this.object.rotation ? this.object.rotationQuaternion = o.q.RotationYawPitchRoll(this.object.rotation.y, this.object.rotation.x, this.object.rotation.z) : this.object.rotationQuaternion = new o.q), - this._options.mass = void 0 === i.mass ? 0 : i.mass, - this._options.friction = void 0 === i.friction ? .2 : i.friction, - this._options.restitution = void 0 === i.restitution ? .2 : i.restitution, - this.soft && (this._options.mass = this._options.mass > 0 ? this._options.mass : 1, - this._options.pressure = void 0 === i.pressure ? 200 : i.pressure, - this._options.stiffness = void 0 === i.stiffness ? 1 : i.stiffness, - this._options.velocityIterations = void 0 === i.velocityIterations ? 20 : i.velocityIterations, - this._options.positionIterations = void 0 === i.positionIterations ? 20 : i.positionIterations, - this._options.fixedPoints = void 0 === i.fixedPoints ? 0 : i.fixedPoints, - this._options.margin = void 0 === i.margin ? 0 : i.margin, - this._options.damping = void 0 === i.damping ? 0 : i.damping, - this._options.path = void 0 === i.path ? null : i.path, - this._options.shape = void 0 === i.shape ? null : i.shape), - this._joints = [], - !this.object.parent || this._options.ignoreParent ? this._init() : this.object.parent.physicsImpostor && n.a.Warn("You must affect impostors to children before affecting impostor to parent.")) : n.a.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))) : n.a.Error("No object was provided. A physics object is obligatory") + return ( + Object.defineProperty(e.prototype, "isDisposed", { + get: function () { + return this._isDisposed; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "mass", { + get: function () { + return this._physicsEngine + ? this._physicsEngine + .getPhysicsPlugin() + .getBodyMass(this) + : 0; + }, + set: function (e) { + this.setMass(e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "friction", { + get: function () { + return this._physicsEngine + ? this._physicsEngine + .getPhysicsPlugin() + .getBodyFriction(this) + : 0; + }, + set: function (e) { + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .setBodyFriction(this, e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "restitution", { + get: function () { + return this._physicsEngine + ? this._physicsEngine + .getPhysicsPlugin() + .getBodyRestitution(this) + : 0; + }, + set: function (e) { + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .setBodyRestitution(this, e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "pressure", { + get: function () { + if (!this._physicsEngine) return 0; + var e = this._physicsEngine.getPhysicsPlugin(); + return e.setBodyPressure ? e.getBodyPressure(this) : 0; + }, + set: function (e) { + if (this._physicsEngine) { + var t = this._physicsEngine.getPhysicsPlugin(); + t.setBodyPressure && t.setBodyPressure(this, e); + } + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "stiffness", { + get: function () { + if (!this._physicsEngine) return 0; + var e = this._physicsEngine.getPhysicsPlugin(); + return e.getBodyStiffness ? e.getBodyStiffness(this) : 0; + }, + set: function (e) { + if (this._physicsEngine) { + var t = this._physicsEngine.getPhysicsPlugin(); + t.setBodyStiffness && t.setBodyStiffness(this, e); + } + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "velocityIterations", { + get: function () { + if (!this._physicsEngine) return 0; + var e = this._physicsEngine.getPhysicsPlugin(); + return e.getBodyVelocityIterations + ? e.getBodyVelocityIterations(this) + : 0; + }, + set: function (e) { + if (this._physicsEngine) { + var t = this._physicsEngine.getPhysicsPlugin(); + t.setBodyVelocityIterations && + t.setBodyVelocityIterations(this, e); + } + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "positionIterations", { + get: function () { + if (!this._physicsEngine) return 0; + var e = this._physicsEngine.getPhysicsPlugin(); + return e.getBodyPositionIterations + ? e.getBodyPositionIterations(this) + : 0; + }, + set: function (e) { + if (this._physicsEngine) { + var t = this._physicsEngine.getPhysicsPlugin(); + t.setBodyPositionIterations && + t.setBodyPositionIterations(this, e); + } + }, + enumerable: true, + configurable: true, + }), + (e.prototype._init = function () { + this._physicsEngine && + (this._physicsEngine.removeImpostor(this), + (this.physicsBody = null), + (this._parent = this._parent || this._getPhysicsParent()), + this._isDisposed || + (this.parent && !this._options.ignoreParent) || + this._physicsEngine.addImpostor(this)); + }), + (e.prototype._getPhysicsParent = function () { + return this.object.parent instanceof a.a + ? this.object.parent.physicsImpostor + : null; + }), + (e.prototype.isBodyInitRequired = function () { + return ( + this._bodyUpdateRequired || + (!this._physicsBody && !this._parent) + ); + }), + (e.prototype.setScalingUpdated = function () { + this.forceUpdate(); + }), + (e.prototype.forceUpdate = function () { + this._init(), + this.parent && + !this._options.ignoreParent && + this.parent.forceUpdate(); + }), + Object.defineProperty(e.prototype, "physicsBody", { + get: function () { + return this._parent && !this._options.ignoreParent + ? this._parent.physicsBody + : this._physicsBody; + }, + set: function (e) { + this._physicsBody && + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .removePhysicsBody(this), + (this._physicsBody = e), + this.resetUpdateFlags(); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "parent", { + get: function () { + return !this._options.ignoreParent && this._parent + ? this._parent + : null; + }, + set: function (e) { + this._parent = e; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.resetUpdateFlags = function () { + this._bodyUpdateRequired = false; + }), + (e.prototype.getObjectExtendSize = function () { + if (this.object.getBoundingInfo) { + var t = this.object.rotationQuaternion; + (this.object.rotationQuaternion = e.IDENTITY_QUATERNION), + this.object.computeWorldMatrix && + this.object.computeWorldMatrix(true); + var i = this.object + .getBoundingInfo() + .boundingBox.extendSizeWorld.scale(2); + return ( + (this.object.rotationQuaternion = t), + this.object.computeWorldMatrix && + this.object.computeWorldMatrix(true), + i + ); } - return Object.defineProperty(e.prototype, "isDisposed", { - get: function() { - return this._isDisposed - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "mass", { - get: function() { - return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0 - }, - set: function(e) { - this.setMass(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "friction", { - get: function() { - return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0 - }, - set: function(e) { - this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "restitution", { - get: function() { - return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0 - }, - set: function(e) { - this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "pressure", { - get: function() { - if (!this._physicsEngine) - return 0; - var e = this._physicsEngine.getPhysicsPlugin(); - return e.setBodyPressure ? e.getBodyPressure(this) : 0 - }, - set: function(e) { - if (this._physicsEngine) { - var t = this._physicsEngine.getPhysicsPlugin(); - t.setBodyPressure && t.setBodyPressure(this, e) - } - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "stiffness", { - get: function() { - if (!this._physicsEngine) - return 0; - var e = this._physicsEngine.getPhysicsPlugin(); - return e.getBodyStiffness ? e.getBodyStiffness(this) : 0 - }, - set: function(e) { - if (this._physicsEngine) { - var t = this._physicsEngine.getPhysicsPlugin(); - t.setBodyStiffness && t.setBodyStiffness(this, e) - } - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "velocityIterations", { - get: function() { - if (!this._physicsEngine) - return 0; - var e = this._physicsEngine.getPhysicsPlugin(); - return e.getBodyVelocityIterations ? e.getBodyVelocityIterations(this) : 0 - }, - set: function(e) { - if (this._physicsEngine) { - var t = this._physicsEngine.getPhysicsPlugin(); - t.setBodyVelocityIterations && t.setBodyVelocityIterations(this, e) - } - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "positionIterations", { - get: function() { - if (!this._physicsEngine) - return 0; - var e = this._physicsEngine.getPhysicsPlugin(); - return e.getBodyPositionIterations ? e.getBodyPositionIterations(this) : 0 - }, - set: function(e) { - if (this._physicsEngine) { - var t = this._physicsEngine.getPhysicsPlugin(); - t.setBodyPositionIterations && t.setBodyPositionIterations(this, e) - } - }, - enumerable: true, - configurable: true - }), - e.prototype._init = function() { - this._physicsEngine && (this._physicsEngine.removeImpostor(this), - this.physicsBody = null, - this._parent = this._parent || this._getPhysicsParent(), - this._isDisposed || this.parent && !this._options.ignoreParent || this._physicsEngine.addImpostor(this)) - } - , - e.prototype._getPhysicsParent = function() { - return this.object.parent instanceof a.a ? this.object.parent.physicsImpostor : null - } - , - e.prototype.isBodyInitRequired = function() { - return this._bodyUpdateRequired || !this._physicsBody && !this._parent - } - , - e.prototype.setScalingUpdated = function() { - this.forceUpdate() - } - , - e.prototype.forceUpdate = function() { - this._init(), - this.parent && !this._options.ignoreParent && this.parent.forceUpdate() - } - , - Object.defineProperty(e.prototype, "physicsBody", { - get: function() { - return this._parent && !this._options.ignoreParent ? this._parent.physicsBody : this._physicsBody - }, - set: function(e) { - this._physicsBody && this._physicsEngine && this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this), - this._physicsBody = e, - this.resetUpdateFlags() - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "parent", { - get: function() { - return !this._options.ignoreParent && this._parent ? this._parent : null - }, - set: function(e) { - this._parent = e - }, - enumerable: true, - configurable: true - }), - e.prototype.resetUpdateFlags = function() { - this._bodyUpdateRequired = false - } - , - e.prototype.getObjectExtendSize = function() { - if (this.object.getBoundingInfo) { - var t = this.object.rotationQuaternion; - this.object.rotationQuaternion = e.IDENTITY_QUATERNION, - this.object.computeWorldMatrix && this.object.computeWorldMatrix(true); - var i = this.object.getBoundingInfo().boundingBox.extendSizeWorld.scale(2); - return this.object.rotationQuaternion = t, - this.object.computeWorldMatrix && this.object.computeWorldMatrix(true), - i - } - return e.DEFAULT_OBJECT_SIZE - } - , - e.prototype.getObjectCenter = function() { - return this.object.getBoundingInfo ? this.object.getBoundingInfo().boundingBox.centerWorld : this.object.position - } - , - e.prototype.getParam = function(e) { - return this._options[e] - } - , - e.prototype.setParam = function(e, t) { - this._options[e] = t, - this._bodyUpdateRequired = true - } - , - e.prototype.setMass = function(e) { - this.getParam("mass") !== e && this.setParam("mass", e), - this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setBodyMass(this, e) - } - , - e.prototype.getLinearVelocity = function() { - return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this) : o.x.Zero() - } - , - e.prototype.setLinearVelocity = function(e) { - this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this, e) - } - , - e.prototype.getAngularVelocity = function() { - return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this) : o.x.Zero() - } - , - e.prototype.setAngularVelocity = function(e) { - this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this, e) - } - , - e.prototype.executeNativeFunction = function(e) { - this._physicsEngine && e(this._physicsEngine.getPhysicsPlugin().world, this.physicsBody) - } - , - e.prototype.registerBeforePhysicsStep = function(e) { - this._onBeforePhysicsStepCallbacks.push(e) - } - , - e.prototype.unregisterBeforePhysicsStep = function(e) { - var t = this._onBeforePhysicsStepCallbacks.indexOf(e); - t > -1 ? this._onBeforePhysicsStepCallbacks.splice(t, 1) : n.a.Warn("Function to remove was not found") - } - , - e.prototype.registerAfterPhysicsStep = function(e) { - this._onAfterPhysicsStepCallbacks.push(e) - } - , - e.prototype.unregisterAfterPhysicsStep = function(e) { - var t = this._onAfterPhysicsStepCallbacks.indexOf(e); - t > -1 ? this._onAfterPhysicsStepCallbacks.splice(t, 1) : n.a.Warn("Function to remove was not found") - } - , - e.prototype.registerOnPhysicsCollide = function(e, t) { - var i = e instanceof Array ? e : [e]; - this._onPhysicsCollideCallbacks.push({ - callback: t, - otherImpostors: i - }) - } - , - e.prototype.unregisterOnPhysicsCollide = function(e, t) { - var i = e instanceof Array ? e : [e] - , r = -1; - this._onPhysicsCollideCallbacks.some(function(e, n) { - if (e.callback === t && e.otherImpostors.length === i.length) { - var o = e.otherImpostors.every(function(e) { - return i.indexOf(e) > -1 - }); - return o && (r = n), - o - } - return false - }) ? this._onPhysicsCollideCallbacks.splice(r, 1) : n.a.Warn("Function to remove was not found") - } - , - e.prototype.getParentsRotation = function() { - var e = this.object.parent; - for (this._tmpQuat.copyFromFloats(0, 0, 0, 1); e; ) - e.rotationQuaternion ? this._tmpQuat2.copyFrom(e.rotationQuaternion) : o.q.RotationYawPitchRollToRef(e.rotation.y, e.rotation.x, e.rotation.z, this._tmpQuat2), - this._tmpQuat.multiplyToRef(this._tmpQuat2, this._tmpQuat), - e = e.parent; - return this._tmpQuat - } - , - e.prototype.applyForce = function(e, t) { - return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().applyForce(this, e, t), - this - } - , - e.prototype.applyImpulse = function(e, t) { - return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().applyImpulse(this, e, t), - this - } - , - e.prototype.createJoint = function(e, t, i) { - var n = new c.e(t,i); - return this.addJoint(e, n), - this - } - , - e.prototype.addJoint = function(e, t) { - return this._joints.push({ - otherImpostor: e, - joint: t - }), - this._physicsEngine && this._physicsEngine.addJoint(this, e, t), - this - } - , - e.prototype.addAnchor = function(e, t, i, n, r) { - if (!this._physicsEngine) - return this; - var o = this._physicsEngine.getPhysicsPlugin(); - return o.appendAnchor ? (this._physicsEngine && o.appendAnchor(this, e, t, i, n, r), - this) : this - } - , - e.prototype.addHook = function(e, t, i, n) { - if (!this._physicsEngine) - return this; - var r = this._physicsEngine.getPhysicsPlugin(); - return r.appendAnchor ? (this._physicsEngine && r.appendHook(this, e, t, i, n), - this) : this - } - , - e.prototype.sleep = function() { - return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().sleepBody(this), - this - } - , - e.prototype.wakeUp = function() { - return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().wakeUpBody(this), - this - } - , - e.prototype.clone = function(t) { - return t ? new e(t,this.type,this._options,this._scene) : null - } - , - e.prototype.dispose = function() { - var e = this; - this._physicsEngine && (this._joints.forEach(function(t) { - e._physicsEngine && e._physicsEngine.removeJoint(e, t.otherImpostor, t.joint) - }), - this._physicsEngine.removeImpostor(this), - this.parent && this.parent.forceUpdate(), - this._isDisposed = true) - } - , - e.prototype.setDeltaPosition = function(e) { - this._deltaPosition.copyFrom(e) - } - , - e.prototype.setDeltaRotation = function(e) { - this._deltaRotation || (this._deltaRotation = new o.q), - this._deltaRotation.copyFrom(e), - this._deltaRotationConjugated = this._deltaRotation.conjugate() - } - , - e.prototype.getBoxSizeToRef = function(e) { - return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this, e), - this - } - , - e.prototype.getRadius = function() { - return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getRadius(this) : 0 - } - , - e.prototype.syncBoneWithImpostor = function(t, i, n, r, a) { - var s = e._tmpVecs[0] - , c = this.object; - if (c.rotationQuaternion) - if (a) { - var u = e._tmpQuat; - c.rotationQuaternion.multiplyToRef(a, u), - t.setRotationQuaternion(u, o.s.WORLD, i) - } else - t.setRotationQuaternion(c.rotationQuaternion, o.s.WORLD, i); - s.x = 0, - s.y = 0, - s.z = 0, - n && (s.x = n.x, - s.y = n.y, - s.z = n.z, + return e.DEFAULT_OBJECT_SIZE; + }), + (e.prototype.getObjectCenter = function () { + return this.object.getBoundingInfo + ? this.object.getBoundingInfo().boundingBox.centerWorld + : this.object.position; + }), + (e.prototype.getParam = function (e) { + return this._options[e]; + }), + (e.prototype.setParam = function (e, t) { + (this._options[e] = t), (this._bodyUpdateRequired = true); + }), + (e.prototype.setMass = function (e) { + this.getParam("mass") !== e && this.setParam("mass", e), + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .setBodyMass(this, e); + }), + (e.prototype.getLinearVelocity = function () { + return this._physicsEngine + ? this._physicsEngine + .getPhysicsPlugin() + .getLinearVelocity(this) + : o.x.Zero(); + }), + (e.prototype.setLinearVelocity = function (e) { + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .setLinearVelocity(this, e); + }), + (e.prototype.getAngularVelocity = function () { + return this._physicsEngine + ? this._physicsEngine + .getPhysicsPlugin() + .getAngularVelocity(this) + : o.x.Zero(); + }), + (e.prototype.setAngularVelocity = function (e) { + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .setAngularVelocity(this, e); + }), + (e.prototype.executeNativeFunction = function (e) { + this._physicsEngine && + e( + this._physicsEngine.getPhysicsPlugin().world, + this.physicsBody + ); + }), + (e.prototype.registerBeforePhysicsStep = function (e) { + this._onBeforePhysicsStepCallbacks.push(e); + }), + (e.prototype.unregisterBeforePhysicsStep = function (e) { + var t = this._onBeforePhysicsStepCallbacks.indexOf(e); + t > -1 + ? this._onBeforePhysicsStepCallbacks.splice(t, 1) + : n.a.Warn("Function to remove was not found"); + }), + (e.prototype.registerAfterPhysicsStep = function (e) { + this._onAfterPhysicsStepCallbacks.push(e); + }), + (e.prototype.unregisterAfterPhysicsStep = function (e) { + var t = this._onAfterPhysicsStepCallbacks.indexOf(e); + t > -1 + ? this._onAfterPhysicsStepCallbacks.splice(t, 1) + : n.a.Warn("Function to remove was not found"); + }), + (e.prototype.registerOnPhysicsCollide = function (e, t) { + var i = e instanceof Array ? e : [e]; + this._onPhysicsCollideCallbacks.push({ + callback: t, + otherImpostors: i, + }); + }), + (e.prototype.unregisterOnPhysicsCollide = function (e, t) { + var i = e instanceof Array ? e : [e], + r = -1; + this._onPhysicsCollideCallbacks.some(function (e, n) { + if ( + e.callback === t && + e.otherImpostors.length === i.length + ) { + var o = e.otherImpostors.every(function (e) { + return i.indexOf(e) > -1; + }); + return o && (r = n), o; + } + return false; + }) + ? this._onPhysicsCollideCallbacks.splice(r, 1) + : n.a.Warn("Function to remove was not found"); + }), + (e.prototype.getParentsRotation = function () { + var e = this.object.parent; + for (this._tmpQuat.copyFromFloats(0, 0, 0, 1); e; ) + e.rotationQuaternion + ? this._tmpQuat2.copyFrom(e.rotationQuaternion) + : o.q.RotationYawPitchRollToRef( + e.rotation.y, + e.rotation.x, + e.rotation.z, + this._tmpQuat2 + ), + this._tmpQuat.multiplyToRef( + this._tmpQuat2, + this._tmpQuat + ), + (e = e.parent); + return this._tmpQuat; + }), + (e.prototype.applyForce = function (e, t) { + return ( + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .applyForce(this, e, t), + this + ); + }), + (e.prototype.applyImpulse = function (e, t) { + return ( + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .applyImpulse(this, e, t), + this + ); + }), + (e.prototype.createJoint = function (e, t, i) { + var n = new c.e(t, i); + return this.addJoint(e, n), this; + }), + (e.prototype.addJoint = function (e, t) { + return ( + this._joints.push({ + otherImpostor: e, + joint: t, + }), + this._physicsEngine && + this._physicsEngine.addJoint(this, e, t), + this + ); + }), + (e.prototype.addAnchor = function (e, t, i, n, r) { + if (!this._physicsEngine) return this; + var o = this._physicsEngine.getPhysicsPlugin(); + return o.appendAnchor + ? (this._physicsEngine && + o.appendAnchor(this, e, t, i, n, r), + this) + : this; + }), + (e.prototype.addHook = function (e, t, i, n) { + if (!this._physicsEngine) return this; + var r = this._physicsEngine.getPhysicsPlugin(); + return r.appendAnchor + ? (this._physicsEngine && r.appendHook(this, e, t, i, n), + this) + : this; + }), + (e.prototype.sleep = function () { + return ( + this._physicsEngine && + this._physicsEngine.getPhysicsPlugin().sleepBody(this), + this + ); + }), + (e.prototype.wakeUp = function () { + return ( + this._physicsEngine && + this._physicsEngine.getPhysicsPlugin().wakeUpBody(this), + this + ); + }), + (e.prototype.clone = function (t) { + return t + ? new e(t, this.type, this._options, this._scene) + : null; + }), + (e.prototype.dispose = function () { + var e = this; + this._physicsEngine && + (this._joints.forEach(function (t) { + e._physicsEngine && + e._physicsEngine.removeJoint( + e, + t.otherImpostor, + t.joint + ); + }), + this._physicsEngine.removeImpostor(this), + this.parent && this.parent.forceUpdate(), + (this._isDisposed = true)); + }), + (e.prototype.setDeltaPosition = function (e) { + this._deltaPosition.copyFrom(e); + }), + (e.prototype.setDeltaRotation = function (e) { + this._deltaRotation || (this._deltaRotation = new o.q()), + this._deltaRotation.copyFrom(e), + (this._deltaRotationConjugated = + this._deltaRotation.conjugate()); + }), + (e.prototype.getBoxSizeToRef = function (e) { + return ( + this._physicsEngine && + this._physicsEngine + .getPhysicsPlugin() + .getBoxSizeToRef(this, e), + this + ); + }), + (e.prototype.getRadius = function () { + return this._physicsEngine + ? this._physicsEngine.getPhysicsPlugin().getRadius(this) + : 0; + }), + (e.prototype.syncBoneWithImpostor = function (t, i, n, r, a) { + var s = e._tmpVecs[0], + c = this.object; + if (c.rotationQuaternion) + if (a) { + var u = e._tmpQuat; + c.rotationQuaternion.multiplyToRef(a, u), + t.setRotationQuaternion(u, o.s.WORLD, i); + } else + t.setRotationQuaternion( + c.rotationQuaternion, + o.s.WORLD, + i + ); + (s.x = 0), + (s.y = 0), + (s.z = 0), + n && + ((s.x = n.x), + (s.y = n.y), + (s.z = n.z), t.getDirectionToRef(s, i, s), null == r && (r = n.length()), - s.x *= r, - s.y *= r, - s.z *= r), - t.getParent() ? (s.addInPlace(c.getAbsolutePosition()), - t.setAbsolutePosition(s, i)) : (i.setAbsolutePosition(c.getAbsolutePosition()), - i.position.x -= s.x, - i.position.y -= s.y, - i.position.z -= s.z) - } - , - e.prototype.syncImpostorWithBone = function(t, i, n, r, a, s) { - var c = this.object; - if (c.rotationQuaternion) - if (a) { - var u = e._tmpQuat; - t.getRotationQuaternionToRef(o.s.WORLD, i, u), - u.multiplyToRef(a, c.rotationQuaternion) - } else - t.getRotationQuaternionToRef(o.s.WORLD, i, c.rotationQuaternion); - var l = e._tmpVecs[0] - , h = e._tmpVecs[1]; - s || ((s = e._tmpVecs[2]).x = 0, - s.y = 1, - s.z = 0), - t.getDirectionToRef(s, i, h), - t.getAbsolutePositionToRef(i, l), - null == r && n && (r = n.length()), - null != r && (l.x += h.x * r, - l.y += h.y * r, - l.z += h.z * r), - c.setAbsolutePosition(l) - } - , - e.DEFAULT_OBJECT_SIZE = new o.x(1,1,1), - e.IDENTITY_QUATERNION = o.q.Identity(), - e._tmpVecs = r.a.BuildArray(3, o.x.Zero), - e._tmpQuat = o.q.Identity(), - e.NoImpostor = 0, - e.SphereImpostor = 1, - e.BoxImpostor = 2, - e.PlaneImpostor = 3, - e.MeshImpostor = 4, - e.CylinderImpostor = 7, - e.ParticleImpostor = 8, - e.HeightmapImpostor = 9, - e.ConvexHullImpostor = 10, - e.RopeImpostor = 101, - e.ClothImpostor = 102, - e.SoftbodyImpostor = 103, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }), - i.d(t, "b", function() { - return o + (s.x *= r), + (s.y *= r), + (s.z *= r)), + t.getParent() + ? (s.addInPlace(c.getAbsolutePosition()), + t.setAbsolutePosition(s, i)) + : (i.setAbsolutePosition(c.getAbsolutePosition()), + (i.position.x -= s.x), + (i.position.y -= s.y), + (i.position.z -= s.z)); + }), + (e.prototype.syncImpostorWithBone = function ( + t, + i, + n, + r, + a, + s + ) { + var c = this.object; + if (c.rotationQuaternion) + if (a) { + var u = e._tmpQuat; + t.getRotationQuaternionToRef(o.s.WORLD, i, u), + u.multiplyToRef(a, c.rotationQuaternion); + } else + t.getRotationQuaternionToRef( + o.s.WORLD, + i, + c.rotationQuaternion + ); + var l = e._tmpVecs[0], + h = e._tmpVecs[1]; + s || (((s = e._tmpVecs[2]).x = 0), (s.y = 1), (s.z = 0)), + t.getDirectionToRef(s, i, h), + t.getAbsolutePositionToRef(i, l), + null == r && n && (r = n.length()), + null != r && + ((l.x += h.x * r), (l.y += h.y * r), (l.z += h.z * r)), + c.setAbsolutePosition(l); + }), + (e.DEFAULT_OBJECT_SIZE = new o.x(1, 1, 1)), + (e.IDENTITY_QUATERNION = o.q.Identity()), + (e._tmpVecs = r.a.BuildArray(3, o.x.Zero)), + (e._tmpQuat = o.q.Identity()), + (e.NoImpostor = 0), + (e.SphereImpostor = 1), + (e.BoxImpostor = 2), + (e.PlaneImpostor = 3), + (e.MeshImpostor = 4), + (e.CylinderImpostor = 7), + (e.ParticleImpostor = 8), + (e.HeightmapImpostor = 9), + (e.ConvexHullImpostor = 10), + (e.RopeImpostor = 101), + (e.ClothImpostor = 102), + (e.SoftbodyImpostor = 103), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }), + i.d(t, "b", function () { + return o; }); - var n = i(1) - , r = function() { - function e(t) { - this.length = 0, - this.data = new Array(t), - this._id = e._GlobalId++ - } - return e.prototype.push = function(e) { - this.data[this.length++] = e, - this.length > this.data.length && (this.data.length *= 2) - } - , - e.prototype.forEach = function(e) { - for (var t = 0; t < this.length; t++) - e(this.data[t]) - } - , - e.prototype.sort = function(e) { - this.data.sort(e) - } - , - e.prototype.reset = function() { - this.length = 0 - } - , - e.prototype.dispose = function() { - this.reset(), - this.data && (this.data.length = 0, - this.data = []) - } - , - e.prototype.concat = function(e) { - if (0 !== e.length) { - this.length + e.length > this.data.length && (this.data.length = 2 * (this.length + e.length)); - for (var t = 0; t < e.length; t++) - this.data[this.length++] = (e.data || e)[t] - } - } - , - e.prototype.indexOf = function(e) { - var t = this.data.indexOf(e); - return t >= this.length ? -1 : t - } - , - e.prototype.contains = function(e) { - return -1 !== this.indexOf(e) - } - , - e._GlobalId = 0, + var n = i(1), + r = (function () { + function e(t) { + (this.length = 0), + (this.data = new Array(t)), + (this._id = e._GlobalId++); + } + return ( + (e.prototype.push = function (e) { + (this.data[this.length++] = e), + this.length > this.data.length && + (this.data.length *= 2); + }), + (e.prototype.forEach = function (e) { + for (var t = 0; t < this.length; t++) e(this.data[t]); + }), + (e.prototype.sort = function (e) { + this.data.sort(e); + }), + (e.prototype.reset = function () { + this.length = 0; + }), + (e.prototype.dispose = function () { + this.reset(), + this.data && ((this.data.length = 0), (this.data = [])); + }), + (e.prototype.concat = function (e) { + if (0 !== e.length) { + this.length + e.length > this.data.length && + (this.data.length = 2 * (this.length + e.length)); + for (var t = 0; t < e.length; t++) + this.data[this.length++] = (e.data || e)[t]; + } + }), + (e.prototype.indexOf = function (e) { + var t = this.data.indexOf(e); + return t >= this.length ? -1 : t; + }), + (e.prototype.contains = function (e) { + return -1 !== this.indexOf(e); + }), + (e._GlobalId = 0), e - }() - , o = function(e) { - function t() { - var t = null !== e && e.apply(this, arguments) || this; - return t._duplicateId = 0, - t - } - return n.d(t, e), - t.prototype.push = function(t) { - e.prototype.push.call(this, t), + ); + })(), + o = (function (e) { + function t() { + var t = (null !== e && e.apply(this, arguments)) || this; + return (t._duplicateId = 0), t; + } + return ( + n.d(t, e), + (t.prototype.push = function (t) { + e.prototype.push.call(this, t), t.__smartArrayFlags || (t.__smartArrayFlags = {}), - t.__smartArrayFlags[this._id] = this._duplicateId - } - , - t.prototype.pushNoDuplicate = function(e) { - return !(e.__smartArrayFlags && e.__smartArrayFlags[this._id] === this._duplicateId || (this.push(e), - 0)) - } - , - t.prototype.reset = function() { - e.prototype.reset.call(this), - this._duplicateId++ - } - , - t.prototype.concatWithNoDuplicate = function(e) { - if (0 !== e.length) { - this.length + e.length > this.data.length && (this.data.length = 2 * (this.length + e.length)); - for (var t = 0; t < e.length; t++) { - var i = (e.data || e)[t]; - this.pushNoDuplicate(i) - } + (t.__smartArrayFlags[this._id] = this._duplicateId); + }), + (t.prototype.pushNoDuplicate = function (e) { + return !( + (e.__smartArrayFlags && + e.__smartArrayFlags[this._id] === + this._duplicateId) || + (this.push(e), 0) + ); + }), + (t.prototype.reset = function () { + e.prototype.reset.call(this), this._duplicateId++; + }), + (t.prototype.concatWithNoDuplicate = function (e) { + if (0 !== e.length) { + this.length + e.length > this.data.length && + (this.data.length = 2 * (this.length + e.length)); + for (var t = 0; t < e.length; t++) { + var i = (e.data || e)[t]; + this.pushNoDuplicate(i); } - } - , + } + }), t - }(r) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return o - }); - var n = i(9) - , r = i(104) - , o = function() { - function e() {} - return e.EnableFor = function(t) { - t._tags = t._tags || {}, - t.hasTags = function() { - return e.HasTags(t) - } - , - t.addTags = function(i) { - return e.AddTagsTo(t, i) - } - , - t.removeTags = function(i) { - return e.RemoveTagsFrom(t, i) - } - , - t.matchesTagsQuery = function(i) { - return e.MatchesQuery(t, i) - } - } - , - e.DisableFor = function(e) { - delete e._tags, + ); + })(r); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return o; + }); + var n = i(9), + r = i(104), + o = (function () { + function e() {} + return ( + (e.EnableFor = function (t) { + (t._tags = t._tags || {}), + (t.hasTags = function () { + return e.HasTags(t); + }), + (t.addTags = function (i) { + return e.AddTagsTo(t, i); + }), + (t.removeTags = function (i) { + return e.RemoveTagsFrom(t, i); + }), + (t.matchesTagsQuery = function (i) { + return e.MatchesQuery(t, i); + }); + }), + (e.DisableFor = function (e) { + delete e._tags, delete e.hasTags, delete e.addTags, delete e.removeTags, - delete e.matchesTagsQuery - } - , - e.HasTags = function(e) { - return !!e._tags && !n.h.IsEmpty(e._tags) - } - , - e.GetTags = function(e, t) { - if (void 0 === t && (t = true), - !e._tags) - return null; - if (t) { - var i = []; - for (var n in e._tags) - e._tags.hasOwnProperty(n) && true === e._tags[n] && i.push(n); - return i.join(" ") - } - return e._tags - } - , - e.AddTagsTo = function(t, i) { - i && "string" == typeof i && i.split(" ").forEach(function(i, n, r) { - e._AddTagTo(t, i) - }) - } - , - e._AddTagTo = function(t, i) { - "" !== (i = i.trim()) && "true" !== i && "false" !== i && (i.match(/[\s]/) || i.match(/^([!]|([|]|[&]){2})/) || (e.EnableFor(t), - t._tags[i] = true)) - } - , - e.RemoveTagsFrom = function(t, i) { - if (e.HasTags(t)) { - var n = i.split(" "); - for (var r in n) - e._RemoveTagFrom(t, n[r]) - } - } - , - e._RemoveTagFrom = function(e, t) { - delete e._tags[t] - } - , - e.MatchesQuery = function(t, i) { - return void 0 === i || ("" === i ? e.HasTags(t) : r.a.Eval(i, function(i) { - return e.HasTags(t) && t._tags[i] - })) - } - , + delete e.matchesTagsQuery; + }), + (e.HasTags = function (e) { + return !!e._tags && !n.h.IsEmpty(e._tags); + }), + (e.GetTags = function (e, t) { + if ((void 0 === t && (t = true), !e._tags)) return null; + if (t) { + var i = []; + for (var n in e._tags) + e._tags.hasOwnProperty(n) && + true === e._tags[n] && + i.push(n); + return i.join(" "); + } + return e._tags; + }), + (e.AddTagsTo = function (t, i) { + i && + "string" == typeof i && + i.split(" ").forEach(function (i, n, r) { + e._AddTagTo(t, i); + }); + }), + (e._AddTagTo = function (t, i) { + "" !== (i = i.trim()) && + "true" !== i && + "false" !== i && + (i.match(/[\s]/) || + i.match(/^([!]|([|]|[&]){2})/) || + (e.EnableFor(t), (t._tags[i] = true))); + }), + (e.RemoveTagsFrom = function (t, i) { + if (e.HasTags(t)) { + var n = i.split(" "); + for (var r in n) e._RemoveTagFrom(t, n[r]); + } + }), + (e._RemoveTagFrom = function (e, t) { + delete e._tags[t]; + }), + (e.MatchesQuery = function (t, i) { + return ( + void 0 === i || + ("" === i + ? e.HasTags(t) + : r.a.Eval(i, function (i) { + return e.HasTags(t) && t._tags[i]; + })) + ); + }), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() { + (this.rootNodes = new Array()), + (this.cameras = new Array()), + (this.lights = new Array()), + (this.meshes = new Array()), + (this.skeletons = new Array()), + (this.particleSystems = new Array()), + (this.animations = []), + (this.animationGroups = new Array()), + (this.multiMaterials = new Array()), + (this.materials = new Array()), + (this.morphTargetManagers = new Array()), + (this.geometries = new Array()), + (this.transformNodes = new Array()), + (this.actionManagers = new Array()), + (this.textures = new Array()), + (this.environmentTexture = null); + } + return ( + (e.AddParser = function (e, t) { + this._BabylonFileParsers[e] = t; + }), + (e.GetParser = function (e) { + return this._BabylonFileParsers[e] + ? this._BabylonFileParsers[e] + : null; + }), + (e.AddIndividualParser = function (e, t) { + this._IndividualBabylonFileParsers[e] = t; + }), + (e.GetIndividualParser = function (e) { + return this._IndividualBabylonFileParsers[e] + ? this._IndividualBabylonFileParsers[e] + : null; + }), + (e.Parse = function (e, t, i, n) { + for (var r in this._BabylonFileParsers) + this._BabylonFileParsers.hasOwnProperty(r) && + this._BabylonFileParsers[r](e, t, i, n); + }), + (e._BabylonFileParsers = {}), + (e._IndividualBabylonFileParsers = {}), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "b", function () { + return l; + }), + i.d(t, "a", function () { + return h; }); - var n = function() { - function e() { - this.rootNodes = new Array, - this.cameras = new Array, - this.lights = new Array, - this.meshes = new Array, - this.skeletons = new Array, - this.particleSystems = new Array, - this.animations = [], - this.animationGroups = new Array, - this.multiMaterials = new Array, - this.materials = new Array, - this.morphTargetManagers = new Array, - this.geometries = new Array, - this.transformNodes = new Array, - this.actionManagers = new Array, - this.textures = new Array, - this.environmentTexture = null - } - return e.AddParser = function(e, t) { - this._BabylonFileParsers[e] = t - } - , - e.GetParser = function(e) { - return this._BabylonFileParsers[e] ? this._BabylonFileParsers[e] : null - } - , - e.AddIndividualParser = function(e, t) { - this._IndividualBabylonFileParsers[e] = t - } - , - e.GetIndividualParser = function(e) { - return this._IndividualBabylonFileParsers[e] ? this._IndividualBabylonFileParsers[e] : null - } - , - e.Parse = function(e, t, i, n) { - for (var r in this._BabylonFileParsers) - this._BabylonFileParsers.hasOwnProperty(r) && this._BabylonFileParsers[r](e, t, i, n) - } - , - e._BabylonFileParsers = {}, - e._IndividualBabylonFileParsers = {}, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "b", function() { - return l - }), - i.d(t, "a", function() { - return h - }); - var n = i(1) - , r = i(2) - , o = i(8) - , a = i(9) - , s = i(0) - , c = i(64) - , u = i(93) - , l = function(e) { - function t() { - var t = e.call(this) || this; - return t.IMAGEPROCESSING = false, - t.VIGNETTE = false, - t.VIGNETTEBLENDMODEMULTIPLY = false, - t.VIGNETTEBLENDMODEOPAQUE = false, - t.TONEMAPPING = false, - t.TONEMAPPING_ACES = false, - t.CONTRAST = false, - t.COLORCURVES = false, - t.COLORGRADING = false, - t.COLORGRADING3D = false, - t.SAMPLER3DGREENDEPTH = false, - t.SAMPLER3DBGRMAP = false, - t.IMAGEPROCESSINGPOSTPROCESS = false, - t.EXPOSURE = false, - t.rebuild(), - t - } - return n.d(t, e), - t - }(c.a) - , h = function() { - function e() { - this.colorCurves = new u.a, - this._colorCurvesEnabled = false, - this._colorGradingEnabled = false, - this._colorGradingWithGreenDepth = true, - this._colorGradingBGR = true, - this._exposure = 1, - this._toneMappingEnabled = false, - this._toneMappingType = e.TONEMAPPING_STANDARD, - this._contrast = 1, - this.vignetteStretch = 0, - this.vignetteCentreX = 0, - this.vignetteCentreY = 0, - this.vignetteWeight = 1.5, - this.vignetteColor = new s.f(0,0,0,0), - this.vignetteCameraFov = .5, - this._vignetteBlendMode = e.VIGNETTEMODE_MULTIPLY, - this._vignetteEnabled = false, - this._applyByPostProcess = false, - this._isEnabled = true, - this.onUpdateParameters = new o.c - } - return Object.defineProperty(e.prototype, "colorCurvesEnabled", { - get: function() { - return this._colorCurvesEnabled - }, - set: function(e) { - this._colorCurvesEnabled !== e && (this._colorCurvesEnabled = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + var n = i(1), + r = i(2), + o = i(8), + a = i(9), + s = i(0), + c = i(64), + u = i(93), + l = (function (e) { + function t() { + var t = e.call(this) || this; + return ( + (t.IMAGEPROCESSING = false), + (t.VIGNETTE = false), + (t.VIGNETTEBLENDMODEMULTIPLY = false), + (t.VIGNETTEBLENDMODEOPAQUE = false), + (t.TONEMAPPING = false), + (t.TONEMAPPING_ACES = false), + (t.CONTRAST = false), + (t.COLORCURVES = false), + (t.COLORGRADING = false), + (t.COLORGRADING3D = false), + (t.SAMPLER3DGREENDEPTH = false), + (t.SAMPLER3DBGRMAP = false), + (t.IMAGEPROCESSINGPOSTPROCESS = false), + (t.EXPOSURE = false), + t.rebuild(), + t + ); + } + return n.d(t, e), t; + })(c.a), + h = (function () { + function e() { + (this.colorCurves = new u.a()), + (this._colorCurvesEnabled = false), + (this._colorGradingEnabled = false), + (this._colorGradingWithGreenDepth = true), + (this._colorGradingBGR = true), + (this._exposure = 1), + (this._toneMappingEnabled = false), + (this._toneMappingType = e.TONEMAPPING_STANDARD), + (this._contrast = 1), + (this.vignetteStretch = 0), + (this.vignetteCentreX = 0), + (this.vignetteCentreY = 0), + (this.vignetteWeight = 1.5), + (this.vignetteColor = new s.f(0, 0, 0, 0)), + (this.vignetteCameraFov = 0.5), + (this._vignetteBlendMode = e.VIGNETTEMODE_MULTIPLY), + (this._vignetteEnabled = false), + (this._applyByPostProcess = false), + (this._isEnabled = true), + (this.onUpdateParameters = new o.c()); + } + return ( + Object.defineProperty(e.prototype, "colorCurvesEnabled", { + get: function () { + return this._colorCurvesEnabled; + }, + set: function (e) { + this._colorCurvesEnabled !== e && + ((this._colorCurvesEnabled = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "colorGradingTexture", { - get: function() { - return this._colorGradingTexture - }, - set: function(e) { - this._colorGradingTexture !== e && (this._colorGradingTexture = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._colorGradingTexture; + }, + set: function (e) { + this._colorGradingTexture !== e && + ((this._colorGradingTexture = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "colorGradingEnabled", { - get: function() { - return this._colorGradingEnabled + get: function () { + return this._colorGradingEnabled; + }, + set: function (e) { + this._colorGradingEnabled !== e && + ((this._colorGradingEnabled = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "colorGradingWithGreenDepth", + { + get: function () { + return this._colorGradingWithGreenDepth; }, - set: function(e) { - this._colorGradingEnabled !== e && (this._colorGradingEnabled = e, - this._updateParameters()) + set: function (e) { + this._colorGradingWithGreenDepth !== e && + ((this._colorGradingWithGreenDepth = e), + this._updateParameters()); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "colorGradingWithGreenDepth", { - get: function() { - return this._colorGradingWithGreenDepth - }, - set: function(e) { - this._colorGradingWithGreenDepth !== e && (this._colorGradingWithGreenDepth = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "colorGradingBGR", { - get: function() { - return this._colorGradingBGR - }, - set: function(e) { - this._colorGradingBGR !== e && (this._colorGradingBGR = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._colorGradingBGR; + }, + set: function (e) { + this._colorGradingBGR !== e && + ((this._colorGradingBGR = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "exposure", { - get: function() { - return this._exposure - }, - set: function(e) { - this._exposure !== e && (this._exposure = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._exposure; + }, + set: function (e) { + this._exposure !== e && + ((this._exposure = e), this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "toneMappingEnabled", { - get: function() { - return this._toneMappingEnabled - }, - set: function(e) { - this._toneMappingEnabled !== e && (this._toneMappingEnabled = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._toneMappingEnabled; + }, + set: function (e) { + this._toneMappingEnabled !== e && + ((this._toneMappingEnabled = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "toneMappingType", { - get: function() { - return this._toneMappingType - }, - set: function(e) { - this._toneMappingType !== e && (this._toneMappingType = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._toneMappingType; + }, + set: function (e) { + this._toneMappingType !== e && + ((this._toneMappingType = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "contrast", { - get: function() { - return this._contrast - }, - set: function(e) { - this._contrast !== e && (this._contrast = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._contrast; + }, + set: function (e) { + this._contrast !== e && + ((this._contrast = e), this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "vignetteBlendMode", { - get: function() { - return this._vignetteBlendMode - }, - set: function(e) { - this._vignetteBlendMode !== e && (this._vignetteBlendMode = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._vignetteBlendMode; + }, + set: function (e) { + this._vignetteBlendMode !== e && + ((this._vignetteBlendMode = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "vignetteEnabled", { - get: function() { - return this._vignetteEnabled - }, - set: function(e) { - this._vignetteEnabled !== e && (this._vignetteEnabled = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._vignetteEnabled; + }, + set: function (e) { + this._vignetteEnabled !== e && + ((this._vignetteEnabled = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "applyByPostProcess", { - get: function() { - return this._applyByPostProcess - }, - set: function(e) { - this._applyByPostProcess !== e && (this._applyByPostProcess = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._applyByPostProcess; + }, + set: function (e) { + this._applyByPostProcess !== e && + ((this._applyByPostProcess = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isEnabled", { - get: function() { - return this._isEnabled - }, - set: function(e) { - this._isEnabled !== e && (this._isEnabled = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._isEnabled; + }, + set: function (e) { + this._isEnabled !== e && + ((this._isEnabled = e), this._updateParameters()); + }, + enumerable: true, + configurable: true, }), - e.prototype._updateParameters = function() { - this.onUpdateParameters.notifyObservers(this) - } - , - e.prototype.getClassName = function() { - return "ImageProcessingConfiguration" - } - , - e.PrepareUniforms = function(e, t) { - t.EXPOSURE && e.push("exposureLinear"), + (e.prototype._updateParameters = function () { + this.onUpdateParameters.notifyObservers(this); + }), + (e.prototype.getClassName = function () { + return "ImageProcessingConfiguration"; + }), + (e.PrepareUniforms = function (e, t) { + t.EXPOSURE && e.push("exposureLinear"), t.CONTRAST && e.push("contrast"), t.COLORGRADING && e.push("colorTransformSettings"), - t.VIGNETTE && (e.push("vInverseScreenSize"), - e.push("vignetteSettings1"), - e.push("vignetteSettings2")), - t.COLORCURVES && u.a.PrepareUniforms(e) - } - , - e.PrepareSamplers = function(e, t) { - t.COLORGRADING && e.push("txColorTransform") - } - , - e.prototype.prepareDefines = function(t, i) { - if (void 0 === i && (i = false), + t.VIGNETTE && + (e.push("vInverseScreenSize"), + e.push("vignetteSettings1"), + e.push("vignetteSettings2")), + t.COLORCURVES && u.a.PrepareUniforms(e); + }), + (e.PrepareSamplers = function (e, t) { + t.COLORGRADING && e.push("txColorTransform"); + }), + (e.prototype.prepareDefines = function (t, i) { + if ( + (void 0 === i && (i = false), i !== this.applyByPostProcess || !this._isEnabled) - return t.VIGNETTE = false, - t.TONEMAPPING = false, - t.TONEMAPPING_ACES = false, - t.CONTRAST = false, - t.EXPOSURE = false, - t.COLORCURVES = false, - t.COLORGRADING = false, - t.COLORGRADING3D = false, - t.IMAGEPROCESSING = false, - void (t.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess && this._isEnabled); - switch (t.VIGNETTE = this.vignetteEnabled, - t.VIGNETTEBLENDMODEMULTIPLY = this.vignetteBlendMode === e._VIGNETTEMODE_MULTIPLY, - t.VIGNETTEBLENDMODEOPAQUE = !t.VIGNETTEBLENDMODEMULTIPLY, - t.TONEMAPPING = this.toneMappingEnabled, - this._toneMappingType) { + ) + return ( + (t.VIGNETTE = false), + (t.TONEMAPPING = false), + (t.TONEMAPPING_ACES = false), + (t.CONTRAST = false), + (t.EXPOSURE = false), + (t.COLORCURVES = false), + (t.COLORGRADING = false), + (t.COLORGRADING3D = false), + (t.IMAGEPROCESSING = false), + void (t.IMAGEPROCESSINGPOSTPROCESS = + this.applyByPostProcess && this._isEnabled) + ); + switch ( + ((t.VIGNETTE = this.vignetteEnabled), + (t.VIGNETTEBLENDMODEMULTIPLY = + this.vignetteBlendMode === e._VIGNETTEMODE_MULTIPLY), + (t.VIGNETTEBLENDMODEOPAQUE = + !t.VIGNETTEBLENDMODEMULTIPLY), + (t.TONEMAPPING = this.toneMappingEnabled), + this._toneMappingType) + ) { case e.TONEMAPPING_ACES: - t.TONEMAPPING_ACES = true; - break; + t.TONEMAPPING_ACES = true; + break; default: - t.TONEMAPPING_ACES = false - } - t.CONTRAST = 1 !== this.contrast, - t.EXPOSURE = 1 !== this.exposure, - t.COLORCURVES = this.colorCurvesEnabled && !!this.colorCurves, - t.COLORGRADING = this.colorGradingEnabled && !!this.colorGradingTexture, - t.COLORGRADING ? t.COLORGRADING3D = this.colorGradingTexture.is3D : t.COLORGRADING3D = false, - t.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth, - t.SAMPLER3DBGRMAP = this.colorGradingBGR, - t.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess, - t.IMAGEPROCESSING = t.VIGNETTE || t.TONEMAPPING || t.CONTRAST || t.EXPOSURE || t.COLORCURVES || t.COLORGRADING - } - , - e.prototype.isReady = function() { - return !this.colorGradingEnabled || !this.colorGradingTexture || this.colorGradingTexture.isReady() - } - , - e.prototype.bind = function(e, t) { - if (void 0 === t && (t = 1), - this._colorCurvesEnabled && this.colorCurves && u.a.Bind(this.colorCurves, e), - this._vignetteEnabled) { - var i = 1 / e.getEngine().getRenderWidth() - , n = 1 / e.getEngine().getRenderHeight(); - e.setFloat2("vInverseScreenSize", i, n); - var r = Math.tan(.5 * this.vignetteCameraFov) - , o = r * t - , s = Math.sqrt(o * r); - o = a.h.Mix(o, s, this.vignetteStretch), - r = a.h.Mix(r, s, this.vignetteStretch), - e.setFloat4("vignetteSettings1", o, r, -o * this.vignetteCentreX, -r * this.vignetteCentreY); - var c = -2 * this.vignetteWeight; - e.setFloat4("vignetteSettings2", this.vignetteColor.r, this.vignetteColor.g, this.vignetteColor.b, c) - } - if (e.setFloat("exposureLinear", this.exposure), + t.TONEMAPPING_ACES = false; + } + (t.CONTRAST = 1 !== this.contrast), + (t.EXPOSURE = 1 !== this.exposure), + (t.COLORCURVES = + this.colorCurvesEnabled && !!this.colorCurves), + (t.COLORGRADING = + this.colorGradingEnabled && + !!this.colorGradingTexture), + t.COLORGRADING + ? (t.COLORGRADING3D = this.colorGradingTexture.is3D) + : (t.COLORGRADING3D = false), + (t.SAMPLER3DGREENDEPTH = + this.colorGradingWithGreenDepth), + (t.SAMPLER3DBGRMAP = this.colorGradingBGR), + (t.IMAGEPROCESSINGPOSTPROCESS = + this.applyByPostProcess), + (t.IMAGEPROCESSING = + t.VIGNETTE || + t.TONEMAPPING || + t.CONTRAST || + t.EXPOSURE || + t.COLORCURVES || + t.COLORGRADING); + }), + (e.prototype.isReady = function () { + return ( + !this.colorGradingEnabled || + !this.colorGradingTexture || + this.colorGradingTexture.isReady() + ); + }), + (e.prototype.bind = function (e, t) { + if ( + (void 0 === t && (t = 1), + this._colorCurvesEnabled && + this.colorCurves && + u.a.Bind(this.colorCurves, e), + this._vignetteEnabled) + ) { + var i = 1 / e.getEngine().getRenderWidth(), + n = 1 / e.getEngine().getRenderHeight(); + e.setFloat2("vInverseScreenSize", i, n); + var r = Math.tan(0.5 * this.vignetteCameraFov), + o = r * t, + s = Math.sqrt(o * r); + (o = a.h.Mix(o, s, this.vignetteStretch)), + (r = a.h.Mix(r, s, this.vignetteStretch)), + e.setFloat4( + "vignetteSettings1", + o, + r, + -o * this.vignetteCentreX, + -r * this.vignetteCentreY + ); + var c = -2 * this.vignetteWeight; + e.setFloat4( + "vignetteSettings2", + this.vignetteColor.r, + this.vignetteColor.g, + this.vignetteColor.b, + c + ); + } + if ( + (e.setFloat("exposureLinear", this.exposure), e.setFloat("contrast", this.contrast), - this.colorGradingTexture) { - e.setTexture("txColorTransform", this.colorGradingTexture); - var l = this.colorGradingTexture.getSize().height; - e.setFloat4("colorTransformSettings", (l - 1) / l, .5 / l, l, this.colorGradingTexture.level) - } - } - , - e.prototype.clone = function() { - return r.a.Clone(function() { - return new e - }, this) - } - , - e.prototype.serialize = function() { - return r.a.Serialize(this) - } - , - e.Parse = function(t) { - return r.a.Parse(function() { - return new e - }, t, null, null) - } - , - Object.defineProperty(e, "VIGNETTEMODE_MULTIPLY", { - get: function() { - return this._VIGNETTEMODE_MULTIPLY + this.colorGradingTexture) + ) { + e.setTexture( + "txColorTransform", + this.colorGradingTexture + ); + var l = this.colorGradingTexture.getSize().height; + e.setFloat4( + "colorTransformSettings", + (l - 1) / l, + 0.5 / l, + l, + this.colorGradingTexture.level + ); + } + }), + (e.prototype.clone = function () { + return r.a.Clone(function () { + return new e(); + }, this); + }), + (e.prototype.serialize = function () { + return r.a.Serialize(this); + }), + (e.Parse = function (t) { + return r.a.Parse( + function () { + return new e(); }, - enumerable: true, - configurable: true + t, + null, + null + ); + }), + Object.defineProperty(e, "VIGNETTEMODE_MULTIPLY", { + get: function () { + return this._VIGNETTEMODE_MULTIPLY; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "VIGNETTEMODE_OPAQUE", { - get: function() { - return this._VIGNETTEMODE_OPAQUE - }, - enumerable: true, - configurable: true + get: function () { + return this._VIGNETTEMODE_OPAQUE; + }, + enumerable: true, + configurable: true, }), - e.TONEMAPPING_STANDARD = 0, - e.TONEMAPPING_ACES = 1, - e._VIGNETTEMODE_MULTIPLY = 0, - e._VIGNETTEMODE_OPAQUE = 1, + (e.TONEMAPPING_STANDARD = 0), + (e.TONEMAPPING_ACES = 1), + (e._VIGNETTEMODE_MULTIPLY = 0), + (e._VIGNETTEMODE_OPAQUE = 1), n.c([Object(r.g)()], e.prototype, "colorCurves", void 0), - n.c([Object(r.c)()], e.prototype, "_colorCurvesEnabled", void 0), - n.c([Object(r.m)("colorGradingTexture")], e.prototype, "_colorGradingTexture", void 0), - n.c([Object(r.c)()], e.prototype, "_colorGradingEnabled", void 0), - n.c([Object(r.c)()], e.prototype, "_colorGradingWithGreenDepth", void 0), - n.c([Object(r.c)()], e.prototype, "_colorGradingBGR", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "_colorCurvesEnabled", + void 0 + ), + n.c( + [Object(r.m)("colorGradingTexture")], + e.prototype, + "_colorGradingTexture", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_colorGradingEnabled", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_colorGradingWithGreenDepth", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_colorGradingBGR", + void 0 + ), n.c([Object(r.c)()], e.prototype, "_exposure", void 0), - n.c([Object(r.c)()], e.prototype, "_toneMappingEnabled", void 0), - n.c([Object(r.c)()], e.prototype, "_toneMappingType", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "_toneMappingEnabled", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_toneMappingType", + void 0 + ), n.c([Object(r.c)()], e.prototype, "_contrast", void 0), - n.c([Object(r.c)()], e.prototype, "vignetteStretch", void 0), - n.c([Object(r.c)()], e.prototype, "vignetteCentreX", void 0), - n.c([Object(r.c)()], e.prototype, "vignetteCentreY", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "vignetteStretch", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "vignetteCentreX", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "vignetteCentreY", + void 0 + ), n.c([Object(r.c)()], e.prototype, "vignetteWeight", void 0), n.c([Object(r.f)()], e.prototype, "vignetteColor", void 0), - n.c([Object(r.c)()], e.prototype, "vignetteCameraFov", void 0), - n.c([Object(r.c)()], e.prototype, "_vignetteBlendMode", void 0), - n.c([Object(r.c)()], e.prototype, "_vignetteEnabled", void 0), - n.c([Object(r.c)()], e.prototype, "_applyByPostProcess", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "vignetteCameraFov", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_vignetteBlendMode", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_vignetteEnabled", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_applyByPostProcess", + void 0 + ), n.c([Object(r.c)()], e.prototype, "_isEnabled", void 0), e - }(); - r.a._ImageProcessingConfigurationParser = h.Parse - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }); - var n = function(e, t) { - return e ? e.getClassName && "Mesh" === e.getClassName() ? null : e.getClassName && "SubMesh" === e.getClassName() ? e.clone(t) : e.clone ? e.clone() : null : null - } - , r = function() { - function e() {} - return e.DeepCopy = function(e, t, i, r) { - for (var o in e) - if (("_" !== o[0] || r && -1 !== r.indexOf(o)) && (!i || -1 === i.indexOf(o))) { - var a = e[o] - , s = c(a); - if ("function" !== s) - try { - if ("object" === s) - if (a instanceof Array) { - if (t[o] = [], - a.length > 0) - if ("object" == c(a[0])) - for (var u = 0; u < a.length; u++) { - var l = n(a[u], t); - -1 === t[o].indexOf(l) && t[o].push(l) - } - else - t[o] = a.slice(0) - } else - t[o] = n(a, t); - else - t[o] = a - } catch (e) {} - } - } - , + ); + })(); + r.a._ImageProcessingConfigurationParser = h.Parse; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }); + var n = function (e, t) { + return e + ? e.getClassName && "Mesh" === e.getClassName() + ? null + : e.getClassName && "SubMesh" === e.getClassName() + ? e.clone(t) + : e.clone + ? e.clone() + : null + : null; + }, + r = (function () { + function e() {} + return ( + (e.DeepCopy = function (e, t, i, r) { + for (var o in e) + if ( + ("_" !== o[0] || (r && -1 !== r.indexOf(o))) && + (!i || -1 === i.indexOf(o)) + ) { + var a = e[o], + s = c(a); + if ("function" !== s) + try { + if ("object" === s) + if (a instanceof Array) { + if (((t[o] = []), a.length > 0)) + if ("object" == c(a[0])) + for (var u = 0; u < a.length; u++) { + var l = n(a[u], t); + -1 === t[o].indexOf(l) && t[o].push(l); + } + else t[o] = a.slice(0); + } else t[o] = n(a, t); + else t[o] = a; + } catch (e) {} + } + }), e - }() - } - , function(e, t, getterFunc) { - "use strict"; - var n = getterFunc(1); - var r = getterFunc(2); - var o = getterFunc(28); - var vec3Math = getterFunc(16); - var s = getterFunc(0); - var c = getterFunc(4); - var u = getterFunc(31); - var l = getterFunc(5); - var h = getterFunc(64); - var f = getterFunc(75); - var d = getterFunc(15); - var p = getterFunc(7); - var m = getterFunc(22); - var g = getterFunc(18); - - l.a.IncludesShadersStore.defaultFragmentDeclaration = "uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif"; - l.a.IncludesShadersStore.defaultUboDeclaration = "layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor;\nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nfloat visibility;\nvec4 vDiffuseColor;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};\n", + ); + })(); + }, + function (e, t, getterFunc) { + "use strict"; + var n = getterFunc(1); + var r = getterFunc(2); + var o = getterFunc(28); + var vec3Math = getterFunc(16); + var s = getterFunc(0); + var c = getterFunc(4); + var u = getterFunc(31); + var l = getterFunc(5); + var h = getterFunc(64); + var f = getterFunc(75); + var d = getterFunc(15); + var p = getterFunc(7); + var m = getterFunc(22); + var g = getterFunc(18); + + l.a.IncludesShadersStore.defaultFragmentDeclaration = + "uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif"; + (l.a.IncludesShadersStore.defaultUboDeclaration = + "layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor;\nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nfloat visibility;\nvec4 vDiffuseColor;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};\n"), getterFunc(56), getterFunc(84), getterFunc(85), getterFunc(120), getterFunc(112); - l.a.IncludesShadersStore.fresnelFunction = "#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif", + (l.a.IncludesShadersStore.fresnelFunction = + "#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif"), getterFunc(113), getterFunc(86), getterFunc(87), @@ -41192,8 +51594,10 @@ and limitations under the License. getterFunc(114), getterFunc(115), getterFunc(99); - l.a.ShadersStore.defaultPixelShader = "#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\n#if SPECULARDIRECTUV == 1\n#define vSpecularUV vMainUV1\n#elif SPECULARDIRECTUV == 2\n#define vSpecularUV vMainUV2\n#else\nvarying vec2 vSpecularUV;\n#endif\nuniform sampler2D specularSampler;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n\n#include\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\n#include[0..maxSimultaneousLights]\n\nvec3 refractionColor=vec3(0.,0.,0.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=textureCube(refractionCubeSampler,refractionVector).rgb;\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords).rgb;\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor=toGammaSpace(refractionColor);\n#endif\nrefractionColor*=vRefractionInfos.x;\n#endif\n\nvec3 reflectionColor=vec3(0.,0.,0.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias).rgb;\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW).rgb;\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords).rgb;\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor=toGammaSpace(reflectionColor);\n#endif\nreflectionColor*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+emissiveColor+refractionColor,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+refractionColor,alpha);\n#endif\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor;\n#else\ncolor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\ngl_FragColor=color;\n}\n"; - l.a.IncludesShadersStore.defaultVertexDeclaration = "\nuniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n", + l.a.ShadersStore.defaultPixelShader = + "#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\n#if SPECULARDIRECTUV == 1\n#define vSpecularUV vMainUV1\n#elif SPECULARDIRECTUV == 2\n#define vSpecularUV vMainUV2\n#else\nvarying vec2 vSpecularUV;\n#endif\nuniform sampler2D specularSampler;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n\n#include\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\n#include[0..maxSimultaneousLights]\n\nvec3 refractionColor=vec3(0.,0.,0.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=textureCube(refractionCubeSampler,refractionVector).rgb;\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords).rgb;\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor=toGammaSpace(refractionColor);\n#endif\nrefractionColor*=vRefractionInfos.x;\n#endif\n\nvec3 reflectionColor=vec3(0.,0.,0.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias).rgb;\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW).rgb;\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords).rgb;\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor=toGammaSpace(reflectionColor);\n#endif\nreflectionColor*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+emissiveColor+refractionColor,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+refractionColor,alpha);\n#endif\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor;\n#else\ncolor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\ngl_FragColor=color;\n}\n"; + (l.a.IncludesShadersStore.defaultVertexDeclaration = + "\nuniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n"), getterFunc(67), getterFunc(68), getterFunc(124), @@ -41208,528 +51612,833 @@ and limitations under the License. getterFunc(90), getterFunc(116), getterFunc(117), - l.a.IncludesShadersStore.pointCloudVertex = "#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif", + (l.a.IncludesShadersStore.pointCloudVertex = + "#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif"), getterFunc(118); - l.a.ShadersStore.defaultVertexShader = "#include<__decl__defaultVertex>\n\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nvarying vec2 vSpecularUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(position,1.0)).xyz;\n#else\nvPositionUVW=position;\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(positionUpdated,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#endif\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n"; - var _ = getterFunc(3); - getterFunc.d(t, "b", function() { - return v - }), - getterFunc.d(t, "a", function() { - return y + l.a.ShadersStore.defaultVertexShader = + "#include<__decl__defaultVertex>\n\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nvarying vec2 vSpecularUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(position,1.0)).xyz;\n#else\nvPositionUVW=position;\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(positionUpdated,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#endif\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n"; + var _ = getterFunc(3); + getterFunc.d(t, "b", function () { + return v; + }), + getterFunc.d(t, "a", function () { + return y; }); - var v = function(e) { - function t() { - var t = e.call(this) || this; - return t.MAINUV1 = false, - t.MAINUV2 = false, - t.DIFFUSE = false, - t.DIFFUSEDIRECTUV = 0, - t.AMBIENT = false, - t.AMBIENTDIRECTUV = 0, - t.OPACITY = false, - t.OPACITYDIRECTUV = 0, - t.OPACITYRGB = false, - t.REFLECTION = false, - t.EMISSIVE = false, - t.EMISSIVEDIRECTUV = 0, - t.SPECULAR = false, - t.SPECULARDIRECTUV = 0, - t.BUMP = false, - t.BUMPDIRECTUV = 0, - t.PARALLAX = false, - t.PARALLAXOCCLUSION = false, - t.SPECULAROVERALPHA = false, - t.CLIPPLANE = false, - t.CLIPPLANE2 = false, - t.CLIPPLANE3 = false, - t.CLIPPLANE4 = false, - t.ALPHATEST = false, - t.DEPTHPREPASS = false, - t.ALPHAFROMDIFFUSE = false, - t.POINTSIZE = false, - t.FOG = false, - t.SPECULARTERM = false, - t.DIFFUSEFRESNEL = false, - t.OPACITYFRESNEL = false, - t.REFLECTIONFRESNEL = false, - t.REFRACTIONFRESNEL = false, - t.EMISSIVEFRESNEL = false, - t.FRESNEL = false, - t.NORMAL = false, - t.UV1 = false, - t.UV2 = false, - t.VERTEXCOLOR = false, - t.VERTEXALPHA = false, - t.NUM_BONE_INFLUENCERS = 0, - t.BonesPerMesh = 0, - t.BONETEXTURE = false, - t.INSTANCES = false, - t.GLOSSINESS = false, - t.ROUGHNESS = false, - t.EMISSIVEASILLUMINATION = false, - t.LINKEMISSIVEWITHDIFFUSE = false, - t.REFLECTIONFRESNELFROMSPECULAR = false, - t.LIGHTMAP = false, - t.LIGHTMAPDIRECTUV = 0, - t.OBJECTSPACE_NORMALMAP = false, - t.USELIGHTMAPASSHADOWMAP = false, - t.REFLECTIONMAP_3D = false, - t.REFLECTIONMAP_SPHERICAL = false, - t.REFLECTIONMAP_PLANAR = false, - t.REFLECTIONMAP_CUBIC = false, - t.USE_LOCAL_REFLECTIONMAP_CUBIC = false, - t.REFLECTIONMAP_PROJECTION = false, - t.REFLECTIONMAP_SKYBOX = false, - t.REFLECTIONMAP_SKYBOX_TRANSFORMED = false, - t.REFLECTIONMAP_EXPLICIT = false, - t.REFLECTIONMAP_EQUIRECTANGULAR = false, - t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false, - t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false, - t.INVERTCUBICMAP = false, - t.LOGARITHMICDEPTH = false, - t.REFRACTION = false, - t.REFRACTIONMAP_3D = false, - t.REFLECTIONOVERALPHA = false, - t.TWOSIDEDLIGHTING = false, - t.SHADOWFLOAT = false, - t.MORPHTARGETS = false, - t.MORPHTARGETS_NORMAL = false, - t.MORPHTARGETS_TANGENT = false, - t.NUM_MORPH_INFLUENCERS = 0, - t.NONUNIFORMSCALING = false, - t.PREMULTIPLYALPHA = false, - t.IMAGEPROCESSING = false, - t.VIGNETTE = false, - t.VIGNETTEBLENDMODEMULTIPLY = false, - t.VIGNETTEBLENDMODEOPAQUE = false, - t.TONEMAPPING = false, - t.TONEMAPPING_ACES = false, - t.CONTRAST = false, - t.COLORCURVES = false, - t.COLORGRADING = false, - t.COLORGRADING3D = false, - t.SAMPLER3DGREENDEPTH = false, - t.SAMPLER3DBGRMAP = false, - t.IMAGEPROCESSINGPOSTPROCESS = false, - t.MULTIVIEW = false, - t.IS_REFLECTION_LINEAR = false, - t.IS_REFRACTION_LINEAR = false, - t.EXPOSURE = false, - t.rebuild(), - t - } - return n.d(t, e), - t.prototype.setReflectionMode = function(e) { - for (var t = 0, i = ["REFLECTIONMAP_CUBIC", "REFLECTIONMAP_EXPLICIT", "REFLECTIONMAP_PLANAR", "REFLECTIONMAP_PROJECTION", "REFLECTIONMAP_PROJECTION", "REFLECTIONMAP_SKYBOX", "REFLECTIONMAP_SPHERICAL", "REFLECTIONMAP_EQUIRECTANGULAR", "REFLECTIONMAP_EQUIRECTANGULAR_FIXED", "REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"]; t < i.length; t++) { - var n = i[t]; - this[n] = n === e - } - } - , + var v = (function (e) { + function t() { + var t = e.call(this) || this; + return ( + (t.MAINUV1 = false), + (t.MAINUV2 = false), + (t.DIFFUSE = false), + (t.DIFFUSEDIRECTUV = 0), + (t.AMBIENT = false), + (t.AMBIENTDIRECTUV = 0), + (t.OPACITY = false), + (t.OPACITYDIRECTUV = 0), + (t.OPACITYRGB = false), + (t.REFLECTION = false), + (t.EMISSIVE = false), + (t.EMISSIVEDIRECTUV = 0), + (t.SPECULAR = false), + (t.SPECULARDIRECTUV = 0), + (t.BUMP = false), + (t.BUMPDIRECTUV = 0), + (t.PARALLAX = false), + (t.PARALLAXOCCLUSION = false), + (t.SPECULAROVERALPHA = false), + (t.CLIPPLANE = false), + (t.CLIPPLANE2 = false), + (t.CLIPPLANE3 = false), + (t.CLIPPLANE4 = false), + (t.ALPHATEST = false), + (t.DEPTHPREPASS = false), + (t.ALPHAFROMDIFFUSE = false), + (t.POINTSIZE = false), + (t.FOG = false), + (t.SPECULARTERM = false), + (t.DIFFUSEFRESNEL = false), + (t.OPACITYFRESNEL = false), + (t.REFLECTIONFRESNEL = false), + (t.REFRACTIONFRESNEL = false), + (t.EMISSIVEFRESNEL = false), + (t.FRESNEL = false), + (t.NORMAL = false), + (t.UV1 = false), + (t.UV2 = false), + (t.VERTEXCOLOR = false), + (t.VERTEXALPHA = false), + (t.NUM_BONE_INFLUENCERS = 0), + (t.BonesPerMesh = 0), + (t.BONETEXTURE = false), + (t.INSTANCES = false), + (t.GLOSSINESS = false), + (t.ROUGHNESS = false), + (t.EMISSIVEASILLUMINATION = false), + (t.LINKEMISSIVEWITHDIFFUSE = false), + (t.REFLECTIONFRESNELFROMSPECULAR = false), + (t.LIGHTMAP = false), + (t.LIGHTMAPDIRECTUV = 0), + (t.OBJECTSPACE_NORMALMAP = false), + (t.USELIGHTMAPASSHADOWMAP = false), + (t.REFLECTIONMAP_3D = false), + (t.REFLECTIONMAP_SPHERICAL = false), + (t.REFLECTIONMAP_PLANAR = false), + (t.REFLECTIONMAP_CUBIC = false), + (t.USE_LOCAL_REFLECTIONMAP_CUBIC = false), + (t.REFLECTIONMAP_PROJECTION = false), + (t.REFLECTIONMAP_SKYBOX = false), + (t.REFLECTIONMAP_SKYBOX_TRANSFORMED = false), + (t.REFLECTIONMAP_EXPLICIT = false), + (t.REFLECTIONMAP_EQUIRECTANGULAR = false), + (t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false), + (t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false), + (t.INVERTCUBICMAP = false), + (t.LOGARITHMICDEPTH = false), + (t.REFRACTION = false), + (t.REFRACTIONMAP_3D = false), + (t.REFLECTIONOVERALPHA = false), + (t.TWOSIDEDLIGHTING = false), + (t.SHADOWFLOAT = false), + (t.MORPHTARGETS = false), + (t.MORPHTARGETS_NORMAL = false), + (t.MORPHTARGETS_TANGENT = false), + (t.NUM_MORPH_INFLUENCERS = 0), + (t.NONUNIFORMSCALING = false), + (t.PREMULTIPLYALPHA = false), + (t.IMAGEPROCESSING = false), + (t.VIGNETTE = false), + (t.VIGNETTEBLENDMODEMULTIPLY = false), + (t.VIGNETTEBLENDMODEOPAQUE = false), + (t.TONEMAPPING = false), + (t.TONEMAPPING_ACES = false), + (t.CONTRAST = false), + (t.COLORCURVES = false), + (t.COLORGRADING = false), + (t.COLORGRADING3D = false), + (t.SAMPLER3DGREENDEPTH = false), + (t.SAMPLER3DBGRMAP = false), + (t.IMAGEPROCESSINGPOSTPROCESS = false), + (t.MULTIVIEW = false), + (t.IS_REFLECTION_LINEAR = false), + (t.IS_REFRACTION_LINEAR = false), + (t.EXPOSURE = false), + t.rebuild(), + t + ); + } + return ( + n.d(t, e), + (t.prototype.setReflectionMode = function (e) { + for ( + var t = 0, + i = [ + "REFLECTIONMAP_CUBIC", + "REFLECTIONMAP_EXPLICIT", + "REFLECTIONMAP_PLANAR", + "REFLECTIONMAP_PROJECTION", + "REFLECTIONMAP_PROJECTION", + "REFLECTIONMAP_SKYBOX", + "REFLECTIONMAP_SPHERICAL", + "REFLECTIONMAP_EQUIRECTANGULAR", + "REFLECTIONMAP_EQUIRECTANGULAR_FIXED", + "REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED", + ]; + t < i.length; + t++ + ) { + var n = i[t]; + this[n] = n === e; + } + }), t - }(h.a) - , y = function(e) { - function t(i, n) { - var r = e.call(this, i, n) || this; - return r._diffuseTexture = null, - r._ambientTexture = null, - r._opacityTexture = null, - r._reflectionTexture = null, - r._emissiveTexture = null, - r._specularTexture = null, - r._bumpTexture = null, - r._lightmapTexture = null, - r._refractionTexture = null, - r.ambientColor = new s.e(0,0,0), - r.diffuseColor = new s.e(1,1,1), - r.specularColor = new s.e(1,1,1), - r.emissiveColor = new s.e(0,0,0), - r.specularPower = 64, - r._useAlphaFromDiffuseTexture = false, - r._useEmissiveAsIllumination = false, - r._linkEmissiveWithDiffuse = false, - r._useSpecularOverAlpha = false, - r._useReflectionOverAlpha = false, - r._disableLighting = false, - r._useObjectSpaceNormalMap = false, - r._useParallax = false, - r._useParallaxOcclusion = false, - r.parallaxScaleBias = .05, - r._roughness = 0, - r.indexOfRefraction = .98, - r.invertRefractionY = true, - r.alphaCutOff = .4, - r._useLightmapAsShadowmap = false, - r._useReflectionFresnelFromSpecular = false, - r._useGlossinessFromSpecularMapAlpha = false, - r._maxSimultaneousLights = 4, - r._invertNormalMapX = false, - r._invertNormalMapY = false, - r._twoSidedLighting = false, - r._renderTargets = new o.a(16), - r._worldViewProjectionMatrix = s.j.Zero(), - r._globalAmbientColor = new s.e(0,0,0), - r._attachImageProcessingConfiguration(null), - r.getRenderTargetTextures = function() { - return r._renderTargets.reset(), - t.ReflectionTextureEnabled && r._reflectionTexture && r._reflectionTexture.isRenderTarget && r._renderTargets.push(r._reflectionTexture), - t.RefractionTextureEnabled && r._refractionTexture && r._refractionTexture.isRenderTarget && r._renderTargets.push(r._refractionTexture), - r._renderTargets - } - , - r - } - return n.d(t, e), - Object.defineProperty(t.prototype, "imageProcessingConfiguration", { - get: function() { - return this._imageProcessingConfiguration + ); + })(h.a), + y = (function (e) { + function t(i, n) { + var r = e.call(this, i, n) || this; + return ( + (r._diffuseTexture = null), + (r._ambientTexture = null), + (r._opacityTexture = null), + (r._reflectionTexture = null), + (r._emissiveTexture = null), + (r._specularTexture = null), + (r._bumpTexture = null), + (r._lightmapTexture = null), + (r._refractionTexture = null), + (r.ambientColor = new s.e(0, 0, 0)), + (r.diffuseColor = new s.e(1, 1, 1)), + (r.specularColor = new s.e(1, 1, 1)), + (r.emissiveColor = new s.e(0, 0, 0)), + (r.specularPower = 64), + (r._useAlphaFromDiffuseTexture = false), + (r._useEmissiveAsIllumination = false), + (r._linkEmissiveWithDiffuse = false), + (r._useSpecularOverAlpha = false), + (r._useReflectionOverAlpha = false), + (r._disableLighting = false), + (r._useObjectSpaceNormalMap = false), + (r._useParallax = false), + (r._useParallaxOcclusion = false), + (r.parallaxScaleBias = 0.05), + (r._roughness = 0), + (r.indexOfRefraction = 0.98), + (r.invertRefractionY = true), + (r.alphaCutOff = 0.4), + (r._useLightmapAsShadowmap = false), + (r._useReflectionFresnelFromSpecular = false), + (r._useGlossinessFromSpecularMapAlpha = false), + (r._maxSimultaneousLights = 4), + (r._invertNormalMapX = false), + (r._invertNormalMapY = false), + (r._twoSidedLighting = false), + (r._renderTargets = new o.a(16)), + (r._worldViewProjectionMatrix = s.j.Zero()), + (r._globalAmbientColor = new s.e(0, 0, 0)), + r._attachImageProcessingConfiguration(null), + (r.getRenderTargetTextures = function () { + return ( + r._renderTargets.reset(), + t.ReflectionTextureEnabled && + r._reflectionTexture && + r._reflectionTexture.isRenderTarget && + r._renderTargets.push(r._reflectionTexture), + t.RefractionTextureEnabled && + r._refractionTexture && + r._refractionTexture.isRenderTarget && + r._renderTargets.push(r._refractionTexture), + r._renderTargets + ); + }), + r + ); + } + return ( + n.d(t, e), + Object.defineProperty( + t.prototype, + "imageProcessingConfiguration", + { + get: function () { + return this._imageProcessingConfiguration; }, - set: function(e) { - this._attachImageProcessingConfiguration(e), - this._markAllSubMeshesAsTexturesDirty() + set: function (e) { + this._attachImageProcessingConfiguration(e), + this._markAllSubMeshesAsTexturesDirty(); }, enumerable: true, - configurable: true - }), - t.prototype._attachImageProcessingConfiguration = function(e) { + configurable: true, + } + ), + (t.prototype._attachImageProcessingConfiguration = + function (e) { var t = this; - e !== this._imageProcessingConfiguration && (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), - this._imageProcessingConfiguration = e || this.getScene().imageProcessingConfiguration, - this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() { - t._markAllSubMeshesAsImageProcessingDirty() - }))) - } - , - Object.defineProperty(t.prototype, "cameraColorCurvesEnabled", { - get: function() { - return this.imageProcessingConfiguration.colorCurvesEnabled + e !== this._imageProcessingConfiguration && + (this._imageProcessingConfiguration && + this._imageProcessingObserver && + this._imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingObserver + ), + (this._imageProcessingConfiguration = + e || this.getScene().imageProcessingConfiguration), + this._imageProcessingConfiguration && + (this._imageProcessingObserver = + this._imageProcessingConfiguration.onUpdateParameters.add( + function () { + t._markAllSubMeshesAsImageProcessingDirty(); + } + ))); + }), + Object.defineProperty( + t.prototype, + "cameraColorCurvesEnabled", + { + get: function () { + return this.imageProcessingConfiguration + .colorCurvesEnabled; }, - set: function(e) { - this.imageProcessingConfiguration.colorCurvesEnabled = e + set: function (e) { + this.imageProcessingConfiguration.colorCurvesEnabled = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraColorGradingEnabled", { - get: function() { - return this.imageProcessingConfiguration.colorGradingEnabled + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "cameraColorGradingEnabled", + { + get: function () { + return this.imageProcessingConfiguration + .colorGradingEnabled; }, - set: function(e) { - this.imageProcessingConfiguration.colorGradingEnabled = e + set: function (e) { + this.imageProcessingConfiguration.colorGradingEnabled = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraToneMappingEnabled", { - get: function() { - return this._imageProcessingConfiguration.toneMappingEnabled + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "cameraToneMappingEnabled", + { + get: function () { + return this._imageProcessingConfiguration + .toneMappingEnabled; }, - set: function(e) { - this._imageProcessingConfiguration.toneMappingEnabled = e + set: function (e) { + this._imageProcessingConfiguration.toneMappingEnabled = + e; }, enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "cameraExposure", { - get: function() { - return this._imageProcessingConfiguration.exposure - }, - set: function(e) { - this._imageProcessingConfiguration.exposure = e - }, - enumerable: true, - configurable: true + get: function () { + return this._imageProcessingConfiguration.exposure; + }, + set: function (e) { + this._imageProcessingConfiguration.exposure = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "cameraContrast", { - get: function() { - return this._imageProcessingConfiguration.contrast + get: function () { + return this._imageProcessingConfiguration.contrast; + }, + set: function (e) { + this._imageProcessingConfiguration.contrast = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "cameraColorGradingTexture", + { + get: function () { + return this._imageProcessingConfiguration + .colorGradingTexture; }, - set: function(e) { - this._imageProcessingConfiguration.contrast = e + set: function (e) { + this._imageProcessingConfiguration.colorGradingTexture = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraColorGradingTexture", { - get: function() { - return this._imageProcessingConfiguration.colorGradingTexture - }, - set: function(e) { - this._imageProcessingConfiguration.colorGradingTexture = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "cameraColorCurves", { - get: function() { - return this._imageProcessingConfiguration.colorCurves - }, - set: function(e) { - this._imageProcessingConfiguration.colorCurves = e + get: function () { + return this._imageProcessingConfiguration.colorCurves; + }, + set: function (e) { + this._imageProcessingConfiguration.colorCurves = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "hasRenderTargetTextures", + { + get: function () { + return ( + !!( + t.ReflectionTextureEnabled && + this._reflectionTexture && + this._reflectionTexture.isRenderTarget + ) || + !!( + t.RefractionTextureEnabled && + this._refractionTexture && + this._refractionTexture.isRenderTarget + ) + ); }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype.getClassName = function () { + return "StandardMaterial"; }), - Object.defineProperty(t.prototype, "hasRenderTargetTextures", { - get: function() { - return !!(t.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) || !!(t.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) - }, - enumerable: true, - configurable: true - }), - t.prototype.getClassName = function() { - return "StandardMaterial" - } - , Object.defineProperty(t.prototype, "useLogarithmicDepth", { - get: function() { - return this._useLogarithmicDepth - }, - set: function(e) { - this._useLogarithmicDepth = e && this.getScene().getEngine().getCaps().fragmentDepthSupported, - this._markAllSubMeshesAsMiscDirty() - }, - enumerable: true, - configurable: true + get: function () { + return this._useLogarithmicDepth; + }, + set: function (e) { + (this._useLogarithmicDepth = + e && + this.getScene().getEngine().getCaps() + .fragmentDepthSupported), + this._markAllSubMeshesAsMiscDirty(); + }, + enumerable: true, + configurable: true, }), - t.prototype.needAlphaBlending = function() { - return this.alpha < 1 || null != this._opacityTexture || this._shouldUseAlphaFromDiffuseTexture() || this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled - } - , - t.prototype.needAlphaTesting = function() { - return null != this._diffuseTexture && this._diffuseTexture.hasAlpha - } - , - t.prototype._shouldUseAlphaFromDiffuseTexture = function() { - return null != this._diffuseTexture && this._diffuseTexture.hasAlpha && this._useAlphaFromDiffuseTexture - } - , - t.prototype.getAlphaTestTexture = function() { - return this._diffuseTexture - } - , - t.prototype.isReadyForSubMesh = function(e, i, n) { - if (void 0 === n && (n = false), + (t.prototype.needAlphaBlending = function () { + return ( + this.alpha < 1 || + null != this._opacityTexture || + this._shouldUseAlphaFromDiffuseTexture() || + (this._opacityFresnelParameters && + this._opacityFresnelParameters.isEnabled) + ); + }), + (t.prototype.needAlphaTesting = function () { + return ( + null != this._diffuseTexture && + this._diffuseTexture.hasAlpha + ); + }), + (t.prototype._shouldUseAlphaFromDiffuseTexture = + function () { + return ( + null != this._diffuseTexture && + this._diffuseTexture.hasAlpha && + this._useAlphaFromDiffuseTexture + ); + }), + (t.prototype.getAlphaTestTexture = function () { + return this._diffuseTexture; + }), + (t.prototype.isReadyForSubMesh = function (e, i, n) { + if ( + (void 0 === n && (n = false), i.effect && this.isFrozen && this._wasPreviouslyReady) - return true; - i._materialDefines || (i._materialDefines = new v); - var r = this.getScene() - , o = i._materialDefines; - if (!this.checkReadyOnEveryCall && i.effect && o._renderId === r.getRenderId()) - return true; - var a = r.getEngine(); - if (o._needNormals = d.a.PrepareDefinesForLights(r, e, o, true, this._maxSimultaneousLights, this._disableLighting), + ) + return true; + i._materialDefines || (i._materialDefines = new v()); + var r = this.getScene(), + o = i._materialDefines; + if ( + !this.checkReadyOnEveryCall && + i.effect && + o._renderId === r.getRenderId() + ) + return true; + var a = r.getEngine(); + if ( + ((o._needNormals = d.a.PrepareDefinesForLights( + r, + e, + o, + true, + this._maxSimultaneousLights, + this._disableLighting + )), d.a.PrepareDefinesForMultiview(r, o), - o._areTexturesDirty) { - if (o._needUVs = false, - o.MAINUV1 = false, - o.MAINUV2 = false, - r.texturesEnabled) { - if (this._diffuseTexture && t.DiffuseTextureEnabled) { - if (!this._diffuseTexture.isReadyOrNotBlocking()) - return false; - d.a.PrepareDefinesForMergedUV(this._diffuseTexture, o, "DIFFUSE") - } else - o.DIFFUSE = false; - if (this._ambientTexture && t.AmbientTextureEnabled) { - if (!this._ambientTexture.isReadyOrNotBlocking()) - return false; - d.a.PrepareDefinesForMergedUV(this._ambientTexture, o, "AMBIENT") - } else - o.AMBIENT = false; - if (this._opacityTexture && t.OpacityTextureEnabled) { - if (!this._opacityTexture.isReadyOrNotBlocking()) - return false; - d.a.PrepareDefinesForMergedUV(this._opacityTexture, o, "OPACITY"), - o.OPACITYRGB = this._opacityTexture.getAlphaFromRGB - } else - o.OPACITY = false; - if (this._reflectionTexture && t.ReflectionTextureEnabled) { - if (!this._reflectionTexture.isReadyOrNotBlocking()) - return false; - switch (o._needNormals = true, - o.REFLECTION = true, - o.ROUGHNESS = this._roughness > 0, - o.REFLECTIONOVERALPHA = this._useReflectionOverAlpha, - o.INVERTCUBICMAP = this._reflectionTexture.coordinatesMode === p.a.INVCUBIC_MODE, - o.REFLECTIONMAP_3D = this._reflectionTexture.isCube, - this._reflectionTexture.coordinatesMode) { - case p.a.EXPLICIT_MODE: - o.setReflectionMode("REFLECTIONMAP_EXPLICIT"); - break; - case p.a.PLANAR_MODE: - o.setReflectionMode("REFLECTIONMAP_PLANAR"); - break; - case p.a.PROJECTION_MODE: - o.setReflectionMode("REFLECTIONMAP_PROJECTION"); - break; - case p.a.SKYBOX_MODE: - o.setReflectionMode("REFLECTIONMAP_SKYBOX"), - o.REFLECTIONMAP_SKYBOX_TRANSFORMED = !this._reflectionTexture.getReflectionTextureMatrix().isIdentity(); - break; - case p.a.SPHERICAL_MODE: - o.setReflectionMode("REFLECTIONMAP_SPHERICAL"); - break; - case p.a.EQUIRECTANGULAR_MODE: - o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR"); - break; - case p.a.FIXED_EQUIRECTANGULAR_MODE: - o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED"); - break; - case p.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE: - o.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"); - break; - case p.a.CUBIC_MODE: - case p.a.INVCUBIC_MODE: - default: - o.setReflectionMode("REFLECTIONMAP_CUBIC") - } - o.USE_LOCAL_REFLECTIONMAP_CUBIC = !!this._reflectionTexture.boundingBoxSize - } else - o.REFLECTION = false; - if (this._emissiveTexture && t.EmissiveTextureEnabled) { - if (!this._emissiveTexture.isReadyOrNotBlocking()) - return false; - d.a.PrepareDefinesForMergedUV(this._emissiveTexture, o, "EMISSIVE") - } else - o.EMISSIVE = false; - if (this._lightmapTexture && t.LightmapTextureEnabled) { - if (!this._lightmapTexture.isReadyOrNotBlocking()) - return false; - d.a.PrepareDefinesForMergedUV(this._lightmapTexture, o, "LIGHTMAP"), - o.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap - } else - o.LIGHTMAP = false; - if (this._specularTexture && t.SpecularTextureEnabled) { - if (!this._specularTexture.isReadyOrNotBlocking()) - return false; - d.a.PrepareDefinesForMergedUV(this._specularTexture, o, "SPECULAR"), - o.GLOSSINESS = this._useGlossinessFromSpecularMapAlpha - } else - o.SPECULAR = false; - if (r.getEngine().getCaps().standardDerivatives && this._bumpTexture && t.BumpTextureEnabled) { - if (!this._bumpTexture.isReady()) - return false; - d.a.PrepareDefinesForMergedUV(this._bumpTexture, o, "BUMP"), - o.PARALLAX = this._useParallax, - o.PARALLAXOCCLUSION = this._useParallaxOcclusion, - o.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap - } else - o.BUMP = false; - if (this._refractionTexture && t.RefractionTextureEnabled) { - if (!this._refractionTexture.isReadyOrNotBlocking()) - return false; - o._needUVs = true, - o.REFRACTION = true, - o.REFRACTIONMAP_3D = this._refractionTexture.isCube - } else - o.REFRACTION = false; - o.TWOSIDEDLIGHTING = !this._backFaceCulling && this._twoSidedLighting - } else - o.DIFFUSE = false, - o.AMBIENT = false, - o.OPACITY = false, - o.REFLECTION = false, - o.EMISSIVE = false, - o.LIGHTMAP = false, - o.BUMP = false, - o.REFRACTION = false; - o.ALPHAFROMDIFFUSE = this._shouldUseAlphaFromDiffuseTexture(), - o.EMISSIVEASILLUMINATION = this._useEmissiveAsIllumination, - o.LINKEMISSIVEWITHDIFFUSE = this._linkEmissiveWithDiffuse, - o.SPECULAROVERALPHA = this._useSpecularOverAlpha, - o.PREMULTIPLYALPHA = this.alphaMode === _.a.ALPHA_PREMULTIPLIED || this.alphaMode === _.a.ALPHA_PREMULTIPLIED_PORTERDUFF - } - if (o._areImageProcessingDirty && this._imageProcessingConfiguration) { - if (!this._imageProcessingConfiguration.isReady()) - return false; - this._imageProcessingConfiguration.prepareDefines(o), - o.IS_REFLECTION_LINEAR = null != this.reflectionTexture && !this.reflectionTexture.gammaSpace, - o.IS_REFRACTION_LINEAR = null != this.refractionTexture && !this.refractionTexture.gammaSpace - } - if (o._areFresnelDirty && (t.FresnelEnabled ? (this._diffuseFresnelParameters || this._opacityFresnelParameters || this._emissiveFresnelParameters || this._refractionFresnelParameters || this._reflectionFresnelParameters) && (o.DIFFUSEFRESNEL = this._diffuseFresnelParameters && this._diffuseFresnelParameters.isEnabled, - o.OPACITYFRESNEL = this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled, - o.REFLECTIONFRESNEL = this._reflectionFresnelParameters && this._reflectionFresnelParameters.isEnabled, - o.REFLECTIONFRESNELFROMSPECULAR = this._useReflectionFresnelFromSpecular, - o.REFRACTIONFRESNEL = this._refractionFresnelParameters && this._refractionFresnelParameters.isEnabled, - o.EMISSIVEFRESNEL = this._emissiveFresnelParameters && this._emissiveFresnelParameters.isEnabled, - o._needNormals = true, - o.FRESNEL = true) : o.FRESNEL = false), - d.a.PrepareDefinesForMisc(e, r, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(e), o), + o._areTexturesDirty) + ) { + if ( + ((o._needUVs = false), + (o.MAINUV1 = false), + (o.MAINUV2 = false), + r.texturesEnabled) + ) { + if (this._diffuseTexture && t.DiffuseTextureEnabled) { + if (!this._diffuseTexture.isReadyOrNotBlocking()) + return false; + d.a.PrepareDefinesForMergedUV( + this._diffuseTexture, + o, + "DIFFUSE" + ); + } else o.DIFFUSE = false; + if (this._ambientTexture && t.AmbientTextureEnabled) { + if (!this._ambientTexture.isReadyOrNotBlocking()) + return false; + d.a.PrepareDefinesForMergedUV( + this._ambientTexture, + o, + "AMBIENT" + ); + } else o.AMBIENT = false; + if (this._opacityTexture && t.OpacityTextureEnabled) { + if (!this._opacityTexture.isReadyOrNotBlocking()) + return false; + d.a.PrepareDefinesForMergedUV( + this._opacityTexture, + o, + "OPACITY" + ), + (o.OPACITYRGB = + this._opacityTexture.getAlphaFromRGB); + } else o.OPACITY = false; + if ( + this._reflectionTexture && + t.ReflectionTextureEnabled + ) { + if (!this._reflectionTexture.isReadyOrNotBlocking()) + return false; + switch ( + ((o._needNormals = true), + (o.REFLECTION = true), + (o.ROUGHNESS = this._roughness > 0), + (o.REFLECTIONOVERALPHA = + this._useReflectionOverAlpha), + (o.INVERTCUBICMAP = + this._reflectionTexture.coordinatesMode === + p.a.INVCUBIC_MODE), + (o.REFLECTIONMAP_3D = + this._reflectionTexture.isCube), + this._reflectionTexture.coordinatesMode) + ) { + case p.a.EXPLICIT_MODE: + o.setReflectionMode("REFLECTIONMAP_EXPLICIT"); + break; + case p.a.PLANAR_MODE: + o.setReflectionMode("REFLECTIONMAP_PLANAR"); + break; + case p.a.PROJECTION_MODE: + o.setReflectionMode("REFLECTIONMAP_PROJECTION"); + break; + case p.a.SKYBOX_MODE: + o.setReflectionMode("REFLECTIONMAP_SKYBOX"), + (o.REFLECTIONMAP_SKYBOX_TRANSFORMED = + !this._reflectionTexture + .getReflectionTextureMatrix() + .isIdentity()); + break; + case p.a.SPHERICAL_MODE: + o.setReflectionMode("REFLECTIONMAP_SPHERICAL"); + break; + case p.a.EQUIRECTANGULAR_MODE: + o.setReflectionMode( + "REFLECTIONMAP_EQUIRECTANGULAR" + ); + break; + case p.a.FIXED_EQUIRECTANGULAR_MODE: + o.setReflectionMode( + "REFLECTIONMAP_EQUIRECTANGULAR_FIXED" + ); + break; + case p.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE: + o.setReflectionMode( + "REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED" + ); + break; + case p.a.CUBIC_MODE: + case p.a.INVCUBIC_MODE: + default: + o.setReflectionMode("REFLECTIONMAP_CUBIC"); + } + o.USE_LOCAL_REFLECTIONMAP_CUBIC = + !!this._reflectionTexture.boundingBoxSize; + } else o.REFLECTION = false; + if ( + this._emissiveTexture && + t.EmissiveTextureEnabled + ) { + if (!this._emissiveTexture.isReadyOrNotBlocking()) + return false; + d.a.PrepareDefinesForMergedUV( + this._emissiveTexture, + o, + "EMISSIVE" + ); + } else o.EMISSIVE = false; + if ( + this._lightmapTexture && + t.LightmapTextureEnabled + ) { + if (!this._lightmapTexture.isReadyOrNotBlocking()) + return false; + d.a.PrepareDefinesForMergedUV( + this._lightmapTexture, + o, + "LIGHTMAP" + ), + (o.USELIGHTMAPASSHADOWMAP = + this._useLightmapAsShadowmap); + } else o.LIGHTMAP = false; + if ( + this._specularTexture && + t.SpecularTextureEnabled + ) { + if (!this._specularTexture.isReadyOrNotBlocking()) + return false; + d.a.PrepareDefinesForMergedUV( + this._specularTexture, + o, + "SPECULAR" + ), + (o.GLOSSINESS = + this._useGlossinessFromSpecularMapAlpha); + } else o.SPECULAR = false; + if ( + r.getEngine().getCaps().standardDerivatives && + this._bumpTexture && + t.BumpTextureEnabled + ) { + if (!this._bumpTexture.isReady()) return false; + d.a.PrepareDefinesForMergedUV( + this._bumpTexture, + o, + "BUMP" + ), + (o.PARALLAX = this._useParallax), + (o.PARALLAXOCCLUSION = + this._useParallaxOcclusion), + (o.OBJECTSPACE_NORMALMAP = + this._useObjectSpaceNormalMap); + } else o.BUMP = false; + if ( + this._refractionTexture && + t.RefractionTextureEnabled + ) { + if (!this._refractionTexture.isReadyOrNotBlocking()) + return false; + (o._needUVs = true), + (o.REFRACTION = true), + (o.REFRACTIONMAP_3D = + this._refractionTexture.isCube); + } else o.REFRACTION = false; + o.TWOSIDEDLIGHTING = + !this._backFaceCulling && this._twoSidedLighting; + } else + (o.DIFFUSE = false), + (o.AMBIENT = false), + (o.OPACITY = false), + (o.REFLECTION = false), + (o.EMISSIVE = false), + (o.LIGHTMAP = false), + (o.BUMP = false), + (o.REFRACTION = false); + (o.ALPHAFROMDIFFUSE = + this._shouldUseAlphaFromDiffuseTexture()), + (o.EMISSIVEASILLUMINATION = + this._useEmissiveAsIllumination), + (o.LINKEMISSIVEWITHDIFFUSE = + this._linkEmissiveWithDiffuse), + (o.SPECULAROVERALPHA = this._useSpecularOverAlpha), + (o.PREMULTIPLYALPHA = + this.alphaMode === _.a.ALPHA_PREMULTIPLIED || + this.alphaMode === + _.a.ALPHA_PREMULTIPLIED_PORTERDUFF); + } + if ( + o._areImageProcessingDirty && + this._imageProcessingConfiguration + ) { + if (!this._imageProcessingConfiguration.isReady()) + return false; + this._imageProcessingConfiguration.prepareDefines(o), + (o.IS_REFLECTION_LINEAR = + null != this.reflectionTexture && + !this.reflectionTexture.gammaSpace), + (o.IS_REFRACTION_LINEAR = + null != this.refractionTexture && + !this.refractionTexture.gammaSpace); + } + if ( + (o._areFresnelDirty && + (t.FresnelEnabled + ? (this._diffuseFresnelParameters || + this._opacityFresnelParameters || + this._emissiveFresnelParameters || + this._refractionFresnelParameters || + this._reflectionFresnelParameters) && + ((o.DIFFUSEFRESNEL = + this._diffuseFresnelParameters && + this._diffuseFresnelParameters.isEnabled), + (o.OPACITYFRESNEL = + this._opacityFresnelParameters && + this._opacityFresnelParameters.isEnabled), + (o.REFLECTIONFRESNEL = + this._reflectionFresnelParameters && + this._reflectionFresnelParameters.isEnabled), + (o.REFLECTIONFRESNELFROMSPECULAR = + this._useReflectionFresnelFromSpecular), + (o.REFRACTIONFRESNEL = + this._refractionFresnelParameters && + this._refractionFresnelParameters.isEnabled), + (o.EMISSIVEFRESNEL = + this._emissiveFresnelParameters && + this._emissiveFresnelParameters.isEnabled), + (o._needNormals = true), + (o.FRESNEL = true)) + : (o.FRESNEL = false)), + d.a.PrepareDefinesForMisc( + e, + r, + this._useLogarithmicDepth, + this.pointsCloud, + this.fogEnabled, + this._shouldTurnAlphaTestOn(e), + o + ), d.a.PrepareDefinesForAttributes(e, o, true, true, true), d.a.PrepareDefinesForFrameBoundValues(r, a, o, n), - o.isDirty) { - o.markAsProcessed(); - var s = new l.c; - o.REFLECTION && s.addFallback(0, "REFLECTION"), - o.SPECULAR && s.addFallback(0, "SPECULAR"), - o.BUMP && s.addFallback(0, "BUMP"), - o.PARALLAX && s.addFallback(1, "PARALLAX"), - o.PARALLAXOCCLUSION && s.addFallback(0, "PARALLAXOCCLUSION"), - o.SPECULAROVERALPHA && s.addFallback(0, "SPECULAROVERALPHA"), - o.FOG && s.addFallback(1, "FOG"), - o.POINTSIZE && s.addFallback(0, "POINTSIZE"), - o.LOGARITHMICDEPTH && s.addFallback(0, "LOGARITHMICDEPTH"), - d.a.HandleFallbacksForShadows(o, s, this._maxSimultaneousLights), - o.SPECULARTERM && s.addFallback(0, "SPECULARTERM"), - o.DIFFUSEFRESNEL && s.addFallback(1, "DIFFUSEFRESNEL"), - o.OPACITYFRESNEL && s.addFallback(2, "OPACITYFRESNEL"), - o.REFLECTIONFRESNEL && s.addFallback(3, "REFLECTIONFRESNEL"), - o.EMISSIVEFRESNEL && s.addFallback(4, "EMISSIVEFRESNEL"), - o.FRESNEL && s.addFallback(4, "FRESNEL"), - o.MULTIVIEW && s.addFallback(0, "MULTIVIEW"); - var h = [c.b.PositionKind]; - o.NORMAL && h.push(c.b.NormalKind), - o.UV1 && h.push(c.b.UVKind), - o.UV2 && h.push(c.b.UV2Kind), - o.VERTEXCOLOR && h.push(c.b.ColorKind), - d.a.PrepareAttributesForBones(h, e, o, s), - d.a.PrepareAttributesForInstances(h, o), - d.a.PrepareAttributesForMorphTargets(h, e, o); - var f = "default" - , m = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vDiffuseColor", "vSpecularColor", "vEmissiveColor", "visibility", "vFogInfos", "vFogColor", "pointSize", "vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos", "vLightmapInfos", "vRefractionInfos", "mBones", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "normalMatrix", "lightmapMatrix", "refractionMatrix", "diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor", "refractionLeftColor", "refractionRightColor", "vReflectionPosition", "vReflectionSize", "logarithmicDepthConstant", "vTangentSpaceParams", "alphaCutOff", "boneTextureWidth"] - , g = ["diffuseSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "specularSampler", "bumpSampler", "lightmapSampler", "refractionCubeSampler", "refraction2DSampler", "boneSampler"] - , y = ["Material", "Scene"]; - u.a && (u.a.PrepareUniforms(m, o), - u.a.PrepareSamplers(g, o)), - d.a.PrepareUniformsAndSamplersList({ - uniformsNames: m, - uniformBuffersNames: y, - samplers: g, - defines: o, - maxSimultaneousLights: this._maxSimultaneousLights - }), - this.customShaderNameResolve && (f = this.customShaderNameResolve(f, m, y, g, o)); - var b = o.toString() - , E = i.effect - , T = r.getEngine().createEffect(f, { - attributes: h, - uniformsNames: m, - uniformBuffersNames: y, - samplers: g, - defines: b, - fallbacks: s, - onCompiled: this.onCompiled, - onError: this.onError, - indexParameters: { - maxSimultaneousLights: this._maxSimultaneousLights, - maxSimultaneousMorphTargets: o.NUM_MORPH_INFLUENCERS - } - }, a); - T && (this.allowShaderHotSwapping && E && !T.isReady() ? (T = E, - o.markAsUnprocessed()) : (r.resetCachedMaterial(), - i.setEffect(T, o), - this.buildUniformLayout())) - } - return !(!i.effect || !i.effect.isReady() || (o._renderId = r.getRenderId(), - this._wasPreviouslyReady = true, - 0)) - } - , - t.prototype.buildUniformLayout = function() { - var e = this._uniformBuffer; - e.addUniform("diffuseLeftColor", 4), + o.isDirty) + ) { + o.markAsProcessed(); + var s = new l.c(); + o.REFLECTION && s.addFallback(0, "REFLECTION"), + o.SPECULAR && s.addFallback(0, "SPECULAR"), + o.BUMP && s.addFallback(0, "BUMP"), + o.PARALLAX && s.addFallback(1, "PARALLAX"), + o.PARALLAXOCCLUSION && + s.addFallback(0, "PARALLAXOCCLUSION"), + o.SPECULAROVERALPHA && + s.addFallback(0, "SPECULAROVERALPHA"), + o.FOG && s.addFallback(1, "FOG"), + o.POINTSIZE && s.addFallback(0, "POINTSIZE"), + o.LOGARITHMICDEPTH && + s.addFallback(0, "LOGARITHMICDEPTH"), + d.a.HandleFallbacksForShadows( + o, + s, + this._maxSimultaneousLights + ), + o.SPECULARTERM && s.addFallback(0, "SPECULARTERM"), + o.DIFFUSEFRESNEL && + s.addFallback(1, "DIFFUSEFRESNEL"), + o.OPACITYFRESNEL && + s.addFallback(2, "OPACITYFRESNEL"), + o.REFLECTIONFRESNEL && + s.addFallback(3, "REFLECTIONFRESNEL"), + o.EMISSIVEFRESNEL && + s.addFallback(4, "EMISSIVEFRESNEL"), + o.FRESNEL && s.addFallback(4, "FRESNEL"), + o.MULTIVIEW && s.addFallback(0, "MULTIVIEW"); + var h = [c.b.PositionKind]; + o.NORMAL && h.push(c.b.NormalKind), + o.UV1 && h.push(c.b.UVKind), + o.UV2 && h.push(c.b.UV2Kind), + o.VERTEXCOLOR && h.push(c.b.ColorKind), + d.a.PrepareAttributesForBones(h, e, o, s), + d.a.PrepareAttributesForInstances(h, o), + d.a.PrepareAttributesForMorphTargets(h, e, o); + var f = "default", + m = [ + "world", + "view", + "viewProjection", + "vEyePosition", + "vLightsType", + "vAmbientColor", + "vDiffuseColor", + "vSpecularColor", + "vEmissiveColor", + "visibility", + "vFogInfos", + "vFogColor", + "pointSize", + "vDiffuseInfos", + "vAmbientInfos", + "vOpacityInfos", + "vReflectionInfos", + "vEmissiveInfos", + "vSpecularInfos", + "vBumpInfos", + "vLightmapInfos", + "vRefractionInfos", + "mBones", + "vClipPlane", + "vClipPlane2", + "vClipPlane3", + "vClipPlane4", + "diffuseMatrix", + "ambientMatrix", + "opacityMatrix", + "reflectionMatrix", + "emissiveMatrix", + "specularMatrix", + "bumpMatrix", + "normalMatrix", + "lightmapMatrix", + "refractionMatrix", + "diffuseLeftColor", + "diffuseRightColor", + "opacityParts", + "reflectionLeftColor", + "reflectionRightColor", + "emissiveLeftColor", + "emissiveRightColor", + "refractionLeftColor", + "refractionRightColor", + "vReflectionPosition", + "vReflectionSize", + "logarithmicDepthConstant", + "vTangentSpaceParams", + "alphaCutOff", + "boneTextureWidth", + ], + g = [ + "diffuseSampler", + "ambientSampler", + "opacitySampler", + "reflectionCubeSampler", + "reflection2DSampler", + "emissiveSampler", + "specularSampler", + "bumpSampler", + "lightmapSampler", + "refractionCubeSampler", + "refraction2DSampler", + "boneSampler", + ], + y = ["Material", "Scene"]; + u.a && + (u.a.PrepareUniforms(m, o), + u.a.PrepareSamplers(g, o)), + d.a.PrepareUniformsAndSamplersList({ + uniformsNames: m, + uniformBuffersNames: y, + samplers: g, + defines: o, + maxSimultaneousLights: this._maxSimultaneousLights, + }), + this.customShaderNameResolve && + (f = this.customShaderNameResolve(f, m, y, g, o)); + var b = o.toString(), + E = i.effect, + T = r.getEngine().createEffect( + f, + { + attributes: h, + uniformsNames: m, + uniformBuffersNames: y, + samplers: g, + defines: b, + fallbacks: s, + onCompiled: this.onCompiled, + onError: this.onError, + indexParameters: { + maxSimultaneousLights: + this._maxSimultaneousLights, + maxSimultaneousMorphTargets: + o.NUM_MORPH_INFLUENCERS, + }, + }, + a + ); + T && + (this.allowShaderHotSwapping && E && !T.isReady() + ? ((T = E), o.markAsUnprocessed()) + : (r.resetCachedMaterial(), + i.setEffect(T, o), + this.buildUniformLayout())); + } + return !( + !i.effect || + !i.effect.isReady() || + ((o._renderId = r.getRenderId()), + (this._wasPreviouslyReady = true), + 0) + ); + }), + (t.prototype.buildUniformLayout = function () { + var e = this._uniformBuffer; + e.addUniform("diffuseLeftColor", 4), e.addUniform("diffuseRightColor", 4), e.addUniform("opacityParts", 4), e.addUniform("reflectionLeftColor", 4), @@ -41764,919 +52473,1675 @@ and limitations under the License. e.addUniform("vEmissiveColor", 3), e.addUniform("visibility", 1), e.addUniform("vDiffuseColor", 4), - e.create() - } - , - t.prototype.unbind = function() { - if (this._activeEffect) { - var t = false; - this._reflectionTexture && this._reflectionTexture.isRenderTarget && (this._activeEffect.setTexture("reflection2DSampler", null), - t = true), - this._refractionTexture && this._refractionTexture.isRenderTarget && (this._activeEffect.setTexture("refraction2DSampler", null), - t = true), - t && this._markAllSubMeshesAsTexturesDirty() - } - e.prototype.unbind.call(this) - } - , - t.prototype.bindForSubMesh = function(e, i, n) { - var r = this.getScene() - , o = n._materialDefines; - if (o) { - var c = n.effect; - if (c) { - this._activeEffect = c, - o.INSTANCES || this.bindOnlyWorldMatrix(e), - o.OBJECTSPACE_NORMALMAP && (e.toNormalMatrix(this._normalMatrix), - this.bindOnlyNormalMatrix(this._normalMatrix)); - var u = this._mustRebind(r, c, i.visibility); - d.a.BindBonesParameters(i, c); - var l = this._uniformBuffer; - if (u) { - if (l.bindToEffect(c, "Material"), - this.bindViewProjection(c), - !l.useUbo || !this.isFrozen || !l.isSync) { - if (t.FresnelEnabled && o.FRESNEL && (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled && (l.updateColor4("diffuseLeftColor", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power), - l.updateColor4("diffuseRightColor", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias)), - this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled && l.updateColor4("opacityParts", new s.e(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power), - this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled && (l.updateColor4("reflectionLeftColor", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power), - l.updateColor4("reflectionRightColor", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias)), - this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled && (l.updateColor4("refractionLeftColor", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power), - l.updateColor4("refractionRightColor", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.bias)), - this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled && (l.updateColor4("emissiveLeftColor", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power), - l.updateColor4("emissiveRightColor", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias))), - r.texturesEnabled) { - if (this._diffuseTexture && t.DiffuseTextureEnabled && (l.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level), - d.a.BindTextureMatrix(this._diffuseTexture, l, "diffuse"), - this._diffuseTexture.hasAlpha && c.setFloat("alphaCutOff", this.alphaCutOff)), - this._ambientTexture && t.AmbientTextureEnabled && (l.updateFloat2("vAmbientInfos", this._ambientTexture.coordinatesIndex, this._ambientTexture.level), - d.a.BindTextureMatrix(this._ambientTexture, l, "ambient")), - this._opacityTexture && t.OpacityTextureEnabled && (l.updateFloat2("vOpacityInfos", this._opacityTexture.coordinatesIndex, this._opacityTexture.level), - d.a.BindTextureMatrix(this._opacityTexture, l, "opacity")), - this._reflectionTexture && t.ReflectionTextureEnabled && (l.updateFloat2("vReflectionInfos", this._reflectionTexture.level, this.roughness), - l.updateMatrix("reflectionMatrix", this._reflectionTexture.getReflectionTextureMatrix()), - this._reflectionTexture.boundingBoxSize)) { - var h = this._reflectionTexture; - l.updateVector3("vReflectionPosition", h.boundingBoxPosition), - l.updateVector3("vReflectionSize", h.boundingBoxSize) - } - if (this._emissiveTexture && t.EmissiveTextureEnabled && (l.updateFloat2("vEmissiveInfos", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level), - d.a.BindTextureMatrix(this._emissiveTexture, l, "emissive")), - this._lightmapTexture && t.LightmapTextureEnabled && (l.updateFloat2("vLightmapInfos", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level), - d.a.BindTextureMatrix(this._lightmapTexture, l, "lightmap")), - this._specularTexture && t.SpecularTextureEnabled && (l.updateFloat2("vSpecularInfos", this._specularTexture.coordinatesIndex, this._specularTexture.level), - d.a.BindTextureMatrix(this._specularTexture, l, "specular")), - this._bumpTexture && r.getEngine().getCaps().standardDerivatives && t.BumpTextureEnabled && (l.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, 1 / this._bumpTexture.level, this.parallaxScaleBias), - d.a.BindTextureMatrix(this._bumpTexture, l, "bump"), - r._mirroredCameraPosition ? l.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? 1 : -1, this._invertNormalMapY ? 1 : -1) : l.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? -1 : 1, this._invertNormalMapY ? -1 : 1)), - this._refractionTexture && t.RefractionTextureEnabled) { - var f = 1; - this._refractionTexture.isCube || (l.updateMatrix("refractionMatrix", this._refractionTexture.getReflectionTextureMatrix()), - this._refractionTexture.depth && (f = this._refractionTexture.depth)), - l.updateFloat4("vRefractionInfos", this._refractionTexture.level, this.indexOfRefraction, f, this.invertRefractionY ? -1 : 1) - } - } - this.pointsCloud && l.updateFloat("pointSize", this.pointSize), - o.SPECULARTERM && l.updateColor4("vSpecularColor", this.specularColor, this.specularPower), - l.updateColor3("vEmissiveColor", t.EmissiveTextureEnabled ? this.emissiveColor : s.e.BlackReadOnly), - l.updateFloat("visibility", i.visibility), - l.updateColor4("vDiffuseColor", this.diffuseColor, this.alpha) - } - r.texturesEnabled && (this._diffuseTexture && t.DiffuseTextureEnabled && c.setTexture("diffuseSampler", this._diffuseTexture), - this._ambientTexture && t.AmbientTextureEnabled && c.setTexture("ambientSampler", this._ambientTexture), - this._opacityTexture && t.OpacityTextureEnabled && c.setTexture("opacitySampler", this._opacityTexture), - this._reflectionTexture && t.ReflectionTextureEnabled && (this._reflectionTexture.isCube ? c.setTexture("reflectionCubeSampler", this._reflectionTexture) : c.setTexture("reflection2DSampler", this._reflectionTexture)), - this._emissiveTexture && t.EmissiveTextureEnabled && c.setTexture("emissiveSampler", this._emissiveTexture), - this._lightmapTexture && t.LightmapTextureEnabled && c.setTexture("lightmapSampler", this._lightmapTexture), - this._specularTexture && t.SpecularTextureEnabled && c.setTexture("specularSampler", this._specularTexture), - this._bumpTexture && r.getEngine().getCaps().standardDerivatives && t.BumpTextureEnabled && c.setTexture("bumpSampler", this._bumpTexture), - this._refractionTexture && t.RefractionTextureEnabled) && (f = 1, - this._refractionTexture.isCube ? c.setTexture("refractionCubeSampler", this._refractionTexture) : c.setTexture("refraction2DSampler", this._refractionTexture)), - d.a.BindClipPlane(c, r), - r.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor), - d.a.BindEyePosition(c, r), - c.setColor3("vAmbientColor", this._globalAmbientColor) + e.create(); + }), + (t.prototype.unbind = function () { + if (this._activeEffect) { + var t = false; + this._reflectionTexture && + this._reflectionTexture.isRenderTarget && + (this._activeEffect.setTexture( + "reflection2DSampler", + null + ), + (t = true)), + this._refractionTexture && + this._refractionTexture.isRenderTarget && + (this._activeEffect.setTexture( + "refraction2DSampler", + null + ), + (t = true)), + t && this._markAllSubMeshesAsTexturesDirty(); + } + e.prototype.unbind.call(this); + }), + (t.prototype.bindForSubMesh = function (e, i, n) { + var r = this.getScene(), + o = n._materialDefines; + if (o) { + var c = n.effect; + if (c) { + (this._activeEffect = c), + o.INSTANCES || this.bindOnlyWorldMatrix(e), + o.OBJECTSPACE_NORMALMAP && + (e.toNormalMatrix(this._normalMatrix), + this.bindOnlyNormalMatrix(this._normalMatrix)); + var u = this._mustRebind(r, c, i.visibility); + d.a.BindBonesParameters(i, c); + var l = this._uniformBuffer; + if (u) { + if ( + (l.bindToEffect(c, "Material"), + this.bindViewProjection(c), + !l.useUbo || !this.isFrozen || !l.isSync) + ) { + if ( + (t.FresnelEnabled && + o.FRESNEL && + (this.diffuseFresnelParameters && + this.diffuseFresnelParameters.isEnabled && + (l.updateColor4( + "diffuseLeftColor", + this.diffuseFresnelParameters.leftColor, + this.diffuseFresnelParameters.power + ), + l.updateColor4( + "diffuseRightColor", + this.diffuseFresnelParameters.rightColor, + this.diffuseFresnelParameters.bias + )), + this.opacityFresnelParameters && + this.opacityFresnelParameters.isEnabled && + l.updateColor4( + "opacityParts", + new s.e( + this.opacityFresnelParameters.leftColor.toLuminance(), + this.opacityFresnelParameters.rightColor.toLuminance(), + this.opacityFresnelParameters.bias + ), + this.opacityFresnelParameters.power + ), + this.reflectionFresnelParameters && + this.reflectionFresnelParameters + .isEnabled && + (l.updateColor4( + "reflectionLeftColor", + this.reflectionFresnelParameters + .leftColor, + this.reflectionFresnelParameters.power + ), + l.updateColor4( + "reflectionRightColor", + this.reflectionFresnelParameters + .rightColor, + this.reflectionFresnelParameters.bias + )), + this.refractionFresnelParameters && + this.refractionFresnelParameters + .isEnabled && + (l.updateColor4( + "refractionLeftColor", + this.refractionFresnelParameters + .leftColor, + this.refractionFresnelParameters.power + ), + l.updateColor4( + "refractionRightColor", + this.refractionFresnelParameters + .rightColor, + this.refractionFresnelParameters.bias + )), + this.emissiveFresnelParameters && + this.emissiveFresnelParameters.isEnabled && + (l.updateColor4( + "emissiveLeftColor", + this.emissiveFresnelParameters.leftColor, + this.emissiveFresnelParameters.power + ), + l.updateColor4( + "emissiveRightColor", + this.emissiveFresnelParameters.rightColor, + this.emissiveFresnelParameters.bias + ))), + r.texturesEnabled) + ) { + if ( + (this._diffuseTexture && + t.DiffuseTextureEnabled && + (l.updateFloat2( + "vDiffuseInfos", + this._diffuseTexture.coordinatesIndex, + this._diffuseTexture.level + ), + d.a.BindTextureMatrix( + this._diffuseTexture, + l, + "diffuse" + ), + this._diffuseTexture.hasAlpha && + c.setFloat( + "alphaCutOff", + this.alphaCutOff + )), + this._ambientTexture && + t.AmbientTextureEnabled && + (l.updateFloat2( + "vAmbientInfos", + this._ambientTexture.coordinatesIndex, + this._ambientTexture.level + ), + d.a.BindTextureMatrix( + this._ambientTexture, + l, + "ambient" + )), + this._opacityTexture && + t.OpacityTextureEnabled && + (l.updateFloat2( + "vOpacityInfos", + this._opacityTexture.coordinatesIndex, + this._opacityTexture.level + ), + d.a.BindTextureMatrix( + this._opacityTexture, + l, + "opacity" + )), + this._reflectionTexture && + t.ReflectionTextureEnabled && + (l.updateFloat2( + "vReflectionInfos", + this._reflectionTexture.level, + this.roughness + ), + l.updateMatrix( + "reflectionMatrix", + this._reflectionTexture.getReflectionTextureMatrix() + ), + this._reflectionTexture.boundingBoxSize)) + ) { + var h = this._reflectionTexture; + l.updateVector3( + "vReflectionPosition", + h.boundingBoxPosition + ), + l.updateVector3( + "vReflectionSize", + h.boundingBoxSize + ); } - !u && this.isFrozen || (r.lightsEnabled && !this._disableLighting && d.a.BindLights(r, i, c, o, this._maxSimultaneousLights), - (r.fogEnabled && i.applyFog && r.fogMode !== vec3Math.a.FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) && this.bindView(c), - d.a.BindFogParameters(r, i, c), - o.NUM_MORPH_INFLUENCERS && d.a.BindMorphTargetParameters(i, c), - d.a.BindLogDepth(o, c, r), - this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess && this._imageProcessingConfiguration.bind(this._activeEffect)), - l.update(), - this._afterBind(i, this._activeEffect) + if ( + (this._emissiveTexture && + t.EmissiveTextureEnabled && + (l.updateFloat2( + "vEmissiveInfos", + this._emissiveTexture.coordinatesIndex, + this._emissiveTexture.level + ), + d.a.BindTextureMatrix( + this._emissiveTexture, + l, + "emissive" + )), + this._lightmapTexture && + t.LightmapTextureEnabled && + (l.updateFloat2( + "vLightmapInfos", + this._lightmapTexture.coordinatesIndex, + this._lightmapTexture.level + ), + d.a.BindTextureMatrix( + this._lightmapTexture, + l, + "lightmap" + )), + this._specularTexture && + t.SpecularTextureEnabled && + (l.updateFloat2( + "vSpecularInfos", + this._specularTexture.coordinatesIndex, + this._specularTexture.level + ), + d.a.BindTextureMatrix( + this._specularTexture, + l, + "specular" + )), + this._bumpTexture && + r.getEngine().getCaps() + .standardDerivatives && + t.BumpTextureEnabled && + (l.updateFloat3( + "vBumpInfos", + this._bumpTexture.coordinatesIndex, + 1 / this._bumpTexture.level, + this.parallaxScaleBias + ), + d.a.BindTextureMatrix( + this._bumpTexture, + l, + "bump" + ), + r._mirroredCameraPosition + ? l.updateFloat2( + "vTangentSpaceParams", + this._invertNormalMapX ? 1 : -1, + this._invertNormalMapY ? 1 : -1 + ) + : l.updateFloat2( + "vTangentSpaceParams", + this._invertNormalMapX ? -1 : 1, + this._invertNormalMapY ? -1 : 1 + )), + this._refractionTexture && + t.RefractionTextureEnabled) + ) { + var f = 1; + this._refractionTexture.isCube || + (l.updateMatrix( + "refractionMatrix", + this._refractionTexture.getReflectionTextureMatrix() + ), + this._refractionTexture.depth && + (f = this._refractionTexture.depth)), + l.updateFloat4( + "vRefractionInfos", + this._refractionTexture.level, + this.indexOfRefraction, + f, + this.invertRefractionY ? -1 : 1 + ); + } + } + this.pointsCloud && + l.updateFloat("pointSize", this.pointSize), + o.SPECULARTERM && + l.updateColor4( + "vSpecularColor", + this.specularColor, + this.specularPower + ), + l.updateColor3( + "vEmissiveColor", + t.EmissiveTextureEnabled + ? this.emissiveColor + : s.e.BlackReadOnly + ), + l.updateFloat("visibility", i.visibility), + l.updateColor4( + "vDiffuseColor", + this.diffuseColor, + this.alpha + ); } + r.texturesEnabled && + (this._diffuseTexture && + t.DiffuseTextureEnabled && + c.setTexture( + "diffuseSampler", + this._diffuseTexture + ), + this._ambientTexture && + t.AmbientTextureEnabled && + c.setTexture( + "ambientSampler", + this._ambientTexture + ), + this._opacityTexture && + t.OpacityTextureEnabled && + c.setTexture( + "opacitySampler", + this._opacityTexture + ), + this._reflectionTexture && + t.ReflectionTextureEnabled && + (this._reflectionTexture.isCube + ? c.setTexture( + "reflectionCubeSampler", + this._reflectionTexture + ) + : c.setTexture( + "reflection2DSampler", + this._reflectionTexture + )), + this._emissiveTexture && + t.EmissiveTextureEnabled && + c.setTexture( + "emissiveSampler", + this._emissiveTexture + ), + this._lightmapTexture && + t.LightmapTextureEnabled && + c.setTexture( + "lightmapSampler", + this._lightmapTexture + ), + this._specularTexture && + t.SpecularTextureEnabled && + c.setTexture( + "specularSampler", + this._specularTexture + ), + this._bumpTexture && + r.getEngine().getCaps().standardDerivatives && + t.BumpTextureEnabled && + c.setTexture("bumpSampler", this._bumpTexture), + this._refractionTexture && + t.RefractionTextureEnabled) && + ((f = 1), + this._refractionTexture.isCube + ? c.setTexture( + "refractionCubeSampler", + this._refractionTexture + ) + : c.setTexture( + "refraction2DSampler", + this._refractionTexture + )), + d.a.BindClipPlane(c, r), + r.ambientColor.multiplyToRef( + this.ambientColor, + this._globalAmbientColor + ), + d.a.BindEyePosition(c, r), + c.setColor3( + "vAmbientColor", + this._globalAmbientColor + ); + } + (!u && this.isFrozen) || + (r.lightsEnabled && + !this._disableLighting && + d.a.BindLights( + r, + i, + c, + o, + this._maxSimultaneousLights + ), + ((r.fogEnabled && + i.applyFog && + r.fogMode !== vec3Math.a.FOGMODE_NONE) || + this._reflectionTexture || + this._refractionTexture) && + this.bindView(c), + d.a.BindFogParameters(r, i, c), + o.NUM_MORPH_INFLUENCERS && + d.a.BindMorphTargetParameters(i, c), + d.a.BindLogDepth(o, c, r), + this._imageProcessingConfiguration && + !this._imageProcessingConfiguration + .applyByPostProcess && + this._imageProcessingConfiguration.bind( + this._activeEffect + )), + l.update(), + this._afterBind(i, this._activeEffect); } - } - , - t.prototype.getAnimatables = function() { - var e = []; - return this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0 && e.push(this._diffuseTexture), - this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0 && e.push(this._ambientTexture), - this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0 && e.push(this._opacityTexture), - this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0 && e.push(this._reflectionTexture), - this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0 && e.push(this._emissiveTexture), - this._specularTexture && this._specularTexture.animations && this._specularTexture.animations.length > 0 && e.push(this._specularTexture), - this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0 && e.push(this._bumpTexture), - this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0 && e.push(this._lightmapTexture), - this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0 && e.push(this._refractionTexture), + } + }), + (t.prototype.getAnimatables = function () { + var e = []; + return ( + this._diffuseTexture && + this._diffuseTexture.animations && + this._diffuseTexture.animations.length > 0 && + e.push(this._diffuseTexture), + this._ambientTexture && + this._ambientTexture.animations && + this._ambientTexture.animations.length > 0 && + e.push(this._ambientTexture), + this._opacityTexture && + this._opacityTexture.animations && + this._opacityTexture.animations.length > 0 && + e.push(this._opacityTexture), + this._reflectionTexture && + this._reflectionTexture.animations && + this._reflectionTexture.animations.length > 0 && + e.push(this._reflectionTexture), + this._emissiveTexture && + this._emissiveTexture.animations && + this._emissiveTexture.animations.length > 0 && + e.push(this._emissiveTexture), + this._specularTexture && + this._specularTexture.animations && + this._specularTexture.animations.length > 0 && + e.push(this._specularTexture), + this._bumpTexture && + this._bumpTexture.animations && + this._bumpTexture.animations.length > 0 && + e.push(this._bumpTexture), + this._lightmapTexture && + this._lightmapTexture.animations && + this._lightmapTexture.animations.length > 0 && + e.push(this._lightmapTexture), + this._refractionTexture && + this._refractionTexture.animations && + this._refractionTexture.animations.length > 0 && + e.push(this._refractionTexture), e - } - , - t.prototype.getActiveTextures = function() { - var t = e.prototype.getActiveTextures.call(this); - return this._diffuseTexture && t.push(this._diffuseTexture), + ); + }), + (t.prototype.getActiveTextures = function () { + var t = e.prototype.getActiveTextures.call(this); + return ( + this._diffuseTexture && t.push(this._diffuseTexture), this._ambientTexture && t.push(this._ambientTexture), this._opacityTexture && t.push(this._opacityTexture), - this._reflectionTexture && t.push(this._reflectionTexture), + this._reflectionTexture && + t.push(this._reflectionTexture), this._emissiveTexture && t.push(this._emissiveTexture), this._specularTexture && t.push(this._specularTexture), this._bumpTexture && t.push(this._bumpTexture), this._lightmapTexture && t.push(this._lightmapTexture), - this._refractionTexture && t.push(this._refractionTexture), + this._refractionTexture && + t.push(this._refractionTexture), t - } - , - t.prototype.hasTexture = function(t) { - return !!e.prototype.hasTexture.call(this, t) || this._diffuseTexture === t || this._ambientTexture === t || this._opacityTexture === t || this._reflectionTexture === t || this._emissiveTexture === t || this._specularTexture === t || this._bumpTexture === t || this._lightmapTexture === t || this._refractionTexture === t - } - , - t.prototype.dispose = function(t, i) { - i && (this._diffuseTexture && this._diffuseTexture.dispose(), + ); + }), + (t.prototype.hasTexture = function (t) { + return ( + !!e.prototype.hasTexture.call(this, t) || + this._diffuseTexture === t || + this._ambientTexture === t || + this._opacityTexture === t || + this._reflectionTexture === t || + this._emissiveTexture === t || + this._specularTexture === t || + this._bumpTexture === t || + this._lightmapTexture === t || + this._refractionTexture === t + ); + }), + (t.prototype.dispose = function (t, i) { + i && + (this._diffuseTexture && this._diffuseTexture.dispose(), this._ambientTexture && this._ambientTexture.dispose(), this._opacityTexture && this._opacityTexture.dispose(), - this._reflectionTexture && this._reflectionTexture.dispose(), - this._emissiveTexture && this._emissiveTexture.dispose(), - this._specularTexture && this._specularTexture.dispose(), + this._reflectionTexture && + this._reflectionTexture.dispose(), + this._emissiveTexture && + this._emissiveTexture.dispose(), + this._specularTexture && + this._specularTexture.dispose(), this._bumpTexture && this._bumpTexture.dispose(), - this._lightmapTexture && this._lightmapTexture.dispose(), - this._refractionTexture && this._refractionTexture.dispose()), - this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), - e.prototype.dispose.call(this, t, i) - } - , - t.prototype.clone = function(e) { - var i = this - , n = r.a.Clone(function() { - return new t(e,i.getScene()) + this._lightmapTexture && + this._lightmapTexture.dispose(), + this._refractionTexture && + this._refractionTexture.dispose()), + this._imageProcessingConfiguration && + this._imageProcessingObserver && + this._imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingObserver + ), + e.prototype.dispose.call(this, t, i); + }), + (t.prototype.clone = function (e) { + var i = this, + n = r.a.Clone(function () { + return new t(e, i.getScene()); }, this); - return n.name = e, - n.id = e, + return (n.name = e), (n.id = e), n; + }), + (t.prototype.serialize = function () { + return r.a.Serialize(this); + }), + (t.Parse = function (e, i, n) { + return r.a.Parse( + function () { + return new t(e.name, i); + }, + e, + i, n - } - , - t.prototype.serialize = function() { - return r.a.Serialize(this) - } - , - t.Parse = function(e, i, n) { - return r.a.Parse(function() { - return new t(e.name,i) - }, e, i, n) - } - , + ); + }), Object.defineProperty(t, "DiffuseTextureEnabled", { - get: function() { - return g.a.DiffuseTextureEnabled - }, - set: function(e) { - g.a.DiffuseTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.DiffuseTextureEnabled; + }, + set: function (e) { + g.a.DiffuseTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "AmbientTextureEnabled", { - get: function() { - return g.a.AmbientTextureEnabled - }, - set: function(e) { - g.a.AmbientTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.AmbientTextureEnabled; + }, + set: function (e) { + g.a.AmbientTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "OpacityTextureEnabled", { - get: function() { - return g.a.OpacityTextureEnabled - }, - set: function(e) { - g.a.OpacityTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.OpacityTextureEnabled; + }, + set: function (e) { + g.a.OpacityTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "ReflectionTextureEnabled", { - get: function() { - return g.a.ReflectionTextureEnabled - }, - set: function(e) { - g.a.ReflectionTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.ReflectionTextureEnabled; + }, + set: function (e) { + g.a.ReflectionTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "EmissiveTextureEnabled", { - get: function() { - return g.a.EmissiveTextureEnabled - }, - set: function(e) { - g.a.EmissiveTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.EmissiveTextureEnabled; + }, + set: function (e) { + g.a.EmissiveTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "SpecularTextureEnabled", { - get: function() { - return g.a.SpecularTextureEnabled - }, - set: function(e) { - g.a.SpecularTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.SpecularTextureEnabled; + }, + set: function (e) { + g.a.SpecularTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "BumpTextureEnabled", { - get: function() { - return g.a.BumpTextureEnabled - }, - set: function(e) { - g.a.BumpTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.BumpTextureEnabled; + }, + set: function (e) { + g.a.BumpTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "LightmapTextureEnabled", { - get: function() { - return g.a.LightmapTextureEnabled - }, - set: function(e) { - g.a.LightmapTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.LightmapTextureEnabled; + }, + set: function (e) { + g.a.LightmapTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "RefractionTextureEnabled", { - get: function() { - return g.a.RefractionTextureEnabled - }, - set: function(e) { - g.a.RefractionTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.RefractionTextureEnabled; + }, + set: function (e) { + g.a.RefractionTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "ColorGradingTextureEnabled", { - get: function() { - return g.a.ColorGradingTextureEnabled - }, - set: function(e) { - g.a.ColorGradingTextureEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.ColorGradingTextureEnabled; + }, + set: function (e) { + g.a.ColorGradingTextureEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "FresnelEnabled", { - get: function() { - return g.a.FresnelEnabled - }, - set: function(e) { - g.a.FresnelEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return g.a.FresnelEnabled; + }, + set: function (e) { + g.a.FresnelEnabled = e; + }, + enumerable: true, + configurable: true, }), - n.c([Object(r.m)("diffuseTexture")], t.prototype, "_diffuseTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "diffuseTexture", void 0), - n.c([Object(r.m)("ambientTexture")], t.prototype, "_ambientTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTexture", void 0), - n.c([Object(r.m)("opacityTexture")], t.prototype, "_opacityTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "opacityTexture", void 0), - n.c([Object(r.m)("reflectionTexture")], t.prototype, "_reflectionTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionTexture", void 0), - n.c([Object(r.m)("emissiveTexture")], t.prototype, "_emissiveTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveTexture", void 0), - n.c([Object(r.m)("specularTexture")], t.prototype, "_specularTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "specularTexture", void 0), - n.c([Object(r.m)("bumpTexture")], t.prototype, "_bumpTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "bumpTexture", void 0), - n.c([Object(r.m)("lightmapTexture")], t.prototype, "_lightmapTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "lightmapTexture", void 0), - n.c([Object(r.m)("refractionTexture")], t.prototype, "_refractionTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "refractionTexture", void 0), - n.c([Object(r.e)("ambient")], t.prototype, "ambientColor", void 0), - n.c([Object(r.e)("diffuse")], t.prototype, "diffuseColor", void 0), - n.c([Object(r.e)("specular")], t.prototype, "specularColor", void 0), - n.c([Object(r.e)("emissive")], t.prototype, "emissiveColor", void 0), + n.c( + [Object(r.m)("diffuseTexture")], + t.prototype, + "_diffuseTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], + t.prototype, + "diffuseTexture", + void 0 + ), + n.c( + [Object(r.m)("ambientTexture")], + t.prototype, + "_ambientTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "ambientTexture", + void 0 + ), + n.c( + [Object(r.m)("opacityTexture")], + t.prototype, + "_opacityTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], + t.prototype, + "opacityTexture", + void 0 + ), + n.c( + [Object(r.m)("reflectionTexture")], + t.prototype, + "_reflectionTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "reflectionTexture", + void 0 + ), + n.c( + [Object(r.m)("emissiveTexture")], + t.prototype, + "_emissiveTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "emissiveTexture", + void 0 + ), + n.c( + [Object(r.m)("specularTexture")], + t.prototype, + "_specularTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "specularTexture", + void 0 + ), + n.c( + [Object(r.m)("bumpTexture")], + t.prototype, + "_bumpTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "bumpTexture", + void 0 + ), + n.c( + [Object(r.m)("lightmapTexture")], + t.prototype, + "_lightmapTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "lightmapTexture", + void 0 + ), + n.c( + [Object(r.m)("refractionTexture")], + t.prototype, + "_refractionTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "refractionTexture", + void 0 + ), + n.c( + [Object(r.e)("ambient")], + t.prototype, + "ambientColor", + void 0 + ), + n.c( + [Object(r.e)("diffuse")], + t.prototype, + "diffuseColor", + void 0 + ), + n.c( + [Object(r.e)("specular")], + t.prototype, + "specularColor", + void 0 + ), + n.c( + [Object(r.e)("emissive")], + t.prototype, + "emissiveColor", + void 0 + ), n.c([Object(r.c)()], t.prototype, "specularPower", void 0), - n.c([Object(r.c)("useAlphaFromDiffuseTexture")], t.prototype, "_useAlphaFromDiffuseTexture", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAlphaFromDiffuseTexture", void 0), - n.c([Object(r.c)("useEmissiveAsIllumination")], t.prototype, "_useEmissiveAsIllumination", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useEmissiveAsIllumination", void 0), - n.c([Object(r.c)("linkEmissiveWithDiffuse")], t.prototype, "_linkEmissiveWithDiffuse", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "linkEmissiveWithDiffuse", void 0), - n.c([Object(r.c)("useSpecularOverAlpha")], t.prototype, "_useSpecularOverAlpha", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useSpecularOverAlpha", void 0), - n.c([Object(r.c)("useReflectionOverAlpha")], t.prototype, "_useReflectionOverAlpha", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useReflectionOverAlpha", void 0), - n.c([Object(r.c)("disableLighting")], t.prototype, "_disableLighting", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "disableLighting", void 0), - n.c([Object(r.c)("useObjectSpaceNormalMap")], t.prototype, "_useObjectSpaceNormalMap", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useObjectSpaceNormalMap", void 0), - n.c([Object(r.c)("useParallax")], t.prototype, "_useParallax", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useParallax", void 0), - n.c([Object(r.c)("useParallaxOcclusion")], t.prototype, "_useParallaxOcclusion", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useParallaxOcclusion", void 0), - n.c([Object(r.c)()], t.prototype, "parallaxScaleBias", void 0), - n.c([Object(r.c)("roughness")], t.prototype, "_roughness", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "roughness", void 0), - n.c([Object(r.c)()], t.prototype, "indexOfRefraction", void 0), - n.c([Object(r.c)()], t.prototype, "invertRefractionY", void 0), + n.c( + [Object(r.c)("useAlphaFromDiffuseTexture")], + t.prototype, + "_useAlphaFromDiffuseTexture", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useAlphaFromDiffuseTexture", + void 0 + ), + n.c( + [Object(r.c)("useEmissiveAsIllumination")], + t.prototype, + "_useEmissiveAsIllumination", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useEmissiveAsIllumination", + void 0 + ), + n.c( + [Object(r.c)("linkEmissiveWithDiffuse")], + t.prototype, + "_linkEmissiveWithDiffuse", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "linkEmissiveWithDiffuse", + void 0 + ), + n.c( + [Object(r.c)("useSpecularOverAlpha")], + t.prototype, + "_useSpecularOverAlpha", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useSpecularOverAlpha", + void 0 + ), + n.c( + [Object(r.c)("useReflectionOverAlpha")], + t.prototype, + "_useReflectionOverAlpha", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useReflectionOverAlpha", + void 0 + ), + n.c( + [Object(r.c)("disableLighting")], + t.prototype, + "_disableLighting", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsLightsDirty")], + t.prototype, + "disableLighting", + void 0 + ), + n.c( + [Object(r.c)("useObjectSpaceNormalMap")], + t.prototype, + "_useObjectSpaceNormalMap", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useObjectSpaceNormalMap", + void 0 + ), + n.c( + [Object(r.c)("useParallax")], + t.prototype, + "_useParallax", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useParallax", + void 0 + ), + n.c( + [Object(r.c)("useParallaxOcclusion")], + t.prototype, + "_useParallaxOcclusion", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useParallaxOcclusion", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "parallaxScaleBias", + void 0 + ), + n.c( + [Object(r.c)("roughness")], + t.prototype, + "_roughness", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "roughness", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "indexOfRefraction", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "invertRefractionY", + void 0 + ), n.c([Object(r.c)()], t.prototype, "alphaCutOff", void 0), - n.c([Object(r.c)("useLightmapAsShadowmap")], t.prototype, "_useLightmapAsShadowmap", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLightmapAsShadowmap", void 0), - n.c([Object(r.h)("diffuseFresnelParameters")], t.prototype, "_diffuseFresnelParameters", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")], t.prototype, "diffuseFresnelParameters", void 0), - n.c([Object(r.h)("opacityFresnelParameters")], t.prototype, "_opacityFresnelParameters", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsFresnelAndMiscDirty")], t.prototype, "opacityFresnelParameters", void 0), - n.c([Object(r.h)("reflectionFresnelParameters")], t.prototype, "_reflectionFresnelParameters", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")], t.prototype, "reflectionFresnelParameters", void 0), - n.c([Object(r.h)("refractionFresnelParameters")], t.prototype, "_refractionFresnelParameters", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")], t.prototype, "refractionFresnelParameters", void 0), - n.c([Object(r.h)("emissiveFresnelParameters")], t.prototype, "_emissiveFresnelParameters", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")], t.prototype, "emissiveFresnelParameters", void 0), - n.c([Object(r.c)("useReflectionFresnelFromSpecular")], t.prototype, "_useReflectionFresnelFromSpecular", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")], t.prototype, "useReflectionFresnelFromSpecular", void 0), - n.c([Object(r.c)("useGlossinessFromSpecularMapAlpha")], t.prototype, "_useGlossinessFromSpecularMapAlpha", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useGlossinessFromSpecularMapAlpha", void 0), - n.c([Object(r.c)("maxSimultaneousLights")], t.prototype, "_maxSimultaneousLights", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "maxSimultaneousLights", void 0), - n.c([Object(r.c)("invertNormalMapX")], t.prototype, "_invertNormalMapX", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapX", void 0), - n.c([Object(r.c)("invertNormalMapY")], t.prototype, "_invertNormalMapY", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapY", void 0), - n.c([Object(r.c)("twoSidedLighting")], t.prototype, "_twoSidedLighting", void 0), - n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "twoSidedLighting", void 0), - n.c([Object(r.c)()], t.prototype, "useLogarithmicDepth", null), + n.c( + [Object(r.c)("useLightmapAsShadowmap")], + t.prototype, + "_useLightmapAsShadowmap", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useLightmapAsShadowmap", + void 0 + ), + n.c( + [Object(r.h)("diffuseFresnelParameters")], + t.prototype, + "_diffuseFresnelParameters", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsFresnelDirty")], + t.prototype, + "diffuseFresnelParameters", + void 0 + ), + n.c( + [Object(r.h)("opacityFresnelParameters")], + t.prototype, + "_opacityFresnelParameters", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsFresnelAndMiscDirty")], + t.prototype, + "opacityFresnelParameters", + void 0 + ), + n.c( + [Object(r.h)("reflectionFresnelParameters")], + t.prototype, + "_reflectionFresnelParameters", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsFresnelDirty")], + t.prototype, + "reflectionFresnelParameters", + void 0 + ), + n.c( + [Object(r.h)("refractionFresnelParameters")], + t.prototype, + "_refractionFresnelParameters", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsFresnelDirty")], + t.prototype, + "refractionFresnelParameters", + void 0 + ), + n.c( + [Object(r.h)("emissiveFresnelParameters")], + t.prototype, + "_emissiveFresnelParameters", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsFresnelDirty")], + t.prototype, + "emissiveFresnelParameters", + void 0 + ), + n.c( + [Object(r.c)("useReflectionFresnelFromSpecular")], + t.prototype, + "_useReflectionFresnelFromSpecular", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsFresnelDirty")], + t.prototype, + "useReflectionFresnelFromSpecular", + void 0 + ), + n.c( + [Object(r.c)("useGlossinessFromSpecularMapAlpha")], + t.prototype, + "_useGlossinessFromSpecularMapAlpha", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useGlossinessFromSpecularMapAlpha", + void 0 + ), + n.c( + [Object(r.c)("maxSimultaneousLights")], + t.prototype, + "_maxSimultaneousLights", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsLightsDirty")], + t.prototype, + "maxSimultaneousLights", + void 0 + ), + n.c( + [Object(r.c)("invertNormalMapX")], + t.prototype, + "_invertNormalMapX", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "invertNormalMapX", + void 0 + ), + n.c( + [Object(r.c)("invertNormalMapY")], + t.prototype, + "_invertNormalMapY", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "invertNormalMapY", + void 0 + ), + n.c( + [Object(r.c)("twoSidedLighting")], + t.prototype, + "_twoSidedLighting", + void 0 + ), + n.c( + [Object(r.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "twoSidedLighting", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "useLogarithmicDepth", + null + ), t - }(f.a); - m.a.RegisteredTypes["BABYLON.StandardMaterial"] = y, - vec3Math.a.DefaultMaterialFactory = function(e) { - return new y("default material",e) + ); + })(f.a); + (m.a.RegisteredTypes["BABYLON.StandardMaterial"] = y), + (vec3Math.a.DefaultMaterialFactory = function (e) { + return new y("default material", e); + }); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + (e.BuildArray = function (e, t) { + for (var i = [], n = 0; n < e; ++n) i.push(t()); + return i; + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + (e.IsWindowObjectExist = function () { + return "undefined" != typeof window; + }), + (e.GetDOMTextContent = function (e) { + for (var t = "", i = e.firstChild; i; ) + 3 === i.nodeType && (t += i.textContent), + (i = i.nextSibling); + return t; + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e(e, t, i, n, r, o) { + (this.source = e), + (this.pointerX = t), + (this.pointerY = i), + (this.meshUnderPointer = n), + (this.sourceEvent = r), + (this.additionalData = o); } - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return e.BuildArray = function(e, t) { - for (var i = [], n = 0; n < e; ++n) - i.push(t()); - return i - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return e.IsWindowObjectExist = function() { - return "undefined" != typeof window - } - , - e.GetDOMTextContent = function(e) { - for (var t = "", i = e.firstChild; i; ) - 3 === i.nodeType && (t += i.textContent), - i = i.nextSibling; - return t - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e(e, t, i, n, r, o) { - this.source = e, - this.pointerX = t, - this.pointerY = i, - this.meshUnderPointer = n, - this.sourceEvent = r, - this.additionalData = o - } - return e.CreateNew = function(t, i, n) { - var r = t.getScene(); - return new e(t,r.pointerX,r.pointerY,r.meshUnderPointer || t,i,n) - } - , - e.CreateNewFromSprite = function(t, i, n, r) { - return new e(t,i.pointerX,i.pointerY,i.meshUnderPointer,n,r) - } - , - e.CreateNewFromScene = function(t, i) { - return new e(null,t.pointerX,t.pointerY,t.meshUnderPointer,i) - } - , - e.CreateNewFromPrimitive = function(t, i, n, r) { - return new e(t,i.x,i.y,null,n,r) - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "e", function() { - return r + return ( + (e.CreateNew = function (t, i, n) { + var r = t.getScene(); + return new e( + t, + r.pointerX, + r.pointerY, + r.meshUnderPointer || t, + i, + n + ); + }), + (e.CreateNewFromSprite = function (t, i, n, r) { + return new e( + t, + i.pointerX, + i.pointerY, + i.meshUnderPointer, + n, + r + ); + }), + (e.CreateNewFromScene = function (t, i) { + return new e( + null, + t.pointerX, + t.pointerY, + t.meshUnderPointer, + i + ); + }), + (e.CreateNewFromPrimitive = function (t, i, n, r) { + return new e(t, i.x, i.y, null, n, r); + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "e", function () { + return r; + }), + i.d(t, "a", function () { + return o; }), - i.d(t, "a", function() { - return o + i.d(t, "d", function () { + return a; }), - i.d(t, "d", function() { - return a + i.d(t, "c", function () { + return s; }), - i.d(t, "c", function() { - return s - }), - i.d(t, "b", function() { - return c + i.d(t, "b", function () { + return c; }); - var n = i(1) - , r = function() { - function e(e, t) { - this.type = e, - this.jointData = t, - t.nativeParams = t.nativeParams || {} - } - return Object.defineProperty(e.prototype, "physicsJoint", { - get: function() { - return this._physicsJoint - }, - set: function(e) { - this._physicsJoint, - this._physicsJoint = e - }, - enumerable: true, - configurable: true + var n = i(1), + r = (function () { + function e(e, t) { + (this.type = e), + (this.jointData = t), + (t.nativeParams = t.nativeParams || {}); + } + return ( + Object.defineProperty(e.prototype, "physicsJoint", { + get: function () { + return this._physicsJoint; + }, + set: function (e) { + this._physicsJoint, (this._physicsJoint = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "physicsPlugin", { - set: function(e) { - this._physicsPlugin = e - }, - enumerable: true, - configurable: true + set: function (e) { + this._physicsPlugin = e; + }, + enumerable: true, + configurable: true, }), - e.prototype.executeNativeFunction = function(e) { - e(this._physicsPlugin.world, this._physicsJoint) - } - , - e.DistanceJoint = 0, - e.HingeJoint = 1, - e.BallAndSocketJoint = 2, - e.WheelJoint = 3, - e.SliderJoint = 4, - e.PrismaticJoint = 5, - e.UniversalJoint = 6, - e.Hinge2Joint = e.WheelJoint, - e.PointToPointJoint = 8, - e.SpringJoint = 9, - e.LockJoint = 10, + (e.prototype.executeNativeFunction = function (e) { + e(this._physicsPlugin.world, this._physicsJoint); + }), + (e.DistanceJoint = 0), + (e.HingeJoint = 1), + (e.BallAndSocketJoint = 2), + (e.WheelJoint = 3), + (e.SliderJoint = 4), + (e.PrismaticJoint = 5), + (e.UniversalJoint = 6), + (e.Hinge2Joint = e.WheelJoint), + (e.PointToPointJoint = 8), + (e.SpringJoint = 9), + (e.LockJoint = 10), e - }() - , o = function(e) { - function t(t) { - return e.call(this, r.DistanceJoint, t) || this - } - return n.d(t, e), - t.prototype.updateDistance = function(e, t) { - this._physicsPlugin.updateDistanceJoint(this, e, t) - } - , + ); + })(), + o = (function (e) { + function t(t) { + return e.call(this, r.DistanceJoint, t) || this; + } + return ( + n.d(t, e), + (t.prototype.updateDistance = function (e, t) { + this._physicsPlugin.updateDistanceJoint(this, e, t); + }), t - }(r) - , a = function(e) { - function t(t, i) { - return e.call(this, t, i) || this - } - return n.d(t, e), - t.prototype.setMotor = function(e, t) { - this._physicsPlugin.setMotor(this, e || 0, t) - } - , - t.prototype.setLimit = function(e, t) { - this._physicsPlugin.setLimit(this, e, t) - } - , + ); + })(r), + a = (function (e) { + function t(t, i) { + return e.call(this, t, i) || this; + } + return ( + n.d(t, e), + (t.prototype.setMotor = function (e, t) { + this._physicsPlugin.setMotor(this, e || 0, t); + }), + (t.prototype.setLimit = function (e, t) { + this._physicsPlugin.setLimit(this, e, t); + }), t - }(r) - , s = function(e) { - function t(t) { - return e.call(this, r.HingeJoint, t) || this - } - return n.d(t, e), - t.prototype.setMotor = function(e, t) { - this._physicsPlugin.setMotor(this, e || 0, t) - } - , - t.prototype.setLimit = function(e, t) { - this._physicsPlugin.setLimit(this, e, t) - } - , + ); + })(r), + s = (function (e) { + function t(t) { + return e.call(this, r.HingeJoint, t) || this; + } + return ( + n.d(t, e), + (t.prototype.setMotor = function (e, t) { + this._physicsPlugin.setMotor(this, e || 0, t); + }), + (t.prototype.setLimit = function (e, t) { + this._physicsPlugin.setLimit(this, e, t); + }), t - }(a) - , c = function(e) { - function t(t) { - return e.call(this, r.Hinge2Joint, t) || this - } - return n.d(t, e), - t.prototype.setMotor = function(e, t, i) { - void 0 === i && (i = 0), - this._physicsPlugin.setMotor(this, e || 0, t, i) - } - , - t.prototype.setLimit = function(e, t, i) { - void 0 === i && (i = 0), - this._physicsPlugin.setLimit(this, e, t, i) - } - , + ); + })(a), + c = (function (e) { + function t(t) { + return e.call(this, r.Hinge2Joint, t) || this; + } + return ( + n.d(t, e), + (t.prototype.setMotor = function (e, t, i) { + void 0 === i && (i = 0), + this._physicsPlugin.setMotor(this, e || 0, t, i); + }), + (t.prototype.setLimit = function (e, t, i) { + void 0 === i && (i = 0), + this._physicsPlugin.setLimit(this, e, t, i); + }), t - }(a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return u - }); - var n = i(1) - , r = i(2) - , o = i(0) - , a = i(25) - , s = i(63) - , c = i(22) - , u = function(e) { - function t(i, n) { - var r = e.call(this, i, n) || this; - return r.diffuse = new o.e(1,1,1), - r.specular = new o.e(1,1,1), - r.falloffType = t.FALLOFF_DEFAULT, - r.intensity = 1, - r._range = Number.MAX_VALUE, - r._inverseSquaredRange = 0, - r._photometricScale = 1, - r._intensityMode = t.INTENSITYMODE_AUTOMATIC, - r._radius = 1e-5, - r.renderPriority = 0, - r._shadowEnabled = true, - r._excludeWithLayerMask = 0, - r._includeOnlyWithLayerMask = 0, - r._lightmapMode = 0, - r._excludedMeshesIds = new Array, - r._includedOnlyMeshesIds = new Array, - r._isLight = true, - r.getScene().addLight(r), - r._uniformBuffer = new s.a(r.getScene().getEngine()), - r._buildUniformLayout(), - r.includedOnlyMeshes = new Array, - r.excludedMeshes = new Array, - r._resyncMeshes(), - r - } - return n.d(t, e), + ); + })(a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return u; + }); + var n = i(1), + r = i(2), + o = i(0), + a = i(25), + s = i(63), + c = i(22), + u = (function (e) { + function t(i, n) { + var r = e.call(this, i, n) || this; + return ( + (r.diffuse = new o.e(1, 1, 1)), + (r.specular = new o.e(1, 1, 1)), + (r.falloffType = t.FALLOFF_DEFAULT), + (r.intensity = 1), + (r._range = Number.MAX_VALUE), + (r._inverseSquaredRange = 0), + (r._photometricScale = 1), + (r._intensityMode = t.INTENSITYMODE_AUTOMATIC), + (r._radius = 1e-5), + (r.renderPriority = 0), + (r._shadowEnabled = true), + (r._excludeWithLayerMask = 0), + (r._includeOnlyWithLayerMask = 0), + (r._lightmapMode = 0), + (r._excludedMeshesIds = new Array()), + (r._includedOnlyMeshesIds = new Array()), + (r._isLight = true), + r.getScene().addLight(r), + (r._uniformBuffer = new s.a(r.getScene().getEngine())), + r._buildUniformLayout(), + (r.includedOnlyMeshes = new Array()), + (r.excludedMeshes = new Array()), + r._resyncMeshes(), + r + ); + } + return ( + n.d(t, e), Object.defineProperty(t.prototype, "range", { - get: function() { - return this._range - }, - set: function(e) { - this._range = e, - this._inverseSquaredRange = 1 / (this.range * this.range) - }, - enumerable: true, - configurable: true + get: function () { + return this._range; + }, + set: function (e) { + (this._range = e), + (this._inverseSquaredRange = + 1 / (this.range * this.range)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "intensityMode", { - get: function() { - return this._intensityMode - }, - set: function(e) { - this._intensityMode = e, - this._computePhotometricScale() - }, - enumerable: true, - configurable: true + get: function () { + return this._intensityMode; + }, + set: function (e) { + (this._intensityMode = e), + this._computePhotometricScale(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "radius", { - get: function() { - return this._radius - }, - set: function(e) { - this._radius = e, - this._computePhotometricScale() - }, - enumerable: true, - configurable: true + get: function () { + return this._radius; + }, + set: function (e) { + (this._radius = e), this._computePhotometricScale(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "shadowEnabled", { - get: function() { - return this._shadowEnabled - }, - set: function(e) { - this._shadowEnabled !== e && (this._shadowEnabled = e, - this._markMeshesAsLightDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._shadowEnabled; + }, + set: function (e) { + this._shadowEnabled !== e && + ((this._shadowEnabled = e), + this._markMeshesAsLightDirty()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "includedOnlyMeshes", { - get: function() { - return this._includedOnlyMeshes - }, - set: function(e) { - this._includedOnlyMeshes = e, - this._hookArrayForIncludedOnly(e) - }, - enumerable: true, - configurable: true + get: function () { + return this._includedOnlyMeshes; + }, + set: function (e) { + (this._includedOnlyMeshes = e), + this._hookArrayForIncludedOnly(e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "excludedMeshes", { - get: function() { - return this._excludedMeshes - }, - set: function(e) { - this._excludedMeshes = e, - this._hookArrayForExcluded(e) - }, - enumerable: true, - configurable: true + get: function () { + return this._excludedMeshes; + }, + set: function (e) { + (this._excludedMeshes = e), + this._hookArrayForExcluded(e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "excludeWithLayerMask", { - get: function() { - return this._excludeWithLayerMask + get: function () { + return this._excludeWithLayerMask; + }, + set: function (e) { + (this._excludeWithLayerMask = e), this._resyncMeshes(); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "includeOnlyWithLayerMask", + { + get: function () { + return this._includeOnlyWithLayerMask; }, - set: function(e) { - this._excludeWithLayerMask = e, - this._resyncMeshes() + set: function (e) { + (this._includeOnlyWithLayerMask = e), + this._resyncMeshes(); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "includeOnlyWithLayerMask", { - get: function() { - return this._includeOnlyWithLayerMask - }, - set: function(e) { - this._includeOnlyWithLayerMask = e, - this._resyncMeshes() - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "lightmapMode", { - get: function() { - return this._lightmapMode - }, - set: function(e) { - this._lightmapMode !== e && (this._lightmapMode = e, - this._markMeshesAsLightDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._lightmapMode; + }, + set: function (e) { + this._lightmapMode !== e && + ((this._lightmapMode = e), + this._markMeshesAsLightDirty()); + }, + enumerable: true, + configurable: true, }), - t.prototype.getClassName = function() { - return "Light" - } - , - t.prototype.toString = function(e) { - var t = "Name: " + this.name; - if (t += ", type: " + ["Point", "Directional", "Spot", "Hemispheric"][this.getTypeID()], + (t.prototype.getClassName = function () { + return "Light"; + }), + (t.prototype.toString = function (e) { + var t = "Name: " + this.name; + if ( + ((t += + ", type: " + + ["Point", "Directional", "Spot", "Hemispheric"][ + this.getTypeID() + ]), this.animations) - for (var i = 0; i < this.animations.length; i++) - t += ", animation[0]: " + this.animations[i].toString(e); - return t - } - , - t.prototype._syncParentEnabledState = function() { - e.prototype._syncParentEnabledState.call(this), - this._resyncMeshes() - } - , - t.prototype.setEnabled = function(t) { - e.prototype.setEnabled.call(this, t), - this._resyncMeshes() - } - , - t.prototype.getShadowGenerator = function() { - return this._shadowGenerator - } - , - t.prototype.getAbsolutePosition = function() { - return o.x.Zero() - } - , - t.prototype.canAffectMesh = function(e) { - return !(e && (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && -1 === this.includedOnlyMeshes.indexOf(e) || this.excludedMeshes && this.excludedMeshes.length > 0 && -1 !== this.excludedMeshes.indexOf(e) || 0 !== this.includeOnlyWithLayerMask && 0 == (this.includeOnlyWithLayerMask & e.layerMask) || 0 !== this.excludeWithLayerMask && this.excludeWithLayerMask & e.layerMask)) - } - , - t.CompareLightsPriority = function(e, t) { - return e.shadowEnabled !== t.shadowEnabled ? (t.shadowEnabled ? 1 : 0) - (e.shadowEnabled ? 1 : 0) : t.renderPriority - e.renderPriority - } - , - t.prototype.dispose = function(t, i) { - void 0 === i && (i = false), - this._shadowGenerator && (this._shadowGenerator.dispose(), - this._shadowGenerator = null), + ) + for (var i = 0; i < this.animations.length; i++) + t += + ", animation[0]: " + this.animations[i].toString(e); + return t; + }), + (t.prototype._syncParentEnabledState = function () { + e.prototype._syncParentEnabledState.call(this), + this._resyncMeshes(); + }), + (t.prototype.setEnabled = function (t) { + e.prototype.setEnabled.call(this, t), + this._resyncMeshes(); + }), + (t.prototype.getShadowGenerator = function () { + return this._shadowGenerator; + }), + (t.prototype.getAbsolutePosition = function () { + return o.x.Zero(); + }), + (t.prototype.canAffectMesh = function (e) { + return !( + e && + ((this.includedOnlyMeshes && + this.includedOnlyMeshes.length > 0 && + -1 === this.includedOnlyMeshes.indexOf(e)) || + (this.excludedMeshes && + this.excludedMeshes.length > 0 && + -1 !== this.excludedMeshes.indexOf(e)) || + (0 !== this.includeOnlyWithLayerMask && + 0 == + (this.includeOnlyWithLayerMask & e.layerMask)) || + (0 !== this.excludeWithLayerMask && + this.excludeWithLayerMask & e.layerMask)) + ); + }), + (t.CompareLightsPriority = function (e, t) { + return e.shadowEnabled !== t.shadowEnabled + ? (t.shadowEnabled ? 1 : 0) - (e.shadowEnabled ? 1 : 0) + : t.renderPriority - e.renderPriority; + }), + (t.prototype.dispose = function (t, i) { + void 0 === i && (i = false), + this._shadowGenerator && + (this._shadowGenerator.dispose(), + (this._shadowGenerator = null)), this.getScene().stopAnimation(this); - for (var n = 0, r = this.getScene().meshes; n < r.length; n++) - r[n]._removeLightSource(this); - this._uniformBuffer.dispose(), + for ( + var n = 0, r = this.getScene().meshes; + n < r.length; + n++ + ) + r[n]._removeLightSource(this); + this._uniformBuffer.dispose(), this.getScene().removeLight(this), - e.prototype.dispose.call(this, t, i) - } - , - t.prototype.getTypeID = function() { - return 0 - } - , - t.prototype.getScaledIntensity = function() { - return this._photometricScale * this.intensity - } - , - t.prototype.clone = function(e) { - var i = t.GetConstructorFromName(this.getTypeID(), e, this.getScene()); - return i ? r.a.Clone(i, this) : null - } - , - t.prototype.serialize = function() { - var e = r.a.Serialize(this); - return e.type = this.getTypeID(), + e.prototype.dispose.call(this, t, i); + }), + (t.prototype.getTypeID = function () { + return 0; + }), + (t.prototype.getScaledIntensity = function () { + return this._photometricScale * this.intensity; + }), + (t.prototype.clone = function (e) { + var i = t.GetConstructorFromName( + this.getTypeID(), + e, + this.getScene() + ); + return i ? r.a.Clone(i, this) : null; + }), + (t.prototype.serialize = function () { + var e = r.a.Serialize(this); + return ( + (e.type = this.getTypeID()), this.parent && (e.parentId = this.parent.id), - this.excludedMeshes.length > 0 && (e.excludedMeshesIds = [], - this.excludedMeshes.forEach(function(t) { - e.excludedMeshesIds.push(t.id) - })), - this.includedOnlyMeshes.length > 0 && (e.includedOnlyMeshesIds = [], - this.includedOnlyMeshes.forEach(function(t) { - e.includedOnlyMeshesIds.push(t.id) - })), + this.excludedMeshes.length > 0 && + ((e.excludedMeshesIds = []), + this.excludedMeshes.forEach(function (t) { + e.excludedMeshesIds.push(t.id); + })), + this.includedOnlyMeshes.length > 0 && + ((e.includedOnlyMeshesIds = []), + this.includedOnlyMeshes.forEach(function (t) { + e.includedOnlyMeshesIds.push(t.id); + })), r.a.AppendSerializedAnimations(this, e), - e.ranges = this.serializeAnimationRanges(), + (e.ranges = this.serializeAnimationRanges()), e - } - , - t.GetConstructorFromName = function(e, t, i) { - return a.a.Construct("Light_Type_" + e, t, i) || null - } - , - t.Parse = function(e, i) { - var n = t.GetConstructorFromName(e.type, e.name, i); - if (!n) - return null; - var o = r.a.Parse(n, e, i); - if (e.excludedMeshesIds && (o._excludedMeshesIds = e.excludedMeshesIds), - e.includedOnlyMeshesIds && (o._includedOnlyMeshesIds = e.includedOnlyMeshesIds), + ); + }), + (t.GetConstructorFromName = function (e, t, i) { + return a.a.Construct("Light_Type_" + e, t, i) || null; + }), + (t.Parse = function (e, i) { + var n = t.GetConstructorFromName(e.type, e.name, i); + if (!n) return null; + var o = r.a.Parse(n, e, i); + if ( + (e.excludedMeshesIds && + (o._excludedMeshesIds = e.excludedMeshesIds), + e.includedOnlyMeshesIds && + (o._includedOnlyMeshesIds = e.includedOnlyMeshesIds), e.parentId && (o._waitingParentId = e.parentId), - void 0 !== e.falloffType && (o.falloffType = e.falloffType), - void 0 !== e.lightmapMode && (o.lightmapMode = e.lightmapMode), - e.animations) { - for (var s = 0; s < e.animations.length; s++) { - var u = e.animations[s] - , l = c.a.GetClass("BABYLON.Animation"); - l && o.animations.push(l.Parse(u)) - } - a.a.ParseAnimationRanges(o, e, i) + void 0 !== e.falloffType && + (o.falloffType = e.falloffType), + void 0 !== e.lightmapMode && + (o.lightmapMode = e.lightmapMode), + e.animations) + ) { + for (var s = 0; s < e.animations.length; s++) { + var u = e.animations[s], + l = c.a.GetClass("BABYLON.Animation"); + l && o.animations.push(l.Parse(u)); } - return e.autoAnimate && i.beginAnimation(o, e.autoAnimateFrom, e.autoAnimateTo, e.autoAnimateLoop, e.autoAnimateSpeed || 1), + a.a.ParseAnimationRanges(o, e, i); + } + return ( + e.autoAnimate && + i.beginAnimation( + o, + e.autoAnimateFrom, + e.autoAnimateTo, + e.autoAnimateLoop, + e.autoAnimateSpeed || 1 + ), o - } - , - t.prototype._hookArrayForExcluded = function(e) { - var t = this - , i = e.push; - e.push = function() { - for (var n = [], r = 0; r < arguments.length; r++) - n[r] = arguments[r]; - for (var o = i.apply(e, n), a = 0, s = n; a < s.length; a++) - s[a]._resyncLighSource(t); - return o - } - ; - var n = e.splice; - e.splice = function(i, r) { - for (var o = n.apply(e, [i, r]), a = 0, s = o; a < s.length; a++) - s[a]._resyncLighSource(t); - return o - } - ; - for (var r = 0, o = e; r < o.length; r++) - o[r]._resyncLighSource(this) - } - , - t.prototype._hookArrayForIncludedOnly = function(e) { - var t = this - , i = e.push; - e.push = function() { - for (var n = [], r = 0; r < arguments.length; r++) - n[r] = arguments[r]; - var o = i.apply(e, n); - return t._resyncMeshes(), - o - } - ; - var n = e.splice; - e.splice = function(i, r) { - var o = n.apply(e, [i, r]); - return t._resyncMeshes(), - o - } - , - this._resyncMeshes() - } - , - t.prototype._resyncMeshes = function() { - for (var e = 0, t = this.getScene().meshes; e < t.length; e++) - t[e]._resyncLighSource(this) - } - , - t.prototype._markMeshesAsLightDirty = function() { - for (var e = 0, t = this.getScene().meshes; e < t.length; e++) { - var i = t[e]; - -1 !== i.lightSources.indexOf(this) && i._markSubMeshesAsLightDirty() - } - } - , - t.prototype._computePhotometricScale = function() { - this._photometricScale = this._getPhotometricScale(), - this.getScene().resetCachedMaterial() - } - , - t.prototype._getPhotometricScale = function() { - var e = 0 - , i = this.getTypeID() - , n = this.intensityMode; - switch (n === t.INTENSITYMODE_AUTOMATIC && (n = i === t.LIGHTTYPEID_DIRECTIONALLIGHT ? t.INTENSITYMODE_ILLUMINANCE : t.INTENSITYMODE_LUMINOUSINTENSITY), - i) { + ); + }), + (t.prototype._hookArrayForExcluded = function (e) { + var t = this, + i = e.push; + e.push = function () { + for (var n = [], r = 0; r < arguments.length; r++) + n[r] = arguments[r]; + for ( + var o = i.apply(e, n), a = 0, s = n; + a < s.length; + a++ + ) + s[a]._resyncLighSource(t); + return o; + }; + var n = e.splice; + e.splice = function (i, r) { + for ( + var o = n.apply(e, [i, r]), a = 0, s = o; + a < s.length; + a++ + ) + s[a]._resyncLighSource(t); + return o; + }; + for (var r = 0, o = e; r < o.length; r++) + o[r]._resyncLighSource(this); + }), + (t.prototype._hookArrayForIncludedOnly = function (e) { + var t = this, + i = e.push; + e.push = function () { + for (var n = [], r = 0; r < arguments.length; r++) + n[r] = arguments[r]; + var o = i.apply(e, n); + return t._resyncMeshes(), o; + }; + var n = e.splice; + (e.splice = function (i, r) { + var o = n.apply(e, [i, r]); + return t._resyncMeshes(), o; + }), + this._resyncMeshes(); + }), + (t.prototype._resyncMeshes = function () { + for ( + var e = 0, t = this.getScene().meshes; + e < t.length; + e++ + ) + t[e]._resyncLighSource(this); + }), + (t.prototype._markMeshesAsLightDirty = function () { + for ( + var e = 0, t = this.getScene().meshes; + e < t.length; + e++ + ) { + var i = t[e]; + -1 !== i.lightSources.indexOf(this) && + i._markSubMeshesAsLightDirty(); + } + }), + (t.prototype._computePhotometricScale = function () { + (this._photometricScale = this._getPhotometricScale()), + this.getScene().resetCachedMaterial(); + }), + (t.prototype._getPhotometricScale = function () { + var e = 0, + i = this.getTypeID(), + n = this.intensityMode; + switch ( + (n === t.INTENSITYMODE_AUTOMATIC && + (n = + i === t.LIGHTTYPEID_DIRECTIONALLIGHT + ? t.INTENSITYMODE_ILLUMINANCE + : t.INTENSITYMODE_LUMINOUSINTENSITY), + i) + ) { case t.LIGHTTYPEID_POINTLIGHT: case t.LIGHTTYPEID_SPOTLIGHT: - switch (n) { + switch (n) { case t.INTENSITYMODE_LUMINOUSPOWER: - e = 1 / (4 * Math.PI); - break; + e = 1 / (4 * Math.PI); + break; case t.INTENSITYMODE_LUMINOUSINTENSITY: - e = 1; - break; + e = 1; + break; case t.INTENSITYMODE_LUMINANCE: - e = this.radius * this.radius - } - break; + e = this.radius * this.radius; + } + break; case t.LIGHTTYPEID_DIRECTIONALLIGHT: - switch (n) { + switch (n) { case t.INTENSITYMODE_ILLUMINANCE: - e = 1; - break; + e = 1; + break; case t.INTENSITYMODE_LUMINANCE: - var r = this.radius; - r = Math.max(r, .001), - e = 2 * Math.PI * (1 - Math.cos(r)) - } - break; + var r = this.radius; + (r = Math.max(r, 0.001)), + (e = 2 * Math.PI * (1 - Math.cos(r))); + } + break; case t.LIGHTTYPEID_HEMISPHERICLIGHT: - e = 1 - } - return e - } - , - t.prototype._reorderLightsInScene = function() { - var e = this.getScene(); - 0 != this._renderPriority && (e.requireLightSorting = true), - this.getScene().sortLightsByPriority() - } - , - t.FALLOFF_DEFAULT = 0, - t.FALLOFF_PHYSICAL = 1, - t.FALLOFF_GLTF = 2, - t.FALLOFF_STANDARD = 3, - t.LIGHTMAP_DEFAULT = 0, - t.LIGHTMAP_SPECULAR = 1, - t.LIGHTMAP_SHADOWSONLY = 2, - t.INTENSITYMODE_AUTOMATIC = 0, - t.INTENSITYMODE_LUMINOUSPOWER = 1, - t.INTENSITYMODE_LUMINOUSINTENSITY = 2, - t.INTENSITYMODE_ILLUMINANCE = 3, - t.INTENSITYMODE_LUMINANCE = 4, - t.LIGHTTYPEID_POINTLIGHT = 0, - t.LIGHTTYPEID_DIRECTIONALLIGHT = 1, - t.LIGHTTYPEID_SPOTLIGHT = 2, - t.LIGHTTYPEID_HEMISPHERICLIGHT = 3, + e = 1; + } + return e; + }), + (t.prototype._reorderLightsInScene = function () { + var e = this.getScene(); + 0 != this._renderPriority && + (e.requireLightSorting = true), + this.getScene().sortLightsByPriority(); + }), + (t.FALLOFF_DEFAULT = 0), + (t.FALLOFF_PHYSICAL = 1), + (t.FALLOFF_GLTF = 2), + (t.FALLOFF_STANDARD = 3), + (t.LIGHTMAP_DEFAULT = 0), + (t.LIGHTMAP_SPECULAR = 1), + (t.LIGHTMAP_SHADOWSONLY = 2), + (t.INTENSITYMODE_AUTOMATIC = 0), + (t.INTENSITYMODE_LUMINOUSPOWER = 1), + (t.INTENSITYMODE_LUMINOUSINTENSITY = 2), + (t.INTENSITYMODE_ILLUMINANCE = 3), + (t.INTENSITYMODE_LUMINANCE = 4), + (t.LIGHTTYPEID_POINTLIGHT = 0), + (t.LIGHTTYPEID_DIRECTIONALLIGHT = 1), + (t.LIGHTTYPEID_SPOTLIGHT = 2), + (t.LIGHTTYPEID_HEMISPHERICLIGHT = 3), n.c([Object(r.e)()], t.prototype, "diffuse", void 0), n.c([Object(r.e)()], t.prototype, "specular", void 0), n.c([Object(r.c)()], t.prototype, "falloffType", void 0), @@ -42684,1155 +54149,1574 @@ and limitations under the License. n.c([Object(r.c)()], t.prototype, "range", null), n.c([Object(r.c)()], t.prototype, "intensityMode", null), n.c([Object(r.c)()], t.prototype, "radius", null), - n.c([Object(r.c)()], t.prototype, "_renderPriority", void 0), - n.c([Object(r.b)("_reorderLightsInScene")], t.prototype, "renderPriority", void 0), - n.c([Object(r.c)("shadowEnabled")], t.prototype, "_shadowEnabled", void 0), - n.c([Object(r.c)("excludeWithLayerMask")], t.prototype, "_excludeWithLayerMask", void 0), - n.c([Object(r.c)("includeOnlyWithLayerMask")], t.prototype, "_includeOnlyWithLayerMask", void 0), - n.c([Object(r.c)("lightmapMode")], t.prototype, "_lightmapMode", void 0), + n.c( + [Object(r.c)()], + t.prototype, + "_renderPriority", + void 0 + ), + n.c( + [Object(r.b)("_reorderLightsInScene")], + t.prototype, + "renderPriority", + void 0 + ), + n.c( + [Object(r.c)("shadowEnabled")], + t.prototype, + "_shadowEnabled", + void 0 + ), + n.c( + [Object(r.c)("excludeWithLayerMask")], + t.prototype, + "_excludeWithLayerMask", + void 0 + ), + n.c( + [Object(r.c)("includeOnlyWithLayerMask")], + t.prototype, + "_includeOnlyWithLayerMask", + void 0 + ), + n.c( + [Object(r.c)("lightmapMode")], + t.prototype, + "_lightmapMode", + void 0 + ), t - }(a.a) - } - , function(e, t, getterFunc) { - "use strict"; - getterFunc.d(t, "a", function() { - return u - }); - var n = getterFunc(34); - var r = getterFunc(0); - var o = getterFunc(50); - var a = getterFunc(81); - var vec3Math = getterFunc(16); - var c = getterFunc(21); - - var u = function() { - function e(e, t, i) { - void 0 === i && (i = Number.MAX_VALUE), - this.origin = e, - this.direction = t, - this.length = i - } - return e.prototype.intersectsBoxMinMax = function(t, i, n) { - void 0 === n && (n = 0); - var r, o, a, s, c = e.TmpVector3[0].copyFromFloats(t.x - n, t.y - n, t.z - n), u = e.TmpVector3[1].copyFromFloats(i.x + n, i.y + n, i.z + n), l = 0, h = Number.MAX_VALUE; - if (Math.abs(this.direction.x) < 1e-7) { - if (this.origin.x < c.x || this.origin.x > u.x) - return false - } else if (r = 1 / this.direction.x, - o = (c.x - this.origin.x) * r, - (a = (u.x - this.origin.x) * r) == -1 / 0 && (a = 1 / 0), - o > a && (s = o, - o = a, - a = s), - (l = Math.max(o, l)) > (h = Math.min(a, h))) - return false; - if (Math.abs(this.direction.y) < 1e-7) { - if (this.origin.y < c.y || this.origin.y > u.y) - return false - } else if (r = 1 / this.direction.y, - o = (c.y - this.origin.y) * r, - (a = (u.y - this.origin.y) * r) == -1 / 0 && (a = 1 / 0), - o > a && (s = o, - o = a, - a = s), - (l = Math.max(o, l)) > (h = Math.min(a, h))) - return false; - if (Math.abs(this.direction.z) < 1e-7) { - if (this.origin.z < c.z || this.origin.z > u.z) - return false - } else if (r = 1 / this.direction.z, - o = (c.z - this.origin.z) * r, - (a = (u.z - this.origin.z) * r) == -1 / 0 && (a = 1 / 0), - o > a && (s = o, - o = a, - a = s), - (l = Math.max(o, l)) > (h = Math.min(a, h))) - return false; - return true - } - , - e.prototype.intersectsBox = function(e, t) { - return void 0 === t && (t = 0), - this.intersectsBoxMinMax(e.minimum, e.maximum, t) - } - , - e.prototype.intersectsSphere = function(e, t) { - void 0 === t && (t = 0); - var i = e.center.x - this.origin.x - , n = e.center.y - this.origin.y - , r = e.center.z - this.origin.z - , o = i * i + n * n + r * r - , a = e.radius + t - , s = a * a; - if (o <= s) - return true; - var c = i * this.direction.x + n * this.direction.y + r * this.direction.z; - return !(c < 0) && o - c * c <= s - } - , - e.prototype.intersectsTriangle = function(t, i, n) { - var o = e.TmpVector3[0] - , s = e.TmpVector3[1] - , c = e.TmpVector3[2] - , u = e.TmpVector3[3] - , l = e.TmpVector3[4]; - i.subtractToRef(t, o), - n.subtractToRef(t, s), - r.x.CrossToRef(this.direction, s, c); - var h = r.x.Dot(o, c); - if (0 === h) - return null; - var f = 1 / h; - this.origin.subtractToRef(t, u); - var d = r.x.Dot(u, c) * f; - if (d < 0 || d > 1) - return null; - r.x.CrossToRef(u, o, l); - var p = r.x.Dot(this.direction, l) * f; - if (p < 0 || d + p > 1) - return null; - var m = r.x.Dot(s, l) * f; - return m > this.length ? null : new a.a(d,p,m) - } - , - e.prototype.intersectsPlane = function(e) { - var t, i = r.x.Dot(e.normal, this.direction); - if (Math.abs(i) < 9.99999997475243e-7) - return null; - var n = r.x.Dot(e.normal, this.origin); - return (t = (-e.d - n) / i) < 0 ? t < -9.99999997475243e-7 ? null : 0 : t - } - , - e.prototype.intersectsMesh = function(t, i) { - var n = r.t.Matrix[0]; - return t.getWorldMatrix().invertToRef(n), - this._tmpRay ? e.TransformToRef(this, n, this._tmpRay) : this._tmpRay = e.Transform(this, n), - t.intersects(this._tmpRay, i) - } - , - e.prototype.intersectsMeshes = function(e, t, i) { - i ? i.length = 0 : i = []; - for (var n = 0; n < e.length; n++) { - var r = this.intersectsMesh(e[n], t); - r.hit && i.push(r) - } - return i.sort(this._comparePickingInfo), - i - } - , - e.prototype._comparePickingInfo = function(e, t) { - return e.distance < t.distance ? -1 : e.distance > t.distance ? 1 : 0 - } - , - e.prototype.intersectionSegment = function(t, i, n) { - var o = this.origin - , a = r.t.Vector3[0] - , s = r.t.Vector3[1] - , c = r.t.Vector3[2] - , u = r.t.Vector3[3]; - i.subtractToRef(t, a), - this.direction.scaleToRef(e.rayl, c), - o.addToRef(c, s), - t.subtractToRef(o, u); - var l, h, f, d, p = r.x.Dot(a, a), m = r.x.Dot(a, c), g = r.x.Dot(c, c), _ = r.x.Dot(a, u), v = r.x.Dot(c, u), y = p * g - m * m, b = y, E = y; - y < e.smallnum ? (h = 0, - b = 1, - d = v, - E = g) : (d = p * v - m * _, - (h = m * v - g * _) < 0 ? (h = 0, - d = v, - E = g) : h > b && (h = b, - d = v + m, - E = g)), - d < 0 ? (d = 0, - -_ < 0 ? h = 0 : -_ > p ? h = b : (h = -_, - b = p)) : d > E && (d = E, - -_ + m < 0 ? h = 0 : -_ + m > p ? h = b : (h = -_ + m, - b = p)), - l = Math.abs(h) < e.smallnum ? 0 : h / b, - f = Math.abs(d) < e.smallnum ? 0 : d / E; - var T = r.t.Vector3[4]; - c.scaleToRef(f, T); - var A = r.t.Vector3[5]; - a.scaleToRef(l, A), - A.addInPlace(u); - var x = r.t.Vector3[6]; - return A.subtractToRef(T, x), - f > 0 && f <= this.length && x.lengthSquared() < n * n ? A.length() : -1 - } - , - e.prototype.update = function(e, t, i, n, r, o, a) { - return this.unprojectRayToRef(e, t, i, n, r, o, a), - this - } - , - e.Zero = function() { - return new e(r.x.Zero(),r.x.Zero()) - } - , - e.CreateNew = function(t, i, n, r, o, a, s) { - return e.Zero().update(t, i, n, r, o, a, s) - } - , - e.CreateNewFromTo = function(t, i, n) { - void 0 === n && (n = r.j.IdentityReadOnly); - var o = i.subtract(t) - , a = Math.sqrt(o.x * o.x + o.y * o.y + o.z * o.z); - return o.normalize(), - e.Transform(new e(t,o,a), n) - } - , - e.Transform = function(t, i) { - var n = new e(new r.x(0,0,0),new r.x(0,0,0)); - return e.TransformToRef(t, i, n), - n - } - , - e.TransformToRef = function(e, t, i) { - r.x.TransformCoordinatesToRef(e.origin, t, i.origin), - r.x.TransformNormalToRef(e.direction, t, i.direction), - i.length = e.length; - var n = i.direction - , o = n.length(); - if (0 !== o && 1 !== o) { - var a = 1 / o; - n.x *= a, - n.y *= a, - n.z *= a, - i.length *= o - } - } - , - e.prototype.unprojectRayToRef = function(e, t, i, n, o, a, s) { - var c = r.t.Matrix[0]; - o.multiplyToRef(a, c), - c.multiplyToRef(s, c), - c.invert(); - var u = r.t.Vector3[0]; - u.x = e / i * 2 - 1, - u.y = -(t / n * 2 - 1), - u.z = -1; - var l = r.t.Vector3[1].copyFromFloats(u.x, u.y, 1) - , h = r.t.Vector3[2] - , f = r.t.Vector3[3]; - r.x._UnprojectFromInvertedMatrixToRef(u, c, h), - r.x._UnprojectFromInvertedMatrixToRef(l, c, f), - this.origin.copyFrom(h), - f.subtractToRef(h, this.direction), - this.direction.normalize() - } - , - e.TmpVector3 = n.a.BuildArray(6, r.x.Zero), - e.smallnum = 1e-8, - e.rayl = 1e9, - e - }(); - vec3Math.a.prototype.createPickingRay = function(e, t, i, n, r) { - void 0 === r && (r = false); - var o = u.Zero(); - return this.createPickingRayToRef(e, t, i, o, n, r), - o + ); + })(a.a); + }, + function (e, t, getterFunc) { + "use strict"; + getterFunc.d(t, "a", function () { + return u; + }); + var n = getterFunc(34); + var r = getterFunc(0); + var o = getterFunc(50); + var a = getterFunc(81); + var vec3Math = getterFunc(16); + var c = getterFunc(21); + + var u = (function () { + function e(e, t, i) { + void 0 === i && (i = Number.MAX_VALUE), + (this.origin = e), + (this.direction = t), + (this.length = i); } - , - vec3Math.a.prototype.createPickingRayToRef = function(e, t, i, n, o, a) { - void 0 === a && (a = false); - var s = this.getEngine(); - if (!o) { - if (!this.activeCamera) - throw new Error("Active camera not set"); - o = this.activeCamera + return ( + (e.prototype.intersectsBoxMinMax = function (t, i, n) { + void 0 === n && (n = 0); + var r, + o, + a, + s, + c = e.TmpVector3[0].copyFromFloats( + t.x - n, + t.y - n, + t.z - n + ), + u = e.TmpVector3[1].copyFromFloats( + i.x + n, + i.y + n, + i.z + n + ), + l = 0, + h = Number.MAX_VALUE; + if (Math.abs(this.direction.x) < 1e-7) { + if (this.origin.x < c.x || this.origin.x > u.x) + return false; + } else if ( + ((r = 1 / this.direction.x), + (o = (c.x - this.origin.x) * r), + (a = (u.x - this.origin.x) * r) == -1 / 0 && (a = 1 / 0), + o > a && ((s = o), (o = a), (a = s)), + (l = Math.max(o, l)) > (h = Math.min(a, h))) + ) + return false; + if (Math.abs(this.direction.y) < 1e-7) { + if (this.origin.y < c.y || this.origin.y > u.y) + return false; + } else if ( + ((r = 1 / this.direction.y), + (o = (c.y - this.origin.y) * r), + (a = (u.y - this.origin.y) * r) == -1 / 0 && (a = 1 / 0), + o > a && ((s = o), (o = a), (a = s)), + (l = Math.max(o, l)) > (h = Math.min(a, h))) + ) + return false; + if (Math.abs(this.direction.z) < 1e-7) { + if (this.origin.z < c.z || this.origin.z > u.z) + return false; + } else if ( + ((r = 1 / this.direction.z), + (o = (c.z - this.origin.z) * r), + (a = (u.z - this.origin.z) * r) == -1 / 0 && (a = 1 / 0), + o > a && ((s = o), (o = a), (a = s)), + (l = Math.max(o, l)) > (h = Math.min(a, h))) + ) + return false; + return true; + }), + (e.prototype.intersectsBox = function (e, t) { + return ( + void 0 === t && (t = 0), + this.intersectsBoxMinMax(e.minimum, e.maximum, t) + ); + }), + (e.prototype.intersectsSphere = function (e, t) { + void 0 === t && (t = 0); + var i = e.center.x - this.origin.x, + n = e.center.y - this.origin.y, + r = e.center.z - this.origin.z, + o = i * i + n * n + r * r, + a = e.radius + t, + s = a * a; + if (o <= s) return true; + var c = + i * this.direction.x + + n * this.direction.y + + r * this.direction.z; + return !(c < 0) && o - c * c <= s; + }), + (e.prototype.intersectsTriangle = function (t, i, n) { + var o = e.TmpVector3[0], + s = e.TmpVector3[1], + c = e.TmpVector3[2], + u = e.TmpVector3[3], + l = e.TmpVector3[4]; + i.subtractToRef(t, o), + n.subtractToRef(t, s), + r.x.CrossToRef(this.direction, s, c); + var h = r.x.Dot(o, c); + if (0 === h) return null; + var f = 1 / h; + this.origin.subtractToRef(t, u); + var d = r.x.Dot(u, c) * f; + if (d < 0 || d > 1) return null; + r.x.CrossToRef(u, o, l); + var p = r.x.Dot(this.direction, l) * f; + if (p < 0 || d + p > 1) return null; + var m = r.x.Dot(s, l) * f; + return m > this.length ? null : new a.a(d, p, m); + }), + (e.prototype.intersectsPlane = function (e) { + var t, + i = r.x.Dot(e.normal, this.direction); + if (Math.abs(i) < 9.99999997475243e-7) return null; + var n = r.x.Dot(e.normal, this.origin); + return (t = (-e.d - n) / i) < 0 + ? t < -9.99999997475243e-7 + ? null + : 0 + : t; + }), + (e.prototype.intersectsMesh = function (t, i) { + var n = r.t.Matrix[0]; + return ( + t.getWorldMatrix().invertToRef(n), + this._tmpRay + ? e.TransformToRef(this, n, this._tmpRay) + : (this._tmpRay = e.Transform(this, n)), + t.intersects(this._tmpRay, i) + ); + }), + (e.prototype.intersectsMeshes = function (e, t, i) { + i ? (i.length = 0) : (i = []); + for (var n = 0; n < e.length; n++) { + var r = this.intersectsMesh(e[n], t); + r.hit && i.push(r); } - var c = o.viewport.toGlobal(s.getRenderWidth(), s.getRenderHeight()); - return e = e / s.getHardwareScalingLevel() - c.x, - t = t / s.getHardwareScalingLevel() - (s.getRenderHeight() - c.y - c.height), - n.update(e, t, c.width, c.height, i || r.j.IdentityReadOnly, a ? r.j.IdentityReadOnly : o.getViewMatrix(), o.getProjectionMatrix()), + return i.sort(this._comparePickingInfo), i; + }), + (e.prototype._comparePickingInfo = function (e, t) { + return e.distance < t.distance + ? -1 + : e.distance > t.distance + ? 1 + : 0; + }), + (e.prototype.intersectionSegment = function (t, i, n) { + var o = this.origin, + a = r.t.Vector3[0], + s = r.t.Vector3[1], + c = r.t.Vector3[2], + u = r.t.Vector3[3]; + i.subtractToRef(t, a), + this.direction.scaleToRef(e.rayl, c), + o.addToRef(c, s), + t.subtractToRef(o, u); + var l, + h, + f, + d, + p = r.x.Dot(a, a), + m = r.x.Dot(a, c), + g = r.x.Dot(c, c), + _ = r.x.Dot(a, u), + v = r.x.Dot(c, u), + y = p * g - m * m, + b = y, + E = y; + y < e.smallnum + ? ((h = 0), (b = 1), (d = v), (E = g)) + : ((d = p * v - m * _), + (h = m * v - g * _) < 0 + ? ((h = 0), (d = v), (E = g)) + : h > b && ((h = b), (d = v + m), (E = g))), + d < 0 + ? ((d = 0), + -_ < 0 + ? (h = 0) + : -_ > p + ? (h = b) + : ((h = -_), (b = p))) + : d > E && + ((d = E), + -_ + m < 0 + ? (h = 0) + : -_ + m > p + ? (h = b) + : ((h = -_ + m), (b = p))), + (l = Math.abs(h) < e.smallnum ? 0 : h / b), + (f = Math.abs(d) < e.smallnum ? 0 : d / E); + var T = r.t.Vector3[4]; + c.scaleToRef(f, T); + var A = r.t.Vector3[5]; + a.scaleToRef(l, A), A.addInPlace(u); + var x = r.t.Vector3[6]; + return ( + A.subtractToRef(T, x), + f > 0 && f <= this.length && x.lengthSquared() < n * n + ? A.length() + : -1 + ); + }), + (e.prototype.update = function (e, t, i, n, r, o, a) { + return this.unprojectRayToRef(e, t, i, n, r, o, a), this; + }), + (e.Zero = function () { + return new e(r.x.Zero(), r.x.Zero()); + }), + (e.CreateNew = function (t, i, n, r, o, a, s) { + return e.Zero().update(t, i, n, r, o, a, s); + }), + (e.CreateNewFromTo = function (t, i, n) { + void 0 === n && (n = r.j.IdentityReadOnly); + var o = i.subtract(t), + a = Math.sqrt(o.x * o.x + o.y * o.y + o.z * o.z); + return o.normalize(), e.Transform(new e(t, o, a), n); + }), + (e.Transform = function (t, i) { + var n = new e(new r.x(0, 0, 0), new r.x(0, 0, 0)); + return e.TransformToRef(t, i, n), n; + }), + (e.TransformToRef = function (e, t, i) { + r.x.TransformCoordinatesToRef(e.origin, t, i.origin), + r.x.TransformNormalToRef(e.direction, t, i.direction), + (i.length = e.length); + var n = i.direction, + o = n.length(); + if (0 !== o && 1 !== o) { + var a = 1 / o; + (n.x *= a), (n.y *= a), (n.z *= a), (i.length *= o); + } + }), + (e.prototype.unprojectRayToRef = function ( + e, + t, + i, + n, + o, + a, + s + ) { + var c = r.t.Matrix[0]; + o.multiplyToRef(a, c), c.multiplyToRef(s, c), c.invert(); + var u = r.t.Vector3[0]; + (u.x = (e / i) * 2 - 1), + (u.y = -((t / n) * 2 - 1)), + (u.z = -1); + var l = r.t.Vector3[1].copyFromFloats(u.x, u.y, 1), + h = r.t.Vector3[2], + f = r.t.Vector3[3]; + r.x._UnprojectFromInvertedMatrixToRef(u, c, h), + r.x._UnprojectFromInvertedMatrixToRef(l, c, f), + this.origin.copyFrom(h), + f.subtractToRef(h, this.direction), + this.direction.normalize(); + }), + (e.TmpVector3 = n.a.BuildArray(6, r.x.Zero)), + (e.smallnum = 1e-8), + (e.rayl = 1e9), + e + ); + })(); + (vec3Math.a.prototype.createPickingRay = function ( + e, + t, + i, + n, + r + ) { + void 0 === r && (r = false); + var o = u.Zero(); + return this.createPickingRayToRef(e, t, i, o, n, r), o; + }), + (vec3Math.a.prototype.createPickingRayToRef = function ( + e, + t, + i, + n, + o, + a + ) { + void 0 === a && (a = false); + var s = this.getEngine(); + if (!o) { + if (!this.activeCamera) + throw new Error("Active camera not set"); + o = this.activeCamera; + } + var c = o.viewport.toGlobal( + s.getRenderWidth(), + s.getRenderHeight() + ); + return ( + (e = e / s.getHardwareScalingLevel() - c.x), + (t = + t / s.getHardwareScalingLevel() - + (s.getRenderHeight() - c.y - c.height)), + n.update( + e, + t, + c.width, + c.height, + i || r.j.IdentityReadOnly, + a ? r.j.IdentityReadOnly : o.getViewMatrix(), + o.getProjectionMatrix() + ), this - } - , - vec3Math.a.prototype.createPickingRayInCameraSpace = function(e, t, i) { - var n = u.Zero(); - return this.createPickingRayInCameraSpaceToRef(e, t, n, i), - n - } - , - vec3Math.a.prototype.createPickingRayInCameraSpaceToRef = function(e, t, i, n) { - if (!o.a) - return this; + ); + }), + (vec3Math.a.prototype.createPickingRayInCameraSpace = function ( + e, + t, + i + ) { + var n = u.Zero(); + return this.createPickingRayInCameraSpaceToRef(e, t, n, i), n; + }), + (vec3Math.a.prototype.createPickingRayInCameraSpaceToRef = + function (e, t, i, n) { + if (!o.a) return this; var a = this.getEngine(); if (!n) { - if (!this.activeCamera) - throw new Error("Active camera not set"); - n = this.activeCamera + if (!this.activeCamera) + throw new Error("Active camera not set"); + n = this.activeCamera; } - var s = n.viewport.toGlobal(a.getRenderWidth(), a.getRenderHeight()) - , c = r.j.Identity(); - return e = e / a.getHardwareScalingLevel() - s.x, - t = t / a.getHardwareScalingLevel() - (a.getRenderHeight() - s.y - s.height), - i.update(e, t, s.width, s.height, c, c, n.getProjectionMatrix()), - this - } - , - vec3Math.a.prototype._internalPick = function(e, t, i, n) { - if (!o.a) - return null; - for (var r = null, a = 0; a < this.meshes.length; a++) { - var s = this.meshes[a]; - if (t) { - if (!t(s)) - continue - } else if (!s.isEnabled() || !s.isVisible || !s.isPickable) - continue; - var c = e(s.getWorldMatrix()) - , u = s.intersects(c, i, n); - if (u && u.hit && (i || null == r || !(u.distance >= r.distance)) && (r = u, - i)) - break - } - return r || new o.a - } - , - vec3Math.a.prototype._internalMultiPick = function(e, t, i) { - if (!o.a) - return null; - for (var n = new Array, r = 0; r < this.meshes.length; r++) { - var a = this.meshes[r]; - if (t) { - if (!t(a)) - continue - } else if (!a.isEnabled() || !a.isVisible || !a.isPickable) - continue; - var s = e(a.getWorldMatrix()) - , c = a.intersects(s, false, i); - c && c.hit && n.push(c) - } - return n - } - , - vec3Math.a.prototype.pick = function(e, t, i, n, a, s) { - var c = this; - if (!o.a) - return null; - var l = this._internalPick(function(i) { - return c._tempPickingRay || (c._tempPickingRay = u.Zero()), - c.createPickingRayToRef(e, t, i, c._tempPickingRay, a || null), + var s = n.viewport.toGlobal( + a.getRenderWidth(), + a.getRenderHeight() + ), + c = r.j.Identity(); + return ( + (e = e / a.getHardwareScalingLevel() - s.x), + (t = + t / a.getHardwareScalingLevel() - + (a.getRenderHeight() - s.y - s.height)), + i.update( + e, + t, + s.width, + s.height, + c, + c, + n.getProjectionMatrix() + ), + this + ); + }), + (vec3Math.a.prototype._internalPick = function (e, t, i, n) { + if (!o.a) return null; + for (var r = null, a = 0; a < this.meshes.length; a++) { + var s = this.meshes[a]; + if (t) { + if (!t(s)) continue; + } else if (!s.isEnabled() || !s.isVisible || !s.isPickable) + continue; + var c = e(s.getWorldMatrix()), + u = s.intersects(c, i, n); + if ( + u && + u.hit && + (i || null == r || !(u.distance >= r.distance)) && + ((r = u), i) + ) + break; + } + return r || new o.a(); + }), + (vec3Math.a.prototype._internalMultiPick = function (e, t, i) { + if (!o.a) return null; + for ( + var n = new Array(), r = 0; + r < this.meshes.length; + r++ + ) { + var a = this.meshes[r]; + if (t) { + if (!t(a)) continue; + } else if (!a.isEnabled() || !a.isVisible || !a.isPickable) + continue; + var s = e(a.getWorldMatrix()), + c = a.intersects(s, false, i); + c && c.hit && n.push(c); + } + return n; + }), + (vec3Math.a.prototype.pick = function (e, t, i, n, a, s) { + var c = this; + if (!o.a) return null; + var l = this._internalPick( + function (i) { + return ( + c._tempPickingRay || (c._tempPickingRay = u.Zero()), + c.createPickingRayToRef( + e, + t, + i, + c._tempPickingRay, + a || null + ), c._tempPickingRay - }, i, n, s); - return l && (l.ray = this.createPickingRay(e, t, r.j.Identity(), a || null)), + ); + }, + i, + n, + s + ); + return ( + l && + (l.ray = this.createPickingRay( + e, + t, + r.j.Identity(), + a || null + )), l - } - , - vec3Math.a.prototype.pickWithRay = function(e, t, i, n) { - var o = this - , a = this._internalPick(function(t) { - return o._pickWithRayInverseMatrix || (o._pickWithRayInverseMatrix = r.j.Identity()), - t.invertToRef(o._pickWithRayInverseMatrix), - o._cachedRayForTransform || (o._cachedRayForTransform = u.Zero()), - u.TransformToRef(e, o._pickWithRayInverseMatrix, o._cachedRayForTransform), - o._cachedRayForTransform - }, t, i, n); - return a && (a.ray = e), - a - } - , - vec3Math.a.prototype.multiPick = function(e, t, i, n, r) { - var o = this; - return this._internalMultiPick(function(i) { - return o.createPickingRay(e, t, i, n || null) - }, i, r) - } - , - vec3Math.a.prototype.multiPickWithRay = function(e, t, i) { - var n = this; - return this._internalMultiPick(function(t) { - return n._pickWithRayInverseMatrix || (n._pickWithRayInverseMatrix = r.j.Identity()), + ); + }), + (vec3Math.a.prototype.pickWithRay = function (e, t, i, n) { + var o = this, + a = this._internalPick( + function (t) { + return ( + o._pickWithRayInverseMatrix || + (o._pickWithRayInverseMatrix = r.j.Identity()), + t.invertToRef(o._pickWithRayInverseMatrix), + o._cachedRayForTransform || + (o._cachedRayForTransform = u.Zero()), + u.TransformToRef( + e, + o._pickWithRayInverseMatrix, + o._cachedRayForTransform + ), + o._cachedRayForTransform + ); + }, + t, + i, + n + ); + return a && (a.ray = e), a; + }), + (vec3Math.a.prototype.multiPick = function (e, t, i, n, r) { + var o = this; + return this._internalMultiPick( + function (i) { + return o.createPickingRay(e, t, i, n || null); + }, + i, + r + ); + }), + (vec3Math.a.prototype.multiPickWithRay = function (e, t, i) { + var n = this; + return this._internalMultiPick( + function (t) { + return ( + n._pickWithRayInverseMatrix || + (n._pickWithRayInverseMatrix = r.j.Identity()), t.invertToRef(n._pickWithRayInverseMatrix), - n._cachedRayForTransform || (n._cachedRayForTransform = u.Zero()), - u.TransformToRef(e, n._pickWithRayInverseMatrix, n._cachedRayForTransform), + n._cachedRayForTransform || + (n._cachedRayForTransform = u.Zero()), + u.TransformToRef( + e, + n._pickWithRayInverseMatrix, + n._cachedRayForTransform + ), n._cachedRayForTransform - }, t, i) - } - , - c.a.prototype.getForwardRay = function(e, t, i) { - void 0 === e && (e = 100), + ); + }, + t, + i + ); + }), + (c.a.prototype.getForwardRay = function (e, t, i) { + void 0 === e && (e = 100), t || (t = this.getWorldMatrix()), i || (i = this.position); - var n = this._scene.useRightHandedSystem ? new r.x(0,0,-1) : new r.x(0,0,1) - , o = r.x.TransformNormal(n, t) - , a = r.x.Normalize(o); - return new u(i,a,e) - } - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return c + var n = this._scene.useRightHandedSystem + ? new r.x(0, 0, -1) + : new r.x(0, 0, 1), + o = r.x.TransformNormal(n, t), + a = r.x.Normalize(o); + return new u(i, a, e); }); - var n = i(0) - , r = i(11) - , o = i(13) - , a = i(72) - , s = i(4); - o.a.CreateLineSystem = function(e) { - for (var t = [], i = [], n = e.lines, r = e.colors, a = [], s = 0, c = 0; c < n.length; c++) - for (var u = n[c], l = 0; l < u.length; l++) { - if (i.push(u[l].x, u[l].y, u[l].z), - r) { - var h = r[c]; - a.push(h[l].r, h[l].g, h[l].b, h[l].a) - } - l > 0 && (t.push(s - 1), - t.push(s)), - s++ - } - var f = new o.a; - return f.indices = t, - f.positions = i, - r && (f.colors = a), - f - } - , - o.a.CreateDashedLines = function(e) { - var t, i, r = e.dashSize || 3, a = e.gapSize || 1, s = e.dashNb || 200, c = e.points, u = new Array, l = new Array, h = n.x.Zero(), f = 0, d = 0, p = 0, m = 0, g = 0; - for (g = 0; g < c.length - 1; g++) - c[g + 1].subtractToRef(c[g], h), - f += h.length(); - for (i = r * (t = f / s) / (r + a), - g = 0; g < c.length - 1; g++) { - c[g + 1].subtractToRef(c[g], h), - d = Math.floor(h.length() / t), - h.normalize(); - for (var _ = 0; _ < d; _++) - p = t * _, - u.push(c[g].x + p * h.x, c[g].y + p * h.y, c[g].z + p * h.z), - u.push(c[g].x + (p + i) * h.x, c[g].y + (p + i) * h.y, c[g].z + (p + i) * h.z), - l.push(m, m + 1), - m += 2 + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return c; + }); + var n = i(0), + r = i(11), + o = i(13), + a = i(72), + s = i(4); + (o.a.CreateLineSystem = function (e) { + for ( + var t = [], + i = [], + n = e.lines, + r = e.colors, + a = [], + s = 0, + c = 0; + c < n.length; + c++ + ) + for (var u = n[c], l = 0; l < u.length; l++) { + if ((i.push(u[l].x, u[l].y, u[l].z), r)) { + var h = r[c]; + a.push(h[l].r, h[l].g, h[l].b, h[l].a); } - var v = new o.a; - return v.positions = u, - v.indices = l, - v - } - , - r.a.CreateLines = function(e, t, i, n, r) { - void 0 === i && (i = null), + l > 0 && (t.push(s - 1), t.push(s)), s++; + } + var f = new o.a(); + return ( + (f.indices = t), (f.positions = i), r && (f.colors = a), f + ); + }), + (o.a.CreateDashedLines = function (e) { + var t, + i, + r = e.dashSize || 3, + a = e.gapSize || 1, + s = e.dashNb || 200, + c = e.points, + u = new Array(), + l = new Array(), + h = n.x.Zero(), + f = 0, + d = 0, + p = 0, + m = 0, + g = 0; + for (g = 0; g < c.length - 1; g++) + c[g + 1].subtractToRef(c[g], h), (f += h.length()); + for ( + i = (r * (t = f / s)) / (r + a), g = 0; + g < c.length - 1; + g++ + ) { + c[g + 1].subtractToRef(c[g], h), + (d = Math.floor(h.length() / t)), + h.normalize(); + for (var _ = 0; _ < d; _++) + (p = t * _), + u.push( + c[g].x + p * h.x, + c[g].y + p * h.y, + c[g].z + p * h.z + ), + u.push( + c[g].x + (p + i) * h.x, + c[g].y + (p + i) * h.y, + c[g].z + (p + i) * h.z + ), + l.push(m, m + 1), + (m += 2); + } + var v = new o.a(); + return (v.positions = u), (v.indices = l), v; + }), + (r.a.CreateLines = function (e, t, i, n, r) { + void 0 === i && (i = null), void 0 === n && (n = false), void 0 === r && (r = null); - var o = { - points: t, - updatable: n, - instance: r - }; - return c.CreateLines(e, o, i) - } - , - r.a.CreateDashedLines = function(e, t, i, n, r, o, a, s) { - void 0 === o && (o = null); - var u = { - points: t, - dashSize: i, - gapSize: n, - dashNb: r, - updatable: a, - instance: s - }; - return c.CreateDashedLines(e, u, o) - } - ; - var c = function() { - function e() {} - return e.CreateLineSystem = function(e, t, i) { - var n = t.instance - , r = t.lines - , c = t.colors; - if (n) { - var u, l, h = n.getVerticesData(s.b.PositionKind); - c && (u = n.getVerticesData(s.b.ColorKind)); - for (var f = 0, d = 0, p = 0; p < r.length; p++) - for (var m = r[p], g = 0; g < m.length; g++) - h[f] = m[g].x, - h[f + 1] = m[g].y, - h[f + 2] = m[g].z, - c && u && (l = c[p], - u[d] = l[g].r, - u[d + 1] = l[g].g, - u[d + 2] = l[g].b, - u[d + 3] = l[g].a, - d += 4), - f += 3; - return n.updateVerticesData(s.b.PositionKind, h, false, false), - c && u && n.updateVerticesData(s.b.ColorKind, u, false, false), - n - } - var _ = !!c - , v = new a.b(e,i,null,void 0,void 0,_,t.useVertexAlpha); - return o.a.CreateLineSystem(t).applyToMesh(v, t.updatable), - v - } - , - e.CreateLines = function(t, i, n) { - void 0 === n && (n = null); - var r = i.colors ? [i.colors] : null; - return e.CreateLineSystem(t, { - lines: [i.points], - updatable: i.updatable, - instance: i.instance, - colors: r, - useVertexAlpha: i.useVertexAlpha - }, n) - } - , - e.CreateDashedLines = function(e, t, i) { - void 0 === i && (i = null); - var s = t.points - , c = t.instance - , u = t.gapSize || 1 - , l = t.dashSize || 3; - if (c) - return c.updateMeshPositions(function(e) { - var t, i, r = n.x.Zero(), o = e.length / 6, a = 0, u = 0, l = 0, h = 0, f = 0, d = 0; - for (f = 0; f < s.length - 1; f++) - s[f + 1].subtractToRef(s[f], r), - a += r.length(); - t = a / o; - var p = c._creationDataStorage.dashSize; - for (i = p * t / (p + c._creationDataStorage.gapSize), - f = 0; f < s.length - 1; f++) - for (s[f + 1].subtractToRef(s[f], r), - u = Math.floor(r.length() / t), - r.normalize(), - d = 0; d < u && h < e.length; ) - l = t * d, - e[h] = s[f].x + l * r.x, - e[h + 1] = s[f].y + l * r.y, - e[h + 2] = s[f].z + l * r.z, - e[h + 3] = s[f].x + (l + i) * r.x, - e[h + 4] = s[f].y + (l + i) * r.y, - e[h + 5] = s[f].z + (l + i) * r.z, - h += 6, - d++; - for (; h < e.length; ) - e[h] = s[f].x, - e[h + 1] = s[f].y, - e[h + 2] = s[f].z, - h += 3 - }, false), - c; - var h = new a.b(e,i); - return o.a.CreateDashedLines(t).applyToMesh(h, t.updatable), - h._creationDataStorage = new r.b, - h._creationDataStorage.dashSize = l, - h._creationDataStorage.gapSize = u, - h - } - , - e - }() - } - , function(e, t, getterFunc) { - "use strict"; - getterFunc.d(t, "a", function() { - return u + var o = { + points: t, + updatable: n, + instance: r, + }; + return c.CreateLines(e, o, i); + }), + (r.a.CreateDashedLines = function (e, t, i, n, r, o, a, s) { + void 0 === o && (o = null); + var u = { + points: t, + dashSize: i, + gapSize: n, + dashNb: r, + updatable: a, + instance: s, + }; + return c.CreateDashedLines(e, u, o); }); - var vec3Math = getterFunc(16) - var r = getterFunc(8) - var o = getterFunc(17) - var a = getterFunc(23) - var s = getterFunc(65) - var c = getterFunc(0) - var u = function() { - function e(e, t) { - var i = this; - void 0 === t && (t = true), - this.originalScene = e, - this._pointerCaptures = {}, - this._lastPointerEvents = {}, - this._sharedGizmoLight = null, - this.pickUtilitySceneFirst = true, - this.shouldRender = true, - this.onlyCheckPointerDownEvents = true, - this.processAllEvents = false, - this.onPointerOutObservable = new r.c, - this.utilityLayerScene = new vec3Math.a(e.getEngine(),{ - virtual: true - }), - this.utilityLayerScene.useRightHandedSystem = e.useRightHandedSystem, - this.utilityLayerScene._allowPostProcessClearColor = false, - this.utilityLayerScene.detachControl(), - t && (this._originalPointerObserver = e.onPrePointerObservable.add(function(t, n) { - if (i.utilityLayerScene.activeCamera && (i.processAllEvents || t.type === o.a.POINTERMOVE || t.type === o.a.POINTERUP || t.type === o.a.POINTERDOWN)) { - i.utilityLayerScene.pointerX = e.pointerX, - i.utilityLayerScene.pointerY = e.pointerY; - var r = t.event; - if (e.isPointerCaptured(r.pointerId)) - i._pointerCaptures[r.pointerId] = false; - else { - var a = t.ray ? i.utilityLayerScene.pickWithRay(t.ray) : i.utilityLayerScene.pick(e.pointerX, e.pointerY); - if (!t.ray && a && (t.ray = a.ray), - i.utilityLayerScene.onPrePointerObservable.notifyObservers(t), - i.onlyCheckPointerDownEvents && t.type != o.a.POINTERDOWN) - return t.skipOnPointerObservable || i.utilityLayerScene.onPointerObservable.notifyObservers(new o.b(t.type,t.event,a)), - void (t.type === o.a.POINTERUP && i._pointerCaptures[r.pointerId] && (i._pointerCaptures[r.pointerId] = false)); - if (i.utilityLayerScene.autoClearDepthAndStencil || i.pickUtilitySceneFirst) - a && a.hit && (t.skipOnPointerObservable || i.utilityLayerScene.onPointerObservable.notifyObservers(new o.b(t.type,t.event,a)), - t.skipOnPointerObservable = true); - else { - var s = t.ray ? e.pickWithRay(t.ray) : e.pick(e.pointerX, e.pointerY) - , c = t.event; - s && a && (0 === a.distance && s.pickedMesh ? i.mainSceneTrackerPredicate && i.mainSceneTrackerPredicate(s.pickedMesh) ? (i._notifyObservers(t, s, c), - t.skipOnPointerObservable = true) : t.type === o.a.POINTERDOWN ? i._pointerCaptures[c.pointerId] = true : i._lastPointerEvents[c.pointerId] && (i.onPointerOutObservable.notifyObservers(c.pointerId), - delete i._lastPointerEvents[c.pointerId]) : !i._pointerCaptures[c.pointerId] && (a.distance < s.distance || 0 === s.distance) ? (i._notifyObservers(t, a, c), - t.skipOnPointerObservable || (t.skipOnPointerObservable = a.distance > 0)) : !i._pointerCaptures[c.pointerId] && a.distance > s.distance && (i.mainSceneTrackerPredicate && i.mainSceneTrackerPredicate(s.pickedMesh) ? (i._notifyObservers(t, s, c), - t.skipOnPointerObservable = true) : i._lastPointerEvents[c.pointerId] && (i.onPointerOutObservable.notifyObservers(c.pointerId), - delete i._lastPointerEvents[c.pointerId])), - t.type === o.a.POINTERUP && i._pointerCaptures[c.pointerId] && (i._pointerCaptures[c.pointerId] = false)) - } - } + var c = (function () { + function e() {} + return ( + (e.CreateLineSystem = function (e, t, i) { + var n = t.instance, + r = t.lines, + c = t.colors; + if (n) { + var u, + l, + h = n.getVerticesData(s.b.PositionKind); + c && (u = n.getVerticesData(s.b.ColorKind)); + for (var f = 0, d = 0, p = 0; p < r.length; p++) + for (var m = r[p], g = 0; g < m.length; g++) + (h[f] = m[g].x), + (h[f + 1] = m[g].y), + (h[f + 2] = m[g].z), + c && + u && + ((l = c[p]), + (u[d] = l[g].r), + (u[d + 1] = l[g].g), + (u[d + 2] = l[g].b), + (u[d + 3] = l[g].a), + (d += 4)), + (f += 3); + return ( + n.updateVerticesData(s.b.PositionKind, h, false, false), + c && + u && + n.updateVerticesData(s.b.ColorKind, u, false, false), + n + ); + } + var _ = !!c, + v = new a.b( + e, + i, + null, + void 0, + void 0, + _, + t.useVertexAlpha + ); + return ( + o.a.CreateLineSystem(t).applyToMesh(v, t.updatable), v + ); + }), + (e.CreateLines = function (t, i, n) { + void 0 === n && (n = null); + var r = i.colors ? [i.colors] : null; + return e.CreateLineSystem( + t, + { + lines: [i.points], + updatable: i.updatable, + instance: i.instance, + colors: r, + useVertexAlpha: i.useVertexAlpha, + }, + n + ); + }), + (e.CreateDashedLines = function (e, t, i) { + void 0 === i && (i = null); + var s = t.points, + c = t.instance, + u = t.gapSize || 1, + l = t.dashSize || 3; + if (c) + return ( + c.updateMeshPositions(function (e) { + var t, + i, + r = n.x.Zero(), + o = e.length / 6, + a = 0, + u = 0, + l = 0, + h = 0, + f = 0, + d = 0; + for (f = 0; f < s.length - 1; f++) + s[f + 1].subtractToRef(s[f], r), (a += r.length()); + t = a / o; + var p = c._creationDataStorage.dashSize; + for ( + i = (p * t) / (p + c._creationDataStorage.gapSize), + f = 0; + f < s.length - 1; + f++ + ) + for ( + s[f + 1].subtractToRef(s[f], r), + u = Math.floor(r.length() / t), + r.normalize(), + d = 0; + d < u && h < e.length; + + ) + (l = t * d), + (e[h] = s[f].x + l * r.x), + (e[h + 1] = s[f].y + l * r.y), + (e[h + 2] = s[f].z + l * r.z), + (e[h + 3] = s[f].x + (l + i) * r.x), + (e[h + 4] = s[f].y + (l + i) * r.y), + (e[h + 5] = s[f].z + (l + i) * r.z), + (h += 6), + d++; + for (; h < e.length; ) + (e[h] = s[f].x), + (e[h + 1] = s[f].y), + (e[h + 2] = s[f].z), + (h += 3); + }, false), + c + ); + var h = new a.b(e, i); + return ( + o.a.CreateDashedLines(t).applyToMesh(h, t.updatable), + (h._creationDataStorage = new r.b()), + (h._creationDataStorage.dashSize = l), + (h._creationDataStorage.gapSize = u), + h + ); + }), + e + ); + })(); + }, + function (e, t, getterFunc) { + "use strict"; + getterFunc.d(t, "a", function () { + return u; + }); + var vec3Math = getterFunc(16); + var r = getterFunc(8); + var o = getterFunc(17); + var a = getterFunc(23); + var s = getterFunc(65); + var c = getterFunc(0); + var u = (function () { + function e(e, t) { + var i = this; + void 0 === t && (t = true), + (this.originalScene = e), + (this._pointerCaptures = {}), + (this._lastPointerEvents = {}), + (this._sharedGizmoLight = null), + (this.pickUtilitySceneFirst = true), + (this.shouldRender = true), + (this.onlyCheckPointerDownEvents = true), + (this.processAllEvents = false), + (this.onPointerOutObservable = new r.c()), + (this.utilityLayerScene = new vec3Math.a(e.getEngine(), { + virtual: true, + })), + (this.utilityLayerScene.useRightHandedSystem = + e.useRightHandedSystem), + (this.utilityLayerScene._allowPostProcessClearColor = false), + this.utilityLayerScene.detachControl(), + t && + ((this._originalPointerObserver = + e.onPrePointerObservable.add(function (t, n) { + if ( + i.utilityLayerScene.activeCamera && + (i.processAllEvents || + t.type === o.a.POINTERMOVE || + t.type === o.a.POINTERUP || + t.type === o.a.POINTERDOWN) + ) { + (i.utilityLayerScene.pointerX = e.pointerX), + (i.utilityLayerScene.pointerY = e.pointerY); + var r = t.event; + if (e.isPointerCaptured(r.pointerId)) + i._pointerCaptures[r.pointerId] = false; + else { + var a = t.ray + ? i.utilityLayerScene.pickWithRay(t.ray) + : i.utilityLayerScene.pick( + e.pointerX, + e.pointerY + ); + if ( + (!t.ray && a && (t.ray = a.ray), + i.utilityLayerScene.onPrePointerObservable.notifyObservers( + t + ), + i.onlyCheckPointerDownEvents && + t.type != o.a.POINTERDOWN) + ) + return ( + t.skipOnPointerObservable || + i.utilityLayerScene.onPointerObservable.notifyObservers( + new o.b(t.type, t.event, a) + ), + void ( + t.type === o.a.POINTERUP && + i._pointerCaptures[r.pointerId] && + (i._pointerCaptures[r.pointerId] = false) + ) + ); + if ( + i.utilityLayerScene.autoClearDepthAndStencil || + i.pickUtilitySceneFirst + ) + a && + a.hit && + (t.skipOnPointerObservable || + i.utilityLayerScene.onPointerObservable.notifyObservers( + new o.b(t.type, t.event, a) + ), + (t.skipOnPointerObservable = true)); + else { + var s = t.ray + ? e.pickWithRay(t.ray) + : e.pick(e.pointerX, e.pointerY), + c = t.event; + s && + a && + (0 === a.distance && s.pickedMesh + ? i.mainSceneTrackerPredicate && + i.mainSceneTrackerPredicate(s.pickedMesh) + ? (i._notifyObservers(t, s, c), + (t.skipOnPointerObservable = true)) + : t.type === o.a.POINTERDOWN + ? (i._pointerCaptures[c.pointerId] = true) + : i._lastPointerEvents[c.pointerId] && + (i.onPointerOutObservable.notifyObservers( + c.pointerId + ), + delete i._lastPointerEvents[ + c.pointerId + ]) + : !i._pointerCaptures[c.pointerId] && + (a.distance < s.distance || + 0 === s.distance) + ? (i._notifyObservers(t, a, c), + t.skipOnPointerObservable || + (t.skipOnPointerObservable = + a.distance > 0)) + : !i._pointerCaptures[c.pointerId] && + a.distance > s.distance && + (i.mainSceneTrackerPredicate && + i.mainSceneTrackerPredicate(s.pickedMesh) + ? (i._notifyObservers(t, s, c), + (t.skipOnPointerObservable = true)) + : i._lastPointerEvents[c.pointerId] && + (i.onPointerOutObservable.notifyObservers( + c.pointerId + ), + delete i._lastPointerEvents[ + c.pointerId + ])), + t.type === o.a.POINTERUP && + i._pointerCaptures[c.pointerId] && + (i._pointerCaptures[c.pointerId] = false)); + } } - }), - this._originalPointerObserver && e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)), - this.utilityLayerScene.autoClear = false, - this._afterRenderObserver = this.originalScene.onAfterRenderObservable.add(function() { - i.shouldRender && i.render() - }), - this._sceneDisposeObserver = this.originalScene.onDisposeObservable.add(function() { - i.dispose() - }), - this._updateCamera() - } - return e.prototype._getSharedGizmoLight = function() { - return this._sharedGizmoLight || (this._sharedGizmoLight = new s.a("shared gizmo light",new c.x(0,1,0),this.utilityLayerScene), - this._sharedGizmoLight.intensity = 2, - this._sharedGizmoLight.groundColor = c.e.Gray()), - this._sharedGizmoLight - } - , - Object.defineProperty(e, "DefaultUtilityLayer", { - get: function() { - return null == e._DefaultUtilityLayer && (e._DefaultUtilityLayer = new e(a.a.LastCreatedScene), - e._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(function() { - e._DefaultUtilityLayer = null - })), - e._DefaultUtilityLayer - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e, "DefaultKeepDepthUtilityLayer", { - get: function() { - return null == e._DefaultKeepDepthUtilityLayer && (e._DefaultKeepDepthUtilityLayer = new e(a.a.LastCreatedScene), - e._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false, - e._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(function() { - e._DefaultKeepDepthUtilityLayer = null - })), - e._DefaultKeepDepthUtilityLayer - }, - enumerable: true, - configurable: true - }), - e.prototype._notifyObservers = function(e, t, i) { - e.skipOnPointerObservable || (this.utilityLayerScene.onPointerObservable.notifyObservers(new o.b(e.type,e.event,t)), - this._lastPointerEvents[i.pointerId] = true) - } - , - e.prototype.render = function() { - if (this._updateCamera(), - this.utilityLayerScene.activeCamera) { - var e = this.utilityLayerScene.activeCamera.getScene() - , t = this.utilityLayerScene.activeCamera; - t._scene = this.utilityLayerScene, - t.leftCamera && (t.leftCamera._scene = this.utilityLayerScene), - t.rightCamera && (t.rightCamera._scene = this.utilityLayerScene), - this.utilityLayerScene.render(false), - t._scene = e, - t.leftCamera && (t.leftCamera._scene = e), - t.rightCamera && (t.rightCamera._scene = e) + } + })), + this._originalPointerObserver && + e.onPrePointerObservable.makeObserverTopPriority( + this._originalPointerObserver + )), + (this.utilityLayerScene.autoClear = false), + (this._afterRenderObserver = + this.originalScene.onAfterRenderObservable.add( + function () { + i.shouldRender && i.render(); } + )), + (this._sceneDisposeObserver = + this.originalScene.onDisposeObservable.add(function () { + i.dispose(); + })), + this._updateCamera(); + } + return ( + (e.prototype._getSharedGizmoLight = function () { + return ( + this._sharedGizmoLight || + ((this._sharedGizmoLight = new s.a( + "shared gizmo light", + new c.x(0, 1, 0), + this.utilityLayerScene + )), + (this._sharedGizmoLight.intensity = 2), + (this._sharedGizmoLight.groundColor = c.e.Gray())), + this._sharedGizmoLight + ); + }), + Object.defineProperty(e, "DefaultUtilityLayer", { + get: function () { + return ( + null == e._DefaultUtilityLayer && + ((e._DefaultUtilityLayer = new e( + a.a.LastCreatedScene + )), + e._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce( + function () { + e._DefaultUtilityLayer = null; + } + )), + e._DefaultUtilityLayer + ); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e, "DefaultKeepDepthUtilityLayer", { + get: function () { + return ( + null == e._DefaultKeepDepthUtilityLayer && + ((e._DefaultKeepDepthUtilityLayer = new e( + a.a.LastCreatedScene + )), + (e._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false), + e._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce( + function () { + e._DefaultKeepDepthUtilityLayer = null; + } + )), + e._DefaultKeepDepthUtilityLayer + ); + }, + enumerable: true, + configurable: true, + }), + (e.prototype._notifyObservers = function (e, t, i) { + e.skipOnPointerObservable || + (this.utilityLayerScene.onPointerObservable.notifyObservers( + new o.b(e.type, e.event, t) + ), + (this._lastPointerEvents[i.pointerId] = true)); + }), + (e.prototype.render = function () { + if ( + (this._updateCamera(), + this.utilityLayerScene.activeCamera) + ) { + var e = this.utilityLayerScene.activeCamera.getScene(), + t = this.utilityLayerScene.activeCamera; + (t._scene = this.utilityLayerScene), + t.leftCamera && + (t.leftCamera._scene = this.utilityLayerScene), + t.rightCamera && + (t.rightCamera._scene = this.utilityLayerScene), + this.utilityLayerScene.render(false), + (t._scene = e), + t.leftCamera && (t.leftCamera._scene = e), + t.rightCamera && (t.rightCamera._scene = e); } - , - e.prototype.dispose = function() { - this.onPointerOutObservable.clear(), - this._afterRenderObserver && this.originalScene.onAfterRenderObservable.remove(this._afterRenderObserver), - this._sceneDisposeObserver && this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver), - this._originalPointerObserver && this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver), - this.utilityLayerScene.dispose() - } - , - e.prototype._updateCamera = function() { - this.originalScene.activeCameras.length > 1 ? this.utilityLayerScene.activeCamera = this.originalScene.activeCameras[this.originalScene.activeCameras.length - 1] : this.utilityLayerScene.activeCamera = this.originalScene.activeCamera - } - , - e._DefaultUtilityLayer = null, - e._DefaultKeepDepthUtilityLayer = null, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return s - }); - var n = i(1) - , r = i(2) - , o = i(8) - , a = i(0) - , s = function(e) { - function t(i, n, r) { - void 0 === n && (n = null), - void 0 === r && (r = true); - var s = e.call(this, i, n) || this; - return s._forward = new a.x(0,0,1), - s._forwardInverted = new a.x(0,0,-1), - s._up = new a.x(0,1,0), - s._right = new a.x(1,0,0), - s._rightInverted = new a.x(-1,0,0), - s._position = a.x.Zero(), - s._rotation = a.x.Zero(), - s._rotationQuaternion = null, - s._scaling = a.x.One(), - s._isDirty = false, - s._transformToBoneReferal = null, - s._billboardMode = t.BILLBOARDMODE_NONE, - s._preserveParentRotationForBillboard = false, - s.scalingDeterminant = 1, - s._infiniteDistance = false, - s.ignoreNonUniformScaling = false, - s.reIntegrateRotationIntoRotationQuaternion = false, - s._poseMatrix = null, - s._localMatrix = a.j.Zero(), - s._usePivotMatrix = false, - s._absolutePosition = a.x.Zero(), - s._pivotMatrix = a.j.Identity(), - s._postMultiplyPivotMatrix = false, - s._isWorldMatrixFrozen = false, - s._indexInSceneTransformNodesArray = -1, - s.onAfterWorldMatrixUpdateObservable = new o.c, - s._nonUniformScaling = false, - r && s.getScene().addTransformNode(s), - s - } - return n.d(t, e), + }), + (e.prototype.dispose = function () { + this.onPointerOutObservable.clear(), + this._afterRenderObserver && + this.originalScene.onAfterRenderObservable.remove( + this._afterRenderObserver + ), + this._sceneDisposeObserver && + this.originalScene.onDisposeObservable.remove( + this._sceneDisposeObserver + ), + this._originalPointerObserver && + this.originalScene.onPrePointerObservable.remove( + this._originalPointerObserver + ), + this.utilityLayerScene.dispose(); + }), + (e.prototype._updateCamera = function () { + this.originalScene.activeCameras.length > 1 + ? (this.utilityLayerScene.activeCamera = + this.originalScene.activeCameras[ + this.originalScene.activeCameras.length - 1 + ]) + : (this.utilityLayerScene.activeCamera = + this.originalScene.activeCamera); + }), + (e._DefaultUtilityLayer = null), + (e._DefaultKeepDepthUtilityLayer = null), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return s; + }); + var n = i(1), + r = i(2), + o = i(8), + a = i(0), + s = (function (e) { + function t(i, n, r) { + void 0 === n && (n = null), void 0 === r && (r = true); + var s = e.call(this, i, n) || this; + return ( + (s._forward = new a.x(0, 0, 1)), + (s._forwardInverted = new a.x(0, 0, -1)), + (s._up = new a.x(0, 1, 0)), + (s._right = new a.x(1, 0, 0)), + (s._rightInverted = new a.x(-1, 0, 0)), + (s._position = a.x.Zero()), + (s._rotation = a.x.Zero()), + (s._rotationQuaternion = null), + (s._scaling = a.x.One()), + (s._isDirty = false), + (s._transformToBoneReferal = null), + (s._billboardMode = t.BILLBOARDMODE_NONE), + (s._preserveParentRotationForBillboard = false), + (s.scalingDeterminant = 1), + (s._infiniteDistance = false), + (s.ignoreNonUniformScaling = false), + (s.reIntegrateRotationIntoRotationQuaternion = false), + (s._poseMatrix = null), + (s._localMatrix = a.j.Zero()), + (s._usePivotMatrix = false), + (s._absolutePosition = a.x.Zero()), + (s._pivotMatrix = a.j.Identity()), + (s._postMultiplyPivotMatrix = false), + (s._isWorldMatrixFrozen = false), + (s._indexInSceneTransformNodesArray = -1), + (s.onAfterWorldMatrixUpdateObservable = new o.c()), + (s._nonUniformScaling = false), + r && s.getScene().addTransformNode(s), + s + ); + } + return ( + n.d(t, e), Object.defineProperty(t.prototype, "billboardMode", { - get: function() { - return this._billboardMode + get: function () { + return this._billboardMode; + }, + set: function (e) { + this._billboardMode !== e && (this._billboardMode = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "preserveParentRotationForBillboard", + { + get: function () { + return this._preserveParentRotationForBillboard; }, - set: function(e) { - this._billboardMode !== e && (this._billboardMode = e) + set: function (e) { + e !== this._preserveParentRotationForBillboard && + (this._preserveParentRotationForBillboard = e); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "preserveParentRotationForBillboard", { - get: function() { - return this._preserveParentRotationForBillboard - }, - set: function(e) { - e !== this._preserveParentRotationForBillboard && (this._preserveParentRotationForBillboard = e) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "infiniteDistance", { - get: function() { - return this._infiniteDistance - }, - set: function(e) { - this._infiniteDistance !== e && (this._infiniteDistance = e) - }, - enumerable: true, - configurable: true + get: function () { + return this._infiniteDistance; + }, + set: function (e) { + this._infiniteDistance !== e && + (this._infiniteDistance = e); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "TransformNode"; }), - t.prototype.getClassName = function() { - return "TransformNode" - } - , Object.defineProperty(t.prototype, "position", { - get: function() { - return this._position - }, - set: function(e) { - this._position = e, - this._isDirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._position; + }, + set: function (e) { + (this._position = e), (this._isDirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rotation", { - get: function() { - return this._rotation - }, - set: function(e) { - this._rotation = e, - this._rotationQuaternion = null, - this._isDirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._rotation; + }, + set: function (e) { + (this._rotation = e), + (this._rotationQuaternion = null), + (this._isDirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "scaling", { - get: function() { - return this._scaling - }, - set: function(e) { - this._scaling = e, - this._isDirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._scaling; + }, + set: function (e) { + (this._scaling = e), (this._isDirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rotationQuaternion", { - get: function() { - return this._rotationQuaternion - }, - set: function(e) { - this._rotationQuaternion = e, - e && this._rotation.setAll(0), - this._isDirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._rotationQuaternion; + }, + set: function (e) { + (this._rotationQuaternion = e), + e && this._rotation.setAll(0), + (this._isDirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "forward", { - get: function() { - return a.x.Normalize(a.x.TransformNormal(this.getScene().useRightHandedSystem ? this._forwardInverted : this._forward, this.getWorldMatrix())) - }, - enumerable: true, - configurable: true + get: function () { + return a.x.Normalize( + a.x.TransformNormal( + this.getScene().useRightHandedSystem + ? this._forwardInverted + : this._forward, + this.getWorldMatrix() + ) + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "up", { - get: function() { - return a.x.Normalize(a.x.TransformNormal(this._up, this.getWorldMatrix())) - }, - enumerable: true, - configurable: true + get: function () { + return a.x.Normalize( + a.x.TransformNormal(this._up, this.getWorldMatrix()) + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "right", { - get: function() { - return a.x.Normalize(a.x.TransformNormal(this.getScene().useRightHandedSystem ? this._rightInverted : this._right, this.getWorldMatrix())) - }, - enumerable: true, - configurable: true + get: function () { + return a.x.Normalize( + a.x.TransformNormal( + this.getScene().useRightHandedSystem + ? this._rightInverted + : this._right, + this.getWorldMatrix() + ) + ); + }, + enumerable: true, + configurable: true, }), - t.prototype.updatePoseMatrix = function(e) { - return this._poseMatrix ? (this._poseMatrix.copyFrom(e), - this) : (this._poseMatrix = e.clone(), - this) - } - , - t.prototype.getPoseMatrix = function() { - return this._poseMatrix || (this._poseMatrix = a.j.Identity()), + (t.prototype.updatePoseMatrix = function (e) { + return this._poseMatrix + ? (this._poseMatrix.copyFrom(e), this) + : ((this._poseMatrix = e.clone()), this); + }), + (t.prototype.getPoseMatrix = function () { + return ( + this._poseMatrix || (this._poseMatrix = a.j.Identity()), this._poseMatrix - } - , - t.prototype._isSynchronized = function() { - var e = this._cache; - if (this.billboardMode !== e.billboardMode || this.billboardMode !== t.BILLBOARDMODE_NONE) - return false; - if (e.pivotMatrixUpdated) - return false; - if (this.infiniteDistance) - return false; - if (!e.position.equals(this._position)) - return false; - if (this._rotationQuaternion) { - if (!e.rotationQuaternion.equals(this._rotationQuaternion)) - return false - } else if (!e.rotation.equals(this._rotation)) - return false; - return !!e.scaling.equals(this._scaling) - } - , - t.prototype._initCache = function() { - e.prototype._initCache.call(this); - var t = this._cache; - t.localMatrixUpdated = false, - t.position = a.x.Zero(), - t.scaling = a.x.Zero(), - t.rotation = a.x.Zero(), - t.rotationQuaternion = new a.q(0,0,0,0), - t.billboardMode = -1, - t.infiniteDistance = false - } - , - t.prototype.markAsDirty = function(e) { - return this._currentRenderId = Number.MAX_VALUE, - this._isDirty = true, + ); + }), + (t.prototype._isSynchronized = function () { + var e = this._cache; + if ( + this.billboardMode !== e.billboardMode || + this.billboardMode !== t.BILLBOARDMODE_NONE + ) + return false; + if (e.pivotMatrixUpdated) return false; + if (this.infiniteDistance) return false; + if (!e.position.equals(this._position)) return false; + if (this._rotationQuaternion) { + if ( + !e.rotationQuaternion.equals(this._rotationQuaternion) + ) + return false; + } else if (!e.rotation.equals(this._rotation)) + return false; + return !!e.scaling.equals(this._scaling); + }), + (t.prototype._initCache = function () { + e.prototype._initCache.call(this); + var t = this._cache; + (t.localMatrixUpdated = false), + (t.position = a.x.Zero()), + (t.scaling = a.x.Zero()), + (t.rotation = a.x.Zero()), + (t.rotationQuaternion = new a.q(0, 0, 0, 0)), + (t.billboardMode = -1), + (t.infiniteDistance = false); + }), + (t.prototype.markAsDirty = function (e) { + return ( + (this._currentRenderId = Number.MAX_VALUE), + (this._isDirty = true), this - } - , + ); + }), Object.defineProperty(t.prototype, "absolutePosition", { - get: function() { - return this._absolutePosition - }, - enumerable: true, - configurable: true + get: function () { + return this._absolutePosition; + }, + enumerable: true, + configurable: true, }), - t.prototype.setPreTransformMatrix = function(e) { - return this.setPivotMatrix(e, false) - } - , - t.prototype.setPivotMatrix = function(e, t) { - return void 0 === t && (t = true), + (t.prototype.setPreTransformMatrix = function (e) { + return this.setPivotMatrix(e, false); + }), + (t.prototype.setPivotMatrix = function (e, t) { + return ( + void 0 === t && (t = true), this._pivotMatrix.copyFrom(e), - this._usePivotMatrix = !this._pivotMatrix.isIdentity(), - this._cache.pivotMatrixUpdated = true, - this._postMultiplyPivotMatrix = t, - this._postMultiplyPivotMatrix && (this._pivotMatrixInverse ? this._pivotMatrix.invertToRef(this._pivotMatrixInverse) : this._pivotMatrixInverse = a.j.Invert(this._pivotMatrix)), + (this._usePivotMatrix = + !this._pivotMatrix.isIdentity()), + (this._cache.pivotMatrixUpdated = true), + (this._postMultiplyPivotMatrix = t), + this._postMultiplyPivotMatrix && + (this._pivotMatrixInverse + ? this._pivotMatrix.invertToRef( + this._pivotMatrixInverse + ) + : (this._pivotMatrixInverse = a.j.Invert( + this._pivotMatrix + ))), this - } - , - t.prototype.getPivotMatrix = function() { - return this._pivotMatrix - } - , - t.prototype.freezeWorldMatrix = function() { - return this._isWorldMatrixFrozen = false, - this.computeWorldMatrix(true), - this._isWorldMatrixFrozen = true, - this - } - , - t.prototype.unfreezeWorldMatrix = function() { - return this._isWorldMatrixFrozen = false, - this.computeWorldMatrix(true), - this - } - , - Object.defineProperty(t.prototype, "isWorldMatrixFrozen", { - get: function() { - return this._isWorldMatrixFrozen - }, - enumerable: true, - configurable: true + ); }), - t.prototype.getAbsolutePosition = function() { - return this.computeWorldMatrix(), - this._absolutePosition - } - , - t.prototype.setAbsolutePosition = function(e) { - if (!e) - return this; - var t, i, n; - if (void 0 === e.x) { - if (arguments.length < 3) - return this; - t = arguments[0], - i = arguments[1], - n = arguments[2] - } else - t = e.x, - i = e.y, - n = e.z; - if (this.parent) { - var r = a.t.Matrix[0]; - this.parent.getWorldMatrix().invertToRef(r), - a.x.TransformCoordinatesFromFloatsToRef(t, i, n, r, this.position) - } else - this.position.x = t, - this.position.y = i, - this.position.z = n; - return this - } - , - t.prototype.setPositionWithLocalVector = function(e) { - return this.computeWorldMatrix(), - this.position = a.x.TransformNormal(e, this._localMatrix), + (t.prototype.getPivotMatrix = function () { + return this._pivotMatrix; + }), + (t.prototype.freezeWorldMatrix = function () { + return ( + (this._isWorldMatrixFrozen = false), + this.computeWorldMatrix(true), + (this._isWorldMatrixFrozen = true), this - } - , - t.prototype.getPositionExpressedInLocalSpace = function() { + ); + }), + (t.prototype.unfreezeWorldMatrix = function () { + return ( + (this._isWorldMatrixFrozen = false), + this.computeWorldMatrix(true), + this + ); + }), + Object.defineProperty(t.prototype, "isWorldMatrixFrozen", { + get: function () { + return this._isWorldMatrixFrozen; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getAbsolutePosition = function () { + return this.computeWorldMatrix(), this._absolutePosition; + }), + (t.prototype.setAbsolutePosition = function (e) { + if (!e) return this; + var t, i, n; + if (void 0 === e.x) { + if (arguments.length < 3) return this; + (t = arguments[0]), + (i = arguments[1]), + (n = arguments[2]); + } else (t = e.x), (i = e.y), (n = e.z); + if (this.parent) { + var r = a.t.Matrix[0]; + this.parent.getWorldMatrix().invertToRef(r), + a.x.TransformCoordinatesFromFloatsToRef( + t, + i, + n, + r, + this.position + ); + } else + (this.position.x = t), + (this.position.y = i), + (this.position.z = n); + return this; + }), + (t.prototype.setPositionWithLocalVector = function (e) { + return ( + this.computeWorldMatrix(), + (this.position = a.x.TransformNormal( + e, + this._localMatrix + )), + this + ); + }), + (t.prototype.getPositionExpressedInLocalSpace = + function () { this.computeWorldMatrix(); var e = a.t.Matrix[0]; - return this._localMatrix.invertToRef(e), - a.x.TransformNormal(this.position, e) - } - , - t.prototype.locallyTranslate = function(e) { - return this.computeWorldMatrix(true), - this.position = a.x.TransformCoordinates(e, this._localMatrix), + return ( + this._localMatrix.invertToRef(e), + a.x.TransformNormal(this.position, e) + ); + }), + (t.prototype.locallyTranslate = function (e) { + return ( + this.computeWorldMatrix(true), + (this.position = a.x.TransformCoordinates( + e, + this._localMatrix + )), this - } - , - t.prototype.lookAt = function(e, i, n, r, o) { - void 0 === i && (i = 0), + ); + }), + (t.prototype.lookAt = function (e, i, n, r, o) { + void 0 === i && (i = 0), void 0 === n && (n = 0), void 0 === r && (r = 0), void 0 === o && (o = a.s.LOCAL); - var s = t._lookAtVectorCache - , c = o === a.s.LOCAL ? this.position : this.getAbsolutePosition(); - if (e.subtractToRef(c, s), + var s = t._lookAtVectorCache, + c = + o === a.s.LOCAL + ? this.position + : this.getAbsolutePosition(); + if ( + (e.subtractToRef(c, s), this.setDirection(s, i, n, r), o === a.s.WORLD && this.parent) - if (this.rotationQuaternion) { - var u = a.t.Matrix[0]; - this.rotationQuaternion.toRotationMatrix(u); - var l = a.t.Matrix[1]; - this.parent.getWorldMatrix().getRotationMatrixToRef(l), - l.invert(), - u.multiplyToRef(l, u), - this.rotationQuaternion.fromRotationMatrix(u) - } else { - var h = a.t.Quaternion[0]; - a.q.FromEulerVectorToRef(this.rotation, h), - u = a.t.Matrix[0], - h.toRotationMatrix(u), - l = a.t.Matrix[1], - this.parent.getWorldMatrix().getRotationMatrixToRef(l), - l.invert(), - u.multiplyToRef(l, u), - h.fromRotationMatrix(u), - h.toEulerAnglesToRef(this.rotation) - } - return this - } - , - t.prototype.getDirection = function(e) { - var t = a.x.Zero(); - return this.getDirectionToRef(e, t), - t - } - , - t.prototype.getDirectionToRef = function(e, t) { - return a.x.TransformNormalToRef(e, this.getWorldMatrix(), t), + ) + if (this.rotationQuaternion) { + var u = a.t.Matrix[0]; + this.rotationQuaternion.toRotationMatrix(u); + var l = a.t.Matrix[1]; + this.parent + .getWorldMatrix() + .getRotationMatrixToRef(l), + l.invert(), + u.multiplyToRef(l, u), + this.rotationQuaternion.fromRotationMatrix(u); + } else { + var h = a.t.Quaternion[0]; + a.q.FromEulerVectorToRef(this.rotation, h), + (u = a.t.Matrix[0]), + h.toRotationMatrix(u), + (l = a.t.Matrix[1]), + this.parent + .getWorldMatrix() + .getRotationMatrixToRef(l), + l.invert(), + u.multiplyToRef(l, u), + h.fromRotationMatrix(u), + h.toEulerAnglesToRef(this.rotation); + } + return this; + }), + (t.prototype.getDirection = function (e) { + var t = a.x.Zero(); + return this.getDirectionToRef(e, t), t; + }), + (t.prototype.getDirectionToRef = function (e, t) { + return ( + a.x.TransformNormalToRef(e, this.getWorldMatrix(), t), this - } - , - t.prototype.setDirection = function(e, t, i, n) { - void 0 === t && (t = 0), + ); + }), + (t.prototype.setDirection = function (e, t, i, n) { + void 0 === t && (t = 0), void 0 === i && (i = 0), void 0 === n && (n = 0); - var r = -Math.atan2(e.z, e.x) + Math.PI / 2 - , o = Math.sqrt(e.x * e.x + e.z * e.z) - , s = -Math.atan2(e.y, o); - return this.rotationQuaternion ? a.q.RotationYawPitchRollToRef(r + t, s + i, n, this.rotationQuaternion) : (this.rotation.x = s + i, - this.rotation.y = r + t, - this.rotation.z = n), + var r = -Math.atan2(e.z, e.x) + Math.PI / 2, + o = Math.sqrt(e.x * e.x + e.z * e.z), + s = -Math.atan2(e.y, o); + return ( + this.rotationQuaternion + ? a.q.RotationYawPitchRollToRef( + r + t, + s + i, + n, + this.rotationQuaternion + ) + : ((this.rotation.x = s + i), + (this.rotation.y = r + t), + (this.rotation.z = n)), this - } - , - t.prototype.setPivotPoint = function(e, t) { - void 0 === t && (t = a.s.LOCAL), - 0 == this.getScene().getRenderId() && this.computeWorldMatrix(true); - var i = this.getWorldMatrix(); - if (t == a.s.WORLD) { - var n = a.t.Matrix[0]; - i.invertToRef(n), - e = a.x.TransformCoordinates(e, n) - } - return this.setPivotMatrix(a.j.Translation(-e.x, -e.y, -e.z), true) - } - , - t.prototype.getPivotPoint = function() { - var e = a.x.Zero(); - return this.getPivotPointToRef(e), - e - } - , - t.prototype.getPivotPointToRef = function(e) { - return e.x = -this._pivotMatrix.m[12], - e.y = -this._pivotMatrix.m[13], - e.z = -this._pivotMatrix.m[14], + ); + }), + (t.prototype.setPivotPoint = function (e, t) { + void 0 === t && (t = a.s.LOCAL), + 0 == this.getScene().getRenderId() && + this.computeWorldMatrix(true); + var i = this.getWorldMatrix(); + if (t == a.s.WORLD) { + var n = a.t.Matrix[0]; + i.invertToRef(n), (e = a.x.TransformCoordinates(e, n)); + } + return this.setPivotMatrix( + a.j.Translation(-e.x, -e.y, -e.z), + true + ); + }), + (t.prototype.getPivotPoint = function () { + var e = a.x.Zero(); + return this.getPivotPointToRef(e), e; + }), + (t.prototype.getPivotPointToRef = function (e) { + return ( + (e.x = -this._pivotMatrix.m[12]), + (e.y = -this._pivotMatrix.m[13]), + (e.z = -this._pivotMatrix.m[14]), this - } - , - t.prototype.getAbsolutePivotPoint = function() { - var e = a.x.Zero(); - return this.getAbsolutePivotPointToRef(e), - e - } - , - t.prototype.getAbsolutePivotPointToRef = function(e) { - return e.x = this._pivotMatrix.m[12], - e.y = this._pivotMatrix.m[13], - e.z = this._pivotMatrix.m[14], + ); + }), + (t.prototype.getAbsolutePivotPoint = function () { + var e = a.x.Zero(); + return this.getAbsolutePivotPointToRef(e), e; + }), + (t.prototype.getAbsolutePivotPointToRef = function (e) { + return ( + (e.x = this._pivotMatrix.m[12]), + (e.y = this._pivotMatrix.m[13]), + (e.z = this._pivotMatrix.m[14]), this.getPivotPointToRef(e), - a.x.TransformCoordinatesToRef(e, this.getWorldMatrix(), e), + a.x.TransformCoordinatesToRef( + e, + this.getWorldMatrix(), + e + ), this - } - , - t.prototype.setParent = function(e) { - if (!e && !this.parent) - return this; - var t = a.t.Quaternion[0] - , i = a.t.Vector3[0] - , n = a.t.Vector3[1]; - if (e) { - var r = a.t.Matrix[0] - , o = a.t.Matrix[1]; - this.computeWorldMatrix(true), - e.computeWorldMatrix(true), - e.getWorldMatrix().invertToRef(o), - this.getWorldMatrix().multiplyToRef(o, r), - r.decompose(n, t, i) - } else - this.parent && this.parent.computeWorldMatrix && this.parent.computeWorldMatrix(true), - this.computeWorldMatrix(true), - this.getWorldMatrix().decompose(n, t, i); - return this.rotationQuaternion ? this.rotationQuaternion.copyFrom(t) : t.toEulerAnglesToRef(this.rotation), + ); + }), + (t.prototype.setParent = function (e) { + if (!e && !this.parent) return this; + var t = a.t.Quaternion[0], + i = a.t.Vector3[0], + n = a.t.Vector3[1]; + if (e) { + var r = a.t.Matrix[0], + o = a.t.Matrix[1]; + this.computeWorldMatrix(true), + e.computeWorldMatrix(true), + e.getWorldMatrix().invertToRef(o), + this.getWorldMatrix().multiplyToRef(o, r), + r.decompose(n, t, i); + } else + this.parent && + this.parent.computeWorldMatrix && + this.parent.computeWorldMatrix(true), + this.computeWorldMatrix(true), + this.getWorldMatrix().decompose(n, t, i); + return ( + this.rotationQuaternion + ? this.rotationQuaternion.copyFrom(t) + : t.toEulerAnglesToRef(this.rotation), this.scaling.copyFrom(n), this.position.copyFrom(i), - this.parent = e, + (this.parent = e), this - } - , - Object.defineProperty(t.prototype, "nonUniformScaling", { - get: function() { - return this._nonUniformScaling - }, - enumerable: true, - configurable: true + ); }), - t.prototype._updateNonUniformScalingState = function(e) { - return this._nonUniformScaling !== e && (this._nonUniformScaling = e, - true) - } - , - t.prototype.attachToBone = function(e, t) { - return this._transformToBoneReferal = t, - this.parent = e, - e.getWorldMatrix().determinant() < 0 && (this.scalingDeterminant *= -1), + Object.defineProperty(t.prototype, "nonUniformScaling", { + get: function () { + return this._nonUniformScaling; + }, + enumerable: true, + configurable: true, + }), + (t.prototype._updateNonUniformScalingState = function (e) { + return ( + this._nonUniformScaling !== e && + ((this._nonUniformScaling = e), true) + ); + }), + (t.prototype.attachToBone = function (e, t) { + return ( + (this._transformToBoneReferal = t), + (this.parent = e), + e.getWorldMatrix().determinant() < 0 && + (this.scalingDeterminant *= -1), this - } - , - t.prototype.detachFromBone = function() { - return this.parent ? (this.parent.getWorldMatrix().determinant() < 0 && (this.scalingDeterminant *= -1), - this._transformToBoneReferal = null, - this.parent = null, - this) : this - } - , - t.prototype.rotate = function(e, i, n) { - var r; - if (e.normalize(), - this.rotationQuaternion || (this.rotationQuaternion = this.rotation.toQuaternion(), - this.rotation.setAll(0)), - n && n !== a.s.LOCAL) { - if (this.parent) { - var o = a.t.Matrix[0]; - this.parent.getWorldMatrix().invertToRef(o), - e = a.x.TransformNormal(e, o) - } - (r = a.q.RotationAxisToRef(e, i, t._rotationAxisCache)).multiplyToRef(this.rotationQuaternion, this.rotationQuaternion) - } else - r = a.q.RotationAxisToRef(e, i, t._rotationAxisCache), - this.rotationQuaternion.multiplyToRef(r, this.rotationQuaternion); - return this - } - , - t.prototype.rotateAround = function(e, t, i) { - t.normalize(), - this.rotationQuaternion || (this.rotationQuaternion = a.q.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z), - this.rotation.setAll(0)); - var n = a.t.Vector3[0] - , r = a.t.Vector3[1] - , o = a.t.Vector3[2] - , s = a.t.Quaternion[0] - , c = a.t.Matrix[0] - , u = a.t.Matrix[1] - , l = a.t.Matrix[2] - , h = a.t.Matrix[3]; - return e.subtractToRef(this.position, n), + ); + }), + (t.prototype.detachFromBone = function () { + return this.parent + ? (this.parent.getWorldMatrix().determinant() < 0 && + (this.scalingDeterminant *= -1), + (this._transformToBoneReferal = null), + (this.parent = null), + this) + : this; + }), + (t.prototype.rotate = function (e, i, n) { + var r; + if ( + (e.normalize(), + this.rotationQuaternion || + ((this.rotationQuaternion = + this.rotation.toQuaternion()), + this.rotation.setAll(0)), + n && n !== a.s.LOCAL) + ) { + if (this.parent) { + var o = a.t.Matrix[0]; + this.parent.getWorldMatrix().invertToRef(o), + (e = a.x.TransformNormal(e, o)); + } + (r = a.q.RotationAxisToRef( + e, + i, + t._rotationAxisCache + )).multiplyToRef( + this.rotationQuaternion, + this.rotationQuaternion + ); + } else + (r = a.q.RotationAxisToRef(e, i, t._rotationAxisCache)), + this.rotationQuaternion.multiplyToRef( + r, + this.rotationQuaternion + ); + return this; + }), + (t.prototype.rotateAround = function (e, t, i) { + t.normalize(), + this.rotationQuaternion || + ((this.rotationQuaternion = a.q.RotationYawPitchRoll( + this.rotation.y, + this.rotation.x, + this.rotation.z + )), + this.rotation.setAll(0)); + var n = a.t.Vector3[0], + r = a.t.Vector3[1], + o = a.t.Vector3[2], + s = a.t.Quaternion[0], + c = a.t.Matrix[0], + u = a.t.Matrix[1], + l = a.t.Matrix[2], + h = a.t.Matrix[3]; + return ( + e.subtractToRef(this.position, n), a.j.TranslationToRef(n.x, n.y, n.z, c), a.j.TranslationToRef(-n.x, -n.y, -n.z, u), a.j.RotationAxisToRef(t, i, l), @@ -43840,2947 +55724,4194 @@ and limitations under the License. h.multiplyToRef(c, h), h.decompose(r, s, o), this.position.addInPlace(o), - s.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion), + s.multiplyToRef( + this.rotationQuaternion, + this.rotationQuaternion + ), this - } - , - t.prototype.translate = function(e, t, i) { - var n = e.scale(t); - if (i && i !== a.s.LOCAL) - this.setAbsolutePosition(this.getAbsolutePosition().add(n)); - else { - var r = this.getPositionExpressedInLocalSpace().add(n); - this.setPositionWithLocalVector(r) - } - return this - } - , - t.prototype.addRotation = function(e, t, i) { - var n; - this.rotationQuaternion ? n = this.rotationQuaternion : (n = a.t.Quaternion[1], - a.q.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, n)); - var r = a.t.Quaternion[0]; - return a.q.RotationYawPitchRollToRef(t, e, i, r), + ); + }), + (t.prototype.translate = function (e, t, i) { + var n = e.scale(t); + if (i && i !== a.s.LOCAL) + this.setAbsolutePosition( + this.getAbsolutePosition().add(n) + ); + else { + var r = this.getPositionExpressedInLocalSpace().add(n); + this.setPositionWithLocalVector(r); + } + return this; + }), + (t.prototype.addRotation = function (e, t, i) { + var n; + this.rotationQuaternion + ? (n = this.rotationQuaternion) + : ((n = a.t.Quaternion[1]), + a.q.RotationYawPitchRollToRef( + this.rotation.y, + this.rotation.x, + this.rotation.z, + n + )); + var r = a.t.Quaternion[0]; + return ( + a.q.RotationYawPitchRollToRef(t, e, i, r), n.multiplyInPlace(r), - this.rotationQuaternion || n.toEulerAnglesToRef(this.rotation), + this.rotationQuaternion || + n.toEulerAnglesToRef(this.rotation), this - } - , - t.prototype._getEffectiveParent = function() { - return this.parent - } - , - t.prototype.computeWorldMatrix = function(e) { - if (this._isWorldMatrixFrozen && !this._isDirty) - return this._worldMatrix; - var i = this.getScene().getRenderId(); - if (!this._isDirty && !e && this.isSynchronized()) - return this._currentRenderId = i, - this._worldMatrix; - this._updateCache(); - var n = this._cache; - n.pivotMatrixUpdated = false, - n.billboardMode = this.billboardMode, - n.infiniteDistance = this.infiniteDistance, - this._currentRenderId = i, + ); + }), + (t.prototype._getEffectiveParent = function () { + return this.parent; + }), + (t.prototype.computeWorldMatrix = function (e) { + if (this._isWorldMatrixFrozen && !this._isDirty) + return this._worldMatrix; + var i = this.getScene().getRenderId(); + if (!this._isDirty && !e && this.isSynchronized()) + return (this._currentRenderId = i), this._worldMatrix; + this._updateCache(); + var n = this._cache; + (n.pivotMatrixUpdated = false), + (n.billboardMode = this.billboardMode), + (n.infiniteDistance = this.infiniteDistance), + (this._currentRenderId = i), this._childUpdateId++, - this._isDirty = false; - var r = this._getEffectiveParent() - , o = this._billboardMode !== t.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard - , s = this.getScene().activeCamera - , c = n.scaling - , u = n.position; - if (this._infiniteDistance) - if (!this.parent && s) { - var l = s.getWorldMatrix() - , h = new a.x(l.m[12],l.m[13],l.m[14]); - u.copyFromFloats(this._position.x + h.x, this._position.y + h.y, this._position.z + h.z) - } else - u.copyFrom(this._position); - else - u.copyFrom(this._position); - c.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant); - var f = n.rotationQuaternion; - if (this._rotationQuaternion ? (this.reIntegrateRotationIntoRotationQuaternion && this.rotation.lengthSquared() && (this._rotationQuaternion.multiplyInPlace(a.q.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z)), - this._rotation.copyFromFloats(0, 0, 0)), - f.copyFrom(this._rotationQuaternion)) : (a.q.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, f), - n.rotation.copyFrom(this._rotation)), - this._usePivotMatrix) { - var d = a.t.Matrix[1]; - a.j.ScalingToRef(c.x, c.y, c.z, d); - var p = a.t.Matrix[0]; - f.toRotationMatrix(p), - this._pivotMatrix.multiplyToRef(d, a.t.Matrix[4]), - a.t.Matrix[4].multiplyToRef(p, this._localMatrix), - this._postMultiplyPivotMatrix && this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix), - this._localMatrix.addTranslationFromFloats(u.x, u.y, u.z) + (this._isDirty = false); + var r = this._getEffectiveParent(), + o = + this._billboardMode !== t.BILLBOARDMODE_NONE && + !this.preserveParentRotationForBillboard, + s = this.getScene().activeCamera, + c = n.scaling, + u = n.position; + if (this._infiniteDistance) + if (!this.parent && s) { + var l = s.getWorldMatrix(), + h = new a.x(l.m[12], l.m[13], l.m[14]); + u.copyFromFloats( + this._position.x + h.x, + this._position.y + h.y, + this._position.z + h.z + ); + } else u.copyFrom(this._position); + else u.copyFrom(this._position); + c.copyFromFloats( + this._scaling.x * this.scalingDeterminant, + this._scaling.y * this.scalingDeterminant, + this._scaling.z * this.scalingDeterminant + ); + var f = n.rotationQuaternion; + if ( + (this._rotationQuaternion + ? (this.reIntegrateRotationIntoRotationQuaternion && + this.rotation.lengthSquared() && + (this._rotationQuaternion.multiplyInPlace( + a.q.RotationYawPitchRoll( + this._rotation.y, + this._rotation.x, + this._rotation.z + ) + ), + this._rotation.copyFromFloats(0, 0, 0)), + f.copyFrom(this._rotationQuaternion)) + : (a.q.RotationYawPitchRollToRef( + this._rotation.y, + this._rotation.x, + this._rotation.z, + f + ), + n.rotation.copyFrom(this._rotation)), + this._usePivotMatrix) + ) { + var d = a.t.Matrix[1]; + a.j.ScalingToRef(c.x, c.y, c.z, d); + var p = a.t.Matrix[0]; + f.toRotationMatrix(p), + this._pivotMatrix.multiplyToRef(d, a.t.Matrix[4]), + a.t.Matrix[4].multiplyToRef(p, this._localMatrix), + this._postMultiplyPivotMatrix && + this._localMatrix.multiplyToRef( + this._pivotMatrixInverse, + this._localMatrix + ), + this._localMatrix.addTranslationFromFloats( + u.x, + u.y, + u.z + ); + } else a.j.ComposeToRef(c, f, u, this._localMatrix); + if (r && r.getWorldMatrix) { + if (o) { + this._transformToBoneReferal + ? r + .getWorldMatrix() + .multiplyToRef( + this._transformToBoneReferal.getWorldMatrix(), + a.t.Matrix[7] + ) + : a.t.Matrix[7].copyFrom(r.getWorldMatrix()); + var m = a.t.Vector3[5], + g = a.t.Vector3[6]; + a.t.Matrix[7].decompose(g, void 0, m), + a.j.ScalingToRef(g.x, g.y, g.z, a.t.Matrix[7]), + a.t.Matrix[7].setTranslation(m), + this._localMatrix.multiplyToRef( + a.t.Matrix[7], + this._worldMatrix + ); } else - a.j.ComposeToRef(c, f, u, this._localMatrix); - if (r && r.getWorldMatrix) { - if (o) { - this._transformToBoneReferal ? r.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), a.t.Matrix[7]) : a.t.Matrix[7].copyFrom(r.getWorldMatrix()); - var m = a.t.Vector3[5] - , g = a.t.Vector3[6]; - a.t.Matrix[7].decompose(g, void 0, m), - a.j.ScalingToRef(g.x, g.y, g.z, a.t.Matrix[7]), - a.t.Matrix[7].setTranslation(m), - this._localMatrix.multiplyToRef(a.t.Matrix[7], this._worldMatrix) - } else - this._transformToBoneReferal ? (this._localMatrix.multiplyToRef(r.getWorldMatrix(), a.t.Matrix[6]), - a.t.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix)) : this._localMatrix.multiplyToRef(r.getWorldMatrix(), this._worldMatrix); - this._markSyncedWithParent() - } else - this._worldMatrix.copyFrom(this._localMatrix); - if (o && s) { - var _ = a.t.Vector3[0]; - if (this._worldMatrix.getTranslationToRef(_), - a.t.Matrix[1].copyFrom(s.getViewMatrix()), - a.t.Matrix[1].setTranslationFromFloats(0, 0, 0), - a.t.Matrix[1].invertToRef(a.t.Matrix[0]), - (this.billboardMode & t.BILLBOARDMODE_ALL) !== t.BILLBOARDMODE_ALL) { - a.t.Matrix[0].decompose(void 0, a.t.Quaternion[0], void 0); - var v = a.t.Vector3[1]; - a.t.Quaternion[0].toEulerAnglesToRef(v), - (this.billboardMode & t.BILLBOARDMODE_X) !== t.BILLBOARDMODE_X && (v.x = 0), - (this.billboardMode & t.BILLBOARDMODE_Y) !== t.BILLBOARDMODE_Y && (v.y = 0), - (this.billboardMode & t.BILLBOARDMODE_Z) !== t.BILLBOARDMODE_Z && (v.z = 0), - a.j.RotationYawPitchRollToRef(v.y, v.x, v.z, a.t.Matrix[0]) - } - this._worldMatrix.setTranslationFromFloats(0, 0, 0), - this._worldMatrix.multiplyToRef(a.t.Matrix[0], this._worldMatrix), - this._worldMatrix.setTranslation(a.t.Vector3[0]) + this._transformToBoneReferal + ? (this._localMatrix.multiplyToRef( + r.getWorldMatrix(), + a.t.Matrix[6] + ), + a.t.Matrix[6].multiplyToRef( + this._transformToBoneReferal.getWorldMatrix(), + this._worldMatrix + )) + : this._localMatrix.multiplyToRef( + r.getWorldMatrix(), + this._worldMatrix + ); + this._markSyncedWithParent(); + } else this._worldMatrix.copyFrom(this._localMatrix); + if (o && s) { + var _ = a.t.Vector3[0]; + if ( + (this._worldMatrix.getTranslationToRef(_), + a.t.Matrix[1].copyFrom(s.getViewMatrix()), + a.t.Matrix[1].setTranslationFromFloats(0, 0, 0), + a.t.Matrix[1].invertToRef(a.t.Matrix[0]), + (this.billboardMode & t.BILLBOARDMODE_ALL) !== + t.BILLBOARDMODE_ALL) + ) { + a.t.Matrix[0].decompose( + void 0, + a.t.Quaternion[0], + void 0 + ); + var v = a.t.Vector3[1]; + a.t.Quaternion[0].toEulerAnglesToRef(v), + (this.billboardMode & t.BILLBOARDMODE_X) !== + t.BILLBOARDMODE_X && (v.x = 0), + (this.billboardMode & t.BILLBOARDMODE_Y) !== + t.BILLBOARDMODE_Y && (v.y = 0), + (this.billboardMode & t.BILLBOARDMODE_Z) !== + t.BILLBOARDMODE_Z && (v.z = 0), + a.j.RotationYawPitchRollToRef( + v.y, + v.x, + v.z, + a.t.Matrix[0] + ); } - return this.ignoreNonUniformScaling ? this._updateNonUniformScalingState(false) : this._scaling.isNonUniform ? this._updateNonUniformScalingState(true) : r && r._nonUniformScaling ? this._updateNonUniformScalingState(r._nonUniformScaling) : this._updateNonUniformScalingState(false), + this._worldMatrix.setTranslationFromFloats(0, 0, 0), + this._worldMatrix.multiplyToRef( + a.t.Matrix[0], + this._worldMatrix + ), + this._worldMatrix.setTranslation(a.t.Vector3[0]); + } + return ( + this.ignoreNonUniformScaling + ? this._updateNonUniformScalingState(false) + : this._scaling.isNonUniform + ? this._updateNonUniformScalingState(true) + : r && r._nonUniformScaling + ? this._updateNonUniformScalingState( + r._nonUniformScaling + ) + : this._updateNonUniformScalingState(false), this._afterComputeWorldMatrix(), - this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]), - this.onAfterWorldMatrixUpdateObservable.notifyObservers(this), - this._poseMatrix || (this._poseMatrix = a.j.Invert(this._worldMatrix)), - this._worldMatrixDeterminantIsDirty = true, + this._absolutePosition.copyFromFloats( + this._worldMatrix.m[12], + this._worldMatrix.m[13], + this._worldMatrix.m[14] + ), + this.onAfterWorldMatrixUpdateObservable.notifyObservers( + this + ), + this._poseMatrix || + (this._poseMatrix = a.j.Invert(this._worldMatrix)), + (this._worldMatrixDeterminantIsDirty = true), this._worldMatrix - } - , - t.prototype._afterComputeWorldMatrix = function() {} - , - t.prototype.registerAfterWorldMatrixUpdate = function(e) { - return this.onAfterWorldMatrixUpdateObservable.add(e), + ); + }), + (t.prototype._afterComputeWorldMatrix = function () {}), + (t.prototype.registerAfterWorldMatrixUpdate = function (e) { + return ( + this.onAfterWorldMatrixUpdateObservable.add(e), this + ); + }), + (t.prototype.unregisterAfterWorldMatrixUpdate = function ( + e + ) { + return ( + this.onAfterWorldMatrixUpdateObservable.removeCallback( + e + ), this - } - , - t.prototype.unregisterAfterWorldMatrixUpdate = function(e) { - return this.onAfterWorldMatrixUpdateObservable.removeCallback(e), - this - } - , - t.prototype.getPositionInCameraSpace = function(e) { - return void 0 === e && (e = null), + ); + }), + (t.prototype.getPositionInCameraSpace = function (e) { + return ( + void 0 === e && (e = null), e || (e = this.getScene().activeCamera), - a.x.TransformCoordinates(this.absolutePosition, e.getViewMatrix()) - } - , - t.prototype.getDistanceToCamera = function(e) { - return void 0 === e && (e = null), + a.x.TransformCoordinates( + this.absolutePosition, + e.getViewMatrix() + ) + ); + }), + (t.prototype.getDistanceToCamera = function (e) { + return ( + void 0 === e && (e = null), e || (e = this.getScene().activeCamera), - this.absolutePosition.subtract(e.globalPosition).length() - } - , - t.prototype.clone = function(e, i, n) { - var o = this - , a = r.a.Clone(function() { - return new t(e,o.getScene()) + this.absolutePosition + .subtract(e.globalPosition) + .length() + ); + }), + (t.prototype.clone = function (e, i, n) { + var o = this, + a = r.a.Clone(function () { + return new t(e, o.getScene()); }, this); - if (a.name = e, - a.id = e, - i && (a.parent = i), - !n) - for (var s = this.getDescendants(true), c = 0; c < s.length; c++) { - var u = s[c]; - u.clone && u.clone(e + "." + u.name, a) - } - return a - } - , - t.prototype.serialize = function(e) { - var t = r.a.Serialize(this, e); - return t.type = this.getClassName(), + if (((a.name = e), (a.id = e), i && (a.parent = i), !n)) + for ( + var s = this.getDescendants(true), c = 0; + c < s.length; + c++ + ) { + var u = s[c]; + u.clone && u.clone(e + "." + u.name, a); + } + return a; + }), + (t.prototype.serialize = function (e) { + var t = r.a.Serialize(this, e); + return ( + (t.type = this.getClassName()), this.parent && (t.parentId = this.parent.id), - t.localMatrix = this.getPivotMatrix().asArray(), - t.isEnabled = this.isEnabled(), + (t.localMatrix = this.getPivotMatrix().asArray()), + (t.isEnabled = this.isEnabled()), this.parent && (t.parentId = this.parent.id), t - } - , - t.Parse = function(e, i, n) { - var o = r.a.Parse(function() { - return new t(e.name,i) - }, e, i, n); - return e.localMatrix ? o.setPreTransformMatrix(a.j.FromArray(e.localMatrix)) : e.pivotMatrix && o.setPivotMatrix(a.j.FromArray(e.pivotMatrix)), + ); + }), + (t.Parse = function (e, i, n) { + var o = r.a.Parse( + function () { + return new t(e.name, i); + }, + e, + i, + n + ); + return ( + e.localMatrix + ? o.setPreTransformMatrix( + a.j.FromArray(e.localMatrix) + ) + : e.pivotMatrix && + o.setPivotMatrix(a.j.FromArray(e.pivotMatrix)), o.setEnabled(e.isEnabled), e.parentId && (o._waitingParentId = e.parentId), o - } - , - t.prototype.getChildTransformNodes = function(e, i) { - var n = []; - return this._getDescendants(n, e, function(e) { - return (!i || i(e)) && e instanceof t + ); + }), + (t.prototype.getChildTransformNodes = function (e, i) { + var n = []; + return ( + this._getDescendants(n, e, function (e) { + return (!i || i(e)) && e instanceof t; }), n - } - , - t.prototype.dispose = function(t, i) { - if (void 0 === i && (i = false), + ); + }), + (t.prototype.dispose = function (t, i) { + if ( + (void 0 === i && (i = false), this.getScene().stopAnimation(this), this.getScene().removeTransformNode(this), this.onAfterWorldMatrixUpdateObservable.clear(), t) - for (var n = 0, r = this.getChildTransformNodes(true); n < r.length; n++) { - var o = r[n]; - o.parent = null, - o.computeWorldMatrix(true) - } - e.prototype.dispose.call(this, t, i) - } - , - t.BILLBOARDMODE_NONE = 0, - t.BILLBOARDMODE_X = 1, - t.BILLBOARDMODE_Y = 2, - t.BILLBOARDMODE_Z = 4, - t.BILLBOARDMODE_ALL = 7, - t._lookAtVectorCache = new a.x(0,0,0), - t._rotationAxisCache = new a.q, - n.c([Object(r.o)("position")], t.prototype, "_position", void 0), - n.c([Object(r.o)("rotation")], t.prototype, "_rotation", void 0), - n.c([Object(r.l)("rotationQuaternion")], t.prototype, "_rotationQuaternion", void 0), - n.c([Object(r.o)("scaling")], t.prototype, "_scaling", void 0), - n.c([Object(r.c)("billboardMode")], t.prototype, "_billboardMode", void 0), - n.c([Object(r.c)()], t.prototype, "scalingDeterminant", void 0), - n.c([Object(r.c)("infiniteDistance")], t.prototype, "_infiniteDistance", void 0), - n.c([Object(r.c)()], t.prototype, "ignoreNonUniformScaling", void 0), - n.c([Object(r.c)()], t.prototype, "reIntegrateRotationIntoRotationQuaternion", void 0), + ) + for ( + var n = 0, r = this.getChildTransformNodes(true); + n < r.length; + n++ + ) { + var o = r[n]; + (o.parent = null), o.computeWorldMatrix(true); + } + e.prototype.dispose.call(this, t, i); + }), + (t.BILLBOARDMODE_NONE = 0), + (t.BILLBOARDMODE_X = 1), + (t.BILLBOARDMODE_Y = 2), + (t.BILLBOARDMODE_Z = 4), + (t.BILLBOARDMODE_ALL = 7), + (t._lookAtVectorCache = new a.x(0, 0, 0)), + (t._rotationAxisCache = new a.q()), + n.c( + [Object(r.o)("position")], + t.prototype, + "_position", + void 0 + ), + n.c( + [Object(r.o)("rotation")], + t.prototype, + "_rotation", + void 0 + ), + n.c( + [Object(r.l)("rotationQuaternion")], + t.prototype, + "_rotationQuaternion", + void 0 + ), + n.c( + [Object(r.o)("scaling")], + t.prototype, + "_scaling", + void 0 + ), + n.c( + [Object(r.c)("billboardMode")], + t.prototype, + "_billboardMode", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "scalingDeterminant", + void 0 + ), + n.c( + [Object(r.c)("infiniteDistance")], + t.prototype, + "_infiniteDistance", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "ignoreNonUniformScaling", + void 0 + ), + n.c( + [Object(r.c)()], + t.prototype, + "reIntegrateRotationIntoRotationQuaternion", + void 0 + ), t - }(i(25).a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return f - }); - var n = i(34) - , r = i(0) - , o = i(3) - , a = i(77) - , s = i(82) - , c = { - min: 0, - max: 0 - } - , u = { - min: 0, - max: 0 - } - , l = function(e, t, i) { - var n = r.x.Dot(t.centerWorld, e) - , o = Math.abs(r.x.Dot(t.directions[0], e)) * t.extendSize.x + Math.abs(r.x.Dot(t.directions[1], e)) * t.extendSize.y + Math.abs(r.x.Dot(t.directions[2], e)) * t.extendSize.z; - i.min = n - o, - i.max = n + o - } - , h = function(e, t, i) { - return l(e, t, c), - l(e, i, u), - !(c.min > u.max || u.min > c.max) - } - , f = function() { - function e(e, t, i) { - this._isLocked = false, - this.boundingBox = new a.a(e,t,i), - this.boundingSphere = new s.a(e,t,i) - } - return e.prototype.reConstruct = function(e, t, i) { - this.boundingBox.reConstruct(e, t, i), - this.boundingSphere.reConstruct(e, t, i) - } - , + ); + })(i(25).a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return f; + }); + var n = i(34), + r = i(0), + o = i(3), + a = i(77), + s = i(82), + c = { + min: 0, + max: 0, + }, + u = { + min: 0, + max: 0, + }, + l = function (e, t, i) { + var n = r.x.Dot(t.centerWorld, e), + o = + Math.abs(r.x.Dot(t.directions[0], e)) * t.extendSize.x + + Math.abs(r.x.Dot(t.directions[1], e)) * t.extendSize.y + + Math.abs(r.x.Dot(t.directions[2], e)) * t.extendSize.z; + (i.min = n - o), (i.max = n + o); + }, + h = function (e, t, i) { + return ( + l(e, t, c), l(e, i, u), !(c.min > u.max || u.min > c.max) + ); + }, + f = (function () { + function e(e, t, i) { + (this._isLocked = false), + (this.boundingBox = new a.a(e, t, i)), + (this.boundingSphere = new s.a(e, t, i)); + } + return ( + (e.prototype.reConstruct = function (e, t, i) { + this.boundingBox.reConstruct(e, t, i), + this.boundingSphere.reConstruct(e, t, i); + }), Object.defineProperty(e.prototype, "minimum", { - get: function() { - return this.boundingBox.minimum - }, - enumerable: true, - configurable: true + get: function () { + return this.boundingBox.minimum; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "maximum", { - get: function() { - return this.boundingBox.maximum - }, - enumerable: true, - configurable: true + get: function () { + return this.boundingBox.maximum; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isLocked", { - get: function() { - return this._isLocked - }, - set: function(e) { - this._isLocked = e - }, - enumerable: true, - configurable: true + get: function () { + return this._isLocked; + }, + set: function (e) { + this._isLocked = e; + }, + enumerable: true, + configurable: true, }), - e.prototype.update = function(e) { - this._isLocked || (this.boundingBox._update(e), - this.boundingSphere._update(e)) - } - , - e.prototype.centerOn = function(t, i) { - var n = e.TmpVector3[0].copyFrom(t).subtractInPlace(i) - , r = e.TmpVector3[1].copyFrom(t).addInPlace(i); - return this.boundingBox.reConstruct(n, r, this.boundingBox.getWorldMatrix()), - this.boundingSphere.reConstruct(n, r, this.boundingBox.getWorldMatrix()), + (e.prototype.update = function (e) { + this._isLocked || + (this.boundingBox._update(e), + this.boundingSphere._update(e)); + }), + (e.prototype.centerOn = function (t, i) { + var n = e.TmpVector3[0].copyFrom(t).subtractInPlace(i), + r = e.TmpVector3[1].copyFrom(t).addInPlace(i); + return ( + this.boundingBox.reConstruct( + n, + r, + this.boundingBox.getWorldMatrix() + ), + this.boundingSphere.reConstruct( + n, + r, + this.boundingBox.getWorldMatrix() + ), this - } - , - e.prototype.scale = function(e) { - return this.boundingBox.scale(e), + ); + }), + (e.prototype.scale = function (e) { + return ( + this.boundingBox.scale(e), this.boundingSphere.scale(e), this - } - , - e.prototype.isInFrustum = function(e, t) { - return void 0 === t && (t = o.a.MESHES_CULLINGSTRATEGY_STANDARD), - !(t !== o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION && t !== o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY || !this.boundingSphere.isCenterInFrustum(e)) || !!this.boundingSphere.isInFrustum(e) && (!(t !== o.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY && t !== o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY) || this.boundingBox.isInFrustum(e)) - } - , - Object.defineProperty(e.prototype, "diagonalLength", { - get: function() { - var t = this.boundingBox; - return t.maximumWorld.subtractToRef(t.minimumWorld, e.TmpVector3[0]).length() - }, - enumerable: true, - configurable: true + ); }), - e.prototype.isCompletelyInFrustum = function(e) { - return this.boundingBox.isCompletelyInFrustum(e) - } - , - e.prototype._checkCollision = function(e) { - return e._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld) - } - , - e.prototype.intersectsPoint = function(e) { - return !!this.boundingSphere.centerWorld && !!this.boundingSphere.intersectsPoint(e) && !!this.boundingBox.intersectsPoint(e) - } - , - e.prototype.intersects = function(e, t) { - if (!s.a.Intersects(this.boundingSphere, e.boundingSphere)) - return false; - if (!a.a.Intersects(this.boundingBox, e.boundingBox)) - return false; - if (!t) - return true; - var i = this.boundingBox - , n = e.boundingBox; - return !!(h(i.directions[0], i, n) && h(i.directions[1], i, n) && h(i.directions[2], i, n) && h(n.directions[0], i, n) && h(n.directions[1], i, n) && h(n.directions[2], i, n) && h(r.x.Cross(i.directions[0], n.directions[0]), i, n) && h(r.x.Cross(i.directions[0], n.directions[1]), i, n) && h(r.x.Cross(i.directions[0], n.directions[2]), i, n) && h(r.x.Cross(i.directions[1], n.directions[0]), i, n) && h(r.x.Cross(i.directions[1], n.directions[1]), i, n) && h(r.x.Cross(i.directions[1], n.directions[2]), i, n) && h(r.x.Cross(i.directions[2], n.directions[0]), i, n) && h(r.x.Cross(i.directions[2], n.directions[1]), i, n) && h(r.x.Cross(i.directions[2], n.directions[2]), i, n)) - } - , - e.TmpVector3 = n.a.BuildArray(2, r.x.Zero), + (e.prototype.isInFrustum = function (e, t) { + return ( + void 0 === t && + (t = o.a.MESHES_CULLINGSTRATEGY_STANDARD), + !( + (t !== + o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION && + t !== + o.a + .MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY) || + !this.boundingSphere.isCenterInFrustum(e) + ) || + (!!this.boundingSphere.isInFrustum(e) && + (!( + t !== + o.a + .MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY && + t !== + o.a + .MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY + ) || + this.boundingBox.isInFrustum(e))) + ); + }), + Object.defineProperty(e.prototype, "diagonalLength", { + get: function () { + var t = this.boundingBox; + return t.maximumWorld + .subtractToRef(t.minimumWorld, e.TmpVector3[0]) + .length(); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.isCompletelyInFrustum = function (e) { + return this.boundingBox.isCompletelyInFrustum(e); + }), + (e.prototype._checkCollision = function (e) { + return e._canDoCollision( + this.boundingSphere.centerWorld, + this.boundingSphere.radiusWorld, + this.boundingBox.minimumWorld, + this.boundingBox.maximumWorld + ); + }), + (e.prototype.intersectsPoint = function (e) { + return ( + !!this.boundingSphere.centerWorld && + !!this.boundingSphere.intersectsPoint(e) && + !!this.boundingBox.intersectsPoint(e) + ); + }), + (e.prototype.intersects = function (e, t) { + if ( + !s.a.Intersects(this.boundingSphere, e.boundingSphere) + ) + return false; + if (!a.a.Intersects(this.boundingBox, e.boundingBox)) + return false; + if (!t) return true; + var i = this.boundingBox, + n = e.boundingBox; + return !!( + h(i.directions[0], i, n) && + h(i.directions[1], i, n) && + h(i.directions[2], i, n) && + h(n.directions[0], i, n) && + h(n.directions[1], i, n) && + h(n.directions[2], i, n) && + h(r.x.Cross(i.directions[0], n.directions[0]), i, n) && + h(r.x.Cross(i.directions[0], n.directions[1]), i, n) && + h(r.x.Cross(i.directions[0], n.directions[2]), i, n) && + h(r.x.Cross(i.directions[1], n.directions[0]), i, n) && + h(r.x.Cross(i.directions[1], n.directions[1]), i, n) && + h(r.x.Cross(i.directions[1], n.directions[2]), i, n) && + h(r.x.Cross(i.directions[2], n.directions[0]), i, n) && + h(r.x.Cross(i.directions[2], n.directions[1]), i, n) && + h(r.x.Cross(i.directions[2], n.directions[2]), i, n) + ); + }), + (e.TmpVector3 = n.a.BuildArray(2, r.x.Zero)), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return h - }); - var n = i(1) - , r = i(2) - , o = i(8) - , a = i(9) - , s = i(71) - , c = i(0) - , u = i(23) - , l = i(3) - , h = function() { - function e(t) { - this.metadata = null, - this.reservedDataStore = null, - this._hasAlpha = false, - this.getAlphaFromRGB = false, - this.level = 1, - this.coordinatesIndex = 0, - this._coordinatesMode = l.a.TEXTURE_EXPLICIT_MODE, - this.wrapU = l.a.TEXTURE_WRAP_ADDRESSMODE, - this.wrapV = l.a.TEXTURE_WRAP_ADDRESSMODE, - this.wrapR = l.a.TEXTURE_WRAP_ADDRESSMODE, - this.anisotropicFilteringLevel = e.DEFAULT_ANISOTROPIC_FILTERING_LEVEL, - this.gammaSpace = true, - this.invertZ = false, - this.lodLevelInAlpha = false, - this.isRenderTarget = false, - this.animations = new Array, - this.onDisposeObservable = new o.c, - this._onDisposeObserver = null, - this.delayLoadState = l.a.DELAYLOADSTATE_NONE, - this._scene = null, - this._texture = null, - this._uid = null, - this._cachedSize = c.r.Zero(), - this._scene = t || u.a.LastCreatedScene, - this._scene && (this.uniqueId = this._scene.getUniqueId(), + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return h; + }); + var n = i(1), + r = i(2), + o = i(8), + a = i(9), + s = i(71), + c = i(0), + u = i(23), + l = i(3), + h = (function () { + function e(t) { + (this.metadata = null), + (this.reservedDataStore = null), + (this._hasAlpha = false), + (this.getAlphaFromRGB = false), + (this.level = 1), + (this.coordinatesIndex = 0), + (this._coordinatesMode = l.a.TEXTURE_EXPLICIT_MODE), + (this.wrapU = l.a.TEXTURE_WRAP_ADDRESSMODE), + (this.wrapV = l.a.TEXTURE_WRAP_ADDRESSMODE), + (this.wrapR = l.a.TEXTURE_WRAP_ADDRESSMODE), + (this.anisotropicFilteringLevel = + e.DEFAULT_ANISOTROPIC_FILTERING_LEVEL), + (this.gammaSpace = true), + (this.invertZ = false), + (this.lodLevelInAlpha = false), + (this.isRenderTarget = false), + (this.animations = new Array()), + (this.onDisposeObservable = new o.c()), + (this._onDisposeObserver = null), + (this.delayLoadState = l.a.DELAYLOADSTATE_NONE), + (this._scene = null), + (this._texture = null), + (this._uid = null), + (this._cachedSize = c.r.Zero()), + (this._scene = t || u.a.LastCreatedScene), + this._scene && + ((this.uniqueId = this._scene.getUniqueId()), this._scene.addTexture(this)), - this._uid = null - } - return Object.defineProperty(e.prototype, "hasAlpha", { - get: function() { - return this._hasAlpha - }, - set: function(e) { - this._hasAlpha !== e && (this._hasAlpha = e, - this._scene && this._scene.markAllMaterialsAsDirty(l.a.MATERIAL_TextureDirtyFlag | l.a.MATERIAL_MiscDirtyFlag)) - }, - enumerable: true, - configurable: true + (this._uid = null); + } + return ( + Object.defineProperty(e.prototype, "hasAlpha", { + get: function () { + return this._hasAlpha; + }, + set: function (e) { + this._hasAlpha !== e && + ((this._hasAlpha = e), + this._scene && + this._scene.markAllMaterialsAsDirty( + l.a.MATERIAL_TextureDirtyFlag | + l.a.MATERIAL_MiscDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "coordinatesMode", { - get: function() { - return this._coordinatesMode - }, - set: function(e) { - this._coordinatesMode !== e && (this._coordinatesMode = e, - this._scene && this._scene.markAllMaterialsAsDirty(l.a.MATERIAL_TextureDirtyFlag)) - }, - enumerable: true, - configurable: true + get: function () { + return this._coordinatesMode; + }, + set: function (e) { + this._coordinatesMode !== e && + ((this._coordinatesMode = e), + this._scene && + this._scene.markAllMaterialsAsDirty( + l.a.MATERIAL_TextureDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isCube", { - get: function() { - return !!this._texture && this._texture.isCube - }, - set: function(e) { - this._texture && (this._texture.isCube = e) - }, - enumerable: true, - configurable: true + get: function () { + return !!this._texture && this._texture.isCube; + }, + set: function (e) { + this._texture && (this._texture.isCube = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "is3D", { - get: function() { - return !!this._texture && this._texture.is3D - }, - set: function(e) { - this._texture && (this._texture.is3D = e) - }, - enumerable: true, - configurable: true + get: function () { + return !!this._texture && this._texture.is3D; + }, + set: function (e) { + this._texture && (this._texture.is3D = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isRGBD", { - get: function() { - return null != this._texture && this._texture._isRGBD - }, - enumerable: true, - configurable: true + get: function () { + return null != this._texture && this._texture._isRGBD; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "noMipmap", { - get: function() { - return false - }, - enumerable: true, - configurable: true + get: function () { + return false; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "lodGenerationOffset", { - get: function() { - return this._texture ? this._texture._lodGenerationOffset : 0 - }, - set: function(e) { - this._texture && (this._texture._lodGenerationOffset = e) - }, - enumerable: true, - configurable: true + get: function () { + return this._texture + ? this._texture._lodGenerationOffset + : 0; + }, + set: function (e) { + this._texture && + (this._texture._lodGenerationOffset = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "lodGenerationScale", { - get: function() { - return this._texture ? this._texture._lodGenerationScale : 0 - }, - set: function(e) { - this._texture && (this._texture._lodGenerationScale = e) - }, - enumerable: true, - configurable: true + get: function () { + return this._texture + ? this._texture._lodGenerationScale + : 0; + }, + set: function (e) { + this._texture && + (this._texture._lodGenerationScale = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "uid", { - get: function() { - return this._uid || (this._uid = a.h.RandomId()), - this._uid - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._uid || (this._uid = a.h.RandomId()), this._uid + ); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.toString = function () { + return this.name; + }), + (e.prototype.getClassName = function () { + return "BaseTexture"; }), - e.prototype.toString = function() { - return this.name - } - , - e.prototype.getClassName = function() { - return "BaseTexture" - } - , Object.defineProperty(e.prototype, "onDispose", { - set: function(e) { - this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), - this._onDisposeObserver = this.onDisposeObservable.add(e) - }, - enumerable: true, - configurable: true + set: function (e) { + this._onDisposeObserver && + this.onDisposeObservable.remove( + this._onDisposeObserver + ), + (this._onDisposeObserver = + this.onDisposeObservable.add(e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isBlocking", { - get: function() { - return true - }, - enumerable: true, - configurable: true + get: function () { + return true; + }, + enumerable: true, + configurable: true, }), - e.prototype.getScene = function() { - return this._scene - } - , - e.prototype.getTextureMatrix = function() { - return c.j.IdentityReadOnly - } - , - e.prototype.getReflectionTextureMatrix = function() { - return c.j.IdentityReadOnly - } - , - e.prototype.getInternalTexture = function() { - return this._texture - } - , - e.prototype.isReadyOrNotBlocking = function() { - return !this.isBlocking || this.isReady() - } - , - e.prototype.isReady = function() { - return this.delayLoadState === l.a.DELAYLOADSTATE_NOTLOADED ? (this.delayLoad(), - false) : !!this._texture && this._texture.isReady - } - , - e.prototype.getSize = function() { - if (this._texture) { - if (this._texture.width) - return this._cachedSize.width = this._texture.width, - this._cachedSize.height = this._texture.height, - this._cachedSize; - if (this._texture._size) - return this._cachedSize.width = this._texture._size, - this._cachedSize.height = this._texture._size, - this._cachedSize - } - return this._cachedSize - } - , - e.prototype.getBaseSize = function() { - return this.isReady() && this._texture ? this._texture._size ? new c.r(this._texture._size,this._texture._size) : new c.r(this._texture.baseWidth,this._texture.baseHeight) : c.r.Zero() - } - , - e.prototype.updateSamplingMode = function(e) { - if (this._texture) { - var t = this.getScene(); - t && t.getEngine().updateTextureSamplingMode(e, this._texture) - } - } - , - e.prototype.scale = function(e) {} - , + (e.prototype.getScene = function () { + return this._scene; + }), + (e.prototype.getTextureMatrix = function () { + return c.j.IdentityReadOnly; + }), + (e.prototype.getReflectionTextureMatrix = function () { + return c.j.IdentityReadOnly; + }), + (e.prototype.getInternalTexture = function () { + return this._texture; + }), + (e.prototype.isReadyOrNotBlocking = function () { + return !this.isBlocking || this.isReady(); + }), + (e.prototype.isReady = function () { + return this.delayLoadState === + l.a.DELAYLOADSTATE_NOTLOADED + ? (this.delayLoad(), false) + : !!this._texture && this._texture.isReady; + }), + (e.prototype.getSize = function () { + if (this._texture) { + if (this._texture.width) + return ( + (this._cachedSize.width = this._texture.width), + (this._cachedSize.height = this._texture.height), + this._cachedSize + ); + if (this._texture._size) + return ( + (this._cachedSize.width = this._texture._size), + (this._cachedSize.height = this._texture._size), + this._cachedSize + ); + } + return this._cachedSize; + }), + (e.prototype.getBaseSize = function () { + return this.isReady() && this._texture + ? this._texture._size + ? new c.r(this._texture._size, this._texture._size) + : new c.r( + this._texture.baseWidth, + this._texture.baseHeight + ) + : c.r.Zero(); + }), + (e.prototype.updateSamplingMode = function (e) { + if (this._texture) { + var t = this.getScene(); + t && + t + .getEngine() + .updateTextureSamplingMode(e, this._texture); + } + }), + (e.prototype.scale = function (e) {}), Object.defineProperty(e.prototype, "canRescale", { - get: function() { - return false - }, - enumerable: true, - configurable: true + get: function () { + return false; + }, + enumerable: true, + configurable: true, + }), + (e.prototype._getFromCache = function (e, t, i, n) { + if (!this._scene) return null; + for ( + var r = this._scene + .getEngine() + .getLoadedTexturesCache(), + o = 0; + o < r.length; + o++ + ) { + var a = r[o]; + if ( + !( + (void 0 !== n && n !== a.invertY) || + a.url !== e || + a.generateMipMaps !== !t || + (i && i !== a.samplingMode) + ) + ) + return a.incrementReferences(), a; + } + return null; + }), + (e.prototype._rebuild = function () {}), + (e.prototype.delayLoad = function () {}), + (e.prototype.clone = function () { + return null; }), - e.prototype._getFromCache = function(e, t, i, n) { - if (!this._scene) - return null; - for (var r = this._scene.getEngine().getLoadedTexturesCache(), o = 0; o < r.length; o++) { - var a = r[o]; - if (!(void 0 !== n && n !== a.invertY || a.url !== e || a.generateMipMaps !== !t || i && i !== a.samplingMode)) - return a.incrementReferences(), - a - } - return null - } - , - e.prototype._rebuild = function() {} - , - e.prototype.delayLoad = function() {} - , - e.prototype.clone = function() { - return null - } - , Object.defineProperty(e.prototype, "textureType", { - get: function() { - return this._texture && void 0 !== this._texture.type ? this._texture.type : l.a.TEXTURETYPE_UNSIGNED_INT - }, - enumerable: true, - configurable: true + get: function () { + return this._texture && void 0 !== this._texture.type + ? this._texture.type + : l.a.TEXTURETYPE_UNSIGNED_INT; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "textureFormat", { - get: function() { - return this._texture && void 0 !== this._texture.format ? this._texture.format : l.a.TEXTUREFORMAT_RGBA - }, - enumerable: true, - configurable: true + get: function () { + return this._texture && void 0 !== this._texture.format + ? this._texture.format + : l.a.TEXTUREFORMAT_RGBA; + }, + enumerable: true, + configurable: true, }), - e.prototype.readPixels = function(e, t, i) { - if (void 0 === e && (e = 0), + (e.prototype.readPixels = function (e, t, i) { + if ( + (void 0 === e && (e = 0), void 0 === t && (t = 0), void 0 === i && (i = null), !this._texture) - return null; - var n = this.getSize() - , r = n.width - , o = n.height - , a = this.getScene(); - if (!a) - return null; - var s = a.getEngine(); - return 0 != t && (r /= Math.pow(2, t), - o /= Math.pow(2, t), - r = Math.round(r), - o = Math.round(o)), - this._texture.isCube ? s._readTexturePixels(this._texture, r, o, e, t, i) : s._readTexturePixels(this._texture, r, o, -1, t, i) - } - , - e.prototype.releaseInternalTexture = function() { - this._texture && (this._texture.dispose(), - this._texture = null) - } - , + ) + return null; + var n = this.getSize(), + r = n.width, + o = n.height, + a = this.getScene(); + if (!a) return null; + var s = a.getEngine(); + return ( + 0 != t && + ((r /= Math.pow(2, t)), + (o /= Math.pow(2, t)), + (r = Math.round(r)), + (o = Math.round(o))), + this._texture.isCube + ? s._readTexturePixels(this._texture, r, o, e, t, i) + : s._readTexturePixels(this._texture, r, o, -1, t, i) + ); + }), + (e.prototype.releaseInternalTexture = function () { + this._texture && + (this._texture.dispose(), (this._texture = null)); + }), Object.defineProperty(e.prototype, "sphericalPolynomial", { - get: function() { - return this._texture && s.a && this.isReady() ? (this._texture._sphericalPolynomial || (this._texture._sphericalPolynomial = s.a.ConvertCubeMapTextureToSphericalPolynomial(this)), - this._texture._sphericalPolynomial) : null - }, - set: function(e) { - this._texture && (this._texture._sphericalPolynomial = e) - }, - enumerable: true, - configurable: true + get: function () { + return this._texture && s.a && this.isReady() + ? (this._texture._sphericalPolynomial || + (this._texture._sphericalPolynomial = + s.a.ConvertCubeMapTextureToSphericalPolynomial( + this + )), + this._texture._sphericalPolynomial) + : null; + }, + set: function (e) { + this._texture && + (this._texture._sphericalPolynomial = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "_lodTextureHigh", { - get: function() { - return this._texture ? this._texture._lodTextureHigh : null - }, - enumerable: true, - configurable: true + get: function () { + return this._texture + ? this._texture._lodTextureHigh + : null; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "_lodTextureMid", { - get: function() { - return this._texture ? this._texture._lodTextureMid : null - }, - enumerable: true, - configurable: true + get: function () { + return this._texture + ? this._texture._lodTextureMid + : null; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "_lodTextureLow", { - get: function() { - return this._texture ? this._texture._lodTextureLow : null - }, - enumerable: true, - configurable: true + get: function () { + return this._texture + ? this._texture._lodTextureLow + : null; + }, + enumerable: true, + configurable: true, }), - e.prototype.dispose = function() { - if (this._scene) { - this._scene.stopAnimation && this._scene.stopAnimation(this), - this._scene._removePendingData(this); - var e = this._scene.textures.indexOf(this); - e >= 0 && this._scene.textures.splice(e, 1), - this._scene.onTextureRemovedObservable.notifyObservers(this), - void 0 !== this._texture && (this.releaseInternalTexture(), + (e.prototype.dispose = function () { + if (this._scene) { + this._scene.stopAnimation && + this._scene.stopAnimation(this), + this._scene._removePendingData(this); + var e = this._scene.textures.indexOf(this); + e >= 0 && this._scene.textures.splice(e, 1), + this._scene.onTextureRemovedObservable.notifyObservers( + this + ), + void 0 !== this._texture && + (this.releaseInternalTexture(), this.onDisposeObservable.notifyObservers(this), - this.onDisposeObservable.clear()) - } - } - , - e.prototype.serialize = function() { - if (!this.name) - return null; - var e = r.a.Serialize(this); - return r.a.AppendSerializedAnimations(this, e), - e - } - , - e.WhenAllReady = function(e, t) { - var i = e.length; - if (0 !== i) - for (var n, r, o = function() { - if ((n = e[a]).isReady()) - 0 == --i && t(); - else { - var o = function e() { - r.removeCallback(e), - 0 == --i && t() - }; - (r = n.onLoadObservable).add(o) - } - }, a = 0; a < e.length; a++) - o(); - else - t() - } - , - e.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4, + this.onDisposeObservable.clear()); + } + }), + (e.prototype.serialize = function () { + if (!this.name) return null; + var e = r.a.Serialize(this); + return r.a.AppendSerializedAnimations(this, e), e; + }), + (e.WhenAllReady = function (e, t) { + var i = e.length; + if (0 !== i) + for ( + var n, + r, + o = function () { + if ((n = e[a]).isReady()) 0 == --i && t(); + else { + var o = function e() { + r.removeCallback(e), 0 == --i && t(); + }; + (r = n.onLoadObservable).add(o); + } + }, + a = 0; + a < e.length; + a++ + ) + o(); + else t(); + }), + (e.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4), n.c([Object(r.c)()], e.prototype, "uniqueId", void 0), n.c([Object(r.c)()], e.prototype, "name", void 0), n.c([Object(r.c)()], e.prototype, "metadata", void 0), - n.c([Object(r.c)("hasAlpha")], e.prototype, "_hasAlpha", void 0), - n.c([Object(r.c)()], e.prototype, "getAlphaFromRGB", void 0), + n.c( + [Object(r.c)("hasAlpha")], + e.prototype, + "_hasAlpha", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "getAlphaFromRGB", + void 0 + ), n.c([Object(r.c)()], e.prototype, "level", void 0), - n.c([Object(r.c)()], e.prototype, "coordinatesIndex", void 0), - n.c([Object(r.c)("coordinatesMode")], e.prototype, "_coordinatesMode", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "coordinatesIndex", + void 0 + ), + n.c( + [Object(r.c)("coordinatesMode")], + e.prototype, + "_coordinatesMode", + void 0 + ), n.c([Object(r.c)()], e.prototype, "wrapU", void 0), n.c([Object(r.c)()], e.prototype, "wrapV", void 0), n.c([Object(r.c)()], e.prototype, "wrapR", void 0), - n.c([Object(r.c)()], e.prototype, "anisotropicFilteringLevel", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "anisotropicFilteringLevel", + void 0 + ), n.c([Object(r.c)()], e.prototype, "isCube", null), n.c([Object(r.c)()], e.prototype, "is3D", null), n.c([Object(r.c)()], e.prototype, "gammaSpace", void 0), n.c([Object(r.c)()], e.prototype, "invertZ", void 0), - n.c([Object(r.c)()], e.prototype, "lodLevelInAlpha", void 0), - n.c([Object(r.c)()], e.prototype, "lodGenerationOffset", null), - n.c([Object(r.c)()], e.prototype, "lodGenerationScale", null), + n.c( + [Object(r.c)()], + e.prototype, + "lodLevelInAlpha", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "lodGenerationOffset", + null + ), + n.c( + [Object(r.c)()], + e.prototype, + "lodGenerationScale", + null + ), n.c([Object(r.c)()], e.prototype, "isRenderTarget", void 0), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }); - var n = i(0) - , r = function() { - function e() {} - return e._RemoveAndStorePivotPoint = function(t) { - t && 0 === e._PivotCached && (t.getPivotPointToRef(e._OldPivotPoint), - e._OldPivotPoint.equalsToFloats(0, 0, 0) || (t.setPivotMatrix(n.j.IdentityReadOnly), - e._OldPivotPoint.subtractToRef(t.getPivotPoint(), e._PivotTranslation), - e._PivotTmpVector.copyFromFloats(1, 1, 1), - e._PivotTmpVector.subtractInPlace(t.scaling), - e._PivotTmpVector.multiplyInPlace(e._PivotTranslation), - t.position.addInPlace(e._PivotTmpVector))), - e._PivotCached++ - } - , - e._RestorePivotPoint = function(t) { - t && !e._OldPivotPoint.equalsToFloats(0, 0, 0) && 1 === e._PivotCached && (t.setPivotPoint(e._OldPivotPoint), + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }); + var n = i(0), + r = (function () { + function e() {} + return ( + (e._RemoveAndStorePivotPoint = function (t) { + t && + 0 === e._PivotCached && + (t.getPivotPointToRef(e._OldPivotPoint), + e._OldPivotPoint.equalsToFloats(0, 0, 0) || + (t.setPivotMatrix(n.j.IdentityReadOnly), + e._OldPivotPoint.subtractToRef( + t.getPivotPoint(), + e._PivotTranslation + ), + e._PivotTmpVector.copyFromFloats(1, 1, 1), + e._PivotTmpVector.subtractInPlace(t.scaling), + e._PivotTmpVector.multiplyInPlace( + e._PivotTranslation + ), + t.position.addInPlace(e._PivotTmpVector))), + e._PivotCached++; + }), + (e._RestorePivotPoint = function (t) { + t && + !e._OldPivotPoint.equalsToFloats(0, 0, 0) && + 1 === e._PivotCached && + (t.setPivotPoint(e._OldPivotPoint), e._PivotTmpVector.copyFromFloats(1, 1, 1), e._PivotTmpVector.subtractInPlace(t.scaling), e._PivotTmpVector.multiplyInPlace(e._PivotTranslation), t.position.subtractInPlace(e._PivotTmpVector)), - this._PivotCached-- - } - , - e._PivotCached = 0, - e._OldPivotPoint = new n.x, - e._PivotTranslation = new n.x, - e._PivotTmpVector = new n.x, + this._PivotCached--; + }), + (e._PivotCached = 0), + (e._OldPivotPoint = new n.x()), + (e._PivotTranslation = new n.x()), + (e._PivotTmpVector = new n.x()), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return a - }); - var n = i(0) - , r = i(11) - , o = i(13); - o.a.CreateSphere = function(e) { - for (var t = e.segments || 32, i = e.diameterX || e.diameter || 1, r = e.diameterY || e.diameter || 1, a = e.diameterZ || e.diameter || 1, s = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1, c = e.slice && e.slice <= 0 ? 1 : e.slice || 1, u = 0 === e.sideOrientation ? 0 : e.sideOrientation || o.a.DEFAULTSIDE, l = new n.x(i / 2,r / 2,a / 2), h = 2 + t, f = 2 * h, d = [], p = [], m = [], g = [], _ = 0; _ <= h; _++) { - for (var v = _ / h, y = v * Math.PI * c, b = 0; b <= f; b++) { - var E = b / f - , T = E * Math.PI * 2 * s - , A = n.j.RotationZ(-y) - , x = n.j.RotationY(T) - , S = n.x.TransformCoordinates(n.x.Up(), A) - , C = n.x.TransformCoordinates(S, x) - , P = C.multiply(l) - , R = C.divide(l).normalize(); - p.push(P.x, P.y, P.z), - m.push(R.x, R.y, R.z), - g.push(E, v) - } - if (_ > 0) - for (var M = p.length / 3, O = M - 2 * (f + 1); O + f + 2 < M; O++) - d.push(O), - d.push(O + 1), - d.push(O + f + 1), - d.push(O + f + 1), - d.push(O + 1), - d.push(O + f + 2) - } - o.a._ComputeSides(u, p, d, m, g, e.frontUVs, e.backUVs); - var w = new o.a; - return w.indices = d, - w.positions = p, - w.normals = m, - w.uvs = g, - w + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return a; + }); + var n = i(0), + r = i(11), + o = i(13); + (o.a.CreateSphere = function (e) { + for ( + var t = e.segments || 32, + i = e.diameterX || e.diameter || 1, + r = e.diameterY || e.diameter || 1, + a = e.diameterZ || e.diameter || 1, + s = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1, + c = e.slice && e.slice <= 0 ? 1 : e.slice || 1, + u = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || o.a.DEFAULTSIDE, + l = new n.x(i / 2, r / 2, a / 2), + h = 2 + t, + f = 2 * h, + d = [], + p = [], + m = [], + g = [], + _ = 0; + _ <= h; + _++ + ) { + for (var v = _ / h, y = v * Math.PI * c, b = 0; b <= f; b++) { + var E = b / f, + T = E * Math.PI * 2 * s, + A = n.j.RotationZ(-y), + x = n.j.RotationY(T), + S = n.x.TransformCoordinates(n.x.Up(), A), + C = n.x.TransformCoordinates(S, x), + P = C.multiply(l), + R = C.divide(l).normalize(); + p.push(P.x, P.y, P.z), m.push(R.x, R.y, R.z), g.push(E, v); + } + if (_ > 0) + for ( + var M = p.length / 3, O = M - 2 * (f + 1); + O + f + 2 < M; + O++ + ) + d.push(O), + d.push(O + 1), + d.push(O + f + 1), + d.push(O + f + 1), + d.push(O + 1), + d.push(O + f + 2); } - , - r.a.CreateSphere = function(e, t, i, n, r, o) { - var s = { - segments: t, - diameterX: i, - diameterY: i, - diameterZ: i, - sideOrientation: o, - updatable: r - }; - return a.CreateSphere(e, s, n) - } - ; - var a = function() { - function e() {} - return e.CreateSphere = function(e, t, i) { - var n = new r.a(e,i); - return t.sideOrientation = r.a._GetDefaultSideOrientation(t.sideOrientation), - n._originalBuilderSideOrientation = t.sideOrientation, - o.a.CreateSphere(t).applyToMesh(n, t.updatable), - n - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r + o.a._ComputeSides(u, p, d, m, g, e.frontUVs, e.backUVs); + var w = new o.a(); + return ( + (w.indices = d), + (w.positions = p), + (w.normals = m), + (w.uvs = g), + w + ); + }), + (r.a.CreateSphere = function (e, t, i, n, r, o) { + var s = { + segments: t, + diameterX: i, + diameterY: i, + diameterZ: i, + sideOrientation: o, + updatable: r, + }; + return a.CreateSphere(e, s, n); }); - var n = i(35) - , r = function() { - function e() {} - return Object.defineProperty(e, "Now", { - get: function() { - return n.a.IsWindowObjectExist() && window.performance && window.performance.now ? window.performance.now() : Date.now() - }, - enumerable: true, - configurable: true + var a = (function () { + function e() {} + return ( + (e.CreateSphere = function (e, t, i) { + var n = new r.a(e, i); + return ( + (t.sideOrientation = r.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (n._originalBuilderSideOrientation = t.sideOrientation), + o.a.CreateSphere(t).applyToMesh(n, t.updatable), + n + ); + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }); + var n = i(35), + r = (function () { + function e() {} + return ( + Object.defineProperty(e, "Now", { + get: function () { + return n.a.IsWindowObjectExist() && + window.performance && + window.performance.now + ? window.performance.now() + : Date.now(); + }, + enumerable: true, + configurable: true, }), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return a - }); - var n = i(0) - , r = i(11) - , o = i(41) - , a = function() { - function e(e) { - var t = this; - void 0 === e && (e = o.a.DefaultUtilityLayer), - this.gizmoLayer = e, - this._attachedMesh = null, - this.scaleRatio = 1, - this._customMeshSet = false, - this.updateGizmoRotationToMatchAttachedMesh = true, - this.updateGizmoPositionToMatchAttachedMesh = true, - this._updateScale = true, - this._interactionsEnabled = true, - this._tempVector = new n.x, - this._rootMesh = new r.a("gizmoRootNode",e.utilityLayerScene), - this._rootMesh.rotationQuaternion = n.q.Identity(), - this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(function() { - t._update() - }) - } - return Object.defineProperty(e.prototype, "attachedMesh", { - get: function() { - return this._attachedMesh - }, - set: function(e) { - this._attachedMesh = e, - this._rootMesh.setEnabled(!!e), - this._attachedMeshChanged(e) - }, - enumerable: true, - configurable: true + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return a; + }); + var n = i(0), + r = i(11), + o = i(41), + a = (function () { + function e(e) { + var t = this; + void 0 === e && (e = o.a.DefaultUtilityLayer), + (this.gizmoLayer = e), + (this._attachedMesh = null), + (this.scaleRatio = 1), + (this._customMeshSet = false), + (this.updateGizmoRotationToMatchAttachedMesh = true), + (this.updateGizmoPositionToMatchAttachedMesh = true), + (this._updateScale = true), + (this._interactionsEnabled = true), + (this._tempVector = new n.x()), + (this._rootMesh = new r.a( + "gizmoRootNode", + e.utilityLayerScene + )), + (this._rootMesh.rotationQuaternion = n.q.Identity()), + (this._beforeRenderObserver = + this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add( + function () { + t._update(); + } + )); + } + return ( + Object.defineProperty(e.prototype, "attachedMesh", { + get: function () { + return this._attachedMesh; + }, + set: function (e) { + (this._attachedMesh = e), + this._rootMesh.setEnabled(!!e), + this._attachedMeshChanged(e); + }, + enumerable: true, + configurable: true, }), - e.prototype.setCustomMesh = function(e) { - if (e.getScene() != this.gizmoLayer.utilityLayerScene) - throw "When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)"; - this._rootMesh.getChildMeshes().forEach(function(e) { - e.dispose() - }), - e.parent = this._rootMesh, - this._customMeshSet = true - } - , - e.prototype._attachedMeshChanged = function(e) {} - , - e.prototype._update = function() { - if (this.attachedMesh) { - var e = this.attachedMesh._effectiveMesh || this.attachedMesh; - if (this.updateGizmoPositionToMatchAttachedMesh && this._rootMesh.position.copyFrom(e.absolutePosition), - this.updateGizmoRotationToMatchAttachedMesh ? e.getWorldMatrix().decompose(void 0, this._rootMesh.rotationQuaternion) : this._rootMesh.rotationQuaternion.set(0, 0, 0, 1), - this._updateScale) { - var t = this.gizmoLayer.utilityLayerScene.activeCamera - , i = t.globalPosition; - t.devicePosition && (i = t.devicePosition), - this._rootMesh.position.subtractToRef(i, this._tempVector); - var n = this._tempVector.length() * this.scaleRatio; - this._rootMesh.scaling.set(n, n, n), - e._getWorldMatrixDeterminant() < 0 && (this._rootMesh.scaling.y *= -1) - } + (e.prototype.setCustomMesh = function (e) { + if (e.getScene() != this.gizmoLayer.utilityLayerScene) + throw "When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)"; + this._rootMesh.getChildMeshes().forEach(function (e) { + e.dispose(); + }), + (e.parent = this._rootMesh), + (this._customMeshSet = true); + }), + (e.prototype._attachedMeshChanged = function (e) {}), + (e.prototype._update = function () { + if (this.attachedMesh) { + var e = + this.attachedMesh._effectiveMesh || this.attachedMesh; + if ( + (this.updateGizmoPositionToMatchAttachedMesh && + this._rootMesh.position.copyFrom( + e.absolutePosition + ), + this.updateGizmoRotationToMatchAttachedMesh + ? e + .getWorldMatrix() + .decompose( + void 0, + this._rootMesh.rotationQuaternion + ) + : this._rootMesh.rotationQuaternion.set(0, 0, 0, 1), + this._updateScale) + ) { + var t = + this.gizmoLayer.utilityLayerScene.activeCamera, + i = t.globalPosition; + t.devicePosition && (i = t.devicePosition), + this._rootMesh.position.subtractToRef( + i, + this._tempVector + ); + var n = this._tempVector.length() * this.scaleRatio; + this._rootMesh.scaling.set(n, n, n), + e._getWorldMatrixDeterminant() < 0 && + (this._rootMesh.scaling.y *= -1); } - } - , - e.prototype.dispose = function() { - this._rootMesh.dispose(), - this._beforeRenderObserver && this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver) - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return u - }), - i.d(t, "b", function() { - return l - }); - var n = i(1) - , r = i(9) - , o = i(4) - , a = i(81) - , s = i(43) - , c = i(3) - , u = function() { - function e() { - this._materialDefines = null, - this._materialEffect = null - } - return Object.defineProperty(e.prototype, "effect", { - get: function() { - return this._materialEffect - }, - enumerable: true, - configurable: true + } + }), + (e.prototype.dispose = function () { + this._rootMesh.dispose(), + this._beforeRenderObserver && + this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove( + this._beforeRenderObserver + ); }), - e.prototype.setEffect = function(e, t) { - void 0 === t && (t = null), - this._materialEffect !== e ? (this._materialDefines = t, - this._materialEffect = e) : e || (this._materialDefines = null) - } - , e - }() - , l = function(e) { - function t(t, i, n, r, o, a, s, c) { - void 0 === c && (c = true); - var u = e.call(this) || this; - return u.materialIndex = t, - u.verticesStart = i, - u.verticesCount = n, - u.indexStart = r, - u.indexCount = o, - u._linesIndexCount = 0, - u._linesIndexBuffer = null, - u._lastColliderWorldVertices = null, - u._lastColliderTransformMatrix = null, - u._renderId = 0, - u._alphaIndex = 0, - u._distanceToCamera = 0, - u._currentMaterial = null, - u._mesh = a, - u._renderingMesh = s || a, - a.subMeshes.push(u), - u._trianglePlanes = [], - u._id = a.subMeshes.length - 1, - c && (u.refreshBoundingInfo(), - a.computeWorldMatrix(true)), - u - } - return n.d(t, e), - t.AddToMesh = function(e, i, n, r, o, a, s, c) { - return void 0 === c && (c = true), - new t(e,i,n,r,o,a,s,c) - } - , + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return u; + }), + i.d(t, "b", function () { + return l; + }); + var n = i(1), + r = i(9), + o = i(4), + a = i(81), + s = i(43), + c = i(3), + u = (function () { + function e() { + (this._materialDefines = null), + (this._materialEffect = null); + } + return ( + Object.defineProperty(e.prototype, "effect", { + get: function () { + return this._materialEffect; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.setEffect = function (e, t) { + void 0 === t && (t = null), + this._materialEffect !== e + ? ((this._materialDefines = t), + (this._materialEffect = e)) + : e || (this._materialDefines = null); + }), + e + ); + })(), + l = (function (e) { + function t(t, i, n, r, o, a, s, c) { + void 0 === c && (c = true); + var u = e.call(this) || this; + return ( + (u.materialIndex = t), + (u.verticesStart = i), + (u.verticesCount = n), + (u.indexStart = r), + (u.indexCount = o), + (u._linesIndexCount = 0), + (u._linesIndexBuffer = null), + (u._lastColliderWorldVertices = null), + (u._lastColliderTransformMatrix = null), + (u._renderId = 0), + (u._alphaIndex = 0), + (u._distanceToCamera = 0), + (u._currentMaterial = null), + (u._mesh = a), + (u._renderingMesh = s || a), + a.subMeshes.push(u), + (u._trianglePlanes = []), + (u._id = a.subMeshes.length - 1), + c && + (u.refreshBoundingInfo(), a.computeWorldMatrix(true)), + u + ); + } + return ( + n.d(t, e), + (t.AddToMesh = function (e, i, n, r, o, a, s, c) { + return ( + void 0 === c && (c = true), + new t(e, i, n, r, o, a, s, c) + ); + }), Object.defineProperty(t.prototype, "IsGlobal", { - get: function() { - return 0 === this.verticesStart && this.verticesCount === this._mesh.getTotalVertices() - }, - enumerable: true, - configurable: true + get: function () { + return ( + 0 === this.verticesStart && + this.verticesCount === this._mesh.getTotalVertices() + ); + }, + enumerable: true, + configurable: true, }), - t.prototype.getBoundingInfo = function() { - return this.IsGlobal ? this._mesh.getBoundingInfo() : this._boundingInfo - } - , - t.prototype.setBoundingInfo = function(e) { - return this._boundingInfo = e, - this - } - , - t.prototype.getMesh = function() { - return this._mesh - } - , - t.prototype.getRenderingMesh = function() { - return this._renderingMesh - } - , - t.prototype.getMaterial = function() { - var e = this._renderingMesh.material; - if (null == e) - return this._mesh.getScene().defaultMaterial; - if (e.getSubMaterial) { - var t = e.getSubMaterial(this.materialIndex); - return this._currentMaterial !== t && (this._currentMaterial = t, - this._materialDefines = null), - t - } - return e - } - , - t.prototype.refreshBoundingInfo = function(e) { - if (void 0 === e && (e = null), - this._lastColliderWorldVertices = null, - this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry) - return this; - if (e || (e = this._renderingMesh.getVerticesData(o.b.PositionKind)), + (t.prototype.getBoundingInfo = function () { + return this.IsGlobal + ? this._mesh.getBoundingInfo() + : this._boundingInfo; + }), + (t.prototype.setBoundingInfo = function (e) { + return (this._boundingInfo = e), this; + }), + (t.prototype.getMesh = function () { + return this._mesh; + }), + (t.prototype.getRenderingMesh = function () { + return this._renderingMesh; + }), + (t.prototype.getMaterial = function () { + var e = this._renderingMesh.material; + if (null == e) + return this._mesh.getScene().defaultMaterial; + if (e.getSubMaterial) { + var t = e.getSubMaterial(this.materialIndex); + return ( + this._currentMaterial !== t && + ((this._currentMaterial = t), + (this._materialDefines = null)), + t + ); + } + return e; + }), + (t.prototype.refreshBoundingInfo = function (e) { + if ( + (void 0 === e && (e = null), + (this._lastColliderWorldVertices = null), + this.IsGlobal || + !this._renderingMesh || + !this._renderingMesh.geometry) + ) + return this; + if ( + (e || + (e = this._renderingMesh.getVerticesData( + o.b.PositionKind + )), !e) - return this._boundingInfo = this._mesh.getBoundingInfo(), - this; - var t, i = this._renderingMesh.getIndices(); - if (0 === this.indexStart && this.indexCount === i.length) { - var n = this._renderingMesh.getBoundingInfo(); - t = { - minimum: n.minimum.clone(), - maximum: n.maximum.clone() - } - } else - t = r.h.ExtractMinAndMaxIndexed(e, i, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias); - return this._boundingInfo ? this._boundingInfo.reConstruct(t.minimum, t.maximum) : this._boundingInfo = new s.a(t.minimum,t.maximum), + ) + return ( + (this._boundingInfo = this._mesh.getBoundingInfo()), + this + ); + var t, + i = this._renderingMesh.getIndices(); + if ( + 0 === this.indexStart && + this.indexCount === i.length + ) { + var n = this._renderingMesh.getBoundingInfo(); + t = { + minimum: n.minimum.clone(), + maximum: n.maximum.clone(), + }; + } else + t = r.h.ExtractMinAndMaxIndexed( + e, + i, + this.indexStart, + this.indexCount, + this._renderingMesh.geometry.boundingBias + ); + return ( + this._boundingInfo + ? this._boundingInfo.reConstruct(t.minimum, t.maximum) + : (this._boundingInfo = new s.a( + t.minimum, + t.maximum + )), this - } - , - t.prototype._checkCollision = function(e) { - return this.getBoundingInfo()._checkCollision(e) - } - , - t.prototype.updateBoundingInfo = function(e) { - var t = this.getBoundingInfo(); - return t || (this.refreshBoundingInfo(), - t = this.getBoundingInfo()), + ); + }), + (t.prototype._checkCollision = function (e) { + return this.getBoundingInfo()._checkCollision(e); + }), + (t.prototype.updateBoundingInfo = function (e) { + var t = this.getBoundingInfo(); + return ( + t || + (this.refreshBoundingInfo(), + (t = this.getBoundingInfo())), t.update(e), this - } - , - t.prototype.isInFrustum = function(e) { - var t = this.getBoundingInfo(); - return !!t && t.isInFrustum(e, this._mesh.cullingStrategy) - } - , - t.prototype.isCompletelyInFrustum = function(e) { - var t = this.getBoundingInfo(); - return !!t && t.isCompletelyInFrustum(e) - } - , - t.prototype.render = function(e) { - return this._renderingMesh.render(this, e), - this - } - , - t.prototype._getLinesIndexBuffer = function(e, t) { - if (!this._linesIndexBuffer) { - for (var i = [], n = this.indexStart; n < this.indexStart + this.indexCount; n += 3) - i.push(e[n], e[n + 1], e[n + 1], e[n + 2], e[n + 2], e[n]); - this._linesIndexBuffer = t.createIndexBuffer(i), - this._linesIndexCount = i.length - } - return this._linesIndexBuffer - } - , - t.prototype.canIntersects = function(e) { - var t = this.getBoundingInfo(); - return !!t && e.intersectsBox(t.boundingBox) - } - , - t.prototype.intersects = function(e, t, i, n, r) { - var o = this.getMaterial(); - if (!o) - return null; - switch (o.fillMode) { + ); + }), + (t.prototype.isInFrustum = function (e) { + var t = this.getBoundingInfo(); + return ( + !!t && t.isInFrustum(e, this._mesh.cullingStrategy) + ); + }), + (t.prototype.isCompletelyInFrustum = function (e) { + var t = this.getBoundingInfo(); + return !!t && t.isCompletelyInFrustum(e); + }), + (t.prototype.render = function (e) { + return this._renderingMesh.render(this, e), this; + }), + (t.prototype._getLinesIndexBuffer = function (e, t) { + if (!this._linesIndexBuffer) { + for ( + var i = [], n = this.indexStart; + n < this.indexStart + this.indexCount; + n += 3 + ) + i.push( + e[n], + e[n + 1], + e[n + 1], + e[n + 2], + e[n + 2], + e[n] + ); + (this._linesIndexBuffer = t.createIndexBuffer(i)), + (this._linesIndexCount = i.length); + } + return this._linesIndexBuffer; + }), + (t.prototype.canIntersects = function (e) { + var t = this.getBoundingInfo(); + return !!t && e.intersectsBox(t.boundingBox); + }), + (t.prototype.intersects = function (e, t, i, n, r) { + var o = this.getMaterial(); + if (!o) return null; + switch (o.fillMode) { case c.a.MATERIAL_PointListDrawMode: case c.a.MATERIAL_LineListDrawMode: case c.a.MATERIAL_LineLoopDrawMode: case c.a.MATERIAL_LineStripDrawMode: case c.a.MATERIAL_TriangleFanDrawMode: case c.a.MATERIAL_TriangleStripDrawMode: - return null - } - return "InstancedLinesMesh" === this._mesh.getClassName() || "LinesMesh" === this._mesh.getClassName() ? i.length ? this._intersectLines(e, t, i, this._mesh.intersectionThreshold, n) : this._intersectUnIndexedLines(e, t, i, this._mesh.intersectionThreshold, n) : !i.length && this._mesh._unIndexed ? this._intersectUnIndexedTriangles(e, t, i, n, r) : this._intersectTriangles(e, t, i, n, r) - } - , - t.prototype._intersectLines = function(e, t, i, n, r) { - for (var o = null, s = this.indexStart; s < this.indexStart + this.indexCount; s += 2) { - var c = t[i[s]] - , u = t[i[s + 1]] - , l = e.intersectionSegment(c, u, n); - if (!(l < 0) && (r || !o || l < o.distance) && ((o = new a.a(null,null,l)).faceId = s / 2, - r)) - break - } - return o - } - , - t.prototype._intersectUnIndexedLines = function(e, t, i, n, r) { - for (var o = null, s = this.verticesStart; s < this.verticesStart + this.verticesCount; s += 2) { - var c = t[s] - , u = t[s + 1] - , l = e.intersectionSegment(c, u, n); - if (!(l < 0) && (r || !o || l < o.distance) && ((o = new a.a(null,null,l)).faceId = s / 2, - r)) - break - } - return o - } - , - t.prototype._intersectTriangles = function(e, t, i, n, r) { - for (var o = null, a = this.indexStart; a < this.indexStart + this.indexCount; a += 3) { - var s = t[i[a]] - , c = t[i[a + 1]] - , u = t[i[a + 2]]; - if (!r || r(s, c, u, e)) { - var l = e.intersectsTriangle(s, c, u); - if (l) { - if (l.distance < 0) - continue; - if ((n || !o || l.distance < o.distance) && ((o = l).faceId = a / 3, - n)) - break - } - } - } - return o - } - , - t.prototype._intersectUnIndexedTriangles = function(e, t, i, n, r) { - for (var o = null, a = this.verticesStart; a < this.verticesStart + this.verticesCount; a += 3) { - var s = t[a] - , c = t[a + 1] - , u = t[a + 2]; - if (!r || r(s, c, u, e)) { - var l = e.intersectsTriangle(s, c, u); - if (l) { - if (l.distance < 0) - continue; - if ((n || !o || l.distance < o.distance) && ((o = l).faceId = a / 3, - n)) - break - } - } - } - return o - } - , - t.prototype._rebuild = function() { - this._linesIndexBuffer && (this._linesIndexBuffer = null) - } - , - t.prototype.clone = function(e, i) { - var n = new t(this.materialIndex,this.verticesStart,this.verticesCount,this.indexStart,this.indexCount,e,i,false); - if (!this.IsGlobal) { - var r = this.getBoundingInfo(); - if (!r) - return n; - n._boundingInfo = new s.a(r.minimum,r.maximum) - } - return n - } - , - t.prototype.dispose = function() { - this._linesIndexBuffer && (this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer), - this._linesIndexBuffer = null); - var e = this._mesh.subMeshes.indexOf(this); - this._mesh.subMeshes.splice(e, 1) - } - , - t.prototype.getClassName = function() { - return "SubMesh" - } - , - t.CreateFromIndices = function(e, i, n, r, o) { - for (var a = Number.MAX_VALUE, s = -Number.MAX_VALUE, c = (o || r).getIndices(), u = i; u < i + n; u++) { - var l = c[u]; - l < a && (a = l), - l > s && (s = l) - } - return new t(e,a,s - a + 1,i,n,r,o) - } - , - t - }(u) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return o - }); - var n = i(0) - , r = i(4) - , o = function() { - function e() { - this._pickingUnavailable = false, - this.hit = false, - this.distance = 0, - this.pickedPoint = null, - this.pickedMesh = null, - this.bu = 0, - this.bv = 0, - this.faceId = -1, - this.subMeshId = 0, - this.pickedSprite = null, - this.originMesh = null, - this.ray = null - } - return e.prototype.getNormal = function(e, t) { - if (void 0 === e && (e = false), - void 0 === t && (t = true), - !this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(r.b.NormalKind)) - return null; - var i, o = this.pickedMesh.getIndices(); - if (!o) - return null; - if (t) { - var a = this.pickedMesh.getVerticesData(r.b.NormalKind) - , s = n.x.FromArray(a, 3 * o[3 * this.faceId]) - , c = n.x.FromArray(a, 3 * o[3 * this.faceId + 1]) - , u = n.x.FromArray(a, 3 * o[3 * this.faceId + 2]); - s = s.scale(this.bu), - c = c.scale(this.bv), - u = u.scale(1 - this.bu - this.bv), - i = new n.x(s.x + c.x + u.x,s.y + c.y + u.y,s.z + c.z + u.z) - } else { - var l = this.pickedMesh.getVerticesData(r.b.PositionKind) - , h = n.x.FromArray(l, 3 * o[3 * this.faceId]) - , f = n.x.FromArray(l, 3 * o[3 * this.faceId + 1]) - , d = n.x.FromArray(l, 3 * o[3 * this.faceId + 2]) - , p = h.subtract(f) - , m = d.subtract(f); - i = n.x.Cross(p, m) - } - if (e) { - var g = this.pickedMesh.getWorldMatrix(); - this.pickedMesh.nonUniformScaling && (n.t.Matrix[0].copyFrom(g), - (g = n.t.Matrix[0]).setTranslationFromFloats(0, 0, 0), - g.invert(), - g.transposeToRef(n.t.Matrix[1]), - g = n.t.Matrix[1]), - i = n.x.TransformNormal(i, g) - } - return i.normalize(), - i - } - , - e.prototype.getTextureCoordinates = function() { - if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(r.b.UVKind)) - return null; - var e = this.pickedMesh.getIndices(); - if (!e) - return null; - var t = this.pickedMesh.getVerticesData(r.b.UVKind); - if (!t) - return null; - var i = n.w.FromArray(t, 2 * e[3 * this.faceId]) - , o = n.w.FromArray(t, 2 * e[3 * this.faceId + 1]) - , a = n.w.FromArray(t, 2 * e[3 * this.faceId + 2]); - return i = i.scale(1 - this.bu - this.bv), - o = o.scale(this.bu), - a = a.scale(this.bv), - new n.w(i.x + o.x + a.x,i.y + o.y + a.y) - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }), - i.d(t, "b", function() { - return o - }), - i.d(t, "c", function() { - return a - }); - var n = i(1) - , r = function() { - function e() {} - return e.KEYDOWN = 1, - e.KEYUP = 2, - e - }() - , o = function(e, t) { - this.type = e, - this.event = t - } - , a = function(e) { - function t(t, i) { - var n = e.call(this, t, i) || this; - return n.type = t, - n.event = i, - n.skipOnPointerObservable = false, - n - } - return n.d(t, e), - t - }(o) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return a - }); - var n = i(0) - , r = i(11) - , o = i(13); - o.a.CreateBox = function(e) { - var t, i = [0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23], r = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0], a = [], s = e.width || e.size || 1, c = e.height || e.size || 1, u = e.depth || e.size || 1, l = e.wrap || false, h = void 0 === e.topBaseAt ? 1 : e.topBaseAt, f = void 0 === e.bottomBaseAt ? 0 : e.bottomBaseAt, d = [2, 0, 3, 1][h = (h + 4) % 4], p = [2, 0, 1, 3][f = (f + 4) % 4], m = [1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1]; - if (l) { - i = [2, 3, 0, 2, 0, 1, 4, 5, 6, 4, 6, 7, 9, 10, 11, 9, 11, 8, 12, 14, 15, 12, 13, 14], - m = [-1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1]; - for (var g = [[1, 1, 1], [-1, 1, 1], [-1, 1, -1], [1, 1, -1]], _ = [[-1, -1, 1], [1, -1, 1], [1, -1, -1], [-1, -1, -1]], v = [17, 18, 19, 16], y = [22, 23, 20, 21]; d > 0; ) - g.unshift(g.pop()), - v.unshift(v.pop()), - d--; - for (; p > 0; ) - _.unshift(_.pop()), - y.unshift(y.pop()), - p--; - g = g.flat(), - _ = _.flat(), - m = m.concat(g).concat(_), - i.push(v[0], v[2], v[3], v[0], v[1], v[2]), - i.push(y[0], y[2], y[3], y[0], y[1], y[2]) - } - var b = [s / 2, c / 2, u / 2]; - t = m.reduce(function(e, t, i) { - return e.concat(t * b[i % 3]) - }, []); - for (var E = 0 === e.sideOrientation ? 0 : e.sideOrientation || o.a.DEFAULTSIDE, T = e.faceUV || new Array(6), A = e.faceColors, x = [], S = 0; S < 6; S++) - void 0 === T[S] && (T[S] = new n.y(0,0,1,1)), - A && void 0 === A[S] && (A[S] = new n.f(1,1,1,1)); - for (var C = 0; C < 6; C++) - if (a.push(T[C].z, T[C].w), - a.push(T[C].x, T[C].w), - a.push(T[C].x, T[C].y), - a.push(T[C].z, T[C].y), - A) - for (var P = 0; P < 4; P++) - x.push(A[C].r, A[C].g, A[C].b, A[C].a); - o.a._ComputeSides(E, t, i, r, a, e.frontUVs, e.backUVs); - var R = new o.a; - if (R.indices = i, - R.positions = t, - R.normals = r, - R.uvs = a, - A) { - var M = E === o.a.DOUBLESIDE ? x.concat(x) : x; - R.colors = M - } - return R - } - , - r.a.CreateBox = function(e, t, i, n, r) { - void 0 === i && (i = null); - var o = { - size: t, - sideOrientation: r, - updatable: n - }; - return a.CreateBox(e, o, i) - } - ; - var a = function() { - function e() {} - return e.CreateBox = function(e, t, i) { - void 0 === i && (i = null); - var n = new r.a(e,i); - return t.sideOrientation = r.a._GetDefaultSideOrientation(t.sideOrientation), - n._originalBuilderSideOrientation = t.sideOrientation, - o.a.CreateBox(t).applyToMesh(n, t.updatable), - n - } - , - e - }() - } - , function(e, t, getterFunc) { - "use strict"; - getterFunc.d(t, "a", function() { - return s - }); - - var n = getterFunc(0) - var r = getterFunc(11) - var o = getterFunc(13) - var vec3Math = getterFunc(16); - - o.a.CreateCylinder = function(e) { - var t, i = e.height || 2, r = 0 === e.diameterTop ? 0 : e.diameterTop || e.diameter || 1, a = 0 === e.diameterBottom ? 0 : e.diameterBottom || e.diameter || 1, s = e.tessellation || 24, c = e.subdivisions || 1, u = !!e.hasRings, l = !!e.enclose, h = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1, f = 0 === e.sideOrientation ? 0 : e.sideOrientation || o.a.DEFAULTSIDE, d = e.faceUV || new Array(3), p = e.faceColors, m = 2 + (1 + (1 !== h && l ? 2 : 0)) * (u ? c : 1); - for (t = 0; t < m; t++) - p && void 0 === p[t] && (p[t] = new n.f(1,1,1,1)); - for (t = 0; t < m; t++) - d && void 0 === d[t] && (d[t] = new n.y(0,0,1,1)); - var g, _, v, y, b, E, T = new Array, A = new Array, x = new Array, S = new Array, C = new Array, P = 2 * Math.PI * h / s, R = (a - r) / 2 / i, M = n.x.Zero(), O = n.x.Zero(), w = n.x.Zero(), I = n.x.Zero(), D = n.x.Zero(), L = n.c.Y, F = 1, B = 1, N = 0, k = 0; - for (y = 0; y <= c; y++) - for (v = ((_ = y / c) * (r - a) + a) / 2, - F = u && 0 !== y && y !== c ? 2 : 1, - E = 0; E < F; E++) { - for (u && (B += E), - l && (B += 2 * E), - b = 0; b <= s; b++) - g = b * P, - M.x = Math.cos(-g) * v, - M.y = -i / 2 + _ * i, - M.z = Math.sin(-g) * v, - 0 === r && y === c ? (O.x = x[x.length - 3 * (s + 1)], - O.y = x[x.length - 3 * (s + 1) + 1], - O.z = x[x.length - 3 * (s + 1) + 2]) : (O.x = M.x, - O.z = M.z, - O.y = Math.sqrt(O.x * O.x + O.z * O.z) * R, - O.normalize()), - 0 === b && (w.copyFrom(M), - I.copyFrom(O)), - A.push(M.x, M.y, M.z), - x.push(O.x, O.y, O.z), - k = u ? N !== B ? d[B].y : d[B].w : d[B].y + (d[B].w - d[B].y) * _, - S.push(d[B].x + (d[B].z - d[B].x) * b / s, k), - p && C.push(p[B].r, p[B].g, p[B].b, p[B].a); - 1 !== h && l && (A.push(M.x, M.y, M.z), - A.push(0, M.y, 0), - A.push(0, M.y, 0), - A.push(w.x, w.y, w.z), - n.x.CrossToRef(L, O, D), - D.normalize(), - x.push(D.x, D.y, D.z, D.x, D.y, D.z), - n.x.CrossToRef(I, L, D), - D.normalize(), - x.push(D.x, D.y, D.z, D.x, D.y, D.z), - k = u ? N !== B ? d[B + 1].y : d[B + 1].w : d[B + 1].y + (d[B + 1].w - d[B + 1].y) * _, - S.push(d[B + 1].x, k), - S.push(d[B + 1].z, k), - k = u ? N !== B ? d[B + 2].y : d[B + 2].w : d[B + 2].y + (d[B + 2].w - d[B + 2].y) * _, - S.push(d[B + 2].x, k), - S.push(d[B + 2].z, k), - p && (C.push(p[B + 1].r, p[B + 1].g, p[B + 1].b, p[B + 1].a), - C.push(p[B + 1].r, p[B + 1].g, p[B + 1].b, p[B + 1].a), - C.push(p[B + 2].r, p[B + 2].g, p[B + 2].b, p[B + 2].a), - C.push(p[B + 2].r, p[B + 2].g, p[B + 2].b, p[B + 2].a))), - N !== B && (N = B) - } - var U = 1 !== h && l ? s + 4 : s; - for (y = 0, - B = 0; B < c; B++) { - var V = 0 - , G = 0 - , z = 0 - , j = 0; - for (b = 0; b < s; b++) - V = y * (U + 1) + b, - G = (y + 1) * (U + 1) + b, - z = y * (U + 1) + (b + 1), - j = (y + 1) * (U + 1) + (b + 1), - T.push(V, G, z), - T.push(j, z, G); - 1 !== h && l && (T.push(V + 2, G + 2, z + 2), - T.push(j + 2, z + 2, G + 2), - T.push(V + 4, G + 4, z + 4), - T.push(j + 4, z + 4, G + 4)), - y = u ? y + 2 : y + 1 - } - var H = function(e) { - var t = e ? r / 2 : a / 2; - if (0 !== t) { - var o, c, u, l = e ? d[m - 1] : d[0], f = null; - p && (f = e ? p[m - 1] : p[0]); - var g = A.length / 3 - , _ = e ? i / 2 : -i / 2 - , v = new n.x(0,_,0); - A.push(v.x, v.y, v.z), - x.push(0, e ? 1 : -1, 0), - S.push(l.x + .5 * (l.z - l.x), l.y + .5 * (l.w - l.y)), - f && C.push(f.r, f.g, f.b, f.a); - var y = new n.w(.5,.5); - for (u = 0; u <= s; u++) { - o = 2 * Math.PI * u * h / s; - var b = Math.cos(-o) - , E = Math.sin(-o); - c = new n.x(b * t,_,E * t); - var P = new n.w(b * y.x + .5,E * y.y + .5); - A.push(c.x, c.y, c.z), - x.push(0, e ? 1 : -1, 0), - S.push(l.x + (l.z - l.x) * P.x, l.y + (l.w - l.y) * P.y), - f && C.push(f.r, f.g, f.b, f.a) - } - for (u = 0; u < s; u++) - e ? (T.push(g), - T.push(g + (u + 2)), - T.push(g + (u + 1))) : (T.push(g), - T.push(g + (u + 1)), - T.push(g + (u + 2))) - } - }; - H(false), - H(true), - o.a._ComputeSides(f, A, T, x, S, e.frontUVs, e.backUVs); - var W = new o.a; - return W.indices = T, - W.positions = A, - W.normals = x, - W.uvs = S, - p && (W.colors = C), - W - } - , - r.a.CreateCylinder = function(e, t, i, n, o, c, u, l, h) { - void 0 !== u && u instanceof vec3Math.a || (void 0 !== u && (h = l || r.a.DEFAULTSIDE, - l = u), - u = c, - c = 1); - var f = { - height: t, - diameterTop: i, - diameterBottom: n, - tessellation: o, - subdivisions: c, - sideOrientation: h, - updatable: l - }; - return s.CreateCylinder(e, f, u) - } - ; - var s = function() { - function e() {} - return e.CreateCylinder = function(e, t, i) { - var n = new r.a(e,i); - return t.sideOrientation = r.a._GetDefaultSideOrientation(t.sideOrientation), - n._originalBuilderSideOrientation = t.sideOrientation, - o.a.CreateCylinder(t).applyToMesh(n, t.updatable), - n - } - , - e - }() - } - , function(e, t, getterFunc) { - "use strict"; - getterFunc.d(t, "a", function() { - return l - }); - var n = getterFunc(11); - var vec3Math = getterFunc(16); - var o = getterFunc(8); - var a = getterFunc(0); - var s = getterFunc(17); - var c = getterFunc(39); - var u = getterFunc(45); - - var l = (getterFunc(80), - function() { - function e(e) { - this._useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1, - this.maxDragAngle = 0, - this._useAlternatePickedPointAboveMaxDragAngle = false, - this.currentDraggingPointerID = -1, - this.dragging = false, - this.dragDeltaRatio = .2, - this.updateDragPlane = true, - this._debugMode = false, - this._moving = false, - this.onDragObservable = new o.c, - this.onDragStartObservable = new o.c, - this.onDragEndObservable = new o.c, - this.moveAttached = true, - this.enabled = true, - this.detachCameraControls = true, - this.useObjectOrienationForDragging = true, - this.validateDrag = function(e) { - return true - } - , - this._tmpVector = new a.x(0,0,0), - this._alternatePickedPoint = new a.x(0,0,0), - this._worldDragAxis = new a.x(0,0,0), - this._targetPosition = new a.x(0,0,0), - this._attachedElement = null, - this._startDragRay = new c.a(new a.x,new a.x), - this._lastPointerRay = {}, - this._dragDelta = new a.x, - this._pointA = new a.x(0,0,0), - this._pointB = new a.x(0,0,0), - this._pointC = new a.x(0,0,0), - this._lineA = new a.x(0,0,0), - this._lineB = new a.x(0,0,0), - this._localAxis = new a.x(0,0,0), - this._lookAt = new a.x(0,0,0), - this._options = e || {}; - var t = 0; - if (this._options.dragAxis && t++, - this._options.dragPlaneNormal && t++, - t > 1) - throw "Multiple drag modes specified in dragBehavior options. Only one expected" - } - return Object.defineProperty(e.prototype, "name", { - get: function() { - return "PointerDrag" - }, - enumerable: true, - configurable: true + return null; + } + return "InstancedLinesMesh" === + this._mesh.getClassName() || + "LinesMesh" === this._mesh.getClassName() + ? i.length + ? this._intersectLines( + e, + t, + i, + this._mesh.intersectionThreshold, + n + ) + : this._intersectUnIndexedLines( + e, + t, + i, + this._mesh.intersectionThreshold, + n + ) + : !i.length && this._mesh._unIndexed + ? this._intersectUnIndexedTriangles(e, t, i, n, r) + : this._intersectTriangles(e, t, i, n, r); }), - e.prototype.init = function() {} - , - e.prototype.attach = function(t) { - var i = this; - this._scene = t.getScene(), - this._attachedNode = t, - e._planeScene || (this._debugMode ? e._planeScene = this._scene : (e._planeScene = new vec3Math.a(this._scene.getEngine(),{ - virtual: true - }), - e._planeScene.detachControl(), - this._scene.onDisposeObservable.addOnce(function() { - e._planeScene.dispose(), - e._planeScene = null - }))), - this._dragPlane = n.a.CreatePlane("pointerDragPlane", this._debugMode ? 1 : 1e4, e._planeScene, false, n.a.DOUBLESIDE), - this.lastDragPosition = new a.x(0,0,0), - this._pointerObserver = this._scene.onPointerObservable.add(function(t, n) { + (t.prototype._intersectLines = function (e, t, i, n, r) { + for ( + var o = null, s = this.indexStart; + s < this.indexStart + this.indexCount; + s += 2 + ) { + var c = t[i[s]], + u = t[i[s + 1]], + l = e.intersectionSegment(c, u, n); + if ( + !(l < 0) && + (r || !o || l < o.distance) && + (((o = new a.a(null, null, l)).faceId = s / 2), r) + ) + break; + } + return o; + }), + (t.prototype._intersectUnIndexedLines = function ( + e, + t, + i, + n, + r + ) { + for ( + var o = null, s = this.verticesStart; + s < this.verticesStart + this.verticesCount; + s += 2 + ) { + var c = t[s], + u = t[s + 1], + l = e.intersectionSegment(c, u, n); + if ( + !(l < 0) && + (r || !o || l < o.distance) && + (((o = new a.a(null, null, l)).faceId = s / 2), r) + ) + break; + } + return o; + }), + (t.prototype._intersectTriangles = function ( + e, + t, + i, + n, + r + ) { + for ( + var o = null, a = this.indexStart; + a < this.indexStart + this.indexCount; + a += 3 + ) { + var s = t[i[a]], + c = t[i[a + 1]], + u = t[i[a + 2]]; + if (!r || r(s, c, u, e)) { + var l = e.intersectsTriangle(s, c, u); + if (l) { + if (l.distance < 0) continue; + if ( + (n || !o || l.distance < o.distance) && + (((o = l).faceId = a / 3), n) + ) + break; + } + } + } + return o; + }), + (t.prototype._intersectUnIndexedTriangles = function ( + e, + t, + i, + n, + r + ) { + for ( + var o = null, a = this.verticesStart; + a < this.verticesStart + this.verticesCount; + a += 3 + ) { + var s = t[a], + c = t[a + 1], + u = t[a + 2]; + if (!r || r(s, c, u, e)) { + var l = e.intersectsTriangle(s, c, u); + if (l) { + if (l.distance < 0) continue; + if ( + (n || !o || l.distance < o.distance) && + (((o = l).faceId = a / 3), n) + ) + break; + } + } + } + return o; + }), + (t.prototype._rebuild = function () { + this._linesIndexBuffer && (this._linesIndexBuffer = null); + }), + (t.prototype.clone = function (e, i) { + var n = new t( + this.materialIndex, + this.verticesStart, + this.verticesCount, + this.indexStart, + this.indexCount, + e, + i, + false + ); + if (!this.IsGlobal) { + var r = this.getBoundingInfo(); + if (!r) return n; + n._boundingInfo = new s.a(r.minimum, r.maximum); + } + return n; + }), + (t.prototype.dispose = function () { + this._linesIndexBuffer && + (this._mesh + .getScene() + .getEngine() + ._releaseBuffer(this._linesIndexBuffer), + (this._linesIndexBuffer = null)); + var e = this._mesh.subMeshes.indexOf(this); + this._mesh.subMeshes.splice(e, 1); + }), + (t.prototype.getClassName = function () { + return "SubMesh"; + }), + (t.CreateFromIndices = function (e, i, n, r, o) { + for ( + var a = Number.MAX_VALUE, + s = -Number.MAX_VALUE, + c = (o || r).getIndices(), + u = i; + u < i + n; + u++ + ) { + var l = c[u]; + l < a && (a = l), l > s && (s = l); + } + return new t(e, a, s - a + 1, i, n, r, o); + }), + t + ); + })(u); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return o; + }); + var n = i(0), + r = i(4), + o = (function () { + function e() { + (this._pickingUnavailable = false), + (this.hit = false), + (this.distance = 0), + (this.pickedPoint = null), + (this.pickedMesh = null), + (this.bu = 0), + (this.bv = 0), + (this.faceId = -1), + (this.subMeshId = 0), + (this.pickedSprite = null), + (this.originMesh = null), + (this.ray = null); + } + return ( + (e.prototype.getNormal = function (e, t) { + if ( + (void 0 === e && (e = false), + void 0 === t && (t = true), + !this.pickedMesh || + !this.pickedMesh.isVerticesDataPresent( + r.b.NormalKind + )) + ) + return null; + var i, + o = this.pickedMesh.getIndices(); + if (!o) return null; + if (t) { + var a = this.pickedMesh.getVerticesData(r.b.NormalKind), + s = n.x.FromArray(a, 3 * o[3 * this.faceId]), + c = n.x.FromArray(a, 3 * o[3 * this.faceId + 1]), + u = n.x.FromArray(a, 3 * o[3 * this.faceId + 2]); + (s = s.scale(this.bu)), + (c = c.scale(this.bv)), + (u = u.scale(1 - this.bu - this.bv)), + (i = new n.x( + s.x + c.x + u.x, + s.y + c.y + u.y, + s.z + c.z + u.z + )); + } else { + var l = this.pickedMesh.getVerticesData( + r.b.PositionKind + ), + h = n.x.FromArray(l, 3 * o[3 * this.faceId]), + f = n.x.FromArray(l, 3 * o[3 * this.faceId + 1]), + d = n.x.FromArray(l, 3 * o[3 * this.faceId + 2]), + p = h.subtract(f), + m = d.subtract(f); + i = n.x.Cross(p, m); + } + if (e) { + var g = this.pickedMesh.getWorldMatrix(); + this.pickedMesh.nonUniformScaling && + (n.t.Matrix[0].copyFrom(g), + (g = n.t.Matrix[0]).setTranslationFromFloats(0, 0, 0), + g.invert(), + g.transposeToRef(n.t.Matrix[1]), + (g = n.t.Matrix[1])), + (i = n.x.TransformNormal(i, g)); + } + return i.normalize(), i; + }), + (e.prototype.getTextureCoordinates = function () { + if ( + !this.pickedMesh || + !this.pickedMesh.isVerticesDataPresent(r.b.UVKind) + ) + return null; + var e = this.pickedMesh.getIndices(); + if (!e) return null; + var t = this.pickedMesh.getVerticesData(r.b.UVKind); + if (!t) return null; + var i = n.w.FromArray(t, 2 * e[3 * this.faceId]), + o = n.w.FromArray(t, 2 * e[3 * this.faceId + 1]), + a = n.w.FromArray(t, 2 * e[3 * this.faceId + 2]); + return ( + (i = i.scale(1 - this.bu - this.bv)), + (o = o.scale(this.bu)), + (a = a.scale(this.bv)), + new n.w(i.x + o.x + a.x, i.y + o.y + a.y) + ); + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }), + i.d(t, "b", function () { + return o; + }), + i.d(t, "c", function () { + return a; + }); + var n = i(1), + r = (function () { + function e() {} + return (e.KEYDOWN = 1), (e.KEYUP = 2), e; + })(), + o = function (e, t) { + (this.type = e), (this.event = t); + }, + a = (function (e) { + function t(t, i) { + var n = e.call(this, t, i) || this; + return ( + (n.type = t), + (n.event = i), + (n.skipOnPointerObservable = false), + n + ); + } + return n.d(t, e), t; + })(o); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return a; + }); + var n = i(0), + r = i(11), + o = i(13); + (o.a.CreateBox = function (e) { + var t, + i = [ + 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, + 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, + 22, 23, + ], + r = [ + 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, + 0, -1, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, + 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, + 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, + ], + a = [], + s = e.width || e.size || 1, + c = e.height || e.size || 1, + u = e.depth || e.size || 1, + l = e.wrap || false, + h = void 0 === e.topBaseAt ? 1 : e.topBaseAt, + f = void 0 === e.bottomBaseAt ? 0 : e.bottomBaseAt, + d = [2, 0, 3, 1][(h = (h + 4) % 4)], + p = [2, 0, 1, 3][(f = (f + 4) % 4)], + m = [ + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, + -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, + 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, + 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, + -1, -1, 1, + ]; + if (l) { + (i = [ + 2, 3, 0, 2, 0, 1, 4, 5, 6, 4, 6, 7, 9, 10, 11, 9, 11, 8, 12, + 14, 15, 12, 13, 14, + ]), + (m = [ + -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, + -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, + 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, + ]); + for ( + var g = [ + [1, 1, 1], + [-1, 1, 1], + [-1, 1, -1], + [1, 1, -1], + ], + _ = [ + [-1, -1, 1], + [1, -1, 1], + [1, -1, -1], + [-1, -1, -1], + ], + v = [17, 18, 19, 16], + y = [22, 23, 20, 21]; + d > 0; + + ) + g.unshift(g.pop()), v.unshift(v.pop()), d--; + for (; p > 0; ) _.unshift(_.pop()), y.unshift(y.pop()), p--; + (g = g.flat()), + (_ = _.flat()), + (m = m.concat(g).concat(_)), + i.push(v[0], v[2], v[3], v[0], v[1], v[2]), + i.push(y[0], y[2], y[3], y[0], y[1], y[2]); + } + var b = [s / 2, c / 2, u / 2]; + t = m.reduce(function (e, t, i) { + return e.concat(t * b[i % 3]); + }, []); + for ( + var E = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || o.a.DEFAULTSIDE, + T = e.faceUV || new Array(6), + A = e.faceColors, + x = [], + S = 0; + S < 6; + S++ + ) + void 0 === T[S] && (T[S] = new n.y(0, 0, 1, 1)), + A && void 0 === A[S] && (A[S] = new n.f(1, 1, 1, 1)); + for (var C = 0; C < 6; C++) + if ( + (a.push(T[C].z, T[C].w), + a.push(T[C].x, T[C].w), + a.push(T[C].x, T[C].y), + a.push(T[C].z, T[C].y), + A) + ) + for (var P = 0; P < 4; P++) + x.push(A[C].r, A[C].g, A[C].b, A[C].a); + o.a._ComputeSides(E, t, i, r, a, e.frontUVs, e.backUVs); + var R = new o.a(); + if ( + ((R.indices = i), + (R.positions = t), + (R.normals = r), + (R.uvs = a), + A) + ) { + var M = E === o.a.DOUBLESIDE ? x.concat(x) : x; + R.colors = M; + } + return R; + }), + (r.a.CreateBox = function (e, t, i, n, r) { + void 0 === i && (i = null); + var o = { + size: t, + sideOrientation: r, + updatable: n, + }; + return a.CreateBox(e, o, i); + }); + var a = (function () { + function e() {} + return ( + (e.CreateBox = function (e, t, i) { + void 0 === i && (i = null); + var n = new r.a(e, i); + return ( + (t.sideOrientation = r.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (n._originalBuilderSideOrientation = t.sideOrientation), + o.a.CreateBox(t).applyToMesh(n, t.updatable), + n + ); + }), + e + ); + })(); + }, + function (e, t, getterFunc) { + "use strict"; + getterFunc.d(t, "a", function () { + return s; + }); + + var n = getterFunc(0); + var r = getterFunc(11); + var o = getterFunc(13); + var vec3Math = getterFunc(16); + + (o.a.CreateCylinder = function (e) { + var t, + i = e.height || 2, + r = + 0 === e.diameterTop ? 0 : e.diameterTop || e.diameter || 1, + a = + 0 === e.diameterBottom + ? 0 + : e.diameterBottom || e.diameter || 1, + s = e.tessellation || 24, + c = e.subdivisions || 1, + u = !!e.hasRings, + l = !!e.enclose, + h = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1, + f = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || o.a.DEFAULTSIDE, + d = e.faceUV || new Array(3), + p = e.faceColors, + m = 2 + (1 + (1 !== h && l ? 2 : 0)) * (u ? c : 1); + for (t = 0; t < m; t++) + p && void 0 === p[t] && (p[t] = new n.f(1, 1, 1, 1)); + for (t = 0; t < m; t++) + d && void 0 === d[t] && (d[t] = new n.y(0, 0, 1, 1)); + var g, + _, + v, + y, + b, + E, + T = new Array(), + A = new Array(), + x = new Array(), + S = new Array(), + C = new Array(), + P = (2 * Math.PI * h) / s, + R = (a - r) / 2 / i, + M = n.x.Zero(), + O = n.x.Zero(), + w = n.x.Zero(), + I = n.x.Zero(), + D = n.x.Zero(), + L = n.c.Y, + F = 1, + B = 1, + N = 0, + k = 0; + for (y = 0; y <= c; y++) + for ( + v = ((_ = y / c) * (r - a) + a) / 2, + F = u && 0 !== y && y !== c ? 2 : 1, + E = 0; + E < F; + E++ + ) { + for (u && (B += E), l && (B += 2 * E), b = 0; b <= s; b++) + (g = b * P), + (M.x = Math.cos(-g) * v), + (M.y = -i / 2 + _ * i), + (M.z = Math.sin(-g) * v), + 0 === r && y === c + ? ((O.x = x[x.length - 3 * (s + 1)]), + (O.y = x[x.length - 3 * (s + 1) + 1]), + (O.z = x[x.length - 3 * (s + 1) + 2])) + : ((O.x = M.x), + (O.z = M.z), + (O.y = Math.sqrt(O.x * O.x + O.z * O.z) * R), + O.normalize()), + 0 === b && (w.copyFrom(M), I.copyFrom(O)), + A.push(M.x, M.y, M.z), + x.push(O.x, O.y, O.z), + (k = u + ? N !== B + ? d[B].y + : d[B].w + : d[B].y + (d[B].w - d[B].y) * _), + S.push(d[B].x + ((d[B].z - d[B].x) * b) / s, k), + p && C.push(p[B].r, p[B].g, p[B].b, p[B].a); + 1 !== h && + l && + (A.push(M.x, M.y, M.z), + A.push(0, M.y, 0), + A.push(0, M.y, 0), + A.push(w.x, w.y, w.z), + n.x.CrossToRef(L, O, D), + D.normalize(), + x.push(D.x, D.y, D.z, D.x, D.y, D.z), + n.x.CrossToRef(I, L, D), + D.normalize(), + x.push(D.x, D.y, D.z, D.x, D.y, D.z), + (k = u + ? N !== B + ? d[B + 1].y + : d[B + 1].w + : d[B + 1].y + (d[B + 1].w - d[B + 1].y) * _), + S.push(d[B + 1].x, k), + S.push(d[B + 1].z, k), + (k = u + ? N !== B + ? d[B + 2].y + : d[B + 2].w + : d[B + 2].y + (d[B + 2].w - d[B + 2].y) * _), + S.push(d[B + 2].x, k), + S.push(d[B + 2].z, k), + p && + (C.push(p[B + 1].r, p[B + 1].g, p[B + 1].b, p[B + 1].a), + C.push(p[B + 1].r, p[B + 1].g, p[B + 1].b, p[B + 1].a), + C.push(p[B + 2].r, p[B + 2].g, p[B + 2].b, p[B + 2].a), + C.push( + p[B + 2].r, + p[B + 2].g, + p[B + 2].b, + p[B + 2].a + ))), + N !== B && (N = B); + } + var U = 1 !== h && l ? s + 4 : s; + for (y = 0, B = 0; B < c; B++) { + var V = 0, + G = 0, + z = 0, + j = 0; + for (b = 0; b < s; b++) + (V = y * (U + 1) + b), + (G = (y + 1) * (U + 1) + b), + (z = y * (U + 1) + (b + 1)), + (j = (y + 1) * (U + 1) + (b + 1)), + T.push(V, G, z), + T.push(j, z, G); + 1 !== h && + l && + (T.push(V + 2, G + 2, z + 2), + T.push(j + 2, z + 2, G + 2), + T.push(V + 4, G + 4, z + 4), + T.push(j + 4, z + 4, G + 4)), + (y = u ? y + 2 : y + 1); + } + var H = function (e) { + var t = e ? r / 2 : a / 2; + if (0 !== t) { + var o, + c, + u, + l = e ? d[m - 1] : d[0], + f = null; + p && (f = e ? p[m - 1] : p[0]); + var g = A.length / 3, + _ = e ? i / 2 : -i / 2, + v = new n.x(0, _, 0); + A.push(v.x, v.y, v.z), + x.push(0, e ? 1 : -1, 0), + S.push(l.x + 0.5 * (l.z - l.x), l.y + 0.5 * (l.w - l.y)), + f && C.push(f.r, f.g, f.b, f.a); + var y = new n.w(0.5, 0.5); + for (u = 0; u <= s; u++) { + o = (2 * Math.PI * u * h) / s; + var b = Math.cos(-o), + E = Math.sin(-o); + c = new n.x(b * t, _, E * t); + var P = new n.w(b * y.x + 0.5, E * y.y + 0.5); + A.push(c.x, c.y, c.z), + x.push(0, e ? 1 : -1, 0), + S.push( + l.x + (l.z - l.x) * P.x, + l.y + (l.w - l.y) * P.y + ), + f && C.push(f.r, f.g, f.b, f.a); + } + for (u = 0; u < s; u++) + e + ? (T.push(g), T.push(g + (u + 2)), T.push(g + (u + 1))) + : (T.push(g), T.push(g + (u + 1)), T.push(g + (u + 2))); + } + }; + H(false), + H(true), + o.a._ComputeSides(f, A, T, x, S, e.frontUVs, e.backUVs); + var W = new o.a(); + return ( + (W.indices = T), + (W.positions = A), + (W.normals = x), + (W.uvs = S), + p && (W.colors = C), + W + ); + }), + (r.a.CreateCylinder = function (e, t, i, n, o, c, u, l, h) { + (void 0 !== u && u instanceof vec3Math.a) || + (void 0 !== u && ((h = l || r.a.DEFAULTSIDE), (l = u)), + (u = c), + (c = 1)); + var f = { + height: t, + diameterTop: i, + diameterBottom: n, + tessellation: o, + subdivisions: c, + sideOrientation: h, + updatable: l, + }; + return s.CreateCylinder(e, f, u); + }); + var s = (function () { + function e() {} + return ( + (e.CreateCylinder = function (e, t, i) { + var n = new r.a(e, i); + return ( + (t.sideOrientation = r.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (n._originalBuilderSideOrientation = t.sideOrientation), + o.a.CreateCylinder(t).applyToMesh(n, t.updatable), + n + ); + }), + e + ); + })(); + }, + function (e, t, getterFunc) { + "use strict"; + getterFunc.d(t, "a", function () { + return l; + }); + var n = getterFunc(11); + var vec3Math = getterFunc(16); + var o = getterFunc(8); + var a = getterFunc(0); + var s = getterFunc(17); + var c = getterFunc(39); + var u = getterFunc(45); + + var l = + (getterFunc(80), + (function () { + function e(e) { + (this._useAlternatePickedPointAboveMaxDragAngleDragSpeed = + -1.1), + (this.maxDragAngle = 0), + (this._useAlternatePickedPointAboveMaxDragAngle = false), + (this.currentDraggingPointerID = -1), + (this.dragging = false), + (this.dragDeltaRatio = 0.2), + (this.updateDragPlane = true), + (this._debugMode = false), + (this._moving = false), + (this.onDragObservable = new o.c()), + (this.onDragStartObservable = new o.c()), + (this.onDragEndObservable = new o.c()), + (this.moveAttached = true), + (this.enabled = true), + (this.detachCameraControls = true), + (this.useObjectOrienationForDragging = true), + (this.validateDrag = function (e) { + return true; + }), + (this._tmpVector = new a.x(0, 0, 0)), + (this._alternatePickedPoint = new a.x(0, 0, 0)), + (this._worldDragAxis = new a.x(0, 0, 0)), + (this._targetPosition = new a.x(0, 0, 0)), + (this._attachedElement = null), + (this._startDragRay = new c.a(new a.x(), new a.x())), + (this._lastPointerRay = {}), + (this._dragDelta = new a.x()), + (this._pointA = new a.x(0, 0, 0)), + (this._pointB = new a.x(0, 0, 0)), + (this._pointC = new a.x(0, 0, 0)), + (this._lineA = new a.x(0, 0, 0)), + (this._lineB = new a.x(0, 0, 0)), + (this._localAxis = new a.x(0, 0, 0)), + (this._lookAt = new a.x(0, 0, 0)), + (this._options = e || {}); + var t = 0; + if ( + (this._options.dragAxis && t++, + this._options.dragPlaneNormal && t++, + t > 1) + ) + throw "Multiple drag modes specified in dragBehavior options. Only one expected"; + } + return ( + Object.defineProperty(e.prototype, "name", { + get: function () { + return "PointerDrag"; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.init = function () {}), + (e.prototype.attach = function (t) { + var i = this; + (this._scene = t.getScene()), + (this._attachedNode = t), + e._planeScene || + (this._debugMode + ? (e._planeScene = this._scene) + : ((e._planeScene = new vec3Math.a( + this._scene.getEngine(), + { + virtual: true, + } + )), + e._planeScene.detachControl(), + this._scene.onDisposeObservable.addOnce( + function () { + e._planeScene.dispose(), + (e._planeScene = null); + } + ))), + (this._dragPlane = n.a.CreatePlane( + "pointerDragPlane", + this._debugMode ? 1 : 1e4, + e._planeScene, + false, + n.a.DOUBLESIDE + )), + (this.lastDragPosition = new a.x(0, 0, 0)), + (this._pointerObserver = + this._scene.onPointerObservable.add(function (t, n) { var r; if (i.enabled) - if (t.type == s.a.POINTERDOWN) - !i.dragging && t.pickInfo && t.pickInfo.hit && t.pickInfo.pickedMesh && t.pickInfo.pickedPoint && t.pickInfo.ray && (r = t.pickInfo.pickedMesh, - i._attachedNode == r || r.isDescendantOf(i._attachedNode)) && i._startDrag(t.event.pointerId, t.pickInfo.ray, t.pickInfo.pickedPoint); - else if (t.type == s.a.POINTERUP) - i.currentDraggingPointerID == t.event.pointerId && i.releaseDrag(); - else if (t.type == s.a.POINTERMOVE) { - var o = t.event.pointerId; - i.currentDraggingPointerID === e._AnyMouseID && o !== e._AnyMouseID && "mouse" == t.event.pointerType && (i._lastPointerRay[i.currentDraggingPointerID] && (i._lastPointerRay[o] = i._lastPointerRay[i.currentDraggingPointerID], - delete i._lastPointerRay[i.currentDraggingPointerID]), - i.currentDraggingPointerID = o), - i._lastPointerRay[o] || (i._lastPointerRay[o] = new c.a(new a.x,new a.x)), - t.pickInfo && t.pickInfo.ray && (i._lastPointerRay[o].origin.copyFrom(t.pickInfo.ray.origin), - i._lastPointerRay[o].direction.copyFrom(t.pickInfo.ray.direction), - i.currentDraggingPointerID == o && i.dragging && i._moveDrag(t.pickInfo.ray)) - } - }), - this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(function() { - i._moving && i.moveAttached && (u.a._RemoveAndStorePivotPoint(i._attachedNode), - i._targetPosition.subtractToRef(i._attachedNode.absolutePosition, i._tmpVector), - i._tmpVector.scaleInPlace(i.dragDeltaRatio), - i._attachedNode.getAbsolutePosition().addToRef(i._tmpVector, i._tmpVector), - i.validateDrag(i._tmpVector) && i._attachedNode.setAbsolutePosition(i._tmpVector), - u.a._RestorePivotPoint(i._attachedNode)) - }) - } - , - e.prototype.releaseDrag = function() { - this.dragging = false, - this.onDragEndObservable.notifyObservers({ - dragPlanePoint: this.lastDragPosition, - pointerId: this.currentDraggingPointerID - }), - this.currentDraggingPointerID = -1, - this._moving = false, - this.detachCameraControls && this._attachedElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera && this._scene.activeCamera.attachControl(this._attachedElement, true) - } - , - e.prototype.startDrag = function(t, i, n) { - void 0 === t && (t = e._AnyMouseID), - this._startDrag(t, i, n); - var r = this._lastPointerRay[t]; - t === e._AnyMouseID && (r = this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]), - r && this._moveDrag(r) - } - , - e.prototype._startDrag = function(e, t, i) { - if (this._scene.activeCamera && !this.dragging && this._attachedNode) { - u.a._RemoveAndStorePivotPoint(this._attachedNode), - t ? (this._startDragRay.direction.copyFrom(t.direction), - this._startDragRay.origin.copyFrom(t.origin)) : (this._startDragRay.origin.copyFrom(this._scene.activeCamera.position), - this._attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector), - this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction)), - this._updateDragPlanePosition(this._startDragRay, i || this._tmpVector); - var n = this._pickWithRayOnDragPlane(this._startDragRay); - n && (this.dragging = true, - this.currentDraggingPointerID = e, - this.lastDragPosition.copyFrom(n), - this.onDragStartObservable.notifyObservers({ - dragPlanePoint: n, - pointerId: this.currentDraggingPointerID - }), - this._targetPosition.copyFrom(this._attachedNode.absolutePosition), - this.detachCameraControls && this._scene.activeCamera && !this._scene.activeCamera.leftCamera && (this._scene.activeCamera.inputs.attachedElement ? (this._attachedElement = this._scene.activeCamera.inputs.attachedElement, - this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement)) : this._attachedElement = null)), - u.a._RestorePivotPoint(this._attachedNode) - } - } - , - e.prototype._moveDrag = function(e) { - this._moving = true; - var t = this._pickWithRayOnDragPlane(e); - if (t) { - this.updateDragPlane && this._updateDragPlanePosition(e, t); - var i = 0; - this._options.dragAxis ? (a.x.TransformCoordinatesToRef(this._options.dragAxis, this._attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis), - t.subtractToRef(this.lastDragPosition, this._tmpVector), - i = a.x.Dot(this._tmpVector, this._worldDragAxis), - this._worldDragAxis.scaleToRef(i, this._dragDelta)) : (i = this._dragDelta.length(), - t.subtractToRef(this.lastDragPosition, this._dragDelta)), - this._targetPosition.addInPlace(this._dragDelta), - this.onDragObservable.notifyObservers({ - dragDistance: i, - delta: this._dragDelta, - dragPlanePoint: t, - dragPlaneNormal: this._dragPlane.forward, - pointerId: this.currentDraggingPointerID - }), - this.lastDragPosition.copyFrom(t) - } - } - , - e.prototype._pickWithRayOnDragPlane = function(t) { - var i = this; - if (!t) - return null; - var n = Math.acos(a.x.Dot(this._dragPlane.forward, t.direction)); - if (n > Math.PI / 2 && (n = Math.PI - n), - this.maxDragAngle > 0 && n > this.maxDragAngle) { - if (this._useAlternatePickedPointAboveMaxDragAngle) { - this._tmpVector.copyFrom(t.direction), - this._attachedNode.absolutePosition.subtractToRef(t.origin, this._alternatePickedPoint), - this._alternatePickedPoint.normalize(), - this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * a.x.Dot(this._alternatePickedPoint, this._tmpVector)), - this._tmpVector.addInPlace(this._alternatePickedPoint); - var r = a.x.Dot(this._dragPlane.forward, this._tmpVector); - return this._dragPlane.forward.scaleToRef(-r, this._alternatePickedPoint), - this._alternatePickedPoint.addInPlace(this._tmpVector), - this._alternatePickedPoint.addInPlace(this._attachedNode.absolutePosition), - this._alternatePickedPoint - } - return null - } - var o = e._planeScene.pickWithRay(t, function(e) { - return e == i._dragPlane - }); - return o && o.hit && o.pickedMesh && o.pickedPoint ? o.pickedPoint : null - } - , - e.prototype._updateDragPlanePosition = function(e, t) { - this._pointA.copyFrom(t), - this._options.dragAxis ? (this.useObjectOrienationForDragging ? a.x.TransformCoordinatesToRef(this._options.dragAxis, this._attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragAxis), - this._pointA.addToRef(this._localAxis, this._pointB), - e.origin.subtractToRef(this._pointA, this._pointC), - this._pointA.addToRef(this._pointC.normalize(), this._pointC), - this._pointB.subtractToRef(this._pointA, this._lineA), - this._pointC.subtractToRef(this._pointA, this._lineB), - a.x.CrossToRef(this._lineA, this._lineB, this._lookAt), - a.x.CrossToRef(this._lineA, this._lookAt, this._lookAt), - this._lookAt.normalize(), - this._dragPlane.position.copyFrom(this._pointA), - this._pointA.addToRef(this._lookAt, this._lookAt), - this._dragPlane.lookAt(this._lookAt)) : this._options.dragPlaneNormal ? (this.useObjectOrienationForDragging ? a.x.TransformCoordinatesToRef(this._options.dragPlaneNormal, this._attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal), - this._dragPlane.position.copyFrom(this._pointA), - this._pointA.addToRef(this._localAxis, this._lookAt), - this._dragPlane.lookAt(this._lookAt)) : (this._dragPlane.position.copyFrom(this._pointA), - this._dragPlane.lookAt(e.origin)), - this._dragPlane.position.copyFrom(this._attachedNode.absolutePosition), - this._dragPlane.computeWorldMatrix(true) - } - , - e.prototype.detach = function() { - this._pointerObserver && this._scene.onPointerObservable.remove(this._pointerObserver), - this._beforeRenderObserver && this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver), - this.releaseDrag() - } - , - e._AnyMouseID = -2, - e - }()) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }); - var n = i(3) - , r = function() { - function e() {} - return Object.defineProperty(e, "ForceFullSceneLoadingForIncremental", { - get: function() { - return e._ForceFullSceneLoadingForIncremental - }, - set: function(t) { - e._ForceFullSceneLoadingForIncremental = t - }, - enumerable: true, - configurable: true + if (t.type == s.a.POINTERDOWN) + !i.dragging && + t.pickInfo && + t.pickInfo.hit && + t.pickInfo.pickedMesh && + t.pickInfo.pickedPoint && + t.pickInfo.ray && + ((r = t.pickInfo.pickedMesh), + i._attachedNode == r || + r.isDescendantOf(i._attachedNode)) && + i._startDrag( + t.event.pointerId, + t.pickInfo.ray, + t.pickInfo.pickedPoint + ); + else if (t.type == s.a.POINTERUP) + i.currentDraggingPointerID == + t.event.pointerId && i.releaseDrag(); + else if (t.type == s.a.POINTERMOVE) { + var o = t.event.pointerId; + i.currentDraggingPointerID === e._AnyMouseID && + o !== e._AnyMouseID && + "mouse" == t.event.pointerType && + (i._lastPointerRay[ + i.currentDraggingPointerID + ] && + ((i._lastPointerRay[o] = + i._lastPointerRay[ + i.currentDraggingPointerID + ]), + delete i._lastPointerRay[ + i.currentDraggingPointerID + ]), + (i.currentDraggingPointerID = o)), + i._lastPointerRay[o] || + (i._lastPointerRay[o] = new c.a( + new a.x(), + new a.x() + )), + t.pickInfo && + t.pickInfo.ray && + (i._lastPointerRay[o].origin.copyFrom( + t.pickInfo.ray.origin + ), + i._lastPointerRay[o].direction.copyFrom( + t.pickInfo.ray.direction + ), + i.currentDraggingPointerID == o && + i.dragging && + i._moveDrag(t.pickInfo.ray)); + } + })), + (this._beforeRenderObserver = + this._scene.onBeforeRenderObservable.add(function () { + i._moving && + i.moveAttached && + (u.a._RemoveAndStorePivotPoint(i._attachedNode), + i._targetPosition.subtractToRef( + i._attachedNode.absolutePosition, + i._tmpVector + ), + i._tmpVector.scaleInPlace(i.dragDeltaRatio), + i._attachedNode + .getAbsolutePosition() + .addToRef(i._tmpVector, i._tmpVector), + i.validateDrag(i._tmpVector) && + i._attachedNode.setAbsolutePosition( + i._tmpVector + ), + u.a._RestorePivotPoint(i._attachedNode)); + })); }), - Object.defineProperty(e, "ShowLoadingScreen", { - get: function() { - return e._ShowLoadingScreen + (e.prototype.releaseDrag = function () { + (this.dragging = false), + this.onDragEndObservable.notifyObservers({ + dragPlanePoint: this.lastDragPosition, + pointerId: this.currentDraggingPointerID, + }), + (this.currentDraggingPointerID = -1), + (this._moving = false), + this.detachCameraControls && + this._attachedElement && + this._scene.activeCamera && + !this._scene.activeCamera.leftCamera && + this._scene.activeCamera.attachControl( + this._attachedElement, + true + ); + }), + (e.prototype.startDrag = function (t, i, n) { + void 0 === t && (t = e._AnyMouseID), + this._startDrag(t, i, n); + var r = this._lastPointerRay[t]; + t === e._AnyMouseID && + (r = + this._lastPointerRay[ + Object.keys(this._lastPointerRay)[0] + ]), + r && this._moveDrag(r); + }), + (e.prototype._startDrag = function (e, t, i) { + if ( + this._scene.activeCamera && + !this.dragging && + this._attachedNode + ) { + u.a._RemoveAndStorePivotPoint(this._attachedNode), + t + ? (this._startDragRay.direction.copyFrom( + t.direction + ), + this._startDragRay.origin.copyFrom(t.origin)) + : (this._startDragRay.origin.copyFrom( + this._scene.activeCamera.position + ), + this._attachedNode + .getWorldMatrix() + .getTranslationToRef(this._tmpVector), + this._tmpVector.subtractToRef( + this._scene.activeCamera.position, + this._startDragRay.direction + )), + this._updateDragPlanePosition( + this._startDragRay, + i || this._tmpVector + ); + var n = this._pickWithRayOnDragPlane( + this._startDragRay + ); + n && + ((this.dragging = true), + (this.currentDraggingPointerID = e), + this.lastDragPosition.copyFrom(n), + this.onDragStartObservable.notifyObservers({ + dragPlanePoint: n, + pointerId: this.currentDraggingPointerID, + }), + this._targetPosition.copyFrom( + this._attachedNode.absolutePosition + ), + this.detachCameraControls && + this._scene.activeCamera && + !this._scene.activeCamera.leftCamera && + (this._scene.activeCamera.inputs.attachedElement + ? ((this._attachedElement = + this._scene.activeCamera.inputs.attachedElement), + this._scene.activeCamera.detachControl( + this._scene.activeCamera.inputs + .attachedElement + )) + : (this._attachedElement = null))), + u.a._RestorePivotPoint(this._attachedNode); + } + }), + (e.prototype._moveDrag = function (e) { + this._moving = true; + var t = this._pickWithRayOnDragPlane(e); + if (t) { + this.updateDragPlane && + this._updateDragPlanePosition(e, t); + var i = 0; + this._options.dragAxis + ? (a.x.TransformCoordinatesToRef( + this._options.dragAxis, + this._attachedNode + .getWorldMatrix() + .getRotationMatrix(), + this._worldDragAxis + ), + t.subtractToRef( + this.lastDragPosition, + this._tmpVector + ), + (i = a.x.Dot(this._tmpVector, this._worldDragAxis)), + this._worldDragAxis.scaleToRef(i, this._dragDelta)) + : ((i = this._dragDelta.length()), + t.subtractToRef( + this.lastDragPosition, + this._dragDelta + )), + this._targetPosition.addInPlace(this._dragDelta), + this.onDragObservable.notifyObservers({ + dragDistance: i, + delta: this._dragDelta, + dragPlanePoint: t, + dragPlaneNormal: this._dragPlane.forward, + pointerId: this.currentDraggingPointerID, + }), + this.lastDragPosition.copyFrom(t); + } + }), + (e.prototype._pickWithRayOnDragPlane = function (t) { + var i = this; + if (!t) return null; + var n = Math.acos( + a.x.Dot(this._dragPlane.forward, t.direction) + ); + if ( + (n > Math.PI / 2 && (n = Math.PI - n), + this.maxDragAngle > 0 && n > this.maxDragAngle) + ) { + if (this._useAlternatePickedPointAboveMaxDragAngle) { + this._tmpVector.copyFrom(t.direction), + this._attachedNode.absolutePosition.subtractToRef( + t.origin, + this._alternatePickedPoint + ), + this._alternatePickedPoint.normalize(), + this._alternatePickedPoint.scaleInPlace( + this + ._useAlternatePickedPointAboveMaxDragAngleDragSpeed * + a.x.Dot( + this._alternatePickedPoint, + this._tmpVector + ) + ), + this._tmpVector.addInPlace( + this._alternatePickedPoint + ); + var r = a.x.Dot( + this._dragPlane.forward, + this._tmpVector + ); + return ( + this._dragPlane.forward.scaleToRef( + -r, + this._alternatePickedPoint + ), + this._alternatePickedPoint.addInPlace( + this._tmpVector + ), + this._alternatePickedPoint.addInPlace( + this._attachedNode.absolutePosition + ), + this._alternatePickedPoint + ); + } + return null; + } + var o = e._planeScene.pickWithRay(t, function (e) { + return e == i._dragPlane; + }); + return o && o.hit && o.pickedMesh && o.pickedPoint + ? o.pickedPoint + : null; + }), + (e.prototype._updateDragPlanePosition = function (e, t) { + this._pointA.copyFrom(t), + this._options.dragAxis + ? (this.useObjectOrienationForDragging + ? a.x.TransformCoordinatesToRef( + this._options.dragAxis, + this._attachedNode + .getWorldMatrix() + .getRotationMatrix(), + this._localAxis + ) + : this._localAxis.copyFrom( + this._options.dragAxis + ), + this._pointA.addToRef( + this._localAxis, + this._pointB + ), + e.origin.subtractToRef(this._pointA, this._pointC), + this._pointA.addToRef( + this._pointC.normalize(), + this._pointC + ), + this._pointB.subtractToRef( + this._pointA, + this._lineA + ), + this._pointC.subtractToRef( + this._pointA, + this._lineB + ), + a.x.CrossToRef( + this._lineA, + this._lineB, + this._lookAt + ), + a.x.CrossToRef( + this._lineA, + this._lookAt, + this._lookAt + ), + this._lookAt.normalize(), + this._dragPlane.position.copyFrom(this._pointA), + this._pointA.addToRef(this._lookAt, this._lookAt), + this._dragPlane.lookAt(this._lookAt)) + : this._options.dragPlaneNormal + ? (this.useObjectOrienationForDragging + ? a.x.TransformCoordinatesToRef( + this._options.dragPlaneNormal, + this._attachedNode + .getWorldMatrix() + .getRotationMatrix(), + this._localAxis + ) + : this._localAxis.copyFrom( + this._options.dragPlaneNormal + ), + this._dragPlane.position.copyFrom(this._pointA), + this._pointA.addToRef( + this._localAxis, + this._lookAt + ), + this._dragPlane.lookAt(this._lookAt)) + : (this._dragPlane.position.copyFrom(this._pointA), + this._dragPlane.lookAt(e.origin)), + this._dragPlane.position.copyFrom( + this._attachedNode.absolutePosition + ), + this._dragPlane.computeWorldMatrix(true); + }), + (e.prototype.detach = function () { + this._pointerObserver && + this._scene.onPointerObservable.remove( + this._pointerObserver + ), + this._beforeRenderObserver && + this._scene.onBeforeRenderObservable.remove( + this._beforeRenderObserver + ), + this.releaseDrag(); + }), + (e._AnyMouseID = -2), + e + ); + })()); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }); + var n = i(3), + r = (function () { + function e() {} + return ( + Object.defineProperty( + e, + "ForceFullSceneLoadingForIncremental", + { + get: function () { + return e._ForceFullSceneLoadingForIncremental; }, - set: function(t) { - e._ShowLoadingScreen = t + set: function (t) { + e._ForceFullSceneLoadingForIncremental = t; }, enumerable: true, - configurable: true + configurable: true, + } + ), + Object.defineProperty(e, "ShowLoadingScreen", { + get: function () { + return e._ShowLoadingScreen; + }, + set: function (t) { + e._ShowLoadingScreen = t; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "loggingLevel", { - get: function() { - return e._loggingLevel - }, - set: function(t) { - e._loggingLevel = t - }, - enumerable: true, - configurable: true + get: function () { + return e._loggingLevel; + }, + set: function (t) { + e._loggingLevel = t; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "CleanBoneMatrixWeights", { - get: function() { - return e._CleanBoneMatrixWeights - }, - set: function(t) { - e._CleanBoneMatrixWeights = t - }, - enumerable: true, - configurable: true + get: function () { + return e._CleanBoneMatrixWeights; + }, + set: function (t) { + e._CleanBoneMatrixWeights = t; + }, + enumerable: true, + configurable: true, }), - e._ForceFullSceneLoadingForIncremental = false, - e._ShowLoadingScreen = true, - e._CleanBoneMatrixWeights = false, - e._loggingLevel = n.a.SCENELOADER_NO_LOGGING, + (e._ForceFullSceneLoadingForIncremental = false), + (e._ShowLoadingScreen = true), + (e._CleanBoneMatrixWeights = false), + (e._loggingLevel = n.a.SCENELOADER_NO_LOGGING), e - }() - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.helperFunctions = "const float PI=3.1415926535897932384626433832795;\nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\nconst float Epsilon=0.0000001;\n#define saturate(x) clamp(x,0.0,1.0)\n#define absEps(x) abs(x)+Epsilon\n#define maxEps(x) max(x,Epsilon)\n#define saturateEps(x) clamp(x,Epsilon,1.0)\nmat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}\n\nmat3 inverseMat3(mat3 inMatrix) {\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\nfloat b01=a22*a11-a12*a21;\nfloat b11=-a22*a10+a12*a20;\nfloat b21=a21*a10-a11*a20;\nfloat det=a00*b01+a01*b11+a02*b21;\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn pow(color,vec3(LinearEncodePowerApprox));\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn pow(color,vec3(GammaEncodePowerApprox));\n}\nfloat square(float value)\n{\nreturn value*value;\n}\nfloat pow5(float value) {\nfloat sq=value*value;\nreturn sq*sq*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\n}\n\nfloat getRand(vec2 seed) {\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\n}\nfloat dither(vec2 seed,float varianceAmount) {\nfloat rand=getRand(seed);\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\nreturn dither;\n}\n\nconst float rgbdMaxRange=255.0;\nvec4 toRGBD(vec3 color) {\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\nfloat D=max(rgbdMaxRange/maxRGB,1.);\nD=clamp(floor(D)/255.0,0.,1.);\n\nvec3 rgb=color.rgb*D;\n\nrgb=toGammaSpace(rgb);\nreturn vec4(rgb,D);\n}\nvec3 fromRGBD(vec4 rgbd) {\n\nrgbd.rgb=toLinearSpace(rgbd.rgb);\n\nreturn rgbd.rgb/rgbd.a;\n}" - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return f - }); - var n = i(0) - , r = i(13) - , o = i(4) - , a = i(49) - , s = i(55) - , c = i(43) - , u = i(3) - , l = i(9) - , h = i(29) - , f = function() { - function e(e, t, i, n, r) { - void 0 === n && (n = false), - void 0 === r && (r = null), - this.delayLoadState = u.a.DELAYLOADSTATE_NONE, - this._totalVertices = 0, - this._isDisposed = false, - this._indexBufferIsUpdatable = false, - this.id = e, - this.uniqueId = t.getUniqueId(), - this._engine = t.getEngine(), - this._meshes = [], - this._scene = t, - this._vertexBuffers = {}, - this._indices = [], - this._updatable = n, - i ? this.setAllVerticesData(i, n) : (this._totalVertices = 0, - this._indices = []), - this._engine.getCaps().vertexArrayObject && (this._vertexArrayObjects = {}), - r && (this.applyToMesh(r), - r.computeWorldMatrix(true)) - } - return Object.defineProperty(e.prototype, "boundingBias", { - get: function() { - return this._boundingBias - }, - set: function(e) { - this._boundingBias ? this._boundingBias.copyFrom(e) : this._boundingBias = e.clone(), - this._updateBoundingInfo(true, null) - }, - enumerable: true, - configurable: true + ); + })(); + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.helperFunctions = + "const float PI=3.1415926535897932384626433832795;\nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\nconst float Epsilon=0.0000001;\n#define saturate(x) clamp(x,0.0,1.0)\n#define absEps(x) abs(x)+Epsilon\n#define maxEps(x) max(x,Epsilon)\n#define saturateEps(x) clamp(x,Epsilon,1.0)\nmat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}\n\nmat3 inverseMat3(mat3 inMatrix) {\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\nfloat b01=a22*a11-a12*a21;\nfloat b11=-a22*a10+a12*a20;\nfloat b21=a21*a10-a11*a20;\nfloat det=a00*b01+a01*b11+a02*b21;\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn pow(color,vec3(LinearEncodePowerApprox));\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn pow(color,vec3(GammaEncodePowerApprox));\n}\nfloat square(float value)\n{\nreturn value*value;\n}\nfloat pow5(float value) {\nfloat sq=value*value;\nreturn sq*sq*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\n}\n\nfloat getRand(vec2 seed) {\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\n}\nfloat dither(vec2 seed,float varianceAmount) {\nfloat rand=getRand(seed);\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\nreturn dither;\n}\n\nconst float rgbdMaxRange=255.0;\nvec4 toRGBD(vec3 color) {\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\nfloat D=max(rgbdMaxRange/maxRGB,1.);\nD=clamp(floor(D)/255.0,0.,1.);\n\nvec3 rgb=color.rgb*D;\n\nrgb=toGammaSpace(rgb);\nreturn vec4(rgb,D);\n}\nvec3 fromRGBD(vec4 rgbd) {\n\nrgbd.rgb=toLinearSpace(rgbd.rgb);\n\nreturn rgbd.rgb/rgbd.a;\n}"; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return f; + }); + var n = i(0), + r = i(13), + o = i(4), + a = i(49), + s = i(55), + c = i(43), + u = i(3), + l = i(9), + h = i(29), + f = (function () { + function e(e, t, i, n, r) { + void 0 === n && (n = false), + void 0 === r && (r = null), + (this.delayLoadState = u.a.DELAYLOADSTATE_NONE), + (this._totalVertices = 0), + (this._isDisposed = false), + (this._indexBufferIsUpdatable = false), + (this.id = e), + (this.uniqueId = t.getUniqueId()), + (this._engine = t.getEngine()), + (this._meshes = []), + (this._scene = t), + (this._vertexBuffers = {}), + (this._indices = []), + (this._updatable = n), + i + ? this.setAllVerticesData(i, n) + : ((this._totalVertices = 0), (this._indices = [])), + this._engine.getCaps().vertexArrayObject && + (this._vertexArrayObjects = {}), + r && (this.applyToMesh(r), r.computeWorldMatrix(true)); + } + return ( + Object.defineProperty(e.prototype, "boundingBias", { + get: function () { + return this._boundingBias; + }, + set: function (e) { + this._boundingBias + ? this._boundingBias.copyFrom(e) + : (this._boundingBias = e.clone()), + this._updateBoundingInfo(true, null); + }, + enumerable: true, + configurable: true, + }), + (e.CreateGeometryForMesh = function (t) { + var i = new e(e.RandomId(), t.getScene()); + return i.applyToMesh(t), i; }), - e.CreateGeometryForMesh = function(t) { - var i = new e(e.RandomId(),t.getScene()); - return i.applyToMesh(t), - i - } - , Object.defineProperty(e.prototype, "extend", { - get: function() { - return this._extend - }, - enumerable: true, - configurable: true + get: function () { + return this._extend; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getScene = function () { + return this._scene; + }), + (e.prototype.getEngine = function () { + return this._engine; + }), + (e.prototype.isReady = function () { + return ( + this.delayLoadState === u.a.DELAYLOADSTATE_LOADED || + this.delayLoadState === u.a.DELAYLOADSTATE_NONE + ); }), - e.prototype.getScene = function() { - return this._scene - } - , - e.prototype.getEngine = function() { - return this._engine - } - , - e.prototype.isReady = function() { - return this.delayLoadState === u.a.DELAYLOADSTATE_LOADED || this.delayLoadState === u.a.DELAYLOADSTATE_NONE - } - , Object.defineProperty(e.prototype, "doNotSerialize", { - get: function() { - for (var e = 0; e < this._meshes.length; e++) - if (!this._meshes[e].doNotSerialize) - return false; - return true - }, - enumerable: true, - configurable: true + get: function () { + for (var e = 0; e < this._meshes.length; e++) + if (!this._meshes[e].doNotSerialize) return false; + return true; + }, + enumerable: true, + configurable: true, }), - e.prototype._rebuild = function() { - for (var e in this._vertexArrayObjects && (this._vertexArrayObjects = {}), - 0 !== this._meshes.length && this._indices && (this._indexBuffer = this._engine.createIndexBuffer(this._indices)), - this._vertexBuffers) - this._vertexBuffers[e]._rebuild() - } - , - e.prototype.setAllVerticesData = function(e, t) { - e.applyToGeometry(this, t), - this.notifyUpdate() - } - , - e.prototype.setVerticesData = function(e, t, i, n) { - void 0 === i && (i = false); - var r = new o.b(this._engine,t,e,i,0 === this._meshes.length,n); - this.setVerticesBuffer(r) - } - , - e.prototype.removeVerticesData = function(e) { - this._vertexBuffers[e] && (this._vertexBuffers[e].dispose(), - delete this._vertexBuffers[e]) - } - , - e.prototype.setVerticesBuffer = function(e, t) { - void 0 === t && (t = null); - var i = e.getKind(); - if (this._vertexBuffers[i] && this._vertexBuffers[i].dispose(), - this._vertexBuffers[i] = e, - i === o.b.PositionKind) { - var n = e.getData(); - null != t ? this._totalVertices = t : null != n && (this._totalVertices = n.length / (e.byteStride / 4)), - this._updateExtend(n), - this._resetPointsArrayCache(); - for (var r = this._meshes, a = r.length, s = 0; s < a; s++) { - var u = r[s]; - u._boundingInfo = new c.a(this._extend.minimum,this._extend.maximum), - u._createGlobalSubMesh(false), - u.computeWorldMatrix(true) - } + (e.prototype._rebuild = function () { + for (var e in (this._vertexArrayObjects && + (this._vertexArrayObjects = {}), + 0 !== this._meshes.length && + this._indices && + (this._indexBuffer = this._engine.createIndexBuffer( + this._indices + )), + this._vertexBuffers)) + this._vertexBuffers[e]._rebuild(); + }), + (e.prototype.setAllVerticesData = function (e, t) { + e.applyToGeometry(this, t), this.notifyUpdate(); + }), + (e.prototype.setVerticesData = function (e, t, i, n) { + void 0 === i && (i = false); + var r = new o.b( + this._engine, + t, + e, + i, + 0 === this._meshes.length, + n + ); + this.setVerticesBuffer(r); + }), + (e.prototype.removeVerticesData = function (e) { + this._vertexBuffers[e] && + (this._vertexBuffers[e].dispose(), + delete this._vertexBuffers[e]); + }), + (e.prototype.setVerticesBuffer = function (e, t) { + void 0 === t && (t = null); + var i = e.getKind(); + if ( + (this._vertexBuffers[i] && + this._vertexBuffers[i].dispose(), + (this._vertexBuffers[i] = e), + i === o.b.PositionKind) + ) { + var n = e.getData(); + null != t + ? (this._totalVertices = t) + : null != n && + (this._totalVertices = + n.length / (e.byteStride / 4)), + this._updateExtend(n), + this._resetPointsArrayCache(); + for ( + var r = this._meshes, a = r.length, s = 0; + s < a; + s++ + ) { + var u = r[s]; + (u._boundingInfo = new c.a( + this._extend.minimum, + this._extend.maximum + )), + u._createGlobalSubMesh(false), + u.computeWorldMatrix(true); } - this.notifyUpdate(i), - this._vertexArrayObjects && (this._disposeVertexArrayObjects(), - this._vertexArrayObjects = {}) - } - , - e.prototype.updateVerticesDataDirectly = function(e, t, i, n) { - void 0 === n && (n = false); - var r = this.getVertexBuffer(e); - r && (r.updateDirectly(t, i, n), - this.notifyUpdate(e)) - } - , - e.prototype.updateVerticesData = function(e, t, i) { - void 0 === i && (i = false); - var n = this.getVertexBuffer(e); - n && (n.update(t), - e === o.b.PositionKind && this._updateBoundingInfo(i, t), - this.notifyUpdate(e)) - } - , - e.prototype._updateBoundingInfo = function(e, t) { - if (e && this._updateExtend(t), + } + this.notifyUpdate(i), + this._vertexArrayObjects && + (this._disposeVertexArrayObjects(), + (this._vertexArrayObjects = {})); + }), + (e.prototype.updateVerticesDataDirectly = function ( + e, + t, + i, + n + ) { + void 0 === n && (n = false); + var r = this.getVertexBuffer(e); + r && (r.updateDirectly(t, i, n), this.notifyUpdate(e)); + }), + (e.prototype.updateVerticesData = function (e, t, i) { + void 0 === i && (i = false); + var n = this.getVertexBuffer(e); + n && + (n.update(t), + e === o.b.PositionKind && + this._updateBoundingInfo(i, t), + this.notifyUpdate(e)); + }), + (e.prototype._updateBoundingInfo = function (e, t) { + if ( + (e && this._updateExtend(t), this._resetPointsArrayCache(), e) - for (var i = 0, n = this._meshes; i < n.length; i++) { - var r = n[i]; - r._boundingInfo ? r._boundingInfo.reConstruct(this._extend.minimum, this._extend.maximum) : r._boundingInfo = new c.a(this._extend.minimum,this._extend.maximum); - for (var o = 0, a = r.subMeshes; o < a.length; o++) - a[o].refreshBoundingInfo() - } - } - , - e.prototype._bind = function(e, t) { - if (e) { - void 0 === t && (t = this._indexBuffer); - var i = this.getVertexBuffers(); - i && (t == this._indexBuffer && this._vertexArrayObjects ? (this._vertexArrayObjects[e.key] || (this._vertexArrayObjects[e.key] = this._engine.recordVertexArrayObject(i, t, e)), - this._engine.bindVertexArrayObject(this._vertexArrayObjects[e.key], t)) : this._engine.bindBuffers(i, t, e)) + ) + for (var i = 0, n = this._meshes; i < n.length; i++) { + var r = n[i]; + r._boundingInfo + ? r._boundingInfo.reConstruct( + this._extend.minimum, + this._extend.maximum + ) + : (r._boundingInfo = new c.a( + this._extend.minimum, + this._extend.maximum + )); + for (var o = 0, a = r.subMeshes; o < a.length; o++) + a[o].refreshBoundingInfo(); } - } - , - e.prototype.getTotalVertices = function() { - return this.isReady() ? this._totalVertices : 0 - } - , - e.prototype.getVerticesData = function(e, t, i) { - var n = this.getVertexBuffer(e); - if (!n) - return null; - var r = n.getData(); - if (!r) - return null; - var a = n.getSize() * o.b.GetTypeByteLength(n.type) - , s = this._totalVertices * n.getSize(); - if (n.type !== o.b.FLOAT || n.byteStride !== a) { - var c = []; - return n.forEach(s, function(e) { - return c.push(e) - }), - c + }), + (e.prototype._bind = function (e, t) { + if (e) { + void 0 === t && (t = this._indexBuffer); + var i = this.getVertexBuffers(); + i && + (t == this._indexBuffer && this._vertexArrayObjects + ? (this._vertexArrayObjects[e.key] || + (this._vertexArrayObjects[e.key] = + this._engine.recordVertexArrayObject( + i, + t, + e + )), + this._engine.bindVertexArrayObject( + this._vertexArrayObjects[e.key], + t + )) + : this._engine.bindBuffers(i, t, e)); + } + }), + (e.prototype.getTotalVertices = function () { + return this.isReady() ? this._totalVertices : 0; + }), + (e.prototype.getVerticesData = function (e, t, i) { + var n = this.getVertexBuffer(e); + if (!n) return null; + var r = n.getData(); + if (!r) return null; + var a = n.getSize() * o.b.GetTypeByteLength(n.type), + s = this._totalVertices * n.getSize(); + if (n.type !== o.b.FLOAT || n.byteStride !== a) { + var c = []; + return ( + n.forEach(s, function (e) { + return c.push(e); + }), + c + ); + } + if ( + !(r instanceof Array || r instanceof Float32Array) || + 0 !== n.byteOffset || + r.length !== s + ) { + if (r instanceof Array) { + var u = n.byteOffset / 4; + return l.h.Slice(r, u, u + s); } - if (!(r instanceof Array || r instanceof Float32Array) || 0 !== n.byteOffset || r.length !== s) { - if (r instanceof Array) { - var u = n.byteOffset / 4; - return l.h.Slice(r, u, u + s) - } - if (r instanceof ArrayBuffer) - return new Float32Array(r,n.byteOffset,s); - if (u = r.byteOffset + n.byteOffset, - i || t && 1 !== this._meshes.length) { - var h = new Float32Array(s) - , f = new Float32Array(r.buffer,u,s); - return h.set(f), - h - } - return new Float32Array(r.buffer,u,s) + if (r instanceof ArrayBuffer) + return new Float32Array(r, n.byteOffset, s); + if ( + ((u = r.byteOffset + n.byteOffset), + i || (t && 1 !== this._meshes.length)) + ) { + var h = new Float32Array(s), + f = new Float32Array(r.buffer, u, s); + return h.set(f), h; } - return i || t && 1 !== this._meshes.length ? l.h.Slice(r) : r - } - , - e.prototype.isVertexBufferUpdatable = function(e) { - var t = this._vertexBuffers[e]; - return !!t && t.isUpdatable() - } - , - e.prototype.getVertexBuffer = function(e) { - return this.isReady() ? this._vertexBuffers[e] : null - } - , - e.prototype.getVertexBuffers = function() { - return this.isReady() ? this._vertexBuffers : null - } - , - e.prototype.isVerticesDataPresent = function(e) { - return this._vertexBuffers ? void 0 !== this._vertexBuffers[e] : !!this._delayInfo && -1 !== this._delayInfo.indexOf(e) - } - , - e.prototype.getVerticesDataKinds = function() { - var e, t = []; - if (!this._vertexBuffers && this._delayInfo) - for (e in this._delayInfo) - t.push(e); - else - for (e in this._vertexBuffers) - t.push(e); - return t - } - , - e.prototype.updateIndices = function(e, t, i) { - if (void 0 === i && (i = false), - this._indexBuffer) - if (this._indexBufferIsUpdatable) { - var n = e.length !== this._indices.length; - if (i || (this._indices = e.slice()), - this._engine.updateDynamicIndexBuffer(this._indexBuffer, e, t), - n) - for (var r = 0, o = this._meshes; r < o.length; r++) - o[r]._createGlobalSubMesh(true) - } else - this.setIndices(e, null, true) - } - , - e.prototype.setIndices = function(e, t, i) { - void 0 === t && (t = null), + return new Float32Array(r.buffer, u, s); + } + return i || (t && 1 !== this._meshes.length) + ? l.h.Slice(r) + : r; + }), + (e.prototype.isVertexBufferUpdatable = function (e) { + var t = this._vertexBuffers[e]; + return !!t && t.isUpdatable(); + }), + (e.prototype.getVertexBuffer = function (e) { + return this.isReady() ? this._vertexBuffers[e] : null; + }), + (e.prototype.getVertexBuffers = function () { + return this.isReady() ? this._vertexBuffers : null; + }), + (e.prototype.isVerticesDataPresent = function (e) { + return this._vertexBuffers + ? void 0 !== this._vertexBuffers[e] + : !!this._delayInfo && + -1 !== this._delayInfo.indexOf(e); + }), + (e.prototype.getVerticesDataKinds = function () { + var e, + t = []; + if (!this._vertexBuffers && this._delayInfo) + for (e in this._delayInfo) t.push(e); + else for (e in this._vertexBuffers) t.push(e); + return t; + }), + (e.prototype.updateIndices = function (e, t, i) { + if ((void 0 === i && (i = false), this._indexBuffer)) + if (this._indexBufferIsUpdatable) { + var n = e.length !== this._indices.length; + if ( + (i || (this._indices = e.slice()), + this._engine.updateDynamicIndexBuffer( + this._indexBuffer, + e, + t + ), + n) + ) + for (var r = 0, o = this._meshes; r < o.length; r++) + o[r]._createGlobalSubMesh(true); + } else this.setIndices(e, null, true); + }), + (e.prototype.setIndices = function (e, t, i) { + void 0 === t && (t = null), void 0 === i && (i = false), - this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer), + this._indexBuffer && + this._engine._releaseBuffer(this._indexBuffer), this._disposeVertexArrayObjects(), - this._indices = e, - this._indexBufferIsUpdatable = i, - 0 !== this._meshes.length && this._indices && (this._indexBuffer = this._engine.createIndexBuffer(this._indices, i)), + (this._indices = e), + (this._indexBufferIsUpdatable = i), + 0 !== this._meshes.length && + this._indices && + (this._indexBuffer = this._engine.createIndexBuffer( + this._indices, + i + )), null != t && (this._totalVertices = t); - for (var n = 0, r = this._meshes; n < r.length; n++) - r[n]._createGlobalSubMesh(true); - this.notifyUpdate() - } - , - e.prototype.getTotalIndices = function() { - return this.isReady() ? this._indices.length : 0 - } - , - e.prototype.getIndices = function(e, t) { - if (!this.isReady()) - return null; - var i = this._indices; - if (t || e && 1 !== this._meshes.length) { - for (var n = i.length, r = [], o = 0; o < n; o++) - r.push(i[o]); - return r - } - return i - } - , - e.prototype.getIndexBuffer = function() { - return this.isReady() ? this._indexBuffer : null - } - , - e.prototype._releaseVertexArrayObject = function(e) { - void 0 === e && (e = null), - e && this._vertexArrayObjects && this._vertexArrayObjects[e.key] && (this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e.key]), - delete this._vertexArrayObjects[e.key]) - } - , - e.prototype.releaseForMesh = function(e, t) { - var i = this._meshes - , n = i.indexOf(e); - -1 !== n && (i.splice(n, 1), - e._geometry = null, - 0 === i.length && t && this.dispose()) - } - , - e.prototype.applyToMesh = function(e) { - if (e._geometry !== this) { - var t = e._geometry; - t && t.releaseForMesh(e); - var i = this._meshes; - e._geometry = this, - this._scene.pushGeometry(this), - i.push(e), - this.isReady() ? this._applyToMesh(e) : e._boundingInfo = this._boundingInfo - } - } - , - e.prototype._updateExtend = function(e) { - void 0 === e && (e = null), + for (var n = 0, r = this._meshes; n < r.length; n++) + r[n]._createGlobalSubMesh(true); + this.notifyUpdate(); + }), + (e.prototype.getTotalIndices = function () { + return this.isReady() ? this._indices.length : 0; + }), + (e.prototype.getIndices = function (e, t) { + if (!this.isReady()) return null; + var i = this._indices; + if (t || (e && 1 !== this._meshes.length)) { + for (var n = i.length, r = [], o = 0; o < n; o++) + r.push(i[o]); + return r; + } + return i; + }), + (e.prototype.getIndexBuffer = function () { + return this.isReady() ? this._indexBuffer : null; + }), + (e.prototype._releaseVertexArrayObject = function (e) { + void 0 === e && (e = null), + e && + this._vertexArrayObjects && + this._vertexArrayObjects[e.key] && + (this._engine.releaseVertexArrayObject( + this._vertexArrayObjects[e.key] + ), + delete this._vertexArrayObjects[e.key]); + }), + (e.prototype.releaseForMesh = function (e, t) { + var i = this._meshes, + n = i.indexOf(e); + -1 !== n && + (i.splice(n, 1), + (e._geometry = null), + 0 === i.length && t && this.dispose()); + }), + (e.prototype.applyToMesh = function (e) { + if (e._geometry !== this) { + var t = e._geometry; + t && t.releaseForMesh(e); + var i = this._meshes; + (e._geometry = this), + this._scene.pushGeometry(this), + i.push(e), + this.isReady() + ? this._applyToMesh(e) + : (e._boundingInfo = this._boundingInfo); + } + }), + (e.prototype._updateExtend = function (e) { + void 0 === e && (e = null), e || (e = this.getVerticesData(o.b.PositionKind)), - this._extend = l.h.ExtractMinAndMax(e, 0, this._totalVertices, this.boundingBias, 3) - } - , - e.prototype._applyToMesh = function(e) { - var t = this._meshes.length; - for (var i in this._vertexBuffers) { - 1 === t && this._vertexBuffers[i].create(); - var n = this._vertexBuffers[i].getBuffer(); - n && (n.references = t), - i === o.b.PositionKind && (this._extend || this._updateExtend(), - e._boundingInfo = new c.a(this._extend.minimum,this._extend.maximum), + (this._extend = l.h.ExtractMinAndMax( + e, + 0, + this._totalVertices, + this.boundingBias, + 3 + )); + }), + (e.prototype._applyToMesh = function (e) { + var t = this._meshes.length; + for (var i in this._vertexBuffers) { + 1 === t && this._vertexBuffers[i].create(); + var n = this._vertexBuffers[i].getBuffer(); + n && (n.references = t), + i === o.b.PositionKind && + (this._extend || this._updateExtend(), + (e._boundingInfo = new c.a( + this._extend.minimum, + this._extend.maximum + )), e._createGlobalSubMesh(false), - e._updateBoundingInfo()) - } - 1 === t && this._indices && this._indices.length > 0 && (this._indexBuffer = this._engine.createIndexBuffer(this._indices)), + e._updateBoundingInfo()); + } + 1 === t && + this._indices && + this._indices.length > 0 && + (this._indexBuffer = this._engine.createIndexBuffer( + this._indices + )), this._indexBuffer && (this._indexBuffer.references = t), e._syncGeometryWithMorphTargetManager(), - e.synchronizeInstances() - } - , - e.prototype.notifyUpdate = function(e) { - this.onGeometryUpdated && this.onGeometryUpdated(this, e); - for (var t = 0, i = this._meshes; t < i.length; t++) - i[t]._markSubMeshesAsAttributesDirty() - } - , - e.prototype.load = function(e, t) { - this.delayLoadState !== u.a.DELAYLOADSTATE_LOADING && (this.isReady() ? t && t() : (this.delayLoadState = u.a.DELAYLOADSTATE_LOADING, - this._queueLoad(e, t))) - } - , - e.prototype._queueLoad = function(e, t) { - var i = this; - this.delayLoadingFile && (e._addPendingData(this), - e._loadFile(this.delayLoadingFile, function(n) { + e.synchronizeInstances(); + }), + (e.prototype.notifyUpdate = function (e) { + this.onGeometryUpdated && this.onGeometryUpdated(this, e); + for (var t = 0, i = this._meshes; t < i.length; t++) + i[t]._markSubMeshesAsAttributesDirty(); + }), + (e.prototype.load = function (e, t) { + this.delayLoadState !== u.a.DELAYLOADSTATE_LOADING && + (this.isReady() + ? t && t() + : ((this.delayLoadState = u.a.DELAYLOADSTATE_LOADING), + this._queueLoad(e, t))); + }), + (e.prototype._queueLoad = function (e, t) { + var i = this; + this.delayLoadingFile && + (e._addPendingData(this), + e._loadFile( + this.delayLoadingFile, + function (n) { if (i._delayLoadingFunction) { - i._delayLoadingFunction(JSON.parse(n), i), - i.delayLoadState = u.a.DELAYLOADSTATE_LOADED, - i._delayInfo = [], + i._delayLoadingFunction(JSON.parse(n), i), + (i.delayLoadState = u.a.DELAYLOADSTATE_LOADED), + (i._delayInfo = []), e._removePendingData(i); - for (var r = i._meshes, o = r.length, a = 0; a < o; a++) - i._applyToMesh(r[a]); - t && t() + for ( + var r = i._meshes, o = r.length, a = 0; + a < o; + a++ + ) + i._applyToMesh(r[a]); + t && t(); } - }, void 0, true)) - } - , - e.prototype.toLeftHanded = function() { - var e = this.getIndices(false); - if (null != e && e.length > 0) { - for (var t = 0; t < e.length; t += 3) { - var i = e[t + 0]; - e[t + 0] = e[t + 2], - e[t + 2] = i - } - this.setIndices(e) + }, + void 0, + true + )); + }), + (e.prototype.toLeftHanded = function () { + var e = this.getIndices(false); + if (null != e && e.length > 0) { + for (var t = 0; t < e.length; t += 3) { + var i = e[t + 0]; + (e[t + 0] = e[t + 2]), (e[t + 2] = i); } - var n = this.getVerticesData(o.b.PositionKind, false); - if (null != n && n.length > 0) { - for (t = 0; t < n.length; t += 3) - n[t + 2] = -n[t + 2]; - this.setVerticesData(o.b.PositionKind, n, false) - } - var r = this.getVerticesData(o.b.NormalKind, false); - if (null != r && r.length > 0) { - for (t = 0; t < r.length; t += 3) - r[t + 2] = -r[t + 2]; - this.setVerticesData(o.b.NormalKind, r, false) - } - } - , - e.prototype._resetPointsArrayCache = function() { - this._positions = null - } - , - e.prototype._generatePointsArray = function() { - if (this._positions) - return true; - var e = this.getVerticesData(o.b.PositionKind); - if (!e || 0 === e.length) - return false; - this._positions = []; - for (var t = 0; t < e.length; t += 3) - this._positions.push(n.x.FromArray(e, t)); - return true - } - , - e.prototype.isDisposed = function() { - return this._isDisposed - } - , - e.prototype._disposeVertexArrayObjects = function() { - if (this._vertexArrayObjects) { - for (var e in this._vertexArrayObjects) - this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e]); - this._vertexArrayObjects = {} - } - } - , - e.prototype.dispose = function() { - var e, t = this._meshes, i = t.length; - for (e = 0; e < i; e++) - this.releaseForMesh(t[e]); - for (var n in this._meshes = [], - this._disposeVertexArrayObjects(), - this._vertexBuffers) - this._vertexBuffers[n].dispose(); - this._vertexBuffers = {}, - this._totalVertices = 0, - this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer), - this._indexBuffer = null, - this._indices = [], - this.delayLoadState = u.a.DELAYLOADSTATE_NONE, - this.delayLoadingFile = null, - this._delayLoadingFunction = null, - this._delayInfo = [], - this._boundingInfo = null, + this.setIndices(e); + } + var n = this.getVerticesData(o.b.PositionKind, false); + if (null != n && n.length > 0) { + for (t = 0; t < n.length; t += 3) n[t + 2] = -n[t + 2]; + this.setVerticesData(o.b.PositionKind, n, false); + } + var r = this.getVerticesData(o.b.NormalKind, false); + if (null != r && r.length > 0) { + for (t = 0; t < r.length; t += 3) r[t + 2] = -r[t + 2]; + this.setVerticesData(o.b.NormalKind, r, false); + } + }), + (e.prototype._resetPointsArrayCache = function () { + this._positions = null; + }), + (e.prototype._generatePointsArray = function () { + if (this._positions) return true; + var e = this.getVerticesData(o.b.PositionKind); + if (!e || 0 === e.length) return false; + this._positions = []; + for (var t = 0; t < e.length; t += 3) + this._positions.push(n.x.FromArray(e, t)); + return true; + }), + (e.prototype.isDisposed = function () { + return this._isDisposed; + }), + (e.prototype._disposeVertexArrayObjects = function () { + if (this._vertexArrayObjects) { + for (var e in this._vertexArrayObjects) + this._engine.releaseVertexArrayObject( + this._vertexArrayObjects[e] + ); + this._vertexArrayObjects = {}; + } + }), + (e.prototype.dispose = function () { + var e, + t = this._meshes, + i = t.length; + for (e = 0; e < i; e++) this.releaseForMesh(t[e]); + for (var n in ((this._meshes = []), + this._disposeVertexArrayObjects(), + this._vertexBuffers)) + this._vertexBuffers[n].dispose(); + (this._vertexBuffers = {}), + (this._totalVertices = 0), + this._indexBuffer && + this._engine._releaseBuffer(this._indexBuffer), + (this._indexBuffer = null), + (this._indices = []), + (this.delayLoadState = u.a.DELAYLOADSTATE_NONE), + (this.delayLoadingFile = null), + (this._delayLoadingFunction = null), + (this._delayInfo = []), + (this._boundingInfo = null), this._scene.removeGeometry(this), - this._isDisposed = true - } - , - e.prototype.copy = function(t) { - var i = new r.a; - i.indices = []; - var n = this.getIndices(); - if (n) - for (var o = 0; o < n.length; o++) - i.indices.push(n[o]); - var a, s = false, u = false; - for (a in this._vertexBuffers) { - var l = this.getVerticesData(a); - if (l && (l instanceof Float32Array ? i.set(new Float32Array(l), a) : i.set(l.slice(0), a), - !u)) { - var h = this.getVertexBuffer(a); - h && (u = !(s = h.isUpdatable())) - } + (this._isDisposed = true); + }), + (e.prototype.copy = function (t) { + var i = new r.a(); + i.indices = []; + var n = this.getIndices(); + if (n) + for (var o = 0; o < n.length; o++) i.indices.push(n[o]); + var a, + s = false, + u = false; + for (a in this._vertexBuffers) { + var l = this.getVerticesData(a); + if ( + l && + (l instanceof Float32Array + ? i.set(new Float32Array(l), a) + : i.set(l.slice(0), a), + !u) + ) { + var h = this.getVertexBuffer(a); + h && (u = !(s = h.isUpdatable())); } - var f = new e(t,this._scene,i,s); - for (a in f.delayLoadState = this.delayLoadState, - f.delayLoadingFile = this.delayLoadingFile, - f._delayLoadingFunction = this._delayLoadingFunction, - this._delayInfo) - f._delayInfo = f._delayInfo || [], - f._delayInfo.push(a); - return f._boundingInfo = new c.a(this._extend.minimum,this._extend.maximum), + } + var f = new e(t, this._scene, i, s); + for (a in ((f.delayLoadState = this.delayLoadState), + (f.delayLoadingFile = this.delayLoadingFile), + (f._delayLoadingFunction = this._delayLoadingFunction), + this._delayInfo)) + (f._delayInfo = f._delayInfo || []), + f._delayInfo.push(a); + return ( + (f._boundingInfo = new c.a( + this._extend.minimum, + this._extend.maximum + )), f - } - , - e.prototype.serialize = function() { - var e = {}; - return e.id = this.id, - e.updatable = this._updatable, - h.a && h.a.HasTags(this) && (e.tags = h.a.GetTags(this)), + ); + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.id = this.id), + (e.updatable = this._updatable), + h.a && + h.a.HasTags(this) && + (e.tags = h.a.GetTags(this)), e - } - , - e.prototype.toNumberArray = function(e) { - return Array.isArray(e) ? e : Array.prototype.slice.call(e) - } - , - e.prototype.serializeVerticeData = function() { - var e = this.serialize(); - return this.isVerticesDataPresent(o.b.PositionKind) && (e.positions = this.toNumberArray(this.getVerticesData(o.b.PositionKind)), - this.isVertexBufferUpdatable(o.b.PositionKind) && (e.positions._updatable = true)), - this.isVerticesDataPresent(o.b.NormalKind) && (e.normals = this.toNumberArray(this.getVerticesData(o.b.NormalKind)), - this.isVertexBufferUpdatable(o.b.NormalKind) && (e.normals._updatable = true)), - this.isVerticesDataPresent(o.b.TangentKind) && (e.tangets = this.toNumberArray(this.getVerticesData(o.b.TangentKind)), - this.isVertexBufferUpdatable(o.b.TangentKind) && (e.tangets._updatable = true)), - this.isVerticesDataPresent(o.b.UVKind) && (e.uvs = this.toNumberArray(this.getVerticesData(o.b.UVKind)), - this.isVertexBufferUpdatable(o.b.UVKind) && (e.uvs._updatable = true)), - this.isVerticesDataPresent(o.b.UV2Kind) && (e.uv2s = this.toNumberArray(this.getVerticesData(o.b.UV2Kind)), - this.isVertexBufferUpdatable(o.b.UV2Kind) && (e.uv2s._updatable = true)), - this.isVerticesDataPresent(o.b.UV3Kind) && (e.uv3s = this.toNumberArray(this.getVerticesData(o.b.UV3Kind)), - this.isVertexBufferUpdatable(o.b.UV3Kind) && (e.uv3s._updatable = true)), - this.isVerticesDataPresent(o.b.UV4Kind) && (e.uv4s = this.toNumberArray(this.getVerticesData(o.b.UV4Kind)), - this.isVertexBufferUpdatable(o.b.UV4Kind) && (e.uv4s._updatable = true)), - this.isVerticesDataPresent(o.b.UV5Kind) && (e.uv5s = this.toNumberArray(this.getVerticesData(o.b.UV5Kind)), - this.isVertexBufferUpdatable(o.b.UV5Kind) && (e.uv5s._updatable = true)), - this.isVerticesDataPresent(o.b.UV6Kind) && (e.uv6s = this.toNumberArray(this.getVerticesData(o.b.UV6Kind)), - this.isVertexBufferUpdatable(o.b.UV6Kind) && (e.uv6s._updatable = true)), - this.isVerticesDataPresent(o.b.ColorKind) && (e.colors = this.toNumberArray(this.getVerticesData(o.b.ColorKind)), - this.isVertexBufferUpdatable(o.b.ColorKind) && (e.colors._updatable = true)), - this.isVerticesDataPresent(o.b.MatricesIndicesKind) && (e.matricesIndices = this.toNumberArray(this.getVerticesData(o.b.MatricesIndicesKind)), - e.matricesIndices._isExpanded = true, - this.isVertexBufferUpdatable(o.b.MatricesIndicesKind) && (e.matricesIndices._updatable = true)), - this.isVerticesDataPresent(o.b.MatricesWeightsKind) && (e.matricesWeights = this.toNumberArray(this.getVerticesData(o.b.MatricesWeightsKind)), - this.isVertexBufferUpdatable(o.b.MatricesWeightsKind) && (e.matricesWeights._updatable = true)), - e.indices = this.toNumberArray(this.getIndices()), + ); + }), + (e.prototype.toNumberArray = function (e) { + return Array.isArray(e) + ? e + : Array.prototype.slice.call(e); + }), + (e.prototype.serializeVerticeData = function () { + var e = this.serialize(); + return ( + this.isVerticesDataPresent(o.b.PositionKind) && + ((e.positions = this.toNumberArray( + this.getVerticesData(o.b.PositionKind) + )), + this.isVertexBufferUpdatable(o.b.PositionKind) && + (e.positions._updatable = true)), + this.isVerticesDataPresent(o.b.NormalKind) && + ((e.normals = this.toNumberArray( + this.getVerticesData(o.b.NormalKind) + )), + this.isVertexBufferUpdatable(o.b.NormalKind) && + (e.normals._updatable = true)), + this.isVerticesDataPresent(o.b.TangentKind) && + ((e.tangets = this.toNumberArray( + this.getVerticesData(o.b.TangentKind) + )), + this.isVertexBufferUpdatable(o.b.TangentKind) && + (e.tangets._updatable = true)), + this.isVerticesDataPresent(o.b.UVKind) && + ((e.uvs = this.toNumberArray( + this.getVerticesData(o.b.UVKind) + )), + this.isVertexBufferUpdatable(o.b.UVKind) && + (e.uvs._updatable = true)), + this.isVerticesDataPresent(o.b.UV2Kind) && + ((e.uv2s = this.toNumberArray( + this.getVerticesData(o.b.UV2Kind) + )), + this.isVertexBufferUpdatable(o.b.UV2Kind) && + (e.uv2s._updatable = true)), + this.isVerticesDataPresent(o.b.UV3Kind) && + ((e.uv3s = this.toNumberArray( + this.getVerticesData(o.b.UV3Kind) + )), + this.isVertexBufferUpdatable(o.b.UV3Kind) && + (e.uv3s._updatable = true)), + this.isVerticesDataPresent(o.b.UV4Kind) && + ((e.uv4s = this.toNumberArray( + this.getVerticesData(o.b.UV4Kind) + )), + this.isVertexBufferUpdatable(o.b.UV4Kind) && + (e.uv4s._updatable = true)), + this.isVerticesDataPresent(o.b.UV5Kind) && + ((e.uv5s = this.toNumberArray( + this.getVerticesData(o.b.UV5Kind) + )), + this.isVertexBufferUpdatable(o.b.UV5Kind) && + (e.uv5s._updatable = true)), + this.isVerticesDataPresent(o.b.UV6Kind) && + ((e.uv6s = this.toNumberArray( + this.getVerticesData(o.b.UV6Kind) + )), + this.isVertexBufferUpdatable(o.b.UV6Kind) && + (e.uv6s._updatable = true)), + this.isVerticesDataPresent(o.b.ColorKind) && + ((e.colors = this.toNumberArray( + this.getVerticesData(o.b.ColorKind) + )), + this.isVertexBufferUpdatable(o.b.ColorKind) && + (e.colors._updatable = true)), + this.isVerticesDataPresent(o.b.MatricesIndicesKind) && + ((e.matricesIndices = this.toNumberArray( + this.getVerticesData(o.b.MatricesIndicesKind) + )), + (e.matricesIndices._isExpanded = true), + this.isVertexBufferUpdatable( + o.b.MatricesIndicesKind + ) && (e.matricesIndices._updatable = true)), + this.isVerticesDataPresent(o.b.MatricesWeightsKind) && + ((e.matricesWeights = this.toNumberArray( + this.getVerticesData(o.b.MatricesWeightsKind) + )), + this.isVertexBufferUpdatable( + o.b.MatricesWeightsKind + ) && (e.matricesWeights._updatable = true)), + (e.indices = this.toNumberArray(this.getIndices())), e - } - , - e.ExtractFromMesh = function(e, t) { - var i = e._geometry; - return i ? i.copy(t) : null - } - , - e.RandomId = function() { - return l.h.RandomId() - } - , - e._ImportGeometry = function(t, i) { - var r = i.getScene() - , s = t.geometryId; - if (s) { - var c = r.getGeometryByID(s); - c && c.applyToMesh(i) - } else if (t instanceof ArrayBuffer) { - var u = i._binaryInfo; - if (u.positionsAttrDesc && u.positionsAttrDesc.count > 0) { - var l = new Float32Array(t,u.positionsAttrDesc.offset,u.positionsAttrDesc.count); - i.setVerticesData(o.b.PositionKind, l, false) - } - if (u.normalsAttrDesc && u.normalsAttrDesc.count > 0) { - var h = new Float32Array(t,u.normalsAttrDesc.offset,u.normalsAttrDesc.count); - i.setVerticesData(o.b.NormalKind, h, false) - } - if (u.tangetsAttrDesc && u.tangetsAttrDesc.count > 0) { - var f = new Float32Array(t,u.tangetsAttrDesc.offset,u.tangetsAttrDesc.count); - i.setVerticesData(o.b.TangentKind, f, false) - } - if (u.uvsAttrDesc && u.uvsAttrDesc.count > 0) { - var d = new Float32Array(t,u.uvsAttrDesc.offset,u.uvsAttrDesc.count); - i.setVerticesData(o.b.UVKind, d, false) - } - if (u.uvs2AttrDesc && u.uvs2AttrDesc.count > 0) { - var p = new Float32Array(t,u.uvs2AttrDesc.offset,u.uvs2AttrDesc.count); - i.setVerticesData(o.b.UV2Kind, p, false) - } - if (u.uvs3AttrDesc && u.uvs3AttrDesc.count > 0) { - var m = new Float32Array(t,u.uvs3AttrDesc.offset,u.uvs3AttrDesc.count); - i.setVerticesData(o.b.UV3Kind, m, false) - } - if (u.uvs4AttrDesc && u.uvs4AttrDesc.count > 0) { - var g = new Float32Array(t,u.uvs4AttrDesc.offset,u.uvs4AttrDesc.count); - i.setVerticesData(o.b.UV4Kind, g, false) - } - if (u.uvs5AttrDesc && u.uvs5AttrDesc.count > 0) { - var _ = new Float32Array(t,u.uvs5AttrDesc.offset,u.uvs5AttrDesc.count); - i.setVerticesData(o.b.UV5Kind, _, false) - } - if (u.uvs6AttrDesc && u.uvs6AttrDesc.count > 0) { - var v = new Float32Array(t,u.uvs6AttrDesc.offset,u.uvs6AttrDesc.count); - i.setVerticesData(o.b.UV6Kind, v, false) - } - if (u.colorsAttrDesc && u.colorsAttrDesc.count > 0) { - var y = new Float32Array(t,u.colorsAttrDesc.offset,u.colorsAttrDesc.count); - i.setVerticesData(o.b.ColorKind, y, false, u.colorsAttrDesc.stride) - } - if (u.matricesIndicesAttrDesc && u.matricesIndicesAttrDesc.count > 0) { - for (var b = new Int32Array(t,u.matricesIndicesAttrDesc.offset,u.matricesIndicesAttrDesc.count), E = [], T = 0; T < b.length; T++) { - var A = b[T]; - E.push(255 & A), - E.push((65280 & A) >> 8), - E.push((16711680 & A) >> 16), - E.push(A >> 24) - } - i.setVerticesData(o.b.MatricesIndicesKind, E, false) - } - if (u.matricesWeightsAttrDesc && u.matricesWeightsAttrDesc.count > 0) { - var x = new Float32Array(t,u.matricesWeightsAttrDesc.offset,u.matricesWeightsAttrDesc.count); - i.setVerticesData(o.b.MatricesWeightsKind, x, false) - } - if (u.indicesAttrDesc && u.indicesAttrDesc.count > 0) { - var S = new Int32Array(t,u.indicesAttrDesc.offset,u.indicesAttrDesc.count); - i.setIndices(S, null) - } - if (u.subMeshesAttrDesc && u.subMeshesAttrDesc.count > 0) { - var C = new Int32Array(t,u.subMeshesAttrDesc.offset,5 * u.subMeshesAttrDesc.count); - for (i.subMeshes = [], - T = 0; T < u.subMeshesAttrDesc.count; T++) { - var P = C[5 * T + 0] - , R = C[5 * T + 1] - , M = C[5 * T + 2] - , O = C[5 * T + 3] - , w = C[5 * T + 4]; - a.b.AddToMesh(P, R, M, O, w, i) - } - } - } else if (t.positions && t.normals && t.indices) { - if (i.setVerticesData(o.b.PositionKind, t.positions, t.positions._updatable), - i.setVerticesData(o.b.NormalKind, t.normals, t.normals._updatable), - t.tangents && i.setVerticesData(o.b.TangentKind, t.tangents, t.tangents._updatable), - t.uvs && i.setVerticesData(o.b.UVKind, t.uvs, t.uvs._updatable), - t.uvs2 && i.setVerticesData(o.b.UV2Kind, t.uvs2, t.uvs2._updatable), - t.uvs3 && i.setVerticesData(o.b.UV3Kind, t.uvs3, t.uvs3._updatable), - t.uvs4 && i.setVerticesData(o.b.UV4Kind, t.uvs4, t.uvs4._updatable), - t.uvs5 && i.setVerticesData(o.b.UV5Kind, t.uvs5, t.uvs5._updatable), - t.uvs6 && i.setVerticesData(o.b.UV6Kind, t.uvs6, t.uvs6._updatable), - t.colors && i.setVerticesData(o.b.ColorKind, n.f.CheckColors4(t.colors, t.positions.length / 3), t.colors._updatable), - t.matricesIndices) - if (t.matricesIndices._isExpanded) - delete t.matricesIndices._isExpanded, - i.setVerticesData(o.b.MatricesIndicesKind, t.matricesIndices, t.matricesIndices._updatable); - else { - for (E = [], - T = 0; T < t.matricesIndices.length; T++) { - var I = t.matricesIndices[T]; - E.push(255 & I), - E.push((65280 & I) >> 8), - E.push((16711680 & I) >> 16), - E.push(I >> 24) - } - i.setVerticesData(o.b.MatricesIndicesKind, E, t.matricesIndices._updatable) - } - if (t.matricesIndicesExtra) - if (t.matricesIndicesExtra._isExpanded) - delete t.matricesIndices._isExpanded, - i.setVerticesData(o.b.MatricesIndicesExtraKind, t.matricesIndicesExtra, t.matricesIndicesExtra._updatable); - else { - for (E = [], - T = 0; T < t.matricesIndicesExtra.length; T++) - I = t.matricesIndicesExtra[T], - E.push(255 & I), - E.push((65280 & I) >> 8), - E.push((16711680 & I) >> 16), - E.push(I >> 24); - i.setVerticesData(o.b.MatricesIndicesExtraKind, E, t.matricesIndicesExtra._updatable) - } - t.matricesWeights && (e._CleanMatricesWeights(t, i), - i.setVerticesData(o.b.MatricesWeightsKind, t.matricesWeights, t.matricesWeights._updatable)), - t.matricesWeightsExtra && i.setVerticesData(o.b.MatricesWeightsExtraKind, t.matricesWeightsExtra, t.matricesWeights._updatable), - i.setIndices(t.indices, null) + ); + }), + (e.ExtractFromMesh = function (e, t) { + var i = e._geometry; + return i ? i.copy(t) : null; + }), + (e.RandomId = function () { + return l.h.RandomId(); + }), + (e._ImportGeometry = function (t, i) { + var r = i.getScene(), + s = t.geometryId; + if (s) { + var c = r.getGeometryByID(s); + c && c.applyToMesh(i); + } else if (t instanceof ArrayBuffer) { + var u = i._binaryInfo; + if ( + u.positionsAttrDesc && + u.positionsAttrDesc.count > 0 + ) { + var l = new Float32Array( + t, + u.positionsAttrDesc.offset, + u.positionsAttrDesc.count + ); + i.setVerticesData(o.b.PositionKind, l, false); } - if (t.subMeshes) { - i.subMeshes = []; - for (var D = 0; D < t.subMeshes.length; D++) { - var L = t.subMeshes[D]; - a.b.AddToMesh(L.materialIndex, L.verticesStart, L.verticesCount, L.indexStart, L.indexCount, i) - } + if (u.normalsAttrDesc && u.normalsAttrDesc.count > 0) { + var h = new Float32Array( + t, + u.normalsAttrDesc.offset, + u.normalsAttrDesc.count + ); + i.setVerticesData(o.b.NormalKind, h, false); } - i._shouldGenerateFlatShading && (i.convertToFlatShadedMesh(), + if (u.tangetsAttrDesc && u.tangetsAttrDesc.count > 0) { + var f = new Float32Array( + t, + u.tangetsAttrDesc.offset, + u.tangetsAttrDesc.count + ); + i.setVerticesData(o.b.TangentKind, f, false); + } + if (u.uvsAttrDesc && u.uvsAttrDesc.count > 0) { + var d = new Float32Array( + t, + u.uvsAttrDesc.offset, + u.uvsAttrDesc.count + ); + i.setVerticesData(o.b.UVKind, d, false); + } + if (u.uvs2AttrDesc && u.uvs2AttrDesc.count > 0) { + var p = new Float32Array( + t, + u.uvs2AttrDesc.offset, + u.uvs2AttrDesc.count + ); + i.setVerticesData(o.b.UV2Kind, p, false); + } + if (u.uvs3AttrDesc && u.uvs3AttrDesc.count > 0) { + var m = new Float32Array( + t, + u.uvs3AttrDesc.offset, + u.uvs3AttrDesc.count + ); + i.setVerticesData(o.b.UV3Kind, m, false); + } + if (u.uvs4AttrDesc && u.uvs4AttrDesc.count > 0) { + var g = new Float32Array( + t, + u.uvs4AttrDesc.offset, + u.uvs4AttrDesc.count + ); + i.setVerticesData(o.b.UV4Kind, g, false); + } + if (u.uvs5AttrDesc && u.uvs5AttrDesc.count > 0) { + var _ = new Float32Array( + t, + u.uvs5AttrDesc.offset, + u.uvs5AttrDesc.count + ); + i.setVerticesData(o.b.UV5Kind, _, false); + } + if (u.uvs6AttrDesc && u.uvs6AttrDesc.count > 0) { + var v = new Float32Array( + t, + u.uvs6AttrDesc.offset, + u.uvs6AttrDesc.count + ); + i.setVerticesData(o.b.UV6Kind, v, false); + } + if (u.colorsAttrDesc && u.colorsAttrDesc.count > 0) { + var y = new Float32Array( + t, + u.colorsAttrDesc.offset, + u.colorsAttrDesc.count + ); + i.setVerticesData( + o.b.ColorKind, + y, + false, + u.colorsAttrDesc.stride + ); + } + if ( + u.matricesIndicesAttrDesc && + u.matricesIndicesAttrDesc.count > 0 + ) { + for ( + var b = new Int32Array( + t, + u.matricesIndicesAttrDesc.offset, + u.matricesIndicesAttrDesc.count + ), + E = [], + T = 0; + T < b.length; + T++ + ) { + var A = b[T]; + E.push(255 & A), + E.push((65280 & A) >> 8), + E.push((16711680 & A) >> 16), + E.push(A >> 24); + } + i.setVerticesData(o.b.MatricesIndicesKind, E, false); + } + if ( + u.matricesWeightsAttrDesc && + u.matricesWeightsAttrDesc.count > 0 + ) { + var x = new Float32Array( + t, + u.matricesWeightsAttrDesc.offset, + u.matricesWeightsAttrDesc.count + ); + i.setVerticesData(o.b.MatricesWeightsKind, x, false); + } + if (u.indicesAttrDesc && u.indicesAttrDesc.count > 0) { + var S = new Int32Array( + t, + u.indicesAttrDesc.offset, + u.indicesAttrDesc.count + ); + i.setIndices(S, null); + } + if ( + u.subMeshesAttrDesc && + u.subMeshesAttrDesc.count > 0 + ) { + var C = new Int32Array( + t, + u.subMeshesAttrDesc.offset, + 5 * u.subMeshesAttrDesc.count + ); + for ( + i.subMeshes = [], T = 0; + T < u.subMeshesAttrDesc.count; + T++ + ) { + var P = C[5 * T + 0], + R = C[5 * T + 1], + M = C[5 * T + 2], + O = C[5 * T + 3], + w = C[5 * T + 4]; + a.b.AddToMesh(P, R, M, O, w, i); + } + } + } else if (t.positions && t.normals && t.indices) { + if ( + (i.setVerticesData( + o.b.PositionKind, + t.positions, + t.positions._updatable + ), + i.setVerticesData( + o.b.NormalKind, + t.normals, + t.normals._updatable + ), + t.tangents && + i.setVerticesData( + o.b.TangentKind, + t.tangents, + t.tangents._updatable + ), + t.uvs && + i.setVerticesData( + o.b.UVKind, + t.uvs, + t.uvs._updatable + ), + t.uvs2 && + i.setVerticesData( + o.b.UV2Kind, + t.uvs2, + t.uvs2._updatable + ), + t.uvs3 && + i.setVerticesData( + o.b.UV3Kind, + t.uvs3, + t.uvs3._updatable + ), + t.uvs4 && + i.setVerticesData( + o.b.UV4Kind, + t.uvs4, + t.uvs4._updatable + ), + t.uvs5 && + i.setVerticesData( + o.b.UV5Kind, + t.uvs5, + t.uvs5._updatable + ), + t.uvs6 && + i.setVerticesData( + o.b.UV6Kind, + t.uvs6, + t.uvs6._updatable + ), + t.colors && + i.setVerticesData( + o.b.ColorKind, + n.f.CheckColors4( + t.colors, + t.positions.length / 3 + ), + t.colors._updatable + ), + t.matricesIndices) + ) + if (t.matricesIndices._isExpanded) + delete t.matricesIndices._isExpanded, + i.setVerticesData( + o.b.MatricesIndicesKind, + t.matricesIndices, + t.matricesIndices._updatable + ); + else { + for ( + E = [], T = 0; + T < t.matricesIndices.length; + T++ + ) { + var I = t.matricesIndices[T]; + E.push(255 & I), + E.push((65280 & I) >> 8), + E.push((16711680 & I) >> 16), + E.push(I >> 24); + } + i.setVerticesData( + o.b.MatricesIndicesKind, + E, + t.matricesIndices._updatable + ); + } + if (t.matricesIndicesExtra) + if (t.matricesIndicesExtra._isExpanded) + delete t.matricesIndices._isExpanded, + i.setVerticesData( + o.b.MatricesIndicesExtraKind, + t.matricesIndicesExtra, + t.matricesIndicesExtra._updatable + ); + else { + for ( + E = [], T = 0; + T < t.matricesIndicesExtra.length; + T++ + ) + (I = t.matricesIndicesExtra[T]), + E.push(255 & I), + E.push((65280 & I) >> 8), + E.push((16711680 & I) >> 16), + E.push(I >> 24); + i.setVerticesData( + o.b.MatricesIndicesExtraKind, + E, + t.matricesIndicesExtra._updatable + ); + } + t.matricesWeights && + (e._CleanMatricesWeights(t, i), + i.setVerticesData( + o.b.MatricesWeightsKind, + t.matricesWeights, + t.matricesWeights._updatable + )), + t.matricesWeightsExtra && + i.setVerticesData( + o.b.MatricesWeightsExtraKind, + t.matricesWeightsExtra, + t.matricesWeights._updatable + ), + i.setIndices(t.indices, null); + } + if (t.subMeshes) { + i.subMeshes = []; + for (var D = 0; D < t.subMeshes.length; D++) { + var L = t.subMeshes[D]; + a.b.AddToMesh( + L.materialIndex, + L.verticesStart, + L.verticesCount, + L.indexStart, + L.indexCount, + i + ); + } + } + i._shouldGenerateFlatShading && + (i.convertToFlatShadedMesh(), delete i._shouldGenerateFlatShading), i.computeWorldMatrix(true), - r.onMeshImportedObservable.notifyObservers(i) - } - , - e._CleanMatricesWeights = function(e, t) { - if (s.a.CleanBoneMatrixWeights) { - var i = 0; - if (e.skeletonId > -1) { - var n = t.getScene().getLastSkeletonByID(e.skeletonId); - if (n) { - i = n.bones.length; - for (var r = t.getVerticesData(o.b.MatricesIndicesKind), a = t.getVerticesData(o.b.MatricesIndicesExtraKind), c = e.matricesWeights, u = e.matricesWeightsExtra, l = e.numBoneInfluencer, h = c.length, f = 0; f < h; f += 4) { - for (var d = 0, p = -1, m = 0; m < 4; m++) - d += g = c[f + m], - g < .001 && p < 0 && (p = m); - if (u) - for (m = 0; m < 4; m++) { - var g; - d += g = u[f + m], - g < .001 && p < 0 && (p = m + 4) - } - if ((p < 0 || p > l - 1) && (p = l - 1), - d > .001) { - var _ = 1 / d; - for (m = 0; m < 4; m++) - c[f + m] *= _; - if (u) - for (m = 0; m < 4; m++) - u[f + m] *= _ - } else - p >= 4 ? (u[f + p - 4] = 1 - d, - a[f + p - 4] = i) : (c[f + p] = 1 - d, - r[f + p] = i) - } - t.setVerticesData(o.b.MatricesIndicesKind, r), - e.matricesWeightsExtra && t.setVerticesData(o.b.MatricesIndicesExtraKind, a) + r.onMeshImportedObservable.notifyObservers(i); + }), + (e._CleanMatricesWeights = function (e, t) { + if (s.a.CleanBoneMatrixWeights) { + var i = 0; + if (e.skeletonId > -1) { + var n = t + .getScene() + .getLastSkeletonByID(e.skeletonId); + if (n) { + i = n.bones.length; + for ( + var r = t.getVerticesData( + o.b.MatricesIndicesKind + ), + a = t.getVerticesData( + o.b.MatricesIndicesExtraKind + ), + c = e.matricesWeights, + u = e.matricesWeightsExtra, + l = e.numBoneInfluencer, + h = c.length, + f = 0; + f < h; + f += 4 + ) { + for (var d = 0, p = -1, m = 0; m < 4; m++) + (d += g = c[f + m]), + g < 0.001 && p < 0 && (p = m); + if (u) + for (m = 0; m < 4; m++) { + var g; + (d += g = u[f + m]), + g < 0.001 && p < 0 && (p = m + 4); } + if ( + ((p < 0 || p > l - 1) && (p = l - 1), d > 0.001) + ) { + var _ = 1 / d; + for (m = 0; m < 4; m++) c[f + m] *= _; + if (u) for (m = 0; m < 4; m++) u[f + m] *= _; + } else + p >= 4 + ? ((u[f + p - 4] = 1 - d), (a[f + p - 4] = i)) + : ((c[f + p] = 1 - d), (r[f + p] = i)); } + t.setVerticesData(o.b.MatricesIndicesKind, r), + e.matricesWeightsExtra && + t.setVerticesData( + o.b.MatricesIndicesExtraKind, + a + ); + } } - } - , - e.Parse = function(t, i, a) { - if (i.getGeometryByID(t.id)) - return null; - var s = new e(t.id,i,void 0,t.updatable); - return h.a && h.a.AddTagsTo(s, t.tags), - t.delayLoadingFile ? (s.delayLoadState = u.a.DELAYLOADSTATE_NOTLOADED, - s.delayLoadingFile = a + t.delayLoadingFile, - s._boundingInfo = new c.a(n.x.FromArray(t.boundingBoxMinimum),n.x.FromArray(t.boundingBoxMaximum)), - s._delayInfo = [], - t.hasUVs && s._delayInfo.push(o.b.UVKind), - t.hasUVs2 && s._delayInfo.push(o.b.UV2Kind), - t.hasUVs3 && s._delayInfo.push(o.b.UV3Kind), - t.hasUVs4 && s._delayInfo.push(o.b.UV4Kind), - t.hasUVs5 && s._delayInfo.push(o.b.UV5Kind), - t.hasUVs6 && s._delayInfo.push(o.b.UV6Kind), - t.hasColors && s._delayInfo.push(o.b.ColorKind), - t.hasMatricesIndices && s._delayInfo.push(o.b.MatricesIndicesKind), - t.hasMatricesWeights && s._delayInfo.push(o.b.MatricesWeightsKind), - s._delayLoadingFunction = r.a.ImportVertexData) : r.a.ImportVertexData(t, s), + } + }), + (e.Parse = function (t, i, a) { + if (i.getGeometryByID(t.id)) return null; + var s = new e(t.id, i, void 0, t.updatable); + return ( + h.a && h.a.AddTagsTo(s, t.tags), + t.delayLoadingFile + ? ((s.delayLoadState = u.a.DELAYLOADSTATE_NOTLOADED), + (s.delayLoadingFile = a + t.delayLoadingFile), + (s._boundingInfo = new c.a( + n.x.FromArray(t.boundingBoxMinimum), + n.x.FromArray(t.boundingBoxMaximum) + )), + (s._delayInfo = []), + t.hasUVs && s._delayInfo.push(o.b.UVKind), + t.hasUVs2 && s._delayInfo.push(o.b.UV2Kind), + t.hasUVs3 && s._delayInfo.push(o.b.UV3Kind), + t.hasUVs4 && s._delayInfo.push(o.b.UV4Kind), + t.hasUVs5 && s._delayInfo.push(o.b.UV5Kind), + t.hasUVs6 && s._delayInfo.push(o.b.UV6Kind), + t.hasColors && s._delayInfo.push(o.b.ColorKind), + t.hasMatricesIndices && + s._delayInfo.push(o.b.MatricesIndicesKind), + t.hasMatricesWeights && + s._delayInfo.push(o.b.MatricesWeightsKind), + (s._delayLoadingFunction = r.a.ImportVertexData)) + : r.a.ImportVertexData(t, s), i.pushGeometry(s, true), s - } - , + ); + }), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return f - }); - var n = i(1) - , r = i(8) - , o = i(0) - , a = i(42) - , s = i(53) - , c = i(54) - , u = i(48) - , l = i(41) - , h = i(33) - , f = function(e) { - function t(i, n, a) { - void 0 === n && (n = o.e.Gray()), - void 0 === a && (a = l.a.DefaultUtilityLayer); - var s = e.call(this, a) || this; - s._pointerObserver = null, - s.snapDistance = 0, - s.onSnapObservable = new r.c; - var u = new h.a("",a.utilityLayerScene); - u.diffuseColor = n, - u.specularColor = n.subtract(new o.e(.1,.1,.1)); - var f = new h.a("",a.utilityLayerScene); - f.diffuseColor = n.add(new o.e(.3,.3,.3)); - var d = t._CreateArrow(a.utilityLayerScene, u); - d.lookAt(s._rootMesh.position.add(i)), - d.scaling.scaleInPlace(1 / 3), - d.parent = s._rootMesh; - var p = 0 - , m = new o.x - , g = { - snapDistance: 0 - }; - s.dragBehavior = new c.a({ - dragAxis: i - }), - s.dragBehavior.moveAttached = false, - s._rootMesh.addBehavior(s.dragBehavior); - var _ = new o.x - , v = new o.j; - s.dragBehavior.onDragObservable.add(function(e) { - if (s.attachedMesh) - if (s.attachedMesh.parent ? (s.attachedMesh.parent.computeWorldMatrix().invertToRef(v), - v.setTranslationFromFloats(0, 0, 0), - o.x.TransformCoordinatesToRef(e.delta, v, _)) : _.copyFrom(e.delta), - 0 == s.snapDistance) - s.attachedMesh.position.addInPlace(_); - else if (p += e.dragDistance, - Math.abs(p) > s.snapDistance) { - var t = Math.floor(Math.abs(p) / s.snapDistance); - p %= s.snapDistance, - _.normalizeToRef(m), - m.scaleInPlace(s.snapDistance * t), - s.attachedMesh.position.addInPlace(m), - g.snapDistance = s.snapDistance * t, - s.onSnapObservable.notifyObservers(g) - } - }), - s._pointerObserver = a.utilityLayerScene.onPointerObservable.add(function(e) { - if (!s._customMeshSet) { - var t = e.pickInfo && -1 != s._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh) ? f : u; - s._rootMesh.getChildMeshes().forEach(function(e) { - e.material = t, - e.color && (e.color = t.diffuseColor) - }) - } - }); - var y = a._getSharedGizmoLight(); - return y.includedOnlyMeshes = y.includedOnlyMeshes.concat(s._rootMesh.getChildMeshes(false)), - s - } - return n.d(t, e), - t._CreateArrow = function(e, t) { - var i = new a.a("arrow",e) - , n = s.a.CreateCylinder("cylinder", { + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return f; + }); + var n = i(1), + r = i(8), + o = i(0), + a = i(42), + s = i(53), + c = i(54), + u = i(48), + l = i(41), + h = i(33), + f = (function (e) { + function t(i, n, a) { + void 0 === n && (n = o.e.Gray()), + void 0 === a && (a = l.a.DefaultUtilityLayer); + var s = e.call(this, a) || this; + (s._pointerObserver = null), + (s.snapDistance = 0), + (s.onSnapObservable = new r.c()); + var u = new h.a("", a.utilityLayerScene); + (u.diffuseColor = n), + (u.specularColor = n.subtract(new o.e(0.1, 0.1, 0.1))); + var f = new h.a("", a.utilityLayerScene); + f.diffuseColor = n.add(new o.e(0.3, 0.3, 0.3)); + var d = t._CreateArrow(a.utilityLayerScene, u); + d.lookAt(s._rootMesh.position.add(i)), + d.scaling.scaleInPlace(1 / 3), + (d.parent = s._rootMesh); + var p = 0, + m = new o.x(), + g = { + snapDistance: 0, + }; + (s.dragBehavior = new c.a({ + dragAxis: i, + })), + (s.dragBehavior.moveAttached = false), + s._rootMesh.addBehavior(s.dragBehavior); + var _ = new o.x(), + v = new o.j(); + s.dragBehavior.onDragObservable.add(function (e) { + if (s.attachedMesh) + if ( + (s.attachedMesh.parent + ? (s.attachedMesh.parent + .computeWorldMatrix() + .invertToRef(v), + v.setTranslationFromFloats(0, 0, 0), + o.x.TransformCoordinatesToRef(e.delta, v, _)) + : _.copyFrom(e.delta), + 0 == s.snapDistance) + ) + s.attachedMesh.position.addInPlace(_); + else if ( + ((p += e.dragDistance), Math.abs(p) > s.snapDistance) + ) { + var t = Math.floor(Math.abs(p) / s.snapDistance); + (p %= s.snapDistance), + _.normalizeToRef(m), + m.scaleInPlace(s.snapDistance * t), + s.attachedMesh.position.addInPlace(m), + (g.snapDistance = s.snapDistance * t), + s.onSnapObservable.notifyObservers(g); + } + }), + (s._pointerObserver = + a.utilityLayerScene.onPointerObservable.add(function ( + e + ) { + if (!s._customMeshSet) { + var t = + e.pickInfo && + -1 != + s._rootMesh + .getChildMeshes() + .indexOf(e.pickInfo.pickedMesh) + ? f + : u; + s._rootMesh.getChildMeshes().forEach(function (e) { + (e.material = t), + e.color && (e.color = t.diffuseColor); + }); + } + })); + var y = a._getSharedGizmoLight(); + return ( + (y.includedOnlyMeshes = y.includedOnlyMeshes.concat( + s._rootMesh.getChildMeshes(false) + )), + s + ); + } + return ( + n.d(t, e), + (t._CreateArrow = function (e, t) { + var i = new a.a("arrow", e), + n = s.a.CreateCylinder( + "cylinder", + { diameterTop: 0, - height: .075, - diameterBottom: .0375, - tessellation: 96 - }, e) - , r = s.a.CreateCylinder("cylinder", { - diameterTop: .005, - height: .275, - diameterBottom: .005, - tessellation: 96 - }, e); - return r.material = t, - n.parent = i, - r.parent = i, - n.material = t, - n.rotation.x = Math.PI / 2, - n.position.z += .3, - r.position.z += .1375, - r.rotation.x = Math.PI / 2, + height: 0.075, + diameterBottom: 0.0375, + tessellation: 96, + }, + e + ), + r = s.a.CreateCylinder( + "cylinder", + { + diameterTop: 0.005, + height: 0.275, + diameterBottom: 0.005, + tessellation: 96, + }, + e + ); + return ( + (r.material = t), + (n.parent = i), + (r.parent = i), + (n.material = t), + (n.rotation.x = Math.PI / 2), + (n.position.z += 0.3), + (r.position.z += 0.1375), + (r.rotation.x = Math.PI / 2), i - } - , - t._CreateArrowInstance = function(e, t) { - for (var i = new a.a("arrow",e), n = 0, r = t.getChildMeshes(); n < r.length; n++) { - var o = r[n]; - o.createInstance(o.name).parent = i - } - return i - } - , - t.prototype._attachedMeshChanged = function(e) { - this.dragBehavior && (this.dragBehavior.enabled = !!e) - } - , - t.prototype.dispose = function() { - this.onSnapObservable.clear(), - this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), + ); + }), + (t._CreateArrowInstance = function (e, t) { + for ( + var i = new a.a("arrow", e), + n = 0, + r = t.getChildMeshes(); + n < r.length; + n++ + ) { + var o = r[n]; + o.createInstance(o.name).parent = i; + } + return i; + }), + (t.prototype._attachedMeshChanged = function (e) { + this.dragBehavior && (this.dragBehavior.enabled = !!e); + }), + (t.prototype.dispose = function () { + this.onSnapObservable.clear(), + this.gizmoLayer.utilityLayerScene.onPointerObservable.remove( + this._pointerObserver + ), this.dragBehavior.detach(), - e.prototype.dispose.call(this) - } - , + e.prototype.dispose.call(this); + }), t - }(u.a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n + ); + })(u.a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return (e.FilesToLoad = {}), e; + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() { + this._xhr = new XMLHttpRequest(); + } + return ( + (e.prototype._injectCustomRequestHeaders = function () { + for (var t in e.CustomRequestHeaders) { + var i = e.CustomRequestHeaders[t]; + i && this._xhr.setRequestHeader(t, i); + } + }), + Object.defineProperty(e.prototype, "onprogress", { + get: function () { + return this._xhr.onprogress; + }, + set: function (e) { + this._xhr.onprogress = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "readyState", { + get: function () { + return this._xhr.readyState; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "status", { + get: function () { + return this._xhr.status; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "statusText", { + get: function () { + return this._xhr.statusText; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "response", { + get: function () { + return this._xhr.response; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "responseURL", { + get: function () { + return this._xhr.responseURL; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "responseText", { + get: function () { + return this._xhr.responseText; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "responseType", { + get: function () { + return this._xhr.responseType; + }, + set: function (e) { + this._xhr.responseType = e; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.addEventListener = function (e, t, i) { + this._xhr.addEventListener(e, t, i); + }), + (e.prototype.removeEventListener = function (e, t, i) { + this._xhr.removeEventListener(e, t, i); + }), + (e.prototype.abort = function () { + this._xhr.abort(); + }), + (e.prototype.send = function (t) { + e.CustomRequestHeaders && + this._injectCustomRequestHeaders(), + this._xhr.send(t); + }), + (e.prototype.open = function (t, i) { + for ( + var n = 0, r = e.CustomRequestModifiers; + n < r.length; + n++ + ) + (0, r[n])(this._xhr); + return this._xhr.open(t, i, true); + }), + (e.CustomRequestHeaders = {}), + (e.CustomRequestModifiers = new Array()), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() { + (this._count = 0), (this._data = {}); + } + return ( + (e.prototype.copyFrom = function (e) { + var t = this; + this.clear(), + e.forEach(function (e, i) { + return t.add(e, i); + }); + }), + (e.prototype.get = function (e) { + var t = this._data[e]; + if (void 0 !== t) return t; + }), + (e.prototype.getOrAddWithFactory = function (e, t) { + var i = this.get(e); + return void 0 !== i ? i : ((i = t(e)) && this.add(e, i), i); + }), + (e.prototype.getOrAdd = function (e, t) { + var i = this.get(e); + return void 0 !== i ? i : (this.add(e, t), t); + }), + (e.prototype.contains = function (e) { + return void 0 !== this._data[e]; + }), + (e.prototype.add = function (e, t) { + return ( + void 0 === this._data[e] && + ((this._data[e] = t), ++this._count, true) + ); + }), + (e.prototype.set = function (e, t) { + return ( + void 0 !== this._data[e] && ((this._data[e] = t), true) + ); + }), + (e.prototype.getAndRemove = function (e) { + var t = this.get(e); + return void 0 !== t + ? (delete this._data[e], --this._count, t) + : null; + }), + (e.prototype.remove = function (e) { + return ( + !!this.contains(e) && + (delete this._data[e], --this._count, true) + ); + }), + (e.prototype.clear = function () { + (this._data = {}), (this._count = 0); + }), + Object.defineProperty(e.prototype, "count", { + get: function () { + return this._count; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.forEach = function (e) { + for (var t in this._data) e(t, this._data[t]); + }), + (e.prototype.first = function (e) { + for (var t in this._data) { + var i = e(t, this._data[t]); + if (i) return i; + } + return null; + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return c; + }), + i.d(t, "b", function () { + return u; }); - var n = function() { - function e() {} - return e.FilesToLoad = {}, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() { - this._xhr = new XMLHttpRequest - } - return e.prototype._injectCustomRequestHeaders = function() { - for (var t in e.CustomRequestHeaders) { - var i = e.CustomRequestHeaders[t]; - i && this._xhr.setRequestHeader(t, i) - } - } - , - Object.defineProperty(e.prototype, "onprogress", { - get: function() { - return this._xhr.onprogress - }, - set: function(e) { - this._xhr.onprogress = e - }, - enumerable: true, - configurable: true + var n = i(0), + r = [ + Math.sqrt(1 / (4 * Math.PI)), + -Math.sqrt(3 / (4 * Math.PI)), + Math.sqrt(3 / (4 * Math.PI)), + -Math.sqrt(3 / (4 * Math.PI)), + Math.sqrt(15 / (4 * Math.PI)), + -Math.sqrt(15 / (4 * Math.PI)), + Math.sqrt(5 / (16 * Math.PI)), + -Math.sqrt(15 / (4 * Math.PI)), + Math.sqrt(15 / (16 * Math.PI)), + ], + o = [ + function (e) { + return 1; + }, + function (e) { + return e.y; + }, + function (e) { + return e.z; + }, + function (e) { + return e.x; + }, + function (e) { + return e.x * e.y; + }, + function (e) { + return e.y * e.z; + }, + function (e) { + return 3 * e.z * e.z - 1; + }, + function (e) { + return e.x * e.z; + }, + function (e) { + return e.x * e.x - e.y * e.y; + }, + ], + a = function (e, t) { + return r[e] * o[e](t); + }, + s = [ + Math.PI, + (2 * Math.PI) / 3, + (2 * Math.PI) / 3, + (2 * Math.PI) / 3, + Math.PI / 4, + Math.PI / 4, + Math.PI / 4, + Math.PI / 4, + Math.PI / 4, + ], + c = (function () { + function e() { + (this.preScaled = false), + (this.l00 = n.x.Zero()), + (this.l1_1 = n.x.Zero()), + (this.l10 = n.x.Zero()), + (this.l11 = n.x.Zero()), + (this.l2_2 = n.x.Zero()), + (this.l2_1 = n.x.Zero()), + (this.l20 = n.x.Zero()), + (this.l21 = n.x.Zero()), + (this.l22 = n.x.Zero()); + } + return ( + (e.prototype.addLight = function (e, t, i) { + var r = new n.x(t.r, t.g, t.b).scale(i); + (this.l00 = this.l00.add(r.scale(a(0, e)))), + (this.l1_1 = this.l1_1.add(r.scale(a(1, e)))), + (this.l10 = this.l10.add(r.scale(a(2, e)))), + (this.l11 = this.l11.add(r.scale(a(3, e)))), + (this.l2_2 = this.l2_2.add(r.scale(a(4, e)))), + (this.l2_1 = this.l2_1.add(r.scale(a(5, e)))), + (this.l20 = this.l20.add(r.scale(a(6, e)))), + (this.l21 = this.l21.add(r.scale(a(7, e)))), + (this.l22 = this.l22.add(r.scale(a(8, e)))); }), - Object.defineProperty(e.prototype, "readyState", { - get: function() { - return this._xhr.readyState - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "status", { - get: function() { - return this._xhr.status - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "statusText", { - get: function() { - return this._xhr.statusText - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "response", { - get: function() { - return this._xhr.response - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "responseURL", { - get: function() { - return this._xhr.responseURL - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "responseText", { - get: function() { - return this._xhr.responseText - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "responseType", { - get: function() { - return this._xhr.responseType - }, - set: function(e) { - this._xhr.responseType = e - }, - enumerable: true, - configurable: true - }), - e.prototype.addEventListener = function(e, t, i) { - this._xhr.addEventListener(e, t, i) - } - , - e.prototype.removeEventListener = function(e, t, i) { - this._xhr.removeEventListener(e, t, i) - } - , - e.prototype.abort = function() { - this._xhr.abort() - } - , - e.prototype.send = function(t) { - e.CustomRequestHeaders && this._injectCustomRequestHeaders(), - this._xhr.send(t) - } - , - e.prototype.open = function(t, i) { - for (var n = 0, r = e.CustomRequestModifiers; n < r.length; n++) - (0, - r[n])(this._xhr); - return this._xhr.open(t, i, true) - } - , - e.CustomRequestHeaders = {}, - e.CustomRequestModifiers = new Array, - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() { - this._count = 0, - this._data = {} - } - return e.prototype.copyFrom = function(e) { - var t = this; - this.clear(), - e.forEach(function(e, i) { - return t.add(e, i) - }) - } - , - e.prototype.get = function(e) { - var t = this._data[e]; - if (void 0 !== t) - return t - } - , - e.prototype.getOrAddWithFactory = function(e, t) { - var i = this.get(e); - return void 0 !== i ? i : ((i = t(e)) && this.add(e, i), - i) - } - , - e.prototype.getOrAdd = function(e, t) { - var i = this.get(e); - return void 0 !== i ? i : (this.add(e, t), - t) - } - , - e.prototype.contains = function(e) { - return void 0 !== this._data[e] - } - , - e.prototype.add = function(e, t) { - return void 0 === this._data[e] && (this._data[e] = t, - ++this._count, - true) - } - , - e.prototype.set = function(e, t) { - return void 0 !== this._data[e] && (this._data[e] = t, - true) - } - , - e.prototype.getAndRemove = function(e) { - var t = this.get(e); - return void 0 !== t ? (delete this._data[e], - --this._count, - t) : null - } - , - e.prototype.remove = function(e) { - return !!this.contains(e) && (delete this._data[e], - --this._count, - true) - } - , - e.prototype.clear = function() { - this._data = {}, - this._count = 0 - } - , - Object.defineProperty(e.prototype, "count", { - get: function() { - return this._count - }, - enumerable: true, - configurable: true - }), - e.prototype.forEach = function(e) { - for (var t in this._data) - e(t, this._data[t]) - } - , - e.prototype.first = function(e) { - for (var t in this._data) { - var i = e(t, this._data[t]); - if (i) - return i - } - return null - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return c - }), - i.d(t, "b", function() { - return u - }); - var n = i(0) - , r = [Math.sqrt(1 / (4 * Math.PI)), -Math.sqrt(3 / (4 * Math.PI)), Math.sqrt(3 / (4 * Math.PI)), -Math.sqrt(3 / (4 * Math.PI)), Math.sqrt(15 / (4 * Math.PI)), -Math.sqrt(15 / (4 * Math.PI)), Math.sqrt(5 / (16 * Math.PI)), -Math.sqrt(15 / (4 * Math.PI)), Math.sqrt(15 / (16 * Math.PI))] - , o = [function(e) { - return 1 - } - , function(e) { - return e.y - } - , function(e) { - return e.z - } - , function(e) { - return e.x - } - , function(e) { - return e.x * e.y - } - , function(e) { - return e.y * e.z - } - , function(e) { - return 3 * e.z * e.z - 1 - } - , function(e) { - return e.x * e.z - } - , function(e) { - return e.x * e.x - e.y * e.y - } - ] - , a = function(e, t) { - return r[e] * o[e](t) - } - , s = [Math.PI, 2 * Math.PI / 3, 2 * Math.PI / 3, 2 * Math.PI / 3, Math.PI / 4, Math.PI / 4, Math.PI / 4, Math.PI / 4, Math.PI / 4] - , c = function() { - function e() { - this.preScaled = false, - this.l00 = n.x.Zero(), - this.l1_1 = n.x.Zero(), - this.l10 = n.x.Zero(), - this.l11 = n.x.Zero(), - this.l2_2 = n.x.Zero(), - this.l2_1 = n.x.Zero(), - this.l20 = n.x.Zero(), - this.l21 = n.x.Zero(), - this.l22 = n.x.Zero() - } - return e.prototype.addLight = function(e, t, i) { - var r = new n.x(t.r,t.g,t.b).scale(i); - this.l00 = this.l00.add(r.scale(a(0, e))), - this.l1_1 = this.l1_1.add(r.scale(a(1, e))), - this.l10 = this.l10.add(r.scale(a(2, e))), - this.l11 = this.l11.add(r.scale(a(3, e))), - this.l2_2 = this.l2_2.add(r.scale(a(4, e))), - this.l2_1 = this.l2_1.add(r.scale(a(5, e))), - this.l20 = this.l20.add(r.scale(a(6, e))), - this.l21 = this.l21.add(r.scale(a(7, e))), - this.l22 = this.l22.add(r.scale(a(8, e))) - } - , - e.prototype.scaleInPlace = function(e) { - this.l00.scaleInPlace(e), + (e.prototype.scaleInPlace = function (e) { + this.l00.scaleInPlace(e), this.l1_1.scaleInPlace(e), this.l10.scaleInPlace(e), this.l11.scaleInPlace(e), @@ -46788,27 +59919,26 @@ and limitations under the License. this.l2_1.scaleInPlace(e), this.l20.scaleInPlace(e), this.l21.scaleInPlace(e), - this.l22.scaleInPlace(e) - } - , - e.prototype.convertIncidentRadianceToIrradiance = function() { + this.l22.scaleInPlace(e); + }), + (e.prototype.convertIncidentRadianceToIrradiance = + function () { this.l00.scaleInPlace(s[0]), - this.l1_1.scaleInPlace(s[1]), - this.l10.scaleInPlace(s[2]), - this.l11.scaleInPlace(s[3]), - this.l2_2.scaleInPlace(s[4]), - this.l2_1.scaleInPlace(s[5]), - this.l20.scaleInPlace(s[6]), - this.l21.scaleInPlace(s[7]), - this.l22.scaleInPlace(s[8]) - } - , - e.prototype.convertIrradianceToLambertianRadiance = function() { - this.scaleInPlace(1 / Math.PI) - } - , - e.prototype.preScaleForRendering = function() { - this.preScaled = true, + this.l1_1.scaleInPlace(s[1]), + this.l10.scaleInPlace(s[2]), + this.l11.scaleInPlace(s[3]), + this.l2_2.scaleInPlace(s[4]), + this.l2_1.scaleInPlace(s[5]), + this.l20.scaleInPlace(s[6]), + this.l21.scaleInPlace(s[7]), + this.l22.scaleInPlace(s[8]); + }), + (e.prototype.convertIrradianceToLambertianRadiance = + function () { + this.scaleInPlace(1 / Math.PI); + }), + (e.prototype.preScaleForRendering = function () { + (this.preScaled = true), this.l00.scaleInPlace(r[0]), this.l1_1.scaleInPlace(r[1]), this.l10.scaleInPlace(r[2]), @@ -46817,12 +59947,12 @@ and limitations under the License. this.l2_1.scaleInPlace(r[5]), this.l20.scaleInPlace(r[6]), this.l21.scaleInPlace(r[7]), - this.l22.scaleInPlace(r[8]) - } - , - e.FromArray = function(t) { - var i = new e; - return n.x.FromArrayToRef(t[0], 0, i.l00), + this.l22.scaleInPlace(r[8]); + }), + (e.FromArray = function (t) { + var i = new e(); + return ( + n.x.FromArrayToRef(t[0], 0, i.l00), n.x.FromArrayToRef(t[1], 0, i.l1_1), n.x.FromArrayToRef(t[2], 0, i.l10), n.x.FromArrayToRef(t[3], 0, i.l11), @@ -46832,59 +59962,73 @@ and limitations under the License. n.x.FromArrayToRef(t[7], 0, i.l21), n.x.FromArrayToRef(t[8], 0, i.l22), i - } - , - e.FromPolynomial = function(t) { - var i = new e; - return i.l00 = t.xx.scale(.376127).add(t.yy.scale(.376127)).add(t.zz.scale(.376126)), - i.l1_1 = t.y.scale(.977204), - i.l10 = t.z.scale(.977204), - i.l11 = t.x.scale(.977204), - i.l2_2 = t.xy.scale(1.16538), - i.l2_1 = t.yz.scale(1.16538), - i.l20 = t.zz.scale(1.34567).subtract(t.xx.scale(.672834)).subtract(t.yy.scale(.672834)), - i.l21 = t.zx.scale(1.16538), - i.l22 = t.xx.scale(1.16538).subtract(t.yy.scale(1.16538)), + ); + }), + (e.FromPolynomial = function (t) { + var i = new e(); + return ( + (i.l00 = t.xx + .scale(0.376127) + .add(t.yy.scale(0.376127)) + .add(t.zz.scale(0.376126))), + (i.l1_1 = t.y.scale(0.977204)), + (i.l10 = t.z.scale(0.977204)), + (i.l11 = t.x.scale(0.977204)), + (i.l2_2 = t.xy.scale(1.16538)), + (i.l2_1 = t.yz.scale(1.16538)), + (i.l20 = t.zz + .scale(1.34567) + .subtract(t.xx.scale(0.672834)) + .subtract(t.yy.scale(0.672834))), + (i.l21 = t.zx.scale(1.16538)), + (i.l22 = t.xx + .scale(1.16538) + .subtract(t.yy.scale(1.16538))), i.l1_1.scaleInPlace(-1), i.l11.scaleInPlace(-1), i.l2_1.scaleInPlace(-1), i.l21.scaleInPlace(-1), i.scaleInPlace(Math.PI), i - } - , - e - }() - , u = function() { - function e() { - this.x = n.x.Zero(), - this.y = n.x.Zero(), - this.z = n.x.Zero(), - this.xx = n.x.Zero(), - this.yy = n.x.Zero(), - this.zz = n.x.Zero(), - this.xy = n.x.Zero(), - this.yz = n.x.Zero(), - this.zx = n.x.Zero() - } - return Object.defineProperty(e.prototype, "preScaledHarmonics", { - get: function() { - return this._harmonics || (this._harmonics = c.FromPolynomial(this)), - this._harmonics.preScaled || this._harmonics.preScaleForRendering(), - this._harmonics - }, - enumerable: true, - configurable: true + ); }), - e.prototype.addAmbient = function(e) { - var t = new n.x(e.r,e.g,e.b); - this.xx = this.xx.add(t), - this.yy = this.yy.add(t), - this.zz = this.zz.add(t) - } - , - e.prototype.scaleInPlace = function(e) { - this.x.scaleInPlace(e), + e + ); + })(), + u = (function () { + function e() { + (this.x = n.x.Zero()), + (this.y = n.x.Zero()), + (this.z = n.x.Zero()), + (this.xx = n.x.Zero()), + (this.yy = n.x.Zero()), + (this.zz = n.x.Zero()), + (this.xy = n.x.Zero()), + (this.yz = n.x.Zero()), + (this.zx = n.x.Zero()); + } + return ( + Object.defineProperty(e.prototype, "preScaledHarmonics", { + get: function () { + return ( + this._harmonics || + (this._harmonics = c.FromPolynomial(this)), + this._harmonics.preScaled || + this._harmonics.preScaleForRendering(), + this._harmonics + ); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.addAmbient = function (e) { + var t = new n.x(e.r, e.g, e.b); + (this.xx = this.xx.add(t)), + (this.yy = this.yy.add(t)), + (this.zz = this.zz.add(t)); + }), + (e.prototype.scaleInPlace = function (e) { + this.x.scaleInPlace(e), this.y.scaleInPlace(e), this.z.scaleInPlace(e), this.xx.scaleInPlace(e), @@ -46892,28 +60036,37 @@ and limitations under the License. this.zz.scaleInPlace(e), this.yz.scaleInPlace(e), this.zx.scaleInPlace(e), - this.xy.scaleInPlace(e) - } - , - e.FromHarmonics = function(t) { - var i = new e; - return i._harmonics = t, - i.x = t.l11.scale(1.02333).scale(-1), - i.y = t.l1_1.scale(1.02333).scale(-1), - i.z = t.l10.scale(1.02333), - i.xx = t.l00.scale(.886277).subtract(t.l20.scale(.247708)).add(t.l22.scale(.429043)), - i.yy = t.l00.scale(.886277).subtract(t.l20.scale(.247708)).subtract(t.l22.scale(.429043)), - i.zz = t.l00.scale(.886277).add(t.l20.scale(.495417)), - i.yz = t.l2_1.scale(.858086).scale(-1), - i.zx = t.l21.scale(.858086).scale(-1), - i.xy = t.l2_2.scale(.858086), + this.xy.scaleInPlace(e); + }), + (e.FromHarmonics = function (t) { + var i = new e(); + return ( + (i._harmonics = t), + (i.x = t.l11.scale(1.02333).scale(-1)), + (i.y = t.l1_1.scale(1.02333).scale(-1)), + (i.z = t.l10.scale(1.02333)), + (i.xx = t.l00 + .scale(0.886277) + .subtract(t.l20.scale(0.247708)) + .add(t.l22.scale(0.429043))), + (i.yy = t.l00 + .scale(0.886277) + .subtract(t.l20.scale(0.247708)) + .subtract(t.l22.scale(0.429043))), + (i.zz = t.l00 + .scale(0.886277) + .add(t.l20.scale(0.495417))), + (i.yz = t.l2_1.scale(0.858086).scale(-1)), + (i.zx = t.l21.scale(0.858086).scale(-1)), + (i.xy = t.l2_2.scale(0.858086)), i.scaleInPlace(1 / Math.PI), i - } - , - e.FromArray = function(t) { - var i = new e; - return n.x.FromArrayToRef(t[0], 0, i.x), + ); + }), + (e.FromArray = function (t) { + var i = new e(); + return ( + n.x.FromArrayToRef(t[0], 0, i.x), n.x.FromArrayToRef(t[1], 0, i.y), n.x.FromArrayToRef(t[2], 0, i.z), n.x.FromArrayToRef(t[3], 0, i.xx), @@ -46923,1799 +60076,2176 @@ and limitations under the License. n.x.FromArrayToRef(t[7], 0, i.zx), n.x.FromArrayToRef(t[8], 0, i.xy), i - } - , + ); + }), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }); - var n = i(6) - , r = function() { - function e(e, t, i) { - this._engine = e, - this._noUBO = !e.supportsUniformBuffers, - this._dynamic = i, - this._data = t || [], - this._uniformLocations = {}, - this._uniformSizes = {}, - this._uniformLocationPointer = 0, - this._needSync = false, - this._noUBO ? (this.updateMatrix3x3 = this._updateMatrix3x3ForEffect, - this.updateMatrix2x2 = this._updateMatrix2x2ForEffect, - this.updateFloat = this._updateFloatForEffect, - this.updateFloat2 = this._updateFloat2ForEffect, - this.updateFloat3 = this._updateFloat3ForEffect, - this.updateFloat4 = this._updateFloat4ForEffect, - this.updateMatrix = this._updateMatrixForEffect, - this.updateVector3 = this._updateVector3ForEffect, - this.updateVector4 = this._updateVector4ForEffect, - this.updateColor3 = this._updateColor3ForEffect, - this.updateColor4 = this._updateColor4ForEffect) : (this._engine._uniformBuffers.push(this), - this.updateMatrix3x3 = this._updateMatrix3x3ForUniform, - this.updateMatrix2x2 = this._updateMatrix2x2ForUniform, - this.updateFloat = this._updateFloatForUniform, - this.updateFloat2 = this._updateFloat2ForUniform, - this.updateFloat3 = this._updateFloat3ForUniform, - this.updateFloat4 = this._updateFloat4ForUniform, - this.updateMatrix = this._updateMatrixForUniform, - this.updateVector3 = this._updateVector3ForUniform, - this.updateVector4 = this._updateVector4ForUniform, - this.updateColor3 = this._updateColor3ForUniform, - this.updateColor4 = this._updateColor4ForUniform) - } - return Object.defineProperty(e.prototype, "useUbo", { - get: function() { - return !this._noUBO - }, - enumerable: true, - configurable: true + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }); + var n = i(6), + r = (function () { + function e(e, t, i) { + (this._engine = e), + (this._noUBO = !e.supportsUniformBuffers), + (this._dynamic = i), + (this._data = t || []), + (this._uniformLocations = {}), + (this._uniformSizes = {}), + (this._uniformLocationPointer = 0), + (this._needSync = false), + this._noUBO + ? ((this.updateMatrix3x3 = + this._updateMatrix3x3ForEffect), + (this.updateMatrix2x2 = + this._updateMatrix2x2ForEffect), + (this.updateFloat = this._updateFloatForEffect), + (this.updateFloat2 = this._updateFloat2ForEffect), + (this.updateFloat3 = this._updateFloat3ForEffect), + (this.updateFloat4 = this._updateFloat4ForEffect), + (this.updateMatrix = this._updateMatrixForEffect), + (this.updateVector3 = this._updateVector3ForEffect), + (this.updateVector4 = this._updateVector4ForEffect), + (this.updateColor3 = this._updateColor3ForEffect), + (this.updateColor4 = this._updateColor4ForEffect)) + : (this._engine._uniformBuffers.push(this), + (this.updateMatrix3x3 = + this._updateMatrix3x3ForUniform), + (this.updateMatrix2x2 = + this._updateMatrix2x2ForUniform), + (this.updateFloat = this._updateFloatForUniform), + (this.updateFloat2 = this._updateFloat2ForUniform), + (this.updateFloat3 = this._updateFloat3ForUniform), + (this.updateFloat4 = this._updateFloat4ForUniform), + (this.updateMatrix = this._updateMatrixForUniform), + (this.updateVector3 = this._updateVector3ForUniform), + (this.updateVector4 = this._updateVector4ForUniform), + (this.updateColor3 = this._updateColor3ForUniform), + (this.updateColor4 = this._updateColor4ForUniform)); + } + return ( + Object.defineProperty(e.prototype, "useUbo", { + get: function () { + return !this._noUBO; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isSync", { - get: function() { - return !this._needSync - }, - enumerable: true, - configurable: true + get: function () { + return !this._needSync; + }, + enumerable: true, + configurable: true, }), - e.prototype.isDynamic = function() { - return void 0 !== this._dynamic - } - , - e.prototype.getData = function() { - return this._bufferData - } - , - e.prototype.getBuffer = function() { - return this._buffer - } - , - e.prototype._fillAlignment = function(e) { - var t; - if (t = e <= 2 ? e : 4, - this._uniformLocationPointer % t != 0) { - var i = this._uniformLocationPointer; - this._uniformLocationPointer += t - this._uniformLocationPointer % t; - for (var n = this._uniformLocationPointer - i, r = 0; r < n; r++) - this._data.push(0) - } - } - , - e.prototype.addUniform = function(e, t) { - if (!this._noUBO && void 0 === this._uniformLocations[e]) { - var i; - if (t instanceof Array) - t = (i = t).length; - else { - t = t, - i = []; - for (var n = 0; n < t; n++) - i.push(0) - } - for (this._fillAlignment(t), - this._uniformSizes[e] = t, - this._uniformLocations[e] = this._uniformLocationPointer, - this._uniformLocationPointer += t, - n = 0; n < t; n++) - this._data.push(i[n]); - this._needSync = true - } - } - , - e.prototype.addMatrix = function(e, t) { - this.addUniform(e, Array.prototype.slice.call(t.toArray())) - } - , - e.prototype.addFloat2 = function(e, t, i) { - var n = [t, i]; - this.addUniform(e, n) - } - , - e.prototype.addFloat3 = function(e, t, i, n) { - var r = [t, i, n]; - this.addUniform(e, r) - } - , - e.prototype.addColor3 = function(e, t) { - var i = new Array; - t.toArray(i), - this.addUniform(e, i) - } - , - e.prototype.addColor4 = function(e, t, i) { - var n = new Array; - t.toArray(n), - n.push(i), - this.addUniform(e, n) - } - , - e.prototype.addVector3 = function(e, t) { - var i = new Array; - t.toArray(i), - this.addUniform(e, i) - } - , - e.prototype.addMatrix3x3 = function(e) { - this.addUniform(e, 12) - } - , - e.prototype.addMatrix2x2 = function(e) { - this.addUniform(e, 8) - } - , - e.prototype.create = function() { - this._noUBO || this._buffer || (this._fillAlignment(4), - this._bufferData = new Float32Array(this._data), - this._rebuild(), - this._needSync = true) - } - , - e.prototype._rebuild = function() { - !this._noUBO && this._bufferData && (this._dynamic ? this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData) : this._buffer = this._engine.createUniformBuffer(this._bufferData)) - } - , - e.prototype.update = function() { - this._buffer ? (this._dynamic || this._needSync) && (this._engine.updateUniformBuffer(this._buffer, this._bufferData), - this._needSync = false) : this.create() - } - , - e.prototype.updateUniform = function(e, t, i) { - var r = this._uniformLocations[e]; - if (void 0 === r) { - if (this._buffer) - return void n.a.Error("Cannot add an uniform after UBO has been created."); - this.addUniform(e, i), - r = this._uniformLocations[e] - } - if (this._buffer || this.create(), - this._dynamic) - for (a = 0; a < i; a++) - this._bufferData[r + a] = t[a]; + (e.prototype.isDynamic = function () { + return void 0 !== this._dynamic; + }), + (e.prototype.getData = function () { + return this._bufferData; + }), + (e.prototype.getBuffer = function () { + return this._buffer; + }), + (e.prototype._fillAlignment = function (e) { + var t; + if ( + ((t = e <= 2 ? e : 4), + this._uniformLocationPointer % t != 0) + ) { + var i = this._uniformLocationPointer; + this._uniformLocationPointer += + t - (this._uniformLocationPointer % t); + for ( + var n = this._uniformLocationPointer - i, r = 0; + r < n; + r++ + ) + this._data.push(0); + } + }), + (e.prototype.addUniform = function (e, t) { + if ( + !this._noUBO && + void 0 === this._uniformLocations[e] + ) { + var i; + if (t instanceof Array) t = (i = t).length; else { - for (var o = false, a = 0; a < i; a++) - this._bufferData[r + a] !== t[a] && (o = true, - this._bufferData[r + a] = t[a]); - this._needSync = this._needSync || o + (t = t), (i = []); + for (var n = 0; n < t; n++) i.push(0); } - } - , - e.prototype._updateMatrix3x3ForUniform = function(t, i) { - for (var n = 0; n < 3; n++) - e._tempBuffer[4 * n] = i[3 * n], - e._tempBuffer[4 * n + 1] = i[3 * n + 1], - e._tempBuffer[4 * n + 2] = i[3 * n + 2], - e._tempBuffer[4 * n + 3] = 0; - this.updateUniform(t, e._tempBuffer, 12) - } - , - e.prototype._updateMatrix3x3ForEffect = function(e, t) { - this._currentEffect.setMatrix3x3(e, t) - } - , - e.prototype._updateMatrix2x2ForEffect = function(e, t) { - this._currentEffect.setMatrix2x2(e, t) - } - , - e.prototype._updateMatrix2x2ForUniform = function(t, i) { - for (var n = 0; n < 2; n++) - e._tempBuffer[4 * n] = i[2 * n], - e._tempBuffer[4 * n + 1] = i[2 * n + 1], - e._tempBuffer[4 * n + 2] = 0, - e._tempBuffer[4 * n + 3] = 0; - this.updateUniform(t, e._tempBuffer, 8) - } - , - e.prototype._updateFloatForEffect = function(e, t) { - this._currentEffect.setFloat(e, t) - } - , - e.prototype._updateFloatForUniform = function(t, i) { - e._tempBuffer[0] = i, - this.updateUniform(t, e._tempBuffer, 1) - } - , - e.prototype._updateFloat2ForEffect = function(e, t, i, n) { - void 0 === n && (n = ""), - this._currentEffect.setFloat2(e + n, t, i) - } - , - e.prototype._updateFloat2ForUniform = function(t, i, n) { - e._tempBuffer[0] = i, - e._tempBuffer[1] = n, - this.updateUniform(t, e._tempBuffer, 2) - } - , - e.prototype._updateFloat3ForEffect = function(e, t, i, n, r) { - void 0 === r && (r = ""), - this._currentEffect.setFloat3(e + r, t, i, n) - } - , - e.prototype._updateFloat3ForUniform = function(t, i, n, r) { - e._tempBuffer[0] = i, - e._tempBuffer[1] = n, - e._tempBuffer[2] = r, - this.updateUniform(t, e._tempBuffer, 3) - } - , - e.prototype._updateFloat4ForEffect = function(e, t, i, n, r, o) { - void 0 === o && (o = ""), - this._currentEffect.setFloat4(e + o, t, i, n, r) - } - , - e.prototype._updateFloat4ForUniform = function(t, i, n, r, o) { - e._tempBuffer[0] = i, - e._tempBuffer[1] = n, - e._tempBuffer[2] = r, - e._tempBuffer[3] = o, - this.updateUniform(t, e._tempBuffer, 4) - } - , - e.prototype._updateMatrixForEffect = function(e, t) { - this._currentEffect.setMatrix(e, t) - } - , - e.prototype._updateMatrixForUniform = function(e, t) { - this.updateUniform(e, t.toArray(), 16) - } - , - e.prototype._updateVector3ForEffect = function(e, t) { - this._currentEffect.setVector3(e, t) - } - , - e.prototype._updateVector3ForUniform = function(t, i) { - i.toArray(e._tempBuffer), - this.updateUniform(t, e._tempBuffer, 3) - } - , - e.prototype._updateVector4ForEffect = function(e, t) { - this._currentEffect.setVector4(e, t) - } - , - e.prototype._updateVector4ForUniform = function(t, i) { - i.toArray(e._tempBuffer), - this.updateUniform(t, e._tempBuffer, 4) - } - , - e.prototype._updateColor3ForEffect = function(e, t, i) { - void 0 === i && (i = ""), - this._currentEffect.setColor3(e + i, t) - } - , - e.prototype._updateColor3ForUniform = function(t, i) { - i.toArray(e._tempBuffer), - this.updateUniform(t, e._tempBuffer, 3) - } - , - e.prototype._updateColor4ForEffect = function(e, t, i, n) { - void 0 === n && (n = ""), - this._currentEffect.setColor4(e + n, t, i) - } - , - e.prototype._updateColor4ForUniform = function(t, i, n) { - i.toArray(e._tempBuffer), - e._tempBuffer[3] = n, - this.updateUniform(t, e._tempBuffer, 4) - } - , - e.prototype.setTexture = function(e, t) { - this._currentEffect.setTexture(e, t) - } - , - e.prototype.updateUniformDirectly = function(e, t) { - this.updateUniform(e, t, t.length), - this.update() - } - , - e.prototype.bindToEffect = function(e, t) { - this._currentEffect = e, - !this._noUBO && this._buffer && e.bindUniformBuffer(this._buffer, t) - } - , - e.prototype.dispose = function() { - if (!this._noUBO) { - var e = this._engine._uniformBuffers - , t = e.indexOf(this); - -1 !== t && (e[t] = e[e.length - 1], - e.pop()), - this._buffer && this._engine._releaseBuffer(this._buffer) && (this._buffer = null) - } - } - , - e._MAX_UNIFORM_SIZE = 256, - e._tempBuffer = new Float32Array(e._MAX_UNIFORM_SIZE), - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() { - this._isDirty = true, - this._areLightsDirty = true, - this._areAttributesDirty = true, - this._areTexturesDirty = true, - this._areFresnelDirty = true, - this._areMiscDirty = true, - this._areImageProcessingDirty = true, - this._normals = false, - this._uvs = false, - this._needNormals = false, - this._needUVs = false - } - return Object.defineProperty(e.prototype, "isDirty", { - get: function() { - return this._isDirty - }, - enumerable: true, - configurable: true + for ( + this._fillAlignment(t), + this._uniformSizes[e] = t, + this._uniformLocations[e] = + this._uniformLocationPointer, + this._uniformLocationPointer += t, + n = 0; + n < t; + n++ + ) + this._data.push(i[n]); + this._needSync = true; + } }), - e.prototype.markAsProcessed = function() { - this._isDirty = false, - this._areAttributesDirty = false, - this._areTexturesDirty = false, - this._areFresnelDirty = false, - this._areLightsDirty = false, - this._areMiscDirty = false, - this._areImageProcessingDirty = false - } - , - e.prototype.markAsUnprocessed = function() { - this._isDirty = true - } - , - e.prototype.markAllAsDirty = function() { - this._areTexturesDirty = true, - this._areAttributesDirty = true, - this._areLightsDirty = true, - this._areFresnelDirty = true, - this._areMiscDirty = true, - this._areImageProcessingDirty = true, - this._isDirty = true - } - , - e.prototype.markAsImageProcessingDirty = function() { - this._areImageProcessingDirty = true, - this._isDirty = true - } - , - e.prototype.markAsLightDirty = function() { - this._areLightsDirty = true, - this._isDirty = true - } - , - e.prototype.markAsAttributesDirty = function() { - this._areAttributesDirty = true, - this._isDirty = true - } - , - e.prototype.markAsTexturesDirty = function() { - this._areTexturesDirty = true, - this._isDirty = true - } - , - e.prototype.markAsFresnelDirty = function() { - this._areFresnelDirty = true, - this._isDirty = true - } - , - e.prototype.markAsMiscDirty = function() { - this._areMiscDirty = true, - this._isDirty = true - } - , - e.prototype.rebuild = function() { - this._keys && delete this._keys, - this._keys = []; - for (var e = 0, t = Object.keys(this); e < t.length; e++) { - var i = t[e]; - "_" !== i[0] && this._keys.push(i) - } - } - , - e.prototype.isEqual = function(e) { - if (this._keys.length !== e._keys.length) - return false; - for (var t = 0; t < this._keys.length; t++) { - var i = this._keys[t]; - if (this[i] !== e[i]) - return false - } - return true - } - , - e.prototype.cloneTo = function(e) { - this._keys.length !== e._keys.length && (e._keys = this._keys.slice(0)); - for (var t = 0; t < this._keys.length; t++) { - var i = this._keys[t]; - e[i] = this[i] - } - } - , - e.prototype.reset = function() { - for (var e = 0; e < this._keys.length; e++) { - var t = this._keys[e]; - switch (c(this[t])) { - case "number": - this[t] = 0; - break; - case "string": - this[t] = ""; - break; - default: - this[t] = false - } - } - } - , - e.prototype.toString = function() { - for (var e = "", t = 0; t < this._keys.length; t++) { - var i = this._keys[t] - , n = this[i]; - switch (c(n)) { - case "number": - case "string": - e += "#define " + i + " " + n + "\n"; - break; - default: - n && (e += "#define " + i + "\n") - } - } - return e - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return c - }); - var n = i(1) - , r = i(2) - , o = i(0) - , a = i(25) - , s = i(38); - a.a.AddNodeConstructor("Light_Type_3", function(e, t) { - return function() { - return new c(e,o.x.Zero(),t) - } - }); - var c = function(e) { - function t(t, i, n) { - var r = e.call(this, t, n) || this; - return r.groundColor = new o.e(0,0,0), - r.direction = i || o.x.Up(), - r - } - return n.d(t, e), - t.prototype._buildUniformLayout = function() { - this._uniformBuffer.addUniform("vLightData", 4), - this._uniformBuffer.addUniform("vLightDiffuse", 4), - this._uniformBuffer.addUniform("vLightSpecular", 3), - this._uniformBuffer.addUniform("vLightGround", 3), - this._uniformBuffer.addUniform("shadowsInfo", 3), - this._uniformBuffer.addUniform("depthValues", 2), - this._uniformBuffer.create() - } - , - t.prototype.getClassName = function() { - return "HemisphericLight" - } - , - t.prototype.setDirectionToTarget = function(e) { - return this.direction = o.x.Normalize(e.subtract(o.x.Zero())), - this.direction - } - , - t.prototype.getShadowGenerator = function() { - return null - } - , - t.prototype.transferToEffect = function(e, t) { - var i = o.x.Normalize(this.direction); - return this._uniformBuffer.updateFloat4("vLightData", i.x, i.y, i.z, 0, t), - this._uniformBuffer.updateColor3("vLightGround", this.groundColor.scale(this.intensity), t), - this - } - , - t.prototype.computeWorldMatrix = function() { - return this._worldMatrix || (this._worldMatrix = o.j.Identity()), - this._worldMatrix - } - , - t.prototype.getTypeID = function() { - return s.a.LIGHTTYPEID_HEMISPHERICLIGHT - } - , - t.prototype.prepareLightSpecificDefines = function(e, t) { - e["HEMILIGHT" + t] = true - } - , - n.c([Object(r.e)()], t.prototype, "groundColor", void 0), - n.c([Object(r.o)()], t.prototype, "direction", void 0), - t - }(s.a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return s - }); - var n = i(1) - , r = i(20) - , o = i(29) - , a = i(22) - , s = function(e) { - function t(t, i) { - var n = e.call(this, t, i, true) || this; - return i.multiMaterials.push(n), - n.subMaterials = new Array, - n._storeEffectOnSubMeshes = true, - n - } - return n.d(t, e), - Object.defineProperty(t.prototype, "subMaterials", { - get: function() { - return this._subMaterials - }, - set: function(e) { - this._subMaterials = e, - this._hookArray(e) - }, - enumerable: true, - configurable: true + (e.prototype.addMatrix = function (e, t) { + this.addUniform( + e, + Array.prototype.slice.call(t.toArray()) + ); }), - t.prototype.getChildren = function() { - return this.subMaterials - } - , - t.prototype._hookArray = function(e) { - var t = this - , i = e.push; - e.push = function() { - for (var n = [], r = 0; r < arguments.length; r++) - n[r] = arguments[r]; - var o = i.apply(e, n); - return t._markAllSubMeshesAsTexturesDirty(), - o - } - ; - var n = e.splice; - e.splice = function(i, r) { - var o = n.apply(e, [i, r]); - return t._markAllSubMeshesAsTexturesDirty(), - o - } - } - , - t.prototype.getSubMaterial = function(e) { - return e < 0 || e >= this.subMaterials.length ? this.getScene().defaultMaterial : this.subMaterials[e] - } - , - t.prototype.getActiveTextures = function() { - var t; - return (t = e.prototype.getActiveTextures.call(this)).concat.apply(t, this.subMaterials.map(function(e) { - return e ? e.getActiveTextures() : [] - })) - } - , - t.prototype.getClassName = function() { - return "MultiMaterial" - } - , - t.prototype.isReadyForSubMesh = function(e, t, i) { - for (var n = 0; n < this.subMaterials.length; n++) { - var r = this.subMaterials[n]; - if (r) { - if (r._storeEffectOnSubMeshes) { - if (!r.isReadyForSubMesh(e, t, i)) - return false; - continue - } - if (!r.isReady(e)) - return false - } - } - return true - } - , - t.prototype.clone = function(e, i) { - for (var n = new t(e,this.getScene()), r = 0; r < this.subMaterials.length; r++) { - var o, a = this.subMaterials[r]; - o = i && a ? a.clone(e + "-" + a.name) : this.subMaterials[r], - n.subMaterials.push(o) - } - return n - } - , - t.prototype.serialize = function() { - var e = {}; - e.name = this.name, - e.id = this.id, - o.a && (e.tags = o.a.GetTags(this)), - e.materials = []; - for (var t = 0; t < this.subMaterials.length; t++) { - var i = this.subMaterials[t]; - i ? e.materials.push(i.id) : e.materials.push(null) - } - return e - } - , - t.prototype.dispose = function(t, i, n) { - var r = this.getScene(); - if (r) { - if (n) - for (var o = 0; o < this.subMaterials.length; o++) { - var a = this.subMaterials[o]; - a && a.dispose(t, i) - } - (o = r.multiMaterials.indexOf(this)) >= 0 && r.multiMaterials.splice(o, 1), - e.prototype.dispose.call(this, t, i) - } - } - , - t.ParseMultiMaterial = function(e, i) { - var n = new t(e.name,i); - n.id = e.id, - o.a && o.a.AddTagsTo(n, e.tags); - for (var r = 0; r < e.materials.length; r++) { - var a = e.materials[r]; - a ? n.subMaterials.push(i.getMaterialByID(a)) : n.subMaterials.push(null) - } - return n - } - , - t - }(r.a); - a.a.RegisteredTypes["BABYLON.MultiMaterial"] = s - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.bonesDeclaration = "#if NUM_BONE_INFLUENCERS>0\n#ifdef BONETEXTURE\nuniform sampler2D boneSampler;\nuniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#endif\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#ifdef BONETEXTURE\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{\nfloat offset=index*4.0;\nfloat dx=1.0/boneTextureWidth;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.instancesDeclaration = "#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#else\nuniform mat4 world;\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.instancesVertex = "#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#else\nmat4 finalWorld=world;\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.bonesVertex = "#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif" - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return c - }); - var n = i(0) - , r = i(12) - , o = i(62) - , a = i(3) - , s = function(e, t, i, n) { - this.name = e, - this.worldAxisForNormal = t, - this.worldAxisForFileX = i, - this.worldAxisForFileY = n + (e.prototype.addFloat2 = function (e, t, i) { + var n = [t, i]; + this.addUniform(e, n); + }), + (e.prototype.addFloat3 = function (e, t, i, n) { + var r = [t, i, n]; + this.addUniform(e, r); + }), + (e.prototype.addColor3 = function (e, t) { + var i = new Array(); + t.toArray(i), this.addUniform(e, i); + }), + (e.prototype.addColor4 = function (e, t, i) { + var n = new Array(); + t.toArray(n), n.push(i), this.addUniform(e, n); + }), + (e.prototype.addVector3 = function (e, t) { + var i = new Array(); + t.toArray(i), this.addUniform(e, i); + }), + (e.prototype.addMatrix3x3 = function (e) { + this.addUniform(e, 12); + }), + (e.prototype.addMatrix2x2 = function (e) { + this.addUniform(e, 8); + }), + (e.prototype.create = function () { + this._noUBO || + this._buffer || + (this._fillAlignment(4), + (this._bufferData = new Float32Array(this._data)), + this._rebuild(), + (this._needSync = true)); + }), + (e.prototype._rebuild = function () { + !this._noUBO && + this._bufferData && + (this._dynamic + ? (this._buffer = + this._engine.createDynamicUniformBuffer( + this._bufferData + )) + : (this._buffer = this._engine.createUniformBuffer( + this._bufferData + ))); + }), + (e.prototype.update = function () { + this._buffer + ? (this._dynamic || this._needSync) && + (this._engine.updateUniformBuffer( + this._buffer, + this._bufferData + ), + (this._needSync = false)) + : this.create(); + }), + (e.prototype.updateUniform = function (e, t, i) { + var r = this._uniformLocations[e]; + if (void 0 === r) { + if (this._buffer) + return void n.a.Error( + "Cannot add an uniform after UBO has been created." + ); + this.addUniform(e, i), (r = this._uniformLocations[e]); + } + if ((this._buffer || this.create(), this._dynamic)) + for (a = 0; a < i; a++) this._bufferData[r + a] = t[a]; + else { + for (var o = false, a = 0; a < i; a++) + this._bufferData[r + a] !== t[a] && + ((o = true), (this._bufferData[r + a] = t[a])); + this._needSync = this._needSync || o; + } + }), + (e.prototype._updateMatrix3x3ForUniform = function (t, i) { + for (var n = 0; n < 3; n++) + (e._tempBuffer[4 * n] = i[3 * n]), + (e._tempBuffer[4 * n + 1] = i[3 * n + 1]), + (e._tempBuffer[4 * n + 2] = i[3 * n + 2]), + (e._tempBuffer[4 * n + 3] = 0); + this.updateUniform(t, e._tempBuffer, 12); + }), + (e.prototype._updateMatrix3x3ForEffect = function (e, t) { + this._currentEffect.setMatrix3x3(e, t); + }), + (e.prototype._updateMatrix2x2ForEffect = function (e, t) { + this._currentEffect.setMatrix2x2(e, t); + }), + (e.prototype._updateMatrix2x2ForUniform = function (t, i) { + for (var n = 0; n < 2; n++) + (e._tempBuffer[4 * n] = i[2 * n]), + (e._tempBuffer[4 * n + 1] = i[2 * n + 1]), + (e._tempBuffer[4 * n + 2] = 0), + (e._tempBuffer[4 * n + 3] = 0); + this.updateUniform(t, e._tempBuffer, 8); + }), + (e.prototype._updateFloatForEffect = function (e, t) { + this._currentEffect.setFloat(e, t); + }), + (e.prototype._updateFloatForUniform = function (t, i) { + (e._tempBuffer[0] = i), + this.updateUniform(t, e._tempBuffer, 1); + }), + (e.prototype._updateFloat2ForEffect = function ( + e, + t, + i, + n + ) { + void 0 === n && (n = ""), + this._currentEffect.setFloat2(e + n, t, i); + }), + (e.prototype._updateFloat2ForUniform = function (t, i, n) { + (e._tempBuffer[0] = i), + (e._tempBuffer[1] = n), + this.updateUniform(t, e._tempBuffer, 2); + }), + (e.prototype._updateFloat3ForEffect = function ( + e, + t, + i, + n, + r + ) { + void 0 === r && (r = ""), + this._currentEffect.setFloat3(e + r, t, i, n); + }), + (e.prototype._updateFloat3ForUniform = function ( + t, + i, + n, + r + ) { + (e._tempBuffer[0] = i), + (e._tempBuffer[1] = n), + (e._tempBuffer[2] = r), + this.updateUniform(t, e._tempBuffer, 3); + }), + (e.prototype._updateFloat4ForEffect = function ( + e, + t, + i, + n, + r, + o + ) { + void 0 === o && (o = ""), + this._currentEffect.setFloat4(e + o, t, i, n, r); + }), + (e.prototype._updateFloat4ForUniform = function ( + t, + i, + n, + r, + o + ) { + (e._tempBuffer[0] = i), + (e._tempBuffer[1] = n), + (e._tempBuffer[2] = r), + (e._tempBuffer[3] = o), + this.updateUniform(t, e._tempBuffer, 4); + }), + (e.prototype._updateMatrixForEffect = function (e, t) { + this._currentEffect.setMatrix(e, t); + }), + (e.prototype._updateMatrixForUniform = function (e, t) { + this.updateUniform(e, t.toArray(), 16); + }), + (e.prototype._updateVector3ForEffect = function (e, t) { + this._currentEffect.setVector3(e, t); + }), + (e.prototype._updateVector3ForUniform = function (t, i) { + i.toArray(e._tempBuffer), + this.updateUniform(t, e._tempBuffer, 3); + }), + (e.prototype._updateVector4ForEffect = function (e, t) { + this._currentEffect.setVector4(e, t); + }), + (e.prototype._updateVector4ForUniform = function (t, i) { + i.toArray(e._tempBuffer), + this.updateUniform(t, e._tempBuffer, 4); + }), + (e.prototype._updateColor3ForEffect = function (e, t, i) { + void 0 === i && (i = ""), + this._currentEffect.setColor3(e + i, t); + }), + (e.prototype._updateColor3ForUniform = function (t, i) { + i.toArray(e._tempBuffer), + this.updateUniform(t, e._tempBuffer, 3); + }), + (e.prototype._updateColor4ForEffect = function ( + e, + t, + i, + n + ) { + void 0 === n && (n = ""), + this._currentEffect.setColor4(e + n, t, i); + }), + (e.prototype._updateColor4ForUniform = function (t, i, n) { + i.toArray(e._tempBuffer), + (e._tempBuffer[3] = n), + this.updateUniform(t, e._tempBuffer, 4); + }), + (e.prototype.setTexture = function (e, t) { + this._currentEffect.setTexture(e, t); + }), + (e.prototype.updateUniformDirectly = function (e, t) { + this.updateUniform(e, t, t.length), this.update(); + }), + (e.prototype.bindToEffect = function (e, t) { + (this._currentEffect = e), + !this._noUBO && + this._buffer && + e.bindUniformBuffer(this._buffer, t); + }), + (e.prototype.dispose = function () { + if (!this._noUBO) { + var e = this._engine._uniformBuffers, + t = e.indexOf(this); + -1 !== t && ((e[t] = e[e.length - 1]), e.pop()), + this._buffer && + this._engine._releaseBuffer(this._buffer) && + (this._buffer = null); + } + }), + (e._MAX_UNIFORM_SIZE = 256), + (e._tempBuffer = new Float32Array(e._MAX_UNIFORM_SIZE)), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() { + (this._isDirty = true), + (this._areLightsDirty = true), + (this._areAttributesDirty = true), + (this._areTexturesDirty = true), + (this._areFresnelDirty = true), + (this._areMiscDirty = true), + (this._areImageProcessingDirty = true), + (this._normals = false), + (this._uvs = false), + (this._needNormals = false), + (this._needUVs = false); } - , c = function() { - function e() {} - return e.ConvertCubeMapTextureToSphericalPolynomial = function(e) { - if (!e.isCube) - return null; - var t, i, n = e.getSize().width, r = e.readPixels(0), o = e.readPixels(1); - e.isRenderTarget ? (t = e.readPixels(3), - i = e.readPixels(2)) : (t = e.readPixels(2), - i = e.readPixels(3)); - var s = e.readPixels(4) - , c = e.readPixels(5) - , u = e.gammaSpace - , l = a.a.TEXTUREFORMAT_RGBA - , h = a.a.TEXTURETYPE_UNSIGNED_INT; - e.textureType && e.textureType !== a.a.TEXTURETYPE_UNSIGNED_INT && (h = a.a.TEXTURETYPE_FLOAT); - var f = { - size: n, - right: r, - left: o, - up: t, - down: i, - front: s, - back: c, - format: l, - type: h, - gammaSpace: u - }; - return this.ConvertCubeMapToSphericalPolynomial(f) + return ( + Object.defineProperty(e.prototype, "isDirty", { + get: function () { + return this._isDirty; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.markAsProcessed = function () { + (this._isDirty = false), + (this._areAttributesDirty = false), + (this._areTexturesDirty = false), + (this._areFresnelDirty = false), + (this._areLightsDirty = false), + (this._areMiscDirty = false), + (this._areImageProcessingDirty = false); + }), + (e.prototype.markAsUnprocessed = function () { + this._isDirty = true; + }), + (e.prototype.markAllAsDirty = function () { + (this._areTexturesDirty = true), + (this._areAttributesDirty = true), + (this._areLightsDirty = true), + (this._areFresnelDirty = true), + (this._areMiscDirty = true), + (this._areImageProcessingDirty = true), + (this._isDirty = true); + }), + (e.prototype.markAsImageProcessingDirty = function () { + (this._areImageProcessingDirty = true), + (this._isDirty = true); + }), + (e.prototype.markAsLightDirty = function () { + (this._areLightsDirty = true), (this._isDirty = true); + }), + (e.prototype.markAsAttributesDirty = function () { + (this._areAttributesDirty = true), (this._isDirty = true); + }), + (e.prototype.markAsTexturesDirty = function () { + (this._areTexturesDirty = true), (this._isDirty = true); + }), + (e.prototype.markAsFresnelDirty = function () { + (this._areFresnelDirty = true), (this._isDirty = true); + }), + (e.prototype.markAsMiscDirty = function () { + (this._areMiscDirty = true), (this._isDirty = true); + }), + (e.prototype.rebuild = function () { + this._keys && delete this._keys, (this._keys = []); + for (var e = 0, t = Object.keys(this); e < t.length; e++) { + var i = t[e]; + "_" !== i[0] && this._keys.push(i); } - , - e.ConvertCubeMapToSphericalPolynomial = function(e) { - for (var t = new o.a, i = 0, s = 2 / e.size, c = s, u = .5 * s - 1, l = 0; l < 6; l++) - for (var h = this.FileFaces[l], f = e[h.name], d = u, p = e.format === a.a.TEXTUREFORMAT_RGBA ? 4 : 3, m = 0; m < e.size; m++) { - for (var g = u, _ = 0; _ < e.size; _++) { - var v = h.worldAxisForFileX.scale(g).add(h.worldAxisForFileY.scale(d)).add(h.worldAxisForNormal); - v.normalize(); - var y = Math.pow(1 + g * g + d * d, -1.5) - , b = f[m * e.size * p + _ * p + 0] - , E = f[m * e.size * p + _ * p + 1] - , T = f[m * e.size * p + _ * p + 2]; - e.type === a.a.TEXTURETYPE_UNSIGNED_INT && (b /= 255, - E /= 255, - T /= 255), - e.gammaSpace && (b = Math.pow(r.a.Clamp(b), n.v), - E = Math.pow(r.a.Clamp(E), n.v), - T = Math.pow(r.a.Clamp(T), n.v)); - var A = new n.e(b,E,T); - t.addLight(v, A, y), - i += y, - g += s - } - d += c - } - var x = 4 * Math.PI * 6 / 6 / i; - return t.scaleInPlace(x), + }), + (e.prototype.isEqual = function (e) { + if (this._keys.length !== e._keys.length) return false; + for (var t = 0; t < this._keys.length; t++) { + var i = this._keys[t]; + if (this[i] !== e[i]) return false; + } + return true; + }), + (e.prototype.cloneTo = function (e) { + this._keys.length !== e._keys.length && + (e._keys = this._keys.slice(0)); + for (var t = 0; t < this._keys.length; t++) { + var i = this._keys[t]; + e[i] = this[i]; + } + }), + (e.prototype.reset = function () { + for (var e = 0; e < this._keys.length; e++) { + var t = this._keys[e]; + switch (c(this[t])) { + case "number": + this[t] = 0; + break; + case "string": + this[t] = ""; + break; + default: + this[t] = false; + } + } + }), + (e.prototype.toString = function () { + for (var e = "", t = 0; t < this._keys.length; t++) { + var i = this._keys[t], + n = this[i]; + switch (c(n)) { + case "number": + case "string": + e += "#define " + i + " " + n + "\n"; + break; + default: + n && (e += "#define " + i + "\n"); + } + } + return e; + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return c; + }); + var n = i(1), + r = i(2), + o = i(0), + a = i(25), + s = i(38); + a.a.AddNodeConstructor("Light_Type_3", function (e, t) { + return function () { + return new c(e, o.x.Zero(), t); + }; + }); + var c = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, n) || this; + return ( + (r.groundColor = new o.e(0, 0, 0)), + (r.direction = i || o.x.Up()), + r + ); + } + return ( + n.d(t, e), + (t.prototype._buildUniformLayout = function () { + this._uniformBuffer.addUniform("vLightData", 4), + this._uniformBuffer.addUniform("vLightDiffuse", 4), + this._uniformBuffer.addUniform("vLightSpecular", 3), + this._uniformBuffer.addUniform("vLightGround", 3), + this._uniformBuffer.addUniform("shadowsInfo", 3), + this._uniformBuffer.addUniform("depthValues", 2), + this._uniformBuffer.create(); + }), + (t.prototype.getClassName = function () { + return "HemisphericLight"; + }), + (t.prototype.setDirectionToTarget = function (e) { + return ( + (this.direction = o.x.Normalize(e.subtract(o.x.Zero()))), + this.direction + ); + }), + (t.prototype.getShadowGenerator = function () { + return null; + }), + (t.prototype.transferToEffect = function (e, t) { + var i = o.x.Normalize(this.direction); + return ( + this._uniformBuffer.updateFloat4( + "vLightData", + i.x, + i.y, + i.z, + 0, + t + ), + this._uniformBuffer.updateColor3( + "vLightGround", + this.groundColor.scale(this.intensity), + t + ), + this + ); + }), + (t.prototype.computeWorldMatrix = function () { + return ( + this._worldMatrix || (this._worldMatrix = o.j.Identity()), + this._worldMatrix + ); + }), + (t.prototype.getTypeID = function () { + return s.a.LIGHTTYPEID_HEMISPHERICLIGHT; + }), + (t.prototype.prepareLightSpecificDefines = function (e, t) { + e["HEMILIGHT" + t] = true; + }), + n.c([Object(r.e)()], t.prototype, "groundColor", void 0), + n.c([Object(r.o)()], t.prototype, "direction", void 0), + t + ); + })(s.a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return s; + }); + var n = i(1), + r = i(20), + o = i(29), + a = i(22), + s = (function (e) { + function t(t, i) { + var n = e.call(this, t, i, true) || this; + return ( + i.multiMaterials.push(n), + (n.subMaterials = new Array()), + (n._storeEffectOnSubMeshes = true), + n + ); + } + return ( + n.d(t, e), + Object.defineProperty(t.prototype, "subMaterials", { + get: function () { + return this._subMaterials; + }, + set: function (e) { + (this._subMaterials = e), this._hookArray(e); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getChildren = function () { + return this.subMaterials; + }), + (t.prototype._hookArray = function (e) { + var t = this, + i = e.push; + e.push = function () { + for (var n = [], r = 0; r < arguments.length; r++) + n[r] = arguments[r]; + var o = i.apply(e, n); + return t._markAllSubMeshesAsTexturesDirty(), o; + }; + var n = e.splice; + e.splice = function (i, r) { + var o = n.apply(e, [i, r]); + return t._markAllSubMeshesAsTexturesDirty(), o; + }; + }), + (t.prototype.getSubMaterial = function (e) { + return e < 0 || e >= this.subMaterials.length + ? this.getScene().defaultMaterial + : this.subMaterials[e]; + }), + (t.prototype.getActiveTextures = function () { + var t; + return (t = + e.prototype.getActiveTextures.call(this)).concat.apply( + t, + this.subMaterials.map(function (e) { + return e ? e.getActiveTextures() : []; + }) + ); + }), + (t.prototype.getClassName = function () { + return "MultiMaterial"; + }), + (t.prototype.isReadyForSubMesh = function (e, t, i) { + for (var n = 0; n < this.subMaterials.length; n++) { + var r = this.subMaterials[n]; + if (r) { + if (r._storeEffectOnSubMeshes) { + if (!r.isReadyForSubMesh(e, t, i)) return false; + continue; + } + if (!r.isReady(e)) return false; + } + } + return true; + }), + (t.prototype.clone = function (e, i) { + for ( + var n = new t(e, this.getScene()), r = 0; + r < this.subMaterials.length; + r++ + ) { + var o, + a = this.subMaterials[r]; + (o = + i && a + ? a.clone(e + "-" + a.name) + : this.subMaterials[r]), + n.subMaterials.push(o); + } + return n; + }), + (t.prototype.serialize = function () { + var e = {}; + (e.name = this.name), + (e.id = this.id), + o.a && (e.tags = o.a.GetTags(this)), + (e.materials = []); + for (var t = 0; t < this.subMaterials.length; t++) { + var i = this.subMaterials[t]; + i ? e.materials.push(i.id) : e.materials.push(null); + } + return e; + }), + (t.prototype.dispose = function (t, i, n) { + var r = this.getScene(); + if (r) { + if (n) + for (var o = 0; o < this.subMaterials.length; o++) { + var a = this.subMaterials[o]; + a && a.dispose(t, i); + } + (o = r.multiMaterials.indexOf(this)) >= 0 && + r.multiMaterials.splice(o, 1), + e.prototype.dispose.call(this, t, i); + } + }), + (t.ParseMultiMaterial = function (e, i) { + var n = new t(e.name, i); + (n.id = e.id), o.a && o.a.AddTagsTo(n, e.tags); + for (var r = 0; r < e.materials.length; r++) { + var a = e.materials[r]; + a + ? n.subMaterials.push(i.getMaterialByID(a)) + : n.subMaterials.push(null); + } + return n; + }), + t + ); + })(r.a); + a.a.RegisteredTypes["BABYLON.MultiMaterial"] = s; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.bonesDeclaration = + "#if NUM_BONE_INFLUENCERS>0\n#ifdef BONETEXTURE\nuniform sampler2D boneSampler;\nuniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#endif\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#ifdef BONETEXTURE\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{\nfloat offset=index*4.0;\nfloat dx=1.0/boneTextureWidth;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.instancesDeclaration = + "#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#else\nuniform mat4 world;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.instancesVertex = + "#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#else\nmat4 finalWorld=world;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.bonesVertex = + "#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return c; + }); + var n = i(0), + r = i(12), + o = i(62), + a = i(3), + s = function (e, t, i, n) { + (this.name = e), + (this.worldAxisForNormal = t), + (this.worldAxisForFileX = i), + (this.worldAxisForFileY = n); + }, + c = (function () { + function e() {} + return ( + (e.ConvertCubeMapTextureToSphericalPolynomial = function ( + e + ) { + if (!e.isCube) return null; + var t, + i, + n = e.getSize().width, + r = e.readPixels(0), + o = e.readPixels(1); + e.isRenderTarget + ? ((t = e.readPixels(3)), (i = e.readPixels(2))) + : ((t = e.readPixels(2)), (i = e.readPixels(3))); + var s = e.readPixels(4), + c = e.readPixels(5), + u = e.gammaSpace, + l = a.a.TEXTUREFORMAT_RGBA, + h = a.a.TEXTURETYPE_UNSIGNED_INT; + e.textureType && + e.textureType !== a.a.TEXTURETYPE_UNSIGNED_INT && + (h = a.a.TEXTURETYPE_FLOAT); + var f = { + size: n, + right: r, + left: o, + up: t, + down: i, + front: s, + back: c, + format: l, + type: h, + gammaSpace: u, + }; + return this.ConvertCubeMapToSphericalPolynomial(f); + }), + (e.ConvertCubeMapToSphericalPolynomial = function (e) { + for ( + var t = new o.a(), + i = 0, + s = 2 / e.size, + c = s, + u = 0.5 * s - 1, + l = 0; + l < 6; + l++ + ) + for ( + var h = this.FileFaces[l], + f = e[h.name], + d = u, + p = e.format === a.a.TEXTUREFORMAT_RGBA ? 4 : 3, + m = 0; + m < e.size; + m++ + ) { + for (var g = u, _ = 0; _ < e.size; _++) { + var v = h.worldAxisForFileX + .scale(g) + .add(h.worldAxisForFileY.scale(d)) + .add(h.worldAxisForNormal); + v.normalize(); + var y = Math.pow(1 + g * g + d * d, -1.5), + b = f[m * e.size * p + _ * p + 0], + E = f[m * e.size * p + _ * p + 1], + T = f[m * e.size * p + _ * p + 2]; + e.type === a.a.TEXTURETYPE_UNSIGNED_INT && + ((b /= 255), (E /= 255), (T /= 255)), + e.gammaSpace && + ((b = Math.pow(r.a.Clamp(b), n.v)), + (E = Math.pow(r.a.Clamp(E), n.v)), + (T = Math.pow(r.a.Clamp(T), n.v))); + var A = new n.e(b, E, T); + t.addLight(v, A, y), (i += y), (g += s); + } + d += c; + } + var x = (4 * Math.PI * 6) / 6 / i; + return ( + t.scaleInPlace(x), t.convertIncidentRadianceToIrradiance(), t.convertIrradianceToLambertianRadiance(), o.b.FromHarmonics(t) - } - , - e.FileFaces = [new s("right",new n.x(1,0,0),new n.x(0,0,-1),new n.x(0,-1,0)), new s("left",new n.x(-1,0,0),new n.x(0,0,1),new n.x(0,-1,0)), new s("up",new n.x(0,1,0),new n.x(1,0,0),new n.x(0,0,1)), new s("down",new n.x(0,-1,0),new n.x(1,0,0),new n.x(0,0,-1)), new s("front",new n.x(0,0,1),new n.x(1,0,0),new n.x(0,-1,0)), new s("back",new n.x(0,0,-1),new n.x(-1,0,0),new n.x(0,-1,0))], + ); + }), + (e.FileFaces = [ + new s( + "right", + new n.x(1, 0, 0), + new n.x(0, 0, -1), + new n.x(0, -1, 0) + ), + new s( + "left", + new n.x(-1, 0, 0), + new n.x(0, 0, 1), + new n.x(0, -1, 0) + ), + new s( + "up", + new n.x(0, 1, 0), + new n.x(1, 0, 0), + new n.x(0, 0, 1) + ), + new s( + "down", + new n.x(0, -1, 0), + new n.x(1, 0, 0), + new n.x(0, 0, -1) + ), + new s( + "front", + new n.x(0, 0, 1), + new n.x(1, 0, 0), + new n.x(0, -1, 0) + ), + new s( + "back", + new n.x(0, 0, -1), + new n.x(-1, 0, 0), + new n.x(0, -1, 0) + ), + ]), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "b", function() { - return h - }), - i.d(t, "a", function() { - return f + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "b", function () { + return h; + }), + i.d(t, "a", function () { + return f; }); - var n = i(1) - , r = i(0) - , o = i(4) - , a = i(11) - , s = i(111) - , c = i(20) - , u = i(76) - , l = (i(126), - i(127), - i(15)) - , h = function(e) { - function t(t, i, n, a, s, c, l) { - void 0 === i && (i = null), - void 0 === n && (n = null); - var h = e.call(this, t, i, n, a, s) || this; - h.useVertexColor = c, - h.useVertexAlpha = l, - h.color = new r.e(1,1,1), - h.alpha = 1, - a && (h.color = a.color.clone(), - h.alpha = a.alpha, - h.useVertexColor = a.useVertexColor, - h.useVertexAlpha = a.useVertexAlpha), - h.intersectionThreshold = .1; - var f = { - attributes: [o.b.PositionKind, "world0", "world1", "world2", "world3"], - uniforms: ["vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "world", "viewProjection"], - needAlphaBlending: true, - defines: [] - }; - return false === l && (f.needAlphaBlending = false), - c ? (f.defines.push("#define VERTEXCOLOR"), - f.attributes.push(o.b.ColorKind)) : f.uniforms.push("color"), - h._colorShader = new u.a("colorShader",h.getScene(),"color",f), - h - } - return n.d(t, e), - t.prototype._addClipPlaneDefine = function(e) { - var t = "#define " + e; - -1 === this._colorShader.options.defines.indexOf(t) && this._colorShader.options.defines.push(t) - } - , - t.prototype._removeClipPlaneDefine = function(e) { - var t = "#define " + e - , i = this._colorShader.options.defines.indexOf(t); - -1 !== i && this._colorShader.options.defines.splice(i, 1) - } - , - t.prototype.isReady = function() { - var t = this.getScene(); - return t.clipPlane ? this._addClipPlaneDefine("CLIPPLANE") : this._removeClipPlaneDefine("CLIPPLANE"), - t.clipPlane2 ? this._addClipPlaneDefine("CLIPPLANE2") : this._removeClipPlaneDefine("CLIPPLANE2"), - t.clipPlane3 ? this._addClipPlaneDefine("CLIPPLANE3") : this._removeClipPlaneDefine("CLIPPLANE3"), - t.clipPlane4 ? this._addClipPlaneDefine("CLIPPLANE4") : this._removeClipPlaneDefine("CLIPPLANE4"), - !!this._colorShader.isReady() && e.prototype.isReady.call(this) - } - , - t.prototype.getClassName = function() { - return "LinesMesh" - } - , + var n = i(1), + r = i(0), + o = i(4), + a = i(11), + s = i(111), + c = i(20), + u = i(76), + l = (i(126), i(127), i(15)), + h = (function (e) { + function t(t, i, n, a, s, c, l) { + void 0 === i && (i = null), void 0 === n && (n = null); + var h = e.call(this, t, i, n, a, s) || this; + (h.useVertexColor = c), + (h.useVertexAlpha = l), + (h.color = new r.e(1, 1, 1)), + (h.alpha = 1), + a && + ((h.color = a.color.clone()), + (h.alpha = a.alpha), + (h.useVertexColor = a.useVertexColor), + (h.useVertexAlpha = a.useVertexAlpha)), + (h.intersectionThreshold = 0.1); + var f = { + attributes: [ + o.b.PositionKind, + "world0", + "world1", + "world2", + "world3", + ], + uniforms: [ + "vClipPlane", + "vClipPlane2", + "vClipPlane3", + "vClipPlane4", + "world", + "viewProjection", + ], + needAlphaBlending: true, + defines: [], + }; + return ( + false === l && (f.needAlphaBlending = false), + c + ? (f.defines.push("#define VERTEXCOLOR"), + f.attributes.push(o.b.ColorKind)) + : f.uniforms.push("color"), + (h._colorShader = new u.a( + "colorShader", + h.getScene(), + "color", + f + )), + h + ); + } + return ( + n.d(t, e), + (t.prototype._addClipPlaneDefine = function (e) { + var t = "#define " + e; + -1 === this._colorShader.options.defines.indexOf(t) && + this._colorShader.options.defines.push(t); + }), + (t.prototype._removeClipPlaneDefine = function (e) { + var t = "#define " + e, + i = this._colorShader.options.defines.indexOf(t); + -1 !== i && + this._colorShader.options.defines.splice(i, 1); + }), + (t.prototype.isReady = function () { + var t = this.getScene(); + return ( + t.clipPlane + ? this._addClipPlaneDefine("CLIPPLANE") + : this._removeClipPlaneDefine("CLIPPLANE"), + t.clipPlane2 + ? this._addClipPlaneDefine("CLIPPLANE2") + : this._removeClipPlaneDefine("CLIPPLANE2"), + t.clipPlane3 + ? this._addClipPlaneDefine("CLIPPLANE3") + : this._removeClipPlaneDefine("CLIPPLANE3"), + t.clipPlane4 + ? this._addClipPlaneDefine("CLIPPLANE4") + : this._removeClipPlaneDefine("CLIPPLANE4"), + !!this._colorShader.isReady() && + e.prototype.isReady.call(this) + ); + }), + (t.prototype.getClassName = function () { + return "LinesMesh"; + }), Object.defineProperty(t.prototype, "material", { - get: function() { - return this._colorShader - }, - set: function(e) {}, - enumerable: true, - configurable: true + get: function () { + return this._colorShader; + }, + set: function (e) {}, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "checkCollisions", { - get: function() { - return false - }, - enumerable: true, - configurable: true + get: function () { + return false; + }, + enumerable: true, + configurable: true, }), - t.prototype._bind = function(e, t, i) { - if (!this._geometry) - return this; - var n = this._colorShader.getEffect() - , r = this.isUnIndexed ? null : this._geometry.getIndexBuffer(); - return this._geometry._bind(n, r), - this.useVertexColor || this._colorShader.setColor4("color", this.color.toColor4(this.alpha)), + (t.prototype._bind = function (e, t, i) { + if (!this._geometry) return this; + var n = this._colorShader.getEffect(), + r = this.isUnIndexed + ? null + : this._geometry.getIndexBuffer(); + return ( + this._geometry._bind(n, r), + this.useVertexColor || + this._colorShader.setColor4( + "color", + this.color.toColor4(this.alpha) + ), l.a.BindClipPlane(n, this.getScene()), this - } - , - t.prototype._draw = function(e, t, i) { - if (!this._geometry || !this._geometry.getVertexBuffers() || !this._unIndexed && !this._geometry.getIndexBuffer()) - return this; - var n = this.getScene().getEngine(); - return this._unIndexed ? n.drawArraysType(c.a.LineListDrawMode, e.verticesStart, e.verticesCount, i) : n.drawElementsType(c.a.LineListDrawMode, e.indexStart, e.indexCount, i), + ); + }), + (t.prototype._draw = function (e, t, i) { + if ( + !this._geometry || + !this._geometry.getVertexBuffers() || + (!this._unIndexed && !this._geometry.getIndexBuffer()) + ) + return this; + var n = this.getScene().getEngine(); + return ( + this._unIndexed + ? n.drawArraysType( + c.a.LineListDrawMode, + e.verticesStart, + e.verticesCount, + i + ) + : n.drawElementsType( + c.a.LineListDrawMode, + e.indexStart, + e.indexCount, + i + ), this - } - , - t.prototype.dispose = function(t) { - this._colorShader.dispose(false, false, true), - e.prototype.dispose.call(this, t) - } - , - t.prototype.clone = function(e, i, n) { - return new t(e,this.getScene(),i,this,n) - } - , - t.prototype.createInstance = function(e) { - return new f(e,this) - } - , - t - }(a.a) - , f = function(e) { - function t(t, i) { - var n = e.call(this, t, i) || this; - return n.intersectionThreshold = i.intersectionThreshold, - n - } - return n.d(t, e), - t.prototype.getClassName = function() { - return "InstancedLinesMesh" - } - , - t - }(s.a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }); - var n = i(1) - , r = function(e) { - function t(t) { - var i = e.call(this) || this; - return i._buffer = t, - i - } - return n.d(t, e), - Object.defineProperty(t.prototype, "underlyingResource", { - get: function() { - return this._buffer - }, - enumerable: true, - configurable: true + ); + }), + (t.prototype.dispose = function (t) { + this._colorShader.dispose(false, false, true), + e.prototype.dispose.call(this, t); + }), + (t.prototype.clone = function (e, i, n) { + return new t(e, this.getScene(), i, this, n); + }), + (t.prototype.createInstance = function (e) { + return new f(e, this); }), t - }(i(78).a) - } - , function(e, t, n) { - "use strict"; - n.r(t); - var r = n(0) - , o = n(33) - , a = n(58) - , s = function() { - function e(t, i, n, s, c, u) { - if (void 0 === i && (i = 1), - void 0 === n && (n = 2), - this._scaleLinesFactor = 4, - this._instanced = false, - this.scaleLines = 1, - this.scaleLines = i, - !s) { - var l = new o.a("",t); - l.disableLighting = true, - l.emissiveColor = r.e.Red().scale(.5), - s = a.a._CreateArrow(t, l) - } - if (!c) { - var h = new o.a("",t); - h.disableLighting = true, - h.emissiveColor = r.e.Green().scale(.5), - c = a.a._CreateArrow(t, h) - } - if (!u) { - var f = new o.a("",t); - f.disableLighting = true, - f.emissiveColor = r.e.Blue().scale(.5), - u = a.a._CreateArrow(t, f) - } - this._xAxis = s, - this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), - this._yAxis = c, - this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), - this._zAxis = u, - this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), - null != n && (e._SetRenderingGroupId(this._xAxis, n), + ); + })(a.a), + f = (function (e) { + function t(t, i) { + var n = e.call(this, t, i) || this; + return ( + (n.intersectionThreshold = i.intersectionThreshold), n + ); + } + return ( + n.d(t, e), + (t.prototype.getClassName = function () { + return "InstancedLinesMesh"; + }), + t + ); + })(s.a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }); + var n = i(1), + r = (function (e) { + function t(t) { + var i = e.call(this) || this; + return (i._buffer = t), i; + } + return ( + n.d(t, e), + Object.defineProperty(t.prototype, "underlyingResource", { + get: function () { + return this._buffer; + }, + enumerable: true, + configurable: true, + }), + t + ); + })(i(78).a); + }, + function (e, t, n) { + "use strict"; + n.r(t); + var r = n(0), + o = n(33), + a = n(58), + s = (function () { + function e(t, i, n, s, c, u) { + if ( + (void 0 === i && (i = 1), + void 0 === n && (n = 2), + (this._scaleLinesFactor = 4), + (this._instanced = false), + (this.scaleLines = 1), + (this.scaleLines = i), + !s) + ) { + var l = new o.a("", t); + (l.disableLighting = true), + (l.emissiveColor = r.e.Red().scale(0.5)), + (s = a.a._CreateArrow(t, l)); + } + if (!c) { + var h = new o.a("", t); + (h.disableLighting = true), + (h.emissiveColor = r.e.Green().scale(0.5)), + (c = a.a._CreateArrow(t, h)); + } + if (!u) { + var f = new o.a("", t); + (f.disableLighting = true), + (f.emissiveColor = r.e.Blue().scale(0.5)), + (u = a.a._CreateArrow(t, f)); + } + (this._xAxis = s), + this._xAxis.scaling.setAll( + this.scaleLines * this._scaleLinesFactor + ), + (this._yAxis = c), + this._yAxis.scaling.setAll( + this.scaleLines * this._scaleLinesFactor + ), + (this._zAxis = u), + this._zAxis.scaling.setAll( + this.scaleLines * this._scaleLinesFactor + ), + null != n && + (e._SetRenderingGroupId(this._xAxis, n), e._SetRenderingGroupId(this._yAxis, n), e._SetRenderingGroupId(this._zAxis, n)), - this.scene = t, - this.update(new r.x, r.x.Right(), r.x.Up(), r.x.Forward()) - } - return Object.defineProperty(e.prototype, "xAxis", { - get: function() { - return this._xAxis - }, - enumerable: true, - configurable: true + (this.scene = t), + this.update( + new r.x(), + r.x.Right(), + r.x.Up(), + r.x.Forward() + ); + } + return ( + Object.defineProperty(e.prototype, "xAxis", { + get: function () { + return this._xAxis; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "yAxis", { - get: function() { - return this._yAxis - }, - enumerable: true, - configurable: true + get: function () { + return this._yAxis; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "zAxis", { - get: function() { - return this._zAxis - }, - enumerable: true, - configurable: true + get: function () { + return this._zAxis; + }, + enumerable: true, + configurable: true, }), - e.prototype.update = function(e, t, i, n) { - this._xAxis.position.copyFrom(e), + (e.prototype.update = function (e, t, i, n) { + this._xAxis.position.copyFrom(e), this._xAxis.setDirection(t), - this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), + this._xAxis.scaling.setAll( + this.scaleLines * this._scaleLinesFactor + ), this._yAxis.position.copyFrom(e), this._yAxis.setDirection(i), - this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), + this._yAxis.scaling.setAll( + this.scaleLines * this._scaleLinesFactor + ), this._zAxis.position.copyFrom(e), this._zAxis.setDirection(n), - this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor) - } - , - e.prototype.createInstance = function() { - var t = a.a._CreateArrowInstance(this.scene, this._xAxis) - , i = a.a._CreateArrowInstance(this.scene, this._yAxis) - , n = a.a._CreateArrowInstance(this.scene, this._zAxis) - , r = new e(this.scene,this.scaleLines,null,t,i,n); - return r._instanced = true, - r - } - , - e.prototype.dispose = function() { - this._xAxis && (this._xAxis.dispose(false, !this._instanced), + this._zAxis.scaling.setAll( + this.scaleLines * this._scaleLinesFactor + ); + }), + (e.prototype.createInstance = function () { + var t = a.a._CreateArrowInstance(this.scene, this._xAxis), + i = a.a._CreateArrowInstance(this.scene, this._yAxis), + n = a.a._CreateArrowInstance(this.scene, this._zAxis), + r = new e(this.scene, this.scaleLines, null, t, i, n); + return (r._instanced = true), r; + }), + (e.prototype.dispose = function () { + this._xAxis && + (this._xAxis.dispose(false, !this._instanced), delete this._xAxis), - this._yAxis && (this._yAxis.dispose(false, !this._instanced), - delete this._yAxis), - this._zAxis && (this._zAxis.dispose(false, !this._instanced), - delete this._zAxis), - delete this.scene - } - , - e._SetRenderingGroupId = function(e, t) { - e.getChildMeshes().forEach(function(e) { - e.renderingGroupId = t - }) - } - , + this._yAxis && + (this._yAxis.dispose(false, !this._instanced), + delete this._yAxis), + this._zAxis && + (this._zAxis.dispose(false, !this._instanced), + delete this._zAxis), + delete this.scene; + }), + (e._SetRenderingGroupId = function (e, t) { + e.getChildMeshes().forEach(function (e) { + e.renderingGroupId = t; + }); + }), e - }() - , c = n(1) - , u = function(e) { - function t(t, i, n, o) { - void 0 === o && (o = 1); - var a = e.call(this, t, o) || this; - return a.pos = r.x.Zero(), - a.xaxis = r.x.Zero(), - a.yaxis = r.x.Zero(), - a.zaxis = r.x.Zero(), - a.mesh = n, - a.bone = i, - a - } - return c.d(t, e), - t.prototype.update = function() { - if (this.mesh && this.bone) { - var t = this.bone; - t.getAbsolutePositionToRef(this.mesh, this.pos), - t.getDirectionToRef(r.c.X, this.mesh, this.xaxis), - t.getDirectionToRef(r.c.Y, this.mesh, this.yaxis), - t.getDirectionToRef(r.c.Z, this.mesh, this.zaxis), - e.prototype.update.call(this, this.pos, this.xaxis, this.yaxis, this.zaxis) - } - } - , - t.prototype.dispose = function() { - this.mesh && (this.mesh = null, - this.bone = null, - e.prototype.dispose.call(this)) - } - , + ); + })(), + c = n(1), + u = (function (e) { + function t(t, i, n, o) { + void 0 === o && (o = 1); + var a = e.call(this, t, o) || this; + return ( + (a.pos = r.x.Zero()), + (a.xaxis = r.x.Zero()), + (a.yaxis = r.x.Zero()), + (a.zaxis = r.x.Zero()), + (a.mesh = n), + (a.bone = i), + a + ); + } + return ( + c.d(t, e), + (t.prototype.update = function () { + if (this.mesh && this.bone) { + var t = this.bone; + t.getAbsolutePositionToRef(this.mesh, this.pos), + t.getDirectionToRef(r.c.X, this.mesh, this.xaxis), + t.getDirectionToRef(r.c.Y, this.mesh, this.yaxis), + t.getDirectionToRef(r.c.Z, this.mesh, this.zaxis), + e.prototype.update.call( + this, + this.pos, + this.xaxis, + this.yaxis, + this.zaxis + ); + } + }), + (t.prototype.dispose = function () { + this.mesh && + ((this.mesh = null), + (this.bone = null), + e.prototype.dispose.call(this)); + }), t - }(s) - , l = n(9) - , h = n(8) - , f = n(16) - , d = n(10); - Object.defineProperty(f.a.prototype, "debugLayer", { - get: function() { - return this._debugLayer || (this._debugLayer = new p(this)), - this._debugLayer - }, - enumerable: true, - configurable: true - }); - var p = function() { - function e(e) { - var t = this; - this.BJSINSPECTOR = this._getGlobalInspector(), - this.onPropertyChangedObservable = new h.c, - this._scene = e, - this._scene.onDisposeObservable.add(function() { - t._scene._debugLayer && t._scene._debugLayer.hide() - }) - } - return e.prototype._createInspector = function(e) { - if (!this.isVisible()) { - var t = c.a({ - overlay: false, - showExplorer: true, - showInspector: true, - embedMode: false, - handleResize: true, - enablePopup: true - }, e); - this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector(), - this.BJSINSPECTOR.Inspector.Show(this._scene, t) - } - } - , - e.prototype.select = function(e, t) { - this.BJSINSPECTOR && (this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(t), - this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(e)) - } - , - e.prototype._getGlobalInspector = function() { - return "undefined" != typeof INSPECTOR ? INSPECTOR : "undefined" != typeof BABYLON && void 0 !== BABYLON.Inspector ? BABYLON : void 0 - } - , - e.prototype.isVisible = function() { - return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible - } - , - e.prototype.hide = function() { - this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.Hide() - } - , - e.prototype.show = function(t) { - var n = this; - return new i(function(i, r) { - if (void 0 === n.BJSINSPECTOR) { - var o = t && t.inspectorURL ? t.inspectorURL : e.InspectorURL; - l.h.LoadScript(o, function() { - n._createInspector(t), - i(n) - }) - } else - n._createInspector(t), - i(n) - } - ) - } - , - e.InspectorURL = "https://unpkg.com/babylonjs-inspector@" + d.b.Version + "/babylon.inspector.bundle.js", + ); + })(s), + l = n(9), + h = n(8), + f = n(16), + d = n(10); + Object.defineProperty(f.a.prototype, "debugLayer", { + get: function () { + return ( + this._debugLayer || (this._debugLayer = new p(this)), + this._debugLayer + ); + }, + enumerable: true, + configurable: true, + }); + var p = (function () { + function e(e) { + var t = this; + (this.BJSINSPECTOR = this._getGlobalInspector()), + (this.onPropertyChangedObservable = new h.c()), + (this._scene = e), + this._scene.onDisposeObservable.add(function () { + t._scene._debugLayer && t._scene._debugLayer.hide(); + }); + } + return ( + (e.prototype._createInspector = function (e) { + if (!this.isVisible()) { + var t = c.a( + { + overlay: false, + showExplorer: true, + showInspector: true, + embedMode: false, + handleResize: true, + enablePopup: true, + }, + e + ); + (this.BJSINSPECTOR = + this.BJSINSPECTOR || this._getGlobalInspector()), + this.BJSINSPECTOR.Inspector.Show(this._scene, t); + } + }), + (e.prototype.select = function (e, t) { + this.BJSINSPECTOR && + (this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting( + t + ), + this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers( + e + )); + }), + (e.prototype._getGlobalInspector = function () { + return "undefined" != typeof INSPECTOR + ? INSPECTOR + : "undefined" != typeof BABYLON && + void 0 !== BABYLON.Inspector + ? BABYLON + : void 0; + }), + (e.prototype.isVisible = function () { + return ( + this.BJSINSPECTOR && + this.BJSINSPECTOR.Inspector.IsVisible + ); + }), + (e.prototype.hide = function () { + this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.Hide(); + }), + (e.prototype.show = function (t) { + var n = this; + return new i(function (i, r) { + if (void 0 === n.BJSINSPECTOR) { + var o = + t && t.inspectorURL + ? t.inspectorURL + : e.InspectorURL; + l.h.LoadScript(o, function () { + n._createInspector(t), i(n); + }); + } else n._createInspector(t), i(n); + }); + }), + (e.InspectorURL = + "https://unpkg.com/babylonjs-inspector@" + + d.b.Version + + "/babylon.inspector.bundle.js"), e - }() - , m = n(11) - , g = n(52) - , _ = n(46) - , v = n(23) - , y = n(27) - , b = n(41) - , E = n(53) - , T = function() { - function e(e) { - this._impostors = [], - this._meshes = [], - this._numMeshes = 0, - this._debugMeshMeshes = new Array, - this._scene = e || v.a.LastCreatedScene; - var t = this._scene.getPhysicsEngine(); - t && (this._physicsEnginePlugin = t.getPhysicsPlugin()), - this._utilityLayer = new b.a(this._scene,false), - this._utilityLayer.pickUtilitySceneFirst = false, - this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true - } - return e.prototype._updateDebugMeshes = function() { - for (var e = this._physicsEnginePlugin, t = 0; t < this._numMeshes; t++) { - var i = this._impostors[t]; - if (i) - if (i.isDisposed) - this.hideImpostor(this._impostors[t--]); - else { - if (i.type === y.a.MeshImpostor) - continue; - var n = this._meshes[t]; - n && e && e.syncMeshWithImpostor(n, i) - } - } - } - , - e.prototype.showImpostor = function(e, t) { - if (!this._scene) - return null; - for (var i = 0; i < this._numMeshes; i++) - if (this._impostors[i] == e) - return null; - var n = this._getDebugMesh(e, t); - return n && (this._impostors[this._numMeshes] = e, - this._meshes[this._numMeshes] = n, - 0 === this._numMeshes && (this._renderFunction = this._updateDebugMeshes.bind(this), - this._scene.registerBeforeRender(this._renderFunction)), - this._numMeshes++), + ); + })(), + m = n(11), + g = n(52), + _ = n(46), + v = n(23), + y = n(27), + b = n(41), + E = n(53), + T = (function () { + function e(e) { + (this._impostors = []), + (this._meshes = []), + (this._numMeshes = 0), + (this._debugMeshMeshes = new Array()), + (this._scene = e || v.a.LastCreatedScene); + var t = this._scene.getPhysicsEngine(); + t && (this._physicsEnginePlugin = t.getPhysicsPlugin()), + (this._utilityLayer = new b.a(this._scene, false)), + (this._utilityLayer.pickUtilitySceneFirst = false), + (this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true); + } + return ( + (e.prototype._updateDebugMeshes = function () { + for ( + var e = this._physicsEnginePlugin, t = 0; + t < this._numMeshes; + t++ + ) { + var i = this._impostors[t]; + if (i) + if (i.isDisposed) + this.hideImpostor(this._impostors[t--]); + else { + if (i.type === y.a.MeshImpostor) continue; + var n = this._meshes[t]; + n && e && e.syncMeshWithImpostor(n, i); + } + } + }), + (e.prototype.showImpostor = function (e, t) { + if (!this._scene) return null; + for (var i = 0; i < this._numMeshes; i++) + if (this._impostors[i] == e) return null; + var n = this._getDebugMesh(e, t); + return ( + n && + ((this._impostors[this._numMeshes] = e), + (this._meshes[this._numMeshes] = n), + 0 === this._numMeshes && + ((this._renderFunction = + this._updateDebugMeshes.bind(this)), + this._scene.registerBeforeRender( + this._renderFunction + )), + this._numMeshes++), n - } - , - e.prototype.hideImpostor = function(e) { - if (e && this._scene && this._utilityLayer) { - for (var t = false, i = this._utilityLayer.utilityLayerScene, n = 0; n < this._numMeshes; n++) - if (this._impostors[n] == e) { - var r = this._meshes[n]; - if (!r) - continue; - i.removeMesh(r), - r.dispose(); - var o = this._debugMeshMeshes.indexOf(r); - o > -1 && this._debugMeshMeshes.splice(o, 1), - this._numMeshes--, - this._numMeshes > 0 ? (this._meshes[n] = this._meshes[this._numMeshes], - this._impostors[n] = this._impostors[this._numMeshes], - this._meshes[this._numMeshes] = null, - this._impostors[this._numMeshes] = null) : (this._meshes[0] = null, - this._impostors[0] = null), - t = true; - break - } - t && 0 === this._numMeshes && this._scene.unregisterBeforeRender(this._renderFunction) - } - } - , - e.prototype._getDebugMaterial = function(e) { - return this._debugMaterial || (this._debugMaterial = new o.a("",e), - this._debugMaterial.wireframe = true, - this._debugMaterial.emissiveColor = r.e.White(), - this._debugMaterial.disableLighting = true), + ); + }), + (e.prototype.hideImpostor = function (e) { + if (e && this._scene && this._utilityLayer) { + for ( + var t = false, + i = this._utilityLayer.utilityLayerScene, + n = 0; + n < this._numMeshes; + n++ + ) + if (this._impostors[n] == e) { + var r = this._meshes[n]; + if (!r) continue; + i.removeMesh(r), r.dispose(); + var o = this._debugMeshMeshes.indexOf(r); + o > -1 && this._debugMeshMeshes.splice(o, 1), + this._numMeshes--, + this._numMeshes > 0 + ? ((this._meshes[n] = + this._meshes[this._numMeshes]), + (this._impostors[n] = + this._impostors[this._numMeshes]), + (this._meshes[this._numMeshes] = null), + (this._impostors[this._numMeshes] = null)) + : ((this._meshes[0] = null), + (this._impostors[0] = null)), + (t = true); + break; + } + t && + 0 === this._numMeshes && + this._scene.unregisterBeforeRender( + this._renderFunction + ); + } + }), + (e.prototype._getDebugMaterial = function (e) { + return ( + this._debugMaterial || + ((this._debugMaterial = new o.a("", e)), + (this._debugMaterial.wireframe = true), + (this._debugMaterial.emissiveColor = r.e.White()), + (this._debugMaterial.disableLighting = true)), this._debugMaterial - } - , - e.prototype._getDebugBoxMesh = function(e) { - return this._debugBoxMesh || (this._debugBoxMesh = g.a.CreateBox("physicsBodyBoxViewMesh", { - size: 1 - }, e), - this._debugBoxMesh.rotationQuaternion = r.q.Identity(), - this._debugBoxMesh.material = this._getDebugMaterial(e), - this._debugBoxMesh.setEnabled(false)), - this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance") - } - , - e.prototype._getDebugSphereMesh = function(e) { - return this._debugSphereMesh || (this._debugSphereMesh = _.a.CreateSphere("physicsBodySphereViewMesh", { - diameter: 1 - }, e), - this._debugSphereMesh.rotationQuaternion = r.q.Identity(), - this._debugSphereMesh.material = this._getDebugMaterial(e), - this._debugSphereMesh.setEnabled(false)), - this._debugSphereMesh.createInstance("physicsBodyBoxViewInstance") - } - , - e.prototype._getDebugCylinderMesh = function(e) { - return this._debugCylinderMesh || (this._debugCylinderMesh = E.a.CreateCylinder("physicsBodyCylinderViewMesh", { - diameterTop: 1, - diameterBottom: 1, - height: 1 - }, e), - this._debugCylinderMesh.rotationQuaternion = r.q.Identity(), - this._debugCylinderMesh.material = this._getDebugMaterial(e), - this._debugCylinderMesh.setEnabled(false)), - this._debugCylinderMesh.createInstance("physicsBodyBoxViewInstance") - } - , - e.prototype._getDebugMeshMesh = function(e, t) { - var i = new m.a(e.name,t,null,e); - return i.position = r.x.Zero(), + ); + }), + (e.prototype._getDebugBoxMesh = function (e) { + return ( + this._debugBoxMesh || + ((this._debugBoxMesh = g.a.CreateBox( + "physicsBodyBoxViewMesh", + { + size: 1, + }, + e + )), + (this._debugBoxMesh.rotationQuaternion = + r.q.Identity()), + (this._debugBoxMesh.material = + this._getDebugMaterial(e)), + this._debugBoxMesh.setEnabled(false)), + this._debugBoxMesh.createInstance( + "physicsBodyBoxViewInstance" + ) + ); + }), + (e.prototype._getDebugSphereMesh = function (e) { + return ( + this._debugSphereMesh || + ((this._debugSphereMesh = _.a.CreateSphere( + "physicsBodySphereViewMesh", + { + diameter: 1, + }, + e + )), + (this._debugSphereMesh.rotationQuaternion = + r.q.Identity()), + (this._debugSphereMesh.material = + this._getDebugMaterial(e)), + this._debugSphereMesh.setEnabled(false)), + this._debugSphereMesh.createInstance( + "physicsBodyBoxViewInstance" + ) + ); + }), + (e.prototype._getDebugCylinderMesh = function (e) { + return ( + this._debugCylinderMesh || + ((this._debugCylinderMesh = E.a.CreateCylinder( + "physicsBodyCylinderViewMesh", + { + diameterTop: 1, + diameterBottom: 1, + height: 1, + }, + e + )), + (this._debugCylinderMesh.rotationQuaternion = + r.q.Identity()), + (this._debugCylinderMesh.material = + this._getDebugMaterial(e)), + this._debugCylinderMesh.setEnabled(false)), + this._debugCylinderMesh.createInstance( + "physicsBodyBoxViewInstance" + ) + ); + }), + (e.prototype._getDebugMeshMesh = function (e, t) { + var i = new m.a(e.name, t, null, e); + return ( + (i.position = r.x.Zero()), i.setParent(e), - i.material = this._getDebugMaterial(t), + (i.material = this._getDebugMaterial(t)), this._debugMeshMeshes.push(i), i - } - , - e.prototype._getDebugMesh = function(e, t) { - var i = this; - if (!this._utilityLayer) - return null; - if (t && t.parent && t.parent.physicsImpostor) - return null; - var n = null - , r = this._utilityLayer.utilityLayerScene; - switch (e.type) { + ); + }), + (e.prototype._getDebugMesh = function (e, t) { + var i = this; + if (!this._utilityLayer) return null; + if (t && t.parent && t.parent.physicsImpostor) + return null; + var n = null, + r = this._utilityLayer.utilityLayerScene; + switch (e.type) { case y.a.BoxImpostor: - n = this._getDebugBoxMesh(r), + (n = this._getDebugBoxMesh(r)), e.getBoxSizeToRef(n.scaling); - break; + break; case y.a.SphereImpostor: - n = this._getDebugSphereMesh(r); - var o = e.getRadius(); - n.scaling.x = 2 * o, - n.scaling.y = 2 * o, - n.scaling.z = 2 * o; - break; + n = this._getDebugSphereMesh(r); + var o = e.getRadius(); + (n.scaling.x = 2 * o), + (n.scaling.y = 2 * o), + (n.scaling.z = 2 * o); + break; case y.a.MeshImpostor: - t && (n = this._getDebugMeshMesh(t, r)); - break; + t && (n = this._getDebugMeshMesh(t, r)); + break; case y.a.NoImpostor: - t && t.getChildMeshes().filter(function(e) { - return e.physicsImpostor ? 1 : 0 - }).forEach(function(e) { - i._getDebugBoxMesh(r).parent = e - }); - break; + t && + t + .getChildMeshes() + .filter(function (e) { + return e.physicsImpostor ? 1 : 0; + }) + .forEach(function (e) { + i._getDebugBoxMesh(r).parent = e; + }); + break; case y.a.CylinderImpostor: - n = this._getDebugCylinderMesh(r); - var a = e.object.getBoundingInfo(); - n.scaling.x = a.boundingBox.maximum.x - a.boundingBox.minimum.x, - n.scaling.y = a.boundingBox.maximum.y - a.boundingBox.minimum.y, - n.scaling.z = a.boundingBox.maximum.z - a.boundingBox.minimum.z - } - return n - } - , - e.prototype.dispose = function() { - for (var e = this._numMeshes, t = 0; t < e; t++) - this.hideImpostor(this._impostors[0]); - this._debugBoxMesh && this._debugBoxMesh.dispose(), - this._debugSphereMesh && this._debugSphereMesh.dispose(), - this._debugCylinderMesh && this._debugCylinderMesh.dispose(), + n = this._getDebugCylinderMesh(r); + var a = e.object.getBoundingInfo(); + (n.scaling.x = + a.boundingBox.maximum.x - a.boundingBox.minimum.x), + (n.scaling.y = + a.boundingBox.maximum.y - + a.boundingBox.minimum.y), + (n.scaling.z = + a.boundingBox.maximum.z - + a.boundingBox.minimum.z); + } + return n; + }), + (e.prototype.dispose = function () { + for (var e = this._numMeshes, t = 0; t < e; t++) + this.hideImpostor(this._impostors[0]); + this._debugBoxMesh && this._debugBoxMesh.dispose(), + this._debugSphereMesh && + this._debugSphereMesh.dispose(), + this._debugCylinderMesh && + this._debugCylinderMesh.dispose(), this._debugMaterial && this._debugMaterial.dispose(), - this._impostors.length = 0, - this._scene = null, - this._physicsEnginePlugin = null, - this._utilityLayer && (this._utilityLayer.dispose(), - this._utilityLayer = null) - } - , + (this._impostors.length = 0), + (this._scene = null), + (this._physicsEnginePlugin = null), + this._utilityLayer && + (this._utilityLayer.dispose(), + (this._utilityLayer = null)); + }), e - }() - , A = n(40) - , x = function() { - function e(e) { - this.ray = e - } - return e.CreateAndShow = function(t, i, n) { - var r = new e(t); - return r.show(i, n), - r - } - , - e.prototype.show = function(e, t) { - if (!this._renderFunction && this.ray) { - var i = this.ray; - this._renderFunction = this._render.bind(this), - this._scene = e, - this._renderPoints = [i.origin, i.origin.add(i.direction.scale(i.length))], - this._renderLine = m.a.CreateLines("ray", this._renderPoints, e, true), - this._renderFunction && this._scene.registerBeforeRender(this._renderFunction) - } - t && this._renderLine && this._renderLine.color.copyFrom(t) - } - , - e.prototype.hide = function() { - this._renderFunction && this._scene && (this._scene.unregisterBeforeRender(this._renderFunction), - this._scene = null, - this._renderFunction = null, - this._renderLine && (this._renderLine.dispose(), - this._renderLine = null), - this._renderPoints = []) - } - , - e.prototype._render = function() { - var e = this.ray; - if (e) { - var t = this._renderPoints[1] - , i = Math.min(e.length, 1e6); - t.copyFrom(e.direction), - t.scaleInPlace(i), - t.addInPlace(e.origin), - m.a.CreateLines("ray", this._renderPoints, this._scene, true, this._renderLine) - } - } - , - e.prototype.attachToMesh = function(e, t, i, n) { - this._attachedToMesh = e; - var o = this.ray; - o && (o.direction || (o.direction = r.x.Zero()), + ); + })(), + A = n(40), + x = (function () { + function e(e) { + this.ray = e; + } + return ( + (e.CreateAndShow = function (t, i, n) { + var r = new e(t); + return r.show(i, n), r; + }), + (e.prototype.show = function (e, t) { + if (!this._renderFunction && this.ray) { + var i = this.ray; + (this._renderFunction = this._render.bind(this)), + (this._scene = e), + (this._renderPoints = [ + i.origin, + i.origin.add(i.direction.scale(i.length)), + ]), + (this._renderLine = m.a.CreateLines( + "ray", + this._renderPoints, + e, + true + )), + this._renderFunction && + this._scene.registerBeforeRender( + this._renderFunction + ); + } + t && + this._renderLine && + this._renderLine.color.copyFrom(t); + }), + (e.prototype.hide = function () { + this._renderFunction && + this._scene && + (this._scene.unregisterBeforeRender( + this._renderFunction + ), + (this._scene = null), + (this._renderFunction = null), + this._renderLine && + (this._renderLine.dispose(), + (this._renderLine = null)), + (this._renderPoints = [])); + }), + (e.prototype._render = function () { + var e = this.ray; + if (e) { + var t = this._renderPoints[1], + i = Math.min(e.length, 1e6); + t.copyFrom(e.direction), + t.scaleInPlace(i), + t.addInPlace(e.origin), + m.a.CreateLines( + "ray", + this._renderPoints, + this._scene, + true, + this._renderLine + ); + } + }), + (e.prototype.attachToMesh = function (e, t, i, n) { + this._attachedToMesh = e; + var o = this.ray; + o && + (o.direction || (o.direction = r.x.Zero()), o.origin || (o.origin = r.x.Zero()), n && (o.length = n), i || (i = r.x.Zero()), - t || (t = new r.x(0,0,-1)), - this._meshSpaceDirection ? (this._meshSpaceDirection.copyFrom(t), - this._meshSpaceOrigin.copyFrom(i)) : (this._meshSpaceDirection = t.clone(), - this._meshSpaceOrigin = i.clone()), - this._updateToMeshFunction || (this._updateToMeshFunction = this._updateToMesh.bind(this), - this._attachedToMesh.getScene().registerBeforeRender(this._updateToMeshFunction)), - this._updateToMesh()) - } - , - e.prototype.detachFromMesh = function() { - this._attachedToMesh && (this._updateToMeshFunction && this._attachedToMesh.getScene().unregisterBeforeRender(this._updateToMeshFunction), - this._attachedToMesh = null, - this._updateToMeshFunction = null) - } - , - e.prototype._updateToMesh = function() { - var e = this.ray; - this._attachedToMesh && e && (this._attachedToMesh._isDisposed ? this.detachFromMesh() : (this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection, e.direction), - r.x.TransformCoordinatesToRef(this._meshSpaceOrigin, this._attachedToMesh.getWorldMatrix(), e.origin))) - } - , - e.prototype.dispose = function() { - this.hide(), - this.detachFromMesh(), - this.ray = null - } - , + t || (t = new r.x(0, 0, -1)), + this._meshSpaceDirection + ? (this._meshSpaceDirection.copyFrom(t), + this._meshSpaceOrigin.copyFrom(i)) + : ((this._meshSpaceDirection = t.clone()), + (this._meshSpaceOrigin = i.clone())), + this._updateToMeshFunction || + ((this._updateToMeshFunction = + this._updateToMesh.bind(this)), + this._attachedToMesh + .getScene() + .registerBeforeRender(this._updateToMeshFunction)), + this._updateToMesh()); + }), + (e.prototype.detachFromMesh = function () { + this._attachedToMesh && + (this._updateToMeshFunction && + this._attachedToMesh + .getScene() + .unregisterBeforeRender(this._updateToMeshFunction), + (this._attachedToMesh = null), + (this._updateToMeshFunction = null)); + }), + (e.prototype._updateToMesh = function () { + var e = this.ray; + this._attachedToMesh && + e && + (this._attachedToMesh._isDisposed + ? this.detachFromMesh() + : (this._attachedToMesh.getDirectionToRef( + this._meshSpaceDirection, + e.direction + ), + r.x.TransformCoordinatesToRef( + this._meshSpaceOrigin, + this._attachedToMesh.getWorldMatrix(), + e.origin + ))); + }), + (e.prototype.dispose = function () { + this.hide(), this.detachFromMesh(), (this.ray = null); + }), e - }() - , S = function() { - function e(e, t, i, n, o) { - void 0 === n && (n = true), - void 0 === o && (o = 1), - this.skeleton = e, - this.mesh = t, - this.autoUpdateBonesMatrices = n, - this.renderingGroupId = o, - this.color = r.e.White(), - this._debugLines = new Array, - this._isEnabled = false, - this._scene = i, - this._utilityLayer = new b.a(this._scene,false), - this._utilityLayer.pickUtilitySceneFirst = false, - this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true, - this.update(), - this._renderFunction = this.update.bind(this) - } - return Object.defineProperty(e.prototype, "debugMesh", { - get: function() { - return this._debugMesh - }, - enumerable: true, - configurable: true + ); + })(), + S = (function () { + function e(e, t, i, n, o) { + void 0 === n && (n = true), + void 0 === o && (o = 1), + (this.skeleton = e), + (this.mesh = t), + (this.autoUpdateBonesMatrices = n), + (this.renderingGroupId = o), + (this.color = r.e.White()), + (this._debugLines = new Array()), + (this._isEnabled = false), + (this._scene = i), + (this._utilityLayer = new b.a(this._scene, false)), + (this._utilityLayer.pickUtilitySceneFirst = false), + (this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true), + this.update(), + (this._renderFunction = this.update.bind(this)); + } + return ( + Object.defineProperty(e.prototype, "debugMesh", { + get: function () { + return this._debugMesh; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isEnabled", { - get: function() { - return this._isEnabled - }, - set: function(e) { - this._isEnabled !== e && (this._isEnabled = e, - e ? this._scene.registerBeforeRender(this._renderFunction) : this._scene.unregisterBeforeRender(this._renderFunction)) - }, - enumerable: true, - configurable: true + get: function () { + return this._isEnabled; + }, + set: function (e) { + this._isEnabled !== e && + ((this._isEnabled = e), + e + ? this._scene.registerBeforeRender( + this._renderFunction + ) + : this._scene.unregisterBeforeRender( + this._renderFunction + )); + }, + enumerable: true, + configurable: true, }), - e.prototype._getBonePosition = function(e, t, i, n, o, a) { - void 0 === n && (n = 0), + (e.prototype._getBonePosition = function ( + e, + t, + i, + n, + o, + a + ) { + void 0 === n && (n = 0), void 0 === o && (o = 0), void 0 === a && (a = 0); - var s = r.t.Matrix[0] - , c = t.getParent(); - if (s.copyFrom(t.getLocalMatrix()), - 0 !== n || 0 !== o || 0 !== a) { - var u = r.t.Matrix[1]; - r.j.IdentityToRef(u), - u.setTranslationFromFloats(n, o, a), - u.multiplyToRef(s, s) - } - c && s.multiplyToRef(c.getAbsoluteTransform(), s), + var s = r.t.Matrix[0], + c = t.getParent(); + if ( + (s.copyFrom(t.getLocalMatrix()), + 0 !== n || 0 !== o || 0 !== a) + ) { + var u = r.t.Matrix[1]; + r.j.IdentityToRef(u), + u.setTranslationFromFloats(n, o, a), + u.multiplyToRef(s, s); + } + c && s.multiplyToRef(c.getAbsoluteTransform(), s), s.multiplyToRef(i, s), - e.x = s.m[12], - e.y = s.m[13], - e.z = s.m[14] - } - , - e.prototype._getLinesForBonesWithLength = function(e, t) { - for (var i = e.length, n = this.mesh._effectiveMesh.position, o = 0; o < i; o++) { - var a = e[o] - , s = this._debugLines[o]; - s || (s = [r.x.Zero(), r.x.Zero()], - this._debugLines[o] = s), - this._getBonePosition(s[0], a, t), - this._getBonePosition(s[1], a, t, 0, a.length, 0), - s[0].subtractInPlace(n), - s[1].subtractInPlace(n) - } - } - , - e.prototype._getLinesForBonesNoLength = function(e, t) { - for (var i = e.length, n = 0, o = this.mesh._effectiveMesh, a = o.position, s = i - 1; s >= 0; s--) { - var c = e[s] - , u = c.getParent(); - if (u) { - var l = this._debugLines[n]; - l || (l = [r.x.Zero(), r.x.Zero()], - this._debugLines[n] = l), - c.getAbsolutePositionToRef(o, l[0]), - u.getAbsolutePositionToRef(o, l[1]), - l[0].subtractInPlace(a), - l[1].subtractInPlace(a), - n++ - } - } - } - , - e.prototype.update = function() { - if (this._utilityLayer) { - this.autoUpdateBonesMatrices && this.skeleton.computeAbsoluteTransforms(); - var e = this.mesh._effectiveMesh; - void 0 === this.skeleton.bones[0].length ? this._getLinesForBonesNoLength(this.skeleton.bones, e.getWorldMatrix()) : this._getLinesForBonesWithLength(this.skeleton.bones, e.getWorldMatrix()); - var t = this._utilityLayer.utilityLayerScene; - this._debugMesh ? A.a.CreateLineSystem("", { - lines: this._debugLines, - updatable: true, - instance: this._debugMesh - }, t) : (this._debugMesh = A.a.CreateLineSystem("", { - lines: this._debugLines, - updatable: true, - instance: null - }, t), - this._debugMesh.renderingGroupId = this.renderingGroupId), - this._debugMesh.position.copyFrom(this.mesh.position), - this._debugMesh.color = this.color - } - } - , - e.prototype.dispose = function() { - this.isEnabled = false, - this._debugMesh && (this.isEnabled = false, - this._debugMesh.dispose(), - this._debugMesh = null), - this._utilityLayer && (this._utilityLayer.dispose(), - this._utilityLayer = null) - } - , - e - }(); - n.d(t, "AxesViewer", function() { - return s - }), - n.d(t, "BoneAxesViewer", function() { - return u - }), - n.d(t, "DebugLayer", function() { - return p - }), - n.d(t, "PhysicsViewer", function() { - return T - }), - n.d(t, "RayHelper", function() { - return x - }), - n.d(t, "SkeletonViewer", function() { - return S - }) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return o - }); - var n = i(1) - , r = i(0) - , o = function(e) { - function t(t, i) { - var n = e.call(this, t, i) || this; - return n._normalMatrix = new r.j, - n.allowShaderHotSwapping = true, - n._storeEffectOnSubMeshes = true, - n - } - return n.d(t, e), - t.prototype.getEffect = function() { - return this._activeEffect - } - , - t.prototype.isReady = function(e, t) { - return !!e && (!e.subMeshes || 0 === e.subMeshes.length || this.isReadyForSubMesh(e, e.subMeshes[0], t)) - } - , - t.prototype.bindOnlyWorldMatrix = function(e) { - this._activeEffect.setMatrix("world", e) - } - , - t.prototype.bindOnlyNormalMatrix = function(e) { - this._activeEffect.setMatrix("normalMatrix", e) - } - , - t.prototype.bind = function(e, t) { - t && this.bindForSubMesh(e, t, t.subMeshes[0]) - } - , - t.prototype._afterBind = function(t, i) { - void 0 === i && (i = null), - e.prototype._afterBind.call(this, t), - this.getScene()._cachedEffect = i - } - , - t.prototype._mustRebind = function(e, t, i) { - return void 0 === i && (i = 1), - e.isCachedMaterialInvalid(this, t, i) - } - , - t - }(i(20).a) - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return f - }); - var n = i(1) - , r = i(2) - , o = i(0) - , a = i(4) - , s = i(7) - , c = i(15) - , u = i(5) - , l = i(20) - , h = i(22) - , f = function(e) { - function t(t, i, r, a) { - void 0 === a && (a = {}); - var s = e.call(this, t, i) || this; - return s._textures = {}, - s._textureArrays = {}, - s._floats = {}, - s._ints = {}, - s._floatsArrays = {}, - s._colors3 = {}, - s._colors3Arrays = {}, - s._colors4 = {}, - s._vectors2 = {}, - s._vectors3 = {}, - s._vectors4 = {}, - s._matrices = {}, - s._matrices3x3 = {}, - s._matrices2x2 = {}, - s._vectors2Arrays = {}, - s._vectors3Arrays = {}, - s._cachedWorldViewMatrix = new o.j, - s._shaderPath = r, - s._options = n.a({ - needAlphaBlending: false, - needAlphaTesting: false, - attributes: ["position", "normal", "uv"], - uniforms: ["worldViewProjection"], - uniformBuffers: [], - samplers: [], - defines: [] - }, a), - s - } - return n.d(t, e), - Object.defineProperty(t.prototype, "options", { - get: function() { - return this._options - }, - enumerable: true, - configurable: true + (e.x = s.m[12]), + (e.y = s.m[13]), + (e.z = s.m[14]); }), - t.prototype.getClassName = function() { - return "ShaderMaterial" - } - , - t.prototype.needAlphaBlending = function() { - return this.alpha < 1 || this._options.needAlphaBlending - } - , - t.prototype.needAlphaTesting = function() { - return this._options.needAlphaTesting - } - , - t.prototype._checkUniform = function(e) { - -1 === this._options.uniforms.indexOf(e) && this._options.uniforms.push(e) - } - , - t.prototype.setTexture = function(e, t) { - return -1 === this._options.samplers.indexOf(e) && this._options.samplers.push(e), - this._textures[e] = t, + (e.prototype._getLinesForBonesWithLength = function (e, t) { + for ( + var i = e.length, + n = this.mesh._effectiveMesh.position, + o = 0; + o < i; + o++ + ) { + var a = e[o], + s = this._debugLines[o]; + s || + ((s = [r.x.Zero(), r.x.Zero()]), + (this._debugLines[o] = s)), + this._getBonePosition(s[0], a, t), + this._getBonePosition(s[1], a, t, 0, a.length, 0), + s[0].subtractInPlace(n), + s[1].subtractInPlace(n); + } + }), + (e.prototype._getLinesForBonesNoLength = function (e, t) { + for ( + var i = e.length, + n = 0, + o = this.mesh._effectiveMesh, + a = o.position, + s = i - 1; + s >= 0; + s-- + ) { + var c = e[s], + u = c.getParent(); + if (u) { + var l = this._debugLines[n]; + l || + ((l = [r.x.Zero(), r.x.Zero()]), + (this._debugLines[n] = l)), + c.getAbsolutePositionToRef(o, l[0]), + u.getAbsolutePositionToRef(o, l[1]), + l[0].subtractInPlace(a), + l[1].subtractInPlace(a), + n++; + } + } + }), + (e.prototype.update = function () { + if (this._utilityLayer) { + this.autoUpdateBonesMatrices && + this.skeleton.computeAbsoluteTransforms(); + var e = this.mesh._effectiveMesh; + void 0 === this.skeleton.bones[0].length + ? this._getLinesForBonesNoLength( + this.skeleton.bones, + e.getWorldMatrix() + ) + : this._getLinesForBonesWithLength( + this.skeleton.bones, + e.getWorldMatrix() + ); + var t = this._utilityLayer.utilityLayerScene; + this._debugMesh + ? A.a.CreateLineSystem( + "", + { + lines: this._debugLines, + updatable: true, + instance: this._debugMesh, + }, + t + ) + : ((this._debugMesh = A.a.CreateLineSystem( + "", + { + lines: this._debugLines, + updatable: true, + instance: null, + }, + t + )), + (this._debugMesh.renderingGroupId = + this.renderingGroupId)), + this._debugMesh.position.copyFrom(this.mesh.position), + (this._debugMesh.color = this.color); + } + }), + (e.prototype.dispose = function () { + (this.isEnabled = false), + this._debugMesh && + ((this.isEnabled = false), + this._debugMesh.dispose(), + (this._debugMesh = null)), + this._utilityLayer && + (this._utilityLayer.dispose(), + (this._utilityLayer = null)); + }), + e + ); + })(); + n.d(t, "AxesViewer", function () { + return s; + }), + n.d(t, "BoneAxesViewer", function () { + return u; + }), + n.d(t, "DebugLayer", function () { + return p; + }), + n.d(t, "PhysicsViewer", function () { + return T; + }), + n.d(t, "RayHelper", function () { + return x; + }), + n.d(t, "SkeletonViewer", function () { + return S; + }); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return o; + }); + var n = i(1), + r = i(0), + o = (function (e) { + function t(t, i) { + var n = e.call(this, t, i) || this; + return ( + (n._normalMatrix = new r.j()), + (n.allowShaderHotSwapping = true), + (n._storeEffectOnSubMeshes = true), + n + ); + } + return ( + n.d(t, e), + (t.prototype.getEffect = function () { + return this._activeEffect; + }), + (t.prototype.isReady = function (e, t) { + return ( + !!e && + (!e.subMeshes || + 0 === e.subMeshes.length || + this.isReadyForSubMesh(e, e.subMeshes[0], t)) + ); + }), + (t.prototype.bindOnlyWorldMatrix = function (e) { + this._activeEffect.setMatrix("world", e); + }), + (t.prototype.bindOnlyNormalMatrix = function (e) { + this._activeEffect.setMatrix("normalMatrix", e); + }), + (t.prototype.bind = function (e, t) { + t && this.bindForSubMesh(e, t, t.subMeshes[0]); + }), + (t.prototype._afterBind = function (t, i) { + void 0 === i && (i = null), + e.prototype._afterBind.call(this, t), + (this.getScene()._cachedEffect = i); + }), + (t.prototype._mustRebind = function (e, t, i) { + return ( + void 0 === i && (i = 1), + e.isCachedMaterialInvalid(this, t, i) + ); + }), + t + ); + })(i(20).a); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return f; + }); + var n = i(1), + r = i(2), + o = i(0), + a = i(4), + s = i(7), + c = i(15), + u = i(5), + l = i(20), + h = i(22), + f = (function (e) { + function t(t, i, r, a) { + void 0 === a && (a = {}); + var s = e.call(this, t, i) || this; + return ( + (s._textures = {}), + (s._textureArrays = {}), + (s._floats = {}), + (s._ints = {}), + (s._floatsArrays = {}), + (s._colors3 = {}), + (s._colors3Arrays = {}), + (s._colors4 = {}), + (s._vectors2 = {}), + (s._vectors3 = {}), + (s._vectors4 = {}), + (s._matrices = {}), + (s._matrices3x3 = {}), + (s._matrices2x2 = {}), + (s._vectors2Arrays = {}), + (s._vectors3Arrays = {}), + (s._cachedWorldViewMatrix = new o.j()), + (s._shaderPath = r), + (s._options = n.a( + { + needAlphaBlending: false, + needAlphaTesting: false, + attributes: ["position", "normal", "uv"], + uniforms: ["worldViewProjection"], + uniformBuffers: [], + samplers: [], + defines: [], + }, + a + )), + s + ); + } + return ( + n.d(t, e), + Object.defineProperty(t.prototype, "options", { + get: function () { + return this._options; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "ShaderMaterial"; + }), + (t.prototype.needAlphaBlending = function () { + return this.alpha < 1 || this._options.needAlphaBlending; + }), + (t.prototype.needAlphaTesting = function () { + return this._options.needAlphaTesting; + }), + (t.prototype._checkUniform = function (e) { + -1 === this._options.uniforms.indexOf(e) && + this._options.uniforms.push(e); + }), + (t.prototype.setTexture = function (e, t) { + return ( + -1 === this._options.samplers.indexOf(e) && + this._options.samplers.push(e), + (this._textures[e] = t), this - } - , - t.prototype.setTextureArray = function(e, t) { - return -1 === this._options.samplers.indexOf(e) && this._options.samplers.push(e), + ); + }), + (t.prototype.setTextureArray = function (e, t) { + return ( + -1 === this._options.samplers.indexOf(e) && + this._options.samplers.push(e), this._checkUniform(e), - this._textureArrays[e] = t, + (this._textureArrays[e] = t), this - } - , - t.prototype.setFloat = function(e, t) { - return this._checkUniform(e), - this._floats[e] = t, + ); + }), + (t.prototype.setFloat = function (e, t) { + return this._checkUniform(e), (this._floats[e] = t), this; + }), + (t.prototype.setInt = function (e, t) { + return this._checkUniform(e), (this._ints[e] = t), this; + }), + (t.prototype.setFloats = function (e, t) { + return ( + this._checkUniform(e), (this._floatsArrays[e] = t), this + ); + }), + (t.prototype.setColor3 = function (e, t) { + return ( + this._checkUniform(e), (this._colors3[e] = t), this + ); + }), + (t.prototype.setColor3Array = function (e, t) { + return ( + this._checkUniform(e), + (this._colors3Arrays[e] = t.reduce(function (e, t) { + return t.toArray(e, e.length), e; + }, [])), this - } - , - t.prototype.setInt = function(e, t) { - return this._checkUniform(e), - this._ints[e] = t, + ); + }), + (t.prototype.setColor4 = function (e, t) { + return ( + this._checkUniform(e), (this._colors4[e] = t), this + ); + }), + (t.prototype.setVector2 = function (e, t) { + return ( + this._checkUniform(e), (this._vectors2[e] = t), this + ); + }), + (t.prototype.setVector3 = function (e, t) { + return ( + this._checkUniform(e), (this._vectors3[e] = t), this + ); + }), + (t.prototype.setVector4 = function (e, t) { + return ( + this._checkUniform(e), (this._vectors4[e] = t), this + ); + }), + (t.prototype.setMatrix = function (e, t) { + return ( + this._checkUniform(e), (this._matrices[e] = t), this + ); + }), + (t.prototype.setMatrix3x3 = function (e, t) { + return ( + this._checkUniform(e), (this._matrices3x3[e] = t), this + ); + }), + (t.prototype.setMatrix2x2 = function (e, t) { + return ( + this._checkUniform(e), (this._matrices2x2[e] = t), this + ); + }), + (t.prototype.setArray2 = function (e, t) { + return ( + this._checkUniform(e), + (this._vectors2Arrays[e] = t), this - } - , - t.prototype.setFloats = function(e, t) { - return this._checkUniform(e), - this._floatsArrays[e] = t, + ); + }), + (t.prototype.setArray3 = function (e, t) { + return ( + this._checkUniform(e), + (this._vectors3Arrays[e] = t), this - } - , - t.prototype.setColor3 = function(e, t) { - return this._checkUniform(e), - this._colors3[e] = t, - this - } - , - t.prototype.setColor3Array = function(e, t) { - return this._checkUniform(e), - this._colors3Arrays[e] = t.reduce(function(e, t) { - return t.toArray(e, e.length), - e - }, []), - this - } - , - t.prototype.setColor4 = function(e, t) { - return this._checkUniform(e), - this._colors4[e] = t, - this - } - , - t.prototype.setVector2 = function(e, t) { - return this._checkUniform(e), - this._vectors2[e] = t, - this - } - , - t.prototype.setVector3 = function(e, t) { - return this._checkUniform(e), - this._vectors3[e] = t, - this - } - , - t.prototype.setVector4 = function(e, t) { - return this._checkUniform(e), - this._vectors4[e] = t, - this - } - , - t.prototype.setMatrix = function(e, t) { - return this._checkUniform(e), - this._matrices[e] = t, - this - } - , - t.prototype.setMatrix3x3 = function(e, t) { - return this._checkUniform(e), - this._matrices3x3[e] = t, - this - } - , - t.prototype.setMatrix2x2 = function(e, t) { - return this._checkUniform(e), - this._matrices2x2[e] = t, - this - } - , - t.prototype.setArray2 = function(e, t) { - return this._checkUniform(e), - this._vectors2Arrays[e] = t, - this - } - , - t.prototype.setArray3 = function(e, t) { - return this._checkUniform(e), - this._vectors3Arrays[e] = t, - this - } - , - t.prototype._checkCache = function(e, t) { - return !e || (this._effect && this._effect.defines.indexOf("#define INSTANCES"), + ); + }), + (t.prototype._checkCache = function (e, t) { + return ( + !e || + (this._effect && + this._effect.defines.indexOf("#define INSTANCES"), false) - } - , - t.prototype.isReadyForSubMesh = function(e, t, i) { - return this.isReady(e, i) - } - , - t.prototype.isReady = function(e, t) { - var i = this.getScene() - , n = i.getEngine(); - if (!this.checkReadyOnEveryCall && this._renderId === i.getRenderId() && this._checkCache(e, t)) - return true; - for (var r = [], o = [], s = new u.c, l = 0; l < this._options.defines.length; l++) - r.push(this._options.defines[l]); - for (l = 0; l < this._options.attributes.length; l++) - o.push(this._options.attributes[l]); - if (e && e.isVerticesDataPresent(a.b.ColorKind) && (o.push(a.b.ColorKind), - r.push("#define VERTEXCOLOR")), - t && (r.push("#define INSTANCES"), - c.a.PrepareAttributesForInstances(o, r)), - e && e.useBones && e.computeBonesUsingShaders && e.skeleton) { - o.push(a.b.MatricesIndicesKind), - o.push(a.b.MatricesWeightsKind), - e.numBoneInfluencers > 4 && (o.push(a.b.MatricesIndicesExtraKind), + ); + }), + (t.prototype.isReadyForSubMesh = function (e, t, i) { + return this.isReady(e, i); + }), + (t.prototype.isReady = function (e, t) { + var i = this.getScene(), + n = i.getEngine(); + if ( + !this.checkReadyOnEveryCall && + this._renderId === i.getRenderId() && + this._checkCache(e, t) + ) + return true; + for ( + var r = [], o = [], s = new u.c(), l = 0; + l < this._options.defines.length; + l++ + ) + r.push(this._options.defines[l]); + for (l = 0; l < this._options.attributes.length; l++) + o.push(this._options.attributes[l]); + if ( + (e && + e.isVerticesDataPresent(a.b.ColorKind) && + (o.push(a.b.ColorKind), + r.push("#define VERTEXCOLOR")), + t && + (r.push("#define INSTANCES"), + c.a.PrepareAttributesForInstances(o, r)), + e && + e.useBones && + e.computeBonesUsingShaders && + e.skeleton) + ) { + o.push(a.b.MatricesIndicesKind), + o.push(a.b.MatricesWeightsKind), + e.numBoneInfluencers > 4 && + (o.push(a.b.MatricesIndicesExtraKind), o.push(a.b.MatricesWeightsExtraKind)); - var h = e.skeleton; - r.push("#define NUM_BONE_INFLUENCERS " + e.numBoneInfluencers), - s.addCPUSkinningFallback(0, e), - h.isUsingTextureForMatrices ? (r.push("#define BONETEXTURE"), - -1 === this._options.uniforms.indexOf("boneTextureWidth") && this._options.uniforms.push("boneTextureWidth"), - -1 === this._options.samplers.indexOf("boneSampler") && this._options.samplers.push("boneSampler")) : (r.push("#define BonesPerMesh " + (h.bones.length + 1)), - -1 === this._options.uniforms.indexOf("mBones") && this._options.uniforms.push("mBones")) - } else - r.push("#define NUM_BONE_INFLUENCERS 0"); - for (var f in this._textures) - if (!this._textures[f].isReady()) - return false; - e && this._shouldTurnAlphaTestOn(e) && r.push("#define ALPHATEST"); - var d = this._effect - , p = r.join("\n"); - return this._effect = n.createEffect(this._shaderPath, { + var h = e.skeleton; + r.push( + "#define NUM_BONE_INFLUENCERS " + e.numBoneInfluencers + ), + s.addCPUSkinningFallback(0, e), + h.isUsingTextureForMatrices + ? (r.push("#define BONETEXTURE"), + -1 === + this._options.uniforms.indexOf( + "boneTextureWidth" + ) && + this._options.uniforms.push("boneTextureWidth"), + -1 === + this._options.samplers.indexOf("boneSampler") && + this._options.samplers.push("boneSampler")) + : (r.push( + "#define BonesPerMesh " + (h.bones.length + 1) + ), + -1 === this._options.uniforms.indexOf("mBones") && + this._options.uniforms.push("mBones")); + } else r.push("#define NUM_BONE_INFLUENCERS 0"); + for (var f in this._textures) + if (!this._textures[f].isReady()) return false; + e && + this._shouldTurnAlphaTestOn(e) && + r.push("#define ALPHATEST"); + var d = this._effect, + p = r.join("\n"); + return ( + (this._effect = n.createEffect( + this._shaderPath, + { attributes: o, uniformsNames: this._options.uniforms, uniformBuffersNames: this._options.uniformBuffers, @@ -48723,245 +62253,296 @@ and limitations under the License. defines: p, fallbacks: s, onCompiled: this.onCompiled, - onError: this.onError - }, n), - !!this._effect.isReady() && (d !== this._effect && i.resetCachedMaterial(), - this._renderId = i.getRenderId(), - true) - } - , - t.prototype.bindOnlyWorldMatrix = function(e) { - var t = this.getScene(); - this._effect && (-1 !== this._options.uniforms.indexOf("world") && this._effect.setMatrix("world", e), - -1 !== this._options.uniforms.indexOf("worldView") && (e.multiplyToRef(t.getViewMatrix(), this._cachedWorldViewMatrix), - this._effect.setMatrix("worldView", this._cachedWorldViewMatrix)), - -1 !== this._options.uniforms.indexOf("worldViewProjection") && this._effect.setMatrix("worldViewProjection", e.multiply(t.getTransformMatrix()))) - } - , - t.prototype.bind = function(e, t) { - if (this.bindOnlyWorldMatrix(e), - this._effect && this.getScene().getCachedMaterial() !== this) { - var i; - for (i in -1 !== this._options.uniforms.indexOf("view") && this._effect.setMatrix("view", this.getScene().getViewMatrix()), - -1 !== this._options.uniforms.indexOf("projection") && this._effect.setMatrix("projection", this.getScene().getProjectionMatrix()), - -1 !== this._options.uniforms.indexOf("viewProjection") && this._effect.setMatrix("viewProjection", this.getScene().getTransformMatrix()), - c.a.BindBonesParameters(t, this._effect), - this._textures) - this._effect.setTexture(i, this._textures[i]); - for (i in this._textureArrays) - this._effect.setTextureArray(i, this._textureArrays[i]); - for (i in this._ints) - this._effect.setInt(i, this._ints[i]); - for (i in this._floats) - this._effect.setFloat(i, this._floats[i]); - for (i in this._floatsArrays) - this._effect.setArray(i, this._floatsArrays[i]); - for (i in this._colors3) - this._effect.setColor3(i, this._colors3[i]); - for (i in this._colors3Arrays) - this._effect.setArray3(i, this._colors3Arrays[i]); - for (i in this._colors4) { - var n = this._colors4[i]; - this._effect.setFloat4(i, n.r, n.g, n.b, n.a) - } - for (i in this._vectors2) - this._effect.setVector2(i, this._vectors2[i]); - for (i in this._vectors3) - this._effect.setVector3(i, this._vectors3[i]); - for (i in this._vectors4) - this._effect.setVector4(i, this._vectors4[i]); - for (i in this._matrices) - this._effect.setMatrix(i, this._matrices[i]); - for (i in this._matrices3x3) - this._effect.setMatrix3x3(i, this._matrices3x3[i]); - for (i in this._matrices2x2) - this._effect.setMatrix2x2(i, this._matrices2x2[i]); - for (i in this._vectors2Arrays) - this._effect.setArray2(i, this._vectors2Arrays[i]); - for (i in this._vectors3Arrays) - this._effect.setArray3(i, this._vectors3Arrays[i]) + onError: this.onError, + }, + n + )), + !!this._effect.isReady() && + (d !== this._effect && i.resetCachedMaterial(), + (this._renderId = i.getRenderId()), + true) + ); + }), + (t.prototype.bindOnlyWorldMatrix = function (e) { + var t = this.getScene(); + this._effect && + (-1 !== this._options.uniforms.indexOf("world") && + this._effect.setMatrix("world", e), + -1 !== this._options.uniforms.indexOf("worldView") && + (e.multiplyToRef( + t.getViewMatrix(), + this._cachedWorldViewMatrix + ), + this._effect.setMatrix( + "worldView", + this._cachedWorldViewMatrix + )), + -1 !== + this._options.uniforms.indexOf( + "worldViewProjection" + ) && + this._effect.setMatrix( + "worldViewProjection", + e.multiply(t.getTransformMatrix()) + )); + }), + (t.prototype.bind = function (e, t) { + if ( + (this.bindOnlyWorldMatrix(e), + this._effect && + this.getScene().getCachedMaterial() !== this) + ) { + var i; + for (i in (-1 !== + this._options.uniforms.indexOf("view") && + this._effect.setMatrix( + "view", + this.getScene().getViewMatrix() + ), + -1 !== this._options.uniforms.indexOf("projection") && + this._effect.setMatrix( + "projection", + this.getScene().getProjectionMatrix() + ), + -1 !== + this._options.uniforms.indexOf("viewProjection") && + this._effect.setMatrix( + "viewProjection", + this.getScene().getTransformMatrix() + ), + c.a.BindBonesParameters(t, this._effect), + this._textures)) + this._effect.setTexture(i, this._textures[i]); + for (i in this._textureArrays) + this._effect.setTextureArray( + i, + this._textureArrays[i] + ); + for (i in this._ints) + this._effect.setInt(i, this._ints[i]); + for (i in this._floats) + this._effect.setFloat(i, this._floats[i]); + for (i in this._floatsArrays) + this._effect.setArray(i, this._floatsArrays[i]); + for (i in this._colors3) + this._effect.setColor3(i, this._colors3[i]); + for (i in this._colors3Arrays) + this._effect.setArray3(i, this._colors3Arrays[i]); + for (i in this._colors4) { + var n = this._colors4[i]; + this._effect.setFloat4(i, n.r, n.g, n.b, n.a); } - this._afterBind(t) - } - , - t.prototype.getActiveTextures = function() { - var t = e.prototype.getActiveTextures.call(this); - for (var i in this._textures) - t.push(this._textures[i]); - for (var i in this._textureArrays) - for (var n = this._textureArrays[i], r = 0; r < n.length; r++) - t.push(n[r]); - return t - } - , - t.prototype.hasTexture = function(t) { - if (e.prototype.hasTexture.call(this, t)) - return true; - for (var i in this._textures) - if (this._textures[i] === t) - return true; - for (var i in this._textureArrays) - for (var n = this._textureArrays[i], r = 0; r < n.length; r++) - if (n[r] === t) - return true; - return false - } - , - t.prototype.clone = function(e) { - return new t(e,this.getScene(),this._shaderPath,this._options) - } - , - t.prototype.dispose = function(t, i, n) { - if (i) { - var r; - for (r in this._textures) - this._textures[r].dispose(); - for (r in this._textureArrays) - for (var o = this._textureArrays[r], a = 0; a < o.length; a++) - o[a].dispose() - } - this._textures = {}, - e.prototype.dispose.call(this, t, i, n) - } - , - t.prototype.serialize = function() { - var e, t = r.a.Serialize(this); - for (e in t.customType = "BABYLON.ShaderMaterial", - t.options = this._options, - t.shaderPath = this._shaderPath, - t.textures = {}, - this._textures) - t.textures[e] = this._textures[e].serialize(); - for (e in t.textureArrays = {}, - this._textureArrays) { - t.textureArrays[e] = []; - for (var i = this._textureArrays[e], n = 0; n < i.length; n++) - t.textureArrays[e].push(i[n].serialize()) - } - for (e in t.floats = {}, - this._floats) - t.floats[e] = this._floats[e]; - for (e in t.FloatArrays = {}, - this._floatsArrays) - t.FloatArrays[e] = this._floatsArrays[e]; - for (e in t.colors3 = {}, - this._colors3) - t.colors3[e] = this._colors3[e].asArray(); - for (e in t.colors3Arrays = {}, - this._colors3Arrays) - t.colors3Arrays[e] = this._colors3Arrays[e]; - for (e in t.colors4 = {}, - this._colors4) - t.colors4[e] = this._colors4[e].asArray(); - for (e in t.vectors2 = {}, - this._vectors2) - t.vectors2[e] = this._vectors2[e].asArray(); - for (e in t.vectors3 = {}, - this._vectors3) - t.vectors3[e] = this._vectors3[e].asArray(); - for (e in t.vectors4 = {}, - this._vectors4) - t.vectors4[e] = this._vectors4[e].asArray(); - for (e in t.matrices = {}, - this._matrices) - t.matrices[e] = this._matrices[e].asArray(); - for (e in t.matrices3x3 = {}, - this._matrices3x3) - t.matrices3x3[e] = this._matrices3x3[e]; - for (e in t.matrices2x2 = {}, - this._matrices2x2) - t.matrices2x2[e] = this._matrices2x2[e]; - for (e in t.vectors2Arrays = {}, - this._vectors2Arrays) - t.vectors2Arrays[e] = this._vectors2Arrays[e]; - for (e in t.vectors3Arrays = {}, - this._vectors3Arrays) - t.vectors3Arrays[e] = this._vectors3Arrays[e]; - return t - } - , - t.Parse = function(e, i, n) { - var a, c = r.a.Parse(function() { - return new t(e.name,i,e.shaderPath,e.options) - }, e, i, n); - for (a in e.textures) - c.setTexture(a, s.a.Parse(e.textures[a], i, n)); - for (a in e.textureArrays) { - for (var u = e.textureArrays[a], l = new Array, h = 0; h < u.length; h++) - l.push(s.a.Parse(u[h], i, n)); - c.setTextureArray(a, l) - } - for (a in e.floats) - c.setFloat(a, e.floats[a]); - for (a in e.floatsArrays) - c.setFloats(a, e.floatsArrays[a]); - for (a in e.colors3) - c.setColor3(a, o.e.FromArray(e.colors3[a])); - for (a in e.colors3Arrays) { - var f = e.colors3Arrays[a].reduce(function(e, t, i) { - return i % 3 == 0 ? e.push([t]) : e[e.length - 1].push(t), - e - }, []).map(function(e) { - return o.e.FromArray(e) - }); - c.setColor3Array(a, f) - } - for (a in e.colors4) - c.setColor4(a, o.f.FromArray(e.colors4[a])); - for (a in e.vectors2) - c.setVector2(a, o.w.FromArray(e.vectors2[a])); - for (a in e.vectors3) - c.setVector3(a, o.x.FromArray(e.vectors3[a])); - for (a in e.vectors4) - c.setVector4(a, o.y.FromArray(e.vectors4[a])); - for (a in e.matrices) - c.setMatrix(a, o.j.FromArray(e.matrices[a])); - for (a in e.matrices3x3) - c.setMatrix3x3(a, e.matrices3x3[a]); - for (a in e.matrices2x2) - c.setMatrix2x2(a, e.matrices2x2[a]); - for (a in e.vectors2Arrays) - c.setArray2(a, e.vectors2Arrays[a]); - for (a in e.vectors3Arrays) - c.setArray3(a, e.vectors3Arrays[a]); - return c - } - , + for (i in this._vectors2) + this._effect.setVector2(i, this._vectors2[i]); + for (i in this._vectors3) + this._effect.setVector3(i, this._vectors3[i]); + for (i in this._vectors4) + this._effect.setVector4(i, this._vectors4[i]); + for (i in this._matrices) + this._effect.setMatrix(i, this._matrices[i]); + for (i in this._matrices3x3) + this._effect.setMatrix3x3(i, this._matrices3x3[i]); + for (i in this._matrices2x2) + this._effect.setMatrix2x2(i, this._matrices2x2[i]); + for (i in this._vectors2Arrays) + this._effect.setArray2(i, this._vectors2Arrays[i]); + for (i in this._vectors3Arrays) + this._effect.setArray3(i, this._vectors3Arrays[i]); + } + this._afterBind(t); + }), + (t.prototype.getActiveTextures = function () { + var t = e.prototype.getActiveTextures.call(this); + for (var i in this._textures) t.push(this._textures[i]); + for (var i in this._textureArrays) + for ( + var n = this._textureArrays[i], r = 0; + r < n.length; + r++ + ) + t.push(n[r]); + return t; + }), + (t.prototype.hasTexture = function (t) { + if (e.prototype.hasTexture.call(this, t)) return true; + for (var i in this._textures) + if (this._textures[i] === t) return true; + for (var i in this._textureArrays) + for ( + var n = this._textureArrays[i], r = 0; + r < n.length; + r++ + ) + if (n[r] === t) return true; + return false; + }), + (t.prototype.clone = function (e) { + return new t( + e, + this.getScene(), + this._shaderPath, + this._options + ); + }), + (t.prototype.dispose = function (t, i, n) { + if (i) { + var r; + for (r in this._textures) this._textures[r].dispose(); + for (r in this._textureArrays) + for ( + var o = this._textureArrays[r], a = 0; + a < o.length; + a++ + ) + o[a].dispose(); + } + (this._textures = {}), + e.prototype.dispose.call(this, t, i, n); + }), + (t.prototype.serialize = function () { + var e, + t = r.a.Serialize(this); + for (e in ((t.customType = "BABYLON.ShaderMaterial"), + (t.options = this._options), + (t.shaderPath = this._shaderPath), + (t.textures = {}), + this._textures)) + t.textures[e] = this._textures[e].serialize(); + for (e in ((t.textureArrays = {}), this._textureArrays)) { + t.textureArrays[e] = []; + for ( + var i = this._textureArrays[e], n = 0; + n < i.length; + n++ + ) + t.textureArrays[e].push(i[n].serialize()); + } + for (e in ((t.floats = {}), this._floats)) + t.floats[e] = this._floats[e]; + for (e in ((t.FloatArrays = {}), this._floatsArrays)) + t.FloatArrays[e] = this._floatsArrays[e]; + for (e in ((t.colors3 = {}), this._colors3)) + t.colors3[e] = this._colors3[e].asArray(); + for (e in ((t.colors3Arrays = {}), this._colors3Arrays)) + t.colors3Arrays[e] = this._colors3Arrays[e]; + for (e in ((t.colors4 = {}), this._colors4)) + t.colors4[e] = this._colors4[e].asArray(); + for (e in ((t.vectors2 = {}), this._vectors2)) + t.vectors2[e] = this._vectors2[e].asArray(); + for (e in ((t.vectors3 = {}), this._vectors3)) + t.vectors3[e] = this._vectors3[e].asArray(); + for (e in ((t.vectors4 = {}), this._vectors4)) + t.vectors4[e] = this._vectors4[e].asArray(); + for (e in ((t.matrices = {}), this._matrices)) + t.matrices[e] = this._matrices[e].asArray(); + for (e in ((t.matrices3x3 = {}), this._matrices3x3)) + t.matrices3x3[e] = this._matrices3x3[e]; + for (e in ((t.matrices2x2 = {}), this._matrices2x2)) + t.matrices2x2[e] = this._matrices2x2[e]; + for (e in ((t.vectors2Arrays = {}), this._vectors2Arrays)) + t.vectors2Arrays[e] = this._vectors2Arrays[e]; + for (e in ((t.vectors3Arrays = {}), this._vectors3Arrays)) + t.vectors3Arrays[e] = this._vectors3Arrays[e]; + return t; + }), + (t.Parse = function (e, i, n) { + var a, + c = r.a.Parse( + function () { + return new t(e.name, i, e.shaderPath, e.options); + }, + e, + i, + n + ); + for (a in e.textures) + c.setTexture(a, s.a.Parse(e.textures[a], i, n)); + for (a in e.textureArrays) { + for ( + var u = e.textureArrays[a], l = new Array(), h = 0; + h < u.length; + h++ + ) + l.push(s.a.Parse(u[h], i, n)); + c.setTextureArray(a, l); + } + for (a in e.floats) c.setFloat(a, e.floats[a]); + for (a in e.floatsArrays) + c.setFloats(a, e.floatsArrays[a]); + for (a in e.colors3) + c.setColor3(a, o.e.FromArray(e.colors3[a])); + for (a in e.colors3Arrays) { + var f = e.colors3Arrays[a] + .reduce(function (e, t, i) { + return ( + i % 3 == 0 + ? e.push([t]) + : e[e.length - 1].push(t), + e + ); + }, []) + .map(function (e) { + return o.e.FromArray(e); + }); + c.setColor3Array(a, f); + } + for (a in e.colors4) + c.setColor4(a, o.f.FromArray(e.colors4[a])); + for (a in e.vectors2) + c.setVector2(a, o.w.FromArray(e.vectors2[a])); + for (a in e.vectors3) + c.setVector3(a, o.x.FromArray(e.vectors3[a])); + for (a in e.vectors4) + c.setVector4(a, o.y.FromArray(e.vectors4[a])); + for (a in e.matrices) + c.setMatrix(a, o.j.FromArray(e.matrices[a])); + for (a in e.matrices3x3) + c.setMatrix3x3(a, e.matrices3x3[a]); + for (a in e.matrices2x2) + c.setMatrix2x2(a, e.matrices2x2[a]); + for (a in e.vectors2Arrays) + c.setArray2(a, e.vectors2Arrays[a]); + for (a in e.vectors3Arrays) + c.setArray3(a, e.vectors3Arrays[a]); + return c; + }), t - }(l.a); - h.a.RegisteredTypes["BABYLON.ShaderMaterial"] = f - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return o - }); - var n = i(34) - , r = i(0) - , o = function() { - function e(e, t, i) { - this.vectors = n.a.BuildArray(8, r.x.Zero), - this.center = r.x.Zero(), - this.centerWorld = r.x.Zero(), - this.extendSize = r.x.Zero(), - this.extendSizeWorld = r.x.Zero(), - this.directions = n.a.BuildArray(3, r.x.Zero), - this.vectorsWorld = n.a.BuildArray(8, r.x.Zero), - this.minimumWorld = r.x.Zero(), - this.maximumWorld = r.x.Zero(), - this.minimum = r.x.Zero(), - this.maximum = r.x.Zero(), - this.reConstruct(e, t, i) - } - return e.prototype.reConstruct = function(e, t, i) { - var n = e.x - , o = e.y - , a = e.z - , s = t.x - , c = t.y - , u = t.z - , l = this.vectors; - this.minimum.copyFromFloats(n, o, a), + ); + })(l.a); + h.a.RegisteredTypes["BABYLON.ShaderMaterial"] = f; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return o; + }); + var n = i(34), + r = i(0), + o = (function () { + function e(e, t, i) { + (this.vectors = n.a.BuildArray(8, r.x.Zero)), + (this.center = r.x.Zero()), + (this.centerWorld = r.x.Zero()), + (this.extendSize = r.x.Zero()), + (this.extendSizeWorld = r.x.Zero()), + (this.directions = n.a.BuildArray(3, r.x.Zero)), + (this.vectorsWorld = n.a.BuildArray(8, r.x.Zero)), + (this.minimumWorld = r.x.Zero()), + (this.maximumWorld = r.x.Zero()), + (this.minimum = r.x.Zero()), + (this.maximum = r.x.Zero()), + this.reConstruct(e, t, i); + } + return ( + (e.prototype.reConstruct = function (e, t, i) { + var n = e.x, + o = e.y, + a = e.z, + s = t.x, + c = t.y, + u = t.z, + l = this.vectors; + this.minimum.copyFromFloats(n, o, a), this.maximum.copyFromFloats(s, c, u), l[0].copyFromFloats(n, o, a), l[1].copyFromFloats(s, c, u), @@ -48971,20362 +62552,29674 @@ and limitations under the License. l[5].copyFromFloats(s, c, a), l[6].copyFromFloats(n, c, u), l[7].copyFromFloats(s, o, u), - t.addToRef(e, this.center).scaleInPlace(.5), - t.subtractToRef(e, this.extendSize).scaleInPlace(.5), - this._worldMatrix = i || r.j.IdentityReadOnly, - this._update(this._worldMatrix) - } - , - e.prototype.scale = function(t) { - var i = e.TmpVector3 - , n = this.maximum.subtractToRef(this.minimum, i[0]) - , r = n.length(); - n.normalizeFromLength(r); - var o = r * t - , a = n.scaleInPlace(.5 * o) - , s = this.center.subtractToRef(a, i[1]) - , c = this.center.addToRef(a, i[2]); - return this.reConstruct(s, c, this._worldMatrix), - this - } - , - e.prototype.getWorldMatrix = function() { - return this._worldMatrix - } - , - e.prototype._update = function(e) { - var t = this.minimumWorld - , i = this.maximumWorld - , n = this.directions - , o = this.vectorsWorld - , a = this.vectors; - if (e.isIdentity()) { - for (t.copyFrom(this.minimum), + t.addToRef(e, this.center).scaleInPlace(0.5), + t.subtractToRef(e, this.extendSize).scaleInPlace(0.5), + (this._worldMatrix = i || r.j.IdentityReadOnly), + this._update(this._worldMatrix); + }), + (e.prototype.scale = function (t) { + var i = e.TmpVector3, + n = this.maximum.subtractToRef(this.minimum, i[0]), + r = n.length(); + n.normalizeFromLength(r); + var o = r * t, + a = n.scaleInPlace(0.5 * o), + s = this.center.subtractToRef(a, i[1]), + c = this.center.addToRef(a, i[2]); + return this.reConstruct(s, c, this._worldMatrix), this; + }), + (e.prototype.getWorldMatrix = function () { + return this._worldMatrix; + }), + (e.prototype._update = function (e) { + var t = this.minimumWorld, + i = this.maximumWorld, + n = this.directions, + o = this.vectorsWorld, + a = this.vectors; + if (e.isIdentity()) { + for ( + t.copyFrom(this.minimum), i.copyFrom(this.maximum), - s = 0; s < 8; ++s) - o[s].copyFrom(a[s]); - this.extendSizeWorld.copyFrom(this.extendSize), - this.centerWorld.copyFrom(this.center) - } else { - t.setAll(Number.MAX_VALUE), - i.setAll(-Number.MAX_VALUE); - for (var s = 0; s < 8; ++s) { - var c = o[s]; - r.x.TransformCoordinatesToRef(a[s], e, c), - t.minimizeInPlace(c), - i.maximizeInPlace(c) - } - i.subtractToRef(t, this.extendSizeWorld).scaleInPlace(.5), - i.addToRef(t, this.centerWorld).scaleInPlace(.5) + s = 0; + s < 8; + ++s + ) + o[s].copyFrom(a[s]); + this.extendSizeWorld.copyFrom(this.extendSize), + this.centerWorld.copyFrom(this.center); + } else { + t.setAll(Number.MAX_VALUE), i.setAll(-Number.MAX_VALUE); + for (var s = 0; s < 8; ++s) { + var c = o[s]; + r.x.TransformCoordinatesToRef(a[s], e, c), + t.minimizeInPlace(c), + i.maximizeInPlace(c); } - r.x.FromArrayToRef(e.m, 0, n[0]), + i + .subtractToRef(t, this.extendSizeWorld) + .scaleInPlace(0.5), + i.addToRef(t, this.centerWorld).scaleInPlace(0.5); + } + r.x.FromArrayToRef(e.m, 0, n[0]), r.x.FromArrayToRef(e.m, 4, n[1]), r.x.FromArrayToRef(e.m, 8, n[2]), - this._worldMatrix = e - } - , - e.prototype.isInFrustum = function(t) { - return e.IsInFrustum(this.vectorsWorld, t) - } - , - e.prototype.isCompletelyInFrustum = function(t) { - return e.IsCompletelyInFrustum(this.vectorsWorld, t) - } - , - e.prototype.intersectsPoint = function(e) { - var t = this.minimumWorld - , i = this.maximumWorld - , n = t.x - , o = t.y - , a = t.z - , s = i.x - , c = i.y - , u = i.z - , l = e.x - , h = e.y - , f = e.z - , d = -r.h; - return !(s - l < d || d > l - n || c - h < d || d > h - o || u - f < d || d > f - a) - } - , - e.prototype.intersectsSphere = function(t) { - return e.IntersectsSphere(this.minimumWorld, this.maximumWorld, t.centerWorld, t.radiusWorld) - } - , - e.prototype.intersectsMinMax = function(e, t) { - var i = this.minimumWorld - , n = this.maximumWorld - , r = i.x - , o = i.y - , a = i.z - , s = n.x - , c = n.y - , u = n.z - , l = e.x - , h = e.y - , f = e.z - , d = t.x - , p = t.y - , m = t.z; - return !(s < l || r > d || c < h || o > p || u < f || a > m) - } - , - e.Intersects = function(e, t) { - return e.intersectsMinMax(t.minimumWorld, t.maximumWorld) - } - , - e.IntersectsSphere = function(t, i, n, o) { - var a = e.TmpVector3[0]; - return r.x.ClampToRef(n, t, i, a), - r.x.DistanceSquared(n, a) <= o * o - } - , - e.IsCompletelyInFrustum = function(e, t) { - for (var i = 0; i < 6; ++i) - for (var n = t[i], r = 0; r < 8; ++r) - if (n.dotCoordinate(e[r]) < 0) - return false; - return true - } - , - e.IsInFrustum = function(e, t) { - for (var i = 0; i < 6; ++i) { - for (var n = true, r = t[i], o = 0; o < 8; ++o) - if (r.dotCoordinate(e[o]) >= 0) { - n = false; - break - } - if (n) - return false - } - return true - } - , - e.TmpVector3 = n.a.BuildArray(3, r.x.Zero), - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() { - this.references = 0, - this.capacity = 0, - this.is32Bits = false - } - return Object.defineProperty(e.prototype, "underlyingResource", { - get: function() { - return null - }, - enumerable: true, - configurable: true + (this._worldMatrix = e); }), + (e.prototype.isInFrustum = function (t) { + return e.IsInFrustum(this.vectorsWorld, t); + }), + (e.prototype.isCompletelyInFrustum = function (t) { + return e.IsCompletelyInFrustum(this.vectorsWorld, t); + }), + (e.prototype.intersectsPoint = function (e) { + var t = this.minimumWorld, + i = this.maximumWorld, + n = t.x, + o = t.y, + a = t.z, + s = i.x, + c = i.y, + u = i.z, + l = e.x, + h = e.y, + f = e.z, + d = -r.h; + return !( + s - l < d || + d > l - n || + c - h < d || + d > h - o || + u - f < d || + d > f - a + ); + }), + (e.prototype.intersectsSphere = function (t) { + return e.IntersectsSphere( + this.minimumWorld, + this.maximumWorld, + t.centerWorld, + t.radiusWorld + ); + }), + (e.prototype.intersectsMinMax = function (e, t) { + var i = this.minimumWorld, + n = this.maximumWorld, + r = i.x, + o = i.y, + a = i.z, + s = n.x, + c = n.y, + u = n.z, + l = e.x, + h = e.y, + f = e.z, + d = t.x, + p = t.y, + m = t.z; + return !( + s < l || + r > d || + c < h || + o > p || + u < f || + a > m + ); + }), + (e.Intersects = function (e, t) { + return e.intersectsMinMax(t.minimumWorld, t.maximumWorld); + }), + (e.IntersectsSphere = function (t, i, n, o) { + var a = e.TmpVector3[0]; + return ( + r.x.ClampToRef(n, t, i, a), + r.x.DistanceSquared(n, a) <= o * o + ); + }), + (e.IsCompletelyInFrustum = function (e, t) { + for (var i = 0; i < 6; ++i) + for (var n = t[i], r = 0; r < 8; ++r) + if (n.dotCoordinate(e[r]) < 0) return false; + return true; + }), + (e.IsInFrustum = function (e, t) { + for (var i = 0; i < 6; ++i) { + for (var n = true, r = t[i], o = 0; o < 8; ++o) + if (r.dotCoordinate(e[o]) >= 0) { + n = false; + break; + } + if (n) return false; + } + return true; + }), + (e.TmpVector3 = n.a.BuildArray(3, r.x.Zero)), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }); - var n = i(3) - , r = function() { - function e() { - this.hoverCursor = "", - this.actions = new Array, - this.isRecursive = false - } - return Object.defineProperty(e, "HasTriggers", { - get: function() { - for (var t in e.Triggers) - if (e.Triggers.hasOwnProperty(t)) - return true; - return false - }, - enumerable: true, - configurable: true + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() { + (this.references = 0), + (this.capacity = 0), + (this.is32Bits = false); + } + return ( + Object.defineProperty(e.prototype, "underlyingResource", { + get: function () { + return null; + }, + enumerable: true, + configurable: true, + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }); + var n = i(3), + r = (function () { + function e() { + (this.hoverCursor = ""), + (this.actions = new Array()), + (this.isRecursive = false); + } + return ( + Object.defineProperty(e, "HasTriggers", { + get: function () { + for (var t in e.Triggers) + if (e.Triggers.hasOwnProperty(t)) return true; + return false; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "HasPickTriggers", { - get: function() { - for (var t in e.Triggers) - if (e.Triggers.hasOwnProperty(t)) { - var i = parseInt(t); - if (i >= n.a.ACTION_OnPickTrigger && i <= n.a.ACTION_OnPickUpTrigger) - return true - } - return false - }, - enumerable: true, - configurable: true + get: function () { + for (var t in e.Triggers) + if (e.Triggers.hasOwnProperty(t)) { + var i = parseInt(t); + if ( + i >= n.a.ACTION_OnPickTrigger && + i <= n.a.ACTION_OnPickUpTrigger + ) + return true; + } + return false; + }, + enumerable: true, + configurable: true, }), - e.HasSpecificTrigger = function(t) { - for (var i in e.Triggers) - if (e.Triggers.hasOwnProperty(i) && parseInt(i) === t) - return true; - return false - } - , - e.Triggers = {}, + (e.HasSpecificTrigger = function (t) { + for (var i in e.Triggers) + if (e.Triggers.hasOwnProperty(i) && parseInt(i) === t) + return true; + return false; + }), + (e.Triggers = {}), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return o + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return o; + }); + var n = i(11), + r = i(13); + (r.a.CreatePlane = function (e) { + var t = [], + i = [], + n = [], + o = [], + a = e.width || e.size || 1, + s = e.height || e.size || 1, + c = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || r.a.DEFAULTSIDE, + u = a / 2, + l = s / 2; + i.push(-u, -l, 0), + n.push(0, 0, -1), + o.push(0, 0), + i.push(u, -l, 0), + n.push(0, 0, -1), + o.push(1, 0), + i.push(u, l, 0), + n.push(0, 0, -1), + o.push(1, 1), + i.push(-u, l, 0), + n.push(0, 0, -1), + o.push(0, 1), + t.push(0), + t.push(1), + t.push(2), + t.push(0), + t.push(2), + t.push(3), + r.a._ComputeSides(c, i, t, n, o, e.frontUVs, e.backUVs); + var h = new r.a(); + return ( + (h.indices = t), + (h.positions = i), + (h.normals = n), + (h.uvs = o), + h + ); + }), + (n.a.CreatePlane = function (e, t, i, n, r) { + var a = { + size: t, + width: t, + height: t, + sideOrientation: r, + updatable: n, + }; + return o.CreatePlane(e, a, i); }); - var n = i(11) - , r = i(13); - r.a.CreatePlane = function(e) { - var t = [] - , i = [] - , n = [] - , o = [] - , a = e.width || e.size || 1 - , s = e.height || e.size || 1 - , c = 0 === e.sideOrientation ? 0 : e.sideOrientation || r.a.DEFAULTSIDE - , u = a / 2 - , l = s / 2; - i.push(-u, -l, 0), - n.push(0, 0, -1), - o.push(0, 0), - i.push(u, -l, 0), - n.push(0, 0, -1), - o.push(1, 0), - i.push(u, l, 0), - n.push(0, 0, -1), - o.push(1, 1), - i.push(-u, l, 0), - n.push(0, 0, -1), - o.push(0, 1), - t.push(0), - t.push(1), - t.push(2), - t.push(0), - t.push(2), - t.push(3), - r.a._ComputeSides(c, i, t, n, o, e.frontUVs, e.backUVs); - var h = new r.a; - return h.indices = t, - h.positions = i, - h.normals = n, - h.uvs = o, - h - } - , - n.a.CreatePlane = function(e, t, i, n, r) { - var a = { - size: t, - width: t, - height: t, - sideOrientation: r, - updatable: n - }; - return o.CreatePlane(e, a, i) - } - ; - var o = function() { - function e() {} - return e.CreatePlane = function(e, t, i) { - void 0 === i && (i = null); - var o = new n.a(e,i); - return t.sideOrientation = n.a._GetDefaultSideOrientation(t.sideOrientation), - o._originalBuilderSideOrientation = t.sideOrientation, - r.a.CreatePlane(t).applyToMesh(o, t.updatable), - t.sourcePlane && (o.translate(t.sourcePlane.normal, -t.sourcePlane.d), + var o = (function () { + function e() {} + return ( + (e.CreatePlane = function (e, t, i) { + void 0 === i && (i = null); + var o = new n.a(e, i); + return ( + (t.sideOrientation = n.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (o._originalBuilderSideOrientation = t.sideOrientation), + r.a.CreatePlane(t).applyToMesh(o, t.updatable), + t.sourcePlane && + (o.translate(t.sourcePlane.normal, -t.sourcePlane.d), o.setDirection(t.sourcePlane.normal.scale(-1))), - o - } - , + o + ); + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = function (e, t, i) { + (this.bu = e), + (this.bv = t), + (this.distance = i), + (this.faceId = 0), + (this.subMeshId = 0); + }; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return o; + }); + var n = i(34), + r = i(0), + o = (function () { + function e(e, t, i) { + (this.center = r.x.Zero()), + (this.centerWorld = r.x.Zero()), + (this.minimum = r.x.Zero()), + (this.maximum = r.x.Zero()), + this.reConstruct(e, t, i); + } + return ( + (e.prototype.reConstruct = function (e, t, i) { + this.minimum.copyFrom(e), this.maximum.copyFrom(t); + var n = r.x.Distance(e, t); + t.addToRef(e, this.center).scaleInPlace(0.5), + (this.radius = 0.5 * n), + this._update(i || r.j.IdentityReadOnly); + }), + (e.prototype.scale = function (t) { + var i = this.radius * t, + n = e.TmpVector3, + r = n[0].setAll(i), + o = this.center.subtractToRef(r, n[1]), + a = this.center.addToRef(r, n[2]); + return this.reConstruct(o, a, this._worldMatrix), this; + }), + (e.prototype.getWorldMatrix = function () { + return this._worldMatrix; + }), + (e.prototype._update = function (t) { + if (t.isIdentity()) + this.centerWorld.copyFrom(this.center), + (this.radiusWorld = this.radius); + else { + r.x.TransformCoordinatesToRef( + this.center, + t, + this.centerWorld + ); + var i = e.TmpVector3[0]; + r.x.TransformNormalFromFloatsToRef(1, 1, 1, t, i), + (this.radiusWorld = + Math.max( + Math.abs(i.x), + Math.abs(i.y), + Math.abs(i.z) + ) * this.radius); + } + }), + (e.prototype.isInFrustum = function (e) { + for ( + var t = this.centerWorld, i = this.radiusWorld, n = 0; + n < 6; + n++ + ) + if (e[n].dotCoordinate(t) <= -i) return false; + return true; + }), + (e.prototype.isCenterInFrustum = function (e) { + for (var t = this.centerWorld, i = 0; i < 6; i++) + if (e[i].dotCoordinate(t) < 0) return false; + return true; + }), + (e.prototype.intersectsPoint = function (e) { + var t = r.x.DistanceSquared(this.centerWorld, e); + return !(this.radiusWorld * this.radiusWorld < t); + }), + (e.Intersects = function (e, t) { + var i = r.x.DistanceSquared(e.centerWorld, t.centerWorld), + n = e.radiusWorld + t.radiusWorld; + return !(n * n < i); + }), + (e.TmpVector3 = n.a.BuildArray(3, r.x.Zero)), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function(e, t, i) { - this.bu = e, - this.bv = t, - this.distance = i, - this.faceId = 0, - this.subMeshId = 0 - } - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return o - }); - var n = i(34) - , r = i(0) - , o = function() { - function e(e, t, i) { - this.center = r.x.Zero(), - this.centerWorld = r.x.Zero(), - this.minimum = r.x.Zero(), - this.maximum = r.x.Zero(), - this.reConstruct(e, t, i) - } - return e.prototype.reConstruct = function(e, t, i) { - this.minimum.copyFrom(e), - this.maximum.copyFrom(t); - var n = r.x.Distance(e, t); - t.addToRef(e, this.center).scaleInPlace(.5), - this.radius = .5 * n, - this._update(i || r.j.IdentityReadOnly) - } - , - e.prototype.scale = function(t) { - var i = this.radius * t - , n = e.TmpVector3 - , r = n[0].setAll(i) - , o = this.center.subtractToRef(r, n[1]) - , a = this.center.addToRef(r, n[2]); - return this.reConstruct(o, a, this._worldMatrix), - this - } - , - e.prototype.getWorldMatrix = function() { - return this._worldMatrix - } - , - e.prototype._update = function(t) { - if (t.isIdentity()) - this.centerWorld.copyFrom(this.center), - this.radiusWorld = this.radius; - else { - r.x.TransformCoordinatesToRef(this.center, t, this.centerWorld); - var i = e.TmpVector3[0]; - r.x.TransformNormalFromFloatsToRef(1, 1, 1, t, i), - this.radiusWorld = Math.max(Math.abs(i.x), Math.abs(i.y), Math.abs(i.z)) * this.radius - } - } - , - e.prototype.isInFrustum = function(e) { - for (var t = this.centerWorld, i = this.radiusWorld, n = 0; n < 6; n++) - if (e[n].dotCoordinate(t) <= -i) - return false; - return true - } - , - e.prototype.isCenterInFrustum = function(e) { - for (var t = this.centerWorld, i = 0; i < 6; i++) - if (e[i].dotCoordinate(t) < 0) - return false; - return true - } - , - e.prototype.intersectsPoint = function(e) { - var t = r.x.DistanceSquared(this.centerWorld, e); - return !(this.radiusWorld * this.radiusWorld < t) - } - , - e.Intersects = function(e, t) { - var i = r.x.DistanceSquared(e.centerWorld, t.centerWorld) - , n = e.radiusWorld + t.radiusWorld; - return !(n * n < i) - } - , - e.TmpVector3 = n.a.BuildArray(3, r.x.Zero), - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return a - }); - var n = i(20) - , r = i(4) - , o = i(3) - , a = function() { - function e(e) { - this._vertexBuffers = {}, - this._scene = e - } - return e.prototype._prepareBuffers = function() { - if (!this._vertexBuffers[r.b.PositionKind]) { - var e = []; - e.push(1, 1), - e.push(-1, 1), - e.push(-1, -1), - e.push(1, -1), - this._vertexBuffers[r.b.PositionKind] = new r.b(this._scene.getEngine(),e,r.b.PositionKind,false,false,2), - this._buildIndexBuffer() - } - } - , - e.prototype._buildIndexBuffer = function() { + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return a; + }); + var n = i(20), + r = i(4), + o = i(3), + a = (function () { + function e(e) { + (this._vertexBuffers = {}), (this._scene = e); + } + return ( + (e.prototype._prepareBuffers = function () { + if (!this._vertexBuffers[r.b.PositionKind]) { var e = []; - e.push(0), + e.push(1, 1), + e.push(-1, 1), + e.push(-1, -1), + e.push(1, -1), + (this._vertexBuffers[r.b.PositionKind] = new r.b( + this._scene.getEngine(), + e, + r.b.PositionKind, + false, + false, + 2 + )), + this._buildIndexBuffer(); + } + }), + (e.prototype._buildIndexBuffer = function () { + var e = []; + e.push(0), e.push(1), e.push(2), e.push(0), e.push(2), e.push(3), - this._indexBuffer = this._scene.getEngine().createIndexBuffer(e) - } - , - e.prototype._rebuild = function() { - var e = this._vertexBuffers[r.b.PositionKind]; - e && (e._rebuild(), - this._buildIndexBuffer()) - } - , - e.prototype._prepareFrame = function(e, t) { - void 0 === e && (e = null), - void 0 === t && (t = null); - var i = this._scene.activeCamera; - return !!i && !(!(t = t || i._postProcesses.filter(function(e) { - return null != e - })) || 0 === t.length || !this._scene.postProcessesEnabled) && (t[0].activate(i, e, null != t), - true) - } - , - e.prototype.directRender = function(e, t, i, r, o) { - void 0 === t && (t = null), + (this._indexBuffer = this._scene + .getEngine() + .createIndexBuffer(e)); + }), + (e.prototype._rebuild = function () { + var e = this._vertexBuffers[r.b.PositionKind]; + e && (e._rebuild(), this._buildIndexBuffer()); + }), + (e.prototype._prepareFrame = function (e, t) { + void 0 === e && (e = null), void 0 === t && (t = null); + var i = this._scene.activeCamera; + return ( + !!i && + !( + !(t = + t || + i._postProcesses.filter(function (e) { + return null != e; + })) || + 0 === t.length || + !this._scene.postProcessesEnabled + ) && + (t[0].activate(i, e, null != t), true) + ); + }), + (e.prototype.directRender = function (e, t, i, r, o) { + void 0 === t && (t = null), void 0 === i && (i = false), void 0 === r && (r = 0), void 0 === o && (o = 0); - for (var a = this._scene.getEngine(), s = 0; s < e.length; s++) { - s < e.length - 1 ? e[s + 1].activate(this._scene.activeCamera, t) : t ? a.bindFramebuffer(t, r, void 0, void 0, i, void 0, o) : a.restoreDefaultFramebuffer(); - var c = e[s] - , u = c.apply(); - u && (c.onBeforeRenderObservable.notifyObservers(u), + for ( + var a = this._scene.getEngine(), s = 0; + s < e.length; + s++ + ) { + s < e.length - 1 + ? e[s + 1].activate(this._scene.activeCamera, t) + : t + ? a.bindFramebuffer( + t, + r, + void 0, + void 0, + i, + void 0, + o + ) + : a.restoreDefaultFramebuffer(); + var c = e[s], + u = c.apply(); + u && + (c.onBeforeRenderObservable.notifyObservers(u), + this._prepareBuffers(), + a.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + u + ), + a.drawElementsType(n.a.TriangleFillMode, 0, 6), + c.onAfterRenderObservable.notifyObservers(u)); + } + a.setDepthBuffer(true), a.setDepthWrite(true); + }), + (e.prototype._finalizeFrame = function (e, t, i, r, a) { + void 0 === a && (a = false); + var s = this._scene.activeCamera; + if ( + s && + 0 !== + (r = + r || + s._postProcesses.filter(function (e) { + return null != e; + })).length && + this._scene.postProcessesEnabled + ) { + for ( + var c = this._scene.getEngine(), u = 0, l = r.length; + u < l; + u++ + ) { + var h = r[u]; + if ( + (u < l - 1 + ? (h._outputTexture = r[u + 1].activate(s, t)) + : t + ? (c.bindFramebuffer(t, i, void 0, void 0, a), + (h._outputTexture = t)) + : (c.restoreDefaultFramebuffer(), + (h._outputTexture = null)), + e) + ) + break; + var f = h.apply(); + f && + (h.onBeforeRenderObservable.notifyObservers(f), this._prepareBuffers(), - a.bindBuffers(this._vertexBuffers, this._indexBuffer, u), - a.drawElementsType(n.a.TriangleFillMode, 0, 6), - c.onAfterRenderObservable.notifyObservers(u)) + c.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + f + ), + c.drawElementsType(n.a.TriangleFillMode, 0, 6), + h.onAfterRenderObservable.notifyObservers(f)); } - a.setDepthBuffer(true), - a.setDepthWrite(true) - } - , - e.prototype._finalizeFrame = function(e, t, i, r, a) { - void 0 === a && (a = false); - var s = this._scene.activeCamera; - if (s && 0 !== (r = r || s._postProcesses.filter(function(e) { - return null != e - })).length && this._scene.postProcessesEnabled) { - for (var c = this._scene.getEngine(), u = 0, l = r.length; u < l; u++) { - var h = r[u]; - if (u < l - 1 ? h._outputTexture = r[u + 1].activate(s, t) : t ? (c.bindFramebuffer(t, i, void 0, void 0, a), - h._outputTexture = t) : (c.restoreDefaultFramebuffer(), - h._outputTexture = null), - e) - break; - var f = h.apply(); - f && (h.onBeforeRenderObservable.notifyObservers(f), - this._prepareBuffers(), - c.bindBuffers(this._vertexBuffers, this._indexBuffer, f), - c.drawElementsType(n.a.TriangleFillMode, 0, 6), - h.onAfterRenderObservable.notifyObservers(f)) - } - c.setDepthBuffer(true), - c.setDepthWrite(true), - c.setAlphaMode(o.a.ALPHA_DISABLE) - } - } - , - e.prototype.dispose = function() { - var e = this._vertexBuffers[r.b.PositionKind]; - e && (e.dispose(), - this._vertexBuffers[r.b.PositionKind] = null), - this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), - this._indexBuffer = null) - } - , + c.setDepthBuffer(true), + c.setDepthWrite(true), + c.setAlphaMode(o.a.ALPHA_DISABLE); + } + }), + (e.prototype.dispose = function () { + var e = this._vertexBuffers[r.b.PositionKind]; + e && + (e.dispose(), + (this._vertexBuffers[r.b.PositionKind] = null)), + this._indexBuffer && + (this._scene + .getEngine() + ._releaseBuffer(this._indexBuffer), + (this._indexBuffer = null)); + }), e - }() - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.lightFragmentDeclaration = "#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec3 vLightSpecular{X};\n#else\nvec3 vLightSpecular{X}=vec3(0.);\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.lightUboDeclaration = "#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec3 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.imageProcessingDeclaration = "#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#ifdef VIGNETTE\nuniform vec2 vInverseScreenSize;\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.imageProcessingFunctions = "#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x;\n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\n#ifdef TONEMAPPING_ACES\n\n\n\n\n\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);\n\nconst mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108,1.10813,-0.07276),\nvec3(-0.07367,-0.00605,1.07602)\n);\nvec3 RRTAndODTFit(vec3 v)\n{\nvec3 a=v*(v+0.0245786)-0.000090537;\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\nreturn a/b;\n}\nvec3 ACESFitted(vec3 color)\n{\ncolor=ACESInputMat*color;\n\ncolor=RRTAndODTFit(color);\ncolor=ACESOutputMat*color;\n\ncolor=saturate(color);\nreturn color;\n}\n#endif\nvec4 applyImageProcessing(vec4 result) {\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\n\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\n\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\n\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=saturate(result.rgb);\n#ifdef CONTRAST\n\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\nif (contrast<1.0) {\n\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\n\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}\n#endif\n\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\n\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\nreturn result;\n}" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.logDepthDeclaration = "#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.clipPlaneFragment = "#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nif (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nif (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nif (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.clipPlaneVertex = "#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif" - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }), - i.d(t, "b", function() { - return o + ); + })(); + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.lightFragmentDeclaration = + "#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec3 vLightSpecular{X};\n#else\nvec3 vLightSpecular{X}=vec3(0.);\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.lightUboDeclaration = + "#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec3 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.imageProcessingDeclaration = + "#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#ifdef VIGNETTE\nuniform vec2 vInverseScreenSize;\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.imageProcessingFunctions = + "#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x;\n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\n#ifdef TONEMAPPING_ACES\n\n\n\n\n\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);\n\nconst mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108,1.10813,-0.07276),\nvec3(-0.07367,-0.00605,1.07602)\n);\nvec3 RRTAndODTFit(vec3 v)\n{\nvec3 a=v*(v+0.0245786)-0.000090537;\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\nreturn a/b;\n}\nvec3 ACESFitted(vec3 color)\n{\ncolor=ACESInputMat*color;\n\ncolor=RRTAndODTFit(color);\ncolor=ACESOutputMat*color;\n\ncolor=saturate(color);\nreturn color;\n}\n#endif\nvec4 applyImageProcessing(vec4 result) {\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\n\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\n\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\n\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=saturate(result.rgb);\n#ifdef CONTRAST\n\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\nif (contrast<1.0) {\n\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\n\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}\n#endif\n\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\n\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\nreturn result;\n}"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.logDepthDeclaration = + "#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.clipPlaneFragment = + "#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nif (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nif (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nif (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.clipPlaneVertex = + "#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif"; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }), + i.d(t, "b", function () { + return o; }); - var n = i(109) - , r = function() {} - , o = function() { - function e(t) { - this._useSceneAutoClearSetup = false, - this._renderingGroups = new Array, - this._autoClearDepthStencil = {}, - this._customOpaqueSortCompareFn = {}, - this._customAlphaTestSortCompareFn = {}, - this._customTransparentSortCompareFn = {}, - this._renderingGroupInfo = new r, - this._scene = t; - for (var i = e.MIN_RENDERINGGROUPS; i < e.MAX_RENDERINGGROUPS; i++) - this._autoClearDepthStencil[i] = { - autoClear: true, - depth: true, - stencil: true - } - } - return e.prototype._clearDepthStencilBuffer = function(e, t) { - void 0 === e && (e = true), + var n = i(109), + r = function () {}, + o = (function () { + function e(t) { + (this._useSceneAutoClearSetup = false), + (this._renderingGroups = new Array()), + (this._autoClearDepthStencil = {}), + (this._customOpaqueSortCompareFn = {}), + (this._customAlphaTestSortCompareFn = {}), + (this._customTransparentSortCompareFn = {}), + (this._renderingGroupInfo = new r()), + (this._scene = t); + for ( + var i = e.MIN_RENDERINGGROUPS; + i < e.MAX_RENDERINGGROUPS; + i++ + ) + this._autoClearDepthStencil[i] = { + autoClear: true, + depth: true, + stencil: true, + }; + } + return ( + (e.prototype._clearDepthStencilBuffer = function (e, t) { + void 0 === e && (e = true), void 0 === t && (t = true), - this._depthStencilBufferAlreadyCleaned || (this._scene.getEngine().clear(null, false, e, t), - this._depthStencilBufferAlreadyCleaned = true) - } - , - e.prototype.render = function(t, i, n, r) { - var o = this._renderingGroupInfo; - if (o.scene = this._scene, - o.camera = this._scene.activeCamera, + this._depthStencilBufferAlreadyCleaned || + (this._scene.getEngine().clear(null, false, e, t), + (this._depthStencilBufferAlreadyCleaned = true)); + }), + (e.prototype.render = function (t, i, n, r) { + var o = this._renderingGroupInfo; + if ( + ((o.scene = this._scene), + (o.camera = this._scene.activeCamera), this._scene.spriteManagers && r) - for (var a = 0; a < this._scene.spriteManagers.length; a++) { - var s = this._scene.spriteManagers[a]; - this.dispatchSprites(s) - } - for (a = e.MIN_RENDERINGGROUPS; a < e.MAX_RENDERINGGROUPS; a++) { - this._depthStencilBufferAlreadyCleaned = a === e.MIN_RENDERINGGROUPS; - var c = this._renderingGroups[a]; - if (c) { - var u = Math.pow(2, a); - if (o.renderingGroupId = a, - this._scene.onBeforeRenderingGroupObservable.notifyObservers(o, u), - e.AUTOCLEAR) { - var l = this._useSceneAutoClearSetup ? this._scene.getAutoClearDepthStencilSetup(a) : this._autoClearDepthStencil[a]; - l && l.autoClear && this._clearDepthStencilBuffer(l.depth, l.stencil) - } - for (var h = 0, f = this._scene._beforeRenderingGroupDrawStage; h < f.length; h++) - f[h].action(a); - c.render(t, r, n, i); - for (var d = 0, p = this._scene._afterRenderingGroupDrawStage; d < p.length; d++) - p[d].action(a); - this._scene.onAfterRenderingGroupObservable.notifyObservers(o, u) - } + ) + for ( + var a = 0; + a < this._scene.spriteManagers.length; + a++ + ) { + var s = this._scene.spriteManagers[a]; + this.dispatchSprites(s); } - } - , - e.prototype.reset = function() { - for (var t = e.MIN_RENDERINGGROUPS; t < e.MAX_RENDERINGGROUPS; t++) { - var i = this._renderingGroups[t]; - i && i.prepare() + for ( + a = e.MIN_RENDERINGGROUPS; + a < e.MAX_RENDERINGGROUPS; + a++ + ) { + this._depthStencilBufferAlreadyCleaned = + a === e.MIN_RENDERINGGROUPS; + var c = this._renderingGroups[a]; + if (c) { + var u = Math.pow(2, a); + if ( + ((o.renderingGroupId = a), + this._scene.onBeforeRenderingGroupObservable.notifyObservers( + o, + u + ), + e.AUTOCLEAR) + ) { + var l = this._useSceneAutoClearSetup + ? this._scene.getAutoClearDepthStencilSetup(a) + : this._autoClearDepthStencil[a]; + l && + l.autoClear && + this._clearDepthStencilBuffer(l.depth, l.stencil); + } + for ( + var h = 0, + f = this._scene._beforeRenderingGroupDrawStage; + h < f.length; + h++ + ) + f[h].action(a); + c.render(t, r, n, i); + for ( + var d = 0, + p = this._scene._afterRenderingGroupDrawStage; + d < p.length; + d++ + ) + p[d].action(a); + this._scene.onAfterRenderingGroupObservable.notifyObservers( + o, + u + ); } - } - , - e.prototype.dispose = function() { - this.freeRenderingGroups(), - this._renderingGroups.length = 0, - this._renderingGroupInfo = null - } - , - e.prototype.freeRenderingGroups = function() { - for (var t = e.MIN_RENDERINGGROUPS; t < e.MAX_RENDERINGGROUPS; t++) { - var i = this._renderingGroups[t]; - i && i.dispose() - } - } - , - e.prototype._prepareRenderingGroup = function(e) { - void 0 === this._renderingGroups[e] && (this._renderingGroups[e] = new n.a(e,this._scene,this._customOpaqueSortCompareFn[e],this._customAlphaTestSortCompareFn[e],this._customTransparentSortCompareFn[e])) - } - , - e.prototype.dispatchSprites = function(e) { - var t = e.renderingGroupId || 0; - this._prepareRenderingGroup(t), - this._renderingGroups[t].dispatchSprites(e) - } - , - e.prototype.dispatchParticles = function(e) { - var t = e.renderingGroupId || 0; - this._prepareRenderingGroup(t), - this._renderingGroups[t].dispatchParticles(e) - } - , - e.prototype.dispatch = function(e, t, i) { - void 0 === t && (t = e.getMesh()); - var n = t.renderingGroupId || 0; - this._prepareRenderingGroup(n), - this._renderingGroups[n].dispatch(e, t, i) - } - , - e.prototype.setRenderingOrder = function(e, t, i, n) { - if (void 0 === t && (t = null), + } + }), + (e.prototype.reset = function () { + for ( + var t = e.MIN_RENDERINGGROUPS; + t < e.MAX_RENDERINGGROUPS; + t++ + ) { + var i = this._renderingGroups[t]; + i && i.prepare(); + } + }), + (e.prototype.dispose = function () { + this.freeRenderingGroups(), + (this._renderingGroups.length = 0), + (this._renderingGroupInfo = null); + }), + (e.prototype.freeRenderingGroups = function () { + for ( + var t = e.MIN_RENDERINGGROUPS; + t < e.MAX_RENDERINGGROUPS; + t++ + ) { + var i = this._renderingGroups[t]; + i && i.dispose(); + } + }), + (e.prototype._prepareRenderingGroup = function (e) { + void 0 === this._renderingGroups[e] && + (this._renderingGroups[e] = new n.a( + e, + this._scene, + this._customOpaqueSortCompareFn[e], + this._customAlphaTestSortCompareFn[e], + this._customTransparentSortCompareFn[e] + )); + }), + (e.prototype.dispatchSprites = function (e) { + var t = e.renderingGroupId || 0; + this._prepareRenderingGroup(t), + this._renderingGroups[t].dispatchSprites(e); + }), + (e.prototype.dispatchParticles = function (e) { + var t = e.renderingGroupId || 0; + this._prepareRenderingGroup(t), + this._renderingGroups[t].dispatchParticles(e); + }), + (e.prototype.dispatch = function (e, t, i) { + void 0 === t && (t = e.getMesh()); + var n = t.renderingGroupId || 0; + this._prepareRenderingGroup(n), + this._renderingGroups[n].dispatch(e, t, i); + }), + (e.prototype.setRenderingOrder = function (e, t, i, n) { + if ( + (void 0 === t && (t = null), void 0 === i && (i = null), void 0 === n && (n = null), - this._customOpaqueSortCompareFn[e] = t, - this._customAlphaTestSortCompareFn[e] = i, - this._customTransparentSortCompareFn[e] = n, - this._renderingGroups[e]) { - var r = this._renderingGroups[e]; - r.opaqueSortCompareFn = this._customOpaqueSortCompareFn[e], - r.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[e], - r.transparentSortCompareFn = this._customTransparentSortCompareFn[e] - } - } - , - e.prototype.setRenderingAutoClearDepthStencil = function(e, t, i, n) { - void 0 === i && (i = true), + (this._customOpaqueSortCompareFn[e] = t), + (this._customAlphaTestSortCompareFn[e] = i), + (this._customTransparentSortCompareFn[e] = n), + this._renderingGroups[e]) + ) { + var r = this._renderingGroups[e]; + (r.opaqueSortCompareFn = + this._customOpaqueSortCompareFn[e]), + (r.alphaTestSortCompareFn = + this._customAlphaTestSortCompareFn[e]), + (r.transparentSortCompareFn = + this._customTransparentSortCompareFn[e]); + } + }), + (e.prototype.setRenderingAutoClearDepthStencil = function ( + e, + t, + i, + n + ) { + void 0 === i && (i = true), void 0 === n && (n = true), - this._autoClearDepthStencil[e] = { - autoClear: t, - depth: i, - stencil: n - } - } - , - e.prototype.getAutoClearDepthStencilSetup = function(e) { - return this._autoClearDepthStencil[e] - } - , - e.MAX_RENDERINGGROUPS = 4, - e.MIN_RENDERINGGROUPS = 0, - e.AUTOCLEAR = true, + (this._autoClearDepthStencil[e] = { + autoClear: t, + depth: i, + stencil: n, + }); + }), + (e.prototype.getAutoClearDepthStencilSetup = function (e) { + return this._autoClearDepthStencil[e]; + }), + (e.MAX_RENDERINGGROUPS = 4), + (e.MIN_RENDERINGGROUPS = 0), + (e.AUTOCLEAR = true), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() {} - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return a - }); - var n = i(1) - , r = i(2) - , o = i(0) - , a = function() { - function e() { - this._dirty = true, - this._tempColor = new o.f(0,0,0,0), - this._globalCurve = new o.f(0,0,0,0), - this._highlightsCurve = new o.f(0,0,0,0), - this._midtonesCurve = new o.f(0,0,0,0), - this._shadowsCurve = new o.f(0,0,0,0), - this._positiveCurve = new o.f(0,0,0,0), - this._negativeCurve = new o.f(0,0,0,0), - this._globalHue = 30, - this._globalDensity = 0, - this._globalSaturation = 0, - this._globalExposure = 0, - this._highlightsHue = 30, - this._highlightsDensity = 0, - this._highlightsSaturation = 0, - this._highlightsExposure = 0, - this._midtonesHue = 30, - this._midtonesDensity = 0, - this._midtonesSaturation = 0, - this._midtonesExposure = 0, - this._shadowsHue = 30, - this._shadowsDensity = 0, - this._shadowsSaturation = 0, - this._shadowsExposure = 0 - } - return Object.defineProperty(e.prototype, "globalHue", { - get: function() { - return this._globalHue - }, - set: function(e) { - this._globalHue = e, - this._dirty = true - }, - enumerable: true, - configurable: true + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = function () {}; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return a; + }); + var n = i(1), + r = i(2), + o = i(0), + a = (function () { + function e() { + (this._dirty = true), + (this._tempColor = new o.f(0, 0, 0, 0)), + (this._globalCurve = new o.f(0, 0, 0, 0)), + (this._highlightsCurve = new o.f(0, 0, 0, 0)), + (this._midtonesCurve = new o.f(0, 0, 0, 0)), + (this._shadowsCurve = new o.f(0, 0, 0, 0)), + (this._positiveCurve = new o.f(0, 0, 0, 0)), + (this._negativeCurve = new o.f(0, 0, 0, 0)), + (this._globalHue = 30), + (this._globalDensity = 0), + (this._globalSaturation = 0), + (this._globalExposure = 0), + (this._highlightsHue = 30), + (this._highlightsDensity = 0), + (this._highlightsSaturation = 0), + (this._highlightsExposure = 0), + (this._midtonesHue = 30), + (this._midtonesDensity = 0), + (this._midtonesSaturation = 0), + (this._midtonesExposure = 0), + (this._shadowsHue = 30), + (this._shadowsDensity = 0), + (this._shadowsSaturation = 0), + (this._shadowsExposure = 0); + } + return ( + Object.defineProperty(e.prototype, "globalHue", { + get: function () { + return this._globalHue; + }, + set: function (e) { + (this._globalHue = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "globalDensity", { - get: function() { - return this._globalDensity - }, - set: function(e) { - this._globalDensity = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._globalDensity; + }, + set: function (e) { + (this._globalDensity = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "globalSaturation", { - get: function() { - return this._globalSaturation - }, - set: function(e) { - this._globalSaturation = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._globalSaturation; + }, + set: function (e) { + (this._globalSaturation = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "globalExposure", { - get: function() { - return this._globalExposure - }, - set: function(e) { - this._globalExposure = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._globalExposure; + }, + set: function (e) { + (this._globalExposure = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "highlightsHue", { - get: function() { - return this._highlightsHue - }, - set: function(e) { - this._highlightsHue = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._highlightsHue; + }, + set: function (e) { + (this._highlightsHue = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "highlightsDensity", { - get: function() { - return this._highlightsDensity - }, - set: function(e) { - this._highlightsDensity = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._highlightsDensity; + }, + set: function (e) { + (this._highlightsDensity = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "highlightsSaturation", { - get: function() { - return this._highlightsSaturation - }, - set: function(e) { - this._highlightsSaturation = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._highlightsSaturation; + }, + set: function (e) { + (this._highlightsSaturation = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "highlightsExposure", { - get: function() { - return this._highlightsExposure - }, - set: function(e) { - this._highlightsExposure = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._highlightsExposure; + }, + set: function (e) { + (this._highlightsExposure = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "midtonesHue", { - get: function() { - return this._midtonesHue - }, - set: function(e) { - this._midtonesHue = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._midtonesHue; + }, + set: function (e) { + (this._midtonesHue = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "midtonesDensity", { - get: function() { - return this._midtonesDensity - }, - set: function(e) { - this._midtonesDensity = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._midtonesDensity; + }, + set: function (e) { + (this._midtonesDensity = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "midtonesSaturation", { - get: function() { - return this._midtonesSaturation - }, - set: function(e) { - this._midtonesSaturation = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._midtonesSaturation; + }, + set: function (e) { + (this._midtonesSaturation = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "midtonesExposure", { - get: function() { - return this._midtonesExposure - }, - set: function(e) { - this._midtonesExposure = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._midtonesExposure; + }, + set: function (e) { + (this._midtonesExposure = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "shadowsHue", { - get: function() { - return this._shadowsHue - }, - set: function(e) { - this._shadowsHue = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._shadowsHue; + }, + set: function (e) { + (this._shadowsHue = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "shadowsDensity", { - get: function() { - return this._shadowsDensity - }, - set: function(e) { - this._shadowsDensity = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._shadowsDensity; + }, + set: function (e) { + (this._shadowsDensity = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "shadowsSaturation", { - get: function() { - return this._shadowsSaturation - }, - set: function(e) { - this._shadowsSaturation = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._shadowsSaturation; + }, + set: function (e) { + (this._shadowsSaturation = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "shadowsExposure", { - get: function() { - return this._shadowsExposure - }, - set: function(e) { - this._shadowsExposure = e, - this._dirty = true - }, - enumerable: true, - configurable: true + get: function () { + return this._shadowsExposure; + }, + set: function (e) { + (this._shadowsExposure = e), (this._dirty = true); + }, + enumerable: true, + configurable: true, }), - e.prototype.getClassName = function() { - return "ColorCurves" - } - , - e.Bind = function(e, t, i, n, r) { - void 0 === i && (i = "vCameraColorCurvePositive"), + (e.prototype.getClassName = function () { + return "ColorCurves"; + }), + (e.Bind = function (e, t, i, n, r) { + void 0 === i && (i = "vCameraColorCurvePositive"), void 0 === n && (n = "vCameraColorCurveNeutral"), void 0 === r && (r = "vCameraColorCurveNegative"), - e._dirty && (e._dirty = false, - e.getColorGradingDataToRef(e._globalHue, e._globalDensity, e._globalSaturation, e._globalExposure, e._globalCurve), - e.getColorGradingDataToRef(e._highlightsHue, e._highlightsDensity, e._highlightsSaturation, e._highlightsExposure, e._tempColor), - e._tempColor.multiplyToRef(e._globalCurve, e._highlightsCurve), - e.getColorGradingDataToRef(e._midtonesHue, e._midtonesDensity, e._midtonesSaturation, e._midtonesExposure, e._tempColor), - e._tempColor.multiplyToRef(e._globalCurve, e._midtonesCurve), - e.getColorGradingDataToRef(e._shadowsHue, e._shadowsDensity, e._shadowsSaturation, e._shadowsExposure, e._tempColor), - e._tempColor.multiplyToRef(e._globalCurve, e._shadowsCurve), - e._highlightsCurve.subtractToRef(e._midtonesCurve, e._positiveCurve), - e._midtonesCurve.subtractToRef(e._shadowsCurve, e._negativeCurve)), - t && (t.setFloat4(i, e._positiveCurve.r, e._positiveCurve.g, e._positiveCurve.b, e._positiveCurve.a), - t.setFloat4(n, e._midtonesCurve.r, e._midtonesCurve.g, e._midtonesCurve.b, e._midtonesCurve.a), - t.setFloat4(r, e._negativeCurve.r, e._negativeCurve.g, e._negativeCurve.b, e._negativeCurve.a)) - } - , - e.PrepareUniforms = function(e) { - e.push("vCameraColorCurveNeutral", "vCameraColorCurvePositive", "vCameraColorCurveNegative") - } - , - e.prototype.getColorGradingDataToRef = function(t, i, n, r, o) { - null != t && (t = e.clamp(t, 0, 360), - i = e.clamp(i, -100, 100), - n = e.clamp(n, -100, 100), - r = e.clamp(r, -100, 100), - i = e.applyColorGradingSliderNonlinear(i), - i *= .5, - r = e.applyColorGradingSliderNonlinear(r), - i < 0 && (i *= -1, - t = (t + 180) % 360), - e.fromHSBToRef(t, i, 50 + .25 * r, o), + e._dirty && + ((e._dirty = false), + e.getColorGradingDataToRef( + e._globalHue, + e._globalDensity, + e._globalSaturation, + e._globalExposure, + e._globalCurve + ), + e.getColorGradingDataToRef( + e._highlightsHue, + e._highlightsDensity, + e._highlightsSaturation, + e._highlightsExposure, + e._tempColor + ), + e._tempColor.multiplyToRef( + e._globalCurve, + e._highlightsCurve + ), + e.getColorGradingDataToRef( + e._midtonesHue, + e._midtonesDensity, + e._midtonesSaturation, + e._midtonesExposure, + e._tempColor + ), + e._tempColor.multiplyToRef( + e._globalCurve, + e._midtonesCurve + ), + e.getColorGradingDataToRef( + e._shadowsHue, + e._shadowsDensity, + e._shadowsSaturation, + e._shadowsExposure, + e._tempColor + ), + e._tempColor.multiplyToRef( + e._globalCurve, + e._shadowsCurve + ), + e._highlightsCurve.subtractToRef( + e._midtonesCurve, + e._positiveCurve + ), + e._midtonesCurve.subtractToRef( + e._shadowsCurve, + e._negativeCurve + )), + t && + (t.setFloat4( + i, + e._positiveCurve.r, + e._positiveCurve.g, + e._positiveCurve.b, + e._positiveCurve.a + ), + t.setFloat4( + n, + e._midtonesCurve.r, + e._midtonesCurve.g, + e._midtonesCurve.b, + e._midtonesCurve.a + ), + t.setFloat4( + r, + e._negativeCurve.r, + e._negativeCurve.g, + e._negativeCurve.b, + e._negativeCurve.a + )); + }), + (e.PrepareUniforms = function (e) { + e.push( + "vCameraColorCurveNeutral", + "vCameraColorCurvePositive", + "vCameraColorCurveNegative" + ); + }), + (e.prototype.getColorGradingDataToRef = function ( + t, + i, + n, + r, + o + ) { + null != t && + ((t = e.clamp(t, 0, 360)), + (i = e.clamp(i, -100, 100)), + (n = e.clamp(n, -100, 100)), + (r = e.clamp(r, -100, 100)), + (i = e.applyColorGradingSliderNonlinear(i)), + (i *= 0.5), + (r = e.applyColorGradingSliderNonlinear(r)), + i < 0 && ((i *= -1), (t = (t + 180) % 360)), + e.fromHSBToRef(t, i, 50 + 0.25 * r, o), o.scaleToRef(2, o), - o.a = 1 + .01 * n) - } - , - e.applyColorGradingSliderNonlinear = function(e) { - e /= 100; - var t = Math.abs(e); - return t = Math.pow(t, 2), - e < 0 && (t *= -1), - 100 * t - } - , - e.fromHSBToRef = function(t, i, n, r) { - var o = e.clamp(t, 0, 360) - , a = e.clamp(i / 100, 0, 1) - , s = e.clamp(n / 100, 0, 1); - if (0 === a) - r.r = s, - r.g = s, - r.b = s; - else { - o /= 60; - var c = Math.floor(o) - , u = o - c - , l = s * (1 - a) - , h = s * (1 - a * u) - , f = s * (1 - a * (1 - u)); - switch (c) { - case 0: - r.r = s, - r.g = f, - r.b = l; - break; - case 1: - r.r = h, - r.g = s, - r.b = l; - break; - case 2: - r.r = l, - r.g = s, - r.b = f; - break; - case 3: - r.r = l, - r.g = h, - r.b = s; - break; - case 4: - r.r = f, - r.g = l, - r.b = s; - break; - default: - r.r = s, - r.g = l, - r.b = h - } + (o.a = 1 + 0.01 * n)); + }), + (e.applyColorGradingSliderNonlinear = function (e) { + e /= 100; + var t = Math.abs(e); + return (t = Math.pow(t, 2)), e < 0 && (t *= -1), 100 * t; + }), + (e.fromHSBToRef = function (t, i, n, r) { + var o = e.clamp(t, 0, 360), + a = e.clamp(i / 100, 0, 1), + s = e.clamp(n / 100, 0, 1); + if (0 === a) (r.r = s), (r.g = s), (r.b = s); + else { + o /= 60; + var c = Math.floor(o), + u = o - c, + l = s * (1 - a), + h = s * (1 - a * u), + f = s * (1 - a * (1 - u)); + switch (c) { + case 0: + (r.r = s), (r.g = f), (r.b = l); + break; + case 1: + (r.r = h), (r.g = s), (r.b = l); + break; + case 2: + (r.r = l), (r.g = s), (r.b = f); + break; + case 3: + (r.r = l), (r.g = h), (r.b = s); + break; + case 4: + (r.r = f), (r.g = l), (r.b = s); + break; + default: + (r.r = s), (r.g = l), (r.b = h); } - r.a = 1 - } - , - e.clamp = function(e, t, i) { - return Math.min(Math.max(e, t), i) - } - , - e.prototype.clone = function() { - return r.a.Clone(function() { - return new e - }, this) - } - , - e.prototype.serialize = function() { - return r.a.Serialize(this) - } - , - e.Parse = function(t) { - return r.a.Parse(function() { - return new e - }, t, null, null) - } - , + } + r.a = 1; + }), + (e.clamp = function (e, t, i) { + return Math.min(Math.max(e, t), i); + }), + (e.prototype.clone = function () { + return r.a.Clone(function () { + return new e(); + }, this); + }), + (e.prototype.serialize = function () { + return r.a.Serialize(this); + }), + (e.Parse = function (t) { + return r.a.Parse( + function () { + return new e(); + }, + t, + null, + null + ); + }), n.c([Object(r.c)()], e.prototype, "_globalHue", void 0), n.c([Object(r.c)()], e.prototype, "_globalDensity", void 0), - n.c([Object(r.c)()], e.prototype, "_globalSaturation", void 0), - n.c([Object(r.c)()], e.prototype, "_globalExposure", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "_globalSaturation", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_globalExposure", + void 0 + ), n.c([Object(r.c)()], e.prototype, "_highlightsHue", void 0), - n.c([Object(r.c)()], e.prototype, "_highlightsDensity", void 0), - n.c([Object(r.c)()], e.prototype, "_highlightsSaturation", void 0), - n.c([Object(r.c)()], e.prototype, "_highlightsExposure", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "_highlightsDensity", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_highlightsSaturation", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_highlightsExposure", + void 0 + ), n.c([Object(r.c)()], e.prototype, "_midtonesHue", void 0), - n.c([Object(r.c)()], e.prototype, "_midtonesDensity", void 0), - n.c([Object(r.c)()], e.prototype, "_midtonesSaturation", void 0), - n.c([Object(r.c)()], e.prototype, "_midtonesExposure", void 0), + n.c( + [Object(r.c)()], + e.prototype, + "_midtonesDensity", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_midtonesSaturation", + void 0 + ), + n.c( + [Object(r.c)()], + e.prototype, + "_midtonesExposure", + void 0 + ), e - }(); - r.a._ColorCurvesParser = a.Parse - } - , function(e, t, i) { - "use strict"; - var n = function() { - function e() { - this._isAlphaBlendDirty = false, - this._isBlendFunctionParametersDirty = false, - this._isBlendEquationParametersDirty = false, - this._isBlendConstantsDirty = false, - this._alphaBlend = false, - this._blendFunctionParameters = new Array(4), - this._blendEquationParameters = new Array(2), - this._blendConstants = new Array(4), - this.reset() - } - return Object.defineProperty(e.prototype, "isDirty", { - get: function() { - return this._isAlphaBlendDirty || this._isBlendFunctionParametersDirty - }, - enumerable: true, - configurable: true + ); + })(); + r.a._ColorCurvesParser = a.Parse; + }, + function (e, t, i) { + "use strict"; + var n = (function () { + function e() { + (this._isAlphaBlendDirty = false), + (this._isBlendFunctionParametersDirty = false), + (this._isBlendEquationParametersDirty = false), + (this._isBlendConstantsDirty = false), + (this._alphaBlend = false), + (this._blendFunctionParameters = new Array(4)), + (this._blendEquationParameters = new Array(2)), + (this._blendConstants = new Array(4)), + this.reset(); + } + return ( + Object.defineProperty(e.prototype, "isDirty", { + get: function () { + return ( + this._isAlphaBlendDirty || + this._isBlendFunctionParametersDirty + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "alphaBlend", { - get: function() { - return this._alphaBlend - }, - set: function(e) { - this._alphaBlend !== e && (this._alphaBlend = e, - this._isAlphaBlendDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._alphaBlend; + }, + set: function (e) { + this._alphaBlend !== e && + ((this._alphaBlend = e), + (this._isAlphaBlendDirty = true)); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.setAlphaBlendConstants = function ( + e, + t, + i, + n + ) { + (this._blendConstants[0] === e && + this._blendConstants[1] === t && + this._blendConstants[2] === i && + this._blendConstants[3] === n) || + ((this._blendConstants[0] = e), + (this._blendConstants[1] = t), + (this._blendConstants[2] = i), + (this._blendConstants[3] = n), + (this._isBlendConstantsDirty = true)); + }), + (e.prototype.setAlphaBlendFunctionParameters = function ( + e, + t, + i, + n + ) { + (this._blendFunctionParameters[0] === e && + this._blendFunctionParameters[1] === t && + this._blendFunctionParameters[2] === i && + this._blendFunctionParameters[3] === n) || + ((this._blendFunctionParameters[0] = e), + (this._blendFunctionParameters[1] = t), + (this._blendFunctionParameters[2] = i), + (this._blendFunctionParameters[3] = n), + (this._isBlendFunctionParametersDirty = true)); + }), + (e.prototype.setAlphaEquationParameters = function (e, t) { + (this._blendEquationParameters[0] === e && + this._blendEquationParameters[1] === t) || + ((this._blendEquationParameters[0] = e), + (this._blendEquationParameters[1] = t), + (this._isBlendEquationParametersDirty = true)); + }), + (e.prototype.reset = function () { + (this._alphaBlend = false), + (this._blendFunctionParameters[0] = null), + (this._blendFunctionParameters[1] = null), + (this._blendFunctionParameters[2] = null), + (this._blendFunctionParameters[3] = null), + (this._blendEquationParameters[0] = null), + (this._blendEquationParameters[1] = null), + (this._blendConstants[0] = null), + (this._blendConstants[1] = null), + (this._blendConstants[2] = null), + (this._blendConstants[3] = null), + (this._isAlphaBlendDirty = true), + (this._isBlendFunctionParametersDirty = false), + (this._isBlendEquationParametersDirty = false), + (this._isBlendConstantsDirty = false); + }), + (e.prototype.apply = function (e) { + this.isDirty && + (this._isAlphaBlendDirty && + (this._alphaBlend + ? e.enable(e.BLEND) + : e.disable(e.BLEND), + (this._isAlphaBlendDirty = false)), + this._isBlendFunctionParametersDirty && + (e.blendFuncSeparate( + this._blendFunctionParameters[0], + this._blendFunctionParameters[1], + this._blendFunctionParameters[2], + this._blendFunctionParameters[3] + ), + (this._isBlendFunctionParametersDirty = false)), + this._isBlendEquationParametersDirty && + (e.blendEquationSeparate( + this._blendEquationParameters[0], + this._blendEquationParameters[1] + ), + (this._isBlendEquationParametersDirty = false)), + this._isBlendConstantsDirty && + (e.blendColor( + this._blendConstants[0], + this._blendConstants[1], + this._blendConstants[2], + this._blendConstants[3] + ), + (this._isBlendConstantsDirty = false))); }), - e.prototype.setAlphaBlendConstants = function(e, t, i, n) { - this._blendConstants[0] === e && this._blendConstants[1] === t && this._blendConstants[2] === i && this._blendConstants[3] === n || (this._blendConstants[0] = e, - this._blendConstants[1] = t, - this._blendConstants[2] = i, - this._blendConstants[3] = n, - this._isBlendConstantsDirty = true) - } - , - e.prototype.setAlphaBlendFunctionParameters = function(e, t, i, n) { - this._blendFunctionParameters[0] === e && this._blendFunctionParameters[1] === t && this._blendFunctionParameters[2] === i && this._blendFunctionParameters[3] === n || (this._blendFunctionParameters[0] = e, - this._blendFunctionParameters[1] = t, - this._blendFunctionParameters[2] = i, - this._blendFunctionParameters[3] = n, - this._isBlendFunctionParametersDirty = true) - } - , - e.prototype.setAlphaEquationParameters = function(e, t) { - this._blendEquationParameters[0] === e && this._blendEquationParameters[1] === t || (this._blendEquationParameters[0] = e, - this._blendEquationParameters[1] = t, - this._isBlendEquationParametersDirty = true) - } - , - e.prototype.reset = function() { - this._alphaBlend = false, - this._blendFunctionParameters[0] = null, - this._blendFunctionParameters[1] = null, - this._blendFunctionParameters[2] = null, - this._blendFunctionParameters[3] = null, - this._blendEquationParameters[0] = null, - this._blendEquationParameters[1] = null, - this._blendConstants[0] = null, - this._blendConstants[1] = null, - this._blendConstants[2] = null, - this._blendConstants[3] = null, - this._isAlphaBlendDirty = true, - this._isBlendFunctionParametersDirty = false, - this._isBlendEquationParametersDirty = false, - this._isBlendConstantsDirty = false - } - , - e.prototype.apply = function(e) { - this.isDirty && (this._isAlphaBlendDirty && (this._alphaBlend ? e.enable(e.BLEND) : e.disable(e.BLEND), - this._isAlphaBlendDirty = false), - this._isBlendFunctionParametersDirty && (e.blendFuncSeparate(this._blendFunctionParameters[0], this._blendFunctionParameters[1], this._blendFunctionParameters[2], this._blendFunctionParameters[3]), - this._isBlendFunctionParametersDirty = false), - this._isBlendEquationParametersDirty && (e.blendEquationSeparate(this._blendEquationParameters[0], this._blendEquationParameters[1]), - this._isBlendEquationParametersDirty = false), - this._isBlendConstantsDirty && (e.blendColor(this._blendConstants[0], this._blendConstants[1], this._blendConstants[2], this._blendConstants[3]), - this._isBlendConstantsDirty = false)) - } - , e - }() - , r = function() { - function e() { - this._isDepthTestDirty = false, - this._isDepthMaskDirty = false, - this._isDepthFuncDirty = false, - this._isCullFaceDirty = false, - this._isCullDirty = false, - this._isZOffsetDirty = false, - this._isFrontFaceDirty = false, - this.reset() - } - return Object.defineProperty(e.prototype, "isDirty", { - get: function() { - return this._isDepthFuncDirty || this._isDepthTestDirty || this._isDepthMaskDirty || this._isCullFaceDirty || this._isCullDirty || this._isZOffsetDirty || this._isFrontFaceDirty - }, - enumerable: true, - configurable: true + ); + })(), + r = (function () { + function e() { + (this._isDepthTestDirty = false), + (this._isDepthMaskDirty = false), + (this._isDepthFuncDirty = false), + (this._isCullFaceDirty = false), + (this._isCullDirty = false), + (this._isZOffsetDirty = false), + (this._isFrontFaceDirty = false), + this.reset(); + } + return ( + Object.defineProperty(e.prototype, "isDirty", { + get: function () { + return ( + this._isDepthFuncDirty || + this._isDepthTestDirty || + this._isDepthMaskDirty || + this._isCullFaceDirty || + this._isCullDirty || + this._isZOffsetDirty || + this._isFrontFaceDirty + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "zOffset", { - get: function() { - return this._zOffset - }, - set: function(e) { - this._zOffset !== e && (this._zOffset = e, - this._isZOffsetDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._zOffset; + }, + set: function (e) { + this._zOffset !== e && + ((this._zOffset = e), (this._isZOffsetDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "cullFace", { - get: function() { - return this._cullFace - }, - set: function(e) { - this._cullFace !== e && (this._cullFace = e, - this._isCullFaceDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._cullFace; + }, + set: function (e) { + this._cullFace !== e && + ((this._cullFace = e), + (this._isCullFaceDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "cull", { - get: function() { - return this._cull - }, - set: function(e) { - this._cull !== e && (this._cull = e, - this._isCullDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._cull; + }, + set: function (e) { + this._cull !== e && + ((this._cull = e), (this._isCullDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "depthFunc", { - get: function() { - return this._depthFunc - }, - set: function(e) { - this._depthFunc !== e && (this._depthFunc = e, - this._isDepthFuncDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._depthFunc; + }, + set: function (e) { + this._depthFunc !== e && + ((this._depthFunc = e), + (this._isDepthFuncDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "depthMask", { - get: function() { - return this._depthMask - }, - set: function(e) { - this._depthMask !== e && (this._depthMask = e, - this._isDepthMaskDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._depthMask; + }, + set: function (e) { + this._depthMask !== e && + ((this._depthMask = e), + (this._isDepthMaskDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "depthTest", { - get: function() { - return this._depthTest - }, - set: function(e) { - this._depthTest !== e && (this._depthTest = e, - this._isDepthTestDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._depthTest; + }, + set: function (e) { + this._depthTest !== e && + ((this._depthTest = e), + (this._isDepthTestDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "frontFace", { - get: function() { - return this._frontFace - }, - set: function(e) { - this._frontFace !== e && (this._frontFace = e, - this._isFrontFaceDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._frontFace; + }, + set: function (e) { + this._frontFace !== e && + ((this._frontFace = e), + (this._isFrontFaceDirty = true)); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.reset = function () { + (this._depthMask = true), + (this._depthTest = true), + (this._depthFunc = null), + (this._cullFace = null), + (this._cull = null), + (this._zOffset = 0), + (this._frontFace = null), + (this._isDepthTestDirty = true), + (this._isDepthMaskDirty = true), + (this._isDepthFuncDirty = false), + (this._isCullFaceDirty = false), + (this._isCullDirty = false), + (this._isZOffsetDirty = false), + (this._isFrontFaceDirty = false); + }), + (e.prototype.apply = function (e) { + this.isDirty && + (this._isCullDirty && + (this.cull + ? e.enable(e.CULL_FACE) + : e.disable(e.CULL_FACE), + (this._isCullDirty = false)), + this._isCullFaceDirty && + (e.cullFace(this.cullFace), + (this._isCullFaceDirty = false)), + this._isDepthMaskDirty && + (e.depthMask(this.depthMask), + (this._isDepthMaskDirty = false)), + this._isDepthTestDirty && + (this.depthTest + ? e.enable(e.DEPTH_TEST) + : e.disable(e.DEPTH_TEST), + (this._isDepthTestDirty = false)), + this._isDepthFuncDirty && + (e.depthFunc(this.depthFunc), + (this._isDepthFuncDirty = false)), + this._isZOffsetDirty && + (this.zOffset + ? (e.enable(e.POLYGON_OFFSET_FILL), + e.polygonOffset(this.zOffset, 0)) + : e.disable(e.POLYGON_OFFSET_FILL), + (this._isZOffsetDirty = false)), + this._isFrontFaceDirty && + (e.frontFace(this.frontFace), + (this._isFrontFaceDirty = false))); }), - e.prototype.reset = function() { - this._depthMask = true, - this._depthTest = true, - this._depthFunc = null, - this._cullFace = null, - this._cull = null, - this._zOffset = 0, - this._frontFace = null, - this._isDepthTestDirty = true, - this._isDepthMaskDirty = true, - this._isDepthFuncDirty = false, - this._isCullFaceDirty = false, - this._isCullDirty = false, - this._isZOffsetDirty = false, - this._isFrontFaceDirty = false - } - , - e.prototype.apply = function(e) { - this.isDirty && (this._isCullDirty && (this.cull ? e.enable(e.CULL_FACE) : e.disable(e.CULL_FACE), - this._isCullDirty = false), - this._isCullFaceDirty && (e.cullFace(this.cullFace), - this._isCullFaceDirty = false), - this._isDepthMaskDirty && (e.depthMask(this.depthMask), - this._isDepthMaskDirty = false), - this._isDepthTestDirty && (this.depthTest ? e.enable(e.DEPTH_TEST) : e.disable(e.DEPTH_TEST), - this._isDepthTestDirty = false), - this._isDepthFuncDirty && (e.depthFunc(this.depthFunc), - this._isDepthFuncDirty = false), - this._isZOffsetDirty && (this.zOffset ? (e.enable(e.POLYGON_OFFSET_FILL), - e.polygonOffset(this.zOffset, 0)) : e.disable(e.POLYGON_OFFSET_FILL), - this._isZOffsetDirty = false), - this._isFrontFaceDirty && (e.frontFace(this.frontFace), - this._isFrontFaceDirty = false)) - } - , e - }() - , o = i(3) - , a = function() { - function e() { - this._isStencilTestDirty = false, - this._isStencilMaskDirty = false, - this._isStencilFuncDirty = false, - this._isStencilOpDirty = false, - this.reset() - } - return Object.defineProperty(e.prototype, "isDirty", { - get: function() { - return this._isStencilTestDirty || this._isStencilMaskDirty || this._isStencilFuncDirty || this._isStencilOpDirty - }, - enumerable: true, - configurable: true + ); + })(), + o = i(3), + a = (function () { + function e() { + (this._isStencilTestDirty = false), + (this._isStencilMaskDirty = false), + (this._isStencilFuncDirty = false), + (this._isStencilOpDirty = false), + this.reset(); + } + return ( + Object.defineProperty(e.prototype, "isDirty", { + get: function () { + return ( + this._isStencilTestDirty || + this._isStencilMaskDirty || + this._isStencilFuncDirty || + this._isStencilOpDirty + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "stencilFunc", { - get: function() { - return this._stencilFunc - }, - set: function(e) { - this._stencilFunc !== e && (this._stencilFunc = e, - this._isStencilFuncDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._stencilFunc; + }, + set: function (e) { + this._stencilFunc !== e && + ((this._stencilFunc = e), + (this._isStencilFuncDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "stencilFuncRef", { - get: function() { - return this._stencilFuncRef - }, - set: function(e) { - this._stencilFuncRef !== e && (this._stencilFuncRef = e, - this._isStencilFuncDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._stencilFuncRef; + }, + set: function (e) { + this._stencilFuncRef !== e && + ((this._stencilFuncRef = e), + (this._isStencilFuncDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "stencilFuncMask", { - get: function() { - return this._stencilFuncMask - }, - set: function(e) { - this._stencilFuncMask !== e && (this._stencilFuncMask = e, - this._isStencilFuncDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._stencilFuncMask; + }, + set: function (e) { + this._stencilFuncMask !== e && + ((this._stencilFuncMask = e), + (this._isStencilFuncDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "stencilOpStencilFail", { - get: function() { - return this._stencilOpStencilFail - }, - set: function(e) { - this._stencilOpStencilFail !== e && (this._stencilOpStencilFail = e, - this._isStencilOpDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._stencilOpStencilFail; + }, + set: function (e) { + this._stencilOpStencilFail !== e && + ((this._stencilOpStencilFail = e), + (this._isStencilOpDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "stencilOpDepthFail", { - get: function() { - return this._stencilOpDepthFail + get: function () { + return this._stencilOpDepthFail; + }, + set: function (e) { + this._stencilOpDepthFail !== e && + ((this._stencilOpDepthFail = e), + (this._isStencilOpDirty = true)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "stencilOpStencilDepthPass", + { + get: function () { + return this._stencilOpStencilDepthPass; }, - set: function(e) { - this._stencilOpDepthFail !== e && (this._stencilOpDepthFail = e, - this._isStencilOpDirty = true) + set: function (e) { + this._stencilOpStencilDepthPass !== e && + ((this._stencilOpStencilDepthPass = e), + (this._isStencilOpDirty = true)); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "stencilOpStencilDepthPass", { - get: function() { - return this._stencilOpStencilDepthPass - }, - set: function(e) { - this._stencilOpStencilDepthPass !== e && (this._stencilOpStencilDepthPass = e, - this._isStencilOpDirty = true) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "stencilMask", { - get: function() { - return this._stencilMask - }, - set: function(e) { - this._stencilMask !== e && (this._stencilMask = e, - this._isStencilMaskDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._stencilMask; + }, + set: function (e) { + this._stencilMask !== e && + ((this._stencilMask = e), + (this._isStencilMaskDirty = true)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "stencilTest", { - get: function() { - return this._stencilTest - }, - set: function(e) { - this._stencilTest !== e && (this._stencilTest = e, - this._isStencilTestDirty = true) - }, - enumerable: true, - configurable: true + get: function () { + return this._stencilTest; + }, + set: function (e) { + this._stencilTest !== e && + ((this._stencilTest = e), + (this._isStencilTestDirty = true)); + }, + enumerable: true, + configurable: true, }), - e.prototype.reset = function() { - this._stencilTest = false, - this._stencilMask = 255, - this._stencilFunc = e.ALWAYS, - this._stencilFuncRef = 1, - this._stencilFuncMask = 255, - this._stencilOpStencilFail = e.KEEP, - this._stencilOpDepthFail = e.KEEP, - this._stencilOpStencilDepthPass = e.REPLACE, - this._isStencilTestDirty = true, - this._isStencilMaskDirty = true, - this._isStencilFuncDirty = true, - this._isStencilOpDirty = true - } - , - e.prototype.apply = function(e) { - this.isDirty && (this._isStencilTestDirty && (this.stencilTest ? e.enable(e.STENCIL_TEST) : e.disable(e.STENCIL_TEST), - this._isStencilTestDirty = false), - this._isStencilMaskDirty && (e.stencilMask(this.stencilMask), - this._isStencilMaskDirty = false), - this._isStencilFuncDirty && (e.stencilFunc(this.stencilFunc, this.stencilFuncRef, this.stencilFuncMask), - this._isStencilFuncDirty = false), - this._isStencilOpDirty && (e.stencilOp(this.stencilOpStencilFail, this.stencilOpDepthFail, this.stencilOpStencilDepthPass), - this._isStencilOpDirty = false)) - } - , - e.ALWAYS = o.a.ALWAYS, - e.KEEP = o.a.KEEP, - e.REPLACE = o.a.REPLACE, + (e.prototype.reset = function () { + (this._stencilTest = false), + (this._stencilMask = 255), + (this._stencilFunc = e.ALWAYS), + (this._stencilFuncRef = 1), + (this._stencilFuncMask = 255), + (this._stencilOpStencilFail = e.KEEP), + (this._stencilOpDepthFail = e.KEEP), + (this._stencilOpStencilDepthPass = e.REPLACE), + (this._isStencilTestDirty = true), + (this._isStencilMaskDirty = true), + (this._isStencilFuncDirty = true), + (this._isStencilOpDirty = true); + }), + (e.prototype.apply = function (e) { + this.isDirty && + (this._isStencilTestDirty && + (this.stencilTest + ? e.enable(e.STENCIL_TEST) + : e.disable(e.STENCIL_TEST), + (this._isStencilTestDirty = false)), + this._isStencilMaskDirty && + (e.stencilMask(this.stencilMask), + (this._isStencilMaskDirty = false)), + this._isStencilFuncDirty && + (e.stencilFunc( + this.stencilFunc, + this.stencilFuncRef, + this.stencilFuncMask + ), + (this._isStencilFuncDirty = false)), + this._isStencilOpDirty && + (e.stencilOp( + this.stencilOpStencilFail, + this.stencilOpDepthFail, + this.stencilOpStencilDepthPass + ), + (this._isStencilOpDirty = false))); + }), + (e.ALWAYS = o.a.ALWAYS), + (e.KEEP = o.a.KEEP), + (e.REPLACE = o.a.REPLACE), e - }(); - i.d(t, "a", function() { - return n + ); + })(); + i.d(t, "a", function () { + return n; + }), + i.d(t, "b", function () { + return r; }), - i.d(t, "b", function() { - return r - }), - i.d(t, "c", function() { - return a - }) - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.clipPlaneFragmentDeclaration = "#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.clipPlaneVertexDeclaration = "#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nvarying float fClipDistance4;\n#endif" - } - , function(e, t, n) { - "use strict"; - n.r(t); - var r = n(30) - , o = n(8) - , a = n(0) - , s = n(22) - , u = function() { - function e(e, t) { - this.triggerOptions = e, - this.onBeforeExecuteObservable = new o.c, - e.parameter ? (this.trigger = e.trigger, - this._triggerParameter = e.parameter) : e.trigger ? this.trigger = e.trigger : this.trigger = e, - this._nextActiveAction = this, - this._condition = t - } - return e.prototype._prepare = function() {} - , - e.prototype.getTriggerParameter = function() { - return this._triggerParameter - } - , - e.prototype._executeCurrent = function(e) { - if (this._nextActiveAction._condition) { - var t = this._nextActiveAction._condition - , i = this._actionManager.getScene().getRenderId(); - if (t._evaluationId === i) { - if (!t._currentResult) - return - } else { - if (t._evaluationId = i, - !t.isValid()) - return void (t._currentResult = false); - t._currentResult = true - } + i.d(t, "c", function () { + return a; + }); + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.clipPlaneFragmentDeclaration = + "#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.clipPlaneVertexDeclaration = + "#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nvarying float fClipDistance4;\n#endif"; + }, + function (e, t, n) { + "use strict"; + n.r(t); + var r = n(30), + o = n(8), + a = n(0), + s = n(22), + u = (function () { + function e(e, t) { + (this.triggerOptions = e), + (this.onBeforeExecuteObservable = new o.c()), + e.parameter + ? ((this.trigger = e.trigger), + (this._triggerParameter = e.parameter)) + : e.trigger + ? (this.trigger = e.trigger) + : (this.trigger = e), + (this._nextActiveAction = this), + (this._condition = t); + } + return ( + (e.prototype._prepare = function () {}), + (e.prototype.getTriggerParameter = function () { + return this._triggerParameter; + }), + (e.prototype._executeCurrent = function (e) { + if (this._nextActiveAction._condition) { + var t = this._nextActiveAction._condition, + i = this._actionManager.getScene().getRenderId(); + if (t._evaluationId === i) { + if (!t._currentResult) return; + } else { + if (((t._evaluationId = i), !t.isValid())) + return void (t._currentResult = false); + t._currentResult = true; } - this.onBeforeExecuteObservable.notifyObservers(this), + } + this.onBeforeExecuteObservable.notifyObservers(this), this._nextActiveAction.execute(e), - this.skipToNextActiveAction() - } - , - e.prototype.execute = function(e) {} - , - e.prototype.skipToNextActiveAction = function() { - this._nextActiveAction._child ? (this._nextActiveAction._child._actionManager || (this._nextActiveAction._child._actionManager = this._actionManager), - this._nextActiveAction = this._nextActiveAction._child) : this._nextActiveAction = this - } - , - e.prototype.then = function(e) { - return this._child = e, - e._actionManager = this._actionManager, + this.skipToNextActiveAction(); + }), + (e.prototype.execute = function (e) {}), + (e.prototype.skipToNextActiveAction = function () { + this._nextActiveAction._child + ? (this._nextActiveAction._child._actionManager || + (this._nextActiveAction._child._actionManager = + this._actionManager), + (this._nextActiveAction = + this._nextActiveAction._child)) + : (this._nextActiveAction = this); + }), + (e.prototype.then = function (e) { + return ( + (this._child = e), + (e._actionManager = this._actionManager), e._prepare(), e - } - , - e.prototype._getProperty = function(e) { - return this._actionManager._getProperty(e) - } - , - e.prototype._getEffectiveTarget = function(e, t) { - return this._actionManager._getEffectiveTarget(e, t) - } - , - e.prototype.serialize = function(e) {} - , - e.prototype._serialize = function(e, t) { - var i = { - type: 1, - children: [], - name: e.name, - properties: e.properties || [] - }; - if (this._child && this._child.serialize(i), - this._condition) { - var n = this._condition.serialize(); - return n.children.push(i), - t && t.children.push(n), - n - } - return t && t.children.push(i), - i - } - , - e._SerializeValueAsString = function(e) { - return "number" == typeof e ? e.toString() : "boolean" == typeof e ? e ? "true" : "false" : e instanceof a.w ? e.x + ", " + e.y : e instanceof a.x ? e.x + ", " + e.y + ", " + e.z : e instanceof a.e ? e.r + ", " + e.g + ", " + e.b : e instanceof a.f ? e.r + ", " + e.g + ", " + e.b + ", " + e.a : e - } - , - e._GetTargetProperty = function(e) { - return { - name: "target", - targetType: e._isMesh ? "MeshProperties" : e._isLight ? "LightProperties" : e._isCamera ? "CameraProperties" : "SceneProperties", - value: e._isScene ? "Scene" : e.name - } - } - , + ); + }), + (e.prototype._getProperty = function (e) { + return this._actionManager._getProperty(e); + }), + (e.prototype._getEffectiveTarget = function (e, t) { + return this._actionManager._getEffectiveTarget(e, t); + }), + (e.prototype.serialize = function (e) {}), + (e.prototype._serialize = function (e, t) { + var i = { + type: 1, + children: [], + name: e.name, + properties: e.properties || [], + }; + if ( + (this._child && this._child.serialize(i), + this._condition) + ) { + var n = this._condition.serialize(); + return n.children.push(i), t && t.children.push(n), n; + } + return t && t.children.push(i), i; + }), + (e._SerializeValueAsString = function (e) { + return "number" == typeof e + ? e.toString() + : "boolean" == typeof e + ? e + ? "true" + : "false" + : e instanceof a.w + ? e.x + ", " + e.y + : e instanceof a.x + ? e.x + ", " + e.y + ", " + e.z + : e instanceof a.e + ? e.r + ", " + e.g + ", " + e.b + : e instanceof a.f + ? e.r + ", " + e.g + ", " + e.b + ", " + e.a + : e; + }), + (e._GetTargetProperty = function (e) { + return { + name: "target", + targetType: e._isMesh + ? "MeshProperties" + : e._isLight + ? "LightProperties" + : e._isCamera + ? "CameraProperties" + : "SceneProperties", + value: e._isScene ? "Scene" : e.name, + }; + }), e - }(); - s.a.RegisteredTypes["BABYLON.Action"] = u; - var l = n(36) - , h = n(1) - , f = function() { - function e(e) { - this._actionManager = e - } - return e.prototype.isValid = function() { - return true - } - , - e.prototype._getProperty = function(e) { - return this._actionManager._getProperty(e) - } - , - e.prototype._getEffectiveTarget = function(e, t) { - return this._actionManager._getEffectiveTarget(e, t) - } - , - e.prototype.serialize = function() {} - , - e.prototype._serialize = function(e) { - return { - type: 2, - children: [], - name: e.name, - properties: e.properties - } - } - , + ); + })(); + s.a.RegisteredTypes["BABYLON.Action"] = u; + var l = n(36), + h = n(1), + f = (function () { + function e(e) { + this._actionManager = e; + } + return ( + (e.prototype.isValid = function () { + return true; + }), + (e.prototype._getProperty = function (e) { + return this._actionManager._getProperty(e); + }), + (e.prototype._getEffectiveTarget = function (e, t) { + return this._actionManager._getEffectiveTarget(e, t); + }), + (e.prototype.serialize = function () {}), + (e.prototype._serialize = function (e) { + return { + type: 2, + children: [], + name: e.name, + properties: e.properties, + }; + }), e - }() - , d = function(e) { - function t(i, n, r, o, a) { - void 0 === a && (a = t.IsEqual); - var s = e.call(this, i) || this; - return s.propertyPath = r, - s.value = o, - s.operator = a, - s._target = n, - s._effectiveTarget = s._getEffectiveTarget(n, s.propertyPath), - s._property = s._getProperty(s.propertyPath), - s - } - return h.d(t, e), + ); + })(), + d = (function (e) { + function t(i, n, r, o, a) { + void 0 === a && (a = t.IsEqual); + var s = e.call(this, i) || this; + return ( + (s.propertyPath = r), + (s.value = o), + (s.operator = a), + (s._target = n), + (s._effectiveTarget = s._getEffectiveTarget( + n, + s.propertyPath + )), + (s._property = s._getProperty(s.propertyPath)), + s + ); + } + return ( + h.d(t, e), Object.defineProperty(t, "IsEqual", { - get: function() { - return t._IsEqual - }, - enumerable: true, - configurable: true + get: function () { + return t._IsEqual; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "IsDifferent", { - get: function() { - return t._IsDifferent - }, - enumerable: true, - configurable: true + get: function () { + return t._IsDifferent; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "IsGreater", { - get: function() { - return t._IsGreater - }, - enumerable: true, - configurable: true + get: function () { + return t._IsGreater; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t, "IsLesser", { - get: function() { - return t._IsLesser - }, - enumerable: true, - configurable: true + get: function () { + return t._IsLesser; + }, + enumerable: true, + configurable: true, }), - t.prototype.isValid = function() { - switch (this.operator) { + (t.prototype.isValid = function () { + switch (this.operator) { case t.IsGreater: - return this._effectiveTarget[this._property] > this.value; + return ( + this._effectiveTarget[this._property] > this.value + ); case t.IsLesser: - return this._effectiveTarget[this._property] < this.value; + return ( + this._effectiveTarget[this._property] < this.value + ); case t.IsEqual: case t.IsDifferent: - var e; - return e = this.value.equals ? this.value.equals(this._effectiveTarget[this._property]) : this.value === this._effectiveTarget[this._property], + var e; + return ( + (e = this.value.equals + ? this.value.equals( + this._effectiveTarget[this._property] + ) + : this.value === + this._effectiveTarget[this._property]), this.operator === t.IsEqual ? e : !e - } - return false - } - , - t.prototype.serialize = function() { - return this._serialize({ - name: "ValueCondition", - properties: [u._GetTargetProperty(this._target), { - name: "propertyPath", - value: this.propertyPath - }, { - name: "value", - value: u._SerializeValueAsString(this.value) - }, { - name: "operator", - value: t.GetOperatorName(this.operator) - }] - }) - } - , - t.GetOperatorName = function(e) { - switch (e) { + ); + } + return false; + }), + (t.prototype.serialize = function () { + return this._serialize({ + name: "ValueCondition", + properties: [ + u._GetTargetProperty(this._target), + { + name: "propertyPath", + value: this.propertyPath, + }, + { + name: "value", + value: u._SerializeValueAsString(this.value), + }, + { + name: "operator", + value: t.GetOperatorName(this.operator), + }, + ], + }); + }), + (t.GetOperatorName = function (e) { + switch (e) { case t._IsEqual: - return "IsEqual"; + return "IsEqual"; case t._IsDifferent: - return "IsDifferent"; + return "IsDifferent"; case t._IsGreater: - return "IsGreater"; + return "IsGreater"; case t._IsLesser: - return "IsLesser"; + return "IsLesser"; default: - return "" - } - } - , - t._IsEqual = 0, - t._IsDifferent = 1, - t._IsGreater = 2, - t._IsLesser = 3, + return ""; + } + }), + (t._IsEqual = 0), + (t._IsDifferent = 1), + (t._IsGreater = 2), + (t._IsLesser = 3), t - }(f) - , p = function(e) { - function t(t, i) { - var n = e.call(this, t) || this; - return n.predicate = i, - n - } - return h.d(t, e), - t.prototype.isValid = function() { - return this.predicate() - } - , + ); + })(f), + p = (function (e) { + function t(t, i) { + var n = e.call(this, t) || this; + return (n.predicate = i), n; + } + return ( + h.d(t, e), + (t.prototype.isValid = function () { + return this.predicate(); + }), t - }(f) - , m = function(e) { - function t(t, i, n) { - var r = e.call(this, t) || this; - return r.value = n, - r._target = i, - r - } - return h.d(t, e), - t.prototype.isValid = function() { - return this._target.state === this.value - } - , - t.prototype.serialize = function() { - return this._serialize({ - name: "StateCondition", - properties: [u._GetTargetProperty(this._target), { - name: "value", - value: this.value - }] - }) - } - , + ); + })(f), + m = (function (e) { + function t(t, i, n) { + var r = e.call(this, t) || this; + return (r.value = n), (r._target = i), r; + } + return ( + h.d(t, e), + (t.prototype.isValid = function () { + return this._target.state === this.value; + }), + (t.prototype.serialize = function () { + return this._serialize({ + name: "StateCondition", + properties: [ + u._GetTargetProperty(this._target), + { + name: "value", + value: this.value, + }, + ], + }); + }), t - }(f); - s.a.RegisteredTypes["BABYLON.ValueCondition"] = d, - s.a.RegisteredTypes["BABYLON.PredicateCondition"] = p, - s.a.RegisteredTypes["BABYLON.StateCondition"] = m; - var g = n(6) - , _ = n(3) - , v = function(e) { - function t(t, i, n, r) { - var o = e.call(this, t, r) || this; - return o.propertyPath = n, - o._target = o._effectiveTarget = i, - o - } - return h.d(t, e), - t.prototype._prepare = function() { - this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath), - this._property = this._getProperty(this.propertyPath) - } - , - t.prototype.execute = function() { - this._effectiveTarget[this._property] = !this._effectiveTarget[this._property] - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "SwitchBooleanAction", - properties: [u._GetTargetProperty(this._target), { - name: "propertyPath", - value: this.propertyPath - }] - }, t) - } - , - t - }(u) - , y = function(e) { - function t(t, i, n, r) { - var o = e.call(this, t, r) || this; - return o.value = n, - o._target = i, - o - } - return h.d(t, e), - t.prototype.execute = function() { - this._target.state = this.value - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "SetStateAction", - properties: [u._GetTargetProperty(this._target), { - name: "value", - value: this.value - }] - }, t) - } - , - t - }(u) - , b = function(e) { - function t(t, i, n, r, o) { - var a = e.call(this, t, o) || this; - return a.propertyPath = n, - a.value = r, - a._target = a._effectiveTarget = i, - a - } - return h.d(t, e), - t.prototype._prepare = function() { - this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath), - this._property = this._getProperty(this.propertyPath) - } - , - t.prototype.execute = function() { - this._effectiveTarget[this._property] = this.value, - this._target.markAsDirty && this._target.markAsDirty(this._property) - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "SetValueAction", - properties: [u._GetTargetProperty(this._target), { - name: "propertyPath", - value: this.propertyPath - }, { - name: "value", - value: u._SerializeValueAsString(this.value) - }] - }, t) - } - , - t - }(u) - , E = function(e) { - function t(t, i, n, r, o) { - var a = e.call(this, t, o) || this; - return a.propertyPath = n, - a.value = r, - a._target = a._effectiveTarget = i, - a - } - return h.d(t, e), - t.prototype._prepare = function() { - this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath), - this._property = this._getProperty(this.propertyPath), - "number" != typeof this._effectiveTarget[this._property] && g.a.Warn("Warning: IncrementValueAction can only be used with number values") - } - , - t.prototype.execute = function() { - this._effectiveTarget[this._property] += this.value, - this._target.markAsDirty && this._target.markAsDirty(this._property) - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "IncrementValueAction", - properties: [u._GetTargetProperty(this._target), { - name: "propertyPath", - value: this.propertyPath - }, { - name: "value", - value: u._SerializeValueAsString(this.value) - }] - }, t) - } - , - t - }(u) - , T = function(e) { - function t(t, i, n, r, o, a) { - var s = e.call(this, t, a) || this; - return s.from = n, - s.to = r, - s.loop = o, - s._target = i, - s - } - return h.d(t, e), - t.prototype._prepare = function() {} - , - t.prototype.execute = function() { - this._actionManager.getScene().beginAnimation(this._target, this.from, this.to, this.loop) - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "PlayAnimationAction", - properties: [u._GetTargetProperty(this._target), { - name: "from", - value: String(this.from) - }, { - name: "to", - value: String(this.to) - }, { - name: "loop", - value: u._SerializeValueAsString(this.loop) || false - }] - }, t) - } - , - t - }(u) - , A = function(e) { - function t(t, i, n) { - var r = e.call(this, t, n) || this; - return r._target = i, - r - } - return h.d(t, e), - t.prototype._prepare = function() {} - , - t.prototype.execute = function() { - this._actionManager.getScene().stopAnimation(this._target) - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "StopAnimationAction", - properties: [u._GetTargetProperty(this._target)] - }, t) - } - , - t - }(u) - , x = function(e) { - function t(t, i) { - return void 0 === t && (t = _.a.ACTION_NothingTrigger), - e.call(this, t, i) || this - } - return h.d(t, e), - t.prototype.execute = function() {} - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "DoNothingAction", - properties: [] - }, t) - } - , - t - }(u) - , S = function(e) { - function t(t, i, n) { - var r = e.call(this, t, n) || this; - return r.children = i, - r - } - return h.d(t, e), - t.prototype._prepare = function() { - for (var e = 0; e < this.children.length; e++) - this.children[e]._actionManager = this._actionManager, - this.children[e]._prepare() - } - , - t.prototype.execute = function(e) { - for (var t = 0; t < this.children.length; t++) - this.children[t].execute(e) - } - , - t.prototype.serialize = function(t) { - for (var i = e.prototype._serialize.call(this, { - name: "CombineAction", - properties: [], - combine: [] - }, t), n = 0; n < this.children.length; n++) - i.combine.push(this.children[n].serialize(null)); - return i - } - , - t - }(u) - , C = function(e) { - function t(t, i, n) { - var r = e.call(this, t, n) || this; - return r.func = i, - r - } - return h.d(t, e), - t.prototype.execute = function(e) { - this.func(e) - } - , - t - }(u) - , P = function(e) { - function t(t, i, n, r) { - var o = e.call(this, t, r) || this; - return o._target = i, - o._parent = n, - o - } - return h.d(t, e), - t.prototype._prepare = function() {} - , - t.prototype.execute = function() { - if (this._target.parent !== this._parent) { - var e = this._parent.getWorldMatrix().clone(); - e.invert(), - this._target.position = a.x.TransformCoordinates(this._target.position, e), - this._target.parent = this._parent - } - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "SetParentAction", - properties: [u._GetTargetProperty(this._target), u._GetTargetProperty(this._parent)] - }, t) - } - , - t - }(u); - s.a.RegisteredTypes["BABYLON.SetParentAction"] = P, - s.a.RegisteredTypes["BABYLON.ExecuteCodeAction"] = C, - s.a.RegisteredTypes["BABYLON.DoNothingAction"] = x, - s.a.RegisteredTypes["BABYLON.StopAnimationAction"] = A, - s.a.RegisteredTypes["BABYLON.PlayAnimationAction"] = T, - s.a.RegisteredTypes["BABYLON.IncrementValueAction"] = E, - s.a.RegisteredTypes["BABYLON.SetValueAction"] = b, - s.a.RegisteredTypes["BABYLON.SetStateAction"] = y, - s.a.RegisteredTypes["BABYLON.SetParentAction"] = P; - var R = n(23) - , M = n(32) - , O = function(e) { - function t(t) { - var i = e.call(this) || this; - return i._scene = t || R.a.LastCreatedScene, - t.actionManagers.push(i), - i - } - return h.d(t, e), - t.prototype.dispose = function() { - for (var e = this._scene.actionManagers.indexOf(this), i = 0; i < this.actions.length; i++) { - var n = this.actions[i]; - t.Triggers[n.trigger]--, - 0 === t.Triggers[n.trigger] && delete t.Triggers[n.trigger] - } - e > -1 && this._scene.actionManagers.splice(e, 1) - } - , - t.prototype.getScene = function() { - return this._scene - } - , - t.prototype.hasSpecificTriggers = function(e) { - for (var t = 0; t < this.actions.length; t++) { - var i = this.actions[t]; - if (e.indexOf(i.trigger) > -1) - return true - } - return false - } - , - t.prototype.hasSpecificTriggers2 = function(e, t) { - for (var i = 0; i < this.actions.length; i++) { - var n = this.actions[i]; - if (e == n.trigger || t == n.trigger) - return true - } - return false - } - , - t.prototype.hasSpecificTrigger = function(e, t) { - for (var i = 0; i < this.actions.length; i++) { - var n = this.actions[i]; - if (n.trigger === e) { - if (!t) - return true; - if (t(n.getTriggerParameter())) - return true - } - } - return false - } - , - Object.defineProperty(t.prototype, "hasPointerTriggers", { - get: function() { - for (var e = 0; e < this.actions.length; e++) { - var i = this.actions[e]; - if (i.trigger >= t.OnPickTrigger && i.trigger <= t.OnPointerOutTrigger) - return true - } - return false + ); + })(f); + (s.a.RegisteredTypes["BABYLON.ValueCondition"] = d), + (s.a.RegisteredTypes["BABYLON.PredicateCondition"] = p), + (s.a.RegisteredTypes["BABYLON.StateCondition"] = m); + var g = n(6), + _ = n(3), + v = (function (e) { + function t(t, i, n, r) { + var o = e.call(this, t, r) || this; + return ( + (o.propertyPath = n), + (o._target = o._effectiveTarget = i), + o + ); + } + return ( + h.d(t, e), + (t.prototype._prepare = function () { + (this._effectiveTarget = this._getEffectiveTarget( + this._effectiveTarget, + this.propertyPath + )), + (this._property = this._getProperty(this.propertyPath)); + }), + (t.prototype.execute = function () { + this._effectiveTarget[this._property] = + !this._effectiveTarget[this._property]; + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "SwitchBooleanAction", + properties: [ + u._GetTargetProperty(this._target), + { + name: "propertyPath", + value: this.propertyPath, + }, + ], }, - enumerable: true, - configurable: true + t + ); + }), + t + ); + })(u), + y = (function (e) { + function t(t, i, n, r) { + var o = e.call(this, t, r) || this; + return (o.value = n), (o._target = i), o; + } + return ( + h.d(t, e), + (t.prototype.execute = function () { + this._target.state = this.value; + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "SetStateAction", + properties: [ + u._GetTargetProperty(this._target), + { + name: "value", + value: this.value, + }, + ], + }, + t + ); + }), + t + ); + })(u), + b = (function (e) { + function t(t, i, n, r, o) { + var a = e.call(this, t, o) || this; + return ( + (a.propertyPath = n), + (a.value = r), + (a._target = a._effectiveTarget = i), + a + ); + } + return ( + h.d(t, e), + (t.prototype._prepare = function () { + (this._effectiveTarget = this._getEffectiveTarget( + this._effectiveTarget, + this.propertyPath + )), + (this._property = this._getProperty(this.propertyPath)); + }), + (t.prototype.execute = function () { + (this._effectiveTarget[this._property] = this.value), + this._target.markAsDirty && + this._target.markAsDirty(this._property); + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "SetValueAction", + properties: [ + u._GetTargetProperty(this._target), + { + name: "propertyPath", + value: this.propertyPath, + }, + { + name: "value", + value: u._SerializeValueAsString(this.value), + }, + ], + }, + t + ); + }), + t + ); + })(u), + E = (function (e) { + function t(t, i, n, r, o) { + var a = e.call(this, t, o) || this; + return ( + (a.propertyPath = n), + (a.value = r), + (a._target = a._effectiveTarget = i), + a + ); + } + return ( + h.d(t, e), + (t.prototype._prepare = function () { + (this._effectiveTarget = this._getEffectiveTarget( + this._effectiveTarget, + this.propertyPath + )), + (this._property = this._getProperty(this.propertyPath)), + "number" != + typeof this._effectiveTarget[this._property] && + g.a.Warn( + "Warning: IncrementValueAction can only be used with number values" + ); + }), + (t.prototype.execute = function () { + (this._effectiveTarget[this._property] += this.value), + this._target.markAsDirty && + this._target.markAsDirty(this._property); + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "IncrementValueAction", + properties: [ + u._GetTargetProperty(this._target), + { + name: "propertyPath", + value: this.propertyPath, + }, + { + name: "value", + value: u._SerializeValueAsString(this.value), + }, + ], + }, + t + ); + }), + t + ); + })(u), + T = (function (e) { + function t(t, i, n, r, o, a) { + var s = e.call(this, t, a) || this; + return ( + (s.from = n), (s.to = r), (s.loop = o), (s._target = i), s + ); + } + return ( + h.d(t, e), + (t.prototype._prepare = function () {}), + (t.prototype.execute = function () { + this._actionManager + .getScene() + .beginAnimation( + this._target, + this.from, + this.to, + this.loop + ); + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "PlayAnimationAction", + properties: [ + u._GetTargetProperty(this._target), + { + name: "from", + value: String(this.from), + }, + { + name: "to", + value: String(this.to), + }, + { + name: "loop", + value: + u._SerializeValueAsString(this.loop) || false, + }, + ], + }, + t + ); + }), + t + ); + })(u), + A = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, n) || this; + return (r._target = i), r; + } + return ( + h.d(t, e), + (t.prototype._prepare = function () {}), + (t.prototype.execute = function () { + this._actionManager + .getScene() + .stopAnimation(this._target); + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "StopAnimationAction", + properties: [u._GetTargetProperty(this._target)], + }, + t + ); + }), + t + ); + })(u), + x = (function (e) { + function t(t, i) { + return ( + void 0 === t && (t = _.a.ACTION_NothingTrigger), + e.call(this, t, i) || this + ); + } + return ( + h.d(t, e), + (t.prototype.execute = function () {}), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "DoNothingAction", + properties: [], + }, + t + ); + }), + t + ); + })(u), + S = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, n) || this; + return (r.children = i), r; + } + return ( + h.d(t, e), + (t.prototype._prepare = function () { + for (var e = 0; e < this.children.length; e++) + (this.children[e]._actionManager = this._actionManager), + this.children[e]._prepare(); + }), + (t.prototype.execute = function (e) { + for (var t = 0; t < this.children.length; t++) + this.children[t].execute(e); + }), + (t.prototype.serialize = function (t) { + for ( + var i = e.prototype._serialize.call( + this, + { + name: "CombineAction", + properties: [], + combine: [], + }, + t + ), + n = 0; + n < this.children.length; + n++ + ) + i.combine.push(this.children[n].serialize(null)); + return i; + }), + t + ); + })(u), + C = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, n) || this; + return (r.func = i), r; + } + return ( + h.d(t, e), + (t.prototype.execute = function (e) { + this.func(e); + }), + t + ); + })(u), + P = (function (e) { + function t(t, i, n, r) { + var o = e.call(this, t, r) || this; + return (o._target = i), (o._parent = n), o; + } + return ( + h.d(t, e), + (t.prototype._prepare = function () {}), + (t.prototype.execute = function () { + if (this._target.parent !== this._parent) { + var e = this._parent.getWorldMatrix().clone(); + e.invert(), + (this._target.position = a.x.TransformCoordinates( + this._target.position, + e + )), + (this._target.parent = this._parent); + } + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "SetParentAction", + properties: [ + u._GetTargetProperty(this._target), + u._GetTargetProperty(this._parent), + ], + }, + t + ); + }), + t + ); + })(u); + (s.a.RegisteredTypes["BABYLON.SetParentAction"] = P), + (s.a.RegisteredTypes["BABYLON.ExecuteCodeAction"] = C), + (s.a.RegisteredTypes["BABYLON.DoNothingAction"] = x), + (s.a.RegisteredTypes["BABYLON.StopAnimationAction"] = A), + (s.a.RegisteredTypes["BABYLON.PlayAnimationAction"] = T), + (s.a.RegisteredTypes["BABYLON.IncrementValueAction"] = E), + (s.a.RegisteredTypes["BABYLON.SetValueAction"] = b), + (s.a.RegisteredTypes["BABYLON.SetStateAction"] = y), + (s.a.RegisteredTypes["BABYLON.SetParentAction"] = P); + var R = n(23), + M = n(32), + O = (function (e) { + function t(t) { + var i = e.call(this) || this; + return ( + (i._scene = t || R.a.LastCreatedScene), + t.actionManagers.push(i), + i + ); + } + return ( + h.d(t, e), + (t.prototype.dispose = function () { + for ( + var e = this._scene.actionManagers.indexOf(this), i = 0; + i < this.actions.length; + i++ + ) { + var n = this.actions[i]; + t.Triggers[n.trigger]--, + 0 === t.Triggers[n.trigger] && + delete t.Triggers[n.trigger]; + } + e > -1 && this._scene.actionManagers.splice(e, 1); + }), + (t.prototype.getScene = function () { + return this._scene; + }), + (t.prototype.hasSpecificTriggers = function (e) { + for (var t = 0; t < this.actions.length; t++) { + var i = this.actions[t]; + if (e.indexOf(i.trigger) > -1) return true; + } + return false; + }), + (t.prototype.hasSpecificTriggers2 = function (e, t) { + for (var i = 0; i < this.actions.length; i++) { + var n = this.actions[i]; + if (e == n.trigger || t == n.trigger) return true; + } + return false; + }), + (t.prototype.hasSpecificTrigger = function (e, t) { + for (var i = 0; i < this.actions.length; i++) { + var n = this.actions[i]; + if (n.trigger === e) { + if (!t) return true; + if (t(n.getTriggerParameter())) return true; + } + } + return false; + }), + Object.defineProperty(t.prototype, "hasPointerTriggers", { + get: function () { + for (var e = 0; e < this.actions.length; e++) { + var i = this.actions[e]; + if ( + i.trigger >= t.OnPickTrigger && + i.trigger <= t.OnPointerOutTrigger + ) + return true; + } + return false; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "hasPickTriggers", { - get: function() { - for (var e = 0; e < this.actions.length; e++) { - var i = this.actions[e]; - if (i.trigger >= t.OnPickTrigger && i.trigger <= t.OnPickUpTrigger) - return true - } - return false - }, - enumerable: true, - configurable: true + get: function () { + for (var e = 0; e < this.actions.length; e++) { + var i = this.actions[e]; + if ( + i.trigger >= t.OnPickTrigger && + i.trigger <= t.OnPickUpTrigger + ) + return true; + } + return false; + }, + enumerable: true, + configurable: true, }), - t.prototype.registerAction = function(e) { - return e.trigger === t.OnEveryFrameTrigger && this.getScene().actionManager !== this ? (g.a.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"), - null) : (this.actions.push(e), - t.Triggers[e.trigger] ? t.Triggers[e.trigger]++ : t.Triggers[e.trigger] = 1, - e._actionManager = this, - e._prepare(), - e) - } - , - t.prototype.unregisterAction = function(e) { - var i = this.actions.indexOf(e); - return -1 !== i && (this.actions.splice(i, 1), - t.Triggers[e.trigger] -= 1, - 0 === t.Triggers[e.trigger] && delete t.Triggers[e.trigger], + (t.prototype.registerAction = function (e) { + return e.trigger === t.OnEveryFrameTrigger && + this.getScene().actionManager !== this + ? (g.a.Warn( + "OnEveryFrameTrigger can only be used with scene.actionManager" + ), + null) + : (this.actions.push(e), + t.Triggers[e.trigger] + ? t.Triggers[e.trigger]++ + : (t.Triggers[e.trigger] = 1), + (e._actionManager = this), + e._prepare(), + e); + }), + (t.prototype.unregisterAction = function (e) { + var i = this.actions.indexOf(e); + return ( + -1 !== i && + (this.actions.splice(i, 1), + (t.Triggers[e.trigger] -= 1), + 0 === t.Triggers[e.trigger] && + delete t.Triggers[e.trigger], delete e._actionManager, true) - } - , - t.prototype.processTrigger = function(e, i) { - for (var n = 0; n < this.actions.length; n++) { - var r = this.actions[n]; - if (r.trigger === e) { - if (i && (e === t.OnKeyUpTrigger || e === t.OnKeyDownTrigger)) { - var o = r.getTriggerParameter(); - if (o && o !== i.sourceEvent.keyCode) { - if (!o.toLowerCase) - continue; - var a = o.toLowerCase(); - if (a !== i.sourceEvent.key) { - var s = i.sourceEvent.charCode ? i.sourceEvent.charCode : i.sourceEvent.keyCode; - if (String.fromCharCode(s).toLowerCase() !== a) - continue - } - } - } - r._executeCurrent(i) + ); + }), + (t.prototype.processTrigger = function (e, i) { + for (var n = 0; n < this.actions.length; n++) { + var r = this.actions[n]; + if (r.trigger === e) { + if ( + i && + (e === t.OnKeyUpTrigger || e === t.OnKeyDownTrigger) + ) { + var o = r.getTriggerParameter(); + if (o && o !== i.sourceEvent.keyCode) { + if (!o.toLowerCase) continue; + var a = o.toLowerCase(); + if (a !== i.sourceEvent.key) { + var s = i.sourceEvent.charCode + ? i.sourceEvent.charCode + : i.sourceEvent.keyCode; + if (String.fromCharCode(s).toLowerCase() !== a) + continue; + } } + } + r._executeCurrent(i); } - } - , - t.prototype._getEffectiveTarget = function(e, t) { - for (var i = t.split("."), n = 0; n < i.length - 1; n++) - e = e[i[n]]; - return e - } - , - t.prototype._getProperty = function(e) { - var t = e.split("."); - return t[t.length - 1] - } - , - t.prototype.serialize = function(e) { - for (var i = { - children: new Array, + } + }), + (t.prototype._getEffectiveTarget = function (e, t) { + for (var i = t.split("."), n = 0; n < i.length - 1; n++) + e = e[i[n]]; + return e; + }), + (t.prototype._getProperty = function (e) { + var t = e.split("."); + return t[t.length - 1]; + }), + (t.prototype.serialize = function (e) { + for ( + var i = { + children: new Array(), name: e, type: 3, - properties: new Array - }, n = 0; n < this.actions.length; n++) { - var r = { - type: 0, - children: new Array, - name: t.GetTriggerName(this.actions[n].trigger), - properties: new Array - } - , o = this.actions[n].triggerOptions; - if (o && "number" != typeof o) - if (o.parameter instanceof Node) - r.properties.push(u._GetTargetProperty(o.parameter)); - else { - var a = {}; - M.a.DeepCopy(o.parameter, a, ["mesh"]), - o.parameter && o.parameter.mesh && (a._meshId = o.parameter.mesh.id), - r.properties.push({ - name: "parameter", - targetType: null, - value: a - }) - } - this.actions[n].serialize(r), - i.children.push(r) - } - return i - } - , - t.Parse = function(e, i, n) { - var r = new t(n); - null === i ? n.actionManager = r : i.actionManager = r; - for (var o = function(e, t, i, n) { + properties: new Array(), + }, + n = 0; + n < this.actions.length; + n++ + ) { + var r = { + type: 0, + children: new Array(), + name: t.GetTriggerName(this.actions[n].trigger), + properties: new Array(), + }, + o = this.actions[n].triggerOptions; + if (o && "number" != typeof o) + if (o.parameter instanceof Node) + r.properties.push( + u._GetTargetProperty(o.parameter) + ); + else { + var a = {}; + M.a.DeepCopy(o.parameter, a, ["mesh"]), + o.parameter && + o.parameter.mesh && + (a._meshId = o.parameter.mesh.id), + r.properties.push({ + name: "parameter", + targetType: null, + value: a, + }); + } + this.actions[n].serialize(r), i.children.push(r); + } + return i; + }), + (t.Parse = function (e, i, n) { + var r = new t(n); + null === i + ? (n.actionManager = r) + : (i.actionManager = r); + for ( + var o = function (e, t, i, n) { if (null === n) { - var r = parseFloat(t); - return "true" === t || "false" === t ? "true" === t : isNaN(r) ? t : r + var r = parseFloat(t); + return "true" === t || "false" === t + ? "true" === t + : isNaN(r) + ? t + : r; } - for (var o = n.split("."), s = t.split(","), c = 0; c < o.length; c++) - i = i[o[c]]; - if ("boolean" == typeof i) - return "true" === s[0]; - if ("string" == typeof i) - return s[0]; - var u = new Array; + for ( + var o = n.split("."), s = t.split(","), c = 0; + c < o.length; + c++ + ) + i = i[o[c]]; + if ("boolean" == typeof i) return "true" === s[0]; + if ("string" == typeof i) return s[0]; + var u = new Array(); for (c = 0; c < s.length; c++) - u.push(parseFloat(s[c])); - return i instanceof a.x ? a.x.FromArray(u) : i instanceof a.y ? a.y.FromArray(u) : i instanceof a.e ? a.e.FromArray(u) : i instanceof a.f ? a.f.FromArray(u) : parseFloat(s[0]) - }, c = function e(i, a, c, u, l) { - if (void 0 === l && (l = null), - !i.detached) { - var h = new Array - , p = null - , m = null - , g = i.combine && i.combine.length > 0; - if (2 === i.type ? h.push(r) : h.push(a), - g) { - for (var _ = new Array, v = 0; v < i.combine.length; v++) - e(i.combine[v], t.NothingTrigger, c, u, _); - h.push(_) - } else - for (var y = 0; y < i.properties.length; y++) { - var b = i.properties[y].value - , E = i.properties[y].name - , T = i.properties[y].targetType; - "target" === E ? b = p = null !== T && "SceneProperties" === T ? n : n.getNodeByName(b) : "parent" === E ? b = n.getNodeByName(b) : "sound" === E ? n.getSoundByName && (b = n.getSoundByName(b)) : "propertyPath" !== E ? b = 2 === i.type && "operator" === E ? d[b] : o(0, b, p, "value" === E ? m : null) : m = b, - h.push(b) - } - if (null === l ? h.push(c) : h.push(null), - "InterpolateValueAction" === i.name) { - var A = h[h.length - 2]; - h[h.length - 1] = A, - h[h.length - 2] = c + u.push(parseFloat(s[c])); + return i instanceof a.x + ? a.x.FromArray(u) + : i instanceof a.y + ? a.y.FromArray(u) + : i instanceof a.e + ? a.e.FromArray(u) + : i instanceof a.f + ? a.f.FromArray(u) + : parseFloat(s[0]); + }, + c = function e(i, a, c, u, l) { + if ((void 0 === l && (l = null), !i.detached)) { + var h = new Array(), + p = null, + m = null, + g = i.combine && i.combine.length > 0; + if ((2 === i.type ? h.push(r) : h.push(a), g)) { + for ( + var _ = new Array(), v = 0; + v < i.combine.length; + v++ + ) + e(i.combine[v], t.NothingTrigger, c, u, _); + h.push(_); + } else + for (var y = 0; y < i.properties.length; y++) { + var b = i.properties[y].value, + E = i.properties[y].name, + T = i.properties[y].targetType; + "target" === E + ? (b = p = + null !== T && "SceneProperties" === T + ? n + : n.getNodeByName(b)) + : "parent" === E + ? (b = n.getNodeByName(b)) + : "sound" === E + ? n.getSoundByName && + (b = n.getSoundByName(b)) + : "propertyPath" !== E + ? (b = + 2 === i.type && "operator" === E + ? d[b] + : o( + 0, + b, + p, + "value" === E ? m : null + )) + : (m = b), + h.push(b); } - var S = function(e, t) { - var i = s.a.GetClass("BABYLON." + e); - if (i) { - var n = Object.create(i.prototype); - return n.constructor.apply(n, t), - n - } - }(i.name, h); - if (S instanceof f && null !== c) { - var C = new x(a,c); - u ? u.then(C) : r.registerAction(C), - u = C + if ( + (null === l ? h.push(c) : h.push(null), + "InterpolateValueAction" === i.name) + ) { + var A = h[h.length - 2]; + (h[h.length - 1] = A), (h[h.length - 2] = c); + } + var S = (function (e, t) { + var i = s.a.GetClass("BABYLON." + e); + if (i) { + var n = Object.create(i.prototype); + return n.constructor.apply(n, t), n; } - for (null === l ? S instanceof f ? (c = S, - S = u) : (c = null, - u ? u.then(S) : r.registerAction(S)) : l.push(S), - y = 0; y < i.children.length; y++) - e(i.children[y], a, c, S, null) + })(i.name, h); + if (S instanceof f && null !== c) { + var C = new x(a, c); + u ? u.then(C) : r.registerAction(C), (u = C); + } + for ( + null === l + ? S instanceof f + ? ((c = S), (S = u)) + : ((c = null), + u ? u.then(S) : r.registerAction(S)) + : l.push(S), + y = 0; + y < i.children.length; + y++ + ) + e(i.children[y], a, c, S, null); } - }, u = 0; u < e.children.length; u++) { - var l, h = e.children[u]; - if (h.properties.length > 0) { - var p = h.properties[0].value - , m = null === h.properties[0].targetType ? p : n.getMeshByName(p); - m._meshId && (m.mesh = n.getMeshByID(m._meshId)), - l = { - trigger: t[h.name], - parameter: m - } - } else - l = t[h.name]; - for (var g = 0; g < h.children.length; g++) - h.detached || c(h.children[g], l, null, null) - } - } - , - t.GetTriggerName = function(e) { - switch (e) { + }, + u = 0; + u < e.children.length; + u++ + ) { + var l, + h = e.children[u]; + if (h.properties.length > 0) { + var p = h.properties[0].value, + m = + null === h.properties[0].targetType + ? p + : n.getMeshByName(p); + m._meshId && (m.mesh = n.getMeshByID(m._meshId)), + (l = { + trigger: t[h.name], + parameter: m, + }); + } else l = t[h.name]; + for (var g = 0; g < h.children.length; g++) + h.detached || c(h.children[g], l, null, null); + } + }), + (t.GetTriggerName = function (e) { + switch (e) { case 0: - return "NothingTrigger"; + return "NothingTrigger"; case 1: - return "OnPickTrigger"; + return "OnPickTrigger"; case 2: - return "OnLeftPickTrigger"; + return "OnLeftPickTrigger"; case 3: - return "OnRightPickTrigger"; + return "OnRightPickTrigger"; case 4: - return "OnCenterPickTrigger"; + return "OnCenterPickTrigger"; case 5: - return "OnPickDownTrigger"; + return "OnPickDownTrigger"; case 6: - return "OnPickUpTrigger"; + return "OnPickUpTrigger"; case 7: - return "OnLongPressTrigger"; + return "OnLongPressTrigger"; case 8: - return "OnPointerOverTrigger"; + return "OnPointerOverTrigger"; case 9: - return "OnPointerOutTrigger"; + return "OnPointerOutTrigger"; case 10: - return "OnEveryFrameTrigger"; + return "OnEveryFrameTrigger"; case 11: - return "OnIntersectionEnterTrigger"; + return "OnIntersectionEnterTrigger"; case 12: - return "OnIntersectionExitTrigger"; + return "OnIntersectionExitTrigger"; case 13: - return "OnKeyDownTrigger"; + return "OnKeyDownTrigger"; case 14: - return "OnKeyUpTrigger"; + return "OnKeyUpTrigger"; case 15: - return "OnPickOutTrigger"; + return "OnPickOutTrigger"; default: - return "" - } - } - , - t.NothingTrigger = _.a.ACTION_NothingTrigger, - t.OnPickTrigger = _.a.ACTION_OnPickTrigger, - t.OnLeftPickTrigger = _.a.ACTION_OnLeftPickTrigger, - t.OnRightPickTrigger = _.a.ACTION_OnRightPickTrigger, - t.OnCenterPickTrigger = _.a.ACTION_OnCenterPickTrigger, - t.OnPickDownTrigger = _.a.ACTION_OnPickDownTrigger, - t.OnDoublePickTrigger = _.a.ACTION_OnDoublePickTrigger, - t.OnPickUpTrigger = _.a.ACTION_OnPickUpTrigger, - t.OnPickOutTrigger = _.a.ACTION_OnPickOutTrigger, - t.OnLongPressTrigger = _.a.ACTION_OnLongPressTrigger, - t.OnPointerOverTrigger = _.a.ACTION_OnPointerOverTrigger, - t.OnPointerOutTrigger = _.a.ACTION_OnPointerOutTrigger, - t.OnEveryFrameTrigger = _.a.ACTION_OnEveryFrameTrigger, - t.OnIntersectionEnterTrigger = _.a.ACTION_OnIntersectionEnterTrigger, - t.OnIntersectionExitTrigger = _.a.ACTION_OnIntersectionExitTrigger, - t.OnKeyDownTrigger = _.a.ACTION_OnKeyDownTrigger, - t.OnKeyUpTrigger = 15, + return ""; + } + }), + (t.NothingTrigger = _.a.ACTION_NothingTrigger), + (t.OnPickTrigger = _.a.ACTION_OnPickTrigger), + (t.OnLeftPickTrigger = _.a.ACTION_OnLeftPickTrigger), + (t.OnRightPickTrigger = _.a.ACTION_OnRightPickTrigger), + (t.OnCenterPickTrigger = _.a.ACTION_OnCenterPickTrigger), + (t.OnPickDownTrigger = _.a.ACTION_OnPickDownTrigger), + (t.OnDoublePickTrigger = _.a.ACTION_OnDoublePickTrigger), + (t.OnPickUpTrigger = _.a.ACTION_OnPickUpTrigger), + (t.OnPickOutTrigger = _.a.ACTION_OnPickOutTrigger), + (t.OnLongPressTrigger = _.a.ACTION_OnLongPressTrigger), + (t.OnPointerOverTrigger = _.a.ACTION_OnPointerOverTrigger), + (t.OnPointerOutTrigger = _.a.ACTION_OnPointerOutTrigger), + (t.OnEveryFrameTrigger = _.a.ACTION_OnEveryFrameTrigger), + (t.OnIntersectionEnterTrigger = + _.a.ACTION_OnIntersectionEnterTrigger), + (t.OnIntersectionExitTrigger = + _.a.ACTION_OnIntersectionExitTrigger), + (t.OnKeyDownTrigger = _.a.ACTION_OnKeyDownTrigger), + (t.OnKeyUpTrigger = 15), t - }(n(79).a) - , w = function(e) { - function t(t, i, n) { - var r = e.call(this, t, n) || this; - return r._sound = i, - r - } - return h.d(t, e), - t.prototype._prepare = function() {} - , - t.prototype.execute = function() { - void 0 !== this._sound && this._sound.play() - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "PlaySoundAction", - properties: [{ - name: "sound", - value: this._sound.name - }] - }, t) - } - , + ); + })(n(79).a), + w = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, n) || this; + return (r._sound = i), r; + } + return ( + h.d(t, e), + (t.prototype._prepare = function () {}), + (t.prototype.execute = function () { + void 0 !== this._sound && this._sound.play(); + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "PlaySoundAction", + properties: [ + { + name: "sound", + value: this._sound.name, + }, + ], + }, + t + ); + }), t - }(u) - , I = function(e) { - function t(t, i, n) { - var r = e.call(this, t, n) || this; - return r._sound = i, - r - } - return h.d(t, e), - t.prototype._prepare = function() {} - , - t.prototype.execute = function() { - void 0 !== this._sound && this._sound.stop() - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "StopSoundAction", - properties: [{ - name: "sound", - value: this._sound.name - }] - }, t) - } - , + ); + })(u), + I = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, n) || this; + return (r._sound = i), r; + } + return ( + h.d(t, e), + (t.prototype._prepare = function () {}), + (t.prototype.execute = function () { + void 0 !== this._sound && this._sound.stop(); + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "StopSoundAction", + properties: [ + { + name: "sound", + value: this._sound.name, + }, + ], + }, + t + ); + }), t - }(u); - s.a.RegisteredTypes["BABYLON.PlaySoundAction"] = I, - s.a.RegisteredTypes["BABYLON.StopSoundAction"] = I; - var D, L = n(12), F = n(2); - !function(e) { - e[e.STEP = 1] = "STEP" - }(D || (D = {})); - var B = function() { - function e(e, t, i) { - this.name = e, - this.from = t, - this.to = i - } - return e.prototype.clone = function() { - return new e(this.name,this.from,this.to) - } - , + ); + })(u); + (s.a.RegisteredTypes["BABYLON.PlaySoundAction"] = I), + (s.a.RegisteredTypes["BABYLON.StopSoundAction"] = I); + var D, + L = n(12), + F = n(2); + !(function (e) { + e[(e.STEP = 1)] = "STEP"; + })(D || (D = {})); + var B = (function () { + function e(e, t, i) { + (this.name = e), (this.from = t), (this.to = i); + } + return ( + (e.prototype.clone = function () { + return new e(this.name, this.from, this.to); + }), e - }() - , N = n(25) - , k = function() {} - , U = function() { - function e(t, i, n, r, o, a) { - this.name = t, - this.targetProperty = i, - this.framePerSecond = n, - this.dataType = r, - this.loopMode = o, - this.enableBlending = a, - this._runtimeAnimations = new Array, - this._events = new Array, - this.blendingSpeed = .01, - this._ranges = {}, - this.targetPropertyPath = i.split("."), - this.dataType = r, - this.loopMode = void 0 === o ? e.ANIMATIONLOOPMODE_CYCLE : o - } - return e._PrepareAnimation = function(t, i, n, r, o, s, c, u) { - var l = void 0; - if (!isNaN(parseFloat(o)) && isFinite(o) ? l = e.ANIMATIONTYPE_FLOAT : o instanceof a.q ? l = e.ANIMATIONTYPE_QUATERNION : o instanceof a.x ? l = e.ANIMATIONTYPE_VECTOR3 : o instanceof a.w ? l = e.ANIMATIONTYPE_VECTOR2 : o instanceof a.e ? l = e.ANIMATIONTYPE_COLOR3 : o instanceof a.r && (l = e.ANIMATIONTYPE_SIZE), + ); + })(), + N = n(25), + k = function () {}, + U = (function () { + function e(t, i, n, r, o, a) { + (this.name = t), + (this.targetProperty = i), + (this.framePerSecond = n), + (this.dataType = r), + (this.loopMode = o), + (this.enableBlending = a), + (this._runtimeAnimations = new Array()), + (this._events = new Array()), + (this.blendingSpeed = 0.01), + (this._ranges = {}), + (this.targetPropertyPath = i.split(".")), + (this.dataType = r), + (this.loopMode = + void 0 === o ? e.ANIMATIONLOOPMODE_CYCLE : o); + } + return ( + (e._PrepareAnimation = function (t, i, n, r, o, s, c, u) { + var l = void 0; + if ( + (!isNaN(parseFloat(o)) && isFinite(o) + ? (l = e.ANIMATIONTYPE_FLOAT) + : o instanceof a.q + ? (l = e.ANIMATIONTYPE_QUATERNION) + : o instanceof a.x + ? (l = e.ANIMATIONTYPE_VECTOR3) + : o instanceof a.w + ? (l = e.ANIMATIONTYPE_VECTOR2) + : o instanceof a.e + ? (l = e.ANIMATIONTYPE_COLOR3) + : o instanceof a.r && (l = e.ANIMATIONTYPE_SIZE), null == l) - return null; - var h = new e(t,i,n,l,c) - , f = [{ + ) + return null; + var h = new e(t, i, n, l, c), + f = [ + { frame: 0, - value: o - }, { + value: o, + }, + { frame: r, - value: s - }]; - return h.setKeys(f), - void 0 !== u && h.setEasingFunction(u), - h - } - , - e.CreateAnimation = function(t, i, n, r) { - var o = new e(t + "Animation",t,n,i,e.ANIMATIONLOOPMODE_CONSTANT); - return o.setEasingFunction(r), - o - } - , - e.CreateAndStartAnimation = function(t, i, n, r, o, a, s, c, u, l) { - var h = e._PrepareAnimation(t, n, r, o, a, s, c, u); - return h ? i.getScene().beginDirectAnimation(i, [h], 0, o, 1 === h.loopMode, 1, l) : null - } - , - e.CreateAndStartHierarchyAnimation = function(t, i, n, r, o, a, s, c, u, l, h) { - var f = e._PrepareAnimation(t, r, o, a, s, c, u, l); - return f ? i.getScene().beginDirectHierarchyAnimation(i, n, [f], 0, a, 1 === f.loopMode, 1, h) : null - } - , - e.CreateMergeAndStartAnimation = function(t, i, n, r, o, a, s, c, u, l) { - var h = e._PrepareAnimation(t, n, r, o, a, s, c, u); - return h ? (i.animations.push(h), - i.getScene().beginAnimation(i, 0, o, 1 === h.loopMode, 1, l)) : null - } - , - e.TransitionTo = function(e, t, i, n, r, o, a, s) { - if (void 0 === s && (s = null), - a <= 0) - return i[e] = t, - s && s(), - null; - var c = r * (a / 1e3); - o.setKeys([{ - frame: 0, - value: i[e].clone ? i[e].clone() : i[e] - }, { - frame: c, - value: t - }]), + value: s, + }, + ]; + return ( + h.setKeys(f), void 0 !== u && h.setEasingFunction(u), h + ); + }), + (e.CreateAnimation = function (t, i, n, r) { + var o = new e( + t + "Animation", + t, + n, + i, + e.ANIMATIONLOOPMODE_CONSTANT + ); + return o.setEasingFunction(r), o; + }), + (e.CreateAndStartAnimation = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u, + l + ) { + var h = e._PrepareAnimation(t, n, r, o, a, s, c, u); + return h + ? i + .getScene() + .beginDirectAnimation( + i, + [h], + 0, + o, + 1 === h.loopMode, + 1, + l + ) + : null; + }), + (e.CreateAndStartHierarchyAnimation = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u, + l, + h + ) { + var f = e._PrepareAnimation(t, r, o, a, s, c, u, l); + return f + ? i + .getScene() + .beginDirectHierarchyAnimation( + i, + n, + [f], + 0, + a, + 1 === f.loopMode, + 1, + h + ) + : null; + }), + (e.CreateMergeAndStartAnimation = function ( + t, + i, + n, + r, + o, + a, + s, + c, + u, + l + ) { + var h = e._PrepareAnimation(t, n, r, o, a, s, c, u); + return h + ? (i.animations.push(h), + i + .getScene() + .beginAnimation(i, 0, o, 1 === h.loopMode, 1, l)) + : null; + }), + (e.TransitionTo = function (e, t, i, n, r, o, a, s) { + if ((void 0 === s && (s = null), a <= 0)) + return (i[e] = t), s && s(), null; + var c = r * (a / 1e3); + o.setKeys([ + { + frame: 0, + value: i[e].clone ? i[e].clone() : i[e], + }, + { + frame: c, + value: t, + }, + ]), i.animations || (i.animations = []), i.animations.push(o); - var u = n.beginAnimation(i, 0, c, false); - return u.onAnimationEnd = s, - u - } - , + var u = n.beginAnimation(i, 0, c, false); + return (u.onAnimationEnd = s), u; + }), Object.defineProperty(e.prototype, "runtimeAnimations", { - get: function() { - return this._runtimeAnimations + get: function () { + return this._runtimeAnimations; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "hasRunningRuntimeAnimations", + { + get: function () { + for ( + var e = 0, t = this._runtimeAnimations; + e < t.length; + e++ + ) + if (!t[e].isStopped) return true; + return false; }, enumerable: true, - configurable: true + configurable: true, + } + ), + (e.prototype.toString = function (e) { + var t = + "Name: " + + this.name + + ", property: " + + this.targetProperty; + if ( + ((t += + ", datatype: " + + [ + "Float", + "Vector3", + "Quaternion", + "Matrix", + "Color3", + "Vector2", + ][this.dataType]), + (t += + ", nKeys: " + + (this._keys ? this._keys.length : "none")), + (t += + ", nRanges: " + + (this._ranges + ? Object.keys(this._ranges).length + : "none")), + e) + ) { + t += ", Ranges: {"; + var i = true; + for (var n in this._ranges) + i && ((t += ", "), (i = false)), (t += n); + t += "}"; + } + return t; }), - Object.defineProperty(e.prototype, "hasRunningRuntimeAnimations", { - get: function() { - for (var e = 0, t = this._runtimeAnimations; e < t.length; e++) - if (!t[e].isStopped) - return true; - return false - }, - enumerable: true, - configurable: true + (e.prototype.addEvent = function (e) { + this._events.push(e); }), - e.prototype.toString = function(e) { - var t = "Name: " + this.name + ", property: " + this.targetProperty; - if (t += ", datatype: " + ["Float", "Vector3", "Quaternion", "Matrix", "Color3", "Vector2"][this.dataType], - t += ", nKeys: " + (this._keys ? this._keys.length : "none"), - t += ", nRanges: " + (this._ranges ? Object.keys(this._ranges).length : "none"), - e) { - t += ", Ranges: {"; - var i = true; - for (var n in this._ranges) - i && (t += ", ", - i = false), - t += n; - t += "}" + (e.prototype.removeEvents = function (e) { + for (var t = 0; t < this._events.length; t++) + this._events[t].frame === e && + (this._events.splice(t, 1), t--); + }), + (e.prototype.getEvents = function () { + return this._events; + }), + (e.prototype.createRange = function (e, t, i) { + this._ranges[e] || (this._ranges[e] = new B(e, t, i)); + }), + (e.prototype.deleteRange = function (e, t) { + void 0 === t && (t = true); + var i = this._ranges[e]; + if (i) { + if (t) + for ( + var n = i.from, r = i.to, o = this._keys.length - 1; + o >= 0; + o-- + ) + this._keys[o].frame >= n && + this._keys[o].frame <= r && + this._keys.splice(o, 1); + this._ranges[e] = null; + } + }), + (e.prototype.getRange = function (e) { + return this._ranges[e]; + }), + (e.prototype.getKeys = function () { + return this._keys; + }), + (e.prototype.getHighestFrame = function () { + for (var e = 0, t = 0, i = this._keys.length; t < i; t++) + e < this._keys[t].frame && (e = this._keys[t].frame); + return e; + }), + (e.prototype.getEasingFunction = function () { + return this._easingFunction; + }), + (e.prototype.setEasingFunction = function (e) { + this._easingFunction = e; + }), + (e.prototype.floatInterpolateFunction = function (e, t, i) { + return L.a.Lerp(e, t, i); + }), + (e.prototype.floatInterpolateFunctionWithTangents = + function (e, t, i, n, r) { + return L.a.Hermite(e, t, i, n, r); + }), + (e.prototype.quaternionInterpolateFunction = function ( + e, + t, + i + ) { + return a.q.Slerp(e, t, i); + }), + (e.prototype.quaternionInterpolateFunctionWithTangents = + function (e, t, i, n, r) { + return a.q.Hermite(e, t, i, n, r).normalize(); + }), + (e.prototype.vector3InterpolateFunction = function ( + e, + t, + i + ) { + return a.x.Lerp(e, t, i); + }), + (e.prototype.vector3InterpolateFunctionWithTangents = + function (e, t, i, n, r) { + return a.x.Hermite(e, t, i, n, r); + }), + (e.prototype.vector2InterpolateFunction = function ( + e, + t, + i + ) { + return a.w.Lerp(e, t, i); + }), + (e.prototype.vector2InterpolateFunctionWithTangents = + function (e, t, i, n, r) { + return a.w.Hermite(e, t, i, n, r); + }), + (e.prototype.sizeInterpolateFunction = function (e, t, i) { + return a.r.Lerp(e, t, i); + }), + (e.prototype.color3InterpolateFunction = function ( + e, + t, + i + ) { + return a.e.Lerp(e, t, i); + }), + (e.prototype._getKeyValue = function (e) { + return "function" == typeof e ? e() : e; + }), + (e.prototype._interpolate = function (t, i) { + if ( + i.loopMode === e.ANIMATIONLOOPMODE_CONSTANT && + i.repeatCount > 0 + ) + return i.highLimitValue.clone + ? i.highLimitValue.clone() + : i.highLimitValue; + var n = this._keys; + if (1 === n.length) return this._getKeyValue(n[0].value); + var r = i.key; + if (n[r].frame >= t) + for (; r - 1 >= 0 && n[r].frame >= t; ) r--; + for (var o = r; o < n.length; o++) { + var a = n[o + 1]; + if (a.frame >= t) { + i.key = o; + var s = n[o], + c = this._getKeyValue(s.value); + if (s.interpolation === D.STEP) return c; + var u = this._getKeyValue(a.value), + l = + void 0 !== s.outTangent && void 0 !== a.inTangent, + h = a.frame - s.frame, + f = (t - s.frame) / h, + d = this.getEasingFunction(); + switch ( + (null != d && (f = d.ease(f)), this.dataType) + ) { + case e.ANIMATIONTYPE_FLOAT: + var p = l + ? this.floatInterpolateFunctionWithTangents( + c, + s.outTangent * h, + u, + a.inTangent * h, + f + ) + : this.floatInterpolateFunction(c, u, f); + switch (i.loopMode) { + case e.ANIMATIONLOOPMODE_CYCLE: + case e.ANIMATIONLOOPMODE_CONSTANT: + return p; + case e.ANIMATIONLOOPMODE_RELATIVE: + return i.offsetValue * i.repeatCount + p; + } + break; + case e.ANIMATIONTYPE_QUATERNION: + var m = l + ? this.quaternionInterpolateFunctionWithTangents( + c, + s.outTangent.scale(h), + u, + a.inTangent.scale(h), + f + ) + : this.quaternionInterpolateFunction(c, u, f); + switch (i.loopMode) { + case e.ANIMATIONLOOPMODE_CYCLE: + case e.ANIMATIONLOOPMODE_CONSTANT: + return m; + case e.ANIMATIONLOOPMODE_RELATIVE: + return m.addInPlace( + i.offsetValue.scale(i.repeatCount) + ); + } + return m; + case e.ANIMATIONTYPE_VECTOR3: + var g = l + ? this.vector3InterpolateFunctionWithTangents( + c, + s.outTangent.scale(h), + u, + a.inTangent.scale(h), + f + ) + : this.vector3InterpolateFunction(c, u, f); + switch (i.loopMode) { + case e.ANIMATIONLOOPMODE_CYCLE: + case e.ANIMATIONLOOPMODE_CONSTANT: + return g; + case e.ANIMATIONLOOPMODE_RELATIVE: + return g.add( + i.offsetValue.scale(i.repeatCount) + ); + } + case e.ANIMATIONTYPE_VECTOR2: + var _ = l + ? this.vector2InterpolateFunctionWithTangents( + c, + s.outTangent.scale(h), + u, + a.inTangent.scale(h), + f + ) + : this.vector2InterpolateFunction(c, u, f); + switch (i.loopMode) { + case e.ANIMATIONLOOPMODE_CYCLE: + case e.ANIMATIONLOOPMODE_CONSTANT: + return _; + case e.ANIMATIONLOOPMODE_RELATIVE: + return _.add( + i.offsetValue.scale(i.repeatCount) + ); + } + case e.ANIMATIONTYPE_SIZE: + switch (i.loopMode) { + case e.ANIMATIONLOOPMODE_CYCLE: + case e.ANIMATIONLOOPMODE_CONSTANT: + return this.sizeInterpolateFunction(c, u, f); + case e.ANIMATIONLOOPMODE_RELATIVE: + return this.sizeInterpolateFunction( + c, + u, + f + ).add(i.offsetValue.scale(i.repeatCount)); + } + case e.ANIMATIONTYPE_COLOR3: + switch (i.loopMode) { + case e.ANIMATIONLOOPMODE_CYCLE: + case e.ANIMATIONLOOPMODE_CONSTANT: + return this.color3InterpolateFunction( + c, + u, + f + ); + case e.ANIMATIONLOOPMODE_RELATIVE: + return this.color3InterpolateFunction( + c, + u, + f + ).add(i.offsetValue.scale(i.repeatCount)); + } + case e.ANIMATIONTYPE_MATRIX: + switch (i.loopMode) { + case e.ANIMATIONLOOPMODE_CYCLE: + case e.ANIMATIONLOOPMODE_CONSTANT: + if (e.AllowMatricesInterpolation) + return this.matrixInterpolateFunction( + c, + u, + f, + i.workValue + ); + case e.ANIMATIONLOOPMODE_RELATIVE: + return c; + } + } + break; } - return t - } - , - e.prototype.addEvent = function(e) { - this._events.push(e) - } - , - e.prototype.removeEvents = function(e) { - for (var t = 0; t < this._events.length; t++) - this._events[t].frame === e && (this._events.splice(t, 1), - t--) - } - , - e.prototype.getEvents = function() { - return this._events - } - , - e.prototype.createRange = function(e, t, i) { - this._ranges[e] || (this._ranges[e] = new B(e,t,i)) - } - , - e.prototype.deleteRange = function(e, t) { - void 0 === t && (t = true); - var i = this._ranges[e]; - if (i) { - if (t) - for (var n = i.from, r = i.to, o = this._keys.length - 1; o >= 0; o--) - this._keys[o].frame >= n && this._keys[o].frame <= r && this._keys.splice(o, 1); - this._ranges[e] = null - } - } - , - e.prototype.getRange = function(e) { - return this._ranges[e] - } - , - e.prototype.getKeys = function() { - return this._keys - } - , - e.prototype.getHighestFrame = function() { - for (var e = 0, t = 0, i = this._keys.length; t < i; t++) - e < this._keys[t].frame && (e = this._keys[t].frame); - return e - } - , - e.prototype.getEasingFunction = function() { - return this._easingFunction - } - , - e.prototype.setEasingFunction = function(e) { - this._easingFunction = e - } - , - e.prototype.floatInterpolateFunction = function(e, t, i) { - return L.a.Lerp(e, t, i) - } - , - e.prototype.floatInterpolateFunctionWithTangents = function(e, t, i, n, r) { - return L.a.Hermite(e, t, i, n, r) - } - , - e.prototype.quaternionInterpolateFunction = function(e, t, i) { - return a.q.Slerp(e, t, i) - } - , - e.prototype.quaternionInterpolateFunctionWithTangents = function(e, t, i, n, r) { - return a.q.Hermite(e, t, i, n, r).normalize() - } - , - e.prototype.vector3InterpolateFunction = function(e, t, i) { - return a.x.Lerp(e, t, i) - } - , - e.prototype.vector3InterpolateFunctionWithTangents = function(e, t, i, n, r) { - return a.x.Hermite(e, t, i, n, r) - } - , - e.prototype.vector2InterpolateFunction = function(e, t, i) { - return a.w.Lerp(e, t, i) - } - , - e.prototype.vector2InterpolateFunctionWithTangents = function(e, t, i, n, r) { - return a.w.Hermite(e, t, i, n, r) - } - , - e.prototype.sizeInterpolateFunction = function(e, t, i) { - return a.r.Lerp(e, t, i) - } - , - e.prototype.color3InterpolateFunction = function(e, t, i) { - return a.e.Lerp(e, t, i) - } - , - e.prototype._getKeyValue = function(e) { - return "function" == typeof e ? e() : e - } - , - e.prototype._interpolate = function(t, i) { - if (i.loopMode === e.ANIMATIONLOOPMODE_CONSTANT && i.repeatCount > 0) - return i.highLimitValue.clone ? i.highLimitValue.clone() : i.highLimitValue; - var n = this._keys; - if (1 === n.length) - return this._getKeyValue(n[0].value); - var r = i.key; - if (n[r].frame >= t) - for (; r - 1 >= 0 && n[r].frame >= t; ) - r--; - for (var o = r; o < n.length; o++) { - var a = n[o + 1]; - if (a.frame >= t) { - i.key = o; - var s = n[o] - , c = this._getKeyValue(s.value); - if (s.interpolation === D.STEP) - return c; - var u = this._getKeyValue(a.value) - , l = void 0 !== s.outTangent && void 0 !== a.inTangent - , h = a.frame - s.frame - , f = (t - s.frame) / h - , d = this.getEasingFunction(); - switch (null != d && (f = d.ease(f)), - this.dataType) { - case e.ANIMATIONTYPE_FLOAT: - var p = l ? this.floatInterpolateFunctionWithTangents(c, s.outTangent * h, u, a.inTangent * h, f) : this.floatInterpolateFunction(c, u, f); - switch (i.loopMode) { - case e.ANIMATIONLOOPMODE_CYCLE: - case e.ANIMATIONLOOPMODE_CONSTANT: - return p; - case e.ANIMATIONLOOPMODE_RELATIVE: - return i.offsetValue * i.repeatCount + p - } - break; - case e.ANIMATIONTYPE_QUATERNION: - var m = l ? this.quaternionInterpolateFunctionWithTangents(c, s.outTangent.scale(h), u, a.inTangent.scale(h), f) : this.quaternionInterpolateFunction(c, u, f); - switch (i.loopMode) { - case e.ANIMATIONLOOPMODE_CYCLE: - case e.ANIMATIONLOOPMODE_CONSTANT: - return m; - case e.ANIMATIONLOOPMODE_RELATIVE: - return m.addInPlace(i.offsetValue.scale(i.repeatCount)) - } - return m; - case e.ANIMATIONTYPE_VECTOR3: - var g = l ? this.vector3InterpolateFunctionWithTangents(c, s.outTangent.scale(h), u, a.inTangent.scale(h), f) : this.vector3InterpolateFunction(c, u, f); - switch (i.loopMode) { - case e.ANIMATIONLOOPMODE_CYCLE: - case e.ANIMATIONLOOPMODE_CONSTANT: - return g; - case e.ANIMATIONLOOPMODE_RELATIVE: - return g.add(i.offsetValue.scale(i.repeatCount)) - } - case e.ANIMATIONTYPE_VECTOR2: - var _ = l ? this.vector2InterpolateFunctionWithTangents(c, s.outTangent.scale(h), u, a.inTangent.scale(h), f) : this.vector2InterpolateFunction(c, u, f); - switch (i.loopMode) { - case e.ANIMATIONLOOPMODE_CYCLE: - case e.ANIMATIONLOOPMODE_CONSTANT: - return _; - case e.ANIMATIONLOOPMODE_RELATIVE: - return _.add(i.offsetValue.scale(i.repeatCount)) - } - case e.ANIMATIONTYPE_SIZE: - switch (i.loopMode) { - case e.ANIMATIONLOOPMODE_CYCLE: - case e.ANIMATIONLOOPMODE_CONSTANT: - return this.sizeInterpolateFunction(c, u, f); - case e.ANIMATIONLOOPMODE_RELATIVE: - return this.sizeInterpolateFunction(c, u, f).add(i.offsetValue.scale(i.repeatCount)) - } - case e.ANIMATIONTYPE_COLOR3: - switch (i.loopMode) { - case e.ANIMATIONLOOPMODE_CYCLE: - case e.ANIMATIONLOOPMODE_CONSTANT: - return this.color3InterpolateFunction(c, u, f); - case e.ANIMATIONLOOPMODE_RELATIVE: - return this.color3InterpolateFunction(c, u, f).add(i.offsetValue.scale(i.repeatCount)) - } - case e.ANIMATIONTYPE_MATRIX: - switch (i.loopMode) { - case e.ANIMATIONLOOPMODE_CYCLE: - case e.ANIMATIONLOOPMODE_CONSTANT: - if (e.AllowMatricesInterpolation) - return this.matrixInterpolateFunction(c, u, f, i.workValue); - case e.ANIMATIONLOOPMODE_RELATIVE: - return c - } - } - break - } - } - return this._getKeyValue(n[n.length - 1].value) - } - , - e.prototype.matrixInterpolateFunction = function(t, i, n, r) { - return e.AllowMatrixDecomposeForInterpolation ? r ? (a.j.DecomposeLerpToRef(t, i, n, r), - r) : a.j.DecomposeLerp(t, i, n) : r ? (a.j.LerpToRef(t, i, n, r), - r) : a.j.Lerp(t, i, n) - } - , - e.prototype.clone = function() { - var t = new e(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode); - if (t.enableBlending = this.enableBlending, - t.blendingSpeed = this.blendingSpeed, + } + return this._getKeyValue(n[n.length - 1].value); + }), + (e.prototype.matrixInterpolateFunction = function ( + t, + i, + n, + r + ) { + return e.AllowMatrixDecomposeForInterpolation + ? r + ? (a.j.DecomposeLerpToRef(t, i, n, r), r) + : a.j.DecomposeLerp(t, i, n) + : r + ? (a.j.LerpToRef(t, i, n, r), r) + : a.j.Lerp(t, i, n); + }), + (e.prototype.clone = function () { + var t = new e( + this.name, + this.targetPropertyPath.join("."), + this.framePerSecond, + this.dataType, + this.loopMode + ); + if ( + ((t.enableBlending = this.enableBlending), + (t.blendingSpeed = this.blendingSpeed), this._keys && t.setKeys(this._keys), this._ranges) - for (var i in t._ranges = {}, - this._ranges) { - var n = this._ranges[i]; - n && (t._ranges[i] = n.clone()) - } - return t - } - , - e.prototype.setKeys = function(e) { - this._keys = e.slice(0) - } - , - e.prototype.serialize = function() { - var t = {}; - t.name = this.name, - t.property = this.targetProperty, - t.framePerSecond = this.framePerSecond, - t.dataType = this.dataType, - t.loopBehavior = this.loopMode, - t.enableBlending = this.enableBlending, - t.blendingSpeed = this.blendingSpeed; - var i = this.dataType; - t.keys = []; - for (var n = this.getKeys(), r = 0; r < n.length; r++) { - var o = n[r] - , a = {}; - switch (a.frame = o.frame, - i) { - case e.ANIMATIONTYPE_FLOAT: - a.values = [o.value]; - break; - case e.ANIMATIONTYPE_QUATERNION: - case e.ANIMATIONTYPE_MATRIX: - case e.ANIMATIONTYPE_VECTOR3: - case e.ANIMATIONTYPE_COLOR3: - a.values = o.value.asArray() - } - t.keys.push(a) + ) + for (var i in ((t._ranges = {}), this._ranges)) { + var n = this._ranges[i]; + n && (t._ranges[i] = n.clone()); } - for (var s in t.ranges = [], - this._ranges) { - var c = this._ranges[s]; - if (c) { - var u = {}; - u.name = s, - u.from = c.from, - u.to = c.to, - t.ranges.push(u) - } + return t; + }), + (e.prototype.setKeys = function (e) { + this._keys = e.slice(0); + }), + (e.prototype.serialize = function () { + var t = {}; + (t.name = this.name), + (t.property = this.targetProperty), + (t.framePerSecond = this.framePerSecond), + (t.dataType = this.dataType), + (t.loopBehavior = this.loopMode), + (t.enableBlending = this.enableBlending), + (t.blendingSpeed = this.blendingSpeed); + var i = this.dataType; + t.keys = []; + for (var n = this.getKeys(), r = 0; r < n.length; r++) { + var o = n[r], + a = {}; + switch (((a.frame = o.frame), i)) { + case e.ANIMATIONTYPE_FLOAT: + a.values = [o.value]; + break; + case e.ANIMATIONTYPE_QUATERNION: + case e.ANIMATIONTYPE_MATRIX: + case e.ANIMATIONTYPE_VECTOR3: + case e.ANIMATIONTYPE_COLOR3: + a.values = o.value.asArray(); } - return t - } - , + t.keys.push(a); + } + for (var s in ((t.ranges = []), this._ranges)) { + var c = this._ranges[s]; + if (c) { + var u = {}; + (u.name = s), + (u.from = c.from), + (u.to = c.to), + t.ranges.push(u); + } + } + return t; + }), Object.defineProperty(e, "ANIMATIONTYPE_FLOAT", { - get: function() { - return e._ANIMATIONTYPE_FLOAT - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONTYPE_FLOAT; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONTYPE_VECTOR3", { - get: function() { - return e._ANIMATIONTYPE_VECTOR3 - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONTYPE_VECTOR3; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONTYPE_VECTOR2", { - get: function() { - return e._ANIMATIONTYPE_VECTOR2 - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONTYPE_VECTOR2; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONTYPE_SIZE", { - get: function() { - return e._ANIMATIONTYPE_SIZE - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONTYPE_SIZE; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONTYPE_QUATERNION", { - get: function() { - return e._ANIMATIONTYPE_QUATERNION - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONTYPE_QUATERNION; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONTYPE_MATRIX", { - get: function() { - return e._ANIMATIONTYPE_MATRIX - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONTYPE_MATRIX; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONTYPE_COLOR3", { - get: function() { - return e._ANIMATIONTYPE_COLOR3 - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONTYPE_COLOR3; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONLOOPMODE_RELATIVE", { - get: function() { - return e._ANIMATIONLOOPMODE_RELATIVE - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONLOOPMODE_RELATIVE; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONLOOPMODE_CYCLE", { - get: function() { - return e._ANIMATIONLOOPMODE_CYCLE - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONLOOPMODE_CYCLE; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "ANIMATIONLOOPMODE_CONSTANT", { - get: function() { - return e._ANIMATIONLOOPMODE_CONSTANT - }, - enumerable: true, - configurable: true + get: function () { + return e._ANIMATIONLOOPMODE_CONSTANT; + }, + enumerable: true, + configurable: true, }), - e._UniversalLerp = function(e, t, i) { - var n = e.constructor; - return n.Lerp ? n.Lerp(e, t, i) : n.Slerp ? n.Slerp(e, t, i) : e.toFixed ? e * (1 - i) + i * t : t - } - , - e.Parse = function(t) { - var i, n, r = new e(t.name,t.property,t.framePerSecond,t.dataType,t.loopBehavior), o = t.dataType, s = []; - for (t.enableBlending && (r.enableBlending = t.enableBlending), - t.blendingSpeed && (r.blendingSpeed = t.blendingSpeed), - n = 0; n < t.keys.length; n++) { - var c, u, l = t.keys[n]; - switch (o) { - case e.ANIMATIONTYPE_FLOAT: - i = l.values[0], - l.values.length >= 1 && (c = l.values[1]), - l.values.length >= 2 && (u = l.values[2]); - break; - case e.ANIMATIONTYPE_QUATERNION: - if (i = a.q.FromArray(l.values), - l.values.length >= 8) { - var h = a.q.FromArray(l.values.slice(4, 8)); - h.equals(a.q.Zero()) || (c = h) - } - if (l.values.length >= 12) { - var f = a.q.FromArray(l.values.slice(8, 12)); - f.equals(a.q.Zero()) || (u = f) - } - break; - case e.ANIMATIONTYPE_MATRIX: - i = a.j.FromArray(l.values); - break; - case e.ANIMATIONTYPE_COLOR3: - i = a.e.FromArray(l.values); - break; - case e.ANIMATIONTYPE_VECTOR3: - default: - i = a.x.FromArray(l.values) + (e._UniversalLerp = function (e, t, i) { + var n = e.constructor; + return n.Lerp + ? n.Lerp(e, t, i) + : n.Slerp + ? n.Slerp(e, t, i) + : e.toFixed + ? e * (1 - i) + i * t + : t; + }), + (e.Parse = function (t) { + var i, + n, + r = new e( + t.name, + t.property, + t.framePerSecond, + t.dataType, + t.loopBehavior + ), + o = t.dataType, + s = []; + for ( + t.enableBlending && + (r.enableBlending = t.enableBlending), + t.blendingSpeed && + (r.blendingSpeed = t.blendingSpeed), + n = 0; + n < t.keys.length; + n++ + ) { + var c, + u, + l = t.keys[n]; + switch (o) { + case e.ANIMATIONTYPE_FLOAT: + (i = l.values[0]), + l.values.length >= 1 && (c = l.values[1]), + l.values.length >= 2 && (u = l.values[2]); + break; + case e.ANIMATIONTYPE_QUATERNION: + if ( + ((i = a.q.FromArray(l.values)), + l.values.length >= 8) + ) { + var h = a.q.FromArray(l.values.slice(4, 8)); + h.equals(a.q.Zero()) || (c = h); } - var d = {}; - d.frame = l.frame, - d.value = i, - null != c && (d.inTangent = c), - null != u && (d.outTangent = u), - s.push(d) + if (l.values.length >= 12) { + var f = a.q.FromArray(l.values.slice(8, 12)); + f.equals(a.q.Zero()) || (u = f); + } + break; + case e.ANIMATIONTYPE_MATRIX: + i = a.j.FromArray(l.values); + break; + case e.ANIMATIONTYPE_COLOR3: + i = a.e.FromArray(l.values); + break; + case e.ANIMATIONTYPE_VECTOR3: + default: + i = a.x.FromArray(l.values); } - if (r.setKeys(s), - t.ranges) - for (n = 0; n < t.ranges.length; n++) - i = t.ranges[n], - r.createRange(i.name, i.from, i.to); - return r - } - , - e.AppendSerializedAnimations = function(e, t) { - F.a.AppendSerializedAnimations(e, t) - } - , - e.AllowMatricesInterpolation = false, - e.AllowMatrixDecomposeForInterpolation = true, - e._ANIMATIONTYPE_FLOAT = 0, - e._ANIMATIONTYPE_VECTOR3 = 1, - e._ANIMATIONTYPE_QUATERNION = 2, - e._ANIMATIONTYPE_MATRIX = 3, - e._ANIMATIONTYPE_COLOR3 = 4, - e._ANIMATIONTYPE_VECTOR2 = 5, - e._ANIMATIONTYPE_SIZE = 6, - e._ANIMATIONLOOPMODE_RELATIVE = 0, - e._ANIMATIONLOOPMODE_CYCLE = 1, - e._ANIMATIONLOOPMODE_CONSTANT = 2, + var d = {}; + (d.frame = l.frame), + (d.value = i), + null != c && (d.inTangent = c), + null != u && (d.outTangent = u), + s.push(d); + } + if ((r.setKeys(s), t.ranges)) + for (n = 0; n < t.ranges.length; n++) + (i = t.ranges[n]), + r.createRange(i.name, i.from, i.to); + return r; + }), + (e.AppendSerializedAnimations = function (e, t) { + F.a.AppendSerializedAnimations(e, t); + }), + (e.AllowMatricesInterpolation = false), + (e.AllowMatrixDecomposeForInterpolation = true), + (e._ANIMATIONTYPE_FLOAT = 0), + (e._ANIMATIONTYPE_VECTOR3 = 1), + (e._ANIMATIONTYPE_QUATERNION = 2), + (e._ANIMATIONTYPE_MATRIX = 3), + (e._ANIMATIONTYPE_COLOR3 = 4), + (e._ANIMATIONTYPE_VECTOR2 = 5), + (e._ANIMATIONTYPE_SIZE = 6), + (e._ANIMATIONLOOPMODE_RELATIVE = 0), + (e._ANIMATIONLOOPMODE_CYCLE = 1), + (e._ANIMATIONLOOPMODE_CONSTANT = 2), e - }(); - s.a.RegisteredTypes["BABYLON.Animation"] = U, - N.a._AnimationRangeFactory = function(e, t, i) { - return new B(e,t,i) + ); + })(); + (s.a.RegisteredTypes["BABYLON.Animation"] = U), + (N.a._AnimationRangeFactory = function (e, t, i) { + return new B(e, t, i); + }); + var V = (function (e) { + function t(t, i, n, r, a, s, c, u) { + void 0 === a && (a = 1e3); + var l = e.call(this, t, s) || this; + return ( + (l.duration = 1e3), + (l.onInterpolationDoneObservable = new o.c()), + (l.propertyPath = n), + (l.value = r), + (l.duration = a), + (l.stopOtherAnimations = c), + (l.onInterpolationDone = u), + (l._target = l._effectiveTarget = i), + l + ); } - ; - var V = function(e) { - function t(t, i, n, r, a, s, c, u) { - void 0 === a && (a = 1e3); - var l = e.call(this, t, s) || this; - return l.duration = 1e3, - l.onInterpolationDoneObservable = new o.c, - l.propertyPath = n, - l.value = r, - l.duration = a, - l.stopOtherAnimations = c, - l.onInterpolationDone = u, - l._target = l._effectiveTarget = i, - l - } - return h.d(t, e), - t.prototype._prepare = function() { - this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath), - this._property = this._getProperty(this.propertyPath) - } - , - t.prototype.execute = function() { - var e, t = this, i = this._actionManager.getScene(), n = [{ - frame: 0, - value: this._effectiveTarget[this._property] - }, { - frame: 100, - value: this.value - }]; - if ("number" == typeof this.value) - e = U.ANIMATIONTYPE_FLOAT; - else if (this.value instanceof a.e) - e = U.ANIMATIONTYPE_COLOR3; - else if (this.value instanceof a.x) - e = U.ANIMATIONTYPE_VECTOR3; - else if (this.value instanceof a.j) - e = U.ANIMATIONTYPE_MATRIX; - else { - if (!(this.value instanceof a.q)) - return void g.a.Warn("InterpolateValueAction: Unsupported type (" + c(this.value) + ")"); - e = U.ANIMATIONTYPE_QUATERNION - } - var r = new U("InterpolateValueAction",this._property,1e3 / this.duration * 100,e,U.ANIMATIONLOOPMODE_CONSTANT); - r.setKeys(n), - this.stopOtherAnimations && i.stopAnimation(this._effectiveTarget), - i.beginDirectAnimation(this._effectiveTarget, [r], 0, 100, false, 1, function() { - t.onInterpolationDoneObservable.notifyObservers(t), - t.onInterpolationDone && t.onInterpolationDone() - }) - } - , - t.prototype.serialize = function(t) { - return e.prototype._serialize.call(this, { - name: "InterpolateValueAction", - properties: [u._GetTargetProperty(this._target), { - name: "propertyPath", - value: this.propertyPath - }, { - name: "value", - value: u._SerializeValueAsString(this.value) - }, { - name: "duration", - value: u._SerializeValueAsString(this.duration) - }, { - name: "stopOtherAnimations", - value: u._SerializeValueAsString(this.stopOtherAnimations) || false - }] - }, t) - } - , - t - }(u); - s.a.RegisteredTypes["BABYLON.InterpolateValueAction"] = V; - var G = Object.freeze(new a.q(0,0,0,0)) - , z = Object.freeze(a.x.Zero()) - , j = Object.freeze(a.w.Zero()) - , H = Object.freeze(a.r.Zero()) - , W = Object.freeze(a.e.Black()) - , X = function() { - function e(e, t, i, n) { - var r = this; - if (this._events = new Array, - this._currentFrame = 0, - this._originalValue = new Array, - this._originalBlendValue = null, - this._offsetsCache = {}, - this._highLimitsCache = {}, - this._stopped = false, - this._blendingFactor = 0, - this._currentValue = null, - this._currentActiveTarget = null, - this._directTarget = null, - this._targetPath = "", - this._weight = 1, - this._ratioOffset = 0, - this._previousDelay = 0, - this._previousRatio = 0, - this._targetIsArray = false, - this._animation = t, - this._target = e, - this._scene = i, - this._host = n, - this._activeTargets = [], - t._runtimeAnimations.push(this), - this._animationState = { - key: 0, - repeatCount: 0, - loopMode: this._getCorrectLoopMode() + return ( + h.d(t, e), + (t.prototype._prepare = function () { + (this._effectiveTarget = this._getEffectiveTarget( + this._effectiveTarget, + this.propertyPath + )), + (this._property = this._getProperty(this.propertyPath)); + }), + (t.prototype.execute = function () { + var e, + t = this, + i = this._actionManager.getScene(), + n = [ + { + frame: 0, + value: this._effectiveTarget[this._property], }, - this._animation.dataType === U.ANIMATIONTYPE_MATRIX && (this._animationState.workValue = a.j.Zero()), - this._keys = this._animation.getKeys(), - this._minFrame = this._keys[0].frame, - this._maxFrame = this._keys[this._keys.length - 1].frame, - this._minValue = this._keys[0].value, - this._maxValue = this._keys[this._keys.length - 1].value, - 0 !== this._minFrame) { - var o = { - frame: 0, - value: this._minValue - }; - this._keys.splice(0, 0, o) - } - if (this._target instanceof Array) { - for (var s = 0, c = 0, u = this._target; c < u.length; c++) { - var l = u[c]; - this._preparePath(l, s), - this._getOriginalValues(s), - s++ - } - this._targetIsArray = true - } else - this._preparePath(this._target), - this._getOriginalValues(), - this._targetIsArray = false, - this._directTarget = this._activeTargets[0]; - var h = t.getEvents(); - h && h.length > 0 && h.forEach(function(e) { - r._events.push(e._clone()) - }), - this._enableBlending = e && e.animationPropertiesOverride ? e.animationPropertiesOverride.enableBlending : this._animation.enableBlending - } - return Object.defineProperty(e.prototype, "currentFrame", { - get: function() { - return this._currentFrame + { + frame: 100, + value: this.value, }, - enumerable: true, - configurable: true + ]; + if ("number" == typeof this.value) + e = U.ANIMATIONTYPE_FLOAT; + else if (this.value instanceof a.e) + e = U.ANIMATIONTYPE_COLOR3; + else if (this.value instanceof a.x) + e = U.ANIMATIONTYPE_VECTOR3; + else if (this.value instanceof a.j) + e = U.ANIMATIONTYPE_MATRIX; + else { + if (!(this.value instanceof a.q)) + return void g.a.Warn( + "InterpolateValueAction: Unsupported type (" + + c(this.value) + + ")" + ); + e = U.ANIMATIONTYPE_QUATERNION; + } + var r = new U( + "InterpolateValueAction", + this._property, + (1e3 / this.duration) * 100, + e, + U.ANIMATIONLOOPMODE_CONSTANT + ); + r.setKeys(n), + this.stopOtherAnimations && + i.stopAnimation(this._effectiveTarget), + i.beginDirectAnimation( + this._effectiveTarget, + [r], + 0, + 100, + false, + 1, + function () { + t.onInterpolationDoneObservable.notifyObservers(t), + t.onInterpolationDone && t.onInterpolationDone(); + } + ); + }), + (t.prototype.serialize = function (t) { + return e.prototype._serialize.call( + this, + { + name: "InterpolateValueAction", + properties: [ + u._GetTargetProperty(this._target), + { + name: "propertyPath", + value: this.propertyPath, + }, + { + name: "value", + value: u._SerializeValueAsString(this.value), + }, + { + name: "duration", + value: u._SerializeValueAsString(this.duration), + }, + { + name: "stopOtherAnimations", + value: + u._SerializeValueAsString( + this.stopOtherAnimations + ) || false, + }, + ], + }, + t + ); + }), + t + ); + })(u); + s.a.RegisteredTypes["BABYLON.InterpolateValueAction"] = V; + var G = Object.freeze(new a.q(0, 0, 0, 0)), + z = Object.freeze(a.x.Zero()), + j = Object.freeze(a.w.Zero()), + H = Object.freeze(a.r.Zero()), + W = Object.freeze(a.e.Black()), + X = (function () { + function e(e, t, i, n) { + var r = this; + if ( + ((this._events = new Array()), + (this._currentFrame = 0), + (this._originalValue = new Array()), + (this._originalBlendValue = null), + (this._offsetsCache = {}), + (this._highLimitsCache = {}), + (this._stopped = false), + (this._blendingFactor = 0), + (this._currentValue = null), + (this._currentActiveTarget = null), + (this._directTarget = null), + (this._targetPath = ""), + (this._weight = 1), + (this._ratioOffset = 0), + (this._previousDelay = 0), + (this._previousRatio = 0), + (this._targetIsArray = false), + (this._animation = t), + (this._target = e), + (this._scene = i), + (this._host = n), + (this._activeTargets = []), + t._runtimeAnimations.push(this), + (this._animationState = { + key: 0, + repeatCount: 0, + loopMode: this._getCorrectLoopMode(), + }), + this._animation.dataType === U.ANIMATIONTYPE_MATRIX && + (this._animationState.workValue = a.j.Zero()), + (this._keys = this._animation.getKeys()), + (this._minFrame = this._keys[0].frame), + (this._maxFrame = + this._keys[this._keys.length - 1].frame), + (this._minValue = this._keys[0].value), + (this._maxValue = + this._keys[this._keys.length - 1].value), + 0 !== this._minFrame) + ) { + var o = { + frame: 0, + value: this._minValue, + }; + this._keys.splice(0, 0, o); + } + if (this._target instanceof Array) { + for ( + var s = 0, c = 0, u = this._target; + c < u.length; + c++ + ) { + var l = u[c]; + this._preparePath(l, s), + this._getOriginalValues(s), + s++; + } + this._targetIsArray = true; + } else + this._preparePath(this._target), + this._getOriginalValues(), + (this._targetIsArray = false), + (this._directTarget = this._activeTargets[0]); + var h = t.getEvents(); + h && + h.length > 0 && + h.forEach(function (e) { + r._events.push(e._clone()); + }), + (this._enableBlending = + e && e.animationPropertiesOverride + ? e.animationPropertiesOverride.enableBlending + : this._animation.enableBlending); + } + return ( + Object.defineProperty(e.prototype, "currentFrame", { + get: function () { + return this._currentFrame; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "weight", { - get: function() { - return this._weight - }, - enumerable: true, - configurable: true + get: function () { + return this._weight; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "currentValue", { - get: function() { - return this._currentValue - }, - enumerable: true, - configurable: true + get: function () { + return this._currentValue; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "targetPath", { - get: function() { - return this._targetPath - }, - enumerable: true, - configurable: true + get: function () { + return this._targetPath; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "target", { - get: function() { - return this._currentActiveTarget - }, - enumerable: true, - configurable: true + get: function () { + return this._currentActiveTarget; + }, + enumerable: true, + configurable: true, + }), + (e.prototype._preparePath = function (e, t) { + void 0 === t && (t = 0); + var i = this._animation.targetPropertyPath; + if (i.length > 1) { + for (var n = e[i[0]], r = 1; r < i.length - 1; r++) + n = n[i[r]]; + (this._targetPath = i[i.length - 1]), + (this._activeTargets[t] = n); + } else + (this._targetPath = i[0]), (this._activeTargets[t] = e); }), - e.prototype._preparePath = function(e, t) { - void 0 === t && (t = 0); - var i = this._animation.targetPropertyPath; - if (i.length > 1) { - for (var n = e[i[0]], r = 1; r < i.length - 1; r++) - n = n[i[r]]; - this._targetPath = i[i.length - 1], - this._activeTargets[t] = n - } else - this._targetPath = i[0], - this._activeTargets[t] = e - } - , Object.defineProperty(e.prototype, "animation", { - get: function() { - return this._animation - }, - enumerable: true, - configurable: true + get: function () { + return this._animation; + }, + enumerable: true, + configurable: true, }), - e.prototype.reset = function(e) { - if (void 0 === e && (e = false), - e) - if (this._target instanceof Array) - for (var t = 0, i = 0, n = this._target; i < n.length; i++) { - var r = n[i]; - void 0 !== this._originalValue[t] && this._setValue(r, this._activeTargets[t], this._originalValue[t], -1, t), - t++ - } - else - void 0 !== this._originalValue[0] && this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0); - for (this._offsetsCache = {}, - this._highLimitsCache = {}, - this._currentFrame = 0, - this._blendingFactor = 0, - t = 0; t < this._events.length; t++) - this._events[t].isDone = false - } - , - e.prototype.isStopped = function() { - return this._stopped - } - , - e.prototype.dispose = function() { - var e = this._animation.runtimeAnimations.indexOf(this); - e > -1 && this._animation.runtimeAnimations.splice(e, 1) - } - , - e.prototype.setValue = function(e, t) { - if (this._targetIsArray) - for (var i = 0; i < this._target.length; i++) { - var n = this._target[i]; - this._setValue(n, this._activeTargets[i], e, t, i) - } + (e.prototype.reset = function (e) { + if ((void 0 === e && (e = false), e)) + if (this._target instanceof Array) + for ( + var t = 0, i = 0, n = this._target; + i < n.length; + i++ + ) { + var r = n[i]; + void 0 !== this._originalValue[t] && + this._setValue( + r, + this._activeTargets[t], + this._originalValue[t], + -1, + t + ), + t++; + } else - this._setValue(this._target, this._directTarget, e, t, 0) - } - , - e.prototype._getOriginalValues = function(e) { - var t; - void 0 === e && (e = 0); - var i = this._activeTargets[e]; - (t = i.getRestPose && "_matrix" === this._targetPath ? i.getRestPose() : i[this._targetPath]) && t.clone ? this._originalValue[e] = t.clone() : this._originalValue[e] = t - } - , - e.prototype._setValue = function(e, t, i, n, r) { - if (this._currentActiveTarget = t, - this._weight = n, - this._enableBlending && this._blendingFactor <= 1) { - if (!this._originalBlendValue) { - var o = t[this._targetPath]; - o.clone ? this._originalBlendValue = o.clone() : this._originalBlendValue = o - } - this._originalBlendValue.m ? U.AllowMatrixDecomposeForInterpolation ? this._currentValue ? a.j.DecomposeLerpToRef(this._originalBlendValue, i, this._blendingFactor, this._currentValue) : this._currentValue = a.j.DecomposeLerp(this._originalBlendValue, i, this._blendingFactor) : this._currentValue ? a.j.LerpToRef(this._originalBlendValue, i, this._blendingFactor, this._currentValue) : this._currentValue = a.j.Lerp(this._originalBlendValue, i, this._blendingFactor) : this._currentValue = U._UniversalLerp(this._originalBlendValue, i, this._blendingFactor); - var s = e && e.animationPropertiesOverride ? e.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed; - this._blendingFactor += s - } else - this._currentValue = i; - -1 !== n ? this._scene._registerTargetForLateAnimationBinding(this, this._originalValue[r]) : t[this._targetPath] = this._currentValue, - e.markAsDirty && e.markAsDirty(this._animation.targetProperty) - } - , - e.prototype._getCorrectLoopMode = function() { - return this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.loopMode : this._animation.loopMode - } - , - e.prototype.goToFrame = function(e) { - var t = this._animation.getKeys(); - e < t[0].frame ? e = t[0].frame : e > t[t.length - 1].frame && (e = t[t.length - 1].frame), - this._currentFrame = e; - var i = this._animation._interpolate(e, this._animationState); - this.setValue(i, -1) - } - , - e.prototype._prepareForSpeedRatioChange = function(e) { - var t = this._previousDelay * (this._animation.framePerSecond * e) / 1e3; - this._ratioOffset = this._previousRatio - t - } - , - e.prototype.animate = function(e, t, i, n, r, o) { - void 0 === o && (o = -1); - var a = this._animation - , s = a.targetPropertyPath; - if (!s || s.length < 1) - return this._stopped = true, - false; - var c = true; - (t < this._minFrame || t > this._maxFrame) && (t = this._minFrame), - (i < this._minFrame || i > this._maxFrame) && (i = this._maxFrame); - var u, l, h = i - t, f = e * (a.framePerSecond * r) / 1e3 + this._ratioOffset, d = 0; - if (this._previousDelay = e, - this._previousRatio = f, - !n && i >= t && f >= h) - c = false, - d = a._getKeyValue(this._maxValue); - else if (!n && t >= i && f <= h) - c = false, - d = a._getKeyValue(this._minValue); - else if (this._animationState.loopMode !== U.ANIMATIONLOOPMODE_CYCLE) { - var p = i.toString() + t.toString(); - if (!this._offsetsCache[p]) { - this._animationState.repeatCount = 0, - this._animationState.loopMode = U.ANIMATIONLOOPMODE_CYCLE; - var m = a._interpolate(t, this._animationState) - , g = a._interpolate(i, this._animationState); - switch (this._animationState.loopMode = this._getCorrectLoopMode(), - a.dataType) { - case U.ANIMATIONTYPE_FLOAT: - this._offsetsCache[p] = g - m; - break; - case U.ANIMATIONTYPE_QUATERNION: - this._offsetsCache[p] = g.subtract(m); - break; - case U.ANIMATIONTYPE_VECTOR3: - this._offsetsCache[p] = g.subtract(m); - case U.ANIMATIONTYPE_VECTOR2: - this._offsetsCache[p] = g.subtract(m); - case U.ANIMATIONTYPE_SIZE: - this._offsetsCache[p] = g.subtract(m); - case U.ANIMATIONTYPE_COLOR3: - this._offsetsCache[p] = g.subtract(m) - } - this._highLimitsCache[p] = g - } - d = this._highLimitsCache[p], - u = this._offsetsCache[p] - } - if (void 0 === u) - switch (a.dataType) { - case U.ANIMATIONTYPE_FLOAT: - u = 0; - break; - case U.ANIMATIONTYPE_QUATERNION: - u = G; - break; - case U.ANIMATIONTYPE_VECTOR3: - u = z; - break; - case U.ANIMATIONTYPE_VECTOR2: - u = j; - break; - case U.ANIMATIONTYPE_SIZE: - u = H; - break; - case U.ANIMATIONTYPE_COLOR3: - u = W - } - if (this._host && this._host.syncRoot) { - var _ = this._host.syncRoot; - l = t + (i - t) * ((_.masterFrame - _.fromFrame) / (_.toFrame - _.fromFrame)) - } else - l = c && 0 !== h ? t + f % h : i; - var v = this._events; - if ((h > 0 && this.currentFrame > l || h < 0 && this.currentFrame < l) && (this._onLoop(), - v.length)) - for (var y = 0; y < v.length; y++) - v[y].onlyOnce || (v[y].isDone = false); - this._currentFrame = l, - this._animationState.repeatCount = 0 === h ? 0 : f / h >> 0, - this._animationState.highLimitValue = d, - this._animationState.offsetValue = u; - var b = a._interpolate(l, this._animationState); - if (this.setValue(b, o), - v.length) - for (y = 0; y < v.length; y++) - if (h > 0 && l >= v[y].frame && v[y].frame >= t || h < 0 && l <= v[y].frame && v[y].frame <= t) { - var E = v[y]; - E.isDone || (E.onlyOnce && (v.splice(y, 1), - y--), - E.isDone = true, - E.action(l)) - } - return c || (this._stopped = true), - c - } - , - e - }() - , Y = n(16) - , K = n(47) - , Q = n(34) - , q = function(e) { - function t(t, i, n, r, o, s, c) { - void 0 === n && (n = null), - void 0 === r && (r = null), - void 0 === o && (o = null), - void 0 === s && (s = null), - void 0 === c && (c = null); - var u = e.call(this, t, i.getScene(), false) || this; - return u.name = t, - u.children = new Array, - u.animations = new Array, - u._index = null, - u._absoluteTransform = new a.j, - u._invertedAbsoluteTransform = new a.j, - u._scalingDeterminant = 1, - u._worldTransform = new a.j, - u._needToDecompose = true, - u._needToCompose = false, - u._linkedTransformNode = null, - u._waitingTransformNodeId = null, - u._skeleton = i, - u._localMatrix = r ? r.clone() : a.j.Identity(), - u._restPose = o || u._localMatrix.clone(), - u._baseMatrix = s || u._localMatrix.clone(), - u._index = c, - i.bones.push(u), - u.setParent(n, false), - (s || r) && u._updateDifferenceMatrix(), - u - } - return h.d(t, e), - Object.defineProperty(t.prototype, "_matrix", { - get: function() { - return this._compose(), - this._localMatrix - }, - set: function(e) { - this._localMatrix.copyFrom(e), - this._needToDecompose = true - }, - enumerable: true, - configurable: true + void 0 !== this._originalValue[0] && + this._setValue( + this._target, + this._directTarget, + this._originalValue[0], + -1, + 0 + ); + for ( + this._offsetsCache = {}, + this._highLimitsCache = {}, + this._currentFrame = 0, + this._blendingFactor = 0, + t = 0; + t < this._events.length; + t++ + ) + this._events[t].isDone = false; }), - t.prototype.getClassName = function() { - return "Bone" - } - , - t.prototype.getSkeleton = function() { - return this._skeleton - } - , - t.prototype.getParent = function() { - return this._parent - } - , - t.prototype.getChildren = function() { - return this.children - } - , - t.prototype.setParent = function(e, t) { - if (void 0 === t && (t = true), - this._parent !== e) { - if (this._parent) { - var i = this._parent.children.indexOf(this); - -1 !== i && this._parent.children.splice(i, 1) - } - this._parent = e, - this._parent && this._parent.children.push(this), - t && this._updateDifferenceMatrix(), - this.markAsDirty() + (e.prototype.isStopped = function () { + return this._stopped; + }), + (e.prototype.dispose = function () { + var e = this._animation.runtimeAnimations.indexOf(this); + e > -1 && this._animation.runtimeAnimations.splice(e, 1); + }), + (e.prototype.setValue = function (e, t) { + if (this._targetIsArray) + for (var i = 0; i < this._target.length; i++) { + var n = this._target[i]; + this._setValue(n, this._activeTargets[i], e, t, i); } - } - , - t.prototype.getLocalMatrix = function() { - return this._compose(), - this._localMatrix - } - , - t.prototype.getBaseMatrix = function() { - return this._baseMatrix - } - , - t.prototype.getRestPose = function() { - return this._restPose - } - , - t.prototype.getWorldMatrix = function() { - return this._worldTransform - } - , - t.prototype.returnToRest = function() { - this.updateMatrix(this._restPose.clone()) - } - , - t.prototype.getInvertedAbsoluteTransform = function() { - return this._invertedAbsoluteTransform - } - , - t.prototype.getAbsoluteTransform = function() { - return this._absoluteTransform - } - , - t.prototype.linkTransformNode = function(e) { - this._linkedTransformNode && this._skeleton._numBonesWithLinkedTransformNode--, - this._linkedTransformNode = e, - this._linkedTransformNode && this._skeleton._numBonesWithLinkedTransformNode++ - } - , + else + this._setValue( + this._target, + this._directTarget, + e, + t, + 0 + ); + }), + (e.prototype._getOriginalValues = function (e) { + var t; + void 0 === e && (e = 0); + var i = this._activeTargets[e]; + (t = + i.getRestPose && "_matrix" === this._targetPath + ? i.getRestPose() + : i[this._targetPath]) && t.clone + ? (this._originalValue[e] = t.clone()) + : (this._originalValue[e] = t); + }), + (e.prototype._setValue = function (e, t, i, n, r) { + if ( + ((this._currentActiveTarget = t), + (this._weight = n), + this._enableBlending && this._blendingFactor <= 1) + ) { + if (!this._originalBlendValue) { + var o = t[this._targetPath]; + o.clone + ? (this._originalBlendValue = o.clone()) + : (this._originalBlendValue = o); + } + this._originalBlendValue.m + ? U.AllowMatrixDecomposeForInterpolation + ? this._currentValue + ? a.j.DecomposeLerpToRef( + this._originalBlendValue, + i, + this._blendingFactor, + this._currentValue + ) + : (this._currentValue = a.j.DecomposeLerp( + this._originalBlendValue, + i, + this._blendingFactor + )) + : this._currentValue + ? a.j.LerpToRef( + this._originalBlendValue, + i, + this._blendingFactor, + this._currentValue + ) + : (this._currentValue = a.j.Lerp( + this._originalBlendValue, + i, + this._blendingFactor + )) + : (this._currentValue = U._UniversalLerp( + this._originalBlendValue, + i, + this._blendingFactor + )); + var s = + e && e.animationPropertiesOverride + ? e.animationPropertiesOverride.blendingSpeed + : this._animation.blendingSpeed; + this._blendingFactor += s; + } else this._currentValue = i; + -1 !== n + ? this._scene._registerTargetForLateAnimationBinding( + this, + this._originalValue[r] + ) + : (t[this._targetPath] = this._currentValue), + e.markAsDirty && + e.markAsDirty(this._animation.targetProperty); + }), + (e.prototype._getCorrectLoopMode = function () { + return this._target && + this._target.animationPropertiesOverride + ? this._target.animationPropertiesOverride.loopMode + : this._animation.loopMode; + }), + (e.prototype.goToFrame = function (e) { + var t = this._animation.getKeys(); + e < t[0].frame + ? (e = t[0].frame) + : e > t[t.length - 1].frame && + (e = t[t.length - 1].frame), + (this._currentFrame = e); + var i = this._animation._interpolate( + e, + this._animationState + ); + this.setValue(i, -1); + }), + (e.prototype._prepareForSpeedRatioChange = function (e) { + var t = + (this._previousDelay * + (this._animation.framePerSecond * e)) / + 1e3; + this._ratioOffset = this._previousRatio - t; + }), + (e.prototype.animate = function (e, t, i, n, r, o) { + void 0 === o && (o = -1); + var a = this._animation, + s = a.targetPropertyPath; + if (!s || s.length < 1) + return (this._stopped = true), false; + var c = true; + (t < this._minFrame || t > this._maxFrame) && + (t = this._minFrame), + (i < this._minFrame || i > this._maxFrame) && + (i = this._maxFrame); + var u, + l, + h = i - t, + f = + (e * (a.framePerSecond * r)) / 1e3 + + this._ratioOffset, + d = 0; + if ( + ((this._previousDelay = e), + (this._previousRatio = f), + !n && i >= t && f >= h) + ) + (c = false), (d = a._getKeyValue(this._maxValue)); + else if (!n && t >= i && f <= h) + (c = false), (d = a._getKeyValue(this._minValue)); + else if ( + this._animationState.loopMode !== + U.ANIMATIONLOOPMODE_CYCLE + ) { + var p = i.toString() + t.toString(); + if (!this._offsetsCache[p]) { + (this._animationState.repeatCount = 0), + (this._animationState.loopMode = + U.ANIMATIONLOOPMODE_CYCLE); + var m = a._interpolate(t, this._animationState), + g = a._interpolate(i, this._animationState); + switch ( + ((this._animationState.loopMode = + this._getCorrectLoopMode()), + a.dataType) + ) { + case U.ANIMATIONTYPE_FLOAT: + this._offsetsCache[p] = g - m; + break; + case U.ANIMATIONTYPE_QUATERNION: + this._offsetsCache[p] = g.subtract(m); + break; + case U.ANIMATIONTYPE_VECTOR3: + this._offsetsCache[p] = g.subtract(m); + case U.ANIMATIONTYPE_VECTOR2: + this._offsetsCache[p] = g.subtract(m); + case U.ANIMATIONTYPE_SIZE: + this._offsetsCache[p] = g.subtract(m); + case U.ANIMATIONTYPE_COLOR3: + this._offsetsCache[p] = g.subtract(m); + } + this._highLimitsCache[p] = g; + } + (d = this._highLimitsCache[p]), + (u = this._offsetsCache[p]); + } + if (void 0 === u) + switch (a.dataType) { + case U.ANIMATIONTYPE_FLOAT: + u = 0; + break; + case U.ANIMATIONTYPE_QUATERNION: + u = G; + break; + case U.ANIMATIONTYPE_VECTOR3: + u = z; + break; + case U.ANIMATIONTYPE_VECTOR2: + u = j; + break; + case U.ANIMATIONTYPE_SIZE: + u = H; + break; + case U.ANIMATIONTYPE_COLOR3: + u = W; + } + if (this._host && this._host.syncRoot) { + var _ = this._host.syncRoot; + l = + t + + (i - t) * + ((_.masterFrame - _.fromFrame) / + (_.toFrame - _.fromFrame)); + } else l = c && 0 !== h ? t + (f % h) : i; + var v = this._events; + if ( + ((h > 0 && this.currentFrame > l) || + (h < 0 && this.currentFrame < l)) && + (this._onLoop(), v.length) + ) + for (var y = 0; y < v.length; y++) + v[y].onlyOnce || (v[y].isDone = false); + (this._currentFrame = l), + (this._animationState.repeatCount = + 0 === h ? 0 : (f / h) >> 0), + (this._animationState.highLimitValue = d), + (this._animationState.offsetValue = u); + var b = a._interpolate(l, this._animationState); + if ((this.setValue(b, o), v.length)) + for (y = 0; y < v.length; y++) + if ( + (h > 0 && l >= v[y].frame && v[y].frame >= t) || + (h < 0 && l <= v[y].frame && v[y].frame <= t) + ) { + var E = v[y]; + E.isDone || + (E.onlyOnce && (v.splice(y, 1), y--), + (E.isDone = true), + E.action(l)); + } + return c || (this._stopped = true), c; + }), + e + ); + })(), + Y = n(16), + K = n(47), + Q = n(34), + q = (function (e) { + function t(t, i, n, r, o, s, c) { + void 0 === n && (n = null), + void 0 === r && (r = null), + void 0 === o && (o = null), + void 0 === s && (s = null), + void 0 === c && (c = null); + var u = e.call(this, t, i.getScene(), false) || this; + return ( + (u.name = t), + (u.children = new Array()), + (u.animations = new Array()), + (u._index = null), + (u._absoluteTransform = new a.j()), + (u._invertedAbsoluteTransform = new a.j()), + (u._scalingDeterminant = 1), + (u._worldTransform = new a.j()), + (u._needToDecompose = true), + (u._needToCompose = false), + (u._linkedTransformNode = null), + (u._waitingTransformNodeId = null), + (u._skeleton = i), + (u._localMatrix = r ? r.clone() : a.j.Identity()), + (u._restPose = o || u._localMatrix.clone()), + (u._baseMatrix = s || u._localMatrix.clone()), + (u._index = c), + i.bones.push(u), + u.setParent(n, false), + (s || r) && u._updateDifferenceMatrix(), + u + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "_matrix", { + get: function () { + return this._compose(), this._localMatrix; + }, + set: function (e) { + this._localMatrix.copyFrom(e), + (this._needToDecompose = true); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "Bone"; + }), + (t.prototype.getSkeleton = function () { + return this._skeleton; + }), + (t.prototype.getParent = function () { + return this._parent; + }), + (t.prototype.getChildren = function () { + return this.children; + }), + (t.prototype.setParent = function (e, t) { + if ((void 0 === t && (t = true), this._parent !== e)) { + if (this._parent) { + var i = this._parent.children.indexOf(this); + -1 !== i && this._parent.children.splice(i, 1); + } + (this._parent = e), + this._parent && this._parent.children.push(this), + t && this._updateDifferenceMatrix(), + this.markAsDirty(); + } + }), + (t.prototype.getLocalMatrix = function () { + return this._compose(), this._localMatrix; + }), + (t.prototype.getBaseMatrix = function () { + return this._baseMatrix; + }), + (t.prototype.getRestPose = function () { + return this._restPose; + }), + (t.prototype.getWorldMatrix = function () { + return this._worldTransform; + }), + (t.prototype.returnToRest = function () { + this.updateMatrix(this._restPose.clone()); + }), + (t.prototype.getInvertedAbsoluteTransform = function () { + return this._invertedAbsoluteTransform; + }), + (t.prototype.getAbsoluteTransform = function () { + return this._absoluteTransform; + }), + (t.prototype.linkTransformNode = function (e) { + this._linkedTransformNode && + this._skeleton._numBonesWithLinkedTransformNode--, + (this._linkedTransformNode = e), + this._linkedTransformNode && + this._skeleton._numBonesWithLinkedTransformNode++; + }), Object.defineProperty(t.prototype, "position", { - get: function() { - return this._decompose(), - this._localPosition - }, - set: function(e) { - this._decompose(), - this._localPosition.copyFrom(e), - this._markAsDirtyAndCompose() - }, - enumerable: true, - configurable: true + get: function () { + return this._decompose(), this._localPosition; + }, + set: function (e) { + this._decompose(), + this._localPosition.copyFrom(e), + this._markAsDirtyAndCompose(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rotation", { - get: function() { - return this.getRotation() - }, - set: function(e) { - this.setRotation(e) - }, - enumerable: true, - configurable: true + get: function () { + return this.getRotation(); + }, + set: function (e) { + this.setRotation(e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rotationQuaternion", { - get: function() { - return this._decompose(), - this._localRotation - }, - set: function(e) { - this.setRotationQuaternion(e) - }, - enumerable: true, - configurable: true + get: function () { + return this._decompose(), this._localRotation; + }, + set: function (e) { + this.setRotationQuaternion(e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "scaling", { - get: function() { - return this.getScale() - }, - set: function(e) { - this.setScale(e) + get: function () { + return this.getScale(); + }, + set: function (e) { + this.setScale(e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "animationPropertiesOverride", + { + get: function () { + return this._skeleton.animationPropertiesOverride; }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype._decompose = function () { + this._needToDecompose && + ((this._needToDecompose = false), + this._localScaling || + ((this._localScaling = a.x.Zero()), + (this._localRotation = a.q.Zero()), + (this._localPosition = a.x.Zero())), + this._localMatrix.decompose( + this._localScaling, + this._localRotation, + this._localPosition + )); }), - Object.defineProperty(t.prototype, "animationPropertiesOverride", { - get: function() { - return this._skeleton.animationPropertiesOverride - }, - enumerable: true, - configurable: true + (t.prototype._compose = function () { + this._needToCompose && + ((this._needToCompose = false), + a.j.ComposeToRef( + this._localScaling, + this._localRotation, + this._localPosition, + this._localMatrix + )); }), - t.prototype._decompose = function() { - this._needToDecompose && (this._needToDecompose = false, - this._localScaling || (this._localScaling = a.x.Zero(), - this._localRotation = a.q.Zero(), - this._localPosition = a.x.Zero()), - this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition)) - } - , - t.prototype._compose = function() { - this._needToCompose && (this._needToCompose = false, - a.j.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix)) - } - , - t.prototype.updateMatrix = function(e, t, i) { - void 0 === t && (t = true), + (t.prototype.updateMatrix = function (e, t, i) { + void 0 === t && (t = true), void 0 === i && (i = true), this._baseMatrix.copyFrom(e), t && this._updateDifferenceMatrix(), - i ? (this._localMatrix.copyFrom(e), - this._markAsDirtyAndDecompose()) : this.markAsDirty() - } - , - t.prototype._updateDifferenceMatrix = function(e, t) { - if (void 0 === t && (t = true), + i + ? (this._localMatrix.copyFrom(e), + this._markAsDirtyAndDecompose()) + : this.markAsDirty(); + }), + (t.prototype._updateDifferenceMatrix = function (e, t) { + if ( + (void 0 === t && (t = true), e || (e = this._baseMatrix), - this._parent ? e.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform) : this._absoluteTransform.copyFrom(e), - this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform), + this._parent + ? e.multiplyToRef( + this._parent._absoluteTransform, + this._absoluteTransform + ) + : this._absoluteTransform.copyFrom(e), + this._absoluteTransform.invertToRef( + this._invertedAbsoluteTransform + ), t) - for (var i = 0; i < this.children.length; i++) - this.children[i]._updateDifferenceMatrix(); - this._scalingDeterminant = this._absoluteTransform.determinant() < 0 ? -1 : 1 - } - , - t.prototype.markAsDirty = function() { - this._currentRenderId++, + ) + for (var i = 0; i < this.children.length; i++) + this.children[i]._updateDifferenceMatrix(); + this._scalingDeterminant = + this._absoluteTransform.determinant() < 0 ? -1 : 1; + }), + (t.prototype.markAsDirty = function () { + this._currentRenderId++, this._childUpdateId++, - this._skeleton._markAsDirty() - } - , - t.prototype._markAsDirtyAndCompose = function() { - this.markAsDirty(), - this._needToCompose = true - } - , - t.prototype._markAsDirtyAndDecompose = function() { - this.markAsDirty(), - this._needToDecompose = true - } - , - t.prototype.translate = function(e, i, n) { - void 0 === i && (i = a.s.LOCAL); - var r = this.getLocalMatrix(); - if (i == a.s.LOCAL) - r.addAtIndex(12, e.x), - r.addAtIndex(13, e.y), - r.addAtIndex(14, e.z); - else { - var o = null; - n && (o = n.getWorldMatrix()), - this._skeleton.computeAbsoluteTransforms(); - var s = t._tmpMats[0] - , c = t._tmpVecs[0]; - this._parent && (n && o ? (s.copyFrom(this._parent.getAbsoluteTransform()), - s.multiplyToRef(o, s)) : s.copyFrom(this._parent.getAbsoluteTransform())), - s.setTranslationFromFloats(0, 0, 0), - s.invert(), - a.x.TransformCoordinatesToRef(e, s, c), - r.addAtIndex(12, c.x), - r.addAtIndex(13, c.y), - r.addAtIndex(14, c.z) - } - this._markAsDirtyAndDecompose() - } - , - t.prototype.setPosition = function(e, i, n) { - void 0 === i && (i = a.s.LOCAL); - var r = this.getLocalMatrix(); - if (i == a.s.LOCAL) - r.setTranslationFromFloats(e.x, e.y, e.z); - else { - var o = null; - n && (o = n.getWorldMatrix()), - this._skeleton.computeAbsoluteTransforms(); - var s = t._tmpMats[0] - , c = t._tmpVecs[0]; - this._parent && (n && o ? (s.copyFrom(this._parent.getAbsoluteTransform()), - s.multiplyToRef(o, s)) : s.copyFrom(this._parent.getAbsoluteTransform())), - s.invert(), - a.x.TransformCoordinatesToRef(e, s, c), - r.setTranslationFromFloats(c.x, c.y, c.z) - } - this._markAsDirtyAndDecompose() - } - , - t.prototype.setAbsolutePosition = function(e, t) { - this.setPosition(e, a.s.WORLD, t) - } - , - t.prototype.scale = function(e, i, n, r) { - void 0 === r && (r = false); - var o = this.getLocalMatrix() - , s = t._tmpMats[0]; - a.j.ScalingToRef(e, i, n, s), + this._skeleton._markAsDirty(); + }), + (t.prototype._markAsDirtyAndCompose = function () { + this.markAsDirty(), (this._needToCompose = true); + }), + (t.prototype._markAsDirtyAndDecompose = function () { + this.markAsDirty(), (this._needToDecompose = true); + }), + (t.prototype.translate = function (e, i, n) { + void 0 === i && (i = a.s.LOCAL); + var r = this.getLocalMatrix(); + if (i == a.s.LOCAL) + r.addAtIndex(12, e.x), + r.addAtIndex(13, e.y), + r.addAtIndex(14, e.z); + else { + var o = null; + n && (o = n.getWorldMatrix()), + this._skeleton.computeAbsoluteTransforms(); + var s = t._tmpMats[0], + c = t._tmpVecs[0]; + this._parent && + (n && o + ? (s.copyFrom(this._parent.getAbsoluteTransform()), + s.multiplyToRef(o, s)) + : s.copyFrom(this._parent.getAbsoluteTransform())), + s.setTranslationFromFloats(0, 0, 0), + s.invert(), + a.x.TransformCoordinatesToRef(e, s, c), + r.addAtIndex(12, c.x), + r.addAtIndex(13, c.y), + r.addAtIndex(14, c.z); + } + this._markAsDirtyAndDecompose(); + }), + (t.prototype.setPosition = function (e, i, n) { + void 0 === i && (i = a.s.LOCAL); + var r = this.getLocalMatrix(); + if (i == a.s.LOCAL) + r.setTranslationFromFloats(e.x, e.y, e.z); + else { + var o = null; + n && (o = n.getWorldMatrix()), + this._skeleton.computeAbsoluteTransforms(); + var s = t._tmpMats[0], + c = t._tmpVecs[0]; + this._parent && + (n && o + ? (s.copyFrom(this._parent.getAbsoluteTransform()), + s.multiplyToRef(o, s)) + : s.copyFrom(this._parent.getAbsoluteTransform())), + s.invert(), + a.x.TransformCoordinatesToRef(e, s, c), + r.setTranslationFromFloats(c.x, c.y, c.z); + } + this._markAsDirtyAndDecompose(); + }), + (t.prototype.setAbsolutePosition = function (e, t) { + this.setPosition(e, a.s.WORLD, t); + }), + (t.prototype.scale = function (e, i, n, r) { + void 0 === r && (r = false); + var o = this.getLocalMatrix(), + s = t._tmpMats[0]; + a.j.ScalingToRef(e, i, n, s), s.multiplyToRef(o, o), s.invert(); - for (var c = 0, u = this.children; c < u.length; c++) { - var l = (d = u[c]).getLocalMatrix(); - l.multiplyToRef(s, l), - l.multiplyAtIndex(12, e), - l.multiplyAtIndex(13, i), - l.multiplyAtIndex(14, n), - d._markAsDirtyAndDecompose() + for (var c = 0, u = this.children; c < u.length; c++) { + var l = (d = u[c]).getLocalMatrix(); + l.multiplyToRef(s, l), + l.multiplyAtIndex(12, e), + l.multiplyAtIndex(13, i), + l.multiplyAtIndex(14, n), + d._markAsDirtyAndDecompose(); + } + if ((this._markAsDirtyAndDecompose(), r)) + for (var h = 0, f = this.children; h < f.length; h++) { + var d; + (d = f[h]).scale(e, i, n, r); } - if (this._markAsDirtyAndDecompose(), - r) - for (var h = 0, f = this.children; h < f.length; h++) { - var d; - (d = f[h]).scale(e, i, n, r) - } - } - , - t.prototype.setScale = function(e) { - this._decompose(), + }), + (t.prototype.setScale = function (e) { + this._decompose(), this._localScaling.copyFrom(e), - this._markAsDirtyAndCompose() - } - , - t.prototype.getScale = function() { - return this._decompose(), - this._localScaling - } - , - t.prototype.getScaleToRef = function(e) { - this._decompose(), - e.copyFrom(this._localScaling) - } - , - t.prototype.setYawPitchRoll = function(e, i, n, r, o) { - if (void 0 === r && (r = a.s.LOCAL), - r === a.s.LOCAL) { - var s = t._tmpQuat; - return a.q.RotationYawPitchRollToRef(e, i, n, s), - void this.setRotationQuaternion(s, r, o) - } - var c = t._tmpMats[0]; - if (this._getNegativeRotationToRef(c, o)) { - var u = t._tmpMats[1]; - a.j.RotationYawPitchRollToRef(e, i, n, u), - c.multiplyToRef(u, u), - this._rotateWithMatrix(u, r, o) - } - } - , - t.prototype.rotate = function(e, i, n, r) { - void 0 === n && (n = a.s.LOCAL); - var o = t._tmpMats[0]; - o.setTranslationFromFloats(0, 0, 0), + this._markAsDirtyAndCompose(); + }), + (t.prototype.getScale = function () { + return this._decompose(), this._localScaling; + }), + (t.prototype.getScaleToRef = function (e) { + this._decompose(), e.copyFrom(this._localScaling); + }), + (t.prototype.setYawPitchRoll = function (e, i, n, r, o) { + if ((void 0 === r && (r = a.s.LOCAL), r === a.s.LOCAL)) { + var s = t._tmpQuat; + return ( + a.q.RotationYawPitchRollToRef(e, i, n, s), + void this.setRotationQuaternion(s, r, o) + ); + } + var c = t._tmpMats[0]; + if (this._getNegativeRotationToRef(c, o)) { + var u = t._tmpMats[1]; + a.j.RotationYawPitchRollToRef(e, i, n, u), + c.multiplyToRef(u, u), + this._rotateWithMatrix(u, r, o); + } + }), + (t.prototype.rotate = function (e, i, n, r) { + void 0 === n && (n = a.s.LOCAL); + var o = t._tmpMats[0]; + o.setTranslationFromFloats(0, 0, 0), a.j.RotationAxisToRef(e, i, o), - this._rotateWithMatrix(o, n, r) - } - , - t.prototype.setAxisAngle = function(e, i, n, r) { - if (void 0 === n && (n = a.s.LOCAL), - n === a.s.LOCAL) { - var o = t._tmpQuat; - return a.q.RotationAxisToRef(e, i, o), - void this.setRotationQuaternion(o, n, r) - } - var s = t._tmpMats[0]; - if (this._getNegativeRotationToRef(s, r)) { - var c = t._tmpMats[1]; - a.j.RotationAxisToRef(e, i, c), - s.multiplyToRef(c, c), - this._rotateWithMatrix(c, n, r) - } - } - , - t.prototype.setRotation = function(e, t, i) { - void 0 === t && (t = a.s.LOCAL), - this.setYawPitchRoll(e.y, e.x, e.z, t, i) - } - , - t.prototype.setRotationQuaternion = function(e, i, n) { - if (void 0 === i && (i = a.s.LOCAL), - i === a.s.LOCAL) - return this._decompose(), - this._localRotation.copyFrom(e), - void this._markAsDirtyAndCompose(); - var r = t._tmpMats[0]; - if (this._getNegativeRotationToRef(r, n)) { - var o = t._tmpMats[1]; - a.j.FromQuaternionToRef(e, o), - r.multiplyToRef(o, o), - this._rotateWithMatrix(o, i, n) - } - } - , - t.prototype.setRotationMatrix = function(e, i, n) { - if (void 0 === i && (i = a.s.LOCAL), - i === a.s.LOCAL) { - var r = t._tmpQuat; - return a.q.FromRotationMatrixToRef(e, r), - void this.setRotationQuaternion(r, i, n) - } - var o = t._tmpMats[0]; - if (this._getNegativeRotationToRef(o, n)) { - var s = t._tmpMats[1]; - s.copyFrom(e), - o.multiplyToRef(e, s), - this._rotateWithMatrix(s, i, n) - } - } - , - t.prototype._rotateWithMatrix = function(e, i, n) { - void 0 === i && (i = a.s.LOCAL); - var r = this.getLocalMatrix() - , o = r.m[12] - , s = r.m[13] - , c = r.m[14] - , u = this.getParent() - , l = t._tmpMats[3] - , h = t._tmpMats[4]; - u && i == a.s.WORLD ? (n ? (l.copyFrom(n.getWorldMatrix()), - u.getAbsoluteTransform().multiplyToRef(l, l)) : l.copyFrom(u.getAbsoluteTransform()), - h.copyFrom(l), - h.invert(), - r.multiplyToRef(l, r), - r.multiplyToRef(e, r), - r.multiplyToRef(h, r)) : i == a.s.WORLD && n ? (l.copyFrom(n.getWorldMatrix()), - h.copyFrom(l), - h.invert(), - r.multiplyToRef(l, r), - r.multiplyToRef(e, r), - r.multiplyToRef(h, r)) : r.multiplyToRef(e, r), + this._rotateWithMatrix(o, n, r); + }), + (t.prototype.setAxisAngle = function (e, i, n, r) { + if ((void 0 === n && (n = a.s.LOCAL), n === a.s.LOCAL)) { + var o = t._tmpQuat; + return ( + a.q.RotationAxisToRef(e, i, o), + void this.setRotationQuaternion(o, n, r) + ); + } + var s = t._tmpMats[0]; + if (this._getNegativeRotationToRef(s, r)) { + var c = t._tmpMats[1]; + a.j.RotationAxisToRef(e, i, c), + s.multiplyToRef(c, c), + this._rotateWithMatrix(c, n, r); + } + }), + (t.prototype.setRotation = function (e, t, i) { + void 0 === t && (t = a.s.LOCAL), + this.setYawPitchRoll(e.y, e.x, e.z, t, i); + }), + (t.prototype.setRotationQuaternion = function (e, i, n) { + if ((void 0 === i && (i = a.s.LOCAL), i === a.s.LOCAL)) + return ( + this._decompose(), + this._localRotation.copyFrom(e), + void this._markAsDirtyAndCompose() + ); + var r = t._tmpMats[0]; + if (this._getNegativeRotationToRef(r, n)) { + var o = t._tmpMats[1]; + a.j.FromQuaternionToRef(e, o), + r.multiplyToRef(o, o), + this._rotateWithMatrix(o, i, n); + } + }), + (t.prototype.setRotationMatrix = function (e, i, n) { + if ((void 0 === i && (i = a.s.LOCAL), i === a.s.LOCAL)) { + var r = t._tmpQuat; + return ( + a.q.FromRotationMatrixToRef(e, r), + void this.setRotationQuaternion(r, i, n) + ); + } + var o = t._tmpMats[0]; + if (this._getNegativeRotationToRef(o, n)) { + var s = t._tmpMats[1]; + s.copyFrom(e), + o.multiplyToRef(e, s), + this._rotateWithMatrix(s, i, n); + } + }), + (t.prototype._rotateWithMatrix = function (e, i, n) { + void 0 === i && (i = a.s.LOCAL); + var r = this.getLocalMatrix(), + o = r.m[12], + s = r.m[13], + c = r.m[14], + u = this.getParent(), + l = t._tmpMats[3], + h = t._tmpMats[4]; + u && i == a.s.WORLD + ? (n + ? (l.copyFrom(n.getWorldMatrix()), + u.getAbsoluteTransform().multiplyToRef(l, l)) + : l.copyFrom(u.getAbsoluteTransform()), + h.copyFrom(l), + h.invert(), + r.multiplyToRef(l, r), + r.multiplyToRef(e, r), + r.multiplyToRef(h, r)) + : i == a.s.WORLD && n + ? (l.copyFrom(n.getWorldMatrix()), + h.copyFrom(l), + h.invert(), + r.multiplyToRef(l, r), + r.multiplyToRef(e, r), + r.multiplyToRef(h, r)) + : r.multiplyToRef(e, r), r.setTranslationFromFloats(o, s, c), this.computeAbsoluteTransforms(), - this._markAsDirtyAndDecompose() - } - , - t.prototype._getNegativeRotationToRef = function(e, i) { - var n = t._tmpMats[2]; - return e.copyFrom(this.getAbsoluteTransform()), - i && (e.multiplyToRef(i.getWorldMatrix(), e), - a.j.ScalingToRef(i.scaling.x, i.scaling.y, i.scaling.z, n)), + this._markAsDirtyAndDecompose(); + }), + (t.prototype._getNegativeRotationToRef = function (e, i) { + var n = t._tmpMats[2]; + return ( + e.copyFrom(this.getAbsoluteTransform()), + i && + (e.multiplyToRef(i.getWorldMatrix(), e), + a.j.ScalingToRef( + i.scaling.x, + i.scaling.y, + i.scaling.z, + n + )), e.invert(), - !isNaN(e.m[0]) && (n.multiplyAtIndex(0, this._scalingDeterminant), - e.multiplyToRef(n, e), - true) - } - , - t.prototype.getPosition = function(e, t) { - void 0 === e && (e = a.s.LOCAL), + !isNaN(e.m[0]) && + (n.multiplyAtIndex(0, this._scalingDeterminant), + e.multiplyToRef(n, e), + true) + ); + }), + (t.prototype.getPosition = function (e, t) { + void 0 === e && (e = a.s.LOCAL), void 0 === t && (t = null); - var i = a.x.Zero(); - return this.getPositionToRef(e, t, i), - i - } - , - t.prototype.getPositionToRef = function(e, i, n) { - if (void 0 === e && (e = a.s.LOCAL), - e == a.s.LOCAL) { - var r = this.getLocalMatrix(); - n.x = r.m[12], - n.y = r.m[13], - n.z = r.m[14] - } else { - var o = null; - i && (o = i.getWorldMatrix()), - this._skeleton.computeAbsoluteTransforms(); - var s = t._tmpMats[0]; - i && o ? (s.copyFrom(this.getAbsoluteTransform()), - s.multiplyToRef(o, s)) : s = this.getAbsoluteTransform(), - n.x = s.m[12], - n.y = s.m[13], - n.z = s.m[14] - } - } - , - t.prototype.getAbsolutePosition = function(e) { - void 0 === e && (e = null); - var t = a.x.Zero(); - return this.getPositionToRef(a.s.WORLD, e, t), - t - } - , - t.prototype.getAbsolutePositionToRef = function(e, t) { - this.getPositionToRef(a.s.WORLD, e, t) - } - , - t.prototype.computeAbsoluteTransforms = function() { - if (this._compose(), - this._parent) - this._localMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform); - else { - this._absoluteTransform.copyFrom(this._localMatrix); - var e = this._skeleton.getPoseMatrix(); - e && this._absoluteTransform.multiplyToRef(e, this._absoluteTransform) - } - for (var t = this.children, i = t.length, n = 0; n < i; n++) - t[n].computeAbsoluteTransforms() - } - , - t.prototype.getDirection = function(e, t) { - void 0 === t && (t = null); - var i = a.x.Zero(); - return this.getDirectionToRef(e, t, i), - i - } - , - t.prototype.getDirectionToRef = function(e, i, n) { - void 0 === i && (i = null); - var r = null; - i && (r = i.getWorldMatrix()), + var i = a.x.Zero(); + return this.getPositionToRef(e, t, i), i; + }), + (t.prototype.getPositionToRef = function (e, i, n) { + if ((void 0 === e && (e = a.s.LOCAL), e == a.s.LOCAL)) { + var r = this.getLocalMatrix(); + (n.x = r.m[12]), (n.y = r.m[13]), (n.z = r.m[14]); + } else { + var o = null; + i && (o = i.getWorldMatrix()), + this._skeleton.computeAbsoluteTransforms(); + var s = t._tmpMats[0]; + i && o + ? (s.copyFrom(this.getAbsoluteTransform()), + s.multiplyToRef(o, s)) + : (s = this.getAbsoluteTransform()), + (n.x = s.m[12]), + (n.y = s.m[13]), + (n.z = s.m[14]); + } + }), + (t.prototype.getAbsolutePosition = function (e) { + void 0 === e && (e = null); + var t = a.x.Zero(); + return this.getPositionToRef(a.s.WORLD, e, t), t; + }), + (t.prototype.getAbsolutePositionToRef = function (e, t) { + this.getPositionToRef(a.s.WORLD, e, t); + }), + (t.prototype.computeAbsoluteTransforms = function () { + if ((this._compose(), this._parent)) + this._localMatrix.multiplyToRef( + this._parent._absoluteTransform, + this._absoluteTransform + ); + else { + this._absoluteTransform.copyFrom(this._localMatrix); + var e = this._skeleton.getPoseMatrix(); + e && + this._absoluteTransform.multiplyToRef( + e, + this._absoluteTransform + ); + } + for ( + var t = this.children, i = t.length, n = 0; + n < i; + n++ + ) + t[n].computeAbsoluteTransforms(); + }), + (t.prototype.getDirection = function (e, t) { + void 0 === t && (t = null); + var i = a.x.Zero(); + return this.getDirectionToRef(e, t, i), i; + }), + (t.prototype.getDirectionToRef = function (e, i, n) { + void 0 === i && (i = null); + var r = null; + i && (r = i.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms(); - var o = t._tmpMats[0]; - o.copyFrom(this.getAbsoluteTransform()), + var o = t._tmpMats[0]; + o.copyFrom(this.getAbsoluteTransform()), i && r && o.multiplyToRef(r, o), a.x.TransformNormalToRef(e, o, n), - n.normalize() - } - , - t.prototype.getRotation = function(e, t) { - void 0 === e && (e = a.s.LOCAL), + n.normalize(); + }), + (t.prototype.getRotation = function (e, t) { + void 0 === e && (e = a.s.LOCAL), void 0 === t && (t = null); - var i = a.x.Zero(); - return this.getRotationToRef(e, t, i), - i - } - , - t.prototype.getRotationToRef = function(e, i, n) { - void 0 === e && (e = a.s.LOCAL), + var i = a.x.Zero(); + return this.getRotationToRef(e, t, i), i; + }), + (t.prototype.getRotationToRef = function (e, i, n) { + void 0 === e && (e = a.s.LOCAL), void 0 === i && (i = null); - var r = t._tmpQuat; - this.getRotationQuaternionToRef(e, i, r), - r.toEulerAnglesToRef(n) - } - , - t.prototype.getRotationQuaternion = function(e, t) { - void 0 === e && (e = a.s.LOCAL), + var r = t._tmpQuat; + this.getRotationQuaternionToRef(e, i, r), + r.toEulerAnglesToRef(n); + }), + (t.prototype.getRotationQuaternion = function (e, t) { + void 0 === e && (e = a.s.LOCAL), void 0 === t && (t = null); - var i = a.q.Identity(); - return this.getRotationQuaternionToRef(e, t, i), - i - } - , - t.prototype.getRotationQuaternionToRef = function(e, i, n) { - if (void 0 === e && (e = a.s.LOCAL), + var i = a.q.Identity(); + return this.getRotationQuaternionToRef(e, t, i), i; + }), + (t.prototype.getRotationQuaternionToRef = function ( + e, + i, + n + ) { + if ( + (void 0 === e && (e = a.s.LOCAL), void 0 === i && (i = null), e == a.s.LOCAL) - this._decompose(), - n.copyFrom(this._localRotation); - else { - var r = t._tmpMats[0] - , o = this.getAbsoluteTransform(); - i ? o.multiplyToRef(i.getWorldMatrix(), r) : r.copyFrom(o), - r.multiplyAtIndex(0, this._scalingDeterminant), - r.multiplyAtIndex(1, this._scalingDeterminant), - r.multiplyAtIndex(2, this._scalingDeterminant), - r.decompose(void 0, n, void 0) - } - } - , - t.prototype.getRotationMatrix = function(e, t) { - void 0 === e && (e = a.s.LOCAL); - var i = a.j.Identity(); - return this.getRotationMatrixToRef(e, t, i), + ) + this._decompose(), n.copyFrom(this._localRotation); + else { + var r = t._tmpMats[0], + o = this.getAbsoluteTransform(); i - } - , - t.prototype.getRotationMatrixToRef = function(e, i, n) { - if (void 0 === e && (e = a.s.LOCAL), - e == a.s.LOCAL) - this.getLocalMatrix().getRotationMatrixToRef(n); - else { - var r = t._tmpMats[0] - , o = this.getAbsoluteTransform(); - i ? o.multiplyToRef(i.getWorldMatrix(), r) : r.copyFrom(o), - r.multiplyAtIndex(0, this._scalingDeterminant), - r.multiplyAtIndex(1, this._scalingDeterminant), - r.multiplyAtIndex(2, this._scalingDeterminant), - r.getRotationMatrixToRef(n) - } - } - , - t.prototype.getAbsolutePositionFromLocal = function(e, t) { - void 0 === t && (t = null); - var i = a.x.Zero(); - return this.getAbsolutePositionFromLocalToRef(e, t, i), + ? o.multiplyToRef(i.getWorldMatrix(), r) + : r.copyFrom(o), + r.multiplyAtIndex(0, this._scalingDeterminant), + r.multiplyAtIndex(1, this._scalingDeterminant), + r.multiplyAtIndex(2, this._scalingDeterminant), + r.decompose(void 0, n, void 0); + } + }), + (t.prototype.getRotationMatrix = function (e, t) { + void 0 === e && (e = a.s.LOCAL); + var i = a.j.Identity(); + return this.getRotationMatrixToRef(e, t, i), i; + }), + (t.prototype.getRotationMatrixToRef = function (e, i, n) { + if ((void 0 === e && (e = a.s.LOCAL), e == a.s.LOCAL)) + this.getLocalMatrix().getRotationMatrixToRef(n); + else { + var r = t._tmpMats[0], + o = this.getAbsoluteTransform(); i - } - , - t.prototype.getAbsolutePositionFromLocalToRef = function(e, i, n) { - void 0 === i && (i = null); - var r = null; - i && (r = i.getWorldMatrix()), + ? o.multiplyToRef(i.getWorldMatrix(), r) + : r.copyFrom(o), + r.multiplyAtIndex(0, this._scalingDeterminant), + r.multiplyAtIndex(1, this._scalingDeterminant), + r.multiplyAtIndex(2, this._scalingDeterminant), + r.getRotationMatrixToRef(n); + } + }), + (t.prototype.getAbsolutePositionFromLocal = function ( + e, + t + ) { + void 0 === t && (t = null); + var i = a.x.Zero(); + return this.getAbsolutePositionFromLocalToRef(e, t, i), i; + }), + (t.prototype.getAbsolutePositionFromLocalToRef = function ( + e, + i, + n + ) { + void 0 === i && (i = null); + var r = null; + i && (r = i.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms(); - var o = t._tmpMats[0]; - i && r ? (o.copyFrom(this.getAbsoluteTransform()), - o.multiplyToRef(r, o)) : o = this.getAbsoluteTransform(), - a.x.TransformCoordinatesToRef(e, o, n) - } - , - t.prototype.getLocalPositionFromAbsolute = function(e, t) { - void 0 === t && (t = null); - var i = a.x.Zero(); - return this.getLocalPositionFromAbsoluteToRef(e, t, i), - i - } - , - t.prototype.getLocalPositionFromAbsoluteToRef = function(e, i, n) { - void 0 === i && (i = null); - var r = null; - i && (r = i.getWorldMatrix()), + var o = t._tmpMats[0]; + i && r + ? (o.copyFrom(this.getAbsoluteTransform()), + o.multiplyToRef(r, o)) + : (o = this.getAbsoluteTransform()), + a.x.TransformCoordinatesToRef(e, o, n); + }), + (t.prototype.getLocalPositionFromAbsolute = function ( + e, + t + ) { + void 0 === t && (t = null); + var i = a.x.Zero(); + return this.getLocalPositionFromAbsoluteToRef(e, t, i), i; + }), + (t.prototype.getLocalPositionFromAbsoluteToRef = function ( + e, + i, + n + ) { + void 0 === i && (i = null); + var r = null; + i && (r = i.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms(); - var o = t._tmpMats[0]; - o.copyFrom(this.getAbsoluteTransform()), + var o = t._tmpMats[0]; + o.copyFrom(this.getAbsoluteTransform()), i && r && o.multiplyToRef(r, o), o.invert(), - a.x.TransformCoordinatesToRef(e, o, n) - } - , - t._tmpVecs = Q.a.BuildArray(2, a.x.Zero), - t._tmpQuat = a.q.Identity(), - t._tmpMats = Q.a.BuildArray(5, a.j.Identity), + a.x.TransformCoordinatesToRef(e, o, n); + }), + (t._tmpVecs = Q.a.BuildArray(2, a.x.Zero)), + (t._tmpQuat = a.q.Identity()), + (t._tmpMats = Q.a.BuildArray(5, a.j.Identity)), t - }(N.a) - , Z = function() { - function e(e, t, i, n, r, a, s, c, u) { - void 0 === i && (i = 0), - void 0 === n && (n = 100), - void 0 === r && (r = false), - void 0 === a && (a = 1), - this.target = t, - this.fromFrame = i, - this.toFrame = n, - this.loopAnimation = r, - this.onAnimationEnd = s, - this.onAnimationLoop = u, - this._localDelayOffset = null, - this._pausedDelay = null, - this._runtimeAnimations = new Array, - this._paused = false, - this._speedRatio = 1, - this._weight = -1, - this._syncRoot = null, - this.disposeOnEnd = true, - this.animationStarted = false, - this.onAnimationEndObservable = new o.c, - this.onAnimationLoopObservable = new o.c, - this._scene = e, - c && this.appendAnimations(t, c), - this._speedRatio = a, - e._activeAnimatables.push(this) - } - return Object.defineProperty(e.prototype, "syncRoot", { - get: function() { - return this._syncRoot - }, - enumerable: true, - configurable: true + ); + })(N.a), + Z = (function () { + function e(e, t, i, n, r, a, s, c, u) { + void 0 === i && (i = 0), + void 0 === n && (n = 100), + void 0 === r && (r = false), + void 0 === a && (a = 1), + (this.target = t), + (this.fromFrame = i), + (this.toFrame = n), + (this.loopAnimation = r), + (this.onAnimationEnd = s), + (this.onAnimationLoop = u), + (this._localDelayOffset = null), + (this._pausedDelay = null), + (this._runtimeAnimations = new Array()), + (this._paused = false), + (this._speedRatio = 1), + (this._weight = -1), + (this._syncRoot = null), + (this.disposeOnEnd = true), + (this.animationStarted = false), + (this.onAnimationEndObservable = new o.c()), + (this.onAnimationLoopObservable = new o.c()), + (this._scene = e), + c && this.appendAnimations(t, c), + (this._speedRatio = a), + e._activeAnimatables.push(this); + } + return ( + Object.defineProperty(e.prototype, "syncRoot", { + get: function () { + return this._syncRoot; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "masterFrame", { - get: function() { - return 0 === this._runtimeAnimations.length ? 0 : this._runtimeAnimations[0].currentFrame - }, - enumerable: true, - configurable: true + get: function () { + return 0 === this._runtimeAnimations.length + ? 0 + : this._runtimeAnimations[0].currentFrame; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "weight", { - get: function() { - return this._weight - }, - set: function(e) { - this._weight = -1 !== e ? Math.min(Math.max(e, 0), 1) : -1 - }, - enumerable: true, - configurable: true + get: function () { + return this._weight; + }, + set: function (e) { + this._weight = + -1 !== e ? Math.min(Math.max(e, 0), 1) : -1; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "speedRatio", { - get: function() { - return this._speedRatio - }, - set: function(e) { - for (var t = 0; t < this._runtimeAnimations.length; t++) - this._runtimeAnimations[t]._prepareForSpeedRatioChange(e); - this._speedRatio = e - }, - enumerable: true, - configurable: true + get: function () { + return this._speedRatio; + }, + set: function (e) { + for (var t = 0; t < this._runtimeAnimations.length; t++) + this._runtimeAnimations[ + t + ]._prepareForSpeedRatioChange(e); + this._speedRatio = e; + }, + enumerable: true, + configurable: true, }), - e.prototype.syncWith = function(e) { - if (this._syncRoot = e, - e) { - var t = this._scene._activeAnimatables.indexOf(this); - t > -1 && (this._scene._activeAnimatables.splice(t, 1), - this._scene._activeAnimatables.push(this)) - } - return this - } - , - e.prototype.getAnimations = function() { - return this._runtimeAnimations - } - , - e.prototype.appendAnimations = function(e, t) { - for (var i = this, n = 0; n < t.length; n++) { - var r = t[n] - , o = new X(e,r,this._scene,this); - o._onLoop = function() { - i.onAnimationLoopObservable.notifyObservers(i), - i.onAnimationLoop && i.onAnimationLoop() - } - , - this._runtimeAnimations.push(o) - } - } - , - e.prototype.getAnimationByTargetProperty = function(e) { - for (var t = this._runtimeAnimations, i = 0; i < t.length; i++) - if (t[i].animation.targetProperty === e) - return t[i].animation; - return null - } - , - e.prototype.getRuntimeAnimationByTargetProperty = function(e) { - for (var t = this._runtimeAnimations, i = 0; i < t.length; i++) - if (t[i].animation.targetProperty === e) - return t[i]; - return null - } - , - e.prototype.reset = function() { - for (var e = this._runtimeAnimations, t = 0; t < e.length; t++) - e[t].reset(true); - this._localDelayOffset = null, - this._pausedDelay = null - } - , - e.prototype.enableBlending = function(e) { - for (var t = this._runtimeAnimations, i = 0; i < t.length; i++) - t[i].animation.enableBlending = true, - t[i].animation.blendingSpeed = e - } - , - e.prototype.disableBlending = function() { - for (var e = this._runtimeAnimations, t = 0; t < e.length; t++) - e[t].animation.enableBlending = false - } - , - e.prototype.goToFrame = function(e) { - var t = this._runtimeAnimations; - if (t[0]) { - var i = t[0].animation.framePerSecond - , n = e - t[0].currentFrame - , r = 0 !== this.speedRatio ? 1e3 * n / (i * this.speedRatio) : 0; - null === this._localDelayOffset && (this._localDelayOffset = 0), - this._localDelayOffset -= r - } - for (var o = 0; o < t.length; o++) - t[o].goToFrame(e) - } - , - e.prototype.pause = function() { - this._paused || (this._paused = true) - } - , - e.prototype.restart = function() { - this._paused = false - } - , - e.prototype._raiseOnAnimationEnd = function() { - this.onAnimationEnd && this.onAnimationEnd(), - this.onAnimationEndObservable.notifyObservers(this) - } - , - e.prototype.stop = function(e, t) { - if (e || t) { - var i = this._scene._activeAnimatables.indexOf(this); - if (i > -1) { - for (var n = (o = this._runtimeAnimations).length - 1; n >= 0; n--) { - var r = o[n]; - e && r.animation.name != e || t && !t(r.target) || (r.dispose(), - o.splice(n, 1)) - } - 0 == o.length && (this._scene._activeAnimatables.splice(i, 1), - this._raiseOnAnimationEnd()) - } - } else if ((n = this._scene._activeAnimatables.indexOf(this)) > -1) { - this._scene._activeAnimatables.splice(n, 1); - var o = this._runtimeAnimations; - for (n = 0; n < o.length; n++) - o[n].dispose(); - this._raiseOnAnimationEnd() - } - } - , - e.prototype.waitAsync = function() { - var e = this; - return new i(function(t, i) { - e.onAnimationEndObservable.add(function() { - t(e) - }, void 0, void 0, e, true) - } + (e.prototype.syncWith = function (e) { + if (((this._syncRoot = e), e)) { + var t = this._scene._activeAnimatables.indexOf(this); + t > -1 && + (this._scene._activeAnimatables.splice(t, 1), + this._scene._activeAnimatables.push(this)); + } + return this; + }), + (e.prototype.getAnimations = function () { + return this._runtimeAnimations; + }), + (e.prototype.appendAnimations = function (e, t) { + for (var i = this, n = 0; n < t.length; n++) { + var r = t[n], + o = new X(e, r, this._scene, this); + (o._onLoop = function () { + i.onAnimationLoopObservable.notifyObservers(i), + i.onAnimationLoop && i.onAnimationLoop(); + }), + this._runtimeAnimations.push(o); + } + }), + (e.prototype.getAnimationByTargetProperty = function (e) { + for ( + var t = this._runtimeAnimations, i = 0; + i < t.length; + i++ + ) + if (t[i].animation.targetProperty === e) + return t[i].animation; + return null; + }), + (e.prototype.getRuntimeAnimationByTargetProperty = + function (e) { + for ( + var t = this._runtimeAnimations, i = 0; + i < t.length; + i++ ) - } - , - e.prototype._animate = function(e) { - if (this._paused) - return this.animationStarted = false, - null === this._pausedDelay && (this._pausedDelay = e), - true; - if (null === this._localDelayOffset ? (this._localDelayOffset = e, - this._pausedDelay = null) : null !== this._pausedDelay && (this._localDelayOffset += e - this._pausedDelay, - this._pausedDelay = null), + if (t[i].animation.targetProperty === e) return t[i]; + return null; + }), + (e.prototype.reset = function () { + for ( + var e = this._runtimeAnimations, t = 0; + t < e.length; + t++ + ) + e[t].reset(true); + (this._localDelayOffset = null), + (this._pausedDelay = null); + }), + (e.prototype.enableBlending = function (e) { + for ( + var t = this._runtimeAnimations, i = 0; + i < t.length; + i++ + ) + (t[i].animation.enableBlending = true), + (t[i].animation.blendingSpeed = e); + }), + (e.prototype.disableBlending = function () { + for ( + var e = this._runtimeAnimations, t = 0; + t < e.length; + t++ + ) + e[t].animation.enableBlending = false; + }), + (e.prototype.goToFrame = function (e) { + var t = this._runtimeAnimations; + if (t[0]) { + var i = t[0].animation.framePerSecond, + n = e - t[0].currentFrame, + r = + 0 !== this.speedRatio + ? (1e3 * n) / (i * this.speedRatio) + : 0; + null === this._localDelayOffset && + (this._localDelayOffset = 0), + (this._localDelayOffset -= r); + } + for (var o = 0; o < t.length; o++) t[o].goToFrame(e); + }), + (e.prototype.pause = function () { + this._paused || (this._paused = true); + }), + (e.prototype.restart = function () { + this._paused = false; + }), + (e.prototype._raiseOnAnimationEnd = function () { + this.onAnimationEnd && this.onAnimationEnd(), + this.onAnimationEndObservable.notifyObservers(this); + }), + (e.prototype.stop = function (e, t) { + if (e || t) { + var i = this._scene._activeAnimatables.indexOf(this); + if (i > -1) { + for ( + var n = (o = this._runtimeAnimations).length - 1; + n >= 0; + n-- + ) { + var r = o[n]; + (e && r.animation.name != e) || + (t && !t(r.target)) || + (r.dispose(), o.splice(n, 1)); + } + 0 == o.length && + (this._scene._activeAnimatables.splice(i, 1), + this._raiseOnAnimationEnd()); + } + } else if ( + (n = this._scene._activeAnimatables.indexOf(this)) > -1 + ) { + this._scene._activeAnimatables.splice(n, 1); + var o = this._runtimeAnimations; + for (n = 0; n < o.length; n++) o[n].dispose(); + this._raiseOnAnimationEnd(); + } + }), + (e.prototype.waitAsync = function () { + var e = this; + return new i(function (t, i) { + e.onAnimationEndObservable.add( + function () { + t(e); + }, + void 0, + void 0, + e, + true + ); + }); + }), + (e.prototype._animate = function (e) { + if (this._paused) + return ( + (this.animationStarted = false), + null === this._pausedDelay && (this._pausedDelay = e), + true + ); + if ( + (null === this._localDelayOffset + ? ((this._localDelayOffset = e), + (this._pausedDelay = null)) + : null !== this._pausedDelay && + ((this._localDelayOffset += e - this._pausedDelay), + (this._pausedDelay = null)), 0 === this._weight) - return true; - var t, i = false, n = this._runtimeAnimations; - for (t = 0; t < n.length; t++) { - var r = n[t].animate(e - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight); - i = i || r - } - if (this.animationStarted = i, - !i) { - if (this.disposeOnEnd) - for (t = this._scene._activeAnimatables.indexOf(this), - this._scene._activeAnimatables.splice(t, 1), - t = 0; t < n.length; t++) - n[t].dispose(); - this._raiseOnAnimationEnd(), - this.disposeOnEnd && (this.onAnimationEnd = null, - this.onAnimationLoop = null, + ) + return true; + var t, + i = false, + n = this._runtimeAnimations; + for (t = 0; t < n.length; t++) { + var r = n[t].animate( + e - this._localDelayOffset, + this.fromFrame, + this.toFrame, + this.loopAnimation, + this._speedRatio, + this._weight + ); + i = i || r; + } + if (((this.animationStarted = i), !i)) { + if (this.disposeOnEnd) + for ( + t = this._scene._activeAnimatables.indexOf(this), + this._scene._activeAnimatables.splice(t, 1), + t = 0; + t < n.length; + t++ + ) + n[t].dispose(); + this._raiseOnAnimationEnd(), + this.disposeOnEnd && + ((this.onAnimationEnd = null), + (this.onAnimationLoop = null), this.onAnimationLoopObservable.clear(), - this.onAnimationEndObservable.clear()) - } - return i - } - , + this.onAnimationEndObservable.clear()); + } + return i; + }), e - }(); - Y.a.prototype._animate = function() { - if (this.animationsEnabled) { - var e = this._activeAnimatables; - if (0 !== e.length) { - var t = K.a.Now; - if (!this._animationTimeLast) { - if (this._pendingData.length > 0) - return; - this._animationTimeLast = t - } - var i = this.useConstantAnimationDeltaTime ? 16 : (t - this._animationTimeLast) * this.animationTimeScale; - this._animationTime += i; - var n = this._animationTime; - this._animationTimeLast = t; - for (var r = 0; r < e.length; r++) - e[r]._animate(n); - this._processLateAnimationBindings() - } + ); + })(); + (Y.a.prototype._animate = function () { + if (this.animationsEnabled) { + var e = this._activeAnimatables; + if (0 !== e.length) { + var t = K.a.Now; + if (!this._animationTimeLast) { + if (this._pendingData.length > 0) return; + this._animationTimeLast = t; } + var i = this.useConstantAnimationDeltaTime + ? 16 + : (t - this._animationTimeLast) * this.animationTimeScale; + this._animationTime += i; + var n = this._animationTime; + this._animationTimeLast = t; + for (var r = 0; r < e.length; r++) e[r]._animate(n); + this._processLateAnimationBindings(); + } } - , - Y.a.prototype.beginWeightedAnimation = function(e, t, i, n, r, o, a, s, c, u) { - void 0 === n && (n = 1), - void 0 === o && (o = 1); - var l = this.beginAnimation(e, t, i, r, o, a, s, false, c, u); - return l.weight = n, - l - } - , - Y.a.prototype.beginAnimation = function(e, t, i, n, r, o, a, s, c, u) { - void 0 === r && (r = 1), + }), + (Y.a.prototype.beginWeightedAnimation = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u + ) { + void 0 === n && (n = 1), void 0 === o && (o = 1); + var l = this.beginAnimation(e, t, i, r, o, a, s, false, c, u); + return (l.weight = n), l; + }), + (Y.a.prototype.beginAnimation = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u + ) { + void 0 === r && (r = 1), void 0 === s && (s = true), t > i && r > 0 && (r *= -1), s && this.stopAnimation(e, void 0, c), - a || (a = new Z(this,e,t,i,n,r,o,void 0,u)); - var l = !c || c(e); - if (e.animations && l && a.appendAnimations(e, e.animations), + a || (a = new Z(this, e, t, i, n, r, o, void 0, u)); + var l = !c || c(e); + if ( + (e.animations && l && a.appendAnimations(e, e.animations), e.getAnimatables) - for (var h = e.getAnimatables(), f = 0; f < h.length; f++) - this.beginAnimation(h[f], t, i, n, r, o, a, s, c, u); - return a.reset(), - a - } - , - Y.a.prototype.beginHierarchyAnimation = function(e, t, i, n, r, o, a, s, c, u, l) { - void 0 === o && (o = 1), - void 0 === c && (c = true); - var h = e.getDescendants(t) - , f = []; - f.push(this.beginAnimation(e, i, n, r, o, a, s, c, u)); - for (var d = 0, p = h; d < p.length; d++) { - var m = p[d]; - f.push(this.beginAnimation(m, i, n, r, o, a, s, c, u)) - } - return f - } - , - Y.a.prototype.beginDirectAnimation = function(e, t, i, n, r, o, a, s) { - return void 0 === o && (o = 1), - new Z(this,e,i,n,r,o,a,t,s) - } - , - Y.a.prototype.beginDirectHierarchyAnimation = function(e, t, i, n, r, o, a, s, c) { - var u = e.getDescendants(t) - , l = []; - l.push(this.beginDirectAnimation(e, i, n, r, o, a, s, c)); - for (var h = 0, f = u; h < f.length; h++) { - var d = f[h]; - l.push(this.beginDirectAnimation(d, i, n, r, o, a, s, c)) - } - return l - } - , - Y.a.prototype.getAnimatableByTarget = function(e) { - for (var t = 0; t < this._activeAnimatables.length; t++) - if (this._activeAnimatables[t].target === e) - return this._activeAnimatables[t]; - return null - } - , - Y.a.prototype.getAllAnimatablesByTarget = function(e) { - for (var t = [], i = 0; i < this._activeAnimatables.length; i++) - this._activeAnimatables[i].target === e && t.push(this._activeAnimatables[i]); - return t - } - , - Y.a.prototype.stopAnimation = function(e, t, i) { - for (var n = 0, r = this.getAllAnimatablesByTarget(e); n < r.length; n++) - r[n].stop(t, i) - } - , - Y.a.prototype.stopAllAnimations = function() { - if (this._activeAnimatables) { - for (var e = 0; e < this._activeAnimatables.length; e++) - this._activeAnimatables[e].stop(); - this._activeAnimatables = [] - } - for (var t = 0, i = this.animationGroups; t < i.length; t++) - i[t].stop() - } - , - Y.a.prototype._registerTargetForLateAnimationBinding = function(e, t) { + ) + for (var h = e.getAnimatables(), f = 0; f < h.length; f++) + this.beginAnimation(h[f], t, i, n, r, o, a, s, c, u); + return a.reset(), a; + }), + (Y.a.prototype.beginHierarchyAnimation = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u, + l + ) { + void 0 === o && (o = 1), void 0 === c && (c = true); + var h = e.getDescendants(t), + f = []; + f.push(this.beginAnimation(e, i, n, r, o, a, s, c, u)); + for (var d = 0, p = h; d < p.length; d++) { + var m = p[d]; + f.push(this.beginAnimation(m, i, n, r, o, a, s, c, u)); + } + return f; + }), + (Y.a.prototype.beginDirectAnimation = function ( + e, + t, + i, + n, + r, + o, + a, + s + ) { + return ( + void 0 === o && (o = 1), new Z(this, e, i, n, r, o, a, t, s) + ); + }), + (Y.a.prototype.beginDirectHierarchyAnimation = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u = e.getDescendants(t), + l = []; + l.push(this.beginDirectAnimation(e, i, n, r, o, a, s, c)); + for (var h = 0, f = u; h < f.length; h++) { + var d = f[h]; + l.push(this.beginDirectAnimation(d, i, n, r, o, a, s, c)); + } + return l; + }), + (Y.a.prototype.getAnimatableByTarget = function (e) { + for (var t = 0; t < this._activeAnimatables.length; t++) + if (this._activeAnimatables[t].target === e) + return this._activeAnimatables[t]; + return null; + }), + (Y.a.prototype.getAllAnimatablesByTarget = function (e) { + for ( + var t = [], i = 0; + i < this._activeAnimatables.length; + i++ + ) + this._activeAnimatables[i].target === e && + t.push(this._activeAnimatables[i]); + return t; + }), + (Y.a.prototype.stopAnimation = function (e, t, i) { + for ( + var n = 0, r = this.getAllAnimatablesByTarget(e); + n < r.length; + n++ + ) + r[n].stop(t, i); + }), + (Y.a.prototype.stopAllAnimations = function () { + if (this._activeAnimatables) { + for (var e = 0; e < this._activeAnimatables.length; e++) + this._activeAnimatables[e].stop(); + this._activeAnimatables = []; + } + for (var t = 0, i = this.animationGroups; t < i.length; t++) + i[t].stop(); + }), + (Y.a.prototype._registerTargetForLateAnimationBinding = + function (e, t) { var i = e.target; this._registeredForLateAnimationBindings.pushNoDuplicate(i), - i._lateAnimationHolders || (i._lateAnimationHolders = {}), - i._lateAnimationHolders[e.targetPath] || (i._lateAnimationHolders[e.targetPath] = { - totalWeight: 0, - animations: [], - originalValue: t - }), - i._lateAnimationHolders[e.targetPath].animations.push(e), - i._lateAnimationHolders[e.targetPath].totalWeight += e.weight - } - , - Y.a.prototype._processLateAnimationBindingsForMatrices = function(e) { - var t = 1 - , i = a.t.Vector3[0] - , n = a.t.Vector3[1] - , r = a.t.Quaternion[0] - , o = 0 - , s = e.animations[0] - , c = e.originalValue - , u = 1; + i._lateAnimationHolders || (i._lateAnimationHolders = {}), + i._lateAnimationHolders[e.targetPath] || + (i._lateAnimationHolders[e.targetPath] = { + totalWeight: 0, + animations: [], + originalValue: t, + }), + i._lateAnimationHolders[e.targetPath].animations.push(e), + (i._lateAnimationHolders[e.targetPath].totalWeight += + e.weight); + }), + (Y.a.prototype._processLateAnimationBindingsForMatrices = + function (e) { + var t = 1, + i = a.t.Vector3[0], + n = a.t.Vector3[1], + r = a.t.Quaternion[0], + o = 0, + s = e.animations[0], + c = e.originalValue, + u = 1; if (e.totalWeight < 1) - c.decompose(n, r, i), - u = 1 - e.totalWeight; - else if (o = 1, - t = e.totalWeight, - s.currentValue.decompose(n, r, i), - 1 == (u = s.weight / t)) - return s.currentValue; - n.scaleInPlace(u), - i.scaleInPlace(u), - r.scaleInPlace(u); + c.decompose(n, r, i), (u = 1 - e.totalWeight); + else if ( + ((o = 1), + (t = e.totalWeight), + s.currentValue.decompose(n, r, i), + 1 == (u = s.weight / t)) + ) + return s.currentValue; + n.scaleInPlace(u), i.scaleInPlace(u), r.scaleInPlace(u); for (var l = o; l < e.animations.length; l++) { - var h = e.animations[l] - , f = (u = h.weight / t, - a.t.Vector3[2]) - , d = a.t.Vector3[3] - , p = a.t.Quaternion[1]; - h.currentValue.decompose(d, p, f), + var h = e.animations[l], + f = ((u = h.weight / t), a.t.Vector3[2]), + d = a.t.Vector3[3], + p = a.t.Quaternion[1]; + h.currentValue.decompose(d, p, f), d.scaleAndAddToRef(u, n), p.scaleAndAddToRef(u, r), - f.scaleAndAddToRef(u, i) + f.scaleAndAddToRef(u, i); } var m = s._animationState.workValue; - return a.j.ComposeToRef(n, r, i, m), - m - } - , - Y.a.prototype._processLateAnimationBindingsForQuaternions = function(e, t) { - var i = e.animations[0] - , n = e.originalValue; + return a.j.ComposeToRef(n, r, i, m), m; + }), + (Y.a.prototype._processLateAnimationBindingsForQuaternions = + function (e, t) { + var i = e.animations[0], + n = e.originalValue; if (1 === e.animations.length) - return a.q.SlerpToRef(n, i.currentValue, Math.min(1, e.totalWeight), t), - t; - var r, o, s = 1; + return ( + a.q.SlerpToRef( + n, + i.currentValue, + Math.min(1, e.totalWeight), + t + ), + t + ); + var r, + o, + s = 1; if (e.totalWeight < 1) { - var c = 1 - e.totalWeight; - o = [], - (r = []).push(n), - o.push(c) + var c = 1 - e.totalWeight; + (o = []), (r = []).push(n), o.push(c); } else { - if (2 === e.animations.length) - return a.q.SlerpToRef(e.animations[0].currentValue, e.animations[1].currentValue, e.animations[1].weight / e.totalWeight, t), - t; - r = [], - o = [], - s = e.totalWeight + if (2 === e.animations.length) + return ( + a.q.SlerpToRef( + e.animations[0].currentValue, + e.animations[1].currentValue, + e.animations[1].weight / e.totalWeight, + t + ), + t + ); + (r = []), (o = []), (s = e.totalWeight); } for (var u = 0; u < e.animations.length; u++) { - var l = e.animations[u]; - r.push(l.currentValue), - o.push(l.weight / s) + var l = e.animations[u]; + r.push(l.currentValue), o.push(l.weight / s); } for (var h = 0, f = null, d = 0; d < r.length; ) - f ? (h += o[d], - a.q.SlerpToRef(f, r[d], o[d] / h, f), - d++) : (a.q.SlerpToRef(r[d], r[d + 1], o[d + 1] / (o[d] + o[d + 1]), t), - f = t, - h = o[d] + o[d + 1], - d += 2); - return f - } - , - Y.a.prototype._processLateAnimationBindings = function() { - if (this._registeredForLateAnimationBindings.length) { - for (var e = 0; e < this._registeredForLateAnimationBindings.length; e++) { - var t = this._registeredForLateAnimationBindings.data[e]; - for (var i in t._lateAnimationHolders) { - var n = t._lateAnimationHolders[i] - , r = n.animations[0] - , o = n.originalValue - , s = U.AllowMatrixDecomposeForInterpolation && o.m - , c = t[i]; - if (s) - c = this._processLateAnimationBindingsForMatrices(n); - else if (void 0 !== o.w) - c = this._processLateAnimationBindingsForQuaternions(n, c || a.q.Identity()); - else { - var u = 0 - , l = 1; - if (n.totalWeight < 1) - c = o.scale ? o.scale(1 - n.totalWeight) : o * (1 - n.totalWeight); - else { - l = n.totalWeight; - var h = r.weight / l; - c = 1 !== h ? r.currentValue.scale ? r.currentValue.scale(h) : r.currentValue * h : r.currentValue, - u = 1 - } - for (var f = u; f < n.animations.length; f++) { - var d = n.animations[f] - , p = d.weight / l; - d.currentValue.scaleAndAddToRef ? d.currentValue.scaleAndAddToRef(p, c) : c += d.currentValue * p - } - } - t[i] = c - } - t._lateAnimationHolders = {} + f + ? ((h += o[d]), + a.q.SlerpToRef(f, r[d], o[d] / h, f), + d++) + : (a.q.SlerpToRef( + r[d], + r[d + 1], + o[d + 1] / (o[d] + o[d + 1]), + t + ), + (f = t), + (h = o[d] + o[d + 1]), + (d += 2)); + return f; + }), + (Y.a.prototype._processLateAnimationBindings = function () { + if (this._registeredForLateAnimationBindings.length) { + for ( + var e = 0; + e < this._registeredForLateAnimationBindings.length; + e++ + ) { + var t = this._registeredForLateAnimationBindings.data[e]; + for (var i in t._lateAnimationHolders) { + var n = t._lateAnimationHolders[i], + r = n.animations[0], + o = n.originalValue, + s = U.AllowMatrixDecomposeForInterpolation && o.m, + c = t[i]; + if (s) + c = this._processLateAnimationBindingsForMatrices(n); + else if (void 0 !== o.w) + c = this._processLateAnimationBindingsForQuaternions( + n, + c || a.q.Identity() + ); + else { + var u = 0, + l = 1; + if (n.totalWeight < 1) + c = o.scale + ? o.scale(1 - n.totalWeight) + : o * (1 - n.totalWeight); + else { + l = n.totalWeight; + var h = r.weight / l; + (c = + 1 !== h + ? r.currentValue.scale + ? r.currentValue.scale(h) + : r.currentValue * h + : r.currentValue), + (u = 1); + } + for (var f = u; f < n.animations.length; f++) { + var d = n.animations[f], + p = d.weight / l; + d.currentValue.scaleAndAddToRef + ? d.currentValue.scaleAndAddToRef(p, c) + : (c += d.currentValue * p); + } } - this._registeredForLateAnimationBindings.reset() + t[i] = c; + } + t._lateAnimationHolders = {}; } - } - , - q.prototype.copyAnimationRange = function(e, t, i, n, r) { - void 0 === n && (n = false), + this._registeredForLateAnimationBindings.reset(); + } + }), + (q.prototype.copyAnimationRange = function (e, t, i, n, r) { + void 0 === n && (n = false), void 0 === r && (r = null), - 0 === this.animations.length && (this.animations.push(new U(this.name,"_matrix",e.animations[0].framePerSecond,U.ANIMATIONTYPE_MATRIX,0)), - this.animations[0].setKeys([])); - var o = e.animations[0].getRange(t); - if (!o) - return false; - for (var a, s, c, u = o.from, l = o.to, h = e.animations[0].getKeys(), f = e.length, d = e.getParent(), p = this.getParent(), m = n && d && f && this.length && f !== this.length, g = m && p && d ? p.length / d.length : 1, _ = n && !p && r && (1 !== r.x || 1 !== r.y || 1 !== r.z), v = this.animations[0].getKeys(), y = 0, b = h.length; y < b; y++) - (a = h[y]).frame >= u && a.frame <= l && (n ? (c = a.value.clone(), - m ? (s = c.getTranslation(), - c.setTranslation(s.scaleInPlace(g))) : _ && r ? (s = c.getTranslation(), - c.setTranslation(s.multiplyInPlace(r))) : c = a.value) : c = a.value, - v.push({ - frame: a.frame + i, - value: c - })); - return this.animations[0].createRange(t, u + i, l + i), - true - } - ; - var J = function() {} - , $ = function() { - function e(e, t) { - void 0 === t && (t = null), - this.name = e, - this._targetedAnimations = new Array, - this._animatables = new Array, - this._from = Number.MAX_VALUE, - this._to = -Number.MAX_VALUE, - this._speedRatio = 1, - this._loopAnimation = false, - this.onAnimationEndObservable = new o.c, - this.onAnimationLoopObservable = new o.c, - this.onAnimationGroupEndObservable = new o.c, - this.onAnimationGroupPauseObservable = new o.c, - this.onAnimationGroupPlayObservable = new o.c, - this._scene = t || R.a.LastCreatedScene, - this.uniqueId = this._scene.getUniqueId(), - this._scene.animationGroups.push(this) - } - return Object.defineProperty(e.prototype, "from", { - get: function() { - return this._from - }, - enumerable: true, - configurable: true + 0 === this.animations.length && + (this.animations.push( + new U( + this.name, + "_matrix", + e.animations[0].framePerSecond, + U.ANIMATIONTYPE_MATRIX, + 0 + ) + ), + this.animations[0].setKeys([])); + var o = e.animations[0].getRange(t); + if (!o) return false; + for ( + var a, + s, + c, + u = o.from, + l = o.to, + h = e.animations[0].getKeys(), + f = e.length, + d = e.getParent(), + p = this.getParent(), + m = n && d && f && this.length && f !== this.length, + g = m && p && d ? p.length / d.length : 1, + _ = n && !p && r && (1 !== r.x || 1 !== r.y || 1 !== r.z), + v = this.animations[0].getKeys(), + y = 0, + b = h.length; + y < b; + y++ + ) + (a = h[y]).frame >= u && + a.frame <= l && + (n + ? ((c = a.value.clone()), + m + ? ((s = c.getTranslation()), + c.setTranslation(s.scaleInPlace(g))) + : _ && r + ? ((s = c.getTranslation()), + c.setTranslation(s.multiplyInPlace(r))) + : (c = a.value)) + : (c = a.value), + v.push({ + frame: a.frame + i, + value: c, + })); + return this.animations[0].createRange(t, u + i, l + i), true; + }); + var J = function () {}, + $ = (function () { + function e(e, t) { + void 0 === t && (t = null), + (this.name = e), + (this._targetedAnimations = new Array()), + (this._animatables = new Array()), + (this._from = Number.MAX_VALUE), + (this._to = -Number.MAX_VALUE), + (this._speedRatio = 1), + (this._loopAnimation = false), + (this.onAnimationEndObservable = new o.c()), + (this.onAnimationLoopObservable = new o.c()), + (this.onAnimationGroupEndObservable = new o.c()), + (this.onAnimationGroupPauseObservable = new o.c()), + (this.onAnimationGroupPlayObservable = new o.c()), + (this._scene = t || R.a.LastCreatedScene), + (this.uniqueId = this._scene.getUniqueId()), + this._scene.animationGroups.push(this); + } + return ( + Object.defineProperty(e.prototype, "from", { + get: function () { + return this._from; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "to", { - get: function() { - return this._to - }, - enumerable: true, - configurable: true + get: function () { + return this._to; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isStarted", { - get: function() { - return this._isStarted - }, - enumerable: true, - configurable: true + get: function () { + return this._isStarted; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isPlaying", { - get: function() { - return this._isStarted && !this._isPaused - }, - enumerable: true, - configurable: true + get: function () { + return this._isStarted && !this._isPaused; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "speedRatio", { - get: function() { - return this._speedRatio - }, - set: function(e) { - if (this._speedRatio !== e) { - this._speedRatio = e; - for (var t = 0; t < this._animatables.length; t++) - this._animatables[t].speedRatio = this._speedRatio - } - }, - enumerable: true, - configurable: true + get: function () { + return this._speedRatio; + }, + set: function (e) { + if (this._speedRatio !== e) { + this._speedRatio = e; + for (var t = 0; t < this._animatables.length; t++) + this._animatables[t].speedRatio = this._speedRatio; + } + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "loopAnimation", { - get: function() { - return this._loopAnimation - }, - set: function(e) { - if (this._loopAnimation !== e) { - this._loopAnimation = e; - for (var t = 0; t < this._animatables.length; t++) - this._animatables[t].loopAnimation = this._loopAnimation - } - }, - enumerable: true, - configurable: true + get: function () { + return this._loopAnimation; + }, + set: function (e) { + if (this._loopAnimation !== e) { + this._loopAnimation = e; + for (var t = 0; t < this._animatables.length; t++) + this._animatables[t].loopAnimation = + this._loopAnimation; + } + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "targetedAnimations", { - get: function() { - return this._targetedAnimations - }, - enumerable: true, - configurable: true + get: function () { + return this._targetedAnimations; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "animatables", { - get: function() { - return this._animatables - }, - enumerable: true, - configurable: true + get: function () { + return this._animatables; + }, + enumerable: true, + configurable: true, }), - e.prototype.addTargetedAnimation = function(e, t) { - var i = { - animation: e, - target: t - } - , n = e.getKeys(); - return this._from > n[0].frame && (this._from = n[0].frame), - this._to < n[n.length - 1].frame && (this._to = n[n.length - 1].frame), + (e.prototype.addTargetedAnimation = function (e, t) { + var i = { + animation: e, + target: t, + }, + n = e.getKeys(); + return ( + this._from > n[0].frame && (this._from = n[0].frame), + this._to < n[n.length - 1].frame && + (this._to = n[n.length - 1].frame), this._targetedAnimations.push(i), i - } - , - e.prototype.normalize = function(e, t) { - void 0 === e && (e = null), + ); + }), + (e.prototype.normalize = function (e, t) { + void 0 === e && (e = null), void 0 === t && (t = null), null == e && (e = this._from), null == t && (t = this._to); - for (var i = 0; i < this._targetedAnimations.length; i++) { - var n = this._targetedAnimations[i].animation.getKeys() - , r = n[0] - , o = n[n.length - 1]; - if (r.frame > e) { - var a = { - frame: e, - value: r.value, - inTangent: r.inTangent, - outTangent: r.outTangent, - interpolation: r.interpolation - }; - n.splice(0, 0, a) - } - o.frame < t && (a = { - frame: t, - value: o.value, - inTangent: o.outTangent, - outTangent: o.outTangent, - interpolation: o.interpolation - }, - n.push(a)) + for ( + var i = 0; + i < this._targetedAnimations.length; + i++ + ) { + var n = this._targetedAnimations[i].animation.getKeys(), + r = n[0], + o = n[n.length - 1]; + if (r.frame > e) { + var a = { + frame: e, + value: r.value, + inTangent: r.inTangent, + outTangent: r.outTangent, + interpolation: r.interpolation, + }; + n.splice(0, 0, a); } - return this._from = e, - this._to = t, - this - } - , - e.prototype.start = function(e, t, i, n) { - var r = this; - if (void 0 === e && (e = false), + o.frame < t && + ((a = { + frame: t, + value: o.value, + inTangent: o.outTangent, + outTangent: o.outTangent, + interpolation: o.interpolation, + }), + n.push(a)); + } + return (this._from = e), (this._to = t), this; + }), + (e.prototype.start = function (e, t, i, n) { + var r = this; + if ( + (void 0 === e && (e = false), void 0 === t && (t = 1), - this._isStarted || 0 === this._targetedAnimations.length) - return this; - this._loopAnimation = e; - for (var o = function(o) { - var s = a._scene.beginDirectAnimation(o.target, [o.animation], void 0 !== i ? i : a._from, void 0 !== n ? n : a._to, e, t); - s.onAnimationEnd = function() { - r.onAnimationEndObservable.notifyObservers(o), - r._checkAnimationGroupEnded(s) - } - , - s.onAnimationLoop = function() { - r.onAnimationLoopObservable.notifyObservers(o) - } - , - a._animatables.push(s) - }, a = this, s = 0, c = this._targetedAnimations; s < c.length; s++) - o(c[s]); - if (this._speedRatio = t, - void 0 !== i && void 0 !== n) - if (i < n && this._speedRatio < 0) { - var u = n; - n = i, - i = u - } else - i > n && this._speedRatio > 0 && (this._speedRatio = -t); - return this._isStarted = true, - this._isPaused = false, - this.onAnimationGroupPlayObservable.notifyObservers(this), + this._isStarted || + 0 === this._targetedAnimations.length) + ) + return this; + this._loopAnimation = e; + for ( + var o = function (o) { + var s = a._scene.beginDirectAnimation( + o.target, + [o.animation], + void 0 !== i ? i : a._from, + void 0 !== n ? n : a._to, + e, + t + ); + (s.onAnimationEnd = function () { + r.onAnimationEndObservable.notifyObservers(o), + r._checkAnimationGroupEnded(s); + }), + (s.onAnimationLoop = function () { + r.onAnimationLoopObservable.notifyObservers(o); + }), + a._animatables.push(s); + }, + a = this, + s = 0, + c = this._targetedAnimations; + s < c.length; + s++ + ) + o(c[s]); + if ( + ((this._speedRatio = t), void 0 !== i && void 0 !== n) + ) + if (i < n && this._speedRatio < 0) { + var u = n; + (n = i), (i = u); + } else + i > n && + this._speedRatio > 0 && + (this._speedRatio = -t); + return ( + (this._isStarted = true), + (this._isPaused = false), + this.onAnimationGroupPlayObservable.notifyObservers( + this + ), this - } - , - e.prototype.pause = function() { - if (!this._isStarted) - return this; - this._isPaused = true; - for (var e = 0; e < this._animatables.length; e++) - this._animatables[e].pause(); - return this.onAnimationGroupPauseObservable.notifyObservers(this), + ); + }), + (e.prototype.pause = function () { + if (!this._isStarted) return this; + this._isPaused = true; + for (var e = 0; e < this._animatables.length; e++) + this._animatables[e].pause(); + return ( + this.onAnimationGroupPauseObservable.notifyObservers( + this + ), this - } - , - e.prototype.play = function(e) { - return this.isStarted && this._animatables.length === this._targetedAnimations.length ? (void 0 !== e && (this.loopAnimation = e), - this.restart()) : (this.stop(), - this.start(e, this._speedRatio)), - this._isPaused = false, + ); + }), + (e.prototype.play = function (e) { + return ( + this.isStarted && + this._animatables.length === + this._targetedAnimations.length + ? (void 0 !== e && (this.loopAnimation = e), + this.restart()) + : (this.stop(), this.start(e, this._speedRatio)), + (this._isPaused = false), this - } - , - e.prototype.reset = function() { - if (!this._isStarted) - return this; - for (var e = 0; e < this._animatables.length; e++) - this._animatables[e].reset(); - return this - } - , - e.prototype.restart = function() { - if (!this._isStarted) - return this; - for (var e = 0; e < this._animatables.length; e++) - this._animatables[e].restart(); - return this.onAnimationGroupPlayObservable.notifyObservers(this), + ); + }), + (e.prototype.reset = function () { + if (!this._isStarted) return this; + for (var e = 0; e < this._animatables.length; e++) + this._animatables[e].reset(); + return this; + }), + (e.prototype.restart = function () { + if (!this._isStarted) return this; + for (var e = 0; e < this._animatables.length; e++) + this._animatables[e].restart(); + return ( + this.onAnimationGroupPlayObservable.notifyObservers( + this + ), this - } - , - e.prototype.stop = function() { - if (!this._isStarted) - return this; - for (var e = this._animatables.slice(), t = 0; t < e.length; t++) - e[t].stop(); - return this._isStarted = false, - this - } - , - e.prototype.setWeightForAllAnimatables = function(e) { - for (var t = 0; t < this._animatables.length; t++) - this._animatables[t].weight = e; - return this - } - , - e.prototype.syncAllAnimationsWith = function(e) { - for (var t = 0; t < this._animatables.length; t++) - this._animatables[t].syncWith(e); - return this - } - , - e.prototype.goToFrame = function(e) { - if (!this._isStarted) - return this; - for (var t = 0; t < this._animatables.length; t++) - this._animatables[t].goToFrame(e); - return this - } - , - e.prototype.dispose = function() { - this._targetedAnimations = [], - this._animatables = []; - var e = this._scene.animationGroups.indexOf(this); - e > -1 && this._scene.animationGroups.splice(e, 1), + ); + }), + (e.prototype.stop = function () { + if (!this._isStarted) return this; + for ( + var e = this._animatables.slice(), t = 0; + t < e.length; + t++ + ) + e[t].stop(); + return (this._isStarted = false), this; + }), + (e.prototype.setWeightForAllAnimatables = function (e) { + for (var t = 0; t < this._animatables.length; t++) + this._animatables[t].weight = e; + return this; + }), + (e.prototype.syncAllAnimationsWith = function (e) { + for (var t = 0; t < this._animatables.length; t++) + this._animatables[t].syncWith(e); + return this; + }), + (e.prototype.goToFrame = function (e) { + if (!this._isStarted) return this; + for (var t = 0; t < this._animatables.length; t++) + this._animatables[t].goToFrame(e); + return this; + }), + (e.prototype.dispose = function () { + (this._targetedAnimations = []), (this._animatables = []); + var e = this._scene.animationGroups.indexOf(this); + e > -1 && this._scene.animationGroups.splice(e, 1), this.onAnimationEndObservable.clear(), this.onAnimationGroupEndObservable.clear(), this.onAnimationGroupPauseObservable.clear(), this.onAnimationGroupPlayObservable.clear(), - this.onAnimationLoopObservable.clear() - } - , - e.prototype._checkAnimationGroupEnded = function(e) { - var t = this._animatables.indexOf(e); - t > -1 && this._animatables.splice(t, 1), - 0 === this._animatables.length && (this._isStarted = false, - this.onAnimationGroupEndObservable.notifyObservers(this)) - } - , - e.prototype.clone = function(t, i) { - for (var n = new e(t || this.name,this._scene), r = 0, o = this._targetedAnimations; r < o.length; r++) { - var a = o[r]; - n.addTargetedAnimation(a.animation.clone(), i ? i(a.target) : a.target) + this.onAnimationLoopObservable.clear(); + }), + (e.prototype._checkAnimationGroupEnded = function (e) { + var t = this._animatables.indexOf(e); + t > -1 && this._animatables.splice(t, 1), + 0 === this._animatables.length && + ((this._isStarted = false), + this.onAnimationGroupEndObservable.notifyObservers( + this + )); + }), + (e.prototype.clone = function (t, i) { + for ( + var n = new e(t || this.name, this._scene), + r = 0, + o = this._targetedAnimations; + r < o.length; + r++ + ) { + var a = o[r]; + n.addTargetedAnimation( + a.animation.clone(), + i ? i(a.target) : a.target + ); + } + return n; + }), + (e.Parse = function (t, i) { + for ( + var n = new e(t.name, i), r = 0; + r < t.targetedAnimations.length; + r++ + ) { + var o = t.targetedAnimations[r], + a = U.Parse(o.animation), + s = o.targetId; + if ("influence" === o.animation.property) { + var c = i.getMorphTargetById(s); + c && n.addTargetedAnimation(a, c); + } else { + var u = i.getNodeByID(s); + null != u && n.addTargetedAnimation(a, u); } - return n - } - , - e.Parse = function(t, i) { - for (var n = new e(t.name,i), r = 0; r < t.targetedAnimations.length; r++) { - var o = t.targetedAnimations[r] - , a = U.Parse(o.animation) - , s = o.targetId; - if ("influence" === o.animation.property) { - var c = i.getMorphTargetById(s); - c && n.addTargetedAnimation(a, c) - } else { - var u = i.getNodeByID(s); - null != u && n.addTargetedAnimation(a, u) - } - } - return null !== t.from && null !== t.from && n.normalize(t.from, t.to), + } + return ( + null !== t.from && + null !== t.from && + n.normalize(t.from, t.to), n - } - , - e.prototype.getClassName = function() { - return "AnimationGroup" - } - , - e.prototype.toString = function(e) { - var t = "Name: " + this.name; - return t += ", type: " + this.getClassName(), - e && (t += ", from: " + this._from, - t += ", to: " + this._to, - t += ", isStarted: " + this._isStarted, - t += ", speedRatio: " + this._speedRatio, - t += ", targetedAnimations length: " + this._targetedAnimations.length, - t += ", animatables length: " + this._animatables), + ); + }), + (e.prototype.getClassName = function () { + return "AnimationGroup"; + }), + (e.prototype.toString = function (e) { + var t = "Name: " + this.name; + return ( + (t += ", type: " + this.getClassName()), + e && + ((t += ", from: " + this._from), + (t += ", to: " + this._to), + (t += ", isStarted: " + this._isStarted), + (t += ", speedRatio: " + this._speedRatio), + (t += + ", targetedAnimations length: " + + this._targetedAnimations.length), + (t += ", animatables length: " + this._animatables)), t - } - , + ); + }), e - }() - , ee = function() { - this.enableBlending = false, - this.blendingSpeed = .01, - this.loopMode = U.ANIMATIONLOOPMODE_CYCLE - } - , te = function() { - function e() { - this._easingMode = e.EASINGMODE_EASEIN - } - return e.prototype.setEasingMode = function(e) { - var t = Math.min(Math.max(e, 0), 2); - this._easingMode = t - } - , - e.prototype.getEasingMode = function() { - return this._easingMode - } - , - e.prototype.easeInCore = function(e) { - throw new Error("You must implement this method") - } - , - e.prototype.ease = function(t) { - switch (this._easingMode) { + ); + })(), + ee = function () { + (this.enableBlending = false), + (this.blendingSpeed = 0.01), + (this.loopMode = U.ANIMATIONLOOPMODE_CYCLE); + }, + te = (function () { + function e() { + this._easingMode = e.EASINGMODE_EASEIN; + } + return ( + (e.prototype.setEasingMode = function (e) { + var t = Math.min(Math.max(e, 0), 2); + this._easingMode = t; + }), + (e.prototype.getEasingMode = function () { + return this._easingMode; + }), + (e.prototype.easeInCore = function (e) { + throw new Error("You must implement this method"); + }), + (e.prototype.ease = function (t) { + switch (this._easingMode) { case e.EASINGMODE_EASEIN: - return this.easeInCore(t); + return this.easeInCore(t); case e.EASINGMODE_EASEOUT: - return 1 - this.easeInCore(1 - t) - } - return t >= .5 ? .5 * (1 - this.easeInCore(2 * (1 - t))) + .5 : .5 * this.easeInCore(2 * t) - } - , - e.EASINGMODE_EASEIN = 0, - e.EASINGMODE_EASEOUT = 1, - e.EASINGMODE_EASEINOUT = 2, + return 1 - this.easeInCore(1 - t); + } + return t >= 0.5 + ? 0.5 * (1 - this.easeInCore(2 * (1 - t))) + 0.5 + : 0.5 * this.easeInCore(2 * t); + }), + (e.EASINGMODE_EASEIN = 0), + (e.EASINGMODE_EASEOUT = 1), + (e.EASINGMODE_EASEINOUT = 2), e - }() - , ie = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - return e = Math.max(0, Math.min(1, e)), + ); + })(), + ie = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + return ( + (e = Math.max(0, Math.min(1, e))), 1 - Math.sqrt(1 - e * e) - } - , + ); + }), t - }(te) - , ne = function(e) { - function t(t) { - void 0 === t && (t = 1); - var i = e.call(this) || this; - return i.amplitude = t, - i - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - var t = Math.max(0, this.amplitude); - return Math.pow(e, 3) - e * t * Math.sin(3.141592653589793 * e) - } - , + ); + })(te), + ne = (function (e) { + function t(t) { + void 0 === t && (t = 1); + var i = e.call(this) || this; + return (i.amplitude = t), i; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + var t = Math.max(0, this.amplitude); + return ( + Math.pow(e, 3) - e * t * Math.sin(3.141592653589793 * e) + ); + }), t - }(te) - , re = function(e) { - function t(t, i) { - void 0 === t && (t = 3), - void 0 === i && (i = 2); - var n = e.call(this) || this; - return n.bounces = t, - n.bounciness = i, - n - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - var t = Math.max(0, this.bounces) - , i = this.bounciness; - i <= 1 && (i = 1.001); - var n = Math.pow(i, t) - , r = 1 - i - , o = (1 - n) / r + .5 * n - , a = e * o - , s = Math.log(-a * (1 - i) + 1) / Math.log(i) - , c = Math.floor(s) - , u = c + 1 - , l = (1 - Math.pow(i, c)) / (r * o) - , h = .5 * (l + (1 - Math.pow(i, u)) / (r * o)) - , f = e - h - , d = h - l; - return -Math.pow(1 / i, t - c) / (d * d) * (f - d) * (f + d) - } - , + ); + })(te), + re = (function (e) { + function t(t, i) { + void 0 === t && (t = 3), void 0 === i && (i = 2); + var n = e.call(this) || this; + return (n.bounces = t), (n.bounciness = i), n; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + var t = Math.max(0, this.bounces), + i = this.bounciness; + i <= 1 && (i = 1.001); + var n = Math.pow(i, t), + r = 1 - i, + o = (1 - n) / r + 0.5 * n, + a = e * o, + s = Math.log(-a * (1 - i) + 1) / Math.log(i), + c = Math.floor(s), + u = c + 1, + l = (1 - Math.pow(i, c)) / (r * o), + h = 0.5 * (l + (1 - Math.pow(i, u)) / (r * o)), + f = e - h, + d = h - l; + return ( + (-Math.pow(1 / i, t - c) / (d * d)) * (f - d) * (f + d) + ); + }), t - }(te) - , oe = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - return e * e * e - } - , + ); + })(te), + oe = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + return e * e * e; + }), t - }(te) - , ae = function(e) { - function t(t, i) { - void 0 === t && (t = 3), - void 0 === i && (i = 3); - var n = e.call(this) || this; - return n.oscillations = t, - n.springiness = i, - n - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - var t = Math.max(0, this.oscillations) - , i = Math.max(0, this.springiness); - return (0 == i ? e : (Math.exp(i * e) - 1) / (Math.exp(i) - 1)) * Math.sin((6.283185307179586 * t + 1.5707963267948966) * e) - } - , + ); + })(te), + ae = (function (e) { + function t(t, i) { + void 0 === t && (t = 3), void 0 === i && (i = 3); + var n = e.call(this) || this; + return (n.oscillations = t), (n.springiness = i), n; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + var t = Math.max(0, this.oscillations), + i = Math.max(0, this.springiness); + return ( + (0 == i + ? e + : (Math.exp(i * e) - 1) / (Math.exp(i) - 1)) * + Math.sin( + (6.283185307179586 * t + 1.5707963267948966) * e + ) + ); + }), t - }(te) - , se = function(e) { - function t(t) { - void 0 === t && (t = 2); - var i = e.call(this) || this; - return i.exponent = t, - i - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - return this.exponent <= 0 ? e : (Math.exp(this.exponent * e) - 1) / (Math.exp(this.exponent) - 1) - } - , + ); + })(te), + se = (function (e) { + function t(t) { + void 0 === t && (t = 2); + var i = e.call(this) || this; + return (i.exponent = t), i; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + return this.exponent <= 0 + ? e + : (Math.exp(this.exponent * e) - 1) / + (Math.exp(this.exponent) - 1); + }), t - }(te) - , ce = function(e) { - function t(t) { - void 0 === t && (t = 2); - var i = e.call(this) || this; - return i.power = t, - i - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - var t = Math.max(0, this.power); - return Math.pow(e, t) - } - , + ); + })(te), + ce = (function (e) { + function t(t) { + void 0 === t && (t = 2); + var i = e.call(this) || this; + return (i.power = t), i; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + var t = Math.max(0, this.power); + return Math.pow(e, t); + }), t - }(te) - , ue = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - return e * e - } - , + ); + })(te), + ue = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + return e * e; + }), t - }(te) - , le = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - return e * e * e * e - } - , + ); + })(te), + le = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + return e * e * e * e; + }), t - }(te) - , he = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - return e * e * e * e * e - } - , + ); + })(te), + he = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + return e * e * e * e * e; + }), t - }(te) - , fe = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - return 1 - Math.sin(1.5707963267948966 * (1 - e)) - } - , + ); + })(te), + fe = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + return 1 - Math.sin(1.5707963267948966 * (1 - e)); + }), t - }(te) - , de = function(e) { - function t(t, i, n, r) { - void 0 === t && (t = 0), - void 0 === i && (i = 0), - void 0 === n && (n = 1), - void 0 === r && (r = 1); - var o = e.call(this) || this; - return o.x1 = t, - o.y1 = i, - o.x2 = n, - o.y2 = r, - o - } - return h.d(t, e), - t.prototype.easeInCore = function(e) { - return a.d.Interpolate(e, this.x1, this.y1, this.x2, this.y2) - } - , + ); + })(te), + de = (function (e) { + function t(t, i, n, r) { + void 0 === t && (t = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 1), + void 0 === r && (r = 1); + var o = e.call(this) || this; + return (o.x1 = t), (o.y1 = i), (o.x2 = n), (o.y2 = r), o; + } + return ( + h.d(t, e), + (t.prototype.easeInCore = function (e) { + return a.d.Interpolate( + e, + this.x1, + this.y1, + this.x2, + this.y2 + ); + }), t - }(te) - , pe = function() { - function e(e, t, i) { - this.frame = e, - this.action = t, - this.onlyOnce = i, - this.isDone = false - } - return e.prototype._clone = function() { - return new e(this.frame,this.action,this.onlyOnce) - } - , + ); + })(te), + pe = (function () { + function e(e, t, i) { + (this.frame = e), + (this.action = t), + (this.onlyOnce = i), + (this.isDone = false); + } + return ( + (e.prototype._clone = function () { + return new e(this.frame, this.action, this.onlyOnce); + }), e - }() - , me = n(11) - , ge = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t - }(r.a) - , _e = function(e) { - function t(t) { - var i = e.call(this) || this; - return i.scene = t, - i.sounds = [], - i.effectLayers = [], - i.layers = [], - i.lensFlareSystems = [], - i.proceduralTextures = [], - i.reflectionProbes = [], - i - } - return h.d(t, e), - t.prototype.addAllToScene = function() { - var e = this; - this.cameras.forEach(function(t) { - e.scene.addCamera(t) + ); + })(), + me = n(11), + ge = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return h.d(t, e), t; + })(r.a), + _e = (function (e) { + function t(t) { + var i = e.call(this) || this; + return ( + (i.scene = t), + (i.sounds = []), + (i.effectLayers = []), + (i.layers = []), + (i.lensFlareSystems = []), + (i.proceduralTextures = []), + (i.reflectionProbes = []), + i + ); + } + return ( + h.d(t, e), + (t.prototype.addAllToScene = function () { + var e = this; + this.cameras.forEach(function (t) { + e.scene.addCamera(t); + }), + this.lights.forEach(function (t) { + e.scene.addLight(t); }), - this.lights.forEach(function(t) { - e.scene.addLight(t) + this.meshes.forEach(function (t) { + e.scene.addMesh(t); }), - this.meshes.forEach(function(t) { - e.scene.addMesh(t) + this.skeletons.forEach(function (t) { + e.scene.addSkeleton(t); }), - this.skeletons.forEach(function(t) { - e.scene.addSkeleton(t) + this.animations.forEach(function (t) { + e.scene.addAnimation(t); }), - this.animations.forEach(function(t) { - e.scene.addAnimation(t) + this.animationGroups.forEach(function (t) { + e.scene.addAnimationGroup(t); }), - this.animationGroups.forEach(function(t) { - e.scene.addAnimationGroup(t) + this.multiMaterials.forEach(function (t) { + e.scene.addMultiMaterial(t); }), - this.multiMaterials.forEach(function(t) { - e.scene.addMultiMaterial(t) + this.materials.forEach(function (t) { + e.scene.addMaterial(t); }), - this.materials.forEach(function(t) { - e.scene.addMaterial(t) + this.morphTargetManagers.forEach(function (t) { + e.scene.addMorphTargetManager(t); }), - this.morphTargetManagers.forEach(function(t) { - e.scene.addMorphTargetManager(t) + this.geometries.forEach(function (t) { + e.scene.addGeometry(t); }), - this.geometries.forEach(function(t) { - e.scene.addGeometry(t) + this.transformNodes.forEach(function (t) { + e.scene.addTransformNode(t); }), - this.transformNodes.forEach(function(t) { - e.scene.addTransformNode(t) + this.actionManagers.forEach(function (t) { + e.scene.addActionManager(t); }), - this.actionManagers.forEach(function(t) { - e.scene.addActionManager(t) + this.textures.forEach(function (t) { + e.scene.addTexture(t); }), - this.textures.forEach(function(t) { - e.scene.addTexture(t) + this.reflectionProbes.forEach(function (t) { + e.scene.addReflectionProbe(t); }), - this.reflectionProbes.forEach(function(t) { - e.scene.addReflectionProbe(t) + this.environmentTexture && + (this.scene.environmentTexture = + this.environmentTexture); + for ( + var t = 0, i = this.scene._serializableComponents; + t < i.length; + t++ + ) + i[t].addFromContainer(this); + }), + (t.prototype.removeAllFromScene = function () { + var e = this; + this.cameras.forEach(function (t) { + e.scene.removeCamera(t); + }), + this.lights.forEach(function (t) { + e.scene.removeLight(t); }), - this.environmentTexture && (this.scene.environmentTexture = this.environmentTexture); - for (var t = 0, i = this.scene._serializableComponents; t < i.length; t++) - i[t].addFromContainer(this) - } - , - t.prototype.removeAllFromScene = function() { - var e = this; - this.cameras.forEach(function(t) { - e.scene.removeCamera(t) + this.meshes.forEach(function (t) { + e.scene.removeMesh(t); }), - this.lights.forEach(function(t) { - e.scene.removeLight(t) + this.skeletons.forEach(function (t) { + e.scene.removeSkeleton(t); }), - this.meshes.forEach(function(t) { - e.scene.removeMesh(t) + this.animations.forEach(function (t) { + e.scene.removeAnimation(t); }), - this.skeletons.forEach(function(t) { - e.scene.removeSkeleton(t) + this.animationGroups.forEach(function (t) { + e.scene.removeAnimationGroup(t); }), - this.animations.forEach(function(t) { - e.scene.removeAnimation(t) + this.multiMaterials.forEach(function (t) { + e.scene.removeMultiMaterial(t); }), - this.animationGroups.forEach(function(t) { - e.scene.removeAnimationGroup(t) + this.materials.forEach(function (t) { + e.scene.removeMaterial(t); }), - this.multiMaterials.forEach(function(t) { - e.scene.removeMultiMaterial(t) + this.morphTargetManagers.forEach(function (t) { + e.scene.removeMorphTargetManager(t); }), - this.materials.forEach(function(t) { - e.scene.removeMaterial(t) + this.geometries.forEach(function (t) { + e.scene.removeGeometry(t); }), - this.morphTargetManagers.forEach(function(t) { - e.scene.removeMorphTargetManager(t) + this.transformNodes.forEach(function (t) { + e.scene.removeTransformNode(t); }), - this.geometries.forEach(function(t) { - e.scene.removeGeometry(t) + this.actionManagers.forEach(function (t) { + e.scene.removeActionManager(t); }), - this.transformNodes.forEach(function(t) { - e.scene.removeTransformNode(t) + this.textures.forEach(function (t) { + e.scene.removeTexture(t); }), - this.actionManagers.forEach(function(t) { - e.scene.removeActionManager(t) + this.reflectionProbes.forEach(function (t) { + e.scene.removeReflectionProbe(t); }), - this.textures.forEach(function(t) { - e.scene.removeTexture(t) + this.environmentTexture === + this.scene.environmentTexture && + (this.scene.environmentTexture = null); + for ( + var t = 0, i = this.scene._serializableComponents; + t < i.length; + t++ + ) + i[t].removeFromContainer(this); + }), + (t.prototype.dispose = function () { + this.cameras.forEach(function (e) { + e.dispose(); + }), + (this.cameras = []), + this.lights.forEach(function (e) { + e.dispose(); }), - this.reflectionProbes.forEach(function(t) { - e.scene.removeReflectionProbe(t) + (this.lights = []), + this.meshes.forEach(function (e) { + e.dispose(); }), - this.environmentTexture === this.scene.environmentTexture && (this.scene.environmentTexture = null); - for (var t = 0, i = this.scene._serializableComponents; t < i.length; t++) - i[t].removeFromContainer(this) - } - , - t.prototype.dispose = function() { - this.cameras.forEach(function(e) { - e.dispose() + (this.meshes = []), + this.skeletons.forEach(function (e) { + e.dispose(); }), - this.cameras = [], - this.lights.forEach(function(e) { - e.dispose() + (this.skeletons = []), + this.animationGroups.forEach(function (e) { + e.dispose(); }), - this.lights = [], - this.meshes.forEach(function(e) { - e.dispose() + (this.animationGroups = []), + this.multiMaterials.forEach(function (e) { + e.dispose(); }), - this.meshes = [], - this.skeletons.forEach(function(e) { - e.dispose() + (this.multiMaterials = []), + this.materials.forEach(function (e) { + e.dispose(); }), - this.skeletons = [], - this.animationGroups.forEach(function(e) { - e.dispose() + (this.materials = []), + this.geometries.forEach(function (e) { + e.dispose(); }), - this.animationGroups = [], - this.multiMaterials.forEach(function(e) { - e.dispose() + (this.geometries = []), + this.transformNodes.forEach(function (e) { + e.dispose(); }), - this.multiMaterials = [], - this.materials.forEach(function(e) { - e.dispose() + (this.transformNodes = []), + this.actionManagers.forEach(function (e) { + e.dispose(); }), - this.materials = [], - this.geometries.forEach(function(e) { - e.dispose() + (this.actionManagers = []), + this.textures.forEach(function (e) { + e.dispose(); }), - this.geometries = [], - this.transformNodes.forEach(function(e) { - e.dispose() + (this.textures = []), + this.reflectionProbes.forEach(function (e) { + e.dispose(); }), - this.transformNodes = [], - this.actionManagers.forEach(function(e) { - e.dispose() - }), - this.actionManagers = [], - this.textures.forEach(function(e) { - e.dispose() - }), - this.textures = [], - this.reflectionProbes.forEach(function(e) { - e.dispose() - }), - this.reflectionProbes = [], - this.environmentTexture && (this.environmentTexture.dispose(), - this.environmentTexture = null); - for (var e = 0, t = this.scene._serializableComponents; e < t.length; e++) - t[e].removeFromContainer(this, true) - } - , - t.prototype._moveAssets = function(e, t, i) { - if (e) - for (var n = 0, r = e; n < r.length; n++) { - var o = r[n] - , a = true; - if (i) - for (var s = 0, c = i; s < c.length; s++) - if (o === c[s]) { - a = false; - break - } - a && t.push(o) - } - } - , - t.prototype.moveAllFromScene = function(e) { - for (var t in void 0 === e && (e = new ge), - this) - this.hasOwnProperty(t) && (this[t] = this[t] || [], - this._moveAssets(this.scene[t], this[t], e[t])); - this.removeAllFromScene() - } - , - t.prototype.createRootMesh = function() { - var e = new me.a("assetContainerRootMesh",this.scene); - return this.meshes.forEach(function(t) { - t.parent || e.addChild(t) + (this.reflectionProbes = []), + this.environmentTexture && + (this.environmentTexture.dispose(), + (this.environmentTexture = null)); + for ( + var e = 0, t = this.scene._serializableComponents; + e < t.length; + e++ + ) + t[e].removeFromContainer(this, true); + }), + (t.prototype._moveAssets = function (e, t, i) { + if (e) + for (var n = 0, r = e; n < r.length; n++) { + var o = r[n], + a = true; + if (i) + for (var s = 0, c = i; s < c.length; s++) + if (o === c[s]) { + a = false; + break; + } + a && t.push(o); + } + }), + (t.prototype.moveAllFromScene = function (e) { + for (var t in (void 0 === e && (e = new ge()), this)) + this.hasOwnProperty(t) && + ((this[t] = this[t] || []), + this._moveAssets(this.scene[t], this[t], e[t])); + this.removeAllFromScene(); + }), + (t.prototype.createRootMesh = function () { + var e = new me.a("assetContainerRootMesh", this.scene); + return ( + this.meshes.forEach(function (t) { + t.parent || e.addChild(t); }), this.meshes.unshift(e), e - } - , - t - }(r.a) - , ve = n(10) - , ye = function() { - function e(e) { - this.SMOOTHING = .75, - this.FFT_SIZE = 512, - this.BARGRAPHAMPLITUDE = 256, - this.DEBUGCANVASPOS = { - x: 20, - y: 20 - }, - this.DEBUGCANVASSIZE = { - width: 320, - height: 200 - }, - this._scene = e, - this._audioEngine = ve.b.audioEngine, - this._audioEngine.canUseWebAudio && this._audioEngine.audioContext && (this._webAudioAnalyser = this._audioEngine.audioContext.createAnalyser(), - this._webAudioAnalyser.minDecibels = -140, - this._webAudioAnalyser.maxDecibels = 0, - this._byteFreqs = new Uint8Array(this._webAudioAnalyser.frequencyBinCount), - this._byteTime = new Uint8Array(this._webAudioAnalyser.frequencyBinCount), - this._floatFreqs = new Float32Array(this._webAudioAnalyser.frequencyBinCount)) - } - return e.prototype.getFrequencyBinCount = function() { - return this._audioEngine.canUseWebAudio ? this._webAudioAnalyser.frequencyBinCount : 0 - } - , - e.prototype.getByteFrequencyData = function() { - return this._audioEngine.canUseWebAudio && (this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING, - this._webAudioAnalyser.fftSize = this.FFT_SIZE, - this._webAudioAnalyser.getByteFrequencyData(this._byteFreqs)), - this._byteFreqs - } - , - e.prototype.getByteTimeDomainData = function() { - return this._audioEngine.canUseWebAudio && (this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING, - this._webAudioAnalyser.fftSize = this.FFT_SIZE, - this._webAudioAnalyser.getByteTimeDomainData(this._byteTime)), - this._byteTime - } - , - e.prototype.getFloatFrequencyData = function() { - return this._audioEngine.canUseWebAudio && (this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING, - this._webAudioAnalyser.fftSize = this.FFT_SIZE, - this._webAudioAnalyser.getFloatFrequencyData(this._floatFreqs)), - this._floatFreqs - } - , - e.prototype.drawDebugCanvas = function() { - var e = this; - if (this._audioEngine.canUseWebAudio && (this._debugCanvas || (this._debugCanvas = document.createElement("canvas"), - this._debugCanvas.width = this.DEBUGCANVASSIZE.width, - this._debugCanvas.height = this.DEBUGCANVASSIZE.height, - this._debugCanvas.style.position = "absolute", - this._debugCanvas.style.top = this.DEBUGCANVASPOS.y + "px", - this._debugCanvas.style.left = this.DEBUGCANVASPOS.x + "px", - this._debugCanvasContext = this._debugCanvas.getContext("2d"), - document.body.appendChild(this._debugCanvas), - this._registerFunc = function() { - e.drawDebugCanvas() - } - , - this._scene.registerBeforeRender(this._registerFunc)), - this._registerFunc && this._debugCanvasContext)) { - var t = this.getByteFrequencyData(); - this._debugCanvasContext.fillStyle = "rgb(0, 0, 0)", - this._debugCanvasContext.fillRect(0, 0, this.DEBUGCANVASSIZE.width, this.DEBUGCANVASSIZE.height); - for (var i = 0; i < this.getFrequencyBinCount(); i++) { - var n = t[i] / this.BARGRAPHAMPLITUDE - , r = this.DEBUGCANVASSIZE.height * n - , o = this.DEBUGCANVASSIZE.height - r - 1 - , a = this.DEBUGCANVASSIZE.width / this.getFrequencyBinCount() - , s = i / this.getFrequencyBinCount() * 360; - this._debugCanvasContext.fillStyle = "hsl(" + s + ", 100%, 50%)", - this._debugCanvasContext.fillRect(i * a, o, a, r) - } - } - } - , - e.prototype.stopDebugCanvas = function() { - this._debugCanvas && (this._registerFunc && (this._scene.unregisterBeforeRender(this._registerFunc), - this._registerFunc = null), - document.body.removeChild(this._debugCanvas), - this._debugCanvas = null, - this._debugCanvasContext = null) - } - , - e.prototype.connectAudioNodes = function(e, t) { - this._audioEngine.canUseWebAudio && (e.connect(this._webAudioAnalyser), - this._webAudioAnalyser.connect(t)) - } - , - e.prototype.dispose = function() { - this._audioEngine.canUseWebAudio && this._webAudioAnalyser.disconnect() - } - , - e - }(); - ve.b.AudioEngineFactory = function(e) { - return new be(e) - } - ; - var be = function() { - function e(e) { - var t = this; - void 0 === e && (e = null), - this._audioContext = null, - this._audioContextInitialized = false, - this._muteButton = null, - this.canUseWebAudio = false, - this.WarnedWebAudioUnsupported = false, - this.isMP3supported = false, - this.isOGGsupported = false, - this.unlocked = true, - this.useCustomUnlockedButton = false, - this.onAudioUnlockedObservable = new o.c, - this.onAudioLockedObservable = new o.c, - this._tryToRun = false, - this._onResize = function() { - t._moveButtonToTopLeft() - } - , - void 0 === window.AudioContext && void 0 === window.webkitAudioContext || (window.AudioContext = window.AudioContext || window.webkitAudioContext, - this.canUseWebAudio = true); - var i = document.createElement("audio"); - this._hostElement = e; - try { - i && i.canPlayType && i.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, "") && (this.isMP3supported = true) - } catch (e) {} - try { - i && i.canPlayType && i.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, "") && (this.isOGGsupported = true) - } catch (e) {} - } - return Object.defineProperty(e.prototype, "audioContext", { - get: function() { - return this._audioContextInitialized ? this.unlocked || this._muteButton || this._displayMuteButton() : this._initializeAudioContext(), - this._audioContext - }, - enumerable: true, - configurable: true + ); }), - e.prototype.lock = function() { - this._triggerSuspendedState() - } - , - e.prototype.unlock = function() { - this._triggerRunningState() - } - , - e.prototype._resumeAudioContext = function() { - var e; - return this._audioContext.resume && (e = this._audioContext.resume()), + t + ); + })(r.a), + ve = n(10), + ye = (function () { + function e(e) { + (this.SMOOTHING = 0.75), + (this.FFT_SIZE = 512), + (this.BARGRAPHAMPLITUDE = 256), + (this.DEBUGCANVASPOS = { + x: 20, + y: 20, + }), + (this.DEBUGCANVASSIZE = { + width: 320, + height: 200, + }), + (this._scene = e), + (this._audioEngine = ve.b.audioEngine), + this._audioEngine.canUseWebAudio && + this._audioEngine.audioContext && + ((this._webAudioAnalyser = + this._audioEngine.audioContext.createAnalyser()), + (this._webAudioAnalyser.minDecibels = -140), + (this._webAudioAnalyser.maxDecibels = 0), + (this._byteFreqs = new Uint8Array( + this._webAudioAnalyser.frequencyBinCount + )), + (this._byteTime = new Uint8Array( + this._webAudioAnalyser.frequencyBinCount + )), + (this._floatFreqs = new Float32Array( + this._webAudioAnalyser.frequencyBinCount + ))); + } + return ( + (e.prototype.getFrequencyBinCount = function () { + return this._audioEngine.canUseWebAudio + ? this._webAudioAnalyser.frequencyBinCount + : 0; + }), + (e.prototype.getByteFrequencyData = function () { + return ( + this._audioEngine.canUseWebAudio && + ((this._webAudioAnalyser.smoothingTimeConstant = + this.SMOOTHING), + (this._webAudioAnalyser.fftSize = this.FFT_SIZE), + this._webAudioAnalyser.getByteFrequencyData( + this._byteFreqs + )), + this._byteFreqs + ); + }), + (e.prototype.getByteTimeDomainData = function () { + return ( + this._audioEngine.canUseWebAudio && + ((this._webAudioAnalyser.smoothingTimeConstant = + this.SMOOTHING), + (this._webAudioAnalyser.fftSize = this.FFT_SIZE), + this._webAudioAnalyser.getByteTimeDomainData( + this._byteTime + )), + this._byteTime + ); + }), + (e.prototype.getFloatFrequencyData = function () { + return ( + this._audioEngine.canUseWebAudio && + ((this._webAudioAnalyser.smoothingTimeConstant = + this.SMOOTHING), + (this._webAudioAnalyser.fftSize = this.FFT_SIZE), + this._webAudioAnalyser.getFloatFrequencyData( + this._floatFreqs + )), + this._floatFreqs + ); + }), + (e.prototype.drawDebugCanvas = function () { + var e = this; + if ( + this._audioEngine.canUseWebAudio && + (this._debugCanvas || + ((this._debugCanvas = + document.createElement("canvas")), + (this._debugCanvas.width = + this.DEBUGCANVASSIZE.width), + (this._debugCanvas.height = + this.DEBUGCANVASSIZE.height), + (this._debugCanvas.style.position = "absolute"), + (this._debugCanvas.style.top = + this.DEBUGCANVASPOS.y + "px"), + (this._debugCanvas.style.left = + this.DEBUGCANVASPOS.x + "px"), + (this._debugCanvasContext = + this._debugCanvas.getContext("2d")), + document.body.appendChild(this._debugCanvas), + (this._registerFunc = function () { + e.drawDebugCanvas(); + }), + this._scene.registerBeforeRender(this._registerFunc)), + this._registerFunc && this._debugCanvasContext) + ) { + var t = this.getByteFrequencyData(); + (this._debugCanvasContext.fillStyle = "rgb(0, 0, 0)"), + this._debugCanvasContext.fillRect( + 0, + 0, + this.DEBUGCANVASSIZE.width, + this.DEBUGCANVASSIZE.height + ); + for (var i = 0; i < this.getFrequencyBinCount(); i++) { + var n = t[i] / this.BARGRAPHAMPLITUDE, + r = this.DEBUGCANVASSIZE.height * n, + o = this.DEBUGCANVASSIZE.height - r - 1, + a = + this.DEBUGCANVASSIZE.width / + this.getFrequencyBinCount(), + s = (i / this.getFrequencyBinCount()) * 360; + (this._debugCanvasContext.fillStyle = + "hsl(" + s + ", 100%, 50%)"), + this._debugCanvasContext.fillRect(i * a, o, a, r); + } + } + }), + (e.prototype.stopDebugCanvas = function () { + this._debugCanvas && + (this._registerFunc && + (this._scene.unregisterBeforeRender( + this._registerFunc + ), + (this._registerFunc = null)), + document.body.removeChild(this._debugCanvas), + (this._debugCanvas = null), + (this._debugCanvasContext = null)); + }), + (e.prototype.connectAudioNodes = function (e, t) { + this._audioEngine.canUseWebAudio && + (e.connect(this._webAudioAnalyser), + this._webAudioAnalyser.connect(t)); + }), + (e.prototype.dispose = function () { + this._audioEngine.canUseWebAudio && + this._webAudioAnalyser.disconnect(); + }), + e + ); + })(); + ve.b.AudioEngineFactory = function (e) { + return new be(e); + }; + var be = (function () { + function e(e) { + var t = this; + void 0 === e && (e = null), + (this._audioContext = null), + (this._audioContextInitialized = false), + (this._muteButton = null), + (this.canUseWebAudio = false), + (this.WarnedWebAudioUnsupported = false), + (this.isMP3supported = false), + (this.isOGGsupported = false), + (this.unlocked = true), + (this.useCustomUnlockedButton = false), + (this.onAudioUnlockedObservable = new o.c()), + (this.onAudioLockedObservable = new o.c()), + (this._tryToRun = false), + (this._onResize = function () { + t._moveButtonToTopLeft(); + }), + (void 0 === window.AudioContext && + void 0 === window.webkitAudioContext) || + ((window.AudioContext = + window.AudioContext || window.webkitAudioContext), + (this.canUseWebAudio = true)); + var i = document.createElement("audio"); + this._hostElement = e; + try { + i && + i.canPlayType && + i + .canPlayType('audio/mpeg; codecs="mp3"') + .replace(/^no$/, "") && + (this.isMP3supported = true); + } catch (e) {} + try { + i && + i.canPlayType && + i + .canPlayType('audio/ogg; codecs="vorbis"') + .replace(/^no$/, "") && + (this.isOGGsupported = true); + } catch (e) {} + } + return ( + Object.defineProperty(e.prototype, "audioContext", { + get: function () { + return ( + this._audioContextInitialized + ? this.unlocked || + this._muteButton || + this._displayMuteButton() + : this._initializeAudioContext(), + this._audioContext + ); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.lock = function () { + this._triggerSuspendedState(); + }), + (e.prototype.unlock = function () { + this._triggerRunningState(); + }), + (e.prototype._resumeAudioContext = function () { + var e; + return ( + this._audioContext.resume && + (e = this._audioContext.resume()), e || i.resolve() - } - , - e.prototype._initializeAudioContext = function() { - try { - this.canUseWebAudio && (this._audioContext = new AudioContext, - this.masterGain = this._audioContext.createGain(), - this.masterGain.gain.value = 1, - this.masterGain.connect(this._audioContext.destination), - this._audioContextInitialized = true, - "running" === this._audioContext.state && this._triggerRunningState()) - } catch (e) { - this.canUseWebAudio = false, - g.a.Error("Web Audio: " + e.message) - } - } - , - e.prototype._triggerRunningState = function() { - var e = this; - this._tryToRun || (this._tryToRun = true, - this._resumeAudioContext().then(function() { - e._tryToRun = false, - e._muteButton && e._hideMuteButton() - }).catch(function() { - e._tryToRun = false, - e.unlocked = false - }), - this.unlocked = true, - this.onAudioUnlockedObservable.notifyObservers(this)) - } - , - e.prototype._triggerSuspendedState = function() { - this.unlocked = false, + ); + }), + (e.prototype._initializeAudioContext = function () { + try { + this.canUseWebAudio && + ((this._audioContext = new AudioContext()), + (this.masterGain = this._audioContext.createGain()), + (this.masterGain.gain.value = 1), + this.masterGain.connect( + this._audioContext.destination + ), + (this._audioContextInitialized = true), + "running" === this._audioContext.state && + this._triggerRunningState()); + } catch (e) { + (this.canUseWebAudio = false), + g.a.Error("Web Audio: " + e.message); + } + }), + (e.prototype._triggerRunningState = function () { + var e = this; + this._tryToRun || + ((this._tryToRun = true), + this._resumeAudioContext() + .then(function () { + (e._tryToRun = false), + e._muteButton && e._hideMuteButton(); + }) + .catch(function () { + (e._tryToRun = false), (e.unlocked = false); + }), + (this.unlocked = true), + this.onAudioUnlockedObservable.notifyObservers(this)); + }), + (e.prototype._triggerSuspendedState = function () { + (this.unlocked = false), this.onAudioLockedObservable.notifyObservers(this), - this._displayMuteButton() - } - , - e.prototype._displayMuteButton = function() { - var e = this; - if (!this.useCustomUnlockedButton && !this._muteButton) { - this._muteButton = document.createElement("BUTTON"), - this._muteButton.className = "babylonUnmuteIcon", - this._muteButton.id = "babylonUnmuteIconBtn", - this._muteButton.title = "Unmute"; - var t = document.createElement("style"); - t.appendChild(document.createTextNode(".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }")), - document.getElementsByTagName("head")[0].appendChild(t), - document.body.appendChild(this._muteButton), - this._moveButtonToTopLeft(), - this._muteButton.addEventListener("touchend", function() { - e._triggerRunningState() - }, true), - this._muteButton.addEventListener("click", function() { - e._triggerRunningState() - }, true), - window.addEventListener("resize", this._onResize) - } - } - , - e.prototype._moveButtonToTopLeft = function() { - this._hostElement && this._muteButton && (this._muteButton.style.top = this._hostElement.offsetTop + 20 + "px", - this._muteButton.style.left = this._hostElement.offsetLeft + 20 + "px") - } - , - e.prototype._hideMuteButton = function() { - this._muteButton && (document.body.removeChild(this._muteButton), - this._muteButton = null) - } - , - e.prototype.dispose = function() { - this.canUseWebAudio && this._audioContextInitialized && (this._connectedAnalyser && this._audioContext && (this._connectedAnalyser.stopDebugCanvas(), - this._connectedAnalyser.dispose(), - this.masterGain.disconnect(), - this.masterGain.connect(this._audioContext.destination), - this._connectedAnalyser = null), - this.masterGain.gain.value = 1), - this.WarnedWebAudioUnsupported = false, + this._displayMuteButton(); + }), + (e.prototype._displayMuteButton = function () { + var e = this; + if (!this.useCustomUnlockedButton && !this._muteButton) { + (this._muteButton = document.createElement("BUTTON")), + (this._muteButton.className = "babylonUnmuteIcon"), + (this._muteButton.id = "babylonUnmuteIconBtn"), + (this._muteButton.title = "Unmute"); + var t = document.createElement("style"); + t.appendChild( + document.createTextNode( + ".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }" + ) + ), + document + .getElementsByTagName("head")[0] + .appendChild(t), + document.body.appendChild(this._muteButton), + this._moveButtonToTopLeft(), + this._muteButton.addEventListener( + "touchend", + function () { + e._triggerRunningState(); + }, + true + ), + this._muteButton.addEventListener( + "click", + function () { + e._triggerRunningState(); + }, + true + ), + window.addEventListener("resize", this._onResize); + } + }), + (e.prototype._moveButtonToTopLeft = function () { + this._hostElement && + this._muteButton && + ((this._muteButton.style.top = + this._hostElement.offsetTop + 20 + "px"), + (this._muteButton.style.left = + this._hostElement.offsetLeft + 20 + "px")); + }), + (e.prototype._hideMuteButton = function () { + this._muteButton && + (document.body.removeChild(this._muteButton), + (this._muteButton = null)); + }), + (e.prototype.dispose = function () { + this.canUseWebAudio && + this._audioContextInitialized && + (this._connectedAnalyser && + this._audioContext && + (this._connectedAnalyser.stopDebugCanvas(), + this._connectedAnalyser.dispose(), + this.masterGain.disconnect(), + this.masterGain.connect( + this._audioContext.destination + ), + (this._connectedAnalyser = null)), + (this.masterGain.gain.value = 1)), + (this.WarnedWebAudioUnsupported = false), this._hideMuteButton(), window.removeEventListener("resize", this._onResize), this.onAudioUnlockedObservable.clear(), - this.onAudioLockedObservable.clear() - } - , - e.prototype.getGlobalVolume = function() { - return this.canUseWebAudio && this._audioContextInitialized ? this.masterGain.gain.value : -1 - } - , - e.prototype.setGlobalVolume = function(e) { - this.canUseWebAudio && this._audioContextInitialized && (this.masterGain.gain.value = e) - } - , - e.prototype.connectToAnalyser = function(e) { - this._connectedAnalyser && this._connectedAnalyser.stopDebugCanvas(), - this.canUseWebAudio && this._audioContextInitialized && this._audioContext && (this._connectedAnalyser = e, - this.masterGain.disconnect(), - this._connectedAnalyser.connectAudioNodes(this.masterGain, this._audioContext.destination)) - } - , + this.onAudioLockedObservable.clear(); + }), + (e.prototype.getGlobalVolume = function () { + return this.canUseWebAudio && + this._audioContextInitialized + ? this.masterGain.gain.value + : -1; + }), + (e.prototype.setGlobalVolume = function (e) { + this.canUseWebAudio && + this._audioContextInitialized && + (this.masterGain.gain.value = e); + }), + (e.prototype.connectToAnalyser = function (e) { + this._connectedAnalyser && + this._connectedAnalyser.stopDebugCanvas(), + this.canUseWebAudio && + this._audioContextInitialized && + this._audioContext && + ((this._connectedAnalyser = e), + this.masterGain.disconnect(), + this._connectedAnalyser.connectAudioNodes( + this.masterGain, + this._audioContext.destination + )); + }), e - }() - , Ee = n(9) - , Te = n(19) - , Ae = function() { - function e(t, i, n, r, s) { - var c = this; - if (void 0 === r && (r = null), - this.autoplay = false, - this.loop = false, - this.useCustomAttenuation = false, - this.isPlaying = false, - this.isPaused = false, - this.spatialSound = false, - this.refDistance = 1, - this.rolloffFactor = 1, - this.maxDistance = 100, - this.distanceModel = "linear", - this.onEndedObservable = new o.c, - this._panningModel = "equalpower", - this._playbackRate = 1, - this._streaming = false, - this._startTime = 0, - this._startOffset = 0, - this._position = a.x.Zero(), - this._positionInEmitterSpace = false, - this._localDirection = new a.x(1,0,0), - this._volume = 1, - this._isReadyToPlay = false, - this._isDirectional = false, - this._coneInnerAngle = 360, - this._coneOuterAngle = 360, - this._coneOuterGain = 0, - this._isOutputConnected = false, - this._urlType = "Unknown", - this.name = t, - this._scene = n, - e._SceneComponentInitialization(n), - this._readyToPlayCallback = r, - this._customAttenuationFunction = function(e, t, i, n, r) { - return t < i ? e * (1 - t / i) : 0 - } - , - s && (this.autoplay = s.autoplay || false, - this.loop = s.loop || false, + ); + })(), + Ee = n(9), + Te = n(19), + Ae = (function () { + function e(t, i, n, r, s) { + var c = this; + if ( + (void 0 === r && (r = null), + (this.autoplay = false), + (this.loop = false), + (this.useCustomAttenuation = false), + (this.isPlaying = false), + (this.isPaused = false), + (this.spatialSound = false), + (this.refDistance = 1), + (this.rolloffFactor = 1), + (this.maxDistance = 100), + (this.distanceModel = "linear"), + (this.onEndedObservable = new o.c()), + (this._panningModel = "equalpower"), + (this._playbackRate = 1), + (this._streaming = false), + (this._startTime = 0), + (this._startOffset = 0), + (this._position = a.x.Zero()), + (this._positionInEmitterSpace = false), + (this._localDirection = new a.x(1, 0, 0)), + (this._volume = 1), + (this._isReadyToPlay = false), + (this._isDirectional = false), + (this._coneInnerAngle = 360), + (this._coneOuterAngle = 360), + (this._coneOuterGain = 0), + (this._isOutputConnected = false), + (this._urlType = "Unknown"), + (this.name = t), + (this._scene = n), + e._SceneComponentInitialization(n), + (this._readyToPlayCallback = r), + (this._customAttenuationFunction = function ( + e, + t, + i, + n, + r + ) { + return t < i ? e * (1 - t / i) : 0; + }), + s && + ((this.autoplay = s.autoplay || false), + (this.loop = s.loop || false), void 0 !== s.volume && (this._volume = s.volume), - this.spatialSound = s.spatialSound || false, - this.maxDistance = s.maxDistance || 100, - this.useCustomAttenuation = s.useCustomAttenuation || false, - this.rolloffFactor = s.rolloffFactor || 1, - this.refDistance = s.refDistance || 1, - this.distanceModel = s.distanceModel || "linear", - this._playbackRate = s.playbackRate || 1, - this._streaming = s.streaming || false), - ve.b.audioEngine.canUseWebAudio && ve.b.audioEngine.audioContext) { - this._soundGain = ve.b.audioEngine.audioContext.createGain(), - this._soundGain.gain.value = this._volume, - this._inputAudioNode = this._soundGain, - this._outputAudioNode = this._soundGain, - this.spatialSound && this._createSpatialParameters(), - this._scene.mainSoundTrack.AddSound(this); - var u = true; - if (i) - try { - "string" == typeof i ? this._urlType = "String" : i instanceof ArrayBuffer ? this._urlType = "ArrayBuffer" : i instanceof MediaStream ? this._urlType = "MediaStream" : Array.isArray(i) && (this._urlType = "Array"); - var l = [] - , h = false; - switch (this._urlType) { - case "MediaStream": - this._streaming = true, - this._isReadyToPlay = true, - this._streamingSource = ve.b.audioEngine.audioContext.createMediaStreamSource(i), - this.autoplay && this.play(), - this._readyToPlayCallback && this._readyToPlayCallback(); - break; - case "ArrayBuffer": - i.byteLength > 0 && (h = true, - this._soundLoaded(i)); - break; - case "String": - l.push(i); - case "Array": - 0 === l.length && (l = i); - for (var f = 0; f < l.length; f++) { - var d = l[f]; - if (-1 !== d.indexOf(".mp3", d.length - 4) && ve.b.audioEngine.isMP3supported && (h = true), - -1 !== d.indexOf(".ogg", d.length - 4) && ve.b.audioEngine.isOGGsupported && (h = true), - -1 !== d.indexOf(".wav", d.length - 4) && (h = true), - -1 !== d.indexOf("blob:") && (h = true), - h) { - this._streaming ? (this._htmlAudioElement = new Audio(d), - this._htmlAudioElement.controls = false, - this._htmlAudioElement.loop = this.loop, - Ee.h.SetCorsBehavior(d, this._htmlAudioElement), - this._htmlAudioElement.preload = "auto", - this._htmlAudioElement.addEventListener("canplaythrough", function() { - c._isReadyToPlay = true, - c.autoplay && c.play(), - c._readyToPlayCallback && c._readyToPlayCallback() - }), - document.body.appendChild(this._htmlAudioElement), - this._htmlAudioElement.load()) : this._scene._loadFile(d, function(e) { - c._soundLoaded(e) - }, void 0, true, true, function(e) { - e && g.a.Error("XHR " + e.status + " error on: " + d + "."), - g.a.Error("Sound creation aborted."), - c._scene.mainSoundTrack.RemoveSound(c) - }); - break - } + (this.spatialSound = s.spatialSound || false), + (this.maxDistance = s.maxDistance || 100), + (this.useCustomAttenuation = + s.useCustomAttenuation || false), + (this.rolloffFactor = s.rolloffFactor || 1), + (this.refDistance = s.refDistance || 1), + (this.distanceModel = s.distanceModel || "linear"), + (this._playbackRate = s.playbackRate || 1), + (this._streaming = s.streaming || false)), + ve.b.audioEngine.canUseWebAudio && + ve.b.audioEngine.audioContext) + ) { + (this._soundGain = + ve.b.audioEngine.audioContext.createGain()), + (this._soundGain.gain.value = this._volume), + (this._inputAudioNode = this._soundGain), + (this._outputAudioNode = this._soundGain), + this.spatialSound && this._createSpatialParameters(), + this._scene.mainSoundTrack.AddSound(this); + var u = true; + if (i) + try { + "string" == typeof i + ? (this._urlType = "String") + : i instanceof ArrayBuffer + ? (this._urlType = "ArrayBuffer") + : i instanceof MediaStream + ? (this._urlType = "MediaStream") + : Array.isArray(i) && (this._urlType = "Array"); + var l = [], + h = false; + switch (this._urlType) { + case "MediaStream": + (this._streaming = true), + (this._isReadyToPlay = true), + (this._streamingSource = + ve.b.audioEngine.audioContext.createMediaStreamSource( + i + )), + this.autoplay && this.play(), + this._readyToPlayCallback && + this._readyToPlayCallback(); + break; + case "ArrayBuffer": + i.byteLength > 0 && + ((h = true), this._soundLoaded(i)); + break; + case "String": + l.push(i); + case "Array": + 0 === l.length && (l = i); + for (var f = 0; f < l.length; f++) { + var d = l[f]; + if ( + (-1 !== d.indexOf(".mp3", d.length - 4) && + ve.b.audioEngine.isMP3supported && + (h = true), + -1 !== d.indexOf(".ogg", d.length - 4) && + ve.b.audioEngine.isOGGsupported && + (h = true), + -1 !== d.indexOf(".wav", d.length - 4) && + (h = true), + -1 !== d.indexOf("blob:") && (h = true), + h) + ) { + this._streaming + ? ((this._htmlAudioElement = new Audio(d)), + (this._htmlAudioElement.controls = false), + (this._htmlAudioElement.loop = this.loop), + Ee.h.SetCorsBehavior( + d, + this._htmlAudioElement + ), + (this._htmlAudioElement.preload = "auto"), + this._htmlAudioElement.addEventListener( + "canplaythrough", + function () { + (c._isReadyToPlay = true), + c.autoplay && c.play(), + c._readyToPlayCallback && + c._readyToPlayCallback(); } - break; - default: - u = false - } - u ? h || (this._isReadyToPlay = true, - this._readyToPlayCallback && window.setTimeout(function() { - c._readyToPlayCallback && c._readyToPlayCallback() - }, 1e3)) : g.a.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.") - } catch (e) { - g.a.Error("Unexpected error. Sound creation aborted."), - this._scene.mainSoundTrack.RemoveSound(this) + ), + document.body.appendChild( + this._htmlAudioElement + ), + this._htmlAudioElement.load()) + : this._scene._loadFile( + d, + function (e) { + c._soundLoaded(e); + }, + void 0, + true, + true, + function (e) { + e && + g.a.Error( + "XHR " + + e.status + + " error on: " + + d + + "." + ), + g.a.Error( + "Sound creation aborted." + ), + c._scene.mainSoundTrack.RemoveSound( + c + ); + } + ); + break; } - } else - this._scene.mainSoundTrack.AddSound(this), - ve.b.audioEngine.WarnedWebAudioUnsupported || (g.a.Error("Web Audio is not supported by your browser."), - ve.b.audioEngine.WarnedWebAudioUnsupported = true), - this._readyToPlayCallback && window.setTimeout(function() { - c._readyToPlayCallback && c._readyToPlayCallback() - }, 1e3) - } - return e.prototype.dispose = function() { - ve.b.audioEngine.canUseWebAudio && (this.isPlaying && this.stop(), - this._isReadyToPlay = false, - -1 === this.soundTrackId ? this._scene.mainSoundTrack.RemoveSound(this) : this._scene.soundTracks && this._scene.soundTracks[this.soundTrackId].RemoveSound(this), - this._soundGain && (this._soundGain.disconnect(), - this._soundGain = null), - this._soundPanner && (this._soundPanner.disconnect(), - this._soundPanner = null), - this._soundSource && (this._soundSource.disconnect(), - this._soundSource = null), - this._audioBuffer = null, - this._htmlAudioElement && (this._htmlAudioElement.pause(), - this._htmlAudioElement.src = "", - document.body.removeChild(this._htmlAudioElement)), - this._streamingSource && this._streamingSource.disconnect(), - this._connectedTransformNode && this._registerFunc && (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc), - this._connectedTransformNode = null)) - } - , - e.prototype.isReady = function() { - return this._isReadyToPlay - } - , - e.prototype._soundLoaded = function(e) { - var t = this; - ve.b.audioEngine.audioContext && ve.b.audioEngine.audioContext.decodeAudioData(e, function(e) { - t._audioBuffer = e, - t._isReadyToPlay = true, - t.autoplay && t.play(), - t._readyToPlayCallback && t._readyToPlayCallback() - }, function(e) { - g.a.Error("Error while decoding audio data for: " + t.name + " / Error: " + e) - }) - } - , - e.prototype.setAudioBuffer = function(e) { - ve.b.audioEngine.canUseWebAudio && (this._audioBuffer = e, - this._isReadyToPlay = true) - } - , - e.prototype.updateOptions = function(e) { - e && (this.loop = e.loop || this.loop, - this.maxDistance = e.maxDistance || this.maxDistance, - this.useCustomAttenuation = e.useCustomAttenuation || this.useCustomAttenuation, - this.rolloffFactor = e.rolloffFactor || this.rolloffFactor, - this.refDistance = e.refDistance || this.refDistance, - this.distanceModel = e.distanceModel || this.distanceModel, - this._playbackRate = e.playbackRate || this._playbackRate, + } + break; + default: + u = false; + } + u + ? h || + ((this._isReadyToPlay = true), + this._readyToPlayCallback && + window.setTimeout(function () { + c._readyToPlayCallback && + c._readyToPlayCallback(); + }, 1e3)) + : g.a.Error( + "Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound." + ); + } catch (e) { + g.a.Error( + "Unexpected error. Sound creation aborted." + ), + this._scene.mainSoundTrack.RemoveSound(this); + } + } else + this._scene.mainSoundTrack.AddSound(this), + ve.b.audioEngine.WarnedWebAudioUnsupported || + (g.a.Error( + "Web Audio is not supported by your browser." + ), + (ve.b.audioEngine.WarnedWebAudioUnsupported = true)), + this._readyToPlayCallback && + window.setTimeout(function () { + c._readyToPlayCallback && c._readyToPlayCallback(); + }, 1e3); + } + return ( + (e.prototype.dispose = function () { + ve.b.audioEngine.canUseWebAudio && + (this.isPlaying && this.stop(), + (this._isReadyToPlay = false), + -1 === this.soundTrackId + ? this._scene.mainSoundTrack.RemoveSound(this) + : this._scene.soundTracks && + this._scene.soundTracks[ + this.soundTrackId + ].RemoveSound(this), + this._soundGain && + (this._soundGain.disconnect(), + (this._soundGain = null)), + this._soundPanner && + (this._soundPanner.disconnect(), + (this._soundPanner = null)), + this._soundSource && + (this._soundSource.disconnect(), + (this._soundSource = null)), + (this._audioBuffer = null), + this._htmlAudioElement && + (this._htmlAudioElement.pause(), + (this._htmlAudioElement.src = ""), + document.body.removeChild(this._htmlAudioElement)), + this._streamingSource && + this._streamingSource.disconnect(), + this._connectedTransformNode && + this._registerFunc && + (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate( + this._registerFunc + ), + (this._connectedTransformNode = null))); + }), + (e.prototype.isReady = function () { + return this._isReadyToPlay; + }), + (e.prototype._soundLoaded = function (e) { + var t = this; + ve.b.audioEngine.audioContext && + ve.b.audioEngine.audioContext.decodeAudioData( + e, + function (e) { + (t._audioBuffer = e), + (t._isReadyToPlay = true), + t.autoplay && t.play(), + t._readyToPlayCallback && + t._readyToPlayCallback(); + }, + function (e) { + g.a.Error( + "Error while decoding audio data for: " + + t.name + + " / Error: " + + e + ); + } + ); + }), + (e.prototype.setAudioBuffer = function (e) { + ve.b.audioEngine.canUseWebAudio && + ((this._audioBuffer = e), (this._isReadyToPlay = true)); + }), + (e.prototype.updateOptions = function (e) { + e && + ((this.loop = e.loop || this.loop), + (this.maxDistance = e.maxDistance || this.maxDistance), + (this.useCustomAttenuation = + e.useCustomAttenuation || this.useCustomAttenuation), + (this.rolloffFactor = + e.rolloffFactor || this.rolloffFactor), + (this.refDistance = e.refDistance || this.refDistance), + (this.distanceModel = + e.distanceModel || this.distanceModel), + (this._playbackRate = + e.playbackRate || this._playbackRate), this._updateSpatialParameters(), - this.isPlaying && (this._streaming && this._htmlAudioElement ? this._htmlAudioElement.playbackRate = this._playbackRate : this._soundSource && (this._soundSource.playbackRate.value = this._playbackRate))) - } - , - e.prototype._createSpatialParameters = function() { - ve.b.audioEngine.canUseWebAudio && ve.b.audioEngine.audioContext && (this._scene.headphone && (this._panningModel = "HRTF"), - this._soundPanner = ve.b.audioEngine.audioContext.createPanner(), + this.isPlaying && + (this._streaming && this._htmlAudioElement + ? (this._htmlAudioElement.playbackRate = + this._playbackRate) + : this._soundSource && + (this._soundSource.playbackRate.value = + this._playbackRate))); + }), + (e.prototype._createSpatialParameters = function () { + ve.b.audioEngine.canUseWebAudio && + ve.b.audioEngine.audioContext && + (this._scene.headphone && (this._panningModel = "HRTF"), + (this._soundPanner = + ve.b.audioEngine.audioContext.createPanner()), this._updateSpatialParameters(), this._soundPanner.connect(this._outputAudioNode), - this._inputAudioNode = this._soundPanner) - } - , - e.prototype._updateSpatialParameters = function() { - this.spatialSound && this._soundPanner && (this.useCustomAttenuation ? (this._soundPanner.distanceModel = "linear", - this._soundPanner.maxDistance = Number.MAX_VALUE, - this._soundPanner.refDistance = 1, - this._soundPanner.rolloffFactor = 1, - this._soundPanner.panningModel = this._panningModel) : (this._soundPanner.distanceModel = this.distanceModel, - this._soundPanner.maxDistance = this.maxDistance, - this._soundPanner.refDistance = this.refDistance, - this._soundPanner.rolloffFactor = this.rolloffFactor, - this._soundPanner.panningModel = this._panningModel)) - } - , - e.prototype.switchPanningModelToHRTF = function() { - this._panningModel = "HRTF", - this._switchPanningModel() - } - , - e.prototype.switchPanningModelToEqualPower = function() { - this._panningModel = "equalpower", - this._switchPanningModel() - } - , - e.prototype._switchPanningModel = function() { - ve.b.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.panningModel = this._panningModel) - } - , - e.prototype.connectToSoundTrackAudioNode = function(e) { - ve.b.audioEngine.canUseWebAudio && (this._isOutputConnected && this._outputAudioNode.disconnect(), + (this._inputAudioNode = this._soundPanner)); + }), + (e.prototype._updateSpatialParameters = function () { + this.spatialSound && + this._soundPanner && + (this.useCustomAttenuation + ? ((this._soundPanner.distanceModel = "linear"), + (this._soundPanner.maxDistance = Number.MAX_VALUE), + (this._soundPanner.refDistance = 1), + (this._soundPanner.rolloffFactor = 1), + (this._soundPanner.panningModel = + this._panningModel)) + : ((this._soundPanner.distanceModel = + this.distanceModel), + (this._soundPanner.maxDistance = this.maxDistance), + (this._soundPanner.refDistance = this.refDistance), + (this._soundPanner.rolloffFactor = + this.rolloffFactor), + (this._soundPanner.panningModel = + this._panningModel))); + }), + (e.prototype.switchPanningModelToHRTF = function () { + (this._panningModel = "HRTF"), this._switchPanningModel(); + }), + (e.prototype.switchPanningModelToEqualPower = function () { + (this._panningModel = "equalpower"), + this._switchPanningModel(); + }), + (e.prototype._switchPanningModel = function () { + ve.b.audioEngine.canUseWebAudio && + this.spatialSound && + this._soundPanner && + (this._soundPanner.panningModel = this._panningModel); + }), + (e.prototype.connectToSoundTrackAudioNode = function (e) { + ve.b.audioEngine.canUseWebAudio && + (this._isOutputConnected && + this._outputAudioNode.disconnect(), this._outputAudioNode.connect(e), - this._isOutputConnected = true) - } - , - e.prototype.setDirectionalCone = function(e, t, i) { - t < e ? g.a.Error("setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.") : (this._coneInnerAngle = e, - this._coneOuterAngle = t, - this._coneOuterGain = i, - this._isDirectional = true, - this.isPlaying && this.loop && (this.stop(), - this.play())) - } - , - Object.defineProperty(e.prototype, "directionalConeInnerAngle", { - get: function() { - return this._coneInnerAngle + (this._isOutputConnected = true)); + }), + (e.prototype.setDirectionalCone = function (e, t, i) { + t < e + ? g.a.Error( + "setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle." + ) + : ((this._coneInnerAngle = e), + (this._coneOuterAngle = t), + (this._coneOuterGain = i), + (this._isDirectional = true), + this.isPlaying && + this.loop && + (this.stop(), this.play())); + }), + Object.defineProperty( + e.prototype, + "directionalConeInnerAngle", + { + get: function () { + return this._coneInnerAngle; }, - set: function(e) { - if (e != this._coneInnerAngle) { - if (this._coneOuterAngle < e) - return void g.a.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle."); - this._coneInnerAngle = e, - ve.b.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.coneInnerAngle = this._coneInnerAngle) - } + set: function (e) { + if (e != this._coneInnerAngle) { + if (this._coneOuterAngle < e) + return void g.a.Error( + "directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle." + ); + (this._coneInnerAngle = e), + ve.b.audioEngine.canUseWebAudio && + this.spatialSound && + this._soundPanner && + (this._soundPanner.coneInnerAngle = + this._coneInnerAngle); + } }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "directionalConeOuterAngle", { - get: function() { - return this._coneOuterAngle + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "directionalConeOuterAngle", + { + get: function () { + return this._coneOuterAngle; }, - set: function(e) { - if (e != this._coneOuterAngle) { - if (e < this._coneInnerAngle) - return void g.a.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle."); - this._coneOuterAngle = e, - ve.b.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.coneOuterAngle = this._coneOuterAngle) - } + set: function (e) { + if (e != this._coneOuterAngle) { + if (e < this._coneInnerAngle) + return void g.a.Error( + "directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle." + ); + (this._coneOuterAngle = e), + ve.b.audioEngine.canUseWebAudio && + this.spatialSound && + this._soundPanner && + (this._soundPanner.coneOuterAngle = + this._coneOuterAngle); + } }, enumerable: true, - configurable: true + configurable: true, + } + ), + (e.prototype.setPosition = function (e) { + (this._position = e), + ve.b.audioEngine.canUseWebAudio && + this.spatialSound && + this._soundPanner && + !isNaN(this._position.x) && + !isNaN(this._position.y) && + !isNaN(this._position.z) && + this._soundPanner.setPosition( + this._position.x, + this._position.y, + this._position.z + ); }), - e.prototype.setPosition = function(e) { - this._position = e, - ve.b.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z) && this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z) - } - , - e.prototype.setLocalDirectionToMesh = function(e) { - this._localDirection = e, - ve.b.audioEngine.canUseWebAudio && this._connectedTransformNode && this.isPlaying && this._updateDirection() - } - , - e.prototype._updateDirection = function() { - if (this._connectedTransformNode && this._soundPanner) { - var e = this._connectedTransformNode.getWorldMatrix() - , t = a.x.TransformNormal(this._localDirection, e); - t.normalize(), - this._soundPanner.setOrientation(t.x, t.y, t.z) - } - } - , - e.prototype.updateDistanceFromListener = function() { - if (ve.b.audioEngine.canUseWebAudio && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) { - var e = this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera); - this._soundGain.gain.value = this._customAttenuationFunction(this._volume, e, this.maxDistance, this.refDistance, this.rolloffFactor) - } - } - , - e.prototype.setAttenuationFunction = function(e) { - this._customAttenuationFunction = e - } - , - e.prototype.play = function(e, t) { - var i = this; - if (this._isReadyToPlay && this._scene.audioEnabled && ve.b.audioEngine.audioContext) - try { - this._startOffset < 0 && (e = -this._startOffset, - this._startOffset = 0); - var n = e ? ve.b.audioEngine.audioContext.currentTime + e : ve.b.audioEngine.audioContext.currentTime; - if (this._soundSource && this._streamingSource || this.spatialSound && this._soundPanner && (isNaN(this._position.x) || isNaN(this._position.y) || isNaN(this._position.z) || this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z), - this._isDirectional && (this._soundPanner.coneInnerAngle = this._coneInnerAngle, - this._soundPanner.coneOuterAngle = this._coneOuterAngle, - this._soundPanner.coneOuterGain = this._coneOuterGain, - this._connectedTransformNode ? this._updateDirection() : this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z))), - this._streaming) - this._streamingSource || (this._streamingSource = ve.b.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement), - this._htmlAudioElement.onended = function() { - i._onended() - } - , - this._htmlAudioElement.playbackRate = this._playbackRate), - this._streamingSource.disconnect(), - this._streamingSource.connect(this._inputAudioNode), - this._htmlAudioElement && (r = function() { - if (ve.b.audioEngine.unlocked) { - var e = i._htmlAudioElement.play(); - void 0 !== e && e.catch(function(e) { - ve.b.audioEngine.lock(), - (i.loop || i.autoplay) && ve.b.audioEngine.onAudioUnlockedObservable.addOnce(function() { - r() - }) - }) - } else - (i.loop || i.autoplay) && ve.b.audioEngine.onAudioUnlockedObservable.addOnce(function() { - r() - }) - } - )(); - else { - var r = function() { - ve.b.audioEngine.audioContext && (i._soundSource = ve.b.audioEngine.audioContext.createBufferSource(), - i._soundSource.buffer = i._audioBuffer, - i._soundSource.connect(i._inputAudioNode), - i._soundSource.loop = i.loop, - i._soundSource.playbackRate.value = i._playbackRate, - i._soundSource.onended = function() { - i._onended() + (e.prototype.setLocalDirectionToMesh = function (e) { + (this._localDirection = e), + ve.b.audioEngine.canUseWebAudio && + this._connectedTransformNode && + this.isPlaying && + this._updateDirection(); + }), + (e.prototype._updateDirection = function () { + if (this._connectedTransformNode && this._soundPanner) { + var e = this._connectedTransformNode.getWorldMatrix(), + t = a.x.TransformNormal(this._localDirection, e); + t.normalize(), + this._soundPanner.setOrientation(t.x, t.y, t.z); + } + }), + (e.prototype.updateDistanceFromListener = function () { + if ( + ve.b.audioEngine.canUseWebAudio && + this._connectedTransformNode && + this.useCustomAttenuation && + this._soundGain && + this._scene.activeCamera + ) { + var e = + this._connectedTransformNode.getDistanceToCamera( + this._scene.activeCamera + ); + this._soundGain.gain.value = + this._customAttenuationFunction( + this._volume, + e, + this.maxDistance, + this.refDistance, + this.rolloffFactor + ); + } + }), + (e.prototype.setAttenuationFunction = function (e) { + this._customAttenuationFunction = e; + }), + (e.prototype.play = function (e, t) { + var i = this; + if ( + this._isReadyToPlay && + this._scene.audioEnabled && + ve.b.audioEngine.audioContext + ) + try { + this._startOffset < 0 && + ((e = -this._startOffset), (this._startOffset = 0)); + var n = e + ? ve.b.audioEngine.audioContext.currentTime + e + : ve.b.audioEngine.audioContext.currentTime; + if ( + ((this._soundSource && this._streamingSource) || + (this.spatialSound && + this._soundPanner && + (isNaN(this._position.x) || + isNaN(this._position.y) || + isNaN(this._position.z) || + this._soundPanner.setPosition( + this._position.x, + this._position.y, + this._position.z + ), + this._isDirectional && + ((this._soundPanner.coneInnerAngle = + this._coneInnerAngle), + (this._soundPanner.coneOuterAngle = + this._coneOuterAngle), + (this._soundPanner.coneOuterGain = + this._coneOuterGain), + this._connectedTransformNode + ? this._updateDirection() + : this._soundPanner.setOrientation( + this._localDirection.x, + this._localDirection.y, + this._localDirection.z + )))), + this._streaming) + ) + this._streamingSource || + ((this._streamingSource = + ve.b.audioEngine.audioContext.createMediaElementSource( + this._htmlAudioElement + )), + (this._htmlAudioElement.onended = function () { + i._onended(); + }), + (this._htmlAudioElement.playbackRate = + this._playbackRate)), + this._streamingSource.disconnect(), + this._streamingSource.connect( + this._inputAudioNode + ), + this._htmlAudioElement && + (r = function () { + if (ve.b.audioEngine.unlocked) { + var e = i._htmlAudioElement.play(); + void 0 !== e && + e.catch(function (e) { + ve.b.audioEngine.lock(), + (i.loop || i.autoplay) && + ve.b.audioEngine.onAudioUnlockedObservable.addOnce( + function () { + r(); + } + ); + }); + } else + (i.loop || i.autoplay) && + ve.b.audioEngine.onAudioUnlockedObservable.addOnce( + function () { + r(); } - , - n = e ? ve.b.audioEngine.audioContext.currentTime + e : ve.b.audioEngine.audioContext.currentTime, - i._soundSource.start(n, i.isPaused ? i._startOffset % i._soundSource.buffer.duration : t || 0)) - }; - "suspended" === ve.b.audioEngine.audioContext.state ? setTimeout(function() { - "suspended" === ve.b.audioEngine.audioContext.state ? (ve.b.audioEngine.lock(), - (i.loop || i.autoplay) && ve.b.audioEngine.onAudioUnlockedObservable.addOnce(function() { - r() - })) : r() - }, 500) : r() - } - this._startTime = n, - this.isPlaying = true, - this.isPaused = false - } catch (e) { - g.a.Error("Error while trying to play audio: " + this.name + ", " + e.message) - } - } - , - e.prototype._onended = function() { - this.isPlaying = false, + ); + })(); + else { + var r = function () { + ve.b.audioEngine.audioContext && + ((i._soundSource = + ve.b.audioEngine.audioContext.createBufferSource()), + (i._soundSource.buffer = i._audioBuffer), + i._soundSource.connect(i._inputAudioNode), + (i._soundSource.loop = i.loop), + (i._soundSource.playbackRate.value = + i._playbackRate), + (i._soundSource.onended = function () { + i._onended(); + }), + (n = e + ? ve.b.audioEngine.audioContext.currentTime + + e + : ve.b.audioEngine.audioContext.currentTime), + i._soundSource.start( + n, + i.isPaused + ? i._startOffset % + i._soundSource.buffer.duration + : t || 0 + )); + }; + "suspended" === ve.b.audioEngine.audioContext.state + ? setTimeout(function () { + "suspended" === + ve.b.audioEngine.audioContext.state + ? (ve.b.audioEngine.lock(), + (i.loop || i.autoplay) && + ve.b.audioEngine.onAudioUnlockedObservable.addOnce( + function () { + r(); + } + )) + : r(); + }, 500) + : r(); + } + (this._startTime = n), + (this.isPlaying = true), + (this.isPaused = false); + } catch (e) { + g.a.Error( + "Error while trying to play audio: " + + this.name + + ", " + + e.message + ); + } + }), + (e.prototype._onended = function () { + (this.isPlaying = false), this.onended && this.onended(), - this.onEndedObservable.notifyObservers(this) - } - , - e.prototype.stop = function(e) { - var t = this; - if (this.isPlaying) - if (this._streaming) - this._htmlAudioElement ? (this._htmlAudioElement.pause(), - this._htmlAudioElement.currentTime > 0 && (this._htmlAudioElement.currentTime = 0)) : this._streamingSource.disconnect(), - this.isPlaying = false; - else if (ve.b.audioEngine.audioContext && this._soundSource) { - var i = e ? ve.b.audioEngine.audioContext.currentTime + e : ve.b.audioEngine.audioContext.currentTime; - this._soundSource.stop(i), - this._soundSource.onended = function() { - t.isPlaying = false - } - , - this.isPaused || (this._startOffset = 0) - } - } - , - e.prototype.pause = function() { - this.isPlaying && (this.isPaused = true, - this._streaming ? this._htmlAudioElement ? this._htmlAudioElement.pause() : this._streamingSource.disconnect() : ve.b.audioEngine.audioContext && (this.stop(0), - this._startOffset += ve.b.audioEngine.audioContext.currentTime - this._startTime)) - } - , - e.prototype.setVolume = function(e, t) { - ve.b.audioEngine.canUseWebAudio && this._soundGain && (t && ve.b.audioEngine.audioContext ? (this._soundGain.gain.cancelScheduledValues(ve.b.audioEngine.audioContext.currentTime), - this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, ve.b.audioEngine.audioContext.currentTime), - this._soundGain.gain.linearRampToValueAtTime(e, ve.b.audioEngine.audioContext.currentTime + t)) : this._soundGain.gain.value = e), - this._volume = e - } - , - e.prototype.setPlaybackRate = function(e) { - this._playbackRate = e, - this.isPlaying && (this._streaming && this._htmlAudioElement ? this._htmlAudioElement.playbackRate = this._playbackRate : this._soundSource && (this._soundSource.playbackRate.value = this._playbackRate)) - } - , - e.prototype.getVolume = function() { - return this._volume - } - , - e.prototype.attachToMesh = function(e) { - var t = this; - this._connectedTransformNode && this._registerFunc && (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc), - this._registerFunc = null), - this._connectedTransformNode = e, - this.spatialSound || (this.spatialSound = true, - this._createSpatialParameters(), - this.isPlaying && this.loop && (this.stop(), - this.play())), - this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode), - this._registerFunc = function(e) { - return t._onRegisterAfterWorldMatrixUpdate(e) - } - , - this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc) - } - , - e.prototype.detachFromMesh = function() { - this._connectedTransformNode && this._registerFunc && (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc), - this._registerFunc = null, - this._connectedTransformNode = null) - } - , - e.prototype._onRegisterAfterWorldMatrixUpdate = function(e) { - if (e.getBoundingInfo) { - var t = e; - if (this._positionInEmitterSpace) - t.worldMatrixFromCache.invertToRef(a.t.Matrix[0]), - this.setPosition(a.t.Matrix[0].getTranslation()); - else { - var i = t.getBoundingInfo(); - this.setPosition(i.boundingSphere.centerWorld) - } - ve.b.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying && this._updateDirection() - } - } - , - e.prototype.clone = function() { - var t = this; + this.onEndedObservable.notifyObservers(this); + }), + (e.prototype.stop = function (e) { + var t = this; + if (this.isPlaying) if (this._streaming) - return null; - var i = { - autoplay: this.autoplay, - loop: this.loop, - volume: this._volume, - spatialSound: this.spatialSound, - maxDistance: this.maxDistance, - useCustomAttenuation: this.useCustomAttenuation, - rolloffFactor: this.rolloffFactor, - refDistance: this.refDistance, - distanceModel: this.distanceModel + this._htmlAudioElement + ? (this._htmlAudioElement.pause(), + this._htmlAudioElement.currentTime > 0 && + (this._htmlAudioElement.currentTime = 0)) + : this._streamingSource.disconnect(), + (this.isPlaying = false); + else if ( + ve.b.audioEngine.audioContext && + this._soundSource + ) { + var i = e + ? ve.b.audioEngine.audioContext.currentTime + e + : ve.b.audioEngine.audioContext.currentTime; + this._soundSource.stop(i), + (this._soundSource.onended = function () { + t.isPlaying = false; + }), + this.isPaused || (this._startOffset = 0); } - , n = new e(this.name + "_cloned",new ArrayBuffer(0),this._scene,null,i); - return this.useCustomAttenuation && n.setAttenuationFunction(this._customAttenuationFunction), + }), + (e.prototype.pause = function () { + this.isPlaying && + ((this.isPaused = true), + this._streaming + ? this._htmlAudioElement + ? this._htmlAudioElement.pause() + : this._streamingSource.disconnect() + : ve.b.audioEngine.audioContext && + (this.stop(0), + (this._startOffset += + ve.b.audioEngine.audioContext.currentTime - + this._startTime))); + }), + (e.prototype.setVolume = function (e, t) { + ve.b.audioEngine.canUseWebAudio && + this._soundGain && + (t && ve.b.audioEngine.audioContext + ? (this._soundGain.gain.cancelScheduledValues( + ve.b.audioEngine.audioContext.currentTime + ), + this._soundGain.gain.setValueAtTime( + this._soundGain.gain.value, + ve.b.audioEngine.audioContext.currentTime + ), + this._soundGain.gain.linearRampToValueAtTime( + e, + ve.b.audioEngine.audioContext.currentTime + t + )) + : (this._soundGain.gain.value = e)), + (this._volume = e); + }), + (e.prototype.setPlaybackRate = function (e) { + (this._playbackRate = e), + this.isPlaying && + (this._streaming && this._htmlAudioElement + ? (this._htmlAudioElement.playbackRate = + this._playbackRate) + : this._soundSource && + (this._soundSource.playbackRate.value = + this._playbackRate)); + }), + (e.prototype.getVolume = function () { + return this._volume; + }), + (e.prototype.attachToMesh = function (e) { + var t = this; + this._connectedTransformNode && + this._registerFunc && + (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate( + this._registerFunc + ), + (this._registerFunc = null)), + (this._connectedTransformNode = e), + this.spatialSound || + ((this.spatialSound = true), + this._createSpatialParameters(), + this.isPlaying && + this.loop && + (this.stop(), this.play())), + this._onRegisterAfterWorldMatrixUpdate( + this._connectedTransformNode + ), + (this._registerFunc = function (e) { + return t._onRegisterAfterWorldMatrixUpdate(e); + }), + this._connectedTransformNode.registerAfterWorldMatrixUpdate( + this._registerFunc + ); + }), + (e.prototype.detachFromMesh = function () { + this._connectedTransformNode && + this._registerFunc && + (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate( + this._registerFunc + ), + (this._registerFunc = null), + (this._connectedTransformNode = null)); + }), + (e.prototype._onRegisterAfterWorldMatrixUpdate = function ( + e + ) { + if (e.getBoundingInfo) { + var t = e; + if (this._positionInEmitterSpace) + t.worldMatrixFromCache.invertToRef(a.t.Matrix[0]), + this.setPosition(a.t.Matrix[0].getTranslation()); + else { + var i = t.getBoundingInfo(); + this.setPosition(i.boundingSphere.centerWorld); + } + ve.b.audioEngine.canUseWebAudio && + this._isDirectional && + this.isPlaying && + this._updateDirection(); + } + }), + (e.prototype.clone = function () { + var t = this; + if (this._streaming) return null; + var i = { + autoplay: this.autoplay, + loop: this.loop, + volume: this._volume, + spatialSound: this.spatialSound, + maxDistance: this.maxDistance, + useCustomAttenuation: this.useCustomAttenuation, + rolloffFactor: this.rolloffFactor, + refDistance: this.refDistance, + distanceModel: this.distanceModel, + }, + n = new e( + this.name + "_cloned", + new ArrayBuffer(0), + this._scene, + null, + i + ); + return ( + this.useCustomAttenuation && + n.setAttenuationFunction( + this._customAttenuationFunction + ), n.setPosition(this._position), n.setPlaybackRate(this._playbackRate), - function e() { - t._isReadyToPlay ? (n._audioBuffer = t.getAudioBuffer(), - n._isReadyToPlay = true, - n.autoplay && n.play()) : window.setTimeout(e, 300) - }(), + (function e() { + t._isReadyToPlay + ? ((n._audioBuffer = t.getAudioBuffer()), + (n._isReadyToPlay = true), + n.autoplay && n.play()) + : window.setTimeout(e, 300); + })(), n - } - , - e.prototype.getAudioBuffer = function() { - return this._audioBuffer - } - , - e.prototype.serialize = function() { - var e = { - name: this.name, - url: this.name, - autoplay: this.autoplay, - loop: this.loop, - volume: this._volume, - spatialSound: this.spatialSound, - maxDistance: this.maxDistance, - rolloffFactor: this.rolloffFactor, - refDistance: this.refDistance, - distanceModel: this.distanceModel, - playbackRate: this._playbackRate, - panningModel: this._panningModel, - soundTrackId: this.soundTrackId - }; - return this.spatialSound && (this._connectedTransformNode && (e.connectedMeshId = this._connectedTransformNode.id), - e.position = this._position.asArray(), - e.refDistance = this.refDistance, - e.distanceModel = this.distanceModel, - e.isDirectional = this._isDirectional, - e.localDirectionToMesh = this._localDirection.asArray(), - e.coneInnerAngle = this._coneInnerAngle, - e.coneOuterAngle = this._coneOuterAngle, - e.coneOuterGain = this._coneOuterGain), + ); + }), + (e.prototype.getAudioBuffer = function () { + return this._audioBuffer; + }), + (e.prototype.serialize = function () { + var e = { + name: this.name, + url: this.name, + autoplay: this.autoplay, + loop: this.loop, + volume: this._volume, + spatialSound: this.spatialSound, + maxDistance: this.maxDistance, + rolloffFactor: this.rolloffFactor, + refDistance: this.refDistance, + distanceModel: this.distanceModel, + playbackRate: this._playbackRate, + panningModel: this._panningModel, + soundTrackId: this.soundTrackId, + }; + return ( + this.spatialSound && + (this._connectedTransformNode && + (e.connectedMeshId = + this._connectedTransformNode.id), + (e.position = this._position.asArray()), + (e.refDistance = this.refDistance), + (e.distanceModel = this.distanceModel), + (e.isDirectional = this._isDirectional), + (e.localDirectionToMesh = + this._localDirection.asArray()), + (e.coneInnerAngle = this._coneInnerAngle), + (e.coneOuterAngle = this._coneOuterAngle), + (e.coneOuterGain = this._coneOuterGain)), e - } - , - e.Parse = function(t, i, n, r) { - var o, s = t.name; - o = t.url ? n + t.url : n + s; - var c, u = { - autoplay: t.autoplay, - loop: t.loop, - volume: t.volume, - spatialSound: t.spatialSound, - maxDistance: t.maxDistance, - rolloffFactor: t.rolloffFactor, - refDistance: t.refDistance, - distanceModel: t.distanceModel, - playbackRate: t.playbackRate + ); + }), + (e.Parse = function (t, i, n, r) { + var o, + s = t.name; + o = t.url ? n + t.url : n + s; + var c, + u = { + autoplay: t.autoplay, + loop: t.loop, + volume: t.volume, + spatialSound: t.spatialSound, + maxDistance: t.maxDistance, + rolloffFactor: t.rolloffFactor, + refDistance: t.refDistance, + distanceModel: t.distanceModel, + playbackRate: t.playbackRate, }; - if (r) { - c = new e(s,new ArrayBuffer(0),i,null,u), - function e() { - r._isReadyToPlay ? (c._audioBuffer = r.getAudioBuffer(), - c._isReadyToPlay = true, - c.autoplay && c.play()) : window.setTimeout(e, 300) - }() - } else - c = new e(s,o,i,function() { - i._removePendingData(c) - } - ,u), - i._addPendingData(c); - if (t.position) { - var l = a.x.FromArray(t.position); - c.setPosition(l) - } - if (t.isDirectional && (c.setDirectionalCone(t.coneInnerAngle || 360, t.coneOuterAngle || 360, t.coneOuterGain || 0), - t.localDirectionToMesh)) { - var h = a.x.FromArray(t.localDirectionToMesh); - c.setLocalDirectionToMesh(h) - } - if (t.connectedMeshId) { - var f = i.getMeshByID(t.connectedMeshId); - f && c.attachToMesh(f) - } - return c - } - , - e._SceneComponentInitialization = function(e) { - throw Te.a.WarnImport("AudioSceneComponent") - } - , + if (r) { + (c = new e(s, new ArrayBuffer(0), i, null, u)), + (function e() { + r._isReadyToPlay + ? ((c._audioBuffer = r.getAudioBuffer()), + (c._isReadyToPlay = true), + c.autoplay && c.play()) + : window.setTimeout(e, 300); + })(); + } else + (c = new e( + s, + o, + i, + function () { + i._removePendingData(c); + }, + u + )), + i._addPendingData(c); + if (t.position) { + var l = a.x.FromArray(t.position); + c.setPosition(l); + } + if ( + t.isDirectional && + (c.setDirectionalCone( + t.coneInnerAngle || 360, + t.coneOuterAngle || 360, + t.coneOuterGain || 0 + ), + t.localDirectionToMesh) + ) { + var h = a.x.FromArray(t.localDirectionToMesh); + c.setLocalDirectionToMesh(h); + } + if (t.connectedMeshId) { + var f = i.getMeshByID(t.connectedMeshId); + f && c.attachToMesh(f); + } + return c; + }), + (e._SceneComponentInitialization = function (e) { + throw Te.a.WarnImport("AudioSceneComponent"); + }), e - }() - , xe = function() { - function e(e, t) { - void 0 === t && (t = {}), - this.id = -1, - this._isMainTrack = false, - this._isInitialized = false, - this._scene = e, - this.soundCollection = new Array, - this._options = t, - !this._isMainTrack && this._scene.soundTracks && (this._scene.soundTracks.push(this), - this.id = this._scene.soundTracks.length - 1) - } - return e.prototype._initializeSoundTrackAudioGraph = function() { - ve.b.audioEngine.canUseWebAudio && ve.b.audioEngine.audioContext && (this._outputAudioNode = ve.b.audioEngine.audioContext.createGain(), - this._outputAudioNode.connect(ve.b.audioEngine.masterGain), - this._options && (this._options.volume && (this._outputAudioNode.gain.value = this._options.volume), - this._options.mainTrack && (this._isMainTrack = this._options.mainTrack)), - this._isInitialized = true) - } - , - e.prototype.dispose = function() { - if (ve.b.audioEngine && ve.b.audioEngine.canUseWebAudio) { - for (this._connectedAnalyser && this._connectedAnalyser.stopDebugCanvas(); this.soundCollection.length; ) - this.soundCollection[0].dispose(); - this._outputAudioNode && this._outputAudioNode.disconnect(), - this._outputAudioNode = null - } - } - , - e.prototype.AddSound = function(e) { - this._isInitialized || this._initializeSoundTrackAudioGraph(), - ve.b.audioEngine.canUseWebAudio && this._outputAudioNode && e.connectToSoundTrackAudioNode(this._outputAudioNode), - e.soundTrackId && (-1 === e.soundTrackId ? this._scene.mainSoundTrack.RemoveSound(e) : this._scene.soundTracks && this._scene.soundTracks[e.soundTrackId].RemoveSound(e)), + ); + })(), + xe = (function () { + function e(e, t) { + void 0 === t && (t = {}), + (this.id = -1), + (this._isMainTrack = false), + (this._isInitialized = false), + (this._scene = e), + (this.soundCollection = new Array()), + (this._options = t), + !this._isMainTrack && + this._scene.soundTracks && + (this._scene.soundTracks.push(this), + (this.id = this._scene.soundTracks.length - 1)); + } + return ( + (e.prototype._initializeSoundTrackAudioGraph = function () { + ve.b.audioEngine.canUseWebAudio && + ve.b.audioEngine.audioContext && + ((this._outputAudioNode = + ve.b.audioEngine.audioContext.createGain()), + this._outputAudioNode.connect( + ve.b.audioEngine.masterGain + ), + this._options && + (this._options.volume && + (this._outputAudioNode.gain.value = + this._options.volume), + this._options.mainTrack && + (this._isMainTrack = this._options.mainTrack)), + (this._isInitialized = true)); + }), + (e.prototype.dispose = function () { + if (ve.b.audioEngine && ve.b.audioEngine.canUseWebAudio) { + for ( + this._connectedAnalyser && + this._connectedAnalyser.stopDebugCanvas(); + this.soundCollection.length; + + ) + this.soundCollection[0].dispose(); + this._outputAudioNode && + this._outputAudioNode.disconnect(), + (this._outputAudioNode = null); + } + }), + (e.prototype.AddSound = function (e) { + this._isInitialized || + this._initializeSoundTrackAudioGraph(), + ve.b.audioEngine.canUseWebAudio && + this._outputAudioNode && + e.connectToSoundTrackAudioNode(this._outputAudioNode), + e.soundTrackId && + (-1 === e.soundTrackId + ? this._scene.mainSoundTrack.RemoveSound(e) + : this._scene.soundTracks && + this._scene.soundTracks[ + e.soundTrackId + ].RemoveSound(e)), this.soundCollection.push(e), - e.soundTrackId = this.id - } - , - e.prototype.RemoveSound = function(e) { - var t = this.soundCollection.indexOf(e); - -1 !== t && this.soundCollection.splice(t, 1) - } - , - e.prototype.setVolume = function(e) { - ve.b.audioEngine.canUseWebAudio && this._outputAudioNode && (this._outputAudioNode.gain.value = e) - } - , - e.prototype.switchPanningModelToHRTF = function() { - if (ve.b.audioEngine.canUseWebAudio) - for (var e = 0; e < this.soundCollection.length; e++) - this.soundCollection[e].switchPanningModelToHRTF() - } - , - e.prototype.switchPanningModelToEqualPower = function() { - if (ve.b.audioEngine.canUseWebAudio) - for (var e = 0; e < this.soundCollection.length; e++) - this.soundCollection[e].switchPanningModelToEqualPower() - } - , - e.prototype.connectToAnalyser = function(e) { - this._connectedAnalyser && this._connectedAnalyser.stopDebugCanvas(), - this._connectedAnalyser = e, - ve.b.audioEngine.canUseWebAudio && this._outputAudioNode && (this._outputAudioNode.disconnect(), - this._connectedAnalyser.connectAudioNodes(this._outputAudioNode, ve.b.audioEngine.masterGain)) - } - , + (e.soundTrackId = this.id); + }), + (e.prototype.RemoveSound = function (e) { + var t = this.soundCollection.indexOf(e); + -1 !== t && this.soundCollection.splice(t, 1); + }), + (e.prototype.setVolume = function (e) { + ve.b.audioEngine.canUseWebAudio && + this._outputAudioNode && + (this._outputAudioNode.gain.value = e); + }), + (e.prototype.switchPanningModelToHRTF = function () { + if (ve.b.audioEngine.canUseWebAudio) + for (var e = 0; e < this.soundCollection.length; e++) + this.soundCollection[e].switchPanningModelToHRTF(); + }), + (e.prototype.switchPanningModelToEqualPower = function () { + if (ve.b.audioEngine.canUseWebAudio) + for (var e = 0; e < this.soundCollection.length; e++) + this.soundCollection[ + e + ].switchPanningModelToEqualPower(); + }), + (e.prototype.connectToAnalyser = function (e) { + this._connectedAnalyser && + this._connectedAnalyser.stopDebugCanvas(), + (this._connectedAnalyser = e), + ve.b.audioEngine.canUseWebAudio && + this._outputAudioNode && + (this._outputAudioNode.disconnect(), + this._connectedAnalyser.connectAudioNodes( + this._outputAudioNode, + ve.b.audioEngine.masterGain + )); + }), e - }() - , Se = n(14); - r.a.AddParser(Se.a.NAME_AUDIO, function(e, t, i, n) { - var r, o = []; - if (i.sounds = i.sounds || [], - void 0 !== e.sounds && null !== e.sounds) - for (var a = 0, s = e.sounds.length; a < s; a++) { - var c = e.sounds[a]; - ve.b.audioEngine.canUseWebAudio ? (c.url || (c.url = c.name), - o[c.url] ? i.sounds.push(Ae.Parse(c, t, n, o[c.url])) : (r = Ae.Parse(c, t, n), - o[c.url] = r, - i.sounds.push(r))) : i.sounds.push(new Ae(c.name,null,t)) - } - o = [] - }), + ); + })(), + Se = n(14); + r.a.AddParser(Se.a.NAME_AUDIO, function (e, t, i, n) { + var r, + o = []; + if ( + ((i.sounds = i.sounds || []), + void 0 !== e.sounds && null !== e.sounds) + ) + for (var a = 0, s = e.sounds.length; a < s; a++) { + var c = e.sounds[a]; + ve.b.audioEngine.canUseWebAudio + ? (c.url || (c.url = c.name), + o[c.url] + ? i.sounds.push(Ae.Parse(c, t, n, o[c.url])) + : ((r = Ae.Parse(c, t, n)), + (o[c.url] = r), + i.sounds.push(r))) + : i.sounds.push(new Ae(c.name, null, t)); + } + o = []; + }), Object.defineProperty(Y.a.prototype, "mainSoundTrack", { - get: function() { - var e = this._getComponent(Se.a.NAME_AUDIO); - return e || (e = new Ce(this), - this._addComponent(e)), - this._mainSoundTrack || (this._mainSoundTrack = new xe(this,{ - mainTrack: true + get: function () { + var e = this._getComponent(Se.a.NAME_AUDIO); + return ( + e || ((e = new Ce(this)), this._addComponent(e)), + this._mainSoundTrack || + (this._mainSoundTrack = new xe(this, { + mainTrack: true, })), - this._mainSoundTrack - }, - enumerable: true, - configurable: true + this._mainSoundTrack + ); + }, + enumerable: true, + configurable: true, + }), + (Y.a.prototype.getSoundByName = function (e) { + var t; + for ( + t = 0; + t < this.mainSoundTrack.soundCollection.length; + t++ + ) + if (this.mainSoundTrack.soundCollection[t].name === e) + return this.mainSoundTrack.soundCollection[t]; + if (this.soundTracks) + for (var i = 0; i < this.soundTracks.length; i++) + for ( + t = 0; + t < this.soundTracks[i].soundCollection.length; + t++ + ) + if (this.soundTracks[i].soundCollection[t].name === e) + return this.soundTracks[i].soundCollection[t]; + return null; }), - Y.a.prototype.getSoundByName = function(e) { - var t; - for (t = 0; t < this.mainSoundTrack.soundCollection.length; t++) - if (this.mainSoundTrack.soundCollection[t].name === e) - return this.mainSoundTrack.soundCollection[t]; - if (this.soundTracks) - for (var i = 0; i < this.soundTracks.length; i++) - for (t = 0; t < this.soundTracks[i].soundCollection.length; t++) - if (this.soundTracks[i].soundCollection[t].name === e) - return this.soundTracks[i].soundCollection[t]; - return null - } - , Object.defineProperty(Y.a.prototype, "audioEnabled", { - get: function() { - var e = this._getComponent(Se.a.NAME_AUDIO); - return e || (e = new Ce(this), - this._addComponent(e)), - e.audioEnabled - }, - set: function(e) { - var t = this._getComponent(Se.a.NAME_AUDIO); - t || (t = new Ce(this), - this._addComponent(t)), - e ? t.enableAudio() : t.disableAudio() - }, - enumerable: true, - configurable: true + get: function () { + var e = this._getComponent(Se.a.NAME_AUDIO); + return ( + e || ((e = new Ce(this)), this._addComponent(e)), + e.audioEnabled + ); + }, + set: function (e) { + var t = this._getComponent(Se.a.NAME_AUDIO); + t || ((t = new Ce(this)), this._addComponent(t)), + e ? t.enableAudio() : t.disableAudio(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(Y.a.prototype, "headphone", { - get: function() { - var e = this._getComponent(Se.a.NAME_AUDIO); - return e || (e = new Ce(this), - this._addComponent(e)), - e.headphone - }, - set: function(e) { - var t = this._getComponent(Se.a.NAME_AUDIO); - t || (t = new Ce(this), - this._addComponent(t)), - e ? t.switchAudioModeForHeadphones() : t.switchAudioModeForNormalSpeakers() + get: function () { + var e = this._getComponent(Se.a.NAME_AUDIO); + return ( + e || ((e = new Ce(this)), this._addComponent(e)), + e.headphone + ); + }, + set: function (e) { + var t = this._getComponent(Se.a.NAME_AUDIO); + t || ((t = new Ce(this)), this._addComponent(t)), + e + ? t.switchAudioModeForHeadphones() + : t.switchAudioModeForNormalSpeakers(); + }, + enumerable: true, + configurable: true, + }); + var Ce = (function () { + function e(e) { + (this.name = Se.a.NAME_AUDIO), + (this._audioEnabled = true), + (this._headphone = false), + (this.scene = e), + (e.soundTracks = new Array()), + (e.sounds = new Array()); + } + return ( + Object.defineProperty(e.prototype, "audioEnabled", { + get: function () { + return this._audioEnabled; }, enumerable: true, - configurable: true - }); - var Ce = function() { - function e(e) { - this.name = Se.a.NAME_AUDIO, - this._audioEnabled = true, - this._headphone = false, - this.scene = e, - e.soundTracks = new Array, - e.sounds = new Array - } - return Object.defineProperty(e.prototype, "audioEnabled", { - get: function() { - return this._audioEnabled - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "headphone", { - get: function() { - return this._headphone - }, - enumerable: true, - configurable: true - }), - e.prototype.register = function() { - this.scene._afterRenderStage.registerStep(Se.a.STEP_AFTERRENDER_AUDIO, this, this._afterRender) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.serialize = function(e) { - if (e.sounds = [], - this.scene.soundTracks) - for (var t = 0; t < this.scene.soundTracks.length; t++) - for (var i = this.scene.soundTracks[t], n = 0; n < i.soundCollection.length; n++) - e.sounds.push(i.soundCollection[n].serialize()) - } - , - e.prototype.addFromContainer = function(e) { - var t = this; - e.sounds && e.sounds.forEach(function(e) { - e.play(), - e.autoplay = true, - t.scene.mainSoundTrack.AddSound(e) - }) - } - , - e.prototype.removeFromContainer = function(e, t) { - var i = this; - void 0 === t && (t = false), - e.sounds && e.sounds.forEach(function(e) { - e.stop(), - e.autoplay = false, + configurable: true, + }), + Object.defineProperty(e.prototype, "headphone", { + get: function () { + return this._headphone; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.register = function () { + this.scene._afterRenderStage.registerStep( + Se.a.STEP_AFTERRENDER_AUDIO, + this, + this._afterRender + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.serialize = function (e) { + if (((e.sounds = []), this.scene.soundTracks)) + for (var t = 0; t < this.scene.soundTracks.length; t++) + for ( + var i = this.scene.soundTracks[t], n = 0; + n < i.soundCollection.length; + n++ + ) + e.sounds.push(i.soundCollection[n].serialize()); + }), + (e.prototype.addFromContainer = function (e) { + var t = this; + e.sounds && + e.sounds.forEach(function (e) { + e.play(), + (e.autoplay = true), + t.scene.mainSoundTrack.AddSound(e); + }); + }), + (e.prototype.removeFromContainer = function (e, t) { + var i = this; + void 0 === t && (t = false), + e.sounds && + e.sounds.forEach(function (e) { + e.stop(), + (e.autoplay = false), i.scene.mainSoundTrack.RemoveSound(e), - t && e.dispose() - }) - } - , - e.prototype.dispose = function() { - var e = this.scene; - if (e._mainSoundTrack && e.mainSoundTrack.dispose(), - e.soundTracks) - for (var t = 0; t < e.soundTracks.length; t++) - e.soundTracks[t].dispose() - } - , - e.prototype.disableAudio = function() { - var e, t = this.scene; - for (this._audioEnabled = false, - e = 0; e < t.mainSoundTrack.soundCollection.length; e++) - t.mainSoundTrack.soundCollection[e].pause(); - if (t.soundTracks) - for (e = 0; e < t.soundTracks.length; e++) - for (var i = 0; i < t.soundTracks[e].soundCollection.length; i++) - t.soundTracks[e].soundCollection[i].pause() - } - , - e.prototype.enableAudio = function() { - var e, t = this.scene; - for (this._audioEnabled = true, - e = 0; e < t.mainSoundTrack.soundCollection.length; e++) - t.mainSoundTrack.soundCollection[e].isPaused && t.mainSoundTrack.soundCollection[e].play(); - if (t.soundTracks) - for (e = 0; e < t.soundTracks.length; e++) - for (var i = 0; i < t.soundTracks[e].soundCollection.length; i++) - t.soundTracks[e].soundCollection[i].isPaused && t.soundTracks[e].soundCollection[i].play() - } - , - e.prototype.switchAudioModeForHeadphones = function() { - var e = this.scene; - if (this._headphone = true, - e.mainSoundTrack.switchPanningModelToHRTF(), - e.soundTracks) - for (var t = 0; t < e.soundTracks.length; t++) - e.soundTracks[t].switchPanningModelToHRTF() - } - , - e.prototype.switchAudioModeForNormalSpeakers = function() { - var e = this.scene; - if (this._headphone = false, - e.mainSoundTrack.switchPanningModelToEqualPower(), - e.soundTracks) - for (var t = 0; t < e.soundTracks.length; t++) - e.soundTracks[t].switchPanningModelToEqualPower() - } - , - e.prototype._afterRender = function() { - var e = this.scene; - if (this._audioEnabled && e._mainSoundTrack && e.soundTracks && (0 !== e._mainSoundTrack.soundCollection.length || 1 !== e.soundTracks.length)) { - var t, i = ve.b.audioEngine; - if ((t = e.activeCameras.length > 0 ? e.activeCameras[0] : e.activeCamera) && i.audioContext) { - i.audioContext.listener.setPosition(t.position.x, t.position.y, t.position.z), - t.rigCameras && t.rigCameras.length > 0 && (t = t.rigCameras[0]); - var n, r = a.j.Invert(t.getViewMatrix()), o = a.x.TransformNormal(new a.x(0,0,-1), r); - for (o.normalize(), - isNaN(o.x) || isNaN(o.y) || isNaN(o.z) || i.audioContext.listener.setOrientation(o.x, o.y, o.z, 0, 1, 0), - n = 0; n < e.mainSoundTrack.soundCollection.length; n++) { - var s = e.mainSoundTrack.soundCollection[n]; - s.useCustomAttenuation && s.updateDistanceFromListener() - } - if (e.soundTracks) - for (n = 0; n < e.soundTracks.length; n++) - for (var c = 0; c < e.soundTracks[n].soundCollection.length; c++) - (s = e.soundTracks[n].soundCollection[c]).useCustomAttenuation && s.updateDistanceFromListener() - } + t && e.dispose(); + }); + }), + (e.prototype.dispose = function () { + var e = this.scene; + if ( + (e._mainSoundTrack && e.mainSoundTrack.dispose(), + e.soundTracks) + ) + for (var t = 0; t < e.soundTracks.length; t++) + e.soundTracks[t].dispose(); + }), + (e.prototype.disableAudio = function () { + var e, + t = this.scene; + for ( + this._audioEnabled = false, e = 0; + e < t.mainSoundTrack.soundCollection.length; + e++ + ) + t.mainSoundTrack.soundCollection[e].pause(); + if (t.soundTracks) + for (e = 0; e < t.soundTracks.length; e++) + for ( + var i = 0; + i < t.soundTracks[e].soundCollection.length; + i++ + ) + t.soundTracks[e].soundCollection[i].pause(); + }), + (e.prototype.enableAudio = function () { + var e, + t = this.scene; + for ( + this._audioEnabled = true, e = 0; + e < t.mainSoundTrack.soundCollection.length; + e++ + ) + t.mainSoundTrack.soundCollection[e].isPaused && + t.mainSoundTrack.soundCollection[e].play(); + if (t.soundTracks) + for (e = 0; e < t.soundTracks.length; e++) + for ( + var i = 0; + i < t.soundTracks[e].soundCollection.length; + i++ + ) + t.soundTracks[e].soundCollection[i].isPaused && + t.soundTracks[e].soundCollection[i].play(); + }), + (e.prototype.switchAudioModeForHeadphones = function () { + var e = this.scene; + if ( + ((this._headphone = true), + e.mainSoundTrack.switchPanningModelToHRTF(), + e.soundTracks) + ) + for (var t = 0; t < e.soundTracks.length; t++) + e.soundTracks[t].switchPanningModelToHRTF(); + }), + (e.prototype.switchAudioModeForNormalSpeakers = function () { + var e = this.scene; + if ( + ((this._headphone = false), + e.mainSoundTrack.switchPanningModelToEqualPower(), + e.soundTracks) + ) + for (var t = 0; t < e.soundTracks.length; t++) + e.soundTracks[t].switchPanningModelToEqualPower(); + }), + (e.prototype._afterRender = function () { + var e = this.scene; + if ( + this._audioEnabled && + e._mainSoundTrack && + e.soundTracks && + (0 !== e._mainSoundTrack.soundCollection.length || + 1 !== e.soundTracks.length) + ) { + var t, + i = ve.b.audioEngine; + if ( + (t = + e.activeCameras.length > 0 + ? e.activeCameras[0] + : e.activeCamera) && + i.audioContext + ) { + i.audioContext.listener.setPosition( + t.position.x, + t.position.y, + t.position.z + ), + t.rigCameras && + t.rigCameras.length > 0 && + (t = t.rigCameras[0]); + var n, + r = a.j.Invert(t.getViewMatrix()), + o = a.x.TransformNormal(new a.x(0, 0, -1), r); + for ( + o.normalize(), + isNaN(o.x) || + isNaN(o.y) || + isNaN(o.z) || + i.audioContext.listener.setOrientation( + o.x, + o.y, + o.z, + 0, + 1, + 0 + ), + n = 0; + n < e.mainSoundTrack.soundCollection.length; + n++ + ) { + var s = e.mainSoundTrack.soundCollection[n]; + s.useCustomAttenuation && + s.updateDistanceFromListener(); } + if (e.soundTracks) + for (n = 0; n < e.soundTracks.length; n++) + for ( + var c = 0; + c < e.soundTracks[n].soundCollection.length; + c++ + ) + (s = e.soundTracks[n].soundCollection[c]) + .useCustomAttenuation && + s.updateDistanceFromListener(); + } } - , - e - }(); - Ae._SceneComponentInitialization = function(e) { - var t = e._getComponent(Se.a.NAME_AUDIO); - t || (t = new Ce(e), - e._addComponent(t)) - } - ; - var Pe = function() { - function e(e, t, i) { - var n = this; - if (this.loop = false, - this._coneInnerAngle = 360, - this._coneOuterAngle = 360, - this._volume = 1, - this.isPlaying = false, - this.isPaused = false, - this._sounds = [], - this._weights = [], - t.length !== i.length) - throw new Error("Sounds length does not equal weights length"); - this.loop = e, - this._weights = i; - for (var r = 0, o = 0, a = i; o < a.length; o++) - r += a[o]; - for (var s = r > 0 ? 1 / r : 0, c = 0; c < this._weights.length; c++) - this._weights[c] *= s; - this._sounds = t; - for (var u = 0, l = this._sounds; u < l.length; u++) - l[u].onEndedObservable.add(function() { - n._onended() - }) - } - return Object.defineProperty(e.prototype, "directionalConeInnerAngle", { - get: function() { - return this._coneInnerAngle + }), + e + ); + })(); + Ae._SceneComponentInitialization = function (e) { + var t = e._getComponent(Se.a.NAME_AUDIO); + t || ((t = new Ce(e)), e._addComponent(t)); + }; + var Pe = (function () { + function e(e, t, i) { + var n = this; + if ( + ((this.loop = false), + (this._coneInnerAngle = 360), + (this._coneOuterAngle = 360), + (this._volume = 1), + (this.isPlaying = false), + (this.isPaused = false), + (this._sounds = []), + (this._weights = []), + t.length !== i.length) + ) + throw new Error( + "Sounds length does not equal weights length" + ); + (this.loop = e), (this._weights = i); + for (var r = 0, o = 0, a = i; o < a.length; o++) r += a[o]; + for ( + var s = r > 0 ? 1 / r : 0, c = 0; + c < this._weights.length; + c++ + ) + this._weights[c] *= s; + this._sounds = t; + for (var u = 0, l = this._sounds; u < l.length; u++) + l[u].onEndedObservable.add(function () { + n._onended(); + }); + } + return ( + Object.defineProperty( + e.prototype, + "directionalConeInnerAngle", + { + get: function () { + return this._coneInnerAngle; }, - set: function(e) { - if (e !== this._coneInnerAngle) { - if (this._coneOuterAngle < e) - return void g.a.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle."); - this._coneInnerAngle = e; - for (var t = 0, i = this._sounds; t < i.length; t++) - i[t].directionalConeInnerAngle = e - } + set: function (e) { + if (e !== this._coneInnerAngle) { + if (this._coneOuterAngle < e) + return void g.a.Error( + "directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle." + ); + this._coneInnerAngle = e; + for (var t = 0, i = this._sounds; t < i.length; t++) + i[t].directionalConeInnerAngle = e; + } }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "directionalConeOuterAngle", { - get: function() { - return this._coneOuterAngle + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "directionalConeOuterAngle", + { + get: function () { + return this._coneOuterAngle; }, - set: function(e) { - if (e !== this._coneOuterAngle) { - if (e < this._coneInnerAngle) - return void g.a.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle."); - this._coneOuterAngle = e; - for (var t = 0, i = this._sounds; t < i.length; t++) - i[t].directionalConeOuterAngle = e - } + set: function (e) { + if (e !== this._coneOuterAngle) { + if (e < this._coneInnerAngle) + return void g.a.Error( + "directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle." + ); + this._coneOuterAngle = e; + for (var t = 0, i = this._sounds; t < i.length; t++) + i[t].directionalConeOuterAngle = e; + } }, enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "volume", { - get: function() { - return this._volume - }, - set: function(e) { - if (e !== this._volume) - for (var t = 0, i = this._sounds; t < i.length; t++) - i[t].setVolume(e) - }, - enumerable: true, - configurable: true + get: function () { + return this._volume; + }, + set: function (e) { + if (e !== this._volume) + for (var t = 0, i = this._sounds; t < i.length; t++) + i[t].setVolume(e); + }, + enumerable: true, + configurable: true, + }), + (e.prototype._onended = function () { + void 0 !== this._currentIndex && + (this._sounds[this._currentIndex].autoplay = false), + this.loop && this.isPlaying + ? this.play() + : (this.isPlaying = false); + }), + (e.prototype.pause = function () { + (this.isPaused = true), + void 0 !== this._currentIndex && + this._sounds[this._currentIndex].pause(); + }), + (e.prototype.stop = function () { + (this.isPlaying = false), + void 0 !== this._currentIndex && + this._sounds[this._currentIndex].stop(); + }), + (e.prototype.play = function (e) { + if (!this.isPaused) { + this.stop(); + for ( + var t = Math.random(), i = 0, n = 0; + n < this._weights.length; + n++ + ) + if (t <= (i += this._weights[n])) { + this._currentIndex = n; + break; + } + } + var r = this._sounds[this._currentIndex]; + r.isReady() + ? r.play(0, this.isPaused ? void 0 : e) + : (r.autoplay = true), + (this.isPlaying = true), + (this.isPaused = false); }), - e.prototype._onended = function() { - void 0 !== this._currentIndex && (this._sounds[this._currentIndex].autoplay = false), - this.loop && this.isPlaying ? this.play() : this.isPlaying = false - } - , - e.prototype.pause = function() { - this.isPaused = true, - void 0 !== this._currentIndex && this._sounds[this._currentIndex].pause() - } - , - e.prototype.stop = function() { - this.isPlaying = false, - void 0 !== this._currentIndex && this._sounds[this._currentIndex].stop() - } - , - e.prototype.play = function(e) { - if (!this.isPaused) { - this.stop(); - for (var t = Math.random(), i = 0, n = 0; n < this._weights.length; n++) - if (t <= (i += this._weights[n])) { - this._currentIndex = n; - break - } - } - var r = this._sounds[this._currentIndex]; - r.isReady() ? r.play(0, this.isPaused ? void 0 : e) : r.autoplay = true, - this.isPlaying = true, - this.isPaused = false - } - , e - }() - , Re = n(17) - , Me = function() { - function e() { - this._zoomStopsAnimation = false, - this._idleRotationSpeed = .05, - this._idleRotationWaitTime = 2e3, - this._idleRotationSpinupTime = 2e3, - this._isPointerDown = false, - this._lastFrameTime = null, - this._lastInteractionTime = -1 / 0, - this._cameraRotationSpeed = 0, - this._lastFrameRadius = 0 - } - return Object.defineProperty(e.prototype, "name", { - get: function() { - return "AutoRotation" - }, - enumerable: true, - configurable: true + ); + })(), + Re = n(17), + Me = (function () { + function e() { + (this._zoomStopsAnimation = false), + (this._idleRotationSpeed = 0.05), + (this._idleRotationWaitTime = 2e3), + (this._idleRotationSpinupTime = 2e3), + (this._isPointerDown = false), + (this._lastFrameTime = null), + (this._lastInteractionTime = -1 / 0), + (this._cameraRotationSpeed = 0), + (this._lastFrameRadius = 0); + } + return ( + Object.defineProperty(e.prototype, "name", { + get: function () { + return "AutoRotation"; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "zoomStopsAnimation", { - get: function() { - return this._zoomStopsAnimation - }, - set: function(e) { - this._zoomStopsAnimation = e - }, - enumerable: true, - configurable: true + get: function () { + return this._zoomStopsAnimation; + }, + set: function (e) { + this._zoomStopsAnimation = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "idleRotationSpeed", { - get: function() { - return this._idleRotationSpeed - }, - set: function(e) { - this._idleRotationSpeed = e - }, - enumerable: true, - configurable: true + get: function () { + return this._idleRotationSpeed; + }, + set: function (e) { + this._idleRotationSpeed = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "idleRotationWaitTime", { - get: function() { - return this._idleRotationWaitTime + get: function () { + return this._idleRotationWaitTime; + }, + set: function (e) { + this._idleRotationWaitTime = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "idleRotationSpinupTime", + { + get: function () { + return this._idleRotationSpinupTime; }, - set: function(e) { - this._idleRotationWaitTime = e + set: function (e) { + this._idleRotationSpinupTime = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "idleRotationSpinupTime", { - get: function() { - return this._idleRotationSpinupTime - }, - set: function(e) { - this._idleRotationSpinupTime = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "rotationInProgress", { - get: function() { - return Math.abs(this._cameraRotationSpeed) > 0 - }, - enumerable: true, - configurable: true + get: function () { + return Math.abs(this._cameraRotationSpeed) > 0; + }, + enumerable: true, + configurable: true, }), - e.prototype.init = function() {} - , - e.prototype.attach = function(e) { - var t = this; - this._attachedCamera = e; - var i = this._attachedCamera.getScene(); - this._onPrePointerObservableObserver = i.onPrePointerObservable.add(function(e) { - e.type !== Re.a.POINTERDOWN ? e.type === Re.a.POINTERUP && (t._isPointerDown = false) : t._isPointerDown = true - }), - this._onAfterCheckInputsObserver = e.onAfterCheckInputsObservable.add(function() { - var e = K.a.Now - , i = 0; - null != t._lastFrameTime && (i = e - t._lastFrameTime), - t._lastFrameTime = e, - t._applyUserInteraction(); - var n = e - t._lastInteractionTime - t._idleRotationWaitTime - , r = Math.max(Math.min(n / t._idleRotationSpinupTime, 1), 0); - t._cameraRotationSpeed = t._idleRotationSpeed * r, - t._attachedCamera && (t._attachedCamera.alpha -= t._cameraRotationSpeed * (i / 1e3)) - }) - } - , - e.prototype.detach = function() { - if (this._attachedCamera) { - var e = this._attachedCamera.getScene(); - this._onPrePointerObservableObserver && e.onPrePointerObservable.remove(this._onPrePointerObservableObserver), - this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver), - this._attachedCamera = null - } - } - , - e.prototype._userIsZooming = function() { - return !!this._attachedCamera && 0 !== this._attachedCamera.inertialRadiusOffset - } - , - e.prototype._shouldAnimationStopForInteraction = function() { - if (!this._attachedCamera) - return false; + (e.prototype.init = function () {}), + (e.prototype.attach = function (e) { + var t = this; + this._attachedCamera = e; + var i = this._attachedCamera.getScene(); + (this._onPrePointerObservableObserver = + i.onPrePointerObservable.add(function (e) { + e.type !== Re.a.POINTERDOWN + ? e.type === Re.a.POINTERUP && + (t._isPointerDown = false) + : (t._isPointerDown = true); + })), + (this._onAfterCheckInputsObserver = + e.onAfterCheckInputsObservable.add(function () { + var e = K.a.Now, + i = 0; + null != t._lastFrameTime && + (i = e - t._lastFrameTime), + (t._lastFrameTime = e), + t._applyUserInteraction(); + var n = + e - + t._lastInteractionTime - + t._idleRotationWaitTime, + r = Math.max( + Math.min(n / t._idleRotationSpinupTime, 1), + 0 + ); + (t._cameraRotationSpeed = t._idleRotationSpeed * r), + t._attachedCamera && + (t._attachedCamera.alpha -= + t._cameraRotationSpeed * (i / 1e3)); + })); + }), + (e.prototype.detach = function () { + if (this._attachedCamera) { + var e = this._attachedCamera.getScene(); + this._onPrePointerObservableObserver && + e.onPrePointerObservable.remove( + this._onPrePointerObservableObserver + ), + this._attachedCamera.onAfterCheckInputsObservable.remove( + this._onAfterCheckInputsObserver + ), + (this._attachedCamera = null); + } + }), + (e.prototype._userIsZooming = function () { + return ( + !!this._attachedCamera && + 0 !== this._attachedCamera.inertialRadiusOffset + ); + }), + (e.prototype._shouldAnimationStopForInteraction = + function () { + if (!this._attachedCamera) return false; var e = false; - return this._lastFrameRadius === this._attachedCamera.radius && 0 !== this._attachedCamera.inertialRadiusOffset && (e = true), - this._lastFrameRadius = this._attachedCamera.radius, - this._zoomStopsAnimation ? e : this._userIsZooming() - } - , - e.prototype._applyUserInteraction = function() { - this._userIsMoving() && !this._shouldAnimationStopForInteraction() && (this._lastInteractionTime = K.a.Now) - } - , - e.prototype._userIsMoving = function() { - return !!this._attachedCamera && (0 !== this._attachedCamera.inertialAlphaOffset || 0 !== this._attachedCamera.inertialBetaOffset || 0 !== this._attachedCamera.inertialRadiusOffset || 0 !== this._attachedCamera.inertialPanningX || 0 !== this._attachedCamera.inertialPanningY || this._isPointerDown) - } - , + return ( + this._lastFrameRadius === + this._attachedCamera.radius && + 0 !== this._attachedCamera.inertialRadiusOffset && + (e = true), + (this._lastFrameRadius = this._attachedCamera.radius), + this._zoomStopsAnimation ? e : this._userIsZooming() + ); + }), + (e.prototype._applyUserInteraction = function () { + this._userIsMoving() && + !this._shouldAnimationStopForInteraction() && + (this._lastInteractionTime = K.a.Now); + }), + (e.prototype._userIsMoving = function () { + return ( + !!this._attachedCamera && + (0 !== this._attachedCamera.inertialAlphaOffset || + 0 !== this._attachedCamera.inertialBetaOffset || + 0 !== this._attachedCamera.inertialRadiusOffset || + 0 !== this._attachedCamera.inertialPanningX || + 0 !== this._attachedCamera.inertialPanningY || + this._isPointerDown) + ); + }), e - }() - , Oe = function() { - function e() { - this.transitionDuration = 450, - this.lowerRadiusTransitionRange = 2, - this.upperRadiusTransitionRange = -2, - this._autoTransitionRange = false, - this._radiusIsAnimating = false, - this._radiusBounceTransition = null, - this._animatables = new Array - } - return Object.defineProperty(e.prototype, "name", { - get: function() { - return "Bouncing" - }, - enumerable: true, - configurable: true + ); + })(), + Oe = (function () { + function e() { + (this.transitionDuration = 450), + (this.lowerRadiusTransitionRange = 2), + (this.upperRadiusTransitionRange = -2), + (this._autoTransitionRange = false), + (this._radiusIsAnimating = false), + (this._radiusBounceTransition = null), + (this._animatables = new Array()); + } + return ( + Object.defineProperty(e.prototype, "name", { + get: function () { + return "Bouncing"; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "autoTransitionRange", { - get: function() { - return this._autoTransitionRange - }, - set: function(e) { - var t = this; - if (this._autoTransitionRange !== e) { - this._autoTransitionRange = e; - var i = this._attachedCamera; - i && (e ? this._onMeshTargetChangedObserver = i.onMeshTargetChangedObservable.add(function(e) { - if (e) { - e.computeWorldMatrix(true); - var i = e.getBoundingInfo().diagonalLength; - t.lowerRadiusTransitionRange = .05 * i, - t.upperRadiusTransitionRange = .05 * i - } - }) : this._onMeshTargetChangedObserver && i.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver)) - } - }, - enumerable: true, - configurable: true - }), - e.prototype.init = function() {} - , - e.prototype.attach = function(e) { + get: function () { + return this._autoTransitionRange; + }, + set: function (e) { var t = this; - this._attachedCamera = e, - this._onAfterCheckInputsObserver = e.onAfterCheckInputsObservable.add(function() { - t._attachedCamera && (t._isRadiusAtLimit(t._attachedCamera.lowerRadiusLimit) && t._applyBoundRadiusAnimation(t.lowerRadiusTransitionRange), - t._isRadiusAtLimit(t._attachedCamera.upperRadiusLimit) && t._applyBoundRadiusAnimation(t.upperRadiusTransitionRange)) - }) - } - , - e.prototype.detach = function() { - this._attachedCamera && (this._onAfterCheckInputsObserver && this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver), - this._onMeshTargetChangedObserver && this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver), - this._attachedCamera = null) - } - , - e.prototype._isRadiusAtLimit = function(e) { - return !!this._attachedCamera && this._attachedCamera.radius === e && !this._radiusIsAnimating - } - , - e.prototype._applyBoundRadiusAnimation = function(t) { - var i = this; - if (this._attachedCamera) { - this._radiusBounceTransition || (e.EasingFunction.setEasingMode(e.EasingMode), - this._radiusBounceTransition = U.CreateAnimation("radius", U.ANIMATIONTYPE_FLOAT, 60, e.EasingFunction)), - this._cachedWheelPrecision = this._attachedCamera.wheelPrecision, - this._attachedCamera.wheelPrecision = 1 / 0, - this._attachedCamera.inertialRadiusOffset = 0, - this.stopAllAnimations(), - this._radiusIsAnimating = true; - var n = U.TransitionTo("radius", this._attachedCamera.radius + t, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusBounceTransition, this.transitionDuration, function() { - return i._clearAnimationLocks() - }); - n && this._animatables.push(n) + if (this._autoTransitionRange !== e) { + this._autoTransitionRange = e; + var i = this._attachedCamera; + i && + (e + ? (this._onMeshTargetChangedObserver = + i.onMeshTargetChangedObservable.add(function ( + e + ) { + if (e) { + e.computeWorldMatrix(true); + var i = + e.getBoundingInfo().diagonalLength; + (t.lowerRadiusTransitionRange = 0.05 * i), + (t.upperRadiusTransitionRange = + 0.05 * i); + } + })) + : this._onMeshTargetChangedObserver && + i.onMeshTargetChangedObservable.remove( + this._onMeshTargetChangedObserver + )); } - } - , - e.prototype._clearAnimationLocks = function() { - this._radiusIsAnimating = false, - this._attachedCamera && (this._attachedCamera.wheelPrecision = this._cachedWheelPrecision) - } - , - e.prototype.stopAllAnimations = function() { - for (this._attachedCamera && (this._attachedCamera.animations = []); this._animatables.length; ) - this._animatables[0].onAnimationEnd = null, - this._animatables[0].stop(), - this._animatables.shift() - } - , - e.EasingFunction = new ne(.3), - e.EasingMode = te.EASINGMODE_EASEOUT, + }, + enumerable: true, + configurable: true, + }), + (e.prototype.init = function () {}), + (e.prototype.attach = function (e) { + var t = this; + (this._attachedCamera = e), + (this._onAfterCheckInputsObserver = + e.onAfterCheckInputsObservable.add(function () { + t._attachedCamera && + (t._isRadiusAtLimit( + t._attachedCamera.lowerRadiusLimit + ) && + t._applyBoundRadiusAnimation( + t.lowerRadiusTransitionRange + ), + t._isRadiusAtLimit( + t._attachedCamera.upperRadiusLimit + ) && + t._applyBoundRadiusAnimation( + t.upperRadiusTransitionRange + )); + })); + }), + (e.prototype.detach = function () { + this._attachedCamera && + (this._onAfterCheckInputsObserver && + this._attachedCamera.onAfterCheckInputsObservable.remove( + this._onAfterCheckInputsObserver + ), + this._onMeshTargetChangedObserver && + this._attachedCamera.onMeshTargetChangedObservable.remove( + this._onMeshTargetChangedObserver + ), + (this._attachedCamera = null)); + }), + (e.prototype._isRadiusAtLimit = function (e) { + return ( + !!this._attachedCamera && + this._attachedCamera.radius === e && + !this._radiusIsAnimating + ); + }), + (e.prototype._applyBoundRadiusAnimation = function (t) { + var i = this; + if (this._attachedCamera) { + this._radiusBounceTransition || + (e.EasingFunction.setEasingMode(e.EasingMode), + (this._radiusBounceTransition = U.CreateAnimation( + "radius", + U.ANIMATIONTYPE_FLOAT, + 60, + e.EasingFunction + ))), + (this._cachedWheelPrecision = + this._attachedCamera.wheelPrecision), + (this._attachedCamera.wheelPrecision = 1 / 0), + (this._attachedCamera.inertialRadiusOffset = 0), + this.stopAllAnimations(), + (this._radiusIsAnimating = true); + var n = U.TransitionTo( + "radius", + this._attachedCamera.radius + t, + this._attachedCamera, + this._attachedCamera.getScene(), + 60, + this._radiusBounceTransition, + this.transitionDuration, + function () { + return i._clearAnimationLocks(); + } + ); + n && this._animatables.push(n); + } + }), + (e.prototype._clearAnimationLocks = function () { + (this._radiusIsAnimating = false), + this._attachedCamera && + (this._attachedCamera.wheelPrecision = + this._cachedWheelPrecision); + }), + (e.prototype.stopAllAnimations = function () { + for ( + this._attachedCamera && + (this._attachedCamera.animations = []); + this._animatables.length; + + ) + (this._animatables[0].onAnimationEnd = null), + this._animatables[0].stop(), + this._animatables.shift(); + }), + (e.EasingFunction = new ne(0.3)), + (e.EasingMode = te.EASINGMODE_EASEOUT), e - }() - , we = function() { - function e() { - this._mode = e.FitFrustumSidesMode, - this._radiusScale = 1, - this._positionScale = .5, - this._defaultElevation = .3, - this._elevationReturnTime = 1500, - this._elevationReturnWaitTime = 1e3, - this._zoomStopsAnimation = false, - this._framingTime = 1500, - this.autoCorrectCameraLimitsAndSensibility = true, - this._isPointerDown = false, - this._lastInteractionTime = -1 / 0, - this._animatables = new Array, - this._betaIsAnimating = false - } - return Object.defineProperty(e.prototype, "name", { - get: function() { - return "Framing" - }, - enumerable: true, - configurable: true + ); + })(), + we = (function () { + function e() { + (this._mode = e.FitFrustumSidesMode), + (this._radiusScale = 1), + (this._positionScale = 0.5), + (this._defaultElevation = 0.3), + (this._elevationReturnTime = 1500), + (this._elevationReturnWaitTime = 1e3), + (this._zoomStopsAnimation = false), + (this._framingTime = 1500), + (this.autoCorrectCameraLimitsAndSensibility = true), + (this._isPointerDown = false), + (this._lastInteractionTime = -1 / 0), + (this._animatables = new Array()), + (this._betaIsAnimating = false); + } + return ( + Object.defineProperty(e.prototype, "name", { + get: function () { + return "Framing"; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "mode", { - get: function() { - return this._mode - }, - set: function(e) { - this._mode = e - }, - enumerable: true, - configurable: true + get: function () { + return this._mode; + }, + set: function (e) { + this._mode = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "radiusScale", { - get: function() { - return this._radiusScale - }, - set: function(e) { - this._radiusScale = e - }, - enumerable: true, - configurable: true + get: function () { + return this._radiusScale; + }, + set: function (e) { + this._radiusScale = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "positionScale", { - get: function() { - return this._positionScale - }, - set: function(e) { - this._positionScale = e - }, - enumerable: true, - configurable: true + get: function () { + return this._positionScale; + }, + set: function (e) { + this._positionScale = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "defaultElevation", { - get: function() { - return this._defaultElevation - }, - set: function(e) { - this._defaultElevation = e - }, - enumerable: true, - configurable: true + get: function () { + return this._defaultElevation; + }, + set: function (e) { + this._defaultElevation = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "elevationReturnTime", { - get: function() { - return this._elevationReturnTime + get: function () { + return this._elevationReturnTime; + }, + set: function (e) { + this._elevationReturnTime = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "elevationReturnWaitTime", + { + get: function () { + return this._elevationReturnWaitTime; }, - set: function(e) { - this._elevationReturnTime = e + set: function (e) { + this._elevationReturnWaitTime = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "elevationReturnWaitTime", { - get: function() { - return this._elevationReturnWaitTime - }, - set: function(e) { - this._elevationReturnWaitTime = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "zoomStopsAnimation", { - get: function() { - return this._zoomStopsAnimation - }, - set: function(e) { - this._zoomStopsAnimation = e - }, - enumerable: true, - configurable: true + get: function () { + return this._zoomStopsAnimation; + }, + set: function (e) { + this._zoomStopsAnimation = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "framingTime", { - get: function() { - return this._framingTime - }, - set: function(e) { - this._framingTime = e - }, - enumerable: true, - configurable: true + get: function () { + return this._framingTime; + }, + set: function (e) { + this._framingTime = e; + }, + enumerable: true, + configurable: true, }), - e.prototype.init = function() {} - , - e.prototype.attach = function(t) { - var i = this; - this._attachedCamera = t; - var n = this._attachedCamera.getScene(); - e.EasingFunction.setEasingMode(e.EasingMode), - this._onPrePointerObservableObserver = n.onPrePointerObservable.add(function(e) { - e.type !== Re.a.POINTERDOWN ? e.type === Re.a.POINTERUP && (i._isPointerDown = false) : i._isPointerDown = true - }), - this._onMeshTargetChangedObserver = t.onMeshTargetChangedObservable.add(function(e) { - e && i.zoomOnMesh(e) - }), - this._onAfterCheckInputsObserver = t.onAfterCheckInputsObservable.add(function() { + (e.prototype.init = function () {}), + (e.prototype.attach = function (t) { + var i = this; + this._attachedCamera = t; + var n = this._attachedCamera.getScene(); + e.EasingFunction.setEasingMode(e.EasingMode), + (this._onPrePointerObservableObserver = + n.onPrePointerObservable.add(function (e) { + e.type !== Re.a.POINTERDOWN + ? e.type === Re.a.POINTERUP && + (i._isPointerDown = false) + : (i._isPointerDown = true); + })), + (this._onMeshTargetChangedObserver = + t.onMeshTargetChangedObservable.add(function (e) { + e && i.zoomOnMesh(e); + })), + (this._onAfterCheckInputsObserver = + t.onAfterCheckInputsObservable.add(function () { i._applyUserInteraction(), - i._maintainCameraAboveGround() - }) - } - , - e.prototype.detach = function() { - if (this._attachedCamera) { - var e = this._attachedCamera.getScene(); - this._onPrePointerObservableObserver && e.onPrePointerObservable.remove(this._onPrePointerObservableObserver), - this._onAfterCheckInputsObserver && this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver), - this._onMeshTargetChangedObserver && this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver), - this._attachedCamera = null - } - } - , - e.prototype.zoomOnMesh = function(e, t, i) { - void 0 === t && (t = false), - void 0 === i && (i = null), - e.computeWorldMatrix(true); - var n = e.getBoundingInfo().boundingBox; - this.zoomOnBoundingInfo(n.minimumWorld, n.maximumWorld, t, i) - } - , - e.prototype.zoomOnMeshHierarchy = function(e, t, i) { - void 0 === t && (t = false), - void 0 === i && (i = null), - e.computeWorldMatrix(true); - var n = e.getHierarchyBoundingVectors(true); - this.zoomOnBoundingInfo(n.min, n.max, t, i) - } - , - e.prototype.zoomOnMeshesHierarchy = function(e, t, i) { - void 0 === t && (t = false), - void 0 === i && (i = null); - for (var n = new a.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), r = new a.x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE), o = 0; o < e.length; o++) { - var s = e[o].getHierarchyBoundingVectors(true); - Ee.h.CheckExtends(s.min, n, r), - Ee.h.CheckExtends(s.max, n, r) - } - this.zoomOnBoundingInfo(n, r, t, i) - } - , - e.prototype.zoomOnBoundingInfo = function(t, i, n, r) { - var o, s = this; - if (void 0 === n && (n = false), - void 0 === r && (r = null), - this._attachedCamera) { - var c = t.y - , u = c + (i.y - c) * this._positionScale - , l = i.subtract(t).scale(.5); - if (n) - o = new a.x(0,u,0); - else { - var h = t.add(l); - o = new a.x(h.x,u,h.z) - } - this._vectorTransition || (this._vectorTransition = U.CreateAnimation("target", U.ANIMATIONTYPE_VECTOR3, 60, e.EasingFunction)), - this._betaIsAnimating = true; - var f = U.TransitionTo("target", o, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime); - f && this._animatables.push(f); - var d = 0; - if (this._mode === e.FitFrustumSidesMode) { - var p = this._calculateLowerRadiusFromModelBoundingSphere(t, i); - this.autoCorrectCameraLimitsAndSensibility && (this._attachedCamera.lowerRadiusLimit = l.length() + this._attachedCamera.minZ), - d = p - } else - this._mode === e.IgnoreBoundsSizeMode && (d = this._calculateLowerRadiusFromModelBoundingSphere(t, i), - this.autoCorrectCameraLimitsAndSensibility && null === this._attachedCamera.lowerRadiusLimit && (this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ)); - if (this.autoCorrectCameraLimitsAndSensibility) { - var m = i.subtract(t).length(); - this._attachedCamera.panningSensibility = 5e3 / m, - this._attachedCamera.wheelPrecision = 100 / d - } - this._radiusTransition || (this._radiusTransition = U.CreateAnimation("radius", U.ANIMATIONTYPE_FLOAT, 60, e.EasingFunction)), - (f = U.TransitionTo("radius", d, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function() { - s.stopAllAnimations(), - r && r(), - s._attachedCamera && s._attachedCamera.useInputToRestoreState && s._attachedCamera.storeState() - })) && this._animatables.push(f) - } - } - , - e.prototype._calculateLowerRadiusFromModelBoundingSphere = function(t, i) { - var n = i.subtract(t).length() - , r = this._getFrustumSlope() - , o = .5 * n * this._radiusScale - , a = o * Math.sqrt(1 + 1 / (r.x * r.x)) - , s = o * Math.sqrt(1 + 1 / (r.y * r.y)) - , c = Math.max(a, s) - , u = this._attachedCamera; - return u ? (u.lowerRadiusLimit && this._mode === e.IgnoreBoundsSizeMode && (c = c < u.lowerRadiusLimit ? u.lowerRadiusLimit : c), - u.upperRadiusLimit && (c = c > u.upperRadiusLimit ? u.upperRadiusLimit : c), - c) : 0 - } - , - e.prototype._maintainCameraAboveGround = function() { - var t = this; - if (!(this._elevationReturnTime < 0)) { - var i = K.a.Now - this._lastInteractionTime - , n = .5 * Math.PI - this._defaultElevation - , r = .5 * Math.PI; - if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > r && i >= this._elevationReturnWaitTime) { - this._betaIsAnimating = true, - this.stopAllAnimations(), - this._betaTransition || (this._betaTransition = U.CreateAnimation("beta", U.ANIMATIONTYPE_FLOAT, 60, e.EasingFunction)); - var o = U.TransitionTo("beta", n, this._attachedCamera, this._attachedCamera.getScene(), 60, this._betaTransition, this._elevationReturnTime, function() { - t._clearAnimationLocks(), - t.stopAllAnimations() - }); - o && this._animatables.push(o) - } - } - } - , - e.prototype._getFrustumSlope = function() { - var e = this._attachedCamera; - if (!e) - return a.w.Zero(); - var t = e.getScene().getEngine().getAspectRatio(e) - , i = Math.tan(e.fov / 2) - , n = i * t; - return new a.w(n,i) - } - , - e.prototype._clearAnimationLocks = function() { - this._betaIsAnimating = false - } - , - e.prototype._applyUserInteraction = function() { - this.isUserIsMoving && (this._lastInteractionTime = K.a.Now, - this.stopAllAnimations(), - this._clearAnimationLocks()) - } - , - e.prototype.stopAllAnimations = function() { - for (this._attachedCamera && (this._attachedCamera.animations = []); this._animatables.length; ) - this._animatables[0] && (this._animatables[0].onAnimationEnd = null, - this._animatables[0].stop()), - this._animatables.shift() - } - , - Object.defineProperty(e.prototype, "isUserIsMoving", { - get: function() { - return !!this._attachedCamera && (0 !== this._attachedCamera.inertialAlphaOffset || 0 !== this._attachedCamera.inertialBetaOffset || 0 !== this._attachedCamera.inertialRadiusOffset || 0 !== this._attachedCamera.inertialPanningX || 0 !== this._attachedCamera.inertialPanningY || this._isPointerDown) - }, - enumerable: true, - configurable: true + i._maintainCameraAboveGround(); + })); }), - e.EasingFunction = new se, - e.EasingMode = te.EASINGMODE_EASEINOUT, - e.IgnoreBoundsSizeMode = 0, - e.FitFrustumSidesMode = 1, + (e.prototype.detach = function () { + if (this._attachedCamera) { + var e = this._attachedCamera.getScene(); + this._onPrePointerObservableObserver && + e.onPrePointerObservable.remove( + this._onPrePointerObservableObserver + ), + this._onAfterCheckInputsObserver && + this._attachedCamera.onAfterCheckInputsObservable.remove( + this._onAfterCheckInputsObserver + ), + this._onMeshTargetChangedObserver && + this._attachedCamera.onMeshTargetChangedObservable.remove( + this._onMeshTargetChangedObserver + ), + (this._attachedCamera = null); + } + }), + (e.prototype.zoomOnMesh = function (e, t, i) { + void 0 === t && (t = false), + void 0 === i && (i = null), + e.computeWorldMatrix(true); + var n = e.getBoundingInfo().boundingBox; + this.zoomOnBoundingInfo( + n.minimumWorld, + n.maximumWorld, + t, + i + ); + }), + (e.prototype.zoomOnMeshHierarchy = function (e, t, i) { + void 0 === t && (t = false), + void 0 === i && (i = null), + e.computeWorldMatrix(true); + var n = e.getHierarchyBoundingVectors(true); + this.zoomOnBoundingInfo(n.min, n.max, t, i); + }), + (e.prototype.zoomOnMeshesHierarchy = function (e, t, i) { + void 0 === t && (t = false), void 0 === i && (i = null); + for ( + var n = new a.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + ), + r = new a.x( + -Number.MAX_VALUE, + -Number.MAX_VALUE, + -Number.MAX_VALUE + ), + o = 0; + o < e.length; + o++ + ) { + var s = e[o].getHierarchyBoundingVectors(true); + Ee.h.CheckExtends(s.min, n, r), + Ee.h.CheckExtends(s.max, n, r); + } + this.zoomOnBoundingInfo(n, r, t, i); + }), + (e.prototype.zoomOnBoundingInfo = function (t, i, n, r) { + var o, + s = this; + if ( + (void 0 === n && (n = false), + void 0 === r && (r = null), + this._attachedCamera) + ) { + var c = t.y, + u = c + (i.y - c) * this._positionScale, + l = i.subtract(t).scale(0.5); + if (n) o = new a.x(0, u, 0); + else { + var h = t.add(l); + o = new a.x(h.x, u, h.z); + } + this._vectorTransition || + (this._vectorTransition = U.CreateAnimation( + "target", + U.ANIMATIONTYPE_VECTOR3, + 60, + e.EasingFunction + )), + (this._betaIsAnimating = true); + var f = U.TransitionTo( + "target", + o, + this._attachedCamera, + this._attachedCamera.getScene(), + 60, + this._vectorTransition, + this._framingTime + ); + f && this._animatables.push(f); + var d = 0; + if (this._mode === e.FitFrustumSidesMode) { + var p = + this._calculateLowerRadiusFromModelBoundingSphere( + t, + i + ); + this.autoCorrectCameraLimitsAndSensibility && + (this._attachedCamera.lowerRadiusLimit = + l.length() + this._attachedCamera.minZ), + (d = p); + } else + this._mode === e.IgnoreBoundsSizeMode && + ((d = + this._calculateLowerRadiusFromModelBoundingSphere( + t, + i + )), + this.autoCorrectCameraLimitsAndSensibility && + null === this._attachedCamera.lowerRadiusLimit && + (this._attachedCamera.lowerRadiusLimit = + this._attachedCamera.minZ)); + if (this.autoCorrectCameraLimitsAndSensibility) { + var m = i.subtract(t).length(); + (this._attachedCamera.panningSensibility = 5e3 / m), + (this._attachedCamera.wheelPrecision = 100 / d); + } + this._radiusTransition || + (this._radiusTransition = U.CreateAnimation( + "radius", + U.ANIMATIONTYPE_FLOAT, + 60, + e.EasingFunction + )), + (f = U.TransitionTo( + "radius", + d, + this._attachedCamera, + this._attachedCamera.getScene(), + 60, + this._radiusTransition, + this._framingTime, + function () { + s.stopAllAnimations(), + r && r(), + s._attachedCamera && + s._attachedCamera.useInputToRestoreState && + s._attachedCamera.storeState(); + } + )) && this._animatables.push(f); + } + }), + (e.prototype._calculateLowerRadiusFromModelBoundingSphere = + function (t, i) { + var n = i.subtract(t).length(), + r = this._getFrustumSlope(), + o = 0.5 * n * this._radiusScale, + a = o * Math.sqrt(1 + 1 / (r.x * r.x)), + s = o * Math.sqrt(1 + 1 / (r.y * r.y)), + c = Math.max(a, s), + u = this._attachedCamera; + return u + ? (u.lowerRadiusLimit && + this._mode === e.IgnoreBoundsSizeMode && + (c = + c < u.lowerRadiusLimit + ? u.lowerRadiusLimit + : c), + u.upperRadiusLimit && + (c = + c > u.upperRadiusLimit + ? u.upperRadiusLimit + : c), + c) + : 0; + }), + (e.prototype._maintainCameraAboveGround = function () { + var t = this; + if (!(this._elevationReturnTime < 0)) { + var i = K.a.Now - this._lastInteractionTime, + n = 0.5 * Math.PI - this._defaultElevation, + r = 0.5 * Math.PI; + if ( + this._attachedCamera && + !this._betaIsAnimating && + this._attachedCamera.beta > r && + i >= this._elevationReturnWaitTime + ) { + (this._betaIsAnimating = true), + this.stopAllAnimations(), + this._betaTransition || + (this._betaTransition = U.CreateAnimation( + "beta", + U.ANIMATIONTYPE_FLOAT, + 60, + e.EasingFunction + )); + var o = U.TransitionTo( + "beta", + n, + this._attachedCamera, + this._attachedCamera.getScene(), + 60, + this._betaTransition, + this._elevationReturnTime, + function () { + t._clearAnimationLocks(), t.stopAllAnimations(); + } + ); + o && this._animatables.push(o); + } + } + }), + (e.prototype._getFrustumSlope = function () { + var e = this._attachedCamera; + if (!e) return a.w.Zero(); + var t = e.getScene().getEngine().getAspectRatio(e), + i = Math.tan(e.fov / 2), + n = i * t; + return new a.w(n, i); + }), + (e.prototype._clearAnimationLocks = function () { + this._betaIsAnimating = false; + }), + (e.prototype._applyUserInteraction = function () { + this.isUserIsMoving && + ((this._lastInteractionTime = K.a.Now), + this.stopAllAnimations(), + this._clearAnimationLocks()); + }), + (e.prototype.stopAllAnimations = function () { + for ( + this._attachedCamera && + (this._attachedCamera.animations = []); + this._animatables.length; + + ) + this._animatables[0] && + ((this._animatables[0].onAnimationEnd = null), + this._animatables[0].stop()), + this._animatables.shift(); + }), + Object.defineProperty(e.prototype, "isUserIsMoving", { + get: function () { + return ( + !!this._attachedCamera && + (0 !== this._attachedCamera.inertialAlphaOffset || + 0 !== this._attachedCamera.inertialBetaOffset || + 0 !== this._attachedCamera.inertialRadiusOffset || + 0 !== this._attachedCamera.inertialPanningX || + 0 !== this._attachedCamera.inertialPanningY || + this._isPointerDown) + ); + }, + enumerable: true, + configurable: true, + }), + (e.EasingFunction = new se()), + (e.EasingMode = te.EASINGMODE_EASEINOUT), + (e.IgnoreBoundsSizeMode = 0), + (e.FitFrustumSidesMode = 1), e - }() - , Ie = function(e, t, i, n) { - void 0 === t && (t = new a.x), + ); + })(), + Ie = function (e, t, i, n) { + void 0 === t && (t = new a.x()), void 0 === i && (i = 0), void 0 === n && (n = false), - this.direction = e, - this.rotatedDirection = t, - this.diff = i, - this.ignore = n - } - , De = function() { - function e(e) { - this.ui = e, - this.name = "AttachToBoxBehavior", - this.distanceAwayFromFace = .15, - this.distanceAwayFromBottomOfFace = .15, - this._faceVectors = [new Ie(a.x.Up()), new Ie(a.x.Down()), new Ie(a.x.Left()), new Ie(a.x.Right()), new Ie(a.x.Forward()), new Ie(a.x.Forward().scaleInPlace(-1))], - this._tmpMatrix = new a.j, - this._tmpVector = new a.x, - this._zeroVector = a.x.Zero(), - this._lookAtTmpMatrix = new a.j - } - return e.prototype.init = function() {} - , - e.prototype._closestFace = function(e) { - var t = this; - return this._faceVectors.forEach(function(i) { - t._target.rotationQuaternion || (t._target.rotationQuaternion = a.q.RotationYawPitchRoll(t._target.rotation.y, t._target.rotation.x, t._target.rotation.z)), - t._target.rotationQuaternion.toRotationMatrix(t._tmpMatrix), - a.x.TransformCoordinatesToRef(i.direction, t._tmpMatrix, i.rotatedDirection), - i.diff = a.x.GetAngleBetweenVectors(i.rotatedDirection, e, a.x.Cross(i.rotatedDirection, e)) + (this.direction = e), + (this.rotatedDirection = t), + (this.diff = i), + (this.ignore = n); + }, + De = (function () { + function e(e) { + (this.ui = e), + (this.name = "AttachToBoxBehavior"), + (this.distanceAwayFromFace = 0.15), + (this.distanceAwayFromBottomOfFace = 0.15), + (this._faceVectors = [ + new Ie(a.x.Up()), + new Ie(a.x.Down()), + new Ie(a.x.Left()), + new Ie(a.x.Right()), + new Ie(a.x.Forward()), + new Ie(a.x.Forward().scaleInPlace(-1)), + ]), + (this._tmpMatrix = new a.j()), + (this._tmpVector = new a.x()), + (this._zeroVector = a.x.Zero()), + (this._lookAtTmpMatrix = new a.j()); + } + return ( + (e.prototype.init = function () {}), + (e.prototype._closestFace = function (e) { + var t = this; + return ( + this._faceVectors.forEach(function (i) { + t._target.rotationQuaternion || + (t._target.rotationQuaternion = + a.q.RotationYawPitchRoll( + t._target.rotation.y, + t._target.rotation.x, + t._target.rotation.z + )), + t._target.rotationQuaternion.toRotationMatrix( + t._tmpMatrix + ), + a.x.TransformCoordinatesToRef( + i.direction, + t._tmpMatrix, + i.rotatedDirection + ), + (i.diff = a.x.GetAngleBetweenVectors( + i.rotatedDirection, + e, + a.x.Cross(i.rotatedDirection, e) + )); }), - this._faceVectors.reduce(function(e, t) { - return e.ignore ? t : t.ignore ? e : e.diff < t.diff ? e : t + this._faceVectors.reduce(function (e, t) { + return e.ignore + ? t + : t.ignore + ? e + : e.diff < t.diff + ? e + : t; }, this._faceVectors[0]) - } - , - e.prototype._lookAtToRef = function(e, t, i) { - void 0 === t && (t = new a.x(0,1,0)), - a.j.LookAtLHToRef(this._zeroVector, e, t, this._lookAtTmpMatrix), + ); + }), + (e.prototype._lookAtToRef = function (e, t, i) { + void 0 === t && (t = new a.x(0, 1, 0)), + a.j.LookAtLHToRef( + this._zeroVector, + e, + t, + this._lookAtTmpMatrix + ), this._lookAtTmpMatrix.invert(), - a.q.FromRotationMatrixToRef(this._lookAtTmpMatrix, i) - } - , - e.prototype.attach = function(e) { - var t = this; - this._target = e, - this._scene = this._target.getScene(), - this._onRenderObserver = this._scene.onBeforeRenderObservable.add(function() { + a.q.FromRotationMatrixToRef(this._lookAtTmpMatrix, i); + }), + (e.prototype.attach = function (e) { + var t = this; + (this._target = e), + (this._scene = this._target.getScene()), + (this._onRenderObserver = + this._scene.onBeforeRenderObservable.add(function () { if (t._scene.activeCamera) { - var i = t._scene.activeCamera.position; - t._scene.activeCamera.devicePosition && (i = t._scene.activeCamera.devicePosition); - var n = t._closestFace(i.subtract(e.position)); - t._scene.activeCamera.leftCamera ? t._scene.activeCamera.leftCamera.computeWorldMatrix().getRotationMatrixToRef(t._tmpMatrix) : t._scene.activeCamera.computeWorldMatrix().getRotationMatrixToRef(t._tmpMatrix), - a.x.TransformCoordinatesToRef(a.x.Up(), t._tmpMatrix, t._tmpVector), - t._faceVectors.forEach(function(e) { - n.direction.x && e.direction.x && (e.ignore = true), - n.direction.y && e.direction.y && (e.ignore = true), - n.direction.z && e.direction.z && (e.ignore = true) + var i = t._scene.activeCamera.position; + t._scene.activeCamera.devicePosition && + (i = t._scene.activeCamera.devicePosition); + var n = t._closestFace(i.subtract(e.position)); + t._scene.activeCamera.leftCamera + ? t._scene.activeCamera.leftCamera + .computeWorldMatrix() + .getRotationMatrixToRef(t._tmpMatrix) + : t._scene.activeCamera + .computeWorldMatrix() + .getRotationMatrixToRef(t._tmpMatrix), + a.x.TransformCoordinatesToRef( + a.x.Up(), + t._tmpMatrix, + t._tmpVector + ), + t._faceVectors.forEach(function (e) { + n.direction.x && + e.direction.x && + (e.ignore = true), + n.direction.y && + e.direction.y && + (e.ignore = true), + n.direction.z && + e.direction.z && + (e.ignore = true); }); - var r = t._closestFace(t._tmpVector); - t._faceVectors.forEach(function(e) { - e.ignore = false - }), + var r = t._closestFace(t._tmpVector); + t._faceVectors.forEach(function (e) { + e.ignore = false; + }), t.ui.position.copyFrom(e.position), - n.direction.x && (n.rotatedDirection.scaleToRef(e.scaling.x / 2 + t.distanceAwayFromFace, t._tmpVector), - t.ui.position.addInPlace(t._tmpVector)), - n.direction.y && (n.rotatedDirection.scaleToRef(e.scaling.y / 2 + t.distanceAwayFromFace, t._tmpVector), - t.ui.position.addInPlace(t._tmpVector)), - n.direction.z && (n.rotatedDirection.scaleToRef(e.scaling.z / 2 + t.distanceAwayFromFace, t._tmpVector), - t.ui.position.addInPlace(t._tmpVector)), - t.ui.rotationQuaternion || (t.ui.rotationQuaternion = a.q.RotationYawPitchRoll(t.ui.rotation.y, t.ui.rotation.x, t.ui.rotation.z)), + n.direction.x && + (n.rotatedDirection.scaleToRef( + e.scaling.x / 2 + t.distanceAwayFromFace, + t._tmpVector + ), + t.ui.position.addInPlace(t._tmpVector)), + n.direction.y && + (n.rotatedDirection.scaleToRef( + e.scaling.y / 2 + t.distanceAwayFromFace, + t._tmpVector + ), + t.ui.position.addInPlace(t._tmpVector)), + n.direction.z && + (n.rotatedDirection.scaleToRef( + e.scaling.z / 2 + t.distanceAwayFromFace, + t._tmpVector + ), + t.ui.position.addInPlace(t._tmpVector)), + t.ui.rotationQuaternion || + (t.ui.rotationQuaternion = + a.q.RotationYawPitchRoll( + t.ui.rotation.y, + t.ui.rotation.x, + t.ui.rotation.z + )), n.rotatedDirection.scaleToRef(-1, t._tmpVector), - t._lookAtToRef(t._tmpVector, r.rotatedDirection, t.ui.rotationQuaternion), - r.direction.x && t.ui.up.scaleToRef(t.distanceAwayFromBottomOfFace - e.scaling.x / 2, t._tmpVector), - r.direction.y && t.ui.up.scaleToRef(t.distanceAwayFromBottomOfFace - e.scaling.y / 2, t._tmpVector), - r.direction.z && t.ui.up.scaleToRef(t.distanceAwayFromBottomOfFace - e.scaling.z / 2, t._tmpVector), - t.ui.position.addInPlace(t._tmpVector) + t._lookAtToRef( + t._tmpVector, + r.rotatedDirection, + t.ui.rotationQuaternion + ), + r.direction.x && + t.ui.up.scaleToRef( + t.distanceAwayFromBottomOfFace - + e.scaling.x / 2, + t._tmpVector + ), + r.direction.y && + t.ui.up.scaleToRef( + t.distanceAwayFromBottomOfFace - + e.scaling.y / 2, + t._tmpVector + ), + r.direction.z && + t.ui.up.scaleToRef( + t.distanceAwayFromBottomOfFace - + e.scaling.z / 2, + t._tmpVector + ), + t.ui.position.addInPlace(t._tmpVector); } - }) - } - , - e.prototype.detach = function() { - this._scene.onBeforeRenderObservable.remove(this._onRenderObserver) - } - , + })); + }), + (e.prototype.detach = function () { + this._scene.onBeforeRenderObservable.remove( + this._onRenderObserver + ); + }), e - }() - , Le = function() { - function e() { - var e = this; - this.delay = 0, - this.fadeInTime = 300, - this._millisecondsPerFrame = 1e3 / 60, - this._hovered = false, - this._hoverValue = 0, - this._ownerNode = null, - this._update = function() { - if (e._ownerNode) { - if (e._hoverValue += e._hovered ? e._millisecondsPerFrame : -e._millisecondsPerFrame, - e._setAllVisibility(e._ownerNode, (e._hoverValue - e.delay) / e.fadeInTime), - e._ownerNode.visibility > 1) - return e._setAllVisibility(e._ownerNode, 1), - void (e._hoverValue = e.fadeInTime + e.delay); - if (e._ownerNode.visibility < 0 && (e._setAllVisibility(e._ownerNode, 0), - e._hoverValue < 0)) - return void (e._hoverValue = 0); - setTimeout(e._update, e._millisecondsPerFrame) - } + ); + })(), + Le = (function () { + function e() { + var e = this; + (this.delay = 0), + (this.fadeInTime = 300), + (this._millisecondsPerFrame = 1e3 / 60), + (this._hovered = false), + (this._hoverValue = 0), + (this._ownerNode = null), + (this._update = function () { + if (e._ownerNode) { + if ( + ((e._hoverValue += e._hovered + ? e._millisecondsPerFrame + : -e._millisecondsPerFrame), + e._setAllVisibility( + e._ownerNode, + (e._hoverValue - e.delay) / e.fadeInTime + ), + e._ownerNode.visibility > 1) + ) + return ( + e._setAllVisibility(e._ownerNode, 1), + void (e._hoverValue = e.fadeInTime + e.delay) + ); + if ( + e._ownerNode.visibility < 0 && + (e._setAllVisibility(e._ownerNode, 0), + e._hoverValue < 0) + ) + return void (e._hoverValue = 0); + setTimeout(e._update, e._millisecondsPerFrame); } - } - return Object.defineProperty(e.prototype, "name", { - get: function() { - return "FadeInOut" - }, - enumerable: true, - configurable: true + }); + } + return ( + Object.defineProperty(e.prototype, "name", { + get: function () { + return "FadeInOut"; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.init = function () {}), + (e.prototype.attach = function (e) { + (this._ownerNode = e), + this._setAllVisibility(this._ownerNode, 0); + }), + (e.prototype.detach = function () { + this._ownerNode = null; + }), + (e.prototype.fadeIn = function (e) { + (this._hovered = e), this._update(); + }), + (e.prototype._setAllVisibility = function (e, t) { + var i = this; + (e.visibility = t), + e.getChildMeshes().forEach(function (e) { + i._setAllVisibility(e, t); + }); }), - e.prototype.init = function() {} - , - e.prototype.attach = function(e) { - this._ownerNode = e, - this._setAllVisibility(this._ownerNode, 0) - } - , - e.prototype.detach = function() { - this._ownerNode = null - } - , - e.prototype.fadeIn = function(e) { - this._hovered = e, - this._update() - } - , - e.prototype._setAllVisibility = function(e, t) { - var i = this; - e.visibility = t, - e.getChildMeshes().forEach(function(e) { - i._setAllVisibility(e, t) - }) - } - , e - }() - , Fe = n(54) - , Be = function() { - function e() { - this._startDistance = 0, - this._initialScale = new a.x(0,0,0), - this._targetScale = new a.x(0,0,0), - this._sceneRenderObserver = null, - this._dragBehaviorA = new Fe.a({}), - this._dragBehaviorA.moveAttached = false, - this._dragBehaviorB = new Fe.a({}), - this._dragBehaviorB.moveAttached = false - } - return Object.defineProperty(e.prototype, "name", { - get: function() { - return "MultiPointerScale" - }, - enumerable: true, - configurable: true + ); + })(), + Fe = n(54), + Be = (function () { + function e() { + (this._startDistance = 0), + (this._initialScale = new a.x(0, 0, 0)), + (this._targetScale = new a.x(0, 0, 0)), + (this._sceneRenderObserver = null), + (this._dragBehaviorA = new Fe.a({})), + (this._dragBehaviorA.moveAttached = false), + (this._dragBehaviorB = new Fe.a({})), + (this._dragBehaviorB.moveAttached = false); + } + return ( + Object.defineProperty(e.prototype, "name", { + get: function () { + return "MultiPointerScale"; + }, + enumerable: true, + configurable: true, }), - e.prototype.init = function() {} - , - e.prototype._getCurrentDistance = function() { - return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length() - } - , - e.prototype.attach = function(e) { - var t = this; - this._ownerNode = e, - this._dragBehaviorA.onDragStartObservable.add(function(i) { - t._dragBehaviorA.dragging && t._dragBehaviorB.dragging && (t._dragBehaviorA.currentDraggingPointerID == t._dragBehaviorB.currentDraggingPointerID ? t._dragBehaviorA.releaseDrag() : (t._initialScale.copyFrom(e.scaling), - t._startDistance = t._getCurrentDistance())) + (e.prototype.init = function () {}), + (e.prototype._getCurrentDistance = function () { + return this._dragBehaviorA.lastDragPosition + .subtract(this._dragBehaviorB.lastDragPosition) + .length(); + }), + (e.prototype.attach = function (e) { + var t = this; + (this._ownerNode = e), + this._dragBehaviorA.onDragStartObservable.add(function ( + i + ) { + t._dragBehaviorA.dragging && + t._dragBehaviorB.dragging && + (t._dragBehaviorA.currentDraggingPointerID == + t._dragBehaviorB.currentDraggingPointerID + ? t._dragBehaviorA.releaseDrag() + : (t._initialScale.copyFrom(e.scaling), + (t._startDistance = t._getCurrentDistance()))); }), - this._dragBehaviorB.onDragStartObservable.add(function(i) { - t._dragBehaviorA.dragging && t._dragBehaviorB.dragging && (t._dragBehaviorA.currentDraggingPointerID == t._dragBehaviorB.currentDraggingPointerID ? t._dragBehaviorB.releaseDrag() : (t._initialScale.copyFrom(e.scaling), - t._startDistance = t._getCurrentDistance())) - }), - [this._dragBehaviorA, this._dragBehaviorB].forEach(function(e) { - e.onDragObservable.add(function() { - if (t._dragBehaviorA.dragging && t._dragBehaviorB.dragging) { - var e = t._getCurrentDistance() / t._startDistance; - t._initialScale.scaleToRef(e, t._targetScale) - } - }) + this._dragBehaviorB.onDragStartObservable.add(function ( + i + ) { + t._dragBehaviorA.dragging && + t._dragBehaviorB.dragging && + (t._dragBehaviorA.currentDraggingPointerID == + t._dragBehaviorB.currentDraggingPointerID + ? t._dragBehaviorB.releaseDrag() + : (t._initialScale.copyFrom(e.scaling), + (t._startDistance = t._getCurrentDistance()))); }), + [this._dragBehaviorA, this._dragBehaviorB].forEach( + function (e) { + e.onDragObservable.add(function () { + if ( + t._dragBehaviorA.dragging && + t._dragBehaviorB.dragging + ) { + var e = + t._getCurrentDistance() / t._startDistance; + t._initialScale.scaleToRef(e, t._targetScale); + } + }); + } + ), e.addBehavior(this._dragBehaviorA), e.addBehavior(this._dragBehaviorB), - this._sceneRenderObserver = e.getScene().onBeforeRenderObservable.add(function() { - if (t._dragBehaviorA.dragging && t._dragBehaviorB.dragging) { - var i = t._targetScale.subtract(e.scaling).scaleInPlace(.1); - i.length() > .01 && e.scaling.addInPlace(i) + (this._sceneRenderObserver = e + .getScene() + .onBeforeRenderObservable.add(function () { + if ( + t._dragBehaviorA.dragging && + t._dragBehaviorB.dragging + ) { + var i = t._targetScale + .subtract(e.scaling) + .scaleInPlace(0.1); + i.length() > 0.01 && e.scaling.addInPlace(i); } - }) - } - , - e.prototype.detach = function() { - var e = this; - this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver), - [this._dragBehaviorA, this._dragBehaviorB].forEach(function(t) { + })); + }), + (e.prototype.detach = function () { + var e = this; + this._ownerNode + .getScene() + .onBeforeRenderObservable.remove( + this._sceneRenderObserver + ), + [this._dragBehaviorA, this._dragBehaviorB].forEach( + function (t) { t.onDragStartObservable.clear(), - t.onDragObservable.clear(), - e._ownerNode.removeBehavior(t) - }) - } - , - e - }() - , Ne = n(24) - , ke = n(21) - , Ue = n(45) - , Ve = function() { - function e() { - this._sceneRenderObserver = null, - this._targetPosition = new a.x(0,0,0), - this._moving = false, - this._startingOrientation = new a.q, - this.zDragFactor = 3, - this.rotateDraggedObject = true, - this.dragging = false, - this.dragDeltaRatio = .2, - this.currentDraggingPointerID = -1, - this.detachCameraControls = true, - this.onDragStartObservable = new o.c, - this.onDragEndObservable = new o.c - } - return Object.defineProperty(e.prototype, "name", { - get: function() { - return "SixDofDrag" - }, - enumerable: true, - configurable: true + t.onDragObservable.clear(), + e._ownerNode.removeBehavior(t); + } + ); }), - e.prototype.init = function() {} - , - e.prototype.attach = function(t) { - var i = this; - this._ownerNode = t, - this._scene = this._ownerNode.getScene(), - e._virtualScene || (e._virtualScene = new Y.a(this._scene.getEngine()), - e._virtualScene.detachControl(), - this._scene.getEngine().scenes.pop()); - var n = null - , r = new a.x(0,0,0); - this._virtualOriginMesh = new Ne.a("",e._virtualScene), - this._virtualOriginMesh.rotationQuaternion = new a.q, - this._virtualDragMesh = new Ne.a("",e._virtualScene), - this._virtualDragMesh.rotationQuaternion = new a.q; - var o = null; - this._pointerObserver = this._scene.onPointerObservable.add(function(e, t) { - if (e.type == Re.a.POINTERDOWN) { - if (!i.dragging && e.pickInfo && e.pickInfo.hit && e.pickInfo.pickedMesh && e.pickInfo.ray && (h = e.pickInfo.pickedMesh, - i._ownerNode == h || h.isDescendantOf(i._ownerNode))) { - i._scene.activeCamera && i._scene.activeCamera.cameraRigMode == ke.a.RIG_MODE_NONE && e.pickInfo.ray.origin.copyFrom(i._scene.activeCamera.globalPosition), - n = i._ownerNode, - Ue.a._RemoveAndStorePivotPoint(n), - r.copyFrom(e.pickInfo.ray.origin), - i._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin), - i._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.add(e.pickInfo.ray.direction)), - i._virtualOriginMesh.removeChild(i._virtualDragMesh), - n.computeWorldMatrix(), - i._virtualDragMesh.position.copyFrom(n.absolutePosition), - n.rotationQuaternion || (n.rotationQuaternion = a.q.RotationYawPitchRoll(n.rotation.y, n.rotation.x, n.rotation.z)); - var s = n.parent; - n.setParent(null), - i._virtualDragMesh.rotationQuaternion.copyFrom(n.rotationQuaternion), - n.setParent(s), - i._virtualOriginMesh.addChild(i._virtualDragMesh), - i._targetPosition.copyFrom(i._virtualDragMesh.absolutePosition), - i.dragging = true, - i.currentDraggingPointerID = e.event.pointerId, - i.detachCameraControls && i._scene.activeCamera && !i._scene.activeCamera.leftCamera && (i._scene.activeCamera.inputs.attachedElement ? (o = i._scene.activeCamera.inputs.attachedElement, - i._scene.activeCamera.detachControl(i._scene.activeCamera.inputs.attachedElement)) : o = null), - Ue.a._RestorePivotPoint(n), - i.onDragStartObservable.notifyObservers({}) - } - } else if (e.type == Re.a.POINTERUP) - i.currentDraggingPointerID == e.event.pointerId && (i.dragging = false, - i._moving = false, - i.currentDraggingPointerID = -1, - n = null, - i._virtualOriginMesh.removeChild(i._virtualDragMesh), - i.detachCameraControls && o && i._scene.activeCamera && !i._scene.activeCamera.leftCamera && i._scene.activeCamera.attachControl(o, true), - i.onDragEndObservable.notifyObservers({})); - else if (e.type == Re.a.POINTERMOVE && i.currentDraggingPointerID == e.event.pointerId && i.dragging && e.pickInfo && e.pickInfo.ray && n) { - var c = i.zDragFactor; - i._scene.activeCamera && i._scene.activeCamera.cameraRigMode == ke.a.RIG_MODE_NONE && (e.pickInfo.ray.origin.copyFrom(i._scene.activeCamera.globalPosition), - c = 0); - var u = e.pickInfo.ray.origin.subtract(r); - r.copyFrom(e.pickInfo.ray.origin); - var l = -a.x.Dot(u, e.pickInfo.ray.direction); - i._virtualOriginMesh.addChild(i._virtualDragMesh), - i._virtualDragMesh.position.z -= i._virtualDragMesh.position.z < 1 ? l * i.zDragFactor : l * c * i._virtualDragMesh.position.z, - i._virtualDragMesh.position.z < 0 && (i._virtualDragMesh.position.z = 0), - i._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin), - i._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.add(e.pickInfo.ray.direction)), - i._virtualOriginMesh.removeChild(i._virtualDragMesh), - i._targetPosition.copyFrom(i._virtualDragMesh.absolutePosition), - n.parent && a.x.TransformCoordinatesToRef(i._targetPosition, a.j.Invert(n.parent.getWorldMatrix()), i._targetPosition), - i._moving || i._startingOrientation.copyFrom(i._virtualDragMesh.rotationQuaternion), - i._moving = true + e + ); + })(), + Ne = n(24), + ke = n(21), + Ue = n(45), + Ve = (function () { + function e() { + (this._sceneRenderObserver = null), + (this._targetPosition = new a.x(0, 0, 0)), + (this._moving = false), + (this._startingOrientation = new a.q()), + (this.zDragFactor = 3), + (this.rotateDraggedObject = true), + (this.dragging = false), + (this.dragDeltaRatio = 0.2), + (this.currentDraggingPointerID = -1), + (this.detachCameraControls = true), + (this.onDragStartObservable = new o.c()), + (this.onDragEndObservable = new o.c()); + } + return ( + Object.defineProperty(e.prototype, "name", { + get: function () { + return "SixDofDrag"; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.init = function () {}), + (e.prototype.attach = function (t) { + var i = this; + (this._ownerNode = t), + (this._scene = this._ownerNode.getScene()), + e._virtualScene || + ((e._virtualScene = new Y.a(this._scene.getEngine())), + e._virtualScene.detachControl(), + this._scene.getEngine().scenes.pop()); + var n = null, + r = new a.x(0, 0, 0); + (this._virtualOriginMesh = new Ne.a("", e._virtualScene)), + (this._virtualOriginMesh.rotationQuaternion = + new a.q()), + (this._virtualDragMesh = new Ne.a("", e._virtualScene)), + (this._virtualDragMesh.rotationQuaternion = new a.q()); + var o = null; + this._pointerObserver = + this._scene.onPointerObservable.add(function (e, t) { + if (e.type == Re.a.POINTERDOWN) { + if ( + !i.dragging && + e.pickInfo && + e.pickInfo.hit && + e.pickInfo.pickedMesh && + e.pickInfo.ray && + ((h = e.pickInfo.pickedMesh), + i._ownerNode == h || + h.isDescendantOf(i._ownerNode)) + ) { + i._scene.activeCamera && + i._scene.activeCamera.cameraRigMode == + ke.a.RIG_MODE_NONE && + e.pickInfo.ray.origin.copyFrom( + i._scene.activeCamera.globalPosition + ), + (n = i._ownerNode), + Ue.a._RemoveAndStorePivotPoint(n), + r.copyFrom(e.pickInfo.ray.origin), + i._virtualOriginMesh.position.copyFrom( + e.pickInfo.ray.origin + ), + i._virtualOriginMesh.lookAt( + e.pickInfo.ray.origin.add( + e.pickInfo.ray.direction + ) + ), + i._virtualOriginMesh.removeChild( + i._virtualDragMesh + ), + n.computeWorldMatrix(), + i._virtualDragMesh.position.copyFrom( + n.absolutePosition + ), + n.rotationQuaternion || + (n.rotationQuaternion = + a.q.RotationYawPitchRoll( + n.rotation.y, + n.rotation.x, + n.rotation.z + )); + var s = n.parent; + n.setParent(null), + i._virtualDragMesh.rotationQuaternion.copyFrom( + n.rotationQuaternion + ), + n.setParent(s), + i._virtualOriginMesh.addChild( + i._virtualDragMesh + ), + i._targetPosition.copyFrom( + i._virtualDragMesh.absolutePosition + ), + (i.dragging = true), + (i.currentDraggingPointerID = + e.event.pointerId), + i.detachCameraControls && + i._scene.activeCamera && + !i._scene.activeCamera.leftCamera && + (i._scene.activeCamera.inputs.attachedElement + ? ((o = + i._scene.activeCamera.inputs + .attachedElement), + i._scene.activeCamera.detachControl( + i._scene.activeCamera.inputs + .attachedElement + )) + : (o = null)), + Ue.a._RestorePivotPoint(n), + i.onDragStartObservable.notifyObservers({}); } - var h + } else if (e.type == Re.a.POINTERUP) + i.currentDraggingPointerID == e.event.pointerId && + ((i.dragging = false), + (i._moving = false), + (i.currentDraggingPointerID = -1), + (n = null), + i._virtualOriginMesh.removeChild( + i._virtualDragMesh + ), + i.detachCameraControls && + o && + i._scene.activeCamera && + !i._scene.activeCamera.leftCamera && + i._scene.activeCamera.attachControl(o, true), + i.onDragEndObservable.notifyObservers({})); + else if ( + e.type == Re.a.POINTERMOVE && + i.currentDraggingPointerID == e.event.pointerId && + i.dragging && + e.pickInfo && + e.pickInfo.ray && + n + ) { + var c = i.zDragFactor; + i._scene.activeCamera && + i._scene.activeCamera.cameraRigMode == + ke.a.RIG_MODE_NONE && + (e.pickInfo.ray.origin.copyFrom( + i._scene.activeCamera.globalPosition + ), + (c = 0)); + var u = e.pickInfo.ray.origin.subtract(r); + r.copyFrom(e.pickInfo.ray.origin); + var l = -a.x.Dot(u, e.pickInfo.ray.direction); + i._virtualOriginMesh.addChild(i._virtualDragMesh), + (i._virtualDragMesh.position.z -= + i._virtualDragMesh.position.z < 1 + ? l * i.zDragFactor + : l * c * i._virtualDragMesh.position.z), + i._virtualDragMesh.position.z < 0 && + (i._virtualDragMesh.position.z = 0), + i._virtualOriginMesh.position.copyFrom( + e.pickInfo.ray.origin + ), + i._virtualOriginMesh.lookAt( + e.pickInfo.ray.origin.add( + e.pickInfo.ray.direction + ) + ), + i._virtualOriginMesh.removeChild( + i._virtualDragMesh + ), + i._targetPosition.copyFrom( + i._virtualDragMesh.absolutePosition + ), + n.parent && + a.x.TransformCoordinatesToRef( + i._targetPosition, + a.j.Invert(n.parent.getWorldMatrix()), + i._targetPosition + ), + i._moving || + i._startingOrientation.copyFrom( + i._virtualDragMesh.rotationQuaternion + ), + (i._moving = true); + } + var h; }); - var s = new a.q; - this._sceneRenderObserver = t.getScene().onBeforeRenderObservable.add(function() { - if (i.dragging && i._moving && n) { - if (Ue.a._RemoveAndStorePivotPoint(n), - n.position.addInPlace(i._targetPosition.subtract(n.position).scale(i.dragDeltaRatio)), - i.rotateDraggedObject) { - s.copyFrom(i._startingOrientation), - s.x = -s.x, - s.y = -s.y, - s.z = -s.z, - i._virtualDragMesh.rotationQuaternion.multiplyToRef(s, s), - a.q.RotationYawPitchRollToRef(s.toEulerAngles("xyz").y, 0, 0, s), - s.multiplyToRef(i._startingOrientation, s); - var e = n.parent; - (!e || e.scaling && !e.scaling.isNonUniformWithinEpsilon(.001)) && (n.setParent(null), - a.q.SlerpToRef(n.rotationQuaternion, s, i.dragDeltaRatio, n.rotationQuaternion), - n.setParent(e)) - } - Ue.a._RestorePivotPoint(n) + var s = new a.q(); + this._sceneRenderObserver = t + .getScene() + .onBeforeRenderObservable.add(function () { + if (i.dragging && i._moving && n) { + if ( + (Ue.a._RemoveAndStorePivotPoint(n), + n.position.addInPlace( + i._targetPosition + .subtract(n.position) + .scale(i.dragDeltaRatio) + ), + i.rotateDraggedObject) + ) { + s.copyFrom(i._startingOrientation), + (s.x = -s.x), + (s.y = -s.y), + (s.z = -s.z), + i._virtualDragMesh.rotationQuaternion.multiplyToRef( + s, + s + ), + a.q.RotationYawPitchRollToRef( + s.toEulerAngles("xyz").y, + 0, + 0, + s + ), + s.multiplyToRef(i._startingOrientation, s); + var e = n.parent; + (!e || + (e.scaling && + !e.scaling.isNonUniformWithinEpsilon( + 0.001 + ))) && + (n.setParent(null), + a.q.SlerpToRef( + n.rotationQuaternion, + s, + i.dragDeltaRatio, + n.rotationQuaternion + ), + n.setParent(e)); } - }) - } - , - e.prototype.detach = function() { - this._scene && this._scene.onPointerObservable.remove(this._pointerObserver), - this._ownerNode && this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver), - this._virtualOriginMesh && this._virtualOriginMesh.dispose(), - this._virtualDragMesh && this._virtualDragMesh.dispose(), - this.onDragEndObservable.clear(), - this.onDragStartObservable.clear() - } - , - e - }() - , Ge = function() { - function e(e, t, i) { - if (this.targetPosition = a.x.Zero(), - this.poleTargetPosition = a.x.Zero(), - this.poleTargetLocalOffset = a.x.Zero(), - this.poleAngle = 0, - this.slerpAmount = 1, - this._bone1Quat = a.q.Identity(), - this._bone1Mat = a.j.Identity(), - this._bone2Ang = Math.PI, - this._maxAngle = Math.PI, - this._rightHandedSystem = false, - this._bendAxis = a.x.Right(), - this._slerping = false, - this._adjustRoll = 0, - this._bone2 = t, - this._bone1 = t.getParent(), - this._bone1) { - this.mesh = e; - var n = t.getPosition(); - if (t.getAbsoluteTransform().determinant() > 0 && (this._rightHandedSystem = true, - this._bendAxis.x = 0, - this._bendAxis.y = 0, - this._bendAxis.z = -1, - n.x > n.y && n.x > n.z && (this._adjustRoll = .5 * Math.PI, - this._bendAxis.z = 1)), - this._bone1.length) { - var r = this._bone1.getScale() - , o = this._bone2.getScale(); - this._bone1Length = this._bone1.length * r.y * this.mesh.scaling.y, - this._bone2Length = this._bone2.length * o.y * this.mesh.scaling.y - } else if (this._bone1.children[0]) { - e.computeWorldMatrix(true); - var s = this._bone2.children[0].getAbsolutePosition(e) - , c = this._bone2.getAbsolutePosition(e) - , u = this._bone1.getAbsolutePosition(e); - this._bone1Length = a.x.Distance(s, c), - this._bone2Length = a.x.Distance(c, u) - } - this._bone1.getRotationMatrixToRef(a.s.WORLD, e, this._bone1Mat), - this.maxAngle = Math.PI, - i && (i.targetMesh && (this.targetMesh = i.targetMesh, - this.targetMesh.computeWorldMatrix(true)), - i.poleTargetMesh ? (this.poleTargetMesh = i.poleTargetMesh, - this.poleTargetMesh.computeWorldMatrix(true)) : i.poleTargetBone ? this.poleTargetBone = i.poleTargetBone : this._bone1.getParent() && (this.poleTargetBone = this._bone1.getParent()), - i.poleTargetLocalOffset && this.poleTargetLocalOffset.copyFrom(i.poleTargetLocalOffset), - i.poleAngle && (this.poleAngle = i.poleAngle), - i.bendAxis && this._bendAxis.copyFrom(i.bendAxis), - i.maxAngle && (this.maxAngle = i.maxAngle), - i.slerpAmount && (this.slerpAmount = i.slerpAmount)) - } - } - return Object.defineProperty(e.prototype, "maxAngle", { - get: function() { - return this._maxAngle - }, - set: function(e) { - this._setMaxAngle(e) - }, - enumerable: true, - configurable: true + Ue.a._RestorePivotPoint(n); + } + }); + }), + (e.prototype.detach = function () { + this._scene && + this._scene.onPointerObservable.remove( + this._pointerObserver + ), + this._ownerNode && + this._ownerNode + .getScene() + .onBeforeRenderObservable.remove( + this._sceneRenderObserver + ), + this._virtualOriginMesh && + this._virtualOriginMesh.dispose(), + this._virtualDragMesh && + this._virtualDragMesh.dispose(), + this.onDragEndObservable.clear(), + this.onDragStartObservable.clear(); }), - e.prototype._setMaxAngle = function(e) { - e < 0 && (e = 0), - (e > Math.PI || null == e) && (e = Math.PI), - this._maxAngle = e; - var t = this._bone1Length - , i = this._bone2Length; - this._maxReach = Math.sqrt(t * t + i * i - 2 * t * i * Math.cos(e)) - } - , - e.prototype.update = function() { - var t = this._bone1; - if (t) { - var i = this.targetPosition - , n = this.poleTargetPosition - , r = e._tmpMats[0] - , o = e._tmpMats[1]; - this.targetMesh && i.copyFrom(this.targetMesh.getAbsolutePosition()), - this.poleTargetBone ? this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset, this.mesh, n) : this.poleTargetMesh && a.x.TransformCoordinatesToRef(this.poleTargetLocalOffset, this.poleTargetMesh.getWorldMatrix(), n); - var s = e._tmpVecs[0] - , c = e._tmpVecs[1] - , u = e._tmpVecs[2] - , l = e._tmpVecs[3] - , h = e._tmpVecs[4] - , f = e._tmpQuat; - t.getAbsolutePositionToRef(this.mesh, s), - n.subtractToRef(s, h), - 0 == h.x && 0 == h.y && 0 == h.z ? h.y = 1 : h.normalize(), - i.subtractToRef(s, l), - l.normalize(), - a.x.CrossToRef(l, h, c), - c.normalize(), - a.x.CrossToRef(l, c, u), - u.normalize(), - a.j.FromXYZAxesToRef(u, l, c, r); - var d = this._bone1Length - , p = this._bone2Length - , m = a.x.Distance(s, i); - this._maxReach > 0 && (m = Math.min(this._maxReach, m)); - var g = (p * p + m * m - d * d) / (2 * p * m) - , _ = (m * m + d * d - p * p) / (2 * m * d); - g > 1 && (g = 1), - _ > 1 && (_ = 1), - g < -1 && (g = -1), - _ < -1 && (_ = -1); - var v = Math.acos(g) - , y = Math.acos(_) - , b = -v - y; - if (this._rightHandedSystem) - a.j.RotationYawPitchRollToRef(0, 0, this._adjustRoll, o), - o.multiplyToRef(r, r), - a.j.RotationAxisToRef(this._bendAxis, y, o), - o.multiplyToRef(r, r); - else { - var E = e._tmpVecs[5]; - E.copyFrom(this._bendAxis), - E.x *= -1, - a.j.RotationAxisToRef(E, -y, o), - o.multiplyToRef(r, r) - } - this.poleAngle && (a.j.RotationAxisToRef(l, this.poleAngle, o), - r.multiplyToRef(o, r)), - this._bone1 && (this.slerpAmount < 1 ? (this._slerping || a.q.FromRotationMatrixToRef(this._bone1Mat, this._bone1Quat), - a.q.FromRotationMatrixToRef(r, f), - a.q.SlerpToRef(this._bone1Quat, f, this.slerpAmount, this._bone1Quat), - b = this._bone2Ang * (1 - this.slerpAmount) + b * this.slerpAmount, - this._bone1.setRotationQuaternion(this._bone1Quat, a.s.WORLD, this.mesh), - this._slerping = true) : (this._bone1.setRotationMatrix(r, a.s.WORLD, this.mesh), - this._bone1Mat.copyFrom(r), - this._slerping = false)), - this._bone2.setAxisAngle(this._bendAxis, b, a.s.LOCAL), - this._bone2Ang = b - } - } - , - e._tmpVecs = [a.x.Zero(), a.x.Zero(), a.x.Zero(), a.x.Zero(), a.x.Zero(), a.x.Zero()], - e._tmpQuat = a.q.Identity(), - e._tmpMats = [a.j.Identity(), a.j.Identity()], e - }() - , ze = function() { - function e(e, t, i, n) { - if (this.upAxis = a.x.Up(), - this.upAxisSpace = a.s.LOCAL, - this.adjustYaw = 0, - this.adjustPitch = 0, - this.adjustRoll = 0, - this.slerpAmount = 1, - this._boneQuat = a.q.Identity(), - this._slerping = false, - this._firstFrameSkipped = false, - this._fowardAxis = a.x.Forward(), - this.mesh = e, - this.bone = t, - this.target = i, - n && (n.adjustYaw && (this.adjustYaw = n.adjustYaw), + ); + })(), + Ge = (function () { + function e(e, t, i) { + if ( + ((this.targetPosition = a.x.Zero()), + (this.poleTargetPosition = a.x.Zero()), + (this.poleTargetLocalOffset = a.x.Zero()), + (this.poleAngle = 0), + (this.slerpAmount = 1), + (this._bone1Quat = a.q.Identity()), + (this._bone1Mat = a.j.Identity()), + (this._bone2Ang = Math.PI), + (this._maxAngle = Math.PI), + (this._rightHandedSystem = false), + (this._bendAxis = a.x.Right()), + (this._slerping = false), + (this._adjustRoll = 0), + (this._bone2 = t), + (this._bone1 = t.getParent()), + this._bone1) + ) { + this.mesh = e; + var n = t.getPosition(); + if ( + (t.getAbsoluteTransform().determinant() > 0 && + ((this._rightHandedSystem = true), + (this._bendAxis.x = 0), + (this._bendAxis.y = 0), + (this._bendAxis.z = -1), + n.x > n.y && + n.x > n.z && + ((this._adjustRoll = 0.5 * Math.PI), + (this._bendAxis.z = 1))), + this._bone1.length) + ) { + var r = this._bone1.getScale(), + o = this._bone2.getScale(); + (this._bone1Length = + this._bone1.length * r.y * this.mesh.scaling.y), + (this._bone2Length = + this._bone2.length * o.y * this.mesh.scaling.y); + } else if (this._bone1.children[0]) { + e.computeWorldMatrix(true); + var s = this._bone2.children[0].getAbsolutePosition(e), + c = this._bone2.getAbsolutePosition(e), + u = this._bone1.getAbsolutePosition(e); + (this._bone1Length = a.x.Distance(s, c)), + (this._bone2Length = a.x.Distance(c, u)); + } + this._bone1.getRotationMatrixToRef( + a.s.WORLD, + e, + this._bone1Mat + ), + (this.maxAngle = Math.PI), + i && + (i.targetMesh && + ((this.targetMesh = i.targetMesh), + this.targetMesh.computeWorldMatrix(true)), + i.poleTargetMesh + ? ((this.poleTargetMesh = i.poleTargetMesh), + this.poleTargetMesh.computeWorldMatrix(true)) + : i.poleTargetBone + ? (this.poleTargetBone = i.poleTargetBone) + : this._bone1.getParent() && + (this.poleTargetBone = this._bone1.getParent()), + i.poleTargetLocalOffset && + this.poleTargetLocalOffset.copyFrom( + i.poleTargetLocalOffset + ), + i.poleAngle && (this.poleAngle = i.poleAngle), + i.bendAxis && this._bendAxis.copyFrom(i.bendAxis), + i.maxAngle && (this.maxAngle = i.maxAngle), + i.slerpAmount && (this.slerpAmount = i.slerpAmount)); + } + } + return ( + Object.defineProperty(e.prototype, "maxAngle", { + get: function () { + return this._maxAngle; + }, + set: function (e) { + this._setMaxAngle(e); + }, + enumerable: true, + configurable: true, + }), + (e.prototype._setMaxAngle = function (e) { + e < 0 && (e = 0), + (e > Math.PI || null == e) && (e = Math.PI), + (this._maxAngle = e); + var t = this._bone1Length, + i = this._bone2Length; + this._maxReach = Math.sqrt( + t * t + i * i - 2 * t * i * Math.cos(e) + ); + }), + (e.prototype.update = function () { + var t = this._bone1; + if (t) { + var i = this.targetPosition, + n = this.poleTargetPosition, + r = e._tmpMats[0], + o = e._tmpMats[1]; + this.targetMesh && + i.copyFrom(this.targetMesh.getAbsolutePosition()), + this.poleTargetBone + ? this.poleTargetBone.getAbsolutePositionFromLocalToRef( + this.poleTargetLocalOffset, + this.mesh, + n + ) + : this.poleTargetMesh && + a.x.TransformCoordinatesToRef( + this.poleTargetLocalOffset, + this.poleTargetMesh.getWorldMatrix(), + n + ); + var s = e._tmpVecs[0], + c = e._tmpVecs[1], + u = e._tmpVecs[2], + l = e._tmpVecs[3], + h = e._tmpVecs[4], + f = e._tmpQuat; + t.getAbsolutePositionToRef(this.mesh, s), + n.subtractToRef(s, h), + 0 == h.x && 0 == h.y && 0 == h.z + ? (h.y = 1) + : h.normalize(), + i.subtractToRef(s, l), + l.normalize(), + a.x.CrossToRef(l, h, c), + c.normalize(), + a.x.CrossToRef(l, c, u), + u.normalize(), + a.j.FromXYZAxesToRef(u, l, c, r); + var d = this._bone1Length, + p = this._bone2Length, + m = a.x.Distance(s, i); + this._maxReach > 0 && (m = Math.min(this._maxReach, m)); + var g = (p * p + m * m - d * d) / (2 * p * m), + _ = (m * m + d * d - p * p) / (2 * m * d); + g > 1 && (g = 1), + _ > 1 && (_ = 1), + g < -1 && (g = -1), + _ < -1 && (_ = -1); + var v = Math.acos(g), + y = Math.acos(_), + b = -v - y; + if (this._rightHandedSystem) + a.j.RotationYawPitchRollToRef( + 0, + 0, + this._adjustRoll, + o + ), + o.multiplyToRef(r, r), + a.j.RotationAxisToRef(this._bendAxis, y, o), + o.multiplyToRef(r, r); + else { + var E = e._tmpVecs[5]; + E.copyFrom(this._bendAxis), + (E.x *= -1), + a.j.RotationAxisToRef(E, -y, o), + o.multiplyToRef(r, r); + } + this.poleAngle && + (a.j.RotationAxisToRef(l, this.poleAngle, o), + r.multiplyToRef(o, r)), + this._bone1 && + (this.slerpAmount < 1 + ? (this._slerping || + a.q.FromRotationMatrixToRef( + this._bone1Mat, + this._bone1Quat + ), + a.q.FromRotationMatrixToRef(r, f), + a.q.SlerpToRef( + this._bone1Quat, + f, + this.slerpAmount, + this._bone1Quat + ), + (b = + this._bone2Ang * (1 - this.slerpAmount) + + b * this.slerpAmount), + this._bone1.setRotationQuaternion( + this._bone1Quat, + a.s.WORLD, + this.mesh + ), + (this._slerping = true)) + : (this._bone1.setRotationMatrix( + r, + a.s.WORLD, + this.mesh + ), + this._bone1Mat.copyFrom(r), + (this._slerping = false))), + this._bone2.setAxisAngle( + this._bendAxis, + b, + a.s.LOCAL + ), + (this._bone2Ang = b); + } + }), + (e._tmpVecs = [ + a.x.Zero(), + a.x.Zero(), + a.x.Zero(), + a.x.Zero(), + a.x.Zero(), + a.x.Zero(), + ]), + (e._tmpQuat = a.q.Identity()), + (e._tmpMats = [a.j.Identity(), a.j.Identity()]), + e + ); + })(), + ze = (function () { + function e(e, t, i, n) { + if ( + ((this.upAxis = a.x.Up()), + (this.upAxisSpace = a.s.LOCAL), + (this.adjustYaw = 0), + (this.adjustPitch = 0), + (this.adjustRoll = 0), + (this.slerpAmount = 1), + (this._boneQuat = a.q.Identity()), + (this._slerping = false), + (this._firstFrameSkipped = false), + (this._fowardAxis = a.x.Forward()), + (this.mesh = e), + (this.bone = t), + (this.target = i), + n && + (n.adjustYaw && (this.adjustYaw = n.adjustYaw), n.adjustPitch && (this.adjustPitch = n.adjustPitch), n.adjustRoll && (this.adjustRoll = n.adjustRoll), - null != n.maxYaw ? this.maxYaw = n.maxYaw : this.maxYaw = Math.PI, - null != n.minYaw ? this.minYaw = n.minYaw : this.minYaw = -Math.PI, - null != n.maxPitch ? this.maxPitch = n.maxPitch : this.maxPitch = Math.PI, - null != n.minPitch ? this.minPitch = n.minPitch : this.minPitch = -Math.PI, - null != n.slerpAmount && (this.slerpAmount = n.slerpAmount), + null != n.maxYaw + ? (this.maxYaw = n.maxYaw) + : (this.maxYaw = Math.PI), + null != n.minYaw + ? (this.minYaw = n.minYaw) + : (this.minYaw = -Math.PI), + null != n.maxPitch + ? (this.maxPitch = n.maxPitch) + : (this.maxPitch = Math.PI), + null != n.minPitch + ? (this.minPitch = n.minPitch) + : (this.minPitch = -Math.PI), + null != n.slerpAmount && + (this.slerpAmount = n.slerpAmount), null != n.upAxis && (this.upAxis = n.upAxis), - null != n.upAxisSpace && (this.upAxisSpace = n.upAxisSpace), - null != n.yawAxis || null != n.pitchAxis)) { - var r = a.c.Y - , o = a.c.X; - null != n.yawAxis && (r = n.yawAxis.clone()).normalize(), - null != n.pitchAxis && (o = n.pitchAxis.clone()).normalize(); - var s = a.x.Cross(o, r); - this._transformYawPitch = a.j.Identity(), - a.j.FromXYZAxesToRef(o, r, s, this._transformYawPitch), - this._transformYawPitchInv = this._transformYawPitch.clone(), - this._transformYawPitch.invert() - } - t.getParent() || this.upAxisSpace != a.s.BONE || (this.upAxisSpace = a.s.LOCAL) + null != n.upAxisSpace && + (this.upAxisSpace = n.upAxisSpace), + null != n.yawAxis || null != n.pitchAxis)) + ) { + var r = a.c.Y, + o = a.c.X; + null != n.yawAxis && (r = n.yawAxis.clone()).normalize(), + null != n.pitchAxis && + (o = n.pitchAxis.clone()).normalize(); + var s = a.x.Cross(o, r); + (this._transformYawPitch = a.j.Identity()), + a.j.FromXYZAxesToRef(o, r, s, this._transformYawPitch), + (this._transformYawPitchInv = + this._transformYawPitch.clone()), + this._transformYawPitch.invert(); } - return Object.defineProperty(e.prototype, "minYaw", { - get: function() { - return this._minYaw - }, - set: function(e) { - this._minYaw = e, - this._minYawSin = Math.sin(e), - this._minYawCos = Math.cos(e), - null != this._maxYaw && (this._midYawConstraint = .5 * this._getAngleDiff(this._minYaw, this._maxYaw) + this._minYaw, - this._yawRange = this._maxYaw - this._minYaw) - }, - enumerable: true, - configurable: true + t.getParent() || + this.upAxisSpace != a.s.BONE || + (this.upAxisSpace = a.s.LOCAL); + } + return ( + Object.defineProperty(e.prototype, "minYaw", { + get: function () { + return this._minYaw; + }, + set: function (e) { + (this._minYaw = e), + (this._minYawSin = Math.sin(e)), + (this._minYawCos = Math.cos(e)), + null != this._maxYaw && + ((this._midYawConstraint = + 0.5 * + this._getAngleDiff(this._minYaw, this._maxYaw) + + this._minYaw), + (this._yawRange = this._maxYaw - this._minYaw)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "maxYaw", { - get: function() { - return this._maxYaw - }, - set: function(e) { - this._maxYaw = e, - this._maxYawSin = Math.sin(e), - this._maxYawCos = Math.cos(e), - null != this._minYaw && (this._midYawConstraint = .5 * this._getAngleDiff(this._minYaw, this._maxYaw) + this._minYaw, - this._yawRange = this._maxYaw - this._minYaw) - }, - enumerable: true, - configurable: true + get: function () { + return this._maxYaw; + }, + set: function (e) { + (this._maxYaw = e), + (this._maxYawSin = Math.sin(e)), + (this._maxYawCos = Math.cos(e)), + null != this._minYaw && + ((this._midYawConstraint = + 0.5 * + this._getAngleDiff(this._minYaw, this._maxYaw) + + this._minYaw), + (this._yawRange = this._maxYaw - this._minYaw)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "minPitch", { - get: function() { - return this._minPitch - }, - set: function(e) { - this._minPitch = e, - this._minPitchTan = Math.tan(e) - }, - enumerable: true, - configurable: true + get: function () { + return this._minPitch; + }, + set: function (e) { + (this._minPitch = e), (this._minPitchTan = Math.tan(e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "maxPitch", { - get: function() { - return this._maxPitch - }, - set: function(e) { - this._maxPitch = e, - this._maxPitchTan = Math.tan(e) - }, - enumerable: true, - configurable: true + get: function () { + return this._maxPitch; + }, + set: function (e) { + (this._maxPitch = e), (this._maxPitchTan = Math.tan(e)); + }, + enumerable: true, + configurable: true, }), - e.prototype.update = function() { - if (this.slerpAmount < 1 && !this._firstFrameSkipped) - this._firstFrameSkipped = true; - else { - var t = this.bone - , i = e._tmpVecs[0]; - t.getAbsolutePositionToRef(this.mesh, i); - var n = this.target - , r = e._tmpMats[0] - , o = e._tmpMats[1] - , s = this.mesh - , c = t.getParent() - , u = e._tmpVecs[1]; - u.copyFrom(this.upAxis), - this.upAxisSpace == a.s.BONE && c ? (this._transformYawPitch && a.x.TransformCoordinatesToRef(u, this._transformYawPitchInv, u), - c.getDirectionToRef(u, this.mesh, u)) : this.upAxisSpace == a.s.LOCAL && (s.getDirectionToRef(u, u), - 1 == s.scaling.x && 1 == s.scaling.y && 1 == s.scaling.z || u.normalize()); - var l = false - , h = false; - if (this._maxYaw == Math.PI && this._minYaw == -Math.PI || (l = true), - this._maxPitch == Math.PI && this._minPitch == -Math.PI || (h = true), - l || h) { - var f = e._tmpMats[2] - , d = e._tmpMats[3]; - if (this.upAxisSpace == a.s.BONE && 1 == u.y && c) - c.getRotationMatrixToRef(a.s.WORLD, this.mesh, f); - else if (this.upAxisSpace != a.s.LOCAL || 1 != u.y || c) { - (m = e._tmpVecs[2]).copyFrom(this._fowardAxis), - this._transformYawPitch && a.x.TransformCoordinatesToRef(m, this._transformYawPitchInv, m), - c ? c.getDirectionToRef(m, this.mesh, m) : s.getDirectionToRef(m, m); - var p = a.x.Cross(u, m); - p.normalize(); - var m = a.x.Cross(p, u); - a.j.FromXYZAxesToRef(p, u, m, f) - } else - f.copyFrom(s.getWorldMatrix()); - f.invertToRef(d); - var g = null; - if (h) { - var _ = e._tmpVecs[3]; - n.subtractToRef(i, _), - a.x.TransformCoordinatesToRef(_, d, _), - g = Math.sqrt(_.x * _.x + _.z * _.z); - var v = Math.atan2(_.y, g) - , y = v; - v > this._maxPitch ? (_.y = this._maxPitchTan * g, - y = this._maxPitch) : v < this._minPitch && (_.y = this._minPitchTan * g, - y = this._minPitch), - v != y && (a.x.TransformCoordinatesToRef(_, f, _), - _.addInPlace(i), - n = _) - } - if (l) { - _ = e._tmpVecs[4], - n.subtractToRef(i, _), - a.x.TransformCoordinatesToRef(_, d, _); - var b = Math.atan2(_.x, _.z) - , E = b; - if ((b > this._maxYaw || b < this._minYaw) && (null == g && (g = Math.sqrt(_.x * _.x + _.z * _.z)), - this._yawRange > Math.PI ? this._isAngleBetween(b, this._maxYaw, this._midYawConstraint) ? (_.z = this._maxYawCos * g, - _.x = this._maxYawSin * g, - E = this._maxYaw) : this._isAngleBetween(b, this._midYawConstraint, this._minYaw) && (_.z = this._minYawCos * g, - _.x = this._minYawSin * g, - E = this._minYaw) : b > this._maxYaw ? (_.z = this._maxYawCos * g, - _.x = this._maxYawSin * g, - E = this._maxYaw) : b < this._minYaw && (_.z = this._minYawCos * g, - _.x = this._minYawSin * g, - E = this._minYaw)), - this._slerping && this._yawRange > Math.PI) { - var T = e._tmpVecs[8]; - T.copyFrom(a.c.Z), - this._transformYawPitch && a.x.TransformCoordinatesToRef(T, this._transformYawPitchInv, T); - var A = e._tmpMats[4]; - this._boneQuat.toRotationMatrix(A), - this.mesh.getWorldMatrix().multiplyToRef(A, A), - a.x.TransformCoordinatesToRef(T, A, T), - a.x.TransformCoordinatesToRef(T, d, T); - var x = Math.atan2(T.x, T.z); - if (this._getAngleBetween(x, b) > this._getAngleBetween(x, this._midYawConstraint)) { - null == g && (g = Math.sqrt(_.x * _.x + _.z * _.z)); - var S = this._getAngleBetween(x, this._maxYaw); - this._getAngleBetween(x, this._minYaw) < S ? (E = x + .75 * Math.PI, - _.z = Math.cos(E) * g, - _.x = Math.sin(E) * g) : (E = x - .75 * Math.PI, - _.z = Math.cos(E) * g, - _.x = Math.sin(E) * g) - } - } - b != E && (a.x.TransformCoordinatesToRef(_, f, _), - _.addInPlace(i), - n = _) - } + (e.prototype.update = function () { + if (this.slerpAmount < 1 && !this._firstFrameSkipped) + this._firstFrameSkipped = true; + else { + var t = this.bone, + i = e._tmpVecs[0]; + t.getAbsolutePositionToRef(this.mesh, i); + var n = this.target, + r = e._tmpMats[0], + o = e._tmpMats[1], + s = this.mesh, + c = t.getParent(), + u = e._tmpVecs[1]; + u.copyFrom(this.upAxis), + this.upAxisSpace == a.s.BONE && c + ? (this._transformYawPitch && + a.x.TransformCoordinatesToRef( + u, + this._transformYawPitchInv, + u + ), + c.getDirectionToRef(u, this.mesh, u)) + : this.upAxisSpace == a.s.LOCAL && + (s.getDirectionToRef(u, u), + (1 == s.scaling.x && + 1 == s.scaling.y && + 1 == s.scaling.z) || + u.normalize()); + var l = false, + h = false; + if ( + ((this._maxYaw == Math.PI && + this._minYaw == -Math.PI) || + (l = true), + (this._maxPitch == Math.PI && + this._minPitch == -Math.PI) || + (h = true), + l || h) + ) { + var f = e._tmpMats[2], + d = e._tmpMats[3]; + if (this.upAxisSpace == a.s.BONE && 1 == u.y && c) + c.getRotationMatrixToRef(a.s.WORLD, this.mesh, f); + else if ( + this.upAxisSpace != a.s.LOCAL || + 1 != u.y || + c + ) { + (m = e._tmpVecs[2]).copyFrom(this._fowardAxis), + this._transformYawPitch && + a.x.TransformCoordinatesToRef( + m, + this._transformYawPitchInv, + m + ), + c + ? c.getDirectionToRef(m, this.mesh, m) + : s.getDirectionToRef(m, m); + var p = a.x.Cross(u, m); + p.normalize(); + var m = a.x.Cross(p, u); + a.j.FromXYZAxesToRef(p, u, m, f); + } else f.copyFrom(s.getWorldMatrix()); + f.invertToRef(d); + var g = null; + if (h) { + var _ = e._tmpVecs[3]; + n.subtractToRef(i, _), + a.x.TransformCoordinatesToRef(_, d, _), + (g = Math.sqrt(_.x * _.x + _.z * _.z)); + var v = Math.atan2(_.y, g), + y = v; + v > this._maxPitch + ? ((_.y = this._maxPitchTan * g), + (y = this._maxPitch)) + : v < this._minPitch && + ((_.y = this._minPitchTan * g), + (y = this._minPitch)), + v != y && + (a.x.TransformCoordinatesToRef(_, f, _), + _.addInPlace(i), + (n = _)); + } + if (l) { + (_ = e._tmpVecs[4]), + n.subtractToRef(i, _), + a.x.TransformCoordinatesToRef(_, d, _); + var b = Math.atan2(_.x, _.z), + E = b; + if ( + ((b > this._maxYaw || b < this._minYaw) && + (null == g && + (g = Math.sqrt(_.x * _.x + _.z * _.z)), + this._yawRange > Math.PI + ? this._isAngleBetween( + b, + this._maxYaw, + this._midYawConstraint + ) + ? ((_.z = this._maxYawCos * g), + (_.x = this._maxYawSin * g), + (E = this._maxYaw)) + : this._isAngleBetween( + b, + this._midYawConstraint, + this._minYaw + ) && + ((_.z = this._minYawCos * g), + (_.x = this._minYawSin * g), + (E = this._minYaw)) + : b > this._maxYaw + ? ((_.z = this._maxYawCos * g), + (_.x = this._maxYawSin * g), + (E = this._maxYaw)) + : b < this._minYaw && + ((_.z = this._minYawCos * g), + (_.x = this._minYawSin * g), + (E = this._minYaw))), + this._slerping && this._yawRange > Math.PI) + ) { + var T = e._tmpVecs[8]; + T.copyFrom(a.c.Z), + this._transformYawPitch && + a.x.TransformCoordinatesToRef( + T, + this._transformYawPitchInv, + T + ); + var A = e._tmpMats[4]; + this._boneQuat.toRotationMatrix(A), + this.mesh.getWorldMatrix().multiplyToRef(A, A), + a.x.TransformCoordinatesToRef(T, A, T), + a.x.TransformCoordinatesToRef(T, d, T); + var x = Math.atan2(T.x, T.z); + if ( + this._getAngleBetween(x, b) > + this._getAngleBetween(x, this._midYawConstraint) + ) { + null == g && + (g = Math.sqrt(_.x * _.x + _.z * _.z)); + var S = this._getAngleBetween(x, this._maxYaw); + this._getAngleBetween(x, this._minYaw) < S + ? ((E = x + 0.75 * Math.PI), + (_.z = Math.cos(E) * g), + (_.x = Math.sin(E) * g)) + : ((E = x - 0.75 * Math.PI), + (_.z = Math.cos(E) * g), + (_.x = Math.sin(E) * g)); + } } - var C = e._tmpVecs[5] - , P = e._tmpVecs[6] - , R = e._tmpVecs[7] - , M = e._tmpQuat; - n.subtractToRef(i, C), - C.normalize(), - a.x.CrossToRef(u, C, P), - P.normalize(), - a.x.CrossToRef(C, P, R), - R.normalize(), - a.j.FromXYZAxesToRef(P, R, C, r), - 0 === P.x && 0 === P.y && 0 === P.z || 0 === R.x && 0 === R.y && 0 === R.z || 0 === C.x && 0 === C.y && 0 === C.z || ((this.adjustYaw || this.adjustPitch || this.adjustRoll) && (a.j.RotationYawPitchRollToRef(this.adjustYaw, this.adjustPitch, this.adjustRoll, o), - o.multiplyToRef(r, r)), - this.slerpAmount < 1 ? (this._slerping || this.bone.getRotationQuaternionToRef(a.s.WORLD, this.mesh, this._boneQuat), - this._transformYawPitch && this._transformYawPitch.multiplyToRef(r, r), - a.q.FromRotationMatrixToRef(r, M), - a.q.SlerpToRef(this._boneQuat, M, this.slerpAmount, this._boneQuat), - this.bone.setRotationQuaternion(this._boneQuat, a.s.WORLD, this.mesh), - this._slerping = true) : (this._transformYawPitch && this._transformYawPitch.multiplyToRef(r, r), - this.bone.setRotationMatrix(r, a.s.WORLD, this.mesh), - this._slerping = false)) + b != E && + (a.x.TransformCoordinatesToRef(_, f, _), + _.addInPlace(i), + (n = _)); + } } - } - , - e.prototype._getAngleDiff = function(e, t) { - var i = t - e; - return (i %= 2 * Math.PI) > Math.PI ? i -= 2 * Math.PI : i < -Math.PI && (i += 2 * Math.PI), + var C = e._tmpVecs[5], + P = e._tmpVecs[6], + R = e._tmpVecs[7], + M = e._tmpQuat; + n.subtractToRef(i, C), + C.normalize(), + a.x.CrossToRef(u, C, P), + P.normalize(), + a.x.CrossToRef(C, P, R), + R.normalize(), + a.j.FromXYZAxesToRef(P, R, C, r), + (0 === P.x && 0 === P.y && 0 === P.z) || + (0 === R.x && 0 === R.y && 0 === R.z) || + (0 === C.x && 0 === C.y && 0 === C.z) || + ((this.adjustYaw || + this.adjustPitch || + this.adjustRoll) && + (a.j.RotationYawPitchRollToRef( + this.adjustYaw, + this.adjustPitch, + this.adjustRoll, + o + ), + o.multiplyToRef(r, r)), + this.slerpAmount < 1 + ? (this._slerping || + this.bone.getRotationQuaternionToRef( + a.s.WORLD, + this.mesh, + this._boneQuat + ), + this._transformYawPitch && + this._transformYawPitch.multiplyToRef(r, r), + a.q.FromRotationMatrixToRef(r, M), + a.q.SlerpToRef( + this._boneQuat, + M, + this.slerpAmount, + this._boneQuat + ), + this.bone.setRotationQuaternion( + this._boneQuat, + a.s.WORLD, + this.mesh + ), + (this._slerping = true)) + : (this._transformYawPitch && + this._transformYawPitch.multiplyToRef(r, r), + this.bone.setRotationMatrix( + r, + a.s.WORLD, + this.mesh + ), + (this._slerping = false))); + } + }), + (e.prototype._getAngleDiff = function (e, t) { + var i = t - e; + return ( + (i %= 2 * Math.PI) > Math.PI + ? (i -= 2 * Math.PI) + : i < -Math.PI && (i += 2 * Math.PI), i - } - , - e.prototype._getAngleBetween = function(e, t) { - var i = 0; - return (i = (e = (e %= 2 * Math.PI) < 0 ? e + 2 * Math.PI : e) < (t = (t %= 2 * Math.PI) < 0 ? t + 2 * Math.PI : t) ? t - e : e - t) > Math.PI && (i = 2 * Math.PI - i), + ); + }), + (e.prototype._getAngleBetween = function (e, t) { + var i = 0; + return ( + (i = + (e = (e %= 2 * Math.PI) < 0 ? e + 2 * Math.PI : e) < + (t = (t %= 2 * Math.PI) < 0 ? t + 2 * Math.PI : t) + ? t - e + : e - t) > Math.PI && (i = 2 * Math.PI - i), i - } - , - e.prototype._isAngleBetween = function(e, t, i) { - if (e = (e %= 2 * Math.PI) < 0 ? e + 2 * Math.PI : e, - (t = (t %= 2 * Math.PI) < 0 ? t + 2 * Math.PI : t) < (i = (i %= 2 * Math.PI) < 0 ? i + 2 * Math.PI : i)) { - if (e > t && e < i) - return true - } else if (e > i && e < t) - return true; - return false - } - , - e._tmpVecs = Q.a.BuildArray(10, a.x.Zero), - e._tmpQuat = a.q.Identity(), - e._tmpMats = Q.a.BuildArray(5, a.j.Identity), + ); + }), + (e.prototype._isAngleBetween = function (e, t, i) { + if ( + ((e = (e %= 2 * Math.PI) < 0 ? e + 2 * Math.PI : e), + (t = (t %= 2 * Math.PI) < 0 ? t + 2 * Math.PI : t) < + (i = (i %= 2 * Math.PI) < 0 ? i + 2 * Math.PI : i)) + ) { + if (e > t && e < i) return true; + } else if (e > i && e < t) return true; + return false; + }), + (e._tmpVecs = Q.a.BuildArray(10, a.x.Zero)), + (e._tmpQuat = a.q.Identity()), + (e._tmpMats = Q.a.BuildArray(5, a.j.Identity)), e - }() - , je = n(7) - , He = n(26); - ve.b.prototype.updateRawTexture = function(e, t, i, n, r, o) { - if (void 0 === r && (r = null), - void 0 === o && (o = ve.b.TEXTURETYPE_UNSIGNED_INT), - e) { - var a = this._getRGBABufferInternalSizedFormat(o, i) - , s = this._getInternalFormat(i) - , c = this._getWebGLTextureType(o); - this._bindTextureDirectly(this._gl.TEXTURE_2D, e, true), - this._unpackFlipY(void 0 === n || !!n), - this._doNotHandleContextLost || (e._bufferView = t, - e.format = i, - e.type = o, - e.invertY = n, - e._compression = r), - e.width % 4 != 0 && this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1), - r && t ? this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[r], e.width, e.height, 0, t) : this._gl.texImage2D(this._gl.TEXTURE_2D, 0, a, e.width, e.height, 0, s, c, t), - e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), - this._bindTextureDirectly(this._gl.TEXTURE_2D, null), - e.isReady = true - } + ); + })(), + je = n(7), + He = n(26); + (ve.b.prototype.updateRawTexture = function (e, t, i, n, r, o) { + if ( + (void 0 === r && (r = null), + void 0 === o && (o = ve.b.TEXTURETYPE_UNSIGNED_INT), + e) + ) { + var a = this._getRGBABufferInternalSizedFormat(o, i), + s = this._getInternalFormat(i), + c = this._getWebGLTextureType(o); + this._bindTextureDirectly(this._gl.TEXTURE_2D, e, true), + this._unpackFlipY(void 0 === n || !!n), + this._doNotHandleContextLost || + ((e._bufferView = t), + (e.format = i), + (e.type = o), + (e.invertY = n), + (e._compression = r)), + e.width % 4 != 0 && + this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1), + r && t + ? this._gl.compressedTexImage2D( + this._gl.TEXTURE_2D, + 0, + this.getCaps().s3tc[r], + e.width, + e.height, + 0, + t + ) + : this._gl.texImage2D( + this._gl.TEXTURE_2D, + 0, + a, + e.width, + e.height, + 0, + s, + c, + t + ), + e.generateMipMaps && + this._gl.generateMipmap(this._gl.TEXTURE_2D), + this._bindTextureDirectly(this._gl.TEXTURE_2D, null), + (e.isReady = true); } - , - ve.b.prototype.createRawTexture = function(e, t, i, n, r, o, a, s, c) { - void 0 === s && (s = null), + }), + (ve.b.prototype.createRawTexture = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + void 0 === s && (s = null), void 0 === c && (c = ve.b.TEXTURETYPE_UNSIGNED_INT); - var u = new He.a(this,He.a.DATASOURCE_RAW); - u.baseWidth = t, - u.baseHeight = i, - u.width = t, - u.height = i, - u.format = n, - u.generateMipMaps = r, - u.samplingMode = a, - u.invertY = o, - u._compression = s, - u.type = c, + var u = new He.a(this, He.a.DATASOURCE_RAW); + (u.baseWidth = t), + (u.baseHeight = i), + (u.width = t), + (u.height = i), + (u.format = n), + (u.generateMipMaps = r), + (u.samplingMode = a), + (u.invertY = o), + (u._compression = s), + (u.type = c), this._doNotHandleContextLost || (u._bufferView = e), this.updateRawTexture(u, e, n, o, s, c), this._bindTextureDirectly(this._gl.TEXTURE_2D, u, true); - var l = this._getSamplingParameters(a, r); - return this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, l.mag), - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, l.min), + var l = this._getSamplingParameters(a, r); + return ( + this._gl.texParameteri( + this._gl.TEXTURE_2D, + this._gl.TEXTURE_MAG_FILTER, + l.mag + ), + this._gl.texParameteri( + this._gl.TEXTURE_2D, + this._gl.TEXTURE_MIN_FILTER, + l.min + ), r && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this._internalTexturesCache.push(u), u - } - , - ve.b.prototype.createRawCubeTexture = function(e, t, i, n, r, o, a, s) { - void 0 === s && (s = null); - var c = this._gl - , u = new He.a(this,He.a.DATASOURCE_CUBERAW); - u.isCube = true, - u.format = i, - u.type = n, + ); + }), + (ve.b.prototype.createRawCubeTexture = function ( + e, + t, + i, + n, + r, + o, + a, + s + ) { + void 0 === s && (s = null); + var c = this._gl, + u = new He.a(this, He.a.DATASOURCE_CUBERAW); + (u.isCube = true), + (u.format = i), + (u.type = n), this._doNotHandleContextLost || (u._bufferViewArray = e); - var l = this._getWebGLTextureType(n) - , h = this._getInternalFormat(i); - h === c.RGB && (h = c.RGBA), - l !== c.FLOAT || this._caps.textureFloatLinearFiltering ? l !== this._gl.HALF_FLOAT_OES || this._caps.textureHalfFloatLinearFiltering ? l !== c.FLOAT || this._caps.textureFloatRender ? l !== c.HALF_FLOAT || this._caps.colorBufferFloat || (r = false, - g.a.Warn("Render to half float textures is not supported. Mipmap generation forced to false.")) : (r = false, - g.a.Warn("Render to float textures is not supported. Mipmap generation forced to false.")) : (r = false, - a = ve.b.TEXTURE_NEAREST_SAMPLINGMODE, - g.a.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")) : (r = false, - a = ve.b.TEXTURE_NEAREST_SAMPLINGMODE, - g.a.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")); - var f = t - , d = f; - u.width = f, - u.height = d, - !this.needPOTTextures || Ee.h.IsExponentOfTwo(u.width) && Ee.h.IsExponentOfTwo(u.height) || (r = false), + var l = this._getWebGLTextureType(n), + h = this._getInternalFormat(i); + h === c.RGB && (h = c.RGBA), + l !== c.FLOAT || this._caps.textureFloatLinearFiltering + ? l !== this._gl.HALF_FLOAT_OES || + this._caps.textureHalfFloatLinearFiltering + ? l !== c.FLOAT || this._caps.textureFloatRender + ? l !== c.HALF_FLOAT || + this._caps.colorBufferFloat || + ((r = false), + g.a.Warn( + "Render to half float textures is not supported. Mipmap generation forced to false." + )) + : ((r = false), + g.a.Warn( + "Render to float textures is not supported. Mipmap generation forced to false." + )) + : ((r = false), + (a = ve.b.TEXTURE_NEAREST_SAMPLINGMODE), + g.a.Warn( + "Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively." + )) + : ((r = false), + (a = ve.b.TEXTURE_NEAREST_SAMPLINGMODE), + g.a.Warn( + "Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively." + )); + var f = t, + d = f; + (u.width = f), + (u.height = d), + !this.needPOTTextures || + (Ee.h.IsExponentOfTwo(u.width) && + Ee.h.IsExponentOfTwo(u.height)) || + (r = false), e && this.updateRawCubeTexture(u, e, i, n, o, s), - this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, u, true), - e && r && this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP); - var p = this._getSamplingParameters(a, r); - return c.texParameteri(c.TEXTURE_CUBE_MAP, c.TEXTURE_MAG_FILTER, p.mag), - c.texParameteri(c.TEXTURE_CUBE_MAP, c.TEXTURE_MIN_FILTER, p.min), - c.texParameteri(c.TEXTURE_CUBE_MAP, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE), - c.texParameteri(c.TEXTURE_CUBE_MAP, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE), + this._bindTextureDirectly( + this._gl.TEXTURE_CUBE_MAP, + u, + true + ), + e && + r && + this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP); + var p = this._getSamplingParameters(a, r); + return ( + c.texParameteri( + c.TEXTURE_CUBE_MAP, + c.TEXTURE_MAG_FILTER, + p.mag + ), + c.texParameteri( + c.TEXTURE_CUBE_MAP, + c.TEXTURE_MIN_FILTER, + p.min + ), + c.texParameteri( + c.TEXTURE_CUBE_MAP, + c.TEXTURE_WRAP_S, + c.CLAMP_TO_EDGE + ), + c.texParameteri( + c.TEXTURE_CUBE_MAP, + c.TEXTURE_WRAP_T, + c.CLAMP_TO_EDGE + ), this._bindTextureDirectly(c.TEXTURE_CUBE_MAP, null), - u.generateMipMaps = r, + (u.generateMipMaps = r), u - } - , - ve.b.prototype.updateRawCubeTexture = function(e, t, i, n, r, o, a) { - void 0 === o && (o = null), + ); + }), + (ve.b.prototype.updateRawCubeTexture = function ( + e, + t, + i, + n, + r, + o, + a + ) { + void 0 === o && (o = null), void 0 === a && (a = 0), - e._bufferViewArray = t, - e.format = i, - e.type = n, - e.invertY = r, - e._compression = o; - var s = this._gl - , c = this._getWebGLTextureType(n) - , u = this._getInternalFormat(i) - , l = this._getRGBABufferInternalSizedFormat(n) - , h = false; - u === s.RGB && (u = s.RGBA, - h = true), + (e._bufferViewArray = t), + (e.format = i), + (e.type = n), + (e.invertY = r), + (e._compression = o); + var s = this._gl, + c = this._getWebGLTextureType(n), + u = this._getInternalFormat(i), + l = this._getRGBABufferInternalSizedFormat(n), + h = false; + u === s.RGB && ((u = s.RGBA), (h = true)), this._bindTextureDirectly(s.TEXTURE_CUBE_MAP, e, true), this._unpackFlipY(void 0 === r || !!r), e.width % 4 != 0 && s.pixelStorei(s.UNPACK_ALIGNMENT, 1); - for (var f = 0; f < 6; f++) { - var d = t[f]; - o ? s.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + f, a, this.getCaps().s3tc[o], e.width, e.height, 0, d) : (h && (d = this._convertRGBtoRGBATextureData(d, e.width, e.height, n)), - s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + f, a, l, e.width, e.height, 0, u, c, d)) - } - (!this.needPOTTextures || Ee.h.IsExponentOfTwo(e.width) && Ee.h.IsExponentOfTwo(e.height)) && e.generateMipMaps && 0 === a && this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP), + for (var f = 0; f < 6; f++) { + var d = t[f]; + o + ? s.compressedTexImage2D( + s.TEXTURE_CUBE_MAP_POSITIVE_X + f, + a, + this.getCaps().s3tc[o], + e.width, + e.height, + 0, + d + ) + : (h && + (d = this._convertRGBtoRGBATextureData( + d, + e.width, + e.height, + n + )), + s.texImage2D( + s.TEXTURE_CUBE_MAP_POSITIVE_X + f, + a, + l, + e.width, + e.height, + 0, + u, + c, + d + )); + } + (!this.needPOTTextures || + (Ee.h.IsExponentOfTwo(e.width) && + Ee.h.IsExponentOfTwo(e.height))) && + e.generateMipMaps && + 0 === a && + this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), - e.isReady = true - } - , - ve.b.prototype.createRawCubeTextureFromUrl = function(e, t, i, n, r, o, a, s, c, u, l, h) { - var f = this; - void 0 === c && (c = null), + (e.isReady = true); + }), + (ve.b.prototype.createRawCubeTextureFromUrl = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u, + l, + h + ) { + var f = this; + void 0 === c && (c = null), void 0 === u && (u = null), void 0 === l && (l = ve.b.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === h && (h = false); - var d = this._gl - , p = this.createRawCubeTexture(null, i, n, r, !o, h, l); - return t._addPendingData(p), - p.url = e, + var d = this._gl, + p = this.createRawCubeTexture(null, i, n, r, !o, h, l); + return ( + t._addPendingData(p), + (p.url = e), this._internalTexturesCache.push(p), - this._loadFile(e, function(e) { - !function(e) { - var i = p.width - , o = a(e); - if (o) { - if (s) { - var u = f._getWebGLTextureType(r) - , l = f._getInternalFormat(n) - , m = f._getRGBABufferInternalSizedFormat(r) - , g = false; - l === d.RGB && (l = d.RGBA, - g = true), - f._bindTextureDirectly(d.TEXTURE_CUBE_MAP, p, true), - f._unpackFlipY(false); - for (var _ = s(o), v = 0; v < _.length; v++) - for (var y = i >> v, b = 0; b < 6; b++) { - var E = _[v][b]; - g && (E = f._convertRGBtoRGBATextureData(E, y, y, r)), - d.texImage2D(b, v, m, y, y, 0, l, u, E) - } - f._bindTextureDirectly(d.TEXTURE_CUBE_MAP, null) - } else - f.updateRawCubeTexture(p, o, n, r, h); - p.isReady = true, - t._removePendingData(p), - c && c() - } - }(e) - }, void 0, t.offlineProvider, true, function(e, i) { + this._loadFile( + e, + function (e) { + !(function (e) { + var i = p.width, + o = a(e); + if (o) { + if (s) { + var u = f._getWebGLTextureType(r), + l = f._getInternalFormat(n), + m = f._getRGBABufferInternalSizedFormat(r), + g = false; + l === d.RGB && ((l = d.RGBA), (g = true)), + f._bindTextureDirectly( + d.TEXTURE_CUBE_MAP, + p, + true + ), + f._unpackFlipY(false); + for (var _ = s(o), v = 0; v < _.length; v++) + for (var y = i >> v, b = 0; b < 6; b++) { + var E = _[v][b]; + g && + (E = f._convertRGBtoRGBATextureData( + E, + y, + y, + r + )), + d.texImage2D(b, v, m, y, y, 0, l, u, E); + } + f._bindTextureDirectly(d.TEXTURE_CUBE_MAP, null); + } else f.updateRawCubeTexture(p, o, n, r, h); + (p.isReady = true), + t._removePendingData(p), + c && c(); + } + })(e); + }, + void 0, + t.offlineProvider, + true, + function (e, i) { t._removePendingData(p), - u && e && u(e.status + " " + e.statusText, i) - }), + u && e && u(e.status + " " + e.statusText, i); + } + ), p - } - , - ve.b.prototype.createRawTexture3D = function(e, t, i, n, r, o, a, s, c, u) { - void 0 === c && (c = null), + ); + }), + (ve.b.prototype.createRawTexture3D = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u + ) { + void 0 === c && (c = null), void 0 === u && (u = ve.b.TEXTURETYPE_UNSIGNED_INT); - var l = new He.a(this,He.a.DATASOURCE_RAW3D); - l.baseWidth = t, - l.baseHeight = i, - l.baseDepth = n, - l.width = t, - l.height = i, - l.depth = n, - l.format = r, - l.type = u, - l.generateMipMaps = o, - l.samplingMode = s, - l.is3D = true, + var l = new He.a(this, He.a.DATASOURCE_RAW3D); + (l.baseWidth = t), + (l.baseHeight = i), + (l.baseDepth = n), + (l.width = t), + (l.height = i), + (l.depth = n), + (l.format = r), + (l.type = u), + (l.generateMipMaps = o), + (l.samplingMode = s), + (l.is3D = true), this._doNotHandleContextLost || (l._bufferView = e), this.updateRawTexture3D(l, e, r, a, c, u), this._bindTextureDirectly(this._gl.TEXTURE_3D, l, true); - var h = this._getSamplingParameters(s, o); - return this._gl.texParameteri(this._gl.TEXTURE_3D, this._gl.TEXTURE_MAG_FILTER, h.mag), - this._gl.texParameteri(this._gl.TEXTURE_3D, this._gl.TEXTURE_MIN_FILTER, h.min), + var h = this._getSamplingParameters(s, o); + return ( + this._gl.texParameteri( + this._gl.TEXTURE_3D, + this._gl.TEXTURE_MAG_FILTER, + h.mag + ), + this._gl.texParameteri( + this._gl.TEXTURE_3D, + this._gl.TEXTURE_MIN_FILTER, + h.min + ), o && this._gl.generateMipmap(this._gl.TEXTURE_3D), this._bindTextureDirectly(this._gl.TEXTURE_3D, null), this._internalTexturesCache.push(l), l - } - , - ve.b.prototype.updateRawTexture3D = function(e, t, i, n, r, o) { - void 0 === r && (r = null), + ); + }), + (ve.b.prototype.updateRawTexture3D = function ( + e, + t, + i, + n, + r, + o + ) { + void 0 === r && (r = null), void 0 === o && (o = ve.b.TEXTURETYPE_UNSIGNED_INT); - var a = this._getWebGLTextureType(o) - , s = this._getInternalFormat(i) - , c = this._getRGBABufferInternalSizedFormat(o, i); - this._bindTextureDirectly(this._gl.TEXTURE_3D, e, true), + var a = this._getWebGLTextureType(o), + s = this._getInternalFormat(i), + c = this._getRGBABufferInternalSizedFormat(o, i); + this._bindTextureDirectly(this._gl.TEXTURE_3D, e, true), this._unpackFlipY(void 0 === n || !!n), - this._doNotHandleContextLost || (e._bufferView = t, - e.format = i, - e.invertY = n, - e._compression = r), - e.width % 4 != 0 && this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1), - r && t ? this._gl.compressedTexImage3D(this._gl.TEXTURE_3D, 0, this.getCaps().s3tc[r], e.width, e.height, e.depth, 0, t) : this._gl.texImage3D(this._gl.TEXTURE_3D, 0, c, e.width, e.height, e.depth, 0, s, a, t), - e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_3D), + this._doNotHandleContextLost || + ((e._bufferView = t), + (e.format = i), + (e.invertY = n), + (e._compression = r)), + e.width % 4 != 0 && + this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1), + r && t + ? this._gl.compressedTexImage3D( + this._gl.TEXTURE_3D, + 0, + this.getCaps().s3tc[r], + e.width, + e.height, + e.depth, + 0, + t + ) + : this._gl.texImage3D( + this._gl.TEXTURE_3D, + 0, + c, + e.width, + e.height, + e.depth, + 0, + s, + a, + t + ), + e.generateMipMaps && + this._gl.generateMipmap(this._gl.TEXTURE_3D), this._bindTextureDirectly(this._gl.TEXTURE_3D, null), - e.isReady = true - } - ; - var We = function(e) { - function t(t, i, n, r, o, a, s, c, u) { - void 0 === a && (a = true), - void 0 === s && (s = false), - void 0 === c && (c = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), - void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT); - var l = e.call(this, null, o, !a, s) || this; - return l.format = r, - l._engine = o.getEngine(), - l._texture = o.getEngine().createRawTexture(t, i, n, r, a, s, c, null, u), - l.wrapU = je.a.CLAMP_ADDRESSMODE, - l.wrapV = je.a.CLAMP_ADDRESSMODE, - l - } - return h.d(t, e), - t.prototype.update = function(e) { - this._engine.updateRawTexture(this._texture, e, this._texture.format, this._texture.invertY, null, this._texture.type) - } - , - t.CreateLuminanceTexture = function(e, i, n, r, o, a, s) { - return void 0 === o && (o = true), + (e.isReady = true); + }); + var We = (function (e) { + function t(t, i, n, r, o, a, s, c, u) { + void 0 === a && (a = true), + void 0 === s && (s = false), + void 0 === c && (c = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT); + var l = e.call(this, null, o, !a, s) || this; + return ( + (l.format = r), + (l._engine = o.getEngine()), + (l._texture = o + .getEngine() + .createRawTexture(t, i, n, r, a, s, c, null, u)), + (l.wrapU = je.a.CLAMP_ADDRESSMODE), + (l.wrapV = je.a.CLAMP_ADDRESSMODE), + l + ); + } + return ( + h.d(t, e), + (t.prototype.update = function (e) { + this._engine.updateRawTexture( + this._texture, + e, + this._texture.format, + this._texture.invertY, + null, + this._texture.type + ); + }), + (t.CreateLuminanceTexture = function (e, i, n, r, o, a, s) { + return ( + void 0 === o && (o = true), void 0 === a && (a = false), - void 0 === s && (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), - new t(e,i,n,_.a.TEXTUREFORMAT_LUMINANCE,r,o,a,s) - } - , - t.CreateLuminanceAlphaTexture = function(e, i, n, r, o, a, s) { - return void 0 === o && (o = true), + void 0 === s && + (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + new t(e, i, n, _.a.TEXTUREFORMAT_LUMINANCE, r, o, a, s) + ); + }), + (t.CreateLuminanceAlphaTexture = function ( + e, + i, + n, + r, + o, + a, + s + ) { + return ( + void 0 === o && (o = true), void 0 === a && (a = false), - void 0 === s && (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), - new t(e,i,n,_.a.TEXTUREFORMAT_LUMINANCE_ALPHA,r,o,a,s) - } - , - t.CreateAlphaTexture = function(e, i, n, r, o, a, s) { - return void 0 === o && (o = true), + void 0 === s && + (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + new t( + e, + i, + n, + _.a.TEXTUREFORMAT_LUMINANCE_ALPHA, + r, + o, + a, + s + ) + ); + }), + (t.CreateAlphaTexture = function (e, i, n, r, o, a, s) { + return ( + void 0 === o && (o = true), void 0 === a && (a = false), - void 0 === s && (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), - new t(e,i,n,_.a.TEXTUREFORMAT_ALPHA,r,o,a,s) - } - , - t.CreateRGBTexture = function(e, i, n, r, o, a, s, c) { - return void 0 === o && (o = true), + void 0 === s && + (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + new t(e, i, n, _.a.TEXTUREFORMAT_ALPHA, r, o, a, s) + ); + }), + (t.CreateRGBTexture = function (e, i, n, r, o, a, s, c) { + return ( + void 0 === o && (o = true), void 0 === a && (a = false), - void 0 === s && (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + void 0 === s && + (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), - new t(e,i,n,_.a.TEXTUREFORMAT_RGB,r,o,a,s,c) - } - , - t.CreateRGBATexture = function(e, i, n, r, o, a, s, c) { - return void 0 === o && (o = true), + new t(e, i, n, _.a.TEXTUREFORMAT_RGB, r, o, a, s, c) + ); + }), + (t.CreateRGBATexture = function (e, i, n, r, o, a, s, c) { + return ( + void 0 === o && (o = true), void 0 === a && (a = false), - void 0 === s && (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + void 0 === s && + (s = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), - new t(e,i,n,_.a.TEXTUREFORMAT_RGBA,r,o,a,s,c) - } - , - t.CreateRTexture = function(e, i, n, r, o, a, s, c) { - return void 0 === o && (o = true), + new t(e, i, n, _.a.TEXTUREFORMAT_RGBA, r, o, a, s, c) + ); + }), + (t.CreateRTexture = function (e, i, n, r, o, a, s, c) { + return ( + void 0 === o && (o = true), void 0 === a && (a = false), void 0 === s && (s = je.a.TRILINEAR_SAMPLINGMODE), void 0 === c && (c = _.a.TEXTURETYPE_FLOAT), - new t(e,i,n,_.a.TEXTUREFORMAT_R,r,o,a,s,c) - } - , + new t(e, i, n, _.a.TEXTUREFORMAT_R, r, o, a, s, c) + ); + }), t - }(je.a) - , Xe = function() { - function e(e, t, i) { - this.name = e, - this.id = t, - this.bones = new Array, - this.needInitialSkinMatrix = false, - this.overrideMesh = null, - this._isDirty = true, - this._meshesWithPoseMatrix = new Array, - this._identity = a.j.Identity(), - this._ranges = {}, - this._lastAbsoluteTransformsUpdateId = -1, - this._canUseTextureForBones = false, - this._uniqueId = 0, - this._numBonesWithLinkedTransformNode = 0, - this._hasWaitingData = null, - this.doNotSerialize = false, - this._useTextureToStoreBoneMatrices = true, - this._animationPropertiesOverride = null, - this.onBeforeComputeObservable = new o.c, - this.bones = [], - this._scene = i || R.a.LastCreatedScene, - this._uniqueId = this._scene.getUniqueId(), - this._scene.addSkeleton(this), - this._isDirty = true; - var n = this._scene.getEngine().getCaps(); - this._canUseTextureForBones = n.textureFloat && n.maxVertexTextureImageUnits > 0 - } - return Object.defineProperty(e.prototype, "useTextureToStoreBoneMatrices", { - get: function() { - return this._useTextureToStoreBoneMatrices + ); + })(je.a), + Xe = (function () { + function e(e, t, i) { + (this.name = e), + (this.id = t), + (this.bones = new Array()), + (this.needInitialSkinMatrix = false), + (this.overrideMesh = null), + (this._isDirty = true), + (this._meshesWithPoseMatrix = new Array()), + (this._identity = a.j.Identity()), + (this._ranges = {}), + (this._lastAbsoluteTransformsUpdateId = -1), + (this._canUseTextureForBones = false), + (this._uniqueId = 0), + (this._numBonesWithLinkedTransformNode = 0), + (this._hasWaitingData = null), + (this.doNotSerialize = false), + (this._useTextureToStoreBoneMatrices = true), + (this._animationPropertiesOverride = null), + (this.onBeforeComputeObservable = new o.c()), + (this.bones = []), + (this._scene = i || R.a.LastCreatedScene), + (this._uniqueId = this._scene.getUniqueId()), + this._scene.addSkeleton(this), + (this._isDirty = true); + var n = this._scene.getEngine().getCaps(); + this._canUseTextureForBones = + n.textureFloat && n.maxVertexTextureImageUnits > 0; + } + return ( + Object.defineProperty( + e.prototype, + "useTextureToStoreBoneMatrices", + { + get: function () { + return this._useTextureToStoreBoneMatrices; }, - set: function(e) { - this._useTextureToStoreBoneMatrices = e, - this._markAsDirty() + set: function (e) { + (this._useTextureToStoreBoneMatrices = e), + this._markAsDirty(); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "animationPropertiesOverride", { - get: function() { - return this._animationPropertiesOverride ? this._animationPropertiesOverride : this._scene.animationPropertiesOverride + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "animationPropertiesOverride", + { + get: function () { + return this._animationPropertiesOverride + ? this._animationPropertiesOverride + : this._scene.animationPropertiesOverride; }, - set: function(e) { - this._animationPropertiesOverride = e + set: function (e) { + this._animationPropertiesOverride = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "isUsingTextureForMatrices", { - get: function() { - return this.useTextureToStoreBoneMatrices && this._canUseTextureForBones && !this.needInitialSkinMatrix + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "isUsingTextureForMatrices", + { + get: function () { + return ( + this.useTextureToStoreBoneMatrices && + this._canUseTextureForBones && + !this.needInitialSkinMatrix + ); }, enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "uniqueId", { - get: function() { - return this._uniqueId - }, - enumerable: true, - configurable: true + get: function () { + return this._uniqueId; + }, + enumerable: true, + configurable: true, }), - e.prototype.getClassName = function() { - return "Skeleton" - } - , - e.prototype.getChildren = function() { - return this.bones.filter(function(e) { - return !e.getParent() - }) - } - , - e.prototype.getTransformMatrices = function(e) { - return this.needInitialSkinMatrix && e._bonesTransformMatrices ? e._bonesTransformMatrices : (this._transformMatrices || this.prepare(), - this._transformMatrices) - } - , - e.prototype.getTransformMatrixTexture = function() { - return this._transformMatrixTexture - } - , - e.prototype.getScene = function() { - return this._scene - } - , - e.prototype.toString = function(e) { - var t = "Name: " + this.name + ", nBones: " + this.bones.length; - if (t += ", nAnimationRanges: " + (this._ranges ? Object.keys(this._ranges).length : "none"), - e) { - t += ", Ranges: {"; - var i = true; - for (var n in this._ranges) - i && (t += ", ", - i = false), - t += n; - t += "}" - } - return t - } - , - e.prototype.getBoneIndexByName = function(e) { - for (var t = 0, i = this.bones.length; t < i; t++) - if (this.bones[t].name === e) - return t; - return -1 - } - , - e.prototype.createAnimationRange = function(e, t, i) { - if (!this._ranges[e]) { - this._ranges[e] = new B(e,t,i); - for (var n = 0, r = this.bones.length; n < r; n++) - this.bones[n].animations[0] && this.bones[n].animations[0].createRange(e, t, i) - } - } - , - e.prototype.deleteAnimationRange = function(e, t) { - void 0 === t && (t = true); - for (var i = 0, n = this.bones.length; i < n; i++) - this.bones[i].animations[0] && this.bones[i].animations[0].deleteRange(e, t); - this._ranges[e] = null - } - , - e.prototype.getAnimationRange = function(e) { - return this._ranges[e] - } - , - e.prototype.getAnimationRanges = function() { - var e, t = []; - for (e in this._ranges) - t.push(this._ranges[e]); - return t - } - , - e.prototype.copyAnimationRange = function(e, t, i) { - if (void 0 === i && (i = false), + (e.prototype.getClassName = function () { + return "Skeleton"; + }), + (e.prototype.getChildren = function () { + return this.bones.filter(function (e) { + return !e.getParent(); + }); + }), + (e.prototype.getTransformMatrices = function (e) { + return this.needInitialSkinMatrix && + e._bonesTransformMatrices + ? e._bonesTransformMatrices + : (this._transformMatrices || this.prepare(), + this._transformMatrices); + }), + (e.prototype.getTransformMatrixTexture = function () { + return this._transformMatrixTexture; + }), + (e.prototype.getScene = function () { + return this._scene; + }), + (e.prototype.toString = function (e) { + var t = + "Name: " + this.name + ", nBones: " + this.bones.length; + if ( + ((t += + ", nAnimationRanges: " + + (this._ranges + ? Object.keys(this._ranges).length + : "none")), + e) + ) { + t += ", Ranges: {"; + var i = true; + for (var n in this._ranges) + i && ((t += ", "), (i = false)), (t += n); + t += "}"; + } + return t; + }), + (e.prototype.getBoneIndexByName = function (e) { + for (var t = 0, i = this.bones.length; t < i; t++) + if (this.bones[t].name === e) return t; + return -1; + }), + (e.prototype.createAnimationRange = function (e, t, i) { + if (!this._ranges[e]) { + this._ranges[e] = new B(e, t, i); + for (var n = 0, r = this.bones.length; n < r; n++) + this.bones[n].animations[0] && + this.bones[n].animations[0].createRange(e, t, i); + } + }), + (e.prototype.deleteAnimationRange = function (e, t) { + void 0 === t && (t = true); + for (var i = 0, n = this.bones.length; i < n; i++) + this.bones[i].animations[0] && + this.bones[i].animations[0].deleteRange(e, t); + this._ranges[e] = null; + }), + (e.prototype.getAnimationRange = function (e) { + return this._ranges[e]; + }), + (e.prototype.getAnimationRanges = function () { + var e, + t = []; + for (e in this._ranges) t.push(this._ranges[e]); + return t; + }), + (e.prototype.copyAnimationRange = function (e, t, i) { + if ( + (void 0 === i && (i = false), this._ranges[t] || !e.getAnimationRange(t)) - return false; - var n, r, o = true, a = this._getHighestAnimationFrame() + 1, s = {}, c = e.bones; - for (r = 0, - n = c.length; r < n; r++) - s[c[r].name] = c[r]; - this.bones.length !== c.length && (g.a.Warn("copyAnimationRange: this rig has " + this.bones.length + " bones, while source as " + c.length), - o = false); - var u = i && this.dimensionsAtRest && e.dimensionsAtRest ? this.dimensionsAtRest.divide(e.dimensionsAtRest) : null; - for (r = 0, - n = this.bones.length; r < n; r++) { - var l = this.bones[r].name - , h = s[l]; - h ? o = o && this.bones[r].copyAnimationRange(h, t, a, i, u) : (g.a.Warn("copyAnimationRange: not same rig, missing source bone " + l), - o = false) - } - var f = e.getAnimationRange(t); - return f && (this._ranges[t] = new B(t,f.from + a,f.to + a)), + ) + return false; + var n, + r, + o = true, + a = this._getHighestAnimationFrame() + 1, + s = {}, + c = e.bones; + for (r = 0, n = c.length; r < n; r++) s[c[r].name] = c[r]; + this.bones.length !== c.length && + (g.a.Warn( + "copyAnimationRange: this rig has " + + this.bones.length + + " bones, while source as " + + c.length + ), + (o = false)); + var u = + i && this.dimensionsAtRest && e.dimensionsAtRest + ? this.dimensionsAtRest.divide(e.dimensionsAtRest) + : null; + for (r = 0, n = this.bones.length; r < n; r++) { + var l = this.bones[r].name, + h = s[l]; + h + ? (o = + o && + this.bones[r].copyAnimationRange(h, t, a, i, u)) + : (g.a.Warn( + "copyAnimationRange: not same rig, missing source bone " + + l + ), + (o = false)); + } + var f = e.getAnimationRange(t); + return ( + f && (this._ranges[t] = new B(t, f.from + a, f.to + a)), o - } - , - e.prototype.returnToRest = function() { + ); + }), + (e.prototype.returnToRest = function () { + for (var e = 0; e < this.bones.length; e++) + this.bones[e].returnToRest(); + }), + (e.prototype._getHighestAnimationFrame = function () { + for (var e = 0, t = 0, i = this.bones.length; t < i; t++) + if (this.bones[t].animations[0]) { + var n = this.bones[t].animations[0].getHighestFrame(); + e < n && (e = n); + } + return e; + }), + (e.prototype.beginAnimation = function (e, t, i, n) { + var r = this.getAnimationRange(e); + return r + ? this._scene.beginAnimation( + this, + r.from, + r.to, + t, + i, + n + ) + : null; + }), + (e.prototype._markAsDirty = function () { + this._isDirty = true; + }), + (e.prototype._registerMeshWithPoseMatrix = function (e) { + this._meshesWithPoseMatrix.push(e); + }), + (e.prototype._unregisterMeshWithPoseMatrix = function (e) { + var t = this._meshesWithPoseMatrix.indexOf(e); + t > -1 && this._meshesWithPoseMatrix.splice(t, 1); + }), + (e.prototype._computeTransformMatrices = function (e, t) { + this.onBeforeComputeObservable.notifyObservers(this); + for (var i = 0; i < this.bones.length; i++) { + var n = this.bones[i]; + n._childUpdateId++; + var r = n.getParent(); + if ( + (r + ? n + .getLocalMatrix() + .multiplyToRef( + r.getWorldMatrix(), + n.getWorldMatrix() + ) + : t + ? n + .getLocalMatrix() + .multiplyToRef(t, n.getWorldMatrix()) + : n.getWorldMatrix().copyFrom(n.getLocalMatrix()), + -1 !== n._index) + ) { + var o = null === n._index ? i : n._index; + n.getInvertedAbsoluteTransform().multiplyToArray( + n.getWorldMatrix(), + e, + 16 * o + ); + } + } + this._identity.copyToArray(e, 16 * this.bones.length); + }), + (e.prototype.prepare = function () { + if (this._numBonesWithLinkedTransformNode > 0) + for (var e = 0, t = this.bones; e < t.length; e++) { + var i = t[e]; + i._linkedTransformNode && + (i._linkedTransformNode.computeWorldMatrix(), + (i._matrix = i._linkedTransformNode._localMatrix), + i.markAsDirty()); + } + if (this._isDirty) { + if (this.needInitialSkinMatrix) + for ( + var n = 0; + n < this._meshesWithPoseMatrix.length; + n++ + ) { + var r = this._meshesWithPoseMatrix[n], + o = r.getPoseMatrix(); + if ( + ((r._bonesTransformMatrices && + r._bonesTransformMatrices.length === + 16 * (this.bones.length + 1)) || + (r._bonesTransformMatrices = new Float32Array( + 16 * (this.bones.length + 1) + )), + this._synchronizedWithMesh !== r) + ) { + this._synchronizedWithMesh = r; + for (var s = 0; s < this.bones.length; s++) { + var c = this.bones[s]; + c.getParent() || + (c + .getBaseMatrix() + .multiplyToRef(o, a.t.Matrix[1]), + c._updateDifferenceMatrix(a.t.Matrix[1])); + } + } + this._computeTransformMatrices( + r._bonesTransformMatrices, + o + ); + } + else + (this._transformMatrices && + this._transformMatrices.length === + 16 * (this.bones.length + 1)) || + ((this._transformMatrices = new Float32Array( + 16 * (this.bones.length + 1) + )), + this.isUsingTextureForMatrices && + (this._transformMatrixTexture && + this._transformMatrixTexture.dispose(), + (this._transformMatrixTexture = + We.CreateRGBATexture( + this._transformMatrices, + 4 * (this.bones.length + 1), + 1, + this._scene, + false, + false, + _.a.TEXTURE_NEAREST_SAMPLINGMODE, + _.a.TEXTURETYPE_FLOAT + )))), + this._computeTransformMatrices( + this._transformMatrices, + null + ), + this.isUsingTextureForMatrices && + this._transformMatrixTexture && + this._transformMatrixTexture.update( + this._transformMatrices + ); + (this._isDirty = false), + this._scene._activeBones.addCount( + this.bones.length, + false + ); + } + }), + (e.prototype.getAnimatables = function () { + if ( + !this._animatables || + this._animatables.length !== this.bones.length + ) { + this._animatables = []; for (var e = 0; e < this.bones.length; e++) - this.bones[e].returnToRest() - } - , - e.prototype._getHighestAnimationFrame = function() { - for (var e = 0, t = 0, i = this.bones.length; t < i; t++) - if (this.bones[t].animations[0]) { - var n = this.bones[t].animations[0].getHighestFrame(); - e < n && (e = n) - } - return e - } - , - e.prototype.beginAnimation = function(e, t, i, n) { - var r = this.getAnimationRange(e); - return r ? this._scene.beginAnimation(this, r.from, r.to, t, i, n) : null - } - , - e.prototype._markAsDirty = function() { - this._isDirty = true - } - , - e.prototype._registerMeshWithPoseMatrix = function(e) { - this._meshesWithPoseMatrix.push(e) - } - , - e.prototype._unregisterMeshWithPoseMatrix = function(e) { - var t = this._meshesWithPoseMatrix.indexOf(e); - t > -1 && this._meshesWithPoseMatrix.splice(t, 1) - } - , - e.prototype._computeTransformMatrices = function(e, t) { - this.onBeforeComputeObservable.notifyObservers(this); - for (var i = 0; i < this.bones.length; i++) { - var n = this.bones[i]; - n._childUpdateId++; - var r = n.getParent(); - if (r ? n.getLocalMatrix().multiplyToRef(r.getWorldMatrix(), n.getWorldMatrix()) : t ? n.getLocalMatrix().multiplyToRef(t, n.getWorldMatrix()) : n.getWorldMatrix().copyFrom(n.getLocalMatrix()), - -1 !== n._index) { - var o = null === n._index ? i : n._index; - n.getInvertedAbsoluteTransform().multiplyToArray(n.getWorldMatrix(), e, 16 * o) - } + this._animatables.push(this.bones[e]); + } + return this._animatables; + }), + (e.prototype.clone = function (t, i) { + var n = new e(t, i || t, this._scene); + n.needInitialSkinMatrix = this.needInitialSkinMatrix; + for (var r = 0; r < this.bones.length; r++) { + var o = this.bones[r], + a = null, + s = o.getParent(); + if (s) { + var c = this.bones.indexOf(s); + a = n.bones[c]; } - this._identity.copyToArray(e, 16 * this.bones.length) - } - , - e.prototype.prepare = function() { - if (this._numBonesWithLinkedTransformNode > 0) - for (var e = 0, t = this.bones; e < t.length; e++) { - var i = t[e]; - i._linkedTransformNode && (i._linkedTransformNode.computeWorldMatrix(), - i._matrix = i._linkedTransformNode._localMatrix, - i.markAsDirty()) - } - if (this._isDirty) { - if (this.needInitialSkinMatrix) - for (var n = 0; n < this._meshesWithPoseMatrix.length; n++) { - var r = this._meshesWithPoseMatrix[n] - , o = r.getPoseMatrix(); - if (r._bonesTransformMatrices && r._bonesTransformMatrices.length === 16 * (this.bones.length + 1) || (r._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1))), - this._synchronizedWithMesh !== r) { - this._synchronizedWithMesh = r; - for (var s = 0; s < this.bones.length; s++) { - var c = this.bones[s]; - c.getParent() || (c.getBaseMatrix().multiplyToRef(o, a.t.Matrix[1]), - c._updateDifferenceMatrix(a.t.Matrix[1])) - } - } - this._computeTransformMatrices(r._bonesTransformMatrices, o) - } - else - this._transformMatrices && this._transformMatrices.length === 16 * (this.bones.length + 1) || (this._transformMatrices = new Float32Array(16 * (this.bones.length + 1)), - this.isUsingTextureForMatrices && (this._transformMatrixTexture && this._transformMatrixTexture.dispose(), - this._transformMatrixTexture = We.CreateRGBATexture(this._transformMatrices, 4 * (this.bones.length + 1), 1, this._scene, false, false, _.a.TEXTURE_NEAREST_SAMPLINGMODE, _.a.TEXTURETYPE_FLOAT))), - this._computeTransformMatrices(this._transformMatrices, null), - this.isUsingTextureForMatrices && this._transformMatrixTexture && this._transformMatrixTexture.update(this._transformMatrices); - this._isDirty = false, - this._scene._activeBones.addCount(this.bones.length, false) + var u = new q( + o.name, + n, + a, + o.getBaseMatrix().clone(), + o.getRestPose().clone() + ); + M.a.DeepCopy(o.animations, u.animations); + } + if (this._ranges) + for (var l in ((n._ranges = {}), this._ranges)) { + var h = this._ranges[l]; + h && (n._ranges[l] = h.clone()); } - } - , - e.prototype.getAnimatables = function() { - if (!this._animatables || this._animatables.length !== this.bones.length) { - this._animatables = []; - for (var e = 0; e < this.bones.length; e++) - this._animatables.push(this.bones[e]) - } - return this._animatables - } - , - e.prototype.clone = function(t, i) { - var n = new e(t,i || t,this._scene); - n.needInitialSkinMatrix = this.needInitialSkinMatrix; - for (var r = 0; r < this.bones.length; r++) { - var o = this.bones[r] - , a = null - , s = o.getParent(); - if (s) { - var c = this.bones.indexOf(s); - a = n.bones[c] - } - var u = new q(o.name,n,a,o.getBaseMatrix().clone(),o.getRestPose().clone()); - M.a.DeepCopy(o.animations, u.animations) - } - if (this._ranges) - for (var l in n._ranges = {}, - this._ranges) { - var h = this._ranges[l]; - h && (n._ranges[l] = h.clone()) - } - return this._isDirty = true, - n - } - , - e.prototype.enableBlending = function(e) { - void 0 === e && (e = .01), - this.bones.forEach(function(t) { - t.animations.forEach(function(t) { - t.enableBlending = true, - t.blendingSpeed = e - }) - }) - } - , - e.prototype.dispose = function() { - this._meshesWithPoseMatrix = [], + return (this._isDirty = true), n; + }), + (e.prototype.enableBlending = function (e) { + void 0 === e && (e = 0.01), + this.bones.forEach(function (t) { + t.animations.forEach(function (t) { + (t.enableBlending = true), (t.blendingSpeed = e); + }); + }); + }), + (e.prototype.dispose = function () { + (this._meshesWithPoseMatrix = []), this.getScene().stopAnimation(this), this.getScene().removeSkeleton(this), - this._transformMatrixTexture && (this._transformMatrixTexture.dispose(), - this._transformMatrixTexture = null) - } - , - e.prototype.serialize = function() { - var e = {}; - e.name = this.name, - e.id = this.id, - this.dimensionsAtRest && (e.dimensionsAtRest = this.dimensionsAtRest.asArray()), - e.bones = [], - e.needInitialSkinMatrix = this.needInitialSkinMatrix; - for (var t = 0; t < this.bones.length; t++) { - var i = this.bones[t] - , n = i.getParent() - , r = { - parentBoneIndex: n ? this.bones.indexOf(n) : -1, - name: i.name, - matrix: i.getBaseMatrix().toArray(), - rest: i.getRestPose().toArray() - }; - for (var o in e.bones.push(r), - i.length && (r.length = i.length), - i.metadata && (r.metadata = i.metadata), - i.animations && i.animations.length > 0 && (r.animation = i.animations[0].serialize()), - e.ranges = [], - this._ranges) { - var a = this._ranges[o]; - if (a) { - var s = {}; - s.name = o, - s.from = a.from, - s.to = a.to, - e.ranges.push(s) - } - } - } - return e - } - , - e.Parse = function(t, i) { - var n, r = new e(t.name,t.id,i); - for (t.dimensionsAtRest && (r.dimensionsAtRest = a.x.FromArray(t.dimensionsAtRest)), - r.needInitialSkinMatrix = t.needInitialSkinMatrix, - n = 0; n < t.bones.length; n++) { - var o = t.bones[n] - , s = null; - o.parentBoneIndex > -1 && (s = r.bones[o.parentBoneIndex]); - var c = o.rest ? a.j.FromArray(o.rest) : null - , u = new q(o.name,r,s,a.j.FromArray(o.matrix),c); - void 0 !== o.id && null !== o.id && (u.id = o.id), - o.length && (u.length = o.length), - o.metadata && (u.metadata = o.metadata), - o.animation && u.animations.push(U.Parse(o.animation)), - void 0 !== o.linkedTransformNodeId && null !== o.linkedTransformNodeId && (r._hasWaitingData = true, - u._waitingTransformNodeId = o.linkedTransformNodeId) - } - if (t.ranges) - for (n = 0; n < t.ranges.length; n++) { - var l = t.ranges[n]; - r.createAnimationRange(l.name, l.from, l.to) - } - return r - } - , - e.prototype.computeAbsoluteTransforms = function(e) { - void 0 === e && (e = false); - var t = this._scene.getRenderId(); - (this._lastAbsoluteTransformsUpdateId != t || e) && (this.bones[0].computeAbsoluteTransforms(), - this._lastAbsoluteTransformsUpdateId = t) - } - , - e.prototype.getPoseMatrix = function() { - var e = null; - return this._meshesWithPoseMatrix.length > 0 && (e = this._meshesWithPoseMatrix[0].getPoseMatrix()), - e - } - , - e.prototype.sortBones = function() { - for (var e = new Array, t = new Array(this.bones.length), i = 0; i < this.bones.length; i++) - this._sortBones(i, e, t); - this.bones = e - } - , - e.prototype._sortBones = function(e, t, i) { - if (!i[e]) { - i[e] = true; - var n = this.bones[e]; - void 0 === n._index && (n._index = e); - var r = n.getParent(); - r && this._sortBones(this.bones.indexOf(r), t, i), - t.push(n) - } - } - , - e - }() - , Ye = {} - , Ke = function() { - function e(e) { - this.attached = {}, - this.camera = e, - this.checkInputs = function() {} - } - return e.prototype.add = function(e) { - var t = e.getSimpleName(); - this.attached[t] ? g.a.Warn("camera input of type " + t + " already exists on camera") : (this.attached[t] = e, - e.camera = this.camera, - e.checkInputs && (this.checkInputs = this._addCheckInputs(e.checkInputs.bind(e))), - this.attachedElement && e.attachControl(this.attachedElement)) - } - , - e.prototype.remove = function(e) { - for (var t in this.attached) { - var i = this.attached[t]; - i === e && (i.detachControl(this.attachedElement), - i.camera = null, - delete this.attached[t], - this.rebuildInputCheck()) - } - } - , - e.prototype.removeByType = function(e) { - for (var t in this.attached) { - var i = this.attached[t]; - i.getClassName() === e && (i.detachControl(this.attachedElement), - i.camera = null, - delete this.attached[t], - this.rebuildInputCheck()) - } - } - , - e.prototype._addCheckInputs = function(e) { - var t = this.checkInputs; - return function() { - t(), - e() - } - } - , - e.prototype.attachInput = function(e) { - this.attachedElement && e.attachControl(this.attachedElement, this.noPreventDefault) - } - , - e.prototype.attachElement = function(e, t) { - if (void 0 === t && (t = false), - !this.attachedElement) - for (var i in t = !ke.a.ForceAttachControlToAlwaysPreventDefault && t, - this.attachedElement = e, - this.noPreventDefault = t, - this.attached) - this.attached[i].attachControl(e, t) - } - , - e.prototype.detachElement = function(e, t) { - if (void 0 === t && (t = false), - this.attachedElement === e) { - for (var i in this.attached) - this.attached[i].detachControl(e), - t && (this.attached[i].camera = null); - this.attachedElement = null - } - } - , - e.prototype.rebuildInputCheck = function() { - for (var e in this.checkInputs = function() {} - , - this.attached) { - var t = this.attached[e]; - t.checkInputs && (this.checkInputs = this._addCheckInputs(t.checkInputs.bind(t))) - } - } - , - e.prototype.clear = function() { - this.attachedElement && this.detachElement(this.attachedElement, true), - this.attached = {}, - this.attachedElement = null, - this.checkInputs = function() {} - } - , - e.prototype.serialize = function(e) { - var t = {}; - for (var i in this.attached) { - var n = this.attached[i] - , r = F.a.Serialize(n); - t[n.getClassName()] = r - } - e.inputsmgr = t - } - , - e.prototype.parse = function(e) { - var t = e.inputsmgr; - if (t) { - for (var i in this.clear(), - t) - if (o = Ye[i]) { - var n = t[i] - , r = F.a.Parse(function() { - return new o - }, n, null); - this.add(r) - } - } else - for (var i in this.attached) { - var o; - (o = Ye[this.attached[i].getClassName()]) && (r = F.a.Parse(function() { - return new o - }, e, null), - this.remove(this.attached[i]), - this.add(r)) - } - } - , - e - }() - , Qe = function(e, t) { - this.x = e, - this.y = t - } - , qe = function() { - function e(t, i, n, r, o, a, s) { - void 0 === r && (r = 0), - void 0 === o && (o = 1), - void 0 === a && (a = 2), - void 0 === s && (s = 3), - this.id = t, - this.index = i, - this.browserGamepad = n, - this._leftStick = { - x: 0, - y: 0 - }, - this._rightStick = { - x: 0, - y: 0 - }, - this._isConnected = true, - this._invertLeftStickY = false, - this.type = e.GAMEPAD, - this._leftStickAxisX = r, - this._leftStickAxisY = o, - this._rightStickAxisX = a, - this._rightStickAxisY = s, - this.browserGamepad.axes.length >= 2 && (this._leftStick = { - x: this.browserGamepad.axes[this._leftStickAxisX], - y: this.browserGamepad.axes[this._leftStickAxisY] - }), - this.browserGamepad.axes.length >= 4 && (this._rightStick = { - x: this.browserGamepad.axes[this._rightStickAxisX], - y: this.browserGamepad.axes[this._rightStickAxisY] - }) - } - return Object.defineProperty(e.prototype, "isConnected", { - get: function() { - return this._isConnected - }, - enumerable: true, - configurable: true + this._transformMatrixTexture && + (this._transformMatrixTexture.dispose(), + (this._transformMatrixTexture = null)); + }), + (e.prototype.serialize = function () { + var e = {}; + (e.name = this.name), + (e.id = this.id), + this.dimensionsAtRest && + (e.dimensionsAtRest = + this.dimensionsAtRest.asArray()), + (e.bones = []), + (e.needInitialSkinMatrix = this.needInitialSkinMatrix); + for (var t = 0; t < this.bones.length; t++) { + var i = this.bones[t], + n = i.getParent(), + r = { + parentBoneIndex: n ? this.bones.indexOf(n) : -1, + name: i.name, + matrix: i.getBaseMatrix().toArray(), + rest: i.getRestPose().toArray(), + }; + for (var o in (e.bones.push(r), + i.length && (r.length = i.length), + i.metadata && (r.metadata = i.metadata), + i.animations && + i.animations.length > 0 && + (r.animation = i.animations[0].serialize()), + (e.ranges = []), + this._ranges)) { + var a = this._ranges[o]; + if (a) { + var s = {}; + (s.name = o), + (s.from = a.from), + (s.to = a.to), + e.ranges.push(s); + } + } + } + return e; + }), + (e.Parse = function (t, i) { + var n, + r = new e(t.name, t.id, i); + for ( + t.dimensionsAtRest && + (r.dimensionsAtRest = a.x.FromArray( + t.dimensionsAtRest + )), + r.needInitialSkinMatrix = t.needInitialSkinMatrix, + n = 0; + n < t.bones.length; + n++ + ) { + var o = t.bones[n], + s = null; + o.parentBoneIndex > -1 && + (s = r.bones[o.parentBoneIndex]); + var c = o.rest ? a.j.FromArray(o.rest) : null, + u = new q(o.name, r, s, a.j.FromArray(o.matrix), c); + void 0 !== o.id && null !== o.id && (u.id = o.id), + o.length && (u.length = o.length), + o.metadata && (u.metadata = o.metadata), + o.animation && + u.animations.push(U.Parse(o.animation)), + void 0 !== o.linkedTransformNodeId && + null !== o.linkedTransformNodeId && + ((r._hasWaitingData = true), + (u._waitingTransformNodeId = + o.linkedTransformNodeId)); + } + if (t.ranges) + for (n = 0; n < t.ranges.length; n++) { + var l = t.ranges[n]; + r.createAnimationRange(l.name, l.from, l.to); + } + return r; + }), + (e.prototype.computeAbsoluteTransforms = function (e) { + void 0 === e && (e = false); + var t = this._scene.getRenderId(); + (this._lastAbsoluteTransformsUpdateId != t || e) && + (this.bones[0].computeAbsoluteTransforms(), + (this._lastAbsoluteTransformsUpdateId = t)); + }), + (e.prototype.getPoseMatrix = function () { + var e = null; + return ( + this._meshesWithPoseMatrix.length > 0 && + (e = this._meshesWithPoseMatrix[0].getPoseMatrix()), + e + ); + }), + (e.prototype.sortBones = function () { + for ( + var e = new Array(), + t = new Array(this.bones.length), + i = 0; + i < this.bones.length; + i++ + ) + this._sortBones(i, e, t); + this.bones = e; + }), + (e.prototype._sortBones = function (e, t, i) { + if (!i[e]) { + i[e] = true; + var n = this.bones[e]; + void 0 === n._index && (n._index = e); + var r = n.getParent(); + r && this._sortBones(this.bones.indexOf(r), t, i), + t.push(n); + } + }), + e + ); + })(), + Ye = {}, + Ke = (function () { + function e(e) { + (this.attached = {}), + (this.camera = e), + (this.checkInputs = function () {}); + } + return ( + (e.prototype.add = function (e) { + var t = e.getSimpleName(); + this.attached[t] + ? g.a.Warn( + "camera input of type " + + t + + " already exists on camera" + ) + : ((this.attached[t] = e), + (e.camera = this.camera), + e.checkInputs && + (this.checkInputs = this._addCheckInputs( + e.checkInputs.bind(e) + )), + this.attachedElement && + e.attachControl(this.attachedElement)); + }), + (e.prototype.remove = function (e) { + for (var t in this.attached) { + var i = this.attached[t]; + i === e && + (i.detachControl(this.attachedElement), + (i.camera = null), + delete this.attached[t], + this.rebuildInputCheck()); + } + }), + (e.prototype.removeByType = function (e) { + for (var t in this.attached) { + var i = this.attached[t]; + i.getClassName() === e && + (i.detachControl(this.attachedElement), + (i.camera = null), + delete this.attached[t], + this.rebuildInputCheck()); + } + }), + (e.prototype._addCheckInputs = function (e) { + var t = this.checkInputs; + return function () { + t(), e(); + }; + }), + (e.prototype.attachInput = function (e) { + this.attachedElement && + e.attachControl( + this.attachedElement, + this.noPreventDefault + ); + }), + (e.prototype.attachElement = function (e, t) { + if ((void 0 === t && (t = false), !this.attachedElement)) + for (var i in ((t = + !ke.a.ForceAttachControlToAlwaysPreventDefault && t), + (this.attachedElement = e), + (this.noPreventDefault = t), + this.attached)) + this.attached[i].attachControl(e, t); + }), + (e.prototype.detachElement = function (e, t) { + if ( + (void 0 === t && (t = false), + this.attachedElement === e) + ) { + for (var i in this.attached) + this.attached[i].detachControl(e), + t && (this.attached[i].camera = null); + this.attachedElement = null; + } + }), + (e.prototype.rebuildInputCheck = function () { + for (var e in ((this.checkInputs = function () {}), + this.attached)) { + var t = this.attached[e]; + t.checkInputs && + (this.checkInputs = this._addCheckInputs( + t.checkInputs.bind(t) + )); + } + }), + (e.prototype.clear = function () { + this.attachedElement && + this.detachElement(this.attachedElement, true), + (this.attached = {}), + (this.attachedElement = null), + (this.checkInputs = function () {}); + }), + (e.prototype.serialize = function (e) { + var t = {}; + for (var i in this.attached) { + var n = this.attached[i], + r = F.a.Serialize(n); + t[n.getClassName()] = r; + } + e.inputsmgr = t; + }), + (e.prototype.parse = function (e) { + var t = e.inputsmgr; + if (t) { + for (var i in (this.clear(), t)) + if ((o = Ye[i])) { + var n = t[i], + r = F.a.Parse( + function () { + return new o(); + }, + n, + null + ); + this.add(r); + } + } else + for (var i in this.attached) { + var o; + (o = Ye[this.attached[i].getClassName()]) && + ((r = F.a.Parse( + function () { + return new o(); + }, + e, + null + )), + this.remove(this.attached[i]), + this.add(r)); + } + }), + e + ); + })(), + Qe = function (e, t) { + (this.x = e), (this.y = t); + }, + qe = (function () { + function e(t, i, n, r, o, a, s) { + void 0 === r && (r = 0), + void 0 === o && (o = 1), + void 0 === a && (a = 2), + void 0 === s && (s = 3), + (this.id = t), + (this.index = i), + (this.browserGamepad = n), + (this._leftStick = { + x: 0, + y: 0, + }), + (this._rightStick = { + x: 0, + y: 0, + }), + (this._isConnected = true), + (this._invertLeftStickY = false), + (this.type = e.GAMEPAD), + (this._leftStickAxisX = r), + (this._leftStickAxisY = o), + (this._rightStickAxisX = a), + (this._rightStickAxisY = s), + this.browserGamepad.axes.length >= 2 && + (this._leftStick = { + x: this.browserGamepad.axes[this._leftStickAxisX], + y: this.browserGamepad.axes[this._leftStickAxisY], + }), + this.browserGamepad.axes.length >= 4 && + (this._rightStick = { + x: this.browserGamepad.axes[this._rightStickAxisX], + y: this.browserGamepad.axes[this._rightStickAxisY], + }); + } + return ( + Object.defineProperty(e.prototype, "isConnected", { + get: function () { + return this._isConnected; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.onleftstickchanged = function (e) { + this._onleftstickchanged = e; + }), + (e.prototype.onrightstickchanged = function (e) { + this._onrightstickchanged = e; }), - e.prototype.onleftstickchanged = function(e) { - this._onleftstickchanged = e - } - , - e.prototype.onrightstickchanged = function(e) { - this._onrightstickchanged = e - } - , Object.defineProperty(e.prototype, "leftStick", { - get: function() { - return this._leftStick - }, - set: function(e) { - !this._onleftstickchanged || this._leftStick.x === e.x && this._leftStick.y === e.y || this._onleftstickchanged(e), - this._leftStick = e - }, - enumerable: true, - configurable: true + get: function () { + return this._leftStick; + }, + set: function (e) { + !this._onleftstickchanged || + (this._leftStick.x === e.x && + this._leftStick.y === e.y) || + this._onleftstickchanged(e), + (this._leftStick = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "rightStick", { - get: function() { - return this._rightStick - }, - set: function(e) { - !this._onrightstickchanged || this._rightStick.x === e.x && this._rightStick.y === e.y || this._onrightstickchanged(e), - this._rightStick = e - }, - enumerable: true, - configurable: true + get: function () { + return this._rightStick; + }, + set: function (e) { + !this._onrightstickchanged || + (this._rightStick.x === e.x && + this._rightStick.y === e.y) || + this._onrightstickchanged(e), + (this._rightStick = e); + }, + enumerable: true, + configurable: true, }), - e.prototype.update = function() { - this._leftStick && (this.leftStick = { - x: this.browserGamepad.axes[this._leftStickAxisX], - y: this.browserGamepad.axes[this._leftStickAxisY] - }, + (e.prototype.update = function () { + this._leftStick && + ((this.leftStick = { + x: this.browserGamepad.axes[this._leftStickAxisX], + y: this.browserGamepad.axes[this._leftStickAxisY], + }), this._invertLeftStickY && (this.leftStick.y *= -1)), - this._rightStick && (this.rightStick = { + this._rightStick && + (this.rightStick = { x: this.browserGamepad.axes[this._rightStickAxisX], - y: this.browserGamepad.axes[this._rightStickAxisY] - }) - } - , - e.prototype.dispose = function() {} - , - e.GAMEPAD = 0, - e.GENERIC = 1, - e.XBOX = 2, - e.POSE_ENABLED = 3, + y: this.browserGamepad.axes[this._rightStickAxisY], + }); + }), + (e.prototype.dispose = function () {}), + (e.GAMEPAD = 0), + (e.GENERIC = 1), + (e.XBOX = 2), + (e.POSE_ENABLED = 3), e - }() - , Ze = function(e) { - function t(t, i, n) { - var r = e.call(this, t, i, n) || this; - return r.onButtonDownObservable = new o.c, - r.onButtonUpObservable = new o.c, - r.type = qe.GENERIC, - r._buttons = new Array(n.buttons.length), - r - } - return h.d(t, e), - t.prototype.onbuttondown = function(e) { - this._onbuttondown = e - } - , - t.prototype.onbuttonup = function(e) { - this._onbuttonup = e - } - , - t.prototype._setButtonValue = function(e, t, i) { - return e !== t && (1 === e && (this._onbuttondown && this._onbuttondown(i), - this.onButtonDownObservable.notifyObservers(i)), - 0 === e && (this._onbuttonup && this._onbuttonup(i), - this.onButtonUpObservable.notifyObservers(i))), + ); + })(), + Ze = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, i, n) || this; + return ( + (r.onButtonDownObservable = new o.c()), + (r.onButtonUpObservable = new o.c()), + (r.type = qe.GENERIC), + (r._buttons = new Array(n.buttons.length)), + r + ); + } + return ( + h.d(t, e), + (t.prototype.onbuttondown = function (e) { + this._onbuttondown = e; + }), + (t.prototype.onbuttonup = function (e) { + this._onbuttonup = e; + }), + (t.prototype._setButtonValue = function (e, t, i) { + return ( + e !== t && + (1 === e && + (this._onbuttondown && this._onbuttondown(i), + this.onButtonDownObservable.notifyObservers(i)), + 0 === e && + (this._onbuttonup && this._onbuttonup(i), + this.onButtonUpObservable.notifyObservers(i))), e - } - , - t.prototype.update = function() { - e.prototype.update.call(this); - for (var t = 0; t < this._buttons.length; t++) - this._buttons[t] = this._setButtonValue(this.browserGamepad.buttons[t].value, this._buttons[t], t) - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), + ); + }), + (t.prototype.update = function () { + e.prototype.update.call(this); + for (var t = 0; t < this._buttons.length; t++) + this._buttons[t] = this._setButtonValue( + this.browserGamepad.buttons[t].value, + this._buttons[t], + t + ); + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), this.onButtonDownObservable.clear(), - this.onButtonUpObservable.clear() - } - , + this.onButtonUpObservable.clear(); + }), t - }(qe) - , Je = function() { - function e() { - this.gamepadRotationSensibility = 80, - this.gamepadMoveSensibility = 40 - } - return e.prototype.attachControl = function(e, t) { - var i = this - , n = this.camera.getScene().gamepadManager; - this._onGamepadConnectedObserver = n.onGamepadConnectedObservable.add(function(e) { - e.type !== qe.POSE_ENABLED && (i.gamepad && e.type !== qe.XBOX || (i.gamepad = e)) - }), - this._onGamepadDisconnectedObserver = n.onGamepadDisconnectedObservable.add(function(e) { - i.gamepad === e && (i.gamepad = null) - }), - this.gamepad = n.getGamepadByType(qe.XBOX) - } - , - e.prototype.detachControl = function(e) { - this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver), - this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver), - this.gamepad = null - } - , - e.prototype.checkInputs = function() { - if (this.gamepad) { - var e = this.camera - , t = this.gamepad.rightStick; - if (t) { - if (0 != t.x) { - var i = t.x / this.gamepadRotationSensibility; - 0 != i && Math.abs(i) > .005 && (e.inertialAlphaOffset += i) - } - if (0 != t.y) { - var n = t.y / this.gamepadRotationSensibility; - 0 != n && Math.abs(n) > .005 && (e.inertialBetaOffset += n) - } - } - var r = this.gamepad.leftStick; - if (r && 0 != r.y) { - var o = r.y / this.gamepadMoveSensibility; - 0 != o && Math.abs(o) > .005 && (this.camera.inertialRadiusOffset -= o) - } + ); + })(qe), + Je = (function () { + function e() { + (this.gamepadRotationSensibility = 80), + (this.gamepadMoveSensibility = 40); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this, + n = this.camera.getScene().gamepadManager; + (this._onGamepadConnectedObserver = + n.onGamepadConnectedObservable.add(function (e) { + e.type !== qe.POSE_ENABLED && + ((i.gamepad && e.type !== qe.XBOX) || + (i.gamepad = e)); + })), + (this._onGamepadDisconnectedObserver = + n.onGamepadDisconnectedObservable.add(function (e) { + i.gamepad === e && (i.gamepad = null); + })), + (this.gamepad = n.getGamepadByType(qe.XBOX)); + }), + (e.prototype.detachControl = function (e) { + this.camera + .getScene() + .gamepadManager.onGamepadConnectedObservable.remove( + this._onGamepadConnectedObserver + ), + this.camera + .getScene() + .gamepadManager.onGamepadDisconnectedObservable.remove( + this._onGamepadDisconnectedObserver + ), + (this.gamepad = null); + }), + (e.prototype.checkInputs = function () { + if (this.gamepad) { + var e = this.camera, + t = this.gamepad.rightStick; + if (t) { + if (0 != t.x) { + var i = t.x / this.gamepadRotationSensibility; + 0 != i && + Math.abs(i) > 0.005 && + (e.inertialAlphaOffset += i); + } + if (0 != t.y) { + var n = t.y / this.gamepadRotationSensibility; + 0 != n && + Math.abs(n) > 0.005 && + (e.inertialBetaOffset += n); + } } - } - , - e.prototype.getClassName = function() { - return "ArcRotateCameraGamepadInput" - } - , - e.prototype.getSimpleName = function() { - return "gamepad" - } - , - h.c([Object(F.c)()], e.prototype, "gamepadRotationSensibility", void 0), - h.c([Object(F.c)()], e.prototype, "gamepadMoveSensibility", void 0), + var r = this.gamepad.leftStick; + if (r && 0 != r.y) { + var o = r.y / this.gamepadMoveSensibility; + 0 != o && + Math.abs(o) > 0.005 && + (this.camera.inertialRadiusOffset -= o); + } + } + }), + (e.prototype.getClassName = function () { + return "ArcRotateCameraGamepadInput"; + }), + (e.prototype.getSimpleName = function () { + return "gamepad"; + }), + h.c( + [Object(F.c)()], + e.prototype, + "gamepadRotationSensibility", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "gamepadMoveSensibility", + void 0 + ), e - }(); - Ye.ArcRotateCameraGamepadInput = Je; - var $e = n(51) - , et = function() { - function e() { - this.keysUp = [38], - this.keysDown = [40], - this.keysLeft = [37], - this.keysRight = [39], - this.keysReset = [220], - this.panningSensibility = 50, - this.zoomingSensibility = 25, - this.useAltToZoom = true, - this.angularSpeed = .01, - this._keys = new Array - } - return e.prototype.attachControl = function(e, t) { - var i = this; - this._onCanvasBlurObserver || (this._scene = this.camera.getScene(), - this._engine = this._scene.getEngine(), - this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function() { - i._keys = [] - }), - this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function(e) { - var n, r = e.event; - r.metaKey || (e.type === $e.a.KEYDOWN ? (i._ctrlPressed = r.ctrlKey, - i._altPressed = r.altKey, - (-1 !== i.keysUp.indexOf(r.keyCode) || -1 !== i.keysDown.indexOf(r.keyCode) || -1 !== i.keysLeft.indexOf(r.keyCode) || -1 !== i.keysRight.indexOf(r.keyCode) || -1 !== i.keysReset.indexOf(r.keyCode)) && (-1 === (n = i._keys.indexOf(r.keyCode)) && i._keys.push(r.keyCode), - r.preventDefault && (t || r.preventDefault()))) : -1 === i.keysUp.indexOf(r.keyCode) && -1 === i.keysDown.indexOf(r.keyCode) && -1 === i.keysLeft.indexOf(r.keyCode) && -1 === i.keysRight.indexOf(r.keyCode) && -1 === i.keysReset.indexOf(r.keyCode) || ((n = i._keys.indexOf(r.keyCode)) >= 0 && i._keys.splice(n, 1), - r.preventDefault && (t || r.preventDefault()))) - })) - } - , - e.prototype.detachControl = function(e) { - this._scene && (this._onKeyboardObserver && this._scene.onKeyboardObservable.remove(this._onKeyboardObserver), - this._onCanvasBlurObserver && this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), - this._onKeyboardObserver = null, - this._onCanvasBlurObserver = null), - this._keys = [] - } - , - e.prototype.checkInputs = function() { - if (this._onKeyboardObserver) - for (var e = this.camera, t = 0; t < this._keys.length; t++) { - var i = this._keys[t]; - -1 !== this.keysLeft.indexOf(i) ? this._ctrlPressed && this.camera._useCtrlForPanning ? e.inertialPanningX -= 1 / this.panningSensibility : e.inertialAlphaOffset -= this.angularSpeed : -1 !== this.keysUp.indexOf(i) ? this._ctrlPressed && this.camera._useCtrlForPanning ? e.inertialPanningY += 1 / this.panningSensibility : this._altPressed && this.useAltToZoom ? e.inertialRadiusOffset += 1 / this.zoomingSensibility : e.inertialBetaOffset -= this.angularSpeed : -1 !== this.keysRight.indexOf(i) ? this._ctrlPressed && this.camera._useCtrlForPanning ? e.inertialPanningX += 1 / this.panningSensibility : e.inertialAlphaOffset += this.angularSpeed : -1 !== this.keysDown.indexOf(i) ? this._ctrlPressed && this.camera._useCtrlForPanning ? e.inertialPanningY -= 1 / this.panningSensibility : this._altPressed && this.useAltToZoom ? e.inertialRadiusOffset -= 1 / this.zoomingSensibility : e.inertialBetaOffset += this.angularSpeed : -1 !== this.keysReset.indexOf(i) && e.useInputToRestoreState && e.restoreState() - } - } - , - e.prototype.getClassName = function() { - return "ArcRotateCameraKeyboardMoveInput" - } - , - e.prototype.getSimpleName = function() { - return "keyboard" - } - , + ); + })(); + Ye.ArcRotateCameraGamepadInput = Je; + var $e = n(51), + et = (function () { + function e() { + (this.keysUp = [38]), + (this.keysDown = [40]), + (this.keysLeft = [37]), + (this.keysRight = [39]), + (this.keysReset = [220]), + (this.panningSensibility = 50), + (this.zoomingSensibility = 25), + (this.useAltToZoom = true), + (this.angularSpeed = 0.01), + (this._keys = new Array()); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this; + this._onCanvasBlurObserver || + ((this._scene = this.camera.getScene()), + (this._engine = this._scene.getEngine()), + (this._onCanvasBlurObserver = + this._engine.onCanvasBlurObservable.add(function () { + i._keys = []; + })), + (this._onKeyboardObserver = + this._scene.onKeyboardObservable.add(function (e) { + var n, + r = e.event; + r.metaKey || + (e.type === $e.a.KEYDOWN + ? ((i._ctrlPressed = r.ctrlKey), + (i._altPressed = r.altKey), + (-1 !== i.keysUp.indexOf(r.keyCode) || + -1 !== i.keysDown.indexOf(r.keyCode) || + -1 !== i.keysLeft.indexOf(r.keyCode) || + -1 !== i.keysRight.indexOf(r.keyCode) || + -1 !== i.keysReset.indexOf(r.keyCode)) && + (-1 === (n = i._keys.indexOf(r.keyCode)) && + i._keys.push(r.keyCode), + r.preventDefault && + (t || r.preventDefault()))) + : (-1 === i.keysUp.indexOf(r.keyCode) && + -1 === i.keysDown.indexOf(r.keyCode) && + -1 === i.keysLeft.indexOf(r.keyCode) && + -1 === i.keysRight.indexOf(r.keyCode) && + -1 === i.keysReset.indexOf(r.keyCode)) || + ((n = i._keys.indexOf(r.keyCode)) >= 0 && + i._keys.splice(n, 1), + r.preventDefault && + (t || r.preventDefault()))); + }))); + }), + (e.prototype.detachControl = function (e) { + this._scene && + (this._onKeyboardObserver && + this._scene.onKeyboardObservable.remove( + this._onKeyboardObserver + ), + this._onCanvasBlurObserver && + this._engine.onCanvasBlurObservable.remove( + this._onCanvasBlurObserver + ), + (this._onKeyboardObserver = null), + (this._onCanvasBlurObserver = null)), + (this._keys = []); + }), + (e.prototype.checkInputs = function () { + if (this._onKeyboardObserver) + for ( + var e = this.camera, t = 0; + t < this._keys.length; + t++ + ) { + var i = this._keys[t]; + -1 !== this.keysLeft.indexOf(i) + ? this._ctrlPressed && + this.camera._useCtrlForPanning + ? (e.inertialPanningX -= + 1 / this.panningSensibility) + : (e.inertialAlphaOffset -= this.angularSpeed) + : -1 !== this.keysUp.indexOf(i) + ? this._ctrlPressed && + this.camera._useCtrlForPanning + ? (e.inertialPanningY += + 1 / this.panningSensibility) + : this._altPressed && this.useAltToZoom + ? (e.inertialRadiusOffset += + 1 / this.zoomingSensibility) + : (e.inertialBetaOffset -= this.angularSpeed) + : -1 !== this.keysRight.indexOf(i) + ? this._ctrlPressed && + this.camera._useCtrlForPanning + ? (e.inertialPanningX += + 1 / this.panningSensibility) + : (e.inertialAlphaOffset += this.angularSpeed) + : -1 !== this.keysDown.indexOf(i) + ? this._ctrlPressed && + this.camera._useCtrlForPanning + ? (e.inertialPanningY -= + 1 / this.panningSensibility) + : this._altPressed && this.useAltToZoom + ? (e.inertialRadiusOffset -= + 1 / this.zoomingSensibility) + : (e.inertialBetaOffset += this.angularSpeed) + : -1 !== this.keysReset.indexOf(i) && + e.useInputToRestoreState && + e.restoreState(); + } + }), + (e.prototype.getClassName = function () { + return "ArcRotateCameraKeyboardMoveInput"; + }), + (e.prototype.getSimpleName = function () { + return "keyboard"; + }), h.c([Object(F.c)()], e.prototype, "keysUp", void 0), h.c([Object(F.c)()], e.prototype, "keysDown", void 0), h.c([Object(F.c)()], e.prototype, "keysLeft", void 0), h.c([Object(F.c)()], e.prototype, "keysRight", void 0), h.c([Object(F.c)()], e.prototype, "keysReset", void 0), - h.c([Object(F.c)()], e.prototype, "panningSensibility", void 0), - h.c([Object(F.c)()], e.prototype, "zoomingSensibility", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "panningSensibility", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "zoomingSensibility", + void 0 + ), h.c([Object(F.c)()], e.prototype, "useAltToZoom", void 0), h.c([Object(F.c)()], e.prototype, "angularSpeed", void 0), e - }(); - Ye.ArcRotateCameraKeyboardMoveInput = et; - var tt = function() { - function e() { - this.wheelPrecision = 3, - this.wheelDeltaPercentage = 0 - } - return e.prototype.computeDeltaFromMouseWheelLegacyEvent = function(e, t) { - var i = .01 * e.wheelDelta * this.wheelDeltaPercentage * t; - return e.wheelDelta > 0 ? i / (1 + this.wheelDeltaPercentage) : i * (1 + this.wheelDeltaPercentage) - } - , - e.prototype.attachControl = function(e, t) { - var i = this; - this._wheel = function(e, n) { - if (e.type === Re.a.POINTERWHEEL) { - var r = e.event - , o = 0 - , a = r; - if (a.wheelDelta) - if (i.wheelDeltaPercentage) { - if ((o = i.computeDeltaFromMouseWheelLegacyEvent(a, i.camera.radius)) > 0) { - for (var s = i.camera.radius, c = i.camera.inertialRadiusOffset + o, u = 0; u < 20 && Math.abs(c) > .001; u++) - s -= c, - c *= i.camera.inertia; - s = L.a.Clamp(s, 0, Number.MAX_VALUE), - o = i.computeDeltaFromMouseWheelLegacyEvent(a, s) - } - } else - o = a.wheelDelta / (40 * i.wheelPrecision); - else - o = -(r.deltaY || r.detail) / i.wheelPrecision; - o && (i.camera.inertialRadiusOffset += o), - r.preventDefault && (t || r.preventDefault()) - } - } - , - this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, Re.a.POINTERWHEEL) - } - , - e.prototype.detachControl = function(e) { - this._observer && e && (this.camera.getScene().onPointerObservable.remove(this._observer), - this._observer = null, - this._wheel = null) - } - , - e.prototype.getClassName = function() { - return "ArcRotateCameraMouseWheelInput" - } - , - e.prototype.getSimpleName = function() { - return "mousewheel" - } - , - h.c([Object(F.c)()], e.prototype, "wheelPrecision", void 0), - h.c([Object(F.c)()], e.prototype, "wheelDeltaPercentage", void 0), - e - }(); - Ye.ArcRotateCameraMouseWheelInput = tt; - var it = function() { - function e() { - this.buttons = [0, 1, 2] - } - return e.prototype.attachControl = function(e, t) { - var i = this - , n = this.camera.getEngine() - , r = 0 - , o = null; - this.pointA = null, - this.pointB = null, - this._altKey = false, - this._ctrlKey = false, - this._metaKey = false, - this._shiftKey = false, - this._buttonsPressed = 0, - this._pointerInput = function(a, s) { - var c = a.event - , u = "touch" === c.pointerType; - if (!n.isInVRExclusivePointerMode && (a.type === Re.a.POINTERMOVE || -1 !== i.buttons.indexOf(c.button))) { - var l = c.srcElement || c.target; - if (i._altKey = c.altKey, - i._ctrlKey = c.ctrlKey, - i._metaKey = c.metaKey, - i._shiftKey = c.shiftKey, - i._buttonsPressed = c.buttons, - n.isPointerLock) { - var h = c.movementX || c.mozMovementX || c.webkitMovementX || c.msMovementX || 0 - , f = c.movementY || c.mozMovementY || c.webkitMovementY || c.msMovementY || 0; - i.onTouch(null, h, f), - i.pointA = null, - i.pointB = null - } else if (a.type === Re.a.POINTERDOWN && l) { - try { - l.setPointerCapture(c.pointerId) - } catch (e) {} - null === i.pointA ? i.pointA = { - x: c.clientX, - y: c.clientY, - pointerId: c.pointerId, - type: c.pointerType - } : null === i.pointB && (i.pointB = { - x: c.clientX, - y: c.clientY, - pointerId: c.pointerId, - type: c.pointerType - }), - i.onButtonDown(c), - t || (c.preventDefault(), - e.focus()) - } else if (a.type === Re.a.POINTERDOUBLETAP) - i.onDoubleTap(c.pointerType); - else if (a.type === Re.a.POINTERUP && l) { - try { - l.releasePointerCapture(c.pointerId) - } catch (e) {} - u || (i.pointB = null), - n._badOS ? i.pointA = i.pointB = null : i.pointB && i.pointA && i.pointA.pointerId == c.pointerId ? (i.pointA = i.pointB, - i.pointB = null) : i.pointA && i.pointB && i.pointB.pointerId == c.pointerId ? i.pointB = null : i.pointA = i.pointB = null, - (0 !== r || o) && (i.onMultiTouch(i.pointA, i.pointB, r, 0, o, null), - r = 0, - o = null), - i.onButtonUp(c), - t || c.preventDefault() - } else if (a.type === Re.a.POINTERMOVE) - if (t || c.preventDefault(), - i.pointA && null === i.pointB) - h = c.clientX - i.pointA.x, - f = c.clientY - i.pointA.y, - i.onTouch(i.pointA, h, f), - i.pointA.x = c.clientX, - i.pointA.y = c.clientY; - else if (i.pointA && i.pointB) { - var d = i.pointA.pointerId === c.pointerId ? i.pointA : i.pointB; - d.x = c.clientX, - d.y = c.clientY; - var p = i.pointA.x - i.pointB.x - , m = i.pointA.y - i.pointB.y - , g = p * p + m * m - , _ = { - x: (i.pointA.x + i.pointB.x) / 2, - y: (i.pointA.y + i.pointB.y) / 2, - pointerId: c.pointerId, - type: a.type - }; - i.onMultiTouch(i.pointA, i.pointB, r, g, o, _), - o = _, - r = g - } - } - } - , - this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, Re.a.POINTERDOWN | Re.a.POINTERUP | Re.a.POINTERMOVE), - this._onLostFocus = function() { - i.pointA = i.pointB = null, - r = 0, - o = null, - i.onLostFocus() - } - , - e.addEventListener("contextmenu", this.onContextMenu.bind(this), false), - Ee.h.RegisterTopRootEvents([{ - name: "blur", - handler: this._onLostFocus - }]) - } - , - e.prototype.detachControl = function(e) { - this._onLostFocus && Ee.h.UnregisterTopRootEvents([{ - name: "blur", - handler: this._onLostFocus - }]), - e && this._observer && (this.camera.getScene().onPointerObservable.remove(this._observer), - this._observer = null, - this.onContextMenu && e.removeEventListener("contextmenu", this.onContextMenu), - this._onLostFocus = null), - this._altKey = false, - this._ctrlKey = false, - this._metaKey = false, - this._shiftKey = false, - this._buttonsPressed = 0 - } - , - e.prototype.getClassName = function() { - return "BaseCameraPointersInput" - } - , - e.prototype.getSimpleName = function() { - return "pointers" - } - , - e.prototype.onDoubleTap = function(e) {} - , - e.prototype.onTouch = function(e, t, i) {} - , - e.prototype.onMultiTouch = function(e, t, i, n, r, o) {} - , - e.prototype.onContextMenu = function(e) { - e.preventDefault() - } - , - e.prototype.onButtonDown = function(e) {} - , - e.prototype.onButtonUp = function(e) {} - , - e.prototype.onLostFocus = function() {} - , - h.c([Object(F.c)()], e.prototype, "buttons", void 0), - e - }() - , nt = function(e) { - function t() { - var t = null !== e && e.apply(this, arguments) || this; - return t.buttons = [0, 1, 2], - t.angularSensibilityX = 1e3, - t.angularSensibilityY = 1e3, - t.pinchPrecision = 12, - t.pinchDeltaPercentage = 0, - t.panningSensibility = 1e3, - t.multiTouchPanning = true, - t.multiTouchPanAndZoom = true, - t.pinchInwards = true, - t._isPanClick = false, - t._twoFingerActivityCount = 0, - t._isPinching = false, - t - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "ArcRotateCameraPointersInput" - } - , - t.prototype.onTouch = function(e, t, i) { - 0 !== this.panningSensibility && (this._ctrlKey && this.camera._useCtrlForPanning || this._isPanClick) ? (this.camera.inertialPanningX += -t / this.panningSensibility, - this.camera.inertialPanningY += i / this.panningSensibility) : (this.camera.inertialAlphaOffset -= t / this.angularSensibilityX, - this.camera.inertialBetaOffset -= i / this.angularSensibilityY) - } - , - t.prototype.onDoubleTap = function(e) { - this.camera.useInputToRestoreState && this.camera.restoreState() - } - , - t.prototype.onMultiTouch = function(e, t, i, n, r, o) { - if (!(0 === i && null === r || 0 === n && null === o)) { - var a = this.pinchInwards ? 1 : -1; - if (this.multiTouchPanAndZoom) { - if (this.pinchDeltaPercentage ? this.camera.inertialRadiusOffset += .001 * (n - i) * this.camera.radius * this.pinchDeltaPercentage : this.camera.inertialRadiusOffset += (n - i) / (this.pinchPrecision * a * (this.angularSensibilityX + this.angularSensibilityY) / 2), - 0 !== this.panningSensibility && r && o) { - var s = o.x - r.x - , c = o.y - r.y; - this.camera.inertialPanningX += -s / this.panningSensibility, - this.camera.inertialPanningY += c / this.panningSensibility - } - } else { - this._twoFingerActivityCount++; - var u = Math.sqrt(i) - , l = Math.sqrt(n); - this._isPinching || this._twoFingerActivityCount < 20 && Math.abs(l - u) > this.camera.pinchToPanMaxDistance ? (this.pinchDeltaPercentage ? this.camera.inertialRadiusOffset += .001 * (n - i) * this.camera.radius * this.pinchDeltaPercentage : this.camera.inertialRadiusOffset += (n - i) / (this.pinchPrecision * a * (this.angularSensibilityX + this.angularSensibilityY) / 2), - this._isPinching = true) : 0 !== this.panningSensibility && this.multiTouchPanning && o && r && (s = o.x - r.x, - c = o.y - r.y, - this.camera.inertialPanningX += -s / this.panningSensibility, - this.camera.inertialPanningY += c / this.panningSensibility) - } - } - } - , - t.prototype.onButtonDown = function(e) { - this._isPanClick = e.button === this.camera._panningMouseButton - } - , - t.prototype.onButtonUp = function(e) { - this._twoFingerActivityCount = 0, - this._isPinching = false - } - , - t.prototype.onLostFocus = function() { - this._isPanClick = false, - this._twoFingerActivityCount = 0, - this._isPinching = false - } - , - h.c([Object(F.c)()], t.prototype, "buttons", void 0), - h.c([Object(F.c)()], t.prototype, "angularSensibilityX", void 0), - h.c([Object(F.c)()], t.prototype, "angularSensibilityY", void 0), - h.c([Object(F.c)()], t.prototype, "pinchPrecision", void 0), - h.c([Object(F.c)()], t.prototype, "pinchDeltaPercentage", void 0), - h.c([Object(F.c)()], t.prototype, "panningSensibility", void 0), - h.c([Object(F.c)()], t.prototype, "multiTouchPanning", void 0), - h.c([Object(F.c)()], t.prototype, "multiTouchPanAndZoom", void 0), - t - }(it); - Ye.ArcRotateCameraPointersInput = nt; - var rt = function(e) { - function t(t) { - return e.call(this, t) || this - } - return h.d(t, e), - t.prototype.addMouseWheel = function() { - return this.add(new tt), - this - } - , - t.prototype.addPointers = function() { - return this.add(new nt), - this - } - , - t.prototype.addKeyboard = function() { - return this.add(new et), - this - } - , - t - }(Ke); - rt.prototype.addVRDeviceOrientation = function() { - return this.add(new ot), - this + ); + })(); + Ye.ArcRotateCameraKeyboardMoveInput = et; + var tt = (function () { + function e() { + (this.wheelPrecision = 3), (this.wheelDeltaPercentage = 0); } - ; - var ot = function() { - function e() { - this.alphaCorrection = 1, - this.gammaCorrection = 1, - this._alpha = 0, - this._gamma = 0, - this._dirty = false, - this._deviceOrientationHandler = this._onOrientationEvent.bind(this) - } - return e.prototype.attachControl = function(e, t) { - this.camera.attachControl(e, t), - window.addEventListener("deviceorientation", this._deviceOrientationHandler) - } - , - e.prototype._onOrientationEvent = function(e) { - null !== e.alpha && (this._alpha = (0 | +e.alpha) * this.alphaCorrection), - null !== e.gamma && (this._gamma = (0 | +e.gamma) * this.gammaCorrection), - this._dirty = true - } - , - e.prototype.checkInputs = function() { - this._dirty && (this._dirty = false, - this._gamma < 0 && (this._gamma = 180 + this._gamma), - this.camera.alpha = -this._alpha / 180 * Math.PI % Math.PI * 2, - this.camera.beta = this._gamma / 180 * Math.PI) - } - , - e.prototype.detachControl = function(e) { - window.removeEventListener("deviceorientation", this._deviceOrientationHandler) - } - , - e.prototype.getClassName = function() { - return "ArcRotateCameraVRDeviceOrientationInput" - } - , - e.prototype.getSimpleName = function() { - return "VRDeviceOrientation" - } - , - e - }(); - Ye.ArcRotateCameraVRDeviceOrientationInput = ot; - var at = function() { - function e() { - this.keysForward = [87], - this.keysBackward = [83], - this.keysUp = [69], - this.keysDown = [81], - this.keysRight = [68], - this.keysLeft = [65], - this._keys = new Array - } - return e.prototype.attachControl = function(e, t) { - var i = this; - this._onCanvasBlurObserver || (this._scene = this.camera.getScene(), - this._engine = this._scene.getEngine(), - this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function() { - i._keys = [] - }), - this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function(e) { - var n, r = e.event; - e.type === $e.a.KEYDOWN ? -1 === i.keysForward.indexOf(r.keyCode) && -1 === i.keysBackward.indexOf(r.keyCode) && -1 === i.keysUp.indexOf(r.keyCode) && -1 === i.keysDown.indexOf(r.keyCode) && -1 === i.keysLeft.indexOf(r.keyCode) && -1 === i.keysRight.indexOf(r.keyCode) || (-1 === (n = i._keys.indexOf(r.keyCode)) && i._keys.push(r.keyCode), - t || r.preventDefault()) : -1 === i.keysForward.indexOf(r.keyCode) && -1 === i.keysBackward.indexOf(r.keyCode) && -1 === i.keysUp.indexOf(r.keyCode) && -1 === i.keysDown.indexOf(r.keyCode) && -1 === i.keysLeft.indexOf(r.keyCode) && -1 === i.keysRight.indexOf(r.keyCode) || ((n = i._keys.indexOf(r.keyCode)) >= 0 && i._keys.splice(n, 1), - t || r.preventDefault()) - })) - } - , - e.prototype.detachControl = function(e) { - this._scene && (this._onKeyboardObserver && this._scene.onKeyboardObservable.remove(this._onKeyboardObserver), - this._onCanvasBlurObserver && this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), - this._onKeyboardObserver = null, - this._onCanvasBlurObserver = null), - this._keys = [] - } - , - e.prototype.getClassName = function() { - return "FlyCameraKeyboardInput" - } - , - e.prototype._onLostFocus = function(e) { - this._keys = [] - } - , - e.prototype.getSimpleName = function() { - return "keyboard" - } - , - e.prototype.checkInputs = function() { - if (this._onKeyboardObserver) - for (var e = this.camera, t = 0; t < this._keys.length; t++) { - var i = this._keys[t] - , n = e._computeLocalCameraSpeed(); - -1 !== this.keysForward.indexOf(i) ? e._localDirection.copyFromFloats(0, 0, n) : -1 !== this.keysBackward.indexOf(i) ? e._localDirection.copyFromFloats(0, 0, -n) : -1 !== this.keysUp.indexOf(i) ? e._localDirection.copyFromFloats(0, n, 0) : -1 !== this.keysDown.indexOf(i) ? e._localDirection.copyFromFloats(0, -n, 0) : -1 !== this.keysRight.indexOf(i) ? e._localDirection.copyFromFloats(n, 0, 0) : -1 !== this.keysLeft.indexOf(i) && e._localDirection.copyFromFloats(-n, 0, 0), - e.getScene().useRightHandedSystem && (e._localDirection.z *= -1), - e.getViewMatrix().invertToRef(e._cameraTransformMatrix), - a.x.TransformNormalToRef(e._localDirection, e._cameraTransformMatrix, e._transformedDirection), - e.cameraDirection.addInPlace(e._transformedDirection) - } - } - , - h.c([Object(F.c)()], e.prototype, "keysForward", void 0), - h.c([Object(F.c)()], e.prototype, "keysBackward", void 0), - h.c([Object(F.c)()], e.prototype, "keysUp", void 0), - h.c([Object(F.c)()], e.prototype, "keysDown", void 0), - h.c([Object(F.c)()], e.prototype, "keysRight", void 0), - h.c([Object(F.c)()], e.prototype, "keysLeft", void 0), - e - }(); - Ye.FlyCameraKeyboardInput = at; - var st = function() { - function e(e) { - void 0 === e && (e = true), - this.buttons = [0, 1, 2], - this.buttonsYaw = [-1, 0, 1], - this.buttonsPitch = [-1, 0, 1], - this.buttonsRoll = [2], - this.activeButton = -1, - this.angularSensibility = 1e3, - this.previousPosition = null - } - return e.prototype.attachControl = function(e, t) { - var i = this; - this.element = e, - this.noPreventDefault = t, - this._observer = this.camera.getScene().onPointerObservable.add(function(e, t) { - i._pointerInput(e, t) - }, Re.a.POINTERDOWN | Re.a.POINTERUP | Re.a.POINTERMOVE), - this._rollObserver = this.camera.getScene().onBeforeRenderObservable.add(function() { - i.camera.rollCorrect && i.camera.restoreRoll(i.camera.rollCorrect) - }), - this._mousemoveCallback = function(e) { - i._onMouseMove(e) - } - , - e.addEventListener("mousemove", this._mousemoveCallback, false) - } - , - e.prototype.detachControl = function(e) { - this._observer && e && (this.camera.getScene().onPointerObservable.remove(this._observer), - this.camera.getScene().onBeforeRenderObservable.remove(this._rollObserver), - this._mousemoveCallback && e.removeEventListener("mousemove", this._mousemoveCallback), - this._observer = null, - this._rollObserver = null, - this.previousPosition = null, - this.noPreventDefault = void 0) - } - , - e.prototype.getClassName = function() { - return "FlyCameraMouseInput" - } - , - e.prototype.getSimpleName = function() { - return "mouse" - } - , - e.prototype._pointerInput = function(e, t) { - var i = e.event - , n = this.camera.getEngine(); - if (!n.isInVRExclusivePointerMode && (this.touchEnabled || "touch" !== i.pointerType) && (e.type === Re.a.POINTERMOVE || -1 !== this.buttons.indexOf(i.button))) { - var r = i.srcElement || i.target; - if (e.type === Re.a.POINTERDOWN && r) { - try { - r.setPointerCapture(i.pointerId) - } catch (i) {} - this.previousPosition = { - x: i.clientX, - y: i.clientY - }, - this.activeButton = i.button, - this.noPreventDefault || (i.preventDefault(), - this.element.focus()) - } else if (e.type === Re.a.POINTERUP && r) { - try { - r.releasePointerCapture(i.pointerId) - } catch (i) {} - this.activeButton = -1, - this.previousPosition = null, - this.noPreventDefault || i.preventDefault() - } else if (e.type === Re.a.POINTERMOVE) { - if (!this.previousPosition || n.isPointerLock) - return; - var o = i.clientX - this.previousPosition.x - , a = i.clientY - this.previousPosition.y; - this.rotateCamera(o, a), - this.previousPosition = { - x: i.clientX, - y: i.clientY - }, - this.noPreventDefault || i.preventDefault() - } - } - } - , - e.prototype._onMouseMove = function(e) { - var t = this.camera.getEngine(); - if (t.isPointerLock && !t.isInVRExclusivePointerMode) { - var i = e.movementX || e.mozMovementX || e.webkitMovementX || e.msMovementX || 0 - , n = e.movementY || e.mozMovementY || e.webkitMovementY || e.msMovementY || 0; - this.rotateCamera(i, n), - this.previousPosition = null, - this.noPreventDefault || e.preventDefault() - } - } - , - e.prototype.rotateCamera = function(e, t) { - var i = this - , n = this.camera; - this.camera.getScene().useRightHandedSystem && (e *= -1), - n.parent && n.parent._getWorldMatrixDeterminant() < 0 && (e *= -1); - var r, o = e / this.angularSensibility, s = t / this.angularSensibility, c = a.q.RotationYawPitchRoll(n.rotation.y, n.rotation.x, n.rotation.z); - if (this.buttonsPitch.some(function(e) { - return e === i.activeButton - }) && (r = a.q.RotationAxis(a.c.X, s), - c.multiplyInPlace(r)), - this.buttonsYaw.some(function(e) { - return e === i.activeButton - })) { - r = a.q.RotationAxis(a.c.Y, o), - c.multiplyInPlace(r); - var u = n.bankedTurnLimit + n._trackRoll; - if (n.bankedTurn && -u < n.rotation.z && n.rotation.z < u) { - var l = n.bankedTurnMultiplier * -o; - r = a.q.RotationAxis(a.c.Z, l), - c.multiplyInPlace(r) - } - } - this.buttonsRoll.some(function(e) { - return e === i.activeButton - }) && (r = a.q.RotationAxis(a.c.Z, -o), - n._trackRoll -= o, - c.multiplyInPlace(r)), - c.toEulerAnglesToRef(n.rotation) - } - , - h.c([Object(F.c)()], e.prototype, "buttons", void 0), - h.c([Object(F.c)()], e.prototype, "angularSensibility", void 0), - e - }(); - Ye.FlyCameraMouseInput = st; - var ct = function() { - function e() { - this.keysHeightOffsetIncr = [38], - this.keysHeightOffsetDecr = [40], - this.keysHeightOffsetModifierAlt = false, - this.keysHeightOffsetModifierCtrl = false, - this.keysHeightOffsetModifierShift = false, - this.keysRotationOffsetIncr = [37], - this.keysRotationOffsetDecr = [39], - this.keysRotationOffsetModifierAlt = false, - this.keysRotationOffsetModifierCtrl = false, - this.keysRotationOffsetModifierShift = false, - this.keysRadiusIncr = [40], - this.keysRadiusDecr = [38], - this.keysRadiusModifierAlt = true, - this.keysRadiusModifierCtrl = false, - this.keysRadiusModifierShift = false, - this.heightSensibility = 1, - this.rotationSensibility = 1, - this.radiusSensibility = 1, - this._keys = new Array - } - return e.prototype.attachControl = function(e, t) { - var i = this; - this._onCanvasBlurObserver || (this._scene = this.camera.getScene(), - this._engine = this._scene.getEngine(), - this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function() { - i._keys = [] - }), - this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function(e) { - var n, r = e.event; - r.metaKey || (e.type === $e.a.KEYDOWN ? (i._ctrlPressed = r.ctrlKey, - i._altPressed = r.altKey, - i._shiftPressed = r.shiftKey, - (-1 !== i.keysHeightOffsetIncr.indexOf(r.keyCode) || -1 !== i.keysHeightOffsetDecr.indexOf(r.keyCode) || -1 !== i.keysRotationOffsetIncr.indexOf(r.keyCode) || -1 !== i.keysRotationOffsetDecr.indexOf(r.keyCode) || -1 !== i.keysRadiusIncr.indexOf(r.keyCode) || -1 !== i.keysRadiusDecr.indexOf(r.keyCode)) && (-1 === (n = i._keys.indexOf(r.keyCode)) && i._keys.push(r.keyCode), - r.preventDefault && (t || r.preventDefault()))) : -1 === i.keysHeightOffsetIncr.indexOf(r.keyCode) && -1 === i.keysHeightOffsetDecr.indexOf(r.keyCode) && -1 === i.keysRotationOffsetIncr.indexOf(r.keyCode) && -1 === i.keysRotationOffsetDecr.indexOf(r.keyCode) && -1 === i.keysRadiusIncr.indexOf(r.keyCode) && -1 === i.keysRadiusDecr.indexOf(r.keyCode) || ((n = i._keys.indexOf(r.keyCode)) >= 0 && i._keys.splice(n, 1), - r.preventDefault && (t || r.preventDefault()))) - })) - } - , - e.prototype.detachControl = function(e) { - this._scene && (this._onKeyboardObserver && this._scene.onKeyboardObservable.remove(this._onKeyboardObserver), - this._onCanvasBlurObserver && this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), - this._onKeyboardObserver = null, - this._onCanvasBlurObserver = null), - this._keys = [] - } - , - e.prototype.checkInputs = function() { - var e = this; - this._onKeyboardObserver && this._keys.forEach(function(t) { - -1 !== e.keysHeightOffsetIncr.indexOf(t) && e._modifierHeightOffset() ? e.camera.heightOffset += e.heightSensibility : -1 !== e.keysHeightOffsetDecr.indexOf(t) && e._modifierHeightOffset() ? e.camera.heightOffset -= e.heightSensibility : -1 !== e.keysRotationOffsetIncr.indexOf(t) && e._modifierRotationOffset() ? (e.camera.rotationOffset += e.rotationSensibility, - e.camera.rotationOffset %= 360) : -1 !== e.keysRotationOffsetDecr.indexOf(t) && e._modifierRotationOffset() ? (e.camera.rotationOffset -= e.rotationSensibility, - e.camera.rotationOffset %= 360) : -1 !== e.keysRadiusIncr.indexOf(t) && e._modifierRadius() ? e.camera.radius += e.radiusSensibility : -1 !== e.keysRadiusDecr.indexOf(t) && e._modifierRadius() && (e.camera.radius -= e.radiusSensibility) - }) - } - , - e.prototype.getClassName = function() { - return "FollowCameraKeyboardMoveInput" - } - , - e.prototype.getSimpleName = function() { - return "keyboard" - } - , - e.prototype._modifierHeightOffset = function() { - return this.keysHeightOffsetModifierAlt === this._altPressed && this.keysHeightOffsetModifierCtrl === this._ctrlPressed && this.keysHeightOffsetModifierShift === this._shiftPressed - } - , - e.prototype._modifierRotationOffset = function() { - return this.keysRotationOffsetModifierAlt === this._altPressed && this.keysRotationOffsetModifierCtrl === this._ctrlPressed && this.keysRotationOffsetModifierShift === this._shiftPressed - } - , - e.prototype._modifierRadius = function() { - return this.keysRadiusModifierAlt === this._altPressed && this.keysRadiusModifierCtrl === this._ctrlPressed && this.keysRadiusModifierShift === this._shiftPressed - } - , - h.c([Object(F.c)()], e.prototype, "keysHeightOffsetIncr", void 0), - h.c([Object(F.c)()], e.prototype, "keysHeightOffsetDecr", void 0), - h.c([Object(F.c)()], e.prototype, "keysHeightOffsetModifierAlt", void 0), - h.c([Object(F.c)()], e.prototype, "keysHeightOffsetModifierCtrl", void 0), - h.c([Object(F.c)()], e.prototype, "keysHeightOffsetModifierShift", void 0), - h.c([Object(F.c)()], e.prototype, "keysRotationOffsetIncr", void 0), - h.c([Object(F.c)()], e.prototype, "keysRotationOffsetDecr", void 0), - h.c([Object(F.c)()], e.prototype, "keysRotationOffsetModifierAlt", void 0), - h.c([Object(F.c)()], e.prototype, "keysRotationOffsetModifierCtrl", void 0), - h.c([Object(F.c)()], e.prototype, "keysRotationOffsetModifierShift", void 0), - h.c([Object(F.c)()], e.prototype, "keysRadiusIncr", void 0), - h.c([Object(F.c)()], e.prototype, "keysRadiusDecr", void 0), - h.c([Object(F.c)()], e.prototype, "keysRadiusModifierAlt", void 0), - h.c([Object(F.c)()], e.prototype, "keysRadiusModifierCtrl", void 0), - h.c([Object(F.c)()], e.prototype, "keysRadiusModifierShift", void 0), - h.c([Object(F.c)()], e.prototype, "heightSensibility", void 0), - h.c([Object(F.c)()], e.prototype, "rotationSensibility", void 0), - h.c([Object(F.c)()], e.prototype, "radiusSensibility", void 0), - e - }(); - Ye.FollowCameraKeyboardMoveInput = ct; - var ut = function() { - function e() { - this.axisControlRadius = true, - this.axisControlHeight = false, - this.axisControlRotation = false, - this.wheelPrecision = 3, - this.wheelDeltaPercentage = 0 - } - return e.prototype.attachControl = function(e, t) { - var i = this; - this._wheel = function(e, n) { - if (e.type === Re.a.POINTERWHEEL) { - var r = e.event - , o = 0 - , a = Math.max(-1, Math.min(1, r.deltaY || r.wheelDelta || -r.detail)); - i.wheelDeltaPercentage ? (console.assert(i.axisControlRadius + i.axisControlHeight + i.axisControlRotation <= 1, "wheelDeltaPercentage only usable when mouse wheel controlls ONE axis. Currently enabled: axisControlRadius: " + i.axisControlRadius + ", axisControlHeightOffset: " + i.axisControlHeight + ", axisControlRotationOffset: " + i.axisControlRotation), - i.axisControlRadius ? o = .01 * a * i.wheelDeltaPercentage * i.camera.radius : i.axisControlHeight ? o = .01 * a * i.wheelDeltaPercentage * i.camera.heightOffset : i.axisControlRotation && (o = .01 * a * i.wheelDeltaPercentage * i.camera.rotationOffset)) : o = a * i.wheelPrecision, - o && (i.axisControlRadius ? i.camera.radius += o : i.axisControlHeight ? i.camera.heightOffset -= o : i.axisControlRotation && (i.camera.rotationOffset -= o)), - r.preventDefault && (t || r.preventDefault()) - } - } - , - this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, Re.a.POINTERWHEEL) - } - , - e.prototype.detachControl = function(e) { - this._observer && e && (this.camera.getScene().onPointerObservable.remove(this._observer), - this._observer = null, - this._wheel = null) - } - , - e.prototype.getClassName = function() { - return "ArcRotateCameraMouseWheelInput" - } - , - e.prototype.getSimpleName = function() { - return "mousewheel" - } - , - h.c([Object(F.c)()], e.prototype, "axisControlRadius", void 0), - h.c([Object(F.c)()], e.prototype, "axisControlHeight", void 0), - h.c([Object(F.c)()], e.prototype, "axisControlRotation", void 0), - h.c([Object(F.c)()], e.prototype, "wheelPrecision", void 0), - h.c([Object(F.c)()], e.prototype, "wheelDeltaPercentage", void 0), - e - }(); - Ye.FollowCameraMouseWheelInput = ut; - var lt = function(e) { - function t() { - var t = null !== e && e.apply(this, arguments) || this; - return t.angularSensibilityX = 1, - t.angularSensibilityY = 1, - t.pinchPrecision = 1e4, - t.pinchDeltaPercentage = 0, - t.axisXControlRadius = false, - t.axisXControlHeight = false, - t.axisXControlRotation = true, - t.axisYControlRadius = false, - t.axisYControlHeight = true, - t.axisYControlRotation = false, - t.axisPinchControlRadius = true, - t.axisPinchControlHeight = false, - t.axisPinchControlRotation = false, - t.warningEnable = true, - t._warningCounter = 0, - t - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "FollowCameraPointersInput" - } - , - t.prototype.onTouch = function(e, t, i) { - this._warning(), - this.axisXControlRotation ? this.camera.rotationOffset += t / this.angularSensibilityX : this.axisYControlRotation && (this.camera.rotationOffset += i / this.angularSensibilityX), - this.axisXControlHeight ? this.camera.heightOffset += t / this.angularSensibilityY : this.axisYControlHeight && (this.camera.heightOffset += i / this.angularSensibilityY), - this.axisXControlRadius ? this.camera.radius -= t / this.angularSensibilityY : this.axisYControlRadius && (this.camera.radius -= i / this.angularSensibilityY) - } - , - t.prototype.onMultiTouch = function(e, t, i, n, r, o) { - if (!(0 === i && null === r || 0 === n && null === o)) { - var a = (n - i) / (this.pinchPrecision * (this.angularSensibilityX + this.angularSensibilityY) / 2); - this.pinchDeltaPercentage ? (a *= .01 * this.pinchDeltaPercentage, - this.axisPinchControlRotation && (this.camera.rotationOffset += a * this.camera.rotationOffset), - this.axisPinchControlHeight && (this.camera.heightOffset += a * this.camera.heightOffset), - this.axisPinchControlRadius && (this.camera.radius -= a * this.camera.radius)) : (this.axisPinchControlRotation && (this.camera.rotationOffset += a), - this.axisPinchControlHeight && (this.camera.heightOffset += a), - this.axisPinchControlRadius && (this.camera.radius -= a)) - } - } - , - t.prototype._warning = function() { - if (this.warningEnable && this._warningCounter++ % 100 == 0) { - var e = "It probably only makes sense to control ONE camera property with each pointer axis. Set 'warningEnable = false' if you are sure. Currently enabled: "; - console.assert(this.axisXControlRotation + this.axisXControlHeight + this.axisXControlRadius <= 1, e + "axisXControlRotation: " + this.axisXControlRotation + ", axisXControlHeight: " + this.axisXControlHeight + ", axisXControlRadius: " + this.axisXControlRadius), - console.assert(this.axisYControlRotation + this.axisYControlHeight + this.axisYControlRadius <= 1, e + "axisYControlRotation: " + this.axisYControlRotation + ", axisYControlHeight: " + this.axisYControlHeight + ", axisYControlRadius: " + this.axisYControlRadius), - console.assert(this.axisPinchControlRotation + this.axisPinchControlHeight + this.axisPinchControlRadius <= 1, e + "axisPinchControlRotation: " + this.axisPinchControlRotation + ", axisPinchControlHeight: " + this.axisPinchControlHeight + ", axisPinchControlRadius: " + this.axisPinchControlRadius) - } - } - , - h.c([Object(F.c)()], t.prototype, "angularSensibilityX", void 0), - h.c([Object(F.c)()], t.prototype, "angularSensibilityY", void 0), - h.c([Object(F.c)()], t.prototype, "pinchPrecision", void 0), - h.c([Object(F.c)()], t.prototype, "pinchDeltaPercentage", void 0), - h.c([Object(F.c)()], t.prototype, "axisXControlRadius", void 0), - h.c([Object(F.c)()], t.prototype, "axisXControlHeight", void 0), - h.c([Object(F.c)()], t.prototype, "axisXControlRotation", void 0), - h.c([Object(F.c)()], t.prototype, "axisYControlRadius", void 0), - h.c([Object(F.c)()], t.prototype, "axisYControlHeight", void 0), - h.c([Object(F.c)()], t.prototype, "axisYControlRotation", void 0), - h.c([Object(F.c)()], t.prototype, "axisPinchControlRadius", void 0), - h.c([Object(F.c)()], t.prototype, "axisPinchControlHeight", void 0), - h.c([Object(F.c)()], t.prototype, "axisPinchControlRotation", void 0), - t - }(it); - Ye.FollowCameraPointersInput = lt; - var ht = function() { - function e() { - this.keysUp = [38], - this.keysDown = [40], - this.keysLeft = [37], - this.keysRight = [39], - this._keys = new Array - } - return e.prototype.attachControl = function(e, t) { - var i = this; - this._onCanvasBlurObserver || (this._scene = this.camera.getScene(), - this._engine = this._scene.getEngine(), - this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function() { - i._keys = [] - }), - this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function(e) { - var n, r = e.event; - r.metaKey || (e.type === $e.a.KEYDOWN ? -1 === i.keysUp.indexOf(r.keyCode) && -1 === i.keysDown.indexOf(r.keyCode) && -1 === i.keysLeft.indexOf(r.keyCode) && -1 === i.keysRight.indexOf(r.keyCode) || (-1 === (n = i._keys.indexOf(r.keyCode)) && i._keys.push(r.keyCode), - t || r.preventDefault()) : -1 === i.keysUp.indexOf(r.keyCode) && -1 === i.keysDown.indexOf(r.keyCode) && -1 === i.keysLeft.indexOf(r.keyCode) && -1 === i.keysRight.indexOf(r.keyCode) || ((n = i._keys.indexOf(r.keyCode)) >= 0 && i._keys.splice(n, 1), - t || r.preventDefault())) - })) - } - , - e.prototype.detachControl = function(e) { - this._scene && (this._onKeyboardObserver && this._scene.onKeyboardObservable.remove(this._onKeyboardObserver), - this._onCanvasBlurObserver && this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), - this._onKeyboardObserver = null, - this._onCanvasBlurObserver = null), - this._keys = [] - } - , - e.prototype.checkInputs = function() { - if (this._onKeyboardObserver) - for (var e = this.camera, t = 0; t < this._keys.length; t++) { - var i = this._keys[t] - , n = e._computeLocalCameraSpeed(); - -1 !== this.keysLeft.indexOf(i) ? e._localDirection.copyFromFloats(-n, 0, 0) : -1 !== this.keysUp.indexOf(i) ? e._localDirection.copyFromFloats(0, 0, n) : -1 !== this.keysRight.indexOf(i) ? e._localDirection.copyFromFloats(n, 0, 0) : -1 !== this.keysDown.indexOf(i) && e._localDirection.copyFromFloats(0, 0, -n), - e.getScene().useRightHandedSystem && (e._localDirection.z *= -1), - e.getViewMatrix().invertToRef(e._cameraTransformMatrix), - a.x.TransformNormalToRef(e._localDirection, e._cameraTransformMatrix, e._transformedDirection), - e.cameraDirection.addInPlace(e._transformedDirection) - } - } - , - e.prototype.getClassName = function() { - return "FreeCameraKeyboardMoveInput" - } - , - e.prototype._onLostFocus = function() { - this._keys = [] - } - , - e.prototype.getSimpleName = function() { - return "keyboard" - } - , - h.c([Object(F.c)()], e.prototype, "keysUp", void 0), - h.c([Object(F.c)()], e.prototype, "keysDown", void 0), - h.c([Object(F.c)()], e.prototype, "keysLeft", void 0), - h.c([Object(F.c)()], e.prototype, "keysRight", void 0), - e - }(); - Ye.FreeCameraKeyboardMoveInput = ht; - var ft = function() { - function e(e) { - void 0 === e && (e = true), - this.touchEnabled = e, - this.buttons = [0, 1, 2], - this.angularSensibility = 2e3, - this.previousPosition = null, - this.onPointerMovedObservable = new o.c, - this._allowCameraRotation = true - } - return e.prototype.attachControl = function(e, t) { - var i = this - , n = this.camera.getEngine(); - this._pointerInput || (this._pointerInput = function(r) { - var o = r.event; - if (!n.isInVRExclusivePointerMode && (i.touchEnabled || "touch" !== o.pointerType) && (r.type === Re.a.POINTERMOVE || -1 !== i.buttons.indexOf(o.button))) { - var a = o.srcElement || o.target; - if (r.type === Re.a.POINTERDOWN && a) { - try { - a.setPointerCapture(o.pointerId) - } catch (e) {} - i.previousPosition = { - x: o.clientX, - y: o.clientY - }, - t || (o.preventDefault(), - e.focus()) - } else if (r.type === Re.a.POINTERUP && a) { - try { - a.releasePointerCapture(o.pointerId) - } catch (e) {} - i.previousPosition = null, - t || o.preventDefault() - } else if (r.type === Re.a.POINTERMOVE) { - if (!i.previousPosition || n.isPointerLock) - return; - var s = o.clientX - i.previousPosition.x - , c = o.clientY - i.previousPosition.y; - i.camera.getScene().useRightHandedSystem && (s *= -1), - i.camera.parent && i.camera.parent._getWorldMatrixDeterminant() < 0 && (s *= -1), - i._allowCameraRotation && (i.camera.cameraRotation.y += s / i.angularSensibility, - i.camera.cameraRotation.x += c / i.angularSensibility), - i.onPointerMovedObservable.notifyObservers({ - offsetX: s, - offsetY: c - }), - i.previousPosition = { - x: o.clientX, - y: o.clientY - }, - t || o.preventDefault() - } - } - } - ), - this._onMouseMove = function(e) { - if (n.isPointerLock && !n.isInVRExclusivePointerMode) { - var r = e.movementX || e.mozMovementX || e.webkitMovementX || e.msMovementX || 0; - i.camera.getScene().useRightHandedSystem && (r *= -1), - i.camera.parent && i.camera.parent._getWorldMatrixDeterminant() < 0 && (r *= -1), - i.camera.cameraRotation.y += r / i.angularSensibility; - var o = e.movementY || e.mozMovementY || e.webkitMovementY || e.msMovementY || 0; - i.camera.cameraRotation.x += o / i.angularSensibility, - i.previousPosition = null, - t || e.preventDefault() - } - } - , - this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, Re.a.POINTERDOWN | Re.a.POINTERUP | Re.a.POINTERMOVE), - e.addEventListener("mousemove", this._onMouseMove, false), - e.addEventListener("contextmenu", this.onContextMenu.bind(this), false) - } - , - e.prototype.onContextMenu = function(e) { - e.preventDefault() - } - , - e.prototype.detachControl = function(e) { - this._observer && e && (this.camera.getScene().onPointerObservable.remove(this._observer), - this._onMouseMove && e.removeEventListener("mousemove", this._onMouseMove), - this.onContextMenu && e.removeEventListener("contextmenu", this.onContextMenu), - this.onPointerMovedObservable && this.onPointerMovedObservable.clear(), - this._observer = null, - this._onMouseMove = null, - this.previousPosition = null) - } - , - e.prototype.getClassName = function() { - return "FreeCameraMouseInput" - } - , - e.prototype.getSimpleName = function() { - return "mouse" - } - , - h.c([Object(F.c)()], e.prototype, "buttons", void 0), - h.c([Object(F.c)()], e.prototype, "angularSensibility", void 0), - e - }(); - Ye.FreeCameraMouseInput = ft; - var dt = function() { - function e() { - this.touchAngularSensibility = 2e5, - this.touchMoveSensibility = 250, - this._offsetX = null, - this._offsetY = null, - this._pointerPressed = new Array - } - return e.prototype.attachControl = function(e, t) { - var i = this - , n = null; - void 0 === this._pointerInput && (this._onLostFocus = function() { - i._offsetX = null, - i._offsetY = null - } - , - this._pointerInput = function(e) { - var r = e.event; - if ("mouse" !== r.pointerType) - if (e.type === Re.a.POINTERDOWN) { - if (t || r.preventDefault(), - i._pointerPressed.push(r.pointerId), - 1 !== i._pointerPressed.length) - return; - n = { - x: r.clientX, - y: r.clientY - } - } else if (e.type === Re.a.POINTERUP) { - if (t || r.preventDefault(), - -1 === (o = i._pointerPressed.indexOf(r.pointerId))) - return; - if (i._pointerPressed.splice(o, 1), - 0 != o) - return; - n = null, - i._offsetX = null, - i._offsetY = null - } else if (e.type === Re.a.POINTERMOVE) { - if (t || r.preventDefault(), - !n) - return; - var o; - if (0 != (o = i._pointerPressed.indexOf(r.pointerId))) - return; - i._offsetX = r.clientX - n.x, - i._offsetY = -(r.clientY - n.y) - } - } - ), - this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, Re.a.POINTERDOWN | Re.a.POINTERUP | Re.a.POINTERMOVE), - this._onLostFocus && e.addEventListener("blur", this._onLostFocus) - } - , - e.prototype.detachControl = function(e) { - this._pointerInput && e && (this._observer && (this.camera.getScene().onPointerObservable.remove(this._observer), - this._observer = null), - this._onLostFocus && (e.removeEventListener("blur", this._onLostFocus), - this._onLostFocus = null), - this._pointerPressed = [], - this._offsetX = null, - this._offsetY = null) - } - , - e.prototype.checkInputs = function() { - if (this._offsetX && this._offsetY) { - var e = this.camera; - if (e.cameraRotation.y += this._offsetX / this.touchAngularSensibility, - this._pointerPressed.length > 1) - e.cameraRotation.x += -this._offsetY / this.touchAngularSensibility; - else { - var t = e._computeLocalCameraSpeed() - , i = new a.x(0,0,t * this._offsetY / this.touchMoveSensibility); - a.j.RotationYawPitchRollToRef(e.rotation.y, e.rotation.x, 0, e._cameraRotationMatrix), - e.cameraDirection.addInPlace(a.x.TransformCoordinates(i, e._cameraRotationMatrix)) - } - } - } - , - e.prototype.getClassName = function() { - return "FreeCameraTouchInput" - } - , - e.prototype.getSimpleName = function() { - return "touch" - } - , - h.c([Object(F.c)()], e.prototype, "touchAngularSensibility", void 0), - h.c([Object(F.c)()], e.prototype, "touchMoveSensibility", void 0), - e - }(); - Ye.FreeCameraTouchInput = dt; - var pt = function(e) { - function t(t) { - var i = e.call(this, t) || this; - return i._mouseInput = null, - i - } - return h.d(t, e), - t.prototype.addKeyboard = function() { - return this.add(new ht), - this - } - , - t.prototype.addMouse = function(e) { - return void 0 === e && (e = true), - this._mouseInput || (this._mouseInput = new ft(e), - this.add(this._mouseInput)), - this - } - , - t.prototype.removeMouse = function() { - return this._mouseInput && this.remove(this._mouseInput), - this - } - , - t.prototype.addTouch = function() { - return this.add(new dt), - this - } - , - t.prototype.clear = function() { - e.prototype.clear.call(this), - this._mouseInput = null - } - , - t - }(Ke); - pt.prototype.addDeviceOrientation = function() { - return this._deviceOrientationInput || (this._deviceOrientationInput = new mt, - this.add(this._deviceOrientationInput)), - this - } - ; - var mt = function() { - function e() { - var e = this; - this._screenOrientationAngle = 0, - this._screenQuaternion = new a.q, - this._alpha = 0, - this._beta = 0, - this._gamma = 0, - this._onDeviceOrientationChangedObservable = new o.c, - this._orientationChanged = function() { - e._screenOrientationAngle = void 0 !== window.orientation ? +window.orientation : window.screen.orientation && window.screen.orientation.angle ? window.screen.orientation.angle : 0, - e._screenOrientationAngle = -Ee.h.ToRadians(e._screenOrientationAngle / 2), - e._screenQuaternion.copyFromFloats(0, Math.sin(e._screenOrientationAngle), 0, Math.cos(e._screenOrientationAngle)) - } - , - this._deviceOrientation = function(t) { - e._alpha = null !== t.alpha ? t.alpha : 0, - e._beta = null !== t.beta ? t.beta : 0, - e._gamma = null !== t.gamma ? t.gamma : 0, - null !== t.alpha && e._onDeviceOrientationChangedObservable.notifyObservers() - } - , - this._constantTranform = new a.q(-Math.sqrt(.5),0,0,Math.sqrt(.5)), - this._orientationChanged() - } - return Object.defineProperty(e.prototype, "camera", { - get: function() { - return this._camera - }, - set: function(e) { - var t = this; - this._camera = e, - null == this._camera || this._camera.rotationQuaternion || (this._camera.rotationQuaternion = new a.q), - this._camera && this._camera.onDisposeObservable.add(function() { - t._onDeviceOrientationChangedObservable.clear() - }) - }, - enumerable: true, - configurable: true + return ( + (e.prototype.computeDeltaFromMouseWheelLegacyEvent = + function (e, t) { + var i = + 0.01 * e.wheelDelta * this.wheelDeltaPercentage * t; + return e.wheelDelta > 0 + ? i / (1 + this.wheelDeltaPercentage) + : i * (1 + this.wheelDeltaPercentage); }), - e.prototype.attachControl = function(e, t) { - window.addEventListener("orientationchange", this._orientationChanged), - window.addEventListener("deviceorientation", this._deviceOrientation), - this._orientationChanged() - } - , - e.prototype.detachControl = function(e) { - window.removeEventListener("orientationchange", this._orientationChanged), - window.removeEventListener("deviceorientation", this._deviceOrientation), - this._alpha = 0 - } - , - e.prototype.checkInputs = function() { - this._alpha && (a.q.RotationYawPitchRollToRef(Ee.h.ToRadians(this._alpha), Ee.h.ToRadians(this._beta), -Ee.h.ToRadians(this._gamma), this.camera.rotationQuaternion), - this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion), - this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform), - this._camera.rotationQuaternion.z *= -1, - this._camera.rotationQuaternion.w *= -1) - } - , - e.prototype.getClassName = function() { - return "FreeCameraDeviceOrientationInput" - } - , - e.prototype.getSimpleName = function() { - return "deviceOrientation" - } - , - e - }(); - Ye.FreeCameraDeviceOrientationInput = mt; - var gt = function() { - function e() { - this.gamepadAngularSensibility = 200, - this.gamepadMoveSensibility = 40, - this._cameraTransform = a.j.Identity(), - this._deltaTransform = a.x.Zero(), - this._vector3 = a.x.Zero(), - this._vector2 = a.w.Zero() - } - return e.prototype.attachControl = function(e, t) { - var i = this - , n = this.camera.getScene().gamepadManager; - this._onGamepadConnectedObserver = n.onGamepadConnectedObservable.add(function(e) { - e.type !== qe.POSE_ENABLED && (i.gamepad && e.type !== qe.XBOX || (i.gamepad = e)) + (e.prototype.attachControl = function (e, t) { + var i = this; + (this._wheel = function (e, n) { + if (e.type === Re.a.POINTERWHEEL) { + var r = e.event, + o = 0, + a = r; + if (a.wheelDelta) + if (i.wheelDeltaPercentage) { + if ( + (o = i.computeDeltaFromMouseWheelLegacyEvent( + a, + i.camera.radius + )) > 0 + ) { + for ( + var s = i.camera.radius, + c = i.camera.inertialRadiusOffset + o, + u = 0; + u < 20 && Math.abs(c) > 0.001; + u++ + ) + (s -= c), (c *= i.camera.inertia); + (s = L.a.Clamp(s, 0, Number.MAX_VALUE)), + (o = i.computeDeltaFromMouseWheelLegacyEvent( + a, + s + )); + } + } else o = a.wheelDelta / (40 * i.wheelPrecision); + else o = -(r.deltaY || r.detail) / i.wheelPrecision; + o && (i.camera.inertialRadiusOffset += o), + r.preventDefault && (t || r.preventDefault()); + } + }), + (this._observer = this.camera + .getScene() + .onPointerObservable.add( + this._wheel, + Re.a.POINTERWHEEL + )); + }), + (e.prototype.detachControl = function (e) { + this._observer && + e && + (this.camera + .getScene() + .onPointerObservable.remove(this._observer), + (this._observer = null), + (this._wheel = null)); + }), + (e.prototype.getClassName = function () { + return "ArcRotateCameraMouseWheelInput"; + }), + (e.prototype.getSimpleName = function () { + return "mousewheel"; + }), + h.c([Object(F.c)()], e.prototype, "wheelPrecision", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "wheelDeltaPercentage", + void 0 + ), + e + ); + })(); + Ye.ArcRotateCameraMouseWheelInput = tt; + var it = (function () { + function e() { + this.buttons = [0, 1, 2]; + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this, + n = this.camera.getEngine(), + r = 0, + o = null; + (this.pointA = null), + (this.pointB = null), + (this._altKey = false), + (this._ctrlKey = false), + (this._metaKey = false), + (this._shiftKey = false), + (this._buttonsPressed = 0), + (this._pointerInput = function (a, s) { + var c = a.event, + u = "touch" === c.pointerType; + if ( + !n.isInVRExclusivePointerMode && + (a.type === Re.a.POINTERMOVE || + -1 !== i.buttons.indexOf(c.button)) + ) { + var l = c.srcElement || c.target; + if ( + ((i._altKey = c.altKey), + (i._ctrlKey = c.ctrlKey), + (i._metaKey = c.metaKey), + (i._shiftKey = c.shiftKey), + (i._buttonsPressed = c.buttons), + n.isPointerLock) + ) { + var h = + c.movementX || + c.mozMovementX || + c.webkitMovementX || + c.msMovementX || + 0, + f = + c.movementY || + c.mozMovementY || + c.webkitMovementY || + c.msMovementY || + 0; + i.onTouch(null, h, f), + (i.pointA = null), + (i.pointB = null); + } else if (a.type === Re.a.POINTERDOWN && l) { + try { + l.setPointerCapture(c.pointerId); + } catch (e) {} + null === i.pointA + ? (i.pointA = { + x: c.clientX, + y: c.clientY, + pointerId: c.pointerId, + type: c.pointerType, + }) + : null === i.pointB && + (i.pointB = { + x: c.clientX, + y: c.clientY, + pointerId: c.pointerId, + type: c.pointerType, + }), + i.onButtonDown(c), + t || (c.preventDefault(), e.focus()); + } else if (a.type === Re.a.POINTERDOUBLETAP) + i.onDoubleTap(c.pointerType); + else if (a.type === Re.a.POINTERUP && l) { + try { + l.releasePointerCapture(c.pointerId); + } catch (e) {} + u || (i.pointB = null), + n._badOS + ? (i.pointA = i.pointB = null) + : i.pointB && + i.pointA && + i.pointA.pointerId == c.pointerId + ? ((i.pointA = i.pointB), (i.pointB = null)) + : i.pointA && + i.pointB && + i.pointB.pointerId == c.pointerId + ? (i.pointB = null) + : (i.pointA = i.pointB = null), + (0 !== r || o) && + (i.onMultiTouch( + i.pointA, + i.pointB, + r, + 0, + o, + null + ), + (r = 0), + (o = null)), + i.onButtonUp(c), + t || c.preventDefault(); + } else if (a.type === Re.a.POINTERMOVE) + if ( + (t || c.preventDefault(), + i.pointA && null === i.pointB) + ) + (h = c.clientX - i.pointA.x), + (f = c.clientY - i.pointA.y), + i.onTouch(i.pointA, h, f), + (i.pointA.x = c.clientX), + (i.pointA.y = c.clientY); + else if (i.pointA && i.pointB) { + var d = + i.pointA.pointerId === c.pointerId + ? i.pointA + : i.pointB; + (d.x = c.clientX), (d.y = c.clientY); + var p = i.pointA.x - i.pointB.x, + m = i.pointA.y - i.pointB.y, + g = p * p + m * m, + _ = { + x: (i.pointA.x + i.pointB.x) / 2, + y: (i.pointA.y + i.pointB.y) / 2, + pointerId: c.pointerId, + type: a.type, + }; + i.onMultiTouch(i.pointA, i.pointB, r, g, o, _), + (o = _), + (r = g); + } + } }), - this._onGamepadDisconnectedObserver = n.onGamepadDisconnectedObservable.add(function(e) { - i.gamepad === e && (i.gamepad = null) + (this._observer = this.camera + .getScene() + .onPointerObservable.add( + this._pointerInput, + Re.a.POINTERDOWN | Re.a.POINTERUP | Re.a.POINTERMOVE + )), + (this._onLostFocus = function () { + (i.pointA = i.pointB = null), + (r = 0), + (o = null), + i.onLostFocus(); }), - this.gamepad = n.getGamepadByType(qe.XBOX) - } - , - e.prototype.detachControl = function(e) { - this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver), - this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver), - this.gamepad = null - } - , - e.prototype.checkInputs = function() { - if (this.gamepad && this.gamepad.leftStick) { - var e = this.camera - , t = this.gamepad.leftStick - , i = t.x / this.gamepadMoveSensibility - , n = t.y / this.gamepadMoveSensibility; - t.x = Math.abs(i) > .005 ? 0 + i : 0, - t.y = Math.abs(n) > .005 ? 0 + n : 0; - var r = this.gamepad.rightStick; - if (r) { - var o = r.x / this.gamepadAngularSensibility - , s = r.y / this.gamepadAngularSensibility; - r.x = Math.abs(o) > .001 ? 0 + o : 0, - r.y = Math.abs(s) > .001 ? 0 + s : 0 - } else - r = { - x: 0, - y: 0 - }; - e.rotationQuaternion ? e.rotationQuaternion.toRotationMatrix(this._cameraTransform) : a.j.RotationYawPitchRollToRef(e.rotation.y, e.rotation.x, 0, this._cameraTransform); - var c = 50 * e._computeLocalCameraSpeed(); - this._vector3.copyFromFloats(t.x * c, 0, -t.y * c), - a.x.TransformCoordinatesToRef(this._vector3, this._cameraTransform, this._deltaTransform), - e.cameraDirection.addInPlace(this._deltaTransform), - this._vector2.copyFromFloats(r.y, r.x), - e.cameraRotation.addInPlace(this._vector2) - } - } - , - e.prototype.getClassName = function() { - return "FreeCameraGamepadInput" - } - , - e.prototype.getSimpleName = function() { - return "gamepad" - } - , - h.c([Object(F.c)()], e.prototype, "gamepadAngularSensibility", void 0), - h.c([Object(F.c)()], e.prototype, "gamepadMoveSensibility", void 0), + e.addEventListener( + "contextmenu", + this.onContextMenu.bind(this), + false + ), + Ee.h.RegisterTopRootEvents([ + { + name: "blur", + handler: this._onLostFocus, + }, + ]); + }), + (e.prototype.detachControl = function (e) { + this._onLostFocus && + Ee.h.UnregisterTopRootEvents([ + { + name: "blur", + handler: this._onLostFocus, + }, + ]), + e && + this._observer && + (this.camera + .getScene() + .onPointerObservable.remove(this._observer), + (this._observer = null), + this.onContextMenu && + e.removeEventListener( + "contextmenu", + this.onContextMenu + ), + (this._onLostFocus = null)), + (this._altKey = false), + (this._ctrlKey = false), + (this._metaKey = false), + (this._shiftKey = false), + (this._buttonsPressed = 0); + }), + (e.prototype.getClassName = function () { + return "BaseCameraPointersInput"; + }), + (e.prototype.getSimpleName = function () { + return "pointers"; + }), + (e.prototype.onDoubleTap = function (e) {}), + (e.prototype.onTouch = function (e, t, i) {}), + (e.prototype.onMultiTouch = function (e, t, i, n, r, o) {}), + (e.prototype.onContextMenu = function (e) { + e.preventDefault(); + }), + (e.prototype.onButtonDown = function (e) {}), + (e.prototype.onButtonUp = function (e) {}), + (e.prototype.onLostFocus = function () {}), + h.c([Object(F.c)()], e.prototype, "buttons", void 0), e - }(); - Ye.FreeCameraGamepadInput = gt; - var _t, vt = n(61); - !function(e) { - e[e.X = 0] = "X", - e[e.Y = 1] = "Y", - e[e.Z = 2] = "Z" - }(_t || (_t = {})); - var yt = function() { - function e(t) { - var i = this; - if (this._leftJoystick = !!t, - e._globalJoystickIndex++, - this._axisTargetedByLeftAndRight = _t.X, - this._axisTargetedByUpAndDown = _t.Y, - this.reverseLeftRight = false, - this.reverseUpDown = false, - this._touches = new vt.a, - this.deltaPosition = a.x.Zero(), - this._joystickSensibility = 25, - this._inversedSensibility = 1 / (this._joystickSensibility / 1e3), - this._onResize = function(t) { - e.vjCanvasWidth = window.innerWidth, - e.vjCanvasHeight = window.innerHeight, - e.Canvas && (e.Canvas.width = e.vjCanvasWidth, - e.Canvas.height = e.vjCanvasHeight), - e.halfWidth = e.vjCanvasWidth / 2 + ); + })(), + nt = (function (e) { + function t() { + var t = (null !== e && e.apply(this, arguments)) || this; + return ( + (t.buttons = [0, 1, 2]), + (t.angularSensibilityX = 1e3), + (t.angularSensibilityY = 1e3), + (t.pinchPrecision = 12), + (t.pinchDeltaPercentage = 0), + (t.panningSensibility = 1e3), + (t.multiTouchPanning = true), + (t.multiTouchPanAndZoom = true), + (t.pinchInwards = true), + (t._isPanClick = false), + (t._twoFingerActivityCount = 0), + (t._isPinching = false), + t + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "ArcRotateCameraPointersInput"; + }), + (t.prototype.onTouch = function (e, t, i) { + 0 !== this.panningSensibility && + ((this._ctrlKey && this.camera._useCtrlForPanning) || + this._isPanClick) + ? ((this.camera.inertialPanningX += + -t / this.panningSensibility), + (this.camera.inertialPanningY += + i / this.panningSensibility)) + : ((this.camera.inertialAlphaOffset -= + t / this.angularSensibilityX), + (this.camera.inertialBetaOffset -= + i / this.angularSensibilityY)); + }), + (t.prototype.onDoubleTap = function (e) { + this.camera.useInputToRestoreState && + this.camera.restoreState(); + }), + (t.prototype.onMultiTouch = function (e, t, i, n, r, o) { + if ( + !((0 === i && null === r) || (0 === n && null === o)) + ) { + var a = this.pinchInwards ? 1 : -1; + if (this.multiTouchPanAndZoom) { + if ( + (this.pinchDeltaPercentage + ? (this.camera.inertialRadiusOffset += + 0.001 * + (n - i) * + this.camera.radius * + this.pinchDeltaPercentage) + : (this.camera.inertialRadiusOffset += + (n - i) / + ((this.pinchPrecision * + a * + (this.angularSensibilityX + + this.angularSensibilityY)) / + 2)), + 0 !== this.panningSensibility && r && o) + ) { + var s = o.x - r.x, + c = o.y - r.y; + (this.camera.inertialPanningX += + -s / this.panningSensibility), + (this.camera.inertialPanningY += + c / this.panningSensibility); + } + } else { + this._twoFingerActivityCount++; + var u = Math.sqrt(i), + l = Math.sqrt(n); + this._isPinching || + (this._twoFingerActivityCount < 20 && + Math.abs(l - u) > this.camera.pinchToPanMaxDistance) + ? (this.pinchDeltaPercentage + ? (this.camera.inertialRadiusOffset += + 0.001 * + (n - i) * + this.camera.radius * + this.pinchDeltaPercentage) + : (this.camera.inertialRadiusOffset += + (n - i) / + ((this.pinchPrecision * + a * + (this.angularSensibilityX + + this.angularSensibilityY)) / + 2)), + (this._isPinching = true)) + : 0 !== this.panningSensibility && + this.multiTouchPanning && + o && + r && + ((s = o.x - r.x), + (c = o.y - r.y), + (this.camera.inertialPanningX += + -s / this.panningSensibility), + (this.camera.inertialPanningY += + c / this.panningSensibility)); } - , - !e.Canvas) { - window.addEventListener("resize", this._onResize, false), - e.Canvas = document.createElement("canvas"), - e.vjCanvasWidth = window.innerWidth, - e.vjCanvasHeight = window.innerHeight, - e.Canvas.width = window.innerWidth, - e.Canvas.height = window.innerHeight, - e.Canvas.style.width = "100%", - e.Canvas.style.height = "100%", - e.Canvas.style.position = "absolute", - e.Canvas.style.backgroundColor = "transparent", - e.Canvas.style.top = "0px", - e.Canvas.style.left = "0px", - e.Canvas.style.zIndex = "5", - e.Canvas.style.msTouchAction = "none", - e.Canvas.setAttribute("touch-action", "none"); - var n = e.Canvas.getContext("2d"); - if (!n) - throw new Error("Unable to create canvas for virtual joystick"); - e.vjCanvasContext = n, - e.vjCanvasContext.strokeStyle = "#ffffff", - e.vjCanvasContext.lineWidth = 2, - document.body.appendChild(e.Canvas) - } - e.halfWidth = e.Canvas.width / 2, - this.pressed = false, - this._joystickColor = "cyan", - this._joystickPointerID = -1, - this._joystickPointerPos = new a.w(0,0), - this._joystickPreviousPointerPos = new a.w(0,0), - this._joystickPointerStartPos = new a.w(0,0), - this._deltaJoystickVector = new a.w(0,0), - this._onPointerDownHandlerRef = function(e) { - i._onPointerDown(e) - } - , - this._onPointerMoveHandlerRef = function(e) { - i._onPointerMove(e) - } - , - this._onPointerUpHandlerRef = function(e) { - i._onPointerUp(e) - } - , - e.Canvas.addEventListener("pointerdown", this._onPointerDownHandlerRef, false), - e.Canvas.addEventListener("pointermove", this._onPointerMoveHandlerRef, false), - e.Canvas.addEventListener("pointerup", this._onPointerUpHandlerRef, false), - e.Canvas.addEventListener("pointerout", this._onPointerUpHandlerRef, false), - e.Canvas.addEventListener("contextmenu", function(e) { - e.preventDefault() - }, false), - requestAnimationFrame(function() { - i._drawVirtualJoystick() - }) + } + }), + (t.prototype.onButtonDown = function (e) { + this._isPanClick = + e.button === this.camera._panningMouseButton; + }), + (t.prototype.onButtonUp = function (e) { + (this._twoFingerActivityCount = 0), + (this._isPinching = false); + }), + (t.prototype.onLostFocus = function () { + (this._isPanClick = false), + (this._twoFingerActivityCount = 0), + (this._isPinching = false); + }), + h.c([Object(F.c)()], t.prototype, "buttons", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "angularSensibilityX", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "angularSensibilityY", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "pinchPrecision", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "pinchDeltaPercentage", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "panningSensibility", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "multiTouchPanning", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "multiTouchPanAndZoom", + void 0 + ), + t + ); + })(it); + Ye.ArcRotateCameraPointersInput = nt; + var rt = (function (e) { + function t(t) { + return e.call(this, t) || this; + } + return ( + h.d(t, e), + (t.prototype.addMouseWheel = function () { + return this.add(new tt()), this; + }), + (t.prototype.addPointers = function () { + return this.add(new nt()), this; + }), + (t.prototype.addKeyboard = function () { + return this.add(new et()), this; + }), + t + ); + })(Ke); + rt.prototype.addVRDeviceOrientation = function () { + return this.add(new ot()), this; + }; + var ot = (function () { + function e() { + (this.alphaCorrection = 1), + (this.gammaCorrection = 1), + (this._alpha = 0), + (this._gamma = 0), + (this._dirty = false), + (this._deviceOrientationHandler = + this._onOrientationEvent.bind(this)); + } + return ( + (e.prototype.attachControl = function (e, t) { + this.camera.attachControl(e, t), + window.addEventListener( + "deviceorientation", + this._deviceOrientationHandler + ); + }), + (e.prototype._onOrientationEvent = function (e) { + null !== e.alpha && + (this._alpha = (0 | +e.alpha) * this.alphaCorrection), + null !== e.gamma && + (this._gamma = (0 | +e.gamma) * this.gammaCorrection), + (this._dirty = true); + }), + (e.prototype.checkInputs = function () { + this._dirty && + ((this._dirty = false), + this._gamma < 0 && (this._gamma = 180 + this._gamma), + (this.camera.alpha = + (((-this._alpha / 180) * Math.PI) % Math.PI) * 2), + (this.camera.beta = (this._gamma / 180) * Math.PI)); + }), + (e.prototype.detachControl = function (e) { + window.removeEventListener( + "deviceorientation", + this._deviceOrientationHandler + ); + }), + (e.prototype.getClassName = function () { + return "ArcRotateCameraVRDeviceOrientationInput"; + }), + (e.prototype.getSimpleName = function () { + return "VRDeviceOrientation"; + }), + e + ); + })(); + Ye.ArcRotateCameraVRDeviceOrientationInput = ot; + var at = (function () { + function e() { + (this.keysForward = [87]), + (this.keysBackward = [83]), + (this.keysUp = [69]), + (this.keysDown = [81]), + (this.keysRight = [68]), + (this.keysLeft = [65]), + (this._keys = new Array()); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this; + this._onCanvasBlurObserver || + ((this._scene = this.camera.getScene()), + (this._engine = this._scene.getEngine()), + (this._onCanvasBlurObserver = + this._engine.onCanvasBlurObservable.add(function () { + i._keys = []; + })), + (this._onKeyboardObserver = + this._scene.onKeyboardObservable.add(function (e) { + var n, + r = e.event; + e.type === $e.a.KEYDOWN + ? (-1 === i.keysForward.indexOf(r.keyCode) && + -1 === i.keysBackward.indexOf(r.keyCode) && + -1 === i.keysUp.indexOf(r.keyCode) && + -1 === i.keysDown.indexOf(r.keyCode) && + -1 === i.keysLeft.indexOf(r.keyCode) && + -1 === i.keysRight.indexOf(r.keyCode)) || + (-1 === (n = i._keys.indexOf(r.keyCode)) && + i._keys.push(r.keyCode), + t || r.preventDefault()) + : (-1 === i.keysForward.indexOf(r.keyCode) && + -1 === i.keysBackward.indexOf(r.keyCode) && + -1 === i.keysUp.indexOf(r.keyCode) && + -1 === i.keysDown.indexOf(r.keyCode) && + -1 === i.keysLeft.indexOf(r.keyCode) && + -1 === i.keysRight.indexOf(r.keyCode)) || + ((n = i._keys.indexOf(r.keyCode)) >= 0 && + i._keys.splice(n, 1), + t || r.preventDefault()); + }))); + }), + (e.prototype.detachControl = function (e) { + this._scene && + (this._onKeyboardObserver && + this._scene.onKeyboardObservable.remove( + this._onKeyboardObserver + ), + this._onCanvasBlurObserver && + this._engine.onCanvasBlurObservable.remove( + this._onCanvasBlurObserver + ), + (this._onKeyboardObserver = null), + (this._onCanvasBlurObserver = null)), + (this._keys = []); + }), + (e.prototype.getClassName = function () { + return "FlyCameraKeyboardInput"; + }), + (e.prototype._onLostFocus = function (e) { + this._keys = []; + }), + (e.prototype.getSimpleName = function () { + return "keyboard"; + }), + (e.prototype.checkInputs = function () { + if (this._onKeyboardObserver) + for ( + var e = this.camera, t = 0; + t < this._keys.length; + t++ + ) { + var i = this._keys[t], + n = e._computeLocalCameraSpeed(); + -1 !== this.keysForward.indexOf(i) + ? e._localDirection.copyFromFloats(0, 0, n) + : -1 !== this.keysBackward.indexOf(i) + ? e._localDirection.copyFromFloats(0, 0, -n) + : -1 !== this.keysUp.indexOf(i) + ? e._localDirection.copyFromFloats(0, n, 0) + : -1 !== this.keysDown.indexOf(i) + ? e._localDirection.copyFromFloats(0, -n, 0) + : -1 !== this.keysRight.indexOf(i) + ? e._localDirection.copyFromFloats(n, 0, 0) + : -1 !== this.keysLeft.indexOf(i) && + e._localDirection.copyFromFloats(-n, 0, 0), + e.getScene().useRightHandedSystem && + (e._localDirection.z *= -1), + e + .getViewMatrix() + .invertToRef(e._cameraTransformMatrix), + a.x.TransformNormalToRef( + e._localDirection, + e._cameraTransformMatrix, + e._transformedDirection + ), + e.cameraDirection.addInPlace(e._transformedDirection); + } + }), + h.c([Object(F.c)()], e.prototype, "keysForward", void 0), + h.c([Object(F.c)()], e.prototype, "keysBackward", void 0), + h.c([Object(F.c)()], e.prototype, "keysUp", void 0), + h.c([Object(F.c)()], e.prototype, "keysDown", void 0), + h.c([Object(F.c)()], e.prototype, "keysRight", void 0), + h.c([Object(F.c)()], e.prototype, "keysLeft", void 0), + e + ); + })(); + Ye.FlyCameraKeyboardInput = at; + var st = (function () { + function e(e) { + void 0 === e && (e = true), + (this.buttons = [0, 1, 2]), + (this.buttonsYaw = [-1, 0, 1]), + (this.buttonsPitch = [-1, 0, 1]), + (this.buttonsRoll = [2]), + (this.activeButton = -1), + (this.angularSensibility = 1e3), + (this.previousPosition = null); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this; + (this.element = e), + (this.noPreventDefault = t), + (this._observer = this.camera + .getScene() + .onPointerObservable.add(function (e, t) { + i._pointerInput(e, t); + }, Re.a.POINTERDOWN | + Re.a.POINTERUP | + Re.a.POINTERMOVE)), + (this._rollObserver = this.camera + .getScene() + .onBeforeRenderObservable.add(function () { + i.camera.rollCorrect && + i.camera.restoreRoll(i.camera.rollCorrect); + })), + (this._mousemoveCallback = function (e) { + i._onMouseMove(e); + }), + e.addEventListener( + "mousemove", + this._mousemoveCallback, + false + ); + }), + (e.prototype.detachControl = function (e) { + this._observer && + e && + (this.camera + .getScene() + .onPointerObservable.remove(this._observer), + this.camera + .getScene() + .onBeforeRenderObservable.remove(this._rollObserver), + this._mousemoveCallback && + e.removeEventListener( + "mousemove", + this._mousemoveCallback + ), + (this._observer = null), + (this._rollObserver = null), + (this.previousPosition = null), + (this.noPreventDefault = void 0)); + }), + (e.prototype.getClassName = function () { + return "FlyCameraMouseInput"; + }), + (e.prototype.getSimpleName = function () { + return "mouse"; + }), + (e.prototype._pointerInput = function (e, t) { + var i = e.event, + n = this.camera.getEngine(); + if ( + !n.isInVRExclusivePointerMode && + (this.touchEnabled || "touch" !== i.pointerType) && + (e.type === Re.a.POINTERMOVE || + -1 !== this.buttons.indexOf(i.button)) + ) { + var r = i.srcElement || i.target; + if (e.type === Re.a.POINTERDOWN && r) { + try { + r.setPointerCapture(i.pointerId); + } catch (i) {} + (this.previousPosition = { + x: i.clientX, + y: i.clientY, + }), + (this.activeButton = i.button), + this.noPreventDefault || + (i.preventDefault(), this.element.focus()); + } else if (e.type === Re.a.POINTERUP && r) { + try { + r.releasePointerCapture(i.pointerId); + } catch (i) {} + (this.activeButton = -1), + (this.previousPosition = null), + this.noPreventDefault || i.preventDefault(); + } else if (e.type === Re.a.POINTERMOVE) { + if (!this.previousPosition || n.isPointerLock) return; + var o = i.clientX - this.previousPosition.x, + a = i.clientY - this.previousPosition.y; + this.rotateCamera(o, a), + (this.previousPosition = { + x: i.clientX, + y: i.clientY, + }), + this.noPreventDefault || i.preventDefault(); + } } - return e.prototype.setJoystickSensibility = function(e) { - this._joystickSensibility = e, - this._inversedSensibility = 1 / (this._joystickSensibility / 1e3) + }), + (e.prototype._onMouseMove = function (e) { + var t = this.camera.getEngine(); + if (t.isPointerLock && !t.isInVRExclusivePointerMode) { + var i = + e.movementX || + e.mozMovementX || + e.webkitMovementX || + e.msMovementX || + 0, + n = + e.movementY || + e.mozMovementY || + e.webkitMovementY || + e.msMovementY || + 0; + this.rotateCamera(i, n), + (this.previousPosition = null), + this.noPreventDefault || e.preventDefault(); } - , - e.prototype._onPointerDown = function(t) { - t.preventDefault(), - (true === this._leftJoystick ? t.clientX < e.halfWidth : t.clientX > e.halfWidth) && this._joystickPointerID < 0 ? (this._joystickPointerID = t.pointerId, - this._joystickPointerStartPos.x = t.clientX, - this._joystickPointerStartPos.y = t.clientY, - this._joystickPointerPos = this._joystickPointerStartPos.clone(), - this._joystickPreviousPointerPos = this._joystickPointerStartPos.clone(), - this._deltaJoystickVector.x = 0, - this._deltaJoystickVector.y = 0, - this.pressed = true, - this._touches.add(t.pointerId.toString(), t)) : e._globalJoystickIndex < 2 && this._action && (this._action(), - this._touches.add(t.pointerId.toString(), { + }), + (e.prototype.rotateCamera = function (e, t) { + var i = this, + n = this.camera; + this.camera.getScene().useRightHandedSystem && (e *= -1), + n.parent && + n.parent._getWorldMatrixDeterminant() < 0 && + (e *= -1); + var r, + o = e / this.angularSensibility, + s = t / this.angularSensibility, + c = a.q.RotationYawPitchRoll( + n.rotation.y, + n.rotation.x, + n.rotation.z + ); + if ( + (this.buttonsPitch.some(function (e) { + return e === i.activeButton; + }) && + ((r = a.q.RotationAxis(a.c.X, s)), + c.multiplyInPlace(r)), + this.buttonsYaw.some(function (e) { + return e === i.activeButton; + })) + ) { + (r = a.q.RotationAxis(a.c.Y, o)), c.multiplyInPlace(r); + var u = n.bankedTurnLimit + n._trackRoll; + if ( + n.bankedTurn && + -u < n.rotation.z && + n.rotation.z < u + ) { + var l = n.bankedTurnMultiplier * -o; + (r = a.q.RotationAxis(a.c.Z, l)), c.multiplyInPlace(r); + } + } + this.buttonsRoll.some(function (e) { + return e === i.activeButton; + }) && + ((r = a.q.RotationAxis(a.c.Z, -o)), + (n._trackRoll -= o), + c.multiplyInPlace(r)), + c.toEulerAnglesToRef(n.rotation); + }), + h.c([Object(F.c)()], e.prototype, "buttons", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "angularSensibility", + void 0 + ), + e + ); + })(); + Ye.FlyCameraMouseInput = st; + var ct = (function () { + function e() { + (this.keysHeightOffsetIncr = [38]), + (this.keysHeightOffsetDecr = [40]), + (this.keysHeightOffsetModifierAlt = false), + (this.keysHeightOffsetModifierCtrl = false), + (this.keysHeightOffsetModifierShift = false), + (this.keysRotationOffsetIncr = [37]), + (this.keysRotationOffsetDecr = [39]), + (this.keysRotationOffsetModifierAlt = false), + (this.keysRotationOffsetModifierCtrl = false), + (this.keysRotationOffsetModifierShift = false), + (this.keysRadiusIncr = [40]), + (this.keysRadiusDecr = [38]), + (this.keysRadiusModifierAlt = true), + (this.keysRadiusModifierCtrl = false), + (this.keysRadiusModifierShift = false), + (this.heightSensibility = 1), + (this.rotationSensibility = 1), + (this.radiusSensibility = 1), + (this._keys = new Array()); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this; + this._onCanvasBlurObserver || + ((this._scene = this.camera.getScene()), + (this._engine = this._scene.getEngine()), + (this._onCanvasBlurObserver = + this._engine.onCanvasBlurObservable.add(function () { + i._keys = []; + })), + (this._onKeyboardObserver = + this._scene.onKeyboardObservable.add(function (e) { + var n, + r = e.event; + r.metaKey || + (e.type === $e.a.KEYDOWN + ? ((i._ctrlPressed = r.ctrlKey), + (i._altPressed = r.altKey), + (i._shiftPressed = r.shiftKey), + (-1 !== + i.keysHeightOffsetIncr.indexOf(r.keyCode) || + -1 !== + i.keysHeightOffsetDecr.indexOf(r.keyCode) || + -1 !== + i.keysRotationOffsetIncr.indexOf( + r.keyCode + ) || + -1 !== + i.keysRotationOffsetDecr.indexOf( + r.keyCode + ) || + -1 !== i.keysRadiusIncr.indexOf(r.keyCode) || + -1 !== i.keysRadiusDecr.indexOf(r.keyCode)) && + (-1 === (n = i._keys.indexOf(r.keyCode)) && + i._keys.push(r.keyCode), + r.preventDefault && + (t || r.preventDefault()))) + : (-1 === + i.keysHeightOffsetIncr.indexOf(r.keyCode) && + -1 === + i.keysHeightOffsetDecr.indexOf(r.keyCode) && + -1 === + i.keysRotationOffsetIncr.indexOf( + r.keyCode + ) && + -1 === + i.keysRotationOffsetDecr.indexOf( + r.keyCode + ) && + -1 === i.keysRadiusIncr.indexOf(r.keyCode) && + -1 === i.keysRadiusDecr.indexOf(r.keyCode)) || + ((n = i._keys.indexOf(r.keyCode)) >= 0 && + i._keys.splice(n, 1), + r.preventDefault && (t || r.preventDefault()))); + }))); + }), + (e.prototype.detachControl = function (e) { + this._scene && + (this._onKeyboardObserver && + this._scene.onKeyboardObservable.remove( + this._onKeyboardObserver + ), + this._onCanvasBlurObserver && + this._engine.onCanvasBlurObservable.remove( + this._onCanvasBlurObserver + ), + (this._onKeyboardObserver = null), + (this._onCanvasBlurObserver = null)), + (this._keys = []); + }), + (e.prototype.checkInputs = function () { + var e = this; + this._onKeyboardObserver && + this._keys.forEach(function (t) { + -1 !== e.keysHeightOffsetIncr.indexOf(t) && + e._modifierHeightOffset() + ? (e.camera.heightOffset += e.heightSensibility) + : -1 !== e.keysHeightOffsetDecr.indexOf(t) && + e._modifierHeightOffset() + ? (e.camera.heightOffset -= e.heightSensibility) + : -1 !== e.keysRotationOffsetIncr.indexOf(t) && + e._modifierRotationOffset() + ? ((e.camera.rotationOffset += e.rotationSensibility), + (e.camera.rotationOffset %= 360)) + : -1 !== e.keysRotationOffsetDecr.indexOf(t) && + e._modifierRotationOffset() + ? ((e.camera.rotationOffset -= e.rotationSensibility), + (e.camera.rotationOffset %= 360)) + : -1 !== e.keysRadiusIncr.indexOf(t) && + e._modifierRadius() + ? (e.camera.radius += e.radiusSensibility) + : -1 !== e.keysRadiusDecr.indexOf(t) && + e._modifierRadius() && + (e.camera.radius -= e.radiusSensibility); + }); + }), + (e.prototype.getClassName = function () { + return "FollowCameraKeyboardMoveInput"; + }), + (e.prototype.getSimpleName = function () { + return "keyboard"; + }), + (e.prototype._modifierHeightOffset = function () { + return ( + this.keysHeightOffsetModifierAlt === this._altPressed && + this.keysHeightOffsetModifierCtrl === this._ctrlPressed && + this.keysHeightOffsetModifierShift === this._shiftPressed + ); + }), + (e.prototype._modifierRotationOffset = function () { + return ( + this.keysRotationOffsetModifierAlt === this._altPressed && + this.keysRotationOffsetModifierCtrl === + this._ctrlPressed && + this.keysRotationOffsetModifierShift === + this._shiftPressed + ); + }), + (e.prototype._modifierRadius = function () { + return ( + this.keysRadiusModifierAlt === this._altPressed && + this.keysRadiusModifierCtrl === this._ctrlPressed && + this.keysRadiusModifierShift === this._shiftPressed + ); + }), + h.c( + [Object(F.c)()], + e.prototype, + "keysHeightOffsetIncr", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysHeightOffsetDecr", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysHeightOffsetModifierAlt", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysHeightOffsetModifierCtrl", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysHeightOffsetModifierShift", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysRotationOffsetIncr", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysRotationOffsetDecr", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysRotationOffsetModifierAlt", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysRotationOffsetModifierCtrl", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysRotationOffsetModifierShift", + void 0 + ), + h.c([Object(F.c)()], e.prototype, "keysRadiusIncr", void 0), + h.c([Object(F.c)()], e.prototype, "keysRadiusDecr", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "keysRadiusModifierAlt", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysRadiusModifierCtrl", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "keysRadiusModifierShift", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "heightSensibility", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "rotationSensibility", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "radiusSensibility", + void 0 + ), + e + ); + })(); + Ye.FollowCameraKeyboardMoveInput = ct; + var ut = (function () { + function e() { + (this.axisControlRadius = true), + (this.axisControlHeight = false), + (this.axisControlRotation = false), + (this.wheelPrecision = 3), + (this.wheelDeltaPercentage = 0); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this; + (this._wheel = function (e, n) { + if (e.type === Re.a.POINTERWHEEL) { + var r = e.event, + o = 0, + a = Math.max( + -1, + Math.min(1, r.deltaY || r.wheelDelta || -r.detail) + ); + i.wheelDeltaPercentage + ? (console.assert( + i.axisControlRadius + + i.axisControlHeight + + i.axisControlRotation <= + 1, + "wheelDeltaPercentage only usable when mouse wheel controlls ONE axis. Currently enabled: axisControlRadius: " + + i.axisControlRadius + + ", axisControlHeightOffset: " + + i.axisControlHeight + + ", axisControlRotationOffset: " + + i.axisControlRotation + ), + i.axisControlRadius + ? (o = + 0.01 * + a * + i.wheelDeltaPercentage * + i.camera.radius) + : i.axisControlHeight + ? (o = + 0.01 * + a * + i.wheelDeltaPercentage * + i.camera.heightOffset) + : i.axisControlRotation && + (o = + 0.01 * + a * + i.wheelDeltaPercentage * + i.camera.rotationOffset)) + : (o = a * i.wheelPrecision), + o && + (i.axisControlRadius + ? (i.camera.radius += o) + : i.axisControlHeight + ? (i.camera.heightOffset -= o) + : i.axisControlRotation && + (i.camera.rotationOffset -= o)), + r.preventDefault && (t || r.preventDefault()); + } + }), + (this._observer = this.camera + .getScene() + .onPointerObservable.add( + this._wheel, + Re.a.POINTERWHEEL + )); + }), + (e.prototype.detachControl = function (e) { + this._observer && + e && + (this.camera + .getScene() + .onPointerObservable.remove(this._observer), + (this._observer = null), + (this._wheel = null)); + }), + (e.prototype.getClassName = function () { + return "ArcRotateCameraMouseWheelInput"; + }), + (e.prototype.getSimpleName = function () { + return "mousewheel"; + }), + h.c( + [Object(F.c)()], + e.prototype, + "axisControlRadius", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "axisControlHeight", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "axisControlRotation", + void 0 + ), + h.c([Object(F.c)()], e.prototype, "wheelPrecision", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "wheelDeltaPercentage", + void 0 + ), + e + ); + })(); + Ye.FollowCameraMouseWheelInput = ut; + var lt = (function (e) { + function t() { + var t = (null !== e && e.apply(this, arguments)) || this; + return ( + (t.angularSensibilityX = 1), + (t.angularSensibilityY = 1), + (t.pinchPrecision = 1e4), + (t.pinchDeltaPercentage = 0), + (t.axisXControlRadius = false), + (t.axisXControlHeight = false), + (t.axisXControlRotation = true), + (t.axisYControlRadius = false), + (t.axisYControlHeight = true), + (t.axisYControlRotation = false), + (t.axisPinchControlRadius = true), + (t.axisPinchControlHeight = false), + (t.axisPinchControlRotation = false), + (t.warningEnable = true), + (t._warningCounter = 0), + t + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "FollowCameraPointersInput"; + }), + (t.prototype.onTouch = function (e, t, i) { + this._warning(), + this.axisXControlRotation + ? (this.camera.rotationOffset += + t / this.angularSensibilityX) + : this.axisYControlRotation && + (this.camera.rotationOffset += + i / this.angularSensibilityX), + this.axisXControlHeight + ? (this.camera.heightOffset += + t / this.angularSensibilityY) + : this.axisYControlHeight && + (this.camera.heightOffset += + i / this.angularSensibilityY), + this.axisXControlRadius + ? (this.camera.radius -= t / this.angularSensibilityY) + : this.axisYControlRadius && + (this.camera.radius -= i / this.angularSensibilityY); + }), + (t.prototype.onMultiTouch = function (e, t, i, n, r, o) { + if (!((0 === i && null === r) || (0 === n && null === o))) { + var a = + (n - i) / + ((this.pinchPrecision * + (this.angularSensibilityX + + this.angularSensibilityY)) / + 2); + this.pinchDeltaPercentage + ? ((a *= 0.01 * this.pinchDeltaPercentage), + this.axisPinchControlRotation && + (this.camera.rotationOffset += + a * this.camera.rotationOffset), + this.axisPinchControlHeight && + (this.camera.heightOffset += + a * this.camera.heightOffset), + this.axisPinchControlRadius && + (this.camera.radius -= a * this.camera.radius)) + : (this.axisPinchControlRotation && + (this.camera.rotationOffset += a), + this.axisPinchControlHeight && + (this.camera.heightOffset += a), + this.axisPinchControlRadius && + (this.camera.radius -= a)); + } + }), + (t.prototype._warning = function () { + if ( + this.warningEnable && + this._warningCounter++ % 100 == 0 + ) { + var e = + "It probably only makes sense to control ONE camera property with each pointer axis. Set 'warningEnable = false' if you are sure. Currently enabled: "; + console.assert( + this.axisXControlRotation + + this.axisXControlHeight + + this.axisXControlRadius <= + 1, + e + + "axisXControlRotation: " + + this.axisXControlRotation + + ", axisXControlHeight: " + + this.axisXControlHeight + + ", axisXControlRadius: " + + this.axisXControlRadius + ), + console.assert( + this.axisYControlRotation + + this.axisYControlHeight + + this.axisYControlRadius <= + 1, + e + + "axisYControlRotation: " + + this.axisYControlRotation + + ", axisYControlHeight: " + + this.axisYControlHeight + + ", axisYControlRadius: " + + this.axisYControlRadius + ), + console.assert( + this.axisPinchControlRotation + + this.axisPinchControlHeight + + this.axisPinchControlRadius <= + 1, + e + + "axisPinchControlRotation: " + + this.axisPinchControlRotation + + ", axisPinchControlHeight: " + + this.axisPinchControlHeight + + ", axisPinchControlRadius: " + + this.axisPinchControlRadius + ); + } + }), + h.c( + [Object(F.c)()], + t.prototype, + "angularSensibilityX", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "angularSensibilityY", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "pinchPrecision", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "pinchDeltaPercentage", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisXControlRadius", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisXControlHeight", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisXControlRotation", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisYControlRadius", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisYControlHeight", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisYControlRotation", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisPinchControlRadius", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisPinchControlHeight", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "axisPinchControlRotation", + void 0 + ), + t + ); + })(it); + Ye.FollowCameraPointersInput = lt; + var ht = (function () { + function e() { + (this.keysUp = [38]), + (this.keysDown = [40]), + (this.keysLeft = [37]), + (this.keysRight = [39]), + (this._keys = new Array()); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this; + this._onCanvasBlurObserver || + ((this._scene = this.camera.getScene()), + (this._engine = this._scene.getEngine()), + (this._onCanvasBlurObserver = + this._engine.onCanvasBlurObservable.add(function () { + i._keys = []; + })), + (this._onKeyboardObserver = + this._scene.onKeyboardObservable.add(function (e) { + var n, + r = e.event; + r.metaKey || + (e.type === $e.a.KEYDOWN + ? (-1 === i.keysUp.indexOf(r.keyCode) && + -1 === i.keysDown.indexOf(r.keyCode) && + -1 === i.keysLeft.indexOf(r.keyCode) && + -1 === i.keysRight.indexOf(r.keyCode)) || + (-1 === (n = i._keys.indexOf(r.keyCode)) && + i._keys.push(r.keyCode), + t || r.preventDefault()) + : (-1 === i.keysUp.indexOf(r.keyCode) && + -1 === i.keysDown.indexOf(r.keyCode) && + -1 === i.keysLeft.indexOf(r.keyCode) && + -1 === i.keysRight.indexOf(r.keyCode)) || + ((n = i._keys.indexOf(r.keyCode)) >= 0 && + i._keys.splice(n, 1), + t || r.preventDefault())); + }))); + }), + (e.prototype.detachControl = function (e) { + this._scene && + (this._onKeyboardObserver && + this._scene.onKeyboardObservable.remove( + this._onKeyboardObserver + ), + this._onCanvasBlurObserver && + this._engine.onCanvasBlurObservable.remove( + this._onCanvasBlurObserver + ), + (this._onKeyboardObserver = null), + (this._onCanvasBlurObserver = null)), + (this._keys = []); + }), + (e.prototype.checkInputs = function () { + if (this._onKeyboardObserver) + for ( + var e = this.camera, t = 0; + t < this._keys.length; + t++ + ) { + var i = this._keys[t], + n = e._computeLocalCameraSpeed(); + -1 !== this.keysLeft.indexOf(i) + ? e._localDirection.copyFromFloats(-n, 0, 0) + : -1 !== this.keysUp.indexOf(i) + ? e._localDirection.copyFromFloats(0, 0, n) + : -1 !== this.keysRight.indexOf(i) + ? e._localDirection.copyFromFloats(n, 0, 0) + : -1 !== this.keysDown.indexOf(i) && + e._localDirection.copyFromFloats(0, 0, -n), + e.getScene().useRightHandedSystem && + (e._localDirection.z *= -1), + e + .getViewMatrix() + .invertToRef(e._cameraTransformMatrix), + a.x.TransformNormalToRef( + e._localDirection, + e._cameraTransformMatrix, + e._transformedDirection + ), + e.cameraDirection.addInPlace(e._transformedDirection); + } + }), + (e.prototype.getClassName = function () { + return "FreeCameraKeyboardMoveInput"; + }), + (e.prototype._onLostFocus = function () { + this._keys = []; + }), + (e.prototype.getSimpleName = function () { + return "keyboard"; + }), + h.c([Object(F.c)()], e.prototype, "keysUp", void 0), + h.c([Object(F.c)()], e.prototype, "keysDown", void 0), + h.c([Object(F.c)()], e.prototype, "keysLeft", void 0), + h.c([Object(F.c)()], e.prototype, "keysRight", void 0), + e + ); + })(); + Ye.FreeCameraKeyboardMoveInput = ht; + var ft = (function () { + function e(e) { + void 0 === e && (e = true), + (this.touchEnabled = e), + (this.buttons = [0, 1, 2]), + (this.angularSensibility = 2e3), + (this.previousPosition = null), + (this.onPointerMovedObservable = new o.c()), + (this._allowCameraRotation = true); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this, + n = this.camera.getEngine(); + this._pointerInput || + (this._pointerInput = function (r) { + var o = r.event; + if ( + !n.isInVRExclusivePointerMode && + (i.touchEnabled || "touch" !== o.pointerType) && + (r.type === Re.a.POINTERMOVE || + -1 !== i.buttons.indexOf(o.button)) + ) { + var a = o.srcElement || o.target; + if (r.type === Re.a.POINTERDOWN && a) { + try { + a.setPointerCapture(o.pointerId); + } catch (e) {} + (i.previousPosition = { + x: o.clientX, + y: o.clientY, + }), + t || (o.preventDefault(), e.focus()); + } else if (r.type === Re.a.POINTERUP && a) { + try { + a.releasePointerCapture(o.pointerId); + } catch (e) {} + (i.previousPosition = null), + t || o.preventDefault(); + } else if (r.type === Re.a.POINTERMOVE) { + if (!i.previousPosition || n.isPointerLock) return; + var s = o.clientX - i.previousPosition.x, + c = o.clientY - i.previousPosition.y; + i.camera.getScene().useRightHandedSystem && + (s *= -1), + i.camera.parent && + i.camera.parent._getWorldMatrixDeterminant() < + 0 && + (s *= -1), + i._allowCameraRotation && + ((i.camera.cameraRotation.y += + s / i.angularSensibility), + (i.camera.cameraRotation.x += + c / i.angularSensibility)), + i.onPointerMovedObservable.notifyObservers({ + offsetX: s, + offsetY: c, + }), + (i.previousPosition = { + x: o.clientX, + y: o.clientY, + }), + t || o.preventDefault(); + } + } + }), + (this._onMouseMove = function (e) { + if (n.isPointerLock && !n.isInVRExclusivePointerMode) { + var r = + e.movementX || + e.mozMovementX || + e.webkitMovementX || + e.msMovementX || + 0; + i.camera.getScene().useRightHandedSystem && (r *= -1), + i.camera.parent && + i.camera.parent._getWorldMatrixDeterminant() < + 0 && + (r *= -1), + (i.camera.cameraRotation.y += + r / i.angularSensibility); + var o = + e.movementY || + e.mozMovementY || + e.webkitMovementY || + e.msMovementY || + 0; + (i.camera.cameraRotation.x += + o / i.angularSensibility), + (i.previousPosition = null), + t || e.preventDefault(); + } + }), + (this._observer = this.camera + .getScene() + .onPointerObservable.add( + this._pointerInput, + Re.a.POINTERDOWN | Re.a.POINTERUP | Re.a.POINTERMOVE + )), + e.addEventListener("mousemove", this._onMouseMove, false), + e.addEventListener( + "contextmenu", + this.onContextMenu.bind(this), + false + ); + }), + (e.prototype.onContextMenu = function (e) { + e.preventDefault(); + }), + (e.prototype.detachControl = function (e) { + this._observer && + e && + (this.camera + .getScene() + .onPointerObservable.remove(this._observer), + this._onMouseMove && + e.removeEventListener("mousemove", this._onMouseMove), + this.onContextMenu && + e.removeEventListener( + "contextmenu", + this.onContextMenu + ), + this.onPointerMovedObservable && + this.onPointerMovedObservable.clear(), + (this._observer = null), + (this._onMouseMove = null), + (this.previousPosition = null)); + }), + (e.prototype.getClassName = function () { + return "FreeCameraMouseInput"; + }), + (e.prototype.getSimpleName = function () { + return "mouse"; + }), + h.c([Object(F.c)()], e.prototype, "buttons", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "angularSensibility", + void 0 + ), + e + ); + })(); + Ye.FreeCameraMouseInput = ft; + var dt = (function () { + function e() { + (this.touchAngularSensibility = 2e5), + (this.touchMoveSensibility = 250), + (this._offsetX = null), + (this._offsetY = null), + (this._pointerPressed = new Array()); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this, + n = null; + void 0 === this._pointerInput && + ((this._onLostFocus = function () { + (i._offsetX = null), (i._offsetY = null); + }), + (this._pointerInput = function (e) { + var r = e.event; + if ("mouse" !== r.pointerType) + if (e.type === Re.a.POINTERDOWN) { + if ( + (t || r.preventDefault(), + i._pointerPressed.push(r.pointerId), + 1 !== i._pointerPressed.length) + ) + return; + n = { + x: r.clientX, + y: r.clientY, + }; + } else if (e.type === Re.a.POINTERUP) { + if ( + (t || r.preventDefault(), + -1 === + (o = i._pointerPressed.indexOf(r.pointerId))) + ) + return; + if ((i._pointerPressed.splice(o, 1), 0 != o)) + return; + (n = null), + (i._offsetX = null), + (i._offsetY = null); + } else if (e.type === Re.a.POINTERMOVE) { + if ((t || r.preventDefault(), !n)) return; + var o; + if ( + 0 != (o = i._pointerPressed.indexOf(r.pointerId)) + ) + return; + (i._offsetX = r.clientX - n.x), + (i._offsetY = -(r.clientY - n.y)); + } + })), + (this._observer = this.camera + .getScene() + .onPointerObservable.add( + this._pointerInput, + Re.a.POINTERDOWN | Re.a.POINTERUP | Re.a.POINTERMOVE + )), + this._onLostFocus && + e.addEventListener("blur", this._onLostFocus); + }), + (e.prototype.detachControl = function (e) { + this._pointerInput && + e && + (this._observer && + (this.camera + .getScene() + .onPointerObservable.remove(this._observer), + (this._observer = null)), + this._onLostFocus && + (e.removeEventListener("blur", this._onLostFocus), + (this._onLostFocus = null)), + (this._pointerPressed = []), + (this._offsetX = null), + (this._offsetY = null)); + }), + (e.prototype.checkInputs = function () { + if (this._offsetX && this._offsetY) { + var e = this.camera; + if ( + ((e.cameraRotation.y += + this._offsetX / this.touchAngularSensibility), + this._pointerPressed.length > 1) + ) + e.cameraRotation.x += + -this._offsetY / this.touchAngularSensibility; + else { + var t = e._computeLocalCameraSpeed(), + i = new a.x( + 0, + 0, + (t * this._offsetY) / this.touchMoveSensibility + ); + a.j.RotationYawPitchRollToRef( + e.rotation.y, + e.rotation.x, + 0, + e._cameraRotationMatrix + ), + e.cameraDirection.addInPlace( + a.x.TransformCoordinates(i, e._cameraRotationMatrix) + ); + } + } + }), + (e.prototype.getClassName = function () { + return "FreeCameraTouchInput"; + }), + (e.prototype.getSimpleName = function () { + return "touch"; + }), + h.c( + [Object(F.c)()], + e.prototype, + "touchAngularSensibility", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "touchMoveSensibility", + void 0 + ), + e + ); + })(); + Ye.FreeCameraTouchInput = dt; + var pt = (function (e) { + function t(t) { + var i = e.call(this, t) || this; + return (i._mouseInput = null), i; + } + return ( + h.d(t, e), + (t.prototype.addKeyboard = function () { + return this.add(new ht()), this; + }), + (t.prototype.addMouse = function (e) { + return ( + void 0 === e && (e = true), + this._mouseInput || + ((this._mouseInput = new ft(e)), + this.add(this._mouseInput)), + this + ); + }), + (t.prototype.removeMouse = function () { + return ( + this._mouseInput && this.remove(this._mouseInput), this + ); + }), + (t.prototype.addTouch = function () { + return this.add(new dt()), this; + }), + (t.prototype.clear = function () { + e.prototype.clear.call(this), (this._mouseInput = null); + }), + t + ); + })(Ke); + pt.prototype.addDeviceOrientation = function () { + return ( + this._deviceOrientationInput || + ((this._deviceOrientationInput = new mt()), + this.add(this._deviceOrientationInput)), + this + ); + }; + var mt = (function () { + function e() { + var e = this; + (this._screenOrientationAngle = 0), + (this._screenQuaternion = new a.q()), + (this._alpha = 0), + (this._beta = 0), + (this._gamma = 0), + (this._onDeviceOrientationChangedObservable = new o.c()), + (this._orientationChanged = function () { + (e._screenOrientationAngle = + void 0 !== window.orientation + ? +window.orientation + : window.screen.orientation && + window.screen.orientation.angle + ? window.screen.orientation.angle + : 0), + (e._screenOrientationAngle = -Ee.h.ToRadians( + e._screenOrientationAngle / 2 + )), + e._screenQuaternion.copyFromFloats( + 0, + Math.sin(e._screenOrientationAngle), + 0, + Math.cos(e._screenOrientationAngle) + ); + }), + (this._deviceOrientation = function (t) { + (e._alpha = null !== t.alpha ? t.alpha : 0), + (e._beta = null !== t.beta ? t.beta : 0), + (e._gamma = null !== t.gamma ? t.gamma : 0), + null !== t.alpha && + e._onDeviceOrientationChangedObservable.notifyObservers(); + }), + (this._constantTranform = new a.q( + -Math.sqrt(0.5), + 0, + 0, + Math.sqrt(0.5) + )), + this._orientationChanged(); + } + return ( + Object.defineProperty(e.prototype, "camera", { + get: function () { + return this._camera; + }, + set: function (e) { + var t = this; + (this._camera = e), + null == this._camera || + this._camera.rotationQuaternion || + (this._camera.rotationQuaternion = new a.q()), + this._camera && + this._camera.onDisposeObservable.add(function () { + t._onDeviceOrientationChangedObservable.clear(); + }); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.attachControl = function (e, t) { + window.addEventListener( + "orientationchange", + this._orientationChanged + ), + window.addEventListener( + "deviceorientation", + this._deviceOrientation + ), + this._orientationChanged(); + }), + (e.prototype.detachControl = function (e) { + window.removeEventListener( + "orientationchange", + this._orientationChanged + ), + window.removeEventListener( + "deviceorientation", + this._deviceOrientation + ), + (this._alpha = 0); + }), + (e.prototype.checkInputs = function () { + this._alpha && + (a.q.RotationYawPitchRollToRef( + Ee.h.ToRadians(this._alpha), + Ee.h.ToRadians(this._beta), + -Ee.h.ToRadians(this._gamma), + this.camera.rotationQuaternion + ), + this._camera.rotationQuaternion.multiplyInPlace( + this._screenQuaternion + ), + this._camera.rotationQuaternion.multiplyInPlace( + this._constantTranform + ), + (this._camera.rotationQuaternion.z *= -1), + (this._camera.rotationQuaternion.w *= -1)); + }), + (e.prototype.getClassName = function () { + return "FreeCameraDeviceOrientationInput"; + }), + (e.prototype.getSimpleName = function () { + return "deviceOrientation"; + }), + e + ); + })(); + Ye.FreeCameraDeviceOrientationInput = mt; + var gt = (function () { + function e() { + (this.gamepadAngularSensibility = 200), + (this.gamepadMoveSensibility = 40), + (this._cameraTransform = a.j.Identity()), + (this._deltaTransform = a.x.Zero()), + (this._vector3 = a.x.Zero()), + (this._vector2 = a.w.Zero()); + } + return ( + (e.prototype.attachControl = function (e, t) { + var i = this, + n = this.camera.getScene().gamepadManager; + (this._onGamepadConnectedObserver = + n.onGamepadConnectedObservable.add(function (e) { + e.type !== qe.POSE_ENABLED && + ((i.gamepad && e.type !== qe.XBOX) || + (i.gamepad = e)); + })), + (this._onGamepadDisconnectedObserver = + n.onGamepadDisconnectedObservable.add(function (e) { + i.gamepad === e && (i.gamepad = null); + })), + (this.gamepad = n.getGamepadByType(qe.XBOX)); + }), + (e.prototype.detachControl = function (e) { + this.camera + .getScene() + .gamepadManager.onGamepadConnectedObservable.remove( + this._onGamepadConnectedObserver + ), + this.camera + .getScene() + .gamepadManager.onGamepadDisconnectedObservable.remove( + this._onGamepadDisconnectedObserver + ), + (this.gamepad = null); + }), + (e.prototype.checkInputs = function () { + if (this.gamepad && this.gamepad.leftStick) { + var e = this.camera, + t = this.gamepad.leftStick, + i = t.x / this.gamepadMoveSensibility, + n = t.y / this.gamepadMoveSensibility; + (t.x = Math.abs(i) > 0.005 ? 0 + i : 0), + (t.y = Math.abs(n) > 0.005 ? 0 + n : 0); + var r = this.gamepad.rightStick; + if (r) { + var o = r.x / this.gamepadAngularSensibility, + s = r.y / this.gamepadAngularSensibility; + (r.x = Math.abs(o) > 0.001 ? 0 + o : 0), + (r.y = Math.abs(s) > 0.001 ? 0 + s : 0); + } else + r = { + x: 0, + y: 0, + }; + e.rotationQuaternion + ? e.rotationQuaternion.toRotationMatrix( + this._cameraTransform + ) + : a.j.RotationYawPitchRollToRef( + e.rotation.y, + e.rotation.x, + 0, + this._cameraTransform + ); + var c = 50 * e._computeLocalCameraSpeed(); + this._vector3.copyFromFloats(t.x * c, 0, -t.y * c), + a.x.TransformCoordinatesToRef( + this._vector3, + this._cameraTransform, + this._deltaTransform + ), + e.cameraDirection.addInPlace(this._deltaTransform), + this._vector2.copyFromFloats(r.y, r.x), + e.cameraRotation.addInPlace(this._vector2); + } + }), + (e.prototype.getClassName = function () { + return "FreeCameraGamepadInput"; + }), + (e.prototype.getSimpleName = function () { + return "gamepad"; + }), + h.c( + [Object(F.c)()], + e.prototype, + "gamepadAngularSensibility", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "gamepadMoveSensibility", + void 0 + ), + e + ); + })(); + Ye.FreeCameraGamepadInput = gt; + var _t, + vt = n(61); + !(function (e) { + (e[(e.X = 0)] = "X"), + (e[(e.Y = 1)] = "Y"), + (e[(e.Z = 2)] = "Z"); + })(_t || (_t = {})); + var yt = (function () { + function e(t) { + var i = this; + if ( + ((this._leftJoystick = !!t), + e._globalJoystickIndex++, + (this._axisTargetedByLeftAndRight = _t.X), + (this._axisTargetedByUpAndDown = _t.Y), + (this.reverseLeftRight = false), + (this.reverseUpDown = false), + (this._touches = new vt.a()), + (this.deltaPosition = a.x.Zero()), + (this._joystickSensibility = 25), + (this._inversedSensibility = + 1 / (this._joystickSensibility / 1e3)), + (this._onResize = function (t) { + (e.vjCanvasWidth = window.innerWidth), + (e.vjCanvasHeight = window.innerHeight), + e.Canvas && + ((e.Canvas.width = e.vjCanvasWidth), + (e.Canvas.height = e.vjCanvasHeight)), + (e.halfWidth = e.vjCanvasWidth / 2); + }), + !e.Canvas) + ) { + window.addEventListener("resize", this._onResize, false), + (e.Canvas = document.createElement("canvas")), + (e.vjCanvasWidth = window.innerWidth), + (e.vjCanvasHeight = window.innerHeight), + (e.Canvas.width = window.innerWidth), + (e.Canvas.height = window.innerHeight), + (e.Canvas.style.width = "100%"), + (e.Canvas.style.height = "100%"), + (e.Canvas.style.position = "absolute"), + (e.Canvas.style.backgroundColor = "transparent"), + (e.Canvas.style.top = "0px"), + (e.Canvas.style.left = "0px"), + (e.Canvas.style.zIndex = "5"), + (e.Canvas.style.msTouchAction = "none"), + e.Canvas.setAttribute("touch-action", "none"); + var n = e.Canvas.getContext("2d"); + if (!n) + throw new Error( + "Unable to create canvas for virtual joystick" + ); + (e.vjCanvasContext = n), + (e.vjCanvasContext.strokeStyle = "#ffffff"), + (e.vjCanvasContext.lineWidth = 2), + document.body.appendChild(e.Canvas); + } + (e.halfWidth = e.Canvas.width / 2), + (this.pressed = false), + (this._joystickColor = "cyan"), + (this._joystickPointerID = -1), + (this._joystickPointerPos = new a.w(0, 0)), + (this._joystickPreviousPointerPos = new a.w(0, 0)), + (this._joystickPointerStartPos = new a.w(0, 0)), + (this._deltaJoystickVector = new a.w(0, 0)), + (this._onPointerDownHandlerRef = function (e) { + i._onPointerDown(e); + }), + (this._onPointerMoveHandlerRef = function (e) { + i._onPointerMove(e); + }), + (this._onPointerUpHandlerRef = function (e) { + i._onPointerUp(e); + }), + e.Canvas.addEventListener( + "pointerdown", + this._onPointerDownHandlerRef, + false + ), + e.Canvas.addEventListener( + "pointermove", + this._onPointerMoveHandlerRef, + false + ), + e.Canvas.addEventListener( + "pointerup", + this._onPointerUpHandlerRef, + false + ), + e.Canvas.addEventListener( + "pointerout", + this._onPointerUpHandlerRef, + false + ), + e.Canvas.addEventListener( + "contextmenu", + function (e) { + e.preventDefault(); + }, + false + ), + requestAnimationFrame(function () { + i._drawVirtualJoystick(); + }); + } + return ( + (e.prototype.setJoystickSensibility = function (e) { + (this._joystickSensibility = e), + (this._inversedSensibility = + 1 / (this._joystickSensibility / 1e3)); + }), + (e.prototype._onPointerDown = function (t) { + t.preventDefault(), + (true === this._leftJoystick + ? t.clientX < e.halfWidth + : t.clientX > e.halfWidth) && + this._joystickPointerID < 0 + ? ((this._joystickPointerID = t.pointerId), + (this._joystickPointerStartPos.x = t.clientX), + (this._joystickPointerStartPos.y = t.clientY), + (this._joystickPointerPos = + this._joystickPointerStartPos.clone()), + (this._joystickPreviousPointerPos = + this._joystickPointerStartPos.clone()), + (this._deltaJoystickVector.x = 0), + (this._deltaJoystickVector.y = 0), + (this.pressed = true), + this._touches.add(t.pointerId.toString(), t)) + : e._globalJoystickIndex < 2 && + this._action && + (this._action(), + this._touches.add(t.pointerId.toString(), { x: t.clientX, y: t.clientY, prevX: t.clientX, - prevY: t.clientY - })) - } - , - e.prototype._onPointerMove = function(e) { - if (this._joystickPointerID == e.pointerId) { - this._joystickPointerPos.x = e.clientX, - this._joystickPointerPos.y = e.clientY, - this._deltaJoystickVector = this._joystickPointerPos.clone(), - this._deltaJoystickVector = this._deltaJoystickVector.subtract(this._joystickPointerStartPos); - var t = (this.reverseLeftRight ? -1 : 1) * this._deltaJoystickVector.x / this._inversedSensibility; - switch (this._axisTargetedByLeftAndRight) { - case _t.X: - this.deltaPosition.x = Math.min(1, Math.max(-1, t)); - break; - case _t.Y: - this.deltaPosition.y = Math.min(1, Math.max(-1, t)); - break; - case _t.Z: - this.deltaPosition.z = Math.min(1, Math.max(-1, t)) - } - var i = (this.reverseUpDown ? 1 : -1) * this._deltaJoystickVector.y / this._inversedSensibility; - switch (this._axisTargetedByUpAndDown) { - case _t.X: - this.deltaPosition.x = Math.min(1, Math.max(-1, i)); - break; - case _t.Y: - this.deltaPosition.y = Math.min(1, Math.max(-1, i)); - break; - case _t.Z: - this.deltaPosition.z = Math.min(1, Math.max(-1, i)) - } - } else { - var n = this._touches.get(e.pointerId.toString()); - n && (n.x = e.clientX, - n.y = e.clientY) - } - } - , - e.prototype._onPointerUp = function(t) { - if (this._joystickPointerID == t.pointerId) - e.vjCanvasContext.clearRect(this._joystickPointerStartPos.x - 64, this._joystickPointerStartPos.y - 64, 128, 128), - e.vjCanvasContext.clearRect(this._joystickPreviousPointerPos.x - 42, this._joystickPreviousPointerPos.y - 42, 84, 84), - this._joystickPointerID = -1, - this.pressed = false; - else { - var i = this._touches.get(t.pointerId.toString()); - i && e.vjCanvasContext.clearRect(i.prevX - 44, i.prevY - 44, 88, 88) - } - this._deltaJoystickVector.x = 0, - this._deltaJoystickVector.y = 0, - this._touches.remove(t.pointerId.toString()) - } - , - e.prototype.setJoystickColor = function(e) { - this._joystickColor = e - } - , - e.prototype.setActionOnTouch = function(e) { - this._action = e - } - , - e.prototype.setAxisForLeftRight = function(e) { - switch (e) { + prevY: t.clientY, + })); + }), + (e.prototype._onPointerMove = function (e) { + if (this._joystickPointerID == e.pointerId) { + (this._joystickPointerPos.x = e.clientX), + (this._joystickPointerPos.y = e.clientY), + (this._deltaJoystickVector = + this._joystickPointerPos.clone()), + (this._deltaJoystickVector = + this._deltaJoystickVector.subtract( + this._joystickPointerStartPos + )); + var t = + ((this.reverseLeftRight ? -1 : 1) * + this._deltaJoystickVector.x) / + this._inversedSensibility; + switch (this._axisTargetedByLeftAndRight) { case _t.X: + this.deltaPosition.x = Math.min(1, Math.max(-1, t)); + break; case _t.Y: + this.deltaPosition.y = Math.min(1, Math.max(-1, t)); + break; case _t.Z: - this._axisTargetedByLeftAndRight = e; - break; - default: - this._axisTargetedByLeftAndRight = _t.X - } - } - , - e.prototype.setAxisForUpDown = function(e) { - switch (e) { + this.deltaPosition.z = Math.min(1, Math.max(-1, t)); + } + var i = + ((this.reverseUpDown ? 1 : -1) * + this._deltaJoystickVector.y) / + this._inversedSensibility; + switch (this._axisTargetedByUpAndDown) { case _t.X: + this.deltaPosition.x = Math.min(1, Math.max(-1, i)); + break; case _t.Y: + this.deltaPosition.y = Math.min(1, Math.max(-1, i)); + break; case _t.Z: - this._axisTargetedByUpAndDown = e; - break; - default: - this._axisTargetedByUpAndDown = _t.Y - } + this.deltaPosition.z = Math.min(1, Math.max(-1, i)); + } + } else { + var n = this._touches.get(e.pointerId.toString()); + n && ((n.x = e.clientX), (n.y = e.clientY)); } - , - e.prototype._drawVirtualJoystick = function() { - var t = this; - this.pressed && this._touches.forEach(function(i, n) { - n.pointerId === t._joystickPointerID ? (e.vjCanvasContext.clearRect(t._joystickPointerStartPos.x - 64, t._joystickPointerStartPos.y - 64, 128, 128), - e.vjCanvasContext.clearRect(t._joystickPreviousPointerPos.x - 42, t._joystickPreviousPointerPos.y - 42, 84, 84), + }), + (e.prototype._onPointerUp = function (t) { + if (this._joystickPointerID == t.pointerId) + e.vjCanvasContext.clearRect( + this._joystickPointerStartPos.x - 64, + this._joystickPointerStartPos.y - 64, + 128, + 128 + ), + e.vjCanvasContext.clearRect( + this._joystickPreviousPointerPos.x - 42, + this._joystickPreviousPointerPos.y - 42, + 84, + 84 + ), + (this._joystickPointerID = -1), + (this.pressed = false); + else { + var i = this._touches.get(t.pointerId.toString()); + i && + e.vjCanvasContext.clearRect( + i.prevX - 44, + i.prevY - 44, + 88, + 88 + ); + } + (this._deltaJoystickVector.x = 0), + (this._deltaJoystickVector.y = 0), + this._touches.remove(t.pointerId.toString()); + }), + (e.prototype.setJoystickColor = function (e) { + this._joystickColor = e; + }), + (e.prototype.setActionOnTouch = function (e) { + this._action = e; + }), + (e.prototype.setAxisForLeftRight = function (e) { + switch (e) { + case _t.X: + case _t.Y: + case _t.Z: + this._axisTargetedByLeftAndRight = e; + break; + default: + this._axisTargetedByLeftAndRight = _t.X; + } + }), + (e.prototype.setAxisForUpDown = function (e) { + switch (e) { + case _t.X: + case _t.Y: + case _t.Z: + this._axisTargetedByUpAndDown = e; + break; + default: + this._axisTargetedByUpAndDown = _t.Y; + } + }), + (e.prototype._drawVirtualJoystick = function () { + var t = this; + this.pressed && + this._touches.forEach(function (i, n) { + n.pointerId === t._joystickPointerID + ? (e.vjCanvasContext.clearRect( + t._joystickPointerStartPos.x - 64, + t._joystickPointerStartPos.y - 64, + 128, + 128 + ), + e.vjCanvasContext.clearRect( + t._joystickPreviousPointerPos.x - 42, + t._joystickPreviousPointerPos.y - 42, + 84, + 84 + ), e.vjCanvasContext.beginPath(), - e.vjCanvasContext.lineWidth = 6, - e.vjCanvasContext.strokeStyle = t._joystickColor, - e.vjCanvasContext.arc(t._joystickPointerStartPos.x, t._joystickPointerStartPos.y, 40, 0, 2 * Math.PI, true), + (e.vjCanvasContext.lineWidth = 6), + (e.vjCanvasContext.strokeStyle = t._joystickColor), + e.vjCanvasContext.arc( + t._joystickPointerStartPos.x, + t._joystickPointerStartPos.y, + 40, + 0, + 2 * Math.PI, + true + ), e.vjCanvasContext.stroke(), e.vjCanvasContext.closePath(), e.vjCanvasContext.beginPath(), - e.vjCanvasContext.strokeStyle = t._joystickColor, - e.vjCanvasContext.lineWidth = 2, - e.vjCanvasContext.arc(t._joystickPointerStartPos.x, t._joystickPointerStartPos.y, 60, 0, 2 * Math.PI, true), + (e.vjCanvasContext.strokeStyle = t._joystickColor), + (e.vjCanvasContext.lineWidth = 2), + e.vjCanvasContext.arc( + t._joystickPointerStartPos.x, + t._joystickPointerStartPos.y, + 60, + 0, + 2 * Math.PI, + true + ), e.vjCanvasContext.stroke(), e.vjCanvasContext.closePath(), e.vjCanvasContext.beginPath(), - e.vjCanvasContext.strokeStyle = t._joystickColor, - e.vjCanvasContext.arc(t._joystickPointerPos.x, t._joystickPointerPos.y, 40, 0, 2 * Math.PI, true), + (e.vjCanvasContext.strokeStyle = t._joystickColor), + e.vjCanvasContext.arc( + t._joystickPointerPos.x, + t._joystickPointerPos.y, + 40, + 0, + 2 * Math.PI, + true + ), e.vjCanvasContext.stroke(), e.vjCanvasContext.closePath(), - t._joystickPreviousPointerPos = t._joystickPointerPos.clone()) : (e.vjCanvasContext.clearRect(n.prevX - 44, n.prevY - 44, 88, 88), + (t._joystickPreviousPointerPos = + t._joystickPointerPos.clone())) + : (e.vjCanvasContext.clearRect( + n.prevX - 44, + n.prevY - 44, + 88, + 88 + ), e.vjCanvasContext.beginPath(), - e.vjCanvasContext.fillStyle = "white", + (e.vjCanvasContext.fillStyle = "white"), e.vjCanvasContext.beginPath(), - e.vjCanvasContext.strokeStyle = "red", - e.vjCanvasContext.lineWidth = 6, - e.vjCanvasContext.arc(n.x, n.y, 40, 0, 2 * Math.PI, true), + (e.vjCanvasContext.strokeStyle = "red"), + (e.vjCanvasContext.lineWidth = 6), + e.vjCanvasContext.arc( + n.x, + n.y, + 40, + 0, + 2 * Math.PI, + true + ), e.vjCanvasContext.stroke(), e.vjCanvasContext.closePath(), - n.prevX = n.x, - n.prevY = n.y) - }), - requestAnimationFrame(function() { - t._drawVirtualJoystick() - }) + (n.prevX = n.x), + (n.prevY = n.y)); + }), + requestAnimationFrame(function () { + t._drawVirtualJoystick(); + }); + }), + (e.prototype.releaseCanvas = function () { + e.Canvas && + (e.Canvas.removeEventListener( + "pointerdown", + this._onPointerDownHandlerRef + ), + e.Canvas.removeEventListener( + "pointermove", + this._onPointerMoveHandlerRef + ), + e.Canvas.removeEventListener( + "pointerup", + this._onPointerUpHandlerRef + ), + e.Canvas.removeEventListener( + "pointerout", + this._onPointerUpHandlerRef + ), + window.removeEventListener("resize", this._onResize), + document.body.removeChild(e.Canvas), + (e.Canvas = null)); + }), + (e._globalJoystickIndex = 0), + e + ); + })(); + pt.prototype.addVirtualJoystick = function () { + return this.add(new bt()), this; + }; + var bt = (function () { + function e() {} + return ( + (e.prototype.getLeftJoystick = function () { + return this._leftjoystick; + }), + (e.prototype.getRightJoystick = function () { + return this._rightjoystick; + }), + (e.prototype.checkInputs = function () { + if (this._leftjoystick) { + var e = this.camera, + t = 50 * e._computeLocalCameraSpeed(), + i = a.j.RotationYawPitchRoll( + e.rotation.y, + e.rotation.x, + 0 + ), + n = a.x.TransformCoordinates( + new a.x( + this._leftjoystick.deltaPosition.x * t, + this._leftjoystick.deltaPosition.y * t, + this._leftjoystick.deltaPosition.z * t + ), + i + ); + (e.cameraDirection = e.cameraDirection.add(n)), + (e.cameraRotation = e.cameraRotation.addVector3( + this._rightjoystick.deltaPosition + )), + this._leftjoystick.pressed || + (this._leftjoystick.deltaPosition = + this._leftjoystick.deltaPosition.scale(0.9)), + this._rightjoystick.pressed || + (this._rightjoystick.deltaPosition = + this._rightjoystick.deltaPosition.scale(0.9)); } - , - e.prototype.releaseCanvas = function() { - e.Canvas && (e.Canvas.removeEventListener("pointerdown", this._onPointerDownHandlerRef), - e.Canvas.removeEventListener("pointermove", this._onPointerMoveHandlerRef), - e.Canvas.removeEventListener("pointerup", this._onPointerUpHandlerRef), - e.Canvas.removeEventListener("pointerout", this._onPointerUpHandlerRef), - window.removeEventListener("resize", this._onResize), - document.body.removeChild(e.Canvas), - e.Canvas = null) - } - , - e._globalJoystickIndex = 0, - e - }(); - pt.prototype.addVirtualJoystick = function() { - return this.add(new bt), - this - } - ; - var bt = function() { - function e() {} - return e.prototype.getLeftJoystick = function() { - return this._leftjoystick - } - , - e.prototype.getRightJoystick = function() { - return this._rightjoystick - } - , - e.prototype.checkInputs = function() { - if (this._leftjoystick) { - var e = this.camera - , t = 50 * e._computeLocalCameraSpeed() - , i = a.j.RotationYawPitchRoll(e.rotation.y, e.rotation.x, 0) - , n = a.x.TransformCoordinates(new a.x(this._leftjoystick.deltaPosition.x * t,this._leftjoystick.deltaPosition.y * t,this._leftjoystick.deltaPosition.z * t), i); - e.cameraDirection = e.cameraDirection.add(n), - e.cameraRotation = e.cameraRotation.addVector3(this._rightjoystick.deltaPosition), - this._leftjoystick.pressed || (this._leftjoystick.deltaPosition = this._leftjoystick.deltaPosition.scale(.9)), - this._rightjoystick.pressed || (this._rightjoystick.deltaPosition = this._rightjoystick.deltaPosition.scale(.9)) - } - } - , - e.prototype.attachControl = function(e, t) { - this._leftjoystick = new yt(true), - this._leftjoystick.setAxisForUpDown(_t.Z), - this._leftjoystick.setAxisForLeftRight(_t.X), - this._leftjoystick.setJoystickSensibility(.15), - this._rightjoystick = new yt(false), - this._rightjoystick.setAxisForUpDown(_t.X), - this._rightjoystick.setAxisForLeftRight(_t.Y), - this._rightjoystick.reverseUpDown = true, - this._rightjoystick.setJoystickSensibility(.05), - this._rightjoystick.setJoystickColor("yellow") - } - , - e.prototype.detachControl = function(e) { - this._leftjoystick.releaseCanvas(), - this._rightjoystick.releaseCanvas() - } - , - e.prototype.getClassName = function() { - return "FreeCameraVirtualJoystickInput" - } - , - e.prototype.getSimpleName = function() { - return "virtualJoystick" - } - , - e - }(); - Ye.FreeCameraVirtualJoystickInput = bt; - var Et = function(e) { - function t(t, i, n, r) { - void 0 === r && (r = true); - var o = e.call(this, t, i, n, r) || this; - return o.cameraDirection = new a.x(0,0,0), - o.cameraRotation = new a.w(0,0), - o.updateUpVectorFromRotation = false, - o._tmpQuaternion = new a.q, - o.rotation = new a.x(0,0,0), - o.speed = 2, - o.noRotationConstraint = false, - o.lockedTarget = null, - o._currentTarget = a.x.Zero(), - o._initialFocalDistance = 1, - o._viewMatrix = a.j.Zero(), - o._camMatrix = a.j.Zero(), - o._cameraTransformMatrix = a.j.Zero(), - o._cameraRotationMatrix = a.j.Zero(), - o._referencePoint = new a.x(0,0,1), - o._transformedReferencePoint = a.x.Zero(), - o._globalCurrentTarget = a.x.Zero(), - o._globalCurrentUpVector = a.x.Zero(), - o._defaultUp = a.x.Up(), - o._cachedRotationZ = 0, - o._cachedQuaternionRotationZ = 0, - o - } - return h.d(t, e), - t.prototype.getFrontPosition = function(e) { - this.getWorldMatrix(); - var t = this.getTarget().subtract(this.position); - return t.normalize(), + }), + (e.prototype.attachControl = function (e, t) { + (this._leftjoystick = new yt(true)), + this._leftjoystick.setAxisForUpDown(_t.Z), + this._leftjoystick.setAxisForLeftRight(_t.X), + this._leftjoystick.setJoystickSensibility(0.15), + (this._rightjoystick = new yt(false)), + this._rightjoystick.setAxisForUpDown(_t.X), + this._rightjoystick.setAxisForLeftRight(_t.Y), + (this._rightjoystick.reverseUpDown = true), + this._rightjoystick.setJoystickSensibility(0.05), + this._rightjoystick.setJoystickColor("yellow"); + }), + (e.prototype.detachControl = function (e) { + this._leftjoystick.releaseCanvas(), + this._rightjoystick.releaseCanvas(); + }), + (e.prototype.getClassName = function () { + return "FreeCameraVirtualJoystickInput"; + }), + (e.prototype.getSimpleName = function () { + return "virtualJoystick"; + }), + e + ); + })(); + Ye.FreeCameraVirtualJoystickInput = bt; + var Et = (function (e) { + function t(t, i, n, r) { + void 0 === r && (r = true); + var o = e.call(this, t, i, n, r) || this; + return ( + (o.cameraDirection = new a.x(0, 0, 0)), + (o.cameraRotation = new a.w(0, 0)), + (o.updateUpVectorFromRotation = false), + (o._tmpQuaternion = new a.q()), + (o.rotation = new a.x(0, 0, 0)), + (o.speed = 2), + (o.noRotationConstraint = false), + (o.lockedTarget = null), + (o._currentTarget = a.x.Zero()), + (o._initialFocalDistance = 1), + (o._viewMatrix = a.j.Zero()), + (o._camMatrix = a.j.Zero()), + (o._cameraTransformMatrix = a.j.Zero()), + (o._cameraRotationMatrix = a.j.Zero()), + (o._referencePoint = new a.x(0, 0, 1)), + (o._transformedReferencePoint = a.x.Zero()), + (o._globalCurrentTarget = a.x.Zero()), + (o._globalCurrentUpVector = a.x.Zero()), + (o._defaultUp = a.x.Up()), + (o._cachedRotationZ = 0), + (o._cachedQuaternionRotationZ = 0), + o + ); + } + return ( + h.d(t, e), + (t.prototype.getFrontPosition = function (e) { + this.getWorldMatrix(); + var t = this.getTarget().subtract(this.position); + return ( + t.normalize(), t.scaleInPlace(e), this.globalPosition.add(t) - } - , - t.prototype._getLockedTargetPosition = function() { - return this.lockedTarget ? (this.lockedTarget.absolutePosition && this.lockedTarget.computeWorldMatrix(), - this.lockedTarget.absolutePosition || this.lockedTarget) : null - } - , - t.prototype.storeState = function() { - return this._storedPosition = this.position.clone(), - this._storedRotation = this.rotation.clone(), - this.rotationQuaternion && (this._storedRotationQuaternion = this.rotationQuaternion.clone()), + ); + }), + (t.prototype._getLockedTargetPosition = function () { + return this.lockedTarget + ? (this.lockedTarget.absolutePosition && + this.lockedTarget.computeWorldMatrix(), + this.lockedTarget.absolutePosition || + this.lockedTarget) + : null; + }), + (t.prototype.storeState = function () { + return ( + (this._storedPosition = this.position.clone()), + (this._storedRotation = this.rotation.clone()), + this.rotationQuaternion && + (this._storedRotationQuaternion = + this.rotationQuaternion.clone()), e.prototype.storeState.call(this) - } - , - t.prototype._restoreStateValues = function() { - return !!e.prototype._restoreStateValues.call(this) && (this.position = this._storedPosition.clone(), - this.rotation = this._storedRotation.clone(), - this.rotationQuaternion && (this.rotationQuaternion = this._storedRotationQuaternion.clone()), + ); + }), + (t.prototype._restoreStateValues = function () { + return ( + !!e.prototype._restoreStateValues.call(this) && + ((this.position = this._storedPosition.clone()), + (this.rotation = this._storedRotation.clone()), + this.rotationQuaternion && + (this.rotationQuaternion = + this._storedRotationQuaternion.clone()), this.cameraDirection.copyFromFloats(0, 0, 0), this.cameraRotation.copyFromFloats(0, 0), true) - } - , - t.prototype._initCache = function() { - e.prototype._initCache.call(this), - this._cache.lockedTarget = new a.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), - this._cache.rotation = new a.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), - this._cache.rotationQuaternion = new a.q(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE) - } - , - t.prototype._updateCache = function(t) { - t || e.prototype._updateCache.call(this); - var i = this._getLockedTargetPosition(); - i ? this._cache.lockedTarget ? this._cache.lockedTarget.copyFrom(i) : this._cache.lockedTarget = i.clone() : this._cache.lockedTarget = null, + ); + }), + (t.prototype._initCache = function () { + e.prototype._initCache.call(this), + (this._cache.lockedTarget = new a.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )), + (this._cache.rotation = new a.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )), + (this._cache.rotationQuaternion = new a.q( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )); + }), + (t.prototype._updateCache = function (t) { + t || e.prototype._updateCache.call(this); + var i = this._getLockedTargetPosition(); + i + ? this._cache.lockedTarget + ? this._cache.lockedTarget.copyFrom(i) + : (this._cache.lockedTarget = i.clone()) + : (this._cache.lockedTarget = null), this._cache.rotation.copyFrom(this.rotation), - this.rotationQuaternion && this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion) - } - , - t.prototype._isSynchronizedViewMatrix = function() { - if (!e.prototype._isSynchronizedViewMatrix.call(this)) - return false; - var t = this._getLockedTargetPosition(); - return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(t) : !t) && (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation)) - } - , - t.prototype._computeLocalCameraSpeed = function() { - var e = this.getEngine(); - return this.speed * Math.sqrt(e.getDeltaTime() / (100 * e.getFps())) - } - , - t.prototype.setTarget = function(e) { - this.upVector.normalize(), - this._initialFocalDistance = e.subtract(this.position).length(), + this.rotationQuaternion && + this._cache.rotationQuaternion.copyFrom( + this.rotationQuaternion + ); + }), + (t.prototype._isSynchronizedViewMatrix = function () { + if (!e.prototype._isSynchronizedViewMatrix.call(this)) + return false; + var t = this._getLockedTargetPosition(); + return ( + (this._cache.lockedTarget + ? this._cache.lockedTarget.equals(t) + : !t) && + (this.rotationQuaternion + ? this.rotationQuaternion.equals( + this._cache.rotationQuaternion + ) + : this._cache.rotation.equals(this.rotation)) + ); + }), + (t.prototype._computeLocalCameraSpeed = function () { + var e = this.getEngine(); + return ( + this.speed * + Math.sqrt(e.getDeltaTime() / (100 * e.getFps())) + ); + }), + (t.prototype.setTarget = function (e) { + this.upVector.normalize(), + (this._initialFocalDistance = e + .subtract(this.position) + .length()), this.position.z === e.z && (this.position.z += a.h), - a.j.LookAtLHToRef(this.position, e, this._defaultUp, this._camMatrix), + a.j.LookAtLHToRef( + this.position, + e, + this._defaultUp, + this._camMatrix + ), this._camMatrix.invert(), - this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]); - var t = e.subtract(this.position); - t.x >= 0 ? this.rotation.y = -Math.atan(t.z / t.x) + Math.PI / 2 : this.rotation.y = -Math.atan(t.z / t.x) - Math.PI / 2, - this.rotation.z = 0, + (this.rotation.x = Math.atan( + this._camMatrix.m[6] / this._camMatrix.m[10] + )); + var t = e.subtract(this.position); + t.x >= 0 + ? (this.rotation.y = + -Math.atan(t.z / t.x) + Math.PI / 2) + : (this.rotation.y = + -Math.atan(t.z / t.x) - Math.PI / 2), + (this.rotation.z = 0), isNaN(this.rotation.x) && (this.rotation.x = 0), isNaN(this.rotation.y) && (this.rotation.y = 0), isNaN(this.rotation.z) && (this.rotation.z = 0), - this.rotationQuaternion && a.q.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion) - } - , - t.prototype.getTarget = function() { - return this._currentTarget - } - , - t.prototype._decideIfNeedsToMove = function() { - return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0 - } - , - t.prototype._updatePosition = function() { - if (this.parent) - return this.parent.getWorldMatrix().invertToRef(a.t.Matrix[0]), - a.x.TransformNormalToRef(this.cameraDirection, a.t.Matrix[0], a.t.Vector3[0]), - void this.position.addInPlace(a.t.Vector3[0]); - this.position.addInPlace(this.cameraDirection) - } - , - t.prototype._checkInputs = function() { - var t = this._decideIfNeedsToMove() - , i = Math.abs(this.cameraRotation.x) > 0 || Math.abs(this.cameraRotation.y) > 0; - if (t && this._updatePosition(), - i && (this.rotation.x += this.cameraRotation.x, - this.rotation.y += this.cameraRotation.y, - this.rotationQuaternion && this.rotation.lengthSquared() && a.q.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion), - !this.noRotationConstraint)) { - var n = Math.PI / 2 * .95; - this.rotation.x > n && (this.rotation.x = n), - this.rotation.x < -n && (this.rotation.x = -n) - } - t && (Math.abs(this.cameraDirection.x) < this.speed * a.h && (this.cameraDirection.x = 0), - Math.abs(this.cameraDirection.y) < this.speed * a.h && (this.cameraDirection.y = 0), - Math.abs(this.cameraDirection.z) < this.speed * a.h && (this.cameraDirection.z = 0), + this.rotationQuaternion && + a.q.RotationYawPitchRollToRef( + this.rotation.y, + this.rotation.x, + this.rotation.z, + this.rotationQuaternion + ); + }), + (t.prototype.getTarget = function () { + return this._currentTarget; + }), + (t.prototype._decideIfNeedsToMove = function () { + return ( + Math.abs(this.cameraDirection.x) > 0 || + Math.abs(this.cameraDirection.y) > 0 || + Math.abs(this.cameraDirection.z) > 0 + ); + }), + (t.prototype._updatePosition = function () { + if (this.parent) + return ( + this.parent + .getWorldMatrix() + .invertToRef(a.t.Matrix[0]), + a.x.TransformNormalToRef( + this.cameraDirection, + a.t.Matrix[0], + a.t.Vector3[0] + ), + void this.position.addInPlace(a.t.Vector3[0]) + ); + this.position.addInPlace(this.cameraDirection); + }), + (t.prototype._checkInputs = function () { + var t = this._decideIfNeedsToMove(), + i = + Math.abs(this.cameraRotation.x) > 0 || + Math.abs(this.cameraRotation.y) > 0; + if ( + (t && this._updatePosition(), + i && + ((this.rotation.x += this.cameraRotation.x), + (this.rotation.y += this.cameraRotation.y), + this.rotationQuaternion && + this.rotation.lengthSquared() && + a.q.RotationYawPitchRollToRef( + this.rotation.y, + this.rotation.x, + this.rotation.z, + this.rotationQuaternion + ), + !this.noRotationConstraint)) + ) { + var n = (Math.PI / 2) * 0.95; + this.rotation.x > n && (this.rotation.x = n), + this.rotation.x < -n && (this.rotation.x = -n); + } + t && + (Math.abs(this.cameraDirection.x) < this.speed * a.h && + (this.cameraDirection.x = 0), + Math.abs(this.cameraDirection.y) < this.speed * a.h && + (this.cameraDirection.y = 0), + Math.abs(this.cameraDirection.z) < this.speed * a.h && + (this.cameraDirection.z = 0), this.cameraDirection.scaleInPlace(this.inertia)), - i && (Math.abs(this.cameraRotation.x) < this.speed * a.h && (this.cameraRotation.x = 0), - Math.abs(this.cameraRotation.y) < this.speed * a.h && (this.cameraRotation.y = 0), - this.cameraRotation.scaleInPlace(this.inertia)), - e.prototype._checkInputs.call(this) - } - , - t.prototype._updateCameraRotationMatrix = function() { - this.rotationQuaternion ? this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix) : a.j.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix) - } - , - t.prototype._rotateUpVectorWithCameraRotationMatrix = function() { - return a.x.TransformNormalToRef(this._defaultUp, this._cameraRotationMatrix, this.upVector), - this - } - , - t.prototype._getViewMatrix = function() { - return this.lockedTarget && this.setTarget(this._getLockedTargetPosition()), + i && + (Math.abs(this.cameraRotation.x) < this.speed * a.h && + (this.cameraRotation.x = 0), + Math.abs(this.cameraRotation.y) < this.speed * a.h && + (this.cameraRotation.y = 0), + this.cameraRotation.scaleInPlace(this.inertia)), + e.prototype._checkInputs.call(this); + }), + (t.prototype._updateCameraRotationMatrix = function () { + this.rotationQuaternion + ? this.rotationQuaternion.toRotationMatrix( + this._cameraRotationMatrix + ) + : a.j.RotationYawPitchRollToRef( + this.rotation.y, + this.rotation.x, + this.rotation.z, + this._cameraRotationMatrix + ); + }), + (t.prototype._rotateUpVectorWithCameraRotationMatrix = + function () { + return ( + a.x.TransformNormalToRef( + this._defaultUp, + this._cameraRotationMatrix, + this.upVector + ), + this + ); + }), + (t.prototype._getViewMatrix = function () { + return ( + this.lockedTarget && + this.setTarget(this._getLockedTargetPosition()), this._updateCameraRotationMatrix(), - this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z ? (this._rotateUpVectorWithCameraRotationMatrix(), - this._cachedQuaternionRotationZ = this.rotationQuaternion.z) : this._cachedRotationZ != this.rotation.z && (this._rotateUpVectorWithCameraRotationMatrix(), - this._cachedRotationZ = this.rotation.z), - a.x.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint), - this.position.addToRef(this._transformedReferencePoint, this._currentTarget), - this.updateUpVectorFromRotation && (this.rotationQuaternion ? a.c.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector) : (a.q.FromEulerVectorToRef(this.rotation, this._tmpQuaternion), - a.c.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector))), - this._computeViewMatrix(this.position, this._currentTarget, this.upVector), + this.rotationQuaternion && + this._cachedQuaternionRotationZ != + this.rotationQuaternion.z + ? (this._rotateUpVectorWithCameraRotationMatrix(), + (this._cachedQuaternionRotationZ = + this.rotationQuaternion.z)) + : this._cachedRotationZ != this.rotation.z && + (this._rotateUpVectorWithCameraRotationMatrix(), + (this._cachedRotationZ = this.rotation.z)), + a.x.TransformCoordinatesToRef( + this._referencePoint, + this._cameraRotationMatrix, + this._transformedReferencePoint + ), + this.position.addToRef( + this._transformedReferencePoint, + this._currentTarget + ), + this.updateUpVectorFromRotation && + (this.rotationQuaternion + ? a.c.Y.rotateByQuaternionToRef( + this.rotationQuaternion, + this.upVector + ) + : (a.q.FromEulerVectorToRef( + this.rotation, + this._tmpQuaternion + ), + a.c.Y.rotateByQuaternionToRef( + this._tmpQuaternion, + this.upVector + ))), + this._computeViewMatrix( + this.position, + this._currentTarget, + this.upVector + ), this._viewMatrix - } - , - t.prototype._computeViewMatrix = function(e, t, i) { - if (this.parent) { - var n = this.parent.getWorldMatrix(); - a.x.TransformCoordinatesToRef(e, n, this._globalPosition), - a.x.TransformCoordinatesToRef(t, n, this._globalCurrentTarget), - a.x.TransformNormalToRef(i, n, this._globalCurrentUpVector), - this._markSyncedWithParent() - } else - this._globalPosition.copyFrom(e), - this._globalCurrentTarget.copyFrom(t), - this._globalCurrentUpVector.copyFrom(i); - this.getScene().useRightHandedSystem ? a.j.LookAtRHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix) : a.j.LookAtLHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix) - } - , - t.prototype.createRigCamera = function(e, i) { - if (this.cameraRigMode !== ke.a.RIG_MODE_NONE) { - var n = new t(e,this.position.clone(),this.getScene()); - return this.cameraRigMode !== ke.a.RIG_MODE_VR && this.cameraRigMode !== ke.a.RIG_MODE_WEBVR || (this.rotationQuaternion || (this.rotationQuaternion = new a.q), - n._cameraRigParams = {}, - n.rotationQuaternion = new a.q), - n - } - return null - } - , - t.prototype._updateRigCameras = function() { - var t = this._rigCameras[0] - , i = this._rigCameras[1]; - switch (this.computeWorldMatrix(), - this.cameraRigMode) { + ); + }), + (t.prototype._computeViewMatrix = function (e, t, i) { + if (this.parent) { + var n = this.parent.getWorldMatrix(); + a.x.TransformCoordinatesToRef( + e, + n, + this._globalPosition + ), + a.x.TransformCoordinatesToRef( + t, + n, + this._globalCurrentTarget + ), + a.x.TransformNormalToRef( + i, + n, + this._globalCurrentUpVector + ), + this._markSyncedWithParent(); + } else + this._globalPosition.copyFrom(e), + this._globalCurrentTarget.copyFrom(t), + this._globalCurrentUpVector.copyFrom(i); + this.getScene().useRightHandedSystem + ? a.j.LookAtRHToRef( + this._globalPosition, + this._globalCurrentTarget, + this._globalCurrentUpVector, + this._viewMatrix + ) + : a.j.LookAtLHToRef( + this._globalPosition, + this._globalCurrentTarget, + this._globalCurrentUpVector, + this._viewMatrix + ); + }), + (t.prototype.createRigCamera = function (e, i) { + if (this.cameraRigMode !== ke.a.RIG_MODE_NONE) { + var n = new t( + e, + this.position.clone(), + this.getScene() + ); + return ( + (this.cameraRigMode !== ke.a.RIG_MODE_VR && + this.cameraRigMode !== ke.a.RIG_MODE_WEBVR) || + (this.rotationQuaternion || + (this.rotationQuaternion = new a.q()), + (n._cameraRigParams = {}), + (n.rotationQuaternion = new a.q())), + n + ); + } + return null; + }), + (t.prototype._updateRigCameras = function () { + var t = this._rigCameras[0], + i = this._rigCameras[1]; + switch ((this.computeWorldMatrix(), this.cameraRigMode)) { case ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH: case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: case ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER: - var n = this.cameraRigMode === ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? 1 : -1 - , r = this.cameraRigMode === ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? -1 : 1; - this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * n, t), - this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * r, i); - break; + var n = + this.cameraRigMode === + ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED + ? 1 + : -1, + r = + this.cameraRigMode === + ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED + ? -1 + : 1; + this._getRigCamPositionAndTarget( + this._cameraRigParams.stereoHalfAngle * n, + t + ), + this._getRigCamPositionAndTarget( + this._cameraRigParams.stereoHalfAngle * r, + i + ); + break; case ke.a.RIG_MODE_VR: - t.rotationQuaternion ? (t.rotationQuaternion.copyFrom(this.rotationQuaternion), - i.rotationQuaternion.copyFrom(this.rotationQuaternion)) : (t.rotation.copyFrom(this.rotation), - i.rotation.copyFrom(this.rotation)), + t.rotationQuaternion + ? (t.rotationQuaternion.copyFrom( + this.rotationQuaternion + ), + i.rotationQuaternion.copyFrom( + this.rotationQuaternion + )) + : (t.rotation.copyFrom(this.rotation), + i.rotation.copyFrom(this.rotation)), t.position.copyFrom(this.position), - i.position.copyFrom(this.position) - } - e.prototype._updateRigCameras.call(this) - } - , - t.prototype._getRigCamPositionAndTarget = function(e, i) { - this.getTarget().subtractToRef(this.position, t._TargetFocalPoint), - t._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance); - var n = t._TargetFocalPoint.addInPlace(this.position); - a.j.TranslationToRef(-n.x, -n.y, -n.z, t._TargetTransformMatrix), - t._TargetTransformMatrix.multiplyToRef(a.j.RotationY(e), t._RigCamTransformMatrix), - a.j.TranslationToRef(n.x, n.y, n.z, t._TargetTransformMatrix), - t._RigCamTransformMatrix.multiplyToRef(t._TargetTransformMatrix, t._RigCamTransformMatrix), - a.x.TransformCoordinatesToRef(this.position, t._RigCamTransformMatrix, i.position), - i.setTarget(n) - } - , - t.prototype.getClassName = function() { - return "TargetCamera" - } - , - t._RigCamTransformMatrix = new a.j, - t._TargetTransformMatrix = new a.j, - t._TargetFocalPoint = new a.x, + i.position.copyFrom(this.position); + } + e.prototype._updateRigCameras.call(this); + }), + (t.prototype._getRigCamPositionAndTarget = function (e, i) { + this.getTarget().subtractToRef( + this.position, + t._TargetFocalPoint + ), + t._TargetFocalPoint + .normalize() + .scaleInPlace(this._initialFocalDistance); + var n = t._TargetFocalPoint.addInPlace(this.position); + a.j.TranslationToRef( + -n.x, + -n.y, + -n.z, + t._TargetTransformMatrix + ), + t._TargetTransformMatrix.multiplyToRef( + a.j.RotationY(e), + t._RigCamTransformMatrix + ), + a.j.TranslationToRef( + n.x, + n.y, + n.z, + t._TargetTransformMatrix + ), + t._RigCamTransformMatrix.multiplyToRef( + t._TargetTransformMatrix, + t._RigCamTransformMatrix + ), + a.x.TransformCoordinatesToRef( + this.position, + t._RigCamTransformMatrix, + i.position + ), + i.setTarget(n); + }), + (t.prototype.getClassName = function () { + return "TargetCamera"; + }), + (t._RigCamTransformMatrix = new a.j()), + (t._TargetTransformMatrix = new a.j()), + (t._TargetFocalPoint = new a.x()), h.c([Object(F.o)()], t.prototype, "rotation", void 0), h.c([Object(F.c)()], t.prototype, "speed", void 0), - h.c([Object(F.k)("lockedTargetId")], t.prototype, "lockedTarget", void 0), + h.c( + [Object(F.k)("lockedTargetId")], + t.prototype, + "lockedTarget", + void 0 + ), t - }(ke.a) - , Tt = function(e) { - function t(t, i, n, r) { - void 0 === r && (r = true); - var o = e.call(this, t, i, n, r) || this; - return o.ellipsoid = new a.x(.5,1,.5), - o.ellipsoidOffset = new a.x(0,0,0), - o.checkCollisions = false, - o.applyGravity = false, - o._needMoveForGravity = false, - o._oldPosition = a.x.Zero(), - o._diffPosition = a.x.Zero(), - o._newPosition = a.x.Zero(), - o._collisionMask = -1, - o._onCollisionPositionChange = function(e, t, i) { - var n; - void 0 === i && (i = null), - n = t, - o._newPosition.copyFrom(n), - o._newPosition.subtractToRef(o._oldPosition, o._diffPosition), - o._diffPosition.length() > ve.b.CollisionsEpsilon && (o.position.addInPlace(o._diffPosition), - o.onCollide && i && o.onCollide(i)) - } - , - o.inputs = new pt(o), - o.inputs.addKeyboard().addMouse(), - o - } - return h.d(t, e), + ); + })(ke.a), + Tt = (function (e) { + function t(t, i, n, r) { + void 0 === r && (r = true); + var o = e.call(this, t, i, n, r) || this; + return ( + (o.ellipsoid = new a.x(0.5, 1, 0.5)), + (o.ellipsoidOffset = new a.x(0, 0, 0)), + (o.checkCollisions = false), + (o.applyGravity = false), + (o._needMoveForGravity = false), + (o._oldPosition = a.x.Zero()), + (o._diffPosition = a.x.Zero()), + (o._newPosition = a.x.Zero()), + (o._collisionMask = -1), + (o._onCollisionPositionChange = function (e, t, i) { + var n; + void 0 === i && (i = null), + (n = t), + o._newPosition.copyFrom(n), + o._newPosition.subtractToRef( + o._oldPosition, + o._diffPosition + ), + o._diffPosition.length() > ve.b.CollisionsEpsilon && + (o.position.addInPlace(o._diffPosition), + o.onCollide && i && o.onCollide(i)); + }), + (o.inputs = new pt(o)), + o.inputs.addKeyboard().addMouse(), + o + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "angularSensibility", { - get: function() { - var e = this.inputs.attached.mouse; - return e ? e.angularSensibility : 0 - }, - set: function(e) { - var t = this.inputs.attached.mouse; - t && (t.angularSensibility = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.mouse; + return e ? e.angularSensibility : 0; + }, + set: function (e) { + var t = this.inputs.attached.mouse; + t && (t.angularSensibility = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysUp", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysUp : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysUp = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysUp : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysUp = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysDown", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysDown : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysDown = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysDown : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysDown = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysLeft", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysLeft : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysLeft = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysLeft : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysLeft = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysRight", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysRight : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysRight = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysRight : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysRight = e); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.attachControl = function (e, t) { + this.inputs.attachElement(e, t); + }), + (t.prototype.detachControl = function (e) { + this.inputs.detachElement(e), + (this.cameraDirection = new a.x(0, 0, 0)), + (this.cameraRotation = new a.w(0, 0)); }), - t.prototype.attachControl = function(e, t) { - this.inputs.attachElement(e, t) - } - , - t.prototype.detachControl = function(e) { - this.inputs.detachElement(e), - this.cameraDirection = new a.x(0,0,0), - this.cameraRotation = new a.w(0,0) - } - , Object.defineProperty(t.prototype, "collisionMask", { - get: function() { - return this._collisionMask - }, - set: function(e) { - this._collisionMask = isNaN(e) ? -1 : e - }, - enumerable: true, - configurable: true + get: function () { + return this._collisionMask; + }, + set: function (e) { + this._collisionMask = isNaN(e) ? -1 : e; + }, + enumerable: true, + configurable: true, }), - t.prototype._collideWithWorld = function(e) { - (this.parent ? a.x.TransformCoordinates(this.position, this.parent.getWorldMatrix()) : this.position).subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition), + (t.prototype._collideWithWorld = function (e) { + (this.parent + ? a.x.TransformCoordinates( + this.position, + this.parent.getWorldMatrix() + ) + : this.position + ).subtractFromFloatsToRef( + 0, + this.ellipsoid.y, + 0, + this._oldPosition + ), this._oldPosition.addInPlace(this.ellipsoidOffset); - var t = this.getScene().collisionCoordinator; - this._collider || (this._collider = t.createCollider()), - this._collider._radius = this.ellipsoid, - this._collider.collisionMask = this._collisionMask; - var i = e; - this.applyGravity && (i = e.add(this.getScene().gravity)), - t.getNewPosition(this._oldPosition, i, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId) - } - , - t.prototype._checkInputs = function() { - this._localDirection || (this._localDirection = a.x.Zero(), - this._transformedDirection = a.x.Zero()), + var t = this.getScene().collisionCoordinator; + this._collider || (this._collider = t.createCollider()), + (this._collider._radius = this.ellipsoid), + (this._collider.collisionMask = this._collisionMask); + var i = e; + this.applyGravity && (i = e.add(this.getScene().gravity)), + t.getNewPosition( + this._oldPosition, + i, + this._collider, + 3, + null, + this._onCollisionPositionChange, + this.uniqueId + ); + }), + (t.prototype._checkInputs = function () { + this._localDirection || + ((this._localDirection = a.x.Zero()), + (this._transformedDirection = a.x.Zero())), this.inputs.checkInputs(), - e.prototype._checkInputs.call(this) - } - , - t.prototype._decideIfNeedsToMove = function() { - return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0 - } - , - t.prototype._updatePosition = function() { - this.checkCollisions && this.getScene().collisionsEnabled ? this._collideWithWorld(this.cameraDirection) : e.prototype._updatePosition.call(this) - } - , - t.prototype.dispose = function() { - this.inputs.clear(), - e.prototype.dispose.call(this) - } - , - t.prototype.getClassName = function() { - return "FreeCamera" - } - , + e.prototype._checkInputs.call(this); + }), + (t.prototype._decideIfNeedsToMove = function () { + return ( + this._needMoveForGravity || + Math.abs(this.cameraDirection.x) > 0 || + Math.abs(this.cameraDirection.y) > 0 || + Math.abs(this.cameraDirection.z) > 0 + ); + }), + (t.prototype._updatePosition = function () { + this.checkCollisions && this.getScene().collisionsEnabled + ? this._collideWithWorld(this.cameraDirection) + : e.prototype._updatePosition.call(this); + }), + (t.prototype.dispose = function () { + this.inputs.clear(), e.prototype.dispose.call(this); + }), + (t.prototype.getClassName = function () { + return "FreeCamera"; + }), h.c([Object(F.o)()], t.prototype, "ellipsoid", void 0), - h.c([Object(F.o)()], t.prototype, "ellipsoidOffset", void 0), - h.c([Object(F.c)()], t.prototype, "checkCollisions", void 0), + h.c( + [Object(F.o)()], + t.prototype, + "ellipsoidOffset", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "checkCollisions", + void 0 + ), h.c([Object(F.c)()], t.prototype, "applyGravity", void 0), t - }(Et); - N.a.AddNodeConstructor("TouchCamera", function(e, t) { - return function() { - return new At(e,a.x.Zero(),t) + ); + })(Et); + N.a.AddNodeConstructor("TouchCamera", function (e, t) { + return function () { + return new At(e, a.x.Zero(), t); + }; + }); + var At = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, i, n) || this; + return r.inputs.addTouch(), r._setupInputs(), r; + } + return ( + h.d(t, e), + Object.defineProperty( + t.prototype, + "touchAngularSensibility", + { + get: function () { + var e = this.inputs.attached.touch; + return e ? e.touchAngularSensibility : 0; + }, + set: function (e) { + var t = this.inputs.attached.touch; + t && (t.touchAngularSensibility = e); + }, + enumerable: true, + configurable: true, } - }); - var At = function(e) { - function t(t, i, n) { - var r = e.call(this, t, i, n) || this; - return r.inputs.addTouch(), - r._setupInputs(), - r - } - return h.d(t, e), - Object.defineProperty(t.prototype, "touchAngularSensibility", { - get: function() { - var e = this.inputs.attached.touch; - return e ? e.touchAngularSensibility : 0 - }, - set: function(e) { - var t = this.inputs.attached.touch; - t && (t.touchAngularSensibility = e) - }, - enumerable: true, - configurable: true + ), + Object.defineProperty(t.prototype, "touchMoveSensibility", { + get: function () { + var e = this.inputs.attached.touch; + return e ? e.touchMoveSensibility : 0; + }, + set: function (e) { + var t = this.inputs.attached.touch; + t && (t.touchMoveSensibility = e); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "TouchCamera"; + }), + (t.prototype._setupInputs = function () { + var e = this.inputs.attached.mouse; + e && (e.touchEnabled = false); + }), + t + ); + })(Tt); + N.a.AddNodeConstructor("ArcRotateCamera", function (e, t) { + return function () { + return new xt(e, 0, 0, 1, a.x.Zero(), t); + }; + }); + var xt = (function (e) { + function t(t, i, n, r, s, c, u) { + void 0 === u && (u = true); + var l = e.call(this, t, a.x.Zero(), c, u) || this; + return ( + (l._upVector = a.x.Up()), + (l.inertialAlphaOffset = 0), + (l.inertialBetaOffset = 0), + (l.inertialRadiusOffset = 0), + (l.lowerAlphaLimit = null), + (l.upperAlphaLimit = null), + (l.lowerBetaLimit = 0.01), + (l.upperBetaLimit = Math.PI - 0.01), + (l.lowerRadiusLimit = null), + (l.upperRadiusLimit = null), + (l.inertialPanningX = 0), + (l.inertialPanningY = 0), + (l.pinchToPanMaxDistance = 20), + (l.panningDistanceLimit = null), + (l.panningOriginTarget = a.x.Zero()), + (l.panningInertia = 0.9), + (l.zoomOnFactor = 1), + (l.targetScreenOffset = a.w.Zero()), + (l.allowUpsideDown = true), + (l.useInputToRestoreState = true), + (l._viewMatrix = new a.j()), + (l.panningAxis = new a.x(1, 1, 0)), + (l.onMeshTargetChangedObservable = new o.c()), + (l.checkCollisions = false), + (l.collisionRadius = new a.x(0.5, 0.5, 0.5)), + (l._previousPosition = a.x.Zero()), + (l._collisionVelocity = a.x.Zero()), + (l._newPosition = a.x.Zero()), + (l._computationVector = a.x.Zero()), + (l._onCollisionPositionChange = function (e, t, i) { + void 0 === i && (i = null), + i + ? (l.setPosition(t), l.onCollide && l.onCollide(i)) + : l._previousPosition.copyFrom(l._position); + var n = Math.cos(l.alpha), + r = Math.sin(l.alpha), + o = Math.cos(l.beta), + a = Math.sin(l.beta); + 0 === a && (a = 1e-4); + var s = l._getTargetPosition(); + l._computationVector.copyFromFloats( + l.radius * n * a, + l.radius * o, + l.radius * r * a + ), + s.addToRef(l._computationVector, l._newPosition), + l._position.copyFrom(l._newPosition); + var c = l.upVector; + l.allowUpsideDown && + l.beta < 0 && + (c = (c = c.clone()).negate()), + l._computeViewMatrix(l._position, s, c), + l._viewMatrix.addAtIndex(12, l.targetScreenOffset.x), + l._viewMatrix.addAtIndex(13, l.targetScreenOffset.y), + (l._collisionTriggered = false); }), - Object.defineProperty(t.prototype, "touchMoveSensibility", { - get: function() { - var e = this.inputs.attached.touch; - return e ? e.touchMoveSensibility : 0 + (l._target = a.x.Zero()), + s && l.setTarget(s), + (l.alpha = i), + (l.beta = n), + (l.radius = r), + l.getViewMatrix(), + (l.inputs = new rt(l)), + l.inputs.addKeyboard().addMouseWheel().addPointers(), + l + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "target", { + get: function () { + return this._target; + }, + set: function (e) { + this.setTarget(e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "position", { + get: function () { + return this._position; + }, + set: function (e) { + this.setPosition(e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "upVector", { + get: function () { + return this._upVector; + }, + set: function (e) { + this._upToYMatrix || + ((this._YToUpMatrix = new a.j()), + (this._upToYMatrix = new a.j()), + (this._upVector = a.x.Zero())), + e.normalize(), + this._upVector.copyFrom(e), + this.setMatUp(); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.setMatUp = function () { + a.j.RotationAlignToRef( + a.x.UpReadOnly, + this._upVector, + this._YToUpMatrix + ), + a.j.RotationAlignToRef( + this._upVector, + a.x.UpReadOnly, + this._upToYMatrix + ); + }), + Object.defineProperty(t.prototype, "angularSensibilityX", { + get: function () { + var e = this.inputs.attached.pointers; + return e ? e.angularSensibilityX : 0; + }, + set: function (e) { + var t = this.inputs.attached.pointers; + t && (t.angularSensibilityX = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "angularSensibilityY", { + get: function () { + var e = this.inputs.attached.pointers; + return e ? e.angularSensibilityY : 0; + }, + set: function (e) { + var t = this.inputs.attached.pointers; + t && (t.angularSensibilityY = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "pinchPrecision", { + get: function () { + var e = this.inputs.attached.pointers; + return e ? e.pinchPrecision : 0; + }, + set: function (e) { + var t = this.inputs.attached.pointers; + t && (t.pinchPrecision = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "pinchDeltaPercentage", { + get: function () { + var e = this.inputs.attached.pointers; + return e ? e.pinchDeltaPercentage : 0; + }, + set: function (e) { + var t = this.inputs.attached.pointers; + t && (t.pinchDeltaPercentage = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "panningSensibility", { + get: function () { + var e = this.inputs.attached.pointers; + return e ? e.panningSensibility : 0; + }, + set: function (e) { + var t = this.inputs.attached.pointers; + t && (t.panningSensibility = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "keysUp", { + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysUp : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysUp = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "keysDown", { + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysDown : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysDown = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "keysLeft", { + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysLeft : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysLeft = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "keysRight", { + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysRight : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysRight = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "wheelPrecision", { + get: function () { + var e = this.inputs.attached.mousewheel; + return e ? e.wheelPrecision : 0; + }, + set: function (e) { + var t = this.inputs.attached.mousewheel; + t && (t.wheelPrecision = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "wheelDeltaPercentage", { + get: function () { + var e = this.inputs.attached.mousewheel; + return e ? e.wheelDeltaPercentage : 0; + }, + set: function (e) { + var t = this.inputs.attached.mousewheel; + t && (t.wheelDeltaPercentage = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "bouncingBehavior", { + get: function () { + return this._bouncingBehavior; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "useBouncingBehavior", { + get: function () { + return null != this._bouncingBehavior; + }, + set: function (e) { + e !== this.useBouncingBehavior && + (e + ? ((this._bouncingBehavior = new Oe()), + this.addBehavior(this._bouncingBehavior)) + : this._bouncingBehavior && + (this.removeBehavior(this._bouncingBehavior), + (this._bouncingBehavior = null))); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "framingBehavior", { + get: function () { + return this._framingBehavior; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "useFramingBehavior", { + get: function () { + return null != this._framingBehavior; + }, + set: function (e) { + e !== this.useFramingBehavior && + (e + ? ((this._framingBehavior = new we()), + this.addBehavior(this._framingBehavior)) + : this._framingBehavior && + (this.removeBehavior(this._framingBehavior), + (this._framingBehavior = null))); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "autoRotationBehavior", { + get: function () { + return this._autoRotationBehavior; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "useAutoRotationBehavior", + { + get: function () { + return null != this._autoRotationBehavior; + }, + set: function (e) { + e !== this.useAutoRotationBehavior && + (e + ? ((this._autoRotationBehavior = new Me()), + this.addBehavior(this._autoRotationBehavior)) + : this._autoRotationBehavior && + (this.removeBehavior(this._autoRotationBehavior), + (this._autoRotationBehavior = null))); + }, + enumerable: true, + configurable: true, + } + ), + (t.prototype._initCache = function () { + e.prototype._initCache.call(this), + (this._cache._target = new a.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )), + (this._cache.alpha = void 0), + (this._cache.beta = void 0), + (this._cache.radius = void 0), + (this._cache.targetScreenOffset = a.w.Zero()); + }), + (t.prototype._updateCache = function (t) { + t || e.prototype._updateCache.call(this), + this._cache._target.copyFrom(this._getTargetPosition()), + (this._cache.alpha = this.alpha), + (this._cache.beta = this.beta), + (this._cache.radius = this.radius), + this._cache.targetScreenOffset.copyFrom( + this.targetScreenOffset + ); + }), + (t.prototype._getTargetPosition = function () { + if ( + this._targetHost && + this._targetHost.getAbsolutePosition + ) { + var e = this._targetHost.absolutePosition; + this._targetBoundingCenter + ? e.addToRef(this._targetBoundingCenter, this._target) + : this._target.copyFrom(e); + } + return this._getLockedTargetPosition() || this._target; + }), + (t.prototype.storeState = function () { + return ( + (this._storedAlpha = this.alpha), + (this._storedBeta = this.beta), + (this._storedRadius = this.radius), + (this._storedTarget = this._getTargetPosition().clone()), + e.prototype.storeState.call(this) + ); + }), + (t.prototype._restoreStateValues = function () { + return ( + !!e.prototype._restoreStateValues.call(this) && + ((this.alpha = this._storedAlpha), + (this.beta = this._storedBeta), + (this.radius = this._storedRadius), + this.setTarget(this._storedTarget.clone()), + (this.inertialAlphaOffset = 0), + (this.inertialBetaOffset = 0), + (this.inertialRadiusOffset = 0), + (this.inertialPanningX = 0), + (this.inertialPanningY = 0), + true) + ); + }), + (t.prototype._isSynchronizedViewMatrix = function () { + return ( + !!e.prototype._isSynchronizedViewMatrix.call(this) && + this._cache._target.equals(this._getTargetPosition()) && + this._cache.alpha === this.alpha && + this._cache.beta === this.beta && + this._cache.radius === this.radius && + this._cache.targetScreenOffset.equals( + this.targetScreenOffset + ) + ); + }), + (t.prototype.attachControl = function (e, t, i, n) { + var r = this; + void 0 === i && (i = true), + void 0 === n && (n = 2), + (this._useCtrlForPanning = i), + (this._panningMouseButton = n), + this.inputs.attachElement(e, t), + (this._reset = function () { + (r.inertialAlphaOffset = 0), + (r.inertialBetaOffset = 0), + (r.inertialRadiusOffset = 0), + (r.inertialPanningX = 0), + (r.inertialPanningY = 0); + }); + }), + (t.prototype.detachControl = function (e) { + this.inputs.detachElement(e), this._reset && this._reset(); + }), + (t.prototype._checkInputs = function () { + if (!this._collisionTriggered) { + if ( + (this.inputs.checkInputs(), + 0 !== this.inertialAlphaOffset || + 0 !== this.inertialBetaOffset || + 0 !== this.inertialRadiusOffset) + ) { + var t = this.inertialAlphaOffset; + this.beta <= 0 && (t *= -1), + this.getScene().useRightHandedSystem && (t *= -1), + this.parent && + this.parent._getWorldMatrixDeterminant() < 0 && + (t *= -1), + (this.alpha += t), + (this.beta += this.inertialBetaOffset), + (this.radius -= this.inertialRadiusOffset), + (this.inertialAlphaOffset *= this.inertia), + (this.inertialBetaOffset *= this.inertia), + (this.inertialRadiusOffset *= this.inertia), + Math.abs(this.inertialAlphaOffset) < a.h && + (this.inertialAlphaOffset = 0), + Math.abs(this.inertialBetaOffset) < a.h && + (this.inertialBetaOffset = 0), + Math.abs(this.inertialRadiusOffset) < + this.speed * a.h && (this.inertialRadiusOffset = 0); + } + (0 === this.inertialPanningX && + 0 === this.inertialPanningY) || + (this._localDirection || + ((this._localDirection = a.x.Zero()), + (this._transformedDirection = a.x.Zero())), + this._localDirection.copyFromFloats( + this.inertialPanningX, + this.inertialPanningY, + this.inertialPanningY + ), + this._localDirection.multiplyInPlace(this.panningAxis), + this._viewMatrix.invertToRef( + this._cameraTransformMatrix + ), + a.x.TransformNormalToRef( + this._localDirection, + this._cameraTransformMatrix, + this._transformedDirection + ), + this.panningAxis.y || + (this._transformedDirection.y = 0), + this._targetHost || + (this.panningDistanceLimit + ? (this._transformedDirection.addInPlace( + this._target + ), + a.x.DistanceSquared( + this._transformedDirection, + this.panningOriginTarget + ) <= + this.panningDistanceLimit * + this.panningDistanceLimit && + this._target.copyFrom( + this._transformedDirection + )) + : this._target.addInPlace( + this._transformedDirection + )), + (this.inertialPanningX *= this.panningInertia), + (this.inertialPanningY *= this.panningInertia), + Math.abs(this.inertialPanningX) < this.speed * a.h && + (this.inertialPanningX = 0), + Math.abs(this.inertialPanningY) < this.speed * a.h && + (this.inertialPanningY = 0)), + this._checkLimits(), + e.prototype._checkInputs.call(this); + } + }), + (t.prototype._checkLimits = function () { + null === this.lowerBetaLimit || + void 0 === this.lowerBetaLimit + ? this.allowUpsideDown && + this.beta > Math.PI && + (this.beta = this.beta - 2 * Math.PI) + : this.beta < this.lowerBetaLimit && + (this.beta = this.lowerBetaLimit), + null === this.upperBetaLimit || + void 0 === this.upperBetaLimit + ? this.allowUpsideDown && + this.beta < -Math.PI && + (this.beta = this.beta + 2 * Math.PI) + : this.beta > this.upperBetaLimit && + (this.beta = this.upperBetaLimit), + null !== this.lowerAlphaLimit && + this.alpha < this.lowerAlphaLimit && + (this.alpha = this.lowerAlphaLimit), + null !== this.upperAlphaLimit && + this.alpha > this.upperAlphaLimit && + (this.alpha = this.upperAlphaLimit), + null !== this.lowerRadiusLimit && + this.radius < this.lowerRadiusLimit && + ((this.radius = this.lowerRadiusLimit), + (this.inertialRadiusOffset = 0)), + null !== this.upperRadiusLimit && + this.radius > this.upperRadiusLimit && + ((this.radius = this.upperRadiusLimit), + (this.inertialRadiusOffset = 0)); + }), + (t.prototype.rebuildAnglesAndRadius = function () { + this._position.subtractToRef( + this._getTargetPosition(), + this._computationVector + ), + (0 === this._upVector.x && + 1 === this._upVector.y && + 0 === this._upVector.z) || + a.x.TransformCoordinatesToRef( + this._computationVector, + this._upToYMatrix, + this._computationVector + ), + (this.radius = this._computationVector.length()), + 0 === this.radius && (this.radius = 1e-4), + 0 === this._computationVector.x && + 0 === this._computationVector.z + ? (this.alpha = Math.PI / 2) + : (this.alpha = Math.acos( + this._computationVector.x / + Math.sqrt( + Math.pow(this._computationVector.x, 2) + + Math.pow(this._computationVector.z, 2) + ) + )), + this._computationVector.z < 0 && + (this.alpha = 2 * Math.PI - this.alpha), + (this.beta = Math.acos( + this._computationVector.y / this.radius + )), + this._checkLimits(); + }), + (t.prototype.setPosition = function (e) { + this._position.equals(e) || + (this._position.copyFrom(e), + this.rebuildAnglesAndRadius()); + }), + (t.prototype.setTarget = function (e, t, i) { + if ( + (void 0 === t && (t = false), + void 0 === i && (i = false), + e.getBoundingInfo) + ) + (this._targetBoundingCenter = t + ? e.getBoundingInfo().boundingBox.centerWorld.clone() + : null), + e.computeWorldMatrix(), + (this._targetHost = e), + (this._target = this._getTargetPosition()), + this.onMeshTargetChangedObservable.notifyObservers( + this._targetHost + ); + else { + var n = e, + r = this._getTargetPosition(); + if (r && !i && r.equals(n)) return; + (this._targetHost = null), + (this._target = n), + (this._targetBoundingCenter = null), + this.onMeshTargetChangedObservable.notifyObservers( + null + ); + } + this.rebuildAnglesAndRadius(); + }), + (t.prototype._getViewMatrix = function () { + var e = Math.cos(this.alpha), + t = Math.sin(this.alpha), + i = Math.cos(this.beta), + n = Math.sin(this.beta); + 0 === n && (n = 1e-4); + var r = this._getTargetPosition(); + if ( + (this._computationVector.copyFromFloats( + this.radius * e * n, + this.radius * i, + this.radius * t * n + ), + (0 === this._upVector.x && + 1 === this._upVector.y && + 0 === this._upVector.z) || + a.x.TransformCoordinatesToRef( + this._computationVector, + this._YToUpMatrix, + this._computationVector + ), + r.addToRef(this._computationVector, this._newPosition), + this.getScene().collisionsEnabled && this.checkCollisions) + ) { + var o = this.getScene().collisionCoordinator; + this._collider || (this._collider = o.createCollider()), + (this._collider._radius = this.collisionRadius), + this._newPosition.subtractToRef( + this._position, + this._collisionVelocity + ), + (this._collisionTriggered = true), + o.getNewPosition( + this._position, + this._collisionVelocity, + this._collider, + 3, + null, + this._onCollisionPositionChange, + this.uniqueId + ); + } else { + this._position.copyFrom(this._newPosition); + var s = this.upVector; + this.allowUpsideDown && + n < 0 && + (s = (s = s.clone()).negate()), + this._computeViewMatrix(this._position, r, s), + this._viewMatrix.addAtIndex( + 12, + this.targetScreenOffset.x + ), + this._viewMatrix.addAtIndex( + 13, + this.targetScreenOffset.y + ); + } + return (this._currentTarget = r), this._viewMatrix; + }), + (t.prototype.zoomOn = function (e, t) { + void 0 === t && (t = false), + (e = e || this.getScene().meshes); + var i = me.a.MinMax(e), + n = a.x.Distance(i.min, i.max); + (this.radius = n * this.zoomOnFactor), + this.focusOn( + { + min: i.min, + max: i.max, + distance: n, }, - set: function(e) { - var t = this.inputs.attached.touch; - t && (t.touchMoveSensibility = e) - }, - enumerable: true, - configurable: true + t + ); + }), + (t.prototype.focusOn = function (e, t) { + var i, n; + if ((void 0 === t && (t = false), void 0 === e.min)) { + var r = e || this.getScene().meshes; + (i = me.a.MinMax(r)), (n = a.x.Distance(i.min, i.max)); + } else (i = e), (n = e.distance); + (this._target = me.a.Center(i)), t || (this.maxZ = 2 * n); + }), + (t.prototype.createRigCamera = function (e, i) { + var n = 0; + switch (this.cameraRigMode) { + case ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH: + case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: + case ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER: + case ke.a.RIG_MODE_VR: + n = + this._cameraRigParams.stereoHalfAngle * + (0 === i ? 1 : -1); + break; + case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: + n = + this._cameraRigParams.stereoHalfAngle * + (0 === i ? -1 : 1); + } + var r = new t( + e, + this.alpha + n, + this.beta, + this.radius, + this._target, + this.getScene() + ); + return (r._cameraRigParams = {}), r; + }), + (t.prototype._updateRigCameras = function () { + var t = this._rigCameras[0], + i = this._rigCameras[1]; + switch ( + ((t.beta = i.beta = this.beta), this.cameraRigMode) + ) { + case ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH: + case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: + case ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER: + case ke.a.RIG_MODE_VR: + (t.alpha = + this.alpha - this._cameraRigParams.stereoHalfAngle), + (i.alpha = + this.alpha + this._cameraRigParams.stereoHalfAngle); + break; + case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: + (t.alpha = + this.alpha + this._cameraRigParams.stereoHalfAngle), + (i.alpha = + this.alpha - this._cameraRigParams.stereoHalfAngle); + } + e.prototype._updateRigCameras.call(this); + }), + (t.prototype.dispose = function () { + this.inputs.clear(), e.prototype.dispose.call(this); + }), + (t.prototype.getClassName = function () { + return "ArcRotateCamera"; + }), + h.c([Object(F.c)()], t.prototype, "alpha", void 0), + h.c([Object(F.c)()], t.prototype, "beta", void 0), + h.c([Object(F.c)()], t.prototype, "radius", void 0), + h.c([Object(F.o)("target")], t.prototype, "_target", void 0), + h.c( + [Object(F.o)("upVector")], + t.prototype, + "_upVector", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "inertialAlphaOffset", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "inertialBetaOffset", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "inertialRadiusOffset", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "lowerAlphaLimit", void 0), + h.c([Object(F.c)()], t.prototype, "upperAlphaLimit", void 0), + h.c([Object(F.c)()], t.prototype, "lowerBetaLimit", void 0), + h.c([Object(F.c)()], t.prototype, "upperBetaLimit", void 0), + h.c([Object(F.c)()], t.prototype, "lowerRadiusLimit", void 0), + h.c([Object(F.c)()], t.prototype, "upperRadiusLimit", void 0), + h.c([Object(F.c)()], t.prototype, "inertialPanningX", void 0), + h.c([Object(F.c)()], t.prototype, "inertialPanningY", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "pinchToPanMaxDistance", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "panningDistanceLimit", + void 0 + ), + h.c( + [Object(F.o)()], + t.prototype, + "panningOriginTarget", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "panningInertia", void 0), + h.c([Object(F.c)()], t.prototype, "zoomOnFactor", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "targetScreenOffset", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "allowUpsideDown", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "useInputToRestoreState", + void 0 + ), + t + ); + })(Et); + N.a.AddNodeConstructor( + "DeviceOrientationCamera", + function (e, t) { + return function () { + return new St(e, a.x.Zero(), t); + }; + } + ); + var St = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, i, n) || this; + return ( + (r._tmpDragQuaternion = new a.q()), + (r._disablePointerInputWhenUsingDeviceOrientation = true), + (r._dragFactor = 0), + (r._quaternionCache = new a.q()), + r.inputs.addDeviceOrientation(), + r.inputs._deviceOrientationInput && + r.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce( + function () { + r._disablePointerInputWhenUsingDeviceOrientation && + r.inputs._mouseInput && + ((r.inputs._mouseInput._allowCameraRotation = false), + r.inputs._mouseInput.onPointerMovedObservable.add( + function (e) { + 0 != r._dragFactor && + (r._initialQuaternion || + (r._initialQuaternion = new a.q()), + a.q.FromEulerAnglesToRef( + 0, + e.offsetX * r._dragFactor, + 0, + r._tmpDragQuaternion + ), + r._initialQuaternion.multiplyToRef( + r._tmpDragQuaternion, + r._initialQuaternion + )); + } + )); + } + ), + r + ); + } + return ( + h.d(t, e), + (t.prototype.enableHorizontalDragging = function (e) { + void 0 === e && (e = 1 / 300), (this._dragFactor = e); }), - t.prototype.getClassName = function() { - return "TouchCamera" - } - , - t.prototype._setupInputs = function() { - var e = this.inputs.attached.mouse; - e && (e.touchEnabled = false) - } - , - t - }(Tt); - N.a.AddNodeConstructor("ArcRotateCamera", function(e, t) { - return function() { - return new xt(e,0,0,1,a.x.Zero(),t) - } - }); - var xt = function(e) { - function t(t, i, n, r, s, c, u) { - void 0 === u && (u = true); - var l = e.call(this, t, a.x.Zero(), c, u) || this; - return l._upVector = a.x.Up(), - l.inertialAlphaOffset = 0, - l.inertialBetaOffset = 0, - l.inertialRadiusOffset = 0, - l.lowerAlphaLimit = null, - l.upperAlphaLimit = null, - l.lowerBetaLimit = .01, - l.upperBetaLimit = Math.PI - .01, - l.lowerRadiusLimit = null, - l.upperRadiusLimit = null, - l.inertialPanningX = 0, - l.inertialPanningY = 0, - l.pinchToPanMaxDistance = 20, - l.panningDistanceLimit = null, - l.panningOriginTarget = a.x.Zero(), - l.panningInertia = .9, - l.zoomOnFactor = 1, - l.targetScreenOffset = a.w.Zero(), - l.allowUpsideDown = true, - l.useInputToRestoreState = true, - l._viewMatrix = new a.j, - l.panningAxis = new a.x(1,1,0), - l.onMeshTargetChangedObservable = new o.c, - l.checkCollisions = false, - l.collisionRadius = new a.x(.5,.5,.5), - l._previousPosition = a.x.Zero(), - l._collisionVelocity = a.x.Zero(), - l._newPosition = a.x.Zero(), - l._computationVector = a.x.Zero(), - l._onCollisionPositionChange = function(e, t, i) { - void 0 === i && (i = null), - i ? (l.setPosition(t), - l.onCollide && l.onCollide(i)) : l._previousPosition.copyFrom(l._position); - var n = Math.cos(l.alpha) - , r = Math.sin(l.alpha) - , o = Math.cos(l.beta) - , a = Math.sin(l.beta); - 0 === a && (a = 1e-4); - var s = l._getTargetPosition(); - l._computationVector.copyFromFloats(l.radius * n * a, l.radius * o, l.radius * r * a), - s.addToRef(l._computationVector, l._newPosition), - l._position.copyFrom(l._newPosition); - var c = l.upVector; - l.allowUpsideDown && l.beta < 0 && (c = (c = c.clone()).negate()), - l._computeViewMatrix(l._position, s, c), - l._viewMatrix.addAtIndex(12, l.targetScreenOffset.x), - l._viewMatrix.addAtIndex(13, l.targetScreenOffset.y), - l._collisionTriggered = false - } - , - l._target = a.x.Zero(), - s && l.setTarget(s), - l.alpha = i, - l.beta = n, - l.radius = r, - l.getViewMatrix(), - l.inputs = new rt(l), - l.inputs.addKeyboard().addMouseWheel().addPointers(), - l - } - return h.d(t, e), - Object.defineProperty(t.prototype, "target", { - get: function() { - return this._target - }, - set: function(e) { - this.setTarget(e) - }, - enumerable: true, - configurable: true + (t.prototype.getClassName = function () { + return "DeviceOrientationCamera"; }), - Object.defineProperty(t.prototype, "position", { - get: function() { - return this._position - }, - set: function(e) { - this.setPosition(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "upVector", { - get: function() { - return this._upVector - }, - set: function(e) { - this._upToYMatrix || (this._YToUpMatrix = new a.j, - this._upToYMatrix = new a.j, - this._upVector = a.x.Zero()), - e.normalize(), - this._upVector.copyFrom(e), - this.setMatUp() - }, - enumerable: true, - configurable: true - }), - t.prototype.setMatUp = function() { - a.j.RotationAlignToRef(a.x.UpReadOnly, this._upVector, this._YToUpMatrix), - a.j.RotationAlignToRef(this._upVector, a.x.UpReadOnly, this._upToYMatrix) - } - , - Object.defineProperty(t.prototype, "angularSensibilityX", { - get: function() { - var e = this.inputs.attached.pointers; - return e ? e.angularSensibilityX : 0 - }, - set: function(e) { - var t = this.inputs.attached.pointers; - t && (t.angularSensibilityX = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "angularSensibilityY", { - get: function() { - var e = this.inputs.attached.pointers; - return e ? e.angularSensibilityY : 0 - }, - set: function(e) { - var t = this.inputs.attached.pointers; - t && (t.angularSensibilityY = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "pinchPrecision", { - get: function() { - var e = this.inputs.attached.pointers; - return e ? e.pinchPrecision : 0 - }, - set: function(e) { - var t = this.inputs.attached.pointers; - t && (t.pinchPrecision = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "pinchDeltaPercentage", { - get: function() { - var e = this.inputs.attached.pointers; - return e ? e.pinchDeltaPercentage : 0 - }, - set: function(e) { - var t = this.inputs.attached.pointers; - t && (t.pinchDeltaPercentage = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "panningSensibility", { - get: function() { - var e = this.inputs.attached.pointers; - return e ? e.panningSensibility : 0 - }, - set: function(e) { - var t = this.inputs.attached.pointers; - t && (t.panningSensibility = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "keysUp", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysUp : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysUp = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "keysDown", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysDown : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysDown = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "keysLeft", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysLeft : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysLeft = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "keysRight", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysRight : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysRight = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "wheelPrecision", { - get: function() { - var e = this.inputs.attached.mousewheel; - return e ? e.wheelPrecision : 0 - }, - set: function(e) { - var t = this.inputs.attached.mousewheel; - t && (t.wheelPrecision = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "wheelDeltaPercentage", { - get: function() { - var e = this.inputs.attached.mousewheel; - return e ? e.wheelDeltaPercentage : 0 - }, - set: function(e) { - var t = this.inputs.attached.mousewheel; - t && (t.wheelDeltaPercentage = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "bouncingBehavior", { - get: function() { - return this._bouncingBehavior - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "useBouncingBehavior", { - get: function() { - return null != this._bouncingBehavior - }, - set: function(e) { - e !== this.useBouncingBehavior && (e ? (this._bouncingBehavior = new Oe, - this.addBehavior(this._bouncingBehavior)) : this._bouncingBehavior && (this.removeBehavior(this._bouncingBehavior), - this._bouncingBehavior = null)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "framingBehavior", { - get: function() { - return this._framingBehavior - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "useFramingBehavior", { - get: function() { - return null != this._framingBehavior - }, - set: function(e) { - e !== this.useFramingBehavior && (e ? (this._framingBehavior = new we, - this.addBehavior(this._framingBehavior)) : this._framingBehavior && (this.removeBehavior(this._framingBehavior), - this._framingBehavior = null)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "autoRotationBehavior", { - get: function() { - return this._autoRotationBehavior - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "useAutoRotationBehavior", { - get: function() { - return null != this._autoRotationBehavior - }, - set: function(e) { - e !== this.useAutoRotationBehavior && (e ? (this._autoRotationBehavior = new Me, - this.addBehavior(this._autoRotationBehavior)) : this._autoRotationBehavior && (this.removeBehavior(this._autoRotationBehavior), - this._autoRotationBehavior = null)) - }, - enumerable: true, - configurable: true - }), - t.prototype._initCache = function() { - e.prototype._initCache.call(this), - this._cache._target = new a.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), - this._cache.alpha = void 0, - this._cache.beta = void 0, - this._cache.radius = void 0, - this._cache.targetScreenOffset = a.w.Zero() - } - , - t.prototype._updateCache = function(t) { - t || e.prototype._updateCache.call(this), - this._cache._target.copyFrom(this._getTargetPosition()), - this._cache.alpha = this.alpha, - this._cache.beta = this.beta, - this._cache.radius = this.radius, - this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset) - } - , - t.prototype._getTargetPosition = function() { - if (this._targetHost && this._targetHost.getAbsolutePosition) { - var e = this._targetHost.absolutePosition; - this._targetBoundingCenter ? e.addToRef(this._targetBoundingCenter, this._target) : this._target.copyFrom(e) - } - return this._getLockedTargetPosition() || this._target - } - , - t.prototype.storeState = function() { - return this._storedAlpha = this.alpha, - this._storedBeta = this.beta, - this._storedRadius = this.radius, - this._storedTarget = this._getTargetPosition().clone(), - e.prototype.storeState.call(this) - } - , - t.prototype._restoreStateValues = function() { - return !!e.prototype._restoreStateValues.call(this) && (this.alpha = this._storedAlpha, - this.beta = this._storedBeta, - this.radius = this._storedRadius, - this.setTarget(this._storedTarget.clone()), - this.inertialAlphaOffset = 0, - this.inertialBetaOffset = 0, - this.inertialRadiusOffset = 0, - this.inertialPanningX = 0, - this.inertialPanningY = 0, - true) - } - , - t.prototype._isSynchronizedViewMatrix = function() { - return !!e.prototype._isSynchronizedViewMatrix.call(this) && this._cache._target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius && this._cache.targetScreenOffset.equals(this.targetScreenOffset) - } - , - t.prototype.attachControl = function(e, t, i, n) { - var r = this; - void 0 === i && (i = true), - void 0 === n && (n = 2), - this._useCtrlForPanning = i, - this._panningMouseButton = n, - this.inputs.attachElement(e, t), - this._reset = function() { - r.inertialAlphaOffset = 0, - r.inertialBetaOffset = 0, - r.inertialRadiusOffset = 0, - r.inertialPanningX = 0, - r.inertialPanningY = 0 - } - } - , - t.prototype.detachControl = function(e) { - this.inputs.detachElement(e), - this._reset && this._reset() - } - , - t.prototype._checkInputs = function() { - if (!this._collisionTriggered) { - if (this.inputs.checkInputs(), - 0 !== this.inertialAlphaOffset || 0 !== this.inertialBetaOffset || 0 !== this.inertialRadiusOffset) { - var t = this.inertialAlphaOffset; - this.beta <= 0 && (t *= -1), - this.getScene().useRightHandedSystem && (t *= -1), - this.parent && this.parent._getWorldMatrixDeterminant() < 0 && (t *= -1), - this.alpha += t, - this.beta += this.inertialBetaOffset, - this.radius -= this.inertialRadiusOffset, - this.inertialAlphaOffset *= this.inertia, - this.inertialBetaOffset *= this.inertia, - this.inertialRadiusOffset *= this.inertia, - Math.abs(this.inertialAlphaOffset) < a.h && (this.inertialAlphaOffset = 0), - Math.abs(this.inertialBetaOffset) < a.h && (this.inertialBetaOffset = 0), - Math.abs(this.inertialRadiusOffset) < this.speed * a.h && (this.inertialRadiusOffset = 0) - } - 0 === this.inertialPanningX && 0 === this.inertialPanningY || (this._localDirection || (this._localDirection = a.x.Zero(), - this._transformedDirection = a.x.Zero()), - this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY), - this._localDirection.multiplyInPlace(this.panningAxis), - this._viewMatrix.invertToRef(this._cameraTransformMatrix), - a.x.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection), - this.panningAxis.y || (this._transformedDirection.y = 0), - this._targetHost || (this.panningDistanceLimit ? (this._transformedDirection.addInPlace(this._target), - a.x.DistanceSquared(this._transformedDirection, this.panningOriginTarget) <= this.panningDistanceLimit * this.panningDistanceLimit && this._target.copyFrom(this._transformedDirection)) : this._target.addInPlace(this._transformedDirection)), - this.inertialPanningX *= this.panningInertia, - this.inertialPanningY *= this.panningInertia, - Math.abs(this.inertialPanningX) < this.speed * a.h && (this.inertialPanningX = 0), - Math.abs(this.inertialPanningY) < this.speed * a.h && (this.inertialPanningY = 0)), - this._checkLimits(), - e.prototype._checkInputs.call(this) - } - } - , - t.prototype._checkLimits = function() { - null === this.lowerBetaLimit || void 0 === this.lowerBetaLimit ? this.allowUpsideDown && this.beta > Math.PI && (this.beta = this.beta - 2 * Math.PI) : this.beta < this.lowerBetaLimit && (this.beta = this.lowerBetaLimit), - null === this.upperBetaLimit || void 0 === this.upperBetaLimit ? this.allowUpsideDown && this.beta < -Math.PI && (this.beta = this.beta + 2 * Math.PI) : this.beta > this.upperBetaLimit && (this.beta = this.upperBetaLimit), - null !== this.lowerAlphaLimit && this.alpha < this.lowerAlphaLimit && (this.alpha = this.lowerAlphaLimit), - null !== this.upperAlphaLimit && this.alpha > this.upperAlphaLimit && (this.alpha = this.upperAlphaLimit), - null !== this.lowerRadiusLimit && this.radius < this.lowerRadiusLimit && (this.radius = this.lowerRadiusLimit, - this.inertialRadiusOffset = 0), - null !== this.upperRadiusLimit && this.radius > this.upperRadiusLimit && (this.radius = this.upperRadiusLimit, - this.inertialRadiusOffset = 0) - } - , - t.prototype.rebuildAnglesAndRadius = function() { - this._position.subtractToRef(this._getTargetPosition(), this._computationVector), - 0 === this._upVector.x && 1 === this._upVector.y && 0 === this._upVector.z || a.x.TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector), - this.radius = this._computationVector.length(), - 0 === this.radius && (this.radius = 1e-4), - 0 === this._computationVector.x && 0 === this._computationVector.z ? this.alpha = Math.PI / 2 : this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2))), - this._computationVector.z < 0 && (this.alpha = 2 * Math.PI - this.alpha), - this.beta = Math.acos(this._computationVector.y / this.radius), - this._checkLimits() - } - , - t.prototype.setPosition = function(e) { - this._position.equals(e) || (this._position.copyFrom(e), - this.rebuildAnglesAndRadius()) - } - , - t.prototype.setTarget = function(e, t, i) { - if (void 0 === t && (t = false), - void 0 === i && (i = false), - e.getBoundingInfo) - this._targetBoundingCenter = t ? e.getBoundingInfo().boundingBox.centerWorld.clone() : null, - e.computeWorldMatrix(), - this._targetHost = e, - this._target = this._getTargetPosition(), - this.onMeshTargetChangedObservable.notifyObservers(this._targetHost); - else { - var n = e - , r = this._getTargetPosition(); - if (r && !i && r.equals(n)) - return; - this._targetHost = null, - this._target = n, - this._targetBoundingCenter = null, - this.onMeshTargetChangedObservable.notifyObservers(null) - } - this.rebuildAnglesAndRadius() - } - , - t.prototype._getViewMatrix = function() { - var e = Math.cos(this.alpha) - , t = Math.sin(this.alpha) - , i = Math.cos(this.beta) - , n = Math.sin(this.beta); - 0 === n && (n = 1e-4); - var r = this._getTargetPosition(); - if (this._computationVector.copyFromFloats(this.radius * e * n, this.radius * i, this.radius * t * n), - 0 === this._upVector.x && 1 === this._upVector.y && 0 === this._upVector.z || a.x.TransformCoordinatesToRef(this._computationVector, this._YToUpMatrix, this._computationVector), - r.addToRef(this._computationVector, this._newPosition), - this.getScene().collisionsEnabled && this.checkCollisions) { - var o = this.getScene().collisionCoordinator; - this._collider || (this._collider = o.createCollider()), - this._collider._radius = this.collisionRadius, - this._newPosition.subtractToRef(this._position, this._collisionVelocity), - this._collisionTriggered = true, - o.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId) - } else { - this._position.copyFrom(this._newPosition); - var s = this.upVector; - this.allowUpsideDown && n < 0 && (s = (s = s.clone()).negate()), - this._computeViewMatrix(this._position, r, s), - this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x), - this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y) - } - return this._currentTarget = r, - this._viewMatrix - } - , - t.prototype.zoomOn = function(e, t) { - void 0 === t && (t = false), - e = e || this.getScene().meshes; - var i = me.a.MinMax(e) - , n = a.x.Distance(i.min, i.max); - this.radius = n * this.zoomOnFactor, - this.focusOn({ - min: i.min, - max: i.max, - distance: n - }, t) - } - , - t.prototype.focusOn = function(e, t) { - var i, n; - if (void 0 === t && (t = false), - void 0 === e.min) { - var r = e || this.getScene().meshes; - i = me.a.MinMax(r), - n = a.x.Distance(i.min, i.max) - } else - i = e, - n = e.distance; - this._target = me.a.Center(i), - t || (this.maxZ = 2 * n) - } - , - t.prototype.createRigCamera = function(e, i) { - var n = 0; - switch (this.cameraRigMode) { - case ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH: - case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: - case ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER: - case ke.a.RIG_MODE_VR: - n = this._cameraRigParams.stereoHalfAngle * (0 === i ? 1 : -1); - break; - case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: - n = this._cameraRigParams.stereoHalfAngle * (0 === i ? -1 : 1) - } - var r = new t(e,this.alpha + n,this.beta,this.radius,this._target,this.getScene()); - return r._cameraRigParams = {}, - r - } - , - t.prototype._updateRigCameras = function() { - var t = this._rigCameras[0] - , i = this._rigCameras[1]; - switch (t.beta = i.beta = this.beta, - this.cameraRigMode) { - case ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH: - case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: - case ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER: - case ke.a.RIG_MODE_VR: - t.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle, - i.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle; - break; - case ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: - t.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle, - i.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle - } - e.prototype._updateRigCameras.call(this) - } - , - t.prototype.dispose = function() { - this.inputs.clear(), - e.prototype.dispose.call(this) - } - , - t.prototype.getClassName = function() { - return "ArcRotateCamera" - } - , - h.c([Object(F.c)()], t.prototype, "alpha", void 0), - h.c([Object(F.c)()], t.prototype, "beta", void 0), - h.c([Object(F.c)()], t.prototype, "radius", void 0), - h.c([Object(F.o)("target")], t.prototype, "_target", void 0), - h.c([Object(F.o)("upVector")], t.prototype, "_upVector", void 0), - h.c([Object(F.c)()], t.prototype, "inertialAlphaOffset", void 0), - h.c([Object(F.c)()], t.prototype, "inertialBetaOffset", void 0), - h.c([Object(F.c)()], t.prototype, "inertialRadiusOffset", void 0), - h.c([Object(F.c)()], t.prototype, "lowerAlphaLimit", void 0), - h.c([Object(F.c)()], t.prototype, "upperAlphaLimit", void 0), - h.c([Object(F.c)()], t.prototype, "lowerBetaLimit", void 0), - h.c([Object(F.c)()], t.prototype, "upperBetaLimit", void 0), - h.c([Object(F.c)()], t.prototype, "lowerRadiusLimit", void 0), - h.c([Object(F.c)()], t.prototype, "upperRadiusLimit", void 0), - h.c([Object(F.c)()], t.prototype, "inertialPanningX", void 0), - h.c([Object(F.c)()], t.prototype, "inertialPanningY", void 0), - h.c([Object(F.c)()], t.prototype, "pinchToPanMaxDistance", void 0), - h.c([Object(F.c)()], t.prototype, "panningDistanceLimit", void 0), - h.c([Object(F.o)()], t.prototype, "panningOriginTarget", void 0), - h.c([Object(F.c)()], t.prototype, "panningInertia", void 0), - h.c([Object(F.c)()], t.prototype, "zoomOnFactor", void 0), - h.c([Object(F.c)()], t.prototype, "targetScreenOffset", void 0), - h.c([Object(F.c)()], t.prototype, "allowUpsideDown", void 0), - h.c([Object(F.c)()], t.prototype, "useInputToRestoreState", void 0), - t - }(Et); - N.a.AddNodeConstructor("DeviceOrientationCamera", function(e, t) { - return function() { - return new St(e,a.x.Zero(),t) - } - }); - var St = function(e) { - function t(t, i, n) { - var r = e.call(this, t, i, n) || this; - return r._tmpDragQuaternion = new a.q, - r._disablePointerInputWhenUsingDeviceOrientation = true, - r._dragFactor = 0, - r._quaternionCache = new a.q, - r.inputs.addDeviceOrientation(), - r.inputs._deviceOrientationInput && r.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(function() { - r._disablePointerInputWhenUsingDeviceOrientation && r.inputs._mouseInput && (r.inputs._mouseInput._allowCameraRotation = false, - r.inputs._mouseInput.onPointerMovedObservable.add(function(e) { - 0 != r._dragFactor && (r._initialQuaternion || (r._initialQuaternion = new a.q), - a.q.FromEulerAnglesToRef(0, e.offsetX * r._dragFactor, 0, r._tmpDragQuaternion), - r._initialQuaternion.multiplyToRef(r._tmpDragQuaternion, r._initialQuaternion)) - })) - }), - r - } - return h.d(t, e), - t.prototype.enableHorizontalDragging = function(e) { - void 0 === e && (e = 1 / 300), - this._dragFactor = e - } - , - t.prototype.getClassName = function() { - return "DeviceOrientationCamera" - } - , - t.prototype._checkInputs = function() { - e.prototype._checkInputs.call(this), + (t.prototype._checkInputs = function () { + e.prototype._checkInputs.call(this), this._quaternionCache.copyFrom(this.rotationQuaternion), - this._initialQuaternion && this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion) - } - , - t.prototype.resetToCurrentRotation = function(e) { - var t = this; - void 0 === e && (e = a.c.Y), - this.rotationQuaternion && (this._initialQuaternion || (this._initialQuaternion = new a.q), - this._initialQuaternion.copyFrom(this._quaternionCache || this.rotationQuaternion), - ["x", "y", "z"].forEach(function(i) { - e[i] ? t._initialQuaternion[i] *= -1 : t._initialQuaternion[i] = 0 - }), - this._initialQuaternion.normalize(), - this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion)) - } - , + this._initialQuaternion && + this._initialQuaternion.multiplyToRef( + this.rotationQuaternion, + this.rotationQuaternion + ); + }), + (t.prototype.resetToCurrentRotation = function (e) { + var t = this; + void 0 === e && (e = a.c.Y), + this.rotationQuaternion && + (this._initialQuaternion || + (this._initialQuaternion = new a.q()), + this._initialQuaternion.copyFrom( + this._quaternionCache || this.rotationQuaternion + ), + ["x", "y", "z"].forEach(function (i) { + e[i] + ? (t._initialQuaternion[i] *= -1) + : (t._initialQuaternion[i] = 0); + }), + this._initialQuaternion.normalize(), + this._initialQuaternion.multiplyToRef( + this.rotationQuaternion, + this.rotationQuaternion + )); + }), t - }(Tt) - , Ct = function(e) { - function t(t) { - return e.call(this, t) || this - } - return h.d(t, e), - t.prototype.addKeyboard = function() { - return this.add(new at), - this - } - , - t.prototype.addMouse = function(e) { - return void 0 === e && (e = true), - this.add(new st(e)), - this - } - , + ); + })(Tt), + Ct = (function (e) { + function t(t) { + return e.call(this, t) || this; + } + return ( + h.d(t, e), + (t.prototype.addKeyboard = function () { + return this.add(new at()), this; + }), + (t.prototype.addMouse = function (e) { + return ( + void 0 === e && (e = true), this.add(new st(e)), this + ); + }), t - }(Ke) - , Pt = function(e) { - function t(t, i, n, r) { - void 0 === r && (r = true); - var o = e.call(this, t, i, n, r) || this; - return o.ellipsoid = new a.x(1,1,1), - o.ellipsoidOffset = new a.x(0,0,0), - o.checkCollisions = false, - o.applyGravity = false, - o.cameraDirection = a.x.Zero(), - o._trackRoll = 0, - o.rollCorrect = 100, - o.bankedTurn = false, - o.bankedTurnLimit = Math.PI / 2, - o.bankedTurnMultiplier = 1, - o._needMoveForGravity = false, - o._oldPosition = a.x.Zero(), - o._diffPosition = a.x.Zero(), - o._newPosition = a.x.Zero(), - o._collisionMask = -1, - o._onCollisionPositionChange = function(e, t, i) { - var n; - void 0 === i && (i = null), - n = t, - o._newPosition.copyFrom(n), - o._newPosition.subtractToRef(o._oldPosition, o._diffPosition), - o._diffPosition.length() > ve.b.CollisionsEpsilon && (o.position.addInPlace(o._diffPosition), - o.onCollide && i && o.onCollide(i)) - } - , - o.inputs = new Ct(o), - o.inputs.addKeyboard().addMouse(), - o - } - return h.d(t, e), + ); + })(Ke), + Pt = (function (e) { + function t(t, i, n, r) { + void 0 === r && (r = true); + var o = e.call(this, t, i, n, r) || this; + return ( + (o.ellipsoid = new a.x(1, 1, 1)), + (o.ellipsoidOffset = new a.x(0, 0, 0)), + (o.checkCollisions = false), + (o.applyGravity = false), + (o.cameraDirection = a.x.Zero()), + (o._trackRoll = 0), + (o.rollCorrect = 100), + (o.bankedTurn = false), + (o.bankedTurnLimit = Math.PI / 2), + (o.bankedTurnMultiplier = 1), + (o._needMoveForGravity = false), + (o._oldPosition = a.x.Zero()), + (o._diffPosition = a.x.Zero()), + (o._newPosition = a.x.Zero()), + (o._collisionMask = -1), + (o._onCollisionPositionChange = function (e, t, i) { + var n; + void 0 === i && (i = null), + (n = t), + o._newPosition.copyFrom(n), + o._newPosition.subtractToRef( + o._oldPosition, + o._diffPosition + ), + o._diffPosition.length() > ve.b.CollisionsEpsilon && + (o.position.addInPlace(o._diffPosition), + o.onCollide && i && o.onCollide(i)); + }), + (o.inputs = new Ct(o)), + o.inputs.addKeyboard().addMouse(), + o + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "angularSensibility", { - get: function() { - var e = this.inputs.attached.mouse; - return e ? e.angularSensibility : 0 - }, - set: function(e) { - var t = this.inputs.attached.mouse; - t && (t.angularSensibility = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.mouse; + return e ? e.angularSensibility : 0; + }, + set: function (e) { + var t = this.inputs.attached.mouse; + t && (t.angularSensibility = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysForward", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysForward : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysForward = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysForward : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysForward = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysBackward", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysBackward : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysBackward = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysBackward : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysBackward = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysUp", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysUp : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysUp = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysUp : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysUp = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysDown", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysDown : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysDown = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysDown : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysDown = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysLeft", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysLeft : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysLeft = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysLeft : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysLeft = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "keysRight", { - get: function() { - var e = this.inputs.attached.keyboard; - return e ? e.keysRight : [] - }, - set: function(e) { - var t = this.inputs.attached.keyboard; - t && (t.keysRight = e) - }, - enumerable: true, - configurable: true + get: function () { + var e = this.inputs.attached.keyboard; + return e ? e.keysRight : []; + }, + set: function (e) { + var t = this.inputs.attached.keyboard; + t && (t.keysRight = e); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.attachControl = function (e, t) { + this.inputs.attachElement(e, t); + }), + (t.prototype.detachControl = function (e) { + this.inputs.detachElement(e), + (this.cameraDirection = new a.x(0, 0, 0)); }), - t.prototype.attachControl = function(e, t) { - this.inputs.attachElement(e, t) - } - , - t.prototype.detachControl = function(e) { - this.inputs.detachElement(e), - this.cameraDirection = new a.x(0,0,0) - } - , Object.defineProperty(t.prototype, "collisionMask", { - get: function() { - return this._collisionMask - }, - set: function(e) { - this._collisionMask = isNaN(e) ? -1 : e - }, - enumerable: true, - configurable: true + get: function () { + return this._collisionMask; + }, + set: function (e) { + this._collisionMask = isNaN(e) ? -1 : e; + }, + enumerable: true, + configurable: true, }), - t.prototype._collideWithWorld = function(e) { - (this.parent ? a.x.TransformCoordinates(this.position, this.parent.getWorldMatrix()) : this.position).subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition), + (t.prototype._collideWithWorld = function (e) { + (this.parent + ? a.x.TransformCoordinates( + this.position, + this.parent.getWorldMatrix() + ) + : this.position + ).subtractFromFloatsToRef( + 0, + this.ellipsoid.y, + 0, + this._oldPosition + ), this._oldPosition.addInPlace(this.ellipsoidOffset); - var t = this.getScene().collisionCoordinator; - this._collider || (this._collider = t.createCollider()), - this._collider._radius = this.ellipsoid, - this._collider.collisionMask = this._collisionMask; - var i = e; - this.applyGravity && (i = e.add(this.getScene().gravity)), - t.getNewPosition(this._oldPosition, i, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId) - } - , - t.prototype._checkInputs = function() { - this._localDirection || (this._localDirection = a.x.Zero(), - this._transformedDirection = a.x.Zero()), + var t = this.getScene().collisionCoordinator; + this._collider || (this._collider = t.createCollider()), + (this._collider._radius = this.ellipsoid), + (this._collider.collisionMask = this._collisionMask); + var i = e; + this.applyGravity && (i = e.add(this.getScene().gravity)), + t.getNewPosition( + this._oldPosition, + i, + this._collider, + 3, + null, + this._onCollisionPositionChange, + this.uniqueId + ); + }), + (t.prototype._checkInputs = function () { + this._localDirection || + ((this._localDirection = a.x.Zero()), + (this._transformedDirection = a.x.Zero())), this.inputs.checkInputs(), - e.prototype._checkInputs.call(this) - } - , - t.prototype._decideIfNeedsToMove = function() { - return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0 - } - , - t.prototype._updatePosition = function() { - this.checkCollisions && this.getScene().collisionsEnabled ? this._collideWithWorld(this.cameraDirection) : e.prototype._updatePosition.call(this) - } - , - t.prototype.restoreRoll = function(e) { - var t = this._trackRoll - , i = t - this.rotation.z; - Math.abs(i) >= .001 && (this.rotation.z += i / e, - Math.abs(t - this.rotation.z) <= .001 && (this.rotation.z = t)) - } - , - t.prototype.dispose = function() { - this.inputs.clear(), - e.prototype.dispose.call(this) - } - , - t.prototype.getClassName = function() { - return "FlyCamera" - } - , + e.prototype._checkInputs.call(this); + }), + (t.prototype._decideIfNeedsToMove = function () { + return ( + this._needMoveForGravity || + Math.abs(this.cameraDirection.x) > 0 || + Math.abs(this.cameraDirection.y) > 0 || + Math.abs(this.cameraDirection.z) > 0 + ); + }), + (t.prototype._updatePosition = function () { + this.checkCollisions && this.getScene().collisionsEnabled + ? this._collideWithWorld(this.cameraDirection) + : e.prototype._updatePosition.call(this); + }), + (t.prototype.restoreRoll = function (e) { + var t = this._trackRoll, + i = t - this.rotation.z; + Math.abs(i) >= 0.001 && + ((this.rotation.z += i / e), + Math.abs(t - this.rotation.z) <= 0.001 && + (this.rotation.z = t)); + }), + (t.prototype.dispose = function () { + this.inputs.clear(), e.prototype.dispose.call(this); + }), + (t.prototype.getClassName = function () { + return "FlyCamera"; + }), h.c([Object(F.o)()], t.prototype, "ellipsoid", void 0), - h.c([Object(F.o)()], t.prototype, "ellipsoidOffset", void 0), - h.c([Object(F.c)()], t.prototype, "checkCollisions", void 0), + h.c( + [Object(F.o)()], + t.prototype, + "ellipsoidOffset", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "checkCollisions", + void 0 + ), h.c([Object(F.c)()], t.prototype, "applyGravity", void 0), t - }(Et) - , Rt = function(e) { - function t(t) { - return e.call(this, t) || this - } - return h.d(t, e), - t.prototype.addKeyboard = function() { - return this.add(new ct), + ); + })(Et), + Rt = (function (e) { + function t(t) { + return e.call(this, t) || this; + } + return ( + h.d(t, e), + (t.prototype.addKeyboard = function () { + return this.add(new ct()), this; + }), + (t.prototype.addMouseWheel = function () { + return this.add(new ut()), this; + }), + (t.prototype.addPointers = function () { + return this.add(new lt()), this; + }), + (t.prototype.addVRDeviceOrientation = function () { + return ( + console.warn( + "DeviceOrientation support not yet implemented for FollowCamera." + ), this - } - , - t.prototype.addMouseWheel = function() { - return this.add(new ut), - this - } - , - t.prototype.addPointers = function() { - return this.add(new lt), - this - } - , - t.prototype.addVRDeviceOrientation = function() { - return console.warn("DeviceOrientation support not yet implemented for FollowCamera."), - this - } - , + ); + }), t - }(Ke); - N.a.AddNodeConstructor("FollowCamera", function(e, t) { - return function() { - return new Ot(e,a.x.Zero(),t) - } - }), - N.a.AddNodeConstructor("ArcFollowCamera", function(e, t) { - return function() { - return new wt(e,0,0,1,null,t) - } + ); + })(Ke); + N.a.AddNodeConstructor("FollowCamera", function (e, t) { + return function () { + return new Ot(e, a.x.Zero(), t); + }; + }), + N.a.AddNodeConstructor("ArcFollowCamera", function (e, t) { + return function () { + return new wt(e, 0, 0, 1, null, t); + }; }); - var Mt, Ot = function(e) { - function t(t, i, n, r) { - void 0 === r && (r = null); - var o = e.call(this, t, i, n) || this; - return o.radius = 12, - o.lowerRadiusLimit = null, - o.upperRadiusLimit = null, - o.rotationOffset = 0, - o.lowerRotationOffsetLimit = null, - o.upperRotationOffsetLimit = null, - o.heightOffset = 4, - o.lowerHeightOffsetLimit = null, - o.upperHeightOffsetLimit = null, - o.cameraAcceleration = .05, - o.maxCameraSpeed = 20, - o.lockedTarget = r, - o.inputs = new Rt(o), - o.inputs.addKeyboard().addMouseWheel().addPointers(), - o - } - return h.d(t, e), - t.prototype._follow = function(e) { - if (e) { - var t; - if (e.rotationQuaternion) { - var i = new a.j; - e.rotationQuaternion.toRotationMatrix(i), - t = Math.atan2(i.m[8], i.m[10]) - } else - t = e.rotation.y; - var n = Ee.h.ToRadians(this.rotationOffset) + t - , r = e.getAbsolutePosition() - , o = r.x + Math.sin(n) * this.radius - , s = r.z + Math.cos(n) * this.radius - , c = o - this.position.x - , u = r.y + this.heightOffset - this.position.y - , l = s - this.position.z - , h = c * this.cameraAcceleration * 2 - , f = u * this.cameraAcceleration - , d = l * this.cameraAcceleration * 2; - (h > this.maxCameraSpeed || h < -this.maxCameraSpeed) && (h = h < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), - (f > this.maxCameraSpeed || f < -this.maxCameraSpeed) && (f = f < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), - (d > this.maxCameraSpeed || d < -this.maxCameraSpeed) && (d = d < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), - this.position = new a.x(this.position.x + h,this.position.y + f,this.position.z + d), - this.setTarget(r) - } - } - , - t.prototype.attachControl = function(e, t) { - this.inputs.attachElement(e, t), - this._reset = function() {} - } - , - t.prototype.detachControl = function(e) { - this.inputs.detachElement(e), - this._reset && this._reset() - } - , - t.prototype._checkInputs = function() { - this.inputs.checkInputs(), + var Mt, + Ot = (function (e) { + function t(t, i, n, r) { + void 0 === r && (r = null); + var o = e.call(this, t, i, n) || this; + return ( + (o.radius = 12), + (o.lowerRadiusLimit = null), + (o.upperRadiusLimit = null), + (o.rotationOffset = 0), + (o.lowerRotationOffsetLimit = null), + (o.upperRotationOffsetLimit = null), + (o.heightOffset = 4), + (o.lowerHeightOffsetLimit = null), + (o.upperHeightOffsetLimit = null), + (o.cameraAcceleration = 0.05), + (o.maxCameraSpeed = 20), + (o.lockedTarget = r), + (o.inputs = new Rt(o)), + o.inputs.addKeyboard().addMouseWheel().addPointers(), + o + ); + } + return ( + h.d(t, e), + (t.prototype._follow = function (e) { + if (e) { + var t; + if (e.rotationQuaternion) { + var i = new a.j(); + e.rotationQuaternion.toRotationMatrix(i), + (t = Math.atan2(i.m[8], i.m[10])); + } else t = e.rotation.y; + var n = Ee.h.ToRadians(this.rotationOffset) + t, + r = e.getAbsolutePosition(), + o = r.x + Math.sin(n) * this.radius, + s = r.z + Math.cos(n) * this.radius, + c = o - this.position.x, + u = r.y + this.heightOffset - this.position.y, + l = s - this.position.z, + h = c * this.cameraAcceleration * 2, + f = u * this.cameraAcceleration, + d = l * this.cameraAcceleration * 2; + (h > this.maxCameraSpeed || h < -this.maxCameraSpeed) && + (h = + h < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), + (f > this.maxCameraSpeed || + f < -this.maxCameraSpeed) && + (f = + f < 1 + ? -this.maxCameraSpeed + : this.maxCameraSpeed), + (d > this.maxCameraSpeed || + d < -this.maxCameraSpeed) && + (d = + d < 1 + ? -this.maxCameraSpeed + : this.maxCameraSpeed), + (this.position = new a.x( + this.position.x + h, + this.position.y + f, + this.position.z + d + )), + this.setTarget(r); + } + }), + (t.prototype.attachControl = function (e, t) { + this.inputs.attachElement(e, t), + (this._reset = function () {}); + }), + (t.prototype.detachControl = function (e) { + this.inputs.detachElement(e), + this._reset && this._reset(); + }), + (t.prototype._checkInputs = function () { + this.inputs.checkInputs(), this._checkLimits(), e.prototype._checkInputs.call(this), - this.lockedTarget && this._follow(this.lockedTarget) - } - , - t.prototype._checkLimits = function() { - null !== this.lowerRadiusLimit && this.radius < this.lowerRadiusLimit && (this.radius = this.lowerRadiusLimit), - null !== this.upperRadiusLimit && this.radius > this.upperRadiusLimit && (this.radius = this.upperRadiusLimit), - null !== this.lowerHeightOffsetLimit && this.heightOffset < this.lowerHeightOffsetLimit && (this.heightOffset = this.lowerHeightOffsetLimit), - null !== this.upperHeightOffsetLimit && this.heightOffset > this.upperHeightOffsetLimit && (this.heightOffset = this.upperHeightOffsetLimit), - null !== this.lowerRotationOffsetLimit && this.rotationOffset < this.lowerRotationOffsetLimit && (this.rotationOffset = this.lowerRotationOffsetLimit), - null !== this.upperRotationOffsetLimit && this.rotationOffset > this.upperRotationOffsetLimit && (this.rotationOffset = this.upperRotationOffsetLimit) - } - , - t.prototype.getClassName = function() { - return "FollowCamera" - } - , - h.c([Object(F.c)()], t.prototype, "radius", void 0), - h.c([Object(F.c)()], t.prototype, "lowerRadiusLimit", void 0), - h.c([Object(F.c)()], t.prototype, "upperRadiusLimit", void 0), - h.c([Object(F.c)()], t.prototype, "rotationOffset", void 0), - h.c([Object(F.c)()], t.prototype, "lowerRotationOffsetLimit", void 0), - h.c([Object(F.c)()], t.prototype, "upperRotationOffsetLimit", void 0), - h.c([Object(F.c)()], t.prototype, "heightOffset", void 0), - h.c([Object(F.c)()], t.prototype, "lowerHeightOffsetLimit", void 0), - h.c([Object(F.c)()], t.prototype, "upperHeightOffsetLimit", void 0), - h.c([Object(F.c)()], t.prototype, "cameraAcceleration", void 0), - h.c([Object(F.c)()], t.prototype, "maxCameraSpeed", void 0), - h.c([Object(F.k)("lockedTargetId")], t.prototype, "lockedTarget", void 0), - t - }(Et), wt = function(e) { - function t(t, i, n, r, o, s) { - var c = e.call(this, t, a.x.Zero(), s) || this; - return c.alpha = i, - c.beta = n, - c.radius = r, - c.target = o, - c._cartesianCoordinates = a.x.Zero(), - c._follow(), - c - } - return h.d(t, e), - t.prototype._follow = function() { - if (this.target) { - this._cartesianCoordinates.x = this.radius * Math.cos(this.alpha) * Math.cos(this.beta), - this._cartesianCoordinates.y = this.radius * Math.sin(this.beta), - this._cartesianCoordinates.z = this.radius * Math.sin(this.alpha) * Math.cos(this.beta); - var e = this.target.getAbsolutePosition(); - this.position = e.add(this._cartesianCoordinates), - this.setTarget(e) - } - } - , - t.prototype._checkInputs = function() { - e.prototype._checkInputs.call(this), - this._follow() - } - , - t.prototype.getClassName = function() { - return "ArcFollowCamera" - } - , - t - }(Et), It = n(35), Dt = n(39); - !function(e) { - e[e.VIVE = 0] = "VIVE", - e[e.OCULUS = 1] = "OCULUS", - e[e.WINDOWS = 2] = "WINDOWS", - e[e.GEAR_VR = 3] = "GEAR_VR", - e[e.DAYDREAM = 4] = "DAYDREAM", - e[e.GENERIC = 5] = "GENERIC" - }(Mt || (Mt = {})); - var Lt, Ft, Bt = function() { - function e() {} - return e.InitiateController = function(e) { - for (var t = 0, i = this._ControllerFactories; t < i.length; t++) { - var n = i[t]; - if (n.canCreate(e)) - return n.create(e) - } - if (this._DefaultControllerFactory) - return this._DefaultControllerFactory(e); - throw "The type of gamepad you are trying to load needs to be imported first or is not supported." - } - , - e._ControllerFactories = [], - e._DefaultControllerFactory = null, - e - }(), Nt = function(e) { - function t(t) { - var i = e.call(this, t.id, t.index, t) || this; - return i._deviceRoomPosition = a.x.Zero(), - i._deviceRoomRotationQuaternion = new a.q, - i.devicePosition = a.x.Zero(), - i.deviceRotationQuaternion = new a.q, - i.deviceScaleFactor = 1, - i._trackPosition = true, - i._maxRotationDistFromHeadset = Math.PI / 5, - i._draggedRoomRotation = 0, - i._leftHandSystemQuaternion = new a.q, - i._deviceToWorld = a.j.Identity(), - i._pointingPoseNode = null, - i._workingMatrix = a.j.Identity(), - i._meshAttachedObservable = new o.c, - i.type = qe.POSE_ENABLED, - i.controllerType = Mt.GENERIC, - i.position = a.x.Zero(), - i.rotationQuaternion = new a.q, - i._calculatedPosition = a.x.Zero(), - i._calculatedRotation = new a.q, - a.q.RotationYawPitchRollToRef(Math.PI, 0, 0, i._leftHandSystemQuaternion), - i - } - return h.d(t, e), - t.prototype._disableTrackPosition = function(e) { - this._trackPosition && (this._calculatedPosition.copyFrom(e), - this._trackPosition = false) - } - , - t.prototype.update = function() { - e.prototype.update.call(this), - this._updatePoseAndMesh() - } - , - t.prototype._updatePoseAndMesh = function() { - var e = this.browserGamepad.pose; - if (this.updateFromDevice(e), - !this._trackPosition && R.a.LastCreatedScene && R.a.LastCreatedScene.activeCamera && R.a.LastCreatedScene.activeCamera.devicePosition && ((t = R.a.LastCreatedScene.activeCamera)._computeDevicePosition(), - this._deviceToWorld.setTranslation(t.devicePosition), - t.deviceRotationQuaternion)) { - var t; - (t = t)._deviceRoomRotationQuaternion.toEulerAnglesToRef(a.t.Vector3[0]); - var i = Math.atan2(Math.sin(a.t.Vector3[0].y - this._draggedRoomRotation), Math.cos(a.t.Vector3[0].y - this._draggedRoomRotation)); - if (Math.abs(i) > this._maxRotationDistFromHeadset) { - var n = i - (i < 0 ? -this._maxRotationDistFromHeadset : this._maxRotationDistFromHeadset); - this._draggedRoomRotation += n; - var r = Math.sin(-n) - , o = Math.cos(-n); - this._calculatedPosition.x = this._calculatedPosition.x * o - this._calculatedPosition.z * r, - this._calculatedPosition.z = this._calculatedPosition.x * r + this._calculatedPosition.z * o - } - } - a.x.TransformCoordinatesToRef(this._calculatedPosition, this._deviceToWorld, this.devicePosition), - this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix), - a.q.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion), - this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation), - this._mesh && (this._mesh.position.copyFrom(this.devicePosition), - this._mesh.rotationQuaternion && this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion)) - } - , - t.prototype.updateFromDevice = function(e) { - if (e) { - this.rawPose = e, - e.position && (this._deviceRoomPosition.copyFromFloats(e.position[0], e.position[1], -e.position[2]), - this._mesh && this._mesh.getScene().useRightHandedSystem && (this._deviceRoomPosition.z *= -1), - this._trackPosition && this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor, this._calculatedPosition), - this._calculatedPosition.addInPlace(this.position)); - var t = this.rawPose; - e.orientation && t.orientation && (this._deviceRoomRotationQuaternion.copyFromFloats(t.orientation[0], t.orientation[1], -t.orientation[2], -t.orientation[3]), - this._mesh && (this._mesh.getScene().useRightHandedSystem ? (this._deviceRoomRotationQuaternion.z *= -1, - this._deviceRoomRotationQuaternion.w *= -1) : this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion, this._deviceRoomRotationQuaternion)), - this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion, this._calculatedRotation)) - } - } - , - t.prototype.attachToMesh = function(e) { - if (this._mesh && (this._mesh.parent = null), - this._mesh = e, - this._poseControlledCamera && (this._mesh.parent = this._poseControlledCamera), - this._mesh.rotationQuaternion || (this._mesh.rotationQuaternion = new a.q), - this._updatePoseAndMesh(), - this._pointingPoseNode) { - for (var t = [], i = this._pointingPoseNode; i.parent; ) - t.push(i.parent), - i = i.parent; - t.reverse().forEach(function(e) { - e.computeWorldMatrix(true) - }) - } - this._meshAttachedObservable.notifyObservers(e) - } - , - t.prototype.attachToPoseControlledCamera = function(e) { - this._poseControlledCamera = e, - this._mesh && (this._mesh.parent = this._poseControlledCamera) - } - , - t.prototype.dispose = function() { - this._mesh && this._mesh.dispose(), - this._mesh = null, - e.prototype.dispose.call(this) - } - , - Object.defineProperty(t.prototype, "mesh", { - get: function() { - return this._mesh - }, - enumerable: true, - configurable: true + this.lockedTarget && this._follow(this.lockedTarget); }), - t.prototype.getForwardRay = function(e) { - if (void 0 === e && (e = 100), - !this.mesh) - return new Dt.a(a.x.Zero(),new a.x(0,0,1),e); - var t = this._pointingPoseNode ? this._pointingPoseNode.getWorldMatrix() : this.mesh.getWorldMatrix() - , i = t.getTranslation() - , n = new a.x(0,0,-1) - , r = a.x.TransformNormal(n, t) - , o = a.x.Normalize(r); - return new Dt.a(i,o,e) - } - , - t.POINTING_POSE = "POINTING_POSE", + (t.prototype._checkLimits = function () { + null !== this.lowerRadiusLimit && + this.radius < this.lowerRadiusLimit && + (this.radius = this.lowerRadiusLimit), + null !== this.upperRadiusLimit && + this.radius > this.upperRadiusLimit && + (this.radius = this.upperRadiusLimit), + null !== this.lowerHeightOffsetLimit && + this.heightOffset < this.lowerHeightOffsetLimit && + (this.heightOffset = this.lowerHeightOffsetLimit), + null !== this.upperHeightOffsetLimit && + this.heightOffset > this.upperHeightOffsetLimit && + (this.heightOffset = this.upperHeightOffsetLimit), + null !== this.lowerRotationOffsetLimit && + this.rotationOffset < this.lowerRotationOffsetLimit && + (this.rotationOffset = this.lowerRotationOffsetLimit), + null !== this.upperRotationOffsetLimit && + this.rotationOffset > this.upperRotationOffsetLimit && + (this.rotationOffset = this.upperRotationOffsetLimit); + }), + (t.prototype.getClassName = function () { + return "FollowCamera"; + }), + h.c([Object(F.c)()], t.prototype, "radius", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "lowerRadiusLimit", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "upperRadiusLimit", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "rotationOffset", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "lowerRotationOffsetLimit", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "upperRotationOffsetLimit", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "heightOffset", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "lowerHeightOffsetLimit", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "upperHeightOffsetLimit", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "cameraAcceleration", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "maxCameraSpeed", void 0), + h.c( + [Object(F.k)("lockedTargetId")], + t.prototype, + "lockedTarget", + void 0 + ), t - }(qe); - !function(e) { - e[e.A = 0] = "A", - e[e.B = 1] = "B", - e[e.X = 2] = "X", - e[e.Y = 3] = "Y", - e[e.Start = 4] = "Start", - e[e.Back = 5] = "Back", - e[e.LB = 6] = "LB", - e[e.RB = 7] = "RB", - e[e.LeftStick = 8] = "LeftStick", - e[e.RightStick = 9] = "RightStick" - }(Lt || (Lt = {})), - function(e) { - e[e.Up = 0] = "Up", - e[e.Down = 1] = "Down", - e[e.Left = 2] = "Left", - e[e.Right = 3] = "Right" - }(Ft || (Ft = {})); - var kt = function(e) { - function t(t, i, n, r) { - void 0 === r && (r = false); - var a = e.call(this, t, i, n, 0, 1, 2, 3) || this; - return a._leftTrigger = 0, - a._rightTrigger = 0, - a.onButtonDownObservable = new o.c, - a.onButtonUpObservable = new o.c, - a.onPadDownObservable = new o.c, - a.onPadUpObservable = new o.c, - a._buttonA = 0, - a._buttonB = 0, - a._buttonX = 0, - a._buttonY = 0, - a._buttonBack = 0, - a._buttonStart = 0, - a._buttonLB = 0, - a._buttonRB = 0, - a._buttonLeftStick = 0, - a._buttonRightStick = 0, - a._dPadUp = 0, - a._dPadDown = 0, - a._dPadLeft = 0, - a._dPadRight = 0, - a._isXboxOnePad = false, - a.type = qe.XBOX, - a._isXboxOnePad = r, - a - } - return h.d(t, e), - t.prototype.onlefttriggerchanged = function(e) { - this._onlefttriggerchanged = e - } - , - t.prototype.onrighttriggerchanged = function(e) { - this._onrighttriggerchanged = e - } - , + ); + })(Et), + wt = (function (e) { + function t(t, i, n, r, o, s) { + var c = e.call(this, t, a.x.Zero(), s) || this; + return ( + (c.alpha = i), + (c.beta = n), + (c.radius = r), + (c.target = o), + (c._cartesianCoordinates = a.x.Zero()), + c._follow(), + c + ); + } + return ( + h.d(t, e), + (t.prototype._follow = function () { + if (this.target) { + (this._cartesianCoordinates.x = + this.radius * + Math.cos(this.alpha) * + Math.cos(this.beta)), + (this._cartesianCoordinates.y = + this.radius * Math.sin(this.beta)), + (this._cartesianCoordinates.z = + this.radius * + Math.sin(this.alpha) * + Math.cos(this.beta)); + var e = this.target.getAbsolutePosition(); + (this.position = e.add(this._cartesianCoordinates)), + this.setTarget(e); + } + }), + (t.prototype._checkInputs = function () { + e.prototype._checkInputs.call(this), this._follow(); + }), + (t.prototype.getClassName = function () { + return "ArcFollowCamera"; + }), + t + ); + })(Et), + It = n(35), + Dt = n(39); + !(function (e) { + (e[(e.VIVE = 0)] = "VIVE"), + (e[(e.OCULUS = 1)] = "OCULUS"), + (e[(e.WINDOWS = 2)] = "WINDOWS"), + (e[(e.GEAR_VR = 3)] = "GEAR_VR"), + (e[(e.DAYDREAM = 4)] = "DAYDREAM"), + (e[(e.GENERIC = 5)] = "GENERIC"); + })(Mt || (Mt = {})); + var Lt, + Ft, + Bt = (function () { + function e() {} + return ( + (e.InitiateController = function (e) { + for ( + var t = 0, i = this._ControllerFactories; + t < i.length; + t++ + ) { + var n = i[t]; + if (n.canCreate(e)) return n.create(e); + } + if (this._DefaultControllerFactory) + return this._DefaultControllerFactory(e); + throw "The type of gamepad you are trying to load needs to be imported first or is not supported."; + }), + (e._ControllerFactories = []), + (e._DefaultControllerFactory = null), + e + ); + })(), + Nt = (function (e) { + function t(t) { + var i = e.call(this, t.id, t.index, t) || this; + return ( + (i._deviceRoomPosition = a.x.Zero()), + (i._deviceRoomRotationQuaternion = new a.q()), + (i.devicePosition = a.x.Zero()), + (i.deviceRotationQuaternion = new a.q()), + (i.deviceScaleFactor = 1), + (i._trackPosition = true), + (i._maxRotationDistFromHeadset = Math.PI / 5), + (i._draggedRoomRotation = 0), + (i._leftHandSystemQuaternion = new a.q()), + (i._deviceToWorld = a.j.Identity()), + (i._pointingPoseNode = null), + (i._workingMatrix = a.j.Identity()), + (i._meshAttachedObservable = new o.c()), + (i.type = qe.POSE_ENABLED), + (i.controllerType = Mt.GENERIC), + (i.position = a.x.Zero()), + (i.rotationQuaternion = new a.q()), + (i._calculatedPosition = a.x.Zero()), + (i._calculatedRotation = new a.q()), + a.q.RotationYawPitchRollToRef( + Math.PI, + 0, + 0, + i._leftHandSystemQuaternion + ), + i + ); + } + return ( + h.d(t, e), + (t.prototype._disableTrackPosition = function (e) { + this._trackPosition && + (this._calculatedPosition.copyFrom(e), + (this._trackPosition = false)); + }), + (t.prototype.update = function () { + e.prototype.update.call(this), this._updatePoseAndMesh(); + }), + (t.prototype._updatePoseAndMesh = function () { + var e = this.browserGamepad.pose; + if ( + (this.updateFromDevice(e), + !this._trackPosition && + R.a.LastCreatedScene && + R.a.LastCreatedScene.activeCamera && + R.a.LastCreatedScene.activeCamera.devicePosition && + ((t = + R.a.LastCreatedScene + .activeCamera)._computeDevicePosition(), + this._deviceToWorld.setTranslation(t.devicePosition), + t.deviceRotationQuaternion)) + ) { + var t; + (t = + t)._deviceRoomRotationQuaternion.toEulerAnglesToRef( + a.t.Vector3[0] + ); + var i = Math.atan2( + Math.sin( + a.t.Vector3[0].y - this._draggedRoomRotation + ), + Math.cos(a.t.Vector3[0].y - this._draggedRoomRotation) + ); + if (Math.abs(i) > this._maxRotationDistFromHeadset) { + var n = + i - + (i < 0 + ? -this._maxRotationDistFromHeadset + : this._maxRotationDistFromHeadset); + this._draggedRoomRotation += n; + var r = Math.sin(-n), + o = Math.cos(-n); + (this._calculatedPosition.x = + this._calculatedPosition.x * o - + this._calculatedPosition.z * r), + (this._calculatedPosition.z = + this._calculatedPosition.x * r + + this._calculatedPosition.z * o); + } + } + a.x.TransformCoordinatesToRef( + this._calculatedPosition, + this._deviceToWorld, + this.devicePosition + ), + this._deviceToWorld.getRotationMatrixToRef( + this._workingMatrix + ), + a.q.FromRotationMatrixToRef( + this._workingMatrix, + this.deviceRotationQuaternion + ), + this.deviceRotationQuaternion.multiplyInPlace( + this._calculatedRotation + ), + this._mesh && + (this._mesh.position.copyFrom(this.devicePosition), + this._mesh.rotationQuaternion && + this._mesh.rotationQuaternion.copyFrom( + this.deviceRotationQuaternion + )); + }), + (t.prototype.updateFromDevice = function (e) { + if (e) { + (this.rawPose = e), + e.position && + (this._deviceRoomPosition.copyFromFloats( + e.position[0], + e.position[1], + -e.position[2] + ), + this._mesh && + this._mesh.getScene().useRightHandedSystem && + (this._deviceRoomPosition.z *= -1), + this._trackPosition && + this._deviceRoomPosition.scaleToRef( + this.deviceScaleFactor, + this._calculatedPosition + ), + this._calculatedPosition.addInPlace(this.position)); + var t = this.rawPose; + e.orientation && + t.orientation && + (this._deviceRoomRotationQuaternion.copyFromFloats( + t.orientation[0], + t.orientation[1], + -t.orientation[2], + -t.orientation[3] + ), + this._mesh && + (this._mesh.getScene().useRightHandedSystem + ? ((this._deviceRoomRotationQuaternion.z *= -1), + (this._deviceRoomRotationQuaternion.w *= -1)) + : this._deviceRoomRotationQuaternion.multiplyToRef( + this._leftHandSystemQuaternion, + this._deviceRoomRotationQuaternion + )), + this._deviceRoomRotationQuaternion.multiplyToRef( + this.rotationQuaternion, + this._calculatedRotation + )); + } + }), + (t.prototype.attachToMesh = function (e) { + if ( + (this._mesh && (this._mesh.parent = null), + (this._mesh = e), + this._poseControlledCamera && + (this._mesh.parent = this._poseControlledCamera), + this._mesh.rotationQuaternion || + (this._mesh.rotationQuaternion = new a.q()), + this._updatePoseAndMesh(), + this._pointingPoseNode) + ) { + for (var t = [], i = this._pointingPoseNode; i.parent; ) + t.push(i.parent), (i = i.parent); + t.reverse().forEach(function (e) { + e.computeWorldMatrix(true); + }); + } + this._meshAttachedObservable.notifyObservers(e); + }), + (t.prototype.attachToPoseControlledCamera = function (e) { + (this._poseControlledCamera = e), + this._mesh && + (this._mesh.parent = this._poseControlledCamera); + }), + (t.prototype.dispose = function () { + this._mesh && this._mesh.dispose(), + (this._mesh = null), + e.prototype.dispose.call(this); + }), + Object.defineProperty(t.prototype, "mesh", { + get: function () { + return this._mesh; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getForwardRay = function (e) { + if ((void 0 === e && (e = 100), !this.mesh)) + return new Dt.a(a.x.Zero(), new a.x(0, 0, 1), e); + var t = this._pointingPoseNode + ? this._pointingPoseNode.getWorldMatrix() + : this.mesh.getWorldMatrix(), + i = t.getTranslation(), + n = new a.x(0, 0, -1), + r = a.x.TransformNormal(n, t), + o = a.x.Normalize(r); + return new Dt.a(i, o, e); + }), + (t.POINTING_POSE = "POINTING_POSE"), + t + ); + })(qe); + !(function (e) { + (e[(e.A = 0)] = "A"), + (e[(e.B = 1)] = "B"), + (e[(e.X = 2)] = "X"), + (e[(e.Y = 3)] = "Y"), + (e[(e.Start = 4)] = "Start"), + (e[(e.Back = 5)] = "Back"), + (e[(e.LB = 6)] = "LB"), + (e[(e.RB = 7)] = "RB"), + (e[(e.LeftStick = 8)] = "LeftStick"), + (e[(e.RightStick = 9)] = "RightStick"); + })(Lt || (Lt = {})), + (function (e) { + (e[(e.Up = 0)] = "Up"), + (e[(e.Down = 1)] = "Down"), + (e[(e.Left = 2)] = "Left"), + (e[(e.Right = 3)] = "Right"); + })(Ft || (Ft = {})); + var kt = (function (e) { + function t(t, i, n, r) { + void 0 === r && (r = false); + var a = e.call(this, t, i, n, 0, 1, 2, 3) || this; + return ( + (a._leftTrigger = 0), + (a._rightTrigger = 0), + (a.onButtonDownObservable = new o.c()), + (a.onButtonUpObservable = new o.c()), + (a.onPadDownObservable = new o.c()), + (a.onPadUpObservable = new o.c()), + (a._buttonA = 0), + (a._buttonB = 0), + (a._buttonX = 0), + (a._buttonY = 0), + (a._buttonBack = 0), + (a._buttonStart = 0), + (a._buttonLB = 0), + (a._buttonRB = 0), + (a._buttonLeftStick = 0), + (a._buttonRightStick = 0), + (a._dPadUp = 0), + (a._dPadDown = 0), + (a._dPadLeft = 0), + (a._dPadRight = 0), + (a._isXboxOnePad = false), + (a.type = qe.XBOX), + (a._isXboxOnePad = r), + a + ); + } + return ( + h.d(t, e), + (t.prototype.onlefttriggerchanged = function (e) { + this._onlefttriggerchanged = e; + }), + (t.prototype.onrighttriggerchanged = function (e) { + this._onrighttriggerchanged = e; + }), Object.defineProperty(t.prototype, "leftTrigger", { - get: function() { - return this._leftTrigger - }, - set: function(e) { - this._onlefttriggerchanged && this._leftTrigger !== e && this._onlefttriggerchanged(e), - this._leftTrigger = e - }, - enumerable: true, - configurable: true + get: function () { + return this._leftTrigger; + }, + set: function (e) { + this._onlefttriggerchanged && + this._leftTrigger !== e && + this._onlefttriggerchanged(e), + (this._leftTrigger = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rightTrigger", { - get: function() { - return this._rightTrigger - }, - set: function(e) { - this._onrighttriggerchanged && this._rightTrigger !== e && this._onrighttriggerchanged(e), - this._rightTrigger = e - }, - enumerable: true, - configurable: true + get: function () { + return this._rightTrigger; + }, + set: function (e) { + this._onrighttriggerchanged && + this._rightTrigger !== e && + this._onrighttriggerchanged(e), + (this._rightTrigger = e); + }, + enumerable: true, + configurable: true, }), - t.prototype.onbuttondown = function(e) { - this._onbuttondown = e - } - , - t.prototype.onbuttonup = function(e) { - this._onbuttonup = e - } - , - t.prototype.ondpaddown = function(e) { - this._ondpaddown = e - } - , - t.prototype.ondpadup = function(e) { - this._ondpadup = e - } - , - t.prototype._setButtonValue = function(e, t, i) { - return e !== t && (1 === e && (this._onbuttondown && this._onbuttondown(i), - this.onButtonDownObservable.notifyObservers(i)), - 0 === e && (this._onbuttonup && this._onbuttonup(i), - this.onButtonUpObservable.notifyObservers(i))), + (t.prototype.onbuttondown = function (e) { + this._onbuttondown = e; + }), + (t.prototype.onbuttonup = function (e) { + this._onbuttonup = e; + }), + (t.prototype.ondpaddown = function (e) { + this._ondpaddown = e; + }), + (t.prototype.ondpadup = function (e) { + this._ondpadup = e; + }), + (t.prototype._setButtonValue = function (e, t, i) { + return ( + e !== t && + (1 === e && + (this._onbuttondown && this._onbuttondown(i), + this.onButtonDownObservable.notifyObservers(i)), + 0 === e && + (this._onbuttonup && this._onbuttonup(i), + this.onButtonUpObservable.notifyObservers(i))), e - } - , - t.prototype._setDPadValue = function(e, t, i) { - return e !== t && (1 === e && (this._ondpaddown && this._ondpaddown(i), - this.onPadDownObservable.notifyObservers(i)), - 0 === e && (this._ondpadup && this._ondpadup(i), - this.onPadUpObservable.notifyObservers(i))), + ); + }), + (t.prototype._setDPadValue = function (e, t, i) { + return ( + e !== t && + (1 === e && + (this._ondpaddown && this._ondpaddown(i), + this.onPadDownObservable.notifyObservers(i)), + 0 === e && + (this._ondpadup && this._ondpadup(i), + this.onPadUpObservable.notifyObservers(i))), e - } - , + ); + }), Object.defineProperty(t.prototype, "buttonA", { - get: function() { - return this._buttonA - }, - set: function(e) { - this._buttonA = this._setButtonValue(e, this._buttonA, Lt.A) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonA; + }, + set: function (e) { + this._buttonA = this._setButtonValue( + e, + this._buttonA, + Lt.A + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonB", { - get: function() { - return this._buttonB - }, - set: function(e) { - this._buttonB = this._setButtonValue(e, this._buttonB, Lt.B) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonB; + }, + set: function (e) { + this._buttonB = this._setButtonValue( + e, + this._buttonB, + Lt.B + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonX", { - get: function() { - return this._buttonX - }, - set: function(e) { - this._buttonX = this._setButtonValue(e, this._buttonX, Lt.X) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonX; + }, + set: function (e) { + this._buttonX = this._setButtonValue( + e, + this._buttonX, + Lt.X + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonY", { - get: function() { - return this._buttonY - }, - set: function(e) { - this._buttonY = this._setButtonValue(e, this._buttonY, Lt.Y) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonY; + }, + set: function (e) { + this._buttonY = this._setButtonValue( + e, + this._buttonY, + Lt.Y + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonStart", { - get: function() { - return this._buttonStart - }, - set: function(e) { - this._buttonStart = this._setButtonValue(e, this._buttonStart, Lt.Start) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonStart; + }, + set: function (e) { + this._buttonStart = this._setButtonValue( + e, + this._buttonStart, + Lt.Start + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonBack", { - get: function() { - return this._buttonBack - }, - set: function(e) { - this._buttonBack = this._setButtonValue(e, this._buttonBack, Lt.Back) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonBack; + }, + set: function (e) { + this._buttonBack = this._setButtonValue( + e, + this._buttonBack, + Lt.Back + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonLB", { - get: function() { - return this._buttonLB - }, - set: function(e) { - this._buttonLB = this._setButtonValue(e, this._buttonLB, Lt.LB) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonLB; + }, + set: function (e) { + this._buttonLB = this._setButtonValue( + e, + this._buttonLB, + Lt.LB + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonRB", { - get: function() { - return this._buttonRB - }, - set: function(e) { - this._buttonRB = this._setButtonValue(e, this._buttonRB, Lt.RB) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonRB; + }, + set: function (e) { + this._buttonRB = this._setButtonValue( + e, + this._buttonRB, + Lt.RB + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonLeftStick", { - get: function() { - return this._buttonLeftStick - }, - set: function(e) { - this._buttonLeftStick = this._setButtonValue(e, this._buttonLeftStick, Lt.LeftStick) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonLeftStick; + }, + set: function (e) { + this._buttonLeftStick = this._setButtonValue( + e, + this._buttonLeftStick, + Lt.LeftStick + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "buttonRightStick", { - get: function() { - return this._buttonRightStick - }, - set: function(e) { - this._buttonRightStick = this._setButtonValue(e, this._buttonRightStick, Lt.RightStick) - }, - enumerable: true, - configurable: true + get: function () { + return this._buttonRightStick; + }, + set: function (e) { + this._buttonRightStick = this._setButtonValue( + e, + this._buttonRightStick, + Lt.RightStick + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "dPadUp", { - get: function() { - return this._dPadUp - }, - set: function(e) { - this._dPadUp = this._setDPadValue(e, this._dPadUp, Ft.Up) - }, - enumerable: true, - configurable: true + get: function () { + return this._dPadUp; + }, + set: function (e) { + this._dPadUp = this._setDPadValue( + e, + this._dPadUp, + Ft.Up + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "dPadDown", { - get: function() { - return this._dPadDown - }, - set: function(e) { - this._dPadDown = this._setDPadValue(e, this._dPadDown, Ft.Down) - }, - enumerable: true, - configurable: true + get: function () { + return this._dPadDown; + }, + set: function (e) { + this._dPadDown = this._setDPadValue( + e, + this._dPadDown, + Ft.Down + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "dPadLeft", { - get: function() { - return this._dPadLeft - }, - set: function(e) { - this._dPadLeft = this._setDPadValue(e, this._dPadLeft, Ft.Left) - }, - enumerable: true, - configurable: true + get: function () { + return this._dPadLeft; + }, + set: function (e) { + this._dPadLeft = this._setDPadValue( + e, + this._dPadLeft, + Ft.Left + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "dPadRight", { - get: function() { - return this._dPadRight - }, - set: function(e) { - this._dPadRight = this._setDPadValue(e, this._dPadRight, Ft.Right) - }, - enumerable: true, - configurable: true + get: function () { + return this._dPadRight; + }, + set: function (e) { + this._dPadRight = this._setDPadValue( + e, + this._dPadRight, + Ft.Right + ); + }, + enumerable: true, + configurable: true, }), - t.prototype.update = function() { - e.prototype.update.call(this), - this._isXboxOnePad ? (this.buttonA = this.browserGamepad.buttons[0].value, - this.buttonB = this.browserGamepad.buttons[1].value, - this.buttonX = this.browserGamepad.buttons[2].value, - this.buttonY = this.browserGamepad.buttons[3].value, - this.buttonLB = this.browserGamepad.buttons[4].value, - this.buttonRB = this.browserGamepad.buttons[5].value, - this.leftTrigger = this.browserGamepad.axes[2], - this.rightTrigger = this.browserGamepad.axes[5], - this.buttonBack = this.browserGamepad.buttons[9].value, - this.buttonStart = this.browserGamepad.buttons[8].value, - this.buttonLeftStick = this.browserGamepad.buttons[6].value, - this.buttonRightStick = this.browserGamepad.buttons[7].value, - this.dPadUp = this.browserGamepad.buttons[11].value, - this.dPadDown = this.browserGamepad.buttons[12].value, - this.dPadLeft = this.browserGamepad.buttons[13].value, - this.dPadRight = this.browserGamepad.buttons[14].value) : (this.buttonA = this.browserGamepad.buttons[0].value, - this.buttonB = this.browserGamepad.buttons[1].value, - this.buttonX = this.browserGamepad.buttons[2].value, - this.buttonY = this.browserGamepad.buttons[3].value, - this.buttonLB = this.browserGamepad.buttons[4].value, - this.buttonRB = this.browserGamepad.buttons[5].value, - this.leftTrigger = this.browserGamepad.buttons[6].value, - this.rightTrigger = this.browserGamepad.buttons[7].value, - this.buttonBack = this.browserGamepad.buttons[8].value, - this.buttonStart = this.browserGamepad.buttons[9].value, - this.buttonLeftStick = this.browserGamepad.buttons[10].value, - this.buttonRightStick = this.browserGamepad.buttons[11].value, - this.dPadUp = this.browserGamepad.buttons[12].value, - this.dPadDown = this.browserGamepad.buttons[13].value, - this.dPadLeft = this.browserGamepad.buttons[14].value, - this.dPadRight = this.browserGamepad.buttons[15].value) - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), + (t.prototype.update = function () { + e.prototype.update.call(this), + this._isXboxOnePad + ? ((this.buttonA = + this.browserGamepad.buttons[0].value), + (this.buttonB = + this.browserGamepad.buttons[1].value), + (this.buttonX = + this.browserGamepad.buttons[2].value), + (this.buttonY = + this.browserGamepad.buttons[3].value), + (this.buttonLB = + this.browserGamepad.buttons[4].value), + (this.buttonRB = + this.browserGamepad.buttons[5].value), + (this.leftTrigger = this.browserGamepad.axes[2]), + (this.rightTrigger = this.browserGamepad.axes[5]), + (this.buttonBack = + this.browserGamepad.buttons[9].value), + (this.buttonStart = + this.browserGamepad.buttons[8].value), + (this.buttonLeftStick = + this.browserGamepad.buttons[6].value), + (this.buttonRightStick = + this.browserGamepad.buttons[7].value), + (this.dPadUp = + this.browserGamepad.buttons[11].value), + (this.dPadDown = + this.browserGamepad.buttons[12].value), + (this.dPadLeft = + this.browserGamepad.buttons[13].value), + (this.dPadRight = + this.browserGamepad.buttons[14].value)) + : ((this.buttonA = + this.browserGamepad.buttons[0].value), + (this.buttonB = + this.browserGamepad.buttons[1].value), + (this.buttonX = + this.browserGamepad.buttons[2].value), + (this.buttonY = + this.browserGamepad.buttons[3].value), + (this.buttonLB = + this.browserGamepad.buttons[4].value), + (this.buttonRB = + this.browserGamepad.buttons[5].value), + (this.leftTrigger = + this.browserGamepad.buttons[6].value), + (this.rightTrigger = + this.browserGamepad.buttons[7].value), + (this.buttonBack = + this.browserGamepad.buttons[8].value), + (this.buttonStart = + this.browserGamepad.buttons[9].value), + (this.buttonLeftStick = + this.browserGamepad.buttons[10].value), + (this.buttonRightStick = + this.browserGamepad.buttons[11].value), + (this.dPadUp = + this.browserGamepad.buttons[12].value), + (this.dPadDown = + this.browserGamepad.buttons[13].value), + (this.dPadLeft = + this.browserGamepad.buttons[14].value), + (this.dPadRight = + this.browserGamepad.buttons[15].value)); + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), this.onButtonDownObservable.clear(), this.onButtonUpObservable.clear(), this.onPadDownObservable.clear(), - this.onPadUpObservable.clear() - } - , - t - }(qe) - , Ut = function() { - function e(e) { - var t = this; - this._scene = e, - this._babylonGamepads = [], - this._oneGamepadConnected = false, - this._isMonitoring = false, - this.onGamepadDisconnectedObservable = new o.c, - It.a.IsWindowObjectExist() ? (this._gamepadEventSupported = "GamepadEvent"in window, - this._gamepadSupport = navigator.getGamepads || navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads) : this._gamepadEventSupported = false, - this.onGamepadConnectedObservable = new o.c(function(e) { - for (var i in t._babylonGamepads) { - var n = t._babylonGamepads[i]; - n && n._isConnected && t.onGamepadConnectedObservable.notifyObserver(e, n) - } - } - ), - this._onGamepadConnectedEvent = function(e) { - var i, n = e.gamepad; - n.index in t._babylonGamepads && t._babylonGamepads[n.index].isConnected || (t._babylonGamepads[n.index] ? ((i = t._babylonGamepads[n.index]).browserGamepad = n, - i._isConnected = true) : i = t._addNewGamepad(n), - t.onGamepadConnectedObservable.notifyObservers(i), - t._startMonitoringGamepads()) - } - , - this._onGamepadDisconnectedEvent = function(e) { - var i = e.gamepad; - for (var n in t._babylonGamepads) - if (t._babylonGamepads[n].index === i.index) { - var r = t._babylonGamepads[n]; - r._isConnected = false, - t.onGamepadDisconnectedObservable.notifyObservers(r); - break - } - } - , - this._gamepadSupport && (this._updateGamepadObjects(), - this._babylonGamepads.length && this._startMonitoringGamepads(), - this._gamepadEventSupported ? (window.addEventListener("gamepadconnected", this._onGamepadConnectedEvent, false), - window.addEventListener("gamepaddisconnected", this._onGamepadDisconnectedEvent, false)) : this._startMonitoringGamepads()) - } - return Object.defineProperty(e.prototype, "gamepads", { - get: function() { - return this._babylonGamepads - }, - enumerable: true, - configurable: true + this.onPadUpObservable.clear(); }), - e.prototype.getGamepadByType = function(e) { - void 0 === e && (e = qe.XBOX); - for (var t = 0, i = this._babylonGamepads; t < i.length; t++) { - var n = i[t]; - if (n && n.type === e) - return n + t + ); + })(qe), + Ut = (function () { + function e(e) { + var t = this; + (this._scene = e), + (this._babylonGamepads = []), + (this._oneGamepadConnected = false), + (this._isMonitoring = false), + (this.onGamepadDisconnectedObservable = new o.c()), + It.a.IsWindowObjectExist() + ? ((this._gamepadEventSupported = + "GamepadEvent" in window), + (this._gamepadSupport = + navigator.getGamepads || + navigator.webkitGetGamepads || + navigator.msGetGamepads || + navigator.webkitGamepads)) + : (this._gamepadEventSupported = false), + (this.onGamepadConnectedObservable = new o.c(function ( + e + ) { + for (var i in t._babylonGamepads) { + var n = t._babylonGamepads[i]; + n && + n._isConnected && + t.onGamepadConnectedObservable.notifyObserver(e, n); } - return null - } - , - e.prototype.dispose = function() { - this._gamepadEventSupported && (this._onGamepadConnectedEvent && window.removeEventListener("gamepadconnected", this._onGamepadConnectedEvent), - this._onGamepadDisconnectedEvent && window.removeEventListener("gamepaddisconnected", this._onGamepadDisconnectedEvent), - this._onGamepadConnectedEvent = null, - this._onGamepadDisconnectedEvent = null), - this._babylonGamepads.forEach(function(e) { - e.dispose() + })), + (this._onGamepadConnectedEvent = function (e) { + var i, + n = e.gamepad; + (n.index in t._babylonGamepads && + t._babylonGamepads[n.index].isConnected) || + (t._babylonGamepads[n.index] + ? (((i = + t._babylonGamepads[n.index]).browserGamepad = + n), + (i._isConnected = true)) + : (i = t._addNewGamepad(n)), + t.onGamepadConnectedObservable.notifyObservers(i), + t._startMonitoringGamepads()); + }), + (this._onGamepadDisconnectedEvent = function (e) { + var i = e.gamepad; + for (var n in t._babylonGamepads) + if (t._babylonGamepads[n].index === i.index) { + var r = t._babylonGamepads[n]; + (r._isConnected = false), + t.onGamepadDisconnectedObservable.notifyObservers( + r + ); + break; + } + }), + this._gamepadSupport && + (this._updateGamepadObjects(), + this._babylonGamepads.length && + this._startMonitoringGamepads(), + this._gamepadEventSupported + ? (window.addEventListener( + "gamepadconnected", + this._onGamepadConnectedEvent, + false + ), + window.addEventListener( + "gamepaddisconnected", + this._onGamepadDisconnectedEvent, + false + )) + : this._startMonitoringGamepads()); + } + return ( + Object.defineProperty(e.prototype, "gamepads", { + get: function () { + return this._babylonGamepads; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getGamepadByType = function (e) { + void 0 === e && (e = qe.XBOX); + for ( + var t = 0, i = this._babylonGamepads; + t < i.length; + t++ + ) { + var n = i[t]; + if (n && n.type === e) return n; + } + return null; + }), + (e.prototype.dispose = function () { + this._gamepadEventSupported && + (this._onGamepadConnectedEvent && + window.removeEventListener( + "gamepadconnected", + this._onGamepadConnectedEvent + ), + this._onGamepadDisconnectedEvent && + window.removeEventListener( + "gamepaddisconnected", + this._onGamepadDisconnectedEvent + ), + (this._onGamepadConnectedEvent = null), + (this._onGamepadDisconnectedEvent = null)), + this._babylonGamepads.forEach(function (e) { + e.dispose(); }), this.onGamepadConnectedObservable.clear(), this.onGamepadDisconnectedObservable.clear(), - this._oneGamepadConnected = false, + (this._oneGamepadConnected = false), this._stopMonitoringGamepads(), - this._babylonGamepads = [] - } - , - e.prototype._addNewGamepad = function(e) { - var t; - this._oneGamepadConnected || (this._oneGamepadConnected = true); - var i = -1 !== e.id.search("Xbox One"); - return t = i || -1 !== e.id.search("Xbox 360") || -1 !== e.id.search("xinput") ? new kt(e.id,e.index,e,i) : e.pose ? Bt.InitiateController(e) : new Ze(e.id,e.index,e), - this._babylonGamepads[t.index] = t, + (this._babylonGamepads = []); + }), + (e.prototype._addNewGamepad = function (e) { + var t; + this._oneGamepadConnected || + (this._oneGamepadConnected = true); + var i = -1 !== e.id.search("Xbox One"); + return ( + (t = + i || + -1 !== e.id.search("Xbox 360") || + -1 !== e.id.search("xinput") + ? new kt(e.id, e.index, e, i) + : e.pose + ? Bt.InitiateController(e) + : new Ze(e.id, e.index, e)), + (this._babylonGamepads[t.index] = t), t - } - , - e.prototype._startMonitoringGamepads = function() { - this._isMonitoring || (this._isMonitoring = true, - this._scene || this._checkGamepadsStatus()) - } - , - e.prototype._stopMonitoringGamepads = function() { - this._isMonitoring = false - } - , - e.prototype._checkGamepadsStatus = function() { - var e = this; - for (var t in this._updateGamepadObjects(), - this._babylonGamepads) { - var i = this._babylonGamepads[t]; - i && i.isConnected && i.update() - } - this._isMonitoring && !this._scene && Ee.h.QueueNewFrame(function() { - e._checkGamepadsStatus() - }) - } - , - e.prototype._updateGamepadObjects = function() { - for (var e = navigator.getGamepads ? navigator.getGamepads() : navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : [], t = 0; t < e.length; t++) { - var i = e[t]; - if (i) - if (this._babylonGamepads[i.index]) - this._babylonGamepads[t].browserGamepad = i, - this._babylonGamepads[t].isConnected || (this._babylonGamepads[t]._isConnected = true, - this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[t])); - else { - var n = this._addNewGamepad(i); - this.onGamepadConnectedObservable.notifyObservers(n) - } - } - } - , + ); + }), + (e.prototype._startMonitoringGamepads = function () { + this._isMonitoring || + ((this._isMonitoring = true), + this._scene || this._checkGamepadsStatus()); + }), + (e.prototype._stopMonitoringGamepads = function () { + this._isMonitoring = false; + }), + (e.prototype._checkGamepadsStatus = function () { + var e = this; + for (var t in (this._updateGamepadObjects(), + this._babylonGamepads)) { + var i = this._babylonGamepads[t]; + i && i.isConnected && i.update(); + } + this._isMonitoring && + !this._scene && + Ee.h.QueueNewFrame(function () { + e._checkGamepadsStatus(); + }); + }), + (e.prototype._updateGamepadObjects = function () { + for ( + var e = navigator.getGamepads + ? navigator.getGamepads() + : navigator.webkitGetGamepads + ? navigator.webkitGetGamepads() + : [], + t = 0; + t < e.length; + t++ + ) { + var i = e[t]; + if (i) + if (this._babylonGamepads[i.index]) + (this._babylonGamepads[t].browserGamepad = i), + this._babylonGamepads[t].isConnected || + ((this._babylonGamepads[t]._isConnected = true), + this.onGamepadConnectedObservable.notifyObservers( + this._babylonGamepads[t] + )); + else { + var n = this._addNewGamepad(i); + this.onGamepadConnectedObservable.notifyObservers( + n + ); + } + } + }), e - }(); - Object.defineProperty(Y.a.prototype, "gamepadManager", { - get: function() { - if (!this._gamepadManager) { - this._gamepadManager = new Ut(this); - var e = this._getComponent(Se.a.NAME_GAMEPAD); - e || (e = new Vt(this), - this._addComponent(e)) - } - return this._gamepadManager + ); + })(); + Object.defineProperty(Y.a.prototype, "gamepadManager", { + get: function () { + if (!this._gamepadManager) { + this._gamepadManager = new Ut(this); + var e = this._getComponent(Se.a.NAME_GAMEPAD); + e || ((e = new Vt(this)), this._addComponent(e)); + } + return this._gamepadManager; + }, + enumerable: true, + configurable: true, + }), + (pt.prototype.addGamepad = function () { + return this.add(new gt()), this; + }), + (rt.prototype.addGamepad = function () { + return this.add(new Je()), this; + }); + var Vt = (function () { + function e(e) { + (this.name = Se.a.NAME_GAMEPAD), (this.scene = e); + } + return ( + (e.prototype.register = function () { + this.scene._beforeCameraUpdateStage.registerStep( + Se.a.STEP_BEFORECAMERAUPDATE_GAMEPAD, + this, + this._beforeCameraUpdate + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () { + var e = this.scene._gamepadManager; + e && (e.dispose(), (this.scene._gamepadManager = null)); + }), + (e.prototype._beforeCameraUpdate = function () { + var e = this.scene._gamepadManager; + e && e._isMonitoring && e._checkGamepadsStatus(); + }), + e + ); + })(); + N.a.AddNodeConstructor("FreeCamera", function (e, t) { + return function () { + return new Gt(e, a.x.Zero(), t); + }; + }); + var Gt = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, i, n) || this; + return r.inputs.addGamepad(), r; + } + return ( + h.d(t, e), + Object.defineProperty( + t.prototype, + "gamepadAngularSensibility", + { + get: function () { + var e = this.inputs.attached.gamepad; + return e ? e.gamepadAngularSensibility : 0; + }, + set: function (e) { + var t = this.inputs.attached.gamepad; + t && (t.gamepadAngularSensibility = e); + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty(t.prototype, "gamepadMoveSensibility", { + get: function () { + var e = this.inputs.attached.gamepad; + return e ? e.gamepadMoveSensibility : 0; + }, + set: function (e) { + var t = this.inputs.attached.gamepad; + t && (t.gamepadMoveSensibility = e); }, enumerable: true, - configurable: true - }), - pt.prototype.addGamepad = function() { - return this.add(new gt), - this - } - , - rt.prototype.addGamepad = function() { - return this.add(new Je), - this - } - ; - var Vt = function() { - function e(e) { - this.name = Se.a.NAME_GAMEPAD, - this.scene = e - } - return e.prototype.register = function() { - this.scene._beforeCameraUpdateStage.registerStep(Se.a.STEP_BEFORECAMERAUPDATE_GAMEPAD, this, this._beforeCameraUpdate) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() { - var e = this.scene._gamepadManager; - e && (e.dispose(), - this.scene._gamepadManager = null) - } - , - e.prototype._beforeCameraUpdate = function() { - var e = this.scene._gamepadManager; - e && e._isMonitoring && e._checkGamepadsStatus() - } - , - e - }(); - N.a.AddNodeConstructor("FreeCamera", function(e, t) { - return function() { - return new Gt(e,a.x.Zero(),t) - } + configurable: true, + }), + (t.prototype.getClassName = function () { + return "UniversalCamera"; + }), + t + ); + })(At); + (ke.a._createDefaultParsedCamera = function (e, t) { + return new Gt(e, a.x.Zero(), t); + }), + N.a.AddNodeConstructor("GamepadCamera", function (e, t) { + return function () { + return new zt(e, a.x.Zero(), t); + }; }); - var Gt = function(e) { - function t(t, i, n) { - var r = e.call(this, t, i, n) || this; - return r.inputs.addGamepad(), - r - } - return h.d(t, e), - Object.defineProperty(t.prototype, "gamepadAngularSensibility", { - get: function() { - var e = this.inputs.attached.gamepad; - return e ? e.gamepadAngularSensibility : 0 - }, - set: function(e) { - var t = this.inputs.attached.gamepad; - t && (t.gamepadAngularSensibility = e) - }, - enumerable: true, - configurable: true + var zt = (function (e) { + function t(t, i, n) { + return e.call(this, t, i, n) || this; + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "GamepadCamera"; }), - Object.defineProperty(t.prototype, "gamepadMoveSensibility", { - get: function() { - var e = this.inputs.attached.gamepad; - return e ? e.gamepadMoveSensibility : 0 - }, - set: function(e) { - var t = this.inputs.attached.gamepad; - t && (t.gamepadMoveSensibility = e) - }, - enumerable: true, - configurable: true - }), - t.prototype.getClassName = function() { - return "UniversalCamera" - } - , t - }(At); - ke.a._createDefaultParsedCamera = function(e, t) { - return new Gt(e,a.x.Zero(),t) - } - , - N.a.AddNodeConstructor("GamepadCamera", function(e, t) { - return function() { - return new zt(e,a.x.Zero(),t) - } - }); - var zt = function(e) { - function t(t, i, n) { - return e.call(this, t, i, n) || this - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "GamepadCamera" - } - , - t - }(Gt) - , jt = n(28) - , Ht = n(5); - Ht.a.ShadersStore.postprocessVertexShader = "\nattribute vec2 position;\nuniform vec2 scale;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n}"; - var Wt = function() { - function e(e, t, i, n, r, s, c, u, l, h, f, d, p, m) { - void 0 === c && (c = _.a.TEXTURE_NEAREST_SAMPLINGMODE), - void 0 === h && (h = null), - void 0 === f && (f = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === d && (d = "postprocess"), - void 0 === m && (m = false), - this.name = e, - this.width = -1, - this.height = -1, - this._outputTexture = null, - this.autoClear = true, - this.alphaMode = _.a.ALPHA_DISABLE, - this.animations = new Array, - this.enablePixelPerfectMode = false, - this.forceFullscreenViewport = true, - this.scaleMode = _.a.SCALEMODE_FLOOR, - this.alwaysForcePOT = false, - this._samples = 1, - this.adaptScaleToCurrentViewport = false, - this._reusable = false, - this._textures = new jt.a(2), - this._currentRenderTextureInd = 0, - this._scaleRatio = new a.w(1,1), - this._texelSize = a.w.Zero(), - this.onActivateObservable = new o.c, - this.onSizeChangedObservable = new o.c, - this.onApplyObservable = new o.c, - this.onBeforeRenderObservable = new o.c, - this.onAfterRenderObservable = new o.c, - null != s ? (this._camera = s, - this._scene = s.getScene(), + ); + })(Gt), + jt = n(28), + Ht = n(5); + Ht.a.ShadersStore.postprocessVertexShader = + "\nattribute vec2 position;\nuniform vec2 scale;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n}"; + var Wt = (function () { + function e(e, t, i, n, r, s, c, u, l, h, f, d, p, m) { + void 0 === c && (c = _.a.TEXTURE_NEAREST_SAMPLINGMODE), + void 0 === h && (h = null), + void 0 === f && (f = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === d && (d = "postprocess"), + void 0 === m && (m = false), + (this.name = e), + (this.width = -1), + (this.height = -1), + (this._outputTexture = null), + (this.autoClear = true), + (this.alphaMode = _.a.ALPHA_DISABLE), + (this.animations = new Array()), + (this.enablePixelPerfectMode = false), + (this.forceFullscreenViewport = true), + (this.scaleMode = _.a.SCALEMODE_FLOOR), + (this.alwaysForcePOT = false), + (this._samples = 1), + (this.adaptScaleToCurrentViewport = false), + (this._reusable = false), + (this._textures = new jt.a(2)), + (this._currentRenderTextureInd = 0), + (this._scaleRatio = new a.w(1, 1)), + (this._texelSize = a.w.Zero()), + (this.onActivateObservable = new o.c()), + (this.onSizeChangedObservable = new o.c()), + (this.onApplyObservable = new o.c()), + (this.onBeforeRenderObservable = new o.c()), + (this.onAfterRenderObservable = new o.c()), + null != s + ? ((this._camera = s), + (this._scene = s.getScene()), s.attachPostProcess(this), - this._engine = this._scene.getEngine(), + (this._engine = this._scene.getEngine()), this._scene.postProcesses.push(this), - this.uniqueId = this._scene.getUniqueId()) : u && (this._engine = u, + (this.uniqueId = this._scene.getUniqueId())) + : u && + ((this._engine = u), this._engine.postProcesses.push(this)), - this._options = r, - this.renderTargetSamplingMode = c || _.a.TEXTURE_NEAREST_SAMPLINGMODE, - this._reusable = l || false, - this._textureType = f, - this._samplers = n || [], - this._samplers.push("textureSampler"), - this._fragmentUrl = t, - this._vertexUrl = d, - this._parameters = i || [], - this._parameters.push("scale"), - this._indexParameters = p, - m || this.updateEffect(h) - } - return Object.defineProperty(e.prototype, "samples", { - get: function() { - return this._samples + (this._options = r), + (this.renderTargetSamplingMode = + c || _.a.TEXTURE_NEAREST_SAMPLINGMODE), + (this._reusable = l || false), + (this._textureType = f), + (this._samplers = n || []), + this._samplers.push("textureSampler"), + (this._fragmentUrl = t), + (this._vertexUrl = d), + (this._parameters = i || []), + this._parameters.push("scale"), + (this._indexParameters = p), + m || this.updateEffect(h); + } + return ( + Object.defineProperty(e.prototype, "samples", { + get: function () { + return this._samples; + }, + set: function (e) { + var t = this; + (this._samples = e), + this._textures.forEach(function (e) { + e.samples !== t._samples && + t._engine.updateRenderTargetTextureSampleCount( + e, + t._samples + ); + }); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getEffectName = function () { + return this._fragmentUrl; + }), + Object.defineProperty(e.prototype, "onActivate", { + set: function (e) { + this._onActivateObserver && + this.onActivateObservable.remove( + this._onActivateObserver + ), + e && + (this._onActivateObserver = + this.onActivateObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "onSizeChanged", { + set: function (e) { + this._onSizeChangedObserver && + this.onSizeChangedObservable.remove( + this._onSizeChangedObserver + ), + (this._onSizeChangedObserver = + this.onSizeChangedObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "onApply", { + set: function (e) { + this._onApplyObserver && + this.onApplyObservable.remove(this._onApplyObserver), + (this._onApplyObserver = this.onApplyObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "onBeforeRender", { + set: function (e) { + this._onBeforeRenderObserver && + this.onBeforeRenderObservable.remove( + this._onBeforeRenderObserver + ), + (this._onBeforeRenderObserver = + this.onBeforeRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "onAfterRender", { + set: function (e) { + this._onAfterRenderObserver && + this.onAfterRenderObservable.remove( + this._onAfterRenderObserver + ), + (this._onAfterRenderObserver = + this.onAfterRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "inputTexture", { + get: function () { + return this._textures.data[this._currentRenderTextureInd]; + }, + set: function (e) { + this._forcedOutputTexture = e; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getCamera = function () { + return this._camera; + }), + Object.defineProperty(e.prototype, "texelSize", { + get: function () { + return this._shareOutputWithPostProcess + ? this._shareOutputWithPostProcess.texelSize + : (this._forcedOutputTexture && + this._texelSize.copyFromFloats( + 1 / this._forcedOutputTexture.width, + 1 / this._forcedOutputTexture.height + ), + this._texelSize); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getClassName = function () { + return "PostProcess"; + }), + (e.prototype.getEngine = function () { + return this._engine; + }), + (e.prototype.getEffect = function () { + return this._effect; + }), + (e.prototype.shareOutputWith = function (e) { + return ( + this._disposeTextures(), + (this._shareOutputWithPostProcess = e), + this + ); + }), + (e.prototype.useOwnOutput = function () { + 0 == this._textures.length && + (this._textures = new jt.a(2)), + (this._shareOutputWithPostProcess = null); + }), + (e.prototype.updateEffect = function (e, t, i, n, r, o) { + void 0 === e && (e = null), + void 0 === t && (t = null), + void 0 === i && (i = null), + (this._effect = this._engine.createEffect( + { + vertex: this._vertexUrl, + fragment: this._fragmentUrl, }, - set: function(e) { - var t = this; - this._samples = e, - this._textures.forEach(function(e) { - e.samples !== t._samples && t._engine.updateRenderTargetTextureSampleCount(e, t._samples) - }) - }, - enumerable: true, - configurable: true - }), - e.prototype.getEffectName = function() { - return this._fragmentUrl - } - , - Object.defineProperty(e.prototype, "onActivate", { - set: function(e) { - this._onActivateObserver && this.onActivateObservable.remove(this._onActivateObserver), - e && (this._onActivateObserver = this.onActivateObservable.add(e)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "onSizeChanged", { - set: function(e) { - this._onSizeChangedObserver && this.onSizeChangedObservable.remove(this._onSizeChangedObserver), - this._onSizeChangedObserver = this.onSizeChangedObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "onApply", { - set: function(e) { - this._onApplyObserver && this.onApplyObservable.remove(this._onApplyObserver), - this._onApplyObserver = this.onApplyObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "onBeforeRender", { - set: function(e) { - this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), - this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "onAfterRender", { - set: function(e) { - this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), - this._onAfterRenderObserver = this.onAfterRenderObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "inputTexture", { - get: function() { - return this._textures.data[this._currentRenderTextureInd] - }, - set: function(e) { - this._forcedOutputTexture = e - }, - enumerable: true, - configurable: true - }), - e.prototype.getCamera = function() { - return this._camera - } - , - Object.defineProperty(e.prototype, "texelSize", { - get: function() { - return this._shareOutputWithPostProcess ? this._shareOutputWithPostProcess.texelSize : (this._forcedOutputTexture && this._texelSize.copyFromFloats(1 / this._forcedOutputTexture.width, 1 / this._forcedOutputTexture.height), - this._texelSize) - }, - enumerable: true, - configurable: true - }), - e.prototype.getClassName = function() { - return "PostProcess" - } - , - e.prototype.getEngine = function() { - return this._engine - } - , - e.prototype.getEffect = function() { - return this._effect - } - , - e.prototype.shareOutputWith = function(e) { - return this._disposeTextures(), - this._shareOutputWithPostProcess = e, - this - } - , - e.prototype.useOwnOutput = function() { - 0 == this._textures.length && (this._textures = new jt.a(2)), - this._shareOutputWithPostProcess = null - } - , - e.prototype.updateEffect = function(e, t, i, n, r, o) { - void 0 === e && (e = null), - void 0 === t && (t = null), - void 0 === i && (i = null), - this._effect = this._engine.createEffect({ - vertex: this._vertexUrl, - fragment: this._fragmentUrl - }, ["position"], t || this._parameters, i || this._samplers, null !== e ? e : "", void 0, r, o, n || this._indexParameters) - } - , - e.prototype.isReusable = function() { - return this._reusable - } - , - e.prototype.markTextureDirty = function() { - this.width = -1 - } - , - e.prototype.activate = function(e, t, i) { - var n = this; - void 0 === t && (t = null); - var r = (e = e || this._camera).getScene() - , o = r.getEngine() - , a = o.getCaps().maxTextureSize - , s = (t ? t.width : this._engine.getRenderWidth(true)) * this._options | 0 - , c = (t ? t.height : this._engine.getRenderHeight(true)) * this._options | 0 - , u = e.parent; - !u || u.leftCamera != e && u.rightCamera != e || (s /= 2); - var l, h = this._options.width || s, f = this._options.height || c; - if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) { - if (this.adaptScaleToCurrentViewport) { - var d = o.currentViewport; - d && (h *= d.width, - f *= d.height) - } - if ((this.renderTargetSamplingMode === _.a.TEXTURE_TRILINEAR_SAMPLINGMODE || this.alwaysForcePOT) && (this._options.width || (h = o.needPOTTextures ? Ee.h.GetExponentOfTwo(h, a, this.scaleMode) : h), - this._options.height || (f = o.needPOTTextures ? Ee.h.GetExponentOfTwo(f, a, this.scaleMode) : f)), - this.width !== h || this.height !== f) { - if (this._textures.length > 0) { - for (var p = 0; p < this._textures.length; p++) - this._engine._releaseTexture(this._textures.data[p]); - this._textures.reset() - } - this.width = h, - this.height = f; - var m = { - width: this.width, - height: this.height - } - , g = { - generateMipMaps: false, - generateDepthBuffer: i || 0 === e._postProcesses.indexOf(this), - generateStencilBuffer: (i || 0 === e._postProcesses.indexOf(this)) && this._engine.isStencilEnable, - samplingMode: this.renderTargetSamplingMode, - type: this._textureType - }; - this._textures.push(this._engine.createRenderTargetTexture(m, g)), - this._reusable && this._textures.push(this._engine.createRenderTargetTexture(m, g)), - this._texelSize.copyFromFloats(1 / this.width, 1 / this.height), - this.onSizeChangedObservable.notifyObservers(this) - } - this._textures.forEach(function(e) { - e.samples !== n.samples && n._engine.updateRenderTargetTextureSampleCount(e, n.samples) - }) + ["position"], + t || this._parameters, + i || this._samplers, + null !== e ? e : "", + void 0, + r, + o, + n || this._indexParameters + )); + }), + (e.prototype.isReusable = function () { + return this._reusable; + }), + (e.prototype.markTextureDirty = function () { + this.width = -1; + }), + (e.prototype.activate = function (e, t, i) { + var n = this; + void 0 === t && (t = null); + var r = (e = e || this._camera).getScene(), + o = r.getEngine(), + a = o.getCaps().maxTextureSize, + s = + ((t ? t.width : this._engine.getRenderWidth(true)) * + this._options) | + 0, + c = + ((t ? t.height : this._engine.getRenderHeight(true)) * + this._options) | + 0, + u = e.parent; + !u || (u.leftCamera != e && u.rightCamera != e) || (s /= 2); + var l, + h = this._options.width || s, + f = this._options.height || c; + if ( + !this._shareOutputWithPostProcess && + !this._forcedOutputTexture + ) { + if (this.adaptScaleToCurrentViewport) { + var d = o.currentViewport; + d && ((h *= d.width), (f *= d.height)); + } + if ( + ((this.renderTargetSamplingMode === + _.a.TEXTURE_TRILINEAR_SAMPLINGMODE || + this.alwaysForcePOT) && + (this._options.width || + (h = o.needPOTTextures + ? Ee.h.GetExponentOfTwo(h, a, this.scaleMode) + : h), + this._options.height || + (f = o.needPOTTextures + ? Ee.h.GetExponentOfTwo(f, a, this.scaleMode) + : f)), + this.width !== h || this.height !== f) + ) { + if (this._textures.length > 0) { + for (var p = 0; p < this._textures.length; p++) + this._engine._releaseTexture( + this._textures.data[p] + ); + this._textures.reset(); } - return this._shareOutputWithPostProcess ? l = this._shareOutputWithPostProcess.inputTexture : this._forcedOutputTexture ? (l = this._forcedOutputTexture, - this.width = this._forcedOutputTexture.width, - this.height = this._forcedOutputTexture.height) : l = this.inputTexture, - this.enablePixelPerfectMode ? (this._scaleRatio.copyFromFloats(s / h, c / f), - this._engine.bindFramebuffer(l, 0, s, c, this.forceFullscreenViewport)) : (this._scaleRatio.copyFromFloats(1, 1), - this._engine.bindFramebuffer(l, 0, void 0, void 0, this.forceFullscreenViewport)), - this.onActivateObservable.notifyObservers(e), - this.autoClear && this.alphaMode === _.a.ALPHA_DISABLE && this._engine.clear(this.clearColor ? this.clearColor : r.clearColor, r._allowPostProcessClearColor, true, true), - this._reusable && (this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2), - l + (this.width = h), (this.height = f); + var m = { + width: this.width, + height: this.height, + }, + g = { + generateMipMaps: false, + generateDepthBuffer: + i || 0 === e._postProcesses.indexOf(this), + generateStencilBuffer: + (i || 0 === e._postProcesses.indexOf(this)) && + this._engine.isStencilEnable, + samplingMode: this.renderTargetSamplingMode, + type: this._textureType, + }; + this._textures.push( + this._engine.createRenderTargetTexture(m, g) + ), + this._reusable && + this._textures.push( + this._engine.createRenderTargetTexture(m, g) + ), + this._texelSize.copyFromFloats( + 1 / this.width, + 1 / this.height + ), + this.onSizeChangedObservable.notifyObservers(this); + } + this._textures.forEach(function (e) { + e.samples !== n.samples && + n._engine.updateRenderTargetTextureSampleCount( + e, + n.samples + ); + }); } - , - Object.defineProperty(e.prototype, "isSupported", { - get: function() { - return this._effect.isSupported - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "aspectRatio", { - get: function() { - return this._shareOutputWithPostProcess ? this._shareOutputWithPostProcess.aspectRatio : this._forcedOutputTexture ? this._forcedOutputTexture.width / this._forcedOutputTexture.height : this.width / this.height - }, - enumerable: true, - configurable: true - }), - e.prototype.isReady = function() { - return this._effect && this._effect.isReady() - } - , - e.prototype.apply = function() { - return this._effect && this._effect.isReady() ? (this._engine.enableEffect(this._effect), + return ( + this._shareOutputWithPostProcess + ? (l = this._shareOutputWithPostProcess.inputTexture) + : this._forcedOutputTexture + ? ((l = this._forcedOutputTexture), + (this.width = this._forcedOutputTexture.width), + (this.height = this._forcedOutputTexture.height)) + : (l = this.inputTexture), + this.enablePixelPerfectMode + ? (this._scaleRatio.copyFromFloats(s / h, c / f), + this._engine.bindFramebuffer( + l, + 0, + s, + c, + this.forceFullscreenViewport + )) + : (this._scaleRatio.copyFromFloats(1, 1), + this._engine.bindFramebuffer( + l, + 0, + void 0, + void 0, + this.forceFullscreenViewport + )), + this.onActivateObservable.notifyObservers(e), + this.autoClear && + this.alphaMode === _.a.ALPHA_DISABLE && + this._engine.clear( + this.clearColor ? this.clearColor : r.clearColor, + r._allowPostProcessClearColor, + true, + true + ), + this._reusable && + (this._currentRenderTextureInd = + (this._currentRenderTextureInd + 1) % 2), + l + ); + }), + Object.defineProperty(e.prototype, "isSupported", { + get: function () { + return this._effect.isSupported; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "aspectRatio", { + get: function () { + return this._shareOutputWithPostProcess + ? this._shareOutputWithPostProcess.aspectRatio + : this._forcedOutputTexture + ? this._forcedOutputTexture.width / + this._forcedOutputTexture.height + : this.width / this.height; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.isReady = function () { + return this._effect && this._effect.isReady(); + }), + (e.prototype.apply = function () { + return this._effect && this._effect.isReady() + ? (this._engine.enableEffect(this._effect), this._engine.setState(false), this._engine.setDepthBuffer(false), this._engine.setDepthWrite(false), this._engine.setAlphaMode(this.alphaMode), - this.alphaConstants && this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a), - e = this._shareOutputWithPostProcess ? this._shareOutputWithPostProcess.inputTexture : this._forcedOutputTexture ? this._forcedOutputTexture : this.inputTexture, + this.alphaConstants && + this.getEngine().setAlphaConstants( + this.alphaConstants.r, + this.alphaConstants.g, + this.alphaConstants.b, + this.alphaConstants.a + ), + (e = this._shareOutputWithPostProcess + ? this._shareOutputWithPostProcess.inputTexture + : this._forcedOutputTexture + ? this._forcedOutputTexture + : this.inputTexture), this._effect._bindTexture("textureSampler", e), this._effect.setVector2("scale", this._scaleRatio), this.onApplyObservable.notifyObservers(this._effect), - this._effect) : null; - var e + this._effect) + : null; + var e; + }), + (e.prototype._disposeTextures = function () { + if ( + !this._shareOutputWithPostProcess && + !this._forcedOutputTexture + ) { + if (this._textures.length > 0) + for (var e = 0; e < this._textures.length; e++) + this._engine._releaseTexture(this._textures.data[e]); + this._textures.dispose(); } - , - e.prototype._disposeTextures = function() { - if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) { - if (this._textures.length > 0) - for (var e = 0; e < this._textures.length; e++) - this._engine._releaseTexture(this._textures.data[e]); - this._textures.dispose() - } + }), + (e.prototype.dispose = function (e) { + if ( + ((e = e || this._camera), + this._disposeTextures(), + this._scene) + ) { + var t = this._scene.postProcesses.indexOf(this); + -1 !== t && this._scene.postProcesses.splice(t, 1); + } else { + var i = this._engine.postProcesses.indexOf(this); + -1 !== i && this._engine.postProcesses.splice(i, 1); } - , - e.prototype.dispose = function(e) { - if (e = e || this._camera, - this._disposeTextures(), - this._scene) { - var t = this._scene.postProcesses.indexOf(this); - -1 !== t && this._scene.postProcesses.splice(t, 1) - } else { - var i = this._engine.postProcesses.indexOf(this); - -1 !== i && this._engine.postProcesses.splice(i, 1) - } - if (e) { - if (e.detachPostProcess(this), - 0 === e._postProcesses.indexOf(this) && e._postProcesses.length > 0) { - var n = this._camera._getFirstPostProcess(); - n && n.markTextureDirty() - } - this.onActivateObservable.clear(), - this.onAfterRenderObservable.clear(), - this.onApplyObservable.clear(), - this.onBeforeRenderObservable.clear(), - this.onSizeChangedObservable.clear() - } + if (e) { + if ( + (e.detachPostProcess(this), + 0 === e._postProcesses.indexOf(this) && + e._postProcesses.length > 0) + ) { + var n = this._camera._getFirstPostProcess(); + n && n.markTextureDirty(); + } + this.onActivateObservable.clear(), + this.onAfterRenderObservable.clear(), + this.onApplyObservable.clear(), + this.onBeforeRenderObservable.clear(), + this.onSizeChangedObservable.clear(); } - , - e - }(); - Ht.a.ShadersStore.passPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}"; - Ht.a.ShadersStore.passCubePixelShader = "\nvarying vec2 vUV;\nuniform samplerCube textureSampler;\nvoid main(void)\n{\nvec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));\n#endif\n}"; - var Xt = function(e) { - function t(t, i, n, r, o, a, s, c) { - return void 0 === n && (n = null), - void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === c && (c = false), - e.call(this, t, "pass", null, null, i, n, r, o, a, void 0, s, void 0, null, c) || this - } - return h.d(t, e), - t - }(Wt) - , Yt = function(e) { - function t(t, i, n, r, o, a, s, c) { - void 0 === n && (n = null), - void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === c && (c = false); - var u = e.call(this, t, "passCube", null, null, i, n, r, o, a, "#define POSITIVEX", s, void 0, null, c) || this; - return u._face = 0, - u - } - return h.d(t, e), + }), + e + ); + })(); + Ht.a.ShadersStore.passPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}"; + Ht.a.ShadersStore.passCubePixelShader = + "\nvarying vec2 vUV;\nuniform samplerCube textureSampler;\nvoid main(void)\n{\nvec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));\n#endif\n}"; + var Xt = (function (e) { + function t(t, i, n, r, o, a, s, c) { + return ( + void 0 === n && (n = null), + void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === c && (c = false), + e.call( + this, + t, + "pass", + null, + null, + i, + n, + r, + o, + a, + void 0, + s, + void 0, + null, + c + ) || this + ); + } + return h.d(t, e), t; + })(Wt), + Yt = (function (e) { + function t(t, i, n, r, o, a, s, c) { + void 0 === n && (n = null), + void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === c && (c = false); + var u = + e.call( + this, + t, + "passCube", + null, + null, + i, + n, + r, + o, + a, + "#define POSITIVEX", + s, + void 0, + null, + c + ) || this; + return (u._face = 0), u; + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "face", { - get: function() { - return this._face - }, - set: function(e) { - if (!(e < 0 || e > 5)) - switch (this._face = e, - this._face) { - case 0: - this.updateEffect("#define POSITIVEX"); - break; - case 1: - this.updateEffect("#define NEGATIVEX"); - break; - case 2: - this.updateEffect("#define POSITIVEY"); - break; - case 3: - this.updateEffect("#define NEGATIVEY"); - break; - case 4: - this.updateEffect("#define POSITIVEZ"); - break; - case 5: - this.updateEffect("#define NEGATIVEZ") - } - }, - enumerable: true, - configurable: true + get: function () { + return this._face; + }, + set: function (e) { + if (!(e < 0 || e > 5)) + switch (((this._face = e), this._face)) { + case 0: + this.updateEffect("#define POSITIVEX"); + break; + case 1: + this.updateEffect("#define NEGATIVEX"); + break; + case 2: + this.updateEffect("#define POSITIVEY"); + break; + case 3: + this.updateEffect("#define NEGATIVEY"); + break; + case 4: + this.updateEffect("#define POSITIVEZ"); + break; + case 5: + this.updateEffect("#define NEGATIVEZ"); + } + }, + enumerable: true, + configurable: true, }), t - }(Wt); - ve.b._RescalePostProcessFactory = function(e) { - return new Xt("rescale",1,null,ve.b.TEXTURE_BILINEAR_SAMPLINGMODE,e,false,ve.b.TEXTURETYPE_UNSIGNED_INT) + ); + })(Wt); + ve.b._RescalePostProcessFactory = function (e) { + return new Xt( + "rescale", + 1, + null, + ve.b.TEXTURE_BILINEAR_SAMPLINGMODE, + e, + false, + ve.b.TEXTURETYPE_UNSIGNED_INT + ); + }; + Ht.a.ShadersStore.anaglyphPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}"; + var Kt = (function (e) { + function t(t, i, n, r, o, a) { + var s = + e.call( + this, + t, + "anaglyph", + null, + ["leftSampler"], + i, + n[1], + r, + o, + a + ) || this; + return ( + (s._passedProcess = n[0]._rigPostProcess), + s.onApplyObservable.add(function (e) { + e.setTextureFromPostProcess( + "leftSampler", + s._passedProcess + ); + }), + s + ); } - ; - Ht.a.ShadersStore.anaglyphPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}"; - var Kt = function(e) { - function t(t, i, n, r, o, a) { - var s = e.call(this, t, "anaglyph", null, ["leftSampler"], i, n[1], r, o, a) || this; - return s._passedProcess = n[0]._rigPostProcess, - s.onApplyObservable.add(function(e) { - e.setTextureFromPostProcess("leftSampler", s._passedProcess) - }), - s - } - return h.d(t, e), - t - }(Wt); - ke.a._setStereoscopicAnaglyphRigMode = function(e) { - e._rigCameras[0]._rigPostProcess = new Xt(e.name + "_passthru",1,e._rigCameras[0]), - e._rigCameras[1]._rigPostProcess = new Kt(e.name + "_anaglyph",1,e._rigCameras) + return h.d(t, e), t; + })(Wt); + (ke.a._setStereoscopicAnaglyphRigMode = function (e) { + (e._rigCameras[0]._rigPostProcess = new Xt( + e.name + "_passthru", + 1, + e._rigCameras[0] + )), + (e._rigCameras[1]._rigPostProcess = new Kt( + e.name + "_anaglyph", + 1, + e._rigCameras + )); + }), + N.a.AddNodeConstructor( + "AnaglyphArcRotateCamera", + function (e, t, i) { + return function () { + return new Qt( + e, + 0, + 0, + 1, + a.x.Zero(), + i.interaxial_distance, + t + ); + }; + } + ); + var Qt = (function (e) { + function t(t, i, n, r, o, a, s) { + var c = e.call(this, t, i, n, r, o, s) || this; + return ( + (c.interaxialDistance = a), + c.setCameraRigMode(ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { + interaxialDistance: a, + }), + c + ); } - , - N.a.AddNodeConstructor("AnaglyphArcRotateCamera", function(e, t, i) { - return function() { - return new Qt(e,0,0,1,a.x.Zero(),i.interaxial_distance,t) - } - }); - var Qt = function(e) { - function t(t, i, n, r, o, a, s) { - var c = e.call(this, t, i, n, r, o, s) || this; - return c.interaxialDistance = a, - c.setCameraRigMode(ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { - interaxialDistance: a - }), - c - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "AnaglyphArcRotateCamera" - } - , - t - }(xt); - N.a.AddNodeConstructor("AnaglyphFreeCamera", function(e, t, i) { - return function() { - return new qt(e,a.x.Zero(),i.interaxial_distance,t) - } - }); - var qt = function(e) { - function t(t, i, n, r) { - var o = e.call(this, t, i, r) || this; - return o.interaxialDistance = n, - o.setCameraRigMode(ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { - interaxialDistance: n - }), - o - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "AnaglyphFreeCamera" - } - , - t - }(Tt); - N.a.AddNodeConstructor("AnaglyphGamepadCamera", function(e, t, i) { - return function() { - return new Zt(e,a.x.Zero(),i.interaxial_distance,t) - } - }); - var Zt = function(e) { - function t(t, i, n, r) { - var o = e.call(this, t, i, r) || this; - return o.interaxialDistance = n, - o.setCameraRigMode(ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { - interaxialDistance: n - }), - o - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "AnaglyphGamepadCamera" - } - , - t - }(zt); - N.a.AddNodeConstructor("AnaglyphUniversalCamera", function(e, t, i) { - return function() { - return new Jt(e,a.x.Zero(),i.interaxial_distance,t) - } - }); - var Jt = function(e) { - function t(t, i, n, r) { - var o = e.call(this, t, i, r) || this; - return o.interaxialDistance = n, - o.setCameraRigMode(ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { - interaxialDistance: n - }), - o - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "AnaglyphUniversalCamera" - } - , - t - }(Gt); - Ht.a.ShadersStore.stereoscopicInterlacePixelShader = "const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\nvoid main(void)\n{\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else{\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}"; - var $t = function(e) { - function t(t, i, n, r, o, s) { - var c = e.call(this, t, "stereoscopicInterlace", ["stepSize"], ["camASampler"], 1, i[1], r, o, s, n ? "#define IS_STEREOSCOPIC_HORIZ 1" : void 0) || this; - return c._passedProcess = i[0]._rigPostProcess, - c._stepSize = new a.w(1 / c.width,1 / c.height), - c.onSizeChangedObservable.add(function() { - c._stepSize = new a.w(1 / c.width,1 / c.height) - }), - c.onApplyObservable.add(function(e) { - e.setTextureFromPostProcess("camASampler", c._passedProcess), - e.setFloat2("stepSize", c._stepSize.x, c._stepSize.y) - }), - c - } - return h.d(t, e), - t - }(Wt); - ke.a._setStereoscopicRigMode = function(e) { - var t = e.cameraRigMode === ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL || e.cameraRigMode === ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED; - e._rigCameras[0]._rigPostProcess = new Xt(e.name + "_passthru",1,e._rigCameras[0]), - e._rigCameras[1]._rigPostProcess = new $t(e.name + "_stereoInterlace",e._rigCameras,t) + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "AnaglyphArcRotateCamera"; + }), + t + ); + })(xt); + N.a.AddNodeConstructor("AnaglyphFreeCamera", function (e, t, i) { + return function () { + return new qt(e, a.x.Zero(), i.interaxial_distance, t); + }; + }); + var qt = (function (e) { + function t(t, i, n, r) { + var o = e.call(this, t, i, r) || this; + return ( + (o.interaxialDistance = n), + o.setCameraRigMode(ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { + interaxialDistance: n, + }), + o + ); } - , - N.a.AddNodeConstructor("StereoscopicArcRotateCamera", function(e, t, i) { - return function() { - return new ei(e,0,0,1,a.x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t) - } - }); - var ei = function(e) { - function t(t, i, n, r, o, a, s, c) { - var u = e.call(this, t, i, n, r, o, c) || this; - return u.interaxialDistance = a, - u.isStereoscopicSideBySide = s, - u.setCameraRigMode(s ? ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { - interaxialDistance: a - }), - u - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "StereoscopicArcRotateCamera" - } - , + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "AnaglyphFreeCamera"; + }), + t + ); + })(Tt); + N.a.AddNodeConstructor( + "AnaglyphGamepadCamera", + function (e, t, i) { + return function () { + return new Zt(e, a.x.Zero(), i.interaxial_distance, t); + }; + } + ); + var Zt = (function (e) { + function t(t, i, n, r) { + var o = e.call(this, t, i, r) || this; + return ( + (o.interaxialDistance = n), + o.setCameraRigMode(ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { + interaxialDistance: n, + }), + o + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "AnaglyphGamepadCamera"; + }), + t + ); + })(zt); + N.a.AddNodeConstructor( + "AnaglyphUniversalCamera", + function (e, t, i) { + return function () { + return new Jt(e, a.x.Zero(), i.interaxial_distance, t); + }; + } + ); + var Jt = (function (e) { + function t(t, i, n, r) { + var o = e.call(this, t, i, r) || this; + return ( + (o.interaxialDistance = n), + o.setCameraRigMode(ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { + interaxialDistance: n, + }), + o + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "AnaglyphUniversalCamera"; + }), + t + ); + })(Gt); + Ht.a.ShadersStore.stereoscopicInterlacePixelShader = + "const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\nvoid main(void)\n{\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else{\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}"; + var $t = (function (e) { + function t(t, i, n, r, o, s) { + var c = + e.call( + this, + t, + "stereoscopicInterlace", + ["stepSize"], + ["camASampler"], + 1, + i[1], + r, + o, + s, + n ? "#define IS_STEREOSCOPIC_HORIZ 1" : void 0 + ) || this; + return ( + (c._passedProcess = i[0]._rigPostProcess), + (c._stepSize = new a.w(1 / c.width, 1 / c.height)), + c.onSizeChangedObservable.add(function () { + c._stepSize = new a.w(1 / c.width, 1 / c.height); + }), + c.onApplyObservable.add(function (e) { + e.setTextureFromPostProcess( + "camASampler", + c._passedProcess + ), + e.setFloat2("stepSize", c._stepSize.x, c._stepSize.y); + }), + c + ); + } + return h.d(t, e), t; + })(Wt); + (ke.a._setStereoscopicRigMode = function (e) { + var t = + e.cameraRigMode === + ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL || + e.cameraRigMode === + ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED; + (e._rigCameras[0]._rigPostProcess = new Xt( + e.name + "_passthru", + 1, + e._rigCameras[0] + )), + (e._rigCameras[1]._rigPostProcess = new $t( + e.name + "_stereoInterlace", + e._rigCameras, t - }(xt); - N.a.AddNodeConstructor("StereoscopicFreeCamera", function(e, t, i) { - return function() { - return new ti(e,a.x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t) - } - }); - var ti = function(e) { - function t(t, i, n, r, o) { - var a = e.call(this, t, i, o) || this; - return a.interaxialDistance = n, - a.isStereoscopicSideBySide = r, - a.setCameraRigMode(r ? ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { - interaxialDistance: n - }), - a - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "StereoscopicFreeCamera" - } - , + )); + }), + N.a.AddNodeConstructor( + "StereoscopicArcRotateCamera", + function (e, t, i) { + return function () { + return new ei( + e, + 0, + 0, + 1, + a.x.Zero(), + i.interaxial_distance, + i.isStereoscopicSideBySide, + t + ); + }; + } + ); + var ei = (function (e) { + function t(t, i, n, r, o, a, s, c) { + var u = e.call(this, t, i, n, r, o, c) || this; + return ( + (u.interaxialDistance = a), + (u.isStereoscopicSideBySide = s), + u.setCameraRigMode( + s + ? ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL + : ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, + { + interaxialDistance: a, + } + ), + u + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "StereoscopicArcRotateCamera"; + }), + t + ); + })(xt); + N.a.AddNodeConstructor( + "StereoscopicFreeCamera", + function (e, t, i) { + return function () { + return new ti( + e, + a.x.Zero(), + i.interaxial_distance, + i.isStereoscopicSideBySide, + t + ); + }; + } + ); + var ti = (function (e) { + function t(t, i, n, r, o) { + var a = e.call(this, t, i, o) || this; + return ( + (a.interaxialDistance = n), + (a.isStereoscopicSideBySide = r), + a.setCameraRigMode( + r + ? ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL + : ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, + { + interaxialDistance: n, + } + ), + a + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "StereoscopicFreeCamera"; + }), + t + ); + })(Tt); + N.a.AddNodeConstructor( + "StereoscopicGamepadCamera", + function (e, t, i) { + return function () { + return new ii( + e, + a.x.Zero(), + i.interaxial_distance, + i.isStereoscopicSideBySide, + t + ); + }; + } + ); + var ii = (function (e) { + function t(t, i, n, r, o) { + var a = e.call(this, t, i, o) || this; + return ( + (a.interaxialDistance = n), + (a.isStereoscopicSideBySide = r), + a.setCameraRigMode( + r + ? ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL + : ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, + { + interaxialDistance: n, + } + ), + a + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "StereoscopicGamepadCamera"; + }), + t + ); + })(zt); + N.a.AddNodeConstructor( + "StereoscopicFreeCamera", + function (e, t, i) { + return function () { + return new ni( + e, + a.x.Zero(), + i.interaxial_distance, + i.isStereoscopicSideBySide, + t + ); + }; + } + ); + var ni = (function (e) { + function t(t, i, n, r, o) { + var a = e.call(this, t, i, o) || this; + return ( + (a.interaxialDistance = n), + (a.isStereoscopicSideBySide = r), + a.setCameraRigMode( + r + ? ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL + : ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, + { + interaxialDistance: n, + } + ), + a + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "StereoscopicUniversalCamera"; + }), + t + ); + })(Gt); + N.a.AddNodeConstructor("VirtualJoysticksCamera", function (e, t) { + return function () { + return new ri(e, a.x.Zero(), t); + }; + }); + var ri = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, i, n) || this; + return r.inputs.addVirtualJoystick(), r; + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "VirtualJoysticksCamera"; + }), t - }(Tt); - N.a.AddNodeConstructor("StereoscopicGamepadCamera", function(e, t, i) { - return function() { - return new ii(e,a.x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t) - } - }); - var ii = function(e) { - function t(t, i, n, r, o) { - var a = e.call(this, t, i, o) || this; - return a.interaxialDistance = n, - a.isStereoscopicSideBySide = r, - a.setCameraRigMode(r ? ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { - interaxialDistance: n - }), - a - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "StereoscopicGamepadCamera" - } - , - t - }(zt); - N.a.AddNodeConstructor("StereoscopicFreeCamera", function(e, t, i) { - return function() { - return new ni(e,a.x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t) - } - }); - var ni = function(e) { - function t(t, i, n, r, o) { - var a = e.call(this, t, i, o) || this; - return a.interaxialDistance = n, - a.isStereoscopicSideBySide = r, - a.setCameraRigMode(r ? ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { - interaxialDistance: n - }), - a - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "StereoscopicUniversalCamera" - } - , - t - }(Gt); - N.a.AddNodeConstructor("VirtualJoysticksCamera", function(e, t) { - return function() { - return new ri(e,a.x.Zero(),t) - } - }); - var ri = function(e) { - function t(t, i, n) { - var r = e.call(this, t, i, n) || this; - return r.inputs.addVirtualJoystick(), - r - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "VirtualJoysticksCamera" - } - , - t - }(Tt) - , oi = function() { - function e() { - this.compensateDistortion = true, - this.multiviewEnabled = false - } - return Object.defineProperty(e.prototype, "aspectRatio", { - get: function() { - return this.hResolution / (2 * this.vResolution) - }, - enumerable: true, - configurable: true + ); + })(Tt), + oi = (function () { + function e() { + (this.compensateDistortion = true), + (this.multiviewEnabled = false); + } + return ( + Object.defineProperty(e.prototype, "aspectRatio", { + get: function () { + return this.hResolution / (2 * this.vResolution); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "aspectRatioFov", { - get: function() { - return 2 * Math.atan(this.postProcessScaleFactor * this.vScreenSize / (2 * this.eyeToScreenDistance)) - }, - enumerable: true, - configurable: true + get: function () { + return ( + 2 * + Math.atan( + (this.postProcessScaleFactor * this.vScreenSize) / + (2 * this.eyeToScreenDistance) + ) + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "leftHMatrix", { - get: function() { - var e = 4 * (this.hScreenSize / 4 - this.lensSeparationDistance / 2) / this.hScreenSize; - return a.j.Translation(e, 0, 0) - }, - enumerable: true, - configurable: true + get: function () { + var e = + (4 * + (this.hScreenSize / 4 - + this.lensSeparationDistance / 2)) / + this.hScreenSize; + return a.j.Translation(e, 0, 0); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "rightHMatrix", { - get: function() { - var e = 4 * (this.hScreenSize / 4 - this.lensSeparationDistance / 2) / this.hScreenSize; - return a.j.Translation(-e, 0, 0) - }, - enumerable: true, - configurable: true + get: function () { + var e = + (4 * + (this.hScreenSize / 4 - + this.lensSeparationDistance / 2)) / + this.hScreenSize; + return a.j.Translation(-e, 0, 0); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "leftPreViewMatrix", { - get: function() { - return a.j.Translation(.5 * this.interpupillaryDistance, 0, 0) - }, - enumerable: true, - configurable: true + get: function () { + return a.j.Translation( + 0.5 * this.interpupillaryDistance, + 0, + 0 + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "rightPreViewMatrix", { - get: function() { - return a.j.Translation(-.5 * this.interpupillaryDistance, 0, 0) - }, - enumerable: true, - configurable: true + get: function () { + return a.j.Translation( + -0.5 * this.interpupillaryDistance, + 0, + 0 + ); + }, + enumerable: true, + configurable: true, }), - e.GetDefault = function() { - var t = new e; - return t.hResolution = 1280, - t.vResolution = 800, - t.hScreenSize = .149759993, - t.vScreenSize = .0935999975, - t.vScreenCenter = .0467999987, - t.eyeToScreenDistance = .0410000011, - t.lensSeparationDistance = .063500002, - t.interpupillaryDistance = .064000003, - t.distortionK = [1, .219999999, .239999995, 0], - t.chromaAbCorrection = [.995999992, -.00400000019, 1.01400006, 0], - t.postProcessScaleFactor = 1.714605507808412, - t.lensCenterOffset = .151976421, + (e.GetDefault = function () { + var t = new e(); + return ( + (t.hResolution = 1280), + (t.vResolution = 800), + (t.hScreenSize = 0.149759993), + (t.vScreenSize = 0.0935999975), + (t.vScreenCenter = 0.0467999987), + (t.eyeToScreenDistance = 0.0410000011), + (t.lensSeparationDistance = 0.063500002), + (t.interpupillaryDistance = 0.064000003), + (t.distortionK = [1, 0.219999999, 0.239999995, 0]), + (t.chromaAbCorrection = [ + 0.995999992, -0.00400000019, 1.01400006, 0, + ]), + (t.postProcessScaleFactor = 1.714605507808412), + (t.lensCenterOffset = 0.151976421), t - } - , + ); + }), e - }(); - Ht.a.ShadersStore.vrDistortionCorrectionPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn;\nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\nelse{\ngl_FragColor=texture2D(textureSampler,tc);\n}\n}"; - var ai = function(e) { - function t(t, i, n, r) { - var o = e.call(this, t, "vrDistortionCorrection", ["LensCenter", "Scale", "ScaleIn", "HmdWarpParam"], null, r.postProcessScaleFactor, i, je.a.BILINEAR_SAMPLINGMODE) || this; - return o._isRightEye = n, - o._distortionFactors = r.distortionK, - o._postProcessScaleFactor = r.postProcessScaleFactor, - o._lensCenterOffset = r.lensCenterOffset, - o.adaptScaleToCurrentViewport = true, - o.onSizeChangedObservable.add(function() { - o._scaleIn = new a.w(2,2 / o.aspectRatio), - o._scaleFactor = new a.w(1 / o._postProcessScaleFactor * .5,1 / o._postProcessScaleFactor * .5 * o.aspectRatio), - o._lensCenter = new a.w(o._isRightEye ? .5 - .5 * o._lensCenterOffset : .5 + .5 * o._lensCenterOffset,.5) - }), - o.onApplyObservable.add(function(e) { - e.setFloat2("LensCenter", o._lensCenter.x, o._lensCenter.y), - e.setFloat2("Scale", o._scaleFactor.x, o._scaleFactor.y), - e.setFloat2("ScaleIn", o._scaleIn.x, o._scaleIn.y), - e.setFloat4("HmdWarpParam", o._distortionFactors[0], o._distortionFactors[1], o._distortionFactors[2], o._distortionFactors[3]) - }), - o - } - return h.d(t, e), - t - }(Wt); - Ht.a.ShadersStore.vrMultiviewToSingleviewPixelShader = "#ifdef GL_ES\nprecision mediump sampler2DArray;\n#endif\nvarying vec2 vUV;\nuniform sampler2DArray multiviewSampler;\nuniform int imageIndex;\nvoid main(void)\n{\ngl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));\n}"; - var si = n(63) - , ci = n(83) - , ui = n(91); - ve.b.prototype.createRenderTargetCubeTexture = function(e, t) { - var i = h.a({ - generateMipMaps: true, - generateDepthBuffer: true, - generateStencilBuffer: false, - type: ve.b.TEXTURETYPE_UNSIGNED_INT, - samplingMode: ve.b.TEXTURE_TRILINEAR_SAMPLINGMODE, - format: ve.b.TEXTUREFORMAT_RGBA - }, t); - i.generateStencilBuffer = i.generateDepthBuffer && i.generateStencilBuffer, - (i.type !== ve.b.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (i.type !== ve.b.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (i.samplingMode = ve.b.TEXTURE_NEAREST_SAMPLINGMODE); - var n = this._gl - , r = new He.a(this,He.a.DATASOURCE_RENDERTARGET); - this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, r, true); - var o = this._getSamplingParameters(i.samplingMode, i.generateMipMaps); - i.type !== ve.b.TEXTURETYPE_FLOAT || this._caps.textureFloat || (i.type = ve.b.TEXTURETYPE_UNSIGNED_INT, - g.a.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")), - n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_MAG_FILTER, o.mag), - n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_MIN_FILTER, o.min), - n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), - n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE); - for (var a = 0; a < 6; a++) - n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, 0, this._getRGBABufferInternalSizedFormat(i.type, i.format), e, e, 0, this._getInternalFormat(i.format), this._getWebGLTextureType(i.type), null); - var s = n.createFramebuffer(); - return this._bindUnboundFramebuffer(s), - r._depthStencilBuffer = this._setupFramebufferDepthAttachments(i.generateStencilBuffer, i.generateDepthBuffer, e, e), - i.generateMipMaps && n.generateMipmap(n.TEXTURE_CUBE_MAP), - this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, null), - n.bindRenderbuffer(n.RENDERBUFFER, null), - this._bindUnboundFramebuffer(null), - r._framebuffer = s, - r.width = e, - r.height = e, - r.isReady = true, - r.isCube = true, - r.samples = 1, - r.generateMipMaps = i.generateMipMaps, - r.samplingMode = i.samplingMode, - r.type = i.type, - r.format = i.format, - r._generateDepthBuffer = i.generateDepthBuffer, - r._generateStencilBuffer = i.generateStencilBuffer, - this._internalTexturesCache.push(r), - r + ); + })(); + Ht.a.ShadersStore.vrDistortionCorrectionPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn;\nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\nelse{\ngl_FragColor=texture2D(textureSampler,tc);\n}\n}"; + var ai = (function (e) { + function t(t, i, n, r) { + var o = + e.call( + this, + t, + "vrDistortionCorrection", + ["LensCenter", "Scale", "ScaleIn", "HmdWarpParam"], + null, + r.postProcessScaleFactor, + i, + je.a.BILINEAR_SAMPLINGMODE + ) || this; + return ( + (o._isRightEye = n), + (o._distortionFactors = r.distortionK), + (o._postProcessScaleFactor = r.postProcessScaleFactor), + (o._lensCenterOffset = r.lensCenterOffset), + (o.adaptScaleToCurrentViewport = true), + o.onSizeChangedObservable.add(function () { + (o._scaleIn = new a.w(2, 2 / o.aspectRatio)), + (o._scaleFactor = new a.w( + (1 / o._postProcessScaleFactor) * 0.5, + (1 / o._postProcessScaleFactor) * 0.5 * o.aspectRatio + )), + (o._lensCenter = new a.w( + o._isRightEye + ? 0.5 - 0.5 * o._lensCenterOffset + : 0.5 + 0.5 * o._lensCenterOffset, + 0.5 + )); + }), + o.onApplyObservable.add(function (e) { + e.setFloat2( + "LensCenter", + o._lensCenter.x, + o._lensCenter.y + ), + e.setFloat2( + "Scale", + o._scaleFactor.x, + o._scaleFactor.y + ), + e.setFloat2("ScaleIn", o._scaleIn.x, o._scaleIn.y), + e.setFloat4( + "HmdWarpParam", + o._distortionFactors[0], + o._distortionFactors[1], + o._distortionFactors[2], + o._distortionFactors[3] + ); + }), + o + ); } - ; - var li = function(e) { - function t(t, i, n, r, s, c, u, l, h, f, d, p, m) { - void 0 === s && (s = true), - void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === u && (u = false), - void 0 === l && (l = je.a.TRILINEAR_SAMPLINGMODE), - void 0 === h && (h = true), - void 0 === f && (f = false), - void 0 === d && (d = false), - void 0 === p && (p = _.a.TEXTUREFORMAT_RGBA), - void 0 === m && (m = false); - var g = e.call(this, null, n, !r) || this; - return g.isCube = u, - g.renderParticles = true, - g.renderSprites = false, - g.coordinatesMode = je.a.PROJECTION_MODE, - g.ignoreCameraViewport = false, - g.onBeforeBindObservable = new o.c, - g.onAfterUnbindObservable = new o.c, - g.onBeforeRenderObservable = new o.c, - g.onAfterRenderObservable = new o.c, - g.onClearObservable = new o.c, - g._currentRefreshId = -1, - g._refreshRate = 1, - g._samples = 1, - g.boundingBoxPosition = a.x.Zero(), - (n = g.getScene()) ? (g.renderList = new Array, - g._engine = n.getEngine(), - g.name = t, - g.isRenderTarget = true, - g._initialSizeParameter = i, + return h.d(t, e), t; + })(Wt); + Ht.a.ShadersStore.vrMultiviewToSingleviewPixelShader = + "#ifdef GL_ES\nprecision mediump sampler2DArray;\n#endif\nvarying vec2 vUV;\nuniform sampler2DArray multiviewSampler;\nuniform int imageIndex;\nvoid main(void)\n{\ngl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));\n}"; + var si = n(63), + ci = n(83), + ui = n(91); + ve.b.prototype.createRenderTargetCubeTexture = function (e, t) { + var i = h.a( + { + generateMipMaps: true, + generateDepthBuffer: true, + generateStencilBuffer: false, + type: ve.b.TEXTURETYPE_UNSIGNED_INT, + samplingMode: ve.b.TEXTURE_TRILINEAR_SAMPLINGMODE, + format: ve.b.TEXTUREFORMAT_RGBA, + }, + t + ); + (i.generateStencilBuffer = + i.generateDepthBuffer && i.generateStencilBuffer), + ((i.type !== ve.b.TEXTURETYPE_FLOAT || + this._caps.textureFloatLinearFiltering) && + (i.type !== ve.b.TEXTURETYPE_HALF_FLOAT || + this._caps.textureHalfFloatLinearFiltering)) || + (i.samplingMode = ve.b.TEXTURE_NEAREST_SAMPLINGMODE); + var n = this._gl, + r = new He.a(this, He.a.DATASOURCE_RENDERTARGET); + this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, r, true); + var o = this._getSamplingParameters( + i.samplingMode, + i.generateMipMaps + ); + i.type !== ve.b.TEXTURETYPE_FLOAT || + this._caps.textureFloat || + ((i.type = ve.b.TEXTURETYPE_UNSIGNED_INT), + g.a.Warn( + "Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type" + )), + n.texParameteri( + n.TEXTURE_CUBE_MAP, + n.TEXTURE_MAG_FILTER, + o.mag + ), + n.texParameteri( + n.TEXTURE_CUBE_MAP, + n.TEXTURE_MIN_FILTER, + o.min + ), + n.texParameteri( + n.TEXTURE_CUBE_MAP, + n.TEXTURE_WRAP_S, + n.CLAMP_TO_EDGE + ), + n.texParameteri( + n.TEXTURE_CUBE_MAP, + n.TEXTURE_WRAP_T, + n.CLAMP_TO_EDGE + ); + for (var a = 0; a < 6; a++) + n.texImage2D( + n.TEXTURE_CUBE_MAP_POSITIVE_X + a, + 0, + this._getRGBABufferInternalSizedFormat(i.type, i.format), + e, + e, + 0, + this._getInternalFormat(i.format), + this._getWebGLTextureType(i.type), + null + ); + var s = n.createFramebuffer(); + return ( + this._bindUnboundFramebuffer(s), + (r._depthStencilBuffer = + this._setupFramebufferDepthAttachments( + i.generateStencilBuffer, + i.generateDepthBuffer, + e, + e + )), + i.generateMipMaps && n.generateMipmap(n.TEXTURE_CUBE_MAP), + this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, null), + n.bindRenderbuffer(n.RENDERBUFFER, null), + this._bindUnboundFramebuffer(null), + (r._framebuffer = s), + (r.width = e), + (r.height = e), + (r.isReady = true), + (r.isCube = true), + (r.samples = 1), + (r.generateMipMaps = i.generateMipMaps), + (r.samplingMode = i.samplingMode), + (r.type = i.type), + (r.format = i.format), + (r._generateDepthBuffer = i.generateDepthBuffer), + (r._generateStencilBuffer = i.generateStencilBuffer), + this._internalTexturesCache.push(r), + r + ); + }; + var li = (function (e) { + function t(t, i, n, r, s, c, u, l, h, f, d, p, m) { + void 0 === s && (s = true), + void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === u && (u = false), + void 0 === l && (l = je.a.TRILINEAR_SAMPLINGMODE), + void 0 === h && (h = true), + void 0 === f && (f = false), + void 0 === d && (d = false), + void 0 === p && (p = _.a.TEXTUREFORMAT_RGBA), + void 0 === m && (m = false); + var g = e.call(this, null, n, !r) || this; + return ( + (g.isCube = u), + (g.renderParticles = true), + (g.renderSprites = false), + (g.coordinatesMode = je.a.PROJECTION_MODE), + (g.ignoreCameraViewport = false), + (g.onBeforeBindObservable = new o.c()), + (g.onAfterUnbindObservable = new o.c()), + (g.onBeforeRenderObservable = new o.c()), + (g.onAfterRenderObservable = new o.c()), + (g.onClearObservable = new o.c()), + (g._currentRefreshId = -1), + (g._refreshRate = 1), + (g._samples = 1), + (g.boundingBoxPosition = a.x.Zero()), + (n = g.getScene()) + ? ((g.renderList = new Array()), + (g._engine = n.getEngine()), + (g.name = t), + (g.isRenderTarget = true), + (g._initialSizeParameter = i), g._processSizeParameter(i), - g._resizeObserver = g.getScene().getEngine().onResizeObservable.add(function() {}), - g._generateMipMaps = !!r, - g._doNotChangeAspectRatio = s, - g._renderingManager = new ui.b(n), - g._renderingManager._useSceneAutoClearSetup = true, - d ? g : (g._renderTargetOptions = { - generateMipMaps: r, - type: c, - format: p, - samplingMode: l, - generateDepthBuffer: h, - generateStencilBuffer: f - }, - l === je.a.NEAREST_SAMPLINGMODE && (g.wrapU = je.a.CLAMP_ADDRESSMODE, - g.wrapV = je.a.CLAMP_ADDRESSMODE), - m || (u ? (g._texture = n.getEngine().createRenderTargetCubeTexture(g.getRenderSize(), g._renderTargetOptions), - g.coordinatesMode = je.a.INVCUBIC_MODE, - g._textureMatrix = a.j.Identity()) : g._texture = n.getEngine().createRenderTargetTexture(g._size, g._renderTargetOptions)), - g)) : g - } - return h.d(t, e), - Object.defineProperty(t.prototype, "renderList", { - get: function() { - return this._renderList - }, - set: function(e) { - this._renderList = e, - this._renderList && this._hookArray(this._renderList) - }, - enumerable: true, - configurable: true - }), - t.prototype._hookArray = function(e) { - var t = this - , i = e.push; - e.push = function() { - for (var n = [], r = 0; r < arguments.length; r++) - n[r] = arguments[r]; - var o = 0 === e.length - , a = i.apply(e, n); - return o && t.getScene().meshes.forEach(function(e) { - e._markSubMeshesAsLightDirty() + (g._resizeObserver = g + .getScene() + .getEngine() + .onResizeObservable.add(function () {})), + (g._generateMipMaps = !!r), + (g._doNotChangeAspectRatio = s), + (g._renderingManager = new ui.b(n)), + (g._renderingManager._useSceneAutoClearSetup = true), + d + ? g + : ((g._renderTargetOptions = { + generateMipMaps: r, + type: c, + format: p, + samplingMode: l, + generateDepthBuffer: h, + generateStencilBuffer: f, }), - a - } - ; - var n = e.splice; - e.splice = function(i, r) { - var o = n.apply(e, [i, r]); - return 0 === e.length && t.getScene().meshes.forEach(function(e) { - e._markSubMeshesAsLightDirty() - }), - o - } - } - , - Object.defineProperty(t.prototype, "onAfterUnbind", { - set: function(e) { - this._onAfterUnbindObserver && this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver), - this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onBeforeRender", { - set: function(e) { - this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), - this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onAfterRender", { - set: function(e) { - this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), - this._onAfterRenderObserver = this.onAfterRenderObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onClear", { - set: function(e) { - this._onClearObserver && this.onClearObservable.remove(this._onClearObserver), - this._onClearObserver = this.onClearObservable.add(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "renderTargetOptions", { - get: function() { - return this._renderTargetOptions - }, - enumerable: true, - configurable: true - }), - t.prototype._onRatioRescale = function() { - this._sizeRatio && this.resize(this._initialSizeParameter) - } - , - Object.defineProperty(t.prototype, "boundingBoxSize", { - get: function() { - return this._boundingBoxSize - }, - set: function(e) { - if (!this._boundingBoxSize || !this._boundingBoxSize.equals(e)) { - this._boundingBoxSize = e; - var t = this.getScene(); - t && t.markAllMaterialsAsDirty(_.a.MATERIAL_TextureDirtyFlag) - } - }, - enumerable: true, - configurable: true - }), - t.prototype.createDepthStencilTexture = function(e, t, i) { - if (void 0 === e && (e = 0), - void 0 === t && (t = true), - void 0 === i && (i = false), - this.getScene()) { - var n = this.getScene().getEngine(); - this.depthStencilTexture = n.createDepthStencilTexture(this._size, { - bilinearFiltering: t, - comparisonFunction: e, - generateStencil: i, - isCube: this.isCube - }), - n.setFrameBufferDepthStencilTexture(this) - } - } - , - t.prototype._processSizeParameter = function(e) { - e.ratio ? (this._sizeRatio = e.ratio, - this._size = { - width: this._bestReflectionRenderTargetDimension(this._engine.getRenderWidth(), this._sizeRatio), - height: this._bestReflectionRenderTargetDimension(this._engine.getRenderHeight(), this._sizeRatio) - }) : this._size = e - } - , - Object.defineProperty(t.prototype, "samples", { - get: function() { - return this._samples - }, - set: function(e) { - if (this._samples !== e) { - var t = this.getScene(); - t && (this._samples = t.getEngine().updateRenderTargetTextureSampleCount(this._texture, e)) - } - }, - enumerable: true, - configurable: true - }), - t.prototype.resetRefreshCounter = function() { - this._currentRefreshId = -1 - } - , - Object.defineProperty(t.prototype, "refreshRate", { - get: function() { - return this._refreshRate - }, - set: function(e) { - this._refreshRate = e, - this.resetRefreshCounter() - }, - enumerable: true, - configurable: true - }), - t.prototype.addPostProcess = function(e) { - if (!this._postProcessManager) { - var t = this.getScene(); - if (!t) - return; - this._postProcessManager = new ci.a(t), - this._postProcesses = new Array - } - this._postProcesses.push(e), - this._postProcesses[0].autoClear = false - } - , - t.prototype.clearPostProcesses = function(e) { - if (void 0 === e && (e = false), - this._postProcesses) { - if (e) - for (var t = 0, i = this._postProcesses; t < i.length; t++) - i[t].dispose(); - this._postProcesses = [] - } - } - , - t.prototype.removePostProcess = function(e) { - if (this._postProcesses) { - var t = this._postProcesses.indexOf(e); - -1 !== t && (this._postProcesses.splice(t, 1), - this._postProcesses.length > 0 && (this._postProcesses[0].autoClear = false)) - } - } - , - t.prototype._shouldRender = function() { - return -1 === this._currentRefreshId ? (this._currentRefreshId = 1, - true) : this.refreshRate === this._currentRefreshId ? (this._currentRefreshId = 1, - true) : (this._currentRefreshId++, - false) - } - , - t.prototype.getRenderSize = function() { - return this.getRenderWidth() - } - , - t.prototype.getRenderWidth = function() { - return this._size.width ? this._size.width : this._size - } - , - t.prototype.getRenderHeight = function() { - return this._size.width ? this._size.height : this._size - } - , - Object.defineProperty(t.prototype, "canRescale", { - get: function() { - return true - }, - enumerable: true, - configurable: true - }), - t.prototype.scale = function(e) { - var t = this.getRenderSize() * e; - this.resize(t) - } - , - t.prototype.getReflectionTextureMatrix = function() { - return this.isCube ? this._textureMatrix : e.prototype.getReflectionTextureMatrix.call(this) - } - , - t.prototype.resize = function(e) { - var t = this.isCube; - this.releaseInternalTexture(); - var i = this.getScene(); - i && (this._processSizeParameter(e), - this._texture = t ? i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions) : i.getEngine().createRenderTargetTexture(this._size, this._renderTargetOptions)) - } - , - t.prototype.render = function(e, t) { - if (void 0 === e && (e = false), - void 0 === t && (t = false), - s = this.getScene()) { - var i, n = s.getEngine(); - if (void 0 !== this.useCameraPostProcesses && (e = this.useCameraPostProcesses), - this._waitingRenderList) { - this.renderList = []; - for (var r = 0; r < this._waitingRenderList.length; r++) { - var o = this._waitingRenderList[r] - , a = s.getMeshByID(o); - a && this.renderList.push(a) - } - delete this._waitingRenderList - } - if (this.renderListPredicate) { - var s; - if (this.renderList ? this.renderList.length = 0 : this.renderList = [], - !(s = this.getScene())) - return; - var c = s.meshes; - for (r = 0; r < c.length; r++) { - var u = c[r]; - this.renderListPredicate(u) && this.renderList.push(u) - } - } - this.onBeforeBindObservable.notifyObservers(this), - this.activeCamera ? (i = this.activeCamera, - n.setViewport(this.activeCamera.viewport, this.getRenderWidth(), this.getRenderHeight()), - this.activeCamera !== s.activeCamera && s.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true))) : (i = s.activeCamera) && n.setViewport(i.viewport, this.getRenderWidth(), this.getRenderHeight()), - this._renderingManager.reset(); - for (var l = this.renderList ? this.renderList : s.getActiveMeshes().data, h = this.renderList ? this.renderList.length : s.getActiveMeshes().length, f = s.getRenderId(), d = 0; d < h; d++) - if (u = l[d]) { - if (!u.isReady(0 === this.refreshRate)) { - this.resetRefreshCounter(); - continue - } - u._preActivateForIntermediateRendering(f); - var p; - if (p = !(this.renderList || !i) && 0 == (u.layerMask & i.layerMask), - u.isEnabled() && u.isVisible && u.subMeshes && !p && u._activate(f, true)) { - u.isAnInstance ? u = u.sourceMesh : u._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false, - u._internalAbstractMeshDataInfo._isActiveIntermediate = true; - for (var m = 0; m < u.subMeshes.length; m++) { - var g = u.subMeshes[m]; - s._activeIndices.addCount(g.indexCount, false), - this._renderingManager.dispatch(g, u) - } - } - } - for (var _ = 0; _ < s.particleSystems.length; _++) { - var v = s.particleSystems[_] - , y = v.emitter; - v.isStarted() && y && y.position && y.isEnabled() && l.indexOf(y) >= 0 && this._renderingManager.dispatchParticles(v) - } - if (this.isCube) - for (var b = 0; b < 6; b++) - this.renderToTarget(b, l, e, t), - s.incrementRenderId(), - s.resetCachedMaterial(); - else - this.renderToTarget(0, l, e, t); - this.onAfterUnbindObservable.notifyObservers(this), - s.activeCamera && (this.activeCamera && this.activeCamera !== s.activeCamera && s.setTransformMatrix(s.activeCamera.getViewMatrix(), s.activeCamera.getProjectionMatrix(true)), - n.setViewport(s.activeCamera.viewport)), - s.resetCachedMaterial() - } - } - , - t.prototype._bestReflectionRenderTargetDimension = function(e, t) { - var i = e * t - , n = Ee.h.NearestPOT(i + 16384 / (128 + i)); - return Math.min(Ee.h.FloorPOT(e), n) - } - , - t.prototype._bindFrameBuffer = function(e) { - void 0 === e && (e = 0); - var t = this.getScene(); - if (t) { - var i = t.getEngine(); - this._texture && i.bindFramebuffer(this._texture, this.isCube ? e : void 0, void 0, void 0, this.ignoreCameraViewport, this.depthStencilTexture ? this.depthStencilTexture : void 0) - } - } - , - t.prototype.unbindFrameBuffer = function(e, t) { - var i = this; - this._texture && e.unBindFramebuffer(this._texture, this.isCube, function() { - i.onAfterRenderObservable.notifyObservers(t) - }) - } - , - t.prototype.renderToTarget = function(e, t, i, n) { - var r = this.getScene(); - if (r) { - var o = r.getEngine(); - if (this._texture) { - this._postProcessManager ? this._postProcessManager._prepareFrame(this._texture, this._postProcesses) : i && r.postProcessManager._prepareFrame(this._texture) || this._bindFrameBuffer(e), - this.onBeforeRenderObservable.notifyObservers(e), - this.onClearObservable.hasObservers() ? this.onClearObservable.notifyObservers(o) : o.clear(this.clearColor || r.clearColor, true, true, true), - this._doNotChangeAspectRatio || r.updateTransformMatrix(true); - for (var a = 0, s = r._beforeRenderTargetDrawStage; a < s.length; a++) - s[a].action(this); - this._renderingManager.render(this.customRenderFunction, t, this.renderParticles, this.renderSprites); - for (var c = 0, u = r._afterRenderTargetDrawStage; c < u.length; c++) - u[c].action(this); - this._postProcessManager ? this._postProcessManager._finalizeFrame(false, this._texture, e, this._postProcesses, this.ignoreCameraViewport) : i && r.postProcessManager._finalizeFrame(false, this._texture, e), - this._doNotChangeAspectRatio || r.updateTransformMatrix(true), - n && Ee.h.DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), o), - this.isCube && 5 !== e ? this.onAfterRenderObservable.notifyObservers(e) : (this.isCube && 5 === e && o.generateMipMapsForCubemap(this._texture), - this.unbindFrameBuffer(o, e)) - } - } - } - , - t.prototype.setRenderingOrder = function(e, t, i, n) { - void 0 === t && (t = null), - void 0 === i && (i = null), - void 0 === n && (n = null), - this._renderingManager.setRenderingOrder(e, t, i, n) - } - , - t.prototype.setRenderingAutoClearDepthStencil = function(e, t) { - this._renderingManager.setRenderingAutoClearDepthStencil(e, t), - this._renderingManager._useSceneAutoClearSetup = false - } - , - t.prototype.clone = function() { - var e = this.getSize() - , i = new t(this.name,e,this.getScene(),this._renderTargetOptions.generateMipMaps,this._doNotChangeAspectRatio,this._renderTargetOptions.type,this.isCube,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer,this._renderTargetOptions.generateStencilBuffer); - return i.hasAlpha = this.hasAlpha, - i.level = this.level, - i.coordinatesMode = this.coordinatesMode, - this.renderList && (i.renderList = this.renderList.slice(0)), - i - } - , - t.prototype.serialize = function() { - if (!this.name) - return null; - var t = e.prototype.serialize.call(this); - if (t.renderTargetSize = this.getRenderSize(), - t.renderList = [], - this.renderList) - for (var i = 0; i < this.renderList.length; i++) - t.renderList.push(this.renderList[i].id); - return t - } - , - t.prototype.disposeFramebufferObjects = function() { - var e = this.getInternalTexture() - , t = this.getScene(); - e && t && t.getEngine()._releaseFramebufferObjects(e) - } - , - t.prototype.dispose = function() { - this._postProcessManager && (this._postProcessManager.dispose(), - this._postProcessManager = null), - this.clearPostProcesses(true), - this._resizeObserver && (this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver), - this._resizeObserver = null), - this.renderList = null; - var t = this.getScene(); - if (t) { - var i = t.customRenderTargets.indexOf(this); - i >= 0 && t.customRenderTargets.splice(i, 1); - for (var n = 0, r = t.cameras; n < r.length; n++) { - var o = r[n]; - (i = o.customRenderTargets.indexOf(this)) >= 0 && o.customRenderTargets.splice(i, 1) - } - e.prototype.dispose.call(this) - } - } - , - t.prototype._rebuild = function() { - this.refreshRate === t.REFRESHRATE_RENDER_ONCE && (this.refreshRate = t.REFRESHRATE_RENDER_ONCE), - this._postProcessManager && this._postProcessManager._rebuild() - } - , - t.prototype.freeRenderingGroups = function() { - this._renderingManager && this._renderingManager.freeRenderingGroups() - } - , - t.prototype.getViewCount = function() { - return 1 - } - , - t.REFRESHRATE_RENDER_ONCE = 0, - t.REFRESHRATE_RENDER_ONEVERYFRAME = 1, - t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2, - t - }(je.a); - je.a._CreateRenderTargetTexture = function(e, t, i, n) { - return new li(e,t,i,n) + l === je.a.NEAREST_SAMPLINGMODE && + ((g.wrapU = je.a.CLAMP_ADDRESSMODE), + (g.wrapV = je.a.CLAMP_ADDRESSMODE)), + m || + (u + ? ((g._texture = n + .getEngine() + .createRenderTargetCubeTexture( + g.getRenderSize(), + g._renderTargetOptions + )), + (g.coordinatesMode = je.a.INVCUBIC_MODE), + (g._textureMatrix = a.j.Identity())) + : (g._texture = n + .getEngine() + .createRenderTargetTexture( + g._size, + g._renderTargetOptions + ))), + g)) + : g + ); } - ; - var hi = function(e) { - function t(t, i) { - void 0 === i && (i = 512); - var n = e.call(this, "multiview rtt", i, t, false, true, He.a.DATASOURCE_UNKNOWN, false, void 0, false, false, true, void 0, true) || this - , r = t.getEngine().createMultiviewRenderTargetTexture(n.getRenderWidth(), n.getRenderHeight()); - return r.isMultiview = true, - n._texture = r, - n - } - return h.d(t, e), - t.prototype._bindFrameBuffer = function(e) { - void 0 === e && (e = 0), - this._texture && this.getScene().getEngine().bindMultiviewFramebuffer(this._texture) - } - , - t.prototype.getViewCount = function() { - return 2 - } - , - t - }(li); - ve.b.prototype.createMultiviewRenderTargetTexture = function(e, t) { - var i = this._gl; - if (!this.getCaps().multiview) - throw "Multiview is not supported"; - var n = new He.a(this,He.a.DATASOURCE_UNKNOWN,true); - return n.width = e, - n.height = t, - n._framebuffer = i.createFramebuffer(), - n._colorTextureArray = i.createTexture(), - i.bindTexture(i.TEXTURE_2D_ARRAY, n._colorTextureArray), - i.texStorage3D(i.TEXTURE_2D_ARRAY, 1, i.RGBA8, e, t, 2), - n._depthStencilTextureArray = i.createTexture(), - i.bindTexture(i.TEXTURE_2D_ARRAY, n._depthStencilTextureArray), - i.texStorage3D(i.TEXTURE_2D_ARRAY, 1, i.DEPTH32F_STENCIL8, e, t, 2), - n.isReady = true, - n - } - , - ve.b.prototype.bindMultiviewFramebuffer = function(e) { - var t = this._gl - , i = this.getCaps().multiview; - if (this.bindFramebuffer(e, void 0, void 0, void 0, true), - t.bindFramebuffer(t.DRAW_FRAMEBUFFER, e._framebuffer), - !e._colorTextureArray || !e._depthStencilTextureArray) - throw "Invalid multiview frame buffer"; - i.framebufferTextureMultiviewOVR(t.DRAW_FRAMEBUFFER, t.COLOR_ATTACHMENT0, e._colorTextureArray, 0, 0, 2), - i.framebufferTextureMultiviewOVR(t.DRAW_FRAMEBUFFER, t.DEPTH_STENCIL_ATTACHMENT, e._depthStencilTextureArray, 0, 0, 2) - } - , - ke.a.prototype._useMultiviewToSingleView = false, - ke.a.prototype._multiviewTexture = null, - ke.a.prototype._resizeOrCreateMultiviewTexture = function(e, t) { - this._multiviewTexture ? this._multiviewTexture.getRenderWidth() == e && this._multiviewTexture.getRenderHeight() == t || (this._multiviewTexture.dispose(), - this._multiviewTexture = new hi(this.getScene(),{ - width: e, - height: t - })) : this._multiviewTexture = new hi(this.getScene(),{ - width: e, - height: t - }) - } - , - Y.a.prototype._transformMatrixR = a.j.Zero(), - Y.a.prototype._multiviewSceneUbo = null, - Y.a.prototype._createMultiviewUbo = function() { - this._multiviewSceneUbo = new si.a(this.getEngine(),void 0,true), - this._multiviewSceneUbo.addUniform("viewProjection", 16), - this._multiviewSceneUbo.addUniform("viewProjectionR", 16), - this._multiviewSceneUbo.addUniform("view", 16) - } - , - Y.a.prototype._updateMultiviewUbo = function(e, t) { - e && t && e.multiplyToRef(t, this._transformMatrixR), - e && t && (e.multiplyToRef(t, a.t.Matrix[0]), - a.i.GetRightPlaneToRef(a.t.Matrix[0], this._frustumPlanes[3])), - this._multiviewSceneUbo && (this._multiviewSceneUbo.updateMatrix("viewProjection", this.getTransformMatrix()), - this._multiviewSceneUbo.updateMatrix("viewProjectionR", this._transformMatrixR), - this._multiviewSceneUbo.updateMatrix("view", this._viewMatrix), - this._multiviewSceneUbo.update()) - } - , - Y.a.prototype._renderMultiviewToSingleView = function(e) { - e._resizeOrCreateMultiviewTexture(e._rigPostProcess && e._rigPostProcess && e._rigPostProcess.width > 0 ? e._rigPostProcess.width / 2 : this.getEngine().getRenderWidth(true) / 2, e._rigPostProcess && e._rigPostProcess && e._rigPostProcess.height > 0 ? e._rigPostProcess.height : this.getEngine().getRenderHeight(true)), - this._multiviewSceneUbo || this._createMultiviewUbo(), - e.outputRenderTarget = e._multiviewTexture, - this._renderForCamera(e), - e.outputRenderTarget = null; - for (var t = 0; t < e._rigCameras.length; t++) { - var i = this.getEngine(); - this._activeCamera = e._rigCameras[t], - i.setViewport(this._activeCamera.viewport), - this.postProcessManager && (this.postProcessManager._prepareFrame(), - this.postProcessManager._finalizeFrame(this._activeCamera.isIntermediate)) - } - } - ; - var fi = function(e) { - function t(t, i, n) { - var r = e.call(this, t, "vrMultiviewToSingleview", ["imageIndex"], ["multiviewSampler"], n, i, je.a.BILINEAR_SAMPLINGMODE) || this; - return r.onSizeChangedObservable.add(function() {}), - r.onApplyObservable.add(function(e) { - i._scene.activeCamera && i._scene.activeCamera.isLeftCamera ? e.setInt("imageIndex", 0) : e.setInt("imageIndex", 1), - e.setTexture("multiviewSampler", i._multiviewTexture) - }), - r - } - return h.d(t, e), - t - }(Wt); - ke.a._setVRRigMode = function(e, t) { - var i = t.vrCameraMetrics || oi.GetDefault(); - e._rigCameras[0]._cameraRigParams.vrMetrics = i, - e._rigCameras[0].viewport = new a.z(0,0,.5,1), - e._rigCameras[0]._cameraRigParams.vrWorkMatrix = new a.j, - e._rigCameras[0]._cameraRigParams.vrHMatrix = i.leftHMatrix, - e._rigCameras[0]._cameraRigParams.vrPreViewMatrix = i.leftPreViewMatrix, - e._rigCameras[0].getProjectionMatrix = e._rigCameras[0]._getVRProjectionMatrix, - e._rigCameras[1]._cameraRigParams.vrMetrics = i, - e._rigCameras[1].viewport = new a.z(.5,0,.5,1), - e._rigCameras[1]._cameraRigParams.vrWorkMatrix = new a.j, - e._rigCameras[1]._cameraRigParams.vrHMatrix = i.rightHMatrix, - e._rigCameras[1]._cameraRigParams.vrPreViewMatrix = i.rightPreViewMatrix, - e._rigCameras[1].getProjectionMatrix = e._rigCameras[1]._getVRProjectionMatrix, - i.multiviewEnabled && (e.getScene().getEngine().getCaps().multiview ? (e._useMultiviewToSingleView = true, - e._rigPostProcess = new fi("VRMultiviewToSingleview",e,i.postProcessScaleFactor)) : (g.a.Warn("Multiview is not supported, falling back to standard rendering"), - i.multiviewEnabled = false)), - i.compensateDistortion && (e._rigCameras[0]._rigPostProcess = new ai("VR_Distort_Compensation_Left",e._rigCameras[0],false,i), - e._rigCameras[1]._rigPostProcess = new ai("VR_Distort_Compensation_Right",e._rigCameras[1],true,i)) - } - , - N.a.AddNodeConstructor("VRDeviceOrientationFreeCamera", function(e, t) { - return function() { - return new di(e,0,0,1,a.x.Zero(),t) - } - }); - var di = function(e) { - function t(t, i, n, r, o, a, s, c) { - void 0 === s && (s = true), - void 0 === c && (c = oi.GetDefault()); - var u = e.call(this, t, i, n, r, o, a) || this; - return c.compensateDistortion = s, - u.setCameraRigMode(ke.a.RIG_MODE_VR, { - vrCameraMetrics: c - }), - u.inputs.addVRDeviceOrientation(), - u - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "VRDeviceOrientationArcRotateCamera" - } - , - t - }(xt); - N.a.AddNodeConstructor("VRDeviceOrientationFreeCamera", function(e, t) { - return function() { - return new pi(e,a.x.Zero(),t) - } - }); - var pi = function(e) { - function t(t, i, n, r, o) { - void 0 === r && (r = true), - void 0 === o && (o = oi.GetDefault()); - var a = e.call(this, t, i, n) || this; - return o.compensateDistortion = r, - a.setCameraRigMode(ke.a.RIG_MODE_VR, { - vrCameraMetrics: o - }), - a - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "VRDeviceOrientationFreeCamera" - } - , - t - }(St); - N.a.AddNodeConstructor("VRDeviceOrientationGamepadCamera", function(e, t) { - return function() { - return new mi(e,a.x.Zero(),t) - } - }); - var mi = function(e) { - function t(t, i, n, r, o) { - void 0 === r && (r = true), - void 0 === o && (o = oi.GetDefault()); - var a = e.call(this, t, i, n, r, o) || this; - return a.inputs.addGamepad(), - a - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "VRDeviceOrientationGamepadCamera" - } - , - t - }(pi) - , gi = n(65); - ke.a._setWebVRRigMode = function(e, t) { - if (t.vrDisplay) { - var i = t.vrDisplay.getEyeParameters("left") - , n = t.vrDisplay.getEyeParameters("right"); - e._rigCameras[0].viewport = new a.z(0,0,.5,1), - e._rigCameras[0].setCameraRigParameter("left", true), - e._rigCameras[0].setCameraRigParameter("specs", t.specs), - e._rigCameras[0].setCameraRigParameter("eyeParameters", i), - e._rigCameras[0].setCameraRigParameter("frameData", t.frameData), - e._rigCameras[0].setCameraRigParameter("parentCamera", t.parentCamera), - e._rigCameras[0]._cameraRigParams.vrWorkMatrix = new a.j, - e._rigCameras[0].getProjectionMatrix = e._getWebVRProjectionMatrix, - e._rigCameras[0].parent = e, - e._rigCameras[0]._getViewMatrix = e._getWebVRViewMatrix, - e._rigCameras[1].viewport = new a.z(.5,0,.5,1), - e._rigCameras[1].setCameraRigParameter("eyeParameters", n), - e._rigCameras[1].setCameraRigParameter("specs", t.specs), - e._rigCameras[1].setCameraRigParameter("frameData", t.frameData), - e._rigCameras[1].setCameraRigParameter("parentCamera", t.parentCamera), - e._rigCameras[1]._cameraRigParams.vrWorkMatrix = new a.j, - e._rigCameras[1].getProjectionMatrix = e._getWebVRProjectionMatrix, - e._rigCameras[1].parent = e, - e._rigCameras[1]._getViewMatrix = e._getWebVRViewMatrix - } - } - , - Object.defineProperty(ve.b.prototype, "isInVRExclusivePointerMode", { - get: function() { - return this._vrExclusivePointerMode + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "renderList", { + get: function () { + return this._renderList; + }, + set: function (e) { + (this._renderList = e), + this._renderList && this._hookArray(this._renderList); }, enumerable: true, - configurable: true - }), - ve.b.prototype._prepareVRComponent = function() { - this._vrSupported = false, - this._vrExclusivePointerMode = false, - this.onVRDisplayChangedObservable = new o.c, - this.onVRRequestPresentComplete = new o.c, - this.onVRRequestPresentStart = new o.c - } - , - ve.b.prototype.isVRDevicePresent = function() { - return !!this._vrDisplay - } - , - ve.b.prototype.getVRDevice = function() { - return this._vrDisplay - } - , - ve.b.prototype.initWebVR = function() { - return this.initWebVRAsync(), - this.onVRDisplayChangedObservable - } - , - ve.b.prototype.initWebVRAsync = function() { - var e = this - , t = function() { - var t = { - vrDisplay: e._vrDisplay, - vrSupported: e._vrSupported - }; - e.onVRDisplayChangedObservable.notifyObservers(t), - e._webVRInitPromise = new i(function(e) { - e(t) - } - ) + configurable: true, + }), + (t.prototype._hookArray = function (e) { + var t = this, + i = e.push; + e.push = function () { + for (var n = [], r = 0; r < arguments.length; r++) + n[r] = arguments[r]; + var o = 0 === e.length, + a = i.apply(e, n); + return ( + o && + t.getScene().meshes.forEach(function (e) { + e._markSubMeshesAsLightDirty(); + }), + a + ); }; - return this._onVrDisplayConnect || (this._onVrDisplayConnect = function(i) { - e._vrDisplay = i.display, - t() + var n = e.splice; + e.splice = function (i, r) { + var o = n.apply(e, [i, r]); + return ( + 0 === e.length && + t.getScene().meshes.forEach(function (e) { + e._markSubMeshesAsLightDirty(); + }), + o + ); + }; + }), + Object.defineProperty(t.prototype, "onAfterUnbind", { + set: function (e) { + this._onAfterUnbindObserver && + this.onAfterUnbindObservable.remove( + this._onAfterUnbindObserver + ), + (this._onAfterUnbindObserver = + this.onAfterUnbindObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "onBeforeRender", { + set: function (e) { + this._onBeforeRenderObserver && + this.onBeforeRenderObservable.remove( + this._onBeforeRenderObserver + ), + (this._onBeforeRenderObserver = + this.onBeforeRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "onAfterRender", { + set: function (e) { + this._onAfterRenderObserver && + this.onAfterRenderObservable.remove( + this._onAfterRenderObserver + ), + (this._onAfterRenderObserver = + this.onAfterRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "onClear", { + set: function (e) { + this._onClearObserver && + this.onClearObservable.remove(this._onClearObserver), + (this._onClearObserver = this.onClearObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "renderTargetOptions", { + get: function () { + return this._renderTargetOptions; + }, + enumerable: true, + configurable: true, + }), + (t.prototype._onRatioRescale = function () { + this._sizeRatio && this.resize(this._initialSizeParameter); + }), + Object.defineProperty(t.prototype, "boundingBoxSize", { + get: function () { + return this._boundingBoxSize; + }, + set: function (e) { + if ( + !this._boundingBoxSize || + !this._boundingBoxSize.equals(e) + ) { + this._boundingBoxSize = e; + var t = this.getScene(); + t && + t.markAllMaterialsAsDirty( + _.a.MATERIAL_TextureDirtyFlag + ); + } + }, + enumerable: true, + configurable: true, + }), + (t.prototype.createDepthStencilTexture = function (e, t, i) { + if ( + (void 0 === e && (e = 0), + void 0 === t && (t = true), + void 0 === i && (i = false), + this.getScene()) + ) { + var n = this.getScene().getEngine(); + (this.depthStencilTexture = n.createDepthStencilTexture( + this._size, + { + bilinearFiltering: t, + comparisonFunction: e, + generateStencil: i, + isCube: this.isCube, + } + )), + n.setFrameBufferDepthStencilTexture(this); } - , - this._onVrDisplayDisconnect = function() { + }), + (t.prototype._processSizeParameter = function (e) { + e.ratio + ? ((this._sizeRatio = e.ratio), + (this._size = { + width: this._bestReflectionRenderTargetDimension( + this._engine.getRenderWidth(), + this._sizeRatio + ), + height: this._bestReflectionRenderTargetDimension( + this._engine.getRenderHeight(), + this._sizeRatio + ), + })) + : (this._size = e); + }), + Object.defineProperty(t.prototype, "samples", { + get: function () { + return this._samples; + }, + set: function (e) { + if (this._samples !== e) { + var t = this.getScene(); + t && + (this._samples = t + .getEngine() + .updateRenderTargetTextureSampleCount( + this._texture, + e + )); + } + }, + enumerable: true, + configurable: true, + }), + (t.prototype.resetRefreshCounter = function () { + this._currentRefreshId = -1; + }), + Object.defineProperty(t.prototype, "refreshRate", { + get: function () { + return this._refreshRate; + }, + set: function (e) { + (this._refreshRate = e), this.resetRefreshCounter(); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.addPostProcess = function (e) { + if (!this._postProcessManager) { + var t = this.getScene(); + if (!t) return; + (this._postProcessManager = new ci.a(t)), + (this._postProcesses = new Array()); + } + this._postProcesses.push(e), + (this._postProcesses[0].autoClear = false); + }), + (t.prototype.clearPostProcesses = function (e) { + if ((void 0 === e && (e = false), this._postProcesses)) { + if (e) + for ( + var t = 0, i = this._postProcesses; + t < i.length; + t++ + ) + i[t].dispose(); + this._postProcesses = []; + } + }), + (t.prototype.removePostProcess = function (e) { + if (this._postProcesses) { + var t = this._postProcesses.indexOf(e); + -1 !== t && + (this._postProcesses.splice(t, 1), + this._postProcesses.length > 0 && + (this._postProcesses[0].autoClear = false)); + } + }), + (t.prototype._shouldRender = function () { + return -1 === this._currentRefreshId + ? ((this._currentRefreshId = 1), true) + : this.refreshRate === this._currentRefreshId + ? ((this._currentRefreshId = 1), true) + : (this._currentRefreshId++, false); + }), + (t.prototype.getRenderSize = function () { + return this.getRenderWidth(); + }), + (t.prototype.getRenderWidth = function () { + return this._size.width ? this._size.width : this._size; + }), + (t.prototype.getRenderHeight = function () { + return this._size.width ? this._size.height : this._size; + }), + Object.defineProperty(t.prototype, "canRescale", { + get: function () { + return true; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.scale = function (e) { + var t = this.getRenderSize() * e; + this.resize(t); + }), + (t.prototype.getReflectionTextureMatrix = function () { + return this.isCube + ? this._textureMatrix + : e.prototype.getReflectionTextureMatrix.call(this); + }), + (t.prototype.resize = function (e) { + var t = this.isCube; + this.releaseInternalTexture(); + var i = this.getScene(); + i && + (this._processSizeParameter(e), + (this._texture = t + ? i + .getEngine() + .createRenderTargetCubeTexture( + this.getRenderSize(), + this._renderTargetOptions + ) + : i + .getEngine() + .createRenderTargetTexture( + this._size, + this._renderTargetOptions + ))); + }), + (t.prototype.render = function (e, t) { + if ( + (void 0 === e && (e = false), + void 0 === t && (t = false), + (s = this.getScene())) + ) { + var i, + n = s.getEngine(); + if ( + (void 0 !== this.useCameraPostProcesses && + (e = this.useCameraPostProcesses), + this._waitingRenderList) + ) { + this.renderList = []; + for ( + var r = 0; + r < this._waitingRenderList.length; + r++ + ) { + var o = this._waitingRenderList[r], + a = s.getMeshByID(o); + a && this.renderList.push(a); + } + delete this._waitingRenderList; + } + if (this.renderListPredicate) { + var s; + if ( + (this.renderList + ? (this.renderList.length = 0) + : (this.renderList = []), + !(s = this.getScene())) + ) + return; + var c = s.meshes; + for (r = 0; r < c.length; r++) { + var u = c[r]; + this.renderListPredicate(u) && + this.renderList.push(u); + } + } + this.onBeforeBindObservable.notifyObservers(this), + this.activeCamera + ? ((i = this.activeCamera), + n.setViewport( + this.activeCamera.viewport, + this.getRenderWidth(), + this.getRenderHeight() + ), + this.activeCamera !== s.activeCamera && + s.setTransformMatrix( + this.activeCamera.getViewMatrix(), + this.activeCamera.getProjectionMatrix(true) + )) + : (i = s.activeCamera) && + n.setViewport( + i.viewport, + this.getRenderWidth(), + this.getRenderHeight() + ), + this._renderingManager.reset(); + for ( + var l = this.renderList + ? this.renderList + : s.getActiveMeshes().data, + h = this.renderList + ? this.renderList.length + : s.getActiveMeshes().length, + f = s.getRenderId(), + d = 0; + d < h; + d++ + ) + if ((u = l[d])) { + if (!u.isReady(0 === this.refreshRate)) { + this.resetRefreshCounter(); + continue; + } + u._preActivateForIntermediateRendering(f); + var p; + if ( + ((p = + !(this.renderList || !i) && + 0 == (u.layerMask & i.layerMask)), + u.isEnabled() && + u.isVisible && + u.subMeshes && + !p && + u._activate(f, true)) + ) { + u.isAnInstance + ? (u = u.sourceMesh) + : (u._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false), + (u._internalAbstractMeshDataInfo._isActiveIntermediate = true); + for (var m = 0; m < u.subMeshes.length; m++) { + var g = u.subMeshes[m]; + s._activeIndices.addCount(g.indexCount, false), + this._renderingManager.dispatch(g, u); + } + } + } + for (var _ = 0; _ < s.particleSystems.length; _++) { + var v = s.particleSystems[_], + y = v.emitter; + v.isStarted() && + y && + y.position && + y.isEnabled() && + l.indexOf(y) >= 0 && + this._renderingManager.dispatchParticles(v); + } + if (this.isCube) + for (var b = 0; b < 6; b++) + this.renderToTarget(b, l, e, t), + s.incrementRenderId(), + s.resetCachedMaterial(); + else this.renderToTarget(0, l, e, t); + this.onAfterUnbindObservable.notifyObservers(this), + s.activeCamera && + (this.activeCamera && + this.activeCamera !== s.activeCamera && + s.setTransformMatrix( + s.activeCamera.getViewMatrix(), + s.activeCamera.getProjectionMatrix(true) + ), + n.setViewport(s.activeCamera.viewport)), + s.resetCachedMaterial(); + } + }), + (t.prototype._bestReflectionRenderTargetDimension = function ( + e, + t + ) { + var i = e * t, + n = Ee.h.NearestPOT(i + 16384 / (128 + i)); + return Math.min(Ee.h.FloorPOT(e), n); + }), + (t.prototype._bindFrameBuffer = function (e) { + void 0 === e && (e = 0); + var t = this.getScene(); + if (t) { + var i = t.getEngine(); + this._texture && + i.bindFramebuffer( + this._texture, + this.isCube ? e : void 0, + void 0, + void 0, + this.ignoreCameraViewport, + this.depthStencilTexture + ? this.depthStencilTexture + : void 0 + ); + } + }), + (t.prototype.unbindFrameBuffer = function (e, t) { + var i = this; + this._texture && + e.unBindFramebuffer( + this._texture, + this.isCube, + function () { + i.onAfterRenderObservable.notifyObservers(t); + } + ); + }), + (t.prototype.renderToTarget = function (e, t, i, n) { + var r = this.getScene(); + if (r) { + var o = r.getEngine(); + if (this._texture) { + this._postProcessManager + ? this._postProcessManager._prepareFrame( + this._texture, + this._postProcesses + ) + : (i && + r.postProcessManager._prepareFrame( + this._texture + )) || + this._bindFrameBuffer(e), + this.onBeforeRenderObservable.notifyObservers(e), + this.onClearObservable.hasObservers() + ? this.onClearObservable.notifyObservers(o) + : o.clear( + this.clearColor || r.clearColor, + true, + true, + true + ), + this._doNotChangeAspectRatio || + r.updateTransformMatrix(true); + for ( + var a = 0, s = r._beforeRenderTargetDrawStage; + a < s.length; + a++ + ) + s[a].action(this); + this._renderingManager.render( + this.customRenderFunction, + t, + this.renderParticles, + this.renderSprites + ); + for ( + var c = 0, u = r._afterRenderTargetDrawStage; + c < u.length; + c++ + ) + u[c].action(this); + this._postProcessManager + ? this._postProcessManager._finalizeFrame( + false, + this._texture, + e, + this._postProcesses, + this.ignoreCameraViewport + ) + : i && + r.postProcessManager._finalizeFrame( + false, + this._texture, + e + ), + this._doNotChangeAspectRatio || + r.updateTransformMatrix(true), + n && + Ee.h.DumpFramebuffer( + this.getRenderWidth(), + this.getRenderHeight(), + o + ), + this.isCube && 5 !== e + ? this.onAfterRenderObservable.notifyObservers(e) + : (this.isCube && + 5 === e && + o.generateMipMapsForCubemap(this._texture), + this.unbindFrameBuffer(o, e)); + } + } + }), + (t.prototype.setRenderingOrder = function (e, t, i, n) { + void 0 === t && (t = null), + void 0 === i && (i = null), + void 0 === n && (n = null), + this._renderingManager.setRenderingOrder(e, t, i, n); + }), + (t.prototype.setRenderingAutoClearDepthStencil = function ( + e, + t + ) { + this._renderingManager.setRenderingAutoClearDepthStencil( + e, + t + ), + (this._renderingManager._useSceneAutoClearSetup = false); + }), + (t.prototype.clone = function () { + var e = this.getSize(), + i = new t( + this.name, + e, + this.getScene(), + this._renderTargetOptions.generateMipMaps, + this._doNotChangeAspectRatio, + this._renderTargetOptions.type, + this.isCube, + this._renderTargetOptions.samplingMode, + this._renderTargetOptions.generateDepthBuffer, + this._renderTargetOptions.generateStencilBuffer + ); + return ( + (i.hasAlpha = this.hasAlpha), + (i.level = this.level), + (i.coordinatesMode = this.coordinatesMode), + this.renderList && + (i.renderList = this.renderList.slice(0)), + i + ); + }), + (t.prototype.serialize = function () { + if (!this.name) return null; + var t = e.prototype.serialize.call(this); + if ( + ((t.renderTargetSize = this.getRenderSize()), + (t.renderList = []), + this.renderList) + ) + for (var i = 0; i < this.renderList.length; i++) + t.renderList.push(this.renderList[i].id); + return t; + }), + (t.prototype.disposeFramebufferObjects = function () { + var e = this.getInternalTexture(), + t = this.getScene(); + e && t && t.getEngine()._releaseFramebufferObjects(e); + }), + (t.prototype.dispose = function () { + this._postProcessManager && + (this._postProcessManager.dispose(), + (this._postProcessManager = null)), + this.clearPostProcesses(true), + this._resizeObserver && + (this.getScene() + .getEngine() + .onResizeObservable.remove(this._resizeObserver), + (this._resizeObserver = null)), + (this.renderList = null); + var t = this.getScene(); + if (t) { + var i = t.customRenderTargets.indexOf(this); + i >= 0 && t.customRenderTargets.splice(i, 1); + for (var n = 0, r = t.cameras; n < r.length; n++) { + var o = r[n]; + (i = o.customRenderTargets.indexOf(this)) >= 0 && + o.customRenderTargets.splice(i, 1); + } + e.prototype.dispose.call(this); + } + }), + (t.prototype._rebuild = function () { + this.refreshRate === t.REFRESHRATE_RENDER_ONCE && + (this.refreshRate = t.REFRESHRATE_RENDER_ONCE), + this._postProcessManager && + this._postProcessManager._rebuild(); + }), + (t.prototype.freeRenderingGroups = function () { + this._renderingManager && + this._renderingManager.freeRenderingGroups(); + }), + (t.prototype.getViewCount = function () { + return 1; + }), + (t.REFRESHRATE_RENDER_ONCE = 0), + (t.REFRESHRATE_RENDER_ONEVERYFRAME = 1), + (t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2), + t + ); + })(je.a); + je.a._CreateRenderTargetTexture = function (e, t, i, n) { + return new li(e, t, i, n); + }; + var hi = (function (e) { + function t(t, i) { + void 0 === i && (i = 512); + var n = + e.call( + this, + "multiview rtt", + i, + t, + false, + true, + He.a.DATASOURCE_UNKNOWN, + false, + void 0, + false, + false, + true, + void 0, + true + ) || this, + r = t + .getEngine() + .createMultiviewRenderTargetTexture( + n.getRenderWidth(), + n.getRenderHeight() + ); + return (r.isMultiview = true), (n._texture = r), n; + } + return ( + h.d(t, e), + (t.prototype._bindFrameBuffer = function (e) { + void 0 === e && (e = 0), + this._texture && + this.getScene() + .getEngine() + .bindMultiviewFramebuffer(this._texture); + }), + (t.prototype.getViewCount = function () { + return 2; + }), + t + ); + })(li); + (ve.b.prototype.createMultiviewRenderTargetTexture = function ( + e, + t + ) { + var i = this._gl; + if (!this.getCaps().multiview) + throw "Multiview is not supported"; + var n = new He.a(this, He.a.DATASOURCE_UNKNOWN, true); + return ( + (n.width = e), + (n.height = t), + (n._framebuffer = i.createFramebuffer()), + (n._colorTextureArray = i.createTexture()), + i.bindTexture(i.TEXTURE_2D_ARRAY, n._colorTextureArray), + i.texStorage3D(i.TEXTURE_2D_ARRAY, 1, i.RGBA8, e, t, 2), + (n._depthStencilTextureArray = i.createTexture()), + i.bindTexture( + i.TEXTURE_2D_ARRAY, + n._depthStencilTextureArray + ), + i.texStorage3D( + i.TEXTURE_2D_ARRAY, + 1, + i.DEPTH32F_STENCIL8, + e, + t, + 2 + ), + (n.isReady = true), + n + ); + }), + (ve.b.prototype.bindMultiviewFramebuffer = function (e) { + var t = this._gl, + i = this.getCaps().multiview; + if ( + (this.bindFramebuffer(e, void 0, void 0, void 0, true), + t.bindFramebuffer(t.DRAW_FRAMEBUFFER, e._framebuffer), + !e._colorTextureArray || !e._depthStencilTextureArray) + ) + throw "Invalid multiview frame buffer"; + i.framebufferTextureMultiviewOVR( + t.DRAW_FRAMEBUFFER, + t.COLOR_ATTACHMENT0, + e._colorTextureArray, + 0, + 0, + 2 + ), + i.framebufferTextureMultiviewOVR( + t.DRAW_FRAMEBUFFER, + t.DEPTH_STENCIL_ATTACHMENT, + e._depthStencilTextureArray, + 0, + 0, + 2 + ); + }), + (ke.a.prototype._useMultiviewToSingleView = false), + (ke.a.prototype._multiviewTexture = null), + (ke.a.prototype._resizeOrCreateMultiviewTexture = function ( + e, + t + ) { + this._multiviewTexture + ? (this._multiviewTexture.getRenderWidth() == e && + this._multiviewTexture.getRenderHeight() == t) || + (this._multiviewTexture.dispose(), + (this._multiviewTexture = new hi(this.getScene(), { + width: e, + height: t, + }))) + : (this._multiviewTexture = new hi(this.getScene(), { + width: e, + height: t, + })); + }), + (Y.a.prototype._transformMatrixR = a.j.Zero()), + (Y.a.prototype._multiviewSceneUbo = null), + (Y.a.prototype._createMultiviewUbo = function () { + (this._multiviewSceneUbo = new si.a( + this.getEngine(), + void 0, + true + )), + this._multiviewSceneUbo.addUniform("viewProjection", 16), + this._multiviewSceneUbo.addUniform("viewProjectionR", 16), + this._multiviewSceneUbo.addUniform("view", 16); + }), + (Y.a.prototype._updateMultiviewUbo = function (e, t) { + e && t && e.multiplyToRef(t, this._transformMatrixR), + e && + t && + (e.multiplyToRef(t, a.t.Matrix[0]), + a.i.GetRightPlaneToRef( + a.t.Matrix[0], + this._frustumPlanes[3] + )), + this._multiviewSceneUbo && + (this._multiviewSceneUbo.updateMatrix( + "viewProjection", + this.getTransformMatrix() + ), + this._multiviewSceneUbo.updateMatrix( + "viewProjectionR", + this._transformMatrixR + ), + this._multiviewSceneUbo.updateMatrix( + "view", + this._viewMatrix + ), + this._multiviewSceneUbo.update()); + }), + (Y.a.prototype._renderMultiviewToSingleView = function (e) { + e._resizeOrCreateMultiviewTexture( + e._rigPostProcess && + e._rigPostProcess && + e._rigPostProcess.width > 0 + ? e._rigPostProcess.width / 2 + : this.getEngine().getRenderWidth(true) / 2, + e._rigPostProcess && + e._rigPostProcess && + e._rigPostProcess.height > 0 + ? e._rigPostProcess.height + : this.getEngine().getRenderHeight(true) + ), + this._multiviewSceneUbo || this._createMultiviewUbo(), + (e.outputRenderTarget = e._multiviewTexture), + this._renderForCamera(e), + (e.outputRenderTarget = null); + for (var t = 0; t < e._rigCameras.length; t++) { + var i = this.getEngine(); + (this._activeCamera = e._rigCameras[t]), + i.setViewport(this._activeCamera.viewport), + this.postProcessManager && + (this.postProcessManager._prepareFrame(), + this.postProcessManager._finalizeFrame( + this._activeCamera.isIntermediate + )); + } + }); + var fi = (function (e) { + function t(t, i, n) { + var r = + e.call( + this, + t, + "vrMultiviewToSingleview", + ["imageIndex"], + ["multiviewSampler"], + n, + i, + je.a.BILINEAR_SAMPLINGMODE + ) || this; + return ( + r.onSizeChangedObservable.add(function () {}), + r.onApplyObservable.add(function (e) { + i._scene.activeCamera && + i._scene.activeCamera.isLeftCamera + ? e.setInt("imageIndex", 0) + : e.setInt("imageIndex", 1), + e.setTexture("multiviewSampler", i._multiviewTexture); + }), + r + ); + } + return h.d(t, e), t; + })(Wt); + (ke.a._setVRRigMode = function (e, t) { + var i = t.vrCameraMetrics || oi.GetDefault(); + (e._rigCameras[0]._cameraRigParams.vrMetrics = i), + (e._rigCameras[0].viewport = new a.z(0, 0, 0.5, 1)), + (e._rigCameras[0]._cameraRigParams.vrWorkMatrix = new a.j()), + (e._rigCameras[0]._cameraRigParams.vrHMatrix = i.leftHMatrix), + (e._rigCameras[0]._cameraRigParams.vrPreViewMatrix = + i.leftPreViewMatrix), + (e._rigCameras[0].getProjectionMatrix = + e._rigCameras[0]._getVRProjectionMatrix), + (e._rigCameras[1]._cameraRigParams.vrMetrics = i), + (e._rigCameras[1].viewport = new a.z(0.5, 0, 0.5, 1)), + (e._rigCameras[1]._cameraRigParams.vrWorkMatrix = new a.j()), + (e._rigCameras[1]._cameraRigParams.vrHMatrix = + i.rightHMatrix), + (e._rigCameras[1]._cameraRigParams.vrPreViewMatrix = + i.rightPreViewMatrix), + (e._rigCameras[1].getProjectionMatrix = + e._rigCameras[1]._getVRProjectionMatrix), + i.multiviewEnabled && + (e.getScene().getEngine().getCaps().multiview + ? ((e._useMultiviewToSingleView = true), + (e._rigPostProcess = new fi( + "VRMultiviewToSingleview", + e, + i.postProcessScaleFactor + ))) + : (g.a.Warn( + "Multiview is not supported, falling back to standard rendering" + ), + (i.multiviewEnabled = false))), + i.compensateDistortion && + ((e._rigCameras[0]._rigPostProcess = new ai( + "VR_Distort_Compensation_Left", + e._rigCameras[0], + false, + i + )), + (e._rigCameras[1]._rigPostProcess = new ai( + "VR_Distort_Compensation_Right", + e._rigCameras[1], + true, + i + ))); + }), + N.a.AddNodeConstructor( + "VRDeviceOrientationFreeCamera", + function (e, t) { + return function () { + return new di(e, 0, 0, 1, a.x.Zero(), t); + }; + } + ); + var di = (function (e) { + function t(t, i, n, r, o, a, s, c) { + void 0 === s && (s = true), + void 0 === c && (c = oi.GetDefault()); + var u = e.call(this, t, i, n, r, o, a) || this; + return ( + (c.compensateDistortion = s), + u.setCameraRigMode(ke.a.RIG_MODE_VR, { + vrCameraMetrics: c, + }), + u.inputs.addVRDeviceOrientation(), + u + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "VRDeviceOrientationArcRotateCamera"; + }), + t + ); + })(xt); + N.a.AddNodeConstructor( + "VRDeviceOrientationFreeCamera", + function (e, t) { + return function () { + return new pi(e, a.x.Zero(), t); + }; + } + ); + var pi = (function (e) { + function t(t, i, n, r, o) { + void 0 === r && (r = true), + void 0 === o && (o = oi.GetDefault()); + var a = e.call(this, t, i, n) || this; + return ( + (o.compensateDistortion = r), + a.setCameraRigMode(ke.a.RIG_MODE_VR, { + vrCameraMetrics: o, + }), + a + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "VRDeviceOrientationFreeCamera"; + }), + t + ); + })(St); + N.a.AddNodeConstructor( + "VRDeviceOrientationGamepadCamera", + function (e, t) { + return function () { + return new mi(e, a.x.Zero(), t); + }; + } + ); + var mi = (function (e) { + function t(t, i, n, r, o) { + void 0 === r && (r = true), + void 0 === o && (o = oi.GetDefault()); + var a = e.call(this, t, i, n, r, o) || this; + return a.inputs.addGamepad(), a; + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "VRDeviceOrientationGamepadCamera"; + }), + t + ); + })(pi), + gi = n(65); + (ke.a._setWebVRRigMode = function (e, t) { + if (t.vrDisplay) { + var i = t.vrDisplay.getEyeParameters("left"), + n = t.vrDisplay.getEyeParameters("right"); + (e._rigCameras[0].viewport = new a.z(0, 0, 0.5, 1)), + e._rigCameras[0].setCameraRigParameter("left", true), + e._rigCameras[0].setCameraRigParameter("specs", t.specs), + e._rigCameras[0].setCameraRigParameter("eyeParameters", i), + e._rigCameras[0].setCameraRigParameter( + "frameData", + t.frameData + ), + e._rigCameras[0].setCameraRigParameter( + "parentCamera", + t.parentCamera + ), + (e._rigCameras[0]._cameraRigParams.vrWorkMatrix = + new a.j()), + (e._rigCameras[0].getProjectionMatrix = + e._getWebVRProjectionMatrix), + (e._rigCameras[0].parent = e), + (e._rigCameras[0]._getViewMatrix = e._getWebVRViewMatrix), + (e._rigCameras[1].viewport = new a.z(0.5, 0, 0.5, 1)), + e._rigCameras[1].setCameraRigParameter("eyeParameters", n), + e._rigCameras[1].setCameraRigParameter("specs", t.specs), + e._rigCameras[1].setCameraRigParameter( + "frameData", + t.frameData + ), + e._rigCameras[1].setCameraRigParameter( + "parentCamera", + t.parentCamera + ), + (e._rigCameras[1]._cameraRigParams.vrWorkMatrix = + new a.j()), + (e._rigCameras[1].getProjectionMatrix = + e._getWebVRProjectionMatrix), + (e._rigCameras[1].parent = e), + (e._rigCameras[1]._getViewMatrix = e._getWebVRViewMatrix); + } + }), + Object.defineProperty( + ve.b.prototype, + "isInVRExclusivePointerMode", + { + get: function () { + return this._vrExclusivePointerMode; + }, + enumerable: true, + configurable: true, + } + ), + (ve.b.prototype._prepareVRComponent = function () { + (this._vrSupported = false), + (this._vrExclusivePointerMode = false), + (this.onVRDisplayChangedObservable = new o.c()), + (this.onVRRequestPresentComplete = new o.c()), + (this.onVRRequestPresentStart = new o.c()); + }), + (ve.b.prototype.isVRDevicePresent = function () { + return !!this._vrDisplay; + }), + (ve.b.prototype.getVRDevice = function () { + return this._vrDisplay; + }), + (ve.b.prototype.initWebVR = function () { + return ( + this.initWebVRAsync(), this.onVRDisplayChangedObservable + ); + }), + (ve.b.prototype.initWebVRAsync = function () { + var e = this, + t = function () { + var t = { + vrDisplay: e._vrDisplay, + vrSupported: e._vrSupported, + }; + e.onVRDisplayChangedObservable.notifyObservers(t), + (e._webVRInitPromise = new i(function (e) { + e(t); + })); + }; + return ( + this._onVrDisplayConnect || + ((this._onVrDisplayConnect = function (i) { + (e._vrDisplay = i.display), t(); + }), + (this._onVrDisplayDisconnect = function () { e._vrDisplay.cancelAnimationFrame(e._frameHandler), - e._vrDisplay = void 0, - e._frameHandler = Ee.h.QueueNewFrame(e._bindedRenderFunction), - t() - } - , - this._onVrDisplayPresentChange = function() { - e._vrExclusivePointerMode = e._vrDisplay && e._vrDisplay.isPresenting - } - , - window.addEventListener("vrdisplayconnect", this._onVrDisplayConnect), - window.addEventListener("vrdisplaydisconnect", this._onVrDisplayDisconnect), - window.addEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange)), - this._webVRInitPromise = this._webVRInitPromise || this._getVRDisplaysAsync(), + (e._vrDisplay = void 0), + (e._frameHandler = Ee.h.QueueNewFrame( + e._bindedRenderFunction + )), + t(); + }), + (this._onVrDisplayPresentChange = function () { + e._vrExclusivePointerMode = + e._vrDisplay && e._vrDisplay.isPresenting; + }), + window.addEventListener( + "vrdisplayconnect", + this._onVrDisplayConnect + ), + window.addEventListener( + "vrdisplaydisconnect", + this._onVrDisplayDisconnect + ), + window.addEventListener( + "vrdisplaypresentchange", + this._onVrDisplayPresentChange + )), + (this._webVRInitPromise = + this._webVRInitPromise || this._getVRDisplaysAsync()), this._webVRInitPromise.then(t), this._webVRInitPromise - } - , - ve.b.prototype._getVRDisplaysAsync = function() { - var e = this; - return new i(function(t) { - navigator.getVRDisplays ? navigator.getVRDisplays().then(function(i) { - e._vrSupported = true, - e._vrDisplay = i[0], + ); + }), + (ve.b.prototype._getVRDisplaysAsync = function () { + var e = this; + return new i(function (t) { + navigator.getVRDisplays + ? navigator.getVRDisplays().then(function (i) { + (e._vrSupported = true), + (e._vrDisplay = i[0]), t({ - vrDisplay: e._vrDisplay, - vrSupported: e._vrSupported - }) - }) : (e._vrDisplay = void 0, - e._vrSupported = false, + vrDisplay: e._vrDisplay, + vrSupported: e._vrSupported, + }); + }) + : ((e._vrDisplay = void 0), + (e._vrSupported = false), t({ - vrDisplay: e._vrDisplay, - vrSupported: e._vrSupported - })) - } - ) - } - , - ve.b.prototype.enableVR = function() { - var e = this; - this._vrDisplay && !this._vrDisplay.isPresenting && (this.onVRRequestPresentStart.notifyObservers(this), - this._vrDisplay.requestPresent([{ - source: this.getRenderingCanvas() - }]).then(function() { + vrDisplay: e._vrDisplay, + vrSupported: e._vrSupported, + })); + }); + }), + (ve.b.prototype.enableVR = function () { + var e = this; + this._vrDisplay && + !this._vrDisplay.isPresenting && + (this.onVRRequestPresentStart.notifyObservers(this), + this._vrDisplay + .requestPresent([ + { + source: this.getRenderingCanvas(), + }, + ]) + .then(function () { e.onVRRequestPresentComplete.notifyObservers(true), - e._onVRFullScreenTriggered() - }).catch(function() { - e.onVRRequestPresentComplete.notifyObservers(false) - })) - } - , - ve.b.prototype._onVRFullScreenTriggered = function() { - if (this._vrDisplay && this._vrDisplay.isPresenting) { - this._oldSize = new a.r(this.getRenderWidth(),this.getRenderHeight()), - this._oldHardwareScaleFactor = this.getHardwareScalingLevel(); - var e = this._vrDisplay.getEyeParameters("left"); - this.setHardwareScalingLevel(1), - this.setSize(2 * e.renderWidth, e.renderHeight) - } else - this.setHardwareScalingLevel(this._oldHardwareScaleFactor), - this.setSize(this._oldSize.width, this._oldSize.height) - } - , - ve.b.prototype.disableVR = function() { - var e = this; - this._vrDisplay && this._vrDisplay.isPresenting && this._vrDisplay.exitPresent().then(function() { - return e._onVRFullScreenTriggered() - }).catch(function() { - return e._onVRFullScreenTriggered() + e._onVRFullScreenTriggered(); + }) + .catch(function () { + e.onVRRequestPresentComplete.notifyObservers(false); + })); + }), + (ve.b.prototype._onVRFullScreenTriggered = function () { + if (this._vrDisplay && this._vrDisplay.isPresenting) { + (this._oldSize = new a.r( + this.getRenderWidth(), + this.getRenderHeight() + )), + (this._oldHardwareScaleFactor = + this.getHardwareScalingLevel()); + var e = this._vrDisplay.getEyeParameters("left"); + this.setHardwareScalingLevel(1), + this.setSize(2 * e.renderWidth, e.renderHeight); + } else + this.setHardwareScalingLevel(this._oldHardwareScaleFactor), + this.setSize(this._oldSize.width, this._oldSize.height); + }), + (ve.b.prototype.disableVR = function () { + var e = this; + this._vrDisplay && + this._vrDisplay.isPresenting && + this._vrDisplay + .exitPresent() + .then(function () { + return e._onVRFullScreenTriggered(); + }) + .catch(function () { + return e._onVRFullScreenTriggered(); + }), + It.a.IsWindowObjectExist() && + (window.removeEventListener( + "vrdisplaypointerrestricted", + this._onVRDisplayPointerRestricted + ), + window.removeEventListener( + "vrdisplaypointerunrestricted", + this._onVRDisplayPointerUnrestricted + ), + this._onVrDisplayConnect && + (window.removeEventListener( + "vrdisplayconnect", + this._onVrDisplayConnect + ), + this._onVrDisplayDisconnect && + window.removeEventListener( + "vrdisplaydisconnect", + this._onVrDisplayDisconnect + ), + this._onVrDisplayPresentChange && + window.removeEventListener( + "vrdisplaypresentchange", + this._onVrDisplayPresentChange + ), + (this._onVrDisplayConnect = null), + (this._onVrDisplayDisconnect = null))); + }), + (ve.b.prototype._connectVREvents = function (e, t) { + (this._onVRDisplayPointerRestricted = function () { + e && e.requestPointerLock(); + }), + (this._onVRDisplayPointerUnrestricted = function () { + t.exitPointerLock && t.exitPointerLock(); }), - It.a.IsWindowObjectExist() && (window.removeEventListener("vrdisplaypointerrestricted", this._onVRDisplayPointerRestricted), - window.removeEventListener("vrdisplaypointerunrestricted", this._onVRDisplayPointerUnrestricted), - this._onVrDisplayConnect && (window.removeEventListener("vrdisplayconnect", this._onVrDisplayConnect), - this._onVrDisplayDisconnect && window.removeEventListener("vrdisplaydisconnect", this._onVrDisplayDisconnect), - this._onVrDisplayPresentChange && window.removeEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange), - this._onVrDisplayConnect = null, - this._onVrDisplayDisconnect = null)) - } - , - ve.b.prototype._connectVREvents = function(e, t) { - this._onVRDisplayPointerRestricted = function() { - e && e.requestPointerLock() - } - , - this._onVRDisplayPointerUnrestricted = function() { - t.exitPointerLock && t.exitPointerLock() - } - , - It.a.IsWindowObjectExist() && (window.addEventListener("vrdisplaypointerrestricted", this._onVRDisplayPointerRestricted, false), - window.addEventListener("vrdisplaypointerunrestricted", this._onVRDisplayPointerUnrestricted, false)) - } - , - ve.b.prototype._submitVRFrame = function() { - if (this._vrDisplay && this._vrDisplay.isPresenting) - try { - this._vrDisplay.submitFrame() - } catch (e) { - Ee.h.Warn("webVR submitFrame has had an unexpected failure: " + e) - } - } - , - ve.b.prototype.isVRPresenting = function() { - return this._vrDisplay && this._vrDisplay.isPresenting - } - , - ve.b.prototype._requestVRFrame = function() { - this._frameHandler = Ee.h.QueueNewFrame(this._bindedRenderFunction, this._vrDisplay) - } - , - N.a.AddNodeConstructor("WebVRFreeCamera", function(e, t) { - return function() { - return new _i(e,a.x.Zero(),t) + It.a.IsWindowObjectExist() && + (window.addEventListener( + "vrdisplaypointerrestricted", + this._onVRDisplayPointerRestricted, + false + ), + window.addEventListener( + "vrdisplaypointerunrestricted", + this._onVRDisplayPointerUnrestricted, + false + )); + }), + (ve.b.prototype._submitVRFrame = function () { + if (this._vrDisplay && this._vrDisplay.isPresenting) + try { + this._vrDisplay.submitFrame(); + } catch (e) { + Ee.h.Warn( + "webVR submitFrame has had an unexpected failure: " + e + ); } }), - N.a.AddNodeConstructor("WebVRGamepadCamera", function(e, t) { - return function() { - return new _i(e,a.x.Zero(),t) - } + (ve.b.prototype.isVRPresenting = function () { + return this._vrDisplay && this._vrDisplay.isPresenting; + }), + (ve.b.prototype._requestVRFrame = function () { + this._frameHandler = Ee.h.QueueNewFrame( + this._bindedRenderFunction, + this._vrDisplay + ); + }), + N.a.AddNodeConstructor("WebVRFreeCamera", function (e, t) { + return function () { + return new _i(e, a.x.Zero(), t); + }; + }), + N.a.AddNodeConstructor("WebVRGamepadCamera", function (e, t) { + return function () { + return new _i(e, a.x.Zero(), t); + }; }); - var _i = function(e) { - function t(t, i, n, r) { - void 0 === r && (r = {}); - var s = e.call(this, t, i, n) || this; - s.webVROptions = r, - s._vrDevice = null, - s.rawPose = null, - s._specsVersion = "1.1", - s._attached = false, - s._descendants = [], - s._deviceRoomPosition = a.x.Zero(), - s._deviceRoomRotationQuaternion = a.q.Identity(), - s._standingMatrix = null, - s.devicePosition = a.x.Zero(), - s.deviceRotationQuaternion = a.q.Identity(), - s.deviceScaleFactor = 1, - s._deviceToWorld = a.j.Identity(), - s._worldToDevice = a.j.Identity(), - s.controllers = [], - s.onControllersAttachedObservable = new o.c, - s.onControllerMeshLoadedObservable = new o.c, - s.onPoseUpdatedFromDeviceObservable = new o.c, - s._poseSet = false, - s.rigParenting = true, - s._defaultHeight = void 0, - s._htmlElementAttached = null, - s._detachIfAttached = function() { - var e = s.getEngine().getVRDevice(); - e && !e.isPresenting && s._htmlElementAttached && s.detachControl(s._htmlElementAttached) - } - , - s._workingVector = a.x.Zero(), - s._oneVector = a.x.One(), - s._workingMatrix = a.j.Identity(), - s._tmpMatrix = new a.j, - s._cache.position = a.x.Zero(), - r.defaultHeight && (s._defaultHeight = r.defaultHeight, - s.position.y = s._defaultHeight), - s.minZ = .1, - 5 === arguments.length && (s.webVROptions = arguments[4]), - null == s.webVROptions.trackPosition && (s.webVROptions.trackPosition = true), - null == s.webVROptions.controllerMeshes && (s.webVROptions.controllerMeshes = true), - null == s.webVROptions.defaultLightingOnControllers && (s.webVROptions.defaultLightingOnControllers = true), - s.rotationQuaternion = new a.q, - s.webVROptions && s.webVROptions.positionScale && (s.deviceScaleFactor = s.webVROptions.positionScale); - var c = s.getEngine(); - return s._onVREnabled = function(e) { - e && s.initControllers() - } - , - c.onVRRequestPresentComplete.add(s._onVREnabled), - c.initWebVR().add(function(e) { - e.vrDisplay && s._vrDevice !== e.vrDisplay && (s._vrDevice = e.vrDisplay, - s.setCameraRigMode(ke.a.RIG_MODE_WEBVR, { - parentCamera: s, - vrDisplay: s._vrDevice, - frameData: s._frameData, - specs: s._specsVersion - }), - s._attached && s.getEngine().enableVR()) - }), - "undefined" != typeof VRFrameData && (s._frameData = new VRFrameData), - r.useMultiview && (s.getScene().getEngine().getCaps().multiview ? (s._useMultiviewToSingleView = true, - s._rigPostProcess = new fi("VRMultiviewToSingleview",s,1)) : (g.a.Warn("Multiview is not supported, falling back to standard rendering"), - s._useMultiviewToSingleView = false)), - n.onBeforeCameraRenderObservable.add(function(e) { - e.parent === s && s.rigParenting && (s._descendants = s.getDescendants(true, function(e) { - var t = s.controllers.some(function(t) { - return t._mesh === e - }) - , i = -1 !== s._rigCameras.indexOf(e); - return !t && !i - }), - s._descendants.forEach(function(t) { - t.parent = e - })) - }), - n.onAfterCameraRenderObservable.add(function(e) { - e.parent === s && s.rigParenting && s._descendants.forEach(function(e) { - e.parent = s - }) - }), - s - } - return h.d(t, e), - t.prototype.deviceDistanceToRoomGround = function() { - return this._standingMatrix ? (this._standingMatrix.getTranslationToRef(this._workingVector), - this._deviceRoomPosition.y + this._workingVector.y) : this._defaultHeight || 0 - } - , - t.prototype.useStandingMatrix = function(e) { - var t = this; - void 0 === e && (e = function(e) {} + var _i = (function (e) { + function t(t, i, n, r) { + void 0 === r && (r = {}); + var s = e.call(this, t, i, n) || this; + (s.webVROptions = r), + (s._vrDevice = null), + (s.rawPose = null), + (s._specsVersion = "1.1"), + (s._attached = false), + (s._descendants = []), + (s._deviceRoomPosition = a.x.Zero()), + (s._deviceRoomRotationQuaternion = a.q.Identity()), + (s._standingMatrix = null), + (s.devicePosition = a.x.Zero()), + (s.deviceRotationQuaternion = a.q.Identity()), + (s.deviceScaleFactor = 1), + (s._deviceToWorld = a.j.Identity()), + (s._worldToDevice = a.j.Identity()), + (s.controllers = []), + (s.onControllersAttachedObservable = new o.c()), + (s.onControllerMeshLoadedObservable = new o.c()), + (s.onPoseUpdatedFromDeviceObservable = new o.c()), + (s._poseSet = false), + (s.rigParenting = true), + (s._defaultHeight = void 0), + (s._htmlElementAttached = null), + (s._detachIfAttached = function () { + var e = s.getEngine().getVRDevice(); + e && + !e.isPresenting && + s._htmlElementAttached && + s.detachControl(s._htmlElementAttached); + }), + (s._workingVector = a.x.Zero()), + (s._oneVector = a.x.One()), + (s._workingMatrix = a.j.Identity()), + (s._tmpMatrix = new a.j()), + (s._cache.position = a.x.Zero()), + r.defaultHeight && + ((s._defaultHeight = r.defaultHeight), + (s.position.y = s._defaultHeight)), + (s.minZ = 0.1), + 5 === arguments.length && (s.webVROptions = arguments[4]), + null == s.webVROptions.trackPosition && + (s.webVROptions.trackPosition = true), + null == s.webVROptions.controllerMeshes && + (s.webVROptions.controllerMeshes = true), + null == s.webVROptions.defaultLightingOnControllers && + (s.webVROptions.defaultLightingOnControllers = true), + (s.rotationQuaternion = new a.q()), + s.webVROptions && + s.webVROptions.positionScale && + (s.deviceScaleFactor = s.webVROptions.positionScale); + var c = s.getEngine(); + return ( + (s._onVREnabled = function (e) { + e && s.initControllers(); + }), + c.onVRRequestPresentComplete.add(s._onVREnabled), + c.initWebVR().add(function (e) { + e.vrDisplay && + s._vrDevice !== e.vrDisplay && + ((s._vrDevice = e.vrDisplay), + s.setCameraRigMode(ke.a.RIG_MODE_WEBVR, { + parentCamera: s, + vrDisplay: s._vrDevice, + frameData: s._frameData, + specs: s._specsVersion, + }), + s._attached && s.getEngine().enableVR()); + }), + "undefined" != typeof VRFrameData && + (s._frameData = new VRFrameData()), + r.useMultiview && + (s.getScene().getEngine().getCaps().multiview + ? ((s._useMultiviewToSingleView = true), + (s._rigPostProcess = new fi( + "VRMultiviewToSingleview", + s, + 1 + ))) + : (g.a.Warn( + "Multiview is not supported, falling back to standard rendering" + ), + (s._useMultiviewToSingleView = false))), + n.onBeforeCameraRenderObservable.add(function (e) { + e.parent === s && + s.rigParenting && + ((s._descendants = s.getDescendants( + true, + function (e) { + var t = s.controllers.some(function (t) { + return t._mesh === e; + }), + i = -1 !== s._rigCameras.indexOf(e); + return !t && !i; + } + )), + s._descendants.forEach(function (t) { + t.parent = e; + })); + }), + n.onAfterCameraRenderObservable.add(function (e) { + e.parent === s && + s.rigParenting && + s._descendants.forEach(function (e) { + e.parent = s; + }); + }), + s + ); + } + return ( + h.d(t, e), + (t.prototype.deviceDistanceToRoomGround = function () { + return this._standingMatrix + ? (this._standingMatrix.getTranslationToRef( + this._workingVector + ), + this._deviceRoomPosition.y + this._workingVector.y) + : this._defaultHeight || 0; + }), + (t.prototype.useStandingMatrix = function (e) { + var t = this; + void 0 === e && (e = function (e) {}), + this.getEngine() + .initWebVRAsync() + .then(function (i) { + i.vrDisplay && + i.vrDisplay.stageParameters && + i.vrDisplay.stageParameters + .sittingToStandingTransform && + t.webVROptions.trackPosition + ? ((t._standingMatrix = new a.j()), + a.j.FromFloat32ArrayToRefScaled( + i.vrDisplay.stageParameters + .sittingToStandingTransform, + 0, + 1, + t._standingMatrix + ), + t.getScene().useRightHandedSystem || + (t._standingMatrix && + t._standingMatrix.toggleModelMatrixHandInPlace()), + e(true)) + : e(false); + }); + }), + (t.prototype.useStandingMatrixAsync = function () { + var e = this; + return new i(function (t) { + e.useStandingMatrix(function (e) { + t(e); + }); + }); + }), + (t.prototype.dispose = function () { + this._detachIfAttached(), + this.getEngine().onVRRequestPresentComplete.removeCallback( + this._onVREnabled ), - this.getEngine().initWebVRAsync().then(function(i) { - i.vrDisplay && i.vrDisplay.stageParameters && i.vrDisplay.stageParameters.sittingToStandingTransform && t.webVROptions.trackPosition ? (t._standingMatrix = new a.j, - a.j.FromFloat32ArrayToRefScaled(i.vrDisplay.stageParameters.sittingToStandingTransform, 0, 1, t._standingMatrix), - t.getScene().useRightHandedSystem || t._standingMatrix && t._standingMatrix.toggleModelMatrixHandInPlace(), - e(true)) : e(false) - }) - } - , - t.prototype.useStandingMatrixAsync = function() { - var e = this; - return new i(function(t) { - e.useStandingMatrix(function(e) { - t(e) - }) - } - ) - } - , - t.prototype.dispose = function() { - this._detachIfAttached(), - this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled), - this._updateCacheWhenTrackingDisabledObserver && this._scene.onBeforeRenderObservable.remove(this._updateCacheWhenTrackingDisabledObserver), - e.prototype.dispose.call(this) - } - , - t.prototype.getControllerByName = function(e) { - for (var t = 0, i = this.controllers; t < i.length; t++) { - var n = i[t]; - if (n.hand === e) - return n - } - return null - } - , + this._updateCacheWhenTrackingDisabledObserver && + this._scene.onBeforeRenderObservable.remove( + this._updateCacheWhenTrackingDisabledObserver + ), + e.prototype.dispose.call(this); + }), + (t.prototype.getControllerByName = function (e) { + for (var t = 0, i = this.controllers; t < i.length; t++) { + var n = i[t]; + if (n.hand === e) return n; + } + return null; + }), Object.defineProperty(t.prototype, "leftController", { - get: function() { - return this._leftController || (this._leftController = this.getControllerByName("left")), - this._leftController - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._leftController || + (this._leftController = + this.getControllerByName("left")), + this._leftController + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rightController", { - get: function() { - return this._rightController || (this._rightController = this.getControllerByName("right")), - this._rightController - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._rightController || + (this._rightController = + this.getControllerByName("right")), + this._rightController + ); + }, + enumerable: true, + configurable: true, }), - t.prototype.getForwardRay = function(t) { - return void 0 === t && (t = 100), - this.leftCamera ? e.prototype.getForwardRay.call(this, t, this.leftCamera.getWorldMatrix(), this.leftCamera.globalPosition) : e.prototype.getForwardRay.call(this, t) - } - , - t.prototype._checkInputs = function() { - this._vrDevice && this._vrDevice.isPresenting && (this._vrDevice.getFrameData(this._frameData), + (t.prototype.getForwardRay = function (t) { + return ( + void 0 === t && (t = 100), + this.leftCamera + ? e.prototype.getForwardRay.call( + this, + t, + this.leftCamera.getWorldMatrix(), + this.leftCamera.globalPosition + ) + : e.prototype.getForwardRay.call(this, t) + ); + }), + (t.prototype._checkInputs = function () { + this._vrDevice && + this._vrDevice.isPresenting && + (this._vrDevice.getFrameData(this._frameData), this.updateFromDevice(this._frameData.pose)), - e.prototype._checkInputs.call(this) - } - , - t.prototype.updateFromDevice = function(e) { - e && e.orientation && (this.rawPose = e, - this._deviceRoomRotationQuaternion.copyFromFloats(e.orientation[0], e.orientation[1], -e.orientation[2], -e.orientation[3]), - this.getScene().useRightHandedSystem && (this._deviceRoomRotationQuaternion.z *= -1, - this._deviceRoomRotationQuaternion.w *= -1), - this.webVROptions.trackPosition && this.rawPose.position && (this._deviceRoomPosition.copyFromFloats(this.rawPose.position[0], this.rawPose.position[1], -this.rawPose.position[2]), - this.getScene().useRightHandedSystem && (this._deviceRoomPosition.z *= -1)), - this._poseSet = true) - } - , - t.prototype.attachControl = function(t, i) { - e.prototype.attachControl.call(this, t, i), - this._attached = true, - this._htmlElementAttached = t, - i = !ke.a.ForceAttachControlToAlwaysPreventDefault && i, + e.prototype._checkInputs.call(this); + }), + (t.prototype.updateFromDevice = function (e) { + e && + e.orientation && + ((this.rawPose = e), + this._deviceRoomRotationQuaternion.copyFromFloats( + e.orientation[0], + e.orientation[1], + -e.orientation[2], + -e.orientation[3] + ), + this.getScene().useRightHandedSystem && + ((this._deviceRoomRotationQuaternion.z *= -1), + (this._deviceRoomRotationQuaternion.w *= -1)), + this.webVROptions.trackPosition && + this.rawPose.position && + (this._deviceRoomPosition.copyFromFloats( + this.rawPose.position[0], + this.rawPose.position[1], + -this.rawPose.position[2] + ), + this.getScene().useRightHandedSystem && + (this._deviceRoomPosition.z *= -1)), + (this._poseSet = true)); + }), + (t.prototype.attachControl = function (t, i) { + e.prototype.attachControl.call(this, t, i), + (this._attached = true), + (this._htmlElementAttached = t), + (i = + !ke.a.ForceAttachControlToAlwaysPreventDefault && i), this._vrDevice && this.getEngine().enableVR(), - window.addEventListener("vrdisplaypresentchange", this._detachIfAttached) - } - , - t.prototype.detachControl = function(t) { - this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver), - this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver), + window.addEventListener( + "vrdisplaypresentchange", + this._detachIfAttached + ); + }), + (t.prototype.detachControl = function (t) { + this.getScene().gamepadManager.onGamepadConnectedObservable.remove( + this._onGamepadConnectedObserver + ), + this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove( + this._onGamepadDisconnectedObserver + ), e.prototype.detachControl.call(this, t), - this._attached = false, + (this._attached = false), this.getEngine().disableVR(), - window.removeEventListener("vrdisplaypresentchange", this._detachIfAttached) - } - , - t.prototype.getClassName = function() { - return "WebVRFreeCamera" - } - , - t.prototype.resetToCurrentRotation = function() { - this._vrDevice.resetPose() - } - , - t.prototype._updateRigCameras = function() { - var e = this._rigCameras[0] - , t = this._rigCameras[1]; - e.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion), - t.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion), + window.removeEventListener( + "vrdisplaypresentchange", + this._detachIfAttached + ); + }), + (t.prototype.getClassName = function () { + return "WebVRFreeCamera"; + }), + (t.prototype.resetToCurrentRotation = function () { + this._vrDevice.resetPose(); + }), + (t.prototype._updateRigCameras = function () { + var e = this._rigCameras[0], + t = this._rigCameras[1]; + e.rotationQuaternion.copyFrom( + this._deviceRoomRotationQuaternion + ), + t.rotationQuaternion.copyFrom( + this._deviceRoomRotationQuaternion + ), e.position.copyFrom(this._deviceRoomPosition), - t.position.copyFrom(this._deviceRoomPosition) - } - , - t.prototype._correctPositionIfNotTrackPosition = function(e, t) { - void 0 === t && (t = false), - this.rawPose && this.rawPose.position && !this.webVROptions.trackPosition && (a.j.TranslationToRef(this.rawPose.position[0], this.rawPose.position[1], -this.rawPose.position[2], this._tmpMatrix), - t || this._tmpMatrix.invert(), - this._tmpMatrix.multiplyToRef(e, e)) - } - , - t.prototype._updateCache = function(t) { - var i = this; - this.rotationQuaternion.equals(this._cache.rotationQuaternion) && this.position.equals(this._cache.position) || (this.updateCacheCalled || (this.updateCacheCalled = true, - this.update()), - this.rotationQuaternion.toRotationMatrix(this._workingMatrix), - a.x.TransformCoordinatesToRef(this._deviceRoomPosition, this._workingMatrix, this._workingVector), - this.devicePosition.subtractToRef(this._workingVector, this._workingVector), - a.j.ComposeToRef(this._oneVector, this.rotationQuaternion, this._workingVector, this._deviceToWorld), - this._deviceToWorld.getTranslationToRef(this._workingVector), + t.position.copyFrom(this._deviceRoomPosition); + }), + (t.prototype._correctPositionIfNotTrackPosition = function ( + e, + t + ) { + void 0 === t && (t = false), + this.rawPose && + this.rawPose.position && + !this.webVROptions.trackPosition && + (a.j.TranslationToRef( + this.rawPose.position[0], + this.rawPose.position[1], + -this.rawPose.position[2], + this._tmpMatrix + ), + t || this._tmpMatrix.invert(), + this._tmpMatrix.multiplyToRef(e, e)); + }), + (t.prototype._updateCache = function (t) { + var i = this; + (this.rotationQuaternion.equals( + this._cache.rotationQuaternion + ) && + this.position.equals(this._cache.position)) || + (this.updateCacheCalled || + ((this.updateCacheCalled = true), this.update()), + this.rotationQuaternion.toRotationMatrix( + this._workingMatrix + ), + a.x.TransformCoordinatesToRef( + this._deviceRoomPosition, + this._workingMatrix, + this._workingVector + ), + this.devicePosition.subtractToRef( + this._workingVector, + this._workingVector + ), + a.j.ComposeToRef( + this._oneVector, + this.rotationQuaternion, + this._workingVector, + this._deviceToWorld + ), + this._deviceToWorld.getTranslationToRef( + this._workingVector + ), this._workingVector.addInPlace(this.position), - this._workingVector.subtractInPlace(this._cache.position), + this._workingVector.subtractInPlace( + this._cache.position + ), this._deviceToWorld.setTranslation(this._workingVector), this._deviceToWorld.invertToRef(this._worldToDevice), - this.controllers.forEach(function(e) { - e._deviceToWorld.copyFrom(i._deviceToWorld), - i._correctPositionIfNotTrackPosition(e._deviceToWorld), - e.update() + this.controllers.forEach(function (e) { + e._deviceToWorld.copyFrom(i._deviceToWorld), + i._correctPositionIfNotTrackPosition( + e._deviceToWorld + ), + e.update(); })), t || e.prototype._updateCache.call(this), - this.updateCacheCalled = false - } - , - t.prototype._computeDevicePosition = function() { - a.x.TransformCoordinatesToRef(this._deviceRoomPosition, this._deviceToWorld, this.devicePosition) - } - , - t.prototype.update = function() { - this._computeDevicePosition(), - a.j.FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix), - this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix), - a.q.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion), - this._poseSet && this.onPoseUpdatedFromDeviceObservable.notifyObservers(null), - e.prototype.update.call(this) - } - , - t.prototype._getViewMatrix = function() { - return a.j.Identity() - } - , - t.prototype._getWebVRViewMatrix = function() { - var e = this._cameraRigParams.parentCamera; - e._updateCache(); - var t = this._cameraRigParams.left ? this._cameraRigParams.frameData.leftViewMatrix : this._cameraRigParams.frameData.rightViewMatrix; - return a.j.FromArrayToRef(t, 0, this._webvrViewMatrix), - this.getScene().useRightHandedSystem || this._webvrViewMatrix.toggleModelMatrixHandInPlace(), - this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix), - a.x.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint), - this.position.addToRef(this._transformedReferencePoint, this._currentTarget), - 1 !== e.deviceScaleFactor && (this._webvrViewMatrix.invert(), - e.deviceScaleFactor && (this._webvrViewMatrix.multiplyAtIndex(12, e.deviceScaleFactor), - this._webvrViewMatrix.multiplyAtIndex(13, e.deviceScaleFactor), - this._webvrViewMatrix.multiplyAtIndex(14, e.deviceScaleFactor)), - this._webvrViewMatrix.invert()), - e._correctPositionIfNotTrackPosition(this._webvrViewMatrix, true), - e._worldToDevice.multiplyToRef(this._webvrViewMatrix, this._webvrViewMatrix), - this._workingMatrix = this._workingMatrix || a.j.Identity(), + (this.updateCacheCalled = false); + }), + (t.prototype._computeDevicePosition = function () { + a.x.TransformCoordinatesToRef( + this._deviceRoomPosition, + this._deviceToWorld, + this.devicePosition + ); + }), + (t.prototype.update = function () { + this._computeDevicePosition(), + a.j.FromQuaternionToRef( + this._deviceRoomRotationQuaternion, + this._workingMatrix + ), + this._workingMatrix.multiplyToRef( + this._deviceToWorld, + this._workingMatrix + ), + a.q.FromRotationMatrixToRef( + this._workingMatrix, + this.deviceRotationQuaternion + ), + this._poseSet && + this.onPoseUpdatedFromDeviceObservable.notifyObservers( + null + ), + e.prototype.update.call(this); + }), + (t.prototype._getViewMatrix = function () { + return a.j.Identity(); + }), + (t.prototype._getWebVRViewMatrix = function () { + var e = this._cameraRigParams.parentCamera; + e._updateCache(); + var t = this._cameraRigParams.left + ? this._cameraRigParams.frameData.leftViewMatrix + : this._cameraRigParams.frameData.rightViewMatrix; + return ( + a.j.FromArrayToRef(t, 0, this._webvrViewMatrix), + this.getScene().useRightHandedSystem || + this._webvrViewMatrix.toggleModelMatrixHandInPlace(), + this._webvrViewMatrix.getRotationMatrixToRef( + this._cameraRotationMatrix + ), + a.x.TransformCoordinatesToRef( + this._referencePoint, + this._cameraRotationMatrix, + this._transformedReferencePoint + ), + this.position.addToRef( + this._transformedReferencePoint, + this._currentTarget + ), + 1 !== e.deviceScaleFactor && + (this._webvrViewMatrix.invert(), + e.deviceScaleFactor && + (this._webvrViewMatrix.multiplyAtIndex( + 12, + e.deviceScaleFactor + ), + this._webvrViewMatrix.multiplyAtIndex( + 13, + e.deviceScaleFactor + ), + this._webvrViewMatrix.multiplyAtIndex( + 14, + e.deviceScaleFactor + )), + this._webvrViewMatrix.invert()), + e._correctPositionIfNotTrackPosition( + this._webvrViewMatrix, + true + ), + e._worldToDevice.multiplyToRef( + this._webvrViewMatrix, + this._webvrViewMatrix + ), + (this._workingMatrix = + this._workingMatrix || a.j.Identity()), this._webvrViewMatrix.invertToRef(this._workingMatrix), - this._workingMatrix.multiplyToRef(e.getWorldMatrix(), this._workingMatrix), - this._workingMatrix.getTranslationToRef(this._globalPosition), + this._workingMatrix.multiplyToRef( + e.getWorldMatrix(), + this._workingMatrix + ), + this._workingMatrix.getTranslationToRef( + this._globalPosition + ), this._markSyncedWithParent(), this._webvrViewMatrix - } - , - t.prototype._getWebVRProjectionMatrix = function() { - var e = this.parent; - e._vrDevice.depthNear = e.minZ, - e._vrDevice.depthFar = e.maxZ; - var t = this._cameraRigParams.left ? this._cameraRigParams.frameData.leftProjectionMatrix : this._cameraRigParams.frameData.rightProjectionMatrix; - return a.j.FromArrayToRef(t, 0, this._projectionMatrix), - this.getScene().useRightHandedSystem || this._projectionMatrix.toggleProjectionMatrixHandInPlace(), - this._projectionMatrix - } - , - t.prototype.initControllers = function() { - var e = this; - this.controllers = []; - var t = this.getScene().gamepadManager; - this._onGamepadDisconnectedObserver = t.onGamepadDisconnectedObservable.add(function(t) { - if (t.type === qe.POSE_ENABLED) { - var i = t; - i.defaultModel && i.defaultModel.setEnabled(false), - "right" === i.hand && (e._rightController = null), - "left" === i.hand && (e._leftController = null); - var n = e.controllers.indexOf(i); - -1 !== n && e.controllers.splice(n, 1) - } - }), - this._onGamepadConnectedObserver = t.onGamepadConnectedObservable.add(function(t) { - if (t.type === qe.POSE_ENABLED) { - var i = t; - if (e.webVROptions.trackPosition || (i._disableTrackPosition(new a.x("left" == i.hand ? -.15 : .15,-.5,.25)), - e._updateCacheWhenTrackingDisabledObserver || (e._updateCacheWhenTrackingDisabledObserver = e._scene.onBeforeRenderObservable.add(function() { - e._updateCache() - }))), - i.deviceScaleFactor = e.deviceScaleFactor, - i._deviceToWorld.copyFrom(e._deviceToWorld), - e._correctPositionIfNotTrackPosition(i._deviceToWorld), - e.webVROptions.controllerMeshes && (i.defaultModel ? i.defaultModel.setEnabled(true) : i.initControllerMesh(e.getScene(), function(t) { - if (t.scaling.scaleInPlace(e.deviceScaleFactor), - e.onControllerMeshLoadedObservable.notifyObservers(i), - e.webVROptions.defaultLightingOnControllers) { - e._lightOnControllers || (e._lightOnControllers = new gi.a("vrControllersLight",new a.x(0,1,0),e.getScene())); - e._lightOnControllers.includedOnlyMeshes.push(t), - function e(t, i) { - var n = t.getChildren(); - n && 0 !== n.length && n.forEach(function(t) { - i.includedOnlyMeshes.push(t), - e(t, i) - }) - }(t, e._lightOnControllers) - } - })), - i.attachToPoseControlledCamera(e), - -1 === e.controllers.indexOf(i)) { - e.controllers.push(i); - for (var n = false, r = 0; r < e.controllers.length; r++) - e.controllers[r].controllerType === Mt.VIVE && (n ? e.controllers[r].hand = "right" : (n = true, - e.controllers[r].hand = "left")); - e.controllers.length >= 2 && e.onControllersAttachedObservable.notifyObservers(e.controllers) - } - } - }) - } - , - t - }(Tt) - , vi = function(e) { - function t(t) { - var i = e.call(this, t) || this; - return i.onTriggerStateChangedObservable = new o.c, - i.onMainButtonStateChangedObservable = new o.c, - i.onSecondaryButtonStateChangedObservable = new o.c, - i.onPadStateChangedObservable = new o.c, - i.onPadValuesChangedObservable = new o.c, - i.pad = { - x: 0, - y: 0 - }, - i._changes = { - pressChanged: false, - touchChanged: false, - valueChanged: false, - changed: false - }, - i._buttons = new Array(t.buttons.length), - i.hand = t.hand, - i - } - return h.d(t, e), - t.prototype.onButtonStateChange = function(e) { - this._onButtonStateChange = e - } - , - Object.defineProperty(t.prototype, "defaultModel", { - get: function() { - return this._defaultModel - }, - enumerable: true, - configurable: true + ); }), - t.prototype.update = function() { - e.prototype.update.call(this); - for (var t = 0; t < this._buttons.length; t++) - this._setButtonValue(this.browserGamepad.buttons[t], this._buttons[t], t); - this.leftStick.x === this.pad.x && this.leftStick.y === this.pad.y || (this.pad.x = this.leftStick.x, - this.pad.y = this.leftStick.y, - this.onPadValuesChangedObservable.notifyObservers(this.pad)) - } - , - t.prototype._setButtonValue = function(e, t, i) { - e || (e = { - pressed: false, - touched: false, - value: 0 + (t.prototype._getWebVRProjectionMatrix = function () { + var e = this.parent; + (e._vrDevice.depthNear = e.minZ), + (e._vrDevice.depthFar = e.maxZ); + var t = this._cameraRigParams.left + ? this._cameraRigParams.frameData.leftProjectionMatrix + : this._cameraRigParams.frameData.rightProjectionMatrix; + return ( + a.j.FromArrayToRef(t, 0, this._projectionMatrix), + this.getScene().useRightHandedSystem || + this._projectionMatrix.toggleProjectionMatrixHandInPlace(), + this._projectionMatrix + ); + }), + (t.prototype.initControllers = function () { + var e = this; + this.controllers = []; + var t = this.getScene().gamepadManager; + (this._onGamepadDisconnectedObserver = + t.onGamepadDisconnectedObservable.add(function (t) { + if (t.type === qe.POSE_ENABLED) { + var i = t; + i.defaultModel && i.defaultModel.setEnabled(false), + "right" === i.hand && (e._rightController = null), + "left" === i.hand && (e._leftController = null); + var n = e.controllers.indexOf(i); + -1 !== n && e.controllers.splice(n, 1); + } + })), + (this._onGamepadConnectedObserver = + t.onGamepadConnectedObservable.add(function (t) { + if (t.type === qe.POSE_ENABLED) { + var i = t; + if ( + (e.webVROptions.trackPosition || + (i._disableTrackPosition( + new a.x( + "left" == i.hand ? -0.15 : 0.15, + -0.5, + 0.25 + ) + ), + e._updateCacheWhenTrackingDisabledObserver || + (e._updateCacheWhenTrackingDisabledObserver = + e._scene.onBeforeRenderObservable.add( + function () { + e._updateCache(); + } + ))), + (i.deviceScaleFactor = e.deviceScaleFactor), + i._deviceToWorld.copyFrom(e._deviceToWorld), + e._correctPositionIfNotTrackPosition( + i._deviceToWorld + ), + e.webVROptions.controllerMeshes && + (i.defaultModel + ? i.defaultModel.setEnabled(true) + : i.initControllerMesh( + e.getScene(), + function (t) { + if ( + (t.scaling.scaleInPlace( + e.deviceScaleFactor + ), + e.onControllerMeshLoadedObservable.notifyObservers( + i + ), + e.webVROptions + .defaultLightingOnControllers) + ) { + e._lightOnControllers || + (e._lightOnControllers = new gi.a( + "vrControllersLight", + new a.x(0, 1, 0), + e.getScene() + )); + e._lightOnControllers.includedOnlyMeshes.push( + t + ), + (function e(t, i) { + var n = t.getChildren(); + n && + 0 !== n.length && + n.forEach(function (t) { + i.includedOnlyMeshes.push( + t + ), + e(t, i); + }); + })(t, e._lightOnControllers); + } + } + )), + i.attachToPoseControlledCamera(e), + -1 === e.controllers.indexOf(i)) + ) { + e.controllers.push(i); + for ( + var n = false, r = 0; + r < e.controllers.length; + r++ + ) + e.controllers[r].controllerType === Mt.VIVE && + (n + ? (e.controllers[r].hand = "right") + : ((n = true), + (e.controllers[r].hand = "left"))); + e.controllers.length >= 2 && + e.onControllersAttachedObservable.notifyObservers( + e.controllers + ); + } + } + })); + }), + t + ); + })(Tt), + vi = (function (e) { + function t(t) { + var i = e.call(this, t) || this; + return ( + (i.onTriggerStateChangedObservable = new o.c()), + (i.onMainButtonStateChangedObservable = new o.c()), + (i.onSecondaryButtonStateChangedObservable = new o.c()), + (i.onPadStateChangedObservable = new o.c()), + (i.onPadValuesChangedObservable = new o.c()), + (i.pad = { + x: 0, + y: 0, + }), + (i._changes = { + pressChanged: false, + touchChanged: false, + valueChanged: false, + changed: false, + }), + (i._buttons = new Array(t.buttons.length)), + (i.hand = t.hand), + i + ); + } + return ( + h.d(t, e), + (t.prototype.onButtonStateChange = function (e) { + this._onButtonStateChange = e; + }), + Object.defineProperty(t.prototype, "defaultModel", { + get: function () { + return this._defaultModel; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.update = function () { + e.prototype.update.call(this); + for (var t = 0; t < this._buttons.length; t++) + this._setButtonValue( + this.browserGamepad.buttons[t], + this._buttons[t], + t + ); + (this.leftStick.x === this.pad.x && + this.leftStick.y === this.pad.y) || + ((this.pad.x = this.leftStick.x), + (this.pad.y = this.leftStick.y), + this.onPadValuesChangedObservable.notifyObservers( + this.pad + )); + }), + (t.prototype._setButtonValue = function (e, t, i) { + e || + (e = { + pressed: false, + touched: false, + value: 0, }), - t ? (this._checkChanges(e, t), - this._changes.changed && (this._onButtonStateChange && this._onButtonStateChange(this.index, i, e), - this._handleButtonChange(i, e, this._changes)), - this._buttons[i].pressed = e.pressed, - this._buttons[i].touched = e.touched, - this._buttons[i].value = e.value < 1e-8 ? 0 : e.value) : this._buttons[i] = { - pressed: e.pressed, - touched: e.touched, - value: e.value - } - } - , - t.prototype._checkChanges = function(e, t) { - return this._changes.pressChanged = e.pressed !== t.pressed, - this._changes.touchChanged = e.touched !== t.touched, - this._changes.valueChanged = e.value !== t.value, - this._changes.changed = this._changes.pressChanged || this._changes.touchChanged || this._changes.valueChanged, + t + ? (this._checkChanges(e, t), + this._changes.changed && + (this._onButtonStateChange && + this._onButtonStateChange(this.index, i, e), + this._handleButtonChange(i, e, this._changes)), + (this._buttons[i].pressed = e.pressed), + (this._buttons[i].touched = e.touched), + (this._buttons[i].value = + e.value < 1e-8 ? 0 : e.value)) + : (this._buttons[i] = { + pressed: e.pressed, + touched: e.touched, + value: e.value, + }); + }), + (t.prototype._checkChanges = function (e, t) { + return ( + (this._changes.pressChanged = e.pressed !== t.pressed), + (this._changes.touchChanged = e.touched !== t.touched), + (this._changes.valueChanged = e.value !== t.value), + (this._changes.changed = + this._changes.pressChanged || + this._changes.touchChanged || + this._changes.valueChanged), this._changes - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), + ); + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), this.onTriggerStateChangedObservable.clear(), this.onMainButtonStateChangedObservable.clear(), this.onSecondaryButtonStateChangedObservable.clear(), this.onPadStateChangedObservable.clear(), - this.onPadValuesChangedObservable.clear() - } - , + this.onPadValuesChangedObservable.clear(); + }), t - }(Nt) - , yi = n(31) - , bi = n(33) - , Ei = function(e) { - function t(t, i, n, r, o, a) { - void 0 === n && (n = null), - void 0 === o && (o = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), - void 0 === a && (a = _.a.TEXTUREFORMAT_RGBA); - var s = e.call(this, null, n, !r, void 0, o, void 0, void 0, void 0, void 0, a) || this; - s.name = t, - s._engine = s.getScene().getEngine(), - s.wrapU = je.a.CLAMP_ADDRESSMODE, - s.wrapV = je.a.CLAMP_ADDRESSMODE, - s._generateMipMaps = r, - i.getContext ? (s._canvas = i, - s._texture = s._engine.createDynamicTexture(i.width, i.height, r, o)) : (s._canvas = document.createElement("canvas"), - i.width || 0 === i.width ? s._texture = s._engine.createDynamicTexture(i.width, i.height, r, o) : s._texture = s._engine.createDynamicTexture(i, i, r, o)); - var c = s.getSize(); - return s._canvas.width = c.width, - s._canvas.height = c.height, - s._context = s._canvas.getContext("2d"), - s - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "DynamicTexture" - } - , + ); + })(Nt), + yi = n(31), + bi = n(33), + Ei = (function (e) { + function t(t, i, n, r, o, a) { + void 0 === n && (n = null), + void 0 === o && (o = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), + void 0 === a && (a = _.a.TEXTUREFORMAT_RGBA); + var s = + e.call( + this, + null, + n, + !r, + void 0, + o, + void 0, + void 0, + void 0, + void 0, + a + ) || this; + (s.name = t), + (s._engine = s.getScene().getEngine()), + (s.wrapU = je.a.CLAMP_ADDRESSMODE), + (s.wrapV = je.a.CLAMP_ADDRESSMODE), + (s._generateMipMaps = r), + i.getContext + ? ((s._canvas = i), + (s._texture = s._engine.createDynamicTexture( + i.width, + i.height, + r, + o + ))) + : ((s._canvas = document.createElement("canvas")), + i.width || 0 === i.width + ? (s._texture = s._engine.createDynamicTexture( + i.width, + i.height, + r, + o + )) + : (s._texture = s._engine.createDynamicTexture( + i, + i, + r, + o + ))); + var c = s.getSize(); + return ( + (s._canvas.width = c.width), + (s._canvas.height = c.height), + (s._context = s._canvas.getContext("2d")), + s + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "DynamicTexture"; + }), Object.defineProperty(t.prototype, "canRescale", { - get: function() { - return true - }, - enumerable: true, - configurable: true + get: function () { + return true; + }, + enumerable: true, + configurable: true, }), - t.prototype._recreate = function(e) { - this._canvas.width = e.width, - this._canvas.height = e.height, + (t.prototype._recreate = function (e) { + (this._canvas.width = e.width), + (this._canvas.height = e.height), this.releaseInternalTexture(), - this._texture = this._engine.createDynamicTexture(e.width, e.height, this._generateMipMaps, this.samplingMode) - } - , - t.prototype.scale = function(e) { - var t = this.getSize(); - t.width *= e, - t.height *= e, - this._recreate(t) - } - , - t.prototype.scaleTo = function(e, t) { - var i = this.getSize(); - i.width = e, - i.height = t, - this._recreate(i) - } - , - t.prototype.getContext = function() { - return this._context - } - , - t.prototype.clear = function() { - var e = this.getSize(); - this._context.fillRect(0, 0, e.width, e.height) - } - , - t.prototype.update = function(e, t) { - void 0 === t && (t = false), - this._engine.updateDynamicTexture(this._texture, this._canvas, void 0 === e || e, t, this._format || void 0) - } - , - t.prototype.drawText = function(e, t, i, n, r, o, a, s) { - void 0 === s && (s = true); - var c = this.getSize(); - if (o && (this._context.fillStyle = o, - this._context.fillRect(0, 0, c.width, c.height)), - this._context.font = n, - null == t) { - var u = this._context.measureText(e); - t = (c.width - u.width) / 2 - } - if (null == i) { - var l = parseInt(n.replace(/\D/g, "")); - i = c.height / 2 + l / 3.65 - } - this._context.fillStyle = r, - this._context.fillText(e, t, i), - s && this.update(a) - } - , - t.prototype.clone = function() { - var e = this.getScene(); - if (!e) - return this; - var i = this.getSize() - , n = new t(this.name,i,e,this._generateMipMaps); - return n.hasAlpha = this.hasAlpha, - n.level = this.level, - n.wrapU = this.wrapU, - n.wrapV = this.wrapV, - n - } - , - t.prototype.serialize = function() { - var t = this.getScene(); - t && !t.isReady() && g.a.Warn("The scene must be ready before serializing the dynamic texture"); - var i = e.prototype.serialize.call(this); - return i.base64String = this._canvas.toDataURL(), - i.invertY = this._invertY, - i.samplingMode = this.samplingMode, - i - } - , - t.prototype._rebuild = function() { - this.update() - } - , - t - }(je.a) - , Ti = (n(86), - n(56), - n(87), - "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\n#include\n#include\nvoid main(void)\n{\nvec4 result=texture2D(textureSampler,vUV);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\n\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;\n}"); - Ht.a.ShadersStore.imageProcessingPixelShader = Ti; - var Ai = function(e) { - function t(t, i, n, r, o, a, s, c) { - void 0 === n && (n = null), - void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT); - var u = e.call(this, t, "imageProcessing", [], [], i, n, r, o, a, null, s, "postprocess", null, true) || this; - return u._fromLinearSpace = true, - u._defines = { - IMAGEPROCESSING: false, - VIGNETTE: false, - VIGNETTEBLENDMODEMULTIPLY: false, - VIGNETTEBLENDMODEOPAQUE: false, - TONEMAPPING: false, - TONEMAPPING_ACES: false, - CONTRAST: false, - COLORCURVES: false, - COLORGRADING: false, - COLORGRADING3D: false, - FROMLINEARSPACE: false, - SAMPLER3DGREENDEPTH: false, - SAMPLER3DBGRMAP: false, - IMAGEPROCESSINGPOSTPROCESS: false, - EXPOSURE: false - }, - c ? (c.applyByPostProcess = true, - u._attachImageProcessingConfiguration(c, true), - u.fromLinearSpace = false) : (u._attachImageProcessingConfiguration(null, true), - u.imageProcessingConfiguration.applyByPostProcess = true), - u.onApply = function(e) { - u.imageProcessingConfiguration.bind(e, u.aspectRatio) - } - , - u - } - return h.d(t, e), - Object.defineProperty(t.prototype, "imageProcessingConfiguration", { - get: function() { - return this._imageProcessingConfiguration - }, - set: function(e) { - this._attachImageProcessingConfiguration(e) - }, - enumerable: true, - configurable: true + (this._texture = this._engine.createDynamicTexture( + e.width, + e.height, + this._generateMipMaps, + this.samplingMode + )); }), - t.prototype._attachImageProcessingConfiguration = function(e, t) { - var i = this; - if (void 0 === t && (t = false), - e !== this._imageProcessingConfiguration) { - if (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), - e) - this._imageProcessingConfiguration = e; - else { - var n = null - , r = this.getEngine() - , o = this.getCamera(); - if (o) - n = o.getScene(); - else if (r && r.scenes) { - var a = r.scenes; - n = a[a.length - 1] - } else - n = R.a.LastCreatedScene; - this._imageProcessingConfiguration = n.imageProcessingConfiguration - } - this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() { - i._updateParameters() - })), - t || this._updateParameters() - } - } - , - Object.defineProperty(t.prototype, "colorCurves", { - get: function() { - return this.imageProcessingConfiguration.colorCurves + (t.prototype.scale = function (e) { + var t = this.getSize(); + (t.width *= e), (t.height *= e), this._recreate(t); + }), + (t.prototype.scaleTo = function (e, t) { + var i = this.getSize(); + (i.width = e), (i.height = t), this._recreate(i); + }), + (t.prototype.getContext = function () { + return this._context; + }), + (t.prototype.clear = function () { + var e = this.getSize(); + this._context.fillRect(0, 0, e.width, e.height); + }), + (t.prototype.update = function (e, t) { + void 0 === t && (t = false), + this._engine.updateDynamicTexture( + this._texture, + this._canvas, + void 0 === e || e, + t, + this._format || void 0 + ); + }), + (t.prototype.drawText = function (e, t, i, n, r, o, a, s) { + void 0 === s && (s = true); + var c = this.getSize(); + if ( + (o && + ((this._context.fillStyle = o), + this._context.fillRect(0, 0, c.width, c.height)), + (this._context.font = n), + null == t) + ) { + var u = this._context.measureText(e); + t = (c.width - u.width) / 2; + } + if (null == i) { + var l = parseInt(n.replace(/\D/g, "")); + i = c.height / 2 + l / 3.65; + } + (this._context.fillStyle = r), + this._context.fillText(e, t, i), + s && this.update(a); + }), + (t.prototype.clone = function () { + var e = this.getScene(); + if (!e) return this; + var i = this.getSize(), + n = new t(this.name, i, e, this._generateMipMaps); + return ( + (n.hasAlpha = this.hasAlpha), + (n.level = this.level), + (n.wrapU = this.wrapU), + (n.wrapV = this.wrapV), + n + ); + }), + (t.prototype.serialize = function () { + var t = this.getScene(); + t && + !t.isReady() && + g.a.Warn( + "The scene must be ready before serializing the dynamic texture" + ); + var i = e.prototype.serialize.call(this); + return ( + (i.base64String = this._canvas.toDataURL()), + (i.invertY = this._invertY), + (i.samplingMode = this.samplingMode), + i + ); + }), + (t.prototype._rebuild = function () { + this.update(); + }), + t + ); + })(je.a), + Ti = + (n(86), + n(56), + n(87), + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\n#include\n#include\nvoid main(void)\n{\nvec4 result=texture2D(textureSampler,vUV);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\n\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;\n}"); + Ht.a.ShadersStore.imageProcessingPixelShader = Ti; + var Ai = (function (e) { + function t(t, i, n, r, o, a, s, c) { + void 0 === n && (n = null), + void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT); + var u = + e.call( + this, + t, + "imageProcessing", + [], + [], + i, + n, + r, + o, + a, + null, + s, + "postprocess", + null, + true + ) || this; + return ( + (u._fromLinearSpace = true), + (u._defines = { + IMAGEPROCESSING: false, + VIGNETTE: false, + VIGNETTEBLENDMODEMULTIPLY: false, + VIGNETTEBLENDMODEOPAQUE: false, + TONEMAPPING: false, + TONEMAPPING_ACES: false, + CONTRAST: false, + COLORCURVES: false, + COLORGRADING: false, + COLORGRADING3D: false, + FROMLINEARSPACE: false, + SAMPLER3DGREENDEPTH: false, + SAMPLER3DBGRMAP: false, + IMAGEPROCESSINGPOSTPROCESS: false, + EXPOSURE: false, + }), + c + ? ((c.applyByPostProcess = true), + u._attachImageProcessingConfiguration(c, true), + (u.fromLinearSpace = false)) + : (u._attachImageProcessingConfiguration(null, true), + (u.imageProcessingConfiguration.applyByPostProcess = true)), + (u.onApply = function (e) { + u.imageProcessingConfiguration.bind(e, u.aspectRatio); + }), + u + ); + } + return ( + h.d(t, e), + Object.defineProperty( + t.prototype, + "imageProcessingConfiguration", + { + get: function () { + return this._imageProcessingConfiguration; }, - set: function(e) { - this.imageProcessingConfiguration.colorCurves = e + set: function (e) { + this._attachImageProcessingConfiguration(e); }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype._attachImageProcessingConfiguration = + function (e, t) { + var i = this; + if ( + (void 0 === t && (t = false), + e !== this._imageProcessingConfiguration) + ) { + if ( + (this._imageProcessingConfiguration && + this._imageProcessingObserver && + this._imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingObserver + ), + e) + ) + this._imageProcessingConfiguration = e; + else { + var n = null, + r = this.getEngine(), + o = this.getCamera(); + if (o) n = o.getScene(); + else if (r && r.scenes) { + var a = r.scenes; + n = a[a.length - 1]; + } else n = R.a.LastCreatedScene; + this._imageProcessingConfiguration = + n.imageProcessingConfiguration; + } + this._imageProcessingConfiguration && + (this._imageProcessingObserver = + this._imageProcessingConfiguration.onUpdateParameters.add( + function () { + i._updateParameters(); + } + )), + t || this._updateParameters(); + } + }), + Object.defineProperty(t.prototype, "colorCurves", { + get: function () { + return this.imageProcessingConfiguration.colorCurves; + }, + set: function (e) { + this.imageProcessingConfiguration.colorCurves = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "colorCurvesEnabled", { - get: function() { - return this.imageProcessingConfiguration.colorCurvesEnabled - }, - set: function(e) { - this.imageProcessingConfiguration.colorCurvesEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .colorCurvesEnabled; + }, + set: function (e) { + this.imageProcessingConfiguration.colorCurvesEnabled = + e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "colorGradingTexture", { - get: function() { - return this.imageProcessingConfiguration.colorGradingTexture - }, - set: function(e) { - this.imageProcessingConfiguration.colorGradingTexture = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .colorGradingTexture; + }, + set: function (e) { + this.imageProcessingConfiguration.colorGradingTexture = + e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "colorGradingEnabled", { - get: function() { - return this.imageProcessingConfiguration.colorGradingEnabled - }, - set: function(e) { - this.imageProcessingConfiguration.colorGradingEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .colorGradingEnabled; + }, + set: function (e) { + this.imageProcessingConfiguration.colorGradingEnabled = + e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "exposure", { - get: function() { - return this.imageProcessingConfiguration.exposure - }, - set: function(e) { - this.imageProcessingConfiguration.exposure = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration.exposure; + }, + set: function (e) { + this.imageProcessingConfiguration.exposure = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "toneMappingEnabled", { - get: function() { - return this._imageProcessingConfiguration.toneMappingEnabled - }, - set: function(e) { - this._imageProcessingConfiguration.toneMappingEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return this._imageProcessingConfiguration + .toneMappingEnabled; + }, + set: function (e) { + this._imageProcessingConfiguration.toneMappingEnabled = + e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "toneMappingType", { - get: function() { - return this._imageProcessingConfiguration.toneMappingType - }, - set: function(e) { - this._imageProcessingConfiguration.toneMappingType = e - }, - enumerable: true, - configurable: true + get: function () { + return this._imageProcessingConfiguration + .toneMappingType; + }, + set: function (e) { + this._imageProcessingConfiguration.toneMappingType = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "contrast", { - get: function() { - return this.imageProcessingConfiguration.contrast - }, - set: function(e) { - this.imageProcessingConfiguration.contrast = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration.contrast; + }, + set: function (e) { + this.imageProcessingConfiguration.contrast = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "vignetteStretch", { - get: function() { - return this.imageProcessingConfiguration.vignetteStretch - }, - set: function(e) { - this.imageProcessingConfiguration.vignetteStretch = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .vignetteStretch; + }, + set: function (e) { + this.imageProcessingConfiguration.vignetteStretch = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "vignetteCentreX", { - get: function() { - return this.imageProcessingConfiguration.vignetteCentreX - }, - set: function(e) { - this.imageProcessingConfiguration.vignetteCentreX = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .vignetteCentreX; + }, + set: function (e) { + this.imageProcessingConfiguration.vignetteCentreX = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "vignetteCentreY", { - get: function() { - return this.imageProcessingConfiguration.vignetteCentreY - }, - set: function(e) { - this.imageProcessingConfiguration.vignetteCentreY = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .vignetteCentreY; + }, + set: function (e) { + this.imageProcessingConfiguration.vignetteCentreY = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "vignetteWeight", { - get: function() { - return this.imageProcessingConfiguration.vignetteWeight - }, - set: function(e) { - this.imageProcessingConfiguration.vignetteWeight = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration.vignetteWeight; + }, + set: function (e) { + this.imageProcessingConfiguration.vignetteWeight = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "vignetteColor", { - get: function() { - return this.imageProcessingConfiguration.vignetteColor - }, - set: function(e) { - this.imageProcessingConfiguration.vignetteColor = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration.vignetteColor; + }, + set: function (e) { + this.imageProcessingConfiguration.vignetteColor = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "vignetteCameraFov", { - get: function() { - return this.imageProcessingConfiguration.vignetteCameraFov - }, - set: function(e) { - this.imageProcessingConfiguration.vignetteCameraFov = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .vignetteCameraFov; + }, + set: function (e) { + this.imageProcessingConfiguration.vignetteCameraFov = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "vignetteBlendMode", { - get: function() { - return this.imageProcessingConfiguration.vignetteBlendMode - }, - set: function(e) { - this.imageProcessingConfiguration.vignetteBlendMode = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .vignetteBlendMode; + }, + set: function (e) { + this.imageProcessingConfiguration.vignetteBlendMode = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "vignetteEnabled", { - get: function() { - return this.imageProcessingConfiguration.vignetteEnabled - }, - set: function(e) { - this.imageProcessingConfiguration.vignetteEnabled = e - }, - enumerable: true, - configurable: true + get: function () { + return this.imageProcessingConfiguration + .vignetteEnabled; + }, + set: function (e) { + this.imageProcessingConfiguration.vignetteEnabled = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "fromLinearSpace", { - get: function() { - return this._fromLinearSpace - }, - set: function(e) { - this._fromLinearSpace !== e && (this._fromLinearSpace = e, - this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._fromLinearSpace; + }, + set: function (e) { + this._fromLinearSpace !== e && + ((this._fromLinearSpace = e), + this._updateParameters()); + }, + enumerable: true, + configurable: true, }), - t.prototype.getClassName = function() { - return "ImageProcessingPostProcess" - } - , - t.prototype._updateParameters = function() { - this._defines.FROMLINEARSPACE = this._fromLinearSpace, - this.imageProcessingConfiguration.prepareDefines(this._defines, true); - var e = ""; - for (var t in this._defines) - this._defines[t] && (e += "#define " + t + ";\r\n"); - var i = ["textureSampler"] - , n = ["scale"]; - yi.a && (yi.a.PrepareSamplers(i, this._defines), + (t.prototype.getClassName = function () { + return "ImageProcessingPostProcess"; + }), + (t.prototype._updateParameters = function () { + (this._defines.FROMLINEARSPACE = this._fromLinearSpace), + this.imageProcessingConfiguration.prepareDefines( + this._defines, + true + ); + var e = ""; + for (var t in this._defines) + this._defines[t] && (e += "#define " + t + ";\r\n"); + var i = ["textureSampler"], + n = ["scale"]; + yi.a && + (yi.a.PrepareSamplers(i, this._defines), yi.a.PrepareUniforms(n, this._defines)), - this.updateEffect(e, n, i) - } - , - t.prototype.dispose = function(t) { - e.prototype.dispose.call(this, t), - this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), - this._imageProcessingConfiguration && (this.imageProcessingConfiguration.applyByPostProcess = false) - } - , - h.c([Object(F.c)()], t.prototype, "_fromLinearSpace", void 0), + this.updateEffect(e, n, i); + }), + (t.prototype.dispose = function (t) { + e.prototype.dispose.call(this, t), + this._imageProcessingConfiguration && + this._imageProcessingObserver && + this._imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingObserver + ), + this._imageProcessingConfiguration && + (this.imageProcessingConfiguration.applyByPostProcess = false); + }), + h.c( + [Object(F.c)()], + t.prototype, + "_fromLinearSpace", + void 0 + ), t - }(Wt) - , xi = n(13) - , Si = n(4); - me.a._GroundMeshParser = function(e, t) { - return Ci.Parse(e, t) + ); + })(Wt), + xi = n(13), + Si = n(4); + me.a._GroundMeshParser = function (e, t) { + return Ci.Parse(e, t); + }; + var Ci = (function (e) { + function t(t, i) { + var n = e.call(this, t, i) || this; + return (n.generateOctree = false), n; } - ; - var Ci = function(e) { - function t(t, i) { - var n = e.call(this, t, i) || this; - return n.generateOctree = false, - n - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "GroundMesh" - } - , - Object.defineProperty(t.prototype, "subdivisions", { - get: function() { - return Math.min(this._subdivisionsX, this._subdivisionsY) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "subdivisionsX", { - get: function() { - return this._subdivisionsX - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "subdivisionsY", { - get: function() { - return this._subdivisionsY - }, - enumerable: true, - configurable: true - }), - t.prototype.optimize = function(e, t) { - void 0 === t && (t = 32), - this._subdivisionsX = e, - this._subdivisionsY = e, - this.subdivide(e), - this.createOrUpdateSubmeshesOctree && this.createOrUpdateSubmeshesOctree(t) - } - , - t.prototype.getHeightAtCoordinates = function(e, t) { - var i = this.getWorldMatrix() - , n = a.t.Matrix[5]; - i.invertToRef(n); - var r = a.t.Vector3[8]; - if (a.x.TransformCoordinatesFromFloatsToRef(e, 0, t, n, r), - e = r.x, - t = r.z, - e < this._minX || e > this._maxX || t < this._minZ || t > this._maxZ) - return this.position.y; - this._heightQuads && 0 != this._heightQuads.length || (this._initHeightQuads(), - this._computeHeightQuads()); - var o = this._getFacetAt(e, t) - , s = -(o.x * e + o.z * t + o.w) / o.y; - return a.x.TransformCoordinatesFromFloatsToRef(0, s, 0, i, r), - r.y - } - , - t.prototype.getNormalAtCoordinates = function(e, t) { - var i = new a.x(0,1,0); - return this.getNormalAtCoordinatesToRef(e, t, i), - i - } - , - t.prototype.getNormalAtCoordinatesToRef = function(e, t, i) { - var n = this.getWorldMatrix() - , r = a.t.Matrix[5]; - n.invertToRef(r); - var o = a.t.Vector3[8]; - if (a.x.TransformCoordinatesFromFloatsToRef(e, 0, t, r, o), - e = o.x, - t = o.z, - e < this._minX || e > this._maxX || t < this._minZ || t > this._maxZ) - return this; - this._heightQuads && 0 != this._heightQuads.length || (this._initHeightQuads(), - this._computeHeightQuads()); - var s = this._getFacetAt(e, t); - return a.x.TransformNormalFromFloatsToRef(s.x, s.y, s.z, n, i), - this - } - , - t.prototype.updateCoordinateHeights = function() { - return this._heightQuads && 0 != this._heightQuads.length || this._initHeightQuads(), - this._computeHeightQuads(), - this - } - , - t.prototype._getFacetAt = function(e, t) { - var i = Math.floor((e + this._maxX) * this._subdivisionsX / this._width) - , n = Math.floor(-(t + this._maxZ) * this._subdivisionsY / this._height + this._subdivisionsY) - , r = this._heightQuads[n * this._subdivisionsX + i]; - return t < r.slope.x * e + r.slope.y ? r.facet1 : r.facet2 - } - , - t.prototype._initHeightQuads = function() { - var e = this._subdivisionsX - , t = this._subdivisionsY; - this._heightQuads = new Array; - for (var i = 0; i < t; i++) - for (var n = 0; n < e; n++) { - var r = { - slope: a.w.Zero(), - facet1: new a.y(0,0,0,0), - facet2: new a.y(0,0,0,0) - }; - this._heightQuads[i * e + n] = r - } - return this - } - , - t.prototype._computeHeightQuads = function() { - var e = this.getVerticesData(Si.b.PositionKind); - if (!e) - return this; - for (var t = a.t.Vector3[3], i = a.t.Vector3[2], n = a.t.Vector3[1], r = a.t.Vector3[0], o = a.t.Vector3[4], s = a.t.Vector3[5], c = a.t.Vector3[6], u = a.t.Vector3[7], l = a.t.Vector3[8], h = 0, f = 0, d = 0, p = 0, m = 0, g = 0, _ = 0, v = this._subdivisionsX, y = this._subdivisionsY, b = 0; b < y; b++) - for (var E = 0; E < v; E++) { - h = 3 * E, - f = b * (v + 1) * 3, - d = (b + 1) * (v + 1) * 3, - t.x = e[f + h], - t.y = e[f + h + 1], - t.z = e[f + h + 2], - i.x = e[f + h + 3], - i.y = e[f + h + 4], - i.z = e[f + h + 5], - n.x = e[d + h], - n.y = e[d + h + 1], - n.z = e[d + h + 2], - r.x = e[d + h + 3], - r.y = e[d + h + 4], - r.z = e[d + h + 5], - p = (r.z - t.z) / (r.x - t.x), - m = t.z - p * t.x, - i.subtractToRef(t, o), - n.subtractToRef(t, s), - r.subtractToRef(t, c), - a.x.CrossToRef(c, s, u), - a.x.CrossToRef(o, c, l), - u.normalize(), - l.normalize(), - g = -(u.x * t.x + u.y * t.y + u.z * t.z), - _ = -(l.x * i.x + l.y * i.y + l.z * i.z); - var T = this._heightQuads[b * v + E]; - T.slope.copyFromFloats(p, m), - T.facet1.copyFromFloats(u.x, u.y, u.z, g), - T.facet2.copyFromFloats(l.x, l.y, l.z, _) - } - return this - } - , - t.prototype.serialize = function(t) { - e.prototype.serialize.call(this, t), - t.subdivisionsX = this._subdivisionsX, - t.subdivisionsY = this._subdivisionsY, - t.minX = this._minX, - t.maxX = this._maxX, - t.minZ = this._minZ, - t.maxZ = this._maxZ, - t.width = this._width, - t.height = this._height - } - , - t.Parse = function(e, i) { - var n = new t(e.name,i); - return n._subdivisionsX = e.subdivisionsX || 1, - n._subdivisionsY = e.subdivisionsY || 1, - n._minX = e.minX, - n._maxX = e.maxX, - n._minZ = e.minZ, - n._maxZ = e.maxZ, - n._width = e.width, - n._height = e.height, - n - } - , - t - }(me.a); - xi.a.CreateGround = function(e) { - var t, i, n = [], r = [], o = [], s = [], c = e.width || 1, u = e.height || 1, l = e.subdivisionsX || e.subdivisions || 1, h = e.subdivisionsY || e.subdivisions || 1; - for (t = 0; t <= h; t++) - for (i = 0; i <= l; i++) { - var f = new a.x(i * c / l - c / 2,0,(h - t) * u / h - u / 2) - , d = new a.x(0,1,0); - r.push(f.x, f.y, f.z), - o.push(d.x, d.y, d.z), - s.push(i / l, 1 - t / h) - } - for (t = 0; t < h; t++) - for (i = 0; i < l; i++) - n.push(i + 1 + (t + 1) * (l + 1)), - n.push(i + 1 + t * (l + 1)), - n.push(i + t * (l + 1)), - n.push(i + (t + 1) * (l + 1)), - n.push(i + 1 + (t + 1) * (l + 1)), - n.push(i + t * (l + 1)); - var p = new xi.a; - return p.indices = n, - p.positions = r, - p.normals = o, - p.uvs = s, - p - } - , - xi.a.CreateTiledGround = function(e) { - var t, i, n, r, o = void 0 !== e.xmin && null !== e.xmin ? e.xmin : -1, s = void 0 !== e.zmin && null !== e.zmin ? e.zmin : -1, c = void 0 !== e.xmax && null !== e.xmax ? e.xmax : 1, u = void 0 !== e.zmax && null !== e.zmax ? e.zmax : 1, l = e.subdivisions || { - w: 1, - h: 1 - }, h = e.precision || { - w: 1, - h: 1 - }, f = new Array, d = new Array, p = new Array, m = new Array; - l.h = l.h < 1 ? 1 : l.h, - l.w = l.w < 1 ? 1 : l.w, - h.w = h.w < 1 ? 1 : h.w, - h.h = h.h < 1 ? 1 : h.h; - var g = (c - o) / l.w - , _ = (u - s) / l.h; - function v(e, n, r, o) { - var s = d.length / 3 - , c = h.w + 1; - for (t = 0; t < h.h; t++) - for (i = 0; i < h.w; i++) { - var u = [s + i + t * c, s + (i + 1) + t * c, s + (i + 1) + (t + 1) * c, s + i + (t + 1) * c]; - f.push(u[1]), - f.push(u[2]), - f.push(u[3]), - f.push(u[0]), - f.push(u[1]), - f.push(u[3]) - } - var l = a.x.Zero() - , g = new a.x(0,1,0); - for (t = 0; t <= h.h; t++) - for (l.z = t * (o - n) / h.h + n, - i = 0; i <= h.w; i++) - l.x = i * (r - e) / h.w + e, - l.y = 0, - d.push(l.x, l.y, l.z), - p.push(g.x, g.y, g.z), - m.push(i / h.w, t / h.h) - } - for (n = 0; n < l.h; n++) - for (r = 0; r < l.w; r++) - v(o + r * g, s + n * _, o + (r + 1) * g, s + (n + 1) * _); - var y = new xi.a; - return y.indices = f, - y.positions = d, - y.normals = p, - y.uvs = m, + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "GroundMesh"; + }), + Object.defineProperty(t.prototype, "subdivisions", { + get: function () { + return Math.min(this._subdivisionsX, this._subdivisionsY); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "subdivisionsX", { + get: function () { + return this._subdivisionsX; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "subdivisionsY", { + get: function () { + return this._subdivisionsY; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.optimize = function (e, t) { + void 0 === t && (t = 32), + (this._subdivisionsX = e), + (this._subdivisionsY = e), + this.subdivide(e), + this.createOrUpdateSubmeshesOctree && + this.createOrUpdateSubmeshesOctree(t); + }), + (t.prototype.getHeightAtCoordinates = function (e, t) { + var i = this.getWorldMatrix(), + n = a.t.Matrix[5]; + i.invertToRef(n); + var r = a.t.Vector3[8]; + if ( + (a.x.TransformCoordinatesFromFloatsToRef(e, 0, t, n, r), + (e = r.x), + (t = r.z), + e < this._minX || + e > this._maxX || + t < this._minZ || + t > this._maxZ) + ) + return this.position.y; + (this._heightQuads && 0 != this._heightQuads.length) || + (this._initHeightQuads(), this._computeHeightQuads()); + var o = this._getFacetAt(e, t), + s = -(o.x * e + o.z * t + o.w) / o.y; + return ( + a.x.TransformCoordinatesFromFloatsToRef(0, s, 0, i, r), + r.y + ); + }), + (t.prototype.getNormalAtCoordinates = function (e, t) { + var i = new a.x(0, 1, 0); + return this.getNormalAtCoordinatesToRef(e, t, i), i; + }), + (t.prototype.getNormalAtCoordinatesToRef = function ( + e, + t, + i + ) { + var n = this.getWorldMatrix(), + r = a.t.Matrix[5]; + n.invertToRef(r); + var o = a.t.Vector3[8]; + if ( + (a.x.TransformCoordinatesFromFloatsToRef(e, 0, t, r, o), + (e = o.x), + (t = o.z), + e < this._minX || + e > this._maxX || + t < this._minZ || + t > this._maxZ) + ) + return this; + (this._heightQuads && 0 != this._heightQuads.length) || + (this._initHeightQuads(), this._computeHeightQuads()); + var s = this._getFacetAt(e, t); + return ( + a.x.TransformNormalFromFloatsToRef(s.x, s.y, s.z, n, i), + this + ); + }), + (t.prototype.updateCoordinateHeights = function () { + return ( + (this._heightQuads && 0 != this._heightQuads.length) || + this._initHeightQuads(), + this._computeHeightQuads(), + this + ); + }), + (t.prototype._getFacetAt = function (e, t) { + var i = Math.floor( + ((e + this._maxX) * this._subdivisionsX) / this._width + ), + n = Math.floor( + (-(t + this._maxZ) * this._subdivisionsY) / + this._height + + this._subdivisionsY + ), + r = this._heightQuads[n * this._subdivisionsX + i]; + return t < r.slope.x * e + r.slope.y ? r.facet1 : r.facet2; + }), + (t.prototype._initHeightQuads = function () { + var e = this._subdivisionsX, + t = this._subdivisionsY; + this._heightQuads = new Array(); + for (var i = 0; i < t; i++) + for (var n = 0; n < e; n++) { + var r = { + slope: a.w.Zero(), + facet1: new a.y(0, 0, 0, 0), + facet2: new a.y(0, 0, 0, 0), + }; + this._heightQuads[i * e + n] = r; + } + return this; + }), + (t.prototype._computeHeightQuads = function () { + var e = this.getVerticesData(Si.b.PositionKind); + if (!e) return this; + for ( + var t = a.t.Vector3[3], + i = a.t.Vector3[2], + n = a.t.Vector3[1], + r = a.t.Vector3[0], + o = a.t.Vector3[4], + s = a.t.Vector3[5], + c = a.t.Vector3[6], + u = a.t.Vector3[7], + l = a.t.Vector3[8], + h = 0, + f = 0, + d = 0, + p = 0, + m = 0, + g = 0, + _ = 0, + v = this._subdivisionsX, + y = this._subdivisionsY, + b = 0; + b < y; + b++ + ) + for (var E = 0; E < v; E++) { + (h = 3 * E), + (f = b * (v + 1) * 3), + (d = (b + 1) * (v + 1) * 3), + (t.x = e[f + h]), + (t.y = e[f + h + 1]), + (t.z = e[f + h + 2]), + (i.x = e[f + h + 3]), + (i.y = e[f + h + 4]), + (i.z = e[f + h + 5]), + (n.x = e[d + h]), + (n.y = e[d + h + 1]), + (n.z = e[d + h + 2]), + (r.x = e[d + h + 3]), + (r.y = e[d + h + 4]), + (r.z = e[d + h + 5]), + (p = (r.z - t.z) / (r.x - t.x)), + (m = t.z - p * t.x), + i.subtractToRef(t, o), + n.subtractToRef(t, s), + r.subtractToRef(t, c), + a.x.CrossToRef(c, s, u), + a.x.CrossToRef(o, c, l), + u.normalize(), + l.normalize(), + (g = -(u.x * t.x + u.y * t.y + u.z * t.z)), + (_ = -(l.x * i.x + l.y * i.y + l.z * i.z)); + var T = this._heightQuads[b * v + E]; + T.slope.copyFromFloats(p, m), + T.facet1.copyFromFloats(u.x, u.y, u.z, g), + T.facet2.copyFromFloats(l.x, l.y, l.z, _); + } + return this; + }), + (t.prototype.serialize = function (t) { + e.prototype.serialize.call(this, t), + (t.subdivisionsX = this._subdivisionsX), + (t.subdivisionsY = this._subdivisionsY), + (t.minX = this._minX), + (t.maxX = this._maxX), + (t.minZ = this._minZ), + (t.maxZ = this._maxZ), + (t.width = this._width), + (t.height = this._height); + }), + (t.Parse = function (e, i) { + var n = new t(e.name, i); + return ( + (n._subdivisionsX = e.subdivisionsX || 1), + (n._subdivisionsY = e.subdivisionsY || 1), + (n._minX = e.minX), + (n._maxX = e.maxX), + (n._minZ = e.minZ), + (n._maxZ = e.maxZ), + (n._width = e.width), + (n._height = e.height), + n + ); + }), + t + ); + })(me.a); + (xi.a.CreateGround = function (e) { + var t, + i, + n = [], + r = [], + o = [], + s = [], + c = e.width || 1, + u = e.height || 1, + l = e.subdivisionsX || e.subdivisions || 1, + h = e.subdivisionsY || e.subdivisions || 1; + for (t = 0; t <= h; t++) + for (i = 0; i <= l; i++) { + var f = new a.x( + (i * c) / l - c / 2, + 0, + ((h - t) * u) / h - u / 2 + ), + d = new a.x(0, 1, 0); + r.push(f.x, f.y, f.z), + o.push(d.x, d.y, d.z), + s.push(i / l, 1 - t / h); + } + for (t = 0; t < h; t++) + for (i = 0; i < l; i++) + n.push(i + 1 + (t + 1) * (l + 1)), + n.push(i + 1 + t * (l + 1)), + n.push(i + t * (l + 1)), + n.push(i + (t + 1) * (l + 1)), + n.push(i + 1 + (t + 1) * (l + 1)), + n.push(i + t * (l + 1)); + var p = new xi.a(); + return ( + (p.indices = n), + (p.positions = r), + (p.normals = o), + (p.uvs = s), + p + ); + }), + (xi.a.CreateTiledGround = function (e) { + var t, + i, + n, + r, + o = void 0 !== e.xmin && null !== e.xmin ? e.xmin : -1, + s = void 0 !== e.zmin && null !== e.zmin ? e.zmin : -1, + c = void 0 !== e.xmax && null !== e.xmax ? e.xmax : 1, + u = void 0 !== e.zmax && null !== e.zmax ? e.zmax : 1, + l = e.subdivisions || { + w: 1, + h: 1, + }, + h = e.precision || { + w: 1, + h: 1, + }, + f = new Array(), + d = new Array(), + p = new Array(), + m = new Array(); + (l.h = l.h < 1 ? 1 : l.h), + (l.w = l.w < 1 ? 1 : l.w), + (h.w = h.w < 1 ? 1 : h.w), + (h.h = h.h < 1 ? 1 : h.h); + var g = (c - o) / l.w, + _ = (u - s) / l.h; + function v(e, n, r, o) { + var s = d.length / 3, + c = h.w + 1; + for (t = 0; t < h.h; t++) + for (i = 0; i < h.w; i++) { + var u = [ + s + i + t * c, + s + (i + 1) + t * c, + s + (i + 1) + (t + 1) * c, + s + i + (t + 1) * c, + ]; + f.push(u[1]), + f.push(u[2]), + f.push(u[3]), + f.push(u[0]), + f.push(u[1]), + f.push(u[3]); + } + var l = a.x.Zero(), + g = new a.x(0, 1, 0); + for (t = 0; t <= h.h; t++) + for (l.z = (t * (o - n)) / h.h + n, i = 0; i <= h.w; i++) + (l.x = (i * (r - e)) / h.w + e), + (l.y = 0), + d.push(l.x, l.y, l.z), + p.push(g.x, g.y, g.z), + m.push(i / h.w, t / h.h); + } + for (n = 0; n < l.h; n++) + for (r = 0; r < l.w; r++) + v(o + r * g, s + n * _, o + (r + 1) * g, s + (n + 1) * _); + var y = new xi.a(); + return ( + (y.indices = f), + (y.positions = d), + (y.normals = p), + (y.uvs = m), y - } - , - xi.a.CreateGroundFromHeightMap = function(e) { - var t, i, n = [], r = [], o = [], s = [], c = e.colorFilter || new a.e(.3,.59,.11), u = e.alphaFilter || 0, l = false; - if (e.minHeight > e.maxHeight) { - l = true; - var h = e.maxHeight; - e.maxHeight = e.minHeight, - e.minHeight = h + ); + }), + (xi.a.CreateGroundFromHeightMap = function (e) { + var t, + i, + n = [], + r = [], + o = [], + s = [], + c = e.colorFilter || new a.e(0.3, 0.59, 0.11), + u = e.alphaFilter || 0, + l = false; + if (e.minHeight > e.maxHeight) { + l = true; + var h = e.maxHeight; + (e.maxHeight = e.minHeight), (e.minHeight = h); + } + for (t = 0; t <= e.subdivisions; t++) + for (i = 0; i <= e.subdivisions; i++) { + var f = new a.x( + (i * e.width) / e.subdivisions - e.width / 2, + 0, + ((e.subdivisions - t) * e.height) / e.subdivisions - + e.height / 2 + ), + d = + 4 * + (((((f.x + e.width / 2) / e.width) * + (e.bufferWidth - 1)) | + 0) + + (((1 - (f.z + e.height / 2) / e.height) * + (e.bufferHeight - 1)) | + 0) * + e.bufferWidth), + p = e.buffer[d] / 255, + m = e.buffer[d + 1] / 255, + g = e.buffer[d + 2] / 255, + _ = e.buffer[d + 3] / 255; + l && ((p = 1 - p), (m = 1 - m), (g = 1 - g)); + var v = p * c.r + m * c.g + g * c.b; + (f.y = + _ >= u + ? e.minHeight + (e.maxHeight - e.minHeight) * v + : e.minHeight - a.h), + r.push(f.x, f.y, f.z), + o.push(0, 0, 0), + s.push(i / e.subdivisions, 1 - t / e.subdivisions); } - for (t = 0; t <= e.subdivisions; t++) - for (i = 0; i <= e.subdivisions; i++) { - var f = new a.x(i * e.width / e.subdivisions - e.width / 2,0,(e.subdivisions - t) * e.height / e.subdivisions - e.height / 2) - , d = 4 * (((f.x + e.width / 2) / e.width * (e.bufferWidth - 1) | 0) + ((1 - (f.z + e.height / 2) / e.height) * (e.bufferHeight - 1) | 0) * e.bufferWidth) - , p = e.buffer[d] / 255 - , m = e.buffer[d + 1] / 255 - , g = e.buffer[d + 2] / 255 - , _ = e.buffer[d + 3] / 255; - l && (p = 1 - p, - m = 1 - m, - g = 1 - g); - var v = p * c.r + m * c.g + g * c.b; - f.y = _ >= u ? e.minHeight + (e.maxHeight - e.minHeight) * v : e.minHeight - a.h, - r.push(f.x, f.y, f.z), - o.push(0, 0, 0), - s.push(i / e.subdivisions, 1 - t / e.subdivisions) - } - for (t = 0; t < e.subdivisions; t++) - for (i = 0; i < e.subdivisions; i++) { - var y = i + 1 + (t + 1) * (e.subdivisions + 1) - , b = i + 1 + t * (e.subdivisions + 1) - , E = i + t * (e.subdivisions + 1) - , T = i + (t + 1) * (e.subdivisions + 1) - , A = r[3 * y + 1] >= e.minHeight - , x = r[3 * b + 1] >= e.minHeight - , S = r[3 * E + 1] >= e.minHeight; - A && x && S && (n.push(y), - n.push(b), - n.push(E)), - r[3 * T + 1] >= e.minHeight && A && S && (n.push(T), - n.push(y), - n.push(E)) - } - xi.a.ComputeNormals(r, n, o); - var C = new xi.a; - return C.indices = n, - C.positions = r, - C.normals = o, - C.uvs = s, + for (t = 0; t < e.subdivisions; t++) + for (i = 0; i < e.subdivisions; i++) { + var y = i + 1 + (t + 1) * (e.subdivisions + 1), + b = i + 1 + t * (e.subdivisions + 1), + E = i + t * (e.subdivisions + 1), + T = i + (t + 1) * (e.subdivisions + 1), + A = r[3 * y + 1] >= e.minHeight, + x = r[3 * b + 1] >= e.minHeight, + S = r[3 * E + 1] >= e.minHeight; + A && x && S && (n.push(y), n.push(b), n.push(E)), + r[3 * T + 1] >= e.minHeight && + A && + S && + (n.push(T), n.push(y), n.push(E)); + } + xi.a.ComputeNormals(r, n, o); + var C = new xi.a(); + return ( + (C.indices = n), + (C.positions = r), + (C.normals = o), + (C.uvs = s), C - } - , - me.a.CreateGround = function(e, t, i, n, r, o) { - var a = { - width: t, - height: i, - subdivisions: n, - updatable: o - }; - return Pi.CreateGround(e, a, r) - } - , - me.a.CreateTiledGround = function(e, t, i, n, r, o, a, s, c) { - var u = { - xmin: t, - zmin: i, - xmax: n, - zmax: r, - subdivisions: o, - precision: a, - updatable: c - }; - return Pi.CreateTiledGround(e, u, s) - } - , - me.a.CreateGroundFromHeightMap = function(e, t, i, n, r, o, a, s, c, u, l) { - var h = { - width: i, - height: n, - subdivisions: r, - minHeight: o, - maxHeight: a, - updatable: c, - onReady: u, - alphaFilter: l - }; - return Pi.CreateGroundFromHeightMap(e, t, h, s) - } - ; - var Pi = function() { - function e() {} - return e.CreateGround = function(e, t, i) { - var n = new Ci(e,i); - return n._setReady(false), - n._subdivisionsX = t.subdivisionsX || t.subdivisions || 1, - n._subdivisionsY = t.subdivisionsY || t.subdivisions || 1, - n._width = t.width || 1, - n._height = t.height || 1, - n._maxX = n._width / 2, - n._maxZ = n._height / 2, - n._minX = -n._maxX, - n._minZ = -n._maxZ, - xi.a.CreateGround(t).applyToMesh(n, t.updatable), - n._setReady(true), - n - } - , - e.CreateTiledGround = function(e, t, i) { - void 0 === i && (i = null); - var n = new me.a(e,i); - return xi.a.CreateTiledGround(t).applyToMesh(n, t.updatable), - n - } - , - e.CreateGroundFromHeightMap = function(e, t, i, n) { - void 0 === n && (n = null); - var r = i.width || 10 - , o = i.height || 10 - , s = i.subdivisions || 1 - , c = i.minHeight || 0 - , u = i.maxHeight || 1 - , l = i.colorFilter || new a.e(.3,.59,.11) - , h = i.alphaFilter || 0 - , f = i.updatable - , d = i.onReady; - n = n || R.a.LastCreatedScene; - var p = new Ci(e,n); - return p._subdivisionsX = s, - p._subdivisionsY = s, - p._width = r, - p._height = o, - p._maxX = p._width / 2, - p._maxZ = p._height / 2, - p._minX = -p._maxX, - p._minZ = -p._maxZ, - p._setReady(false), - Ee.h.LoadImage(t, function(e) { - var t = document.createElement("canvas") - , i = t.getContext("2d"); - if (!i) - throw new Error("Unable to get 2d context for CreateGroundFromHeightMap"); - if (!n.isDisposed) { - var a = e.width - , m = e.height; - t.width = a, - t.height = m, - i.drawImage(e, 0, 0); - var g = i.getImageData(0, 0, a, m).data; - xi.a.CreateGroundFromHeightMap({ - width: r, - height: o, - subdivisions: s, - minHeight: c, - maxHeight: u, - colorFilter: l, - buffer: g, - bufferWidth: a, - bufferHeight: m, - alphaFilter: h - }).applyToMesh(p, f), - d && d(p), - p._setReady(true) - } - }, function() {}, n.offlineProvider), - p - } - , - e - }(); - xi.a.CreateTorus = function(e) { - for (var t = [], i = [], n = [], r = [], o = e.diameter || 1, s = e.thickness || .5, c = e.tessellation || 16, u = 0 === e.sideOrientation ? 0 : e.sideOrientation || xi.a.DEFAULTSIDE, l = c + 1, h = 0; h <= c; h++) - for (var f = h / c, d = h * Math.PI * 2 / c - Math.PI / 2, p = a.j.Translation(o / 2, 0, 0).multiply(a.j.RotationY(d)), m = 0; m <= c; m++) { - var g = 1 - m / c - , _ = m * Math.PI * 2 / c + Math.PI - , v = Math.cos(_) - , y = Math.sin(_) - , b = new a.x(v,y,0) - , E = b.scale(s / 2) - , T = new a.w(f,g); - E = a.x.TransformCoordinates(E, p), - b = a.x.TransformNormal(b, p), - i.push(E.x, E.y, E.z), - n.push(b.x, b.y, b.z), - r.push(T.x, T.y); - var A = (h + 1) % l - , x = (m + 1) % l; - t.push(h * l + m), - t.push(h * l + x), - t.push(A * l + m), - t.push(h * l + x), - t.push(A * l + x), - t.push(A * l + m) - } - xi.a._ComputeSides(u, i, t, n, r, e.frontUVs, e.backUVs); - var S = new xi.a; - return S.indices = t, - S.positions = i, - S.normals = n, - S.uvs = r, - S - } - , - me.a.CreateTorus = function(e, t, i, n, r, o, a) { - var s = { - diameter: t, - thickness: i, - tessellation: n, - sideOrientation: a, - updatable: o - }; - return Mi.CreateTorus(e, s, r) - } - ; - var Ri, Mi = function() { - function e() {} - return e.CreateTorus = function(e, t, i) { - var n = new me.a(e,i); - return t.sideOrientation = me.a._GetDefaultSideOrientation(t.sideOrientation), - n._originalBuilderSideOrientation = t.sideOrientation, + ); + }), + (me.a.CreateGround = function (e, t, i, n, r, o) { + var a = { + width: t, + height: i, + subdivisions: n, + updatable: o, + }; + return Pi.CreateGround(e, a, r); + }), + (me.a.CreateTiledGround = function (e, t, i, n, r, o, a, s, c) { + var u = { + xmin: t, + zmin: i, + xmax: n, + zmax: r, + subdivisions: o, + precision: a, + updatable: c, + }; + return Pi.CreateTiledGround(e, u, s); + }), + (me.a.CreateGroundFromHeightMap = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u, + l + ) { + var h = { + width: i, + height: n, + subdivisions: r, + minHeight: o, + maxHeight: a, + updatable: c, + onReady: u, + alphaFilter: l, + }; + return Pi.CreateGroundFromHeightMap(e, t, h, s); + }); + var Pi = (function () { + function e() {} + return ( + (e.CreateGround = function (e, t, i) { + var n = new Ci(e, i); + return ( + n._setReady(false), + (n._subdivisionsX = + t.subdivisionsX || t.subdivisions || 1), + (n._subdivisionsY = + t.subdivisionsY || t.subdivisions || 1), + (n._width = t.width || 1), + (n._height = t.height || 1), + (n._maxX = n._width / 2), + (n._maxZ = n._height / 2), + (n._minX = -n._maxX), + (n._minZ = -n._maxZ), + xi.a.CreateGround(t).applyToMesh(n, t.updatable), + n._setReady(true), + n + ); + }), + (e.CreateTiledGround = function (e, t, i) { + void 0 === i && (i = null); + var n = new me.a(e, i); + return ( + xi.a.CreateTiledGround(t).applyToMesh(n, t.updatable), n + ); + }), + (e.CreateGroundFromHeightMap = function (e, t, i, n) { + void 0 === n && (n = null); + var r = i.width || 10, + o = i.height || 10, + s = i.subdivisions || 1, + c = i.minHeight || 0, + u = i.maxHeight || 1, + l = i.colorFilter || new a.e(0.3, 0.59, 0.11), + h = i.alphaFilter || 0, + f = i.updatable, + d = i.onReady; + n = n || R.a.LastCreatedScene; + var p = new Ci(e, n); + return ( + (p._subdivisionsX = s), + (p._subdivisionsY = s), + (p._width = r), + (p._height = o), + (p._maxX = p._width / 2), + (p._maxZ = p._height / 2), + (p._minX = -p._maxX), + (p._minZ = -p._maxZ), + p._setReady(false), + Ee.h.LoadImage( + t, + function (e) { + var t = document.createElement("canvas"), + i = t.getContext("2d"); + if (!i) + throw new Error( + "Unable to get 2d context for CreateGroundFromHeightMap" + ); + if (!n.isDisposed) { + var a = e.width, + m = e.height; + (t.width = a), (t.height = m), i.drawImage(e, 0, 0); + var g = i.getImageData(0, 0, a, m).data; + xi.a + .CreateGroundFromHeightMap({ + width: r, + height: o, + subdivisions: s, + minHeight: c, + maxHeight: u, + colorFilter: l, + buffer: g, + bufferWidth: a, + bufferHeight: m, + alphaFilter: h, + }) + .applyToMesh(p, f), + d && d(p), + p._setReady(true); + } + }, + function () {}, + n.offlineProvider + ), + p + ); + }), + e + ); + })(); + (xi.a.CreateTorus = function (e) { + for ( + var t = [], + i = [], + n = [], + r = [], + o = e.diameter || 1, + s = e.thickness || 0.5, + c = e.tessellation || 16, + u = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || xi.a.DEFAULTSIDE, + l = c + 1, + h = 0; + h <= c; + h++ + ) + for ( + var f = h / c, + d = (h * Math.PI * 2) / c - Math.PI / 2, + p = a.j + .Translation(o / 2, 0, 0) + .multiply(a.j.RotationY(d)), + m = 0; + m <= c; + m++ + ) { + var g = 1 - m / c, + _ = (m * Math.PI * 2) / c + Math.PI, + v = Math.cos(_), + y = Math.sin(_), + b = new a.x(v, y, 0), + E = b.scale(s / 2), + T = new a.w(f, g); + (E = a.x.TransformCoordinates(E, p)), + (b = a.x.TransformNormal(b, p)), + i.push(E.x, E.y, E.z), + n.push(b.x, b.y, b.z), + r.push(T.x, T.y); + var A = (h + 1) % l, + x = (m + 1) % l; + t.push(h * l + m), + t.push(h * l + x), + t.push(A * l + m), + t.push(h * l + x), + t.push(A * l + x), + t.push(A * l + m); + } + xi.a._ComputeSides(u, i, t, n, r, e.frontUVs, e.backUVs); + var S = new xi.a(); + return ( + (S.indices = t), + (S.positions = i), + (S.normals = n), + (S.uvs = r), + S + ); + }), + (me.a.CreateTorus = function (e, t, i, n, r, o, a) { + var s = { + diameter: t, + thickness: i, + tessellation: n, + sideOrientation: a, + updatable: o, + }; + return Mi.CreateTorus(e, s, r); + }); + var Ri, + Mi = (function () { + function e() {} + return ( + (e.CreateTorus = function (e, t, i) { + var n = new me.a(e, i); + return ( + (t.sideOrientation = me.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (n._originalBuilderSideOrientation = t.sideOrientation), xi.a.CreateTorus(t).applyToMesh(n, t.updatable), n - } - , + ); + }), e - }(), Oi = n(53), wi = function() { - function e(t, i) { - if (void 0 === i && (i = null), - this.scene = t, - this._pointerDownOnMeshAsked = false, - this._isActionableMesh = false, - this._teleportationRequestInitiated = false, - this._teleportationBackRequestInitiated = false, - this._rotationRightAsked = false, - this._rotationLeftAsked = false, - this._dpadPressed = true, - this._activePointer = false, - this._id = e._idCounter++, - i) - this._gazeTracker = i.clone("gazeTracker"); - else { - this._gazeTracker = me.a.CreateTorus("gazeTracker", .0035, .0025, 20, t, false), - this._gazeTracker.bakeCurrentTransformIntoVertices(), - this._gazeTracker.isPickable = false, - this._gazeTracker.isVisible = false; - var n = new bi.a("targetMat",t); - n.specularColor = a.e.Black(), - n.emissiveColor = new a.e(.7,.7,.7), - n.backFaceCulling = false, - this._gazeTracker.material = n - } + ); + })(), + Oi = n(53), + wi = (function () { + function e(t, i) { + if ( + (void 0 === i && (i = null), + (this.scene = t), + (this._pointerDownOnMeshAsked = false), + (this._isActionableMesh = false), + (this._teleportationRequestInitiated = false), + (this._teleportationBackRequestInitiated = false), + (this._rotationRightAsked = false), + (this._rotationLeftAsked = false), + (this._dpadPressed = true), + (this._activePointer = false), + (this._id = e._idCounter++), + i) + ) + this._gazeTracker = i.clone("gazeTracker"); + else { + (this._gazeTracker = me.a.CreateTorus( + "gazeTracker", + 0.0035, + 0.0025, + 20, + t, + false + )), + this._gazeTracker.bakeCurrentTransformIntoVertices(), + (this._gazeTracker.isPickable = false), + (this._gazeTracker.isVisible = false); + var n = new bi.a("targetMat", t); + (n.specularColor = a.e.Black()), + (n.emissiveColor = new a.e(0.7, 0.7, 0.7)), + (n.backFaceCulling = false), + (this._gazeTracker.material = n); } - return e.prototype._getForwardRay = function(e) { - return new Dt.a(a.x.Zero(),new a.x(0,0,e)) - } - , - e.prototype._selectionPointerDown = function() { - this._pointerDownOnMeshAsked = true, - this._currentHit && this.scene.simulatePointerDown(this._currentHit, { - pointerId: this._id - }) - } - , - e.prototype._selectionPointerUp = function() { - this._currentHit && this.scene.simulatePointerUp(this._currentHit, { - pointerId: this._id + } + return ( + (e.prototype._getForwardRay = function (e) { + return new Dt.a(a.x.Zero(), new a.x(0, 0, e)); + }), + (e.prototype._selectionPointerDown = function () { + (this._pointerDownOnMeshAsked = true), + this._currentHit && + this.scene.simulatePointerDown(this._currentHit, { + pointerId: this._id, + }); + }), + (e.prototype._selectionPointerUp = function () { + this._currentHit && + this.scene.simulatePointerUp(this._currentHit, { + pointerId: this._id, }), - this._pointerDownOnMeshAsked = false - } - , - e.prototype._activatePointer = function() { - this._activePointer = true - } - , - e.prototype._deactivatePointer = function() { - this._activePointer = false - } - , - e.prototype._updatePointerDistance = function(e) { - void 0 === e && (e = 100) - } - , - e.prototype.dispose = function() { - this._interactionsEnabled = false, - this._teleportationEnabled = false, - this._gazeTracker && this._gazeTracker.dispose() - } - , - e._idCounter = 0, + (this._pointerDownOnMeshAsked = false); + }), + (e.prototype._activatePointer = function () { + this._activePointer = true; + }), + (e.prototype._deactivatePointer = function () { + this._activePointer = false; + }), + (e.prototype._updatePointerDistance = function (e) { + void 0 === e && (e = 100); + }), + (e.prototype.dispose = function () { + (this._interactionsEnabled = false), + (this._teleportationEnabled = false), + this._gazeTracker && this._gazeTracker.dispose(); + }), + (e._idCounter = 0), e - }(), Ii = function(e) { - function t(t, i, n) { - var r = e.call(this, i, n) || this; - r.webVRController = t, - r._laserPointer = me.a.CreateCylinder("laserPointer", 1, .004, 2e-4, 20, 1, i, false); - var o = new bi.a("laserPointerMat",i); - if (o.emissiveColor = new a.e(.7,.7,.7), - o.alpha = .6, - r._laserPointer.material = o, - r._laserPointer.rotation.x = Math.PI / 2, - r._laserPointer.position.z = -.5, - r._laserPointer.isVisible = false, - r._laserPointer.isPickable = false, - !t.mesh) { - var s = new me.a("preloadControllerMesh",i) - , c = new me.a(Nt.POINTING_POSE,i); - c.rotation.x = -.7, - s.addChild(c), - t.attachToMesh(s) + ); + })(), + Ii = (function (e) { + function t(t, i, n) { + var r = e.call(this, i, n) || this; + (r.webVRController = t), + (r._laserPointer = me.a.CreateCylinder( + "laserPointer", + 1, + 0.004, + 2e-4, + 20, + 1, + i, + false + )); + var o = new bi.a("laserPointerMat", i); + if ( + ((o.emissiveColor = new a.e(0.7, 0.7, 0.7)), + (o.alpha = 0.6), + (r._laserPointer.material = o), + (r._laserPointer.rotation.x = Math.PI / 2), + (r._laserPointer.position.z = -0.5), + (r._laserPointer.isVisible = false), + (r._laserPointer.isPickable = false), + !t.mesh) + ) { + var s = new me.a("preloadControllerMesh", i), + c = new me.a(Nt.POINTING_POSE, i); + (c.rotation.x = -0.7), s.addChild(c), t.attachToMesh(s); + } + return ( + r._setLaserPointerParent(t.mesh), + (r._meshAttachedObserver = t._meshAttachedObservable.add( + function (e) { + r._setLaserPointerParent(e); } - return r._setLaserPointerParent(t.mesh), - r._meshAttachedObserver = t._meshAttachedObservable.add(function(e) { - r._setLaserPointerParent(e) - }), - r - } - return h.d(t, e), - t.prototype._getForwardRay = function(e) { - return this.webVRController.getForwardRay(e) - } - , - t.prototype._activatePointer = function() { - e.prototype._activatePointer.call(this), - this._laserPointer.isVisible = true - } - , - t.prototype._deactivatePointer = function() { - e.prototype._deactivatePointer.call(this), - this._laserPointer.isVisible = false - } - , - t.prototype._setLaserPointerColor = function(e) { - this._laserPointer.material.emissiveColor = e - } - , - t.prototype._setLaserPointerParent = function(e) { - !function e(t) { - t.isPickable = false, - t.getChildMeshes().forEach(function(t) { - e(t) - }) - }(e); - var t = e.getChildren(void 0, false) - , i = e; - this.webVRController._pointingPoseNode = null; - for (var n = 0; n < t.length; n++) - if (t[n].name && t[n].name.indexOf(Nt.POINTING_POSE) >= 0) { - i = t[n], - this.webVRController._pointingPoseNode = i; - break - } - this._laserPointer.parent = i - } - , - t.prototype._updatePointerDistance = function(e) { - void 0 === e && (e = 100), - this._laserPointer.scaling.y = e, - this._laserPointer.position.z = -e / 2 - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), + )), + r + ); + } + return ( + h.d(t, e), + (t.prototype._getForwardRay = function (e) { + return this.webVRController.getForwardRay(e); + }), + (t.prototype._activatePointer = function () { + e.prototype._activatePointer.call(this), + (this._laserPointer.isVisible = true); + }), + (t.prototype._deactivatePointer = function () { + e.prototype._deactivatePointer.call(this), + (this._laserPointer.isVisible = false); + }), + (t.prototype._setLaserPointerColor = function (e) { + this._laserPointer.material.emissiveColor = e; + }), + (t.prototype._setLaserPointerParent = function (e) { + !(function e(t) { + (t.isPickable = false), + t.getChildMeshes().forEach(function (t) { + e(t); + }); + })(e); + var t = e.getChildren(void 0, false), + i = e; + this.webVRController._pointingPoseNode = null; + for (var n = 0; n < t.length; n++) + if ( + t[n].name && + t[n].name.indexOf(Nt.POINTING_POSE) >= 0 + ) { + (i = t[n]), + (this.webVRController._pointingPoseNode = i); + break; + } + this._laserPointer.parent = i; + }), + (t.prototype._updatePointerDistance = function (e) { + void 0 === e && (e = 100), + (this._laserPointer.scaling.y = e), + (this._laserPointer.position.z = -e / 2); + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), this._laserPointer.dispose(), - this._meshAttachedObserver && this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver) - } - , + this._meshAttachedObserver && + this.webVRController._meshAttachedObservable.remove( + this._meshAttachedObserver + ); + }), t - }(wi), Di = function(e) { - function t(t, i) { - var n = e.call(this, i) || this; - return n.getCamera = t, - n - } - return h.d(t, e), - t.prototype._getForwardRay = function(e) { - var t = this.getCamera(); - return t ? t.getForwardRay(e) : new Dt.a(a.x.Zero(),a.x.Forward()) - } - , + ); + })(wi), + Di = (function (e) { + function t(t, i) { + var n = e.call(this, i) || this; + return (n.getCamera = t), n; + } + return ( + h.d(t, e), + (t.prototype._getForwardRay = function (e) { + var t = this.getCamera(); + return t + ? t.getForwardRay(e) + : new Dt.a(a.x.Zero(), a.x.Forward()); + }), t - }(wi), Li = function() {}, Fi = function() { - function e(e, t) { - var i = this; - if (void 0 === t && (t = {}), - this.webVROptions = t, - this._webVRsupported = false, - this._webVRready = false, - this._webVRrequesting = false, - this._webVRpresenting = false, - this._fullscreenVRpresenting = false, - this.onEnteringVRObservable = new o.c, - this.onAfterEnteringVRObservable = new o.c, - this.onExitingVRObservable = new o.c, - this.onControllerMeshLoadedObservable = new o.c, - this._useCustomVRButton = false, - this._teleportationRequested = false, - this._teleportActive = false, - this._floorMeshesCollection = [], - this._rotationAllowed = true, - this._teleportBackwardsVector = new a.x(0,-1,-1), - this._isDefaultTeleportationTarget = true, - this._teleportationFillColor = "#444444", - this._teleportationBorderColor = "#FFFFFF", - this._rotationAngle = 0, - this._haloCenter = new a.x(0,0,0), - this._padSensibilityUp = .65, - this._padSensibilityDown = .35, - this._leftController = null, - this._rightController = null, - this.onNewMeshSelected = new o.c, - this.onNewMeshPicked = new o.c, - this.onBeforeCameraTeleport = new o.c, - this.onAfterCameraTeleport = new o.c, - this.onSelectedMeshUnselected = new o.c, - this.teleportationEnabled = true, - this._teleportationInitialized = false, - this._interactionsEnabled = false, - this._interactionsRequested = false, - this._displayGaze = true, - this._displayLaserPointer = true, - this.updateGazeTrackerScale = true, - this.updateGazeTrackerColor = true, - this.requestPointerLockOnFullScreen = true, - this._onResize = function() { - i.moveButtonToBottomRight(), - i._fullscreenVRpresenting && i._webVRready && i.exitVR() + ); + })(wi), + Li = function () {}, + Fi = (function () { + function e(e, t) { + var i = this; + if ( + (void 0 === t && (t = {}), + (this.webVROptions = t), + (this._webVRsupported = false), + (this._webVRready = false), + (this._webVRrequesting = false), + (this._webVRpresenting = false), + (this._fullscreenVRpresenting = false), + (this.onEnteringVRObservable = new o.c()), + (this.onAfterEnteringVRObservable = new o.c()), + (this.onExitingVRObservable = new o.c()), + (this.onControllerMeshLoadedObservable = new o.c()), + (this._useCustomVRButton = false), + (this._teleportationRequested = false), + (this._teleportActive = false), + (this._floorMeshesCollection = []), + (this._rotationAllowed = true), + (this._teleportBackwardsVector = new a.x(0, -1, -1)), + (this._isDefaultTeleportationTarget = true), + (this._teleportationFillColor = "#444444"), + (this._teleportationBorderColor = "#FFFFFF"), + (this._rotationAngle = 0), + (this._haloCenter = new a.x(0, 0, 0)), + (this._padSensibilityUp = 0.65), + (this._padSensibilityDown = 0.35), + (this._leftController = null), + (this._rightController = null), + (this.onNewMeshSelected = new o.c()), + (this.onNewMeshPicked = new o.c()), + (this.onBeforeCameraTeleport = new o.c()), + (this.onAfterCameraTeleport = new o.c()), + (this.onSelectedMeshUnselected = new o.c()), + (this.teleportationEnabled = true), + (this._teleportationInitialized = false), + (this._interactionsEnabled = false), + (this._interactionsRequested = false), + (this._displayGaze = true), + (this._displayLaserPointer = true), + (this.updateGazeTrackerScale = true), + (this.updateGazeTrackerColor = true), + (this.requestPointerLockOnFullScreen = true), + (this._onResize = function () { + i.moveButtonToBottomRight(), + i._fullscreenVRpresenting && + i._webVRready && + i.exitVR(); + }), + (this._onFullscreenChange = function () { + var e = document; + void 0 !== e.fullscreen + ? (i._fullscreenVRpresenting = document.fullscreen) + : void 0 !== e.mozFullScreen + ? (i._fullscreenVRpresenting = e.mozFullScreen) + : void 0 !== e.webkitIsFullScreen + ? (i._fullscreenVRpresenting = e.webkitIsFullScreen) + : void 0 !== e.msIsFullScreen + ? (i._fullscreenVRpresenting = e.msIsFullScreen) + : void 0 !== document.msFullscreenElement && + (i._fullscreenVRpresenting = + document.msFullscreenElement), + !i._fullscreenVRpresenting && + i._canvas && + (i.exitVR(), + i._useCustomVRButton || + ((i._btnVR.style.top = + i._canvas.offsetTop + + i._canvas.offsetHeight - + 70 + + "px"), + (i._btnVR.style.left = + i._canvas.offsetLeft + + i._canvas.offsetWidth - + 100 + + "px"))); + }), + (this._cachedAngularSensibility = { + angularSensibilityX: null, + angularSensibilityY: null, + angularSensibility: null, + }), + (this.beforeRender = function () { + i._leftController && + i._leftController._activePointer && + i._castRayAndSelectObject(i._leftController), + i._rightController && + i._rightController._activePointer && + i._castRayAndSelectObject(i._rightController), + i._noControllerIsActive + ? i._castRayAndSelectObject(i._cameraGazer) + : (i._cameraGazer._gazeTracker.isVisible = false); + }), + (this._onNewGamepadConnected = function (e) { + if (e.type !== qe.POSE_ENABLED) + e.leftStick && + e.onleftstickchanged(function (e) { + i._teleportationInitialized && + i.teleportationEnabled && + ((!i._leftController && !i._rightController) || + (i._leftController && + !i._leftController._activePointer && + i._rightController && + !i._rightController._activePointer)) && + (i._checkTeleportWithRay(e, i._cameraGazer), + i._checkTeleportBackwards(e, i._cameraGazer)); + }), + e.rightStick && + e.onrightstickchanged(function (e) { + i._teleportationInitialized && + i._checkRotate(e, i._cameraGazer); + }), + e.type === qe.XBOX && + (e.onbuttondown(function (e) { + i._interactionsEnabled && + e === Lt.A && + i._cameraGazer._selectionPointerDown(); + }), + e.onbuttonup(function (e) { + i._interactionsEnabled && + e === Lt.A && + i._cameraGazer._selectionPointerUp(); + })); + else { + var t = e, + n = new Ii( + t, + i._scene, + i._cameraGazer._gazeTracker + ); + "right" === t.hand || + (i._leftController && + i._leftController.webVRController != t) + ? (i._rightController = n) + : (i._leftController = n), + i._tryEnableInteractionOnController(n); } - , - this._onFullscreenChange = function() { - var e = document; - void 0 !== e.fullscreen ? i._fullscreenVRpresenting = document.fullscreen : void 0 !== e.mozFullScreen ? i._fullscreenVRpresenting = e.mozFullScreen : void 0 !== e.webkitIsFullScreen ? i._fullscreenVRpresenting = e.webkitIsFullScreen : void 0 !== e.msIsFullScreen ? i._fullscreenVRpresenting = e.msIsFullScreen : void 0 !== document.msFullscreenElement && (i._fullscreenVRpresenting = document.msFullscreenElement), - !i._fullscreenVRpresenting && i._canvas && (i.exitVR(), - i._useCustomVRButton || (i._btnVR.style.top = i._canvas.offsetTop + i._canvas.offsetHeight - 70 + "px", - i._btnVR.style.left = i._canvas.offsetLeft + i._canvas.offsetWidth - 100 + "px")) - } - , - this._cachedAngularSensibility = { - angularSensibilityX: null, - angularSensibilityY: null, - angularSensibility: null - }, - this.beforeRender = function() { - i._leftController && i._leftController._activePointer && i._castRayAndSelectObject(i._leftController), - i._rightController && i._rightController._activePointer && i._castRayAndSelectObject(i._rightController), - i._noControllerIsActive ? i._castRayAndSelectObject(i._cameraGazer) : i._cameraGazer._gazeTracker.isVisible = false - } - , - this._onNewGamepadConnected = function(e) { - if (e.type !== qe.POSE_ENABLED) - e.leftStick && e.onleftstickchanged(function(e) { - i._teleportationInitialized && i.teleportationEnabled && (!i._leftController && !i._rightController || i._leftController && !i._leftController._activePointer && i._rightController && !i._rightController._activePointer) && (i._checkTeleportWithRay(e, i._cameraGazer), - i._checkTeleportBackwards(e, i._cameraGazer)) - }), - e.rightStick && e.onrightstickchanged(function(e) { - i._teleportationInitialized && i._checkRotate(e, i._cameraGazer) - }), - e.type === qe.XBOX && (e.onbuttondown(function(e) { - i._interactionsEnabled && e === Lt.A && i._cameraGazer._selectionPointerDown() - }), - e.onbuttonup(function(e) { - i._interactionsEnabled && e === Lt.A && i._cameraGazer._selectionPointerUp() - })); - else { - var t = e - , n = new Ii(t,i._scene,i._cameraGazer._gazeTracker); - "right" === t.hand || i._leftController && i._leftController.webVRController != t ? i._rightController = n : i._leftController = n, - i._tryEnableInteractionOnController(n) - } - } - , - this._tryEnableInteractionOnController = function(e) { - i._interactionsRequested && !e._interactionsEnabled && i._enableInteractionOnController(e), - i._teleportationRequested && !e._teleportationEnabled && i._enableTeleportationOnController(e) - } - , - this._onNewGamepadDisconnected = function(e) { - e instanceof vi && ("left" === e.hand && null != i._leftController && (i._leftController.dispose(), - i._leftController = null), - "right" === e.hand && null != i._rightController && (i._rightController.dispose(), - i._rightController = null)) - } - , - this._workingVector = a.x.Zero(), - this._workingQuaternion = a.q.Identity(), - this._workingMatrix = a.j.Identity(), - this._scene = e, - this._canvas = e.getEngine().getRenderingCanvas(), - void 0 === t.createFallbackVRDeviceOrientationFreeCamera && (t.createFallbackVRDeviceOrientationFreeCamera = true), - void 0 === t.createDeviceOrientationCamera && (t.createDeviceOrientationCamera = true), - void 0 === t.laserToggle && (t.laserToggle = true), - void 0 === t.defaultHeight && (t.defaultHeight = 1.7), - t.useCustomVRButton && (this._useCustomVRButton = true, + }), + (this._tryEnableInteractionOnController = function (e) { + i._interactionsRequested && + !e._interactionsEnabled && + i._enableInteractionOnController(e), + i._teleportationRequested && + !e._teleportationEnabled && + i._enableTeleportationOnController(e); + }), + (this._onNewGamepadDisconnected = function (e) { + e instanceof vi && + ("left" === e.hand && + null != i._leftController && + (i._leftController.dispose(), + (i._leftController = null)), + "right" === e.hand && + null != i._rightController && + (i._rightController.dispose(), + (i._rightController = null))); + }), + (this._workingVector = a.x.Zero()), + (this._workingQuaternion = a.q.Identity()), + (this._workingMatrix = a.j.Identity()), + (this._scene = e), + (this._canvas = e.getEngine().getRenderingCanvas()), + void 0 === + t.createFallbackVRDeviceOrientationFreeCamera && + (t.createFallbackVRDeviceOrientationFreeCamera = true), + void 0 === t.createDeviceOrientationCamera && + (t.createDeviceOrientationCamera = true), + void 0 === t.laserToggle && (t.laserToggle = true), + void 0 === t.defaultHeight && (t.defaultHeight = 1.7), + t.useCustomVRButton && + ((this._useCustomVRButton = true), t.customVRButton && (this._btnVR = t.customVRButton)), - t.rayLength && (this._rayLength = t.rayLength), - this._defaultHeight = t.defaultHeight, - t.positionScale && (this._rayLength *= t.positionScale, - this._defaultHeight *= t.positionScale), - this._hasEnteredVR = false, - this._scene.activeCamera ? this._position = this._scene.activeCamera.position.clone() : this._position = new a.x(0,this._defaultHeight,0), - t.createDeviceOrientationCamera || !this._scene.activeCamera) { - if (this._deviceOrientationCamera = new St("deviceOrientationVRHelper",this._position.clone(),e), - this._scene.activeCamera && (this._deviceOrientationCamera.minZ = this._scene.activeCamera.minZ, - this._deviceOrientationCamera.maxZ = this._scene.activeCamera.maxZ, - this._scene.activeCamera instanceof Et && this._scene.activeCamera.rotation)) { - var n = this._scene.activeCamera; - n.rotationQuaternion ? this._deviceOrientationCamera.rotationQuaternion.copyFrom(n.rotationQuaternion) : this._deviceOrientationCamera.rotationQuaternion.copyFrom(a.q.RotationYawPitchRoll(n.rotation.y, n.rotation.x, n.rotation.z)), - this._deviceOrientationCamera.rotation = n.rotation.clone() - } - this._scene.activeCamera = this._deviceOrientationCamera, - this._canvas && this._scene.activeCamera.attachControl(this._canvas) - } else - this._existingCamera = this._scene.activeCamera; - if (t.createFallbackVRDeviceOrientationFreeCamera && (t.useMultiview && (t.vrDeviceOrientationCameraMetrics || (t.vrDeviceOrientationCameraMetrics = oi.GetDefault()), - t.vrDeviceOrientationCameraMetrics.multiviewEnabled = true), - this._vrDeviceOrientationCamera = new pi("VRDeviceOrientationVRHelper",this._position,this._scene,true,t.vrDeviceOrientationCameraMetrics), - this._vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE), - this._webVRCamera = new _i("WebVRHelper",this._position,this._scene,t), - this._webVRCamera.useStandingMatrix(), - this._cameraGazer = new Di(function() { - return i.currentVRCamera - } - ,e), - !this._useCustomVRButton) { - this._btnVR = document.createElement("BUTTON"), - this._btnVR.className = "babylonVRicon", - this._btnVR.id = "babylonVRiconbtn", - this._btnVR.title = "Click to switch to VR"; - var r = document.createElement("style"); - r.appendChild(document.createTextNode(".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }.babylonVRicon.vrdisplaypresenting { display: none; }")), - document.getElementsByTagName("head")[0].appendChild(r), - this.moveButtonToBottomRight() - } - this._btnVR && this._btnVR.addEventListener("click", function() { - i.isInVRMode ? i.exitVR() : i.enterVR() - }), - window.addEventListener("resize", this._onResize), - document.addEventListener("fullscreenchange", this._onFullscreenChange, false), - document.addEventListener("mozfullscreenchange", this._onFullscreenChange, false), - document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, false), - document.addEventListener("msfullscreenchange", this._onFullscreenChange, false), - document.onmsfullscreenchange = this._onFullscreenChange, - t.createFallbackVRDeviceOrientationFreeCamera ? this.displayVRButton() : this._scene.getEngine().onVRDisplayChangedObservable.add(function(e) { - e.vrDisplay && i.displayVRButton() - }), - this._onKeyDown = function(e) { - 27 === e.keyCode && i.isInVRMode && i.exitVR() - } - , - document.addEventListener("keydown", this._onKeyDown), - this._scene.onPrePointerObservable.add(function() { - i.isInVRMode && (i.exitVR(), - i._fullscreenVRpresenting && i._scene.getEngine().exitFullscreen()) - }, Re.a.POINTERDOUBLETAP, false), - this._onVRDisplayChanged = function(e) { - return i.onVRDisplayChanged(e) - } - , - this._onVrDisplayPresentChange = function() { - return i.onVrDisplayPresentChange() - } - , - this._onVRRequestPresentStart = function() { - i._webVRrequesting = true, - i.updateButtonVisibility() - } - , - this._onVRRequestPresentComplete = function() { - i._webVRrequesting = false, - i.updateButtonVisibility() - } - , - e.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChanged), - e.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart), - e.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete), - window.addEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange), - e.onDisposeObservable.add(function() { - i.dispose() - }), - this._webVRCamera.onControllerMeshLoadedObservable.add(function(e) { - return i._onDefaultMeshLoaded(e) - }), - this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected), - this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected), - this.updateButtonVisibility(), - this._circleEase = new ie, - this._circleEase.setEasingMode(te.EASINGMODE_EASEINOUT), - this.webVROptions.floorMeshes && this.enableTeleportation({ - floorMeshes: this.webVROptions.floorMeshes - }) + t.rayLength && (this._rayLength = t.rayLength), + (this._defaultHeight = t.defaultHeight), + t.positionScale && + ((this._rayLength *= t.positionScale), + (this._defaultHeight *= t.positionScale)), + (this._hasEnteredVR = false), + this._scene.activeCamera + ? (this._position = + this._scene.activeCamera.position.clone()) + : (this._position = new a.x(0, this._defaultHeight, 0)), + t.createDeviceOrientationCamera || + !this._scene.activeCamera) + ) { + if ( + ((this._deviceOrientationCamera = new St( + "deviceOrientationVRHelper", + this._position.clone(), + e + )), + this._scene.activeCamera && + ((this._deviceOrientationCamera.minZ = + this._scene.activeCamera.minZ), + (this._deviceOrientationCamera.maxZ = + this._scene.activeCamera.maxZ), + this._scene.activeCamera instanceof Et && + this._scene.activeCamera.rotation)) + ) { + var n = this._scene.activeCamera; + n.rotationQuaternion + ? this._deviceOrientationCamera.rotationQuaternion.copyFrom( + n.rotationQuaternion + ) + : this._deviceOrientationCamera.rotationQuaternion.copyFrom( + a.q.RotationYawPitchRoll( + n.rotation.y, + n.rotation.x, + n.rotation.z + ) + ), + (this._deviceOrientationCamera.rotation = + n.rotation.clone()); + } + (this._scene.activeCamera = + this._deviceOrientationCamera), + this._canvas && + this._scene.activeCamera.attachControl(this._canvas); + } else this._existingCamera = this._scene.activeCamera; + if ( + (t.createFallbackVRDeviceOrientationFreeCamera && + (t.useMultiview && + (t.vrDeviceOrientationCameraMetrics || + (t.vrDeviceOrientationCameraMetrics = + oi.GetDefault()), + (t.vrDeviceOrientationCameraMetrics.multiviewEnabled = true)), + (this._vrDeviceOrientationCamera = new pi( + "VRDeviceOrientationVRHelper", + this._position, + this._scene, + true, + t.vrDeviceOrientationCameraMetrics + )), + (this._vrDeviceOrientationCamera.angularSensibility = + Number.MAX_VALUE)), + (this._webVRCamera = new _i( + "WebVRHelper", + this._position, + this._scene, + t + )), + this._webVRCamera.useStandingMatrix(), + (this._cameraGazer = new Di(function () { + return i.currentVRCamera; + }, e)), + !this._useCustomVRButton) + ) { + (this._btnVR = document.createElement("BUTTON")), + (this._btnVR.className = "babylonVRicon"), + (this._btnVR.id = "babylonVRiconbtn"), + (this._btnVR.title = "Click to switch to VR"); + var r = document.createElement("style"); + r.appendChild( + document.createTextNode( + ".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }.babylonVRicon.vrdisplaypresenting { display: none; }" + ) + ), + document.getElementsByTagName("head")[0].appendChild(r), + this.moveButtonToBottomRight(); } - return Object.defineProperty(e.prototype, "onEnteringVR", { - get: function() { - return this.onEnteringVRObservable + this._btnVR && + this._btnVR.addEventListener("click", function () { + i.isInVRMode ? i.exitVR() : i.enterVR(); + }), + window.addEventListener("resize", this._onResize), + document.addEventListener( + "fullscreenchange", + this._onFullscreenChange, + false + ), + document.addEventListener( + "mozfullscreenchange", + this._onFullscreenChange, + false + ), + document.addEventListener( + "webkitfullscreenchange", + this._onFullscreenChange, + false + ), + document.addEventListener( + "msfullscreenchange", + this._onFullscreenChange, + false + ), + (document.onmsfullscreenchange = + this._onFullscreenChange), + t.createFallbackVRDeviceOrientationFreeCamera + ? this.displayVRButton() + : this._scene + .getEngine() + .onVRDisplayChangedObservable.add(function (e) { + e.vrDisplay && i.displayVRButton(); + }), + (this._onKeyDown = function (e) { + 27 === e.keyCode && i.isInVRMode && i.exitVR(); + }), + document.addEventListener("keydown", this._onKeyDown), + this._scene.onPrePointerObservable.add( + function () { + i.isInVRMode && + (i.exitVR(), + i._fullscreenVRpresenting && + i._scene.getEngine().exitFullscreen()); }, - enumerable: true, - configurable: true + Re.a.POINTERDOUBLETAP, + false + ), + (this._onVRDisplayChanged = function (e) { + return i.onVRDisplayChanged(e); + }), + (this._onVrDisplayPresentChange = function () { + return i.onVrDisplayPresentChange(); + }), + (this._onVRRequestPresentStart = function () { + (i._webVRrequesting = true), i.updateButtonVisibility(); + }), + (this._onVRRequestPresentComplete = function () { + (i._webVRrequesting = false), + i.updateButtonVisibility(); + }), + e + .getEngine() + .onVRDisplayChangedObservable.add( + this._onVRDisplayChanged + ), + e + .getEngine() + .onVRRequestPresentStart.add( + this._onVRRequestPresentStart + ), + e + .getEngine() + .onVRRequestPresentComplete.add( + this._onVRRequestPresentComplete + ), + window.addEventListener( + "vrdisplaypresentchange", + this._onVrDisplayPresentChange + ), + e.onDisposeObservable.add(function () { + i.dispose(); + }), + this._webVRCamera.onControllerMeshLoadedObservable.add( + function (e) { + return i._onDefaultMeshLoaded(e); + } + ), + this._scene.gamepadManager.onGamepadConnectedObservable.add( + this._onNewGamepadConnected + ), + this._scene.gamepadManager.onGamepadDisconnectedObservable.add( + this._onNewGamepadDisconnected + ), + this.updateButtonVisibility(), + (this._circleEase = new ie()), + this._circleEase.setEasingMode(te.EASINGMODE_EASEINOUT), + this.webVROptions.floorMeshes && + this.enableTeleportation({ + floorMeshes: this.webVROptions.floorMeshes, + }); + } + return ( + Object.defineProperty(e.prototype, "onEnteringVR", { + get: function () { + return this.onEnteringVRObservable; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "onExitingVR", { - get: function() { - return this.onExitingVRObservable + get: function () { + return this.onExitingVRObservable; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "onControllerMeshLoaded", + { + get: function () { + return this.onControllerMeshLoadedObservable; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "onControllerMeshLoaded", { - get: function() { - return this.onControllerMeshLoadedObservable - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "teleportationTarget", { - get: function() { - return this._teleportationTarget - }, - set: function(e) { - e && (e.name = "teleportationTarget", - this._isDefaultTeleportationTarget = false, - this._teleportationTarget = e) - }, - enumerable: true, - configurable: true + get: function () { + return this._teleportationTarget; + }, + set: function (e) { + e && + ((e.name = "teleportationTarget"), + (this._isDefaultTeleportationTarget = false), + (this._teleportationTarget = e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "gazeTrackerMesh", { - get: function() { - return this._cameraGazer._gazeTracker - }, - set: function(e) { - e && (this._cameraGazer._gazeTracker && this._cameraGazer._gazeTracker.dispose(), - this._leftController && this._leftController._gazeTracker && this._leftController._gazeTracker.dispose(), - this._rightController && this._rightController._gazeTracker && this._rightController._gazeTracker.dispose(), - this._cameraGazer._gazeTracker = e, - this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(), - this._cameraGazer._gazeTracker.isPickable = false, - this._cameraGazer._gazeTracker.isVisible = false, - this._cameraGazer._gazeTracker.name = "gazeTracker", - this._leftController && (this._leftController._gazeTracker = this._cameraGazer._gazeTracker.clone("gazeTracker")), - this._rightController && (this._rightController._gazeTracker = this._cameraGazer._gazeTracker.clone("gazeTracker"))) + get: function () { + return this._cameraGazer._gazeTracker; + }, + set: function (e) { + e && + (this._cameraGazer._gazeTracker && + this._cameraGazer._gazeTracker.dispose(), + this._leftController && + this._leftController._gazeTracker && + this._leftController._gazeTracker.dispose(), + this._rightController && + this._rightController._gazeTracker && + this._rightController._gazeTracker.dispose(), + (this._cameraGazer._gazeTracker = e), + this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(), + (this._cameraGazer._gazeTracker.isPickable = false), + (this._cameraGazer._gazeTracker.isVisible = false), + (this._cameraGazer._gazeTracker.name = "gazeTracker"), + this._leftController && + (this._leftController._gazeTracker = + this._cameraGazer._gazeTracker.clone( + "gazeTracker" + )), + this._rightController && + (this._rightController._gazeTracker = + this._cameraGazer._gazeTracker.clone( + "gazeTracker" + ))); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "leftControllerGazeTrackerMesh", + { + get: function () { + return this._leftController + ? this._leftController._gazeTracker + : null; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "leftControllerGazeTrackerMesh", { - get: function() { - return this._leftController ? this._leftController._gazeTracker : null + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "rightControllerGazeTrackerMesh", + { + get: function () { + return this._rightController + ? this._rightController._gazeTracker + : null; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "rightControllerGazeTrackerMesh", { - get: function() { - return this._rightController ? this._rightController._gazeTracker : null - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "displayGaze", { - get: function() { - return this._displayGaze - }, - set: function(e) { - this._displayGaze = e, - e || (this._cameraGazer._gazeTracker.isVisible = false, - this._leftController && (this._leftController._gazeTracker.isVisible = false), - this._rightController && (this._rightController._gazeTracker.isVisible = false)) - }, - enumerable: true, - configurable: true + get: function () { + return this._displayGaze; + }, + set: function (e) { + (this._displayGaze = e), + e || + ((this._cameraGazer._gazeTracker.isVisible = false), + this._leftController && + (this._leftController._gazeTracker.isVisible = false), + this._rightController && + (this._rightController._gazeTracker.isVisible = false)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "displayLaserPointer", { - get: function() { - return this._displayLaserPointer - }, - set: function(e) { - this._displayLaserPointer = e, - e ? (this._rightController && this._rightController._activatePointer(), - this._leftController && this._leftController._activatePointer()) : (this._rightController && (this._rightController._deactivatePointer(), - this._rightController._gazeTracker.isVisible = false), - this._leftController && (this._leftController._deactivatePointer(), - this._leftController._gazeTracker.isVisible = false)) + get: function () { + return this._displayLaserPointer; + }, + set: function (e) { + (this._displayLaserPointer = e), + e + ? (this._rightController && + this._rightController._activatePointer(), + this._leftController && + this._leftController._activatePointer()) + : (this._rightController && + (this._rightController._deactivatePointer(), + (this._rightController._gazeTracker.isVisible = false)), + this._leftController && + (this._leftController._deactivatePointer(), + (this._leftController._gazeTracker.isVisible = false))); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "deviceOrientationCamera", + { + get: function () { + return this._deviceOrientationCamera; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "deviceOrientationCamera", { - get: function() { - return this._deviceOrientationCamera - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "currentVRCamera", { - get: function() { - return this._webVRready ? this._webVRCamera : this._scene.activeCamera - }, - enumerable: true, - configurable: true + get: function () { + return this._webVRready + ? this._webVRCamera + : this._scene.activeCamera; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "webVRCamera", { - get: function() { - return this._webVRCamera + get: function () { + return this._webVRCamera; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "vrDeviceOrientationCamera", + { + get: function () { + return this._vrDeviceOrientationCamera; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "vrDeviceOrientationCamera", { - get: function() { - return this._vrDeviceOrientationCamera + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "_teleportationRequestInitiated", + { + get: function () { + return ( + this._cameraGazer._teleportationRequestInitiated || + (null !== this._leftController && + this._leftController + ._teleportationRequestInitiated) || + (null !== this._rightController && + this._rightController + ._teleportationRequestInitiated) + ); }, enumerable: true, - configurable: true + configurable: true, + } + ), + (e.prototype._onDefaultMeshLoaded = function (e) { + this._leftController && + this._leftController.webVRController == e && + e.mesh && + this._leftController._setLaserPointerParent(e.mesh), + this._rightController && + this._rightController.webVRController == e && + e.mesh && + this._rightController._setLaserPointerParent(e.mesh); + try { + this.onControllerMeshLoadedObservable.notifyObservers( + e + ); + } catch (e) { + g.a.Warn( + "Error in your custom logic onControllerMeshLoaded: " + + e + ); + } }), - Object.defineProperty(e.prototype, "_teleportationRequestInitiated", { - get: function() { - return this._cameraGazer._teleportationRequestInitiated || null !== this._leftController && this._leftController._teleportationRequestInitiated || null !== this._rightController && this._rightController._teleportationRequestInitiated - }, - enumerable: true, - configurable: true - }), - e.prototype._onDefaultMeshLoaded = function(e) { - this._leftController && this._leftController.webVRController == e && e.mesh && this._leftController._setLaserPointerParent(e.mesh), - this._rightController && this._rightController.webVRController == e && e.mesh && this._rightController._setLaserPointerParent(e.mesh); - try { - this.onControllerMeshLoadedObservable.notifyObservers(e) - } catch (e) { - g.a.Warn("Error in your custom logic onControllerMeshLoaded: " + e) - } - } - , Object.defineProperty(e.prototype, "isInVRMode", { - get: function() { - return this._webVRpresenting || this._fullscreenVRpresenting - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._webVRpresenting || this._fullscreenVRpresenting + ); + }, + enumerable: true, + configurable: true, }), - e.prototype.onVrDisplayPresentChange = function() { - var e = this._scene.getEngine().getVRDevice(); - if (e) { - var t = this._webVRpresenting; - this._webVRpresenting = e.isPresenting, - t && !this._webVRpresenting && this.exitVR() - } else - g.a.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?"); - this.updateButtonVisibility() - } - , - e.prototype.onVRDisplayChanged = function(e) { - this._webVRsupported = e.vrSupported, - this._webVRready = !!e.vrDisplay, - this._webVRpresenting = e.vrDisplay && e.vrDisplay.isPresenting, - this.updateButtonVisibility() - } - , - e.prototype.moveButtonToBottomRight = function() { - this._canvas && !this._useCustomVRButton && (this._btnVR.style.top = this._canvas.offsetTop + this._canvas.offsetHeight - 70 + "px", - this._btnVR.style.left = this._canvas.offsetLeft + this._canvas.offsetWidth - 100 + "px") - } - , - e.prototype.displayVRButton = function() { - this._useCustomVRButton || this._btnVRDisplayed || (document.body.appendChild(this._btnVR), - this._btnVRDisplayed = true) - } - , - e.prototype.updateButtonVisibility = function() { - this._btnVR && !this._useCustomVRButton && (this._btnVR.className = "babylonVRicon", - this.isInVRMode ? this._btnVR.className += " vrdisplaypresenting" : (this._webVRready && (this._btnVR.className += " vrdisplayready"), - this._webVRsupported && (this._btnVR.className += " vrdisplaysupported"), - this._webVRrequesting && (this._btnVR.className += " vrdisplayrequesting"))) - } - , - e.prototype.enterVR = function() { - var e = this; - if (this.onEnteringVRObservable) - try { - this.onEnteringVRObservable.notifyObservers(this) - } catch (e) { - g.a.Warn("Error in your custom logic onEnteringVR: " + e) - } - if (this._scene.activeCamera) { - if (this._position = this._scene.activeCamera.position.clone(), - this.vrDeviceOrientationCamera && (this.vrDeviceOrientationCamera.rotation = a.q.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(), - this.vrDeviceOrientationCamera.angularSensibility = 2e3), - this.webVRCamera) { - var t = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y - , i = a.q.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y - t - , n = this.webVRCamera.rotationQuaternion.toEulerAngles().y; - this.webVRCamera.rotationQuaternion = a.q.FromEulerAngles(0, n + i, 0) - } - this._existingCamera = this._scene.activeCamera, - this._existingCamera.angularSensibilityX && (this._cachedAngularSensibility.angularSensibilityX = this._existingCamera.angularSensibilityX, - this._existingCamera.angularSensibilityX = Number.MAX_VALUE), - this._existingCamera.angularSensibilityY && (this._cachedAngularSensibility.angularSensibilityY = this._existingCamera.angularSensibilityY, - this._existingCamera.angularSensibilityY = Number.MAX_VALUE), - this._existingCamera.angularSensibility && (this._cachedAngularSensibility.angularSensibility = this._existingCamera.angularSensibility, - this._existingCamera.angularSensibility = Number.MAX_VALUE) + (e.prototype.onVrDisplayPresentChange = function () { + var e = this._scene.getEngine().getVRDevice(); + if (e) { + var t = this._webVRpresenting; + (this._webVRpresenting = e.isPresenting), + t && !this._webVRpresenting && this.exitVR(); + } else + g.a.Warn( + "Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?" + ); + this.updateButtonVisibility(); + }), + (e.prototype.onVRDisplayChanged = function (e) { + (this._webVRsupported = e.vrSupported), + (this._webVRready = !!e.vrDisplay), + (this._webVRpresenting = + e.vrDisplay && e.vrDisplay.isPresenting), + this.updateButtonVisibility(); + }), + (e.prototype.moveButtonToBottomRight = function () { + this._canvas && + !this._useCustomVRButton && + ((this._btnVR.style.top = + this._canvas.offsetTop + + this._canvas.offsetHeight - + 70 + + "px"), + (this._btnVR.style.left = + this._canvas.offsetLeft + + this._canvas.offsetWidth - + 100 + + "px")); + }), + (e.prototype.displayVRButton = function () { + this._useCustomVRButton || + this._btnVRDisplayed || + (document.body.appendChild(this._btnVR), + (this._btnVRDisplayed = true)); + }), + (e.prototype.updateButtonVisibility = function () { + this._btnVR && + !this._useCustomVRButton && + ((this._btnVR.className = "babylonVRicon"), + this.isInVRMode + ? (this._btnVR.className += " vrdisplaypresenting") + : (this._webVRready && + (this._btnVR.className += " vrdisplayready"), + this._webVRsupported && + (this._btnVR.className += " vrdisplaysupported"), + this._webVRrequesting && + (this._btnVR.className += + " vrdisplayrequesting"))); + }), + (e.prototype.enterVR = function () { + var e = this; + if (this.onEnteringVRObservable) + try { + this.onEnteringVRObservable.notifyObservers(this); + } catch (e) { + g.a.Warn( + "Error in your custom logic onEnteringVR: " + e + ); } - this._webVRrequesting || (this._webVRready ? this._webVRpresenting || (this._scene.getEngine().onVRRequestPresentComplete.addOnce(function(t) { - e.onAfterEnteringVRObservable.notifyObservers({ - success: t - }) - }), - this._webVRCamera.position = this._position, - this._scene.activeCamera = this._webVRCamera) : this._vrDeviceOrientationCamera && (this._vrDeviceOrientationCamera.position = this._position, - this._scene.activeCamera && (this._vrDeviceOrientationCamera.minZ = this._scene.activeCamera.minZ), - this._scene.activeCamera = this._vrDeviceOrientationCamera, - this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen), - this.updateButtonVisibility(), - this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce(function() { - e.onAfterEnteringVRObservable.notifyObservers({ - success: true - }) - })), - this._scene.activeCamera && this._canvas && this._scene.activeCamera.attachControl(this._canvas), - this._interactionsEnabled && this._scene.registerBeforeRender(this.beforeRender), - this._displayLaserPointer && [this._leftController, this._rightController].forEach(function(e) { - e && e._activatePointer() - }), - this._hasEnteredVR = true) - } - , - e.prototype.exitVR = function() { - if (this._hasEnteredVR) { - if (this.onExitingVRObservable) - try { - this.onExitingVRObservable.notifyObservers(this) - } catch (e) { - g.a.Warn("Error in your custom logic onExitingVR: " + e) - } - this._webVRpresenting && this._scene.getEngine().disableVR(), - this._scene.activeCamera && (this._position = this._scene.activeCamera.position.clone()), - this.vrDeviceOrientationCamera && (this.vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE), - this._deviceOrientationCamera ? (this._deviceOrientationCamera.position = this._position, - this._scene.activeCamera = this._deviceOrientationCamera, - this._canvas && this._scene.activeCamera.attachControl(this._canvas), - this._cachedAngularSensibility.angularSensibilityX && (this._deviceOrientationCamera.angularSensibilityX = this._cachedAngularSensibility.angularSensibilityX, - this._cachedAngularSensibility.angularSensibilityX = null), - this._cachedAngularSensibility.angularSensibilityY && (this._deviceOrientationCamera.angularSensibilityY = this._cachedAngularSensibility.angularSensibilityY, - this._cachedAngularSensibility.angularSensibilityY = null), - this._cachedAngularSensibility.angularSensibility && (this._deviceOrientationCamera.angularSensibility = this._cachedAngularSensibility.angularSensibility, - this._cachedAngularSensibility.angularSensibility = null)) : this._existingCamera && (this._existingCamera.position = this._position, - this._scene.activeCamera = this._existingCamera, - this._cachedAngularSensibility.angularSensibilityX && (this._existingCamera.angularSensibilityX = this._cachedAngularSensibility.angularSensibilityX, - this._cachedAngularSensibility.angularSensibilityX = null), - this._cachedAngularSensibility.angularSensibilityY && (this._existingCamera.angularSensibilityY = this._cachedAngularSensibility.angularSensibilityY, - this._cachedAngularSensibility.angularSensibilityY = null), - this._cachedAngularSensibility.angularSensibility && (this._existingCamera.angularSensibility = this._cachedAngularSensibility.angularSensibility, - this._cachedAngularSensibility.angularSensibility = null)), + if (this._scene.activeCamera) { + if ( + ((this._position = + this._scene.activeCamera.position.clone()), + this.vrDeviceOrientationCamera && + ((this.vrDeviceOrientationCamera.rotation = a.q + .FromRotationMatrix( + this._scene.activeCamera + .getWorldMatrix() + .getRotationMatrix() + ) + .toEulerAngles()), + (this.vrDeviceOrientationCamera.angularSensibility = 2e3)), + this.webVRCamera) + ) { + var t = + this.webVRCamera.deviceRotationQuaternion.toEulerAngles() + .y, + i = + a.q + .FromRotationMatrix( + this._scene.activeCamera + .getWorldMatrix() + .getRotationMatrix() + ) + .toEulerAngles().y - t, + n = + this.webVRCamera.rotationQuaternion.toEulerAngles() + .y; + this.webVRCamera.rotationQuaternion = + a.q.FromEulerAngles(0, n + i, 0); + } + (this._existingCamera = this._scene.activeCamera), + this._existingCamera.angularSensibilityX && + ((this._cachedAngularSensibility.angularSensibilityX = + this._existingCamera.angularSensibilityX), + (this._existingCamera.angularSensibilityX = + Number.MAX_VALUE)), + this._existingCamera.angularSensibilityY && + ((this._cachedAngularSensibility.angularSensibilityY = + this._existingCamera.angularSensibilityY), + (this._existingCamera.angularSensibilityY = + Number.MAX_VALUE)), + this._existingCamera.angularSensibility && + ((this._cachedAngularSensibility.angularSensibility = + this._existingCamera.angularSensibility), + (this._existingCamera.angularSensibility = + Number.MAX_VALUE)); + } + this._webVRrequesting || + (this._webVRready + ? this._webVRpresenting || + (this._scene + .getEngine() + .onVRRequestPresentComplete.addOnce(function (t) { + e.onAfterEnteringVRObservable.notifyObservers({ + success: t, + }); + }), + (this._webVRCamera.position = this._position), + (this._scene.activeCamera = this._webVRCamera)) + : this._vrDeviceOrientationCamera && + ((this._vrDeviceOrientationCamera.position = + this._position), + this._scene.activeCamera && + (this._vrDeviceOrientationCamera.minZ = + this._scene.activeCamera.minZ), + (this._scene.activeCamera = + this._vrDeviceOrientationCamera), + this._scene + .getEngine() + .enterFullscreen( + this.requestPointerLockOnFullScreen + ), this.updateButtonVisibility(), - this._interactionsEnabled && (this._scene.unregisterBeforeRender(this.beforeRender), - this._cameraGazer._gazeTracker.isVisible = false, - this._leftController && (this._leftController._gazeTracker.isVisible = false), - this._rightController && (this._rightController._gazeTracker.isVisible = false)), - this._scene.getEngine().resize(), - [this._leftController, this._rightController].forEach(function(e) { - e && e._deactivatePointer() - }), - this._hasEnteredVR = false; - var e = this._scene.getEngine(); - e._onVrDisplayPresentChange && e._onVrDisplayPresentChange() - } - } - , + this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce( + function () { + e.onAfterEnteringVRObservable.notifyObservers({ + success: true, + }); + } + )), + this._scene.activeCamera && + this._canvas && + this._scene.activeCamera.attachControl(this._canvas), + this._interactionsEnabled && + this._scene.registerBeforeRender(this.beforeRender), + this._displayLaserPointer && + [this._leftController, this._rightController].forEach( + function (e) { + e && e._activatePointer(); + } + ), + (this._hasEnteredVR = true)); + }), + (e.prototype.exitVR = function () { + if (this._hasEnteredVR) { + if (this.onExitingVRObservable) + try { + this.onExitingVRObservable.notifyObservers(this); + } catch (e) { + g.a.Warn( + "Error in your custom logic onExitingVR: " + e + ); + } + this._webVRpresenting && + this._scene.getEngine().disableVR(), + this._scene.activeCamera && + (this._position = + this._scene.activeCamera.position.clone()), + this.vrDeviceOrientationCamera && + (this.vrDeviceOrientationCamera.angularSensibility = + Number.MAX_VALUE), + this._deviceOrientationCamera + ? ((this._deviceOrientationCamera.position = + this._position), + (this._scene.activeCamera = + this._deviceOrientationCamera), + this._canvas && + this._scene.activeCamera.attachControl( + this._canvas + ), + this._cachedAngularSensibility + .angularSensibilityX && + ((this._deviceOrientationCamera.angularSensibilityX = + this._cachedAngularSensibility.angularSensibilityX), + (this._cachedAngularSensibility.angularSensibilityX = + null)), + this._cachedAngularSensibility + .angularSensibilityY && + ((this._deviceOrientationCamera.angularSensibilityY = + this._cachedAngularSensibility.angularSensibilityY), + (this._cachedAngularSensibility.angularSensibilityY = + null)), + this._cachedAngularSensibility + .angularSensibility && + ((this._deviceOrientationCamera.angularSensibility = + this._cachedAngularSensibility.angularSensibility), + (this._cachedAngularSensibility.angularSensibility = + null))) + : this._existingCamera && + ((this._existingCamera.position = this._position), + (this._scene.activeCamera = this._existingCamera), + this._cachedAngularSensibility + .angularSensibilityX && + ((this._existingCamera.angularSensibilityX = + this._cachedAngularSensibility.angularSensibilityX), + (this._cachedAngularSensibility.angularSensibilityX = + null)), + this._cachedAngularSensibility + .angularSensibilityY && + ((this._existingCamera.angularSensibilityY = + this._cachedAngularSensibility.angularSensibilityY), + (this._cachedAngularSensibility.angularSensibilityY = + null)), + this._cachedAngularSensibility + .angularSensibility && + ((this._existingCamera.angularSensibility = + this._cachedAngularSensibility.angularSensibility), + (this._cachedAngularSensibility.angularSensibility = + null))), + this.updateButtonVisibility(), + this._interactionsEnabled && + (this._scene.unregisterBeforeRender( + this.beforeRender + ), + (this._cameraGazer._gazeTracker.isVisible = false), + this._leftController && + (this._leftController._gazeTracker.isVisible = false), + this._rightController && + (this._rightController._gazeTracker.isVisible = false)), + this._scene.getEngine().resize(), + [this._leftController, this._rightController].forEach( + function (e) { + e && e._deactivatePointer(); + } + ), + (this._hasEnteredVR = false); + var e = this._scene.getEngine(); + e._onVrDisplayPresentChange && + e._onVrDisplayPresentChange(); + } + }), Object.defineProperty(e.prototype, "position", { - get: function() { - return this._position - }, - set: function(e) { - this._position = e, - this._scene.activeCamera && (this._scene.activeCamera.position = e) - }, - enumerable: true, - configurable: true + get: function () { + return this._position; + }, + set: function (e) { + (this._position = e), + this._scene.activeCamera && + (this._scene.activeCamera.position = e); + }, + enumerable: true, + configurable: true, }), - e.prototype.enableInteractions = function() { - var e = this; - this._interactionsEnabled || (this._interactionsRequested = true, - this._leftController && this._enableInteractionOnController(this._leftController), - this._rightController && this._enableInteractionOnController(this._rightController), - this.raySelectionPredicate = function(t) { - return t.isVisible && (t.isPickable || t.name === e._floorMeshName) - } - , - this.meshSelectionPredicate = function() { - return true - } - , - this._raySelectionPredicate = function(t) { - return !!(e._isTeleportationFloor(t) || -1 === t.name.indexOf("gazeTracker") && -1 === t.name.indexOf("teleportationTarget") && -1 === t.name.indexOf("torusTeleportation")) && e.raySelectionPredicate(t) - } - , - this._interactionsEnabled = true) - } - , - Object.defineProperty(e.prototype, "_noControllerIsActive", { - get: function() { - return !(this._leftController && this._leftController._activePointer || this._rightController && this._rightController._activePointer) - }, - enumerable: true, - configurable: true - }), - e.prototype._isTeleportationFloor = function(e) { - for (var t = 0; t < this._floorMeshesCollection.length; t++) - if (this._floorMeshesCollection[t].id === e.id) - return true; - return !(!this._floorMeshName || e.name !== this._floorMeshName) - } - , - e.prototype.addFloorMesh = function(e) { - this._floorMeshesCollection && (this._floorMeshesCollection.indexOf(e) > -1 || this._floorMeshesCollection.push(e)) - } - , - e.prototype.removeFloorMesh = function(e) { - if (this._floorMeshesCollection) { - var t = this._floorMeshesCollection.indexOf(e); - -1 !== t && this._floorMeshesCollection.splice(t, 1) - } - } - , - e.prototype.enableTeleportation = function(e) { - if (void 0 === e && (e = {}), - !this._teleportationInitialized) { - this._teleportationRequested = true, - this.enableInteractions(), - e.floorMeshName && (this._floorMeshName = e.floorMeshName), - e.floorMeshes && (this._floorMeshesCollection = e.floorMeshes), - null != this._leftController && this._enableTeleportationOnController(this._leftController), - null != this._rightController && this._enableTeleportationOnController(this._rightController); - var t = new yi.a; - t.vignetteColor = new a.f(0,0,0,0), - t.vignetteEnabled = true, - this._postProcessMove = new Ai("postProcessMove",1,this._webVRCamera,void 0,void 0,void 0,void 0,t), - this._webVRCamera.detachPostProcess(this._postProcessMove), - this._teleportationInitialized = true, - this._isDefaultTeleportationTarget && (this._createTeleportationCircles(), - this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor)) - } - } - , - e.prototype._enableInteractionOnController = function(e) { - var t = this; - e.webVRController.mesh && (e._interactionsEnabled = true, - this.isInVRMode && this._displayLaserPointer && e._activatePointer(), - this.webVROptions.laserToggle && e.webVRController.onMainButtonStateChangedObservable.add(function(i) { - t._displayLaserPointer && 1 === i.value && (e._activePointer ? e._deactivatePointer() : e._activatePointer(), - t.displayGaze && (e._gazeTracker.isVisible = e._activePointer)) + (e.prototype.enableInteractions = function () { + var e = this; + this._interactionsEnabled || + ((this._interactionsRequested = true), + this._leftController && + this._enableInteractionOnController( + this._leftController + ), + this._rightController && + this._enableInteractionOnController( + this._rightController + ), + (this.raySelectionPredicate = function (t) { + return ( + t.isVisible && + (t.isPickable || t.name === e._floorMeshName) + ); }), - e.webVRController.onTriggerStateChangedObservable.add(function(i) { + (this.meshSelectionPredicate = function () { + return true; + }), + (this._raySelectionPredicate = function (t) { + return ( + !!( + e._isTeleportationFloor(t) || + (-1 === t.name.indexOf("gazeTracker") && + -1 === t.name.indexOf("teleportationTarget") && + -1 === t.name.indexOf("torusTeleportation")) + ) && e.raySelectionPredicate(t) + ); + }), + (this._interactionsEnabled = true)); + }), + Object.defineProperty( + e.prototype, + "_noControllerIsActive", + { + get: function () { + return !( + (this._leftController && + this._leftController._activePointer) || + (this._rightController && + this._rightController._activePointer) + ); + }, + enumerable: true, + configurable: true, + } + ), + (e.prototype._isTeleportationFloor = function (e) { + for ( + var t = 0; + t < this._floorMeshesCollection.length; + t++ + ) + if (this._floorMeshesCollection[t].id === e.id) + return true; + return !( + !this._floorMeshName || e.name !== this._floorMeshName + ); + }), + (e.prototype.addFloorMesh = function (e) { + this._floorMeshesCollection && + (this._floorMeshesCollection.indexOf(e) > -1 || + this._floorMeshesCollection.push(e)); + }), + (e.prototype.removeFloorMesh = function (e) { + if (this._floorMeshesCollection) { + var t = this._floorMeshesCollection.indexOf(e); + -1 !== t && this._floorMeshesCollection.splice(t, 1); + } + }), + (e.prototype.enableTeleportation = function (e) { + if ( + (void 0 === e && (e = {}), + !this._teleportationInitialized) + ) { + (this._teleportationRequested = true), + this.enableInteractions(), + e.floorMeshName && + (this._floorMeshName = e.floorMeshName), + e.floorMeshes && + (this._floorMeshesCollection = e.floorMeshes), + null != this._leftController && + this._enableTeleportationOnController( + this._leftController + ), + null != this._rightController && + this._enableTeleportationOnController( + this._rightController + ); + var t = new yi.a(); + (t.vignetteColor = new a.f(0, 0, 0, 0)), + (t.vignetteEnabled = true), + (this._postProcessMove = new Ai( + "postProcessMove", + 1, + this._webVRCamera, + void 0, + void 0, + void 0, + void 0, + t + )), + this._webVRCamera.detachPostProcess( + this._postProcessMove + ), + (this._teleportationInitialized = true), + this._isDefaultTeleportationTarget && + (this._createTeleportationCircles(), + this._teleportationTarget.scaling.scaleInPlace( + this._webVRCamera.deviceScaleFactor + )); + } + }), + (e.prototype._enableInteractionOnController = function (e) { + var t = this; + e.webVRController.mesh && + ((e._interactionsEnabled = true), + this.isInVRMode && + this._displayLaserPointer && + e._activatePointer(), + this.webVROptions.laserToggle && + e.webVRController.onMainButtonStateChangedObservable.add( + function (i) { + t._displayLaserPointer && + 1 === i.value && + (e._activePointer + ? e._deactivatePointer() + : e._activatePointer(), + t.displayGaze && + (e._gazeTracker.isVisible = + e._activePointer)); + } + ), + e.webVRController.onTriggerStateChangedObservable.add( + function (i) { var n = e; t._noControllerIsActive && (n = t._cameraGazer), - n._pointerDownOnMeshAsked ? i.value < t._padSensibilityDown && n._selectionPointerUp() : i.value > t._padSensibilityUp && n._selectionPointerDown() - })) - } - , - e.prototype._checkTeleportWithRay = function(e, t) { - this._teleportationRequestInitiated && !t._teleportationRequestInitiated || (t._teleportationRequestInitiated ? Math.sqrt(e.y * e.y + e.x * e.x) < this._padSensibilityDown && (this._teleportActive && this.teleportCamera(this._haloCenter), - t._teleportationRequestInitiated = false) : e.y < -this._padSensibilityUp && t._dpadPressed && (t._activatePointer(), - t._teleportationRequestInitiated = true)) - } - , - e.prototype._checkRotate = function(e, t) { - t._teleportationRequestInitiated || (t._rotationLeftAsked ? e.x > -this._padSensibilityDown && (t._rotationLeftAsked = false) : e.x < -this._padSensibilityUp && t._dpadPressed && (t._rotationLeftAsked = true, - this._rotationAllowed && this._rotateCamera(false)), - t._rotationRightAsked ? e.x < this._padSensibilityDown && (t._rotationRightAsked = false) : e.x > this._padSensibilityUp && t._dpadPressed && (t._rotationRightAsked = true, - this._rotationAllowed && this._rotateCamera(true))) - } - , - e.prototype._checkTeleportBackwards = function(e, t) { - if (!t._teleportationRequestInitiated) - if (e.y > this._padSensibilityUp && t._dpadPressed) { - if (!t._teleportationBackRequestInitiated) { - if (!this.currentVRCamera) - return; - var i = a.q.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()) - , n = this.currentVRCamera.position; - this.currentVRCamera.devicePosition && this.currentVRCamera.deviceRotationQuaternion && (i = this.currentVRCamera.deviceRotationQuaternion, - n = this.currentVRCamera.devicePosition), - i.toEulerAnglesToRef(this._workingVector), - this._workingVector.z = 0, - this._workingVector.x = 0, - a.q.RotationYawPitchRollToRef(this._workingVector.y, this._workingVector.x, this._workingVector.z, this._workingQuaternion), - this._workingQuaternion.toRotationMatrix(this._workingMatrix), - a.x.TransformCoordinatesToRef(this._teleportBackwardsVector, this._workingMatrix, this._workingVector); - var r = new Dt.a(n,this._workingVector) - , o = this._scene.pickWithRay(r, this._raySelectionPredicate); - o && o.pickedPoint && o.pickedMesh && this._isTeleportationFloor(o.pickedMesh) && o.distance < 5 && this.teleportCamera(o.pickedPoint), - t._teleportationBackRequestInitiated = true - } - } else - t._teleportationBackRequestInitiated = false - } - , - e.prototype._enableTeleportationOnController = function(e) { - var t = this; - e.webVRController.mesh && (e._interactionsEnabled || this._enableInteractionOnController(e), - e._interactionsEnabled = true, - e._teleportationEnabled = true, - e.webVRController.controllerType === Mt.VIVE && (e._dpadPressed = false, - e.webVRController.onPadStateChangedObservable.add(function(t) { - e._dpadPressed = t.pressed, - e._dpadPressed || (e._rotationLeftAsked = false, - e._rotationRightAsked = false, - e._teleportationBackRequestInitiated = false) - })), - e.webVRController.onPadValuesChangedObservable.add(function(i) { - t.teleportationEnabled && (t._checkTeleportBackwards(i, e), - t._checkTeleportWithRay(i, e)), - t._checkRotate(i, e) - })) - } - , - e.prototype._createTeleportationCircles = function() { - this._teleportationTarget = me.a.CreateGround("teleportationTarget", 2, 2, 2, this._scene), - this._teleportationTarget.isPickable = false; - var e = new Ei("DynamicTexture",512,this._scene,true); - e.hasAlpha = true; - var t = e.getContext(); - t.beginPath(), + n._pointerDownOnMeshAsked + ? i.value < t._padSensibilityDown && + n._selectionPointerUp() + : i.value > t._padSensibilityUp && + n._selectionPointerDown(); + } + )); + }), + (e.prototype._checkTeleportWithRay = function (e, t) { + (this._teleportationRequestInitiated && + !t._teleportationRequestInitiated) || + (t._teleportationRequestInitiated + ? Math.sqrt(e.y * e.y + e.x * e.x) < + this._padSensibilityDown && + (this._teleportActive && + this.teleportCamera(this._haloCenter), + (t._teleportationRequestInitiated = false)) + : e.y < -this._padSensibilityUp && + t._dpadPressed && + (t._activatePointer(), + (t._teleportationRequestInitiated = true))); + }), + (e.prototype._checkRotate = function (e, t) { + t._teleportationRequestInitiated || + (t._rotationLeftAsked + ? e.x > -this._padSensibilityDown && + (t._rotationLeftAsked = false) + : e.x < -this._padSensibilityUp && + t._dpadPressed && + ((t._rotationLeftAsked = true), + this._rotationAllowed && this._rotateCamera(false)), + t._rotationRightAsked + ? e.x < this._padSensibilityDown && + (t._rotationRightAsked = false) + : e.x > this._padSensibilityUp && + t._dpadPressed && + ((t._rotationRightAsked = true), + this._rotationAllowed && this._rotateCamera(true))); + }), + (e.prototype._checkTeleportBackwards = function (e, t) { + if (!t._teleportationRequestInitiated) + if (e.y > this._padSensibilityUp && t._dpadPressed) { + if (!t._teleportationBackRequestInitiated) { + if (!this.currentVRCamera) return; + var i = a.q.FromRotationMatrix( + this.currentVRCamera + .getWorldMatrix() + .getRotationMatrix() + ), + n = this.currentVRCamera.position; + this.currentVRCamera.devicePosition && + this.currentVRCamera.deviceRotationQuaternion && + ((i = + this.currentVRCamera.deviceRotationQuaternion), + (n = this.currentVRCamera.devicePosition)), + i.toEulerAnglesToRef(this._workingVector), + (this._workingVector.z = 0), + (this._workingVector.x = 0), + a.q.RotationYawPitchRollToRef( + this._workingVector.y, + this._workingVector.x, + this._workingVector.z, + this._workingQuaternion + ), + this._workingQuaternion.toRotationMatrix( + this._workingMatrix + ), + a.x.TransformCoordinatesToRef( + this._teleportBackwardsVector, + this._workingMatrix, + this._workingVector + ); + var r = new Dt.a(n, this._workingVector), + o = this._scene.pickWithRay( + r, + this._raySelectionPredicate + ); + o && + o.pickedPoint && + o.pickedMesh && + this._isTeleportationFloor(o.pickedMesh) && + o.distance < 5 && + this.teleportCamera(o.pickedPoint), + (t._teleportationBackRequestInitiated = true); + } + } else t._teleportationBackRequestInitiated = false; + }), + (e.prototype._enableTeleportationOnController = function ( + e + ) { + var t = this; + e.webVRController.mesh && + (e._interactionsEnabled || + this._enableInteractionOnController(e), + (e._interactionsEnabled = true), + (e._teleportationEnabled = true), + e.webVRController.controllerType === Mt.VIVE && + ((e._dpadPressed = false), + e.webVRController.onPadStateChangedObservable.add( + function (t) { + (e._dpadPressed = t.pressed), + e._dpadPressed || + ((e._rotationLeftAsked = false), + (e._rotationRightAsked = false), + (e._teleportationBackRequestInitiated = false)); + } + )), + e.webVRController.onPadValuesChangedObservable.add( + function (i) { + t.teleportationEnabled && + (t._checkTeleportBackwards(i, e), + t._checkTeleportWithRay(i, e)), + t._checkRotate(i, e); + } + )); + }), + (e.prototype._createTeleportationCircles = function () { + (this._teleportationTarget = me.a.CreateGround( + "teleportationTarget", + 2, + 2, + 2, + this._scene + )), + (this._teleportationTarget.isPickable = false); + var e = new Ei("DynamicTexture", 512, this._scene, true); + e.hasAlpha = true; + var t = e.getContext(); + t.beginPath(), t.arc(256, 256, 200, 0, 2 * Math.PI, false), - t.fillStyle = this._teleportationFillColor, + (t.fillStyle = this._teleportationFillColor), t.fill(), - t.lineWidth = 10, - t.strokeStyle = this._teleportationBorderColor, + (t.lineWidth = 10), + (t.strokeStyle = this._teleportationBorderColor), t.stroke(), t.closePath(), e.update(); - var i = new bi.a("TextPlaneMaterial",this._scene); - i.diffuseTexture = e, - this._teleportationTarget.material = i; - var n = me.a.CreateTorus("torusTeleportation", .75, .1, 25, this._scene, false); - n.isPickable = false, - n.parent = this._teleportationTarget; - var r = new U("animationInnerCircle","position.y",30,U.ANIMATIONTYPE_FLOAT,U.ANIMATIONLOOPMODE_CYCLE) - , o = []; + var i = new bi.a("TextPlaneMaterial", this._scene); + (i.diffuseTexture = e), + (this._teleportationTarget.material = i); + var n = me.a.CreateTorus( + "torusTeleportation", + 0.75, + 0.1, + 25, + this._scene, + false + ); + (n.isPickable = false), + (n.parent = this._teleportationTarget); + var r = new U( + "animationInnerCircle", + "position.y", + 30, + U.ANIMATIONTYPE_FLOAT, + U.ANIMATIONLOOPMODE_CYCLE + ), + o = []; + o.push({ + frame: 0, + value: 0, + }), o.push({ - frame: 0, - value: 0 + frame: 30, + value: 0.4, }), o.push({ - frame: 30, - value: .4 - }), - o.push({ - frame: 60, - value: 0 + frame: 60, + value: 0, }), r.setKeys(o); - var a = new fe; - a.setEasingMode(te.EASINGMODE_EASEINOUT), + var a = new fe(); + a.setEasingMode(te.EASINGMODE_EASEINOUT), r.setEasingFunction(a), - n.animations = [], + (n.animations = []), n.animations.push(r), this._scene.beginAnimation(n, 0, 60, true), - this._hideTeleportationTarget() - } - , - e.prototype._displayTeleportationTarget = function() { - this._teleportActive = true, - this._teleportationInitialized && (this._teleportationTarget.isVisible = true, - this._isDefaultTeleportationTarget && (this._teleportationTarget.getChildren()[0].isVisible = true)) - } - , - e.prototype._hideTeleportationTarget = function() { - this._teleportActive = false, - this._teleportationInitialized && (this._teleportationTarget.isVisible = false, - this._isDefaultTeleportationTarget && (this._teleportationTarget.getChildren()[0].isVisible = false)) - } - , - e.prototype._rotateCamera = function(e) { - var t = this; - if (this.currentVRCamera instanceof Tt) { - e ? this._rotationAngle++ : this._rotationAngle--, - this.currentVRCamera.animations = []; - var i = a.q.FromRotationMatrix(a.j.RotationY(Math.PI / 4 * this._rotationAngle)) - , n = new U("animationRotation","rotationQuaternion",90,U.ANIMATIONTYPE_QUATERNION,U.ANIMATIONLOOPMODE_CONSTANT) - , r = []; - r.push({ - frame: 0, - value: this.currentVRCamera.rotationQuaternion - }), - r.push({ - frame: 6, - value: i - }), - n.setKeys(r), - n.setEasingFunction(this._circleEase), - this.currentVRCamera.animations.push(n), - this._postProcessMove.animations = []; - var o = new U("animationPP","vignetteWeight",90,U.ANIMATIONTYPE_FLOAT,U.ANIMATIONLOOPMODE_CONSTANT) - , s = []; - s.push({ - frame: 0, - value: 0 - }), - s.push({ - frame: 3, - value: 4 - }), - s.push({ - frame: 6, - value: 0 - }), - o.setKeys(s), - o.setEasingFunction(this._circleEase), - this._postProcessMove.animations.push(o); - var c = new U("animationPP2","vignetteStretch",90,U.ANIMATIONTYPE_FLOAT,U.ANIMATIONLOOPMODE_CONSTANT) - , u = []; - u.push({ - frame: 0, - value: 0 - }), - u.push({ - frame: 3, - value: 10 - }), - u.push({ - frame: 6, - value: 0 - }), - c.setKeys(u), - c.setEasingFunction(this._circleEase), - this._postProcessMove.animations.push(c), - this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0, - this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0, - this._postProcessMove.samples = 4, - this._webVRCamera.attachPostProcess(this._postProcessMove), - this._scene.beginAnimation(this._postProcessMove, 0, 6, false, 1, function() { - t._webVRCamera.detachPostProcess(t._postProcessMove) - }), - this._scene.beginAnimation(this.currentVRCamera, 0, 6, false, 1) - } - } - , - e.prototype._moveTeleportationSelectorTo = function(e, t, i) { - if (e.pickedPoint) { - t._teleportationRequestInitiated && (this._displayTeleportationTarget(), - this._haloCenter.copyFrom(e.pickedPoint), - this._teleportationTarget.position.copyFrom(e.pickedPoint)); - var n = this._convertNormalToDirectionOfRay(e.getNormal(true, false), i); - if (n) { - var r = a.x.Cross(a.c.Y, n) - , o = a.x.Cross(n, r); - a.x.RotationFromAxisToRef(o, n, r, this._teleportationTarget.rotation) + this._hideTeleportationTarget(); + }), + (e.prototype._displayTeleportationTarget = function () { + (this._teleportActive = true), + this._teleportationInitialized && + ((this._teleportationTarget.isVisible = true), + this._isDefaultTeleportationTarget && + (this._teleportationTarget.getChildren()[0].isVisible = true)); + }), + (e.prototype._hideTeleportationTarget = function () { + (this._teleportActive = false), + this._teleportationInitialized && + ((this._teleportationTarget.isVisible = false), + this._isDefaultTeleportationTarget && + (this._teleportationTarget.getChildren()[0].isVisible = false)); + }), + (e.prototype._rotateCamera = function (e) { + var t = this; + if (this.currentVRCamera instanceof Tt) { + e ? this._rotationAngle++ : this._rotationAngle--, + (this.currentVRCamera.animations = []); + var i = a.q.FromRotationMatrix( + a.j.RotationY((Math.PI / 4) * this._rotationAngle) + ), + n = new U( + "animationRotation", + "rotationQuaternion", + 90, + U.ANIMATIONTYPE_QUATERNION, + U.ANIMATIONLOOPMODE_CONSTANT + ), + r = []; + r.push({ + frame: 0, + value: this.currentVRCamera.rotationQuaternion, + }), + r.push({ + frame: 6, + value: i, + }), + n.setKeys(r), + n.setEasingFunction(this._circleEase), + this.currentVRCamera.animations.push(n), + (this._postProcessMove.animations = []); + var o = new U( + "animationPP", + "vignetteWeight", + 90, + U.ANIMATIONTYPE_FLOAT, + U.ANIMATIONLOOPMODE_CONSTANT + ), + s = []; + s.push({ + frame: 0, + value: 0, + }), + s.push({ + frame: 3, + value: 4, + }), + s.push({ + frame: 6, + value: 0, + }), + o.setKeys(s), + o.setEasingFunction(this._circleEase), + this._postProcessMove.animations.push(o); + var c = new U( + "animationPP2", + "vignetteStretch", + 90, + U.ANIMATIONTYPE_FLOAT, + U.ANIMATIONLOOPMODE_CONSTANT + ), + u = []; + u.push({ + frame: 0, + value: 0, + }), + u.push({ + frame: 3, + value: 10, + }), + u.push({ + frame: 6, + value: 0, + }), + c.setKeys(u), + c.setEasingFunction(this._circleEase), + this._postProcessMove.animations.push(c), + (this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0), + (this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0), + (this._postProcessMove.samples = 4), + this._webVRCamera.attachPostProcess( + this._postProcessMove + ), + this._scene.beginAnimation( + this._postProcessMove, + 0, + 6, + false, + 1, + function () { + t._webVRCamera.detachPostProcess( + t._postProcessMove + ); } - this._teleportationTarget.position.y += .1 + ), + this._scene.beginAnimation( + this.currentVRCamera, + 0, + 6, + false, + 1 + ); + } + }), + (e.prototype._moveTeleportationSelectorTo = function ( + e, + t, + i + ) { + if (e.pickedPoint) { + t._teleportationRequestInitiated && + (this._displayTeleportationTarget(), + this._haloCenter.copyFrom(e.pickedPoint), + this._teleportationTarget.position.copyFrom( + e.pickedPoint + )); + var n = this._convertNormalToDirectionOfRay( + e.getNormal(true, false), + i + ); + if (n) { + var r = a.x.Cross(a.c.Y, n), + o = a.x.Cross(n, r); + a.x.RotationFromAxisToRef( + o, + n, + r, + this._teleportationTarget.rotation + ); } - } - , - e.prototype.teleportCamera = function(e) { - var t = this; - if (this.currentVRCamera instanceof Tt) { - this.webVRCamera.leftCamera ? (this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition), - this._workingVector.subtractInPlace(this.webVRCamera.position), - e.subtractToRef(this._workingVector, this._workingVector)) : this._workingVector.copyFrom(e), - this.isInVRMode ? this._workingVector.y += this.webVRCamera.deviceDistanceToRoomGround() * this._webVRCamera.deviceScaleFactor : this._workingVector.y += this._defaultHeight, - this.onBeforeCameraTeleport.notifyObservers(this._workingVector), - this.currentVRCamera.animations = []; - var i = new U("animationCameraTeleportation","position",90,U.ANIMATIONTYPE_VECTOR3,U.ANIMATIONLOOPMODE_CONSTANT) - , n = [{ - frame: 0, - value: this.currentVRCamera.position - }, { - frame: 11, - value: this._workingVector - }]; - i.setKeys(n), - i.setEasingFunction(this._circleEase), - this.currentVRCamera.animations.push(i), - this._postProcessMove.animations = []; - var r = new U("animationPP","vignetteWeight",90,U.ANIMATIONTYPE_FLOAT,U.ANIMATIONLOOPMODE_CONSTANT) - , o = []; - o.push({ - frame: 0, - value: 0 - }), - o.push({ - frame: 5, - value: 8 - }), - o.push({ - frame: 11, - value: 0 - }), - r.setKeys(o), - this._postProcessMove.animations.push(r); - var a = new U("animationPP2","vignetteStretch",90,U.ANIMATIONTYPE_FLOAT,U.ANIMATIONLOOPMODE_CONSTANT) - , s = []; - s.push({ - frame: 0, - value: 0 - }), - s.push({ - frame: 5, - value: 10 - }), - s.push({ - frame: 11, - value: 0 - }), - a.setKeys(s), - this._postProcessMove.animations.push(a), - this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0, - this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0, - this._webVRCamera.attachPostProcess(this._postProcessMove), - this._scene.beginAnimation(this._postProcessMove, 0, 11, false, 1, function() { - t._webVRCamera.detachPostProcess(t._postProcessMove) - }), - this._scene.beginAnimation(this.currentVRCamera, 0, 11, false, 1, function() { - t.onAfterCameraTeleport.notifyObservers(t._workingVector) - }), - this._hideTeleportationTarget() - } - } - , - e.prototype._convertNormalToDirectionOfRay = function(e, t) { - return e && Math.acos(a.x.Dot(e, t.direction)) < Math.PI / 2 && e.scaleInPlace(-1), + this._teleportationTarget.position.y += 0.1; + } + }), + (e.prototype.teleportCamera = function (e) { + var t = this; + if (this.currentVRCamera instanceof Tt) { + this.webVRCamera.leftCamera + ? (this._workingVector.copyFrom( + this.webVRCamera.leftCamera.globalPosition + ), + this._workingVector.subtractInPlace( + this.webVRCamera.position + ), + e.subtractToRef( + this._workingVector, + this._workingVector + )) + : this._workingVector.copyFrom(e), + this.isInVRMode + ? (this._workingVector.y += + this.webVRCamera.deviceDistanceToRoomGround() * + this._webVRCamera.deviceScaleFactor) + : (this._workingVector.y += this._defaultHeight), + this.onBeforeCameraTeleport.notifyObservers( + this._workingVector + ), + (this.currentVRCamera.animations = []); + var i = new U( + "animationCameraTeleportation", + "position", + 90, + U.ANIMATIONTYPE_VECTOR3, + U.ANIMATIONLOOPMODE_CONSTANT + ), + n = [ + { + frame: 0, + value: this.currentVRCamera.position, + }, + { + frame: 11, + value: this._workingVector, + }, + ]; + i.setKeys(n), + i.setEasingFunction(this._circleEase), + this.currentVRCamera.animations.push(i), + (this._postProcessMove.animations = []); + var r = new U( + "animationPP", + "vignetteWeight", + 90, + U.ANIMATIONTYPE_FLOAT, + U.ANIMATIONLOOPMODE_CONSTANT + ), + o = []; + o.push({ + frame: 0, + value: 0, + }), + o.push({ + frame: 5, + value: 8, + }), + o.push({ + frame: 11, + value: 0, + }), + r.setKeys(o), + this._postProcessMove.animations.push(r); + var a = new U( + "animationPP2", + "vignetteStretch", + 90, + U.ANIMATIONTYPE_FLOAT, + U.ANIMATIONLOOPMODE_CONSTANT + ), + s = []; + s.push({ + frame: 0, + value: 0, + }), + s.push({ + frame: 5, + value: 10, + }), + s.push({ + frame: 11, + value: 0, + }), + a.setKeys(s), + this._postProcessMove.animations.push(a), + (this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0), + (this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0), + this._webVRCamera.attachPostProcess( + this._postProcessMove + ), + this._scene.beginAnimation( + this._postProcessMove, + 0, + 11, + false, + 1, + function () { + t._webVRCamera.detachPostProcess( + t._postProcessMove + ); + } + ), + this._scene.beginAnimation( + this.currentVRCamera, + 0, + 11, + false, + 1, + function () { + t.onAfterCameraTeleport.notifyObservers( + t._workingVector + ); + } + ), + this._hideTeleportationTarget(); + } + }), + (e.prototype._convertNormalToDirectionOfRay = function ( + e, + t + ) { + return ( + e && + Math.acos(a.x.Dot(e, t.direction)) < Math.PI / 2 && + e.scaleInPlace(-1), e - } - , - e.prototype._castRayAndSelectObject = function(e) { - if (this.currentVRCamera instanceof Tt) { - var t = e._getForwardRay(this._rayLength) - , i = this._scene.pickWithRay(t, this._raySelectionPredicate); - if (i && (e._laserPointer && (i.originMesh = e._laserPointer.parent), + ); + }), + (e.prototype._castRayAndSelectObject = function (e) { + if (this.currentVRCamera instanceof Tt) { + var t = e._getForwardRay(this._rayLength), + i = this._scene.pickWithRay( + t, + this._raySelectionPredicate + ); + if ( + (i && + (e._laserPointer && + (i.originMesh = e._laserPointer.parent), this._scene.simulatePointerMove(i, { - pointerId: e._id + pointerId: e._id, })), - e._currentHit = i, - i && i.pickedPoint) { - if (this._displayGaze) { - var n = 1; - e._gazeTracker.isVisible = true, - e._isActionableMesh && (n = 3), - this.updateGazeTrackerScale && (e._gazeTracker.scaling.x = i.distance * n, - e._gazeTracker.scaling.y = i.distance * n, - e._gazeTracker.scaling.z = i.distance * n); - var r = this._convertNormalToDirectionOfRay(i.getNormal(), t); - if (r) { - var o = a.x.Cross(a.c.Y, r) - , s = a.x.Cross(r, o); - a.x.RotationFromAxisToRef(s, r, o, e._gazeTracker.rotation) - } - e._gazeTracker.position.copyFrom(i.pickedPoint), - e._gazeTracker.position.x < 0 ? e._gazeTracker.position.x += .002 : e._gazeTracker.position.x -= .002, - e._gazeTracker.position.y < 0 ? e._gazeTracker.position.y += .002 : e._gazeTracker.position.y -= .002, - e._gazeTracker.position.z < 0 ? e._gazeTracker.position.z += .002 : e._gazeTracker.position.z -= .002 - } - e._updatePointerDistance(i.distance) + (e._currentHit = i), + i && i.pickedPoint) + ) { + if (this._displayGaze) { + var n = 1; + (e._gazeTracker.isVisible = true), + e._isActionableMesh && (n = 3), + this.updateGazeTrackerScale && + ((e._gazeTracker.scaling.x = i.distance * n), + (e._gazeTracker.scaling.y = i.distance * n), + (e._gazeTracker.scaling.z = i.distance * n)); + var r = this._convertNormalToDirectionOfRay( + i.getNormal(), + t + ); + if (r) { + var o = a.x.Cross(a.c.Y, r), + s = a.x.Cross(r, o); + a.x.RotationFromAxisToRef( + s, + r, + o, + e._gazeTracker.rotation + ); + } + e._gazeTracker.position.copyFrom(i.pickedPoint), + e._gazeTracker.position.x < 0 + ? (e._gazeTracker.position.x += 0.002) + : (e._gazeTracker.position.x -= 0.002), + e._gazeTracker.position.y < 0 + ? (e._gazeTracker.position.y += 0.002) + : (e._gazeTracker.position.y -= 0.002), + e._gazeTracker.position.z < 0 + ? (e._gazeTracker.position.z += 0.002) + : (e._gazeTracker.position.z -= 0.002); + } + e._updatePointerDistance(i.distance); + } else + e._updatePointerDistance(), + (e._gazeTracker.isVisible = false); + if (i && i.pickedMesh) { + if ( + this._teleportationInitialized && + this._isTeleportationFloor(i.pickedMesh) && + i.pickedPoint + ) + return ( + e._currentMeshSelected && + !this._isTeleportationFloor( + e._currentMeshSelected + ) && + this._notifySelectedMeshUnselected( + e._currentMeshSelected + ), + (e._currentMeshSelected = null), + void ( + e._teleportationRequestInitiated && + this._moveTeleportationSelectorTo(i, e, t) + ) + ); + if (i.pickedMesh !== e._currentMeshSelected) + if (this.meshSelectionPredicate(i.pickedMesh)) { + this.onNewMeshPicked.notifyObservers(i), + (e._currentMeshSelected = i.pickedMesh), + i.pickedMesh.isPickable && + i.pickedMesh.actionManager + ? (this.changeGazeColor(new a.e(0, 0, 1)), + this.changeLaserColor(new a.e(0.2, 0.2, 1)), + (e._isActionableMesh = true)) + : (this.changeGazeColor( + new a.e(0.7, 0.7, 0.7) + ), + this.changeLaserColor( + new a.e(0.7, 0.7, 0.7) + ), + (e._isActionableMesh = false)); + try { + this.onNewMeshSelected.notifyObservers( + i.pickedMesh + ); + } catch (e) { + g.a.Warn( + "Error in your custom logic onNewMeshSelected: " + + e + ); + } } else - e._updatePointerDistance(), - e._gazeTracker.isVisible = false; - if (i && i.pickedMesh) { - if (this._teleportationInitialized && this._isTeleportationFloor(i.pickedMesh) && i.pickedPoint) - return e._currentMeshSelected && !this._isTeleportationFloor(e._currentMeshSelected) && this._notifySelectedMeshUnselected(e._currentMeshSelected), - e._currentMeshSelected = null, - void (e._teleportationRequestInitiated && this._moveTeleportationSelectorTo(i, e, t)); - if (i.pickedMesh !== e._currentMeshSelected) - if (this.meshSelectionPredicate(i.pickedMesh)) { - this.onNewMeshPicked.notifyObservers(i), - e._currentMeshSelected = i.pickedMesh, - i.pickedMesh.isPickable && i.pickedMesh.actionManager ? (this.changeGazeColor(new a.e(0,0,1)), - this.changeLaserColor(new a.e(.2,.2,1)), - e._isActionableMesh = true) : (this.changeGazeColor(new a.e(.7,.7,.7)), - this.changeLaserColor(new a.e(.7,.7,.7)), - e._isActionableMesh = false); - try { - this.onNewMeshSelected.notifyObservers(i.pickedMesh) - } catch (e) { - g.a.Warn("Error in your custom logic onNewMeshSelected: " + e) - } - } else - this._notifySelectedMeshUnselected(e._currentMeshSelected), - e._currentMeshSelected = null, - this.changeGazeColor(new a.e(.7,.7,.7)), - this.changeLaserColor(new a.e(.7,.7,.7)) - } else - this._notifySelectedMeshUnselected(e._currentMeshSelected), - e._currentMeshSelected = null, - this.changeGazeColor(new a.e(.7,.7,.7)), - this.changeLaserColor(new a.e(.7,.7,.7)) - } - } - , - e.prototype._notifySelectedMeshUnselected = function(e) { - e && this.onSelectedMeshUnselected.notifyObservers(e) - } - , - e.prototype.changeLaserColor = function(e) { - this._leftController && this._leftController._setLaserPointerColor(e), - this._rightController && this._rightController._setLaserPointerColor(e) - } - , - e.prototype.changeGazeColor = function(e) { - this.updateGazeTrackerColor && this._cameraGazer._gazeTracker.material && (this._cameraGazer._gazeTracker.material.emissiveColor = e, - this._leftController && (this._leftController._gazeTracker.material.emissiveColor = e), - this._rightController && (this._rightController._gazeTracker.material.emissiveColor = e)) - } - , - e.prototype.dispose = function() { - this.isInVRMode && this.exitVR(), - this._postProcessMove && this._postProcessMove.dispose(), + this._notifySelectedMeshUnselected( + e._currentMeshSelected + ), + (e._currentMeshSelected = null), + this.changeGazeColor(new a.e(0.7, 0.7, 0.7)), + this.changeLaserColor(new a.e(0.7, 0.7, 0.7)); + } else + this._notifySelectedMeshUnselected( + e._currentMeshSelected + ), + (e._currentMeshSelected = null), + this.changeGazeColor(new a.e(0.7, 0.7, 0.7)), + this.changeLaserColor(new a.e(0.7, 0.7, 0.7)); + } + }), + (e.prototype._notifySelectedMeshUnselected = function (e) { + e && this.onSelectedMeshUnselected.notifyObservers(e); + }), + (e.prototype.changeLaserColor = function (e) { + this._leftController && + this._leftController._setLaserPointerColor(e), + this._rightController && + this._rightController._setLaserPointerColor(e); + }), + (e.prototype.changeGazeColor = function (e) { + this.updateGazeTrackerColor && + this._cameraGazer._gazeTracker.material && + ((this._cameraGazer._gazeTracker.material.emissiveColor = + e), + this._leftController && + (this._leftController._gazeTracker.material.emissiveColor = + e), + this._rightController && + (this._rightController._gazeTracker.material.emissiveColor = + e)); + }), + (e.prototype.dispose = function () { + this.isInVRMode && this.exitVR(), + this._postProcessMove && + this._postProcessMove.dispose(), this._webVRCamera && this._webVRCamera.dispose(), - this._vrDeviceOrientationCamera && this._vrDeviceOrientationCamera.dispose(), - !this._useCustomVRButton && this._btnVR.parentNode && document.body.removeChild(this._btnVR), - this._deviceOrientationCamera && this._scene.activeCamera != this._deviceOrientationCamera && this._deviceOrientationCamera.dispose(), + this._vrDeviceOrientationCamera && + this._vrDeviceOrientationCamera.dispose(), + !this._useCustomVRButton && + this._btnVR.parentNode && + document.body.removeChild(this._btnVR), + this._deviceOrientationCamera && + this._scene.activeCamera != + this._deviceOrientationCamera && + this._deviceOrientationCamera.dispose(), this._cameraGazer && this._cameraGazer.dispose(), this._leftController && this._leftController.dispose(), - this._rightController && this._rightController.dispose(), - this._teleportationTarget && this._teleportationTarget.dispose(), - this._floorMeshesCollection = [], - document.removeEventListener("keydown", this._onKeyDown), - window.removeEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange), + this._rightController && + this._rightController.dispose(), + this._teleportationTarget && + this._teleportationTarget.dispose(), + (this._floorMeshesCollection = []), + document.removeEventListener( + "keydown", + this._onKeyDown + ), + window.removeEventListener( + "vrdisplaypresentchange", + this._onVrDisplayPresentChange + ), window.removeEventListener("resize", this._onResize), - document.removeEventListener("fullscreenchange", this._onFullscreenChange), - document.removeEventListener("mozfullscreenchange", this._onFullscreenChange), - document.removeEventListener("webkitfullscreenchange", this._onFullscreenChange), - document.removeEventListener("msfullscreenchange", this._onFullscreenChange), - document.onmsfullscreenchange = null, - this._scene.getEngine().onVRDisplayChangedObservable.removeCallback(this._onVRDisplayChanged), - this._scene.getEngine().onVRRequestPresentStart.removeCallback(this._onVRRequestPresentStart), - this._scene.getEngine().onVRRequestPresentComplete.removeCallback(this._onVRRequestPresentComplete), - window.removeEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange), - this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected), - this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected), - this._scene.unregisterBeforeRender(this.beforeRender) - } - , - e.prototype.getClassName = function() { - return "VRExperienceHelper" - } - , + document.removeEventListener( + "fullscreenchange", + this._onFullscreenChange + ), + document.removeEventListener( + "mozfullscreenchange", + this._onFullscreenChange + ), + document.removeEventListener( + "webkitfullscreenchange", + this._onFullscreenChange + ), + document.removeEventListener( + "msfullscreenchange", + this._onFullscreenChange + ), + (document.onmsfullscreenchange = null), + this._scene + .getEngine() + .onVRDisplayChangedObservable.removeCallback( + this._onVRDisplayChanged + ), + this._scene + .getEngine() + .onVRRequestPresentStart.removeCallback( + this._onVRRequestPresentStart + ), + this._scene + .getEngine() + .onVRRequestPresentComplete.removeCallback( + this._onVRRequestPresentComplete + ), + window.removeEventListener( + "vrdisplaypresentchange", + this._onVrDisplayPresentChange + ), + this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback( + this._onNewGamepadConnected + ), + this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback( + this._onNewGamepadDisconnected + ), + this._scene.unregisterBeforeRender(this.beforeRender); + }), + (e.prototype.getClassName = function () { + return "VRExperienceHelper"; + }), e - }(), Bi = function(e) { - function t(t, i) { - var n = e.call(this, t, a.x.Zero(), i) || this; - return n.minZ = 0, - n.rotationQuaternion = new a.q, - n.cameraRigMode = ke.a.RIG_MODE_CUSTOM, - n.updateUpVectorFromRotation = true, - n._updateNumberOfRigCameras(1), - n - } - return h.d(t, e), - t.prototype._updateNumberOfRigCameras = function(e) { - for (void 0 === e && (e = 1); this.rigCameras.length < e; ) { - var t = new Et("view: " + this.rigCameras.length,a.x.Zero(),this.getScene()); - t.minZ = 0, - t.parent = this, - t.rotationQuaternion = new a.q, - t.updateUpVectorFromRotation = true, - this.rigCameras.push(t) - } - for (; this.rigCameras.length > e; ) { - var i = this.rigCameras.pop(); - i && i.dispose() - } - } - , - t.prototype._updateForDualEyeDebugging = function(e) { - void 0 === e && (e = .01), + ); + })(), + Bi = (function (e) { + function t(t, i) { + var n = e.call(this, t, a.x.Zero(), i) || this; + return ( + (n.minZ = 0), + (n.rotationQuaternion = new a.q()), + (n.cameraRigMode = ke.a.RIG_MODE_CUSTOM), + (n.updateUpVectorFromRotation = true), + n._updateNumberOfRigCameras(1), + n + ); + } + return ( + h.d(t, e), + (t.prototype._updateNumberOfRigCameras = function (e) { + for ( + void 0 === e && (e = 1); + this.rigCameras.length < e; + + ) { + var t = new Et( + "view: " + this.rigCameras.length, + a.x.Zero(), + this.getScene() + ); + (t.minZ = 0), + (t.parent = this), + (t.rotationQuaternion = new a.q()), + (t.updateUpVectorFromRotation = true), + this.rigCameras.push(t); + } + for (; this.rigCameras.length > e; ) { + var i = this.rigCameras.pop(); + i && i.dispose(); + } + }), + (t.prototype._updateForDualEyeDebugging = function (e) { + void 0 === e && (e = 0.01), this._updateNumberOfRigCameras(2), - this.rigCameras[0].viewport = new a.z(0,0,.5,1), - this.rigCameras[0].position.x = -e / 2, - this.rigCameras[0].outputRenderTarget = null, - this.rigCameras[1].viewport = new a.z(.5,0,.5,1), - this.rigCameras[1].position.x = e / 2, - this.rigCameras[1].outputRenderTarget = null - } - , - t.prototype.updateFromXRSessionManager = function(e) { - var i = this; - if (!e._currentXRFrame || !e._currentXRFrame.getDevicePose) - return false; - var n = e._currentXRFrame.getDevicePose(e._frameOfReference); - return !(!n || !n.poseModelMatrix || (a.j.FromFloat32ArrayToRefScaled(n.poseModelMatrix, 0, 1, t._TmpMatrix), - this._scene.useRightHandedSystem || t._TmpMatrix.toggleModelMatrixHandInPlace(), + (this.rigCameras[0].viewport = new a.z(0, 0, 0.5, 1)), + (this.rigCameras[0].position.x = -e / 2), + (this.rigCameras[0].outputRenderTarget = null), + (this.rigCameras[1].viewport = new a.z(0.5, 0, 0.5, 1)), + (this.rigCameras[1].position.x = e / 2), + (this.rigCameras[1].outputRenderTarget = null); + }), + (t.prototype.updateFromXRSessionManager = function (e) { + var i = this; + if ( + !e._currentXRFrame || + !e._currentXRFrame.getDevicePose + ) + return false; + var n = e._currentXRFrame.getDevicePose( + e._frameOfReference + ); + return !( + !n || + !n.poseModelMatrix || + (a.j.FromFloat32ArrayToRefScaled( + n.poseModelMatrix, + 0, + 1, + t._TmpMatrix + ), + this._scene.useRightHandedSystem || + t._TmpMatrix.toggleModelMatrixHandInPlace(), t._TmpMatrix.getTranslationToRef(this.position), t._TmpMatrix.getRotationMatrixToRef(t._TmpMatrix), - a.q.FromRotationMatrixToRef(t._TmpMatrix, this.rotationQuaternion), + a.q.FromRotationMatrixToRef( + t._TmpMatrix, + this.rotationQuaternion + ), this.computeWorldMatrix(), - this._updateNumberOfRigCameras(e._currentXRFrame.views.length), - e._currentXRFrame.views.forEach(function(t, r) { - a.j.FromFloat32ArrayToRefScaled(n.getViewMatrix(t), 0, 1, i.rigCameras[r]._computedViewMatrix), - a.j.FromFloat32ArrayToRefScaled(t.projectionMatrix, 0, 1, i.rigCameras[r]._projectionMatrix), - i._scene.useRightHandedSystem || (i.rigCameras[r]._computedViewMatrix.toggleModelMatrixHandInPlace(), - i.rigCameras[r]._projectionMatrix.toggleProjectionMatrixHandInPlace()); - var o = e._xrSession.baseLayer.getViewport(t) - , s = e._xrSession.baseLayer.framebufferWidth - , c = e._xrSession.baseLayer.framebufferHeight; - i.rigCameras[r].viewport.width = o.width / s, - i.rigCameras[r].viewport.height = o.height / c, - i.rigCameras[r].viewport.x = o.x / s, - i.rigCameras[r].viewport.y = o.y / c, - i.rigCameras[r].outputRenderTarget = e._sessionRenderTargetTexture + this._updateNumberOfRigCameras( + e._currentXRFrame.views.length + ), + e._currentXRFrame.views.forEach(function (t, r) { + a.j.FromFloat32ArrayToRefScaled( + n.getViewMatrix(t), + 0, + 1, + i.rigCameras[r]._computedViewMatrix + ), + a.j.FromFloat32ArrayToRefScaled( + t.projectionMatrix, + 0, + 1, + i.rigCameras[r]._projectionMatrix + ), + i._scene.useRightHandedSystem || + (i.rigCameras[ + r + ]._computedViewMatrix.toggleModelMatrixHandInPlace(), + i.rigCameras[ + r + ]._projectionMatrix.toggleProjectionMatrixHandInPlace()); + var o = e._xrSession.baseLayer.getViewport(t), + s = e._xrSession.baseLayer.framebufferWidth, + c = e._xrSession.baseLayer.framebufferHeight; + (i.rigCameras[r].viewport.width = o.width / s), + (i.rigCameras[r].viewport.height = o.height / c), + (i.rigCameras[r].viewport.x = o.x / s), + (i.rigCameras[r].viewport.y = o.y / c), + (i.rigCameras[r].outputRenderTarget = + e._sessionRenderTargetTexture); }), - 0)) - } - , - t._TmpMatrix = new a.j, + 0) + ); + }), + (t._TmpMatrix = new a.j()), t - }(Tt), Ni = function() { - function e(e) { - this.scene = e, - this.onXRFrameObservable = new o.c, - this.onXRSessionEnded = new o.c, - this._sessionRenderTargetTexture = null, - this._tmpMatrix = new a.j - } - return e.prototype.initializeAsync = function() { - var e = this; - return g.a.Warn("The WebXR APIs are still under development and are subject to change in the future."), - this._xrNavigator = navigator, - this._xrNavigator.xr ? this._xrNavigator.xr.requestDevice().then(function(t) { - return e._xrDevice = t, - e.scene.getEngine()._gl.setCompatibleXRDevice(e._xrDevice) - }) : i.reject("webXR not supported by this browser") - } - , - e.prototype.enterXRAsync = function(t, i) { - var n = this; - return this._xrDevice.requestSession(t).then(function(e) { - return n._xrSession = e, - n._xrSession.addEventListener("end", function() { - n._sessionRenderTargetTexture = null, - n.scene.getEngine().restoreDefaultFramebuffer(), - n.scene.getEngine().customAnimationFrameRequester = null, - n.onXRSessionEnded.notifyObservers(null), - n.scene.getEngine()._renderLoop() - }, { - once: true - }), - n._xrSession.baseLayer = new XRWebGLLayer(n._xrSession,n.scene.getEngine()._gl), + ); + })(Tt), + Ni = (function () { + function e(e) { + (this.scene = e), + (this.onXRFrameObservable = new o.c()), + (this.onXRSessionEnded = new o.c()), + (this._sessionRenderTargetTexture = null), + (this._tmpMatrix = new a.j()); + } + return ( + (e.prototype.initializeAsync = function () { + var e = this; + return ( + g.a.Warn( + "The WebXR APIs are still under development and are subject to change in the future." + ), + (this._xrNavigator = navigator), + this._xrNavigator.xr + ? this._xrNavigator.xr + .requestDevice() + .then(function (t) { + return ( + (e._xrDevice = t), + e.scene + .getEngine() + ._gl.setCompatibleXRDevice(e._xrDevice) + ); + }) + : i.reject("webXR not supported by this browser") + ); + }), + (e.prototype.enterXRAsync = function (t, i) { + var n = this; + return this._xrDevice + .requestSession(t) + .then(function (e) { + return ( + (n._xrSession = e), + n._xrSession.addEventListener( + "end", + function () { + (n._sessionRenderTargetTexture = null), + n.scene + .getEngine() + .restoreDefaultFramebuffer(), + (n.scene.getEngine().customAnimationFrameRequester = + null), + n.onXRSessionEnded.notifyObservers(null), + n.scene.getEngine()._renderLoop(); + }, + { + once: true, + } + ), + (n._xrSession.baseLayer = new XRWebGLLayer( + n._xrSession, + n.scene.getEngine()._gl + )), n._xrSession.requestFrameOfReference(i) - }).then(function(t) { - n._frameOfReference = t, - n.scene.getEngine().customAnimationFrameRequester = { - requestAnimationFrame: n._xrSession.requestAnimationFrame.bind(n._xrSession), - renderFunction: function(e, t) { - n._currentXRFrame = t, + ); + }) + .then(function (t) { + (n._frameOfReference = t), + (n.scene.getEngine().customAnimationFrameRequester = + { + requestAnimationFrame: + n._xrSession.requestAnimationFrame.bind( + n._xrSession + ), + renderFunction: function (e, t) { + (n._currentXRFrame = t), n.onXRFrameObservable.notifyObservers(null), - n.scene.getEngine()._renderLoop() - } - }, - n._sessionRenderTargetTexture = e._CreateRenderTargetTextureFromSession(n._xrSession, n.scene), - window.cancelAnimationFrame(n.scene.getEngine()._frameHandler), - n.scene.getEngine()._renderLoop() - }) - } - , - e.prototype.exitXRAsync = function() { - return this._xrSession.end() - } - , - e.prototype.environmentPointHitTestAsync = function(e) { - var t = this; - return new i(function(i) { - var n = new Float32Array([e.origin.x, e.origin.y, e.origin.z]) - , r = new Float32Array([e.direction.x, e.direction.y, e.direction.z]); - t.scene.useRightHandedSystem || (n[2] *= -1, - r[2] *= -1), - t._xrSession.requestHitTest(n, r, t._frameOfReference).then(function(e) { - if (e.length > 0) { - a.j.FromFloat32ArrayToRefScaled(e[0].hitMatrix, 0, 1, t._tmpMatrix); - var n = t._tmpMatrix.getTranslation(); - t.scene.useRightHandedSystem || (n.z *= -1), - i(n) - } else - i(null) - }).catch(function() { - i(null) + n.scene.getEngine()._renderLoop(); + }, + }), + (n._sessionRenderTargetTexture = + e._CreateRenderTargetTextureFromSession( + n._xrSession, + n.scene + )), + window.cancelAnimationFrame( + n.scene.getEngine()._frameHandler + ), + n.scene.getEngine()._renderLoop(); + }); + }), + (e.prototype.exitXRAsync = function () { + return this._xrSession.end(); + }), + (e.prototype.environmentPointHitTestAsync = function (e) { + var t = this; + return new i(function (i) { + var n = new Float32Array([ + e.origin.x, + e.origin.y, + e.origin.z, + ]), + r = new Float32Array([ + e.direction.x, + e.direction.y, + e.direction.z, + ]); + t.scene.useRightHandedSystem || + ((n[2] *= -1), (r[2] *= -1)), + t._xrSession + .requestHitTest(n, r, t._frameOfReference) + .then(function (e) { + if (e.length > 0) { + a.j.FromFloat32ArrayToRefScaled( + e[0].hitMatrix, + 0, + 1, + t._tmpMatrix + ); + var n = t._tmpMatrix.getTranslation(); + t.scene.useRightHandedSystem || (n.z *= -1), + i(n); + } else i(null); }) - } - ) - } - , - e.prototype.supportsSessionAsync = function(e) { - return this._xrDevice.supportsSession(e).then(function() { - return true - }).catch(function() { - return false + .catch(function () { + i(null); + }); + }); + }), + (e.prototype.supportsSessionAsync = function (e) { + return this._xrDevice + .supportsSession(e) + .then(function () { + return true; }) - } - , - e._CreateRenderTargetTextureFromSession = function(e, t) { - var i = new He.a(t.getEngine(),He.a.DATASOURCE_UNKNOWN,true); - i.width = e.baseLayer.framebufferWidth, - i.height = e.baseLayer.framebufferHeight, - i._framebuffer = e.baseLayer.framebuffer; - var n = new li("XR renderTargetTexture",{ - width: i.width, - height: i.height - },t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,true); - return n._texture = i, - n - } - , - e.prototype.dispose = function() { - this.onXRFrameObservable.clear(), - this.onXRSessionEnded.clear() - } - , + .catch(function () { + return false; + }); + }), + (e._CreateRenderTargetTextureFromSession = function (e, t) { + var i = new He.a( + t.getEngine(), + He.a.DATASOURCE_UNKNOWN, + true + ); + (i.width = e.baseLayer.framebufferWidth), + (i.height = e.baseLayer.framebufferHeight), + (i._framebuffer = e.baseLayer.framebuffer); + var n = new li( + "XR renderTargetTexture", + { + width: i.width, + height: i.height, + }, + t, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + true + ); + return (n._texture = i), n; + }), + (e.prototype.dispose = function () { + this.onXRFrameObservable.clear(), + this.onXRSessionEnded.clear(); + }), e - }(); - !function(e) { - e[e.ENTERING_XR = 0] = "ENTERING_XR", - e[e.EXITING_XR = 1] = "EXITING_XR", - e[e.IN_XR = 2] = "IN_XR", - e[e.NOT_IN_XR = 3] = "NOT_IN_XR" - }(Ri || (Ri = {})); - var ki, Ui = function() { - function e(e) { - this.scene = e, - this.state = Ri.NOT_IN_XR, - this.onStateChangedObservable = new o.c, - this._nonVRCamera = null, - this._originalSceneAutoClear = true, - this._supported = false, - this.camera = new Bi("",e), - this._sessionManager = new Ni(e), - this.container = new Ne.a("",e), - this.camera.parent = this.container - } - return e.prototype._setState = function(e) { - this.state = e, - this.onStateChangedObservable.notifyObservers(this.state) - } - , - e.CreateAsync = function(t) { - var i = new e(t); - return i._sessionManager.initializeAsync().then(function() { - return i._supported = true, - i - }).catch(function() { - return i + ); + })(); + !(function (e) { + (e[(e.ENTERING_XR = 0)] = "ENTERING_XR"), + (e[(e.EXITING_XR = 1)] = "EXITING_XR"), + (e[(e.IN_XR = 2)] = "IN_XR"), + (e[(e.NOT_IN_XR = 3)] = "NOT_IN_XR"); + })(Ri || (Ri = {})); + var ki, + Ui = (function () { + function e(e) { + (this.scene = e), + (this.state = Ri.NOT_IN_XR), + (this.onStateChangedObservable = new o.c()), + (this._nonVRCamera = null), + (this._originalSceneAutoClear = true), + (this._supported = false), + (this.camera = new Bi("", e)), + (this._sessionManager = new Ni(e)), + (this.container = new Ne.a("", e)), + (this.camera.parent = this.container); + } + return ( + (e.prototype._setState = function (e) { + (this.state = e), + this.onStateChangedObservable.notifyObservers( + this.state + ); + }), + (e.CreateAsync = function (t) { + var i = new e(t); + return i._sessionManager + .initializeAsync() + .then(function () { + return (i._supported = true), i; }) - } - , - e.prototype.exitXRAsync = function() { - return this._setState(Ri.EXITING_XR), + .catch(function () { + return i; + }); + }), + (e.prototype.exitXRAsync = function () { + return ( + this._setState(Ri.EXITING_XR), this._sessionManager.exitXRAsync() - } - , - e.prototype.enterXRAsync = function(e, t) { - var i = this; - if (!this._supported) - throw "XR session not supported by this browser"; - return this._setState(Ri.ENTERING_XR), - this._sessionManager.enterXRAsync(e, t).then(function() { - i._originalSceneAutoClear = i.scene.autoClear, - i._nonVRCamera = i.scene.activeCamera, - i.scene.autoClear = false, - i.scene.activeCamera = i.camera, - i._sessionManager.onXRFrameObservable.add(function() { - i.camera.updateFromXRSessionManager(i._sessionManager) - }), - i._sessionManager.onXRSessionEnded.addOnce(function() { - i.camera.rigCameras.forEach(function(e) { - e.outputRenderTarget = null - }), - i.scene.autoClear = i._originalSceneAutoClear, - i.scene.activeCamera = i._nonVRCamera, - i._sessionManager.onXRFrameObservable.clear(), - i._setState(Ri.NOT_IN_XR) - }), - i._setState(Ri.IN_XR) - }) - } - , - e.prototype.environmentPointHitTestAsync = function(e) { - return this._sessionManager.environmentPointHitTestAsync(e) - } - , - e.prototype.setPositionOfCameraUsingContainer = function(t) { - this.camera.globalPosition.subtractToRef(t, e._TmpVector), - this.container.position.subtractInPlace(e._TmpVector) - } - , - e.prototype.rotateCameraByQuaternionUsingContainer = function(e) { - this.container.rotationQuaternion || (this.container.rotationQuaternion = a.q.FromEulerVector(this.container.rotation)), - this.container.rotationQuaternion.multiplyInPlace(e), - this.container.position.rotateByQuaternionAroundPointToRef(e, this.camera.globalPosition, this.container.position) - } - , - e.prototype.supportsSessionAsync = function(e) { - return this._supported ? this._sessionManager.supportsSessionAsync(e) : i.resolve(false) - } - , - e.prototype.dispose = function() { - this.camera.dispose(), + ); + }), + (e.prototype.enterXRAsync = function (e, t) { + var i = this; + if (!this._supported) + throw "XR session not supported by this browser"; + return ( + this._setState(Ri.ENTERING_XR), + this._sessionManager + .enterXRAsync(e, t) + .then(function () { + (i._originalSceneAutoClear = i.scene.autoClear), + (i._nonVRCamera = i.scene.activeCamera), + (i.scene.autoClear = false), + (i.scene.activeCamera = i.camera), + i._sessionManager.onXRFrameObservable.add( + function () { + i.camera.updateFromXRSessionManager( + i._sessionManager + ); + } + ), + i._sessionManager.onXRSessionEnded.addOnce( + function () { + i.camera.rigCameras.forEach(function (e) { + e.outputRenderTarget = null; + }), + (i.scene.autoClear = + i._originalSceneAutoClear), + (i.scene.activeCamera = i._nonVRCamera), + i._sessionManager.onXRFrameObservable.clear(), + i._setState(Ri.NOT_IN_XR); + } + ), + i._setState(Ri.IN_XR); + }) + ); + }), + (e.prototype.environmentPointHitTestAsync = function (e) { + return this._sessionManager.environmentPointHitTestAsync( + e + ); + }), + (e.prototype.setPositionOfCameraUsingContainer = function ( + t + ) { + this.camera.globalPosition.subtractToRef(t, e._TmpVector), + this.container.position.subtractInPlace(e._TmpVector); + }), + (e.prototype.rotateCameraByQuaternionUsingContainer = + function (e) { + this.container.rotationQuaternion || + (this.container.rotationQuaternion = + a.q.FromEulerVector(this.container.rotation)), + this.container.rotationQuaternion.multiplyInPlace(e), + this.container.position.rotateByQuaternionAroundPointToRef( + e, + this.camera.globalPosition, + this.container.position + ); + }), + (e.prototype.supportsSessionAsync = function (e) { + return this._supported + ? this._sessionManager.supportsSessionAsync(e) + : i.resolve(false); + }), + (e.prototype.dispose = function () { + this.camera.dispose(), this.container.dispose(), this.onStateChangedObservable.clear(), - this._sessionManager.dispose() - } - , - e._TmpVector = new a.x, + this._sessionManager.dispose(); + }), + (e._TmpVector = new a.x()), e - }(), Vi = function() { - function e(e, t) { - this.element = e, - this.initializationOptions = t + ); + })(), + Vi = (function () { + function e(e, t) { + (this.element = e), (this.initializationOptions = t); + } + return (e.prototype.update = function (e) {}), e; + })(), + Gi = function () {}, + zi = (function () { + function e(e, t) { + var i = this; + if ( + ((this.scene = e), + (this._buttons = []), + (this._activeButton = null), + (this.activeButtonChangedObservable = new o.c()), + (this._overlay = document.createElement("div")), + (this._overlay.style.cssText = + "z-index:11;position: absolute; right: 20px;bottom: 50px;"), + t.customButtons) + ) + this._buttons = t.customButtons; + else { + var n = document.createElement("button"); + (n.style.cssText = + "color: #868686; border-color: #868686; border-style: solid; margin-left: 10px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-repeat:no-repeat; background-position: center; outline: none;"), + (n.innerText = "HMD"), + this._buttons.push( + new Vi(n, { + immersive: true, + outputContext: t.outputCanvasContext, + }) + ), + (this._buttons[this._buttons.length - 1].update = + function (e) { + (this.element.style.display = + null === e || e === this ? "" : "none"), + (this.element.innerText = + e === this ? "EXIT" : "HMD"); + }); + var r = document.createElement("button"); + (r.style.cssText = n.style.cssText), + (r.innerText = "Window"), + this._buttons.push( + new Vi(r, { + immersive: false, + environmentIntegration: true, + outputContext: t.outputCanvasContext, + }) + ), + (this._buttons[this._buttons.length - 1].update = + function (e) { + (this.element.style.display = + null === e || e === this ? "" : "none"), + (this.element.innerText = + e === this ? "EXIT" : "Window"); + }), + this._updateButtons(null); } - return e.prototype.update = function(e) {} - , - e - }(), Gi = function() {}, zi = function() { - function e(e, t) { - var i = this; - if (this.scene = e, - this._buttons = [], - this._activeButton = null, - this.activeButtonChangedObservable = new o.c, - this._overlay = document.createElement("div"), - this._overlay.style.cssText = "z-index:11;position: absolute; right: 20px;bottom: 50px;", - t.customButtons) - this._buttons = t.customButtons; - else { - var n = document.createElement("button"); - n.style.cssText = "color: #868686; border-color: #868686; border-style: solid; margin-left: 10px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-repeat:no-repeat; background-position: center; outline: none;", - n.innerText = "HMD", - this._buttons.push(new Vi(n,{ - immersive: true, - outputContext: t.outputCanvasContext - })), - this._buttons[this._buttons.length - 1].update = function(e) { - this.element.style.display = null === e || e === this ? "" : "none", - this.element.innerText = e === this ? "EXIT" : "HMD" - } - ; - var r = document.createElement("button"); - r.style.cssText = n.style.cssText, - r.innerText = "Window", - this._buttons.push(new Vi(r,{ - immersive: false, - environmentIntegration: true, - outputContext: t.outputCanvasContext - })), - this._buttons[this._buttons.length - 1].update = function(e) { - this.element.style.display = null === e || e === this ? "" : "none", - this.element.innerText = e === this ? "EXIT" : "Window" - } - , - this._updateButtons(null) - } - var a = e.getEngine().getRenderingCanvas(); - a && a.parentNode && (a.parentNode.appendChild(this._overlay), - e.onDisposeObservable.addOnce(function() { - i.dispose() - })) - } - return e.CreateAsync = function(t, n, r) { - var o = this - , a = new e(t,r) - , s = a._buttons.map(function(e) { - return n.supportsSessionAsync(e.initializationOptions) + var a = e.getEngine().getRenderingCanvas(); + a && + a.parentNode && + (a.parentNode.appendChild(this._overlay), + e.onDisposeObservable.addOnce(function () { + i.dispose(); + })); + } + return ( + (e.CreateAsync = function (t, n, r) { + var o = this, + a = new e(t, r), + s = a._buttons.map(function (e) { + return n.supportsSessionAsync( + e.initializationOptions + ); }); - return n.onStateChangedObservable.add(function(e) { - e == Ri.NOT_IN_XR && a._updateButtons(null) + return ( + n.onStateChangedObservable.add(function (e) { + e == Ri.NOT_IN_XR && a._updateButtons(null); }), - i.all(s).then(function(e) { - return e.forEach(function(e, t) { - e && (a._overlay.appendChild(a._buttons[t].element), - a._buttons[t].element.onclick = function() { - return h.b(o, void 0, void 0, function() { - return h.e(this, function(e) { - switch (e.label) { - case 0: - return n.state != Ri.IN_XR ? [3, 2] : (a._updateButtons(null), - [4, n.exitXRAsync()]); - case 1: - return e.sent(), - [2]; - case 2: - return n.state != Ri.NOT_IN_XR ? [3, 4] : (a._updateButtons(a._buttons[t]), - [4, n.enterXRAsync(a._buttons[t].initializationOptions, "eye-level")]); - case 3: - e.sent(), - e.label = 4; - case 4: - return [2] - } - }) - }) - } - ) + i.all(s).then(function (e) { + return ( + e.forEach(function (e, t) { + e && + (a._overlay.appendChild(a._buttons[t].element), + (a._buttons[t].element.onclick = function () { + return h.b(o, void 0, void 0, function () { + return h.e(this, function (e) { + switch (e.label) { + case 0: + return n.state != Ri.IN_XR + ? [3, 2] + : (a._updateButtons(null), + [4, n.exitXRAsync()]); + case 1: + return e.sent(), [2]; + case 2: + return n.state != Ri.NOT_IN_XR + ? [3, 4] + : (a._updateButtons(a._buttons[t]), + [ + 4, + n.enterXRAsync( + a._buttons[t] + .initializationOptions, + "eye-level" + ), + ]); + case 3: + e.sent(), (e.label = 4); + case 4: + return [2]; + } + }); + }); + })); }), a + ); }) - } - , - e.prototype._updateButtons = function(e) { - var t = this; - this._activeButton = e, - this._buttons.forEach(function(e) { - e.update(t._activeButton) + ); + }), + (e.prototype._updateButtons = function (e) { + var t = this; + (this._activeButton = e), + this._buttons.forEach(function (e) { + e.update(t._activeButton); }), - this.activeButtonChangedObservable.notifyObservers(this._activeButton) - } - , - e.prototype.dispose = function() { - var e = this.scene.getEngine().getRenderingCanvas(); - e && e.parentNode && e.parentNode.contains(this._overlay) && e.parentNode.removeChild(this._overlay), - this.activeButtonChangedObservable.clear() - } - , + this.activeButtonChangedObservable.notifyObservers( + this._activeButton + ); + }), + (e.prototype.dispose = function () { + var e = this.scene.getEngine().getRenderingCanvas(); + e && + e.parentNode && + e.parentNode.contains(this._overlay) && + e.parentNode.removeChild(this._overlay), + this.activeButtonChangedObservable.clear(); + }), e - }(), ji = function() { - function e(e) { - this.pointer = new Ne.a("controllerPointer",e) - } - return e.prototype.dispose = function() { - this.grip && this.grip.dispose(), - this.pointer.dispose() - } - , + ); + })(), + ji = (function () { + function e(e) { + this.pointer = new Ne.a("controllerPointer", e); + } + return ( + (e.prototype.dispose = function () { + this.grip && this.grip.dispose(), this.pointer.dispose(); + }), e - }(), Hi = function() { - function e(e) { - var t = this; - this.helper = e, - this.controllers = [], - this._tmpMatrix = new a.j, - this._frameObserver = e._sessionManager.onXRFrameObservable.add(function() { - if (e._sessionManager._currentXRFrame && e._sessionManager._currentXRFrame.getDevicePose) { - var i = e._sessionManager._currentXRFrame; - e._sessionManager._xrSession.getInputSources().forEach(function(n, r) { - var o = i.getInputPose(n, e._sessionManager._frameOfReference); - if (o) { - t.controllers.length <= r && t.controllers.push(new ji(e.container.getScene())); - var s = t.controllers[r]; - o.gripMatrix && (s.grip || (s.grip = new Ne.a("controllerGrip",e.container.getScene())), - a.j.FromFloat32ArrayToRefScaled(o.gripMatrix, 0, 1, t._tmpMatrix), - s.grip.getScene().useRightHandedSystem || t._tmpMatrix.toggleModelMatrixHandInPlace(), - s.grip.rotationQuaternion || (s.grip.rotationQuaternion = new a.q), - t._tmpMatrix.decompose(s.grip.scaling, s.grip.rotationQuaternion, s.grip.position)), - a.j.FromFloat32ArrayToRefScaled(o.targetRay.transformMatrix, 0, 1, t._tmpMatrix), - s.pointer.getScene().useRightHandedSystem || t._tmpMatrix.toggleModelMatrixHandInPlace(), - s.pointer.rotationQuaternion || (s.pointer.rotationQuaternion = new a.q), - t._tmpMatrix.decompose(s.pointer.scaling, s.pointer.rotationQuaternion, s.pointer.position) - } - }) - } - }) - } - return e.prototype.dispose = function() { - this.controllers.forEach(function(e) { - e.dispose() - }), - this.helper._sessionManager.onXRFrameObservable.remove(this._frameObserver) - } - , + ); + })(), + Hi = (function () { + function e(e) { + var t = this; + (this.helper = e), + (this.controllers = []), + (this._tmpMatrix = new a.j()), + (this._frameObserver = + e._sessionManager.onXRFrameObservable.add(function () { + if ( + e._sessionManager._currentXRFrame && + e._sessionManager._currentXRFrame.getDevicePose + ) { + var i = e._sessionManager._currentXRFrame; + e._sessionManager._xrSession + .getInputSources() + .forEach(function (n, r) { + var o = i.getInputPose( + n, + e._sessionManager._frameOfReference + ); + if (o) { + t.controllers.length <= r && + t.controllers.push( + new ji(e.container.getScene()) + ); + var s = t.controllers[r]; + o.gripMatrix && + (s.grip || + (s.grip = new Ne.a( + "controllerGrip", + e.container.getScene() + )), + a.j.FromFloat32ArrayToRefScaled( + o.gripMatrix, + 0, + 1, + t._tmpMatrix + ), + s.grip.getScene().useRightHandedSystem || + t._tmpMatrix.toggleModelMatrixHandInPlace(), + s.grip.rotationQuaternion || + (s.grip.rotationQuaternion = new a.q()), + t._tmpMatrix.decompose( + s.grip.scaling, + s.grip.rotationQuaternion, + s.grip.position + )), + a.j.FromFloat32ArrayToRefScaled( + o.targetRay.transformMatrix, + 0, + 1, + t._tmpMatrix + ), + s.pointer.getScene().useRightHandedSystem || + t._tmpMatrix.toggleModelMatrixHandInPlace(), + s.pointer.rotationQuaternion || + (s.pointer.rotationQuaternion = + new a.q()), + t._tmpMatrix.decompose( + s.pointer.scaling, + s.pointer.rotationQuaternion, + s.pointer.position + ); + } + }); + } + })); + } + return ( + (e.prototype.dispose = function () { + this.controllers.forEach(function (e) { + e.dispose(); + }), + this.helper._sessionManager.onXRFrameObservable.remove( + this._frameObserver + ); + }), e - }(), Wi = function() { - function e(e, t) { - var i = this; - this._canvas = null, - this.canvasContext = null, - t || ((t = document.createElement("canvas")).style.cssText = "position:absolute; bottom:0px;right:0px;z-index:10;width:100%;height:100%;background-color: #000000;"), - this._setManagedOutputCanvas(t), - e.onStateChangedObservable.add(function(t) { - t == Ri.ENTERING_XR ? i._addCanvas() : e.state == Ri.NOT_IN_XR && i._removeCanvas() - }) - } - return e.prototype.dispose = function() { - this._removeCanvas(), - this._setManagedOutputCanvas(null) - } - , - e.prototype._setManagedOutputCanvas = function(e) { - this._removeCanvas(), - e ? (this._canvas = e, - this.canvasContext = this._canvas.getContext("xrpresent")) : (this._canvas = null, - this.canvasContext = null) - } - , - e.prototype._addCanvas = function() { - this._canvas && document.body.appendChild(this._canvas) - } - , - e.prototype._removeCanvas = function() { - this._canvas && document.body.contains(this._canvas) && document.body.removeChild(this._canvas) - } - , + ); + })(), + Wi = (function () { + function e(e, t) { + var i = this; + (this._canvas = null), + (this.canvasContext = null), + t || + ((t = document.createElement("canvas")).style.cssText = + "position:absolute; bottom:0px;right:0px;z-index:10;width:100%;height:100%;background-color: #000000;"), + this._setManagedOutputCanvas(t), + e.onStateChangedObservable.add(function (t) { + t == Ri.ENTERING_XR + ? i._addCanvas() + : e.state == Ri.NOT_IN_XR && i._removeCanvas(); + }); + } + return ( + (e.prototype.dispose = function () { + this._removeCanvas(), this._setManagedOutputCanvas(null); + }), + (e.prototype._setManagedOutputCanvas = function (e) { + this._removeCanvas(), + e + ? ((this._canvas = e), + (this.canvasContext = + this._canvas.getContext("xrpresent"))) + : ((this._canvas = null), + (this.canvasContext = null)); + }), + (e.prototype._addCanvas = function () { + this._canvas && document.body.appendChild(this._canvas); + }), + (e.prototype._removeCanvas = function () { + this._canvas && + document.body.contains(this._canvas) && + document.body.removeChild(this._canvas); + }), e - }(), Xi = (ki = { + ); + })(), + Xi = + ((ki = { root: 0, - found: false - }, - function(e, t, i, n) { - ki.root = 0, - ki.found = false; + found: false, + }), + function (e, t, i, n) { + (ki.root = 0), (ki.found = false); var r = t * t - 4 * e * i; - if (r < 0) - return ki; - var o = Math.sqrt(r) - , a = (-t - o) / (2 * e) - , s = (-t + o) / (2 * e); + if (r < 0) return ki; + var o = Math.sqrt(r), + a = (-t - o) / (2 * e), + s = (-t + o) / (2 * e); if (a > s) { - var c = s; - s = a, - a = c + var c = s; + (s = a), (a = c); } - return a > 0 && a < n ? (ki.root = a, - ki.found = true, - ki) : s > 0 && s < n ? (ki.root = s, - ki.found = true, - ki) : ki - } - ), Yi = function() { - function e() { - this._collisionPoint = a.x.Zero(), - this._planeIntersectionPoint = a.x.Zero(), - this._tempVector = a.x.Zero(), - this._tempVector2 = a.x.Zero(), - this._tempVector3 = a.x.Zero(), - this._tempVector4 = a.x.Zero(), - this._edge = a.x.Zero(), - this._baseToVertex = a.x.Zero(), - this._destinationPoint = a.x.Zero(), - this._slidePlaneNormal = a.x.Zero(), - this._displacementVector = a.x.Zero(), - this._radius = a.x.One(), - this._retry = 0, - this._basePointWorld = a.x.Zero(), - this._velocityWorld = a.x.Zero(), - this._normalizedVelocity = a.x.Zero(), - this._collisionMask = -1 - } - return Object.defineProperty(e.prototype, "collisionMask", { - get: function() { - return this._collisionMask - }, - set: function(e) { - this._collisionMask = isNaN(e) ? -1 : e - }, - enumerable: true, - configurable: true + return a > 0 && a < n + ? ((ki.root = a), (ki.found = true), ki) + : s > 0 && s < n + ? ((ki.root = s), (ki.found = true), ki) + : ki; + }), + Yi = (function () { + function e() { + (this._collisionPoint = a.x.Zero()), + (this._planeIntersectionPoint = a.x.Zero()), + (this._tempVector = a.x.Zero()), + (this._tempVector2 = a.x.Zero()), + (this._tempVector3 = a.x.Zero()), + (this._tempVector4 = a.x.Zero()), + (this._edge = a.x.Zero()), + (this._baseToVertex = a.x.Zero()), + (this._destinationPoint = a.x.Zero()), + (this._slidePlaneNormal = a.x.Zero()), + (this._displacementVector = a.x.Zero()), + (this._radius = a.x.One()), + (this._retry = 0), + (this._basePointWorld = a.x.Zero()), + (this._velocityWorld = a.x.Zero()), + (this._normalizedVelocity = a.x.Zero()), + (this._collisionMask = -1); + } + return ( + Object.defineProperty(e.prototype, "collisionMask", { + get: function () { + return this._collisionMask; + }, + set: function (e) { + this._collisionMask = isNaN(e) ? -1 : e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "slidePlaneNormal", { - get: function() { - return this._slidePlaneNormal - }, - enumerable: true, - configurable: true + get: function () { + return this._slidePlaneNormal; + }, + enumerable: true, + configurable: true, }), - e.prototype._initialize = function(e, t, i) { - this._velocity = t, + (e.prototype._initialize = function (e, t, i) { + (this._velocity = t), a.x.NormalizeToRef(t, this._normalizedVelocity), - this._basePoint = e, + (this._basePoint = e), e.multiplyToRef(this._radius, this._basePointWorld), t.multiplyToRef(this._radius, this._velocityWorld), - this._velocityWorldLength = this._velocityWorld.length(), - this._epsilon = i, - this.collisionFound = false - } - , - e.prototype._checkPointInTriangle = function(e, t, i, n, r) { - t.subtractToRef(e, this._tempVector), + (this._velocityWorldLength = + this._velocityWorld.length()), + (this._epsilon = i), + (this.collisionFound = false); + }), + (e.prototype._checkPointInTriangle = function ( + e, + t, + i, + n, + r + ) { + t.subtractToRef(e, this._tempVector), i.subtractToRef(e, this._tempVector2), - a.x.CrossToRef(this._tempVector, this._tempVector2, this._tempVector4); - var o = a.x.Dot(this._tempVector4, r); - return !(o < 0) && (n.subtractToRef(e, this._tempVector3), - a.x.CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4), - !((o = a.x.Dot(this._tempVector4, r)) < 0) && (a.x.CrossToRef(this._tempVector3, this._tempVector, this._tempVector4), - (o = a.x.Dot(this._tempVector4, r)) >= 0)) - } - , - e.prototype._canDoCollision = function(e, t, i, n) { - var r = a.x.Distance(this._basePointWorld, e) - , o = Math.max(this._radius.x, this._radius.y, this._radius.z); - return !(r > this._velocityWorldLength + o + t || !function(e, t, i, n) { - return !(e.x > i.x + n || i.x - n > t.x || e.y > i.y + n || i.y - n > t.y || e.z > i.z + n || i.z - n > t.z) - }(i, n, this._basePointWorld, this._velocityWorldLength + o)) - } - , - e.prototype._testTriangle = function(e, t, i, n, r, o) { - var s, c = false; - t || (t = []), - t[e] || (t[e] = new a.n(0,0,0,0), - t[e].copyFromPoints(i, n, r)); - var u = t[e]; - if (o || u.isFrontFacingTo(this._normalizedVelocity, 0)) { - var l = u.signedDistanceTo(this._basePoint) - , h = a.x.Dot(u.normal, this._velocity); - if (0 == h) { - if (Math.abs(l) >= 1) - return; - c = true, - s = 0 - } else { - var f = (1 - l) / h; - if ((s = (-1 - l) / h) > f) { - var d = f; - f = s, - s = d - } - if (s > 1 || f < 0) - return; - s < 0 && (s = 0), - s > 1 && (s = 1) - } - this._collisionPoint.copyFromFloats(0, 0, 0); - var p = false - , m = 1; - if (c || (this._basePoint.subtractToRef(u.normal, this._planeIntersectionPoint), + a.x.CrossToRef( + this._tempVector, + this._tempVector2, + this._tempVector4 + ); + var o = a.x.Dot(this._tempVector4, r); + return ( + !(o < 0) && + (n.subtractToRef(e, this._tempVector3), + a.x.CrossToRef( + this._tempVector2, + this._tempVector3, + this._tempVector4 + ), + !((o = a.x.Dot(this._tempVector4, r)) < 0) && + (a.x.CrossToRef( + this._tempVector3, + this._tempVector, + this._tempVector4 + ), + (o = a.x.Dot(this._tempVector4, r)) >= 0)) + ); + }), + (e.prototype._canDoCollision = function (e, t, i, n) { + var r = a.x.Distance(this._basePointWorld, e), + o = Math.max( + this._radius.x, + this._radius.y, + this._radius.z + ); + return !( + r > this._velocityWorldLength + o + t || + !(function (e, t, i, n) { + return !( + e.x > i.x + n || + i.x - n > t.x || + e.y > i.y + n || + i.y - n > t.y || + e.z > i.z + n || + i.z - n > t.z + ); + })( + i, + n, + this._basePointWorld, + this._velocityWorldLength + o + ) + ); + }), + (e.prototype._testTriangle = function (e, t, i, n, r, o) { + var s, + c = false; + t || (t = []), + t[e] || + ((t[e] = new a.n(0, 0, 0, 0)), + t[e].copyFromPoints(i, n, r)); + var u = t[e]; + if (o || u.isFrontFacingTo(this._normalizedVelocity, 0)) { + var l = u.signedDistanceTo(this._basePoint), + h = a.x.Dot(u.normal, this._velocity); + if (0 == h) { + if (Math.abs(l) >= 1) return; + (c = true), (s = 0); + } else { + var f = (1 - l) / h; + if ((s = (-1 - l) / h) > f) { + var d = f; + (f = s), (s = d); + } + if (s > 1 || f < 0) return; + s < 0 && (s = 0), s > 1 && (s = 1); + } + this._collisionPoint.copyFromFloats(0, 0, 0); + var p = false, + m = 1; + if ( + (c || + (this._basePoint.subtractToRef( + u.normal, + this._planeIntersectionPoint + ), this._velocity.scaleToRef(s, this._tempVector), - this._planeIntersectionPoint.addInPlace(this._tempVector), - this._checkPointInTriangle(this._planeIntersectionPoint, i, n, r, u.normal) && (p = true, - m = s, - this._collisionPoint.copyFrom(this._planeIntersectionPoint))), - !p) { - var g = this._velocity.lengthSquared() - , _ = g; - this._basePoint.subtractToRef(i, this._tempVector); - var v = 2 * a.x.Dot(this._velocity, this._tempVector) - , y = this._tempVector.lengthSquared() - 1 - , b = Xi(_, v, y, m); - b.found && (m = b.root, - p = true, - this._collisionPoint.copyFrom(i)), - this._basePoint.subtractToRef(n, this._tempVector), - v = 2 * a.x.Dot(this._velocity, this._tempVector), - y = this._tempVector.lengthSquared() - 1, - (b = Xi(_, v, y, m)).found && (m = b.root, - p = true, - this._collisionPoint.copyFrom(n)), - this._basePoint.subtractToRef(r, this._tempVector), - v = 2 * a.x.Dot(this._velocity, this._tempVector), - y = this._tempVector.lengthSquared() - 1, - (b = Xi(_, v, y, m)).found && (m = b.root, - p = true, - this._collisionPoint.copyFrom(r)), - n.subtractToRef(i, this._edge), - i.subtractToRef(this._basePoint, this._baseToVertex); - var E = this._edge.lengthSquared() - , T = a.x.Dot(this._edge, this._velocity) - , A = a.x.Dot(this._edge, this._baseToVertex); - if (_ = E * -g + T * T, - v = E * (2 * a.x.Dot(this._velocity, this._baseToVertex)) - 2 * T * A, - y = E * (1 - this._baseToVertex.lengthSquared()) + A * A, - (b = Xi(_, v, y, m)).found) { - var x = (T * b.root - A) / E; - x >= 0 && x <= 1 && (m = b.root, - p = true, - this._edge.scaleInPlace(x), - i.addToRef(this._edge, this._collisionPoint)) - } - r.subtractToRef(n, this._edge), - n.subtractToRef(this._basePoint, this._baseToVertex), - E = this._edge.lengthSquared(), - T = a.x.Dot(this._edge, this._velocity), - A = a.x.Dot(this._edge, this._baseToVertex), - _ = E * -g + T * T, - v = E * (2 * a.x.Dot(this._velocity, this._baseToVertex)) - 2 * T * A, - y = E * (1 - this._baseToVertex.lengthSquared()) + A * A, - (b = Xi(_, v, y, m)).found && (x = (T * b.root - A) / E) >= 0 && x <= 1 && (m = b.root, - p = true, - this._edge.scaleInPlace(x), - n.addToRef(this._edge, this._collisionPoint)), - i.subtractToRef(r, this._edge), - r.subtractToRef(this._basePoint, this._baseToVertex), - E = this._edge.lengthSquared(), - T = a.x.Dot(this._edge, this._velocity), - A = a.x.Dot(this._edge, this._baseToVertex), - _ = E * -g + T * T, - v = E * (2 * a.x.Dot(this._velocity, this._baseToVertex)) - 2 * T * A, - y = E * (1 - this._baseToVertex.lengthSquared()) + A * A, - (b = Xi(_, v, y, m)).found && (x = (T * b.root - A) / E) >= 0 && x <= 1 && (m = b.root, - p = true, - this._edge.scaleInPlace(x), - r.addToRef(this._edge, this._collisionPoint)) - } - if (p) { - var S = m * this._velocity.length(); - (!this.collisionFound || S < this._nearestDistance) && (this.intersectionPoint ? this.intersectionPoint.copyFrom(this._collisionPoint) : this.intersectionPoint = this._collisionPoint.clone(), - this._nearestDistance = S, - this.collisionFound = true) - } + this._planeIntersectionPoint.addInPlace( + this._tempVector + ), + this._checkPointInTriangle( + this._planeIntersectionPoint, + i, + n, + r, + u.normal + ) && + ((p = true), + (m = s), + this._collisionPoint.copyFrom( + this._planeIntersectionPoint + ))), + !p) + ) { + var g = this._velocity.lengthSquared(), + _ = g; + this._basePoint.subtractToRef(i, this._tempVector); + var v = 2 * a.x.Dot(this._velocity, this._tempVector), + y = this._tempVector.lengthSquared() - 1, + b = Xi(_, v, y, m); + b.found && + ((m = b.root), + (p = true), + this._collisionPoint.copyFrom(i)), + this._basePoint.subtractToRef(n, this._tempVector), + (v = 2 * a.x.Dot(this._velocity, this._tempVector)), + (y = this._tempVector.lengthSquared() - 1), + (b = Xi(_, v, y, m)).found && + ((m = b.root), + (p = true), + this._collisionPoint.copyFrom(n)), + this._basePoint.subtractToRef(r, this._tempVector), + (v = 2 * a.x.Dot(this._velocity, this._tempVector)), + (y = this._tempVector.lengthSquared() - 1), + (b = Xi(_, v, y, m)).found && + ((m = b.root), + (p = true), + this._collisionPoint.copyFrom(r)), + n.subtractToRef(i, this._edge), + i.subtractToRef( + this._basePoint, + this._baseToVertex + ); + var E = this._edge.lengthSquared(), + T = a.x.Dot(this._edge, this._velocity), + A = a.x.Dot(this._edge, this._baseToVertex); + if ( + ((_ = E * -g + T * T), + (v = + E * + (2 * + a.x.Dot(this._velocity, this._baseToVertex)) - + 2 * T * A), + (y = + E * (1 - this._baseToVertex.lengthSquared()) + + A * A), + (b = Xi(_, v, y, m)).found) + ) { + var x = (T * b.root - A) / E; + x >= 0 && + x <= 1 && + ((m = b.root), + (p = true), + this._edge.scaleInPlace(x), + i.addToRef(this._edge, this._collisionPoint)); + } + r.subtractToRef(n, this._edge), + n.subtractToRef( + this._basePoint, + this._baseToVertex + ), + (E = this._edge.lengthSquared()), + (T = a.x.Dot(this._edge, this._velocity)), + (A = a.x.Dot(this._edge, this._baseToVertex)), + (_ = E * -g + T * T), + (v = + E * + (2 * + a.x.Dot(this._velocity, this._baseToVertex)) - + 2 * T * A), + (y = + E * (1 - this._baseToVertex.lengthSquared()) + + A * A), + (b = Xi(_, v, y, m)).found && + (x = (T * b.root - A) / E) >= 0 && + x <= 1 && + ((m = b.root), + (p = true), + this._edge.scaleInPlace(x), + n.addToRef(this._edge, this._collisionPoint)), + i.subtractToRef(r, this._edge), + r.subtractToRef( + this._basePoint, + this._baseToVertex + ), + (E = this._edge.lengthSquared()), + (T = a.x.Dot(this._edge, this._velocity)), + (A = a.x.Dot(this._edge, this._baseToVertex)), + (_ = E * -g + T * T), + (v = + E * + (2 * + a.x.Dot(this._velocity, this._baseToVertex)) - + 2 * T * A), + (y = + E * (1 - this._baseToVertex.lengthSquared()) + + A * A), + (b = Xi(_, v, y, m)).found && + (x = (T * b.root - A) / E) >= 0 && + x <= 1 && + ((m = b.root), + (p = true), + this._edge.scaleInPlace(x), + r.addToRef(this._edge, this._collisionPoint)); } - } - , - e.prototype._collide = function(e, t, i, n, r, o, a) { - for (var s = n; s < r; s += 3) { - var c = t[i[s] - o] - , u = t[i[s + 1] - o] - , l = t[i[s + 2] - o]; - this._testTriangle(s, e, l, u, c, a) + if (p) { + var S = m * this._velocity.length(); + (!this.collisionFound || S < this._nearestDistance) && + (this.intersectionPoint + ? this.intersectionPoint.copyFrom( + this._collisionPoint + ) + : (this.intersectionPoint = + this._collisionPoint.clone()), + (this._nearestDistance = S), + (this.collisionFound = true)); } - } - , - e.prototype._getResponse = function(e, t) { - e.addToRef(t, this._destinationPoint), + } + }), + (e.prototype._collide = function (e, t, i, n, r, o, a) { + for (var s = n; s < r; s += 3) { + var c = t[i[s] - o], + u = t[i[s + 1] - o], + l = t[i[s + 2] - o]; + this._testTriangle(s, e, l, u, c, a); + } + }), + (e.prototype._getResponse = function (e, t) { + e.addToRef(t, this._destinationPoint), t.scaleInPlace(this._nearestDistance / t.length()), this._basePoint.addToRef(t, e), - e.subtractToRef(this.intersectionPoint, this._slidePlaneNormal), + e.subtractToRef( + this.intersectionPoint, + this._slidePlaneNormal + ), this._slidePlaneNormal.normalize(), - this._slidePlaneNormal.scaleToRef(this._epsilon, this._displacementVector), + this._slidePlaneNormal.scaleToRef( + this._epsilon, + this._displacementVector + ), e.addInPlace(this._displacementVector), - this.intersectionPoint.addInPlace(this._displacementVector), - this._slidePlaneNormal.scaleInPlace(a.n.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint)), - this._destinationPoint.subtractInPlace(this._slidePlaneNormal), - this._destinationPoint.subtractToRef(this.intersectionPoint, t) - } - , + this.intersectionPoint.addInPlace( + this._displacementVector + ), + this._slidePlaneNormal.scaleInPlace( + a.n.SignedDistanceToPlaneFromPositionAndNormal( + this.intersectionPoint, + this._slidePlaneNormal, + this._destinationPoint + ) + ), + this._destinationPoint.subtractInPlace( + this._slidePlaneNormal + ), + this._destinationPoint.subtractToRef( + this.intersectionPoint, + t + ); + }), e - }(), Ki = function() { - function e() { - this._scaledPosition = a.x.Zero(), - this._scaledVelocity = a.x.Zero(), - this._finalPosition = a.x.Zero() - } - return e.prototype.getNewPosition = function(e, t, i, n, r, o, a) { - e.divideToRef(i._radius, this._scaledPosition), + ); + })(), + Ki = (function () { + function e() { + (this._scaledPosition = a.x.Zero()), + (this._scaledVelocity = a.x.Zero()), + (this._finalPosition = a.x.Zero()); + } + return ( + (e.prototype.getNewPosition = function ( + e, + t, + i, + n, + r, + o, + a + ) { + e.divideToRef(i._radius, this._scaledPosition), t.divideToRef(i._radius, this._scaledVelocity), - i.collidedMesh = null, - i._retry = 0, - i._initialVelocity = this._scaledVelocity, - i._initialPosition = this._scaledPosition, - this._collideWithWorld(this._scaledPosition, this._scaledVelocity, i, n, this._finalPosition, r), + (i.collidedMesh = null), + (i._retry = 0), + (i._initialVelocity = this._scaledVelocity), + (i._initialPosition = this._scaledPosition), + this._collideWithWorld( + this._scaledPosition, + this._scaledVelocity, + i, + n, + this._finalPosition, + r + ), this._finalPosition.multiplyInPlace(i._radius), - o(a, this._finalPosition, i.collidedMesh) - } - , - e.prototype.createCollider = function() { - return new Yi - } - , - e.prototype.init = function(e) { - this._scene = e - } - , - e.prototype._collideWithWorld = function(e, t, i, n, r, o) { - void 0 === o && (o = null); - var a = 10 * ve.b.CollisionsEpsilon; - if (i._retry >= n) - r.copyFrom(e); - else { - var s = o ? o.collisionMask : i.collisionMask; - i._initialize(e, t, a); - for (var c = 0; c < this._scene.meshes.length; c++) { - var u = this._scene.meshes[c]; - u.isEnabled() && u.checkCollisions && u.subMeshes && u !== o && 0 != (s & u.collisionGroup) && u._checkCollision(i) - } - i.collisionFound ? (0 === t.x && 0 === t.y && 0 === t.z || i._getResponse(e, t), - t.length() <= a ? r.copyFrom(e) : (i._retry++, - this._collideWithWorld(e, t, i, n, r, o))) : e.addToRef(t, r) + o(a, this._finalPosition, i.collidedMesh); + }), + (e.prototype.createCollider = function () { + return new Yi(); + }), + (e.prototype.init = function (e) { + this._scene = e; + }), + (e.prototype._collideWithWorld = function ( + e, + t, + i, + n, + r, + o + ) { + void 0 === o && (o = null); + var a = 10 * ve.b.CollisionsEpsilon; + if (i._retry >= n) r.copyFrom(e); + else { + var s = o ? o.collisionMask : i.collisionMask; + i._initialize(e, t, a); + for (var c = 0; c < this._scene.meshes.length; c++) { + var u = this._scene.meshes[c]; + u.isEnabled() && + u.checkCollisions && + u.subMeshes && + u !== o && + 0 != (s & u.collisionGroup) && + u._checkCollision(i); } - } - , + i.collisionFound + ? ((0 === t.x && 0 === t.y && 0 === t.z) || + i._getResponse(e, t), + t.length() <= a + ? r.copyFrom(e) + : (i._retry++, + this._collideWithWorld(e, t, i, n, r, o))) + : e.addToRef(t, r); + } + }), e - }(); - Y.a.CollisionCoordinatorFactory = function() { - return new Ki - } - ; - var Qi = n(50) - , qi = n(81) - , Zi = n(108) - , Ji = n(77) - , $i = n(43) - , en = n(82) - , tn = function() { - function e(e, t, i, n, r, o) { - this.entries = new Array, - this._boundingVectors = new Array, - this._capacity = i, - this._depth = n, - this._maxDepth = r, - this._creationFunc = o, - this._minPoint = e, - this._maxPoint = t, - this._boundingVectors.push(e.clone()), - this._boundingVectors.push(t.clone()), - this._boundingVectors.push(e.clone()), - this._boundingVectors[2].x = t.x, - this._boundingVectors.push(e.clone()), - this._boundingVectors[3].y = t.y, - this._boundingVectors.push(e.clone()), - this._boundingVectors[4].z = t.z, - this._boundingVectors.push(t.clone()), - this._boundingVectors[5].z = e.z, - this._boundingVectors.push(t.clone()), - this._boundingVectors[6].x = e.x, - this._boundingVectors.push(t.clone()), - this._boundingVectors[7].y = e.y - } - return Object.defineProperty(e.prototype, "capacity", { - get: function() { - return this._capacity - }, - enumerable: true, - configurable: true + ); + })(); + Y.a.CollisionCoordinatorFactory = function () { + return new Ki(); + }; + var Qi = n(50), + qi = n(81), + Zi = n(108), + Ji = n(77), + $i = n(43), + en = n(82), + tn = (function () { + function e(e, t, i, n, r, o) { + (this.entries = new Array()), + (this._boundingVectors = new Array()), + (this._capacity = i), + (this._depth = n), + (this._maxDepth = r), + (this._creationFunc = o), + (this._minPoint = e), + (this._maxPoint = t), + this._boundingVectors.push(e.clone()), + this._boundingVectors.push(t.clone()), + this._boundingVectors.push(e.clone()), + (this._boundingVectors[2].x = t.x), + this._boundingVectors.push(e.clone()), + (this._boundingVectors[3].y = t.y), + this._boundingVectors.push(e.clone()), + (this._boundingVectors[4].z = t.z), + this._boundingVectors.push(t.clone()), + (this._boundingVectors[5].z = e.z), + this._boundingVectors.push(t.clone()), + (this._boundingVectors[6].x = e.x), + this._boundingVectors.push(t.clone()), + (this._boundingVectors[7].y = e.y); + } + return ( + Object.defineProperty(e.prototype, "capacity", { + get: function () { + return this._capacity; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "minPoint", { - get: function() { - return this._minPoint - }, - enumerable: true, - configurable: true + get: function () { + return this._minPoint; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "maxPoint", { - get: function() { - return this._maxPoint - }, - enumerable: true, - configurable: true + get: function () { + return this._maxPoint; + }, + enumerable: true, + configurable: true, }), - e.prototype.addEntry = function(e) { - if (this.blocks) - for (var t = 0; t < this.blocks.length; t++) - this.blocks[t].addEntry(e); - else - this._creationFunc(e, this), - this.entries.length > this.capacity && this._depth < this._maxDepth && this.createInnerBlocks() - } - , - e.prototype.removeEntry = function(e) { - if (this.blocks) - for (var t = 0; t < this.blocks.length; t++) - this.blocks[t].removeEntry(e); - else { - var i = this.entries.indexOf(e); - i > -1 && this.entries.splice(i, 1) + (e.prototype.addEntry = function (e) { + if (this.blocks) + for (var t = 0; t < this.blocks.length; t++) + this.blocks[t].addEntry(e); + else + this._creationFunc(e, this), + this.entries.length > this.capacity && + this._depth < this._maxDepth && + this.createInnerBlocks(); + }), + (e.prototype.removeEntry = function (e) { + if (this.blocks) + for (var t = 0; t < this.blocks.length; t++) + this.blocks[t].removeEntry(e); + else { + var i = this.entries.indexOf(e); + i > -1 && this.entries.splice(i, 1); + } + }), + (e.prototype.addEntries = function (e) { + for (var t = 0; t < e.length; t++) { + var i = e[t]; + this.addEntry(i); + } + }), + (e.prototype.select = function (e, t, i) { + if (Ji.a.IsInFrustum(this._boundingVectors, e)) { + if (this.blocks) { + for (var n = 0; n < this.blocks.length; n++) + this.blocks[n].select(e, t, i); + return; } - } - , - e.prototype.addEntries = function(e) { - for (var t = 0; t < e.length; t++) { - var i = e[t]; - this.addEntry(i) + i + ? t.concat(this.entries) + : t.concatWithNoDuplicate(this.entries); + } + }), + (e.prototype.intersects = function (e, t, i, n) { + if ( + Ji.a.IntersectsSphere( + this._minPoint, + this._maxPoint, + e, + t + ) + ) { + if (this.blocks) { + for (var r = 0; r < this.blocks.length; r++) + this.blocks[r].intersects(e, t, i, n); + return; } - } - , - e.prototype.select = function(e, t, i) { - if (Ji.a.IsInFrustum(this._boundingVectors, e)) { - if (this.blocks) { - for (var n = 0; n < this.blocks.length; n++) - this.blocks[n].select(e, t, i); - return - } - i ? t.concat(this.entries) : t.concatWithNoDuplicate(this.entries) + n + ? i.concat(this.entries) + : i.concatWithNoDuplicate(this.entries); + } + }), + (e.prototype.intersectsRay = function (e, t) { + if ( + e.intersectsBoxMinMax(this._minPoint, this._maxPoint) + ) { + if (this.blocks) { + for (var i = 0; i < this.blocks.length; i++) + this.blocks[i].intersectsRay(e, t); + return; } - } - , - e.prototype.intersects = function(e, t, i, n) { - if (Ji.a.IntersectsSphere(this._minPoint, this._maxPoint, e, t)) { - if (this.blocks) { - for (var r = 0; r < this.blocks.length; r++) - this.blocks[r].intersects(e, t, i, n); - return - } - n ? i.concat(this.entries) : i.concatWithNoDuplicate(this.entries) - } - } - , - e.prototype.intersectsRay = function(e, t) { - if (e.intersectsBoxMinMax(this._minPoint, this._maxPoint)) { - if (this.blocks) { - for (var i = 0; i < this.blocks.length; i++) - this.blocks[i].intersectsRay(e, t); - return - } - t.concatWithNoDuplicate(this.entries) - } - } - , - e.prototype.createInnerBlocks = function() { - e._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc) - } - , - e._CreateBlocks = function(t, i, n, r, o, s, c, u) { - c.blocks = new Array; - for (var l = new a.x((i.x - t.x) / 2,(i.y - t.y) / 2,(i.z - t.z) / 2), h = 0; h < 2; h++) - for (var f = 0; f < 2; f++) - for (var d = 0; d < 2; d++) { - var p = new e(t.add(l.multiplyByFloats(h, f, d)),t.add(l.multiplyByFloats(h + 1, f + 1, d + 1)),r,o + 1,s,u); - p.addEntries(n), - c.blocks.push(p) - } - } - , + t.concatWithNoDuplicate(this.entries); + } + }), + (e.prototype.createInnerBlocks = function () { + e._CreateBlocks( + this._minPoint, + this._maxPoint, + this.entries, + this._capacity, + this._depth, + this._maxDepth, + this, + this._creationFunc + ); + }), + (e._CreateBlocks = function (t, i, n, r, o, s, c, u) { + c.blocks = new Array(); + for ( + var l = new a.x( + (i.x - t.x) / 2, + (i.y - t.y) / 2, + (i.z - t.z) / 2 + ), + h = 0; + h < 2; + h++ + ) + for (var f = 0; f < 2; f++) + for (var d = 0; d < 2; d++) { + var p = new e( + t.add(l.multiplyByFloats(h, f, d)), + t.add(l.multiplyByFloats(h + 1, f + 1, d + 1)), + r, + o + 1, + s, + u + ); + p.addEntries(n), c.blocks.push(p); + } + }), e - }() - , nn = function() { - function e(e, t, i) { - void 0 === i && (i = 2), - this.maxDepth = i, - this.dynamicContent = new Array, - this._maxBlockCapacity = t || 64, - this._selectionContent = new jt.b(1024), - this._creationFunc = e - } - return e.prototype.update = function(e, t, i) { - tn._CreateBlocks(e, t, i, this._maxBlockCapacity, 0, this.maxDepth, this, this._creationFunc) - } - , - e.prototype.addMesh = function(e) { - for (var t = 0; t < this.blocks.length; t++) - this.blocks[t].addEntry(e) - } - , - e.prototype.removeMesh = function(e) { - for (var t = 0; t < this.blocks.length; t++) - this.blocks[t].removeEntry(e) - } - , - e.prototype.select = function(e, t) { - this._selectionContent.reset(); - for (var i = 0; i < this.blocks.length; i++) - this.blocks[i].select(e, this._selectionContent, t); - return t ? this._selectionContent.concat(this.dynamicContent) : this._selectionContent.concatWithNoDuplicate(this.dynamicContent), + ); + })(), + nn = (function () { + function e(e, t, i) { + void 0 === i && (i = 2), + (this.maxDepth = i), + (this.dynamicContent = new Array()), + (this._maxBlockCapacity = t || 64), + (this._selectionContent = new jt.b(1024)), + (this._creationFunc = e); + } + return ( + (e.prototype.update = function (e, t, i) { + tn._CreateBlocks( + e, + t, + i, + this._maxBlockCapacity, + 0, + this.maxDepth, + this, + this._creationFunc + ); + }), + (e.prototype.addMesh = function (e) { + for (var t = 0; t < this.blocks.length; t++) + this.blocks[t].addEntry(e); + }), + (e.prototype.removeMesh = function (e) { + for (var t = 0; t < this.blocks.length; t++) + this.blocks[t].removeEntry(e); + }), + (e.prototype.select = function (e, t) { + this._selectionContent.reset(); + for (var i = 0; i < this.blocks.length; i++) + this.blocks[i].select(e, this._selectionContent, t); + return ( + t + ? this._selectionContent.concat(this.dynamicContent) + : this._selectionContent.concatWithNoDuplicate( + this.dynamicContent + ), this._selectionContent - } - , - e.prototype.intersects = function(e, t, i) { - this._selectionContent.reset(); - for (var n = 0; n < this.blocks.length; n++) - this.blocks[n].intersects(e, t, this._selectionContent, i); - return i ? this._selectionContent.concat(this.dynamicContent) : this._selectionContent.concatWithNoDuplicate(this.dynamicContent), + ); + }), + (e.prototype.intersects = function (e, t, i) { + this._selectionContent.reset(); + for (var n = 0; n < this.blocks.length; n++) + this.blocks[n].intersects( + e, + t, + this._selectionContent, + i + ); + return ( + i + ? this._selectionContent.concat(this.dynamicContent) + : this._selectionContent.concatWithNoDuplicate( + this.dynamicContent + ), this._selectionContent - } - , - e.prototype.intersectsRay = function(e) { - this._selectionContent.reset(); - for (var t = 0; t < this.blocks.length; t++) - this.blocks[t].intersectsRay(e, this._selectionContent); - return this._selectionContent.concatWithNoDuplicate(this.dynamicContent), + ); + }), + (e.prototype.intersectsRay = function (e) { + this._selectionContent.reset(); + for (var t = 0; t < this.blocks.length; t++) + this.blocks[t].intersectsRay(e, this._selectionContent); + return ( + this._selectionContent.concatWithNoDuplicate( + this.dynamicContent + ), this._selectionContent - } - , - e.CreationFuncForMeshes = function(e, t) { - var i = e.getBoundingInfo(); - !e.isBlocked && i.boundingBox.intersectsMinMax(t.minPoint, t.maxPoint) && t.entries.push(e) - } - , - e.CreationFuncForSubMeshes = function(e, t) { - e.getBoundingInfo().boundingBox.intersectsMinMax(t.minPoint, t.maxPoint) && t.entries.push(e) - } - , + ); + }), + (e.CreationFuncForMeshes = function (e, t) { + var i = e.getBoundingInfo(); + !e.isBlocked && + i.boundingBox.intersectsMinMax( + t.minPoint, + t.maxPoint + ) && + t.entries.push(e); + }), + (e.CreationFuncForSubMeshes = function (e, t) { + e + .getBoundingInfo() + .boundingBox.intersectsMinMax(t.minPoint, t.maxPoint) && + t.entries.push(e); + }), e - }(); - Y.a.prototype.createOrUpdateSelectionOctree = function(e, t) { - void 0 === e && (e = 64), - void 0 === t && (t = 2); - var i = this._getComponent(Se.a.NAME_OCTREE); - i || (i = new rn(this), - this._addComponent(i)), - this._selectionOctree || (this._selectionOctree = new nn(nn.CreationFuncForMeshes,e,t)); - var n = this.getWorldExtends(); - return this._selectionOctree.update(n.min, n.max, this.meshes), - this._selectionOctree - } - , + ); + })(); + (Y.a.prototype.createOrUpdateSelectionOctree = function (e, t) { + void 0 === e && (e = 64), void 0 === t && (t = 2); + var i = this._getComponent(Se.a.NAME_OCTREE); + i || ((i = new rn(this)), this._addComponent(i)), + this._selectionOctree || + (this._selectionOctree = new nn( + nn.CreationFuncForMeshes, + e, + t + )); + var n = this.getWorldExtends(); + return ( + this._selectionOctree.update(n.min, n.max, this.meshes), + this._selectionOctree + ); + }), Object.defineProperty(Y.a.prototype, "selectionOctree", { - get: function() { - return this._selectionOctree - }, - enumerable: true, - configurable: true + get: function () { + return this._selectionOctree; + }, + enumerable: true, + configurable: true, }), - Ne.a.prototype.createOrUpdateSubmeshesOctree = function(e, t) { - void 0 === e && (e = 64), - void 0 === t && (t = 2); - var i = this.getScene() - , n = i._getComponent(Se.a.NAME_OCTREE); - n || (n = new rn(i), - i._addComponent(n)), - this._submeshesOctree || (this._submeshesOctree = new nn(nn.CreationFuncForSubMeshes,e,t)), + (Ne.a.prototype.createOrUpdateSubmeshesOctree = function ( + e, + t + ) { + void 0 === e && (e = 64), void 0 === t && (t = 2); + var i = this.getScene(), + n = i._getComponent(Se.a.NAME_OCTREE); + n || ((n = new rn(i)), i._addComponent(n)), + this._submeshesOctree || + (this._submeshesOctree = new nn( + nn.CreationFuncForSubMeshes, + e, + t + )), this.computeWorldMatrix(true); - var r = this.getBoundingInfo().boundingBox; - return this._submeshesOctree.update(r.minimumWorld, r.maximumWorld, this.subMeshes), + var r = this.getBoundingInfo().boundingBox; + return ( + this._submeshesOctree.update( + r.minimumWorld, + r.maximumWorld, + this.subMeshes + ), this._submeshesOctree - } - ; - var rn = function() { - function e(e) { - this.name = Se.a.NAME_OCTREE, - this.checksIsEnabled = true, - this._tempRay = new Dt.a(a.x.Zero(),new a.x(1,1,1)), - this.scene = e, - this.scene.getActiveMeshCandidates = this.getActiveMeshCandidates.bind(this), - this.scene.getActiveSubMeshCandidates = this.getActiveSubMeshCandidates.bind(this), - this.scene.getCollidingSubMeshCandidates = this.getCollidingSubMeshCandidates.bind(this), - this.scene.getIntersectingSubMeshCandidates = this.getIntersectingSubMeshCandidates.bind(this) - } - return e.prototype.register = function() { - var e = this; - this.scene.onMeshRemovedObservable.add(function(t) { - var i = e.scene.selectionOctree; - if (null != i) { - var n = i.dynamicContent.indexOf(t); - -1 !== n && i.dynamicContent.splice(n, 1) - } - }), - this.scene.onMeshImportedObservable.add(function(t) { - var i = e.scene.selectionOctree; - null != i && i.addMesh(t) - }) - } - , - e.prototype.getActiveMeshCandidates = function() { - return this.scene._selectionOctree ? this.scene._selectionOctree.select(this.scene.frustumPlanes) : this.scene._getDefaultMeshCandidates() - } - , - e.prototype.getActiveSubMeshCandidates = function(e) { - return e._submeshesOctree && e.useOctreeForRenderingSelection ? e._submeshesOctree.select(this.scene.frustumPlanes) : this.scene._getDefaultSubMeshCandidates(e) - } - , - e.prototype.getIntersectingSubMeshCandidates = function(e, t) { - return e._submeshesOctree && e.useOctreeForPicking ? (Dt.a.TransformToRef(t, e.getWorldMatrix(), this._tempRay), - e._submeshesOctree.intersectsRay(this._tempRay)) : this.scene._getDefaultSubMeshCandidates(e) - } - , - e.prototype.getCollidingSubMeshCandidates = function(e, t) { - if (e._submeshesOctree && e.useOctreeForCollisions) { - var i = t._velocityWorldLength + Math.max(t._radius.x, t._radius.y, t._radius.z); - return e._submeshesOctree.intersects(t._basePointWorld, i) + ); + }); + var rn = (function () { + function e(e) { + (this.name = Se.a.NAME_OCTREE), + (this.checksIsEnabled = true), + (this._tempRay = new Dt.a(a.x.Zero(), new a.x(1, 1, 1))), + (this.scene = e), + (this.scene.getActiveMeshCandidates = + this.getActiveMeshCandidates.bind(this)), + (this.scene.getActiveSubMeshCandidates = + this.getActiveSubMeshCandidates.bind(this)), + (this.scene.getCollidingSubMeshCandidates = + this.getCollidingSubMeshCandidates.bind(this)), + (this.scene.getIntersectingSubMeshCandidates = + this.getIntersectingSubMeshCandidates.bind(this)); + } + return ( + (e.prototype.register = function () { + var e = this; + this.scene.onMeshRemovedObservable.add(function (t) { + var i = e.scene.selectionOctree; + if (null != i) { + var n = i.dynamicContent.indexOf(t); + -1 !== n && i.dynamicContent.splice(n, 1); } - return this.scene._getDefaultSubMeshCandidates(e) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() {} - , + }), + this.scene.onMeshImportedObservable.add(function (t) { + var i = e.scene.selectionOctree; + null != i && i.addMesh(t); + }); + }), + (e.prototype.getActiveMeshCandidates = function () { + return this.scene._selectionOctree + ? this.scene._selectionOctree.select( + this.scene.frustumPlanes + ) + : this.scene._getDefaultMeshCandidates(); + }), + (e.prototype.getActiveSubMeshCandidates = function (e) { + return e._submeshesOctree && + e.useOctreeForRenderingSelection + ? e._submeshesOctree.select(this.scene.frustumPlanes) + : this.scene._getDefaultSubMeshCandidates(e); + }), + (e.prototype.getIntersectingSubMeshCandidates = function ( + e, + t + ) { + return e._submeshesOctree && e.useOctreeForPicking + ? (Dt.a.TransformToRef( + t, + e.getWorldMatrix(), + this._tempRay + ), + e._submeshesOctree.intersectsRay(this._tempRay)) + : this.scene._getDefaultSubMeshCandidates(e); + }), + (e.prototype.getCollidingSubMeshCandidates = function ( + e, + t + ) { + if (e._submeshesOctree && e.useOctreeForCollisions) { + var i = + t._velocityWorldLength + + Math.max(t._radius.x, t._radius.y, t._radius.z); + return e._submeshesOctree.intersects( + t._basePointWorld, + i + ); + } + return this.scene._getDefaultSubMeshCandidates(e); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () {}), e - }() - , on = n(74) - , an = n(128) - , sn = function() { - this._timeElapsedQueryEnded = false - } - , cn = function() { - this.occlusionInternalRetryCounter = 0, - this.isOcclusionQueryInProgress = false, - this.isOccluded = false, - this.occlusionRetryCount = -1, - this.occlusionType = Ne.a.OCCLUSION_TYPE_NONE, - this.occlusionQueryAlgorithmType = Ne.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE + ); + })(), + on = n(74), + an = n(128), + sn = function () { + this._timeElapsedQueryEnded = false; + }, + cn = function () { + (this.occlusionInternalRetryCounter = 0), + (this.isOcclusionQueryInProgress = false), + (this.isOccluded = false), + (this.occlusionRetryCount = -1), + (this.occlusionType = Ne.a.OCCLUSION_TYPE_NONE), + (this.occlusionQueryAlgorithmType = + Ne.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE); }; - ve.b.prototype.createQuery = function() { - return this._gl.createQuery() - } - , - ve.b.prototype.deleteQuery = function(e) { - return this._gl.deleteQuery(e), - this - } - , - ve.b.prototype.isQueryResultAvailable = function(e) { - return this._gl.getQueryParameter(e, this._gl.QUERY_RESULT_AVAILABLE) - } - , - ve.b.prototype.getQueryResult = function(e) { - return this._gl.getQueryParameter(e, this._gl.QUERY_RESULT) - } - , - ve.b.prototype.beginOcclusionQuery = function(e, t) { - var i = this._getGlAlgorithmType(e); - return this._gl.beginQuery(i, t), - this - } - , - ve.b.prototype.endOcclusionQuery = function(e) { - var t = this._getGlAlgorithmType(e); - return this._gl.endQuery(t), - this - } - , - ve.b.prototype._createTimeQuery = function() { - var e = this.getCaps().timerQuery; - return e.createQueryEXT ? e.createQueryEXT() : this.createQuery() - } - , - ve.b.prototype._deleteTimeQuery = function(e) { - var t = this.getCaps().timerQuery; - t.deleteQueryEXT ? t.deleteQueryEXT(e) : this.deleteQuery(e) - } - , - ve.b.prototype._getTimeQueryResult = function(e) { - var t = this.getCaps().timerQuery; - return t.getQueryObjectEXT ? t.getQueryObjectEXT(e, t.QUERY_RESULT_EXT) : this.getQueryResult(e) - } - , - ve.b.prototype._getTimeQueryAvailability = function(e) { - var t = this.getCaps().timerQuery; - return t.getQueryObjectEXT ? t.getQueryObjectEXT(e, t.QUERY_RESULT_AVAILABLE_EXT) : this.isQueryResultAvailable(e) - } - , - ve.b.prototype.startTimeQuery = function() { - var e = this.getCaps() - , t = e.timerQuery; - if (!t) - return null; - var i = new sn; - if (this._gl.getParameter(t.GPU_DISJOINT_EXT), - e.canUseTimestampForTimerQuery) - i._startTimeQuery = this._createTimeQuery(), - t.queryCounterEXT(i._startTimeQuery, t.TIMESTAMP_EXT); - else { - if (this._currentNonTimestampToken) - return this._currentNonTimestampToken; - i._timeElapsedQuery = this._createTimeQuery(), - t.beginQueryEXT ? t.beginQueryEXT(t.TIME_ELAPSED_EXT, i._timeElapsedQuery) : this._gl.beginQuery(t.TIME_ELAPSED_EXT, i._timeElapsedQuery), - this._currentNonTimestampToken = i - } - return i - } - , - ve.b.prototype.endTimeQuery = function(e) { - var t = this.getCaps() - , i = t.timerQuery; - if (!i || !e) - return -1; - if (t.canUseTimestampForTimerQuery) { - if (!e._startTimeQuery) - return -1; - e._endTimeQuery || (e._endTimeQuery = this._createTimeQuery(), - i.queryCounterEXT(e._endTimeQuery, i.TIMESTAMP_EXT)) - } else if (!e._timeElapsedQueryEnded) { - if (!e._timeElapsedQuery) - return -1; - i.endQueryEXT ? i.endQueryEXT(i.TIME_ELAPSED_EXT) : this._gl.endQuery(i.TIME_ELAPSED_EXT), - e._timeElapsedQueryEnded = true - } - var n = this._gl.getParameter(i.GPU_DISJOINT_EXT) - , r = false; - if (e._endTimeQuery ? r = this._getTimeQueryAvailability(e._endTimeQuery) : e._timeElapsedQuery && (r = this._getTimeQueryAvailability(e._timeElapsedQuery)), - r && !n) { - var o = 0; - if (t.canUseTimestampForTimerQuery) { - if (!e._startTimeQuery || !e._endTimeQuery) - return -1; - var a = this._getTimeQueryResult(e._startTimeQuery); - o = this._getTimeQueryResult(e._endTimeQuery) - a, - this._deleteTimeQuery(e._startTimeQuery), - this._deleteTimeQuery(e._endTimeQuery), - e._startTimeQuery = null, - e._endTimeQuery = null - } else { - if (!e._timeElapsedQuery) - return -1; - o = this._getTimeQueryResult(e._timeElapsedQuery), - this._deleteTimeQuery(e._timeElapsedQuery), - e._timeElapsedQuery = null, - e._timeElapsedQueryEnded = false, - this._currentNonTimestampToken = null - } - return o - } - return -1 - } - , - ve.b.prototype._getGlAlgorithmType = function(e) { - return e === Ne.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED - } - , - Object.defineProperty(Ne.a.prototype, "isOcclusionQueryInProgress", { - get: function() { - return this._occlusionDataStorage.isOcclusionQueryInProgress - }, - enumerable: false, - configurable: true + (ve.b.prototype.createQuery = function () { + return this._gl.createQuery(); + }), + (ve.b.prototype.deleteQuery = function (e) { + return this._gl.deleteQuery(e), this; }), - Object.defineProperty(Ne.a.prototype, "_occlusionDataStorage", { - get: function() { - return this.__occlusionDataStorage || (this.__occlusionDataStorage = new cn), - this.__occlusionDataStorage + (ve.b.prototype.isQueryResultAvailable = function (e) { + return this._gl.getQueryParameter( + e, + this._gl.QUERY_RESULT_AVAILABLE + ); + }), + (ve.b.prototype.getQueryResult = function (e) { + return this._gl.getQueryParameter(e, this._gl.QUERY_RESULT); + }), + (ve.b.prototype.beginOcclusionQuery = function (e, t) { + var i = this._getGlAlgorithmType(e); + return this._gl.beginQuery(i, t), this; + }), + (ve.b.prototype.endOcclusionQuery = function (e) { + var t = this._getGlAlgorithmType(e); + return this._gl.endQuery(t), this; + }), + (ve.b.prototype._createTimeQuery = function () { + var e = this.getCaps().timerQuery; + return e.createQueryEXT + ? e.createQueryEXT() + : this.createQuery(); + }), + (ve.b.prototype._deleteTimeQuery = function (e) { + var t = this.getCaps().timerQuery; + t.deleteQueryEXT ? t.deleteQueryEXT(e) : this.deleteQuery(e); + }), + (ve.b.prototype._getTimeQueryResult = function (e) { + var t = this.getCaps().timerQuery; + return t.getQueryObjectEXT + ? t.getQueryObjectEXT(e, t.QUERY_RESULT_EXT) + : this.getQueryResult(e); + }), + (ve.b.prototype._getTimeQueryAvailability = function (e) { + var t = this.getCaps().timerQuery; + return t.getQueryObjectEXT + ? t.getQueryObjectEXT(e, t.QUERY_RESULT_AVAILABLE_EXT) + : this.isQueryResultAvailable(e); + }), + (ve.b.prototype.startTimeQuery = function () { + var e = this.getCaps(), + t = e.timerQuery; + if (!t) return null; + var i = new sn(); + if ( + (this._gl.getParameter(t.GPU_DISJOINT_EXT), + e.canUseTimestampForTimerQuery) + ) + (i._startTimeQuery = this._createTimeQuery()), + t.queryCounterEXT(i._startTimeQuery, t.TIMESTAMP_EXT); + else { + if (this._currentNonTimestampToken) + return this._currentNonTimestampToken; + (i._timeElapsedQuery = this._createTimeQuery()), + t.beginQueryEXT + ? t.beginQueryEXT( + t.TIME_ELAPSED_EXT, + i._timeElapsedQuery + ) + : this._gl.beginQuery( + t.TIME_ELAPSED_EXT, + i._timeElapsedQuery + ), + (this._currentNonTimestampToken = i); + } + return i; + }), + (ve.b.prototype.endTimeQuery = function (e) { + var t = this.getCaps(), + i = t.timerQuery; + if (!i || !e) return -1; + if (t.canUseTimestampForTimerQuery) { + if (!e._startTimeQuery) return -1; + e._endTimeQuery || + ((e._endTimeQuery = this._createTimeQuery()), + i.queryCounterEXT(e._endTimeQuery, i.TIMESTAMP_EXT)); + } else if (!e._timeElapsedQueryEnded) { + if (!e._timeElapsedQuery) return -1; + i.endQueryEXT + ? i.endQueryEXT(i.TIME_ELAPSED_EXT) + : this._gl.endQuery(i.TIME_ELAPSED_EXT), + (e._timeElapsedQueryEnded = true); + } + var n = this._gl.getParameter(i.GPU_DISJOINT_EXT), + r = false; + if ( + (e._endTimeQuery + ? (r = this._getTimeQueryAvailability(e._endTimeQuery)) + : e._timeElapsedQuery && + (r = this._getTimeQueryAvailability( + e._timeElapsedQuery + )), + r && !n) + ) { + var o = 0; + if (t.canUseTimestampForTimerQuery) { + if (!e._startTimeQuery || !e._endTimeQuery) return -1; + var a = this._getTimeQueryResult(e._startTimeQuery); + (o = this._getTimeQueryResult(e._endTimeQuery) - a), + this._deleteTimeQuery(e._startTimeQuery), + this._deleteTimeQuery(e._endTimeQuery), + (e._startTimeQuery = null), + (e._endTimeQuery = null); + } else { + if (!e._timeElapsedQuery) return -1; + (o = this._getTimeQueryResult(e._timeElapsedQuery)), + this._deleteTimeQuery(e._timeElapsedQuery), + (e._timeElapsedQuery = null), + (e._timeElapsedQueryEnded = false), + (this._currentNonTimestampToken = null); + } + return o; + } + return -1; + }), + (ve.b.prototype._getGlAlgorithmType = function (e) { + return e === Ne.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE + ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE + : this._gl.ANY_SAMPLES_PASSED; + }), + Object.defineProperty( + Ne.a.prototype, + "isOcclusionQueryInProgress", + { + get: function () { + return this._occlusionDataStorage + .isOcclusionQueryInProgress; }, enumerable: false, - configurable: true + configurable: true, + } + ), + Object.defineProperty(Ne.a.prototype, "_occlusionDataStorage", { + get: function () { + return ( + this.__occlusionDataStorage || + (this.__occlusionDataStorage = new cn()), + this.__occlusionDataStorage + ); + }, + enumerable: false, + configurable: true, }), Object.defineProperty(Ne.a.prototype, "isOccluded", { - get: function() { - return this._occlusionDataStorage.isOccluded + get: function () { + return this._occlusionDataStorage.isOccluded; + }, + set: function (e) { + this._occlusionDataStorage.isOccluded = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + Ne.a.prototype, + "occlusionQueryAlgorithmType", + { + get: function () { + return this._occlusionDataStorage + .occlusionQueryAlgorithmType; }, - set: function(e) { - this._occlusionDataStorage.isOccluded = e + set: function (e) { + this._occlusionDataStorage.occlusionQueryAlgorithmType = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(Ne.a.prototype, "occlusionQueryAlgorithmType", { - get: function() { - return this._occlusionDataStorage.occlusionQueryAlgorithmType - }, - set: function(e) { - this._occlusionDataStorage.occlusionQueryAlgorithmType = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(Ne.a.prototype, "occlusionType", { - get: function() { - return this._occlusionDataStorage.occlusionType - }, - set: function(e) { - this._occlusionDataStorage.occlusionType = e - }, - enumerable: true, - configurable: true + get: function () { + return this._occlusionDataStorage.occlusionType; + }, + set: function (e) { + this._occlusionDataStorage.occlusionType = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(Ne.a.prototype, "occlusionRetryCount", { - get: function() { - return this._occlusionDataStorage.occlusionRetryCount - }, - set: function(e) { - this._occlusionDataStorage.occlusionRetryCount = e - }, - enumerable: true, - configurable: true + get: function () { + return this._occlusionDataStorage.occlusionRetryCount; + }, + set: function (e) { + this._occlusionDataStorage.occlusionRetryCount = e; + }, + enumerable: true, + configurable: true, }), - Ne.a.prototype._checkOcclusionQuery = function() { - var e = this._occlusionDataStorage; - if (e.occlusionType === Ne.a.OCCLUSION_TYPE_NONE) - return e.isOccluded = false, - false; - var t = this.getEngine(); - if (t.webGLVersion < 2) - return e.isOccluded = false, - false; - if (!t.isQueryResultAvailable) - return e.isOccluded = false, - false; - if (this.isOcclusionQueryInProgress && this._occlusionQuery) - if (t.isQueryResultAvailable(this._occlusionQuery)) { - var i = t.getQueryResult(this._occlusionQuery); - e.isOcclusionQueryInProgress = false, - e.occlusionInternalRetryCounter = 0, - e.isOccluded = 1 !== i - } else { - if (e.occlusionInternalRetryCounter++, - !(-1 !== e.occlusionRetryCount && e.occlusionInternalRetryCounter > e.occlusionRetryCount)) - return false; - e.isOcclusionQueryInProgress = false, - e.occlusionInternalRetryCounter = 0, - e.isOccluded = e.occlusionType !== Ne.a.OCCLUSION_TYPE_OPTIMISTIC && e.isOccluded - } - var n = this.getScene(); - if (n.getBoundingBoxRenderer) { - var r = n.getBoundingBoxRenderer(); - this._occlusionQuery || (this._occlusionQuery = t.createQuery()), - t.beginOcclusionQuery(e.occlusionQueryAlgorithmType, this._occlusionQuery), - r.renderOcclusionBoundingBox(this), - t.endOcclusionQuery(e.occlusionQueryAlgorithmType), - this._occlusionDataStorage.isOcclusionQueryInProgress = true + (Ne.a.prototype._checkOcclusionQuery = function () { + var e = this._occlusionDataStorage; + if (e.occlusionType === Ne.a.OCCLUSION_TYPE_NONE) + return (e.isOccluded = false), false; + var t = this.getEngine(); + if (t.webGLVersion < 2) return (e.isOccluded = false), false; + if (!t.isQueryResultAvailable) + return (e.isOccluded = false), false; + if (this.isOcclusionQueryInProgress && this._occlusionQuery) + if (t.isQueryResultAvailable(this._occlusionQuery)) { + var i = t.getQueryResult(this._occlusionQuery); + (e.isOcclusionQueryInProgress = false), + (e.occlusionInternalRetryCounter = 0), + (e.isOccluded = 1 !== i); + } else { + if ( + (e.occlusionInternalRetryCounter++, + !( + -1 !== e.occlusionRetryCount && + e.occlusionInternalRetryCounter > + e.occlusionRetryCount + )) + ) + return false; + (e.isOcclusionQueryInProgress = false), + (e.occlusionInternalRetryCounter = 0), + (e.isOccluded = + e.occlusionType !== Ne.a.OCCLUSION_TYPE_OPTIMISTIC && + e.isOccluded); } - return e.isOccluded - } - , - ve.b.prototype.createTransformFeedback = function() { - return this._gl.createTransformFeedback() - } - , - ve.b.prototype.deleteTransformFeedback = function(e) { - this._gl.deleteTransformFeedback(e) - } - , - ve.b.prototype.bindTransformFeedback = function(e) { - this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, e) - } - , - ve.b.prototype.beginTransformFeedback = function(e) { - void 0 === e && (e = true), - this._gl.beginTransformFeedback(e ? this._gl.POINTS : this._gl.TRIANGLES) - } - , - ve.b.prototype.endTransformFeedback = function() { - this._gl.endTransformFeedback() - } - , - ve.b.prototype.setTranformFeedbackVaryings = function(e, t) { - this._gl.transformFeedbackVaryings(e, t, this._gl.INTERLEAVED_ATTRIBS) - } - , - ve.b.prototype.bindTransformFeedbackBuffer = function(e) { - this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, e ? e.underlyingResource : null) - } - ; - var un = n(107) - , ln = function() { - function e() {} - return e.COPY = 1, - e.CUT = 2, - e.PASTE = 3, + var n = this.getScene(); + if (n.getBoundingBoxRenderer) { + var r = n.getBoundingBoxRenderer(); + this._occlusionQuery || + (this._occlusionQuery = t.createQuery()), + t.beginOcclusionQuery( + e.occlusionQueryAlgorithmType, + this._occlusionQuery + ), + r.renderOcclusionBoundingBox(this), + t.endOcclusionQuery(e.occlusionQueryAlgorithmType), + (this._occlusionDataStorage.isOcclusionQueryInProgress = true); + } + return e.isOccluded; + }), + (ve.b.prototype.createTransformFeedback = function () { + return this._gl.createTransformFeedback(); + }), + (ve.b.prototype.deleteTransformFeedback = function (e) { + this._gl.deleteTransformFeedback(e); + }), + (ve.b.prototype.bindTransformFeedback = function (e) { + this._gl.bindTransformFeedback( + this._gl.TRANSFORM_FEEDBACK, e - }() - , hn = function() { - function e(e, t) { - this.type = e, - this.event = t - } - return e.GetTypeFromCharacter = function(e) { - switch (e) { + ); + }), + (ve.b.prototype.beginTransformFeedback = function (e) { + void 0 === e && (e = true), + this._gl.beginTransformFeedback( + e ? this._gl.POINTS : this._gl.TRIANGLES + ); + }), + (ve.b.prototype.endTransformFeedback = function () { + this._gl.endTransformFeedback(); + }), + (ve.b.prototype.setTranformFeedbackVaryings = function (e, t) { + this._gl.transformFeedbackVaryings( + e, + t, + this._gl.INTERLEAVED_ATTRIBS + ); + }), + (ve.b.prototype.bindTransformFeedbackBuffer = function (e) { + this._gl.bindBufferBase( + this._gl.TRANSFORM_FEEDBACK_BUFFER, + 0, + e ? e.underlyingResource : null + ); + }); + var un = n(107), + ln = (function () { + function e() {} + return (e.COPY = 1), (e.CUT = 2), (e.PASTE = 3), e; + })(), + hn = (function () { + function e(e, t) { + (this.type = e), (this.event = t); + } + return ( + (e.GetTypeFromCharacter = function (e) { + switch (e) { case 67: - return ln.COPY; + return ln.COPY; case 86: - return ln.PASTE; + return ln.PASTE; case 88: - return ln.CUT; + return ln.CUT; default: - return -1 - } - } - , - e - }() - , fn = n(59) - , dn = n(55) - , pn = function() { - function e(e, t, i) { - this.lengthComputable = e, - this.loaded = t, - this.total = i - } - return e.FromProgressEvent = function(t) { - return new e(t.lengthComputable,t.loaded,t.total) - } - , - e - }() - , mn = function() { - function e() {} - return Object.defineProperty(e, "ForceFullSceneLoadingForIncremental", { - get: function() { - return dn.a.ForceFullSceneLoadingForIncremental - }, - set: function(e) { - dn.a.ForceFullSceneLoadingForIncremental = e - }, - enumerable: true, - configurable: true + return -1; + } }), - Object.defineProperty(e, "ShowLoadingScreen", { - get: function() { - return dn.a.ShowLoadingScreen + e + ); + })(), + fn = n(59), + dn = n(55), + pn = (function () { + function e(e, t, i) { + (this.lengthComputable = e), + (this.loaded = t), + (this.total = i); + } + return ( + (e.FromProgressEvent = function (t) { + return new e(t.lengthComputable, t.loaded, t.total); + }), + e + ); + })(), + mn = (function () { + function e() {} + return ( + Object.defineProperty( + e, + "ForceFullSceneLoadingForIncremental", + { + get: function () { + return dn.a.ForceFullSceneLoadingForIncremental; }, - set: function(e) { - dn.a.ShowLoadingScreen = e + set: function (e) { + dn.a.ForceFullSceneLoadingForIncremental = e; }, enumerable: true, - configurable: true + configurable: true, + } + ), + Object.defineProperty(e, "ShowLoadingScreen", { + get: function () { + return dn.a.ShowLoadingScreen; + }, + set: function (e) { + dn.a.ShowLoadingScreen = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "loggingLevel", { - get: function() { - return dn.a.loggingLevel - }, - set: function(e) { - dn.a.loggingLevel = e - }, - enumerable: true, - configurable: true + get: function () { + return dn.a.loggingLevel; + }, + set: function (e) { + dn.a.loggingLevel = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e, "CleanBoneMatrixWeights", { - get: function() { - return dn.a.CleanBoneMatrixWeights - }, - set: function(e) { - dn.a.CleanBoneMatrixWeights = e - }, - enumerable: true, - configurable: true + get: function () { + return dn.a.CleanBoneMatrixWeights; + }, + set: function (e) { + dn.a.CleanBoneMatrixWeights = e; + }, + enumerable: true, + configurable: true, }), - e._getDefaultPlugin = function() { - return e._registeredPlugins[".babylon"] - } - , - e._getPluginForExtension = function(t) { - return e._registeredPlugins[t] || (g.a.Warn("Unable to find a plugin to load " + t + " files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: http://doc.babylonjs.com/how_to/load_from_any_file_type"), + (e._getDefaultPlugin = function () { + return e._registeredPlugins[".babylon"]; + }), + (e._getPluginForExtension = function (t) { + return ( + e._registeredPlugins[t] || + (g.a.Warn( + "Unable to find a plugin to load " + + t + + " files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: http://doc.babylonjs.com/how_to/load_from_any_file_type" + ), e._getDefaultPlugin()) - } - , - e._getPluginForDirectLoad = function(t) { - for (var i in e._registeredPlugins) { - var n = e._registeredPlugins[i].plugin; - if (n.canDirectLoad && n.canDirectLoad(t)) - return e._registeredPlugins[i] - } - return e._getDefaultPlugin() - } - , - e._getPluginForFilename = function(t) { - var i = t.indexOf("?"); - -1 !== i && (t = t.substring(0, i)); - var n = t.lastIndexOf(".") - , r = t.substring(n, t.length).toLowerCase(); - return e._getPluginForExtension(r) - } - , - e._getDirectLoad = function(e) { - return "data:" === e.substr(0, 5) ? e.substr(5) : null - } - , - e._loadData = function(t, i, n, r, o, a, s) { - var c, u = e._getDirectLoad(t.name), l = s ? e._getPluginForExtension(s) : u ? e._getPluginForDirectLoad(t.name) : e._getPluginForFilename(t.name); - if (!(c = l.plugin.createPlugin ? l.plugin.createPlugin() : l.plugin)) - throw "The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before."; - var h, f = l.isBinary; - e.OnPluginActivatedObservable.notifyObservers(c); - var d = function(e, t) { - i.isDisposed ? o("Scene has been disposed") : (i.offlineProvider = h, - n(c, e, t)) - } - , p = null - , m = false - , g = c.onDisposeObservable; - g && g.add(function() { - m = true, - p && (p.abort(), - p = null), - a() + ); + }), + (e._getPluginForDirectLoad = function (t) { + for (var i in e._registeredPlugins) { + var n = e._registeredPlugins[i].plugin; + if (n.canDirectLoad && n.canDirectLoad(t)) + return e._registeredPlugins[i]; + } + return e._getDefaultPlugin(); + }), + (e._getPluginForFilename = function (t) { + var i = t.indexOf("?"); + -1 !== i && (t = t.substring(0, i)); + var n = t.lastIndexOf("."), + r = t.substring(n, t.length).toLowerCase(); + return e._getPluginForExtension(r); + }), + (e._getDirectLoad = function (e) { + return "data:" === e.substr(0, 5) ? e.substr(5) : null; + }), + (e._loadData = function (t, i, n, r, o, a, s) { + var c, + u = e._getDirectLoad(t.name), + l = s + ? e._getPluginForExtension(s) + : u + ? e._getPluginForDirectLoad(t.name) + : e._getPluginForFilename(t.name); + if ( + !(c = l.plugin.createPlugin + ? l.plugin.createPlugin() + : l.plugin) + ) + throw "The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before."; + var h, + f = l.isBinary; + e.OnPluginActivatedObservable.notifyObservers(c); + var d = function (e, t) { + i.isDisposed + ? o("Scene has been disposed") + : ((i.offlineProvider = h), n(c, e, t)); + }, + p = null, + m = false, + g = c.onDisposeObservable; + g && + g.add(function () { + (m = true), p && (p.abort(), (p = null)), a(); }); - var _ = function() { - m || (p = Ee.h.LoadFile(t.url, d, r ? function(e) { - r(pn.FromProgressEvent(e)) - } - : void 0, h, f, function(e, t) { - o("Failed to load scene." + (t ? " " + t.message : ""), t) - })) - }; - if (u) - return d(u), - c; - var v = t.file || fn.a.FilesToLoad[t.name.toLowerCase()]; - if (-1 === t.rootUrl.indexOf("file:") || -1 !== t.rootUrl.indexOf("file:") && !v) { - var y = i.getEngine() - , b = y.enableOfflineSupport; - if (b) { - for (var E = false, T = 0, A = i.disableOfflineSupportExceptionRules; T < A.length; T++) - if (A[T].test(t.url)) { - E = true; - break - } - b = !E - } - b && ve.b.OfflineProviderFactory ? h = ve.b.OfflineProviderFactory(t.url, _, y.disableManifestCheck) : _() - } else - v ? p = Ee.h.ReadFile(v, d, r, f) : o("Unable to find file named " + t.name); - return c - } - , - e._getFileInfo = function(e, t) { - var i, n, r = null; - if (t) - if (t.name) { - var o = t; - i = e + o.name, - n = o.name, - r = o - } else { - var a = t; - if ("/" === a.substr(0, 1)) - return Ee.h.Error("Wrong sceneFilename parameter"), - null; - i = e + a, - n = a - } - else - i = e, - n = Ee.h.GetFilename(e), - e = Ee.h.GetFolderPath(e); - return { - url: i, - rootUrl: e, - name: n, - file: r - } - } - , - e.GetPluginForExtension = function(t) { - return e._getPluginForExtension(t).plugin - } - , - e.IsPluginForExtensionAvailable = function(t) { - return !!e._registeredPlugins[t] - } - , - e.RegisterPlugin = function(t) { - if ("string" == typeof t.extensions) { - var i = t.extensions; - e._registeredPlugins[i.toLowerCase()] = { - plugin: t, - isBinary: false - } - } else { - var n = t.extensions; - Object.keys(n).forEach(function(i) { - e._registeredPlugins[i.toLowerCase()] = { - plugin: t, - isBinary: n[i].isBinary + var _ = function () { + m || + (p = Ee.h.LoadFile( + t.url, + d, + r + ? function (e) { + r(pn.FromProgressEvent(e)); } - }) + : void 0, + h, + f, + function (e, t) { + o( + "Failed to load scene." + + (t ? " " + t.message : ""), + t + ); + } + )); + }; + if (u) return d(u), c; + var v = t.file || fn.a.FilesToLoad[t.name.toLowerCase()]; + if ( + -1 === t.rootUrl.indexOf("file:") || + (-1 !== t.rootUrl.indexOf("file:") && !v) + ) { + var y = i.getEngine(), + b = y.enableOfflineSupport; + if (b) { + for ( + var E = false, + T = 0, + A = i.disableOfflineSupportExceptionRules; + T < A.length; + T++ + ) + if (A[T].test(t.url)) { + E = true; + break; + } + b = !E; } - } - , - e.ImportMesh = function(t, i, n, r, o, a, s, c) { - if (void 0 === n && (n = ""), + b && ve.b.OfflineProviderFactory + ? (h = ve.b.OfflineProviderFactory( + t.url, + _, + y.disableManifestCheck + )) + : _(); + } else + v + ? (p = Ee.h.ReadFile(v, d, r, f)) + : o("Unable to find file named " + t.name); + return c; + }), + (e._getFileInfo = function (e, t) { + var i, + n, + r = null; + if (t) + if (t.name) { + var o = t; + (i = e + o.name), (n = o.name), (r = o); + } else { + var a = t; + if ("/" === a.substr(0, 1)) + return ( + Ee.h.Error("Wrong sceneFilename parameter"), null + ); + (i = e + a), (n = a); + } + else + (i = e), + (n = Ee.h.GetFilename(e)), + (e = Ee.h.GetFolderPath(e)); + return { + url: i, + rootUrl: e, + name: n, + file: r, + }; + }), + (e.GetPluginForExtension = function (t) { + return e._getPluginForExtension(t).plugin; + }), + (e.IsPluginForExtensionAvailable = function (t) { + return !!e._registeredPlugins[t]; + }), + (e.RegisterPlugin = function (t) { + if ("string" == typeof t.extensions) { + var i = t.extensions; + e._registeredPlugins[i.toLowerCase()] = { + plugin: t, + isBinary: false, + }; + } else { + var n = t.extensions; + Object.keys(n).forEach(function (i) { + e._registeredPlugins[i.toLowerCase()] = { + plugin: t, + isBinary: n[i].isBinary, + }; + }); + } + }), + (e.ImportMesh = function (t, i, n, r, o, a, s, c) { + if ( + (void 0 === n && (n = ""), void 0 === r && (r = R.a.LastCreatedScene), void 0 === o && (o = null), void 0 === a && (a = null), void 0 === s && (s = null), void 0 === c && (c = null), !r) - return g.a.Error("No scene available to import mesh to"), - null; - var u = e._getFileInfo(i, n); - if (!u) - return null; - var l = {}; - r._addPendingData(l); - var h = function() { - r._removePendingData(l) - } - , f = function(e, t) { - var i = "Unable to import meshes from " + u.url + ": " + e; - s ? s(r, i, t) : g.a.Error(i), - h() - } - , d = a ? function(e) { - try { - a(e) - } catch (e) { - f("Error in onProgress callback", e) + ) + return ( + g.a.Error("No scene available to import mesh to"), + null + ); + var u = e._getFileInfo(i, n); + if (!u) return null; + var l = {}; + r._addPendingData(l); + var h = function () { + r._removePendingData(l); + }, + f = function (e, t) { + var i = + "Unable to import meshes from " + u.url + ": " + e; + s ? s(r, i, t) : g.a.Error(i), h(); + }, + d = a + ? function (e) { + try { + a(e); + } catch (e) { + f("Error in onProgress callback", e); + } } - } - : void 0 - , p = function(e, t, i, n) { - if (r.importedMeshesFiles.push(u.url), - o) - try { - o(e, t, i, n) - } catch (e) { - f("Error in onSuccess callback", e) - } - r._removePendingData(l) + : void 0, + p = function (e, t, i, n) { + if ((r.importedMeshesFiles.push(u.url), o)) + try { + o(e, t, i, n); + } catch (e) { + f("Error in onSuccess callback", e); + } + r._removePendingData(l); }; - return e._loadData(u, r, function(e, i, n) { - if (e.rewriteRootURL && (u.rootUrl = e.rewriteRootURL(u.rootUrl, n)), - e.importMesh) { - var o = e - , a = new Array - , s = new Array - , c = new Array; - if (!o.importMesh(t, r, i, u.rootUrl, a, s, c, f)) - return; - r.loadingPluginName = e.name, - p(a, s, c, []) - } else - e.importMeshAsync(t, r, i, u.rootUrl, d, u.name).then(function(t) { - r.loadingPluginName = e.name, - p(t.meshes, t.particleSystems, t.skeletons, t.animationGroups) - }).catch(function(e) { - f(e.message, e) - }) - }, d, f, h, c) - } - , - e.ImportMeshAsync = function(t, n, r, o, a, s) { - return void 0 === r && (r = ""), + return e._loadData( + u, + r, + function (e, i, n) { + if ( + (e.rewriteRootURL && + (u.rootUrl = e.rewriteRootURL(u.rootUrl, n)), + e.importMesh) + ) { + var o = e, + a = new Array(), + s = new Array(), + c = new Array(); + if (!o.importMesh(t, r, i, u.rootUrl, a, s, c, f)) + return; + (r.loadingPluginName = e.name), p(a, s, c, []); + } else + e.importMeshAsync(t, r, i, u.rootUrl, d, u.name) + .then(function (t) { + (r.loadingPluginName = e.name), + p( + t.meshes, + t.particleSystems, + t.skeletons, + t.animationGroups + ); + }) + .catch(function (e) { + f(e.message, e); + }); + }, + d, + f, + h, + c + ); + }), + (e.ImportMeshAsync = function (t, n, r, o, a, s) { + return ( + void 0 === r && (r = ""), void 0 === o && (o = R.a.LastCreatedScene), void 0 === a && (a = null), void 0 === s && (s = null), - new i(function(i, c) { - e.ImportMesh(t, n, r, o, function(e, t, n, r) { - i({ - meshes: e, - particleSystems: t, - skeletons: n, - animationGroups: r - }) - }, a, function(e, t, i) { - c(i || new Error(t)) - }, s) - } - ) - } - , - e.Load = function(t, i, n, r, o, a, s) { - return void 0 === i && (i = ""), + new i(function (i, c) { + e.ImportMesh( + t, + n, + r, + o, + function (e, t, n, r) { + i({ + meshes: e, + particleSystems: t, + skeletons: n, + animationGroups: r, + }); + }, + a, + function (e, t, i) { + c(i || new Error(t)); + }, + s + ); + }) + ); + }), + (e.Load = function (t, i, n, r, o, a, s) { + return ( + void 0 === i && (i = ""), void 0 === n && (n = R.a.LastCreatedEngine), void 0 === r && (r = null), void 0 === o && (o = null), void 0 === a && (a = null), void 0 === s && (s = null), - n ? e.Append(t, i, new Y.a(n), r, o, a, s) : (Ee.h.Error("No engine available"), - null) - } - , - e.LoadAsync = function(t, n, r, o, a) { - return void 0 === n && (n = ""), + n + ? e.Append(t, i, new Y.a(n), r, o, a, s) + : (Ee.h.Error("No engine available"), null) + ); + }), + (e.LoadAsync = function (t, n, r, o, a) { + return ( + void 0 === n && (n = ""), void 0 === r && (r = R.a.LastCreatedEngine), void 0 === o && (o = null), void 0 === a && (a = null), - new i(function(i, s) { - e.Load(t, n, r, function(e) { - i(e) - }, o, function(e, t, i) { - s(i || new Error(t)) - }, a) - } - ) - } - , - e.Append = function(t, i, n, r, o, a, s) { - if (void 0 === i && (i = ""), + new i(function (i, s) { + e.Load( + t, + n, + r, + function (e) { + i(e); + }, + o, + function (e, t, i) { + s(i || new Error(t)); + }, + a + ); + }) + ); + }), + (e.Append = function (t, i, n, r, o, a, s) { + if ( + (void 0 === i && (i = ""), void 0 === n && (n = R.a.LastCreatedScene), void 0 === r && (r = null), void 0 === o && (o = null), void 0 === a && (a = null), void 0 === s && (s = null), !n) - return g.a.Error("No scene available to append to"), - null; - var c = e._getFileInfo(t, i); - if (!c) - return null; - e.ShowLoadingScreen && n.getEngine().displayLoadingUI(); - var u = {}; - n._addPendingData(u); - var l = function() { - n._removePendingData(u), - n.getEngine().hideLoadingUI() - } - , h = function(e, t) { - var i = "Unable to load from " + c.url + (e ? ": " + e : ""); - a ? a(n, i, t) : g.a.Error(i), - l() - } - , f = o ? function(e) { - try { - o(e) - } catch (e) { - h("Error in onProgress callback", e) + ) + return ( + g.a.Error("No scene available to append to"), null + ); + var c = e._getFileInfo(t, i); + if (!c) return null; + e.ShowLoadingScreen && n.getEngine().displayLoadingUI(); + var u = {}; + n._addPendingData(u); + var l = function () { + n._removePendingData(u), + n.getEngine().hideLoadingUI(); + }, + h = function (e, t) { + var i = + "Unable to load from " + + c.url + + (e ? ": " + e : ""); + a ? a(n, i, t) : g.a.Error(i), l(); + }, + f = o + ? function (e) { + try { + o(e); + } catch (e) { + h("Error in onProgress callback", e); + } } - } - : void 0 - , d = function() { - if (r) - try { - r(n) - } catch (e) { - h("Error in onSuccess callback", e) - } - n._removePendingData(u) + : void 0, + d = function () { + if (r) + try { + r(n); + } catch (e) { + h("Error in onSuccess callback", e); + } + n._removePendingData(u); }; - return e._loadData(c, n, function(t, i) { - if (t.load) { - if (!t.load(n, i, c.rootUrl, h)) - return; - n.loadingPluginName = t.name, - d() - } else - t.loadAsync(n, i, c.rootUrl, f, c.name).then(function() { - n.loadingPluginName = t.name, - d() - }).catch(function(e) { - h(e.message, e) - }); - e.ShowLoadingScreen && n.executeWhenReady(function() { - n.getEngine().hideLoadingUI() - }) - }, f, h, l, s) - } - , - e.AppendAsync = function(t, n, r, o, a) { - return void 0 === n && (n = ""), + return e._loadData( + c, + n, + function (t, i) { + if (t.load) { + if (!t.load(n, i, c.rootUrl, h)) return; + (n.loadingPluginName = t.name), d(); + } else + t.loadAsync(n, i, c.rootUrl, f, c.name) + .then(function () { + (n.loadingPluginName = t.name), d(); + }) + .catch(function (e) { + h(e.message, e); + }); + e.ShowLoadingScreen && + n.executeWhenReady(function () { + n.getEngine().hideLoadingUI(); + }); + }, + f, + h, + l, + s + ); + }), + (e.AppendAsync = function (t, n, r, o, a) { + return ( + void 0 === n && (n = ""), void 0 === r && (r = R.a.LastCreatedScene), void 0 === o && (o = null), void 0 === a && (a = null), - new i(function(i, s) { - e.Append(t, n, r, function(e) { - i(e) - }, o, function(e, t, i) { - s(i || new Error(t)) - }, a) - } - ) - } - , - e.LoadAssetContainer = function(t, i, n, r, o, a, s) { - if (void 0 === i && (i = ""), + new i(function (i, s) { + e.Append( + t, + n, + r, + function (e) { + i(e); + }, + o, + function (e, t, i) { + s(i || new Error(t)); + }, + a + ); + }) + ); + }), + (e.LoadAssetContainer = function (t, i, n, r, o, a, s) { + if ( + (void 0 === i && (i = ""), void 0 === n && (n = R.a.LastCreatedScene), void 0 === r && (r = null), void 0 === o && (o = null), void 0 === a && (a = null), void 0 === s && (s = null), !n) - return g.a.Error("No scene available to load asset container to"), - null; - var c = e._getFileInfo(t, i); - if (!c) - return null; - var u = {}; - n._addPendingData(u); - var l = function() { - n._removePendingData(u) - } - , h = function(e, t) { - var i = "Unable to load assets from " + c.url + (e ? ": " + e : ""); - a ? a(n, i, t) : g.a.Error(i), - l() - } - , f = o ? function(e) { - try { - o(e) - } catch (e) { - h("Error in onProgress callback", e) + ) + return ( + g.a.Error( + "No scene available to load asset container to" + ), + null + ); + var c = e._getFileInfo(t, i); + if (!c) return null; + var u = {}; + n._addPendingData(u); + var l = function () { + n._removePendingData(u); + }, + h = function (e, t) { + var i = + "Unable to load assets from " + + c.url + + (e ? ": " + e : ""); + a ? a(n, i, t) : g.a.Error(i), l(); + }, + f = o + ? function (e) { + try { + o(e); + } catch (e) { + h("Error in onProgress callback", e); + } } - } - : void 0 - , d = function(e) { - if (r) - try { - r(e) - } catch (e) { - h("Error in onSuccess callback", e) - } - n._removePendingData(u) + : void 0, + d = function (e) { + if (r) + try { + r(e); + } catch (e) { + h("Error in onSuccess callback", e); + } + n._removePendingData(u); }; - return e._loadData(c, n, function(t, i) { - if (t.loadAssetContainer) { - var r = t.loadAssetContainer(n, i, c.rootUrl, h); - if (!r) - return; - n.loadingPluginName = t.name, - d(r) - } else - t.loadAssetContainerAsync ? t.loadAssetContainerAsync(n, i, c.rootUrl, f, c.name).then(function(e) { - n.loadingPluginName = t.name, - d(e) - }).catch(function(e) { - h(e.message, e) - }) : h("LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method."); - e.ShowLoadingScreen && n.executeWhenReady(function() { - n.getEngine().hideLoadingUI() - }) - }, f, h, l, s) - } - , - e.LoadAssetContainerAsync = function(t, n, r, o, a) { - return void 0 === n && (n = ""), + return e._loadData( + c, + n, + function (t, i) { + if (t.loadAssetContainer) { + var r = t.loadAssetContainer(n, i, c.rootUrl, h); + if (!r) return; + (n.loadingPluginName = t.name), d(r); + } else + t.loadAssetContainerAsync + ? t + .loadAssetContainerAsync( + n, + i, + c.rootUrl, + f, + c.name + ) + .then(function (e) { + (n.loadingPluginName = t.name), d(e); + }) + .catch(function (e) { + h(e.message, e); + }) + : h( + "LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method." + ); + e.ShowLoadingScreen && + n.executeWhenReady(function () { + n.getEngine().hideLoadingUI(); + }); + }, + f, + h, + l, + s + ); + }), + (e.LoadAssetContainerAsync = function (t, n, r, o, a) { + return ( + void 0 === n && (n = ""), void 0 === r && (r = R.a.LastCreatedScene), void 0 === o && (o = null), void 0 === a && (a = null), - new i(function(i, s) { - e.LoadAssetContainer(t, n, r, function(e) { - i(e) - }, o, function(e, t, i) { - s(i || new Error(t)) - }, a) - } - ) - } - , - e.NO_LOGGING = _.a.SCENELOADER_NO_LOGGING, - e.MINIMAL_LOGGING = _.a.SCENELOADER_MINIMAL_LOGGING, - e.SUMMARY_LOGGING = _.a.SCENELOADER_SUMMARY_LOGGING, - e.DETAILED_LOGGING = _.a.SCENELOADER_DETAILED_LOGGING, - e.OnPluginActivatedObservable = new o.c, - e._registeredPlugins = {}, + new i(function (i, s) { + e.LoadAssetContainer( + t, + n, + r, + function (e) { + i(e); + }, + o, + function (e, t, i) { + s(i || new Error(t)); + }, + a + ); + }) + ); + }), + (e.NO_LOGGING = _.a.SCENELOADER_NO_LOGGING), + (e.MINIMAL_LOGGING = _.a.SCENELOADER_MINIMAL_LOGGING), + (e.SUMMARY_LOGGING = _.a.SCENELOADER_SUMMARY_LOGGING), + (e.DETAILED_LOGGING = _.a.SCENELOADER_DETAILED_LOGGING), + (e.OnPluginActivatedObservable = new o.c()), + (e._registeredPlugins = {}), e - }() - , gn = function(e) { - function t(t) { - var i = e.call(this, t) || this; - return i.controllerType = Mt.DAYDREAM, - i - } - return h.d(t, e), - t.prototype.initControllerMesh = function(e, i) { - var n = this; - mn.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(e) { - n._defaultModel = e[1], + ); + })(), + gn = (function (e) { + function t(t) { + var i = e.call(this, t) || this; + return (i.controllerType = Mt.DAYDREAM), i; + } + return ( + h.d(t, e), + (t.prototype.initControllerMesh = function (e, i) { + var n = this; + mn.ImportMesh( + "", + t.MODEL_BASE_URL, + t.MODEL_FILENAME, + e, + function (e) { + (n._defaultModel = e[1]), n.attachToMesh(n._defaultModel), - i && i(n._defaultModel) - }) - } - , - t.prototype._handleButtonChange = function(e, t, i) { - if (0 === e) { - var n = this.onTriggerStateChangedObservable; - n && n.notifyObservers(t) - } else - g.a.Warn("Unrecognized Daydream button index: " + e) - } - , - t.MODEL_BASE_URL = "https://controllers.babylonjs.com/generic/", - t.MODEL_FILENAME = "generic.babylon", - t.GAMEPAD_ID_PREFIX = "Daydream", - t - }(vi); - Bt._ControllerFactories.push({ - canCreate: function(e) { - return 0 === e.id.indexOf(gn.GAMEPAD_ID_PREFIX) - }, - create: function(e) { - return new gn(e) - } - }); - var _n = function(e) { - function t(t) { - var i = e.call(this, t) || this; - return i._buttonIndexToObservableNameMap = ["onPadStateChangedObservable", "onTriggerStateChangedObservable"], - i.controllerType = Mt.GEAR_VR, - i._calculatedPosition = new a.x("left" == i.hand ? -.15 : .15,-.5,.25), - i._disableTrackPosition(i._calculatedPosition), - i - } - return h.d(t, e), - t.prototype.initControllerMesh = function(e, i) { - var n = this; - mn.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(t) { - var r = new me.a("",e); - t[1].parent = r, - t[1].position.z = -.15, - n._defaultModel = r, - n.attachToMesh(n._defaultModel), - i && i(n._defaultModel) - }) - } - , - t.prototype._handleButtonChange = function(e, t, i) { - if (e < this._buttonIndexToObservableNameMap.length) { - var n = this[this._buttonIndexToObservableNameMap[e]]; - n && n.notifyObservers(t) + i && i(n._defaultModel); } - } - , - t.MODEL_BASE_URL = "https://controllers.babylonjs.com/generic/", - t.MODEL_FILENAME = "generic.babylon", - t.GAMEPAD_ID_PREFIX = "Gear VR", + ); + }), + (t.prototype._handleButtonChange = function (e, t, i) { + if (0 === e) { + var n = this.onTriggerStateChangedObservable; + n && n.notifyObservers(t); + } else + g.a.Warn("Unrecognized Daydream button index: " + e); + }), + (t.MODEL_BASE_URL = + "https://controllers.babylonjs.com/generic/"), + (t.MODEL_FILENAME = "generic.babylon"), + (t.GAMEPAD_ID_PREFIX = "Daydream"), t - }(vi); - Bt._ControllerFactories.push({ - canCreate: function(e) { - return 0 === e.id.indexOf(_n.GAMEPAD_ID_PREFIX) || -1 !== e.id.indexOf("Oculus Go") - }, - create: function(e) { - return new _n(e) - } - }); - var vn = function(e) { - function t(t) { - return e.call(this, t) || this - } - return h.d(t, e), - t.prototype.initControllerMesh = function(e, i) { - var n = this; - mn.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(e) { - n._defaultModel = e[1], - n.attachToMesh(n._defaultModel), - i && i(n._defaultModel) - }) - } - , - t.prototype._handleButtonChange = function(e, t, i) { - console.log("Button id: " + e + "state: "), - console.dir(t) - } - , - t.MODEL_BASE_URL = "https://controllers.babylonjs.com/generic/", - t.MODEL_FILENAME = "generic.babylon", - t - }(vi); - Bt._DefaultControllerFactory = function(e) { - return new vn(e) + ); + })(vi); + Bt._ControllerFactories.push({ + canCreate: function (e) { + return 0 === e.id.indexOf(gn.GAMEPAD_ID_PREFIX); + }, + create: function (e) { + return new gn(e); + }, + }); + var _n = (function (e) { + function t(t) { + var i = e.call(this, t) || this; + return ( + (i._buttonIndexToObservableNameMap = [ + "onPadStateChangedObservable", + "onTriggerStateChangedObservable", + ]), + (i.controllerType = Mt.GEAR_VR), + (i._calculatedPosition = new a.x( + "left" == i.hand ? -0.15 : 0.15, + -0.5, + 0.25 + )), + i._disableTrackPosition(i._calculatedPosition), + i + ); } - ; - var yn = function(e) { - function t(t) { - var i = e.call(this, t) || this; - return i.onSecondaryTriggerStateChangedObservable = new o.c, - i.onThumbRestChangedObservable = new o.c, - i.controllerType = Mt.OCULUS, - i + return ( + h.d(t, e), + (t.prototype.initControllerMesh = function (e, i) { + var n = this; + mn.ImportMesh( + "", + t.MODEL_BASE_URL, + t.MODEL_FILENAME, + e, + function (t) { + var r = new me.a("", e); + (t[1].parent = r), + (t[1].position.z = -0.15), + (n._defaultModel = r), + n.attachToMesh(n._defaultModel), + i && i(n._defaultModel); + } + ); + }), + (t.prototype._handleButtonChange = function (e, t, i) { + if (e < this._buttonIndexToObservableNameMap.length) { + var n = this[this._buttonIndexToObservableNameMap[e]]; + n && n.notifyObservers(t); } - return h.d(t, e), - t.prototype.initControllerMesh = function(e, i) { - var n, r = this; - n = "left" === this.hand ? t.MODEL_LEFT_FILENAME : t.MODEL_RIGHT_FILENAME, - mn.ImportMesh("", t.MODEL_BASE_URL, n, e, function(e) { - r._defaultModel = e[1], - r.attachToMesh(r._defaultModel), - i && i(r._defaultModel) - }) - } - , - Object.defineProperty(t.prototype, "onAButtonStateChangedObservable", { - get: function() { - if ("right" === this.hand) - return this.onMainButtonStateChangedObservable; - throw new Error("No A button on left hand") - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onBButtonStateChangedObservable", { - get: function() { - if ("right" === this.hand) - return this.onSecondaryButtonStateChangedObservable; - throw new Error("No B button on left hand") - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onXButtonStateChangedObservable", { - get: function() { - if ("left" === this.hand) - return this.onMainButtonStateChangedObservable; - throw new Error("No X button on right hand") - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onYButtonStateChangedObservable", { - get: function() { - if ("left" === this.hand) - return this.onSecondaryButtonStateChangedObservable; - throw new Error("No Y button on right hand") - }, - enumerable: true, - configurable: true - }), - t.prototype._handleButtonChange = function(e, t, i) { - var n = t - , r = "right" === this.hand ? -1 : 1; - switch (e) { - case 0: - return void this.onPadStateChangedObservable.notifyObservers(n); - case 1: - return this._defaultModel && (this._defaultModel.getChildren()[3].rotation.x = .2 * -n.value, - this._defaultModel.getChildren()[3].position.y = .005 * -n.value, - this._defaultModel.getChildren()[3].position.z = .005 * -n.value), - void this.onTriggerStateChangedObservable.notifyObservers(n); - case 2: - return this._defaultModel && (this._defaultModel.getChildren()[4].position.x = r * n.value * .0035), - void this.onSecondaryTriggerStateChangedObservable.notifyObservers(n); - case 3: - return this._defaultModel && (n.pressed ? this._defaultModel.getChildren()[1].position.y = -.001 : this._defaultModel.getChildren()[1].position.y = 0), - void this.onMainButtonStateChangedObservable.notifyObservers(n); - case 4: - return this._defaultModel && (n.pressed ? this._defaultModel.getChildren()[2].position.y = -.001 : this._defaultModel.getChildren()[2].position.y = 0), - void this.onSecondaryButtonStateChangedObservable.notifyObservers(n); - case 5: - return void this.onThumbRestChangedObservable.notifyObservers(n) - } - } - , - t.MODEL_BASE_URL = "https://controllers.babylonjs.com/oculus/", - t.MODEL_LEFT_FILENAME = "left.babylon", - t.MODEL_RIGHT_FILENAME = "right.babylon", - t - }(vi); - Bt._ControllerFactories.push({ - canCreate: function(e) { - return -1 !== e.id.indexOf("Oculus Touch") - }, - create: function(e) { - return new yn(e) - } - }); - var bn = function(e) { - function t(t) { - var i = e.call(this, t) || this; - return i.controllerType = Mt.VIVE, - i._invertLeftStickY = true, - i - } - return h.d(t, e), - t.prototype.initControllerMesh = function(e, i) { - var n = this; - mn.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(e) { - n._defaultModel = e[1], - n.attachToMesh(n._defaultModel), - i && i(n._defaultModel) - }) - } - , - Object.defineProperty(t.prototype, "onLeftButtonStateChangedObservable", { - get: function() { - return this.onMainButtonStateChangedObservable - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onRightButtonStateChangedObservable", { - get: function() { - return this.onMainButtonStateChangedObservable - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onMenuButtonStateChangedObservable", { - get: function() { - return this.onSecondaryButtonStateChangedObservable - }, - enumerable: true, - configurable: true - }), - t.prototype._handleButtonChange = function(e, t, i) { - var n = t; - switch (e) { - case 0: - return void this.onPadStateChangedObservable.notifyObservers(n); - case 1: - return this._defaultModel && (this._defaultModel.getChildren()[6].rotation.x = .15 * -n.value), - void this.onTriggerStateChangedObservable.notifyObservers(n); - case 2: - return void this.onMainButtonStateChangedObservable.notifyObservers(n); - case 3: - return this._defaultModel && (n.pressed ? this._defaultModel.getChildren()[2].position.y = -.001 : this._defaultModel.getChildren()[2].position.y = 0), - void this.onSecondaryButtonStateChangedObservable.notifyObservers(n) - } - } - , - t.MODEL_BASE_URL = "https://controllers.babylonjs.com/vive/", - t.MODEL_FILENAME = "wand.babylon", - t - }(vi); - Bt._ControllerFactories.push({ - canCreate: function(e) { - return -1 !== e.id.toLowerCase().indexOf("openvr") - }, - create: function(e) { - return new bn(e) - } - }); - var En = function() { - this.buttonMeshes = {}, - this.axisMeshes = {} + }), + (t.MODEL_BASE_URL = + "https://controllers.babylonjs.com/generic/"), + (t.MODEL_FILENAME = "generic.babylon"), + (t.GAMEPAD_ID_PREFIX = "Gear VR"), + t + ); + })(vi); + Bt._ControllerFactories.push({ + canCreate: function (e) { + return ( + 0 === e.id.indexOf(_n.GAMEPAD_ID_PREFIX) || + -1 !== e.id.indexOf("Oculus Go") + ); + }, + create: function (e) { + return new _n(e); + }, + }); + var vn = (function (e) { + function t(t) { + return e.call(this, t) || this; } - , Tn = function(e) { - function t(t) { - var i = e.call(this, t) || this; - return i._mapping = { - buttons: ["thumbstick", "trigger", "grip", "menu", "trackpad"], - buttonMeshNames: { - trigger: "SELECT", - menu: "MENU", - grip: "GRASP", - thumbstick: "THUMBSTICK_PRESS", - trackpad: "TOUCHPAD_PRESS" - }, - buttonObservableNames: { - trigger: "onTriggerStateChangedObservable", - menu: "onSecondaryButtonStateChangedObservable", - grip: "onMainButtonStateChangedObservable", - thumbstick: "onPadStateChangedObservable", - trackpad: "onTrackpadChangedObservable" - }, - axisMeshNames: ["THUMBSTICK_X", "THUMBSTICK_Y", "TOUCHPAD_TOUCH_X", "TOUCHPAD_TOUCH_Y"], - pointingPoseMeshName: Nt.POINTING_POSE - }, - i.onTrackpadChangedObservable = new o.c, - i.onTrackpadValuesChangedObservable = new o.c, - i.trackpad = { - x: 0, - y: 0 - }, - i.controllerType = Mt.WINDOWS, - i._loadedMeshInfo = null, - i + return ( + h.d(t, e), + (t.prototype.initControllerMesh = function (e, i) { + var n = this; + mn.ImportMesh( + "", + t.MODEL_BASE_URL, + t.MODEL_FILENAME, + e, + function (e) { + (n._defaultModel = e[1]), + n.attachToMesh(n._defaultModel), + i && i(n._defaultModel); + } + ); + }), + (t.prototype._handleButtonChange = function (e, t, i) { + console.log("Button id: " + e + "state: "), console.dir(t); + }), + (t.MODEL_BASE_URL = + "https://controllers.babylonjs.com/generic/"), + (t.MODEL_FILENAME = "generic.babylon"), + t + ); + })(vi); + Bt._DefaultControllerFactory = function (e) { + return new vn(e); + }; + var yn = (function (e) { + function t(t) { + var i = e.call(this, t) || this; + return ( + (i.onSecondaryTriggerStateChangedObservable = new o.c()), + (i.onThumbRestChangedObservable = new o.c()), + (i.controllerType = Mt.OCULUS), + i + ); + } + return ( + h.d(t, e), + (t.prototype.initControllerMesh = function (e, i) { + var n, + r = this; + (n = + "left" === this.hand + ? t.MODEL_LEFT_FILENAME + : t.MODEL_RIGHT_FILENAME), + mn.ImportMesh("", t.MODEL_BASE_URL, n, e, function (e) { + (r._defaultModel = e[1]), + r.attachToMesh(r._defaultModel), + i && i(r._defaultModel); + }); + }), + Object.defineProperty( + t.prototype, + "onAButtonStateChangedObservable", + { + get: function () { + if ("right" === this.hand) + return this.onMainButtonStateChangedObservable; + throw new Error("No A button on left hand"); + }, + enumerable: true, + configurable: true, } - return h.d(t, e), - Object.defineProperty(t.prototype, "onTriggerButtonStateChangedObservable", { - get: function() { - return this.onTriggerStateChangedObservable + ), + Object.defineProperty( + t.prototype, + "onBButtonStateChangedObservable", + { + get: function () { + if ("right" === this.hand) + return this.onSecondaryButtonStateChangedObservable; + throw new Error("No B button on left hand"); + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onXButtonStateChangedObservable", + { + get: function () { + if ("left" === this.hand) + return this.onMainButtonStateChangedObservable; + throw new Error("No X button on right hand"); + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onYButtonStateChangedObservable", + { + get: function () { + if ("left" === this.hand) + return this.onSecondaryButtonStateChangedObservable; + throw new Error("No Y button on right hand"); + }, + enumerable: true, + configurable: true, + } + ), + (t.prototype._handleButtonChange = function (e, t, i) { + var n = t, + r = "right" === this.hand ? -1 : 1; + switch (e) { + case 0: + return void this.onPadStateChangedObservable.notifyObservers( + n + ); + case 1: + return ( + this._defaultModel && + ((this._defaultModel.getChildren()[3].rotation.x = + 0.2 * -n.value), + (this._defaultModel.getChildren()[3].position.y = + 0.005 * -n.value), + (this._defaultModel.getChildren()[3].position.z = + 0.005 * -n.value)), + void this.onTriggerStateChangedObservable.notifyObservers( + n + ) + ); + case 2: + return ( + this._defaultModel && + (this._defaultModel.getChildren()[4].position.x = + r * n.value * 0.0035), + void this.onSecondaryTriggerStateChangedObservable.notifyObservers( + n + ) + ); + case 3: + return ( + this._defaultModel && + (n.pressed + ? (this._defaultModel.getChildren()[1].position.y = + -0.001) + : (this._defaultModel.getChildren()[1].position.y = 0)), + void this.onMainButtonStateChangedObservable.notifyObservers( + n + ) + ); + case 4: + return ( + this._defaultModel && + (n.pressed + ? (this._defaultModel.getChildren()[2].position.y = + -0.001) + : (this._defaultModel.getChildren()[2].position.y = 0)), + void this.onSecondaryButtonStateChangedObservable.notifyObservers( + n + ) + ); + case 5: + return void this.onThumbRestChangedObservable.notifyObservers( + n + ); + } + }), + (t.MODEL_BASE_URL = + "https://controllers.babylonjs.com/oculus/"), + (t.MODEL_LEFT_FILENAME = "left.babylon"), + (t.MODEL_RIGHT_FILENAME = "right.babylon"), + t + ); + })(vi); + Bt._ControllerFactories.push({ + canCreate: function (e) { + return -1 !== e.id.indexOf("Oculus Touch"); + }, + create: function (e) { + return new yn(e); + }, + }); + var bn = (function (e) { + function t(t) { + var i = e.call(this, t) || this; + return ( + (i.controllerType = Mt.VIVE), + (i._invertLeftStickY = true), + i + ); + } + return ( + h.d(t, e), + (t.prototype.initControllerMesh = function (e, i) { + var n = this; + mn.ImportMesh( + "", + t.MODEL_BASE_URL, + t.MODEL_FILENAME, + e, + function (e) { + (n._defaultModel = e[1]), + n.attachToMesh(n._defaultModel), + i && i(n._defaultModel); + } + ); + }), + Object.defineProperty( + t.prototype, + "onLeftButtonStateChangedObservable", + { + get: function () { + return this.onMainButtonStateChangedObservable; + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onRightButtonStateChangedObservable", + { + get: function () { + return this.onMainButtonStateChangedObservable; + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onMenuButtonStateChangedObservable", + { + get: function () { + return this.onSecondaryButtonStateChangedObservable; + }, + enumerable: true, + configurable: true, + } + ), + (t.prototype._handleButtonChange = function (e, t, i) { + var n = t; + switch (e) { + case 0: + return void this.onPadStateChangedObservable.notifyObservers( + n + ); + case 1: + return ( + this._defaultModel && + (this._defaultModel.getChildren()[6].rotation.x = + 0.15 * -n.value), + void this.onTriggerStateChangedObservable.notifyObservers( + n + ) + ); + case 2: + return void this.onMainButtonStateChangedObservable.notifyObservers( + n + ); + case 3: + return ( + this._defaultModel && + (n.pressed + ? (this._defaultModel.getChildren()[2].position.y = + -0.001) + : (this._defaultModel.getChildren()[2].position.y = 0)), + void this.onSecondaryButtonStateChangedObservable.notifyObservers( + n + ) + ); + } + }), + (t.MODEL_BASE_URL = + "https://controllers.babylonjs.com/vive/"), + (t.MODEL_FILENAME = "wand.babylon"), + t + ); + })(vi); + Bt._ControllerFactories.push({ + canCreate: function (e) { + return -1 !== e.id.toLowerCase().indexOf("openvr"); + }, + create: function (e) { + return new bn(e); + }, + }); + var En = function () { + (this.buttonMeshes = {}), (this.axisMeshes = {}); + }, + Tn = (function (e) { + function t(t) { + var i = e.call(this, t) || this; + return ( + (i._mapping = { + buttons: [ + "thumbstick", + "trigger", + "grip", + "menu", + "trackpad", + ], + buttonMeshNames: { + trigger: "SELECT", + menu: "MENU", + grip: "GRASP", + thumbstick: "THUMBSTICK_PRESS", + trackpad: "TOUCHPAD_PRESS", + }, + buttonObservableNames: { + trigger: "onTriggerStateChangedObservable", + menu: "onSecondaryButtonStateChangedObservable", + grip: "onMainButtonStateChangedObservable", + thumbstick: "onPadStateChangedObservable", + trackpad: "onTrackpadChangedObservable", + }, + axisMeshNames: [ + "THUMBSTICK_X", + "THUMBSTICK_Y", + "TOUCHPAD_TOUCH_X", + "TOUCHPAD_TOUCH_Y", + ], + pointingPoseMeshName: Nt.POINTING_POSE, + }), + (i.onTrackpadChangedObservable = new o.c()), + (i.onTrackpadValuesChangedObservable = new o.c()), + (i.trackpad = { + x: 0, + y: 0, + }), + (i.controllerType = Mt.WINDOWS), + (i._loadedMeshInfo = null), + i + ); + } + return ( + h.d(t, e), + Object.defineProperty( + t.prototype, + "onTriggerButtonStateChangedObservable", + { + get: function () { + return this.onTriggerStateChangedObservable; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onMenuButtonStateChangedObservable", { - get: function() { - return this.onSecondaryButtonStateChangedObservable + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onMenuButtonStateChangedObservable", + { + get: function () { + return this.onSecondaryButtonStateChangedObservable; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onGripButtonStateChangedObservable", { - get: function() { - return this.onMainButtonStateChangedObservable + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onGripButtonStateChangedObservable", + { + get: function () { + return this.onMainButtonStateChangedObservable; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onThumbstickButtonStateChangedObservable", { - get: function() { - return this.onPadStateChangedObservable + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onThumbstickButtonStateChangedObservable", + { + get: function () { + return this.onPadStateChangedObservable; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onTouchpadButtonStateChangedObservable", { - get: function() { - return this.onTrackpadChangedObservable + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onTouchpadButtonStateChangedObservable", + { + get: function () { + return this.onTrackpadChangedObservable; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "onTouchpadValuesChangedObservable", { - get: function() { - return this.onTrackpadValuesChangedObservable + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "onTouchpadValuesChangedObservable", + { + get: function () { + return this.onTrackpadValuesChangedObservable; }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype._updateTrackpad = function () { + !this.browserGamepad.axes || + (this.browserGamepad.axes[2] == this.trackpad.x && + this.browserGamepad.axes[3] == this.trackpad.y) || + ((this.trackpad.x = this.browserGamepad.axes[2]), + (this.trackpad.y = this.browserGamepad.axes[3]), + this.onTrackpadValuesChangedObservable.notifyObservers( + this.trackpad + )); }), - t.prototype._updateTrackpad = function() { - !this.browserGamepad.axes || this.browserGamepad.axes[2] == this.trackpad.x && this.browserGamepad.axes[3] == this.trackpad.y || (this.trackpad.x = this.browserGamepad.axes[2], - this.trackpad.y = this.browserGamepad.axes[3], - this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad)) - } - , - t.prototype.update = function() { - if (e.prototype.update.call(this), - this.browserGamepad.axes && (this._updateTrackpad(), - this._loadedMeshInfo)) - for (var t = 0; t < this._mapping.axisMeshNames.length; t++) - this._lerpAxisTransform(t, this.browserGamepad.axes[t]) - } - , - t.prototype._handleButtonChange = function(e, t, i) { - var n = this._mapping.buttons[e]; - if (n) { - this._updateTrackpad(); - var r = this[this._mapping.buttonObservableNames[n]]; - r && r.notifyObservers(t), - this._lerpButtonTransform(n, t.value) + (t.prototype.update = function () { + if ( + (e.prototype.update.call(this), + this.browserGamepad.axes && + (this._updateTrackpad(), this._loadedMeshInfo)) + ) + for ( + var t = 0; + t < this._mapping.axisMeshNames.length; + t++ + ) + this._lerpAxisTransform( + t, + this.browserGamepad.axes[t] + ); + }), + (t.prototype._handleButtonChange = function (e, t, i) { + var n = this._mapping.buttons[e]; + if (n) { + this._updateTrackpad(); + var r = this[this._mapping.buttonObservableNames[n]]; + r && r.notifyObservers(t), + this._lerpButtonTransform(n, t.value); + } + }), + (t.prototype._lerpButtonTransform = function (e, t) { + if (this._loadedMeshInfo) { + var i = this._loadedMeshInfo.buttonMeshes[e]; + i.unpressed.rotationQuaternion && + i.pressed.rotationQuaternion && + i.value.rotationQuaternion && + (a.q.SlerpToRef( + i.unpressed.rotationQuaternion, + i.pressed.rotationQuaternion, + t, + i.value.rotationQuaternion + ), + a.x.LerpToRef( + i.unpressed.position, + i.pressed.position, + t, + i.value.position + )); + } + }), + (t.prototype._lerpAxisTransform = function (e, t) { + if (this._loadedMeshInfo) { + var i = this._loadedMeshInfo.axisMeshes[e]; + if ( + i && + i.min.rotationQuaternion && + i.max.rotationQuaternion && + i.value.rotationQuaternion + ) { + var n = 0.5 * t + 0.5; + a.q.SlerpToRef( + i.min.rotationQuaternion, + i.max.rotationQuaternion, + n, + i.value.rotationQuaternion + ), + a.x.LerpToRef( + i.min.position, + i.max.position, + n, + i.value.position + ); } - } - , - t.prototype._lerpButtonTransform = function(e, t) { - if (this._loadedMeshInfo) { - var i = this._loadedMeshInfo.buttonMeshes[e]; - i.unpressed.rotationQuaternion && i.pressed.rotationQuaternion && i.value.rotationQuaternion && (a.q.SlerpToRef(i.unpressed.rotationQuaternion, i.pressed.rotationQuaternion, t, i.value.rotationQuaternion), - a.x.LerpToRef(i.unpressed.position, i.pressed.position, t, i.value.position)) + } + }), + (t.prototype.initControllerMesh = function (e, i, n) { + var r, + o, + a = this; + if ( + (void 0 === n && (n = false), + mn.IsPluginForExtensionAvailable(".glb")) + ) { + var s = "default"; + if (this.id && !n) { + var c = this.id.match(t.GAMEPAD_ID_PATTERN); + s = (c && c[0]) || s; } - } - , - t.prototype._lerpAxisTransform = function(e, t) { - if (this._loadedMeshInfo) { - var i = this._loadedMeshInfo.axisMeshes[e]; - if (i && i.min.rotationQuaternion && i.max.rotationQuaternion && i.value.rotationQuaternion) { - var n = .5 * t + .5; - a.q.SlerpToRef(i.min.rotationQuaternion, i.max.rotationQuaternion, n, i.value.rotationQuaternion), - a.x.LerpToRef(i.min.position, i.max.position, n, i.value.position) - } + (o = + "left" === this.hand + ? t.MODEL_LEFT_FILENAME + : t.MODEL_RIGHT_FILENAME), + (r = t.MODEL_BASE_URL + s + "/"); + } else + g.a.Warn( + "You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models" + ), + (r = vn.MODEL_BASE_URL), + (o = vn.MODEL_FILENAME); + mn.ImportMesh( + "", + r, + o, + e, + function (t) { + (a._loadedMeshInfo = a.processModel(e, t)), + a._loadedMeshInfo && + ((a._defaultModel = a._loadedMeshInfo.rootNode), + a.attachToMesh(a._defaultModel), + i && i(a._defaultModel)); + }, + null, + function (e, t) { + g.a.Log(t), + g.a.Warn( + "Failed to retrieve controller model from the remote server: " + + r + + o + ), + n || a.initControllerMesh(e, i, true); } - } - , - t.prototype.initControllerMesh = function(e, i, n) { - var r, o, a = this; - if (void 0 === n && (n = false), - mn.IsPluginForExtensionAvailable(".glb")) { - var s = "default"; - if (this.id && !n) { - var c = this.id.match(t.GAMEPAD_ID_PATTERN); - s = c && c[0] || s - } - o = "left" === this.hand ? t.MODEL_LEFT_FILENAME : t.MODEL_RIGHT_FILENAME, - r = t.MODEL_BASE_URL + s + "/" - } else - g.a.Warn("You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models"), - r = vn.MODEL_BASE_URL, - o = vn.MODEL_FILENAME; - mn.ImportMesh("", r, o, e, function(t) { - a._loadedMeshInfo = a.processModel(e, t), - a._loadedMeshInfo && (a._defaultModel = a._loadedMeshInfo.rootNode, - a.attachToMesh(a._defaultModel), - i && i(a._defaultModel)) - }, null, function(e, t) { - g.a.Log(t), - g.a.Warn("Failed to retrieve controller model from the remote server: " + r + o), - n || a.initControllerMesh(e, i, true) - }) - } - , - t.prototype.processModel = function(e, t) { - for (var i = null, n = new me.a(this.id + " " + this.hand,e), r = null, o = 0; o < t.length; o++) { - var a = t[o]; - if (!a.parent) { - a.isPickable = false, - r = a; - break - } + ); + }), + (t.prototype.processModel = function (e, t) { + for ( + var i = null, + n = new me.a(this.id + " " + this.hand, e), + r = null, + o = 0; + o < t.length; + o++ + ) { + var a = t[o]; + if (!a.parent) { + (a.isPickable = false), (r = a); + break; } - return r ? (r.setParent(n), - i = this.createMeshInfo(n)) : g.a.Warn("Could not find root node in model file."), - i - } - , - t.prototype.createMeshInfo = function(e) { - var t, i = new En; - for (i.rootNode = e, - i.buttonMeshes = {}, - i.axisMeshes = {}, - t = 0; t < this._mapping.buttons.length; t++) { - var n = this._mapping.buttonMeshNames[this._mapping.buttons[t]]; - if (n) { - var r = u(e, n); - if (r) { - var o = { - index: t, - value: l(r, "VALUE"), - pressed: l(r, "PRESSED"), - unpressed: l(r, "UNPRESSED") - }; - o.value && o.pressed && o.unpressed ? i.buttonMeshes[this._mapping.buttons[t]] = o : g.a.Warn("Missing button submesh under mesh with name: " + n + "(VALUE: " + !!o.value + ", PRESSED: " + !!o.pressed + ", UNPRESSED:" + !!o.unpressed + ")") - } else - g.a.Warn("Missing button mesh with name: " + n) - } else - g.a.Log("Skipping unknown button at index: " + t + " with mapped name: " + this._mapping.buttons[t]) - } - for (t = 0; t < this._mapping.axisMeshNames.length; t++) { - var a = this._mapping.axisMeshNames[t]; - if (a) { - var s = u(e, a); - if (s) { - var c = { - index: t, - value: l(s, "VALUE"), - min: l(s, "MIN"), - max: l(s, "MAX") - }; - c.value && c.min && c.max ? i.axisMeshes[t] = c : g.a.Warn("Missing axis submesh under mesh with name: " + a + "(VALUE: " + !!c.value + ", MIN: " + !!c.min + ", MAX:" + !!c.max + ")") - } else - g.a.Warn("Missing axis mesh with name: " + a) - } else - g.a.Log("Skipping unknown axis at index: " + t) - } - return i.pointingPoseNode = u(e, this._mapping.pointingPoseMeshName), - i.pointingPoseNode ? this._pointingPoseNode = i.pointingPoseNode : g.a.Warn("Missing pointing pose mesh with name: " + this._mapping.pointingPoseMeshName), - i; - function u(e, t) { - return e.getChildren(function(e) { - return e.name === t - }, false)[0] - } - function l(e, t) { - return e.getChildren(function(e) { - return e.name == t - }, true)[0] - } - } - , - t.prototype.getForwardRay = function(t) { - if (void 0 === t && (t = 100), - !this._loadedMeshInfo || !this._loadedMeshInfo.pointingPoseNode) - return e.prototype.getForwardRay.call(this, t); - var i = this._loadedMeshInfo.pointingPoseNode.getWorldMatrix() - , n = i.getTranslation() - , r = new a.x(0,0,-1) - , o = a.x.TransformNormal(r, i) - , s = a.x.Normalize(o); - return new Dt.a(n,s,t) - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), - this.onTrackpadChangedObservable.clear() - } - , - t.MODEL_BASE_URL = "https://controllers.babylonjs.com/microsoft/", - t.MODEL_LEFT_FILENAME = "left.glb", - t.MODEL_RIGHT_FILENAME = "right.glb", - t.GAMEPAD_ID_PREFIX = "Spatial Controller (Spatial Interaction Source) ", - t.GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/, - t - }(vi); - Bt._ControllerFactories.push({ - canCreate: function(e) { - return 0 === e.id.indexOf(Tn.GAMEPAD_ID_PREFIX) - }, - create: function(e) { - return new Tn(e) - } - }); - var An = n(58) - , xn = n(52) - , Sn = n(48) - , Cn = n(41) - , Pn = function(e) { - function t(t, i, n) { - void 0 === i && (i = a.e.Gray()), - void 0 === n && (n = Cn.a.DefaultUtilityLayer); - var r = e.call(this, n) || this; - r._pointerObserver = null, - r.snapDistance = 0, - r.onSnapObservable = new o.c, - r.uniformScaling = false, - r._coloredMaterial = new bi.a("",n.utilityLayerScene), - r._coloredMaterial.diffuseColor = i, - r._coloredMaterial.specularColor = i.subtract(new a.e(.1,.1,.1)); - var s = new bi.a("",n.utilityLayerScene); - s.diffuseColor = i.add(new a.e(.3,.3,.3)); - var c = new Ne.a("",n.utilityLayerScene) - , u = xn.a.CreateBox("yPosMesh", { - size: .4 - }, n.utilityLayerScene) - , l = Oi.a.CreateCylinder("cylinder", { - diameterTop: .005, - height: .275, - diameterBottom: .005, - tessellation: 96 - }, n.utilityLayerScene); - l.material = r._coloredMaterial, - c.addChild(u), - c.addChild(l), - u.scaling.scaleInPlace(.1), - u.material = r._coloredMaterial, - u.rotation.x = Math.PI / 2, - u.position.z += .3, - l.position.z += .1375, - l.rotation.x = Math.PI / 2, - c.lookAt(r._rootMesh.position.add(t)), - r._rootMesh.addChild(c), - c.scaling.scaleInPlace(1 / 3), - r.dragBehavior = new Fe.a({ - dragAxis: t - }), - r.dragBehavior.moveAttached = false, - r._rootMesh.addBehavior(r.dragBehavior); - var h = 0 - , f = new a.x - , d = { - snapDistance: 0 - }; - r.dragBehavior.onDragObservable.add(function(e) { - if (r.attachedMesh) { - var i = e.dragDistance * (3 * r.scaleRatio / r._rootMesh.scaling.length()) - , n = false - , o = 0; - r.uniformScaling ? (r.attachedMesh.scaling.normalizeToRef(f), - f.y < 0 && f.scaleInPlace(-1)) : f.copyFrom(t), - 0 == r.snapDistance ? f.scaleToRef(i, f) : (h += i, - Math.abs(h) > r.snapDistance ? (o = Math.floor(Math.abs(h) / r.snapDistance), - h < 0 && (o *= -1), - h %= r.snapDistance, - f.scaleToRef(r.snapDistance * o, f), - n = true) : f.scaleInPlace(0)), - r.attachedMesh.scaling.addInPlace(f), - n && (d.snapDistance = r.snapDistance * o, - r.onSnapObservable.notifyObservers(d)) - } - }), - r._pointerObserver = n.utilityLayerScene.onPointerObservable.add(function(e) { - if (!r._customMeshSet) { - var t = e.pickInfo && -1 != r._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh) ? s : r._coloredMaterial; - r._rootMesh.getChildMeshes().forEach(function(e) { - e.material = t, - e.color && (e.color = t.diffuseColor) - }) - } - }); - var p = n._getSharedGizmoLight(); - return p.includedOnlyMeshes = p.includedOnlyMeshes.concat(r._rootMesh.getChildMeshes()), + } + return ( r - } - return h.d(t, e), - t.prototype._attachedMeshChanged = function(e) { - this.dragBehavior && (this.dragBehavior.enabled = !!e) - } - , - t.prototype.dispose = function() { - this.onSnapObservable.clear(), - this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), - this.dragBehavior.detach(), - e.prototype.dispose.call(this) - } - , - t.prototype.setCustomMesh = function(t, i) { - var n = this; - void 0 === i && (i = false), - e.prototype.setCustomMesh.call(this, t), - i && (this._rootMesh.getChildMeshes().forEach(function(e) { - e.material = n._coloredMaterial, - e.color && (e.color = n._coloredMaterial.diffuseColor) - }), - this._customMeshSet = false) - } - , + ? (r.setParent(n), (i = this.createMeshInfo(n))) + : g.a.Warn("Could not find root node in model file."), + i + ); + }), + (t.prototype.createMeshInfo = function (e) { + var t, + i = new En(); + for ( + i.rootNode = e, + i.buttonMeshes = {}, + i.axisMeshes = {}, + t = 0; + t < this._mapping.buttons.length; + t++ + ) { + var n = + this._mapping.buttonMeshNames[ + this._mapping.buttons[t] + ]; + if (n) { + var r = u(e, n); + if (r) { + var o = { + index: t, + value: l(r, "VALUE"), + pressed: l(r, "PRESSED"), + unpressed: l(r, "UNPRESSED"), + }; + o.value && o.pressed && o.unpressed + ? (i.buttonMeshes[this._mapping.buttons[t]] = o) + : g.a.Warn( + "Missing button submesh under mesh with name: " + + n + + "(VALUE: " + + !!o.value + + ", PRESSED: " + + !!o.pressed + + ", UNPRESSED:" + + !!o.unpressed + + ")" + ); + } else + g.a.Warn("Missing button mesh with name: " + n); + } else + g.a.Log( + "Skipping unknown button at index: " + + t + + " with mapped name: " + + this._mapping.buttons[t] + ); + } + for (t = 0; t < this._mapping.axisMeshNames.length; t++) { + var a = this._mapping.axisMeshNames[t]; + if (a) { + var s = u(e, a); + if (s) { + var c = { + index: t, + value: l(s, "VALUE"), + min: l(s, "MIN"), + max: l(s, "MAX"), + }; + c.value && c.min && c.max + ? (i.axisMeshes[t] = c) + : g.a.Warn( + "Missing axis submesh under mesh with name: " + + a + + "(VALUE: " + + !!c.value + + ", MIN: " + + !!c.min + + ", MAX:" + + !!c.max + + ")" + ); + } else g.a.Warn("Missing axis mesh with name: " + a); + } else g.a.Log("Skipping unknown axis at index: " + t); + } + return ( + (i.pointingPoseNode = u( + e, + this._mapping.pointingPoseMeshName + )), + i.pointingPoseNode + ? (this._pointingPoseNode = i.pointingPoseNode) + : g.a.Warn( + "Missing pointing pose mesh with name: " + + this._mapping.pointingPoseMeshName + ), + i + ); + function u(e, t) { + return e.getChildren(function (e) { + return e.name === t; + }, false)[0]; + } + function l(e, t) { + return e.getChildren(function (e) { + return e.name == t; + }, true)[0]; + } + }), + (t.prototype.getForwardRay = function (t) { + if ( + (void 0 === t && (t = 100), + !this._loadedMeshInfo || + !this._loadedMeshInfo.pointingPoseNode) + ) + return e.prototype.getForwardRay.call(this, t); + var i = + this._loadedMeshInfo.pointingPoseNode.getWorldMatrix(), + n = i.getTranslation(), + r = new a.x(0, 0, -1), + o = a.x.TransformNormal(r, i), + s = a.x.Normalize(o); + return new Dt.a(n, s, t); + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), + this.onTrackpadChangedObservable.clear(); + }), + (t.MODEL_BASE_URL = + "https://controllers.babylonjs.com/microsoft/"), + (t.MODEL_LEFT_FILENAME = "left.glb"), + (t.MODEL_RIGHT_FILENAME = "right.glb"), + (t.GAMEPAD_ID_PREFIX = + "Spatial Controller (Spatial Interaction Source) "), + (t.GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/), t - }(Sn.a) - , Rn = n(46) - , Mn = n(40) - , On = function(e) { - function t(t, i) { - void 0 === t && (t = a.e.Gray()), - void 0 === i && (i = Cn.a.DefaultKeepDepthUtilityLayer); - var n = e.call(this, i) || this; - n._boundingDimensions = new a.x(1,1,1), - n._renderObserver = null, - n._pointerObserver = null, - n._scaleDragSpeed = .2, - n._tmpQuaternion = new a.q, - n._tmpVector = new a.x(0,0,0), - n._tmpRotationMatrix = new a.j, - n.ignoreChildren = false, - n.includeChildPredicate = null, - n.rotationSphereSize = .1, - n.scaleBoxSize = .1, - n.fixedDragMeshScreenSize = false, - n.fixedDragMeshScreenSizeDistanceFactor = 10, - n.onDragStartObservable = new o.c, - n.onScaleBoxDragObservable = new o.c, - n.onScaleBoxDragEndObservable = new o.c, - n.onRotationSphereDragObservable = new o.c, - n.onRotationSphereDragEndObservable = new o.c, - n.scalePivot = null, - n._existingMeshScale = new a.x, - n._dragMesh = null, - n.pointerDragBehavior = new Fe.a, - n._updateScale = false, - n._anchorMesh = new Ne.a("anchor",i.utilityLayerScene), - n.coloredMaterial = new bi.a("",i.utilityLayerScene), - n.coloredMaterial.disableLighting = true, - n.hoverColoredMaterial = new bi.a("",i.utilityLayerScene), - n.hoverColoredMaterial.disableLighting = true, - n._lineBoundingBox = new Ne.a("",i.utilityLayerScene), - n._lineBoundingBox.rotationQuaternion = new a.q; - var r = []; - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(0,0,0), new a.x(n._boundingDimensions.x,0,0)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(0,0,0), new a.x(0,n._boundingDimensions.y,0)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(0,0,0), new a.x(0,0,n._boundingDimensions.z)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(n._boundingDimensions.x,0,0), new a.x(n._boundingDimensions.x,n._boundingDimensions.y,0)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(n._boundingDimensions.x,0,0), new a.x(n._boundingDimensions.x,0,n._boundingDimensions.z)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(0,n._boundingDimensions.y,0), new a.x(n._boundingDimensions.x,n._boundingDimensions.y,0)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(0,n._boundingDimensions.y,0), new a.x(0,n._boundingDimensions.y,n._boundingDimensions.z)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(0,0,n._boundingDimensions.z), new a.x(n._boundingDimensions.x,0,n._boundingDimensions.z)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(0,0,n._boundingDimensions.z), new a.x(0,n._boundingDimensions.y,n._boundingDimensions.z)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z), new a.x(0,n._boundingDimensions.y,n._boundingDimensions.z)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z), new a.x(n._boundingDimensions.x,0,n._boundingDimensions.z)] - }, i.utilityLayerScene)), - r.push(Mn.a.CreateLines("lines", { - points: [new a.x(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z), new a.x(n._boundingDimensions.x,n._boundingDimensions.y,0)] - }, i.utilityLayerScene)), - r.forEach(function(e) { - e.color = t, - e.position.addInPlace(new a.x(-n._boundingDimensions.x / 2,-n._boundingDimensions.y / 2,-n._boundingDimensions.z / 2)), - e.isPickable = false, - n._lineBoundingBox.addChild(e) - }), - n._rootMesh.addChild(n._lineBoundingBox), - n.setColor(t), - n._rotateSpheresParent = new Ne.a("",i.utilityLayerScene), - n._rotateSpheresParent.rotationQuaternion = new a.q; - for (var s = function(e) { - var t = Rn.a.CreateSphere("", { - diameter: 1 - }, i.utilityLayerScene); - t.rotationQuaternion = new a.q, - t.material = c.coloredMaterial, - (f = new Fe.a({})).moveAttached = false, - f.updateDragPlane = false, - t.addBehavior(f); - var r = new a.x(1,0,0) - , o = 0; - f.onDragStartObservable.add(function() { - r.copyFrom(t.forward), - o = 0 + ); + })(vi); + Bt._ControllerFactories.push({ + canCreate: function (e) { + return 0 === e.id.indexOf(Tn.GAMEPAD_ID_PREFIX); + }, + create: function (e) { + return new Tn(e); + }, + }); + var An = n(58), + xn = n(52), + Sn = n(48), + Cn = n(41), + Pn = (function (e) { + function t(t, i, n) { + void 0 === i && (i = a.e.Gray()), + void 0 === n && (n = Cn.a.DefaultUtilityLayer); + var r = e.call(this, n) || this; + (r._pointerObserver = null), + (r.snapDistance = 0), + (r.onSnapObservable = new o.c()), + (r.uniformScaling = false), + (r._coloredMaterial = new bi.a("", n.utilityLayerScene)), + (r._coloredMaterial.diffuseColor = i), + (r._coloredMaterial.specularColor = i.subtract( + new a.e(0.1, 0.1, 0.1) + )); + var s = new bi.a("", n.utilityLayerScene); + s.diffuseColor = i.add(new a.e(0.3, 0.3, 0.3)); + var c = new Ne.a("", n.utilityLayerScene), + u = xn.a.CreateBox( + "yPosMesh", + { + size: 0.4, + }, + n.utilityLayerScene + ), + l = Oi.a.CreateCylinder( + "cylinder", + { + diameterTop: 0.005, + height: 0.275, + diameterBottom: 0.005, + tessellation: 96, + }, + n.utilityLayerScene + ); + (l.material = r._coloredMaterial), + c.addChild(u), + c.addChild(l), + u.scaling.scaleInPlace(0.1), + (u.material = r._coloredMaterial), + (u.rotation.x = Math.PI / 2), + (u.position.z += 0.3), + (l.position.z += 0.1375), + (l.rotation.x = Math.PI / 2), + c.lookAt(r._rootMesh.position.add(t)), + r._rootMesh.addChild(c), + c.scaling.scaleInPlace(1 / 3), + (r.dragBehavior = new Fe.a({ + dragAxis: t, + })), + (r.dragBehavior.moveAttached = false), + r._rootMesh.addBehavior(r.dragBehavior); + var h = 0, + f = new a.x(), + d = { + snapDistance: 0, + }; + r.dragBehavior.onDragObservable.add(function (e) { + if (r.attachedMesh) { + var i = + e.dragDistance * + ((3 * r.scaleRatio) / r._rootMesh.scaling.length()), + n = false, + o = 0; + r.uniformScaling + ? (r.attachedMesh.scaling.normalizeToRef(f), + f.y < 0 && f.scaleInPlace(-1)) + : f.copyFrom(t), + 0 == r.snapDistance + ? f.scaleToRef(i, f) + : ((h += i), + Math.abs(h) > r.snapDistance + ? ((o = Math.floor( + Math.abs(h) / r.snapDistance + )), + h < 0 && (o *= -1), + (h %= r.snapDistance), + f.scaleToRef(r.snapDistance * o, f), + (n = true)) + : f.scaleInPlace(0)), + r.attachedMesh.scaling.addInPlace(f), + n && + ((d.snapDistance = r.snapDistance * o), + r.onSnapObservable.notifyObservers(d)); + } + }), + (r._pointerObserver = + n.utilityLayerScene.onPointerObservable.add(function ( + e + ) { + if (!r._customMeshSet) { + var t = + e.pickInfo && + -1 != + r._rootMesh + .getChildMeshes() + .indexOf(e.pickInfo.pickedMesh) + ? s + : r._coloredMaterial; + r._rootMesh.getChildMeshes().forEach(function (e) { + (e.material = t), + e.color && (e.color = t.diffuseColor); + }); + } + })); + var p = n._getSharedGizmoLight(); + return ( + (p.includedOnlyMeshes = p.includedOnlyMeshes.concat( + r._rootMesh.getChildMeshes() + )), + r + ); + } + return ( + h.d(t, e), + (t.prototype._attachedMeshChanged = function (e) { + this.dragBehavior && (this.dragBehavior.enabled = !!e); + }), + (t.prototype.dispose = function () { + this.onSnapObservable.clear(), + this.gizmoLayer.utilityLayerScene.onPointerObservable.remove( + this._pointerObserver + ), + this.dragBehavior.detach(), + e.prototype.dispose.call(this); + }), + (t.prototype.setCustomMesh = function (t, i) { + var n = this; + void 0 === i && (i = false), + e.prototype.setCustomMesh.call(this, t), + i && + (this._rootMesh + .getChildMeshes() + .forEach(function (e) { + (e.material = n._coloredMaterial), + e.color && + (e.color = n._coloredMaterial.diffuseColor); }), - f.onDragObservable.add(function(t) { - if (n.onRotationSphereDragObservable.notifyObservers({}), - n.attachedMesh) { - var i = n.attachedMesh.parent; - if (i && i.scaling && i.scaling.isNonUniformWithinEpsilon(.001)) - return void g.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling"); - Ue.a._RemoveAndStorePivotPoint(n.attachedMesh); - var s = r - , c = t.dragPlaneNormal.scale(a.x.Dot(t.dragPlaneNormal, s)) - , u = s.subtract(c).normalizeToNew() - , l = a.x.Dot(u, t.delta) < 0 ? Math.abs(t.delta.length()) : -Math.abs(t.delta.length()); - l = l / n._boundingDimensions.length() * n._anchorMesh.scaling.length(), - n.attachedMesh.rotationQuaternion || (n.attachedMesh.rotationQuaternion = a.q.RotationYawPitchRoll(n.attachedMesh.rotation.y, n.attachedMesh.rotation.x, n.attachedMesh.rotation.z)), - n._anchorMesh.rotationQuaternion || (n._anchorMesh.rotationQuaternion = a.q.RotationYawPitchRoll(n._anchorMesh.rotation.y, n._anchorMesh.rotation.x, n._anchorMesh.rotation.z)), - o += l, - Math.abs(o) <= 2 * Math.PI && (e >= 8 ? a.q.RotationYawPitchRollToRef(0, 0, l, n._tmpQuaternion) : e >= 4 ? a.q.RotationYawPitchRollToRef(l, 0, 0, n._tmpQuaternion) : a.q.RotationYawPitchRollToRef(0, l, 0, n._tmpQuaternion), + (this._customMeshSet = false)); + }), + t + ); + })(Sn.a), + Rn = n(46), + Mn = n(40), + On = (function (e) { + function t(t, i) { + void 0 === t && (t = a.e.Gray()), + void 0 === i && (i = Cn.a.DefaultKeepDepthUtilityLayer); + var n = e.call(this, i) || this; + (n._boundingDimensions = new a.x(1, 1, 1)), + (n._renderObserver = null), + (n._pointerObserver = null), + (n._scaleDragSpeed = 0.2), + (n._tmpQuaternion = new a.q()), + (n._tmpVector = new a.x(0, 0, 0)), + (n._tmpRotationMatrix = new a.j()), + (n.ignoreChildren = false), + (n.includeChildPredicate = null), + (n.rotationSphereSize = 0.1), + (n.scaleBoxSize = 0.1), + (n.fixedDragMeshScreenSize = false), + (n.fixedDragMeshScreenSizeDistanceFactor = 10), + (n.onDragStartObservable = new o.c()), + (n.onScaleBoxDragObservable = new o.c()), + (n.onScaleBoxDragEndObservable = new o.c()), + (n.onRotationSphereDragObservable = new o.c()), + (n.onRotationSphereDragEndObservable = new o.c()), + (n.scalePivot = null), + (n._existingMeshScale = new a.x()), + (n._dragMesh = null), + (n.pointerDragBehavior = new Fe.a()), + (n._updateScale = false), + (n._anchorMesh = new Ne.a("anchor", i.utilityLayerScene)), + (n.coloredMaterial = new bi.a("", i.utilityLayerScene)), + (n.coloredMaterial.disableLighting = true), + (n.hoverColoredMaterial = new bi.a( + "", + i.utilityLayerScene + )), + (n.hoverColoredMaterial.disableLighting = true), + (n._lineBoundingBox = new Ne.a("", i.utilityLayerScene)), + (n._lineBoundingBox.rotationQuaternion = new a.q()); + var r = []; + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(0, 0, 0), + new a.x(n._boundingDimensions.x, 0, 0), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(0, 0, 0), + new a.x(0, n._boundingDimensions.y, 0), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(0, 0, 0), + new a.x(0, 0, n._boundingDimensions.z), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(n._boundingDimensions.x, 0, 0), + new a.x( + n._boundingDimensions.x, + n._boundingDimensions.y, + 0 + ), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(n._boundingDimensions.x, 0, 0), + new a.x( + n._boundingDimensions.x, + 0, + n._boundingDimensions.z + ), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(0, n._boundingDimensions.y, 0), + new a.x( + n._boundingDimensions.x, + n._boundingDimensions.y, + 0 + ), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(0, n._boundingDimensions.y, 0), + new a.x( + 0, + n._boundingDimensions.y, + n._boundingDimensions.z + ), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(0, 0, n._boundingDimensions.z), + new a.x( + n._boundingDimensions.x, + 0, + n._boundingDimensions.z + ), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x(0, 0, n._boundingDimensions.z), + new a.x( + 0, + n._boundingDimensions.y, + n._boundingDimensions.z + ), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x( + n._boundingDimensions.x, + n._boundingDimensions.y, + n._boundingDimensions.z + ), + new a.x( + 0, + n._boundingDimensions.y, + n._boundingDimensions.z + ), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x( + n._boundingDimensions.x, + n._boundingDimensions.y, + n._boundingDimensions.z + ), + new a.x( + n._boundingDimensions.x, + 0, + n._boundingDimensions.z + ), + ], + }, + i.utilityLayerScene + ) + ), + r.push( + Mn.a.CreateLines( + "lines", + { + points: [ + new a.x( + n._boundingDimensions.x, + n._boundingDimensions.y, + n._boundingDimensions.z + ), + new a.x( + n._boundingDimensions.x, + n._boundingDimensions.y, + 0 + ), + ], + }, + i.utilityLayerScene + ) + ), + r.forEach(function (e) { + (e.color = t), + e.position.addInPlace( + new a.x( + -n._boundingDimensions.x / 2, + -n._boundingDimensions.y / 2, + -n._boundingDimensions.z / 2 + ) + ), + (e.isPickable = false), + n._lineBoundingBox.addChild(e); + }), + n._rootMesh.addChild(n._lineBoundingBox), + n.setColor(t), + (n._rotateSpheresParent = new Ne.a( + "", + i.utilityLayerScene + )), + (n._rotateSpheresParent.rotationQuaternion = new a.q()); + for ( + var s = function (e) { + var t = Rn.a.CreateSphere( + "", + { + diameter: 1, + }, + i.utilityLayerScene + ); + (t.rotationQuaternion = new a.q()), + (t.material = c.coloredMaterial), + ((f = new Fe.a({})).moveAttached = false), + (f.updateDragPlane = false), + t.addBehavior(f); + var r = new a.x(1, 0, 0), + o = 0; + f.onDragStartObservable.add(function () { + r.copyFrom(t.forward), (o = 0); + }), + f.onDragObservable.add(function (t) { + if ( + (n.onRotationSphereDragObservable.notifyObservers( + {} + ), + n.attachedMesh) + ) { + var i = n.attachedMesh.parent; + if ( + i && + i.scaling && + i.scaling.isNonUniformWithinEpsilon(0.001) + ) + return void g.a.Warn( + "BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling" + ); + Ue.a._RemoveAndStorePivotPoint(n.attachedMesh); + var s = r, + c = t.dragPlaneNormal.scale( + a.x.Dot(t.dragPlaneNormal, s) + ), + u = s.subtract(c).normalizeToNew(), + l = + a.x.Dot(u, t.delta) < 0 + ? Math.abs(t.delta.length()) + : -Math.abs(t.delta.length()); + (l = + (l / n._boundingDimensions.length()) * + n._anchorMesh.scaling.length()), + n.attachedMesh.rotationQuaternion || + (n.attachedMesh.rotationQuaternion = + a.q.RotationYawPitchRoll( + n.attachedMesh.rotation.y, + n.attachedMesh.rotation.x, + n.attachedMesh.rotation.z + )), + n._anchorMesh.rotationQuaternion || + (n._anchorMesh.rotationQuaternion = + a.q.RotationYawPitchRoll( + n._anchorMesh.rotation.y, + n._anchorMesh.rotation.x, + n._anchorMesh.rotation.z + )), + (o += l), + Math.abs(o) <= 2 * Math.PI && + (e >= 8 + ? a.q.RotationYawPitchRollToRef( + 0, + 0, + l, + n._tmpQuaternion + ) + : e >= 4 + ? a.q.RotationYawPitchRollToRef( + l, + 0, + 0, + n._tmpQuaternion + ) + : a.q.RotationYawPitchRollToRef( + 0, + l, + 0, + n._tmpQuaternion + ), n._anchorMesh.addChild(n.attachedMesh), - n._anchorMesh.rotationQuaternion.multiplyToRef(n._tmpQuaternion, n._anchorMesh.rotationQuaternion), + n._anchorMesh.rotationQuaternion.multiplyToRef( + n._tmpQuaternion, + n._anchorMesh.rotationQuaternion + ), n._anchorMesh.removeChild(n.attachedMesh), n.attachedMesh.setParent(i)), - n.updateBoundingBox(), - Ue.a._RestorePivotPoint(n.attachedMesh) - } - n._updateDummy() + n.updateBoundingBox(), + Ue.a._RestorePivotPoint(n.attachedMesh); + } + n._updateDummy(); }), - f.onDragStartObservable.add(function() { - n.onDragStartObservable.notifyObservers({}), - n._selectNode(t) + f.onDragStartObservable.add(function () { + n.onDragStartObservable.notifyObservers({}), + n._selectNode(t); }), - f.onDragEndObservable.add(function() { - n.onRotationSphereDragEndObservable.notifyObservers({}), + f.onDragEndObservable.add(function () { + n.onRotationSphereDragEndObservable.notifyObservers( + {} + ), n._selectNode(null), - n._updateDummy() + n._updateDummy(); }), - c._rotateSpheresParent.addChild(t) - }, c = this, u = 0; u < 12; u++) - s(u); - n._rootMesh.addChild(n._rotateSpheresParent), - n._scaleBoxesParent = new Ne.a("",i.utilityLayerScene), - n._scaleBoxesParent.rotationQuaternion = new a.q; - for (var l = 0; l < 2; l++) - for (var h = 0; h < 2; h++) - for (var f, d = function() { - var e = xn.a.CreateBox("", { - size: 1 - }, i.utilityLayerScene); - e.material = p.coloredMaterial; - var t = new a.x(0 == l ? -1 : 1,0 == h ? -1 : 1,0 == m ? -1 : 1); - (f = new Fe.a({ - dragAxis: t - })).moveAttached = false, - e.addBehavior(f), - f.onDragObservable.add(function(t) { - if (n.onScaleBoxDragObservable.notifyObservers({}), - n.attachedMesh) { - var i = n.attachedMesh.parent; - if (i && i.scaling && i.scaling.isNonUniformWithinEpsilon(.001)) - return void g.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling"); - Ue.a._RemoveAndStorePivotPoint(n.attachedMesh); - var r = t.dragDistance / n._boundingDimensions.length() * n._anchorMesh.scaling.length() - , o = new a.x(r,r,r); - o.scaleInPlace(n._scaleDragSpeed), - n.updateBoundingBox(), - n.scalePivot ? (n.attachedMesh.getWorldMatrix().getRotationMatrixToRef(n._tmpRotationMatrix), - n._boundingDimensions.scaleToRef(.5, n._tmpVector), - a.x.TransformCoordinatesToRef(n._tmpVector, n._tmpRotationMatrix, n._tmpVector), - n._anchorMesh.position.subtractInPlace(n._tmpVector), - n._boundingDimensions.multiplyToRef(n.scalePivot, n._tmpVector), - a.x.TransformCoordinatesToRef(n._tmpVector, n._tmpRotationMatrix, n._tmpVector), - n._anchorMesh.position.addInPlace(n._tmpVector)) : (e.absolutePosition.subtractToRef(n._anchorMesh.position, n._tmpVector), - n._anchorMesh.position.subtractInPlace(n._tmpVector)), - n._anchorMesh.addChild(n.attachedMesh), - n._anchorMesh.scaling.addInPlace(o), - (n._anchorMesh.scaling.x < 0 || n._anchorMesh.scaling.y < 0 || n._anchorMesh.scaling.z < 0) && n._anchorMesh.scaling.subtractInPlace(o), - n._anchorMesh.removeChild(n.attachedMesh), - n.attachedMesh.setParent(i), - Ue.a._RestorePivotPoint(n.attachedMesh) - } - n._updateDummy() - }), - f.onDragStartObservable.add(function() { - n.onDragStartObservable.notifyObservers({}), - n._selectNode(e) - }), - f.onDragEndObservable.add(function() { - n.onScaleBoxDragEndObservable.notifyObservers({}), - n._selectNode(null), - n._updateDummy() - }), - p._scaleBoxesParent.addChild(e) - }, p = this, m = 0; m < 2; m++) - d(); - n._rootMesh.addChild(n._scaleBoxesParent); - var _ = new Array; - return n._pointerObserver = i.utilityLayerScene.onPointerObservable.add(function(e) { - _[e.event.pointerId] ? e.pickInfo && e.pickInfo.pickedMesh != _[e.event.pointerId] && (_[e.event.pointerId].material = n.coloredMaterial, - delete _[e.event.pointerId]) : n._rotateSpheresParent.getChildMeshes().concat(n._scaleBoxesParent.getChildMeshes()).forEach(function(t) { - e.pickInfo && e.pickInfo.pickedMesh == t && (_[e.event.pointerId] = t, - t.material = n.hoverColoredMaterial) - }) - }), - n._renderObserver = n.gizmoLayer.originalScene.onBeforeRenderObservable.add(function() { - n.attachedMesh && !n._existingMeshScale.equals(n.attachedMesh.scaling) ? n.updateBoundingBox() : n.fixedDragMeshScreenSize && (n._updateRotationSpheres(), - n._updateScaleBoxes()), - n._dragMesh && n.attachedMesh && n.pointerDragBehavior.dragging && (n._lineBoundingBox.position.rotateByQuaternionToRef(n._rootMesh.rotationQuaternion, n._tmpVector), - n.attachedMesh.setAbsolutePosition(n._dragMesh.position.add(n._tmpVector.scale(-1)))) - }), - n.updateBoundingBox(), - n - } - return h.d(t, e), - t.prototype.setColor = function(e) { - this.coloredMaterial.emissiveColor = e, - this.hoverColoredMaterial.emissiveColor = e.clone().add(new a.e(.3,.3,.3)), - this._lineBoundingBox.getChildren().forEach(function(t) { - t.color && (t.color = e) - }) - } - , - t.prototype._attachedMeshChanged = function(e) { - var t = this; - if (e) { - Ue.a._RemoveAndStorePivotPoint(e); - var i = e.parent; - this._anchorMesh.addChild(e), - this._anchorMesh.removeChild(e), - e.setParent(i), - Ue.a._RestorePivotPoint(e), - this.updateBoundingBox(), - e.getChildMeshes(false).forEach(function(e) { - e.markAsDirty("scaling") - }), - this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(function() { - t._updateDummy() - }) - } - } - , - t.prototype._selectNode = function(e) { - this._rotateSpheresParent.getChildMeshes().concat(this._scaleBoxesParent.getChildMeshes()).forEach(function(t) { - t.isVisible = !e || t == e - }) - } - , - t.prototype.updateBoundingBox = function() { - if (this.attachedMesh) { - Ue.a._RemoveAndStorePivotPoint(this.attachedMesh); - var e = this.attachedMesh.parent; - this.attachedMesh.setParent(null); - var t = null; - this.attachedMesh.skeleton && (t = this.attachedMesh.skeleton.overrideMesh, - this.attachedMesh.skeleton.overrideMesh = null), - this._update(), - this.attachedMesh.rotationQuaternion || (this.attachedMesh.rotationQuaternion = a.q.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z)), - this._anchorMesh.rotationQuaternion || (this._anchorMesh.rotationQuaternion = a.q.RotationYawPitchRoll(this._anchorMesh.rotation.y, this._anchorMesh.rotation.x, this._anchorMesh.rotation.z)), - this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion), - this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion), - this._tmpVector.copyFrom(this.attachedMesh.position), - this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1), - this.attachedMesh.position.set(0, 0, 0); - var i = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate); - i.max.subtractToRef(i.min, this._boundingDimensions), - this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions), - this._lineBoundingBox.position.set((i.max.x + i.min.x) / 2, (i.max.y + i.min.y) / 2, (i.max.z + i.min.z) / 2), - this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position), - this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position), - this._lineBoundingBox.computeWorldMatrix(), - this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition), - this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion), - this.attachedMesh.position.copyFrom(this._tmpVector), - this.attachedMesh.setParent(e), - this.attachedMesh.skeleton && (this.attachedMesh.skeleton.overrideMesh = t) - } - this._updateRotationSpheres(), + c._rotateSpheresParent.addChild(t); + }, + c = this, + u = 0; + u < 12; + u++ + ) + s(u); + n._rootMesh.addChild(n._rotateSpheresParent), + (n._scaleBoxesParent = new Ne.a("", i.utilityLayerScene)), + (n._scaleBoxesParent.rotationQuaternion = new a.q()); + for (var l = 0; l < 2; l++) + for (var h = 0; h < 2; h++) + for ( + var f, + d = function () { + var e = xn.a.CreateBox( + "", + { + size: 1, + }, + i.utilityLayerScene + ); + e.material = p.coloredMaterial; + var t = new a.x( + 0 == l ? -1 : 1, + 0 == h ? -1 : 1, + 0 == m ? -1 : 1 + ); + ((f = new Fe.a({ + dragAxis: t, + })).moveAttached = false), + e.addBehavior(f), + f.onDragObservable.add(function (t) { + if ( + (n.onScaleBoxDragObservable.notifyObservers( + {} + ), + n.attachedMesh) + ) { + var i = n.attachedMesh.parent; + if ( + i && + i.scaling && + i.scaling.isNonUniformWithinEpsilon(0.001) + ) + return void g.a.Warn( + "BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling" + ); + Ue.a._RemoveAndStorePivotPoint( + n.attachedMesh + ); + var r = + (t.dragDistance / + n._boundingDimensions.length()) * + n._anchorMesh.scaling.length(), + o = new a.x(r, r, r); + o.scaleInPlace(n._scaleDragSpeed), + n.updateBoundingBox(), + n.scalePivot + ? (n.attachedMesh + .getWorldMatrix() + .getRotationMatrixToRef( + n._tmpRotationMatrix + ), + n._boundingDimensions.scaleToRef( + 0.5, + n._tmpVector + ), + a.x.TransformCoordinatesToRef( + n._tmpVector, + n._tmpRotationMatrix, + n._tmpVector + ), + n._anchorMesh.position.subtractInPlace( + n._tmpVector + ), + n._boundingDimensions.multiplyToRef( + n.scalePivot, + n._tmpVector + ), + a.x.TransformCoordinatesToRef( + n._tmpVector, + n._tmpRotationMatrix, + n._tmpVector + ), + n._anchorMesh.position.addInPlace( + n._tmpVector + )) + : (e.absolutePosition.subtractToRef( + n._anchorMesh.position, + n._tmpVector + ), + n._anchorMesh.position.subtractInPlace( + n._tmpVector + )), + n._anchorMesh.addChild(n.attachedMesh), + n._anchorMesh.scaling.addInPlace(o), + (n._anchorMesh.scaling.x < 0 || + n._anchorMesh.scaling.y < 0 || + n._anchorMesh.scaling.z < 0) && + n._anchorMesh.scaling.subtractInPlace( + o + ), + n._anchorMesh.removeChild(n.attachedMesh), + n.attachedMesh.setParent(i), + Ue.a._RestorePivotPoint(n.attachedMesh); + } + n._updateDummy(); + }), + f.onDragStartObservable.add(function () { + n.onDragStartObservable.notifyObservers({}), + n._selectNode(e); + }), + f.onDragEndObservable.add(function () { + n.onScaleBoxDragEndObservable.notifyObservers( + {} + ), + n._selectNode(null), + n._updateDummy(); + }), + p._scaleBoxesParent.addChild(e); + }, + p = this, + m = 0; + m < 2; + m++ + ) + d(); + n._rootMesh.addChild(n._scaleBoxesParent); + var _ = new Array(); + return ( + (n._pointerObserver = + i.utilityLayerScene.onPointerObservable.add(function ( + e + ) { + _[e.event.pointerId] + ? e.pickInfo && + e.pickInfo.pickedMesh != _[e.event.pointerId] && + ((_[e.event.pointerId].material = + n.coloredMaterial), + delete _[e.event.pointerId]) + : n._rotateSpheresParent + .getChildMeshes() + .concat(n._scaleBoxesParent.getChildMeshes()) + .forEach(function (t) { + e.pickInfo && + e.pickInfo.pickedMesh == t && + ((_[e.event.pointerId] = t), + (t.material = n.hoverColoredMaterial)); + }); + })), + (n._renderObserver = + n.gizmoLayer.originalScene.onBeforeRenderObservable.add( + function () { + n.attachedMesh && + !n._existingMeshScale.equals(n.attachedMesh.scaling) + ? n.updateBoundingBox() + : n.fixedDragMeshScreenSize && + (n._updateRotationSpheres(), + n._updateScaleBoxes()), + n._dragMesh && + n.attachedMesh && + n.pointerDragBehavior.dragging && + (n._lineBoundingBox.position.rotateByQuaternionToRef( + n._rootMesh.rotationQuaternion, + n._tmpVector + ), + n.attachedMesh.setAbsolutePosition( + n._dragMesh.position.add( + n._tmpVector.scale(-1) + ) + )); + } + )), + n.updateBoundingBox(), + n + ); + } + return ( + h.d(t, e), + (t.prototype.setColor = function (e) { + (this.coloredMaterial.emissiveColor = e), + (this.hoverColoredMaterial.emissiveColor = e + .clone() + .add(new a.e(0.3, 0.3, 0.3))), + this._lineBoundingBox + .getChildren() + .forEach(function (t) { + t.color && (t.color = e); + }); + }), + (t.prototype._attachedMeshChanged = function (e) { + var t = this; + if (e) { + Ue.a._RemoveAndStorePivotPoint(e); + var i = e.parent; + this._anchorMesh.addChild(e), + this._anchorMesh.removeChild(e), + e.setParent(i), + Ue.a._RestorePivotPoint(e), + this.updateBoundingBox(), + e.getChildMeshes(false).forEach(function (e) { + e.markAsDirty("scaling"); + }), + this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce( + function () { + t._updateDummy(); + } + ); + } + }), + (t.prototype._selectNode = function (e) { + this._rotateSpheresParent + .getChildMeshes() + .concat(this._scaleBoxesParent.getChildMeshes()) + .forEach(function (t) { + t.isVisible = !e || t == e; + }); + }), + (t.prototype.updateBoundingBox = function () { + if (this.attachedMesh) { + Ue.a._RemoveAndStorePivotPoint(this.attachedMesh); + var e = this.attachedMesh.parent; + this.attachedMesh.setParent(null); + var t = null; + this.attachedMesh.skeleton && + ((t = this.attachedMesh.skeleton.overrideMesh), + (this.attachedMesh.skeleton.overrideMesh = null)), + this._update(), + this.attachedMesh.rotationQuaternion || + (this.attachedMesh.rotationQuaternion = + a.q.RotationYawPitchRoll( + this.attachedMesh.rotation.y, + this.attachedMesh.rotation.x, + this.attachedMesh.rotation.z + )), + this._anchorMesh.rotationQuaternion || + (this._anchorMesh.rotationQuaternion = + a.q.RotationYawPitchRoll( + this._anchorMesh.rotation.y, + this._anchorMesh.rotation.x, + this._anchorMesh.rotation.z + )), + this._anchorMesh.rotationQuaternion.copyFrom( + this.attachedMesh.rotationQuaternion + ), + this._tmpQuaternion.copyFrom( + this.attachedMesh.rotationQuaternion + ), + this._tmpVector.copyFrom(this.attachedMesh.position), + this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1), + this.attachedMesh.position.set(0, 0, 0); + var i = this.attachedMesh.getHierarchyBoundingVectors( + !this.ignoreChildren, + this.includeChildPredicate + ); + i.max.subtractToRef(i.min, this._boundingDimensions), + this._lineBoundingBox.scaling.copyFrom( + this._boundingDimensions + ), + this._lineBoundingBox.position.set( + (i.max.x + i.min.x) / 2, + (i.max.y + i.min.y) / 2, + (i.max.z + i.min.z) / 2 + ), + this._rotateSpheresParent.position.copyFrom( + this._lineBoundingBox.position + ), + this._scaleBoxesParent.position.copyFrom( + this._lineBoundingBox.position + ), + this._lineBoundingBox.computeWorldMatrix(), + this._anchorMesh.position.copyFrom( + this._lineBoundingBox.absolutePosition + ), + this.attachedMesh.rotationQuaternion.copyFrom( + this._tmpQuaternion + ), + this.attachedMesh.position.copyFrom(this._tmpVector), + this.attachedMesh.setParent(e), + this.attachedMesh.skeleton && + (this.attachedMesh.skeleton.overrideMesh = t); + } + this._updateRotationSpheres(), this._updateScaleBoxes(), - this.attachedMesh && (this._existingMeshScale.copyFrom(this.attachedMesh.scaling), - Ue.a._RestorePivotPoint(this.attachedMesh)) - } - , - t.prototype._updateRotationSpheres = function() { - for (var e = this._rotateSpheresParent.getChildMeshes(), t = 0; t < 3; t++) - for (var i = 0; i < 2; i++) - for (var n = 0; n < 2; n++) { - var r = 4 * t + 2 * i + n; - if (0 == t && (e[r].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * i, this._boundingDimensions.z * n), - e[r].position.addInPlace(new a.x(-this._boundingDimensions.x / 2,-this._boundingDimensions.y / 2,-this._boundingDimensions.z / 2)), - e[r].lookAt(a.x.Cross(e[r].position.normalizeToNew(), a.x.Right()).normalizeToNew().add(e[r].position))), - 1 == t && (e[r].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y / 2, this._boundingDimensions.z * n), - e[r].position.addInPlace(new a.x(-this._boundingDimensions.x / 2,-this._boundingDimensions.y / 2,-this._boundingDimensions.z / 2)), - e[r].lookAt(a.x.Cross(e[r].position.normalizeToNew(), a.x.Up()).normalizeToNew().add(e[r].position))), - 2 == t && (e[r].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * n, this._boundingDimensions.z / 2), - e[r].position.addInPlace(new a.x(-this._boundingDimensions.x / 2,-this._boundingDimensions.y / 2,-this._boundingDimensions.z / 2)), - e[r].lookAt(a.x.Cross(e[r].position.normalizeToNew(), a.x.Forward()).normalizeToNew().add(e[r].position))), - this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) { - e[r].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector); - var o = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor; - e[r].scaling.set(o, o, o) - } else - e[r].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize) - } - } - , - t.prototype._updateScaleBoxes = function() { - for (var e = this._scaleBoxesParent.getChildMeshes(), t = 0; t < 2; t++) - for (var i = 0; i < 2; i++) - for (var n = 0; n < 2; n++) { - var r = 4 * t + 2 * i + n; - if (e[r]) - if (e[r].position.set(this._boundingDimensions.x * t, this._boundingDimensions.y * i, this._boundingDimensions.z * n), - e[r].position.addInPlace(new a.x(-this._boundingDimensions.x / 2,-this._boundingDimensions.y / 2,-this._boundingDimensions.z / 2)), - this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) { - e[r].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector); - var o = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor; - e[r].scaling.set(o, o, o) - } else - e[r].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize) - } - } - , - t.prototype.setEnabledRotationAxis = function(e) { - this._rotateSpheresParent.getChildMeshes().forEach(function(t, i) { - i < 4 ? t.setEnabled(-1 != e.indexOf("x")) : i < 8 ? t.setEnabled(-1 != e.indexOf("y")) : t.setEnabled(-1 != e.indexOf("z")) - }) - } - , - t.prototype.setEnabledScaling = function(e) { - this._scaleBoxesParent.getChildMeshes().forEach(function(t, i) { - t.setEnabled(e) - }) - } - , - t.prototype._updateDummy = function() { - this._dragMesh && (this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition()), - this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling), - this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion)) - } - , - t.prototype.enableDragBehavior = function() { - this._dragMesh = me.a.CreateBox("dummy", 1, this.gizmoLayer.utilityLayerScene), - this._dragMesh.visibility = 0, - this._dragMesh.rotationQuaternion = new a.q, - this.pointerDragBehavior.useObjectOrienationForDragging = false, - this._dragMesh.addBehavior(this.pointerDragBehavior) - } - , - t.prototype.dispose = function() { - this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), - this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver), + this.attachedMesh && + (this._existingMeshScale.copyFrom( + this.attachedMesh.scaling + ), + Ue.a._RestorePivotPoint(this.attachedMesh)); + }), + (t.prototype._updateRotationSpheres = function () { + for ( + var e = this._rotateSpheresParent.getChildMeshes(), + t = 0; + t < 3; + t++ + ) + for (var i = 0; i < 2; i++) + for (var n = 0; n < 2; n++) { + var r = 4 * t + 2 * i + n; + if ( + (0 == t && + (e[r].position.set( + this._boundingDimensions.x / 2, + this._boundingDimensions.y * i, + this._boundingDimensions.z * n + ), + e[r].position.addInPlace( + new a.x( + -this._boundingDimensions.x / 2, + -this._boundingDimensions.y / 2, + -this._boundingDimensions.z / 2 + ) + ), + e[r].lookAt( + a.x + .Cross( + e[r].position.normalizeToNew(), + a.x.Right() + ) + .normalizeToNew() + .add(e[r].position) + )), + 1 == t && + (e[r].position.set( + this._boundingDimensions.x * i, + this._boundingDimensions.y / 2, + this._boundingDimensions.z * n + ), + e[r].position.addInPlace( + new a.x( + -this._boundingDimensions.x / 2, + -this._boundingDimensions.y / 2, + -this._boundingDimensions.z / 2 + ) + ), + e[r].lookAt( + a.x + .Cross( + e[r].position.normalizeToNew(), + a.x.Up() + ) + .normalizeToNew() + .add(e[r].position) + )), + 2 == t && + (e[r].position.set( + this._boundingDimensions.x * i, + this._boundingDimensions.y * n, + this._boundingDimensions.z / 2 + ), + e[r].position.addInPlace( + new a.x( + -this._boundingDimensions.x / 2, + -this._boundingDimensions.y / 2, + -this._boundingDimensions.z / 2 + ) + ), + e[r].lookAt( + a.x + .Cross( + e[r].position.normalizeToNew(), + a.x.Forward() + ) + .normalizeToNew() + .add(e[r].position) + )), + this.fixedDragMeshScreenSize && + this.gizmoLayer.utilityLayerScene.activeCamera) + ) { + e[r].absolutePosition.subtractToRef( + this.gizmoLayer.utilityLayerScene.activeCamera + .position, + this._tmpVector + ); + var o = + (this.rotationSphereSize * + this._tmpVector.length()) / + this.fixedDragMeshScreenSizeDistanceFactor; + e[r].scaling.set(o, o, o); + } else + e[r].scaling.set( + this.rotationSphereSize, + this.rotationSphereSize, + this.rotationSphereSize + ); + } + }), + (t.prototype._updateScaleBoxes = function () { + for ( + var e = this._scaleBoxesParent.getChildMeshes(), t = 0; + t < 2; + t++ + ) + for (var i = 0; i < 2; i++) + for (var n = 0; n < 2; n++) { + var r = 4 * t + 2 * i + n; + if (e[r]) + if ( + (e[r].position.set( + this._boundingDimensions.x * t, + this._boundingDimensions.y * i, + this._boundingDimensions.z * n + ), + e[r].position.addInPlace( + new a.x( + -this._boundingDimensions.x / 2, + -this._boundingDimensions.y / 2, + -this._boundingDimensions.z / 2 + ) + ), + this.fixedDragMeshScreenSize && + this.gizmoLayer.utilityLayerScene + .activeCamera) + ) { + e[r].absolutePosition.subtractToRef( + this.gizmoLayer.utilityLayerScene.activeCamera + .position, + this._tmpVector + ); + var o = + (this.scaleBoxSize * + this._tmpVector.length()) / + this.fixedDragMeshScreenSizeDistanceFactor; + e[r].scaling.set(o, o, o); + } else + e[r].scaling.set( + this.scaleBoxSize, + this.scaleBoxSize, + this.scaleBoxSize + ); + } + }), + (t.prototype.setEnabledRotationAxis = function (e) { + this._rotateSpheresParent + .getChildMeshes() + .forEach(function (t, i) { + i < 4 + ? t.setEnabled(-1 != e.indexOf("x")) + : i < 8 + ? t.setEnabled(-1 != e.indexOf("y")) + : t.setEnabled(-1 != e.indexOf("z")); + }); + }), + (t.prototype.setEnabledScaling = function (e) { + this._scaleBoxesParent + .getChildMeshes() + .forEach(function (t, i) { + t.setEnabled(e); + }); + }), + (t.prototype._updateDummy = function () { + this._dragMesh && + (this._dragMesh.position.copyFrom( + this._lineBoundingBox.getAbsolutePosition() + ), + this._dragMesh.scaling.copyFrom( + this._lineBoundingBox.scaling + ), + this._dragMesh.rotationQuaternion.copyFrom( + this._rootMesh.rotationQuaternion + )); + }), + (t.prototype.enableDragBehavior = function () { + (this._dragMesh = me.a.CreateBox( + "dummy", + 1, + this.gizmoLayer.utilityLayerScene + )), + (this._dragMesh.visibility = 0), + (this._dragMesh.rotationQuaternion = new a.q()), + (this.pointerDragBehavior.useObjectOrienationForDragging = false), + this._dragMesh.addBehavior(this.pointerDragBehavior); + }), + (t.prototype.dispose = function () { + this.gizmoLayer.utilityLayerScene.onPointerObservable.remove( + this._pointerObserver + ), + this.gizmoLayer.originalScene.onBeforeRenderObservable.remove( + this._renderObserver + ), this._lineBoundingBox.dispose(), this._rotateSpheresParent.dispose(), this._scaleBoxesParent.dispose(), this._dragMesh && this._dragMesh.dispose(), - e.prototype.dispose.call(this) - } - , - t.MakeNotPickableAndWrapInBoundingBox = function(e) { - (function e(t) { - t.isPickable = false, - t.getChildMeshes().forEach(function(t) { - e(t) - }) - } - )(e), - e.rotationQuaternion || (e.rotationQuaternion = a.q.RotationYawPitchRoll(e.rotation.y, e.rotation.x, e.rotation.z)); - var t = e.position.clone() - , i = e.rotationQuaternion.clone(); - e.rotationQuaternion.set(0, 0, 0, 1), + e.prototype.dispose.call(this); + }), + (t.MakeNotPickableAndWrapInBoundingBox = function (e) { + (function e(t) { + (t.isPickable = false), + t.getChildMeshes().forEach(function (t) { + e(t); + }); + })(e), + e.rotationQuaternion || + (e.rotationQuaternion = a.q.RotationYawPitchRoll( + e.rotation.y, + e.rotation.x, + e.rotation.z + )); + var t = e.position.clone(), + i = e.rotationQuaternion.clone(); + e.rotationQuaternion.set(0, 0, 0, 1), e.position.set(0, 0, 0); - var n = xn.a.CreateBox("box", { - size: 1 - }, e.getScene()) - , r = e.getHierarchyBoundingVectors(); - return r.max.subtractToRef(r.min, n.scaling), + var n = xn.a.CreateBox( + "box", + { + size: 1, + }, + e.getScene() + ), + r = e.getHierarchyBoundingVectors(); + return ( + r.max.subtractToRef(r.min, n.scaling), 0 === n.scaling.y && (n.scaling.y = a.h), 0 === n.scaling.x && (n.scaling.x = a.h), 0 === n.scaling.z && (n.scaling.z = a.h), - n.position.set((r.max.x + r.min.x) / 2, (r.max.y + r.min.y) / 2, (r.max.z + r.min.z) / 2), + n.position.set( + (r.max.x + r.min.x) / 2, + (r.max.y + r.min.y) / 2, + (r.max.z + r.min.z) / 2 + ), e.addChild(n), e.rotationQuaternion.copyFrom(i), e.position.copyFrom(t), e.removeChild(n), n.addChild(e), - n.visibility = 0, + (n.visibility = 0), n - } - , - t.prototype.setCustomMesh = function(e) { - g.a.Error("Custom meshes are not supported on this gizmo") - } - , + ); + }), + (t.prototype.setCustomMesh = function (e) { + g.a.Error( + "Custom meshes are not supported on this gizmo" + ); + }), t - }(Sn.a) - , wn = function(e) { - function t(t, i, n, r) { - void 0 === i && (i = a.e.Gray()), - void 0 === n && (n = Cn.a.DefaultUtilityLayer), - void 0 === r && (r = 32); - var s = e.call(this, n) || this; - s._pointerObserver = null, - s.snapDistance = 0, - s.onSnapObservable = new o.c; - var c = new bi.a("",n.utilityLayerScene); - c.diffuseColor = i, - c.specularColor = i.subtract(new a.e(.1,.1,.1)); - var u = new bi.a("",n.utilityLayerScene); - u.diffuseColor = i.add(new a.e(.3,.3,.3)); - var l = new Ne.a("",n.utilityLayerScene) - , h = me.a.CreateTorus("", .6, .03, r, n.utilityLayerScene); - h.visibility = 0; - var f = me.a.CreateTorus("", .6, .005, r, n.utilityLayerScene); - f.material = c, - f.rotation.x = Math.PI / 2, - h.rotation.x = Math.PI / 2, - l.addChild(f), - l.addChild(h), - l.lookAt(s._rootMesh.position.add(t)), - s._rootMesh.addChild(l), - l.scaling.scaleInPlace(1 / 3), - s.dragBehavior = new Fe.a({ - dragPlaneNormal: t - }), - s.dragBehavior.moveAttached = false, - s.dragBehavior.maxDragAngle = 9 * Math.PI / 20, - s.dragBehavior._useAlternatePickedPointAboveMaxDragAngle = true, - s._rootMesh.addBehavior(s.dragBehavior); - var d = new a.x; - s.dragBehavior.onDragStartObservable.add(function(e) { - s.attachedMesh && d.copyFrom(e.dragPlanePoint) - }); - var p = new a.j - , m = new a.x - , g = new a.x - , _ = { - snapDistance: 0 + ); + })(Sn.a), + wn = (function (e) { + function t(t, i, n, r) { + void 0 === i && (i = a.e.Gray()), + void 0 === n && (n = Cn.a.DefaultUtilityLayer), + void 0 === r && (r = 32); + var s = e.call(this, n) || this; + (s._pointerObserver = null), + (s.snapDistance = 0), + (s.onSnapObservable = new o.c()); + var c = new bi.a("", n.utilityLayerScene); + (c.diffuseColor = i), + (c.specularColor = i.subtract(new a.e(0.1, 0.1, 0.1))); + var u = new bi.a("", n.utilityLayerScene); + u.diffuseColor = i.add(new a.e(0.3, 0.3, 0.3)); + var l = new Ne.a("", n.utilityLayerScene), + h = me.a.CreateTorus( + "", + 0.6, + 0.03, + r, + n.utilityLayerScene + ); + h.visibility = 0; + var f = me.a.CreateTorus( + "", + 0.6, + 0.005, + r, + n.utilityLayerScene + ); + (f.material = c), + (f.rotation.x = Math.PI / 2), + (h.rotation.x = Math.PI / 2), + l.addChild(f), + l.addChild(h), + l.lookAt(s._rootMesh.position.add(t)), + s._rootMesh.addChild(l), + l.scaling.scaleInPlace(1 / 3), + (s.dragBehavior = new Fe.a({ + dragPlaneNormal: t, + })), + (s.dragBehavior.moveAttached = false), + (s.dragBehavior.maxDragAngle = (9 * Math.PI) / 20), + (s.dragBehavior._useAlternatePickedPointAboveMaxDragAngle = true), + s._rootMesh.addBehavior(s.dragBehavior); + var d = new a.x(); + s.dragBehavior.onDragStartObservable.add(function (e) { + s.attachedMesh && d.copyFrom(e.dragPlanePoint); + }); + var p = new a.j(), + m = new a.x(), + g = new a.x(), + _ = { + snapDistance: 0, + }, + v = 0, + y = new a.j(), + b = new a.x(), + E = new a.q(); + s.dragBehavior.onDragObservable.add(function (e) { + if (s.attachedMesh) { + s.attachedMesh.rotationQuaternion || + (s.attachedMesh.rotationQuaternion = + a.q.RotationYawPitchRoll( + s.attachedMesh.rotation.y, + s.attachedMesh.rotation.x, + s.attachedMesh.rotation.z + )); + var i = s.attachedMesh.parent; + i && s.attachedMesh.setParent(null); + var r = e.dragPlanePoint + .subtract(s.attachedMesh.absolutePosition) + .normalize(), + o = d + .subtract(s.attachedMesh.absolutePosition) + .normalize(), + c = a.x.Cross(r, o), + u = a.x.Dot(r, o), + l = Math.atan2(c.length(), u); + if ( + (m.copyFrom(t), + g.copyFrom(t), + s.updateGizmoRotationToMatchAttachedMesh && + (s.attachedMesh.rotationQuaternion.toRotationMatrix( + p + ), + (g = a.x.TransformCoordinates(m, p))), + n.utilityLayerScene.activeCamera) + ) { + var h = + n.utilityLayerScene.activeCamera.position.subtract( + s.attachedMesh.position + ); + a.x.Dot(h, g) > 0 && + (m.scaleInPlace(-1), g.scaleInPlace(-1)); } - , v = 0 - , y = new a.j - , b = new a.x - , E = new a.q; - s.dragBehavior.onDragObservable.add(function(e) { - if (s.attachedMesh) { - s.attachedMesh.rotationQuaternion || (s.attachedMesh.rotationQuaternion = a.q.RotationYawPitchRoll(s.attachedMesh.rotation.y, s.attachedMesh.rotation.x, s.attachedMesh.rotation.z)); - var i = s.attachedMesh.parent; - i && s.attachedMesh.setParent(null); - var r = e.dragPlanePoint.subtract(s.attachedMesh.absolutePosition).normalize() - , o = d.subtract(s.attachedMesh.absolutePosition).normalize() - , c = a.x.Cross(r, o) - , u = a.x.Dot(r, o) - , l = Math.atan2(c.length(), u); - if (m.copyFrom(t), - g.copyFrom(t), - s.updateGizmoRotationToMatchAttachedMesh && (s.attachedMesh.rotationQuaternion.toRotationMatrix(p), - g = a.x.TransformCoordinates(m, p)), - n.utilityLayerScene.activeCamera) { - var h = n.utilityLayerScene.activeCamera.position.subtract(s.attachedMesh.position); - a.x.Dot(h, g) > 0 && (m.scaleInPlace(-1), - g.scaleInPlace(-1)) - } - a.x.Dot(g, c) > 0 && (l = -l); - var f = false; - if (0 != s.snapDistance) - if (v += l, - Math.abs(v) > s.snapDistance) { - var T = Math.floor(Math.abs(v) / s.snapDistance); - v < 0 && (T *= -1), - v %= s.snapDistance, - l = s.snapDistance * T, - f = true - } else - l = 0; - y.reset(), - s.attachedMesh.parent && (s.attachedMesh.parent.computeWorldMatrix().invertToRef(y), - y.getRotationMatrixToRef(y), - a.x.TransformCoordinatesToRef(m, y, m)); - var A = Math.sin(l / 2); - E.set(m.x * A, m.y * A, m.z * A, Math.cos(l / 2)), - y.determinant() > 0 && (E.toEulerAnglesToRef(b), - a.q.RotationYawPitchRollToRef(b.y, -b.x, -b.z, E)), - s.updateGizmoRotationToMatchAttachedMesh ? s.attachedMesh.rotationQuaternion.multiplyToRef(E, s.attachedMesh.rotationQuaternion) : E.multiplyToRef(s.attachedMesh.rotationQuaternion, s.attachedMesh.rotationQuaternion), - d.copyFrom(e.dragPlanePoint), - f && (_.snapDistance = l, - s.onSnapObservable.notifyObservers(_)), - i && s.attachedMesh.setParent(i) - } - }), - s._pointerObserver = n.utilityLayerScene.onPointerObservable.add(function(e) { - if (!s._customMeshSet) { - var t = e.pickInfo && -1 != s._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh) ? u : c; - s._rootMesh.getChildMeshes().forEach(function(e) { - e.material = t, - e.color && (e.color = t.diffuseColor) - }) - } - }); - var T = n._getSharedGizmoLight(); - return T.includedOnlyMeshes = T.includedOnlyMeshes.concat(s._rootMesh.getChildMeshes(false)), - s - } - return h.d(t, e), - t.prototype._attachedMeshChanged = function(e) { - this.dragBehavior && (this.dragBehavior.enabled = !!e) - } - , - t.prototype.dispose = function() { - this.onSnapObservable.clear(), - this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), + a.x.Dot(g, c) > 0 && (l = -l); + var f = false; + if (0 != s.snapDistance) + if (((v += l), Math.abs(v) > s.snapDistance)) { + var T = Math.floor(Math.abs(v) / s.snapDistance); + v < 0 && (T *= -1), + (v %= s.snapDistance), + (l = s.snapDistance * T), + (f = true); + } else l = 0; + y.reset(), + s.attachedMesh.parent && + (s.attachedMesh.parent + .computeWorldMatrix() + .invertToRef(y), + y.getRotationMatrixToRef(y), + a.x.TransformCoordinatesToRef(m, y, m)); + var A = Math.sin(l / 2); + E.set(m.x * A, m.y * A, m.z * A, Math.cos(l / 2)), + y.determinant() > 0 && + (E.toEulerAnglesToRef(b), + a.q.RotationYawPitchRollToRef(b.y, -b.x, -b.z, E)), + s.updateGizmoRotationToMatchAttachedMesh + ? s.attachedMesh.rotationQuaternion.multiplyToRef( + E, + s.attachedMesh.rotationQuaternion + ) + : E.multiplyToRef( + s.attachedMesh.rotationQuaternion, + s.attachedMesh.rotationQuaternion + ), + d.copyFrom(e.dragPlanePoint), + f && + ((_.snapDistance = l), + s.onSnapObservable.notifyObservers(_)), + i && s.attachedMesh.setParent(i); + } + }), + (s._pointerObserver = + n.utilityLayerScene.onPointerObservable.add(function ( + e + ) { + if (!s._customMeshSet) { + var t = + e.pickInfo && + -1 != + s._rootMesh + .getChildMeshes() + .indexOf(e.pickInfo.pickedMesh) + ? u + : c; + s._rootMesh.getChildMeshes().forEach(function (e) { + (e.material = t), + e.color && (e.color = t.diffuseColor); + }); + } + })); + var T = n._getSharedGizmoLight(); + return ( + (T.includedOnlyMeshes = T.includedOnlyMeshes.concat( + s._rootMesh.getChildMeshes(false) + )), + s + ); + } + return ( + h.d(t, e), + (t.prototype._attachedMeshChanged = function (e) { + this.dragBehavior && (this.dragBehavior.enabled = !!e); + }), + (t.prototype.dispose = function () { + this.onSnapObservable.clear(), + this.gizmoLayer.utilityLayerScene.onPointerObservable.remove( + this._pointerObserver + ), this.dragBehavior.detach(), - e.prototype.dispose.call(this) - } - , + e.prototype.dispose.call(this); + }), t - }(Sn.a) - , In = function(e) { - function t(t, i) { - void 0 === t && (t = Cn.a.DefaultUtilityLayer), - void 0 === i && (i = 32); - var n = e.call(this, t) || this; - return n.onDragStartObservable = new o.c, - n.onDragEndObservable = new o.c, - n.xGizmo = new wn(new a.x(1,0,0),a.e.Red().scale(.5),t,i), - n.yGizmo = new wn(new a.x(0,1,0),a.e.Green().scale(.5),t,i), - n.zGizmo = new wn(new a.x(0,0,1),a.e.Blue().scale(.5),t,i), - [n.xGizmo, n.yGizmo, n.zGizmo].forEach(function(e) { - e.dragBehavior.onDragStartObservable.add(function() { - n.onDragStartObservable.notifyObservers({}) - }), - e.dragBehavior.onDragEndObservable.add(function() { - n.onDragEndObservable.notifyObservers({}) - }) - }), - n.attachedMesh = null, - n - } - return h.d(t, e), - Object.defineProperty(t.prototype, "attachedMesh", { - get: function() { - return this.xGizmo.attachedMesh - }, - set: function(e) { - this.xGizmo && (this.xGizmo.attachedMesh = e, - this.yGizmo.attachedMesh = e, - this.zGizmo.attachedMesh = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "updateGizmoRotationToMatchAttachedMesh", { - get: function() { - return this.xGizmo.updateGizmoRotationToMatchAttachedMesh - }, - set: function(e) { - this.xGizmo && (this.xGizmo.updateGizmoRotationToMatchAttachedMesh = e, - this.yGizmo.updateGizmoRotationToMatchAttachedMesh = e, - this.zGizmo.updateGizmoRotationToMatchAttachedMesh = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "snapDistance", { - get: function() { - return this.xGizmo.snapDistance - }, - set: function(e) { - this.xGizmo && (this.xGizmo.snapDistance = e, - this.yGizmo.snapDistance = e, - this.zGizmo.snapDistance = e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "scaleRatio", { - get: function() { - return this.xGizmo.scaleRatio - }, - set: function(e) { - this.xGizmo && (this.xGizmo.scaleRatio = e, - this.yGizmo.scaleRatio = e, - this.zGizmo.scaleRatio = e) - }, - enumerable: true, - configurable: true - }), - t.prototype.dispose = function() { - this.xGizmo.dispose(), - this.yGizmo.dispose(), - this.zGizmo.dispose(), - this.onDragStartObservable.clear(), - this.onDragEndObservable.clear() - } - , - t.prototype.setCustomMesh = function(e) { - g.a.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)") - } - , - t - }(Sn.a) - , Dn = function(e) { - function t(t) { - void 0 === t && (t = Cn.a.DefaultUtilityLayer); - var i = e.call(this, t) || this; - return i.onDragStartObservable = new o.c, - i.onDragEndObservable = new o.c, - i.xGizmo = new An.a(new a.x(1,0,0),a.e.Red().scale(.5),t), - i.yGizmo = new An.a(new a.x(0,1,0),a.e.Green().scale(.5),t), - i.zGizmo = new An.a(new a.x(0,0,1),a.e.Blue().scale(.5),t), - [i.xGizmo, i.yGizmo, i.zGizmo].forEach(function(e) { - e.dragBehavior.onDragStartObservable.add(function() { - i.onDragStartObservable.notifyObservers({}) - }), - e.dragBehavior.onDragEndObservable.add(function() { - i.onDragEndObservable.notifyObservers({}) - }) - }), - i.attachedMesh = null, + ); + })(Sn.a), + In = (function (e) { + function t(t, i) { + void 0 === t && (t = Cn.a.DefaultUtilityLayer), + void 0 === i && (i = 32); + var n = e.call(this, t) || this; + return ( + (n.onDragStartObservable = new o.c()), + (n.onDragEndObservable = new o.c()), + (n.xGizmo = new wn( + new a.x(1, 0, 0), + a.e.Red().scale(0.5), + t, i - } - return h.d(t, e), + )), + (n.yGizmo = new wn( + new a.x(0, 1, 0), + a.e.Green().scale(0.5), + t, + i + )), + (n.zGizmo = new wn( + new a.x(0, 0, 1), + a.e.Blue().scale(0.5), + t, + i + )), + [n.xGizmo, n.yGizmo, n.zGizmo].forEach(function (e) { + e.dragBehavior.onDragStartObservable.add(function () { + n.onDragStartObservable.notifyObservers({}); + }), + e.dragBehavior.onDragEndObservable.add(function () { + n.onDragEndObservable.notifyObservers({}); + }); + }), + (n.attachedMesh = null), + n + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "attachedMesh", { - get: function() { - return this.xGizmo.attachedMesh + get: function () { + return this.xGizmo.attachedMesh; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.attachedMesh = e), + (this.yGizmo.attachedMesh = e), + (this.zGizmo.attachedMesh = e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "updateGizmoRotationToMatchAttachedMesh", + { + get: function () { + return this.xGizmo + .updateGizmoRotationToMatchAttachedMesh; }, - set: function(e) { - this.xGizmo && (this.xGizmo.attachedMesh = e, - this.yGizmo.attachedMesh = e, - this.zGizmo.attachedMesh = e) + set: function (e) { + this.xGizmo && + ((this.xGizmo.updateGizmoRotationToMatchAttachedMesh = + e), + (this.yGizmo.updateGizmoRotationToMatchAttachedMesh = + e), + (this.zGizmo.updateGizmoRotationToMatchAttachedMesh = + e)); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "updateGizmoRotationToMatchAttachedMesh", { - get: function() { - return this.xGizmo.updateGizmoRotationToMatchAttachedMesh - }, - set: function(e) { - this.xGizmo && (this.xGizmo.updateGizmoRotationToMatchAttachedMesh = e, - this.yGizmo.updateGizmoRotationToMatchAttachedMesh = e, - this.zGizmo.updateGizmoRotationToMatchAttachedMesh = e) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "snapDistance", { - get: function() { - return this.xGizmo.snapDistance - }, - set: function(e) { - this.xGizmo && (this.xGizmo.snapDistance = e, - this.yGizmo.snapDistance = e, - this.zGizmo.snapDistance = e) - }, - enumerable: true, - configurable: true + get: function () { + return this.xGizmo.snapDistance; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.snapDistance = e), + (this.yGizmo.snapDistance = e), + (this.zGizmo.snapDistance = e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "scaleRatio", { - get: function() { - return this.xGizmo.scaleRatio - }, - set: function(e) { - this.xGizmo && (this.xGizmo.scaleRatio = e, - this.yGizmo.scaleRatio = e, - this.zGizmo.scaleRatio = e) - }, - enumerable: true, - configurable: true + get: function () { + return this.xGizmo.scaleRatio; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.scaleRatio = e), + (this.yGizmo.scaleRatio = e), + (this.zGizmo.scaleRatio = e)); + }, + enumerable: true, + configurable: true, }), - t.prototype.dispose = function() { - this.xGizmo.dispose(), + (t.prototype.dispose = function () { + this.xGizmo.dispose(), this.yGizmo.dispose(), this.zGizmo.dispose(), this.onDragStartObservable.clear(), - this.onDragEndObservable.clear() - } - , - t.prototype.setCustomMesh = function(e) { - g.a.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)") - } - , + this.onDragEndObservable.clear(); + }), + (t.prototype.setCustomMesh = function (e) { + g.a.Error( + "Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)" + ); + }), t - }(Sn.a); - xi.a.CreatePolyhedron = function(e) { - var t = []; - t[0] = { - vertex: [[0, 0, 1.732051], [1.632993, 0, -.5773503], [-.8164966, 1.414214, -.5773503], [-.8164966, -1.414214, -.5773503]], - face: [[0, 1, 2], [0, 2, 3], [0, 3, 1], [1, 3, 2]] - }, - t[1] = { - vertex: [[0, 0, 1.414214], [1.414214, 0, 0], [0, 1.414214, 0], [-1.414214, 0, 0], [0, -1.414214, 0], [0, 0, -1.414214]], - face: [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [3, 5, 4]] - }, - t[2] = { - vertex: [[0, 0, 1.070466], [.7136442, 0, .7978784], [-.3568221, .618034, .7978784], [-.3568221, -.618034, .7978784], [.7978784, .618034, .3568221], [.7978784, -.618034, .3568221], [-.9341724, .381966, .3568221], [.1362939, 1, .3568221], [.1362939, -1, .3568221], [-.9341724, -.381966, .3568221], [.9341724, .381966, -.3568221], [.9341724, -.381966, -.3568221], [-.7978784, .618034, -.3568221], [-.1362939, 1, -.3568221], [-.1362939, -1, -.3568221], [-.7978784, -.618034, -.3568221], [.3568221, .618034, -.7978784], [.3568221, -.618034, -.7978784], [-.7136442, 0, -.7978784], [0, 0, -1.070466]], - face: [[0, 1, 4, 7, 2], [0, 2, 6, 9, 3], [0, 3, 8, 5, 1], [1, 5, 11, 10, 4], [2, 7, 13, 12, 6], [3, 9, 15, 14, 8], [4, 10, 16, 13, 7], [5, 8, 14, 17, 11], [6, 12, 18, 15, 9], [10, 11, 17, 19, 16], [12, 13, 16, 19, 18], [14, 15, 18, 19, 17]] - }, - t[3] = { - vertex: [[0, 0, 1.175571], [1.051462, 0, .5257311], [.3249197, 1, .5257311], [-.8506508, .618034, .5257311], [-.8506508, -.618034, .5257311], [.3249197, -1, .5257311], [.8506508, .618034, -.5257311], [.8506508, -.618034, -.5257311], [-.3249197, 1, -.5257311], [-1.051462, 0, -.5257311], [-.3249197, -1, -.5257311], [0, 0, -1.175571]], - face: [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1], [1, 5, 7], [1, 7, 6], [1, 6, 2], [2, 6, 8], [2, 8, 3], [3, 8, 9], [3, 9, 4], [4, 9, 10], [4, 10, 5], [5, 10, 7], [6, 7, 11], [6, 11, 8], [7, 10, 11], [8, 11, 9], [9, 11, 10]] - }, - t[4] = { - vertex: [[0, 0, 1.070722], [.7148135, 0, .7971752], [-.104682, .7071068, .7971752], [-.6841528, .2071068, .7971752], [-.104682, -.7071068, .7971752], [.6101315, .7071068, .5236279], [1.04156, .2071068, .1367736], [.6101315, -.7071068, .5236279], [-.3574067, 1, .1367736], [-.7888348, -.5, .5236279], [-.9368776, .5, .1367736], [-.3574067, -1, .1367736], [.3574067, 1, -.1367736], [.9368776, -.5, -.1367736], [.7888348, .5, -.5236279], [.3574067, -1, -.1367736], [-.6101315, .7071068, -.5236279], [-1.04156, -.2071068, -.1367736], [-.6101315, -.7071068, -.5236279], [.104682, .7071068, -.7971752], [.6841528, -.2071068, -.7971752], [.104682, -.7071068, -.7971752], [-.7148135, 0, -.7971752], [0, 0, -1.070722]], - face: [[0, 2, 3], [1, 6, 5], [4, 9, 11], [7, 15, 13], [8, 16, 10], [12, 14, 19], [17, 22, 18], [20, 21, 23], [0, 1, 5, 2], [0, 3, 9, 4], [0, 4, 7, 1], [1, 7, 13, 6], [2, 5, 12, 8], [2, 8, 10, 3], [3, 10, 17, 9], [4, 11, 15, 7], [5, 6, 14, 12], [6, 13, 20, 14], [8, 12, 19, 16], [9, 17, 18, 11], [10, 16, 22, 17], [11, 18, 21, 15], [13, 15, 21, 20], [14, 20, 23, 19], [16, 19, 23, 22], [18, 22, 23, 21]] - }, - t[5] = { - vertex: [[0, 0, 1.322876], [1.309307, 0, .1889822], [-.9819805, .8660254, .1889822], [.1636634, -1.299038, .1889822], [.3273268, .8660254, -.9449112], [-.8183171, -.4330127, -.9449112]], - face: [[0, 3, 1], [2, 4, 5], [0, 1, 4, 2], [0, 2, 5, 3], [1, 3, 5, 4]] - }, - t[6] = { - vertex: [[0, 0, 1.159953], [1.013464, 0, .5642542], [-.3501431, .9510565, .5642542], [-.7715208, -.6571639, .5642542], [.6633206, .9510565, -.03144481], [.8682979, -.6571639, -.3996071], [-1.121664, .2938926, -.03144481], [-.2348831, -1.063314, -.3996071], [.5181548, .2938926, -.9953061], [-.5850262, -.112257, -.9953061]], - face: [[0, 1, 4, 2], [0, 2, 6, 3], [1, 5, 8, 4], [3, 6, 9, 7], [5, 7, 9, 8], [0, 3, 7, 5, 1], [2, 4, 8, 9, 6]] - }, - t[7] = { - vertex: [[0, 0, 1.118034], [.8944272, 0, .6708204], [-.2236068, .8660254, .6708204], [-.7826238, -.4330127, .6708204], [.6708204, .8660254, .2236068], [1.006231, -.4330127, -.2236068], [-1.006231, .4330127, .2236068], [-.6708204, -.8660254, -.2236068], [.7826238, .4330127, -.6708204], [.2236068, -.8660254, -.6708204], [-.8944272, 0, -.6708204], [0, 0, -1.118034]], - face: [[0, 1, 4, 2], [0, 2, 6, 3], [1, 5, 8, 4], [3, 6, 10, 7], [5, 9, 11, 8], [7, 10, 11, 9], [0, 3, 7, 9, 5, 1], [2, 4, 8, 11, 10, 6]] - }, - t[8] = { - vertex: [[-.729665, .670121, .319155], [-.655235, -.29213, -.754096], [-.093922, -.607123, .537818], [.702196, .595691, .485187], [.776626, -.36656, -.588064]], - face: [[1, 4, 2], [0, 1, 2], [3, 0, 2], [4, 3, 2], [4, 1, 0, 3]] - }, - t[9] = { - vertex: [[-.868849, -.100041, .61257], [-.329458, .976099, .28078], [-.26629, -.013796, -.477654], [-.13392, -1.034115, .229829], [.738834, .707117, -.307018], [.859683, -.535264, -.338508]], - face: [[3, 0, 2], [5, 3, 2], [4, 5, 2], [1, 4, 2], [0, 1, 2], [0, 3, 5, 4, 1]] - }, - t[10] = { - vertex: [[-.610389, .243975, .531213], [-.187812, -.48795, -.664016], [-.187812, .9759, -.664016], [.187812, -.9759, .664016], [.798201, .243975, .132803]], - face: [[1, 3, 0], [3, 4, 0], [3, 1, 4], [0, 2, 1], [0, 4, 2], [2, 4, 1]] - }, - t[11] = { - vertex: [[-1.028778, .392027, -.048786], [-.640503, -.646161, .621837], [-.125162, -.395663, -.540059], [.004683, .888447, -.651988], [.125161, .395663, .540059], [.632925, -.791376, .433102], [1.031672, .157063, -.354165]], - face: [[3, 2, 0], [2, 1, 0], [2, 5, 1], [0, 4, 3], [0, 1, 4], [4, 1, 5], [2, 3, 6], [3, 4, 6], [5, 2, 6], [4, 5, 6]] - }, - t[12] = { - vertex: [[-.669867, .334933, -.529576], [-.669867, .334933, .529577], [-.4043, 1.212901, 0], [-.334933, -.669867, -.529576], [-.334933, -.669867, .529577], [.334933, .669867, -.529576], [.334933, .669867, .529577], [.4043, -1.212901, 0], [.669867, -.334933, -.529576], [.669867, -.334933, .529577]], - face: [[8, 9, 7], [6, 5, 2], [3, 8, 7], [5, 0, 2], [4, 3, 7], [0, 1, 2], [9, 4, 7], [1, 6, 2], [9, 8, 5, 6], [8, 3, 0, 5], [3, 4, 1, 0], [4, 9, 6, 1]] - }, - t[13] = { - vertex: [[-.931836, .219976, -.264632], [-.636706, .318353, .692816], [-.613483, -.735083, -.264632], [-.326545, .979634, 0], [-.318353, -.636706, .692816], [-.159176, .477529, -.856368], [.159176, -.477529, -.856368], [.318353, .636706, .692816], [.326545, -.979634, 0], [.613482, .735082, -.264632], [.636706, -.318353, .692816], [.931835, -.219977, -.264632]], - face: [[11, 10, 8], [7, 9, 3], [6, 11, 8], [9, 5, 3], [2, 6, 8], [5, 0, 3], [4, 2, 8], [0, 1, 3], [10, 4, 8], [1, 7, 3], [10, 11, 9, 7], [11, 6, 5, 9], [6, 2, 0, 5], [2, 4, 1, 0], [4, 10, 7, 1]] - }, - t[14] = { - vertex: [[-.93465, .300459, -.271185], [-.838689, -.260219, -.516017], [-.711319, .717591, .128359], [-.710334, -.156922, .080946], [-.599799, .556003, -.725148], [-.503838, -.004675, -.969981], [-.487004, .26021, .48049], [-.460089, -.750282, -.512622], [-.376468, .973135, -.325605], [-.331735, -.646985, .084342], [-.254001, .831847, .530001], [-.125239, -.494738, -.966586], [.029622, .027949, .730817], [.056536, -.982543, -.262295], [.08085, 1.087391, .076037], [.125583, -.532729, .485984], [.262625, .599586, .780328], [.391387, -.726999, -.716259], [.513854, -.868287, .139347], [.597475, .85513, .326364], [.641224, .109523, .783723], [.737185, -.451155, .538891], [.848705, -.612742, -.314616], [.976075, .365067, .32976], [1.072036, -.19561, .084927]], - face: [[15, 18, 21], [12, 20, 16], [6, 10, 2], [3, 0, 1], [9, 7, 13], [2, 8, 4, 0], [0, 4, 5, 1], [1, 5, 11, 7], [7, 11, 17, 13], [13, 17, 22, 18], [18, 22, 24, 21], [21, 24, 23, 20], [20, 23, 19, 16], [16, 19, 14, 10], [10, 14, 8, 2], [15, 9, 13, 18], [12, 15, 21, 20], [6, 12, 16, 10], [3, 6, 2, 0], [9, 3, 1, 7], [9, 15, 12, 6, 3], [22, 17, 11, 5, 4, 8, 14, 19, 23, 24]] - }; - var i, n, r, o, s, c, u = e.type && (e.type < 0 || e.type >= t.length) ? 0 : e.type || 0, l = e.size, h = e.sizeX || l || 1, f = e.sizeY || l || 1, d = e.sizeZ || l || 1, p = e.custom || t[u], m = p.face.length, g = e.faceUV || new Array(m), _ = e.faceColors, v = void 0 === e.flat || e.flat, y = 0 === e.sideOrientation ? 0 : e.sideOrientation || xi.a.DEFAULTSIDE, b = new Array, E = new Array, T = new Array, A = new Array, x = new Array, S = 0, C = 0, P = new Array, R = 0, M = 0; - if (v) - for (M = 0; M < m; M++) - _ && void 0 === _[M] && (_[M] = new a.f(1,1,1,1)), - g && void 0 === g[M] && (g[M] = new a.y(0,0,1,1)); - if (v) - for (M = 0; M < m; M++) { - var O = p.face[M].length; - for (r = 2 * Math.PI / O, - o = .5 * Math.tan(r / 2), - s = .5, - R = 0; R < O; R++) - b.push(p.vertex[p.face[M][R]][0] * h, p.vertex[p.face[M][R]][1] * f, p.vertex[p.face[M][R]][2] * d), - P.push(S), - S++, - i = g[M].x + (g[M].z - g[M].x) * (.5 + o), - n = g[M].y + (g[M].w - g[M].y) * (s - .5), - A.push(i, n), - c = o * Math.cos(r) - s * Math.sin(r), - s = o * Math.sin(r) + s * Math.cos(r), - o = c, - _ && x.push(_[M].r, _[M].g, _[M].b, _[M].a); - for (R = 0; R < O - 2; R++) - E.push(P[0 + C], P[R + 2 + C], P[R + 1 + C]); - C += O - } - else { - for (R = 0; R < p.vertex.length; R++) - b.push(p.vertex[R][0] * h, p.vertex[R][1] * f, p.vertex[R][2] * d), - A.push(0, 0); - for (M = 0; M < m; M++) - for (R = 0; R < p.face[M].length - 2; R++) - E.push(p.face[M][0], p.face[M][R + 2], p.face[M][R + 1]) - } - xi.a.ComputeNormals(b, E, T), - xi.a._ComputeSides(y, b, E, T, A, e.frontUVs, e.backUVs); - var w = new xi.a; - return w.positions = b, - w.indices = E, - w.normals = T, - w.uvs = A, - _ && v && (w.colors = x), - w + ); + })(Sn.a), + Dn = (function (e) { + function t(t) { + void 0 === t && (t = Cn.a.DefaultUtilityLayer); + var i = e.call(this, t) || this; + return ( + (i.onDragStartObservable = new o.c()), + (i.onDragEndObservable = new o.c()), + (i.xGizmo = new An.a( + new a.x(1, 0, 0), + a.e.Red().scale(0.5), + t + )), + (i.yGizmo = new An.a( + new a.x(0, 1, 0), + a.e.Green().scale(0.5), + t + )), + (i.zGizmo = new An.a( + new a.x(0, 0, 1), + a.e.Blue().scale(0.5), + t + )), + [i.xGizmo, i.yGizmo, i.zGizmo].forEach(function (e) { + e.dragBehavior.onDragStartObservable.add(function () { + i.onDragStartObservable.notifyObservers({}); + }), + e.dragBehavior.onDragEndObservable.add(function () { + i.onDragEndObservable.notifyObservers({}); + }); + }), + (i.attachedMesh = null), + i + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "attachedMesh", { + get: function () { + return this.xGizmo.attachedMesh; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.attachedMesh = e), + (this.yGizmo.attachedMesh = e), + (this.zGizmo.attachedMesh = e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "updateGizmoRotationToMatchAttachedMesh", + { + get: function () { + return this.xGizmo + .updateGizmoRotationToMatchAttachedMesh; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.updateGizmoRotationToMatchAttachedMesh = + e), + (this.yGizmo.updateGizmoRotationToMatchAttachedMesh = + e), + (this.zGizmo.updateGizmoRotationToMatchAttachedMesh = + e)); + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty(t.prototype, "snapDistance", { + get: function () { + return this.xGizmo.snapDistance; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.snapDistance = e), + (this.yGizmo.snapDistance = e), + (this.zGizmo.snapDistance = e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "scaleRatio", { + get: function () { + return this.xGizmo.scaleRatio; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.scaleRatio = e), + (this.yGizmo.scaleRatio = e), + (this.zGizmo.scaleRatio = e)); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.dispose = function () { + this.xGizmo.dispose(), + this.yGizmo.dispose(), + this.zGizmo.dispose(), + this.onDragStartObservable.clear(), + this.onDragEndObservable.clear(); + }), + (t.prototype.setCustomMesh = function (e) { + g.a.Error( + "Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)" + ); + }), + t + ); + })(Sn.a); + (xi.a.CreatePolyhedron = function (e) { + var t = []; + (t[0] = { + vertex: [ + [0, 0, 1.732051], + [1.632993, 0, -0.5773503], + [-0.8164966, 1.414214, -0.5773503], + [-0.8164966, -1.414214, -0.5773503], + ], + face: [ + [0, 1, 2], + [0, 2, 3], + [0, 3, 1], + [1, 3, 2], + ], + }), + (t[1] = { + vertex: [ + [0, 0, 1.414214], + [1.414214, 0, 0], + [0, 1.414214, 0], + [-1.414214, 0, 0], + [0, -1.414214, 0], + [0, 0, -1.414214], + ], + face: [ + [0, 1, 2], + [0, 2, 3], + [0, 3, 4], + [0, 4, 1], + [1, 4, 5], + [1, 5, 2], + [2, 5, 3], + [3, 5, 4], + ], + }), + (t[2] = { + vertex: [ + [0, 0, 1.070466], + [0.7136442, 0, 0.7978784], + [-0.3568221, 0.618034, 0.7978784], + [-0.3568221, -0.618034, 0.7978784], + [0.7978784, 0.618034, 0.3568221], + [0.7978784, -0.618034, 0.3568221], + [-0.9341724, 0.381966, 0.3568221], + [0.1362939, 1, 0.3568221], + [0.1362939, -1, 0.3568221], + [-0.9341724, -0.381966, 0.3568221], + [0.9341724, 0.381966, -0.3568221], + [0.9341724, -0.381966, -0.3568221], + [-0.7978784, 0.618034, -0.3568221], + [-0.1362939, 1, -0.3568221], + [-0.1362939, -1, -0.3568221], + [-0.7978784, -0.618034, -0.3568221], + [0.3568221, 0.618034, -0.7978784], + [0.3568221, -0.618034, -0.7978784], + [-0.7136442, 0, -0.7978784], + [0, 0, -1.070466], + ], + face: [ + [0, 1, 4, 7, 2], + [0, 2, 6, 9, 3], + [0, 3, 8, 5, 1], + [1, 5, 11, 10, 4], + [2, 7, 13, 12, 6], + [3, 9, 15, 14, 8], + [4, 10, 16, 13, 7], + [5, 8, 14, 17, 11], + [6, 12, 18, 15, 9], + [10, 11, 17, 19, 16], + [12, 13, 16, 19, 18], + [14, 15, 18, 19, 17], + ], + }), + (t[3] = { + vertex: [ + [0, 0, 1.175571], + [1.051462, 0, 0.5257311], + [0.3249197, 1, 0.5257311], + [-0.8506508, 0.618034, 0.5257311], + [-0.8506508, -0.618034, 0.5257311], + [0.3249197, -1, 0.5257311], + [0.8506508, 0.618034, -0.5257311], + [0.8506508, -0.618034, -0.5257311], + [-0.3249197, 1, -0.5257311], + [-1.051462, 0, -0.5257311], + [-0.3249197, -1, -0.5257311], + [0, 0, -1.175571], + ], + face: [ + [0, 1, 2], + [0, 2, 3], + [0, 3, 4], + [0, 4, 5], + [0, 5, 1], + [1, 5, 7], + [1, 7, 6], + [1, 6, 2], + [2, 6, 8], + [2, 8, 3], + [3, 8, 9], + [3, 9, 4], + [4, 9, 10], + [4, 10, 5], + [5, 10, 7], + [6, 7, 11], + [6, 11, 8], + [7, 10, 11], + [8, 11, 9], + [9, 11, 10], + ], + }), + (t[4] = { + vertex: [ + [0, 0, 1.070722], + [0.7148135, 0, 0.7971752], + [-0.104682, 0.7071068, 0.7971752], + [-0.6841528, 0.2071068, 0.7971752], + [-0.104682, -0.7071068, 0.7971752], + [0.6101315, 0.7071068, 0.5236279], + [1.04156, 0.2071068, 0.1367736], + [0.6101315, -0.7071068, 0.5236279], + [-0.3574067, 1, 0.1367736], + [-0.7888348, -0.5, 0.5236279], + [-0.9368776, 0.5, 0.1367736], + [-0.3574067, -1, 0.1367736], + [0.3574067, 1, -0.1367736], + [0.9368776, -0.5, -0.1367736], + [0.7888348, 0.5, -0.5236279], + [0.3574067, -1, -0.1367736], + [-0.6101315, 0.7071068, -0.5236279], + [-1.04156, -0.2071068, -0.1367736], + [-0.6101315, -0.7071068, -0.5236279], + [0.104682, 0.7071068, -0.7971752], + [0.6841528, -0.2071068, -0.7971752], + [0.104682, -0.7071068, -0.7971752], + [-0.7148135, 0, -0.7971752], + [0, 0, -1.070722], + ], + face: [ + [0, 2, 3], + [1, 6, 5], + [4, 9, 11], + [7, 15, 13], + [8, 16, 10], + [12, 14, 19], + [17, 22, 18], + [20, 21, 23], + [0, 1, 5, 2], + [0, 3, 9, 4], + [0, 4, 7, 1], + [1, 7, 13, 6], + [2, 5, 12, 8], + [2, 8, 10, 3], + [3, 10, 17, 9], + [4, 11, 15, 7], + [5, 6, 14, 12], + [6, 13, 20, 14], + [8, 12, 19, 16], + [9, 17, 18, 11], + [10, 16, 22, 17], + [11, 18, 21, 15], + [13, 15, 21, 20], + [14, 20, 23, 19], + [16, 19, 23, 22], + [18, 22, 23, 21], + ], + }), + (t[5] = { + vertex: [ + [0, 0, 1.322876], + [1.309307, 0, 0.1889822], + [-0.9819805, 0.8660254, 0.1889822], + [0.1636634, -1.299038, 0.1889822], + [0.3273268, 0.8660254, -0.9449112], + [-0.8183171, -0.4330127, -0.9449112], + ], + face: [ + [0, 3, 1], + [2, 4, 5], + [0, 1, 4, 2], + [0, 2, 5, 3], + [1, 3, 5, 4], + ], + }), + (t[6] = { + vertex: [ + [0, 0, 1.159953], + [1.013464, 0, 0.5642542], + [-0.3501431, 0.9510565, 0.5642542], + [-0.7715208, -0.6571639, 0.5642542], + [0.6633206, 0.9510565, -0.03144481], + [0.8682979, -0.6571639, -0.3996071], + [-1.121664, 0.2938926, -0.03144481], + [-0.2348831, -1.063314, -0.3996071], + [0.5181548, 0.2938926, -0.9953061], + [-0.5850262, -0.112257, -0.9953061], + ], + face: [ + [0, 1, 4, 2], + [0, 2, 6, 3], + [1, 5, 8, 4], + [3, 6, 9, 7], + [5, 7, 9, 8], + [0, 3, 7, 5, 1], + [2, 4, 8, 9, 6], + ], + }), + (t[7] = { + vertex: [ + [0, 0, 1.118034], + [0.8944272, 0, 0.6708204], + [-0.2236068, 0.8660254, 0.6708204], + [-0.7826238, -0.4330127, 0.6708204], + [0.6708204, 0.8660254, 0.2236068], + [1.006231, -0.4330127, -0.2236068], + [-1.006231, 0.4330127, 0.2236068], + [-0.6708204, -0.8660254, -0.2236068], + [0.7826238, 0.4330127, -0.6708204], + [0.2236068, -0.8660254, -0.6708204], + [-0.8944272, 0, -0.6708204], + [0, 0, -1.118034], + ], + face: [ + [0, 1, 4, 2], + [0, 2, 6, 3], + [1, 5, 8, 4], + [3, 6, 10, 7], + [5, 9, 11, 8], + [7, 10, 11, 9], + [0, 3, 7, 9, 5, 1], + [2, 4, 8, 11, 10, 6], + ], + }), + (t[8] = { + vertex: [ + [-0.729665, 0.670121, 0.319155], + [-0.655235, -0.29213, -0.754096], + [-0.093922, -0.607123, 0.537818], + [0.702196, 0.595691, 0.485187], + [0.776626, -0.36656, -0.588064], + ], + face: [ + [1, 4, 2], + [0, 1, 2], + [3, 0, 2], + [4, 3, 2], + [4, 1, 0, 3], + ], + }), + (t[9] = { + vertex: [ + [-0.868849, -0.100041, 0.61257], + [-0.329458, 0.976099, 0.28078], + [-0.26629, -0.013796, -0.477654], + [-0.13392, -1.034115, 0.229829], + [0.738834, 0.707117, -0.307018], + [0.859683, -0.535264, -0.338508], + ], + face: [ + [3, 0, 2], + [5, 3, 2], + [4, 5, 2], + [1, 4, 2], + [0, 1, 2], + [0, 3, 5, 4, 1], + ], + }), + (t[10] = { + vertex: [ + [-0.610389, 0.243975, 0.531213], + [-0.187812, -0.48795, -0.664016], + [-0.187812, 0.9759, -0.664016], + [0.187812, -0.9759, 0.664016], + [0.798201, 0.243975, 0.132803], + ], + face: [ + [1, 3, 0], + [3, 4, 0], + [3, 1, 4], + [0, 2, 1], + [0, 4, 2], + [2, 4, 1], + ], + }), + (t[11] = { + vertex: [ + [-1.028778, 0.392027, -0.048786], + [-0.640503, -0.646161, 0.621837], + [-0.125162, -0.395663, -0.540059], + [0.004683, 0.888447, -0.651988], + [0.125161, 0.395663, 0.540059], + [0.632925, -0.791376, 0.433102], + [1.031672, 0.157063, -0.354165], + ], + face: [ + [3, 2, 0], + [2, 1, 0], + [2, 5, 1], + [0, 4, 3], + [0, 1, 4], + [4, 1, 5], + [2, 3, 6], + [3, 4, 6], + [5, 2, 6], + [4, 5, 6], + ], + }), + (t[12] = { + vertex: [ + [-0.669867, 0.334933, -0.529576], + [-0.669867, 0.334933, 0.529577], + [-0.4043, 1.212901, 0], + [-0.334933, -0.669867, -0.529576], + [-0.334933, -0.669867, 0.529577], + [0.334933, 0.669867, -0.529576], + [0.334933, 0.669867, 0.529577], + [0.4043, -1.212901, 0], + [0.669867, -0.334933, -0.529576], + [0.669867, -0.334933, 0.529577], + ], + face: [ + [8, 9, 7], + [6, 5, 2], + [3, 8, 7], + [5, 0, 2], + [4, 3, 7], + [0, 1, 2], + [9, 4, 7], + [1, 6, 2], + [9, 8, 5, 6], + [8, 3, 0, 5], + [3, 4, 1, 0], + [4, 9, 6, 1], + ], + }), + (t[13] = { + vertex: [ + [-0.931836, 0.219976, -0.264632], + [-0.636706, 0.318353, 0.692816], + [-0.613483, -0.735083, -0.264632], + [-0.326545, 0.979634, 0], + [-0.318353, -0.636706, 0.692816], + [-0.159176, 0.477529, -0.856368], + [0.159176, -0.477529, -0.856368], + [0.318353, 0.636706, 0.692816], + [0.326545, -0.979634, 0], + [0.613482, 0.735082, -0.264632], + [0.636706, -0.318353, 0.692816], + [0.931835, -0.219977, -0.264632], + ], + face: [ + [11, 10, 8], + [7, 9, 3], + [6, 11, 8], + [9, 5, 3], + [2, 6, 8], + [5, 0, 3], + [4, 2, 8], + [0, 1, 3], + [10, 4, 8], + [1, 7, 3], + [10, 11, 9, 7], + [11, 6, 5, 9], + [6, 2, 0, 5], + [2, 4, 1, 0], + [4, 10, 7, 1], + ], + }), + (t[14] = { + vertex: [ + [-0.93465, 0.300459, -0.271185], + [-0.838689, -0.260219, -0.516017], + [-0.711319, 0.717591, 0.128359], + [-0.710334, -0.156922, 0.080946], + [-0.599799, 0.556003, -0.725148], + [-0.503838, -0.004675, -0.969981], + [-0.487004, 0.26021, 0.48049], + [-0.460089, -0.750282, -0.512622], + [-0.376468, 0.973135, -0.325605], + [-0.331735, -0.646985, 0.084342], + [-0.254001, 0.831847, 0.530001], + [-0.125239, -0.494738, -0.966586], + [0.029622, 0.027949, 0.730817], + [0.056536, -0.982543, -0.262295], + [0.08085, 1.087391, 0.076037], + [0.125583, -0.532729, 0.485984], + [0.262625, 0.599586, 0.780328], + [0.391387, -0.726999, -0.716259], + [0.513854, -0.868287, 0.139347], + [0.597475, 0.85513, 0.326364], + [0.641224, 0.109523, 0.783723], + [0.737185, -0.451155, 0.538891], + [0.848705, -0.612742, -0.314616], + [0.976075, 0.365067, 0.32976], + [1.072036, -0.19561, 0.084927], + ], + face: [ + [15, 18, 21], + [12, 20, 16], + [6, 10, 2], + [3, 0, 1], + [9, 7, 13], + [2, 8, 4, 0], + [0, 4, 5, 1], + [1, 5, 11, 7], + [7, 11, 17, 13], + [13, 17, 22, 18], + [18, 22, 24, 21], + [21, 24, 23, 20], + [20, 23, 19, 16], + [16, 19, 14, 10], + [10, 14, 8, 2], + [15, 9, 13, 18], + [12, 15, 21, 20], + [6, 12, 16, 10], + [3, 6, 2, 0], + [9, 3, 1, 7], + [9, 15, 12, 6, 3], + [22, 17, 11, 5, 4, 8, 14, 19, 23, 24], + ], + }); + var i, + n, + r, + o, + s, + c, + u = + e.type && (e.type < 0 || e.type >= t.length) + ? 0 + : e.type || 0, + l = e.size, + h = e.sizeX || l || 1, + f = e.sizeY || l || 1, + d = e.sizeZ || l || 1, + p = e.custom || t[u], + m = p.face.length, + g = e.faceUV || new Array(m), + _ = e.faceColors, + v = void 0 === e.flat || e.flat, + y = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || xi.a.DEFAULTSIDE, + b = new Array(), + E = new Array(), + T = new Array(), + A = new Array(), + x = new Array(), + S = 0, + C = 0, + P = new Array(), + R = 0, + M = 0; + if (v) + for (M = 0; M < m; M++) + _ && void 0 === _[M] && (_[M] = new a.f(1, 1, 1, 1)), + g && void 0 === g[M] && (g[M] = new a.y(0, 0, 1, 1)); + if (v) + for (M = 0; M < m; M++) { + var O = p.face[M].length; + for ( + r = (2 * Math.PI) / O, + o = 0.5 * Math.tan(r / 2), + s = 0.5, + R = 0; + R < O; + R++ + ) + b.push( + p.vertex[p.face[M][R]][0] * h, + p.vertex[p.face[M][R]][1] * f, + p.vertex[p.face[M][R]][2] * d + ), + P.push(S), + S++, + (i = g[M].x + (g[M].z - g[M].x) * (0.5 + o)), + (n = g[M].y + (g[M].w - g[M].y) * (s - 0.5)), + A.push(i, n), + (c = o * Math.cos(r) - s * Math.sin(r)), + (s = o * Math.sin(r) + s * Math.cos(r)), + (o = c), + _ && x.push(_[M].r, _[M].g, _[M].b, _[M].a); + for (R = 0; R < O - 2; R++) + E.push(P[0 + C], P[R + 2 + C], P[R + 1 + C]); + C += O; + } + else { + for (R = 0; R < p.vertex.length; R++) + b.push( + p.vertex[R][0] * h, + p.vertex[R][1] * f, + p.vertex[R][2] * d + ), + A.push(0, 0); + for (M = 0; M < m; M++) + for (R = 0; R < p.face[M].length - 2; R++) + E.push(p.face[M][0], p.face[M][R + 2], p.face[M][R + 1]); } - , - me.a.CreatePolyhedron = function(e, t, i) { - return Ln.CreatePolyhedron(e, t, i) - } - ; - var Ln = function() { - function e() {} - return e.CreatePolyhedron = function(e, t, i) { - void 0 === i && (i = null); - var n = new me.a(e,i); - return t.sideOrientation = me.a._GetDefaultSideOrientation(t.sideOrientation), - n._originalBuilderSideOrientation = t.sideOrientation, + xi.a.ComputeNormals(b, E, T), + xi.a._ComputeSides(y, b, E, T, A, e.frontUVs, e.backUVs); + var w = new xi.a(); + return ( + (w.positions = b), + (w.indices = E), + (w.normals = T), + (w.uvs = A), + _ && v && (w.colors = x), + w + ); + }), + (me.a.CreatePolyhedron = function (e, t, i) { + return Ln.CreatePolyhedron(e, t, i); + }); + var Ln = (function () { + function e() {} + return ( + (e.CreatePolyhedron = function (e, t, i) { + void 0 === i && (i = null); + var n = new me.a(e, i); + return ( + (t.sideOrientation = me.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (n._originalBuilderSideOrientation = t.sideOrientation), xi.a.CreatePolyhedron(t).applyToMesh(n, t.updatable), n - } - , + ); + }), e - }() - , Fn = function(e) { - function t(t) { - void 0 === t && (t = Cn.a.DefaultUtilityLayer); - var i = e.call(this, t) || this; - i.onDragStartObservable = new o.c, - i.onDragEndObservable = new o.c, - i.xGizmo = new Pn(new a.x(1,0,0),a.e.Red().scale(.5),t), - i.yGizmo = new Pn(new a.x(0,1,0),a.e.Green().scale(.5),t), - i.zGizmo = new Pn(new a.x(0,0,1),a.e.Blue().scale(.5),t), - i.uniformScaleGizmo = new Pn(new a.x(0,1,0),a.e.Yellow().scale(.5),t), - i.uniformScaleGizmo.updateGizmoRotationToMatchAttachedMesh = false, - i.uniformScaleGizmo.uniformScaling = true; - var n = Ln.CreatePolyhedron("", { - type: 1 - }, i.uniformScaleGizmo.gizmoLayer.utilityLayerScene); - n.scaling.scaleInPlace(.02), - n.visibility = 0; - var r = Ln.CreatePolyhedron("", { - type: 1 - }, i.uniformScaleGizmo.gizmoLayer.utilityLayerScene); - r.scaling.scaleInPlace(.007), - n.addChild(r), - i.uniformScaleGizmo.setCustomMesh(n, true); - var s = t._getSharedGizmoLight(); - return s.includedOnlyMeshes = s.includedOnlyMeshes.concat(r), - [i.xGizmo, i.yGizmo, i.zGizmo, i.uniformScaleGizmo].forEach(function(e) { - e.dragBehavior.onDragStartObservable.add(function() { - i.onDragStartObservable.notifyObservers({}) - }), - e.dragBehavior.onDragEndObservable.add(function() { - i.onDragEndObservable.notifyObservers({}) - }) + ); + })(), + Fn = (function (e) { + function t(t) { + void 0 === t && (t = Cn.a.DefaultUtilityLayer); + var i = e.call(this, t) || this; + (i.onDragStartObservable = new o.c()), + (i.onDragEndObservable = new o.c()), + (i.xGizmo = new Pn( + new a.x(1, 0, 0), + a.e.Red().scale(0.5), + t + )), + (i.yGizmo = new Pn( + new a.x(0, 1, 0), + a.e.Green().scale(0.5), + t + )), + (i.zGizmo = new Pn( + new a.x(0, 0, 1), + a.e.Blue().scale(0.5), + t + )), + (i.uniformScaleGizmo = new Pn( + new a.x(0, 1, 0), + a.e.Yellow().scale(0.5), + t + )), + (i.uniformScaleGizmo.updateGizmoRotationToMatchAttachedMesh = false), + (i.uniformScaleGizmo.uniformScaling = true); + var n = Ln.CreatePolyhedron( + "", + { + type: 1, + }, + i.uniformScaleGizmo.gizmoLayer.utilityLayerScene + ); + n.scaling.scaleInPlace(0.02), (n.visibility = 0); + var r = Ln.CreatePolyhedron( + "", + { + type: 1, + }, + i.uniformScaleGizmo.gizmoLayer.utilityLayerScene + ); + r.scaling.scaleInPlace(0.007), + n.addChild(r), + i.uniformScaleGizmo.setCustomMesh(n, true); + var s = t._getSharedGizmoLight(); + return ( + (s.includedOnlyMeshes = s.includedOnlyMeshes.concat(r)), + [ + i.xGizmo, + i.yGizmo, + i.zGizmo, + i.uniformScaleGizmo, + ].forEach(function (e) { + e.dragBehavior.onDragStartObservable.add(function () { + i.onDragStartObservable.notifyObservers({}); }), - i.attachedMesh = null, - i - } - return h.d(t, e), + e.dragBehavior.onDragEndObservable.add(function () { + i.onDragEndObservable.notifyObservers({}); + }); + }), + (i.attachedMesh = null), + i + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "attachedMesh", { - get: function() { - return this.xGizmo.attachedMesh + get: function () { + return this.xGizmo.attachedMesh; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.attachedMesh = e), + (this.yGizmo.attachedMesh = e), + (this.zGizmo.attachedMesh = e), + (this.uniformScaleGizmo.attachedMesh = e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "updateGizmoRotationToMatchAttachedMesh", + { + get: function () { + return this.xGizmo + .updateGizmoRotationToMatchAttachedMesh; }, - set: function(e) { - this.xGizmo && (this.xGizmo.attachedMesh = e, - this.yGizmo.attachedMesh = e, - this.zGizmo.attachedMesh = e, - this.uniformScaleGizmo.attachedMesh = e) + set: function (e) { + e || + g.a.Warn( + "Setting updateGizmoRotationToMatchAttachedMesh = false on scaling gizmo is not supported." + ), + this.xGizmo && + ((this.xGizmo.updateGizmoRotationToMatchAttachedMesh = + e), + (this.yGizmo.updateGizmoRotationToMatchAttachedMesh = + e), + (this.zGizmo.updateGizmoRotationToMatchAttachedMesh = + e)); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "updateGizmoRotationToMatchAttachedMesh", { - get: function() { - return this.xGizmo.updateGizmoRotationToMatchAttachedMesh - }, - set: function(e) { - e || g.a.Warn("Setting updateGizmoRotationToMatchAttachedMesh = false on scaling gizmo is not supported."), - this.xGizmo && (this.xGizmo.updateGizmoRotationToMatchAttachedMesh = e, - this.yGizmo.updateGizmoRotationToMatchAttachedMesh = e, - this.zGizmo.updateGizmoRotationToMatchAttachedMesh = e) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "snapDistance", { - get: function() { - return this.xGizmo.snapDistance - }, - set: function(e) { - this.xGizmo && (this.xGizmo.snapDistance = e, - this.yGizmo.snapDistance = e, - this.zGizmo.snapDistance = e, - this.uniformScaleGizmo.snapDistance = e) - }, - enumerable: true, - configurable: true + get: function () { + return this.xGizmo.snapDistance; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.snapDistance = e), + (this.yGizmo.snapDistance = e), + (this.zGizmo.snapDistance = e), + (this.uniformScaleGizmo.snapDistance = e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "scaleRatio", { - get: function() { - return this.xGizmo.scaleRatio - }, - set: function(e) { - this.xGizmo && (this.xGizmo.scaleRatio = e, - this.yGizmo.scaleRatio = e, - this.zGizmo.scaleRatio = e, - this.uniformScaleGizmo.scaleRatio = e) - }, - enumerable: true, - configurable: true + get: function () { + return this.xGizmo.scaleRatio; + }, + set: function (e) { + this.xGizmo && + ((this.xGizmo.scaleRatio = e), + (this.yGizmo.scaleRatio = e), + (this.zGizmo.scaleRatio = e), + (this.uniformScaleGizmo.scaleRatio = e)); + }, + enumerable: true, + configurable: true, }), - t.prototype.dispose = function() { - this.xGizmo.dispose(), + (t.prototype.dispose = function () { + this.xGizmo.dispose(), this.yGizmo.dispose(), this.zGizmo.dispose(), this.uniformScaleGizmo.dispose(), this.onDragStartObservable.clear(), - this.onDragEndObservable.clear() - } - , + this.onDragEndObservable.clear(); + }), t - }(Sn.a) - , Bn = function() { - function e(e) { - var t = this; - this.scene = e, - this.clearGizmoOnEmptyPointerEvent = false, - this.onAttachedToMeshObservable = new o.c, - this._gizmosEnabled = { - positionGizmo: false, - rotationGizmo: false, - scaleGizmo: false, - boundingBoxGizmo: false - }, - this._pointerObserver = null, - this._attachedMesh = null, - this._boundingBoxColor = a.e.FromHexString("#0984e3"), - this.boundingBoxDragBehavior = new Ve, - this.attachableMeshes = null, - this.usePointerToAttachGizmos = true, - this._defaultKeepDepthUtilityLayer = new Cn.a(e), - this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false, - this._defaultUtilityLayer = Cn.a.DefaultUtilityLayer, - this.gizmos = { - positionGizmo: null, - rotationGizmo: null, - scaleGizmo: null, - boundingBoxGizmo: null - }, - this._pointerObserver = e.onPointerObservable.add(function(e) { - if (t.usePointerToAttachGizmos && e.type == Re.a.POINTERDOWN) - if (e.pickInfo && e.pickInfo.pickedMesh) { - var i = e.pickInfo.pickedMesh; - if (null == t.attachableMeshes) - for (; i && null != i.parent; ) - i = i.parent; - else { - var n = false; - t.attachableMeshes.forEach(function(e) { - i && (i == e || i.isDescendantOf(e)) && (i = e, - n = true) - }), - n || (i = null) - } - i instanceof Ne.a ? t._attachedMesh != i && t.attachToMesh(i) : t.clearGizmoOnEmptyPointerEvent && t.attachToMesh(null) - } else - t.clearGizmoOnEmptyPointerEvent && t.attachToMesh(null) - }) - } - return e.prototype.attachToMesh = function(e) { - for (var t in this._attachedMesh && this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior), - this._attachedMesh = e, - this.gizmos) { - var i = this.gizmos[t]; - i && this._gizmosEnabled[t] && (i.attachedMesh = e) + ); + })(Sn.a), + Bn = (function () { + function e(e) { + var t = this; + (this.scene = e), + (this.clearGizmoOnEmptyPointerEvent = false), + (this.onAttachedToMeshObservable = new o.c()), + (this._gizmosEnabled = { + positionGizmo: false, + rotationGizmo: false, + scaleGizmo: false, + boundingBoxGizmo: false, + }), + (this._pointerObserver = null), + (this._attachedMesh = null), + (this._boundingBoxColor = a.e.FromHexString("#0984e3")), + (this.boundingBoxDragBehavior = new Ve()), + (this.attachableMeshes = null), + (this.usePointerToAttachGizmos = true), + (this._defaultKeepDepthUtilityLayer = new Cn.a(e)), + (this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false), + (this._defaultUtilityLayer = Cn.a.DefaultUtilityLayer), + (this.gizmos = { + positionGizmo: null, + rotationGizmo: null, + scaleGizmo: null, + boundingBoxGizmo: null, + }), + (this._pointerObserver = e.onPointerObservable.add( + function (e) { + if ( + t.usePointerToAttachGizmos && + e.type == Re.a.POINTERDOWN + ) + if (e.pickInfo && e.pickInfo.pickedMesh) { + var i = e.pickInfo.pickedMesh; + if (null == t.attachableMeshes) + for (; i && null != i.parent; ) i = i.parent; + else { + var n = false; + t.attachableMeshes.forEach(function (e) { + i && + (i == e || i.isDescendantOf(e)) && + ((i = e), (n = true)); + }), + n || (i = null); + } + i instanceof Ne.a + ? t._attachedMesh != i && t.attachToMesh(i) + : t.clearGizmoOnEmptyPointerEvent && + t.attachToMesh(null); + } else + t.clearGizmoOnEmptyPointerEvent && + t.attachToMesh(null); } - this.boundingBoxGizmoEnabled && this._attachedMesh && this._attachedMesh.addBehavior(this.boundingBoxDragBehavior), - this.onAttachedToMeshObservable.notifyObservers(e) - } - , + )); + } + return ( + (e.prototype.attachToMesh = function (e) { + for (var t in (this._attachedMesh && + this._attachedMesh.removeBehavior( + this.boundingBoxDragBehavior + ), + (this._attachedMesh = e), + this.gizmos)) { + var i = this.gizmos[t]; + i && this._gizmosEnabled[t] && (i.attachedMesh = e); + } + this.boundingBoxGizmoEnabled && + this._attachedMesh && + this._attachedMesh.addBehavior( + this.boundingBoxDragBehavior + ), + this.onAttachedToMeshObservable.notifyObservers(e); + }), Object.defineProperty(e.prototype, "positionGizmoEnabled", { - get: function() { - return this._gizmosEnabled.positionGizmo - }, - set: function(e) { - e ? (this.gizmos.positionGizmo || (this.gizmos.positionGizmo = new Dn(this._defaultUtilityLayer)), - this.gizmos.positionGizmo.attachedMesh = this._attachedMesh) : this.gizmos.positionGizmo && (this.gizmos.positionGizmo.attachedMesh = null), - this._gizmosEnabled.positionGizmo = e - }, - enumerable: true, - configurable: true + get: function () { + return this._gizmosEnabled.positionGizmo; + }, + set: function (e) { + e + ? (this.gizmos.positionGizmo || + (this.gizmos.positionGizmo = new Dn( + this._defaultUtilityLayer + )), + (this.gizmos.positionGizmo.attachedMesh = + this._attachedMesh)) + : this.gizmos.positionGizmo && + (this.gizmos.positionGizmo.attachedMesh = null), + (this._gizmosEnabled.positionGizmo = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "rotationGizmoEnabled", { - get: function() { - return this._gizmosEnabled.rotationGizmo - }, - set: function(e) { - e ? (this.gizmos.rotationGizmo || (this.gizmos.rotationGizmo = new In(this._defaultUtilityLayer)), - this.gizmos.rotationGizmo.attachedMesh = this._attachedMesh) : this.gizmos.rotationGizmo && (this.gizmos.rotationGizmo.attachedMesh = null), - this._gizmosEnabled.rotationGizmo = e - }, - enumerable: true, - configurable: true + get: function () { + return this._gizmosEnabled.rotationGizmo; + }, + set: function (e) { + e + ? (this.gizmos.rotationGizmo || + (this.gizmos.rotationGizmo = new In( + this._defaultUtilityLayer + )), + (this.gizmos.rotationGizmo.attachedMesh = + this._attachedMesh)) + : this.gizmos.rotationGizmo && + (this.gizmos.rotationGizmo.attachedMesh = null), + (this._gizmosEnabled.rotationGizmo = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "scaleGizmoEnabled", { - get: function() { - return this._gizmosEnabled.scaleGizmo + get: function () { + return this._gizmosEnabled.scaleGizmo; + }, + set: function (e) { + e + ? ((this.gizmos.scaleGizmo = + this.gizmos.scaleGizmo || + new Fn(this._defaultUtilityLayer)), + (this.gizmos.scaleGizmo.attachedMesh = + this._attachedMesh)) + : this.gizmos.scaleGizmo && + (this.gizmos.scaleGizmo.attachedMesh = null), + (this._gizmosEnabled.scaleGizmo = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "boundingBoxGizmoEnabled", + { + get: function () { + return this._gizmosEnabled.boundingBoxGizmo; }, - set: function(e) { - e ? (this.gizmos.scaleGizmo = this.gizmos.scaleGizmo || new Fn(this._defaultUtilityLayer), - this.gizmos.scaleGizmo.attachedMesh = this._attachedMesh) : this.gizmos.scaleGizmo && (this.gizmos.scaleGizmo.attachedMesh = null), - this._gizmosEnabled.scaleGizmo = e + set: function (e) { + e + ? ((this.gizmos.boundingBoxGizmo = + this.gizmos.boundingBoxGizmo || + new On( + this._boundingBoxColor, + this._defaultKeepDepthUtilityLayer + )), + (this.gizmos.boundingBoxGizmo.attachedMesh = + this._attachedMesh), + this._attachedMesh && + (this._attachedMesh.removeBehavior( + this.boundingBoxDragBehavior + ), + this._attachedMesh.addBehavior( + this.boundingBoxDragBehavior + ))) + : this.gizmos.boundingBoxGizmo && + (this._attachedMesh && + this._attachedMesh.removeBehavior( + this.boundingBoxDragBehavior + ), + (this.gizmos.boundingBoxGizmo.attachedMesh = + null)), + (this._gizmosEnabled.boundingBoxGizmo = e); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "boundingBoxGizmoEnabled", { - get: function() { - return this._gizmosEnabled.boundingBoxGizmo - }, - set: function(e) { - e ? (this.gizmos.boundingBoxGizmo = this.gizmos.boundingBoxGizmo || new On(this._boundingBoxColor,this._defaultKeepDepthUtilityLayer), - this.gizmos.boundingBoxGizmo.attachedMesh = this._attachedMesh, - this._attachedMesh && (this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior), - this._attachedMesh.addBehavior(this.boundingBoxDragBehavior))) : this.gizmos.boundingBoxGizmo && (this._attachedMesh && this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior), - this.gizmos.boundingBoxGizmo.attachedMesh = null), - this._gizmosEnabled.boundingBoxGizmo = e - }, - enumerable: true, - configurable: true - }), - e.prototype.dispose = function() { - for (var e in this.scene.onPointerObservable.remove(this._pointerObserver), - this.gizmos) { - var t = this.gizmos[e]; - t && t.dispose() - } - this._defaultKeepDepthUtilityLayer.dispose(), + configurable: true, + } + ), + (e.prototype.dispose = function () { + for (var e in (this.scene.onPointerObservable.remove( + this._pointerObserver + ), + this.gizmos)) { + var t = this.gizmos[e]; + t && t.dispose(); + } + this._defaultKeepDepthUtilityLayer.dispose(), this.boundingBoxDragBehavior.detach(), - this.onAttachedToMeshObservable.clear() - } - , - e - }() - , Nn = n(38) - , kn = function(e) { - function t() { - var t = null !== e && e.apply(this, arguments) || this; - return t._needProjectionMatrixCompute = true, - t - } - return h.d(t, e), - t.prototype._setPosition = function(e) { - this._position = e - } - , - Object.defineProperty(t.prototype, "position", { - get: function() { - return this._position - }, - set: function(e) { - this._setPosition(e) - }, - enumerable: true, - configurable: true + this.onAttachedToMeshObservable.clear(); + }), + e + ); + })(), + Nn = n(38), + kn = (function (e) { + function t() { + var t = (null !== e && e.apply(this, arguments)) || this; + return (t._needProjectionMatrixCompute = true), t; + } + return ( + h.d(t, e), + (t.prototype._setPosition = function (e) { + this._position = e; + }), + Object.defineProperty(t.prototype, "position", { + get: function () { + return this._position; + }, + set: function (e) { + this._setPosition(e); + }, + enumerable: true, + configurable: true, + }), + (t.prototype._setDirection = function (e) { + this._direction = e; }), - t.prototype._setDirection = function(e) { - this._direction = e - } - , Object.defineProperty(t.prototype, "direction", { - get: function() { - return this._direction - }, - set: function(e) { - this._setDirection(e) - }, - enumerable: true, - configurable: true + get: function () { + return this._direction; + }, + set: function (e) { + this._setDirection(e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "shadowMinZ", { - get: function() { - return this._shadowMinZ - }, - set: function(e) { - this._shadowMinZ = e, - this.forceProjectionMatrixCompute() - }, - enumerable: true, - configurable: true + get: function () { + return this._shadowMinZ; + }, + set: function (e) { + (this._shadowMinZ = e), + this.forceProjectionMatrixCompute(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "shadowMaxZ", { - get: function() { - return this._shadowMaxZ - }, - set: function(e) { - this._shadowMaxZ = e, - this.forceProjectionMatrixCompute() - }, - enumerable: true, - configurable: true + get: function () { + return this._shadowMaxZ; + }, + set: function (e) { + (this._shadowMaxZ = e), + this.forceProjectionMatrixCompute(); + }, + enumerable: true, + configurable: true, }), - t.prototype.computeTransformedInformation = function() { - return !(!this.parent || !this.parent.getWorldMatrix || (this.transformedPosition || (this.transformedPosition = a.x.Zero()), - a.x.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition), - this.direction && (this.transformedDirection || (this.transformedDirection = a.x.Zero()), - a.x.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection)), - 0)) - } - , - t.prototype.getDepthScale = function() { - return 50 - } - , - t.prototype.getShadowDirection = function(e) { - return this.transformedDirection ? this.transformedDirection : this.direction - } - , - t.prototype.getAbsolutePosition = function() { - return this.transformedPosition ? this.transformedPosition : this.position - } - , - t.prototype.setDirectionToTarget = function(e) { - return this.direction = a.x.Normalize(e.subtract(this.position)), + (t.prototype.computeTransformedInformation = function () { + return !( + !this.parent || + !this.parent.getWorldMatrix || + (this.transformedPosition || + (this.transformedPosition = a.x.Zero()), + a.x.TransformCoordinatesToRef( + this.position, + this.parent.getWorldMatrix(), + this.transformedPosition + ), + this.direction && + (this.transformedDirection || + (this.transformedDirection = a.x.Zero()), + a.x.TransformNormalToRef( + this.direction, + this.parent.getWorldMatrix(), + this.transformedDirection + )), + 0) + ); + }), + (t.prototype.getDepthScale = function () { + return 50; + }), + (t.prototype.getShadowDirection = function (e) { + return this.transformedDirection + ? this.transformedDirection + : this.direction; + }), + (t.prototype.getAbsolutePosition = function () { + return this.transformedPosition + ? this.transformedPosition + : this.position; + }), + (t.prototype.setDirectionToTarget = function (e) { + return ( + (this.direction = a.x.Normalize( + e.subtract(this.position) + )), this.direction - } - , - t.prototype.getRotation = function() { - this.direction.normalize(); - var e = a.x.Cross(this.direction, a.c.Y) - , t = a.x.Cross(e, this.direction); - return a.x.RotationFromAxis(e, t, this.direction) - } - , - t.prototype.needCube = function() { - return false - } - , - t.prototype.needProjectionMatrixCompute = function() { - return this._needProjectionMatrixCompute - } - , - t.prototype.forceProjectionMatrixCompute = function() { - this._needProjectionMatrixCompute = true - } - , - t.prototype._initCache = function() { - e.prototype._initCache.call(this), - this._cache.position = a.x.Zero() - } - , - t.prototype._isSynchronized = function() { - return !!this._cache.position.equals(this.position) - } - , - t.prototype.computeWorldMatrix = function(e) { - return !e && this.isSynchronized() ? (this._currentRenderId = this.getScene().getRenderId(), - this._worldMatrix) : (this._updateCache(), - this._cache.position.copyFrom(this.position), - this._worldMatrix || (this._worldMatrix = a.j.Identity()), - a.j.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix), - this.parent && this.parent.getWorldMatrix && (this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix), - this._markSyncedWithParent()), - this._worldMatrixDeterminantIsDirty = true, - this._worldMatrix) - } - , - t.prototype.getDepthMinZ = function(e) { - return void 0 !== this.shadowMinZ ? this.shadowMinZ : e.minZ - } - , - t.prototype.getDepthMaxZ = function(e) { - return void 0 !== this.shadowMaxZ ? this.shadowMaxZ : e.maxZ - } - , - t.prototype.setShadowProjectionMatrix = function(e, t, i) { - return this.customProjectionMatrixBuilder ? this.customProjectionMatrixBuilder(t, i, e) : this._setDefaultShadowProjectionMatrix(e, t, i), + ); + }), + (t.prototype.getRotation = function () { + this.direction.normalize(); + var e = a.x.Cross(this.direction, a.c.Y), + t = a.x.Cross(e, this.direction); + return a.x.RotationFromAxis(e, t, this.direction); + }), + (t.prototype.needCube = function () { + return false; + }), + (t.prototype.needProjectionMatrixCompute = function () { + return this._needProjectionMatrixCompute; + }), + (t.prototype.forceProjectionMatrixCompute = function () { + this._needProjectionMatrixCompute = true; + }), + (t.prototype._initCache = function () { + e.prototype._initCache.call(this), + (this._cache.position = a.x.Zero()); + }), + (t.prototype._isSynchronized = function () { + return !!this._cache.position.equals(this.position); + }), + (t.prototype.computeWorldMatrix = function (e) { + return !e && this.isSynchronized() + ? ((this._currentRenderId = + this.getScene().getRenderId()), + this._worldMatrix) + : (this._updateCache(), + this._cache.position.copyFrom(this.position), + this._worldMatrix || + (this._worldMatrix = a.j.Identity()), + a.j.TranslationToRef( + this.position.x, + this.position.y, + this.position.z, + this._worldMatrix + ), + this.parent && + this.parent.getWorldMatrix && + (this._worldMatrix.multiplyToRef( + this.parent.getWorldMatrix(), + this._worldMatrix + ), + this._markSyncedWithParent()), + (this._worldMatrixDeterminantIsDirty = true), + this._worldMatrix); + }), + (t.prototype.getDepthMinZ = function (e) { + return void 0 !== this.shadowMinZ + ? this.shadowMinZ + : e.minZ; + }), + (t.prototype.getDepthMaxZ = function (e) { + return void 0 !== this.shadowMaxZ + ? this.shadowMaxZ + : e.maxZ; + }), + (t.prototype.setShadowProjectionMatrix = function ( + e, + t, + i + ) { + return ( + this.customProjectionMatrixBuilder + ? this.customProjectionMatrixBuilder(t, i, e) + : this._setDefaultShadowProjectionMatrix(e, t, i), this - } - , + ); + }), h.c([Object(F.o)()], t.prototype, "position", null), h.c([Object(F.o)()], t.prototype, "direction", null), h.c([Object(F.c)()], t.prototype, "shadowMinZ", null), h.c([Object(F.c)()], t.prototype, "shadowMaxZ", null), t - }(Nn.a); - N.a.AddNodeConstructor("Light_Type_1", function(e, t) { - return function() { - return new Un(e,a.x.Zero(),t) - } - }); - var Un = function(e) { - function t(t, i, n) { - var r = e.call(this, t, n) || this; - return r._shadowFrustumSize = 0, - r._shadowOrthoScale = .1, - r.autoUpdateExtends = true, - r._orthoLeft = Number.MAX_VALUE, - r._orthoRight = Number.MIN_VALUE, - r._orthoTop = Number.MIN_VALUE, - r._orthoBottom = Number.MAX_VALUE, - r.position = i.scale(-1), - r.direction = i, - r - } - return h.d(t, e), - Object.defineProperty(t.prototype, "shadowFrustumSize", { - get: function() { - return this._shadowFrustumSize - }, - set: function(e) { - this._shadowFrustumSize = e, - this.forceProjectionMatrixCompute() - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "shadowOrthoScale", { - get: function() { - return this._shadowOrthoScale - }, - set: function(e) { - this._shadowOrthoScale = e, - this.forceProjectionMatrixCompute() - }, - enumerable: true, - configurable: true - }), - t.prototype.getClassName = function() { - return "DirectionalLight" - } - , - t.prototype.getTypeID = function() { - return Nn.a.LIGHTTYPEID_DIRECTIONALLIGHT - } - , - t.prototype._setDefaultShadowProjectionMatrix = function(e, t, i) { - this.shadowFrustumSize > 0 ? this._setDefaultFixedFrustumShadowProjectionMatrix(e) : this._setDefaultAutoExtendShadowProjectionMatrix(e, t, i) - } - , - t.prototype._setDefaultFixedFrustumShadowProjectionMatrix = function(e) { - var t = this.getScene().activeCamera; - t && a.j.OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, void 0 !== this.shadowMinZ ? this.shadowMinZ : t.minZ, void 0 !== this.shadowMaxZ ? this.shadowMaxZ : t.maxZ, e) - } - , - t.prototype._setDefaultAutoExtendShadowProjectionMatrix = function(e, t, i) { - var n = this.getScene().activeCamera; - if (n) { - if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) { - var r = a.x.Zero(); - this._orthoLeft = Number.MAX_VALUE, - this._orthoRight = Number.MIN_VALUE, - this._orthoTop = Number.MIN_VALUE, - this._orthoBottom = Number.MAX_VALUE; - for (var o = 0; o < i.length; o++) { - var s = i[o]; - if (s) - for (var c = s.getBoundingInfo().boundingBox, u = 0; u < c.vectorsWorld.length; u++) - a.x.TransformCoordinatesToRef(c.vectorsWorld[u], t, r), - r.x < this._orthoLeft && (this._orthoLeft = r.x), - r.y < this._orthoBottom && (this._orthoBottom = r.y), - r.x > this._orthoRight && (this._orthoRight = r.x), - r.y > this._orthoTop && (this._orthoTop = r.y) - } - } - var l = this._orthoRight - this._orthoLeft - , h = this._orthoTop - this._orthoBottom; - a.j.OrthoOffCenterLHToRef(this._orthoLeft - l * this.shadowOrthoScale, this._orthoRight + l * this.shadowOrthoScale, this._orthoBottom - h * this.shadowOrthoScale, this._orthoTop + h * this.shadowOrthoScale, void 0 !== this.shadowMinZ ? this.shadowMinZ : n.minZ, void 0 !== this.shadowMaxZ ? this.shadowMaxZ : n.maxZ, e) - } - } - , - t.prototype._buildUniformLayout = function() { - this._uniformBuffer.addUniform("vLightData", 4), - this._uniformBuffer.addUniform("vLightDiffuse", 4), - this._uniformBuffer.addUniform("vLightSpecular", 3), - this._uniformBuffer.addUniform("shadowsInfo", 3), - this._uniformBuffer.addUniform("depthValues", 2), - this._uniformBuffer.create() - } - , - t.prototype.transferToEffect = function(e, t) { - return this.computeTransformedInformation() ? (this._uniformBuffer.updateFloat4("vLightData", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, t), - this) : (this._uniformBuffer.updateFloat4("vLightData", this.direction.x, this.direction.y, this.direction.z, 1, t), - this) - } - , - t.prototype.getDepthMinZ = function(e) { - return 1 - } - , - t.prototype.getDepthMaxZ = function(e) { - return 1 - } - , - t.prototype.prepareLightSpecificDefines = function(e, t) { - e["DIRLIGHT" + t] = true - } - , - h.c([Object(F.c)()], t.prototype, "shadowFrustumSize", null), - h.c([Object(F.c)()], t.prototype, "shadowOrthoScale", null), - h.c([Object(F.c)()], t.prototype, "autoUpdateExtends", void 0), - t - }(kn); - me.a.CreateHemisphere = function(e, t, i, n) { - var r = { - segments: t, - diameter: i - }; - return Vn.CreateHemisphere(e, r, n) + ); + })(Nn.a); + N.a.AddNodeConstructor("Light_Type_1", function (e, t) { + return function () { + return new Un(e, a.x.Zero(), t); + }; + }); + var Un = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, n) || this; + return ( + (r._shadowFrustumSize = 0), + (r._shadowOrthoScale = 0.1), + (r.autoUpdateExtends = true), + (r._orthoLeft = Number.MAX_VALUE), + (r._orthoRight = Number.MIN_VALUE), + (r._orthoTop = Number.MIN_VALUE), + (r._orthoBottom = Number.MAX_VALUE), + (r.position = i.scale(-1)), + (r.direction = i), + r + ); } - ; - var Vn = function() { - function e() {} - return e.CreateHemisphere = function(e, t, i) { - t.diameter || (t.diameter = 1), - t.segments || (t.segments = 16); - var n = Rn.a.CreateSphere("", { - slice: .5, - diameter: t.diameter, - segments: t.segments - }, i) - , r = me.a.CreateDisc("", t.diameter / 2, 3 * t.segments + (4 - t.segments), i); - r.rotation.x = -Math.PI / 2, - r.parent = n; - var o = me.a.MergeMeshes([r, n], true); - return o.name = e, - o - } - , - e - }(); - N.a.AddNodeConstructor("Light_Type_2", function(e, t) { - return function() { - return new Gn(e,a.x.Zero(),a.x.Zero(),0,0,t) - } - }); - var Gn = function(e) { - function t(t, i, n, r, o, s) { - var c = e.call(this, t, s) || this; - return c._innerAngle = 0, - c._projectionTextureMatrix = a.j.Zero(), - c._projectionTextureLightNear = 1e-6, - c._projectionTextureLightFar = 1e3, - c._projectionTextureUpDirection = a.x.Up(), - c._projectionTextureViewLightDirty = true, - c._projectionTextureProjectionLightDirty = true, - c._projectionTextureDirty = true, - c._projectionTextureViewTargetVector = a.x.Zero(), - c._projectionTextureViewLightMatrix = a.j.Zero(), - c._projectionTextureProjectionLightMatrix = a.j.Zero(), - c._projectionTextureScalingMatrix = a.j.FromValues(.5, 0, 0, 0, 0, .5, 0, 0, 0, 0, .5, 0, .5, .5, .5, 1), - c.position = i, - c.direction = n, - c.angle = r, - c.exponent = o, - c - } - return h.d(t, e), + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "shadowFrustumSize", { + get: function () { + return this._shadowFrustumSize; + }, + set: function (e) { + (this._shadowFrustumSize = e), + this.forceProjectionMatrixCompute(); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "shadowOrthoScale", { + get: function () { + return this._shadowOrthoScale; + }, + set: function (e) { + (this._shadowOrthoScale = e), + this.forceProjectionMatrixCompute(); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "DirectionalLight"; + }), + (t.prototype.getTypeID = function () { + return Nn.a.LIGHTTYPEID_DIRECTIONALLIGHT; + }), + (t.prototype._setDefaultShadowProjectionMatrix = function ( + e, + t, + i + ) { + this.shadowFrustumSize > 0 + ? this._setDefaultFixedFrustumShadowProjectionMatrix(e) + : this._setDefaultAutoExtendShadowProjectionMatrix( + e, + t, + i + ); + }), + (t.prototype._setDefaultFixedFrustumShadowProjectionMatrix = + function (e) { + var t = this.getScene().activeCamera; + t && + a.j.OrthoLHToRef( + this.shadowFrustumSize, + this.shadowFrustumSize, + void 0 !== this.shadowMinZ ? this.shadowMinZ : t.minZ, + void 0 !== this.shadowMaxZ ? this.shadowMaxZ : t.maxZ, + e + ); + }), + (t.prototype._setDefaultAutoExtendShadowProjectionMatrix = + function (e, t, i) { + var n = this.getScene().activeCamera; + if (n) { + if ( + this.autoUpdateExtends || + this._orthoLeft === Number.MAX_VALUE + ) { + var r = a.x.Zero(); + (this._orthoLeft = Number.MAX_VALUE), + (this._orthoRight = Number.MIN_VALUE), + (this._orthoTop = Number.MIN_VALUE), + (this._orthoBottom = Number.MAX_VALUE); + for (var o = 0; o < i.length; o++) { + var s = i[o]; + if (s) + for ( + var c = s.getBoundingInfo().boundingBox, u = 0; + u < c.vectorsWorld.length; + u++ + ) + a.x.TransformCoordinatesToRef( + c.vectorsWorld[u], + t, + r + ), + r.x < this._orthoLeft && + (this._orthoLeft = r.x), + r.y < this._orthoBottom && + (this._orthoBottom = r.y), + r.x > this._orthoRight && + (this._orthoRight = r.x), + r.y > this._orthoTop && + (this._orthoTop = r.y); + } + } + var l = this._orthoRight - this._orthoLeft, + h = this._orthoTop - this._orthoBottom; + a.j.OrthoOffCenterLHToRef( + this._orthoLeft - l * this.shadowOrthoScale, + this._orthoRight + l * this.shadowOrthoScale, + this._orthoBottom - h * this.shadowOrthoScale, + this._orthoTop + h * this.shadowOrthoScale, + void 0 !== this.shadowMinZ ? this.shadowMinZ : n.minZ, + void 0 !== this.shadowMaxZ ? this.shadowMaxZ : n.maxZ, + e + ); + } + }), + (t.prototype._buildUniformLayout = function () { + this._uniformBuffer.addUniform("vLightData", 4), + this._uniformBuffer.addUniform("vLightDiffuse", 4), + this._uniformBuffer.addUniform("vLightSpecular", 3), + this._uniformBuffer.addUniform("shadowsInfo", 3), + this._uniformBuffer.addUniform("depthValues", 2), + this._uniformBuffer.create(); + }), + (t.prototype.transferToEffect = function (e, t) { + return this.computeTransformedInformation() + ? (this._uniformBuffer.updateFloat4( + "vLightData", + this.transformedDirection.x, + this.transformedDirection.y, + this.transformedDirection.z, + 1, + t + ), + this) + : (this._uniformBuffer.updateFloat4( + "vLightData", + this.direction.x, + this.direction.y, + this.direction.z, + 1, + t + ), + this); + }), + (t.prototype.getDepthMinZ = function (e) { + return 1; + }), + (t.prototype.getDepthMaxZ = function (e) { + return 1; + }), + (t.prototype.prepareLightSpecificDefines = function (e, t) { + e["DIRLIGHT" + t] = true; + }), + h.c([Object(F.c)()], t.prototype, "shadowFrustumSize", null), + h.c([Object(F.c)()], t.prototype, "shadowOrthoScale", null), + h.c( + [Object(F.c)()], + t.prototype, + "autoUpdateExtends", + void 0 + ), + t + ); + })(kn); + me.a.CreateHemisphere = function (e, t, i, n) { + var r = { + segments: t, + diameter: i, + }; + return Vn.CreateHemisphere(e, r, n); + }; + var Vn = (function () { + function e() {} + return ( + (e.CreateHemisphere = function (e, t, i) { + t.diameter || (t.diameter = 1), + t.segments || (t.segments = 16); + var n = Rn.a.CreateSphere( + "", + { + slice: 0.5, + diameter: t.diameter, + segments: t.segments, + }, + i + ), + r = me.a.CreateDisc( + "", + t.diameter / 2, + 3 * t.segments + (4 - t.segments), + i + ); + (r.rotation.x = -Math.PI / 2), (r.parent = n); + var o = me.a.MergeMeshes([r, n], true); + return (o.name = e), o; + }), + e + ); + })(); + N.a.AddNodeConstructor("Light_Type_2", function (e, t) { + return function () { + return new Gn(e, a.x.Zero(), a.x.Zero(), 0, 0, t); + }; + }); + var Gn = (function (e) { + function t(t, i, n, r, o, s) { + var c = e.call(this, t, s) || this; + return ( + (c._innerAngle = 0), + (c._projectionTextureMatrix = a.j.Zero()), + (c._projectionTextureLightNear = 1e-6), + (c._projectionTextureLightFar = 1e3), + (c._projectionTextureUpDirection = a.x.Up()), + (c._projectionTextureViewLightDirty = true), + (c._projectionTextureProjectionLightDirty = true), + (c._projectionTextureDirty = true), + (c._projectionTextureViewTargetVector = a.x.Zero()), + (c._projectionTextureViewLightMatrix = a.j.Zero()), + (c._projectionTextureProjectionLightMatrix = a.j.Zero()), + (c._projectionTextureScalingMatrix = a.j.FromValues( + 0.5, + 0, + 0, + 0, + 0, + 0.5, + 0, + 0, + 0, + 0, + 0.5, + 0, + 0.5, + 0.5, + 0.5, + 1 + )), + (c.position = i), + (c.direction = n), + (c.angle = r), + (c.exponent = o), + c + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "angle", { - get: function() { - return this._angle - }, - set: function(e) { - this._angle = e, - this._cosHalfAngle = Math.cos(.5 * e), - this._projectionTextureProjectionLightDirty = true, - this.forceProjectionMatrixCompute(), - this._computeAngleValues() - }, - enumerable: true, - configurable: true + get: function () { + return this._angle; + }, + set: function (e) { + (this._angle = e), + (this._cosHalfAngle = Math.cos(0.5 * e)), + (this._projectionTextureProjectionLightDirty = true), + this.forceProjectionMatrixCompute(), + this._computeAngleValues(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "innerAngle", { - get: function() { - return this._innerAngle - }, - set: function(e) { - this._innerAngle = e, - this._computeAngleValues() - }, - enumerable: true, - configurable: true + get: function () { + return this._innerAngle; + }, + set: function (e) { + (this._innerAngle = e), this._computeAngleValues(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "shadowAngleScale", { - get: function() { - return this._shadowAngleScale - }, - set: function(e) { - this._shadowAngleScale = e, - this.forceProjectionMatrixCompute() + get: function () { + return this._shadowAngleScale; + }, + set: function (e) { + (this._shadowAngleScale = e), + this.forceProjectionMatrixCompute(); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "projectionTextureMatrix", + { + get: function () { + return this._projectionTextureMatrix; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "projectionTextureMatrix", { - get: function() { - return this._projectionTextureMatrix + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "projectionTextureLightNear", + { + get: function () { + return this._projectionTextureLightNear; + }, + set: function (e) { + (this._projectionTextureLightNear = e), + (this._projectionTextureProjectionLightDirty = true); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "projectionTextureLightNear", { - get: function() { - return this._projectionTextureLightNear + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "projectionTextureLightFar", + { + get: function () { + return this._projectionTextureLightFar; }, - set: function(e) { - this._projectionTextureLightNear = e, - this._projectionTextureProjectionLightDirty = true + set: function (e) { + (this._projectionTextureLightFar = e), + (this._projectionTextureProjectionLightDirty = true); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "projectionTextureLightFar", { - get: function() { - return this._projectionTextureLightFar + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "projectionTextureUpDirection", + { + get: function () { + return this._projectionTextureUpDirection; }, - set: function(e) { - this._projectionTextureLightFar = e, - this._projectionTextureProjectionLightDirty = true + set: function (e) { + (this._projectionTextureUpDirection = e), + (this._projectionTextureProjectionLightDirty = true); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "projectionTextureUpDirection", { - get: function() { - return this._projectionTextureUpDirection - }, - set: function(e) { - this._projectionTextureUpDirection = e, - this._projectionTextureProjectionLightDirty = true - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "projectionTexture", { - get: function() { - return this._projectionTexture - }, - set: function(e) { - var t = this; - if (this._projectionTexture !== e && (this._projectionTexture = e, - this._projectionTextureDirty = true, - this._projectionTexture && !this._projectionTexture.isReady())) { - var i = this._projectionTexture; - i.onLoadObservable && i.onLoadObservable.addOnce(function() { - t._markMeshesAsLightDirty() - }) - } - }, - enumerable: true, - configurable: true - }), - t.prototype.getClassName = function() { - return "SpotLight" - } - , - t.prototype.getTypeID = function() { - return Nn.a.LIGHTTYPEID_SPOTLIGHT - } - , - t.prototype._setDirection = function(t) { - e.prototype._setDirection.call(this, t), - this._projectionTextureViewLightDirty = true - } - , - t.prototype._setPosition = function(t) { - e.prototype._setPosition.call(this, t), - this._projectionTextureViewLightDirty = true - } - , - t.prototype._setDefaultShadowProjectionMatrix = function(e, t, i) { - var n = this.getScene().activeCamera; - if (n) { - this._shadowAngleScale = this._shadowAngleScale || 1; - var r = this._shadowAngleScale * this._angle; - a.j.PerspectiveFovLHToRef(r, 1, this.getDepthMinZ(n), this.getDepthMaxZ(n), e) + get: function () { + return this._projectionTexture; + }, + set: function (e) { + var t = this; + if ( + this._projectionTexture !== e && + ((this._projectionTexture = e), + (this._projectionTextureDirty = true), + this._projectionTexture && + !this._projectionTexture.isReady()) + ) { + var i = this._projectionTexture; + i.onLoadObservable && + i.onLoadObservable.addOnce(function () { + t._markMeshesAsLightDirty(); + }); } - } - , - t.prototype._computeProjectionTextureViewLightMatrix = function() { - this._projectionTextureViewLightDirty = false, - this._projectionTextureDirty = true, - this.position.addToRef(this.direction, this._projectionTextureViewTargetVector), - a.j.LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix) - } - , - t.prototype._computeProjectionTextureProjectionLightMatrix = function() { - this._projectionTextureProjectionLightDirty = false, - this._projectionTextureDirty = true; - var e = this.projectionTextureLightFar - , t = this.projectionTextureLightNear - , i = e / (e - t) - , n = -i * t - , r = 1 / Math.tan(this._angle / 2); - a.j.FromValuesToRef(r / 1, 0, 0, 0, 0, r, 0, 0, 0, 0, i, 1, 0, 0, n, 0, this._projectionTextureProjectionLightMatrix) - } - , - t.prototype._computeProjectionTextureMatrix = function() { - this._projectionTextureDirty = false, - this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix), - this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix) - } - , - t.prototype._buildUniformLayout = function() { - this._uniformBuffer.addUniform("vLightData", 4), + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "SpotLight"; + }), + (t.prototype.getTypeID = function () { + return Nn.a.LIGHTTYPEID_SPOTLIGHT; + }), + (t.prototype._setDirection = function (t) { + e.prototype._setDirection.call(this, t), + (this._projectionTextureViewLightDirty = true); + }), + (t.prototype._setPosition = function (t) { + e.prototype._setPosition.call(this, t), + (this._projectionTextureViewLightDirty = true); + }), + (t.prototype._setDefaultShadowProjectionMatrix = function ( + e, + t, + i + ) { + var n = this.getScene().activeCamera; + if (n) { + this._shadowAngleScale = this._shadowAngleScale || 1; + var r = this._shadowAngleScale * this._angle; + a.j.PerspectiveFovLHToRef( + r, + 1, + this.getDepthMinZ(n), + this.getDepthMaxZ(n), + e + ); + } + }), + (t.prototype._computeProjectionTextureViewLightMatrix = + function () { + (this._projectionTextureViewLightDirty = false), + (this._projectionTextureDirty = true), + this.position.addToRef( + this.direction, + this._projectionTextureViewTargetVector + ), + a.j.LookAtLHToRef( + this.position, + this._projectionTextureViewTargetVector, + this._projectionTextureUpDirection, + this._projectionTextureViewLightMatrix + ); + }), + (t.prototype._computeProjectionTextureProjectionLightMatrix = + function () { + (this._projectionTextureProjectionLightDirty = false), + (this._projectionTextureDirty = true); + var e = this.projectionTextureLightFar, + t = this.projectionTextureLightNear, + i = e / (e - t), + n = -i * t, + r = 1 / Math.tan(this._angle / 2); + a.j.FromValuesToRef( + r / 1, + 0, + 0, + 0, + 0, + r, + 0, + 0, + 0, + 0, + i, + 1, + 0, + 0, + n, + 0, + this._projectionTextureProjectionLightMatrix + ); + }), + (t.prototype._computeProjectionTextureMatrix = function () { + (this._projectionTextureDirty = false), + this._projectionTextureViewLightMatrix.multiplyToRef( + this._projectionTextureProjectionLightMatrix, + this._projectionTextureMatrix + ), + this._projectionTextureMatrix.multiplyToRef( + this._projectionTextureScalingMatrix, + this._projectionTextureMatrix + ); + }), + (t.prototype._buildUniformLayout = function () { + this._uniformBuffer.addUniform("vLightData", 4), this._uniformBuffer.addUniform("vLightDiffuse", 4), this._uniformBuffer.addUniform("vLightSpecular", 3), this._uniformBuffer.addUniform("vLightDirection", 3), this._uniformBuffer.addUniform("vLightFalloff", 4), this._uniformBuffer.addUniform("shadowsInfo", 3), this._uniformBuffer.addUniform("depthValues", 2), - this._uniformBuffer.create() - } - , - t.prototype._computeAngleValues = function() { - this._lightAngleScale = 1 / Math.max(.001, Math.cos(.5 * this._innerAngle) - this._cosHalfAngle), - this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale - } - , - t.prototype.transferToEffect = function(e, t) { - var i; - return this.computeTransformedInformation() ? (this._uniformBuffer.updateFloat4("vLightData", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, t), - i = a.x.Normalize(this.transformedDirection)) : (this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, this.exponent, t), - i = a.x.Normalize(this.direction)), - this._uniformBuffer.updateFloat4("vLightDirection", i.x, i.y, i.z, this._cosHalfAngle, t), - this._uniformBuffer.updateFloat4("vLightFalloff", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, t), - this.projectionTexture && this.projectionTexture.isReady() && (this._projectionTextureViewLightDirty && this._computeProjectionTextureViewLightMatrix(), - this._projectionTextureProjectionLightDirty && this._computeProjectionTextureProjectionLightMatrix(), - this._projectionTextureDirty && this._computeProjectionTextureMatrix(), - e.setMatrix("textureProjectionMatrix" + t, this._projectionTextureMatrix), - e.setTexture("projectionLightSampler" + t, this.projectionTexture)), + this._uniformBuffer.create(); + }), + (t.prototype._computeAngleValues = function () { + (this._lightAngleScale = + 1 / + Math.max( + 0.001, + Math.cos(0.5 * this._innerAngle) - this._cosHalfAngle + )), + (this._lightAngleOffset = + -this._cosHalfAngle * this._lightAngleScale); + }), + (t.prototype.transferToEffect = function (e, t) { + var i; + return ( + this.computeTransformedInformation() + ? (this._uniformBuffer.updateFloat4( + "vLightData", + this.transformedPosition.x, + this.transformedPosition.y, + this.transformedPosition.z, + this.exponent, + t + ), + (i = a.x.Normalize(this.transformedDirection))) + : (this._uniformBuffer.updateFloat4( + "vLightData", + this.position.x, + this.position.y, + this.position.z, + this.exponent, + t + ), + (i = a.x.Normalize(this.direction))), + this._uniformBuffer.updateFloat4( + "vLightDirection", + i.x, + i.y, + i.z, + this._cosHalfAngle, + t + ), + this._uniformBuffer.updateFloat4( + "vLightFalloff", + this.range, + this._inverseSquaredRange, + this._lightAngleScale, + this._lightAngleOffset, + t + ), + this.projectionTexture && + this.projectionTexture.isReady() && + (this._projectionTextureViewLightDirty && + this._computeProjectionTextureViewLightMatrix(), + this._projectionTextureProjectionLightDirty && + this._computeProjectionTextureProjectionLightMatrix(), + this._projectionTextureDirty && + this._computeProjectionTextureMatrix(), + e.setMatrix( + "textureProjectionMatrix" + t, + this._projectionTextureMatrix + ), + e.setTexture( + "projectionLightSampler" + t, + this.projectionTexture + )), this - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), - this._projectionTexture && this._projectionTexture.dispose() - } - , - t.prototype.prepareLightSpecificDefines = function(e, t) { - e["SPOTLIGHT" + t] = true, - e["PROJECTEDLIGHTTEXTURE" + t] = !(!this.projectionTexture || !this.projectionTexture.isReady()) - } - , + ); + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), + this._projectionTexture && + this._projectionTexture.dispose(); + }), + (t.prototype.prepareLightSpecificDefines = function (e, t) { + (e["SPOTLIGHT" + t] = true), + (e["PROJECTEDLIGHTTEXTURE" + t] = !( + !this.projectionTexture || + !this.projectionTexture.isReady() + )); + }), h.c([Object(F.c)()], t.prototype, "angle", null), h.c([Object(F.c)()], t.prototype, "innerAngle", null), h.c([Object(F.c)()], t.prototype, "shadowAngleScale", null), h.c([Object(F.c)()], t.prototype, "exponent", void 0), - h.c([Object(F.c)()], t.prototype, "projectionTextureLightNear", null), - h.c([Object(F.c)()], t.prototype, "projectionTextureLightFar", null), - h.c([Object(F.c)()], t.prototype, "projectionTextureUpDirection", null), - h.c([Object(F.m)("projectedLightTexture")], t.prototype, "_projectionTexture", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "projectionTextureLightNear", + null + ), + h.c( + [Object(F.c)()], + t.prototype, + "projectionTextureLightFar", + null + ), + h.c( + [Object(F.c)()], + t.prototype, + "projectionTextureUpDirection", + null + ), + h.c( + [Object(F.m)("projectedLightTexture")], + t.prototype, + "_projectionTexture", + void 0 + ), t - }(kn) - , zn = function(e) { - function t(t) { - var i = e.call(this, t) || this; - return i.cachedPosition = new a.x, - i.cachedForward = new a.x(0,0,1), - i._light = null, - i.attachedMesh = new Ne.a("",i.gizmoLayer.utilityLayerScene), - i._material = new bi.a("light",i.gizmoLayer.originalScene), - i._material.diffuseColor = new a.e(.5,.5,.5), - i._material.specularColor = new a.e(.1,.1,.1), - i - } - return h.d(t, e), + ); + })(kn), + zn = (function (e) { + function t(t) { + var i = e.call(this, t) || this; + return ( + (i.cachedPosition = new a.x()), + (i.cachedForward = new a.x(0, 0, 1)), + (i._light = null), + (i.attachedMesh = new Ne.a( + "", + i.gizmoLayer.utilityLayerScene + )), + (i._material = new bi.a( + "light", + i.gizmoLayer.originalScene + )), + (i._material.diffuseColor = new a.e(0.5, 0.5, 0.5)), + (i._material.specularColor = new a.e(0.1, 0.1, 0.1)), + i + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "light", { - get: function() { - return this._light - }, - set: function(e) { - var i = this; - if (this._light = e, - e) { - this._lightMesh && this._lightMesh.dispose(), - e instanceof gi.a ? this._lightMesh = t._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene) : this._lightMesh = e instanceof Un ? t._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene) : e instanceof Gn ? t._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene) : t._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene), - this._lightMesh.getChildMeshes(false).forEach(function(e) { - e.material = i._material - }), - this._lightMesh.parent = this._rootMesh; - var n = this.gizmoLayer._getSharedGizmoLight(); - n.includedOnlyMeshes = n.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(false)), - this._lightMesh.rotationQuaternion = new a.q, - e.position && this.attachedMesh.position.copyFrom(e.position), - e.direction && this.attachedMesh.setDirection(e.direction), - this._update() - } - }, - enumerable: true, - configurable: true + get: function () { + return this._light; + }, + set: function (e) { + var i = this; + if (((this._light = e), e)) { + this._lightMesh && this._lightMesh.dispose(), + e instanceof gi.a + ? (this._lightMesh = + t._CreateHemisphericLightMesh( + this.gizmoLayer.utilityLayerScene + )) + : (this._lightMesh = + e instanceof Un + ? t._CreateDirectionalLightMesh( + this.gizmoLayer.utilityLayerScene + ) + : e instanceof Gn + ? t._CreateSpotLightMesh( + this.gizmoLayer.utilityLayerScene + ) + : t._CreatePointLightMesh( + this.gizmoLayer.utilityLayerScene + )), + this._lightMesh + .getChildMeshes(false) + .forEach(function (e) { + e.material = i._material; + }), + (this._lightMesh.parent = this._rootMesh); + var n = this.gizmoLayer._getSharedGizmoLight(); + (n.includedOnlyMeshes = n.includedOnlyMeshes.concat( + this._lightMesh.getChildMeshes(false) + )), + (this._lightMesh.rotationQuaternion = new a.q()), + e.position && + this.attachedMesh.position.copyFrom(e.position), + e.direction && + this.attachedMesh.setDirection(e.direction), + this._update(); + } + }, + enumerable: true, + configurable: true, }), - t.prototype._update = function() { - e.prototype._update.call(this), - this._light && (this._light.position && (this.attachedMesh.position.equals(this.cachedPosition) ? this.attachedMesh.position.copyFrom(this._light.position) : (this._light.position.copyFrom(this.attachedMesh.position), - this.cachedPosition.copyFrom(this.attachedMesh.position))), - this._light.direction && (a.x.DistanceSquared(this.attachedMesh.forward, this.cachedForward) > 1e-4 ? (this._light.direction.copyFrom(this.attachedMesh.forward), - this.cachedForward.copyFrom(this.attachedMesh.forward)) : a.x.DistanceSquared(this.attachedMesh.forward, this._light.direction) > 1e-4 && (this.attachedMesh.setDirection(this._light.direction), - this.cachedForward.copyFrom(this._lightMesh.forward))), - this._light.isEnabled() ? this._material.diffuseColor.set(this._light.diffuse.r / 3, this._light.diffuse.g / 3, this._light.diffuse.b / 3) : this._material.diffuseColor.set(0, 0, 0)) - } - , - t.prototype.dispose = function() { - this._material.dispose(), - e.prototype.dispose.call(this) - } - , - t._CreateHemisphericLightMesh = function(e) { - var i = new me.a("hemisphereLight",e) - , n = Vn.CreateHemisphere(i.name, { + (t.prototype._update = function () { + e.prototype._update.call(this), + this._light && + (this._light.position && + (this.attachedMesh.position.equals( + this.cachedPosition + ) + ? this.attachedMesh.position.copyFrom( + this._light.position + ) + : (this._light.position.copyFrom( + this.attachedMesh.position + ), + this.cachedPosition.copyFrom( + this.attachedMesh.position + ))), + this._light.direction && + (a.x.DistanceSquared( + this.attachedMesh.forward, + this.cachedForward + ) > 1e-4 + ? (this._light.direction.copyFrom( + this.attachedMesh.forward + ), + this.cachedForward.copyFrom( + this.attachedMesh.forward + )) + : a.x.DistanceSquared( + this.attachedMesh.forward, + this._light.direction + ) > 1e-4 && + (this.attachedMesh.setDirection( + this._light.direction + ), + this.cachedForward.copyFrom( + this._lightMesh.forward + ))), + this._light.isEnabled() + ? this._material.diffuseColor.set( + this._light.diffuse.r / 3, + this._light.diffuse.g / 3, + this._light.diffuse.b / 3 + ) + : this._material.diffuseColor.set(0, 0, 0)); + }), + (t.prototype.dispose = function () { + this._material.dispose(), e.prototype.dispose.call(this); + }), + (t._CreateHemisphericLightMesh = function (e) { + var i = new me.a("hemisphereLight", e), + n = Vn.CreateHemisphere( + i.name, + { segments: 10, - diameter: 1 - }, e); - n.position.z = -.15, - n.rotation.x = Math.PI / 2, - n.parent = i; - var r = this._createLightLines(3, e); - return r.parent = i, + diameter: 1, + }, + e + ); + (n.position.z = -0.15), + (n.rotation.x = Math.PI / 2), + (n.parent = i); + var r = this._createLightLines(3, e); + return ( + (r.parent = i), r.position.z, i.scaling.scaleInPlace(t._Scale), - i.rotation.x = Math.PI / 2, + (i.rotation.x = Math.PI / 2), i - } - , - t._CreatePointLightMesh = function(e) { - var i = new me.a("pointLight",e) - , n = Rn.a.CreateSphere(i.name, { + ); + }), + (t._CreatePointLightMesh = function (e) { + var i = new me.a("pointLight", e), + n = Rn.a.CreateSphere( + i.name, + { segments: 10, - diameter: 1 - }, e); - return n.rotation.x = Math.PI / 2, - n.parent = i, - this._createLightLines(5, e).parent = i, + diameter: 1, + }, + e + ); + return ( + (n.rotation.x = Math.PI / 2), + (n.parent = i), + (this._createLightLines(5, e).parent = i), i.scaling.scaleInPlace(t._Scale), - i.rotation.x = Math.PI / 2, + (i.rotation.x = Math.PI / 2), i - } - , - t._CreateSpotLightMesh = function(e) { - var i = new me.a("spotLight",e); - Rn.a.CreateSphere(i.name, { - segments: 10, - diameter: 1 - }, e).parent = i; - var n = Vn.CreateHemisphere(i.name, { - segments: 10, - diameter: 2 - }, e); - return n.parent = i, - n.rotation.x = -Math.PI / 2, - this._createLightLines(2, e).parent = i, + ); + }), + (t._CreateSpotLightMesh = function (e) { + var i = new me.a("spotLight", e); + Rn.a.CreateSphere( + i.name, + { + segments: 10, + diameter: 1, + }, + e + ).parent = i; + var n = Vn.CreateHemisphere( + i.name, + { + segments: 10, + diameter: 2, + }, + e + ); + return ( + (n.parent = i), + (n.rotation.x = -Math.PI / 2), + (this._createLightLines(2, e).parent = i), i.scaling.scaleInPlace(t._Scale), - i.rotation.x = Math.PI / 2, + (i.rotation.x = Math.PI / 2), i - } - , - t._CreateDirectionalLightMesh = function(e) { - var i = new me.a("directionalLight",e) - , n = new me.a(i.name,e); - n.parent = i, - Rn.a.CreateSphere(i.name, { + ); + }), + (t._CreateDirectionalLightMesh = function (e) { + var i = new me.a("directionalLight", e), + n = new me.a(i.name, e); + (n.parent = i), + (Rn.a.CreateSphere( + i.name, + { diameter: 1.2, - segments: 10 - }, e).parent = n; - var r = me.a.CreateCylinder(i.name, 6, .3, .3, 6, 1, e); - r.parent = n, - (o = r.clone(i.name)).scaling.y = .5, - o.position.x += 1.25, - (a = r.clone(i.name)).scaling.y = .5, - a.position.x += -1.25; - var o, a, s = me.a.CreateCylinder(i.name, 1, 0, .6, 6, 1, e); - return s.position.y += 3, - s.parent = n, - (o = s.clone(i.name)).position.y = 1.5, - o.position.x += 1.25, - (a = s.clone(i.name)).position.y = 1.5, - a.position.x += -1.25, + segments: 10, + }, + e + ).parent = n); + var r = me.a.CreateCylinder(i.name, 6, 0.3, 0.3, 6, 1, e); + (r.parent = n), + ((o = r.clone(i.name)).scaling.y = 0.5), + (o.position.x += 1.25), + ((a = r.clone(i.name)).scaling.y = 0.5), + (a.position.x += -1.25); + var o, + a, + s = me.a.CreateCylinder(i.name, 1, 0, 0.6, 6, 1, e); + return ( + (s.position.y += 3), + (s.parent = n), + ((o = s.clone(i.name)).position.y = 1.5), + (o.position.x += 1.25), + ((a = s.clone(i.name)).position.y = 1.5), + (a.position.x += -1.25), n.scaling.scaleInPlace(t._Scale), - n.rotation.z = Math.PI / 2, - n.rotation.y = Math.PI / 2, + (n.rotation.z = Math.PI / 2), + (n.rotation.y = Math.PI / 2), i - } - , - t._Scale = .007, - t._createLightLines = function(e, t) { - var i = new me.a("root",t); - i.rotation.x = Math.PI / 2; - var n = new me.a("linePivot",t); - n.parent = i; - var r = me.a.CreateCylinder("line", 2, .2, .3, 6, 1, t); - if (r.position.y = r.scaling.y / 2 + 1.2, - r.parent = n, + ); + }), + (t._Scale = 0.007), + (t._createLightLines = function (e, t) { + var i = new me.a("root", t); + i.rotation.x = Math.PI / 2; + var n = new me.a("linePivot", t); + n.parent = i; + var r = me.a.CreateCylinder("line", 2, 0.2, 0.3, 6, 1, t); + if ( + ((r.position.y = r.scaling.y / 2 + 1.2), + (r.parent = n), e < 2) - return n; - for (var o = 0; o < 4; o++) - (a = n.clone("lineParentClone")).rotation.z = Math.PI / 4, - a.rotation.y = Math.PI / 2 + Math.PI / 2 * o, - a.getChildMeshes()[0].scaling.y = .5, - a.getChildMeshes()[0].scaling.x = a.getChildMeshes()[0].scaling.z = .8, - a.getChildMeshes()[0].position.y = a.getChildMeshes()[0].scaling.y / 2 + 1.2; - if (e < 3) - return i; - for (o = 0; o < 4; o++) - (a = n.clone("linePivotClone")).rotation.z = Math.PI / 2, - a.rotation.y = Math.PI / 2 * o; - if (e < 4) - return i; - for (o = 0; o < 4; o++) { - var a; - (a = n.clone("linePivotClone")).rotation.z = Math.PI + Math.PI / 4, - a.rotation.y = Math.PI / 2 + Math.PI / 2 * o, - a.getChildMeshes()[0].scaling.y = .5, - a.getChildMeshes()[0].scaling.x = a.getChildMeshes()[0].scaling.z = .8, - a.getChildMeshes()[0].position.y = a.getChildMeshes()[0].scaling.y / 2 + 1.2 - } - return e < 5 ? i : ((a = n.clone("linePivotClone")).rotation.z = Math.PI, - i) - } - , + ) + return n; + for (var o = 0; o < 4; o++) + ((a = n.clone("lineParentClone")).rotation.z = + Math.PI / 4), + (a.rotation.y = Math.PI / 2 + (Math.PI / 2) * o), + (a.getChildMeshes()[0].scaling.y = 0.5), + (a.getChildMeshes()[0].scaling.x = + a.getChildMeshes()[0].scaling.z = + 0.8), + (a.getChildMeshes()[0].position.y = + a.getChildMeshes()[0].scaling.y / 2 + 1.2); + if (e < 3) return i; + for (o = 0; o < 4; o++) + ((a = n.clone("linePivotClone")).rotation.z = + Math.PI / 2), + (a.rotation.y = (Math.PI / 2) * o); + if (e < 4) return i; + for (o = 0; o < 4; o++) { + var a; + ((a = n.clone("linePivotClone")).rotation.z = + Math.PI + Math.PI / 4), + (a.rotation.y = Math.PI / 2 + (Math.PI / 2) * o), + (a.getChildMeshes()[0].scaling.y = 0.5), + (a.getChildMeshes()[0].scaling.x = + a.getChildMeshes()[0].scaling.z = + 0.8), + (a.getChildMeshes()[0].position.y = + a.getChildMeshes()[0].scaling.y / 2 + 1.2); + } + return e < 5 + ? i + : (((a = n.clone("linePivotClone")).rotation.z = + Math.PI), + i); + }), t - }(Sn.a) - , jn = n(44); - Ht.a.IncludesShadersStore.kernelBlurVaryingDeclaration = "varying vec2 sampleCoord{X};"; - Ht.a.IncludesShadersStore.kernelBlurFragment = "#ifdef DOF\nfactor=sampleCoC(sampleCoord{X});\ncomputedWeight=KERNEL_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif"; - Ht.a.IncludesShadersStore.kernelBlurFragment2 = "#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});\ncomputedWeight=KERNEL_DEP_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif"; - Ht.a.ShadersStore.kernelBlurPixelShader = "\nuniform sampler2D textureSampler;\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;\nuniform vec2 cameraMinMaxZ;\nfloat sampleDistance(const in vec2 offset) {\nfloat depth=texture2D(circleOfConfusionSampler,offset).g;\nreturn cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth;\n}\nfloat sampleCoC(const in vec2 offset) {\nfloat coc=texture2D(circleOfConfusionSampler,offset).r;\nreturn coc;\n}\n#endif\n#include[0..varyingCount]\n#ifdef PACKEDFLOAT\nvec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nvoid main(void)\n{\nfloat computedWeight=0.0;\n#ifdef PACKEDFLOAT\nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT;\nfloat factor=0.0;\n\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include[0..varyingCount]\n#include[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}", - Ht.a.IncludesShadersStore.kernelBlurVertex = "sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};"; - Ht.a.ShadersStore.kernelBlurVertexShader = "\nattribute vec2 position;\n\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#include[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nsampleCenter=(position*madd+madd);\n#include[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n}"; - var Hn = function(e) { - function t(t, i, n, r, o, a, s, c, u, l, h) { - void 0 === a && (a = je.a.BILINEAR_SAMPLINGMODE), - void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === l && (l = ""), - void 0 === h && (h = false); - var f = e.call(this, t, "kernelBlur", ["delta", "direction", "cameraMinMaxZ"], ["circleOfConfusionSampler"], r, o, a, s, c, null, u, "kernelBlur", { - varyingCount: 0, - depCount: 0 - }, true) || this; - return f.direction = i, - f.blockCompilation = h, - f._packedFloat = false, - f._staticDefines = "", - f._staticDefines = l, - f.onApplyObservable.add(function(e) { - f._outputTexture ? e.setFloat2("delta", 1 / f._outputTexture.width * f.direction.x, 1 / f._outputTexture.height * f.direction.y) : e.setFloat2("delta", 1 / f.width * f.direction.x, 1 / f.height * f.direction.y) - }), - f.kernel = n, - f - } - return h.d(t, e), + ); + })(Sn.a), + jn = n(44); + Ht.a.IncludesShadersStore.kernelBlurVaryingDeclaration = + "varying vec2 sampleCoord{X};"; + Ht.a.IncludesShadersStore.kernelBlurFragment = + "#ifdef DOF\nfactor=sampleCoC(sampleCoord{X});\ncomputedWeight=KERNEL_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif"; + Ht.a.IncludesShadersStore.kernelBlurFragment2 = + "#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});\ncomputedWeight=KERNEL_DEP_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif"; + (Ht.a.ShadersStore.kernelBlurPixelShader = + "\nuniform sampler2D textureSampler;\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;\nuniform vec2 cameraMinMaxZ;\nfloat sampleDistance(const in vec2 offset) {\nfloat depth=texture2D(circleOfConfusionSampler,offset).g;\nreturn cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth;\n}\nfloat sampleCoC(const in vec2 offset) {\nfloat coc=texture2D(circleOfConfusionSampler,offset).r;\nreturn coc;\n}\n#endif\n#include[0..varyingCount]\n#ifdef PACKEDFLOAT\nvec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nvoid main(void)\n{\nfloat computedWeight=0.0;\n#ifdef PACKEDFLOAT\nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT;\nfloat factor=0.0;\n\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include[0..varyingCount]\n#include[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}"), + (Ht.a.IncludesShadersStore.kernelBlurVertex = + "sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};"); + Ht.a.ShadersStore.kernelBlurVertexShader = + "\nattribute vec2 position;\n\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#include[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nsampleCenter=(position*madd+madd);\n#include[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n}"; + var Hn = (function (e) { + function t(t, i, n, r, o, a, s, c, u, l, h) { + void 0 === a && (a = je.a.BILINEAR_SAMPLINGMODE), + void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === l && (l = ""), + void 0 === h && (h = false); + var f = + e.call( + this, + t, + "kernelBlur", + ["delta", "direction", "cameraMinMaxZ"], + ["circleOfConfusionSampler"], + r, + o, + a, + s, + c, + null, + u, + "kernelBlur", + { + varyingCount: 0, + depCount: 0, + }, + true + ) || this; + return ( + (f.direction = i), + (f.blockCompilation = h), + (f._packedFloat = false), + (f._staticDefines = ""), + (f._staticDefines = l), + f.onApplyObservable.add(function (e) { + f._outputTexture + ? e.setFloat2( + "delta", + (1 / f._outputTexture.width) * f.direction.x, + (1 / f._outputTexture.height) * f.direction.y + ) + : e.setFloat2( + "delta", + (1 / f.width) * f.direction.x, + (1 / f.height) * f.direction.y + ); + }), + (f.kernel = n), + f + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "kernel", { - get: function() { - return this._idealKernel - }, - set: function(e) { - this._idealKernel !== e && (e = Math.max(e, 1), - this._idealKernel = e, - this._kernel = this._nearestBestKernel(e), - this.blockCompilation || this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._idealKernel; + }, + set: function (e) { + this._idealKernel !== e && + ((e = Math.max(e, 1)), + (this._idealKernel = e), + (this._kernel = this._nearestBestKernel(e)), + this.blockCompilation || this._updateParameters()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "packedFloat", { - get: function() { - return this._packedFloat - }, - set: function(e) { - this._packedFloat !== e && (this._packedFloat = e, - this.blockCompilation || this._updateParameters()) - }, - enumerable: true, - configurable: true + get: function () { + return this._packedFloat; + }, + set: function (e) { + this._packedFloat !== e && + ((this._packedFloat = e), + this.blockCompilation || this._updateParameters()); + }, + enumerable: true, + configurable: true, }), - t.prototype.updateEffect = function(e, t, i, n, r, o) { - void 0 === e && (e = null), + (t.prototype.updateEffect = function (e, t, i, n, r, o) { + void 0 === e && (e = null), void 0 === t && (t = null), void 0 === i && (i = null), - this._updateParameters(r, o) - } - , - t.prototype._updateParameters = function(t, i) { - for (var n = this._kernel, r = (n - 1) / 2, o = [], a = [], s = 0, c = 0; c < n; c++) { - var u = c / (n - 1) - , l = this._gaussianWeight(2 * u - 1); - o[c] = c - r, - a[c] = l, - s += l + this._updateParameters(r, o); + }), + (t.prototype._updateParameters = function (t, i) { + for ( + var n = this._kernel, + r = (n - 1) / 2, + o = [], + a = [], + s = 0, + c = 0; + c < n; + c++ + ) { + var u = c / (n - 1), + l = this._gaussianWeight(2 * u - 1); + (o[c] = c - r), (a[c] = l), (s += l); + } + for (c = 0; c < a.length; c++) a[c] /= s; + var h = [], + f = [], + d = []; + for (c = 0; c <= r; c += 2) { + var p = Math.min(c + 1, Math.floor(r)); + if (c === p) + d.push({ + o: o[c], + w: a[c], + }); + else { + var m = p === r, + g = a[c] + a[p] * (m ? 0.5 : 1), + _ = o[c] + 1 / (1 + a[c] / a[p]); + 0 === _ + ? (d.push({ + o: o[c], + w: a[c], + }), + d.push({ + o: o[c + 1], + w: a[c + 1], + })) + : (d.push({ + o: _, + w: g, + }), + d.push({ + o: -_, + w: g, + })); } - for (c = 0; c < a.length; c++) - a[c] /= s; - var h = [] - , f = [] - , d = []; - for (c = 0; c <= r; c += 2) { - var p = Math.min(c + 1, Math.floor(r)); - if (c === p) - d.push({ - o: o[c], - w: a[c] - }); - else { - var m = p === r - , g = a[c] + a[p] * (m ? .5 : 1) - , _ = o[c] + 1 / (1 + a[c] / a[p]); - 0 === _ ? (d.push({ - o: o[c], - w: a[c] - }), - d.push({ - o: o[c + 1], - w: a[c + 1] - })) : (d.push({ - o: _, - w: g - }), - d.push({ - o: -_, - w: g - })) - } - } - for (c = 0; c < d.length; c++) - f[c] = d[c].o, - h[c] = d[c].w; - o = f, - a = h; - var v = this.getEngine().getCaps().maxVaryingVectors - , y = Math.max(v, 0) - 1 - , b = Math.min(o.length, y) - , E = ""; - for (E += this._staticDefines, - -1 != this._staticDefines.indexOf("DOF") && (E += "#define CENTER_WEIGHT " + this._glslFloat(a[b - 1]) + "\r\n", - b--), - c = 0; c < b; c++) - E += "#define KERNEL_OFFSET" + c + " " + this._glslFloat(o[c]) + "\r\n", - E += "#define KERNEL_WEIGHT" + c + " " + this._glslFloat(a[c]) + "\r\n"; - var T = 0; - for (c = y; c < o.length; c++) - E += "#define KERNEL_DEP_OFFSET" + T + " " + this._glslFloat(o[c]) + "\r\n", - E += "#define KERNEL_DEP_WEIGHT" + T + " " + this._glslFloat(a[c]) + "\r\n", - T++; - this.packedFloat && (E += "#define PACKEDFLOAT 1"), - this.blockCompilation = false, - e.prototype.updateEffect.call(this, E, null, null, { + } + for (c = 0; c < d.length; c++) + (f[c] = d[c].o), (h[c] = d[c].w); + (o = f), (a = h); + var v = this.getEngine().getCaps().maxVaryingVectors, + y = Math.max(v, 0) - 1, + b = Math.min(o.length, y), + E = ""; + for ( + E += this._staticDefines, + -1 != this._staticDefines.indexOf("DOF") && + ((E += + "#define CENTER_WEIGHT " + + this._glslFloat(a[b - 1]) + + "\r\n"), + b--), + c = 0; + c < b; + c++ + ) + (E += + "#define KERNEL_OFFSET" + + c + + " " + + this._glslFloat(o[c]) + + "\r\n"), + (E += + "#define KERNEL_WEIGHT" + + c + + " " + + this._glslFloat(a[c]) + + "\r\n"); + var T = 0; + for (c = y; c < o.length; c++) + (E += + "#define KERNEL_DEP_OFFSET" + + T + + " " + + this._glslFloat(o[c]) + + "\r\n"), + (E += + "#define KERNEL_DEP_WEIGHT" + + T + + " " + + this._glslFloat(a[c]) + + "\r\n"), + T++; + this.packedFloat && (E += "#define PACKEDFLOAT 1"), + (this.blockCompilation = false), + e.prototype.updateEffect.call( + this, + E, + null, + null, + { varyingCount: b, - depCount: T - }, t, i) - } - , - t.prototype._nearestBestKernel = function(e) { - for (var t = Math.round(e), i = 0, n = [t, t - 1, t + 1, t - 2, t + 2]; i < n.length; i++) { - var r = n[i]; - if (r % 2 != 0 && Math.floor(r / 2) % 2 == 0 && r > 0) - return Math.max(r, 3) - } - return Math.max(t, 3) - } - , - t.prototype._gaussianWeight = function(e) { - var t = -e * e / (1 / 3 * 2 * (1 / 3)); - return 1 / (Math.sqrt(2 * Math.PI) * (1 / 3)) * Math.exp(t) - } - , - t.prototype._glslFloat = function(e, t) { - return void 0 === t && (t = 8), - e.toFixed(t).replace(/0+$/, "") - } - , + depCount: T, + }, + t, + i + ); + }), + (t.prototype._nearestBestKernel = function (e) { + for ( + var t = Math.round(e), + i = 0, + n = [t, t - 1, t + 1, t - 2, t + 2]; + i < n.length; + i++ + ) { + var r = n[i]; + if (r % 2 != 0 && Math.floor(r / 2) % 2 == 0 && r > 0) + return Math.max(r, 3); + } + return Math.max(t, 3); + }), + (t.prototype._gaussianWeight = function (e) { + var t = (-e * e) / ((1 / 3) * 2 * (1 / 3)); + return ( + (1 / (Math.sqrt(2 * Math.PI) * (1 / 3))) * Math.exp(t) + ); + }), + (t.prototype._glslFloat = function (e, t) { + return ( + void 0 === t && (t = 8), e.toFixed(t).replace(/0+$/, "") + ); + }), t - }(Wt) - , Wn = function(e) { - function t(t, i, n, r, o, s, c) { - void 0 === o && (o = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === s && (s = je.a.BILINEAR_SAMPLINGMODE), - void 0 === c && (c = true); - var u = e.call(this, t, i, n, r, true, o, false, s, c) || this; - return u.scene = n, - u.mirrorPlane = new a.n(0,1,0,1), - u._transformMatrix = a.j.Zero(), - u._mirrorMatrix = a.j.Zero(), - u._adaptiveBlurKernel = 0, - u._blurKernelX = 0, - u._blurKernelY = 0, - u._blurRatio = 1, - u.ignoreCameraViewport = true, - u._updateGammaSpace(), - u._imageProcessingConfigChangeObserver = n.imageProcessingConfiguration.onUpdateParameters.add(function() { - u._updateGammaSpace - }), - u.onBeforeRenderObservable.add(function() { - a.j.ReflectionToRef(u.mirrorPlane, u._mirrorMatrix), - u._savedViewMatrix = n.getViewMatrix(), - u._mirrorMatrix.multiplyToRef(u._savedViewMatrix, u._transformMatrix), - n.setTransformMatrix(u._transformMatrix, n.getProjectionMatrix()), - n.clipPlane = u.mirrorPlane, - n.getEngine().cullBackFaces = false, - n._mirroredCameraPosition = a.x.TransformCoordinates(n.activeCamera.globalPosition, u._mirrorMatrix) - }), - u.onAfterRenderObservable.add(function() { - n.setTransformMatrix(u._savedViewMatrix, n.getProjectionMatrix()), - n.getEngine().cullBackFaces = true, - n._mirroredCameraPosition = null, - n.clipPlane = null - }), - u - } - return h.d(t, e), + ); + })(Wt), + Wn = (function (e) { + function t(t, i, n, r, o, s, c) { + void 0 === o && (o = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === s && (s = je.a.BILINEAR_SAMPLINGMODE), + void 0 === c && (c = true); + var u = + e.call(this, t, i, n, r, true, o, false, s, c) || this; + return ( + (u.scene = n), + (u.mirrorPlane = new a.n(0, 1, 0, 1)), + (u._transformMatrix = a.j.Zero()), + (u._mirrorMatrix = a.j.Zero()), + (u._adaptiveBlurKernel = 0), + (u._blurKernelX = 0), + (u._blurKernelY = 0), + (u._blurRatio = 1), + (u.ignoreCameraViewport = true), + u._updateGammaSpace(), + (u._imageProcessingConfigChangeObserver = + n.imageProcessingConfiguration.onUpdateParameters.add( + function () { + u._updateGammaSpace; + } + )), + u.onBeforeRenderObservable.add(function () { + a.j.ReflectionToRef(u.mirrorPlane, u._mirrorMatrix), + (u._savedViewMatrix = n.getViewMatrix()), + u._mirrorMatrix.multiplyToRef( + u._savedViewMatrix, + u._transformMatrix + ), + n.setTransformMatrix( + u._transformMatrix, + n.getProjectionMatrix() + ), + (n.clipPlane = u.mirrorPlane), + (n.getEngine().cullBackFaces = false), + (n._mirroredCameraPosition = a.x.TransformCoordinates( + n.activeCamera.globalPosition, + u._mirrorMatrix + )); + }), + u.onAfterRenderObservable.add(function () { + n.setTransformMatrix( + u._savedViewMatrix, + n.getProjectionMatrix() + ), + (n.getEngine().cullBackFaces = true), + (n._mirroredCameraPosition = null), + (n.clipPlane = null); + }), + u + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "blurRatio", { - get: function() { - return this._blurRatio - }, - set: function(e) { - this._blurRatio !== e && (this._blurRatio = e, - this._preparePostProcesses()) - }, - enumerable: true, - configurable: true + get: function () { + return this._blurRatio; + }, + set: function (e) { + this._blurRatio !== e && + ((this._blurRatio = e), this._preparePostProcesses()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "adaptiveBlurKernel", { - set: function(e) { - this._adaptiveBlurKernel = e, - this._autoComputeBlurKernel() - }, - enumerable: true, - configurable: true + set: function (e) { + (this._adaptiveBlurKernel = e), + this._autoComputeBlurKernel(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "blurKernel", { - set: function(e) { - this.blurKernelX = e, - this.blurKernelY = e - }, - enumerable: true, - configurable: true + set: function (e) { + (this.blurKernelX = e), (this.blurKernelY = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "blurKernelX", { - get: function() { - return this._blurKernelX - }, - set: function(e) { - this._blurKernelX !== e && (this._blurKernelX = e, - this._preparePostProcesses()) - }, - enumerable: true, - configurable: true + get: function () { + return this._blurKernelX; + }, + set: function (e) { + this._blurKernelX !== e && + ((this._blurKernelX = e), + this._preparePostProcesses()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "blurKernelY", { - get: function() { - return this._blurKernelY - }, - set: function(e) { - this._blurKernelY !== e && (this._blurKernelY = e, - this._preparePostProcesses()) - }, - enumerable: true, - configurable: true + get: function () { + return this._blurKernelY; + }, + set: function (e) { + this._blurKernelY !== e && + ((this._blurKernelY = e), + this._preparePostProcesses()); + }, + enumerable: true, + configurable: true, }), - t.prototype._autoComputeBlurKernel = function() { - var e = this.getScene().getEngine() - , t = this.getRenderWidth() / e.getRenderWidth() - , i = this.getRenderHeight() / e.getRenderHeight(); - this.blurKernelX = this._adaptiveBlurKernel * t, - this.blurKernelY = this._adaptiveBlurKernel * i - } - , - t.prototype._onRatioRescale = function() { - this._sizeRatio && (this.resize(this._initialSizeParameter), - this._adaptiveBlurKernel || this._preparePostProcesses()), - this._adaptiveBlurKernel && this._autoComputeBlurKernel() - } - , - t.prototype._updateGammaSpace = function() { - this.gammaSpace = !this.scene.imageProcessingConfiguration.isEnabled || !this.scene.imageProcessingConfiguration.applyByPostProcess - } - , - t.prototype._preparePostProcesses = function() { - if (this.clearPostProcesses(true), - this._blurKernelX && this._blurKernelY) { - var e = this.getScene().getEngine() - , t = e.getCaps().textureFloatRender ? _.a.TEXTURETYPE_FLOAT : _.a.TEXTURETYPE_HALF_FLOAT; - this._blurX = new Hn("horizontal blur",new a.w(1,0),this._blurKernelX,this._blurRatio,null,je.a.BILINEAR_SAMPLINGMODE,e,false,t), - this._blurX.autoClear = false, - 1 === this._blurRatio && this.samples < 2 && this._texture ? this._blurX.inputTexture = this._texture : this._blurX.alwaysForcePOT = true, - this._blurY = new Hn("vertical blur",new a.w(0,1),this._blurKernelY,this._blurRatio,null,je.a.BILINEAR_SAMPLINGMODE,e,false,t), - this._blurY.autoClear = false, - this._blurY.alwaysForcePOT = 1 !== this._blurRatio, - this.addPostProcess(this._blurX), - this.addPostProcess(this._blurY) - } else - this._blurY && (this.removePostProcess(this._blurY), - this._blurY.dispose(), - this._blurY = null), - this._blurX && (this.removePostProcess(this._blurX), + (t.prototype._autoComputeBlurKernel = function () { + var e = this.getScene().getEngine(), + t = this.getRenderWidth() / e.getRenderWidth(), + i = this.getRenderHeight() / e.getRenderHeight(); + (this.blurKernelX = this._adaptiveBlurKernel * t), + (this.blurKernelY = this._adaptiveBlurKernel * i); + }), + (t.prototype._onRatioRescale = function () { + this._sizeRatio && + (this.resize(this._initialSizeParameter), + this._adaptiveBlurKernel || + this._preparePostProcesses()), + this._adaptiveBlurKernel && + this._autoComputeBlurKernel(); + }), + (t.prototype._updateGammaSpace = function () { + this.gammaSpace = + !this.scene.imageProcessingConfiguration.isEnabled || + !this.scene.imageProcessingConfiguration + .applyByPostProcess; + }), + (t.prototype._preparePostProcesses = function () { + if ( + (this.clearPostProcesses(true), + this._blurKernelX && this._blurKernelY) + ) { + var e = this.getScene().getEngine(), + t = e.getCaps().textureFloatRender + ? _.a.TEXTURETYPE_FLOAT + : _.a.TEXTURETYPE_HALF_FLOAT; + (this._blurX = new Hn( + "horizontal blur", + new a.w(1, 0), + this._blurKernelX, + this._blurRatio, + null, + je.a.BILINEAR_SAMPLINGMODE, + e, + false, + t + )), + (this._blurX.autoClear = false), + 1 === this._blurRatio && + this.samples < 2 && + this._texture + ? (this._blurX.inputTexture = this._texture) + : (this._blurX.alwaysForcePOT = true), + (this._blurY = new Hn( + "vertical blur", + new a.w(0, 1), + this._blurKernelY, + this._blurRatio, + null, + je.a.BILINEAR_SAMPLINGMODE, + e, + false, + t + )), + (this._blurY.autoClear = false), + (this._blurY.alwaysForcePOT = 1 !== this._blurRatio), + this.addPostProcess(this._blurX), + this.addPostProcess(this._blurY); + } else + this._blurY && + (this.removePostProcess(this._blurY), + this._blurY.dispose(), + (this._blurY = null)), + this._blurX && + (this.removePostProcess(this._blurX), this._blurX.dispose(), - this._blurX = null) - } - , - t.prototype.clone = function() { - var e = this.getScene(); - if (!e) - return this; - var i = this.getSize() - , n = new t(this.name,i.width,e,this._renderTargetOptions.generateMipMaps,this._renderTargetOptions.type,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer); - return n.hasAlpha = this.hasAlpha, - n.level = this.level, - n.mirrorPlane = this.mirrorPlane.clone(), - this.renderList && (n.renderList = this.renderList.slice(0)), + (this._blurX = null)); + }), + (t.prototype.clone = function () { + var e = this.getScene(); + if (!e) return this; + var i = this.getSize(), + n = new t( + this.name, + i.width, + e, + this._renderTargetOptions.generateMipMaps, + this._renderTargetOptions.type, + this._renderTargetOptions.samplingMode, + this._renderTargetOptions.generateDepthBuffer + ); + return ( + (n.hasAlpha = this.hasAlpha), + (n.level = this.level), + (n.mirrorPlane = this.mirrorPlane.clone()), + this.renderList && + (n.renderList = this.renderList.slice(0)), n - } - , - t.prototype.serialize = function() { - if (!this.name) - return null; - var t = e.prototype.serialize.call(this); - return t.mirrorPlane = this.mirrorPlane.asArray(), - t - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), - this.scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver) - } - , + ); + }), + (t.prototype.serialize = function () { + if (!this.name) return null; + var t = e.prototype.serialize.call(this); + return (t.mirrorPlane = this.mirrorPlane.asArray()), t; + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), + this.scene.imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingConfigChangeObserver + ); + }), t - }(li); - je.a._CreateMirror = function(e, t, i, n) { - return new Wn(e,t,i,n) - } - , - ve.b.prototype._createDepthStencilCubeTexture = function(e, t) { - var i = new He.a(this,He.a.DATASOURCE_UNKNOWN); - if (i.isCube = true, - 1 === this.webGLVersion) - return g.a.Error("Depth cube texture is not supported by WebGL 1."), - i; - var n = h.a({ + ); + })(li); + (je.a._CreateMirror = function (e, t, i, n) { + return new Wn(e, t, i, n); + }), + (ve.b.prototype._createDepthStencilCubeTexture = function ( + e, + t + ) { + var i = new He.a(this, He.a.DATASOURCE_UNKNOWN); + if (((i.isCube = true), 1 === this.webGLVersion)) + return ( + g.a.Error( + "Depth cube texture is not supported by WebGL 1." + ), + i + ); + var n = h.a( + { bilinearFiltering: false, comparisonFunction: 0, - generateStencil: false - }, t) - , r = this._gl; - this._bindTextureDirectly(r.TEXTURE_CUBE_MAP, i, true), - this._setupDepthStencilTexture(i, e, n.generateStencil, n.bilinearFiltering, n.comparisonFunction); - for (var o = 0; o < 6; o++) - n.generateStencil ? r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X + o, 0, r.DEPTH24_STENCIL8, e, e, 0, r.DEPTH_STENCIL, r.UNSIGNED_INT_24_8, null) : r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X + o, 0, r.DEPTH_COMPONENT24, e, e, 0, r.DEPTH_COMPONENT, r.UNSIGNED_INT, null); - return this._bindTextureDirectly(r.TEXTURE_CUBE_MAP, null), - i - } - , - ve.b.prototype._partialLoadFile = function(e, t, i, n, r) { - void 0 === r && (r = null), - this._loadFile(e, function(e) { - i[t] = e, - i._internalCount++, - 6 === i._internalCount && n(i) - }, void 0, void 0, true, function(e, t) { - r && e && r(e.status + " " + e.statusText, t) - }) - } - , - ve.b.prototype._cascadeLoadFiles = function(e, t, i, n) { - void 0 === n && (n = null); - var r = []; - r._internalCount = 0; - for (var o = 0; o < 6; o++) - this._partialLoadFile(i[o], o, r, t, n) - } - , - ve.b.prototype._cascadeLoadImgs = function(e, t, i, n) { - void 0 === n && (n = null); - var r = []; - r._internalCount = 0; - for (var o = 0; o < 6; o++) - this._partialLoadImg(i[o], o, r, e, t, n) - } - , - ve.b.prototype._partialLoadImg = function(e, t, i, n, r, o) { - var a; - void 0 === o && (o = null), - a = Ee.h.LoadImage(e, function() { - i[t] = a, - i._internalCount++, - n && n._removePendingData(a), - 6 === i._internalCount && r(i) - }, function(e, t) { - n && n._removePendingData(a), - o && o(e, t) - }, n ? n.offlineProvider : null), - n && n._addPendingData(a) - } - , - ve.b.prototype.createCubeTexture = function(e, t, i, n, r, o, a, s, c, u, l, h, f) { - var d = this; - void 0 === r && (r = null), + generateStencil: false, + }, + t + ), + r = this._gl; + this._bindTextureDirectly(r.TEXTURE_CUBE_MAP, i, true), + this._setupDepthStencilTexture( + i, + e, + n.generateStencil, + n.bilinearFiltering, + n.comparisonFunction + ); + for (var o = 0; o < 6; o++) + n.generateStencil + ? r.texImage2D( + r.TEXTURE_CUBE_MAP_POSITIVE_X + o, + 0, + r.DEPTH24_STENCIL8, + e, + e, + 0, + r.DEPTH_STENCIL, + r.UNSIGNED_INT_24_8, + null + ) + : r.texImage2D( + r.TEXTURE_CUBE_MAP_POSITIVE_X + o, + 0, + r.DEPTH_COMPONENT24, + e, + e, + 0, + r.DEPTH_COMPONENT, + r.UNSIGNED_INT, + null + ); + return this._bindTextureDirectly(r.TEXTURE_CUBE_MAP, null), i; + }), + (ve.b.prototype._partialLoadFile = function (e, t, i, n, r) { + void 0 === r && (r = null), + this._loadFile( + e, + function (e) { + (i[t] = e), + i._internalCount++, + 6 === i._internalCount && n(i); + }, + void 0, + void 0, + true, + function (e, t) { + r && e && r(e.status + " " + e.statusText, t); + } + ); + }), + (ve.b.prototype._cascadeLoadFiles = function (e, t, i, n) { + void 0 === n && (n = null); + var r = []; + r._internalCount = 0; + for (var o = 0; o < 6; o++) + this._partialLoadFile(i[o], o, r, t, n); + }), + (ve.b.prototype._cascadeLoadImgs = function (e, t, i, n) { + void 0 === n && (n = null); + var r = []; + r._internalCount = 0; + for (var o = 0; o < 6; o++) + this._partialLoadImg(i[o], o, r, e, t, n); + }), + (ve.b.prototype._partialLoadImg = function (e, t, i, n, r, o) { + var a; + void 0 === o && (o = null), + (a = Ee.h.LoadImage( + e, + function () { + (i[t] = a), + i._internalCount++, + n && n._removePendingData(a), + 6 === i._internalCount && r(i); + }, + function (e, t) { + n && n._removePendingData(a), o && o(e, t); + }, + n ? n.offlineProvider : null + )), + n && n._addPendingData(a); + }), + (ve.b.prototype.createCubeTexture = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u, + l, + h, + f + ) { + var d = this; + void 0 === r && (r = null), void 0 === o && (o = null), void 0 === s && (s = null), void 0 === c && (c = false), @@ -69334,250 +92227,493 @@ and limitations under the License. void 0 === l && (l = 0), void 0 === h && (h = null), void 0 === f && (f = []); - var p = this._gl - , m = h || new He.a(this,He.a.DATASOURCE_CUBE); - m.isCube = true, - m.url = e, - m.generateMipMaps = !n, - m._lodGenerationScale = u, - m._lodGenerationOffset = l, - this._doNotHandleContextLost || (m._extension = s, - m._files = i); - for (var _ = e.lastIndexOf("."), v = s || (_ > -1 ? e.substring(_).toLowerCase() : ""), y = null, b = 0, E = ve.b._TextureLoaders; b < E.length; b++) { - var T = E[b]; - if (-1 === f.indexOf(T) && T.canLoad(v, this._textureFormatInUse, h, false, false)) { - y = T; - break - } + var p = this._gl, + m = h || new He.a(this, He.a.DATASOURCE_CUBE); + (m.isCube = true), + (m.url = e), + (m.generateMipMaps = !n), + (m._lodGenerationScale = u), + (m._lodGenerationOffset = l), + this._doNotHandleContextLost || + ((m._extension = s), (m._files = i)); + for ( + var _ = e.lastIndexOf("."), + v = s || (_ > -1 ? e.substring(_).toLowerCase() : ""), + y = null, + b = 0, + E = ve.b._TextureLoaders; + b < E.length; + b++ + ) { + var T = E[b]; + if ( + -1 === f.indexOf(T) && + T.canLoad(v, this._textureFormatInUse, h, false, false) + ) { + y = T; + break; } - if (y) { - e = y.transformUrl(e, this._textureFormatInUse); - var A = function(e) { - d._bindTextureDirectly(p.TEXTURE_CUBE_MAP, m, true), - y.loadCubeData(e, m, c, r, o) - }; - i && 6 === i.length ? y.supportCascades ? this._cascadeLoadFiles(t, A, i, o) : o ? o("Textures type does not support cascades.") : g.a.Warn("Texture loader does not support cascades.") : this._loadFile(e, A, void 0, void 0, true, function(e, s) { + } + if (y) { + e = y.transformUrl(e, this._textureFormatInUse); + var A = function (e) { + d._bindTextureDirectly(p.TEXTURE_CUBE_MAP, m, true), + y.loadCubeData(e, m, c, r, o); + }; + i && 6 === i.length + ? y.supportCascades + ? this._cascadeLoadFiles(t, A, i, o) + : o + ? o("Textures type does not support cascades.") + : g.a.Warn("Texture loader does not support cascades.") + : this._loadFile( + e, + A, + void 0, + void 0, + true, + function (e, s) { if (y) { - var h = y.getFallbackTextureUrl(m.url, d._textureFormatInUse); - if (g.a.Warn(y.constructor.name + " failed when trying to load " + m.url + ", falling back to the next supported loader"), + var h = y.getFallbackTextureUrl( + m.url, + d._textureFormatInUse + ); + if ( + (g.a.Warn( + y.constructor.name + + " failed when trying to load " + + m.url + + ", falling back to the next supported loader" + ), h) - return f.push(y), - void d.createCubeTexture(h, t, i, n, r, o, a, v, c, u, l, m, f) + ) + return ( + f.push(y), + void d.createCubeTexture( + h, + t, + i, + n, + r, + o, + a, + v, + c, + u, + l, + m, + f + ) + ); } - o && e && o(e.status + " " + e.statusText, s) - }) - } else { - if (!i) - throw new Error("Cannot load cubemap because files were not defined"); - this._cascadeLoadImgs(t, function(e) { - var t = d.needPOTTextures ? Ee.h.GetExponentOfTwo(e[0].width, d._caps.maxCubemapTextureSize) : e[0].width - , i = t; - if (d._prepareWorkingCanvas(), - d._workingCanvas && d._workingContext) { - d._workingCanvas.width = t, - d._workingCanvas.height = i; - var o = [p.TEXTURE_CUBE_MAP_POSITIVE_X, p.TEXTURE_CUBE_MAP_POSITIVE_Y, p.TEXTURE_CUBE_MAP_POSITIVE_Z, p.TEXTURE_CUBE_MAP_NEGATIVE_X, p.TEXTURE_CUBE_MAP_NEGATIVE_Y, p.TEXTURE_CUBE_MAP_NEGATIVE_Z]; - d._bindTextureDirectly(p.TEXTURE_CUBE_MAP, m, true), - d._unpackFlipY(false); - for (var s = a ? d._getInternalFormat(a) : d._gl.RGBA, c = 0; c < o.length; c++) - e[c].width !== t || e[c].height !== i ? (d._workingContext.drawImage(e[c], 0, 0, e[c].width, e[c].height, 0, 0, t, i), - p.texImage2D(o[c], 0, s, s, p.UNSIGNED_BYTE, d._workingCanvas)) : p.texImage2D(o[c], 0, s, s, p.UNSIGNED_BYTE, e[c]); - n || p.generateMipmap(p.TEXTURE_CUBE_MAP), - d._setCubeMapTextureParams(!n), - m.width = t, - m.height = i, - m.isReady = true, - a && (m.format = a), - m.onLoadedObservable.notifyObservers(m), - m.onLoadedObservable.clear(), - r && r() - } - }, i, o) - } - return this._internalTexturesCache.push(m), - m - } - ; - var Xn = function(e) { - function t(t, i, n, r, o, s, c, u, l, h, f, d, p) { - void 0 === n && (n = null), - void 0 === r && (r = false), - void 0 === o && (o = null), - void 0 === s && (s = null), - void 0 === c && (c = null), - void 0 === u && (u = _.a.TEXTUREFORMAT_RGBA), - void 0 === l && (l = false), - void 0 === h && (h = null), - void 0 === f && (f = false), - void 0 === d && (d = .8), - void 0 === p && (p = 0); - var m = e.call(this, i) || this; - if (m.boundingBoxPosition = a.x.Zero(), - m._rotationY = 0, - m._prefiltered = false, - m.name = t, - m.url = t, - m._noMipmap = r, - m.hasAlpha = false, - m._format = u, - m.isCube = true, - m._textureMatrix = a.j.Identity(), - m._createPolynomials = f, - m.coordinatesMode = je.a.CUBIC_MODE, - !t && !o) - return m; - var g = t.lastIndexOf(".") - , v = h || (g > -1 ? t.substring(g).toLowerCase() : "") - , y = ".dds" === v - , b = ".env" === v; - if (b ? (m.gammaSpace = false, - m._prefiltered = false) : (m._prefiltered = l, - l && (m.gammaSpace = false)), - m._texture = m._getFromCache(t, r), - !o && (b || y || n || (n = ["_px.jpg", "_py.jpg", "_pz.jpg", "_nx.jpg", "_ny.jpg", "_nz.jpg"]), - o = [], - n)) - for (var E = 0; E < n.length; E++) - o.push(t + n[E]); - return m._files = o, - m._texture ? s && (m._texture.isReady ? Ee.h.SetImmediate(function() { - return s() - }) : m._texture.onLoadedObservable.add(s)) : i.useDelayedTextureLoading ? m.delayLoadState = _.a.DELAYLOADSTATE_NOTLOADED : m._texture = l ? i.getEngine().createPrefilteredCubeTexture(t, i, d, p, s, c, u, h, m._createPolynomials) : i.getEngine().createCubeTexture(t, i, o, r, s, c, m._format, h, false, d, p), - m - } - return h.d(t, e), - Object.defineProperty(t.prototype, "boundingBoxSize", { - get: function() { - return this._boundingBoxSize - }, - set: function(e) { - if (!this._boundingBoxSize || !this._boundingBoxSize.equals(e)) { - this._boundingBoxSize = e; - var t = this.getScene(); - t && t.markAllMaterialsAsDirty(_.a.MATERIAL_TextureDirtyFlag) - } - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "rotationY", { - get: function() { - return this._rotationY - }, - set: function(e) { - this._rotationY = e, - this.setReflectionTextureMatrix(a.j.RotationY(this._rotationY)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "noMipmap", { - get: function() { - return this._noMipmap - }, - enumerable: true, - configurable: true - }), - t.CreateFromImages = function(e, i, n) { - var r = ""; - return e.forEach(function(e) { - return r += e - }), - new t(r,i,null,n,e) - } - , - t.CreateFromPrefilteredData = function(e, i, n, r) { - return void 0 === n && (n = null), - void 0 === r && (r = true), - new t(e,i,null,false,null,null,null,void 0,true,n,r) - } - , - Object.defineProperty(t.prototype, "isPrefiltered", { - get: function() { - return this._prefiltered - }, - enumerable: true, - configurable: true - }), - t.prototype.getClassName = function() { - return "CubeTexture" - } - , - t.prototype.updateURL = function(e, t, i) { - this.url && (this.releaseInternalTexture(), - this.getScene().markAllMaterialsAsDirty(_.a.MATERIAL_TextureDirtyFlag)), - this.url = e, - this.delayLoadState = _.a.DELAYLOADSTATE_NOTLOADED, - this._prefiltered = false, - i && (this._delayedOnLoad = i), - this.delayLoad(t) - } - , - t.prototype.delayLoad = function(e) { - if (this.delayLoadState === _.a.DELAYLOADSTATE_NOTLOADED) { - var t = this.getScene(); - t && (this.delayLoadState = _.a.DELAYLOADSTATE_LOADED, - this._texture = this._getFromCache(this.url, this._noMipmap), - this._texture || (this._prefiltered ? this._texture = t.getEngine().createPrefilteredCubeTexture(this.url, t, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, void 0, this._format, void 0, this._createPolynomials) : this._texture = t.getEngine().createCubeTexture(this.url, t, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, e))) + o && e && o(e.status + " " + e.statusText, s); + } + ); + } else { + if (!i) + throw new Error( + "Cannot load cubemap because files were not defined" + ); + this._cascadeLoadImgs( + t, + function (e) { + var t = d.needPOTTextures + ? Ee.h.GetExponentOfTwo( + e[0].width, + d._caps.maxCubemapTextureSize + ) + : e[0].width, + i = t; + if ( + (d._prepareWorkingCanvas(), + d._workingCanvas && d._workingContext) + ) { + (d._workingCanvas.width = t), + (d._workingCanvas.height = i); + var o = [ + p.TEXTURE_CUBE_MAP_POSITIVE_X, + p.TEXTURE_CUBE_MAP_POSITIVE_Y, + p.TEXTURE_CUBE_MAP_POSITIVE_Z, + p.TEXTURE_CUBE_MAP_NEGATIVE_X, + p.TEXTURE_CUBE_MAP_NEGATIVE_Y, + p.TEXTURE_CUBE_MAP_NEGATIVE_Z, + ]; + d._bindTextureDirectly(p.TEXTURE_CUBE_MAP, m, true), + d._unpackFlipY(false); + for ( + var s = a ? d._getInternalFormat(a) : d._gl.RGBA, + c = 0; + c < o.length; + c++ + ) + e[c].width !== t || e[c].height !== i + ? (d._workingContext.drawImage( + e[c], + 0, + 0, + e[c].width, + e[c].height, + 0, + 0, + t, + i + ), + p.texImage2D( + o[c], + 0, + s, + s, + p.UNSIGNED_BYTE, + d._workingCanvas + )) + : p.texImage2D( + o[c], + 0, + s, + s, + p.UNSIGNED_BYTE, + e[c] + ); + n || p.generateMipmap(p.TEXTURE_CUBE_MAP), + d._setCubeMapTextureParams(!n), + (m.width = t), + (m.height = i), + (m.isReady = true), + a && (m.format = a), + m.onLoadedObservable.notifyObservers(m), + m.onLoadedObservable.clear(), + r && r(); } - } - , - t.prototype.getReflectionTextureMatrix = function() { - return this._textureMatrix - } - , - t.prototype.setReflectionTextureMatrix = function(e) { - var t = this; - e.updateFlag !== this._textureMatrix.updateFlag && (e.isIdentity() !== this._textureMatrix.isIdentity() && this.getScene().markAllMaterialsAsDirty(_.a.MATERIAL_TextureDirtyFlag, function(e) { - return -1 !== e.getActiveTextures().indexOf(t) - }), - this._textureMatrix = e) - } - , - t.Parse = function(e, i, n) { - var r = F.a.Parse(function() { - var r = false; - return e.prefiltered && (r = e.prefiltered), - new t(n + e.name,i,e.extensions,false,null,null,null,void 0,r) - }, e, i); - if (e.boundingBoxPosition && (r.boundingBoxPosition = a.x.FromArray(e.boundingBoxPosition)), - e.boundingBoxSize && (r.boundingBoxSize = a.x.FromArray(e.boundingBoxSize)), - e.animations) - for (var o = 0; o < e.animations.length; o++) { - var c = e.animations[o] - , u = s.a.GetClass("BABYLON.Animation"); - u && r.animations.push(u.Parse(c)) - } - return r - } - , - t.prototype.clone = function() { - var e = this - , i = this.getScene() - , n = 0 - , r = F.a.Clone(function() { - if (!i) - return e; - var r = new t(e.url,i,e._extensions,e._noMipmap,e._files); - return n = r.uniqueId, - r - }, this); - return r.uniqueId = n, + }, + i, + o + ); + } + return this._internalTexturesCache.push(m), m; + }); + var Xn = (function (e) { + function t(t, i, n, r, o, s, c, u, l, h, f, d, p) { + void 0 === n && (n = null), + void 0 === r && (r = false), + void 0 === o && (o = null), + void 0 === s && (s = null), + void 0 === c && (c = null), + void 0 === u && (u = _.a.TEXTUREFORMAT_RGBA), + void 0 === l && (l = false), + void 0 === h && (h = null), + void 0 === f && (f = false), + void 0 === d && (d = 0.8), + void 0 === p && (p = 0); + var m = e.call(this, i) || this; + if ( + ((m.boundingBoxPosition = a.x.Zero()), + (m._rotationY = 0), + (m._prefiltered = false), + (m.name = t), + (m.url = t), + (m._noMipmap = r), + (m.hasAlpha = false), + (m._format = u), + (m.isCube = true), + (m._textureMatrix = a.j.Identity()), + (m._createPolynomials = f), + (m.coordinatesMode = je.a.CUBIC_MODE), + !t && !o) + ) + return m; + var g = t.lastIndexOf("."), + v = h || (g > -1 ? t.substring(g).toLowerCase() : ""), + y = ".dds" === v, + b = ".env" === v; + if ( + (b + ? ((m.gammaSpace = false), (m._prefiltered = false)) + : ((m._prefiltered = l), l && (m.gammaSpace = false)), + (m._texture = m._getFromCache(t, r)), + !o && + (b || + y || + n || + (n = [ + "_px.jpg", + "_py.jpg", + "_pz.jpg", + "_nx.jpg", + "_ny.jpg", + "_nz.jpg", + ]), + (o = []), + n)) + ) + for (var E = 0; E < n.length; E++) o.push(t + n[E]); + return ( + (m._files = o), + m._texture + ? s && + (m._texture.isReady + ? Ee.h.SetImmediate(function () { + return s(); + }) + : m._texture.onLoadedObservable.add(s)) + : i.useDelayedTextureLoading + ? (m.delayLoadState = _.a.DELAYLOADSTATE_NOTLOADED) + : (m._texture = l + ? i + .getEngine() + .createPrefilteredCubeTexture( + t, + i, + d, + p, + s, + c, + u, + h, + m._createPolynomials + ) + : i + .getEngine() + .createCubeTexture( + t, + i, + o, + r, + s, + c, + m._format, + h, + false, + d, + p + )), + m + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "boundingBoxSize", { + get: function () { + return this._boundingBoxSize; + }, + set: function (e) { + if ( + !this._boundingBoxSize || + !this._boundingBoxSize.equals(e) + ) { + this._boundingBoxSize = e; + var t = this.getScene(); + t && + t.markAllMaterialsAsDirty( + _.a.MATERIAL_TextureDirtyFlag + ); + } + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "rotationY", { + get: function () { + return this._rotationY; + }, + set: function (e) { + (this._rotationY = e), + this.setReflectionTextureMatrix( + a.j.RotationY(this._rotationY) + ); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "noMipmap", { + get: function () { + return this._noMipmap; + }, + enumerable: true, + configurable: true, + }), + (t.CreateFromImages = function (e, i, n) { + var r = ""; + return ( + e.forEach(function (e) { + return (r += e); + }), + new t(r, i, null, n, e) + ); + }), + (t.CreateFromPrefilteredData = function (e, i, n, r) { + return ( + void 0 === n && (n = null), + void 0 === r && (r = true), + new t( + e, + i, + null, + false, + null, + null, + null, + void 0, + true, + n, r + ) + ); + }), + Object.defineProperty(t.prototype, "isPrefiltered", { + get: function () { + return this._prefiltered; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "CubeTexture"; + }), + (t.prototype.updateURL = function (e, t, i) { + this.url && + (this.releaseInternalTexture(), + this.getScene().markAllMaterialsAsDirty( + _.a.MATERIAL_TextureDirtyFlag + )), + (this.url = e), + (this.delayLoadState = _.a.DELAYLOADSTATE_NOTLOADED), + (this._prefiltered = false), + i && (this._delayedOnLoad = i), + this.delayLoad(t); + }), + (t.prototype.delayLoad = function (e) { + if (this.delayLoadState === _.a.DELAYLOADSTATE_NOTLOADED) { + var t = this.getScene(); + t && + ((this.delayLoadState = _.a.DELAYLOADSTATE_LOADED), + (this._texture = this._getFromCache( + this.url, + this._noMipmap + )), + this._texture || + (this._prefiltered + ? (this._texture = t + .getEngine() + .createPrefilteredCubeTexture( + this.url, + t, + this.lodGenerationScale, + this.lodGenerationOffset, + this._delayedOnLoad, + void 0, + this._format, + void 0, + this._createPolynomials + )) + : (this._texture = t + .getEngine() + .createCubeTexture( + this.url, + t, + this._files, + this._noMipmap, + this._delayedOnLoad, + null, + this._format, + e + )))); } - , - h.c([Object(F.c)("rotationY")], t.prototype, "rotationY", null), - h.c([Object(F.j)("textureMatrix")], t.prototype, "_textureMatrix", void 0), - t - }(jn.a); - je.a._CubeTextureParser = Xn.Parse, - s.a.RegisteredTypes["BABYLON.CubeTexture"] = Xn; - var Yn = n(15) - , Kn = n(64) - , Qn = n(75) - , qn = n(18); - Ht.a.IncludesShadersStore.backgroundFragmentDeclaration = " uniform vec4 vPrimaryColor;\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nuniform vec4 vPrimaryColorShadow;\n#endif\nuniform float shadowLevel;\nuniform float alpha;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#endif\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif"; - Ht.a.IncludesShadersStore.backgroundUboDeclaration = "layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec4 vPrimaryColor;\nuniform vec4 vPrimaryColorShadow;\nuniform vec2 vDiffuseInfos;\nuniform vec2 vReflectionInfos;\nuniform mat4 diffuseMatrix;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\nuniform float pointSize;\nuniform float shadowLevel;\nuniform float alpha;\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};", + }), + (t.prototype.getReflectionTextureMatrix = function () { + return this._textureMatrix; + }), + (t.prototype.setReflectionTextureMatrix = function (e) { + var t = this; + e.updateFlag !== this._textureMatrix.updateFlag && + (e.isIdentity() !== this._textureMatrix.isIdentity() && + this.getScene().markAllMaterialsAsDirty( + _.a.MATERIAL_TextureDirtyFlag, + function (e) { + return -1 !== e.getActiveTextures().indexOf(t); + } + ), + (this._textureMatrix = e)); + }), + (t.Parse = function (e, i, n) { + var r = F.a.Parse( + function () { + var r = false; + return ( + e.prefiltered && (r = e.prefiltered), + new t( + n + e.name, + i, + e.extensions, + false, + null, + null, + null, + void 0, + r + ) + ); + }, + e, + i + ); + if ( + (e.boundingBoxPosition && + (r.boundingBoxPosition = a.x.FromArray( + e.boundingBoxPosition + )), + e.boundingBoxSize && + (r.boundingBoxSize = a.x.FromArray(e.boundingBoxSize)), + e.animations) + ) + for (var o = 0; o < e.animations.length; o++) { + var c = e.animations[o], + u = s.a.GetClass("BABYLON.Animation"); + u && r.animations.push(u.Parse(c)); + } + return r; + }), + (t.prototype.clone = function () { + var e = this, + i = this.getScene(), + n = 0, + r = F.a.Clone(function () { + if (!i) return e; + var r = new t( + e.url, + i, + e._extensions, + e._noMipmap, + e._files + ); + return (n = r.uniqueId), r; + }, this); + return (r.uniqueId = n), r; + }), + h.c( + [Object(F.c)("rotationY")], + t.prototype, + "rotationY", + null + ), + h.c( + [Object(F.j)("textureMatrix")], + t.prototype, + "_textureMatrix", + void 0 + ), + t + ); + })(jn.a); + (je.a._CubeTextureParser = Xn.Parse), + (s.a.RegisteredTypes["BABYLON.CubeTexture"] = Xn); + var Yn = n(15), + Kn = n(64), + Qn = n(75), + qn = n(18); + Ht.a.IncludesShadersStore.backgroundFragmentDeclaration = + " uniform vec4 vPrimaryColor;\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nuniform vec4 vPrimaryColorShadow;\n#endif\nuniform float shadowLevel;\nuniform float alpha;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#endif\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif"; + (Ht.a.IncludesShadersStore.backgroundUboDeclaration = + "layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec4 vPrimaryColor;\nuniform vec4 vPrimaryColorShadow;\nuniform vec2 vDiffuseInfos;\nuniform vec2 vReflectionInfos;\nuniform mat4 diffuseMatrix;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\nuniform float pointSize;\nuniform float shadowLevel;\nuniform float alpha;\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};"), n(113), n(84), n(85), @@ -69588,8 +92724,10 @@ and limitations under the License. n(89), n(114), n(99); - Ht.a.ShadersStore.backgroundPixelShader = "#ifdef TEXTURELODSUPPORT\n#extension GL_EXT_shader_texture_lod : enable\n#endif\nprecision highp float;\n#include<__decl__backgroundFragment>\n#define RECIPROCAL_PI2 0.15915494\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n\n#ifndef SHADOWONLY\n#define SHADOWONLY;\n#endif\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n#include\n#include\n\n#include\n#ifdef REFLECTIONFRESNEL\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\nvec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(0.0,1.0,0.0);\n#endif\n\nfloat shadow=1.;\nfloat globalShadow=0.;\nfloat shadowLightCount=0.;\n#include[0..maxSimultaneousLights]\n#ifdef SHADOWINUSE\nglobalShadow/=shadowLightCount;\n#else\nglobalShadow=1.0;\n#endif\n\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\n#ifdef REFLECTION\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=reflectionVector;\n#else\nvec2 reflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n#ifdef REFLECTIONBLUR\nfloat reflectionLOD=vReflectionInfos.y;\n#ifdef TEXTURELODSUPPORT\n\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD);\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\nif(lodReflectionNormalizedDoubled<1.0){\nreflectionColor=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nreflectionSpecularMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nreflectionColor=mix(\nreflectionSpecularMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#else\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\nreflectionColor=reflectionSample;\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef GAMMAREFLECTION\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\n#endif\n#ifdef REFLECTIONBGR\nreflectionColor.rgb=reflectionColor.bgr;\n#endif\n\nreflectionColor.rgb*=vReflectionInfos.x;\n#endif\n\nvec3 diffuseColor=vec3(1.,1.,1.);\nfloat finalAlpha=alpha;\n#ifdef DIFFUSE\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef GAMMADIFFUSE\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\n#endif\n\ndiffuseMap.rgb*=vDiffuseInfos.y;\n#ifdef DIFFUSEHASALPHA\nfinalAlpha*=diffuseMap.a;\n#endif\ndiffuseColor=diffuseMap.rgb;\n#endif\n\n#ifdef REFLECTIONFRESNEL\nvec3 colorBase=diffuseColor;\n#else\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\n#endif\ncolorBase=max(colorBase,0.0);\n\n#ifdef USERGBCOLOR\nvec3 finalColor=colorBase;\n#else\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\n#else\nvec3 mainColor=vPrimaryColor.rgb;\n#endif\nvec3 finalColor=colorBase*mainColor;\n#endif\n\n#ifdef REFLECTIONFRESNEL\nvec3 reflectionAmount=vReflectionControl.xxx;\nvec3 reflectionReflectance0=vReflectionControl.yyy;\nvec3 reflectionReflectance90=vReflectionControl.zzz;\nfloat VdotN=dot(normalize(vEyePosition),normalW);\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);\nreflectionAmount*=planarReflectionFresnel;\n#ifdef REFLECTIONFALLOFF\nfloat reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\nreflectionAmount*=reflectionDistanceFalloff;\n#endif\nfinalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));\n#endif\n#ifdef OPACITYFRESNEL\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition-vBackgroundCenter));\n\nconst float startAngle=0.1;\nfloat fadeFactor=saturate(viewAngleToFloor/startAngle);\nfinalAlpha*=fadeFactor*fadeFactor;\n#endif\n\n#ifdef SHADOWINUSE\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\n#endif\n\nvec4 color=vec4(finalColor,finalAlpha);\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n\n\ncolor.rgb=clamp(color.rgb,0.,30.0);\n#else\n\ncolor=applyImageProcessing(color);\n#endif\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#ifdef NOISE\ncolor.rgb+=dither(vPositionW.xy,0.5);\ncolor=max(color,0.0);\n#endif\ngl_FragColor=color;\n}\n"; - Ht.a.IncludesShadersStore.backgroundVertexDeclaration = "uniform mat4 view;\nuniform mat4 viewProjection;\nuniform float shadowLevel;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif", + Ht.a.ShadersStore.backgroundPixelShader = + "#ifdef TEXTURELODSUPPORT\n#extension GL_EXT_shader_texture_lod : enable\n#endif\nprecision highp float;\n#include<__decl__backgroundFragment>\n#define RECIPROCAL_PI2 0.15915494\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n\n#ifndef SHADOWONLY\n#define SHADOWONLY;\n#endif\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n#include\n#include\n\n#include\n#ifdef REFLECTIONFRESNEL\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\nvec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(0.0,1.0,0.0);\n#endif\n\nfloat shadow=1.;\nfloat globalShadow=0.;\nfloat shadowLightCount=0.;\n#include[0..maxSimultaneousLights]\n#ifdef SHADOWINUSE\nglobalShadow/=shadowLightCount;\n#else\nglobalShadow=1.0;\n#endif\n\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\n#ifdef REFLECTION\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=reflectionVector;\n#else\nvec2 reflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n#ifdef REFLECTIONBLUR\nfloat reflectionLOD=vReflectionInfos.y;\n#ifdef TEXTURELODSUPPORT\n\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD);\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\nif(lodReflectionNormalizedDoubled<1.0){\nreflectionColor=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nreflectionSpecularMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nreflectionColor=mix(\nreflectionSpecularMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#else\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\nreflectionColor=reflectionSample;\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef GAMMAREFLECTION\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\n#endif\n#ifdef REFLECTIONBGR\nreflectionColor.rgb=reflectionColor.bgr;\n#endif\n\nreflectionColor.rgb*=vReflectionInfos.x;\n#endif\n\nvec3 diffuseColor=vec3(1.,1.,1.);\nfloat finalAlpha=alpha;\n#ifdef DIFFUSE\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef GAMMADIFFUSE\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\n#endif\n\ndiffuseMap.rgb*=vDiffuseInfos.y;\n#ifdef DIFFUSEHASALPHA\nfinalAlpha*=diffuseMap.a;\n#endif\ndiffuseColor=diffuseMap.rgb;\n#endif\n\n#ifdef REFLECTIONFRESNEL\nvec3 colorBase=diffuseColor;\n#else\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\n#endif\ncolorBase=max(colorBase,0.0);\n\n#ifdef USERGBCOLOR\nvec3 finalColor=colorBase;\n#else\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\n#else\nvec3 mainColor=vPrimaryColor.rgb;\n#endif\nvec3 finalColor=colorBase*mainColor;\n#endif\n\n#ifdef REFLECTIONFRESNEL\nvec3 reflectionAmount=vReflectionControl.xxx;\nvec3 reflectionReflectance0=vReflectionControl.yyy;\nvec3 reflectionReflectance90=vReflectionControl.zzz;\nfloat VdotN=dot(normalize(vEyePosition),normalW);\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);\nreflectionAmount*=planarReflectionFresnel;\n#ifdef REFLECTIONFALLOFF\nfloat reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\nreflectionAmount*=reflectionDistanceFalloff;\n#endif\nfinalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));\n#endif\n#ifdef OPACITYFRESNEL\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition-vBackgroundCenter));\n\nconst float startAngle=0.1;\nfloat fadeFactor=saturate(viewAngleToFloor/startAngle);\nfinalAlpha*=fadeFactor*fadeFactor;\n#endif\n\n#ifdef SHADOWINUSE\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\n#endif\n\nvec4 color=vec4(finalColor,finalAlpha);\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n\n\ncolor.rgb=clamp(color.rgb,0.,30.0);\n#else\n\ncolor=applyImageProcessing(color);\n#endif\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#ifdef NOISE\ncolor.rgb+=dither(vPositionW.xy,0.5);\ncolor=max(color,0.0);\n#endif\ngl_FragColor=color;\n}\n"; + (Ht.a.IncludesShadersStore.backgroundVertexDeclaration = + "uniform mat4 view;\nuniform mat4 viewProjection;\nuniform float shadowLevel;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif"), n(67), n(68), n(96), @@ -69599,1167 +92737,2022 @@ and limitations under the License. n(90), n(116), n(117); - Ht.a.ShadersStore.backgroundVertexShader = "precision highp float;\n#include<__decl__backgroundVertex>\n#include\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n\n#include\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\nvoid main(void) {\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(position,1.0)).xyz;\n#else\nvPositionUVW=position;\n#endif\n#endif\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(position,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#endif\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normal);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\nif (fFovMultiplier<=1.0) {\nvDirectionW=normalize(segment);\n} else {\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\n}\n#endif\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n"; - var Zn = function(e) { - function t() { - var t = e.call(this) || this; - return t.DIFFUSE = false, - t.DIFFUSEDIRECTUV = 0, - t.GAMMADIFFUSE = false, - t.DIFFUSEHASALPHA = false, - t.OPACITYFRESNEL = false, - t.REFLECTIONBLUR = false, - t.REFLECTIONFRESNEL = false, - t.REFLECTIONFALLOFF = false, - t.TEXTURELODSUPPORT = false, - t.PREMULTIPLYALPHA = false, - t.USERGBCOLOR = false, - t.USEHIGHLIGHTANDSHADOWCOLORS = false, - t.NOISE = false, - t.REFLECTIONBGR = false, - t.IMAGEPROCESSING = false, - t.VIGNETTE = false, - t.VIGNETTEBLENDMODEMULTIPLY = false, - t.VIGNETTEBLENDMODEOPAQUE = false, - t.TONEMAPPING = false, - t.TONEMAPPING_ACES = false, - t.CONTRAST = false, - t.COLORCURVES = false, - t.COLORGRADING = false, - t.COLORGRADING3D = false, - t.SAMPLER3DGREENDEPTH = false, - t.SAMPLER3DBGRMAP = false, - t.IMAGEPROCESSINGPOSTPROCESS = false, - t.EXPOSURE = false, - t.MULTIVIEW = false, - t.REFLECTION = false, - t.REFLECTIONMAP_3D = false, - t.REFLECTIONMAP_SPHERICAL = false, - t.REFLECTIONMAP_PLANAR = false, - t.REFLECTIONMAP_CUBIC = false, - t.REFLECTIONMAP_PROJECTION = false, - t.REFLECTIONMAP_SKYBOX = false, - t.REFLECTIONMAP_SKYBOX_TRANSFORMED = false, - t.REFLECTIONMAP_EXPLICIT = false, - t.REFLECTIONMAP_EQUIRECTANGULAR = false, - t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false, - t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false, - t.INVERTCUBICMAP = false, - t.REFLECTIONMAP_OPPOSITEZ = false, - t.LODINREFLECTIONALPHA = false, - t.GAMMAREFLECTION = false, - t.RGBDREFLECTION = false, - t.EQUIRECTANGULAR_RELFECTION_FOV = false, - t.MAINUV1 = false, - t.MAINUV2 = false, - t.UV1 = false, - t.UV2 = false, - t.CLIPPLANE = false, - t.CLIPPLANE2 = false, - t.CLIPPLANE3 = false, - t.CLIPPLANE4 = false, - t.POINTSIZE = false, - t.FOG = false, - t.NORMAL = false, - t.NUM_BONE_INFLUENCERS = 0, - t.BonesPerMesh = 0, - t.INSTANCES = false, - t.SHADOWFLOAT = false, - t.rebuild(), - t - } - return h.d(t, e), - t - }(Kn.a) - , Jn = function(e) { - function t(t, i) { - var n = e.call(this, t, i) || this; - return n.primaryColor = a.e.White(), - n._primaryColorShadowLevel = 0, - n._primaryColorHighlightLevel = 0, - n.reflectionTexture = null, - n.reflectionBlur = 0, - n.diffuseTexture = null, - n._shadowLights = null, - n.shadowLights = null, - n.shadowLevel = 0, - n.sceneCenter = a.x.Zero(), - n.opacityFresnel = true, - n.reflectionFresnel = false, - n.reflectionFalloffDistance = 0, - n.reflectionAmount = 1, - n.reflectionReflectance0 = .05, - n.reflectionReflectance90 = .5, - n.useRGBColor = true, - n.enableNoise = false, - n._fovMultiplier = 1, - n.useEquirectangularFOV = false, - n._maxSimultaneousLights = 4, - n.maxSimultaneousLights = 4, - n._imageProcessingObserver = null, - n.switchToBGR = false, - n._renderTargets = new jt.a(16), - n._reflectionControls = a.y.Zero(), - n._white = a.e.White(), - n._primaryShadowColor = a.e.Black(), - n._primaryHighlightColor = a.e.Black(), - n._attachImageProcessingConfiguration(null), - n.getRenderTargetTextures = function() { - return n._renderTargets.reset(), - n._diffuseTexture && n._diffuseTexture.isRenderTarget && n._renderTargets.push(n._diffuseTexture), - n._reflectionTexture && n._reflectionTexture.isRenderTarget && n._renderTargets.push(n._reflectionTexture), - n._renderTargets - } - , - n - } - return h.d(t, e), + Ht.a.ShadersStore.backgroundVertexShader = + "precision highp float;\n#include<__decl__backgroundVertex>\n#include\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n\n#include\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\nvoid main(void) {\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(position,1.0)).xyz;\n#else\nvPositionUVW=position;\n#endif\n#endif\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(position,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#endif\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normal);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\nif (fFovMultiplier<=1.0) {\nvDirectionW=normalize(segment);\n} else {\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\n}\n#endif\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n"; + var Zn = (function (e) { + function t() { + var t = e.call(this) || this; + return ( + (t.DIFFUSE = false), + (t.DIFFUSEDIRECTUV = 0), + (t.GAMMADIFFUSE = false), + (t.DIFFUSEHASALPHA = false), + (t.OPACITYFRESNEL = false), + (t.REFLECTIONBLUR = false), + (t.REFLECTIONFRESNEL = false), + (t.REFLECTIONFALLOFF = false), + (t.TEXTURELODSUPPORT = false), + (t.PREMULTIPLYALPHA = false), + (t.USERGBCOLOR = false), + (t.USEHIGHLIGHTANDSHADOWCOLORS = false), + (t.NOISE = false), + (t.REFLECTIONBGR = false), + (t.IMAGEPROCESSING = false), + (t.VIGNETTE = false), + (t.VIGNETTEBLENDMODEMULTIPLY = false), + (t.VIGNETTEBLENDMODEOPAQUE = false), + (t.TONEMAPPING = false), + (t.TONEMAPPING_ACES = false), + (t.CONTRAST = false), + (t.COLORCURVES = false), + (t.COLORGRADING = false), + (t.COLORGRADING3D = false), + (t.SAMPLER3DGREENDEPTH = false), + (t.SAMPLER3DBGRMAP = false), + (t.IMAGEPROCESSINGPOSTPROCESS = false), + (t.EXPOSURE = false), + (t.MULTIVIEW = false), + (t.REFLECTION = false), + (t.REFLECTIONMAP_3D = false), + (t.REFLECTIONMAP_SPHERICAL = false), + (t.REFLECTIONMAP_PLANAR = false), + (t.REFLECTIONMAP_CUBIC = false), + (t.REFLECTIONMAP_PROJECTION = false), + (t.REFLECTIONMAP_SKYBOX = false), + (t.REFLECTIONMAP_SKYBOX_TRANSFORMED = false), + (t.REFLECTIONMAP_EXPLICIT = false), + (t.REFLECTIONMAP_EQUIRECTANGULAR = false), + (t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false), + (t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false), + (t.INVERTCUBICMAP = false), + (t.REFLECTIONMAP_OPPOSITEZ = false), + (t.LODINREFLECTIONALPHA = false), + (t.GAMMAREFLECTION = false), + (t.RGBDREFLECTION = false), + (t.EQUIRECTANGULAR_RELFECTION_FOV = false), + (t.MAINUV1 = false), + (t.MAINUV2 = false), + (t.UV1 = false), + (t.UV2 = false), + (t.CLIPPLANE = false), + (t.CLIPPLANE2 = false), + (t.CLIPPLANE3 = false), + (t.CLIPPLANE4 = false), + (t.POINTSIZE = false), + (t.FOG = false), + (t.NORMAL = false), + (t.NUM_BONE_INFLUENCERS = 0), + (t.BonesPerMesh = 0), + (t.INSTANCES = false), + (t.SHADOWFLOAT = false), + t.rebuild(), + t + ); + } + return h.d(t, e), t; + })(Kn.a), + Jn = (function (e) { + function t(t, i) { + var n = e.call(this, t, i) || this; + return ( + (n.primaryColor = a.e.White()), + (n._primaryColorShadowLevel = 0), + (n._primaryColorHighlightLevel = 0), + (n.reflectionTexture = null), + (n.reflectionBlur = 0), + (n.diffuseTexture = null), + (n._shadowLights = null), + (n.shadowLights = null), + (n.shadowLevel = 0), + (n.sceneCenter = a.x.Zero()), + (n.opacityFresnel = true), + (n.reflectionFresnel = false), + (n.reflectionFalloffDistance = 0), + (n.reflectionAmount = 1), + (n.reflectionReflectance0 = 0.05), + (n.reflectionReflectance90 = 0.5), + (n.useRGBColor = true), + (n.enableNoise = false), + (n._fovMultiplier = 1), + (n.useEquirectangularFOV = false), + (n._maxSimultaneousLights = 4), + (n.maxSimultaneousLights = 4), + (n._imageProcessingObserver = null), + (n.switchToBGR = false), + (n._renderTargets = new jt.a(16)), + (n._reflectionControls = a.y.Zero()), + (n._white = a.e.White()), + (n._primaryShadowColor = a.e.Black()), + (n._primaryHighlightColor = a.e.Black()), + n._attachImageProcessingConfiguration(null), + (n.getRenderTargetTextures = function () { + return ( + n._renderTargets.reset(), + n._diffuseTexture && + n._diffuseTexture.isRenderTarget && + n._renderTargets.push(n._diffuseTexture), + n._reflectionTexture && + n._reflectionTexture.isRenderTarget && + n._renderTargets.push(n._reflectionTexture), + n._renderTargets + ); + }), + n + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "_perceptualColor", { - get: function() { - return this.__perceptualColor - }, - set: function(e) { - this.__perceptualColor = e, - this._computePrimaryColorFromPerceptualColor(), - this._markAllSubMeshesAsLightsDirty() - }, - enumerable: true, - configurable: true + get: function () { + return this.__perceptualColor; + }, + set: function (e) { + (this.__perceptualColor = e), + this._computePrimaryColorFromPerceptualColor(), + this._markAllSubMeshesAsLightsDirty(); + }, + enumerable: true, + configurable: true, }), - Object.defineProperty(t.prototype, "primaryColorShadowLevel", { - get: function() { - return this._primaryColorShadowLevel + Object.defineProperty( + t.prototype, + "primaryColorShadowLevel", + { + get: function () { + return this._primaryColorShadowLevel; }, - set: function(e) { - this._primaryColorShadowLevel = e, + set: function (e) { + (this._primaryColorShadowLevel = e), this._computePrimaryColors(), - this._markAllSubMeshesAsLightsDirty() + this._markAllSubMeshesAsLightsDirty(); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "primaryColorHighlightLevel", { - get: function() { - return this._primaryColorHighlightLevel + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "primaryColorHighlightLevel", + { + get: function () { + return this._primaryColorHighlightLevel; }, - set: function(e) { - this._primaryColorHighlightLevel = e, + set: function (e) { + (this._primaryColorHighlightLevel = e), this._computePrimaryColors(), - this._markAllSubMeshesAsLightsDirty() + this._markAllSubMeshesAsLightsDirty(); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "reflectionStandardFresnelWeight", { - set: function(e) { - var i = e; - i < .5 ? (i *= 2, - this.reflectionReflectance0 = t.StandardReflectance0 * i, - this.reflectionReflectance90 = t.StandardReflectance90 * i) : (i = 2 * i - 1, - this.reflectionReflectance0 = t.StandardReflectance0 + (1 - t.StandardReflectance0) * i, - this.reflectionReflectance90 = t.StandardReflectance90 + (1 - t.StandardReflectance90) * i) + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "reflectionStandardFresnelWeight", + { + set: function (e) { + var i = e; + i < 0.5 + ? ((i *= 2), + (this.reflectionReflectance0 = + t.StandardReflectance0 * i), + (this.reflectionReflectance90 = + t.StandardReflectance90 * i)) + : ((i = 2 * i - 1), + (this.reflectionReflectance0 = + t.StandardReflectance0 + + (1 - t.StandardReflectance0) * i), + (this.reflectionReflectance90 = + t.StandardReflectance90 + + (1 - t.StandardReflectance90) * i)); }, enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "fovMultiplier", { - get: function() { - return this._fovMultiplier - }, - set: function(e) { - isNaN(e) && (e = 1), - this._fovMultiplier = Math.max(0, Math.min(2, e)) - }, - enumerable: true, - configurable: true + get: function () { + return this._fovMultiplier; + }, + set: function (e) { + isNaN(e) && (e = 1), + (this._fovMultiplier = Math.max(0, Math.min(2, e))); + }, + enumerable: true, + configurable: true, }), - t.prototype._attachImageProcessingConfiguration = function(e) { + (t.prototype._attachImageProcessingConfiguration = + function (e) { var t = this; - e !== this._imageProcessingConfiguration && (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), - this._imageProcessingConfiguration = e || this.getScene().imageProcessingConfiguration, - this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() { - t._computePrimaryColorFromPerceptualColor(), - t._markAllSubMeshesAsImageProcessingDirty() - }))) - } - , - Object.defineProperty(t.prototype, "imageProcessingConfiguration", { - get: function() { - return this._imageProcessingConfiguration + e !== this._imageProcessingConfiguration && + (this._imageProcessingConfiguration && + this._imageProcessingObserver && + this._imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingObserver + ), + (this._imageProcessingConfiguration = + e || this.getScene().imageProcessingConfiguration), + this._imageProcessingConfiguration && + (this._imageProcessingObserver = + this._imageProcessingConfiguration.onUpdateParameters.add( + function () { + t._computePrimaryColorFromPerceptualColor(), + t._markAllSubMeshesAsImageProcessingDirty(); + } + ))); + }), + Object.defineProperty( + t.prototype, + "imageProcessingConfiguration", + { + get: function () { + return this._imageProcessingConfiguration; }, - set: function(e) { - this._attachImageProcessingConfiguration(e), - this._markAllSubMeshesAsTexturesDirty() + set: function (e) { + this._attachImageProcessingConfiguration(e), + this._markAllSubMeshesAsTexturesDirty(); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraColorCurvesEnabled", { - get: function() { - return this.imageProcessingConfiguration.colorCurvesEnabled + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "cameraColorCurvesEnabled", + { + get: function () { + return this.imageProcessingConfiguration + .colorCurvesEnabled; }, - set: function(e) { - this.imageProcessingConfiguration.colorCurvesEnabled = e + set: function (e) { + this.imageProcessingConfiguration.colorCurvesEnabled = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraColorGradingEnabled", { - get: function() { - return this.imageProcessingConfiguration.colorGradingEnabled + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "cameraColorGradingEnabled", + { + get: function () { + return this.imageProcessingConfiguration + .colorGradingEnabled; }, - set: function(e) { - this.imageProcessingConfiguration.colorGradingEnabled = e + set: function (e) { + this.imageProcessingConfiguration.colorGradingEnabled = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraToneMappingEnabled", { - get: function() { - return this._imageProcessingConfiguration.toneMappingEnabled + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "cameraToneMappingEnabled", + { + get: function () { + return this._imageProcessingConfiguration + .toneMappingEnabled; }, - set: function(e) { - this._imageProcessingConfiguration.toneMappingEnabled = e + set: function (e) { + this._imageProcessingConfiguration.toneMappingEnabled = + e; }, enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "cameraExposure", { - get: function() { - return this._imageProcessingConfiguration.exposure - }, - set: function(e) { - this._imageProcessingConfiguration.exposure = e - }, - enumerable: true, - configurable: true + get: function () { + return this._imageProcessingConfiguration.exposure; + }, + set: function (e) { + this._imageProcessingConfiguration.exposure = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "cameraContrast", { - get: function() { - return this._imageProcessingConfiguration.contrast + get: function () { + return this._imageProcessingConfiguration.contrast; + }, + set: function (e) { + this._imageProcessingConfiguration.contrast = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "cameraColorGradingTexture", + { + get: function () { + return this._imageProcessingConfiguration + .colorGradingTexture; }, - set: function(e) { - this._imageProcessingConfiguration.contrast = e + set: function (e) { + this.imageProcessingConfiguration.colorGradingTexture = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraColorGradingTexture", { - get: function() { - return this._imageProcessingConfiguration.colorGradingTexture - }, - set: function(e) { - this.imageProcessingConfiguration.colorGradingTexture = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "cameraColorCurves", { - get: function() { - return this.imageProcessingConfiguration.colorCurves - }, - set: function(e) { - this.imageProcessingConfiguration.colorCurves = e + get: function () { + return this.imageProcessingConfiguration.colorCurves; + }, + set: function (e) { + this.imageProcessingConfiguration.colorCurves = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "hasRenderTargetTextures", + { + get: function () { + return ( + !( + !this._diffuseTexture || + !this._diffuseTexture.isRenderTarget + ) || + !( + !this._reflectionTexture || + !this._reflectionTexture.isRenderTarget + ) + ); }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype.needAlphaTesting = function () { + return true; }), - Object.defineProperty(t.prototype, "hasRenderTargetTextures", { - get: function() { - return !(!this._diffuseTexture || !this._diffuseTexture.isRenderTarget) || !(!this._reflectionTexture || !this._reflectionTexture.isRenderTarget) - }, - enumerable: true, - configurable: true + (t.prototype.needAlphaBlending = function () { + return ( + this.alpha < 0 || + (null != this._diffuseTexture && + this._diffuseTexture.hasAlpha) + ); }), - t.prototype.needAlphaTesting = function() { - return true - } - , - t.prototype.needAlphaBlending = function() { - return this.alpha < 0 || null != this._diffuseTexture && this._diffuseTexture.hasAlpha - } - , - t.prototype.isReadyForSubMesh = function(e, t, i) { - var n = this; - if (void 0 === i && (i = false), + (t.prototype.isReadyForSubMesh = function (e, t, i) { + var n = this; + if ( + (void 0 === i && (i = false), t.effect && this.isFrozen && this._wasPreviouslyReady) - return true; - t._materialDefines || (t._materialDefines = new Zn); - var r = this.getScene() - , o = t._materialDefines; - if (!this.checkReadyOnEveryCall && t.effect && o._renderId === r.getRenderId()) - return true; - var a = r.getEngine(); - if (Yn.a.PrepareDefinesForLights(r, e, o, false, this._maxSimultaneousLights), - o._needNormals = true, + ) + return true; + t._materialDefines || (t._materialDefines = new Zn()); + var r = this.getScene(), + o = t._materialDefines; + if ( + !this.checkReadyOnEveryCall && + t.effect && + o._renderId === r.getRenderId() + ) + return true; + var a = r.getEngine(); + if ( + (Yn.a.PrepareDefinesForLights( + r, + e, + o, + false, + this._maxSimultaneousLights + ), + (o._needNormals = true), Yn.a.PrepareDefinesForMultiview(r, o), - o._areTexturesDirty) { - if (o._needUVs = false, - r.texturesEnabled) { - if (r.getEngine().getCaps().textureLOD && (o.TEXTURELODSUPPORT = true), - this._diffuseTexture && qn.a.DiffuseTextureEnabled) { - if (!this._diffuseTexture.isReadyOrNotBlocking()) - return false; - Yn.a.PrepareDefinesForMergedUV(this._diffuseTexture, o, "DIFFUSE"), - o.DIFFUSEHASALPHA = this._diffuseTexture.hasAlpha, - o.GAMMADIFFUSE = this._diffuseTexture.gammaSpace, - o.OPACITYFRESNEL = this._opacityFresnel - } else - o.DIFFUSE = false, - o.DIFFUSEHASALPHA = false, - o.GAMMADIFFUSE = false, - o.OPACITYFRESNEL = false; - var s = this._reflectionTexture; - if (s && qn.a.ReflectionTextureEnabled) { - if (!s.isReadyOrNotBlocking()) - return false; - switch (o.REFLECTION = true, - o.GAMMAREFLECTION = s.gammaSpace, - o.RGBDREFLECTION = s.isRGBD, - o.REFLECTIONBLUR = this._reflectionBlur > 0, - o.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !s.invertZ : s.invertZ, - o.LODINREFLECTIONALPHA = s.lodLevelInAlpha, - o.EQUIRECTANGULAR_RELFECTION_FOV = this.useEquirectangularFOV, - o.REFLECTIONBGR = this.switchToBGR, - s.coordinatesMode === je.a.INVCUBIC_MODE && (o.INVERTCUBICMAP = true), - o.REFLECTIONMAP_3D = s.isCube, - s.coordinatesMode) { - case je.a.EXPLICIT_MODE: - o.REFLECTIONMAP_EXPLICIT = true; - break; - case je.a.PLANAR_MODE: - o.REFLECTIONMAP_PLANAR = true; - break; - case je.a.PROJECTION_MODE: - o.REFLECTIONMAP_PROJECTION = true; - break; - case je.a.SKYBOX_MODE: - o.REFLECTIONMAP_SKYBOX = true, - o.REFLECTIONMAP_SKYBOX_TRANSFORMED = !s.getReflectionTextureMatrix().isIdentity(); - break; - case je.a.SPHERICAL_MODE: - o.REFLECTIONMAP_SPHERICAL = true; - break; - case je.a.EQUIRECTANGULAR_MODE: - o.REFLECTIONMAP_EQUIRECTANGULAR = true; - break; - case je.a.FIXED_EQUIRECTANGULAR_MODE: - o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true; - break; - case je.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE: - o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true; - break; - case je.a.CUBIC_MODE: - case je.a.INVCUBIC_MODE: - default: - o.REFLECTIONMAP_CUBIC = true - } - this.reflectionFresnel ? (o.REFLECTIONFRESNEL = true, - o.REFLECTIONFALLOFF = this.reflectionFalloffDistance > 0, - this._reflectionControls.x = this.reflectionAmount, - this._reflectionControls.y = this.reflectionReflectance0, - this._reflectionControls.z = this.reflectionReflectance90, - this._reflectionControls.w = 1 / this.reflectionFalloffDistance) : (o.REFLECTIONFRESNEL = false, - o.REFLECTIONFALLOFF = false) - } else - o.REFLECTION = false, - o.REFLECTIONFRESNEL = false, - o.REFLECTIONFALLOFF = false, - o.REFLECTIONBLUR = false, - o.REFLECTIONMAP_3D = false, - o.REFLECTIONMAP_SPHERICAL = false, - o.REFLECTIONMAP_PLANAR = false, - o.REFLECTIONMAP_CUBIC = false, - o.REFLECTIONMAP_PROJECTION = false, - o.REFLECTIONMAP_SKYBOX = false, - o.REFLECTIONMAP_SKYBOX_TRANSFORMED = false, - o.REFLECTIONMAP_EXPLICIT = false, - o.REFLECTIONMAP_EQUIRECTANGULAR = false, - o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false, - o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false, - o.INVERTCUBICMAP = false, - o.REFLECTIONMAP_OPPOSITEZ = false, - o.LODINREFLECTIONALPHA = false, - o.GAMMAREFLECTION = false, - o.RGBDREFLECTION = false + o._areTexturesDirty) + ) { + if (((o._needUVs = false), r.texturesEnabled)) { + if ( + (r.getEngine().getCaps().textureLOD && + (o.TEXTURELODSUPPORT = true), + this._diffuseTexture && qn.a.DiffuseTextureEnabled) + ) { + if (!this._diffuseTexture.isReadyOrNotBlocking()) + return false; + Yn.a.PrepareDefinesForMergedUV( + this._diffuseTexture, + o, + "DIFFUSE" + ), + (o.DIFFUSEHASALPHA = + this._diffuseTexture.hasAlpha), + (o.GAMMADIFFUSE = + this._diffuseTexture.gammaSpace), + (o.OPACITYFRESNEL = this._opacityFresnel); + } else + (o.DIFFUSE = false), + (o.DIFFUSEHASALPHA = false), + (o.GAMMADIFFUSE = false), + (o.OPACITYFRESNEL = false); + var s = this._reflectionTexture; + if (s && qn.a.ReflectionTextureEnabled) { + if (!s.isReadyOrNotBlocking()) return false; + switch ( + ((o.REFLECTION = true), + (o.GAMMAREFLECTION = s.gammaSpace), + (o.RGBDREFLECTION = s.isRGBD), + (o.REFLECTIONBLUR = this._reflectionBlur > 0), + (o.REFLECTIONMAP_OPPOSITEZ = this.getScene() + .useRightHandedSystem + ? !s.invertZ + : s.invertZ), + (o.LODINREFLECTIONALPHA = s.lodLevelInAlpha), + (o.EQUIRECTANGULAR_RELFECTION_FOV = + this.useEquirectangularFOV), + (o.REFLECTIONBGR = this.switchToBGR), + s.coordinatesMode === je.a.INVCUBIC_MODE && + (o.INVERTCUBICMAP = true), + (o.REFLECTIONMAP_3D = s.isCube), + s.coordinatesMode) + ) { + case je.a.EXPLICIT_MODE: + o.REFLECTIONMAP_EXPLICIT = true; + break; + case je.a.PLANAR_MODE: + o.REFLECTIONMAP_PLANAR = true; + break; + case je.a.PROJECTION_MODE: + o.REFLECTIONMAP_PROJECTION = true; + break; + case je.a.SKYBOX_MODE: + (o.REFLECTIONMAP_SKYBOX = true), + (o.REFLECTIONMAP_SKYBOX_TRANSFORMED = !s + .getReflectionTextureMatrix() + .isIdentity()); + break; + case je.a.SPHERICAL_MODE: + o.REFLECTIONMAP_SPHERICAL = true; + break; + case je.a.EQUIRECTANGULAR_MODE: + o.REFLECTIONMAP_EQUIRECTANGULAR = true; + break; + case je.a.FIXED_EQUIRECTANGULAR_MODE: + o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true; + break; + case je.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE: + o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true; + break; + case je.a.CUBIC_MODE: + case je.a.INVCUBIC_MODE: + default: + o.REFLECTIONMAP_CUBIC = true; } - o.PREMULTIPLYALPHA = this.alphaMode === _.a.ALPHA_PREMULTIPLIED || this.alphaMode === _.a.ALPHA_PREMULTIPLIED_PORTERDUFF, - o.USERGBCOLOR = this._useRGBColor, - o.NOISE = this._enableNoise + this.reflectionFresnel + ? ((o.REFLECTIONFRESNEL = true), + (o.REFLECTIONFALLOFF = + this.reflectionFalloffDistance > 0), + (this._reflectionControls.x = + this.reflectionAmount), + (this._reflectionControls.y = + this.reflectionReflectance0), + (this._reflectionControls.z = + this.reflectionReflectance90), + (this._reflectionControls.w = + 1 / this.reflectionFalloffDistance)) + : ((o.REFLECTIONFRESNEL = false), + (o.REFLECTIONFALLOFF = false)); + } else + (o.REFLECTION = false), + (o.REFLECTIONFRESNEL = false), + (o.REFLECTIONFALLOFF = false), + (o.REFLECTIONBLUR = false), + (o.REFLECTIONMAP_3D = false), + (o.REFLECTIONMAP_SPHERICAL = false), + (o.REFLECTIONMAP_PLANAR = false), + (o.REFLECTIONMAP_CUBIC = false), + (o.REFLECTIONMAP_PROJECTION = false), + (o.REFLECTIONMAP_SKYBOX = false), + (o.REFLECTIONMAP_SKYBOX_TRANSFORMED = false), + (o.REFLECTIONMAP_EXPLICIT = false), + (o.REFLECTIONMAP_EQUIRECTANGULAR = false), + (o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false), + (o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false), + (o.INVERTCUBICMAP = false), + (o.REFLECTIONMAP_OPPOSITEZ = false), + (o.LODINREFLECTIONALPHA = false), + (o.GAMMAREFLECTION = false), + (o.RGBDREFLECTION = false); } - if (o._areLightsDirty && (o.USEHIGHLIGHTANDSHADOWCOLORS = !this._useRGBColor && (0 !== this._primaryColorShadowLevel || 0 !== this._primaryColorHighlightLevel)), - o._areImageProcessingDirty && this._imageProcessingConfiguration) { - if (!this._imageProcessingConfiguration.isReady()) - return false; - this._imageProcessingConfiguration.prepareDefines(o) - } - if (Yn.a.PrepareDefinesForMisc(e, r, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(e), o), + (o.PREMULTIPLYALPHA = + this.alphaMode === _.a.ALPHA_PREMULTIPLIED || + this.alphaMode === + _.a.ALPHA_PREMULTIPLIED_PORTERDUFF), + (o.USERGBCOLOR = this._useRGBColor), + (o.NOISE = this._enableNoise); + } + if ( + (o._areLightsDirty && + (o.USEHIGHLIGHTANDSHADOWCOLORS = + !this._useRGBColor && + (0 !== this._primaryColorShadowLevel || + 0 !== this._primaryColorHighlightLevel)), + o._areImageProcessingDirty && + this._imageProcessingConfiguration) + ) { + if (!this._imageProcessingConfiguration.isReady()) + return false; + this._imageProcessingConfiguration.prepareDefines(o); + } + if ( + (Yn.a.PrepareDefinesForMisc( + e, + r, + false, + this.pointsCloud, + this.fogEnabled, + this._shouldTurnAlphaTestOn(e), + o + ), Yn.a.PrepareDefinesForFrameBoundValues(r, a, o, i), - Yn.a.PrepareDefinesForAttributes(e, o, false, true, false) && e && (r.getEngine().getCaps().standardDerivatives || e.isVerticesDataPresent(Si.b.NormalKind) || (e.createNormals(true), - g.a.Warn("BackgroundMaterial: Normals have been created for the mesh: " + e.name))), - o.isDirty) { - o.markAsProcessed(), - r.resetCachedMaterial(); - var c = new Ht.c; - o.FOG && c.addFallback(0, "FOG"), - o.POINTSIZE && c.addFallback(1, "POINTSIZE"), - o.MULTIVIEW && c.addFallback(0, "MULTIVIEW"), - Yn.a.HandleFallbacksForShadows(o, c, this._maxSimultaneousLights), - o.NUM_BONE_INFLUENCERS > 0 && c.addCPUSkinningFallback(0, e); - var u = [Si.b.PositionKind]; - o.NORMAL && u.push(Si.b.NormalKind), - o.UV1 && u.push(Si.b.UVKind), - o.UV2 && u.push(Si.b.UV2Kind), - Yn.a.PrepareAttributesForBones(u, e, o, c), - Yn.a.PrepareAttributesForInstances(u, o); - var l = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vFogInfos", "vFogColor", "pointSize", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "mBones", "vPrimaryColor", "vPrimaryColorShadow", "vReflectionInfos", "reflectionMatrix", "vReflectionMicrosurfaceInfos", "fFovMultiplier", "shadowLevel", "alpha", "vBackgroundCenter", "vReflectionControl", "vDiffuseInfos", "diffuseMatrix"] - , h = ["diffuseSampler", "reflectionSampler", "reflectionSamplerLow", "reflectionSamplerHigh"] - , f = ["Material", "Scene"]; - yi.a && (yi.a.PrepareUniforms(l, o), - yi.a.PrepareSamplers(h, o)), - Yn.a.PrepareUniformsAndSamplersList({ - uniformsNames: l, - uniformBuffersNames: f, - samplers: h, - defines: o, - maxSimultaneousLights: this._maxSimultaneousLights - }); - var d = o.toString(); - t.setEffect(r.getEngine().createEffect("background", { - attributes: u, - uniformsNames: l, - uniformBuffersNames: f, - samplers: h, - defines: d, - fallbacks: c, - onCompiled: function(e) { - n.onCompiled && n.onCompiled(e), - n.bindSceneUniformBuffer(e, r.getSceneUniformBuffer()) - }, - onError: this.onError, - indexParameters: { - maxSimultaneousLights: this._maxSimultaneousLights - } - }, a), o), - this.buildUniformLayout() - } - return !(!t.effect || !t.effect.isReady() || (o._renderId = r.getRenderId(), - this._wasPreviouslyReady = true, - 0)) - } - , - t.prototype._computePrimaryColorFromPerceptualColor = function() { - this.__perceptualColor && (this._primaryColor.copyFrom(this.__perceptualColor), - this._primaryColor.toLinearSpaceToRef(this._primaryColor), - this._imageProcessingConfiguration && this._primaryColor.scaleToRef(1 / this._imageProcessingConfiguration.exposure, this._primaryColor), - this._computePrimaryColors()) - } - , - t.prototype._computePrimaryColors = function() { - 0 === this._primaryColorShadowLevel && 0 === this._primaryColorHighlightLevel || (this._primaryColor.scaleToRef(this._primaryColorShadowLevel, this._primaryShadowColor), - this._primaryColor.subtractToRef(this._primaryShadowColor, this._primaryShadowColor), - this._white.subtractToRef(this._primaryColor, this._primaryHighlightColor), - this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel, this._primaryHighlightColor), - this._primaryColor.addToRef(this._primaryHighlightColor, this._primaryHighlightColor)) - } - , - t.prototype.buildUniformLayout = function() { - this._uniformBuffer.addUniform("vPrimaryColor", 4), - this._uniformBuffer.addUniform("vPrimaryColorShadow", 4), + Yn.a.PrepareDefinesForAttributes( + e, + o, + false, + true, + false + ) && + e && + (r.getEngine().getCaps().standardDerivatives || + e.isVerticesDataPresent(Si.b.NormalKind) || + (e.createNormals(true), + g.a.Warn( + "BackgroundMaterial: Normals have been created for the mesh: " + + e.name + ))), + o.isDirty) + ) { + o.markAsProcessed(), r.resetCachedMaterial(); + var c = new Ht.c(); + o.FOG && c.addFallback(0, "FOG"), + o.POINTSIZE && c.addFallback(1, "POINTSIZE"), + o.MULTIVIEW && c.addFallback(0, "MULTIVIEW"), + Yn.a.HandleFallbacksForShadows( + o, + c, + this._maxSimultaneousLights + ), + o.NUM_BONE_INFLUENCERS > 0 && + c.addCPUSkinningFallback(0, e); + var u = [Si.b.PositionKind]; + o.NORMAL && u.push(Si.b.NormalKind), + o.UV1 && u.push(Si.b.UVKind), + o.UV2 && u.push(Si.b.UV2Kind), + Yn.a.PrepareAttributesForBones(u, e, o, c), + Yn.a.PrepareAttributesForInstances(u, o); + var l = [ + "world", + "view", + "viewProjection", + "vEyePosition", + "vLightsType", + "vFogInfos", + "vFogColor", + "pointSize", + "vClipPlane", + "vClipPlane2", + "vClipPlane3", + "vClipPlane4", + "mBones", + "vPrimaryColor", + "vPrimaryColorShadow", + "vReflectionInfos", + "reflectionMatrix", + "vReflectionMicrosurfaceInfos", + "fFovMultiplier", + "shadowLevel", + "alpha", + "vBackgroundCenter", + "vReflectionControl", + "vDiffuseInfos", + "diffuseMatrix", + ], + h = [ + "diffuseSampler", + "reflectionSampler", + "reflectionSamplerLow", + "reflectionSamplerHigh", + ], + f = ["Material", "Scene"]; + yi.a && + (yi.a.PrepareUniforms(l, o), + yi.a.PrepareSamplers(h, o)), + Yn.a.PrepareUniformsAndSamplersList({ + uniformsNames: l, + uniformBuffersNames: f, + samplers: h, + defines: o, + maxSimultaneousLights: this._maxSimultaneousLights, + }); + var d = o.toString(); + t.setEffect( + r.getEngine().createEffect( + "background", + { + attributes: u, + uniformsNames: l, + uniformBuffersNames: f, + samplers: h, + defines: d, + fallbacks: c, + onCompiled: function (e) { + n.onCompiled && n.onCompiled(e), + n.bindSceneUniformBuffer( + e, + r.getSceneUniformBuffer() + ); + }, + onError: this.onError, + indexParameters: { + maxSimultaneousLights: + this._maxSimultaneousLights, + }, + }, + a + ), + o + ), + this.buildUniformLayout(); + } + return !( + !t.effect || + !t.effect.isReady() || + ((o._renderId = r.getRenderId()), + (this._wasPreviouslyReady = true), + 0) + ); + }), + (t.prototype._computePrimaryColorFromPerceptualColor = + function () { + this.__perceptualColor && + (this._primaryColor.copyFrom(this.__perceptualColor), + this._primaryColor.toLinearSpaceToRef( + this._primaryColor + ), + this._imageProcessingConfiguration && + this._primaryColor.scaleToRef( + 1 / this._imageProcessingConfiguration.exposure, + this._primaryColor + ), + this._computePrimaryColors()); + }), + (t.prototype._computePrimaryColors = function () { + (0 === this._primaryColorShadowLevel && + 0 === this._primaryColorHighlightLevel) || + (this._primaryColor.scaleToRef( + this._primaryColorShadowLevel, + this._primaryShadowColor + ), + this._primaryColor.subtractToRef( + this._primaryShadowColor, + this._primaryShadowColor + ), + this._white.subtractToRef( + this._primaryColor, + this._primaryHighlightColor + ), + this._primaryHighlightColor.scaleToRef( + this._primaryColorHighlightLevel, + this._primaryHighlightColor + ), + this._primaryColor.addToRef( + this._primaryHighlightColor, + this._primaryHighlightColor + )); + }), + (t.prototype.buildUniformLayout = function () { + this._uniformBuffer.addUniform("vPrimaryColor", 4), + this._uniformBuffer.addUniform( + "vPrimaryColorShadow", + 4 + ), this._uniformBuffer.addUniform("vDiffuseInfos", 2), this._uniformBuffer.addUniform("vReflectionInfos", 2), this._uniformBuffer.addUniform("diffuseMatrix", 16), this._uniformBuffer.addUniform("reflectionMatrix", 16), - this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos", 3), + this._uniformBuffer.addUniform( + "vReflectionMicrosurfaceInfos", + 3 + ), this._uniformBuffer.addUniform("fFovMultiplier", 1), this._uniformBuffer.addUniform("pointSize", 1), this._uniformBuffer.addUniform("shadowLevel", 1), this._uniformBuffer.addUniform("alpha", 1), this._uniformBuffer.addUniform("vBackgroundCenter", 3), this._uniformBuffer.addUniform("vReflectionControl", 4), - this._uniformBuffer.create() - } - , - t.prototype.unbind = function() { - this._diffuseTexture && this._diffuseTexture.isRenderTarget && this._uniformBuffer.setTexture("diffuseSampler", null), - this._reflectionTexture && this._reflectionTexture.isRenderTarget && this._uniformBuffer.setTexture("reflectionSampler", null), - e.prototype.unbind.call(this) - } - , - t.prototype.bindOnlyWorldMatrix = function(e) { - this._activeEffect.setMatrix("world", e) - } - , - t.prototype.bindForSubMesh = function(e, t, i) { - var n = this.getScene() - , r = i._materialDefines; - if (r) { - var o = i.effect; - if (o) { - this._activeEffect = o, - this.bindOnlyWorldMatrix(e), - Yn.a.BindBonesParameters(t, this._activeEffect); - var a = this._mustRebind(n, o, t.visibility); - if (a) { - this._uniformBuffer.bindToEffect(o, "Material"), - this.bindViewProjection(o); - var s = this._reflectionTexture; - this._uniformBuffer.useUbo && this.isFrozen && this._uniformBuffer.isSync || (n.texturesEnabled && (this._diffuseTexture && qn.a.DiffuseTextureEnabled && (this._uniformBuffer.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level), - Yn.a.BindTextureMatrix(this._diffuseTexture, this._uniformBuffer, "diffuse")), - s && qn.a.ReflectionTextureEnabled && (this._uniformBuffer.updateMatrix("reflectionMatrix", s.getReflectionTextureMatrix()), - this._uniformBuffer.updateFloat2("vReflectionInfos", s.level, this._reflectionBlur), - this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos", s.getSize().width, s.lodGenerationScale, s.lodGenerationOffset))), - this.shadowLevel > 0 && this._uniformBuffer.updateFloat("shadowLevel", this.shadowLevel), - this._uniformBuffer.updateFloat("alpha", this.alpha), - this.pointsCloud && this._uniformBuffer.updateFloat("pointSize", this.pointSize), - r.USEHIGHLIGHTANDSHADOWCOLORS ? (this._uniformBuffer.updateColor4("vPrimaryColor", this._primaryHighlightColor, 1), - this._uniformBuffer.updateColor4("vPrimaryColorShadow", this._primaryShadowColor, 1)) : this._uniformBuffer.updateColor4("vPrimaryColor", this._primaryColor, 1)), - this._uniformBuffer.updateFloat("fFovMultiplier", this._fovMultiplier), - n.texturesEnabled && (this._diffuseTexture && qn.a.DiffuseTextureEnabled && this._uniformBuffer.setTexture("diffuseSampler", this._diffuseTexture), - s && qn.a.ReflectionTextureEnabled && (r.REFLECTIONBLUR && r.TEXTURELODSUPPORT ? this._uniformBuffer.setTexture("reflectionSampler", s) : r.REFLECTIONBLUR ? (this._uniformBuffer.setTexture("reflectionSampler", s._lodTextureMid || s), - this._uniformBuffer.setTexture("reflectionSamplerLow", s._lodTextureLow || s), - this._uniformBuffer.setTexture("reflectionSamplerHigh", s._lodTextureHigh || s)) : this._uniformBuffer.setTexture("reflectionSampler", s), - r.REFLECTIONFRESNEL && (this._uniformBuffer.updateFloat3("vBackgroundCenter", this.sceneCenter.x, this.sceneCenter.y, this.sceneCenter.z), - this._uniformBuffer.updateFloat4("vReflectionControl", this._reflectionControls.x, this._reflectionControls.y, this._reflectionControls.z, this._reflectionControls.w)))), - Yn.a.BindClipPlane(this._activeEffect, n), - Yn.a.BindEyePosition(o, n) - } - !a && this.isFrozen || (n.lightsEnabled && Yn.a.BindLights(n, t, this._activeEffect, r, this._maxSimultaneousLights, false), - this.bindView(o), - Yn.a.BindFogParameters(n, t, this._activeEffect, true), - this._imageProcessingConfiguration && this._imageProcessingConfiguration.bind(this._activeEffect)), - this._uniformBuffer.update(), - this._afterBind(t, this._activeEffect) - } + this._uniformBuffer.create(); + }), + (t.prototype.unbind = function () { + this._diffuseTexture && + this._diffuseTexture.isRenderTarget && + this._uniformBuffer.setTexture("diffuseSampler", null), + this._reflectionTexture && + this._reflectionTexture.isRenderTarget && + this._uniformBuffer.setTexture( + "reflectionSampler", + null + ), + e.prototype.unbind.call(this); + }), + (t.prototype.bindOnlyWorldMatrix = function (e) { + this._activeEffect.setMatrix("world", e); + }), + (t.prototype.bindForSubMesh = function (e, t, i) { + var n = this.getScene(), + r = i._materialDefines; + if (r) { + var o = i.effect; + if (o) { + (this._activeEffect = o), + this.bindOnlyWorldMatrix(e), + Yn.a.BindBonesParameters(t, this._activeEffect); + var a = this._mustRebind(n, o, t.visibility); + if (a) { + this._uniformBuffer.bindToEffect(o, "Material"), + this.bindViewProjection(o); + var s = this._reflectionTexture; + (this._uniformBuffer.useUbo && + this.isFrozen && + this._uniformBuffer.isSync) || + (n.texturesEnabled && + (this._diffuseTexture && + qn.a.DiffuseTextureEnabled && + (this._uniformBuffer.updateFloat2( + "vDiffuseInfos", + this._diffuseTexture.coordinatesIndex, + this._diffuseTexture.level + ), + Yn.a.BindTextureMatrix( + this._diffuseTexture, + this._uniformBuffer, + "diffuse" + )), + s && + qn.a.ReflectionTextureEnabled && + (this._uniformBuffer.updateMatrix( + "reflectionMatrix", + s.getReflectionTextureMatrix() + ), + this._uniformBuffer.updateFloat2( + "vReflectionInfos", + s.level, + this._reflectionBlur + ), + this._uniformBuffer.updateFloat3( + "vReflectionMicrosurfaceInfos", + s.getSize().width, + s.lodGenerationScale, + s.lodGenerationOffset + ))), + this.shadowLevel > 0 && + this._uniformBuffer.updateFloat( + "shadowLevel", + this.shadowLevel + ), + this._uniformBuffer.updateFloat( + "alpha", + this.alpha + ), + this.pointsCloud && + this._uniformBuffer.updateFloat( + "pointSize", + this.pointSize + ), + r.USEHIGHLIGHTANDSHADOWCOLORS + ? (this._uniformBuffer.updateColor4( + "vPrimaryColor", + this._primaryHighlightColor, + 1 + ), + this._uniformBuffer.updateColor4( + "vPrimaryColorShadow", + this._primaryShadowColor, + 1 + )) + : this._uniformBuffer.updateColor4( + "vPrimaryColor", + this._primaryColor, + 1 + )), + this._uniformBuffer.updateFloat( + "fFovMultiplier", + this._fovMultiplier + ), + n.texturesEnabled && + (this._diffuseTexture && + qn.a.DiffuseTextureEnabled && + this._uniformBuffer.setTexture( + "diffuseSampler", + this._diffuseTexture + ), + s && + qn.a.ReflectionTextureEnabled && + (r.REFLECTIONBLUR && r.TEXTURELODSUPPORT + ? this._uniformBuffer.setTexture( + "reflectionSampler", + s + ) + : r.REFLECTIONBLUR + ? (this._uniformBuffer.setTexture( + "reflectionSampler", + s._lodTextureMid || s + ), + this._uniformBuffer.setTexture( + "reflectionSamplerLow", + s._lodTextureLow || s + ), + this._uniformBuffer.setTexture( + "reflectionSamplerHigh", + s._lodTextureHigh || s + )) + : this._uniformBuffer.setTexture( + "reflectionSampler", + s + ), + r.REFLECTIONFRESNEL && + (this._uniformBuffer.updateFloat3( + "vBackgroundCenter", + this.sceneCenter.x, + this.sceneCenter.y, + this.sceneCenter.z + ), + this._uniformBuffer.updateFloat4( + "vReflectionControl", + this._reflectionControls.x, + this._reflectionControls.y, + this._reflectionControls.z, + this._reflectionControls.w + )))), + Yn.a.BindClipPlane(this._activeEffect, n), + Yn.a.BindEyePosition(o, n); + } + (!a && this.isFrozen) || + (n.lightsEnabled && + Yn.a.BindLights( + n, + t, + this._activeEffect, + r, + this._maxSimultaneousLights, + false + ), + this.bindView(o), + Yn.a.BindFogParameters( + n, + t, + this._activeEffect, + true + ), + this._imageProcessingConfiguration && + this._imageProcessingConfiguration.bind( + this._activeEffect + )), + this._uniformBuffer.update(), + this._afterBind(t, this._activeEffect); } - } - , - t.prototype.dispose = function(t, i) { - void 0 === t && (t = false), + } + }), + (t.prototype.dispose = function (t, i) { + void 0 === t && (t = false), void 0 === i && (i = false), - i && (this.diffuseTexture && this.diffuseTexture.dispose(), - this.reflectionTexture && this.reflectionTexture.dispose()), + i && + (this.diffuseTexture && this.diffuseTexture.dispose(), + this.reflectionTexture && + this.reflectionTexture.dispose()), this._renderTargets.dispose(), - this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), - e.prototype.dispose.call(this, t) - } - , - t.prototype.clone = function(e) { - var i = this; - return F.a.Clone(function() { - return new t(e,i.getScene()) - }, this) - } - , - t.prototype.serialize = function() { - var e = F.a.Serialize(this); - return e.customType = "BABYLON.BackgroundMaterial", - e - } - , - t.prototype.getClassName = function() { - return "BackgroundMaterial" - } - , - t.Parse = function(e, i, n) { - return F.a.Parse(function() { - return new t(e.name,i) - }, e, i, n) - } - , - t.StandardReflectance0 = .05, - t.StandardReflectance90 = .5, - h.c([Object(F.e)()], t.prototype, "_primaryColor", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "primaryColor", void 0), - h.c([Object(F.e)()], t.prototype, "__perceptualColor", void 0), - h.c([Object(F.c)()], t.prototype, "_primaryColorShadowLevel", void 0), - h.c([Object(F.c)()], t.prototype, "_primaryColorHighlightLevel", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "primaryColorHighlightLevel", null), - h.c([Object(F.m)()], t.prototype, "_reflectionTexture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionTexture", void 0), - h.c([Object(F.c)()], t.prototype, "_reflectionBlur", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionBlur", void 0), - h.c([Object(F.m)()], t.prototype, "_diffuseTexture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "diffuseTexture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "shadowLights", void 0), - h.c([Object(F.c)()], t.prototype, "_shadowLevel", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "shadowLevel", void 0), - h.c([Object(F.o)()], t.prototype, "_sceneCenter", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "sceneCenter", void 0), - h.c([Object(F.c)()], t.prototype, "_opacityFresnel", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "opacityFresnel", void 0), - h.c([Object(F.c)()], t.prototype, "_reflectionFresnel", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionFresnel", void 0), - h.c([Object(F.c)()], t.prototype, "_reflectionFalloffDistance", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionFalloffDistance", void 0), - h.c([Object(F.c)()], t.prototype, "_reflectionAmount", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionAmount", void 0), - h.c([Object(F.c)()], t.prototype, "_reflectionReflectance0", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionReflectance0", void 0), - h.c([Object(F.c)()], t.prototype, "_reflectionReflectance90", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionReflectance90", void 0), - h.c([Object(F.c)()], t.prototype, "_useRGBColor", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRGBColor", void 0), - h.c([Object(F.c)()], t.prototype, "_enableNoise", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "enableNoise", void 0), - h.c([Object(F.c)()], t.prototype, "_maxSimultaneousLights", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "maxSimultaneousLights", void 0), - h.c([Object(F.i)()], t.prototype, "_imageProcessingConfiguration", void 0), - t - }(Qn.a); - s.a.RegisteredTypes["BABYLON.BackgroundMaterial"] = Jn; - var $n = n(80) - , er = function() { - function e(t, i) { - var n = this; - this._errorHandler = function(e, t) { - n.onErrorObservable.notifyObservers({ - message: e, - exception: t - }) - } - , - this._options = h.a({}, e._getDefaultOptions(), t), - this._scene = i, - this.onErrorObservable = new o.c, - this._setupBackground(), - this._setupImageProcessing() - } - return e._getDefaultOptions = function() { - return { - createGround: true, - groundSize: 15, - groundTexture: this._groundTextureCDNUrl, - groundColor: new a.e(.2,.2,.3).toLinearSpace().scale(3), - groundOpacity: .9, - enableGroundShadow: true, - groundShadowLevel: .5, - enableGroundMirror: false, - groundMirrorSizeRatio: .3, - groundMirrorBlurKernel: 64, - groundMirrorAmount: 1, - groundMirrorFresnelWeight: 1, - groundMirrorFallOffDistance: 0, - groundMirrorTextureType: _.a.TEXTURETYPE_UNSIGNED_INT, - groundYBias: 1e-5, - createSkybox: true, - skyboxSize: 20, - skyboxTexture: this._skyboxTextureCDNUrl, - skyboxColor: new a.e(.2,.2,.3).toLinearSpace().scale(3), - backgroundYRotation: 0, - sizeAuto: true, - rootPosition: a.x.Zero(), - setupImageProcessing: true, - environmentTexture: this._environmentTextureCDNUrl, - cameraExposure: .8, - cameraContrast: 1.2, - toneMappingEnabled: true - } - } - , - Object.defineProperty(e.prototype, "rootMesh", { - get: function() { - return this._rootMesh + this._imageProcessingConfiguration && + this._imageProcessingObserver && + this._imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingObserver + ), + e.prototype.dispose.call(this, t); + }), + (t.prototype.clone = function (e) { + var i = this; + return F.a.Clone(function () { + return new t(e, i.getScene()); + }, this); + }), + (t.prototype.serialize = function () { + var e = F.a.Serialize(this); + return (e.customType = "BABYLON.BackgroundMaterial"), e; + }), + (t.prototype.getClassName = function () { + return "BackgroundMaterial"; + }), + (t.Parse = function (e, i, n) { + return F.a.Parse( + function () { + return new t(e.name, i); }, - enumerable: true, - configurable: true + e, + i, + n + ); + }), + (t.StandardReflectance0 = 0.05), + (t.StandardReflectance90 = 0.5), + h.c([Object(F.e)()], t.prototype, "_primaryColor", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsLightsDirty")], + t.prototype, + "primaryColor", + void 0 + ), + h.c( + [Object(F.e)()], + t.prototype, + "__perceptualColor", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_primaryColorShadowLevel", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_primaryColorHighlightLevel", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsLightsDirty")], + t.prototype, + "primaryColorHighlightLevel", + null + ), + h.c( + [Object(F.m)()], + t.prototype, + "_reflectionTexture", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "reflectionTexture", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_reflectionBlur", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "reflectionBlur", + void 0 + ), + h.c( + [Object(F.m)()], + t.prototype, + "_diffuseTexture", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "diffuseTexture", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "shadowLights", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "_shadowLevel", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "shadowLevel", + void 0 + ), + h.c([Object(F.o)()], t.prototype, "_sceneCenter", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "sceneCenter", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_opacityFresnel", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "opacityFresnel", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_reflectionFresnel", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "reflectionFresnel", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_reflectionFalloffDistance", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "reflectionFalloffDistance", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_reflectionAmount", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "reflectionAmount", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_reflectionReflectance0", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "reflectionReflectance0", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_reflectionReflectance90", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "reflectionReflectance90", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "_useRGBColor", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "useRGBColor", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "_enableNoise", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "enableNoise", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "_maxSimultaneousLights", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + t.prototype, + "maxSimultaneousLights", + void 0 + ), + h.c( + [Object(F.i)()], + t.prototype, + "_imageProcessingConfiguration", + void 0 + ), + t + ); + })(Qn.a); + s.a.RegisteredTypes["BABYLON.BackgroundMaterial"] = Jn; + var $n = n(80), + er = (function () { + function e(t, i) { + var n = this; + (this._errorHandler = function (e, t) { + n.onErrorObservable.notifyObservers({ + message: e, + exception: t, + }); + }), + (this._options = h.a({}, e._getDefaultOptions(), t)), + (this._scene = i), + (this.onErrorObservable = new o.c()), + this._setupBackground(), + this._setupImageProcessing(); + } + return ( + (e._getDefaultOptions = function () { + return { + createGround: true, + groundSize: 15, + groundTexture: this._groundTextureCDNUrl, + groundColor: new a.e(0.2, 0.2, 0.3) + .toLinearSpace() + .scale(3), + groundOpacity: 0.9, + enableGroundShadow: true, + groundShadowLevel: 0.5, + enableGroundMirror: false, + groundMirrorSizeRatio: 0.3, + groundMirrorBlurKernel: 64, + groundMirrorAmount: 1, + groundMirrorFresnelWeight: 1, + groundMirrorFallOffDistance: 0, + groundMirrorTextureType: _.a.TEXTURETYPE_UNSIGNED_INT, + groundYBias: 1e-5, + createSkybox: true, + skyboxSize: 20, + skyboxTexture: this._skyboxTextureCDNUrl, + skyboxColor: new a.e(0.2, 0.2, 0.3) + .toLinearSpace() + .scale(3), + backgroundYRotation: 0, + sizeAuto: true, + rootPosition: a.x.Zero(), + setupImageProcessing: true, + environmentTexture: this._environmentTextureCDNUrl, + cameraExposure: 0.8, + cameraContrast: 1.2, + toneMappingEnabled: true, + }; + }), + Object.defineProperty(e.prototype, "rootMesh", { + get: function () { + return this._rootMesh; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "skybox", { - get: function() { - return this._skybox - }, - enumerable: true, - configurable: true + get: function () { + return this._skybox; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "skyboxTexture", { - get: function() { - return this._skyboxTexture - }, - enumerable: true, - configurable: true + get: function () { + return this._skyboxTexture; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "skyboxMaterial", { - get: function() { - return this._skyboxMaterial - }, - enumerable: true, - configurable: true + get: function () { + return this._skyboxMaterial; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "ground", { - get: function() { - return this._ground - }, - enumerable: true, - configurable: true + get: function () { + return this._ground; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "groundTexture", { - get: function() { - return this._groundTexture - }, - enumerable: true, - configurable: true + get: function () { + return this._groundTexture; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "groundMirror", { - get: function() { - return this._groundMirror + get: function () { + return this._groundMirror; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "groundMirrorRenderList", + { + get: function () { + return this._groundMirror + ? this._groundMirror.renderList + : null; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "groundMirrorRenderList", { - get: function() { - return this._groundMirror ? this._groundMirror.renderList : null - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "groundMaterial", { - get: function() { - return this._groundMaterial - }, - enumerable: true, - configurable: true + get: function () { + return this._groundMaterial; + }, + enumerable: true, + configurable: true, }), - e.prototype.updateOptions = function(e) { - var t = h.a({}, this._options, e); - this._ground && !t.createGround && (this._ground.dispose(), - this._ground = null), - this._groundMaterial && !t.createGround && (this._groundMaterial.dispose(), - this._groundMaterial = null), - this._groundTexture && this._options.groundTexture != t.groundTexture && (this._groundTexture.dispose(), - this._groundTexture = null), - this._skybox && !t.createSkybox && (this._skybox.dispose(), - this._skybox = null), - this._skyboxMaterial && !t.createSkybox && (this._skyboxMaterial.dispose(), - this._skyboxMaterial = null), - this._skyboxTexture && this._options.skyboxTexture != t.skyboxTexture && (this._skyboxTexture.dispose(), - this._skyboxTexture = null), - this._groundMirror && !t.enableGroundMirror && (this._groundMirror.dispose(), - this._groundMirror = null), - this._scene.environmentTexture && this._options.environmentTexture != t.environmentTexture && this._scene.environmentTexture.dispose(), - this._options = t, + (e.prototype.updateOptions = function (e) { + var t = h.a({}, this._options, e); + this._ground && + !t.createGround && + (this._ground.dispose(), (this._ground = null)), + this._groundMaterial && + !t.createGround && + (this._groundMaterial.dispose(), + (this._groundMaterial = null)), + this._groundTexture && + this._options.groundTexture != t.groundTexture && + (this._groundTexture.dispose(), + (this._groundTexture = null)), + this._skybox && + !t.createSkybox && + (this._skybox.dispose(), (this._skybox = null)), + this._skyboxMaterial && + !t.createSkybox && + (this._skyboxMaterial.dispose(), + (this._skyboxMaterial = null)), + this._skyboxTexture && + this._options.skyboxTexture != t.skyboxTexture && + (this._skyboxTexture.dispose(), + (this._skyboxTexture = null)), + this._groundMirror && + !t.enableGroundMirror && + (this._groundMirror.dispose(), + (this._groundMirror = null)), + this._scene.environmentTexture && + this._options.environmentTexture != + t.environmentTexture && + this._scene.environmentTexture.dispose(), + (this._options = t), this._setupBackground(), - this._setupImageProcessing() - } - , - e.prototype.setMainColor = function(e) { - this.groundMaterial && (this.groundMaterial.primaryColor = e), - this.skyboxMaterial && (this.skyboxMaterial.primaryColor = e), - this.groundMirror && (this.groundMirror.clearColor = new a.f(e.r,e.g,e.b,1)) - } - , - e.prototype._setupImageProcessing = function() { - this._options.setupImageProcessing && (this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast, - this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure, - this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled, - this._setupEnvironmentTexture()) - } - , - e.prototype._setupEnvironmentTexture = function() { - if (!this._scene.environmentTexture) - if (this._options.environmentTexture instanceof jn.a) - this._scene.environmentTexture = this._options.environmentTexture; - else { - var e = Xn.CreateFromPrefilteredData(this._options.environmentTexture, this._scene); - this._scene.environmentTexture = e - } - } - , - e.prototype._setupBackground = function() { - this._rootMesh || (this._rootMesh = new me.a("BackgroundHelper",this._scene)), - this._rootMesh.rotation.y = this._options.backgroundYRotation; - var e = this._getSceneSize(); - this._options.createGround && (this._setupGround(e), + this._setupImageProcessing(); + }), + (e.prototype.setMainColor = function (e) { + this.groundMaterial && + (this.groundMaterial.primaryColor = e), + this.skyboxMaterial && + (this.skyboxMaterial.primaryColor = e), + this.groundMirror && + (this.groundMirror.clearColor = new a.f( + e.r, + e.g, + e.b, + 1 + )); + }), + (e.prototype._setupImageProcessing = function () { + this._options.setupImageProcessing && + ((this._scene.imageProcessingConfiguration.contrast = + this._options.cameraContrast), + (this._scene.imageProcessingConfiguration.exposure = + this._options.cameraExposure), + (this._scene.imageProcessingConfiguration.toneMappingEnabled = + this._options.toneMappingEnabled), + this._setupEnvironmentTexture()); + }), + (e.prototype._setupEnvironmentTexture = function () { + if (!this._scene.environmentTexture) + if (this._options.environmentTexture instanceof jn.a) + this._scene.environmentTexture = + this._options.environmentTexture; + else { + var e = Xn.CreateFromPrefilteredData( + this._options.environmentTexture, + this._scene + ); + this._scene.environmentTexture = e; + } + }), + (e.prototype._setupBackground = function () { + this._rootMesh || + (this._rootMesh = new me.a( + "BackgroundHelper", + this._scene + )), + (this._rootMesh.rotation.y = + this._options.backgroundYRotation); + var e = this._getSceneSize(); + this._options.createGround && + (this._setupGround(e), this._setupGroundMaterial(), this._setupGroundDiffuseTexture(), - this._options.enableGroundMirror && this._setupGroundMirrorTexture(e), + this._options.enableGroundMirror && + this._setupGroundMirrorTexture(e), this._setupMirrorInGroundMaterial()), - this._options.createSkybox && (this._setupSkybox(e), - this._setupSkyboxMaterial(), - this._setupSkyboxReflectionTexture()), - this._rootMesh.position.x = e.rootPosition.x, - this._rootMesh.position.z = e.rootPosition.z, - this._rootMesh.position.y = e.rootPosition.y - } - , - e.prototype._getSceneSize = function() { - var e = this - , t = this._options.groundSize - , i = this._options.skyboxSize - , n = this._options.rootPosition; - if (!this._scene.meshes || 1 === this._scene.meshes.length) - return { - groundSize: t, - skyboxSize: i, - rootPosition: n - }; - var r = this._scene.getWorldExtends(function(t) { - return t !== e._ground && t !== e._rootMesh && t !== e._skybox - }) - , o = r.max.subtract(r.min); - if (this._options.sizeAuto) { - this._scene.activeCamera instanceof xt && this._scene.activeCamera.upperRadiusLimit && (i = t = 2 * this._scene.activeCamera.upperRadiusLimit); - var a = o.length(); - a > t && (i = t = 2 * a), - t *= 1.1, - i *= 1.5, - (n = r.min.add(o.scale(.5))).y = r.min.y - this._options.groundYBias - } + this._options.createSkybox && + (this._setupSkybox(e), + this._setupSkyboxMaterial(), + this._setupSkyboxReflectionTexture()), + (this._rootMesh.position.x = e.rootPosition.x), + (this._rootMesh.position.z = e.rootPosition.z), + (this._rootMesh.position.y = e.rootPosition.y); + }), + (e.prototype._getSceneSize = function () { + var e = this, + t = this._options.groundSize, + i = this._options.skyboxSize, + n = this._options.rootPosition; + if ( + !this._scene.meshes || + 1 === this._scene.meshes.length + ) return { - groundSize: t, - skyboxSize: i, - rootPosition: n - } - } - , - e.prototype._setupGround = function(e) { - var t = this; - this._ground && !this._ground.isDisposed() || (this._ground = me.a.CreatePlane("BackgroundPlane", e.groundSize, this._scene), - this._ground.rotation.x = Math.PI / 2, - this._ground.parent = this._rootMesh, - this._ground.onDisposeObservable.add(function() { - t._ground = null - })), - this._ground.receiveShadows = this._options.enableGroundShadow - } - , - e.prototype._setupGroundMaterial = function() { - this._groundMaterial || (this._groundMaterial = new Jn("BackgroundPlaneMaterial",this._scene)), - this._groundMaterial.alpha = this._options.groundOpacity, - this._groundMaterial.alphaMode = _.a.ALPHA_PREMULTIPLIED_PORTERDUFF, - this._groundMaterial.shadowLevel = this._options.groundShadowLevel, - this._groundMaterial.primaryColor = this._options.groundColor, - this._groundMaterial.useRGBColor = false, - this._groundMaterial.enableNoise = true, - this._ground && (this._ground.material = this._groundMaterial) - } - , - e.prototype._setupGroundDiffuseTexture = function() { - if (this._groundMaterial && !this._groundTexture) - if (this._options.groundTexture instanceof jn.a) - this._groundMaterial.diffuseTexture = this._options.groundTexture; - else { - var e = new je.a(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler); - e.gammaSpace = false, - e.hasAlpha = true, - this._groundMaterial.diffuseTexture = e - } - } - , - e.prototype._setupGroundMirrorTexture = function(e) { - var t = je.a.CLAMP_ADDRESSMODE; - if (!this._groundMirror && (this._groundMirror = new Wn("BackgroundPlaneMirrorTexture",{ - ratio: this._options.groundMirrorSizeRatio - },this._scene,false,this._options.groundMirrorTextureType,je.a.BILINEAR_SAMPLINGMODE,true), - this._groundMirror.mirrorPlane = new a.n(0,-1,0,e.rootPosition.y), - this._groundMirror.anisotropicFilteringLevel = 1, - this._groundMirror.wrapU = t, - this._groundMirror.wrapV = t, - this._groundMirror.gammaSpace = false, - this._groundMirror.renderList)) - for (var i = 0; i < this._scene.meshes.length; i++) { - var n = this._scene.meshes[i]; - n !== this._ground && n !== this._skybox && n !== this._rootMesh && this._groundMirror.renderList.push(n) - } - this._groundMirror.clearColor = new a.f(this._options.groundColor.r,this._options.groundColor.g,this._options.groundColor.b,1), - this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel - } - , - e.prototype._setupMirrorInGroundMaterial = function() { - this._groundMaterial && (this._groundMaterial.reflectionTexture = this._groundMirror, - this._groundMaterial.reflectionFresnel = true, - this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount, - this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight, - this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance) - } - , - e.prototype._setupSkybox = function(e) { - var t = this; - this._skybox && !this._skybox.isDisposed() || (this._skybox = me.a.CreateBox("BackgroundSkybox", e.skyboxSize, this._scene, void 0, me.a.BACKSIDE), - this._skybox.onDisposeObservable.add(function() { - t._skybox = null - })), - this._skybox.parent = this._rootMesh - } - , - e.prototype._setupSkyboxMaterial = function() { - this._skybox && (this._skyboxMaterial || (this._skyboxMaterial = new Jn("BackgroundSkyboxMaterial",this._scene)), - this._skyboxMaterial.useRGBColor = false, - this._skyboxMaterial.primaryColor = this._options.skyboxColor, - this._skyboxMaterial.enableNoise = true, - this._skybox.material = this._skyboxMaterial) - } - , - e.prototype._setupSkyboxReflectionTexture = function() { - this._skyboxMaterial && (this._skyboxTexture || (this._options.skyboxTexture instanceof jn.a ? this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture : (this._skyboxTexture = new Xn(this._options.skyboxTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler), - this._skyboxTexture.coordinatesMode = je.a.SKYBOX_MODE, - this._skyboxTexture.gammaSpace = false, - this._skyboxMaterial.reflectionTexture = this._skyboxTexture))) - } - , - e.prototype.dispose = function() { - this._groundMaterial && this._groundMaterial.dispose(true, true), - this._skyboxMaterial && this._skyboxMaterial.dispose(true, true), - this._rootMesh.dispose(false) - } - , - e._groundTextureCDNUrl = "https://assets.babylonjs.com/environments/backgroundGround.png", - e._skyboxTextureCDNUrl = "https://assets.babylonjs.com/environments/backgroundSkybox.dds", - e._environmentTextureCDNUrl = "https://assets.babylonjs.com/environments/environmentSpecular.env", - e - }() - , tr = n(42) - , ir = function(e) { - function t(t, i, n, r, s) { - void 0 === s && (s = null); - var c = e.call(this, t, r) || this; - c._useDirectMapping = false, - c.onLoadErrorObservable = new o.c, - t = t || "photoDome", - n.resolution = 0 | Math.abs(n.resolution) || 32, - n.size = Math.abs(n.size) || (r.activeCamera ? .48 * r.activeCamera.maxZ : 1e3), - void 0 === n.useDirectMapping ? c._useDirectMapping = true : c._useDirectMapping = n.useDirectMapping, - void 0 === n.faceForward && (n.faceForward = true), - c._setReady(false); - var u = c._material = new Jn(t + "_material",r); - if (c._mesh = me.a.CreateSphere(t + "_mesh", n.resolution, n.size, r, false, me.a.BACKSIDE), - u.opacityFresnel = false, - u.useEquirectangularFOV = true, - u.fovMultiplier = 1, - c.photoTexture = new je.a(i,r,true,!c._useDirectMapping,void 0,void 0,function(e, t) { - c.onLoadErrorObservable.notifyObservers(e || "Unknown error occured"), - s && s(e, t) - } - ), - c.photoTexture.onLoadObservable.addOnce(function() { - c._setReady(true) + groundSize: t, + skyboxSize: i, + rootPosition: n, + }; + var r = this._scene.getWorldExtends(function (t) { + return ( + t !== e._ground && + t !== e._rootMesh && + t !== e._skybox + ); }), - c._mesh.material = u, - c._mesh.parent = c, - n.faceForward && r.activeCamera) { - var l = r.activeCamera - , h = a.x.Forward() - , f = a.x.TransformNormal(h, l.getViewMatrix()); - f.normalize(), - c.rotation.y = Math.acos(a.x.Dot(h, f)) + o = r.max.subtract(r.min); + if (this._options.sizeAuto) { + this._scene.activeCamera instanceof xt && + this._scene.activeCamera.upperRadiusLimit && + (i = t = + 2 * this._scene.activeCamera.upperRadiusLimit); + var a = o.length(); + a > t && (i = t = 2 * a), + (t *= 1.1), + (i *= 1.5), + ((n = r.min.add(o.scale(0.5))).y = + r.min.y - this._options.groundYBias); + } + return { + groundSize: t, + skyboxSize: i, + rootPosition: n, + }; + }), + (e.prototype._setupGround = function (e) { + var t = this; + (this._ground && !this._ground.isDisposed()) || + ((this._ground = me.a.CreatePlane( + "BackgroundPlane", + e.groundSize, + this._scene + )), + (this._ground.rotation.x = Math.PI / 2), + (this._ground.parent = this._rootMesh), + this._ground.onDisposeObservable.add(function () { + t._ground = null; + })), + (this._ground.receiveShadows = + this._options.enableGroundShadow); + }), + (e.prototype._setupGroundMaterial = function () { + this._groundMaterial || + (this._groundMaterial = new Jn( + "BackgroundPlaneMaterial", + this._scene + )), + (this._groundMaterial.alpha = + this._options.groundOpacity), + (this._groundMaterial.alphaMode = + _.a.ALPHA_PREMULTIPLIED_PORTERDUFF), + (this._groundMaterial.shadowLevel = + this._options.groundShadowLevel), + (this._groundMaterial.primaryColor = + this._options.groundColor), + (this._groundMaterial.useRGBColor = false), + (this._groundMaterial.enableNoise = true), + this._ground && + (this._ground.material = this._groundMaterial); + }), + (e.prototype._setupGroundDiffuseTexture = function () { + if (this._groundMaterial && !this._groundTexture) + if (this._options.groundTexture instanceof jn.a) + this._groundMaterial.diffuseTexture = + this._options.groundTexture; + else { + var e = new je.a( + this._options.groundTexture, + this._scene, + void 0, + void 0, + void 0, + void 0, + this._errorHandler + ); + (e.gammaSpace = false), + (e.hasAlpha = true), + (this._groundMaterial.diffuseTexture = e); } - return c + }), + (e.prototype._setupGroundMirrorTexture = function (e) { + var t = je.a.CLAMP_ADDRESSMODE; + if ( + !this._groundMirror && + ((this._groundMirror = new Wn( + "BackgroundPlaneMirrorTexture", + { + ratio: this._options.groundMirrorSizeRatio, + }, + this._scene, + false, + this._options.groundMirrorTextureType, + je.a.BILINEAR_SAMPLINGMODE, + true + )), + (this._groundMirror.mirrorPlane = new a.n( + 0, + -1, + 0, + e.rootPosition.y + )), + (this._groundMirror.anisotropicFilteringLevel = 1), + (this._groundMirror.wrapU = t), + (this._groundMirror.wrapV = t), + (this._groundMirror.gammaSpace = false), + this._groundMirror.renderList) + ) + for (var i = 0; i < this._scene.meshes.length; i++) { + var n = this._scene.meshes[i]; + n !== this._ground && + n !== this._skybox && + n !== this._rootMesh && + this._groundMirror.renderList.push(n); + } + (this._groundMirror.clearColor = new a.f( + this._options.groundColor.r, + this._options.groundColor.g, + this._options.groundColor.b, + 1 + )), + (this._groundMirror.adaptiveBlurKernel = + this._options.groundMirrorBlurKernel); + }), + (e.prototype._setupMirrorInGroundMaterial = function () { + this._groundMaterial && + ((this._groundMaterial.reflectionTexture = + this._groundMirror), + (this._groundMaterial.reflectionFresnel = true), + (this._groundMaterial.reflectionAmount = + this._options.groundMirrorAmount), + (this._groundMaterial.reflectionStandardFresnelWeight = + this._options.groundMirrorFresnelWeight), + (this._groundMaterial.reflectionFalloffDistance = + this._options.groundMirrorFallOffDistance)); + }), + (e.prototype._setupSkybox = function (e) { + var t = this; + (this._skybox && !this._skybox.isDisposed()) || + ((this._skybox = me.a.CreateBox( + "BackgroundSkybox", + e.skyboxSize, + this._scene, + void 0, + me.a.BACKSIDE + )), + this._skybox.onDisposeObservable.add(function () { + t._skybox = null; + })), + (this._skybox.parent = this._rootMesh); + }), + (e.prototype._setupSkyboxMaterial = function () { + this._skybox && + (this._skyboxMaterial || + (this._skyboxMaterial = new Jn( + "BackgroundSkyboxMaterial", + this._scene + )), + (this._skyboxMaterial.useRGBColor = false), + (this._skyboxMaterial.primaryColor = + this._options.skyboxColor), + (this._skyboxMaterial.enableNoise = true), + (this._skybox.material = this._skyboxMaterial)); + }), + (e.prototype._setupSkyboxReflectionTexture = function () { + this._skyboxMaterial && + (this._skyboxTexture || + (this._options.skyboxTexture instanceof jn.a + ? (this._skyboxMaterial.reflectionTexture = + this._options.skyboxTexture) + : ((this._skyboxTexture = new Xn( + this._options.skyboxTexture, + this._scene, + void 0, + void 0, + void 0, + void 0, + this._errorHandler + )), + (this._skyboxTexture.coordinatesMode = + je.a.SKYBOX_MODE), + (this._skyboxTexture.gammaSpace = false), + (this._skyboxMaterial.reflectionTexture = + this._skyboxTexture)))); + }), + (e.prototype.dispose = function () { + this._groundMaterial && + this._groundMaterial.dispose(true, true), + this._skyboxMaterial && + this._skyboxMaterial.dispose(true, true), + this._rootMesh.dispose(false); + }), + (e._groundTextureCDNUrl = + "https://assets.babylonjs.com/environments/backgroundGround.png"), + (e._skyboxTextureCDNUrl = + "https://assets.babylonjs.com/environments/backgroundSkybox.dds"), + (e._environmentTextureCDNUrl = + "https://assets.babylonjs.com/environments/environmentSpecular.env"), + e + ); + })(), + tr = n(42), + ir = (function (e) { + function t(t, i, n, r, s) { + void 0 === s && (s = null); + var c = e.call(this, t, r) || this; + (c._useDirectMapping = false), + (c.onLoadErrorObservable = new o.c()), + (t = t || "photoDome"), + (n.resolution = 0 | Math.abs(n.resolution) || 32), + (n.size = + Math.abs(n.size) || + (r.activeCamera ? 0.48 * r.activeCamera.maxZ : 1e3)), + void 0 === n.useDirectMapping + ? (c._useDirectMapping = true) + : (c._useDirectMapping = n.useDirectMapping), + void 0 === n.faceForward && (n.faceForward = true), + c._setReady(false); + var u = (c._material = new Jn(t + "_material", r)); + if ( + ((c._mesh = me.a.CreateSphere( + t + "_mesh", + n.resolution, + n.size, + r, + false, + me.a.BACKSIDE + )), + (u.opacityFresnel = false), + (u.useEquirectangularFOV = true), + (u.fovMultiplier = 1), + (c.photoTexture = new je.a( + i, + r, + true, + !c._useDirectMapping, + void 0, + void 0, + function (e, t) { + c.onLoadErrorObservable.notifyObservers( + e || "Unknown error occured" + ), + s && s(e, t); + } + )), + c.photoTexture.onLoadObservable.addOnce(function () { + c._setReady(true); + }), + (c._mesh.material = u), + (c._mesh.parent = c), + n.faceForward && r.activeCamera) + ) { + var l = r.activeCamera, + h = a.x.Forward(), + f = a.x.TransformNormal(h, l.getViewMatrix()); + f.normalize(), (c.rotation.y = Math.acos(a.x.Dot(h, f))); } - return h.d(t, e), + return c; + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "photoTexture", { - get: function() { - return this._photoTexture - }, - set: function(e) { - this._photoTexture !== e && (this._photoTexture = e, - this._useDirectMapping ? (this._photoTexture.wrapU = je.a.CLAMP_ADDRESSMODE, - this._photoTexture.wrapV = je.a.CLAMP_ADDRESSMODE, - this._material.diffuseTexture = this._photoTexture) : (this._photoTexture.coordinatesMode = je.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE, - this._photoTexture.wrapV = je.a.CLAMP_ADDRESSMODE, - this._material.reflectionTexture = this._photoTexture)) - }, - enumerable: true, - configurable: true + get: function () { + return this._photoTexture; + }, + set: function (e) { + this._photoTexture !== e && + ((this._photoTexture = e), + this._useDirectMapping + ? ((this._photoTexture.wrapU = + je.a.CLAMP_ADDRESSMODE), + (this._photoTexture.wrapV = + je.a.CLAMP_ADDRESSMODE), + (this._material.diffuseTexture = + this._photoTexture)) + : ((this._photoTexture.coordinatesMode = + je.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE), + (this._photoTexture.wrapV = + je.a.CLAMP_ADDRESSMODE), + (this._material.reflectionTexture = + this._photoTexture))); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "fovMultiplier", { - get: function() { - return this._material.fovMultiplier - }, - set: function(e) { - this._material.fovMultiplier = e - }, - enumerable: true, - configurable: true + get: function () { + return this._material.fovMultiplier; + }, + set: function (e) { + this._material.fovMultiplier = e; + }, + enumerable: true, + configurable: true, }), - t.prototype.dispose = function(t, i) { - void 0 === i && (i = false), + (t.prototype.dispose = function (t, i) { + void 0 === i && (i = false), this._photoTexture.dispose(), this._mesh.dispose(), this._material.dispose(), this.onLoadErrorObservable.clear(), - e.prototype.dispose.call(this, t, i) - } - , + e.prototype.dispose.call(this, t, i); + }), t - }(tr.a); - Ht.a.ShadersStore.rgbdDecodePixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}"; - var nr = function() { - function e() {} - return e._ExpandDefaultBRDFTexture = function(e) { - var t = e.getEngine() - , i = t.getCaps() - , n = false; - if (i.textureHalfFloatRender && i.textureHalfFloatLinearFiltering ? (n = true, - e.type = _.a.TEXTURETYPE_HALF_FLOAT) : i.textureFloatRender && i.textureFloatLinearFiltering && (n = true, - e.type = _.a.TEXTURETYPE_FLOAT), - n) { - e.isReady = false; - var r = new Wt("rgbdDecode","rgbdDecode",null,null,1,null,_.a.TEXTURE_TRILINEAR_SAMPLINGMODE,t,false,void 0,e.type,void 0,null,false); - e._isRGBD = false, - e.invertY = false; - var o = t.createRenderTargetTexture(e.width, { - generateDepthBuffer: false, - generateMipMaps: false, - generateStencilBuffer: false, - samplingMode: _.a.TEXTURE_BILINEAR_SAMPLINGMODE, - type: e.type, - format: _.a.TEXTUREFORMAT_RGBA - }); - r.getEffect().executeWhenCompiled(function() { - r.onApply = function(t) { - t._bindTexture("textureSampler", e), - t.setFloat2("scale", 1, 1) - } - , - t.scenes[0].postProcessManager.directRender([r], o, true), - t.restoreDefaultFramebuffer(), - t._releaseTexture(e), - t._releaseFramebufferObjects(o), - r && r.dispose(), - o._swapAndDie(e), - e.isReady = true - }) - } - } - , - e.GetEnvironmentBRDFTexture = function(e) { - var t = this; - if (!e.environmentBRDFTexture) { - var i = e.useDelayedTextureLoading; - e.useDelayedTextureLoading = false; - var n = je.a.CreateFromBase64String(this._environmentBRDFBase64Texture, "EnvironmentBRDFTexture", e, true, true, je.a.BILINEAR_SAMPLINGMODE); - n._texture._isRGBD = true, - n.wrapU = je.a.CLAMP_ADDRESSMODE, - n.wrapV = je.a.CLAMP_ADDRESSMODE, - e.environmentBRDFTexture = n, - e.useDelayedTextureLoading = i, - n.onLoadObservable.addOnce(function() { - t._ExpandDefaultBRDFTexture(n._texture) - }) - } - return e.environmentBRDFTexture - } - , - e._environmentBRDFBase64Texture = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR4Xuy9Ccx261oW9q5v/r7/33ufgalSbWtiTJsmTZOmSdOkpVKsWhxAxIJFQaCKUkpFiiBFKjKPh3PO7hjb2LmNnYxtjbGtbY21rQGkgCgiIKPMM5x99ruatZ7puq/7up/nWd/3bzzABjb/9675Xeu5hnt41rv8s+evW9fz+ZT+W9N/63o6re3v+nlfvq2CbdZT2hbW7dukDbf/a/9uS3G7E69Ln9PifK50sHSMvD2ur3+XY/E2++dyPelDPoU7Jm9XTm2uab86vJ56gvSd80dzXflA+Zul74PHwGuGv/MXLv+kL4Lfp56r3DM8ef6utE10Xnu97fra7uWi2/etZ8BV/F3F+fdni/8Dn9O4KSvt/cxPMa+HY5Qx024OHF3cM7zHdcsy3uAeuu3wPve3S2OVthHH09v5e9BuCT0HHgPlHsjz+3uxNALYAJ9JgAigALyBmQGPQEcAxwRQgVhIogwcIoAG2HYsM1gR3IokEDD5biMBhMeSoLXkweCoAxsGcDoX3Xi3nkCFACnfiQaPARECgPaVAMZjEuAsNttAjIBZSY8HXHkuFctt4Npj2e8+B/ImFOnwEcg9SPEqcNdyDBSZemwipBkwmvMwocG9Gm6nCDUisHpb+iSRTp+2kQTQAJ9cACt8cwRN/Ss5IJBJ7a2qC0AHYK4gUkpuQE2uoTiJfMPw4epjeqdRXYE5Rhu0me7aGCwIKtfFD0sAmklCgWBmG3utbfCrfdtlBUpK6qUIpwCkkUYDIg4yp4QhAeW9GDBwLR6glgysC8PvZq6o2MJMT3jdhtKqI0WiMfeTCMhs54BqzwNPyLueclxzS/3+XQI0jtSSQrmly4ecv249Z+U/gQOoNj+HBKj+yhGEtn9/2C10qLaWLH5Tz6KykeI3FTb7wM0uRJMWlZtmQwgXFgAr23VwDGRjADoPOgMIQ1pigNdnCrbviaqvFMopuDpvHjB8/RXoeI8ydGp4RAM2x13NzQtr74BkQoFZlceBDQTugIlaixa7kbn5nl3wNgVNpxGKi2OvQxJmjOJ24riNB/sKX0VJPS/zjNfTTgAp9s95AIj9K9DPqPQc22+nS6C0eYAGZJMLyF+sPPwGVggXypcH8HggA5gwbCjHhy9v1Z7yDIY4Gie3nIMGrQHUUNVBVeq14rnyOeiBvWjVl8QgQoZ6NajErESk0n0wx4CLFLuXJ5gOE4J8gtV4cW2RlYbvrO5lVWMk10KU6lpwrHbBr8cHn8+EMdH5YPl2H4gANhCmPEABLTsBp/5k+Y1TwGReWlGTgqiy6WFrxXcEQQTilLw8mUP5AIh1pbJnTgUrOiYIVBZKMAXqW7GISigAyjbYgkWfyyqyTTI5ZckLokEehQNxAs8TYMHF8X3w+3kSrcc1qozPAsAUqbfLX8B5AKgyFGBidOcIiB8JAMdZWV4fGak/nU+Sd0BC266CANbTqdp+zPZHmX9Uf1Txju1HxS6DbeeAZtOtavtKAILAhw9B1aCNjhyJELDZrldlFwRB1YT2nJtUNnVTBPJ41Y+dAQwOE2eD6+EBWZ4FDDRUFmUn7ZiLzjkgGbgOTTTintG1y2QiuKh2ZSKrLoDDVt4RI90jc28CMunnC/AK27iBhEB+FHgme78rtk2w5b+vcguSAKLyH5YCfT6ghAgFeAh+H9PXBxcBPiKICjo4fnEE+ODLk1NJQ7M9PACXK2iqgTa1DTpPHo59FYGgNZuM9T1AoBphFMIPIhXPMzG1Q/jBVYceAobVqCElHYo+uzwBPKvGyXBuY1O9YjZBQzOP312TK4PAVjDw/Hn/p5CEJKI2puq15C/jXFz7kiZB2CPLckzzzIPjlMtbPuT89WtK/rUSoOkFMDV/KvflEp6pCnCtH614yRPU0AAScxjvlwGABFFGlgQ12MJD+QCt7HX88bEE2aRFFnhGOdBO5hWsLDOx/mzZT6meSgAa9cLrYnA6O0yqxSDpbG/uFRAXwDWPYUsG1s2Le91Yp8CJsK5VM6wYUJyMGLLqjESsCcykC80XsddknltlRSC/fL+GBFAdXXw97fDrafnnzl+fG4FyIrAAPggD9nsTNQIhsLfziwqAVX+r5IcqAQKMxZlYUBaSQVUog4jWgXJhCGKah1QlQIUDZlDSQCm804n1+6rfQOAqEALA0SCMcwdeqZyqONKIQBsAVoBWKlcvRKnq6YHSKmAa/LJKUZFBJMf3tEdeJvmGY05cIx1XkXIlH8re8/J0SeK6I3LMvQCSAHQYULL8OhfApT6X2BN2v4YSRxW/Hivf4ALcScuPAx9JxxIHwKY6AXiIfC5+mHBNj63rW2cAwyMiDiQnygJ3AQzEZ+6BG+iCGBQ4BqD1cTHlKFTJUA3kyi0RyHF8EAAVWOg+vBCSqLeMFFnct64jOXAcW6SM8wHbLcgEUNT/3BKA2BJsWnoFAahKgGv79V2Bs5WAWkbkHAAMirgnoA1ajN8REKHay/IesCzkDdrzfMR6/B5moHuLORMu1PtKipbG9wGldsSgQVSpqdkWECRtRcPyn1DQGTVvl+rPh7pYOA2tvKxE8DOBJJuq+4/i7rj0SKpN9zA9QpFQbV9EtBxbZ1uPUcYDuAlDAEn5z83i7yRgld91AXZiftMXkG9oAartCqQKQOgIhOKHMX8elsbWF8mgdRSnm0QfJry4SoCEhAwND9EMjFE+wCXXJlS/o7ZK9RXwDhNDl0jsgJ2r81cpz8a0MpfrkJNA53sQqWsHXI8mCXZdCDImRAHmuvljjiO+Z+0FUG5GCMLy6/YcAAB/B30igdOZ4/2dDRJBIKCNQyggxfheNfn4kh8qsSGKei6v5l7VDyQEcSBzWIEKgDeTtkubWQvKg5StfBsXI4DDd2ky2EBirkt3pw3BXbFnQdjGVqSoj9weBi3fB1QqHyaIe0FEZMmmnigfNqoYwDOge4zg1AovQhcCmflOgjgbX4jrCLavWzpCa8/EOQ5xXds2y687f0ObDchdgC4M2E4wqAQYYsiDcrcRDSjVRRiQlQds/5WzAE3mHSoJlJGfIoeW8jezBDON+R7/URIQE4IyJvcJQT5XSzqCLhHJtOFN9pBVh0iil5U+5BhUnM6qw3G2UOCo4w/hkNUGtDWIa3mOgVC8CsjhtVhSN/c7ALl0J0Aqs6BkUkASUWMFiapFKoLwRCgBBJCUf9wE1MCswoEKdOcSChlQf76y8PlOGkeAeYZCMkwg+SlJ4PfIQal9uQZULKW4sAxVi2N1rr2zMusyXx/cKtZXqtrtFJxQ5C4xKBWeARc7D6F2GlAQLu4j3zoRoEwXPqRTkKMBMJt9pWLWAZbX2mON8gDTyTl4Jgbc7lrFd8HxiPdH3N9tkSGAU24DtmU+7gYsTT8lHGjlPhPz13gZFV01BWUbpWr+tazYyMOoI8TkCKg4ISgUtRIQcDwk9xhQ0u4jIQHL6m0bqDn5xANopvZ/vMZfvpGoYbscRNWbLEITA55VGMhAkZMrsfYAqQa3JBsgBiKJUTKuOg9x3PBa8ZljsjCqZojlqPIy/CFCMg6pfEe6ZvNdA+JbPrSGAG0egO36C8p+KTtYe/ttGZBzBKz+uv5fzotMPQLz/r3YRbhqAYDOgdvnDDzJIPNb4BxK8kX5AnQghqk74cJAubXqB7aWBodSMnU8Qw8MdHPMdv/cwOUEnhvEvnLRxnusgD0n0AM5CgmCMp1T2epj9ffu8XuJQFLwEZH5Z9OIH11FJoACfnohSNDwo63/DBnkyyo5gTDbv329AtpokhAOKtq23shiD21ZxIUW9VBwHACYsdomk5+HEiiTGSQ4uCsggqYg/L547mJyMZ5mNqdKRc0Eq0HDAMNrZyJS5SfaXlpqvEfRwOXjRKrIcxoitWUSI8WcUth8TYY81LPoJQs75+2SSM9F0DUYcHfcRLvFgijzdyAC2DL/rQyIQEdXYGYE1jKgz/Tbkh/Z/5QsqH3jBpQqL4AM3Fmv3QOFEDgoe9l/tZ1RAuEsROLPKo6v0VpVoGx34bBDYBxUD14EMQwciGp+CgGggMeOgq45Lnd13MZR8gjAFfYNDBUcoYturN7MmtMwTolJOoN35Ca6oUS+1uVDz38tVQFKAhBagBvQC1gpHJDgB3vPiUAX00MG38TzXtGl1e/lDdJoM5l9vGH4EF03IA+UMkBRPY0TgAcrcgpISra7TOUDhKswpBN1zen9npIAVANdDjrOHQycROMOr0xy0KrjT4C5FwO3R6nU8RHJwgN5AKPgh8EN/iRKaIJDafeAvmf+uBNAUn07GagP/jLYIkIoNzB2BVb9i8x5R+DsugFj277adAYrzcjzFQIkCkhYssIpYKtOQUkedI4qUlXeoQFmPkloQhPhPIrtVVZQgpsHY5DQi4A1TRiVw/ygNMqnnErPDgsw9TLz7lwHbPhIofsE411geVYtgtDEhFUPXVZUY8o7jMQR62n556sDaM1AUSlw2ASkbH3JI1T1hwRhecBQMTAqraw+EYCNz2dife4baDfHJRyNks3affEAYGCyIk8lEVlRZdKunVcBVA1YNUiniIE7INmhUIwMmmVKcxFIFGGNMvDTYMZcSrnO7BbbRzxae+6ufViQUZR/wX2738WFVoIICgYKW8jvQd8Bt4Xx6Aggeh9AHPejamN23ycF7Qs/mouoFrmC264z+yEYOKPP5ABZ9y64VYJOOYfIFaBSSVeAmWKRA0DlEqpbH2XFePkjHqj9TH65v6gMKfw0lpHPpxS5objAaP5FmjOhQ5PEdnyRhFMEV3cdJe3w/uNZguVpk6AiIPMABGJ1X0ffyZDUCNwgavB9SviJbiMTQGkCyglA1QFI8bypBHAuAOcHRK6g2K1uHK8tvrTx0/kAn2TD47Ux7sOB+shrdn8yhqfKASufBbi2h2FPQX7WXdUPiCPt6hUujXs7aB9VGmTnMhrkADgmPaO+Qez72CafOfdQb6JO1Kl7xgpNhDIq5Y3W1+cXOJiZ9cuH7SEA9gCUeQC5538v2aVLUZWApt4JrOkhROqPDoG2LczZrQBwchCYeBjrk+pB0rFlrGEosLswrD/OFdT7AgqGg5oVy5NLRXZ+vAKoA5C6hBreI3YzNIja9Qg1AdVvY7oRRpQl1wAVDUk9hVXKq4gDvh9/g6LgziGMQExuxwBMuIUeifVast11dZJ9LCYu1IDxh8pf/l4+7PyNtQpgfxUoE0EH/GWAaTdQ1EWECFV1RO8ArwubeoISotjfgFGp8UDRe3G6BK4KKYq5xhgUH6wAJ6s6D6gQpBznsvLwgAqsOEK68YO3s5bMhD09AlACWQQi5VIM0COwiuWjmDx0FjzvgxW/13pcSnnm2dC9jZKl5WGIHhFNACqPkc7lCGCU/TcuwLmCMeiNQzDg7gPa234RHqBysJPAhxG6hbhfwKgpxfkxMAHCgmTUwJtOEiqVrC61/EFg7Ci3AppXF9Atdh+kuFUdFaCFojm3IgECEBeK60kKAHUoZhfuS4B7lAcwKh8kHHUmH0u9nhSqkjviFgRiXI1fXwmA3wWgG39aP0BR1aPqnwY9WGhX/89DsRsKiPZfyAHg4EOlaOAC8jDEAKZOuQJUdraYUtl9vkFZP6tmgyShUB0GD37PSLldTG8SgA0AQ3VXRAT3xrgIJiiy3CoB6UDEJNa+YIYoJeciRxERlrPMMCaCZKLKvxSQmu/vzhkkEtnBgeIj+PHK6nLcNpOkeYZ0rOXX1xCAXgZi2oCx3s+WPq8zbiBfmgE6lP/KhWGcXZfBvji4iBAkmA2ZEIvS8QuBpfthldqqIZUWYdA64OLgRIUS2fUjrgEJLSozuUQmgUu6jXAbqxSOLAJra++HJ1McpC9K8Q8fRyQ9DVgDZ6G+W+WKSgxarVWoJglCnHtEIJVTpkuB9hozAeQkYGc6sCkD7oABN5AHeHUDBVTlC5mWX6X+jRwQmCVcqOUpTtzV4zfrjsAyYQMCV8XonbLfbPa/PT/rYurDDkkBO8/INeQnzOpolZlUipXWKEE9IDQf2az/oQSgIRGtvt0KRUURfiMYpNWJtaGO5SyrblSVKcfu9SWMzl9DEQ3uci09lY2Sn4ZAQDzqZZdzd8qY+OQrwdKxdJiR7tXy68//X2sF3kCArwTLLiCe/PMY9S+jEx2BBYyr2e+DQOQITJ2/Dex54Jfz0r4DV8AAQXWwyq7sPHK6Tc6MrHy8Pg8DVhAR9w5bgyN1V+oULkOw4rXZ5bpa4O/ZSKGZeJ26qnzFvlGrKjk1N+sZZoqgAoLo5R4UuTNpmVKtPgcLVCWC/B2ciwDS3gmgtgLvBJB7Ajrgt/kBTPwBkKlvIJ0zWF8v6A1KBIaVgTYgfaNQ0C8gyMEMD6oy1DME+QPnGsiiIrnU8wDDj9aPzh+pUDsFERYMHv7eJjwZqa5UdgzbiEQiIA2TewFoRCIyJhrhToj8nMqO1rcHA+a9XKslGA9g+508AYr1GCLAd1/+BXAAGwjw58AR6M3ed6x/vhKb5KOcQQXQRE9A7ari+j8QyUR2P3QEMJhVlaGJQL6hLkywKoKgsU7AZs8ZXHbboHKgBgwmKqMBxZliBbyZBKDscAs64jjnkVlGWWG+T45EgOwiwmF9xiYmDUzqeETVVSVRhKgkDiCIgFh0olCQaxl0ZmwSGdbrKTgYrBfHLGQHBFC6AakBCJOBEPcnV065AEwEFqA/QvVVCIBKZ5xE/nLVHnNVARUbB7/L8nMeQrgDAQKfjGykYHQDHEAT+UIsvgUX93XlJgFqoxKiPDSTyFMJNbmfcikiuabAzddpwTtSvn4LrrpWbvIqAx+eLiwSSt9UwOZMRNLNPDNa71UaQatzJ6b7kUBfL1qRNwIer9q4knS1mQC2o9gZgbIfQCT+ynYtUUd5AdMViKQRdAIa1dfJQZkPeArw4cZgXBqWDYGd8VraYhjmLuGo1mUYmAdkE4M8gJAQq2ry/hTj2n3QlSAcGilFaqxUVS/zyuSB0FfPIYmMlLKj6JbwgHxgRgS3RHviCPaTBGG3rcajNolZUnDrAxvfnqQ6vsqptO2W33D+pjVNBW4EMAX+mpgTicCB+isAO1U3vf0+BHCKT0qPA8e4B8wH4OCJYvSIHBhcYP10M0+5IpX4U27DNiXVLfA8Nc4m5arPt8AyyI5z9yHeQ1CR2BmIwa9IyBCmrezX17mRarXsugaNTiBqUnMuw90fIiqZVwDiFm6nKLJ1AUF1xXzXvAfdt6b+9GzpXsq8C7uPzrGJAHJ8nysBhgjodeCqDFjdgAoFirJHGf2q4FAdEACtpcEg9m84toM/zgMwucBwCcOE3ja4DocenKehOQ8FAdD80FgBR+VAsz5oJXXVBGnpo9IgAaHIlEzqiZJm+cYAQgsee96oEUiXtqicWiV0UFkogIzICwEb5DdGuQv3Pei+heszmKOKST2MChGUWBA5VAIwrwI7l5Bgu6HnWoKzbcDQHASKb+P3fqJPdwQWRmTF7FQIuurPwLPHxRIK21NPGn3gcznGOQ8kNBp0DQ8+HuQEEqtMz3HUKzZOJjOQUsIjQBYOQg1Uc71MbF0CadfplLXadOuompaDc+BkKbkNXaf3eZlCVPIc7CzpHI0g8nUJVVbfsQ2T8n2UI6IxI1xCdOzlN9YQoDQDbe8FhERgbt1V4J9OBAbqb/IGBGIdJsCtL+xmQgUcMAeB784/ytzT8XF/UFRHMNW22wHGCSwNavH9m4fQvw6rADeZ9T+UAKyXpgajzrp3yWKkxhVHHhBIvDqRZgmQXZMBemCfdVYfBIJzAJnoXJs2EIUF6YjY7Pdmp9gNIeDaMgHAj4PWXoDtkEFFQM73L3YvhxGh5QeFB9uf8EPqn8MFta5lxicnBWFyUYAVb6AELSaTEECsmAQu88B761JbCoDY21a53rgKqy5tiMCzKYqr5hQAOcnYUtnfIAutEmxqkJprNM+lkV0BZEhITSYLzGCIE1BCQNP5Bq6Bk7+Pdwd4B5Q7EOsFuTwqRNheCZYcQHkbcHshSCnxuV4A/jFQfBlIeYBmYk405dfH+sZyF+UqD2yg9N7Kl+FGg79Ty4+B3x7MlKJTEonBgAPZgjpI/HUdxcgV4MAOSKVnXwXo+ZpN/MrJVACnsqHqWPCNAFeQ0wESa7dGOQEPKHUNVbfrIQJ1LeeVYZK4z4bQ8Vv5a023KfiO+R46sgzcZL09kBeI9l1+4/mbN/mHFuD9F0HbLwTz36jsuQ/AN/6gkkfvA9BqX8Dis/xC6UmJnYpPrEfTZh6A3Nc/JLTqbO8Q+EhubVwASdXxYZOX5vqGMwEVwPuuQCWfZJKQBvMoL1GPaxQX9pIJqpjMKvakSxGACpxJlFTUSTigC7heF88XkgOCiIiGn2fbFfco32eOiKYqAeIat0XLbzp/M5QBs33fQR8QAai8aQTC5aYKgKFBUThUf87Ccx8BgM6oNzkItPjFPTCrKhuP24ZhAgGfVLGr6KyIImRQg9JE0nCMxhNtkDThEoNoYj5AwyjqBAxCvG+gvjFRdNQuOpZQS6da/KzwWkid00ehqJ0SnwPtTBhQgEXuISYARYLBfYfvh3c0x4p57ey+QCYwnoAASuafp/4CKewAwex/+Zxv9nZgUb8vpbum7pFDyF8TcgNVI8sorevK47UEg8ozCgvatqzEVoWdsyiDC9RNq71NJFq34bPMdtAUxwN7KdVUdlTZ9oESm3MH/fXOxaCq9MDZBUd5fm2IF/AmTrAqaIBAoDeupJbP2pgyxz2YpHNkVMVCX3ev7DdFDkFZ77H78rMrrmEngPYyEHgNGAK9/G1e/rkdEsGnGoJoPbkESRZGhZV7sIBI4w4AjAPRxfvgNsR+mA02gEbwUJwW2XxUZSQQHhhORTtq37Xdw1jdKw8PJhfCCHWzRDGX3VfgmU3oKVDX6hESEDXq7gPckJIFKj7rxgXGdxmFtc8Qj6X2IfdBBBiSQyUtrdae/Cw5soBUA6Fe457PtfyL529JIUDOA4zj/5wfcFl+Uv8Cyv1fPyGIXUF9qJzsK/sX8kDgvmjg98Dds/ITNp8HHD4sV/Iz5ASDbdrOm6Nn4dMDdQR6c91RYxERhVbi6v1LvcNodK8jEMm0qLgnlQw643SM56rnLeQQqam7/nwyvhfhtcgkYQ+s+Iw1qfq8g3JGR4ljPVUCaD8NHrgAUv9qz8yEoPIQAPR1fRz/s5NA6yfXdeL9+sghVJBWf+QUCv8juGFwNUs1b/OtW4hLfiOVta7BJv6G+wK5WHgoK56PRqDqkZkFhQU9g3Zs7wfhwahsicXAA0k8b5c7RIJ0NqX0mpyNWpOzKeDvJSoRM7h9OW5EXjsB+IlA7QdCqyPA+B+TfEgARaWd+peBVKgUwoVyXKfwvvMvjUNyFEYto3xAuek+BEBr13IGloVtOFCecgA8zj47V4EwaPfD2Ds+hrBwOEhZyXqOYgz6QtRsOK26uHNWMIrvlwd0e35+WNZB28s/IDDEPZKKPKveKvSiONw5BnZ+AriRy9AvFBXkQLmK8TV4Z9AjjuXDawiQmoF8CHDOoZRN/tX+gEoMj1P/FB5YgnDhgWgSUvuZUEMQAzqBpwMfHoXLFtsEHrNzE1TKUsvqAgEK1NgMF1I4BttItbsJPpOMixVMkgJcL+totbXDRF/sBBQg8I4VUmA6a+cG+w0AlrkHcR+c46lSHt+n0T49wKLzZKW398ITgXcB62n58PNf33MAthcAMv9VcYNqAMf3rgowjv+bwgrVL4MDlLRsL/cbAL8OQgSb+duCMp4S3Oxtcw68Lw675j56au9jcmWjtV1HYnFgm+jbj52EGsyjBKBSsyISFnSPyhlIex+7D3zuSArOEWUAPzpJSC6l3aUeIPF+BC6g7k6iYVzH8XXLb84E0H4dWLgAsP9NnSnpp0KEieRf2P4ryn3KiiuAovo5q6wqA5k0pCsg++1i/4w6va+107gNDzzMitvtKHlH1rer3NyRWAZLHkyjBJ9TjKjSMJNxD5yLUUPlYtQAN66C7g8DePaYBrgBCB05WOAyAbfEnQd4RDwtQekJwycCJ4jDuBrafnspKBIA/zYAv/EnBH+YB4jVv5f1d4pq1L+M3sZ2lRhggCrga/UH1uxYcEM09T6O9oXH7MIEP3XVkQsA1g7J2BU4YglBP1JjbbuVMjoiyYRqwG2A7PMMChBMmH01zQ8lJJrYkdiyYgOJDgM8Idvv+QSlB7JSdj3zD7yuZMbmw/ehPMd2PysBpNh/awkusX6uBvCEIIj504AtMTyDfWYOACblbAKvHtuAAFwHVQKUDe8n7wLwhkk7aEWmiTvTIYBxGp4cTOynLLtLOlUpd4PCVhzsQEG3YYGn+9Hx+yE8HMA7A5hdzWOPo67XLVP19OmQge4VEddjkncezNS7wudQHYyQkORQbVglMC7VuoDlt+whQJkKfLZTgWuv/xYW4Cu8EPTb0Rns21dGQOdbMFEStIm8OKtvjm+ARUAVZTwXItD+VhGA2CoF21jLuwOKRTlMoHp6D2BmrgFl2lmhXJkRtscrMoAR12bXazvMdtcOSriyTqZ8hhQcUYgwpKfATHZRgo3vT7PiFjBehe36CJz6nQMqfKGxY8ihF5rkdRQelXujCHdbtvyW87fWRqBUDoQ3A7vaP0wSUrMAwzxAuTj8t5MczIBM/2SCQZCinQ5i+sO5ASQsJhS8HnYk+bNT3CrO5YECmeVR5MKUolz0EC1h0YCr46UMjo4rgO+hgBCGIK7WPUsKSk1F/wMMcme7a7QD95FaiUys3S3nIQzstT0pDDDXb7+fJwx1T+haypgSzkCRswW5vU/9dWsigNoHkJ1AfSFIN/lX7H++pAN5gJpbQIAXJar/ti/Ssv4wyFG5wFnIUh+WETlhxbF5RCiGBArIyAmoZBiHFHUbfJR9cjAPvVeSU/0DHdAjafE58D5GgxiJqausQGgqrjbLZB+AVso5dRfVisBFSKse2DVzzl4AACAASURBVHG+d6MEnXQYBuiW2I1iK0Ew5ABYKQ+Lehii/MnyW8EBtLn/KRdQau2+5l/WlWQOhwQ2XDBKzgB3YUG5VF8StOEBxFHkCOpgDpJ6VlExD5Fvu0wmwkDq5QmUWyDQtudJqk3TfavOItnhoAnsdQxs0Z+AjSZRqRAVbjAY0UVEg85+L0sdEZAs2RB5wqBHb5IuOyCPACh2//yJvvNjVT0kGHN85VK8Q5gjq57bSOsyAWwjPs8HKEm9Eg5so8kk+loizlcFOO4/lgdw6l3IAQEkljkrLVW8PMzYRbC9MrxqQMiKzQnC4hCs+sgYPSqtuapByaPoARIm9vi62T4LgLSchAKaB5QlHLG+5iLmgcv9ENahoJ62p1R4augyOknCI7F6pOrq/E28OkpPqv441+DJwpNqu2fLbzv/jTYZKHoHwP6EN4IojCqmBHPSrwzgEsO7z+WR6ux/U3FMILJCU4LOOAGt2D5WR863wI6Se2HWP6iHz+QHQhC5EKLdA1ZY7Rj89xvF/3PHVUQEy6AioJyAUbDJON8AonIsEYCZFdghiumuPrp/oduAc1EeIu1iw8WyLCI2v/1YzfWxjIzBhKi0tSGAWgoE1Vf2Pylu3/bXLH0lgDI4JjoDEUhVwRQ4SdXREncU+wiw02EC11CTdnST6/YKEDZDbodXGdWBiprvBI8bwMbWUFYReslGHqwB0PouwcfdTE5IHxYgvKaFaGqf4bJ8z4bbgfriMzEJRoyrxbOIvscbkx8YKD187/A7bCHA5gCO2H9j++nloHZdnAdwTUC9+QAVgOQEjM1v7GrUtpPg06oMLC3zAHo95ibMQOMchCGTHjkUYmvbGEUgxeyp6UhpjUaaQROAOMg7WPUZ9BNUC26/X8uPsmqp+yAciAG7B4iKm8NldC+G+QxwBvOqLr4D5mTYNXTufQG5cnfdEOAj9hAg9QHUMmD9bFXeuYFi+00F4EAeAKoAM6RQkpL1BiPAVL4AW5FZyWViDpR+Yj2/xBETYDiwHNnk5262EdeH3zO00ex08kB0eRFshJnpDyhOgJQECcMM9N51sLrOkoiK1UWi8gg4jboLp9ZTyylnYBwUEVxQTj0GWrzrjSgr/7hQIwoB0vLlI85/s00Gyom/NiMwzwswNf9W/quhANf/XYiQL9pYaVR0tPciJyCBPJcbSLiKLfzICYzW4/HNgxxVCgTAYtLQbsG4jV55sESgFb02HmV7bgc6JTLrSS1ZpgHIce6g6jAJ8BnlDsFJ8fiTEoSkzvI7B0QYq3AP0D4UHIUT2n3g3bGksRMAhgDoAvS7AEQzkLPwg/ZgtX1WwHT/tv9PBIFAzuvH4A6AT6HBKCfg1nPTkJswVAgPIZpvfJR1FwMndBRFUUXyDMHMoIjtfpBzEE7FDjD41MtDRLa23BKqWc8obTsdK5xV3dCxKEcULQuIs+cWIiDy9TyOGHx45kOAdqZuCPCR2QHYtwDTjEByAHPlP1b4WPGLylqlbtvXmwmq2pTZVwIsCJAELCF0bToBshET3PygycfyregzMGpNCpvPa9WlQyiVKAXZwAwBk8jMfvFQwrCQDhJ1B0QGxL1SY+Qc8jWq645UkJ1LlEnnigs7qX4Y0AOWIh+7vSK3uRDAHvuo0kf3YvnI87eBA8DXgQEJgKV3th/yAC1Gty/5aPsE6l5jefE+AFNa65TpyOa3LDUkCKW7gMfvYlNR31dKzfup5J9yDfXUbMkHbkGA0JCOs73aiaiBb1xCvV+s+0CkSCZAXmy1GZyj5GR8be4KTWkLcx+VQ5zDmAPxTOhhibq5EXP9ktRniGFG6Y8Qg72+7ejLbz9/m58LUMuA29uAfMlPZvupFdgTReshwISfU3eXzFOTe1T874EunYABq2jogUFfj+gAzgBosW7XVRS1M0DpE1C6nHiwzIQJrDASjILYlMpE5xsCNmp4AnAitJlyMCQsoBsRmAYnHnkMQnYysVvokcr4PHMu4MhxPNj5/hoCaLG/sv+cDMyXS9n/Rgz5JpdYvgwu+bkdS5MBHkttC+Ymyg2QYvrEnlBgAoTO5ItkWtj7H51DJdkEwVQ5E4m2TCyNu/z+zWx01nFSTrmdXpmKWpm9b2CFFAO6Q3YKJP2kHsIXzh02Hr1IZzCTwDsC6Mcovd3HEn/6tHwUOIBU5qMXgir7X4G8HSQnBct2FWylZbjTDgxlQB3Ti31Nwo2n6qJb8Ouq8whKfO0GCYeh9qm23qvKVOKwALdT17fEg/qjcwus2tH+JibsJRO5dZgSnu58QEbSQYD78XGpt7w8aNm9pPGHA13bZqV+0gkNrj9SanVd6vu/cUpPY8N8D036uwP4qPPfCsqA4oUgNXtvW4Fr8k4QQ+KDTBQYBxelFJbf7IMq1N22uANOqtGXl4lEdhHl0c2FCO1644TeODRo18/AwLgWB7LVNyYEPSA4e26uq7iMKF+BTiOy7k+y+qTYxoHEA1wp2ygHESYIu8DxRL8nDPND8TkD7QLU9U4Rw3LEMVi3FX3fnQBaGZDtP/1GQFX5pu7JNeiQwAI5f20OA5RzYLU1CT6I9SvzdyoBhoCorTdQ9XGIQMnMPGjS5YzDiTqMxACvgyNKJPYqCAjQUd4gg50n3dghawdRS6wqpY4HpwQjXB8Dpw/eHqg6KiiJyV6zVuzHO4oIdMr5jLdFlxMreuQ6zPJKJOtp+R3GAaSOQN//r5KBAejrHAFeT5+F/S9K1xKI+UsL1TbbFgBGlQDTSOStcwGu4feZikAH8F5ZAzdR4u4AEOraWC1kfgJLgNBTkXCvYN7Abs85r7zRfi/C6jfy4cGvVXnG8s9c1xGw9p3IWL29gwgch3mGkdLPEcbyO87fLhyABbyu+2+XyxOCbPkvxWfZ/le16+UEUMlVyY9cBAMQiUKBs4YiwgmYcmO+8dVhRCFCISgcJgAksX+6JxpUbTG4HLbdxjXgMB+dN1DtvJskrIgsHDnOgdCdI7gPeHcUYc0q9VyCsOcCYgDOHLvEBnPEgFsFzmuinDl2EvbYy0efv92XAXcwxMnAAuym1CUkwFJfIgi0xLpKgM6gAC8CehmtCBBSVswTqFhWEREO9GELbz43uo3qQPyA8fE7KRiTVs3Ee5JyuYEpG23bce0w44HmCW2kknZwl2epCO5Y2KBiYh8qtOsdXedTiOTFuwAdxmhio22X2JE1wvGuIDr2TgCuFbh2/gEJkNrLWYHG1mflr0osSAKteRjnA2CgYahl9J9QCSCCqjdJxd8E+C6wjzQCkT2PYvC+zS+E2bPr5BaEk+jF3gZ8naoFq3cIWraxg0qEGsCjXIHdp6fm1i4zqUWqOusCZo93hGimlR7ifeVElt95/tvZAbye1Vr9OCiEBJAI7CYATdyeyQAAzJWDxBOKNMpXpfCALD5P+EkPB50EaIpRXbtN3WoimVdvaAD4ELTC+hp7bNYLUKtrG9h1b/GDMCQ4t3MfnX6AFq8HjijJsZ48BOseA3qkOa16PSdCJJmvcfY4RwDs4/04BBgT0NGQoW2/E4CpAuyqHGT/tynDGaje/mPdv9lkkyfougEIHyIywAlBmYjaw+lVAgY9AZksfPbfDpbqRQSAo9h+FALIfgFM01EfvbTwISHo68d+CAXEkCx6lQkAyxGyGFn9XtmS3UYMlL7CKzDOqLZSVL1MWPLFZggeY9+Z7I4dI+29/EvVAWzgxrhf2P8cX2v7rxOAwzyAidPbMfybg0WugBN3w/gfwgl2EC4bD3kGpdiiStBczAzwMI8xEe/n62U1miOEQO2NwrVr6AHYW/o2uM2A7JBF7zv0VV+rJIO1d42KNOw5tTOZdQFHlH1MPLEjOS1t/BQSj1xVb/lOANUBqOTf5gagGzAp3a7rOWTAfxGkUAFQyj+qEDhiKI+gUx3gpCOBHFVa2fcSNijrrpQ68QKRipnGHAAvE4oE76hKcCRJCDZ96DQOlQbnrHLPjo+sepQLMUCs9/7pCu/A6ADmQ4exNdfPvwdI5SDG5xEhACQLe85g+Zjzd7QqQHUAnYYgWfrLj0V0AjbbvP0FLkFWCHzXYPry+SiDRKGN3wGYrEYMWpGJnwX8Uy3+FDCVA0Fwl7+HuYFAQaOQJo3UTqzuj+fUd7ZSAefqu4Dx9TzdRcw4DSb+Adi7gOzvq92HF57DDmA5nXYCaA4AgS+mA1eHYJXe/IhojadtHkD/GAiCFC23XV5vgEss+gSh3HbGCXB+IcjOK8ArN4Gs/dT1ZshHoUcGKg+WrkuZArdudWWlUlSggRgPdm/dZ7Z9MYQwQxqjfMVRZZ8KATJxvDBnAONk+z7LxxoHwAlAOx/A2X9WfBMWZO2umX3RMhx2A3oyqE4A1FxWDcqgrjb7gBMwHYNlSASdg9RjYBJnXcXWjUAu8abKjgKwsQPR4DFA7XUf1lCD7eX4uAYoHVeCR5oBYJ90WlChLLPdd4Y0bBCy33oRdytg6mX2Pka2fjaRWckmdBZz51s+9vyd5AC4AUi0BocdgPhCD8oTjHoEhpl/DAPIXRSTKpt4fDKvPSBRHTjiBMhZWBXsEAea6lDR2wMsOQl3/IgQzHX5we7IxoEdIPxIAGuw9q+FCSFORs5ZdAb905KDkeX2uQFzno6CI8WUOP1R8T6puiOg3AugHMfyu87f2c0BVNXfS4DzCcBi+f1rvrbLs0RhbXsf6N08Qh34Cjx4XPvQzDU6BwFOoAf4KBk4kdSbDhEq0R0H9egcfQWm+wUDzpNJxyG4ezRDCLGyx4Cm40oQziX1RiQyC1gFdgXI014enFPv2XPbJKA99k4AugrQeSNw+ZWgrhPIQDfKfqAbsJMwNO3FBPpWnYCBaAaeUn3RTVgGOTYvuWUCGIFi1oc6Wt/LPUwpfnM8DOoGpcE2gsx6dr3vTMYhA4PjxVl9/p7tWiwo1DXqMKEuHbTk4r2udp2UWpHuNKg7qq5CEH3c9bT8y+fvSg7gVH4XAC1/8HLQrhPI1p8sf3oUrPzCyqucgVHR3j75lu53oF2HOW/UHciE45pxvAXsWfOwioB2m65TWfM6kCYy/BKIw/2OuwlvzS2wuoSQv7MmJ22z6/GEkvcShzO5gHFYMFLjScU+oOwvxAHMlgE3AtgdwK7qBfD8MpBm/znj75qCMDnGrwwzai0ah0I1t2FBHTzRNGHOJ0jQvwAnAJY8Bi/1LYC9g+xEFiStzDJmh975vgIL4lIW3hHFEeWOlbYHMHvdcyRiieNpIURIENA/z85nTCqaxKaTe9NEcew88vxbGfDjzn9nXdfXoQsQSAAagJK17lQFVJJPqLl8O5DJvqsZhPnyzSD1cwNMVYCPWewzq65JwsFNxWoDgvZgrG9BHoPRgEEkBkcg1/uPY3dJLuh+ZhqERMUgAvc8ITQTPU4GWpWeCyHaPnb7QVKP7k2196S4fMxpa9+6XtKhg2rMvrySBX9/71qicGMnAOsAsAXYVgBUC3CLuVVnIAx/IAP3CrFu1x9CCDPr1hUkXEP4YVTfAs8RRd633SQMM1hl/Dq7BU1PxkYmQyT+4YYuokc6wSBRhFGXdXv6NTDGRBGTTQzgx+zDJHocsGsXrNbNzCt+7GAkiKeqAxFJ9Zbn6ycXExHQ8rt3B1DmARTAp/ZffEloiqMzwNjaiw7AekLeJytzywmg6or8QRAW2ONDzC+Sdq21FwnJ5gkSkellRsUphu9Zf3negf3WwA1A2SEGR0rFAUnCKHdT6fYkIYTXQgQqLG5MLo8JCxjAjyAIysKzo1CZ+lEu4VEO4JFz/1UOwTmAfOzl95y/ew8BUhIQGoHMxKDtkFQVoAqAcQIq2VcdACp1IZV8ea7VV6g8txCze5CEwQNcH7e4CHxYlZ6IHMw2eZ0CXSG6dJmsXrwEr0sfbRrYT1D5GUCOHUH8XTmujo41tv6xRXaADOfFjwlixgU4ktiGucsleGsu95stAwYTguqYA7IPHUAiAHQADejmrUDGAaj3A3AfP7kFGeejXe6QAWTo0xeh/Qag5/DAgpfCg8gJiAYhCUY1r8Ak/goBHggBqOtQEdQ0MZATcI6jEp0Gl3IoCKEeaKN99zM5gHLo5T/3VLdALYqhR4q9r+8o8Gh/vidOgctzmOzkm1J1fLaGfDwZ75turcAfnwmglQGTC6iWv1QGqvLie/62A9vP1tqryT+4T75NGLsPyoBVM9FRuBKeSBASaZjhxMcqzCnBbHMN0i1kQmrnsLbUOYHwtWBKRWlZ2FdQANyGzog4HgPePiHw9Vu1ndl3fE0BUb3QOH/gEiYz949S+x3IHNbosEyTXWfbrQrw8efvyUnA103M30ICSwiVGIAQWvJN5AlkC7BX/gqWiAxEac928E1UBSowvfXmbsCedW8kF6u4sbUHk3i2h2AybBhm4uPwgtWJPZFdfxzEw3DBNbXMnSO67qJuXcfB9viJhKEU3qh2kPQ7Tgo2jGCnosmi4wA+4fw9YQhQ+wJqQnCQCzCkUMy6qA5E3YFSyeHijVJSuZCy/nWvamnxOOVx4Y1R3YDAnmSNDYW4dWxXYeu8bWzZGX75GgYuYaTuQxC6DEVMPD3gKb8xVvH5c3VBX2Pip4UPXTAf6MCbAbez9t24vrk6RXJRuLNNYgpzAJ9w/t71lJOADfA0LbjE/y7bn3MBocqneF3P2ustB4CarP5M7I/QRNUj1Q9sf+gEoklCZM9kiZHUWZPH05W+VR20gipFPEIMx5yCDnscGUwm554aLjhQD6oRI3fRV/y8dqIUN0MS5p5VpxKruj9mxwH83vP3ZgeQQoAW/4uWYOMEMqtEbwdyuYF8U0yMj8oILFXDgLy+FxbMVAWiNl855RbPaZ1CfRCq34A7/Caz/u1h+fPGLsErXA1LkjSYVmh3joCQIqU+ThI+NHrDXAApJitqPwwQdhpCA7bw/tgH9q/PBFR8MnegyCapPeUGOu4kCg2WT8wEYJKAriRY1Do3Can4P4PCdvpZAO+fENxoz3v2fpjwIyu/37HkPurNU/0BJuPPoBFuwwCnM4GI7XTXvmulVKDzcw/I1bxgYB8H/ryVr8AkEPQBOyaWHtHUsTAZj7OSDj8P8gixawiIZPBK7xJkF8KPwwJ4LnSNyyeev0+GAKkJKMX87e8GYKwU+EpApPYtbq+KNZP1f0zsP1MqrByqwV5vm0ziKXIpw88CwcE0aj+WLbhIEMcBnzhWX8+U4otS2GOJ4UW6gIhARtb9kCMY1PGPOoK5F4qQqovkLgI+lU97TqStU6HB8knn7/NJwN0yY9//4M1ATtmz+hq1Dyz+TAmwC2YRJhR7hA6jTtxRIIqO0QBdgOQHEB0Pvo9KzDUo0oN5gkuQbkFYWQ3c46TSAxkfbRr0gdpFZOOPq92BudbBG30soD0QnQM4WDmIHUC79kQSFtBzZcAA6EAQ/P22sy6fdP7+9XTa4n+YDYghQAF3dgNzswHTl4gn/hQyUBN/qjewNh6dggTzZFVAhQczoQJGXEMFR0LxAxO+oZvsYQHUcxk4nOxgnTn+U6sGDpgi/ozU9oUtDxp1elZ9qNod2z0MASrpEhgPHLM91Y6quxBm7AAUqWxjYPnk8/evKf73SUAVAiRQ92YFauD73EAmAaPSqnEIVNhYWdq28KZL0EVNQX1rHVUDjJmOKglRLN5JHlpAWcvecxL9dX7t44DfdwlToUSQXIus/FNIYr7SMKHyT0gKqhg9VHdJEj37bis9NQwwLqdv/3cH8K+cf2BdswOwbwYSFYGw/790DuaLktYf8wc4wDtOga0/5wK4n0A1C0X9AWa5SACa1mW1HuJ9l/H3gGkDWoUM9vhzoD5u3Xvhi/ITI7II1x+w848G+uDlINFxu0nCAxOVlC1nh+AnDXnCGYcFOO0XQgVTATjoAOD57ASQFD2FAV718fXgOE9A2fx4WUsUZl505cB8+9jqT3xm2+w6BDOLy3f/qfxCmW9QQw3KBZgsv4rlrYK76wvj8w6ooYqhzb9ne76KEaD3sxOwFJBKiPFCcwFvVAhx4LjKfjvbf2B+gCYJAOuwGnHAAUw7CEsWy+/bHQC8DkyWAHkmIIQA5Aoa0OfzAL6lF4ZuryegJvvIUQRx/h50ZELBh52ikJZ84Ri6Hr3XN0CM3PbpuYf+ul5Y4GLwHikNuvz0sWJCiYDvyKKj0uqcDMDuNgccQFf1C8kPwehdmlTvQ5UDH+q5Y051HioHIJZRE9GeA/j9579rQ4BcAeg7Aazni94AbLwZhAP14ZQ+AtnYg8ookn0qNFDHiZKHUA7kWrtU7+h8WFY0bRo79bTMQGIcyBT01NsPEu8vZtSf9b/nUoTH6ChpA761uOxnekCsVzOR2IuIwR4frqXTazBFDsWxhSFCrNTOQeyBdxoPikCUa9DLIAQNqxHqusgBbATQQoBtZaoGtLf/2L/r6757zUCiLFicQVVXmdArrgHZlpN44rNRcCYLZd+jun9+KHxt9VEJ0AzJoJ8/iGCoHUqLAUOXguGFAe08OJ2Sc7uzGLz8PZxLCBU7JrhhiHHABWjSyOfuqLYEMJTp3PqDDoD3r9/5UMvvGOiqX2B3AJ9y/sHdAfifB8MfBcXpwZkkAOTqxaBx1r89cL2NTSTWrcNcAADMgTGoAIQVAyKLmbDgsd2BnGcQjiGO9ftgZtcynzOInYQ6Bja2PNUFOIBKx6GV9miooFV/cOzAiuO5p3II1QHokOKwA5CEY1U+Z912aSjOI/27npY/sBNASgKmdwPm7L/rAlRvBAp+LIR6AHqTgcaOIN8o19orYvZIuXuKHrUIy7BA6bW38i5s2HdToGWTzN+p7YUPUe1VHm60zoIkUF0oIb0hLiAP/n78r+lKuoEDJNENPzoW+pADECU4TRAFiHZMmLBgygEooLdjV8DLGYZp3+UPnH/INgLhLwQbMpidD7CRCCbV4B0BrjnIDng5j6Ao5UDd661UDUOmpIeDH+AyY/tFt54Dew0X5qx/ulXBNdVjxTbZAV5kg8FzmatTVQEFTk8GTEz5u3bOHdl5RTT7toNS4gyJtOPMhxn+OjPIDjmAGOD+haQ9EA+IImwDHjmAdj+WP3j+IWgEKra/JPbaewJNDJ+dgv35rwzmcFJQshz1xaIOlLYfwJEIk4or33FogXY+r3ONOwS8qtQRIGH50Dmo3EOfFLT25fsWEIsGsT3PU7fB109PkwHYTc5XcH2cfVUIQpVkPZwHiN1Pc1EFeOzcvGIbhyBbjS0YRyFDPeOjHYAHv52D0NZvfy2fev5hqgLYNwPX9wLugIO3BRd34EDdgF5sa6jspsSHlQXOAzCAEYg6FLCq9xSln1TnQ12BY+s/tvz+GG249gIBGADDmn/vHJ3wZHhcva+06cPZghPqPkhA9sIDQ0YvwOK/OAewnvhYUf4Ax0UNCzKZ7gRgGoGq7Uewi98KQOBXIENJ0PQHgBoai06qbxSYXhiSQwH3wg2p6jb558hgVum7jiGoLqjynzzfUYfQcw/FMj+OFHrE4VxJMP9ehw5WbRzQuk06KmeiQw/vKPx5oxCkqv5kv75VcOEIXD6h5wAemwPwpGfyB9V9ebLHJOB29uVfPf+IqQLYMiDW+LneL5KCWBmISoFH8gBBmNAHNKs9gsL+naKIYrE7tl/afQXIkbKP1h8lBTbP6vMBUiCFi47uQxW95f5tOuo7G07wL+DwN+om+ErJbmomoAIWkM6LcADbzTNk4y17uy+KyGgZ5QFm9y3favm0nQDKZCDMAcDfBbQy9uewAADlmntUeIBAGuUBuH5f8g4dIHeSe0mYRQjBpb0af+P5Rw5gBPbR+qNkwLAkUOaBwlBVYI63EWQCFt2u7ZAC5wcOuAq2s1WRBxUMFd8710L3aLSPstwjiz9yEOb7Bd2Jj7H6qPyFgHYH8K+df1TkAGhOAP5ISDf2D0IA5wx0SLDfnKDcZwYXtwebPEQv+RerfOsALAR2QOEflRCcU2sdzcPSOkh6bqC/rgv4YTw/mSeAee46XCiJt471f2ozEc21Vw7Egss7gmMAb2PRkQk9N2vN273g0GVs9ZWjwGXoIDIB2BxAifdLjd9WBvavxO8GkPmAuPwXNgkpyy9aev2LN9FZlPQZAdk5AU8GjYDIlaADwP6AunxEFu1c6i8cdHq9dwNHEn6szGbgB92CR1xAPR78WKUClwW+AFe2x37fY26iF++XkC/cRsy1j4iC3YghjwDghxwAjS8bOliSsMRgAd+u35LDVmpdPv38Y6IT0DcEpZ8N2y5fTAxSXYGz+YCw979Yc9X6q94F4MODBstCEPPADknmEWQQAXAW7EMXwAMF5xlMOoRpwB/OEwhFd2FDQAZB8xQm/ZSb6OcEWi/+GNiW2F8EwBmMGMIoQnn0snC+ATmAf30nAOwE5CnBQAZF6eGXg6re8otCgmSftfn562OugPfLjTKFueu/+/dIJNHWUQOSAWveKqoaCGDXoRs1F02Qgbm2eq2s+QhxpXad9UMF18dDBXQEFdp+TUXlORibK2PymXAhX+9khSAC8aiRSF4z9vhDHX5MFAiqosxEHvScXEhAY4mz9WX7/d/wtWFW+f05vDNY/tD5x3UOIMf6+AYg/LWgFAqU3wUAu29m/+WuwB4ZOMBj6BDlCvLNFcCMbTzo7UQ4gIFEGyyWsLQNVyDx4QYOQOkQRMzsyUSFHpPJQ2HXvQsYAD6o0fNeKsTZlw2nCw+s/zCxGTuL/c51ZuVZZ3EU4M2eI3mM8gt4TxrgrYNKxDBa5q0+EgqGCzsByBxAfUfAdjJ6EYgDvnhRiCgDGhWnacJ2HcfxPjlonQQO+uwIuiW+/FgmKwDWfSiAeYDPgfWY8ns4DNyCULH5sAM8wjCB1wFqdxrxhPXvZvdji74fWWT1LbDngNqO1aAXxdxo8SX4B2U7vD57Dhvz1+0ciVnws9Ph614+4/wTYQ7AvSLMvAtQ/UKwfVGInDrsGnrgVWFovdC3NQAAIABJREFUg6hL0PfLZyZUcwT2e1WCA8uYypLPVAD6Vt4CWYNsDuyHiaMb44/cCJCZs/1e9brkMcg1xI7HWloFUAUqY8uFks8ouNsmfBfBhAMopeNOjb88W7TzDHj8rvx2JhsWWELwQFfkBt8jX+fyh3cCiHIAXA4E218Ayu3BJiGYKwkl9pUvB6GfFVcEUSyPA3XQF2Be/MHA058r8Lp9AzNWHiEcgV4vlwAzCjhQfJmTIMfy1OMNEniWcqxVLZbbgJfeLYAgMccKCIZtdXzsvKY7yUgBXX2HA85BvjvAX8tY7fW1yVBB5i/QGbTvtHzm+SeDHIAvB6a4f9tZTw22IKIyYK8qwOsoL1CHPcT8ZnBQX0CDoH97kB+gDGrYQuQKZtR9ZptqsDMg+w5Dx/Xdfbox/gSRBDVz5SlcjD9dKfBHm5t41Ak5trF0sPvQqafLbcw5AKPeNKMR80W95Jw7Ro75K9DhuSL4IWDLc/7tuNbbrqflM88/lacD55eClqYfyAGU14DLEmB1AtvD3E4avCLsQCJwP46c/lvOYRU03B6z7oY8MHYcOAKjqvPq3gf0/HHYOjtyCRJhkRLr/ScThzzPYTLTzzC3CUALZksmcRjSTyKqY9Iy2X044QBA0fmXftC9qERduQ9R/oATk5Gtt8fx39WGCqD8IjxZ/o1KAPmHQcorwdyPg/jJQdIRmORf3BlomoGqsyBg8mzB3ChkFN6EFzYZaId1MLlIALylIL07aFfYW9cjGExwjhKKsK1U9FjJPQHpWFtup8qVYUJNeQK4rkBNmaBQwcw6SiLi4Ld/BwlBUX6ThITABqLjkptWaH9upcj7vodyBO1KpdUPypajbZGcls86/3ROAuZfB6r23v5SkP9BEJsErL8VOGgAqgMumApswM2JQEjuWZDmG6VyBKZzz27nCMLNAdDuwEN4e7TsSuygUI5AhgqPCAnmwD4Aarn+x+YIDs0JsAN7/9TtIhTb47sBDjQWuXCFzq3seQN9GzF+u7xO5hi0SuNxvdpbEk2qHtl6f13xtvYYyx/ZCcAmAfEnws1rwrD2X1/80V4Lli4jeGX4IAfgHIFqCFI9AwQ8m/2fcQR2GwtKtupe9RWIY/ud17iy2hPIQyokE1dAT1Phg3Apg8qDV3MinzC/EKh4cSQHKhVswRPJKMfUU+8gPAn6B0YWP3QPzl3pUKSRDth6SvwiUaQwCbfF4yZCWT77/DM5CUjvBDRvB6Y3BO1gFu8LKE0KNd6eJAOX9MuKCkk45Qw80LYlUeIvr4P+QYZFyTuYc3W2l0DPg1uqe6lw0ENjmnHXlRNKSsPlthMWfvpYj+w0LHaX70N0vSZJdtBNGMIJwZm2ksQgGmvapB/lPjRAu4oukneaECy4y9iQtv5Atr84gnYP0nmWzz7/rEgC4lTg9lqwBK4A+KU6UOP5BuI6wCNiMHkDNNg8PRiJQalzAnm6TlZ2pd5+mY3xWZmPOACtwkN3AKw9RQwO7L7DTp0Tj11BMdV9qFR0dE5rUc31TCYSnXUPKg1IJAhIBFJVahHuKOuMym7/bqQy8zNgY4dAyu5afi0Z9cMC3Na6ALyO5XMqAagkYPCWYJfph7IgkkSvG5BLejJ+F6XEzNYyZCCGN+8fhPjp8QrPoFYkhARm7bM6b8kke0CidjLxAE0FtrgSoZy9aH9vrn9uymUcDBsqICfKkpHzYeurANlddpAsyhN0cf6BygEnASX4yZ53HQT1Szirb5KYMF5cCGCJYfmj558TSUCcAGTfEdjyA9uBsB+gNf3YDsB8rB4ZhLE9tgDTkHY9ATzk2YE8zhFYCzsCPDsGBE9SSQW2OFygHEbef257OPfwvJ2E5aGkYL6yg2FDBZxI5ikVD5cF5zXhBWb4RagUtw9b58MkIc8RTCjy+/pj21BFhxyt38EqvM4VJDzwdS6fe/75gABK/I6/FORzAUgI6aJ7cb8nA6OKwgVYpR+FBwrkmRj2757+9hrdW0YgFDkB8x0qSMsxbVCBD79RFjuLNFEFlyovIY81BHtg4feA0PsGPoe24pFDUcSiJ+F4YvQxe70fopQ2dgV0vPDlIH2gN/LJZwzKergduwEFbusQkEhtWFDuk8wJkAuw14Ak0v5e/s1MAOmXgV8HAGNIQD8V7nIBfmbg3hDEyT2cvWfAXrZFsDRQ+r5+VnelzGUw8+C0/QAGvEafLQANcZgsOJ+bv0McBhglJ+Da6+qEFc6S41E7wBwmK01qLT3L6XkHcN7J8p4lu3zPBhWOUby/X8WwD2CsvvgWIAQgg1Y5ExdGoAp3SoazLoEVvYUG7Y7uy4KE4fJ55/dQFYCAL2cF0u8F1sQf/VIQlg1Vpr/zHgADOH6TMCq5nAw0o/QMlAjwipR6roBcSjVdcHwA7TTQcxlLw1t9FwDwNNgBho8oL9qfCnucK1AgMkQZWfhJV6DyDHWZKMfh9YS5AVVFKGosGqgUuPk8cQhgHcG+HVQ+GgG0MYpuwRLGelr+2Pm1DgFsyhxVARDsOgm4X4J7PwDYbfGKcGvRm9I3WMH+BVxhPkCoPyQK5bkUYE3YoMEWA7kX+3uQmOOYcCJyEiLEAPCqMEKGQMPQgex8x3koZWb7Hln+npXf1z3KFYAaDhwJ2/UplXe/GkzqS6Q1EwIY+y5fL6YtfSKAGPwYBu8GaSOA02nrAsS5ALYMmMKD7UthXmA7kX9V+P7Vq7IzMYAyY9mwlu7QtvO2AvjkBDxJsFLj8VmpESp4rp66otNottXuMSIMALBLYtlrUkqYQDEmB0MTQ7AL9Z7qUCQj3214UvmBfuhgyUHnF+oA707o8bZfHdsAlSoAPTfAAIxJJIOYqhQRgA0pgFCxwkfhA4N/I9Pl88/vDQhgAy+WAfnVYNgKjIk/9U4AahvmrsBKAOkNQumGlb+L0+iBOQM7mi1YuwMGJOLUvxBGENdXaz0CuSIX+2Meo1DAQKtj6ZXi8zTcQls4UIwiT4cMlniwb36k8Hy+rmsQquavNx3BWny/rLs+zBd4wrAq7hXXEYprUEIrj47BEtvI0itSSGFB++7FFShiWP6t8+umClB/GKTG/uwGUPlFGbBafpoIlPMB9SIGGX8LCN8PgOvd37IJiN2FJRSvtZG6M3zaoItBnNdU28xn64cCKvnmgQ5LgtKdIgef+e9dCwzOQV1fuRU7MIk8REnOkYhImvF3Qgtf9ne2vpMY9MqOVlsRir0nHmR9cmAiYRKT4B2QCcf56BAsYayn5Y+fz+t6em9S+1wFSMqP9f+SGMQXgkQdgfyeQHgpSK8TUCUJUbkVYbjYXABL7seKDkpvVD0CuwIwDtd8PIjduoClwV/6t9tVeXrCAKYpL1/D8fyAV+5jIYZRWFk1sN9FAXYfpJ3wQbsF4QA6hNGz8AiS9nf+ZoI8LIhRzUfOIYjXZduwdQwF1Og0PFn4fRoppnXLF+wEsM0DwNmAhQAoDDDvCtgOZasB+8FLrsDZ/M7U4GL53ew/tOyYW2jLGxCUDUcVF4ruQgPlCgSwndXMxxY9AOgKujB2MXYnrOjE4+4cE/kBp9aySuFjbkdqjwX8cD9l73W+QJGDXoZAtSodvSwUwWaBR/vn8dFAinbcEomy5Ug6PUfAxFMIAJ0PhhD1XECMy584r+f19PpiCWDrB8i1f3QD9V0BOCdgXA2oIIjmC8gkIDiJMEkYATYCfk/RRwQShAxVqSKiQK2GbUSc3XUJZOsjMkk2O6Ya4QlEA9BEGDBVafCk8fhSYb6mQSsyAkoBFsFhXx2OVn9k+2PyaCDT4YICJ8fxM9so4kiS3sY4g1/ts/yJ19fXT8v5YrP/rRFoAzV3APZyAWKSULX04tXh3B/QqQI4BZ0OBY6qP4OG3EfpAOzG8R0S6BIFhyTYCcjHZCLCh97bFvYbgBePUghFEgfUv5la9+0fWyoUPQ+spp4slUvIy4JJP9rqd5wBKPu+FZUklVprcCty0ATkVP0FzABsxLCeli987/ra6eJ8lQgArH8lgEIG21fmkIBfEhpXA8y8ARUedHIAxuYfJAAkEA+dNGw1bPLyUKnbnjYMgTMGDT9en7lXQJEROIlBqOHASvG0AzgBuZQVI5DNgj1MBO5ohqNMEoWO/W0o4B2AdzPKKhtnEHbrHXMJeL06Zrehw35doiQYqb1yCvacNgfACcDdMHzha+vPL5frjSWA11uNf/8VoOwGaguw7QfYL4SnCZMDaD39oiRYYFh+cciAUij5QRJAE+7BiiTAysvntkqtgRw5CR9CYHZfHgtn8k2GAEWZOKCx35vuyCDmd0RgkpvC5vecwcSsQEVQBkCdY5S7zKDh79CAkvc4UBnAc9i/PaDLeas7gFePK2CzYwitPhAoKroiHU94jRiWL3pt/dnl8nQXhwD4I6FRI5BtFEpfGpN+/ZJgfeBYJaAMPyp5IhxWb0EUJsmHgx72hay/BiEeNzqGWh6QhQkFPFlU4HZU296LfJ4hQcC5ujkChF/eZ6IvQIJ2IgE5VvV23RbcmnhGCT/1k2EIUvu3tuq9mD0RcGzxWbUdQWR3VAiPyUa5l0YAREC1XGhdEB57+aL3rD+zXJ5uT6fzhc4BQDtwdgL7acqvA2GzEMf26heEqtqXGDvIERgXIBKCQYnQEQUafFHi4+2tcto8gIGryQXwXmW/pi5IV96F8HbsFo7kCDyN7UcLymoRmcQxvz2+2W744lJBLtOhAA5ivD+WCKpiypZfJBN/jFllTyDXoLKAtoBk8HtwewehtsHviODXboHDFhsWLF/88+tP7QSwbHkATP6h9S+xP1t/3SKcvmjPAdCUYdoeByWCpS0fEAKAXhOCdwt+aCJkG4A81AnshZjIVkugCWDyddTPZkCX60fnQS7Eba8gnY9zcCZiUTml+jbufzpZRKDEI3PcHOUetDuIQeqBHpBNVW0kGPs3hhwFtF27P905yHG+/WxzD7xuPS1f/HPrT1xcnu5OF+t1IoDcD2BifwQ6hgSqHEgtwjXDD+8CiKoAveWDvMBxoEckAEBy4UEhBVboTAIuOeeBWgaVpY12XOMO4HgxQWEIwJG/3kt1/yngmr3B8cTuQJOMeuOvpYZ2N6zNJ5WddBgMMFRlQxwZuHPlQFTS46GBU+fJZh/lGiJX0F/uwb8nAb/kZ9cf23IAmwvoE4B/S1DL7HtnoJN+yu4zMRTQ0HITz5M6C3LoEcJwXQBkVvEGZrweUuLqCFROQOj9QOnrAB6UFflaG+iZJIJwYxgyRGD3pIODX7kGSShh6c6SwiG1f3Q5MFb2puLevvMbeXu5A23f50MCD352Bo20EkGmzxsB/OjFxel2J4AtD+DKfyUHoNqDtxsTOYIcBuwAoFmBJjwo4ImqA327PwRzQBxuP6P2EVjztXbtPWiMSPjxeROJ2EDHAqK5g1ZXLyTJZMPuJQC3y9Lba2AV5rDHWOlQlSeJ4EBFoecODBEEnYU6BEBw4/2aVPmOVUfAd+0+dZYiQNG9lOXaFSBZ2EQkfm889k4AX/oz6w8vmQBOy3rVCKCUAqEBKOoK7LUI5zcDmRZhsPoWEEwUTVkr0TwhFHDgo0SeU00gDwaf0O5UtAv6Bpx7cOdWpNPKkh5OjRjseZ8SBoz31ZOHYrC70GLY9gsEOjULUDuCbihB8+XZlVg1Va8wo9CkhBKgrAxcrf6oysJBwPFKWFPBDO28fWLga7XOYPnSn15/cFP/zQWcLk43iQD43QA5CVjfCcDNQUnl9y/NVYEM9qZNrPTqF4S1/U/H8I7giAuIgdzIxuhqlySyEstYnQBqEn6ODmzBslOaNPCgrsQ+gVmC8S4jDgX62+rjJlLyispgw+9jtyYioJh55jgFNBwmoN2uahoc36qnBWkP5Eftvtn+ES8Aad+JY31yBpCw3B3Al/3U+gN7DuDidLP9l9qCg1eEj+YFmJ8Vy+BAd1CHuQgJXFlvZP0tcXRJYAbEodozMDKwpxS87wgYzKGrCEuZjarkvmKCUWTn6/7d6oFXW3NekSj0oB7E8J1ZgAg4RRwS2CbcKe8I9C4D933q30wafLxCjk7VSfFnwoa++jdyZutfPi9f9pPr919cphzAaTldLxfrXg7slQTxp8NMIpAcQB0ctR8AlB1mDbZBpPIAbR8P8njdvm2YxS/k1FRfba90mo/J17Q/tEH1oIGtnZ8DAEM7gwlHFVKmz8H4GNNWZUAZtjrr/cu+KqnYA7sHbL5q0QYcJfZiJfeA9jP67BU0d9AUM4rZjy7HqscMGaht6n12Mwu9wiuCQcCzU0HiWb78J9fvLTmAZSOAy9NNIgDIAVA7cCOH7dBifgCrPr/+y7T8stJbd5AufqYikI/zQkEPRAFq6kGftwMw9bdhcBUiAAgFYHZK3w0DWO91so+JDn1FJaZwXgOqjCcNXMLvLVCKvV0xfke9DbgIasiJyGOcAHyEK4C23nLNM4AfhQcR+PvLNTGE5JCvffnyn1i/u1QBdgdwuecB9jAgqgi0Xwr2MwRdVYAbgvacQCYODAnQgqOTMNoVxP8VLOP8gFJfBdZk08gh1GuEYU3bKEcwk0C0DiQmCL6urnMwLshvKYFe7nenXdhCpUG2B3YNan+kLuCDSUMRkfDgZxcSxfdG8YO23h6IkQwUAI8RAFYjJtSfkoNa/dsxl6/48fW7qgNIeYDrrRqQXgQqZge6dmDbJFQV2839L+CkDsGa1Rd2viQUiQQ8CBCoPjdgQOlKc2jD899By7DR6Qm1t8BHZYPrFSVFVuR964HSGyhRHC38Bfy8Sd5zInwwAK/PLS8NHIJNINp7wKpsSILCnmMgt1Bnu+/UGsiOVXZs/9t32vNrcF/aeY9m+/0x05i3x9HHtyRhyYYJZD0tX/Fj63dsnYA1CXhxut5CgfV0XhoBbOFA6f/nBKHN/PccgF+XnIAdoD4k8KraTwByydADSIDeZekD9Q/JgYHQcQ9dEgJdFrG/vVcAmWEfA+q9CgVYjW34gNDVnYR6e00a9lx2+jGtOxASDElioj9gnPW3ScyR5WcF7ib2yOEUQomIZLScySxtjySyEcCPrt+OBJAcwO4CLuPJQQX0pUkoA7mqPvyEmKv50zpZ2hN5AQoRFMjtEM8kMcgJ7A9I2HjlGjwRAZEQAB1QJXEQKKmPIDofxuXKLfBRrWPiUEABl8gA4mxUaT43A1Bu24nZrW73iMCC0MT9gz4DBAWC07kCqB5YIHmV98dB2w6Ae0L7ryKOEcBH6r+tX77yR9ZvUw7gtBFB/akwGw7YFuCcKwCHYJt+GuDrgBBVAQ9oVnml+p0qwKLzARGwJdg6Sj1PHKiB1hXUc1KC0V9LftQy3yBIJHh7kTqu3TsPmW7VwRKItfgxcWgngL7iEYDvJgA7JCGsOpPPY5xAIVpU2VG8zw5BOQoP9IBgSN0j0ihOYDv38lU/vP7NrQRYQoDiAPaegNN5SS/+VAQArcG7jQdlr7G7bRNuIUB2DC7Dz4Duf5YuwIAkIIEXAmxQf3Yn3RxCDGZWzP0M7lpjQtmHhXM8HYIIE36iemBy883f1KM7MDKgvR9ojsF/c84P6LcEz4Mcz6Cs8zQBdBqGGKgj8CtgoxMp1xmRgl3uE4T6WG27RAA/tH7r3glY+wC2XoDTzZYH2MKARgDtRaGt9MevC6eqgJnm65OADcAIVJ0TaEMuIAUJOjrWKGO/r49Ljggu1i6/zqu9qga0HDps3ykBWhXXbzCSx4S2WksqilBilW+uxd4B5QTwWu36jvJT9cESQR/w6nyodhFAUYWTs5u3+W5fUOERATxV/XvEgOTKcX/5nAjgB9dvKY1Aex9AqQSUZOCu5vZ9gb72314ZZhuDIgeAICt/RySgbD4s25XHbtMGQl4+yOonYPpjaAUmYIsuQ+MNOuuNNlMYwNbcaG6Y14jcgW9OYo33kIQzdisEVun5E8fcRmnhO7cBq4mFj+M/434xgBuBWSVEUPDfqKSsqk8jAEzI+Wtm8mIgxxa/3QuzjygRLl/9d9dvIgewlwJrMnDrCajNPr5F2PYE0OvDTD2fHYACPMb5A1fgQC1IgBS9Den8Vz2GIJkDiUHW+hILCg9gGlPZrlt1h6vtkoinivr4O4lH3otTgz4zr4DerhipB49djytr+Lw/gsCebx7wvJ+ezIPgsX+jy5hxAkgkcWzOxPFC7b8oD6rz2dxEuu7lq39g/caeA7AzBEvWv8T8+bPp/MOkH/QI5Gx/+uJcCVCOIG3XBlNT83oMnD+ACm4GvlB2E1fT+l7VYBRCiOahmHSMT/BvQAxdS6TyrU4sCQnupAV/HoqdsMNqq/EiVMLlY+lQgtUeaSByAibTb0qDGYD1mUZOQIcPiljwGmb/ZkC/MPs/VfufcRI2R1Cub/ma71+/YZsMdLF1AEIIAMnA6z0ZmOcHsBtIIBVvDS6Ah4RgetAZcK4SoBW/kgCouSKAemwHUjhusG7fN1D8fbhLwtiuwocYVsUBao8gD2uGmTDaD4A4kjHEGDgE+dITdUYGMak2Ac9ruicMBh1q9pAcnpD5b6roXcIs0Mueve1n1D2NuQLco/a/PScbFlgHpdZte+L1LV/zfevX7WXAy5T44xzATgSnkgzcEoHcIQgNQjgvIFcGsCRokn6mHbjlAbziCxdQv4TNBcgGoO06egnCHjCDEKJCsRv/91qJUaPVnH/WcAA/5Qo0+AWQBVDtvspZcGDwxAai2iXHNCHUWTgSr9YM5PZZKTvaYiTqNyT+ly3Ex0KEXpIPv0sBtfoeaR06BHuvl6/53vWvKgJAB5A6A/07Asx8AaP4AGjpAJoLYMBXh5Dr+MY1uKYhC275rgA4ToORbhJCYGM1wKh6zykU5R0RA4UKXqM9QfS2kU5BTFe27iSdw0Pc1hCsMxq4AXFEa8j9Of1PhU2QAxFJFDYwIPDIrIT9UMCCZr8L+f72yKOAj8GKLiLaRrkIdc0N3EguviSIJIFOaHnH96z/TyOA9Xq5WNJ8gFwFyAnBm6012AJeJATxfQDmBSGo8JT1VwRByTmboYd8gVTofq5gH4JEChVcPcUfWXhJNKTkzol0YG3CDuUICPYyd2GPrz7xFfjXk0U+wZIH+gc8JlIGg50BydAfK769B6iYNmfwhPgfMucI3OhvBdzHEUD7bmzlX5T670nAd3z3+leGDmB/Uch6KRuCavyPCcLtEoPPoOLcB+A/l+NQmS50Bx7cJiyIAC6qAZYUCgjihKKCaB3QM65hMBeh6LKBozyu0vSivN4D9BTeazFexYQbCFqIFUEoAvkFIYAXUPNnRY8qDJFFb9vbZF4E9McTgM81LO/4O+tf3gjgYgP5xem6/Lsrf8oJ7HMDttxAi//FT4nnVuCk1qU6gPmBAmKO98v2ZZBah9BsPdp9BCLkCCJHEGX9DYB61YBRJUHAP0w4kuYOld67CO8bED6aioptxbVqL+cIZPXABx1zZUN/RqvaBUqWsHoWHyktdAA5b8IWeqToCLTob7w2/nvGDURxflTjj8iiHx5wBaB9Xr72u9a/BHMBahKQcwDpdWHr/ivCtTtwSv079r+ShVJ6ArkDNxCFiXftfrbWzknDomh+eRqC/RJhA5OuBoSuYNYRhDkFHTrIpeatu/aKPIytz2AvYeBLOQZj9aE4GIYDlC/QDkBbfHQmFXTTLwZhkrGqOAP6WTKICSBOBvaBHIcFinw4dFDbLF/7nev/ERFAcQAJ/LsL2H9FuE8ATdHrdOL6Ik9Ue5hEVIFW1JxcgJnYw+ssUFsSUQCYKgIG5NNuwB+3W0IEEFv4CVcB/fZ+DkBEJ6iW9h2EZQ9FDHHyr+3FYRAThgItghPV2cLOlqL4jKz4BvDGMSF454CtVP8poMd9+27A229FEB6ko7BgTCaVCMgJbedavvY71r9YQoCS8MNOwLpsOV3ltwa3ZCA6gPIGIQwBTIKPAa/ATstMYq2/rsJDkkUBBoOOqwgE7h4pyKaf4zkCA+uZ6gFPPKo9DAdcgcz9Z1BCmbEXDlhwT+QDqOKAgz8kAPEz6A0gDHhPAArYjyGAXlPPvBvQ6q2s/iH7P3iDcHIUMUks7/zb6/8qHUCO/wsBZAeQJgjV14VlN4C9AbXjrzQHgSMAckg3DtU8/b0vM3Zf5AyicEAtFwm+qvwZcNsZ0uOxVj4tP/tZAuEx81AOLX4jCFbXvr7TWvHrQWp/TwnGxCcq6VQm5ghABRK6QuDDBFgyOZvwRRHASPWjRF4vwddzAyrWRzJCoOo3/4zsv3UKJZTogX93AO/89vUvcBLQxP9pXsDWJHS1hwIXJ/sbgibbjwlAagl28T4qegGeDgssYCnGd2U9jOfFtqIMiMdvQIri/8i6Ry5DQPNoDuBQ30A6nwUvfDowr4CP4Qmhnam3LVIEvxgUr9UnBHX5Ds8aE4IlJs7Aa3eglXKGDBjgngwAoFK1VYgwsvfz66Nk4/LOv7X++cv2SrCWBPQOYCOAXA1YL+qPiJpWYCYA/FwUNi1riouKH+QAyBUY5zCt+lEVQZcOK2xB7SX0Z+r/IekMdN+p87xPaA6j5wPweD4rcIQAmHRGVQFDCrWxxzsUJgX7uZ8DiMhFHQNDkkYqHpRdMoDmoC4BQAjWFHqWALzSWycROwHlOJZ3fdv65zAEqGVAJID29+4AlvzSUFvrL2Cn9wcWglD2v4JHhQmZMIJwwE7hRetOScKOQ9hed+Iy/a6/P1D8EPht+/2vrtprl+EhOw/8/SHTLxVZmOtgQZ2T4Rg6AFHK9Ha/DD90KKzS3lFEBKBdANpkPp+10EwOCHrlDup1POItwUwuWo2Vxe+TQnM1CvRzRLG862+s/9PFVeoDSLX/9Xq5XMq8gNIDsPcD1HkC28tCytuC9vi/5QLs5KCi9hTrLz4hmIYFLBfk0GJ0BrlS97hvoIGylxT0wN+zARLQUbigCEYAMDzmNig6IUcx+wecQuQHpglgMmesYnE4AAAgAElEQVQwRwAWpPiJATln+z3oFbBRCc3flIfo2XpW03FuwAKSHUI7lwJuDPCx+isSgT6Ad33r+mcvLtfbi8tley1YIoDcDmyagbBJCN4WJMHP/QGo/jv4CzCa8pvmoR38CuQR8CfzAlRVaFBMwCbthnx7v1rQlH4EViCEx+QBwpIiqmrfLRwigHqNVqnLGXgpHntEAArQPZCzYs8RgnAE1a1YYHRVHyoY2xE1McTxeEwWihReBAHMHmM9Le/66+uf2QlgdwBpHkBxAzQfwDiAbTvzpqDa/beBYOsU3L52Dgd25aT8gKsAJJC1TkIgCRcGFMvfs/u0jux+ze2HDUY2NxCSwyAUMJTgQD9DGBluA8KYCRv0NgBjOsdcCIBQbOSjYnzW+xmV77kCre7t7Uc+ro9A384ykx/oOYPY7iuC6C/zrmAW2GW7cQixvPtb1v9+I4AN/DUMKOEAtgOXv9u04ev6Q6JV4fPPiYEDSGW9Bn6XACz7ZiA6AqgABUB3l5VBaEnCFvM64cHmPXq5garCojyo7Lo4loa9WDrhEmaAbxWbCUWrOypu8Rc6BzAmAKXe9vg4UNvVNoBb6vAzCDmXYOkHjzMCOKp1/Hds52fUXrXz+mVj8NpzWdAXp2IJyRPI8u5vXv/b/Y1AFycggBwG2EpAmhvQXhySkoEK/MYNMPjt5/1xZ4Iw4HdhgOoPiJzAWYCYty0Oo1j/mBQqNAfE0LaLlD1W/P45WFnb59m/+t2KaNijc4228etHLkCFDHWZKZURAcg2Yq3u7CBeDAG0GFo3CcXKrkAbAbmQ5B5zmIYe9Aap5Bttw26Ft13e/U3rn94IIKt/TQRe5ETgHgbYqcHmpSEpGQjKf4gQGvh9ApDyAFL1rc1vtr6fK0hrAYwm4QiEYGJuDgIYzDZP4M5hOvjw3D0IHwgRuEMwtPP6fAreKl8QuwDb/BMpPPoF+wvD3klYsKrmInYOXjWZAJSqI9D83/ExMQRRuQGlvscJwKv2TGhQCCFyFuV6l3d/4/m/urhachVgvb7Y8gDpZ8JdMrCSAYQI6dXhSAD5rUGm7JfAjDMFfViACg3g7zqBArPYCZSuQgvIsj26AASbdQMWhna7FC6U/43MPS2H3oKxgk+SwBNyBFEQoMIL3tYTAmcOyu8aiuVZ2SKyQACV+xSRAm87H/+3bzRyB0pNLaGo0MCqtyaA4yDv2/92TruddwrLu//a+b+4vFzqK8G2dwPCJKCwMajOF9hfGVbKgBH4ySGYnEAC4YnyBPsD5+2IDLTiN/W3sbxX/BbF23Ws9WnwAYW4xB/rvQBt3sevmQF4sM1EjsCCK1J/XK6A2tbzWukIRKvyk8IBRxRzdh89Ayu0KttFYNYlPkscTDhepZsXQbseATRW7nYmbf1VeKJDiG3p8u5vWP+z1AmY1Z8SgIUQQP3NlOE0UzD/glAmgqT0ojdAJAQl+I3dz25gL9OBM6jHauCs+Yi6La2LlrvEH1KAJ450VBECZCdg6KDjEDTRKJCiYxl7Bt5CKbmGvN1zJiyI3yCk5wNwoKCIQS+z3kOpdSM7TRDxPvM2PyIDDgdmE30vngAi9dcksLz69et/kjoBKwHUMqAMBUpOoBDFnhRMYUCz+Qr8eRlXBEKVL2AvNXr7uSUfM8irwjYHgI1DKgSwjT3gHNzEINybQgCO7QHwqk6gGnv0dthFOOMSZtQ9Jo/Y7mdYiW4/BFyz6DGJNJDoPe36ppga2Lx+liDG5IDqXc7tY2qr6PF2nlxG8bklBQ/c0frR8dGBLK9+3fqnLi72RqAtAdj6AEwFgPIB0BW4v0249ARI5Qcy6ILflwtLCNDgV7Ypys7uAJenEMLsWxXaVxQcQdTGICQUkSDM3YGxmjO8IzDn7WY6DTnh1/k8Un8J3ADsFnIN6HgOdg0YMtjt/NGOKP/j1R4beR4f/7Nys+L3qwOWYhCQNpR4DPjt9/Nhgj3m8upfXf+jWgW4PN1cqARg7hDMJGHbgrfGocvTzbqcL6z157jfuoINnL2koAO/yBskgJPi5/DBx/cFYAxo+kwVAWv3AeZBV6ElkkJICSx+XQZRt1fgMeqf9pkFf5l+yv4g2t9qrT9PHO8r5ecZf33lx7VouyNC6G2DYENA279bgg5B/kYRQE/de3mBBvRRjiDRTdl+efX/Xf9kKwO2MABDgpoUzGpvXhxSl209AQjyQgCvu0agdeklBZsTqIDhBKEBOQBYKv7WE2BB3iJ4sP3UbahDBp45iOqOHoBBaz+360HIaaCH4UFUVoTlEsBB4lCDXWUBFODt3pEjeIwbUMfywO2FAx7ACuwxAeikGlp+Bu0oHPAJwrm43RJAnNhr1xNvU0hgefX/Pv/7rQzY2oA30LuKABBA7RosyzYXANWA6gYMeBMZaOXHHEGGqKsMCHKAZCAnCS3wMRzIeiwSi2zlW55AATzODRjtF1UDooTAxIeewaQbWbmN+j+xUqCgzWTB23ir75U/dgneXzQV7wGdnUSc2GO3gMlBlSj0gG3XocD8YglgjhyKrvsQokMCy+m0vPpXzv9ucQCp+SfF+xd7nO9j/50URA4gdQjmHxItRLBQebACWiQEAewJdDm+r63C6XMDuX2PgLH8wgnU/VwlwBNDcx42AMAJSirmN2ptyn7aEcR5Axs6FID3t1dv91HUoJf17b7dB5XckE2d11+2ZzDrygD6DFb3Y5b/qBMYuQMGn46v58OBPph7Ci/tP/20GB7d5hUUCaRly6v/1/pvp8lAbS4AzAnYSWBvDirZ/0wAygGcLtar2hMgwc8JQV0ZSMoN/+XPFvwFpna7ppmFMJraNwIpwLahAfcVcB6B5xM4fa7EYwHM+1njr6x/FPfTGYOE4XTsPwoXur8cxKTAtNDWe4AzUBthxJY/VngmCaXidhvrDlCxEcz9+r93GLEbsADUYG5nbvE8hx8xkAvgyx7+GLhv+3t59S+v764OAN4JUBN+OSnYEoDrdf07kcHNcpneFbAnA43659LgDmAEf/D3pu8j8LNTyFl46w4A4KY8yKSRt4O+A4799ecGcBvPxyFBrN4zVQL9HoIoQHixBBA5hjjut/DGnAFSQVluXYIKDRjQ6Dp6YG+hgz1qAUc7zljpfQIwcAPwS0KKELxFt0e2yt1b58kgdhAa/NvS5dW/tL5zJ4C9AuDtfwoF0iSgPFW4/r0t253ARgCZDPYwIKu/dAMYBiDY8z7NqlsXwGEBbseVgLatbx6KQoFY7YMQARKLHtzHk4MGzBPtxZ2aAmX/Izfhge2Jw1t4a+61ytuwQIGeKUJVArzizwLfA5v1P123Vc1GSAxS5xDAelv73/a0JNOz/kgT7ZryxZlf8sVl/m/lIGLgl+++vPp/nr/m4nKbC9A6AQvoMRSA2H8H+77NBnpIAu4/MX5RqgE504+hADoB9/cGmrmQAMnAhAW7gyjqjPkCIAKT+LPgdklEU7yzvQOeMND2H3QCtaphgwMP0RjMeMbHOAALWntmdTwLa64MzIIeodqoJUr6WRhbEjnmBBqxWfi1n+zWBNEHOFt7ZfURphFJoAtQ21uXYH1Gs/498LdAYXn1f1+/quYA9nkA2eLnRqCNGPZXhOV6P/67EwEQQCGENDloy/hDEtAAXocACdi2X4BDAvyM4Hfb1ap7dhKUGEQAa/XHDsQcKphZhFHyEMID0y6MPkH/qnEvTNBGfFbd57bTxMFQL+rJVxSBXqm9Bz7uPU4Etq17wPdOIB95J1xW3raMrXtU/x8BXhOAsu4NkBy7z9j6mW20e9hCgL+4fgX3Aeygh0qAj/8TKezgL6HB1f5Ogevl6nS7TxHegZz/k+DH/oDXIfZvLsCqO24D6l6bgXxSUIcCZd8gPDBqTIlEMwcAzxeDviozzQDU8ftkPiDs/JsDuiYTVvG2lXYA3jNwVsAm9LzCe0VXZOHjdwZ2epOUpQ0mEQ9qH8PPxPkRGaDJ96FFpNL9GP9p6s8OQH3eCOB/W78M3gewzwPY7X1xAqD8Tf2zSygOIOUA9jzCXg68OF+mGLW4gALq2BE0sCdiMOBfXjefffxfgNryBiU5Z1wCTCay7oEVHtXdA72XKDRuIoOeHQaercGMHMJEo4+aV2DBfYwQeqGDygbw9r2wQCm8pRBUdeEQzAxDezSV7POE0LH9zg+o/MAR+++3xSVo0zHUYJWeVXZLFHPALyS1vPt/OX/xNh24qT5MCqLEX4n767/FATQiSI7gct3fF2hDAAX+5gJs/A+A38mghQUq/o9CgbIcY3u/bYGjrxD4/YrSi9wBdBIyQXjAxzmC5iXsX4oongL2tK8nCG34tTtoBKCThR706axuOU0fVvD2YcEoDChA8HYfQedDAQvex9l/RQCjZRa4x9X/GPAL2Szv/gvrF17CZKCdCPYuwNwMlBN+JdY3/17lHEAmghoSXJ5ubQiA4PdEwLH/Dvha+wfwQwXBgZtcA69vVty6iwb7AgZcj9N+W+iwLx20DmuXgKCL7T6v0Uofqfsx1edwIHIBfrmmCmPY3VuJmCjsMWLgM2mosEARgl5mCWAmFLB+Ymz3lVtggPJ5ewQQ7VtgjDmE3jJPEsu7//z6Ba0PwKp/6QYsOYC9VHjZ4n8AfM0HXGy5gDo5KLmApOAF1P7vZNcT0JEMjPLzNnVbtP8cKoC6S4LAPAABHCYZVUC6RGIDNNt8b/sR1n0HoEOEo44g2p4hbz/3CQDWyhmDDOhy7Dngo6NgW2913PoIb/e96nOGAD/j/seXj8jBry/2u8HWJwF76xrEHw/86gDe9efOn3+5vRIsx/yl9FfLgpdpTgDY/jRHAGx//Xy1L98JYLk4XzUXsCkmJgWbC2jgx9i/kIFalgEP1QKv9pwLaKpucwJo/znhV8godgE8qWhEAjo0YKBiLkCBWCn8jOrPbFMsOpCC+4XeiDBmw4CYDKyu+2DBx/rKCaiEIFPEnOr3E34I0ZYz8O7A0ouO/4+ovz4DHreAu/2riCKtXd71P58/73J/KWhpBU4u4GLv7kvJvp0M9lLgen1xlbL/hgQgFNjfMLy7gJwHgERgIgGbHEygKUAvJJHj/qra1h342L4pf10nOgY1UQgSEFOKo3wAgr6XHLTvEMJwowAKAWqP5EOAx5IAgpeOUe26tvYJjt498Na9vIC1+O2IHviPt/x4VKX63i2oJRFBIPgUAWi1j+J5u1wBm4GrfEEM7j4ppLXLu/7H9XN3AoAeAGgKSuqPLiCDvZIAgj/b/0ICpgpgQoEE9Jb4KwDOy43dj8BPicE9LodtYeKQJwx0BFllIUSwoFbOoCizTQaOHIGfhmxpwQLdhwwWfk/IATzyBaIzeQCv7wz04jKU4S8kY6nCAlkpvLf8SCHHQK9AjlBt59JW3G57xBH40KCdAVXdVwdY83ukYH3B8q4/u35OygFk5S9lwKL+l+ACWP0t+Hf7X3IAez/A8voFkkBK7rVQAO1/IQN0CW1ZcgnFLVhAc3/AHAlURYeXitjwgKsCCPbob9VbYG38TG4gQYRTgQz4SQKYnA7M2j6bC7Db+TDAq35s7RVoLbTVpxj8WtubXe9XAGwiz+v9yAEw9C0oj6u/phsL/TngY8CxvPPPnD+LQ4BL6PzbYv+LDejl31zm2x3A1ZLmEOTYH/7dw4DTcr5sgH8v5AFsTqARQ7b+Bey1/s/gz58hRHCkALMJnfWn2YWzwPdhAJOEzRdYGOO2ESnY5TpsUCFDXpbbnCPwegMfL5klABsa9JN9EfRV7O+tfE/TZ+J+b8+tlvdtf0QArMYM7Nj+27i/D28mD+8H2AOMPpcjLu/8H9bPvLg43V5yCACx/5b533MBu+LveYDkGK6WDegpJ1Dsf/p3dwKnPQ/w3toQ1KoBrTKArqApfKkeKOUvio9xP6u+cAHO4rcwAGcSHksS6lAgyhcoQvBaD8oeTC8uDkHBdzv3G0sAKhBQNIAQLleqrL2lhb7510D3ZNEDu03t4ZY6VEAnEG0dq72y62P119bfUsa82isyqATwtf/d+hnJAUAIsMX8HALkEmAigaT6xQHsFYGrbP+3f1siME0PXt4LpUAsCxIRbMqf4/9CFsb2jxxBjfuBHKifQCcCmQwKLLHEGKn9yAX08wSVANyPhRxPBJY9tiFbaOSxZKD3Q3g2+uGl4zxArPk+M9CjBIasNvX9UMCnCvswR+AhlL0XiAAbxfCj2N4Tx0jn9Xr8Bss7/pvzp5cQ4HJ/H8B6vYUALfGHmX/4+2qFECD9vdn+Av6Lq9P2YyO3G/j3+H2P/fPfORfQQN5yAwh8QwI1iVjCBPVvBjK0Dtc8Qg4JIgJQLqDvBmy8H6t+QAD0UlGGu53uOxf/c9YAHcJRIogIwGp9OsOYAHRtYOQHGhBHGt9zBlbB8XoTPBqsLJx1jM+WPqIDPnaDooLxGPqWTB4HfHWM5R1/ev20y4v2PgAs+212fyeDZv139b/cY/715rKEADvwKwnc5XBgCwPu1uX1BR3AeSOBnAisAOfPuXFoW28dAeUIcq5AJwuRIFDJRckwIAd8g5DKE+j16B7y37MvHDVvOEajPyIATx8cHjQIquRhZOv1UcbVAEsJI6BHQUDbr6fhDOkZiD8e9Ec0nwMDa+x7cb2H6tMMf6EjTxzLO/7r9VMvLtb9xR4p+ZdBn2v+W24gx/07Eeyfd/ufbX+J/3MIkEOBXf2Xq9Pd6SJVAgrw939LCXBXavhcS4MW+Coc8O4A8wUJ/E3to8qAXm7dgA0HEPS4XbXy+SfNMNvf4IlAbb0AZl/q0beq3q//67pAWzrnAlitPQkcI4Aj8Lehgf7kLbungFnTr91BPwRQsJ6L9DmbgHCc8wAvTvnLkZav+S/Pn9KqACkPsCl8TvLt4C8uYF9ecwA5BChEUJJ/16e7vay4hQA7AZwvE/ghD3BKFQEJfugXSCAuPQMF4HkZTBJqYA+qBSo34FRfkYFqFS75AiCGmdeO8ctF5LsF0jEb5BD+fRdg10Ylwm2YMaDVZ47ibTBxlADQwHPIwFDVbmDGAfSIIYb0nO3XoD9a2Ovp+kjhR+tH1BDtv3z1f77+vpYETC6gZP0vU8a/qn4lgBQS7HH/5fXe9ZeTgEuy/1en7d9CAFc1D1DUvuQFQP1LjgDzAiZHsIO45BIQ6Br0NvZ/ihtoJGDCAAd6jPXt31bhdTlwPgcQ6XwM+jgc6JOBNfJlW7XUqjwDPgK9zR54kI/MfboiG20rQLfjMJBx6yhXYHW6F/Nj1kDF20xD3gFoGL9R4N/OtnzVf3r+pEQAGfw1CZjBX23/9nmL/5dN3W8urlIOoGT/M/B35c9/329/ny7Peykwlfu2f4vlb9b/XAmhdQgmABfXkPoGPDnYnEADPcwlyOofE0LJDwzCAflGIeEGahMPWvxRJSBS+p4DsG5hZP81CYz9wBwJHCEAFRJo9e4X/Y7bfF8AHIGeCcLCegR4Xh+TQl+/31gC+I/Pv/fyMjf0bBOCNsXfSGDr+tvBX4Cfkn+76m9JQEEAF9e76hcSuN+cwOYOdiDvIE8EUMGdKwPJwvtcQMsbtLZhGxY0oCP4PRH08gN2XZuR2EqDXDmwLb24XQHlUx1Ag7PP7D/dATSFHnsDHQwwLfiynrbyVtNHdl85gEjxLVlYrWUHoFRc5/yZIHpuYBzRR0DuAfyp4I9Ip+YAvvJPrR+/JQG3EuBWAUhJv9P1BvIN/JUIdvXPyn+9EcZ6c7H925J/dxdX6+3+K0OJCHYHsFyttwncRf0TGaDCa1fQHEAUFiRwJHLAvxNAo3wAVwG4q3AEfKwolL8R+E35dSIQAwLc1iq6LQPyOv95PgAoxrln/1UiEN3CDAGMlT4igHnlV87BG+1jBBCB3roB9gIMVAXcX2gCmCGP5Sv+w/PHpclAadbfRgAb6Av4S9y/EwISwN4HcLq9vC5xfwZ/jv8vrncCuC8EUElAOQF0AJAsbG6hgJxDBFxeQI/235JAI4lMHKYleFwe1B2DnCjULsDG+FFI4ElgnNzz2YMetHFdL9VX0oVRTcBSgHIADYjNcVjAItARpEr5C+AiMB8BOULZO4ftGjlXUPIMRTd7ZMDbNmdwhBTamfrhQbR2Bvx7DuDL/+T5d+0hwNLAv2f+r5abqwb668vrZP1r7H992j43B7Bl/wH8ORG4EcBdCQHQCdi/W7cguoGm/MkxDBOEUDFQpcPUkMT9AQr4Nh+gm4RY9TG5x87gMZOEElRnQgCv/rxEx/rj6j9TBNKBdQRWzeesvncA5ZjewjNQLeCRWHhfD2ZPALHVH5OBBvws2EdAHa1XBHBkn+XL/oP1Yy63PoBN+bcQIMf/l9c5BNj+zUSwkcCeF7hOwK8EUMDf/t3Vf3MBy+V6l+L/13L8j7mAMkGo5AZagjAGfysncpkwrhog6DFv0EsANmIYKX+rDkRuICKApvhRvd8TwNPtf3MBbOWbVuttojDAK7tWfQVw3DKpr1LzPgE0SPvtFAGoMAGVWqXvijOYA/yLIIAjQPYZiDnnsHzpv3f+6MuLZZ8MtIcAxf5fn26utr8LAVyXrP96k4ng9iK5gBT7b+C/Xva4v9j/i+vTQ3UAmQBqInB5rWb5k9UvxIAJwaL8UDHA0iF2DKL6Q2ehs/01b9CSf3YbjPHjsKCpc8sZ+OQgAzyO+Y8RgCWB+fg/0nxebj83mjhKAB7wiVgKiNjs4/aWCGLrrxW/ncPb9t46G9vHoB/F/KP1Mxb/MQRwdJ/lS/6d9aNKErCAf7f+1zkEqARQlD8TwfVa4/8M+rvLFPdvBPCQHcBOAOdTAftrOQFYwL65ggL45gJ8GNBCAKwWmJDAgF41D2G2nxOEHBaozyr5p2y/Ajluh8ZeZfs56u/BexT/a+tfQOj13tt6Ze0biO0RME7n+N5+5vxAi7uTA4hCALVOEQC7CAYyGnuv6J4g4m0iIP+iIYAvevf5I65yGXC3/0X5r9brqwz+q5sU/yfrvzmAlvzblf/qtIF/+3e3/fm/jQQeLjIBbCTAoUAjBgR/yf7bngEuFba+gig3gD0CbPuf0jGYiMCHBQXYZT2/G8Am/ljxkQqa/VY5AFxb8gR+WbzEqz3rPdr/eQLwYUDLIKh1s2rP2x0DPOcKUOERpBb0niBOp6U6l55LmCWEN8oB8LWNAoHli951/q0XS+rxb4m/BP6dAKoD2EgAwL+TQLL/l2j9r9f7y+vlYXcBWwhweb47Lyn+T3mAkgsoroCVH/MBLQTA3gFdHeBEoSaA8mahca8AOgZfGozmBDRN7vUCMDkUILPa6wwAg3scAign0JbZTIB3AQ3IqPhWxVm5vUvA7Xt/s/Wfs/gYViiQz4JdbZeOt/8iaP2faLsIgLM5gegcIyDPEIo6xvKFX7v+5hQCbHMA1uvN/l9t9j+DP7mAFPdf7nmA0+3lzVb6yyHA9a7+95vSZ+BvDmAH/+X16dnp6nzbgJ8IIOUBGhFwdcDmBHjeAPcQ2H4BmwhMSi+TgyIXUPoHxlODZ8KBkQOwcbzX+pG9n1H/PvBbwo2Dgaa62u57RVexPapv/DeTwQwBRKFAs/ps41vmwW8zcgW/WAjgaPy/fa/lC776/JtSG/CW9MvgL/Z/cwGb/U9uYLf/V1vdP6t/tv07AewkkP7bgP9wcXN6dnF9erZcvn6TwF7Ab11AcwboBF6rk4dUglA3EcVlQqv2SAqqOjCr/Dr5Z5t/Wj4AI38Ldjb/nAPo2/tY/b3Vt0eyII9UfkwAfJwEMEUIzWm0mNoSg1d7tuYe2O1YDcgN7iqeP7rs7wUBHAXz0e2LG1j++Feuv2F3AJdb0q9Z/+QCNsCfbi5vltuNAPbYf6v97wnATfmXDfBIAA+XN7v6P9vU//Lm9Hy9eO9VUv1GApYQwA3UUMGGBVwh0L0Ctp247wSwAuDnDbQXkPas/wwBoMpzDmDkAFDhEeYW2J4A5lS/ALQHcAtka/85qacdwMjqK7W36t4HfLkmb81HRMFWvUcK7+sE8Fjw7w7g87/s/GEbAWwlv80BXN8k+7//d7PlAHbVT+Df/0vWPxHAupf+LnPcv4F/A/6m/pkAXlqX1y4S4N9TXYAjhL37D/MEcV7gMRWC+XbhXva/vIY8mB0oJgFZE68IwJKASgRqhW8gt+t7qu9j+z7AOd73YYEigQKsFl4UR6Cs/hjsvdg+AnkvBxDnAqyT8ATRcgCjDP9svN8D7hFQH9mW8wDLH/uS84duIcBOADvw1+vrDP5EAgn81QEU9b9Z7i+v1ruLm9P91fWSlX99uLxeduXP/72UgF/An/7d3cCu9vY/mxtIpNAmENFEIpxUVLsEsVyIvz3gW4b5NeN2tmBMBOplIT4hiIafy4I2GIh0vtj1eQKYAb8CcTPhSAjNIbBKN9XluB4BaR0Bxt3Wntt9RiGAjd/fJIB2P2aThI4APvcLX/+Qq8uL2633//pmcwA5D7D/u+4EgODfcgCXN9n236TYf4v5i/pf3qzPLm+WlzYCuLhen51PP5+Bnohg3YFv3UDLDxQnwF2D+DlZfTOrsJJBATo2DuH8gWL92farvoCS6OMfIFEOwHb6aa2PC389sM8RgFJ3tuz9zz4HgGRh1RvJoSm+B7aP72fcwBzIE1mp+F8ve1zcj6HF4x1ApNBHlyuQP0X99xDgj37B+Z/ZZgJuan+9xf03hQh24G9hADiA9XYD/9Vm+wv4N9t/c3q4SjF/Uv/b00YALy2Xr9/toN8AvxQnYN2ATw5ymbCBn+cP6O7BXi4gKbt6bwB3A7b2Xp8HKOt0yQ/7ARG+jyWAfkxvXwLOCh+BfmTnrcqzSs8TQM/2Ixn0/44s/S93Angq+HcC+OzPf/2fvry8uN0SgDebA7jNZLA5gE39b5r9v0rKf3dVwb/eX93sln8jgedXxfrfnl66uj29clpeuzovmwNA8AchgUsS2vkDLUegmoZ8+3CL++EVUykAAAroSURBVDkUwLIgZ/zbJKAxAWjVj+DPZT6l7PGyWOHbPrG954SftfqYsUfgq2y+dQUjy+/t/Tzoe0m8Iwm+IyQRJQY5CXg0B3BU6WeBPbtdLzxYPuvzzv/U5gA2639zs+z/7mHAzbolBHcCKMm/jQCutth/j/vX7d+HTADPrm63uH99fnW7vHx1e9r+eyXZ//KfJ4HdGVTg49++aUj1CpQ3BtlwoCi8bwyypBCVAIvi4zyAErdj/d/W+THhZ0OAluizfqAY//ZvWm8V3y+zQI8dgFZ5TQYc51vwzzkAb917BKCAGW3PDuCXAgG8LyQAdwfwhz/n9X/y+uridkv+3dxuJHC6ubrdqwHbsj0EuLpZNtW/u7peGwHs4F835X92dbs8v9pU/2ZX/pev7k6vXFy/nuN/JADrBhIBaBJoCcG4cxAJoLx5WLYM0wtD5roA2fpz7K8IwCb4uJVHE0ADvFfz7RxK/Ru4LUGwQnMI4IFdYmmO171LaLF128cvs1UAuz5ah8vV30cJAMH1S9kBsGN5TCJw+Yw/cv4ntiagHfy3y04A1zc78HfwX+/gT7H/dVb/6xL3327gT9b/6nZ96fpueWVT/qvb01tOl++5bur/cxnojQwa+I/mBLhV2L9dKH5vQNQEZBN+HOPrz9zO44t43MiLYFXlO2XnRxY/EUSk9t6y2+x+ZPObVe+B3TuDPiG8SQAWokdDgzckCfjpn/n6P745gOub8/XtXQoBbm4365/UPxHAHvfvsf/VzXp/fbs829Q/Kf/6/Pou2f7ru9MrV3ent17drq+cTxvoy38YCvx8Sgru/xVHgJWBLWmI5cFSDrTJQPdCkVwJ4NmC/sUgUcZ/3vIfaemJQK+s/XiZBWzbPlJ2julVjK/jcgR++ZsBrAhg1va/kSHALwYH8CJCgBeSA/i0P3T+x7YGoNu7083t7XJzfbvF/nseYI//r28T+K9vlx38V7fLw/Vu+9dn13fLS9cp4ffy9d36yvX98tbru9PblqvX7hL4fzaDfPt7A74lAp8cTETguwYxIahLghgCqAQgZvltzV/N+ceY36f1UNl1lb/E9Sd6y7+N8dneKzvvFR7t/yzwtaIzyBXAjzqAxxDAiAx+KYYA7zME8Ac/7fV/9Ob24vbm9ny9EcDN3XK7hQBIAJv1v7o93V/fnh6ub9eH6xTzP7++O710fXd6+ebu9Jbr7b/709uu79e3J+AXAkguYN0/RwRAvQKibbg1BJWOQZwp2HthCJf+et1+JRTAWL7pfQ/sNr7nuD599m5AJfSsbbcqbxXcO4A5oCt1j9T8TQIoYc2L7QN4nyGAT/nU8z+yxf27A7jL1YDbXflvr2+T/b/ewL9Z/7vl2fXt6dn13en5zQ7+9eWbu2UD/ltv7k9vu3k4vd9y9Z77jQDWnQTKfxgKIBFgGJAbhUTbsJowZDsES6mPXxdWynyo8tFbfjDJx8k8m85TyTyM1ft/FzKYA3oP5M0dPA34PYv/JgH8EieAT/797/21m/Lf3adE4O3mAG53F7Db/5vbZVP+++u79eHmdrHgv1/ecvNweuvt/entG/hv7s9vP59+5tT+804guQAmgVYitKVBnEWIU4jt68PGrw23qt+SegXY0b/JynNZT8X1aOf93x70bZsE3gjoPZC/SQD9rr+ogagk0zj0+IXsA3ifcQCf+MnnX3N3d0oEcJcSgDe7+q+3O/jvNuu/3t/cnZ7d3C278t/cry/fFvA/rG+/fVje/+756YNOFz97fT79NBHARgg2HIhDgdw1OJwjYF8eqgmgB3rM67eIXgO9WHf+19p6SwocpyfrjqBn8EZgfpMAPMij0l4P0DPrflkSwO/5hPf+6vv75ADu7vdqwM3N3cXdzd2m/uvdzd3ycLOp/93p+e39ksD/sLzl9uH0trtnp7ffPjt9wN2z0wdd3b7n5fPpp06JAJgEOBTQYUBT/1IaxAlBJfmH7xDEST6+xIdKz5F8qfKrd/O0WL84gAJg/JeXqdq8An16tdSbBKB7BHp9ALPAf7MKMN8RsHzc7z7/g/cPp5v73QGsexLw9m7J4D/d394vz27u1me3D8tLt/fry3cPy1vunu3gf7+75+sH3L+0/Irbh9c/4Hz6yVMigB4JRKXBEv+rSUL0GnE38Qd7+5Xql7l6GMe3Rt+WnPMKX1Q9+jft6y08gtv//SYBqJzDTKb/KAEcJYJflg7gYz72vb/y4dmm/psLWG5v7k63t3enu9u7Dfynh9v707O7DfwPp5fvHk5vuX++vu3++fL+98/XD3x4efngh5dPv+p8+vFTIgAmAZUP4N6AKP7HdwTYdwNibb/9BFjSdGXum9pbkFulb3G4BbwHuQJ4H/SFJLZ/33cJYFQJeKP6AGbLgL8YCEDF9rPLODcx0vEX0gfw0b/z/MHPn59ubvcQYFP/9fb2frm/vV/v7+5Pz+6fLS/dPZxevn92esv9S6e3Pzw/vf/Dy6e/79nLp7//+VtO/9B68RNXiQCYBEoYsP0bhQB2fkD78RCeAdisPv/mXwx6m7zzoG5ttiU2t/82m95UHoFs/36TAHRD0Wxr8C8VBzAL9veZJOBH/vb3ftBGAPfPLm/v7k63dw+nu7v70/3tw/pw/3B6fv/s9PLDS8tbH146vf3ZS+sHPH/L8sHPX1l/1ctvW37N6fLHb86nHz2dTz8mCGALBdABYGMQTxDCl4Xa2X42wccqz026kcK3hhwEeQTs2eUYy79JAG8SQNSbP0sKf08cwG/7iPMHJAew3jw8XNzd3Z/v7p8tD/fPTs8fXjq9/Oyl5a3PXz693/NX1g986a3Lr3zlbadf/cr7nf7h08WPXJ9PP3w6n34ECOAnIAwoyUDVC8CTgLi5BxW/NOew1iewl/9KLI9Kj0BWoJ4F+psOIIH7zRDAViQUYGfB/j7jAD78w197+7Pny83Ds+X2/tly9/Cw3j97aXn+7KXl5ecvn976/JX1/V552/IrXnnb+g+89f2XX/u2D/z/2zuXnYSBMAqf0YhAW1pKuQVUVDRqCG5MUBN0oRt3bnwMX8c38EmMD+DGxBgX3qKocUc0mk5NkQk/ZWw1bozMgnBpWJ5zvv8yrbfM0QLHIzieiAH4FED7ACL9xS4APQlI7wxM7+4jOvm9pKejObng+1H9K9ErA/jeslDYOrAygH9oADs7PK3piCU1b1wzWEI3mKYZnmFazDZt5KwMypkcqtki6pbzuuTiFhz34HgIGIBIf5r8YtxHEz+I+PLmXb/YP0VOXwK/xW/0e9Rn2XUZzkcRgioBoqlA9QB69ESben+GALa231O67sV0YyRupJA00yMpy2a27aDg5FHJl7xaucKaca1V4LiEi5uuAfgEQPGf1vy0xqcNPXnCy0QcJvZgyn8n9RUBKAKQbQaGj/56kqVPBgqKVzZujBL7nzGAZrOtpczYuGmxhGUzw8myTK6IUmkSi5Uqa05Mt7c4TsFxAY4ruLjr4r8vfj/1hfBF2gu8F3W8OIwzmOJRqR5mDIoABpeJxHz9N++qBKCiHwIDaKy+JWx7LO5kPb1QhDM1g9mFGttYWfP2OY7BcQKOc3Bcd7Df7XT9/VpfHPWlgo8WeVD0UUkvS3tFAIPjyN+Inv5XGcCQGUC9/hwrlQ1tbn602FjH5u7eywHHIVwcgeOsi/v+jN9v6vn1O+AG6vEwUf/kWjDVFQGEpzwdPSoD6J9UfIX2wWWiYS8BPgCAPOYxoDrtqQAAAABJRU5ErkJggg==", + ); + })(tr.a); + Ht.a.ShadersStore.rgbdDecodePixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}"; + var nr = (function () { + function e() {} + return ( + (e._ExpandDefaultBRDFTexture = function (e) { + var t = e.getEngine(), + i = t.getCaps(), + n = false; + if ( + (i.textureHalfFloatRender && + i.textureHalfFloatLinearFiltering + ? ((n = true), (e.type = _.a.TEXTURETYPE_HALF_FLOAT)) + : i.textureFloatRender && + i.textureFloatLinearFiltering && + ((n = true), (e.type = _.a.TEXTURETYPE_FLOAT)), + n) + ) { + e.isReady = false; + var r = new Wt( + "rgbdDecode", + "rgbdDecode", + null, + null, + 1, + null, + _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, + t, + false, + void 0, + e.type, + void 0, + null, + false + ); + (e._isRGBD = false), (e.invertY = false); + var o = t.createRenderTargetTexture(e.width, { + generateDepthBuffer: false, + generateMipMaps: false, + generateStencilBuffer: false, + samplingMode: _.a.TEXTURE_BILINEAR_SAMPLINGMODE, + type: e.type, + format: _.a.TEXTUREFORMAT_RGBA, + }); + r.getEffect().executeWhenCompiled(function () { + (r.onApply = function (t) { + t._bindTexture("textureSampler", e), + t.setFloat2("scale", 1, 1); + }), + t.scenes[0].postProcessManager.directRender( + [r], + o, + true + ), + t.restoreDefaultFramebuffer(), + t._releaseTexture(e), + t._releaseFramebufferObjects(o), + r && r.dispose(), + o._swapAndDie(e), + (e.isReady = true); + }); + } + }), + (e.GetEnvironmentBRDFTexture = function (e) { + var t = this; + if (!e.environmentBRDFTexture) { + var i = e.useDelayedTextureLoading; + e.useDelayedTextureLoading = false; + var n = je.a.CreateFromBase64String( + this._environmentBRDFBase64Texture, + "EnvironmentBRDFTexture", + e, + true, + true, + je.a.BILINEAR_SAMPLINGMODE + ); + (n._texture._isRGBD = true), + (n.wrapU = je.a.CLAMP_ADDRESSMODE), + (n.wrapV = je.a.CLAMP_ADDRESSMODE), + (e.environmentBRDFTexture = n), + (e.useDelayedTextureLoading = i), + n.onLoadObservable.addOnce(function () { + t._ExpandDefaultBRDFTexture(n._texture); + }); + } + return e.environmentBRDFTexture; + }), + (e._environmentBRDFBase64Texture = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR4Xuy9Ccx261oW9q5v/r7/33ufgalSbWtiTJsmTZOmSdOkpVKsWhxAxIJFQaCKUkpFiiBFKjKPh3PO7hjb2LmNnYxtjbGtbY21rQGkgCgiIKPMM5x99ruatZ7puq/7up/nWd/3bzzABjb/9675Xeu5hnt41rv8s+evW9fz+ZT+W9N/63o6re3v+nlfvq2CbdZT2hbW7dukDbf/a/9uS3G7E69Ln9PifK50sHSMvD2ur3+XY/E2++dyPelDPoU7Jm9XTm2uab86vJ56gvSd80dzXflA+Zul74PHwGuGv/MXLv+kL4Lfp56r3DM8ef6utE10Xnu97fra7uWi2/etZ8BV/F3F+fdni/8Dn9O4KSvt/cxPMa+HY5Qx024OHF3cM7zHdcsy3uAeuu3wPve3S2OVthHH09v5e9BuCT0HHgPlHsjz+3uxNALYAJ9JgAigALyBmQGPQEcAxwRQgVhIogwcIoAG2HYsM1gR3IokEDD5biMBhMeSoLXkweCoAxsGcDoX3Xi3nkCFACnfiQaPARECgPaVAMZjEuAsNttAjIBZSY8HXHkuFctt4Npj2e8+B/ImFOnwEcg9SPEqcNdyDBSZemwipBkwmvMwocG9Gm6nCDUisHpb+iSRTp+2kQTQAJ9cACt8cwRN/Ss5IJBJ7a2qC0AHYK4gUkpuQE2uoTiJfMPw4epjeqdRXYE5Rhu0me7aGCwIKtfFD0sAmklCgWBmG3utbfCrfdtlBUpK6qUIpwCkkUYDIg4yp4QhAeW9GDBwLR6glgysC8PvZq6o2MJMT3jdhtKqI0WiMfeTCMhs54BqzwNPyLueclxzS/3+XQI0jtSSQrmly4ecv249Z+U/gQOoNj+HBKj+yhGEtn9/2C10qLaWLH5Tz6KykeI3FTb7wM0uRJMWlZtmQwgXFgAr23VwDGRjADoPOgMIQ1pigNdnCrbviaqvFMopuDpvHjB8/RXoeI8ydGp4RAM2x13NzQtr74BkQoFZlceBDQTugIlaixa7kbn5nl3wNgVNpxGKi2OvQxJmjOJ24riNB/sKX0VJPS/zjNfTTgAp9s95AIj9K9DPqPQc22+nS6C0eYAGZJMLyF+sPPwGVggXypcH8HggA5gwbCjHhy9v1Z7yDIY4Gie3nIMGrQHUUNVBVeq14rnyOeiBvWjVl8QgQoZ6NajErESk0n0wx4CLFLuXJ5gOE4J8gtV4cW2RlYbvrO5lVWMk10KU6lpwrHbBr8cHn8+EMdH5YPl2H4gANhCmPEABLTsBp/5k+Y1TwGReWlGTgqiy6WFrxXcEQQTilLw8mUP5AIh1pbJnTgUrOiYIVBZKMAXqW7GISigAyjbYgkWfyyqyTTI5ZckLokEehQNxAs8TYMHF8X3w+3kSrcc1qozPAsAUqbfLX8B5AKgyFGBidOcIiB8JAMdZWV4fGak/nU+Sd0BC266CANbTqdp+zPZHmX9Uf1Txju1HxS6DbeeAZtOtavtKAILAhw9B1aCNjhyJELDZrldlFwRB1YT2nJtUNnVTBPJ41Y+dAQwOE2eD6+EBWZ4FDDRUFmUn7ZiLzjkgGbgOTTTintG1y2QiuKh2ZSKrLoDDVt4RI90jc28CMunnC/AK27iBhEB+FHgme78rtk2w5b+vcguSAKLyH5YCfT6ghAgFeAh+H9PXBxcBPiKICjo4fnEE+ODLk1NJQ7M9PACXK2iqgTa1DTpPHo59FYGgNZuM9T1AoBphFMIPIhXPMzG1Q/jBVYceAobVqCElHYo+uzwBPKvGyXBuY1O9YjZBQzOP312TK4PAVjDw/Hn/p5CEJKI2puq15C/jXFz7kiZB2CPLckzzzIPjlMtbPuT89WtK/rUSoOkFMDV/KvflEp6pCnCtH614yRPU0AAScxjvlwGABFFGlgQ12MJD+QCt7HX88bEE2aRFFnhGOdBO5hWsLDOx/mzZT6meSgAa9cLrYnA6O0yqxSDpbG/uFRAXwDWPYUsG1s2Le91Yp8CJsK5VM6wYUJyMGLLqjESsCcykC80XsddknltlRSC/fL+GBFAdXXw97fDrafnnzl+fG4FyIrAAPggD9nsTNQIhsLfziwqAVX+r5IcqAQKMxZlYUBaSQVUog4jWgXJhCGKah1QlQIUDZlDSQCm804n1+6rfQOAqEALA0SCMcwdeqZyqONKIQBsAVoBWKlcvRKnq6YHSKmAa/LJKUZFBJMf3tEdeJvmGY05cIx1XkXIlH8re8/J0SeK6I3LMvQCSAHQYULL8OhfApT6X2BN2v4YSRxW/Hivf4ALcScuPAx9JxxIHwKY6AXiIfC5+mHBNj63rW2cAwyMiDiQnygJ3AQzEZ+6BG+iCGBQ4BqD1cTHlKFTJUA3kyi0RyHF8EAAVWOg+vBCSqLeMFFnct64jOXAcW6SM8wHbLcgEUNT/3BKA2BJsWnoFAahKgGv79V2Bs5WAWkbkHAAMirgnoA1ajN8REKHay/IesCzkDdrzfMR6/B5moHuLORMu1PtKipbG9wGldsSgQVSpqdkWECRtRcPyn1DQGTVvl+rPh7pYOA2tvKxE8DOBJJuq+4/i7rj0SKpN9zA9QpFQbV9EtBxbZ1uPUcYDuAlDAEn5z83i7yRgld91AXZiftMXkG9oAartCqQKQOgIhOKHMX8elsbWF8mgdRSnm0QfJry4SoCEhAwND9EMjFE+wCXXJlS/o7ZK9RXwDhNDl0jsgJ2r81cpz8a0MpfrkJNA53sQqWsHXI8mCXZdCDImRAHmuvljjiO+Z+0FUG5GCMLy6/YcAAB/B30igdOZ4/2dDRJBIKCNQyggxfheNfn4kh8qsSGKei6v5l7VDyQEcSBzWIEKgDeTtkubWQvKg5StfBsXI4DDd2ky2EBirkt3pw3BXbFnQdjGVqSoj9weBi3fB1QqHyaIe0FEZMmmnigfNqoYwDOge4zg1AovQhcCmflOgjgbX4jrCLavWzpCa8/EOQ5xXds2y687f0ObDchdgC4M2E4wqAQYYsiDcrcRDSjVRRiQlQds/5WzAE3mHSoJlJGfIoeW8jezBDON+R7/URIQE4IyJvcJQT5XSzqCLhHJtOFN9pBVh0iil5U+5BhUnM6qw3G2UOCo4w/hkNUGtDWIa3mOgVC8CsjhtVhSN/c7ALl0J0Aqs6BkUkASUWMFiapFKoLwRCgBBJCUf9wE1MCswoEKdOcSChlQf76y8PlOGkeAeYZCMkwg+SlJ4PfIQal9uQZULKW4sAxVi2N1rr2zMusyXx/cKtZXqtrtFJxQ5C4xKBWeARc7D6F2GlAQLu4j3zoRoEwXPqRTkKMBMJt9pWLWAZbX2mON8gDTyTl4Jgbc7lrFd8HxiPdH3N9tkSGAU24DtmU+7gYsTT8lHGjlPhPz13gZFV01BWUbpWr+tazYyMOoI8TkCKg4ISgUtRIQcDwk9xhQ0u4jIQHL6m0bqDn5xANopvZ/vMZfvpGoYbscRNWbLEITA55VGMhAkZMrsfYAqQa3JBsgBiKJUTKuOg9x3PBa8ZljsjCqZojlqPIy/CFCMg6pfEe6ZvNdA+JbPrSGAG0egO36C8p+KTtYe/ttGZBzBKz+uv5fzotMPQLz/r3YRbhqAYDOgdvnDDzJIPNb4BxK8kX5AnQghqk74cJAubXqB7aWBodSMnU8Qw8MdHPMdv/cwOUEnhvEvnLRxnusgD0n0AM5CgmCMp1T2epj9ffu8XuJQFLwEZH5Z9OIH11FJoACfnohSNDwo63/DBnkyyo5gTDbv329AtpokhAOKtq23shiD21ZxIUW9VBwHACYsdomk5+HEiiTGSQ4uCsggqYg/L547mJyMZ5mNqdKRc0Eq0HDAMNrZyJS5SfaXlpqvEfRwOXjRKrIcxoitWUSI8WcUth8TYY81LPoJQs75+2SSM9F0DUYcHfcRLvFgijzdyAC2DL/rQyIQEdXYGYE1jKgz/Tbkh/Z/5QsqH3jBpQqL4AM3Fmv3QOFEDgoe9l/tZ1RAuEsROLPKo6v0VpVoGx34bBDYBxUD14EMQwciGp+CgGggMeOgq45Lnd13MZR8gjAFfYNDBUcoYturN7MmtMwTolJOoN35Ca6oUS+1uVDz38tVQFKAhBagBvQC1gpHJDgB3vPiUAX00MG38TzXtGl1e/lDdJoM5l9vGH4EF03IA+UMkBRPY0TgAcrcgpISra7TOUDhKswpBN1zen9npIAVANdDjrOHQycROMOr0xy0KrjT4C5FwO3R6nU8RHJwgN5AKPgh8EN/iRKaIJDafeAvmf+uBNAUn07GagP/jLYIkIoNzB2BVb9i8x5R+DsugFj277adAYrzcjzFQIkCkhYssIpYKtOQUkedI4qUlXeoQFmPkloQhPhPIrtVVZQgpsHY5DQi4A1TRiVw/ygNMqnnErPDgsw9TLz7lwHbPhIofsE411geVYtgtDEhFUPXVZUY8o7jMQR62n556sDaM1AUSlw2ASkbH3JI1T1hwRhecBQMTAqraw+EYCNz2dife4baDfHJRyNks3affEAYGCyIk8lEVlRZdKunVcBVA1YNUiniIE7INmhUIwMmmVKcxFIFGGNMvDTYMZcSrnO7BbbRzxae+6ufViQUZR/wX2738WFVoIICgYKW8jvQd8Bt4Xx6Aggeh9AHPejamN23ycF7Qs/mouoFrmC264z+yEYOKPP5ABZ9y64VYJOOYfIFaBSSVeAmWKRA0DlEqpbH2XFePkjHqj9TH65v6gMKfw0lpHPpxS5objAaP5FmjOhQ5PEdnyRhFMEV3cdJe3w/uNZguVpk6AiIPMABGJ1X0ffyZDUCNwgavB9SviJbiMTQGkCyglA1QFI8bypBHAuAOcHRK6g2K1uHK8tvrTx0/kAn2TD47Ux7sOB+shrdn8yhqfKASufBbi2h2FPQX7WXdUPiCPt6hUujXs7aB9VGmTnMhrkADgmPaO+Qez72CafOfdQb6JO1Kl7xgpNhDIq5Y3W1+cXOJiZ9cuH7SEA9gCUeQC5538v2aVLUZWApt4JrOkhROqPDoG2LczZrQBwchCYeBjrk+pB0rFlrGEosLswrD/OFdT7AgqGg5oVy5NLRXZ+vAKoA5C6hBreI3YzNIja9Qg1AdVvY7oRRpQl1wAVDUk9hVXKq4gDvh9/g6LgziGMQExuxwBMuIUeifVast11dZJ9LCYu1IDxh8pf/l4+7PyNtQpgfxUoE0EH/GWAaTdQ1EWECFV1RO8ArwubeoISotjfgFGp8UDRe3G6BK4KKYq5xhgUH6wAJ6s6D6gQpBznsvLwgAqsOEK68YO3s5bMhD09AlACWQQi5VIM0COwiuWjmDx0FjzvgxW/13pcSnnm2dC9jZKl5WGIHhFNACqPkc7lCGCU/TcuwLmCMeiNQzDg7gPa234RHqBysJPAhxG6hbhfwKgpxfkxMAHCgmTUwJtOEiqVrC61/EFg7Ci3AppXF9Atdh+kuFUdFaCFojm3IgECEBeK60kKAHUoZhfuS4B7lAcwKh8kHHUmH0u9nhSqkjviFgRiXI1fXwmA3wWgG39aP0BR1aPqnwY9WGhX/89DsRsKiPZfyAHg4EOlaOAC8jDEAKZOuQJUdraYUtl9vkFZP6tmgyShUB0GD37PSLldTG8SgA0AQ3VXRAT3xrgIJiiy3CoB6UDEJNa+YIYoJeciRxERlrPMMCaCZKLKvxSQmu/vzhkkEtnBgeIj+PHK6nLcNpOkeYZ0rOXX1xCAXgZi2oCx3s+WPq8zbiBfmgE6lP/KhWGcXZfBvji4iBAkmA2ZEIvS8QuBpfthldqqIZUWYdA64OLgRIUS2fUjrgEJLSozuUQmgUu6jXAbqxSOLAJra++HJ1McpC9K8Q8fRyQ9DVgDZ6G+W+WKSgxarVWoJglCnHtEIJVTpkuB9hozAeQkYGc6sCkD7oABN5AHeHUDBVTlC5mWX6X+jRwQmCVcqOUpTtzV4zfrjsAyYQMCV8XonbLfbPa/PT/rYurDDkkBO8/INeQnzOpolZlUipXWKEE9IDQf2az/oQSgIRGtvt0KRUURfiMYpNWJtaGO5SyrblSVKcfu9SWMzl9DEQ3uci09lY2Sn4ZAQDzqZZdzd8qY+OQrwdKxdJiR7tXy68//X2sF3kCArwTLLiCe/PMY9S+jEx2BBYyr2e+DQOQITJ2/Dex54Jfz0r4DV8AAQXWwyq7sPHK6Tc6MrHy8Pg8DVhAR9w5bgyN1V+oULkOw4rXZ5bpa4O/ZSKGZeJ26qnzFvlGrKjk1N+sZZoqgAoLo5R4UuTNpmVKtPgcLVCWC/B2ciwDS3gmgtgLvBJB7Ajrgt/kBTPwBkKlvIJ0zWF8v6A1KBIaVgTYgfaNQ0C8gyMEMD6oy1DME+QPnGsiiIrnU8wDDj9aPzh+pUDsFERYMHv7eJjwZqa5UdgzbiEQiIA2TewFoRCIyJhrhToj8nMqO1rcHA+a9XKslGA9g+508AYr1GCLAd1/+BXAAGwjw58AR6M3ed6x/vhKb5KOcQQXQRE9A7ari+j8QyUR2P3QEMJhVlaGJQL6hLkywKoKgsU7AZs8ZXHbboHKgBgwmKqMBxZliBbyZBKDscAs64jjnkVlGWWG+T45EgOwiwmF9xiYmDUzqeETVVSVRhKgkDiCIgFh0olCQaxl0ZmwSGdbrKTgYrBfHLGQHBFC6AakBCJOBEPcnV065AEwEFqA/QvVVCIBKZ5xE/nLVHnNVARUbB7/L8nMeQrgDAQKfjGykYHQDHEAT+UIsvgUX93XlJgFqoxKiPDSTyFMJNbmfcikiuabAzddpwTtSvn4LrrpWbvIqAx+eLiwSSt9UwOZMRNLNPDNa71UaQatzJ6b7kUBfL1qRNwIer9q4knS1mQC2o9gZgbIfQCT+ynYtUUd5AdMViKQRdAIa1dfJQZkPeArw4cZgXBqWDYGd8VraYhjmLuGo1mUYmAdkE4M8gJAQq2ry/hTj2n3QlSAcGilFaqxUVS/zyuSB0FfPIYmMlLKj6JbwgHxgRgS3RHviCPaTBGG3rcajNolZUnDrAxvfnqQ6vsqptO2W33D+pjVNBW4EMAX+mpgTicCB+isAO1U3vf0+BHCKT0qPA8e4B8wH4OCJYvSIHBhcYP10M0+5IpX4U27DNiXVLfA8Nc4m5arPt8AyyI5z9yHeQ1CR2BmIwa9IyBCmrezX17mRarXsugaNTiBqUnMuw90fIiqZVwDiFm6nKLJ1AUF1xXzXvAfdt6b+9GzpXsq8C7uPzrGJAHJ8nysBhgjodeCqDFjdgAoFirJHGf2q4FAdEACtpcEg9m84toM/zgMwucBwCcOE3ja4DocenKehOQ8FAdD80FgBR+VAsz5oJXXVBGnpo9IgAaHIlEzqiZJm+cYAQgsee96oEUiXtqicWiV0UFkogIzICwEb5DdGuQv3Pei+heszmKOKST2MChGUWBA5VAIwrwI7l5Bgu6HnWoKzbcDQHASKb+P3fqJPdwQWRmTF7FQIuurPwLPHxRIK21NPGn3gcznGOQ8kNBp0DQ8+HuQEEqtMz3HUKzZOJjOQUsIjQBYOQg1Uc71MbF0CadfplLXadOuompaDc+BkKbkNXaf3eZlCVPIc7CzpHI0g8nUJVVbfsQ2T8n2UI6IxI1xCdOzlN9YQoDQDbe8FhERgbt1V4J9OBAbqb/IGBGIdJsCtL+xmQgUcMAeB784/ytzT8XF/UFRHMNW22wHGCSwNavH9m4fQvw6rADeZ9T+UAKyXpgajzrp3yWKkxhVHHhBIvDqRZgmQXZMBemCfdVYfBIJzAJnoXJs2EIUF6YjY7Pdmp9gNIeDaMgHAj4PWXoDtkEFFQM73L3YvhxGh5QeFB9uf8EPqn8MFta5lxicnBWFyUYAVb6AELSaTEECsmAQu88B761JbCoDY21a53rgKqy5tiMCzKYqr5hQAOcnYUtnfIAutEmxqkJprNM+lkV0BZEhITSYLzGCIE1BCQNP5Bq6Bk7+Pdwd4B5Q7EOsFuTwqRNheCZYcQHkbcHshSCnxuV4A/jFQfBlIeYBmYk405dfH+sZyF+UqD2yg9N7Kl+FGg79Ty4+B3x7MlKJTEonBgAPZgjpI/HUdxcgV4MAOSKVnXwXo+ZpN/MrJVACnsqHqWPCNAFeQ0wESa7dGOQEPKHUNVbfrIQJ1LeeVYZK4z4bQ8Vv5a023KfiO+R46sgzcZL09kBeI9l1+4/mbN/mHFuD9F0HbLwTz36jsuQ/AN/6gkkfvA9BqX8Dis/xC6UmJnYpPrEfTZh6A3Nc/JLTqbO8Q+EhubVwASdXxYZOX5vqGMwEVwPuuQCWfZJKQBvMoL1GPaxQX9pIJqpjMKvakSxGACpxJlFTUSTigC7heF88XkgOCiIiGn2fbFfco32eOiKYqAeIat0XLbzp/M5QBs33fQR8QAai8aQTC5aYKgKFBUThUf87Ccx8BgM6oNzkItPjFPTCrKhuP24ZhAgGfVLGr6KyIImRQg9JE0nCMxhNtkDThEoNoYj5AwyjqBAxCvG+gvjFRdNQuOpZQS6da/KzwWkid00ehqJ0SnwPtTBhQgEXuISYARYLBfYfvh3c0x4p57ey+QCYwnoAASuafp/4CKewAwex/+Zxv9nZgUb8vpbum7pFDyF8TcgNVI8sorevK47UEg8ozCgvatqzEVoWdsyiDC9RNq71NJFq34bPMdtAUxwN7KdVUdlTZ9oESm3MH/fXOxaCq9MDZBUd5fm2IF/AmTrAqaIBAoDeupJbP2pgyxz2YpHNkVMVCX3ev7DdFDkFZ77H78rMrrmEngPYyEHgNGAK9/G1e/rkdEsGnGoJoPbkESRZGhZV7sIBI4w4AjAPRxfvgNsR+mA02gEbwUJwW2XxUZSQQHhhORTtq37Xdw1jdKw8PJhfCCHWzRDGX3VfgmU3oKVDX6hESEDXq7gPckJIFKj7rxgXGdxmFtc8Qj6X2IfdBBBiSQyUtrdae/Cw5soBUA6Fe457PtfyL529JIUDOA4zj/5wfcFl+Uv8Cyv1fPyGIXUF9qJzsK/sX8kDgvmjg98Dds/ITNp8HHD4sV/Iz5ASDbdrOm6Nn4dMDdQR6c91RYxERhVbi6v1LvcNodK8jEMm0qLgnlQw643SM56rnLeQQqam7/nwyvhfhtcgkYQ+s+Iw1qfq8g3JGR4ljPVUCaD8NHrgAUv9qz8yEoPIQAPR1fRz/s5NA6yfXdeL9+sghVJBWf+QUCv8juGFwNUs1b/OtW4hLfiOVta7BJv6G+wK5WHgoK56PRqDqkZkFhQU9g3Zs7wfhwahsicXAA0k8b5c7RIJ0NqX0mpyNWpOzKeDvJSoRM7h9OW5EXjsB+IlA7QdCqyPA+B+TfEgARaWd+peBVKgUwoVyXKfwvvMvjUNyFEYto3xAuek+BEBr13IGloVtOFCecgA8zj47V4EwaPfD2Ds+hrBwOEhZyXqOYgz6QtRsOK26uHNWMIrvlwd0e35+WNZB28s/IDDEPZKKPKveKvSiONw5BnZ+AriRy9AvFBXkQLmK8TV4Z9AjjuXDawiQmoF8CHDOoZRN/tX+gEoMj1P/FB5YgnDhgWgSUvuZUEMQAzqBpwMfHoXLFtsEHrNzE1TKUsvqAgEK1NgMF1I4BttItbsJPpOMixVMkgJcL+totbXDRF/sBBQg8I4VUmA6a+cG+w0AlrkHcR+c46lSHt+n0T49wKLzZKW398ITgXcB62n58PNf33MAthcAMv9VcYNqAMf3rgowjv+bwgrVL4MDlLRsL/cbAL8OQgSb+duCMp4S3Oxtcw68Lw675j56au9jcmWjtV1HYnFgm+jbj52EGsyjBKBSsyISFnSPyhlIex+7D3zuSArOEWUAPzpJSC6l3aUeIPF+BC6g7k6iYVzH8XXLb84E0H4dWLgAsP9NnSnpp0KEieRf2P4ryn3KiiuAovo5q6wqA5k0pCsg++1i/4w6va+107gNDzzMitvtKHlH1rer3NyRWAZLHkyjBJ9TjKjSMJNxD5yLUUPlYtQAN66C7g8DePaYBrgBCB05WOAyAbfEnQd4RDwtQekJwycCJ4jDuBrafnspKBIA/zYAv/EnBH+YB4jVv5f1d4pq1L+M3sZ2lRhggCrga/UH1uxYcEM09T6O9oXH7MIEP3XVkQsA1g7J2BU4YglBP1JjbbuVMjoiyYRqwG2A7PMMChBMmH01zQ8lJJrYkdiyYgOJDgM8Idvv+QSlB7JSdj3zD7yuZMbmw/ehPMd2PysBpNh/awkusX6uBvCEIIj504AtMTyDfWYOACblbAKvHtuAAFwHVQKUDe8n7wLwhkk7aEWmiTvTIYBxGp4cTOynLLtLOlUpd4PCVhzsQEG3YYGn+9Hx+yE8HMA7A5hdzWOPo67XLVP19OmQge4VEddjkncezNS7wudQHYyQkORQbVglMC7VuoDlt+whQJkKfLZTgWuv/xYW4Cu8EPTb0Rns21dGQOdbMFEStIm8OKtvjm+ARUAVZTwXItD+VhGA2CoF21jLuwOKRTlMoHp6D2BmrgFl2lmhXJkRtscrMoAR12bXazvMdtcOSriyTqZ8hhQcUYgwpKfATHZRgo3vT7PiFjBehe36CJz6nQMqfKGxY8ihF5rkdRQelXujCHdbtvyW87fWRqBUDoQ3A7vaP0wSUrMAwzxAuTj8t5MczIBM/2SCQZCinQ5i+sO5ASQsJhS8HnYk+bNT3CrO5YECmeVR5MKUolz0EC1h0YCr46UMjo4rgO+hgBCGIK7WPUsKSk1F/wMMcme7a7QD95FaiUys3S3nIQzstT0pDDDXb7+fJwx1T+haypgSzkCRswW5vU/9dWsigNoHkJ1AfSFIN/lX7H++pAN5gJpbQIAXJar/ti/Ssv4wyFG5wFnIUh+WETlhxbF5RCiGBArIyAmoZBiHFHUbfJR9cjAPvVeSU/0DHdAjafE58D5GgxiJqausQGgqrjbLZB+AVso5dRfVisBFSKse2DVzzl4AACAASURBVHG+d6MEnXQYBuiW2I1iK0Ew5ABYKQ+Lehii/MnyW8EBtLn/KRdQau2+5l/WlWQOhwQ2XDBKzgB3YUG5VF8StOEBxFHkCOpgDpJ6VlExD5Fvu0wmwkDq5QmUWyDQtudJqk3TfavOItnhoAnsdQxs0Z+AjSZRqRAVbjAY0UVEg85+L0sdEZAs2RB5wqBHb5IuOyCPACh2//yJvvNjVT0kGHN85VK8Q5gjq57bSOsyAWwjPs8HKEm9Eg5so8kk+loizlcFOO4/lgdw6l3IAQEkljkrLVW8PMzYRbC9MrxqQMiKzQnC4hCs+sgYPSqtuapByaPoARIm9vi62T4LgLSchAKaB5QlHLG+5iLmgcv9ENahoJ62p1R4augyOknCI7F6pOrq/E28OkpPqv441+DJwpNqu2fLbzv/jTYZKHoHwP6EN4IojCqmBHPSrwzgEsO7z+WR6ux/U3FMILJCU4LOOAGt2D5WR863wI6Se2HWP6iHz+QHQhC5EKLdA1ZY7Rj89xvF/3PHVUQEy6AioJyAUbDJON8AonIsEYCZFdghiumuPrp/oduAc1EeIu1iw8WyLCI2v/1YzfWxjIzBhKi0tSGAWgoE1Vf2Pylu3/bXLH0lgDI4JjoDEUhVwRQ4SdXREncU+wiw02EC11CTdnST6/YKEDZDbodXGdWBiprvBI8bwMbWUFYReslGHqwB0PouwcfdTE5IHxYgvKaFaGqf4bJ8z4bbgfriMzEJRoyrxbOIvscbkx8YKD187/A7bCHA5gCO2H9j++nloHZdnAdwTUC9+QAVgOQEjM1v7GrUtpPg06oMLC3zAHo95ibMQOMchCGTHjkUYmvbGEUgxeyp6UhpjUaaQROAOMg7WPUZ9BNUC26/X8uPsmqp+yAciAG7B4iKm8NldC+G+QxwBvOqLr4D5mTYNXTufQG5cnfdEOAj9hAg9QHUMmD9bFXeuYFi+00F4EAeAKoAM6RQkpL1BiPAVL4AW5FZyWViDpR+Yj2/xBETYDiwHNnk5262EdeH3zO00ex08kB0eRFshJnpDyhOgJQECcMM9N51sLrOkoiK1UWi8gg4jboLp9ZTyylnYBwUEVxQTj0GWrzrjSgr/7hQIwoB0vLlI85/s00Gyom/NiMwzwswNf9W/quhANf/XYiQL9pYaVR0tPciJyCBPJcbSLiKLfzICYzW4/HNgxxVCgTAYtLQbsG4jV55sESgFb02HmV7bgc6JTLrSS1ZpgHIce6g6jAJ8BnlDsFJ8fiTEoSkzvI7B0QYq3AP0D4UHIUT2n3g3bGksRMAhgDoAvS7AEQzkLPwg/ZgtX1WwHT/tv9PBIFAzuvH4A6AT6HBKCfg1nPTkJswVAgPIZpvfJR1FwMndBRFUUXyDMHMoIjtfpBzEE7FDjD41MtDRLa23BKqWc8obTsdK5xV3dCxKEcULQuIs+cWIiDy9TyOGHx45kOAdqZuCPCR2QHYtwDTjEByAHPlP1b4WPGLylqlbtvXmwmq2pTZVwIsCJAELCF0bToBshET3PygycfyregzMGpNCpvPa9WlQyiVKAXZwAwBk8jMfvFQwrCQDhJ1B0QGxL1SY+Qc8jWq645UkJ1LlEnnigs7qX4Y0AOWIh+7vSK3uRDAHvuo0kf3YvnI87eBA8DXgQEJgKV3th/yAC1Gty/5aPsE6l5jefE+AFNa65TpyOa3LDUkCKW7gMfvYlNR31dKzfup5J9yDfXUbMkHbkGA0JCOs73aiaiBb1xCvV+s+0CkSCZAXmy1GZyj5GR8be4KTWkLcx+VQ5zDmAPxTOhhibq5EXP9ktRniGFG6Y8Qg72+7ejLbz9/m58LUMuA29uAfMlPZvupFdgTReshwISfU3eXzFOTe1T874EunYABq2jogUFfj+gAzgBosW7XVRS1M0DpE1C6nHiwzIQJrDASjILYlMpE5xsCNmp4AnAitJlyMCQsoBsRmAYnHnkMQnYysVvokcr4PHMu4MhxPNj5/hoCaLG/sv+cDMyXS9n/Rgz5JpdYvgwu+bkdS5MBHkttC+Ymyg2QYvrEnlBgAoTO5ItkWtj7H51DJdkEwVQ5E4m2TCyNu/z+zWx01nFSTrmdXpmKWpm9b2CFFAO6Q3YKJP2kHsIXzh02Hr1IZzCTwDsC6Mcovd3HEn/6tHwUOIBU5qMXgir7X4G8HSQnBct2FWylZbjTDgxlQB3Ti31Nwo2n6qJb8Ouq8whKfO0GCYeh9qm23qvKVOKwALdT17fEg/qjcwus2tH+JibsJRO5dZgSnu58QEbSQYD78XGpt7w8aNm9pPGHA13bZqV+0gkNrj9SanVd6vu/cUpPY8N8D036uwP4qPPfCsqA4oUgNXtvW4Fr8k4QQ+KDTBQYBxelFJbf7IMq1N22uANOqtGXl4lEdhHl0c2FCO1644TeODRo18/AwLgWB7LVNyYEPSA4e26uq7iMKF+BTiOy7k+y+qTYxoHEA1wp2ygHESYIu8DxRL8nDPND8TkD7QLU9U4Rw3LEMVi3FX3fnQBaGZDtP/1GQFX5pu7JNeiQwAI5f20OA5RzYLU1CT6I9SvzdyoBhoCorTdQ9XGIQMnMPGjS5YzDiTqMxACvgyNKJPYqCAjQUd4gg50n3dghawdRS6wqpY4HpwQjXB8Dpw/eHqg6KiiJyV6zVuzHO4oIdMr5jLdFlxMreuQ6zPJKJOtp+R3GAaSOQN//r5KBAejrHAFeT5+F/S9K1xKI+UsL1TbbFgBGlQDTSOStcwGu4feZikAH8F5ZAzdR4u4AEOraWC1kfgJLgNBTkXCvYN7Abs85r7zRfi/C6jfy4cGvVXnG8s9c1xGw9p3IWL29gwgch3mGkdLPEcbyO87fLhyABbyu+2+XyxOCbPkvxWfZ/le16+UEUMlVyY9cBAMQiUKBs4YiwgmYcmO+8dVhRCFCISgcJgAksX+6JxpUbTG4HLbdxjXgMB+dN1DtvJskrIgsHDnOgdCdI7gPeHcUYc0q9VyCsOcCYgDOHLvEBnPEgFsFzmuinDl2EvbYy0efv92XAXcwxMnAAuym1CUkwFJfIgi0xLpKgM6gAC8CehmtCBBSVswTqFhWEREO9GELbz43uo3qQPyA8fE7KRiTVs3Ee5JyuYEpG23bce0w44HmCW2kknZwl2epCO5Y2KBiYh8qtOsdXedTiOTFuwAdxmhio22X2JE1wvGuIDr2TgCuFbh2/gEJkNrLWYHG1mflr0osSAKteRjnA2CgYahl9J9QCSCCqjdJxd8E+C6wjzQCkT2PYvC+zS+E2bPr5BaEk+jF3gZ8naoFq3cIWraxg0qEGsCjXIHdp6fm1i4zqUWqOusCZo93hGimlR7ifeVElt95/tvZAbye1Vr9OCiEBJAI7CYATdyeyQAAzJWDxBOKNMpXpfCALD5P+EkPB50EaIpRXbtN3WoimVdvaAD4ELTC+hp7bNYLUKtrG9h1b/GDMCQ4t3MfnX6AFq8HjijJsZ48BOseA3qkOa16PSdCJJmvcfY4RwDs4/04BBgT0NGQoW2/E4CpAuyqHGT/tynDGaje/mPdv9lkkyfougEIHyIywAlBmYjaw+lVAgY9AZksfPbfDpbqRQSAo9h+FALIfgFM01EfvbTwISHo68d+CAXEkCx6lQkAyxGyGFn9XtmS3UYMlL7CKzDOqLZSVL1MWPLFZggeY9+Z7I4dI+29/EvVAWzgxrhf2P8cX2v7rxOAwzyAidPbMfybg0WugBN3w/gfwgl2EC4bD3kGpdiiStBczAzwMI8xEe/n62U1miOEQO2NwrVr6AHYW/o2uM2A7JBF7zv0VV+rJIO1d42KNOw5tTOZdQFHlH1MPLEjOS1t/BQSj1xVb/lOANUBqOTf5gagGzAp3a7rOWTAfxGkUAFQyj+qEDhiKI+gUx3gpCOBHFVa2fcSNijrrpQ68QKRipnGHAAvE4oE76hKcCRJCDZ96DQOlQbnrHLPjo+sepQLMUCs9/7pCu/A6ADmQ4exNdfPvwdI5SDG5xEhACQLe85g+Zjzd7QqQHUAnYYgWfrLj0V0AjbbvP0FLkFWCHzXYPry+SiDRKGN3wGYrEYMWpGJnwX8Uy3+FDCVA0Fwl7+HuYFAQaOQJo3UTqzuj+fUd7ZSAefqu4Dx9TzdRcw4DSb+Adi7gOzvq92HF57DDmA5nXYCaA4AgS+mA1eHYJXe/IhojadtHkD/GAiCFC23XV5vgEss+gSh3HbGCXB+IcjOK8ArN4Gs/dT1ZshHoUcGKg+WrkuZArdudWWlUlSggRgPdm/dZ7Z9MYQwQxqjfMVRZZ8KATJxvDBnAONk+z7LxxoHwAlAOx/A2X9WfBMWZO2umX3RMhx2A3oyqE4A1FxWDcqgrjb7gBMwHYNlSASdg9RjYBJnXcXWjUAu8abKjgKwsQPR4DFA7XUf1lCD7eX4uAYoHVeCR5oBYJ90WlChLLPdd4Y0bBCy33oRdytg6mX2Pka2fjaRWckmdBZz51s+9vyd5AC4AUi0BocdgPhCD8oTjHoEhpl/DAPIXRSTKpt4fDKvPSBRHTjiBMhZWBXsEAea6lDR2wMsOQl3/IgQzHX5we7IxoEdIPxIAGuw9q+FCSFORs5ZdAb905KDkeX2uQFzno6CI8WUOP1R8T6puiOg3AugHMfyu87f2c0BVNXfS4DzCcBi+f1rvrbLs0RhbXsf6N08Qh34Cjx4XPvQzDU6BwFOoAf4KBk4kdSbDhEq0R0H9egcfQWm+wUDzpNJxyG4ezRDCLGyx4Cm40oQziX1RiQyC1gFdgXI014enFPv2XPbJKA99k4AugrQeSNw+ZWgrhPIQDfKfqAbsJMwNO3FBPpWnYCBaAaeUn3RTVgGOTYvuWUCGIFi1oc6Wt/LPUwpfnM8DOoGpcE2gsx6dr3vTMYhA4PjxVl9/p7tWiwo1DXqMKEuHbTk4r2udp2UWpHuNKg7qq5CEH3c9bT8y+fvSg7gVH4XAC1/8HLQrhPI1p8sf3oUrPzCyqucgVHR3j75lu53oF2HOW/UHciE45pxvAXsWfOwioB2m65TWfM6kCYy/BKIw/2OuwlvzS2wuoSQv7MmJ22z6/GEkvcShzO5gHFYMFLjScU+oOwvxAHMlgE3AtgdwK7qBfD8MpBm/znj75qCMDnGrwwzai0ah0I1t2FBHTzRNGHOJ0jQvwAnAJY8Bi/1LYC9g+xEFiStzDJmh975vgIL4lIW3hHFEeWOlbYHMHvdcyRiieNpIURIENA/z85nTCqaxKaTe9NEcew88vxbGfDjzn9nXdfXoQsQSAAagJK17lQFVJJPqLl8O5DJvqsZhPnyzSD1cwNMVYCPWewzq65JwsFNxWoDgvZgrG9BHoPRgEEkBkcg1/uPY3dJLuh+ZhqERMUgAvc8ITQTPU4GWpWeCyHaPnb7QVKP7k2196S4fMxpa9+6XtKhg2rMvrySBX9/71qicGMnAOsAsAXYVgBUC3CLuVVnIAx/IAP3CrFu1x9CCDPr1hUkXEP4YVTfAs8RRd633SQMM1hl/Dq7BU1PxkYmQyT+4YYuokc6wSBRhFGXdXv6NTDGRBGTTQzgx+zDJHocsGsXrNbNzCt+7GAkiKeqAxFJ9Zbn6ycXExHQ8rt3B1DmARTAp/ZffEloiqMzwNjaiw7AekLeJytzywmg6or8QRAW2ONDzC+Sdq21FwnJ5gkSkellRsUphu9Zf3negf3WwA1A2SEGR0rFAUnCKHdT6fYkIYTXQgQqLG5MLo8JCxjAjyAIysKzo1CZ+lEu4VEO4JFz/1UOwTmAfOzl95y/ew8BUhIQGoHMxKDtkFQVoAqAcQIq2VcdACp1IZV8ea7VV6g8txCze5CEwQNcH7e4CHxYlZ6IHMw2eZ0CXSG6dJmsXrwEr0sfbRrYT1D5GUCOHUH8XTmujo41tv6xRXaADOfFjwlixgU4ktiGucsleGsu95stAwYTguqYA7IPHUAiAHQADejmrUDGAaj3A3AfP7kFGeejXe6QAWTo0xeh/Qag5/DAgpfCg8gJiAYhCUY1r8Ak/goBHggBqOtQEdQ0MZATcI6jEp0Gl3IoCKEeaKN99zM5gHLo5T/3VLdALYqhR4q9r+8o8Gh/vidOgctzmOzkm1J1fLaGfDwZ75turcAfnwmglQGTC6iWv1QGqvLie/62A9vP1tqryT+4T75NGLsPyoBVM9FRuBKeSBASaZjhxMcqzCnBbHMN0i1kQmrnsLbUOYHwtWBKRWlZ2FdQANyGzog4HgPePiHw9Vu1ndl3fE0BUb3QOH/gEiYz949S+x3IHNbosEyTXWfbrQrw8efvyUnA103M30ICSwiVGIAQWvJN5AlkC7BX/gqWiAxEac928E1UBSowvfXmbsCedW8kF6u4sbUHk3i2h2AybBhm4uPwgtWJPZFdfxzEw3DBNbXMnSO67qJuXcfB9viJhKEU3qh2kPQ7Tgo2jGCnosmi4wA+4fw9YQhQ+wJqQnCQCzCkUMy6qA5E3YFSyeHijVJSuZCy/nWvamnxOOVx4Y1R3YDAnmSNDYW4dWxXYeu8bWzZGX75GgYuYaTuQxC6DEVMPD3gKb8xVvH5c3VBX2Pip4UPXTAf6MCbAbez9t24vrk6RXJRuLNNYgpzAJ9w/t71lJOADfA0LbjE/y7bn3MBocqneF3P2ustB4CarP5M7I/QRNUj1Q9sf+gEoklCZM9kiZHUWZPH05W+VR20gipFPEIMx5yCDnscGUwm554aLjhQD6oRI3fRV/y8dqIUN0MS5p5VpxKruj9mxwH83vP3ZgeQQoAW/4uWYOMEMqtEbwdyuYF8U0yMj8oILFXDgLy+FxbMVAWiNl855RbPaZ1CfRCq34A7/Caz/u1h+fPGLsErXA1LkjSYVmh3joCQIqU+ThI+NHrDXAApJitqPwwQdhpCA7bw/tgH9q/PBFR8MnegyCapPeUGOu4kCg2WT8wEYJKAriRY1Do3Can4P4PCdvpZAO+fENxoz3v2fpjwIyu/37HkPurNU/0BJuPPoBFuwwCnM4GI7XTXvmulVKDzcw/I1bxgYB8H/ryVr8AkEPQBOyaWHtHUsTAZj7OSDj8P8gixawiIZPBK7xJkF8KPwwJ4LnSNyyeev0+GAKkJKMX87e8GYKwU+EpApPYtbq+KNZP1f0zsP1MqrByqwV5vm0ziKXIpw88CwcE0aj+WLbhIEMcBnzhWX8+U4otS2GOJ4UW6gIhARtb9kCMY1PGPOoK5F4qQqovkLgI+lU97TqStU6HB8knn7/NJwN0yY9//4M1ATtmz+hq1Dyz+TAmwC2YRJhR7hA6jTtxRIIqO0QBdgOQHEB0Pvo9KzDUo0oN5gkuQbkFYWQ3c46TSAxkfbRr0gdpFZOOPq92BudbBG30soD0QnQM4WDmIHUC79kQSFtBzZcAA6EAQ/P22sy6fdP7+9XTa4n+YDYghQAF3dgNzswHTl4gn/hQyUBN/qjewNh6dggTzZFVAhQczoQJGXEMFR0LxAxO+oZvsYQHUcxk4nOxgnTn+U6sGDpgi/ozU9oUtDxp1elZ9qNod2z0MASrpEhgPHLM91Y6quxBm7AAUqWxjYPnk8/evKf73SUAVAiRQ92YFauD73EAmAaPSqnEIVNhYWdq28KZL0EVNQX1rHVUDjJmOKglRLN5JHlpAWcvecxL9dX7t44DfdwlToUSQXIus/FNIYr7SMKHyT0gKqhg9VHdJEj37bis9NQwwLqdv/3cH8K+cf2BdswOwbwYSFYGw/790DuaLktYf8wc4wDtOga0/5wK4n0A1C0X9AWa5SACa1mW1HuJ9l/H3gGkDWoUM9vhzoD5u3Xvhi/ITI7II1x+w848G+uDlINFxu0nCAxOVlC1nh+AnDXnCGYcFOO0XQgVTATjoAOD57ASQFD2FAV718fXgOE9A2fx4WUsUZl505cB8+9jqT3xm2+w6BDOLy3f/qfxCmW9QQw3KBZgsv4rlrYK76wvj8w6ooYqhzb9ne76KEaD3sxOwFJBKiPFCcwFvVAhx4LjKfjvbf2B+gCYJAOuwGnHAAUw7CEsWy+/bHQC8DkyWAHkmIIQA5Aoa0OfzAL6lF4ZuryegJvvIUQRx/h50ZELBh52ikJZ84Ri6Hr3XN0CM3PbpuYf+ul5Y4GLwHikNuvz0sWJCiYDvyKKj0uqcDMDuNgccQFf1C8kPwehdmlTvQ5UDH+q5Y051HioHIJZRE9GeA/j9579rQ4BcAeg7Aazni94AbLwZhAP14ZQ+AtnYg8ookn0qNFDHiZKHUA7kWrtU7+h8WFY0bRo79bTMQGIcyBT01NsPEu8vZtSf9b/nUoTH6ChpA761uOxnekCsVzOR2IuIwR4frqXTazBFDsWxhSFCrNTOQeyBdxoPikCUa9DLIAQNqxHqusgBbATQQoBtZaoGtLf/2L/r6757zUCiLFicQVVXmdArrgHZlpN44rNRcCYLZd+jun9+KHxt9VEJ0AzJoJ8/iGCoHUqLAUOXguGFAe08OJ2Sc7uzGLz8PZxLCBU7JrhhiHHABWjSyOfuqLYEMJTp3PqDDoD3r9/5UMvvGOiqX2B3AJ9y/sHdAfifB8MfBcXpwZkkAOTqxaBx1r89cL2NTSTWrcNcAADMgTGoAIQVAyKLmbDgsd2BnGcQjiGO9ftgZtcynzOInYQ6Bja2PNUFOIBKx6GV9miooFV/cOzAiuO5p3II1QHokOKwA5CEY1U+Z912aSjOI/27npY/sBNASgKmdwPm7L/rAlRvBAp+LIR6AHqTgcaOIN8o19orYvZIuXuKHrUIy7BA6bW38i5s2HdToGWTzN+p7YUPUe1VHm60zoIkUF0oIb0hLiAP/n78r+lKuoEDJNENPzoW+pADECU4TRAFiHZMmLBgygEooLdjV8DLGYZp3+UPnH/INgLhLwQbMpidD7CRCCbV4B0BrjnIDng5j6Ao5UDd661UDUOmpIeDH+AyY/tFt54Dew0X5qx/ulXBNdVjxTbZAV5kg8FzmatTVQEFTk8GTEz5u3bOHdl5RTT7toNS4gyJtOPMhxn+OjPIDjmAGOD+haQ9EA+IImwDHjmAdj+WP3j+IWgEKra/JPbaewJNDJ+dgv35rwzmcFJQshz1xaIOlLYfwJEIk4or33FogXY+r3ONOwS8qtQRIGH50Dmo3EOfFLT25fsWEIsGsT3PU7fB109PkwHYTc5XcH2cfVUIQpVkPZwHiN1Pc1EFeOzcvGIbhyBbjS0YRyFDPeOjHYAHv52D0NZvfy2fev5hqgLYNwPX9wLugIO3BRd34EDdgF5sa6jspsSHlQXOAzCAEYg6FLCq9xSln1TnQ12BY+s/tvz+GG249gIBGADDmn/vHJ3wZHhcva+06cPZghPqPkhA9sIDQ0YvwOK/OAewnvhYUf4Ax0UNCzKZ7gRgGoGq7Uewi98KQOBXIENJ0PQHgBoai06qbxSYXhiSQwH3wg2p6jb558hgVum7jiGoLqjynzzfUYfQcw/FMj+OFHrE4VxJMP9ehw5WbRzQuk06KmeiQw/vKPx5oxCkqv5kv75VcOEIXD6h5wAemwPwpGfyB9V9ebLHJOB29uVfPf+IqQLYMiDW+LneL5KCWBmISoFH8gBBmNAHNKs9gsL+naKIYrE7tl/afQXIkbKP1h8lBTbP6vMBUiCFi47uQxW95f5tOuo7G07wL+DwN+om+ErJbmomoAIWkM6LcADbzTNk4y17uy+KyGgZ5QFm9y3favm0nQDKZCDMAcDfBbQy9uewAADlmntUeIBAGuUBuH5f8g4dIHeSe0mYRQjBpb0af+P5Rw5gBPbR+qNkwLAkUOaBwlBVYI63EWQCFt2u7ZAC5wcOuAq2s1WRBxUMFd8710L3aLSPstwjiz9yEOb7Bd2Jj7H6qPyFgHYH8K+df1TkAGhOAP5ISDf2D0IA5wx0SLDfnKDcZwYXtwebPEQv+RerfOsALAR2QOEflRCcU2sdzcPSOkh6bqC/rgv4YTw/mSeAee46XCiJt471f2ozEc21Vw7Egss7gmMAb2PRkQk9N2vN273g0GVs9ZWjwGXoIDIB2BxAifdLjd9WBvavxO8GkPmAuPwXNgkpyy9aev2LN9FZlPQZAdk5AU8GjYDIlaADwP6AunxEFu1c6i8cdHq9dwNHEn6szGbgB92CR1xAPR78WKUClwW+AFe2x37fY26iF++XkC/cRsy1j4iC3YghjwDghxwAjS8bOliSsMRgAd+u35LDVmpdPv38Y6IT0DcEpZ8N2y5fTAxSXYGz+YCw979Yc9X6q94F4MODBstCEPPADknmEWQQAXAW7EMXwAMF5xlMOoRpwB/OEwhFd2FDQAZB8xQm/ZSb6OcEWi/+GNiW2F8EwBmMGMIoQnn0snC+ATmAf30nAOwE5CnBQAZF6eGXg6re8otCgmSftfn562OugPfLjTKFueu/+/dIJNHWUQOSAWveKqoaCGDXoRs1F02Qgbm2eq2s+QhxpXad9UMF18dDBXQEFdp+TUXlORibK2PymXAhX+9khSAC8aiRSF4z9vhDHX5MFAiqosxEHvScXEhAY4mz9WX7/d/wtWFW+f05vDNY/tD5x3UOIMf6+AYg/LWgFAqU3wUAu29m/+WuwB4ZOMBj6BDlCvLNFcCMbTzo7UQ4gIFEGyyWsLQNVyDx4QYOQOkQRMzsyUSFHpPJQ2HXvQsYAD6o0fNeKsTZlw2nCw+s/zCxGTuL/c51ZuVZZ3EU4M2eI3mM8gt4TxrgrYNKxDBa5q0+EgqGCzsByBxAfUfAdjJ6EYgDvnhRiCgDGhWnacJ2HcfxPjlonQQO+uwIuiW+/FgmKwDWfSiAeYDPgfWY8ns4DNyCULH5sAM8wjCB1wFqdxrxhPXvZvdji74fWWT1LbDngNqO1aAXxdxo8SX4B2U7vD57Dhvz1+0ciVnws9Ph614+4/wTYQ7AvSLMvAtQ/UKwfVGInDrsGnrgVWFovdC3NQAAIABJREFUg6hL0PfLZyZUcwT2e1WCA8uYypLPVAD6Vt4CWYNsDuyHiaMb44/cCJCZs/1e9brkMcg1xI7HWloFUAUqY8uFks8ouNsmfBfBhAMopeNOjb88W7TzDHj8rvx2JhsWWELwQFfkBt8jX+fyh3cCiHIAXA4E218Ayu3BJiGYKwkl9pUvB6GfFVcEUSyPA3XQF2Be/MHA058r8Lp9AzNWHiEcgV4vlwAzCjhQfJmTIMfy1OMNEniWcqxVLZbbgJfeLYAgMccKCIZtdXzsvKY7yUgBXX2HA85BvjvAX8tY7fW1yVBB5i/QGbTvtHzm+SeDHIAvB6a4f9tZTw22IKIyYK8qwOsoL1CHPcT8ZnBQX0CDoH97kB+gDGrYQuQKZtR9ZptqsDMg+w5Dx/Xdfbox/gSRBDVz5SlcjD9dKfBHm5t41Ak5trF0sPvQqafLbcw5AKPeNKMR80W95Jw7Ro75K9DhuSL4IWDLc/7tuNbbrqflM88/lacD55eClqYfyAGU14DLEmB1AtvD3E4avCLsQCJwP46c/lvOYRU03B6z7oY8MHYcOAKjqvPq3gf0/HHYOjtyCRJhkRLr/ScThzzPYTLTzzC3CUALZksmcRjSTyKqY9Iy2X044QBA0fmXftC9qERduQ9R/oATk5Gtt8fx39WGCqD8IjxZ/o1KAPmHQcorwdyPg/jJQdIRmORf3BlomoGqsyBg8mzB3ChkFN6EFzYZaId1MLlIALylIL07aFfYW9cjGExwjhKKsK1U9FjJPQHpWFtup8qVYUJNeQK4rkBNmaBQwcw6SiLi4Ld/BwlBUX6ThITABqLjkptWaH9upcj7vodyBO1KpdUPypajbZGcls86/3ROAuZfB6r23v5SkP9BEJsErL8VOGgAqgMumApswM2JQEjuWZDmG6VyBKZzz27nCMLNAdDuwEN4e7TsSuygUI5AhgqPCAnmwD4Aarn+x+YIDs0JsAN7/9TtIhTb47sBDjQWuXCFzq3seQN9GzF+u7xO5hi0SuNxvdpbEk2qHtl6f13xtvYYyx/ZCcAmAfEnws1rwrD2X1/80V4Lli4jeGX4IAfgHIFqCFI9AwQ8m/2fcQR2GwtKtupe9RWIY/ud17iy2hPIQyokE1dAT1Phg3Apg8qDV3MinzC/EKh4cSQHKhVswRPJKMfUU+8gPAn6B0YWP3QPzl3pUKSRDth6SvwiUaQwCbfF4yZCWT77/DM5CUjvBDRvB6Y3BO1gFu8LKE0KNd6eJAOX9MuKCkk45Qw80LYlUeIvr4P+QYZFyTuYc3W2l0DPg1uqe6lw0ENjmnHXlRNKSsPlthMWfvpYj+w0LHaX70N0vSZJdtBNGMIJwZm2ksQgGmvapB/lPjRAu4oukneaECy4y9iQtv5Atr84gnYP0nmWzz7/rEgC4lTg9lqwBK4A+KU6UOP5BuI6wCNiMHkDNNg8PRiJQalzAnm6TlZ2pd5+mY3xWZmPOACtwkN3AKw9RQwO7L7DTp0Tj11BMdV9qFR0dE5rUc31TCYSnXUPKg1IJAhIBFJVahHuKOuMym7/bqQy8zNgY4dAyu5afi0Z9cMC3Na6ALyO5XMqAagkYPCWYJfph7IgkkSvG5BLejJ+F6XEzNYyZCCGN+8fhPjp8QrPoFYkhARm7bM6b8kke0CidjLxAE0FtrgSoZy9aH9vrn9uymUcDBsqICfKkpHzYeurANlddpAsyhN0cf6BygEnASX4yZ53HQT1Szirb5KYMF5cCGCJYfmj558TSUCcAGTfEdjyA9uBsB+gNf3YDsB8rB4ZhLE9tgDTkHY9ATzk2YE8zhFYCzsCPDsGBE9SSQW2OFygHEbef257OPfwvJ2E5aGkYL6yg2FDBZxI5ikVD5cF5zXhBWb4RagUtw9b58MkIc8RTCjy+/pj21BFhxyt38EqvM4VJDzwdS6fe/75gABK/I6/FORzAUgI6aJ7cb8nA6OKwgVYpR+FBwrkmRj2757+9hrdW0YgFDkB8x0qSMsxbVCBD79RFjuLNFEFlyovIY81BHtg4feA0PsGPoe24pFDUcSiJ+F4YvQxe70fopQ2dgV0vPDlIH2gN/LJZwzKergduwEFbusQkEhtWFDuk8wJkAuw14Ak0v5e/s1MAOmXgV8HAGNIQD8V7nIBfmbg3hDEyT2cvWfAXrZFsDRQ+r5+VnelzGUw8+C0/QAGvEafLQANcZgsOJ+bv0McBhglJ+Da6+qEFc6S41E7wBwmK01qLT3L6XkHcN7J8p4lu3zPBhWOUby/X8WwD2CsvvgWIAQgg1Y5ExdGoAp3SoazLoEVvYUG7Y7uy4KE4fJ55/dQFYCAL2cF0u8F1sQf/VIQlg1Vpr/zHgADOH6TMCq5nAw0o/QMlAjwipR6roBcSjVdcHwA7TTQcxlLw1t9FwDwNNgBho8oL9qfCnucK1AgMkQZWfhJV6DyDHWZKMfh9YS5AVVFKGosGqgUuPk8cQhgHcG+HVQ+GgG0MYpuwRLGelr+2Pm1DgFsyhxVARDsOgm4X4J7PwDYbfGKcGvRm9I3WMH+BVxhPkCoPyQK5bkUYE3YoMEWA7kX+3uQmOOYcCJyEiLEAPCqMEKGQMPQgex8x3koZWb7Hln+npXf1z3KFYAaDhwJ2/UplXe/GkzqS6Q1EwIY+y5fL6YtfSKAGPwYBu8GaSOA02nrAsS5ALYMmMKD7UthXmA7kX9V+P7Vq7IzMYAyY9mwlu7QtvO2AvjkBDxJsFLj8VmpESp4rp66otNottXuMSIMALBLYtlrUkqYQDEmB0MTQ7AL9Z7qUCQj3214UvmBfuhgyUHnF+oA707o8bZfHdsAlSoAPTfAAIxJJIOYqhQRgA0pgFCxwkfhA4N/I9Pl88/vDQhgAy+WAfnVYNgKjIk/9U4AahvmrsBKAOkNQumGlb+L0+iBOQM7mi1YuwMGJOLUvxBGENdXaz0CuSIX+2Meo1DAQKtj6ZXi8zTcQls4UIwiT4cMlniwb36k8Hy+rmsQquavNx3BWny/rLs+zBd4wrAq7hXXEYprUEIrj47BEtvI0itSSGFB++7FFShiWP6t8+umClB/GKTG/uwGUPlFGbBafpoIlPMB9SIGGX8LCN8PgOvd37IJiN2FJRSvtZG6M3zaoItBnNdU28xn64cCKvnmgQ5LgtKdIgef+e9dCwzOQV1fuRU7MIk8REnOkYhImvF3Qgtf9ne2vpMY9MqOVlsRir0nHmR9cmAiYRKT4B2QCcf56BAsYayn5Y+fz+t6em9S+1wFSMqP9f+SGMQXgkQdgfyeQHgpSK8TUCUJUbkVYbjYXABL7seKDkpvVD0CuwIwDtd8PIjduoClwV/6t9tVeXrCAKYpL1/D8fyAV+5jIYZRWFk1sN9FAXYfpJ3wQbsF4QA6hNGz8AiS9nf+ZoI8LIhRzUfOIYjXZduwdQwF1Og0PFn4fRoppnXLF+wEsM0DwNmAhQAoDDDvCtgOZasB+8FLrsDZ/M7U4GL53ew/tOyYW2jLGxCUDUcVF4ruQgPlCgSwndXMxxY9AOgKujB2MXYnrOjE4+4cE/kBp9aySuFjbkdqjwX8cD9l73W+QJGDXoZAtSodvSwUwWaBR/vn8dFAinbcEomy5Ug6PUfAxFMIAJ0PhhD1XECMy584r+f19PpiCWDrB8i1f3QD9V0BOCdgXA2oIIjmC8gkIDiJMEkYATYCfk/RRwQShAxVqSKiQK2GbUSc3XUJZOsjMkk2O6Ya4QlEA9BEGDBVafCk8fhSYb6mQSsyAkoBFsFhXx2OVn9k+2PyaCDT4YICJ8fxM9so4kiS3sY4g1/ts/yJ19fXT8v5YrP/rRFoAzV3APZyAWKSULX04tXh3B/QqQI4BZ0OBY6qP4OG3EfpAOzG8R0S6BIFhyTYCcjHZCLCh97bFvYbgBePUghFEgfUv5la9+0fWyoUPQ+spp4slUvIy4JJP9rqd5wBKPu+FZUklVprcCty0ATkVP0FzABsxLCeli987/ra6eJ8lQgArH8lgEIG21fmkIBfEhpXA8y8ARUedHIAxuYfJAAkEA+dNGw1bPLyUKnbnjYMgTMGDT9en7lXQJEROIlBqOHASvG0AzgBuZQVI5DNgj1MBO5ohqNMEoWO/W0o4B2AdzPKKhtnEHbrHXMJeL06Zrehw35doiQYqb1yCvacNgfACcDdMHzha+vPL5frjSWA11uNf/8VoOwGaguw7QfYL4SnCZMDaD39oiRYYFh+cciAUij5QRJAE+7BiiTAysvntkqtgRw5CR9CYHZfHgtn8k2GAEWZOKCx35vuyCDmd0RgkpvC5vecwcSsQEVQBkCdY5S7zKDh79CAkvc4UBnAc9i/PaDLeas7gFePK2CzYwitPhAoKroiHU94jRiWL3pt/dnl8nQXhwD4I6FRI5BtFEpfGpN+/ZJgfeBYJaAMPyp5IhxWb0EUJsmHgx72hay/BiEeNzqGWh6QhQkFPFlU4HZU296LfJ4hQcC5ujkChF/eZ6IvQIJ2IgE5VvV23RbcmnhGCT/1k2EIUvu3tuq9mD0RcGzxWbUdQWR3VAiPyUa5l0YAREC1XGhdEB57+aL3rD+zXJ5uT6fzhc4BQDtwdgL7acqvA2GzEMf26heEqtqXGDvIERgXIBKCQYnQEQUafFHi4+2tcto8gIGryQXwXmW/pi5IV96F8HbsFo7kCDyN7UcLymoRmcQxvz2+2W744lJBLtOhAA5ivD+WCKpiypZfJBN/jFllTyDXoLKAtoBk8HtwewehtsHviODXboHDFhsWLF/88+tP7QSwbHkATP6h9S+xP1t/3SKcvmjPAdCUYdoeByWCpS0fEAKAXhOCdwt+aCJkG4A81AnshZjIVkugCWDyddTPZkCX60fnQS7Eba8gnY9zcCZiUTml+jbufzpZRKDEI3PcHOUetDuIQeqBHpBNVW0kGPs3hhwFtF27P905yHG+/WxzD7xuPS1f/HPrT1xcnu5OF+t1IoDcD2BifwQ6hgSqHEgtwjXDD+8CiKoAveWDvMBxoEckAEBy4UEhBVboTAIuOeeBWgaVpY12XOMO4HgxQWEIwJG/3kt1/yngmr3B8cTuQJOMeuOvpYZ2N6zNJ5WddBgMMFRlQxwZuHPlQFTS46GBU+fJZh/lGiJX0F/uwb8nAb/kZ9cf23IAmwvoE4B/S1DL7HtnoJN+yu4zMRTQ0HITz5M6C3LoEcJwXQBkVvEGZrweUuLqCFROQOj9QOnrAB6UFflaG+iZJIJwYxgyRGD3pIODX7kGSShh6c6SwiG1f3Q5MFb2puLevvMbeXu5A23f50MCD352Bo20EkGmzxsB/OjFxel2J4AtD+DKfyUHoNqDtxsTOYIcBuwAoFmBJjwo4ImqA327PwRzQBxuP6P2EVjztXbtPWiMSPjxeROJ2EDHAqK5g1ZXLyTJZMPuJQC3y9Lba2AV5rDHWOlQlSeJ4EBFoecODBEEnYU6BEBw4/2aVPmOVUfAd+0+dZYiQNG9lOXaFSBZ2EQkfm889k4AX/oz6w8vmQBOy3rVCKCUAqEBKOoK7LUI5zcDmRZhsPoWEEwUTVkr0TwhFHDgo0SeU00gDwaf0O5UtAv6Bpx7cOdWpNPKkh5OjRjseZ8SBoz31ZOHYrC70GLY9gsEOjULUDuCbihB8+XZlVg1Va8wo9CkhBKgrAxcrf6oysJBwPFKWFPBDO28fWLga7XOYPnSn15/cFP/zQWcLk43iQD43QA5CVjfCcDNQUnl9y/NVYEM9qZNrPTqF4S1/U/H8I7giAuIgdzIxuhqlySyEstYnQBqEn6ODmzBslOaNPCgrsQ+gVmC8S4jDgX62+rjJlLyispgw+9jtyYioJh55jgFNBwmoN2uahoc36qnBWkP5Eftvtn+ES8Aad+JY31yBpCw3B3Al/3U+gN7DuDidLP9l9qCg1eEj+YFmJ8Vy+BAd1CHuQgJXFlvZP0tcXRJYAbEodozMDKwpxS87wgYzKGrCEuZjarkvmKCUWTn6/7d6oFXW3NekSj0oB7E8J1ZgAg4RRwS2CbcKe8I9C4D933q30wafLxCjk7VSfFnwoa++jdyZutfPi9f9pPr919cphzAaTldLxfrXg7slQTxp8NMIpAcQB0ctR8AlB1mDbZBpPIAbR8P8njdvm2YxS/k1FRfba90mo/J17Q/tEH1oIGtnZ8DAEM7gwlHFVKmz8H4GNNWZUAZtjrr/cu+KqnYA7sHbL5q0QYcJfZiJfeA9jP67BU0d9AUM4rZjy7HqscMGaht6n12Mwu9wiuCQcCzU0HiWb78J9fvLTmAZSOAy9NNIgDIAVA7cCOH7dBifgCrPr/+y7T8stJbd5AufqYikI/zQkEPRAFq6kGftwMw9bdhcBUiAAgFYHZK3w0DWO91so+JDn1FJaZwXgOqjCcNXMLvLVCKvV0xfke9DbgIasiJyGOcAHyEK4C23nLNM4AfhQcR+PvLNTGE5JCvffnyn1i/u1QBdgdwuecB9jAgqgi0Xwr2MwRdVYAbgvacQCYODAnQgqOTMNoVxP8VLOP8gFJfBdZk08gh1GuEYU3bKEcwk0C0DiQmCL6urnMwLshvKYFe7nenXdhCpUG2B3YNan+kLuCDSUMRkfDgZxcSxfdG8YO23h6IkQwUAI8RAFYjJtSfkoNa/dsxl6/48fW7qgNIeYDrrRqQXgQqZge6dmDbJFQV2839L+CkDsGa1Rd2viQUiQQ8CBCoPjdgQOlKc2jD899By7DR6Qm1t8BHZYPrFSVFVuR964HSGyhRHC38Bfy8Sd5zInwwAK/PLS8NHIJNINp7wKpsSILCnmMgt1Bnu+/UGsiOVXZs/9t32vNrcF/aeY9m+/0x05i3x9HHtyRhyYYJZD0tX/Fj63dsnYA1CXhxut5CgfV0XhoBbOFA6f/nBKHN/PccgF+XnIAdoD4k8KraTwByydADSIDeZekD9Q/JgYHQcQ9dEgJdFrG/vVcAmWEfA+q9CgVYjW34gNDVnYR6e00a9lx2+jGtOxASDElioj9gnPW3ScyR5WcF7ib2yOEUQomIZLScySxtjySyEcCPrt+OBJAcwO4CLuPJQQX0pUkoA7mqPvyEmKv50zpZ2hN5AQoRFMjtEM8kMcgJ7A9I2HjlGjwRAZEQAB1QJXEQKKmPIDofxuXKLfBRrWPiUEABl8gA4mxUaT43A1Bu24nZrW73iMCC0MT9gz4DBAWC07kCqB5YIHmV98dB2w6Ae0L7ryKOEcBH6r+tX77yR9ZvUw7gtBFB/akwGw7YFuCcKwCHYJt+GuDrgBBVAQ9oVnml+p0qwKLzARGwJdg6Sj1PHKiB1hXUc1KC0V9LftQy3yBIJHh7kTqu3TsPmW7VwRKItfgxcWgngL7iEYDvJgA7JCGsOpPPY5xAIVpU2VG8zw5BOQoP9IBgSN0j0ihOYDv38lU/vP7NrQRYQoDiAPaegNN5SS/+VAQArcG7jQdlr7G7bRNuIUB2DC7Dz4Duf5YuwIAkIIEXAmxQf3Yn3RxCDGZWzP0M7lpjQtmHhXM8HYIIE36iemBy883f1KM7MDKgvR9ojsF/c84P6LcEz4Mcz6Cs8zQBdBqGGKgj8CtgoxMp1xmRgl3uE4T6WG27RAA/tH7r3glY+wC2XoDTzZYH2MKARgDtRaGt9MevC6eqgJnm65OADcAIVJ0TaEMuIAUJOjrWKGO/r49Ljggu1i6/zqu9qga0HDps3ykBWhXXbzCSx4S2WksqilBilW+uxd4B5QTwWu36jvJT9cESQR/w6nyodhFAUYWTs5u3+W5fUOERATxV/XvEgOTKcX/5nAjgB9dvKY1Aex9AqQSUZOCu5vZ9gb72314ZZhuDIgeAICt/RySgbD4s25XHbtMGQl4+yOonYPpjaAUmYIsuQ+MNOuuNNlMYwNbcaG6Y14jcgW9OYo33kIQzdisEVun5E8fcRmnhO7cBq4mFj+M/434xgBuBWSVEUPDfqKSsqk8jAEzI+Wtm8mIgxxa/3QuzjygRLl/9d9dvIgewlwJrMnDrCajNPr5F2PYE0OvDTD2fHYACPMb5A1fgQC1IgBS9Den8Vz2GIJkDiUHW+hILCg9gGlPZrlt1h6vtkoinivr4O4lH3otTgz4zr4DerhipB49djytr+Lw/gsCebx7wvJ+ezIPgsX+jy5hxAkgkcWzOxPFC7b8oD6rz2dxEuu7lq39g/caeA7AzBEvWv8T8+bPp/MOkH/QI5Gx/+uJcCVCOIG3XBlNT83oMnD+ACm4GvlB2E1fT+l7VYBRCiOahmHSMT/BvQAxdS6TyrU4sCQnupAV/HoqdsMNqq/EiVMLlY+lQgtUeaSByAibTb0qDGYD1mUZOQIcPiljwGmb/ZkC/MPs/VfufcRI2R1Cub/ma71+/YZsMdLF1AEIIAMnA6z0ZmOcHsBtIIBVvDS6Ah4RgetAZcK4SoBW/kgCouSKAemwHUjhusG7fN1D8fbhLwtiuwocYVsUBao8gD2uGmTDaD4A4kjHEGDgE+dITdUYGMak2Ac9ruicMBh1q9pAcnpD5b6roXcIs0Mueve1n1D2NuQLco/a/PScbFlgHpdZte+L1LV/zfevX7WXAy5T44xzATgSnkgzcEoHcIQgNQjgvIFcGsCRokn6mHbjlAbziCxdQv4TNBcgGoO06egnCHjCDEKJCsRv/91qJUaPVnH/WcAA/5Qo0+AWQBVDtvspZcGDwxAai2iXHNCHUWTgSr9YM5PZZKTvaYiTqNyT+ly3Ex0KEXpIPv0sBtfoeaR06BHuvl6/53vWvKgJAB5A6A/07Asx8AaP4AGjpAJoLYMBXh5Dr+MY1uKYhC275rgA4ToORbhJCYGM1wKh6zykU5R0RA4UKXqM9QfS2kU5BTFe27iSdw0Pc1hCsMxq4AXFEa8j9Of1PhU2QAxFJFDYwIPDIrIT9UMCCZr8L+f72yKOAj8GKLiLaRrkIdc0N3EguviSIJIFOaHnH96z/TyOA9Xq5WNJ8gFwFyAnBm6012AJeJATxfQDmBSGo8JT1VwRByTmboYd8gVTofq5gH4JEChVcPcUfWXhJNKTkzol0YG3CDuUICPYyd2GPrz7xFfjXk0U+wZIH+gc8JlIGg50BydAfK769B6iYNmfwhPgfMucI3OhvBdzHEUD7bmzlX5T670nAd3z3+leGDmB/Uch6KRuCavyPCcLtEoPPoOLcB+A/l+NQmS50Bx7cJiyIAC6qAZYUCgjihKKCaB3QM65hMBeh6LKBozyu0vSivN4D9BTeazFexYQbCFqIFUEoAvkFIYAXUPNnRY8qDJFFb9vbZF4E9McTgM81LO/4O+tf3gjgYgP5xem6/Lsrf8oJ7HMDttxAi//FT4nnVuCk1qU6gPmBAmKO98v2ZZBah9BsPdp9BCLkCCJHEGX9DYB61YBRJUHAP0w4kuYOld67CO8bED6aioptxbVqL+cIZPXABx1zZUN/RqvaBUqWsHoWHyktdAA5b8IWeqToCLTob7w2/nvGDURxflTjj8iiHx5wBaB9Xr72u9a/BHMBahKQcwDpdWHr/ivCtTtwSv079r+ShVJ6ArkDNxCFiXftfrbWzknDomh+eRqC/RJhA5OuBoSuYNYRhDkFHTrIpeatu/aKPIytz2AvYeBLOQZj9aE4GIYDlC/QDkBbfHQmFXTTLwZhkrGqOAP6WTKICSBOBvaBHIcFinw4dFDbLF/7nev/ERFAcQAJ/LsL2H9FuE8ATdHrdOL6Ik9Ue5hEVIFW1JxcgJnYw+ssUFsSUQCYKgIG5NNuwB+3W0IEEFv4CVcB/fZ+DkBEJ6iW9h2EZQ9FDHHyr+3FYRAThgItghPV2cLOlqL4jKz4BvDGMSF454CtVP8poMd9+27A229FEB6ko7BgTCaVCMgJbedavvY71r9YQoCS8MNOwLpsOV3ltwa3ZCA6gPIGIQwBTIKPAa/ATstMYq2/rsJDkkUBBoOOqwgE7h4pyKaf4zkCA+uZ6gFPPKo9DAdcgcz9Z1BCmbEXDlhwT+QDqOKAgz8kAPEz6A0gDHhPAArYjyGAXlPPvBvQ6q2s/iH7P3iDcHIUMUks7/zb6/8qHUCO/wsBZAeQJgjV14VlN4C9AbXjrzQHgSMAckg3DtU8/b0vM3Zf5AyicEAtFwm+qvwZcNsZ0uOxVj4tP/tZAuEx81AOLX4jCFbXvr7TWvHrQWp/TwnGxCcq6VQm5ghABRK6QuDDBFgyOZvwRRHASPWjRF4vwddzAyrWRzJCoOo3/4zsv3UKJZTogX93AO/89vUvcBLQxP9pXsDWJHS1hwIXJ/sbgibbjwlAagl28T4qegGeDgssYCnGd2U9jOfFtqIMiMdvQIri/8i6Ry5DQPNoDuBQ30A6nwUvfDowr4CP4Qmhnam3LVIEvxgUr9UnBHX5Ds8aE4IlJs7Aa3eglXKGDBjgngwAoFK1VYgwsvfz66Nk4/LOv7X++cv2SrCWBPQOYCOAXA1YL+qPiJpWYCYA/FwUNi1riouKH+QAyBUY5zCt+lEVQZcOK2xB7SX0Z+r/IekMdN+p87xPaA6j5wPweD4rcIQAmHRGVQFDCrWxxzsUJgX7uZ8DiMhFHQNDkkYqHpRdMoDmoC4BQAjWFHqWALzSWycROwHlOJZ3fdv65zAEqGVAJID29+4AlvzSUFvrL2Cn9wcWglD2v4JHhQmZMIJwwE7hRetOScKOQ9hed+Iy/a6/P1D8EPht+/2vrtprl+EhOw/8/SHTLxVZmOtgQZ2T4Rg6AFHK9Ha/DD90KKzS3lFEBKBdANpkPp+10EwOCHrlDup1POItwUwuWo2Vxe+TQnM1CvRzRLG862+s/9PFVeoDSLX/9Xq5XMq8gNIDsPcD1HkC28tCytuC9vi/5QLs5KCi9hTrLz4hmIYFLBfk0GJ0BrlS97hvoIGylxT0wN+zARLQUbigCEYAMDzmNig6IUcx+wecQuQHpglgMmesYnE4AAAgAElEQVQwRwAWpPiJATln+z3oFbBRCc3flIfo2XpW03FuwAKSHUI7lwJuDPCx+isSgT6Ad33r+mcvLtfbi8tley1YIoDcDmyagbBJCN4WJMHP/QGo/jv4CzCa8pvmoR38CuQR8CfzAlRVaFBMwCbthnx7v1rQlH4EViCEx+QBwpIiqmrfLRwigHqNVqnLGXgpHntEAArQPZCzYs8RgnAE1a1YYHRVHyoY2xE1McTxeEwWihReBAHMHmM9Le/66+uf2QlgdwBpHkBxAzQfwDiAbTvzpqDa/beBYOsU3L52Dgd25aT8gKsAJJC1TkIgCRcGFMvfs/u0jux+ze2HDUY2NxCSwyAUMJTgQD9DGBluA8KYCRv0NgBjOsdcCIBQbOSjYnzW+xmV77kCre7t7Uc+ro9A384ykx/oOYPY7iuC6C/zrmAW2GW7cQixvPtb1v9+I4AN/DUMKOEAtgOXv9u04ev6Q6JV4fPPiYEDSGW9Bn6XACz7ZiA6AqgABUB3l5VBaEnCFvM64cHmPXq5garCojyo7Lo4loa9WDrhEmaAbxWbCUWrOypu8Rc6BzAmAKXe9vg4UNvVNoBb6vAzCDmXYOkHjzMCOKp1/Hds52fUXrXz+mVj8NpzWdAXp2IJyRPI8u5vXv/b/Y1AFycggBwG2EpAmhvQXhySkoEK/MYNMPjt5/1xZ4Iw4HdhgOoPiJzAWYCYty0Oo1j/mBQqNAfE0LaLlD1W/P45WFnb59m/+t2KaNijc4228etHLkCFDHWZKZURAcg2Yq3u7CBeDAG0GFo3CcXKrkAbAbmQ5B5zmIYe9Aap5Bttw26Ft13e/U3rn94IIKt/TQRe5ETgHgbYqcHmpSEpGQjKf4gQGvh9ApDyAFL1rc1vtr6fK0hrAYwm4QiEYGJuDgIYzDZP4M5hOvjw3D0IHwgRuEMwtPP6fAreKl8QuwDb/BMpPPoF+wvD3klYsKrmInYOXjWZAJSqI9D83/ExMQRRuQGlvscJwKv2TGhQCCFyFuV6l3d/4/m/urhachVgvb7Y8gDpZ8JdMrCSAYQI6dXhSAD5rUGm7JfAjDMFfViACg3g7zqBArPYCZSuQgvIsj26AASbdQMWhna7FC6U/43MPS2H3oKxgk+SwBNyBFEQoMIL3tYTAmcOyu8aiuVZ2SKyQACV+xSRAm87H/+3bzRyB0pNLaGo0MCqtyaA4yDv2/92TruddwrLu//a+b+4vFzqK8G2dwPCJKCwMajOF9hfGVbKgBH4ySGYnEAC4YnyBPsD5+2IDLTiN/W3sbxX/BbF23Ws9WnwAYW4xB/rvQBt3sevmQF4sM1EjsCCK1J/XK6A2tbzWukIRKvyk8IBRxRzdh89Ayu0KttFYNYlPkscTDhepZsXQbseATRW7nYmbf1VeKJDiG3p8u5vWP+z1AmY1Z8SgIUQQP3NlOE0UzD/glAmgqT0ojdAJAQl+I3dz25gL9OBM6jHauCs+Yi6La2LlrvEH1KAJ450VBECZCdg6KDjEDTRKJCiYxl7Bt5CKbmGvN1zJiyI3yCk5wNwoKCIQS+z3kOpdSM7TRDxPvM2PyIDDgdmE30vngAi9dcksLz69et/kjoBKwHUMqAMBUpOoBDFnhRMYUCz+Qr8eRlXBEKVL2AvNXr7uSUfM8irwjYHgI1DKgSwjT3gHNzEINybQgCO7QHwqk6gGnv0dthFOOMSZtQ9Jo/Y7mdYiW4/BFyz6DGJNJDoPe36ppga2Lx+liDG5IDqXc7tY2qr6PF2nlxG8bklBQ/c0frR8dGBLK9+3fqnLi72RqAtAdj6AEwFgPIB0BW4v0249ARI5Qcy6ILflwtLCNDgV7Ypys7uAJenEMLsWxXaVxQcQdTGICQUkSDM3YGxmjO8IzDn7WY6DTnh1/k8Un8J3ADsFnIN6HgOdg0YMtjt/NGOKP/j1R4beR4f/7Nys+L3qwOWYhCQNpR4DPjt9/Nhgj3m8upfXf+jWgW4PN1cqARg7hDMJGHbgrfGocvTzbqcL6z157jfuoINnL2koAO/yBskgJPi5/DBx/cFYAxo+kwVAWv3AeZBV6ElkkJICSx+XQZRt1fgMeqf9pkFf5l+yv4g2t9qrT9PHO8r5ecZf33lx7VouyNC6G2DYENA279bgg5B/kYRQE/de3mBBvRRjiDRTdl+efX/Xf9kKwO2MABDgpoUzGpvXhxSl209AQjyQgCvu0agdeklBZsTqIDhBKEBOQBYKv7WE2BB3iJ4sP3UbahDBp45iOqOHoBBaz+360HIaaCH4UFUVoTlEsBB4lCDXWUBFODt3pEjeIwbUMfywO2FAx7ACuwxAeikGlp+Bu0oHPAJwrm43RJAnNhr1xNvU0hgefX/Pv/7rQzY2oA30LuKABBA7RosyzYXANWA6gYMeBMZaOXHHEGGqKsMCHKAZCAnCS3wMRzIeiwSi2zlW55AATzODRjtF1UDooTAxIeewaQbWbmN+j+xUqCgzWTB23ir75U/dgneXzQV7wGdnUSc2GO3gMlBlSj0gG3XocD8YglgjhyKrvsQokMCy+m0vPpXzv9ucQCp+SfF+xd7nO9j/50URA4gdQjmHxItRLBQebACWiQEAewJdDm+r63C6XMDuX2PgLH8wgnU/VwlwBNDcx42AMAJSirmN2ptyn7aEcR5Axs6FID3t1dv91HUoJf17b7dB5XckE2d11+2ZzDrygD6DFb3Y5b/qBMYuQMGn46v58OBPph7Ci/tP/20GB7d5hUUCaRly6v/1/pvp8lAbS4AzAnYSWBvDirZ/0wAygGcLtar2hMgwc8JQV0ZSMoN/+XPFvwFpna7ppmFMJraNwIpwLahAfcVcB6B5xM4fa7EYwHM+1njr6x/FPfTGYOE4XTsPwoXur8cxKTAtNDWe4AzUBthxJY/VngmCaXidhvrDlCxEcz9+r93GLEbsADUYG5nbvE8hx8xkAvgyx7+GLhv+3t59S+v764OAN4JUBN+OSnYEoDrdf07kcHNcpneFbAnA43659LgDmAEf/D3pu8j8LNTyFl46w4A4KY8yKSRt4O+A4799ecGcBvPxyFBrN4zVQL9HoIoQHixBBA5hjjut/DGnAFSQVluXYIKDRjQ6Dp6YG+hgz1qAUc7zljpfQIwcAPwS0KKELxFt0e2yt1b58kgdhAa/NvS5dW/tL5zJ4C9AuDtfwoF0iSgPFW4/r0t253ARgCZDPYwIKu/dAMYBiDY8z7NqlsXwGEBbseVgLatbx6KQoFY7YMQARKLHtzHk4MGzBPtxZ2aAmX/Izfhge2Jw1t4a+61ytuwQIGeKUJVArzizwLfA5v1P123Vc1GSAxS5xDAelv73/a0JNOz/kgT7ZryxZlf8sVl/m/lIGLgl+++vPp/nr/m4nKbC9A6AQvoMRSA2H8H+77NBnpIAu4/MX5RqgE504+hADoB9/cGmrmQAMnAhAW7gyjqjPkCIAKT+LPgdklEU7yzvQOeMND2H3QCtaphgwMP0RjMeMbHOAALWntmdTwLa64MzIIeodqoJUr6WRhbEjnmBBqxWfi1n+zWBNEHOFt7ZfURphFJoAtQ21uXYH1Gs/498LdAYXn1f1+/quYA9nkA2eLnRqCNGPZXhOV6P/67EwEQQCGENDloy/hDEtAAXocACdi2X4BDAvyM4Hfb1ap7dhKUGEQAa/XHDsQcKphZhFHyEMID0y6MPkH/qnEvTNBGfFbd57bTxMFQL+rJVxSBXqm9Bz7uPU4Etq17wPdOIB95J1xW3raMrXtU/x8BXhOAsu4NkBy7z9j6mW20e9hCgL+4fgX3Aeygh0qAj/8TKezgL6HB1f5Ogevl6nS7TxHegZz/k+DH/oDXIfZvLsCqO24D6l6bgXxSUIcCZd8gPDBqTIlEMwcAzxeDviozzQDU8ftkPiDs/JsDuiYTVvG2lXYA3jNwVsAm9LzCe0VXZOHjdwZ2epOUpQ0mEQ9qH8PPxPkRGaDJ96FFpNL9GP9p6s8OQH3eCOB/W78M3gewzwPY7X1xAqD8Tf2zSygOIOUA9jzCXg68OF+mGLW4gALq2BE0sCdiMOBfXjefffxfgNryBiU5Z1wCTCay7oEVHtXdA72XKDRuIoOeHQaercGMHMJEo4+aV2DBfYwQeqGDygbw9r2wQCm8pRBUdeEQzAxDezSV7POE0LH9zg+o/MAR+++3xSVo0zHUYJWeVXZLFHPALyS1vPt/OX/xNh24qT5MCqLEX4n767/FATQiSI7gct3fF2hDAAX+5gJs/A+A38mghQUq/o9CgbIcY3u/bYGjrxD4/YrSi9wBdBIyQXjAxzmC5iXsX4oongL2tK8nCG34tTtoBKCThR706axuOU0fVvD2YcEoDChA8HYfQedDAQvex9l/RQCjZRa4x9X/GPAL2Szv/gvrF17CZKCdCPYuwNwMlBN+JdY3/17lHEAmghoSXJ5ubQiA4PdEwLH/Dvha+wfwQwXBgZtcA69vVty6iwb7AgZcj9N+W+iwLx20DmuXgKCL7T6v0Uofqfsx1edwIHIBfrmmCmPY3VuJmCjsMWLgM2mosEARgl5mCWAmFLB+Ymz3lVtggPJ5ewQQ7VtgjDmE3jJPEsu7//z6Ba0PwKp/6QYsOYC9VHjZ4n8AfM0HXGy5gDo5KLmApOAF1P7vZNcT0JEMjPLzNnVbtP8cKoC6S4LAPAABHCYZVUC6RGIDNNt8b/sR1n0HoEOEo44g2p4hbz/3CQDWyhmDDOhy7Dngo6NgW2913PoIb/e96nOGAD/j/seXj8jBry/2u8HWJwF76xrEHw/86gDe9efOn3+5vRIsx/yl9FfLgpdpTgDY/jRHAGx//Xy1L98JYLk4XzUXsCkmJgWbC2jgx9i/kIFalgEP1QKv9pwLaKpucwJo/znhV8godgE8qWhEAjo0YKBiLkCBWCn8jOrPbFMsOpCC+4XeiDBmw4CYDKyu+2DBx/rKCaiEIFPEnOr3E34I0ZYz8O7A0ouO/4+ovz4DHreAu/2riCKtXd71P58/73J/KWhpBU4u4GLv7kvJvp0M9lLgen1xlbL/hgQgFNjfMLy7gJwHgERgIgGbHEygKUAvJJHj/qra1h342L4pf10nOgY1UQgSEFOKo3wAgr6XHLTvEMJwowAKAWqP5EOAx5IAgpeOUe26tvYJjt498Na9vIC1+O2IHviPt/x4VKX63i2oJRFBIPgUAWi1j+J5u1wBm4GrfEEM7j4ppLXLu/7H9XN3AoAeAGgKSuqPLiCDvZIAgj/b/0ICpgpgQoEE9Jb4KwDOy43dj8BPicE9LodtYeKQJwx0BFllIUSwoFbOoCizTQaOHIGfhmxpwQLdhwwWfk/IATzyBaIzeQCv7wz04jKU4S8kY6nCAlkpvLf8SCHHQK9AjlBt59JW3G57xBH40KCdAVXdVwdY83ukYH3B8q4/u35OygFk5S9lwKL+l+ACWP0t+Hf7X3IAez/A8voFkkBK7rVQAO1/IQN0CW1ZcgnFLVhAc3/AHAlURYeXitjwgKsCCPbob9VbYG38TG4gQYRTgQz4SQKYnA7M2j6bC7Db+TDAq35s7RVoLbTVpxj8WtubXe9XAGwiz+v9yAEw9C0oj6u/phsL/TngY8CxvPPPnD+LQ4BL6PzbYv+LDejl31zm2x3A1ZLmEOTYH/7dw4DTcr5sgH8v5AFsTqARQ7b+Bey1/s/gz58hRHCkALMJnfWn2YWzwPdhAJOEzRdYGOO2ESnY5TpsUCFDXpbbnCPwegMfL5klABsa9JN9EfRV7O+tfE/TZ+J+b8+tlvdtf0QArMYM7Nj+27i/D28mD+8H2AOMPpcjLu/8H9bPvLg43V5yCACx/5b533MBu+LveYDkGK6WDegpJ1Dsf/p3dwKnPQ/w3toQ1KoBrTKArqApfKkeKOUvio9xP6u+cAHO4rcwAGcSHksS6lAgyhcoQvBaD8oeTC8uDkHBdzv3G0sAKhBQNIAQLleqrL2lhb7510D3ZNEDu03t4ZY6VEAnEG0dq72y62P119bfUsa82isyqATwtf/d+hnJAUAIsMX8HALkEmAigaT6xQHsFYGrbP+3f1siME0PXt4LpUAsCxIRbMqf4/9CFsb2jxxBjfuBHKifQCcCmQwKLLHEGKn9yAX08wSVANyPhRxPBJY9tiFbaOSxZKD3Q3g2+uGl4zxArPk+M9CjBIasNvX9UMCnCvswR+AhlL0XiAAbxfCj2N4Tx0jn9Xr8Bss7/pvzp5cQ4HJ/H8B6vYUALfGHmX/4+2qFECD9vdn+Av6Lq9P2YyO3G/j3+H2P/fPfORfQQN5yAwh8QwI1iVjCBPVvBjK0Dtc8Qg4JIgJQLqDvBmy8H6t+QAD0UlGGu53uOxf/c9YAHcJRIogIwGp9OsOYAHRtYOQHGhBHGt9zBlbB8XoTPBqsLJx1jM+WPqIDPnaDooLxGPqWTB4HfHWM5R1/ev20y4v2PgAs+212fyeDZv139b/cY/715rKEADvwKwnc5XBgCwPu1uX1BR3AeSOBnAisAOfPuXFoW28dAeUIcq5AJwuRIFDJRckwIAd8g5DKE+j16B7y37MvHDVvOEajPyIATx8cHjQIquRhZOv1UcbVAEsJI6BHQUDbr6fhDOkZiD8e9Ec0nwMDa+x7cb2H6tMMf6EjTxzLO/7r9VMvLtb9xR4p+ZdBn2v+W24gx/07Eeyfd/ufbX+J/3MIkEOBXf2Xq9Pd6SJVAgrw939LCXBXavhcS4MW+Coc8O4A8wUJ/E3to8qAXm7dgA0HEPS4XbXy+SfNMNvf4IlAbb0AZl/q0beq3q//67pAWzrnAlitPQkcI4Aj8Lehgf7kLbungFnTr91BPwRQsJ6L9DmbgHCc8wAvTvnLkZav+S/Pn9KqACkPsCl8TvLt4C8uYF9ecwA5BChEUJJ/16e7vay4hQA7AZwvE/ghD3BKFQEJfugXSCAuPQMF4HkZTBJqYA+qBSo34FRfkYFqFS75AiCGmdeO8ctF5LsF0jEb5BD+fRdg10Ylwm2YMaDVZ47ibTBxlADQwHPIwFDVbmDGAfSIIYb0nO3XoD9a2Ovp+kjhR+tH1BDtv3z1f77+vpYETC6gZP0vU8a/qn4lgBQS7HH/5fXe9ZeTgEuy/1en7d9CAFc1D1DUvuQFQP1LjgDzAiZHsIO45BIQ6Br0NvZ/ihtoJGDCAAd6jPXt31bhdTlwPgcQ6XwM+jgc6JOBNfJlW7XUqjwDPgK9zR54kI/MfboiG20rQLfjMJBx6yhXYHW6F/Nj1kDF20xD3gFoGL9R4N/OtnzVf3r+pEQAGfw1CZjBX23/9nmL/5dN3W8urlIOoGT/M/B35c9/329/ny7Peykwlfu2f4vlb9b/XAmhdQgmABfXkPoGPDnYnEADPcwlyOofE0LJDwzCAflGIeEGahMPWvxRJSBS+p4DsG5hZP81CYz9wBwJHCEAFRJo9e4X/Y7bfF8AHIGeCcLCegR4Xh+TQl+/31gC+I/Pv/fyMjf0bBOCNsXfSGDr+tvBX4Cfkn+76m9JQEEAF9e76hcSuN+cwOYOdiDvIE8EUMGdKwPJwvtcQMsbtLZhGxY0oCP4PRH08gN2XZuR2EqDXDmwLb24XQHlUx1Ag7PP7D/dATSFHnsDHQwwLfiynrbyVtNHdl85gEjxLVlYrWUHoFRc5/yZIHpuYBzRR0DuAfyp4I9Ip+YAvvJPrR+/JQG3EuBWAUhJv9P1BvIN/JUIdvXPyn+9EcZ6c7H925J/dxdX6+3+K0OJCHYHsFyttwncRf0TGaDCa1fQHEAUFiRwJHLAvxNAo3wAVwG4q3AEfKwolL8R+E35dSIQAwLc1iq6LQPyOv95PgAoxrln/1UiEN3CDAGMlT4igHnlV87BG+1jBBCB3roB9gIMVAXcX2gCmCGP5Sv+w/PHpclAadbfRgAb6Av4S9y/EwISwN4HcLq9vC5xfwZ/jv8vrncCuC8EUElAOQF0AJAsbG6hgJxDBFxeQI/235JAI4lMHKYleFwe1B2DnCjULsDG+FFI4ElgnNzz2YMetHFdL9VX0oVRTcBSgHIADYjNcVjAItARpEr5C+AiMB8BOULZO4ftGjlXUPIMRTd7ZMDbNmdwhBTamfrhQbR2Bvx7DuDL/+T5d+0hwNLAv2f+r5abqwb668vrZP1r7H992j43B7Bl/wH8ORG4EcBdCQHQCdi/W7cguoGm/MkxDBOEUDFQpcPUkMT9AQr4Nh+gm4RY9TG5x87gMZOEElRnQgCv/rxEx/rj6j9TBNKBdQRWzeesvncA5ZjewjNQLeCRWHhfD2ZPALHVH5OBBvws2EdAHa1XBHBkn+XL/oP1Yy63PoBN+bcQIMf/l9c5BNj+zUSwkcCeF7hOwK8EUMDf/t3Vf3MBy+V6l+L/13L8j7mAMkGo5AZagjAGfysncpkwrhog6DFv0EsANmIYKX+rDkRuICKApvhRvd8TwNPtf3MBbOWbVuttojDAK7tWfQVw3DKpr1LzPgE0SPvtFAGoMAGVWqXvijOYA/yLIIAjQPYZiDnnsHzpv3f+6MuLZZ8MtIcAxf5fn26utr8LAVyXrP96k4ng9iK5gBT7b+C/Xva4v9j/i+vTQ3UAmQBqInB5rWb5k9UvxIAJwaL8UDHA0iF2DKL6Q2ehs/01b9CSf3YbjPHjsKCpc8sZ+OQgAzyO+Y8RgCWB+fg/0nxebj83mjhKAB7wiVgKiNjs4/aWCGLrrxW/ncPb9t46G9vHoB/F/KP1Mxb/MQRwdJ/lS/6d9aNKErCAf7f+1zkEqARQlD8TwfVa4/8M+rvLFPdvBPCQHcBOAOdTAftrOQFYwL65ggL45gJ8GNBCAKwWmJDAgF41D2G2nxOEHBaozyr5p2y/Ajluh8ZeZfs56u/BexT/a+tfQOj13tt6Ze0biO0RME7n+N5+5vxAi7uTA4hCALVOEQC7CAYyGnuv6J4g4m0iIP+iIYAvevf5I65yGXC3/0X5r9brqwz+q5sU/yfrvzmAlvzblf/qtIF/+3e3/fm/jQQeLjIBbCTAoUAjBgR/yf7bngEuFba+gig3gD0CbPuf0jGYiMCHBQXYZT2/G8Am/ljxkQqa/VY5AFxb8gR+WbzEqz3rPdr/eQLwYUDLIKh1s2rP2x0DPOcKUOERpBb0niBOp6U6l55LmCWEN8oB8LWNAoHli951/q0XS+rxb4m/BP6dAKoD2EgAwL+TQLL/l2j9r9f7y+vlYXcBWwhweb47Lyn+T3mAkgsoroCVH/MBLQTA3gFdHeBEoSaA8mahca8AOgZfGozmBDRN7vUCMDkUILPa6wwAg3scAign0JbZTIB3AQ3IqPhWxVm5vUvA7Xt/s/Wfs/gYViiQz4JdbZeOt/8iaP2faLsIgLM5gegcIyDPEIo6xvKFX7v+5hQCbHMA1uvN/l9t9j+DP7mAFPdf7nmA0+3lzVb6yyHA9a7+95vSZ+BvDmAH/+X16dnp6nzbgJ8IIOUBGhFwdcDmBHjeAPcQ2H4BmwhMSi+TgyIXUPoHxlODZ8KBkQOwcbzX+pG9n1H/PvBbwo2Dgaa62u57RVexPapv/DeTwQwBRKFAs/ps41vmwW8zcgW/WAjgaPy/fa/lC776/JtSG/CW9MvgL/Z/cwGb/U9uYLf/V1vdP6t/tv07AewkkP7bgP9wcXN6dnF9erZcvn6TwF7Ab11AcwboBF6rk4dUglA3EcVlQqv2SAqqOjCr/Dr5Z5t/Wj4AI38Ldjb/nAPo2/tY/b3Vt0eyII9UfkwAfJwEMEUIzWm0mNoSg1d7tuYe2O1YDcgN7iqeP7rs7wUBHAXz0e2LG1j++Feuv2F3AJdb0q9Z/+QCNsCfbi5vltuNAPbYf6v97wnATfmXDfBIAA+XN7v6P9vU//Lm9Hy9eO9VUv1GApYQwA3UUMGGBVwh0L0Ctp247wSwAuDnDbQXkPas/wwBoMpzDmDkAFDhEeYW2J4A5lS/ALQHcAtka/85qacdwMjqK7W36t4HfLkmb81HRMFWvUcK7+sE8Fjw7w7g87/s/GEbAWwlv80BXN8k+7//d7PlAHbVT+Df/0vWPxHAupf+LnPcv4F/A/6m/pkAXlqX1y4S4N9TXYAjhL37D/MEcV7gMRWC+XbhXva/vIY8mB0oJgFZE68IwJKASgRqhW8gt+t7qu9j+z7AOd73YYEigQKsFl4UR6Cs/hjsvdg+AnkvBxDnAqyT8ATRcgCjDP9svN8D7hFQH9mW8wDLH/uS84duIcBOADvw1+vrDP5EAgn81QEU9b9Z7i+v1ruLm9P91fWSlX99uLxeduXP/72UgF/An/7d3cCu9vY/mxtIpNAmENFEIpxUVLsEsVyIvz3gW4b5NeN2tmBMBOplIT4hiIafy4I2GIh0vtj1eQKYAb8CcTPhSAjNIbBKN9XluB4BaR0Bxt3Wntt9RiGAjd/fJIB2P2aThI4APvcLX/+Qq8uL2633//pmcwA5D7D/u+4EgODfcgCXN9n236TYf4v5i/pf3qzPLm+WlzYCuLhen51PP5+Bnohg3YFv3UDLDxQnwF2D+DlZfTOrsJJBATo2DuH8gWL92farvoCS6OMfIFEOwHb6aa2PC389sM8RgFJ3tuz9zz4HgGRh1RvJoSm+B7aP72fcwBzIE1mp+F8ve1zcj6HF4x1ApNBHlyuQP0X99xDgj37B+Z/ZZgJuan+9xf03hQh24G9hADiA9XYD/9Vm+wv4N9t/c3q4SjF/Uv/b00YALy2Xr9/toN8AvxQnYN2ATw5ymbCBn+cP6O7BXi4gKbt6bwB3A7b2Xp8HKOt0yQ/7ARG+jyWAfkxvXwLOCh+BfmTnrcqzSs8TQM/2Ixn0/44s/S93Angq+HcC+OzPf/2fvry8uN0SgDebA7jNZLA5gE39b5r9v0rKf3dVwb/eX93sln8jgedXxfrfnl66uj29clpeuzovmwNA8AchgUsS2vkDLUegmoZ8+3CL++EVUykAAAroSURBVDkUwLIgZ/zbJKAxAWjVj+DPZT6l7PGyWOHbPrG954SftfqYsUfgq2y+dQUjy+/t/Tzoe0m8Iwm+IyQRJQY5CXg0B3BU6WeBPbtdLzxYPuvzzv/U5gA2639zs+z/7mHAzbolBHcCKMm/jQCutth/j/vX7d+HTADPrm63uH99fnW7vHx1e9r+eyXZ//KfJ4HdGVTg49++aUj1CpQ3BtlwoCi8bwyypBCVAIvi4zyAErdj/d/W+THhZ0OAluizfqAY//ZvWm8V3y+zQI8dgFZ5TQYc51vwzzkAb917BKCAGW3PDuCXAgG8LyQAdwfwhz/n9X/y+uridkv+3dxuJHC6ubrdqwHbsj0EuLpZNtW/u7peGwHs4F835X92dbs8v9pU/2ZX/pev7k6vXFy/nuN/JADrBhIBaBJoCcG4cxAJoLx5WLYM0wtD5roA2fpz7K8IwCb4uJVHE0ADvFfz7RxK/Ru4LUGwQnMI4IFdYmmO171LaLF128cvs1UAuz5ah8vV30cJAMH1S9kBsGN5TCJw+Yw/cv4ntiagHfy3y04A1zc78HfwX+/gT7H/dVb/6xL3327gT9b/6nZ96fpueWVT/qvb01tOl++5bur/cxnojQwa+I/mBLhV2L9dKH5vQNQEZBN+HOPrz9zO44t43MiLYFXlO2XnRxY/EUSk9t6y2+x+ZPObVe+B3TuDPiG8SQAWokdDgzckCfjpn/n6P745gOub8/XtXQoBbm4365/UPxHAHvfvsf/VzXp/fbs829Q/Kf/6/Pou2f7ru9MrV3ent17drq+cTxvoy38YCvx8Sgru/xVHgJWBLWmI5cFSDrTJQPdCkVwJ4NmC/sUgUcZ/3vIfaemJQK+s/XiZBWzbPlJ2julVjK/jcgR++ZsBrAhg1va/kSHALwYH8CJCgBeSA/i0P3T+x7YGoNu7083t7XJzfbvF/nseYI//r28T+K9vlx38V7fLw/Vu+9dn13fLS9cp4ffy9d36yvX98tbru9PblqvX7hL4fzaDfPt7A74lAp8cTETguwYxIahLghgCqAQgZvltzV/N+ceY36f1UNl1lb/E9Sd6y7+N8dneKzvvFR7t/yzwtaIzyBXAjzqAxxDAiAx+KYYA7zME8Ac/7fV/9Ob24vbm9ny9EcDN3XK7hQBIAJv1v7o93V/fnh6ub9eH6xTzP7++O710fXd6+ebu9Jbr7b/709uu79e3J+AXAkguYN0/RwRAvQKibbg1BJWOQZwp2HthCJf+et1+JRTAWL7pfQ/sNr7nuD599m5AJfSsbbcqbxXcO4A5oCt1j9T8TQIoYc2L7QN4nyGAT/nU8z+yxf27A7jL1YDbXflvr2+T/b/ewL9Z/7vl2fXt6dn13en5zQ7+9eWbu2UD/ltv7k9vu3k4vd9y9Z77jQDWnQTKfxgKIBFgGJAbhUTbsJowZDsES6mPXxdWynyo8tFbfjDJx8k8m85TyTyM1ft/FzKYA3oP5M0dPA34PYv/JgH8EieAT/797/21m/Lf3adE4O3mAG53F7Db/5vbZVP+++u79eHmdrHgv1/ecvNweuvt/entG/hv7s9vP59+5tT+804guQAmgVYitKVBnEWIU4jt68PGrw23qt+SegXY0b/JynNZT8X1aOf93x70bZsE3gjoPZC/SQD9rr+ogagk0zj0+IXsA3ifcQCf+MnnX3N3d0oEcJcSgDe7+q+3O/jvNuu/3t/cnZ7d3C278t/cry/fFvA/rG+/fVje/+756YNOFz97fT79NBHARgg2HIhDgdw1OJwjYF8eqgmgB3rM67eIXgO9WHf+19p6SwocpyfrjqBn8EZgfpMAPMij0l4P0DPrflkSwO/5hPf+6vv75ADu7vdqwM3N3cXdzd2m/uvdzd3ycLOp/93p+e39ksD/sLzl9uH0trtnp7ffPjt9wN2z0wdd3b7n5fPpp06JAJgEOBTQYUBT/1IaxAlBJfmH7xDEST6+xIdKz5F8qfKrd/O0WL84gAJg/JeXqdq8An16tdSbBKB7BHp9ALPAf7MKMN8RsHzc7z7/g/cPp5v73QGsexLw9m7J4D/d394vz27u1me3D8tLt/fry3cPy1vunu3gf7+75+sH3L+0/Irbh9c/4Hz6yVMigB4JRKXBEv+rSUL0GnE38Qd7+5Xql7l6GMe3Rt+WnPMKX1Q9+jft6y08gtv//SYBqJzDTKb/KAEcJYJflg7gYz72vb/y4dmm/psLWG5v7k63t3enu9u7Dfynh9v707O7DfwPp5fvHk5vuX++vu3++fL+98/XD3x4efngh5dPv+p8+vFTIgAmAZUP4N6AKP7HdwTYdwNibb/9BFjSdGXum9pbkFulb3G4BbwHuQJ4H/SFJLZ/33cJYFQJeKP6AGbLgL8YCEDF9rPLODcx0vEX0gfw0b/z/MHPn59ubvcQYFP/9fb2frm/vV/v7+5Pz+6fLS/dPZxevn92esv9S6e3Pzw/vf/Dy6e/79nLp7//+VtO/9B68RNXiQCYBEoYsP0bhQB2fkD78RCeAdisPv/mXwx6m7zzoG5ttiU2t/82m95UHoFs/36TAHRD0Wxr8C8VBzAL9veZJOBH/vb3ftBGAPfPLm/v7k63dw+nu7v70/3tw/pw/3B6fv/s9PLDS8tbH146vf3ZS+sHPH/L8sHPX1l/1ctvW37N6fLHb86nHz2dTz8mCGALBdABYGMQTxDCl4Xa2X42wccqz026kcK3hhwEeQTs2eUYy79JAG8SQNSbP0sKf08cwG/7iPMHJAew3jw8XNzd3Z/v7p8tD/fPTs8fXjq9/Oyl5a3PXz693/NX1g986a3Lr3zlbadf/cr7nf7h08WPXJ9PP3w6n34ECOAnIAwoyUDVC8CTgLi5BxW/NOew1iewl/9KLI9Kj0BWoJ4F+psOIIH7zRDAViQUYGfB/j7jAD78w197+7Pny83Ds+X2/tly9/Cw3j97aXn+7KXl5ecvn976/JX1/V552/IrXnnb+g+89f2XX/u2D/z/2zuXnYSBMAqf0YhAW1pKuQVUVDRqCG5MUBN0oRt3bnwMX8c38EmMD+DGxBgX3qKocUc0mk5NkQk/ZWw1bozMgnBpWJ5zvv8yrbfM0QLHIzieiAH4FED7ACL9xS4APQlI7wxM7+4jOvm9pKejObng+1H9K9ErA/jeslDYOrAygH9oADs7PK3piCU1b1wzWEI3mKYZnmFazDZt5KwMypkcqtki6pbzuuTiFhz34HgIGIBIf5r8YtxHEz+I+PLmXb/YP0VOXwK/xW/0e9Rn2XUZzkcRgioBoqlA9QB69ESben+GALa231O67sV0YyRupJA00yMpy2a27aDg5FHJl7xaucKaca1V4LiEi5uuAfgEQPGf1vy0xqcNPXnCy0QcJvZgyn8n9RUBKAKQbQaGj/56kqVPBgqKVzZujBL7nzGAZrOtpczYuGmxhGUzw8myTK6IUmkSi5Uqa05Mt7c4TsFxAY4ruLjr4r8vfj/1hfBF2gu8F3W8OIwzmOJRqR5mDIoABpeJxHz9N++qBKCiHwIDaKy+JWx7LO5kPb1QhDM1g9mFGttYWfP2OY7BcQKOc3Bcd7Df7XT9/VpfHPWlgo8WeVD0UUkvS3tFAIPjyN+Inv5XGcCQGUC9/hwrlQ1tbn602FjH5u7eywHHIVwcgeOsi/v+jN9v6vn1O+AG6vEwUf/kWjDVFQGEpzwdPSoD6J9UfIX2wWWiYS8BPgCAPOYxoDrtqQAAAABJRU5ErkJggg=="), e - }() - , rr = function() { - function e(t) { - this._isEnabled = false, - this.isEnabled = false, - this.intensity = 1, - this.roughness = 0, - this._indiceOfRefraction = e._DefaultIndiceOfRefraction, - this.indiceOfRefraction = e._DefaultIndiceOfRefraction, - this._texture = null, - this.texture = null, - this._bumpTexture = null, - this.bumpTexture = null, - this._isTintEnabled = false, - this.isTintEnabled = false, - this.tintColor = a.e.White(), - this.tintColorAtDistance = 1, - this.tintThickness = 1, - this._tintTexture = null, - this.tintTexture = null, - this._internalMarkAllSubMeshesAsTexturesDirty = t - } - return e.prototype._markAllSubMeshesAsTexturesDirty = function() { - this._internalMarkAllSubMeshesAsTexturesDirty() - } - , - e.prototype.isReadyForSubMesh = function(e, t, i, n) { - if (e._areTexturesDirty && t.texturesEnabled) { - if (this._texture && qn.a.ClearCoatTextureEnabled && !this._texture.isReadyOrNotBlocking()) - return false; - if (i.getCaps().standardDerivatives && this._bumpTexture && qn.a.ClearCoatBumpTextureEnabled && !n && !this._bumpTexture.isReady()) - return false; - if (this._isTintEnabled && this._tintTexture && qn.a.ClearCoatTintTextureEnabled && !this._tintTexture.isReadyOrNotBlocking()) - return false - } - return true - } - , - e.prototype.prepareDefines = function(t, i) { - this._isEnabled ? (t.CLEARCOAT = true, - t._areTexturesDirty && i.texturesEnabled && (this._texture && qn.a.ClearCoatTextureEnabled ? Yn.a.PrepareDefinesForMergedUV(this._texture, t, "CLEARCOAT_TEXTURE") : t.CLEARCOAT_TEXTURE = false, - this._bumpTexture && qn.a.ClearCoatBumpTextureEnabled ? Yn.a.PrepareDefinesForMergedUV(this._bumpTexture, t, "CLEARCOAT_BUMP") : t.CLEARCOAT_BUMP = false, - t.CLEARCOAT_DEFAULTIOR = this._indiceOfRefraction === e._DefaultIndiceOfRefraction, - this._isTintEnabled ? (t.CLEARCOAT_TINT = true, - this._tintTexture && qn.a.ClearCoatTintTextureEnabled ? Yn.a.PrepareDefinesForMergedUV(this._tintTexture, t, "CLEARCOAT_TINT_TEXTURE") : t.CLEARCOAT_TINT_TEXTURE = false) : (t.CLEARCOAT_TINT = false, - t.CLEARCOAT_TINT_TEXTURE = false))) : (t.CLEARCOAT = false, - t.CLEARCOAT_TEXTURE = false, - t.CLEARCOAT_BUMP = false, - t.CLEARCOAT_TINT = false, - t.CLEARCOAT_TINT_TEXTURE = false) - } - , - e.prototype.bindForSubMesh = function(e, t, i, n, r, o, a) { - if (!e.useUbo || !r || !e.isSync) { - this._texture && qn.a.ClearCoatTextureEnabled && (e.updateFloat2("vClearCoatInfos", this._texture.coordinatesIndex, this._texture.level), - Yn.a.BindTextureMatrix(this._texture, e, "clearCoat")), - this._bumpTexture && i.getCaps().standardDerivatives && qn.a.ClearCoatTextureEnabled && !n && (e.updateFloat2("vClearCoatBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level), - Yn.a.BindTextureMatrix(this._bumpTexture, e, "clearCoatBump"), - t._mirroredCameraPosition ? e.updateFloat2("vClearCoatTangentSpaceParams", o ? 1 : -1, a ? 1 : -1) : e.updateFloat2("vClearCoatTangentSpaceParams", o ? -1 : 1, a ? -1 : 1)), - this._tintTexture && qn.a.ClearCoatTintTextureEnabled && (e.updateFloat2("vClearCoatTintInfos", this._tintTexture.coordinatesIndex, this._tintTexture.level), - Yn.a.BindTextureMatrix(this._tintTexture, e, "clearCoatTint")), - e.updateFloat2("vClearCoatParams", this.intensity, this.roughness); - var s = 1 - this._indiceOfRefraction - , c = 1 + this._indiceOfRefraction - , u = Math.pow(-s / c, 2) - , l = 1 / this._indiceOfRefraction; - e.updateFloat4("vClearCoatRefractionParams", u, l, s, c), - this._isTintEnabled && (e.updateFloat4("vClearCoatTintParams", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(1e-5, this.tintThickness)), - e.updateFloat("clearCoatColorAtDistance", Math.max(1e-5, this.tintColorAtDistance))) - } - t.texturesEnabled && (this._texture && qn.a.ClearCoatTextureEnabled && e.setTexture("clearCoatSampler", this._texture), - this._bumpTexture && i.getCaps().standardDerivatives && qn.a.ClearCoatBumpTextureEnabled && !n && e.setTexture("clearCoatBumpSampler", this._bumpTexture), - this._isTintEnabled && this._tintTexture && qn.a.ClearCoatTintTextureEnabled && e.setTexture("clearCoatTintSampler", this._tintTexture)) - } - , - e.prototype.hasTexture = function(e) { - return this._texture === e || this._bumpTexture === e || this._tintTexture === e - } - , - e.prototype.getActiveTextures = function(e) { - this._texture && e.push(this._texture), + ); + })(), + rr = (function () { + function e(t) { + (this._isEnabled = false), + (this.isEnabled = false), + (this.intensity = 1), + (this.roughness = 0), + (this._indiceOfRefraction = e._DefaultIndiceOfRefraction), + (this.indiceOfRefraction = e._DefaultIndiceOfRefraction), + (this._texture = null), + (this.texture = null), + (this._bumpTexture = null), + (this.bumpTexture = null), + (this._isTintEnabled = false), + (this.isTintEnabled = false), + (this.tintColor = a.e.White()), + (this.tintColorAtDistance = 1), + (this.tintThickness = 1), + (this._tintTexture = null), + (this.tintTexture = null), + (this._internalMarkAllSubMeshesAsTexturesDirty = t); + } + return ( + (e.prototype._markAllSubMeshesAsTexturesDirty = + function () { + this._internalMarkAllSubMeshesAsTexturesDirty(); + }), + (e.prototype.isReadyForSubMesh = function (e, t, i, n) { + if (e._areTexturesDirty && t.texturesEnabled) { + if ( + this._texture && + qn.a.ClearCoatTextureEnabled && + !this._texture.isReadyOrNotBlocking() + ) + return false; + if ( + i.getCaps().standardDerivatives && + this._bumpTexture && + qn.a.ClearCoatBumpTextureEnabled && + !n && + !this._bumpTexture.isReady() + ) + return false; + if ( + this._isTintEnabled && + this._tintTexture && + qn.a.ClearCoatTintTextureEnabled && + !this._tintTexture.isReadyOrNotBlocking() + ) + return false; + } + return true; + }), + (e.prototype.prepareDefines = function (t, i) { + this._isEnabled + ? ((t.CLEARCOAT = true), + t._areTexturesDirty && + i.texturesEnabled && + (this._texture && qn.a.ClearCoatTextureEnabled + ? Yn.a.PrepareDefinesForMergedUV( + this._texture, + t, + "CLEARCOAT_TEXTURE" + ) + : (t.CLEARCOAT_TEXTURE = false), + this._bumpTexture && + qn.a.ClearCoatBumpTextureEnabled + ? Yn.a.PrepareDefinesForMergedUV( + this._bumpTexture, + t, + "CLEARCOAT_BUMP" + ) + : (t.CLEARCOAT_BUMP = false), + (t.CLEARCOAT_DEFAULTIOR = + this._indiceOfRefraction === + e._DefaultIndiceOfRefraction), + this._isTintEnabled + ? ((t.CLEARCOAT_TINT = true), + this._tintTexture && + qn.a.ClearCoatTintTextureEnabled + ? Yn.a.PrepareDefinesForMergedUV( + this._tintTexture, + t, + "CLEARCOAT_TINT_TEXTURE" + ) + : (t.CLEARCOAT_TINT_TEXTURE = false)) + : ((t.CLEARCOAT_TINT = false), + (t.CLEARCOAT_TINT_TEXTURE = false)))) + : ((t.CLEARCOAT = false), + (t.CLEARCOAT_TEXTURE = false), + (t.CLEARCOAT_BUMP = false), + (t.CLEARCOAT_TINT = false), + (t.CLEARCOAT_TINT_TEXTURE = false)); + }), + (e.prototype.bindForSubMesh = function ( + e, + t, + i, + n, + r, + o, + a + ) { + if (!e.useUbo || !r || !e.isSync) { + this._texture && + qn.a.ClearCoatTextureEnabled && + (e.updateFloat2( + "vClearCoatInfos", + this._texture.coordinatesIndex, + this._texture.level + ), + Yn.a.BindTextureMatrix( + this._texture, + e, + "clearCoat" + )), + this._bumpTexture && + i.getCaps().standardDerivatives && + qn.a.ClearCoatTextureEnabled && + !n && + (e.updateFloat2( + "vClearCoatBumpInfos", + this._bumpTexture.coordinatesIndex, + this._bumpTexture.level + ), + Yn.a.BindTextureMatrix( + this._bumpTexture, + e, + "clearCoatBump" + ), + t._mirroredCameraPosition + ? e.updateFloat2( + "vClearCoatTangentSpaceParams", + o ? 1 : -1, + a ? 1 : -1 + ) + : e.updateFloat2( + "vClearCoatTangentSpaceParams", + o ? -1 : 1, + a ? -1 : 1 + )), + this._tintTexture && + qn.a.ClearCoatTintTextureEnabled && + (e.updateFloat2( + "vClearCoatTintInfos", + this._tintTexture.coordinatesIndex, + this._tintTexture.level + ), + Yn.a.BindTextureMatrix( + this._tintTexture, + e, + "clearCoatTint" + )), + e.updateFloat2( + "vClearCoatParams", + this.intensity, + this.roughness + ); + var s = 1 - this._indiceOfRefraction, + c = 1 + this._indiceOfRefraction, + u = Math.pow(-s / c, 2), + l = 1 / this._indiceOfRefraction; + e.updateFloat4( + "vClearCoatRefractionParams", + u, + l, + s, + c + ), + this._isTintEnabled && + (e.updateFloat4( + "vClearCoatTintParams", + this.tintColor.r, + this.tintColor.g, + this.tintColor.b, + Math.max(1e-5, this.tintThickness) + ), + e.updateFloat( + "clearCoatColorAtDistance", + Math.max(1e-5, this.tintColorAtDistance) + )); + } + t.texturesEnabled && + (this._texture && + qn.a.ClearCoatTextureEnabled && + e.setTexture("clearCoatSampler", this._texture), + this._bumpTexture && + i.getCaps().standardDerivatives && + qn.a.ClearCoatBumpTextureEnabled && + !n && + e.setTexture( + "clearCoatBumpSampler", + this._bumpTexture + ), + this._isTintEnabled && + this._tintTexture && + qn.a.ClearCoatTintTextureEnabled && + e.setTexture( + "clearCoatTintSampler", + this._tintTexture + )); + }), + (e.prototype.hasTexture = function (e) { + return ( + this._texture === e || + this._bumpTexture === e || + this._tintTexture === e + ); + }), + (e.prototype.getActiveTextures = function (e) { + this._texture && e.push(this._texture), this._bumpTexture && e.push(this._bumpTexture), - this._tintTexture && e.push(this._tintTexture) - } - , - e.prototype.getAnimatables = function(e) { - this._texture && this._texture.animations && this._texture.animations.length > 0 && e.push(this._texture), - this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0 && e.push(this._bumpTexture), - this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0 && e.push(this._tintTexture) - } - , - e.prototype.dispose = function(e) { - e && (this._texture && this._texture.dispose(), + this._tintTexture && e.push(this._tintTexture); + }), + (e.prototype.getAnimatables = function (e) { + this._texture && + this._texture.animations && + this._texture.animations.length > 0 && + e.push(this._texture), + this._bumpTexture && + this._bumpTexture.animations && + this._bumpTexture.animations.length > 0 && + e.push(this._bumpTexture), + this._tintTexture && + this._tintTexture.animations && + this._tintTexture.animations.length > 0 && + e.push(this._tintTexture); + }), + (e.prototype.dispose = function (e) { + e && + (this._texture && this._texture.dispose(), this._bumpTexture && this._bumpTexture.dispose(), - this._tintTexture && this._tintTexture.dispose()) - } - , - e.prototype.getClassName = function() { - return "PBRClearCoatConfiguration" - } - , - e.AddFallbacks = function(e, t, i) { - return e.CLEARCOAT_BUMP && t.addFallback(i++, "CLEARCOAT_BUMP"), - e.CLEARCOAT_TINT && t.addFallback(i++, "CLEARCOAT_TINT"), + this._tintTexture && this._tintTexture.dispose()); + }), + (e.prototype.getClassName = function () { + return "PBRClearCoatConfiguration"; + }), + (e.AddFallbacks = function (e, t, i) { + return ( + e.CLEARCOAT_BUMP && + t.addFallback(i++, "CLEARCOAT_BUMP"), + e.CLEARCOAT_TINT && + t.addFallback(i++, "CLEARCOAT_TINT"), e.CLEARCOAT && t.addFallback(i++, "CLEARCOAT"), i - } - , - e.AddUniforms = function(e) { - e.push("vClearCoatTangentSpaceParams", "vClearCoatParams", "vClearCoatRefractionParams", "vClearCoatTintParams", "clearCoatColorAtDistance", "clearCoatMatrix", "clearCoatBumpMatrix", "clearCoatTintMatrix", "vClearCoatInfos", "vClearCoatBumpInfos", "vClearCoatTintInfos") - } - , - e.AddSamplers = function(e) { - e.push("clearCoatSampler", "clearCoatBumpSampler", "clearCoatTintSampler") - } - , - e.PrepareUniformBuffer = function(e) { - e.addUniform("vClearCoatParams", 2), + ); + }), + (e.AddUniforms = function (e) { + e.push( + "vClearCoatTangentSpaceParams", + "vClearCoatParams", + "vClearCoatRefractionParams", + "vClearCoatTintParams", + "clearCoatColorAtDistance", + "clearCoatMatrix", + "clearCoatBumpMatrix", + "clearCoatTintMatrix", + "vClearCoatInfos", + "vClearCoatBumpInfos", + "vClearCoatTintInfos" + ); + }), + (e.AddSamplers = function (e) { + e.push( + "clearCoatSampler", + "clearCoatBumpSampler", + "clearCoatTintSampler" + ); + }), + (e.PrepareUniformBuffer = function (e) { + e.addUniform("vClearCoatParams", 2), e.addUniform("vClearCoatRefractionParams", 4), e.addUniform("vClearCoatInfos", 2), e.addUniform("clearCoatMatrix", 16), @@ -70769,454 +94762,747 @@ and limitations under the License. e.addUniform("vClearCoatTintParams", 4), e.addUniform("clearCoatColorAtDistance", 1), e.addUniform("vClearCoatTintInfos", 2), - e.addUniform("clearCoatTintMatrix", 16) - } - , - e.prototype.copyTo = function(e) { - F.a.Clone(function() { - return e - }, this) - } - , - e.prototype.serialize = function() { - return F.a.Serialize(this) - } - , - e.prototype.parse = function(e) { - var t = this; - F.a.Parse(function() { - return t - }, e, null) - } - , - e._DefaultIndiceOfRefraction = 1.5, + e.addUniform("clearCoatTintMatrix", 16); + }), + (e.prototype.copyTo = function (e) { + F.a.Clone(function () { + return e; + }, this); + }), + (e.prototype.serialize = function () { + return F.a.Serialize(this); + }), + (e.prototype.parse = function (e) { + var t = this; + F.a.Parse( + function () { + return t; + }, + e, + null + ); + }), + (e._DefaultIndiceOfRefraction = 1.5), h.c([Object(F.c)()], e.prototype, "_isEnabled", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isEnabled", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "isEnabled", + void 0 + ), h.c([Object(F.c)()], e.prototype, "intensity", void 0), h.c([Object(F.c)()], e.prototype, "roughness", void 0), - h.c([Object(F.c)()], e.prototype, "_indiceOfRefraction", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "indiceOfRefraction", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "_indiceOfRefraction", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "indiceOfRefraction", + void 0 + ), h.c([Object(F.m)()], e.prototype, "_texture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "texture", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "texture", + void 0 + ), h.c([Object(F.m)()], e.prototype, "_bumpTexture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "bumpTexture", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "bumpTexture", + void 0 + ), h.c([Object(F.c)()], e.prototype, "_isTintEnabled", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isTintEnabled", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "isTintEnabled", + void 0 + ), h.c([Object(F.e)()], e.prototype, "tintColor", void 0), - h.c([Object(F.c)()], e.prototype, "tintColorAtDistance", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "tintColorAtDistance", + void 0 + ), h.c([Object(F.c)()], e.prototype, "tintThickness", void 0), h.c([Object(F.m)()], e.prototype, "_tintTexture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "tintTexture", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "tintTexture", + void 0 + ), e - }() - , or = function() { - function e(e) { - this._isEnabled = false, - this.isEnabled = false, - this.intensity = 1, - this.direction = new a.w(1,0), - this._texture = null, - this.texture = null, - this._internalMarkAllSubMeshesAsTexturesDirty = e - } - return e.prototype._markAllSubMeshesAsTexturesDirty = function() { - this._internalMarkAllSubMeshesAsTexturesDirty() - } - , - e.prototype.isReadyForSubMesh = function(e, t) { - return !(e._areTexturesDirty && t.texturesEnabled && this._texture && qn.a.AnisotropicTextureEnabled && !this._texture.isReadyOrNotBlocking()) - } - , - e.prototype.prepareDefines = function(e, t, i) { - this._isEnabled ? (e.ANISOTROPIC = this._isEnabled, - this._isEnabled && !t.isVerticesDataPresent(Si.b.TangentKind) && (e._needUVs = true, - e.MAINUV1 = true), - e._areTexturesDirty && i.texturesEnabled && (this._texture && qn.a.AnisotropicTextureEnabled ? Yn.a.PrepareDefinesForMergedUV(this._texture, e, "ANISOTROPIC_TEXTURE") : e.ANISOTROPIC_TEXTURE = false)) : (e.ANISOTROPIC = false, - e.ANISOTROPIC_TEXTURE = false) - } - , - e.prototype.bindForSubMesh = function(e, t, i) { - e.useUbo && i && e.isSync || (this._texture && qn.a.AnisotropicTextureEnabled && (e.updateFloat2("vAnisotropyInfos", this._texture.coordinatesIndex, this._texture.level), - Yn.a.BindTextureMatrix(this._texture, e, "anisotropy")), - e.updateFloat3("vAnisotropy", this.direction.x, this.direction.y, this.intensity)), - t.texturesEnabled && this._texture && qn.a.AnisotropicTextureEnabled && e.setTexture("anisotropySampler", this._texture) - } - , - e.prototype.hasTexture = function(e) { - return this._texture === e - } - , - e.prototype.getActiveTextures = function(e) { - this._texture && e.push(this._texture) - } - , - e.prototype.getAnimatables = function(e) { - this._texture && this._texture.animations && this._texture.animations.length > 0 && e.push(this._texture) - } - , - e.prototype.dispose = function(e) { - e && this._texture && this._texture.dispose() - } - , - e.prototype.getClassName = function() { - return "PBRAnisotropicConfiguration" - } - , - e.AddFallbacks = function(e, t, i) { - return e.ANISOTROPIC && t.addFallback(i++, "ANISOTROPIC"), - i - } - , - e.AddUniforms = function(e) { - e.push("vAnisotropy", "vAnisotropyInfos", "anisotropyMatrix") - } - , - e.PrepareUniformBuffer = function(e) { - e.addUniform("vAnisotropy", 3), + ); + })(), + or = (function () { + function e(e) { + (this._isEnabled = false), + (this.isEnabled = false), + (this.intensity = 1), + (this.direction = new a.w(1, 0)), + (this._texture = null), + (this.texture = null), + (this._internalMarkAllSubMeshesAsTexturesDirty = e); + } + return ( + (e.prototype._markAllSubMeshesAsTexturesDirty = + function () { + this._internalMarkAllSubMeshesAsTexturesDirty(); + }), + (e.prototype.isReadyForSubMesh = function (e, t) { + return !( + e._areTexturesDirty && + t.texturesEnabled && + this._texture && + qn.a.AnisotropicTextureEnabled && + !this._texture.isReadyOrNotBlocking() + ); + }), + (e.prototype.prepareDefines = function (e, t, i) { + this._isEnabled + ? ((e.ANISOTROPIC = this._isEnabled), + this._isEnabled && + !t.isVerticesDataPresent(Si.b.TangentKind) && + ((e._needUVs = true), (e.MAINUV1 = true)), + e._areTexturesDirty && + i.texturesEnabled && + (this._texture && qn.a.AnisotropicTextureEnabled + ? Yn.a.PrepareDefinesForMergedUV( + this._texture, + e, + "ANISOTROPIC_TEXTURE" + ) + : (e.ANISOTROPIC_TEXTURE = false))) + : ((e.ANISOTROPIC = false), + (e.ANISOTROPIC_TEXTURE = false)); + }), + (e.prototype.bindForSubMesh = function (e, t, i) { + (e.useUbo && i && e.isSync) || + (this._texture && + qn.a.AnisotropicTextureEnabled && + (e.updateFloat2( + "vAnisotropyInfos", + this._texture.coordinatesIndex, + this._texture.level + ), + Yn.a.BindTextureMatrix( + this._texture, + e, + "anisotropy" + )), + e.updateFloat3( + "vAnisotropy", + this.direction.x, + this.direction.y, + this.intensity + )), + t.texturesEnabled && + this._texture && + qn.a.AnisotropicTextureEnabled && + e.setTexture("anisotropySampler", this._texture); + }), + (e.prototype.hasTexture = function (e) { + return this._texture === e; + }), + (e.prototype.getActiveTextures = function (e) { + this._texture && e.push(this._texture); + }), + (e.prototype.getAnimatables = function (e) { + this._texture && + this._texture.animations && + this._texture.animations.length > 0 && + e.push(this._texture); + }), + (e.prototype.dispose = function (e) { + e && this._texture && this._texture.dispose(); + }), + (e.prototype.getClassName = function () { + return "PBRAnisotropicConfiguration"; + }), + (e.AddFallbacks = function (e, t, i) { + return ( + e.ANISOTROPIC && t.addFallback(i++, "ANISOTROPIC"), i + ); + }), + (e.AddUniforms = function (e) { + e.push( + "vAnisotropy", + "vAnisotropyInfos", + "anisotropyMatrix" + ); + }), + (e.PrepareUniformBuffer = function (e) { + e.addUniform("vAnisotropy", 3), e.addUniform("vAnisotropyInfos", 2), - e.addUniform("anisotropyMatrix", 16) - } - , - e.AddSamplers = function(e) { - e.push("anisotropySampler") - } - , - e.prototype.copyTo = function(e) { - F.a.Clone(function() { - return e - }, this) - } - , - e.prototype.serialize = function() { - return F.a.Serialize(this) - } - , - e.prototype.parse = function(e) { - var t = this; - F.a.Parse(function() { - return t - }, e, null) - } - , + e.addUniform("anisotropyMatrix", 16); + }), + (e.AddSamplers = function (e) { + e.push("anisotropySampler"); + }), + (e.prototype.copyTo = function (e) { + F.a.Clone(function () { + return e; + }, this); + }), + (e.prototype.serialize = function () { + return F.a.Serialize(this); + }), + (e.prototype.parse = function (e) { + var t = this; + F.a.Parse( + function () { + return t; + }, + e, + null + ); + }), h.c([Object(F.c)()], e.prototype, "_isEnabled", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isEnabled", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "isEnabled", + void 0 + ), h.c([Object(F.c)()], e.prototype, "intensity", void 0), h.c([Object(F.n)()], e.prototype, "direction", void 0), h.c([Object(F.m)()], e.prototype, "_texture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "texture", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "texture", + void 0 + ), e - }() - , ar = function() { - function e(t) { - this._useEnergyConservation = e.DEFAULT_USE_ENERGY_CONSERVATION, - this.useEnergyConservation = e.DEFAULT_USE_ENERGY_CONSERVATION, - this._useSmithVisibilityHeightCorrelated = e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED, - this.useSmithVisibilityHeightCorrelated = e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED, - this._useSphericalHarmonics = e.DEFAULT_USE_SPHERICAL_HARMONICS, - this.useSphericalHarmonics = e.DEFAULT_USE_SPHERICAL_HARMONICS, - this._internalMarkAllSubMeshesAsMiscDirty = t - } - return e.prototype._markAllSubMeshesAsMiscDirty = function() { - this._internalMarkAllSubMeshesAsMiscDirty() - } - , - e.prototype.prepareDefines = function(e) { - e.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated, - e.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated, - e.SPHERICAL_HARMONICS = this._useSphericalHarmonics - } - , - e.prototype.getClassName = function() { - return "PBRBRDFConfiguration" - } - , - e.prototype.copyTo = function(e) { - F.a.Clone(function() { - return e - }, this) - } - , - e.prototype.serialize = function() { - return F.a.Serialize(this) - } - , - e.prototype.parse = function(e) { - var t = this; - F.a.Parse(function() { - return t - }, e, null) - } - , - e.DEFAULT_USE_ENERGY_CONSERVATION = true, - e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = true, - e.DEFAULT_USE_SPHERICAL_HARMONICS = true, - h.c([Object(F.c)()], e.prototype, "_useEnergyConservation", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsMiscDirty")], e.prototype, "useEnergyConservation", void 0), - h.c([Object(F.c)()], e.prototype, "_useSmithVisibilityHeightCorrelated", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsMiscDirty")], e.prototype, "useSmithVisibilityHeightCorrelated", void 0), - h.c([Object(F.c)()], e.prototype, "_useSphericalHarmonics", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsMiscDirty")], e.prototype, "useSphericalHarmonics", void 0), + ); + })(), + ar = (function () { + function e(t) { + (this._useEnergyConservation = + e.DEFAULT_USE_ENERGY_CONSERVATION), + (this.useEnergyConservation = + e.DEFAULT_USE_ENERGY_CONSERVATION), + (this._useSmithVisibilityHeightCorrelated = + e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED), + (this.useSmithVisibilityHeightCorrelated = + e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED), + (this._useSphericalHarmonics = + e.DEFAULT_USE_SPHERICAL_HARMONICS), + (this.useSphericalHarmonics = + e.DEFAULT_USE_SPHERICAL_HARMONICS), + (this._internalMarkAllSubMeshesAsMiscDirty = t); + } + return ( + (e.prototype._markAllSubMeshesAsMiscDirty = function () { + this._internalMarkAllSubMeshesAsMiscDirty(); + }), + (e.prototype.prepareDefines = function (e) { + (e.BRDF_V_HEIGHT_CORRELATED = + this._useSmithVisibilityHeightCorrelated), + (e.MS_BRDF_ENERGY_CONSERVATION = + this._useEnergyConservation && + this._useSmithVisibilityHeightCorrelated), + (e.SPHERICAL_HARMONICS = this._useSphericalHarmonics); + }), + (e.prototype.getClassName = function () { + return "PBRBRDFConfiguration"; + }), + (e.prototype.copyTo = function (e) { + F.a.Clone(function () { + return e; + }, this); + }), + (e.prototype.serialize = function () { + return F.a.Serialize(this); + }), + (e.prototype.parse = function (e) { + var t = this; + F.a.Parse( + function () { + return t; + }, + e, + null + ); + }), + (e.DEFAULT_USE_ENERGY_CONSERVATION = true), + (e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = true), + (e.DEFAULT_USE_SPHERICAL_HARMONICS = true), + h.c( + [Object(F.c)()], + e.prototype, + "_useEnergyConservation", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsMiscDirty")], + e.prototype, + "useEnergyConservation", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "_useSmithVisibilityHeightCorrelated", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsMiscDirty")], + e.prototype, + "useSmithVisibilityHeightCorrelated", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "_useSphericalHarmonics", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsMiscDirty")], + e.prototype, + "useSphericalHarmonics", + void 0 + ), e - }() - , sr = function() { - function e(e) { - this._isEnabled = false, - this.isEnabled = false, - this._linkSheenWithAlbedo = false, - this.linkSheenWithAlbedo = false, - this.intensity = 1, - this.color = a.e.White(), - this._texture = null, - this.texture = null, - this._internalMarkAllSubMeshesAsTexturesDirty = e - } - return e.prototype._markAllSubMeshesAsTexturesDirty = function() { - this._internalMarkAllSubMeshesAsTexturesDirty() - } - , - e.prototype.isReadyForSubMesh = function(e, t) { - return !(e._areTexturesDirty && t.texturesEnabled && this._texture && qn.a.SheenTextureEnabled && !this._texture.isReadyOrNotBlocking()) - } - , - e.prototype.prepareDefines = function(e, t) { - this._isEnabled ? (e.SHEEN = this._isEnabled, - e.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo, - e._areTexturesDirty && t.texturesEnabled && (this._texture && qn.a.SheenTextureEnabled ? Yn.a.PrepareDefinesForMergedUV(this._texture, e, "SHEEN_TEXTURE") : e.SHEEN_TEXTURE = false)) : (e.SHEEN = false, - e.SHEEN_TEXTURE = false, - e.SHEEN_LINKWITHALBEDO = false) - } - , - e.prototype.bindForSubMesh = function(e, t, i) { - e.useUbo && i && e.isSync || (this._texture && qn.a.SheenTextureEnabled && (e.updateFloat2("vSheenInfos", this._texture.coordinatesIndex, this._texture.level), - Yn.a.BindTextureMatrix(this._texture, e, "sheen")), - e.updateFloat4("vSheenColor", this.color.r, this.color.g, this.color.b, this.intensity)), - t.texturesEnabled && this._texture && qn.a.SheenTextureEnabled && e.setTexture("sheenSampler", this._texture) - } - , - e.prototype.hasTexture = function(e) { - return this._texture === e - } - , - e.prototype.getActiveTextures = function(e) { - this._texture && e.push(this._texture) - } - , - e.prototype.getAnimatables = function(e) { - this._texture && this._texture.animations && this._texture.animations.length > 0 && e.push(this._texture) - } - , - e.prototype.dispose = function(e) { - e && this._texture && this._texture.dispose() - } - , - e.prototype.getClassName = function() { - return "PBRSheenConfiguration" - } - , - e.AddFallbacks = function(e, t, i) { - return e.SHEEN && t.addFallback(i++, "SHEEN"), - i - } - , - e.AddUniforms = function(e) { - e.push("vSheenColor", "vSheenInfos", "sheenMatrix") - } - , - e.PrepareUniformBuffer = function(e) { - e.addUniform("vSheenColor", 4), + ); + })(), + sr = (function () { + function e(e) { + (this._isEnabled = false), + (this.isEnabled = false), + (this._linkSheenWithAlbedo = false), + (this.linkSheenWithAlbedo = false), + (this.intensity = 1), + (this.color = a.e.White()), + (this._texture = null), + (this.texture = null), + (this._internalMarkAllSubMeshesAsTexturesDirty = e); + } + return ( + (e.prototype._markAllSubMeshesAsTexturesDirty = + function () { + this._internalMarkAllSubMeshesAsTexturesDirty(); + }), + (e.prototype.isReadyForSubMesh = function (e, t) { + return !( + e._areTexturesDirty && + t.texturesEnabled && + this._texture && + qn.a.SheenTextureEnabled && + !this._texture.isReadyOrNotBlocking() + ); + }), + (e.prototype.prepareDefines = function (e, t) { + this._isEnabled + ? ((e.SHEEN = this._isEnabled), + (e.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo), + e._areTexturesDirty && + t.texturesEnabled && + (this._texture && qn.a.SheenTextureEnabled + ? Yn.a.PrepareDefinesForMergedUV( + this._texture, + e, + "SHEEN_TEXTURE" + ) + : (e.SHEEN_TEXTURE = false))) + : ((e.SHEEN = false), + (e.SHEEN_TEXTURE = false), + (e.SHEEN_LINKWITHALBEDO = false)); + }), + (e.prototype.bindForSubMesh = function (e, t, i) { + (e.useUbo && i && e.isSync) || + (this._texture && + qn.a.SheenTextureEnabled && + (e.updateFloat2( + "vSheenInfos", + this._texture.coordinatesIndex, + this._texture.level + ), + Yn.a.BindTextureMatrix(this._texture, e, "sheen")), + e.updateFloat4( + "vSheenColor", + this.color.r, + this.color.g, + this.color.b, + this.intensity + )), + t.texturesEnabled && + this._texture && + qn.a.SheenTextureEnabled && + e.setTexture("sheenSampler", this._texture); + }), + (e.prototype.hasTexture = function (e) { + return this._texture === e; + }), + (e.prototype.getActiveTextures = function (e) { + this._texture && e.push(this._texture); + }), + (e.prototype.getAnimatables = function (e) { + this._texture && + this._texture.animations && + this._texture.animations.length > 0 && + e.push(this._texture); + }), + (e.prototype.dispose = function (e) { + e && this._texture && this._texture.dispose(); + }), + (e.prototype.getClassName = function () { + return "PBRSheenConfiguration"; + }), + (e.AddFallbacks = function (e, t, i) { + return e.SHEEN && t.addFallback(i++, "SHEEN"), i; + }), + (e.AddUniforms = function (e) { + e.push("vSheenColor", "vSheenInfos", "sheenMatrix"); + }), + (e.PrepareUniformBuffer = function (e) { + e.addUniform("vSheenColor", 4), e.addUniform("vSheenInfos", 2), - e.addUniform("sheenMatrix", 16) - } - , - e.AddSamplers = function(e) { - e.push("sheenSampler") - } - , - e.prototype.copyTo = function(e) { - F.a.Clone(function() { - return e - }, this) - } - , - e.prototype.serialize = function() { - return F.a.Serialize(this) - } - , - e.prototype.parse = function(e) { - var t = this; - F.a.Parse(function() { - return t - }, e, null) - } - , + e.addUniform("sheenMatrix", 16); + }), + (e.AddSamplers = function (e) { + e.push("sheenSampler"); + }), + (e.prototype.copyTo = function (e) { + F.a.Clone(function () { + return e; + }, this); + }), + (e.prototype.serialize = function () { + return F.a.Serialize(this); + }), + (e.prototype.parse = function (e) { + var t = this; + F.a.Parse( + function () { + return t; + }, + e, + null + ); + }), h.c([Object(F.c)()], e.prototype, "_isEnabled", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isEnabled", void 0), - h.c([Object(F.c)()], e.prototype, "_linkSheenWithAlbedo", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "linkSheenWithAlbedo", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "isEnabled", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "_linkSheenWithAlbedo", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "linkSheenWithAlbedo", + void 0 + ), h.c([Object(F.c)()], e.prototype, "intensity", void 0), h.c([Object(F.e)()], e.prototype, "color", void 0), h.c([Object(F.m)()], e.prototype, "_texture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "texture", void 0), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "texture", + void 0 + ), e - }() - , cr = function() { - function e(e) { - this._isRefractionEnabled = false, - this.isRefractionEnabled = false, - this._isTranslucencyEnabled = false, - this.isTranslucencyEnabled = false, - this._isScatteringEnabled = false, - this.refractionIntensity = 1, - this.translucencyIntensity = 1, - this.scatteringIntensity = 1, - this._thicknessTexture = null, - this.thicknessTexture = null, - this._refractionTexture = null, - this.refractionTexture = null, - this._indexOfRefraction = 1, - this.indexOfRefraction = 1, - this._invertRefractionY = false, - this.invertRefractionY = false, - this._linkRefractionWithTransparency = false, - this.linkRefractionWithTransparency = false, - this.minimumThickness = 0, - this.maximumThickness = 1, - this.tintColor = a.e.White(), - this.tintColorAtDistance = 1, - this.diffusionDistance = a.e.White(), - this._useMaskFromThicknessTexture = false, - this.useMaskFromThicknessTexture = false, - this._internalMarkAllSubMeshesAsTexturesDirty = e - } - return e.prototype._markAllSubMeshesAsTexturesDirty = function() { - this._internalMarkAllSubMeshesAsTexturesDirty() - } - , - e.prototype.isReadyForSubMesh = function(e, t) { - if (e._areTexturesDirty && t.texturesEnabled) { - if (this._thicknessTexture && qn.a.ThicknessTextureEnabled && !this._thicknessTexture.isReadyOrNotBlocking()) - return false; - var i = this._getRefractionTexture(t); - if (i && qn.a.RefractionTextureEnabled && !i.isReadyOrNotBlocking()) - return false - } - return true - } - , - e.prototype.prepareDefines = function(e, t) { - if (e._areTexturesDirty && (e.SUBSURFACE = false, - e.SS_TRANSLUCENCY = this._isTranslucencyEnabled, - e.SS_SCATERRING = this._isScatteringEnabled, - e.SS_THICKNESSANDMASK_TEXTURE = false, - e.SS_MASK_FROM_THICKNESS_TEXTURE = false, - e.SS_REFRACTION = false, - e.SS_REFRACTIONMAP_3D = false, - e.SS_GAMMAREFRACTION = false, - e.SS_RGBDREFRACTION = false, - e.SS_REFRACTIONMAP_OPPOSITEZ = false, - e.SS_LODINREFRACTIONALPHA = false, - e.SS_LINKREFRACTIONTOTRANSPARENCY = false, - (this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled) && (e.SUBSURFACE = true, - e._areTexturesDirty && t.texturesEnabled && this._thicknessTexture && qn.a.ThicknessTextureEnabled && Yn.a.PrepareDefinesForMergedUV(this._thicknessTexture, e, "SS_THICKNESSANDMASK_TEXTURE"), - e.SS_MASK_FROM_THICKNESS_TEXTURE = this._useMaskFromThicknessTexture), - this._isRefractionEnabled && t.texturesEnabled)) { - var i = this._getRefractionTexture(t); - i && qn.a.RefractionTextureEnabled && (e.SS_REFRACTION = true, - e.SS_REFRACTIONMAP_3D = i.isCube, - e.SS_GAMMAREFRACTION = i.gammaSpace, - e.SS_RGBDREFRACTION = i.isRGBD, - e.SS_REFRACTIONMAP_OPPOSITEZ = i.invertZ, - e.SS_LODINREFRACTIONALPHA = i.lodLevelInAlpha, - e.SS_LINKREFRACTIONTOTRANSPARENCY = this._linkRefractionWithTransparency) - } - } - , - e.prototype.bindForSubMesh = function(e, t, i, n, r) { - var o = this._getRefractionTexture(t); - if (!e.useUbo || !n || !e.isSync) { - if (this._thicknessTexture && qn.a.ThicknessTextureEnabled && (e.updateFloat2("vThicknessInfos", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level), - Yn.a.BindTextureMatrix(this._thicknessTexture, e, "thickness")), - e.updateFloat2("vThicknessParam", this.minimumThickness, this.maximumThickness - this.minimumThickness), - o && qn.a.RefractionTextureEnabled) { - e.updateMatrix("refractionMatrix", o.getReflectionTextureMatrix()); - var a = 1; - o.isCube || o.depth && (a = o.depth), - e.updateFloat4("vRefractionInfos", o.level, 1 / this._indexOfRefraction, a, this._invertRefractionY ? -1 : 1), - e.updateFloat3("vRefractionMicrosurfaceInfos", o.getSize().width, o.lodGenerationScale, o.lodGenerationOffset) - } - e.updateColor3("vDiffusionDistance", this.diffusionDistance), - e.updateFloat4("vTintColor", this.tintColor.r, this.tintColor.g, this.tintColor.b, this.tintColorAtDistance), - e.updateFloat3("vSubSurfaceIntensity", this.refractionIntensity, this.translucencyIntensity, this.scatteringIntensity) - } - t.texturesEnabled && (this._thicknessTexture && qn.a.ThicknessTextureEnabled && e.setTexture("thicknessSampler", this._thicknessTexture), - o && qn.a.RefractionTextureEnabled && (r ? e.setTexture("refractionSampler", o) : (e.setTexture("refractionSampler", o._lodTextureMid || o), - e.setTexture("refractionSamplerLow", o._lodTextureLow || o), - e.setTexture("refractionSamplerHigh", o._lodTextureHigh || o)))) - } - , - e.prototype.unbind = function(e) { - return !(!this._refractionTexture || !this._refractionTexture.isRenderTarget || (e.setTexture("refractionSampler", null), - 0)) - } - , - e.prototype._getRefractionTexture = function(e) { - return this._refractionTexture ? this._refractionTexture : this._isRefractionEnabled ? e.environmentTexture : null - } - , - Object.defineProperty(e.prototype, "disableAlphaBlending", { - get: function() { - return this.isRefractionEnabled && this._linkRefractionWithTransparency - }, - enumerable: true, - configurable: true + ); + })(), + cr = (function () { + function e(e) { + (this._isRefractionEnabled = false), + (this.isRefractionEnabled = false), + (this._isTranslucencyEnabled = false), + (this.isTranslucencyEnabled = false), + (this._isScatteringEnabled = false), + (this.refractionIntensity = 1), + (this.translucencyIntensity = 1), + (this.scatteringIntensity = 1), + (this._thicknessTexture = null), + (this.thicknessTexture = null), + (this._refractionTexture = null), + (this.refractionTexture = null), + (this._indexOfRefraction = 1), + (this.indexOfRefraction = 1), + (this._invertRefractionY = false), + (this.invertRefractionY = false), + (this._linkRefractionWithTransparency = false), + (this.linkRefractionWithTransparency = false), + (this.minimumThickness = 0), + (this.maximumThickness = 1), + (this.tintColor = a.e.White()), + (this.tintColorAtDistance = 1), + (this.diffusionDistance = a.e.White()), + (this._useMaskFromThicknessTexture = false), + (this.useMaskFromThicknessTexture = false), + (this._internalMarkAllSubMeshesAsTexturesDirty = e); + } + return ( + (e.prototype._markAllSubMeshesAsTexturesDirty = + function () { + this._internalMarkAllSubMeshesAsTexturesDirty(); + }), + (e.prototype.isReadyForSubMesh = function (e, t) { + if (e._areTexturesDirty && t.texturesEnabled) { + if ( + this._thicknessTexture && + qn.a.ThicknessTextureEnabled && + !this._thicknessTexture.isReadyOrNotBlocking() + ) + return false; + var i = this._getRefractionTexture(t); + if ( + i && + qn.a.RefractionTextureEnabled && + !i.isReadyOrNotBlocking() + ) + return false; + } + return true; }), - e.prototype.fillRenderTargetTextures = function(e) { - qn.a.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget && e.push(this._refractionTexture) - } - , - e.prototype.hasTexture = function(e) { - return this._thicknessTexture === e || this._refractionTexture === e - } - , - e.prototype.hasRenderTargetTextures = function() { - return !!(qn.a.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) - } - , - e.prototype.getActiveTextures = function(e) { - this._thicknessTexture && e.push(this._thicknessTexture), - this._refractionTexture && e.push(this._refractionTexture) - } - , - e.prototype.getAnimatables = function(e) { - this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0 && e.push(this._thicknessTexture), - this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0 && e.push(this._refractionTexture) - } - , - e.prototype.dispose = function(e) { - e && (this._thicknessTexture && this._thicknessTexture.dispose(), - this._refractionTexture && this._refractionTexture.dispose()) - } - , - e.prototype.getClassName = function() { - return "PBRSubSurfaceConfiguration" - } - , - e.AddFallbacks = function(e, t, i) { - return e.SS_SCATERRING && t.addFallback(i++, "SS_SCATERRING"), - e.SS_TRANSLUCENCY && t.addFallback(i++, "SS_TRANSLUCENCY"), + (e.prototype.prepareDefines = function (e, t) { + if ( + e._areTexturesDirty && + ((e.SUBSURFACE = false), + (e.SS_TRANSLUCENCY = this._isTranslucencyEnabled), + (e.SS_SCATERRING = this._isScatteringEnabled), + (e.SS_THICKNESSANDMASK_TEXTURE = false), + (e.SS_MASK_FROM_THICKNESS_TEXTURE = false), + (e.SS_REFRACTION = false), + (e.SS_REFRACTIONMAP_3D = false), + (e.SS_GAMMAREFRACTION = false), + (e.SS_RGBDREFRACTION = false), + (e.SS_REFRACTIONMAP_OPPOSITEZ = false), + (e.SS_LODINREFRACTIONALPHA = false), + (e.SS_LINKREFRACTIONTOTRANSPARENCY = false), + (this._isRefractionEnabled || + this._isTranslucencyEnabled || + this._isScatteringEnabled) && + ((e.SUBSURFACE = true), + e._areTexturesDirty && + t.texturesEnabled && + this._thicknessTexture && + qn.a.ThicknessTextureEnabled && + Yn.a.PrepareDefinesForMergedUV( + this._thicknessTexture, + e, + "SS_THICKNESSANDMASK_TEXTURE" + ), + (e.SS_MASK_FROM_THICKNESS_TEXTURE = + this._useMaskFromThicknessTexture)), + this._isRefractionEnabled && t.texturesEnabled) + ) { + var i = this._getRefractionTexture(t); + i && + qn.a.RefractionTextureEnabled && + ((e.SS_REFRACTION = true), + (e.SS_REFRACTIONMAP_3D = i.isCube), + (e.SS_GAMMAREFRACTION = i.gammaSpace), + (e.SS_RGBDREFRACTION = i.isRGBD), + (e.SS_REFRACTIONMAP_OPPOSITEZ = i.invertZ), + (e.SS_LODINREFRACTIONALPHA = i.lodLevelInAlpha), + (e.SS_LINKREFRACTIONTOTRANSPARENCY = + this._linkRefractionWithTransparency)); + } + }), + (e.prototype.bindForSubMesh = function (e, t, i, n, r) { + var o = this._getRefractionTexture(t); + if (!e.useUbo || !n || !e.isSync) { + if ( + (this._thicknessTexture && + qn.a.ThicknessTextureEnabled && + (e.updateFloat2( + "vThicknessInfos", + this._thicknessTexture.coordinatesIndex, + this._thicknessTexture.level + ), + Yn.a.BindTextureMatrix( + this._thicknessTexture, + e, + "thickness" + )), + e.updateFloat2( + "vThicknessParam", + this.minimumThickness, + this.maximumThickness - this.minimumThickness + ), + o && qn.a.RefractionTextureEnabled) + ) { + e.updateMatrix( + "refractionMatrix", + o.getReflectionTextureMatrix() + ); + var a = 1; + o.isCube || (o.depth && (a = o.depth)), + e.updateFloat4( + "vRefractionInfos", + o.level, + 1 / this._indexOfRefraction, + a, + this._invertRefractionY ? -1 : 1 + ), + e.updateFloat3( + "vRefractionMicrosurfaceInfos", + o.getSize().width, + o.lodGenerationScale, + o.lodGenerationOffset + ); + } + e.updateColor3( + "vDiffusionDistance", + this.diffusionDistance + ), + e.updateFloat4( + "vTintColor", + this.tintColor.r, + this.tintColor.g, + this.tintColor.b, + this.tintColorAtDistance + ), + e.updateFloat3( + "vSubSurfaceIntensity", + this.refractionIntensity, + this.translucencyIntensity, + this.scatteringIntensity + ); + } + t.texturesEnabled && + (this._thicknessTexture && + qn.a.ThicknessTextureEnabled && + e.setTexture( + "thicknessSampler", + this._thicknessTexture + ), + o && + qn.a.RefractionTextureEnabled && + (r + ? e.setTexture("refractionSampler", o) + : (e.setTexture( + "refractionSampler", + o._lodTextureMid || o + ), + e.setTexture( + "refractionSamplerLow", + o._lodTextureLow || o + ), + e.setTexture( + "refractionSamplerHigh", + o._lodTextureHigh || o + )))); + }), + (e.prototype.unbind = function (e) { + return !( + !this._refractionTexture || + !this._refractionTexture.isRenderTarget || + (e.setTexture("refractionSampler", null), 0) + ); + }), + (e.prototype._getRefractionTexture = function (e) { + return this._refractionTexture + ? this._refractionTexture + : this._isRefractionEnabled + ? e.environmentTexture + : null; + }), + Object.defineProperty(e.prototype, "disableAlphaBlending", { + get: function () { + return ( + this.isRefractionEnabled && + this._linkRefractionWithTransparency + ); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.fillRenderTargetTextures = function (e) { + qn.a.RefractionTextureEnabled && + this._refractionTexture && + this._refractionTexture.isRenderTarget && + e.push(this._refractionTexture); + }), + (e.prototype.hasTexture = function (e) { + return ( + this._thicknessTexture === e || + this._refractionTexture === e + ); + }), + (e.prototype.hasRenderTargetTextures = function () { + return !!( + qn.a.RefractionTextureEnabled && + this._refractionTexture && + this._refractionTexture.isRenderTarget + ); + }), + (e.prototype.getActiveTextures = function (e) { + this._thicknessTexture && e.push(this._thicknessTexture), + this._refractionTexture && + e.push(this._refractionTexture); + }), + (e.prototype.getAnimatables = function (e) { + this._thicknessTexture && + this._thicknessTexture.animations && + this._thicknessTexture.animations.length > 0 && + e.push(this._thicknessTexture), + this._refractionTexture && + this._refractionTexture.animations && + this._refractionTexture.animations.length > 0 && + e.push(this._refractionTexture); + }), + (e.prototype.dispose = function (e) { + e && + (this._thicknessTexture && + this._thicknessTexture.dispose(), + this._refractionTexture && + this._refractionTexture.dispose()); + }), + (e.prototype.getClassName = function () { + return "PBRSubSurfaceConfiguration"; + }), + (e.AddFallbacks = function (e, t, i) { + return ( + e.SS_SCATERRING && t.addFallback(i++, "SS_SCATERRING"), + e.SS_TRANSLUCENCY && + t.addFallback(i++, "SS_TRANSLUCENCY"), i - } - , - e.AddUniforms = function(e) { - e.push("vDiffusionDistance", "vTintColor", "vSubSurfaceIntensity", "vRefractionMicrosurfaceInfos", "vRefractionInfos", "vThicknessInfos", "vThicknessParam", "refractionMatrix", "thicknessMatrix") - } - , - e.AddSamplers = function(e) { - e.push("thicknessSampler", "refractionSampler", "refractionSamplerLow", "refractionSamplerHigh") - } - , - e.PrepareUniformBuffer = function(e) { - e.addUniform("vRefractionMicrosurfaceInfos", 3), + ); + }), + (e.AddUniforms = function (e) { + e.push( + "vDiffusionDistance", + "vTintColor", + "vSubSurfaceIntensity", + "vRefractionMicrosurfaceInfos", + "vRefractionInfos", + "vThicknessInfos", + "vThicknessParam", + "refractionMatrix", + "thicknessMatrix" + ); + }), + (e.AddSamplers = function (e) { + e.push( + "thicknessSampler", + "refractionSampler", + "refractionSamplerLow", + "refractionSamplerHigh" + ); + }), + (e.PrepareUniformBuffer = function (e) { + e.addUniform("vRefractionMicrosurfaceInfos", 3), e.addUniform("vRefractionInfos", 4), e.addUniform("refractionMatrix", 16), e.addUniform("vThicknessInfos", 2), @@ -71224,490 +95510,787 @@ and limitations under the License. e.addUniform("vThicknessParam", 2), e.addUniform("vDiffusionDistance", 3), e.addUniform("vTintColor", 4), - e.addUniform("vSubSurfaceIntensity", 3) - } - , - e.prototype.copyTo = function(e) { - F.a.Clone(function() { - return e - }, this) - } - , - e.prototype.serialize = function() { - return F.a.Serialize(this) - } - , - e.prototype.parse = function(e) { - var t = this; - F.a.Parse(function() { - return t - }, e, null) - } - , - h.c([Object(F.c)()], e.prototype, "_isRefractionEnabled", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isRefractionEnabled", void 0), - h.c([Object(F.c)()], e.prototype, "_isTranslucencyEnabled", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isTranslucencyEnabled", void 0), - h.c([Object(F.c)()], e.prototype, "_isScatteringEnabled", void 0), - h.c([Object(F.c)()], e.prototype, "refractionIntensity", void 0), - h.c([Object(F.c)()], e.prototype, "translucencyIntensity", void 0), - h.c([Object(F.c)()], e.prototype, "scatteringIntensity", void 0), - h.c([Object(F.m)()], e.prototype, "_thicknessTexture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "thicknessTexture", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "refractionTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "indexOfRefraction", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "invertRefractionY", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "linkRefractionWithTransparency", void 0), - h.c([Object(F.c)()], e.prototype, "minimumThickness", void 0), - h.c([Object(F.c)()], e.prototype, "maximumThickness", void 0), + e.addUniform("vSubSurfaceIntensity", 3); + }), + (e.prototype.copyTo = function (e) { + F.a.Clone(function () { + return e; + }, this); + }), + (e.prototype.serialize = function () { + return F.a.Serialize(this); + }), + (e.prototype.parse = function (e) { + var t = this; + F.a.Parse( + function () { + return t; + }, + e, + null + ); + }), + h.c( + [Object(F.c)()], + e.prototype, + "_isRefractionEnabled", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "isRefractionEnabled", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "_isTranslucencyEnabled", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "isTranslucencyEnabled", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "_isScatteringEnabled", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "refractionIntensity", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "translucencyIntensity", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "scatteringIntensity", + void 0 + ), + h.c( + [Object(F.m)()], + e.prototype, + "_thicknessTexture", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "thicknessTexture", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + e.prototype, + "refractionTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + e.prototype, + "indexOfRefraction", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + e.prototype, + "invertRefractionY", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + e.prototype, + "linkRefractionWithTransparency", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "minimumThickness", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "maximumThickness", + void 0 + ), h.c([Object(F.e)()], e.prototype, "tintColor", void 0), - h.c([Object(F.c)()], e.prototype, "tintColorAtDistance", void 0), - h.c([Object(F.e)()], e.prototype, "diffusionDistance", void 0), - h.c([Object(F.c)()], e.prototype, "_useMaskFromThicknessTexture", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "useMaskFromThicknessTexture", void 0), + h.c( + [Object(F.c)()], + e.prototype, + "tintColorAtDistance", + void 0 + ), + h.c( + [Object(F.e)()], + e.prototype, + "diffusionDistance", + void 0 + ), + h.c( + [Object(F.c)()], + e.prototype, + "_useMaskFromThicknessTexture", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsTexturesDirty")], + e.prototype, + "useMaskFromThicknessTexture", + void 0 + ), e - }(); - Ht.a.IncludesShadersStore.pbrFragmentDeclaration = "uniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\n\nuniform vec4 vLightingIntensity;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION)\nuniform mat4 view;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n\n#ifdef CLEARCOAT\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\n#ifdef CLEARCOAT_TEXTURE\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#endif\n\n#ifdef ANISOTROPIC\nuniform vec3 vAnisotropy;\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n\n#ifdef SHEEN\nuniform vec4 vSheenColor;\n#ifdef SHEEN_TEXTURE\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\n#endif\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;;\n#endif\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n#endif"; - Ht.a.IncludesShadersStore.pbrUboDeclaration = "layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec2 vAlbedoInfos;\nuniform vec4 vAmbientInfos;\nuniform vec2 vOpacityInfos;\nuniform vec2 vEmissiveInfos;\nuniform vec2 vLightmapInfos;\nuniform vec3 vReflectivityInfos;\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform vec2 vReflectionInfos;\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\nuniform vec3 vBumpInfos;\nuniform mat4 albedoMatrix;\nuniform mat4 ambientMatrix;\nuniform mat4 opacityMatrix;\nuniform mat4 emissiveMatrix;\nuniform mat4 lightmapMatrix;\nuniform mat4 reflectivityMatrix;\nuniform mat4 microSurfaceSamplerMatrix;\nuniform mat4 bumpMatrix;\nuniform vec2 vTangentSpaceParams;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\nuniform vec4 vLightingIntensity;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float pointSize;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\nuniform vec3 vAnisotropy;\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\nuniform vec4 vSheenColor;\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};"; - Ht.a.IncludesShadersStore.pbrFragmentExtraDeclaration = "uniform vec4 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec4 vCameraInfos;\n\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif"; - Ht.a.IncludesShadersStore.pbrFragmentSamplersDeclaration = "#ifdef ALBEDO\n#if ALBEDODIRECTUV == 1\n#define vAlbedoUV vMainUV1\n#elif ALBEDODIRECTUV == 2\n#define vAlbedoUV vMainUV2\n#else\nvarying vec2 vAlbedoUV;\n#endif\nuniform sampler2D albedoSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFLECTIVITY\n#if REFLECTIVITYDIRECTUV == 1\n#define vReflectivityUV vMainUV1\n#elif REFLECTIVITYDIRECTUV == 2\n#define vReflectivityUV vMainUV2\n#else\nvarying vec2 vReflectivityUV;\n#endif\nuniform sampler2D reflectivitySampler;\n#endif\n#ifdef MICROSURFACEMAP\n#if MICROSURFACEMAPDIRECTUV == 1\n#define vMicroSurfaceSamplerUV vMainUV1\n#elif MICROSURFACEMAPDIRECTUV == 2\n#define vMicroSurfaceSamplerUV vMainUV2\n#else\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\nuniform sampler2D microSurfaceSampler;\n#endif\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\n#if CLEARCOAT_TEXTUREDIRECTUV == 1\n#define vClearCoatUV vMainUV1\n#elif CLEARCOAT_TEXTUREDIRECTUV == 2\n#define vClearCoatUV vMainUV2\n#else\nvarying vec2 vClearCoatUV;\n#endif\nuniform sampler2D clearCoatSampler;\n#endif\n#ifdef CLEARCOAT_BUMP\n#if CLEARCOAT_BUMPDIRECTUV == 1\n#define vClearCoatBumpUV vMainUV1\n#elif CLEARCOAT_BUMPDIRECTUV == 2\n#define vClearCoatBumpUV vMainUV2\n#else\nvarying vec2 vClearCoatBumpUV;\n#endif\nuniform sampler2D clearCoatBumpSampler;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\n#if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1\n#define vClearCoatTintUV vMainUV1\n#elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2\n#define vClearCoatTintUV vMainUV2\n#else\nvarying vec2 vClearCoatTintUV;\n#endif\nuniform sampler2D clearCoatTintSampler;\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_TEXTURE\n#if SHEEN_TEXTUREDIRECTUV == 1\n#define vSheenUV vMainUV1\n#elif SHEEN_TEXTUREDIRECTUV == 2\n#define vSheenUV vMainUV2\n#else\nvarying vec2 vSheenUV;\n#endif\nuniform sampler2D sheenSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\n#if ANISOTROPIC_TEXTUREDIRECTUV == 1\n#define vAnisotropyUV vMainUV1\n#elif ANISOTROPIC_TEXTUREDIRECTUV == 2\n#define vAnisotropyUV vMainUV2\n#else\nvarying vec2 vAnisotropyUV;\n#endif\nuniform sampler2D anisotropySampler;\n#endif\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#endif\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 1\n#define vThicknessUV vMainUV1\n#elif SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 2\n#define vThicknessUV vMainUV2\n#else\nvarying vec2 vThicknessUV;\n#endif\nuniform sampler2D thicknessSampler;\n#endif\n#endif", + ); + })(); + Ht.a.IncludesShadersStore.pbrFragmentDeclaration = + "uniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\n\nuniform vec4 vLightingIntensity;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION)\nuniform mat4 view;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n\n#ifdef CLEARCOAT\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\n#ifdef CLEARCOAT_TEXTURE\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#endif\n\n#ifdef ANISOTROPIC\nuniform vec3 vAnisotropy;\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n\n#ifdef SHEEN\nuniform vec4 vSheenColor;\n#ifdef SHEEN_TEXTURE\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\n#endif\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;;\n#endif\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n#endif"; + Ht.a.IncludesShadersStore.pbrUboDeclaration = + "layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec2 vAlbedoInfos;\nuniform vec4 vAmbientInfos;\nuniform vec2 vOpacityInfos;\nuniform vec2 vEmissiveInfos;\nuniform vec2 vLightmapInfos;\nuniform vec3 vReflectivityInfos;\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform vec2 vReflectionInfos;\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\nuniform vec3 vBumpInfos;\nuniform mat4 albedoMatrix;\nuniform mat4 ambientMatrix;\nuniform mat4 opacityMatrix;\nuniform mat4 emissiveMatrix;\nuniform mat4 lightmapMatrix;\nuniform mat4 reflectivityMatrix;\nuniform mat4 microSurfaceSamplerMatrix;\nuniform mat4 bumpMatrix;\nuniform vec2 vTangentSpaceParams;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\nuniform vec4 vLightingIntensity;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float pointSize;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\nuniform vec3 vAnisotropy;\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\nuniform vec4 vSheenColor;\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};"; + Ht.a.IncludesShadersStore.pbrFragmentExtraDeclaration = + "uniform vec4 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec4 vCameraInfos;\n\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif"; + (Ht.a.IncludesShadersStore.pbrFragmentSamplersDeclaration = + "#ifdef ALBEDO\n#if ALBEDODIRECTUV == 1\n#define vAlbedoUV vMainUV1\n#elif ALBEDODIRECTUV == 2\n#define vAlbedoUV vMainUV2\n#else\nvarying vec2 vAlbedoUV;\n#endif\nuniform sampler2D albedoSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFLECTIVITY\n#if REFLECTIVITYDIRECTUV == 1\n#define vReflectivityUV vMainUV1\n#elif REFLECTIVITYDIRECTUV == 2\n#define vReflectivityUV vMainUV2\n#else\nvarying vec2 vReflectivityUV;\n#endif\nuniform sampler2D reflectivitySampler;\n#endif\n#ifdef MICROSURFACEMAP\n#if MICROSURFACEMAPDIRECTUV == 1\n#define vMicroSurfaceSamplerUV vMainUV1\n#elif MICROSURFACEMAPDIRECTUV == 2\n#define vMicroSurfaceSamplerUV vMainUV2\n#else\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\nuniform sampler2D microSurfaceSampler;\n#endif\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\n#if CLEARCOAT_TEXTUREDIRECTUV == 1\n#define vClearCoatUV vMainUV1\n#elif CLEARCOAT_TEXTUREDIRECTUV == 2\n#define vClearCoatUV vMainUV2\n#else\nvarying vec2 vClearCoatUV;\n#endif\nuniform sampler2D clearCoatSampler;\n#endif\n#ifdef CLEARCOAT_BUMP\n#if CLEARCOAT_BUMPDIRECTUV == 1\n#define vClearCoatBumpUV vMainUV1\n#elif CLEARCOAT_BUMPDIRECTUV == 2\n#define vClearCoatBumpUV vMainUV2\n#else\nvarying vec2 vClearCoatBumpUV;\n#endif\nuniform sampler2D clearCoatBumpSampler;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\n#if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1\n#define vClearCoatTintUV vMainUV1\n#elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2\n#define vClearCoatTintUV vMainUV2\n#else\nvarying vec2 vClearCoatTintUV;\n#endif\nuniform sampler2D clearCoatTintSampler;\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_TEXTURE\n#if SHEEN_TEXTUREDIRECTUV == 1\n#define vSheenUV vMainUV1\n#elif SHEEN_TEXTUREDIRECTUV == 2\n#define vSheenUV vMainUV2\n#else\nvarying vec2 vSheenUV;\n#endif\nuniform sampler2D sheenSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\n#if ANISOTROPIC_TEXTUREDIRECTUV == 1\n#define vAnisotropyUV vMainUV1\n#elif ANISOTROPIC_TEXTUREDIRECTUV == 2\n#define vAnisotropyUV vMainUV2\n#else\nvarying vec2 vAnisotropyUV;\n#endif\nuniform sampler2D anisotropySampler;\n#endif\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#endif\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 1\n#define vThicknessUV vMainUV1\n#elif SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 2\n#define vThicknessUV vMainUV2\n#else\nvarying vec2 vThicknessUV;\n#endif\nuniform sampler2D thicknessSampler;\n#endif\n#endif"), n(88); - Ht.a.IncludesShadersStore.pbrHelperFunctions = "\n#define RECIPROCAL_PI2 0.15915494\n#define RECIPROCAL_PI 0.31830988618\n\n#define MINIMUMVARIANCE 0.0005\nfloat convertRoughnessToAverageSlope(float roughness)\n{\n\nreturn square(roughness)+MINIMUMVARIANCE;\n}\nfloat fresnelGrazingReflectance(float reflectance0) {\n\n\nfloat reflectance90=saturate(reflectance0*25.0);\nreturn reflectance90;\n}\nvec2 getAARoughnessFactors(vec3 normalVector) {\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalVector.xyz);\nvec3 nDfdy=dFdy(normalVector.xyz);\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\n\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\n\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\n\ngeometricAlphaGFactor*=0.75;\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2(0.);\n#endif\n}\n#ifdef ANISOTROPIC\n\n\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\nreturn vec2(alphaT,alphaB);\n}\n\n\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\nreturn anisotropicNormal;\n\n}\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\n\n\n\nvec3 cocaLambert(vec3 alpha,float distance) {\nreturn exp(-alpha*distance);\n}\n\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\n}\n\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\nreturn -log(color)/distance;\n}\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 clearCoatAbsorption=mix(vec3(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);\nreturn clearCoatAbsorption;\n}\n#endif\n\n\n\n\n#ifdef MICROSURFACEAUTOMATIC\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\n#endif"; - Ht.a.IncludesShadersStore.harmonicsFunctions = "#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;\nuniform vec3 vSphericalL1_1;\nuniform vec3 vSphericalL10;\nuniform vec3 vSphericalL11;\nuniform vec3 vSphericalL2_2;\nuniform vec3 vSphericalL2_1;\nuniform vec3 vSphericalL20;\nuniform vec3 vSphericalL21;\nuniform vec3 vSphericalL22;\n\n\n\n\n\n\n\nvec3 computeEnvironmentIrradiance(vec3 normal) {\nreturn vSphericalL00\n+vSphericalL1_1*(normal.y)\n+vSphericalL10*(normal.z)\n+vSphericalL11*(normal.x)\n+vSphericalL2_2*(normal.y*normal.x)\n+vSphericalL2_1*(normal.y*normal.z)\n+vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+vSphericalL21*(normal.z*normal.x)\n+vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\n}\n#else\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\n\nvec3 computeEnvironmentIrradiance(vec3 normal) {\n\n\n\n\n\n\n\n\n\nfloat Nx=normal.x;\nfloat Ny=normal.y;\nfloat Nz=normal.z;\nvec3 C1=vSphericalZZ.rgb;\nvec3 Cx=vSphericalX.rgb;\nvec3 Cy=vSphericalY.rgb;\nvec3 Cz=vSphericalZ.rgb;\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\nvec3 Cxy=vSphericalXY.rgb;\nvec3 Cyz=vSphericalYZ.rgb;\nvec3 Czx=vSphericalZX.rgb;\nvec3 a1=Cyy_zz*Ny+Cy;\nvec3 a2=Cyz*Nz+a1;\nvec3 b1=Czx*Nz+Cx;\nvec3 b2=Cxy*Ny+b1;\nvec3 b3=Cxx_zz*Nx+b2;\nvec3 t1=Cz*Nz+C1;\nvec3 t2=a2*Ny+t1;\nvec3 t3=b3*Nx+t2;\nreturn t3;\n}\n#endif\n#endif"; - Ht.a.IncludesShadersStore.pbrDirectLightingSetupFunctions = "\nstruct preLightingInfo\n{\n\nvec3 lightOffset;\nfloat lightDistanceSquared;\nfloat lightDistance;\n\nfloat attenuation;\n\nvec3 L;\nvec3 H;\nfloat NdotV;\nfloat NdotLUnclamped;\nfloat NdotL;\nfloat VdotH;\nfloat roughness;\n};\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\nresult.lightOffset=lightData.xyz-vPositionW;\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\n\nresult.lightDistance=sqrt(result.lightDistanceSquared);\n\nresult.L=normalize(result.lightOffset);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\nresult.lightDistance=length(-lightData.xyz);\n\nresult.L=normalize(-lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\n\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\nresult.NdotL=saturateEps(result.NdotL);\nresult.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\n#endif\nreturn result;\n}"; - Ht.a.IncludesShadersStore.pbrDirectLightingFalloffFunctions = "float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{\nreturn max(0.,1.0-length(lightOffset)/range);\n}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{\nreturn 1.0/maxEps(lightDistanceSquared);\n}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\nfloat factor=lightDistanceSquared*inverseSquaredRange;\nfloat attenuation=saturate(1.0-factor*factor);\nattenuation*=attenuation;\n\nlightDistanceFalloff*=attenuation;\nreturn lightDistanceFalloff;\n}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{\nfloat falloff=0.0;\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=cosHalfAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977;\n\n\n\n\n\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\n\n\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{\n\n\n\nfloat cd=dot(-lightDirection,directionToLightCenterW);\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\n\nfalloff*=falloff;\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}"; - Ht.a.IncludesShadersStore.pbrBRDFFunctions = "\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\n\n\n\n#ifdef MS_BRDF_ENERGY_CONSERVATION\n\n\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\n}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness,sampler2D brdfSampler) {\n\nvec2 UV=vec2(NdotV,perceptualRoughness);\n\nvec4 brdfLookup=texture2D(brdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;\n}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;\n}\n#endif\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\n#if defined(SHEEN) && defined(REFLECTION)\n\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\nreturn sheenEnvironmentReflectance;\n}\n#endif\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\n#ifdef CLEARCOAT\n\n\n\n\n\nvec3 getR0RemappedForClearCoat(vec3 f0) {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvec3 s=sqrt(f0);\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\nreturn t*t;\n#endif\n}\n#endif\n\n\n\n\n\n\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\n\n\n\nfloat a2=square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(PI*d*d);\n}\n#ifdef SHEEN\n\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\n{\nfloat invR=1./alphaG;\nfloat cos2h=NdotH*NdotH;\nfloat sin2h=1.-cos2h;\nreturn (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {\nfloat a2=alphaTB.x*alphaTB.y;\nvec3 v=vec3(alphaTB.y*TdotH,alphaTB.x*BdotH,a2*NdotH);\nfloat v2=dot(v,v);\nfloat w2=a2/v2;\nreturn a2*w2*w2*RECIPROCAL_PI;\n}\n#endif\n\n\n\n\n#ifdef BRDF_V_HEIGHT_CORRELATED\n\n\n\nfloat smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {\n#ifdef MOBILE\n\nfloat GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);\nfloat GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);\nreturn 0.5/(GGXV+GGXL);\n#else\nfloat a2=alphaG*alphaG;\nfloat GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);\nfloat GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);\nreturn 0.5/(GGXV+GGXL);\n#endif\n}\n#else\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfloat smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)\n{\n#ifdef MOBILE\n\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\n#else\nfloat alphaSquared=alphaG*alphaG;\nreturn 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\n#endif\n}\nfloat smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)\n{\nfloat visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);\n\nreturn visibility;\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {\nfloat lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));\nfloat lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));\nfloat v=0.5/(lambdaV+lambdaL);\nreturn v;\n}\n#endif\n#ifdef CLEARCOAT\nfloat visibility_Kelemen(float VdotH) {\n\n\n\nreturn 0.25/(VdotH*VdotH);\n}\n#endif\n#ifdef SHEEN\n\n\n\nfloat visibility_Ashikhmin(float NdotL,float NdotV)\n{\nreturn 1./(4.*(NdotL+NdotV-NdotL*NdotV));\n}\n#endif\n\n\n\n\n\n\n\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\n\n\nfloat diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));\nfloat diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat fresnel =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn fresnel/PI;\n}\n#ifdef SS_TRANSLUCENCY\n\n\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {\nvec3 S=1./maxEps(diffusionDistance);\nvec3 temp=exp((-0.333333333*thickness)*S);\nreturn tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);\n}\n\n\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {\nfloat t=1.0+w;\nfloat invt2=1.0/square(t);\nreturn saturate((NdotL+w)*invt2);\n}\n#endif\n"; - Ht.a.IncludesShadersStore.pbrDirectLightingFunctions = "#define CLEARCOATREFLECTANCE90 1.0\n\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef CLEARCOAT\n\n\nvec4 clearCoat;\n#endif\n#ifdef SHEEN\nvec3 sheen;\n#endif\n};\n\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\n\nfloat lightRoughness=lightRadius/lightDistance;\n\nfloat totalRoughness=saturate(lightRoughness+roughness);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\nreturn mix(groundColor,lightColor,info.NdotL);\n}\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\n}\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn toLinearSpace(textureColor);\n}\n#ifdef SS_TRANSLUCENCY\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\nfloat NdotL=absEps(info.NdotLUnclamped);\n\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\n\nfloat trAdapt=step(0.,info.NdotLUnclamped);\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\n}\n#endif\n#ifdef SPECULARTERM\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat visibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat visibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*visibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef ANISOTROPIC\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat TdotH=dot(T,info.H);\nfloat BdotH=dot(B,info.H);\nfloat TdotV=dot(T,V);\nfloat BdotV=dot(B,V);\nfloat TdotL=dot(T,info.L);\nfloat BdotL=dot(B,info.L);\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\nfloat visibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\nvec3 specTerm=fresnel*distribution*visibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef CLEARCOAT\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnel*=clearCoatIntensity;\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\nfloat visibility=visibility_Kelemen(info.VdotH);\nfloat clearCoatTerm=fresnel*distribution*visibility;\nreturn vec4(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);\n}\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\nreturn absorption;\n}\n#endif\n#ifdef SHEEN\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\n\n\nvec3 fresnel=reflectance0;\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\nvec3 sheenTerm=fresnel*distribution*visibility;\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n"; - Ht.a.IncludesShadersStore.pbrIBLFunctions = "#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\nfloat microsurfaceAverageSlopeTexels=microsurfaceAverageSlope*cubeMapDimensionPixels;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\nreturn lod;\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\n\n\nfloat temp=NdotVUnclamped+ambientOcclusion;\nreturn saturate(square(temp)-1.0+ambientOcclusion);\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal) {\n\nvec3 reflection=reflect(view,normal);\nfloat temp=saturate(1.0+1.1*dot(reflection,normal));\nreturn square(temp);\n}\n#endif\n\n\n\n\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\n\n\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\nfloat microsurfaceAverageSlope=alphaG;\n\n\n\n\n\n\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\n}\n#endif", + Ht.a.IncludesShadersStore.pbrHelperFunctions = + "\n#define RECIPROCAL_PI2 0.15915494\n#define RECIPROCAL_PI 0.31830988618\n\n#define MINIMUMVARIANCE 0.0005\nfloat convertRoughnessToAverageSlope(float roughness)\n{\n\nreturn square(roughness)+MINIMUMVARIANCE;\n}\nfloat fresnelGrazingReflectance(float reflectance0) {\n\n\nfloat reflectance90=saturate(reflectance0*25.0);\nreturn reflectance90;\n}\nvec2 getAARoughnessFactors(vec3 normalVector) {\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalVector.xyz);\nvec3 nDfdy=dFdy(normalVector.xyz);\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\n\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\n\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\n\ngeometricAlphaGFactor*=0.75;\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2(0.);\n#endif\n}\n#ifdef ANISOTROPIC\n\n\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\nreturn vec2(alphaT,alphaB);\n}\n\n\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\nreturn anisotropicNormal;\n\n}\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\n\n\n\nvec3 cocaLambert(vec3 alpha,float distance) {\nreturn exp(-alpha*distance);\n}\n\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\n}\n\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\nreturn -log(color)/distance;\n}\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 clearCoatAbsorption=mix(vec3(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);\nreturn clearCoatAbsorption;\n}\n#endif\n\n\n\n\n#ifdef MICROSURFACEAUTOMATIC\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\n#endif"; + Ht.a.IncludesShadersStore.harmonicsFunctions = + "#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;\nuniform vec3 vSphericalL1_1;\nuniform vec3 vSphericalL10;\nuniform vec3 vSphericalL11;\nuniform vec3 vSphericalL2_2;\nuniform vec3 vSphericalL2_1;\nuniform vec3 vSphericalL20;\nuniform vec3 vSphericalL21;\nuniform vec3 vSphericalL22;\n\n\n\n\n\n\n\nvec3 computeEnvironmentIrradiance(vec3 normal) {\nreturn vSphericalL00\n+vSphericalL1_1*(normal.y)\n+vSphericalL10*(normal.z)\n+vSphericalL11*(normal.x)\n+vSphericalL2_2*(normal.y*normal.x)\n+vSphericalL2_1*(normal.y*normal.z)\n+vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+vSphericalL21*(normal.z*normal.x)\n+vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\n}\n#else\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\n\nvec3 computeEnvironmentIrradiance(vec3 normal) {\n\n\n\n\n\n\n\n\n\nfloat Nx=normal.x;\nfloat Ny=normal.y;\nfloat Nz=normal.z;\nvec3 C1=vSphericalZZ.rgb;\nvec3 Cx=vSphericalX.rgb;\nvec3 Cy=vSphericalY.rgb;\nvec3 Cz=vSphericalZ.rgb;\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\nvec3 Cxy=vSphericalXY.rgb;\nvec3 Cyz=vSphericalYZ.rgb;\nvec3 Czx=vSphericalZX.rgb;\nvec3 a1=Cyy_zz*Ny+Cy;\nvec3 a2=Cyz*Nz+a1;\nvec3 b1=Czx*Nz+Cx;\nvec3 b2=Cxy*Ny+b1;\nvec3 b3=Cxx_zz*Nx+b2;\nvec3 t1=Cz*Nz+C1;\nvec3 t2=a2*Ny+t1;\nvec3 t3=b3*Nx+t2;\nreturn t3;\n}\n#endif\n#endif"; + Ht.a.IncludesShadersStore.pbrDirectLightingSetupFunctions = + "\nstruct preLightingInfo\n{\n\nvec3 lightOffset;\nfloat lightDistanceSquared;\nfloat lightDistance;\n\nfloat attenuation;\n\nvec3 L;\nvec3 H;\nfloat NdotV;\nfloat NdotLUnclamped;\nfloat NdotL;\nfloat VdotH;\nfloat roughness;\n};\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\nresult.lightOffset=lightData.xyz-vPositionW;\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\n\nresult.lightDistance=sqrt(result.lightDistanceSquared);\n\nresult.L=normalize(result.lightOffset);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\nresult.lightDistance=length(-lightData.xyz);\n\nresult.L=normalize(-lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\n\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\nresult.NdotL=saturateEps(result.NdotL);\nresult.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\n#endif\nreturn result;\n}"; + Ht.a.IncludesShadersStore.pbrDirectLightingFalloffFunctions = + "float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{\nreturn max(0.,1.0-length(lightOffset)/range);\n}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{\nreturn 1.0/maxEps(lightDistanceSquared);\n}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\nfloat factor=lightDistanceSquared*inverseSquaredRange;\nfloat attenuation=saturate(1.0-factor*factor);\nattenuation*=attenuation;\n\nlightDistanceFalloff*=attenuation;\nreturn lightDistanceFalloff;\n}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{\nfloat falloff=0.0;\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=cosHalfAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977;\n\n\n\n\n\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\n\n\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{\n\n\n\nfloat cd=dot(-lightDirection,directionToLightCenterW);\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\n\nfalloff*=falloff;\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}"; + Ht.a.IncludesShadersStore.pbrBRDFFunctions = + "\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\n\n\n\n#ifdef MS_BRDF_ENERGY_CONSERVATION\n\n\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\n}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness,sampler2D brdfSampler) {\n\nvec2 UV=vec2(NdotV,perceptualRoughness);\n\nvec4 brdfLookup=texture2D(brdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;\n}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;\n}\n#endif\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\n#if defined(SHEEN) && defined(REFLECTION)\n\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\nreturn sheenEnvironmentReflectance;\n}\n#endif\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\n#ifdef CLEARCOAT\n\n\n\n\n\nvec3 getR0RemappedForClearCoat(vec3 f0) {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvec3 s=sqrt(f0);\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\nreturn t*t;\n#endif\n}\n#endif\n\n\n\n\n\n\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\n\n\n\nfloat a2=square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(PI*d*d);\n}\n#ifdef SHEEN\n\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\n{\nfloat invR=1./alphaG;\nfloat cos2h=NdotH*NdotH;\nfloat sin2h=1.-cos2h;\nreturn (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {\nfloat a2=alphaTB.x*alphaTB.y;\nvec3 v=vec3(alphaTB.y*TdotH,alphaTB.x*BdotH,a2*NdotH);\nfloat v2=dot(v,v);\nfloat w2=a2/v2;\nreturn a2*w2*w2*RECIPROCAL_PI;\n}\n#endif\n\n\n\n\n#ifdef BRDF_V_HEIGHT_CORRELATED\n\n\n\nfloat smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {\n#ifdef MOBILE\n\nfloat GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);\nfloat GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);\nreturn 0.5/(GGXV+GGXL);\n#else\nfloat a2=alphaG*alphaG;\nfloat GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);\nfloat GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);\nreturn 0.5/(GGXV+GGXL);\n#endif\n}\n#else\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfloat smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)\n{\n#ifdef MOBILE\n\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\n#else\nfloat alphaSquared=alphaG*alphaG;\nreturn 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\n#endif\n}\nfloat smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)\n{\nfloat visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);\n\nreturn visibility;\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {\nfloat lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));\nfloat lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));\nfloat v=0.5/(lambdaV+lambdaL);\nreturn v;\n}\n#endif\n#ifdef CLEARCOAT\nfloat visibility_Kelemen(float VdotH) {\n\n\n\nreturn 0.25/(VdotH*VdotH);\n}\n#endif\n#ifdef SHEEN\n\n\n\nfloat visibility_Ashikhmin(float NdotL,float NdotV)\n{\nreturn 1./(4.*(NdotL+NdotV-NdotL*NdotV));\n}\n#endif\n\n\n\n\n\n\n\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\n\n\nfloat diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));\nfloat diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat fresnel =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn fresnel/PI;\n}\n#ifdef SS_TRANSLUCENCY\n\n\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {\nvec3 S=1./maxEps(diffusionDistance);\nvec3 temp=exp((-0.333333333*thickness)*S);\nreturn tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);\n}\n\n\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {\nfloat t=1.0+w;\nfloat invt2=1.0/square(t);\nreturn saturate((NdotL+w)*invt2);\n}\n#endif\n"; + Ht.a.IncludesShadersStore.pbrDirectLightingFunctions = + "#define CLEARCOATREFLECTANCE90 1.0\n\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef CLEARCOAT\n\n\nvec4 clearCoat;\n#endif\n#ifdef SHEEN\nvec3 sheen;\n#endif\n};\n\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\n\nfloat lightRoughness=lightRadius/lightDistance;\n\nfloat totalRoughness=saturate(lightRoughness+roughness);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\nreturn mix(groundColor,lightColor,info.NdotL);\n}\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\n}\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn toLinearSpace(textureColor);\n}\n#ifdef SS_TRANSLUCENCY\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\nfloat NdotL=absEps(info.NdotLUnclamped);\n\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\n\nfloat trAdapt=step(0.,info.NdotLUnclamped);\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\n}\n#endif\n#ifdef SPECULARTERM\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat visibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat visibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*visibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef ANISOTROPIC\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat TdotH=dot(T,info.H);\nfloat BdotH=dot(B,info.H);\nfloat TdotV=dot(T,V);\nfloat BdotV=dot(B,V);\nfloat TdotL=dot(T,info.L);\nfloat BdotL=dot(B,info.L);\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\nfloat visibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\nvec3 specTerm=fresnel*distribution*visibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef CLEARCOAT\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnel*=clearCoatIntensity;\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\nfloat visibility=visibility_Kelemen(info.VdotH);\nfloat clearCoatTerm=fresnel*distribution*visibility;\nreturn vec4(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);\n}\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\nreturn absorption;\n}\n#endif\n#ifdef SHEEN\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\n\n\nvec3 fresnel=reflectance0;\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\nvec3 sheenTerm=fresnel*distribution*visibility;\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n"; + (Ht.a.IncludesShadersStore.pbrIBLFunctions = + "#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\nfloat microsurfaceAverageSlopeTexels=microsurfaceAverageSlope*cubeMapDimensionPixels;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\nreturn lod;\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\n\n\nfloat temp=NdotVUnclamped+ambientOcclusion;\nreturn saturate(square(temp)-1.0+ambientOcclusion);\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal) {\n\nvec3 reflection=reflect(view,normal);\nfloat temp=saturate(1.0+1.1*dot(reflection,normal));\nreturn square(temp);\n}\n#endif\n\n\n\n\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\n\n\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\nfloat microsurfaceAverageSlope=alphaG;\n\n\n\n\n\n\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\n}\n#endif"), n(121), n(122), n(123), n(115); - Ht.a.IncludesShadersStore.pbrDebug = "#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w0\nif (vClipSpacePosition.x/vClipSpacePosition.w\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n#include\n#include\n\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#ifdef REFLECTION\n#include\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\n#ifdef CLEARCOAT\n\nvec3 clearCoatNormalW=normalW;\n#endif\n#include\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#if defined(TWOSIDEDLIGHTING)\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\n#endif\nnormalW*=sign(dot(normalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n\n\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\n\nfloat alpha=vAlbedoColor.a;\n#ifdef ALBEDO\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\nalpha*=albedoTexture.a;\n#endif\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\nsurfaceAlbedo*=vAlbedoInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nsurfaceAlbedo*=vColor.rgb;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\n\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nalpha=getLuminance(opacityMap.rgb);\n#else\nalpha*=opacityMap.a;\n#endif\nalpha*=vOpacityInfos.y;\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\n#ifdef ALPHATEST\nif (alpha\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#ifdef AMBIENTINGRAYSCALE\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\n#endif\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\n\nfloat microSurface=vReflectivityColor.a;\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\n#ifdef REFLECTIVITY\nvec4 surfaceMetallicColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\n#ifdef AOSTOREINMETALMAPRED\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicColorMap.r,surfaceMetallicColorMap.r,surfaceMetallicColorMap.r);\nambientOcclusionColor=mix(ambientOcclusionColor,aoStoreInMetalMap,vReflectivityInfos.z);\n#endif\n#ifdef METALLNESSSTOREINMETALMAPBLUE\nmetallicRoughness.r*=surfaceMetallicColorMap.b;\n#else\nmetallicRoughness.r*=surfaceMetallicColorMap.r;\n#endif\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\nmetallicRoughness.g*=surfaceMetallicColorMap.a;\n#else\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\nmetallicRoughness.g*=surfaceMetallicColorMap.g;\n#endif\n#endif\n#endif\n#ifdef MICROSURFACEMAP\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\nmetallicRoughness.g*=microSurfaceTexel.r;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\n\nmicroSurface=1.0-metallicRoughness.g;\n\nvec3 baseColor=surfaceAlbedo;\n#ifdef REFLECTANCE\n\n\n\n\n\nsurfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\n\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\n#else\n\n\n\nconst vec3 DefaultSpecularReflectanceDielectric=vec3(0.04,0.04,0.04);\n\nsurfaceAlbedo=mix(baseColor.rgb*(1.0-DefaultSpecularReflectanceDielectric.r),vec3(0.,0.,0.),metallicRoughness.r);\n\nsurfaceReflectivityColor=mix(DefaultSpecularReflectanceDielectric,baseColor,metallicRoughness.r);\n#endif\n#else\n#ifdef REFLECTIVITY\nvec4 surfaceReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\nsurfaceReflectivityColor*=toLinearSpace(surfaceReflectivityColorMap.rgb);\nsurfaceReflectivityColor*=vReflectivityInfos.y;\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\nmicroSurface*=surfaceReflectivityColorMap.a;\nmicroSurface*=vReflectivityInfos.z;\n#else\n#ifdef MICROSURFACEAUTOMATIC\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\n#endif\n#ifdef MICROSURFACEMAP\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\nmicroSurface*=microSurfaceTexel.r;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\n#endif\n#endif\n#endif\n\nmicroSurface=saturate(microSurface);\n\nfloat roughness=1.-microSurface;\n\n#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\n\n\n\nfloat opacityPerceptual=alpha;\n#ifdef LINEARALPHAFRESNEL\nfloat opacity0=opacityPerceptual;\n#else\nfloat opacity0=opacityPerceptual*opacityPerceptual;\n#endif\nfloat opacity90=fresnelGrazingReflectance(opacity0);\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\n\nalpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\n#ifdef ALPHATEST\nif (alpha[0..maxSimultaneousLights]\n\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(specularEnvironmentR0,environmentBrdf);\n#ifdef RADIANCEOCCLUSION\n#ifdef AMBIENTINGRAYSCALE\nfloat ambientMonochrome=ambientOcclusionColor.r;\n#else\nfloat ambientMonochrome=getLuminance(ambientOcclusionColor);\n#endif\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\nspecularEnvironmentReflectance*=seo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW);\nspecularEnvironmentReflectance*=eho;\n#endif\n#endif\n#endif\n#else\n\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\n#endif\n\n#if defined(SHEEN) && defined(REFLECTION)\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentBrdf);\n#ifdef RADIANCEOCCLUSION\nsheenEnvironmentReflectance*=seo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nsheenEnvironmentReflectance*=eho;\n#endif\n#endif\n#endif\n#endif\n\n#ifdef CLEARCOAT\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness,environmentBrdfSampler);\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\n#ifdef RADIANCEOCCLUSION\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\nclearCoatEnvironmentReflectance*=clearCoatSeo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW);\nclearCoatEnvironmentReflectance*=clearCoatEho;\n#endif\n#endif\n#endif\n#else\n\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\n#endif\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\n#ifdef CLEARCOAT_TINT\n\nabsorption=computeClearCoatAbsorption(clearCoatNdotVRefract,clearCoatNdotVRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\n#ifdef REFLECTION\nenvironmentIrradiance*=absorption;\n#endif\n#ifdef SHEEN\nsheenEnvironmentReflectance*=absorption;\n#endif\nspecularEnvironmentReflectance*=absorption;\n#endif\n\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnelIBLClearCoat*=clearCoatIntensity;\nfloat conservationFactor=(1.-fresnelIBLClearCoat);\n#ifdef REFLECTION\nenvironmentIrradiance*=conservationFactor;\n#endif\n#ifdef SHEEN\nsheenEnvironmentReflectance*=(conservationFactor*conservationFactor);\n#endif\nspecularEnvironmentReflectance*=(conservationFactor*conservationFactor);\n#endif\n\n#ifdef SS_REFRACTION\nvec3 refractionTransmittance=vec3(refractionIntensity);\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\n\n\n\n\n\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\n\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\n\nenvironmentRefraction.rgb*=volumeAlbedo;\n#else\n\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\n#endif\n\nsurfaceAlbedo*=(1.-refractionIntensity);\n\nenvironmentIrradiance*=(1.-refractionIntensity);\n\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\nspecularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\n\nrefractionTransmittance*=1.0-specularEnvironmentReflectance;\n#endif\n\n#if defined(REFLECTION) && defined(USESPHERICALFROMREFLECTIONMAP) && defined(SS_TRANSLUCENCY)\n#if defined(USESPHERICALINVERTEX)\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#endif\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\nrefractionIrradiance*=transmittance;\n#endif\n\n\n\n#ifndef METALLICWORKFLOW\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\n#endif\n\n#ifdef REFLECTION\nvec3 finalIrradiance=environmentIrradiance;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(SS_TRANSLUCENCY)\nfinalIrradiance+=refractionIrradiance;\n#endif\nfinalIrradiance*=surfaceAlbedo.rgb;\n#endif\n\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase;\nfinalSpecular=max(finalSpecular,0.0);\n\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalSpecularScaled*=energyConservationFactor;\n#endif\n#endif\n\n#ifdef REFLECTION\nvec3 finalRadiance=environmentRadiance.rgb;\nfinalRadiance*=specularEnvironmentReflectance;\n\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalRadianceScaled*=energyConservationFactor;\n#endif\n#endif\n\n#ifdef SS_REFRACTION\nvec3 finalRefraction=environmentRefraction.rgb;\nfinalRefraction*=refractionTransmittance;\n#endif\n\n#ifdef CLEARCOAT\nvec3 finalClearCoat=clearCoatBase;\nfinalClearCoat=max(finalClearCoat,0.0);\n\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalClearCoatScaled*=energyConservationFactor;\n#endif\n\n#ifdef REFLECTION\nvec3 finalClearCoatRadiance=environmentClearCoatRadiance.rgb;\nfinalClearCoatRadiance*=clearCoatEnvironmentReflectance;\n\nvec3 finalClearCoatRadianceScaled=finalClearCoatRadiance*vLightingIntensity.z;\n#endif\n#ifdef SS_REFRACTION\nfinalRefraction*=(conservationFactor*conservationFactor);\n#ifdef CLEARCOAT_TINT\nfinalRefraction*=absorption;\n#endif\n#endif\n#endif\n\n#ifdef SHEEN\nvec3 finalSheen=sheenBase*sheenColor;\nfinalSheen=max(finalSheen,0.0);\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\n\n\n\n\n\n#ifdef REFLECTION\nvec3 finalSheenRadiance=environmentSheenRadiance.rgb;\nfinalSheenRadiance*=sheenEnvironmentReflectance;\n\nvec3 finalSheenRadianceScaled=finalSheenRadiance*vLightingIntensity.z;\n#endif\n#endif\n\n#ifdef ALPHABLEND\nfloat luminanceOverAlpha=0.0;\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\n#if defined(CLEARCOAT)\nluminanceOverAlpha+=getLuminance(finalClearCoatRadianceScaled);\n#endif\n#endif\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\n#endif\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\n#endif\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA)\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\n#endif\n#endif\n#endif\n\n\nvec3 finalDiffuse=diffuseBase;\nfinalDiffuse*=surfaceAlbedo.rgb;\nfinalDiffuse=max(finalDiffuse,0.0);\n\nvec3 finalAmbient=vAmbientColor;\nfinalAmbient*=surfaceAlbedo.rgb;\n\nvec3 finalEmissive=vEmissiveColor;\n#ifdef EMISSIVE\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\nfinalEmissive*=vEmissiveInfos.y;\n#endif\n\n#ifdef AMBIENT\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),ambientOcclusionColor,vAmbientInfos.w);\n#else\nvec3 ambientOcclusionForDirectDiffuse=ambientOcclusionColor;\n#endif\n\n\n\nvec4 finalColor=vec4(\nfinalAmbient*ambientOcclusionColor +\nfinalDiffuse*ambientOcclusionForDirectDiffuse*vLightingIntensity.x +\n#ifndef UNLIT\n#ifdef REFLECTION\nfinalIrradiance*ambientOcclusionColor*vLightingIntensity.z +\n#endif\n#ifdef SPECULARTERM\n\n\nfinalSpecularScaled +\n#endif\n#ifdef CLEARCOAT\n\n\nfinalClearCoatScaled +\n#endif\n#ifdef SHEEN\n\n\nfinalSheenScaled +\n#endif\n#ifdef REFLECTION\n\n\nfinalRadianceScaled +\n#ifdef CLEARCOAT\n\n\nfinalClearCoatRadianceScaled +\n#endif\n#ifdef SHEEN\n\n\nfinalSheenRadianceScaled +\n#endif\n#endif\n#ifdef SS_REFRACTION\nfinalRefraction*vLightingIntensity.z +\n#endif\n#endif\nfinalEmissive*vLightingIntensity.y,\nalpha);\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\nfinalColor.rgb*=lightmapColor;\n#else\nfinalColor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\n\nfinalColor=max(finalColor,0.0);\n#include\n#include(color,finalColor)\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n\n\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\n#else\n\nfinalColor=applyImageProcessing(finalColor);\n#endif\nfinalColor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\nfinalColor.rgb*=finalColor.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\ngl_FragColor=finalColor;\n#include\n}\n"; + (Ht.a.IncludesShadersStore.pbrVertexDeclaration = + "uniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef ALBEDO\nuniform mat4 albedoMatrix;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\nuniform mat4 reflectivityMatrix;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform mat4 microSurfaceSamplerMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\n#endif\n\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n\n#ifdef SHEEN\n#ifdef SHEEN_TEXTURE\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\n#endif\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;;\n#endif\n#endif\n"), n(124), n(101), n(102), n(103), n(125), n(118); - Ht.a.ShadersStore.pbrVertexShader = "precision highp float;\n#include<__decl__pbrVertex>\n#define CUSTOM_VERTEX_BEGIN\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\nvarying vec2 vAlbedoUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\nvarying vec2 vReflectivityUV;\n#endif\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\nvarying vec2 vClearCoatUV;\n#endif\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\nvarying vec2 vClearCoatBumpUV;\n#endif\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\nvarying vec2 vClearCoatTintUV;\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\nvarying vec2 vSheenUV;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\nvarying vec2 vAnisotropyUV;\n#endif\n#endif\n#ifdef SUBSURFACE\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\nvarying vec2 vThicknessUV;\n#endif\n#endif\n\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(positionUpdated,1.0)).xyz;\n#else\nvPositionUVW=positionUpdated;\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(positionUpdated,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#endif\n#if DEBUGMODE>0\nvClipSpacePosition=gl_Position;\n#endif\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\nif (vAlbedoInfos.x == 0.)\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\nif (vReflectivityInfos.x == 0.)\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\nif (vMicroSurfaceSamplerInfos.x == 0.)\n{\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\nif (vClearCoatInfos.x == 0.)\n{\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\nif (vClearCoatBumpInfos.x == 0.)\n{\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\nif (vClearCoatTintInfos.x == 0.)\n{\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\nif (vSheenInfos.x == 0.)\n{\nvSheenUV=vec2(sheenMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvSheenUV=vec2(sheenMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef ANISOTROPIC\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\nif (vAnisotropyInfos.x == 0.)\n{\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef SUBSURFACE\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\nif (vThicknessInfos.x == 0.)\n{\nvThicknessUV=vec2(thicknessMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvThicknessUV=vec2(thicknessMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n\n#include\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}"; - var ur = function(e) { - function t() { - var t = e.call(this) || this; - return t.PBR = true, - t.MAINUV1 = false, - t.MAINUV2 = false, - t.UV1 = false, - t.UV2 = false, - t.ALBEDO = false, - t.ALBEDODIRECTUV = 0, - t.VERTEXCOLOR = false, - t.AMBIENT = false, - t.AMBIENTDIRECTUV = 0, - t.AMBIENTINGRAYSCALE = false, - t.OPACITY = false, - t.VERTEXALPHA = false, - t.OPACITYDIRECTUV = 0, - t.OPACITYRGB = false, - t.ALPHATEST = false, - t.DEPTHPREPASS = false, - t.ALPHABLEND = false, - t.ALPHAFROMALBEDO = false, - t.ALPHATESTVALUE = "0.5", - t.SPECULAROVERALPHA = false, - t.RADIANCEOVERALPHA = false, - t.ALPHAFRESNEL = false, - t.LINEARALPHAFRESNEL = false, - t.PREMULTIPLYALPHA = false, - t.EMISSIVE = false, - t.EMISSIVEDIRECTUV = 0, - t.REFLECTIVITY = false, - t.REFLECTIVITYDIRECTUV = 0, - t.SPECULARTERM = false, - t.MICROSURFACEFROMREFLECTIVITYMAP = false, - t.MICROSURFACEAUTOMATIC = false, - t.LODBASEDMICROSFURACE = false, - t.MICROSURFACEMAP = false, - t.MICROSURFACEMAPDIRECTUV = 0, - t.METALLICWORKFLOW = false, - t.ROUGHNESSSTOREINMETALMAPALPHA = false, - t.ROUGHNESSSTOREINMETALMAPGREEN = false, - t.METALLNESSSTOREINMETALMAPBLUE = false, - t.AOSTOREINMETALMAPRED = false, - t.ENVIRONMENTBRDF = false, - t.ENVIRONMENTBRDF_RGBD = false, - t.NORMAL = false, - t.TANGENT = false, - t.BUMP = false, - t.BUMPDIRECTUV = 0, - t.OBJECTSPACE_NORMALMAP = false, - t.PARALLAX = false, - t.PARALLAXOCCLUSION = false, - t.NORMALXYSCALE = true, - t.LIGHTMAP = false, - t.LIGHTMAPDIRECTUV = 0, - t.USELIGHTMAPASSHADOWMAP = false, - t.GAMMALIGHTMAP = false, - t.REFLECTION = false, - t.REFLECTIONMAP_3D = false, - t.REFLECTIONMAP_SPHERICAL = false, - t.REFLECTIONMAP_PLANAR = false, - t.REFLECTIONMAP_CUBIC = false, - t.USE_LOCAL_REFLECTIONMAP_CUBIC = false, - t.REFLECTIONMAP_PROJECTION = false, - t.REFLECTIONMAP_SKYBOX = false, - t.REFLECTIONMAP_SKYBOX_TRANSFORMED = false, - t.REFLECTIONMAP_EXPLICIT = false, - t.REFLECTIONMAP_EQUIRECTANGULAR = false, - t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false, - t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false, - t.INVERTCUBICMAP = false, - t.USESPHERICALFROMREFLECTIONMAP = false, - t.SPHERICAL_HARMONICS = false, - t.USESPHERICALINVERTEX = false, - t.REFLECTIONMAP_OPPOSITEZ = false, - t.LODINREFLECTIONALPHA = false, - t.GAMMAREFLECTION = false, - t.RGBDREFLECTION = false, - t.RADIANCEOCCLUSION = false, - t.HORIZONOCCLUSION = false, - t.INSTANCES = false, - t.NUM_BONE_INFLUENCERS = 0, - t.BonesPerMesh = 0, - t.BONETEXTURE = false, - t.NONUNIFORMSCALING = false, - t.MORPHTARGETS = false, - t.MORPHTARGETS_NORMAL = false, - t.MORPHTARGETS_TANGENT = false, - t.NUM_MORPH_INFLUENCERS = 0, - t.IMAGEPROCESSING = false, - t.VIGNETTE = false, - t.VIGNETTEBLENDMODEMULTIPLY = false, - t.VIGNETTEBLENDMODEOPAQUE = false, - t.TONEMAPPING = false, - t.TONEMAPPING_ACES = false, - t.CONTRAST = false, - t.COLORCURVES = false, - t.COLORGRADING = false, - t.COLORGRADING3D = false, - t.SAMPLER3DGREENDEPTH = false, - t.SAMPLER3DBGRMAP = false, - t.IMAGEPROCESSINGPOSTPROCESS = false, - t.EXPOSURE = false, - t.MULTIVIEW = false, - t.USEPHYSICALLIGHTFALLOFF = false, - t.USEGLTFLIGHTFALLOFF = false, - t.TWOSIDEDLIGHTING = false, - t.SHADOWFLOAT = false, - t.CLIPPLANE = false, - t.CLIPPLANE2 = false, - t.CLIPPLANE3 = false, - t.CLIPPLANE4 = false, - t.POINTSIZE = false, - t.FOG = false, - t.LOGARITHMICDEPTH = false, - t.FORCENORMALFORWARD = false, - t.SPECULARAA = false, - t.CLEARCOAT = false, - t.CLEARCOAT_DEFAULTIOR = false, - t.CLEARCOAT_TEXTURE = false, - t.CLEARCOAT_TEXTUREDIRECTUV = 0, - t.CLEARCOAT_BUMP = false, - t.CLEARCOAT_BUMPDIRECTUV = 0, - t.CLEARCOAT_TINT = false, - t.CLEARCOAT_TINT_TEXTURE = false, - t.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0, - t.ANISOTROPIC = false, - t.ANISOTROPIC_TEXTURE = false, - t.ANISOTROPIC_TEXTUREDIRECTUV = 0, - t.BRDF_V_HEIGHT_CORRELATED = false, - t.MS_BRDF_ENERGY_CONSERVATION = false, - t.SHEEN = false, - t.SHEEN_TEXTURE = false, - t.SHEEN_TEXTUREDIRECTUV = 0, - t.SHEEN_LINKWITHALBEDO = false, - t.SUBSURFACE = false, - t.SS_REFRACTION = false, - t.SS_TRANSLUCENCY = false, - t.SS_SCATERRING = false, - t.SS_THICKNESSANDMASK_TEXTURE = false, - t.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0, - t.SS_REFRACTIONMAP_3D = false, - t.SS_REFRACTIONMAP_OPPOSITEZ = false, - t.SS_LODINREFRACTIONALPHA = false, - t.SS_GAMMAREFRACTION = false, - t.SS_RGBDREFRACTION = false, - t.SS_LINKREFRACTIONTOTRANSPARENCY = false, - t.SS_MASK_FROM_THICKNESS_TEXTURE = false, - t.UNLIT = false, - t.DEBUGMODE = 0, - t.rebuild(), - t - } - return h.d(t, e), - t.prototype.reset = function() { - e.prototype.reset.call(this), - this.ALPHATESTVALUE = "0.5", - this.PBR = true - } - , - t - }(Kn.a) - , lr = function(e) { - function t(i, n) { - var r = e.call(this, i, n) || this; - return r._directIntensity = 1, - r._emissiveIntensity = 1, - r._environmentIntensity = 1, - r._specularIntensity = 1, - r._lightingInfos = new a.y(r._directIntensity,r._emissiveIntensity,r._environmentIntensity,r._specularIntensity), - r._disableBumpMap = false, - r._albedoTexture = null, - r._ambientTexture = null, - r._ambientTextureStrength = 1, - r._ambientTextureImpactOnAnalyticalLights = t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, - r._opacityTexture = null, - r._reflectionTexture = null, - r._emissiveTexture = null, - r._reflectivityTexture = null, - r._metallicTexture = null, - r._metallic = null, - r._roughness = null, - r._microSurfaceTexture = null, - r._bumpTexture = null, - r._lightmapTexture = null, - r._ambientColor = new a.e(0,0,0), - r._albedoColor = new a.e(1,1,1), - r._reflectivityColor = new a.e(1,1,1), - r._reflectionColor = new a.e(1,1,1), - r._emissiveColor = new a.e(0,0,0), - r._microSurface = .9, - r._useLightmapAsShadowmap = false, - r._useHorizonOcclusion = true, - r._useRadianceOcclusion = true, - r._useAlphaFromAlbedoTexture = false, - r._useSpecularOverAlpha = true, - r._useMicroSurfaceFromReflectivityMapAlpha = false, - r._useRoughnessFromMetallicTextureAlpha = true, - r._useRoughnessFromMetallicTextureGreen = false, - r._useMetallnessFromMetallicTextureBlue = false, - r._useAmbientOcclusionFromMetallicTextureRed = false, - r._useAmbientInGrayScale = false, - r._useAutoMicroSurfaceFromReflectivityMap = false, - r._lightFalloff = t.LIGHTFALLOFF_PHYSICAL, - r._useRadianceOverAlpha = true, - r._useObjectSpaceNormalMap = false, - r._useParallax = false, - r._useParallaxOcclusion = false, - r._parallaxScaleBias = .05, - r._disableLighting = false, - r._maxSimultaneousLights = 4, - r._invertNormalMapX = false, - r._invertNormalMapY = false, - r._twoSidedLighting = false, - r._alphaCutOff = .4, - r._forceAlphaTest = false, - r._useAlphaFresnel = false, - r._useLinearAlphaFresnel = false, - r._transparencyMode = null, - r._environmentBRDFTexture = null, - r._forceIrradianceInFragment = false, - r._forceNormalForward = false, - r._enableSpecularAntiAliasing = false, - r._imageProcessingObserver = null, - r._renderTargets = new jt.a(16), - r._globalAmbientColor = new a.e(0,0,0), - r._useLogarithmicDepth = false, - r._unlit = false, - r._debugMode = 0, - r.debugMode = 0, - r.debugLimit = -1, - r.debugFactor = 1, - r.clearCoat = new rr(r._markAllSubMeshesAsTexturesDirty.bind(r)), - r.anisotropy = new or(r._markAllSubMeshesAsTexturesDirty.bind(r)), - r.brdf = new ar(r._markAllSubMeshesAsMiscDirty.bind(r)), - r.sheen = new sr(r._markAllSubMeshesAsTexturesDirty.bind(r)), - r.subSurface = new cr(r._markAllSubMeshesAsTexturesDirty.bind(r)), - r._attachImageProcessingConfiguration(null), - r.getRenderTargetTextures = function() { - return r._renderTargets.reset(), - qn.a.ReflectionTextureEnabled && r._reflectionTexture && r._reflectionTexture.isRenderTarget && r._renderTargets.push(r._reflectionTexture), - r.subSurface.fillRenderTargetTextures(r._renderTargets), - r._renderTargets - } - , - r._environmentBRDFTexture = nr.GetEnvironmentBRDFTexture(n), - r - } - return h.d(t, e), - t.prototype._attachImageProcessingConfiguration = function(e) { - var t = this; - e !== this._imageProcessingConfiguration && (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), - this._imageProcessingConfiguration = e || this.getScene().imageProcessingConfiguration, - this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() { - t._markAllSubMeshesAsImageProcessingDirty() - }))) - } - , - Object.defineProperty(t.prototype, "hasRenderTargetTextures", { - get: function() { - return !!(qn.a.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) || this.subSurface.hasRenderTargetTextures() - }, - enumerable: true, - configurable: true + Ht.a.ShadersStore.pbrVertexShader = + "precision highp float;\n#include<__decl__pbrVertex>\n#define CUSTOM_VERTEX_BEGIN\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\nvarying vec2 vAlbedoUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\nvarying vec2 vReflectivityUV;\n#endif\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\nvarying vec2 vClearCoatUV;\n#endif\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\nvarying vec2 vClearCoatBumpUV;\n#endif\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\nvarying vec2 vClearCoatTintUV;\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\nvarying vec2 vSheenUV;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\nvarying vec2 vAnisotropyUV;\n#endif\n#endif\n#ifdef SUBSURFACE\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\nvarying vec2 vThicknessUV;\n#endif\n#endif\n\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(positionUpdated,1.0)).xyz;\n#else\nvPositionUVW=positionUpdated;\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(positionUpdated,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#endif\n#if DEBUGMODE>0\nvClipSpacePosition=gl_Position;\n#endif\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\nif (vAlbedoInfos.x == 0.)\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\nif (vReflectivityInfos.x == 0.)\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\nif (vMicroSurfaceSamplerInfos.x == 0.)\n{\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\nif (vClearCoatInfos.x == 0.)\n{\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\nif (vClearCoatBumpInfos.x == 0.)\n{\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\nif (vClearCoatTintInfos.x == 0.)\n{\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\nif (vSheenInfos.x == 0.)\n{\nvSheenUV=vec2(sheenMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvSheenUV=vec2(sheenMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef ANISOTROPIC\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\nif (vAnisotropyInfos.x == 0.)\n{\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef SUBSURFACE\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\nif (vThicknessInfos.x == 0.)\n{\nvThicknessUV=vec2(thicknessMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvThicknessUV=vec2(thicknessMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n\n#include\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}"; + var ur = (function (e) { + function t() { + var t = e.call(this) || this; + return ( + (t.PBR = true), + (t.MAINUV1 = false), + (t.MAINUV2 = false), + (t.UV1 = false), + (t.UV2 = false), + (t.ALBEDO = false), + (t.ALBEDODIRECTUV = 0), + (t.VERTEXCOLOR = false), + (t.AMBIENT = false), + (t.AMBIENTDIRECTUV = 0), + (t.AMBIENTINGRAYSCALE = false), + (t.OPACITY = false), + (t.VERTEXALPHA = false), + (t.OPACITYDIRECTUV = 0), + (t.OPACITYRGB = false), + (t.ALPHATEST = false), + (t.DEPTHPREPASS = false), + (t.ALPHABLEND = false), + (t.ALPHAFROMALBEDO = false), + (t.ALPHATESTVALUE = "0.5"), + (t.SPECULAROVERALPHA = false), + (t.RADIANCEOVERALPHA = false), + (t.ALPHAFRESNEL = false), + (t.LINEARALPHAFRESNEL = false), + (t.PREMULTIPLYALPHA = false), + (t.EMISSIVE = false), + (t.EMISSIVEDIRECTUV = 0), + (t.REFLECTIVITY = false), + (t.REFLECTIVITYDIRECTUV = 0), + (t.SPECULARTERM = false), + (t.MICROSURFACEFROMREFLECTIVITYMAP = false), + (t.MICROSURFACEAUTOMATIC = false), + (t.LODBASEDMICROSFURACE = false), + (t.MICROSURFACEMAP = false), + (t.MICROSURFACEMAPDIRECTUV = 0), + (t.METALLICWORKFLOW = false), + (t.ROUGHNESSSTOREINMETALMAPALPHA = false), + (t.ROUGHNESSSTOREINMETALMAPGREEN = false), + (t.METALLNESSSTOREINMETALMAPBLUE = false), + (t.AOSTOREINMETALMAPRED = false), + (t.ENVIRONMENTBRDF = false), + (t.ENVIRONMENTBRDF_RGBD = false), + (t.NORMAL = false), + (t.TANGENT = false), + (t.BUMP = false), + (t.BUMPDIRECTUV = 0), + (t.OBJECTSPACE_NORMALMAP = false), + (t.PARALLAX = false), + (t.PARALLAXOCCLUSION = false), + (t.NORMALXYSCALE = true), + (t.LIGHTMAP = false), + (t.LIGHTMAPDIRECTUV = 0), + (t.USELIGHTMAPASSHADOWMAP = false), + (t.GAMMALIGHTMAP = false), + (t.REFLECTION = false), + (t.REFLECTIONMAP_3D = false), + (t.REFLECTIONMAP_SPHERICAL = false), + (t.REFLECTIONMAP_PLANAR = false), + (t.REFLECTIONMAP_CUBIC = false), + (t.USE_LOCAL_REFLECTIONMAP_CUBIC = false), + (t.REFLECTIONMAP_PROJECTION = false), + (t.REFLECTIONMAP_SKYBOX = false), + (t.REFLECTIONMAP_SKYBOX_TRANSFORMED = false), + (t.REFLECTIONMAP_EXPLICIT = false), + (t.REFLECTIONMAP_EQUIRECTANGULAR = false), + (t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false), + (t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false), + (t.INVERTCUBICMAP = false), + (t.USESPHERICALFROMREFLECTIONMAP = false), + (t.SPHERICAL_HARMONICS = false), + (t.USESPHERICALINVERTEX = false), + (t.REFLECTIONMAP_OPPOSITEZ = false), + (t.LODINREFLECTIONALPHA = false), + (t.GAMMAREFLECTION = false), + (t.RGBDREFLECTION = false), + (t.RADIANCEOCCLUSION = false), + (t.HORIZONOCCLUSION = false), + (t.INSTANCES = false), + (t.NUM_BONE_INFLUENCERS = 0), + (t.BonesPerMesh = 0), + (t.BONETEXTURE = false), + (t.NONUNIFORMSCALING = false), + (t.MORPHTARGETS = false), + (t.MORPHTARGETS_NORMAL = false), + (t.MORPHTARGETS_TANGENT = false), + (t.NUM_MORPH_INFLUENCERS = 0), + (t.IMAGEPROCESSING = false), + (t.VIGNETTE = false), + (t.VIGNETTEBLENDMODEMULTIPLY = false), + (t.VIGNETTEBLENDMODEOPAQUE = false), + (t.TONEMAPPING = false), + (t.TONEMAPPING_ACES = false), + (t.CONTRAST = false), + (t.COLORCURVES = false), + (t.COLORGRADING = false), + (t.COLORGRADING3D = false), + (t.SAMPLER3DGREENDEPTH = false), + (t.SAMPLER3DBGRMAP = false), + (t.IMAGEPROCESSINGPOSTPROCESS = false), + (t.EXPOSURE = false), + (t.MULTIVIEW = false), + (t.USEPHYSICALLIGHTFALLOFF = false), + (t.USEGLTFLIGHTFALLOFF = false), + (t.TWOSIDEDLIGHTING = false), + (t.SHADOWFLOAT = false), + (t.CLIPPLANE = false), + (t.CLIPPLANE2 = false), + (t.CLIPPLANE3 = false), + (t.CLIPPLANE4 = false), + (t.POINTSIZE = false), + (t.FOG = false), + (t.LOGARITHMICDEPTH = false), + (t.FORCENORMALFORWARD = false), + (t.SPECULARAA = false), + (t.CLEARCOAT = false), + (t.CLEARCOAT_DEFAULTIOR = false), + (t.CLEARCOAT_TEXTURE = false), + (t.CLEARCOAT_TEXTUREDIRECTUV = 0), + (t.CLEARCOAT_BUMP = false), + (t.CLEARCOAT_BUMPDIRECTUV = 0), + (t.CLEARCOAT_TINT = false), + (t.CLEARCOAT_TINT_TEXTURE = false), + (t.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0), + (t.ANISOTROPIC = false), + (t.ANISOTROPIC_TEXTURE = false), + (t.ANISOTROPIC_TEXTUREDIRECTUV = 0), + (t.BRDF_V_HEIGHT_CORRELATED = false), + (t.MS_BRDF_ENERGY_CONSERVATION = false), + (t.SHEEN = false), + (t.SHEEN_TEXTURE = false), + (t.SHEEN_TEXTUREDIRECTUV = 0), + (t.SHEEN_LINKWITHALBEDO = false), + (t.SUBSURFACE = false), + (t.SS_REFRACTION = false), + (t.SS_TRANSLUCENCY = false), + (t.SS_SCATERRING = false), + (t.SS_THICKNESSANDMASK_TEXTURE = false), + (t.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0), + (t.SS_REFRACTIONMAP_3D = false), + (t.SS_REFRACTIONMAP_OPPOSITEZ = false), + (t.SS_LODINREFRACTIONALPHA = false), + (t.SS_GAMMAREFRACTION = false), + (t.SS_RGBDREFRACTION = false), + (t.SS_LINKREFRACTIONTOTRANSPARENCY = false), + (t.SS_MASK_FROM_THICKNESS_TEXTURE = false), + (t.UNLIT = false), + (t.DEBUGMODE = 0), + t.rebuild(), + t + ); + } + return ( + h.d(t, e), + (t.prototype.reset = function () { + e.prototype.reset.call(this), + (this.ALPHATESTVALUE = "0.5"), + (this.PBR = true); }), - t.prototype.getClassName = function() { - return "PBRBaseMaterial" - } - , - Object.defineProperty(t.prototype, "useLogarithmicDepth", { - get: function() { - return this._useLogarithmicDepth - }, - set: function(e) { - this._useLogarithmicDepth = e && this.getScene().getEngine().getCaps().fragmentDepthSupported + t + ); + })(Kn.a), + lr = (function (e) { + function t(i, n) { + var r = e.call(this, i, n) || this; + return ( + (r._directIntensity = 1), + (r._emissiveIntensity = 1), + (r._environmentIntensity = 1), + (r._specularIntensity = 1), + (r._lightingInfos = new a.y( + r._directIntensity, + r._emissiveIntensity, + r._environmentIntensity, + r._specularIntensity + )), + (r._disableBumpMap = false), + (r._albedoTexture = null), + (r._ambientTexture = null), + (r._ambientTextureStrength = 1), + (r._ambientTextureImpactOnAnalyticalLights = + t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS), + (r._opacityTexture = null), + (r._reflectionTexture = null), + (r._emissiveTexture = null), + (r._reflectivityTexture = null), + (r._metallicTexture = null), + (r._metallic = null), + (r._roughness = null), + (r._microSurfaceTexture = null), + (r._bumpTexture = null), + (r._lightmapTexture = null), + (r._ambientColor = new a.e(0, 0, 0)), + (r._albedoColor = new a.e(1, 1, 1)), + (r._reflectivityColor = new a.e(1, 1, 1)), + (r._reflectionColor = new a.e(1, 1, 1)), + (r._emissiveColor = new a.e(0, 0, 0)), + (r._microSurface = 0.9), + (r._useLightmapAsShadowmap = false), + (r._useHorizonOcclusion = true), + (r._useRadianceOcclusion = true), + (r._useAlphaFromAlbedoTexture = false), + (r._useSpecularOverAlpha = true), + (r._useMicroSurfaceFromReflectivityMapAlpha = false), + (r._useRoughnessFromMetallicTextureAlpha = true), + (r._useRoughnessFromMetallicTextureGreen = false), + (r._useMetallnessFromMetallicTextureBlue = false), + (r._useAmbientOcclusionFromMetallicTextureRed = false), + (r._useAmbientInGrayScale = false), + (r._useAutoMicroSurfaceFromReflectivityMap = false), + (r._lightFalloff = t.LIGHTFALLOFF_PHYSICAL), + (r._useRadianceOverAlpha = true), + (r._useObjectSpaceNormalMap = false), + (r._useParallax = false), + (r._useParallaxOcclusion = false), + (r._parallaxScaleBias = 0.05), + (r._disableLighting = false), + (r._maxSimultaneousLights = 4), + (r._invertNormalMapX = false), + (r._invertNormalMapY = false), + (r._twoSidedLighting = false), + (r._alphaCutOff = 0.4), + (r._forceAlphaTest = false), + (r._useAlphaFresnel = false), + (r._useLinearAlphaFresnel = false), + (r._transparencyMode = null), + (r._environmentBRDFTexture = null), + (r._forceIrradianceInFragment = false), + (r._forceNormalForward = false), + (r._enableSpecularAntiAliasing = false), + (r._imageProcessingObserver = null), + (r._renderTargets = new jt.a(16)), + (r._globalAmbientColor = new a.e(0, 0, 0)), + (r._useLogarithmicDepth = false), + (r._unlit = false), + (r._debugMode = 0), + (r.debugMode = 0), + (r.debugLimit = -1), + (r.debugFactor = 1), + (r.clearCoat = new rr( + r._markAllSubMeshesAsTexturesDirty.bind(r) + )), + (r.anisotropy = new or( + r._markAllSubMeshesAsTexturesDirty.bind(r) + )), + (r.brdf = new ar(r._markAllSubMeshesAsMiscDirty.bind(r))), + (r.sheen = new sr( + r._markAllSubMeshesAsTexturesDirty.bind(r) + )), + (r.subSurface = new cr( + r._markAllSubMeshesAsTexturesDirty.bind(r) + )), + r._attachImageProcessingConfiguration(null), + (r.getRenderTargetTextures = function () { + return ( + r._renderTargets.reset(), + qn.a.ReflectionTextureEnabled && + r._reflectionTexture && + r._reflectionTexture.isRenderTarget && + r._renderTargets.push(r._reflectionTexture), + r.subSurface.fillRenderTargetTextures( + r._renderTargets + ), + r._renderTargets + ); + }), + (r._environmentBRDFTexture = + nr.GetEnvironmentBRDFTexture(n)), + r + ); + } + return ( + h.d(t, e), + (t.prototype._attachImageProcessingConfiguration = + function (e) { + var t = this; + e !== this._imageProcessingConfiguration && + (this._imageProcessingConfiguration && + this._imageProcessingObserver && + this._imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingObserver + ), + (this._imageProcessingConfiguration = + e || this.getScene().imageProcessingConfiguration), + this._imageProcessingConfiguration && + (this._imageProcessingObserver = + this._imageProcessingConfiguration.onUpdateParameters.add( + function () { + t._markAllSubMeshesAsImageProcessingDirty(); + } + ))); + }), + Object.defineProperty( + t.prototype, + "hasRenderTargetTextures", + { + get: function () { + return ( + !!( + qn.a.ReflectionTextureEnabled && + this._reflectionTexture && + this._reflectionTexture.isRenderTarget + ) || this.subSurface.hasRenderTargetTextures() + ); }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype.getClassName = function () { + return "PBRBaseMaterial"; + }), + Object.defineProperty(t.prototype, "useLogarithmicDepth", { + get: function () { + return this._useLogarithmicDepth; + }, + set: function (e) { + this._useLogarithmicDepth = + e && + this.getScene().getEngine().getCaps() + .fragmentDepthSupported; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "transparencyMode", { - get: function() { - return this._transparencyMode - }, - set: function(e) { - this._transparencyMode !== e && (this._transparencyMode = e, - this._forceAlphaTest = e === t.PBRMATERIAL_ALPHATESTANDBLEND, - this._markAllSubMeshesAsTexturesAndMiscDirty()) + get: function () { + return this._transparencyMode; + }, + set: function (e) { + this._transparencyMode !== e && + ((this._transparencyMode = e), + (this._forceAlphaTest = + e === t.PBRMATERIAL_ALPHATESTANDBLEND), + this._markAllSubMeshesAsTexturesAndMiscDirty()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "_disableAlphaBlending", + { + get: function () { + return ( + this.subSurface.disableAlphaBlending || + this._transparencyMode === t.PBRMATERIAL_OPAQUE || + this._transparencyMode === t.PBRMATERIAL_ALPHATEST + ); }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype.needAlphaBlending = function () { + return ( + !this._disableAlphaBlending && + (this.alpha < 1 || + null != this._opacityTexture || + this._shouldUseAlphaFromAlbedoTexture()) + ); }), - Object.defineProperty(t.prototype, "_disableAlphaBlending", { - get: function() { - return this.subSurface.disableAlphaBlending || this._transparencyMode === t.PBRMATERIAL_OPAQUE || this._transparencyMode === t.PBRMATERIAL_ALPHATEST - }, - enumerable: true, - configurable: true + (t.prototype.needAlphaBlendingForMesh = function (t) { + return ( + !(this._disableAlphaBlending && t.visibility >= 1) && + e.prototype.needAlphaBlendingForMesh.call(this, t) + ); }), - t.prototype.needAlphaBlending = function() { - return !this._disableAlphaBlending && (this.alpha < 1 || null != this._opacityTexture || this._shouldUseAlphaFromAlbedoTexture()) - } - , - t.prototype.needAlphaBlendingForMesh = function(t) { - return !(this._disableAlphaBlending && t.visibility >= 1) && e.prototype.needAlphaBlendingForMesh.call(this, t) - } - , - t.prototype.needAlphaTesting = function() { - return !!this._forceAlphaTest || !this.subSurface.disableAlphaBlending && null != this._albedoTexture && this._albedoTexture.hasAlpha && (null == this._transparencyMode || this._transparencyMode === t.PBRMATERIAL_ALPHATEST) - } - , - t.prototype._shouldUseAlphaFromAlbedoTexture = function() { - return null != this._albedoTexture && this._albedoTexture.hasAlpha && this._useAlphaFromAlbedoTexture && this._transparencyMode !== t.PBRMATERIAL_OPAQUE - } - , - t.prototype.getAlphaTestTexture = function() { - return this._albedoTexture - } - , - t.prototype.isReadyForSubMesh = function(e, t, i) { - if (t.effect && this.isFrozen && this._wasPreviouslyReady) - return true; - t._materialDefines || (t._materialDefines = new ur); - var n = t._materialDefines; - if (!this.checkReadyOnEveryCall && t.effect && n._renderId === this.getScene().getRenderId()) - return true; - var r = this.getScene() - , o = r.getEngine(); - if (n._areTexturesDirty && r.texturesEnabled) { - if (this._albedoTexture && qn.a.DiffuseTextureEnabled && !this._albedoTexture.isReadyOrNotBlocking()) - return false; - if (this._ambientTexture && qn.a.AmbientTextureEnabled && !this._ambientTexture.isReadyOrNotBlocking()) - return false; - if (this._opacityTexture && qn.a.OpacityTextureEnabled && !this._opacityTexture.isReadyOrNotBlocking()) - return false; - var a = this._getReflectionTexture(); - if (a && qn.a.ReflectionTextureEnabled && !a.isReadyOrNotBlocking()) - return false; - if (this._lightmapTexture && qn.a.LightmapTextureEnabled && !this._lightmapTexture.isReadyOrNotBlocking()) - return false; - if (this._emissiveTexture && qn.a.EmissiveTextureEnabled && !this._emissiveTexture.isReadyOrNotBlocking()) - return false; - if (qn.a.SpecularTextureEnabled) { - if (this._metallicTexture) { - if (!this._metallicTexture.isReadyOrNotBlocking()) - return false - } else if (this._reflectivityTexture && !this._reflectivityTexture.isReadyOrNotBlocking()) - return false; - if (this._microSurfaceTexture && !this._microSurfaceTexture.isReadyOrNotBlocking()) - return false - } - if (o.getCaps().standardDerivatives && this._bumpTexture && qn.a.BumpTextureEnabled && !this._disableBumpMap && !this._bumpTexture.isReady()) - return false; - if (this._environmentBRDFTexture && qn.a.ReflectionTextureEnabled && !this._environmentBRDFTexture.isReady()) - return false + (t.prototype.needAlphaTesting = function () { + return ( + !!this._forceAlphaTest || + (!this.subSurface.disableAlphaBlending && + null != this._albedoTexture && + this._albedoTexture.hasAlpha && + (null == this._transparencyMode || + this._transparencyMode === t.PBRMATERIAL_ALPHATEST)) + ); + }), + (t.prototype._shouldUseAlphaFromAlbedoTexture = + function () { + return ( + null != this._albedoTexture && + this._albedoTexture.hasAlpha && + this._useAlphaFromAlbedoTexture && + this._transparencyMode !== t.PBRMATERIAL_OPAQUE + ); + }), + (t.prototype.getAlphaTestTexture = function () { + return this._albedoTexture; + }), + (t.prototype.isReadyForSubMesh = function (e, t, i) { + if (t.effect && this.isFrozen && this._wasPreviouslyReady) + return true; + t._materialDefines || (t._materialDefines = new ur()); + var n = t._materialDefines; + if ( + !this.checkReadyOnEveryCall && + t.effect && + n._renderId === this.getScene().getRenderId() + ) + return true; + var r = this.getScene(), + o = r.getEngine(); + if (n._areTexturesDirty && r.texturesEnabled) { + if ( + this._albedoTexture && + qn.a.DiffuseTextureEnabled && + !this._albedoTexture.isReadyOrNotBlocking() + ) + return false; + if ( + this._ambientTexture && + qn.a.AmbientTextureEnabled && + !this._ambientTexture.isReadyOrNotBlocking() + ) + return false; + if ( + this._opacityTexture && + qn.a.OpacityTextureEnabled && + !this._opacityTexture.isReadyOrNotBlocking() + ) + return false; + var a = this._getReflectionTexture(); + if ( + a && + qn.a.ReflectionTextureEnabled && + !a.isReadyOrNotBlocking() + ) + return false; + if ( + this._lightmapTexture && + qn.a.LightmapTextureEnabled && + !this._lightmapTexture.isReadyOrNotBlocking() + ) + return false; + if ( + this._emissiveTexture && + qn.a.EmissiveTextureEnabled && + !this._emissiveTexture.isReadyOrNotBlocking() + ) + return false; + if (qn.a.SpecularTextureEnabled) { + if (this._metallicTexture) { + if (!this._metallicTexture.isReadyOrNotBlocking()) + return false; + } else if ( + this._reflectivityTexture && + !this._reflectivityTexture.isReadyOrNotBlocking() + ) + return false; + if ( + this._microSurfaceTexture && + !this._microSurfaceTexture.isReadyOrNotBlocking() + ) + return false; } - if (!(this.subSurface.isReadyForSubMesh(n, r) && this.clearCoat.isReadyForSubMesh(n, r, o, this._disableBumpMap) && this.sheen.isReadyForSubMesh(n, r) && this.anisotropy.isReadyForSubMesh(n, r))) - return false; - if (n._areImageProcessingDirty && this._imageProcessingConfiguration && !this._imageProcessingConfiguration.isReady()) - return false; - o.getCaps().standardDerivatives || e.isVerticesDataPresent(Si.b.NormalKind) || (e.createNormals(true), - g.a.Warn("PBRMaterial: Normals have been created for the mesh: " + e.name)); - var s = t.effect - , c = this._prepareEffect(e, n, this.onCompiled, this.onError, i); - return c && (this.allowShaderHotSwapping && s && !c.isReady() ? (c = s, - n.markAsUnprocessed()) : (r.resetCachedMaterial(), - t.setEffect(c, n), - this.buildUniformLayout())), - !(!t.effect || !t.effect.isReady() || (n._renderId = r.getRenderId(), - this._wasPreviouslyReady = true, - 0)) - } - , - t.prototype.isMetallicWorkflow = function() { - return !(null == this._metallic && null == this._roughness && !this._metallicTexture) - } - , - t.prototype._prepareEffect = function(e, t, i, n, r, o) { - if (void 0 === i && (i = null), + if ( + o.getCaps().standardDerivatives && + this._bumpTexture && + qn.a.BumpTextureEnabled && + !this._disableBumpMap && + !this._bumpTexture.isReady() + ) + return false; + if ( + this._environmentBRDFTexture && + qn.a.ReflectionTextureEnabled && + !this._environmentBRDFTexture.isReady() + ) + return false; + } + if ( + !( + this.subSurface.isReadyForSubMesh(n, r) && + this.clearCoat.isReadyForSubMesh( + n, + r, + o, + this._disableBumpMap + ) && + this.sheen.isReadyForSubMesh(n, r) && + this.anisotropy.isReadyForSubMesh(n, r) + ) + ) + return false; + if ( + n._areImageProcessingDirty && + this._imageProcessingConfiguration && + !this._imageProcessingConfiguration.isReady() + ) + return false; + o.getCaps().standardDerivatives || + e.isVerticesDataPresent(Si.b.NormalKind) || + (e.createNormals(true), + g.a.Warn( + "PBRMaterial: Normals have been created for the mesh: " + + e.name + )); + var s = t.effect, + c = this._prepareEffect( + e, + n, + this.onCompiled, + this.onError, + i + ); + return ( + c && + (this.allowShaderHotSwapping && s && !c.isReady() + ? ((c = s), n.markAsUnprocessed()) + : (r.resetCachedMaterial(), + t.setEffect(c, n), + this.buildUniformLayout())), + !( + !t.effect || + !t.effect.isReady() || + ((n._renderId = r.getRenderId()), + (this._wasPreviouslyReady = true), + 0) + ) + ); + }), + (t.prototype.isMetallicWorkflow = function () { + return !( + null == this._metallic && + null == this._roughness && + !this._metallicTexture + ); + }), + (t.prototype._prepareEffect = function (e, t, i, n, r, o) { + if ( + (void 0 === i && (i = null), void 0 === n && (n = null), void 0 === r && (r = null), void 0 === o && (o = null), this._prepareDefines(e, t, r, o), !t.isDirty) - return null; - t.markAsProcessed(); - var a = this.getScene().getEngine() - , s = new Ht.c - , c = 0; - t.USESPHERICALINVERTEX && s.addFallback(c++, "USESPHERICALINVERTEX"), + ) + return null; + t.markAsProcessed(); + var a = this.getScene().getEngine(), + s = new Ht.c(), + c = 0; + t.USESPHERICALINVERTEX && + s.addFallback(c++, "USESPHERICALINVERTEX"), t.FOG && s.addFallback(c, "FOG"), t.SPECULARAA && s.addFallback(c, "SPECULARAA"), t.POINTSIZE && s.addFallback(c, "POINTSIZE"), - t.LOGARITHMICDEPTH && s.addFallback(c, "LOGARITHMICDEPTH"), + t.LOGARITHMICDEPTH && + s.addFallback(c, "LOGARITHMICDEPTH"), t.PARALLAX && s.addFallback(c, "PARALLAX"), - t.PARALLAXOCCLUSION && s.addFallback(c++, "PARALLAXOCCLUSION"), - c = or.AddFallbacks(t, s, c), - c = or.AddFallbacks(t, s, c), - c = cr.AddFallbacks(t, s, c), - c = sr.AddFallbacks(t, s, c), - t.ENVIRONMENTBRDF && s.addFallback(c++, "ENVIRONMENTBRDF"), + t.PARALLAXOCCLUSION && + s.addFallback(c++, "PARALLAXOCCLUSION"), + (c = or.AddFallbacks(t, s, c)), + (c = or.AddFallbacks(t, s, c)), + (c = cr.AddFallbacks(t, s, c)), + (c = sr.AddFallbacks(t, s, c)), + t.ENVIRONMENTBRDF && + s.addFallback(c++, "ENVIRONMENTBRDF"), t.TANGENT && s.addFallback(c++, "TANGENT"), t.BUMP && s.addFallback(c++, "BUMP"), - c = Yn.a.HandleFallbacksForShadows(t, s, this._maxSimultaneousLights, c++), + (c = Yn.a.HandleFallbacksForShadows( + t, + s, + this._maxSimultaneousLights, + c++ + )), t.SPECULARTERM && s.addFallback(c++, "SPECULARTERM"), - t.USESPHERICALFROMREFLECTIONMAP && s.addFallback(c++, "USESPHERICALFROMREFLECTIONMAP"), + t.USESPHERICALFROMREFLECTIONMAP && + s.addFallback(c++, "USESPHERICALFROMREFLECTIONMAP"), t.LIGHTMAP && s.addFallback(c++, "LIGHTMAP"), t.NORMAL && s.addFallback(c++, "NORMAL"), t.AMBIENT && s.addFallback(c++, "AMBIENT"), t.EMISSIVE && s.addFallback(c++, "EMISSIVE"), t.VERTEXCOLOR && s.addFallback(c++, "VERTEXCOLOR"), - t.NUM_BONE_INFLUENCERS > 0 && s.addCPUSkinningFallback(c++, e), + t.NUM_BONE_INFLUENCERS > 0 && + s.addCPUSkinningFallback(c++, e), t.MORPHTARGETS && s.addFallback(c++, "MORPHTARGETS"), t.MULTIVIEW && s.addFallback(0, "MULTIVIEW"); - var u = [Si.b.PositionKind]; - t.NORMAL && u.push(Si.b.NormalKind), + var u = [Si.b.PositionKind]; + t.NORMAL && u.push(Si.b.NormalKind), t.TANGENT && u.push(Si.b.TangentKind), t.UV1 && u.push(Si.b.UVKind), t.UV2 && u.push(Si.b.UV2Kind), @@ -71715,11 +96298,90 @@ and limitations under the License. Yn.a.PrepareAttributesForBones(u, e, t, s), Yn.a.PrepareAttributesForInstances(u, t), Yn.a.PrepareAttributesForMorphTargets(u, e, t); - var l = "pbr" - , h = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vAlbedoColor", "vReflectivityColor", "vEmissiveColor", "visibility", "vReflectionColor", "vFogInfos", "vFogColor", "pointSize", "vAlbedoInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vReflectionPosition", "vReflectionSize", "vEmissiveInfos", "vReflectivityInfos", "vMicroSurfaceSamplerInfos", "vBumpInfos", "vLightmapInfos", "mBones", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "albedoMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "reflectivityMatrix", "normalMatrix", "microSurfaceSamplerMatrix", "bumpMatrix", "lightmapMatrix", "vLightingIntensity", "logarithmicDepthConstant", "vSphericalX", "vSphericalY", "vSphericalZ", "vSphericalXX_ZZ", "vSphericalYY_ZZ", "vSphericalZZ", "vSphericalXY", "vSphericalYZ", "vSphericalZX", "vSphericalL00", "vSphericalL1_1", "vSphericalL10", "vSphericalL11", "vSphericalL2_2", "vSphericalL2_1", "vSphericalL20", "vSphericalL21", "vSphericalL22", "vReflectionMicrosurfaceInfos", "vTangentSpaceParams", "boneTextureWidth", "vDebugMode"] - , f = ["albedoSampler", "reflectivitySampler", "ambientSampler", "emissiveSampler", "bumpSampler", "lightmapSampler", "opacitySampler", "reflectionSampler", "reflectionSamplerLow", "reflectionSamplerHigh", "microSurfaceSampler", "environmentBrdfSampler", "boneSampler"] - , d = ["Material", "Scene"]; - cr.AddUniforms(h), + var l = "pbr", + h = [ + "world", + "view", + "viewProjection", + "vEyePosition", + "vLightsType", + "vAmbientColor", + "vAlbedoColor", + "vReflectivityColor", + "vEmissiveColor", + "visibility", + "vReflectionColor", + "vFogInfos", + "vFogColor", + "pointSize", + "vAlbedoInfos", + "vAmbientInfos", + "vOpacityInfos", + "vReflectionInfos", + "vReflectionPosition", + "vReflectionSize", + "vEmissiveInfos", + "vReflectivityInfos", + "vMicroSurfaceSamplerInfos", + "vBumpInfos", + "vLightmapInfos", + "mBones", + "vClipPlane", + "vClipPlane2", + "vClipPlane3", + "vClipPlane4", + "albedoMatrix", + "ambientMatrix", + "opacityMatrix", + "reflectionMatrix", + "emissiveMatrix", + "reflectivityMatrix", + "normalMatrix", + "microSurfaceSamplerMatrix", + "bumpMatrix", + "lightmapMatrix", + "vLightingIntensity", + "logarithmicDepthConstant", + "vSphericalX", + "vSphericalY", + "vSphericalZ", + "vSphericalXX_ZZ", + "vSphericalYY_ZZ", + "vSphericalZZ", + "vSphericalXY", + "vSphericalYZ", + "vSphericalZX", + "vSphericalL00", + "vSphericalL1_1", + "vSphericalL10", + "vSphericalL11", + "vSphericalL2_2", + "vSphericalL2_1", + "vSphericalL20", + "vSphericalL21", + "vSphericalL22", + "vReflectionMicrosurfaceInfos", + "vTangentSpaceParams", + "boneTextureWidth", + "vDebugMode", + ], + f = [ + "albedoSampler", + "reflectivitySampler", + "ambientSampler", + "emissiveSampler", + "bumpSampler", + "lightmapSampler", + "opacitySampler", + "reflectionSampler", + "reflectionSamplerLow", + "reflectionSamplerHigh", + "microSurfaceSampler", + "environmentBrdfSampler", + "boneSampler", + ], + d = ["Material", "Scene"]; + cr.AddUniforms(h), cr.AddSamplers(f), rr.AddUniforms(h), rr.AddSamplers(f), @@ -71727,191 +96389,351 @@ and limitations under the License. or.AddSamplers(f), sr.AddUniforms(h), sr.AddSamplers(f), - yi.a && (yi.a.PrepareUniforms(h, t), - yi.a.PrepareSamplers(f, t)), + yi.a && + (yi.a.PrepareUniforms(h, t), + yi.a.PrepareSamplers(f, t)), Yn.a.PrepareUniformsAndSamplersList({ - uniformsNames: h, - uniformBuffersNames: d, - samplers: f, - defines: t, - maxSimultaneousLights: this._maxSimultaneousLights + uniformsNames: h, + uniformBuffersNames: d, + samplers: f, + defines: t, + maxSimultaneousLights: this._maxSimultaneousLights, }), - this.customShaderNameResolve && (l = this.customShaderNameResolve(l, h, d, f, t)); - var p = t.toString(); - return a.createEffect(l, { - attributes: u, - uniformsNames: h, - uniformBuffersNames: d, - samplers: f, - defines: p, - fallbacks: s, - onCompiled: i, - onError: n, - indexParameters: { - maxSimultaneousLights: this._maxSimultaneousLights, - maxSimultaneousMorphTargets: t.NUM_MORPH_INFLUENCERS - } - }, a) - } - , - t.prototype._prepareDefines = function(e, i, n, r) { - void 0 === n && (n = null), - void 0 === r && (r = null); - var o = this.getScene() - , a = o.getEngine(); - if (Yn.a.PrepareDefinesForLights(o, e, i, true, this._maxSimultaneousLights, this._disableLighting), - i._needNormals = true, + this.customShaderNameResolve && + (l = this.customShaderNameResolve(l, h, d, f, t)); + var p = t.toString(); + return a.createEffect( + l, + { + attributes: u, + uniformsNames: h, + uniformBuffersNames: d, + samplers: f, + defines: p, + fallbacks: s, + onCompiled: i, + onError: n, + indexParameters: { + maxSimultaneousLights: this._maxSimultaneousLights, + maxSimultaneousMorphTargets: + t.NUM_MORPH_INFLUENCERS, + }, + }, + a + ); + }), + (t.prototype._prepareDefines = function (e, i, n, r) { + void 0 === n && (n = null), void 0 === r && (r = null); + var o = this.getScene(), + a = o.getEngine(); + if ( + (Yn.a.PrepareDefinesForLights( + o, + e, + i, + true, + this._maxSimultaneousLights, + this._disableLighting + ), + (i._needNormals = true), Yn.a.PrepareDefinesForMultiview(o, i), - i.METALLICWORKFLOW = this.isMetallicWorkflow(), - i._areTexturesDirty) { - if (i._needUVs = false, - o.texturesEnabled) { - o.getEngine().getCaps().textureLOD && (i.LODBASEDMICROSFURACE = true), - this._albedoTexture && qn.a.DiffuseTextureEnabled ? Yn.a.PrepareDefinesForMergedUV(this._albedoTexture, i, "ALBEDO") : i.ALBEDO = false, - this._ambientTexture && qn.a.AmbientTextureEnabled ? (Yn.a.PrepareDefinesForMergedUV(this._ambientTexture, i, "AMBIENT"), - i.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale) : i.AMBIENT = false, - this._opacityTexture && qn.a.OpacityTextureEnabled ? (Yn.a.PrepareDefinesForMergedUV(this._opacityTexture, i, "OPACITY"), - i.OPACITYRGB = this._opacityTexture.getAlphaFromRGB) : i.OPACITY = false; - var s = this._getReflectionTexture(); - if (s && qn.a.ReflectionTextureEnabled) { - switch (i.REFLECTION = true, - i.GAMMAREFLECTION = s.gammaSpace, - i.RGBDREFLECTION = s.isRGBD, - i.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !s.invertZ : s.invertZ, - i.LODINREFLECTIONALPHA = s.lodLevelInAlpha, - s.coordinatesMode === je.a.INVCUBIC_MODE && (i.INVERTCUBICMAP = true), - i.REFLECTIONMAP_3D = s.isCube, - i.REFLECTIONMAP_CUBIC = false, - i.REFLECTIONMAP_EXPLICIT = false, - i.REFLECTIONMAP_PLANAR = false, - i.REFLECTIONMAP_PROJECTION = false, - i.REFLECTIONMAP_SKYBOX = false, - i.REFLECTIONMAP_SPHERICAL = false, - i.REFLECTIONMAP_EQUIRECTANGULAR = false, - i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false, - i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false, - i.REFLECTIONMAP_SKYBOX_TRANSFORMED = false, - s.coordinatesMode) { - case je.a.EXPLICIT_MODE: - i.REFLECTIONMAP_EXPLICIT = true; - break; - case je.a.PLANAR_MODE: - i.REFLECTIONMAP_PLANAR = true; - break; - case je.a.PROJECTION_MODE: - i.REFLECTIONMAP_PROJECTION = true; - break; - case je.a.SKYBOX_MODE: - i.REFLECTIONMAP_SKYBOX = true; - break; - case je.a.SPHERICAL_MODE: - i.REFLECTIONMAP_SPHERICAL = true; - break; - case je.a.EQUIRECTANGULAR_MODE: - i.REFLECTIONMAP_EQUIRECTANGULAR = true; - break; - case je.a.FIXED_EQUIRECTANGULAR_MODE: - i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true; - break; - case je.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE: - i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true; - break; - case je.a.CUBIC_MODE: - case je.a.INVCUBIC_MODE: - default: - i.REFLECTIONMAP_CUBIC = true, - i.USE_LOCAL_REFLECTIONMAP_CUBIC = !!s.boundingBoxSize - } - s.coordinatesMode !== je.a.SKYBOX_MODE ? s.sphericalPolynomial && (i.USESPHERICALFROMREFLECTIONMAP = true, - this._forceIrradianceInFragment || o.getEngine().getCaps().maxVaryingVectors <= 8 ? i.USESPHERICALINVERTEX = false : i.USESPHERICALINVERTEX = true) : i.REFLECTIONMAP_SKYBOX_TRANSFORMED = !s.getReflectionTextureMatrix().isIdentity() - } else - i.REFLECTION = false, - i.REFLECTIONMAP_3D = false, - i.REFLECTIONMAP_SPHERICAL = false, - i.REFLECTIONMAP_PLANAR = false, - i.REFLECTIONMAP_CUBIC = false, - i.USE_LOCAL_REFLECTIONMAP_CUBIC = false, - i.REFLECTIONMAP_PROJECTION = false, - i.REFLECTIONMAP_SKYBOX = false, - i.REFLECTIONMAP_SKYBOX_TRANSFORMED = false, - i.REFLECTIONMAP_EXPLICIT = false, - i.REFLECTIONMAP_EQUIRECTANGULAR = false, - i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false, - i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false, - i.INVERTCUBICMAP = false, - i.USESPHERICALFROMREFLECTIONMAP = false, - i.USESPHERICALINVERTEX = false, - i.REFLECTIONMAP_OPPOSITEZ = false, - i.LODINREFLECTIONALPHA = false, - i.GAMMAREFLECTION = false, - i.RGBDREFLECTION = false; - this._lightmapTexture && qn.a.LightmapTextureEnabled ? (Yn.a.PrepareDefinesForMergedUV(this._lightmapTexture, i, "LIGHTMAP"), - i.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap, - i.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace) : i.LIGHTMAP = false, - this._emissiveTexture && qn.a.EmissiveTextureEnabled ? Yn.a.PrepareDefinesForMergedUV(this._emissiveTexture, i, "EMISSIVE") : i.EMISSIVE = false, - qn.a.SpecularTextureEnabled ? (this._metallicTexture ? (Yn.a.PrepareDefinesForMergedUV(this._metallicTexture, i, "REFLECTIVITY"), - i.ROUGHNESSSTOREINMETALMAPALPHA = this._useRoughnessFromMetallicTextureAlpha, - i.ROUGHNESSSTOREINMETALMAPGREEN = !this._useRoughnessFromMetallicTextureAlpha && this._useRoughnessFromMetallicTextureGreen, - i.METALLNESSSTOREINMETALMAPBLUE = this._useMetallnessFromMetallicTextureBlue, - i.AOSTOREINMETALMAPRED = this._useAmbientOcclusionFromMetallicTextureRed) : this._reflectivityTexture ? (Yn.a.PrepareDefinesForMergedUV(this._reflectivityTexture, i, "REFLECTIVITY"), - i.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha, - i.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap) : i.REFLECTIVITY = false, - this._microSurfaceTexture ? Yn.a.PrepareDefinesForMergedUV(this._microSurfaceTexture, i, "MICROSURFACEMAP") : i.MICROSURFACEMAP = false) : (i.REFLECTIVITY = false, - i.MICROSURFACEMAP = false), - o.getEngine().getCaps().standardDerivatives && this._bumpTexture && qn.a.BumpTextureEnabled && !this._disableBumpMap ? (Yn.a.PrepareDefinesForMergedUV(this._bumpTexture, i, "BUMP"), - this._useParallax && this._albedoTexture && qn.a.DiffuseTextureEnabled ? (i.PARALLAX = true, - i.PARALLAXOCCLUSION = !!this._useParallaxOcclusion) : i.PARALLAX = false, - i.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap) : i.BUMP = false, - this._environmentBRDFTexture && qn.a.ReflectionTextureEnabled ? (i.ENVIRONMENTBRDF = true, - i.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD) : (i.ENVIRONMENTBRDF = false, - i.ENVIRONMENTBRDF_RGBD = false), - this._shouldUseAlphaFromAlbedoTexture() ? i.ALPHAFROMALBEDO = true : i.ALPHAFROMALBEDO = false + (i.METALLICWORKFLOW = this.isMetallicWorkflow()), + i._areTexturesDirty) + ) { + if (((i._needUVs = false), o.texturesEnabled)) { + o.getEngine().getCaps().textureLOD && + (i.LODBASEDMICROSFURACE = true), + this._albedoTexture && qn.a.DiffuseTextureEnabled + ? Yn.a.PrepareDefinesForMergedUV( + this._albedoTexture, + i, + "ALBEDO" + ) + : (i.ALBEDO = false), + this._ambientTexture && qn.a.AmbientTextureEnabled + ? (Yn.a.PrepareDefinesForMergedUV( + this._ambientTexture, + i, + "AMBIENT" + ), + (i.AMBIENTINGRAYSCALE = + this._useAmbientInGrayScale)) + : (i.AMBIENT = false), + this._opacityTexture && qn.a.OpacityTextureEnabled + ? (Yn.a.PrepareDefinesForMergedUV( + this._opacityTexture, + i, + "OPACITY" + ), + (i.OPACITYRGB = + this._opacityTexture.getAlphaFromRGB)) + : (i.OPACITY = false); + var s = this._getReflectionTexture(); + if (s && qn.a.ReflectionTextureEnabled) { + switch ( + ((i.REFLECTION = true), + (i.GAMMAREFLECTION = s.gammaSpace), + (i.RGBDREFLECTION = s.isRGBD), + (i.REFLECTIONMAP_OPPOSITEZ = this.getScene() + .useRightHandedSystem + ? !s.invertZ + : s.invertZ), + (i.LODINREFLECTIONALPHA = s.lodLevelInAlpha), + s.coordinatesMode === je.a.INVCUBIC_MODE && + (i.INVERTCUBICMAP = true), + (i.REFLECTIONMAP_3D = s.isCube), + (i.REFLECTIONMAP_CUBIC = false), + (i.REFLECTIONMAP_EXPLICIT = false), + (i.REFLECTIONMAP_PLANAR = false), + (i.REFLECTIONMAP_PROJECTION = false), + (i.REFLECTIONMAP_SKYBOX = false), + (i.REFLECTIONMAP_SPHERICAL = false), + (i.REFLECTIONMAP_EQUIRECTANGULAR = false), + (i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false), + (i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false), + (i.REFLECTIONMAP_SKYBOX_TRANSFORMED = false), + s.coordinatesMode) + ) { + case je.a.EXPLICIT_MODE: + i.REFLECTIONMAP_EXPLICIT = true; + break; + case je.a.PLANAR_MODE: + i.REFLECTIONMAP_PLANAR = true; + break; + case je.a.PROJECTION_MODE: + i.REFLECTIONMAP_PROJECTION = true; + break; + case je.a.SKYBOX_MODE: + i.REFLECTIONMAP_SKYBOX = true; + break; + case je.a.SPHERICAL_MODE: + i.REFLECTIONMAP_SPHERICAL = true; + break; + case je.a.EQUIRECTANGULAR_MODE: + i.REFLECTIONMAP_EQUIRECTANGULAR = true; + break; + case je.a.FIXED_EQUIRECTANGULAR_MODE: + i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true; + break; + case je.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE: + i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true; + break; + case je.a.CUBIC_MODE: + case je.a.INVCUBIC_MODE: + default: + (i.REFLECTIONMAP_CUBIC = true), + (i.USE_LOCAL_REFLECTIONMAP_CUBIC = + !!s.boundingBoxSize); } - i.SPECULAROVERALPHA = this._useSpecularOverAlpha, - this._lightFalloff === t.LIGHTFALLOFF_STANDARD ? (i.USEPHYSICALLIGHTFALLOFF = false, - i.USEGLTFLIGHTFALLOFF = false) : this._lightFalloff === t.LIGHTFALLOFF_GLTF ? (i.USEPHYSICALLIGHTFALLOFF = false, - i.USEGLTFLIGHTFALLOFF = true) : (i.USEPHYSICALLIGHTFALLOFF = true, - i.USEGLTFLIGHTFALLOFF = false), - i.RADIANCEOVERALPHA = this._useRadianceOverAlpha, - !this.backFaceCulling && this._twoSidedLighting ? i.TWOSIDEDLIGHTING = true : i.TWOSIDEDLIGHTING = false, - i.ALPHATESTVALUE = this._alphaCutOff + (this._alphaCutOff % 1 == 0 ? "." : ""), - i.PREMULTIPLYALPHA = this.alphaMode === _.a.ALPHA_PREMULTIPLIED || this.alphaMode === _.a.ALPHA_PREMULTIPLIED_PORTERDUFF, - i.ALPHABLEND = this.needAlphaBlendingForMesh(e), - i.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel, - i.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel, - i.SPECULARAA = o.getEngine().getCaps().standardDerivatives && this._enableSpecularAntiAliasing + s.coordinatesMode !== je.a.SKYBOX_MODE + ? s.sphericalPolynomial && + ((i.USESPHERICALFROMREFLECTIONMAP = true), + this._forceIrradianceInFragment || + o.getEngine().getCaps().maxVaryingVectors <= 8 + ? (i.USESPHERICALINVERTEX = false) + : (i.USESPHERICALINVERTEX = true)) + : (i.REFLECTIONMAP_SKYBOX_TRANSFORMED = !s + .getReflectionTextureMatrix() + .isIdentity()); + } else + (i.REFLECTION = false), + (i.REFLECTIONMAP_3D = false), + (i.REFLECTIONMAP_SPHERICAL = false), + (i.REFLECTIONMAP_PLANAR = false), + (i.REFLECTIONMAP_CUBIC = false), + (i.USE_LOCAL_REFLECTIONMAP_CUBIC = false), + (i.REFLECTIONMAP_PROJECTION = false), + (i.REFLECTIONMAP_SKYBOX = false), + (i.REFLECTIONMAP_SKYBOX_TRANSFORMED = false), + (i.REFLECTIONMAP_EXPLICIT = false), + (i.REFLECTIONMAP_EQUIRECTANGULAR = false), + (i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false), + (i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false), + (i.INVERTCUBICMAP = false), + (i.USESPHERICALFROMREFLECTIONMAP = false), + (i.USESPHERICALINVERTEX = false), + (i.REFLECTIONMAP_OPPOSITEZ = false), + (i.LODINREFLECTIONALPHA = false), + (i.GAMMAREFLECTION = false), + (i.RGBDREFLECTION = false); + this._lightmapTexture && qn.a.LightmapTextureEnabled + ? (Yn.a.PrepareDefinesForMergedUV( + this._lightmapTexture, + i, + "LIGHTMAP" + ), + (i.USELIGHTMAPASSHADOWMAP = + this._useLightmapAsShadowmap), + (i.GAMMALIGHTMAP = + this._lightmapTexture.gammaSpace)) + : (i.LIGHTMAP = false), + this._emissiveTexture && qn.a.EmissiveTextureEnabled + ? Yn.a.PrepareDefinesForMergedUV( + this._emissiveTexture, + i, + "EMISSIVE" + ) + : (i.EMISSIVE = false), + qn.a.SpecularTextureEnabled + ? (this._metallicTexture + ? (Yn.a.PrepareDefinesForMergedUV( + this._metallicTexture, + i, + "REFLECTIVITY" + ), + (i.ROUGHNESSSTOREINMETALMAPALPHA = + this._useRoughnessFromMetallicTextureAlpha), + (i.ROUGHNESSSTOREINMETALMAPGREEN = + !this + ._useRoughnessFromMetallicTextureAlpha && + this + ._useRoughnessFromMetallicTextureGreen), + (i.METALLNESSSTOREINMETALMAPBLUE = + this._useMetallnessFromMetallicTextureBlue), + (i.AOSTOREINMETALMAPRED = + this._useAmbientOcclusionFromMetallicTextureRed)) + : this._reflectivityTexture + ? (Yn.a.PrepareDefinesForMergedUV( + this._reflectivityTexture, + i, + "REFLECTIVITY" + ), + (i.MICROSURFACEFROMREFLECTIVITYMAP = + this._useMicroSurfaceFromReflectivityMapAlpha), + (i.MICROSURFACEAUTOMATIC = + this._useAutoMicroSurfaceFromReflectivityMap)) + : (i.REFLECTIVITY = false), + this._microSurfaceTexture + ? Yn.a.PrepareDefinesForMergedUV( + this._microSurfaceTexture, + i, + "MICROSURFACEMAP" + ) + : (i.MICROSURFACEMAP = false)) + : ((i.REFLECTIVITY = false), + (i.MICROSURFACEMAP = false)), + o.getEngine().getCaps().standardDerivatives && + this._bumpTexture && + qn.a.BumpTextureEnabled && + !this._disableBumpMap + ? (Yn.a.PrepareDefinesForMergedUV( + this._bumpTexture, + i, + "BUMP" + ), + this._useParallax && + this._albedoTexture && + qn.a.DiffuseTextureEnabled + ? ((i.PARALLAX = true), + (i.PARALLAXOCCLUSION = + !!this._useParallaxOcclusion)) + : (i.PARALLAX = false), + (i.OBJECTSPACE_NORMALMAP = + this._useObjectSpaceNormalMap)) + : (i.BUMP = false), + this._environmentBRDFTexture && + qn.a.ReflectionTextureEnabled + ? ((i.ENVIRONMENTBRDF = true), + (i.ENVIRONMENTBRDF_RGBD = + this._environmentBRDFTexture.isRGBD)) + : ((i.ENVIRONMENTBRDF = false), + (i.ENVIRONMENTBRDF_RGBD = false)), + this._shouldUseAlphaFromAlbedoTexture() + ? (i.ALPHAFROMALBEDO = true) + : (i.ALPHAFROMALBEDO = false); } - i._areImageProcessingDirty && this._imageProcessingConfiguration && this._imageProcessingConfiguration.prepareDefines(i), - i.FORCENORMALFORWARD = this._forceNormalForward, - i.RADIANCEOCCLUSION = this._useRadianceOcclusion, - i.HORIZONOCCLUSION = this._useHorizonOcclusion, - i._areMiscDirty && (Yn.a.PrepareDefinesForMisc(e, o, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(e) || this._forceAlphaTest, i), - i.UNLIT = this._unlit || (this.pointsCloud || this.wireframe) && !e.isVerticesDataPresent(Si.b.NormalKind), - i.DEBUGMODE = this._debugMode), + (i.SPECULAROVERALPHA = this._useSpecularOverAlpha), + this._lightFalloff === t.LIGHTFALLOFF_STANDARD + ? ((i.USEPHYSICALLIGHTFALLOFF = false), + (i.USEGLTFLIGHTFALLOFF = false)) + : this._lightFalloff === t.LIGHTFALLOFF_GLTF + ? ((i.USEPHYSICALLIGHTFALLOFF = false), + (i.USEGLTFLIGHTFALLOFF = true)) + : ((i.USEPHYSICALLIGHTFALLOFF = true), + (i.USEGLTFLIGHTFALLOFF = false)), + (i.RADIANCEOVERALPHA = this._useRadianceOverAlpha), + !this.backFaceCulling && this._twoSidedLighting + ? (i.TWOSIDEDLIGHTING = true) + : (i.TWOSIDEDLIGHTING = false), + (i.ALPHATESTVALUE = + this._alphaCutOff + + (this._alphaCutOff % 1 == 0 ? "." : "")), + (i.PREMULTIPLYALPHA = + this.alphaMode === _.a.ALPHA_PREMULTIPLIED || + this.alphaMode === + _.a.ALPHA_PREMULTIPLIED_PORTERDUFF), + (i.ALPHABLEND = this.needAlphaBlendingForMesh(e)), + (i.ALPHAFRESNEL = + this._useAlphaFresnel || + this._useLinearAlphaFresnel), + (i.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel), + (i.SPECULARAA = + o.getEngine().getCaps().standardDerivatives && + this._enableSpecularAntiAliasing); + } + i._areImageProcessingDirty && + this._imageProcessingConfiguration && + this._imageProcessingConfiguration.prepareDefines(i), + (i.FORCENORMALFORWARD = this._forceNormalForward), + (i.RADIANCEOCCLUSION = this._useRadianceOcclusion), + (i.HORIZONOCCLUSION = this._useHorizonOcclusion), + i._areMiscDirty && + (Yn.a.PrepareDefinesForMisc( + e, + o, + this._useLogarithmicDepth, + this.pointsCloud, + this.fogEnabled, + this._shouldTurnAlphaTestOn(e) || + this._forceAlphaTest, + i + ), + (i.UNLIT = + this._unlit || + ((this.pointsCloud || this.wireframe) && + !e.isVerticesDataPresent(Si.b.NormalKind))), + (i.DEBUGMODE = this._debugMode)), this.subSurface.prepareDefines(i, o), this.clearCoat.prepareDefines(i, o), this.anisotropy.prepareDefines(i, e, o), this.brdf.prepareDefines(i), this.sheen.prepareDefines(i, o), Yn.a.PrepareDefinesForFrameBoundValues(o, a, i, !!n, r), - Yn.a.PrepareDefinesForAttributes(e, i, true, true, true, this._transparencyMode !== t.PBRMATERIAL_OPAQUE) - } - , - t.prototype.forceCompilation = function(e, t, i) { - var n = this - , r = h.a({ - clipPlane: false - }, i) - , o = new ur - , a = this._prepareEffect(e, o, void 0, void 0, void 0, r.clipPlane); - a.isReady() ? t && t(this) : a.onCompileObservable.add(function() { - t && t(n) - }) - } - , - t.prototype.buildUniformLayout = function() { - var e = this._uniformBuffer; - e.addUniform("vAlbedoInfos", 2), + Yn.a.PrepareDefinesForAttributes( + e, + i, + true, + true, + true, + this._transparencyMode !== t.PBRMATERIAL_OPAQUE + ); + }), + (t.prototype.forceCompilation = function (e, t, i) { + var n = this, + r = h.a( + { + clipPlane: false, + }, + i + ), + o = new ur(), + a = this._prepareEffect( + e, + o, + void 0, + void 0, + void 0, + r.clipPlane + ); + a.isReady() + ? t && t(this) + : a.onCompileObservable.add(function () { + t && t(n); + }); + }), + (t.prototype.buildUniformLayout = function () { + var e = this._uniformBuffer; + e.addUniform("vAlbedoInfos", 2), e.addUniform("vAmbientInfos", 4), e.addUniform("vOpacityInfos", 2), e.addUniform("vEmissiveInfos", 2), @@ -71944,174 +96766,581 @@ and limitations under the License. or.PrepareUniformBuffer(e), sr.PrepareUniformBuffer(e), cr.PrepareUniformBuffer(e), - e.create() - } - , - t.prototype.unbind = function() { - if (this._activeEffect) { - var t = false; - this._reflectionTexture && this._reflectionTexture.isRenderTarget && (this._activeEffect.setTexture("reflection2DSampler", null), - t = true), - this.subSurface.unbind(this._activeEffect) && (t = true), - t && this._markAllSubMeshesAsTexturesDirty() - } - e.prototype.unbind.call(this) - } - , - t.prototype.bindForSubMesh = function(e, i, n) { - var r = this.getScene() - , o = n._materialDefines; - if (o) { - var s = n.effect; - if (s) { - this._activeEffect = s, - o.INSTANCES || this.bindOnlyWorldMatrix(e), - o.OBJECTSPACE_NORMALMAP && (e.toNormalMatrix(this._normalMatrix), - this.bindOnlyNormalMatrix(this._normalMatrix)); - var c = this._mustRebind(r, s, i.visibility); - Yn.a.BindBonesParameters(i, this._activeEffect); - var u = null - , l = this._uniformBuffer; - if (c) { - var h = r.getEngine(); - if (l.bindToEffect(s, "Material"), - this.bindViewProjection(s), - u = this._getReflectionTexture(), - !l.useUbo || !this.isFrozen || !l.isSync) { - if (r.texturesEnabled) { - if (this._albedoTexture && qn.a.DiffuseTextureEnabled && (l.updateFloat2("vAlbedoInfos", this._albedoTexture.coordinatesIndex, this._albedoTexture.level), - Yn.a.BindTextureMatrix(this._albedoTexture, l, "albedo")), - this._ambientTexture && qn.a.AmbientTextureEnabled && (l.updateFloat4("vAmbientInfos", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights), - Yn.a.BindTextureMatrix(this._ambientTexture, l, "ambient")), - this._opacityTexture && qn.a.OpacityTextureEnabled && (l.updateFloat2("vOpacityInfos", this._opacityTexture.coordinatesIndex, this._opacityTexture.level), - Yn.a.BindTextureMatrix(this._opacityTexture, l, "opacity")), - u && qn.a.ReflectionTextureEnabled) { - if (l.updateMatrix("reflectionMatrix", u.getReflectionTextureMatrix()), - l.updateFloat2("vReflectionInfos", u.level, 0), - u.boundingBoxSize) { - var f = u; - l.updateVector3("vReflectionPosition", f.boundingBoxPosition), - l.updateVector3("vReflectionSize", f.boundingBoxSize) - } - var d = u.sphericalPolynomial; - if (o.USESPHERICALFROMREFLECTIONMAP && d) - if (o.SPHERICAL_HARMONICS) { - var p = d.preScaledHarmonics; - this._activeEffect.setVector3("vSphericalL00", p.l00), - this._activeEffect.setVector3("vSphericalL1_1", p.l1_1), - this._activeEffect.setVector3("vSphericalL10", p.l10), - this._activeEffect.setVector3("vSphericalL11", p.l11), - this._activeEffect.setVector3("vSphericalL2_2", p.l2_2), - this._activeEffect.setVector3("vSphericalL2_1", p.l2_1), - this._activeEffect.setVector3("vSphericalL20", p.l20), - this._activeEffect.setVector3("vSphericalL21", p.l21), - this._activeEffect.setVector3("vSphericalL22", p.l22) - } else - this._activeEffect.setFloat3("vSphericalX", d.x.x, d.x.y, d.x.z), - this._activeEffect.setFloat3("vSphericalY", d.y.x, d.y.y, d.y.z), - this._activeEffect.setFloat3("vSphericalZ", d.z.x, d.z.y, d.z.z), - this._activeEffect.setFloat3("vSphericalXX_ZZ", d.xx.x - d.zz.x, d.xx.y - d.zz.y, d.xx.z - d.zz.z), - this._activeEffect.setFloat3("vSphericalYY_ZZ", d.yy.x - d.zz.x, d.yy.y - d.zz.y, d.yy.z - d.zz.z), - this._activeEffect.setFloat3("vSphericalZZ", d.zz.x, d.zz.y, d.zz.z), - this._activeEffect.setFloat3("vSphericalXY", d.xy.x, d.xy.y, d.xy.z), - this._activeEffect.setFloat3("vSphericalYZ", d.yz.x, d.yz.y, d.yz.z), - this._activeEffect.setFloat3("vSphericalZX", d.zx.x, d.zx.y, d.zx.z); - l.updateFloat3("vReflectionMicrosurfaceInfos", u.getSize().width, u.lodGenerationScale, u.lodGenerationOffset) - } - this._emissiveTexture && qn.a.EmissiveTextureEnabled && (l.updateFloat2("vEmissiveInfos", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level), - Yn.a.BindTextureMatrix(this._emissiveTexture, l, "emissive")), - this._lightmapTexture && qn.a.LightmapTextureEnabled && (l.updateFloat2("vLightmapInfos", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level), - Yn.a.BindTextureMatrix(this._lightmapTexture, l, "lightmap")), - qn.a.SpecularTextureEnabled && (this._metallicTexture ? (l.updateFloat3("vReflectivityInfos", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength), - Yn.a.BindTextureMatrix(this._metallicTexture, l, "reflectivity")) : this._reflectivityTexture && (l.updateFloat3("vReflectivityInfos", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1), - Yn.a.BindTextureMatrix(this._reflectivityTexture, l, "reflectivity")), - this._microSurfaceTexture && (l.updateFloat2("vMicroSurfaceSamplerInfos", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level), - Yn.a.BindTextureMatrix(this._microSurfaceTexture, l, "microSurfaceSampler"))), - this._bumpTexture && h.getCaps().standardDerivatives && qn.a.BumpTextureEnabled && !this._disableBumpMap && (l.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias), - Yn.a.BindTextureMatrix(this._bumpTexture, l, "bump"), - r._mirroredCameraPosition ? l.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? 1 : -1, this._invertNormalMapY ? 1 : -1) : l.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? -1 : 1, this._invertNormalMapY ? -1 : 1)) - } - this.pointsCloud && l.updateFloat("pointSize", this.pointSize), - o.METALLICWORKFLOW ? (a.t.Color3[0].r = void 0 === this._metallic || null === this._metallic ? 1 : this._metallic, - a.t.Color3[0].g = void 0 === this._roughness || null === this._roughness ? 1 : this._roughness, - l.updateColor4("vReflectivityColor", a.t.Color3[0], 0)) : l.updateColor4("vReflectivityColor", this._reflectivityColor, this._microSurface), - l.updateColor3("vEmissiveColor", qn.a.EmissiveTextureEnabled ? this._emissiveColor : a.e.BlackReadOnly), - l.updateColor3("vReflectionColor", this._reflectionColor), - l.updateColor4("vAlbedoColor", this._albedoColor, this.alpha), - l.updateFloat("visibility", i.visibility), - this._lightingInfos.x = this._directIntensity, - this._lightingInfos.y = this._emissiveIntensity, - this._lightingInfos.z = this._environmentIntensity, - this._lightingInfos.w = this._specularIntensity, - l.updateVector4("vLightingIntensity", this._lightingInfos) - } - r.texturesEnabled && (this._albedoTexture && qn.a.DiffuseTextureEnabled && l.setTexture("albedoSampler", this._albedoTexture), - this._ambientTexture && qn.a.AmbientTextureEnabled && l.setTexture("ambientSampler", this._ambientTexture), - this._opacityTexture && qn.a.OpacityTextureEnabled && l.setTexture("opacitySampler", this._opacityTexture), - u && qn.a.ReflectionTextureEnabled && (o.LODBASEDMICROSFURACE ? l.setTexture("reflectionSampler", u) : (l.setTexture("reflectionSampler", u._lodTextureMid || u), - l.setTexture("reflectionSamplerLow", u._lodTextureLow || u), - l.setTexture("reflectionSamplerHigh", u._lodTextureHigh || u))), - o.ENVIRONMENTBRDF && l.setTexture("environmentBrdfSampler", this._environmentBRDFTexture), - this._emissiveTexture && qn.a.EmissiveTextureEnabled && l.setTexture("emissiveSampler", this._emissiveTexture), - this._lightmapTexture && qn.a.LightmapTextureEnabled && l.setTexture("lightmapSampler", this._lightmapTexture), - qn.a.SpecularTextureEnabled && (this._metallicTexture ? l.setTexture("reflectivitySampler", this._metallicTexture) : this._reflectivityTexture && l.setTexture("reflectivitySampler", this._reflectivityTexture), - this._microSurfaceTexture && l.setTexture("microSurfaceSampler", this._microSurfaceTexture)), - this._bumpTexture && h.getCaps().standardDerivatives && qn.a.BumpTextureEnabled && !this._disableBumpMap && l.setTexture("bumpSampler", this._bumpTexture)), - this.subSurface.bindForSubMesh(l, r, h, this.isFrozen, o.LODBASEDMICROSFURACE), - this.clearCoat.bindForSubMesh(l, r, h, this._disableBumpMap, this.isFrozen, this._invertNormalMapX, this._invertNormalMapY), - this.anisotropy.bindForSubMesh(l, r, this.isFrozen), - this.sheen.bindForSubMesh(l, r, this.isFrozen), - Yn.a.BindClipPlane(this._activeEffect, r), - r.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor); - var m = r._forcedViewPosition ? r._forcedViewPosition : r._mirroredCameraPosition ? r._mirroredCameraPosition : r.activeCamera.globalPosition - , g = r.useRightHandedSystem === (null != r._mirroredCameraPosition); - s.setFloat4("vEyePosition", m.x, m.y, m.z, g ? -1 : 1), - s.setColor3("vAmbientColor", this._globalAmbientColor), - s.setFloat2("vDebugMode", this.debugLimit, this.debugFactor) + e.create(); + }), + (t.prototype.unbind = function () { + if (this._activeEffect) { + var t = false; + this._reflectionTexture && + this._reflectionTexture.isRenderTarget && + (this._activeEffect.setTexture( + "reflection2DSampler", + null + ), + (t = true)), + this.subSurface.unbind(this._activeEffect) && + (t = true), + t && this._markAllSubMeshesAsTexturesDirty(); + } + e.prototype.unbind.call(this); + }), + (t.prototype.bindForSubMesh = function (e, i, n) { + var r = this.getScene(), + o = n._materialDefines; + if (o) { + var s = n.effect; + if (s) { + (this._activeEffect = s), + o.INSTANCES || this.bindOnlyWorldMatrix(e), + o.OBJECTSPACE_NORMALMAP && + (e.toNormalMatrix(this._normalMatrix), + this.bindOnlyNormalMatrix(this._normalMatrix)); + var c = this._mustRebind(r, s, i.visibility); + Yn.a.BindBonesParameters(i, this._activeEffect); + var u = null, + l = this._uniformBuffer; + if (c) { + var h = r.getEngine(); + if ( + (l.bindToEffect(s, "Material"), + this.bindViewProjection(s), + (u = this._getReflectionTexture()), + !l.useUbo || !this.isFrozen || !l.isSync) + ) { + if (r.texturesEnabled) { + if ( + (this._albedoTexture && + qn.a.DiffuseTextureEnabled && + (l.updateFloat2( + "vAlbedoInfos", + this._albedoTexture.coordinatesIndex, + this._albedoTexture.level + ), + Yn.a.BindTextureMatrix( + this._albedoTexture, + l, + "albedo" + )), + this._ambientTexture && + qn.a.AmbientTextureEnabled && + (l.updateFloat4( + "vAmbientInfos", + this._ambientTexture.coordinatesIndex, + this._ambientTexture.level, + this._ambientTextureStrength, + this + ._ambientTextureImpactOnAnalyticalLights + ), + Yn.a.BindTextureMatrix( + this._ambientTexture, + l, + "ambient" + )), + this._opacityTexture && + qn.a.OpacityTextureEnabled && + (l.updateFloat2( + "vOpacityInfos", + this._opacityTexture.coordinatesIndex, + this._opacityTexture.level + ), + Yn.a.BindTextureMatrix( + this._opacityTexture, + l, + "opacity" + )), + u && qn.a.ReflectionTextureEnabled) + ) { + if ( + (l.updateMatrix( + "reflectionMatrix", + u.getReflectionTextureMatrix() + ), + l.updateFloat2( + "vReflectionInfos", + u.level, + 0 + ), + u.boundingBoxSize) + ) { + var f = u; + l.updateVector3( + "vReflectionPosition", + f.boundingBoxPosition + ), + l.updateVector3( + "vReflectionSize", + f.boundingBoxSize + ); + } + var d = u.sphericalPolynomial; + if (o.USESPHERICALFROMREFLECTIONMAP && d) + if (o.SPHERICAL_HARMONICS) { + var p = d.preScaledHarmonics; + this._activeEffect.setVector3( + "vSphericalL00", + p.l00 + ), + this._activeEffect.setVector3( + "vSphericalL1_1", + p.l1_1 + ), + this._activeEffect.setVector3( + "vSphericalL10", + p.l10 + ), + this._activeEffect.setVector3( + "vSphericalL11", + p.l11 + ), + this._activeEffect.setVector3( + "vSphericalL2_2", + p.l2_2 + ), + this._activeEffect.setVector3( + "vSphericalL2_1", + p.l2_1 + ), + this._activeEffect.setVector3( + "vSphericalL20", + p.l20 + ), + this._activeEffect.setVector3( + "vSphericalL21", + p.l21 + ), + this._activeEffect.setVector3( + "vSphericalL22", + p.l22 + ); + } else + this._activeEffect.setFloat3( + "vSphericalX", + d.x.x, + d.x.y, + d.x.z + ), + this._activeEffect.setFloat3( + "vSphericalY", + d.y.x, + d.y.y, + d.y.z + ), + this._activeEffect.setFloat3( + "vSphericalZ", + d.z.x, + d.z.y, + d.z.z + ), + this._activeEffect.setFloat3( + "vSphericalXX_ZZ", + d.xx.x - d.zz.x, + d.xx.y - d.zz.y, + d.xx.z - d.zz.z + ), + this._activeEffect.setFloat3( + "vSphericalYY_ZZ", + d.yy.x - d.zz.x, + d.yy.y - d.zz.y, + d.yy.z - d.zz.z + ), + this._activeEffect.setFloat3( + "vSphericalZZ", + d.zz.x, + d.zz.y, + d.zz.z + ), + this._activeEffect.setFloat3( + "vSphericalXY", + d.xy.x, + d.xy.y, + d.xy.z + ), + this._activeEffect.setFloat3( + "vSphericalYZ", + d.yz.x, + d.yz.y, + d.yz.z + ), + this._activeEffect.setFloat3( + "vSphericalZX", + d.zx.x, + d.zx.y, + d.zx.z + ); + l.updateFloat3( + "vReflectionMicrosurfaceInfos", + u.getSize().width, + u.lodGenerationScale, + u.lodGenerationOffset + ); } - !c && this.isFrozen || (r.lightsEnabled && !this._disableLighting && Yn.a.BindLights(r, i, this._activeEffect, o, this._maxSimultaneousLights, this._lightFalloff !== t.LIGHTFALLOFF_STANDARD), - (r.fogEnabled && i.applyFog && r.fogMode !== Y.a.FOGMODE_NONE || u) && this.bindView(s), - Yn.a.BindFogParameters(r, i, this._activeEffect, true), - o.NUM_MORPH_INFLUENCERS && Yn.a.BindMorphTargetParameters(i, this._activeEffect), - this._imageProcessingConfiguration.bind(this._activeEffect), - Yn.a.BindLogDepth(o, this._activeEffect, r)), - l.update(), - this._afterBind(i, this._activeEffect) + this._emissiveTexture && + qn.a.EmissiveTextureEnabled && + (l.updateFloat2( + "vEmissiveInfos", + this._emissiveTexture.coordinatesIndex, + this._emissiveTexture.level + ), + Yn.a.BindTextureMatrix( + this._emissiveTexture, + l, + "emissive" + )), + this._lightmapTexture && + qn.a.LightmapTextureEnabled && + (l.updateFloat2( + "vLightmapInfos", + this._lightmapTexture.coordinatesIndex, + this._lightmapTexture.level + ), + Yn.a.BindTextureMatrix( + this._lightmapTexture, + l, + "lightmap" + )), + qn.a.SpecularTextureEnabled && + (this._metallicTexture + ? (l.updateFloat3( + "vReflectivityInfos", + this._metallicTexture + .coordinatesIndex, + this._metallicTexture.level, + this._ambientTextureStrength + ), + Yn.a.BindTextureMatrix( + this._metallicTexture, + l, + "reflectivity" + )) + : this._reflectivityTexture && + (l.updateFloat3( + "vReflectivityInfos", + this._reflectivityTexture + .coordinatesIndex, + this._reflectivityTexture.level, + 1 + ), + Yn.a.BindTextureMatrix( + this._reflectivityTexture, + l, + "reflectivity" + )), + this._microSurfaceTexture && + (l.updateFloat2( + "vMicroSurfaceSamplerInfos", + this._microSurfaceTexture + .coordinatesIndex, + this._microSurfaceTexture.level + ), + Yn.a.BindTextureMatrix( + this._microSurfaceTexture, + l, + "microSurfaceSampler" + ))), + this._bumpTexture && + h.getCaps().standardDerivatives && + qn.a.BumpTextureEnabled && + !this._disableBumpMap && + (l.updateFloat3( + "vBumpInfos", + this._bumpTexture.coordinatesIndex, + this._bumpTexture.level, + this._parallaxScaleBias + ), + Yn.a.BindTextureMatrix( + this._bumpTexture, + l, + "bump" + ), + r._mirroredCameraPosition + ? l.updateFloat2( + "vTangentSpaceParams", + this._invertNormalMapX ? 1 : -1, + this._invertNormalMapY ? 1 : -1 + ) + : l.updateFloat2( + "vTangentSpaceParams", + this._invertNormalMapX ? -1 : 1, + this._invertNormalMapY ? -1 : 1 + )); + } + this.pointsCloud && + l.updateFloat("pointSize", this.pointSize), + o.METALLICWORKFLOW + ? ((a.t.Color3[0].r = + void 0 === this._metallic || + null === this._metallic + ? 1 + : this._metallic), + (a.t.Color3[0].g = + void 0 === this._roughness || + null === this._roughness + ? 1 + : this._roughness), + l.updateColor4( + "vReflectivityColor", + a.t.Color3[0], + 0 + )) + : l.updateColor4( + "vReflectivityColor", + this._reflectivityColor, + this._microSurface + ), + l.updateColor3( + "vEmissiveColor", + qn.a.EmissiveTextureEnabled + ? this._emissiveColor + : a.e.BlackReadOnly + ), + l.updateColor3( + "vReflectionColor", + this._reflectionColor + ), + l.updateColor4( + "vAlbedoColor", + this._albedoColor, + this.alpha + ), + l.updateFloat("visibility", i.visibility), + (this._lightingInfos.x = this._directIntensity), + (this._lightingInfos.y = + this._emissiveIntensity), + (this._lightingInfos.z = + this._environmentIntensity), + (this._lightingInfos.w = + this._specularIntensity), + l.updateVector4( + "vLightingIntensity", + this._lightingInfos + ); } + r.texturesEnabled && + (this._albedoTexture && + qn.a.DiffuseTextureEnabled && + l.setTexture( + "albedoSampler", + this._albedoTexture + ), + this._ambientTexture && + qn.a.AmbientTextureEnabled && + l.setTexture( + "ambientSampler", + this._ambientTexture + ), + this._opacityTexture && + qn.a.OpacityTextureEnabled && + l.setTexture( + "opacitySampler", + this._opacityTexture + ), + u && + qn.a.ReflectionTextureEnabled && + (o.LODBASEDMICROSFURACE + ? l.setTexture("reflectionSampler", u) + : (l.setTexture( + "reflectionSampler", + u._lodTextureMid || u + ), + l.setTexture( + "reflectionSamplerLow", + u._lodTextureLow || u + ), + l.setTexture( + "reflectionSamplerHigh", + u._lodTextureHigh || u + ))), + o.ENVIRONMENTBRDF && + l.setTexture( + "environmentBrdfSampler", + this._environmentBRDFTexture + ), + this._emissiveTexture && + qn.a.EmissiveTextureEnabled && + l.setTexture( + "emissiveSampler", + this._emissiveTexture + ), + this._lightmapTexture && + qn.a.LightmapTextureEnabled && + l.setTexture( + "lightmapSampler", + this._lightmapTexture + ), + qn.a.SpecularTextureEnabled && + (this._metallicTexture + ? l.setTexture( + "reflectivitySampler", + this._metallicTexture + ) + : this._reflectivityTexture && + l.setTexture( + "reflectivitySampler", + this._reflectivityTexture + ), + this._microSurfaceTexture && + l.setTexture( + "microSurfaceSampler", + this._microSurfaceTexture + )), + this._bumpTexture && + h.getCaps().standardDerivatives && + qn.a.BumpTextureEnabled && + !this._disableBumpMap && + l.setTexture("bumpSampler", this._bumpTexture)), + this.subSurface.bindForSubMesh( + l, + r, + h, + this.isFrozen, + o.LODBASEDMICROSFURACE + ), + this.clearCoat.bindForSubMesh( + l, + r, + h, + this._disableBumpMap, + this.isFrozen, + this._invertNormalMapX, + this._invertNormalMapY + ), + this.anisotropy.bindForSubMesh( + l, + r, + this.isFrozen + ), + this.sheen.bindForSubMesh(l, r, this.isFrozen), + Yn.a.BindClipPlane(this._activeEffect, r), + r.ambientColor.multiplyToRef( + this._ambientColor, + this._globalAmbientColor + ); + var m = r._forcedViewPosition + ? r._forcedViewPosition + : r._mirroredCameraPosition + ? r._mirroredCameraPosition + : r.activeCamera.globalPosition, + g = + r.useRightHandedSystem === + (null != r._mirroredCameraPosition); + s.setFloat4( + "vEyePosition", + m.x, + m.y, + m.z, + g ? -1 : 1 + ), + s.setColor3( + "vAmbientColor", + this._globalAmbientColor + ), + s.setFloat2( + "vDebugMode", + this.debugLimit, + this.debugFactor + ); + } + (!c && this.isFrozen) || + (r.lightsEnabled && + !this._disableLighting && + Yn.a.BindLights( + r, + i, + this._activeEffect, + o, + this._maxSimultaneousLights, + this._lightFalloff !== t.LIGHTFALLOFF_STANDARD + ), + ((r.fogEnabled && + i.applyFog && + r.fogMode !== Y.a.FOGMODE_NONE) || + u) && + this.bindView(s), + Yn.a.BindFogParameters( + r, + i, + this._activeEffect, + true + ), + o.NUM_MORPH_INFLUENCERS && + Yn.a.BindMorphTargetParameters( + i, + this._activeEffect + ), + this._imageProcessingConfiguration.bind( + this._activeEffect + ), + Yn.a.BindLogDepth(o, this._activeEffect, r)), + l.update(), + this._afterBind(i, this._activeEffect); } - } - , - t.prototype.getAnimatables = function() { - var e = []; - return this._albedoTexture && this._albedoTexture.animations && this._albedoTexture.animations.length > 0 && e.push(this._albedoTexture), - this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0 && e.push(this._ambientTexture), - this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0 && e.push(this._opacityTexture), - this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0 && e.push(this._reflectionTexture), - this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0 && e.push(this._emissiveTexture), - this._metallicTexture && this._metallicTexture.animations && this._metallicTexture.animations.length > 0 ? e.push(this._metallicTexture) : this._reflectivityTexture && this._reflectivityTexture.animations && this._reflectivityTexture.animations.length > 0 && e.push(this._reflectivityTexture), - this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0 && e.push(this._bumpTexture), - this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0 && e.push(this._lightmapTexture), + } + }), + (t.prototype.getAnimatables = function () { + var e = []; + return ( + this._albedoTexture && + this._albedoTexture.animations && + this._albedoTexture.animations.length > 0 && + e.push(this._albedoTexture), + this._ambientTexture && + this._ambientTexture.animations && + this._ambientTexture.animations.length > 0 && + e.push(this._ambientTexture), + this._opacityTexture && + this._opacityTexture.animations && + this._opacityTexture.animations.length > 0 && + e.push(this._opacityTexture), + this._reflectionTexture && + this._reflectionTexture.animations && + this._reflectionTexture.animations.length > 0 && + e.push(this._reflectionTexture), + this._emissiveTexture && + this._emissiveTexture.animations && + this._emissiveTexture.animations.length > 0 && + e.push(this._emissiveTexture), + this._metallicTexture && + this._metallicTexture.animations && + this._metallicTexture.animations.length > 0 + ? e.push(this._metallicTexture) + : this._reflectivityTexture && + this._reflectivityTexture.animations && + this._reflectivityTexture.animations.length > 0 && + e.push(this._reflectivityTexture), + this._bumpTexture && + this._bumpTexture.animations && + this._bumpTexture.animations.length > 0 && + e.push(this._bumpTexture), + this._lightmapTexture && + this._lightmapTexture.animations && + this._lightmapTexture.animations.length > 0 && + e.push(this._lightmapTexture), this.subSurface.getAnimatables(e), this.clearCoat.getAnimatables(e), this.sheen.getAnimatables(e), this.anisotropy.getAnimatables(e), e - } - , - t.prototype._getReflectionTexture = function() { - return this._reflectionTexture ? this._reflectionTexture : this.getScene().environmentTexture - } - , - t.prototype.getActiveTextures = function() { - var t = e.prototype.getActiveTextures.call(this); - return this._albedoTexture && t.push(this._albedoTexture), + ); + }), + (t.prototype._getReflectionTexture = function () { + return this._reflectionTexture + ? this._reflectionTexture + : this.getScene().environmentTexture; + }), + (t.prototype.getActiveTextures = function () { + var t = e.prototype.getActiveTextures.call(this); + return ( + this._albedoTexture && t.push(this._albedoTexture), this._ambientTexture && t.push(this._ambientTexture), this._opacityTexture && t.push(this._opacityTexture), - this._reflectionTexture && t.push(this._reflectionTexture), + this._reflectionTexture && + t.push(this._reflectionTexture), this._emissiveTexture && t.push(this._emissiveTexture), - this._reflectivityTexture && t.push(this._reflectivityTexture), + this._reflectivityTexture && + t.push(this._reflectivityTexture), this._metallicTexture && t.push(this._metallicTexture), - this._microSurfaceTexture && t.push(this._microSurfaceTexture), + this._microSurfaceTexture && + t.push(this._microSurfaceTexture), this._bumpTexture && t.push(this._bumpTexture), this._lightmapTexture && t.push(this._lightmapTexture), this.subSurface.getActiveTextures(t), @@ -72119,7365 +97348,11270 @@ and limitations under the License. this.sheen.getActiveTextures(t), this.anisotropy.getActiveTextures(t), t - } - , - t.prototype.hasTexture = function(t) { - return !!e.prototype.hasTexture.call(this, t) || this._albedoTexture === t || this._ambientTexture === t || this._opacityTexture === t || this._reflectionTexture === t || this._reflectivityTexture === t || this._metallicTexture === t || this._microSurfaceTexture === t || this._bumpTexture === t || this._lightmapTexture === t || this.subSurface.hasTexture(t) || this.clearCoat.hasTexture(t) || this.sheen.hasTexture(t) || this.anisotropy.hasTexture(t) - } - , - t.prototype.dispose = function(t, i) { - i && (this._albedoTexture && this._albedoTexture.dispose(), + ); + }), + (t.prototype.hasTexture = function (t) { + return ( + !!e.prototype.hasTexture.call(this, t) || + this._albedoTexture === t || + this._ambientTexture === t || + this._opacityTexture === t || + this._reflectionTexture === t || + this._reflectivityTexture === t || + this._metallicTexture === t || + this._microSurfaceTexture === t || + this._bumpTexture === t || + this._lightmapTexture === t || + this.subSurface.hasTexture(t) || + this.clearCoat.hasTexture(t) || + this.sheen.hasTexture(t) || + this.anisotropy.hasTexture(t) + ); + }), + (t.prototype.dispose = function (t, i) { + i && + (this._albedoTexture && this._albedoTexture.dispose(), this._ambientTexture && this._ambientTexture.dispose(), this._opacityTexture && this._opacityTexture.dispose(), - this._reflectionTexture && this._reflectionTexture.dispose(), - this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture && this._environmentBRDFTexture.dispose(), - this._emissiveTexture && this._emissiveTexture.dispose(), - this._metallicTexture && this._metallicTexture.dispose(), - this._reflectivityTexture && this._reflectivityTexture.dispose(), + this._reflectionTexture && + this._reflectionTexture.dispose(), + this._environmentBRDFTexture && + this.getScene().environmentBRDFTexture !== + this._environmentBRDFTexture && + this._environmentBRDFTexture.dispose(), + this._emissiveTexture && + this._emissiveTexture.dispose(), + this._metallicTexture && + this._metallicTexture.dispose(), + this._reflectivityTexture && + this._reflectivityTexture.dispose(), this._bumpTexture && this._bumpTexture.dispose(), - this._lightmapTexture && this._lightmapTexture.dispose()), + this._lightmapTexture && + this._lightmapTexture.dispose()), this.subSurface.dispose(i), this.clearCoat.dispose(i), this.sheen.dispose(i), this.anisotropy.dispose(i), this._renderTargets.dispose(), - this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), - e.prototype.dispose.call(this, t, i) - } - , - t.PBRMATERIAL_OPAQUE = 0, - t.PBRMATERIAL_ALPHATEST = 1, - t.PBRMATERIAL_ALPHABLEND = 2, - t.PBRMATERIAL_ALPHATESTANDBLEND = 3, - t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0, - t.LIGHTFALLOFF_PHYSICAL = 0, - t.LIGHTFALLOFF_GLTF = 1, - t.LIGHTFALLOFF_STANDARD = 2, - h.c([Object(F.i)()], t.prototype, "_imageProcessingConfiguration", void 0), - h.c([Object(F.b)("_markAllSubMeshesAsMiscDirty")], t.prototype, "debugMode", void 0), - h.c([Object(F.c)()], t.prototype, "useLogarithmicDepth", null), + this._imageProcessingConfiguration && + this._imageProcessingObserver && + this._imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingObserver + ), + e.prototype.dispose.call(this, t, i); + }), + (t.PBRMATERIAL_OPAQUE = 0), + (t.PBRMATERIAL_ALPHATEST = 1), + (t.PBRMATERIAL_ALPHABLEND = 2), + (t.PBRMATERIAL_ALPHATESTANDBLEND = 3), + (t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0), + (t.LIGHTFALLOFF_PHYSICAL = 0), + (t.LIGHTFALLOFF_GLTF = 1), + (t.LIGHTFALLOFF_STANDARD = 2), + h.c( + [Object(F.i)()], + t.prototype, + "_imageProcessingConfiguration", + void 0 + ), + h.c( + [Object(F.b)("_markAllSubMeshesAsMiscDirty")], + t.prototype, + "debugMode", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "useLogarithmicDepth", + null + ), h.c([Object(F.c)()], t.prototype, "transparencyMode", null), t - }(Qn.a) - , hr = function(e) { - function t(i, n) { - var r = e.call(this, i, n) || this; - return r.directIntensity = 1, - r.emissiveIntensity = 1, - r.environmentIntensity = 1, - r.specularIntensity = 1, - r.disableBumpMap = false, - r.ambientTextureStrength = 1, - r.ambientTextureImpactOnAnalyticalLights = t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, - r.ambientColor = new a.e(0,0,0), - r.albedoColor = new a.e(1,1,1), - r.reflectivityColor = new a.e(1,1,1), - r.reflectionColor = new a.e(1,1,1), - r.emissiveColor = new a.e(0,0,0), - r.microSurface = 1, - r.useLightmapAsShadowmap = false, - r.useAlphaFromAlbedoTexture = false, - r.forceAlphaTest = false, - r.alphaCutOff = .4, - r.useSpecularOverAlpha = true, - r.useMicroSurfaceFromReflectivityMapAlpha = false, - r.useRoughnessFromMetallicTextureAlpha = true, - r.useRoughnessFromMetallicTextureGreen = false, - r.useMetallnessFromMetallicTextureBlue = false, - r.useAmbientOcclusionFromMetallicTextureRed = false, - r.useAmbientInGrayScale = false, - r.useAutoMicroSurfaceFromReflectivityMap = false, - r.useRadianceOverAlpha = true, - r.useObjectSpaceNormalMap = false, - r.useParallax = false, - r.useParallaxOcclusion = false, - r.parallaxScaleBias = .05, - r.disableLighting = false, - r.forceIrradianceInFragment = false, - r.maxSimultaneousLights = 4, - r.invertNormalMapX = false, - r.invertNormalMapY = false, - r.twoSidedLighting = false, - r.useAlphaFresnel = false, - r.useLinearAlphaFresnel = false, - r.environmentBRDFTexture = null, - r.forceNormalForward = false, - r.enableSpecularAntiAliasing = false, - r.useHorizonOcclusion = true, - r.useRadianceOcclusion = true, - r.unlit = false, - r._environmentBRDFTexture = nr.GetEnvironmentBRDFTexture(n), - r - } - return h.d(t, e), + ); + })(Qn.a), + hr = (function (e) { + function t(i, n) { + var r = e.call(this, i, n) || this; + return ( + (r.directIntensity = 1), + (r.emissiveIntensity = 1), + (r.environmentIntensity = 1), + (r.specularIntensity = 1), + (r.disableBumpMap = false), + (r.ambientTextureStrength = 1), + (r.ambientTextureImpactOnAnalyticalLights = + t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS), + (r.ambientColor = new a.e(0, 0, 0)), + (r.albedoColor = new a.e(1, 1, 1)), + (r.reflectivityColor = new a.e(1, 1, 1)), + (r.reflectionColor = new a.e(1, 1, 1)), + (r.emissiveColor = new a.e(0, 0, 0)), + (r.microSurface = 1), + (r.useLightmapAsShadowmap = false), + (r.useAlphaFromAlbedoTexture = false), + (r.forceAlphaTest = false), + (r.alphaCutOff = 0.4), + (r.useSpecularOverAlpha = true), + (r.useMicroSurfaceFromReflectivityMapAlpha = false), + (r.useRoughnessFromMetallicTextureAlpha = true), + (r.useRoughnessFromMetallicTextureGreen = false), + (r.useMetallnessFromMetallicTextureBlue = false), + (r.useAmbientOcclusionFromMetallicTextureRed = false), + (r.useAmbientInGrayScale = false), + (r.useAutoMicroSurfaceFromReflectivityMap = false), + (r.useRadianceOverAlpha = true), + (r.useObjectSpaceNormalMap = false), + (r.useParallax = false), + (r.useParallaxOcclusion = false), + (r.parallaxScaleBias = 0.05), + (r.disableLighting = false), + (r.forceIrradianceInFragment = false), + (r.maxSimultaneousLights = 4), + (r.invertNormalMapX = false), + (r.invertNormalMapY = false), + (r.twoSidedLighting = false), + (r.useAlphaFresnel = false), + (r.useLinearAlphaFresnel = false), + (r.environmentBRDFTexture = null), + (r.forceNormalForward = false), + (r.enableSpecularAntiAliasing = false), + (r.useHorizonOcclusion = true), + (r.useRadianceOcclusion = true), + (r.unlit = false), + (r._environmentBRDFTexture = + nr.GetEnvironmentBRDFTexture(n)), + r + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "refractionTexture", { - get: function() { - return this.subSurface.refractionTexture - }, - set: function(e) { - this.subSurface.refractionTexture = e, - e ? this.subSurface.isRefractionEnabled = true : this.subSurface.linkRefractionWithTransparency || (this.subSurface.isRefractionEnabled = false) - }, - enumerable: true, - configurable: true + get: function () { + return this.subSurface.refractionTexture; + }, + set: function (e) { + (this.subSurface.refractionTexture = e), + e + ? (this.subSurface.isRefractionEnabled = true) + : this.subSurface.linkRefractionWithTransparency || + (this.subSurface.isRefractionEnabled = false); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "indexOfRefraction", { - get: function() { - return 1 / this.subSurface.indexOfRefraction - }, - set: function(e) { - this.subSurface.indexOfRefraction = 1 / e - }, - enumerable: true, - configurable: true + get: function () { + return 1 / this.subSurface.indexOfRefraction; + }, + set: function (e) { + this.subSurface.indexOfRefraction = 1 / e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "invertRefractionY", { - get: function() { - return this.subSurface.invertRefractionY + get: function () { + return this.subSurface.invertRefractionY; + }, + set: function (e) { + this.subSurface.invertRefractionY = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "linkRefractionWithTransparency", + { + get: function () { + return this.subSurface.linkRefractionWithTransparency; }, - set: function(e) { - this.subSurface.invertRefractionY = e + set: function (e) { + (this.subSurface.linkRefractionWithTransparency = e), + e && (this.subSurface.isRefractionEnabled = true); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "linkRefractionWithTransparency", { - get: function() { - return this.subSurface.linkRefractionWithTransparency + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "usePhysicalLightFalloff", + { + get: function () { + return ( + this._lightFalloff === lr.LIGHTFALLOFF_PHYSICAL + ); }, - set: function(e) { - this.subSurface.linkRefractionWithTransparency = e, - e && (this.subSurface.isRefractionEnabled = true) + set: function (e) { + e !== this.usePhysicalLightFalloff && + (this._markAllSubMeshesAsTexturesDirty(), + (this._lightFalloff = e + ? lr.LIGHTFALLOFF_PHYSICAL + : lr.LIGHTFALLOFF_STANDARD)); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "usePhysicalLightFalloff", { - get: function() { - return this._lightFalloff === lr.LIGHTFALLOFF_PHYSICAL - }, - set: function(e) { - e !== this.usePhysicalLightFalloff && (this._markAllSubMeshesAsTexturesDirty(), - this._lightFalloff = e ? lr.LIGHTFALLOFF_PHYSICAL : lr.LIGHTFALLOFF_STANDARD) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "useGLTFLightFalloff", { - get: function() { - return this._lightFalloff === lr.LIGHTFALLOFF_GLTF + get: function () { + return this._lightFalloff === lr.LIGHTFALLOFF_GLTF; + }, + set: function (e) { + e !== this.useGLTFLightFalloff && + (this._markAllSubMeshesAsTexturesDirty(), + (this._lightFalloff = e + ? lr.LIGHTFALLOFF_GLTF + : lr.LIGHTFALLOFF_STANDARD)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "imageProcessingConfiguration", + { + get: function () { + return this._imageProcessingConfiguration; }, - set: function(e) { - e !== this.useGLTFLightFalloff && (this._markAllSubMeshesAsTexturesDirty(), - this._lightFalloff = e ? lr.LIGHTFALLOFF_GLTF : lr.LIGHTFALLOFF_STANDARD) + set: function (e) { + this._attachImageProcessingConfiguration(e), + this._markAllSubMeshesAsTexturesDirty(); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "imageProcessingConfiguration", { - get: function() { - return this._imageProcessingConfiguration + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "cameraColorCurvesEnabled", + { + get: function () { + return this.imageProcessingConfiguration + .colorCurvesEnabled; }, - set: function(e) { - this._attachImageProcessingConfiguration(e), - this._markAllSubMeshesAsTexturesDirty() + set: function (e) { + this.imageProcessingConfiguration.colorCurvesEnabled = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraColorCurvesEnabled", { - get: function() { - return this.imageProcessingConfiguration.colorCurvesEnabled + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "cameraColorGradingEnabled", + { + get: function () { + return this.imageProcessingConfiguration + .colorGradingEnabled; }, - set: function(e) { - this.imageProcessingConfiguration.colorCurvesEnabled = e + set: function (e) { + this.imageProcessingConfiguration.colorGradingEnabled = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraColorGradingEnabled", { - get: function() { - return this.imageProcessingConfiguration.colorGradingEnabled + configurable: true, + } + ), + Object.defineProperty( + t.prototype, + "cameraToneMappingEnabled", + { + get: function () { + return this._imageProcessingConfiguration + .toneMappingEnabled; }, - set: function(e) { - this.imageProcessingConfiguration.colorGradingEnabled = e + set: function (e) { + this._imageProcessingConfiguration.toneMappingEnabled = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraToneMappingEnabled", { - get: function() { - return this._imageProcessingConfiguration.toneMappingEnabled - }, - set: function(e) { - this._imageProcessingConfiguration.toneMappingEnabled = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "cameraExposure", { - get: function() { - return this._imageProcessingConfiguration.exposure - }, - set: function(e) { - this._imageProcessingConfiguration.exposure = e - }, - enumerable: true, - configurable: true + get: function () { + return this._imageProcessingConfiguration.exposure; + }, + set: function (e) { + this._imageProcessingConfiguration.exposure = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "cameraContrast", { - get: function() { - return this._imageProcessingConfiguration.contrast + get: function () { + return this._imageProcessingConfiguration.contrast; + }, + set: function (e) { + this._imageProcessingConfiguration.contrast = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "cameraColorGradingTexture", + { + get: function () { + return this._imageProcessingConfiguration + .colorGradingTexture; }, - set: function(e) { - this._imageProcessingConfiguration.contrast = e + set: function (e) { + this._imageProcessingConfiguration.colorGradingTexture = + e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "cameraColorGradingTexture", { - get: function() { - return this._imageProcessingConfiguration.colorGradingTexture - }, - set: function(e) { - this._imageProcessingConfiguration.colorGradingTexture = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "cameraColorCurves", { - get: function() { - return this._imageProcessingConfiguration.colorCurves - }, - set: function(e) { - this._imageProcessingConfiguration.colorCurves = e - }, - enumerable: true, - configurable: true + get: function () { + return this._imageProcessingConfiguration.colorCurves; + }, + set: function (e) { + this._imageProcessingConfiguration.colorCurves = e; + }, + enumerable: true, + configurable: true, }), - t.prototype.getClassName = function() { - return "PBRMaterial" - } - , - t.prototype.clone = function(e) { - var i = this - , n = F.a.Clone(function() { - return new t(e,i.getScene()) + (t.prototype.getClassName = function () { + return "PBRMaterial"; + }), + (t.prototype.clone = function (e) { + var i = this, + n = F.a.Clone(function () { + return new t(e, i.getScene()); }, this); - return n.id = e, - n.name = e, + return ( + (n.id = e), + (n.name = e), this.clearCoat.copyTo(n.clearCoat), this.anisotropy.copyTo(n.anisotropy), this.brdf.copyTo(n.brdf), this.sheen.copyTo(n.sheen), n - } - , - t.prototype.serialize = function() { - var e = F.a.Serialize(this); - return e.customType = "BABYLON.PBRMaterial", - e.clearCoat = this.clearCoat.serialize(), - e.anisotropy = this.anisotropy.serialize(), - e.brdf = this.brdf.serialize(), - e.sheen = this.sheen.serialize(), + ); + }), + (t.prototype.serialize = function () { + var e = F.a.Serialize(this); + return ( + (e.customType = "BABYLON.PBRMaterial"), + (e.clearCoat = this.clearCoat.serialize()), + (e.anisotropy = this.anisotropy.serialize()), + (e.brdf = this.brdf.serialize()), + (e.sheen = this.sheen.serialize()), e - } - , - t.Parse = function(e, i, n) { - var r = F.a.Parse(function() { - return new t(e.name,i) - }, e, i, n); - return e.clearCoat && r.clearCoat.parse(e.clearCoat), + ); + }), + (t.Parse = function (e, i, n) { + var r = F.a.Parse( + function () { + return new t(e.name, i); + }, + e, + i, + n + ); + return ( + e.clearCoat && r.clearCoat.parse(e.clearCoat), e.anisotropy && r.anisotropy.parse(e.anisotropy), e.brdf && r.brdf.parse(e.brdf), e.sheen && r.sheen.parse(e.brdf), r - } - , - t.PBRMATERIAL_OPAQUE = lr.PBRMATERIAL_OPAQUE, - t.PBRMATERIAL_ALPHATEST = lr.PBRMATERIAL_ALPHATEST, - t.PBRMATERIAL_ALPHABLEND = lr.PBRMATERIAL_ALPHABLEND, - t.PBRMATERIAL_ALPHATESTANDBLEND = lr.PBRMATERIAL_ALPHATESTANDBLEND, - t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = lr.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "directIntensity", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveIntensity", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "environmentIntensity", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "specularIntensity", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "disableBumpMap", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "albedoTexture", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTextureStrength", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTextureImpactOnAnalyticalLights", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "opacityTexture", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionTexture", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveTexture", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectivityTexture", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallicTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallic", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "roughness", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "microSurfaceTexture", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "bumpTexture", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", null)], t.prototype, "lightmapTexture", void 0), - h.c([Object(F.e)("ambient"), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientColor", void 0), - h.c([Object(F.e)("albedo"), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "albedoColor", void 0), - h.c([Object(F.e)("reflectivity"), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectivityColor", void 0), - h.c([Object(F.e)("reflection"), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionColor", void 0), - h.c([Object(F.e)("emissive"), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveColor", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "microSurface", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLightmapAsShadowmap", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "useAlphaFromAlbedoTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "forceAlphaTest", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "alphaCutOff", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useSpecularOverAlpha", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useMicroSurfaceFromReflectivityMapAlpha", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRoughnessFromMetallicTextureAlpha", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRoughnessFromMetallicTextureGreen", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useMetallnessFromMetallicTextureBlue", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAmbientOcclusionFromMetallicTextureRed", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAmbientInGrayScale", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAutoMicroSurfaceFromReflectivityMap", void 0), - h.c([Object(F.c)()], t.prototype, "usePhysicalLightFalloff", null), - h.c([Object(F.c)()], t.prototype, "useGLTFLightFalloff", null), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRadianceOverAlpha", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useObjectSpaceNormalMap", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useParallax", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useParallaxOcclusion", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "parallaxScaleBias", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "disableLighting", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "forceIrradianceInFragment", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "maxSimultaneousLights", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapX", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapY", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "twoSidedLighting", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAlphaFresnel", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLinearAlphaFresnel", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "environmentBRDFTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "forceNormalForward", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "enableSpecularAntiAliasing", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useHorizonOcclusion", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRadianceOcclusion", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsMiscDirty")], t.prototype, "unlit", void 0), + ); + }), + (t.PBRMATERIAL_OPAQUE = lr.PBRMATERIAL_OPAQUE), + (t.PBRMATERIAL_ALPHATEST = lr.PBRMATERIAL_ALPHATEST), + (t.PBRMATERIAL_ALPHABLEND = lr.PBRMATERIAL_ALPHABLEND), + (t.PBRMATERIAL_ALPHATESTANDBLEND = + lr.PBRMATERIAL_ALPHATESTANDBLEND), + (t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = + lr.DEFAULT_AO_ON_ANALYTICAL_LIGHTS), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "directIntensity", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "emissiveIntensity", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "environmentIntensity", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "specularIntensity", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "disableBumpMap", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "albedoTexture", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "ambientTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "ambientTextureStrength", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "ambientTextureImpactOnAnalyticalLights", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty"), + ], + t.prototype, + "opacityTexture", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "reflectionTexture", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "emissiveTexture", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "reflectivityTexture", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "metallicTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "metallic", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "roughness", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "microSurfaceTexture", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "bumpTexture", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty", null), + ], + t.prototype, + "lightmapTexture", + void 0 + ), + h.c( + [ + Object(F.e)("ambient"), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "ambientColor", + void 0 + ), + h.c( + [ + Object(F.e)("albedo"), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "albedoColor", + void 0 + ), + h.c( + [ + Object(F.e)("reflectivity"), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "reflectivityColor", + void 0 + ), + h.c( + [ + Object(F.e)("reflection"), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "reflectionColor", + void 0 + ), + h.c( + [ + Object(F.e)("emissive"), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "emissiveColor", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "microSurface", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useLightmapAsShadowmap", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty"), + ], + t.prototype, + "useAlphaFromAlbedoTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty"), + ], + t.prototype, + "forceAlphaTest", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty"), + ], + t.prototype, + "alphaCutOff", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useSpecularOverAlpha", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useMicroSurfaceFromReflectivityMapAlpha", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useRoughnessFromMetallicTextureAlpha", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useRoughnessFromMetallicTextureGreen", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useMetallnessFromMetallicTextureBlue", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useAmbientOcclusionFromMetallicTextureRed", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useAmbientInGrayScale", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useAutoMicroSurfaceFromReflectivityMap", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "usePhysicalLightFalloff", + null + ), + h.c( + [Object(F.c)()], + t.prototype, + "useGLTFLightFalloff", + null + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useRadianceOverAlpha", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useObjectSpaceNormalMap", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useParallax", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useParallaxOcclusion", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "parallaxScaleBias", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsLightsDirty"), + ], + t.prototype, + "disableLighting", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "forceIrradianceInFragment", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsLightsDirty"), + ], + t.prototype, + "maxSimultaneousLights", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "invertNormalMapX", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "invertNormalMapY", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "twoSidedLighting", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useAlphaFresnel", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useLinearAlphaFresnel", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "environmentBRDFTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "forceNormalForward", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "enableSpecularAntiAliasing", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useHorizonOcclusion", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useRadianceOcclusion", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsMiscDirty"), + ], + t.prototype, + "unlit", + void 0 + ), t - }(lr); - s.a.RegisteredTypes["BABYLON.PBRMaterial"] = hr; - var fr = n(62) - , dr = n(71); - function pr(e) { - return e.charCodeAt(0) + (e.charCodeAt(1) << 8) + (e.charCodeAt(2) << 16) + (e.charCodeAt(3) << 24) - } - var mr = pr("DXT1") - , gr = pr("DXT3") - , _r = pr("DXT5") - , vr = pr("DX10") - , yr = function() { - function e() {} - return e.GetDDSInfo = function(e) { - var t = new Int32Array(e,0,31) - , i = new Int32Array(e,0,35) - , n = 1; - 131072 & t[2] && (n = Math.max(1, t[7])); - var r = t[21] - , o = r === vr ? i[32] : 0 - , a = _.a.TEXTURETYPE_UNSIGNED_INT; - switch (r) { + ); + })(lr); + s.a.RegisteredTypes["BABYLON.PBRMaterial"] = hr; + var fr = n(62), + dr = n(71); + function pr(e) { + return ( + e.charCodeAt(0) + + (e.charCodeAt(1) << 8) + + (e.charCodeAt(2) << 16) + + (e.charCodeAt(3) << 24) + ); + } + var mr = pr("DXT1"), + gr = pr("DXT3"), + _r = pr("DXT5"), + vr = pr("DX10"), + yr = (function () { + function e() {} + return ( + (e.GetDDSInfo = function (e) { + var t = new Int32Array(e, 0, 31), + i = new Int32Array(e, 0, 35), + n = 1; + 131072 & t[2] && (n = Math.max(1, t[7])); + var r = t[21], + o = r === vr ? i[32] : 0, + a = _.a.TEXTURETYPE_UNSIGNED_INT; + switch (r) { case 113: + a = _.a.TEXTURETYPE_HALF_FLOAT; + break; + case 116: + a = _.a.TEXTURETYPE_FLOAT; + break; + case vr: + if (10 === o) { a = _.a.TEXTURETYPE_HALF_FLOAT; break; - case 116: - a = _.a.TEXTURETYPE_FLOAT; - break; - case vr: - if (10 === o) { - a = _.a.TEXTURETYPE_HALF_FLOAT; - break - } + } + } + return { + width: t[4], + height: t[3], + mipmapCount: n, + isFourCC: 4 == (4 & t[20]), + isRGB: 64 == (64 & t[20]), + isLuminance: 131072 == (131072 & t[20]), + isCube: 512 == (512 & t[28]), + isCompressed: r === mr || r === gr || r === _r, + dxgiFormat: o, + textureType: a, + }; + }), + (e._ToHalfFloat = function (t) { + e._FloatView || + ((e._FloatView = new Float32Array(1)), + (e._Int32View = new Int32Array(e._FloatView.buffer))), + (e._FloatView[0] = t); + var i = e._Int32View[0], + n = (i >> 16) & 32768, + r = (i >> 12) & 2047, + o = (i >> 23) & 255; + return o < 103 + ? n + : o > 142 + ? ((n |= 31744), + (n |= (255 == o ? 0 : 1) && 8388607 & i)) + : o < 113 + ? (n |= + ((r |= 2048) >> (114 - o)) + ((r >> (113 - o)) & 1)) + : ((n |= ((o - 112) << 10) | (r >> 1)), (n += 1 & r)); + }), + (e._FromHalfFloat = function (e) { + var t = (32768 & e) >> 15, + i = (31744 & e) >> 10, + n = 1023 & e; + return 0 === i + ? (t ? -1 : 1) * + Math.pow(2, -14) * + (n / Math.pow(2, 10)) + : 31 == i + ? n + ? NaN + : (1 / 0) * (t ? -1 : 1) + : (t ? -1 : 1) * + Math.pow(2, i - 15) * + (1 + n / Math.pow(2, 10)); + }), + (e._GetHalfFloatAsFloatRGBAArrayBuffer = function ( + t, + i, + n, + r, + o, + a + ) { + for ( + var s = new Float32Array(r), + c = new Uint16Array(o, n), + u = 0, + l = 0; + l < i; + l++ + ) + for (var h = 0; h < t; h++) { + var f = 4 * (h + l * t); + (s[u] = e._FromHalfFloat(c[f])), + (s[u + 1] = e._FromHalfFloat(c[f + 1])), + (s[u + 2] = e._FromHalfFloat(c[f + 2])), + e.StoreLODInAlphaChannel + ? (s[u + 3] = a) + : (s[u + 3] = e._FromHalfFloat(c[f + 3])), + (u += 4); } - return { - width: t[4], - height: t[3], - mipmapCount: n, - isFourCC: 4 == (4 & t[20]), - isRGB: 64 == (64 & t[20]), - isLuminance: 131072 == (131072 & t[20]), - isCube: 512 == (512 & t[28]), - isCompressed: r === mr || r === gr || r === _r, - dxgiFormat: o, - textureType: a + return s; + }), + (e._GetHalfFloatRGBAArrayBuffer = function ( + t, + i, + n, + r, + o, + a + ) { + if (e.StoreLODInAlphaChannel) { + for ( + var s = new Uint16Array(r), + c = new Uint16Array(o, n), + u = 0, + l = 0; + l < i; + l++ + ) + for (var h = 0; h < t; h++) { + var f = 4 * (h + l * t); + (s[u] = c[f]), + (s[u + 1] = c[f + 1]), + (s[u + 2] = c[f + 2]), + (s[u + 3] = e._ToHalfFloat(a)), + (u += 4); + } + return s; + } + return new Uint16Array(o, n, r); + }), + (e._GetFloatRGBAArrayBuffer = function (t, i, n, r, o, a) { + if (e.StoreLODInAlphaChannel) { + for ( + var s = new Float32Array(r), + c = new Float32Array(o, n), + u = 0, + l = 0; + l < i; + l++ + ) + for (var h = 0; h < t; h++) { + var f = 4 * (h + l * t); + (s[u] = c[f]), + (s[u + 1] = c[f + 1]), + (s[u + 2] = c[f + 2]), + (s[u + 3] = a), + (u += 4); + } + return s; + } + return new Float32Array(o, n, r); + }), + (e._GetFloatAsUIntRGBAArrayBuffer = function ( + t, + i, + n, + r, + o, + a + ) { + for ( + var s = new Uint8Array(r), + c = new Float32Array(o, n), + u = 0, + l = 0; + l < i; + l++ + ) + for (var h = 0; h < t; h++) { + var f = 4 * (h + l * t); + (s[u] = 255 * L.a.Clamp(c[f])), + (s[u + 1] = 255 * L.a.Clamp(c[f + 1])), + (s[u + 2] = 255 * L.a.Clamp(c[f + 2])), + e.StoreLODInAlphaChannel + ? (s[u + 3] = a) + : (s[u + 3] = 255 * L.a.Clamp(c[f + 3])), + (u += 4); } - } - , - e._ToHalfFloat = function(t) { - e._FloatView || (e._FloatView = new Float32Array(1), - e._Int32View = new Int32Array(e._FloatView.buffer)), - e._FloatView[0] = t; - var i = e._Int32View[0] - , n = i >> 16 & 32768 - , r = i >> 12 & 2047 - , o = i >> 23 & 255; - return o < 103 ? n : o > 142 ? (n |= 31744, - n |= (255 == o ? 0 : 1) && 8388607 & i) : o < 113 ? n |= ((r |= 2048) >> 114 - o) + (r >> 113 - o & 1) : (n |= o - 112 << 10 | r >> 1, - n += 1 & r) - } - , - e._FromHalfFloat = function(e) { - var t = (32768 & e) >> 15 - , i = (31744 & e) >> 10 - , n = 1023 & e; - return 0 === i ? (t ? -1 : 1) * Math.pow(2, -14) * (n / Math.pow(2, 10)) : 31 == i ? n ? NaN : 1 / 0 * (t ? -1 : 1) : (t ? -1 : 1) * Math.pow(2, i - 15) * (1 + n / Math.pow(2, 10)) - } - , - e._GetHalfFloatAsFloatRGBAArrayBuffer = function(t, i, n, r, o, a) { - for (var s = new Float32Array(r), c = new Uint16Array(o,n), u = 0, l = 0; l < i; l++) - for (var h = 0; h < t; h++) { - var f = 4 * (h + l * t); - s[u] = e._FromHalfFloat(c[f]), - s[u + 1] = e._FromHalfFloat(c[f + 1]), - s[u + 2] = e._FromHalfFloat(c[f + 2]), - e.StoreLODInAlphaChannel ? s[u + 3] = a : s[u + 3] = e._FromHalfFloat(c[f + 3]), - u += 4 - } - return s - } - , - e._GetHalfFloatRGBAArrayBuffer = function(t, i, n, r, o, a) { - if (e.StoreLODInAlphaChannel) { - for (var s = new Uint16Array(r), c = new Uint16Array(o,n), u = 0, l = 0; l < i; l++) - for (var h = 0; h < t; h++) { - var f = 4 * (h + l * t); - s[u] = c[f], - s[u + 1] = c[f + 1], - s[u + 2] = c[f + 2], - s[u + 3] = e._ToHalfFloat(a), - u += 4 + return s; + }), + (e._GetHalfFloatAsUIntRGBAArrayBuffer = function ( + t, + i, + n, + r, + o, + a + ) { + for ( + var s = new Uint8Array(r), + c = new Uint16Array(o, n), + u = 0, + l = 0; + l < i; + l++ + ) + for (var h = 0; h < t; h++) { + var f = 4 * (h + l * t); + (s[u] = 255 * L.a.Clamp(e._FromHalfFloat(c[f]))), + (s[u + 1] = + 255 * L.a.Clamp(e._FromHalfFloat(c[f + 1]))), + (s[u + 2] = + 255 * L.a.Clamp(e._FromHalfFloat(c[f + 2]))), + e.StoreLODInAlphaChannel + ? (s[u + 3] = a) + : (s[u + 3] = + 255 * L.a.Clamp(e._FromHalfFloat(c[f + 3]))), + (u += 4); + } + return s; + }), + (e._GetRGBAArrayBuffer = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + for ( + var u = new Uint8Array(n), + l = new Uint8Array(r, i), + h = 0, + f = 0; + f < t; + f++ + ) + for (var d = 0; d < e; d++) { + var p = 4 * (d + f * e); + (u[h] = l[p + o]), + (u[h + 1] = l[p + a]), + (u[h + 2] = l[p + s]), + (u[h + 3] = l[p + c]), + (h += 4); + } + return u; + }), + (e._ExtractLongWordOrder = function (t) { + return 0 === t || 255 === t || -16777216 === t + ? 0 + : 1 + e._ExtractLongWordOrder(t >> 8); + }), + (e._GetRGBArrayBuffer = function (e, t, i, n, r, o, a, s) { + for ( + var c = new Uint8Array(n), + u = new Uint8Array(r, i), + l = 0, + h = 0; + h < t; + h++ + ) + for (var f = 0; f < e; f++) { + var d = 3 * (f + h * e); + (c[l] = u[d + o]), + (c[l + 1] = u[d + a]), + (c[l + 2] = u[d + s]), + (l += 3); + } + return c; + }), + (e._GetLuminanceArrayBuffer = function (e, t, i, n, r) { + for ( + var o = new Uint8Array(n), + a = new Uint8Array(r, i), + s = 0, + c = 0; + c < t; + c++ + ) + for (var u = 0; u < e; u++) { + var l = u + c * e; + (o[s] = a[l]), s++; + } + return o; + }), + (e.UploadDDSLevels = function (t, i, n, r, o, a, s, c) { + void 0 === s && (s = -1); + var u = null; + r.sphericalPolynomial && (u = new Array()); + var l, + h, + f, + d, + p, + m, + v, + y = t.getCaps().s3tc, + b = new Int32Array(n, 0, 31), + E = 0, + T = 0, + A = 1; + if (542327876 === b[0]) + if (r.isFourCC || r.isRGB || r.isLuminance) + if (!r.isCompressed || y) { + var x = b[22]; + d = b[1] + 4; + var S, + C = false; + if (r.isFourCC) + switch ((l = b[21])) { + case mr: + (A = 8), + (T = y.COMPRESSED_RGBA_S3TC_DXT1_EXT); + break; + case gr: + (A = 16), + (T = y.COMPRESSED_RGBA_S3TC_DXT3_EXT); + break; + case _r: + (A = 16), + (T = y.COMPRESSED_RGBA_S3TC_DXT5_EXT); + break; + case 113: + case 116: + C = true; + break; + case vr: + d += 20; + var P = false; + switch (r.dxgiFormat) { + case 10: + (C = true), (P = true); + break; + case 88: + (r.isRGB = true), + (r.isFourCC = false), + (x = 32), + (P = true); + } + if (P) break; + default: + return void console.error( + "Unsupported FourCC code:", + ((S = l), + String.fromCharCode( + 255 & S, + (S >> 8) & 255, + (S >> 16) & 255, + (S >> 24) & 255 + )) + ); + } + var R = e._ExtractLongWordOrder(b[23]), + M = e._ExtractLongWordOrder(b[24]), + O = e._ExtractLongWordOrder(b[25]), + w = e._ExtractLongWordOrder(b[26]); + C && + (T = t._getRGBABufferInternalSizedFormat( + r.textureType + )), + (m = 1), + 131072 & b[2] && + false !== o && + (m = Math.max(1, b[7])); + for (var I = c || 0; I < a; I++) { + for (h = b[4], f = b[3], v = 0; v < m; ++v) { + if (-1 === s || s === v) { + var D = -1 === s ? v : 0; + if (!r.isCompressed && r.isFourCC) { + (i.format = _.a.TEXTUREFORMAT_RGBA), + (E = h * f * 4); + var L = null; + t._badOS || + t._badDesktopOS || + (!t.getCaps().textureHalfFloat && + !t.getCaps().textureFloat) + ? (128 === x + ? ((L = + e._GetFloatAsUIntRGBAArrayBuffer( + h, + f, + d, + E, + n, + D + )), + u && + 0 == D && + u.push( + e._GetFloatRGBAArrayBuffer( + h, + f, + d, + E, + n, + D + ) + )) + : 64 === x && + ((L = + e._GetHalfFloatAsUIntRGBAArrayBuffer( + h, + f, + d, + E, + n, + D + )), + u && + 0 == D && + u.push( + e._GetHalfFloatAsFloatRGBAArrayBuffer( + h, + f, + d, + E, + n, + D + ) + )), + (i.type = _.a.TEXTURETYPE_UNSIGNED_INT)) + : 128 === x + ? ((i.type = _.a.TEXTURETYPE_FLOAT), + (L = e._GetFloatRGBAArrayBuffer( + h, + f, + d, + E, + n, + D + )), + u && 0 == D && u.push(L)) + : 64 !== x || t.getCaps().textureHalfFloat + ? ((i.type = _.a.TEXTURETYPE_HALF_FLOAT), + (L = e._GetHalfFloatRGBAArrayBuffer( + h, + f, + d, + E, + n, + D + )), + u && + 0 == D && + u.push( + e._GetHalfFloatAsFloatRGBAArrayBuffer( + h, + f, + d, + E, + n, + D + ) + )) + : ((i.type = _.a.TEXTURETYPE_FLOAT), + (L = + e._GetHalfFloatAsFloatRGBAArrayBuffer( + h, + f, + d, + E, + n, + D + )), + u && 0 == D && u.push(L)), + L && + t._uploadDataToTextureDirectly( + i, + L, + I, + D + ); + } else if (r.isRGB) + (i.type = _.a.TEXTURETYPE_UNSIGNED_INT), + 24 === x + ? ((i.format = _.a.TEXTUREFORMAT_RGB), + (E = h * f * 3), + (p = e._GetRGBArrayBuffer( + h, + f, + d, + E, + n, + R, + M, + O + )), + t._uploadDataToTextureDirectly( + i, + p, + I, + D + )) + : ((i.format = _.a.TEXTUREFORMAT_RGBA), + (E = h * f * 4), + (p = e._GetRGBAArrayBuffer( + h, + f, + d, + E, + n, + R, + M, + O, + w + )), + t._uploadDataToTextureDirectly( + i, + p, + I, + D + )); + else if (r.isLuminance) { + var F = t._getUnpackAlignement(), + B = h; + (E = + Math.floor((h + F - 1) / F) * + F * + (f - 1) + + B), + (p = e._GetLuminanceArrayBuffer( + h, + f, + d, + E, + n + )), + (i.format = _.a.TEXTUREFORMAT_LUMINANCE), + (i.type = _.a.TEXTURETYPE_UNSIGNED_INT), + t._uploadDataToTextureDirectly( + i, + p, + I, + D + ); + } else + (E = + (((Math.max(4, h) / 4) * Math.max(4, f)) / + 4) * + A), + (p = new Uint8Array(n, d, E)), + (i.type = _.a.TEXTURETYPE_UNSIGNED_INT), + t._uploadCompressedDataToTextureDirectly( + i, + T, + h, + f, + p, + I, + D + ); } - return s - } - return new Uint16Array(o,n,r) - } - , - e._GetFloatRGBAArrayBuffer = function(t, i, n, r, o, a) { - if (e.StoreLODInAlphaChannel) { - for (var s = new Float32Array(r), c = new Float32Array(o,n), u = 0, l = 0; l < i; l++) - for (var h = 0; h < t; h++) { - var f = 4 * (h + l * t); - s[u] = c[f], - s[u + 1] = c[f + 1], - s[u + 2] = c[f + 2], - s[u + 3] = a, - u += 4 - } - return s - } - return new Float32Array(o,n,r) - } - , - e._GetFloatAsUIntRGBAArrayBuffer = function(t, i, n, r, o, a) { - for (var s = new Uint8Array(r), c = new Float32Array(o,n), u = 0, l = 0; l < i; l++) - for (var h = 0; h < t; h++) { - var f = 4 * (h + l * t); - s[u] = 255 * L.a.Clamp(c[f]), - s[u + 1] = 255 * L.a.Clamp(c[f + 1]), - s[u + 2] = 255 * L.a.Clamp(c[f + 2]), - e.StoreLODInAlphaChannel ? s[u + 3] = a : s[u + 3] = 255 * L.a.Clamp(c[f + 3]), - u += 4 + (d += x ? h * f * (x / 8) : E), + (h *= 0.5), + (f *= 0.5), + (h = Math.max(1, h)), + (f = Math.max(1, f)); + } + if (void 0 !== c) break; } - return s - } - , - e._GetHalfFloatAsUIntRGBAArrayBuffer = function(t, i, n, r, o, a) { - for (var s = new Uint8Array(r), c = new Uint16Array(o,n), u = 0, l = 0; l < i; l++) - for (var h = 0; h < t; h++) { - var f = 4 * (h + l * t); - s[u] = 255 * L.a.Clamp(e._FromHalfFloat(c[f])), - s[u + 1] = 255 * L.a.Clamp(e._FromHalfFloat(c[f + 1])), - s[u + 2] = 255 * L.a.Clamp(e._FromHalfFloat(c[f + 2])), - e.StoreLODInAlphaChannel ? s[u + 3] = a : s[u + 3] = 255 * L.a.Clamp(e._FromHalfFloat(c[f + 3])), - u += 4 - } - return s - } - , - e._GetRGBAArrayBuffer = function(e, t, i, n, r, o, a, s, c) { - for (var u = new Uint8Array(n), l = new Uint8Array(r,i), h = 0, f = 0; f < t; f++) - for (var d = 0; d < e; d++) { - var p = 4 * (d + f * e); - u[h] = l[p + o], - u[h + 1] = l[p + a], - u[h + 2] = l[p + s], - u[h + 3] = l[p + c], - h += 4 - } - return u - } - , - e._ExtractLongWordOrder = function(t) { - return 0 === t || 255 === t || -16777216 === t ? 0 : 1 + e._ExtractLongWordOrder(t >> 8) - } - , - e._GetRGBArrayBuffer = function(e, t, i, n, r, o, a, s) { - for (var c = new Uint8Array(n), u = new Uint8Array(r,i), l = 0, h = 0; h < t; h++) - for (var f = 0; f < e; f++) { - var d = 3 * (f + h * e); - c[l] = u[d + o], - c[l + 1] = u[d + a], - c[l + 2] = u[d + s], - l += 3 - } - return c - } - , - e._GetLuminanceArrayBuffer = function(e, t, i, n, r) { - for (var o = new Uint8Array(n), a = new Uint8Array(r,i), s = 0, c = 0; c < t; c++) - for (var u = 0; u < e; u++) { - var l = u + c * e; - o[s] = a[l], - s++ - } - return o - } - , - e.UploadDDSLevels = function(t, i, n, r, o, a, s, c) { - void 0 === s && (s = -1); - var u = null; - r.sphericalPolynomial && (u = new Array); - var l, h, f, d, p, m, v, y = t.getCaps().s3tc, b = new Int32Array(n,0,31), E = 0, T = 0, A = 1; - if (542327876 === b[0]) - if (r.isFourCC || r.isRGB || r.isLuminance) - if (!r.isCompressed || y) { - var x = b[22]; - d = b[1] + 4; - var S, C = false; - if (r.isFourCC) - switch (l = b[21]) { - case mr: - A = 8, - T = y.COMPRESSED_RGBA_S3TC_DXT1_EXT; - break; - case gr: - A = 16, - T = y.COMPRESSED_RGBA_S3TC_DXT3_EXT; - break; - case _r: - A = 16, - T = y.COMPRESSED_RGBA_S3TC_DXT5_EXT; - break; - case 113: - case 116: - C = true; - break; - case vr: - d += 20; - var P = false; - switch (r.dxgiFormat) { - case 10: - C = true, - P = true; - break; - case 88: - r.isRGB = true, - r.isFourCC = false, - x = 32, - P = true - } - if (P) - break; - default: - return void console.error("Unsupported FourCC code:", (S = l, - String.fromCharCode(255 & S, S >> 8 & 255, S >> 16 & 255, S >> 24 & 255))) - } - var R = e._ExtractLongWordOrder(b[23]) - , M = e._ExtractLongWordOrder(b[24]) - , O = e._ExtractLongWordOrder(b[25]) - , w = e._ExtractLongWordOrder(b[26]); - C && (T = t._getRGBABufferInternalSizedFormat(r.textureType)), - m = 1, - 131072 & b[2] && false !== o && (m = Math.max(1, b[7])); - for (var I = c || 0; I < a; I++) { - for (h = b[4], - f = b[3], - v = 0; v < m; ++v) { - if (-1 === s || s === v) { - var D = -1 === s ? v : 0; - if (!r.isCompressed && r.isFourCC) { - i.format = _.a.TEXTUREFORMAT_RGBA, - E = h * f * 4; - var L = null; - t._badOS || t._badDesktopOS || !t.getCaps().textureHalfFloat && !t.getCaps().textureFloat ? (128 === x ? (L = e._GetFloatAsUIntRGBAArrayBuffer(h, f, d, E, n, D), - u && 0 == D && u.push(e._GetFloatRGBAArrayBuffer(h, f, d, E, n, D))) : 64 === x && (L = e._GetHalfFloatAsUIntRGBAArrayBuffer(h, f, d, E, n, D), - u && 0 == D && u.push(e._GetHalfFloatAsFloatRGBAArrayBuffer(h, f, d, E, n, D))), - i.type = _.a.TEXTURETYPE_UNSIGNED_INT) : 128 === x ? (i.type = _.a.TEXTURETYPE_FLOAT, - L = e._GetFloatRGBAArrayBuffer(h, f, d, E, n, D), - u && 0 == D && u.push(L)) : 64 !== x || t.getCaps().textureHalfFloat ? (i.type = _.a.TEXTURETYPE_HALF_FLOAT, - L = e._GetHalfFloatRGBAArrayBuffer(h, f, d, E, n, D), - u && 0 == D && u.push(e._GetHalfFloatAsFloatRGBAArrayBuffer(h, f, d, E, n, D))) : (i.type = _.a.TEXTURETYPE_FLOAT, - L = e._GetHalfFloatAsFloatRGBAArrayBuffer(h, f, d, E, n, D), - u && 0 == D && u.push(L)), - L && t._uploadDataToTextureDirectly(i, L, I, D) - } else if (r.isRGB) - i.type = _.a.TEXTURETYPE_UNSIGNED_INT, - 24 === x ? (i.format = _.a.TEXTUREFORMAT_RGB, - E = h * f * 3, - p = e._GetRGBArrayBuffer(h, f, d, E, n, R, M, O), - t._uploadDataToTextureDirectly(i, p, I, D)) : (i.format = _.a.TEXTUREFORMAT_RGBA, - E = h * f * 4, - p = e._GetRGBAArrayBuffer(h, f, d, E, n, R, M, O, w), - t._uploadDataToTextureDirectly(i, p, I, D)); - else if (r.isLuminance) { - var F = t._getUnpackAlignement() - , B = h; - E = Math.floor((h + F - 1) / F) * F * (f - 1) + B, - p = e._GetLuminanceArrayBuffer(h, f, d, E, n), - i.format = _.a.TEXTUREFORMAT_LUMINANCE, - i.type = _.a.TEXTURETYPE_UNSIGNED_INT, - t._uploadDataToTextureDirectly(i, p, I, D) - } else - E = Math.max(4, h) / 4 * Math.max(4, f) / 4 * A, - p = new Uint8Array(n,d,E), - i.type = _.a.TEXTURETYPE_UNSIGNED_INT, - t._uploadCompressedDataToTextureDirectly(i, T, h, f, p, I, D) - } - d += x ? h * f * (x / 8) : E, - h *= .5, - f *= .5, - h = Math.max(1, h), - f = Math.max(1, f) - } - if (void 0 !== c) - break - } - u && u.length > 0 ? r.sphericalPolynomial = dr.a.ConvertCubeMapToSphericalPolynomial({ - size: b[4], - right: u[0], - left: u[1], - up: u[2], - down: u[3], - front: u[4], - back: u[5], - format: _.a.TEXTUREFORMAT_RGBA, - type: _.a.TEXTURETYPE_FLOAT, - gammaSpace: false - }) : r.sphericalPolynomial = void 0 - } else - g.a.Error("Compressed textures are not supported on this platform."); - else - g.a.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code"); + u && u.length > 0 + ? (r.sphericalPolynomial = + dr.a.ConvertCubeMapToSphericalPolynomial({ + size: b[4], + right: u[0], + left: u[1], + up: u[2], + down: u[3], + front: u[4], + back: u[5], + format: _.a.TEXTUREFORMAT_RGBA, + type: _.a.TEXTURETYPE_FLOAT, + gammaSpace: false, + })) + : (r.sphericalPolynomial = void 0); + } else + g.a.Error( + "Compressed textures are not supported on this platform." + ); else - g.a.Error("Invalid magic number in DDS header") - } - , - e.StoreLODInAlphaChannel = false, + g.a.Error( + "Unsupported format, must contain a FourCC, RGB or LUMINANCE code" + ); + else g.a.Error("Invalid magic number in DDS header"); + }), + (e.StoreLODInAlphaChannel = false), e - }(); - ve.b.prototype.createPrefilteredCubeTexture = function(e, t, i, n, r, o, a, s, c) { - var u = this; - return void 0 === r && (r = null), - void 0 === o && (o = null), - void 0 === s && (s = null), - void 0 === c && (c = true), - this.createCubeTexture(e, t, null, false, function(e) { - if (e) { - var o = e.texture; - if (c ? e.info.sphericalPolynomial && (o._sphericalPolynomial = e.info.sphericalPolynomial) : o._sphericalPolynomial = new fr.b, - o._dataSource = He.a.DATASOURCE_CUBEPREFILTERED, - u.getCaps().textureLOD) - r && r(o); - else { - var a = u._gl - , s = e.width; - if (s) { - for (var l = [], h = 0; h < 3; h++) { - var f = 1 - h / 2 - , d = n - , p = L.a.Log2(s) * i + n - , m = d + (p - d) * f - , _ = Math.round(Math.min(Math.max(m, 0), p)) - , v = new He.a(u,He.a.DATASOURCE_TEMP); - if (v.type = o.type, - v.format = o.format, - v.width = Math.pow(2, Math.max(L.a.Log2(s) - _, 0)), - v.height = v.width, - v.isCube = true, - u._bindTextureDirectly(a.TEXTURE_CUBE_MAP, v, true), - a.texParameteri(a.TEXTURE_CUBE_MAP, a.TEXTURE_MAG_FILTER, a.LINEAR), - a.texParameteri(a.TEXTURE_CUBE_MAP, a.TEXTURE_MIN_FILTER, a.LINEAR), - a.texParameteri(a.TEXTURE_CUBE_MAP, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE), - a.texParameteri(a.TEXTURE_CUBE_MAP, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE), - e.isDDS) { - var y = e.info - , b = e.data; - u._unpackFlipY(y.isCompressed), - yr.UploadDDSLevels(u, v, b, y, true, 6, _) - } else - g.a.Warn("DDS is the only prefiltered cube map supported so far."); - u._bindTextureDirectly(a.TEXTURE_CUBE_MAP, null); - var E = new jn.a(t); - E.isCube = true, - E._texture = v, - v.isReady = true, - l.push(E) - } - o._lodTextureHigh = l[2], - o._lodTextureMid = l[1], - o._lodTextureLow = l[0], - r && r(o) - } - } - } else - r && r(null) - }, o, a, s, c, i, n) - } - ; - var br = function() { - function e() { - this.supportCascades = true - } - return e.prototype.canLoad = function(e, t, i, n, r) { - return 0 === e.indexOf(".dds") - } - , - e.prototype.transformUrl = function(e, t) { - return e - } - , - e.prototype.getFallbackTextureUrl = function(e, t) { - return null - } - , - e.prototype.loadCubeData = function(e, t, i, n, r) { - var o, a = t.getEngine(), s = false; - if (Array.isArray(e)) - for (var c = 0; c < e.length; c++) { - var u = e[c]; - o = yr.GetDDSInfo(u), - t.width = o.width, - t.height = o.height, - s = (o.isRGB || o.isLuminance || o.mipmapCount > 1) && t.generateMipMaps, - a._unpackFlipY(o.isCompressed), - yr.UploadDDSLevels(a, t, u, o, s, 6, -1, c), - o.isFourCC || 1 !== o.mipmapCount || a.generateMipMapsForCubemap(t) - } + ); + })(); + ve.b.prototype.createPrefilteredCubeTexture = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u = this; + return ( + void 0 === r && (r = null), + void 0 === o && (o = null), + void 0 === s && (s = null), + void 0 === c && (c = true), + this.createCubeTexture( + e, + t, + null, + false, + function (e) { + if (e) { + var o = e.texture; + if ( + (c + ? e.info.sphericalPolynomial && + (o._sphericalPolynomial = + e.info.sphericalPolynomial) + : (o._sphericalPolynomial = new fr.b()), + (o._dataSource = He.a.DATASOURCE_CUBEPREFILTERED), + u.getCaps().textureLOD) + ) + r && r(o); else { - var l = e; - o = yr.GetDDSInfo(l), - t.width = o.width, - t.height = o.height, - i && (o.sphericalPolynomial = new fr.b), - s = (o.isRGB || o.isLuminance || o.mipmapCount > 1) && t.generateMipMaps, - a._unpackFlipY(o.isCompressed), - yr.UploadDDSLevels(a, t, l, o, s, 6), - o.isFourCC || 1 !== o.mipmapCount || a.generateMipMapsForCubemap(t) + var a = u._gl, + s = e.width; + if (s) { + for (var l = [], h = 0; h < 3; h++) { + var f = 1 - h / 2, + d = n, + p = L.a.Log2(s) * i + n, + m = d + (p - d) * f, + _ = Math.round(Math.min(Math.max(m, 0), p)), + v = new He.a(u, He.a.DATASOURCE_TEMP); + if ( + ((v.type = o.type), + (v.format = o.format), + (v.width = Math.pow( + 2, + Math.max(L.a.Log2(s) - _, 0) + )), + (v.height = v.width), + (v.isCube = true), + u._bindTextureDirectly( + a.TEXTURE_CUBE_MAP, + v, + true + ), + a.texParameteri( + a.TEXTURE_CUBE_MAP, + a.TEXTURE_MAG_FILTER, + a.LINEAR + ), + a.texParameteri( + a.TEXTURE_CUBE_MAP, + a.TEXTURE_MIN_FILTER, + a.LINEAR + ), + a.texParameteri( + a.TEXTURE_CUBE_MAP, + a.TEXTURE_WRAP_S, + a.CLAMP_TO_EDGE + ), + a.texParameteri( + a.TEXTURE_CUBE_MAP, + a.TEXTURE_WRAP_T, + a.CLAMP_TO_EDGE + ), + e.isDDS) + ) { + var y = e.info, + b = e.data; + u._unpackFlipY(y.isCompressed), + yr.UploadDDSLevels(u, v, b, y, true, 6, _); + } else + g.a.Warn( + "DDS is the only prefiltered cube map supported so far." + ); + u._bindTextureDirectly(a.TEXTURE_CUBE_MAP, null); + var E = new jn.a(t); + (E.isCube = true), + (E._texture = v), + (v.isReady = true), + l.push(E); + } + (o._lodTextureHigh = l[2]), + (o._lodTextureMid = l[1]), + (o._lodTextureLow = l[0]), + r && r(o); + } } - a._setCubeMapTextureParams(s), - t.isReady = true, - n && n({ - isDDS: true, - width: t.width, - info: o, - data: e, - texture: t - }) + } else r && r(null); + }, + o, + a, + s, + c, + i, + n + ) + ); + }; + var br = (function () { + function e() { + this.supportCascades = true; + } + return ( + (e.prototype.canLoad = function (e, t, i, n, r) { + return 0 === e.indexOf(".dds"); + }), + (e.prototype.transformUrl = function (e, t) { + return e; + }), + (e.prototype.getFallbackTextureUrl = function (e, t) { + return null; + }), + (e.prototype.loadCubeData = function (e, t, i, n, r) { + var o, + a = t.getEngine(), + s = false; + if (Array.isArray(e)) + for (var c = 0; c < e.length; c++) { + var u = e[c]; + (o = yr.GetDDSInfo(u)), + (t.width = o.width), + (t.height = o.height), + (s = + (o.isRGB || o.isLuminance || o.mipmapCount > 1) && + t.generateMipMaps), + a._unpackFlipY(o.isCompressed), + yr.UploadDDSLevels(a, t, u, o, s, 6, -1, c), + o.isFourCC || + 1 !== o.mipmapCount || + a.generateMipMapsForCubemap(t); + } + else { + var l = e; + (o = yr.GetDDSInfo(l)), + (t.width = o.width), + (t.height = o.height), + i && (o.sphericalPolynomial = new fr.b()), + (s = + (o.isRGB || o.isLuminance || o.mipmapCount > 1) && + t.generateMipMaps), + a._unpackFlipY(o.isCompressed), + yr.UploadDDSLevels(a, t, l, o, s, 6), + o.isFourCC || + 1 !== o.mipmapCount || + a.generateMipMapsForCubemap(t); } - , - e.prototype.loadData = function(e, t, i) { - var n = yr.GetDDSInfo(e) - , r = (n.isRGB || n.isLuminance || n.mipmapCount > 1) && t.generateMipMaps && n.width >> n.mipmapCount - 1 == 1; - i(n.width, n.height, r, n.isFourCC, function() { - yr.UploadDDSLevels(t.getEngine(), t, e, n, r, 1) - }) - } - , - e - }(); - ve.b._TextureLoaders.push(new br); - Ht.a.ShadersStore.rgbdEncodePixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}"; - var Er = function() { - function e() {} - return e.GetEnvInfo = function(t) { - for (var i = new DataView(t), n = 0, r = 0; r < e._MagicBytes.length; r++) - if (i.getUint8(n++) !== e._MagicBytes[r]) - return g.a.Error("Not a babylon environment map"), - null; - for (var o = "", a = 0; a = i.getUint8(n++); ) - o += String.fromCharCode(a); - var s = JSON.parse(o); - return s.specular && (s.specular.specularDataPosition = n, - s.specular.lodGenerationScale = s.specular.lodGenerationScale || .8), - s - } - , - e.CreateEnvTextureAsync = function(t) { - var n = this - , r = t.getInternalTexture(); - if (!r) - return i.reject("The cube texture is invalid."); - if (!t._prefiltered) - return i.reject("The cube texture is invalid (not prefiltered)."); - var o = r.getEngine(); - if (o && o.premultipliedAlpha) - return i.reject("Env texture can only be created when the engine is created with the premultipliedAlpha option set to false."); - if (t.textureType === _.a.TEXTURETYPE_UNSIGNED_INT) - return i.reject("The cube texture should allow HDR (Full Float or Half Float)."); - var a = o.getRenderingCanvas(); - if (!a) - return i.reject("Env texture can only be created when the engine is associated to a canvas."); - var s = _.a.TEXTURETYPE_FLOAT; - if (!o.getCaps().textureFloatRender && (s = _.a.TEXTURETYPE_HALF_FLOAT, - !o.getCaps().textureHalfFloatRender)) - return i.reject("Env texture can only be created when the browser supports half float or full float rendering."); - var c = r.width - , u = new Y.a(o) - , l = {} - , h = [] - , f = L.a.Log2(r.width); - f = Math.round(f); - for (var d = function(e) { - for (var n = Math.pow(2, f - e), r = function(r) { - var c = t.readPixels(r, e) - , f = o.createRawTexture(c, n, n, _.a.TEXTUREFORMAT_RGBA, false, false, _.a.TEXTURE_NEAREST_SAMPLINGMODE, null, s) - , d = new i(function(t, i) { - var s = new Wt("rgbdEncode","rgbdEncode",null,null,1,null,_.a.TEXTURE_NEAREST_SAMPLINGMODE,o,false,void 0,_.a.TEXTURETYPE_UNSIGNED_INT,void 0,null,false); - s.getEffect().executeWhenCompiled(function() { - s.onApply = function(e) { - e._bindTexture("textureSampler", f) - } - ; - var i = o.getRenderWidth() - , c = o.getRenderHeight(); + a._setCubeMapTextureParams(s), + (t.isReady = true), + n && + n({ + isDDS: true, + width: t.width, + info: o, + data: e, + texture: t, + }); + }), + (e.prototype.loadData = function (e, t, i) { + var n = yr.GetDDSInfo(e), + r = + (n.isRGB || n.isLuminance || n.mipmapCount > 1) && + t.generateMipMaps && + n.width >> (n.mipmapCount - 1) == 1; + i(n.width, n.height, r, n.isFourCC, function () { + yr.UploadDDSLevels(t.getEngine(), t, e, n, r, 1); + }); + }), + e + ); + })(); + ve.b._TextureLoaders.push(new br()); + Ht.a.ShadersStore.rgbdEncodePixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}"; + var Er = (function () { + function e() {} + return ( + (e.GetEnvInfo = function (t) { + for ( + var i = new DataView(t), n = 0, r = 0; + r < e._MagicBytes.length; + r++ + ) + if (i.getUint8(n++) !== e._MagicBytes[r]) + return g.a.Error("Not a babylon environment map"), null; + for (var o = "", a = 0; (a = i.getUint8(n++)); ) + o += String.fromCharCode(a); + var s = JSON.parse(o); + return ( + s.specular && + ((s.specular.specularDataPosition = n), + (s.specular.lodGenerationScale = + s.specular.lodGenerationScale || 0.8)), + s + ); + }), + (e.CreateEnvTextureAsync = function (t) { + var n = this, + r = t.getInternalTexture(); + if (!r) return i.reject("The cube texture is invalid."); + if (!t._prefiltered) + return i.reject( + "The cube texture is invalid (not prefiltered)." + ); + var o = r.getEngine(); + if (o && o.premultipliedAlpha) + return i.reject( + "Env texture can only be created when the engine is created with the premultipliedAlpha option set to false." + ); + if (t.textureType === _.a.TEXTURETYPE_UNSIGNED_INT) + return i.reject( + "The cube texture should allow HDR (Full Float or Half Float)." + ); + var a = o.getRenderingCanvas(); + if (!a) + return i.reject( + "Env texture can only be created when the engine is associated to a canvas." + ); + var s = _.a.TEXTURETYPE_FLOAT; + if ( + !o.getCaps().textureFloatRender && + ((s = _.a.TEXTURETYPE_HALF_FLOAT), + !o.getCaps().textureHalfFloatRender) + ) + return i.reject( + "Env texture can only be created when the browser supports half float or full float rendering." + ); + var c = r.width, + u = new Y.a(o), + l = {}, + h = [], + f = L.a.Log2(r.width); + f = Math.round(f); + for ( + var d = function (e) { + for ( + var n = Math.pow(2, f - e), + r = function (r) { + var c = t.readPixels(r, e), + f = o.createRawTexture( + c, + n, + n, + _.a.TEXTUREFORMAT_RGBA, + false, + false, + _.a.TEXTURE_NEAREST_SAMPLINGMODE, + null, + s + ), + d = new i(function (t, i) { + var s = new Wt( + "rgbdEncode", + "rgbdEncode", + null, + null, + 1, + null, + _.a.TEXTURE_NEAREST_SAMPLINGMODE, + o, + false, + void 0, + _.a.TEXTURETYPE_UNSIGNED_INT, + void 0, + null, + false + ); + s.getEffect().executeWhenCompiled( + function () { + s.onApply = function (e) { + e._bindTexture("textureSampler", f); + }; + var i = o.getRenderWidth(), + c = o.getRenderHeight(); o.setSize(n, n), - u.postProcessManager.directRender([s], null), - Ee.h.ToBlob(a, function(i) { - var n = new FileReader; - n.onload = function(i) { - var n = i.target.result; - l[6 * e + r] = n, - t() - } - , - n.readAsArrayBuffer(i) - }), - o.setSize(i, c) - }) - } - ); - h.push(d) - }, c = 0; c < 6; c++) - r(c) - }, p = 0; p <= f; p++) - d(p); - return i.all(h).then(function() { - u.dispose(); - for (var i = { - version: 1, - width: c, - irradiance: n._CreateEnvTextureIrradiance(t), - specular: { - mipmaps: [], - lodGenerationScale: t.lodGenerationScale - } - }, r = 0, o = 0; o <= f; o++) - for (var a = 0; a < 6; a++) { - var s = l[6 * o + a].byteLength; - i.specular.mipmaps.push({ - length: s, - position: r - }), - r += s - } - for (var h = JSON.stringify(i), d = new ArrayBuffer(h.length + 1), p = new Uint8Array(d), m = (o = 0, - h.length); o < m; o++) - p[o] = h.charCodeAt(o); - p[h.length] = 0; - var g = e._MagicBytes.length + r + d.byteLength - , _ = new ArrayBuffer(g) - , v = new Uint8Array(_) - , y = new DataView(_) - , b = 0; - for (o = 0; o < e._MagicBytes.length; o++) - y.setUint8(b++, e._MagicBytes[o]); - for (v.set(new Uint8Array(d), b), - b += d.byteLength, - o = 0; o <= f; o++) - for (a = 0; a < 6; a++) { - var E = l[6 * o + a]; - v.set(new Uint8Array(E), b), - b += E.byteLength - } - return _ - }) - } - , - e._CreateEnvTextureIrradiance = function(e) { - var t = e.sphericalPolynomial; - return null == t ? null : { - x: [t.x.x, t.x.y, t.x.z], - y: [t.y.x, t.y.y, t.y.z], - z: [t.z.x, t.z.y, t.z.z], - xx: [t.xx.x, t.xx.y, t.xx.z], - yy: [t.yy.x, t.yy.y, t.yy.z], - zz: [t.zz.x, t.zz.y, t.zz.z], - yz: [t.yz.x, t.yz.y, t.yz.z], - zx: [t.zx.x, t.zx.y, t.zx.z], - xy: [t.xy.x, t.xy.y, t.xy.z] + u.postProcessManager.directRender( + [s], + null + ), + Ee.h.ToBlob(a, function (i) { + var n = new FileReader(); + (n.onload = function (i) { + var n = i.target.result; + (l[6 * e + r] = n), t(); + }), + n.readAsArrayBuffer(i); + }), + o.setSize(i, c); + } + ); + }); + h.push(d); + }, + c = 0; + c < 6; + c++ + ) + r(c); + }, + p = 0; + p <= f; + p++ + ) + d(p); + return i.all(h).then(function () { + u.dispose(); + for ( + var i = { + version: 1, + width: c, + irradiance: n._CreateEnvTextureIrradiance(t), + specular: { + mipmaps: [], + lodGenerationScale: t.lodGenerationScale, + }, + }, + r = 0, + o = 0; + o <= f; + o++ + ) + for (var a = 0; a < 6; a++) { + var s = l[6 * o + a].byteLength; + i.specular.mipmaps.push({ + length: s, + position: r, + }), + (r += s); } - } - , - e.UploadEnvLevelsAsync = function(t, n, r) { - if (1 !== r.version) - throw new Error('Unsupported babylon environment map version "' + r.version + '"'); - var o = r.specular; - if (!o) - return i.resolve(); - var a = L.a.Log2(r.width); - if (a = Math.round(a) + 1, - o.mipmaps.length !== 6 * a) - throw new Error('Unsupported specular mipmaps number "' + o.mipmaps.length + '"'); - t._lodGenerationScale = o.lodGenerationScale; - for (var s = new Array(a), c = 0; c < a; c++) { - s[c] = new Array(6); - for (var u = 0; u < 6; u++) { - var l = o.mipmaps[6 * c + u]; - s[c][u] = new Uint8Array(n,o.specularDataPosition + l.position,l.length) - } + for ( + var h = JSON.stringify(i), + d = new ArrayBuffer(h.length + 1), + p = new Uint8Array(d), + m = ((o = 0), h.length); + o < m; + o++ + ) + p[o] = h.charCodeAt(o); + p[h.length] = 0; + var g = e._MagicBytes.length + r + d.byteLength, + _ = new ArrayBuffer(g), + v = new Uint8Array(_), + y = new DataView(_), + b = 0; + for (o = 0; o < e._MagicBytes.length; o++) + y.setUint8(b++, e._MagicBytes[o]); + for ( + v.set(new Uint8Array(d), b), b += d.byteLength, o = 0; + o <= f; + o++ + ) + for (a = 0; a < 6; a++) { + var E = l[6 * o + a]; + v.set(new Uint8Array(E), b), (b += E.byteLength); } - return e.UploadLevelsAsync(t, s) - } - , - e.UploadLevelsAsync = function(e, t) { - if (!Ee.h.IsExponentOfTwo(e.width)) - throw new Error("Texture size must be a power of two"); - var n = Math.round(L.a.Log2(e.width)) + 1 - , r = e.getEngine() - , o = false - , a = false - , s = null - , c = null - , u = null - , l = r.getCaps(); - if (e.format = _.a.TEXTUREFORMAT_RGBA, - e.type = _.a.TEXTURETYPE_UNSIGNED_INT, - e.generateMipMaps = true, - r.updateTextureSamplingMode(_.a.TEXTURE_TRILINEAR_SAMPLINGMODE, e), - l.textureLOD ? r.webGLVersion < 2 ? o = false : l.textureHalfFloatRender && l.textureHalfFloatLinearFiltering ? (o = true, - e.type = _.a.TEXTURETYPE_HALF_FLOAT) : l.textureFloatRender && l.textureFloatLinearFiltering && (o = true, - e.type = _.a.TEXTURETYPE_FLOAT) : (o = false, - a = true, - u = {}), - o) - s = new Wt("rgbdDecode","rgbdDecode",null,null,1,null,_.a.TEXTURE_TRILINEAR_SAMPLINGMODE,r,false,void 0,e.type,void 0,null,false), - e._isRGBD = false, - e.invertY = false, - c = r.createRenderTargetCubeTexture(e.width, { - generateDepthBuffer: false, - generateMipMaps: true, - generateStencilBuffer: false, - samplingMode: _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, - type: e.type, - format: _.a.TEXTUREFORMAT_RGBA - }); - else if (e._isRGBD = true, - e.invertY = true, - a) - for (var h = e._lodGenerationScale, f = e._lodGenerationOffset, d = 0; d < 3; d++) { - var p = (n - 1) * h + f - , m = f + (p - f) * (1 - d / 2) - , g = Math.round(Math.min(Math.max(m, 0), p)) - , v = new He.a(r,He.a.DATASOURCE_TEMP); - v.isCube = true, - v.invertY = true, - v.generateMipMaps = false, - r.updateTextureSamplingMode(_.a.TEXTURE_LINEAR_LINEAR, v); - var y = new jn.a(null); - switch (y.isCube = true, - y._texture = v, - u[g] = y, - d) { - case 0: - e._lodTextureLow = y; - break; - case 1: - e._lodTextureMid = y; - break; - case 2: - e._lodTextureHigh = y - } - } - var b = [] - , E = function(n) { - for (var l = function(l) { - var h = t[n][l] - , f = new Blob([h],{ - type: "image/png" - }) - , d = URL.createObjectURL(f) - , p = new Image; - p.src = d; - var m = new i(function(t, i) { - p.onload = function() { - if (o) { - var h = r.createTexture(null, true, true, null, _.a.TEXTURE_NEAREST_SAMPLINGMODE, null, function(e) { - i(e) - }, p); - s.getEffect().executeWhenCompiled(function() { - s.onApply = function(e) { - e._bindTexture("textureSampler", h), - e.setFloat2("scale", 1, 1) - } - , - r.scenes[0].postProcessManager.directRender([s], c, true, l, n), - r.restoreDefaultFramebuffer(), - h.dispose(), - window.URL.revokeObjectURL(d), - t() - }) - } else { - if (r._uploadImageToTexture(e, p, l, n), - a) { - var f = u[n]; - f && r._uploadImageToTexture(f._texture, p, l, 0) - } - t() - } - } - , - p.onerror = function(e) { - i(e) - } - } - ); - b.push(m) - }, h = 0; h < 6; h++) - l(h) + return _; + }); + }), + (e._CreateEnvTextureIrradiance = function (e) { + var t = e.sphericalPolynomial; + return null == t + ? null + : { + x: [t.x.x, t.x.y, t.x.z], + y: [t.y.x, t.y.y, t.y.z], + z: [t.z.x, t.z.y, t.z.z], + xx: [t.xx.x, t.xx.y, t.xx.z], + yy: [t.yy.x, t.yy.y, t.yy.z], + zz: [t.zz.x, t.zz.y, t.zz.z], + yz: [t.yz.x, t.yz.y, t.yz.z], + zx: [t.zx.x, t.zx.y, t.zx.z], + xy: [t.xy.x, t.xy.y, t.xy.z], }; - for (d = 0; d < t.length; d++) - E(d); - if (t.length < n) { - var T = void 0 - , A = Math.pow(2, n - 1 - t.length) - , x = A * A * 4; - switch (e.type) { - case _.a.TEXTURETYPE_UNSIGNED_INT: - T = new Uint8Array(x); - break; - case _.a.TEXTURETYPE_HALF_FLOAT: - T = new Uint16Array(x); - break; - case _.a.TEXTURETYPE_FLOAT: - T = new Float32Array(x) - } - for (d = t.length; d < n; d++) - for (var S = 0; S < 6; S++) - r._uploadArrayBufferViewToTexture(e, T, S, d) - } - return i.all(b).then(function() { - c && (r._releaseFramebufferObjects(c), - c._swapAndDie(e)), - s && s.dispose(), - a && (e._lodTextureHigh && e._lodTextureHigh._texture && (e._lodTextureHigh._texture.isReady = true), - e._lodTextureMid && e._lodTextureMid._texture && (e._lodTextureMid._texture.isReady = true), - e._lodTextureLow && e._lodTextureLow._texture && (e._lodTextureLow._texture.isReady = true)) - }) + }), + (e.UploadEnvLevelsAsync = function (t, n, r) { + if (1 !== r.version) + throw new Error( + 'Unsupported babylon environment map version "' + + r.version + + '"' + ); + var o = r.specular; + if (!o) return i.resolve(); + var a = L.a.Log2(r.width); + if (((a = Math.round(a) + 1), o.mipmaps.length !== 6 * a)) + throw new Error( + 'Unsupported specular mipmaps number "' + + o.mipmaps.length + + '"' + ); + t._lodGenerationScale = o.lodGenerationScale; + for (var s = new Array(a), c = 0; c < a; c++) { + s[c] = new Array(6); + for (var u = 0; u < 6; u++) { + var l = o.mipmaps[6 * c + u]; + s[c][u] = new Uint8Array( + n, + o.specularDataPosition + l.position, + l.length + ); + } } - , - e.UploadEnvSpherical = function(e, t) { - 1 !== t.version && g.a.Warn('Unsupported babylon environment map version "' + t.version + '"'); - var i = t.irradiance; - if (i) { - var n = new fr.b; - a.x.FromArrayToRef(i.x, 0, n.x), - a.x.FromArrayToRef(i.y, 0, n.y), - a.x.FromArrayToRef(i.z, 0, n.z), - a.x.FromArrayToRef(i.xx, 0, n.xx), - a.x.FromArrayToRef(i.yy, 0, n.yy), - a.x.FromArrayToRef(i.zz, 0, n.zz), - a.x.FromArrayToRef(i.yz, 0, n.yz), - a.x.FromArrayToRef(i.zx, 0, n.zx), - a.x.FromArrayToRef(i.xy, 0, n.xy), - e._sphericalPolynomial = n - } - } - , - e._UpdateRGBDAsync = function(t, i, n, r, o) { - return t._dataSource = He.a.DATASOURCE_CUBERAW_RGBD, - t._bufferViewArrayArray = i, - t._lodGenerationScale = r, - t._lodGenerationOffset = o, - t._sphericalPolynomial = n, - e.UploadLevelsAsync(t, i).then(function() { - t.isReady = true - }) - } - , - e._MagicBytes = [134, 22, 135, 150, 246, 214, 150, 54], - e - }(); - He.a._UpdateRGBDAsync = Er._UpdateRGBDAsync; - var Tr = function() { - function e() { - this.supportCascades = false - } - return e.prototype.canLoad = function(e, t, i, n, r) { - return 0 === e.indexOf(".env") - } - , - e.prototype.transformUrl = function(e, t) { - return e - } - , - e.prototype.getFallbackTextureUrl = function(e, t) { - return null - } - , - e.prototype.loadCubeData = function(e, t, i, n, r) { - if (!Array.isArray(e)) { - e = e; - var o = Er.GetEnvInfo(e); - o ? (t.width = o.width, - t.height = o.width, - Er.UploadEnvSpherical(t, o), - Er.UploadEnvLevelsAsync(t, e, o).then(function() { - t.isReady = true, - n && n() - })) : r && r("Can not parse the environment file", null) - } - } - , - e.prototype.loadData = function(e, t, i) { - throw ".env not supported in 2d." - } - , - e - }(); - ve.b._TextureLoaders.push(new Tr); - var Ar = function() { - function e(t, i, n, r) { - this.arrayBuffer = t, - this.isInvalid = false; - var o = new Uint8Array(this.arrayBuffer,0,12); - if (171 !== o[0] || 75 !== o[1] || 84 !== o[2] || 88 !== o[3] || 32 !== o[4] || 49 !== o[5] || 49 !== o[6] || 187 !== o[7] || 13 !== o[8] || 10 !== o[9] || 26 !== o[10] || 10 !== o[11]) - return this.isInvalid = true, - void g.a.Error("texture missing KTX identifier"); - var a = Uint32Array.BYTES_PER_ELEMENT - , s = new DataView(this.arrayBuffer,12,13 * a) - , c = 67305985 === s.getUint32(0, true); - this.glType = s.getUint32(1 * a, c), - this.glTypeSize = s.getUint32(2 * a, c), - this.glFormat = s.getUint32(3 * a, c), - this.glInternalFormat = s.getUint32(4 * a, c), - this.glBaseInternalFormat = s.getUint32(5 * a, c), - this.pixelWidth = s.getUint32(6 * a, c), - this.pixelHeight = s.getUint32(7 * a, c), - this.pixelDepth = s.getUint32(8 * a, c), - this.numberOfArrayElements = s.getUint32(9 * a, c), - this.numberOfFaces = s.getUint32(10 * a, c), - this.numberOfMipmapLevels = s.getUint32(11 * a, c), - this.bytesOfKeyValueData = s.getUint32(12 * a, c), - 0 === this.glType ? (this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels), - 0 !== this.pixelHeight && 0 === this.pixelDepth ? 0 === this.numberOfArrayElements ? this.numberOfFaces === i ? this.loadType = e.COMPRESSED_2D : g.a.Error("number of faces expected" + i + ", but found " + this.numberOfFaces) : g.a.Error("texture arrays not currently supported") : g.a.Error("only 2D textures currently supported")) : g.a.Error("only compressed formats currently supported") - } - return e.prototype.uploadLevels = function(t, i) { - switch (this.loadType) { - case e.COMPRESSED_2D: - this._upload2DCompressedLevels(t, i); + return e.UploadLevelsAsync(t, s); + }), + (e.UploadLevelsAsync = function (e, t) { + if (!Ee.h.IsExponentOfTwo(e.width)) + throw new Error("Texture size must be a power of two"); + var n = Math.round(L.a.Log2(e.width)) + 1, + r = e.getEngine(), + o = false, + a = false, + s = null, + c = null, + u = null, + l = r.getCaps(); + if ( + ((e.format = _.a.TEXTUREFORMAT_RGBA), + (e.type = _.a.TEXTURETYPE_UNSIGNED_INT), + (e.generateMipMaps = true), + r.updateTextureSamplingMode( + _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, + e + ), + l.textureLOD + ? r.webGLVersion < 2 + ? (o = false) + : l.textureHalfFloatRender && + l.textureHalfFloatLinearFiltering + ? ((o = true), (e.type = _.a.TEXTURETYPE_HALF_FLOAT)) + : l.textureFloatRender && + l.textureFloatLinearFiltering && + ((o = true), (e.type = _.a.TEXTURETYPE_FLOAT)) + : ((o = false), (a = true), (u = {})), + o) + ) + (s = new Wt( + "rgbdDecode", + "rgbdDecode", + null, + null, + 1, + null, + _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, + r, + false, + void 0, + e.type, + void 0, + null, + false + )), + (e._isRGBD = false), + (e.invertY = false), + (c = r.createRenderTargetCubeTexture(e.width, { + generateDepthBuffer: false, + generateMipMaps: true, + generateStencilBuffer: false, + samplingMode: _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, + type: e.type, + format: _.a.TEXTUREFORMAT_RGBA, + })); + else if (((e._isRGBD = true), (e.invertY = true), a)) + for ( + var h = e._lodGenerationScale, + f = e._lodGenerationOffset, + d = 0; + d < 3; + d++ + ) { + var p = (n - 1) * h + f, + m = f + (p - f) * (1 - d / 2), + g = Math.round(Math.min(Math.max(m, 0), p)), + v = new He.a(r, He.a.DATASOURCE_TEMP); + (v.isCube = true), + (v.invertY = true), + (v.generateMipMaps = false), + r.updateTextureSamplingMode( + _.a.TEXTURE_LINEAR_LINEAR, + v + ); + var y = new jn.a(null); + switch ( + ((y.isCube = true), (y._texture = v), (u[g] = y), d) + ) { + case 0: + e._lodTextureLow = y; break; + case 1: + e._lodTextureMid = y; + break; + case 2: + e._lodTextureHigh = y; + } + } + var b = [], + E = function (n) { + for ( + var l = function (l) { + var h = t[n][l], + f = new Blob([h], { + type: "image/png", + }), + d = URL.createObjectURL(f), + p = new Image(); + p.src = d; + var m = new i(function (t, i) { + (p.onload = function () { + if (o) { + var h = r.createTexture( + null, + true, + true, + null, + _.a.TEXTURE_NEAREST_SAMPLINGMODE, + null, + function (e) { + i(e); + }, + p + ); + s.getEffect().executeWhenCompiled( + function () { + (s.onApply = function (e) { + e._bindTexture("textureSampler", h), + e.setFloat2("scale", 1, 1); + }), + r.scenes[0].postProcessManager.directRender( + [s], + c, + true, + l, + n + ), + r.restoreDefaultFramebuffer(), + h.dispose(), + window.URL.revokeObjectURL(d), + t(); + } + ); + } else { + if ( + (r._uploadImageToTexture(e, p, l, n), a) + ) { + var f = u[n]; + f && + r._uploadImageToTexture( + f._texture, + p, + l, + 0 + ); + } + t(); + } + }), + (p.onerror = function (e) { + i(e); + }); + }); + b.push(m); + }, + h = 0; + h < 6; + h++ + ) + l(h); + }; + for (d = 0; d < t.length; d++) E(d); + if (t.length < n) { + var T = void 0, + A = Math.pow(2, n - 1 - t.length), + x = A * A * 4; + switch (e.type) { + case _.a.TEXTURETYPE_UNSIGNED_INT: + T = new Uint8Array(x); + break; + case _.a.TEXTURETYPE_HALF_FLOAT: + T = new Uint16Array(x); + break; + case _.a.TEXTURETYPE_FLOAT: + T = new Float32Array(x); + } + for (d = t.length; d < n; d++) + for (var S = 0; S < 6; S++) + r._uploadArrayBufferViewToTexture(e, T, S, d); + } + return i.all(b).then(function () { + c && (r._releaseFramebufferObjects(c), c._swapAndDie(e)), + s && s.dispose(), + a && + (e._lodTextureHigh && + e._lodTextureHigh._texture && + (e._lodTextureHigh._texture.isReady = true), + e._lodTextureMid && + e._lodTextureMid._texture && + (e._lodTextureMid._texture.isReady = true), + e._lodTextureLow && + e._lodTextureLow._texture && + (e._lodTextureLow._texture.isReady = true)); + }); + }), + (e.UploadEnvSpherical = function (e, t) { + 1 !== t.version && + g.a.Warn( + 'Unsupported babylon environment map version "' + + t.version + + '"' + ); + var i = t.irradiance; + if (i) { + var n = new fr.b(); + a.x.FromArrayToRef(i.x, 0, n.x), + a.x.FromArrayToRef(i.y, 0, n.y), + a.x.FromArrayToRef(i.z, 0, n.z), + a.x.FromArrayToRef(i.xx, 0, n.xx), + a.x.FromArrayToRef(i.yy, 0, n.yy), + a.x.FromArrayToRef(i.zz, 0, n.zz), + a.x.FromArrayToRef(i.yz, 0, n.yz), + a.x.FromArrayToRef(i.zx, 0, n.zx), + a.x.FromArrayToRef(i.xy, 0, n.xy), + (e._sphericalPolynomial = n); + } + }), + (e._UpdateRGBDAsync = function (t, i, n, r, o) { + return ( + (t._dataSource = He.a.DATASOURCE_CUBERAW_RGBD), + (t._bufferViewArrayArray = i), + (t._lodGenerationScale = r), + (t._lodGenerationOffset = o), + (t._sphericalPolynomial = n), + e.UploadLevelsAsync(t, i).then(function () { + t.isReady = true; + }) + ); + }), + (e._MagicBytes = [134, 22, 135, 150, 246, 214, 150, 54]), + e + ); + })(); + He.a._UpdateRGBDAsync = Er._UpdateRGBDAsync; + var Tr = (function () { + function e() { + this.supportCascades = false; + } + return ( + (e.prototype.canLoad = function (e, t, i, n, r) { + return 0 === e.indexOf(".env"); + }), + (e.prototype.transformUrl = function (e, t) { + return e; + }), + (e.prototype.getFallbackTextureUrl = function (e, t) { + return null; + }), + (e.prototype.loadCubeData = function (e, t, i, n, r) { + if (!Array.isArray(e)) { + e = e; + var o = Er.GetEnvInfo(e); + o + ? ((t.width = o.width), + (t.height = o.width), + Er.UploadEnvSpherical(t, o), + Er.UploadEnvLevelsAsync(t, e, o).then(function () { + (t.isReady = true), n && n(); + })) + : r && r("Can not parse the environment file", null); + } + }), + (e.prototype.loadData = function (e, t, i) { + throw ".env not supported in 2d."; + }), + e + ); + })(); + ve.b._TextureLoaders.push(new Tr()); + var Ar = (function () { + function e(t, i, n, r) { + (this.arrayBuffer = t), (this.isInvalid = false); + var o = new Uint8Array(this.arrayBuffer, 0, 12); + if ( + 171 !== o[0] || + 75 !== o[1] || + 84 !== o[2] || + 88 !== o[3] || + 32 !== o[4] || + 49 !== o[5] || + 49 !== o[6] || + 187 !== o[7] || + 13 !== o[8] || + 10 !== o[9] || + 26 !== o[10] || + 10 !== o[11] + ) + return ( + (this.isInvalid = true), + void g.a.Error("texture missing KTX identifier") + ); + var a = Uint32Array.BYTES_PER_ELEMENT, + s = new DataView(this.arrayBuffer, 12, 13 * a), + c = 67305985 === s.getUint32(0, true); + (this.glType = s.getUint32(1 * a, c)), + (this.glTypeSize = s.getUint32(2 * a, c)), + (this.glFormat = s.getUint32(3 * a, c)), + (this.glInternalFormat = s.getUint32(4 * a, c)), + (this.glBaseInternalFormat = s.getUint32(5 * a, c)), + (this.pixelWidth = s.getUint32(6 * a, c)), + (this.pixelHeight = s.getUint32(7 * a, c)), + (this.pixelDepth = s.getUint32(8 * a, c)), + (this.numberOfArrayElements = s.getUint32(9 * a, c)), + (this.numberOfFaces = s.getUint32(10 * a, c)), + (this.numberOfMipmapLevels = s.getUint32(11 * a, c)), + (this.bytesOfKeyValueData = s.getUint32(12 * a, c)), + 0 === this.glType + ? ((this.numberOfMipmapLevels = Math.max( + 1, + this.numberOfMipmapLevels + )), + 0 !== this.pixelHeight && 0 === this.pixelDepth + ? 0 === this.numberOfArrayElements + ? this.numberOfFaces === i + ? (this.loadType = e.COMPRESSED_2D) + : g.a.Error( + "number of faces expected" + + i + + ", but found " + + this.numberOfFaces + ) + : g.a.Error( + "texture arrays not currently supported" + ) + : g.a.Error("only 2D textures currently supported")) + : g.a.Error( + "only compressed formats currently supported" + ); + } + return ( + (e.prototype.uploadLevels = function (t, i) { + switch (this.loadType) { + case e.COMPRESSED_2D: + this._upload2DCompressedLevels(t, i); + break; case e.TEX_2D: case e.COMPRESSED_3D: case e.TEX_3D: + } + }), + (e.prototype._upload2DCompressedLevels = function (t, i) { + for ( + var n = e.HEADER_LEN + this.bytesOfKeyValueData, + r = this.pixelWidth, + o = this.pixelHeight, + a = i ? this.numberOfMipmapLevels : 1, + s = 0; + s < a; + s++ + ) { + var c = new Int32Array(this.arrayBuffer, n, 1)[0]; + n += 4; + for (var u = 0; u < this.numberOfFaces; u++) { + var l = new Uint8Array(this.arrayBuffer, n, c); + t + .getEngine() + ._uploadCompressedDataToTextureDirectly( + t, + this.glInternalFormat, + r, + o, + l, + u, + s + ), + (n += c), + (n += 3 - ((c + 3) % 4)); } - } - , - e.prototype._upload2DCompressedLevels = function(t, i) { - for (var n = e.HEADER_LEN + this.bytesOfKeyValueData, r = this.pixelWidth, o = this.pixelHeight, a = i ? this.numberOfMipmapLevels : 1, s = 0; s < a; s++) { - var c = new Int32Array(this.arrayBuffer,n,1)[0]; - n += 4; - for (var u = 0; u < this.numberOfFaces; u++) { - var l = new Uint8Array(this.arrayBuffer,n,c); - t.getEngine()._uploadCompressedDataToTextureDirectly(t, this.glInternalFormat, r, o, l, u, s), - n += c, - n += 3 - (c + 3) % 4 - } - r = Math.max(1, .5 * r), - o = Math.max(1, .5 * o) - } - } - , - e.HEADER_LEN = 64, - e.COMPRESSED_2D = 0, - e.COMPRESSED_3D = 1, - e.TEX_2D = 2, - e.TEX_3D = 3, + (r = Math.max(1, 0.5 * r)), (o = Math.max(1, 0.5 * o)); + } + }), + (e.HEADER_LEN = 64), + (e.COMPRESSED_2D = 0), + (e.COMPRESSED_3D = 1), + (e.TEX_2D = 2), + (e.TEX_3D = 3), e - }() - , xr = function() { - function e() { - this.supportCascades = false - } - return e.prototype.canLoad = function(e, t, i, n, r) { - return !(!t || n || i || r) - } - , - e.prototype.transformUrl = function(e, t) { - var i = e.lastIndexOf("."); - return -1 != i && "ktx" == e.substring(i + 1) ? e : (i > -1 ? e.substring(0, i) : e) + t - } - , - e.prototype.getFallbackTextureUrl = function(e, t) { - var i = new RegExp(t + "$"); - return e.replace(i, "") - } - , - e.prototype.loadCubeData = function(e, t, i, n, r) { - if (!Array.isArray(e)) { - t._invertVScale = !t.invertY; - var o = t.getEngine() - , a = new Ar(e,6) - , s = a.numberOfMipmapLevels > 1 && t.generateMipMaps; - o._unpackFlipY(true), - a.uploadLevels(t, t.generateMipMaps), - t.width = a.pixelWidth, - t.height = a.pixelHeight, - o._setCubeMapTextureParams(s), - t.isReady = true - } - } - , - e.prototype.loadData = function(e, t, i) { + ); + })(), + xr = (function () { + function e() { + this.supportCascades = false; + } + return ( + (e.prototype.canLoad = function (e, t, i, n, r) { + return !(!t || n || i || r); + }), + (e.prototype.transformUrl = function (e, t) { + var i = e.lastIndexOf("."); + return -1 != i && "ktx" == e.substring(i + 1) + ? e + : (i > -1 ? e.substring(0, i) : e) + t; + }), + (e.prototype.getFallbackTextureUrl = function (e, t) { + var i = new RegExp(t + "$"); + return e.replace(i, ""); + }), + (e.prototype.loadCubeData = function (e, t, i, n, r) { + if (!Array.isArray(e)) { t._invertVScale = !t.invertY; - var n = new Ar(e,1); - i(n.pixelWidth, n.pixelHeight, false, true, function() { - n.uploadLevels(t, t.generateMipMaps) - }, n.isInvalid) - } - , + var o = t.getEngine(), + a = new Ar(e, 6), + s = a.numberOfMipmapLevels > 1 && t.generateMipMaps; + o._unpackFlipY(true), + a.uploadLevels(t, t.generateMipMaps), + (t.width = a.pixelWidth), + (t.height = a.pixelHeight), + o._setCubeMapTextureParams(s), + (t.isReady = true); + } + }), + (e.prototype.loadData = function (e, t, i) { + t._invertVScale = !t.invertY; + var n = new Ar(e, 1); + i( + n.pixelWidth, + n.pixelHeight, + false, + true, + function () { + n.uploadLevels(t, t.generateMipMaps); + }, + n.isInvalid + ); + }), e - }(); - ve.b._TextureLoaders.unshift(new xr), - Y.a.prototype.createDefaultLight = function(e) { - if (void 0 === e && (e = false), - e && this.lights) - for (var t = 0; t < this.lights.length; t++) - this.lights[t].dispose(); - 0 === this.lights.length && new gi.a("default light",a.x.Up(),this) - } - , - Y.a.prototype.createDefaultCamera = function(e, t, i) { - if (void 0 === e && (e = false), + ); + })(); + ve.b._TextureLoaders.unshift(new xr()), + (Y.a.prototype.createDefaultLight = function (e) { + if ((void 0 === e && (e = false), e && this.lights)) + for (var t = 0; t < this.lights.length; t++) + this.lights[t].dispose(); + 0 === this.lights.length && + new gi.a("default light", a.x.Up(), this); + }), + (Y.a.prototype.createDefaultCamera = function (e, t, i) { + if ( + (void 0 === e && (e = false), void 0 === t && (t = false), void 0 === i && (i = false), - t && this.activeCamera && (this.activeCamera.dispose(), - this.activeCamera = null), - !this.activeCamera) { - var n, r = this.getWorldExtends(), o = r.max.subtract(r.min), s = r.min.add(o.scale(.5)), c = 1.5 * o.length(); - if (isFinite(c) || (c = 1, - s.copyFromFloats(0, 0, 0)), - e) { - var u = new xt("default camera",-Math.PI / 2,Math.PI / 2,c,s,this); - u.lowerRadiusLimit = .01 * c, - u.wheelPrecision = 100 / c, - n = u - } else { - var l = new Tt("default camera",new a.x(s.x,s.y,-c),this); - l.setTarget(s), - n = l - } - n.minZ = .01 * c, - n.maxZ = 1e3 * c, - n.speed = .2 * c, - this.activeCamera = n; - var h = this.getEngine().getRenderingCanvas(); - i && h && n.attachControl(h) + t && + this.activeCamera && + (this.activeCamera.dispose(), (this.activeCamera = null)), + !this.activeCamera) + ) { + var n, + r = this.getWorldExtends(), + o = r.max.subtract(r.min), + s = r.min.add(o.scale(0.5)), + c = 1.5 * o.length(); + if ( + (isFinite(c) || ((c = 1), s.copyFromFloats(0, 0, 0)), e) + ) { + var u = new xt( + "default camera", + -Math.PI / 2, + Math.PI / 2, + c, + s, + this + ); + (u.lowerRadiusLimit = 0.01 * c), + (u.wheelPrecision = 100 / c), + (n = u); + } else { + var l = new Tt( + "default camera", + new a.x(s.x, s.y, -c), + this + ); + l.setTarget(s), (n = l); } - } - , - Y.a.prototype.createDefaultCameraOrLight = function(e, t, i) { - void 0 === e && (e = false), + (n.minZ = 0.01 * c), + (n.maxZ = 1e3 * c), + (n.speed = 0.2 * c), + (this.activeCamera = n); + var h = this.getEngine().getRenderingCanvas(); + i && h && n.attachControl(h); + } + }), + (Y.a.prototype.createDefaultCameraOrLight = function (e, t, i) { + void 0 === e && (e = false), void 0 === t && (t = false), void 0 === i && (i = false), this.createDefaultLight(t), - this.createDefaultCamera(e, t, i) - } - , - Y.a.prototype.createDefaultSkybox = function(e, t, i, n, r) { - if (void 0 === t && (t = false), + this.createDefaultCamera(e, t, i); + }), + (Y.a.prototype.createDefaultSkybox = function (e, t, i, n, r) { + if ( + (void 0 === t && (t = false), void 0 === i && (i = 1e3), void 0 === n && (n = 0), void 0 === r && (r = true), !e) - return g.a.Warn("Can not create default skybox without environment texture."), - null; - r && e && (this.environmentTexture = e); - var o = me.a.CreateBox("hdrSkyBox", i, this); - if (t) { - var a = new hr("skyBox",this); - a.backFaceCulling = false, - a.reflectionTexture = e.clone(), - a.reflectionTexture && (a.reflectionTexture.coordinatesMode = je.a.SKYBOX_MODE), - a.microSurface = 1 - n, - a.disableLighting = true, - a.twoSidedLighting = true, - o.infiniteDistance = true, - o.material = a - } else { - var s = new bi.a("skyBox",this); - s.backFaceCulling = false, - s.reflectionTexture = e.clone(), - s.reflectionTexture && (s.reflectionTexture.coordinatesMode = je.a.SKYBOX_MODE), - s.disableLighting = true, - o.infiniteDistance = true, - o.material = s - } - return o.isPickable = false, - o - } - , - Y.a.prototype.createDefaultEnvironment = function(e) { - return er ? new er(e,this) : null - } - , - Y.a.prototype.createDefaultVRExperience = function(e) { - return void 0 === e && (e = {}), - new Fi(this,e) - } - , - Y.a.prototype.createDefaultXRExperienceAsync = function() { - var e = this; - return Ui.CreateAsync(this).then(function(t) { - var i = new Wi(t); - return zi.CreateAsync(e, t, { - outputCanvasContext: i.canvasContext - }).then(function(e) { - return new Hi(t), - t - }) - }) - } - ; - var Sr = function(e) { - function t(t, i, n, r, o, a, s) { - void 0 === r && (r = false), - void 0 === o && (o = false), - void 0 === a && (a = je.a.TRILINEAR_SAMPLINGMODE), - void 0 === s && (s = { - autoPlay: true, - loop: true, - autoUpdateTexture: true + ) + return ( + g.a.Warn( + "Can not create default skybox without environment texture." + ), + null + ); + r && e && (this.environmentTexture = e); + var o = me.a.CreateBox("hdrSkyBox", i, this); + if (t) { + var a = new hr("skyBox", this); + (a.backFaceCulling = false), + (a.reflectionTexture = e.clone()), + a.reflectionTexture && + (a.reflectionTexture.coordinatesMode = + je.a.SKYBOX_MODE), + (a.microSurface = 1 - n), + (a.disableLighting = true), + (a.twoSidedLighting = true), + (o.infiniteDistance = true), + (o.material = a); + } else { + var s = new bi.a("skyBox", this); + (s.backFaceCulling = false), + (s.reflectionTexture = e.clone()), + s.reflectionTexture && + (s.reflectionTexture.coordinatesMode = + je.a.SKYBOX_MODE), + (s.disableLighting = true), + (o.infiniteDistance = true), + (o.material = s); + } + return (o.isPickable = false), o; + }), + (Y.a.prototype.createDefaultEnvironment = function (e) { + return er ? new er(e, this) : null; + }), + (Y.a.prototype.createDefaultVRExperience = function (e) { + return void 0 === e && (e = {}), new Fi(this, e); + }), + (Y.a.prototype.createDefaultXRExperienceAsync = function () { + var e = this; + return Ui.CreateAsync(this).then(function (t) { + var i = new Wi(t); + return zi + .CreateAsync(e, t, { + outputCanvasContext: i.canvasContext, + }) + .then(function (e) { + return new Hi(t), t; + }); + }); + }); + var Sr = (function (e) { + function t(t, i, n, r, o, a, s) { + void 0 === r && (r = false), + void 0 === o && (o = false), + void 0 === a && (a = je.a.TRILINEAR_SAMPLINGMODE), + void 0 === s && + (s = { + autoPlay: true, + loop: true, + autoUpdateTexture: true, }); - var c = e.call(this, null, n, !r, o) || this; - c._onUserActionRequestedObservable = null, - c._stillImageCaptured = false, - c._displayingPosterTexture = false, - c._createInternalTexture = function() { - if (null != c._texture) { - if (!c._displayingPosterTexture) - return; - c._texture.dispose(), - c._displayingPosterTexture = false - } - if (!c._engine.needPOTTextures || Ee.h.IsExponentOfTwo(c.video.videoWidth) && Ee.h.IsExponentOfTwo(c.video.videoHeight) ? (c.wrapU = je.a.WRAP_ADDRESSMODE, - c.wrapV = je.a.WRAP_ADDRESSMODE) : (c.wrapU = je.a.CLAMP_ADDRESSMODE, - c.wrapV = je.a.CLAMP_ADDRESSMODE, - c._generateMipMaps = false), - c._texture = c._engine.createDynamicTexture(c.video.videoWidth, c.video.videoHeight, c._generateMipMaps, c.samplingMode), - c.video.autoplay || c._settings.poster) - c._texture.isReady = true, + var c = e.call(this, null, n, !r, o) || this; + (c._onUserActionRequestedObservable = null), + (c._stillImageCaptured = false), + (c._displayingPosterTexture = false), + (c._createInternalTexture = function () { + if (null != c._texture) { + if (!c._displayingPosterTexture) return; + c._texture.dispose(), + (c._displayingPosterTexture = false); + } + if ( + (!c._engine.needPOTTextures || + (Ee.h.IsExponentOfTwo(c.video.videoWidth) && + Ee.h.IsExponentOfTwo(c.video.videoHeight)) + ? ((c.wrapU = je.a.WRAP_ADDRESSMODE), + (c.wrapV = je.a.WRAP_ADDRESSMODE)) + : ((c.wrapU = je.a.CLAMP_ADDRESSMODE), + (c.wrapV = je.a.CLAMP_ADDRESSMODE), + (c._generateMipMaps = false)), + (c._texture = c._engine.createDynamicTexture( + c.video.videoWidth, + c.video.videoHeight, + c._generateMipMaps, + c.samplingMode + )), + c.video.autoplay || c._settings.poster) + ) + (c._texture.isReady = true), + c._updateInternalTexture(), + c.onLoadObservable.hasObservers() && + c.onLoadObservable.notifyObservers(c); + else { + var e = c.video.onplaying, + t = false, + i = c.video.muted; + (c.video.muted = true), + (c.video.onplaying = function () { + (c.video.muted = i), + (c.video.onplaying = e), + (c._texture.isReady = true), c._updateInternalTexture(), - c.onLoadObservable.hasObservers() && c.onLoadObservable.notifyObservers(c); - else { - var e = c.video.onplaying - , t = false - , i = c.video.muted; - c.video.muted = true, - c.video.onplaying = function() { - c.video.muted = i, - c.video.onplaying = e, - c._texture.isReady = true, - c._updateInternalTexture(), - t || c.video.pause(), - c.onLoadObservable.hasObservers() && c.onLoadObservable.notifyObservers(c) - } - ; - var n = c.video.play(); - n ? n.then(function() {}).catch(function() { - t = true, - c._onUserActionRequestedObservable && c._onUserActionRequestedObservable.hasObservers() && c._onUserActionRequestedObservable.notifyObservers(c) - }) : (c.video.onplaying = e, - c._texture.isReady = true, - c._updateInternalTexture(), - c.onLoadObservable.hasObservers() && c.onLoadObservable.notifyObservers(c)) - } + t || c.video.pause(), + c.onLoadObservable.hasObservers() && + c.onLoadObservable.notifyObservers(c); + }); + var n = c.video.play(); + n + ? n + .then(function () {}) + .catch(function () { + (t = true), + c._onUserActionRequestedObservable && + c._onUserActionRequestedObservable.hasObservers() && + c._onUserActionRequestedObservable.notifyObservers( + c + ); + }) + : ((c.video.onplaying = e), + (c._texture.isReady = true), + c._updateInternalTexture(), + c.onLoadObservable.hasObservers() && + c.onLoadObservable.notifyObservers(c)); } - , - c.reset = function() { - null != c._texture && (c._displayingPosterTexture || (c._texture.dispose(), - c._texture = null)) - } - , - c._updateInternalTexture = function() { - null != c._texture && c._texture.isReady && (c.video.readyState < c.video.HAVE_CURRENT_DATA || c._displayingPosterTexture || c._engine.updateVideoTexture(c._texture, c.video, c._invertY)) - } - , - c._engine = c.getScene().getEngine(), - c._generateMipMaps = r, - c._initialSamplingMode = a, - c.autoUpdateTexture = s.autoUpdateTexture, - c.name = t || c._getName(i), - c.video = c._getVideo(i), - c._settings = s, - s.poster && (c.video.poster = s.poster), - void 0 !== s.autoPlay && (c.video.autoplay = s.autoPlay), - void 0 !== s.loop && (c.video.loop = s.loop), - c.video.setAttribute("playsinline", ""), - c.video.addEventListener("paused", c._updateInternalTexture), - c.video.addEventListener("seeked", c._updateInternalTexture), - c.video.addEventListener("emptied", c.reset), - c._createInternalTextureOnEvent = s.poster && !s.autoPlay ? "play" : "canplay", - c.video.addEventListener(c._createInternalTextureOnEvent, c._createInternalTexture); - var u = c.video.readyState >= c.video.HAVE_CURRENT_DATA; - return !s.poster || s.autoPlay && u ? u && c._createInternalTexture() : (c._texture = c._engine.createTexture(s.poster, false, true, n), - c._displayingPosterTexture = true), - c - } - return h.d(t, e), - Object.defineProperty(t.prototype, "onUserActionRequestedObservable", { - get: function() { - return this._onUserActionRequestedObservable || (this._onUserActionRequestedObservable = new o.c), + }), + (c.reset = function () { + null != c._texture && + (c._displayingPosterTexture || + (c._texture.dispose(), (c._texture = null))); + }), + (c._updateInternalTexture = function () { + null != c._texture && + c._texture.isReady && + (c.video.readyState < c.video.HAVE_CURRENT_DATA || + c._displayingPosterTexture || + c._engine.updateVideoTexture( + c._texture, + c.video, + c._invertY + )); + }), + (c._engine = c.getScene().getEngine()), + (c._generateMipMaps = r), + (c._initialSamplingMode = a), + (c.autoUpdateTexture = s.autoUpdateTexture), + (c.name = t || c._getName(i)), + (c.video = c._getVideo(i)), + (c._settings = s), + s.poster && (c.video.poster = s.poster), + void 0 !== s.autoPlay && (c.video.autoplay = s.autoPlay), + void 0 !== s.loop && (c.video.loop = s.loop), + c.video.setAttribute("playsinline", ""), + c.video.addEventListener( + "paused", + c._updateInternalTexture + ), + c.video.addEventListener( + "seeked", + c._updateInternalTexture + ), + c.video.addEventListener("emptied", c.reset), + (c._createInternalTextureOnEvent = + s.poster && !s.autoPlay ? "play" : "canplay"), + c.video.addEventListener( + c._createInternalTextureOnEvent, + c._createInternalTexture + ); + var u = c.video.readyState >= c.video.HAVE_CURRENT_DATA; + return ( + !s.poster || (s.autoPlay && u) + ? u && c._createInternalTexture() + : ((c._texture = c._engine.createTexture( + s.poster, + false, + true, + n + )), + (c._displayingPosterTexture = true)), + c + ); + } + return ( + h.d(t, e), + Object.defineProperty( + t.prototype, + "onUserActionRequestedObservable", + { + get: function () { + return ( + this._onUserActionRequestedObservable || + (this._onUserActionRequestedObservable = + new o.c()), this._onUserActionRequestedObservable + ); }, enumerable: true, - configurable: true + configurable: true, + } + ), + (t.prototype._getName = function (e) { + return e instanceof HTMLVideoElement + ? e.currentSrc + : "object" == c(e) + ? e.toString() + : e; }), - t.prototype._getName = function(e) { - return e instanceof HTMLVideoElement ? e.currentSrc : "object" == c(e) ? e.toString() : e - } - , - t.prototype._getVideo = function(e) { - if (e instanceof HTMLVideoElement) - return Ee.h.SetCorsBehavior(e.currentSrc, e), - e; - var t = document.createElement("video"); - return "string" == typeof e ? (Ee.h.SetCorsBehavior(e, t), - t.src = e) : (Ee.h.SetCorsBehavior(e[0], t), - e.forEach(function(e) { - var i = document.createElement("source"); - i.src = e, - t.appendChild(i) - })), + (t.prototype._getVideo = function (e) { + if (e instanceof HTMLVideoElement) + return Ee.h.SetCorsBehavior(e.currentSrc, e), e; + var t = document.createElement("video"); + return ( + "string" == typeof e + ? (Ee.h.SetCorsBehavior(e, t), (t.src = e)) + : (Ee.h.SetCorsBehavior(e[0], t), + e.forEach(function (e) { + var i = document.createElement("source"); + (i.src = e), t.appendChild(i); + })), t - } - , - t.prototype._rebuild = function() { - this.update() - } - , - t.prototype.update = function() { - this.autoUpdateTexture && this.updateTexture(true) - } - , - t.prototype.updateTexture = function(e) { - e && (this.video.paused && this._stillImageCaptured || (this._stillImageCaptured = true, - this._updateInternalTexture())) - } - , - t.prototype.updateURL = function(e) { - this.video.src = e - } - , - t.prototype.dispose = function() { - e.prototype.dispose.call(this), - this._onUserActionRequestedObservable && (this._onUserActionRequestedObservable.clear(), - this._onUserActionRequestedObservable = null), - this.video.removeEventListener(this._createInternalTextureOnEvent, this._createInternalTexture), - this.video.removeEventListener("paused", this._updateInternalTexture), - this.video.removeEventListener("seeked", this._updateInternalTexture), + ); + }), + (t.prototype._rebuild = function () { + this.update(); + }), + (t.prototype.update = function () { + this.autoUpdateTexture && this.updateTexture(true); + }), + (t.prototype.updateTexture = function (e) { + e && + ((this.video.paused && this._stillImageCaptured) || + ((this._stillImageCaptured = true), + this._updateInternalTexture())); + }), + (t.prototype.updateURL = function (e) { + this.video.src = e; + }), + (t.prototype.dispose = function () { + e.prototype.dispose.call(this), + this._onUserActionRequestedObservable && + (this._onUserActionRequestedObservable.clear(), + (this._onUserActionRequestedObservable = null)), + this.video.removeEventListener( + this._createInternalTextureOnEvent, + this._createInternalTexture + ), + this.video.removeEventListener( + "paused", + this._updateInternalTexture + ), + this.video.removeEventListener( + "seeked", + this._updateInternalTexture + ), this.video.removeEventListener("emptied", this.reset), - this.video.pause() - } - , - t.CreateFromStreamAsync = function(e, n) { - var r = document.createElement("video"); - return r.setAttribute("autoplay", ""), + this.video.pause(); + }), + (t.CreateFromStreamAsync = function (e, n) { + var r = document.createElement("video"); + return ( + r.setAttribute("autoplay", ""), r.setAttribute("muted", "true"), r.setAttribute("playsinline", ""), - r.muted = true, - void 0 !== r.mozSrcObject ? r.mozSrcObject = n : "object" == c(r.srcObject) ? r.srcObject = n : (window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL, - r.src = window.URL && window.URL.createObjectURL(n)), - new i(function(i) { - r.addEventListener("playing", function n() { - i(new t("video",r,e,true,true)), - r.removeEventListener("playing", n) - }), - r.play() - } - ) - } - , - t.CreateFromWebCamAsync = function(e, t, n) { - var r, o = this; - return void 0 === n && (n = false), - t && t.deviceId && (r = { - exact: t.deviceId - }), - navigator.mediaDevices ? navigator.mediaDevices.getUserMedia({ - video: t, - audio: n - }).then(function(t) { - return o.CreateFromStreamAsync(e, t) - }) : (navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia, - navigator.getUserMedia && navigator.getUserMedia({ - video: { - deviceId: r, - width: { - min: t && t.minWidth || 256, - max: t && t.maxWidth || 640 - }, - height: { - min: t && t.minHeight || 256, - max: t && t.maxHeight || 480 - } - }, - audio: n - }, function(t) { - return o.CreateFromStreamAsync(e, t) - }, function(e) { - g.a.Error(e.name) - }), - i.reject("No support for userMedia on this device")) - } - , - t.CreateFromWebCam = function(e, t, i, n) { - void 0 === n && (n = false), - this.CreateFromWebCamAsync(e, i, n).then(function(e) { - t && t(e) - }).catch(function(e) { - g.a.Error(e.name) + (r.muted = true), + void 0 !== r.mozSrcObject + ? (r.mozSrcObject = n) + : "object" == c(r.srcObject) + ? (r.srcObject = n) + : ((window.URL = + window.URL || + window.webkitURL || + window.mozURL || + window.msURL), + (r.src = + window.URL && window.URL.createObjectURL(n))), + new i(function (i) { + r.addEventListener("playing", function n() { + i(new t("video", r, e, true, true)), + r.removeEventListener("playing", n); + }), + r.play(); }) - } - , + ); + }), + (t.CreateFromWebCamAsync = function (e, t, n) { + var r, + o = this; + return ( + void 0 === n && (n = false), + t && + t.deviceId && + (r = { + exact: t.deviceId, + }), + navigator.mediaDevices + ? navigator.mediaDevices + .getUserMedia({ + video: t, + audio: n, + }) + .then(function (t) { + return o.CreateFromStreamAsync(e, t); + }) + : ((navigator.getUserMedia = + navigator.getUserMedia || + navigator.webkitGetUserMedia || + navigator.mozGetUserMedia || + navigator.msGetUserMedia), + navigator.getUserMedia && + navigator.getUserMedia( + { + video: { + deviceId: r, + width: { + min: (t && t.minWidth) || 256, + max: (t && t.maxWidth) || 640, + }, + height: { + min: (t && t.minHeight) || 256, + max: (t && t.maxHeight) || 480, + }, + }, + audio: n, + }, + function (t) { + return o.CreateFromStreamAsync(e, t); + }, + function (e) { + g.a.Error(e.name); + } + ), + i.reject("No support for userMedia on this device")) + ); + }), + (t.CreateFromWebCam = function (e, t, i, n) { + void 0 === n && (n = false), + this.CreateFromWebCamAsync(e, i, n) + .then(function (e) { + t && t(e); + }) + .catch(function (e) { + g.a.Error(e.name); + }); + }), t - }(je.a) - , Cr = function(e) { - function t(i, n, r, o) { - var s = e.call(this, i, o) || this; - s._useDirectMapping = false, - s._videoMode = t.MODE_MONOSCOPIC, - s._onBeforeCameraRenderObserver = null, - o = s.getScene(), - i = i || "videoDome", - r.resolution = 0 | Math.abs(r.resolution) || 32, - r.clickToPlay = Boolean(r.clickToPlay), - r.autoPlay = void 0 === r.autoPlay || Boolean(r.autoPlay), - r.loop = void 0 === r.loop || Boolean(r.loop), - r.size = Math.abs(r.size) || (o.activeCamera ? .48 * o.activeCamera.maxZ : 1e3), - void 0 === r.useDirectMapping ? s._useDirectMapping = true : s._useDirectMapping = r.useDirectMapping, - void 0 === r.faceForward && (r.faceForward = true), - s._setReady(false); - var c = { - loop: r.loop, - autoPlay: r.autoPlay, - autoUpdateTexture: true, - poster: r.poster - } - , u = s._material = new Jn(i + "_material",o) - , l = s._videoTexture = new Sr(i + "_texture",n,o,false,s._useDirectMapping,je.a.TRILINEAR_SAMPLINGMODE,c); - if (s._mesh = me.a.CreateSphere(i + "_mesh", r.resolution, r.size, o, false, me.a.BACKSIDE), - l.onLoadObservable.addOnce(function() { - s._setReady(true) + ); + })(je.a), + Cr = (function (e) { + function t(i, n, r, o) { + var s = e.call(this, i, o) || this; + (s._useDirectMapping = false), + (s._videoMode = t.MODE_MONOSCOPIC), + (s._onBeforeCameraRenderObserver = null), + (o = s.getScene()), + (i = i || "videoDome"), + (r.resolution = 0 | Math.abs(r.resolution) || 32), + (r.clickToPlay = Boolean(r.clickToPlay)), + (r.autoPlay = + void 0 === r.autoPlay || Boolean(r.autoPlay)), + (r.loop = void 0 === r.loop || Boolean(r.loop)), + (r.size = + Math.abs(r.size) || + (o.activeCamera ? 0.48 * o.activeCamera.maxZ : 1e3)), + void 0 === r.useDirectMapping + ? (s._useDirectMapping = true) + : (s._useDirectMapping = r.useDirectMapping), + void 0 === r.faceForward && (r.faceForward = true), + s._setReady(false); + var c = { + loop: r.loop, + autoPlay: r.autoPlay, + autoUpdateTexture: true, + poster: r.poster, + }, + u = (s._material = new Jn(i + "_material", o)), + l = (s._videoTexture = new Sr( + i + "_texture", + n, + o, + false, + s._useDirectMapping, + je.a.TRILINEAR_SAMPLINGMODE, + c + )); + if ( + ((s._mesh = me.a.CreateSphere( + i + "_mesh", + r.resolution, + r.size, + o, + false, + me.a.BACKSIDE + )), + l.onLoadObservable.addOnce(function () { + s._setReady(true); + }), + (u.useEquirectangularFOV = true), + (u.fovMultiplier = 1), + (u.opacityFresnel = false), + s._useDirectMapping + ? ((l.wrapU = je.a.CLAMP_ADDRESSMODE), + (l.wrapV = je.a.CLAMP_ADDRESSMODE), + (u.diffuseTexture = l)) + : ((l.coordinatesMode = + je.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE), + (l.wrapV = je.a.CLAMP_ADDRESSMODE), + (u.reflectionTexture = l)), + (s._mesh.material = u), + (s._mesh.parent = s), + r.clickToPlay && + (o.onPointerUp = function () { + s._videoTexture.video.play(); }), - u.useEquirectangularFOV = true, - u.fovMultiplier = 1, - u.opacityFresnel = false, - s._useDirectMapping ? (l.wrapU = je.a.CLAMP_ADDRESSMODE, - l.wrapV = je.a.CLAMP_ADDRESSMODE, - u.diffuseTexture = l) : (l.coordinatesMode = je.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE, - l.wrapV = je.a.CLAMP_ADDRESSMODE, - u.reflectionTexture = l), - s._mesh.material = u, - s._mesh.parent = s, - r.clickToPlay && (o.onPointerUp = function() { - s._videoTexture.video.play() - } - ), - r.faceForward && o.activeCamera) { - var h = o.activeCamera - , f = a.x.Forward() - , d = a.x.TransformNormal(f, h.getViewMatrix()); - d.normalize(), - s.rotation.y = Math.acos(a.x.Dot(f, d)) - } - return s + r.faceForward && o.activeCamera) + ) { + var h = o.activeCamera, + f = a.x.Forward(), + d = a.x.TransformNormal(f, h.getViewMatrix()); + d.normalize(), (s.rotation.y = Math.acos(a.x.Dot(f, d))); } - return h.d(t, e), + return s; + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "videoTexture", { - get: function() { - return this._videoTexture - }, - enumerable: true, - configurable: true + get: function () { + return this._videoTexture; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "fovMultiplier", { - get: function() { - return this._material.fovMultiplier - }, - set: function(e) { - this._material.fovMultiplier = e - }, - enumerable: true, - configurable: true + get: function () { + return this._material.fovMultiplier; + }, + set: function (e) { + this._material.fovMultiplier = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "videoMode", { - get: function() { - return this._videoMode - }, - set: function(e) { - this._videoMode !== e && this._changeVideoMode(e) - }, - enumerable: true, - configurable: true + get: function () { + return this._videoMode; + }, + set: function (e) { + this._videoMode !== e && this._changeVideoMode(e); + }, + enumerable: true, + configurable: true, }), - t.prototype._changeVideoMode = function(e) { - var i = this; - switch (this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), - this._videoMode = e, - this._videoTexture.uScale = 1, - this._videoTexture.vScale = 1, - this._videoTexture.uOffset = 0, - this._videoTexture.vOffset = 0, - e) { + (t.prototype._changeVideoMode = function (e) { + var i = this; + switch ( + (this._scene.onBeforeCameraRenderObservable.remove( + this._onBeforeCameraRenderObserver + ), + (this._videoMode = e), + (this._videoTexture.uScale = 1), + (this._videoTexture.vScale = 1), + (this._videoTexture.uOffset = 0), + (this._videoTexture.vOffset = 0), + e) + ) { case t.MODE_SIDEBYSIDE: - this._videoTexture.uScale = .5, - this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function(e) { - i._videoTexture.uOffset = e.isRightCamera ? .5 : 0 - }); - break; + (this._videoTexture.uScale = 0.5), + (this._onBeforeCameraRenderObserver = + this._scene.onBeforeCameraRenderObservable.add( + function (e) { + i._videoTexture.uOffset = e.isRightCamera + ? 0.5 + : 0; + } + )); + break; case t.MODE_TOPBOTTOM: - this._videoTexture.vScale = .5, - this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function(e) { - i._videoTexture.vOffset = e.isRightCamera ? .5 : 0 - }) - } - } - , - t.prototype.dispose = function(t, i) { - void 0 === i && (i = false), + (this._videoTexture.vScale = 0.5), + (this._onBeforeCameraRenderObserver = + this._scene.onBeforeCameraRenderObservable.add( + function (e) { + i._videoTexture.vOffset = e.isRightCamera + ? 0.5 + : 0; + } + )); + } + }), + (t.prototype.dispose = function (t, i) { + void 0 === i && (i = false), this._videoTexture.dispose(), this._mesh.dispose(), this._material.dispose(), - this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), - e.prototype.dispose.call(this, t, i) - } - , - t.MODE_MONOSCOPIC = 0, - t.MODE_TOPBOTTOM = 1, - t.MODE_SIDEBYSIDE = 2, + this._scene.onBeforeCameraRenderObservable.remove( + this._onBeforeCameraRenderObserver + ), + e.prototype.dispose.call(this, t, i); + }), + (t.MODE_MONOSCOPIC = 0), + (t.MODE_TOPBOTTOM = 1), + (t.MODE_SIDEBYSIDE = 2), t - }(tr.a) - , Pr = function() { - function e(e) { - this.engine = e, - this._captureGPUFrameTime = false, - this._gpuFrameTime = new Ee.f, - this._captureShaderCompilationTime = false, - this._shaderCompilationTime = new Ee.f, - this._onBeginFrameObserver = null, - this._onEndFrameObserver = null, - this._onBeforeShaderCompilationObserver = null, - this._onAfterShaderCompilationObserver = null - } - return Object.defineProperty(e.prototype, "gpuFrameTimeCounter", { - get: function() { - return this._gpuFrameTime - }, - enumerable: true, - configurable: true + ); + })(tr.a), + Pr = (function () { + function e(e) { + (this.engine = e), + (this._captureGPUFrameTime = false), + (this._gpuFrameTime = new Ee.f()), + (this._captureShaderCompilationTime = false), + (this._shaderCompilationTime = new Ee.f()), + (this._onBeginFrameObserver = null), + (this._onEndFrameObserver = null), + (this._onBeforeShaderCompilationObserver = null), + (this._onAfterShaderCompilationObserver = null); + } + return ( + Object.defineProperty(e.prototype, "gpuFrameTimeCounter", { + get: function () { + return this._gpuFrameTime; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "captureGPUFrameTime", { - get: function() { - return this._captureGPUFrameTime - }, - set: function(e) { - var t = this; - e !== this._captureGPUFrameTime && (this._captureGPUFrameTime = e, - e ? (this._onBeginFrameObserver = this.engine.onBeginFrameObservable.add(function() { - t._gpuFrameTimeToken || (t._gpuFrameTimeToken = t.engine.startTimeQuery()) - }), - this._onEndFrameObserver = this.engine.onEndFrameObservable.add(function() { - if (t._gpuFrameTimeToken) { - var e = t.engine.endTimeQuery(t._gpuFrameTimeToken); - e > -1 && (t._gpuFrameTimeToken = null, - t._gpuFrameTime.fetchNewFrame(), - t._gpuFrameTime.addCount(e, true)) - } - })) : (this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver), - this._onBeginFrameObserver = null, - this.engine.onEndFrameObservable.remove(this._onEndFrameObserver), - this._onEndFrameObserver = null)) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "shaderCompilationTimeCounter", { - get: function() { - return this._shaderCompilationTime - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "captureShaderCompilationTime", { - get: function() { - return this._captureShaderCompilationTime - }, - set: function(e) { - var t = this; - e !== this._captureShaderCompilationTime && (this._captureShaderCompilationTime = e, - e ? (this._onBeforeShaderCompilationObserver = this.engine.onBeforeShaderCompilationObservable.add(function() { - t._shaderCompilationTime.fetchNewFrame(), - t._shaderCompilationTime.beginMonitoring() - }), - this._onAfterShaderCompilationObserver = this.engine.onAfterShaderCompilationObservable.add(function() { - t._shaderCompilationTime.endMonitoring() - })) : (this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver), - this._onBeforeShaderCompilationObserver = null, - this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver), - this._onAfterShaderCompilationObserver = null)) - }, - enumerable: true, - configurable: true - }), - e.prototype.dispose = function() { - this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver), - this._onBeginFrameObserver = null, - this.engine.onEndFrameObservable.remove(this._onEndFrameObserver), - this._onEndFrameObserver = null, - this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver), - this._onBeforeShaderCompilationObserver = null, - this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver), - this._onAfterShaderCompilationObserver = null, - this.engine = null - } - , - e - }() - , Rr = function() { - function e(e) { + get: function () { + return this._captureGPUFrameTime; + }, + set: function (e) { var t = this; - this.scene = e, - this._captureActiveMeshesEvaluationTime = false, - this._activeMeshesEvaluationTime = new Ee.f, - this._captureRenderTargetsRenderTime = false, - this._renderTargetsRenderTime = new Ee.f, - this._captureFrameTime = false, - this._frameTime = new Ee.f, - this._captureRenderTime = false, - this._renderTime = new Ee.f, - this._captureInterFrameTime = false, - this._interFrameTime = new Ee.f, - this._captureParticlesRenderTime = false, - this._particlesRenderTime = new Ee.f, - this._captureSpritesRenderTime = false, - this._spritesRenderTime = new Ee.f, - this._capturePhysicsTime = false, - this._physicsTime = new Ee.f, - this._captureAnimationsTime = false, - this._animationsTime = new Ee.f, - this._captureCameraRenderTime = false, - this._cameraRenderTime = new Ee.f, - this._onBeforeActiveMeshesEvaluationObserver = null, - this._onAfterActiveMeshesEvaluationObserver = null, - this._onBeforeRenderTargetsRenderObserver = null, - this._onAfterRenderTargetsRenderObserver = null, - this._onAfterRenderObserver = null, - this._onBeforeDrawPhaseObserver = null, - this._onAfterDrawPhaseObserver = null, - this._onBeforeAnimationsObserver = null, - this._onBeforeParticlesRenderingObserver = null, - this._onAfterParticlesRenderingObserver = null, - this._onBeforeSpritesRenderingObserver = null, - this._onAfterSpritesRenderingObserver = null, - this._onBeforePhysicsObserver = null, - this._onAfterPhysicsObserver = null, - this._onAfterAnimationsObserver = null, - this._onBeforeCameraRenderObserver = null, - this._onAfterCameraRenderObserver = null, - this._onBeforeAnimationsObserver = e.onBeforeAnimationsObservable.add(function() { - t._captureActiveMeshesEvaluationTime && t._activeMeshesEvaluationTime.fetchNewFrame(), - t._captureRenderTargetsRenderTime && t._renderTargetsRenderTime.fetchNewFrame(), - t._captureFrameTime && (Ee.h.StartPerformanceCounter("Scene rendering"), - t._frameTime.beginMonitoring()), - t._captureInterFrameTime && t._interFrameTime.endMonitoring(), - t._captureParticlesRenderTime && t._particlesRenderTime.fetchNewFrame(), - t._captureSpritesRenderTime && t._spritesRenderTime.fetchNewFrame(), - t._captureAnimationsTime && t._animationsTime.beginMonitoring(), - t.scene.getEngine()._drawCalls.fetchNewFrame() - }), - this._onAfterRenderObserver = e.onAfterRenderObservable.add(function() { - t._captureFrameTime && (Ee.h.EndPerformanceCounter("Scene rendering"), + e !== this._captureGPUFrameTime && + ((this._captureGPUFrameTime = e), + e + ? ((this._onBeginFrameObserver = + this.engine.onBeginFrameObservable.add( + function () { + t._gpuFrameTimeToken || + (t._gpuFrameTimeToken = + t.engine.startTimeQuery()); + } + )), + (this._onEndFrameObserver = + this.engine.onEndFrameObservable.add( + function () { + if (t._gpuFrameTimeToken) { + var e = t.engine.endTimeQuery( + t._gpuFrameTimeToken + ); + e > -1 && + ((t._gpuFrameTimeToken = null), + t._gpuFrameTime.fetchNewFrame(), + t._gpuFrameTime.addCount(e, true)); + } + } + ))) + : (this.engine.onBeginFrameObservable.remove( + this._onBeginFrameObserver + ), + (this._onBeginFrameObserver = null), + this.engine.onEndFrameObservable.remove( + this._onEndFrameObserver + ), + (this._onEndFrameObserver = null))); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "shaderCompilationTimeCounter", + { + get: function () { + return this._shaderCompilationTime; + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "captureShaderCompilationTime", + { + get: function () { + return this._captureShaderCompilationTime; + }, + set: function (e) { + var t = this; + e !== this._captureShaderCompilationTime && + ((this._captureShaderCompilationTime = e), + e + ? ((this._onBeforeShaderCompilationObserver = + this.engine.onBeforeShaderCompilationObservable.add( + function () { + t._shaderCompilationTime.fetchNewFrame(), + t._shaderCompilationTime.beginMonitoring(); + } + )), + (this._onAfterShaderCompilationObserver = + this.engine.onAfterShaderCompilationObservable.add( + function () { + t._shaderCompilationTime.endMonitoring(); + } + ))) + : (this.engine.onBeforeShaderCompilationObservable.remove( + this._onBeforeShaderCompilationObserver + ), + (this._onBeforeShaderCompilationObserver = + null), + this.engine.onAfterShaderCompilationObservable.remove( + this._onAfterShaderCompilationObserver + ), + (this._onAfterShaderCompilationObserver = + null))); + }, + enumerable: true, + configurable: true, + } + ), + (e.prototype.dispose = function () { + this.engine.onBeginFrameObservable.remove( + this._onBeginFrameObserver + ), + (this._onBeginFrameObserver = null), + this.engine.onEndFrameObservable.remove( + this._onEndFrameObserver + ), + (this._onEndFrameObserver = null), + this.engine.onBeforeShaderCompilationObservable.remove( + this._onBeforeShaderCompilationObserver + ), + (this._onBeforeShaderCompilationObserver = null), + this.engine.onAfterShaderCompilationObservable.remove( + this._onAfterShaderCompilationObserver + ), + (this._onAfterShaderCompilationObserver = null), + (this.engine = null); + }), + e + ); + })(), + Rr = (function () { + function e(e) { + var t = this; + (this.scene = e), + (this._captureActiveMeshesEvaluationTime = false), + (this._activeMeshesEvaluationTime = new Ee.f()), + (this._captureRenderTargetsRenderTime = false), + (this._renderTargetsRenderTime = new Ee.f()), + (this._captureFrameTime = false), + (this._frameTime = new Ee.f()), + (this._captureRenderTime = false), + (this._renderTime = new Ee.f()), + (this._captureInterFrameTime = false), + (this._interFrameTime = new Ee.f()), + (this._captureParticlesRenderTime = false), + (this._particlesRenderTime = new Ee.f()), + (this._captureSpritesRenderTime = false), + (this._spritesRenderTime = new Ee.f()), + (this._capturePhysicsTime = false), + (this._physicsTime = new Ee.f()), + (this._captureAnimationsTime = false), + (this._animationsTime = new Ee.f()), + (this._captureCameraRenderTime = false), + (this._cameraRenderTime = new Ee.f()), + (this._onBeforeActiveMeshesEvaluationObserver = null), + (this._onAfterActiveMeshesEvaluationObserver = null), + (this._onBeforeRenderTargetsRenderObserver = null), + (this._onAfterRenderTargetsRenderObserver = null), + (this._onAfterRenderObserver = null), + (this._onBeforeDrawPhaseObserver = null), + (this._onAfterDrawPhaseObserver = null), + (this._onBeforeAnimationsObserver = null), + (this._onBeforeParticlesRenderingObserver = null), + (this._onAfterParticlesRenderingObserver = null), + (this._onBeforeSpritesRenderingObserver = null), + (this._onAfterSpritesRenderingObserver = null), + (this._onBeforePhysicsObserver = null), + (this._onAfterPhysicsObserver = null), + (this._onAfterAnimationsObserver = null), + (this._onBeforeCameraRenderObserver = null), + (this._onAfterCameraRenderObserver = null), + (this._onBeforeAnimationsObserver = + e.onBeforeAnimationsObservable.add(function () { + t._captureActiveMeshesEvaluationTime && + t._activeMeshesEvaluationTime.fetchNewFrame(), + t._captureRenderTargetsRenderTime && + t._renderTargetsRenderTime.fetchNewFrame(), + t._captureFrameTime && + (Ee.h.StartPerformanceCounter("Scene rendering"), + t._frameTime.beginMonitoring()), + t._captureInterFrameTime && + t._interFrameTime.endMonitoring(), + t._captureParticlesRenderTime && + t._particlesRenderTime.fetchNewFrame(), + t._captureSpritesRenderTime && + t._spritesRenderTime.fetchNewFrame(), + t._captureAnimationsTime && + t._animationsTime.beginMonitoring(), + t.scene.getEngine()._drawCalls.fetchNewFrame(); + })), + (this._onAfterRenderObserver = + e.onAfterRenderObservable.add(function () { + t._captureFrameTime && + (Ee.h.EndPerformanceCounter("Scene rendering"), t._frameTime.endMonitoring()), - t._captureRenderTime && t._renderTime.endMonitoring(false), - t._captureInterFrameTime && t._interFrameTime.beginMonitoring() - }) - } - return Object.defineProperty(e.prototype, "activeMeshesEvaluationTimeCounter", { - get: function() { - return this._activeMeshesEvaluationTime + t._captureRenderTime && + t._renderTime.endMonitoring(false), + t._captureInterFrameTime && + t._interFrameTime.beginMonitoring(); + })); + } + return ( + Object.defineProperty( + e.prototype, + "activeMeshesEvaluationTimeCounter", + { + get: function () { + return this._activeMeshesEvaluationTime; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "captureActiveMeshesEvaluationTime", { - get: function() { - return this._captureActiveMeshesEvaluationTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "captureActiveMeshesEvaluationTime", + { + get: function () { + return this._captureActiveMeshesEvaluationTime; }, - set: function(e) { - var t = this; - e !== this._captureActiveMeshesEvaluationTime && (this._captureActiveMeshesEvaluationTime = e, - e ? (this._onBeforeActiveMeshesEvaluationObserver = this.scene.onBeforeActiveMeshesEvaluationObservable.add(function() { - Ee.h.StartPerformanceCounter("Active meshes evaluation"), - t._activeMeshesEvaluationTime.beginMonitoring() - }), - this._onAfterActiveMeshesEvaluationObserver = this.scene.onAfterActiveMeshesEvaluationObservable.add(function() { - Ee.h.EndPerformanceCounter("Active meshes evaluation"), - t._activeMeshesEvaluationTime.endMonitoring() - })) : (this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver), - this._onBeforeActiveMeshesEvaluationObserver = null, - this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver), - this._onAfterActiveMeshesEvaluationObserver = null)) + set: function (e) { + var t = this; + e !== this._captureActiveMeshesEvaluationTime && + ((this._captureActiveMeshesEvaluationTime = e), + e + ? ((this._onBeforeActiveMeshesEvaluationObserver = + this.scene.onBeforeActiveMeshesEvaluationObservable.add( + function () { + Ee.h.StartPerformanceCounter( + "Active meshes evaluation" + ), + t._activeMeshesEvaluationTime.beginMonitoring(); + } + )), + (this._onAfterActiveMeshesEvaluationObserver = + this.scene.onAfterActiveMeshesEvaluationObservable.add( + function () { + Ee.h.EndPerformanceCounter( + "Active meshes evaluation" + ), + t._activeMeshesEvaluationTime.endMonitoring(); + } + ))) + : (this.scene.onBeforeActiveMeshesEvaluationObservable.remove( + this._onBeforeActiveMeshesEvaluationObserver + ), + (this._onBeforeActiveMeshesEvaluationObserver = + null), + this.scene.onAfterActiveMeshesEvaluationObservable.remove( + this._onAfterActiveMeshesEvaluationObserver + ), + (this._onAfterActiveMeshesEvaluationObserver = + null))); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "renderTargetsRenderTimeCounter", { - get: function() { - return this._renderTargetsRenderTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "renderTargetsRenderTimeCounter", + { + get: function () { + return this._renderTargetsRenderTime; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "captureRenderTargetsRenderTime", { - get: function() { - return this._captureRenderTargetsRenderTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "captureRenderTargetsRenderTime", + { + get: function () { + return this._captureRenderTargetsRenderTime; }, - set: function(e) { - var t = this; - e !== this._captureRenderTargetsRenderTime && (this._captureRenderTargetsRenderTime = e, - e ? (this._onBeforeRenderTargetsRenderObserver = this.scene.onBeforeRenderTargetsRenderObservable.add(function() { - Ee.h.StartPerformanceCounter("Render targets rendering"), - t._renderTargetsRenderTime.beginMonitoring() - }), - this._onAfterRenderTargetsRenderObserver = this.scene.onAfterRenderTargetsRenderObservable.add(function() { - Ee.h.EndPerformanceCounter("Render targets rendering"), - t._renderTargetsRenderTime.endMonitoring(false) - })) : (this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver), - this._onBeforeRenderTargetsRenderObserver = null, - this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver), - this._onAfterRenderTargetsRenderObserver = null)) + set: function (e) { + var t = this; + e !== this._captureRenderTargetsRenderTime && + ((this._captureRenderTargetsRenderTime = e), + e + ? ((this._onBeforeRenderTargetsRenderObserver = + this.scene.onBeforeRenderTargetsRenderObservable.add( + function () { + Ee.h.StartPerformanceCounter( + "Render targets rendering" + ), + t._renderTargetsRenderTime.beginMonitoring(); + } + )), + (this._onAfterRenderTargetsRenderObserver = + this.scene.onAfterRenderTargetsRenderObservable.add( + function () { + Ee.h.EndPerformanceCounter( + "Render targets rendering" + ), + t._renderTargetsRenderTime.endMonitoring( + false + ); + } + ))) + : (this.scene.onBeforeRenderTargetsRenderObservable.remove( + this._onBeforeRenderTargetsRenderObserver + ), + (this._onBeforeRenderTargetsRenderObserver = + null), + this.scene.onAfterRenderTargetsRenderObservable.remove( + this._onAfterRenderTargetsRenderObserver + ), + (this._onAfterRenderTargetsRenderObserver = + null))); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "particlesRenderTimeCounter", { - get: function() { - return this._particlesRenderTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "particlesRenderTimeCounter", + { + get: function () { + return this._particlesRenderTime; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "captureParticlesRenderTime", { - get: function() { - return this._captureParticlesRenderTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "captureParticlesRenderTime", + { + get: function () { + return this._captureParticlesRenderTime; }, - set: function(e) { - var t = this; - e !== this._captureParticlesRenderTime && (this._captureParticlesRenderTime = e, - e ? (this._onBeforeParticlesRenderingObserver = this.scene.onBeforeParticlesRenderingObservable.add(function() { - Ee.h.StartPerformanceCounter("Particles"), - t._particlesRenderTime.beginMonitoring() - }), - this._onAfterParticlesRenderingObserver = this.scene.onAfterParticlesRenderingObservable.add(function() { - Ee.h.EndPerformanceCounter("Particles"), - t._particlesRenderTime.endMonitoring(false) - })) : (this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver), - this._onBeforeParticlesRenderingObserver = null, - this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver), - this._onAfterParticlesRenderingObserver = null)) + set: function (e) { + var t = this; + e !== this._captureParticlesRenderTime && + ((this._captureParticlesRenderTime = e), + e + ? ((this._onBeforeParticlesRenderingObserver = + this.scene.onBeforeParticlesRenderingObservable.add( + function () { + Ee.h.StartPerformanceCounter("Particles"), + t._particlesRenderTime.beginMonitoring(); + } + )), + (this._onAfterParticlesRenderingObserver = + this.scene.onAfterParticlesRenderingObservable.add( + function () { + Ee.h.EndPerformanceCounter("Particles"), + t._particlesRenderTime.endMonitoring( + false + ); + } + ))) + : (this.scene.onBeforeParticlesRenderingObservable.remove( + this._onBeforeParticlesRenderingObserver + ), + (this._onBeforeParticlesRenderingObserver = + null), + this.scene.onAfterParticlesRenderingObservable.remove( + this._onAfterParticlesRenderingObserver + ), + (this._onAfterParticlesRenderingObserver = + null))); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "spritesRenderTimeCounter", { - get: function() { - return this._spritesRenderTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "spritesRenderTimeCounter", + { + get: function () { + return this._spritesRenderTime; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "captureSpritesRenderTime", { - get: function() { - return this._captureSpritesRenderTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "captureSpritesRenderTime", + { + get: function () { + return this._captureSpritesRenderTime; }, - set: function(e) { - var t = this; - e !== this._captureSpritesRenderTime && (this._captureSpritesRenderTime = e, - this.scene.spriteManagers && (e ? (this._onBeforeSpritesRenderingObserver = this.scene.onBeforeSpritesRenderingObservable.add(function() { - Ee.h.StartPerformanceCounter("Sprites"), - t._spritesRenderTime.beginMonitoring() - }), - this._onAfterSpritesRenderingObserver = this.scene.onAfterSpritesRenderingObservable.add(function() { - Ee.h.EndPerformanceCounter("Sprites"), - t._spritesRenderTime.endMonitoring(false) - })) : (this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver), - this._onBeforeSpritesRenderingObserver = null, - this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver), - this._onAfterSpritesRenderingObserver = null))) + set: function (e) { + var t = this; + e !== this._captureSpritesRenderTime && + ((this._captureSpritesRenderTime = e), + this.scene.spriteManagers && + (e + ? ((this._onBeforeSpritesRenderingObserver = + this.scene.onBeforeSpritesRenderingObservable.add( + function () { + Ee.h.StartPerformanceCounter("Sprites"), + t._spritesRenderTime.beginMonitoring(); + } + )), + (this._onAfterSpritesRenderingObserver = + this.scene.onAfterSpritesRenderingObservable.add( + function () { + Ee.h.EndPerformanceCounter("Sprites"), + t._spritesRenderTime.endMonitoring( + false + ); + } + ))) + : (this.scene.onBeforeSpritesRenderingObservable.remove( + this._onBeforeSpritesRenderingObserver + ), + (this._onBeforeSpritesRenderingObserver = + null), + this.scene.onAfterSpritesRenderingObservable.remove( + this._onAfterSpritesRenderingObserver + ), + (this._onAfterSpritesRenderingObserver = + null)))); }, enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "physicsTimeCounter", { - get: function() { - return this._physicsTime - }, - enumerable: true, - configurable: true + get: function () { + return this._physicsTime; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "capturePhysicsTime", { - get: function() { - return this._capturePhysicsTime - }, - set: function(e) { - var t = this; - e !== this._capturePhysicsTime && this.scene.onBeforePhysicsObservable && (this._capturePhysicsTime = e, - e ? (this._onBeforePhysicsObserver = this.scene.onBeforePhysicsObservable.add(function() { - Ee.h.StartPerformanceCounter("Physics"), - t._physicsTime.beginMonitoring() - }), - this._onAfterPhysicsObserver = this.scene.onAfterPhysicsObservable.add(function() { - Ee.h.EndPerformanceCounter("Physics"), - t._physicsTime.endMonitoring() - })) : (this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver), - this._onBeforePhysicsObserver = null, - this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver), - this._onAfterPhysicsObserver = null)) + get: function () { + return this._capturePhysicsTime; + }, + set: function (e) { + var t = this; + e !== this._capturePhysicsTime && + this.scene.onBeforePhysicsObservable && + ((this._capturePhysicsTime = e), + e + ? ((this._onBeforePhysicsObserver = + this.scene.onBeforePhysicsObservable.add( + function () { + Ee.h.StartPerformanceCounter("Physics"), + t._physicsTime.beginMonitoring(); + } + )), + (this._onAfterPhysicsObserver = + this.scene.onAfterPhysicsObservable.add( + function () { + Ee.h.EndPerformanceCounter("Physics"), + t._physicsTime.endMonitoring(); + } + ))) + : (this.scene.onBeforePhysicsObservable.remove( + this._onBeforePhysicsObserver + ), + (this._onBeforePhysicsObserver = null), + this.scene.onAfterPhysicsObservable.remove( + this._onAfterPhysicsObserver + ), + (this._onAfterPhysicsObserver = null))); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "animationsTimeCounter", + { + get: function () { + return this._animationsTime; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "animationsTimeCounter", { - get: function() { - return this._animationsTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "captureAnimationsTime", + { + get: function () { + return this._captureAnimationsTime; + }, + set: function (e) { + var t = this; + e !== this._captureAnimationsTime && + ((this._captureAnimationsTime = e), + e + ? (this._onAfterAnimationsObserver = + this.scene.onAfterAnimationsObservable.add( + function () { + t._animationsTime.endMonitoring(); + } + )) + : (this.scene.onAfterAnimationsObservable.remove( + this._onAfterAnimationsObserver + ), + (this._onAfterAnimationsObserver = null))); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "captureAnimationsTime", { - get: function() { - return this._captureAnimationsTime - }, - set: function(e) { - var t = this; - e !== this._captureAnimationsTime && (this._captureAnimationsTime = e, - e ? this._onAfterAnimationsObserver = this.scene.onAfterAnimationsObservable.add(function() { - t._animationsTime.endMonitoring() - }) : (this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver), - this._onAfterAnimationsObserver = null)) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "frameTimeCounter", { - get: function() { - return this._frameTime - }, - enumerable: true, - configurable: true + get: function () { + return this._frameTime; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "captureFrameTime", { - get: function() { - return this._captureFrameTime - }, - set: function(e) { - this._captureFrameTime = e + get: function () { + return this._captureFrameTime; + }, + set: function (e) { + this._captureFrameTime = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "interFrameTimeCounter", + { + get: function () { + return this._interFrameTime; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "interFrameTimeCounter", { - get: function() { - return this._interFrameTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "captureInterFrameTime", + { + get: function () { + return this._captureInterFrameTime; + }, + set: function (e) { + this._captureInterFrameTime = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "captureInterFrameTime", { - get: function() { - return this._captureInterFrameTime - }, - set: function(e) { - this._captureInterFrameTime = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "renderTimeCounter", { - get: function() { - return this._renderTime - }, - enumerable: true, - configurable: true + get: function () { + return this._renderTime; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "captureRenderTime", { - get: function() { - return this._captureRenderTime - }, - set: function(e) { - var t = this; - e !== this._captureRenderTime && (this._captureRenderTime = e, - e ? (this._onBeforeDrawPhaseObserver = this.scene.onBeforeDrawPhaseObservable.add(function() { - t._renderTime.beginMonitoring(), - Ee.h.StartPerformanceCounter("Main render") - }), - this._onAfterDrawPhaseObserver = this.scene.onAfterDrawPhaseObservable.add(function() { - t._renderTime.endMonitoring(false), - Ee.h.EndPerformanceCounter("Main render") - })) : (this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver), - this._onBeforeDrawPhaseObserver = null, - this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver), - this._onAfterDrawPhaseObserver = null)) + get: function () { + return this._captureRenderTime; + }, + set: function (e) { + var t = this; + e !== this._captureRenderTime && + ((this._captureRenderTime = e), + e + ? ((this._onBeforeDrawPhaseObserver = + this.scene.onBeforeDrawPhaseObservable.add( + function () { + t._renderTime.beginMonitoring(), + Ee.h.StartPerformanceCounter( + "Main render" + ); + } + )), + (this._onAfterDrawPhaseObserver = + this.scene.onAfterDrawPhaseObservable.add( + function () { + t._renderTime.endMonitoring(false), + Ee.h.EndPerformanceCounter("Main render"); + } + ))) + : (this.scene.onBeforeDrawPhaseObservable.remove( + this._onBeforeDrawPhaseObserver + ), + (this._onBeforeDrawPhaseObserver = null), + this.scene.onAfterDrawPhaseObservable.remove( + this._onAfterDrawPhaseObserver + ), + (this._onAfterDrawPhaseObserver = null))); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "cameraRenderTimeCounter", + { + get: function () { + return this._cameraRenderTime; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "cameraRenderTimeCounter", { - get: function() { - return this._cameraRenderTime + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "captureCameraRenderTime", + { + get: function () { + return this._captureCameraRenderTime; + }, + set: function (e) { + var t = this; + e !== this._captureCameraRenderTime && + ((this._captureCameraRenderTime = e), + e + ? ((this._onBeforeCameraRenderObserver = + this.scene.onBeforeCameraRenderObservable.add( + function (e) { + t._cameraRenderTime.beginMonitoring(), + Ee.h.StartPerformanceCounter( + "Rendering camera " + e.name + ); + } + )), + (this._onAfterCameraRenderObserver = + this.scene.onAfterCameraRenderObservable.add( + function (e) { + t._cameraRenderTime.endMonitoring(false), + Ee.h.EndPerformanceCounter( + "Rendering camera " + e.name + ); + } + ))) + : (this.scene.onBeforeCameraRenderObservable.remove( + this._onBeforeCameraRenderObserver + ), + (this._onBeforeCameraRenderObserver = null), + this.scene.onAfterCameraRenderObservable.remove( + this._onAfterCameraRenderObserver + ), + (this._onAfterCameraRenderObserver = null))); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "captureCameraRenderTime", { - get: function() { - return this._captureCameraRenderTime - }, - set: function(e) { - var t = this; - e !== this._captureCameraRenderTime && (this._captureCameraRenderTime = e, - e ? (this._onBeforeCameraRenderObserver = this.scene.onBeforeCameraRenderObservable.add(function(e) { - t._cameraRenderTime.beginMonitoring(), - Ee.h.StartPerformanceCounter("Rendering camera " + e.name) - }), - this._onAfterCameraRenderObserver = this.scene.onAfterCameraRenderObservable.add(function(e) { - t._cameraRenderTime.endMonitoring(false), - Ee.h.EndPerformanceCounter("Rendering camera " + e.name) - })) : (this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), - this._onBeforeCameraRenderObserver = null, - this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver), - this._onAfterCameraRenderObserver = null)) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "drawCallsCounter", { - get: function() { - return this.scene.getEngine()._drawCalls - }, - enumerable: true, - configurable: true + get: function () { + return this.scene.getEngine()._drawCalls; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.dispose = function () { + this.scene.onAfterRenderObservable.remove( + this._onAfterRenderObserver + ), + (this._onAfterRenderObserver = null), + this.scene.onBeforeActiveMeshesEvaluationObservable.remove( + this._onBeforeActiveMeshesEvaluationObserver + ), + (this._onBeforeActiveMeshesEvaluationObserver = null), + this.scene.onAfterActiveMeshesEvaluationObservable.remove( + this._onAfterActiveMeshesEvaluationObserver + ), + (this._onAfterActiveMeshesEvaluationObserver = null), + this.scene.onBeforeRenderTargetsRenderObservable.remove( + this._onBeforeRenderTargetsRenderObserver + ), + (this._onBeforeRenderTargetsRenderObserver = null), + this.scene.onAfterRenderTargetsRenderObservable.remove( + this._onAfterRenderTargetsRenderObserver + ), + (this._onAfterRenderTargetsRenderObserver = null), + this.scene.onBeforeAnimationsObservable.remove( + this._onBeforeAnimationsObserver + ), + (this._onBeforeAnimationsObserver = null), + this.scene.onBeforeParticlesRenderingObservable.remove( + this._onBeforeParticlesRenderingObserver + ), + (this._onBeforeParticlesRenderingObserver = null), + this.scene.onAfterParticlesRenderingObservable.remove( + this._onAfterParticlesRenderingObserver + ), + (this._onAfterParticlesRenderingObserver = null), + this._onBeforeSpritesRenderingObserver && + (this.scene.onBeforeSpritesRenderingObservable.remove( + this._onBeforeSpritesRenderingObserver + ), + (this._onBeforeSpritesRenderingObserver = null)), + this._onAfterSpritesRenderingObserver && + (this.scene.onAfterSpritesRenderingObservable.remove( + this._onAfterSpritesRenderingObserver + ), + (this._onAfterSpritesRenderingObserver = null)), + this.scene.onBeforeDrawPhaseObservable.remove( + this._onBeforeDrawPhaseObserver + ), + (this._onBeforeDrawPhaseObserver = null), + this.scene.onAfterDrawPhaseObservable.remove( + this._onAfterDrawPhaseObserver + ), + (this._onAfterDrawPhaseObserver = null), + this._onBeforePhysicsObserver && + (this.scene.onBeforePhysicsObservable.remove( + this._onBeforePhysicsObserver + ), + (this._onBeforePhysicsObserver = null)), + this._onAfterPhysicsObserver && + (this.scene.onAfterPhysicsObservable.remove( + this._onAfterPhysicsObserver + ), + (this._onAfterPhysicsObserver = null)), + this.scene.onAfterAnimationsObservable.remove( + this._onAfterAnimationsObserver + ), + (this._onAfterAnimationsObserver = null), + this.scene.onBeforeCameraRenderObservable.remove( + this._onBeforeCameraRenderObserver + ), + (this._onBeforeCameraRenderObserver = null), + this.scene.onAfterCameraRenderObservable.remove( + this._onAfterCameraRenderObserver + ), + (this._onAfterCameraRenderObserver = null), + (this.scene = null); }), - e.prototype.dispose = function() { - this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver), - this._onAfterRenderObserver = null, - this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver), - this._onBeforeActiveMeshesEvaluationObserver = null, - this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver), - this._onAfterActiveMeshesEvaluationObserver = null, - this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver), - this._onBeforeRenderTargetsRenderObserver = null, - this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver), - this._onAfterRenderTargetsRenderObserver = null, - this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver), - this._onBeforeAnimationsObserver = null, - this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver), - this._onBeforeParticlesRenderingObserver = null, - this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver), - this._onAfterParticlesRenderingObserver = null, - this._onBeforeSpritesRenderingObserver && (this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver), - this._onBeforeSpritesRenderingObserver = null), - this._onAfterSpritesRenderingObserver && (this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver), - this._onAfterSpritesRenderingObserver = null), - this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver), - this._onBeforeDrawPhaseObserver = null, - this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver), - this._onAfterDrawPhaseObserver = null, - this._onBeforePhysicsObserver && (this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver), - this._onBeforePhysicsObserver = null), - this._onAfterPhysicsObserver && (this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver), - this._onAfterPhysicsObserver = null), - this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver), - this._onAfterAnimationsObserver = null, - this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), - this._onBeforeCameraRenderObserver = null, - this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver), - this._onAfterCameraRenderObserver = null, - this.scene = null - } - , e - }() - , Mr = n(20); - Ht.a.ShadersStore.glowMapGenerationPixelShader = "#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform sampler2D opacitySampler;\nuniform float opacityIntensity;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef VERTEXALPHA\nvarying vec4 vColor;\n#endif\nuniform vec4 glowColor;\nvoid main(void)\n{\nvec4 finalColor=glowColor;\n\n#ifdef DIFFUSE\nvec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);\nfinalColor.a*=albedoTexture.a;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor.a*=getLuminance(opacityMap.rgb);\n#else\nfinalColor.a*=opacityMap.a;\n#endif\nfinalColor.a*=opacityIntensity;\n#endif\n#ifdef VERTEXALPHA\nfinalColor.a*=vColor.a;\n#endif\n#ifdef ALPHATEST\nif (finalColor.a\n#include\n#include[0..maxSimultaneousMorphTargets]\n\n#include\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform mat4 opacityMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef VERTEXALPHA\nattribute vec4 color;\nvarying vec4 vColor;\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#ifdef CUBEMAP\nvPosition=finalWorld*vec4(positionUpdated,1.0);\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\ngl_Position=vPosition;\n#endif\n#ifdef DIFFUSE\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef OPACITY\n#ifdef OPACITYUV1\nvUVOpacity=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef OPACITYUV2\nvUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef VERTEXALPHA\nvColor=color;\n#endif\n}"; + var Or = (function () { + function e(t, i) { + (this._vertexBuffers = {}), + (this._maxSize = 0), + (this._mainTextureDesiredSize = { + width: 0, + height: 0, }), - Object.defineProperty(e.prototype, "renderingGroupId", { - get: function() { - return this._effectLayerOptions.renderingGroupId - }, - enumerable: true, - configurable: true + (this._shouldRender = true), + (this._postProcesses = []), + (this._textures = []), + (this._emissiveTextureAndColor = { + texture: null, + color: new a.f(), }), - e.prototype._init = function(e) { - this._effectLayerOptions = h.a({ - mainTextureRatio: .5, - alphaBlendingMode: _.a.ALPHA_COMBINE, - camera: null, - renderingGroupId: -1 - }, e), - this._setMainTextureSize(), - this._createMainTexture(), - this._createTextureAndPostProcesses(), - this._mergeEffect = this._createMergeEffect() - } - , - e.prototype._generateIndexBuffer = function() { - var e = []; - e.push(0), - e.push(1), - e.push(2), - e.push(0), - e.push(2), - e.push(3), - this._indexBuffer = this._engine.createIndexBuffer(e) - } - , - e.prototype._generateVertexBuffer = function() { - var e = []; - e.push(1, 1), - e.push(-1, 1), - e.push(-1, -1), - e.push(1, -1); - var t = new Si.b(this._engine,e,Si.b.PositionKind,false,false,2); - this._vertexBuffers[Si.b.PositionKind] = t - } - , - e.prototype._setMainTextureSize = function() { - this._effectLayerOptions.mainTextureFixedSize ? (this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize, - this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize) : (this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio, - this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio, - this._mainTextureDesiredSize.width = this._engine.needPOTTextures ? Ee.h.GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize) : this._mainTextureDesiredSize.width, - this._mainTextureDesiredSize.height = this._engine.needPOTTextures ? Ee.h.GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize) : this._mainTextureDesiredSize.height), - this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width), - this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height) - } - , - e.prototype._createMainTexture = function() { - var e = this; - this._mainTexture = new li("HighlightLayerMainRTT",{ - width: this._mainTextureDesiredSize.width, - height: this._mainTextureDesiredSize.height - },this._scene,false,true,_.a.TEXTURETYPE_UNSIGNED_INT), - this._mainTexture.activeCamera = this._effectLayerOptions.camera, - this._mainTexture.wrapU = je.a.CLAMP_ADDRESSMODE, - this._mainTexture.wrapV = je.a.CLAMP_ADDRESSMODE, - this._mainTexture.anisotropicFilteringLevel = 1, - this._mainTexture.updateSamplingMode(je.a.BILINEAR_SAMPLINGMODE), - this._mainTexture.renderParticles = false, - this._mainTexture.renderList = null, - this._mainTexture.ignoreCameraViewport = true, - this._mainTexture.customRenderFunction = function(t, i, n, r) { - var o; - e.onBeforeRenderMainTextureObservable.notifyObservers(e); - var a = e._scene.getEngine(); - if (r.length) { - for (a.setColorWrite(false), - o = 0; o < r.length; o++) - e._renderSubMesh(r.data[o]); - a.setColorWrite(true) - } - for (o = 0; o < t.length; o++) - e._renderSubMesh(t.data[o]); - for (o = 0; o < i.length; o++) - e._renderSubMesh(i.data[o]); - var s = a.getAlphaMode(); - for (o = 0; o < n.length; o++) - e._renderSubMesh(n.data[o], true); - a.setAlphaMode(s) + (this.neutralColor = new a.f()), + (this.isEnabled = true), + (this.onDisposeObservable = new o.c()), + (this.onBeforeRenderMainTextureObservable = new o.c()), + (this.onBeforeComposeObservable = new o.c()), + (this.onAfterComposeObservable = new o.c()), + (this.onSizeChangedObservable = new o.c()), + (this.name = t), + (this._scene = i || R.a.LastCreatedScene), + e._SceneComponentInitialization(this._scene), + (this._engine = this._scene.getEngine()), + (this._maxSize = this._engine.getCaps().maxTextureSize), + this._scene.effectLayers.push(this), + this._generateIndexBuffer(), + this._generateVertexBuffer(); + } + return ( + Object.defineProperty(e.prototype, "camera", { + get: function () { + return this._effectLayerOptions.camera; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "renderingGroupId", { + get: function () { + return this._effectLayerOptions.renderingGroupId; + }, + enumerable: true, + configurable: true, + }), + (e.prototype._init = function (e) { + (this._effectLayerOptions = h.a( + { + mainTextureRatio: 0.5, + alphaBlendingMode: _.a.ALPHA_COMBINE, + camera: null, + renderingGroupId: -1, + }, + e + )), + this._setMainTextureSize(), + this._createMainTexture(), + this._createTextureAndPostProcesses(), + (this._mergeEffect = this._createMergeEffect()); + }), + (e.prototype._generateIndexBuffer = function () { + var e = []; + e.push(0), + e.push(1), + e.push(2), + e.push(0), + e.push(2), + e.push(3), + (this._indexBuffer = this._engine.createIndexBuffer(e)); + }), + (e.prototype._generateVertexBuffer = function () { + var e = []; + e.push(1, 1), e.push(-1, 1), e.push(-1, -1), e.push(1, -1); + var t = new Si.b( + this._engine, + e, + Si.b.PositionKind, + false, + false, + 2 + ); + this._vertexBuffers[Si.b.PositionKind] = t; + }), + (e.prototype._setMainTextureSize = function () { + this._effectLayerOptions.mainTextureFixedSize + ? ((this._mainTextureDesiredSize.width = + this._effectLayerOptions.mainTextureFixedSize), + (this._mainTextureDesiredSize.height = + this._effectLayerOptions.mainTextureFixedSize)) + : ((this._mainTextureDesiredSize.width = + this._engine.getRenderWidth() * + this._effectLayerOptions.mainTextureRatio), + (this._mainTextureDesiredSize.height = + this._engine.getRenderHeight() * + this._effectLayerOptions.mainTextureRatio), + (this._mainTextureDesiredSize.width = this._engine + .needPOTTextures + ? Ee.h.GetExponentOfTwo( + this._mainTextureDesiredSize.width, + this._maxSize + ) + : this._mainTextureDesiredSize.width), + (this._mainTextureDesiredSize.height = this._engine + .needPOTTextures + ? Ee.h.GetExponentOfTwo( + this._mainTextureDesiredSize.height, + this._maxSize + ) + : this._mainTextureDesiredSize.height)), + (this._mainTextureDesiredSize.width = Math.floor( + this._mainTextureDesiredSize.width + )), + (this._mainTextureDesiredSize.height = Math.floor( + this._mainTextureDesiredSize.height + )); + }), + (e.prototype._createMainTexture = function () { + var e = this; + (this._mainTexture = new li( + "HighlightLayerMainRTT", + { + width: this._mainTextureDesiredSize.width, + height: this._mainTextureDesiredSize.height, + }, + this._scene, + false, + true, + _.a.TEXTURETYPE_UNSIGNED_INT + )), + (this._mainTexture.activeCamera = + this._effectLayerOptions.camera), + (this._mainTexture.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._mainTexture.wrapV = je.a.CLAMP_ADDRESSMODE), + (this._mainTexture.anisotropicFilteringLevel = 1), + this._mainTexture.updateSamplingMode( + je.a.BILINEAR_SAMPLINGMODE + ), + (this._mainTexture.renderParticles = false), + (this._mainTexture.renderList = null), + (this._mainTexture.ignoreCameraViewport = true), + (this._mainTexture.customRenderFunction = function ( + t, + i, + n, + r + ) { + var o; + e.onBeforeRenderMainTextureObservable.notifyObservers( + e + ); + var a = e._scene.getEngine(); + if (r.length) { + for (a.setColorWrite(false), o = 0; o < r.length; o++) + e._renderSubMesh(r.data[o]); + a.setColorWrite(true); } - , - this._mainTexture.onClearObservable.add(function(t) { - t.clear(e.neutralColor, true, true, true) - }) + for (o = 0; o < t.length; o++) + e._renderSubMesh(t.data[o]); + for (o = 0; o < i.length; o++) + e._renderSubMesh(i.data[o]); + var s = a.getAlphaMode(); + for (o = 0; o < n.length; o++) + e._renderSubMesh(n.data[o], true); + a.setAlphaMode(s); + }), + this._mainTexture.onClearObservable.add(function (t) { + t.clear(e.neutralColor, true, true, true); + }); + }), + (e.prototype._addCustomEffectDefines = function (e) {}), + (e.prototype._isReady = function (e, t, i) { + var n = e.getMaterial(); + if (!n) return false; + if (!n.isReadyForSubMesh(e.getMesh(), e, t)) return false; + var r = [], + o = [Si.b.PositionKind], + a = e.getMesh(), + s = false, + c = false; + if (n) { + var u = n.needAlphaTesting(), + l = n.getAlphaTestTexture(), + h = + l && + l.hasAlpha && + (n.useAlphaFromDiffuseTexture || + n._useAlphaFromAlbedoTexture); + l && + (u || h) && + (r.push("#define DIFFUSE"), + a.isVerticesDataPresent(Si.b.UV2Kind) && + 1 === l.coordinatesIndex + ? (r.push("#define DIFFUSEUV2"), (c = true)) + : a.isVerticesDataPresent(Si.b.UVKind) && + (r.push("#define DIFFUSEUV1"), (s = true)), + u && + (r.push("#define ALPHATEST"), + r.push("#define ALPHATESTVALUE 0.4"))); + var f = n.opacityTexture; + f && + (r.push("#define OPACITY"), + a.isVerticesDataPresent(Si.b.UV2Kind) && + 1 === f.coordinatesIndex + ? (r.push("#define OPACITYUV2"), (c = true)) + : a.isVerticesDataPresent(Si.b.UVKind) && + (r.push("#define OPACITYUV1"), (s = true))); } - , - e.prototype._addCustomEffectDefines = function(e) {} - , - e.prototype._isReady = function(e, t, i) { - var n = e.getMaterial(); - if (!n) - return false; - if (!n.isReadyForSubMesh(e.getMesh(), e, t)) - return false; - var r = [] - , o = [Si.b.PositionKind] - , a = e.getMesh() - , s = false - , c = false; - if (n) { - var u = n.needAlphaTesting() - , l = n.getAlphaTestTexture() - , h = l && l.hasAlpha && (n.useAlphaFromDiffuseTexture || n._useAlphaFromAlbedoTexture); - l && (u || h) && (r.push("#define DIFFUSE"), - a.isVerticesDataPresent(Si.b.UV2Kind) && 1 === l.coordinatesIndex ? (r.push("#define DIFFUSEUV2"), - c = true) : a.isVerticesDataPresent(Si.b.UVKind) && (r.push("#define DIFFUSEUV1"), - s = true), - u && (r.push("#define ALPHATEST"), - r.push("#define ALPHATESTVALUE 0.4"))); - var f = n.opacityTexture; - f && (r.push("#define OPACITY"), - a.isVerticesDataPresent(Si.b.UV2Kind) && 1 === f.coordinatesIndex ? (r.push("#define OPACITYUV2"), - c = true) : a.isVerticesDataPresent(Si.b.UVKind) && (r.push("#define OPACITYUV1"), - s = true)) - } - i && (r.push("#define EMISSIVE"), - a.isVerticesDataPresent(Si.b.UV2Kind) && 1 === i.coordinatesIndex ? (r.push("#define EMISSIVEUV2"), - c = true) : a.isVerticesDataPresent(Si.b.UVKind) && (r.push("#define EMISSIVEUV1"), - s = true)), - a.isVerticesDataPresent(Si.b.ColorKind) && a.hasVertexAlpha && (o.push(Si.b.ColorKind), - r.push("#define VERTEXALPHA")), - s && (o.push(Si.b.UVKind), - r.push("#define UV1")), - c && (o.push(Si.b.UV2Kind), - r.push("#define UV2")), - a.useBones && a.computeBonesUsingShaders ? (o.push(Si.b.MatricesIndicesKind), - o.push(Si.b.MatricesWeightsKind), - a.numBoneInfluencers > 4 && (o.push(Si.b.MatricesIndicesExtraKind), - o.push(Si.b.MatricesWeightsExtraKind)), - r.push("#define NUM_BONE_INFLUENCERS " + a.numBoneInfluencers), - r.push("#define BonesPerMesh " + (a.skeleton ? a.skeleton.bones.length + 1 : 0))) : r.push("#define NUM_BONE_INFLUENCERS 0"); - var d = a.morphTargetManager - , p = 0; - d && d.numInfluencers > 0 && (r.push("#define MORPHTARGETS"), - p = d.numInfluencers, - r.push("#define NUM_MORPH_INFLUENCERS " + p), - Yn.a.PrepareAttributesForMorphTargets(o, a, { - NUM_MORPH_INFLUENCERS: p - })), - t && (r.push("#define INSTANCES"), + i && + (r.push("#define EMISSIVE"), + a.isVerticesDataPresent(Si.b.UV2Kind) && + 1 === i.coordinatesIndex + ? (r.push("#define EMISSIVEUV2"), (c = true)) + : a.isVerticesDataPresent(Si.b.UVKind) && + (r.push("#define EMISSIVEUV1"), (s = true))), + a.isVerticesDataPresent(Si.b.ColorKind) && + a.hasVertexAlpha && + (o.push(Si.b.ColorKind), r.push("#define VERTEXALPHA")), + s && (o.push(Si.b.UVKind), r.push("#define UV1")), + c && (o.push(Si.b.UV2Kind), r.push("#define UV2")), + a.useBones && a.computeBonesUsingShaders + ? (o.push(Si.b.MatricesIndicesKind), + o.push(Si.b.MatricesWeightsKind), + a.numBoneInfluencers > 4 && + (o.push(Si.b.MatricesIndicesExtraKind), + o.push(Si.b.MatricesWeightsExtraKind)), + r.push( + "#define NUM_BONE_INFLUENCERS " + + a.numBoneInfluencers + ), + r.push( + "#define BonesPerMesh " + + (a.skeleton ? a.skeleton.bones.length + 1 : 0) + )) + : r.push("#define NUM_BONE_INFLUENCERS 0"); + var d = a.morphTargetManager, + p = 0; + d && + d.numInfluencers > 0 && + (r.push("#define MORPHTARGETS"), + (p = d.numInfluencers), + r.push("#define NUM_MORPH_INFLUENCERS " + p), + Yn.a.PrepareAttributesForMorphTargets(o, a, { + NUM_MORPH_INFLUENCERS: p, + })), + t && + (r.push("#define INSTANCES"), o.push("world0"), o.push("world1"), o.push("world2"), o.push("world3")), - this._addCustomEffectDefines(r); - var m = r.join("\n"); - return this._cachedDefines !== m && (this._cachedDefines = m, - this._effectLayerMapGenerationEffect = this._scene.getEngine().createEffect("glowMapGeneration", o, ["world", "mBones", "viewProjection", "glowColor", "morphTargetInfluences", "diffuseMatrix", "emissiveMatrix", "opacityMatrix", "opacityIntensity"], ["diffuseSampler", "emissiveSampler", "opacitySampler"], m, void 0, void 0, void 0, { - maxSimultaneousMorphTargets: p - })), - this._effectLayerMapGenerationEffect.isReady() - } - , - e.prototype.render = function() { - var e = this._mergeEffect; - if (e.isReady()) { - for (var t = 0; t < this._postProcesses.length; t++) - if (!this._postProcesses[t].isReady()) - return; - var i = this._scene.getEngine(); - this.onBeforeComposeObservable.notifyObservers(this), - i.enableEffect(e), - i.setState(false), - i.bindBuffers(this._vertexBuffers, this._indexBuffer, e); - var n = i.getAlphaMode(); - i.setAlphaMode(this._effectLayerOptions.alphaBlendingMode), - this._internalRender(e), - i.setAlphaMode(n), - this.onAfterComposeObservable.notifyObservers(this); - var r = this._mainTexture.getSize(); - this._setMainTextureSize(), - r.width === this._mainTextureDesiredSize.width && r.height === this._mainTextureDesiredSize.height || (this.onSizeChangedObservable.notifyObservers(this), - this._disposeTextureAndPostProcesses(), - this._createMainTexture(), - this._createTextureAndPostProcesses()) - } - } - , - e.prototype.hasMesh = function(e) { - return -1 === this.renderingGroupId || e.renderingGroupId === this.renderingGroupId - } - , - e.prototype.shouldRender = function() { - return this.isEnabled && this._shouldRender - } - , - e.prototype._shouldRenderMesh = function(e) { - return true - } - , - e.prototype._canRenderMesh = function(e, t) { - return !t.needAlphaBlendingForMesh(e) - } - , - e.prototype._shouldRenderEmissiveTextureForMesh = function() { - return true - } - , - e.prototype._renderSubMesh = function(e, t) { - var i = this; - if (void 0 === t && (t = false), - this.shouldRender()) { - var n = e.getMaterial() - , r = e.getRenderingMesh() - , o = this._scene - , a = o.getEngine(); - if (r._internalAbstractMeshDataInfo._isActiveIntermediate = false, - n && this._canRenderMesh(r, n)) { - a.setState(n.backFaceCulling); - var s = r._getInstancesRenderList(e._id); - if (!s.mustReturn && this._shouldRenderMesh(r)) { - var c = s.hardwareInstancedRendering[e._id]; - if (this._setEmissiveTextureAndColor(r, e, n), - this._isReady(e, c, this._emissiveTextureAndColor.texture)) { - a.enableEffect(this._effectLayerMapGenerationEffect), - r._bind(e, this._effectLayerMapGenerationEffect, Mr.a.TriangleFillMode), - this._effectLayerMapGenerationEffect.setMatrix("viewProjection", o.getTransformMatrix()), - this._effectLayerMapGenerationEffect.setFloat4("glowColor", this._emissiveTextureAndColor.color.r, this._emissiveTextureAndColor.color.g, this._emissiveTextureAndColor.color.b, this._emissiveTextureAndColor.color.a); - var u = n.needAlphaTesting() - , l = n.getAlphaTestTexture() - , h = l && l.hasAlpha && (n.useAlphaFromDiffuseTexture || n._useAlphaFromAlbedoTexture); - l && (u || h) && (this._effectLayerMapGenerationEffect.setTexture("diffuseSampler", l), - (f = l.getTextureMatrix()) && this._effectLayerMapGenerationEffect.setMatrix("diffuseMatrix", f)); - var f, d = n.opacityTexture; - d && (this._effectLayerMapGenerationEffect.setTexture("opacitySampler", d), - this._effectLayerMapGenerationEffect.setFloat("opacityIntensity", d.level), - (f = d.getTextureMatrix()) && this._effectLayerMapGenerationEffect.setMatrix("opacityMatrix", f)), - this._emissiveTextureAndColor.texture && (this._effectLayerMapGenerationEffect.setTexture("emissiveSampler", this._emissiveTextureAndColor.texture), - this._effectLayerMapGenerationEffect.setMatrix("emissiveMatrix", this._emissiveTextureAndColor.texture.getTextureMatrix())), - r.useBones && r.computeBonesUsingShaders && r.skeleton && this._effectLayerMapGenerationEffect.setMatrices("mBones", r.skeleton.getTransformMatrices(r)), - Yn.a.BindMorphTargetParameters(r, this._effectLayerMapGenerationEffect), - t && a.setAlphaMode(n.alphaMode), - r._processRendering(e, this._effectLayerMapGenerationEffect, Mr.a.TriangleFillMode, s, c, function(e, t) { - return i._effectLayerMapGenerationEffect.setMatrix("world", t) - }) - } else - this._mainTexture.resetRefreshCounter() - } + this._addCustomEffectDefines(r); + var m = r.join("\n"); + return ( + this._cachedDefines !== m && + ((this._cachedDefines = m), + (this._effectLayerMapGenerationEffect = this._scene + .getEngine() + .createEffect( + "glowMapGeneration", + o, + [ + "world", + "mBones", + "viewProjection", + "glowColor", + "morphTargetInfluences", + "diffuseMatrix", + "emissiveMatrix", + "opacityMatrix", + "opacityIntensity", + ], + [ + "diffuseSampler", + "emissiveSampler", + "opacitySampler", + ], + m, + void 0, + void 0, + void 0, + { + maxSimultaneousMorphTargets: p, } + ))), + this._effectLayerMapGenerationEffect.isReady() + ); + }), + (e.prototype.render = function () { + var e = this._mergeEffect; + if (e.isReady()) { + for (var t = 0; t < this._postProcesses.length; t++) + if (!this._postProcesses[t].isReady()) return; + var i = this._scene.getEngine(); + this.onBeforeComposeObservable.notifyObservers(this), + i.enableEffect(e), + i.setState(false), + i.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + e + ); + var n = i.getAlphaMode(); + i.setAlphaMode( + this._effectLayerOptions.alphaBlendingMode + ), + this._internalRender(e), + i.setAlphaMode(n), + this.onAfterComposeObservable.notifyObservers(this); + var r = this._mainTexture.getSize(); + this._setMainTextureSize(), + (r.width === this._mainTextureDesiredSize.width && + r.height === this._mainTextureDesiredSize.height) || + (this.onSizeChangedObservable.notifyObservers(this), + this._disposeTextureAndPostProcesses(), + this._createMainTexture(), + this._createTextureAndPostProcesses()); + } + }), + (e.prototype.hasMesh = function (e) { + return ( + -1 === this.renderingGroupId || + e.renderingGroupId === this.renderingGroupId + ); + }), + (e.prototype.shouldRender = function () { + return this.isEnabled && this._shouldRender; + }), + (e.prototype._shouldRenderMesh = function (e) { + return true; + }), + (e.prototype._canRenderMesh = function (e, t) { + return !t.needAlphaBlendingForMesh(e); + }), + (e.prototype._shouldRenderEmissiveTextureForMesh = + function () { + return true; + }), + (e.prototype._renderSubMesh = function (e, t) { + var i = this; + if ((void 0 === t && (t = false), this.shouldRender())) { + var n = e.getMaterial(), + r = e.getRenderingMesh(), + o = this._scene, + a = o.getEngine(); + if ( + ((r._internalAbstractMeshDataInfo._isActiveIntermediate = false), + n && this._canRenderMesh(r, n)) + ) { + a.setState(n.backFaceCulling); + var s = r._getInstancesRenderList(e._id); + if (!s.mustReturn && this._shouldRenderMesh(r)) { + var c = s.hardwareInstancedRendering[e._id]; + if ( + (this._setEmissiveTextureAndColor(r, e, n), + this._isReady( + e, + c, + this._emissiveTextureAndColor.texture + )) + ) { + a.enableEffect( + this._effectLayerMapGenerationEffect + ), + r._bind( + e, + this._effectLayerMapGenerationEffect, + Mr.a.TriangleFillMode + ), + this._effectLayerMapGenerationEffect.setMatrix( + "viewProjection", + o.getTransformMatrix() + ), + this._effectLayerMapGenerationEffect.setFloat4( + "glowColor", + this._emissiveTextureAndColor.color.r, + this._emissiveTextureAndColor.color.g, + this._emissiveTextureAndColor.color.b, + this._emissiveTextureAndColor.color.a + ); + var u = n.needAlphaTesting(), + l = n.getAlphaTestTexture(), + h = + l && + l.hasAlpha && + (n.useAlphaFromDiffuseTexture || + n._useAlphaFromAlbedoTexture); + l && + (u || h) && + (this._effectLayerMapGenerationEffect.setTexture( + "diffuseSampler", + l + ), + (f = l.getTextureMatrix()) && + this._effectLayerMapGenerationEffect.setMatrix( + "diffuseMatrix", + f + )); + var f, + d = n.opacityTexture; + d && + (this._effectLayerMapGenerationEffect.setTexture( + "opacitySampler", + d + ), + this._effectLayerMapGenerationEffect.setFloat( + "opacityIntensity", + d.level + ), + (f = d.getTextureMatrix()) && + this._effectLayerMapGenerationEffect.setMatrix( + "opacityMatrix", + f + )), + this._emissiveTextureAndColor.texture && + (this._effectLayerMapGenerationEffect.setTexture( + "emissiveSampler", + this._emissiveTextureAndColor.texture + ), + this._effectLayerMapGenerationEffect.setMatrix( + "emissiveMatrix", + this._emissiveTextureAndColor.texture.getTextureMatrix() + )), + r.useBones && + r.computeBonesUsingShaders && + r.skeleton && + this._effectLayerMapGenerationEffect.setMatrices( + "mBones", + r.skeleton.getTransformMatrices(r) + ), + Yn.a.BindMorphTargetParameters( + r, + this._effectLayerMapGenerationEffect + ), + t && a.setAlphaMode(n.alphaMode), + r._processRendering( + e, + this._effectLayerMapGenerationEffect, + Mr.a.TriangleFillMode, + s, + c, + function (e, t) { + return i._effectLayerMapGenerationEffect.setMatrix( + "world", + t + ); + } + ); + } else this._mainTexture.resetRefreshCounter(); } + } } - , - e.prototype._rebuild = function() { - var e = this._vertexBuffers[Si.b.PositionKind]; - e && e._rebuild(), - this._generateIndexBuffer() - } - , - e.prototype._disposeTextureAndPostProcesses = function() { - this._mainTexture.dispose(); - for (var e = 0; e < this._postProcesses.length; e++) - this._postProcesses[e] && this._postProcesses[e].dispose(); - for (this._postProcesses = [], - e = 0; e < this._textures.length; e++) - this._textures[e] && this._textures[e].dispose(); - this._textures = [] - } - , - e.prototype.dispose = function() { - var e = this._vertexBuffers[Si.b.PositionKind]; - e && (e.dispose(), - this._vertexBuffers[Si.b.PositionKind] = null), - this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), - this._indexBuffer = null), - this._disposeTextureAndPostProcesses(); - var t = this._scene.effectLayers.indexOf(this, 0); - t > -1 && this._scene.effectLayers.splice(t, 1), - this.onDisposeObservable.notifyObservers(this), - this.onDisposeObservable.clear(), - this.onBeforeRenderMainTextureObservable.clear(), - this.onBeforeComposeObservable.clear(), - this.onAfterComposeObservable.clear(), - this.onSizeChangedObservable.clear() - } - , - e.prototype.getClassName = function() { - return "EffectLayer" - } - , - e.Parse = function(e, t, i) { - return Ee.h.Instantiate(e.customType).Parse(e, t, i) - } - , - e._SceneComponentInitialization = function(e) { - throw Te.a.WarnImport("EffectLayerSceneComponent") - } - , - h.c([Object(F.c)()], e.prototype, "name", void 0), - h.c([Object(F.f)()], e.prototype, "neutralColor", void 0), - h.c([Object(F.c)()], e.prototype, "isEnabled", void 0), - h.c([Object(F.d)()], e.prototype, "camera", null), - h.c([Object(F.c)()], e.prototype, "renderingGroupId", null), - e - }(); - r.a.AddParser(Se.a.NAME_EFFECTLAYER, function(e, t, i, n) { - if (e.effectLayers) { - i.effectLayers || (i.effectLayers = new Array); - for (var r = 0; r < e.effectLayers.length; r++) { - var o = Or.Parse(e.effectLayers[r], t, n); - i.effectLayers.push(o) - } - } + }), + (e.prototype._rebuild = function () { + var e = this._vertexBuffers[Si.b.PositionKind]; + e && e._rebuild(), this._generateIndexBuffer(); + }), + (e.prototype._disposeTextureAndPostProcesses = function () { + this._mainTexture.dispose(); + for (var e = 0; e < this._postProcesses.length; e++) + this._postProcesses[e] && + this._postProcesses[e].dispose(); + for ( + this._postProcesses = [], e = 0; + e < this._textures.length; + e++ + ) + this._textures[e] && this._textures[e].dispose(); + this._textures = []; + }), + (e.prototype.dispose = function () { + var e = this._vertexBuffers[Si.b.PositionKind]; + e && + (e.dispose(), + (this._vertexBuffers[Si.b.PositionKind] = null)), + this._indexBuffer && + (this._scene + .getEngine() + ._releaseBuffer(this._indexBuffer), + (this._indexBuffer = null)), + this._disposeTextureAndPostProcesses(); + var t = this._scene.effectLayers.indexOf(this, 0); + t > -1 && this._scene.effectLayers.splice(t, 1), + this.onDisposeObservable.notifyObservers(this), + this.onDisposeObservable.clear(), + this.onBeforeRenderMainTextureObservable.clear(), + this.onBeforeComposeObservable.clear(), + this.onAfterComposeObservable.clear(), + this.onSizeChangedObservable.clear(); + }), + (e.prototype.getClassName = function () { + return "EffectLayer"; + }), + (e.Parse = function (e, t, i) { + return Ee.h.Instantiate(e.customType).Parse(e, t, i); + }), + (e._SceneComponentInitialization = function (e) { + throw Te.a.WarnImport("EffectLayerSceneComponent"); + }), + h.c([Object(F.c)()], e.prototype, "name", void 0), + h.c([Object(F.f)()], e.prototype, "neutralColor", void 0), + h.c([Object(F.c)()], e.prototype, "isEnabled", void 0), + h.c([Object(F.d)()], e.prototype, "camera", null), + h.c([Object(F.c)()], e.prototype, "renderingGroupId", null), + e + ); + })(); + r.a.AddParser(Se.a.NAME_EFFECTLAYER, function (e, t, i, n) { + if (e.effectLayers) { + i.effectLayers || (i.effectLayers = new Array()); + for (var r = 0; r < e.effectLayers.length; r++) { + var o = Or.Parse(e.effectLayers[r], t, n); + i.effectLayers.push(o); + } + } + }), + (r.a.prototype.removeEffectLayer = function (e) { + var t = this.effectLayers.indexOf(e); + return -1 !== t && this.effectLayers.splice(t, 1), t; }), - r.a.prototype.removeEffectLayer = function(e) { - var t = this.effectLayers.indexOf(e); - return -1 !== t && this.effectLayers.splice(t, 1), - t + (r.a.prototype.addEffectLayer = function (e) { + this.effectLayers.push(e); + }); + var wr = (function () { + function e(e) { + (this.name = Se.a.NAME_EFFECTLAYER), + (this._renderEffects = false), + (this._needStencil = false), + (this._previousStencilState = false), + (this.scene = e), + (this._engine = e.getEngine()), + (e.effectLayers = new Array()); } - , - r.a.prototype.addEffectLayer = function(e) { - this.effectLayers.push(e) - } - ; - var wr = function() { - function e(e) { - this.name = Se.a.NAME_EFFECTLAYER, - this._renderEffects = false, - this._needStencil = false, - this._previousStencilState = false, - this.scene = e, - this._engine = e.getEngine(), - e.effectLayers = new Array + return ( + (e.prototype.register = function () { + this.scene._isReadyForMeshStage.registerStep( + Se.a.STEP_ISREADYFORMESH_EFFECTLAYER, + this, + this._isReadyForMesh + ), + this.scene._cameraDrawRenderTargetStage.registerStep( + Se.a.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, + this, + this._renderMainTexture + ), + this.scene._beforeCameraDrawStage.registerStep( + Se.a.STEP_BEFORECAMERADRAW_EFFECTLAYER, + this, + this._setStencil + ), + this.scene._afterRenderingGroupDrawStage.registerStep( + Se.a.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, + this, + this._drawRenderingGroup + ), + this.scene._afterCameraDrawStage.registerStep( + Se.a.STEP_AFTERCAMERADRAW_EFFECTLAYER, + this, + this._setStencilBack + ), + this.scene._afterCameraDrawStage.registerStep( + Se.a.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, + this, + this._drawCamera + ); + }), + (e.prototype.rebuild = function () { + for ( + var e = 0, t = this.scene.effectLayers; + e < t.length; + e++ + ) + t[e]._rebuild(); + }), + (e.prototype.serialize = function (e) { + e.effectLayers = []; + for ( + var t = 0, i = this.scene.effectLayers; + t < i.length; + t++ + ) { + var n = i[t]; + n.serialize && e.effectLayers.push(n.serialize()); } - return e.prototype.register = function() { - this.scene._isReadyForMeshStage.registerStep(Se.a.STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh), - this.scene._cameraDrawRenderTargetStage.registerStep(Se.a.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture), - this.scene._beforeCameraDrawStage.registerStep(Se.a.STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil), - this.scene._afterRenderingGroupDrawStage.registerStep(Se.a.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup), - this.scene._afterCameraDrawStage.registerStep(Se.a.STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack), - this.scene._afterCameraDrawStage.registerStep(Se.a.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera) - } - , - e.prototype.rebuild = function() { - for (var e = 0, t = this.scene.effectLayers; e < t.length; e++) - t[e]._rebuild() - } - , - e.prototype.serialize = function(e) { - e.effectLayers = []; - for (var t = 0, i = this.scene.effectLayers; t < i.length; t++) { - var n = i[t]; - n.serialize && e.effectLayers.push(n.serialize()) + }), + (e.prototype.addFromContainer = function (e) { + var t = this; + e.effectLayers && + e.effectLayers.forEach(function (e) { + t.scene.addEffectLayer(e); + }); + }), + (e.prototype.removeFromContainer = function (e, t) { + var i = this; + e.effectLayers && + e.effectLayers.forEach(function (e) { + i.scene.removeEffectLayer(e), t && e.dispose(); + }); + }), + (e.prototype.dispose = function () { + for (var e = this.scene.effectLayers; e.length; ) + e[0].dispose(); + }), + (e.prototype._isReadyForMesh = function (e, t) { + for ( + var i = 0, n = this.scene.effectLayers; + i < n.length; + i++ + ) { + var r = n[i]; + if (r.hasMesh(e)) + for (var o = 0, a = e.subMeshes; o < a.length; o++) { + var s = a[o]; + if (!r.isReady(s, t)) return false; } } - , - e.prototype.addFromContainer = function(e) { - var t = this; - e.effectLayers && e.effectLayers.forEach(function(e) { - t.scene.addEffectLayer(e) - }) - } - , - e.prototype.removeFromContainer = function(e, t) { - var i = this; - e.effectLayers && e.effectLayers.forEach(function(e) { - i.scene.removeEffectLayer(e), - t && e.dispose() - }) - } - , - e.prototype.dispose = function() { - for (var e = this.scene.effectLayers; e.length; ) - e[0].dispose() - } - , - e.prototype._isReadyForMesh = function(e, t) { - for (var i = 0, n = this.scene.effectLayers; i < n.length; i++) { - var r = n[i]; - if (r.hasMesh(e)) - for (var o = 0, a = e.subMeshes; o < a.length; o++) { - var s = a[o]; - if (!r.isReady(s, t)) - return false - } + return true; + }), + (e.prototype._renderMainTexture = function (e) { + (this._renderEffects = false), (this._needStencil = false); + var t = false, + i = this.scene.effectLayers; + if (i && i.length > 0) { + this._previousStencilState = + this._engine.getStencilBuffer(); + for (var n = 0, r = i; n < r.length; n++) { + var o = r[n]; + if ( + o.shouldRender() && + (!o.camera || + (o.camera.cameraRigMode === ke.a.RIG_MODE_NONE && + e === o.camera) || + (o.camera.cameraRigMode !== ke.a.RIG_MODE_NONE && + o.camera._rigCameras.indexOf(e) > -1)) + ) { + (this._renderEffects = true), + (this._needStencil = + this._needStencil || o.needStencil()); + var a = o._mainTexture; + a._shouldRender() && + (this.scene.incrementRenderId(), + a.render(false, false), + (t = true)); } - return true + } + this.scene.incrementRenderId(); } - , - e.prototype._renderMainTexture = function(e) { - this._renderEffects = false, - this._needStencil = false; - var t = false - , i = this.scene.effectLayers; - if (i && i.length > 0) { - this._previousStencilState = this._engine.getStencilBuffer(); - for (var n = 0, r = i; n < r.length; n++) { - var o = r[n]; - if (o.shouldRender() && (!o.camera || o.camera.cameraRigMode === ke.a.RIG_MODE_NONE && e === o.camera || o.camera.cameraRigMode !== ke.a.RIG_MODE_NONE && o.camera._rigCameras.indexOf(e) > -1)) { - this._renderEffects = true, - this._needStencil = this._needStencil || o.needStencil(); - var a = o._mainTexture; - a._shouldRender() && (this.scene.incrementRenderId(), - a.render(false, false), - t = true) - } - } - this.scene.incrementRenderId() - } - return t + return t; + }), + (e.prototype._setStencil = function () { + this._needStencil && this._engine.setStencilBuffer(true); + }), + (e.prototype._setStencilBack = function () { + this._needStencil && + this._engine.setStencilBuffer(this._previousStencilState); + }), + (e.prototype._draw = function (e) { + if (this._renderEffects) { + this._engine.setDepthBuffer(false); + for ( + var t = this.scene.effectLayers, i = 0; + i < t.length; + i++ + ) { + var n = t[i]; + n.renderingGroupId === e && + n.shouldRender() && + n.render(); + } + this._engine.setDepthBuffer(true); } - , - e.prototype._setStencil = function() { - this._needStencil && this._engine.setStencilBuffer(true) - } - , - e.prototype._setStencilBack = function() { - this._needStencil && this._engine.setStencilBuffer(this._previousStencilState) - } - , - e.prototype._draw = function(e) { - if (this._renderEffects) { - this._engine.setDepthBuffer(false); - for (var t = this.scene.effectLayers, i = 0; i < t.length; i++) { - var n = t[i]; - n.renderingGroupId === e && n.shouldRender() && n.render() - } - this._engine.setDepthBuffer(true) - } - } - , - e.prototype._drawCamera = function() { - this._renderEffects && this._draw(-1) - } - , - e.prototype._drawRenderingGroup = function(e) { - !this.scene._isInIntermediateRendering() && this._renderEffects && this._draw(e) - } - , - e - }(); - Or._SceneComponentInitialization = function(e) { - var t = e._getComponent(Se.a.NAME_EFFECTLAYER); - t || (t = new wr(e), - e._addComponent(t)) - } - ; - Ht.a.ShadersStore.glowMapMergePixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#ifdef EMISSIVE\nuniform sampler2D textureSampler2;\n#endif\n\nuniform float offset;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef EMISSIVE\nbaseColor+=texture2D(textureSampler2,vUV);\nbaseColor*=offset;\n#else\nbaseColor.a=abs(offset-baseColor.a);\n#ifdef STROKE\nfloat alpha=smoothstep(.0,.1,baseColor.a);\nbaseColor.a=alpha;\nbaseColor.rgb=baseColor.rgb*alpha;\n#endif\n#endif\ngl_FragColor=baseColor;\n}"; - Ht.a.ShadersStore.glowMapMergeVertexShader = "\nattribute vec2 position;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}", - r.a.prototype.getGlowLayerByName = function(e) { - for (var t = 0; t < this.effectLayers.length; t++) - if (this.effectLayers[t].name === e && this.effectLayers[t].getEffectName() === Ir.EffectName) - return this.effectLayers[t]; - return null - } - ; - var Ir = function(e) { - function t(i, n, r) { - var o = e.call(this, i, n) || this; - return o._intensity = 1, - o._includedOnlyMeshes = [], - o._excludedMeshes = [], - o.neutralColor = new a.f(0,0,0,1), - o._options = h.a({ - mainTextureRatio: t.DefaultTextureRatio, - blurKernelSize: 32, - mainTextureFixedSize: void 0, - camera: null, - mainTextureSamples: 1, - renderingGroupId: -1 - }, r), - o._init({ - alphaBlendingMode: _.a.ALPHA_ADD, - camera: o._options.camera, - mainTextureFixedSize: o._options.mainTextureFixedSize, - mainTextureRatio: o._options.mainTextureRatio, - renderingGroupId: o._options.renderingGroupId - }), - o - } - return h.d(t, e), - Object.defineProperty(t.prototype, "blurKernelSize", { - get: function() { - return this._horizontalBlurPostprocess1.kernel - }, - set: function(e) { - this._horizontalBlurPostprocess1.kernel = e, - this._verticalBlurPostprocess1.kernel = e, - this._horizontalBlurPostprocess2.kernel = e, - this._verticalBlurPostprocess2.kernel = e - }, - enumerable: true, - configurable: true + }), + (e.prototype._drawCamera = function () { + this._renderEffects && this._draw(-1); + }), + (e.prototype._drawRenderingGroup = function (e) { + !this.scene._isInIntermediateRendering() && + this._renderEffects && + this._draw(e); + }), + e + ); + })(); + Or._SceneComponentInitialization = function (e) { + var t = e._getComponent(Se.a.NAME_EFFECTLAYER); + t || ((t = new wr(e)), e._addComponent(t)); + }; + Ht.a.ShadersStore.glowMapMergePixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#ifdef EMISSIVE\nuniform sampler2D textureSampler2;\n#endif\n\nuniform float offset;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef EMISSIVE\nbaseColor+=texture2D(textureSampler2,vUV);\nbaseColor*=offset;\n#else\nbaseColor.a=abs(offset-baseColor.a);\n#ifdef STROKE\nfloat alpha=smoothstep(.0,.1,baseColor.a);\nbaseColor.a=alpha;\nbaseColor.rgb=baseColor.rgb*alpha;\n#endif\n#endif\ngl_FragColor=baseColor;\n}"; + (Ht.a.ShadersStore.glowMapMergeVertexShader = + "\nattribute vec2 position;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}"), + (r.a.prototype.getGlowLayerByName = function (e) { + for (var t = 0; t < this.effectLayers.length; t++) + if ( + this.effectLayers[t].name === e && + this.effectLayers[t].getEffectName() === Ir.EffectName + ) + return this.effectLayers[t]; + return null; + }); + var Ir = (function (e) { + function t(i, n, r) { + var o = e.call(this, i, n) || this; + return ( + (o._intensity = 1), + (o._includedOnlyMeshes = []), + (o._excludedMeshes = []), + (o.neutralColor = new a.f(0, 0, 0, 1)), + (o._options = h.a( + { + mainTextureRatio: t.DefaultTextureRatio, + blurKernelSize: 32, + mainTextureFixedSize: void 0, + camera: null, + mainTextureSamples: 1, + renderingGroupId: -1, + }, + r + )), + o._init({ + alphaBlendingMode: _.a.ALPHA_ADD, + camera: o._options.camera, + mainTextureFixedSize: o._options.mainTextureFixedSize, + mainTextureRatio: o._options.mainTextureRatio, + renderingGroupId: o._options.renderingGroupId, }), - Object.defineProperty(t.prototype, "intensity", { - get: function() { - return this._intensity - }, - set: function(e) { - this._intensity = e - }, - enumerable: true, - configurable: true - }), - t.prototype.getEffectName = function() { - return t.EffectName - } - , - t.prototype._createMergeEffect = function() { - return this._engine.createEffect("glowMapMerge", [Si.b.PositionKind], ["offset"], ["textureSampler", "textureSampler2"], "#define EMISSIVE \n") - } - , - t.prototype._createTextureAndPostProcesses = function() { - var e = this - , t = this._mainTextureDesiredSize.width - , i = this._mainTextureDesiredSize.height; - t = this._engine.needPOTTextures ? Ee.h.GetExponentOfTwo(t, this._maxSize) : t, - i = this._engine.needPOTTextures ? Ee.h.GetExponentOfTwo(i, this._maxSize) : i; - var n; - n = this._engine.getCaps().textureHalfFloatRender ? _.a.TEXTURETYPE_HALF_FLOAT : _.a.TEXTURETYPE_UNSIGNED_INT, - this._blurTexture1 = new li("GlowLayerBlurRTT",{ - width: t, - height: i - },this._scene,false,true,n), - this._blurTexture1.wrapU = je.a.CLAMP_ADDRESSMODE, - this._blurTexture1.wrapV = je.a.CLAMP_ADDRESSMODE, - this._blurTexture1.updateSamplingMode(je.a.BILINEAR_SAMPLINGMODE), - this._blurTexture1.renderParticles = false, - this._blurTexture1.ignoreCameraViewport = true; - var r = Math.floor(t / 2) - , o = Math.floor(i / 2); - this._blurTexture2 = new li("GlowLayerBlurRTT2",{ - width: r, - height: o - },this._scene,false,true,n), - this._blurTexture2.wrapU = je.a.CLAMP_ADDRESSMODE, - this._blurTexture2.wrapV = je.a.CLAMP_ADDRESSMODE, - this._blurTexture2.updateSamplingMode(je.a.BILINEAR_SAMPLINGMODE), - this._blurTexture2.renderParticles = false, - this._blurTexture2.ignoreCameraViewport = true, - this._textures = [this._blurTexture1, this._blurTexture2], - this._horizontalBlurPostprocess1 = new Hn("GlowLayerHBP1",new a.w(1,0),this._options.blurKernelSize / 2,{ - width: t, - height: i - },null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,n), - this._horizontalBlurPostprocess1.width = t, - this._horizontalBlurPostprocess1.height = i, - this._horizontalBlurPostprocess1.onApplyObservable.add(function(t) { - t.setTexture("textureSampler", e._mainTexture) - }), - this._verticalBlurPostprocess1 = new Hn("GlowLayerVBP1",new a.w(0,1),this._options.blurKernelSize / 2,{ - width: t, - height: i - },null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,n), - this._horizontalBlurPostprocess2 = new Hn("GlowLayerHBP2",new a.w(1,0),this._options.blurKernelSize / 2,{ - width: r, - height: o - },null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,n), - this._horizontalBlurPostprocess2.width = r, - this._horizontalBlurPostprocess2.height = o, - this._horizontalBlurPostprocess2.onApplyObservable.add(function(t) { - t.setTexture("textureSampler", e._blurTexture1) - }), - this._verticalBlurPostprocess2 = new Hn("GlowLayerVBP2",new a.w(0,1),this._options.blurKernelSize / 2,{ - width: r, - height: o - },null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,n), - this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2], - this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1], - this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2], - this._mainTexture.samples = this._options.mainTextureSamples, - this._mainTexture.onAfterUnbindObservable.add(function() { - var t = e._blurTexture1.getInternalTexture(); - t && (e._scene.postProcessManager.directRender(e._postProcesses1, t, true), - (t = e._blurTexture2.getInternalTexture()) && e._scene.postProcessManager.directRender(e._postProcesses2, t, true)) - }), - this._postProcesses.map(function(e) { - e.autoClear = false - }) - } - , - t.prototype.isReady = function(t, i) { - var n = t.getMaterial() - , r = t.getRenderingMesh(); - if (!n || !r) - return false; - var o = n.emissiveTexture; - return e.prototype._isReady.call(this, t, i, o) - } - , - t.prototype.needStencil = function() { - return false - } - , - t.prototype._canRenderMesh = function(e, t) { - return true - } - , - t.prototype._internalRender = function(e) { - e.setTexture("textureSampler", this._blurTexture1), - e.setTexture("textureSampler2", this._blurTexture2), - e.setFloat("offset", this._intensity); - var t = this._engine - , i = t.getStencilBuffer(); - t.setStencilBuffer(false), - t.drawElementsType(Mr.a.TriangleFillMode, 0, 6), - t.setStencilBuffer(i) - } - , - t.prototype._setEmissiveTextureAndColor = function(e, t, i) { - var n = 1; - this.customEmissiveTextureSelector ? this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(e, t, i) : i ? (this._emissiveTextureAndColor.texture = i.emissiveTexture, - this._emissiveTextureAndColor.texture && (n = this._emissiveTextureAndColor.texture.level)) : this._emissiveTextureAndColor.texture = null, - this.customEmissiveColorSelector ? this.customEmissiveColorSelector(e, t, i, this._emissiveTextureAndColor.color) : i.emissiveColor ? this._emissiveTextureAndColor.color.set(i.emissiveColor.r * n, i.emissiveColor.g * n, i.emissiveColor.b * n, i.alpha) : this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a) - } - , - t.prototype._shouldRenderMesh = function(e) { - return this.hasMesh(e) - } - , - t.prototype._addCustomEffectDefines = function(e) { - e.push("#define GLOW") - } - , - t.prototype.addExcludedMesh = function(e) { - -1 === this._excludedMeshes.indexOf(e.uniqueId) && this._excludedMeshes.push(e.uniqueId) - } - , - t.prototype.removeExcludedMesh = function(e) { - var t = this._excludedMeshes.indexOf(e.uniqueId); - -1 !== t && this._excludedMeshes.splice(t, 1) - } - , - t.prototype.addIncludedOnlyMesh = function(e) { - -1 === this._includedOnlyMeshes.indexOf(e.uniqueId) && this._includedOnlyMeshes.push(e.uniqueId) - } - , - t.prototype.removeIncludedOnlyMesh = function(e) { - var t = this._includedOnlyMeshes.indexOf(e.uniqueId); - -1 !== t && this._includedOnlyMeshes.splice(t, 1) - } - , - t.prototype.hasMesh = function(t) { - return !!e.prototype.hasMesh.call(this, t) && (this._includedOnlyMeshes.length ? -1 !== this._includedOnlyMeshes.indexOf(t.uniqueId) : !this._excludedMeshes.length || -1 === this._excludedMeshes.indexOf(t.uniqueId)) - } - , - t.prototype._disposeMesh = function(e) { - this.removeIncludedOnlyMesh(e), - this.removeExcludedMesh(e) - } - , - t.prototype.getClassName = function() { - return "GlowLayer" - } - , - t.prototype.serialize = function() { - var e, t = F.a.Serialize(this); - if (t.customType = "BABYLON.GlowLayer", - t.includedMeshes = [], - this._includedOnlyMeshes.length) - for (e = 0; e < this._includedOnlyMeshes.length; e++) - (i = this._scene.getMeshByUniqueID(this._includedOnlyMeshes[e])) && t.includedMeshes.push(i.id); - if (t.excludedMeshes = [], - this._excludedMeshes.length) - for (e = 0; e < this._excludedMeshes.length; e++) { - var i; - (i = this._scene.getMeshByUniqueID(this._excludedMeshes[e])) && t.excludedMeshes.push(i.id) - } - return t - } - , - t.Parse = function(e, i, n) { - var r, o = F.a.Parse(function() { - return new t(e.name,i,e.options) - }, e, i, n); - for (r = 0; r < e.excludedMeshes.length; r++) - (a = i.getMeshByID(e.excludedMeshes[r])) && o.addExcludedMesh(a); - for (r = 0; r < e.includedMeshes.length; r++) { - var a; - (a = i.getMeshByID(e.includedMeshes[r])) && o.addIncludedOnlyMesh(a) - } - return o - } - , - t.EffectName = "GlowLayer", - t.DefaultBlurKernelSize = 32, - t.DefaultTextureRatio = .5, - h.c([Object(F.c)()], t.prototype, "blurKernelSize", null), - h.c([Object(F.c)()], t.prototype, "intensity", null), - h.c([Object(F.c)("options")], t.prototype, "_options", void 0), - t - }(Or); - s.a.RegisteredTypes["BABYLON.GlowLayer"] = Ir; - Ht.a.ShadersStore.glowBlurPostProcessPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\n\nfloat getLuminance(vec3 color)\n{\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\n}\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\n\nvec4 texel=texture2D(textureSampler,start+texelOffset);\nbaseColor.a+=texel.a*weights[i];\n\nfloat luminance=getLuminance(baseColor.rgb);\nfloat luminanceTexel=getLuminance(texel.rgb);\nfloat choice=step(luminanceTexel,luminance);\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}", - r.a.prototype.getHighlightLayerByName = function(e) { - for (var t = 0; t < this.effectLayers.length; t++) - if (this.effectLayers[t].name === e && this.effectLayers[t].getEffectName() === Lr.EffectName) - return this.effectLayers[t]; - return null + o + ); } - ; - var Dr = function(e) { - function t(t, i, n, r, o, a, s, c) { - void 0 === a && (a = je.a.BILINEAR_SAMPLINGMODE); - var u = e.call(this, t, "glowBlurPostProcess", ["screenSize", "direction", "blurWidth"], null, r, o, a, s, c) || this; - return u.direction = i, - u.kernel = n, - u.onApplyObservable.add(function(e) { - e.setFloat2("screenSize", u.width, u.height), - e.setVector2("direction", u.direction), - e.setFloat("blurWidth", u.kernel) - }), - u + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "blurKernelSize", { + get: function () { + return this._horizontalBlurPostprocess1.kernel; + }, + set: function (e) { + (this._horizontalBlurPostprocess1.kernel = e), + (this._verticalBlurPostprocess1.kernel = e), + (this._horizontalBlurPostprocess2.kernel = e), + (this._verticalBlurPostprocess2.kernel = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "intensity", { + get: function () { + return this._intensity; + }, + set: function (e) { + this._intensity = e; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getEffectName = function () { + return t.EffectName; + }), + (t.prototype._createMergeEffect = function () { + return this._engine.createEffect( + "glowMapMerge", + [Si.b.PositionKind], + ["offset"], + ["textureSampler", "textureSampler2"], + "#define EMISSIVE \n" + ); + }), + (t.prototype._createTextureAndPostProcesses = function () { + var e = this, + t = this._mainTextureDesiredSize.width, + i = this._mainTextureDesiredSize.height; + (t = this._engine.needPOTTextures + ? Ee.h.GetExponentOfTwo(t, this._maxSize) + : t), + (i = this._engine.needPOTTextures + ? Ee.h.GetExponentOfTwo(i, this._maxSize) + : i); + var n; + (n = this._engine.getCaps().textureHalfFloatRender + ? _.a.TEXTURETYPE_HALF_FLOAT + : _.a.TEXTURETYPE_UNSIGNED_INT), + (this._blurTexture1 = new li( + "GlowLayerBlurRTT", + { + width: t, + height: i, + }, + this._scene, + false, + true, + n + )), + (this._blurTexture1.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._blurTexture1.wrapV = je.a.CLAMP_ADDRESSMODE), + this._blurTexture1.updateSamplingMode( + je.a.BILINEAR_SAMPLINGMODE + ), + (this._blurTexture1.renderParticles = false), + (this._blurTexture1.ignoreCameraViewport = true); + var r = Math.floor(t / 2), + o = Math.floor(i / 2); + (this._blurTexture2 = new li( + "GlowLayerBlurRTT2", + { + width: r, + height: o, + }, + this._scene, + false, + true, + n + )), + (this._blurTexture2.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._blurTexture2.wrapV = je.a.CLAMP_ADDRESSMODE), + this._blurTexture2.updateSamplingMode( + je.a.BILINEAR_SAMPLINGMODE + ), + (this._blurTexture2.renderParticles = false), + (this._blurTexture2.ignoreCameraViewport = true), + (this._textures = [ + this._blurTexture1, + this._blurTexture2, + ]), + (this._horizontalBlurPostprocess1 = new Hn( + "GlowLayerHBP1", + new a.w(1, 0), + this._options.blurKernelSize / 2, + { + width: t, + height: i, + }, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine(), + false, + n + )), + (this._horizontalBlurPostprocess1.width = t), + (this._horizontalBlurPostprocess1.height = i), + this._horizontalBlurPostprocess1.onApplyObservable.add( + function (t) { + t.setTexture("textureSampler", e._mainTexture); + } + ), + (this._verticalBlurPostprocess1 = new Hn( + "GlowLayerVBP1", + new a.w(0, 1), + this._options.blurKernelSize / 2, + { + width: t, + height: i, + }, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine(), + false, + n + )), + (this._horizontalBlurPostprocess2 = new Hn( + "GlowLayerHBP2", + new a.w(1, 0), + this._options.blurKernelSize / 2, + { + width: r, + height: o, + }, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine(), + false, + n + )), + (this._horizontalBlurPostprocess2.width = r), + (this._horizontalBlurPostprocess2.height = o), + this._horizontalBlurPostprocess2.onApplyObservable.add( + function (t) { + t.setTexture("textureSampler", e._blurTexture1); + } + ), + (this._verticalBlurPostprocess2 = new Hn( + "GlowLayerVBP2", + new a.w(0, 1), + this._options.blurKernelSize / 2, + { + width: r, + height: o, + }, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine(), + false, + n + )), + (this._postProcesses = [ + this._horizontalBlurPostprocess1, + this._verticalBlurPostprocess1, + this._horizontalBlurPostprocess2, + this._verticalBlurPostprocess2, + ]), + (this._postProcesses1 = [ + this._horizontalBlurPostprocess1, + this._verticalBlurPostprocess1, + ]), + (this._postProcesses2 = [ + this._horizontalBlurPostprocess2, + this._verticalBlurPostprocess2, + ]), + (this._mainTexture.samples = + this._options.mainTextureSamples), + this._mainTexture.onAfterUnbindObservable.add( + function () { + var t = e._blurTexture1.getInternalTexture(); + t && + (e._scene.postProcessManager.directRender( + e._postProcesses1, + t, + true + ), + (t = e._blurTexture2.getInternalTexture()) && + e._scene.postProcessManager.directRender( + e._postProcesses2, + t, + true + )); + } + ), + this._postProcesses.map(function (e) { + e.autoClear = false; + }); + }), + (t.prototype.isReady = function (t, i) { + var n = t.getMaterial(), + r = t.getRenderingMesh(); + if (!n || !r) return false; + var o = n.emissiveTexture; + return e.prototype._isReady.call(this, t, i, o); + }), + (t.prototype.needStencil = function () { + return false; + }), + (t.prototype._canRenderMesh = function (e, t) { + return true; + }), + (t.prototype._internalRender = function (e) { + e.setTexture("textureSampler", this._blurTexture1), + e.setTexture("textureSampler2", this._blurTexture2), + e.setFloat("offset", this._intensity); + var t = this._engine, + i = t.getStencilBuffer(); + t.setStencilBuffer(false), + t.drawElementsType(Mr.a.TriangleFillMode, 0, 6), + t.setStencilBuffer(i); + }), + (t.prototype._setEmissiveTextureAndColor = function ( + e, + t, + i + ) { + var n = 1; + this.customEmissiveTextureSelector + ? (this._emissiveTextureAndColor.texture = + this.customEmissiveTextureSelector(e, t, i)) + : i + ? ((this._emissiveTextureAndColor.texture = + i.emissiveTexture), + this._emissiveTextureAndColor.texture && + (n = this._emissiveTextureAndColor.texture.level)) + : (this._emissiveTextureAndColor.texture = null), + this.customEmissiveColorSelector + ? this.customEmissiveColorSelector( + e, + t, + i, + this._emissiveTextureAndColor.color + ) + : i.emissiveColor + ? this._emissiveTextureAndColor.color.set( + i.emissiveColor.r * n, + i.emissiveColor.g * n, + i.emissiveColor.b * n, + i.alpha + ) + : this._emissiveTextureAndColor.color.set( + this.neutralColor.r, + this.neutralColor.g, + this.neutralColor.b, + this.neutralColor.a + ); + }), + (t.prototype._shouldRenderMesh = function (e) { + return this.hasMesh(e); + }), + (t.prototype._addCustomEffectDefines = function (e) { + e.push("#define GLOW"); + }), + (t.prototype.addExcludedMesh = function (e) { + -1 === this._excludedMeshes.indexOf(e.uniqueId) && + this._excludedMeshes.push(e.uniqueId); + }), + (t.prototype.removeExcludedMesh = function (e) { + var t = this._excludedMeshes.indexOf(e.uniqueId); + -1 !== t && this._excludedMeshes.splice(t, 1); + }), + (t.prototype.addIncludedOnlyMesh = function (e) { + -1 === this._includedOnlyMeshes.indexOf(e.uniqueId) && + this._includedOnlyMeshes.push(e.uniqueId); + }), + (t.prototype.removeIncludedOnlyMesh = function (e) { + var t = this._includedOnlyMeshes.indexOf(e.uniqueId); + -1 !== t && this._includedOnlyMeshes.splice(t, 1); + }), + (t.prototype.hasMesh = function (t) { + return ( + !!e.prototype.hasMesh.call(this, t) && + (this._includedOnlyMeshes.length + ? -1 !== this._includedOnlyMeshes.indexOf(t.uniqueId) + : !this._excludedMeshes.length || + -1 === this._excludedMeshes.indexOf(t.uniqueId)) + ); + }), + (t.prototype._disposeMesh = function (e) { + this.removeIncludedOnlyMesh(e), this.removeExcludedMesh(e); + }), + (t.prototype.getClassName = function () { + return "GlowLayer"; + }), + (t.prototype.serialize = function () { + var e, + t = F.a.Serialize(this); + if ( + ((t.customType = "BABYLON.GlowLayer"), + (t.includedMeshes = []), + this._includedOnlyMeshes.length) + ) + for (e = 0; e < this._includedOnlyMeshes.length; e++) + (i = this._scene.getMeshByUniqueID( + this._includedOnlyMeshes[e] + )) && t.includedMeshes.push(i.id); + if (((t.excludedMeshes = []), this._excludedMeshes.length)) + for (e = 0; e < this._excludedMeshes.length; e++) { + var i; + (i = this._scene.getMeshByUniqueID( + this._excludedMeshes[e] + )) && t.excludedMeshes.push(i.id); + } + return t; + }), + (t.Parse = function (e, i, n) { + var r, + o = F.a.Parse( + function () { + return new t(e.name, i, e.options); + }, + e, + i, + n + ); + for (r = 0; r < e.excludedMeshes.length; r++) + (a = i.getMeshByID(e.excludedMeshes[r])) && + o.addExcludedMesh(a); + for (r = 0; r < e.includedMeshes.length; r++) { + var a; + (a = i.getMeshByID(e.includedMeshes[r])) && + o.addIncludedOnlyMesh(a); } - return h.d(t, e), - t - }(Wt) - , Lr = function(e) { - function t(i, n, r) { - var a = e.call(this, i, n) || this; - return a.name = i, - a.innerGlow = true, - a.outerGlow = true, - a.onBeforeBlurObservable = new o.c, - a.onAfterBlurObservable = new o.c, - a._instanceGlowingMeshStencilReference = t.GlowingMeshStencilReference++, - a._meshes = {}, - a._excludedMeshes = {}, - a.neutralColor = t.NeutralColor, - a._engine.isStencilEnable || g.a.Warn("Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }"), - a._options = h.a({ - mainTextureRatio: .5, - blurTextureSizeRatio: .5, - blurHorizontalSize: 1, - blurVerticalSize: 1, - alphaBlendingMode: _.a.ALPHA_COMBINE, - camera: null, - renderingGroupId: -1 - }, r), - a._init({ - alphaBlendingMode: a._options.alphaBlendingMode, - camera: a._options.camera, - mainTextureFixedSize: a._options.mainTextureFixedSize, - mainTextureRatio: a._options.mainTextureRatio, - renderingGroupId: a._options.renderingGroupId - }), - a._shouldRender = false, - a - } - return h.d(t, e), + return o; + }), + (t.EffectName = "GlowLayer"), + (t.DefaultBlurKernelSize = 32), + (t.DefaultTextureRatio = 0.5), + h.c([Object(F.c)()], t.prototype, "blurKernelSize", null), + h.c([Object(F.c)()], t.prototype, "intensity", null), + h.c( + [Object(F.c)("options")], + t.prototype, + "_options", + void 0 + ), + t + ); + })(Or); + s.a.RegisteredTypes["BABYLON.GlowLayer"] = Ir; + (Ht.a.ShadersStore.glowBlurPostProcessPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\n\nfloat getLuminance(vec3 color)\n{\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\n}\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\n\nvec4 texel=texture2D(textureSampler,start+texelOffset);\nbaseColor.a+=texel.a*weights[i];\n\nfloat luminance=getLuminance(baseColor.rgb);\nfloat luminanceTexel=getLuminance(texel.rgb);\nfloat choice=step(luminanceTexel,luminance);\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}"), + (r.a.prototype.getHighlightLayerByName = function (e) { + for (var t = 0; t < this.effectLayers.length; t++) + if ( + this.effectLayers[t].name === e && + this.effectLayers[t].getEffectName() === Lr.EffectName + ) + return this.effectLayers[t]; + return null; + }); + var Dr = (function (e) { + function t(t, i, n, r, o, a, s, c) { + void 0 === a && (a = je.a.BILINEAR_SAMPLINGMODE); + var u = + e.call( + this, + t, + "glowBlurPostProcess", + ["screenSize", "direction", "blurWidth"], + null, + r, + o, + a, + s, + c + ) || this; + return ( + (u.direction = i), + (u.kernel = n), + u.onApplyObservable.add(function (e) { + e.setFloat2("screenSize", u.width, u.height), + e.setVector2("direction", u.direction), + e.setFloat("blurWidth", u.kernel); + }), + u + ); + } + return h.d(t, e), t; + })(Wt), + Lr = (function (e) { + function t(i, n, r) { + var a = e.call(this, i, n) || this; + return ( + (a.name = i), + (a.innerGlow = true), + (a.outerGlow = true), + (a.onBeforeBlurObservable = new o.c()), + (a.onAfterBlurObservable = new o.c()), + (a._instanceGlowingMeshStencilReference = + t.GlowingMeshStencilReference++), + (a._meshes = {}), + (a._excludedMeshes = {}), + (a.neutralColor = t.NeutralColor), + a._engine.isStencilEnable || + g.a.Warn( + "Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }" + ), + (a._options = h.a( + { + mainTextureRatio: 0.5, + blurTextureSizeRatio: 0.5, + blurHorizontalSize: 1, + blurVerticalSize: 1, + alphaBlendingMode: _.a.ALPHA_COMBINE, + camera: null, + renderingGroupId: -1, + }, + r + )), + a._init({ + alphaBlendingMode: a._options.alphaBlendingMode, + camera: a._options.camera, + mainTextureFixedSize: a._options.mainTextureFixedSize, + mainTextureRatio: a._options.mainTextureRatio, + renderingGroupId: a._options.renderingGroupId, + }), + (a._shouldRender = false), + a + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "blurHorizontalSize", { - get: function() { - return this._horizontalBlurPostprocess.kernel - }, - set: function(e) { - this._horizontalBlurPostprocess.kernel = e - }, - enumerable: true, - configurable: true + get: function () { + return this._horizontalBlurPostprocess.kernel; + }, + set: function (e) { + this._horizontalBlurPostprocess.kernel = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "blurVerticalSize", { - get: function() { - return this._verticalBlurPostprocess.kernel - }, - set: function(e) { - this._verticalBlurPostprocess.kernel = e - }, - enumerable: true, - configurable: true + get: function () { + return this._verticalBlurPostprocess.kernel; + }, + set: function (e) { + this._verticalBlurPostprocess.kernel = e; + }, + enumerable: true, + configurable: true, }), - t.prototype.getEffectName = function() { - return t.EffectName - } - , - t.prototype._createMergeEffect = function() { - return this._engine.createEffect("glowMapMerge", [Si.b.PositionKind], ["offset"], ["textureSampler"], this._options.isStroke ? "#define STROKE \n" : void 0) - } - , - t.prototype._createTextureAndPostProcesses = function() { - var e = this - , t = this._mainTextureDesiredSize.width * this._options.blurTextureSizeRatio - , i = this._mainTextureDesiredSize.height * this._options.blurTextureSizeRatio; - t = this._engine.needPOTTextures ? Ee.h.GetExponentOfTwo(t, this._maxSize) : t, - i = this._engine.needPOTTextures ? Ee.h.GetExponentOfTwo(i, this._maxSize) : i; - var n; - n = this._engine.getCaps().textureHalfFloatRender ? _.a.TEXTURETYPE_HALF_FLOAT : _.a.TEXTURETYPE_UNSIGNED_INT, - this._blurTexture = new li("HighlightLayerBlurRTT",{ + (t.prototype.getEffectName = function () { + return t.EffectName; + }), + (t.prototype._createMergeEffect = function () { + return this._engine.createEffect( + "glowMapMerge", + [Si.b.PositionKind], + ["offset"], + ["textureSampler"], + this._options.isStroke ? "#define STROKE \n" : void 0 + ); + }), + (t.prototype._createTextureAndPostProcesses = function () { + var e = this, + t = + this._mainTextureDesiredSize.width * + this._options.blurTextureSizeRatio, + i = + this._mainTextureDesiredSize.height * + this._options.blurTextureSizeRatio; + (t = this._engine.needPOTTextures + ? Ee.h.GetExponentOfTwo(t, this._maxSize) + : t), + (i = this._engine.needPOTTextures + ? Ee.h.GetExponentOfTwo(i, this._maxSize) + : i); + var n; + (n = this._engine.getCaps().textureHalfFloatRender + ? _.a.TEXTURETYPE_HALF_FLOAT + : _.a.TEXTURETYPE_UNSIGNED_INT), + (this._blurTexture = new li( + "HighlightLayerBlurRTT", + { width: t, - height: i - },this._scene,false,true,n), - this._blurTexture.wrapU = je.a.CLAMP_ADDRESSMODE, - this._blurTexture.wrapV = je.a.CLAMP_ADDRESSMODE, - this._blurTexture.anisotropicFilteringLevel = 16, - this._blurTexture.updateSamplingMode(je.a.TRILINEAR_SAMPLINGMODE), - this._blurTexture.renderParticles = false, - this._blurTexture.ignoreCameraViewport = true, - this._textures = [this._blurTexture], - this._options.alphaBlendingMode === _.a.ALPHA_COMBINE ? (this._downSamplePostprocess = new Xt("HighlightLayerPPP",this._options.blurTextureSizeRatio,null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine()), - this._downSamplePostprocess.onApplyObservable.add(function(t) { - t.setTexture("textureSampler", e._mainTexture) - }), - this._horizontalBlurPostprocess = new Dr("HighlightLayerHBP",new a.w(1,0),this._options.blurHorizontalSize,1,null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine()), - this._horizontalBlurPostprocess.onApplyObservable.add(function(e) { - e.setFloat2("screenSize", t, i) - }), - this._verticalBlurPostprocess = new Dr("HighlightLayerVBP",new a.w(0,1),this._options.blurVerticalSize,1,null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine()), - this._verticalBlurPostprocess.onApplyObservable.add(function(e) { - e.setFloat2("screenSize", t, i) - }), - this._postProcesses = [this._downSamplePostprocess, this._horizontalBlurPostprocess, this._verticalBlurPostprocess]) : (this._horizontalBlurPostprocess = new Hn("HighlightLayerHBP",new a.w(1,0),this._options.blurHorizontalSize / 2,{ - width: t, - height: i - },null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,n), - this._horizontalBlurPostprocess.width = t, - this._horizontalBlurPostprocess.height = i, - this._horizontalBlurPostprocess.onApplyObservable.add(function(t) { - t.setTexture("textureSampler", e._mainTexture) - }), - this._verticalBlurPostprocess = new Hn("HighlightLayerVBP",new a.w(0,1),this._options.blurVerticalSize / 2,{ - width: t, - height: i - },null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,n), - this._postProcesses = [this._horizontalBlurPostprocess, this._verticalBlurPostprocess]), - this._mainTexture.onAfterUnbindObservable.add(function() { + height: i, + }, + this._scene, + false, + true, + n + )), + (this._blurTexture.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._blurTexture.wrapV = je.a.CLAMP_ADDRESSMODE), + (this._blurTexture.anisotropicFilteringLevel = 16), + this._blurTexture.updateSamplingMode( + je.a.TRILINEAR_SAMPLINGMODE + ), + (this._blurTexture.renderParticles = false), + (this._blurTexture.ignoreCameraViewport = true), + (this._textures = [this._blurTexture]), + this._options.alphaBlendingMode === _.a.ALPHA_COMBINE + ? ((this._downSamplePostprocess = new Xt( + "HighlightLayerPPP", + this._options.blurTextureSizeRatio, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine() + )), + this._downSamplePostprocess.onApplyObservable.add( + function (t) { + t.setTexture("textureSampler", e._mainTexture); + } + ), + (this._horizontalBlurPostprocess = new Dr( + "HighlightLayerHBP", + new a.w(1, 0), + this._options.blurHorizontalSize, + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine() + )), + this._horizontalBlurPostprocess.onApplyObservable.add( + function (e) { + e.setFloat2("screenSize", t, i); + } + ), + (this._verticalBlurPostprocess = new Dr( + "HighlightLayerVBP", + new a.w(0, 1), + this._options.blurVerticalSize, + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine() + )), + this._verticalBlurPostprocess.onApplyObservable.add( + function (e) { + e.setFloat2("screenSize", t, i); + } + ), + (this._postProcesses = [ + this._downSamplePostprocess, + this._horizontalBlurPostprocess, + this._verticalBlurPostprocess, + ])) + : ((this._horizontalBlurPostprocess = new Hn( + "HighlightLayerHBP", + new a.w(1, 0), + this._options.blurHorizontalSize / 2, + { + width: t, + height: i, + }, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine(), + false, + n + )), + (this._horizontalBlurPostprocess.width = t), + (this._horizontalBlurPostprocess.height = i), + this._horizontalBlurPostprocess.onApplyObservable.add( + function (t) { + t.setTexture("textureSampler", e._mainTexture); + } + ), + (this._verticalBlurPostprocess = new Hn( + "HighlightLayerVBP", + new a.w(0, 1), + this._options.blurVerticalSize / 2, + { + width: t, + height: i, + }, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine(), + false, + n + )), + (this._postProcesses = [ + this._horizontalBlurPostprocess, + this._verticalBlurPostprocess, + ])), + this._mainTexture.onAfterUnbindObservable.add( + function () { e.onBeforeBlurObservable.notifyObservers(e); var t = e._blurTexture.getInternalTexture(); - t && e._scene.postProcessManager.directRender(e._postProcesses, t, true), - e.onAfterBlurObservable.notifyObservers(e) - }), - this._postProcesses.map(function(e) { - e.autoClear = false - }) - } - , - t.prototype.needStencil = function() { - return true - } - , - t.prototype.isReady = function(t, i) { - var n = t.getMaterial() - , r = t.getRenderingMesh(); - if (!n || !r || !this._meshes) - return false; - var o = null - , a = this._meshes[r.uniqueId]; - return a && a.glowEmissiveOnly && n && (o = n.emissiveTexture), + t && + e._scene.postProcessManager.directRender( + e._postProcesses, + t, + true + ), + e.onAfterBlurObservable.notifyObservers(e); + } + ), + this._postProcesses.map(function (e) { + e.autoClear = false; + }); + }), + (t.prototype.needStencil = function () { + return true; + }), + (t.prototype.isReady = function (t, i) { + var n = t.getMaterial(), + r = t.getRenderingMesh(); + if (!n || !r || !this._meshes) return false; + var o = null, + a = this._meshes[r.uniqueId]; + return ( + a && a.glowEmissiveOnly && n && (o = n.emissiveTexture), e.prototype._isReady.call(this, t, i, o) - } - , - t.prototype._internalRender = function(e) { - e.setTexture("textureSampler", this._blurTexture); - var t = this._engine; - t.cacheStencilState(), + ); + }), + (t.prototype._internalRender = function (e) { + e.setTexture("textureSampler", this._blurTexture); + var t = this._engine; + t.cacheStencilState(), t.setStencilOperationPass(_.a.REPLACE), t.setStencilOperationFail(_.a.KEEP), t.setStencilOperationDepthFail(_.a.KEEP), t.setStencilMask(0), t.setStencilBuffer(true), - t.setStencilFunctionReference(this._instanceGlowingMeshStencilReference), - this.outerGlow && (e.setFloat("offset", 0), - t.setStencilFunction(_.a.NOTEQUAL), - t.drawElementsType(Mr.a.TriangleFillMode, 0, 6)), - this.innerGlow && (e.setFloat("offset", 1), - t.setStencilFunction(_.a.EQUAL), - t.drawElementsType(Mr.a.TriangleFillMode, 0, 6)), - t.restoreStencilState() - } - , - t.prototype.shouldRender = function() { - return !!e.prototype.shouldRender.call(this) && !!this._meshes - } - , - t.prototype._shouldRenderMesh = function(t) { - return !(this._excludedMeshes && this._excludedMeshes[t.uniqueId] || !e.prototype.hasMesh.call(this, t)) - } - , - t.prototype._setEmissiveTextureAndColor = function(e, t, i) { - var n = this._meshes[e.uniqueId]; - n ? this._emissiveTextureAndColor.color.set(n.color.r, n.color.g, n.color.b, 1) : this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a), - n && n.glowEmissiveOnly && i ? (this._emissiveTextureAndColor.texture = i.emissiveTexture, - this._emissiveTextureAndColor.color.set(1, 1, 1, 1)) : this._emissiveTextureAndColor.texture = null - } - , - t.prototype.addExcludedMesh = function(e) { - this._excludedMeshes && (this._excludedMeshes[e.uniqueId] || (this._excludedMeshes[e.uniqueId] = { + t.setStencilFunctionReference( + this._instanceGlowingMeshStencilReference + ), + this.outerGlow && + (e.setFloat("offset", 0), + t.setStencilFunction(_.a.NOTEQUAL), + t.drawElementsType(Mr.a.TriangleFillMode, 0, 6)), + this.innerGlow && + (e.setFloat("offset", 1), + t.setStencilFunction(_.a.EQUAL), + t.drawElementsType(Mr.a.TriangleFillMode, 0, 6)), + t.restoreStencilState(); + }), + (t.prototype.shouldRender = function () { + return ( + !!e.prototype.shouldRender.call(this) && !!this._meshes + ); + }), + (t.prototype._shouldRenderMesh = function (t) { + return !( + (this._excludedMeshes && + this._excludedMeshes[t.uniqueId]) || + !e.prototype.hasMesh.call(this, t) + ); + }), + (t.prototype._setEmissiveTextureAndColor = function ( + e, + t, + i + ) { + var n = this._meshes[e.uniqueId]; + n + ? this._emissiveTextureAndColor.color.set( + n.color.r, + n.color.g, + n.color.b, + 1 + ) + : this._emissiveTextureAndColor.color.set( + this.neutralColor.r, + this.neutralColor.g, + this.neutralColor.b, + this.neutralColor.a + ), + n && n.glowEmissiveOnly && i + ? ((this._emissiveTextureAndColor.texture = + i.emissiveTexture), + this._emissiveTextureAndColor.color.set(1, 1, 1, 1)) + : (this._emissiveTextureAndColor.texture = null); + }), + (t.prototype.addExcludedMesh = function (e) { + this._excludedMeshes && + (this._excludedMeshes[e.uniqueId] || + (this._excludedMeshes[e.uniqueId] = { mesh: e, - beforeBind: e.onBeforeBindObservable.add(function(e) { - e.getEngine().setStencilBuffer(false) + beforeBind: e.onBeforeBindObservable.add(function ( + e + ) { + e.getEngine().setStencilBuffer(false); }), - afterRender: e.onAfterRenderObservable.add(function(e) { - e.getEngine().setStencilBuffer(true) - }) - })) - } - , - t.prototype.removeExcludedMesh = function(e) { - if (this._excludedMeshes) { - var t = this._excludedMeshes[e.uniqueId]; - t && (t.beforeBind && e.onBeforeBindObservable.remove(t.beforeBind), - t.afterRender && e.onAfterRenderObservable.remove(t.afterRender)), - this._excludedMeshes[e.uniqueId] = null - } - } - , - t.prototype.hasMesh = function(t) { - return !!this._meshes && !!e.prototype.hasMesh.call(this, t) && void 0 !== this._meshes[t.uniqueId] && null !== this._meshes[t.uniqueId] - } - , - t.prototype.addMesh = function(e, t, i) { - var n = this; - if (void 0 === i && (i = false), - this._meshes) { - var r = this._meshes[e.uniqueId]; - r ? r.color = t : (this._meshes[e.uniqueId] = { - mesh: e, - color: t, - observerHighlight: e.onBeforeBindObservable.add(function(e) { - n._excludedMeshes && n._excludedMeshes[e.uniqueId] ? n._defaultStencilReference(e) : e.getScene().getEngine().setStencilFunctionReference(n._instanceGlowingMeshStencilReference) - }), - observerDefault: e.onAfterRenderObservable.add(this._defaultStencilReference), - glowEmissiveOnly: i - }, - e.onDisposeObservable.add(function() { - n._disposeMesh(e) - })), - this._shouldRender = true - } - } - , - t.prototype.removeMesh = function(e) { - if (this._meshes) { - var t = this._meshes[e.uniqueId]; - for (var i in t && (t.observerHighlight && e.onBeforeBindObservable.remove(t.observerHighlight), - t.observerDefault && e.onAfterRenderObservable.remove(t.observerDefault), - delete this._meshes[e.uniqueId]), - this._shouldRender = false, - this._meshes) - if (this._meshes[i]) { - this._shouldRender = true; - break + afterRender: e.onAfterRenderObservable.add( + function (e) { + e.getEngine().setStencilBuffer(true); + } + ), + })); + }), + (t.prototype.removeExcludedMesh = function (e) { + if (this._excludedMeshes) { + var t = this._excludedMeshes[e.uniqueId]; + t && + (t.beforeBind && + e.onBeforeBindObservable.remove(t.beforeBind), + t.afterRender && + e.onAfterRenderObservable.remove(t.afterRender)), + (this._excludedMeshes[e.uniqueId] = null); + } + }), + (t.prototype.hasMesh = function (t) { + return ( + !!this._meshes && + !!e.prototype.hasMesh.call(this, t) && + void 0 !== this._meshes[t.uniqueId] && + null !== this._meshes[t.uniqueId] + ); + }), + (t.prototype.addMesh = function (e, t, i) { + var n = this; + if ((void 0 === i && (i = false), this._meshes)) { + var r = this._meshes[e.uniqueId]; + r + ? (r.color = t) + : ((this._meshes[e.uniqueId] = { + mesh: e, + color: t, + observerHighlight: e.onBeforeBindObservable.add( + function (e) { + n._excludedMeshes && + n._excludedMeshes[e.uniqueId] + ? n._defaultStencilReference(e) + : e + .getScene() + .getEngine() + .setStencilFunctionReference( + n._instanceGlowingMeshStencilReference + ); } + ), + observerDefault: e.onAfterRenderObservable.add( + this._defaultStencilReference + ), + glowEmissiveOnly: i, + }), + e.onDisposeObservable.add(function () { + n._disposeMesh(e); + })), + (this._shouldRender = true); + } + }), + (t.prototype.removeMesh = function (e) { + if (this._meshes) { + var t = this._meshes[e.uniqueId]; + for (var i in (t && + (t.observerHighlight && + e.onBeforeBindObservable.remove( + t.observerHighlight + ), + t.observerDefault && + e.onAfterRenderObservable.remove(t.observerDefault), + delete this._meshes[e.uniqueId]), + (this._shouldRender = false), + this._meshes)) + if (this._meshes[i]) { + this._shouldRender = true; + break; + } + } + }), + (t.prototype._defaultStencilReference = function (e) { + e.getScene() + .getEngine() + .setStencilFunctionReference( + t.NormalMeshStencilReference + ); + }), + (t.prototype._disposeMesh = function (e) { + this.removeMesh(e), this.removeExcludedMesh(e); + }), + (t.prototype.dispose = function () { + if (this._meshes) { + for (var t in this._meshes) + (i = this._meshes[t]) && + i.mesh && + (i.observerHighlight && + i.mesh.onBeforeBindObservable.remove( + i.observerHighlight + ), + i.observerDefault && + i.mesh.onAfterRenderObservable.remove( + i.observerDefault + )); + this._meshes = null; + } + if (this._excludedMeshes) { + for (var t in this._excludedMeshes) { + var i; + (i = this._excludedMeshes[t]) && + (i.beforeBind && + i.mesh.onBeforeBindObservable.remove( + i.beforeBind + ), + i.afterRender && + i.mesh.onAfterRenderObservable.remove( + i.afterRender + )); } - } - , - t.prototype._defaultStencilReference = function(e) { - e.getScene().getEngine().setStencilFunctionReference(t.NormalMeshStencilReference) - } - , - t.prototype._disposeMesh = function(e) { - this.removeMesh(e), - this.removeExcludedMesh(e) - } - , - t.prototype.dispose = function() { - if (this._meshes) { - for (var t in this._meshes) - (i = this._meshes[t]) && i.mesh && (i.observerHighlight && i.mesh.onBeforeBindObservable.remove(i.observerHighlight), - i.observerDefault && i.mesh.onAfterRenderObservable.remove(i.observerDefault)); - this._meshes = null - } - if (this._excludedMeshes) { - for (var t in this._excludedMeshes) { - var i; - (i = this._excludedMeshes[t]) && (i.beforeBind && i.mesh.onBeforeBindObservable.remove(i.beforeBind), - i.afterRender && i.mesh.onAfterRenderObservable.remove(i.afterRender)) - } - this._excludedMeshes = null - } - e.prototype.dispose.call(this) - } - , - t.prototype.getClassName = function() { - return "HighlightLayer" - } - , - t.prototype.serialize = function() { - var e = F.a.Serialize(this); - if (e.customType = "BABYLON.HighlightLayer", - e.meshes = [], + this._excludedMeshes = null; + } + e.prototype.dispose.call(this); + }), + (t.prototype.getClassName = function () { + return "HighlightLayer"; + }), + (t.prototype.serialize = function () { + var e = F.a.Serialize(this); + if ( + ((e.customType = "BABYLON.HighlightLayer"), + (e.meshes = []), this._meshes) - for (var t in this._meshes) { - var i = this._meshes[t]; - i && e.meshes.push({ - glowEmissiveOnly: i.glowEmissiveOnly, - color: i.color.asArray(), - meshId: i.mesh.id - }) - } - if (e.excludedMeshes = [], - this._excludedMeshes) - for (var n in this._excludedMeshes) { - var r = this._excludedMeshes[n]; - r && e.excludedMeshes.push(r.mesh.id) - } - return e - } - , - t.Parse = function(e, i, n) { - var r, o = F.a.Parse(function() { - return new t(e.name,i,e.options) - }, e, i, n); - for (r = 0; r < e.excludedMeshes.length; r++) - (s = i.getMeshByID(e.excludedMeshes[r])) && o.addExcludedMesh(s); - for (r = 0; r < e.meshes.length; r++) { - var s, c = e.meshes[r]; - (s = i.getMeshByID(c.meshId)) && o.addMesh(s, a.e.FromArray(c.color), c.glowEmissiveOnly) + ) + for (var t in this._meshes) { + var i = this._meshes[t]; + i && + e.meshes.push({ + glowEmissiveOnly: i.glowEmissiveOnly, + color: i.color.asArray(), + meshId: i.mesh.id, + }); } - return o - } - , - t.EffectName = "HighlightLayer", - t.NeutralColor = new a.f(0,0,0,0), - t.GlowingMeshStencilReference = 2, - t.NormalMeshStencilReference = 1, + if (((e.excludedMeshes = []), this._excludedMeshes)) + for (var n in this._excludedMeshes) { + var r = this._excludedMeshes[n]; + r && e.excludedMeshes.push(r.mesh.id); + } + return e; + }), + (t.Parse = function (e, i, n) { + var r, + o = F.a.Parse( + function () { + return new t(e.name, i, e.options); + }, + e, + i, + n + ); + for (r = 0; r < e.excludedMeshes.length; r++) + (s = i.getMeshByID(e.excludedMeshes[r])) && + o.addExcludedMesh(s); + for (r = 0; r < e.meshes.length; r++) { + var s, + c = e.meshes[r]; + (s = i.getMeshByID(c.meshId)) && + o.addMesh( + s, + a.e.FromArray(c.color), + c.glowEmissiveOnly + ); + } + return o; + }), + (t.EffectName = "HighlightLayer"), + (t.NeutralColor = new a.f(0, 0, 0, 0)), + (t.GlowingMeshStencilReference = 2), + (t.NormalMeshStencilReference = 1), h.c([Object(F.c)()], t.prototype, "innerGlow", void 0), h.c([Object(F.c)()], t.prototype, "outerGlow", void 0), - h.c([Object(F.c)()], t.prototype, "blurHorizontalSize", null), + h.c( + [Object(F.c)()], + t.prototype, + "blurHorizontalSize", + null + ), h.c([Object(F.c)()], t.prototype, "blurVerticalSize", null), - h.c([Object(F.c)("options")], t.prototype, "_options", void 0), + h.c( + [Object(F.c)("options")], + t.prototype, + "_options", + void 0 + ), t - }(Or); - s.a.RegisteredTypes["BABYLON.HighlightLayer"] = Lr; - var Fr = function() { - function e(e) { - this.name = Se.a.NAME_LAYER, - this.scene = e, - this._engine = e.getEngine(), - e.layers = new Array + ); + })(Or); + s.a.RegisteredTypes["BABYLON.HighlightLayer"] = Lr; + var Fr = (function () { + function e(e) { + (this.name = Se.a.NAME_LAYER), + (this.scene = e), + (this._engine = e.getEngine()), + (e.layers = new Array()); + } + return ( + (e.prototype.register = function () { + this.scene._beforeCameraDrawStage.registerStep( + Se.a.STEP_BEFORECAMERADRAW_LAYER, + this, + this._drawCameraBackground + ), + this.scene._afterCameraDrawStage.registerStep( + Se.a.STEP_AFTERCAMERADRAW_LAYER, + this, + this._drawCameraForeground + ), + this.scene._beforeRenderTargetDrawStage.registerStep( + Se.a.STEP_BEFORERENDERTARGETDRAW_LAYER, + this, + this._drawRenderTargetBackground + ), + this.scene._afterRenderTargetDrawStage.registerStep( + Se.a.STEP_AFTERRENDERTARGETDRAW_LAYER, + this, + this._drawRenderTargetForeground + ); + }), + (e.prototype.rebuild = function () { + for (var e = 0, t = this.scene.layers; e < t.length; e++) + t[e]._rebuild(); + }), + (e.prototype.dispose = function () { + for (var e = this.scene.layers; e.length; ) e[0].dispose(); + }), + (e.prototype._draw = function (e) { + var t = this.scene.layers; + if (t.length) { + this._engine.setDepthBuffer(false); + for (var i = 0, n = t; i < n.length; i++) { + var r = n[i]; + e(r) && r.render(); + } + this._engine.setDepthBuffer(true); } - return e.prototype.register = function() { - this.scene._beforeCameraDrawStage.registerStep(Se.a.STEP_BEFORECAMERADRAW_LAYER, this, this._drawCameraBackground), - this.scene._afterCameraDrawStage.registerStep(Se.a.STEP_AFTERCAMERADRAW_LAYER, this, this._drawCameraForeground), - this.scene._beforeRenderTargetDrawStage.registerStep(Se.a.STEP_BEFORERENDERTARGETDRAW_LAYER, this, this._drawRenderTargetBackground), - this.scene._afterRenderTargetDrawStage.registerStep(Se.a.STEP_AFTERRENDERTARGETDRAW_LAYER, this, this._drawRenderTargetForeground) - } - , - e.prototype.rebuild = function() { - for (var e = 0, t = this.scene.layers; e < t.length; e++) - t[e]._rebuild() - } - , - e.prototype.dispose = function() { - for (var e = this.scene.layers; e.length; ) - e[0].dispose() - } - , - e.prototype._draw = function(e) { - var t = this.scene.layers; - if (t.length) { - this._engine.setDepthBuffer(false); - for (var i = 0, n = t; i < n.length; i++) { - var r = n[i]; - e(r) && r.render() - } - this._engine.setDepthBuffer(true) - } - } - , - e.prototype._drawCameraPredicate = function(e, t, i) { - return !e.renderOnlyInRenderTargetTextures && e.isBackground === t && 0 != (e.layerMask & i) - } - , - e.prototype._drawCameraBackground = function(e) { - var t = this; - this._draw(function(i) { - return t._drawCameraPredicate(i, true, e.layerMask) - }) - } - , - e.prototype._drawCameraForeground = function(e) { - var t = this; - this._draw(function(i) { - return t._drawCameraPredicate(i, false, e.layerMask) - }) - } - , - e.prototype._drawRenderTargetPredicate = function(e, t, i, n) { - return e.renderTargetTextures.length > 0 && e.isBackground === t && e.renderTargetTextures.indexOf(n) > -1 && 0 != (e.layerMask & i) - } - , - e.prototype._drawRenderTargetBackground = function(e) { - var t = this; - this._draw(function(i) { - return t._drawRenderTargetPredicate(i, true, t.scene.activeCamera.layerMask, e) - }) - } - , - e.prototype._drawRenderTargetForeground = function(e) { - var t = this; - this._draw(function(i) { - return t._drawRenderTargetPredicate(i, false, t.scene.activeCamera.layerMask, e) - }) - } - , - e - }(); - Ht.a.ShadersStore.layerPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}"; - Ht.a.ShadersStore.layerVertexShader = "\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}"; - var Br = function() { - function e(e, t, i, n, r) { - this.name = e, - this.scale = new a.w(1,1), - this.offset = new a.w(0,0), - this.alphaBlendingMode = _.a.ALPHA_COMBINE, - this.layerMask = 268435455, - this.renderTargetTextures = [], - this.renderOnlyInRenderTargetTextures = false, - this._vertexBuffers = {}, - this.onDisposeObservable = new o.c, - this.onBeforeRenderObservable = new o.c, - this.onAfterRenderObservable = new o.c, - this.texture = t ? new je.a(t,i,true) : null, - this.isBackground = void 0 === n || n, - this.color = void 0 === r ? new a.f(1,1,1,1) : r, - this._scene = i || R.a.LastCreatedScene; - var s = this._scene._getComponent(Se.a.NAME_LAYER); - s || (s = new Fr(this._scene), - this._scene._addComponent(s)), - this._scene.layers.push(this); - var c = this._scene.getEngine() - , u = []; - u.push(1, 1), - u.push(-1, 1), - u.push(-1, -1), - u.push(1, -1); - var l = new Si.b(c,u,Si.b.PositionKind,false,false,2); - this._vertexBuffers[Si.b.PositionKind] = l, - this._createIndexBuffer(), - this._effect = c.createEffect("layer", [Si.b.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], ""), - this._alphaTestEffect = c.createEffect("layer", [Si.b.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], "#define ALPHATEST") - } - return Object.defineProperty(e.prototype, "onDispose", { - set: function(e) { - this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), - this._onDisposeObserver = this.onDisposeObservable.add(e) - }, - enumerable: true, - configurable: true + }), + (e.prototype._drawCameraPredicate = function (e, t, i) { + return ( + !e.renderOnlyInRenderTargetTextures && + e.isBackground === t && + 0 != (e.layerMask & i) + ); + }), + (e.prototype._drawCameraBackground = function (e) { + var t = this; + this._draw(function (i) { + return t._drawCameraPredicate(i, true, e.layerMask); + }); + }), + (e.prototype._drawCameraForeground = function (e) { + var t = this; + this._draw(function (i) { + return t._drawCameraPredicate(i, false, e.layerMask); + }); + }), + (e.prototype._drawRenderTargetPredicate = function ( + e, + t, + i, + n + ) { + return ( + e.renderTargetTextures.length > 0 && + e.isBackground === t && + e.renderTargetTextures.indexOf(n) > -1 && + 0 != (e.layerMask & i) + ); + }), + (e.prototype._drawRenderTargetBackground = function (e) { + var t = this; + this._draw(function (i) { + return t._drawRenderTargetPredicate( + i, + true, + t.scene.activeCamera.layerMask, + e + ); + }); + }), + (e.prototype._drawRenderTargetForeground = function (e) { + var t = this; + this._draw(function (i) { + return t._drawRenderTargetPredicate( + i, + false, + t.scene.activeCamera.layerMask, + e + ); + }); + }), + e + ); + })(); + Ht.a.ShadersStore.layerPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}"; + Ht.a.ShadersStore.layerVertexShader = + "\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}"; + var Br = (function () { + function e(e, t, i, n, r) { + (this.name = e), + (this.scale = new a.w(1, 1)), + (this.offset = new a.w(0, 0)), + (this.alphaBlendingMode = _.a.ALPHA_COMBINE), + (this.layerMask = 268435455), + (this.renderTargetTextures = []), + (this.renderOnlyInRenderTargetTextures = false), + (this._vertexBuffers = {}), + (this.onDisposeObservable = new o.c()), + (this.onBeforeRenderObservable = new o.c()), + (this.onAfterRenderObservable = new o.c()), + (this.texture = t ? new je.a(t, i, true) : null), + (this.isBackground = void 0 === n || n), + (this.color = void 0 === r ? new a.f(1, 1, 1, 1) : r), + (this._scene = i || R.a.LastCreatedScene); + var s = this._scene._getComponent(Se.a.NAME_LAYER); + s || + ((s = new Fr(this._scene)), this._scene._addComponent(s)), + this._scene.layers.push(this); + var c = this._scene.getEngine(), + u = []; + u.push(1, 1), u.push(-1, 1), u.push(-1, -1), u.push(1, -1); + var l = new Si.b(c, u, Si.b.PositionKind, false, false, 2); + (this._vertexBuffers[Si.b.PositionKind] = l), + this._createIndexBuffer(), + (this._effect = c.createEffect( + "layer", + [Si.b.PositionKind], + ["textureMatrix", "color", "scale", "offset"], + ["textureSampler"], + "" + )), + (this._alphaTestEffect = c.createEffect( + "layer", + [Si.b.PositionKind], + ["textureMatrix", "color", "scale", "offset"], + ["textureSampler"], + "#define ALPHATEST" + )); + } + return ( + Object.defineProperty(e.prototype, "onDispose", { + set: function (e) { + this._onDisposeObserver && + this.onDisposeObservable.remove( + this._onDisposeObserver + ), + (this._onDisposeObserver = + this.onDisposeObservable.add(e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "onBeforeRender", { - set: function(e) { - this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), - this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e) - }, - enumerable: true, - configurable: true + set: function (e) { + this._onBeforeRenderObserver && + this.onBeforeRenderObservable.remove( + this._onBeforeRenderObserver + ), + (this._onBeforeRenderObserver = + this.onBeforeRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "onAfterRender", { - set: function(e) { - this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), - this._onAfterRenderObserver = this.onAfterRenderObservable.add(e) - }, - enumerable: true, - configurable: true + set: function (e) { + this._onAfterRenderObserver && + this.onAfterRenderObservable.remove( + this._onAfterRenderObserver + ), + (this._onAfterRenderObserver = + this.onAfterRenderObservable.add(e)); + }, + enumerable: true, + configurable: true, }), - e.prototype._createIndexBuffer = function() { - var e = this._scene.getEngine() - , t = []; - t.push(0), + (e.prototype._createIndexBuffer = function () { + var e = this._scene.getEngine(), + t = []; + t.push(0), t.push(1), t.push(2), t.push(0), t.push(2), t.push(3), - this._indexBuffer = e.createIndexBuffer(t) - } - , - e.prototype._rebuild = function() { - var e = this._vertexBuffers[Si.b.PositionKind]; - e && e._rebuild(), - this._createIndexBuffer() - } - , - e.prototype.render = function() { - var e = this.alphaTest ? this._alphaTestEffect : this._effect; - if (e.isReady() && this.texture && this.texture.isReady()) { - var t = this._scene.getEngine(); - this.onBeforeRenderObservable.notifyObservers(this), - t.enableEffect(e), - t.setState(false), - e.setTexture("textureSampler", this.texture), - e.setMatrix("textureMatrix", this.texture.getTextureMatrix()), - e.setFloat4("color", this.color.r, this.color.g, this.color.b, this.color.a), - e.setVector2("offset", this.offset), - e.setVector2("scale", this.scale), - t.bindBuffers(this._vertexBuffers, this._indexBuffer, e), - this.alphaTest ? t.drawElementsType(Mr.a.TriangleFillMode, 0, 6) : (t.setAlphaMode(this.alphaBlendingMode), - t.drawElementsType(Mr.a.TriangleFillMode, 0, 6), - t.setAlphaMode(_.a.ALPHA_DISABLE)), - this.onAfterRenderObservable.notifyObservers(this) - } - } - , - e.prototype.dispose = function() { - var e = this._vertexBuffers[Si.b.PositionKind]; - e && (e.dispose(), - this._vertexBuffers[Si.b.PositionKind] = null), - this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), - this._indexBuffer = null), - this.texture && (this.texture.dispose(), - this.texture = null), - this.renderTargetTextures = []; - var t = this._scene.layers.indexOf(this); - this._scene.layers.splice(t, 1), + (this._indexBuffer = e.createIndexBuffer(t)); + }), + (e.prototype._rebuild = function () { + var e = this._vertexBuffers[Si.b.PositionKind]; + e && e._rebuild(), this._createIndexBuffer(); + }), + (e.prototype.render = function () { + var e = this.alphaTest + ? this._alphaTestEffect + : this._effect; + if ( + e.isReady() && + this.texture && + this.texture.isReady() + ) { + var t = this._scene.getEngine(); + this.onBeforeRenderObservable.notifyObservers(this), + t.enableEffect(e), + t.setState(false), + e.setTexture("textureSampler", this.texture), + e.setMatrix( + "textureMatrix", + this.texture.getTextureMatrix() + ), + e.setFloat4( + "color", + this.color.r, + this.color.g, + this.color.b, + this.color.a + ), + e.setVector2("offset", this.offset), + e.setVector2("scale", this.scale), + t.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + e + ), + this.alphaTest + ? t.drawElementsType(Mr.a.TriangleFillMode, 0, 6) + : (t.setAlphaMode(this.alphaBlendingMode), + t.drawElementsType(Mr.a.TriangleFillMode, 0, 6), + t.setAlphaMode(_.a.ALPHA_DISABLE)), + this.onAfterRenderObservable.notifyObservers(this); + } + }), + (e.prototype.dispose = function () { + var e = this._vertexBuffers[Si.b.PositionKind]; + e && + (e.dispose(), + (this._vertexBuffers[Si.b.PositionKind] = null)), + this._indexBuffer && + (this._scene + .getEngine() + ._releaseBuffer(this._indexBuffer), + (this._indexBuffer = null)), + this.texture && + (this.texture.dispose(), (this.texture = null)), + (this.renderTargetTextures = []); + var t = this._scene.layers.indexOf(this); + this._scene.layers.splice(t, 1), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), this.onAfterRenderObservable.clear(), - this.onBeforeRenderObservable.clear() - } - , - e - }() - , Nr = function() { - function e(e, t, i, n, r) { - this.size = e, - this.position = t, - this.alphaMode = _.a.ALPHA_ONEONE, - this.color = i || new a.e(1,1,1), - this.texture = n ? new je.a(n,r.getScene(),true) : null, - this._system = r, - r.lensFlares.push(this) - } - return e.AddFlare = function(t, i, n, r, o) { - return new e(t,i,n,r,o) - } - , - e.prototype.dispose = function() { - this.texture && this.texture.dispose(); - var e = this._system.lensFlares.indexOf(this); - this._system.lensFlares.splice(e, 1) - } - , - e - }(); - Ht.a.ShadersStore.lensFlarePixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}"; - Ht.a.ShadersStore.lensFlareVertexShader = "\nattribute vec2 position;\n\nuniform mat4 viewportMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\n}"; - var kr = function() { - function e(t, i, n) { - this.name = t, - this.lensFlares = new Array, - this.borderLimit = 300, - this.viewportBorder = 0, - this.layerMask = 268435455, - this._vertexBuffers = {}, - this._isEnabled = true, - this._scene = n || R.a.LastCreatedScene, - e._SceneComponentInitialization(this._scene), - this._emitter = i, - this.id = t, - n.lensFlareSystems.push(this), - this.meshesSelectionPredicate = function(e) { - return n.activeCamera && e.material && e.isVisible && e.isEnabled() && e.isBlocker && 0 != (e.layerMask & n.activeCamera.layerMask) - } - ; - var r = n.getEngine() - , o = []; - o.push(1, 1), - o.push(-1, 1), - o.push(-1, -1), - o.push(1, -1), - this._vertexBuffers[Si.b.PositionKind] = new Si.b(r,o,Si.b.PositionKind,false,false,2); - var a = []; - a.push(0), - a.push(1), - a.push(2), - a.push(0), - a.push(2), - a.push(3), - this._indexBuffer = r.createIndexBuffer(a), - this._effect = r.createEffect("lensFlare", [Si.b.PositionKind], ["color", "viewportMatrix"], ["textureSampler"], "") - } - return Object.defineProperty(e.prototype, "isEnabled", { - get: function() { - return this._isEnabled - }, - set: function(e) { - this._isEnabled = e - }, - enumerable: true, - configurable: true + this.onBeforeRenderObservable.clear(); }), - e.prototype.getScene = function() { - return this._scene - } - , - e.prototype.getEmitter = function() { - return this._emitter - } - , - e.prototype.setEmitter = function(e) { - this._emitter = e - } - , - e.prototype.getEmitterPosition = function() { - return this._emitter.getAbsolutePosition ? this._emitter.getAbsolutePosition() : this._emitter.position - } - , - e.prototype.computeEffectivePosition = function(e) { - var t = this.getEmitterPosition(); - return t = a.x.Project(t, a.j.Identity(), this._scene.getTransformMatrix(), e), - this._positionX = t.x, - this._positionY = t.y, - t = a.x.TransformCoordinates(this.getEmitterPosition(), this._scene.getViewMatrix()), - this.viewportBorder > 0 && (e.x -= this.viewportBorder, - e.y -= this.viewportBorder, - e.width += 2 * this.viewportBorder, - e.height += 2 * this.viewportBorder, - t.x += this.viewportBorder, - t.y += this.viewportBorder, - this._positionX += this.viewportBorder, - this._positionY += this.viewportBorder), - t.z > 0 && (this._positionX > e.x && this._positionX < e.x + e.width && this._positionY > e.y && (this._positionY, - e.y, - e.height), + e + ); + })(), + Nr = (function () { + function e(e, t, i, n, r) { + (this.size = e), + (this.position = t), + (this.alphaMode = _.a.ALPHA_ONEONE), + (this.color = i || new a.e(1, 1, 1)), + (this.texture = n + ? new je.a(n, r.getScene(), true) + : null), + (this._system = r), + r.lensFlares.push(this); + } + return ( + (e.AddFlare = function (t, i, n, r, o) { + return new e(t, i, n, r, o); + }), + (e.prototype.dispose = function () { + this.texture && this.texture.dispose(); + var e = this._system.lensFlares.indexOf(this); + this._system.lensFlares.splice(e, 1); + }), + e + ); + })(); + Ht.a.ShadersStore.lensFlarePixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}"; + Ht.a.ShadersStore.lensFlareVertexShader = + "\nattribute vec2 position;\n\nuniform mat4 viewportMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\n}"; + var kr = (function () { + function e(t, i, n) { + (this.name = t), + (this.lensFlares = new Array()), + (this.borderLimit = 300), + (this.viewportBorder = 0), + (this.layerMask = 268435455), + (this._vertexBuffers = {}), + (this._isEnabled = true), + (this._scene = n || R.a.LastCreatedScene), + e._SceneComponentInitialization(this._scene), + (this._emitter = i), + (this.id = t), + n.lensFlareSystems.push(this), + (this.meshesSelectionPredicate = function (e) { + return ( + n.activeCamera && + e.material && + e.isVisible && + e.isEnabled() && + e.isBlocker && + 0 != (e.layerMask & n.activeCamera.layerMask) + ); + }); + var r = n.getEngine(), + o = []; + o.push(1, 1), + o.push(-1, 1), + o.push(-1, -1), + o.push(1, -1), + (this._vertexBuffers[Si.b.PositionKind] = new Si.b( + r, + o, + Si.b.PositionKind, + false, + false, + 2 + )); + var a = []; + a.push(0), + a.push(1), + a.push(2), + a.push(0), + a.push(2), + a.push(3), + (this._indexBuffer = r.createIndexBuffer(a)), + (this._effect = r.createEffect( + "lensFlare", + [Si.b.PositionKind], + ["color", "viewportMatrix"], + ["textureSampler"], + "" + )); + } + return ( + Object.defineProperty(e.prototype, "isEnabled", { + get: function () { + return this._isEnabled; + }, + set: function (e) { + this._isEnabled = e; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getScene = function () { + return this._scene; + }), + (e.prototype.getEmitter = function () { + return this._emitter; + }), + (e.prototype.setEmitter = function (e) { + this._emitter = e; + }), + (e.prototype.getEmitterPosition = function () { + return this._emitter.getAbsolutePosition + ? this._emitter.getAbsolutePosition() + : this._emitter.position; + }), + (e.prototype.computeEffectivePosition = function (e) { + var t = this.getEmitterPosition(); + return ( + (t = a.x.Project( + t, + a.j.Identity(), + this._scene.getTransformMatrix(), + e + )), + (this._positionX = t.x), + (this._positionY = t.y), + (t = a.x.TransformCoordinates( + this.getEmitterPosition(), + this._scene.getViewMatrix() + )), + this.viewportBorder > 0 && + ((e.x -= this.viewportBorder), + (e.y -= this.viewportBorder), + (e.width += 2 * this.viewportBorder), + (e.height += 2 * this.viewportBorder), + (t.x += this.viewportBorder), + (t.y += this.viewportBorder), + (this._positionX += this.viewportBorder), + (this._positionY += this.viewportBorder)), + t.z > 0 && + (this._positionX > e.x && + this._positionX < e.x + e.width && + this._positionY > e.y && + (this._positionY, e.y, e.height), true) - } - , - e.prototype._isVisible = function() { - if (!this._isEnabled || !this._scene.activeCamera) - return false; - var e = this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition) - , t = e.length(); - e.normalize(); - var i = new Dt.a(this._scene.activeCamera.globalPosition,e) - , n = this._scene.pickWithRay(i, this.meshesSelectionPredicate, true); - return !n || !n.hit || n.distance > t - } - , - e.prototype.render = function() { - if (!this._effect.isReady() || !this._scene.activeCamera) - return false; - var e, t, i = this._scene.getEngine(), n = this._scene.activeCamera.viewport.toGlobal(i.getRenderWidth(true), i.getRenderHeight(true)); - if (!this.computeEffectivePosition(n)) - return false; - if (!this._isVisible()) - return false; - var r = (e = this._positionX < this.borderLimit + n.x ? this.borderLimit + n.x - this._positionX : this._positionX > n.x + n.width - this.borderLimit ? this._positionX - n.x - n.width + this.borderLimit : 0) > (t = this._positionY < this.borderLimit + n.y ? this.borderLimit + n.y - this._positionY : this._positionY > n.y + n.height - this.borderLimit ? this._positionY - n.y - n.height + this.borderLimit : 0) ? e : t; - (r -= this.viewportBorder) > this.borderLimit && (r = this.borderLimit); - var o = 1 - L.a.Clamp(r / this.borderLimit, 0, 1); - if (o < 0) - return false; - o > 1 && (o = 1), - this.viewportBorder > 0 && (n.x += this.viewportBorder, - n.y += this.viewportBorder, - n.width -= 2 * this.viewportBorder, - n.height -= 2 * this.viewportBorder, - this._positionX -= this.viewportBorder, - this._positionY -= this.viewportBorder); - var s = n.x + n.width / 2 - , c = n.y + n.height / 2 - , u = s - this._positionX - , l = c - this._positionY; - i.enableEffect(this._effect), - i.setState(false), - i.setDepthBuffer(false), - i.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect); - for (var h = 0; h < this.lensFlares.length; h++) { - var f = this.lensFlares[h]; - i.setAlphaMode(f.alphaMode); - var d = s - u * f.position - , p = c - l * f.position - , m = f.size - , g = f.size * i.getAspectRatio(this._scene.activeCamera, true) - , v = d / (n.width + 2 * n.x) * 2 - 1 - , y = 1 - p / (n.height + 2 * n.y) * 2 - , b = a.j.FromValues(m / 2, 0, 0, 0, 0, g / 2, 0, 0, 0, 0, 1, 0, v, y, 0, 1); - this._effect.setMatrix("viewportMatrix", b), - this._effect.setTexture("textureSampler", f.texture), - this._effect.setFloat4("color", f.color.r * o, f.color.g * o, f.color.b * o, 1), - i.drawElementsType(Mr.a.TriangleFillMode, 0, 6) - } - return i.setDepthBuffer(true), - i.setAlphaMode(_.a.ALPHA_DISABLE), + ); + }), + (e.prototype._isVisible = function () { + if (!this._isEnabled || !this._scene.activeCamera) + return false; + var e = this.getEmitterPosition().subtract( + this._scene.activeCamera.globalPosition + ), + t = e.length(); + e.normalize(); + var i = new Dt.a( + this._scene.activeCamera.globalPosition, + e + ), + n = this._scene.pickWithRay( + i, + this.meshesSelectionPredicate, true + ); + return !n || !n.hit || n.distance > t; + }), + (e.prototype.render = function () { + if (!this._effect.isReady() || !this._scene.activeCamera) + return false; + var e, + t, + i = this._scene.getEngine(), + n = this._scene.activeCamera.viewport.toGlobal( + i.getRenderWidth(true), + i.getRenderHeight(true) + ); + if (!this.computeEffectivePosition(n)) return false; + if (!this._isVisible()) return false; + var r = + (e = + this._positionX < this.borderLimit + n.x + ? this.borderLimit + n.x - this._positionX + : this._positionX > n.x + n.width - this.borderLimit + ? this._positionX - n.x - n.width + this.borderLimit + : 0) > + (t = + this._positionY < this.borderLimit + n.y + ? this.borderLimit + n.y - this._positionY + : this._positionY > n.y + n.height - this.borderLimit + ? this._positionY - n.y - n.height + this.borderLimit + : 0) + ? e + : t; + (r -= this.viewportBorder) > this.borderLimit && + (r = this.borderLimit); + var o = 1 - L.a.Clamp(r / this.borderLimit, 0, 1); + if (o < 0) return false; + o > 1 && (o = 1), + this.viewportBorder > 0 && + ((n.x += this.viewportBorder), + (n.y += this.viewportBorder), + (n.width -= 2 * this.viewportBorder), + (n.height -= 2 * this.viewportBorder), + (this._positionX -= this.viewportBorder), + (this._positionY -= this.viewportBorder)); + var s = n.x + n.width / 2, + c = n.y + n.height / 2, + u = s - this._positionX, + l = c - this._positionY; + i.enableEffect(this._effect), + i.setState(false), + i.setDepthBuffer(false), + i.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + this._effect + ); + for (var h = 0; h < this.lensFlares.length; h++) { + var f = this.lensFlares[h]; + i.setAlphaMode(f.alphaMode); + var d = s - u * f.position, + p = c - l * f.position, + m = f.size, + g = + f.size * + i.getAspectRatio(this._scene.activeCamera, true), + v = (d / (n.width + 2 * n.x)) * 2 - 1, + y = 1 - (p / (n.height + 2 * n.y)) * 2, + b = a.j.FromValues( + m / 2, + 0, + 0, + 0, + 0, + g / 2, + 0, + 0, + 0, + 0, + 1, + 0, + v, + y, + 0, + 1 + ); + this._effect.setMatrix("viewportMatrix", b), + this._effect.setTexture("textureSampler", f.texture), + this._effect.setFloat4( + "color", + f.color.r * o, + f.color.g * o, + f.color.b * o, + 1 + ), + i.drawElementsType(Mr.a.TriangleFillMode, 0, 6); } - , - e.prototype.dispose = function() { - var e = this._vertexBuffers[Si.b.PositionKind]; - for (e && (e.dispose(), - this._vertexBuffers[Si.b.PositionKind] = null), - this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), - this._indexBuffer = null); this.lensFlares.length; ) - this.lensFlares[0].dispose(); - var t = this._scene.lensFlareSystems.indexOf(this); - this._scene.lensFlareSystems.splice(t, 1) + return ( + i.setDepthBuffer(true), + i.setAlphaMode(_.a.ALPHA_DISABLE), + true + ); + }), + (e.prototype.dispose = function () { + var e = this._vertexBuffers[Si.b.PositionKind]; + for ( + e && + (e.dispose(), + (this._vertexBuffers[Si.b.PositionKind] = null)), + this._indexBuffer && + (this._scene + .getEngine() + ._releaseBuffer(this._indexBuffer), + (this._indexBuffer = null)); + this.lensFlares.length; + + ) + this.lensFlares[0].dispose(); + var t = this._scene.lensFlareSystems.indexOf(this); + this._scene.lensFlareSystems.splice(t, 1); + }), + (e.Parse = function (t, i, n) { + var r = i.getLastEntryByID(t.emitterId), + o = t.name || "lensFlareSystem#" + t.emitterId, + s = new e(o, r, i); + (s.id = t.id || o), (s.borderLimit = t.borderLimit); + for (var c = 0; c < t.flares.length; c++) { + var u = t.flares[c]; + Nr.AddFlare( + u.size, + u.position, + a.e.FromArray(u.color), + u.textureName ? n + u.textureName : "", + s + ); } - , - e.Parse = function(t, i, n) { - var r = i.getLastEntryByID(t.emitterId) - , o = t.name || "lensFlareSystem#" + t.emitterId - , s = new e(o,r,i); - s.id = t.id || o, - s.borderLimit = t.borderLimit; - for (var c = 0; c < t.flares.length; c++) { - var u = t.flares[c]; - Nr.AddFlare(u.size, u.position, a.e.FromArray(u.color), u.textureName ? n + u.textureName : "", s) - } - return s - } - , - e.prototype.serialize = function() { - var e = {}; - e.id = this.id, - e.name = this.name, - e.emitterId = this.getEmitter().id, - e.borderLimit = this.borderLimit, - e.flares = []; - for (var t = 0; t < this.lensFlares.length; t++) { - var i = this.lensFlares[t]; - e.flares.push({ - size: i.size, - position: i.position, - color: i.color.asArray(), - textureName: Ee.h.GetFilename(i.texture ? i.texture.name : "") - }) - } - return e - } - , - e._SceneComponentInitialization = function(e) { - throw Te.a.WarnImport("LensFlareSystemSceneComponent") - } - , - e - }(); - r.a.AddParser(Se.a.NAME_LENSFLARESYSTEM, function(e, t, i, n) { - if (void 0 !== e.lensFlareSystems && null !== e.lensFlareSystems) { - i.lensFlareSystems || (i.lensFlareSystems = new Array); - for (var r = 0, o = e.lensFlareSystems.length; r < o; r++) { - var a = e.lensFlareSystems[r] - , s = kr.Parse(a, t, n); - i.lensFlareSystems.push(s) - } + return s; + }), + (e.prototype.serialize = function () { + var e = {}; + (e.id = this.id), + (e.name = this.name), + (e.emitterId = this.getEmitter().id), + (e.borderLimit = this.borderLimit), + (e.flares = []); + for (var t = 0; t < this.lensFlares.length; t++) { + var i = this.lensFlares[t]; + e.flares.push({ + size: i.size, + position: i.position, + color: i.color.asArray(), + textureName: Ee.h.GetFilename( + i.texture ? i.texture.name : "" + ), + }); } + return e; + }), + (e._SceneComponentInitialization = function (e) { + throw Te.a.WarnImport("LensFlareSystemSceneComponent"); + }), + e + ); + })(); + r.a.AddParser(Se.a.NAME_LENSFLARESYSTEM, function (e, t, i, n) { + if ( + void 0 !== e.lensFlareSystems && + null !== e.lensFlareSystems + ) { + i.lensFlareSystems || (i.lensFlareSystems = new Array()); + for (var r = 0, o = e.lensFlareSystems.length; r < o; r++) { + var a = e.lensFlareSystems[r], + s = kr.Parse(a, t, n); + i.lensFlareSystems.push(s); + } + } + }), + (r.a.prototype.getLensFlareSystemByName = function (e) { + for (var t = 0; t < this.lensFlareSystems.length; t++) + if (this.lensFlareSystems[t].name === e) + return this.lensFlareSystems[t]; + return null; }), - r.a.prototype.getLensFlareSystemByName = function(e) { - for (var t = 0; t < this.lensFlareSystems.length; t++) - if (this.lensFlareSystems[t].name === e) - return this.lensFlareSystems[t]; - return null + (r.a.prototype.getLensFlareSystemByID = function (e) { + for (var t = 0; t < this.lensFlareSystems.length; t++) + if (this.lensFlareSystems[t].id === e) + return this.lensFlareSystems[t]; + return null; + }), + (r.a.prototype.removeLensFlareSystem = function (e) { + var t = this.lensFlareSystems.indexOf(e); + return -1 !== t && this.lensFlareSystems.splice(t, 1), t; + }), + (r.a.prototype.addLensFlareSystem = function (e) { + this.lensFlareSystems.push(e); + }); + var Ur = (function () { + function e(e) { + (this.name = Se.a.NAME_LENSFLARESYSTEM), + (this.scene = e), + (e.lensFlareSystems = new Array()); } - , - r.a.prototype.getLensFlareSystemByID = function(e) { - for (var t = 0; t < this.lensFlareSystems.length; t++) - if (this.lensFlareSystems[t].id === e) - return this.lensFlareSystems[t]; - return null + return ( + (e.prototype.register = function () { + this.scene._afterCameraDrawStage.registerStep( + Se.a.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM, + this, + this._draw + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.addFromContainer = function (e) { + var t = this; + e.lensFlareSystems && + e.lensFlareSystems.forEach(function (e) { + t.scene.addLensFlareSystem(e); + }); + }), + (e.prototype.removeFromContainer = function (e, t) { + var i = this; + e.lensFlareSystems && + e.lensFlareSystems.forEach(function (e) { + i.scene.removeLensFlareSystem(e), t && e.dispose(); + }); + }), + (e.prototype.serialize = function (e) { + e.lensFlareSystems = []; + for ( + var t = 0, i = this.scene.lensFlareSystems; + t < i.length; + t++ + ) { + var n = i[t]; + e.lensFlareSystems.push(n.serialize()); + } + }), + (e.prototype.dispose = function () { + for (var e = this.scene.lensFlareSystems; e.length; ) + e[0].dispose(); + }), + (e.prototype._draw = function (e) { + if (this.scene.lensFlaresEnabled) { + var t = this.scene.lensFlareSystems; + Ee.h.StartPerformanceCounter("Lens flares", t.length > 0); + for (var i = 0, n = t; i < n.length; i++) { + var r = n[i]; + 0 != (e.layerMask & r.layerMask) && r.render(); + } + Ee.h.EndPerformanceCounter("Lens flares", t.length > 0); + } + }), + e + ); + })(); + kr._SceneComponentInitialization = function (e) { + var t = e._getComponent(Se.a.NAME_LENSFLARESYSTEM); + t || ((t = new Ur(e)), e._addComponent(t)); + }; + Ht.a.ShadersStore.shadowMapPixelShader = + "#ifndef FLOAT\nvec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n#endif\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nfloat depth=vDepthMetric;\n#ifdef ESM\ndepth=clamp(exp(-min(87.,biasAndScale.z*depth)),0.,1.);\n#endif\n#ifdef FLOAT\ngl_FragColor=vec4(depth,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depth);\n#endif\n}"; + Ht.a.ShadersStore.shadowMapVertexShader = + "\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\nuniform vec3 lightData;\n#endif\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n\n#include\n#include\nuniform mat4 viewProjection;\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvec3 worldNor=normalize(normalWorld*normal);\n#ifdef DIRECTIONINLIGHTDATA\nvec3 worldLightDir=normalize(-lightData.xyz);\n#else\nvec3 directionToLight=lightData.xyz-worldPos.xyz;\nvec3 worldLightDir=normalize(directionToLight);\n#endif\nfloat ndl=dot(worldNor,worldLightDir);\nfloat sinNL=sqrt(1.0-ndl*ndl);\nfloat normalBias=biasAndScale.y*sinNL;\nworldPos.xyz-=worldNor*normalBias;\n#endif\n\ngl_Position=viewProjection*worldPos;\n#ifdef DEPTHTEXTURE\n\ngl_Position.z+=biasAndScale.x*gl_Position.w;\n#endif\n\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y))+biasAndScale.x;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"; + Ht.a.ShadersStore.depthBoxBlurPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}"; + var Vr = (function () { + function e(t, i, n) { + (this.onBeforeShadowMapRenderObservable = new o.c()), + (this.onBeforeShadowMapRenderMeshObservable = new o.c()), + (this._bias = 5e-5), + (this._normalBias = 0), + (this._blurBoxOffset = 1), + (this._blurScale = 2), + (this._blurKernel = 1), + (this._useKernelBlur = false), + (this._filter = e.FILTER_NONE), + (this._filteringQuality = e.QUALITY_HIGH), + (this._contactHardeningLightSizeUVRatio = 0.1), + (this._darkness = 0), + (this._transparencyShadow = false), + (this.frustumEdgeFalloff = 0), + (this.forceBackFacesOnly = false), + (this._lightDirection = a.x.Zero()), + (this._viewMatrix = a.j.Zero()), + (this._projectionMatrix = a.j.Zero()), + (this._transformMatrix = a.j.Zero()), + (this._cachedPosition = new a.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )), + (this._cachedDirection = new a.x( + Number.MAX_VALUE, + Number.MAX_VALUE, + Number.MAX_VALUE + )), + (this._currentFaceIndex = 0), + (this._currentFaceIndexCache = 0), + (this._defaultTextureMatrix = a.j.Identity()), + (this._mapSize = t), + (this._light = i), + (this._scene = i.getScene()), + (i._shadowGenerator = this), + e._SceneComponentInitialization(this._scene); + var r = this._scene.getEngine().getCaps(); + n + ? r.textureFloatRender && r.textureFloatLinearFiltering + ? (this._textureType = _.a.TEXTURETYPE_FLOAT) + : r.textureHalfFloatRender && + r.textureHalfFloatLinearFiltering + ? (this._textureType = _.a.TEXTURETYPE_HALF_FLOAT) + : (this._textureType = _.a.TEXTURETYPE_UNSIGNED_INT) + : r.textureHalfFloatRender && + r.textureHalfFloatLinearFiltering + ? (this._textureType = _.a.TEXTURETYPE_HALF_FLOAT) + : r.textureFloatRender && r.textureFloatLinearFiltering + ? (this._textureType = _.a.TEXTURETYPE_FLOAT) + : (this._textureType = _.a.TEXTURETYPE_UNSIGNED_INT), + this._initializeGenerator(), + this._applyFilterValues(); } - , - r.a.prototype.removeLensFlareSystem = function(e) { - var t = this.lensFlareSystems.indexOf(e); - return -1 !== t && this.lensFlareSystems.splice(t, 1), - t - } - , - r.a.prototype.addLensFlareSystem = function(e) { - this.lensFlareSystems.push(e) - } - ; - var Ur = function() { - function e(e) { - this.name = Se.a.NAME_LENSFLARESYSTEM, - this.scene = e, - e.lensFlareSystems = new Array + return ( + Object.defineProperty(e.prototype, "bias", { + get: function () { + return this._bias; + }, + set: function (e) { + this._bias = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "normalBias", { + get: function () { + return this._normalBias; + }, + set: function (e) { + this._normalBias = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "blurBoxOffset", { + get: function () { + return this._blurBoxOffset; + }, + set: function (e) { + this._blurBoxOffset !== e && + ((this._blurBoxOffset = e), + this._disposeBlurPostProcesses()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "blurScale", { + get: function () { + return this._blurScale; + }, + set: function (e) { + this._blurScale !== e && + ((this._blurScale = e), + this._disposeBlurPostProcesses()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "blurKernel", { + get: function () { + return this._blurKernel; + }, + set: function (e) { + this._blurKernel !== e && + ((this._blurKernel = e), + this._disposeBlurPostProcesses()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "useKernelBlur", { + get: function () { + return this._useKernelBlur; + }, + set: function (e) { + this._useKernelBlur !== e && + ((this._useKernelBlur = e), + this._disposeBlurPostProcesses()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "depthScale", { + get: function () { + return void 0 !== this._depthScale + ? this._depthScale + : this._light.getDepthScale(); + }, + set: function (e) { + this._depthScale = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "filter", { + get: function () { + return this._filter; + }, + set: function (t) { + if (this._light.needCube()) { + if (t === e.FILTER_BLUREXPONENTIALSHADOWMAP) + return void (this.useExponentialShadowMap = true); + if (t === e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) + return void (this.useCloseExponentialShadowMap = true); + if (t === e.FILTER_PCF || t === e.FILTER_PCSS) + return void (this.usePoissonSampling = true); + } + (t !== e.FILTER_PCF && t !== e.FILTER_PCSS) || + 1 !== this._scene.getEngine().webGLVersion + ? this._filter !== t && + ((this._filter = t), + this._disposeBlurPostProcesses(), + this._applyFilterValues(), + this._light._markMeshesAsLightDirty()) + : (this.usePoissonSampling = true); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "usePoissonSampling", { + get: function () { + return this.filter === e.FILTER_POISSONSAMPLING; + }, + set: function (t) { + (t || this.filter === e.FILTER_POISSONSAMPLING) && + (this.filter = t + ? e.FILTER_POISSONSAMPLING + : e.FILTER_NONE); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "useExponentialShadowMap", + { + get: function () { + return this.filter === e.FILTER_EXPONENTIALSHADOWMAP; + }, + set: function (t) { + (t || this.filter === e.FILTER_EXPONENTIALSHADOWMAP) && + (this.filter = t + ? e.FILTER_EXPONENTIALSHADOWMAP + : e.FILTER_NONE); + }, + enumerable: true, + configurable: true, } - return e.prototype.register = function() { - this.scene._afterCameraDrawStage.registerStep(Se.a.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM, this, this._draw) + ), + Object.defineProperty( + e.prototype, + "useBlurExponentialShadowMap", + { + get: function () { + return ( + this.filter === e.FILTER_BLUREXPONENTIALSHADOWMAP + ); + }, + set: function (t) { + (t || + this.filter === e.FILTER_BLUREXPONENTIALSHADOWMAP) && + (this.filter = t + ? e.FILTER_BLUREXPONENTIALSHADOWMAP + : e.FILTER_NONE); + }, + enumerable: true, + configurable: true, } - , - e.prototype.rebuild = function() {} - , - e.prototype.addFromContainer = function(e) { - var t = this; - e.lensFlareSystems && e.lensFlareSystems.forEach(function(e) { - t.scene.addLensFlareSystem(e) - }) + ), + Object.defineProperty( + e.prototype, + "useCloseExponentialShadowMap", + { + get: function () { + return ( + this.filter === e.FILTER_CLOSEEXPONENTIALSHADOWMAP + ); + }, + set: function (t) { + (t || + this.filter === e.FILTER_CLOSEEXPONENTIALSHADOWMAP) && + (this.filter = t + ? e.FILTER_CLOSEEXPONENTIALSHADOWMAP + : e.FILTER_NONE); + }, + enumerable: true, + configurable: true, } - , - e.prototype.removeFromContainer = function(e, t) { - var i = this; - e.lensFlareSystems && e.lensFlareSystems.forEach(function(e) { - i.scene.removeLensFlareSystem(e), - t && e.dispose() - }) + ), + Object.defineProperty( + e.prototype, + "useBlurCloseExponentialShadowMap", + { + get: function () { + return ( + this.filter === e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP + ); + }, + set: function (t) { + (t || + this.filter === + e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) && + (this.filter = t + ? e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP + : e.FILTER_NONE); + }, + enumerable: true, + configurable: true, } - , - e.prototype.serialize = function(e) { - e.lensFlareSystems = []; - for (var t = 0, i = this.scene.lensFlareSystems; t < i.length; t++) { - var n = i[t]; - e.lensFlareSystems.push(n.serialize()) + ), + Object.defineProperty( + e.prototype, + "usePercentageCloserFiltering", + { + get: function () { + return this.filter === e.FILTER_PCF; + }, + set: function (t) { + (t || this.filter === e.FILTER_PCF) && + (this.filter = t ? e.FILTER_PCF : e.FILTER_NONE); + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty(e.prototype, "filteringQuality", { + get: function () { + return this._filteringQuality; + }, + set: function (e) { + this._filteringQuality = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "useContactHardeningShadow", + { + get: function () { + return this.filter === e.FILTER_PCSS; + }, + set: function (t) { + (t || this.filter === e.FILTER_PCSS) && + (this.filter = t ? e.FILTER_PCSS : e.FILTER_NONE); + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "contactHardeningLightSizeUVRatio", + { + get: function () { + return this._contactHardeningLightSizeUVRatio; + }, + set: function (e) { + this._contactHardeningLightSizeUVRatio = e; + }, + enumerable: true, + configurable: true, + } + ), + (e.prototype.getDarkness = function () { + return this._darkness; + }), + (e.prototype.setDarkness = function (e) { + return (this._darkness = e >= 1 ? 1 : e <= 0 ? 0 : e), this; + }), + (e.prototype.setTransparencyShadow = function (e) { + return (this._transparencyShadow = e), this; + }), + (e.prototype.getShadowMap = function () { + return this._shadowMap; + }), + (e.prototype.getShadowMapForRendering = function () { + return this._shadowMap2 + ? this._shadowMap2 + : this._shadowMap; + }), + (e.prototype.addShadowCaster = function (e, t) { + var i; + return ( + void 0 === t && (t = true), + this._shadowMap + ? (this._shadowMap.renderList || + (this._shadowMap.renderList = []), + this._shadowMap.renderList.push(e), + t && + (i = this._shadowMap.renderList).push.apply( + i, + e.getChildMeshes() + ), + this) + : this + ); + }), + (e.prototype.removeShadowCaster = function (e, t) { + if ( + (void 0 === t && (t = true), + !this._shadowMap || !this._shadowMap.renderList) + ) + return this; + var i = this._shadowMap.renderList.indexOf(e); + if ( + (-1 !== i && this._shadowMap.renderList.splice(i, 1), t) + ) + for (var n = 0, r = e.getChildren(); n < r.length; n++) { + var o = r[n]; + this.removeShadowCaster(o); + } + return this; + }), + (e.prototype.getLight = function () { + return this._light; + }), + (e.prototype._initializeGenerator = function () { + this._light._markMeshesAsLightDirty(), + this._initializeShadowMap(); + }), + (e.prototype._initializeShadowMap = function () { + var t = this, + i = this._scene.getEngine(); + i.webGLVersion > 1 + ? ((this._shadowMap = new li( + this._light.name + "_shadowMap", + this._mapSize, + this._scene, + false, + true, + this._textureType, + this._light.needCube(), + void 0, + false, + false + )), + this._shadowMap.createDepthStencilTexture( + _.a.LESS, + true + )) + : (this._shadowMap = new li( + this._light.name + "_shadowMap", + this._mapSize, + this._scene, + false, + true, + this._textureType, + this._light.needCube() + )), + (this._shadowMap.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._shadowMap.wrapV = je.a.CLAMP_ADDRESSMODE), + (this._shadowMap.anisotropicFilteringLevel = 1), + this._shadowMap.updateSamplingMode( + je.a.BILINEAR_SAMPLINGMODE + ), + (this._shadowMap.renderParticles = false), + (this._shadowMap.ignoreCameraViewport = true), + this._shadowMap.onBeforeRenderObservable.add(function ( + n + ) { + (t._currentFaceIndex = n), + t._filter === e.FILTER_PCF && i.setColorWrite(false); + }), + (this._shadowMap.customRenderFunction = + this._renderForShadowMap.bind(this)), + this._shadowMap.onAfterUnbindObservable.add(function () { + if ( + (t._filter === e.FILTER_PCF && i.setColorWrite(true), + t.useBlurExponentialShadowMap || + t.useBlurCloseExponentialShadowMap) + ) { + var n = t.getShadowMapForRendering(); + n && + t._scene.postProcessManager.directRender( + t._blurPostProcesses, + n.getInternalTexture(), + true + ); } - } - , - e.prototype.dispose = function() { - for (var e = this.scene.lensFlareSystems; e.length; ) - e[0].dispose() - } - , - e.prototype._draw = function(e) { - if (this.scene.lensFlaresEnabled) { - var t = this.scene.lensFlareSystems; - Ee.h.StartPerformanceCounter("Lens flares", t.length > 0); - for (var i = 0, n = t; i < n.length; i++) { - var r = n[i]; - 0 != (e.layerMask & r.layerMask) && r.render() - } - Ee.h.EndPerformanceCounter("Lens flares", t.length > 0) - } - } - , - e - }(); - kr._SceneComponentInitialization = function(e) { - var t = e._getComponent(Se.a.NAME_LENSFLARESYSTEM); - t || (t = new Ur(e), - e._addComponent(t)) - } - ; - Ht.a.ShadersStore.shadowMapPixelShader = "#ifndef FLOAT\nvec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n#endif\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nfloat depth=vDepthMetric;\n#ifdef ESM\ndepth=clamp(exp(-min(87.,biasAndScale.z*depth)),0.,1.);\n#endif\n#ifdef FLOAT\ngl_FragColor=vec4(depth,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depth);\n#endif\n}"; - Ht.a.ShadersStore.shadowMapVertexShader = "\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\nuniform vec3 lightData;\n#endif\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n\n#include\n#include\nuniform mat4 viewProjection;\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvec3 worldNor=normalize(normalWorld*normal);\n#ifdef DIRECTIONINLIGHTDATA\nvec3 worldLightDir=normalize(-lightData.xyz);\n#else\nvec3 directionToLight=lightData.xyz-worldPos.xyz;\nvec3 worldLightDir=normalize(directionToLight);\n#endif\nfloat ndl=dot(worldNor,worldLightDir);\nfloat sinNL=sqrt(1.0-ndl*ndl);\nfloat normalBias=biasAndScale.y*sinNL;\nworldPos.xyz-=worldNor*normalBias;\n#endif\n\ngl_Position=viewProjection*worldPos;\n#ifdef DEPTHTEXTURE\n\ngl_Position.z+=biasAndScale.x*gl_Position.w;\n#endif\n\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y))+biasAndScale.x;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"; - Ht.a.ShadersStore.depthBoxBlurPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}"; - var Vr = function() { - function e(t, i, n) { - this.onBeforeShadowMapRenderObservable = new o.c, - this.onBeforeShadowMapRenderMeshObservable = new o.c, - this._bias = 5e-5, - this._normalBias = 0, - this._blurBoxOffset = 1, - this._blurScale = 2, - this._blurKernel = 1, - this._useKernelBlur = false, - this._filter = e.FILTER_NONE, - this._filteringQuality = e.QUALITY_HIGH, - this._contactHardeningLightSizeUVRatio = .1, - this._darkness = 0, - this._transparencyShadow = false, - this.frustumEdgeFalloff = 0, - this.forceBackFacesOnly = false, - this._lightDirection = a.x.Zero(), - this._viewMatrix = a.j.Zero(), - this._projectionMatrix = a.j.Zero(), - this._transformMatrix = a.j.Zero(), - this._cachedPosition = new a.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), - this._cachedDirection = new a.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE), - this._currentFaceIndex = 0, - this._currentFaceIndexCache = 0, - this._defaultTextureMatrix = a.j.Identity(), - this._mapSize = t, - this._light = i, - this._scene = i.getScene(), - i._shadowGenerator = this, - e._SceneComponentInitialization(this._scene); - var r = this._scene.getEngine().getCaps(); - n ? r.textureFloatRender && r.textureFloatLinearFiltering ? this._textureType = _.a.TEXTURETYPE_FLOAT : r.textureHalfFloatRender && r.textureHalfFloatLinearFiltering ? this._textureType = _.a.TEXTURETYPE_HALF_FLOAT : this._textureType = _.a.TEXTURETYPE_UNSIGNED_INT : r.textureHalfFloatRender && r.textureHalfFloatLinearFiltering ? this._textureType = _.a.TEXTURETYPE_HALF_FLOAT : r.textureFloatRender && r.textureFloatLinearFiltering ? this._textureType = _.a.TEXTURETYPE_FLOAT : this._textureType = _.a.TEXTURETYPE_UNSIGNED_INT, - this._initializeGenerator(), - this._applyFilterValues() - } - return Object.defineProperty(e.prototype, "bias", { - get: function() { - return this._bias - }, - set: function(e) { - this._bias = e - }, - enumerable: true, - configurable: true + }); + var n = new a.f(0, 0, 0, 0), + r = new a.f(1, 1, 1, 1); + this._shadowMap.onClearObservable.add(function (i) { + t._filter === e.FILTER_PCF + ? i.clear(r, false, true, false) + : t.useExponentialShadowMap || + t.useBlurExponentialShadowMap + ? i.clear(n, true, true, false) + : i.clear(r, true, true, false); + }); + }), + (e.prototype._initializeBlurRTTAndPostProcesses = + function () { + var e = this, + t = this._scene.getEngine(), + i = this._mapSize / this.blurScale; + (this.useKernelBlur && 1 === this.blurScale) || + ((this._shadowMap2 = new li( + this._light.name + "_shadowMap2", + i, + this._scene, + false, + true, + this._textureType + )), + (this._shadowMap2.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._shadowMap2.wrapV = je.a.CLAMP_ADDRESSMODE), + this._shadowMap2.updateSamplingMode( + je.a.BILINEAR_SAMPLINGMODE + )), + this.useKernelBlur + ? ((this._kernelBlurXPostprocess = new Hn( + this._light.name + "KernelBlurX", + new a.w(1, 0), + this.blurKernel, + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + t, + false, + this._textureType + )), + (this._kernelBlurXPostprocess.width = i), + (this._kernelBlurXPostprocess.height = i), + this._kernelBlurXPostprocess.onApplyObservable.add( + function (t) { + t.setTexture("textureSampler", e._shadowMap); + } + ), + (this._kernelBlurYPostprocess = new Hn( + this._light.name + "KernelBlurY", + new a.w(0, 1), + this.blurKernel, + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + t, + false, + this._textureType + )), + (this._kernelBlurXPostprocess.autoClear = false), + (this._kernelBlurYPostprocess.autoClear = false), + this._textureType === + _.a.TEXTURETYPE_UNSIGNED_INT && + ((this._kernelBlurXPostprocess.packedFloat = true), + (this._kernelBlurYPostprocess.packedFloat = true)), + (this._blurPostProcesses = [ + this._kernelBlurXPostprocess, + this._kernelBlurYPostprocess, + ])) + : ((this._boxBlurPostprocess = new Wt( + this._light.name + "DepthBoxBlur", + "depthBoxBlur", + ["screenSize", "boxOffset"], + [], + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + t, + false, + "#define OFFSET " + this._blurBoxOffset, + this._textureType + )), + this._boxBlurPostprocess.onApplyObservable.add( + function (t) { + t.setFloat2("screenSize", i, i), + t.setTexture("textureSampler", e._shadowMap); + } + ), + (this._boxBlurPostprocess.autoClear = false), + (this._blurPostProcesses = [ + this._boxBlurPostprocess, + ])); }), - Object.defineProperty(e.prototype, "normalBias", { - get: function() { - return this._normalBias - }, - set: function(e) { - this._normalBias = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "blurBoxOffset", { - get: function() { - return this._blurBoxOffset - }, - set: function(e) { - this._blurBoxOffset !== e && (this._blurBoxOffset = e, - this._disposeBlurPostProcesses()) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "blurScale", { - get: function() { - return this._blurScale - }, - set: function(e) { - this._blurScale !== e && (this._blurScale = e, - this._disposeBlurPostProcesses()) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "blurKernel", { - get: function() { - return this._blurKernel - }, - set: function(e) { - this._blurKernel !== e && (this._blurKernel = e, - this._disposeBlurPostProcesses()) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "useKernelBlur", { - get: function() { - return this._useKernelBlur - }, - set: function(e) { - this._useKernelBlur !== e && (this._useKernelBlur = e, - this._disposeBlurPostProcesses()) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "depthScale", { - get: function() { - return void 0 !== this._depthScale ? this._depthScale : this._light.getDepthScale() - }, - set: function(e) { - this._depthScale = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "filter", { - get: function() { - return this._filter - }, - set: function(t) { - if (this._light.needCube()) { - if (t === e.FILTER_BLUREXPONENTIALSHADOWMAP) - return void (this.useExponentialShadowMap = true); - if (t === e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) - return void (this.useCloseExponentialShadowMap = true); - if (t === e.FILTER_PCF || t === e.FILTER_PCSS) - return void (this.usePoissonSampling = true) - } - t !== e.FILTER_PCF && t !== e.FILTER_PCSS || 1 !== this._scene.getEngine().webGLVersion ? this._filter !== t && (this._filter = t, - this._disposeBlurPostProcesses(), - this._applyFilterValues(), - this._light._markMeshesAsLightDirty()) : this.usePoissonSampling = true - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "usePoissonSampling", { - get: function() { - return this.filter === e.FILTER_POISSONSAMPLING - }, - set: function(t) { - (t || this.filter === e.FILTER_POISSONSAMPLING) && (this.filter = t ? e.FILTER_POISSONSAMPLING : e.FILTER_NONE) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "useExponentialShadowMap", { - get: function() { - return this.filter === e.FILTER_EXPONENTIALSHADOWMAP - }, - set: function(t) { - (t || this.filter === e.FILTER_EXPONENTIALSHADOWMAP) && (this.filter = t ? e.FILTER_EXPONENTIALSHADOWMAP : e.FILTER_NONE) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "useBlurExponentialShadowMap", { - get: function() { - return this.filter === e.FILTER_BLUREXPONENTIALSHADOWMAP - }, - set: function(t) { - (t || this.filter === e.FILTER_BLUREXPONENTIALSHADOWMAP) && (this.filter = t ? e.FILTER_BLUREXPONENTIALSHADOWMAP : e.FILTER_NONE) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "useCloseExponentialShadowMap", { - get: function() { - return this.filter === e.FILTER_CLOSEEXPONENTIALSHADOWMAP - }, - set: function(t) { - (t || this.filter === e.FILTER_CLOSEEXPONENTIALSHADOWMAP) && (this.filter = t ? e.FILTER_CLOSEEXPONENTIALSHADOWMAP : e.FILTER_NONE) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "useBlurCloseExponentialShadowMap", { - get: function() { - return this.filter === e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP - }, - set: function(t) { - (t || this.filter === e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) && (this.filter = t ? e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP : e.FILTER_NONE) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "usePercentageCloserFiltering", { - get: function() { - return this.filter === e.FILTER_PCF - }, - set: function(t) { - (t || this.filter === e.FILTER_PCF) && (this.filter = t ? e.FILTER_PCF : e.FILTER_NONE) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "filteringQuality", { - get: function() { - return this._filteringQuality - }, - set: function(e) { - this._filteringQuality = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "useContactHardeningShadow", { - get: function() { - return this.filter === e.FILTER_PCSS - }, - set: function(t) { - (t || this.filter === e.FILTER_PCSS) && (this.filter = t ? e.FILTER_PCSS : e.FILTER_NONE) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "contactHardeningLightSizeUVRatio", { - get: function() { - return this._contactHardeningLightSizeUVRatio - }, - set: function(e) { - this._contactHardeningLightSizeUVRatio = e - }, - enumerable: true, - configurable: true - }), - e.prototype.getDarkness = function() { - return this._darkness + (e.prototype._renderForShadowMap = function (e, t, i, n) { + var r, + o = this._scene.getEngine(); + if (n.length) { + for (o.setColorWrite(false), r = 0; r < n.length; r++) + this._renderSubMeshForShadowMap(n.data[r]); + o.setColorWrite(true); } - , - e.prototype.setDarkness = function(e) { - return this._darkness = e >= 1 ? 1 : e <= 0 ? 0 : e, - this - } - , - e.prototype.setTransparencyShadow = function(e) { - return this._transparencyShadow = e, - this - } - , - e.prototype.getShadowMap = function() { - return this._shadowMap - } - , - e.prototype.getShadowMapForRendering = function() { - return this._shadowMap2 ? this._shadowMap2 : this._shadowMap - } - , - e.prototype.addShadowCaster = function(e, t) { - var i; - return void 0 === t && (t = true), - this._shadowMap ? (this._shadowMap.renderList || (this._shadowMap.renderList = []), - this._shadowMap.renderList.push(e), - t && (i = this._shadowMap.renderList).push.apply(i, e.getChildMeshes()), - this) : this - } - , - e.prototype.removeShadowCaster = function(e, t) { - if (void 0 === t && (t = true), - !this._shadowMap || !this._shadowMap.renderList) - return this; - var i = this._shadowMap.renderList.indexOf(e); - if (-1 !== i && this._shadowMap.renderList.splice(i, 1), - t) - for (var n = 0, r = e.getChildren(); n < r.length; n++) { - var o = r[n]; - this.removeShadowCaster(o) - } - return this - } - , - e.prototype.getLight = function() { - return this._light - } - , - e.prototype._initializeGenerator = function() { - this._light._markMeshesAsLightDirty(), - this._initializeShadowMap() - } - , - e.prototype._initializeShadowMap = function() { - var t = this - , i = this._scene.getEngine(); - i.webGLVersion > 1 ? (this._shadowMap = new li(this._light.name + "_shadowMap",this._mapSize,this._scene,false,true,this._textureType,this._light.needCube(),void 0,false,false), - this._shadowMap.createDepthStencilTexture(_.a.LESS, true)) : this._shadowMap = new li(this._light.name + "_shadowMap",this._mapSize,this._scene,false,true,this._textureType,this._light.needCube()), - this._shadowMap.wrapU = je.a.CLAMP_ADDRESSMODE, - this._shadowMap.wrapV = je.a.CLAMP_ADDRESSMODE, - this._shadowMap.anisotropicFilteringLevel = 1, - this._shadowMap.updateSamplingMode(je.a.BILINEAR_SAMPLINGMODE), - this._shadowMap.renderParticles = false, - this._shadowMap.ignoreCameraViewport = true, - this._shadowMap.onBeforeRenderObservable.add(function(n) { - t._currentFaceIndex = n, - t._filter === e.FILTER_PCF && i.setColorWrite(false) - }), - this._shadowMap.customRenderFunction = this._renderForShadowMap.bind(this), - this._shadowMap.onAfterUnbindObservable.add(function() { - if (t._filter === e.FILTER_PCF && i.setColorWrite(true), - t.useBlurExponentialShadowMap || t.useBlurCloseExponentialShadowMap) { - var n = t.getShadowMapForRendering(); - n && t._scene.postProcessManager.directRender(t._blurPostProcesses, n.getInternalTexture(), true) - } - }); - var n = new a.f(0,0,0,0) - , r = new a.f(1,1,1,1); - this._shadowMap.onClearObservable.add(function(i) { - t._filter === e.FILTER_PCF ? i.clear(r, false, true, false) : t.useExponentialShadowMap || t.useBlurExponentialShadowMap ? i.clear(n, true, true, false) : i.clear(r, true, true, false) - }) - } - , - e.prototype._initializeBlurRTTAndPostProcesses = function() { - var e = this - , t = this._scene.getEngine() - , i = this._mapSize / this.blurScale; - this.useKernelBlur && 1 === this.blurScale || (this._shadowMap2 = new li(this._light.name + "_shadowMap2",i,this._scene,false,true,this._textureType), - this._shadowMap2.wrapU = je.a.CLAMP_ADDRESSMODE, - this._shadowMap2.wrapV = je.a.CLAMP_ADDRESSMODE, - this._shadowMap2.updateSamplingMode(je.a.BILINEAR_SAMPLINGMODE)), - this.useKernelBlur ? (this._kernelBlurXPostprocess = new Hn(this._light.name + "KernelBlurX",new a.w(1,0),this.blurKernel,1,null,je.a.BILINEAR_SAMPLINGMODE,t,false,this._textureType), - this._kernelBlurXPostprocess.width = i, - this._kernelBlurXPostprocess.height = i, - this._kernelBlurXPostprocess.onApplyObservable.add(function(t) { - t.setTexture("textureSampler", e._shadowMap) - }), - this._kernelBlurYPostprocess = new Hn(this._light.name + "KernelBlurY",new a.w(0,1),this.blurKernel,1,null,je.a.BILINEAR_SAMPLINGMODE,t,false,this._textureType), - this._kernelBlurXPostprocess.autoClear = false, - this._kernelBlurYPostprocess.autoClear = false, - this._textureType === _.a.TEXTURETYPE_UNSIGNED_INT && (this._kernelBlurXPostprocess.packedFloat = true, - this._kernelBlurYPostprocess.packedFloat = true), - this._blurPostProcesses = [this._kernelBlurXPostprocess, this._kernelBlurYPostprocess]) : (this._boxBlurPostprocess = new Wt(this._light.name + "DepthBoxBlur","depthBoxBlur",["screenSize", "boxOffset"],[],1,null,je.a.BILINEAR_SAMPLINGMODE,t,false,"#define OFFSET " + this._blurBoxOffset,this._textureType), - this._boxBlurPostprocess.onApplyObservable.add(function(t) { - t.setFloat2("screenSize", i, i), - t.setTexture("textureSampler", e._shadowMap) - }), - this._boxBlurPostprocess.autoClear = false, - this._blurPostProcesses = [this._boxBlurPostprocess]) - } - , - e.prototype._renderForShadowMap = function(e, t, i, n) { - var r, o = this._scene.getEngine(); - if (n.length) { - for (o.setColorWrite(false), - r = 0; r < n.length; r++) - this._renderSubMeshForShadowMap(n.data[r]); - o.setColorWrite(true) - } - for (r = 0; r < e.length; r++) - this._renderSubMeshForShadowMap(e.data[r]); - for (r = 0; r < t.length; r++) - this._renderSubMeshForShadowMap(t.data[r]); - if (this._transparencyShadow) - for (r = 0; r < i.length; r++) - this._renderSubMeshForShadowMap(i.data[r]) - } - , - e.prototype._renderSubMeshForShadowMap = function(e) { - var t = this - , i = e.getRenderingMesh() - , n = this._scene - , r = n.getEngine() - , o = e.getMaterial(); - if (i._internalAbstractMeshDataInfo._isActiveIntermediate = false, - o && 0 !== e.verticesCount) { - r.setState(o.backFaceCulling); - var a = i._getInstancesRenderList(e._id); - if (!a.mustReturn) { - var s = r.getCaps().instancedArrays && null !== a.visibleInstances[e._id] && void 0 !== a.visibleInstances[e._id]; - if (this.isReady(e, s)) { - if (r.enableEffect(this._effect), - i._bind(e, this._effect, Mr.a.TriangleFillMode), - this._effect.setFloat3("biasAndScale", this.bias, this.normalBias, this.depthScale), - this._effect.setMatrix("viewProjection", this.getTransformMatrix()), - this.getLight().getTypeID() === Nn.a.LIGHTTYPEID_DIRECTIONALLIGHT ? this._effect.setVector3("lightData", this._cachedDirection) : this._effect.setVector3("lightData", this._cachedPosition), - n.activeCamera && this._effect.setFloat2("depthValues", this.getLight().getDepthMinZ(n.activeCamera), this.getLight().getDepthMinZ(n.activeCamera) + this.getLight().getDepthMaxZ(n.activeCamera)), - o && o.needAlphaTesting()) { - var c = o.getAlphaTestTexture(); - c && (this._effect.setTexture("diffuseSampler", c), - this._effect.setMatrix("diffuseMatrix", c.getTextureMatrix() || this._defaultTextureMatrix)) - } - if (i.useBones && i.computeBonesUsingShaders && i.skeleton) { - var u = i.skeleton; - if (u.isUsingTextureForMatrices) { - var l = u.getTransformMatrixTexture(); - if (!l) - return; - this._effect.setTexture("boneSampler", l), - this._effect.setFloat("boneTextureWidth", 4 * (u.bones.length + 1)) - } else - this._effect.setMatrices("mBones", u.getTransformMatrices(i)) - } - Yn.a.BindMorphTargetParameters(i, this._effect), - this.forceBackFacesOnly && r.setState(true, 0, false, true), - this.onBeforeShadowMapRenderMeshObservable.notifyObservers(i), - this.onBeforeShadowMapRenderObservable.notifyObservers(this._effect), - i._processRendering(e, this._effect, Mr.a.TriangleFillMode, a, s, function(e, i) { - return t._effect.setMatrix("world", i) - }), - this.forceBackFacesOnly && r.setState(true, 0, false, false) - } else - this._shadowMap && this._shadowMap.resetRefreshCounter() - } - } - } - , - e.prototype._applyFilterValues = function() { - this._shadowMap && (this.filter === e.FILTER_NONE || this.filter === e.FILTER_PCSS ? this._shadowMap.updateSamplingMode(je.a.NEAREST_SAMPLINGMODE) : this._shadowMap.updateSamplingMode(je.a.BILINEAR_SAMPLINGMODE)) - } - , - e.prototype.forceCompilation = function(e, t) { - var i = this - , n = h.a({ - useInstances: false - }, t) - , r = this.getShadowMap(); - if (r) { - var o = r.renderList; - if (o) { - for (var a = new Array, s = 0, c = o; s < c.length; s++) { - var u = c[s]; - a.push.apply(a, u.subMeshes) - } - if (0 !== a.length) { - var l = 0; - !function t() { - if (i._scene && i._scene.getEngine()) { - for (; i.isReady(a[l], n.useInstances); ) - if (++l >= a.length) - return void (e && e(i)); - setTimeout(t, 16) - } - }() - } else - e && e(this) + for (r = 0; r < e.length; r++) + this._renderSubMeshForShadowMap(e.data[r]); + for (r = 0; r < t.length; r++) + this._renderSubMeshForShadowMap(t.data[r]); + if (this._transparencyShadow) + for (r = 0; r < i.length; r++) + this._renderSubMeshForShadowMap(i.data[r]); + }), + (e.prototype._renderSubMeshForShadowMap = function (e) { + var t = this, + i = e.getRenderingMesh(), + n = this._scene, + r = n.getEngine(), + o = e.getMaterial(); + if ( + ((i._internalAbstractMeshDataInfo._isActiveIntermediate = false), + o && 0 !== e.verticesCount) + ) { + r.setState(o.backFaceCulling); + var a = i._getInstancesRenderList(e._id); + if (!a.mustReturn) { + var s = + r.getCaps().instancedArrays && + null !== a.visibleInstances[e._id] && + void 0 !== a.visibleInstances[e._id]; + if (this.isReady(e, s)) { + if ( + (r.enableEffect(this._effect), + i._bind(e, this._effect, Mr.a.TriangleFillMode), + this._effect.setFloat3( + "biasAndScale", + this.bias, + this.normalBias, + this.depthScale + ), + this._effect.setMatrix( + "viewProjection", + this.getTransformMatrix() + ), + this.getLight().getTypeID() === + Nn.a.LIGHTTYPEID_DIRECTIONALLIGHT + ? this._effect.setVector3( + "lightData", + this._cachedDirection + ) + : this._effect.setVector3( + "lightData", + this._cachedPosition + ), + n.activeCamera && + this._effect.setFloat2( + "depthValues", + this.getLight().getDepthMinZ(n.activeCamera), + this.getLight().getDepthMinZ(n.activeCamera) + + this.getLight().getDepthMaxZ(n.activeCamera) + ), + o && o.needAlphaTesting()) + ) { + var c = o.getAlphaTestTexture(); + c && + (this._effect.setTexture("diffuseSampler", c), + this._effect.setMatrix( + "diffuseMatrix", + c.getTextureMatrix() || + this._defaultTextureMatrix + )); + } + if ( + i.useBones && + i.computeBonesUsingShaders && + i.skeleton + ) { + var u = i.skeleton; + if (u.isUsingTextureForMatrices) { + var l = u.getTransformMatrixTexture(); + if (!l) return; + this._effect.setTexture("boneSampler", l), + this._effect.setFloat( + "boneTextureWidth", + 4 * (u.bones.length + 1) + ); } else - e && e(this) + this._effect.setMatrices( + "mBones", + u.getTransformMatrices(i) + ); + } + Yn.a.BindMorphTargetParameters(i, this._effect), + this.forceBackFacesOnly && + r.setState(true, 0, false, true), + this.onBeforeShadowMapRenderMeshObservable.notifyObservers( + i + ), + this.onBeforeShadowMapRenderObservable.notifyObservers( + this._effect + ), + i._processRendering( + e, + this._effect, + Mr.a.TriangleFillMode, + a, + s, + function (e, i) { + return t._effect.setMatrix("world", i); + } + ), + this.forceBackFacesOnly && + r.setState(true, 0, false, false); } else - e && e(this) + this._shadowMap && + this._shadowMap.resetRefreshCounter(); + } } - , - e.prototype.forceCompilationAsync = function(e) { - var t = this; - return new i(function(i) { - t.forceCompilation(function() { - i() - }, e) + }), + (e.prototype._applyFilterValues = function () { + this._shadowMap && + (this.filter === e.FILTER_NONE || + this.filter === e.FILTER_PCSS + ? this._shadowMap.updateSamplingMode( + je.a.NEAREST_SAMPLINGMODE + ) + : this._shadowMap.updateSamplingMode( + je.a.BILINEAR_SAMPLINGMODE + )); + }), + (e.prototype.forceCompilation = function (e, t) { + var i = this, + n = h.a( + { + useInstances: false, + }, + t + ), + r = this.getShadowMap(); + if (r) { + var o = r.renderList; + if (o) { + for ( + var a = new Array(), s = 0, c = o; + s < c.length; + s++ + ) { + var u = c[s]; + a.push.apply(a, u.subMeshes); } - ) - } - , - e.prototype.isReady = function(e, t) { - var i = []; - this._textureType !== _.a.TEXTURETYPE_UNSIGNED_INT && i.push("#define FLOAT"), - this.useExponentialShadowMap || this.useBlurExponentialShadowMap ? i.push("#define ESM") : (this.usePercentageCloserFiltering || this.useContactHardeningShadow) && i.push("#define DEPTHTEXTURE"); - var n = [Si.b.PositionKind] - , r = e.getMesh() - , o = e.getMaterial(); - if (this.normalBias && r.isVerticesDataPresent(Si.b.NormalKind) && (n.push(Si.b.NormalKind), + if (0 !== a.length) { + var l = 0; + !(function t() { + if (i._scene && i._scene.getEngine()) { + for (; i.isReady(a[l], n.useInstances); ) + if (++l >= a.length) return void (e && e(i)); + setTimeout(t, 16); + } + })(); + } else e && e(this); + } else e && e(this); + } else e && e(this); + }), + (e.prototype.forceCompilationAsync = function (e) { + var t = this; + return new i(function (i) { + t.forceCompilation(function () { + i(); + }, e); + }); + }), + (e.prototype.isReady = function (e, t) { + var i = []; + this._textureType !== _.a.TEXTURETYPE_UNSIGNED_INT && + i.push("#define FLOAT"), + this.useExponentialShadowMap || + this.useBlurExponentialShadowMap + ? i.push("#define ESM") + : (this.usePercentageCloserFiltering || + this.useContactHardeningShadow) && + i.push("#define DEPTHTEXTURE"); + var n = [Si.b.PositionKind], + r = e.getMesh(), + o = e.getMaterial(); + if ( + (this.normalBias && + r.isVerticesDataPresent(Si.b.NormalKind) && + (n.push(Si.b.NormalKind), i.push("#define NORMAL"), - r.nonUniformScaling && i.push("#define NONUNIFORMSCALING"), - this.getLight().getTypeID() === Nn.a.LIGHTTYPEID_DIRECTIONALLIGHT && i.push("#define DIRECTIONINLIGHTDATA")), - o && o.needAlphaTesting()) { - var a = o.getAlphaTestTexture(); - a && (i.push("#define ALPHATEST"), - r.isVerticesDataPresent(Si.b.UVKind) && (n.push(Si.b.UVKind), - i.push("#define UV1")), - r.isVerticesDataPresent(Si.b.UV2Kind) && 1 === a.coordinatesIndex && (n.push(Si.b.UV2Kind), - i.push("#define UV2"))) - } - if (r.useBones && r.computeBonesUsingShaders && r.skeleton) { - n.push(Si.b.MatricesIndicesKind), - n.push(Si.b.MatricesWeightsKind), - r.numBoneInfluencers > 4 && (n.push(Si.b.MatricesIndicesExtraKind), - n.push(Si.b.MatricesWeightsExtraKind)); - var s = r.skeleton; - i.push("#define NUM_BONE_INFLUENCERS " + r.numBoneInfluencers), - s.isUsingTextureForMatrices ? i.push("#define BONETEXTURE") : i.push("#define BonesPerMesh " + (s.bones.length + 1)) - } else - i.push("#define NUM_BONE_INFLUENCERS 0"); - var c = r.morphTargetManager - , u = 0; - if (c && c.numInfluencers > 0 && (i.push("#define MORPHTARGETS"), - u = c.numInfluencers, + r.nonUniformScaling && + i.push("#define NONUNIFORMSCALING"), + this.getLight().getTypeID() === + Nn.a.LIGHTTYPEID_DIRECTIONALLIGHT && + i.push("#define DIRECTIONINLIGHTDATA")), + o && o.needAlphaTesting()) + ) { + var a = o.getAlphaTestTexture(); + a && + (i.push("#define ALPHATEST"), + r.isVerticesDataPresent(Si.b.UVKind) && + (n.push(Si.b.UVKind), i.push("#define UV1")), + r.isVerticesDataPresent(Si.b.UV2Kind) && + 1 === a.coordinatesIndex && + (n.push(Si.b.UV2Kind), i.push("#define UV2"))); + } + if ( + r.useBones && + r.computeBonesUsingShaders && + r.skeleton + ) { + n.push(Si.b.MatricesIndicesKind), + n.push(Si.b.MatricesWeightsKind), + r.numBoneInfluencers > 4 && + (n.push(Si.b.MatricesIndicesExtraKind), + n.push(Si.b.MatricesWeightsExtraKind)); + var s = r.skeleton; + i.push( + "#define NUM_BONE_INFLUENCERS " + r.numBoneInfluencers + ), + s.isUsingTextureForMatrices + ? i.push("#define BONETEXTURE") + : i.push( + "#define BonesPerMesh " + (s.bones.length + 1) + ); + } else i.push("#define NUM_BONE_INFLUENCERS 0"); + var c = r.morphTargetManager, + u = 0; + if ( + (c && + c.numInfluencers > 0 && + (i.push("#define MORPHTARGETS"), + (u = c.numInfluencers), i.push("#define NUM_MORPH_INFLUENCERS " + u), Yn.a.PrepareAttributesForMorphTargets(n, r, { - NUM_MORPH_INFLUENCERS: u + NUM_MORPH_INFLUENCERS: u, })), - t && (i.push("#define INSTANCES"), + t && + (i.push("#define INSTANCES"), n.push("world0"), n.push("world1"), n.push("world2"), n.push("world3")), - this.customShaderOptions && this.customShaderOptions.defines) - for (var l = 0, h = this.customShaderOptions.defines; l < h.length; l++) { - var f = h[l]; - -1 === i.indexOf(f) && i.push(f) - } - var d = i.join("\n"); - if (this._cachedDefines !== d) { - this._cachedDefines = d; - var p = "shadowMap" - , m = ["world", "mBones", "viewProjection", "diffuseMatrix", "lightData", "depthValues", "biasAndScale", "morphTargetInfluences", "boneTextureWidth"] - , g = ["diffuseSampler", "boneSampler"]; - if (this.customShaderOptions) { - if (p = this.customShaderOptions.shaderName, - this.customShaderOptions.attributes) - for (var v = 0, y = this.customShaderOptions.attributes; v < y.length; v++) { - var b = y[v]; - -1 === n.indexOf(b) && n.push(b) - } - if (this.customShaderOptions.uniforms) - for (var E = 0, T = this.customShaderOptions.uniforms; E < T.length; E++) { - var A = T[E]; - -1 === m.indexOf(A) && m.push(A) - } - if (this.customShaderOptions.samplers) - for (var x = 0, S = this.customShaderOptions.samplers; x < S.length; x++) { - var C = S[x]; - -1 === g.indexOf(C) && g.push(C) - } - } - this._effect = this._scene.getEngine().createEffect(p, n, m, g, d, void 0, void 0, void 0, { - maxSimultaneousMorphTargets: u - }) - } - return !(!this._effect.isReady() || ((this.useBlurExponentialShadowMap || this.useBlurCloseExponentialShadowMap) && (this._blurPostProcesses && this._blurPostProcesses.length || this._initializeBlurRTTAndPostProcesses()), - this._kernelBlurXPostprocess && !this._kernelBlurXPostprocess.isReady() || this._kernelBlurYPostprocess && !this._kernelBlurYPostprocess.isReady() || this._boxBlurPostprocess && !this._boxBlurPostprocess.isReady())) + this.customShaderOptions && + this.customShaderOptions.defines) + ) + for ( + var l = 0, h = this.customShaderOptions.defines; + l < h.length; + l++ + ) { + var f = h[l]; + -1 === i.indexOf(f) && i.push(f); + } + var d = i.join("\n"); + if (this._cachedDefines !== d) { + this._cachedDefines = d; + var p = "shadowMap", + m = [ + "world", + "mBones", + "viewProjection", + "diffuseMatrix", + "lightData", + "depthValues", + "biasAndScale", + "morphTargetInfluences", + "boneTextureWidth", + ], + g = ["diffuseSampler", "boneSampler"]; + if (this.customShaderOptions) { + if ( + ((p = this.customShaderOptions.shaderName), + this.customShaderOptions.attributes) + ) + for ( + var v = 0, y = this.customShaderOptions.attributes; + v < y.length; + v++ + ) { + var b = y[v]; + -1 === n.indexOf(b) && n.push(b); + } + if (this.customShaderOptions.uniforms) + for ( + var E = 0, T = this.customShaderOptions.uniforms; + E < T.length; + E++ + ) { + var A = T[E]; + -1 === m.indexOf(A) && m.push(A); + } + if (this.customShaderOptions.samplers) + for ( + var x = 0, S = this.customShaderOptions.samplers; + x < S.length; + x++ + ) { + var C = S[x]; + -1 === g.indexOf(C) && g.push(C); + } + } + this._effect = this._scene + .getEngine() + .createEffect(p, n, m, g, d, void 0, void 0, void 0, { + maxSimultaneousMorphTargets: u, + }); } - , - e.prototype.prepareDefines = function(t, i) { - var n = this._scene - , r = this._light; - n.shadowsEnabled && r.shadowEnabled && (t["SHADOW" + i] = true, - this.useContactHardeningShadow && (t["SHADOWPCSS" + i] = true, - this._filteringQuality === e.QUALITY_LOW ? t["SHADOWLOWQUALITY" + i] = true : this._filteringQuality === e.QUALITY_MEDIUM && (t["SHADOWMEDIUMQUALITY" + i] = true)), - this.usePercentageCloserFiltering ? (t["SHADOWPCF" + i] = true, - this._filteringQuality === e.QUALITY_LOW ? t["SHADOWLOWQUALITY" + i] = true : this._filteringQuality === e.QUALITY_MEDIUM && (t["SHADOWMEDIUMQUALITY" + i] = true)) : this.usePoissonSampling ? t["SHADOWPOISSON" + i] = true : this.useExponentialShadowMap || this.useBlurExponentialShadowMap ? t["SHADOWESM" + i] = true : (this.useCloseExponentialShadowMap || this.useBlurCloseExponentialShadowMap) && (t["SHADOWCLOSEESM" + i] = true), - r.needCube() && (t["SHADOWCUBE" + i] = true)) + return !( + !this._effect.isReady() || + ((this.useBlurExponentialShadowMap || + this.useBlurCloseExponentialShadowMap) && + ((this._blurPostProcesses && + this._blurPostProcesses.length) || + this._initializeBlurRTTAndPostProcesses()), + (this._kernelBlurXPostprocess && + !this._kernelBlurXPostprocess.isReady()) || + (this._kernelBlurYPostprocess && + !this._kernelBlurYPostprocess.isReady()) || + (this._boxBlurPostprocess && + !this._boxBlurPostprocess.isReady())) + ); + }), + (e.prototype.prepareDefines = function (t, i) { + var n = this._scene, + r = this._light; + n.shadowsEnabled && + r.shadowEnabled && + ((t["SHADOW" + i] = true), + this.useContactHardeningShadow && + ((t["SHADOWPCSS" + i] = true), + this._filteringQuality === e.QUALITY_LOW + ? (t["SHADOWLOWQUALITY" + i] = true) + : this._filteringQuality === e.QUALITY_MEDIUM && + (t["SHADOWMEDIUMQUALITY" + i] = true)), + this.usePercentageCloserFiltering + ? ((t["SHADOWPCF" + i] = true), + this._filteringQuality === e.QUALITY_LOW + ? (t["SHADOWLOWQUALITY" + i] = true) + : this._filteringQuality === e.QUALITY_MEDIUM && + (t["SHADOWMEDIUMQUALITY" + i] = true)) + : this.usePoissonSampling + ? (t["SHADOWPOISSON" + i] = true) + : this.useExponentialShadowMap || + this.useBlurExponentialShadowMap + ? (t["SHADOWESM" + i] = true) + : (this.useCloseExponentialShadowMap || + this.useBlurCloseExponentialShadowMap) && + (t["SHADOWCLOSEESM" + i] = true), + r.needCube() && (t["SHADOWCUBE" + i] = true)); + }), + (e.prototype.bindShadowLight = function (t, i) { + var n = this._light, + r = this._scene; + if (r.shadowsEnabled && n.shadowEnabled) { + var o = r.activeCamera; + if (o) { + var a = this.getShadowMap(); + a && + (n.needCube() || + i.setMatrix( + "lightMatrix" + t, + this.getTransformMatrix() + ), + this._filter === e.FILTER_PCF + ? (i.setDepthStencilTexture( + "shadowSampler" + t, + this.getShadowMapForRendering() + ), + n._uniformBuffer.updateFloat4( + "shadowsInfo", + this.getDarkness(), + a.getSize().width, + 1 / a.getSize().width, + this.frustumEdgeFalloff, + t + )) + : this._filter === e.FILTER_PCSS + ? (i.setDepthStencilTexture( + "shadowSampler" + t, + this.getShadowMapForRendering() + ), + i.setTexture( + "depthSampler" + t, + this.getShadowMapForRendering() + ), + n._uniformBuffer.updateFloat4( + "shadowsInfo", + this.getDarkness(), + 1 / a.getSize().width, + this._contactHardeningLightSizeUVRatio * + a.getSize().width, + this.frustumEdgeFalloff, + t + )) + : (i.setTexture( + "shadowSampler" + t, + this.getShadowMapForRendering() + ), + n._uniformBuffer.updateFloat4( + "shadowsInfo", + this.getDarkness(), + this.blurScale / a.getSize().width, + this.depthScale, + this.frustumEdgeFalloff, + t + )), + n._uniformBuffer.updateFloat2( + "depthValues", + this.getLight().getDepthMinZ(o), + this.getLight().getDepthMinZ(o) + + this.getLight().getDepthMaxZ(o), + t + )); + } } - , - e.prototype.bindShadowLight = function(t, i) { - var n = this._light - , r = this._scene; - if (r.shadowsEnabled && n.shadowEnabled) { - var o = r.activeCamera; - if (o) { - var a = this.getShadowMap(); - a && (n.needCube() || i.setMatrix("lightMatrix" + t, this.getTransformMatrix()), - this._filter === e.FILTER_PCF ? (i.setDepthStencilTexture("shadowSampler" + t, this.getShadowMapForRendering()), - n._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), a.getSize().width, 1 / a.getSize().width, this.frustumEdgeFalloff, t)) : this._filter === e.FILTER_PCSS ? (i.setDepthStencilTexture("shadowSampler" + t, this.getShadowMapForRendering()), - i.setTexture("depthSampler" + t, this.getShadowMapForRendering()), - n._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), 1 / a.getSize().width, this._contactHardeningLightSizeUVRatio * a.getSize().width, this.frustumEdgeFalloff, t)) : (i.setTexture("shadowSampler" + t, this.getShadowMapForRendering()), - n._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), this.blurScale / a.getSize().width, this.depthScale, this.frustumEdgeFalloff, t)), - n._uniformBuffer.updateFloat2("depthValues", this.getLight().getDepthMinZ(o), this.getLight().getDepthMinZ(o) + this.getLight().getDepthMaxZ(o), t)) - } - } + }), + (e.prototype.getTransformMatrix = function () { + var e = this._scene; + if ( + this._currentRenderID === e.getRenderId() && + this._currentFaceIndexCache === this._currentFaceIndex + ) + return this._transformMatrix; + (this._currentRenderID = e.getRenderId()), + (this._currentFaceIndexCache = this._currentFaceIndex); + var t = this._light.position; + if ( + (this._light.computeTransformedInformation() && + (t = this._light.transformedPosition), + a.x.NormalizeToRef( + this._light.getShadowDirection(this._currentFaceIndex), + this._lightDirection + ), + 1 === Math.abs(a.x.Dot(this._lightDirection, a.x.Up())) && + (this._lightDirection.z = 1e-13), + this._light.needProjectionMatrixCompute() || + !this._cachedPosition || + !this._cachedDirection || + !t.equals(this._cachedPosition) || + !this._lightDirection.equals(this._cachedDirection)) + ) { + this._cachedPosition.copyFrom(t), + this._cachedDirection.copyFrom(this._lightDirection), + a.j.LookAtLHToRef( + t, + t.add(this._lightDirection), + a.x.Up(), + this._viewMatrix + ); + var i = this.getShadowMap(); + if (i) { + var n = i.renderList; + n && + this._light.setShadowProjectionMatrix( + this._projectionMatrix, + this._viewMatrix, + n + ); + } + this._viewMatrix.multiplyToRef( + this._projectionMatrix, + this._transformMatrix + ); } - , - e.prototype.getTransformMatrix = function() { - var e = this._scene; - if (this._currentRenderID === e.getRenderId() && this._currentFaceIndexCache === this._currentFaceIndex) - return this._transformMatrix; - this._currentRenderID = e.getRenderId(), - this._currentFaceIndexCache = this._currentFaceIndex; - var t = this._light.position; - if (this._light.computeTransformedInformation() && (t = this._light.transformedPosition), - a.x.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex), this._lightDirection), - 1 === Math.abs(a.x.Dot(this._lightDirection, a.x.Up())) && (this._lightDirection.z = 1e-13), - this._light.needProjectionMatrixCompute() || !this._cachedPosition || !this._cachedDirection || !t.equals(this._cachedPosition) || !this._lightDirection.equals(this._cachedDirection)) { - this._cachedPosition.copyFrom(t), - this._cachedDirection.copyFrom(this._lightDirection), - a.j.LookAtLHToRef(t, t.add(this._lightDirection), a.x.Up(), this._viewMatrix); - var i = this.getShadowMap(); - if (i) { - var n = i.renderList; - n && this._light.setShadowProjectionMatrix(this._projectionMatrix, this._viewMatrix, n) - } - this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix) - } - return this._transformMatrix + return this._transformMatrix; + }), + (e.prototype.recreateShadowMap = function () { + var e = this._shadowMap; + if (e) { + var t = e.renderList; + this._disposeRTTandPostProcesses(), + this._initializeGenerator(), + (this.filter = this.filter), + this._applyFilterValues(), + (this._shadowMap.renderList = t); } - , - e.prototype.recreateShadowMap = function() { - var e = this._shadowMap; - if (e) { - var t = e.renderList; - this._disposeRTTandPostProcesses(), - this._initializeGenerator(), - this.filter = this.filter, - this._applyFilterValues(), - this._shadowMap.renderList = t - } - } - , - e.prototype._disposeBlurPostProcesses = function() { - this._shadowMap2 && (this._shadowMap2.dispose(), - this._shadowMap2 = null), - this._boxBlurPostprocess && (this._boxBlurPostprocess.dispose(), - this._boxBlurPostprocess = null), - this._kernelBlurXPostprocess && (this._kernelBlurXPostprocess.dispose(), - this._kernelBlurXPostprocess = null), - this._kernelBlurYPostprocess && (this._kernelBlurYPostprocess.dispose(), - this._kernelBlurYPostprocess = null), - this._blurPostProcesses = [] - } - , - e.prototype._disposeRTTandPostProcesses = function() { - this._shadowMap && (this._shadowMap.dispose(), - this._shadowMap = null), - this._disposeBlurPostProcesses() - } - , - e.prototype.dispose = function() { - this._disposeRTTandPostProcesses(), - this._light && (this._light._shadowGenerator = null, - this._light._markMeshesAsLightDirty()) - } - , - e.prototype.serialize = function() { - var e = {} - , t = this.getShadowMap(); - if (!t) - return e; - if (e.lightId = this._light.id, - e.mapSize = t.getRenderSize(), - e.useExponentialShadowMap = this.useExponentialShadowMap, - e.useBlurExponentialShadowMap = this.useBlurExponentialShadowMap, - e.useCloseExponentialShadowMap = this.useBlurExponentialShadowMap, - e.useBlurCloseExponentialShadowMap = this.useBlurExponentialShadowMap, - e.usePoissonSampling = this.usePoissonSampling, - e.forceBackFacesOnly = this.forceBackFacesOnly, - e.depthScale = this.depthScale, - e.darkness = this.getDarkness(), - e.blurBoxOffset = this.blurBoxOffset, - e.blurKernel = this.blurKernel, - e.blurScale = this.blurScale, - e.useKernelBlur = this.useKernelBlur, - e.transparencyShadow = this._transparencyShadow, - e.frustumEdgeFalloff = this.frustumEdgeFalloff, - e.bias = this.bias, - e.normalBias = this.normalBias, - e.usePercentageCloserFiltering = this.usePercentageCloserFiltering, - e.useContactHardeningShadow = this.useContactHardeningShadow, - e.filteringQuality = this.filteringQuality, - e.contactHardeningLightSizeUVRatio = this.contactHardeningLightSizeUVRatio, - e.renderList = [], - t.renderList) - for (var i = 0; i < t.renderList.length; i++) { - var n = t.renderList[i]; - e.renderList.push(n.id) - } - return e - } - , - e.Parse = function(t, i) { - for (var n = i.getLightByID(t.lightId), r = new e(t.mapSize,n), o = r.getShadowMap(), a = 0; a < t.renderList.length; a++) - i.getMeshesByID(t.renderList[a]).forEach(function(e) { - o && (o.renderList || (o.renderList = []), - o.renderList.push(e)) - }); - return t.usePoissonSampling ? r.usePoissonSampling = true : t.useExponentialShadowMap ? r.useExponentialShadowMap = true : t.useBlurExponentialShadowMap ? r.useBlurExponentialShadowMap = true : t.useCloseExponentialShadowMap ? r.useCloseExponentialShadowMap = true : t.useBlurCloseExponentialShadowMap ? r.useBlurCloseExponentialShadowMap = true : t.usePercentageCloserFiltering ? r.usePercentageCloserFiltering = true : t.useContactHardeningShadow && (r.useContactHardeningShadow = true), - t.filteringQuality && (r.filteringQuality = t.filteringQuality), - t.contactHardeningLightSizeUVRatio ? r.contactHardeningLightSizeUVRatio = t.contactHardeningLightSizeUVRatio : t.useVarianceShadowMap ? r.useExponentialShadowMap = true : t.useBlurVarianceShadowMap && (r.useBlurExponentialShadowMap = true), - t.depthScale && (r.depthScale = t.depthScale), - t.blurScale && (r.blurScale = t.blurScale), - t.blurBoxOffset && (r.blurBoxOffset = t.blurBoxOffset), - t.useKernelBlur && (r.useKernelBlur = t.useKernelBlur), - t.blurKernel && (r.blurKernel = t.blurKernel), - void 0 !== t.bias && (r.bias = t.bias), - void 0 !== t.normalBias && (r.normalBias = t.normalBias), - void 0 !== t.frustumEdgeFalloff && (r.frustumEdgeFalloff = t.frustumEdgeFalloff), - t.darkness && r.setDarkness(t.darkness), - t.transparencyShadow && r.setTransparencyShadow(true), - r.forceBackFacesOnly = t.forceBackFacesOnly, - r - } - , - e.FILTER_NONE = 0, - e.FILTER_EXPONENTIALSHADOWMAP = 1, - e.FILTER_POISSONSAMPLING = 2, - e.FILTER_BLUREXPONENTIALSHADOWMAP = 3, - e.FILTER_CLOSEEXPONENTIALSHADOWMAP = 4, - e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP = 5, - e.FILTER_PCF = 6, - e.FILTER_PCSS = 7, - e.QUALITY_HIGH = 0, - e.QUALITY_MEDIUM = 1, - e.QUALITY_LOW = 2, - e._SceneComponentInitialization = function(e) { - throw Te.a.WarnImport("ShadowGeneratorSceneComponent") - } - , - e - }(); - r.a.AddParser(Se.a.NAME_SHADOWGENERATOR, function(e, t) { - if (void 0 !== e.shadowGenerators && null !== e.shadowGenerators) - for (var i = 0, n = e.shadowGenerators.length; i < n; i++) { - var r = e.shadowGenerators[i]; - Vr.Parse(r, t) - } - }); - var Gr = function() { - function e(e) { - this.name = Se.a.NAME_SHADOWGENERATOR, - this.scene = e - } - return e.prototype.register = function() { - this.scene._gatherRenderTargetsStage.registerStep(Se.a.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.serialize = function(e) { - e.shadowGenerators = []; - for (var t = 0, i = this.scene.lights; t < i.length; t++) { - var n = i[t].getShadowGenerator(); - n && e.shadowGenerators.push(n.serialize()) - } - } - , - e.prototype.addFromContainer = function(e) {} - , - e.prototype.removeFromContainer = function(e, t) {} - , - e.prototype.dispose = function() {} - , - e.prototype._gatherRenderTargets = function(e) { - var t = this.scene; - if (this.scene.shadowsEnabled) - for (var i = 0; i < t.lights.length; i++) { - var n = t.lights[i] - , r = n.getShadowGenerator(); - if (n.isEnabled() && n.shadowEnabled && r) { - var o = r.getShadowMap(); - -1 !== t.textures.indexOf(o) && e.push(o) - } - } - } - , - e - }(); - Vr._SceneComponentInitialization = function(e) { - var t = e._getComponent(Se.a.NAME_SHADOWGENERATOR); - t || (t = new Gr(e), - e._addComponent(t)) + }), + (e.prototype._disposeBlurPostProcesses = function () { + this._shadowMap2 && + (this._shadowMap2.dispose(), (this._shadowMap2 = null)), + this._boxBlurPostprocess && + (this._boxBlurPostprocess.dispose(), + (this._boxBlurPostprocess = null)), + this._kernelBlurXPostprocess && + (this._kernelBlurXPostprocess.dispose(), + (this._kernelBlurXPostprocess = null)), + this._kernelBlurYPostprocess && + (this._kernelBlurYPostprocess.dispose(), + (this._kernelBlurYPostprocess = null)), + (this._blurPostProcesses = []); + }), + (e.prototype._disposeRTTandPostProcesses = function () { + this._shadowMap && + (this._shadowMap.dispose(), (this._shadowMap = null)), + this._disposeBlurPostProcesses(); + }), + (e.prototype.dispose = function () { + this._disposeRTTandPostProcesses(), + this._light && + ((this._light._shadowGenerator = null), + this._light._markMeshesAsLightDirty()); + }), + (e.prototype.serialize = function () { + var e = {}, + t = this.getShadowMap(); + if (!t) return e; + if ( + ((e.lightId = this._light.id), + (e.mapSize = t.getRenderSize()), + (e.useExponentialShadowMap = + this.useExponentialShadowMap), + (e.useBlurExponentialShadowMap = + this.useBlurExponentialShadowMap), + (e.useCloseExponentialShadowMap = + this.useBlurExponentialShadowMap), + (e.useBlurCloseExponentialShadowMap = + this.useBlurExponentialShadowMap), + (e.usePoissonSampling = this.usePoissonSampling), + (e.forceBackFacesOnly = this.forceBackFacesOnly), + (e.depthScale = this.depthScale), + (e.darkness = this.getDarkness()), + (e.blurBoxOffset = this.blurBoxOffset), + (e.blurKernel = this.blurKernel), + (e.blurScale = this.blurScale), + (e.useKernelBlur = this.useKernelBlur), + (e.transparencyShadow = this._transparencyShadow), + (e.frustumEdgeFalloff = this.frustumEdgeFalloff), + (e.bias = this.bias), + (e.normalBias = this.normalBias), + (e.usePercentageCloserFiltering = + this.usePercentageCloserFiltering), + (e.useContactHardeningShadow = + this.useContactHardeningShadow), + (e.filteringQuality = this.filteringQuality), + (e.contactHardeningLightSizeUVRatio = + this.contactHardeningLightSizeUVRatio), + (e.renderList = []), + t.renderList) + ) + for (var i = 0; i < t.renderList.length; i++) { + var n = t.renderList[i]; + e.renderList.push(n.id); + } + return e; + }), + (e.Parse = function (t, i) { + for ( + var n = i.getLightByID(t.lightId), + r = new e(t.mapSize, n), + o = r.getShadowMap(), + a = 0; + a < t.renderList.length; + a++ + ) + i.getMeshesByID(t.renderList[a]).forEach(function (e) { + o && + (o.renderList || (o.renderList = []), + o.renderList.push(e)); + }); + return ( + t.usePoissonSampling + ? (r.usePoissonSampling = true) + : t.useExponentialShadowMap + ? (r.useExponentialShadowMap = true) + : t.useBlurExponentialShadowMap + ? (r.useBlurExponentialShadowMap = true) + : t.useCloseExponentialShadowMap + ? (r.useCloseExponentialShadowMap = true) + : t.useBlurCloseExponentialShadowMap + ? (r.useBlurCloseExponentialShadowMap = true) + : t.usePercentageCloserFiltering + ? (r.usePercentageCloserFiltering = true) + : t.useContactHardeningShadow && + (r.useContactHardeningShadow = true), + t.filteringQuality && + (r.filteringQuality = t.filteringQuality), + t.contactHardeningLightSizeUVRatio + ? (r.contactHardeningLightSizeUVRatio = + t.contactHardeningLightSizeUVRatio) + : t.useVarianceShadowMap + ? (r.useExponentialShadowMap = true) + : t.useBlurVarianceShadowMap && + (r.useBlurExponentialShadowMap = true), + t.depthScale && (r.depthScale = t.depthScale), + t.blurScale && (r.blurScale = t.blurScale), + t.blurBoxOffset && (r.blurBoxOffset = t.blurBoxOffset), + t.useKernelBlur && (r.useKernelBlur = t.useKernelBlur), + t.blurKernel && (r.blurKernel = t.blurKernel), + void 0 !== t.bias && (r.bias = t.bias), + void 0 !== t.normalBias && (r.normalBias = t.normalBias), + void 0 !== t.frustumEdgeFalloff && + (r.frustumEdgeFalloff = t.frustumEdgeFalloff), + t.darkness && r.setDarkness(t.darkness), + t.transparencyShadow && r.setTransparencyShadow(true), + (r.forceBackFacesOnly = t.forceBackFacesOnly), + r + ); + }), + (e.FILTER_NONE = 0), + (e.FILTER_EXPONENTIALSHADOWMAP = 1), + (e.FILTER_POISSONSAMPLING = 2), + (e.FILTER_BLUREXPONENTIALSHADOWMAP = 3), + (e.FILTER_CLOSEEXPONENTIALSHADOWMAP = 4), + (e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP = 5), + (e.FILTER_PCF = 6), + (e.FILTER_PCSS = 7), + (e.QUALITY_HIGH = 0), + (e.QUALITY_MEDIUM = 1), + (e.QUALITY_LOW = 2), + (e._SceneComponentInitialization = function (e) { + throw Te.a.WarnImport("ShadowGeneratorSceneComponent"); + }), + e + ); + })(); + r.a.AddParser(Se.a.NAME_SHADOWGENERATOR, function (e, t) { + if ( + void 0 !== e.shadowGenerators && + null !== e.shadowGenerators + ) + for (var i = 0, n = e.shadowGenerators.length; i < n; i++) { + var r = e.shadowGenerators[i]; + Vr.Parse(r, t); + } + }); + var Gr = (function () { + function e(e) { + (this.name = Se.a.NAME_SHADOWGENERATOR), (this.scene = e); } - , - N.a.AddNodeConstructor("Light_Type_0", function(e, t) { - return function() { - return new zr(e,a.x.Zero(),t) + return ( + (e.prototype.register = function () { + this.scene._gatherRenderTargetsStage.registerStep( + Se.a.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, + this, + this._gatherRenderTargets + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.serialize = function (e) { + e.shadowGenerators = []; + for (var t = 0, i = this.scene.lights; t < i.length; t++) { + var n = i[t].getShadowGenerator(); + n && e.shadowGenerators.push(n.serialize()); } + }), + (e.prototype.addFromContainer = function (e) {}), + (e.prototype.removeFromContainer = function (e, t) {}), + (e.prototype.dispose = function () {}), + (e.prototype._gatherRenderTargets = function (e) { + var t = this.scene; + if (this.scene.shadowsEnabled) + for (var i = 0; i < t.lights.length; i++) { + var n = t.lights[i], + r = n.getShadowGenerator(); + if (n.isEnabled() && n.shadowEnabled && r) { + var o = r.getShadowMap(); + -1 !== t.textures.indexOf(o) && e.push(o); + } + } + }), + e + ); + })(); + (Vr._SceneComponentInitialization = function (e) { + var t = e._getComponent(Se.a.NAME_SHADOWGENERATOR); + t || ((t = new Gr(e)), e._addComponent(t)); + }), + N.a.AddNodeConstructor("Light_Type_0", function (e, t) { + return function () { + return new zr(e, a.x.Zero(), t); + }; }); - var zr = function(e) { - function t(t, i, n) { - var r = e.call(this, t, n) || this; - return r._shadowAngle = Math.PI / 2, - r.position = i, - r - } - return h.d(t, e), + var zr = (function (e) { + function t(t, i, n) { + var r = e.call(this, t, n) || this; + return (r._shadowAngle = Math.PI / 2), (r.position = i), r; + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "shadowAngle", { - get: function() { - return this._shadowAngle - }, - set: function(e) { - this._shadowAngle = e, - this.forceProjectionMatrixCompute() - }, - enumerable: true, - configurable: true + get: function () { + return this._shadowAngle; + }, + set: function (e) { + (this._shadowAngle = e), + this.forceProjectionMatrixCompute(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "direction", { - get: function() { - return this._direction - }, - set: function(e) { - var t = this.needCube(); - this._direction = e, - this.needCube() !== t && this._shadowGenerator && this._shadowGenerator.recreateShadowMap() - }, - enumerable: true, - configurable: true + get: function () { + return this._direction; + }, + set: function (e) { + var t = this.needCube(); + (this._direction = e), + this.needCube() !== t && + this._shadowGenerator && + this._shadowGenerator.recreateShadowMap(); + }, + enumerable: true, + configurable: true, }), - t.prototype.getClassName = function() { - return "PointLight" - } - , - t.prototype.getTypeID = function() { - return Nn.a.LIGHTTYPEID_POINTLIGHT - } - , - t.prototype.needCube = function() { - return !this.direction - } - , - t.prototype.getShadowDirection = function(t) { - if (this.direction) - return e.prototype.getShadowDirection.call(this, t); - switch (t) { + (t.prototype.getClassName = function () { + return "PointLight"; + }), + (t.prototype.getTypeID = function () { + return Nn.a.LIGHTTYPEID_POINTLIGHT; + }), + (t.prototype.needCube = function () { + return !this.direction; + }), + (t.prototype.getShadowDirection = function (t) { + if (this.direction) + return e.prototype.getShadowDirection.call(this, t); + switch (t) { case 0: - return new a.x(1,0,0); + return new a.x(1, 0, 0); case 1: - return new a.x(-1,0,0); + return new a.x(-1, 0, 0); case 2: - return new a.x(0,-1,0); + return new a.x(0, -1, 0); case 3: - return new a.x(0,1,0); + return new a.x(0, 1, 0); case 4: - return new a.x(0,0,1); + return new a.x(0, 0, 1); case 5: - return new a.x(0,0,-1) - } - return a.x.Zero() - } - , - t.prototype._setDefaultShadowProjectionMatrix = function(e, t, i) { - var n = this.getScene().activeCamera; - n && a.j.PerspectiveFovLHToRef(this.shadowAngle, 1, this.getDepthMinZ(n), this.getDepthMaxZ(n), e) - } - , - t.prototype._buildUniformLayout = function() { - this._uniformBuffer.addUniform("vLightData", 4), + return new a.x(0, 0, -1); + } + return a.x.Zero(); + }), + (t.prototype._setDefaultShadowProjectionMatrix = function ( + e, + t, + i + ) { + var n = this.getScene().activeCamera; + n && + a.j.PerspectiveFovLHToRef( + this.shadowAngle, + 1, + this.getDepthMinZ(n), + this.getDepthMaxZ(n), + e + ); + }), + (t.prototype._buildUniformLayout = function () { + this._uniformBuffer.addUniform("vLightData", 4), this._uniformBuffer.addUniform("vLightDiffuse", 4), this._uniformBuffer.addUniform("vLightSpecular", 3), this._uniformBuffer.addUniform("vLightFalloff", 4), this._uniformBuffer.addUniform("shadowsInfo", 3), this._uniformBuffer.addUniform("depthValues", 2), - this._uniformBuffer.create() - } - , - t.prototype.transferToEffect = function(e, t) { - return this.computeTransformedInformation() ? this._uniformBuffer.updateFloat4("vLightData", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0, t) : this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, 0, t), - this._uniformBuffer.updateFloat4("vLightFalloff", this.range, this._inverseSquaredRange, 0, 0, t), + this._uniformBuffer.create(); + }), + (t.prototype.transferToEffect = function (e, t) { + return ( + this.computeTransformedInformation() + ? this._uniformBuffer.updateFloat4( + "vLightData", + this.transformedPosition.x, + this.transformedPosition.y, + this.transformedPosition.z, + 0, + t + ) + : this._uniformBuffer.updateFloat4( + "vLightData", + this.position.x, + this.position.y, + this.position.z, + 0, + t + ), + this._uniformBuffer.updateFloat4( + "vLightFalloff", + this.range, + this._inverseSquaredRange, + 0, + 0, + t + ), this - } - , - t.prototype.prepareLightSpecificDefines = function(e, t) { - e["POINTLIGHT" + t] = true - } - , + ); + }), + (t.prototype.prepareLightSpecificDefines = function (e, t) { + e["POINTLIGHT" + t] = true; + }), h.c([Object(F.c)()], t.prototype, "shadowAngle", null), t - }(kn) - , jr = function() { - function e(e, t, i) { - var n = this; - void 0 === t && (t = ""), - void 0 === i && (i = "black"), - this._renderingCanvas = e, - this._loadingText = t, - this._loadingDivBackgroundColor = i, - this._resizeLoadingUI = function() { - var e = n._renderingCanvas.getBoundingClientRect() - , t = window.getComputedStyle(n._renderingCanvas).position; - n._loadingDiv && (n._loadingDiv.style.position = "fixed" === t ? "fixed" : "absolute", - n._loadingDiv.style.left = e.left + "px", - n._loadingDiv.style.top = e.top + "px", - n._loadingDiv.style.width = e.width + "px", - n._loadingDiv.style.height = e.height + "px") - } - } - return e.prototype.displayLoadingUI = function() { - if (!this._loadingDiv) { - this._loadingDiv = document.createElement("div"), - this._loadingDiv.id = "babylonjsLoadingDiv", - this._loadingDiv.style.opacity = "0", - this._loadingDiv.style.transition = "opacity 1.5s ease", - this._loadingDiv.style.pointerEvents = "none", - this._loadingTextDiv = document.createElement("div"), - this._loadingTextDiv.style.position = "absolute", - this._loadingTextDiv.style.left = "0", - this._loadingTextDiv.style.top = "50%", - this._loadingTextDiv.style.marginTop = "80px", - this._loadingTextDiv.style.width = "100%", - this._loadingTextDiv.style.height = "20px", - this._loadingTextDiv.style.fontFamily = "Arial", - this._loadingTextDiv.style.fontSize = "14px", - this._loadingTextDiv.style.color = "white", - this._loadingTextDiv.style.textAlign = "center", - this._loadingTextDiv.innerHTML = "Loading", - this._loadingDiv.appendChild(this._loadingTextDiv), - this._loadingTextDiv.innerHTML = this._loadingText; - var t = document.createElement("style"); - t.type = "text/css", - t.innerHTML = "@-webkit-keyframes spin1 { 0% { -webkit-transform: rotate(0deg);}\n 100% { -webkit-transform: rotate(360deg);}\n } @keyframes spin1 { 0% { transform: rotate(0deg);}\n 100% { transform: rotate(360deg);}\n }", - document.getElementsByTagName("head")[0].appendChild(t); - var i = new Image; - e.DefaultLogoUrl ? i.src = e.DefaultLogoUrl : i.src = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+", - i.style.position = "absolute", - i.style.left = "50%", - i.style.top = "50%", - i.style.width = "10vw", - i.style.height = "10vw", - i.style.marginLeft = "-5vw", - i.style.marginTop = "-5vw"; - var n = new Image; - e.DefaultSpinnerUrl ? n.src = e.DefaultSpinnerUrl : n.src = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==", - n.style.position = "absolute", - n.style.left = "50%", - n.style.top = "50%", - n.style.width = "18vw", - n.style.height = "18vw", - n.style.marginLeft = "-9vw", - n.style.marginTop = "-9vw", - n.style.animation = "spin1 0.75s infinite linear", - n.style.webkitAnimation = "spin1 0.75s infinite linear", - n.style.transformOrigin = "50% 50%", - n.style.webkitTransformOrigin = "50% 50%", - this._loadingDiv.appendChild(i), - this._loadingDiv.appendChild(n), - this._resizeLoadingUI(), - window.addEventListener("resize", this._resizeLoadingUI), - this._loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor, - document.body.appendChild(this._loadingDiv), - this._loadingDiv.style.opacity = "1" - } - } - , - e.prototype.hideLoadingUI = function() { - var e = this; - this._loadingDiv && (this._loadingDiv.style.opacity = "0", - this._loadingDiv.addEventListener("transitionend", function() { - e._loadingDiv && (e._loadingDiv.parentElement && e._loadingDiv.parentElement.removeChild(e._loadingDiv), - window.removeEventListener("resize", e._resizeLoadingUI), - e._loadingDiv = null) - })) - } - , + ); + })(kn), + jr = (function () { + function e(e, t, i) { + var n = this; + void 0 === t && (t = ""), + void 0 === i && (i = "black"), + (this._renderingCanvas = e), + (this._loadingText = t), + (this._loadingDivBackgroundColor = i), + (this._resizeLoadingUI = function () { + var e = n._renderingCanvas.getBoundingClientRect(), + t = window.getComputedStyle( + n._renderingCanvas + ).position; + n._loadingDiv && + ((n._loadingDiv.style.position = + "fixed" === t ? "fixed" : "absolute"), + (n._loadingDiv.style.left = e.left + "px"), + (n._loadingDiv.style.top = e.top + "px"), + (n._loadingDiv.style.width = e.width + "px"), + (n._loadingDiv.style.height = e.height + "px")); + }); + } + return ( + (e.prototype.displayLoadingUI = function () { + if (!this._loadingDiv) { + (this._loadingDiv = document.createElement("div")), + (this._loadingDiv.id = "babylonjsLoadingDiv"), + (this._loadingDiv.style.opacity = "0"), + (this._loadingDiv.style.transition = + "opacity 1.5s ease"), + (this._loadingDiv.style.pointerEvents = "none"), + (this._loadingTextDiv = + document.createElement("div")), + (this._loadingTextDiv.style.position = "absolute"), + (this._loadingTextDiv.style.left = "0"), + (this._loadingTextDiv.style.top = "50%"), + (this._loadingTextDiv.style.marginTop = "80px"), + (this._loadingTextDiv.style.width = "100%"), + (this._loadingTextDiv.style.height = "20px"), + (this._loadingTextDiv.style.fontFamily = "Arial"), + (this._loadingTextDiv.style.fontSize = "14px"), + (this._loadingTextDiv.style.color = "white"), + (this._loadingTextDiv.style.textAlign = "center"), + (this._loadingTextDiv.innerHTML = "Loading"), + this._loadingDiv.appendChild(this._loadingTextDiv), + (this._loadingTextDiv.innerHTML = this._loadingText); + var t = document.createElement("style"); + (t.type = "text/css"), + (t.innerHTML = + "@-webkit-keyframes spin1 { 0% { -webkit-transform: rotate(0deg);}\n 100% { -webkit-transform: rotate(360deg);}\n } @keyframes spin1 { 0% { transform: rotate(0deg);}\n 100% { transform: rotate(360deg);}\n }"), + document + .getElementsByTagName("head")[0] + .appendChild(t); + var i = new Image(); + e.DefaultLogoUrl + ? (i.src = e.DefaultLogoUrl) + : (i.src = + "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+"), + (i.style.position = "absolute"), + (i.style.left = "50%"), + (i.style.top = "50%"), + (i.style.width = "10vw"), + (i.style.height = "10vw"), + (i.style.marginLeft = "-5vw"), + (i.style.marginTop = "-5vw"); + var n = new Image(); + e.DefaultSpinnerUrl + ? (n.src = e.DefaultSpinnerUrl) + : (n.src = + "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg=="), + (n.style.position = "absolute"), + (n.style.left = "50%"), + (n.style.top = "50%"), + (n.style.width = "18vw"), + (n.style.height = "18vw"), + (n.style.marginLeft = "-9vw"), + (n.style.marginTop = "-9vw"), + (n.style.animation = "spin1 0.75s infinite linear"), + (n.style.webkitAnimation = + "spin1 0.75s infinite linear"), + (n.style.transformOrigin = "50% 50%"), + (n.style.webkitTransformOrigin = "50% 50%"), + this._loadingDiv.appendChild(i), + this._loadingDiv.appendChild(n), + this._resizeLoadingUI(), + window.addEventListener( + "resize", + this._resizeLoadingUI + ), + (this._loadingDiv.style.backgroundColor = + this._loadingDivBackgroundColor), + document.body.appendChild(this._loadingDiv), + (this._loadingDiv.style.opacity = "1"); + } + }), + (e.prototype.hideLoadingUI = function () { + var e = this; + this._loadingDiv && + ((this._loadingDiv.style.opacity = "0"), + this._loadingDiv.addEventListener( + "transitionend", + function () { + e._loadingDiv && + (e._loadingDiv.parentElement && + e._loadingDiv.parentElement.removeChild( + e._loadingDiv + ), + window.removeEventListener( + "resize", + e._resizeLoadingUI + ), + (e._loadingDiv = null)); + } + )); + }), Object.defineProperty(e.prototype, "loadingUIText", { - get: function() { - return this._loadingText + get: function () { + return this._loadingText; + }, + set: function (e) { + (this._loadingText = e), + this._loadingTextDiv && + (this._loadingTextDiv.innerHTML = + this._loadingText); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "loadingUIBackgroundColor", + { + get: function () { + return this._loadingDivBackgroundColor; }, - set: function(e) { - this._loadingText = e, - this._loadingTextDiv && (this._loadingTextDiv.innerHTML = this._loadingText) + set: function (e) { + (this._loadingDivBackgroundColor = e), + this._loadingDiv && + (this._loadingDiv.style.backgroundColor = + this._loadingDivBackgroundColor); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "loadingUIBackgroundColor", { - get: function() { - return this._loadingDivBackgroundColor - }, - set: function(e) { - this._loadingDivBackgroundColor = e, - this._loadingDiv && (this._loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor) - }, - enumerable: true, - configurable: true - }), - e.DefaultLogoUrl = "", - e.DefaultSpinnerUrl = "", + configurable: true, + } + ), + (e.DefaultLogoUrl = ""), + (e.DefaultSpinnerUrl = ""), e - }(); - ve.b.DefaultLoadingScreenFactory = function(e) { - return new jr(e) - } - ; - var Hr = n(57) - , Wr = n(66) - , Xr = function() { - function e() {} - return e.ConvertPanoramaToCubemap = function(e, t, i, n) { - if (!e) - throw "ConvertPanoramaToCubemap: input cannot be null"; - if (e.length != t * i * 3) - throw "ConvertPanoramaToCubemap: input size is wrong"; - return { - front: this.CreateCubemapTexture(n, this.FACE_FRONT, e, t, i), - back: this.CreateCubemapTexture(n, this.FACE_BACK, e, t, i), - left: this.CreateCubemapTexture(n, this.FACE_LEFT, e, t, i), - right: this.CreateCubemapTexture(n, this.FACE_RIGHT, e, t, i), - up: this.CreateCubemapTexture(n, this.FACE_UP, e, t, i), - down: this.CreateCubemapTexture(n, this.FACE_DOWN, e, t, i), - size: n, - type: _.a.TEXTURETYPE_FLOAT, - format: _.a.TEXTUREFORMAT_RGB, - gammaSpace: false + ); + })(); + ve.b.DefaultLoadingScreenFactory = function (e) { + return new jr(e); + }; + var Hr = n(57), + Wr = n(66), + Xr = (function () { + function e() {} + return ( + (e.ConvertPanoramaToCubemap = function (e, t, i, n) { + if (!e) + throw "ConvertPanoramaToCubemap: input cannot be null"; + if (e.length != t * i * 3) + throw "ConvertPanoramaToCubemap: input size is wrong"; + return { + front: this.CreateCubemapTexture( + n, + this.FACE_FRONT, + e, + t, + i + ), + back: this.CreateCubemapTexture( + n, + this.FACE_BACK, + e, + t, + i + ), + left: this.CreateCubemapTexture( + n, + this.FACE_LEFT, + e, + t, + i + ), + right: this.CreateCubemapTexture( + n, + this.FACE_RIGHT, + e, + t, + i + ), + up: this.CreateCubemapTexture(n, this.FACE_UP, e, t, i), + down: this.CreateCubemapTexture( + n, + this.FACE_DOWN, + e, + t, + i + ), + size: n, + type: _.a.TEXTURETYPE_FLOAT, + format: _.a.TEXTUREFORMAT_RGB, + gammaSpace: false, + }; + }), + (e.CreateCubemapTexture = function (e, t, i, n, r) { + for ( + var o = new ArrayBuffer(e * e * 4 * 3), + a = new Float32Array(o), + s = t[1].subtract(t[0]).scale(1 / e), + c = t[3].subtract(t[2]).scale(1 / e), + u = 1 / e, + l = 0, + h = 0; + h < e; + h++ + ) { + for (var f = t[0], d = t[2], p = 0; p < e; p++) { + var m = d.subtract(f).scale(l).add(f); + m.normalize(); + var g = this.CalcProjectionSpherical(m, i, n, r); + (a[h * e * 3 + 3 * p + 0] = g.r), + (a[h * e * 3 + 3 * p + 1] = g.g), + (a[h * e * 3 + 3 * p + 2] = g.b), + (f = f.add(s)), + (d = d.add(c)); } - } - , - e.CreateCubemapTexture = function(e, t, i, n, r) { - for (var o = new ArrayBuffer(e * e * 4 * 3), a = new Float32Array(o), s = t[1].subtract(t[0]).scale(1 / e), c = t[3].subtract(t[2]).scale(1 / e), u = 1 / e, l = 0, h = 0; h < e; h++) { - for (var f = t[0], d = t[2], p = 0; p < e; p++) { - var m = d.subtract(f).scale(l).add(f); - m.normalize(); - var g = this.CalcProjectionSpherical(m, i, n, r); - a[h * e * 3 + 3 * p + 0] = g.r, - a[h * e * 3 + 3 * p + 1] = g.g, - a[h * e * 3 + 3 * p + 2] = g.b, - f = f.add(s), - d = d.add(c) - } - l += u - } - return a - } - , - e.CalcProjectionSpherical = function(e, t, i, n) { - for (var r = Math.atan2(e.z, e.x), o = Math.acos(e.y); r < -Math.PI; ) - r += 2 * Math.PI; - for (; r > Math.PI; ) - r -= 2 * Math.PI; - var a = r / Math.PI - , s = o / Math.PI; - a = .5 * a + .5; - var c = Math.round(a * i); - c < 0 ? c = 0 : c >= i && (c = i - 1); - var u = Math.round(s * n); - u < 0 ? u = 0 : u >= n && (u = n - 1); - var l = n - u - 1; - return { - r: t[l * i * 3 + 3 * c + 0], - g: t[l * i * 3 + 3 * c + 1], - b: t[l * i * 3 + 3 * c + 2] - } - } - , - e.FACE_FRONT = [new a.x(-1,-1,-1), new a.x(1,-1,-1), new a.x(-1,1,-1), new a.x(1,1,-1)], - e.FACE_BACK = [new a.x(1,-1,1), new a.x(-1,-1,1), new a.x(1,1,1), new a.x(-1,1,1)], - e.FACE_RIGHT = [new a.x(1,-1,-1), new a.x(1,-1,1), new a.x(1,1,-1), new a.x(1,1,1)], - e.FACE_LEFT = [new a.x(-1,-1,1), new a.x(-1,-1,-1), new a.x(-1,1,1), new a.x(-1,1,-1)], - e.FACE_DOWN = [new a.x(-1,1,-1), new a.x(1,1,-1), new a.x(-1,1,1), new a.x(1,1,1)], - e.FACE_UP = [new a.x(-1,-1,1), new a.x(1,-1,1), new a.x(-1,-1,-1), new a.x(1,-1,-1)], + l += u; + } + return a; + }), + (e.CalcProjectionSpherical = function (e, t, i, n) { + for ( + var r = Math.atan2(e.z, e.x), o = Math.acos(e.y); + r < -Math.PI; + + ) + r += 2 * Math.PI; + for (; r > Math.PI; ) r -= 2 * Math.PI; + var a = r / Math.PI, + s = o / Math.PI; + a = 0.5 * a + 0.5; + var c = Math.round(a * i); + c < 0 ? (c = 0) : c >= i && (c = i - 1); + var u = Math.round(s * n); + u < 0 ? (u = 0) : u >= n && (u = n - 1); + var l = n - u - 1; + return { + r: t[l * i * 3 + 3 * c + 0], + g: t[l * i * 3 + 3 * c + 1], + b: t[l * i * 3 + 3 * c + 2], + }; + }), + (e.FACE_FRONT = [ + new a.x(-1, -1, -1), + new a.x(1, -1, -1), + new a.x(-1, 1, -1), + new a.x(1, 1, -1), + ]), + (e.FACE_BACK = [ + new a.x(1, -1, 1), + new a.x(-1, -1, 1), + new a.x(1, 1, 1), + new a.x(-1, 1, 1), + ]), + (e.FACE_RIGHT = [ + new a.x(1, -1, -1), + new a.x(1, -1, 1), + new a.x(1, 1, -1), + new a.x(1, 1, 1), + ]), + (e.FACE_LEFT = [ + new a.x(-1, -1, 1), + new a.x(-1, -1, -1), + new a.x(-1, 1, 1), + new a.x(-1, 1, -1), + ]), + (e.FACE_DOWN = [ + new a.x(-1, 1, -1), + new a.x(1, 1, -1), + new a.x(-1, 1, 1), + new a.x(1, 1, 1), + ]), + (e.FACE_UP = [ + new a.x(-1, -1, 1), + new a.x(1, -1, 1), + new a.x(-1, -1, -1), + new a.x(1, -1, -1), + ]), e - }() - , Yr = function() { - function e() {} - return e.Ldexp = function(e, t) { - return t > 1023 ? e * Math.pow(2, 1023) * Math.pow(2, t - 1023) : t < -1074 ? e * Math.pow(2, -1074) * Math.pow(2, t + 1074) : e * Math.pow(2, t) - } - , - e.Rgbe2float = function(e, t, i, n, r, o) { - r > 0 ? (r = this.Ldexp(1, r - 136), - e[o + 0] = t * r, - e[o + 1] = i * r, - e[o + 2] = n * r) : (e[o + 0] = 0, - e[o + 1] = 0, - e[o + 2] = 0) - } - , - e.readStringLine = function(e, t) { - for (var i = "", n = "", r = t; r < e.length - t && "\n" != (n = String.fromCharCode(e[r])); r++) - i += n; - return i - } - , - e.RGBE_ReadHeader = function(e) { - var t, i, n = this.readStringLine(e, 0); - if ("#" != n[0] || "?" != n[1]) - throw "Bad HDR Format."; - var r = false - , o = false - , a = 0; - do { - a += n.length + 1, - "FORMAT=32-bit_rle_rgbe" == (n = this.readStringLine(e, a)) ? o = true : 0 == n.length && (r = true) - } while (!r);if (!o) - throw "HDR Bad header format, unsupported FORMAT"; - a += n.length + 1, - n = this.readStringLine(e, a); - var s = /^\-Y (.*) \+X (.*)$/g.exec(n); - if (!s || s.length < 3) - throw "HDR Bad header format, no size"; - if (i = parseInt(s[2]), - t = parseInt(s[1]), + ); + })(), + Yr = (function () { + function e() {} + return ( + (e.Ldexp = function (e, t) { + return t > 1023 + ? e * Math.pow(2, 1023) * Math.pow(2, t - 1023) + : t < -1074 + ? e * Math.pow(2, -1074) * Math.pow(2, t + 1074) + : e * Math.pow(2, t); + }), + (e.Rgbe2float = function (e, t, i, n, r, o) { + r > 0 + ? ((r = this.Ldexp(1, r - 136)), + (e[o + 0] = t * r), + (e[o + 1] = i * r), + (e[o + 2] = n * r)) + : ((e[o + 0] = 0), (e[o + 1] = 0), (e[o + 2] = 0)); + }), + (e.readStringLine = function (e, t) { + for ( + var i = "", n = "", r = t; + r < e.length - t && + "\n" != (n = String.fromCharCode(e[r])); + r++ + ) + i += n; + return i; + }), + (e.RGBE_ReadHeader = function (e) { + var t, + i, + n = this.readStringLine(e, 0); + if ("#" != n[0] || "?" != n[1]) throw "Bad HDR Format."; + var r = false, + o = false, + a = 0; + do { + (a += n.length + 1), + "FORMAT=32-bit_rle_rgbe" == + (n = this.readStringLine(e, a)) + ? (o = true) + : 0 == n.length && (r = true); + } while (!r); + if (!o) throw "HDR Bad header format, unsupported FORMAT"; + (a += n.length + 1), (n = this.readStringLine(e, a)); + var s = /^\-Y (.*) \+X (.*)$/g.exec(n); + if (!s || s.length < 3) + throw "HDR Bad header format, no size"; + if ( + ((i = parseInt(s[2])), + (t = parseInt(s[1])), i < 8 || i > 32767) - throw "HDR Bad header format, unsupported size"; - return { - height: t, - width: i, - dataPosition: a += n.length + 1 - } - } - , - e.GetCubeMapTextureData = function(e, t) { - var i = new Uint8Array(e) - , n = this.RGBE_ReadHeader(i) - , r = this.RGBE_ReadPixels_RLE(i, n); - return Xr.ConvertPanoramaToCubemap(r, n.width, n.height, t) - } - , - e.RGBE_ReadPixels = function(e, t) { - return this.RGBE_ReadPixels_RLE(e, t) - } - , - e.RGBE_ReadPixels_RLE = function(e, t) { - for (var i, n, r, o, a, s = t.height, c = t.width, u = t.dataPosition, l = 0, h = 0, f = 0, d = new ArrayBuffer(4 * c), p = new Uint8Array(d), m = new ArrayBuffer(t.width * t.height * 4 * 3), g = new Float32Array(m); s > 0; ) { - if (i = e[u++], - n = e[u++], - r = e[u++], - o = e[u++], - 2 != i || 2 != n || 128 & r) - throw "HDR Bad header format, not RLE"; - if ((r << 8 | o) != c) - throw "HDR Bad header format, wrong scan line width"; - for (l = 0, - f = 0; f < 4; f++) - for (h = (f + 1) * c; l < h; ) - if (i = e[u++], - n = e[u++], - i > 128) { - if (0 == (a = i - 128) || a > h - l) - throw "HDR Bad Format, bad scanline data (run)"; - for (; a-- > 0; ) - p[l++] = n - } else { - if (0 == (a = i) || a > h - l) - throw "HDR Bad Format, bad scanline data (non-run)"; - if (p[l++] = n, - --a > 0) - for (var _ = 0; _ < a; _++) - p[l++] = e[u++] - } - for (f = 0; f < c; f++) - i = p[f], - n = p[f + c], - r = p[f + 2 * c], - o = p[f + 3 * c], - this.Rgbe2float(g, i, n, r, o, (t.height - s) * c * 3 + 3 * f); - s-- - } - return g - } - , + ) + throw "HDR Bad header format, unsupported size"; + return { + height: t, + width: i, + dataPosition: (a += n.length + 1), + }; + }), + (e.GetCubeMapTextureData = function (e, t) { + var i = new Uint8Array(e), + n = this.RGBE_ReadHeader(i), + r = this.RGBE_ReadPixels_RLE(i, n); + return Xr.ConvertPanoramaToCubemap( + r, + n.width, + n.height, + t + ); + }), + (e.RGBE_ReadPixels = function (e, t) { + return this.RGBE_ReadPixels_RLE(e, t); + }), + (e.RGBE_ReadPixels_RLE = function (e, t) { + for ( + var i, + n, + r, + o, + a, + s = t.height, + c = t.width, + u = t.dataPosition, + l = 0, + h = 0, + f = 0, + d = new ArrayBuffer(4 * c), + p = new Uint8Array(d), + m = new ArrayBuffer(t.width * t.height * 4 * 3), + g = new Float32Array(m); + s > 0; + + ) { + if ( + ((i = e[u++]), + (n = e[u++]), + (r = e[u++]), + (o = e[u++]), + 2 != i || 2 != n || 128 & r) + ) + throw "HDR Bad header format, not RLE"; + if (((r << 8) | o) != c) + throw "HDR Bad header format, wrong scan line width"; + for (l = 0, f = 0; f < 4; f++) + for (h = (f + 1) * c; l < h; ) + if (((i = e[u++]), (n = e[u++]), i > 128)) { + if (0 == (a = i - 128) || a > h - l) + throw "HDR Bad Format, bad scanline data (run)"; + for (; a-- > 0; ) p[l++] = n; + } else { + if (0 == (a = i) || a > h - l) + throw "HDR Bad Format, bad scanline data (non-run)"; + if (((p[l++] = n), --a > 0)) + for (var _ = 0; _ < a; _++) p[l++] = e[u++]; + } + for (f = 0; f < c; f++) + (i = p[f]), + (n = p[f + c]), + (r = p[f + 2 * c]), + (o = p[f + 3 * c]), + this.Rgbe2float( + g, + i, + n, + r, + o, + (t.height - s) * c * 3 + 3 * f + ); + s--; + } + return g; + }), e - }() - , Kr = function(e) { - function t(t, i, n, r, o, s, c, u, l) { - void 0 === r && (r = false), - void 0 === o && (o = true), - void 0 === s && (s = false), - void 0 === c && (c = false), - void 0 === u && (u = null), - void 0 === l && (l = null); - var h = e.call(this, i) || this; - return h._generateHarmonics = true, - h._onLoad = null, - h._onError = null, - h.coordinatesMode = je.a.CUBIC_MODE, - h._isBlocking = true, - h._rotationY = 0, - h.boundingBoxPosition = a.x.Zero(), - t ? (h.name = t, - h.url = t, - h.hasAlpha = false, - h.isCube = true, - h._textureMatrix = a.j.Identity(), - h._onLoad = u, - h._onError = l, - h.gammaSpace = s, - h._noMipmap = r, - h._size = n, - h._texture = h._getFromCache(t, h._noMipmap), - h._texture ? u && (h._texture.isReady ? Ee.h.SetImmediate(function() { - return u() - }) : h._texture.onLoadedObservable.add(u)) : i.useDelayedTextureLoading ? h.delayLoadState = ve.b.DELAYLOADSTATE_NOTLOADED : h.loadTexture(), - h) : h - } - return h.d(t, e), + ); + })(), + Kr = (function (e) { + function t(t, i, n, r, o, s, c, u, l) { + void 0 === r && (r = false), + void 0 === o && (o = true), + void 0 === s && (s = false), + void 0 === c && (c = false), + void 0 === u && (u = null), + void 0 === l && (l = null); + var h = e.call(this, i) || this; + return ( + (h._generateHarmonics = true), + (h._onLoad = null), + (h._onError = null), + (h.coordinatesMode = je.a.CUBIC_MODE), + (h._isBlocking = true), + (h._rotationY = 0), + (h.boundingBoxPosition = a.x.Zero()), + t + ? ((h.name = t), + (h.url = t), + (h.hasAlpha = false), + (h.isCube = true), + (h._textureMatrix = a.j.Identity()), + (h._onLoad = u), + (h._onError = l), + (h.gammaSpace = s), + (h._noMipmap = r), + (h._size = n), + (h._texture = h._getFromCache(t, h._noMipmap)), + h._texture + ? u && + (h._texture.isReady + ? Ee.h.SetImmediate(function () { + return u(); + }) + : h._texture.onLoadedObservable.add(u)) + : i.useDelayedTextureLoading + ? (h.delayLoadState = ve.b.DELAYLOADSTATE_NOTLOADED) + : h.loadTexture(), + h) + : h + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "isBlocking", { - get: function() { - return this._isBlocking - }, - set: function(e) { - this._isBlocking = e - }, - enumerable: true, - configurable: true + get: function () { + return this._isBlocking; + }, + set: function (e) { + this._isBlocking = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "rotationY", { - get: function() { - return this._rotationY - }, - set: function(e) { - this._rotationY = e, - this.setReflectionTextureMatrix(a.j.RotationY(this._rotationY)) - }, - enumerable: true, - configurable: true + get: function () { + return this._rotationY; + }, + set: function (e) { + (this._rotationY = e), + this.setReflectionTextureMatrix( + a.j.RotationY(this._rotationY) + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "boundingBoxSize", { - get: function() { - return this._boundingBoxSize - }, - set: function(e) { - if (!this._boundingBoxSize || !this._boundingBoxSize.equals(e)) { - this._boundingBoxSize = e; - var t = this.getScene(); - t && t.markAllMaterialsAsDirty(_.a.MATERIAL_TextureDirtyFlag) - } - }, - enumerable: true, - configurable: true + get: function () { + return this._boundingBoxSize; + }, + set: function (e) { + if ( + !this._boundingBoxSize || + !this._boundingBoxSize.equals(e) + ) { + this._boundingBoxSize = e; + var t = this.getScene(); + t && + t.markAllMaterialsAsDirty( + _.a.MATERIAL_TextureDirtyFlag + ); + } + }, + enumerable: true, + configurable: true, }), - t.prototype.getClassName = function() { - return "HDRCubeTexture" - } - , - t.prototype.loadTexture = function() { - var e = this - , i = this.getScene(); - i && (this._texture = i.getEngine().createRawCubeTextureFromUrl(this.url, i, this._size, ve.b.TEXTUREFORMAT_RGB, i.getEngine().getCaps().textureFloat ? ve.b.TEXTURETYPE_FLOAT : ve.b.TEXTURETYPE_UNSIGNED_INT, this._noMipmap, function(i) { - e.lodGenerationOffset = 0, - e.lodGenerationScale = .8; - var n = e.getScene(); - if (!n) - return null; - var r = Yr.GetCubeMapTextureData(i, e._size); - if (e._generateHarmonics) { - var o = dr.a.ConvertCubeMapToSphericalPolynomial(r); - e.sphericalPolynomial = o - } - for (var s = [], c = null, u = 0; u < 6; u++) { + (t.prototype.getClassName = function () { + return "HDRCubeTexture"; + }), + (t.prototype.loadTexture = function () { + var e = this, + i = this.getScene(); + i && + (this._texture = i + .getEngine() + .createRawCubeTextureFromUrl( + this.url, + i, + this._size, + ve.b.TEXTUREFORMAT_RGB, + i.getEngine().getCaps().textureFloat + ? ve.b.TEXTURETYPE_FLOAT + : ve.b.TEXTURETYPE_UNSIGNED_INT, + this._noMipmap, + function (i) { + (e.lodGenerationOffset = 0), + (e.lodGenerationScale = 0.8); + var n = e.getScene(); + if (!n) return null; + var r = Yr.GetCubeMapTextureData(i, e._size); + if (e._generateHarmonics) { + var o = + dr.a.ConvertCubeMapToSphericalPolynomial(r); + e.sphericalPolynomial = o; + } + for (var s = [], c = null, u = 0; u < 6; u++) { if (!n.getEngine().getCaps().textureFloat) { - var l = new ArrayBuffer(e._size * e._size * 3); - c = new Uint8Array(l) + var l = new ArrayBuffer( + e._size * e._size * 3 + ); + c = new Uint8Array(l); } var h = r[t._facesMapping[u]]; if (e.gammaSpace || c) - for (var f = 0; f < e._size * e._size; f++) - if (e.gammaSpace && (h[3 * f + 0] = Math.pow(h[3 * f + 0], a.u), - h[3 * f + 1] = Math.pow(h[3 * f + 1], a.u), - h[3 * f + 2] = Math.pow(h[3 * f + 2], a.u)), - c) { - var d = Math.max(255 * h[3 * f + 0], 0) - , p = Math.max(255 * h[3 * f + 1], 0) - , m = Math.max(255 * h[3 * f + 2], 0) - , g = Math.max(Math.max(d, p), m); - if (g > 255) { - var _ = 255 / g; - d *= _, - p *= _, - m *= _ - } - c[3 * f + 0] = d, - c[3 * f + 1] = p, - c[3 * f + 2] = m - } - c ? s.push(c) : s.push(h) - } - return s - }, null, this._onLoad, this._onError)) - } - , - t.prototype.clone = function() { - var e = this.getScene(); - if (!e) - return this; - var i = new t(this.url,e,this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace); - return i.level = this.level, - i.wrapU = this.wrapU, - i.wrapV = this.wrapV, - i.coordinatesIndex = this.coordinatesIndex, - i.coordinatesMode = this.coordinatesMode, + for (var f = 0; f < e._size * e._size; f++) + if ( + (e.gammaSpace && + ((h[3 * f + 0] = Math.pow( + h[3 * f + 0], + a.u + )), + (h[3 * f + 1] = Math.pow( + h[3 * f + 1], + a.u + )), + (h[3 * f + 2] = Math.pow( + h[3 * f + 2], + a.u + ))), + c) + ) { + var d = Math.max(255 * h[3 * f + 0], 0), + p = Math.max(255 * h[3 * f + 1], 0), + m = Math.max(255 * h[3 * f + 2], 0), + g = Math.max(Math.max(d, p), m); + if (g > 255) { + var _ = 255 / g; + (d *= _), (p *= _), (m *= _); + } + (c[3 * f + 0] = d), + (c[3 * f + 1] = p), + (c[3 * f + 2] = m); + } + c ? s.push(c) : s.push(h); + } + return s; + }, + null, + this._onLoad, + this._onError + )); + }), + (t.prototype.clone = function () { + var e = this.getScene(); + if (!e) return this; + var i = new t( + this.url, + e, + this._size, + this._noMipmap, + this._generateHarmonics, + this.gammaSpace + ); + return ( + (i.level = this.level), + (i.wrapU = this.wrapU), + (i.wrapV = this.wrapV), + (i.coordinatesIndex = this.coordinatesIndex), + (i.coordinatesMode = this.coordinatesMode), i - } - , - t.prototype.delayLoad = function() { - this.delayLoadState === ve.b.DELAYLOADSTATE_NOTLOADED && (this.delayLoadState = ve.b.DELAYLOADSTATE_LOADED, - this._texture = this._getFromCache(this.url, this._noMipmap), - this._texture || this.loadTexture()) - } - , - t.prototype.getReflectionTextureMatrix = function() { - return this._textureMatrix - } - , - t.prototype.setReflectionTextureMatrix = function(e) { - var t = this; - this._textureMatrix = e, - e.updateFlag !== this._textureMatrix.updateFlag && e.isIdentity() !== this._textureMatrix.isIdentity() && this.getScene().markAllMaterialsAsDirty(_.a.MATERIAL_TextureDirtyFlag, function(e) { - return -1 !== e.getActiveTextures().indexOf(t) - }) - } - , - t.Parse = function(e, i, n) { - var r = null; - return e.name && !e.isRenderTarget && ((r = new t(n + e.name,i,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace)).name = e.name, - r.hasAlpha = e.hasAlpha, - r.level = e.level, - r.coordinatesMode = e.coordinatesMode, - r.isBlocking = e.isBlocking), - r && (e.boundingBoxPosition && (r.boundingBoxPosition = a.x.FromArray(e.boundingBoxPosition)), - e.boundingBoxSize && (r.boundingBoxSize = a.x.FromArray(e.boundingBoxSize)), - e.rotationY && (r.rotationY = e.rotationY)), - r - } - , - t.prototype.serialize = function() { - if (!this.name) - return null; - var e = {}; - return e.name = this.name, - e.hasAlpha = this.hasAlpha, - e.isCube = true, - e.level = this.level, - e.size = this._size, - e.coordinatesMode = this.coordinatesMode, - e.useInGammaSpace = this.gammaSpace, - e.generateHarmonics = this._generateHarmonics, - e.customType = "BABYLON.HDRCubeTexture", - e.noMipmap = this._noMipmap, - e.isBlocking = this._isBlocking, - e.rotationY = this._rotationY, - e - } - , - t._facesMapping = ["right", "left", "up", "down", "front", "back"], - t - }(jn.a); - s.a.RegisteredTypes["BABYLON.HDRCubeTexture"] = Kr; - var Qr = function() { - function e(e, t, i) { - void 0 === t && (t = 0), - void 0 === i && (i = null), - this.name = e, - this.animations = new Array, - this._positions = null, - this._normals = null, - this._tangents = null, - this.onInfluenceChanged = new o.c, - this._onDataLayoutChanged = new o.c, - this._animationPropertiesOverride = null, - this._scene = i || R.a.LastCreatedScene, - this.influence = t - } - return Object.defineProperty(e.prototype, "influence", { - get: function() { - return this._influence - }, - set: function(e) { - if (this._influence !== e) { - var t = this._influence; - this._influence = e, - this.onInfluenceChanged.hasObservers && this.onInfluenceChanged.notifyObservers(0 === t || 0 === e) + ); + }), + (t.prototype.delayLoad = function () { + this.delayLoadState === ve.b.DELAYLOADSTATE_NOTLOADED && + ((this.delayLoadState = ve.b.DELAYLOADSTATE_LOADED), + (this._texture = this._getFromCache( + this.url, + this._noMipmap + )), + this._texture || this.loadTexture()); + }), + (t.prototype.getReflectionTextureMatrix = function () { + return this._textureMatrix; + }), + (t.prototype.setReflectionTextureMatrix = function (e) { + var t = this; + (this._textureMatrix = e), + e.updateFlag !== this._textureMatrix.updateFlag && + e.isIdentity() !== this._textureMatrix.isIdentity() && + this.getScene().markAllMaterialsAsDirty( + _.a.MATERIAL_TextureDirtyFlag, + function (e) { + return -1 !== e.getActiveTextures().indexOf(t); } + ); + }), + (t.Parse = function (e, i, n) { + var r = null; + return ( + e.name && + !e.isRenderTarget && + (((r = new t( + n + e.name, + i, + e.size, + e.noMipmap, + e.generateHarmonics, + e.useInGammaSpace + )).name = e.name), + (r.hasAlpha = e.hasAlpha), + (r.level = e.level), + (r.coordinatesMode = e.coordinatesMode), + (r.isBlocking = e.isBlocking)), + r && + (e.boundingBoxPosition && + (r.boundingBoxPosition = a.x.FromArray( + e.boundingBoxPosition + )), + e.boundingBoxSize && + (r.boundingBoxSize = a.x.FromArray( + e.boundingBoxSize + )), + e.rotationY && (r.rotationY = e.rotationY)), + r + ); + }), + (t.prototype.serialize = function () { + if (!this.name) return null; + var e = {}; + return ( + (e.name = this.name), + (e.hasAlpha = this.hasAlpha), + (e.isCube = true), + (e.level = this.level), + (e.size = this._size), + (e.coordinatesMode = this.coordinatesMode), + (e.useInGammaSpace = this.gammaSpace), + (e.generateHarmonics = this._generateHarmonics), + (e.customType = "BABYLON.HDRCubeTexture"), + (e.noMipmap = this._noMipmap), + (e.isBlocking = this._isBlocking), + (e.rotationY = this._rotationY), + e + ); + }), + (t._facesMapping = [ + "right", + "left", + "up", + "down", + "front", + "back", + ]), + t + ); + })(jn.a); + s.a.RegisteredTypes["BABYLON.HDRCubeTexture"] = Kr; + var Qr = (function () { + function e(e, t, i) { + void 0 === t && (t = 0), + void 0 === i && (i = null), + (this.name = e), + (this.animations = new Array()), + (this._positions = null), + (this._normals = null), + (this._tangents = null), + (this.onInfluenceChanged = new o.c()), + (this._onDataLayoutChanged = new o.c()), + (this._animationPropertiesOverride = null), + (this._scene = i || R.a.LastCreatedScene), + (this.influence = t); + } + return ( + Object.defineProperty(e.prototype, "influence", { + get: function () { + return this._influence; + }, + set: function (e) { + if (this._influence !== e) { + var t = this._influence; + (this._influence = e), + this.onInfluenceChanged.hasObservers && + this.onInfluenceChanged.notifyObservers( + 0 === t || 0 === e + ); + } + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "animationPropertiesOverride", + { + get: function () { + return !this._animationPropertiesOverride && + this._scene + ? this._scene.animationPropertiesOverride + : this._animationPropertiesOverride; + }, + set: function (e) { + this._animationPropertiesOverride = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "animationPropertiesOverride", { - get: function() { - return !this._animationPropertiesOverride && this._scene ? this._scene.animationPropertiesOverride : this._animationPropertiesOverride - }, - set: function(e) { - this._animationPropertiesOverride = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "hasPositions", { - get: function() { - return !!this._positions - }, - enumerable: true, - configurable: true + get: function () { + return !!this._positions; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "hasNormals", { - get: function() { - return !!this._normals - }, - enumerable: true, - configurable: true + get: function () { + return !!this._normals; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "hasTangents", { - get: function() { - return !!this._tangents - }, - enumerable: true, - configurable: true + get: function () { + return !!this._tangents; + }, + enumerable: true, + configurable: true, }), - e.prototype.setPositions = function(e) { - var t = this.hasPositions; - this._positions = e, - t !== this.hasPositions && this._onDataLayoutChanged.notifyObservers(void 0) - } - , - e.prototype.getPositions = function() { - return this._positions - } - , - e.prototype.setNormals = function(e) { - var t = this.hasNormals; - this._normals = e, - t !== this.hasNormals && this._onDataLayoutChanged.notifyObservers(void 0) - } - , - e.prototype.getNormals = function() { - return this._normals - } - , - e.prototype.setTangents = function(e) { - var t = this.hasTangents; - this._tangents = e, - t !== this.hasTangents && this._onDataLayoutChanged.notifyObservers(void 0) - } - , - e.prototype.getTangents = function() { - return this._tangents - } - , - e.prototype.serialize = function() { - var e = {}; - return e.name = this.name, - e.influence = this.influence, - e.positions = Array.prototype.slice.call(this.getPositions()), + (e.prototype.setPositions = function (e) { + var t = this.hasPositions; + (this._positions = e), + t !== this.hasPositions && + this._onDataLayoutChanged.notifyObservers(void 0); + }), + (e.prototype.getPositions = function () { + return this._positions; + }), + (e.prototype.setNormals = function (e) { + var t = this.hasNormals; + (this._normals = e), + t !== this.hasNormals && + this._onDataLayoutChanged.notifyObservers(void 0); + }), + (e.prototype.getNormals = function () { + return this._normals; + }), + (e.prototype.setTangents = function (e) { + var t = this.hasTangents; + (this._tangents = e), + t !== this.hasTangents && + this._onDataLayoutChanged.notifyObservers(void 0); + }), + (e.prototype.getTangents = function () { + return this._tangents; + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.name = this.name), + (e.influence = this.influence), + (e.positions = Array.prototype.slice.call( + this.getPositions() + )), null != this.id && (e.id = this.id), - this.hasNormals && (e.normals = Array.prototype.slice.call(this.getNormals())), - this.hasTangents && (e.tangents = Array.prototype.slice.call(this.getTangents())), + this.hasNormals && + (e.normals = Array.prototype.slice.call( + this.getNormals() + )), + this.hasTangents && + (e.tangents = Array.prototype.slice.call( + this.getTangents() + )), F.a.AppendSerializedAnimations(this, e), e - } - , - e.prototype.getClassName = function() { - return "MorphTarget" - } - , - e.Parse = function(t) { - var i = new e(t.name,t.influence); - if (i.setPositions(t.positions), + ); + }), + (e.prototype.getClassName = function () { + return "MorphTarget"; + }), + (e.Parse = function (t) { + var i = new e(t.name, t.influence); + if ( + (i.setPositions(t.positions), null != t.id && (i.id = t.id), t.normals && i.setNormals(t.normals), t.tangents && i.setTangents(t.tangents), t.animations) - for (var n = 0; n < t.animations.length; n++) { - var r = t.animations[n] - , o = s.a.GetClass("BABYLON.Animation"); - o && i.animations.push(o.Parse(r)) - } - return i - } - , - e.FromMesh = function(t, i, n) { - i || (i = t.name); - var r = new e(i,n,t.getScene()); - return r.setPositions(t.getVerticesData(Si.b.PositionKind)), - t.isVerticesDataPresent(Si.b.NormalKind) && r.setNormals(t.getVerticesData(Si.b.NormalKind)), - t.isVerticesDataPresent(Si.b.TangentKind) && r.setTangents(t.getVerticesData(Si.b.TangentKind)), + ) + for (var n = 0; n < t.animations.length; n++) { + var r = t.animations[n], + o = s.a.GetClass("BABYLON.Animation"); + o && i.animations.push(o.Parse(r)); + } + return i; + }), + (e.FromMesh = function (t, i, n) { + i || (i = t.name); + var r = new e(i, n, t.getScene()); + return ( + r.setPositions(t.getVerticesData(Si.b.PositionKind)), + t.isVerticesDataPresent(Si.b.NormalKind) && + r.setNormals(t.getVerticesData(Si.b.NormalKind)), + t.isVerticesDataPresent(Si.b.TangentKind) && + r.setTangents(t.getVerticesData(Si.b.TangentKind)), r - } - , + ); + }), h.c([Object(F.c)()], e.prototype, "id", void 0), e - }() - , qr = function() { - function e(e) { - void 0 === e && (e = null), - this._targets = new Array, - this._targetInfluenceChangedObservers = new Array, - this._targetDataLayoutChangedObservers = new Array, - this._activeTargets = new jt.a(16), - this._supportsNormals = false, - this._supportsTangents = false, - this._vertexCount = 0, - this._uniqueId = 0, - this._tempInfluences = new Array, - e || (e = R.a.LastCreatedScene), - this._scene = e, - this._scene && (this._scene.morphTargetManagers.push(this), - this._uniqueId = this._scene.getUniqueId()) - } - return Object.defineProperty(e.prototype, "uniqueId", { - get: function() { - return this._uniqueId - }, - enumerable: true, - configurable: true + ); + })(), + qr = (function () { + function e(e) { + void 0 === e && (e = null), + (this._targets = new Array()), + (this._targetInfluenceChangedObservers = new Array()), + (this._targetDataLayoutChangedObservers = new Array()), + (this._activeTargets = new jt.a(16)), + (this._supportsNormals = false), + (this._supportsTangents = false), + (this._vertexCount = 0), + (this._uniqueId = 0), + (this._tempInfluences = new Array()), + e || (e = R.a.LastCreatedScene), + (this._scene = e), + this._scene && + (this._scene.morphTargetManagers.push(this), + (this._uniqueId = this._scene.getUniqueId())); + } + return ( + Object.defineProperty(e.prototype, "uniqueId", { + get: function () { + return this._uniqueId; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "vertexCount", { - get: function() { - return this._vertexCount - }, - enumerable: true, - configurable: true + get: function () { + return this._vertexCount; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "supportsNormals", { - get: function() { - return this._supportsNormals - }, - enumerable: true, - configurable: true + get: function () { + return this._supportsNormals; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "supportsTangents", { - get: function() { - return this._supportsTangents - }, - enumerable: true, - configurable: true + get: function () { + return this._supportsTangents; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "numTargets", { - get: function() { - return this._targets.length - }, - enumerable: true, - configurable: true + get: function () { + return this._targets.length; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "numInfluencers", { - get: function() { - return this._activeTargets.length - }, - enumerable: true, - configurable: true + get: function () { + return this._activeTargets.length; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "influences", { - get: function() { - return this._influences - }, - enumerable: true, - configurable: true + get: function () { + return this._influences; + }, + enumerable: true, + configurable: true, }), - e.prototype.getActiveTarget = function(e) { - return this._activeTargets.data[e] - } - , - e.prototype.getTarget = function(e) { - return this._targets[e] - } - , - e.prototype.addTarget = function(e) { - var t = this; - this._targets.push(e), - this._targetInfluenceChangedObservers.push(e.onInfluenceChanged.add(function(e) { - t._syncActiveTargets(e) - })), - this._targetDataLayoutChangedObservers.push(e._onDataLayoutChanged.add(function() { - t._syncActiveTargets(true) - })), - this._syncActiveTargets(true) - } - , - e.prototype.removeTarget = function(e) { - var t = this._targets.indexOf(e); - t >= 0 && (this._targets.splice(t, 1), - e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t, 1)[0]), - e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t, 1)[0]), - this._syncActiveTargets(true)) - } - , - e.prototype.serialize = function() { - var e = {}; - e.id = this.uniqueId, - e.targets = []; - for (var t = 0, i = this._targets; t < i.length; t++) { - var n = i[t]; - e.targets.push(n.serialize()) + (e.prototype.getActiveTarget = function (e) { + return this._activeTargets.data[e]; + }), + (e.prototype.getTarget = function (e) { + return this._targets[e]; + }), + (e.prototype.addTarget = function (e) { + var t = this; + this._targets.push(e), + this._targetInfluenceChangedObservers.push( + e.onInfluenceChanged.add(function (e) { + t._syncActiveTargets(e); + }) + ), + this._targetDataLayoutChangedObservers.push( + e._onDataLayoutChanged.add(function () { + t._syncActiveTargets(true); + }) + ), + this._syncActiveTargets(true); + }), + (e.prototype.removeTarget = function (e) { + var t = this._targets.indexOf(e); + t >= 0 && + (this._targets.splice(t, 1), + e.onInfluenceChanged.remove( + this._targetInfluenceChangedObservers.splice(t, 1)[0] + ), + e._onDataLayoutChanged.remove( + this._targetDataLayoutChangedObservers.splice(t, 1)[0] + ), + this._syncActiveTargets(true)); + }), + (e.prototype.serialize = function () { + var e = {}; + (e.id = this.uniqueId), (e.targets = []); + for (var t = 0, i = this._targets; t < i.length; t++) { + var n = i[t]; + e.targets.push(n.serialize()); + } + return e; + }), + (e.prototype._syncActiveTargets = function (e) { + var t = 0; + this._activeTargets.reset(), + (this._supportsNormals = true), + (this._supportsTangents = true), + (this._vertexCount = 0); + for (var i = 0, n = this._targets; i < n.length; i++) { + var r = n[i]; + if (0 !== r.influence) { + this._activeTargets.push(r), + (this._tempInfluences[t++] = r.influence), + (this._supportsNormals = + this._supportsNormals && r.hasNormals), + (this._supportsTangents = + this._supportsTangents && r.hasTangents); + var o = r.getPositions(); + if (o) { + var a = o.length / 3; + if (0 === this._vertexCount) this._vertexCount = a; + else if (this._vertexCount !== a) + return void g.a.Error( + "Incompatible target. Targets must all have the same vertices count." + ); + } } - return e - } - , - e.prototype._syncActiveTargets = function(e) { - var t = 0; - this._activeTargets.reset(), - this._supportsNormals = true, - this._supportsTangents = true, - this._vertexCount = 0; - for (var i = 0, n = this._targets; i < n.length; i++) { - var r = n[i]; - if (0 !== r.influence) { - this._activeTargets.push(r), - this._tempInfluences[t++] = r.influence, - this._supportsNormals = this._supportsNormals && r.hasNormals, - this._supportsTangents = this._supportsTangents && r.hasTangents; - var o = r.getPositions(); - if (o) { - var a = o.length / 3; - if (0 === this._vertexCount) - this._vertexCount = a; - else if (this._vertexCount !== a) - return void g.a.Error("Incompatible target. Targets must all have the same vertices count.") - } - } + } + (this._influences && this._influences.length === t) || + (this._influences = new Float32Array(t)); + for (var s = 0; s < t; s++) + this._influences[s] = this._tempInfluences[s]; + e && this.synchronize(); + }), + (e.prototype.synchronize = function () { + if (this._scene) + for ( + var e = 0, t = this._scene.meshes; + e < t.length; + e++ + ) { + var i = t[e]; + i.morphTargetManager === this && + i._syncGeometryWithMorphTargetManager(); } - this._influences && this._influences.length === t || (this._influences = new Float32Array(t)); - for (var s = 0; s < t; s++) - this._influences[s] = this._tempInfluences[s]; - e && this.synchronize() - } - , - e.prototype.synchronize = function() { - if (this._scene) - for (var e = 0, t = this._scene.meshes; e < t.length; e++) { - var i = t[e]; - i.morphTargetManager === this && i._syncGeometryWithMorphTargetManager() - } - } - , - e.Parse = function(t, i) { - var n = new e(i); - n._uniqueId = t.id; - for (var r = 0, o = t.targets; r < o.length; r++) { - var a = o[r]; - n.addTarget(Qr.Parse(a)) - } - return n - } - , + }), + (e.Parse = function (t, i) { + var n = new e(i); + n._uniqueId = t.id; + for (var r = 0, o = t.targets; r < o.length; r++) { + var a = o[r]; + n.addTarget(Qr.Parse(a)); + } + return n; + }), e - }() - , Zr = n(27) - , Jr = n(37) - , $r = function() { - function e(t, i) { - if (void 0 === i && (i = e.DefaultPluginFactory()), - this._physicsPlugin = i, - this._impostors = [], - this._joints = [], - !this._physicsPlugin.isSupported()) - throw new Error("Physics Engine " + this._physicsPlugin.name + " cannot be found. Please make sure it is included."); - t = t || new a.x(0,-9.807,0), - this.setGravity(t), - this.setTimeStep() - } - return e.DefaultPluginFactory = function() { - throw Te.a.WarnImport("CannonJSPlugin") - } - , - e.prototype.setGravity = function(e) { - this.gravity = e, - this._physicsPlugin.setGravity(this.gravity) - } - , - e.prototype.setTimeStep = function(e) { - void 0 === e && (e = 1 / 60), - this._physicsPlugin.setTimeStep(e) - } - , - e.prototype.getTimeStep = function() { - return this._physicsPlugin.getTimeStep() - } - , - e.prototype.dispose = function() { - this._impostors.forEach(function(e) { - e.dispose() - }), - this._physicsPlugin.dispose() - } - , - e.prototype.getPhysicsPluginName = function() { - return this._physicsPlugin.name - } - , - e.prototype.addImpostor = function(e) { - e.uniqueId = this._impostors.push(e), - e.parent || this._physicsPlugin.generatePhysicsBody(e) - } - , - e.prototype.removeImpostor = function(e) { - var t = this._impostors.indexOf(e); - t > -1 && this._impostors.splice(t, 1).length && this.getPhysicsPlugin().removePhysicsBody(e) - } - , - e.prototype.addJoint = function(e, t, i) { - var n = { - mainImpostor: e, - connectedImpostor: t, - joint: i - }; - i.physicsPlugin = this._physicsPlugin, + ); + })(), + Zr = n(27), + Jr = n(37), + $r = (function () { + function e(t, i) { + if ( + (void 0 === i && (i = e.DefaultPluginFactory()), + (this._physicsPlugin = i), + (this._impostors = []), + (this._joints = []), + !this._physicsPlugin.isSupported()) + ) + throw new Error( + "Physics Engine " + + this._physicsPlugin.name + + " cannot be found. Please make sure it is included." + ); + (t = t || new a.x(0, -9.807, 0)), + this.setGravity(t), + this.setTimeStep(); + } + return ( + (e.DefaultPluginFactory = function () { + throw Te.a.WarnImport("CannonJSPlugin"); + }), + (e.prototype.setGravity = function (e) { + (this.gravity = e), + this._physicsPlugin.setGravity(this.gravity); + }), + (e.prototype.setTimeStep = function (e) { + void 0 === e && (e = 1 / 60), + this._physicsPlugin.setTimeStep(e); + }), + (e.prototype.getTimeStep = function () { + return this._physicsPlugin.getTimeStep(); + }), + (e.prototype.dispose = function () { + this._impostors.forEach(function (e) { + e.dispose(); + }), + this._physicsPlugin.dispose(); + }), + (e.prototype.getPhysicsPluginName = function () { + return this._physicsPlugin.name; + }), + (e.prototype.addImpostor = function (e) { + (e.uniqueId = this._impostors.push(e)), + e.parent || this._physicsPlugin.generatePhysicsBody(e); + }), + (e.prototype.removeImpostor = function (e) { + var t = this._impostors.indexOf(e); + t > -1 && + this._impostors.splice(t, 1).length && + this.getPhysicsPlugin().removePhysicsBody(e); + }), + (e.prototype.addJoint = function (e, t, i) { + var n = { + mainImpostor: e, + connectedImpostor: t, + joint: i, + }; + (i.physicsPlugin = this._physicsPlugin), this._joints.push(n), - this._physicsPlugin.generateJoint(n) - } - , - e.prototype.removeJoint = function(e, t, i) { - var n = this._joints.filter(function(n) { - return n.connectedImpostor === t && n.joint === i && n.mainImpostor === e - }); - n.length && this._physicsPlugin.removeJoint(n[0]) - } - , - e.prototype._step = function(e) { - var t = this; - this._impostors.forEach(function(e) { - e.isBodyInitRequired() && t._physicsPlugin.generatePhysicsBody(e) - }), - e > .1 ? e = .1 : e <= 0 && (e = 1 / 60), - this._physicsPlugin.executeStep(e, this._impostors) - } - , - e.prototype.getPhysicsPlugin = function() { - return this._physicsPlugin - } - , - e.prototype.getImpostors = function() { - return this._impostors - } - , - e.prototype.getImpostorForPhysicsObject = function(e) { - for (var t = 0; t < this._impostors.length; ++t) - if (this._impostors[t].object === e) - return this._impostors[t]; - return null - } - , - e.prototype.getImpostorWithPhysicsBody = function(e) { - for (var t = 0; t < this._impostors.length; ++t) - if (this._impostors[t].physicsBody === e) - return this._impostors[t]; - return null - } - , - e.prototype.raycast = function(e, t) { - return this._physicsPlugin.raycast(e, t) - } - , - e.Epsilon = .001, + this._physicsPlugin.generateJoint(n); + }), + (e.prototype.removeJoint = function (e, t, i) { + var n = this._joints.filter(function (n) { + return ( + n.connectedImpostor === t && + n.joint === i && + n.mainImpostor === e + ); + }); + n.length && this._physicsPlugin.removeJoint(n[0]); + }), + (e.prototype._step = function (e) { + var t = this; + this._impostors.forEach(function (e) { + e.isBodyInitRequired() && + t._physicsPlugin.generatePhysicsBody(e); + }), + e > 0.1 ? (e = 0.1) : e <= 0 && (e = 1 / 60), + this._physicsPlugin.executeStep(e, this._impostors); + }), + (e.prototype.getPhysicsPlugin = function () { + return this._physicsPlugin; + }), + (e.prototype.getImpostors = function () { + return this._impostors; + }), + (e.prototype.getImpostorForPhysicsObject = function (e) { + for (var t = 0; t < this._impostors.length; ++t) + if (this._impostors[t].object === e) + return this._impostors[t]; + return null; + }), + (e.prototype.getImpostorWithPhysicsBody = function (e) { + for (var t = 0; t < this._impostors.length; ++t) + if (this._impostors[t].physicsBody === e) + return this._impostors[t]; + return null; + }), + (e.prototype.raycast = function (e, t) { + return this._physicsPlugin.raycast(e, t); + }), + (e.Epsilon = 0.001), e - }() - , eo = function() { - function e() { - this._hasHit = false, - this._hitDistance = 0, - this._hitNormalWorld = a.x.Zero(), - this._hitPointWorld = a.x.Zero(), - this._rayFromWorld = a.x.Zero(), - this._rayToWorld = a.x.Zero() - } - return Object.defineProperty(e.prototype, "hasHit", { - get: function() { - return this._hasHit - }, - enumerable: true, - configurable: true + ); + })(), + eo = (function () { + function e() { + (this._hasHit = false), + (this._hitDistance = 0), + (this._hitNormalWorld = a.x.Zero()), + (this._hitPointWorld = a.x.Zero()), + (this._rayFromWorld = a.x.Zero()), + (this._rayToWorld = a.x.Zero()); + } + return ( + Object.defineProperty(e.prototype, "hasHit", { + get: function () { + return this._hasHit; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "hitDistance", { - get: function() { - return this._hitDistance - }, - enumerable: true, - configurable: true + get: function () { + return this._hitDistance; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "hitNormalWorld", { - get: function() { - return this._hitNormalWorld - }, - enumerable: true, - configurable: true + get: function () { + return this._hitNormalWorld; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "hitPointWorld", { - get: function() { - return this._hitPointWorld - }, - enumerable: true, - configurable: true + get: function () { + return this._hitPointWorld; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "rayFromWorld", { - get: function() { - return this._rayFromWorld - }, - enumerable: true, - configurable: true + get: function () { + return this._rayFromWorld; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "rayToWorld", { - get: function() { - return this._rayToWorld - }, - enumerable: true, - configurable: true + get: function () { + return this._rayToWorld; + }, + enumerable: true, + configurable: true, }), - e.prototype.setHitData = function(e, t) { - this._hasHit = true, - this._hitNormalWorld = new a.x(e.x,e.y,e.z), - this._hitPointWorld = new a.x(t.x,t.y,t.z) - } - , - e.prototype.setHitDistance = function(e) { - this._hitDistance = e - } - , - e.prototype.calculateHitDistance = function() { - this._hitDistance = a.x.Distance(this._rayFromWorld, this._hitPointWorld) - } - , - e.prototype.reset = function(e, t) { - void 0 === e && (e = a.x.Zero()), + (e.prototype.setHitData = function (e, t) { + (this._hasHit = true), + (this._hitNormalWorld = new a.x(e.x, e.y, e.z)), + (this._hitPointWorld = new a.x(t.x, t.y, t.z)); + }), + (e.prototype.setHitDistance = function (e) { + this._hitDistance = e; + }), + (e.prototype.calculateHitDistance = function () { + this._hitDistance = a.x.Distance( + this._rayFromWorld, + this._hitPointWorld + ); + }), + (e.prototype.reset = function (e, t) { + void 0 === e && (e = a.x.Zero()), void 0 === t && (t = a.x.Zero()), - this._rayFromWorld = e, - this._rayToWorld = t, - this._hasHit = false, - this._hitDistance = 0, - this._hitNormalWorld = a.x.Zero(), - this._hitPointWorld = a.x.Zero() - } - , + (this._rayFromWorld = e), + (this._rayToWorld = t), + (this._hasHit = false), + (this._hitDistance = 0), + (this._hitNormalWorld = a.x.Zero()), + (this._hitPointWorld = a.x.Zero()); + }), e - }() - , to = function() { - function e(e, t, i) { - void 0 === e && (e = true), - void 0 === t && (t = 10), - void 0 === i && (i = CANNON), - this._useDeltaForWorldStep = e, - this.name = "CannonJSPlugin", - this._physicsMaterials = new Array, - this._fixedTimeStep = 1 / 60, - this._removeAfterStep = new Array, - this._minus90X = new a.q(-.7071067811865475,0,0,.7071067811865475), - this._plus90X = new a.q(.7071067811865475,0,0,.7071067811865475), - this._tmpPosition = a.x.Zero(), - this._tmpDeltaPosition = a.x.Zero(), - this._tmpUnityRotation = new a.q, - this.BJSCANNON = i, - this.isSupported() ? (this._extendNamespace(), - this.world = new this.BJSCANNON.World, - this.world.broadphase = new this.BJSCANNON.NaiveBroadphase, - this.world.solver.iterations = t, - this._cannonRaycastResult = new this.BJSCANNON.RaycastResult, - this._raycastResult = new eo) : g.a.Error("CannonJS is not available. Please make sure you included the js file.") - } - return e.prototype.setGravity = function(e) { - this.world.gravity.copy(e) - } - , - e.prototype.setTimeStep = function(e) { - this._fixedTimeStep = e - } - , - e.prototype.getTimeStep = function() { - return this._fixedTimeStep - } - , - e.prototype.executeStep = function(e) { - var t = this; - this.world.step(this._fixedTimeStep, this._useDeltaForWorldStep ? e : 0, 3), - this._removeAfterStep.length > 0 && (this._removeAfterStep.forEach(function(e) { - t.world.remove(e.physicsBody) - }), - this._removeAfterStep = []) - } - , - e.prototype.applyImpulse = function(e, t, i) { - var n = new this.BJSCANNON.Vec3(i.x,i.y,i.z) - , r = new this.BJSCANNON.Vec3(t.x,t.y,t.z); - e.physicsBody.applyImpulse(r, n) - } - , - e.prototype.applyForce = function(e, t, i) { - var n = new this.BJSCANNON.Vec3(i.x,i.y,i.z) - , r = new this.BJSCANNON.Vec3(t.x,t.y,t.z); - e.physicsBody.applyForce(r, n) - } - , - e.prototype.generatePhysicsBody = function(e) { - if (e.parent) - e.physicsBody && (this.removePhysicsBody(e), - e.forceUpdate()); - else { - if (e.isBodyInitRequired()) { - var t = this._createShape(e) - , i = e.physicsBody; - i && this.removePhysicsBody(e); - var n = this._addMaterial("mat-" + e.uniqueId, e.getParam("friction"), e.getParam("restitution")) - , r = { - mass: e.getParam("mass"), - material: n - } - , o = e.getParam("nativeOptions"); - for (var a in o) - o.hasOwnProperty(a) && (r[a] = o[a]); - e.physicsBody = new this.BJSCANNON.Body(r), - e.physicsBody.addEventListener("collide", e.onCollide), - this.world.addEventListener("preStep", e.beforeStep), - this.world.addEventListener("postStep", e.afterStep), - e.physicsBody.addShape(t), - this.world.add(e.physicsBody), - i && ["force", "torque", "velocity", "angularVelocity"].forEach(function(t) { - e.physicsBody[t].copy(i[t]) - }), - this._processChildMeshes(e) - } - this._updatePhysicsBodyTransformation(e) + ); + })(), + to = (function () { + function e(e, t, i) { + void 0 === e && (e = true), + void 0 === t && (t = 10), + void 0 === i && (i = CANNON), + (this._useDeltaForWorldStep = e), + (this.name = "CannonJSPlugin"), + (this._physicsMaterials = new Array()), + (this._fixedTimeStep = 1 / 60), + (this._removeAfterStep = new Array()), + (this._minus90X = new a.q( + -0.7071067811865475, + 0, + 0, + 0.7071067811865475 + )), + (this._plus90X = new a.q( + 0.7071067811865475, + 0, + 0, + 0.7071067811865475 + )), + (this._tmpPosition = a.x.Zero()), + (this._tmpDeltaPosition = a.x.Zero()), + (this._tmpUnityRotation = new a.q()), + (this.BJSCANNON = i), + this.isSupported() + ? (this._extendNamespace(), + (this.world = new this.BJSCANNON.World()), + (this.world.broadphase = + new this.BJSCANNON.NaiveBroadphase()), + (this.world.solver.iterations = t), + (this._cannonRaycastResult = + new this.BJSCANNON.RaycastResult()), + (this._raycastResult = new eo())) + : g.a.Error( + "CannonJS is not available. Please make sure you included the js file." + ); + } + return ( + (e.prototype.setGravity = function (e) { + this.world.gravity.copy(e); + }), + (e.prototype.setTimeStep = function (e) { + this._fixedTimeStep = e; + }), + (e.prototype.getTimeStep = function () { + return this._fixedTimeStep; + }), + (e.prototype.executeStep = function (e) { + var t = this; + this.world.step( + this._fixedTimeStep, + this._useDeltaForWorldStep ? e : 0, + 3 + ), + this._removeAfterStep.length > 0 && + (this._removeAfterStep.forEach(function (e) { + t.world.remove(e.physicsBody); + }), + (this._removeAfterStep = [])); + }), + (e.prototype.applyImpulse = function (e, t, i) { + var n = new this.BJSCANNON.Vec3(i.x, i.y, i.z), + r = new this.BJSCANNON.Vec3(t.x, t.y, t.z); + e.physicsBody.applyImpulse(r, n); + }), + (e.prototype.applyForce = function (e, t, i) { + var n = new this.BJSCANNON.Vec3(i.x, i.y, i.z), + r = new this.BJSCANNON.Vec3(t.x, t.y, t.z); + e.physicsBody.applyForce(r, n); + }), + (e.prototype.generatePhysicsBody = function (e) { + if (e.parent) + e.physicsBody && + (this.removePhysicsBody(e), e.forceUpdate()); + else { + if (e.isBodyInitRequired()) { + var t = this._createShape(e), + i = e.physicsBody; + i && this.removePhysicsBody(e); + var n = this._addMaterial( + "mat-" + e.uniqueId, + e.getParam("friction"), + e.getParam("restitution") + ), + r = { + mass: e.getParam("mass"), + material: n, + }, + o = e.getParam("nativeOptions"); + for (var a in o) o.hasOwnProperty(a) && (r[a] = o[a]); + (e.physicsBody = new this.BJSCANNON.Body(r)), + e.physicsBody.addEventListener( + "collide", + e.onCollide + ), + this.world.addEventListener( + "preStep", + e.beforeStep + ), + this.world.addEventListener( + "postStep", + e.afterStep + ), + e.physicsBody.addShape(t), + this.world.add(e.physicsBody), + i && + [ + "force", + "torque", + "velocity", + "angularVelocity", + ].forEach(function (t) { + e.physicsBody[t].copy(i[t]); + }), + this._processChildMeshes(e); } - } - , - e.prototype._processChildMeshes = function(e) { - var t = this - , i = e.object.getChildMeshes ? e.object.getChildMeshes(true) : [] - , n = e.object.rotationQuaternion; - if (i.length) { - i.filter(function(e) { - return !!e.physicsImpostor - }).forEach(function i(r, o) { - if (n && o.rotationQuaternion) { - var s = o.getPhysicsImpostor(); - if (s && s.parent !== e) { - var c = o.getAbsolutePosition().subtract(e.object.getAbsolutePosition()) - , u = o.rotationQuaternion.multiply(a.q.Inverse(n)); - s.physicsBody && (t.removePhysicsBody(s), - s.physicsBody = null), - s.parent = e, - s.resetUpdateFlags(), - e.physicsBody.addShape(t._createShape(s), new t.BJSCANNON.Vec3(c.x,c.y,c.z), new t.BJSCANNON.Quaternion(u.x,u.y,u.z,u.w)), - e.physicsBody.mass += s.getParam("mass") - } - n.multiplyInPlace(o.rotationQuaternion), - o.getChildMeshes(true).filter(function(e) { - return !!e.physicsImpostor - }).forEach(i.bind(t, o.getAbsolutePosition())) - } + this._updatePhysicsBodyTransformation(e); + } + }), + (e.prototype._processChildMeshes = function (e) { + var t = this, + i = e.object.getChildMeshes + ? e.object.getChildMeshes(true) + : [], + n = e.object.rotationQuaternion; + if (i.length) { + i.filter(function (e) { + return !!e.physicsImpostor; + }).forEach( + function i(r, o) { + if (n && o.rotationQuaternion) { + var s = o.getPhysicsImpostor(); + if (s && s.parent !== e) { + var c = o + .getAbsolutePosition() + .subtract(e.object.getAbsolutePosition()), + u = o.rotationQuaternion.multiply( + a.q.Inverse(n) + ); + s.physicsBody && + (t.removePhysicsBody(s), + (s.physicsBody = null)), + (s.parent = e), + s.resetUpdateFlags(), + e.physicsBody.addShape( + t._createShape(s), + new t.BJSCANNON.Vec3(c.x, c.y, c.z), + new t.BJSCANNON.Quaternion( + u.x, + u.y, + u.z, + u.w + ) + ), + (e.physicsBody.mass += s.getParam("mass")); + } + n.multiplyInPlace(o.rotationQuaternion), + o + .getChildMeshes(true) + .filter(function (e) { + return !!e.physicsImpostor; + }) + .forEach(i.bind(t, o.getAbsolutePosition())); } - .bind(this, e.object.getAbsolutePosition())) - } - } - , - e.prototype.removePhysicsBody = function(e) { - e.physicsBody.removeEventListener("collide", e.onCollide), + }.bind(this, e.object.getAbsolutePosition()) + ); + } + }), + (e.prototype.removePhysicsBody = function (e) { + e.physicsBody.removeEventListener("collide", e.onCollide), this.world.removeEventListener("preStep", e.beforeStep), this.world.removeEventListener("postStep", e.afterStep), - this._removeAfterStep.push(e) - } - , - e.prototype.generateJoint = function(e) { - var t = e.mainImpostor.physicsBody - , i = e.connectedImpostor.physicsBody; - if (t && i) { - var n, r = e.joint.jointData, o = { - pivotA: r.mainPivot ? (new this.BJSCANNON.Vec3).copy(r.mainPivot) : null, - pivotB: r.connectedPivot ? (new this.BJSCANNON.Vec3).copy(r.connectedPivot) : null, - axisA: r.mainAxis ? (new this.BJSCANNON.Vec3).copy(r.mainAxis) : null, - axisB: r.connectedAxis ? (new this.BJSCANNON.Vec3).copy(r.connectedAxis) : null, - maxForce: r.nativeParams.maxForce, - collideConnected: !!r.collision - }; - switch (e.joint.type) { - case Jr.e.HingeJoint: - case Jr.e.Hinge2Joint: - n = new this.BJSCANNON.HingeConstraint(t,i,o); - break; - case Jr.e.DistanceJoint: - n = new this.BJSCANNON.DistanceConstraint(t,i,r.maxDistance || 2); - break; - case Jr.e.SpringJoint: - var a = r; - n = new this.BJSCANNON.Spring(t,i,{ - restLength: a.length, - stiffness: a.stiffness, - damping: a.damping, - localAnchorA: o.pivotA, - localAnchorB: o.pivotB - }); - break; - case Jr.e.LockJoint: - n = new this.BJSCANNON.LockConstraint(t,i,o); - break; - case Jr.e.PointToPointJoint: - case Jr.e.BallAndSocketJoint: - default: - n = new this.BJSCANNON.PointToPointConstraint(t,o.pivotA,i,o.pivotB,o.maxForce) - } - n.collideConnected = !!r.collision, - e.joint.physicsJoint = n, - e.joint.type !== Jr.e.SpringJoint ? this.world.addConstraint(n) : (e.joint.jointData.forceApplicationCallback = e.joint.jointData.forceApplicationCallback || function() { - n.applyForce() - } - , - e.mainImpostor.registerAfterPhysicsStep(e.joint.jointData.forceApplicationCallback)) + this._removeAfterStep.push(e); + }), + (e.prototype.generateJoint = function (e) { + var t = e.mainImpostor.physicsBody, + i = e.connectedImpostor.physicsBody; + if (t && i) { + var n, + r = e.joint.jointData, + o = { + pivotA: r.mainPivot + ? new this.BJSCANNON.Vec3().copy(r.mainPivot) + : null, + pivotB: r.connectedPivot + ? new this.BJSCANNON.Vec3().copy(r.connectedPivot) + : null, + axisA: r.mainAxis + ? new this.BJSCANNON.Vec3().copy(r.mainAxis) + : null, + axisB: r.connectedAxis + ? new this.BJSCANNON.Vec3().copy(r.connectedAxis) + : null, + maxForce: r.nativeParams.maxForce, + collideConnected: !!r.collision, + }; + switch (e.joint.type) { + case Jr.e.HingeJoint: + case Jr.e.Hinge2Joint: + n = new this.BJSCANNON.HingeConstraint(t, i, o); + break; + case Jr.e.DistanceJoint: + n = new this.BJSCANNON.DistanceConstraint( + t, + i, + r.maxDistance || 2 + ); + break; + case Jr.e.SpringJoint: + var a = r; + n = new this.BJSCANNON.Spring(t, i, { + restLength: a.length, + stiffness: a.stiffness, + damping: a.damping, + localAnchorA: o.pivotA, + localAnchorB: o.pivotB, + }); + break; + case Jr.e.LockJoint: + n = new this.BJSCANNON.LockConstraint(t, i, o); + break; + case Jr.e.PointToPointJoint: + case Jr.e.BallAndSocketJoint: + default: + n = new this.BJSCANNON.PointToPointConstraint( + t, + o.pivotA, + i, + o.pivotB, + o.maxForce + ); } - } - , - e.prototype.removeJoint = function(e) { - e.joint.type !== Jr.e.SpringJoint ? this.world.removeConstraint(e.joint.physicsJoint) : e.mainImpostor.unregisterAfterPhysicsStep(e.joint.jointData.forceApplicationCallback) - } - , - e.prototype._addMaterial = function(e, t, i) { - var n, r; - for (n = 0; n < this._physicsMaterials.length; n++) - if ((r = this._physicsMaterials[n]).friction === t && r.restitution === i) - return r; - var o = new this.BJSCANNON.Material(e); - return o.friction = t, - o.restitution = i, + (n.collideConnected = !!r.collision), + (e.joint.physicsJoint = n), + e.joint.type !== Jr.e.SpringJoint + ? this.world.addConstraint(n) + : ((e.joint.jointData.forceApplicationCallback = + e.joint.jointData.forceApplicationCallback || + function () { + n.applyForce(); + }), + e.mainImpostor.registerAfterPhysicsStep( + e.joint.jointData.forceApplicationCallback + )); + } + }), + (e.prototype.removeJoint = function (e) { + e.joint.type !== Jr.e.SpringJoint + ? this.world.removeConstraint(e.joint.physicsJoint) + : e.mainImpostor.unregisterAfterPhysicsStep( + e.joint.jointData.forceApplicationCallback + ); + }), + (e.prototype._addMaterial = function (e, t, i) { + var n, r; + for (n = 0; n < this._physicsMaterials.length; n++) + if ( + (r = this._physicsMaterials[n]).friction === t && + r.restitution === i + ) + return r; + var o = new this.BJSCANNON.Material(e); + return ( + (o.friction = t), + (o.restitution = i), this._physicsMaterials.push(o), o - } - , - e.prototype._checkWithEpsilon = function(e) { - return e < $r.Epsilon ? $r.Epsilon : e - } - , - e.prototype._createShape = function(e) { - var t, i = e.object, n = e.getObjectExtendSize(); - switch (e.type) { + ); + }), + (e.prototype._checkWithEpsilon = function (e) { + return e < $r.Epsilon ? $r.Epsilon : e; + }), + (e.prototype._createShape = function (e) { + var t, + i = e.object, + n = e.getObjectExtendSize(); + switch (e.type) { case Zr.a.SphereImpostor: - var r = n.x - , o = n.y - , s = n.z; - t = new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(r), this._checkWithEpsilon(o), this._checkWithEpsilon(s)) / 2); - break; + var r = n.x, + o = n.y, + s = n.z; + t = new this.BJSCANNON.Sphere( + Math.max( + this._checkWithEpsilon(r), + this._checkWithEpsilon(o), + this._checkWithEpsilon(s) + ) / 2 + ); + break; case Zr.a.CylinderImpostor: - var c = e.getParam("nativeOptions"); - c || (c = {}); - var u = void 0 !== c.radiusTop ? c.radiusTop : this._checkWithEpsilon(n.x) / 2 - , l = void 0 !== c.radiusBottom ? c.radiusBottom : this._checkWithEpsilon(n.x) / 2 - , h = void 0 !== c.height ? c.height : this._checkWithEpsilon(n.y) - , f = void 0 !== c.numSegments ? c.numSegments : 16; - t = new this.BJSCANNON.Cylinder(u,l,h,f); - var d = new this.BJSCANNON.Quaternion; - d.setFromAxisAngle(new this.BJSCANNON.Vec3(1,0,0), -Math.PI / 2); - var p = new this.BJSCANNON.Vec3(0,0,0); - t.transformAllPoints(p, d); - break; + var c = e.getParam("nativeOptions"); + c || (c = {}); + var u = + void 0 !== c.radiusTop + ? c.radiusTop + : this._checkWithEpsilon(n.x) / 2, + l = + void 0 !== c.radiusBottom + ? c.radiusBottom + : this._checkWithEpsilon(n.x) / 2, + h = + void 0 !== c.height + ? c.height + : this._checkWithEpsilon(n.y), + f = void 0 !== c.numSegments ? c.numSegments : 16; + t = new this.BJSCANNON.Cylinder(u, l, h, f); + var d = new this.BJSCANNON.Quaternion(); + d.setFromAxisAngle( + new this.BJSCANNON.Vec3(1, 0, 0), + -Math.PI / 2 + ); + var p = new this.BJSCANNON.Vec3(0, 0, 0); + t.transformAllPoints(p, d); + break; case Zr.a.BoxImpostor: - var m = n.scale(.5); - t = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(m.x),this._checkWithEpsilon(m.y),this._checkWithEpsilon(m.z))); - break; + var m = n.scale(0.5); + t = new this.BJSCANNON.Box( + new this.BJSCANNON.Vec3( + this._checkWithEpsilon(m.x), + this._checkWithEpsilon(m.y), + this._checkWithEpsilon(m.z) + ) + ); + break; case Zr.a.PlaneImpostor: - g.a.Warn("Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead"), - t = new this.BJSCANNON.Plane; - break; + g.a.Warn( + "Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead" + ), + (t = new this.BJSCANNON.Plane()); + break; case Zr.a.MeshImpostor: - var _ = i.getVerticesData ? i.getVerticesData(Si.b.PositionKind) : [] - , v = i.getIndices ? i.getIndices() : []; - if (!_) - return; - var y = i.position.clone() - , b = i.rotation && i.rotation.clone() - , E = i.rotationQuaternion && i.rotationQuaternion.clone(); - i.position.copyFromFloats(0, 0, 0), + var _ = i.getVerticesData + ? i.getVerticesData(Si.b.PositionKind) + : [], + v = i.getIndices ? i.getIndices() : []; + if (!_) return; + var y = i.position.clone(), + b = i.rotation && i.rotation.clone(), + E = + i.rotationQuaternion && + i.rotationQuaternion.clone(); + i.position.copyFromFloats(0, 0, 0), i.rotation && i.rotation.copyFromFloats(0, 0, 0), - i.rotationQuaternion && i.rotationQuaternion.copyFrom(e.getParentsRotation()), - i.rotationQuaternion && i.parent && i.rotationQuaternion.conjugateInPlace(); - var T, A = i.computeWorldMatrix(true), x = new Array; - for (T = 0; T < _.length; T += 3) - a.x.TransformCoordinates(a.x.FromArray(_, T), A).toArray(x, T); - g.a.Warn("MeshImpostor only collides against spheres."), - t = new this.BJSCANNON.Trimesh(x,v), + i.rotationQuaternion && + i.rotationQuaternion.copyFrom( + e.getParentsRotation() + ), + i.rotationQuaternion && + i.parent && + i.rotationQuaternion.conjugateInPlace(); + var T, + A = i.computeWorldMatrix(true), + x = new Array(); + for (T = 0; T < _.length; T += 3) + a.x + .TransformCoordinates(a.x.FromArray(_, T), A) + .toArray(x, T); + g.a.Warn( + "MeshImpostor only collides against spheres." + ), + (t = new this.BJSCANNON.Trimesh(x, v)), i.position.copyFrom(y), b && i.rotation && i.rotation.copyFrom(b), - E && i.rotationQuaternion && i.rotationQuaternion.copyFrom(E); - break; + E && + i.rotationQuaternion && + i.rotationQuaternion.copyFrom(E); + break; case Zr.a.HeightmapImpostor: - var S = i.position.clone() - , C = i.rotation && i.rotation.clone() - , P = i.rotationQuaternion && i.rotationQuaternion.clone(); - i.position.copyFromFloats(0, 0, 0), + var S = i.position.clone(), + C = i.rotation && i.rotation.clone(), + P = + i.rotationQuaternion && + i.rotationQuaternion.clone(); + i.position.copyFromFloats(0, 0, 0), i.rotation && i.rotation.copyFromFloats(0, 0, 0), - i.rotationQuaternion && i.rotationQuaternion.copyFrom(e.getParentsRotation()), - i.rotationQuaternion && i.parent && i.rotationQuaternion.conjugateInPlace(), - i.rotationQuaternion && i.rotationQuaternion.multiplyInPlace(this._minus90X), - t = this._createHeightmap(i), + i.rotationQuaternion && + i.rotationQuaternion.copyFrom( + e.getParentsRotation() + ), + i.rotationQuaternion && + i.parent && + i.rotationQuaternion.conjugateInPlace(), + i.rotationQuaternion && + i.rotationQuaternion.multiplyInPlace( + this._minus90X + ), + (t = this._createHeightmap(i)), i.position.copyFrom(S), C && i.rotation && i.rotation.copyFrom(C), - P && i.rotationQuaternion && i.rotationQuaternion.copyFrom(P), + P && + i.rotationQuaternion && + i.rotationQuaternion.copyFrom(P), i.computeWorldMatrix(true); - break; + break; case Zr.a.ParticleImpostor: - t = new this.BJSCANNON.Particle; - break; + t = new this.BJSCANNON.Particle(); + break; case Zr.a.NoImpostor: - t = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(0,0,0)) + t = new this.BJSCANNON.Box( + new this.BJSCANNON.Vec3(0, 0, 0) + ); + } + return t; + }), + (e.prototype._createHeightmap = function (e, t) { + var i, + n = e.getVerticesData(Si.b.PositionKind), + r = e.computeWorldMatrix(true), + o = new Array(); + for (i = 0; i < n.length; i += 3) + a.x + .TransformCoordinates(a.x.FromArray(n, i), r) + .toArray(o, i); + n = o; + for ( + var s = new Array(), + c = t || ~~(Math.sqrt(n.length / 3) - 1), + u = e.getBoundingInfo(), + l = Math.min( + u.boundingBox.extendSizeWorld.x, + u.boundingBox.extendSizeWorld.y + ), + h = u.boundingBox.extendSizeWorld.z, + f = (2 * l) / c, + d = 0; + d < n.length; + d += 3 + ) { + var p = Math.round(n[d + 0] / f + c / 2), + m = Math.round(-1 * (n[d + 1] / f - c / 2)), + g = -n[d + 2] + h; + s[p] || (s[p] = []), + s[p][m] || (s[p][m] = g), + (s[p][m] = Math.max(g, s[p][m])); + } + for (p = 0; p <= c; ++p) { + if (!s[p]) { + for (var _ = 1; !s[(p + _) % c]; ) _++; + s[p] = s[(p + _) % c].slice(); } - return t - } - , - e.prototype._createHeightmap = function(e, t) { - var i, n = e.getVerticesData(Si.b.PositionKind), r = e.computeWorldMatrix(true), o = new Array; - for (i = 0; i < n.length; i += 3) - a.x.TransformCoordinates(a.x.FromArray(n, i), r).toArray(o, i); - n = o; - for (var s = new Array, c = t || ~~(Math.sqrt(n.length / 3) - 1), u = e.getBoundingInfo(), l = Math.min(u.boundingBox.extendSizeWorld.x, u.boundingBox.extendSizeWorld.y), h = u.boundingBox.extendSizeWorld.z, f = 2 * l / c, d = 0; d < n.length; d += 3) { - var p = Math.round(n[d + 0] / f + c / 2) - , m = Math.round(-1 * (n[d + 1] / f - c / 2)) - , g = -n[d + 2] + h; - s[p] || (s[p] = []), - s[p][m] || (s[p][m] = g), - s[p][m] = Math.max(g, s[p][m]) + for (m = 0; m <= c; ++m) + if (!s[p][m]) { + var v; + for (_ = 1; void 0 === v; ) v = s[p][(m + _++) % c]; + s[p][m] = v; + } + } + var y = new this.BJSCANNON.Heightfield(s, { + elementSize: f, + }); + return (y.minY = h), y; + }), + (e.prototype._updatePhysicsBodyTransformation = function ( + e + ) { + var t = e.object; + if ( + (t.computeWorldMatrix && t.computeWorldMatrix(true), + t.getBoundingInfo()) + ) { + var i = e.getObjectCenter(); + this._tmpDeltaPosition.copyFrom( + t.getAbsolutePivotPoint().subtract(i) + ), + this._tmpDeltaPosition.divideInPlace( + e.object.scaling + ), + this._tmpPosition.copyFrom(i); + var n = t.rotationQuaternion; + if (n) { + if ( + ((e.type !== Zr.a.PlaneImpostor && + e.type !== Zr.a.HeightmapImpostor) || + ((n = n.multiply(this._minus90X)), + e.setDeltaRotation(this._plus90X)), + e.type === Zr.a.HeightmapImpostor) + ) { + var r = t, + o = r.getBoundingInfo(), + s = r.rotationQuaternion; + (r.rotationQuaternion = this._tmpUnityRotation), + r.computeWorldMatrix(true); + var c = i.clone(), + u = r.getPivotMatrix(); + u = u ? u.clone() : a.j.Identity(); + var l = a.j.Translation( + o.boundingBox.extendSizeWorld.x, + 0, + -o.boundingBox.extendSizeWorld.z + ); + r.setPreTransformMatrix(l), + r.computeWorldMatrix(true); + var h = o.boundingBox.centerWorld + .subtract(i) + .subtract(r.position) + .negate(); + this._tmpPosition.copyFromFloats( + h.x, + h.y - o.boundingBox.extendSizeWorld.y, + h.z + ), + this._tmpDeltaPosition.copyFrom( + o.boundingBox.centerWorld.subtract(c) + ), + (this._tmpDeltaPosition.y += + o.boundingBox.extendSizeWorld.y), + (r.rotationQuaternion = s), + r.setPreTransformMatrix(u), + r.computeWorldMatrix(true); + } else + e.type === Zr.a.MeshImpostor && + this._tmpDeltaPosition.copyFromFloats(0, 0, 0); + e.setDeltaPosition(this._tmpDeltaPosition), + e.physicsBody.position.copy(this._tmpPosition), + e.physicsBody.quaternion.copy(n); } - for (p = 0; p <= c; ++p) { - if (!s[p]) { - for (var _ = 1; !s[(p + _) % c]; ) - _++; - s[p] = s[(p + _) % c].slice() - } - for (m = 0; m <= c; ++m) - if (!s[p][m]) { - var v; - for (_ = 1; void 0 === v; ) - v = s[p][(m + _++) % c]; - s[p][m] = v - } - } - var y = new this.BJSCANNON.Heightfield(s,{ - elementSize: f - }); - return y.minY = h, - y - } - , - e.prototype._updatePhysicsBodyTransformation = function(e) { - var t = e.object; - if (t.computeWorldMatrix && t.computeWorldMatrix(true), - t.getBoundingInfo()) { - var i = e.getObjectCenter(); - this._tmpDeltaPosition.copyFrom(t.getAbsolutePivotPoint().subtract(i)), - this._tmpDeltaPosition.divideInPlace(e.object.scaling), - this._tmpPosition.copyFrom(i); - var n = t.rotationQuaternion; - if (n) { - if (e.type !== Zr.a.PlaneImpostor && e.type !== Zr.a.HeightmapImpostor || (n = n.multiply(this._minus90X), - e.setDeltaRotation(this._plus90X)), - e.type === Zr.a.HeightmapImpostor) { - var r = t - , o = r.getBoundingInfo() - , s = r.rotationQuaternion; - r.rotationQuaternion = this._tmpUnityRotation, - r.computeWorldMatrix(true); - var c = i.clone() - , u = r.getPivotMatrix(); - u = u ? u.clone() : a.j.Identity(); - var l = a.j.Translation(o.boundingBox.extendSizeWorld.x, 0, -o.boundingBox.extendSizeWorld.z); - r.setPreTransformMatrix(l), - r.computeWorldMatrix(true); - var h = o.boundingBox.centerWorld.subtract(i).subtract(r.position).negate(); - this._tmpPosition.copyFromFloats(h.x, h.y - o.boundingBox.extendSizeWorld.y, h.z), - this._tmpDeltaPosition.copyFrom(o.boundingBox.centerWorld.subtract(c)), - this._tmpDeltaPosition.y += o.boundingBox.extendSizeWorld.y, - r.rotationQuaternion = s, - r.setPreTransformMatrix(u), - r.computeWorldMatrix(true) - } else - e.type === Zr.a.MeshImpostor && this._tmpDeltaPosition.copyFromFloats(0, 0, 0); - e.setDeltaPosition(this._tmpDeltaPosition), - e.physicsBody.position.copy(this._tmpPosition), - e.physicsBody.quaternion.copy(n) - } - } - } - , - e.prototype.setTransformationFromPhysicsBody = function(e) { - e.object.position.copyFrom(e.physicsBody.position), - e.object.rotationQuaternion && e.object.rotationQuaternion.copyFrom(e.physicsBody.quaternion) - } - , - e.prototype.setPhysicsBodyTransformation = function(e, t, i) { - e.physicsBody.position.copy(t), - e.physicsBody.quaternion.copy(i) - } - , - e.prototype.isSupported = function() { - return void 0 !== this.BJSCANNON - } - , - e.prototype.setLinearVelocity = function(e, t) { - e.physicsBody.velocity.copy(t) - } - , - e.prototype.setAngularVelocity = function(e, t) { - e.physicsBody.angularVelocity.copy(t) - } - , - e.prototype.getLinearVelocity = function(e) { - var t = e.physicsBody.velocity; - return t ? new a.x(t.x,t.y,t.z) : null - } - , - e.prototype.getAngularVelocity = function(e) { - var t = e.physicsBody.angularVelocity; - return t ? new a.x(t.x,t.y,t.z) : null - } - , - e.prototype.setBodyMass = function(e, t) { - e.physicsBody.mass = t, - e.physicsBody.updateMassProperties() - } - , - e.prototype.getBodyMass = function(e) { - return e.physicsBody.mass - } - , - e.prototype.getBodyFriction = function(e) { - return e.physicsBody.material.friction - } - , - e.prototype.setBodyFriction = function(e, t) { - e.physicsBody.material.friction = t - } - , - e.prototype.getBodyRestitution = function(e) { - return e.physicsBody.material.restitution - } - , - e.prototype.setBodyRestitution = function(e, t) { - e.physicsBody.material.restitution = t - } - , - e.prototype.sleepBody = function(e) { - e.physicsBody.sleep() - } - , - e.prototype.wakeUpBody = function(e) { - e.physicsBody.wakeUp() - } - , - e.prototype.updateDistanceJoint = function(e, t) { - e.physicsJoint.distance = t - } - , - e.prototype.setMotor = function(e, t, i, n) { - n || (e.physicsJoint.enableMotor(), + } + }), + (e.prototype.setTransformationFromPhysicsBody = function ( + e + ) { + e.object.position.copyFrom(e.physicsBody.position), + e.object.rotationQuaternion && + e.object.rotationQuaternion.copyFrom( + e.physicsBody.quaternion + ); + }), + (e.prototype.setPhysicsBodyTransformation = function ( + e, + t, + i + ) { + e.physicsBody.position.copy(t), + e.physicsBody.quaternion.copy(i); + }), + (e.prototype.isSupported = function () { + return void 0 !== this.BJSCANNON; + }), + (e.prototype.setLinearVelocity = function (e, t) { + e.physicsBody.velocity.copy(t); + }), + (e.prototype.setAngularVelocity = function (e, t) { + e.physicsBody.angularVelocity.copy(t); + }), + (e.prototype.getLinearVelocity = function (e) { + var t = e.physicsBody.velocity; + return t ? new a.x(t.x, t.y, t.z) : null; + }), + (e.prototype.getAngularVelocity = function (e) { + var t = e.physicsBody.angularVelocity; + return t ? new a.x(t.x, t.y, t.z) : null; + }), + (e.prototype.setBodyMass = function (e, t) { + (e.physicsBody.mass = t), + e.physicsBody.updateMassProperties(); + }), + (e.prototype.getBodyMass = function (e) { + return e.physicsBody.mass; + }), + (e.prototype.getBodyFriction = function (e) { + return e.physicsBody.material.friction; + }), + (e.prototype.setBodyFriction = function (e, t) { + e.physicsBody.material.friction = t; + }), + (e.prototype.getBodyRestitution = function (e) { + return e.physicsBody.material.restitution; + }), + (e.prototype.setBodyRestitution = function (e, t) { + e.physicsBody.material.restitution = t; + }), + (e.prototype.sleepBody = function (e) { + e.physicsBody.sleep(); + }), + (e.prototype.wakeUpBody = function (e) { + e.physicsBody.wakeUp(); + }), + (e.prototype.updateDistanceJoint = function (e, t) { + e.physicsJoint.distance = t; + }), + (e.prototype.setMotor = function (e, t, i, n) { + n || + (e.physicsJoint.enableMotor(), e.physicsJoint.setMotorSpeed(t), - i && this.setLimit(e, i)) - } - , - e.prototype.setLimit = function(e, t, i) { - e.physicsJoint.motorEquation.maxForce = t, - e.physicsJoint.motorEquation.minForce = void 0 === i ? -t : i - } - , - e.prototype.syncMeshWithImpostor = function(e, t) { - var i = t.physicsBody; - e.position.x = i.position.x, - e.position.y = i.position.y, - e.position.z = i.position.z, - e.rotationQuaternion && (e.rotationQuaternion.x = i.quaternion.x, - e.rotationQuaternion.y = i.quaternion.y, - e.rotationQuaternion.z = i.quaternion.z, - e.rotationQuaternion.w = i.quaternion.w) - } - , - e.prototype.getRadius = function(e) { - return e.physicsBody.shapes[0].boundingSphereRadius - } - , - e.prototype.getBoxSizeToRef = function(e, t) { - var i = e.physicsBody.shapes[0]; - t.x = 2 * i.halfExtents.x, - t.y = 2 * i.halfExtents.y, - t.z = 2 * i.halfExtents.z - } - , - e.prototype.dispose = function() {} - , - e.prototype._extendNamespace = function() { - var e = new this.BJSCANNON.Vec3 - , t = this.BJSCANNON; - this.BJSCANNON.World.prototype.step = function(i, n, r) { - if (r = r || 10, - 0 === (n = n || 0)) - this.internalStep(i), - this.time += i; - else { - var o = Math.floor((this.time + n) / i) - Math.floor(this.time / i); - o = Math.min(o, r) || 1; - for (var a = performance.now(), s = 0; s !== o && (this.internalStep(i), - !(performance.now() - a > 1e3 * i)); s++) - ; - this.time += n; - for (var c = this.time % i / i, u = e, l = this.bodies, h = 0; h !== l.length; h++) { - var f = l[h]; - f.type !== t.Body.STATIC && f.sleepState !== t.Body.SLEEPING ? (f.position.vsub(f.previousPosition, u), - u.scale(c, u), - f.position.vadd(u, f.interpolatedPosition)) : (f.interpolatedPosition.copy(f.position), - f.interpolatedQuaternion.copy(f.quaternion)) - } - } - } - } - , - e.prototype.raycast = function(e, t) { - return this._cannonRaycastResult.reset(), - this.world.raycastClosest(e, t, {}, this._cannonRaycastResult), - this._raycastResult.reset(e, t), - this._cannonRaycastResult.hasHit && (this._raycastResult.setHitData({ - x: this._cannonRaycastResult.hitNormalWorld.x, - y: this._cannonRaycastResult.hitNormalWorld.y, - z: this._cannonRaycastResult.hitNormalWorld.z - }, { - x: this._cannonRaycastResult.hitPointWorld.x, - y: this._cannonRaycastResult.hitPointWorld.y, - z: this._cannonRaycastResult.hitPointWorld.z - }), - this._raycastResult.setHitDistance(this._cannonRaycastResult.distance)), - this._raycastResult - } - , - e - }(); - $r.DefaultPluginFactory = function() { - return new to - } - ; - var io = function() { - function e(e, t) { - void 0 === t && (t = OIMO), - this.name = "OimoJSPlugin", - this._tmpImpostorsArray = [], - this._tmpPositionVector = a.x.Zero(), - this.BJSOIMO = t, - this.world = new this.BJSOIMO.World({ - iterations: e - }), - this.world.clear(), - this._raycastResult = new eo - } - return e.prototype.setGravity = function(e) { - this.world.gravity.copy(e) - } - , - e.prototype.setTimeStep = function(e) { - this.world.timeStep = e - } - , - e.prototype.getTimeStep = function() { - return this.world.timeStep - } - , - e.prototype.executeStep = function(e, t) { - var i = this; - t.forEach(function(e) { - e.beforeStep() - }), - this.world.step(), - t.forEach(function(e) { - e.afterStep(), - i._tmpImpostorsArray[e.uniqueId] = e - }); - for (var n = this.world.contacts; null !== n; ) - if (!n.touching || n.body1.sleeping || n.body2.sleeping) { - var r = this._tmpImpostorsArray[+n.body1.name] - , o = this._tmpImpostorsArray[+n.body2.name]; - r && o ? (r.onCollide({ - body: o.physicsBody - }), - o.onCollide({ - body: r.physicsBody - }), - n = n.next) : n = n.next - } else - n = n.next - } - , - e.prototype.applyImpulse = function(e, t, i) { - var n = e.physicsBody.mass; - e.physicsBody.applyImpulse(i.scale(this.world.invScale), t.scale(this.world.invScale * n)) - } - , - e.prototype.applyForce = function(e, t, i) { - g.a.Warn("Oimo doesn't support applying force. Using impule instead."), - this.applyImpulse(e, t, i) - } - , - e.prototype.generatePhysicsBody = function(e) { - var t = this; - if (e.parent) - e.physicsBody && (this.removePhysicsBody(e), - e.forceUpdate()); + i && this.setLimit(e, i)); + }), + (e.prototype.setLimit = function (e, t, i) { + (e.physicsJoint.motorEquation.maxForce = t), + (e.physicsJoint.motorEquation.minForce = + void 0 === i ? -t : i); + }), + (e.prototype.syncMeshWithImpostor = function (e, t) { + var i = t.physicsBody; + (e.position.x = i.position.x), + (e.position.y = i.position.y), + (e.position.z = i.position.z), + e.rotationQuaternion && + ((e.rotationQuaternion.x = i.quaternion.x), + (e.rotationQuaternion.y = i.quaternion.y), + (e.rotationQuaternion.z = i.quaternion.z), + (e.rotationQuaternion.w = i.quaternion.w)); + }), + (e.prototype.getRadius = function (e) { + return e.physicsBody.shapes[0].boundingSphereRadius; + }), + (e.prototype.getBoxSizeToRef = function (e, t) { + var i = e.physicsBody.shapes[0]; + (t.x = 2 * i.halfExtents.x), + (t.y = 2 * i.halfExtents.y), + (t.z = 2 * i.halfExtents.z); + }), + (e.prototype.dispose = function () {}), + (e.prototype._extendNamespace = function () { + var e = new this.BJSCANNON.Vec3(), + t = this.BJSCANNON; + this.BJSCANNON.World.prototype.step = function (i, n, r) { + if (((r = r || 10), 0 === (n = n || 0))) + this.internalStep(i), (this.time += i); else { - if (e.isBodyInitRequired()) { - var i = { - name: e.uniqueId, - config: [e.getParam("mass") || 1, e.getParam("friction"), e.getParam("restitution")], - size: [], - type: [], - pos: [], - posShape: [], - rot: [], - rotShape: [], - move: 0 !== e.getParam("mass"), - density: e.getParam("mass"), - friction: e.getParam("friction"), - restitution: e.getParam("restitution"), - world: this.world - } - , n = [e]; - (s = e.object).getChildMeshes && s.getChildMeshes().forEach(function(e) { - e.physicsImpostor && n.push(e.physicsImpostor) - }); - var r = function(e) { - return Math.max(e, $r.Epsilon) - } - , o = new a.q; - n.forEach(function(n) { - if (n.object.rotationQuaternion) { - var a = n.object.rotationQuaternion; - o = a.clone(); - var s = a.toEulerAngles() - , c = n.getObjectExtendSize(); - if (n === e) { - var u = e.getObjectCenter(); - e.object.getAbsolutePivotPoint().subtractToRef(u, t._tmpPositionVector), - t._tmpPositionVector.divideInPlace(e.object.scaling), - i.pos.push(u.x), - i.pos.push(u.y), - i.pos.push(u.z), - i.posShape.push(0, 0, 0), - i.rotShape.push(0, 0, 0) - } else { - var l = n.object.getAbsolutePosition().subtract(e.object.getAbsolutePosition()); - i.posShape.push(l.x), - i.posShape.push(l.y), - i.posShape.push(l.z), - i.pos.push(0, 0, 0), - i.rotShape.push(57.29577951308232 * s.x), - i.rotShape.push(57.29577951308232 * s.y), - i.rotShape.push(57.29577951308232 * s.z) - } - switch (n.type) { - case Zr.a.ParticleImpostor: - g.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead"); - case Zr.a.SphereImpostor: - var h = c.x - , f = c.y - , d = c.z - , p = Math.max(r(h), r(f), r(d)) / 2; - i.type.push("sphere"), - i.size.push(p), - i.size.push(p), - i.size.push(p); - break; - case Zr.a.CylinderImpostor: - var m = r(c.x) / 2 - , _ = r(c.y); - i.type.push("cylinder"), - i.size.push(m), - i.size.push(_), - i.size.push(_); - break; - case Zr.a.PlaneImpostor: - case Zr.a.BoxImpostor: - default: - m = r(c.x), - _ = r(c.y); - var v = r(c.z); - i.type.push("box"), - i.size.push(m), - i.size.push(_), - i.size.push(v) - } - n.object.rotationQuaternion = a - } - }), - e.physicsBody = this.world.add(i), - e.physicsBody.resetQuaternion(o), - e.physicsBody.updatePosition(0) - } else - this._tmpPositionVector.copyFromFloats(0, 0, 0); - var s; - e.setDeltaPosition(this._tmpPositionVector) + var o = + Math.floor((this.time + n) / i) - + Math.floor(this.time / i); + o = Math.min(o, r) || 1; + for ( + var a = performance.now(), s = 0; + s !== o && + (this.internalStep(i), + !(performance.now() - a > 1e3 * i)); + s++ + ); + this.time += n; + for ( + var c = (this.time % i) / i, + u = e, + l = this.bodies, + h = 0; + h !== l.length; + h++ + ) { + var f = l[h]; + f.type !== t.Body.STATIC && + f.sleepState !== t.Body.SLEEPING + ? (f.position.vsub(f.previousPosition, u), + u.scale(c, u), + f.position.vadd(u, f.interpolatedPosition)) + : (f.interpolatedPosition.copy(f.position), + f.interpolatedQuaternion.copy(f.quaternion)); + } } - } - , - e.prototype.removePhysicsBody = function(e) { - this.world.removeRigidBody(e.physicsBody) - } - , - e.prototype.generateJoint = function(e) { - var t = e.mainImpostor.physicsBody - , i = e.connectedImpostor.physicsBody; - if (t && i) { - var n, r = e.joint.jointData, o = r.nativeParams || {}, a = { - body1: t, - body2: i, - axe1: o.axe1 || (r.mainAxis ? r.mainAxis.asArray() : null), - axe2: o.axe2 || (r.connectedAxis ? r.connectedAxis.asArray() : null), - pos1: o.pos1 || (r.mainPivot ? r.mainPivot.asArray() : null), - pos2: o.pos2 || (r.connectedPivot ? r.connectedPivot.asArray() : null), - min: o.min, - max: o.max, - collision: o.collision || r.collision, - spring: o.spring, - world: this.world - }; - switch (e.joint.type) { - case Jr.e.BallAndSocketJoint: - n = "jointBall"; - break; - case Jr.e.SpringJoint: - g.a.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead"); - var s = r; - a.min = s.length || a.min, - a.max = Math.max(a.min, a.max); - case Jr.e.DistanceJoint: - n = "jointDistance", - a.max = r.maxDistance; - break; - case Jr.e.PrismaticJoint: - n = "jointPrisme"; - break; - case Jr.e.SliderJoint: - n = "jointSlide"; - break; - case Jr.e.WheelJoint: - n = "jointWheel"; - break; - case Jr.e.HingeJoint: - default: - n = "jointHinge" - } - a.type = n, - e.joint.physicsJoint = this.world.add(a) - } - } - , - e.prototype.removeJoint = function(e) { - try { - this.world.removeJoint(e.joint.physicsJoint) - } catch (e) { - g.a.Warn(e) - } - } - , - e.prototype.isSupported = function() { - return void 0 !== this.BJSOIMO - } - , - e.prototype.setTransformationFromPhysicsBody = function(e) { - e.physicsBody.sleeping || (e.object.position.copyFrom(e.physicsBody.getPosition()), - e.object.rotationQuaternion && e.object.rotationQuaternion.copyFrom(e.physicsBody.getQuaternion())) - } - , - e.prototype.setPhysicsBodyTransformation = function(e, t, i) { - var n = e.physicsBody; - n.position.copy(t), - n.orientation.copy(i), - n.syncShapes(), - n.awake() - } - , - e.prototype.setLinearVelocity = function(e, t) { - e.physicsBody.linearVelocity.copy(t) - } - , - e.prototype.setAngularVelocity = function(e, t) { - e.physicsBody.angularVelocity.copy(t) - } - , - e.prototype.getLinearVelocity = function(e) { - var t = e.physicsBody.linearVelocity; - return t ? new a.x(t.x,t.y,t.z) : null - } - , - e.prototype.getAngularVelocity = function(e) { - var t = e.physicsBody.angularVelocity; - return t ? new a.x(t.x,t.y,t.z) : null - } - , - e.prototype.setBodyMass = function(e, t) { - var i = 0 === t; - e.physicsBody.shapes.density = i ? 1 : t, - e.physicsBody.setupMass(i ? 2 : 1) - } - , - e.prototype.getBodyMass = function(e) { - return e.physicsBody.shapes.density - } - , - e.prototype.getBodyFriction = function(e) { - return e.physicsBody.shapes.friction - } - , - e.prototype.setBodyFriction = function(e, t) { - e.physicsBody.shapes.friction = t - } - , - e.prototype.getBodyRestitution = function(e) { - return e.physicsBody.shapes.restitution - } - , - e.prototype.setBodyRestitution = function(e, t) { - e.physicsBody.shapes.restitution = t - } - , - e.prototype.sleepBody = function(e) { - e.physicsBody.sleep() - } - , - e.prototype.wakeUpBody = function(e) { - e.physicsBody.awake() - } - , - e.prototype.updateDistanceJoint = function(e, t, i) { - e.physicsJoint.limitMotor.upperLimit = t, - void 0 !== i && (e.physicsJoint.limitMotor.lowerLimit = i) - } - , - e.prototype.setMotor = function(e, t, i, n) { - void 0 !== i ? g.a.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with force parameter") : i = 1e6, - t *= -1; - var r = n ? e.physicsJoint.rotationalLimitMotor2 : e.physicsJoint.rotationalLimitMotor1 || e.physicsJoint.rotationalLimitMotor || e.physicsJoint.limitMotor; - r && r.setMotor(t, i) - } - , - e.prototype.setLimit = function(e, t, i, n) { - var r = n ? e.physicsJoint.rotationalLimitMotor2 : e.physicsJoint.rotationalLimitMotor1 || e.physicsJoint.rotationalLimitMotor || e.physicsJoint.limitMotor; - r && r.setLimit(t, void 0 === i ? -t : i) - } - , - e.prototype.syncMeshWithImpostor = function(e, t) { - var i = t.physicsBody; - e.position.x = i.position.x, - e.position.y = i.position.y, - e.position.z = i.position.z, - e.rotationQuaternion && (e.rotationQuaternion.x = i.orientation.x, - e.rotationQuaternion.y = i.orientation.y, - e.rotationQuaternion.z = i.orientation.z, - e.rotationQuaternion.w = i.orientation.s) - } - , - e.prototype.getRadius = function(e) { - return e.physicsBody.shapes.radius - } - , - e.prototype.getBoxSizeToRef = function(e, t) { - var i = e.physicsBody.shapes; - t.x = 2 * i.halfWidth, - t.y = 2 * i.halfHeight, - t.z = 2 * i.halfDepth - } - , - e.prototype.dispose = function() { - this.world.clear() - } - , - e.prototype.raycast = function(e, t) { - return g.a.Warn("raycast is not currently supported by the Oimo physics plugin"), + }; + }), + (e.prototype.raycast = function (e, t) { + return ( + this._cannonRaycastResult.reset(), + this.world.raycastClosest( + e, + t, + {}, + this._cannonRaycastResult + ), this._raycastResult.reset(e, t), + this._cannonRaycastResult.hasHit && + (this._raycastResult.setHitData( + { + x: this._cannonRaycastResult.hitNormalWorld.x, + y: this._cannonRaycastResult.hitNormalWorld.y, + z: this._cannonRaycastResult.hitNormalWorld.z, + }, + { + x: this._cannonRaycastResult.hitPointWorld.x, + y: this._cannonRaycastResult.hitPointWorld.y, + z: this._cannonRaycastResult.hitPointWorld.z, + } + ), + this._raycastResult.setHitDistance( + this._cannonRaycastResult.distance + )), this._raycastResult - } - , + ); + }), e - }(); - xi.a.CreateRibbon = function(e) { - var t = e.pathArray - , i = e.closeArray || false - , n = e.closePath || false - , r = e.invertUV || false - , o = Math.floor(t[0].length / 2) - , a = e.offset || o; - a = a > o ? o : Math.floor(a); - var s, c, u, l, h = 0 === e.sideOrientation ? 0 : e.sideOrientation || xi.a.DEFAULTSIDE, f = e.uvs, d = e.colors, p = [], m = [], g = [], _ = [], v = [], y = [], b = [], E = [], T = [], A = []; - if (t.length < 2) { - var x = [] - , S = []; - for (u = 0; u < t[0].length - a; u++) - x.push(t[0][u]), - S.push(t[0][u + a]); - t = [x, S] - } - var C, P, R, M, O, w = 0, I = n ? 1 : 0; - for (s = t[0].length, - c = 0; c < t.length; c++) { - for (b[c] = 0, - v[c] = [0], - s = s < (P = (C = t[c]).length) ? s : P, - l = 0; l < P; ) - p.push(C[l].x, C[l].y, C[l].z), - l > 0 && (R = C[l].subtract(C[l - 1]).length() + b[c], - v[c].push(R), - b[c] = R), - l++; - n && (l--, - p.push(C[0].x, C[0].y, C[0].z), - R = C[l].subtract(C[0]).length() + b[c], - v[c].push(R), - b[c] = R), - T[c] = P + I, - A[c] = w, - w += P + I - } - var D, L, F = null, B = null; - for (u = 0; u < s + I; u++) { - for (E[u] = 0, - y[u] = [0], - c = 0; c < t.length - 1; c++) - M = t[c], - O = t[c + 1], - u === s ? (F = M[0], - B = O[0]) : (F = M[u], - B = O[u]), - R = B.subtract(F).length() + E[u], - y[u].push(R), - E[u] = R; - i && B && F && (M = t[c], - O = t[0], - u === s && (B = O[0]), - R = B.subtract(F).length() + E[u], - E[u] = R) - } - if (f) - for (c = 0; c < f.length; c++) - _.push(f[c].x, f[c].y); - else - for (c = 0; c < t.length; c++) - for (u = 0; u < s + I; u++) - D = 0 != b[c] ? v[c][u] / b[c] : 0, - L = 0 != E[u] ? y[u][c] / E[u] : 0, - r ? _.push(L, D) : _.push(D, L); - for (var N = 0, k = T[c = 0] - 1, U = T[c + 1] - 1, V = k < U ? k : U, G = A[1] - A[0], z = i ? T.length : T.length - 1; N <= V && c < z; ) - m.push(N, N + G, N + 1), - m.push(N + G + 1, N + 1, N + G), - (N += 1) === V && (++c == T.length - 1 ? (G = A[0] - A[c], - k = T[c] - 1, - U = T[0] - 1) : (G = A[c + 1] - A[c], - k = T[c] - 1, - U = T[c + 1] - 1), - N = A[c], - V = k < U ? k + N : U + N); - if (xi.a.ComputeNormals(p, m, g), - n) { - var j = 0 - , H = 0; - for (c = 0; c < t.length; c++) - j = 3 * A[c], - H = c + 1 < t.length ? 3 * (A[c + 1] - 1) : g.length - 3, - g[j] = .5 * (g[j] + g[H]), - g[j + 1] = .5 * (g[j + 1] + g[H + 1]), - g[j + 2] = .5 * (g[j + 2] + g[H + 2]), - g[H] = g[j], - g[H + 1] = g[j + 1], - g[H + 2] = g[j + 2] - } - xi.a._ComputeSides(h, p, m, g, _, e.frontUVs, e.backUVs); - var W = null; - if (d) { - W = new Float32Array(4 * d.length); - for (var X = 0; X < d.length; X++) - W[4 * X] = d[X].r, - W[4 * X + 1] = d[X].g, - W[4 * X + 2] = d[X].b, - W[4 * X + 3] = d[X].a - } - var Y = new xi.a - , K = new Float32Array(p) - , Q = new Float32Array(g) - , q = new Float32Array(_); - return Y.indices = m, - Y.positions = K, - Y.normals = Q, - Y.uvs = q, - W && Y.set(W, Si.b.ColorKind), - n && (Y._idx = A), - Y + ); + })(); + $r.DefaultPluginFactory = function () { + return new to(); + }; + var io = (function () { + function e(e, t) { + void 0 === t && (t = OIMO), + (this.name = "OimoJSPlugin"), + (this._tmpImpostorsArray = []), + (this._tmpPositionVector = a.x.Zero()), + (this.BJSOIMO = t), + (this.world = new this.BJSOIMO.World({ + iterations: e, + })), + this.world.clear(), + (this._raycastResult = new eo()); } - , - me.a.CreateRibbon = function(e, t, i, n, r, o, a, s, c) { - return void 0 === i && (i = false), + return ( + (e.prototype.setGravity = function (e) { + this.world.gravity.copy(e); + }), + (e.prototype.setTimeStep = function (e) { + this.world.timeStep = e; + }), + (e.prototype.getTimeStep = function () { + return this.world.timeStep; + }), + (e.prototype.executeStep = function (e, t) { + var i = this; + t.forEach(function (e) { + e.beforeStep(); + }), + this.world.step(), + t.forEach(function (e) { + e.afterStep(), (i._tmpImpostorsArray[e.uniqueId] = e); + }); + for (var n = this.world.contacts; null !== n; ) + if (!n.touching || n.body1.sleeping || n.body2.sleeping) { + var r = this._tmpImpostorsArray[+n.body1.name], + o = this._tmpImpostorsArray[+n.body2.name]; + r && o + ? (r.onCollide({ + body: o.physicsBody, + }), + o.onCollide({ + body: r.physicsBody, + }), + (n = n.next)) + : (n = n.next); + } else n = n.next; + }), + (e.prototype.applyImpulse = function (e, t, i) { + var n = e.physicsBody.mass; + e.physicsBody.applyImpulse( + i.scale(this.world.invScale), + t.scale(this.world.invScale * n) + ); + }), + (e.prototype.applyForce = function (e, t, i) { + g.a.Warn( + "Oimo doesn't support applying force. Using impule instead." + ), + this.applyImpulse(e, t, i); + }), + (e.prototype.generatePhysicsBody = function (e) { + var t = this; + if (e.parent) + e.physicsBody && + (this.removePhysicsBody(e), e.forceUpdate()); + else { + if (e.isBodyInitRequired()) { + var i = { + name: e.uniqueId, + config: [ + e.getParam("mass") || 1, + e.getParam("friction"), + e.getParam("restitution"), + ], + size: [], + type: [], + pos: [], + posShape: [], + rot: [], + rotShape: [], + move: 0 !== e.getParam("mass"), + density: e.getParam("mass"), + friction: e.getParam("friction"), + restitution: e.getParam("restitution"), + world: this.world, + }, + n = [e]; + (s = e.object).getChildMeshes && + s.getChildMeshes().forEach(function (e) { + e.physicsImpostor && n.push(e.physicsImpostor); + }); + var r = function (e) { + return Math.max(e, $r.Epsilon); + }, + o = new a.q(); + n.forEach(function (n) { + if (n.object.rotationQuaternion) { + var a = n.object.rotationQuaternion; + o = a.clone(); + var s = a.toEulerAngles(), + c = n.getObjectExtendSize(); + if (n === e) { + var u = e.getObjectCenter(); + e.object + .getAbsolutePivotPoint() + .subtractToRef(u, t._tmpPositionVector), + t._tmpPositionVector.divideInPlace( + e.object.scaling + ), + i.pos.push(u.x), + i.pos.push(u.y), + i.pos.push(u.z), + i.posShape.push(0, 0, 0), + i.rotShape.push(0, 0, 0); + } else { + var l = n.object + .getAbsolutePosition() + .subtract(e.object.getAbsolutePosition()); + i.posShape.push(l.x), + i.posShape.push(l.y), + i.posShape.push(l.z), + i.pos.push(0, 0, 0), + i.rotShape.push(57.29577951308232 * s.x), + i.rotShape.push(57.29577951308232 * s.y), + i.rotShape.push(57.29577951308232 * s.z); + } + switch (n.type) { + case Zr.a.ParticleImpostor: + g.a.Warn( + "No Particle support in OIMO.js. using SphereImpostor instead" + ); + case Zr.a.SphereImpostor: + var h = c.x, + f = c.y, + d = c.z, + p = Math.max(r(h), r(f), r(d)) / 2; + i.type.push("sphere"), + i.size.push(p), + i.size.push(p), + i.size.push(p); + break; + case Zr.a.CylinderImpostor: + var m = r(c.x) / 2, + _ = r(c.y); + i.type.push("cylinder"), + i.size.push(m), + i.size.push(_), + i.size.push(_); + break; + case Zr.a.PlaneImpostor: + case Zr.a.BoxImpostor: + default: + (m = r(c.x)), (_ = r(c.y)); + var v = r(c.z); + i.type.push("box"), + i.size.push(m), + i.size.push(_), + i.size.push(v); + } + n.object.rotationQuaternion = a; + } + }), + (e.physicsBody = this.world.add(i)), + e.physicsBody.resetQuaternion(o), + e.physicsBody.updatePosition(0); + } else this._tmpPositionVector.copyFromFloats(0, 0, 0); + var s; + e.setDeltaPosition(this._tmpPositionVector); + } + }), + (e.prototype.removePhysicsBody = function (e) { + this.world.removeRigidBody(e.physicsBody); + }), + (e.prototype.generateJoint = function (e) { + var t = e.mainImpostor.physicsBody, + i = e.connectedImpostor.physicsBody; + if (t && i) { + var n, + r = e.joint.jointData, + o = r.nativeParams || {}, + a = { + body1: t, + body2: i, + axe1: + o.axe1 || + (r.mainAxis ? r.mainAxis.asArray() : null), + axe2: + o.axe2 || + (r.connectedAxis + ? r.connectedAxis.asArray() + : null), + pos1: + o.pos1 || + (r.mainPivot ? r.mainPivot.asArray() : null), + pos2: + o.pos2 || + (r.connectedPivot + ? r.connectedPivot.asArray() + : null), + min: o.min, + max: o.max, + collision: o.collision || r.collision, + spring: o.spring, + world: this.world, + }; + switch (e.joint.type) { + case Jr.e.BallAndSocketJoint: + n = "jointBall"; + break; + case Jr.e.SpringJoint: + g.a.Warn( + "OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead" + ); + var s = r; + (a.min = s.length || a.min), + (a.max = Math.max(a.min, a.max)); + case Jr.e.DistanceJoint: + (n = "jointDistance"), (a.max = r.maxDistance); + break; + case Jr.e.PrismaticJoint: + n = "jointPrisme"; + break; + case Jr.e.SliderJoint: + n = "jointSlide"; + break; + case Jr.e.WheelJoint: + n = "jointWheel"; + break; + case Jr.e.HingeJoint: + default: + n = "jointHinge"; + } + (a.type = n), (e.joint.physicsJoint = this.world.add(a)); + } + }), + (e.prototype.removeJoint = function (e) { + try { + this.world.removeJoint(e.joint.physicsJoint); + } catch (e) { + g.a.Warn(e); + } + }), + (e.prototype.isSupported = function () { + return void 0 !== this.BJSOIMO; + }), + (e.prototype.setTransformationFromPhysicsBody = function (e) { + e.physicsBody.sleeping || + (e.object.position.copyFrom(e.physicsBody.getPosition()), + e.object.rotationQuaternion && + e.object.rotationQuaternion.copyFrom( + e.physicsBody.getQuaternion() + )); + }), + (e.prototype.setPhysicsBodyTransformation = function ( + e, + t, + i + ) { + var n = e.physicsBody; + n.position.copy(t), + n.orientation.copy(i), + n.syncShapes(), + n.awake(); + }), + (e.prototype.setLinearVelocity = function (e, t) { + e.physicsBody.linearVelocity.copy(t); + }), + (e.prototype.setAngularVelocity = function (e, t) { + e.physicsBody.angularVelocity.copy(t); + }), + (e.prototype.getLinearVelocity = function (e) { + var t = e.physicsBody.linearVelocity; + return t ? new a.x(t.x, t.y, t.z) : null; + }), + (e.prototype.getAngularVelocity = function (e) { + var t = e.physicsBody.angularVelocity; + return t ? new a.x(t.x, t.y, t.z) : null; + }), + (e.prototype.setBodyMass = function (e, t) { + var i = 0 === t; + (e.physicsBody.shapes.density = i ? 1 : t), + e.physicsBody.setupMass(i ? 2 : 1); + }), + (e.prototype.getBodyMass = function (e) { + return e.physicsBody.shapes.density; + }), + (e.prototype.getBodyFriction = function (e) { + return e.physicsBody.shapes.friction; + }), + (e.prototype.setBodyFriction = function (e, t) { + e.physicsBody.shapes.friction = t; + }), + (e.prototype.getBodyRestitution = function (e) { + return e.physicsBody.shapes.restitution; + }), + (e.prototype.setBodyRestitution = function (e, t) { + e.physicsBody.shapes.restitution = t; + }), + (e.prototype.sleepBody = function (e) { + e.physicsBody.sleep(); + }), + (e.prototype.wakeUpBody = function (e) { + e.physicsBody.awake(); + }), + (e.prototype.updateDistanceJoint = function (e, t, i) { + (e.physicsJoint.limitMotor.upperLimit = t), + void 0 !== i && + (e.physicsJoint.limitMotor.lowerLimit = i); + }), + (e.prototype.setMotor = function (e, t, i, n) { + void 0 !== i + ? g.a.Warn( + "OimoJS plugin currently has unexpected behavior when using setMotor with force parameter" + ) + : (i = 1e6), + (t *= -1); + var r = n + ? e.physicsJoint.rotationalLimitMotor2 + : e.physicsJoint.rotationalLimitMotor1 || + e.physicsJoint.rotationalLimitMotor || + e.physicsJoint.limitMotor; + r && r.setMotor(t, i); + }), + (e.prototype.setLimit = function (e, t, i, n) { + var r = n + ? e.physicsJoint.rotationalLimitMotor2 + : e.physicsJoint.rotationalLimitMotor1 || + e.physicsJoint.rotationalLimitMotor || + e.physicsJoint.limitMotor; + r && r.setLimit(t, void 0 === i ? -t : i); + }), + (e.prototype.syncMeshWithImpostor = function (e, t) { + var i = t.physicsBody; + (e.position.x = i.position.x), + (e.position.y = i.position.y), + (e.position.z = i.position.z), + e.rotationQuaternion && + ((e.rotationQuaternion.x = i.orientation.x), + (e.rotationQuaternion.y = i.orientation.y), + (e.rotationQuaternion.z = i.orientation.z), + (e.rotationQuaternion.w = i.orientation.s)); + }), + (e.prototype.getRadius = function (e) { + return e.physicsBody.shapes.radius; + }), + (e.prototype.getBoxSizeToRef = function (e, t) { + var i = e.physicsBody.shapes; + (t.x = 2 * i.halfWidth), + (t.y = 2 * i.halfHeight), + (t.z = 2 * i.halfDepth); + }), + (e.prototype.dispose = function () { + this.world.clear(); + }), + (e.prototype.raycast = function (e, t) { + return ( + g.a.Warn( + "raycast is not currently supported by the Oimo physics plugin" + ), + this._raycastResult.reset(e, t), + this._raycastResult + ); + }), + e + ); + })(); + (xi.a.CreateRibbon = function (e) { + var t = e.pathArray, + i = e.closeArray || false, + n = e.closePath || false, + r = e.invertUV || false, + o = Math.floor(t[0].length / 2), + a = e.offset || o; + a = a > o ? o : Math.floor(a); + var s, + c, + u, + l, + h = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || xi.a.DEFAULTSIDE, + f = e.uvs, + d = e.colors, + p = [], + m = [], + g = [], + _ = [], + v = [], + y = [], + b = [], + E = [], + T = [], + A = []; + if (t.length < 2) { + var x = [], + S = []; + for (u = 0; u < t[0].length - a; u++) + x.push(t[0][u]), S.push(t[0][u + a]); + t = [x, S]; + } + var C, + P, + R, + M, + O, + w = 0, + I = n ? 1 : 0; + for (s = t[0].length, c = 0; c < t.length; c++) { + for ( + b[c] = 0, + v[c] = [0], + s = s < (P = (C = t[c]).length) ? s : P, + l = 0; + l < P; + + ) + p.push(C[l].x, C[l].y, C[l].z), + l > 0 && + ((R = C[l].subtract(C[l - 1]).length() + b[c]), + v[c].push(R), + (b[c] = R)), + l++; + n && + (l--, + p.push(C[0].x, C[0].y, C[0].z), + (R = C[l].subtract(C[0]).length() + b[c]), + v[c].push(R), + (b[c] = R)), + (T[c] = P + I), + (A[c] = w), + (w += P + I); + } + var D, + L, + F = null, + B = null; + for (u = 0; u < s + I; u++) { + for (E[u] = 0, y[u] = [0], c = 0; c < t.length - 1; c++) + (M = t[c]), + (O = t[c + 1]), + u === s + ? ((F = M[0]), (B = O[0])) + : ((F = M[u]), (B = O[u])), + (R = B.subtract(F).length() + E[u]), + y[u].push(R), + (E[u] = R); + i && + B && + F && + ((M = t[c]), + (O = t[0]), + u === s && (B = O[0]), + (R = B.subtract(F).length() + E[u]), + (E[u] = R)); + } + if (f) for (c = 0; c < f.length; c++) _.push(f[c].x, f[c].y); + else + for (c = 0; c < t.length; c++) + for (u = 0; u < s + I; u++) + (D = 0 != b[c] ? v[c][u] / b[c] : 0), + (L = 0 != E[u] ? y[u][c] / E[u] : 0), + r ? _.push(L, D) : _.push(D, L); + for ( + var N = 0, + k = T[(c = 0)] - 1, + U = T[c + 1] - 1, + V = k < U ? k : U, + G = A[1] - A[0], + z = i ? T.length : T.length - 1; + N <= V && c < z; + + ) + m.push(N, N + G, N + 1), + m.push(N + G + 1, N + 1, N + G), + (N += 1) === V && + (++c == T.length - 1 + ? ((G = A[0] - A[c]), (k = T[c] - 1), (U = T[0] - 1)) + : ((G = A[c + 1] - A[c]), + (k = T[c] - 1), + (U = T[c + 1] - 1)), + (N = A[c]), + (V = k < U ? k + N : U + N)); + if ((xi.a.ComputeNormals(p, m, g), n)) { + var j = 0, + H = 0; + for (c = 0; c < t.length; c++) + (j = 3 * A[c]), + (H = + c + 1 < t.length ? 3 * (A[c + 1] - 1) : g.length - 3), + (g[j] = 0.5 * (g[j] + g[H])), + (g[j + 1] = 0.5 * (g[j + 1] + g[H + 1])), + (g[j + 2] = 0.5 * (g[j + 2] + g[H + 2])), + (g[H] = g[j]), + (g[H + 1] = g[j + 1]), + (g[H + 2] = g[j + 2]); + } + xi.a._ComputeSides(h, p, m, g, _, e.frontUVs, e.backUVs); + var W = null; + if (d) { + W = new Float32Array(4 * d.length); + for (var X = 0; X < d.length; X++) + (W[4 * X] = d[X].r), + (W[4 * X + 1] = d[X].g), + (W[4 * X + 2] = d[X].b), + (W[4 * X + 3] = d[X].a); + } + var Y = new xi.a(), + K = new Float32Array(p), + Q = new Float32Array(g), + q = new Float32Array(_); + return ( + (Y.indices = m), + (Y.positions = K), + (Y.normals = Q), + (Y.uvs = q), + W && Y.set(W, Si.b.ColorKind), + n && (Y._idx = A), + Y + ); + }), + (me.a.CreateRibbon = function (e, t, i, n, r, o, a, s, c) { + return ( + void 0 === i && (i = false), void 0 === a && (a = false), - no.CreateRibbon(e, { + no.CreateRibbon( + e, + { pathArray: t, closeArray: i, closePath: n, offset: r, updatable: a, sideOrientation: s, - instance: c - }, o) - } - ; - var no = function() { - function e() {} - return e.CreateRibbon = function(e, t, i) { - void 0 === i && (i = null); - var n = t.pathArray - , r = t.closeArray - , o = t.closePath - , s = me.a._GetDefaultSideOrientation(t.sideOrientation) - , c = t.instance - , u = t.updatable; - if (c) { - var l = a.t.Vector3[0].setAll(Number.MAX_VALUE) - , h = a.t.Vector3[1].setAll(-Number.MAX_VALUE) - , f = c.getVerticesData(Si.b.PositionKind); - if (function(e) { - for (var t = n[0].length, i = c, r = 0, o = i._originalBuilderSideOrientation === me.a.DOUBLESIDE ? 2 : 1, a = 1; a <= o; ++a) - for (var s = 0; s < n.length; ++s) { - var u = n[s] - , f = u.length; - t = t < f ? t : f; - for (var d = 0; d < t; ++d) { - var p = u[d]; - e[r] = p.x, - e[r + 1] = p.y, - e[r + 2] = p.z, - l.minimizeInPlaceFromFloats(p.x, p.y, p.z), - h.maximizeInPlaceFromFloats(p.x, p.y, p.z), - r += 3 - } - i._creationDataStorage && i._creationDataStorage.closePath && (p = u[0], - e[r] = p.x, - e[r + 1] = p.y, - e[r + 2] = p.z, - r += 3) - } - }(f), - c._boundingInfo ? c._boundingInfo.reConstruct(l, h, c._worldMatrix) : c._boundingInfo = new $i.a(l,h,c._worldMatrix), - c.updateVerticesData(Si.b.PositionKind, f, false, false), - t.colors) { - for (var d = c.getVerticesData(Si.b.ColorKind), p = 0, m = 0; p < t.colors.length; p++, - m += 4) { - var g = t.colors[p]; - d[m] = g.r, - d[m + 1] = g.g, - d[m + 2] = g.b, - d[m + 3] = g.a - } - c.updateVerticesData(Si.b.ColorKind, d, false, false) + instance: c, + }, + o + ) + ); + }); + var no = (function () { + function e() {} + return ( + (e.CreateRibbon = function (e, t, i) { + void 0 === i && (i = null); + var n = t.pathArray, + r = t.closeArray, + o = t.closePath, + s = me.a._GetDefaultSideOrientation(t.sideOrientation), + c = t.instance, + u = t.updatable; + if (c) { + var l = a.t.Vector3[0].setAll(Number.MAX_VALUE), + h = a.t.Vector3[1].setAll(-Number.MAX_VALUE), + f = c.getVerticesData(Si.b.PositionKind); + if ( + ((function (e) { + for ( + var t = n[0].length, + i = c, + r = 0, + o = + i._originalBuilderSideOrientation === + me.a.DOUBLESIDE + ? 2 + : 1, + a = 1; + a <= o; + ++a + ) + for (var s = 0; s < n.length; ++s) { + var u = n[s], + f = u.length; + t = t < f ? t : f; + for (var d = 0; d < t; ++d) { + var p = u[d]; + (e[r] = p.x), + (e[r + 1] = p.y), + (e[r + 2] = p.z), + l.minimizeInPlaceFromFloats(p.x, p.y, p.z), + h.maximizeInPlaceFromFloats(p.x, p.y, p.z), + (r += 3); + } + i._creationDataStorage && + i._creationDataStorage.closePath && + ((p = u[0]), + (e[r] = p.x), + (e[r + 1] = p.y), + (e[r + 2] = p.z), + (r += 3)); } - if (t.uvs) { - for (var _ = c.getVerticesData(Si.b.UVKind), v = 0; v < t.uvs.length; v++) - _[2 * v] = t.uvs[v].x, - _[2 * v + 1] = t.uvs[v].y; - c.updateVerticesData(Si.b.UVKind, _, false, false) - } - if (!c.areNormalsFrozen || c.isFacetDataEnabled) { - var y = c.getIndices() - , b = c.getVerticesData(Si.b.NormalKind) - , E = c.isFacetDataEnabled ? c.getFacetDataParameters() : null; - if (xi.a.ComputeNormals(f, y, b, E), - c._creationDataStorage && c._creationDataStorage.closePath) - for (var T = 0, A = 0, x = 0; x < n.length; x++) - T = 3 * c._creationDataStorage.idx[x], - A = x + 1 < n.length ? 3 * (c._creationDataStorage.idx[x + 1] - 1) : b.length - 3, - b[T] = .5 * (b[T] + b[A]), - b[T + 1] = .5 * (b[T + 1] + b[A + 1]), - b[T + 2] = .5 * (b[T + 2] + b[A + 2]), - b[A] = b[T], - b[A + 1] = b[T + 1], - b[A + 2] = b[T + 2]; - c.areNormalsFrozen || c.updateVerticesData(Si.b.NormalKind, b, false, false) - } - return c + })(f), + c._boundingInfo + ? c._boundingInfo.reConstruct(l, h, c._worldMatrix) + : (c._boundingInfo = new $i.a(l, h, c._worldMatrix)), + c.updateVerticesData( + Si.b.PositionKind, + f, + false, + false + ), + t.colors) + ) { + for ( + var d = c.getVerticesData(Si.b.ColorKind), + p = 0, + m = 0; + p < t.colors.length; + p++, m += 4 + ) { + var g = t.colors[p]; + (d[m] = g.r), + (d[m + 1] = g.g), + (d[m + 2] = g.b), + (d[m + 3] = g.a); } - var S = new me.a(e,i); - S._originalBuilderSideOrientation = s, - S._creationDataStorage = new me.b; - var C = xi.a.CreateRibbon(t); - return o && (S._creationDataStorage.idx = C._idx), - S._creationDataStorage.closePath = o, - S._creationDataStorage.closeArray = r, - C.applyToMesh(S, u), - S + c.updateVerticesData(Si.b.ColorKind, d, false, false); + } + if (t.uvs) { + for ( + var _ = c.getVerticesData(Si.b.UVKind), v = 0; + v < t.uvs.length; + v++ + ) + (_[2 * v] = t.uvs[v].x), (_[2 * v + 1] = t.uvs[v].y); + c.updateVerticesData(Si.b.UVKind, _, false, false); + } + if (!c.areNormalsFrozen || c.isFacetDataEnabled) { + var y = c.getIndices(), + b = c.getVerticesData(Si.b.NormalKind), + E = c.isFacetDataEnabled + ? c.getFacetDataParameters() + : null; + if ( + (xi.a.ComputeNormals(f, y, b, E), + c._creationDataStorage && + c._creationDataStorage.closePath) + ) + for (var T = 0, A = 0, x = 0; x < n.length; x++) + (T = 3 * c._creationDataStorage.idx[x]), + (A = + x + 1 < n.length + ? 3 * (c._creationDataStorage.idx[x + 1] - 1) + : b.length - 3), + (b[T] = 0.5 * (b[T] + b[A])), + (b[T + 1] = 0.5 * (b[T + 1] + b[A + 1])), + (b[T + 2] = 0.5 * (b[T + 2] + b[A + 2])), + (b[A] = b[T]), + (b[A + 1] = b[T + 1]), + (b[A + 2] = b[T + 2]); + c.areNormalsFrozen || + c.updateVerticesData( + Si.b.NormalKind, + b, + false, + false + ); + } + return c; } - , - e - }(); - me.a.ExtrudeShape = function(e, t, i, n, r, o, a, s, c, u) { - void 0 === a && (a = null); - var l = { - shape: t, - path: i, - scale: n, - rotation: r, - cap: 0 === o ? 0 : o || me.a.NO_CAP, - sideOrientation: c, - instance: u, - updatable: s - }; - return ro.ExtrudeShape(e, l, a) - } - , - me.a.ExtrudeShapeCustom = function(e, t, i, n, r, o, a, s, c, u, l, h) { - var f = { - shape: t, - path: i, - scaleFunction: n, - rotationFunction: r, - ribbonCloseArray: o, - ribbonClosePath: a, - cap: 0 === s ? 0 : s || me.a.NO_CAP, - sideOrientation: l, - instance: h, - updatable: u - }; - return ro.ExtrudeShapeCustom(e, f, c) - } - ; - var ro = function() { - function e() {} - return e.ExtrudeShape = function(t, i, n) { - void 0 === n && (n = null); - var r = i.path - , o = i.shape - , a = i.scale || 1 - , s = i.rotation || 0 - , c = 0 === i.cap ? 0 : i.cap || me.a.NO_CAP - , u = i.updatable - , l = me.a._GetDefaultSideOrientation(i.sideOrientation) - , h = i.instance || null - , f = i.invertUV || false; - return e._ExtrudeShapeGeneric(t, o, r, a, s, null, null, false, false, c, false, n, !!u, l, h, f, i.frontUVs || null, i.backUVs || null) - } - , - e.ExtrudeShapeCustom = function(t, i, n) { - void 0 === n && (n = null); - var r = i.path - , o = i.shape - , a = i.scaleFunction || function() { - return 1 - } - , s = i.rotationFunction || function() { - return 0 - } - , c = i.ribbonCloseArray || false - , u = i.ribbonClosePath || false - , l = 0 === i.cap ? 0 : i.cap || me.a.NO_CAP - , h = i.updatable - , f = me.a._GetDefaultSideOrientation(i.sideOrientation) - , d = i.instance - , p = i.invertUV || false; - return e._ExtrudeShapeGeneric(t, o, r, null, null, a, s, c, u, l, true, n, !!h, f, d || null, p, i.frontUVs || null, i.backUVs || null) - } - , - e._ExtrudeShapeGeneric = function(e, t, i, n, r, o, s, c, u, l, h, f, d, p, m, g, _, v) { - var y, b, E = function(e, t, i, n, r, o, s, c, u, l) { - for (var h = i.getTangents(), f = i.getNormals(), d = i.getBinormals(), p = i.getDistances(), m = 0, g = l && c ? c : function() { - return null !== o ? o : 0 + var S = new me.a(e, i); + (S._originalBuilderSideOrientation = s), + (S._creationDataStorage = new me.b()); + var C = xi.a.CreateRibbon(t); + return ( + o && (S._creationDataStorage.idx = C._idx), + (S._creationDataStorage.closePath = o), + (S._creationDataStorage.closeArray = r), + C.applyToMesh(S, u), + S + ); + }), + e + ); + })(); + (me.a.ExtrudeShape = function (e, t, i, n, r, o, a, s, c, u) { + void 0 === a && (a = null); + var l = { + shape: t, + path: i, + scale: n, + rotation: r, + cap: 0 === o ? 0 : o || me.a.NO_CAP, + sideOrientation: c, + instance: u, + updatable: s, + }; + return ro.ExtrudeShape(e, l, a); + }), + (me.a.ExtrudeShapeCustom = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u, + l, + h + ) { + var f = { + shape: t, + path: i, + scaleFunction: n, + rotationFunction: r, + ribbonCloseArray: o, + ribbonClosePath: a, + cap: 0 === s ? 0 : s || me.a.NO_CAP, + sideOrientation: l, + instance: h, + updatable: u, + }; + return ro.ExtrudeShapeCustom(e, f, c); + }); + var ro = (function () { + function e() {} + return ( + (e.ExtrudeShape = function (t, i, n) { + void 0 === n && (n = null); + var r = i.path, + o = i.shape, + a = i.scale || 1, + s = i.rotation || 0, + c = 0 === i.cap ? 0 : i.cap || me.a.NO_CAP, + u = i.updatable, + l = me.a._GetDefaultSideOrientation(i.sideOrientation), + h = i.instance || null, + f = i.invertUV || false; + return e._ExtrudeShapeGeneric( + t, + o, + r, + a, + s, + null, + null, + false, + false, + c, + false, + n, + !!u, + l, + h, + f, + i.frontUVs || null, + i.backUVs || null + ); + }), + (e.ExtrudeShapeCustom = function (t, i, n) { + void 0 === n && (n = null); + var r = i.path, + o = i.shape, + a = + i.scaleFunction || + function () { + return 1; + }, + s = + i.rotationFunction || + function () { + return 0; + }, + c = i.ribbonCloseArray || false, + u = i.ribbonClosePath || false, + l = 0 === i.cap ? 0 : i.cap || me.a.NO_CAP, + h = i.updatable, + f = me.a._GetDefaultSideOrientation(i.sideOrientation), + d = i.instance, + p = i.invertUV || false; + return e._ExtrudeShapeGeneric( + t, + o, + r, + null, + null, + a, + s, + c, + u, + l, + true, + n, + !!h, + f, + d || null, + p, + i.frontUVs || null, + i.backUVs || null + ); + }), + (e._ExtrudeShapeGeneric = function ( + e, + t, + i, + n, + r, + o, + s, + c, + u, + l, + h, + f, + d, + p, + m, + g, + _, + v + ) { + var y, + b, + E = function (e, t, i, n, r, o, s, c, u, l) { + for ( + var h = i.getTangents(), + f = i.getNormals(), + d = i.getBinormals(), + p = i.getDistances(), + m = 0, + g = + l && c + ? c + : function () { + return null !== o ? o : 0; + }, + _ = + l && s + ? s + : function () { + return null !== r ? r : 1; + }, + v = + u === me.a.NO_CAP || u === me.a.CAP_END ? 0 : 2, + y = a.t.Matrix[0], + b = 0; + b < t.length; + b++ + ) { + for ( + var E = new Array(), + T = g(b, p[b]), + A = _(b, p[b]), + x = 0; + x < e.length; + x++ + ) { + a.j.RotationAxisToRef(h[b], m, y); + var S = h[b] + .scale(e[x].z) + .add(f[b].scale(e[x].x)) + .add(d[b].scale(e[x].y)), + C = E[x] ? E[x] : a.x.Zero(); + a.x.TransformCoordinatesToRef(S, y, C), + C.scaleInPlace(A).addInPlace(t[b]), + (E[x] = C); } - , _ = l && s ? s : function() { - return null !== r ? r : 1 - } - , v = u === me.a.NO_CAP || u === me.a.CAP_END ? 0 : 2, y = a.t.Matrix[0], b = 0; b < t.length; b++) { - for (var E = new Array, T = g(b, p[b]), A = _(b, p[b]), x = 0; x < e.length; x++) { - a.j.RotationAxisToRef(h[b], m, y); - var S = h[b].scale(e[x].z).add(f[b].scale(e[x].x)).add(d[b].scale(e[x].y)) - , C = E[x] ? E[x] : a.x.Zero(); - a.x.TransformCoordinatesToRef(S, y, C), - C.scaleInPlace(A).addInPlace(t[b]), - E[x] = C - } - n[v] = E, - m += T, - v++ - } - var P = function(e) { - var t, i = Array(), n = a.x.Zero(); - for (t = 0; t < e.length; t++) - n.addInPlace(e[t]); - for (n.scaleInPlace(1 / e.length), - t = 0; t < e.length; t++) - i.push(n); - return i - }; - switch (u) { + (n[v] = E), (m += T), v++; + } + var P = function (e) { + var t, + i = Array(), + n = a.x.Zero(); + for (t = 0; t < e.length; t++) n.addInPlace(e[t]); + for ( + n.scaleInPlace(1 / e.length), t = 0; + t < e.length; + t++ + ) + i.push(n); + return i; + }; + switch (u) { case me.a.NO_CAP: - break; + break; case me.a.CAP_START: - n[0] = P(n[2]), - n[1] = n[2]; - break; + (n[0] = P(n[2])), (n[1] = n[2]); + break; case me.a.CAP_END: - n[v] = n[v - 1], - n[v + 1] = P(n[v - 1]); - break; + (n[v] = n[v - 1]), (n[v + 1] = P(n[v - 1])); + break; case me.a.CAP_ALL: - n[0] = P(n[2]), - n[1] = n[2], - n[v] = n[v - 1], - n[v + 1] = P(n[v - 1]) - } - return n + (n[0] = P(n[2])), + (n[1] = n[2]), + (n[v] = n[v - 1]), + (n[v + 1] = P(n[v - 1])); + } + return n; }; - if (m) { - var T = m._creationDataStorage; - return y = T.path3D.update(i), - b = E(t, i, T.path3D, T.pathArray, n, r, o, s, T.cap, h), - me.a.CreateRibbon("", b, false, false, 0, f || void 0, false, 0, m) - } - b = E(t, i, y = new a.m(i), new Array, n, r, o, s, l = l < 0 || l > 3 ? 0 : l, h); - var A = no.CreateRibbon(e, { - pathArray: b, - closeArray: c, - closePath: u, - updatable: d, - sideOrientation: p, - invertUV: g, - frontUVs: _ || void 0, - backUVs: v || void 0 - }, f); - return A._creationDataStorage.pathArray = b, - A._creationDataStorage.path3D = y, - A._creationDataStorage.cap = l, + if (m) { + var T = m._creationDataStorage; + return ( + (y = T.path3D.update(i)), + (b = E( + t, + i, + T.path3D, + T.pathArray, + n, + r, + o, + s, + T.cap, + h + )), + me.a.CreateRibbon( + "", + b, + false, + false, + 0, + f || void 0, + false, + 0, + m + ) + ); + } + b = E( + t, + i, + (y = new a.m(i)), + new Array(), + n, + r, + o, + s, + (l = l < 0 || l > 3 ? 0 : l), + h + ); + var A = no.CreateRibbon( + e, + { + pathArray: b, + closeArray: c, + closePath: u, + updatable: d, + sideOrientation: p, + invertUV: g, + frontUVs: _ || void 0, + backUVs: v || void 0, + }, + f + ); + return ( + (A._creationDataStorage.pathArray = b), + (A._creationDataStorage.path3D = y), + (A._creationDataStorage.cap = l), A - } - , + ); + }), e - }() - , oo = function() { - function e(e, t) { - var i = this; - void 0 === e && (e = true), - void 0 === t && (t = Ammo), - this._useDeltaForWorldStep = e, - this.bjsAMMO = {}, - this.name = "AmmoJSPlugin", - this._timeStep = 1 / 60, - this._fixedTimeStep = 1 / 60, - this._maxSteps = 5, - this._tmpQuaternion = new a.q, - this._tmpContactCallbackResult = false, - this._tmpVector = new a.x, - this._tmpMatrix = new a.j, - "function" == typeof t ? t(this.bjsAMMO) : this.bjsAMMO = t, - this.isSupported() ? (this._collisionConfiguration = new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration, - this._dispatcher = new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration), - this._overlappingPairCache = new this.bjsAMMO.btDbvtBroadphase, - this._solver = new this.bjsAMMO.btSequentialImpulseConstraintSolver, - this._softBodySolver = new this.bjsAMMO.btDefaultSoftBodySolver, - this.world = new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher,this._overlappingPairCache,this._solver,this._collisionConfiguration,this._softBodySolver), - this._tmpAmmoConcreteContactResultCallback = new this.bjsAMMO.ConcreteContactResultCallback, - this._tmpAmmoConcreteContactResultCallback.addSingleResult = function() { - i._tmpContactCallbackResult = true - } - , - this._raycastResult = new eo, - this._tmpAmmoTransform = new this.bjsAMMO.btTransform, - this._tmpAmmoTransform.setIdentity(), - this._tmpAmmoQuaternion = new this.bjsAMMO.btQuaternion(0,0,0,1), - this._tmpAmmoVectorA = new this.bjsAMMO.btVector3(0,0,0), - this._tmpAmmoVectorB = new this.bjsAMMO.btVector3(0,0,0), - this._tmpAmmoVectorC = new this.bjsAMMO.btVector3(0,0,0), - this._tmpAmmoVectorD = new this.bjsAMMO.btVector3(0,0,0)) : g.a.Error("AmmoJS is not available. Please make sure you included the js file.") - } - return e.prototype.setGravity = function(e) { - this._tmpAmmoVectorA.setValue(e.x, e.y, e.z), + ); + })(), + oo = (function () { + function e(e, t) { + var i = this; + void 0 === e && (e = true), + void 0 === t && (t = Ammo), + (this._useDeltaForWorldStep = e), + (this.bjsAMMO = {}), + (this.name = "AmmoJSPlugin"), + (this._timeStep = 1 / 60), + (this._fixedTimeStep = 1 / 60), + (this._maxSteps = 5), + (this._tmpQuaternion = new a.q()), + (this._tmpContactCallbackResult = false), + (this._tmpVector = new a.x()), + (this._tmpMatrix = new a.j()), + "function" == typeof t + ? t(this.bjsAMMO) + : (this.bjsAMMO = t), + this.isSupported() + ? ((this._collisionConfiguration = + new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration()), + (this._dispatcher = + new this.bjsAMMO.btCollisionDispatcher( + this._collisionConfiguration + )), + (this._overlappingPairCache = + new this.bjsAMMO.btDbvtBroadphase()), + (this._solver = + new this.bjsAMMO.btSequentialImpulseConstraintSolver()), + (this._softBodySolver = + new this.bjsAMMO.btDefaultSoftBodySolver()), + (this.world = + new this.bjsAMMO.btSoftRigidDynamicsWorld( + this._dispatcher, + this._overlappingPairCache, + this._solver, + this._collisionConfiguration, + this._softBodySolver + )), + (this._tmpAmmoConcreteContactResultCallback = + new this.bjsAMMO.ConcreteContactResultCallback()), + (this._tmpAmmoConcreteContactResultCallback.addSingleResult = + function () { + i._tmpContactCallbackResult = true; + }), + (this._raycastResult = new eo()), + (this._tmpAmmoTransform = + new this.bjsAMMO.btTransform()), + this._tmpAmmoTransform.setIdentity(), + (this._tmpAmmoQuaternion = + new this.bjsAMMO.btQuaternion(0, 0, 0, 1)), + (this._tmpAmmoVectorA = new this.bjsAMMO.btVector3( + 0, + 0, + 0 + )), + (this._tmpAmmoVectorB = new this.bjsAMMO.btVector3( + 0, + 0, + 0 + )), + (this._tmpAmmoVectorC = new this.bjsAMMO.btVector3( + 0, + 0, + 0 + )), + (this._tmpAmmoVectorD = new this.bjsAMMO.btVector3( + 0, + 0, + 0 + ))) + : g.a.Error( + "AmmoJS is not available. Please make sure you included the js file." + ); + } + return ( + (e.prototype.setGravity = function (e) { + this._tmpAmmoVectorA.setValue(e.x, e.y, e.z), this.world.setGravity(this._tmpAmmoVectorA), - this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA) - } - , - e.prototype.setTimeStep = function(e) { - this._timeStep = e - } - , - e.prototype.setFixedTimeStep = function(e) { - this._fixedTimeStep = e - } - , - e.prototype.setMaxSteps = function(e) { - this._maxSteps = e - } - , - e.prototype.getTimeStep = function() { - return this._timeStep - } - , - e.prototype._isImpostorInContact = function(e) { - return this._tmpContactCallbackResult = false, - this.world.contactTest(e.physicsBody, this._tmpAmmoConcreteContactResultCallback), + this.world + .getWorldInfo() + .set_m_gravity(this._tmpAmmoVectorA); + }), + (e.prototype.setTimeStep = function (e) { + this._timeStep = e; + }), + (e.prototype.setFixedTimeStep = function (e) { + this._fixedTimeStep = e; + }), + (e.prototype.setMaxSteps = function (e) { + this._maxSteps = e; + }), + (e.prototype.getTimeStep = function () { + return this._timeStep; + }), + (e.prototype._isImpostorInContact = function (e) { + return ( + (this._tmpContactCallbackResult = false), + this.world.contactTest( + e.physicsBody, + this._tmpAmmoConcreteContactResultCallback + ), this._tmpContactCallbackResult - } - , - e.prototype._isImpostorPairInContact = function(e, t) { - return this._tmpContactCallbackResult = false, - this.world.contactPairTest(e.physicsBody, t.physicsBody, this._tmpAmmoConcreteContactResultCallback), + ); + }), + (e.prototype._isImpostorPairInContact = function (e, t) { + return ( + (this._tmpContactCallbackResult = false), + this.world.contactPairTest( + e.physicsBody, + t.physicsBody, + this._tmpAmmoConcreteContactResultCallback + ), this._tmpContactCallbackResult - } - , - e.prototype._stepSimulation = function(e, t, i) { - if (void 0 === e && (e = 1 / 60), + ); + }), + (e.prototype._stepSimulation = function (e, t, i) { + if ( + (void 0 === e && (e = 1 / 60), void 0 === t && (t = 10), void 0 === i && (i = 1 / 60), 0 == t) - this.world.stepSimulation(e, 0); - else - for (; t > 0 && e > 0; ) - e - i < i ? (this.world.stepSimulation(e, 0), - e = 0) : (e -= i, - this.world.stepSimulation(i, 0)), - t-- - } - , - e.prototype.executeStep = function(e, t) { - for (var i = 0, n = t; i < n.length; i++) { - var r = n[i]; - r.soft || r.beforeStep() - } - this._stepSimulation(this._useDeltaForWorldStep ? e : this._timeStep, this._maxSteps, this._fixedTimeStep); - for (var o = 0, a = t; o < a.length; o++) { - var s = a[o]; - if (s.soft ? this._afterSoftStep(s) : s.afterStep(), - s._onPhysicsCollideCallbacks.length > 0 && this._isImpostorInContact(s)) - for (var c = 0, u = s._onPhysicsCollideCallbacks; c < u.length; c++) - for (var l = 0, h = u[c].otherImpostors; l < h.length; l++) { - var f = h[l]; - (s.physicsBody.isActive() || f.physicsBody.isActive()) && this._isImpostorPairInContact(s, f) && (s.onCollide({ - body: f.physicsBody - }), - f.onCollide({ - body: s.physicsBody - })) - } - } - } - , - e.prototype._afterSoftStep = function(e) { - e.type === Zr.a.RopeImpostor ? this._ropeStep(e) : this._softbodyOrClothStep(e) - } - , - e.prototype._ropeStep = function(e) { - for (var t, i, n, r, o = e.physicsBody.get_m_nodes(), s = o.size(), c = new Array, u = 0; u < s; u++) - i = (t = o.at(u).get_m_x()).x(), - n = t.y(), - r = t.z(), - c.push(new a.x(i,n,r)); - var l = e.object - , h = e.getParam("shape"); - e._isFromLine ? e.object = Mn.a.CreateLines("lines", { + ) + this.world.stepSimulation(e, 0); + else + for (; t > 0 && e > 0; ) + e - i < i + ? (this.world.stepSimulation(e, 0), (e = 0)) + : ((e -= i), this.world.stepSimulation(i, 0)), + t--; + }), + (e.prototype.executeStep = function (e, t) { + for (var i = 0, n = t; i < n.length; i++) { + var r = n[i]; + r.soft || r.beforeStep(); + } + this._stepSimulation( + this._useDeltaForWorldStep ? e : this._timeStep, + this._maxSteps, + this._fixedTimeStep + ); + for (var o = 0, a = t; o < a.length; o++) { + var s = a[o]; + if ( + (s.soft ? this._afterSoftStep(s) : s.afterStep(), + s._onPhysicsCollideCallbacks.length > 0 && + this._isImpostorInContact(s)) + ) + for ( + var c = 0, u = s._onPhysicsCollideCallbacks; + c < u.length; + c++ + ) + for ( + var l = 0, h = u[c].otherImpostors; + l < h.length; + l++ + ) { + var f = h[l]; + (s.physicsBody.isActive() || + f.physicsBody.isActive()) && + this._isImpostorPairInContact(s, f) && + (s.onCollide({ + body: f.physicsBody, + }), + f.onCollide({ + body: s.physicsBody, + })); + } + } + }), + (e.prototype._afterSoftStep = function (e) { + e.type === Zr.a.RopeImpostor + ? this._ropeStep(e) + : this._softbodyOrClothStep(e); + }), + (e.prototype._ropeStep = function (e) { + for ( + var t, + i, + n, + r, + o = e.physicsBody.get_m_nodes(), + s = o.size(), + c = new Array(), + u = 0; + u < s; + u++ + ) + (i = (t = o.at(u).get_m_x()).x()), + (n = t.y()), + (r = t.z()), + c.push(new a.x(i, n, r)); + var l = e.object, + h = e.getParam("shape"); + e._isFromLine + ? (e.object = Mn.a.CreateLines("lines", { points: c, - instance: l - }) : e.object = ro.ExtrudeShape("ext", { + instance: l, + })) + : (e.object = ro.ExtrudeShape("ext", { shape: h, path: c, - instance: l - }) - } - , - e.prototype._softbodyOrClothStep = function(e) { - var t = e.type === Zr.a.ClothImpostor ? 1 : -1 - , i = e.object - , n = i.getVerticesData(Si.b.PositionKind); - n || (n = []); - var r = i.getVerticesData(Si.b.NormalKind); - r || (r = []); - for (var o, a, s, c, u, l, h, f, d = n.length / 3, p = e.physicsBody.get_m_nodes(), m = 0; m < d; m++) { - var g; - s = (a = (o = p.at(m)).get_m_x()).x(), - c = a.y(), - u = a.z() * t, - l = (g = o.get_m_n()).x(), - h = g.y(), - f = g.z() * t, - n[3 * m] = s, - n[3 * m + 1] = c, - n[3 * m + 2] = u, - r[3 * m] = l, - r[3 * m + 1] = h, - r[3 * m + 2] = f - } - var _ = new xi.a; - _.positions = n, - _.normals = r, - _.uvs = i.getVerticesData(Si.b.UVKind), - _.colors = i.getVerticesData(Si.b.ColorKind), + instance: l, + })); + }), + (e.prototype._softbodyOrClothStep = function (e) { + var t = e.type === Zr.a.ClothImpostor ? 1 : -1, + i = e.object, + n = i.getVerticesData(Si.b.PositionKind); + n || (n = []); + var r = i.getVerticesData(Si.b.NormalKind); + r || (r = []); + for ( + var o, + a, + s, + c, + u, + l, + h, + f, + d = n.length / 3, + p = e.physicsBody.get_m_nodes(), + m = 0; + m < d; + m++ + ) { + var g; + (s = (a = (o = p.at(m)).get_m_x()).x()), + (c = a.y()), + (u = a.z() * t), + (l = (g = o.get_m_n()).x()), + (h = g.y()), + (f = g.z() * t), + (n[3 * m] = s), + (n[3 * m + 1] = c), + (n[3 * m + 2] = u), + (r[3 * m] = l), + (r[3 * m + 1] = h), + (r[3 * m + 2] = f); + } + var _ = new xi.a(); + (_.positions = n), + (_.normals = r), + (_.uvs = i.getVerticesData(Si.b.UVKind)), + (_.colors = i.getVerticesData(Si.b.ColorKind)), i && i.getIndices && (_.indices = i.getIndices()), - _.applyToMesh(i) - } - , - e.prototype.applyImpulse = function(e, t, i) { - if (e.soft) - g.a.Warn("Cannot be applied to a soft body"); + _.applyToMesh(i); + }), + (e.prototype.applyImpulse = function (e, t, i) { + if (e.soft) g.a.Warn("Cannot be applied to a soft body"); + else { + e.physicsBody.activate(); + var n = this._tmpAmmoVectorA, + r = this._tmpAmmoVectorB; + e.object && + e.object.getWorldMatrix && + (e.object + .getWorldMatrix() + .invertToRef(this._tmpMatrix), + a.x.TransformCoordinatesToRef( + i, + this._tmpMatrix, + this._tmpVector + ), + (i = this._tmpVector)), + n.setValue(i.x, i.y, i.z), + r.setValue(t.x, t.y, t.z), + e.physicsBody.applyImpulse(r, n); + } + }), + (e.prototype.applyForce = function (e, t, i) { + if (e.soft) g.a.Warn("Cannot be applied to a soft body"); + else { + e.physicsBody.activate(); + var n = this._tmpAmmoVectorA, + r = this._tmpAmmoVectorB; + e.object && + e.object.getWorldMatrix && + (e.object + .getWorldMatrix() + .invertToRef(this._tmpMatrix), + a.x.TransformCoordinatesToRef( + i, + this._tmpMatrix, + this._tmpVector + ), + (i = this._tmpVector)), + n.setValue(i.x, i.y, i.z), + r.setValue(t.x, t.y, t.z), + e.physicsBody.applyForce(r, n); + } + }), + (e.prototype.generatePhysicsBody = function (t) { + if (((t._pluginData.toDispose = []), t.parent)) + t.physicsBody && + (this.removePhysicsBody(t), t.forceUpdate()); + else if (t.isBodyInitRequired()) { + var i = this._createShape(t), + n = t.getParam("mass"); + if (((t._pluginData.mass = n), t.soft)) + i.get_m_cfg().set_collisions(17), + i.get_m_cfg().set_kDP(t.getParam("damping")), + Ammo.castObject(i, Ammo.btCollisionObject) + .getCollisionShape() + .setMargin(t.getParam("margin")), + i.setActivationState(e.DISABLE_DEACTIVATION_FLAG), + this.world.addSoftBody(i, 1, -1), + (t.physicsBody = i), + t._pluginData.toDispose.push(i), + this.setBodyPressure(t, 0), + t.type === Zr.a.SoftbodyImpostor && + this.setBodyPressure(t, t.getParam("pressure")), + this.setBodyStiffness(t, t.getParam("stiffness")), + this.setBodyVelocityIterations( + t, + t.getParam("velocityIterations") + ), + this.setBodyPositionIterations( + t, + t.getParam("positionIterations") + ); else { - e.physicsBody.activate(); - var n = this._tmpAmmoVectorA - , r = this._tmpAmmoVectorB; - e.object && e.object.getWorldMatrix && (e.object.getWorldMatrix().invertToRef(this._tmpMatrix), - a.x.TransformCoordinatesToRef(i, this._tmpMatrix, this._tmpVector), - i = this._tmpVector), - n.setValue(i.x, i.y, i.z), - r.setValue(t.x, t.y, t.z), - e.physicsBody.applyImpulse(r, n) + var r = new Ammo.btVector3(0, 0, 0), + o = new Ammo.btTransform(); + o.setIdentity(), + 0 !== n && i.calculateLocalInertia(n, r), + this._tmpAmmoVectorA.setValue( + t.object.position.x, + t.object.position.y, + t.object.position.z + ), + this._tmpAmmoQuaternion.setValue( + t.object.rotationQuaternion.x, + t.object.rotationQuaternion.y, + t.object.rotationQuaternion.z, + t.object.rotationQuaternion.w + ), + o.setOrigin(this._tmpAmmoVectorA), + o.setRotation(this._tmpAmmoQuaternion); + var a = new Ammo.btDefaultMotionState(o), + s = new Ammo.btRigidBodyConstructionInfo( + n, + a, + i, + r + ), + c = new Ammo.btRigidBody(s); + 0 === n && + (c.setCollisionFlags( + c.getCollisionFlags() | e.KINEMATIC_FLAG + ), + c.setActivationState(e.DISABLE_DEACTIVATION_FLAG)), + t.type != Zr.a.NoImpostor || + i.getChildShape || + c.setCollisionFlags( + c.getCollisionFlags() | e.DISABLE_COLLISION_FLAG + ), + this.world.addRigidBody(c), + (t.physicsBody = c), + (t._pluginData.toDispose = + t._pluginData.toDispose.concat([ + c, + s, + a, + o, + r, + i, + ])); } - } - , - e.prototype.applyForce = function(e, t, i) { - if (e.soft) - g.a.Warn("Cannot be applied to a soft body"); - else { - e.physicsBody.activate(); - var n = this._tmpAmmoVectorA - , r = this._tmpAmmoVectorB; - e.object && e.object.getWorldMatrix && (e.object.getWorldMatrix().invertToRef(this._tmpMatrix), - a.x.TransformCoordinatesToRef(i, this._tmpMatrix, this._tmpVector), - i = this._tmpVector), - n.setValue(i.x, i.y, i.z), - r.setValue(t.x, t.y, t.z), - e.physicsBody.applyForce(r, n) + this.setBodyRestitution(t, t.getParam("restitution")), + this.setBodyFriction(t, t.getParam("friction")); + } + }), + (e.prototype.removePhysicsBody = function (e) { + var t = this; + this.world && + (this.world.removeRigidBody(e.physicsBody), + e._pluginData && + e._pluginData.toDispose.forEach(function (e) { + t.bjsAMMO.destroy(e); + })); + }), + (e.prototype.generateJoint = function (e) { + var t = e.mainImpostor.physicsBody, + i = e.connectedImpostor.physicsBody; + if (t && i) { + var n, + r = e.joint.jointData; + switch ( + (r.mainPivot || (r.mainPivot = new a.x(0, 0, 0)), + r.connectedPivot || + (r.connectedPivot = new a.x(0, 0, 0)), + e.joint.type) + ) { + case Jr.e.DistanceJoint: + var o = r.maxDistance; + o && + ((r.mainPivot = new a.x(0, -o / 2, 0)), + (r.connectedPivot = new a.x(0, o / 2, 0))), + (n = new Ammo.btPoint2PointConstraint( + t, + i, + new Ammo.btVector3( + r.mainPivot.x, + r.mainPivot.y, + r.mainPivot.z + ), + new Ammo.btVector3( + r.connectedPivot.x, + r.connectedPivot.y, + r.connectedPivot.z + ) + )); + break; + case Jr.e.HingeJoint: + r.mainAxis || (r.mainAxis = new a.x(0, 0, 0)), + r.connectedAxis || + (r.connectedAxis = new a.x(0, 0, 0)); + var s = new Ammo.btVector3( + r.mainAxis.x, + r.mainAxis.y, + r.mainAxis.z + ), + c = new Ammo.btVector3( + r.connectedAxis.x, + r.connectedAxis.y, + r.connectedAxis.z + ); + n = new Ammo.btHingeConstraint( + t, + i, + new Ammo.btVector3( + r.mainPivot.x, + r.mainPivot.y, + r.mainPivot.z + ), + new Ammo.btVector3( + r.connectedPivot.x, + r.connectedPivot.y, + r.connectedPivot.z + ), + s, + c + ); + break; + case Jr.e.BallAndSocketJoint: + n = new Ammo.btPoint2PointConstraint( + t, + i, + new Ammo.btVector3( + r.mainPivot.x, + r.mainPivot.y, + r.mainPivot.z + ), + new Ammo.btVector3( + r.connectedPivot.x, + r.connectedPivot.y, + r.connectedPivot.z + ) + ); + break; + default: + g.a.Warn( + "JointType not currently supported by the Ammo plugin, falling back to PhysicsJoint.BallAndSocketJoint" + ), + (n = new Ammo.btPoint2PointConstraint( + t, + i, + new Ammo.btVector3( + r.mainPivot.x, + r.mainPivot.y, + r.mainPivot.z + ), + new Ammo.btVector3( + r.connectedPivot.x, + r.connectedPivot.y, + r.connectedPivot.z + ) + )); } - } - , - e.prototype.generatePhysicsBody = function(t) { - if (t._pluginData.toDispose = [], - t.parent) - t.physicsBody && (this.removePhysicsBody(t), - t.forceUpdate()); - else if (t.isBodyInitRequired()) { - var i = this._createShape(t) - , n = t.getParam("mass"); - if (t._pluginData.mass = n, - t.soft) - i.get_m_cfg().set_collisions(17), - i.get_m_cfg().set_kDP(t.getParam("damping")), - Ammo.castObject(i, Ammo.btCollisionObject).getCollisionShape().setMargin(t.getParam("margin")), - i.setActivationState(e.DISABLE_DEACTIVATION_FLAG), - this.world.addSoftBody(i, 1, -1), - t.physicsBody = i, - t._pluginData.toDispose.push(i), - this.setBodyPressure(t, 0), - t.type === Zr.a.SoftbodyImpostor && this.setBodyPressure(t, t.getParam("pressure")), - this.setBodyStiffness(t, t.getParam("stiffness")), - this.setBodyVelocityIterations(t, t.getParam("velocityIterations")), - this.setBodyPositionIterations(t, t.getParam("positionIterations")); - else { - var r = new Ammo.btVector3(0,0,0) - , o = new Ammo.btTransform; - o.setIdentity(), - 0 !== n && i.calculateLocalInertia(n, r), - this._tmpAmmoVectorA.setValue(t.object.position.x, t.object.position.y, t.object.position.z), - this._tmpAmmoQuaternion.setValue(t.object.rotationQuaternion.x, t.object.rotationQuaternion.y, t.object.rotationQuaternion.z, t.object.rotationQuaternion.w), - o.setOrigin(this._tmpAmmoVectorA), - o.setRotation(this._tmpAmmoQuaternion); - var a = new Ammo.btDefaultMotionState(o) - , s = new Ammo.btRigidBodyConstructionInfo(n,a,i,r) - , c = new Ammo.btRigidBody(s); - 0 === n && (c.setCollisionFlags(c.getCollisionFlags() | e.KINEMATIC_FLAG), - c.setActivationState(e.DISABLE_DEACTIVATION_FLAG)), - t.type != Zr.a.NoImpostor || i.getChildShape || c.setCollisionFlags(c.getCollisionFlags() | e.DISABLE_COLLISION_FLAG), - this.world.addRigidBody(c), - t.physicsBody = c, - t._pluginData.toDispose = t._pluginData.toDispose.concat([c, s, a, o, r, i]) - } - this.setBodyRestitution(t, t.getParam("restitution")), - this.setBodyFriction(t, t.getParam("friction")) + this.world.addConstraint( + n, + !e.joint.jointData.collision + ), + (e.joint.physicsJoint = n); + } + }), + (e.prototype.removeJoint = function (e) { + this.world && + this.world.removeConstraint(e.joint.physicsJoint); + }), + (e.prototype._addMeshVerts = function (e, t, i) { + var n = this, + r = 0; + if ( + i && + i.getIndices && + i.getWorldMatrix && + i.getChildMeshes + ) { + var o = i.getIndices(); + o || (o = []); + var s = i.getVerticesData(Si.b.PositionKind); + s || (s = []), i.computeWorldMatrix(false); + for (var c = o.length / 3, u = 0; u < c; u++) { + for (var l = [], h = 0; h < 3; h++) { + var f, + d = new a.x( + s[3 * o[3 * u + h] + 0], + s[3 * o[3 * u + h] + 1], + s[3 * o[3 * u + h] + 2] + ); + a.j.ScalingToRef( + i.scaling.x, + i.scaling.y, + i.scaling.z, + this._tmpMatrix + ), + (d = a.x.TransformCoordinates( + d, + this._tmpMatrix + )), + (f = + 0 == h + ? this._tmpAmmoVectorA + : 1 == h + ? this._tmpAmmoVectorB + : this._tmpAmmoVectorC).setValue( + d.x, + d.y, + d.z + ), + l.push(f); + } + e.addTriangle(l[0], l[1], l[2]), r++; } - } - , - e.prototype.removePhysicsBody = function(e) { - var t = this; - this.world && (this.world.removeRigidBody(e.physicsBody), - e._pluginData && e._pluginData.toDispose.forEach(function(e) { - t.bjsAMMO.destroy(e) - })) - } - , - e.prototype.generateJoint = function(e) { - var t = e.mainImpostor.physicsBody - , i = e.connectedImpostor.physicsBody; - if (t && i) { - var n, r = e.joint.jointData; - switch (r.mainPivot || (r.mainPivot = new a.x(0,0,0)), - r.connectedPivot || (r.connectedPivot = new a.x(0,0,0)), - e.joint.type) { - case Jr.e.DistanceJoint: - var o = r.maxDistance; - o && (r.mainPivot = new a.x(0,-o / 2,0), - r.connectedPivot = new a.x(0,o / 2,0)), - n = new Ammo.btPoint2PointConstraint(t,i,new Ammo.btVector3(r.mainPivot.x,r.mainPivot.y,r.mainPivot.z),new Ammo.btVector3(r.connectedPivot.x,r.connectedPivot.y,r.connectedPivot.z)); - break; - case Jr.e.HingeJoint: - r.mainAxis || (r.mainAxis = new a.x(0,0,0)), - r.connectedAxis || (r.connectedAxis = new a.x(0,0,0)); - var s = new Ammo.btVector3(r.mainAxis.x,r.mainAxis.y,r.mainAxis.z) - , c = new Ammo.btVector3(r.connectedAxis.x,r.connectedAxis.y,r.connectedAxis.z); - n = new Ammo.btHingeConstraint(t,i,new Ammo.btVector3(r.mainPivot.x,r.mainPivot.y,r.mainPivot.z),new Ammo.btVector3(r.connectedPivot.x,r.connectedPivot.y,r.connectedPivot.z),s,c); - break; - case Jr.e.BallAndSocketJoint: - n = new Ammo.btPoint2PointConstraint(t,i,new Ammo.btVector3(r.mainPivot.x,r.mainPivot.y,r.mainPivot.z),new Ammo.btVector3(r.connectedPivot.x,r.connectedPivot.y,r.connectedPivot.z)); - break; - default: - g.a.Warn("JointType not currently supported by the Ammo plugin, falling back to PhysicsJoint.BallAndSocketJoint"), - n = new Ammo.btPoint2PointConstraint(t,i,new Ammo.btVector3(r.mainPivot.x,r.mainPivot.y,r.mainPivot.z),new Ammo.btVector3(r.connectedPivot.x,r.connectedPivot.y,r.connectedPivot.z)) - } - this.world.addConstraint(n, !e.joint.jointData.collision), - e.joint.physicsJoint = n + i.getChildMeshes().forEach(function (i) { + r += n._addMeshVerts(e, t, i); + }); + } + return r; + }), + (e.prototype._softVertexData = function (e) { + var t = e.object; + if ( + t && + t.getIndices && + t.getWorldMatrix && + t.getChildMeshes + ) { + var i = t.getIndices(); + i || (i = []); + var n = t.getVerticesData(Si.b.PositionKind); + n || (n = []); + var r = t.getVerticesData(Si.b.NormalKind); + r || (r = []), t.computeWorldMatrix(false); + for (var o = [], s = [], c = 0; c < n.length; c += 3) { + var u = new a.x(n[c], n[c + 1], n[c + 2]), + l = new a.x(r[c], r[c + 1], r[c + 2]); + (u = a.x.TransformCoordinates(u, t.getWorldMatrix())), + (l = a.x.TransformNormal(l, t.getWorldMatrix())), + o.push(u.x, u.y, u.z), + s.push(l.x, l.y, l.z); } - } - , - e.prototype.removeJoint = function(e) { - this.world && this.world.removeConstraint(e.joint.physicsJoint) - } - , - e.prototype._addMeshVerts = function(e, t, i) { - var n = this - , r = 0; - if (i && i.getIndices && i.getWorldMatrix && i.getChildMeshes) { - var o = i.getIndices(); - o || (o = []); - var s = i.getVerticesData(Si.b.PositionKind); - s || (s = []), - i.computeWorldMatrix(false); - for (var c = o.length / 3, u = 0; u < c; u++) { - for (var l = [], h = 0; h < 3; h++) { - var f, d = new a.x(s[3 * o[3 * u + h] + 0],s[3 * o[3 * u + h] + 1],s[3 * o[3 * u + h] + 2]); - a.j.ScalingToRef(i.scaling.x, i.scaling.y, i.scaling.z, this._tmpMatrix), - d = a.x.TransformCoordinates(d, this._tmpMatrix), - (f = 0 == h ? this._tmpAmmoVectorA : 1 == h ? this._tmpAmmoVectorB : this._tmpAmmoVectorC).setValue(d.x, d.y, d.z), - l.push(f) - } - e.addTriangle(l[0], l[1], l[2]), - r++ - } - i.getChildMeshes().forEach(function(i) { - r += n._addMeshVerts(e, t, i) - }) - } - return r - } - , - e.prototype._softVertexData = function(e) { - var t = e.object; - if (t && t.getIndices && t.getWorldMatrix && t.getChildMeshes) { - var i = t.getIndices(); - i || (i = []); - var n = t.getVerticesData(Si.b.PositionKind); - n || (n = []); - var r = t.getVerticesData(Si.b.NormalKind); - r || (r = []), - t.computeWorldMatrix(false); - for (var o = [], s = [], c = 0; c < n.length; c += 3) { - var u = new a.x(n[c],n[c + 1],n[c + 2]) - , l = new a.x(r[c],r[c + 1],r[c + 2]); - u = a.x.TransformCoordinates(u, t.getWorldMatrix()), - l = a.x.TransformNormal(l, t.getWorldMatrix()), - o.push(u.x, u.y, u.z), - s.push(l.x, l.y, l.z) - } - var h = new xi.a; - return h.positions = o, - h.normals = s, - h.uvs = t.getVerticesData(Si.b.UVKind), - h.colors = t.getVerticesData(Si.b.ColorKind), - t && t.getIndices && (h.indices = t.getIndices()), - h.applyToMesh(t), - t.position = a.x.Zero(), - t.rotationQuaternion = null, - t.rotation = a.x.Zero(), - t.computeWorldMatrix(true), - h - } - return xi.a.ExtractFromMesh(t) - } - , - e.prototype._createSoftbody = function(e) { - var t = e.object; - if (t && t.getIndices) { - var i = t.getIndices(); - i || (i = []); - var n = this._softVertexData(e) - , r = n.positions - , o = n.normals; - if (null === r || null === o) - return new Ammo.btCompoundShape; - for (var s = [], c = [], u = 0; u < r.length; u += 3) { - var l = new a.x(r[u],r[u + 1],r[u + 2]) - , h = new a.x(o[u],o[u + 1],o[u + 2]); - s.push(l.x, l.y, -l.z), - c.push(h.x, h.y, -h.z) - } - var f = (new Ammo.btSoftBodyHelpers).CreateFromTriMesh(this.world.getWorldInfo(), s, t.getIndices(), i.length / 3, true) - , d = r.length / 3 - , p = f.get_m_nodes(); - for (u = 0; u < d; u++) { - var m; - (m = p.at(u).get_m_n()).setX(c[3 * u]), - m.setY(c[3 * u + 1]), - m.setZ(c[3 * u + 2]) - } - return f - } - } - , - e.prototype._createCloth = function(e) { - var t = e.object; - if (t && t.getIndices) { - var i = t.getIndices(); - i || (i = []); - var n = this._softVertexData(e) - , r = n.positions - , o = n.normals; - if (null === r || null === o) - return new Ammo.btCompoundShape; - var a = r.length - , s = Math.sqrt(a / 3); - e.segments = s; - var c = s - 1; - return this._tmpAmmoVectorA.setValue(r[0], r[1], r[2]), - this._tmpAmmoVectorB.setValue(r[3 * c], r[3 * c + 1], r[3 * c + 2]), - this._tmpAmmoVectorD.setValue(r[a - 3], r[a - 2], r[a - 1]), - this._tmpAmmoVectorC.setValue(r[a - 3 - 3 * c], r[a - 2 - 3 * c], r[a - 1 - 3 * c]), - (new Ammo.btSoftBodyHelpers).CreatePatch(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, this._tmpAmmoVectorC, this._tmpAmmoVectorD, s, s, e.getParam("fixedPoints"), true) - } - } - , - e.prototype._createRope = function(e) { - var t, i, n = this._softVertexData(e), r = n.positions, o = n.normals; + var h = new xi.a(); + return ( + (h.positions = o), + (h.normals = s), + (h.uvs = t.getVerticesData(Si.b.UVKind)), + (h.colors = t.getVerticesData(Si.b.ColorKind)), + t && t.getIndices && (h.indices = t.getIndices()), + h.applyToMesh(t), + (t.position = a.x.Zero()), + (t.rotationQuaternion = null), + (t.rotation = a.x.Zero()), + t.computeWorldMatrix(true), + h + ); + } + return xi.a.ExtractFromMesh(t); + }), + (e.prototype._createSoftbody = function (e) { + var t = e.object; + if (t && t.getIndices) { + var i = t.getIndices(); + i || (i = []); + var n = this._softVertexData(e), + r = n.positions, + o = n.normals; if (null === r || null === o) - return new Ammo.btCompoundShape; - if (n.applyToMesh(e.object, true), - e._isFromLine = true, - 0 === o.map(function(e) { - return e * e - }).reduce(function(e, t) { - return e + t - })) - i = (t = r.length) / 3 - 1, - this._tmpAmmoVectorA.setValue(r[0], r[1], r[2]), - this._tmpAmmoVectorB.setValue(r[t - 3], r[t - 2], r[t - 1]); - else { - e._isFromLine = false; - var a = e.getParam("path"); - if (null === e.getParam("shape")) - return g.a.Warn("No shape available for extruded mesh"), - new Ammo.btCompoundShape; - if (r.length % (3 * a.length) != 0) - return g.a.Warn("Path does not match extrusion"), - new Ammo.btCompoundShape; - i = (t = a.length) - 1, - this._tmpAmmoVectorA.setValue(a[0].x, a[0].y, a[0].z), - this._tmpAmmoVectorB.setValue(a[t - 1].x, a[t - 1].y, a[t - 1].z) + return new Ammo.btCompoundShape(); + for (var s = [], c = [], u = 0; u < r.length; u += 3) { + var l = new a.x(r[u], r[u + 1], r[u + 2]), + h = new a.x(o[u], o[u + 1], o[u + 2]); + s.push(l.x, l.y, -l.z), c.push(h.x, h.y, -h.z); } - e.segments = i; - var s = e.getParam("fixedPoints"); - s = s > 3 ? 3 : s; - var c = (new Ammo.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, i - 1, s); - return c.get_m_cfg().set_collisions(17), - c - } - , - e.prototype._addHullVerts = function(e, t, i) { - var n = this - , r = 0; - if (i && i.getIndices && i.getWorldMatrix && i.getChildMeshes) { - var o = i.getIndices(); - o || (o = []); - var s = i.getVerticesData(Si.b.PositionKind); - s || (s = []), - i.computeWorldMatrix(false); - for (var c = o.length / 3, u = 0; u < c; u++) { - for (var l = [], h = 0; h < 3; h++) { - var f, d = new a.x(s[3 * o[3 * u + h] + 0],s[3 * o[3 * u + h] + 1],s[3 * o[3 * u + h] + 2]); - a.j.ScalingToRef(i.scaling.x, i.scaling.y, i.scaling.z, this._tmpMatrix), - d = a.x.TransformCoordinates(d, this._tmpMatrix), - (f = 0 == h ? this._tmpAmmoVectorA : 1 == h ? this._tmpAmmoVectorB : this._tmpAmmoVectorC).setValue(d.x, d.y, d.z), - l.push(f) - } - e.addPoint(l[0], true), - e.addPoint(l[1], true), - e.addPoint(l[2], true), - r++ - } - i.getChildMeshes().forEach(function(i) { - r += n._addHullVerts(e, t, i) + var f = new Ammo.btSoftBodyHelpers().CreateFromTriMesh( + this.world.getWorldInfo(), + s, + t.getIndices(), + i.length / 3, + true + ), + d = r.length / 3, + p = f.get_m_nodes(); + for (u = 0; u < d; u++) { + var m; + (m = p.at(u).get_m_n()).setX(c[3 * u]), + m.setY(c[3 * u + 1]), + m.setZ(c[3 * u + 2]); + } + return f; + } + }), + (e.prototype._createCloth = function (e) { + var t = e.object; + if (t && t.getIndices) { + var i = t.getIndices(); + i || (i = []); + var n = this._softVertexData(e), + r = n.positions, + o = n.normals; + if (null === r || null === o) + return new Ammo.btCompoundShape(); + var a = r.length, + s = Math.sqrt(a / 3); + e.segments = s; + var c = s - 1; + return ( + this._tmpAmmoVectorA.setValue(r[0], r[1], r[2]), + this._tmpAmmoVectorB.setValue( + r[3 * c], + r[3 * c + 1], + r[3 * c + 2] + ), + this._tmpAmmoVectorD.setValue( + r[a - 3], + r[a - 2], + r[a - 1] + ), + this._tmpAmmoVectorC.setValue( + r[a - 3 - 3 * c], + r[a - 2 - 3 * c], + r[a - 1 - 3 * c] + ), + new Ammo.btSoftBodyHelpers().CreatePatch( + this.world.getWorldInfo(), + this._tmpAmmoVectorA, + this._tmpAmmoVectorB, + this._tmpAmmoVectorC, + this._tmpAmmoVectorD, + s, + s, + e.getParam("fixedPoints"), + true + ) + ); + } + }), + (e.prototype._createRope = function (e) { + var t, + i, + n = this._softVertexData(e), + r = n.positions, + o = n.normals; + if (null === r || null === o) + return new Ammo.btCompoundShape(); + if ( + (n.applyToMesh(e.object, true), + (e._isFromLine = true), + 0 === + o + .map(function (e) { + return e * e; }) + .reduce(function (e, t) { + return e + t; + })) + ) + (i = (t = r.length) / 3 - 1), + this._tmpAmmoVectorA.setValue(r[0], r[1], r[2]), + this._tmpAmmoVectorB.setValue( + r[t - 3], + r[t - 2], + r[t - 1] + ); + else { + e._isFromLine = false; + var a = e.getParam("path"); + if (null === e.getParam("shape")) + return ( + g.a.Warn("No shape available for extruded mesh"), + new Ammo.btCompoundShape() + ); + if (r.length % (3 * a.length) != 0) + return ( + g.a.Warn("Path does not match extrusion"), + new Ammo.btCompoundShape() + ); + (i = (t = a.length) - 1), + this._tmpAmmoVectorA.setValue(a[0].x, a[0].y, a[0].z), + this._tmpAmmoVectorB.setValue( + a[t - 1].x, + a[t - 1].y, + a[t - 1].z + ); + } + e.segments = i; + var s = e.getParam("fixedPoints"); + s = s > 3 ? 3 : s; + var c = new Ammo.btSoftBodyHelpers().CreateRope( + this.world.getWorldInfo(), + this._tmpAmmoVectorA, + this._tmpAmmoVectorB, + i - 1, + s + ); + return c.get_m_cfg().set_collisions(17), c; + }), + (e.prototype._addHullVerts = function (e, t, i) { + var n = this, + r = 0; + if ( + i && + i.getIndices && + i.getWorldMatrix && + i.getChildMeshes + ) { + var o = i.getIndices(); + o || (o = []); + var s = i.getVerticesData(Si.b.PositionKind); + s || (s = []), i.computeWorldMatrix(false); + for (var c = o.length / 3, u = 0; u < c; u++) { + for (var l = [], h = 0; h < 3; h++) { + var f, + d = new a.x( + s[3 * o[3 * u + h] + 0], + s[3 * o[3 * u + h] + 1], + s[3 * o[3 * u + h] + 2] + ); + a.j.ScalingToRef( + i.scaling.x, + i.scaling.y, + i.scaling.z, + this._tmpMatrix + ), + (d = a.x.TransformCoordinates( + d, + this._tmpMatrix + )), + (f = + 0 == h + ? this._tmpAmmoVectorA + : 1 == h + ? this._tmpAmmoVectorB + : this._tmpAmmoVectorC).setValue( + d.x, + d.y, + d.z + ), + l.push(f); + } + e.addPoint(l[0], true), + e.addPoint(l[1], true), + e.addPoint(l[2], true), + r++; } - return r - } - , - e.prototype._createShape = function(e, t) { - var i = this; - void 0 === t && (t = false); - var n, r = e.object, o = e.getObjectExtendSize(); - if (!t) { - var s = e.object.getChildMeshes ? e.object.getChildMeshes(true) : []; - n = new Ammo.btCompoundShape; - var c = 0; - if (s.forEach(function(e) { - var t = e.getPhysicsImpostor(); - if (t) { - if (t.type == Zr.a.MeshImpostor) - throw "A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)"; - var r = i._createShape(t) - , o = e.parent.getWorldMatrix().clone() - , s = new a.x; - o.decompose(s), - i._tmpAmmoTransform.getOrigin().setValue(e.position.x * s.x, e.position.y * s.y, e.position.z * s.z), - i._tmpAmmoQuaternion.setValue(e.rotationQuaternion.x, e.rotationQuaternion.y, e.rotationQuaternion.z, e.rotationQuaternion.w), - i._tmpAmmoTransform.setRotation(i._tmpAmmoQuaternion), - n.addChildShape(i._tmpAmmoTransform, r), - t.dispose(), - c++ - } - }), - c > 0) { - if (e.type != Zr.a.NoImpostor) { - var u = this._createShape(e, true); - u && (this._tmpAmmoTransform.getOrigin().setValue(0, 0, 0), - this._tmpAmmoQuaternion.setValue(0, 0, 0, 1), - this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion), - n.addChildShape(this._tmpAmmoTransform, u)) - } - return n + i.getChildMeshes().forEach(function (i) { + r += n._addHullVerts(e, t, i); + }); + } + return r; + }), + (e.prototype._createShape = function (e, t) { + var i = this; + void 0 === t && (t = false); + var n, + r = e.object, + o = e.getObjectExtendSize(); + if (!t) { + var s = e.object.getChildMeshes + ? e.object.getChildMeshes(true) + : []; + n = new Ammo.btCompoundShape(); + var c = 0; + if ( + (s.forEach(function (e) { + var t = e.getPhysicsImpostor(); + if (t) { + if (t.type == Zr.a.MeshImpostor) + throw "A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)"; + var r = i._createShape(t), + o = e.parent.getWorldMatrix().clone(), + s = new a.x(); + o.decompose(s), + i._tmpAmmoTransform + .getOrigin() + .setValue( + e.position.x * s.x, + e.position.y * s.y, + e.position.z * s.z + ), + i._tmpAmmoQuaternion.setValue( + e.rotationQuaternion.x, + e.rotationQuaternion.y, + e.rotationQuaternion.z, + e.rotationQuaternion.w + ), + i._tmpAmmoTransform.setRotation( + i._tmpAmmoQuaternion + ), + n.addChildShape(i._tmpAmmoTransform, r), + t.dispose(), + c++; } - Ammo.destroy(n), - n = null + }), + c > 0) + ) { + if (e.type != Zr.a.NoImpostor) { + var u = this._createShape(e, true); + u && + (this._tmpAmmoTransform + .getOrigin() + .setValue(0, 0, 0), + this._tmpAmmoQuaternion.setValue(0, 0, 0, 1), + this._tmpAmmoTransform.setRotation( + this._tmpAmmoQuaternion + ), + n.addChildShape(this._tmpAmmoTransform, u)); + } + return n; } - switch (e.type) { + Ammo.destroy(n), (n = null); + } + switch (e.type) { case Zr.a.SphereImpostor: - n = new Ammo.btSphereShape(o.x / 2); - break; + n = new Ammo.btSphereShape(o.x / 2); + break; case Zr.a.CylinderImpostor: - this._tmpAmmoVectorA.setValue(o.x / 2, o.y / 2, o.z / 2), - n = new Ammo.btCylinderShape(this._tmpAmmoVectorA); - break; + this._tmpAmmoVectorA.setValue( + o.x / 2, + o.y / 2, + o.z / 2 + ), + (n = new Ammo.btCylinderShape( + this._tmpAmmoVectorA + )); + break; case Zr.a.PlaneImpostor: case Zr.a.BoxImpostor: - this._tmpAmmoVectorA.setValue(o.x / 2, o.y / 2, o.z / 2), - n = new Ammo.btBoxShape(this._tmpAmmoVectorA); - break; + this._tmpAmmoVectorA.setValue( + o.x / 2, + o.y / 2, + o.z / 2 + ), + (n = new Ammo.btBoxShape(this._tmpAmmoVectorA)); + break; case Zr.a.MeshImpostor: - if (0 == e.getParam("mass")) { - var l = new Ammo.btTriangleMesh; - e._pluginData.toDispose.push(l); - var h = this._addMeshVerts(l, r, r); - n = 0 == h ? new Ammo.btCompoundShape : new Ammo.btBvhTriangleMeshShape(l); - break - } + if (0 == e.getParam("mass")) { + var l = new Ammo.btTriangleMesh(); + e._pluginData.toDispose.push(l); + var h = this._addMeshVerts(l, r, r); + n = + 0 == h + ? new Ammo.btCompoundShape() + : new Ammo.btBvhTriangleMeshShape(l); + break; + } case Zr.a.ConvexHullImpostor: - var f = new Ammo.btConvexHullShape; - 0 == (h = this._addHullVerts(f, r, r)) ? (e._pluginData.toDispose.push(f), - n = new Ammo.btCompoundShape) : n = f; - break; + var f = new Ammo.btConvexHullShape(); + 0 == (h = this._addHullVerts(f, r, r)) + ? (e._pluginData.toDispose.push(f), + (n = new Ammo.btCompoundShape())) + : (n = f); + break; case Zr.a.NoImpostor: - n = new Ammo.btSphereShape(o.x / 2); - break; + n = new Ammo.btSphereShape(o.x / 2); + break; case Zr.a.SoftbodyImpostor: - n = this._createSoftbody(e); - break; + n = this._createSoftbody(e); + break; case Zr.a.ClothImpostor: - n = this._createCloth(e); - break; + n = this._createCloth(e); + break; case Zr.a.RopeImpostor: - n = this._createRope(e); - break; + n = this._createRope(e); + break; default: - g.a.Warn("The impostor type is not currently supported by the ammo plugin.") - } - return n - } - , - e.prototype.setTransformationFromPhysicsBody = function(e) { - e.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform), - e.object.position.set(this._tmpAmmoTransform.getOrigin().x(), this._tmpAmmoTransform.getOrigin().y(), this._tmpAmmoTransform.getOrigin().z()), - e.object.rotationQuaternion ? e.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(), this._tmpAmmoTransform.getRotation().y(), this._tmpAmmoTransform.getRotation().z(), this._tmpAmmoTransform.getRotation().w()) : e.object.rotation && (this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(), this._tmpAmmoTransform.getRotation().y(), this._tmpAmmoTransform.getRotation().z(), this._tmpAmmoTransform.getRotation().w()), - this._tmpQuaternion.toEulerAnglesToRef(e.object.rotation)) - } - , - e.prototype.setPhysicsBodyTransformation = function(e, t, i) { - var n = e.physicsBody.getWorldTransform(); - if (n.getOrigin().x() != t.x || n.getOrigin().y() != t.y || n.getOrigin().z() != t.z || n.getRotation().x() != i.x || n.getRotation().y() != i.y || n.getRotation().z() != i.z || n.getRotation().w() != i.w) - if (this._tmpAmmoVectorA.setValue(t.x, t.y, t.z), - n.setOrigin(this._tmpAmmoVectorA), - this._tmpAmmoQuaternion.setValue(i.x, i.y, i.z, i.w), - n.setRotation(this._tmpAmmoQuaternion), - e.physicsBody.setWorldTransform(n), - 0 == e.mass) { - var r = e.physicsBody.getMotionState(); - r && r.setWorldTransform(n) - } else - e.physicsBody.activate() - } - , - e.prototype.isSupported = function() { - return void 0 !== this.bjsAMMO - } - , - e.prototype.setLinearVelocity = function(e, t) { - this._tmpAmmoVectorA.setValue(t.x, t.y, t.z), - e.soft ? e.physicsBody.linearVelocity(this._tmpAmmoVectorA) : e.physicsBody.setLinearVelocity(this._tmpAmmoVectorA) - } - , - e.prototype.setAngularVelocity = function(e, t) { - this._tmpAmmoVectorA.setValue(t.x, t.y, t.z), - e.soft ? e.physicsBody.angularVelocity(this._tmpAmmoVectorA) : e.physicsBody.setAngularVelocity(this._tmpAmmoVectorA) - } - , - e.prototype.getLinearVelocity = function(e) { - if (e.soft) - var t = e.physicsBody.linearVelocity(); - else - t = e.physicsBody.getLinearVelocity(); - if (!t) - return null; - var i = new a.x(t.x(),t.y(),t.z()); - return Ammo.destroy(t), - i - } - , - e.prototype.getAngularVelocity = function(e) { - if (e.soft) - var t = e.physicsBody.angularVelocity(); - else - t = e.physicsBody.getAngularVelocity(); - if (!t) - return null; - var i = new a.x(t.x(),t.y(),t.z()); - return Ammo.destroy(t), - i - } - , - e.prototype.setBodyMass = function(e, t) { - e.soft ? e.physicsBody.setTotalMass(t, false) : e.physicsBody.setMassProps(t), - e._pluginData.mass = t - } - , - e.prototype.getBodyMass = function(e) { - return e._pluginData.mass || 0 - } - , - e.prototype.getBodyFriction = function(e) { - return e._pluginData.friction || 0 - } - , - e.prototype.setBodyFriction = function(e, t) { - e.soft ? e.physicsBody.get_m_cfg().set_kDF(t) : e.physicsBody.setFriction(t), - e._pluginData.friction = t - } - , - e.prototype.getBodyRestitution = function(e) { - return e._pluginData.restitution || 0 - } - , - e.prototype.setBodyRestitution = function(e, t) { - e.physicsBody.setRestitution(t), - e._pluginData.restitution = t - } - , - e.prototype.getBodyPressure = function(e) { - return e.soft ? e._pluginData.pressure || 0 : (g.a.Warn("Pressure is not a property of a rigid body"), - 0) - } - , - e.prototype.setBodyPressure = function(e, t) { - e.soft ? e.type === Zr.a.SoftbodyImpostor ? (e.physicsBody.get_m_cfg().set_kPR(t), - e._pluginData.pressure = t) : (e.physicsBody.get_m_cfg().set_kPR(0), - e._pluginData.pressure = 0) : g.a.Warn("Pressure can only be applied to a softbody") - } - , - e.prototype.getBodyStiffness = function(e) { - return e.soft ? e._pluginData.stiffness || 0 : (g.a.Warn("Stiffness is not a property of a rigid body"), - 0) - } - , - e.prototype.setBodyStiffness = function(e, t) { - e.soft ? (t = (t = t < 0 ? 0 : t) > 1 ? 1 : t, - e.physicsBody.get_m_materials().at(0).set_m_kLST(t), - e._pluginData.stiffness = t) : g.a.Warn("Stiffness cannot be applied to a rigid body") - } - , - e.prototype.getBodyVelocityIterations = function(e) { - return e.soft ? e._pluginData.velocityIterations || 0 : (g.a.Warn("Velocity iterations is not a property of a rigid body"), - 0) - } - , - e.prototype.setBodyVelocityIterations = function(e, t) { - e.soft ? (t = t < 0 ? 0 : t, - e.physicsBody.get_m_cfg().set_viterations(t), - e._pluginData.velocityIterations = t) : g.a.Warn("Velocity iterations cannot be applied to a rigid body") - } - , - e.prototype.getBodyPositionIterations = function(e) { - return e.soft ? e._pluginData.positionIterations || 0 : (g.a.Warn("Position iterations is not a property of a rigid body"), - 0) - } - , - e.prototype.setBodyPositionIterations = function(e, t) { - e.soft ? (t = t < 0 ? 0 : t, - e.physicsBody.get_m_cfg().set_piterations(t), - e._pluginData.positionIterations = t) : g.a.Warn("Position iterations cannot be applied to a rigid body") - } - , - e.prototype.appendAnchor = function(e, t, i, n, r, o) { - void 0 === r && (r = 1), - void 0 === o && (o = false); - var a = e.segments - , s = Math.round((a - 1) * i) + a * (a - 1 - Math.round((a - 1) * n)); - e.physicsBody.appendAnchor(s, t.physicsBody, o, r) - } - , - e.prototype.appendHook = function(e, t, i, n, r) { - void 0 === n && (n = 1), - void 0 === r && (r = false); - var o = Math.round(e.segments * i); - e.physicsBody.appendAnchor(o, t.physicsBody, r, n) - } - , - e.prototype.sleepBody = function(e) { - g.a.Warn("sleepBody is not currently supported by the Ammo physics plugin") - } - , - e.prototype.wakeUpBody = function(e) { - e.physicsBody.activate() - } - , - e.prototype.updateDistanceJoint = function(e, t, i) { - g.a.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin") - } - , - e.prototype.setMotor = function(e, t, i, n) { - e.physicsJoint.enableAngularMotor(true, t, i) - } - , - e.prototype.setLimit = function(e, t, i) { - g.a.Warn("setLimit is not currently supported by the Ammo physics plugin") - } - , - e.prototype.syncMeshWithImpostor = function(e, t) { - t.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform), - e.position.x = this._tmpAmmoTransform.getOrigin().x(), - e.position.y = this._tmpAmmoTransform.getOrigin().y(), - e.position.z = this._tmpAmmoTransform.getOrigin().z(), - e.rotationQuaternion && (e.rotationQuaternion.x = this._tmpAmmoTransform.getRotation().x(), - e.rotationQuaternion.y = this._tmpAmmoTransform.getRotation().y(), - e.rotationQuaternion.z = this._tmpAmmoTransform.getRotation().z(), - e.rotationQuaternion.w = this._tmpAmmoTransform.getRotation().w()) - } - , - e.prototype.getRadius = function(e) { - return e.getObjectExtendSize().x / 2 - } - , - e.prototype.getBoxSizeToRef = function(e, t) { - var i = e.getObjectExtendSize(); - t.x = i.x, - t.y = i.y, - t.z = i.z - } - , - e.prototype.dispose = function() { - Ammo.destroy(this.world), + g.a.Warn( + "The impostor type is not currently supported by the ammo plugin." + ); + } + return n; + }), + (e.prototype.setTransformationFromPhysicsBody = function ( + e + ) { + e.physicsBody + .getMotionState() + .getWorldTransform(this._tmpAmmoTransform), + e.object.position.set( + this._tmpAmmoTransform.getOrigin().x(), + this._tmpAmmoTransform.getOrigin().y(), + this._tmpAmmoTransform.getOrigin().z() + ), + e.object.rotationQuaternion + ? e.object.rotationQuaternion.set( + this._tmpAmmoTransform.getRotation().x(), + this._tmpAmmoTransform.getRotation().y(), + this._tmpAmmoTransform.getRotation().z(), + this._tmpAmmoTransform.getRotation().w() + ) + : e.object.rotation && + (this._tmpQuaternion.set( + this._tmpAmmoTransform.getRotation().x(), + this._tmpAmmoTransform.getRotation().y(), + this._tmpAmmoTransform.getRotation().z(), + this._tmpAmmoTransform.getRotation().w() + ), + this._tmpQuaternion.toEulerAnglesToRef( + e.object.rotation + )); + }), + (e.prototype.setPhysicsBodyTransformation = function ( + e, + t, + i + ) { + var n = e.physicsBody.getWorldTransform(); + if ( + n.getOrigin().x() != t.x || + n.getOrigin().y() != t.y || + n.getOrigin().z() != t.z || + n.getRotation().x() != i.x || + n.getRotation().y() != i.y || + n.getRotation().z() != i.z || + n.getRotation().w() != i.w + ) + if ( + (this._tmpAmmoVectorA.setValue(t.x, t.y, t.z), + n.setOrigin(this._tmpAmmoVectorA), + this._tmpAmmoQuaternion.setValue(i.x, i.y, i.z, i.w), + n.setRotation(this._tmpAmmoQuaternion), + e.physicsBody.setWorldTransform(n), + 0 == e.mass) + ) { + var r = e.physicsBody.getMotionState(); + r && r.setWorldTransform(n); + } else e.physicsBody.activate(); + }), + (e.prototype.isSupported = function () { + return void 0 !== this.bjsAMMO; + }), + (e.prototype.setLinearVelocity = function (e, t) { + this._tmpAmmoVectorA.setValue(t.x, t.y, t.z), + e.soft + ? e.physicsBody.linearVelocity(this._tmpAmmoVectorA) + : e.physicsBody.setLinearVelocity( + this._tmpAmmoVectorA + ); + }), + (e.prototype.setAngularVelocity = function (e, t) { + this._tmpAmmoVectorA.setValue(t.x, t.y, t.z), + e.soft + ? e.physicsBody.angularVelocity(this._tmpAmmoVectorA) + : e.physicsBody.setAngularVelocity( + this._tmpAmmoVectorA + ); + }), + (e.prototype.getLinearVelocity = function (e) { + if (e.soft) var t = e.physicsBody.linearVelocity(); + else t = e.physicsBody.getLinearVelocity(); + if (!t) return null; + var i = new a.x(t.x(), t.y(), t.z()); + return Ammo.destroy(t), i; + }), + (e.prototype.getAngularVelocity = function (e) { + if (e.soft) var t = e.physicsBody.angularVelocity(); + else t = e.physicsBody.getAngularVelocity(); + if (!t) return null; + var i = new a.x(t.x(), t.y(), t.z()); + return Ammo.destroy(t), i; + }), + (e.prototype.setBodyMass = function (e, t) { + e.soft + ? e.physicsBody.setTotalMass(t, false) + : e.physicsBody.setMassProps(t), + (e._pluginData.mass = t); + }), + (e.prototype.getBodyMass = function (e) { + return e._pluginData.mass || 0; + }), + (e.prototype.getBodyFriction = function (e) { + return e._pluginData.friction || 0; + }), + (e.prototype.setBodyFriction = function (e, t) { + e.soft + ? e.physicsBody.get_m_cfg().set_kDF(t) + : e.physicsBody.setFriction(t), + (e._pluginData.friction = t); + }), + (e.prototype.getBodyRestitution = function (e) { + return e._pluginData.restitution || 0; + }), + (e.prototype.setBodyRestitution = function (e, t) { + e.physicsBody.setRestitution(t), + (e._pluginData.restitution = t); + }), + (e.prototype.getBodyPressure = function (e) { + return e.soft + ? e._pluginData.pressure || 0 + : (g.a.Warn( + "Pressure is not a property of a rigid body" + ), + 0); + }), + (e.prototype.setBodyPressure = function (e, t) { + e.soft + ? e.type === Zr.a.SoftbodyImpostor + ? (e.physicsBody.get_m_cfg().set_kPR(t), + (e._pluginData.pressure = t)) + : (e.physicsBody.get_m_cfg().set_kPR(0), + (e._pluginData.pressure = 0)) + : g.a.Warn( + "Pressure can only be applied to a softbody" + ); + }), + (e.prototype.getBodyStiffness = function (e) { + return e.soft + ? e._pluginData.stiffness || 0 + : (g.a.Warn( + "Stiffness is not a property of a rigid body" + ), + 0); + }), + (e.prototype.setBodyStiffness = function (e, t) { + e.soft + ? ((t = (t = t < 0 ? 0 : t) > 1 ? 1 : t), + e.physicsBody.get_m_materials().at(0).set_m_kLST(t), + (e._pluginData.stiffness = t)) + : g.a.Warn( + "Stiffness cannot be applied to a rigid body" + ); + }), + (e.prototype.getBodyVelocityIterations = function (e) { + return e.soft + ? e._pluginData.velocityIterations || 0 + : (g.a.Warn( + "Velocity iterations is not a property of a rigid body" + ), + 0); + }), + (e.prototype.setBodyVelocityIterations = function (e, t) { + e.soft + ? ((t = t < 0 ? 0 : t), + e.physicsBody.get_m_cfg().set_viterations(t), + (e._pluginData.velocityIterations = t)) + : g.a.Warn( + "Velocity iterations cannot be applied to a rigid body" + ); + }), + (e.prototype.getBodyPositionIterations = function (e) { + return e.soft + ? e._pluginData.positionIterations || 0 + : (g.a.Warn( + "Position iterations is not a property of a rigid body" + ), + 0); + }), + (e.prototype.setBodyPositionIterations = function (e, t) { + e.soft + ? ((t = t < 0 ? 0 : t), + e.physicsBody.get_m_cfg().set_piterations(t), + (e._pluginData.positionIterations = t)) + : g.a.Warn( + "Position iterations cannot be applied to a rigid body" + ); + }), + (e.prototype.appendAnchor = function (e, t, i, n, r, o) { + void 0 === r && (r = 1), void 0 === o && (o = false); + var a = e.segments, + s = + Math.round((a - 1) * i) + + a * (a - 1 - Math.round((a - 1) * n)); + e.physicsBody.appendAnchor(s, t.physicsBody, o, r); + }), + (e.prototype.appendHook = function (e, t, i, n, r) { + void 0 === n && (n = 1), void 0 === r && (r = false); + var o = Math.round(e.segments * i); + e.physicsBody.appendAnchor(o, t.physicsBody, r, n); + }), + (e.prototype.sleepBody = function (e) { + g.a.Warn( + "sleepBody is not currently supported by the Ammo physics plugin" + ); + }), + (e.prototype.wakeUpBody = function (e) { + e.physicsBody.activate(); + }), + (e.prototype.updateDistanceJoint = function (e, t, i) { + g.a.Warn( + "updateDistanceJoint is not currently supported by the Ammo physics plugin" + ); + }), + (e.prototype.setMotor = function (e, t, i, n) { + e.physicsJoint.enableAngularMotor(true, t, i); + }), + (e.prototype.setLimit = function (e, t, i) { + g.a.Warn( + "setLimit is not currently supported by the Ammo physics plugin" + ); + }), + (e.prototype.syncMeshWithImpostor = function (e, t) { + t.physicsBody + .getMotionState() + .getWorldTransform(this._tmpAmmoTransform), + (e.position.x = this._tmpAmmoTransform.getOrigin().x()), + (e.position.y = this._tmpAmmoTransform.getOrigin().y()), + (e.position.z = this._tmpAmmoTransform.getOrigin().z()), + e.rotationQuaternion && + ((e.rotationQuaternion.x = this._tmpAmmoTransform + .getRotation() + .x()), + (e.rotationQuaternion.y = this._tmpAmmoTransform + .getRotation() + .y()), + (e.rotationQuaternion.z = this._tmpAmmoTransform + .getRotation() + .z()), + (e.rotationQuaternion.w = this._tmpAmmoTransform + .getRotation() + .w())); + }), + (e.prototype.getRadius = function (e) { + return e.getObjectExtendSize().x / 2; + }), + (e.prototype.getBoxSizeToRef = function (e, t) { + var i = e.getObjectExtendSize(); + (t.x = i.x), (t.y = i.y), (t.z = i.z); + }), + (e.prototype.dispose = function () { + Ammo.destroy(this.world), Ammo.destroy(this._solver), Ammo.destroy(this._overlappingPairCache), Ammo.destroy(this._dispatcher), @@ -79487,7847 +108621,11446 @@ and limitations under the License. Ammo.destroy(this._tmpAmmoVectorC), Ammo.destroy(this._tmpAmmoTransform), Ammo.destroy(this._tmpAmmoQuaternion), - Ammo.destroy(this._tmpAmmoConcreteContactResultCallback), - this.world = null - } - , - e.prototype.raycast = function(e, t) { - this._tmpAmmoVectorRCA = new this.bjsAMMO.btVector3(e.x,e.y,e.z), - this._tmpAmmoVectorRCB = new this.bjsAMMO.btVector3(t.x,t.y,t.z); - var i = new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB); - return this.world.rayTest(this._tmpAmmoVectorRCA, this._tmpAmmoVectorRCB, i), + Ammo.destroy( + this._tmpAmmoConcreteContactResultCallback + ), + (this.world = null); + }), + (e.prototype.raycast = function (e, t) { + (this._tmpAmmoVectorRCA = new this.bjsAMMO.btVector3( + e.x, + e.y, + e.z + )), + (this._tmpAmmoVectorRCB = new this.bjsAMMO.btVector3( + t.x, + t.y, + t.z + )); + var i = new this.bjsAMMO.ClosestRayResultCallback( + this._tmpAmmoVectorRCA, + this._tmpAmmoVectorRCB + ); + return ( + this.world.rayTest( + this._tmpAmmoVectorRCA, + this._tmpAmmoVectorRCB, + i + ), this._raycastResult.reset(e, t), - i.hasHit() && (this._raycastResult.setHitData({ - x: i.get_m_hitNormalWorld().x(), - y: i.get_m_hitNormalWorld().y(), - z: i.get_m_hitNormalWorld().z() - }, { - x: i.get_m_hitPointWorld().x(), - y: i.get_m_hitPointWorld().y(), - z: i.get_m_hitPointWorld().z() - }), - this._raycastResult.calculateHitDistance()), + i.hasHit() && + (this._raycastResult.setHitData( + { + x: i.get_m_hitNormalWorld().x(), + y: i.get_m_hitNormalWorld().y(), + z: i.get_m_hitNormalWorld().z(), + }, + { + x: i.get_m_hitPointWorld().x(), + y: i.get_m_hitPointWorld().y(), + z: i.get_m_hitPointWorld().z(), + } + ), + this._raycastResult.calculateHitDistance()), Ammo.destroy(i), Ammo.destroy(this._tmpAmmoVectorRCA), Ammo.destroy(this._tmpAmmoVectorRCB), this._raycastResult - } - , - e.DISABLE_COLLISION_FLAG = 4, - e.KINEMATIC_FLAG = 2, - e.DISABLE_DEACTIVATION_FLAG = 4, + ); + }), + (e.DISABLE_COLLISION_FLAG = 4), + (e.KINEMATIC_FLAG = 2), + (e.DISABLE_DEACTIVATION_FLAG = 4), e - }(); - r.a.prototype.removeReflectionProbe = function(e) { - if (!this.reflectionProbes) - return -1; - var t = this.reflectionProbes.indexOf(e); - return -1 !== t && this.reflectionProbes.splice(t, 1), - t - } - , - r.a.prototype.addReflectionProbe = function(e) { - this.reflectionProbes || (this.reflectionProbes = []), - this.reflectionProbes.push(e) - } - ; - var ao = function() { - function e(e, t, i, n, r) { - var o = this; - void 0 === n && (n = true), - void 0 === r && (r = false), - this.name = e, - this._viewMatrix = a.j.Identity(), - this._target = a.x.Zero(), - this._add = a.x.Zero(), - this._invertYAxis = false, - this.position = a.x.Zero(), - this._scene = i, - this._scene.reflectionProbes || (this._scene.reflectionProbes = new Array), - this._scene.reflectionProbes.push(this), - this._renderTargetTexture = new li(e,t,i,n,true,r ? _.a.TEXTURETYPE_FLOAT : _.a.TEXTURETYPE_UNSIGNED_INT,true), - this._renderTargetTexture.onBeforeRenderObservable.add(function(e) { - switch (e) { + ); + })(); + (r.a.prototype.removeReflectionProbe = function (e) { + if (!this.reflectionProbes) return -1; + var t = this.reflectionProbes.indexOf(e); + return -1 !== t && this.reflectionProbes.splice(t, 1), t; + }), + (r.a.prototype.addReflectionProbe = function (e) { + this.reflectionProbes || (this.reflectionProbes = []), + this.reflectionProbes.push(e); + }); + var ao = (function () { + function e(e, t, i, n, r) { + var o = this; + void 0 === n && (n = true), + void 0 === r && (r = false), + (this.name = e), + (this._viewMatrix = a.j.Identity()), + (this._target = a.x.Zero()), + (this._add = a.x.Zero()), + (this._invertYAxis = false), + (this.position = a.x.Zero()), + (this._scene = i), + this._scene.reflectionProbes || + (this._scene.reflectionProbes = new Array()), + this._scene.reflectionProbes.push(this), + (this._renderTargetTexture = new li( + e, + t, + i, + n, + true, + r + ? _.a.TEXTURETYPE_FLOAT + : _.a.TEXTURETYPE_UNSIGNED_INT, + true + )), + this._renderTargetTexture.onBeforeRenderObservable.add( + function (e) { + switch (e) { case 0: - o._add.copyFromFloats(1, 0, 0); - break; + o._add.copyFromFloats(1, 0, 0); + break; case 1: - o._add.copyFromFloats(-1, 0, 0); - break; + o._add.copyFromFloats(-1, 0, 0); + break; case 2: - o._add.copyFromFloats(0, o._invertYAxis ? 1 : -1, 0); - break; + o._add.copyFromFloats( + 0, + o._invertYAxis ? 1 : -1, + 0 + ); + break; case 3: - o._add.copyFromFloats(0, o._invertYAxis ? -1 : 1, 0); - break; + o._add.copyFromFloats( + 0, + o._invertYAxis ? -1 : 1, + 0 + ); + break; case 4: - o._add.copyFromFloats(0, 0, 1); - break; + o._add.copyFromFloats(0, 0, 1); + break; case 5: - o._add.copyFromFloats(0, 0, -1) - } - o._attachedMesh && o.position.copyFrom(o._attachedMesh.getAbsolutePosition()), + o._add.copyFromFloats(0, 0, -1); + } + o._attachedMesh && + o.position.copyFrom( + o._attachedMesh.getAbsolutePosition() + ), o.position.addToRef(o._add, o._target), - a.j.LookAtLHToRef(o.position, o._target, a.x.Up(), o._viewMatrix), - i.activeCamera && (o._projectionMatrix = a.j.PerspectiveFovLH(Math.PI / 2, 1, i.activeCamera.minZ, i.activeCamera.maxZ), - i.setTransformMatrix(o._viewMatrix, o._projectionMatrix)), - i._forcedViewPosition = o.position - }), - this._renderTargetTexture.onAfterUnbindObservable.add(function() { - i._forcedViewPosition = null, - i.updateTransformMatrix(true) - }) - } - return Object.defineProperty(e.prototype, "samples", { - get: function() { - return this._renderTargetTexture.samples - }, - set: function(e) { - this._renderTargetTexture.samples = e - }, - enumerable: true, - configurable: true + a.j.LookAtLHToRef( + o.position, + o._target, + a.x.Up(), + o._viewMatrix + ), + i.activeCamera && + ((o._projectionMatrix = a.j.PerspectiveFovLH( + Math.PI / 2, + 1, + i.activeCamera.minZ, + i.activeCamera.maxZ + )), + i.setTransformMatrix( + o._viewMatrix, + o._projectionMatrix + )), + (i._forcedViewPosition = o.position); + } + ), + this._renderTargetTexture.onAfterUnbindObservable.add( + function () { + (i._forcedViewPosition = null), + i.updateTransformMatrix(true); + } + ); + } + return ( + Object.defineProperty(e.prototype, "samples", { + get: function () { + return this._renderTargetTexture.samples; + }, + set: function (e) { + this._renderTargetTexture.samples = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "refreshRate", { - get: function() { - return this._renderTargetTexture.refreshRate - }, - set: function(e) { - this._renderTargetTexture.refreshRate = e - }, - enumerable: true, - configurable: true + get: function () { + return this._renderTargetTexture.refreshRate; + }, + set: function (e) { + this._renderTargetTexture.refreshRate = e; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getScene = function () { + return this._scene; }), - e.prototype.getScene = function() { - return this._scene - } - , Object.defineProperty(e.prototype, "cubeTexture", { - get: function() { - return this._renderTargetTexture - }, - enumerable: true, - configurable: true + get: function () { + return this._renderTargetTexture; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "renderList", { - get: function() { - return this._renderTargetTexture.renderList - }, - enumerable: true, - configurable: true + get: function () { + return this._renderTargetTexture.renderList; + }, + enumerable: true, + configurable: true, }), - e.prototype.attachToMesh = function(e) { - this._attachedMesh = e - } - , - e.prototype.setRenderingAutoClearDepthStencil = function(e, t) { - this._renderTargetTexture.setRenderingAutoClearDepthStencil(e, t) - } - , - e.prototype.dispose = function() { - var e = this._scene.reflectionProbes.indexOf(this); - -1 !== e && this._scene.reflectionProbes.splice(e, 1), - this._renderTargetTexture && (this._renderTargetTexture.dispose(), - this._renderTargetTexture = null) - } - , - e.prototype.toString = function(e) { - var t = "Name: " + this.name; - return e && (t += ", position: " + this.position.toString(), - this._attachedMesh && (t += ", attached mesh: " + this._attachedMesh.name)), + (e.prototype.attachToMesh = function (e) { + this._attachedMesh = e; + }), + (e.prototype.setRenderingAutoClearDepthStencil = function ( + e, + t + ) { + this._renderTargetTexture.setRenderingAutoClearDepthStencil( + e, t - } - , - e.prototype.getClassName = function() { - return "ReflectionProbe" - } - , - e.prototype.serialize = function() { - var e = F.a.Serialize(this, this._renderTargetTexture.serialize()); - return e.isReflectionProbe = true, - e - } - , - e.Parse = function(t, i, n) { - var r = null; - if (i.reflectionProbes) - for (var o = 0; o < i.reflectionProbes.length; o++) { - var a = i.reflectionProbes[o]; - if (a.name === t.name) { - r = a; - break - } - } - return (r = F.a.Parse(function() { - return r || new e(t.name,t.renderTargetSize,i,t._generateMipMaps) - }, t, i, n)).cubeTexture._waitingRenderList = t.renderList, - t._attachedMesh && r.attachToMesh(i.getMeshByID(t._attachedMesh)), + ); + }), + (e.prototype.dispose = function () { + var e = this._scene.reflectionProbes.indexOf(this); + -1 !== e && this._scene.reflectionProbes.splice(e, 1), + this._renderTargetTexture && + (this._renderTargetTexture.dispose(), + (this._renderTargetTexture = null)); + }), + (e.prototype.toString = function (e) { + var t = "Name: " + this.name; + return ( + e && + ((t += ", position: " + this.position.toString()), + this._attachedMesh && + (t += + ", attached mesh: " + this._attachedMesh.name)), + t + ); + }), + (e.prototype.getClassName = function () { + return "ReflectionProbe"; + }), + (e.prototype.serialize = function () { + var e = F.a.Serialize( + this, + this._renderTargetTexture.serialize() + ); + return (e.isReflectionProbe = true), e; + }), + (e.Parse = function (t, i, n) { + var r = null; + if (i.reflectionProbes) + for (var o = 0; o < i.reflectionProbes.length; o++) { + var a = i.reflectionProbes[o]; + if (a.name === t.name) { + r = a; + break; + } + } + return ( + ((r = F.a.Parse( + function () { + return ( + r || + new e( + t.name, + t.renderTargetSize, + i, + t._generateMipMaps + ) + ); + }, + t, + i, + n + )).cubeTexture._waitingRenderList = t.renderList), + t._attachedMesh && + r.attachToMesh(i.getMeshByID(t._attachedMesh)), r - } - , + ); + }), h.c([Object(F.k)()], e.prototype, "_attachedMesh", void 0), h.c([Object(F.o)()], e.prototype, "position", void 0), e - }() - , so = function(e, t, i, n) { - for (var r = 0, o = t.materials.length; r < o; r++) { - var a = t.materials[r]; - if (a.id === e) - return Mr.a.Parse(a, i, n) + ); + })(), + so = function (e, t, i, n) { + for (var r = 0, o = t.materials.length; r < o; r++) { + var a = t.materials[r]; + if (a.id === e) return Mr.a.Parse(a, i, n); + } + return null; + }, + co = function (e, t, i) { + for (var n in t) + if (e.name === t[n]) return i.push(e.id), true; + return !( + !e.parentId || + -1 === i.indexOf(e.parentId) || + (i.push(e.id), 0) + ); + }, + uo = function (e, t) { + return ( + e + + " of " + + (t + ? t.file + + " from " + + t.name + + " version: " + + t.version + + ", exporter version: " + + t.exporter_version + : "unknown") + ); + }, + lo = function (e, t) { + var i = t; + if (t._waitingData.lods) { + if ( + t._waitingData.lods.ids && + t._waitingData.lods.ids.length > 0 + ) { + var n = t._waitingData.lods.ids, + r = i.isEnabled(false); + if (t._waitingData.lods.distances) { + var o = t._waitingData.lods.distances; + if (o.length >= n.length) { + var a = o.length > n.length ? o[o.length - 1] : 0; + i.setEnabled(false); + for (var s = 0; s < n.length; s++) { + var c = n[s], + u = e.getMeshByID(c); + null != u && i.addLODLevel(o[s], u); + } + a > 0 && i.addLODLevel(a, null), + true === r && i.setEnabled(true); + } else + Ee.h.Warn( + "Invalid level of detail distances for " + t.name + ); + } } - return null - } - , co = function(e, t, i) { - for (var n in t) - if (e.name === t[n]) - return i.push(e.id), - true; - return !(!e.parentId || -1 === i.indexOf(e.parentId) || (i.push(e.id), - 0)) - } - , uo = function(e, t) { - return e + " of " + (t ? t.file + " from " + t.name + " version: " + t.version + ", exporter version: " + t.exporter_version : "unknown") - } - , lo = function(e, t) { - var i = t; - if (t._waitingData.lods) { - if (t._waitingData.lods.ids && t._waitingData.lods.ids.length > 0) { - var n = t._waitingData.lods.ids - , r = i.isEnabled(false); - if (t._waitingData.lods.distances) { - var o = t._waitingData.lods.distances; - if (o.length >= n.length) { - var a = o.length > n.length ? o[o.length - 1] : 0; - i.setEnabled(false); - for (var s = 0; s < n.length; s++) { - var c = n[s] - , u = e.getMeshByID(c); - null != u && i.addLODLevel(o[s], u) - } - a > 0 && i.addLODLevel(a, null), - true === r && i.setEnabled(true) - } else - Ee.h.Warn("Invalid level of detail distances for " + t.name) - } - } - t._waitingData.lods = null + t._waitingData.lods = null; + } + }, + ho = function (e, t, i, n, o) { + void 0 === o && (o = false); + var a = new _e(e), + c = "importScene has failed JSON parse"; + try { + var u = JSON.parse(t); + c = ""; + var l, + h, + f = mn.loggingLevel === mn.DETAILED_LOGGING; + if ( + void 0 !== u.environmentTexture && + null !== u.environmentTexture + ) { + var d = void 0 === u.isPBR || u.isPBR; + if ( + u.environmentTextureType && + "BABYLON.HDRCubeTexture" === u.environmentTextureType + ) { + var p = u.environmentTextureSize + ? u.environmentTextureSize + : 128, + m = new Kr( + (u.environmentTexture.match(/https?:\/\//g) + ? "" + : i) + u.environmentTexture, + e, + p, + true, + !d + ); + u.environmentTextureRotationY && + (m.rotationY = u.environmentTextureRotationY), + (e.environmentTexture = m); + } else if (Ee.h.EndsWith(u.environmentTexture, ".env")) { + var _ = new Xn( + (u.environmentTexture.match(/https?:\/\//g) + ? "" + : i) + u.environmentTexture, + e + ); + u.environmentTextureRotationY && + (_.rotationY = u.environmentTextureRotationY), + (e.environmentTexture = _); + } else { + var v = Xn.CreateFromPrefilteredData( + (u.environmentTexture.match(/https?:\/\//g) + ? "" + : i) + u.environmentTexture, + e + ); + u.environmentTextureRotationY && + (v.rotationY = u.environmentTextureRotationY), + (e.environmentTexture = v); + } + if (true === u.createDefaultSkybox) { + var y = + void 0 !== e.activeCamera && null !== e.activeCamera + ? (e.activeCamera.maxZ - e.activeCamera.minZ) / 2 + : 1e3, + b = u.skyboxBlurLevel || 0; + e.createDefaultSkybox(e.environmentTexture, d, y, b); + } + a.environmentTexture = e.environmentTexture; } - } - , ho = function(e, t, i, n, o) { - void 0 === o && (o = false); - var a = new _e(e) - , c = "importScene has failed JSON parse"; - try { - var u = JSON.parse(t); - c = ""; - var l, h, f = mn.loggingLevel === mn.DETAILED_LOGGING; - if (void 0 !== u.environmentTexture && null !== u.environmentTexture) { - var d = void 0 === u.isPBR || u.isPBR; - if (u.environmentTextureType && "BABYLON.HDRCubeTexture" === u.environmentTextureType) { - var p = u.environmentTextureSize ? u.environmentTextureSize : 128 - , m = new Kr((u.environmentTexture.match(/https?:\/\//g) ? "" : i) + u.environmentTexture,e,p,true,!d); - u.environmentTextureRotationY && (m.rotationY = u.environmentTextureRotationY), - e.environmentTexture = m - } else if (Ee.h.EndsWith(u.environmentTexture, ".env")) { - var _ = new Xn((u.environmentTexture.match(/https?:\/\//g) ? "" : i) + u.environmentTexture,e); - u.environmentTextureRotationY && (_.rotationY = u.environmentTextureRotationY), - e.environmentTexture = _ - } else { - var v = Xn.CreateFromPrefilteredData((u.environmentTexture.match(/https?:\/\//g) ? "" : i) + u.environmentTexture, e); - u.environmentTextureRotationY && (v.rotationY = u.environmentTextureRotationY), - e.environmentTexture = v - } - if (true === u.createDefaultSkybox) { - var y = void 0 !== e.activeCamera && null !== e.activeCamera ? (e.activeCamera.maxZ - e.activeCamera.minZ) / 2 : 1e3 - , b = u.skyboxBlurLevel || 0; - e.createDefaultSkybox(e.environmentTexture, d, y, b) - } - a.environmentTexture = e.environmentTexture + if (void 0 !== u.lights && null !== u.lights) + for (l = 0, h = u.lights.length; l < h; l++) { + var E = u.lights[l], + T = Nn.a.Parse(E, e); + T && + (a.lights.push(T), + (c += 0 === l ? "\n\tLights:" : ""), + (c += "\n\t\t" + T.toString(f))); + } + if ( + void 0 !== u.reflectionProbes && + null !== u.reflectionProbes + ) + for (l = 0, h = u.reflectionProbes.length; l < h; l++) { + var A = u.reflectionProbes[l], + x = ao.Parse(A, e, i); + x && + (a.reflectionProbes.push(x), + (c += 0 === l ? "\n\tReflection Probes:" : ""), + (c += "\n\t\t" + x.toString(f))); + } + if (void 0 !== u.animations && null !== u.animations) + for (l = 0, h = u.animations.length; l < h; l++) { + var S = u.animations[l], + C = s.a.GetClass("BABYLON.Animation"); + if (C) { + var P = C.Parse(S); + e.animations.push(P), + a.animations.push(P), + (c += 0 === l ? "\n\tAnimations:" : ""), + (c += "\n\t\t" + P.toString(f)); } - if (void 0 !== u.lights && null !== u.lights) - for (l = 0, - h = u.lights.length; l < h; l++) { - var E = u.lights[l] - , T = Nn.a.Parse(E, e); - T && (a.lights.push(T), - c += 0 === l ? "\n\tLights:" : "", - c += "\n\t\t" + T.toString(f)) - } - if (void 0 !== u.reflectionProbes && null !== u.reflectionProbes) - for (l = 0, - h = u.reflectionProbes.length; l < h; l++) { - var A = u.reflectionProbes[l] - , x = ao.Parse(A, e, i); - x && (a.reflectionProbes.push(x), - c += 0 === l ? "\n\tReflection Probes:" : "", - c += "\n\t\t" + x.toString(f)) - } - if (void 0 !== u.animations && null !== u.animations) - for (l = 0, - h = u.animations.length; l < h; l++) { - var S = u.animations[l] - , C = s.a.GetClass("BABYLON.Animation"); - if (C) { - var P = C.Parse(S); - e.animations.push(P), - a.animations.push(P), - c += 0 === l ? "\n\tAnimations:" : "", - c += "\n\t\t" + P.toString(f) - } - } - if (void 0 !== u.materials && null !== u.materials) - for (l = 0, - h = u.materials.length; l < h; l++) { - var R = u.materials[l] - , M = Mr.a.Parse(R, e, i); - M && (a.materials.push(M), - c += 0 === l ? "\n\tMaterials:" : "", - c += "\n\t\t" + M.toString(f), - M.getActiveTextures().forEach(function(e) { - -1 == a.textures.indexOf(e) && a.textures.push(e) - })) - } - if (void 0 !== u.multiMaterials && null !== u.multiMaterials) - for (l = 0, - h = u.multiMaterials.length; l < h; l++) { - var w = u.multiMaterials[l] - , I = Wr.a.ParseMultiMaterial(w, e); - a.multiMaterials.push(I), - c += 0 === l ? "\n\tMultiMaterials:" : "", - c += "\n\t\t" + I.toString(f), - I.getActiveTextures().forEach(function(e) { - -1 == a.textures.indexOf(e) && a.textures.push(e) - }) - } - if (void 0 !== u.morphTargetManagers && null !== u.morphTargetManagers) - for (var D = 0, L = u.morphTargetManagers; D < L.length; D++) { - var F = L[D]; - a.morphTargetManagers.push(qr.Parse(F, e)) - } - if (void 0 !== u.skeletons && null !== u.skeletons) - for (l = 0, - h = u.skeletons.length; l < h; l++) { - var B = u.skeletons[l] - , N = Xe.Parse(B, e); - a.skeletons.push(N), - c += 0 === l ? "\n\tSkeletons:" : "", - c += "\n\t\t" + N.toString(f) - } - var k = u.geometries; - if (null != k) { - var U = new Array - , V = k.vertexData; - if (null != V) - for (l = 0, - h = V.length; l < h; l++) { - var G = V[l]; - U.push(Hr.a.Parse(G, e, i)) - } - U.forEach(function(e) { - e && a.geometries.push(e) - }) + } + if (void 0 !== u.materials && null !== u.materials) + for (l = 0, h = u.materials.length; l < h; l++) { + var R = u.materials[l], + M = Mr.a.Parse(R, e, i); + M && + (a.materials.push(M), + (c += 0 === l ? "\n\tMaterials:" : ""), + (c += "\n\t\t" + M.toString(f)), + M.getActiveTextures().forEach(function (e) { + -1 == a.textures.indexOf(e) && a.textures.push(e); + })); + } + if ( + void 0 !== u.multiMaterials && + null !== u.multiMaterials + ) + for (l = 0, h = u.multiMaterials.length; l < h; l++) { + var w = u.multiMaterials[l], + I = Wr.a.ParseMultiMaterial(w, e); + a.multiMaterials.push(I), + (c += 0 === l ? "\n\tMultiMaterials:" : ""), + (c += "\n\t\t" + I.toString(f)), + I.getActiveTextures().forEach(function (e) { + -1 == a.textures.indexOf(e) && a.textures.push(e); + }); + } + if ( + void 0 !== u.morphTargetManagers && + null !== u.morphTargetManagers + ) + for ( + var D = 0, L = u.morphTargetManagers; + D < L.length; + D++ + ) { + var F = L[D]; + a.morphTargetManagers.push(qr.Parse(F, e)); + } + if (void 0 !== u.skeletons && null !== u.skeletons) + for (l = 0, h = u.skeletons.length; l < h; l++) { + var B = u.skeletons[l], + N = Xe.Parse(B, e); + a.skeletons.push(N), + (c += 0 === l ? "\n\tSkeletons:" : ""), + (c += "\n\t\t" + N.toString(f)); + } + var k = u.geometries; + if (null != k) { + var U = new Array(), + V = k.vertexData; + if (null != V) + for (l = 0, h = V.length; l < h; l++) { + var G = V[l]; + U.push(Hr.a.Parse(G, e, i)); } - if (void 0 !== u.transformNodes && null !== u.transformNodes) - for (l = 0, - h = u.transformNodes.length; l < h; l++) { - var z = u.transformNodes[l] - , j = tr.a.Parse(z, e, i); - a.transformNodes.push(j) - } - if (void 0 !== u.meshes && null !== u.meshes) - for (l = 0, - h = u.meshes.length; l < h; l++) { - var H = u.meshes[l] - , W = me.a.Parse(H, e, i); - a.meshes.push(W), - c += 0 === l ? "\n\tMeshes:" : "", - c += "\n\t\t" + W.toString(f) - } - if (void 0 !== u.cameras && null !== u.cameras) - for (l = 0, - h = u.cameras.length; l < h; l++) { - var X = u.cameras[l] - , Y = ke.a.Parse(X, e); - a.cameras.push(Y), - c += 0 === l ? "\n\tCameras:" : "", - c += "\n\t\t" + Y.toString(f) - } - if (void 0 !== u.animationGroups && null !== u.animationGroups) - for (l = 0, - h = u.animationGroups.length; l < h; l++) { - var K = u.animationGroups[l] - , Q = $.Parse(K, e); - a.animationGroups.push(Q), - c += 0 === l ? "\n\tAnimationGroups:" : "", - c += "\n\t\t" + Q.toString(f) - } - for (l = 0, - h = e.cameras.length; l < h; l++) - (Y = e.cameras[l])._waitingParentId && (Y.parent = e.getLastEntryByID(Y._waitingParentId), - Y._waitingParentId = null); - for (l = 0, - h = e.lights.length; l < h; l++) { - var q = e.lights[l]; - q && q._waitingParentId && (q.parent = e.getLastEntryByID(q._waitingParentId), - q._waitingParentId = null) - } - for (l = 0, - h = e.transformNodes.length; l < h; l++) { - var Z = e.transformNodes[l]; - Z._waitingParentId && (Z.parent = e.getLastEntryByID(Z._waitingParentId), - Z._waitingParentId = null) - } - for (l = 0, - h = e.meshes.length; l < h; l++) - (W = e.meshes[l])._waitingParentId && (W.parent = e.getLastEntryByID(W._waitingParentId), - W._waitingParentId = null), - W._waitingData.lods && lo(e, W); - for (l = 0, - h = e.skeletons.length; l < h; l++) - (N = e.skeletons[l])._hasWaitingData && (null != N.bones && N.bones.forEach(function(t) { - if (t._waitingTransformNodeId) { - var i = e.getLastEntryByID(t._waitingTransformNodeId); - i && t.linkTransformNode(i), - t._waitingTransformNodeId = null - } - }), - N._hasWaitingData = null); - for (l = 0, - h = e.meshes.length; l < h; l++) { - var J = e.meshes[l]; - J._waitingData.freezeWorldMatrix ? (J.freezeWorldMatrix(), - J._waitingData.freezeWorldMatrix = null) : J.computeWorldMatrix(true) - } - for (l = 0, - h = e.lights.length; l < h; l++) { - var ee = e.lights[l]; - if (ee._excludedMeshesIds.length > 0) { - for (var te = 0; te < ee._excludedMeshesIds.length; te++) { - var ie = e.getMeshByID(ee._excludedMeshesIds[te]); - ie && ee.excludedMeshes.push(ie) - } - ee._excludedMeshesIds = [] - } - if (ee._includedOnlyMeshesIds.length > 0) { - for (var ne = 0; ne < ee._includedOnlyMeshesIds.length; ne++) { - var re = e.getMeshByID(ee._includedOnlyMeshesIds[ne]); - re && ee.includedOnlyMeshes.push(re) - } - ee._includedOnlyMeshesIds = [] - } - } - for (r.a.Parse(u, e, a, i), - l = 0, - h = e.meshes.length; l < h; l++) - (W = e.meshes[l])._waitingData.actions && (O.Parse(W._waitingData.actions, W, e), - W._waitingData.actions = null); - void 0 !== u.actions && null !== u.actions && O.Parse(u.actions, null, e), - o || a.removeAllFromScene() - } catch (e) { - var oe = uo("loadAssets", u ? u.producer : "Unknown") + c; - if (!n) - throw g.a.Log(oe), - e; - n(oe, e) - } finally { - null !== c && mn.loggingLevel !== mn.NO_LOGGING && g.a.Log(uo("loadAssets", u ? u.producer : "Unknown") + (mn.loggingLevel !== mn.MINIMAL_LOGGING ? c : "")) + U.forEach(function (e) { + e && a.geometries.push(e); + }); } - return a + if ( + void 0 !== u.transformNodes && + null !== u.transformNodes + ) + for (l = 0, h = u.transformNodes.length; l < h; l++) { + var z = u.transformNodes[l], + j = tr.a.Parse(z, e, i); + a.transformNodes.push(j); + } + if (void 0 !== u.meshes && null !== u.meshes) + for (l = 0, h = u.meshes.length; l < h; l++) { + var H = u.meshes[l], + W = me.a.Parse(H, e, i); + a.meshes.push(W), + (c += 0 === l ? "\n\tMeshes:" : ""), + (c += "\n\t\t" + W.toString(f)); + } + if (void 0 !== u.cameras && null !== u.cameras) + for (l = 0, h = u.cameras.length; l < h; l++) { + var X = u.cameras[l], + Y = ke.a.Parse(X, e); + a.cameras.push(Y), + (c += 0 === l ? "\n\tCameras:" : ""), + (c += "\n\t\t" + Y.toString(f)); + } + if ( + void 0 !== u.animationGroups && + null !== u.animationGroups + ) + for (l = 0, h = u.animationGroups.length; l < h; l++) { + var K = u.animationGroups[l], + Q = $.Parse(K, e); + a.animationGroups.push(Q), + (c += 0 === l ? "\n\tAnimationGroups:" : ""), + (c += "\n\t\t" + Q.toString(f)); + } + for (l = 0, h = e.cameras.length; l < h; l++) + (Y = e.cameras[l])._waitingParentId && + ((Y.parent = e.getLastEntryByID(Y._waitingParentId)), + (Y._waitingParentId = null)); + for (l = 0, h = e.lights.length; l < h; l++) { + var q = e.lights[l]; + q && + q._waitingParentId && + ((q.parent = e.getLastEntryByID(q._waitingParentId)), + (q._waitingParentId = null)); + } + for (l = 0, h = e.transformNodes.length; l < h; l++) { + var Z = e.transformNodes[l]; + Z._waitingParentId && + ((Z.parent = e.getLastEntryByID(Z._waitingParentId)), + (Z._waitingParentId = null)); + } + for (l = 0, h = e.meshes.length; l < h; l++) + (W = e.meshes[l])._waitingParentId && + ((W.parent = e.getLastEntryByID(W._waitingParentId)), + (W._waitingParentId = null)), + W._waitingData.lods && lo(e, W); + for (l = 0, h = e.skeletons.length; l < h; l++) + (N = e.skeletons[l])._hasWaitingData && + (null != N.bones && + N.bones.forEach(function (t) { + if (t._waitingTransformNodeId) { + var i = e.getLastEntryByID( + t._waitingTransformNodeId + ); + i && t.linkTransformNode(i), + (t._waitingTransformNodeId = null); + } + }), + (N._hasWaitingData = null)); + for (l = 0, h = e.meshes.length; l < h; l++) { + var J = e.meshes[l]; + J._waitingData.freezeWorldMatrix + ? (J.freezeWorldMatrix(), + (J._waitingData.freezeWorldMatrix = null)) + : J.computeWorldMatrix(true); + } + for (l = 0, h = e.lights.length; l < h; l++) { + var ee = e.lights[l]; + if (ee._excludedMeshesIds.length > 0) { + for ( + var te = 0; + te < ee._excludedMeshesIds.length; + te++ + ) { + var ie = e.getMeshByID(ee._excludedMeshesIds[te]); + ie && ee.excludedMeshes.push(ie); + } + ee._excludedMeshesIds = []; + } + if (ee._includedOnlyMeshesIds.length > 0) { + for ( + var ne = 0; + ne < ee._includedOnlyMeshesIds.length; + ne++ + ) { + var re = e.getMeshByID(ee._includedOnlyMeshesIds[ne]); + re && ee.includedOnlyMeshes.push(re); + } + ee._includedOnlyMeshesIds = []; + } + } + for ( + r.a.Parse(u, e, a, i), l = 0, h = e.meshes.length; + l < h; + l++ + ) + (W = e.meshes[l])._waitingData.actions && + (O.Parse(W._waitingData.actions, W, e), + (W._waitingData.actions = null)); + void 0 !== u.actions && + null !== u.actions && + O.Parse(u.actions, null, e), + o || a.removeAllFromScene(); + } catch (e) { + var oe = uo("loadAssets", u ? u.producer : "Unknown") + c; + if (!n) throw (g.a.Log(oe), e); + n(oe, e); + } finally { + null !== c && + mn.loggingLevel !== mn.NO_LOGGING && + g.a.Log( + uo("loadAssets", u ? u.producer : "Unknown") + + (mn.loggingLevel !== mn.MINIMAL_LOGGING ? c : "") + ); + } + return a; }; - mn.RegisterPlugin({ - name: "babylon.js", - extensions: ".babylon", - canDirectLoad: function(e) { - return -1 !== e.indexOf("babylon") - }, - importMesh: function(e, t, i, n, o, a, s, c) { - var u = "importMesh has failed JSON parse"; - try { - var l = JSON.parse(i); - u = ""; - var h = mn.loggingLevel === mn.DETAILED_LOGGING; - e ? Array.isArray(e) || (e = [e]) : e = null; - var f = new Array; - if (void 0 !== l.meshes && null !== l.meshes) { - var d, p, m, _ = [], v = []; - for (d = 0, - p = l.meshes.length; d < p; d++) { - var y = l.meshes[d]; - if (null === e || co(y, e, f)) { - if (null !== e && delete e[e.indexOf(y.name)], - void 0 !== y.geometryId && null !== y.geometryId && void 0 !== l.geometries && null !== l.geometries) { - var b = false; - ["boxes", "spheres", "cylinders", "toruses", "grounds", "planes", "torusKnots", "vertexData"].forEach(function(e) { - true !== b && l.geometries[e] && Array.isArray(l.geometries[e]) && l.geometries[e].forEach(function(i) { - if (i.id === y.geometryId) { - switch (e) { - case "vertexData": - Hr.a.Parse(i, t, n) - } - b = true - } - }) - }), - false === b && g.a.Warn("Geometry not found for mesh " + y.id) - } - if (y.materialId) { - var E = -1 !== v.indexOf(y.materialId); - if (false === E && void 0 !== l.multiMaterials && null !== l.multiMaterials) - for (var T = 0, A = l.multiMaterials.length; T < A; T++) { - var x = l.multiMaterials[T]; - if (x.id === y.materialId) { - for (var S = 0, C = x.materials.length; S < C; S++) { - var P, R = x.materials[S]; - v.push(R), - (P = so(R, l, t, n)) && (u += "\n\tMaterial " + P.toString(h)) - } - v.push(x.id); - var M = Wr.a.ParseMultiMaterial(x, t); - M && (E = true, - u += "\n\tMulti-Material " + M.toString(h)); - break - } - } - false === E && (v.push(y.materialId), - (P = so(y.materialId, l, t, n)) ? u += "\n\tMaterial " + P.toString(h) : g.a.Warn("Material not found for mesh " + y.id)) - } - if (y.skeletonId > -1 && void 0 !== l.skeletons && null !== l.skeletons && false == _.indexOf(y.skeletonId) > -1) - for (var O = 0, w = l.skeletons.length; O < w; O++) { - var I = l.skeletons[O]; - if (I.id === y.skeletonId) { - var D = Xe.Parse(I, t); - s.push(D), - _.push(I.id), - u += "\n\tSkeleton " + D.toString(h) - } - } - if (void 0 !== l.morphTargetManagers && null !== l.morphTargetManagers) - for (var L = 0, F = l.morphTargetManagers; L < F.length; L++) { - var B = F[L]; - qr.Parse(B, t) - } - var N = me.a.Parse(y, t, n); - o.push(N), - u += "\n\tMesh " + N.toString(h) + mn.RegisterPlugin({ + name: "babylon.js", + extensions: ".babylon", + canDirectLoad: function (e) { + return -1 !== e.indexOf("babylon"); + }, + importMesh: function (e, t, i, n, o, a, s, c) { + var u = "importMesh has failed JSON parse"; + try { + var l = JSON.parse(i); + u = ""; + var h = mn.loggingLevel === mn.DETAILED_LOGGING; + e ? Array.isArray(e) || (e = [e]) : (e = null); + var f = new Array(); + if (void 0 !== l.meshes && null !== l.meshes) { + var d, + p, + m, + _ = [], + v = []; + for (d = 0, p = l.meshes.length; d < p; d++) { + var y = l.meshes[d]; + if (null === e || co(y, e, f)) { + if ( + (null !== e && delete e[e.indexOf(y.name)], + void 0 !== y.geometryId && + null !== y.geometryId && + void 0 !== l.geometries && + null !== l.geometries) + ) { + var b = false; + [ + "boxes", + "spheres", + "cylinders", + "toruses", + "grounds", + "planes", + "torusKnots", + "vertexData", + ].forEach(function (e) { + true !== b && + l.geometries[e] && + Array.isArray(l.geometries[e]) && + l.geometries[e].forEach(function (i) { + if (i.id === y.geometryId) { + switch (e) { + case "vertexData": + Hr.a.Parse(i, t, n); } + b = true; + } + }); + }), + false === b && + g.a.Warn("Geometry not found for mesh " + y.id); + } + if (y.materialId) { + var E = -1 !== v.indexOf(y.materialId); + if ( + false === E && + void 0 !== l.multiMaterials && + null !== l.multiMaterials + ) + for ( + var T = 0, A = l.multiMaterials.length; + T < A; + T++ + ) { + var x = l.multiMaterials[T]; + if (x.id === y.materialId) { + for ( + var S = 0, C = x.materials.length; + S < C; + S++ + ) { + var P, + R = x.materials[S]; + v.push(R), + (P = so(R, l, t, n)) && + (u += "\n\tMaterial " + P.toString(h)); + } + v.push(x.id); + var M = Wr.a.ParseMultiMaterial(x, t); + M && + ((E = true), + (u += + "\n\tMulti-Material " + M.toString(h))); + break; } - for (d = 0, - p = t.meshes.length; d < p; d++) - (m = t.meshes[d])._waitingParentId && (m.parent = t.getLastEntryByID(m._waitingParentId), - m._waitingParentId = null), - m._waitingData.lods && lo(t, m); - for (d = 0, - p = t.skeletons.length; d < p; d++) - (D = t.skeletons[d])._hasWaitingData && (null != D.bones && D.bones.forEach(function(e) { - if (e._waitingTransformNodeId) { - var i = t.getLastEntryByID(e._waitingTransformNodeId); - i && e.linkTransformNode(i), - e._waitingTransformNodeId = null - } - }), - D._hasWaitingData = null); - for (d = 0, - p = t.meshes.length; d < p; d++) - (m = t.meshes[d])._waitingData.freezeWorldMatrix ? (m.freezeWorldMatrix(), - m._waitingData.freezeWorldMatrix = null) : m.computeWorldMatrix(true) + } + false === E && + (v.push(y.materialId), + (P = so(y.materialId, l, t, n)) + ? (u += "\n\tMaterial " + P.toString(h)) + : g.a.Warn( + "Material not found for mesh " + y.id + )); + } + if ( + y.skeletonId > -1 && + void 0 !== l.skeletons && + null !== l.skeletons && + false == _.indexOf(y.skeletonId) > -1 + ) + for ( + var O = 0, w = l.skeletons.length; + O < w; + O++ + ) { + var I = l.skeletons[O]; + if (I.id === y.skeletonId) { + var D = Xe.Parse(I, t); + s.push(D), + _.push(I.id), + (u += "\n\tSkeleton " + D.toString(h)); + } } - if (void 0 !== l.particleSystems && null !== l.particleSystems) { - var k = r.a.GetIndividualParser(Se.a.NAME_PARTICLESYSTEM); - if (k) - for (d = 0, - p = l.particleSystems.length; d < p; d++) { - var U = l.particleSystems[d]; - -1 !== f.indexOf(U.emitterId) && a.push(k(U, t, n)) - } + if ( + void 0 !== l.morphTargetManagers && + null !== l.morphTargetManagers + ) + for ( + var L = 0, F = l.morphTargetManagers; + L < F.length; + L++ + ) { + var B = F[L]; + qr.Parse(B, t); } - return true - } catch (e) { - var V = uo("importMesh", l ? l.producer : "Unknown") + u; - if (!c) - throw g.a.Log(V), - e; - c(V, e) - } finally { - null !== u && mn.loggingLevel !== mn.NO_LOGGING && g.a.Log(uo("importMesh", l ? l.producer : "Unknown") + (mn.loggingLevel !== mn.MINIMAL_LOGGING ? u : "")) + var N = me.a.Parse(y, t, n); + o.push(N), (u += "\n\tMesh " + N.toString(h)); } - return false - }, - load: function(e, t, i, n) { - var r = "importScene has failed JSON parse"; - try { - var o = JSON.parse(t); - if (r = "", - void 0 !== o.useDelayedTextureLoading && null !== o.useDelayedTextureLoading && (e.useDelayedTextureLoading = o.useDelayedTextureLoading && !mn.ForceFullSceneLoadingForIncremental), - void 0 !== o.autoClear && null !== o.autoClear && (e.autoClear = o.autoClear), - void 0 !== o.clearColor && null !== o.clearColor && (e.clearColor = a.f.FromArray(o.clearColor)), - void 0 !== o.ambientColor && null !== o.ambientColor && (e.ambientColor = a.e.FromArray(o.ambientColor)), - void 0 !== o.gravity && null !== o.gravity && (e.gravity = a.x.FromArray(o.gravity)), - o.fogMode && 0 !== o.fogMode) - switch (e.fogMode = o.fogMode, - e.fogColor = a.e.FromArray(o.fogColor), - e.fogStart = o.fogStart, - e.fogEnd = o.fogEnd, - e.fogDensity = o.fogDensity, - r += "\tFog mode for scene: ", - e.fogMode) { - case 1: - r += "exp\n"; - break; - case 2: - r += "exp2\n"; - break; - case 3: - r += "linear\n" - } - if (o.physicsEnabled) { - var s; - "cannon" === o.physicsEngine ? s = new to : "oimo" === o.physicsEngine ? s = new io : "ammo" === o.physicsEngine && (s = new oo), - r = "\tPhysics engine " + (o.physicsEngine ? o.physicsEngine : "oimo") + " enabled\n"; - var c = o.physicsGravity ? a.x.FromArray(o.physicsGravity) : null; - e.enablePhysics(c, s) - } - if (void 0 !== o.metadata && null !== o.metadata && (e.metadata = o.metadata), - void 0 !== o.collisionsEnabled && null !== o.collisionsEnabled && (e.collisionsEnabled = o.collisionsEnabled), - !ho(e, t, i, n, true)) - return false; - if (o.autoAnimate && e.beginAnimation(e, o.autoAnimateFrom, o.autoAnimateTo, o.autoAnimateLoop, o.autoAnimateSpeed || 1), - void 0 !== o.activeCameraID && null !== o.activeCameraID && e.setActiveCameraByID(o.activeCameraID), - void 0 !== o.environmentTexture && null !== o.environmentTexture) { - var u = void 0 === o.isPBR || o.isPBR; - if (o.environmentTextureType && "BABYLON.HDRCubeTexture" === o.environmentTextureType) { - var l = o.environmentTextureSize ? o.environmentTextureSize : 128 - , h = new Kr(i + o.environmentTexture,e,l,true,!u); - o.environmentTextureRotationY && (h.rotationY = o.environmentTextureRotationY), - e.environmentTexture = h - } else if (Ee.h.EndsWith(o.environmentTexture, ".env")) { - var f = new Xn(i + o.environmentTexture,e); - o.environmentTextureRotationY && (f.rotationY = o.environmentTextureRotationY), - e.environmentTexture = f - } else { - var d = Xn.CreateFromPrefilteredData(i + o.environmentTexture, e); - o.environmentTextureRotationY && (d.rotationY = o.environmentTextureRotationY), - e.environmentTexture = d - } - if (true === o.createDefaultSkybox) { - var p = void 0 !== e.activeCamera && null !== e.activeCamera ? (e.activeCamera.maxZ - e.activeCamera.minZ) / 2 : 1e3 - , m = o.skyboxBlurLevel || 0; - e.createDefaultSkybox(e.environmentTexture, u, p, m) - } - } - return true - } catch (e) { - var _ = uo("importScene", o ? o.producer : "Unknown") + r; - if (!n) - throw g.a.Log(_), - e; - n(_, e) - } finally { - null !== r && mn.loggingLevel !== mn.NO_LOGGING && g.a.Log(uo("importScene", o ? o.producer : "Unknown") + (mn.loggingLevel !== mn.MINIMAL_LOGGING ? r : "")) + } + for (d = 0, p = t.meshes.length; d < p; d++) + (m = t.meshes[d])._waitingParentId && + ((m.parent = t.getLastEntryByID(m._waitingParentId)), + (m._waitingParentId = null)), + m._waitingData.lods && lo(t, m); + for (d = 0, p = t.skeletons.length; d < p; d++) + (D = t.skeletons[d])._hasWaitingData && + (null != D.bones && + D.bones.forEach(function (e) { + if (e._waitingTransformNodeId) { + var i = t.getLastEntryByID( + e._waitingTransformNodeId + ); + i && e.linkTransformNode(i), + (e._waitingTransformNodeId = null); + } + }), + (D._hasWaitingData = null)); + for (d = 0, p = t.meshes.length; d < p; d++) + (m = t.meshes[d])._waitingData.freezeWorldMatrix + ? (m.freezeWorldMatrix(), + (m._waitingData.freezeWorldMatrix = null)) + : m.computeWorldMatrix(true); + } + if ( + void 0 !== l.particleSystems && + null !== l.particleSystems + ) { + var k = r.a.GetIndividualParser(Se.a.NAME_PARTICLESYSTEM); + if (k) + for (d = 0, p = l.particleSystems.length; d < p; d++) { + var U = l.particleSystems[d]; + -1 !== f.indexOf(U.emitterId) && a.push(k(U, t, n)); } - return false - }, - loadAssetContainer: function(e, t, i, n) { - return ho(e, t, i, n) } - }); - var fo = n(93) - , po = function() { - function e() { - this._isEnabled = true, - this.leftColor = a.e.White(), - this.rightColor = a.e.Black(), - this.bias = 0, - this.power = 1 + return true; + } catch (e) { + var V = uo("importMesh", l ? l.producer : "Unknown") + u; + if (!c) throw (g.a.Log(V), e); + c(V, e); + } finally { + null !== u && + mn.loggingLevel !== mn.NO_LOGGING && + g.a.Log( + uo("importMesh", l ? l.producer : "Unknown") + + (mn.loggingLevel !== mn.MINIMAL_LOGGING ? u : "") + ); + } + return false; + }, + load: function (e, t, i, n) { + var r = "importScene has failed JSON parse"; + try { + var o = JSON.parse(t); + if ( + ((r = ""), + void 0 !== o.useDelayedTextureLoading && + null !== o.useDelayedTextureLoading && + (e.useDelayedTextureLoading = + o.useDelayedTextureLoading && + !mn.ForceFullSceneLoadingForIncremental), + void 0 !== o.autoClear && + null !== o.autoClear && + (e.autoClear = o.autoClear), + void 0 !== o.clearColor && + null !== o.clearColor && + (e.clearColor = a.f.FromArray(o.clearColor)), + void 0 !== o.ambientColor && + null !== o.ambientColor && + (e.ambientColor = a.e.FromArray(o.ambientColor)), + void 0 !== o.gravity && + null !== o.gravity && + (e.gravity = a.x.FromArray(o.gravity)), + o.fogMode && 0 !== o.fogMode) + ) + switch ( + ((e.fogMode = o.fogMode), + (e.fogColor = a.e.FromArray(o.fogColor)), + (e.fogStart = o.fogStart), + (e.fogEnd = o.fogEnd), + (e.fogDensity = o.fogDensity), + (r += "\tFog mode for scene: "), + e.fogMode) + ) { + case 1: + r += "exp\n"; + break; + case 2: + r += "exp2\n"; + break; + case 3: + r += "linear\n"; + } + if (o.physicsEnabled) { + var s; + "cannon" === o.physicsEngine + ? (s = new to()) + : "oimo" === o.physicsEngine + ? (s = new io()) + : "ammo" === o.physicsEngine && (s = new oo()), + (r = + "\tPhysics engine " + + (o.physicsEngine ? o.physicsEngine : "oimo") + + " enabled\n"); + var c = o.physicsGravity + ? a.x.FromArray(o.physicsGravity) + : null; + e.enablePhysics(c, s); } - return Object.defineProperty(e.prototype, "isEnabled", { - get: function() { - return this._isEnabled - }, - set: function(e) { - this._isEnabled !== e && (this._isEnabled = e, - ve.b.MarkAllMaterialsAsDirty(_.a.MATERIAL_FresnelDirtyFlag | _.a.MATERIAL_MiscDirtyFlag)) - }, - enumerable: true, - configurable: true + if ( + (void 0 !== o.metadata && + null !== o.metadata && + (e.metadata = o.metadata), + void 0 !== o.collisionsEnabled && + null !== o.collisionsEnabled && + (e.collisionsEnabled = o.collisionsEnabled), + !ho(e, t, i, n, true)) + ) + return false; + if ( + (o.autoAnimate && + e.beginAnimation( + e, + o.autoAnimateFrom, + o.autoAnimateTo, + o.autoAnimateLoop, + o.autoAnimateSpeed || 1 + ), + void 0 !== o.activeCameraID && + null !== o.activeCameraID && + e.setActiveCameraByID(o.activeCameraID), + void 0 !== o.environmentTexture && + null !== o.environmentTexture) + ) { + var u = void 0 === o.isPBR || o.isPBR; + if ( + o.environmentTextureType && + "BABYLON.HDRCubeTexture" === o.environmentTextureType + ) { + var l = o.environmentTextureSize + ? o.environmentTextureSize + : 128, + h = new Kr(i + o.environmentTexture, e, l, true, !u); + o.environmentTextureRotationY && + (h.rotationY = o.environmentTextureRotationY), + (e.environmentTexture = h); + } else if (Ee.h.EndsWith(o.environmentTexture, ".env")) { + var f = new Xn(i + o.environmentTexture, e); + o.environmentTextureRotationY && + (f.rotationY = o.environmentTextureRotationY), + (e.environmentTexture = f); + } else { + var d = Xn.CreateFromPrefilteredData( + i + o.environmentTexture, + e + ); + o.environmentTextureRotationY && + (d.rotationY = o.environmentTextureRotationY), + (e.environmentTexture = d); + } + if (true === o.createDefaultSkybox) { + var p = + void 0 !== e.activeCamera && null !== e.activeCamera + ? (e.activeCamera.maxZ - e.activeCamera.minZ) / 2 + : 1e3, + m = o.skyboxBlurLevel || 0; + e.createDefaultSkybox(e.environmentTexture, u, p, m); + } + } + return true; + } catch (e) { + var _ = uo("importScene", o ? o.producer : "Unknown") + r; + if (!n) throw (g.a.Log(_), e); + n(_, e); + } finally { + null !== r && + mn.loggingLevel !== mn.NO_LOGGING && + g.a.Log( + uo("importScene", o ? o.producer : "Unknown") + + (mn.loggingLevel !== mn.MINIMAL_LOGGING ? r : "") + ); + } + return false; + }, + loadAssetContainer: function (e, t, i, n) { + return ho(e, t, i, n); + }, + }); + var fo = n(93), + po = (function () { + function e() { + (this._isEnabled = true), + (this.leftColor = a.e.White()), + (this.rightColor = a.e.Black()), + (this.bias = 0), + (this.power = 1); + } + return ( + Object.defineProperty(e.prototype, "isEnabled", { + get: function () { + return this._isEnabled; + }, + set: function (e) { + this._isEnabled !== e && + ((this._isEnabled = e), + ve.b.MarkAllMaterialsAsDirty( + _.a.MATERIAL_FresnelDirtyFlag | + _.a.MATERIAL_MiscDirtyFlag + )); + }, + enumerable: true, + configurable: true, }), - e.prototype.clone = function() { - var t = new e; - return M.a.DeepCopy(this, t), - t - } - , - e.prototype.serialize = function() { - var e = {}; - return e.isEnabled = this.isEnabled, - e.leftColor = this.leftColor.asArray(), - e.rightColor = this.rightColor.asArray(), - e.bias = this.bias, - e.power = this.power, + (e.prototype.clone = function () { + var t = new e(); + return M.a.DeepCopy(this, t), t; + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.isEnabled = this.isEnabled), + (e.leftColor = this.leftColor.asArray()), + (e.rightColor = this.rightColor.asArray()), + (e.bias = this.bias), + (e.power = this.power), e - } - , - e.Parse = function(t) { - var i = new e; - return i.isEnabled = t.isEnabled, - i.leftColor = a.e.FromArray(t.leftColor), - i.rightColor = a.e.FromArray(t.rightColor), - i.bias = t.bias, - i.power = t.power || 1, + ); + }), + (e.Parse = function (t) { + var i = new e(); + return ( + (i.isEnabled = t.isEnabled), + (i.leftColor = a.e.FromArray(t.leftColor)), + (i.rightColor = a.e.FromArray(t.rightColor)), + (i.bias = t.bias), + (i.power = t.power || 1), i - } - , + ); + }), e - }(); - F.a._FresnelParametersParser = po.Parse; - var mo = function(e) { - function t(t, i) { - var n = e.call(this, t, i) || this; - return n.maxSimultaneousLights = 4, - n.disableLighting = false, - n.invertNormalMapX = false, - n.invertNormalMapY = false, - n.emissiveColor = new a.e(0,0,0), - n.occlusionStrength = 1, - n.useLightmapAsShadowmap = false, - n._useAlphaFromAlbedoTexture = true, - n._useAmbientInGrayScale = true, - n - } - return h.d(t, e), + ); + })(); + F.a._FresnelParametersParser = po.Parse; + var mo = (function (e) { + function t(t, i) { + var n = e.call(this, t, i) || this; + return ( + (n.maxSimultaneousLights = 4), + (n.disableLighting = false), + (n.invertNormalMapX = false), + (n.invertNormalMapY = false), + (n.emissiveColor = new a.e(0, 0, 0)), + (n.occlusionStrength = 1), + (n.useLightmapAsShadowmap = false), + (n._useAlphaFromAlbedoTexture = true), + (n._useAmbientInGrayScale = true), + n + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "doubleSided", { - get: function() { - return this._twoSidedLighting - }, - set: function(e) { - this._twoSidedLighting !== e && (this._twoSidedLighting = e, - this.backFaceCulling = !e, - this._markAllSubMeshesAsTexturesDirty()) - }, - enumerable: true, - configurable: true + get: function () { + return this._twoSidedLighting; + }, + set: function (e) { + this._twoSidedLighting !== e && + ((this._twoSidedLighting = e), + (this.backFaceCulling = !e), + this._markAllSubMeshesAsTexturesDirty()); + }, + enumerable: true, + configurable: true, }), - t.prototype.getClassName = function() { - return "PBRBaseSimpleMaterial" - } - , - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "maxSimultaneousLights", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "disableLighting", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_reflectionTexture")], t.prototype, "environmentTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapX", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapY", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_bumpTexture")], t.prototype, "normalTexture", void 0), - h.c([Object(F.e)("emissive"), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveColor", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_ambientTextureStrength")], t.prototype, "occlusionStrength", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_ambientTexture")], t.prototype, "occlusionTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_alphaCutOff")], t.prototype, "alphaCutOff", void 0), + (t.prototype.getClassName = function () { + return "PBRBaseSimpleMaterial"; + }), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsLightsDirty"), + ], + t.prototype, + "maxSimultaneousLights", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsLightsDirty"), + ], + t.prototype, + "disableLighting", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_reflectionTexture" + ), + ], + t.prototype, + "environmentTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "invertNormalMapX", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "invertNormalMapY", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_bumpTexture" + ), + ], + t.prototype, + "normalTexture", + void 0 + ), + h.c( + [ + Object(F.e)("emissive"), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "emissiveColor", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "emissiveTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_ambientTextureStrength" + ), + ], + t.prototype, + "occlusionStrength", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_ambientTexture" + ), + ], + t.prototype, + "occlusionTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_alphaCutOff" + ), + ], + t.prototype, + "alphaCutOff", + void 0 + ), h.c([Object(F.c)()], t.prototype, "doubleSided", null), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", null)], t.prototype, "lightmapTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLightmapAsShadowmap", void 0), + h.c( + [ + Object(F.m)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty", null), + ], + t.prototype, + "lightmapTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "useLightmapAsShadowmap", + void 0 + ), t - }(lr) - , go = function(e) { - function t(t, i) { - var n = e.call(this, t, i) || this; - return n._useRoughnessFromMetallicTextureAlpha = false, - n._useRoughnessFromMetallicTextureGreen = true, - n._useMetallnessFromMetallicTextureBlue = true, - n.metallic = 1, - n.roughness = 1, - n - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "PBRMetallicRoughnessMaterial" - } - , - t.prototype.clone = function(e) { - var i = this - , n = F.a.Clone(function() { - return new t(e,i.getScene()) + ); + })(lr), + go = (function (e) { + function t(t, i) { + var n = e.call(this, t, i) || this; + return ( + (n._useRoughnessFromMetallicTextureAlpha = false), + (n._useRoughnessFromMetallicTextureGreen = true), + (n._useMetallnessFromMetallicTextureBlue = true), + (n.metallic = 1), + (n.roughness = 1), + n + ); + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "PBRMetallicRoughnessMaterial"; + }), + (t.prototype.clone = function (e) { + var i = this, + n = F.a.Clone(function () { + return new t(e, i.getScene()); }, this); - return n.id = e, - n.name = e, + return ( + (n.id = e), + (n.name = e), this.clearCoat.copyTo(n.clearCoat), this.anisotropy.copyTo(n.anisotropy), this.brdf.copyTo(n.brdf), this.sheen.copyTo(n.sheen), n - } - , - t.prototype.serialize = function() { - var e = F.a.Serialize(this); - return e.customType = "BABYLON.PBRMetallicRoughnessMaterial", - e.clearCoat = this.clearCoat.serialize(), - e.anisotropy = this.anisotropy.serialize(), - e.brdf = this.brdf.serialize(), - e.sheen = this.sheen.serialize(), + ); + }), + (t.prototype.serialize = function () { + var e = F.a.Serialize(this); + return ( + (e.customType = "BABYLON.PBRMetallicRoughnessMaterial"), + (e.clearCoat = this.clearCoat.serialize()), + (e.anisotropy = this.anisotropy.serialize()), + (e.brdf = this.brdf.serialize()), + (e.sheen = this.sheen.serialize()), e - } - , - t.Parse = function(e, i, n) { - var r = F.a.Parse(function() { - return new t(e.name,i) - }, e, i, n); - return e.clearCoat && r.clearCoat.parse(e.clearCoat), + ); + }), + (t.Parse = function (e, i, n) { + var r = F.a.Parse( + function () { + return new t(e.name, i); + }, + e, + i, + n + ); + return ( + e.clearCoat && r.clearCoat.parse(e.clearCoat), e.anisotropy && r.anisotropy.parse(e.anisotropy), e.brdf && r.brdf.parse(e.brdf), e.sheen && r.sheen.parse(e.brdf), r - } - , - h.c([Object(F.e)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_albedoColor")], t.prototype, "baseColor", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_albedoTexture")], t.prototype, "baseTexture", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallic", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "roughness", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_metallicTexture")], t.prototype, "metallicRoughnessTexture", void 0), + ); + }), + h.c( + [ + Object(F.e)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_albedoColor" + ), + ], + t.prototype, + "baseColor", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_albedoTexture" + ), + ], + t.prototype, + "baseTexture", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "metallic", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)("_markAllSubMeshesAsTexturesDirty"), + ], + t.prototype, + "roughness", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_metallicTexture" + ), + ], + t.prototype, + "metallicRoughnessTexture", + void 0 + ), t - }(mo); - s.a.RegisteredTypes["BABYLON.PBRMetallicRoughnessMaterial"] = go; - var _o = function(e) { - function t(t, i) { - var n = e.call(this, t, i) || this; - return n._useMicroSurfaceFromReflectivityMapAlpha = true, - n - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "PBRSpecularGlossinessMaterial" - } - , - t.prototype.clone = function(e) { - var i = this - , n = F.a.Clone(function() { - return new t(e,i.getScene()) - }, this); - return n.id = e, - n.name = e, - this.clearCoat.copyTo(n.clearCoat), - this.anisotropy.copyTo(n.anisotropy), - this.brdf.copyTo(n.brdf), - this.sheen.copyTo(n.sheen), - n - } - , - t.prototype.serialize = function() { - var e = F.a.Serialize(this); - return e.customType = "BABYLON.PBRSpecularGlossinessMaterial", - e.clearCoat = this.clearCoat.serialize(), - e.anisotropy = this.anisotropy.serialize(), - e.brdf = this.brdf.serialize(), - e.sheen = this.sheen.serialize(), - e - } - , - t.Parse = function(e, i, n) { - var r = F.a.Parse(function() { - return new t(e.name,i) - }, e, i, n); - return e.clearCoat && r.clearCoat.parse(e.clearCoat), - e.anisotropy && r.anisotropy.parse(e.anisotropy), - e.brdf && r.brdf.parse(e.brdf), - e.sheen && r.sheen.parse(e.brdf), - r - } - , - h.c([Object(F.e)("diffuse"), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_albedoColor")], t.prototype, "diffuseColor", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_albedoTexture")], t.prototype, "diffuseTexture", void 0), - h.c([Object(F.e)("specular"), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_reflectivityColor")], t.prototype, "specularColor", void 0), - h.c([Object(F.c)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_microSurface")], t.prototype, "glossiness", void 0), - h.c([Object(F.m)(), Object(F.b)("_markAllSubMeshesAsTexturesDirty", "_reflectivityTexture")], t.prototype, "specularGlossinessTexture", void 0), - t - }(mo); - s.a.RegisteredTypes["BABYLON.PBRSpecularGlossinessMaterial"] = _o; - var vo = n(76) - , yo = function(e) { - function t(t, i) { - var n = e.call(this, i) || this; - return t ? (n._engine = i.getEngine(), - n._textureMatrix = a.j.Identity(), - n.name = t, - n.url = t, - n.hasAlpha = false, - n.isCube = false, - n.is3D = n._engine.webGLVersion > 1, - n.wrapU = _.a.TEXTURE_CLAMP_ADDRESSMODE, - n.wrapV = _.a.TEXTURE_CLAMP_ADDRESSMODE, - n.wrapR = _.a.TEXTURE_CLAMP_ADDRESSMODE, - n.anisotropicFilteringLevel = 1, - n._texture = n._getFromCache(t, true), - n._texture || (i.useDelayedTextureLoading ? n.delayLoadState = _.a.DELAYLOADSTATE_NOTLOADED : n.loadTexture()), - n) : n - } - return h.d(t, e), - t.prototype.getTextureMatrix = function() { - return this._textureMatrix - } - , - t.prototype.load3dlTexture = function() { - var e, i = this._engine; - e = 1 === i.webGLVersion ? i.createRawTexture(null, 1, 1, _.a.TEXTUREFORMAT_RGBA, false, false, _.a.TEXTURE_BILINEAR_SAMPLINGMODE) : i.createRawTexture3D(null, 1, 1, 1, _.a.TEXTUREFORMAT_RGBA, false, false, _.a.TEXTURE_BILINEAR_SAMPLINGMODE), - this._texture = e; - var n = function(n) { - if ("string" == typeof n) { - for (var r, o = null, a = null, s = n.split("\n"), c = 0, u = 0, l = 0, h = 0, f = 0, d = 0; d < s.length; d++) - if (r = s[d], - t._noneEmptyLineRegex.test(r) && 0 !== r.indexOf("#")) { - var p = r.split(" "); - if (0 !== c) { - if (0 != c) { - var m = Math.max(parseInt(p[0]), 0) - , g = Math.max(parseInt(p[1]), 0) - , v = Math.max(parseInt(p[2]), 0); - f = Math.max(m, f), - f = Math.max(g, f), - f = Math.max(v, f); - var y = 4 * (u + h * c + l * c * c); - a && (a[y + 0] = m, - a[y + 1] = g, - a[y + 2] = v), - ++l % c == 0 && (l = 0, - ++h % c == 0 && (u++, - h = 0)) - } - } else - c = p.length, - o = new Uint8Array(c * c * c * 4), - a = new Float32Array(c * c * c * 4) - } - if (a && o) - for (d = 0; d < a.length; d++) - if (d > 0 && (d + 1) % 4 == 0) - o[d] = 255; - else { - var b = a[d]; - o[d] = b / f * 255 - } - e.is3D ? (e.updateSize(c, c, c), - i.updateRawTexture3D(e, o, _.a.TEXTUREFORMAT_RGBA, false)) : (e.updateSize(c * c, c), - i.updateRawTexture(e, o, _.a.TEXTUREFORMAT_RGBA, false)) - } - } - , r = this.getScene(); - return r ? r._loadFile(this.url, n) : this._engine._loadFile(this.url, n), - this._texture - } - , - t.prototype.loadTexture = function() { - this.url && this.url.toLocaleLowerCase().indexOf(".3dl") == this.url.length - 4 && this.load3dlTexture() - } - , - t.prototype.clone = function() { - var e = new t(this.url,this.getScene()); - return e.level = this.level, - e - } - , - t.prototype.delayLoad = function() { - this.delayLoadState === _.a.DELAYLOADSTATE_NOTLOADED && (this.delayLoadState = _.a.DELAYLOADSTATE_LOADED, - this._texture = this._getFromCache(this.url, true), - this._texture || this.loadTexture()) - } - , - t.Parse = function(e, i) { - var n = null; - return e.name && !e.isRenderTarget && ((n = new t(e.name,i)).name = e.name, - n.level = e.level), - n - } - , - t.prototype.serialize = function() { - if (!this.name) - return null; - var e = {}; - return e.name = this.name, - e.level = this.level, - e.customType = "BABYLON.ColorGradingTexture", - e - } - , - t._noneEmptyLineRegex = /\S+/, - t - }(jn.a); - s.a.RegisteredTypes["BABYLON.ColorGradingTexture"] = yo; - var bo = function(e) { - function t(t, i, n, r, o, a, s) { - void 0 === r && (r = false), - void 0 === o && (o = true), - void 0 === a && (a = null), - void 0 === s && (s = null); - var c = e.call(this, i) || this; - if (c._onLoad = null, - c._onError = null, - c.coordinatesMode = je.a.CUBIC_MODE, - !t) - throw new Error("Image url is not set"); - return c.name = t, - c.url = t, - c._size = n, - c._noMipmap = r, - c.gammaSpace = o, - c._onLoad = a, - c._onError = s, - c.hasAlpha = false, - c.isCube = true, - c._texture = c._getFromCache(t, c._noMipmap), - c._texture ? a && (c._texture.isReady ? Ee.h.SetImmediate(function() { - return a() - }) : c._texture.onLoadedObservable.add(a)) : i.useDelayedTextureLoading ? c.delayLoadState = ve.b.DELAYLOADSTATE_NOTLOADED : c.loadImage(c.loadTexture.bind(c), c._onError), - c - } - return h.d(t, e), - t.prototype.loadImage = function(e, t) { - var i = this - , n = document.createElement("canvas") - , r = new Image; - r.addEventListener("load", function() { - i._width = r.width, - i._height = r.height, - n.width = i._width, - n.height = i._height; - var t = n.getContext("2d"); - t.drawImage(r, 0, 0); - var o = t.getImageData(0, 0, r.width, r.height); - i._buffer = o.data.buffer, - n.remove(), - e() - }), - r.addEventListener("error", function(e) { - t && t(i.getClassName() + " could not be loaded", e) - }), - r.src = this.url - } - , - t.prototype.loadTexture = function() { - var e = this - , i = this.getScene(); - i && (this._texture = i.getEngine().createRawCubeTextureFromUrl(this.url, i, this._size, ve.b.TEXTUREFORMAT_RGB, i.getEngine().getCaps().textureFloat ? ve.b.TEXTURETYPE_FLOAT : ve.b.TEXTURETYPE_UNSIGNED_INTEGER, this._noMipmap, function() { - for (var i = e.getFloat32ArrayFromArrayBuffer(e._buffer), n = Xr.ConvertPanoramaToCubemap(i, e._width, e._height, e._size), r = [], o = 0; o < 6; o++) { - var a = n[t._FacesMapping[o]]; - r.push(a) - } - return r - }, null, this._onLoad, this._onError)) - } - , - t.prototype.getFloat32ArrayFromArrayBuffer = function(e) { - for (var t = new DataView(e), i = new Float32Array(3 * e.byteLength / 4), n = 0, r = 0; r < e.byteLength; r++) - (r + 1) % 4 != 0 && (i[n++] = t.getUint8(r) / 255); - return i - } - , - t.prototype.getClassName = function() { - return "EquiRectangularCubeTexture" - } - , - t.prototype.clone = function() { - var e = this.getScene(); - if (!e) - return this; - var i = new t(this.url,e,this._size,this._noMipmap,this.gammaSpace); - return i.level = this.level, - i.wrapU = this.wrapU, - i.wrapV = this.wrapV, - i.coordinatesIndex = this.coordinatesIndex, - i.coordinatesMode = this.coordinatesMode, - i - } - , - t._FacesMapping = ["right", "left", "up", "down", "front", "back"], - t - }(jn.a) - , Eo = function() { - function e() {} - return e.GetTGAHeader = function(e) { - var t = 0; - return { - id_length: e[t++], - colormap_type: e[t++], - image_type: e[t++], - colormap_index: e[t++] | e[t++] << 8, - colormap_length: e[t++] | e[t++] << 8, - colormap_size: e[t++], - origin: [e[t++] | e[t++] << 8, e[t++] | e[t++] << 8], - width: e[t++] | e[t++] << 8, - height: e[t++] | e[t++] << 8, - pixel_size: e[t++], - flags: e[t++] - } - } - , - e.UploadContent = function(t, i) { - if (i.length < 19) - g.a.Error("Unable to load TGA file - Not enough data to contain header"); - else { - var n = 18 - , r = e.GetTGAHeader(i); - if (r.id_length + n > i.length) - g.a.Error("Unable to load TGA file - Not enough data"); - else { - n += r.id_length; - var o, a = false, s = false, c = false; - switch (r.image_type) { - case e._TYPE_RLE_INDEXED: - a = true; - case e._TYPE_INDEXED: - s = true; - break; - case e._TYPE_RLE_RGB: - a = true; - case e._TYPE_RGB: - break; - case e._TYPE_RLE_GREY: - a = true; - case e._TYPE_GREY: - c = true - } - var u, l, h, f, d, p, m, _ = r.pixel_size >> 3, v = r.width * r.height * _; - if (s && (u = i.subarray(n, n += r.colormap_length * (r.colormap_size >> 3))), - a) { - var y, b, E; - o = new Uint8Array(v); - for (var T = 0, A = new Uint8Array(_); n < v && T < v; ) - if (b = 1 + (127 & (y = i[n++])), - 128 & y) { - for (E = 0; E < _; ++E) - A[E] = i[n++]; - for (E = 0; E < b; ++E) - o.set(A, T + E * _); - T += _ * b - } else { - for (b *= _, - E = 0; E < b; ++E) - o[T + E] = i[n++]; - T += b - } + ); + })(mo); + s.a.RegisteredTypes["BABYLON.PBRMetallicRoughnessMaterial"] = go; + var _o = (function (e) { + function t(t, i) { + var n = e.call(this, t, i) || this; + return (n._useMicroSurfaceFromReflectivityMapAlpha = true), n; + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "PBRSpecularGlossinessMaterial"; + }), + (t.prototype.clone = function (e) { + var i = this, + n = F.a.Clone(function () { + return new t(e, i.getScene()); + }, this); + return ( + (n.id = e), + (n.name = e), + this.clearCoat.copyTo(n.clearCoat), + this.anisotropy.copyTo(n.anisotropy), + this.brdf.copyTo(n.brdf), + this.sheen.copyTo(n.sheen), + n + ); + }), + (t.prototype.serialize = function () { + var e = F.a.Serialize(this); + return ( + (e.customType = "BABYLON.PBRSpecularGlossinessMaterial"), + (e.clearCoat = this.clearCoat.serialize()), + (e.anisotropy = this.anisotropy.serialize()), + (e.brdf = this.brdf.serialize()), + (e.sheen = this.sheen.serialize()), + e + ); + }), + (t.Parse = function (e, i, n) { + var r = F.a.Parse( + function () { + return new t(e.name, i); + }, + e, + i, + n + ); + return ( + e.clearCoat && r.clearCoat.parse(e.clearCoat), + e.anisotropy && r.anisotropy.parse(e.anisotropy), + e.brdf && r.brdf.parse(e.brdf), + e.sheen && r.sheen.parse(e.brdf), + r + ); + }), + h.c( + [ + Object(F.e)("diffuse"), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_albedoColor" + ), + ], + t.prototype, + "diffuseColor", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_albedoTexture" + ), + ], + t.prototype, + "diffuseTexture", + void 0 + ), + h.c( + [ + Object(F.e)("specular"), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_reflectivityColor" + ), + ], + t.prototype, + "specularColor", + void 0 + ), + h.c( + [ + Object(F.c)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_microSurface" + ), + ], + t.prototype, + "glossiness", + void 0 + ), + h.c( + [ + Object(F.m)(), + Object(F.b)( + "_markAllSubMeshesAsTexturesDirty", + "_reflectivityTexture" + ), + ], + t.prototype, + "specularGlossinessTexture", + void 0 + ), + t + ); + })(mo); + s.a.RegisteredTypes["BABYLON.PBRSpecularGlossinessMaterial"] = _o; + var vo = n(76), + yo = (function (e) { + function t(t, i) { + var n = e.call(this, i) || this; + return t + ? ((n._engine = i.getEngine()), + (n._textureMatrix = a.j.Identity()), + (n.name = t), + (n.url = t), + (n.hasAlpha = false), + (n.isCube = false), + (n.is3D = n._engine.webGLVersion > 1), + (n.wrapU = _.a.TEXTURE_CLAMP_ADDRESSMODE), + (n.wrapV = _.a.TEXTURE_CLAMP_ADDRESSMODE), + (n.wrapR = _.a.TEXTURE_CLAMP_ADDRESSMODE), + (n.anisotropicFilteringLevel = 1), + (n._texture = n._getFromCache(t, true)), + n._texture || + (i.useDelayedTextureLoading + ? (n.delayLoadState = _.a.DELAYLOADSTATE_NOTLOADED) + : n.loadTexture()), + n) + : n; + } + return ( + h.d(t, e), + (t.prototype.getTextureMatrix = function () { + return this._textureMatrix; + }), + (t.prototype.load3dlTexture = function () { + var e, + i = this._engine; + (e = + 1 === i.webGLVersion + ? i.createRawTexture( + null, + 1, + 1, + _.a.TEXTUREFORMAT_RGBA, + false, + false, + _.a.TEXTURE_BILINEAR_SAMPLINGMODE + ) + : i.createRawTexture3D( + null, + 1, + 1, + 1, + _.a.TEXTUREFORMAT_RGBA, + false, + false, + _.a.TEXTURE_BILINEAR_SAMPLINGMODE + )), + (this._texture = e); + var n = function (n) { + if ("string" == typeof n) { + for ( + var r, + o = null, + a = null, + s = n.split("\n"), + c = 0, + u = 0, + l = 0, + h = 0, + f = 0, + d = 0; + d < s.length; + d++ + ) + if ( + ((r = s[d]), + t._noneEmptyLineRegex.test(r) && + 0 !== r.indexOf("#")) + ) { + var p = r.split(" "); + if (0 !== c) { + if (0 != c) { + var m = Math.max(parseInt(p[0]), 0), + g = Math.max(parseInt(p[1]), 0), + v = Math.max(parseInt(p[2]), 0); + (f = Math.max(m, f)), + (f = Math.max(g, f)), + (f = Math.max(v, f)); + var y = 4 * (u + h * c + l * c * c); + a && + ((a[y + 0] = m), + (a[y + 1] = g), + (a[y + 2] = v)), + ++l % c == 0 && + ((l = 0), + ++h % c == 0 && (u++, (h = 0))); + } } else - o = i.subarray(n, n += s ? r.width * r.height : v); - switch ((r.flags & e._ORIGIN_MASK) >> e._ORIGIN_SHIFT) { - default: - case e._ORIGIN_UL: - l = 0, - f = 1, - m = r.width, - h = 0, - d = 1, - p = r.height; - break; - case e._ORIGIN_BL: - l = 0, - f = 1, - m = r.width, - h = r.height - 1, - d = -1, - p = -1; - break; - case e._ORIGIN_UR: - l = r.width - 1, - f = -1, - m = -1, - h = 0, - d = 1, - p = r.height; - break; - case e._ORIGIN_BR: - l = r.width - 1, - f = -1, - m = -1, - h = r.height - 1, - d = -1, - p = -1 + (c = p.length), + (o = new Uint8Array(c * c * c * 4)), + (a = new Float32Array(c * c * c * 4)); + } + if (a && o) + for (d = 0; d < a.length; d++) + if (d > 0 && (d + 1) % 4 == 0) o[d] = 255; + else { + var b = a[d]; + o[d] = (b / f) * 255; } - var x = e["_getImageData" + (c ? "Grey" : "") + r.pixel_size + "bits"](r, u, o, h, d, p, l, f, m); - t.getEngine()._uploadDataToTextureDirectly(t, x) - } + e.is3D + ? (e.updateSize(c, c, c), + i.updateRawTexture3D( + e, + o, + _.a.TEXTUREFORMAT_RGBA, + false + )) + : (e.updateSize(c * c, c), + i.updateRawTexture( + e, + o, + _.a.TEXTUREFORMAT_RGBA, + false + )); + } + }, + r = this.getScene(); + return ( + r + ? r._loadFile(this.url, n) + : this._engine._loadFile(this.url, n), + this._texture + ); + }), + (t.prototype.loadTexture = function () { + this.url && + this.url.toLocaleLowerCase().indexOf(".3dl") == + this.url.length - 4 && + this.load3dlTexture(); + }), + (t.prototype.clone = function () { + var e = new t(this.url, this.getScene()); + return (e.level = this.level), e; + }), + (t.prototype.delayLoad = function () { + this.delayLoadState === _.a.DELAYLOADSTATE_NOTLOADED && + ((this.delayLoadState = _.a.DELAYLOADSTATE_LOADED), + (this._texture = this._getFromCache(this.url, true)), + this._texture || this.loadTexture()); + }), + (t.Parse = function (e, i) { + var n = null; + return ( + e.name && + !e.isRenderTarget && + (((n = new t(e.name, i)).name = e.name), + (n.level = e.level)), + n + ); + }), + (t.prototype.serialize = function () { + if (!this.name) return null; + var e = {}; + return ( + (e.name = this.name), + (e.level = this.level), + (e.customType = "BABYLON.ColorGradingTexture"), + e + ); + }), + (t._noneEmptyLineRegex = /\S+/), + t + ); + })(jn.a); + s.a.RegisteredTypes["BABYLON.ColorGradingTexture"] = yo; + var bo = (function (e) { + function t(t, i, n, r, o, a, s) { + void 0 === r && (r = false), + void 0 === o && (o = true), + void 0 === a && (a = null), + void 0 === s && (s = null); + var c = e.call(this, i) || this; + if ( + ((c._onLoad = null), + (c._onError = null), + (c.coordinatesMode = je.a.CUBIC_MODE), + !t) + ) + throw new Error("Image url is not set"); + return ( + (c.name = t), + (c.url = t), + (c._size = n), + (c._noMipmap = r), + (c.gammaSpace = o), + (c._onLoad = a), + (c._onError = s), + (c.hasAlpha = false), + (c.isCube = true), + (c._texture = c._getFromCache(t, c._noMipmap)), + c._texture + ? a && + (c._texture.isReady + ? Ee.h.SetImmediate(function () { + return a(); + }) + : c._texture.onLoadedObservable.add(a)) + : i.useDelayedTextureLoading + ? (c.delayLoadState = ve.b.DELAYLOADSTATE_NOTLOADED) + : c.loadImage(c.loadTexture.bind(c), c._onError), + c + ); + } + return ( + h.d(t, e), + (t.prototype.loadImage = function (e, t) { + var i = this, + n = document.createElement("canvas"), + r = new Image(); + r.addEventListener("load", function () { + (i._width = r.width), + (i._height = r.height), + (n.width = i._width), + (n.height = i._height); + var t = n.getContext("2d"); + t.drawImage(r, 0, 0); + var o = t.getImageData(0, 0, r.width, r.height); + (i._buffer = o.data.buffer), n.remove(), e(); + }), + r.addEventListener("error", function (e) { + t && t(i.getClassName() + " could not be loaded", e); + }), + (r.src = this.url); + }), + (t.prototype.loadTexture = function () { + var e = this, + i = this.getScene(); + i && + (this._texture = i + .getEngine() + .createRawCubeTextureFromUrl( + this.url, + i, + this._size, + ve.b.TEXTUREFORMAT_RGB, + i.getEngine().getCaps().textureFloat + ? ve.b.TEXTURETYPE_FLOAT + : ve.b.TEXTURETYPE_UNSIGNED_INTEGER, + this._noMipmap, + function () { + for ( + var i = e.getFloat32ArrayFromArrayBuffer( + e._buffer + ), + n = Xr.ConvertPanoramaToCubemap( + i, + e._width, + e._height, + e._size + ), + r = [], + o = 0; + o < 6; + o++ + ) { + var a = n[t._FacesMapping[o]]; + r.push(a); + } + return r; + }, + null, + this._onLoad, + this._onError + )); + }), + (t.prototype.getFloat32ArrayFromArrayBuffer = function (e) { + for ( + var t = new DataView(e), + i = new Float32Array((3 * e.byteLength) / 4), + n = 0, + r = 0; + r < e.byteLength; + r++ + ) + (r + 1) % 4 != 0 && (i[n++] = t.getUint8(r) / 255); + return i; + }), + (t.prototype.getClassName = function () { + return "EquiRectangularCubeTexture"; + }), + (t.prototype.clone = function () { + var e = this.getScene(); + if (!e) return this; + var i = new t( + this.url, + e, + this._size, + this._noMipmap, + this.gammaSpace + ); + return ( + (i.level = this.level), + (i.wrapU = this.wrapU), + (i.wrapV = this.wrapV), + (i.coordinatesIndex = this.coordinatesIndex), + (i.coordinatesMode = this.coordinatesMode), + i + ); + }), + (t._FacesMapping = [ + "right", + "left", + "up", + "down", + "front", + "back", + ]), + t + ); + })(jn.a), + Eo = (function () { + function e() {} + return ( + (e.GetTGAHeader = function (e) { + var t = 0; + return { + id_length: e[t++], + colormap_type: e[t++], + image_type: e[t++], + colormap_index: e[t++] | (e[t++] << 8), + colormap_length: e[t++] | (e[t++] << 8), + colormap_size: e[t++], + origin: [ + e[t++] | (e[t++] << 8), + e[t++] | (e[t++] << 8), + ], + width: e[t++] | (e[t++] << 8), + height: e[t++] | (e[t++] << 8), + pixel_size: e[t++], + flags: e[t++], + }; + }), + (e.UploadContent = function (t, i) { + if (i.length < 19) + g.a.Error( + "Unable to load TGA file - Not enough data to contain header" + ); + else { + var n = 18, + r = e.GetTGAHeader(i); + if (r.id_length + n > i.length) + g.a.Error( + "Unable to load TGA file - Not enough data" + ); + else { + n += r.id_length; + var o, + a = false, + s = false, + c = false; + switch (r.image_type) { + case e._TYPE_RLE_INDEXED: + a = true; + case e._TYPE_INDEXED: + s = true; + break; + case e._TYPE_RLE_RGB: + a = true; + case e._TYPE_RGB: + break; + case e._TYPE_RLE_GREY: + a = true; + case e._TYPE_GREY: + c = true; + } + var u, + l, + h, + f, + d, + p, + m, + _ = r.pixel_size >> 3, + v = r.width * r.height * _; + if ( + (s && + (u = i.subarray( + n, + (n += + r.colormap_length * (r.colormap_size >> 3)) + )), + a) + ) { + var y, b, E; + o = new Uint8Array(v); + for ( + var T = 0, A = new Uint8Array(_); + n < v && T < v; + + ) + if (((b = 1 + (127 & (y = i[n++]))), 128 & y)) { + for (E = 0; E < _; ++E) A[E] = i[n++]; + for (E = 0; E < b; ++E) o.set(A, T + E * _); + T += _ * b; + } else { + for (b *= _, E = 0; E < b; ++E) + o[T + E] = i[n++]; + T += b; + } + } else + o = i.subarray( + n, + (n += s ? r.width * r.height : v) + ); + switch ( + (r.flags & e._ORIGIN_MASK) >> + e._ORIGIN_SHIFT + ) { + default: + case e._ORIGIN_UL: + (l = 0), + (f = 1), + (m = r.width), + (h = 0), + (d = 1), + (p = r.height); + break; + case e._ORIGIN_BL: + (l = 0), + (f = 1), + (m = r.width), + (h = r.height - 1), + (d = -1), + (p = -1); + break; + case e._ORIGIN_UR: + (l = r.width - 1), + (f = -1), + (m = -1), + (h = 0), + (d = 1), + (p = r.height); + break; + case e._ORIGIN_BR: + (l = r.width - 1), + (f = -1), + (m = -1), + (h = r.height - 1), + (d = -1), + (p = -1); + } + var x = e[ + "_getImageData" + + (c ? "Grey" : "") + + r.pixel_size + + "bits" + ](r, u, o, h, d, p, l, f, m); + t.getEngine()._uploadDataToTextureDirectly(t, x); } - } - , - e._getImageData8bits = function(e, t, i, n, r, o, a, s, c) { - var u, l, h, f = i, d = t, p = e.width, m = e.height, g = 0, _ = new Uint8Array(p * m * 4); - for (h = n; h !== o; h += r) - for (l = a; l !== c; l += s, - g++) - u = f[g], - _[4 * (l + p * h) + 3] = 255, - _[4 * (l + p * h) + 2] = d[3 * u + 0], - _[4 * (l + p * h) + 1] = d[3 * u + 1], - _[4 * (l + p * h) + 0] = d[3 * u + 2]; - return _ - } - , - e._getImageData16bits = function(e, t, i, n, r, o, a, s, c) { - var u, l, h, f = i, d = e.width, p = e.height, m = 0, g = new Uint8Array(d * p * 4); - for (h = n; h !== o; h += r) - for (l = a; l !== c; l += s, - m += 2) { - var _ = 255 * ((31744 & (u = f[m + 0] + (f[m + 1] << 8))) >> 10) / 31 | 0 - , v = 255 * ((992 & u) >> 5) / 31 | 0 - , y = 255 * (31 & u) / 31 | 0; - g[4 * (l + d * h) + 0] = _, - g[4 * (l + d * h) + 1] = v, - g[4 * (l + d * h) + 2] = y, - g[4 * (l + d * h) + 3] = 32768 & u ? 0 : 255 - } - return g - } - , - e._getImageData24bits = function(e, t, i, n, r, o, a, s, c) { - var u, l, h = i, f = e.width, d = e.height, p = 0, m = new Uint8Array(f * d * 4); - for (l = n; l !== o; l += r) - for (u = a; u !== c; u += s, - p += 3) - m[4 * (u + f * l) + 3] = 255, - m[4 * (u + f * l) + 2] = h[p + 0], - m[4 * (u + f * l) + 1] = h[p + 1], - m[4 * (u + f * l) + 0] = h[p + 2]; - return m - } - , - e._getImageData32bits = function(e, t, i, n, r, o, a, s, c) { - var u, l, h = i, f = e.width, d = e.height, p = 0, m = new Uint8Array(f * d * 4); - for (l = n; l !== o; l += r) - for (u = a; u !== c; u += s, - p += 4) - m[4 * (u + f * l) + 2] = h[p + 0], - m[4 * (u + f * l) + 1] = h[p + 1], - m[4 * (u + f * l) + 0] = h[p + 2], - m[4 * (u + f * l) + 3] = h[p + 3]; - return m - } - , - e._getImageDataGrey8bits = function(e, t, i, n, r, o, a, s, c) { - var u, l, h, f = i, d = e.width, p = e.height, m = 0, g = new Uint8Array(d * p * 4); - for (h = n; h !== o; h += r) - for (l = a; l !== c; l += s, - m++) - u = f[m], - g[4 * (l + d * h) + 0] = u, - g[4 * (l + d * h) + 1] = u, - g[4 * (l + d * h) + 2] = u, - g[4 * (l + d * h) + 3] = 255; - return g - } - , - e._getImageDataGrey16bits = function(e, t, i, n, r, o, a, s, c) { - var u, l, h = i, f = e.width, d = e.height, p = 0, m = new Uint8Array(f * d * 4); - for (l = n; l !== o; l += r) - for (u = a; u !== c; u += s, - p += 2) - m[4 * (u + f * l) + 0] = h[p + 0], - m[4 * (u + f * l) + 1] = h[p + 0], - m[4 * (u + f * l) + 2] = h[p + 0], - m[4 * (u + f * l) + 3] = h[p + 1]; - return m - } - , - e._TYPE_INDEXED = 1, - e._TYPE_RGB = 2, - e._TYPE_GREY = 3, - e._TYPE_RLE_INDEXED = 9, - e._TYPE_RLE_RGB = 10, - e._TYPE_RLE_GREY = 11, - e._ORIGIN_MASK = 48, - e._ORIGIN_SHIFT = 4, - e._ORIGIN_BL = 0, - e._ORIGIN_BR = 1, - e._ORIGIN_UL = 2, - e._ORIGIN_UR = 3, + } + }), + (e._getImageData8bits = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u, + l, + h, + f = i, + d = t, + p = e.width, + m = e.height, + g = 0, + _ = new Uint8Array(p * m * 4); + for (h = n; h !== o; h += r) + for (l = a; l !== c; l += s, g++) + (u = f[g]), + (_[4 * (l + p * h) + 3] = 255), + (_[4 * (l + p * h) + 2] = d[3 * u + 0]), + (_[4 * (l + p * h) + 1] = d[3 * u + 1]), + (_[4 * (l + p * h) + 0] = d[3 * u + 2]); + return _; + }), + (e._getImageData16bits = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u, + l, + h, + f = i, + d = e.width, + p = e.height, + m = 0, + g = new Uint8Array(d * p * 4); + for (h = n; h !== o; h += r) + for (l = a; l !== c; l += s, m += 2) { + var _ = + ((255 * + ((31744 & (u = f[m + 0] + (f[m + 1] << 8))) >> + 10)) / + 31) | + 0, + v = ((255 * ((992 & u) >> 5)) / 31) | 0, + y = ((255 * (31 & u)) / 31) | 0; + (g[4 * (l + d * h) + 0] = _), + (g[4 * (l + d * h) + 1] = v), + (g[4 * (l + d * h) + 2] = y), + (g[4 * (l + d * h) + 3] = 32768 & u ? 0 : 255); + } + return g; + }), + (e._getImageData24bits = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u, + l, + h = i, + f = e.width, + d = e.height, + p = 0, + m = new Uint8Array(f * d * 4); + for (l = n; l !== o; l += r) + for (u = a; u !== c; u += s, p += 3) + (m[4 * (u + f * l) + 3] = 255), + (m[4 * (u + f * l) + 2] = h[p + 0]), + (m[4 * (u + f * l) + 1] = h[p + 1]), + (m[4 * (u + f * l) + 0] = h[p + 2]); + return m; + }), + (e._getImageData32bits = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u, + l, + h = i, + f = e.width, + d = e.height, + p = 0, + m = new Uint8Array(f * d * 4); + for (l = n; l !== o; l += r) + for (u = a; u !== c; u += s, p += 4) + (m[4 * (u + f * l) + 2] = h[p + 0]), + (m[4 * (u + f * l) + 1] = h[p + 1]), + (m[4 * (u + f * l) + 0] = h[p + 2]), + (m[4 * (u + f * l) + 3] = h[p + 3]); + return m; + }), + (e._getImageDataGrey8bits = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u, + l, + h, + f = i, + d = e.width, + p = e.height, + m = 0, + g = new Uint8Array(d * p * 4); + for (h = n; h !== o; h += r) + for (l = a; l !== c; l += s, m++) + (u = f[m]), + (g[4 * (l + d * h) + 0] = u), + (g[4 * (l + d * h) + 1] = u), + (g[4 * (l + d * h) + 2] = u), + (g[4 * (l + d * h) + 3] = 255); + return g; + }), + (e._getImageDataGrey16bits = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c + ) { + var u, + l, + h = i, + f = e.width, + d = e.height, + p = 0, + m = new Uint8Array(f * d * 4); + for (l = n; l !== o; l += r) + for (u = a; u !== c; u += s, p += 2) + (m[4 * (u + f * l) + 0] = h[p + 0]), + (m[4 * (u + f * l) + 1] = h[p + 0]), + (m[4 * (u + f * l) + 2] = h[p + 0]), + (m[4 * (u + f * l) + 3] = h[p + 1]); + return m; + }), + (e._TYPE_INDEXED = 1), + (e._TYPE_RGB = 2), + (e._TYPE_GREY = 3), + (e._TYPE_RLE_INDEXED = 9), + (e._TYPE_RLE_RGB = 10), + (e._TYPE_RLE_GREY = 11), + (e._ORIGIN_MASK = 48), + (e._ORIGIN_SHIFT = 4), + (e._ORIGIN_BL = 0), + (e._ORIGIN_BR = 1), + (e._ORIGIN_UL = 2), + (e._ORIGIN_UR = 3), e - }() - , To = function() { - function e() { - this.supportCascades = false - } - return e.prototype.canLoad = function(e, t, i, n, r) { - return 0 === e.indexOf(".tga") - } - , - e.prototype.transformUrl = function(e, t) { - return e - } - , - e.prototype.getFallbackTextureUrl = function(e, t) { - return null - } - , - e.prototype.loadCubeData = function(e, t, i, n, r) { - throw ".env not supported in Cube." - } - , - e.prototype.loadData = function(e, t, i) { - var n = new Uint8Array(e) - , r = Eo.GetTGAHeader(n); - i(r.width, r.height, t.generateMipMaps, false, function() { - Eo.UploadContent(t, n) - }) - } - , + ); + })(), + To = (function () { + function e() { + this.supportCascades = false; + } + return ( + (e.prototype.canLoad = function (e, t, i, n, r) { + return 0 === e.indexOf(".tga"); + }), + (e.prototype.transformUrl = function (e, t) { + return e; + }), + (e.prototype.getFallbackTextureUrl = function (e, t) { + return null; + }), + (e.prototype.loadCubeData = function (e, t, i, n, r) { + throw ".env not supported in Cube."; + }), + (e.prototype.loadData = function (e, t, i) { + var n = new Uint8Array(e), + r = Eo.GetTGAHeader(n); + i( + r.width, + r.height, + t.generateMipMaps, + false, + function () { + Eo.UploadContent(t, n); + } + ); + }), e - }(); - ve.b._TextureLoaders.push(new To), - ve.b.prototype.unBindMultiColorAttachmentFramebuffer = function(e, t, i) { + ); + })(); + ve.b._TextureLoaders.push(new To()), + (ve.b.prototype.unBindMultiColorAttachmentFramebuffer = + function (e, t, i) { void 0 === t && (t = false), - this._currentRenderTarget = null; + (this._currentRenderTarget = null); var n = this._gl; if (e[0]._MSAAFramebuffer) { - n.bindFramebuffer(n.READ_FRAMEBUFFER, e[0]._MSAAFramebuffer), - n.bindFramebuffer(n.DRAW_FRAMEBUFFER, e[0]._framebuffer); - var r = e[0]._attachments; - r || (r = new Array(e.length), - e[0]._attachments = r); - for (var o = 0; o < e.length; o++) { - for (var a = e[o], s = 0; s < r.length; s++) - r[s] = n.NONE; - r[o] = n[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + o : "COLOR_ATTACHMENT" + o + "_WEBGL"], - n.readBuffer(r[o]), - n.drawBuffers(r), - n.blitFramebuffer(0, 0, a.width, a.height, 0, 0, a.width, a.height, n.COLOR_BUFFER_BIT, n.NEAREST) - } - for (o = 0; o < r.length; o++) - r[o] = n[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + o : "COLOR_ATTACHMENT" + o + "_WEBGL"]; - n.drawBuffers(r) + n.bindFramebuffer( + n.READ_FRAMEBUFFER, + e[0]._MSAAFramebuffer + ), + n.bindFramebuffer( + n.DRAW_FRAMEBUFFER, + e[0]._framebuffer + ); + var r = e[0]._attachments; + r || ((r = new Array(e.length)), (e[0]._attachments = r)); + for (var o = 0; o < e.length; o++) { + for (var a = e[o], s = 0; s < r.length; s++) + r[s] = n.NONE; + (r[o] = + n[ + this.webGLVersion > 1 + ? "COLOR_ATTACHMENT" + o + : "COLOR_ATTACHMENT" + o + "_WEBGL" + ]), + n.readBuffer(r[o]), + n.drawBuffers(r), + n.blitFramebuffer( + 0, + 0, + a.width, + a.height, + 0, + 0, + a.width, + a.height, + n.COLOR_BUFFER_BIT, + n.NEAREST + ); + } + for (o = 0; o < r.length; o++) + r[o] = + n[ + this.webGLVersion > 1 + ? "COLOR_ATTACHMENT" + o + : "COLOR_ATTACHMENT" + o + "_WEBGL" + ]; + n.drawBuffers(r); } for (o = 0; o < e.length; o++) - !(a = e[o]).generateMipMaps || t || a.isCube || (this._bindTextureDirectly(n.TEXTURE_2D, a), + !(a = e[o]).generateMipMaps || + t || + a.isCube || + (this._bindTextureDirectly(n.TEXTURE_2D, a), n.generateMipmap(n.TEXTURE_2D), this._bindTextureDirectly(n.TEXTURE_2D, null)); - i && (e[0]._MSAAFramebuffer && this._bindUnboundFramebuffer(e[0]._framebuffer), - i()), - this._bindUnboundFramebuffer(null) - } - , - ve.b.prototype.createMultipleRenderTarget = function(e, t) { - var i = false - , n = true - , r = false - , o = false - , a = 1 - , s = ve.b.TEXTURETYPE_UNSIGNED_INT - , c = ve.b.TEXTURE_TRILINEAR_SAMPLINGMODE - , u = new Array - , l = new Array; - void 0 !== t && (i = void 0 !== t.generateMipMaps && t.generateMipMaps, - n = void 0 === t.generateDepthBuffer || t.generateDepthBuffer, - r = void 0 !== t.generateStencilBuffer && t.generateStencilBuffer, - o = void 0 !== t.generateDepthTexture && t.generateDepthTexture, - a = t.textureCount || 1, + i && + (e[0]._MSAAFramebuffer && + this._bindUnboundFramebuffer(e[0]._framebuffer), + i()), + this._bindUnboundFramebuffer(null); + }), + (ve.b.prototype.createMultipleRenderTarget = function (e, t) { + var i = false, + n = true, + r = false, + o = false, + a = 1, + s = ve.b.TEXTURETYPE_UNSIGNED_INT, + c = ve.b.TEXTURE_TRILINEAR_SAMPLINGMODE, + u = new Array(), + l = new Array(); + void 0 !== t && + ((i = void 0 !== t.generateMipMaps && t.generateMipMaps), + (n = + void 0 === t.generateDepthBuffer || + t.generateDepthBuffer), + (r = + void 0 !== t.generateStencilBuffer && + t.generateStencilBuffer), + (o = + void 0 !== t.generateDepthTexture && + t.generateDepthTexture), + (a = t.textureCount || 1), t.types && (u = t.types), t.samplingModes && (l = t.samplingModes)); - var h = this._gl - , f = h.createFramebuffer(); - this._bindUnboundFramebuffer(f); - for (var d = e.width || e, p = e.height || e, m = [], _ = [], v = this._setupFramebufferDepthAttachments(r, n, d, p), y = 0; y < a; y++) { - var b = l[y] || c - , E = u[y] || s; - (E !== ve.b.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (E !== ve.b.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (b = ve.b.TEXTURE_NEAREST_SAMPLINGMODE); - var T = this._getSamplingParameters(b, i); - E !== ve.b.TEXTURETYPE_FLOAT || this._caps.textureFloat || (E = ve.b.TEXTURETYPE_UNSIGNED_INT, - g.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")); - var A = new He.a(this,He.a.DATASOURCE_MULTIRENDERTARGET) - , x = h[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + y : "COLOR_ATTACHMENT" + y + "_WEBGL"]; - m.push(A), - _.push(x), - h.activeTexture(h["TEXTURE" + y]), - h.bindTexture(h.TEXTURE_2D, A._webGLTexture), - h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MAG_FILTER, T.mag), - h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MIN_FILTER, T.min), - h.texParameteri(h.TEXTURE_2D, h.TEXTURE_WRAP_S, h.CLAMP_TO_EDGE), - h.texParameteri(h.TEXTURE_2D, h.TEXTURE_WRAP_T, h.CLAMP_TO_EDGE), - h.texImage2D(h.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(E), d, p, 0, h.RGBA, this._getWebGLTextureType(E), null), - h.framebufferTexture2D(h.DRAW_FRAMEBUFFER, x, h.TEXTURE_2D, A._webGLTexture, 0), - i && this._gl.generateMipmap(this._gl.TEXTURE_2D), - this._bindTextureDirectly(h.TEXTURE_2D, null), - A._framebuffer = f, - A._depthStencilBuffer = v, - A.baseWidth = d, - A.baseHeight = p, - A.width = d, - A.height = p, - A.isReady = true, - A.samples = 1, - A.generateMipMaps = i, - A.samplingMode = b, - A.type = E, - A._generateDepthBuffer = n, - A._generateStencilBuffer = r, - A._attachments = _, - this._internalTexturesCache.push(A) - } - if (o && this._caps.depthTextureExtension) { - var S = new He.a(this,He.a.DATASOURCE_MULTIRENDERTARGET); - h.activeTexture(h.TEXTURE0), - h.bindTexture(h.TEXTURE_2D, S._webGLTexture), - h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MAG_FILTER, h.NEAREST), - h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MIN_FILTER, h.NEAREST), - h.texParameteri(h.TEXTURE_2D, h.TEXTURE_WRAP_S, h.CLAMP_TO_EDGE), - h.texParameteri(h.TEXTURE_2D, h.TEXTURE_WRAP_T, h.CLAMP_TO_EDGE), - h.texImage2D(h.TEXTURE_2D, 0, this.webGLVersion < 2 ? h.DEPTH_COMPONENT : h.DEPTH_COMPONENT16, d, p, 0, h.DEPTH_COMPONENT, h.UNSIGNED_SHORT, null), - h.framebufferTexture2D(h.FRAMEBUFFER, h.DEPTH_ATTACHMENT, h.TEXTURE_2D, S._webGLTexture, 0), - S._framebuffer = f, - S.baseWidth = d, - S.baseHeight = p, - S.width = d, - S.height = p, - S.isReady = true, - S.samples = 1, - S.generateMipMaps = i, - S.samplingMode = h.NEAREST, - S._generateDepthBuffer = n, - S._generateStencilBuffer = r, - m.push(S), - this._internalTexturesCache.push(S) - } - return h.drawBuffers(_), + var h = this._gl, + f = h.createFramebuffer(); + this._bindUnboundFramebuffer(f); + for ( + var d = e.width || e, + p = e.height || e, + m = [], + _ = [], + v = this._setupFramebufferDepthAttachments(r, n, d, p), + y = 0; + y < a; + y++ + ) { + var b = l[y] || c, + E = u[y] || s; + ((E !== ve.b.TEXTURETYPE_FLOAT || + this._caps.textureFloatLinearFiltering) && + (E !== ve.b.TEXTURETYPE_HALF_FLOAT || + this._caps.textureHalfFloatLinearFiltering)) || + (b = ve.b.TEXTURE_NEAREST_SAMPLINGMODE); + var T = this._getSamplingParameters(b, i); + E !== ve.b.TEXTURETYPE_FLOAT || + this._caps.textureFloat || + ((E = ve.b.TEXTURETYPE_UNSIGNED_INT), + g.a.Warn( + "Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type" + )); + var A = new He.a(this, He.a.DATASOURCE_MULTIRENDERTARGET), + x = + h[ + this.webGLVersion > 1 + ? "COLOR_ATTACHMENT" + y + : "COLOR_ATTACHMENT" + y + "_WEBGL" + ]; + m.push(A), + _.push(x), + h.activeTexture(h["TEXTURE" + y]), + h.bindTexture(h.TEXTURE_2D, A._webGLTexture), + h.texParameteri( + h.TEXTURE_2D, + h.TEXTURE_MAG_FILTER, + T.mag + ), + h.texParameteri( + h.TEXTURE_2D, + h.TEXTURE_MIN_FILTER, + T.min + ), + h.texParameteri( + h.TEXTURE_2D, + h.TEXTURE_WRAP_S, + h.CLAMP_TO_EDGE + ), + h.texParameteri( + h.TEXTURE_2D, + h.TEXTURE_WRAP_T, + h.CLAMP_TO_EDGE + ), + h.texImage2D( + h.TEXTURE_2D, + 0, + this._getRGBABufferInternalSizedFormat(E), + d, + p, + 0, + h.RGBA, + this._getWebGLTextureType(E), + null + ), + h.framebufferTexture2D( + h.DRAW_FRAMEBUFFER, + x, + h.TEXTURE_2D, + A._webGLTexture, + 0 + ), + i && this._gl.generateMipmap(this._gl.TEXTURE_2D), + this._bindTextureDirectly(h.TEXTURE_2D, null), + (A._framebuffer = f), + (A._depthStencilBuffer = v), + (A.baseWidth = d), + (A.baseHeight = p), + (A.width = d), + (A.height = p), + (A.isReady = true), + (A.samples = 1), + (A.generateMipMaps = i), + (A.samplingMode = b), + (A.type = E), + (A._generateDepthBuffer = n), + (A._generateStencilBuffer = r), + (A._attachments = _), + this._internalTexturesCache.push(A); + } + if (o && this._caps.depthTextureExtension) { + var S = new He.a(this, He.a.DATASOURCE_MULTIRENDERTARGET); + h.activeTexture(h.TEXTURE0), + h.bindTexture(h.TEXTURE_2D, S._webGLTexture), + h.texParameteri( + h.TEXTURE_2D, + h.TEXTURE_MAG_FILTER, + h.NEAREST + ), + h.texParameteri( + h.TEXTURE_2D, + h.TEXTURE_MIN_FILTER, + h.NEAREST + ), + h.texParameteri( + h.TEXTURE_2D, + h.TEXTURE_WRAP_S, + h.CLAMP_TO_EDGE + ), + h.texParameteri( + h.TEXTURE_2D, + h.TEXTURE_WRAP_T, + h.CLAMP_TO_EDGE + ), + h.texImage2D( + h.TEXTURE_2D, + 0, + this.webGLVersion < 2 + ? h.DEPTH_COMPONENT + : h.DEPTH_COMPONENT16, + d, + p, + 0, + h.DEPTH_COMPONENT, + h.UNSIGNED_SHORT, + null + ), + h.framebufferTexture2D( + h.FRAMEBUFFER, + h.DEPTH_ATTACHMENT, + h.TEXTURE_2D, + S._webGLTexture, + 0 + ), + (S._framebuffer = f), + (S.baseWidth = d), + (S.baseHeight = p), + (S.width = d), + (S.height = p), + (S.isReady = true), + (S.samples = 1), + (S.generateMipMaps = i), + (S.samplingMode = h.NEAREST), + (S._generateDepthBuffer = n), + (S._generateStencilBuffer = r), + m.push(S), + this._internalTexturesCache.push(S); + } + return ( + h.drawBuffers(_), h.bindRenderbuffer(h.RENDERBUFFER, null), this._bindUnboundFramebuffer(null), this.resetTextureCache(), m - } - , - ve.b.prototype.updateMultipleRenderTargetTextureSampleCount = function(e, t) { - if (this.webGLVersion < 2 || !e || 0 == e.length) - return 1; - if (e[0].samples === t) - return t; + ); + }), + (ve.b.prototype.updateMultipleRenderTargetTextureSampleCount = + function (e, t) { + if (this.webGLVersion < 2 || !e || 0 == e.length) return 1; + if (e[0].samples === t) return t; var i = this._gl; - t = Math.min(t, i.getParameter(i.MAX_SAMPLES)), - e[0]._depthStencilBuffer && (i.deleteRenderbuffer(e[0]._depthStencilBuffer), - e[0]._depthStencilBuffer = null), - e[0]._MSAAFramebuffer && (i.deleteFramebuffer(e[0]._MSAAFramebuffer), - e[0]._MSAAFramebuffer = null); + (t = Math.min(t, i.getParameter(i.MAX_SAMPLES))), + e[0]._depthStencilBuffer && + (i.deleteRenderbuffer(e[0]._depthStencilBuffer), + (e[0]._depthStencilBuffer = null)), + e[0]._MSAAFramebuffer && + (i.deleteFramebuffer(e[0]._MSAAFramebuffer), + (e[0]._MSAAFramebuffer = null)); for (var n = 0; n < e.length; n++) - e[n]._MSAARenderBuffer && (i.deleteRenderbuffer(e[n]._MSAARenderBuffer), - e[n]._MSAARenderBuffer = null); + e[n]._MSAARenderBuffer && + (i.deleteRenderbuffer(e[n]._MSAARenderBuffer), + (e[n]._MSAARenderBuffer = null)); if (t > 1) { - var r = i.createFramebuffer(); - if (!r) - throw new Error("Unable to create multi sampled framebuffer"); - this._bindUnboundFramebuffer(r); - var o = this._setupFramebufferDepthAttachments(e[0]._generateStencilBuffer, e[0]._generateDepthBuffer, e[0].width, e[0].height, t) - , a = []; - for (n = 0; n < e.length; n++) { - var s = e[n] - , c = i[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + n : "COLOR_ATTACHMENT" + n + "_WEBGL"] - , u = i.createRenderbuffer(); - if (!u) - throw new Error("Unable to create multi sampled framebuffer"); - i.bindRenderbuffer(i.RENDERBUFFER, u), - i.renderbufferStorageMultisample(i.RENDERBUFFER, t, this._getRGBAMultiSampleBufferFormat(s.type), s.width, s.height), - i.framebufferRenderbuffer(i.FRAMEBUFFER, c, i.RENDERBUFFER, u), - s._MSAAFramebuffer = r, - s._MSAARenderBuffer = u, - s.samples = t, - s._depthStencilBuffer = o, - i.bindRenderbuffer(i.RENDERBUFFER, null), - a.push(c) - } - i.drawBuffers(a) - } else - this._bindUnboundFramebuffer(e[0]._framebuffer); - return this._bindUnboundFramebuffer(null), - t - } - ; - var Ao = function(e) { - function t(t, i, n, r, o) { - var a = this - , s = !(!o || !o.generateMipMaps) && o.generateMipMaps - , c = !(!o || !o.generateDepthTexture) && o.generateDepthTexture - , u = !o || void 0 === o.doNotChangeAspectRatio || o.doNotChangeAspectRatio; - if ((a = e.call(this, t, i, r, s, u) || this)._engine = r.getEngine(), - a.isSupported) { - for (var l = [], h = [], f = 0; f < n; f++) - o && o.types && void 0 !== o.types[f] ? l.push(o.types[f]) : l.push(o && o.defaultType ? o.defaultType : _.a.TEXTURETYPE_UNSIGNED_INT), - o && o.samplingModes && void 0 !== o.samplingModes[f] ? h.push(o.samplingModes[f]) : h.push(je.a.BILINEAR_SAMPLINGMODE); - var d = !o || void 0 === o.generateDepthBuffer || o.generateDepthBuffer - , p = !(!o || void 0 === o.generateStencilBuffer) && o.generateStencilBuffer; - return a._size = i, - a._multiRenderTargetOptions = { - samplingModes: h, - generateMipMaps: s, - generateDepthBuffer: d, - generateStencilBuffer: p, - generateDepthTexture: c, - types: l, - textureCount: n - }, - a._createInternalTextures(), - a._createTextures(), - a - } - a.dispose() + var r = i.createFramebuffer(); + if (!r) + throw new Error( + "Unable to create multi sampled framebuffer" + ); + this._bindUnboundFramebuffer(r); + var o = this._setupFramebufferDepthAttachments( + e[0]._generateStencilBuffer, + e[0]._generateDepthBuffer, + e[0].width, + e[0].height, + t + ), + a = []; + for (n = 0; n < e.length; n++) { + var s = e[n], + c = + i[ + this.webGLVersion > 1 + ? "COLOR_ATTACHMENT" + n + : "COLOR_ATTACHMENT" + n + "_WEBGL" + ], + u = i.createRenderbuffer(); + if (!u) + throw new Error( + "Unable to create multi sampled framebuffer" + ); + i.bindRenderbuffer(i.RENDERBUFFER, u), + i.renderbufferStorageMultisample( + i.RENDERBUFFER, + t, + this._getRGBAMultiSampleBufferFormat(s.type), + s.width, + s.height + ), + i.framebufferRenderbuffer( + i.FRAMEBUFFER, + c, + i.RENDERBUFFER, + u + ), + (s._MSAAFramebuffer = r), + (s._MSAARenderBuffer = u), + (s.samples = t), + (s._depthStencilBuffer = o), + i.bindRenderbuffer(i.RENDERBUFFER, null), + a.push(c); + } + i.drawBuffers(a); + } else this._bindUnboundFramebuffer(e[0]._framebuffer); + return this._bindUnboundFramebuffer(null), t; + }); + var Ao = (function (e) { + function t(t, i, n, r, o) { + var a = this, + s = !(!o || !o.generateMipMaps) && o.generateMipMaps, + c = + !(!o || !o.generateDepthTexture) && + o.generateDepthTexture, + u = + !o || + void 0 === o.doNotChangeAspectRatio || + o.doNotChangeAspectRatio; + if ( + (((a = e.call(this, t, i, r, s, u) || this)._engine = + r.getEngine()), + a.isSupported) + ) { + for (var l = [], h = [], f = 0; f < n; f++) + o && o.types && void 0 !== o.types[f] + ? l.push(o.types[f]) + : l.push( + o && o.defaultType + ? o.defaultType + : _.a.TEXTURETYPE_UNSIGNED_INT + ), + o && o.samplingModes && void 0 !== o.samplingModes[f] + ? h.push(o.samplingModes[f]) + : h.push(je.a.BILINEAR_SAMPLINGMODE); + var d = + !o || + void 0 === o.generateDepthBuffer || + o.generateDepthBuffer, + p = + !(!o || void 0 === o.generateStencilBuffer) && + o.generateStencilBuffer; + return ( + (a._size = i), + (a._multiRenderTargetOptions = { + samplingModes: h, + generateMipMaps: s, + generateDepthBuffer: d, + generateStencilBuffer: p, + generateDepthTexture: c, + types: l, + textureCount: n, + }), + a._createInternalTextures(), + a._createTextures(), + a + ); } - return h.d(t, e), + a.dispose(); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "isSupported", { - get: function() { - return this._engine.webGLVersion > 1 || this._engine.getCaps().drawBuffersExtension - }, - enumerable: true, - configurable: true + get: function () { + return ( + this._engine.webGLVersion > 1 || + this._engine.getCaps().drawBuffersExtension + ); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "textures", { - get: function() { - return this._textures - }, - enumerable: true, - configurable: true + get: function () { + return this._textures; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "depthTexture", { - get: function() { - return this._textures[this._textures.length - 1] - }, - enumerable: true, - configurable: true + get: function () { + return this._textures[this._textures.length - 1]; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "wrapU", { - set: function(e) { - if (this._textures) - for (var t = 0; t < this._textures.length; t++) - this._textures[t].wrapU = e - }, - enumerable: true, - configurable: true + set: function (e) { + if (this._textures) + for (var t = 0; t < this._textures.length; t++) + this._textures[t].wrapU = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "wrapV", { - set: function(e) { - if (this._textures) - for (var t = 0; t < this._textures.length; t++) - this._textures[t].wrapV = e - }, - enumerable: true, - configurable: true + set: function (e) { + if (this._textures) + for (var t = 0; t < this._textures.length; t++) + this._textures[t].wrapV = e; + }, + enumerable: true, + configurable: true, }), - t.prototype._rebuild = function() { - this.releaseInternalTextures(), + (t.prototype._rebuild = function () { + this.releaseInternalTextures(), this._createInternalTextures(); - for (var e = 0; e < this._internalTextures.length; e++) - this._textures[e]._texture = this._internalTextures[e]; - this._texture = this._internalTextures[0] - } - , - t.prototype._createInternalTextures = function() { - this._internalTextures = this._engine.createMultipleRenderTarget(this._size, this._multiRenderTargetOptions) - } - , - t.prototype._createTextures = function() { - this._textures = []; - for (var e = 0; e < this._internalTextures.length; e++) { - var t = new je.a(null,this.getScene()); - t._texture = this._internalTextures[e], - this._textures.push(t) - } - this._texture = this._internalTextures[0] - } - , - Object.defineProperty(t.prototype, "samples", { - get: function() { - return this._samples - }, - set: function(e) { - this._samples !== e && (this._samples = this._engine.updateMultipleRenderTargetTextureSampleCount(this._internalTextures, e)) - }, - enumerable: true, - configurable: true + for (var e = 0; e < this._internalTextures.length; e++) + this._textures[e]._texture = this._internalTextures[e]; + this._texture = this._internalTextures[0]; }), - t.prototype.resize = function(e) { - this.releaseInternalTextures(), - this._internalTextures = this._engine.createMultipleRenderTarget(e, this._multiRenderTargetOptions), - this._createInternalTextures() - } - , - t.prototype.unbindFrameBuffer = function(e, t) { - var i = this; - e.unBindMultiColorAttachmentFramebuffer(this._internalTextures, this.isCube, function() { - i.onAfterRenderObservable.notifyObservers(t) - }) - } - , - t.prototype.dispose = function() { - this.releaseInternalTextures(), - e.prototype.dispose.call(this) - } - , - t.prototype.releaseInternalTextures = function() { - if (this._internalTextures) - for (var e = this._internalTextures.length - 1; e >= 0; e--) - void 0 !== this._internalTextures[e] && (this._internalTextures[e].dispose(), - this._internalTextures.splice(e, 1)) - } - , - t - }(li) - , xo = function() { - function e(e) { - this.name = Se.a.NAME_PROCEDURALTEXTURE, - this.scene = e, - this.scene.proceduralTextures = new Array, - e.layers = new Array - } - return e.prototype.register = function() { - this.scene._beforeClearStage.registerStep(Se.a.STEP_BEFORECLEAR_PROCEDURALTEXTURE, this, this._beforeClear) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() {} - , - e.prototype._beforeClear = function() { - if (this.scene.proceduralTexturesEnabled) { - Ee.h.StartPerformanceCounter("Procedural textures", this.scene.proceduralTextures.length > 0); - for (var e = 0; e < this.scene.proceduralTextures.length; e++) { - var t = this.scene.proceduralTextures[e]; - t._shouldRender() && t.render() - } - Ee.h.EndPerformanceCounter("Procedural textures", this.scene.proceduralTextures.length > 0) + (t.prototype._createInternalTextures = function () { + this._internalTextures = + this._engine.createMultipleRenderTarget( + this._size, + this._multiRenderTargetOptions + ); + }), + (t.prototype._createTextures = function () { + this._textures = []; + for (var e = 0; e < this._internalTextures.length; e++) { + var t = new je.a(null, this.getScene()); + (t._texture = this._internalTextures[e]), + this._textures.push(t); + } + this._texture = this._internalTextures[0]; + }), + Object.defineProperty(t.prototype, "samples", { + get: function () { + return this._samples; + }, + set: function (e) { + this._samples !== e && + (this._samples = + this._engine.updateMultipleRenderTargetTextureSampleCount( + this._internalTextures, + e + )); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.resize = function (e) { + this.releaseInternalTextures(), + (this._internalTextures = + this._engine.createMultipleRenderTarget( + e, + this._multiRenderTargetOptions + )), + this._createInternalTextures(); + }), + (t.prototype.unbindFrameBuffer = function (e, t) { + var i = this; + e.unBindMultiColorAttachmentFramebuffer( + this._internalTextures, + this.isCube, + function () { + i.onAfterRenderObservable.notifyObservers(t); } - } - , + ); + }), + (t.prototype.dispose = function () { + this.releaseInternalTextures(), + e.prototype.dispose.call(this); + }), + (t.prototype.releaseInternalTextures = function () { + if (this._internalTextures) + for ( + var e = this._internalTextures.length - 1; + e >= 0; + e-- + ) + void 0 !== this._internalTextures[e] && + (this._internalTextures[e].dispose(), + this._internalTextures.splice(e, 1)); + }), + t + ); + })(li), + xo = (function () { + function e(e) { + (this.name = Se.a.NAME_PROCEDURALTEXTURE), + (this.scene = e), + (this.scene.proceduralTextures = new Array()), + (e.layers = new Array()); + } + return ( + (e.prototype.register = function () { + this.scene._beforeClearStage.registerStep( + Se.a.STEP_BEFORECLEAR_PROCEDURALTEXTURE, + this, + this._beforeClear + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () {}), + (e.prototype._beforeClear = function () { + if (this.scene.proceduralTexturesEnabled) { + Ee.h.StartPerformanceCounter( + "Procedural textures", + this.scene.proceduralTextures.length > 0 + ); + for ( + var e = 0; + e < this.scene.proceduralTextures.length; + e++ + ) { + var t = this.scene.proceduralTextures[e]; + t._shouldRender() && t.render(); + } + Ee.h.EndPerformanceCounter( + "Procedural textures", + this.scene.proceduralTextures.length > 0 + ); + } + }), e - }(); - Ht.a.ShadersStore.proceduralVertexShader = "\nattribute vec2 position;\n\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}"; - var So = function(e) { - function t(t, i, n, r, a, s, c) { - void 0 === a && (a = null), - void 0 === s && (s = true), - void 0 === c && (c = false); - var u = e.call(this, null, r, !s) || this; - u.isCube = c, - u.isEnabled = true, - u.autoClear = true, - u.onGeneratedObservable = new o.c, - u._textures = {}, - u._currentRefreshId = -1, - u._refreshRate = 1, - u._vertexBuffers = {}, - u._uniforms = new Array, - u._samplers = new Array, - u._floats = {}, - u._ints = {}, - u._floatsArrays = {}, - u._colors3 = {}, - u._colors4 = {}, - u._vectors2 = {}, - u._vectors3 = {}, - u._matrices = {}, - u._fallbackTextureUsed = false, - u._cachedDefines = "", - u._contentUpdateId = -1; - var l = (r = u.getScene())._getComponent(Se.a.NAME_PROCEDURALTEXTURE); - l || (l = new xo(r), - r._addComponent(l)), - r.proceduralTextures.push(u), - u._engine = r.getEngine(), - u.name = t, - u.isRenderTarget = true, - u._size = i, - u._generateMipMaps = s, - u.setFragment(n), - u._fallbackTexture = a, - c ? (u._texture = u._engine.createRenderTargetCubeTexture(i, { + ); + })(); + Ht.a.ShadersStore.proceduralVertexShader = + "\nattribute vec2 position;\n\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}"; + var So = (function (e) { + function t(t, i, n, r, a, s, c) { + void 0 === a && (a = null), + void 0 === s && (s = true), + void 0 === c && (c = false); + var u = e.call(this, null, r, !s) || this; + (u.isCube = c), + (u.isEnabled = true), + (u.autoClear = true), + (u.onGeneratedObservable = new o.c()), + (u._textures = {}), + (u._currentRefreshId = -1), + (u._refreshRate = 1), + (u._vertexBuffers = {}), + (u._uniforms = new Array()), + (u._samplers = new Array()), + (u._floats = {}), + (u._ints = {}), + (u._floatsArrays = {}), + (u._colors3 = {}), + (u._colors4 = {}), + (u._vectors2 = {}), + (u._vectors3 = {}), + (u._matrices = {}), + (u._fallbackTextureUsed = false), + (u._cachedDefines = ""), + (u._contentUpdateId = -1); + var l = (r = u.getScene())._getComponent( + Se.a.NAME_PROCEDURALTEXTURE + ); + l || ((l = new xo(r)), r._addComponent(l)), + r.proceduralTextures.push(u), + (u._engine = r.getEngine()), + (u.name = t), + (u.isRenderTarget = true), + (u._size = i), + (u._generateMipMaps = s), + u.setFragment(n), + (u._fallbackTexture = a), + c + ? ((u._texture = + u._engine.createRenderTargetCubeTexture(i, { + generateMipMaps: s, + generateDepthBuffer: false, + generateStencilBuffer: false, + })), + u.setFloat("face", 0)) + : (u._texture = u._engine.createRenderTargetTexture(i, { generateMipMaps: s, generateDepthBuffer: false, - generateStencilBuffer: false - }), - u.setFloat("face", 0)) : u._texture = u._engine.createRenderTargetTexture(i, { - generateMipMaps: s, - generateDepthBuffer: false, - generateStencilBuffer: false - }); - var h = []; - return h.push(1, 1), - h.push(-1, 1), - h.push(-1, -1), - h.push(1, -1), - u._vertexBuffers[Si.b.PositionKind] = new Si.b(u._engine,h,Si.b.PositionKind,false,false,2), - u._createIndexBuffer(), - u - } - return h.d(t, e), - t.prototype.getEffect = function() { - return this._effect - } - , - t.prototype.getContent = function() { - return this._contentData && this._currentRefreshId == this._contentUpdateId ? this._contentData : (this._contentData = this.readPixels(0, 0, this._contentData), - this._contentUpdateId = this._currentRefreshId, - this._contentData) - } - , - t.prototype._createIndexBuffer = function() { - var e = this._engine - , t = []; - t.push(0), + generateStencilBuffer: false, + })); + var h = []; + return ( + h.push(1, 1), + h.push(-1, 1), + h.push(-1, -1), + h.push(1, -1), + (u._vertexBuffers[Si.b.PositionKind] = new Si.b( + u._engine, + h, + Si.b.PositionKind, + false, + false, + 2 + )), + u._createIndexBuffer(), + u + ); + } + return ( + h.d(t, e), + (t.prototype.getEffect = function () { + return this._effect; + }), + (t.prototype.getContent = function () { + return this._contentData && + this._currentRefreshId == this._contentUpdateId + ? this._contentData + : ((this._contentData = this.readPixels( + 0, + 0, + this._contentData + )), + (this._contentUpdateId = this._currentRefreshId), + this._contentData); + }), + (t.prototype._createIndexBuffer = function () { + var e = this._engine, + t = []; + t.push(0), t.push(1), t.push(2), t.push(0), t.push(2), t.push(3), - this._indexBuffer = e.createIndexBuffer(t) - } - , - t.prototype._rebuild = function() { - var e = this._vertexBuffers[Si.b.PositionKind]; - e && e._rebuild(), - this._createIndexBuffer(), - this.refreshRate === li.REFRESHRATE_RENDER_ONCE && (this.refreshRate = li.REFRESHRATE_RENDER_ONCE) - } - , - t.prototype.reset = function() { - void 0 !== this._effect && this._effect.dispose() - } - , - t.prototype._getDefines = function() { - return "" - } - , - t.prototype.isReady = function() { - var e, t = this, i = this._engine; - if (!this._fragment) - return false; - if (this._fallbackTextureUsed) - return true; - var n = this._getDefines(); - return !(!this._effect || n !== this._cachedDefines || !this._effect.isReady()) || (e = void 0 !== this._fragment.fragmentElement ? { - vertex: "procedural", - fragmentElement: this._fragment.fragmentElement - } : { - vertex: "procedural", - fragment: this._fragment - }, - this._cachedDefines = n, - this._effect = i.createEffect(e, [Si.b.PositionKind], this._uniforms, this._samplers, n, void 0, void 0, function() { - t.releaseInternalTexture(), - t._fallbackTexture && (t._texture = t._fallbackTexture._texture, - t._texture && t._texture.incrementReferences()), - t._fallbackTextureUsed = true - }), - this._effect.isReady()) - } - , - t.prototype.resetRefreshCounter = function() { - this._currentRefreshId = -1 - } - , - t.prototype.setFragment = function(e) { - this._fragment = e - } - , - Object.defineProperty(t.prototype, "refreshRate", { - get: function() { - return this._refreshRate - }, - set: function(e) { - this._refreshRate = e, - this.resetRefreshCounter() - }, - enumerable: true, - configurable: true + (this._indexBuffer = e.createIndexBuffer(t)); }), - t.prototype._shouldRender = function() { - return this.isEnabled && this.isReady() && this._texture ? !(this._fallbackTextureUsed || (-1 === this._currentRefreshId ? (this._currentRefreshId = 1, - 0) : this.refreshRate === this._currentRefreshId ? (this._currentRefreshId = 1, - 0) : (this._currentRefreshId++, - 1))) : (this._texture && (this._texture.isReady = false), - false) - } - , - t.prototype.getRenderSize = function() { - return this._size - } - , - t.prototype.resize = function(e, t) { - this._fallbackTextureUsed || (this.releaseInternalTexture(), - this._texture = this._engine.createRenderTargetTexture(e, t), - this._size = e, - this._generateMipMaps = t) - } - , - t.prototype._checkUniform = function(e) { - -1 === this._uniforms.indexOf(e) && this._uniforms.push(e) - } - , - t.prototype.setTexture = function(e, t) { - return -1 === this._samplers.indexOf(e) && this._samplers.push(e), - this._textures[e] = t, + (t.prototype._rebuild = function () { + var e = this._vertexBuffers[Si.b.PositionKind]; + e && e._rebuild(), + this._createIndexBuffer(), + this.refreshRate === li.REFRESHRATE_RENDER_ONCE && + (this.refreshRate = li.REFRESHRATE_RENDER_ONCE); + }), + (t.prototype.reset = function () { + void 0 !== this._effect && this._effect.dispose(); + }), + (t.prototype._getDefines = function () { + return ""; + }), + (t.prototype.isReady = function () { + var e, + t = this, + i = this._engine; + if (!this._fragment) return false; + if (this._fallbackTextureUsed) return true; + var n = this._getDefines(); + return ( + !( + !this._effect || + n !== this._cachedDefines || + !this._effect.isReady() + ) || + ((e = + void 0 !== this._fragment.fragmentElement + ? { + vertex: "procedural", + fragmentElement: this._fragment.fragmentElement, + } + : { + vertex: "procedural", + fragment: this._fragment, + }), + (this._cachedDefines = n), + (this._effect = i.createEffect( + e, + [Si.b.PositionKind], + this._uniforms, + this._samplers, + n, + void 0, + void 0, + function () { + t.releaseInternalTexture(), + t._fallbackTexture && + ((t._texture = t._fallbackTexture._texture), + t._texture && t._texture.incrementReferences()), + (t._fallbackTextureUsed = true); + } + )), + this._effect.isReady()) + ); + }), + (t.prototype.resetRefreshCounter = function () { + this._currentRefreshId = -1; + }), + (t.prototype.setFragment = function (e) { + this._fragment = e; + }), + Object.defineProperty(t.prototype, "refreshRate", { + get: function () { + return this._refreshRate; + }, + set: function (e) { + (this._refreshRate = e), this.resetRefreshCounter(); + }, + enumerable: true, + configurable: true, + }), + (t.prototype._shouldRender = function () { + return this.isEnabled && this.isReady() && this._texture + ? !( + this._fallbackTextureUsed || + (-1 === this._currentRefreshId + ? ((this._currentRefreshId = 1), 0) + : this.refreshRate === this._currentRefreshId + ? ((this._currentRefreshId = 1), 0) + : (this._currentRefreshId++, 1)) + ) + : (this._texture && (this._texture.isReady = false), + false); + }), + (t.prototype.getRenderSize = function () { + return this._size; + }), + (t.prototype.resize = function (e, t) { + this._fallbackTextureUsed || + (this.releaseInternalTexture(), + (this._texture = this._engine.createRenderTargetTexture( + e, + t + )), + (this._size = e), + (this._generateMipMaps = t)); + }), + (t.prototype._checkUniform = function (e) { + -1 === this._uniforms.indexOf(e) && + this._uniforms.push(e); + }), + (t.prototype.setTexture = function (e, t) { + return ( + -1 === this._samplers.indexOf(e) && + this._samplers.push(e), + (this._textures[e] = t), this - } - , - t.prototype.setFloat = function(e, t) { - return this._checkUniform(e), - this._floats[e] = t, - this - } - , - t.prototype.setInt = function(e, t) { - return this._checkUniform(e), - this._ints[e] = t, - this - } - , - t.prototype.setFloats = function(e, t) { - return this._checkUniform(e), - this._floatsArrays[e] = t, - this - } - , - t.prototype.setColor3 = function(e, t) { - return this._checkUniform(e), - this._colors3[e] = t, - this - } - , - t.prototype.setColor4 = function(e, t) { - return this._checkUniform(e), - this._colors4[e] = t, - this - } - , - t.prototype.setVector2 = function(e, t) { - return this._checkUniform(e), - this._vectors2[e] = t, - this - } - , - t.prototype.setVector3 = function(e, t) { - return this._checkUniform(e), - this._vectors3[e] = t, - this - } - , - t.prototype.setMatrix = function(e, t) { - return this._checkUniform(e), - this._matrices[e] = t, - this - } - , - t.prototype.render = function(e) { - var t = this.getScene(); - if (t) { - var i = this._engine; - for (var n in i.enableEffect(this._effect), - i.setState(false), - this._textures) - this._effect.setTexture(n, this._textures[n]); - for (n in this._ints) - this._effect.setInt(n, this._ints[n]); - for (n in this._floats) - this._effect.setFloat(n, this._floats[n]); - for (n in this._floatsArrays) - this._effect.setArray(n, this._floatsArrays[n]); - for (n in this._colors3) - this._effect.setColor3(n, this._colors3[n]); - for (n in this._colors4) { - var r = this._colors4[n]; - this._effect.setFloat4(n, r.r, r.g, r.b, r.a) - } - for (n in this._vectors2) - this._effect.setVector2(n, this._vectors2[n]); - for (n in this._vectors3) - this._effect.setVector3(n, this._vectors3[n]); - for (n in this._matrices) - this._effect.setMatrix(n, this._matrices[n]); - if (this._texture) { - if (this.isCube) - for (var o = 0; o < 6; o++) - i.bindFramebuffer(this._texture, o, void 0, void 0, true), - i.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect), - this._effect.setFloat("face", o), - this.autoClear && i.clear(t.clearColor, true, false, false), - i.drawElementsType(Mr.a.TriangleFillMode, 0, 6), - 5 === o && i.generateMipMapsForCubemap(this._texture); - else - i.bindFramebuffer(this._texture, 0, void 0, void 0, true), - i.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect), - this.autoClear && i.clear(t.clearColor, true, false, false), - i.drawElementsType(Mr.a.TriangleFillMode, 0, 6); - i.unBindFramebuffer(this._texture, this.isCube), - this.onGenerated && this.onGenerated(), - this.onGeneratedObservable.notifyObservers(this) - } + ); + }), + (t.prototype.setFloat = function (e, t) { + return this._checkUniform(e), (this._floats[e] = t), this; + }), + (t.prototype.setInt = function (e, t) { + return this._checkUniform(e), (this._ints[e] = t), this; + }), + (t.prototype.setFloats = function (e, t) { + return ( + this._checkUniform(e), (this._floatsArrays[e] = t), this + ); + }), + (t.prototype.setColor3 = function (e, t) { + return ( + this._checkUniform(e), (this._colors3[e] = t), this + ); + }), + (t.prototype.setColor4 = function (e, t) { + return ( + this._checkUniform(e), (this._colors4[e] = t), this + ); + }), + (t.prototype.setVector2 = function (e, t) { + return ( + this._checkUniform(e), (this._vectors2[e] = t), this + ); + }), + (t.prototype.setVector3 = function (e, t) { + return ( + this._checkUniform(e), (this._vectors3[e] = t), this + ); + }), + (t.prototype.setMatrix = function (e, t) { + return ( + this._checkUniform(e), (this._matrices[e] = t), this + ); + }), + (t.prototype.render = function (e) { + var t = this.getScene(); + if (t) { + var i = this._engine; + for (var n in (i.enableEffect(this._effect), + i.setState(false), + this._textures)) + this._effect.setTexture(n, this._textures[n]); + for (n in this._ints) + this._effect.setInt(n, this._ints[n]); + for (n in this._floats) + this._effect.setFloat(n, this._floats[n]); + for (n in this._floatsArrays) + this._effect.setArray(n, this._floatsArrays[n]); + for (n in this._colors3) + this._effect.setColor3(n, this._colors3[n]); + for (n in this._colors4) { + var r = this._colors4[n]; + this._effect.setFloat4(n, r.r, r.g, r.b, r.a); } - } - , - t.prototype.clone = function() { - var e = this.getSize() - , i = new t(this.name,e.width,this._fragment,this.getScene(),this._fallbackTexture,this._generateMipMaps); - return i.hasAlpha = this.hasAlpha, - i.level = this.level, - i.coordinatesMode = this.coordinatesMode, + for (n in this._vectors2) + this._effect.setVector2(n, this._vectors2[n]); + for (n in this._vectors3) + this._effect.setVector3(n, this._vectors3[n]); + for (n in this._matrices) + this._effect.setMatrix(n, this._matrices[n]); + if (this._texture) { + if (this.isCube) + for (var o = 0; o < 6; o++) + i.bindFramebuffer( + this._texture, + o, + void 0, + void 0, + true + ), + i.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + this._effect + ), + this._effect.setFloat("face", o), + this.autoClear && + i.clear(t.clearColor, true, false, false), + i.drawElementsType(Mr.a.TriangleFillMode, 0, 6), + 5 === o && + i.generateMipMapsForCubemap(this._texture); + else + i.bindFramebuffer( + this._texture, + 0, + void 0, + void 0, + true + ), + i.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + this._effect + ), + this.autoClear && + i.clear(t.clearColor, true, false, false), + i.drawElementsType(Mr.a.TriangleFillMode, 0, 6); + i.unBindFramebuffer(this._texture, this.isCube), + this.onGenerated && this.onGenerated(), + this.onGeneratedObservable.notifyObservers(this); + } + } + }), + (t.prototype.clone = function () { + var e = this.getSize(), + i = new t( + this.name, + e.width, + this._fragment, + this.getScene(), + this._fallbackTexture, + this._generateMipMaps + ); + return ( + (i.hasAlpha = this.hasAlpha), + (i.level = this.level), + (i.coordinatesMode = this.coordinatesMode), i - } - , - t.prototype.dispose = function() { - var t = this.getScene(); - if (t) { - var i = t.proceduralTextures.indexOf(this); - i >= 0 && t.proceduralTextures.splice(i, 1); - var n = this._vertexBuffers[Si.b.PositionKind]; - n && (n.dispose(), - this._vertexBuffers[Si.b.PositionKind] = null), - this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer) && (this._indexBuffer = null), - e.prototype.dispose.call(this) - } - } - , + ); + }), + (t.prototype.dispose = function () { + var t = this.getScene(); + if (t) { + var i = t.proceduralTextures.indexOf(this); + i >= 0 && t.proceduralTextures.splice(i, 1); + var n = this._vertexBuffers[Si.b.PositionKind]; + n && + (n.dispose(), + (this._vertexBuffers[Si.b.PositionKind] = null)), + this._indexBuffer && + this._engine._releaseBuffer(this._indexBuffer) && + (this._indexBuffer = null), + e.prototype.dispose.call(this); + } + }), h.c([Object(F.c)()], t.prototype, "isEnabled", void 0), h.c([Object(F.c)()], t.prototype, "autoClear", void 0), - h.c([Object(F.c)()], t.prototype, "_generateMipMaps", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "_generateMipMaps", + void 0 + ), h.c([Object(F.c)()], t.prototype, "_size", void 0), h.c([Object(F.c)()], t.prototype, "refreshRate", null), t - }(je.a) - , Co = n(60) - , Po = function(e) { - function t(t, i, n, r, o, a) { - var s = e.call(this, t, n, null, r, o, a) || this; - return s._animate = true, - s._time = 0, - s._texturePath = i, - s._loadJson(i), - s.refreshRate = 1, - s - } - return h.d(t, e), - t.prototype._loadJson = function(e) { - var t = this - , i = function() { - g.a.Log("No config file found in " + e + " trying to use ShadersStore or DOM element"); - try { - t.setFragment(t._texturePath) - } catch (e) { - g.a.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture") - } - } - , n = e + "/config.json" - , r = new Co.a; - r.open("GET", n), - r.addEventListener("load", function() { - if (200 === r.status || r.responseText && r.responseText.length > 0) - try { - t._config = JSON.parse(r.response), - t.updateShaderUniforms(), - t.updateTextures(), - t.setFragment(t._texturePath + "/custom"), - t._animate = t._config.animate, - t.refreshRate = t._config.refreshrate - } catch (e) { - i() - } - else - i() - }, false), - r.addEventListener("error", function() { - i() - }, false); - try { - r.send() - } catch (e) { - g.a.Error("CustomProceduralTexture: Error on XHR send request.") - } - } - , - t.prototype.isReady = function() { - if (!e.prototype.isReady.call(this)) - return false; - for (var t in this._textures) - if (!this._textures[t].isReady()) - return false; - return true - } - , - t.prototype.render = function(t) { - var i = this.getScene(); - this._animate && i && (this._time += .03 * i.getAnimationRatio(), + ); + })(je.a), + Co = n(60), + Po = (function (e) { + function t(t, i, n, r, o, a) { + var s = e.call(this, t, n, null, r, o, a) || this; + return ( + (s._animate = true), + (s._time = 0), + (s._texturePath = i), + s._loadJson(i), + (s.refreshRate = 1), + s + ); + } + return ( + h.d(t, e), + (t.prototype._loadJson = function (e) { + var t = this, + i = function () { + g.a.Log( + "No config file found in " + + e + + " trying to use ShadersStore or DOM element" + ); + try { + t.setFragment(t._texturePath); + } catch (e) { + g.a.Error( + "No json or ShaderStore or DOM element found for CustomProceduralTexture" + ); + } + }, + n = e + "/config.json", + r = new Co.a(); + r.open("GET", n), + r.addEventListener( + "load", + function () { + if ( + 200 === r.status || + (r.responseText && r.responseText.length > 0) + ) + try { + (t._config = JSON.parse(r.response)), + t.updateShaderUniforms(), + t.updateTextures(), + t.setFragment(t._texturePath + "/custom"), + (t._animate = t._config.animate), + (t.refreshRate = t._config.refreshrate); + } catch (e) { + i(); + } + else i(); + }, + false + ), + r.addEventListener( + "error", + function () { + i(); + }, + false + ); + try { + r.send(); + } catch (e) { + g.a.Error( + "CustomProceduralTexture: Error on XHR send request." + ); + } + }), + (t.prototype.isReady = function () { + if (!e.prototype.isReady.call(this)) return false; + for (var t in this._textures) + if (!this._textures[t].isReady()) return false; + return true; + }), + (t.prototype.render = function (t) { + var i = this.getScene(); + this._animate && + i && + ((this._time += 0.03 * i.getAnimationRatio()), this.updateShaderUniforms()), - e.prototype.render.call(this, t) - } - , - t.prototype.updateTextures = function() { - for (var e = 0; e < this._config.sampler2Ds.length; e++) - this.setTexture(this._config.sampler2Ds[e].sample2Dname, new je.a(this._texturePath + "/" + this._config.sampler2Ds[e].textureRelativeUrl,this.getScene())) - } - , - t.prototype.updateShaderUniforms = function() { - if (this._config) - for (var e = 0; e < this._config.uniforms.length; e++) { - var t = this._config.uniforms[e]; - switch (t.type) { - case "float": - this.setFloat(t.name, t.value); - break; - case "color3": - this.setColor3(t.name, new a.e(t.r,t.g,t.b)); - break; - case "color4": - this.setColor4(t.name, new a.f(t.r,t.g,t.b,t.a)); - break; - case "vector2": - this.setVector2(t.name, new a.w(t.x,t.y)); - break; - case "vector3": - this.setVector3(t.name, new a.x(t.x,t.y,t.z)) - } - } - this.setFloat("time", this._time) - } - , + e.prototype.render.call(this, t); + }), + (t.prototype.updateTextures = function () { + for (var e = 0; e < this._config.sampler2Ds.length; e++) + this.setTexture( + this._config.sampler2Ds[e].sample2Dname, + new je.a( + this._texturePath + + "/" + + this._config.sampler2Ds[e].textureRelativeUrl, + this.getScene() + ) + ); + }), + (t.prototype.updateShaderUniforms = function () { + if (this._config) + for (var e = 0; e < this._config.uniforms.length; e++) { + var t = this._config.uniforms[e]; + switch (t.type) { + case "float": + this.setFloat(t.name, t.value); + break; + case "color3": + this.setColor3(t.name, new a.e(t.r, t.g, t.b)); + break; + case "color4": + this.setColor4( + t.name, + new a.f(t.r, t.g, t.b, t.a) + ); + break; + case "vector2": + this.setVector2(t.name, new a.w(t.x, t.y)); + break; + case "vector3": + this.setVector3(t.name, new a.x(t.x, t.y, t.z)); + } + } + this.setFloat("time", this._time); + }), Object.defineProperty(t.prototype, "animate", { - get: function() { - return this._animate - }, - set: function(e) { - this._animate = e - }, - enumerable: true, - configurable: true + get: function () { + return this._animate; + }, + set: function (e) { + this._animate = e; + }, + enumerable: true, + configurable: true, }), t - }(So); - Ht.a.ShadersStore.noisePixelShader = "\n\nuniform float brightness;\nuniform float persistence;\nuniform float timeScale;\n\nvarying vec2 vUV;\n\nvec2 hash22(vec2 p)\n{\np=p*mat2(127.1,311.7,269.5,183.3);\np=-1.0+2.0*fract(sin(p)*43758.5453123);\nreturn sin(p*6.283+timeScale);\n}\nfloat interpolationNoise(vec2 p)\n{\nvec2 pi=floor(p);\nvec2 pf=p-pi;\nvec2 w=pf*pf*(3.-2.*pf);\nfloat f00=dot(hash22(pi+vec2(.0,.0)),pf-vec2(.0,.0));\nfloat f01=dot(hash22(pi+vec2(.0,1.)),pf-vec2(.0,1.));\nfloat f10=dot(hash22(pi+vec2(1.0,0.)),pf-vec2(1.0,0.));\nfloat f11=dot(hash22(pi+vec2(1.0,1.)),pf-vec2(1.0,1.));\nfloat xm1=mix(f00,f10,w.x);\nfloat xm2=mix(f01,f11,w.x);\nfloat ym=mix(xm1,xm2,w.y);\nreturn ym;\n}\nfloat perlinNoise2D(float x,float y)\n{\nfloat sum=0.0;\nfloat frequency=0.0;\nfloat amplitude=0.0;\nfor(int i=0; i e.EPSILON ? 1 : 0; - u |= h, - l.push(h) - } - switch (u) { + ); + })(), + zo = (function () { + function e(e, t) { + (this.normal = e), (this.w = t); + } + return ( + (e.FromPoints = function (t, i, n) { + var r = n.subtract(t), + o = i.subtract(t); + if (0 === r.lengthSquared() || 0 === o.lengthSquared()) + return null; + var s = a.x.Normalize(a.x.Cross(r, o)); + return new e(s, a.x.Dot(s, t)); + }), + (e.prototype.clone = function () { + return new e(this.normal.clone(), this.w); + }), + (e.prototype.flip = function () { + this.normal.scaleInPlace(-1), (this.w = -this.w); + }), + (e.prototype.splitPolygon = function (t, i, n, r, o) { + var s, + c, + u = 0, + l = []; + for (s = 0; s < t.vertices.length; s++) { + var h = + (c = + a.x.Dot(this.normal, t.vertices[s].pos) - this.w) < + -e.EPSILON + ? 2 + : c > e.EPSILON + ? 1 + : 0; + (u |= h), l.push(h); + } + switch (u) { case 0: - (a.x.Dot(this.normal, t.plane.normal) > 0 ? i : n).push(t); - break; + (a.x.Dot(this.normal, t.plane.normal) > 0 + ? i + : n + ).push(t); + break; case 1: - r.push(t); - break; + r.push(t); + break; case 2: - o.push(t); - break; + o.push(t); + break; case 3: - var f, d = [], p = []; - for (s = 0; s < t.vertices.length; s++) { - var m = (s + 1) % t.vertices.length - , g = l[s] - , _ = l[m] - , v = t.vertices[s] - , y = t.vertices[m]; - if (2 !== g && d.push(v), - 1 !== g && p.push(2 !== g ? v.clone() : v), - 3 == (g | _)) { - c = (this.w - a.x.Dot(this.normal, v.pos)) / a.x.Dot(this.normal, y.pos.subtract(v.pos)); - var b = v.interpolate(y, c); - d.push(b), - p.push(b.clone()) - } + var f, + d = [], + p = []; + for (s = 0; s < t.vertices.length; s++) { + var m = (s + 1) % t.vertices.length, + g = l[s], + _ = l[m], + v = t.vertices[s], + y = t.vertices[m]; + if ( + (2 !== g && d.push(v), + 1 !== g && p.push(2 !== g ? v.clone() : v), + 3 == (g | _)) + ) { + c = + (this.w - a.x.Dot(this.normal, v.pos)) / + a.x.Dot(this.normal, y.pos.subtract(v.pos)); + var b = v.interpolate(y, c); + d.push(b), p.push(b.clone()); } - d.length >= 3 && (f = new jo(d,t.shared)).plane && r.push(f), - p.length >= 3 && (f = new jo(p,t.shared)).plane && o.push(f) - } - } - , - e.EPSILON = 1e-5, + } + d.length >= 3 && + (f = new jo(d, t.shared)).plane && + r.push(f), + p.length >= 3 && + (f = new jo(p, t.shared)).plane && + o.push(f); + } + }), + (e.EPSILON = 1e-5), e - }() - , jo = function() { - function e(e, t) { - this.vertices = e, - this.shared = t, - this.plane = zo.FromPoints(e[0].pos, e[1].pos, e[2].pos) - } - return e.prototype.clone = function() { - return new e(this.vertices.map(function(e) { - return e.clone() - }),this.shared) - } - , - e.prototype.flip = function() { - this.vertices.reverse().map(function(e) { - e.flip() + ); + })(), + jo = (function () { + function e(e, t) { + (this.vertices = e), + (this.shared = t), + (this.plane = zo.FromPoints( + e[0].pos, + e[1].pos, + e[2].pos + )); + } + return ( + (e.prototype.clone = function () { + return new e( + this.vertices.map(function (e) { + return e.clone(); }), - this.plane.flip() - } - , + this.shared + ); + }), + (e.prototype.flip = function () { + this.vertices.reverse().map(function (e) { + e.flip(); + }), + this.plane.flip(); + }), e - }() - , Ho = function() { - function e(e) { - this.plane = null, - this.front = null, - this.back = null, - this.polygons = new Array, - e && this.build(e) - } - return e.prototype.clone = function() { - var t = new e; - return t.plane = this.plane && this.plane.clone(), - t.front = this.front && this.front.clone(), - t.back = this.back && this.back.clone(), - t.polygons = this.polygons.map(function(e) { - return e.clone() - }), + ); + })(), + Ho = (function () { + function e(e) { + (this.plane = null), + (this.front = null), + (this.back = null), + (this.polygons = new Array()), + e && this.build(e); + } + return ( + (e.prototype.clone = function () { + var t = new e(); + return ( + (t.plane = this.plane && this.plane.clone()), + (t.front = this.front && this.front.clone()), + (t.back = this.back && this.back.clone()), + (t.polygons = this.polygons.map(function (e) { + return e.clone(); + })), t - } - , - e.prototype.invert = function() { - for (var e = 0; e < this.polygons.length; e++) - this.polygons[e].flip(); - this.plane && this.plane.flip(), + ); + }), + (e.prototype.invert = function () { + for (var e = 0; e < this.polygons.length; e++) + this.polygons[e].flip(); + this.plane && this.plane.flip(), this.front && this.front.invert(), this.back && this.back.invert(); - var t = this.front; - this.front = this.back, - this.back = t - } - , - e.prototype.clipPolygons = function(e) { - if (!this.plane) - return e.slice(); - for (var t = new Array, i = new Array, n = 0; n < e.length; n++) - this.plane.splitPolygon(e[n], t, i, t, i); - return this.front && (t = this.front.clipPolygons(t)), - i = this.back ? this.back.clipPolygons(i) : [], + var t = this.front; + (this.front = this.back), (this.back = t); + }), + (e.prototype.clipPolygons = function (e) { + if (!this.plane) return e.slice(); + for ( + var t = new Array(), i = new Array(), n = 0; + n < e.length; + n++ + ) + this.plane.splitPolygon(e[n], t, i, t, i); + return ( + this.front && (t = this.front.clipPolygons(t)), + (i = this.back ? this.back.clipPolygons(i) : []), t.concat(i) - } - , - e.prototype.clipTo = function(e) { - this.polygons = e.clipPolygons(this.polygons), + ); + }), + (e.prototype.clipTo = function (e) { + (this.polygons = e.clipPolygons(this.polygons)), this.front && this.front.clipTo(e), - this.back && this.back.clipTo(e) - } - , - e.prototype.allPolygons = function() { - var e = this.polygons.slice(); - return this.front && (e = e.concat(this.front.allPolygons())), + this.back && this.back.clipTo(e); + }), + (e.prototype.allPolygons = function () { + var e = this.polygons.slice(); + return ( + this.front && (e = e.concat(this.front.allPolygons())), this.back && (e = e.concat(this.back.allPolygons())), e - } - , - e.prototype.build = function(t) { - if (t.length) { - this.plane || (this.plane = t[0].plane.clone()); - for (var i = new Array, n = new Array, r = 0; r < t.length; r++) - this.plane.splitPolygon(t[r], this.polygons, this.polygons, i, n); - i.length && (this.front || (this.front = new e), - this.front.build(i)), - n.length && (this.back || (this.back = new e), - this.back.build(n)) - } - } - , + ); + }), + (e.prototype.build = function (t) { + if (t.length) { + this.plane || (this.plane = t[0].plane.clone()); + for ( + var i = new Array(), n = new Array(), r = 0; + r < t.length; + r++ + ) + this.plane.splitPolygon( + t[r], + this.polygons, + this.polygons, + i, + n + ); + i.length && + (this.front || (this.front = new e()), + this.front.build(i)), + n.length && + (this.back || (this.back = new e()), + this.back.build(n)); + } + }), e - }() - , Wo = function() { - function e() { - this.polygons = new Array - } - return e.FromMesh = function(t) { - var i, n, r, o, s, c, u, l, h, f, d = new Array, p = null; - if (!(t instanceof me.a)) - throw "BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh"; - t.computeWorldMatrix(true), - u = t.getWorldMatrix(), - l = t.position.clone(), - h = t.rotation.clone(), - t.rotationQuaternion && (p = t.rotationQuaternion.clone()), - f = t.scaling.clone(); - for (var m = t.getIndices(), g = t.getVerticesData(Si.b.PositionKind), _ = t.getVerticesData(Si.b.NormalKind), v = t.getVerticesData(Si.b.UVKind), y = t.subMeshes, b = 0, E = y.length; b < E; b++) - for (var T = y[b].indexStart, A = y[b].indexCount + y[b].indexStart; T < A; T += 3) { - c = []; - for (var x = 0; x < 3; x++) { - var S = new a.x(_[3 * m[T + x]],_[3 * m[T + x] + 1],_[3 * m[T + x] + 2]); - r = new a.w(v[2 * m[T + x]],v[2 * m[T + x] + 1]); - var C = new a.x(g[3 * m[T + x]],g[3 * m[T + x] + 1],g[3 * m[T + x] + 2]); - o = a.x.TransformCoordinates(C, u), - n = a.x.TransformNormal(S, u), - i = new Go(o,n,r), - c.push(i) - } - (s = new jo(c,{ - subMeshId: b, - meshId: Vo, - materialIndex: y[b].materialIndex - })).plane && d.push(s) - } - var P = e.FromPolygons(d); - return P.matrix = u, - P.position = l, - P.rotation = h, - P.scaling = f, - P.rotationQuaternion = p, + ); + })(), + Wo = (function () { + function e() { + this.polygons = new Array(); + } + return ( + (e.FromMesh = function (t) { + var i, + n, + r, + o, + s, + c, + u, + l, + h, + f, + d = new Array(), + p = null; + if (!(t instanceof me.a)) + throw "BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh"; + t.computeWorldMatrix(true), + (u = t.getWorldMatrix()), + (l = t.position.clone()), + (h = t.rotation.clone()), + t.rotationQuaternion && + (p = t.rotationQuaternion.clone()), + (f = t.scaling.clone()); + for ( + var m = t.getIndices(), + g = t.getVerticesData(Si.b.PositionKind), + _ = t.getVerticesData(Si.b.NormalKind), + v = t.getVerticesData(Si.b.UVKind), + y = t.subMeshes, + b = 0, + E = y.length; + b < E; + b++ + ) + for ( + var T = y[b].indexStart, + A = y[b].indexCount + y[b].indexStart; + T < A; + T += 3 + ) { + c = []; + for (var x = 0; x < 3; x++) { + var S = new a.x( + _[3 * m[T + x]], + _[3 * m[T + x] + 1], + _[3 * m[T + x] + 2] + ); + r = new a.w(v[2 * m[T + x]], v[2 * m[T + x] + 1]); + var C = new a.x( + g[3 * m[T + x]], + g[3 * m[T + x] + 1], + g[3 * m[T + x] + 2] + ); + (o = a.x.TransformCoordinates(C, u)), + (n = a.x.TransformNormal(S, u)), + (i = new Go(o, n, r)), + c.push(i); + } + (s = new jo(c, { + subMeshId: b, + meshId: Vo, + materialIndex: y[b].materialIndex, + })).plane && d.push(s); + } + var P = e.FromPolygons(d); + return ( + (P.matrix = u), + (P.position = l), + (P.rotation = h), + (P.scaling = f), + (P.rotationQuaternion = p), Vo++, P - } - , - e.FromPolygons = function(t) { - var i = new e; - return i.polygons = t, - i - } - , - e.prototype.clone = function() { - var t = new e; - return t.polygons = this.polygons.map(function(e) { - return e.clone() - }), + ); + }), + (e.FromPolygons = function (t) { + var i = new e(); + return (i.polygons = t), i; + }), + (e.prototype.clone = function () { + var t = new e(); + return ( + (t.polygons = this.polygons.map(function (e) { + return e.clone(); + })), t.copyTransformAttributes(this), t - } - , - e.prototype.union = function(t) { - var i = new Ho(this.clone().polygons) - , n = new Ho(t.clone().polygons); - return i.clipTo(n), - n.clipTo(i), - n.invert(), - n.clipTo(i), - n.invert(), - i.build(n.allPolygons()), - e.FromPolygons(i.allPolygons()).copyTransformAttributes(this) - } - , - e.prototype.unionInPlace = function(e) { - var t = new Ho(this.polygons) - , i = new Ho(e.polygons); - t.clipTo(i), - i.clipTo(t), - i.invert(), - i.clipTo(t), - i.invert(), - t.build(i.allPolygons()), - this.polygons = t.allPolygons() - } - , - e.prototype.subtract = function(t) { - var i = new Ho(this.clone().polygons) - , n = new Ho(t.clone().polygons); - return i.invert(), + ); + }), + (e.prototype.union = function (t) { + var i = new Ho(this.clone().polygons), + n = new Ho(t.clone().polygons); + return ( i.clipTo(n), n.clipTo(i), n.invert(), n.clipTo(i), n.invert(), i.build(n.allPolygons()), - i.invert(), - e.FromPolygons(i.allPolygons()).copyTransformAttributes(this) - } - , - e.prototype.subtractInPlace = function(e) { - var t = new Ho(this.polygons) - , i = new Ho(e.polygons); - t.invert(), - t.clipTo(i), - i.clipTo(t), - i.invert(), - i.clipTo(t), - i.invert(), - t.build(i.allPolygons()), - t.invert(), - this.polygons = t.allPolygons() - } - , - e.prototype.intersect = function(t) { - var i = new Ho(this.clone().polygons) - , n = new Ho(t.clone().polygons); - return i.invert(), - n.clipTo(i), - n.invert(), - i.clipTo(n), - n.clipTo(i), - i.build(n.allPolygons()), - i.invert(), - e.FromPolygons(i.allPolygons()).copyTransformAttributes(this) - } - , - e.prototype.intersectInPlace = function(e) { - var t = new Ho(this.polygons) - , i = new Ho(e.polygons); - t.invert(), - i.clipTo(t), - i.invert(), - t.clipTo(i), - i.clipTo(t), - t.build(i.allPolygons()), - t.invert(), - this.polygons = t.allPolygons() - } - , - e.prototype.inverse = function() { - var e = this.clone(); - return e.inverseInPlace(), e - } - , - e.prototype.inverseInPlace = function() { - this.polygons.map(function(e) { - e.flip() - }) - } - , - e.prototype.copyTransformAttributes = function(e) { - return this.matrix = e.matrix, - this.position = e.position, - this.rotation = e.rotation, - this.scaling = e.scaling, - this.rotationQuaternion = e.rotationQuaternion, + .FromPolygons(i.allPolygons()) + .copyTransformAttributes(this) + ); + }), + (e.prototype.unionInPlace = function (e) { + var t = new Ho(this.polygons), + i = new Ho(e.polygons); + t.clipTo(i), + i.clipTo(t), + i.invert(), + i.clipTo(t), + i.invert(), + t.build(i.allPolygons()), + (this.polygons = t.allPolygons()); + }), + (e.prototype.subtract = function (t) { + var i = new Ho(this.clone().polygons), + n = new Ho(t.clone().polygons); + return ( + i.invert(), + i.clipTo(n), + n.clipTo(i), + n.invert(), + n.clipTo(i), + n.invert(), + i.build(n.allPolygons()), + i.invert(), + e + .FromPolygons(i.allPolygons()) + .copyTransformAttributes(this) + ); + }), + (e.prototype.subtractInPlace = function (e) { + var t = new Ho(this.polygons), + i = new Ho(e.polygons); + t.invert(), + t.clipTo(i), + i.clipTo(t), + i.invert(), + i.clipTo(t), + i.invert(), + t.build(i.allPolygons()), + t.invert(), + (this.polygons = t.allPolygons()); + }), + (e.prototype.intersect = function (t) { + var i = new Ho(this.clone().polygons), + n = new Ho(t.clone().polygons); + return ( + i.invert(), + n.clipTo(i), + n.invert(), + i.clipTo(n), + n.clipTo(i), + i.build(n.allPolygons()), + i.invert(), + e + .FromPolygons(i.allPolygons()) + .copyTransformAttributes(this) + ); + }), + (e.prototype.intersectInPlace = function (e) { + var t = new Ho(this.polygons), + i = new Ho(e.polygons); + t.invert(), + i.clipTo(t), + i.invert(), + t.clipTo(i), + i.clipTo(t), + t.build(i.allPolygons()), + t.invert(), + (this.polygons = t.allPolygons()); + }), + (e.prototype.inverse = function () { + var e = this.clone(); + return e.inverseInPlace(), e; + }), + (e.prototype.inverseInPlace = function () { + this.polygons.map(function (e) { + e.flip(); + }); + }), + (e.prototype.copyTransformAttributes = function (e) { + return ( + (this.matrix = e.matrix), + (this.position = e.position), + (this.rotation = e.rotation), + (this.scaling = e.scaling), + (this.rotationQuaternion = e.rotationQuaternion), this - } - , - e.prototype.buildMeshGeometry = function(e, t, i) { - var n = this.matrix.clone(); - n.invert(); - var r, o, s, c = new me.a(e,t), u = [], l = [], h = [], f = [], d = a.x.Zero(), p = a.x.Zero(), m = a.w.Zero(), g = this.polygons, _ = [0, 0, 0], v = {}, y = 0, b = {}; - i && g.sort(function(e, t) { - return e.shared.meshId === t.shared.meshId ? e.shared.subMeshId - t.shared.subMeshId : e.shared.meshId - t.shared.meshId + ); + }), + (e.prototype.buildMeshGeometry = function (e, t, i) { + var n = this.matrix.clone(); + n.invert(); + var r, + o, + s, + c = new me.a(e, t), + u = [], + l = [], + h = [], + f = [], + d = a.x.Zero(), + p = a.x.Zero(), + m = a.w.Zero(), + g = this.polygons, + _ = [0, 0, 0], + v = {}, + y = 0, + b = {}; + i && + g.sort(function (e, t) { + return e.shared.meshId === t.shared.meshId + ? e.shared.subMeshId - t.shared.subMeshId + : e.shared.meshId - t.shared.meshId; }); - for (var E = 0, T = g.length; E < T; E++) { - b[(r = g[E]).shared.meshId] || (b[r.shared.meshId] = {}), - b[r.shared.meshId][r.shared.subMeshId] || (b[r.shared.meshId][r.shared.subMeshId] = { - indexStart: 1 / 0, - indexEnd: -1 / 0, - materialIndex: r.shared.materialIndex + for (var E = 0, T = g.length; E < T; E++) { + b[(r = g[E]).shared.meshId] || + (b[r.shared.meshId] = {}), + b[r.shared.meshId][r.shared.subMeshId] || + (b[r.shared.meshId][r.shared.subMeshId] = { + indexStart: 1 / 0, + indexEnd: -1 / 0, + materialIndex: r.shared.materialIndex, }), - s = b[r.shared.meshId][r.shared.subMeshId]; - for (var A = 2, x = r.vertices.length; A < x; A++) { - _[0] = 0, - _[1] = A - 1, - _[2] = A; - for (var S = 0; S < 3; S++) { - d.copyFrom(r.vertices[_[S]].pos), - p.copyFrom(r.vertices[_[S]].normal), - m.copyFrom(r.vertices[_[S]].uv); - var C = a.x.TransformCoordinates(d, n) - , P = a.x.TransformNormal(p, n); - void 0 !== (o = v[C.x + "," + C.y + "," + C.z]) && h[3 * o] === P.x && h[3 * o + 1] === P.y && h[3 * o + 2] === P.z && f[2 * o] === m.x && f[2 * o + 1] === m.y || (u.push(C.x, C.y, C.z), - f.push(m.x, m.y), - h.push(p.x, p.y, p.z), - o = v[C.x + "," + C.y + "," + C.z] = u.length / 3 - 1), - l.push(o), - s.indexStart = Math.min(y, s.indexStart), - s.indexEnd = Math.max(y, s.indexEnd), - y++ - } - } + (s = b[r.shared.meshId][r.shared.subMeshId]); + for (var A = 2, x = r.vertices.length; A < x; A++) { + (_[0] = 0), (_[1] = A - 1), (_[2] = A); + for (var S = 0; S < 3; S++) { + d.copyFrom(r.vertices[_[S]].pos), + p.copyFrom(r.vertices[_[S]].normal), + m.copyFrom(r.vertices[_[S]].uv); + var C = a.x.TransformCoordinates(d, n), + P = a.x.TransformNormal(p, n); + (void 0 !== (o = v[C.x + "," + C.y + "," + C.z]) && + h[3 * o] === P.x && + h[3 * o + 1] === P.y && + h[3 * o + 2] === P.z && + f[2 * o] === m.x && + f[2 * o + 1] === m.y) || + (u.push(C.x, C.y, C.z), + f.push(m.x, m.y), + h.push(p.x, p.y, p.z), + (o = v[C.x + "," + C.y + "," + C.z] = + u.length / 3 - 1)), + l.push(o), + (s.indexStart = Math.min(y, s.indexStart)), + (s.indexEnd = Math.max(y, s.indexEnd)), + y++; + } } - if (c.setVerticesData(Si.b.PositionKind, u), + } + if ( + (c.setVerticesData(Si.b.PositionKind, u), c.setVerticesData(Si.b.NormalKind, h), c.setVerticesData(Si.b.UVKind, f), c.setIndices(l, null), - i) { - var R, M = 0; - for (var O in c.subMeshes = new Array, - b) { - for (var w in R = -1, - b[O]) - s = b[O][w], - Uo.b.CreateFromIndices(s.materialIndex + M, s.indexStart, s.indexEnd - s.indexStart + 1, c), - R = Math.max(s.materialIndex, R); - M += ++R - } + i) + ) { + var R, + M = 0; + for (var O in ((c.subMeshes = new Array()), b)) { + for (var w in ((R = -1), b[O])) + (s = b[O][w]), + Uo.b.CreateFromIndices( + s.materialIndex + M, + s.indexStart, + s.indexEnd - s.indexStart + 1, + c + ), + (R = Math.max(s.materialIndex, R)); + M += ++R; } - return c - } - , - e.prototype.toMesh = function(e, t, i, n) { - var r = this.buildMeshGeometry(e, i, n); - return r.material = t, + } + return c; + }), + (e.prototype.toMesh = function (e, t, i, n) { + var r = this.buildMeshGeometry(e, i, n); + return ( + (r.material = t), r.position.copyFrom(this.position), r.rotation.copyFrom(this.rotation), - this.rotationQuaternion && (r.rotationQuaternion = this.rotationQuaternion.clone()), + this.rotationQuaternion && + (r.rotationQuaternion = + this.rotationQuaternion.clone()), r.scaling.copyFrom(this.scaling), r.computeWorldMatrix(true), r - } - , + ); + }), e - }() - , Xo = function(e) { - function t(t, i, n, r, o, s) { - void 0 === r && (r = 1), - void 0 === o && (o = 60), - void 0 === s && (s = true); - var c = e.call(this, t, n) || this; - c._sectionPolygonPointsCount = 4, - c._running = false, - c._autoStart = s, - c._generator = i, - c._diameter = r, - c._length = o, - c._sectionVectors = [], - c._sectionNormalVectors = []; - for (var u = 0; u < c._sectionPolygonPointsCount; u++) - c._sectionVectors[u] = a.x.Zero(), - c._sectionNormalVectors[u] = a.x.Zero(); - return c._createMesh(), - c - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "TrailMesh" - } - , - t.prototype._createMesh = function() { - var e = new xi.a - , t = [] - , i = [] - , n = [] - , r = a.x.Zero(); - this._generator._boundingInfo && (r = this._generator._boundingInfo.boundingBox.centerWorld); - for (var o = 2 * Math.PI / this._sectionPolygonPointsCount, s = 0; s < this._sectionPolygonPointsCount; s++) - t.push(r.x + Math.cos(s * o) * this._diameter, r.y + Math.sin(s * o) * this._diameter, r.z); - for (s = 1; s <= this._length; s++) { - for (var c = 0; c < this._sectionPolygonPointsCount; c++) - t.push(r.x + Math.cos(c * o) * this._diameter, r.y + Math.sin(c * o) * this._diameter, r.z); - var u = t.length / 3 - 2 * this._sectionPolygonPointsCount; - for (c = 0; c < this._sectionPolygonPointsCount - 1; c++) - n.push(u + c, u + c + this._sectionPolygonPointsCount, u + c + this._sectionPolygonPointsCount + 1), - n.push(u + c, u + c + this._sectionPolygonPointsCount + 1, u + c + 1); - n.push(u + this._sectionPolygonPointsCount - 1, u + this._sectionPolygonPointsCount - 1 + this._sectionPolygonPointsCount, u + this._sectionPolygonPointsCount), - n.push(u + this._sectionPolygonPointsCount - 1, u + this._sectionPolygonPointsCount, u) - } - xi.a.ComputeNormals(t, n, i), - e.positions = t, - e.normals = i, - e.indices = n, + ); + })(), + Xo = (function (e) { + function t(t, i, n, r, o, s) { + void 0 === r && (r = 1), + void 0 === o && (o = 60), + void 0 === s && (s = true); + var c = e.call(this, t, n) || this; + (c._sectionPolygonPointsCount = 4), + (c._running = false), + (c._autoStart = s), + (c._generator = i), + (c._diameter = r), + (c._length = o), + (c._sectionVectors = []), + (c._sectionNormalVectors = []); + for (var u = 0; u < c._sectionPolygonPointsCount; u++) + (c._sectionVectors[u] = a.x.Zero()), + (c._sectionNormalVectors[u] = a.x.Zero()); + return c._createMesh(), c; + } + return ( + h.d(t, e), + (t.prototype.getClassName = function () { + return "TrailMesh"; + }), + (t.prototype._createMesh = function () { + var e = new xi.a(), + t = [], + i = [], + n = [], + r = a.x.Zero(); + this._generator._boundingInfo && + (r = + this._generator._boundingInfo.boundingBox + .centerWorld); + for ( + var o = (2 * Math.PI) / this._sectionPolygonPointsCount, + s = 0; + s < this._sectionPolygonPointsCount; + s++ + ) + t.push( + r.x + Math.cos(s * o) * this._diameter, + r.y + Math.sin(s * o) * this._diameter, + r.z + ); + for (s = 1; s <= this._length; s++) { + for ( + var c = 0; + c < this._sectionPolygonPointsCount; + c++ + ) + t.push( + r.x + Math.cos(c * o) * this._diameter, + r.y + Math.sin(c * o) * this._diameter, + r.z + ); + var u = + t.length / 3 - 2 * this._sectionPolygonPointsCount; + for ( + c = 0; + c < this._sectionPolygonPointsCount - 1; + c++ + ) + n.push( + u + c, + u + c + this._sectionPolygonPointsCount, + u + c + this._sectionPolygonPointsCount + 1 + ), + n.push( + u + c, + u + c + this._sectionPolygonPointsCount + 1, + u + c + 1 + ); + n.push( + u + this._sectionPolygonPointsCount - 1, + u + + this._sectionPolygonPointsCount - + 1 + + this._sectionPolygonPointsCount, + u + this._sectionPolygonPointsCount + ), + n.push( + u + this._sectionPolygonPointsCount - 1, + u + this._sectionPolygonPointsCount, + u + ); + } + xi.a.ComputeNormals(t, n, i), + (e.positions = t), + (e.normals = i), + (e.indices = n), e.applyToMesh(this, true), - this._autoStart && this.start() - } - , - t.prototype.start = function() { - var e = this; - this._running || (this._running = true, - this._beforeRenderObserver = this.getScene().onBeforeRenderObservable.add(function() { - e.update() - })) - } - , - t.prototype.stop = function() { - this._beforeRenderObserver && this._running && (this._running = false, - this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver)) - } - , - t.prototype.update = function() { - var e = this.getVerticesData(Si.b.PositionKind) - , t = this.getVerticesData(Si.b.NormalKind) - , i = this._generator.getWorldMatrix(); - if (e && t) { - for (var n = 3 * this._sectionPolygonPointsCount; n < e.length; n++) - e[n - 3 * this._sectionPolygonPointsCount] = e[n] - t[n] / this._length * this._diameter; - for (n = 3 * this._sectionPolygonPointsCount; n < t.length; n++) - t[n - 3 * this._sectionPolygonPointsCount] = t[n]; - var r = e.length - 3 * this._sectionPolygonPointsCount - , o = 2 * Math.PI / this._sectionPolygonPointsCount; - for (n = 0; n < this._sectionPolygonPointsCount; n++) - this._sectionVectors[n].copyFromFloats(Math.cos(n * o) * this._diameter, Math.sin(n * o) * this._diameter, 0), - this._sectionNormalVectors[n].copyFromFloats(Math.cos(n * o), Math.sin(n * o), 0), - a.x.TransformCoordinatesToRef(this._sectionVectors[n], i, this._sectionVectors[n]), - a.x.TransformNormalToRef(this._sectionNormalVectors[n], i, this._sectionNormalVectors[n]); - for (n = 0; n < this._sectionPolygonPointsCount; n++) - e[r + 3 * n] = this._sectionVectors[n].x, - e[r + 3 * n + 1] = this._sectionVectors[n].y, - e[r + 3 * n + 2] = this._sectionVectors[n].z, - t[r + 3 * n] = this._sectionNormalVectors[n].x, - t[r + 3 * n + 1] = this._sectionNormalVectors[n].y, - t[r + 3 * n + 2] = this._sectionNormalVectors[n].z; - this.updateVerticesData(Si.b.PositionKind, e, true, false), - this.updateVerticesData(Si.b.NormalKind, t, true, false) - } - } - , - t.prototype.clone = function(e, i) { - return void 0 === e && (e = ""), - new t(e,void 0 === i ? this._generator : i,this.getScene(),this._diameter,this._length,this._autoStart) - } - , - t.prototype.serialize = function(t) { - e.prototype.serialize.call(this, t) - } - , - t.Parse = function(e, i) { - return new t(e.name,e._generator,i,e._diameter,e._length,e._autoStart) - } - , + this._autoStart && this.start(); + }), + (t.prototype.start = function () { + var e = this; + this._running || + ((this._running = true), + (this._beforeRenderObserver = + this.getScene().onBeforeRenderObservable.add( + function () { + e.update(); + } + ))); + }), + (t.prototype.stop = function () { + this._beforeRenderObserver && + this._running && + ((this._running = false), + this.getScene().onBeforeRenderObservable.remove( + this._beforeRenderObserver + )); + }), + (t.prototype.update = function () { + var e = this.getVerticesData(Si.b.PositionKind), + t = this.getVerticesData(Si.b.NormalKind), + i = this._generator.getWorldMatrix(); + if (e && t) { + for ( + var n = 3 * this._sectionPolygonPointsCount; + n < e.length; + n++ + ) + e[n - 3 * this._sectionPolygonPointsCount] = + e[n] - (t[n] / this._length) * this._diameter; + for ( + n = 3 * this._sectionPolygonPointsCount; + n < t.length; + n++ + ) + t[n - 3 * this._sectionPolygonPointsCount] = t[n]; + var r = e.length - 3 * this._sectionPolygonPointsCount, + o = (2 * Math.PI) / this._sectionPolygonPointsCount; + for (n = 0; n < this._sectionPolygonPointsCount; n++) + this._sectionVectors[n].copyFromFloats( + Math.cos(n * o) * this._diameter, + Math.sin(n * o) * this._diameter, + 0 + ), + this._sectionNormalVectors[n].copyFromFloats( + Math.cos(n * o), + Math.sin(n * o), + 0 + ), + a.x.TransformCoordinatesToRef( + this._sectionVectors[n], + i, + this._sectionVectors[n] + ), + a.x.TransformNormalToRef( + this._sectionNormalVectors[n], + i, + this._sectionNormalVectors[n] + ); + for (n = 0; n < this._sectionPolygonPointsCount; n++) + (e[r + 3 * n] = this._sectionVectors[n].x), + (e[r + 3 * n + 1] = this._sectionVectors[n].y), + (e[r + 3 * n + 2] = this._sectionVectors[n].z), + (t[r + 3 * n] = this._sectionNormalVectors[n].x), + (t[r + 3 * n + 1] = + this._sectionNormalVectors[n].y), + (t[r + 3 * n + 2] = + this._sectionNormalVectors[n].z); + this.updateVerticesData( + Si.b.PositionKind, + e, + true, + false + ), + this.updateVerticesData( + Si.b.NormalKind, + t, + true, + false + ); + } + }), + (t.prototype.clone = function (e, i) { + return ( + void 0 === e && (e = ""), + new t( + e, + void 0 === i ? this._generator : i, + this.getScene(), + this._diameter, + this._length, + this._autoStart + ) + ); + }), + (t.prototype.serialize = function (t) { + e.prototype.serialize.call(this, t); + }), + (t.Parse = function (e, i) { + return new t( + e.name, + e._generator, + i, + e._diameter, + e._length, + e._autoStart + ); + }), t - }(me.a) - , Yo = n(111) - , Ko = n(72); - xi.a.CreateDisc = function(e) { - var t = new Array - , i = new Array - , n = new Array - , r = new Array - , o = e.radius || .5 - , a = e.tessellation || 64 - , s = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1 - , c = 0 === e.sideOrientation ? 0 : e.sideOrientation || xi.a.DEFAULTSIDE; - t.push(0, 0, 0), - r.push(.5, .5); - for (var u = 2 * Math.PI * s, l = u / a, h = 0; h < u; h += l) { - var f = Math.cos(h) - , d = Math.sin(h) - , p = (f + 1) / 2 - , m = (1 - d) / 2; - t.push(o * f, o * d, 0), - r.push(p, m) - } - 1 === s && (t.push(t[3], t[4], t[5]), - r.push(r[2], r[3])); - for (var g = t.length / 3, _ = 1; _ < g - 1; _++) - i.push(_ + 1, 0, _); - xi.a.ComputeNormals(t, i, n), - xi.a._ComputeSides(c, t, i, n, r, e.frontUVs, e.backUVs); - var v = new xi.a; - return v.indices = i, - v.positions = t, - v.normals = n, - v.uvs = r, - v + ); + })(me.a), + Yo = n(111), + Ko = n(72); + (xi.a.CreateDisc = function (e) { + var t = new Array(), + i = new Array(), + n = new Array(), + r = new Array(), + o = e.radius || 0.5, + a = e.tessellation || 64, + s = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1, + c = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || xi.a.DEFAULTSIDE; + t.push(0, 0, 0), r.push(0.5, 0.5); + for (var u = 2 * Math.PI * s, l = u / a, h = 0; h < u; h += l) { + var f = Math.cos(h), + d = Math.sin(h), + p = (f + 1) / 2, + m = (1 - d) / 2; + t.push(o * f, o * d, 0), r.push(p, m); } - , - me.a.CreateDisc = function(e, t, i, n, r, o) { - void 0 === n && (n = null); - var a = { - radius: t, - tessellation: i, - sideOrientation: o, - updatable: r - }; - return Qo.CreateDisc(e, a, n) + 1 === s && (t.push(t[3], t[4], t[5]), r.push(r[2], r[3])); + for (var g = t.length / 3, _ = 1; _ < g - 1; _++) + i.push(_ + 1, 0, _); + xi.a.ComputeNormals(t, i, n), + xi.a._ComputeSides(c, t, i, n, r, e.frontUVs, e.backUVs); + var v = new xi.a(); + return ( + (v.indices = i), + (v.positions = t), + (v.normals = n), + (v.uvs = r), + v + ); + }), + (me.a.CreateDisc = function (e, t, i, n, r, o) { + void 0 === n && (n = null); + var a = { + radius: t, + tessellation: i, + sideOrientation: o, + updatable: r, + }; + return Qo.CreateDisc(e, a, n); + }); + var Qo = (function () { + function e() {} + return ( + (e.CreateDisc = function (e, t, i) { + void 0 === i && (i = null); + var n = new me.a(e, i); + return ( + (t.sideOrientation = me.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (n._originalBuilderSideOrientation = t.sideOrientation), + xi.a.CreateDisc(t).applyToMesh(n, t.updatable), + n + ); + }), + e + ); + })(); + (xi.a.CreateTorusKnot = function (e) { + var t, + i, + n = new Array(), + r = new Array(), + o = new Array(), + s = new Array(), + c = e.radius || 2, + u = e.tube || 0.5, + l = e.radialSegments || 32, + h = e.tubularSegments || 32, + f = e.p || 2, + d = e.q || 3, + p = + 0 === e.sideOrientation + ? 0 + : e.sideOrientation || xi.a.DEFAULTSIDE, + m = function (e) { + var t = Math.cos(e), + i = Math.sin(e), + n = (d / f) * e, + r = Math.cos(n), + o = c * (2 + r) * 0.5 * t, + s = c * (2 + r) * i * 0.5, + u = c * Math.sin(n) * 0.5; + return new a.x(o, s, u); + }; + for (t = 0; t <= l; t++) { + var g = ((t % l) / l) * 2 * f * Math.PI, + _ = m(g), + v = m(g + 0.01), + y = v.subtract(_), + b = v.add(_), + E = a.x.Cross(y, b); + for ( + b = a.x.Cross(E, y), E.normalize(), b.normalize(), i = 0; + i < h; + i++ + ) { + var T = ((i % h) / h) * 2 * Math.PI, + A = -u * Math.cos(T), + x = u * Math.sin(T); + r.push(_.x + A * b.x + x * E.x), + r.push(_.y + A * b.y + x * E.y), + r.push(_.z + A * b.z + x * E.z), + s.push(t / l), + s.push(i / h); + } } - ; - var Qo = function() { - function e() {} - return e.CreateDisc = function(e, t, i) { - void 0 === i && (i = null); - var n = new me.a(e,i); - return t.sideOrientation = me.a._GetDefaultSideOrientation(t.sideOrientation), - n._originalBuilderSideOrientation = t.sideOrientation, - xi.a.CreateDisc(t).applyToMesh(n, t.updatable), - n - } - , - e - }(); - xi.a.CreateTorusKnot = function(e) { - var t, i, n = new Array, r = new Array, o = new Array, s = new Array, c = e.radius || 2, u = e.tube || .5, l = e.radialSegments || 32, h = e.tubularSegments || 32, f = e.p || 2, d = e.q || 3, p = 0 === e.sideOrientation ? 0 : e.sideOrientation || xi.a.DEFAULTSIDE, m = function(e) { - var t = Math.cos(e) - , i = Math.sin(e) - , n = d / f * e - , r = Math.cos(n) - , o = c * (2 + r) * .5 * t - , s = c * (2 + r) * i * .5 - , u = c * Math.sin(n) * .5; - return new a.x(o,s,u) - }; - for (t = 0; t <= l; t++) { - var g = t % l / l * 2 * f * Math.PI - , _ = m(g) - , v = m(g + .01) - , y = v.subtract(_) - , b = v.add(_) - , E = a.x.Cross(y, b); - for (b = a.x.Cross(E, y), - E.normalize(), - b.normalize(), - i = 0; i < h; i++) { - var T = i % h / h * 2 * Math.PI - , A = -u * Math.cos(T) - , x = u * Math.sin(T); - r.push(_.x + A * b.x + x * E.x), - r.push(_.y + A * b.y + x * E.y), - r.push(_.z + A * b.z + x * E.z), - s.push(t / l), - s.push(i / h) - } - } - for (t = 0; t < l; t++) - for (i = 0; i < h; i++) { - var S = (i + 1) % h - , C = t * h + i - , P = (t + 1) * h + i - , R = (t + 1) * h + S - , M = t * h + S; - n.push(M), - n.push(P), - n.push(C), - n.push(M), - n.push(R), - n.push(P) - } - xi.a.ComputeNormals(r, n, o), - xi.a._ComputeSides(p, r, n, o, s, e.frontUVs, e.backUVs); - var O = new xi.a; - return O.indices = n, - O.positions = r, - O.normals = o, - O.uvs = s, - O - } - , - me.a.CreateTorusKnot = function(e, t, i, n, r, o, a, s, c, u) { - var l = { - radius: t, - tube: i, - radialSegments: n, - tubularSegments: r, - p: o, - q: a, - sideOrientation: u, - updatable: c - }; - return qo.CreateTorusKnot(e, l, s) - } - ; - var qo = function() { - function e() {} - return e.CreateTorusKnot = function(e, t, i) { - var n = new me.a(e,i); - return t.sideOrientation = me.a._GetDefaultSideOrientation(t.sideOrientation), - n._originalBuilderSideOrientation = t.sideOrientation, + for (t = 0; t < l; t++) + for (i = 0; i < h; i++) { + var S = (i + 1) % h, + C = t * h + i, + P = (t + 1) * h + i, + R = (t + 1) * h + S, + M = t * h + S; + n.push(M), + n.push(P), + n.push(C), + n.push(M), + n.push(R), + n.push(P); + } + xi.a.ComputeNormals(r, n, o), + xi.a._ComputeSides(p, r, n, o, s, e.frontUVs, e.backUVs); + var O = new xi.a(); + return ( + (O.indices = n), + (O.positions = r), + (O.normals = o), + (O.uvs = s), + O + ); + }), + (me.a.CreateTorusKnot = function ( + e, + t, + i, + n, + r, + o, + a, + s, + c, + u + ) { + var l = { + radius: t, + tube: i, + radialSegments: n, + tubularSegments: r, + p: o, + q: a, + sideOrientation: u, + updatable: c, + }; + return qo.CreateTorusKnot(e, l, s); + }); + var qo = (function () { + function e() {} + return ( + (e.CreateTorusKnot = function (e, t, i) { + var n = new me.a(e, i); + return ( + (t.sideOrientation = me.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (n._originalBuilderSideOrientation = t.sideOrientation), xi.a.CreateTorusKnot(t).applyToMesh(n, t.updatable), n - } - , + ); + }), e - }() - , Zo = function(e) { - function t(t, i) { - var n = e.call(this, t.x, t.y) || this; - return n.index = i, - n - } - return h.d(t, e), - t - }(a.w) - , Jo = function() { - function e() { - this.elements = new Array - } - return e.prototype.add = function(e) { - var t = this - , i = new Array; - return e.forEach(function(e) { - if (0 === i.length || !e.equalsWithEpsilon(i[0])) { - var n = new Zo(e,t.elements.length); - i.push(n), - t.elements.push(n) - } + ); + })(), + Zo = (function (e) { + function t(t, i) { + var n = e.call(this, t.x, t.y) || this; + return (n.index = i), n; + } + return h.d(t, e), t; + })(a.w), + Jo = (function () { + function e() { + this.elements = new Array(); + } + return ( + (e.prototype.add = function (e) { + var t = this, + i = new Array(); + return ( + e.forEach(function (e) { + if (0 === i.length || !e.equalsWithEpsilon(i[0])) { + var n = new Zo(e, t.elements.length); + i.push(n), t.elements.push(n); + } }), i - } - , - e.prototype.computeBounds = function() { - var e = new a.w(this.elements[0].x,this.elements[0].y) - , t = new a.w(this.elements[0].x,this.elements[0].y); - return this.elements.forEach(function(i) { - i.x < e.x ? e.x = i.x : i.x > t.x && (t.x = i.x), - i.y < e.y ? e.y = i.y : i.y > t.y && (t.y = i.y) + ); + }), + (e.prototype.computeBounds = function () { + var e = new a.w(this.elements[0].x, this.elements[0].y), + t = new a.w(this.elements[0].x, this.elements[0].y); + return ( + this.elements.forEach(function (i) { + i.x < e.x ? (e.x = i.x) : i.x > t.x && (t.x = i.x), + i.y < e.y ? (e.y = i.y) : i.y > t.y && (t.y = i.y); }), { - min: e, - max: t, - width: t.x - e.x, - height: t.y - e.y + min: e, + max: t, + width: t.x - e.x, + height: t.y - e.y, } - } - , + ); + }), e - }() - , $o = function() { - function e() {} - return e.Rectangle = function(e, t, i, n) { - return [new a.w(e,t), new a.w(i,t), new a.w(i,n), new a.w(e,n)] - } - , - e.Circle = function(e, t, i, n) { - void 0 === t && (t = 0), + ); + })(), + $o = (function () { + function e() {} + return ( + (e.Rectangle = function (e, t, i, n) { + return [ + new a.w(e, t), + new a.w(i, t), + new a.w(i, n), + new a.w(e, n), + ]; + }), + (e.Circle = function (e, t, i, n) { + void 0 === t && (t = 0), void 0 === i && (i = 0), void 0 === n && (n = 32); - for (var r = new Array, o = 0, s = 2 * Math.PI / n, c = 0; c < n; c++) - r.push(new a.w(t + Math.cos(o) * e,i + Math.sin(o) * e)), - o -= s; - return r - } - , - e.Parse = function(e) { - var t, i = e.split(/[^-+eE\.\d]+/).map(parseFloat).filter(function(e) { - return !isNaN(e) - }), n = []; - for (t = 0; t < (2147483646 & i.length); t += 2) - n.push(new a.w(i[t],i[t + 1])); - return n - } - , - e.StartingAt = function(e, t) { - return a.l.StartingAt(e, t) - } - , + for ( + var r = new Array(), + o = 0, + s = (2 * Math.PI) / n, + c = 0; + c < n; + c++ + ) + r.push( + new a.w(t + Math.cos(o) * e, i + Math.sin(o) * e) + ), + (o -= s); + return r; + }), + (e.Parse = function (e) { + var t, + i = e + .split(/[^-+eE\.\d]+/) + .map(parseFloat) + .filter(function (e) { + return !isNaN(e); + }), + n = []; + for (t = 0; t < (2147483646 & i.length); t += 2) + n.push(new a.w(i[t], i[t + 1])); + return n; + }), + (e.StartingAt = function (e, t) { + return a.l.StartingAt(e, t); + }), e - }() - , ea = function() { - function e(e, t, i, n) { - var r; - void 0 === n && (n = earcut), - this._points = new Jo, - this._outlinepoints = new Jo, - this._holes = new Array, - this._epoints = new Array, - this._eholes = new Array, - this.bjsEarcut = n, - this._name = e, - this._scene = i || ve.b.LastCreatedScene, - r = t instanceof a.l ? t.getPoints() : t, - this._addToepoint(r), - this._points.add(r), - this._outlinepoints.add(r), - void 0 === this.bjsEarcut && g.a.Warn("Earcut was not found, the polygon will not be built.") - } - return e.prototype._addToepoint = function(e) { - for (var t = 0, i = e; t < i.length; t++) { - var n = i[t]; - this._epoints.push(n.x, n.y) - } - } - , - e.prototype.addHole = function(e) { - this._points.add(e); - var t = new Jo; - return t.add(e), + ); + })(), + ea = (function () { + function e(e, t, i, n) { + var r; + void 0 === n && (n = earcut), + (this._points = new Jo()), + (this._outlinepoints = new Jo()), + (this._holes = new Array()), + (this._epoints = new Array()), + (this._eholes = new Array()), + (this.bjsEarcut = n), + (this._name = e), + (this._scene = i || ve.b.LastCreatedScene), + (r = t instanceof a.l ? t.getPoints() : t), + this._addToepoint(r), + this._points.add(r), + this._outlinepoints.add(r), + void 0 === this.bjsEarcut && + g.a.Warn( + "Earcut was not found, the polygon will not be built." + ); + } + return ( + (e.prototype._addToepoint = function (e) { + for (var t = 0, i = e; t < i.length; t++) { + var n = i[t]; + this._epoints.push(n.x, n.y); + } + }), + (e.prototype.addHole = function (e) { + this._points.add(e); + var t = new Jo(); + return ( + t.add(e), this._holes.push(t), this._eholes.push(this._epoints.length / 2), this._addToepoint(e), this - } - , - e.prototype.build = function(e, t) { - void 0 === e && (e = false), - void 0 === t && (t = 0); - var i = new me.a(this._name,this._scene) - , n = this.buildVertexData(t); - return i.setVerticesData(Si.b.PositionKind, n.positions, e), + ); + }), + (e.prototype.build = function (e, t) { + void 0 === e && (e = false), void 0 === t && (t = 0); + var i = new me.a(this._name, this._scene), + n = this.buildVertexData(t); + return ( + i.setVerticesData(Si.b.PositionKind, n.positions, e), i.setVerticesData(Si.b.NormalKind, n.normals, e), i.setVerticesData(Si.b.UVKind, n.uvs, e), i.setIndices(n.indices), i - } - , - e.prototype.buildVertexData = function(e) { - var t = this; - void 0 === e && (e = 0); - var i = new xi.a - , n = new Array - , r = new Array - , o = new Array - , a = this._points.computeBounds(); - this._points.elements.forEach(function(e) { - n.push(0, 1, 0), - r.push(e.x, 0, e.y), - o.push((e.x - a.min.x) / a.width, (e.y - a.min.y) / a.height) + ); + }), + (e.prototype.buildVertexData = function (e) { + var t = this; + void 0 === e && (e = 0); + var i = new xi.a(), + n = new Array(), + r = new Array(), + o = new Array(), + a = this._points.computeBounds(); + this._points.elements.forEach(function (e) { + n.push(0, 1, 0), + r.push(e.x, 0, e.y), + o.push( + (e.x - a.min.x) / a.width, + (e.y - a.min.y) / a.height + ); + }); + for ( + var s = new Array(), + c = this.bjsEarcut(this._epoints, this._eholes, 2), + u = 0; + u < c.length; + u++ + ) + s.push(c[u]); + if (e > 0) { + var l = r.length / 3; + this._points.elements.forEach(function (t) { + n.push(0, -1, 0), + r.push(t.x, -e, t.y), + o.push( + 1 - (t.x - a.min.x) / a.width, + 1 - (t.y - a.min.y) / a.height + ); }); - for (var s = new Array, c = this.bjsEarcut(this._epoints, this._eholes, 2), u = 0; u < c.length; u++) - s.push(c[u]); - if (e > 0) { - var l = r.length / 3; - this._points.elements.forEach(function(t) { - n.push(0, -1, 0), - r.push(t.x, -e, t.y), - o.push(1 - (t.x - a.min.x) / a.width, 1 - (t.y - a.min.y) / a.height) - }); - var h = s.length; - for (u = 0; u < h; u += 3) { - var f = s[u + 0] - , d = s[u + 1] - , p = s[u + 2]; - s.push(p + l), - s.push(d + l), - s.push(f + l) - } - this.addSide(r, n, o, s, a, this._outlinepoints, e, false), - this._holes.forEach(function(i) { - t.addSide(r, n, o, s, a, i, e, true) - }) + var h = s.length; + for (u = 0; u < h; u += 3) { + var f = s[u + 0], + d = s[u + 1], + p = s[u + 2]; + s.push(p + l), s.push(d + l), s.push(f + l); } - return i.indices = s, - i.positions = r, - i.normals = n, - i.uvs = o, + this.addSide( + r, + n, + o, + s, + a, + this._outlinepoints, + e, + false + ), + this._holes.forEach(function (i) { + t.addSide(r, n, o, s, a, i, e, true); + }); + } + return ( + (i.indices = s), + (i.positions = r), + (i.normals = n), + (i.uvs = o), i - } - , - e.prototype.addSide = function(e, t, i, n, r, o, s, c) { - for (var u = e.length / 3, l = 0, h = 0; h < o.elements.length; h++) { - var f, d = o.elements[h]; - f = h + 1 > o.elements.length - 1 ? o.elements[0] : o.elements[h + 1], - e.push(d.x, 0, d.y), - e.push(d.x, -s, d.y), - e.push(f.x, 0, f.y), - e.push(f.x, -s, f.y); - var p = new a.x(d.x,0,d.y) - , m = new a.x(f.x,0,f.y).subtract(p) - , g = new a.x(0,1,0) - , _ = a.x.Cross(m, g); - _ = _.normalize(), - i.push(l / r.width, 0), - i.push(l / r.width, 1), - l += m.length(), - i.push(l / r.width, 0), - i.push(l / r.width, 1), - c ? (t.push(_.x, _.y, _.z), - t.push(_.x, _.y, _.z), - t.push(_.x, _.y, _.z), - t.push(_.x, _.y, _.z), - n.push(u), - n.push(u + 2), - n.push(u + 1), - n.push(u + 1), - n.push(u + 2), - n.push(u + 3)) : (t.push(-_.x, -_.y, -_.z), - t.push(-_.x, -_.y, -_.z), - t.push(-_.x, -_.y, -_.z), - t.push(-_.x, -_.y, -_.z), - n.push(u), - n.push(u + 1), - n.push(u + 2), - n.push(u + 1), - n.push(u + 3), - n.push(u + 2)), - u += 4 - } - } - , + ); + }), + (e.prototype.addSide = function (e, t, i, n, r, o, s, c) { + for ( + var u = e.length / 3, l = 0, h = 0; + h < o.elements.length; + h++ + ) { + var f, + d = o.elements[h]; + (f = + h + 1 > o.elements.length - 1 + ? o.elements[0] + : o.elements[h + 1]), + e.push(d.x, 0, d.y), + e.push(d.x, -s, d.y), + e.push(f.x, 0, f.y), + e.push(f.x, -s, f.y); + var p = new a.x(d.x, 0, d.y), + m = new a.x(f.x, 0, f.y).subtract(p), + g = new a.x(0, 1, 0), + _ = a.x.Cross(m, g); + (_ = _.normalize()), + i.push(l / r.width, 0), + i.push(l / r.width, 1), + (l += m.length()), + i.push(l / r.width, 0), + i.push(l / r.width, 1), + c + ? (t.push(_.x, _.y, _.z), + t.push(_.x, _.y, _.z), + t.push(_.x, _.y, _.z), + t.push(_.x, _.y, _.z), + n.push(u), + n.push(u + 2), + n.push(u + 1), + n.push(u + 1), + n.push(u + 2), + n.push(u + 3)) + : (t.push(-_.x, -_.y, -_.z), + t.push(-_.x, -_.y, -_.z), + t.push(-_.x, -_.y, -_.z), + t.push(-_.x, -_.y, -_.z), + n.push(u), + n.push(u + 1), + n.push(u + 2), + n.push(u + 1), + n.push(u + 3), + n.push(u + 2)), + (u += 4); + } + }), e - }(); - xi.a.CreatePolygon = function(e, t, i, n, r, o) { - for (var s = i || new Array(3), c = n, u = [], l = 0; l < 3; l++) - void 0 === s[l] && (s[l] = new a.y(0,0,1,1)), - c && void 0 === c[l] && (c[l] = new a.f(1,1,1,1)); - for (var h = e.getVerticesData(Si.b.PositionKind), f = e.getVerticesData(Si.b.NormalKind), d = e.getVerticesData(Si.b.UVKind), p = e.getIndices(), m = 0, g = 0, _ = 0; _ < f.length; _ += 3) - Math.abs(f[_ + 1]) < .001 && (g = 1), - Math.abs(f[_ + 1] - 1) < .001 && (g = 0), - Math.abs(f[_ + 1] + 1) < .001 && (g = 2), - d[2 * (m = _ / 3)] = (1 - d[2 * m]) * s[g].x + d[2 * m] * s[g].z, - d[2 * m + 1] = (1 - d[2 * m + 1]) * s[g].y + d[2 * m + 1] * s[g].w, - c && u.push(c[g].r, c[g].g, c[g].b, c[g].a); - xi.a._ComputeSides(t, h, p, f, d, r, o); - var v = new xi.a; - if (v.indices = p, - v.positions = h, - v.normals = f, - v.uvs = d, - c) { - var y = t === xi.a.DOUBLESIDE ? u.concat(u) : u; - v.colors = y + ); + })(); + (xi.a.CreatePolygon = function (e, t, i, n, r, o) { + for ( + var s = i || new Array(3), c = n, u = [], l = 0; + l < 3; + l++ + ) + void 0 === s[l] && (s[l] = new a.y(0, 0, 1, 1)), + c && void 0 === c[l] && (c[l] = new a.f(1, 1, 1, 1)); + for ( + var h = e.getVerticesData(Si.b.PositionKind), + f = e.getVerticesData(Si.b.NormalKind), + d = e.getVerticesData(Si.b.UVKind), + p = e.getIndices(), + m = 0, + g = 0, + _ = 0; + _ < f.length; + _ += 3 + ) + Math.abs(f[_ + 1]) < 0.001 && (g = 1), + Math.abs(f[_ + 1] - 1) < 0.001 && (g = 0), + Math.abs(f[_ + 1] + 1) < 0.001 && (g = 2), + (d[2 * (m = _ / 3)] = + (1 - d[2 * m]) * s[g].x + d[2 * m] * s[g].z), + (d[2 * m + 1] = + (1 - d[2 * m + 1]) * s[g].y + d[2 * m + 1] * s[g].w), + c && u.push(c[g].r, c[g].g, c[g].b, c[g].a); + xi.a._ComputeSides(t, h, p, f, d, r, o); + var v = new xi.a(); + if ( + ((v.indices = p), + (v.positions = h), + (v.normals = f), + (v.uvs = d), + c) + ) { + var y = t === xi.a.DOUBLESIDE ? u.concat(u) : u; + v.colors = y; + } + return v; + }), + (me.a.CreatePolygon = function (e, t, i, n, r, o, a) { + void 0 === a && (a = earcut); + var s = { + shape: t, + holes: n, + updatable: r, + sideOrientation: o, + }; + return ta.CreatePolygon(e, s, i, a); + }), + (me.a.ExtrudePolygon = function (e, t, i, n, r, o, a, s) { + void 0 === s && (s = earcut); + var c = { + shape: t, + holes: r, + depth: i, + updatable: o, + sideOrientation: a, + }; + return ta.ExtrudePolygon(e, c, n, s); + }); + var ta = (function () { + function e() {} + return ( + (e.CreatePolygon = function (e, t, i, n) { + void 0 === i && (i = null), + void 0 === n && (n = earcut), + (t.sideOrientation = me.a._GetDefaultSideOrientation( + t.sideOrientation + )); + for ( + var r = t.shape, + o = t.holes || [], + s = t.depth || 0, + c = [], + u = [], + l = 0; + l < r.length; + l++ + ) + c[l] = new a.w(r[l].x, r[l].z); + c[0].equalsWithEpsilon(c[c.length - 1], 1e-8) && c.pop(); + for ( + var h = new ea(e, c, i || R.a.LastCreatedScene, n), f = 0; + f < o.length; + f++ + ) { + u = []; + for (var d = 0; d < o[f].length; d++) + u.push(new a.w(o[f][d].x, o[f][d].z)); + h.addHole(u); } - return v - } - , - me.a.CreatePolygon = function(e, t, i, n, r, o, a) { - void 0 === a && (a = earcut); - var s = { - shape: t, - holes: n, - updatable: r, - sideOrientation: o - }; - return ta.CreatePolygon(e, s, i, a) - } - , - me.a.ExtrudePolygon = function(e, t, i, n, r, o, a, s) { - void 0 === s && (s = earcut); - var c = { - shape: t, - holes: r, - depth: i, - updatable: o, - sideOrientation: a - }; - return ta.ExtrudePolygon(e, c, n, s) - } - ; - var ta = function() { - function e() {} - return e.CreatePolygon = function(e, t, i, n) { - void 0 === i && (i = null), - void 0 === n && (n = earcut), - t.sideOrientation = me.a._GetDefaultSideOrientation(t.sideOrientation); - for (var r = t.shape, o = t.holes || [], s = t.depth || 0, c = [], u = [], l = 0; l < r.length; l++) - c[l] = new a.w(r[l].x,r[l].z); - c[0].equalsWithEpsilon(c[c.length - 1], 1e-8) && c.pop(); - for (var h = new ea(e,c,i || R.a.LastCreatedScene,n), f = 0; f < o.length; f++) { - u = []; - for (var d = 0; d < o[f].length; d++) - u.push(new a.w(o[f][d].x,o[f][d].z)); - h.addHole(u) + var p = h.build(t.updatable, s); + return ( + (p._originalBuilderSideOrientation = t.sideOrientation), + xi.a + .CreatePolygon( + p, + t.sideOrientation, + t.faceUV, + t.faceColors, + t.frontUVs, + t.backUVs + ) + .applyToMesh(p, t.updatable), + p + ); + }), + (e.ExtrudePolygon = function (t, i, n, r) { + return ( + void 0 === n && (n = null), + void 0 === r && (r = earcut), + e.CreatePolygon(t, i, n, r) + ); + }), + e + ); + })(); + me.a.CreateLathe = function (e, t, i, n, r, o, a) { + var s = { + shape: t, + radius: i, + tessellation: n, + sideOrientation: a, + updatable: o, + }; + return ia.CreateLathe(e, s, r); + }; + var ia = (function () { + function e() {} + return ( + (e.CreateLathe = function (e, t, i) { + void 0 === i && (i = null); + var n, + r = t.arc ? (t.arc <= 0 || t.arc > 1 ? 1 : t.arc) : 1, + o = void 0 === t.closed || t.closed, + s = t.shape, + c = t.radius || 1, + u = t.tessellation || 64, + l = t.clip || 0, + h = t.updatable, + f = me.a._GetDefaultSideOrientation(t.sideOrientation), + d = t.cap || me.a.NO_CAP, + p = 2 * Math.PI, + m = new Array(), + g = t.invertUV || false, + _ = 0, + v = 0, + y = (p / u) * r, + b = new Array(); + for (_ = 0; _ <= u - l; _++) { + for ( + b = [], + (d != me.a.CAP_START && d != me.a.CAP_ALL) || + (b.push(new a.x(0, s[0].y, 0)), + b.push( + new a.x( + Math.cos(_ * y) * s[0].x * c, + s[0].y, + Math.sin(_ * y) * s[0].x * c + ) + )), + v = 0; + v < s.length; + v++ + ) + (n = new a.x( + Math.cos(_ * y) * s[v].x * c, + s[v].y, + Math.sin(_ * y) * s[v].x * c + )), + b.push(n); + (d != me.a.CAP_END && d != me.a.CAP_ALL) || + (b.push( + new a.x( + Math.cos(_ * y) * s[s.length - 1].x * c, + s[s.length - 1].y, + Math.sin(_ * y) * s[s.length - 1].x * c + ) + ), + b.push(new a.x(0, s[s.length - 1].y, 0))), + m.push(b); + } + return no.CreateRibbon( + e, + { + pathArray: m, + closeArray: o, + sideOrientation: f, + updatable: h, + invertUV: g, + frontUVs: t.frontUVs, + backUVs: t.backUVs, + }, + i + ); + }), + e + ); + })(); + me.a.CreateTube = function (e, t, i, n, r, o, a, s, c, u) { + var l = { + path: t, + radius: i, + tessellation: n, + radiusFunction: r, + arc: 1, + cap: o, + updatable: s, + sideOrientation: c, + instance: u, + }; + return na.CreateTube(e, l, a); + }; + var na = (function () { + function e() {} + return ( + (e.CreateTube = function (e, t, i) { + void 0 === i && (i = null); + var n = t.path, + r = t.instance, + o = 1; + void 0 !== t.radius + ? (o = t.radius) + : r && (o = r._creationDataStorage.radius); + var s = t.tessellation || 64, + c = t.radiusFunction || null, + u = t.cap || me.a.NO_CAP, + l = t.invertUV || false, + h = t.updatable, + f = me.a._GetDefaultSideOrientation(t.sideOrientation); + t.arc = t.arc && (t.arc <= 0 || t.arc > 1) ? 1 : t.arc || 1; + var d, + p, + m = function (e, t, i, n, r, o, s, c) { + for ( + var u, + l, + h, + f, + d = t.getTangents(), + p = t.getNormals(), + m = t.getDistances(), + g = ((2 * Math.PI) / r) * c, + _ = + o || + function () { + return n; + }, + v = a.t.Matrix[0], + y = s === me.a.NO_CAP || s === me.a.CAP_END ? 0 : 2, + b = 0; + b < e.length; + b++ + ) { + (l = _(b, m[b])), (u = Array()), (h = p[b]); + for (var E = 0; E < r; E++) + a.j.RotationAxisToRef(d[b], g * E, v), + (f = u[E] ? u[E] : a.x.Zero()), + a.x.TransformCoordinatesToRef(h, v, f), + f.scaleInPlace(l).addInPlace(e[b]), + (u[E] = f); + (i[y] = u), y++; } - var p = h.build(t.updatable, s); - return p._originalBuilderSideOrientation = t.sideOrientation, - xi.a.CreatePolygon(p, t.sideOrientation, t.faceUV, t.faceColors, t.frontUVs, t.backUVs).applyToMesh(p, t.updatable), - p - } - , - e.ExtrudePolygon = function(t, i, n, r) { - return void 0 === n && (n = null), - void 0 === r && (r = earcut), - e.CreatePolygon(t, i, n, r) - } - , - e - }(); - me.a.CreateLathe = function(e, t, i, n, r, o, a) { - var s = { - shape: t, - radius: i, - tessellation: n, - sideOrientation: a, - updatable: o - }; - return ia.CreateLathe(e, s, r) - } - ; - var ia = function() { - function e() {} - return e.CreateLathe = function(e, t, i) { - void 0 === i && (i = null); - var n, r = t.arc ? t.arc <= 0 || t.arc > 1 ? 1 : t.arc : 1, o = void 0 === t.closed || t.closed, s = t.shape, c = t.radius || 1, u = t.tessellation || 64, l = t.clip || 0, h = t.updatable, f = me.a._GetDefaultSideOrientation(t.sideOrientation), d = t.cap || me.a.NO_CAP, p = 2 * Math.PI, m = new Array, g = t.invertUV || false, _ = 0, v = 0, y = p / u * r, b = new Array; - for (_ = 0; _ <= u - l; _++) { - for (b = [], - d != me.a.CAP_START && d != me.a.CAP_ALL || (b.push(new a.x(0,s[0].y,0)), - b.push(new a.x(Math.cos(_ * y) * s[0].x * c,s[0].y,Math.sin(_ * y) * s[0].x * c))), - v = 0; v < s.length; v++) - n = new a.x(Math.cos(_ * y) * s[v].x * c,s[v].y,Math.sin(_ * y) * s[v].x * c), - b.push(n); - d != me.a.CAP_END && d != me.a.CAP_ALL || (b.push(new a.x(Math.cos(_ * y) * s[s.length - 1].x * c,s[s.length - 1].y,Math.sin(_ * y) * s[s.length - 1].x * c)), - b.push(new a.x(0,s[s.length - 1].y,0))), - m.push(b) - } - return no.CreateRibbon(e, { - pathArray: m, - closeArray: o, - sideOrientation: f, - updatable: h, - invertUV: g, - frontUVs: t.frontUVs, - backUVs: t.backUVs - }, i) - } - , - e - }(); - me.a.CreateTube = function(e, t, i, n, r, o, a, s, c, u) { - var l = { - path: t, - radius: i, - tessellation: n, - radiusFunction: r, - arc: 1, - cap: o, - updatable: s, - sideOrientation: c, - instance: u - }; - return na.CreateTube(e, l, a) - } - ; - var na = function() { - function e() {} - return e.CreateTube = function(e, t, i) { - void 0 === i && (i = null); - var n = t.path - , r = t.instance - , o = 1; - void 0 !== t.radius ? o = t.radius : r && (o = r._creationDataStorage.radius); - var s = t.tessellation || 64 - , c = t.radiusFunction || null - , u = t.cap || me.a.NO_CAP - , l = t.invertUV || false - , h = t.updatable - , f = me.a._GetDefaultSideOrientation(t.sideOrientation); - t.arc = t.arc && (t.arc <= 0 || t.arc > 1) ? 1 : t.arc || 1; - var d, p, m = function(e, t, i, n, r, o, s, c) { - for (var u, l, h, f, d = t.getTangents(), p = t.getNormals(), m = t.getDistances(), g = 2 * Math.PI / r * c, _ = o || function() { - return n - } - , v = a.t.Matrix[0], y = s === me.a.NO_CAP || s === me.a.CAP_END ? 0 : 2, b = 0; b < e.length; b++) { - l = _(b, m[b]), - u = Array(), - h = p[b]; - for (var E = 0; E < r; E++) - a.j.RotationAxisToRef(d[b], g * E, v), - f = u[E] ? u[E] : a.x.Zero(), - a.x.TransformCoordinatesToRef(h, v, f), - f.scaleInPlace(l).addInPlace(e[b]), - u[E] = f; - i[y] = u, - y++ - } - var T = function(t, i) { - for (var n = Array(), r = 0; r < t; r++) - n.push(e[i]); - return n - }; - switch (s) { - case me.a.NO_CAP: - break; - case me.a.CAP_START: - i[0] = T(r, 0), - i[1] = i[2].slice(0); - break; - case me.a.CAP_END: - i[y] = i[y - 1].slice(0), - i[y + 1] = T(r, e.length - 1); - break; - case me.a.CAP_ALL: - i[0] = T(r, 0), - i[1] = i[2].slice(0), - i[y] = i[y - 1].slice(0), - i[y + 1] = T(r, e.length - 1) - } - return i + var T = function (t, i) { + for (var n = Array(), r = 0; r < t; r++) n.push(e[i]); + return n; }; - if (r) { - var g = r._creationDataStorage - , _ = t.arc || g.arc; - return p = m(n, d = g.path3D.update(n), g.pathArray, o, g.tessellation, c, g.cap, _), - r = no.CreateRibbon("", { - pathArray: p, - instance: r - }), - g.path3D = d, - g.pathArray = p, - g.arc = _, - g.radius = o, - r + switch (s) { + case me.a.NO_CAP: + break; + case me.a.CAP_START: + (i[0] = T(r, 0)), (i[1] = i[2].slice(0)); + break; + case me.a.CAP_END: + (i[y] = i[y - 1].slice(0)), + (i[y + 1] = T(r, e.length - 1)); + break; + case me.a.CAP_ALL: + (i[0] = T(r, 0)), + (i[1] = i[2].slice(0)), + (i[y] = i[y - 1].slice(0)), + (i[y + 1] = T(r, e.length - 1)); } - p = m(n, d = new a.m(n), new Array, o, s, c, u = u < 0 || u > 3 ? 0 : u, t.arc); - var v = no.CreateRibbon(e, { - pathArray: p, - closePath: true, - closeArray: false, - updatable: h, - sideOrientation: f, - invertUV: l, - frontUVs: t.frontUVs, - backUVs: t.backUVs - }, i); - return v._creationDataStorage.pathArray = p, - v._creationDataStorage.path3D = d, - v._creationDataStorage.tessellation = s, - v._creationDataStorage.cap = u, - v._creationDataStorage.arc = t.arc, - v._creationDataStorage.radius = o, - v + return i; + }; + if (r) { + var g = r._creationDataStorage, + _ = t.arc || g.arc; + return ( + (p = m( + n, + (d = g.path3D.update(n)), + g.pathArray, + o, + g.tessellation, + c, + g.cap, + _ + )), + (r = no.CreateRibbon("", { + pathArray: p, + instance: r, + })), + (g.path3D = d), + (g.pathArray = p), + (g.arc = _), + (g.radius = o), + r + ); } - , - e - }(); - xi.a.CreateIcoSphere = function(e) { - var t, i = e.sideOrientation || xi.a.DEFAULTSIDE, n = e.radius || 1, r = void 0 === e.flat || e.flat, o = e.subdivisions || 4, s = e.radiusX || n, c = e.radiusY || n, u = e.radiusZ || n, l = (1 + Math.sqrt(5)) / 2, h = [-1, l, -0, 1, l, 0, -1, -l, 0, 1, -l, 0, 0, -1, -l, 0, 1, -l, 0, -1, l, 0, 1, l, l, 0, 1, l, 0, -1, -l, 0, 1, -l, 0, -1], f = [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 12, 22, 23, 1, 5, 20, 5, 11, 4, 23, 22, 13, 22, 18, 6, 7, 1, 8, 14, 21, 4, 14, 4, 2, 16, 13, 6, 15, 6, 19, 3, 8, 9, 4, 21, 5, 13, 17, 23, 6, 13, 22, 19, 6, 18, 9, 8, 1], d = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 2, 3, 3, 3, 4, 7, 8, 9, 9, 10, 11], p = [5, 1, 3, 1, 6, 4, 0, 0, 5, 3, 4, 2, 2, 2, 4, 0, 2, 0, 1, 1, 6, 0, 6, 2, 0, 4, 3, 3, 4, 4, 3, 1, 4, 2, 4, 4, 0, 2, 1, 1, 2, 2, 3, 3, 1, 3, 2, 4], m = [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0], g = new Array, _ = new Array, v = new Array, y = new Array, b = 0, E = new Array(3), T = new Array(3); - for (t = 0; t < 3; t++) - E[t] = a.x.Zero(), - T[t] = a.w.Zero(); - for (var A = 0; A < 20; A++) { - for (t = 0; t < 3; t++) { - var x = f[3 * A + t]; - E[t].copyFromFloats(h[3 * d[x]], h[3 * d[x] + 1], h[3 * d[x] + 2]), - E[t].normalize().scaleInPlace(n), - T[t].copyFromFloats(p[2 * x] * (138 / 1024) + 60 / 1024 + m[A] * (-40 / 1024), p[2 * x + 1] * (239 / 1024) + 26 / 1024 + m[A] * (20 / 1024)) - } - for (var S = function(e, t, i, n) { - var l, h = a.x.Lerp(E[0], E[2], t / o), f = a.x.Lerp(E[1], E[2], t / o), d = o === t ? E[2] : a.x.Lerp(h, f, e / (o - t)); - if (d.normalize(), - r) { - var p = a.x.Lerp(E[0], E[2], n / o) - , m = a.x.Lerp(E[1], E[2], n / o); - l = a.x.Lerp(p, m, i / (o - n)) - } else - l = new a.x(d.x,d.y,d.z); - l.x /= s, - l.y /= c, - l.z /= u, - l.normalize(); - var A = a.w.Lerp(T[0], T[2], t / o) - , x = a.w.Lerp(T[1], T[2], t / o) - , S = o === t ? T[2] : a.w.Lerp(A, x, e / (o - t)); - _.push(d.x * s, d.y * c, d.z * u), - v.push(l.x, l.y, l.z), - y.push(S.x, S.y), - g.push(b), - b++ - }, C = 0; C < o; C++) - for (var P = 0; P + C < o; P++) - S(P, C, P + 1 / 3, C + 1 / 3), - S(P + 1, C, P + 1 / 3, C + 1 / 3), - S(P, C + 1, P + 1 / 3, C + 1 / 3), - P + C + 1 < o && (S(P + 1, C, P + 2 / 3, C + 2 / 3), - S(P + 1, C + 1, P + 2 / 3, C + 2 / 3), - S(P, C + 1, P + 2 / 3, C + 2 / 3)) - } - xi.a._ComputeSides(i, _, g, v, y, e.frontUVs, e.backUVs); - var R = new xi.a; - return R.indices = g, - R.positions = _, - R.normals = v, - R.uvs = y, - R + p = m( + n, + (d = new a.m(n)), + new Array(), + o, + s, + c, + (u = u < 0 || u > 3 ? 0 : u), + t.arc + ); + var v = no.CreateRibbon( + e, + { + pathArray: p, + closePath: true, + closeArray: false, + updatable: h, + sideOrientation: f, + invertUV: l, + frontUVs: t.frontUVs, + backUVs: t.backUVs, + }, + i + ); + return ( + (v._creationDataStorage.pathArray = p), + (v._creationDataStorage.path3D = d), + (v._creationDataStorage.tessellation = s), + (v._creationDataStorage.cap = u), + (v._creationDataStorage.arc = t.arc), + (v._creationDataStorage.radius = o), + v + ); + }), + e + ); + })(); + (xi.a.CreateIcoSphere = function (e) { + var t, + i = e.sideOrientation || xi.a.DEFAULTSIDE, + n = e.radius || 1, + r = void 0 === e.flat || e.flat, + o = e.subdivisions || 4, + s = e.radiusX || n, + c = e.radiusY || n, + u = e.radiusZ || n, + l = (1 + Math.sqrt(5)) / 2, + h = [ + -1, + l, + -0, + 1, + l, + 0, + -1, + -l, + 0, + 1, + -l, + 0, + 0, + -1, + -l, + 0, + 1, + -l, + 0, + -1, + l, + 0, + 1, + l, + l, + 0, + 1, + l, + 0, + -1, + -l, + 0, + 1, + -l, + 0, + -1, + ], + f = [ + 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 12, 22, 23, 1, 5, 20, + 5, 11, 4, 23, 22, 13, 22, 18, 6, 7, 1, 8, 14, 21, 4, 14, 4, + 2, 16, 13, 6, 15, 6, 19, 3, 8, 9, 4, 21, 5, 13, 17, 23, 6, + 13, 22, 19, 6, 18, 9, 8, 1, + ], + d = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 2, 3, 3, 3, 4, 7, + 8, 9, 9, 10, 11, + ], + p = [ + 5, 1, 3, 1, 6, 4, 0, 0, 5, 3, 4, 2, 2, 2, 4, 0, 2, 0, 1, 1, + 6, 0, 6, 2, 0, 4, 3, 3, 4, 4, 3, 1, 4, 2, 4, 4, 0, 2, 1, 1, + 2, 2, 3, 3, 1, 3, 2, 4, + ], + m = [ + 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, + ], + g = new Array(), + _ = new Array(), + v = new Array(), + y = new Array(), + b = 0, + E = new Array(3), + T = new Array(3); + for (t = 0; t < 3; t++) + (E[t] = a.x.Zero()), (T[t] = a.w.Zero()); + for (var A = 0; A < 20; A++) { + for (t = 0; t < 3; t++) { + var x = f[3 * A + t]; + E[t].copyFromFloats( + h[3 * d[x]], + h[3 * d[x] + 1], + h[3 * d[x] + 2] + ), + E[t].normalize().scaleInPlace(n), + T[t].copyFromFloats( + p[2 * x] * (138 / 1024) + + 60 / 1024 + + m[A] * (-40 / 1024), + p[2 * x + 1] * (239 / 1024) + + 26 / 1024 + + m[A] * (20 / 1024) + ); + } + for ( + var S = function (e, t, i, n) { + var l, + h = a.x.Lerp(E[0], E[2], t / o), + f = a.x.Lerp(E[1], E[2], t / o), + d = o === t ? E[2] : a.x.Lerp(h, f, e / (o - t)); + if ((d.normalize(), r)) { + var p = a.x.Lerp(E[0], E[2], n / o), + m = a.x.Lerp(E[1], E[2], n / o); + l = a.x.Lerp(p, m, i / (o - n)); + } else l = new a.x(d.x, d.y, d.z); + (l.x /= s), (l.y /= c), (l.z /= u), l.normalize(); + var A = a.w.Lerp(T[0], T[2], t / o), + x = a.w.Lerp(T[1], T[2], t / o), + S = o === t ? T[2] : a.w.Lerp(A, x, e / (o - t)); + _.push(d.x * s, d.y * c, d.z * u), + v.push(l.x, l.y, l.z), + y.push(S.x, S.y), + g.push(b), + b++; + }, + C = 0; + C < o; + C++ + ) + for (var P = 0; P + C < o; P++) + S(P, C, P + 1 / 3, C + 1 / 3), + S(P + 1, C, P + 1 / 3, C + 1 / 3), + S(P, C + 1, P + 1 / 3, C + 1 / 3), + P + C + 1 < o && + (S(P + 1, C, P + 2 / 3, C + 2 / 3), + S(P + 1, C + 1, P + 2 / 3, C + 2 / 3), + S(P, C + 1, P + 2 / 3, C + 2 / 3)); } - , - me.a.CreateIcoSphere = function(e, t, i) { - return ra.CreateIcoSphere(e, t, i) - } - ; - var ra = function() { - function e() {} - return e.CreateIcoSphere = function(e, t, i) { - void 0 === i && (i = null); - var n = new me.a(e,i); - return t.sideOrientation = me.a._GetDefaultSideOrientation(t.sideOrientation), - n._originalBuilderSideOrientation = t.sideOrientation, - xi.a.CreateIcoSphere(t).applyToMesh(n, t.updatable), - n - } - , - e - }(); - me.a.CreateDecal = function(e, t, i, n, r, o) { - var a = { - position: i, - normal: n, - size: r, - angle: o - }; - return aa.CreateDecal(e, t, a) - } - ; - var oa, aa = function() { - function e() {} - return e.CreateDecal = function(e, t, i) { - var n = t.getIndices() - , r = t.getVerticesData(Si.b.PositionKind) - , o = t.getVerticesData(Si.b.NormalKind) - , s = i.position || a.x.Zero() - , c = i.normal || a.x.Up() - , u = i.size || a.x.One() - , l = i.angle || 0; - if (!c) { - var h = new a.x(0,0,1) - , f = t.getScene().activeCamera - , d = a.x.TransformCoordinates(h, f.getWorldMatrix()); - c = f.globalPosition.subtract(d) - } - var p = -Math.atan2(c.z, c.x) - Math.PI / 2 - , m = Math.sqrt(c.x * c.x + c.z * c.z) - , g = Math.atan2(c.y, m) - , _ = a.j.RotationYawPitchRoll(p, g, l).multiply(a.j.Translation(s.x, s.y, s.z)) - , v = a.j.Invert(_) - , y = t.getWorldMatrix().multiply(v) - , b = new xi.a; - b.indices = [], - b.positions = [], - b.normals = [], - b.uvs = []; - for (var E = 0, T = function(e) { - var t = new a.p; - if (!n || !r || !o) - return t; + xi.a._ComputeSides(i, _, g, v, y, e.frontUVs, e.backUVs); + var R = new xi.a(); + return ( + (R.indices = g), + (R.positions = _), + (R.normals = v), + (R.uvs = y), + R + ); + }), + (me.a.CreateIcoSphere = function (e, t, i) { + return ra.CreateIcoSphere(e, t, i); + }); + var ra = (function () { + function e() {} + return ( + (e.CreateIcoSphere = function (e, t, i) { + void 0 === i && (i = null); + var n = new me.a(e, i); + return ( + (t.sideOrientation = me.a._GetDefaultSideOrientation( + t.sideOrientation + )), + (n._originalBuilderSideOrientation = t.sideOrientation), + xi.a.CreateIcoSphere(t).applyToMesh(n, t.updatable), + n + ); + }), + e + ); + })(); + me.a.CreateDecal = function (e, t, i, n, r, o) { + var a = { + position: i, + normal: n, + size: r, + angle: o, + }; + return aa.CreateDecal(e, t, a); + }; + var oa, + aa = (function () { + function e() {} + return ( + (e.CreateDecal = function (e, t, i) { + var n = t.getIndices(), + r = t.getVerticesData(Si.b.PositionKind), + o = t.getVerticesData(Si.b.NormalKind), + s = i.position || a.x.Zero(), + c = i.normal || a.x.Up(), + u = i.size || a.x.One(), + l = i.angle || 0; + if (!c) { + var h = new a.x(0, 0, 1), + f = t.getScene().activeCamera, + d = a.x.TransformCoordinates(h, f.getWorldMatrix()); + c = f.globalPosition.subtract(d); + } + var p = -Math.atan2(c.z, c.x) - Math.PI / 2, + m = Math.sqrt(c.x * c.x + c.z * c.z), + g = Math.atan2(c.y, m), + _ = a.j + .RotationYawPitchRoll(p, g, l) + .multiply(a.j.Translation(s.x, s.y, s.z)), + v = a.j.Invert(_), + y = t.getWorldMatrix().multiply(v), + b = new xi.a(); + (b.indices = []), + (b.positions = []), + (b.normals = []), + (b.uvs = []); + for ( + var E = 0, + T = function (e) { + var t = new a.p(); + if (!n || !r || !o) return t; var i = n[e]; - return t.position = new a.x(r[3 * i],r[3 * i + 1],r[3 * i + 2]), - t.position = a.x.TransformCoordinates(t.position, y), - t.normal = new a.x(o[3 * i],o[3 * i + 1],o[3 * i + 2]), - t.normal = a.x.TransformNormal(t.normal, y), - t - }, A = function(e, t) { - if (0 === e.length) - return e; - for (var i = .5 * Math.abs(a.x.Dot(u, t)), n = function(e, n) { - var r = a.x.GetClipFactor(e.position, n.position, t, i); - return new a.p(a.x.Lerp(e.position, n.position, r),a.x.Lerp(e.normal, n.normal, r)) - }, r = new Array, o = 0; o < e.length; o += 3) { - var s, c, l, h = null, f = null, d = null, p = null; - switch (((s = a.x.Dot(e[o].position, t) - i > 0) ? 1 : 0) + ((c = a.x.Dot(e[o + 1].position, t) - i > 0) ? 1 : 0) + ((l = a.x.Dot(e[o + 2].position, t) - i > 0) ? 1 : 0)) { + return ( + (t.position = new a.x( + r[3 * i], + r[3 * i + 1], + r[3 * i + 2] + )), + (t.position = a.x.TransformCoordinates( + t.position, + y + )), + (t.normal = new a.x( + o[3 * i], + o[3 * i + 1], + o[3 * i + 2] + )), + (t.normal = a.x.TransformNormal(t.normal, y)), + t + ); + }, + A = function (e, t) { + if (0 === e.length) return e; + for ( + var i = 0.5 * Math.abs(a.x.Dot(u, t)), + n = function (e, n) { + var r = a.x.GetClipFactor( + e.position, + n.position, + t, + i + ); + return new a.p( + a.x.Lerp(e.position, n.position, r), + a.x.Lerp(e.normal, n.normal, r) + ); + }, + r = new Array(), + o = 0; + o < e.length; + o += 3 + ) { + var s, + c, + l, + h = null, + f = null, + d = null, + p = null; + switch ( + ((s = a.x.Dot(e[o].position, t) - i > 0) + ? 1 + : 0) + + ((c = a.x.Dot(e[o + 1].position, t) - i > 0) + ? 1 + : 0) + + ((l = a.x.Dot(e[o + 2].position, t) - i > 0) + ? 1 + : 0) + ) { case 0: - r.push(e[o]), + r.push(e[o]), r.push(e[o + 1]), r.push(e[o + 2]); - break; + break; case 1: - if (s && (h = e[o + 1], - f = e[o + 2], - d = n(e[o], h), - p = n(e[o], f)), - c) { - h = e[o], - f = e[o + 2], - d = n(e[o + 1], h), - p = n(e[o + 1], f), - r.push(d), - r.push(f.clone()), - r.push(h.clone()), - r.push(f.clone()), - r.push(d.clone()), - r.push(p); - break - } - l && (h = e[o], - f = e[o + 1], - d = n(e[o + 2], h), - p = n(e[o + 2], f)), - h && f && d && p && (r.push(h.clone()), - r.push(f.clone()), - r.push(d), - r.push(p), - r.push(d.clone()), - r.push(f.clone())); + if ( + (s && + ((h = e[o + 1]), + (f = e[o + 2]), + (d = n(e[o], h)), + (p = n(e[o], f))), + c) + ) { + (h = e[o]), + (f = e[o + 2]), + (d = n(e[o + 1], h)), + (p = n(e[o + 1], f)), + r.push(d), + r.push(f.clone()), + r.push(h.clone()), + r.push(f.clone()), + r.push(d.clone()), + r.push(p); break; + } + l && + ((h = e[o]), + (f = e[o + 1]), + (d = n(e[o + 2], h)), + (p = n(e[o + 2], f))), + h && + f && + d && + p && + (r.push(h.clone()), + r.push(f.clone()), + r.push(d), + r.push(p), + r.push(d.clone()), + r.push(f.clone())); + break; case 2: - s || (f = n(h = e[o].clone(), e[o + 1]), - d = n(h, e[o + 2]), + s || + ((f = n((h = e[o].clone()), e[o + 1])), + (d = n(h, e[o + 2])), r.push(h), r.push(f), r.push(d)), - c || (f = n(h = e[o + 1].clone(), e[o + 2]), - d = n(h, e[o]), - r.push(h), - r.push(f), - r.push(d)), - l || (f = n(h = e[o + 2].clone(), e[o]), - d = n(h, e[o + 1]), - r.push(h), - r.push(f), - r.push(d)) - } + c || + ((f = n( + (h = e[o + 1].clone()), + e[o + 2] + )), + (d = n(h, e[o])), + r.push(h), + r.push(f), + r.push(d)), + l || + ((f = n((h = e[o + 2].clone()), e[o])), + (d = n(h, e[o + 1])), + r.push(h), + r.push(f), + r.push(d)); + } } - return r - }, x = 0; x < n.length; x += 3) { - var S = new Array; - if (S.push(T(x)), - S.push(T(x + 1)), - S.push(T(x + 2)), - S = A(S, new a.x(1,0,0)), - S = A(S, new a.x(-1,0,0)), - S = A(S, new a.x(0,1,0)), - S = A(S, new a.x(0,-1,0)), - S = A(S, new a.x(0,0,1)), - 0 !== (S = A(S, new a.x(0,0,-1))).length) - for (var C = 0; C < S.length; C++) { - var P = S[C]; - b.indices.push(E), - P.position.toArray(b.positions, 3 * E), - P.normal.toArray(b.normals, 3 * E), - b.uvs.push(.5 + P.position.x / u.x), - b.uvs.push(.5 + P.position.y / u.y), - E++ - } - } - var R = new me.a(e,t.getScene()); - return b.applyToMesh(R), - R.position = s.clone(), - R.rotation = new a.x(g,p,l), + return r; + }, + x = 0; + x < n.length; + x += 3 + ) { + var S = new Array(); + if ( + (S.push(T(x)), + S.push(T(x + 1)), + S.push(T(x + 2)), + (S = A(S, new a.x(1, 0, 0))), + (S = A(S, new a.x(-1, 0, 0))), + (S = A(S, new a.x(0, 1, 0))), + (S = A(S, new a.x(0, -1, 0))), + (S = A(S, new a.x(0, 0, 1))), + 0 !== (S = A(S, new a.x(0, 0, -1))).length) + ) + for (var C = 0; C < S.length; C++) { + var P = S[C]; + b.indices.push(E), + P.position.toArray(b.positions, 3 * E), + P.normal.toArray(b.normals, 3 * E), + b.uvs.push(0.5 + P.position.x / u.x), + b.uvs.push(0.5 + P.position.y / u.y), + E++; + } + } + var R = new me.a(e, t.getScene()); + return ( + b.applyToMesh(R), + (R.position = s.clone()), + (R.rotation = new a.x(g, p, l)), R - } - , + ); + }), e - }(), sa = function() { - function e() {} - return e.CreateBox = function(e, t, i) { - return void 0 === i && (i = null), - xn.a.CreateBox(e, t, i) - } - , - e.CreateSphere = function(e, t, i) { - return void 0 === i && (i = null), - Rn.a.CreateSphere(e, t, i) - } - , - e.CreateDisc = function(e, t, i) { - return void 0 === i && (i = null), - Qo.CreateDisc(e, t, i) - } - , - e.CreateIcoSphere = function(e, t, i) { - return void 0 === i && (i = null), - ra.CreateIcoSphere(e, t, i) - } - , - e.CreateRibbon = function(e, t, i) { - return void 0 === i && (i = null), - no.CreateRibbon(e, t, i) - } - , - e.CreateCylinder = function(e, t, i) { - return void 0 === i && (i = null), - Oi.a.CreateCylinder(e, t, i) - } - , - e.CreateTorus = function(e, t, i) { - return void 0 === i && (i = null), - Mi.CreateTorus(e, t, i) - } - , - e.CreateTorusKnot = function(e, t, i) { - return void 0 === i && (i = null), - qo.CreateTorusKnot(e, t, i) - } - , - e.CreateLineSystem = function(e, t, i) { - return Mn.a.CreateLineSystem(e, t, i) - } - , - e.CreateLines = function(e, t, i) { - return void 0 === i && (i = null), - Mn.a.CreateLines(e, t, i) - } - , - e.CreateDashedLines = function(e, t, i) { - return void 0 === i && (i = null), + ); + })(), + sa = (function () { + function e() {} + return ( + (e.CreateBox = function (e, t, i) { + return ( + void 0 === i && (i = null), xn.a.CreateBox(e, t, i) + ); + }), + (e.CreateSphere = function (e, t, i) { + return ( + void 0 === i && (i = null), Rn.a.CreateSphere(e, t, i) + ); + }), + (e.CreateDisc = function (e, t, i) { + return void 0 === i && (i = null), Qo.CreateDisc(e, t, i); + }), + (e.CreateIcoSphere = function (e, t, i) { + return ( + void 0 === i && (i = null), ra.CreateIcoSphere(e, t, i) + ); + }), + (e.CreateRibbon = function (e, t, i) { + return ( + void 0 === i && (i = null), no.CreateRibbon(e, t, i) + ); + }), + (e.CreateCylinder = function (e, t, i) { + return ( + void 0 === i && (i = null), Oi.a.CreateCylinder(e, t, i) + ); + }), + (e.CreateTorus = function (e, t, i) { + return ( + void 0 === i && (i = null), Mi.CreateTorus(e, t, i) + ); + }), + (e.CreateTorusKnot = function (e, t, i) { + return ( + void 0 === i && (i = null), qo.CreateTorusKnot(e, t, i) + ); + }), + (e.CreateLineSystem = function (e, t, i) { + return Mn.a.CreateLineSystem(e, t, i); + }), + (e.CreateLines = function (e, t, i) { + return ( + void 0 === i && (i = null), Mn.a.CreateLines(e, t, i) + ); + }), + (e.CreateDashedLines = function (e, t, i) { + return ( + void 0 === i && (i = null), Mn.a.CreateDashedLines(e, t, i) - } - , - e.ExtrudeShape = function(e, t, i) { - return void 0 === i && (i = null), - ro.ExtrudeShape(e, t, i) - } - , - e.ExtrudeShapeCustom = function(e, t, i) { - return void 0 === i && (i = null), + ); + }), + (e.ExtrudeShape = function (e, t, i) { + return ( + void 0 === i && (i = null), ro.ExtrudeShape(e, t, i) + ); + }), + (e.ExtrudeShapeCustom = function (e, t, i) { + return ( + void 0 === i && (i = null), ro.ExtrudeShapeCustom(e, t, i) - } - , - e.CreateLathe = function(e, t, i) { - return void 0 === i && (i = null), - ia.CreateLathe(e, t, i) - } - , - e.CreatePlane = function(e, t, i) { - return void 0 === i && (i = null), - $n.a.CreatePlane(e, t, i) - } - , - e.CreateGround = function(e, t, i) { - return void 0 === i && (i = null), - Pi.CreateGround(e, t, i) - } - , - e.CreateTiledGround = function(e, t, i) { - return void 0 === i && (i = null), + ); + }), + (e.CreateLathe = function (e, t, i) { + return ( + void 0 === i && (i = null), ia.CreateLathe(e, t, i) + ); + }), + (e.CreatePlane = function (e, t, i) { + return ( + void 0 === i && (i = null), $n.a.CreatePlane(e, t, i) + ); + }), + (e.CreateGround = function (e, t, i) { + return ( + void 0 === i && (i = null), Pi.CreateGround(e, t, i) + ); + }), + (e.CreateTiledGround = function (e, t, i) { + return ( + void 0 === i && (i = null), Pi.CreateTiledGround(e, t, i) - } - , - e.CreateGroundFromHeightMap = function(e, t, i, n) { - return void 0 === n && (n = null), + ); + }), + (e.CreateGroundFromHeightMap = function (e, t, i, n) { + return ( + void 0 === n && (n = null), Pi.CreateGroundFromHeightMap(e, t, i, n) - } - , - e.CreatePolygon = function(e, t, i, n) { - return void 0 === i && (i = null), + ); + }), + (e.CreatePolygon = function (e, t, i, n) { + return ( + void 0 === i && (i = null), void 0 === n && (n = earcut), ta.CreatePolygon(e, t, i, n) - } - , - e.ExtrudePolygon = function(e, t, i, n) { - return void 0 === i && (i = null), + ); + }), + (e.ExtrudePolygon = function (e, t, i, n) { + return ( + void 0 === i && (i = null), void 0 === n && (n = earcut), ta.ExtrudePolygon(e, t, i, n) - } - , - e.CreateTube = function(e, t, i) { - return void 0 === i && (i = null), - na.CreateTube(e, t, i) - } - , - e.CreatePolyhedron = function(e, t, i) { - return void 0 === i && (i = null), - Ln.CreatePolyhedron(e, t, i) - } - , - e.CreateDecal = function(e, t, i) { - return aa.CreateDecal(e, t, i) - } - , + ); + }), + (e.CreateTube = function (e, t, i) { + return void 0 === i && (i = null), na.CreateTube(e, t, i); + }), + (e.CreatePolyhedron = function (e, t, i) { + return ( + void 0 === i && (i = null), Ln.CreatePolyhedron(e, t, i) + ); + }), + (e.CreateDecal = function (e, t, i) { + return aa.CreateDecal(e, t, i); + }), e - }(), ca = function(e, t, i) { - this.quality = e, - this.distance = t, - this.optimizeMesh = i - }, ua = function() { - function e() { - this.running = false, - this._simplificationArray = [] - } - return e.prototype.addTask = function(e) { - this._simplificationArray.push(e) - } - , - e.prototype.executeNext = function() { - var e = this._simplificationArray.pop(); - e ? (this.running = true, - this.runSimplification(e)) : this.running = false - } - , - e.prototype.runSimplification = function(e) { - var t = this; - if (e.parallelProcessing) - e.settings.forEach(function(i) { - t.getSimplifier(e).simplify(i, function(n) { - e.mesh.addLODLevel(i.distance, n), - n.isVisible = true, - i.quality === e.settings[e.settings.length - 1].quality && e.successCallback && e.successCallback(), - t.executeNext() - }) - }); - else { - var i = this.getSimplifier(e); - Ee.a.Run(e.settings.length, function(t) { - var n, r; - n = e.settings[t.index], - r = function() { - t.executeNext() - } - , - i.simplify(n, function(t) { - e.mesh.addLODLevel(n.distance, t), - t.isVisible = true, - r() - }) - }, function() { - e.successCallback && e.successCallback(), - t.executeNext() - }) - } - } - , - e.prototype.getSimplifier = function(e) { - switch (e.simplificationType) { + ); + })(), + ca = function (e, t, i) { + (this.quality = e), + (this.distance = t), + (this.optimizeMesh = i); + }, + ua = (function () { + function e() { + (this.running = false), (this._simplificationArray = []); + } + return ( + (e.prototype.addTask = function (e) { + this._simplificationArray.push(e); + }), + (e.prototype.executeNext = function () { + var e = this._simplificationArray.pop(); + e + ? ((this.running = true), this.runSimplification(e)) + : (this.running = false); + }), + (e.prototype.runSimplification = function (e) { + var t = this; + if (e.parallelProcessing) + e.settings.forEach(function (i) { + t.getSimplifier(e).simplify(i, function (n) { + e.mesh.addLODLevel(i.distance, n), + (n.isVisible = true), + i.quality === + e.settings[e.settings.length - 1].quality && + e.successCallback && + e.successCallback(), + t.executeNext(); + }); + }); + else { + var i = this.getSimplifier(e); + Ee.a.Run( + e.settings.length, + function (t) { + var n, r; + (n = e.settings[t.index]), + (r = function () { + t.executeNext(); + }), + i.simplify(n, function (t) { + e.mesh.addLODLevel(n.distance, t), + (t.isVisible = true), + r(); + }); + }, + function () { + e.successCallback && e.successCallback(), + t.executeNext(); + } + ); + } + }), + (e.prototype.getSimplifier = function (e) { + switch (e.simplificationType) { case oa.QUADRATIC: default: - return new pa(e.mesh) - } - } - , + return new pa(e.mesh); + } + }), e - }(); - !function(e) { - e[e.QUADRATIC = 0] = "QUADRATIC" - }(oa || (oa = {})); - var la = function(e) { - this.vertices = e, - this.error = new Array(4), - this.deleted = false, - this.isDirty = false, - this.deletePending = false, - this.borderFactor = 0 - } - , ha = function() { - function e(e, t) { - this.position = e, - this.id = t, - this.isBorder = true, - this.q = new fa, - this.triangleCount = 0, - this.triangleStart = 0, - this.originalOffsets = [] - } - return e.prototype.updatePosition = function(e) { - this.position.copyFrom(e) - } - , + ); + })(); + !(function (e) { + e[(e.QUADRATIC = 0)] = "QUADRATIC"; + })(oa || (oa = {})); + var la = function (e) { + (this.vertices = e), + (this.error = new Array(4)), + (this.deleted = false), + (this.isDirty = false), + (this.deletePending = false), + (this.borderFactor = 0); + }, + ha = (function () { + function e(e, t) { + (this.position = e), + (this.id = t), + (this.isBorder = true), + (this.q = new fa()), + (this.triangleCount = 0), + (this.triangleStart = 0), + (this.originalOffsets = []); + } + return ( + (e.prototype.updatePosition = function (e) { + this.position.copyFrom(e); + }), e - }() - , fa = function() { - function e(e) { - this.data = new Array(10); - for (var t = 0; t < 10; ++t) - e && e[t] ? this.data[t] = e[t] : this.data[t] = 0 - } - return e.prototype.det = function(e, t, i, n, r, o, a, s, c) { - return this.data[e] * this.data[r] * this.data[c] + this.data[i] * this.data[n] * this.data[s] + this.data[t] * this.data[o] * this.data[a] - this.data[i] * this.data[r] * this.data[a] - this.data[e] * this.data[o] * this.data[s] - this.data[t] * this.data[n] * this.data[c] - } - , - e.prototype.addInPlace = function(e) { - for (var t = 0; t < 10; ++t) - this.data[t] += e.data[t] - } - , - e.prototype.addArrayInPlace = function(e) { - for (var t = 0; t < 10; ++t) - this.data[t] += e[t] - } - , - e.prototype.add = function(t) { - for (var i = new e, n = 0; n < 10; ++n) - i.data[n] = this.data[n] + t.data[n]; - return i - } - , - e.FromData = function(t, i, n, r) { - return new e(e.DataFromNumbers(t, i, n, r)) - } - , - e.DataFromNumbers = function(e, t, i, n) { - return [e * e, e * t, e * i, e * n, t * t, t * i, t * n, i * i, i * n, n * n] - } - , + ); + })(), + fa = (function () { + function e(e) { + this.data = new Array(10); + for (var t = 0; t < 10; ++t) + e && e[t] ? (this.data[t] = e[t]) : (this.data[t] = 0); + } + return ( + (e.prototype.det = function (e, t, i, n, r, o, a, s, c) { + return ( + this.data[e] * this.data[r] * this.data[c] + + this.data[i] * this.data[n] * this.data[s] + + this.data[t] * this.data[o] * this.data[a] - + this.data[i] * this.data[r] * this.data[a] - + this.data[e] * this.data[o] * this.data[s] - + this.data[t] * this.data[n] * this.data[c] + ); + }), + (e.prototype.addInPlace = function (e) { + for (var t = 0; t < 10; ++t) this.data[t] += e.data[t]; + }), + (e.prototype.addArrayInPlace = function (e) { + for (var t = 0; t < 10; ++t) this.data[t] += e[t]; + }), + (e.prototype.add = function (t) { + for (var i = new e(), n = 0; n < 10; ++n) + i.data[n] = this.data[n] + t.data[n]; + return i; + }), + (e.FromData = function (t, i, n, r) { + return new e(e.DataFromNumbers(t, i, n, r)); + }), + (e.DataFromNumbers = function (e, t, i, n) { + return [ + e * e, + e * t, + e * i, + e * n, + t * t, + t * i, + t * n, + i * i, + i * n, + n * n, + ]; + }), e - }() - , da = function(e, t) { - this.vertexId = e, - this.triangleId = t - } - , pa = function() { - function e(e) { - this._mesh = e, - this.syncIterations = 5e3, - this.aggressiveness = 7, - this.decimationIterations = 100, - this.boundingBoxEpsilon = a.h - } - return e.prototype.simplify = function(e, t) { - var i = this; - this.initDecimatedMesh(), - Ee.a.Run(this._mesh.subMeshes.length, function(t) { - i.initWithMesh(t.index, function() { - i.runDecimation(e, t.index, function() { - t.executeNext() - }) - }, e.optimizeMesh) - }, function() { - setTimeout(function() { - t(i._reconstructedMesh) - }, 0) - }) - } - , - e.prototype.runDecimation = function(e, t, i) { - var n = this - , r = ~~(this.triangles.length * e.quality) - , o = 0 - , s = this.triangles.length; - Ee.a.Run(this.decimationIterations, function(e) { - var t, i; - s - o <= r ? e.breakLoop() : (t = e.index, - i = function() { - e.executeNext() - } - , - setTimeout(function() { + ); + })(), + da = function (e, t) { + (this.vertexId = e), (this.triangleId = t); + }, + pa = (function () { + function e(e) { + (this._mesh = e), + (this.syncIterations = 5e3), + (this.aggressiveness = 7), + (this.decimationIterations = 100), + (this.boundingBoxEpsilon = a.h); + } + return ( + (e.prototype.simplify = function (e, t) { + var i = this; + this.initDecimatedMesh(), + Ee.a.Run( + this._mesh.subMeshes.length, + function (t) { + i.initWithMesh( + t.index, + function () { + i.runDecimation(e, t.index, function () { + t.executeNext(); + }); + }, + e.optimizeMesh + ); + }, + function () { + setTimeout(function () { + t(i._reconstructedMesh); + }, 0); + } + ); + }), + (e.prototype.runDecimation = function (e, t, i) { + var n = this, + r = ~~(this.triangles.length * e.quality), + o = 0, + s = this.triangles.length; + Ee.a.Run( + this.decimationIterations, + function (e) { + var t, i; + s - o <= r + ? e.breakLoop() + : ((t = e.index), + (i = function () { + e.executeNext(); + }), + setTimeout(function () { t % 5 == 0 && n.updateMesh(0 === t); for (var e = 0; e < n.triangles.length; ++e) - n.triangles[e].isDirty = false; - var c = 1e-9 * Math.pow(t + 3, n.aggressiveness); - Ee.a.SyncAsyncForLoop(n.triangles.length, n.syncIterations, function(e) { - var t = ~~((n.triangles.length / 2 + e) % n.triangles.length) - , i = n.triangles[t]; - if (i && !(i.error[3] > c || i.deleted || i.isDirty)) - for (var r = 0; r < 3; ++r) - if (i.error[r] < c) { - var s = [] - , u = [] - , l = i.vertices[r] - , h = i.vertices[(r + 1) % 3]; - if (l.isBorder || h.isBorder) - continue; - var f = a.x.Zero(); - n.calculateError(l, h, f); - var d = new Array; - if (n.isFlipped(l, h, f, s, d)) - continue; - if (n.isFlipped(h, l, f, u, d)) - continue; - if (s.indexOf(true) < 0 || u.indexOf(true) < 0) - continue; - var p = new Array; - if (d.forEach(function(e) { - -1 === p.indexOf(e) && (e.deletePending = true, - p.push(e)) - }), - p.length % 2 != 0) - continue; - l.q = h.q.add(l.q), - l.updatePosition(f); - var m = n.references.length; - o = n.updateTriangles(l, l, s, o), - o = n.updateTriangles(l, h, u, o); - var g = n.references.length - m; - if (g <= l.triangleCount) { - if (g) - for (var _ = 0; _ < g; _++) - n.references[l.triangleStart + _] = n.references[m + _] - } else - l.triangleStart = m; - l.triangleCount = g; - break - } - }, i, function() { - return s - o <= r - }) - }, 0)) - }, function() { - setTimeout(function() { - n.reconstructMesh(t), - i() - }, 0) - }) - } - , - e.prototype.initWithMesh = function(e, t, i) { - var n = this; - this.vertices = [], - this.triangles = []; - var r = this._mesh.getVerticesData(Si.b.PositionKind) - , o = this._mesh.getIndices() - , s = this._mesh.subMeshes[e] - , c = [] - , u = s.verticesCount; - Ee.a.SyncAsyncForLoop(u, this.syncIterations / 4 >> 0, function(e) { - if (r) { - var t = e + s.verticesStart - , o = a.x.FromArray(r, 3 * t) - , u = function(e) { - if (i) - for (var t = 0; t < n.vertices.length; ++t) - if (n.vertices[t].position.equals(e)) - return n.vertices[t]; - return null - }(o) || new ha(o,n.vertices.length); - u.originalOffsets.push(t), - u.id === n.vertices.length && n.vertices.push(u), - c.push(u.id) + n.triangles[e].isDirty = false; + var c = + 1e-9 * Math.pow(t + 3, n.aggressiveness); + Ee.a.SyncAsyncForLoop( + n.triangles.length, + n.syncIterations, + function (e) { + var t = ~~( + (n.triangles.length / 2 + e) % + n.triangles.length + ), + i = n.triangles[t]; + if ( + i && + !( + i.error[3] > c || + i.deleted || + i.isDirty + ) + ) + for (var r = 0; r < 3; ++r) + if (i.error[r] < c) { + var s = [], + u = [], + l = i.vertices[r], + h = i.vertices[(r + 1) % 3]; + if (l.isBorder || h.isBorder) + continue; + var f = a.x.Zero(); + n.calculateError(l, h, f); + var d = new Array(); + if (n.isFlipped(l, h, f, s, d)) + continue; + if (n.isFlipped(h, l, f, u, d)) + continue; + if ( + s.indexOf(true) < 0 || + u.indexOf(true) < 0 + ) + continue; + var p = new Array(); + if ( + (d.forEach(function (e) { + -1 === p.indexOf(e) && + ((e.deletePending = true), + p.push(e)); + }), + p.length % 2 != 0) + ) + continue; + (l.q = h.q.add(l.q)), + l.updatePosition(f); + var m = n.references.length; + (o = n.updateTriangles(l, l, s, o)), + (o = n.updateTriangles(l, h, u, o)); + var g = n.references.length - m; + if (g <= l.triangleCount) { + if (g) + for (var _ = 0; _ < g; _++) + n.references[ + l.triangleStart + _ + ] = n.references[m + _]; + } else l.triangleStart = m; + l.triangleCount = g; + break; + } + }, + i, + function () { + return s - o <= r; + } + ); + }, 0)); + }, + function () { + setTimeout(function () { + n.reconstructMesh(t), i(); + }, 0); + } + ); + }), + (e.prototype.initWithMesh = function (e, t, i) { + var n = this; + (this.vertices = []), (this.triangles = []); + var r = this._mesh.getVerticesData(Si.b.PositionKind), + o = this._mesh.getIndices(), + s = this._mesh.subMeshes[e], + c = [], + u = s.verticesCount; + Ee.a.SyncAsyncForLoop( + u, + (this.syncIterations / 4) >> 0, + function (e) { + if (r) { + var t = e + s.verticesStart, + o = a.x.FromArray(r, 3 * t), + u = + (function (e) { + if (i) + for (var t = 0; t < n.vertices.length; ++t) + if (n.vertices[t].position.equals(e)) + return n.vertices[t]; + return null; + })(o) || new ha(o, n.vertices.length); + u.originalOffsets.push(t), + u.id === n.vertices.length && n.vertices.push(u), + c.push(u.id); + } + }, + function () { + Ee.a.SyncAsyncForLoop( + s.indexCount / 3, + n.syncIterations, + function (e) { + if (o) { + var t = 3 * (s.indexStart / 3 + e), + i = o[t + 0], + r = o[t + 1], + a = o[t + 2], + u = n.vertices[c[i - s.verticesStart]], + l = n.vertices[c[r - s.verticesStart]], + h = n.vertices[c[a - s.verticesStart]], + f = new la([u, l, h]); + (f.originalOffset = t), n.triangles.push(f); + } + }, + function () { + n.init(t); } - }, function() { - Ee.a.SyncAsyncForLoop(s.indexCount / 3, n.syncIterations, function(e) { - if (o) { - var t = 3 * (s.indexStart / 3 + e) - , i = o[t + 0] - , r = o[t + 1] - , a = o[t + 2] - , u = n.vertices[c[i - s.verticesStart]] - , l = n.vertices[c[r - s.verticesStart]] - , h = n.vertices[c[a - s.verticesStart]] - , f = new la([u, l, h]); - f.originalOffset = t, - n.triangles.push(f) - } - }, function() { - n.init(t) - }) - }) - } - , - e.prototype.init = function(e) { - var t = this; - Ee.a.SyncAsyncForLoop(this.triangles.length, this.syncIterations, function(e) { - var i = t.triangles[e]; - i.normal = a.x.Cross(i.vertices[1].position.subtract(i.vertices[0].position), i.vertices[2].position.subtract(i.vertices[0].position)).normalize(); - for (var n = 0; n < 3; n++) - i.vertices[n].q.addArrayInPlace(fa.DataFromNumbers(i.normal.x, i.normal.y, i.normal.z, -a.x.Dot(i.normal, i.vertices[0].position))) - }, function() { - Ee.a.SyncAsyncForLoop(t.triangles.length, t.syncIterations, function(e) { - for (var i = t.triangles[e], n = 0; n < 3; ++n) - i.error[n] = t.calculateError(i.vertices[n], i.vertices[(n + 1) % 3]); - i.error[3] = Math.min(i.error[0], i.error[1], i.error[2]) - }, function() { - e() - }) - }) - } - , - e.prototype.reconstructMesh = function(e) { - var t, i, n, r = []; - for (t = 0; t < this.vertices.length; ++t) - this.vertices[t].triangleCount = 0; - for (t = 0; t < this.triangles.length; ++t) - if (!this.triangles[t].deleted) { - for (i = this.triangles[t], - n = 0; n < 3; ++n) - i.vertices[n].triangleCount = 1; - r.push(i) + ); + } + ); + }), + (e.prototype.init = function (e) { + var t = this; + Ee.a.SyncAsyncForLoop( + this.triangles.length, + this.syncIterations, + function (e) { + var i = t.triangles[e]; + i.normal = a.x + .Cross( + i.vertices[1].position.subtract( + i.vertices[0].position + ), + i.vertices[2].position.subtract( + i.vertices[0].position + ) + ) + .normalize(); + for (var n = 0; n < 3; n++) + i.vertices[n].q.addArrayInPlace( + fa.DataFromNumbers( + i.normal.x, + i.normal.y, + i.normal.z, + -a.x.Dot(i.normal, i.vertices[0].position) + ) + ); + }, + function () { + Ee.a.SyncAsyncForLoop( + t.triangles.length, + t.syncIterations, + function (e) { + for (var i = t.triangles[e], n = 0; n < 3; ++n) + i.error[n] = t.calculateError( + i.vertices[n], + i.vertices[(n + 1) % 3] + ); + i.error[3] = Math.min( + i.error[0], + i.error[1], + i.error[2] + ); + }, + function () { + e(); } - var o = this._reconstructedMesh.getVerticesData(Si.b.PositionKind) || [] - , a = this._reconstructedMesh.getVerticesData(Si.b.NormalKind) || [] - , s = this._reconstructedMesh.getVerticesData(Si.b.UVKind) || [] - , c = this._reconstructedMesh.getVerticesData(Si.b.ColorKind) || [] - , u = this._mesh.getVerticesData(Si.b.NormalKind) - , l = this._mesh.getVerticesData(Si.b.UVKind) - , h = this._mesh.getVerticesData(Si.b.ColorKind) - , f = 0; - for (t = 0; t < this.vertices.length; ++t) { - var d = this.vertices[t]; - d.id = f, - d.triangleCount && d.originalOffsets.forEach(function(e) { - u && (o.push(d.position.x), + ); + } + ); + }), + (e.prototype.reconstructMesh = function (e) { + var t, + i, + n, + r = []; + for (t = 0; t < this.vertices.length; ++t) + this.vertices[t].triangleCount = 0; + for (t = 0; t < this.triangles.length; ++t) + if (!this.triangles[t].deleted) { + for (i = this.triangles[t], n = 0; n < 3; ++n) + i.vertices[n].triangleCount = 1; + r.push(i); + } + var o = + this._reconstructedMesh.getVerticesData( + Si.b.PositionKind + ) || [], + a = + this._reconstructedMesh.getVerticesData( + Si.b.NormalKind + ) || [], + s = + this._reconstructedMesh.getVerticesData( + Si.b.UVKind + ) || [], + c = + this._reconstructedMesh.getVerticesData( + Si.b.ColorKind + ) || [], + u = this._mesh.getVerticesData(Si.b.NormalKind), + l = this._mesh.getVerticesData(Si.b.UVKind), + h = this._mesh.getVerticesData(Si.b.ColorKind), + f = 0; + for (t = 0; t < this.vertices.length; ++t) { + var d = this.vertices[t]; + (d.id = f), + d.triangleCount && + d.originalOffsets.forEach(function (e) { + u && + (o.push(d.position.x), o.push(d.position.y), o.push(d.position.z), a.push(u[3 * e]), a.push(u[3 * e + 1]), a.push(u[3 * e + 2]), - l && l.length && (s.push(l[2 * e]), - s.push(l[2 * e + 1])), - h && h.length && (c.push(h[4 * e]), - c.push(h[4 * e + 1]), - c.push(h[4 * e + 2]), - c.push(h[4 * e + 3])), - ++f) - }) - } - var p = this._reconstructedMesh.getTotalIndices() - , m = this._reconstructedMesh.getTotalVertices() - , g = this._reconstructedMesh.subMeshes; - this._reconstructedMesh.subMeshes = []; - var _ = this._reconstructedMesh.getIndices() - , v = this._mesh.getIndices(); - for (t = 0; t < r.length; ++t) - i = r[t], - [0, 1, 2].forEach(function(e) { - var t = v[i.originalOffset + e] - , n = i.vertices[e].originalOffsets.indexOf(t); - n < 0 && (n = 0), - _.push(i.vertices[e].id + n + m) + l && + l.length && + (s.push(l[2 * e]), s.push(l[2 * e + 1])), + h && + h.length && + (c.push(h[4 * e]), + c.push(h[4 * e + 1]), + c.push(h[4 * e + 2]), + c.push(h[4 * e + 3])), + ++f); }); - this._reconstructedMesh.setIndices(_), - this._reconstructedMesh.setVerticesData(Si.b.PositionKind, o), - this._reconstructedMesh.setVerticesData(Si.b.NormalKind, a), - s.length > 0 && this._reconstructedMesh.setVerticesData(Si.b.UVKind, s), - c.length > 0 && this._reconstructedMesh.setVerticesData(Si.b.ColorKind, c); - var y = this._mesh.subMeshes[e]; - e > 0 && (this._reconstructedMesh.subMeshes = [], - g.forEach(function(e) { - Uo.b.AddToMesh(e.materialIndex, e.verticesStart, e.verticesCount, e.indexStart, e.indexCount, e.getMesh()) + } + var p = this._reconstructedMesh.getTotalIndices(), + m = this._reconstructedMesh.getTotalVertices(), + g = this._reconstructedMesh.subMeshes; + this._reconstructedMesh.subMeshes = []; + var _ = this._reconstructedMesh.getIndices(), + v = this._mesh.getIndices(); + for (t = 0; t < r.length; ++t) + (i = r[t]), + [0, 1, 2].forEach(function (e) { + var t = v[i.originalOffset + e], + n = i.vertices[e].originalOffsets.indexOf(t); + n < 0 && (n = 0), _.push(i.vertices[e].id + n + m); + }); + this._reconstructedMesh.setIndices(_), + this._reconstructedMesh.setVerticesData( + Si.b.PositionKind, + o + ), + this._reconstructedMesh.setVerticesData( + Si.b.NormalKind, + a + ), + s.length > 0 && + this._reconstructedMesh.setVerticesData( + Si.b.UVKind, + s + ), + c.length > 0 && + this._reconstructedMesh.setVerticesData( + Si.b.ColorKind, + c + ); + var y = this._mesh.subMeshes[e]; + e > 0 && + ((this._reconstructedMesh.subMeshes = []), + g.forEach(function (e) { + Uo.b.AddToMesh( + e.materialIndex, + e.verticesStart, + e.verticesCount, + e.indexStart, + e.indexCount, + e.getMesh() + ); }), - Uo.b.AddToMesh(y.materialIndex, m, f, p, 3 * r.length, this._reconstructedMesh)) - } - , - e.prototype.initDecimatedMesh = function() { - this._reconstructedMesh = new me.a(this._mesh.name + "Decimated",this._mesh.getScene()), - this._reconstructedMesh.material = this._mesh.material, - this._reconstructedMesh.parent = this._mesh.parent, - this._reconstructedMesh.isVisible = false, - this._reconstructedMesh.renderingGroupId = this._mesh.renderingGroupId - } - , - e.prototype.isFlipped = function(e, t, i, n, r) { - for (var o = 0; o < e.triangleCount; ++o) { - var s = this.triangles[this.references[e.triangleStart + o].triangleId]; - if (!s.deleted) { - var c = this.references[e.triangleStart + o].vertexId - , u = s.vertices[(c + 1) % 3] - , l = s.vertices[(c + 2) % 3]; - if (u !== t && l !== t) { - var h = u.position.subtract(i); - h = h.normalize(); - var f = l.position.subtract(i); - if (f = f.normalize(), - Math.abs(a.x.Dot(h, f)) > .999) - return true; - var d = a.x.Cross(h, f).normalize(); - if (n[o] = false, - a.x.Dot(d, s.normal) < .2) - return true - } else - n[o] = true, - r.push(s) - } + Uo.b.AddToMesh( + y.materialIndex, + m, + f, + p, + 3 * r.length, + this._reconstructedMesh + )); + }), + (e.prototype.initDecimatedMesh = function () { + (this._reconstructedMesh = new me.a( + this._mesh.name + "Decimated", + this._mesh.getScene() + )), + (this._reconstructedMesh.material = + this._mesh.material), + (this._reconstructedMesh.parent = this._mesh.parent), + (this._reconstructedMesh.isVisible = false), + (this._reconstructedMesh.renderingGroupId = + this._mesh.renderingGroupId); + }), + (e.prototype.isFlipped = function (e, t, i, n, r) { + for (var o = 0; o < e.triangleCount; ++o) { + var s = + this.triangles[ + this.references[e.triangleStart + o].triangleId + ]; + if (!s.deleted) { + var c = this.references[e.triangleStart + o].vertexId, + u = s.vertices[(c + 1) % 3], + l = s.vertices[(c + 2) % 3]; + if (u !== t && l !== t) { + var h = u.position.subtract(i); + h = h.normalize(); + var f = l.position.subtract(i); + if ( + ((f = f.normalize()), + Math.abs(a.x.Dot(h, f)) > 0.999) + ) + return true; + var d = a.x.Cross(h, f).normalize(); + if (((n[o] = false), a.x.Dot(d, s.normal) < 0.2)) + return true; + } else (n[o] = true), r.push(s); } - return false - } - , - e.prototype.updateTriangles = function(e, t, i, n) { - for (var r = n, o = 0; o < t.triangleCount; ++o) { - var a = this.references[t.triangleStart + o] - , s = this.triangles[a.triangleId]; - s.deleted || (i[o] && s.deletePending ? (s.deleted = true, - r++) : (s.vertices[a.vertexId] = e, - s.isDirty = true, - s.error[0] = this.calculateError(s.vertices[0], s.vertices[1]) + s.borderFactor / 2, - s.error[1] = this.calculateError(s.vertices[1], s.vertices[2]) + s.borderFactor / 2, - s.error[2] = this.calculateError(s.vertices[2], s.vertices[0]) + s.borderFactor / 2, - s.error[3] = Math.min(s.error[0], s.error[1], s.error[2]), - this.references.push(a))) - } - return r - } - , - e.prototype.identifyBorder = function() { - for (var e = 0; e < this.vertices.length; ++e) { - var t, i = [], n = [], r = this.vertices[e]; - for (t = 0; t < r.triangleCount; ++t) - for (var o = this.triangles[this.references[r.triangleStart + t].triangleId], a = 0; a < 3; a++) { - for (var s = 0, c = o.vertices[a]; s < i.length && n[s] !== c.id; ) - ++s; - s === i.length ? (i.push(1), - n.push(c.id)) : i[s]++ - } - for (t = 0; t < i.length; ++t) - 1 === i[t] ? this.vertices[n[t]].isBorder = true : this.vertices[n[t]].isBorder = false - } - } - , - e.prototype.updateMesh = function(e) { - var t, i, n, r; - if (void 0 === e && (e = false), - !e) { - var o = []; - for (t = 0; t < this.triangles.length; ++t) - this.triangles[t].deleted || o.push(this.triangles[t]); - this.triangles = o - } - for (t = 0; t < this.vertices.length; ++t) - this.vertices[t].triangleCount = 0, - this.vertices[t].triangleStart = 0; + } + return false; + }), + (e.prototype.updateTriangles = function (e, t, i, n) { + for (var r = n, o = 0; o < t.triangleCount; ++o) { + var a = this.references[t.triangleStart + o], + s = this.triangles[a.triangleId]; + s.deleted || + (i[o] && s.deletePending + ? ((s.deleted = true), r++) + : ((s.vertices[a.vertexId] = e), + (s.isDirty = true), + (s.error[0] = + this.calculateError( + s.vertices[0], + s.vertices[1] + ) + + s.borderFactor / 2), + (s.error[1] = + this.calculateError( + s.vertices[1], + s.vertices[2] + ) + + s.borderFactor / 2), + (s.error[2] = + this.calculateError( + s.vertices[2], + s.vertices[0] + ) + + s.borderFactor / 2), + (s.error[3] = Math.min( + s.error[0], + s.error[1], + s.error[2] + )), + this.references.push(a))); + } + return r; + }), + (e.prototype.identifyBorder = function () { + for (var e = 0; e < this.vertices.length; ++e) { + var t, + i = [], + n = [], + r = this.vertices[e]; + for (t = 0; t < r.triangleCount; ++t) + for ( + var o = + this.triangles[ + this.references[r.triangleStart + t] + .triangleId + ], + a = 0; + a < 3; + a++ + ) { + for ( + var s = 0, c = o.vertices[a]; + s < i.length && n[s] !== c.id; + + ) + ++s; + s === i.length ? (i.push(1), n.push(c.id)) : i[s]++; + } + for (t = 0; t < i.length; ++t) + 1 === i[t] + ? (this.vertices[n[t]].isBorder = true) + : (this.vertices[n[t]].isBorder = false); + } + }), + (e.prototype.updateMesh = function (e) { + var t, i, n, r; + if ((void 0 === e && (e = false), !e)) { + var o = []; for (t = 0; t < this.triangles.length; ++t) - for (i = this.triangles[t], - n = 0; n < 3; ++n) - (r = i.vertices[n]).triangleCount++; - var a = 0; - for (t = 0; t < this.vertices.length; ++t) - this.vertices[t].triangleStart = a, - a += this.vertices[t].triangleCount, - this.vertices[t].triangleCount = 0; - var s = new Array(3 * this.triangles.length); - for (t = 0; t < this.triangles.length; ++t) - for (i = this.triangles[t], - n = 0; n < 3; ++n) - s[(r = i.vertices[n]).triangleStart + r.triangleCount] = new da(n,t), - r.triangleCount++; - this.references = s, - e && this.identifyBorder() - } - , - e.prototype.vertexError = function(e, t) { - var i = t.x - , n = t.y - , r = t.z; - return e.data[0] * i * i + 2 * e.data[1] * i * n + 2 * e.data[2] * i * r + 2 * e.data[3] * i + e.data[4] * n * n + 2 * e.data[5] * n * r + 2 * e.data[6] * n + e.data[7] * r * r + 2 * e.data[8] * r + e.data[9] - } - , - e.prototype.calculateError = function(e, t, i) { - var n = e.q.add(t.q) - , r = e.isBorder && t.isBorder - , o = 0 - , s = n.det(0, 1, 2, 1, 4, 5, 2, 5, 7); - if (0 === s || r) { - var c = e.position.add(t.position).divide(new a.x(2,2,2)) - , u = this.vertexError(n, e.position) - , l = this.vertexError(n, t.position) - , h = this.vertexError(n, c); - (o = Math.min(u, l, h)) === u ? i && i.copyFrom(e.position) : o === l ? i && i.copyFrom(t.position) : i && i.copyFrom(c) - } else - i || (i = a.x.Zero()), - i.x = -1 / s * n.det(1, 2, 3, 4, 5, 6, 5, 7, 8), - i.y = 1 / s * n.det(0, 2, 3, 1, 5, 6, 2, 7, 8), - i.z = -1 / s * n.det(0, 1, 3, 1, 4, 6, 2, 5, 8), - o = this.vertexError(n, i); - return o - } - , + this.triangles[t].deleted || + o.push(this.triangles[t]); + this.triangles = o; + } + for (t = 0; t < this.vertices.length; ++t) + (this.vertices[t].triangleCount = 0), + (this.vertices[t].triangleStart = 0); + for (t = 0; t < this.triangles.length; ++t) + for (i = this.triangles[t], n = 0; n < 3; ++n) + (r = i.vertices[n]).triangleCount++; + var a = 0; + for (t = 0; t < this.vertices.length; ++t) + (this.vertices[t].triangleStart = a), + (a += this.vertices[t].triangleCount), + (this.vertices[t].triangleCount = 0); + var s = new Array(3 * this.triangles.length); + for (t = 0; t < this.triangles.length; ++t) + for (i = this.triangles[t], n = 0; n < 3; ++n) + (s[ + (r = i.vertices[n]).triangleStart + r.triangleCount + ] = new da(n, t)), + r.triangleCount++; + (this.references = s), e && this.identifyBorder(); + }), + (e.prototype.vertexError = function (e, t) { + var i = t.x, + n = t.y, + r = t.z; + return ( + e.data[0] * i * i + + 2 * e.data[1] * i * n + + 2 * e.data[2] * i * r + + 2 * e.data[3] * i + + e.data[4] * n * n + + 2 * e.data[5] * n * r + + 2 * e.data[6] * n + + e.data[7] * r * r + + 2 * e.data[8] * r + + e.data[9] + ); + }), + (e.prototype.calculateError = function (e, t, i) { + var n = e.q.add(t.q), + r = e.isBorder && t.isBorder, + o = 0, + s = n.det(0, 1, 2, 1, 4, 5, 2, 5, 7); + if (0 === s || r) { + var c = e.position + .add(t.position) + .divide(new a.x(2, 2, 2)), + u = this.vertexError(n, e.position), + l = this.vertexError(n, t.position), + h = this.vertexError(n, c); + (o = Math.min(u, l, h)) === u + ? i && i.copyFrom(e.position) + : o === l + ? i && i.copyFrom(t.position) + : i && i.copyFrom(c); + } else + i || (i = a.x.Zero()), + (i.x = (-1 / s) * n.det(1, 2, 3, 4, 5, 6, 5, 7, 8)), + (i.y = (1 / s) * n.det(0, 2, 3, 1, 5, 6, 2, 7, 8)), + (i.z = (-1 / s) * n.det(0, 1, 3, 1, 4, 6, 2, 5, 8)), + (o = this.vertexError(n, i)); + return o; + }), e - }(); - Object.defineProperty(Y.a.prototype, "simplificationQueue", { - get: function() { - if (!this._simplificationQueue) { - this._simplificationQueue = new ua; - var e = this._getComponent(Se.a.NAME_SIMPLIFICATIONQUEUE); - e || (e = new ma(this), - this._addComponent(e)) - } - return this._simplificationQueue - }, - set: function(e) { - this._simplificationQueue = e - }, - enumerable: true, - configurable: true - }), - me.a.prototype.simplify = function(e, t, i, n) { - return void 0 === t && (t = true), + ); + })(); + Object.defineProperty(Y.a.prototype, "simplificationQueue", { + get: function () { + if (!this._simplificationQueue) { + this._simplificationQueue = new ua(); + var e = this._getComponent(Se.a.NAME_SIMPLIFICATIONQUEUE); + e || ((e = new ma(this)), this._addComponent(e)); + } + return this._simplificationQueue; + }, + set: function (e) { + this._simplificationQueue = e; + }, + enumerable: true, + configurable: true, + }), + (me.a.prototype.simplify = function (e, t, i, n) { + return ( + void 0 === t && (t = true), void 0 === i && (i = oa.QUADRATIC), this.getScene().simplificationQueue.addTask({ - settings: e, - parallelProcessing: t, - mesh: this, - simplificationType: i, - successCallback: n + settings: e, + parallelProcessing: t, + mesh: this, + simplificationType: i, + successCallback: n, }), this - } - ; - var ma = function() { - function e(e) { - this.name = Se.a.NAME_SIMPLIFICATIONQUEUE, - this.scene = e - } - return e.prototype.register = function() { - this.scene._beforeCameraUpdateStage.registerStep(Se.a.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE, this, this._beforeCameraUpdate) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() {} - , - e.prototype._beforeCameraUpdate = function() { - this.scene._simplificationQueue && !this.scene._simplificationQueue.running && this.scene._simplificationQueue.executeNext() - } - , + ); + }); + var ma = (function () { + function e(e) { + (this.name = Se.a.NAME_SIMPLIFICATIONQUEUE), + (this.scene = e); + } + return ( + (e.prototype.register = function () { + this.scene._beforeCameraUpdateStage.registerStep( + Se.a.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE, + this, + this._beforeCameraUpdate + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () {}), + (e.prototype._beforeCameraUpdate = function () { + this.scene._simplificationQueue && + !this.scene._simplificationQueue.running && + this.scene._simplificationQueue.executeNext(); + }), e - }() - , ga = n(110) - , _a = n(78) - , va = n(73); - ve.b.OfflineProviderFactory = function(e, t, i) { - return void 0 === i && (i = false), - new ba(e,t,i) - } - ; - var ya, ba = function() { - function e(t, i, n) { - var r = this; - void 0 === n && (n = false), - this._idbFactory = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB, - this._callbackManifestChecked = i, - this._currentSceneUrl = e._ReturnFullUrlLocation(t), - this._db = null, - this._enableSceneOffline = false, - this._enableTexturesOffline = false, - this._manifestVersionFound = 0, - this._mustUpdateRessources = false, - this._hasReachedQuota = false, - e.IDBStorageEnabled ? n ? (this._enableSceneOffline = true, - this._enableTexturesOffline = true, - this._manifestVersionFound = 1, - Ee.h.SetImmediate(function() { - r._callbackManifestChecked(true) - })) : this._checkManifestFile() : this._callbackManifestChecked(true) - } - return Object.defineProperty(e.prototype, "enableSceneOffline", { - get: function() { - return this._enableSceneOffline + ); + })(), + ga = n(110), + _a = n(78), + va = n(73); + ve.b.OfflineProviderFactory = function (e, t, i) { + return void 0 === i && (i = false), new ba(e, t, i); + }; + var ya, + ba = (function () { + function e(t, i, n) { + var r = this; + void 0 === n && (n = false), + (this._idbFactory = + window.indexedDB || + window.mozIndexedDB || + window.webkitIndexedDB || + window.msIndexedDB), + (this._callbackManifestChecked = i), + (this._currentSceneUrl = e._ReturnFullUrlLocation(t)), + (this._db = null), + (this._enableSceneOffline = false), + (this._enableTexturesOffline = false), + (this._manifestVersionFound = 0), + (this._mustUpdateRessources = false), + (this._hasReachedQuota = false), + e.IDBStorageEnabled + ? n + ? ((this._enableSceneOffline = true), + (this._enableTexturesOffline = true), + (this._manifestVersionFound = 1), + Ee.h.SetImmediate(function () { + r._callbackManifestChecked(true); + })) + : this._checkManifestFile() + : this._callbackManifestChecked(true); + } + return ( + Object.defineProperty(e.prototype, "enableSceneOffline", { + get: function () { + return this._enableSceneOffline; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "enableTexturesOffline", + { + get: function () { + return this._enableTexturesOffline; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "enableTexturesOffline", { - get: function() { - return this._enableTexturesOffline + configurable: true, + } + ), + (e.prototype._checkManifestFile = function () { + var t = this, + i = function () { + (t._enableSceneOffline = false), + (t._enableTexturesOffline = false), + t._callbackManifestChecked(false); }, - enumerable: true, - configurable: true - }), - e.prototype._checkManifestFile = function() { - var t = this - , i = function() { - t._enableSceneOffline = false, - t._enableTexturesOffline = false, - t._callbackManifestChecked(false) - } - , n = false - , r = this._currentSceneUrl + ".manifest" - , o = new Co.a; - navigator.onLine && (n = true, - r = r + (null == r.match(/\?/) ? "?" : "&") + Date.now()), + n = false, + r = this._currentSceneUrl + ".manifest", + o = new Co.a(); + navigator.onLine && + ((n = true), + (r = + r + + (null == r.match(/\?/) ? "?" : "&") + + Date.now())), o.open("GET", r), - o.addEventListener("load", function() { + o.addEventListener( + "load", + function () { if (200 === o.status || e._ValidateXHRData(o, 1)) - try { - var n = JSON.parse(o.response); - t._enableSceneOffline = n.enableSceneOffline, - t._enableTexturesOffline = n.enableTexturesOffline && e.IsUASupportingBlobStorage, - n.version && !isNaN(parseInt(n.version)) && (t._manifestVersionFound = n.version), - t._callbackManifestChecked && t._callbackManifestChecked(true) - } catch (e) { - i() - } - else - i() - }, false), - o.addEventListener("error", function() { + try { + var n = JSON.parse(o.response); + (t._enableSceneOffline = n.enableSceneOffline), + (t._enableTexturesOffline = + n.enableTexturesOffline && + e.IsUASupportingBlobStorage), + n.version && + !isNaN(parseInt(n.version)) && + (t._manifestVersionFound = n.version), + t._callbackManifestChecked && + t._callbackManifestChecked(true); + } catch (e) { + i(); + } + else i(); + }, + false + ), + o.addEventListener( + "error", + function () { if (n) { - n = false; - var e = t._currentSceneUrl + ".manifest"; - o.open("GET", e), - o.send() - } else - i() - }, false); - try { - o.send() - } catch (e) { - g.a.Error("Error on XHR send request."), - this._callbackManifestChecked(false) + n = false; + var e = t._currentSceneUrl + ".manifest"; + o.open("GET", e), o.send(); + } else i(); + }, + false + ); + try { + o.send(); + } catch (e) { + g.a.Error("Error on XHR send request."), + this._callbackManifestChecked(false); + } + }), + (e.prototype.open = function (e, t) { + var i = this, + n = function () { + (i._isSupported = false), t && t(); + }; + if ( + this._idbFactory && + (this._enableSceneOffline || + this._enableTexturesOffline) + ) + if (this._db) e && e(); + else { + (this._hasReachedQuota = false), + (this._isSupported = true); + var r = this._idbFactory.open("babylonjs", 1); + (r.onerror = function () { + n(); + }), + (r.onblocked = function () { + g.a.Error( + "IDB request blocked. Please reload the page." + ), + n(); + }), + (r.onsuccess = function () { + (i._db = r.result), e(); + }), + (r.onupgradeneeded = function (e) { + if (((i._db = e.target.result), i._db)) + try { + i._db.createObjectStore("scenes", { + keyPath: "sceneUrl", + }), + i._db.createObjectStore("versions", { + keyPath: "sceneUrl", + }), + i._db.createObjectStore("textures", { + keyPath: "textureUrl", + }); + } catch (e) { + g.a.Error( + "Error while creating object stores. Exception: " + + e.message + ), + n(); + } + }); } - } - , - e.prototype.open = function(e, t) { - var i = this - , n = function() { - i._isSupported = false, - t && t() + else (this._isSupported = false), t && t(); + }), + (e.prototype.loadImage = function (t, i) { + var n = this, + r = e._ReturnFullUrlLocation(t), + o = function () { + n._hasReachedQuota || null === n._db + ? (i.src = t) + : n._saveImageIntoDBAsync(r, i); }; - if (this._idbFactory && (this._enableSceneOffline || this._enableTexturesOffline)) - if (this._db) - e && e(); - else { - this._hasReachedQuota = false, - this._isSupported = true; - var r = this._idbFactory.open("babylonjs", 1); - r.onerror = function() { - n() - } - , - r.onblocked = function() { - g.a.Error("IDB request blocked. Please reload the page."), - n() - } - , - r.onsuccess = function() { - i._db = r.result, - e() - } - , - r.onupgradeneeded = function(e) { - if (i._db = e.target.result, - i._db) - try { - i._db.createObjectStore("scenes", { - keyPath: "sceneUrl" - }), - i._db.createObjectStore("versions", { - keyPath: "sceneUrl" - }), - i._db.createObjectStore("textures", { - keyPath: "textureUrl" - }) - } catch (e) { - g.a.Error("Error while creating object stores. Exception: " + e.message), - n() - } - } + this._mustUpdateRessources + ? o() + : this._loadImageFromDBAsync(r, i, o); + }), + (e.prototype._loadImageFromDBAsync = function (e, t, i) { + if (this._isSupported && null !== this._db) { + var n, + r = this._db.transaction(["textures"]); + (r.onabort = function () { + t.src = e; + }), + (r.oncomplete = function () { + var r; + if (n) { + var o = window.URL || window.webkitURL; + (r = o.createObjectURL(n.data)), + (t.onerror = function () { + g.a.Error( + "Error loading image from blob URL: " + + r + + " switching back to web url: " + + e + ), + (t.src = e); + }), + (t.src = r); + } else i(); + }); + var o = r.objectStore("textures").get(e); + (o.onsuccess = function (e) { + n = e.target.result; + }), + (o.onerror = function () { + g.a.Error( + "Error loading texture " + e + " from DB." + ), + (t.src = e); + }); + } else + g.a.Error( + "Error: IndexedDB not supported by your browser or BabylonJS Database is not open." + ), + (t.src = e); + }), + (e.prototype._saveImageIntoDBAsync = function (t, i) { + var n = this; + if (this._isSupported) { + var r = function () { + var e; + if (o) { + var t = window.URL || window.webkitURL; + try { + e = t.createObjectURL(o); + } catch (i) { + e = t.createObjectURL(o); } - else - this._isSupported = false, - t && t() - } - , - e.prototype.loadImage = function(t, i) { - var n = this - , r = e._ReturnFullUrlLocation(t) - , o = function() { - n._hasReachedQuota || null === n._db ? i.src = t : n._saveImageIntoDBAsync(r, i) + } + e && (i.src = e); }; - this._mustUpdateRessources ? o() : this._loadImageFromDBAsync(r, i, o) - } - , - e.prototype._loadImageFromDBAsync = function(e, t, i) { - if (this._isSupported && null !== this._db) { - var n, r = this._db.transaction(["textures"]); - r.onabort = function() { - t.src = e - } - , - r.oncomplete = function() { - var r; - if (n) { - var o = window.URL || window.webkitURL; - r = o.createObjectURL(n.data), - t.onerror = function() { - g.a.Error("Error loading image from blob URL: " + r + " switching back to web url: " + e), - t.src = e - } - , - t.src = r - } else - i() - } - ; - var o = r.objectStore("textures").get(e); - o.onsuccess = function(e) { - n = e.target.result - } - , - o.onerror = function() { - g.a.Error("Error loading texture " + e + " from DB."), - t.src = e - } - } else - g.a.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), - t.src = e - } - , - e.prototype._saveImageIntoDBAsync = function(t, i) { - var n = this; - if (this._isSupported) { - var r = function() { - var e; - if (o) { - var t = window.URL || window.webkitURL; + if (e.IsUASupportingBlobStorage) { + var o, + a = new Co.a(); + a.open("GET", t), + (a.responseType = "blob"), + a.addEventListener( + "load", + function () { + if (200 === a.status && n._db) { + o = a.response; + var s = n._db.transaction( + ["textures"], + "readwrite" + ); + (s.onabort = function (e) { try { - e = t.createObjectURL(o) - } catch (i) { - e = t.createObjectURL(o) - } - } - e && (i.src = e) - }; - if (e.IsUASupportingBlobStorage) { - var o, a = new Co.a; - a.open("GET", t), - a.responseType = "blob", - a.addEventListener("load", function() { - if (200 === a.status && n._db) { - o = a.response; - var s = n._db.transaction(["textures"], "readwrite"); - s.onabort = function(e) { - try { - var t = (e.srcElement || e.target).error; - t && "QuotaExceededError" === t.name && (n._hasReachedQuota = true) - } catch (e) {} - r() - } - , - s.oncomplete = function() { - r() - } - ; - var c = { - textureUrl: t, - data: o - }; - try { - var u = s.objectStore("textures").put(c); - u.onsuccess = function() {} - , - u.onerror = function() { - r() - } - } catch (r) { - 25 === r.code && (e.IsUASupportingBlobStorage = false, - n._enableTexturesOffline = false), - i.src = t - } - } else - i.src = t - }, false), - a.addEventListener("error", function() { - g.a.Error("Error in XHR request in BABYLON.Database."), - i.src = t - }, false), - a.send() - } else - i.src = t - } else - g.a.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), - i.src = t - } - , - e.prototype._checkVersionFromDB = function(e, t) { - var i = this; - this._loadVersionFromDBAsync(e, t, function() { - i._saveVersionIntoDBAsync(e, t) - }) - } - , - e.prototype._loadVersionFromDBAsync = function(e, t, i) { - var n, r = this; - if (this._isSupported && this._db) - try { - var o = this._db.transaction(["versions"]); - o.oncomplete = function() { - n ? r._manifestVersionFound !== n.data ? (r._mustUpdateRessources = true, - i()) : t(n.data) : (r._mustUpdateRessources = true, - i()) - } - , - o.onabort = function() { - t(-1) - } - ; - var a = o.objectStore("versions").get(e); - a.onsuccess = function(e) { - n = e.target.result - } - , - a.onerror = function() { - g.a.Error("Error loading version for scene " + e + " from DB."), - t(-1) - } - } catch (e) { - g.a.Error("Error while accessing 'versions' object store (READ OP). Exception: " + e.message), - t(-1) - } - else - g.a.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), - t(-1) - } - , - e.prototype._saveVersionIntoDBAsync = function(e, t) { - var i = this; - if (this._isSupported && !this._hasReachedQuota && this._db) - try { - var n = this._db.transaction(["versions"], "readwrite"); - n.onabort = function(e) { - try { - var n = e.srcElement.error; - n && "QuotaExceededError" === n.name && (i._hasReachedQuota = true) + var t = (e.srcElement || e.target).error; + t && + "QuotaExceededError" === t.name && + (n._hasReachedQuota = true); } catch (e) {} - t(-1) - } - , - n.oncomplete = function() { - t(i._manifestVersionFound) - } - ; - var r = { - sceneUrl: e, - data: this._manifestVersionFound - } - , o = n.objectStore("versions").put(r); - o.onsuccess = function() {} - , - o.onerror = function() { - g.a.Error("Error in DB add version request in BABYLON.Database.") - } - } catch (e) { - g.a.Error("Error while accessing 'versions' object store (WRITE OP). Exception: " + e.message), - t(-1) - } - else - t(-1) - } - , - e.prototype.loadFile = function(t, i, n, r, o) { - var a = this - , s = e._ReturnFullUrlLocation(t) - , c = function() { - a._saveFileAsync(s, i, n, o, r) + r(); + }), + (s.oncomplete = function () { + r(); + }); + var c = { + textureUrl: t, + data: o, + }; + try { + var u = s.objectStore("textures").put(c); + (u.onsuccess = function () {}), + (u.onerror = function () { + r(); + }); + } catch (r) { + 25 === r.code && + ((e.IsUASupportingBlobStorage = false), + (n._enableTexturesOffline = false)), + (i.src = t); + } + } else i.src = t; + }, + false + ), + a.addEventListener( + "error", + function () { + g.a.Error( + "Error in XHR request in BABYLON.Database." + ), + (i.src = t); + }, + false + ), + a.send(); + } else i.src = t; + } else + g.a.Error( + "Error: IndexedDB not supported by your browser or BabylonJS Database is not open." + ), + (i.src = t); + }), + (e.prototype._checkVersionFromDB = function (e, t) { + var i = this; + this._loadVersionFromDBAsync(e, t, function () { + i._saveVersionIntoDBAsync(e, t); + }); + }), + (e.prototype._loadVersionFromDBAsync = function (e, t, i) { + var n, + r = this; + if (this._isSupported && this._db) + try { + var o = this._db.transaction(["versions"]); + (o.oncomplete = function () { + n + ? r._manifestVersionFound !== n.data + ? ((r._mustUpdateRessources = true), i()) + : t(n.data) + : ((r._mustUpdateRessources = true), i()); + }), + (o.onabort = function () { + t(-1); + }); + var a = o.objectStore("versions").get(e); + (a.onsuccess = function (e) { + n = e.target.result; + }), + (a.onerror = function () { + g.a.Error( + "Error loading version for scene " + + e + + " from DB." + ), + t(-1); + }); + } catch (e) { + g.a.Error( + "Error while accessing 'versions' object store (READ OP). Exception: " + + e.message + ), + t(-1); + } + else + g.a.Error( + "Error: IndexedDB not supported by your browser or BabylonJS Database is not open." + ), + t(-1); + }), + (e.prototype._saveVersionIntoDBAsync = function (e, t) { + var i = this; + if ( + this._isSupported && + !this._hasReachedQuota && + this._db + ) + try { + var n = this._db.transaction( + ["versions"], + "readwrite" + ); + (n.onabort = function (e) { + try { + var n = e.srcElement.error; + n && + "QuotaExceededError" === n.name && + (i._hasReachedQuota = true); + } catch (e) {} + t(-1); + }), + (n.oncomplete = function () { + t(i._manifestVersionFound); + }); + var r = { + sceneUrl: e, + data: this._manifestVersionFound, + }, + o = n.objectStore("versions").put(r); + (o.onsuccess = function () {}), + (o.onerror = function () { + g.a.Error( + "Error in DB add version request in BABYLON.Database." + ); + }); + } catch (e) { + g.a.Error( + "Error while accessing 'versions' object store (WRITE OP). Exception: " + + e.message + ), + t(-1); + } + else t(-1); + }), + (e.prototype.loadFile = function (t, i, n, r, o) { + var a = this, + s = e._ReturnFullUrlLocation(t), + c = function () { + a._saveFileAsync(s, i, n, o, r); }; - this._checkVersionFromDB(s, function(e) { - -1 !== e ? a._mustUpdateRessources ? a._saveFileAsync(s, i, n, o, r) : a._loadFileAsync(s, i, c) : r && r() - }) - } - , - e.prototype._loadFileAsync = function(e, t, i) { - if (this._isSupported && this._db) { - var n, r; - n = -1 !== e.indexOf(".babylon") ? "scenes" : "textures"; - var o = this._db.transaction([n]); - o.oncomplete = function() { - r ? t(r.data) : i() - } - , - o.onabort = function() { - i() - } - ; - var a = o.objectStore(n).get(e); - a.onsuccess = function(e) { - r = e.target.result - } - , - a.onerror = function() { - g.a.Error("Error loading file " + e + " from DB."), - i() - } - } else - g.a.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), - t() - } - , - e.prototype._saveFileAsync = function(t, i, n, r, o) { - var a = this; - if (this._isSupported) { - var s; - s = -1 !== t.indexOf(".babylon") ? "scenes" : "textures"; - var c, u = new Co.a; - u.open("GET", t + "?" + Date.now()), - r && (u.responseType = "arraybuffer"), - n && (u.onprogress = n), - u.addEventListener("load", function() { - if (200 === u.status || u.status < 400 && e._ValidateXHRData(u, r ? 6 : 1)) - if (c = r ? u.response : u.responseText, - !a._hasReachedQuota && a._db) { - var n, l = a._db.transaction([s], "readwrite"); - l.onabort = function(e) { - try { - var t = e.srcElement.error; - t && "QuotaExceededError" === t.name && (a._hasReachedQuota = true) - } catch (e) {} - i(c) - } - , - l.oncomplete = function() { - i(c) - } - , - n = "scenes" === s ? { + this._checkVersionFromDB(s, function (e) { + -1 !== e + ? a._mustUpdateRessources + ? a._saveFileAsync(s, i, n, o, r) + : a._loadFileAsync(s, i, c) + : r && r(); + }); + }), + (e.prototype._loadFileAsync = function (e, t, i) { + if (this._isSupported && this._db) { + var n, r; + n = + -1 !== e.indexOf(".babylon") ? "scenes" : "textures"; + var o = this._db.transaction([n]); + (o.oncomplete = function () { + r ? t(r.data) : i(); + }), + (o.onabort = function () { + i(); + }); + var a = o.objectStore(n).get(e); + (a.onsuccess = function (e) { + r = e.target.result; + }), + (a.onerror = function () { + g.a.Error("Error loading file " + e + " from DB."), + i(); + }); + } else + g.a.Error( + "Error: IndexedDB not supported by your browser or BabylonJS Database is not open." + ), + t(); + }), + (e.prototype._saveFileAsync = function (t, i, n, r, o) { + var a = this; + if (this._isSupported) { + var s; + s = + -1 !== t.indexOf(".babylon") ? "scenes" : "textures"; + var c, + u = new Co.a(); + u.open("GET", t + "?" + Date.now()), + r && (u.responseType = "arraybuffer"), + n && (u.onprogress = n), + u.addEventListener( + "load", + function () { + if ( + 200 === u.status || + (u.status < 400 && + e._ValidateXHRData(u, r ? 6 : 1)) + ) + if ( + ((c = r ? u.response : u.responseText), + !a._hasReachedQuota && a._db) + ) { + var n, + l = a._db.transaction([s], "readwrite"); + (l.onabort = function (e) { + try { + var t = e.srcElement.error; + t && + "QuotaExceededError" === t.name && + (a._hasReachedQuota = true); + } catch (e) {} + i(c); + }), + (l.oncomplete = function () { + i(c); + }), + (n = + "scenes" === s + ? { sceneUrl: t, data: c, - version: a._manifestVersionFound - } : { + version: a._manifestVersionFound, + } + : { textureUrl: t, - data: c - }; - try { - var h = l.objectStore(s).put(n); - h.onsuccess = function() {} - , - h.onerror = function() { - g.a.Error("Error in DB add file request in BABYLON.Database.") - } - } catch (e) { - i(c) - } - } else - i(c); - else - u.status >= 400 && o ? o(u) : i() - }, false), - u.addEventListener("error", function() { - g.a.Error("error on XHR request."), - i() - }, false), - u.send() - } else - g.a.Error("Error: IndexedDB not supported by your browser or Babylon.js Database is not open."), - i() - } - , - e._ValidateXHRData = function(e, t) { - void 0 === t && (t = 7); - try { - if (1 & t) { - if (e.responseText && e.responseText.length > 0) - return true; - if (1 === t) - return false - } - if (2 & t) { - var i = Eo.GetTGAHeader(e.response); - if (i.width && i.height && i.width > 0 && i.height > 0) - return true; - if (2 === t) - return false - } - if (4 & t) { - var n = new Uint8Array(e.response,0,3); - return 68 === n[0] && 68 === n[1] && 83 === n[2] - } - } catch (e) {} - return false - } - , - e.IsUASupportingBlobStorage = true, - e.IDBStorageEnabled = false, - e._ParseURL = function(e) { - document.createElement("a").href = e; - var t = e.substring(0, e.lastIndexOf("#")) - , i = e.substring(t.lastIndexOf("/") + 1, e.length); - return e.substring(0, e.indexOf(i, 0)) - } - , - e._ReturnFullUrlLocation = function(t) { - return -1 === t.indexOf("http:/") && -1 === t.indexOf("https:/") ? e._ParseURL(window.location.href) + t : t - } - , + data: c, + }); + try { + var h = l.objectStore(s).put(n); + (h.onsuccess = function () {}), + (h.onerror = function () { + g.a.Error( + "Error in DB add file request in BABYLON.Database." + ); + }); + } catch (e) { + i(c); + } + } else i(c); + else u.status >= 400 && o ? o(u) : i(); + }, + false + ), + u.addEventListener( + "error", + function () { + g.a.Error("error on XHR request."), i(); + }, + false + ), + u.send(); + } else + g.a.Error( + "Error: IndexedDB not supported by your browser or Babylon.js Database is not open." + ), + i(); + }), + (e._ValidateXHRData = function (e, t) { + void 0 === t && (t = 7); + try { + if (1 & t) { + if (e.responseText && e.responseText.length > 0) + return true; + if (1 === t) return false; + } + if (2 & t) { + var i = Eo.GetTGAHeader(e.response); + if ( + i.width && + i.height && + i.width > 0 && + i.height > 0 + ) + return true; + if (2 === t) return false; + } + if (4 & t) { + var n = new Uint8Array(e.response, 0, 3); + return 68 === n[0] && 68 === n[1] && 83 === n[2]; + } + } catch (e) {} + return false; + }), + (e.IsUASupportingBlobStorage = true), + (e.IDBStorageEnabled = false), + (e._ParseURL = function (e) { + document.createElement("a").href = e; + var t = e.substring(0, e.lastIndexOf("#")), + i = e.substring(t.lastIndexOf("/") + 1, e.length); + return e.substring(0, e.indexOf(i, 0)); + }), + (e._ReturnFullUrlLocation = function (t) { + return -1 === t.indexOf("http:/") && + -1 === t.indexOf("https:/") + ? e._ParseURL(window.location.href) + t + : t; + }), e - }(), Ea = function() { - function e() { - this.direction1 = new a.x(0,1,0), - this.direction2 = new a.x(0,1,0), - this.minEmitBox = new a.x(-.5,-.5,-.5), - this.maxEmitBox = new a.x(.5,.5,.5) - } - return e.prototype.startDirectionFunction = function(e, t, i) { - var n = L.a.RandomRange(this.direction1.x, this.direction2.x) - , r = L.a.RandomRange(this.direction1.y, this.direction2.y) - , o = L.a.RandomRange(this.direction1.z, this.direction2.z); - a.x.TransformNormalFromFloatsToRef(n, r, o, e, t) - } - , - e.prototype.startPositionFunction = function(e, t, i) { - var n = L.a.RandomRange(this.minEmitBox.x, this.maxEmitBox.x) - , r = L.a.RandomRange(this.minEmitBox.y, this.maxEmitBox.y) - , o = L.a.RandomRange(this.minEmitBox.z, this.maxEmitBox.z); - a.x.TransformCoordinatesFromFloatsToRef(n, r, o, e, t) - } - , - e.prototype.clone = function() { - var t = new e; - return M.a.DeepCopy(this, t), - t - } - , - e.prototype.applyToShader = function(e) { - e.setVector3("direction1", this.direction1), + ); + })(), + Ea = (function () { + function e() { + (this.direction1 = new a.x(0, 1, 0)), + (this.direction2 = new a.x(0, 1, 0)), + (this.minEmitBox = new a.x(-0.5, -0.5, -0.5)), + (this.maxEmitBox = new a.x(0.5, 0.5, 0.5)); + } + return ( + (e.prototype.startDirectionFunction = function (e, t, i) { + var n = L.a.RandomRange( + this.direction1.x, + this.direction2.x + ), + r = L.a.RandomRange( + this.direction1.y, + this.direction2.y + ), + o = L.a.RandomRange( + this.direction1.z, + this.direction2.z + ); + a.x.TransformNormalFromFloatsToRef(n, r, o, e, t); + }), + (e.prototype.startPositionFunction = function (e, t, i) { + var n = L.a.RandomRange( + this.minEmitBox.x, + this.maxEmitBox.x + ), + r = L.a.RandomRange( + this.minEmitBox.y, + this.maxEmitBox.y + ), + o = L.a.RandomRange( + this.minEmitBox.z, + this.maxEmitBox.z + ); + a.x.TransformCoordinatesFromFloatsToRef(n, r, o, e, t); + }), + (e.prototype.clone = function () { + var t = new e(); + return M.a.DeepCopy(this, t), t; + }), + (e.prototype.applyToShader = function (e) { + e.setVector3("direction1", this.direction1), e.setVector3("direction2", this.direction2), e.setVector3("minEmitBox", this.minEmitBox), - e.setVector3("maxEmitBox", this.maxEmitBox) - } - , - e.prototype.getEffectDefines = function() { - return "#define BOXEMITTER" - } - , - e.prototype.getClassName = function() { - return "BoxParticleEmitter" - } - , - e.prototype.serialize = function() { - var e = {}; - return e.type = this.getClassName(), - e.direction1 = this.direction1.asArray(), - e.direction2 = this.direction2.asArray(), - e.minEmitBox = this.minEmitBox.asArray(), - e.maxEmitBox = this.maxEmitBox.asArray(), + e.setVector3("maxEmitBox", this.maxEmitBox); + }), + (e.prototype.getEffectDefines = function () { + return "#define BOXEMITTER"; + }), + (e.prototype.getClassName = function () { + return "BoxParticleEmitter"; + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.type = this.getClassName()), + (e.direction1 = this.direction1.asArray()), + (e.direction2 = this.direction2.asArray()), + (e.minEmitBox = this.minEmitBox.asArray()), + (e.maxEmitBox = this.maxEmitBox.asArray()), e - } - , - e.prototype.parse = function(e) { - a.x.FromArrayToRef(e.direction1, 0, this.direction1), + ); + }), + (e.prototype.parse = function (e) { + a.x.FromArrayToRef(e.direction1, 0, this.direction1), a.x.FromArrayToRef(e.direction2, 0, this.direction2), a.x.FromArrayToRef(e.minEmitBox, 0, this.minEmitBox), - a.x.FromArrayToRef(e.maxEmitBox, 0, this.maxEmitBox) - } - , + a.x.FromArrayToRef(e.maxEmitBox, 0, this.maxEmitBox); + }), e - }(), Ta = function() { - function e(e, t, i) { - void 0 === e && (e = 1), - void 0 === t && (t = Math.PI), - void 0 === i && (i = 0), - this.directionRandomizer = i, - this.radiusRange = 1, - this.heightRange = 1, - this.emitFromSpawnPointOnly = false, - this.angle = t, - this.radius = e - } - return Object.defineProperty(e.prototype, "radius", { - get: function() { - return this._radius - }, - set: function(e) { - this._radius = e, - this._buildHeight() - }, - enumerable: true, - configurable: true + ); + })(), + Ta = (function () { + function e(e, t, i) { + void 0 === e && (e = 1), + void 0 === t && (t = Math.PI), + void 0 === i && (i = 0), + (this.directionRandomizer = i), + (this.radiusRange = 1), + (this.heightRange = 1), + (this.emitFromSpawnPointOnly = false), + (this.angle = t), + (this.radius = e); + } + return ( + Object.defineProperty(e.prototype, "radius", { + get: function () { + return this._radius; + }, + set: function (e) { + (this._radius = e), this._buildHeight(); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "angle", { - get: function() { - return this._angle - }, - set: function(e) { - this._angle = e, - this._buildHeight() - }, - enumerable: true, - configurable: true + get: function () { + return this._angle; + }, + set: function (e) { + (this._angle = e), this._buildHeight(); + }, + enumerable: true, + configurable: true, }), - e.prototype._buildHeight = function() { - 0 !== this._angle ? this._height = this._radius / Math.tan(this._angle / 2) : this._height = 1 - } - , - e.prototype.startDirectionFunction = function(e, t, i) { - if (1 === Math.abs(Math.cos(this._angle))) - a.x.TransformNormalFromFloatsToRef(0, 1, 0, e, t); - else { - var n = i.position.subtract(e.getTranslation()).normalize() - , r = L.a.RandomRange(0, this.directionRandomizer) - , o = L.a.RandomRange(0, this.directionRandomizer) - , s = L.a.RandomRange(0, this.directionRandomizer); - n.x += r, - n.y += o, - n.z += s, - n.normalize(), - a.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t) - } - } - , - e.prototype.startPositionFunction = function(e, t, i) { - var n, r = L.a.RandomRange(0, 2 * Math.PI); - n = this.emitFromSpawnPointOnly ? 1e-4 : 1 - (n = L.a.RandomRange(0, this.heightRange)) * n; - var o = this._radius - L.a.RandomRange(0, this._radius * this.radiusRange) - , s = (o *= n) * Math.sin(r) - , c = o * Math.cos(r) - , u = n * this._height; - a.x.TransformCoordinatesFromFloatsToRef(s, u, c, e, t) - } - , - e.prototype.clone = function() { - var t = new e(this._radius,this._angle,this.directionRandomizer); - return M.a.DeepCopy(this, t), - t - } - , - e.prototype.applyToShader = function(e) { - e.setFloat2("radius", this._radius, this.radiusRange), + (e.prototype._buildHeight = function () { + 0 !== this._angle + ? (this._height = + this._radius / Math.tan(this._angle / 2)) + : (this._height = 1); + }), + (e.prototype.startDirectionFunction = function (e, t, i) { + if (1 === Math.abs(Math.cos(this._angle))) + a.x.TransformNormalFromFloatsToRef(0, 1, 0, e, t); + else { + var n = i.position + .subtract(e.getTranslation()) + .normalize(), + r = L.a.RandomRange(0, this.directionRandomizer), + o = L.a.RandomRange(0, this.directionRandomizer), + s = L.a.RandomRange(0, this.directionRandomizer); + (n.x += r), + (n.y += o), + (n.z += s), + n.normalize(), + a.x.TransformNormalFromFloatsToRef( + n.x, + n.y, + n.z, + e, + t + ); + } + }), + (e.prototype.startPositionFunction = function (e, t, i) { + var n, + r = L.a.RandomRange(0, 2 * Math.PI); + n = this.emitFromSpawnPointOnly + ? 1e-4 + : 1 - (n = L.a.RandomRange(0, this.heightRange)) * n; + var o = + this._radius - + L.a.RandomRange(0, this._radius * this.radiusRange), + s = (o *= n) * Math.sin(r), + c = o * Math.cos(r), + u = n * this._height; + a.x.TransformCoordinatesFromFloatsToRef(s, u, c, e, t); + }), + (e.prototype.clone = function () { + var t = new e( + this._radius, + this._angle, + this.directionRandomizer + ); + return M.a.DeepCopy(this, t), t; + }), + (e.prototype.applyToShader = function (e) { + e.setFloat2("radius", this._radius, this.radiusRange), e.setFloat("coneAngle", this._angle), e.setFloat2("height", this._height, this.heightRange), - e.setFloat("directionRandomizer", this.directionRandomizer) - } - , - e.prototype.getEffectDefines = function() { - var e = "#define CONEEMITTER"; - return this.emitFromSpawnPointOnly && (e += "\n#define CONEEMITTERSPAWNPOINT"), + e.setFloat( + "directionRandomizer", + this.directionRandomizer + ); + }), + (e.prototype.getEffectDefines = function () { + var e = "#define CONEEMITTER"; + return ( + this.emitFromSpawnPointOnly && + (e += "\n#define CONEEMITTERSPAWNPOINT"), e - } - , - e.prototype.getClassName = function() { - return "ConeParticleEmitter" - } - , - e.prototype.serialize = function() { - var e = {}; - return e.type = this.getClassName(), - e.radius = this._radius, - e.angle = this._angle, - e.directionRandomizer = this.directionRandomizer, + ); + }), + (e.prototype.getClassName = function () { + return "ConeParticleEmitter"; + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.type = this.getClassName()), + (e.radius = this._radius), + (e.angle = this._angle), + (e.directionRandomizer = this.directionRandomizer), e - } - , - e.prototype.parse = function(e) { - this.radius = e.radius, - this.angle = e.angle, - this.directionRandomizer = e.directionRandomizer - } - , + ); + }), + (e.prototype.parse = function (e) { + (this.radius = e.radius), + (this.angle = e.angle), + (this.directionRandomizer = e.directionRandomizer); + }), e - }(), Aa = function() { - function e(e, t, i, n) { - void 0 === e && (e = 1), - void 0 === t && (t = 1), - void 0 === i && (i = 1), - void 0 === n && (n = 0), - this.radius = e, - this.height = t, - this.radiusRange = i, - this.directionRandomizer = n - } - return e.prototype.startDirectionFunction = function(e, t, i) { - var n = i.position.subtract(e.getTranslation()).normalize() - , r = L.a.RandomRange(-this.directionRandomizer / 2, this.directionRandomizer / 2) - , o = Math.atan2(n.x, n.z); - o += L.a.RandomRange(-Math.PI / 2, Math.PI / 2) * this.directionRandomizer, - n.y = r, - n.x = Math.sin(o), - n.z = Math.cos(o), + ); + })(), + Aa = (function () { + function e(e, t, i, n) { + void 0 === e && (e = 1), + void 0 === t && (t = 1), + void 0 === i && (i = 1), + void 0 === n && (n = 0), + (this.radius = e), + (this.height = t), + (this.radiusRange = i), + (this.directionRandomizer = n); + } + return ( + (e.prototype.startDirectionFunction = function (e, t, i) { + var n = i.position + .subtract(e.getTranslation()) + .normalize(), + r = L.a.RandomRange( + -this.directionRandomizer / 2, + this.directionRandomizer / 2 + ), + o = Math.atan2(n.x, n.z); + (o += + L.a.RandomRange(-Math.PI / 2, Math.PI / 2) * + this.directionRandomizer), + (n.y = r), + (n.x = Math.sin(o)), + (n.z = Math.cos(o)), n.normalize(), - a.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t) - } - , - e.prototype.startPositionFunction = function(e, t, i) { - var n = L.a.RandomRange(-this.height / 2, this.height / 2) - , r = L.a.RandomRange(0, 2 * Math.PI) - , o = L.a.RandomRange((1 - this.radiusRange) * (1 - this.radiusRange), 1) - , s = Math.sqrt(o) * this.radius - , c = s * Math.cos(r) - , u = s * Math.sin(r); - a.x.TransformCoordinatesFromFloatsToRef(c, n, u, e, t) - } - , - e.prototype.clone = function() { - var t = new e(this.radius,this.directionRandomizer); - return M.a.DeepCopy(this, t), - t - } - , - e.prototype.applyToShader = function(e) { - e.setFloat("radius", this.radius), + a.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t); + }), + (e.prototype.startPositionFunction = function (e, t, i) { + var n = L.a.RandomRange( + -this.height / 2, + this.height / 2 + ), + r = L.a.RandomRange(0, 2 * Math.PI), + o = L.a.RandomRange( + (1 - this.radiusRange) * (1 - this.radiusRange), + 1 + ), + s = Math.sqrt(o) * this.radius, + c = s * Math.cos(r), + u = s * Math.sin(r); + a.x.TransformCoordinatesFromFloatsToRef(c, n, u, e, t); + }), + (e.prototype.clone = function () { + var t = new e(this.radius, this.directionRandomizer); + return M.a.DeepCopy(this, t), t; + }), + (e.prototype.applyToShader = function (e) { + e.setFloat("radius", this.radius), e.setFloat("height", this.height), e.setFloat("radiusRange", this.radiusRange), - e.setFloat("directionRandomizer", this.directionRandomizer) - } - , - e.prototype.getEffectDefines = function() { - return "#define CYLINDEREMITTER" - } - , - e.prototype.getClassName = function() { - return "CylinderParticleEmitter" - } - , - e.prototype.serialize = function() { - var e = {}; - return e.type = this.getClassName(), - e.radius = this.radius, - e.height = this.height, - e.radiusRange = this.radiusRange, - e.directionRandomizer = this.directionRandomizer, + e.setFloat( + "directionRandomizer", + this.directionRandomizer + ); + }), + (e.prototype.getEffectDefines = function () { + return "#define CYLINDEREMITTER"; + }), + (e.prototype.getClassName = function () { + return "CylinderParticleEmitter"; + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.type = this.getClassName()), + (e.radius = this.radius), + (e.height = this.height), + (e.radiusRange = this.radiusRange), + (e.directionRandomizer = this.directionRandomizer), e - } - , - e.prototype.parse = function(e) { - this.radius = e.radius, - this.height = e.height, - this.radiusRange = e.radiusRange, - this.directionRandomizer = e.directionRandomizer - } - , + ); + }), + (e.prototype.parse = function (e) { + (this.radius = e.radius), + (this.height = e.height), + (this.radiusRange = e.radiusRange), + (this.directionRandomizer = e.directionRandomizer); + }), e - }(), xa = function(e) { - function t(t, i, n, r, o) { - void 0 === t && (t = 1), - void 0 === i && (i = 1), - void 0 === n && (n = 1), - void 0 === r && (r = new a.x(0,1,0)), - void 0 === o && (o = new a.x(0,1,0)); - var s = e.call(this, t, i, n) || this; - return s.direction1 = r, - s.direction2 = o, - s - } - return h.d(t, e), - t.prototype.startDirectionFunction = function(e, t, i) { - var n = L.a.RandomRange(this.direction1.x, this.direction2.x) - , r = L.a.RandomRange(this.direction1.y, this.direction2.y) - , o = L.a.RandomRange(this.direction1.z, this.direction2.z); - a.x.TransformNormalFromFloatsToRef(n, r, o, e, t) - } - , - t.prototype.clone = function() { - var e = new t(this.radius,this.height,this.radiusRange,this.direction1,this.direction2); - return M.a.DeepCopy(this, e), - e - } - , - t.prototype.applyToShader = function(e) { - e.setFloat("radius", this.radius), + ); + })(), + xa = (function (e) { + function t(t, i, n, r, o) { + void 0 === t && (t = 1), + void 0 === i && (i = 1), + void 0 === n && (n = 1), + void 0 === r && (r = new a.x(0, 1, 0)), + void 0 === o && (o = new a.x(0, 1, 0)); + var s = e.call(this, t, i, n) || this; + return (s.direction1 = r), (s.direction2 = o), s; + } + return ( + h.d(t, e), + (t.prototype.startDirectionFunction = function (e, t, i) { + var n = L.a.RandomRange( + this.direction1.x, + this.direction2.x + ), + r = L.a.RandomRange( + this.direction1.y, + this.direction2.y + ), + o = L.a.RandomRange( + this.direction1.z, + this.direction2.z + ); + a.x.TransformNormalFromFloatsToRef(n, r, o, e, t); + }), + (t.prototype.clone = function () { + var e = new t( + this.radius, + this.height, + this.radiusRange, + this.direction1, + this.direction2 + ); + return M.a.DeepCopy(this, e), e; + }), + (t.prototype.applyToShader = function (e) { + e.setFloat("radius", this.radius), e.setFloat("height", this.height), e.setFloat("radiusRange", this.radiusRange), e.setVector3("direction1", this.direction1), - e.setVector3("direction2", this.direction2) - } - , - t.prototype.getEffectDefines = function() { - return "#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER" - } - , - t.prototype.getClassName = function() { - return "CylinderDirectedParticleEmitter" - } - , - t.prototype.serialize = function() { - var t = e.prototype.serialize.call(this); - return t.direction1 = this.direction1.asArray(), - t.direction2 = this.direction2.asArray(), + e.setVector3("direction2", this.direction2); + }), + (t.prototype.getEffectDefines = function () { + return "#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER"; + }), + (t.prototype.getClassName = function () { + return "CylinderDirectedParticleEmitter"; + }), + (t.prototype.serialize = function () { + var t = e.prototype.serialize.call(this); + return ( + (t.direction1 = this.direction1.asArray()), + (t.direction2 = this.direction2.asArray()), t - } - , - t.prototype.parse = function(t) { - e.prototype.parse.call(this, t), + ); + }), + (t.prototype.parse = function (t) { + e.prototype.parse.call(this, t), this.direction1.copyFrom(t.direction1), - this.direction2.copyFrom(t.direction2) - } - , + this.direction2.copyFrom(t.direction2); + }), t - }(Aa), Sa = function() { - function e(e, t, i) { - void 0 === e && (e = 1), - void 0 === t && (t = 1), - void 0 === i && (i = 0), - this.radius = e, - this.radiusRange = t, - this.directionRandomizer = i - } - return e.prototype.startDirectionFunction = function(e, t, i) { - var n = i.position.subtract(e.getTranslation()).normalize() - , r = L.a.RandomRange(0, this.directionRandomizer) - , o = L.a.RandomRange(0, this.directionRandomizer) - , s = L.a.RandomRange(0, this.directionRandomizer); - n.x += r, - n.y += o, - n.z += s, + ); + })(Aa), + Sa = (function () { + function e(e, t, i) { + void 0 === e && (e = 1), + void 0 === t && (t = 1), + void 0 === i && (i = 0), + (this.radius = e), + (this.radiusRange = t), + (this.directionRandomizer = i); + } + return ( + (e.prototype.startDirectionFunction = function (e, t, i) { + var n = i.position + .subtract(e.getTranslation()) + .normalize(), + r = L.a.RandomRange(0, this.directionRandomizer), + o = L.a.RandomRange(0, this.directionRandomizer), + s = L.a.RandomRange(0, this.directionRandomizer); + (n.x += r), + (n.y += o), + (n.z += s), n.normalize(), - a.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t) - } - , - e.prototype.startPositionFunction = function(e, t, i) { - var n = this.radius - L.a.RandomRange(0, this.radius * this.radiusRange) - , r = L.a.RandomRange(0, 1) - , o = L.a.RandomRange(0, 2 * Math.PI) - , s = Math.acos(2 * r - 1) - , c = n * Math.cos(o) * Math.sin(s) - , u = n * Math.cos(s) - , l = n * Math.sin(o) * Math.sin(s); - a.x.TransformCoordinatesFromFloatsToRef(c, Math.abs(u), l, e, t) - } - , - e.prototype.clone = function() { - var t = new e(this.radius,this.directionRandomizer); - return M.a.DeepCopy(this, t), + a.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t); + }), + (e.prototype.startPositionFunction = function (e, t, i) { + var n = + this.radius - + L.a.RandomRange(0, this.radius * this.radiusRange), + r = L.a.RandomRange(0, 1), + o = L.a.RandomRange(0, 2 * Math.PI), + s = Math.acos(2 * r - 1), + c = n * Math.cos(o) * Math.sin(s), + u = n * Math.cos(s), + l = n * Math.sin(o) * Math.sin(s); + a.x.TransformCoordinatesFromFloatsToRef( + c, + Math.abs(u), + l, + e, t - } - , - e.prototype.applyToShader = function(e) { - e.setFloat("radius", this.radius), + ); + }), + (e.prototype.clone = function () { + var t = new e(this.radius, this.directionRandomizer); + return M.a.DeepCopy(this, t), t; + }), + (e.prototype.applyToShader = function (e) { + e.setFloat("radius", this.radius), e.setFloat("radiusRange", this.radiusRange), - e.setFloat("directionRandomizer", this.directionRandomizer) - } - , - e.prototype.getEffectDefines = function() { - return "#define HEMISPHERICEMITTER" - } - , - e.prototype.getClassName = function() { - return "HemisphericParticleEmitter" - } - , - e.prototype.serialize = function() { - var e = {}; - return e.type = this.getClassName(), - e.radius = this.radius, - e.radiusRange = this.radiusRange, - e.directionRandomizer = this.directionRandomizer, + e.setFloat( + "directionRandomizer", + this.directionRandomizer + ); + }), + (e.prototype.getEffectDefines = function () { + return "#define HEMISPHERICEMITTER"; + }), + (e.prototype.getClassName = function () { + return "HemisphericParticleEmitter"; + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.type = this.getClassName()), + (e.radius = this.radius), + (e.radiusRange = this.radiusRange), + (e.directionRandomizer = this.directionRandomizer), e - } - , - e.prototype.parse = function(e) { - this.radius = e.radius, - this.radiusRange = e.radiusRange, - this.directionRandomizer = e.directionRandomizer - } - , + ); + }), + (e.prototype.parse = function (e) { + (this.radius = e.radius), + (this.radiusRange = e.radiusRange), + (this.directionRandomizer = e.directionRandomizer); + }), e - }(), Ca = function() { - function e() { - this.direction1 = new a.x(0,1,0), - this.direction2 = new a.x(0,1,0) - } - return e.prototype.startDirectionFunction = function(e, t, i) { - var n = L.a.RandomRange(this.direction1.x, this.direction2.x) - , r = L.a.RandomRange(this.direction1.y, this.direction2.y) - , o = L.a.RandomRange(this.direction1.z, this.direction2.z); - a.x.TransformNormalFromFloatsToRef(n, r, o, e, t) - } - , - e.prototype.startPositionFunction = function(e, t, i) { - a.x.TransformCoordinatesFromFloatsToRef(0, 0, 0, e, t) - } - , - e.prototype.clone = function() { - var t = new e; - return M.a.DeepCopy(this, t), - t - } - , - e.prototype.applyToShader = function(e) { - e.setVector3("direction1", this.direction1), - e.setVector3("direction2", this.direction2) - } - , - e.prototype.getEffectDefines = function() { - return "#define POINTEMITTER" - } - , - e.prototype.getClassName = function() { - return "PointParticleEmitter" - } - , - e.prototype.serialize = function() { - var e = {}; - return e.type = this.getClassName(), - e.direction1 = this.direction1.asArray(), - e.direction2 = this.direction2.asArray(), + ); + })(), + Ca = (function () { + function e() { + (this.direction1 = new a.x(0, 1, 0)), + (this.direction2 = new a.x(0, 1, 0)); + } + return ( + (e.prototype.startDirectionFunction = function (e, t, i) { + var n = L.a.RandomRange( + this.direction1.x, + this.direction2.x + ), + r = L.a.RandomRange( + this.direction1.y, + this.direction2.y + ), + o = L.a.RandomRange( + this.direction1.z, + this.direction2.z + ); + a.x.TransformNormalFromFloatsToRef(n, r, o, e, t); + }), + (e.prototype.startPositionFunction = function (e, t, i) { + a.x.TransformCoordinatesFromFloatsToRef(0, 0, 0, e, t); + }), + (e.prototype.clone = function () { + var t = new e(); + return M.a.DeepCopy(this, t), t; + }), + (e.prototype.applyToShader = function (e) { + e.setVector3("direction1", this.direction1), + e.setVector3("direction2", this.direction2); + }), + (e.prototype.getEffectDefines = function () { + return "#define POINTEMITTER"; + }), + (e.prototype.getClassName = function () { + return "PointParticleEmitter"; + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.type = this.getClassName()), + (e.direction1 = this.direction1.asArray()), + (e.direction2 = this.direction2.asArray()), e - } - , - e.prototype.parse = function(e) { - a.x.FromArrayToRef(e.direction1, 0, this.direction1), - a.x.FromArrayToRef(e.direction2, 0, this.direction2) - } - , + ); + }), + (e.prototype.parse = function (e) { + a.x.FromArrayToRef(e.direction1, 0, this.direction1), + a.x.FromArrayToRef(e.direction2, 0, this.direction2); + }), e - }(), Pa = function() { - function e(e, t, i) { - void 0 === e && (e = 1), - void 0 === t && (t = 1), - void 0 === i && (i = 0), - this.radius = e, - this.radiusRange = t, - this.directionRandomizer = i - } - return e.prototype.startDirectionFunction = function(e, t, i) { - var n = i.position.subtract(e.getTranslation()).normalize() - , r = L.a.RandomRange(0, this.directionRandomizer) - , o = L.a.RandomRange(0, this.directionRandomizer) - , s = L.a.RandomRange(0, this.directionRandomizer); - n.x += r, - n.y += o, - n.z += s, + ); + })(), + Pa = (function () { + function e(e, t, i) { + void 0 === e && (e = 1), + void 0 === t && (t = 1), + void 0 === i && (i = 0), + (this.radius = e), + (this.radiusRange = t), + (this.directionRandomizer = i); + } + return ( + (e.prototype.startDirectionFunction = function (e, t, i) { + var n = i.position + .subtract(e.getTranslation()) + .normalize(), + r = L.a.RandomRange(0, this.directionRandomizer), + o = L.a.RandomRange(0, this.directionRandomizer), + s = L.a.RandomRange(0, this.directionRandomizer); + (n.x += r), + (n.y += o), + (n.z += s), n.normalize(), - a.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t) - } - , - e.prototype.startPositionFunction = function(e, t, i) { - var n = this.radius - L.a.RandomRange(0, this.radius * this.radiusRange) - , r = L.a.RandomRange(0, 1) - , o = L.a.RandomRange(0, 2 * Math.PI) - , s = Math.acos(2 * r - 1) - , c = n * Math.cos(o) * Math.sin(s) - , u = n * Math.cos(s) - , l = n * Math.sin(o) * Math.sin(s); - a.x.TransformCoordinatesFromFloatsToRef(c, u, l, e, t) - } - , - e.prototype.clone = function() { - var t = new e(this.radius,this.directionRandomizer); - return M.a.DeepCopy(this, t), - t - } - , - e.prototype.applyToShader = function(e) { - e.setFloat("radius", this.radius), + a.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t); + }), + (e.prototype.startPositionFunction = function (e, t, i) { + var n = + this.radius - + L.a.RandomRange(0, this.radius * this.radiusRange), + r = L.a.RandomRange(0, 1), + o = L.a.RandomRange(0, 2 * Math.PI), + s = Math.acos(2 * r - 1), + c = n * Math.cos(o) * Math.sin(s), + u = n * Math.cos(s), + l = n * Math.sin(o) * Math.sin(s); + a.x.TransformCoordinatesFromFloatsToRef(c, u, l, e, t); + }), + (e.prototype.clone = function () { + var t = new e(this.radius, this.directionRandomizer); + return M.a.DeepCopy(this, t), t; + }), + (e.prototype.applyToShader = function (e) { + e.setFloat("radius", this.radius), e.setFloat("radiusRange", this.radiusRange), - e.setFloat("directionRandomizer", this.directionRandomizer) - } - , - e.prototype.getEffectDefines = function() { - return "#define SPHEREEMITTER" - } - , - e.prototype.getClassName = function() { - return "SphereParticleEmitter" - } - , - e.prototype.serialize = function() { - var e = {}; - return e.type = this.getClassName(), - e.radius = this.radius, - e.radiusRange = this.radiusRange, - e.directionRandomizer = this.directionRandomizer, + e.setFloat( + "directionRandomizer", + this.directionRandomizer + ); + }), + (e.prototype.getEffectDefines = function () { + return "#define SPHEREEMITTER"; + }), + (e.prototype.getClassName = function () { + return "SphereParticleEmitter"; + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.type = this.getClassName()), + (e.radius = this.radius), + (e.radiusRange = this.radiusRange), + (e.directionRandomizer = this.directionRandomizer), e - } - , - e.prototype.parse = function(e) { - this.radius = e.radius, - this.radiusRange = e.radiusRange, - this.directionRandomizer = e.directionRandomizer - } - , + ); + }), + (e.prototype.parse = function (e) { + (this.radius = e.radius), + (this.radiusRange = e.radiusRange), + (this.directionRandomizer = e.directionRandomizer); + }), e - }(), Ra = function(e) { - function t(t, i, n) { - void 0 === t && (t = 1), - void 0 === i && (i = new a.x(0,1,0)), - void 0 === n && (n = new a.x(0,1,0)); - var r = e.call(this, t) || this; - return r.direction1 = i, - r.direction2 = n, - r - } - return h.d(t, e), - t.prototype.startDirectionFunction = function(e, t, i) { - var n = L.a.RandomRange(this.direction1.x, this.direction2.x) - , r = L.a.RandomRange(this.direction1.y, this.direction2.y) - , o = L.a.RandomRange(this.direction1.z, this.direction2.z); - a.x.TransformNormalFromFloatsToRef(n, r, o, e, t) - } - , - t.prototype.clone = function() { - var e = new t(this.radius,this.direction1,this.direction2); - return M.a.DeepCopy(this, e), - e - } - , - t.prototype.applyToShader = function(e) { - e.setFloat("radius", this.radius), + ); + })(), + Ra = (function (e) { + function t(t, i, n) { + void 0 === t && (t = 1), + void 0 === i && (i = new a.x(0, 1, 0)), + void 0 === n && (n = new a.x(0, 1, 0)); + var r = e.call(this, t) || this; + return (r.direction1 = i), (r.direction2 = n), r; + } + return ( + h.d(t, e), + (t.prototype.startDirectionFunction = function (e, t, i) { + var n = L.a.RandomRange( + this.direction1.x, + this.direction2.x + ), + r = L.a.RandomRange( + this.direction1.y, + this.direction2.y + ), + o = L.a.RandomRange( + this.direction1.z, + this.direction2.z + ); + a.x.TransformNormalFromFloatsToRef(n, r, o, e, t); + }), + (t.prototype.clone = function () { + var e = new t( + this.radius, + this.direction1, + this.direction2 + ); + return M.a.DeepCopy(this, e), e; + }), + (t.prototype.applyToShader = function (e) { + e.setFloat("radius", this.radius), e.setFloat("radiusRange", this.radiusRange), e.setVector3("direction1", this.direction1), - e.setVector3("direction2", this.direction2) - } - , - t.prototype.getEffectDefines = function() { - return "#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER" - } - , - t.prototype.getClassName = function() { - return "SphereDirectedParticleEmitter" - } - , - t.prototype.serialize = function() { - var t = e.prototype.serialize.call(this); - return t.direction1 = this.direction1.asArray(), - t.direction2 = this.direction2.asArray(), + e.setVector3("direction2", this.direction2); + }), + (t.prototype.getEffectDefines = function () { + return "#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER"; + }), + (t.prototype.getClassName = function () { + return "SphereDirectedParticleEmitter"; + }), + (t.prototype.serialize = function () { + var t = e.prototype.serialize.call(this); + return ( + (t.direction1 = this.direction1.asArray()), + (t.direction2 = this.direction2.asArray()), t - } - , - t.prototype.parse = function(t) { - e.prototype.parse.call(this, t), + ); + }), + (t.prototype.parse = function (t) { + e.prototype.parse.call(this, t), this.direction1.copyFrom(t.direction1), - this.direction2.copyFrom(t.direction2) - } - , + this.direction2.copyFrom(t.direction2); + }), t - }(Pa), Ma = function() { - function e(t) { - this.animations = [], - this.renderingGroupId = 0, - this.emitter = null, - this.emitRate = 10, - this.manualEmitCount = -1, - this.updateSpeed = .01, - this.targetStopDuration = 0, - this.disposeOnStop = false, - this.minEmitPower = 1, - this.maxEmitPower = 1, - this.minLifeTime = 1, - this.maxLifeTime = 1, - this.minSize = 1, - this.maxSize = 1, - this.minScaleX = 1, - this.maxScaleX = 1, - this.minScaleY = 1, - this.maxScaleY = 1, - this.minInitialRotation = 0, - this.maxInitialRotation = 0, - this.minAngularSpeed = 0, - this.maxAngularSpeed = 0, - this.layerMask = 268435455, - this.customShader = null, - this.preventAutoStart = false, - this.noiseStrength = new a.x(10,10,10), - this.onAnimationEnd = null, - this.blendMode = e.BLENDMODE_ONEONE, - this.forceDepthWrite = false, - this.preWarmCycles = 0, - this.preWarmStepOffset = 1, - this.spriteCellChangeSpeed = 1, - this.startSpriteCellID = 0, - this.endSpriteCellID = 0, - this.spriteCellWidth = 0, - this.spriteCellHeight = 0, - this.spriteRandomStartCell = false, - this.translationPivot = new a.w(0,0), - this.beginAnimationOnStart = false, - this.beginAnimationFrom = 0, - this.beginAnimationTo = 60, - this.beginAnimationLoop = false, - this.worldOffset = new a.x(0,0,0), - this.gravity = a.x.Zero(), - this._colorGradients = null, - this._sizeGradients = null, - this._lifeTimeGradients = null, - this._angularSpeedGradients = null, - this._velocityGradients = null, - this._limitVelocityGradients = null, - this._dragGradients = null, - this._emitRateGradients = null, - this._startSizeGradients = null, - this._rampGradients = null, - this._colorRemapGradients = null, - this._alphaRemapGradients = null, - this.startDelay = 0, - this.limitVelocityDamping = .4, - this.color1 = new a.f(1,1,1,1), - this.color2 = new a.f(1,1,1,1), - this.colorDead = new a.f(0,0,0,1), - this.textureMask = new a.f(1,1,1,1), - this._isSubEmitter = false, - this.billboardMode = _.a.PARTICLES_BILLBOARDMODE_ALL, - this._isBillboardBased = true, - this._imageProcessingConfigurationDefines = new yi.b, - this.id = t, - this.name = t - } - return Object.defineProperty(e.prototype, "noiseTexture", { - get: function() { - return this._noiseTexture + ); + })(Pa), + Ma = (function () { + function e(t) { + (this.animations = []), + (this.renderingGroupId = 0), + (this.emitter = null), + (this.emitRate = 10), + (this.manualEmitCount = -1), + (this.updateSpeed = 0.01), + (this.targetStopDuration = 0), + (this.disposeOnStop = false), + (this.minEmitPower = 1), + (this.maxEmitPower = 1), + (this.minLifeTime = 1), + (this.maxLifeTime = 1), + (this.minSize = 1), + (this.maxSize = 1), + (this.minScaleX = 1), + (this.maxScaleX = 1), + (this.minScaleY = 1), + (this.maxScaleY = 1), + (this.minInitialRotation = 0), + (this.maxInitialRotation = 0), + (this.minAngularSpeed = 0), + (this.maxAngularSpeed = 0), + (this.layerMask = 268435455), + (this.customShader = null), + (this.preventAutoStart = false), + (this.noiseStrength = new a.x(10, 10, 10)), + (this.onAnimationEnd = null), + (this.blendMode = e.BLENDMODE_ONEONE), + (this.forceDepthWrite = false), + (this.preWarmCycles = 0), + (this.preWarmStepOffset = 1), + (this.spriteCellChangeSpeed = 1), + (this.startSpriteCellID = 0), + (this.endSpriteCellID = 0), + (this.spriteCellWidth = 0), + (this.spriteCellHeight = 0), + (this.spriteRandomStartCell = false), + (this.translationPivot = new a.w(0, 0)), + (this.beginAnimationOnStart = false), + (this.beginAnimationFrom = 0), + (this.beginAnimationTo = 60), + (this.beginAnimationLoop = false), + (this.worldOffset = new a.x(0, 0, 0)), + (this.gravity = a.x.Zero()), + (this._colorGradients = null), + (this._sizeGradients = null), + (this._lifeTimeGradients = null), + (this._angularSpeedGradients = null), + (this._velocityGradients = null), + (this._limitVelocityGradients = null), + (this._dragGradients = null), + (this._emitRateGradients = null), + (this._startSizeGradients = null), + (this._rampGradients = null), + (this._colorRemapGradients = null), + (this._alphaRemapGradients = null), + (this.startDelay = 0), + (this.limitVelocityDamping = 0.4), + (this.color1 = new a.f(1, 1, 1, 1)), + (this.color2 = new a.f(1, 1, 1, 1)), + (this.colorDead = new a.f(0, 0, 0, 1)), + (this.textureMask = new a.f(1, 1, 1, 1)), + (this._isSubEmitter = false), + (this.billboardMode = _.a.PARTICLES_BILLBOARDMODE_ALL), + (this._isBillboardBased = true), + (this._imageProcessingConfigurationDefines = new yi.b()), + (this.id = t), + (this.name = t); + } + return ( + Object.defineProperty(e.prototype, "noiseTexture", { + get: function () { + return this._noiseTexture; + }, + set: function (e) { + this._noiseTexture !== e && + ((this._noiseTexture = e), this._reset()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "isAnimationSheetEnabled", + { + get: function () { + return this._isAnimationSheetEnabled; }, - set: function(e) { - this._noiseTexture !== e && (this._noiseTexture = e, - this._reset()) + set: function (e) { + this._isAnimationSheetEnabled != e && + ((this._isAnimationSheetEnabled = e), + this._reset()); }, enumerable: true, - configurable: true + configurable: true, + } + ), + (e.prototype.getScene = function () { + return this._scene; }), - Object.defineProperty(e.prototype, "isAnimationSheetEnabled", { - get: function() { - return this._isAnimationSheetEnabled - }, - set: function(e) { - this._isAnimationSheetEnabled != e && (this._isAnimationSheetEnabled = e, - this._reset()) - }, - enumerable: true, - configurable: true + (e.prototype._hasTargetStopDurationDependantGradient = + function () { + return ( + (this._startSizeGradients && + this._startSizeGradients.length > 0) || + (this._emitRateGradients && + this._emitRateGradients.length > 0) || + (this._lifeTimeGradients && + this._lifeTimeGradients.length > 0) + ); + }), + (e.prototype.getDragGradients = function () { + return this._dragGradients; + }), + (e.prototype.getLimitVelocityGradients = function () { + return this._limitVelocityGradients; + }), + (e.prototype.getColorGradients = function () { + return this._colorGradients; + }), + (e.prototype.getSizeGradients = function () { + return this._sizeGradients; + }), + (e.prototype.getColorRemapGradients = function () { + return this._colorRemapGradients; + }), + (e.prototype.getAlphaRemapGradients = function () { + return this._alphaRemapGradients; + }), + (e.prototype.getLifeTimeGradients = function () { + return this._lifeTimeGradients; + }), + (e.prototype.getAngularSpeedGradients = function () { + return this._angularSpeedGradients; + }), + (e.prototype.getVelocityGradients = function () { + return this._velocityGradients; + }), + (e.prototype.getStartSizeGradients = function () { + return this._startSizeGradients; + }), + (e.prototype.getEmitRateGradients = function () { + return this._emitRateGradients; }), - e.prototype.getScene = function() { - return this._scene - } - , - e.prototype._hasTargetStopDurationDependantGradient = function() { - return this._startSizeGradients && this._startSizeGradients.length > 0 || this._emitRateGradients && this._emitRateGradients.length > 0 || this._lifeTimeGradients && this._lifeTimeGradients.length > 0 - } - , - e.prototype.getDragGradients = function() { - return this._dragGradients - } - , - e.prototype.getLimitVelocityGradients = function() { - return this._limitVelocityGradients - } - , - e.prototype.getColorGradients = function() { - return this._colorGradients - } - , - e.prototype.getSizeGradients = function() { - return this._sizeGradients - } - , - e.prototype.getColorRemapGradients = function() { - return this._colorRemapGradients - } - , - e.prototype.getAlphaRemapGradients = function() { - return this._alphaRemapGradients - } - , - e.prototype.getLifeTimeGradients = function() { - return this._lifeTimeGradients - } - , - e.prototype.getAngularSpeedGradients = function() { - return this._angularSpeedGradients - } - , - e.prototype.getVelocityGradients = function() { - return this._velocityGradients - } - , - e.prototype.getStartSizeGradients = function() { - return this._startSizeGradients - } - , - e.prototype.getEmitRateGradients = function() { - return this._emitRateGradients - } - , Object.defineProperty(e.prototype, "direction1", { - get: function() { - return this.particleEmitterType.direction1 ? this.particleEmitterType.direction1 : a.x.Zero() - }, - set: function(e) { - this.particleEmitterType.direction1 && (this.particleEmitterType.direction1 = e) - }, - enumerable: true, - configurable: true + get: function () { + return this.particleEmitterType.direction1 + ? this.particleEmitterType.direction1 + : a.x.Zero(); + }, + set: function (e) { + this.particleEmitterType.direction1 && + (this.particleEmitterType.direction1 = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "direction2", { - get: function() { - return this.particleEmitterType.direction2 ? this.particleEmitterType.direction2 : a.x.Zero() - }, - set: function(e) { - this.particleEmitterType.direction2 && (this.particleEmitterType.direction2 = e) - }, - enumerable: true, - configurable: true + get: function () { + return this.particleEmitterType.direction2 + ? this.particleEmitterType.direction2 + : a.x.Zero(); + }, + set: function (e) { + this.particleEmitterType.direction2 && + (this.particleEmitterType.direction2 = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "minEmitBox", { - get: function() { - return this.particleEmitterType.minEmitBox ? this.particleEmitterType.minEmitBox : a.x.Zero() - }, - set: function(e) { - this.particleEmitterType.minEmitBox && (this.particleEmitterType.minEmitBox = e) - }, - enumerable: true, - configurable: true + get: function () { + return this.particleEmitterType.minEmitBox + ? this.particleEmitterType.minEmitBox + : a.x.Zero(); + }, + set: function (e) { + this.particleEmitterType.minEmitBox && + (this.particleEmitterType.minEmitBox = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "maxEmitBox", { - get: function() { - return this.particleEmitterType.maxEmitBox ? this.particleEmitterType.maxEmitBox : a.x.Zero() - }, - set: function(e) { - this.particleEmitterType.maxEmitBox && (this.particleEmitterType.maxEmitBox = e) - }, - enumerable: true, - configurable: true + get: function () { + return this.particleEmitterType.maxEmitBox + ? this.particleEmitterType.maxEmitBox + : a.x.Zero(); + }, + set: function (e) { + this.particleEmitterType.maxEmitBox && + (this.particleEmitterType.maxEmitBox = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isBillboardBased", { - get: function() { - return this._isBillboardBased + get: function () { + return this._isBillboardBased; + }, + set: function (e) { + this._isBillboardBased !== e && + ((this._isBillboardBased = e), this._reset()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "imageProcessingConfiguration", + { + get: function () { + return this._imageProcessingConfiguration; }, - set: function(e) { - this._isBillboardBased !== e && (this._isBillboardBased = e, - this._reset()) + set: function (e) { + this._attachImageProcessingConfiguration(e); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "imageProcessingConfiguration", { - get: function() { - return this._imageProcessingConfiguration - }, - set: function(e) { - this._attachImageProcessingConfiguration(e) - }, - enumerable: true, - configurable: true - }), - e.prototype._attachImageProcessingConfiguration = function(e) { - e !== this._imageProcessingConfiguration && (this._imageProcessingConfiguration = e || this._scene.imageProcessingConfiguration) - } - , - e.prototype._reset = function() {} - , - e.prototype._removeGradientAndTexture = function(e, t, i) { - if (!t) - return this; - for (var n = 0, r = 0, o = t; r < o.length; r++) { - if (o[r].gradient === e) { - t.splice(n, 1); - break - } - n++ + configurable: true, + } + ), + (e.prototype._attachImageProcessingConfiguration = + function (e) { + e !== this._imageProcessingConfiguration && + (this._imageProcessingConfiguration = + e || this._scene.imageProcessingConfiguration); + }), + (e.prototype._reset = function () {}), + (e.prototype._removeGradientAndTexture = function ( + e, + t, + i + ) { + if (!t) return this; + for (var n = 0, r = 0, o = t; r < o.length; r++) { + if (o[r].gradient === e) { + t.splice(n, 1); + break; } - return i && i.dispose(), - this - } - , - e.prototype.createPointEmitter = function(e, t) { - var i = new Ca; - return i.direction1 = e, - i.direction2 = t, - this.particleEmitterType = i, + n++; + } + return i && i.dispose(), this; + }), + (e.prototype.createPointEmitter = function (e, t) { + var i = new Ca(); + return ( + (i.direction1 = e), + (i.direction2 = t), + (this.particleEmitterType = i), i - } - , - e.prototype.createHemisphericEmitter = function(e, t) { - void 0 === e && (e = 1), - void 0 === t && (t = 1); - var i = new Sa(e,t); - return this.particleEmitterType = i, - i - } - , - e.prototype.createSphereEmitter = function(e, t) { - void 0 === e && (e = 1), - void 0 === t && (t = 1); - var i = new Pa(e,t); - return this.particleEmitterType = i, - i - } - , - e.prototype.createDirectedSphereEmitter = function(e, t, i) { - void 0 === e && (e = 1), - void 0 === t && (t = new a.x(0,1,0)), - void 0 === i && (i = new a.x(0,1,0)); - var n = new Ra(e,t,i); - return this.particleEmitterType = n, - n - } - , - e.prototype.createCylinderEmitter = function(e, t, i, n) { - void 0 === e && (e = 1), + ); + }), + (e.prototype.createHemisphericEmitter = function (e, t) { + void 0 === e && (e = 1), void 0 === t && (t = 1); + var i = new Sa(e, t); + return (this.particleEmitterType = i), i; + }), + (e.prototype.createSphereEmitter = function (e, t) { + void 0 === e && (e = 1), void 0 === t && (t = 1); + var i = new Pa(e, t); + return (this.particleEmitterType = i), i; + }), + (e.prototype.createDirectedSphereEmitter = function ( + e, + t, + i + ) { + void 0 === e && (e = 1), + void 0 === t && (t = new a.x(0, 1, 0)), + void 0 === i && (i = new a.x(0, 1, 0)); + var n = new Ra(e, t, i); + return (this.particleEmitterType = n), n; + }), + (e.prototype.createCylinderEmitter = function (e, t, i, n) { + void 0 === e && (e = 1), void 0 === t && (t = 1), void 0 === i && (i = 1), void 0 === n && (n = 0); - var r = new Aa(e,t,i,n); - return this.particleEmitterType = r, - r - } - , - e.prototype.createDirectedCylinderEmitter = function(e, t, i, n, r) { - void 0 === e && (e = 1), + var r = new Aa(e, t, i, n); + return (this.particleEmitterType = r), r; + }), + (e.prototype.createDirectedCylinderEmitter = function ( + e, + t, + i, + n, + r + ) { + void 0 === e && (e = 1), void 0 === t && (t = 1), void 0 === i && (i = 1), - void 0 === n && (n = new a.x(0,1,0)), - void 0 === r && (r = new a.x(0,1,0)); - var o = new xa(e,t,i,n,r); - return this.particleEmitterType = o, - o - } - , - e.prototype.createConeEmitter = function(e, t) { - void 0 === e && (e = 1), + void 0 === n && (n = new a.x(0, 1, 0)), + void 0 === r && (r = new a.x(0, 1, 0)); + var o = new xa(e, t, i, n, r); + return (this.particleEmitterType = o), o; + }), + (e.prototype.createConeEmitter = function (e, t) { + void 0 === e && (e = 1), void 0 === t && (t = Math.PI / 4); - var i = new Ta(e,t); - return this.particleEmitterType = i, - i - } - , - e.prototype.createBoxEmitter = function(e, t, i, n) { - var r = new Ea; - return this.particleEmitterType = r, - this.direction1 = e, - this.direction2 = t, - this.minEmitBox = i, - this.maxEmitBox = n, + var i = new Ta(e, t); + return (this.particleEmitterType = i), i; + }), + (e.prototype.createBoxEmitter = function (e, t, i, n) { + var r = new Ea(); + return ( + (this.particleEmitterType = r), + (this.direction1 = e), + (this.direction2 = t), + (this.minEmitBox = i), + (this.maxEmitBox = n), r - } - , - e.BLENDMODE_ONEONE = 0, - e.BLENDMODE_STANDARD = 1, - e.BLENDMODE_ADD = 2, - e.BLENDMODE_MULTIPLY = 3, - e.BLENDMODE_MULTIPLYADD = 4, + ); + }), + (e.BLENDMODE_ONEONE = 0), + (e.BLENDMODE_STANDARD = 1), + (e.BLENDMODE_ADD = 2), + (e.BLENDMODE_MULTIPLY = 3), + (e.BLENDMODE_MULTIPLYADD = 4), e - }(), Oa = function() { - function e(t) { - this.particleSystem = t, - this.position = a.x.Zero(), - this.direction = a.x.Zero(), - this.color = new a.f(0,0,0,0), - this.colorStep = new a.f(0,0,0,0), - this.lifeTime = 1, - this.age = 0, - this.size = 0, - this.scale = new a.w(1,1), - this.angle = 0, - this.angularSpeed = 0, - this.cellIndex = 0, - this._attachedSubEmitters = null, - this._currentColor1 = new a.f(0,0,0,0), - this._currentColor2 = new a.f(0,0,0,0), - this._currentSize1 = 0, - this._currentSize2 = 0, - this._currentAngularSpeed1 = 0, - this._currentAngularSpeed2 = 0, - this._currentVelocity1 = 0, - this._currentVelocity2 = 0, - this._currentLimitVelocity1 = 0, - this._currentLimitVelocity2 = 0, - this._currentDrag1 = 0, - this._currentDrag2 = 0, - this.id = e._Count++, - this.particleSystem.isAnimationSheetEnabled && this.updateCellInfoFromSystem() - } - return e.prototype.updateCellInfoFromSystem = function() { - this.cellIndex = this.particleSystem.startSpriteCellID - } - , - e.prototype.updateCellIndex = function() { - var e = this.age - , t = this.particleSystem.spriteCellChangeSpeed; - this.particleSystem.spriteRandomStartCell && (void 0 === this._randomCellOffset && (this._randomCellOffset = Math.random() * this.lifeTime), - 0 === t ? (t = 1, - e = this._randomCellOffset) : e += this._randomCellOffset); - var i = this._initialEndSpriteCellID - this._initialStartSpriteCellID - , n = L.a.Clamp(e * t % this.lifeTime / this.lifeTime); - this.cellIndex = this._initialStartSpriteCellID + n * i | 0 - } - , - e.prototype._inheritParticleInfoToSubEmitter = function(e) { - if (e.particleSystem.emitter.position) { - var t = e.particleSystem.emitter; - t.position.copyFrom(this.position), - e.inheritDirection && (t.position.subtractToRef(this.direction, a.t.Vector3[0]), - t.lookAt(a.t.Vector3[0], 0, Math.PI / 2)) - } else - e.particleSystem.emitter.copyFrom(this.position); - this.direction.scaleToRef(e.inheritedVelocityAmount / 2, a.t.Vector3[0]), - e.particleSystem._inheritedVelocityOffset.copyFrom(a.t.Vector3[0]) - } - , - e.prototype._inheritParticleInfoToSubEmitters = function() { + ); + })(), + Oa = (function () { + function e(t) { + (this.particleSystem = t), + (this.position = a.x.Zero()), + (this.direction = a.x.Zero()), + (this.color = new a.f(0, 0, 0, 0)), + (this.colorStep = new a.f(0, 0, 0, 0)), + (this.lifeTime = 1), + (this.age = 0), + (this.size = 0), + (this.scale = new a.w(1, 1)), + (this.angle = 0), + (this.angularSpeed = 0), + (this.cellIndex = 0), + (this._attachedSubEmitters = null), + (this._currentColor1 = new a.f(0, 0, 0, 0)), + (this._currentColor2 = new a.f(0, 0, 0, 0)), + (this._currentSize1 = 0), + (this._currentSize2 = 0), + (this._currentAngularSpeed1 = 0), + (this._currentAngularSpeed2 = 0), + (this._currentVelocity1 = 0), + (this._currentVelocity2 = 0), + (this._currentLimitVelocity1 = 0), + (this._currentLimitVelocity2 = 0), + (this._currentDrag1 = 0), + (this._currentDrag2 = 0), + (this.id = e._Count++), + this.particleSystem.isAnimationSheetEnabled && + this.updateCellInfoFromSystem(); + } + return ( + (e.prototype.updateCellInfoFromSystem = function () { + this.cellIndex = this.particleSystem.startSpriteCellID; + }), + (e.prototype.updateCellIndex = function () { + var e = this.age, + t = this.particleSystem.spriteCellChangeSpeed; + this.particleSystem.spriteRandomStartCell && + (void 0 === this._randomCellOffset && + (this._randomCellOffset = + Math.random() * this.lifeTime), + 0 === t + ? ((t = 1), (e = this._randomCellOffset)) + : (e += this._randomCellOffset)); + var i = + this._initialEndSpriteCellID - + this._initialStartSpriteCellID, + n = L.a.Clamp( + ((e * t) % this.lifeTime) / this.lifeTime + ); + this.cellIndex = + (this._initialStartSpriteCellID + n * i) | 0; + }), + (e.prototype._inheritParticleInfoToSubEmitter = function ( + e + ) { + if (e.particleSystem.emitter.position) { + var t = e.particleSystem.emitter; + t.position.copyFrom(this.position), + e.inheritDirection && + (t.position.subtractToRef( + this.direction, + a.t.Vector3[0] + ), + t.lookAt(a.t.Vector3[0], 0, Math.PI / 2)); + } else e.particleSystem.emitter.copyFrom(this.position); + this.direction.scaleToRef( + e.inheritedVelocityAmount / 2, + a.t.Vector3[0] + ), + e.particleSystem._inheritedVelocityOffset.copyFrom( + a.t.Vector3[0] + ); + }), + (e.prototype._inheritParticleInfoToSubEmitters = + function () { var e = this; - this._attachedSubEmitters && this._attachedSubEmitters.length > 0 && this._attachedSubEmitters.forEach(function(t) { - e._inheritParticleInfoToSubEmitter(t) - }) - } - , - e.prototype._reset = function() { - this.age = 0, - this._currentColorGradient = null, - this._currentSizeGradient = null, - this._currentAngularSpeedGradient = null, - this._currentVelocityGradient = null, - this._currentLimitVelocityGradient = null, - this._currentDragGradient = null, - this.cellIndex = this.particleSystem.startSpriteCellID, - this._randomCellOffset = void 0 - } - , - e.prototype.copyTo = function(e) { - e.position.copyFrom(this.position), - this._initialDirection ? e._initialDirection ? e._initialDirection.copyFrom(this._initialDirection) : e._initialDirection = this._initialDirection.clone() : e._initialDirection = null, + this._attachedSubEmitters && + this._attachedSubEmitters.length > 0 && + this._attachedSubEmitters.forEach(function (t) { + e._inheritParticleInfoToSubEmitter(t); + }); + }), + (e.prototype._reset = function () { + (this.age = 0), + (this._currentColorGradient = null), + (this._currentSizeGradient = null), + (this._currentAngularSpeedGradient = null), + (this._currentVelocityGradient = null), + (this._currentLimitVelocityGradient = null), + (this._currentDragGradient = null), + (this.cellIndex = + this.particleSystem.startSpriteCellID), + (this._randomCellOffset = void 0); + }), + (e.prototype.copyTo = function (e) { + e.position.copyFrom(this.position), + this._initialDirection + ? e._initialDirection + ? e._initialDirection.copyFrom( + this._initialDirection + ) + : (e._initialDirection = + this._initialDirection.clone()) + : (e._initialDirection = null), e.direction.copyFrom(this.direction), e.color.copyFrom(this.color), e.colorStep.copyFrom(this.colorStep), - e.lifeTime = this.lifeTime, - e.age = this.age, - e._randomCellOffset = this._randomCellOffset, - e.size = this.size, + (e.lifeTime = this.lifeTime), + (e.age = this.age), + (e._randomCellOffset = this._randomCellOffset), + (e.size = this.size), e.scale.copyFrom(this.scale), - e.angle = this.angle, - e.angularSpeed = this.angularSpeed, - e.particleSystem = this.particleSystem, - e.cellIndex = this.cellIndex, - e.id = this.id, - e._attachedSubEmitters = this._attachedSubEmitters, - this._currentColorGradient && (e._currentColorGradient = this._currentColorGradient, - e._currentColor1.copyFrom(this._currentColor1), - e._currentColor2.copyFrom(this._currentColor2)), - this._currentSizeGradient && (e._currentSizeGradient = this._currentSizeGradient, - e._currentSize1 = this._currentSize1, - e._currentSize2 = this._currentSize2), - this._currentAngularSpeedGradient && (e._currentAngularSpeedGradient = this._currentAngularSpeedGradient, - e._currentAngularSpeed1 = this._currentAngularSpeed1, - e._currentAngularSpeed2 = this._currentAngularSpeed2), - this._currentVelocityGradient && (e._currentVelocityGradient = this._currentVelocityGradient, - e._currentVelocity1 = this._currentVelocity1, - e._currentVelocity2 = this._currentVelocity2), - this._currentLimitVelocityGradient && (e._currentLimitVelocityGradient = this._currentLimitVelocityGradient, - e._currentLimitVelocity1 = this._currentLimitVelocity1, - e._currentLimitVelocity2 = this._currentLimitVelocity2), - this._currentDragGradient && (e._currentDragGradient = this._currentDragGradient, - e._currentDrag1 = this._currentDrag1, - e._currentDrag2 = this._currentDrag2), - this.particleSystem.isAnimationSheetEnabled && (e._initialStartSpriteCellID = this._initialStartSpriteCellID, - e._initialEndSpriteCellID = this._initialEndSpriteCellID), - this.particleSystem.useRampGradients && e.remapData.copyFrom(this.remapData), - this._randomNoiseCoordinates1 && (e._randomNoiseCoordinates1 ? (e._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1), - e._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)) : (e._randomNoiseCoordinates1 = this._randomNoiseCoordinates1.clone(), - e._randomNoiseCoordinates2 = this._randomNoiseCoordinates2.clone())) - } - , - e._Count = 0, + (e.angle = this.angle), + (e.angularSpeed = this.angularSpeed), + (e.particleSystem = this.particleSystem), + (e.cellIndex = this.cellIndex), + (e.id = this.id), + (e._attachedSubEmitters = this._attachedSubEmitters), + this._currentColorGradient && + ((e._currentColorGradient = + this._currentColorGradient), + e._currentColor1.copyFrom(this._currentColor1), + e._currentColor2.copyFrom(this._currentColor2)), + this._currentSizeGradient && + ((e._currentSizeGradient = this._currentSizeGradient), + (e._currentSize1 = this._currentSize1), + (e._currentSize2 = this._currentSize2)), + this._currentAngularSpeedGradient && + ((e._currentAngularSpeedGradient = + this._currentAngularSpeedGradient), + (e._currentAngularSpeed1 = + this._currentAngularSpeed1), + (e._currentAngularSpeed2 = + this._currentAngularSpeed2)), + this._currentVelocityGradient && + ((e._currentVelocityGradient = + this._currentVelocityGradient), + (e._currentVelocity1 = this._currentVelocity1), + (e._currentVelocity2 = this._currentVelocity2)), + this._currentLimitVelocityGradient && + ((e._currentLimitVelocityGradient = + this._currentLimitVelocityGradient), + (e._currentLimitVelocity1 = + this._currentLimitVelocity1), + (e._currentLimitVelocity2 = + this._currentLimitVelocity2)), + this._currentDragGradient && + ((e._currentDragGradient = this._currentDragGradient), + (e._currentDrag1 = this._currentDrag1), + (e._currentDrag2 = this._currentDrag2)), + this.particleSystem.isAnimationSheetEnabled && + ((e._initialStartSpriteCellID = + this._initialStartSpriteCellID), + (e._initialEndSpriteCellID = + this._initialEndSpriteCellID)), + this.particleSystem.useRampGradients && + e.remapData.copyFrom(this.remapData), + this._randomNoiseCoordinates1 && + (e._randomNoiseCoordinates1 + ? (e._randomNoiseCoordinates1.copyFrom( + this._randomNoiseCoordinates1 + ), + e._randomNoiseCoordinates2.copyFrom( + this._randomNoiseCoordinates2 + )) + : ((e._randomNoiseCoordinates1 = + this._randomNoiseCoordinates1.clone()), + (e._randomNoiseCoordinates2 = + this._randomNoiseCoordinates2.clone()))); + }), + (e._Count = 0), e - }(); - !function(e) { - e[e.ATTACHED = 0] = "ATTACHED", - e[e.END = 1] = "END" - }(ya || (ya = {})); - var wa = function() { - function e(e) { - this.particleSystem = e, - this.type = ya.END, - this.inheritDirection = false, - this.inheritedVelocityAmount = 0, - e.emitter && e.emitter.dispose || (e.emitter = new Ne.a("SubemitterSystemEmitter",e.getScene())), - e.onDisposeObservable.add(function() { - e.emitter && e.emitter.dispose && e.emitter.dispose() - }) - } - return e.prototype.clone = function() { - var t = this.particleSystem.emitter; - t ? t instanceof a.x ? t = t.clone() : t instanceof Ne.a && ((t = new me.a("",t.getScene())).isVisible = false) : t = new a.x; - var i = new e(this.particleSystem.clone("", t)); - return i.type = this.type, - i.inheritDirection = this.inheritDirection, - i.inheritedVelocityAmount = this.inheritedVelocityAmount, - i.particleSystem._disposeEmitterOnDispose = true, - i.particleSystem.disposeOnStop = true, - i - } - , - e.prototype.serialize = function() { - var e = {}; - return e.type = this.type, - e.inheritDirection = this.inheritDirection, - e.inheritedVelocityAmount = this.inheritedVelocityAmount, - e.particleSystem = this.particleSystem.serialize(), - e - } - , - e._ParseParticleSystem = function(e, t, i) { - throw Te.a.WarnImport("ParseParticle") - } - , - e.Parse = function(t, i, n) { - var r = t.particleSystem - , o = new e(e._ParseParticleSystem(r, i, n)); - return o.type = t.type, - o.inheritDirection = t.inheritDirection, - o.inheritedVelocityAmount = t.inheritedVelocityAmount, - o.particleSystem._isSubEmitter = true, - o - } - , - e.prototype.dispose = function() { - this.particleSystem.dispose() - } - , - e - }(); - Ht.a.ShadersStore.particlesPixelShader = "\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#include\n#include\n#include\n#include\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\nuniform sampler2D rampSampler;\n#endif\nvoid main(void) {\n#include\nvec4 textureColor=texture2D(diffuseSampler,vUV);\nvec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n#ifdef RAMPGRADIENT\nfloat alpha=baseColor.a;\nfloat remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);\nvec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));\nbaseColor.rgb*=rampColor.rgb;\n\nfloat finalAlpha=baseColor.a;\nbaseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nfloat sourceAlpha=vColor.a*textureColor.a;\nbaseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\n#endif\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\nbaseColor=applyImageProcessing(baseColor);\n#endif\n#endif\ngl_FragColor=baseColor;\n}"; - Ht.a.ShadersStore.particlesVertexShader = "\nattribute vec3 position;\nattribute vec4 color;\nattribute float angle;\nattribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;\n\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos;\n#endif\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nuniform mat4 invView;\n#endif\n#include\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#endif\nvoid main(void) {\nvec2 cornerPos;\ncornerPos=(vec2(offset.x-0.5,offset.y-0.5)-translationPivot)*size+translationPivot;\n#ifdef BILLBOARD\n\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=position-eyePosition;\nyaxis.y=0.;\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=position-eyePosition;\nvec3 worldPos=rotateAlign(toCamera,rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\n\ngl_Position=projection*vec4(viewPos,1.0);\n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=normalize(direction);\nvec3 worldPos=rotate(yaxis,rotatedCorner);\ngl_Position=projection*view*vec4(worldPos,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/particlesInfos.z);\nfloat columnOffset=cellIndex-rowOffset*particlesInfos.z;\nvec2 uvScale=particlesInfos.xy;\nvec2 uvOffset=vec2(offset.x ,1.0-offset.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nvec4 worldPos=invView*vec4(viewPos,1.0);\n#endif\n#include\n}"; - var Ia = function(e) { - function t(t, i, n, r, s, c) { - void 0 === r && (r = null), - void 0 === s && (s = false), - void 0 === c && (c = .01); - var u = e.call(this, t) || this; - return u._inheritedVelocityOffset = new a.x, - u.onDisposeObservable = new o.c, - u._particles = new Array, - u._stockParticles = new Array, - u._newPartsExcess = 0, - u._vertexBuffers = {}, - u._scaledColorStep = new a.f(0,0,0,0), - u._colorDiff = new a.f(0,0,0,0), - u._scaledDirection = a.x.Zero(), - u._scaledGravity = a.x.Zero(), - u._currentRenderId = -1, - u._useInstancing = false, - u._started = false, - u._stopped = false, - u._actualFrame = 0, - u._currentEmitRate1 = 0, - u._currentEmitRate2 = 0, - u._currentStartSize1 = 0, - u._currentStartSize2 = 0, - u._rawTextureWidth = 256, - u._useRampGradients = false, - u._disposeEmitterOnDispose = false, - u.recycleParticle = function(e) { - var t = u._particles.pop(); - t !== e && t.copyTo(e), - u._stockParticles.push(t) - } - , - u._createParticle = function() { - var e; - if (0 !== u._stockParticles.length ? (e = u._stockParticles.pop())._reset() : e = new Oa(u), - u._subEmitters && u._subEmitters.length > 0) { - var t = u._subEmitters[Math.floor(Math.random() * u._subEmitters.length)]; - e._attachedSubEmitters = [], - t.forEach(function(t) { - if (t.type === ya.ATTACHED) { - var i = t.clone(); - e._attachedSubEmitters.push(i), - i.particleSystem.start() - } - }) + ); + })(); + !(function (e) { + (e[(e.ATTACHED = 0)] = "ATTACHED"), (e[(e.END = 1)] = "END"); + })(ya || (ya = {})); + var wa = (function () { + function e(e) { + (this.particleSystem = e), + (this.type = ya.END), + (this.inheritDirection = false), + (this.inheritedVelocityAmount = 0), + (e.emitter && e.emitter.dispose) || + (e.emitter = new Ne.a( + "SubemitterSystemEmitter", + e.getScene() + )), + e.onDisposeObservable.add(function () { + e.emitter && e.emitter.dispose && e.emitter.dispose(); + }); + } + return ( + (e.prototype.clone = function () { + var t = this.particleSystem.emitter; + t + ? t instanceof a.x + ? (t = t.clone()) + : t instanceof Ne.a && + ((t = new me.a("", t.getScene())).isVisible = false) + : (t = new a.x()); + var i = new e(this.particleSystem.clone("", t)); + return ( + (i.type = this.type), + (i.inheritDirection = this.inheritDirection), + (i.inheritedVelocityAmount = + this.inheritedVelocityAmount), + (i.particleSystem._disposeEmitterOnDispose = true), + (i.particleSystem.disposeOnStop = true), + i + ); + }), + (e.prototype.serialize = function () { + var e = {}; + return ( + (e.type = this.type), + (e.inheritDirection = this.inheritDirection), + (e.inheritedVelocityAmount = + this.inheritedVelocityAmount), + (e.particleSystem = this.particleSystem.serialize()), + e + ); + }), + (e._ParseParticleSystem = function (e, t, i) { + throw Te.a.WarnImport("ParseParticle"); + }), + (e.Parse = function (t, i, n) { + var r = t.particleSystem, + o = new e(e._ParseParticleSystem(r, i, n)); + return ( + (o.type = t.type), + (o.inheritDirection = t.inheritDirection), + (o.inheritedVelocityAmount = t.inheritedVelocityAmount), + (o.particleSystem._isSubEmitter = true), + o + ); + }), + (e.prototype.dispose = function () { + this.particleSystem.dispose(); + }), + e + ); + })(); + Ht.a.ShadersStore.particlesPixelShader = + "\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#include\n#include\n#include\n#include\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\nuniform sampler2D rampSampler;\n#endif\nvoid main(void) {\n#include\nvec4 textureColor=texture2D(diffuseSampler,vUV);\nvec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n#ifdef RAMPGRADIENT\nfloat alpha=baseColor.a;\nfloat remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);\nvec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));\nbaseColor.rgb*=rampColor.rgb;\n\nfloat finalAlpha=baseColor.a;\nbaseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nfloat sourceAlpha=vColor.a*textureColor.a;\nbaseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\n#endif\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\nbaseColor=applyImageProcessing(baseColor);\n#endif\n#endif\ngl_FragColor=baseColor;\n}"; + Ht.a.ShadersStore.particlesVertexShader = + "\nattribute vec3 position;\nattribute vec4 color;\nattribute float angle;\nattribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;\n\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos;\n#endif\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nuniform mat4 invView;\n#endif\n#include\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#endif\nvoid main(void) {\nvec2 cornerPos;\ncornerPos=(vec2(offset.x-0.5,offset.y-0.5)-translationPivot)*size+translationPivot;\n#ifdef BILLBOARD\n\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=position-eyePosition;\nyaxis.y=0.;\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=position-eyePosition;\nvec3 worldPos=rotateAlign(toCamera,rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\n\ngl_Position=projection*vec4(viewPos,1.0);\n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=normalize(direction);\nvec3 worldPos=rotate(yaxis,rotatedCorner);\ngl_Position=projection*view*vec4(worldPos,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/particlesInfos.z);\nfloat columnOffset=cellIndex-rowOffset*particlesInfos.z;\nvec2 uvScale=particlesInfos.xy;\nvec2 uvOffset=vec2(offset.x ,1.0-offset.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nvec4 worldPos=invView*vec4(viewPos,1.0);\n#endif\n#include\n}"; + var Ia = (function (e) { + function t(t, i, n, r, s, c) { + void 0 === r && (r = null), + void 0 === s && (s = false), + void 0 === c && (c = 0.01); + var u = e.call(this, t) || this; + return ( + (u._inheritedVelocityOffset = new a.x()), + (u.onDisposeObservable = new o.c()), + (u._particles = new Array()), + (u._stockParticles = new Array()), + (u._newPartsExcess = 0), + (u._vertexBuffers = {}), + (u._scaledColorStep = new a.f(0, 0, 0, 0)), + (u._colorDiff = new a.f(0, 0, 0, 0)), + (u._scaledDirection = a.x.Zero()), + (u._scaledGravity = a.x.Zero()), + (u._currentRenderId = -1), + (u._useInstancing = false), + (u._started = false), + (u._stopped = false), + (u._actualFrame = 0), + (u._currentEmitRate1 = 0), + (u._currentEmitRate2 = 0), + (u._currentStartSize1 = 0), + (u._currentStartSize2 = 0), + (u._rawTextureWidth = 256), + (u._useRampGradients = false), + (u._disposeEmitterOnDispose = false), + (u.recycleParticle = function (e) { + var t = u._particles.pop(); + t !== e && t.copyTo(e), u._stockParticles.push(t); + }), + (u._createParticle = function () { + var e; + if ( + (0 !== u._stockParticles.length + ? (e = u._stockParticles.pop())._reset() + : (e = new Oa(u)), + u._subEmitters && u._subEmitters.length > 0) + ) { + var t = + u._subEmitters[ + Math.floor(Math.random() * u._subEmitters.length) + ]; + (e._attachedSubEmitters = []), + t.forEach(function (t) { + if (t.type === ya.ATTACHED) { + var i = t.clone(); + e._attachedSubEmitters.push(i), + i.particleSystem.start(); } - return e - } - , - u._emitFromParticle = function(e) { - if (u._subEmitters && 0 !== u._subEmitters.length) { - var t = Math.floor(Math.random() * u._subEmitters.length); - u._subEmitters[t].forEach(function(t) { - if (t.type === ya.END) { - var i = t.clone(); - e._inheritParticleInfoToSubEmitter(i), - i.particleSystem._rootParticleSystem = u, - u.activeSubSystems.push(i.particleSystem), - i.particleSystem.start() - } - }) + }); + } + return e; + }), + (u._emitFromParticle = function (e) { + if (u._subEmitters && 0 !== u._subEmitters.length) { + var t = Math.floor( + Math.random() * u._subEmitters.length + ); + u._subEmitters[t].forEach(function (t) { + if (t.type === ya.END) { + var i = t.clone(); + e._inheritParticleInfoToSubEmitter(i), + (i.particleSystem._rootParticleSystem = u), + u.activeSubSystems.push(i.particleSystem), + i.particleSystem.start(); + } + }); + } + }), + (u._capacity = i), + (u._epsilon = c), + (u._isAnimationSheetEnabled = s), + (u._scene = n || R.a.LastCreatedScene), + u._attachImageProcessingConfiguration(null), + (u._customEffect = r), + u._scene.particleSystems.push(u), + (u._useInstancing = u._scene + .getEngine() + .getCaps().instancedArrays), + u._createIndexBuffer(), + u._createVertexBuffers(), + (u.particleEmitterType = new Ea()), + (u.updateFunction = function (e) { + var t = null, + i = null; + u.noiseTexture && + ((t = u.noiseTexture.getSize()), + (i = u.noiseTexture.getContent())); + for ( + var n, + r = function () { + n = e[o]; + var r = u._scaledUpdateSpeed, + s = n.age; + if (((n.age += r), n.age > n.lifeTime)) { + var c = n.age - s; + (r = ((n.lifeTime - s) * r) / c), + (n.age = n.lifeTime); } - } - , - u._capacity = i, - u._epsilon = c, - u._isAnimationSheetEnabled = s, - u._scene = n || R.a.LastCreatedScene, - u._attachImageProcessingConfiguration(null), - u._customEffect = r, - u._scene.particleSystems.push(u), - u._useInstancing = u._scene.getEngine().getCaps().instancedArrays, - u._createIndexBuffer(), - u._createVertexBuffers(), - u.particleEmitterType = new Ea, - u.updateFunction = function(e) { - var t = null - , i = null; - u.noiseTexture && (t = u.noiseTexture.getSize(), - i = u.noiseTexture.getContent()); - for (var n, r = function() { - n = e[o]; - var r = u._scaledUpdateSpeed - , s = n.age; - if (n.age += r, - n.age > n.lifeTime) { - var c = n.age - s; - r = (n.lifeTime - s) * r / c, - n.age = n.lifeTime - } - var l = n.age / n.lifeTime; - u._colorGradients && u._colorGradients.length > 0 ? Ee.h.GetCurrentGradient(l, u._colorGradients, function(e, t, i) { - e !== n._currentColorGradient && (n._currentColor1.copyFrom(n._currentColor2), - t.getColorToRef(n._currentColor2), - n._currentColorGradient = e), - a.f.LerpToRef(n._currentColor1, n._currentColor2, i, n.color) - }) : (n.colorStep.scaleToRef(r, u._scaledColorStep), + var l = n.age / n.lifeTime; + u._colorGradients && u._colorGradients.length > 0 + ? Ee.h.GetCurrentGradient( + l, + u._colorGradients, + function (e, t, i) { + e !== n._currentColorGradient && + (n._currentColor1.copyFrom( + n._currentColor2 + ), + t.getColorToRef(n._currentColor2), + (n._currentColorGradient = e)), + a.f.LerpToRef( + n._currentColor1, + n._currentColor2, + i, + n.color + ); + } + ) + : (n.colorStep.scaleToRef(r, u._scaledColorStep), n.color.addInPlace(u._scaledColorStep), n.color.a < 0 && (n.color.a = 0)), - u._angularSpeedGradients && u._angularSpeedGradients.length > 0 && Ee.h.GetCurrentGradient(l, u._angularSpeedGradients, function(e, t, i) { - e !== n._currentAngularSpeedGradient && (n._currentAngularSpeed1 = n._currentAngularSpeed2, - n._currentAngularSpeed2 = t.getFactor(), - n._currentAngularSpeedGradient = e), - n.angularSpeed = L.a.Lerp(n._currentAngularSpeed1, n._currentAngularSpeed2, i) - }), - n.angle += n.angularSpeed * r; - var h = r; - if (u._velocityGradients && u._velocityGradients.length > 0 && Ee.h.GetCurrentGradient(l, u._velocityGradients, function(e, t, i) { - e !== n._currentVelocityGradient && (n._currentVelocity1 = n._currentVelocity2, - n._currentVelocity2 = t.getFactor(), - n._currentVelocityGradient = e), - h *= L.a.Lerp(n._currentVelocity1, n._currentVelocity2, i) - }), - n.direction.scaleToRef(h, u._scaledDirection), - u._limitVelocityGradients && u._limitVelocityGradients.length > 0 && Ee.h.GetCurrentGradient(l, u._limitVelocityGradients, function(e, t, i) { - e !== n._currentLimitVelocityGradient && (n._currentLimitVelocity1 = n._currentLimitVelocity2, - n._currentLimitVelocity2 = t.getFactor(), - n._currentLimitVelocityGradient = e); - var r = L.a.Lerp(n._currentLimitVelocity1, n._currentLimitVelocity2, i); - n.direction.length() > r && n.direction.scaleInPlace(u.limitVelocityDamping) - }), - u._dragGradients && u._dragGradients.length > 0 && Ee.h.GetCurrentGradient(l, u._dragGradients, function(e, t, i) { - e !== n._currentDragGradient && (n._currentDrag1 = n._currentDrag2, - n._currentDrag2 = t.getFactor(), - n._currentDragGradient = e); - var r = L.a.Lerp(n._currentDrag1, n._currentDrag2, i); - u._scaledDirection.scaleInPlace(1 - r) - }), - n.position.addInPlace(u._scaledDirection), - i && t && n._randomNoiseCoordinates1) { - var f = u._fetchR(n._randomNoiseCoordinates1.x, n._randomNoiseCoordinates1.y, t.width, t.height, i) - , d = u._fetchR(n._randomNoiseCoordinates1.z, n._randomNoiseCoordinates2.x, t.width, t.height, i) - , p = u._fetchR(n._randomNoiseCoordinates2.y, n._randomNoiseCoordinates2.z, t.width, t.height, i) - , m = a.t.Vector3[0] - , g = a.t.Vector3[1]; - m.copyFromFloats((2 * f - 1) * u.noiseStrength.x, (2 * d - 1) * u.noiseStrength.y, (2 * p - 1) * u.noiseStrength.z), - m.scaleToRef(r, g), - n.direction.addInPlace(g) - } - if (u.gravity.scaleToRef(r, u._scaledGravity), - n.direction.addInPlace(u._scaledGravity), - u._sizeGradients && u._sizeGradients.length > 0 && Ee.h.GetCurrentGradient(l, u._sizeGradients, function(e, t, i) { - e !== n._currentSizeGradient && (n._currentSize1 = n._currentSize2, - n._currentSize2 = t.getFactor(), - n._currentSizeGradient = e), - n.size = L.a.Lerp(n._currentSize1, n._currentSize2, i) - }), - u._useRampGradients && (u._colorRemapGradients && u._colorRemapGradients.length > 0 && Ee.h.GetCurrentGradient(l, u._colorRemapGradients, function(e, t, i) { - var r = L.a.Lerp(e.factor1, t.factor1, i) - , o = L.a.Lerp(e.factor2, t.factor2, i); - n.remapData.x = r, - n.remapData.y = o - r - }), - u._alphaRemapGradients && u._alphaRemapGradients.length > 0 && Ee.h.GetCurrentGradient(l, u._alphaRemapGradients, function(e, t, i) { - var r = L.a.Lerp(e.factor1, t.factor1, i) - , o = L.a.Lerp(e.factor2, t.factor2, i); - n.remapData.z = r, - n.remapData.w = o - r - })), - u._isAnimationSheetEnabled && n.updateCellIndex(), - n._inheritParticleInfoToSubEmitters(), - n.age >= n.lifeTime) - return u._emitFromParticle(n), - n._attachedSubEmitters && (n._attachedSubEmitters.forEach(function(e) { - e.particleSystem.disposeOnStop = true, - e.particleSystem.stop() - }), - n._attachedSubEmitters = null), - u.recycleParticle(n), - o--, - "continue" - }, o = 0; o < e.length; o++) - r() - } - , - u - } - return h.d(t, e), - Object.defineProperty(t.prototype, "onDispose", { - set: function(e) { - this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), - this._onDisposeObserver = this.onDisposeObservable.add(e) - }, - enumerable: true, - configurable: true + u._angularSpeedGradients && + u._angularSpeedGradients.length > 0 && + Ee.h.GetCurrentGradient( + l, + u._angularSpeedGradients, + function (e, t, i) { + e !== n._currentAngularSpeedGradient && + ((n._currentAngularSpeed1 = + n._currentAngularSpeed2), + (n._currentAngularSpeed2 = t.getFactor()), + (n._currentAngularSpeedGradient = e)), + (n.angularSpeed = L.a.Lerp( + n._currentAngularSpeed1, + n._currentAngularSpeed2, + i + )); + } + ), + (n.angle += n.angularSpeed * r); + var h = r; + if ( + (u._velocityGradients && + u._velocityGradients.length > 0 && + Ee.h.GetCurrentGradient( + l, + u._velocityGradients, + function (e, t, i) { + e !== n._currentVelocityGradient && + ((n._currentVelocity1 = + n._currentVelocity2), + (n._currentVelocity2 = t.getFactor()), + (n._currentVelocityGradient = e)), + (h *= L.a.Lerp( + n._currentVelocity1, + n._currentVelocity2, + i + )); + } + ), + n.direction.scaleToRef(h, u._scaledDirection), + u._limitVelocityGradients && + u._limitVelocityGradients.length > 0 && + Ee.h.GetCurrentGradient( + l, + u._limitVelocityGradients, + function (e, t, i) { + e !== n._currentLimitVelocityGradient && + ((n._currentLimitVelocity1 = + n._currentLimitVelocity2), + (n._currentLimitVelocity2 = + t.getFactor()), + (n._currentLimitVelocityGradient = e)); + var r = L.a.Lerp( + n._currentLimitVelocity1, + n._currentLimitVelocity2, + i + ); + n.direction.length() > r && + n.direction.scaleInPlace( + u.limitVelocityDamping + ); + } + ), + u._dragGradients && + u._dragGradients.length > 0 && + Ee.h.GetCurrentGradient( + l, + u._dragGradients, + function (e, t, i) { + e !== n._currentDragGradient && + ((n._currentDrag1 = n._currentDrag2), + (n._currentDrag2 = t.getFactor()), + (n._currentDragGradient = e)); + var r = L.a.Lerp( + n._currentDrag1, + n._currentDrag2, + i + ); + u._scaledDirection.scaleInPlace(1 - r); + } + ), + n.position.addInPlace(u._scaledDirection), + i && t && n._randomNoiseCoordinates1) + ) { + var f = u._fetchR( + n._randomNoiseCoordinates1.x, + n._randomNoiseCoordinates1.y, + t.width, + t.height, + i + ), + d = u._fetchR( + n._randomNoiseCoordinates1.z, + n._randomNoiseCoordinates2.x, + t.width, + t.height, + i + ), + p = u._fetchR( + n._randomNoiseCoordinates2.y, + n._randomNoiseCoordinates2.z, + t.width, + t.height, + i + ), + m = a.t.Vector3[0], + g = a.t.Vector3[1]; + m.copyFromFloats( + (2 * f - 1) * u.noiseStrength.x, + (2 * d - 1) * u.noiseStrength.y, + (2 * p - 1) * u.noiseStrength.z + ), + m.scaleToRef(r, g), + n.direction.addInPlace(g); + } + if ( + (u.gravity.scaleToRef(r, u._scaledGravity), + n.direction.addInPlace(u._scaledGravity), + u._sizeGradients && + u._sizeGradients.length > 0 && + Ee.h.GetCurrentGradient( + l, + u._sizeGradients, + function (e, t, i) { + e !== n._currentSizeGradient && + ((n._currentSize1 = n._currentSize2), + (n._currentSize2 = t.getFactor()), + (n._currentSizeGradient = e)), + (n.size = L.a.Lerp( + n._currentSize1, + n._currentSize2, + i + )); + } + ), + u._useRampGradients && + (u._colorRemapGradients && + u._colorRemapGradients.length > 0 && + Ee.h.GetCurrentGradient( + l, + u._colorRemapGradients, + function (e, t, i) { + var r = L.a.Lerp(e.factor1, t.factor1, i), + o = L.a.Lerp(e.factor2, t.factor2, i); + (n.remapData.x = r), + (n.remapData.y = o - r); + } + ), + u._alphaRemapGradients && + u._alphaRemapGradients.length > 0 && + Ee.h.GetCurrentGradient( + l, + u._alphaRemapGradients, + function (e, t, i) { + var r = L.a.Lerp(e.factor1, t.factor1, i), + o = L.a.Lerp(e.factor2, t.factor2, i); + (n.remapData.z = r), + (n.remapData.w = o - r); + } + )), + u._isAnimationSheetEnabled && n.updateCellIndex(), + n._inheritParticleInfoToSubEmitters(), + n.age >= n.lifeTime) + ) + return ( + u._emitFromParticle(n), + n._attachedSubEmitters && + (n._attachedSubEmitters.forEach(function (e) { + (e.particleSystem.disposeOnStop = true), + e.particleSystem.stop(); + }), + (n._attachedSubEmitters = null)), + u.recycleParticle(n), + o--, + "continue" + ); + }, + o = 0; + o < e.length; + o++ + ) + r(); }), - Object.defineProperty(t.prototype, "useRampGradients", { - get: function() { - return this._useRampGradients - }, - set: function(e) { - this._useRampGradients !== e && (this._useRampGradients = e, - this._resetEffect()) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "particles", { - get: function() { - return this._particles - }, - enumerable: true, - configurable: true - }), - t.prototype.getClassName = function() { - return "ParticleSystem" - } - , - t.prototype._addFactorGradient = function(e, t, i, n) { - var r = new Ee.d; - r.gradient = t, - r.factor1 = i, - r.factor2 = n, - e.push(r), - e.sort(function(e, t) { - return e.gradient < t.gradient ? -1 : e.gradient > t.gradient ? 1 : 0 - }) - } - , - t.prototype._removeFactorGradient = function(e, t) { - if (e) - for (var i = 0, n = 0, r = e; n < r.length; n++) { - if (r[n].gradient === t) { - e.splice(i, 1); - break - } - i++ - } - } - , - t.prototype.addLifeTimeGradient = function(e, t, i) { - return this._lifeTimeGradients || (this._lifeTimeGradients = []), - this._addFactorGradient(this._lifeTimeGradients, e, t, i), - this - } - , - t.prototype.removeLifeTimeGradient = function(e) { - return this._removeFactorGradient(this._lifeTimeGradients, e), - this - } - , - t.prototype.addSizeGradient = function(e, t, i) { - return this._sizeGradients || (this._sizeGradients = []), - this._addFactorGradient(this._sizeGradients, e, t, i), - this - } - , - t.prototype.removeSizeGradient = function(e) { - return this._removeFactorGradient(this._sizeGradients, e), - this - } - , - t.prototype.addColorRemapGradient = function(e, t, i) { - return this._colorRemapGradients || (this._colorRemapGradients = []), - this._addFactorGradient(this._colorRemapGradients, e, t, i), - this - } - , - t.prototype.removeColorRemapGradient = function(e) { - return this._removeFactorGradient(this._colorRemapGradients, e), - this - } - , - t.prototype.addAlphaRemapGradient = function(e, t, i) { - return this._alphaRemapGradients || (this._alphaRemapGradients = []), - this._addFactorGradient(this._alphaRemapGradients, e, t, i), - this - } - , - t.prototype.removeAlphaRemapGradient = function(e) { - return this._removeFactorGradient(this._alphaRemapGradients, e), - this - } - , - t.prototype.addAngularSpeedGradient = function(e, t, i) { - return this._angularSpeedGradients || (this._angularSpeedGradients = []), - this._addFactorGradient(this._angularSpeedGradients, e, t, i), - this - } - , - t.prototype.removeAngularSpeedGradient = function(e) { - return this._removeFactorGradient(this._angularSpeedGradients, e), - this - } - , - t.prototype.addVelocityGradient = function(e, t, i) { - return this._velocityGradients || (this._velocityGradients = []), - this._addFactorGradient(this._velocityGradients, e, t, i), - this - } - , - t.prototype.removeVelocityGradient = function(e) { - return this._removeFactorGradient(this._velocityGradients, e), - this - } - , - t.prototype.addLimitVelocityGradient = function(e, t, i) { - return this._limitVelocityGradients || (this._limitVelocityGradients = []), - this._addFactorGradient(this._limitVelocityGradients, e, t, i), - this - } - , - t.prototype.removeLimitVelocityGradient = function(e) { - return this._removeFactorGradient(this._limitVelocityGradients, e), - this - } - , - t.prototype.addDragGradient = function(e, t, i) { - return this._dragGradients || (this._dragGradients = []), - this._addFactorGradient(this._dragGradients, e, t, i), - this - } - , - t.prototype.removeDragGradient = function(e) { - return this._removeFactorGradient(this._dragGradients, e), - this - } - , - t.prototype.addEmitRateGradient = function(e, t, i) { - return this._emitRateGradients || (this._emitRateGradients = []), - this._addFactorGradient(this._emitRateGradients, e, t, i), - this - } - , - t.prototype.removeEmitRateGradient = function(e) { - return this._removeFactorGradient(this._emitRateGradients, e), - this - } - , - t.prototype.addStartSizeGradient = function(e, t, i) { - return this._startSizeGradients || (this._startSizeGradients = []), - this._addFactorGradient(this._startSizeGradients, e, t, i), - this - } - , - t.prototype.removeStartSizeGradient = function(e) { - return this._removeFactorGradient(this._emitRateGradients, e), - this - } - , - t.prototype._createRampGradientTexture = function() { - if (this._rampGradients && this._rampGradients.length && !this._rampGradientsTexture) { - for (var e = new Uint8Array(4 * this._rawTextureWidth), t = a.t.Color3[0], i = 0; i < this._rawTextureWidth; i++) { - var n = i / this._rawTextureWidth; - Ee.h.GetCurrentGradient(n, this._rampGradients, function(n, r, o) { - a.e.LerpToRef(n.color, r.color, o, t), - e[4 * i] = 255 * t.r, - e[4 * i + 1] = 255 * t.g, - e[4 * i + 2] = 255 * t.b, - e[4 * i + 3] = 255 - }) - } - this._rampGradientsTexture = We.CreateRGBATexture(e, this._rawTextureWidth, 1, this._scene, false, false, je.a.NEAREST_SAMPLINGMODE) + u + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "onDispose", { + set: function (e) { + this._onDisposeObserver && + this.onDisposeObservable.remove( + this._onDisposeObserver + ), + (this._onDisposeObserver = + this.onDisposeObservable.add(e)); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "useRampGradients", { + get: function () { + return this._useRampGradients; + }, + set: function (e) { + this._useRampGradients !== e && + ((this._useRampGradients = e), this._resetEffect()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "particles", { + get: function () { + return this._particles; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "ParticleSystem"; + }), + (t.prototype._addFactorGradient = function (e, t, i, n) { + var r = new Ee.d(); + (r.gradient = t), + (r.factor1 = i), + (r.factor2 = n), + e.push(r), + e.sort(function (e, t) { + return e.gradient < t.gradient + ? -1 + : e.gradient > t.gradient + ? 1 + : 0; + }); + }), + (t.prototype._removeFactorGradient = function (e, t) { + if (e) + for (var i = 0, n = 0, r = e; n < r.length; n++) { + if (r[n].gradient === t) { + e.splice(i, 1); + break; } - } - , - t.prototype.getRampGradients = function() { - return this._rampGradients - } - , - t.prototype.addRampGradient = function(e, t) { - this._rampGradients || (this._rampGradients = []); - var i = new Ee.b; - return i.gradient = e, - i.color = t, - this._rampGradients.push(i), - this._rampGradients.sort(function(e, t) { - return e.gradient < t.gradient ? -1 : e.gradient > t.gradient ? 1 : 0 - }), - this._rampGradientsTexture && (this._rampGradientsTexture.dispose(), - this._rampGradientsTexture = null), - this._createRampGradientTexture(), - this - } - , - t.prototype.removeRampGradient = function(e) { - return this._removeGradientAndTexture(e, this._rampGradients, this._rampGradientsTexture), - this._rampGradientsTexture = null, - this._rampGradients && this._rampGradients.length > 0 && this._createRampGradientTexture(), - this - } - , - t.prototype.addColorGradient = function(e, t, i) { - this._colorGradients || (this._colorGradients = []); - var n = new Ee.c; - return n.gradient = e, - n.color1 = t, - n.color2 = i, - this._colorGradients.push(n), - this._colorGradients.sort(function(e, t) { - return e.gradient < t.gradient ? -1 : e.gradient > t.gradient ? 1 : 0 - }), - this - } - , - t.prototype.removeColorGradient = function(e) { - if (!this._colorGradients) - return this; - for (var t = 0, i = 0, n = this._colorGradients; i < n.length; i++) { - if (n[i].gradient === e) { - this._colorGradients.splice(t, 1); - break - } - t++ - } - return this - } - , - t.prototype._fetchR = function(e, t, i, n, r) { - return r[4 * (((e = .5 * Math.abs(e) + .5) * i % i | 0) + ((t = .5 * Math.abs(t) + .5) * n % n | 0) * i)] / 255 - } - , - t.prototype._reset = function() { - this._resetEffect() - } - , - t.prototype._resetEffect = function() { - this._vertexBuffer && (this._vertexBuffer.dispose(), - this._vertexBuffer = null), - this._spriteBuffer && (this._spriteBuffer.dispose(), - this._spriteBuffer = null), - this._createVertexBuffers() - } - , - t.prototype._createVertexBuffers = function() { - this._vertexBufferSize = this._useInstancing ? 10 : 12, - this._isAnimationSheetEnabled && (this._vertexBufferSize += 1), - this._isBillboardBased && this.billboardMode !== t.BILLBOARDMODE_STRETCHED || (this._vertexBufferSize += 3), - this._useRampGradients && (this._vertexBufferSize += 4); - var e = this._scene.getEngine(); - this._vertexData = new Float32Array(this._capacity * this._vertexBufferSize * (this._useInstancing ? 1 : 4)), - this._vertexBuffer = new Si.a(e,this._vertexData,true,this._vertexBufferSize); - var i = 0 - , n = this._vertexBuffer.createVertexBuffer(Si.b.PositionKind, i, 3, this._vertexBufferSize, this._useInstancing); - this._vertexBuffers[Si.b.PositionKind] = n, - i += 3; - var r = this._vertexBuffer.createVertexBuffer(Si.b.ColorKind, i, 4, this._vertexBufferSize, this._useInstancing); - this._vertexBuffers[Si.b.ColorKind] = r, - i += 4; - var o = this._vertexBuffer.createVertexBuffer("angle", i, 1, this._vertexBufferSize, this._useInstancing); - this._vertexBuffers.angle = o, - i += 1; - var a, s = this._vertexBuffer.createVertexBuffer("size", i, 2, this._vertexBufferSize, this._useInstancing); - if (this._vertexBuffers.size = s, - i += 2, - this._isAnimationSheetEnabled) { - var c = this._vertexBuffer.createVertexBuffer("cellIndex", i, 1, this._vertexBufferSize, this._useInstancing); - this._vertexBuffers.cellIndex = c, - i += 1 - } - if (!this._isBillboardBased || this.billboardMode === t.BILLBOARDMODE_STRETCHED) { - var u = this._vertexBuffer.createVertexBuffer("direction", i, 3, this._vertexBufferSize, this._useInstancing); - this._vertexBuffers.direction = u, - i += 3 - } - if (this._useRampGradients) { - var l = this._vertexBuffer.createVertexBuffer("remapData", i, 4, this._vertexBufferSize, this._useInstancing); - this._vertexBuffers.remapData = l, - i += 4 - } - if (this._useInstancing) { - var h = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]); - this._spriteBuffer = new Si.a(e,h,false,2), - a = this._spriteBuffer.createVertexBuffer("offset", 0, 2) - } else - a = this._vertexBuffer.createVertexBuffer("offset", i, 2, this._vertexBufferSize, this._useInstancing), - i += 2; - this._vertexBuffers.offset = a - } - , - t.prototype._createIndexBuffer = function() { - if (!this._useInstancing) { - for (var e = [], t = 0, i = 0; i < this._capacity; i++) - e.push(t), - e.push(t + 1), - e.push(t + 2), - e.push(t), - e.push(t + 2), - e.push(t + 3), - t += 4; - this._indexBuffer = this._scene.getEngine().createIndexBuffer(e) - } - } - , - t.prototype.getCapacity = function() { - return this._capacity - } - , - t.prototype.isAlive = function() { - return this._alive - } - , - t.prototype.isStarted = function() { - return this._started - } - , - t.prototype._prepareSubEmitterInternalArray = function() { - var e = this; - this._subEmitters = new Array, - this.subEmitters && this.subEmitters.forEach(function(i) { - i instanceof t ? e._subEmitters.push([new wa(i)]) : i instanceof wa ? e._subEmitters.push([i]) : i instanceof Array && e._subEmitters.push(i) - }) - } - , - t.prototype.start = function(e) { - var t = this; - if (void 0 === e && (e = this.startDelay), - !this.targetStopDuration && this._hasTargetStopDurationDependantGradient()) - throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set"; - if (e) - setTimeout(function() { - t.start(0) - }, e); - else { - if (this._prepareSubEmitterInternalArray(), - this._started = true, - this._stopped = false, - this._actualFrame = 0, - this._subEmitters && 0 != this._subEmitters.length && (this.activeSubSystems = new Array), - this._emitRateGradients && (this._emitRateGradients.length > 0 && (this._currentEmitRateGradient = this._emitRateGradients[0], - this._currentEmitRate1 = this._currentEmitRateGradient.getFactor(), - this._currentEmitRate2 = this._currentEmitRate1), - this._emitRateGradients.length > 1 && (this._currentEmitRate2 = this._emitRateGradients[1].getFactor())), - this._startSizeGradients && (this._startSizeGradients.length > 0 && (this._currentStartSizeGradient = this._startSizeGradients[0], - this._currentStartSize1 = this._currentStartSizeGradient.getFactor(), - this._currentStartSize2 = this._currentStartSize1), - this._startSizeGradients.length > 1 && (this._currentStartSize2 = this._startSizeGradients[1].getFactor())), - this.preWarmCycles) { - this.emitter instanceof Ne.a && this.emitter.computeWorldMatrix(true); - var i = this.noiseTexture; - if (i && i.onGeneratedObservable) - i.onGeneratedObservable.addOnce(function() { - setTimeout(function() { - for (var e = 0; e < t.preWarmCycles; e++) - t.animate(true), - i.render() - }) - }); - else - for (var n = 0; n < this.preWarmCycles; n++) - this.animate(true) - } - this.beginAnimationOnStart && this.animations && this.animations.length > 0 && this.getScene().beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop) - } - } - , - t.prototype.stop = function(e) { - void 0 === e && (e = true), - this._stopped = true, - e && this._stopSubEmitters() - } - , - t.prototype.reset = function() { - this._stockParticles = [], - this._particles = [] - } - , - t.prototype._appendParticleVertex = function(e, i, n, r) { - var o = e * this._vertexBufferSize; - this._vertexData[o++] = i.position.x + this.worldOffset.x, - this._vertexData[o++] = i.position.y + this.worldOffset.y, - this._vertexData[o++] = i.position.z + this.worldOffset.z, - this._vertexData[o++] = i.color.r, - this._vertexData[o++] = i.color.g, - this._vertexData[o++] = i.color.b, - this._vertexData[o++] = i.color.a, - this._vertexData[o++] = i.angle, - this._vertexData[o++] = i.scale.x * i.size, - this._vertexData[o++] = i.scale.y * i.size, - this._isAnimationSheetEnabled && (this._vertexData[o++] = i.cellIndex), - this._isBillboardBased ? this.billboardMode === t.BILLBOARDMODE_STRETCHED && (this._vertexData[o++] = i.direction.x, - this._vertexData[o++] = i.direction.y, - this._vertexData[o++] = i.direction.z) : i._initialDirection ? (this._vertexData[o++] = i._initialDirection.x, - this._vertexData[o++] = i._initialDirection.y, - this._vertexData[o++] = i._initialDirection.z) : (this._vertexData[o++] = i.direction.x, - this._vertexData[o++] = i.direction.y, - this._vertexData[o++] = i.direction.z), - this._useRampGradients && (this._vertexData[o++] = i.remapData.x, - this._vertexData[o++] = i.remapData.y, - this._vertexData[o++] = i.remapData.z, - this._vertexData[o++] = i.remapData.w), - this._useInstancing || (this._isAnimationSheetEnabled && (0 === n ? n = this._epsilon : 1 === n && (n = 1 - this._epsilon), - 0 === r ? r = this._epsilon : 1 === r && (r = 1 - this._epsilon)), - this._vertexData[o++] = n, - this._vertexData[o++] = r) - } - , - t.prototype._stopSubEmitters = function() { - this.activeSubSystems && (this.activeSubSystems.forEach(function(e) { - e.stop(true) - }), - this.activeSubSystems = new Array) - } - , - t.prototype._removeFromRoot = function() { - if (this._rootParticleSystem) { - var e = this._rootParticleSystem.activeSubSystems.indexOf(this); - -1 !== e && this._rootParticleSystem.activeSubSystems.splice(e, 1), - this._rootParticleSystem = null - } - } - , - t.prototype._update = function(e) { - var t, i = this; - if (this._alive = this._particles.length > 0, - this.emitter.position) { - var n = this.emitter; - this._emitterWorldMatrix = n.getWorldMatrix() - } else { - var r = this.emitter; - this._emitterWorldMatrix = a.j.Translation(r.x, r.y, r.z) - } - this.updateFunction(this._particles); - for (var o, s = function() { - if (c._particles.length === c._capacity) - return "break"; - t = c._createParticle(), - c._particles.push(t); - var e = L.a.RandomRange(c.minEmitPower, c.maxEmitPower); - if (c.startPositionFunction ? c.startPositionFunction(c._emitterWorldMatrix, t.position, t) : c.particleEmitterType.startPositionFunction(c._emitterWorldMatrix, t.position, t), - c.startDirectionFunction ? c.startDirectionFunction(c._emitterWorldMatrix, t.direction, t) : c.particleEmitterType.startDirectionFunction(c._emitterWorldMatrix, t.direction, t), - 0 === e ? t._initialDirection ? t._initialDirection.copyFrom(t.direction) : t._initialDirection = t.direction.clone() : t._initialDirection = null, - t.direction.scaleInPlace(e), - c.targetStopDuration && c._lifeTimeGradients && c._lifeTimeGradients.length > 0) { - var n = L.a.Clamp(c._actualFrame / c.targetStopDuration); - Ee.h.GetCurrentGradient(n, c._lifeTimeGradients, function(e, i) { - var r = e - , o = i - , a = r.getFactor() - , s = o.getFactor() - , c = (n - r.gradient) / (o.gradient - r.gradient); - t.lifeTime = L.a.Lerp(a, s, c) - }) - } else - t.lifeTime = L.a.RandomRange(c.minLifeTime, c.maxLifeTime); - if (c._sizeGradients && 0 !== c._sizeGradients.length ? (t._currentSizeGradient = c._sizeGradients[0], - t._currentSize1 = t._currentSizeGradient.getFactor(), - t.size = t._currentSize1, - c._sizeGradients.length > 1 ? t._currentSize2 = c._sizeGradients[1].getFactor() : t._currentSize2 = t._currentSize1) : t.size = L.a.RandomRange(c.minSize, c.maxSize), - t.scale.copyFromFloats(L.a.RandomRange(c.minScaleX, c.maxScaleX), L.a.RandomRange(c.minScaleY, c.maxScaleY)), - c._startSizeGradients && c._startSizeGradients[0] && c.targetStopDuration) { - var r = c._actualFrame / c.targetStopDuration; - Ee.h.GetCurrentGradient(r, c._startSizeGradients, function(e, n, r) { - e !== i._currentStartSizeGradient && (i._currentStartSize1 = i._currentStartSize2, - i._currentStartSize2 = n.getFactor(), - i._currentStartSizeGradient = e); - var o = L.a.Lerp(i._currentStartSize1, i._currentStartSize2, r); - t.scale.scaleInPlace(o) - }) - } - c._angularSpeedGradients && 0 !== c._angularSpeedGradients.length ? (t._currentAngularSpeedGradient = c._angularSpeedGradients[0], - t.angularSpeed = t._currentAngularSpeedGradient.getFactor(), - t._currentAngularSpeed1 = t.angularSpeed, - c._angularSpeedGradients.length > 1 ? t._currentAngularSpeed2 = c._angularSpeedGradients[1].getFactor() : t._currentAngularSpeed2 = t._currentAngularSpeed1) : t.angularSpeed = L.a.RandomRange(c.minAngularSpeed, c.maxAngularSpeed), - t.angle = L.a.RandomRange(c.minInitialRotation, c.maxInitialRotation), - c._velocityGradients && c._velocityGradients.length > 0 && (t._currentVelocityGradient = c._velocityGradients[0], - t._currentVelocity1 = t._currentVelocityGradient.getFactor(), - c._velocityGradients.length > 1 ? t._currentVelocity2 = c._velocityGradients[1].getFactor() : t._currentVelocity2 = t._currentVelocity1), - c._limitVelocityGradients && c._limitVelocityGradients.length > 0 && (t._currentLimitVelocityGradient = c._limitVelocityGradients[0], - t._currentLimitVelocity1 = t._currentLimitVelocityGradient.getFactor(), - c._limitVelocityGradients.length > 1 ? t._currentLimitVelocity2 = c._limitVelocityGradients[1].getFactor() : t._currentLimitVelocity2 = t._currentLimitVelocity1), - c._dragGradients && c._dragGradients.length > 0 && (t._currentDragGradient = c._dragGradients[0], - t._currentDrag1 = t._currentDragGradient.getFactor(), - c._dragGradients.length > 1 ? t._currentDrag2 = c._dragGradients[1].getFactor() : t._currentDrag2 = t._currentDrag1), - c._colorGradients && 0 !== c._colorGradients.length ? (t._currentColorGradient = c._colorGradients[0], - t._currentColorGradient.getColorToRef(t.color), - t._currentColor1.copyFrom(t.color), - c._colorGradients.length > 1 ? c._colorGradients[1].getColorToRef(t._currentColor2) : t._currentColor2.copyFrom(t.color)) : (o = L.a.RandomRange(0, 1), - a.f.LerpToRef(c.color1, c.color2, o, t.color), - c.colorDead.subtractToRef(t.color, c._colorDiff), - c._colorDiff.scaleToRef(1 / t.lifeTime, t.colorStep)), - c._isAnimationSheetEnabled && (t._initialStartSpriteCellID = c.startSpriteCellID, - t._initialEndSpriteCellID = c.endSpriteCellID), - t.direction.addInPlace(c._inheritedVelocityOffset), - c._useRampGradients && (t.remapData = new a.y(0,1,0,1)), - c.noiseTexture && (t._randomNoiseCoordinates1 ? (t._randomNoiseCoordinates1.copyFromFloats(Math.random(), Math.random(), Math.random()), - t._randomNoiseCoordinates2.copyFromFloats(Math.random(), Math.random(), Math.random())) : (t._randomNoiseCoordinates1 = new a.x(Math.random(),Math.random(),Math.random()), - t._randomNoiseCoordinates2 = new a.x(Math.random(),Math.random(),Math.random()))), - t._inheritParticleInfoToSubEmitters() - }, c = this, u = 0; u < e && "break" !== s(); u++) - ; - } - , - t._GetAttributeNamesOrOptions = function(e, t, i) { - void 0 === e && (e = false), - void 0 === t && (t = false), - void 0 === i && (i = false); - var n = [Si.b.PositionKind, Si.b.ColorKind, "angle", "offset", "size"]; - return e && n.push("cellIndex"), - t || n.push("direction"), - i && n.push("remapData"), - n - } - , - t._GetEffectCreationOptions = function(e) { - void 0 === e && (e = false); - var t = ["invView", "view", "projection", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "textureMask", "translationPivot", "eyePosition"]; - return e && t.push("particlesInfos"), - t - } - , - t.prototype._getEffect = function(e) { - if (this._customEffect) - return this._customEffect; - var i = []; - if (this._scene.clipPlane && i.push("#define CLIPPLANE"), - this._scene.clipPlane2 && i.push("#define CLIPPLANE2"), - this._scene.clipPlane3 && i.push("#define CLIPPLANE3"), - this._scene.clipPlane4 && i.push("#define CLIPPLANE4"), - this._isAnimationSheetEnabled && i.push("#define ANIMATESHEET"), - e === t.BLENDMODE_MULTIPLY && i.push("#define BLENDMULTIPLYMODE"), - this._useRampGradients && i.push("#define RAMPGRADIENT"), - this._isBillboardBased) - switch (i.push("#define BILLBOARD"), - this.billboardMode) { - case t.BILLBOARDMODE_Y: - i.push("#define BILLBOARDY"); - break; - case t.BILLBOARDMODE_STRETCHED: - i.push("#define BILLBOARDSTRETCHED"); - break; - case t.BILLBOARDMODE_ALL: - } - this._imageProcessingConfiguration && (this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines), - i.push(this._imageProcessingConfigurationDefines.toString())); - var n = i.join("\n"); - if (this._cachedDefines !== n) { - this._cachedDefines = n; - var r = t._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled, this._isBillboardBased && this.billboardMode !== t.BILLBOARDMODE_STRETCHED, this._useRampGradients) - , o = t._GetEffectCreationOptions(this._isAnimationSheetEnabled) - , a = ["diffuseSampler", "rampSampler"]; - yi.a && (yi.a.PrepareUniforms(o, this._imageProcessingConfigurationDefines), - yi.a.PrepareSamplers(a, this._imageProcessingConfigurationDefines)), - this._effect = this._scene.getEngine().createEffect("particles", r, o, a, n) - } - return this._effect - } - , - t.prototype.animate = function(e) { - var t = this; - if (void 0 === e && (e = false), - this._started) { - if (!e) { - if (!this.isReady()) - return; - if (this._currentRenderId === this._scene.getFrameId()) - return; - this._currentRenderId = this._scene.getFrameId() - } - var i; - if (this._scaledUpdateSpeed = this.updateSpeed * (e ? this.preWarmStepOffset : this._scene.getAnimationRatio()), - this.manualEmitCount > -1) - i = this.manualEmitCount, - this._newPartsExcess = 0, - this.manualEmitCount = 0; - else { - var n = this.emitRate; - if (this._emitRateGradients && this._emitRateGradients.length > 0 && this.targetStopDuration) { - var r = this._actualFrame / this.targetStopDuration; - Ee.h.GetCurrentGradient(r, this._emitRateGradients, function(e, i, r) { - e !== t._currentEmitRateGradient && (t._currentEmitRate1 = t._currentEmitRate2, - t._currentEmitRate2 = i.getFactor(), - t._currentEmitRateGradient = e), - n = L.a.Lerp(t._currentEmitRate1, t._currentEmitRate2, r) - }) - } - i = n * this._scaledUpdateSpeed >> 0, - this._newPartsExcess += n * this._scaledUpdateSpeed - i - } - if (this._newPartsExcess > 1 && (i += this._newPartsExcess >> 0, - this._newPartsExcess -= this._newPartsExcess >> 0), - this._alive = false, - this._stopped ? i = 0 : (this._actualFrame += this._scaledUpdateSpeed, - this.targetStopDuration && this._actualFrame >= this.targetStopDuration && this.stop()), - this._update(i), - this._stopped && (this._alive || (this._started = false, - this.onAnimationEnd && this.onAnimationEnd(), - this.disposeOnStop && this._scene._toBeDisposed.push(this))), - !e) { - for (var o = 0, a = 0; a < this._particles.length; a++) { - var s = this._particles[a]; - this._appendParticleVertices(o, s), - o += this._useInstancing ? 1 : 4 - } - this._vertexBuffer && this._vertexBuffer.update(this._vertexData) - } - 0 === this.manualEmitCount && this.disposeOnStop && this.stop() - } - } - , - t.prototype._appendParticleVertices = function(e, t) { - this._appendParticleVertex(e++, t, 0, 0), - this._useInstancing || (this._appendParticleVertex(e++, t, 1, 0), - this._appendParticleVertex(e++, t, 1, 1), - this._appendParticleVertex(e++, t, 0, 1)) - } - , - t.prototype.rebuild = function() { - this._createIndexBuffer(), - this._vertexBuffer && this._vertexBuffer._rebuild() - } - , - t.prototype.isReady = function() { - if (!(this.emitter && this._imageProcessingConfiguration.isReady() && this.particleTexture && this.particleTexture.isReady())) - return false; - if (this.blendMode !== t.BLENDMODE_MULTIPLYADD) { - if (!this._getEffect(this.blendMode).isReady()) - return false - } else { - if (!this._getEffect(t.BLENDMODE_MULTIPLY).isReady()) - return false; - if (!this._getEffect(t.BLENDMODE_ADD).isReady()) - return false - } - return true - } - , - t.prototype._render = function(e) { - var i = this._getEffect(e) - , n = this._scene.getEngine(); - n.enableEffect(i); - var r = this._scene.getViewMatrix(); - if (i.setTexture("diffuseSampler", this.particleTexture), - i.setMatrix("view", r), - i.setMatrix("projection", this._scene.getProjectionMatrix()), - this._isAnimationSheetEnabled && this.particleTexture) { - var o = this.particleTexture.getBaseSize(); - i.setFloat3("particlesInfos", this.spriteCellWidth / o.width, this.spriteCellHeight / o.height, o.width / this.spriteCellWidth) - } - if (i.setVector2("translationPivot", this.translationPivot), - i.setFloat4("textureMask", this.textureMask.r, this.textureMask.g, this.textureMask.b, this.textureMask.a), - this._isBillboardBased) { - var a = this._scene.activeCamera; - i.setVector3("eyePosition", a.globalPosition) - } - if (this._rampGradientsTexture && i.setTexture("rampSampler", this._rampGradientsTexture), - this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4) { - var s = r.clone(); - s.invert(), - i.setMatrix("invView", s), - Yn.a.BindClipPlane(i, this._scene) - } - switch (n.bindBuffers(this._vertexBuffers, this._indexBuffer, i), - this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess && this._imageProcessingConfiguration.bind(i), - e) { - case t.BLENDMODE_ADD: - n.setAlphaMode(_.a.ALPHA_ADD); - break; - case t.BLENDMODE_ONEONE: - n.setAlphaMode(_.a.ALPHA_ONEONE); - break; - case t.BLENDMODE_STANDARD: - n.setAlphaMode(_.a.ALPHA_COMBINE); - break; - case t.BLENDMODE_MULTIPLY: - n.setAlphaMode(_.a.ALPHA_MULTIPLY) - } - return this._useInstancing ? n.drawArraysType(Mr.a.TriangleFanDrawMode, 0, 4, this._particles.length) : n.drawElementsType(Mr.a.TriangleFillMode, 0, 6 * this._particles.length), - this._particles.length - } - , - t.prototype.render = function() { - if (!this.isReady() || !this._particles.length) - return 0; - var e = this._scene.getEngine(); - e.setState(false), - this.forceDepthWrite && e.setDepthWrite(true); - var i = 0; - return this.blendMode === t.BLENDMODE_MULTIPLYADD && (i = this._render(t.BLENDMODE_MULTIPLY) + this._render(t.BLENDMODE_ADD)), - i = this._render(this.blendMode), - e.unbindInstanceAttributes(), - e.setAlphaMode(_.a.ALPHA_DISABLE), + i++; + } + }), + (t.prototype.addLifeTimeGradient = function (e, t, i) { + return ( + this._lifeTimeGradients || (this._lifeTimeGradients = []), + this._addFactorGradient(this._lifeTimeGradients, e, t, i), + this + ); + }), + (t.prototype.removeLifeTimeGradient = function (e) { + return ( + this._removeFactorGradient(this._lifeTimeGradients, e), + this + ); + }), + (t.prototype.addSizeGradient = function (e, t, i) { + return ( + this._sizeGradients || (this._sizeGradients = []), + this._addFactorGradient(this._sizeGradients, e, t, i), + this + ); + }), + (t.prototype.removeSizeGradient = function (e) { + return ( + this._removeFactorGradient(this._sizeGradients, e), this + ); + }), + (t.prototype.addColorRemapGradient = function (e, t, i) { + return ( + this._colorRemapGradients || + (this._colorRemapGradients = []), + this._addFactorGradient( + this._colorRemapGradients, + e, + t, i + ), + this + ); + }), + (t.prototype.removeColorRemapGradient = function (e) { + return ( + this._removeFactorGradient(this._colorRemapGradients, e), + this + ); + }), + (t.prototype.addAlphaRemapGradient = function (e, t, i) { + return ( + this._alphaRemapGradients || + (this._alphaRemapGradients = []), + this._addFactorGradient( + this._alphaRemapGradients, + e, + t, + i + ), + this + ); + }), + (t.prototype.removeAlphaRemapGradient = function (e) { + return ( + this._removeFactorGradient(this._alphaRemapGradients, e), + this + ); + }), + (t.prototype.addAngularSpeedGradient = function (e, t, i) { + return ( + this._angularSpeedGradients || + (this._angularSpeedGradients = []), + this._addFactorGradient( + this._angularSpeedGradients, + e, + t, + i + ), + this + ); + }), + (t.prototype.removeAngularSpeedGradient = function (e) { + return ( + this._removeFactorGradient( + this._angularSpeedGradients, + e + ), + this + ); + }), + (t.prototype.addVelocityGradient = function (e, t, i) { + return ( + this._velocityGradients || (this._velocityGradients = []), + this._addFactorGradient(this._velocityGradients, e, t, i), + this + ); + }), + (t.prototype.removeVelocityGradient = function (e) { + return ( + this._removeFactorGradient(this._velocityGradients, e), + this + ); + }), + (t.prototype.addLimitVelocityGradient = function (e, t, i) { + return ( + this._limitVelocityGradients || + (this._limitVelocityGradients = []), + this._addFactorGradient( + this._limitVelocityGradients, + e, + t, + i + ), + this + ); + }), + (t.prototype.removeLimitVelocityGradient = function (e) { + return ( + this._removeFactorGradient( + this._limitVelocityGradients, + e + ), + this + ); + }), + (t.prototype.addDragGradient = function (e, t, i) { + return ( + this._dragGradients || (this._dragGradients = []), + this._addFactorGradient(this._dragGradients, e, t, i), + this + ); + }), + (t.prototype.removeDragGradient = function (e) { + return ( + this._removeFactorGradient(this._dragGradients, e), this + ); + }), + (t.prototype.addEmitRateGradient = function (e, t, i) { + return ( + this._emitRateGradients || (this._emitRateGradients = []), + this._addFactorGradient(this._emitRateGradients, e, t, i), + this + ); + }), + (t.prototype.removeEmitRateGradient = function (e) { + return ( + this._removeFactorGradient(this._emitRateGradients, e), + this + ); + }), + (t.prototype.addStartSizeGradient = function (e, t, i) { + return ( + this._startSizeGradients || + (this._startSizeGradients = []), + this._addFactorGradient( + this._startSizeGradients, + e, + t, + i + ), + this + ); + }), + (t.prototype.removeStartSizeGradient = function (e) { + return ( + this._removeFactorGradient(this._emitRateGradients, e), + this + ); + }), + (t.prototype._createRampGradientTexture = function () { + if ( + this._rampGradients && + this._rampGradients.length && + !this._rampGradientsTexture + ) { + for ( + var e = new Uint8Array(4 * this._rawTextureWidth), + t = a.t.Color3[0], + i = 0; + i < this._rawTextureWidth; + i++ + ) { + var n = i / this._rawTextureWidth; + Ee.h.GetCurrentGradient( + n, + this._rampGradients, + function (n, r, o) { + a.e.LerpToRef(n.color, r.color, o, t), + (e[4 * i] = 255 * t.r), + (e[4 * i + 1] = 255 * t.g), + (e[4 * i + 2] = 255 * t.b), + (e[4 * i + 3] = 255); + } + ); + } + this._rampGradientsTexture = We.CreateRGBATexture( + e, + this._rawTextureWidth, + 1, + this._scene, + false, + false, + je.a.NEAREST_SAMPLINGMODE + ); } - , - t.prototype.dispose = function(e) { - if (void 0 === e && (e = true), - this._vertexBuffer && (this._vertexBuffer.dispose(), - this._vertexBuffer = null), - this._spriteBuffer && (this._spriteBuffer.dispose(), - this._spriteBuffer = null), - this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), - this._indexBuffer = null), - e && this.particleTexture && (this.particleTexture.dispose(), - this.particleTexture = null), - e && this.noiseTexture && (this.noiseTexture.dispose(), - this.noiseTexture = null), - this._rampGradientsTexture && (this._rampGradientsTexture.dispose(), - this._rampGradientsTexture = null), - this._removeFromRoot(), - this._subEmitters && this._subEmitters.length) { - for (var t = 0; t < this._subEmitters.length; t++) - for (var i = 0, n = this._subEmitters[t]; i < n.length; i++) - n[i].dispose(); - this._subEmitters = [], - this.subEmitters = [] - } - this._disposeEmitterOnDispose && this.emitter && this.emitter.dispose && this.emitter.dispose(true), - (t = this._scene.particleSystems.indexOf(this)) > -1 && this._scene.particleSystems.splice(t, 1), - this._scene._activeParticleSystems.dispose(), - this.onDisposeObservable.notifyObservers(this), - this.onDisposeObservable.clear(), - this.reset() + }), + (t.prototype.getRampGradients = function () { + return this._rampGradients; + }), + (t.prototype.addRampGradient = function (e, t) { + this._rampGradients || (this._rampGradients = []); + var i = new Ee.b(); + return ( + (i.gradient = e), + (i.color = t), + this._rampGradients.push(i), + this._rampGradients.sort(function (e, t) { + return e.gradient < t.gradient + ? -1 + : e.gradient > t.gradient + ? 1 + : 0; + }), + this._rampGradientsTexture && + (this._rampGradientsTexture.dispose(), + (this._rampGradientsTexture = null)), + this._createRampGradientTexture(), + this + ); + }), + (t.prototype.removeRampGradient = function (e) { + return ( + this._removeGradientAndTexture( + e, + this._rampGradients, + this._rampGradientsTexture + ), + (this._rampGradientsTexture = null), + this._rampGradients && + this._rampGradients.length > 0 && + this._createRampGradientTexture(), + this + ); + }), + (t.prototype.addColorGradient = function (e, t, i) { + this._colorGradients || (this._colorGradients = []); + var n = new Ee.c(); + return ( + (n.gradient = e), + (n.color1 = t), + (n.color2 = i), + this._colorGradients.push(n), + this._colorGradients.sort(function (e, t) { + return e.gradient < t.gradient + ? -1 + : e.gradient > t.gradient + ? 1 + : 0; + }), + this + ); + }), + (t.prototype.removeColorGradient = function (e) { + if (!this._colorGradients) return this; + for ( + var t = 0, i = 0, n = this._colorGradients; + i < n.length; + i++ + ) { + if (n[i].gradient === e) { + this._colorGradients.splice(t, 1); + break; + } + t++; } - , - t.prototype.clone = function(e, i) { - var n = null - , r = null; - if (null != this.customShader) { - var o = (r = this.customShader).shaderOptions.defines.length > 0 ? r.shaderOptions.defines.join("\n") : ""; - n = this._scene.getEngine().createEffectForParticles(r.shaderPath.fragmentElement, r.shaderOptions.uniforms, r.shaderOptions.samplers, o) - } else - this._customEffect && (n = this._customEffect); - var a = new t(e,this._capacity,this._scene,n); - return a.customShader = r, - M.a.DeepCopy(this, a, ["particles", "customShader", "noiseTexture"]), - void 0 === i && (i = this.emitter), - a.noiseTexture = this.noiseTexture, - a.emitter = i, - this.particleTexture && (a.particleTexture = new je.a(this.particleTexture.url,this._scene)), - this._colorGradients && this._colorGradients.forEach(function(e) { - a.addColorGradient(e.gradient, e.color1, e.color2) - }), - this._dragGradients && this._dragGradients.forEach(function(e) { - a.addDragGradient(e.gradient, e.factor1, e.factor2) - }), - this._angularSpeedGradients && this._angularSpeedGradients.forEach(function(e) { - a.addAngularSpeedGradient(e.gradient, e.factor1, e.factor2) - }), - this._emitRateGradients && this._emitRateGradients.forEach(function(e) { - a.addEmitRateGradient(e.gradient, e.factor1, e.factor2) - }), - this._lifeTimeGradients && this._lifeTimeGradients.forEach(function(e) { - a.addLifeTimeGradient(e.gradient, e.factor1, e.factor2) - }), - this._limitVelocityGradients && this._limitVelocityGradients.forEach(function(e) { - a.addLimitVelocityGradient(e.gradient, e.factor1, e.factor2) - }), - this._sizeGradients && this._sizeGradients.forEach(function(e) { - a.addSizeGradient(e.gradient, e.factor1, e.factor2) - }), - this._startSizeGradients && this._startSizeGradients.forEach(function(e) { - a.addStartSizeGradient(e.gradient, e.factor1, e.factor2) - }), - this._velocityGradients && this._velocityGradients.forEach(function(e) { - a.addVelocityGradient(e.gradient, e.factor1, e.factor2) - }), - this._rampGradients && this._rampGradients.forEach(function(e) { - a.addRampGradient(e.gradient, e.color) - }), - this._colorRemapGradients && this._colorRemapGradients.forEach(function(e) { - a.addColorRemapGradient(e.gradient, e.factor1, e.factor2) - }), - this._alphaRemapGradients && this._alphaRemapGradients.forEach(function(e) { - a.addAlphaRemapGradient(e.gradient, e.factor1, e.factor2) - }), - this.preventAutoStart || a.start(), - a + return this; + }), + (t.prototype._fetchR = function (e, t, i, n, r) { + return ( + r[ + 4 * + ((((e = 0.5 * Math.abs(e) + 0.5) * i) % i | 0) + + (((t = 0.5 * Math.abs(t) + 0.5) * n) % n | 0) * i) + ] / 255 + ); + }), + (t.prototype._reset = function () { + this._resetEffect(); + }), + (t.prototype._resetEffect = function () { + this._vertexBuffer && + (this._vertexBuffer.dispose(), + (this._vertexBuffer = null)), + this._spriteBuffer && + (this._spriteBuffer.dispose(), + (this._spriteBuffer = null)), + this._createVertexBuffers(); + }), + (t.prototype._createVertexBuffers = function () { + (this._vertexBufferSize = this._useInstancing ? 10 : 12), + this._isAnimationSheetEnabled && + (this._vertexBufferSize += 1), + (this._isBillboardBased && + this.billboardMode !== t.BILLBOARDMODE_STRETCHED) || + (this._vertexBufferSize += 3), + this._useRampGradients && (this._vertexBufferSize += 4); + var e = this._scene.getEngine(); + (this._vertexData = new Float32Array( + this._capacity * + this._vertexBufferSize * + (this._useInstancing ? 1 : 4) + )), + (this._vertexBuffer = new Si.a( + e, + this._vertexData, + true, + this._vertexBufferSize + )); + var i = 0, + n = this._vertexBuffer.createVertexBuffer( + Si.b.PositionKind, + i, + 3, + this._vertexBufferSize, + this._useInstancing + ); + (this._vertexBuffers[Si.b.PositionKind] = n), (i += 3); + var r = this._vertexBuffer.createVertexBuffer( + Si.b.ColorKind, + i, + 4, + this._vertexBufferSize, + this._useInstancing + ); + (this._vertexBuffers[Si.b.ColorKind] = r), (i += 4); + var o = this._vertexBuffer.createVertexBuffer( + "angle", + i, + 1, + this._vertexBufferSize, + this._useInstancing + ); + (this._vertexBuffers.angle = o), (i += 1); + var a, + s = this._vertexBuffer.createVertexBuffer( + "size", + i, + 2, + this._vertexBufferSize, + this._useInstancing + ); + if ( + ((this._vertexBuffers.size = s), + (i += 2), + this._isAnimationSheetEnabled) + ) { + var c = this._vertexBuffer.createVertexBuffer( + "cellIndex", + i, + 1, + this._vertexBufferSize, + this._useInstancing + ); + (this._vertexBuffers.cellIndex = c), (i += 1); } - , - t.prototype.serialize = function() { - var e = {}; - if (t._Serialize(e, this), - e.textureMask = this.textureMask.asArray(), - e.customShader = this.customShader, - e.preventAutoStart = this.preventAutoStart, - this.subEmitters) { - e.subEmitters = [], - this._subEmitters || this._prepareSubEmitterInternalArray(); - for (var i = 0, n = this._subEmitters; i < n.length; i++) { - for (var r = [], o = 0, a = n[i]; o < a.length; o++) { - var s = a[o]; - r.push(s.serialize()) - } - e.subEmitters.push(r) - } - } - return e + if ( + !this._isBillboardBased || + this.billboardMode === t.BILLBOARDMODE_STRETCHED + ) { + var u = this._vertexBuffer.createVertexBuffer( + "direction", + i, + 3, + this._vertexBufferSize, + this._useInstancing + ); + (this._vertexBuffers.direction = u), (i += 3); } - , - t._Serialize = function(e, t) { - if (e.name = t.name, - e.id = t.id, - e.capacity = t.getCapacity(), - t.emitter.position) { - var i = t.emitter; - e.emitterId = i.id - } else { - var n = t.emitter; - e.emitter = n.asArray() - } - t.particleEmitterType && (e.particleEmitterType = t.particleEmitterType.serialize()), - t.particleTexture && (e.textureName = t.particleTexture.name, - e.invertY = t.particleTexture._invertY), - F.a.AppendSerializedAnimations(t, e), - e.beginAnimationOnStart = t.beginAnimationOnStart, - e.beginAnimationFrom = t.beginAnimationFrom, - e.beginAnimationTo = t.beginAnimationTo, - e.beginAnimationLoop = t.beginAnimationLoop, - e.startDelay = t.startDelay, - e.renderingGroupId = t.renderingGroupId, - e.isBillboardBased = t.isBillboardBased, - e.billboardMode = t.billboardMode, - e.minAngularSpeed = t.minAngularSpeed, - e.maxAngularSpeed = t.maxAngularSpeed, - e.minSize = t.minSize, - e.maxSize = t.maxSize, - e.minScaleX = t.minScaleX, - e.maxScaleX = t.maxScaleX, - e.minScaleY = t.minScaleY, - e.maxScaleY = t.maxScaleY, - e.minEmitPower = t.minEmitPower, - e.maxEmitPower = t.maxEmitPower, - e.minLifeTime = t.minLifeTime, - e.maxLifeTime = t.maxLifeTime, - e.emitRate = t.emitRate, - e.gravity = t.gravity.asArray(), - e.noiseStrength = t.noiseStrength.asArray(), - e.color1 = t.color1.asArray(), - e.color2 = t.color2.asArray(), - e.colorDead = t.colorDead.asArray(), - e.updateSpeed = t.updateSpeed, - e.targetStopDuration = t.targetStopDuration, - e.blendMode = t.blendMode, - e.preWarmCycles = t.preWarmCycles, - e.preWarmStepOffset = t.preWarmStepOffset, - e.minInitialRotation = t.minInitialRotation, - e.maxInitialRotation = t.maxInitialRotation, - e.startSpriteCellID = t.startSpriteCellID, - e.endSpriteCellID = t.endSpriteCellID, - e.spriteCellChangeSpeed = t.spriteCellChangeSpeed, - e.spriteCellWidth = t.spriteCellWidth, - e.spriteCellHeight = t.spriteCellHeight, - e.spriteRandomStartCell = t.spriteRandomStartCell, - e.isAnimationSheetEnabled = t.isAnimationSheetEnabled; - var r = t.getColorGradients(); - if (r) { - e.colorGradients = []; - for (var o = 0, a = r; o < a.length; o++) { - var s = a[o] - , c = { - gradient: s.gradient, - color1: s.color1.asArray() - }; - s.color2 && (c.color2 = s.color2.asArray()), - e.colorGradients.push(c) - } - } - var u = t.getRampGradients(); - if (u) { - e.rampGradients = []; - for (var l = 0, h = u; l < h.length; l++) { - var f = h[l]; - c = { - gradient: f.gradient, - color: f.color.asArray() - }, - e.rampGradients.push(c) - } - e.useRampGradients = t.useRampGradients - } - var d = t.getColorRemapGradients(); - if (d) { - e.colorRemapGradients = []; - for (var p = 0, m = d; p < m.length; p++) { - var g = m[p]; - c = { - gradient: g.gradient, - factor1: g.factor1 - }, - void 0 !== g.factor2 && (c.factor2 = g.factor2), - e.colorRemapGradients.push(c) - } - } - var _ = t.getAlphaRemapGradients(); - if (_) { - e.alphaRemapGradients = []; - for (var v = 0, y = _; v < y.length; v++) { - var b = y[v]; - c = { - gradient: b.gradient, - factor1: b.factor1 - }, - void 0 !== b.factor2 && (c.factor2 = b.factor2), - e.alphaRemapGradients.push(c) - } - } - var E = t.getSizeGradients(); - if (E) { - e.sizeGradients = []; - for (var T = 0, A = E; T < A.length; T++) { - var x = A[T]; - c = { - gradient: x.gradient, - factor1: x.factor1 - }, - void 0 !== x.factor2 && (c.factor2 = x.factor2), - e.sizeGradients.push(c) - } - } - var S = t.getAngularSpeedGradients(); - if (S) { - e.angularSpeedGradients = []; - for (var C = 0, P = S; C < P.length; C++) { - var R = P[C]; - c = { - gradient: R.gradient, - factor1: R.factor1 - }, - void 0 !== R.factor2 && (c.factor2 = R.factor2), - e.angularSpeedGradients.push(c) - } - } - var M = t.getVelocityGradients(); - if (M) { - e.velocityGradients = []; - for (var O = 0, w = M; O < w.length; O++) { - var I = w[O]; - c = { - gradient: I.gradient, - factor1: I.factor1 - }, - void 0 !== I.factor2 && (c.factor2 = I.factor2), - e.velocityGradients.push(c) - } - } - var D = t.getDragGradients(); - if (D) { - e.dragyGradients = []; - for (var L = 0, B = D; L < B.length; L++) { - var N = B[L]; - c = { - gradient: N.gradient, - factor1: N.factor1 - }, - void 0 !== N.factor2 && (c.factor2 = N.factor2), - e.dragGradients.push(c) - } - } - var k = t.getEmitRateGradients(); - if (k) { - e.emitRateGradients = []; - for (var U = 0, V = k; U < V.length; U++) { - var G = V[U]; - c = { - gradient: G.gradient, - factor1: G.factor1 - }, - void 0 !== G.factor2 && (c.factor2 = G.factor2), - e.emitRateGradients.push(c) - } - } - var z = t.getStartSizeGradients(); - if (z) { - e.startSizeGradients = []; - for (var j = 0, H = z; j < H.length; j++) { - var W = H[j]; - c = { - gradient: W.gradient, - factor1: W.factor1 - }, - void 0 !== W.factor2 && (c.factor2 = W.factor2), - e.startSizeGradients.push(c) - } - } - var X = t.getLifeTimeGradients(); - if (X) { - e.lifeTimeGradients = []; - for (var Y = 0, K = X; Y < K.length; Y++) { - var Q = K[Y]; - c = { - gradient: Q.gradient, - factor1: Q.factor1 - }, - void 0 !== Q.factor2 && (c.factor2 = Q.factor2), - e.lifeTimeGradients.push(c) - } - } - var q = t.getLimitVelocityGradients(); - if (q) { - e.limitVelocityGradients = []; - for (var Z = 0, J = q; Z < J.length; Z++) { - var $ = J[Z]; - c = { - gradient: $.gradient, - factor1: $.factor1 - }, - void 0 !== $.factor2 && (c.factor2 = $.factor2), - e.limitVelocityGradients.push(c) - } - e.limitVelocityDamping = t.limitVelocityDamping - } - t.noiseTexture && (e.noiseTexture = t.noiseTexture.serialize()) + if (this._useRampGradients) { + var l = this._vertexBuffer.createVertexBuffer( + "remapData", + i, + 4, + this._vertexBufferSize, + this._useInstancing + ); + (this._vertexBuffers.remapData = l), (i += 4); } - , - t._Parse = function(e, t, i, n) { - if (e.textureName && (t.particleTexture = new je.a(n + e.textureName,i,false,void 0 === e.invertY || e.invertY), - t.particleTexture.name = e.textureName), - e.emitterId || 0 === e.emitterId || void 0 !== e.emitter ? e.emitterId ? t.emitter = i.getLastMeshByID(e.emitterId) : t.emitter = a.x.FromArray(e.emitter) : t.emitter = a.x.Zero(), - void 0 !== e.renderingGroupId && (t.renderingGroupId = e.renderingGroupId), - void 0 !== e.isBillboardBased && (t.isBillboardBased = e.isBillboardBased), - void 0 !== e.billboardMode && (t.billboardMode = e.billboardMode), - e.animations) { - for (var r = 0; r < e.animations.length; r++) { - var o = e.animations[r] - , c = s.a.GetClass("BABYLON.Animation"); - c && t.animations.push(c.Parse(o)) - } - t.beginAnimationOnStart = e.beginAnimationOnStart, - t.beginAnimationFrom = e.beginAnimationFrom, - t.beginAnimationTo = e.beginAnimationTo, - t.beginAnimationLoop = e.beginAnimationLoop - } - if (e.autoAnimate && i.beginAnimation(t, e.autoAnimateFrom, e.autoAnimateTo, e.autoAnimateLoop, e.autoAnimateSpeed || 1), - t.startDelay = 0 | e.startDelay, - t.minAngularSpeed = e.minAngularSpeed, - t.maxAngularSpeed = e.maxAngularSpeed, - t.minSize = e.minSize, - t.maxSize = e.maxSize, - e.minScaleX && (t.minScaleX = e.minScaleX, - t.maxScaleX = e.maxScaleX, - t.minScaleY = e.minScaleY, - t.maxScaleY = e.maxScaleY), - void 0 !== e.preWarmCycles && (t.preWarmCycles = e.preWarmCycles, - t.preWarmStepOffset = e.preWarmStepOffset), - void 0 !== e.minInitialRotation && (t.minInitialRotation = e.minInitialRotation, - t.maxInitialRotation = e.maxInitialRotation), - t.minLifeTime = e.minLifeTime, - t.maxLifeTime = e.maxLifeTime, - t.minEmitPower = e.minEmitPower, - t.maxEmitPower = e.maxEmitPower, - t.emitRate = e.emitRate, - t.gravity = a.x.FromArray(e.gravity), - e.noiseStrength && (t.noiseStrength = a.x.FromArray(e.noiseStrength)), - t.color1 = a.f.FromArray(e.color1), - t.color2 = a.f.FromArray(e.color2), - t.colorDead = a.f.FromArray(e.colorDead), - t.updateSpeed = e.updateSpeed, - t.targetStopDuration = e.targetStopDuration, - t.blendMode = e.blendMode, - e.colorGradients) - for (var u = 0, l = e.colorGradients; u < l.length; u++) { - var h = l[u]; - t.addColorGradient(h.gradient, a.f.FromArray(h.color1), h.color2 ? a.f.FromArray(h.color2) : void 0) - } - if (e.rampGradients) { - for (var f = 0, d = e.rampGradients; f < d.length; f++) { - var p = d[f]; - t.addRampGradient(p.gradient, a.e.FromArray(p.color)) - } - t.useRampGradients = e.useRampGradients - } - if (e.colorRemapGradients) - for (var m = 0, g = e.colorRemapGradients; m < g.length; m++) { - var _ = g[m]; - t.addColorRemapGradient(_.gradient, void 0 !== _.factor1 ? _.factor1 : _.factor, _.factor2) - } - if (e.alphaRemapGradients) - for (var v = 0, y = e.alphaRemapGradients; v < y.length; v++) { - var b = y[v]; - t.addAlphaRemapGradient(b.gradient, void 0 !== b.factor1 ? b.factor1 : b.factor, b.factor2) - } - if (e.sizeGradients) - for (var E = 0, T = e.sizeGradients; E < T.length; E++) { - var A = T[E]; - t.addSizeGradient(A.gradient, void 0 !== A.factor1 ? A.factor1 : A.factor, A.factor2) - } - if (e.sizeGradients) - for (var x = 0, S = e.sizeGradients; x < S.length; x++) - A = S[x], - t.addSizeGradient(A.gradient, void 0 !== A.factor1 ? A.factor1 : A.factor, A.factor2); - if (e.angularSpeedGradients) - for (var C = 0, P = e.angularSpeedGradients; C < P.length; C++) { - var R = P[C]; - t.addAngularSpeedGradient(R.gradient, void 0 !== R.factor1 ? R.factor1 : R.factor, R.factor2) - } - if (e.velocityGradients) - for (var M = 0, O = e.velocityGradients; M < O.length; M++) { - var w = O[M]; - t.addVelocityGradient(w.gradient, void 0 !== w.factor1 ? w.factor1 : w.factor, w.factor2) - } - if (e.dragGradients) - for (var I = 0, D = e.dragGradients; I < D.length; I++) { - var L = D[I]; - t.addDragGradient(L.gradient, void 0 !== L.factor1 ? L.factor1 : L.factor, L.factor2) - } - if (e.emitRateGradients) - for (var F = 0, B = e.emitRateGradients; F < B.length; F++) { - var N = B[F]; - t.addEmitRateGradient(N.gradient, void 0 !== N.factor1 ? N.factor1 : N.factor, N.factor2) - } - if (e.startSizeGradients) - for (var k = 0, U = e.startSizeGradients; k < U.length; k++) { - var V = U[k]; - t.addStartSizeGradient(V.gradient, void 0 !== V.factor1 ? V.factor1 : V.factor, V.factor2) - } - if (e.lifeTimeGradients) - for (var G = 0, z = e.lifeTimeGradients; G < z.length; G++) { - var j = z[G]; - t.addLifeTimeGradient(j.gradient, void 0 !== j.factor1 ? j.factor1 : j.factor, j.factor2) - } - if (e.limitVelocityGradients) { - for (var H = 0, W = e.limitVelocityGradients; H < W.length; H++) { - var X = W[H]; - t.addLimitVelocityGradient(X.gradient, void 0 !== X.factor1 ? X.factor1 : X.factor, X.factor2) - } - t.limitVelocityDamping = e.limitVelocityDamping - } - var Y; - if (e.noiseTexture && (t.noiseTexture = So.Parse(e.noiseTexture, i, n)), - e.particleEmitterType) { - switch (e.particleEmitterType.type) { - case "SphereParticleEmitter": - Y = new Pa; - break; - case "SphereDirectedParticleEmitter": - Y = new Ra; - break; - case "ConeEmitter": - case "ConeParticleEmitter": - Y = new Ta; - break; - case "CylinderParticleEmitter": - Y = new Aa; - break; - case "HemisphericParticleEmitter": - Y = new Sa; - break; - case "BoxEmitter": - case "BoxParticleEmitter": - default: - Y = new Ea - } - Y.parse(e.particleEmitterType) - } else - (Y = new Ea).parse(e); - t.particleEmitterType = Y, - t.startSpriteCellID = e.startSpriteCellID, - t.endSpriteCellID = e.endSpriteCellID, - t.spriteCellWidth = e.spriteCellWidth, - t.spriteCellHeight = e.spriteCellHeight, - t.spriteCellChangeSpeed = e.spriteCellChangeSpeed, - t.spriteRandomStartCell = e.spriteRandomStartCell + if (this._useInstancing) { + var h = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]); + (this._spriteBuffer = new Si.a(e, h, false, 2)), + (a = this._spriteBuffer.createVertexBuffer( + "offset", + 0, + 2 + )); + } else + (a = this._vertexBuffer.createVertexBuffer( + "offset", + i, + 2, + this._vertexBufferSize, + this._useInstancing + )), + (i += 2); + this._vertexBuffers.offset = a; + }), + (t.prototype._createIndexBuffer = function () { + if (!this._useInstancing) { + for (var e = [], t = 0, i = 0; i < this._capacity; i++) + e.push(t), + e.push(t + 1), + e.push(t + 2), + e.push(t), + e.push(t + 2), + e.push(t + 3), + (t += 4); + this._indexBuffer = this._scene + .getEngine() + .createIndexBuffer(e); } - , - t.Parse = function(e, i, n, r) { - void 0 === r && (r = false); - var o = e.name - , s = null - , c = null; - if (e.customShader) { - var u = (c = e.customShader).shaderOptions.defines.length > 0 ? c.shaderOptions.defines.join("\n") : ""; - s = i.getEngine().createEffectForParticles(c.shaderPath.fragmentElement, c.shaderOptions.uniforms, c.shaderOptions.samplers, u) - } - var l = new t(o,e.capacity,i,s,e.isAnimationSheetEnabled); - if (l.customShader = c, - e.id && (l.id = e.id), - e.subEmitters) { - l.subEmitters = []; - for (var h = 0, f = e.subEmitters; h < f.length; h++) { - for (var d = [], p = 0, m = f[h]; p < m.length; p++) { - var g = m[p]; - d.push(wa.Parse(g, i, n)) - } - l.subEmitters.push(d) - } - } - return t._Parse(e, l, i, n), - l.textureMask = a.f.FromArray(e.textureMask), - e.preventAutoStart && (l.preventAutoStart = e.preventAutoStart), - r || l.preventAutoStart || l.start(), - l + }), + (t.prototype.getCapacity = function () { + return this._capacity; + }), + (t.prototype.isAlive = function () { + return this._alive; + }), + (t.prototype.isStarted = function () { + return this._started; + }), + (t.prototype._prepareSubEmitterInternalArray = function () { + var e = this; + (this._subEmitters = new Array()), + this.subEmitters && + this.subEmitters.forEach(function (i) { + i instanceof t + ? e._subEmitters.push([new wa(i)]) + : i instanceof wa + ? e._subEmitters.push([i]) + : i instanceof Array && e._subEmitters.push(i); + }); + }), + (t.prototype.start = function (e) { + var t = this; + if ( + (void 0 === e && (e = this.startDelay), + !this.targetStopDuration && + this._hasTargetStopDurationDependantGradient()) + ) + throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set"; + if (e) + setTimeout(function () { + t.start(0); + }, e); + else { + if ( + (this._prepareSubEmitterInternalArray(), + (this._started = true), + (this._stopped = false), + (this._actualFrame = 0), + this._subEmitters && + 0 != this._subEmitters.length && + (this.activeSubSystems = new Array()), + this._emitRateGradients && + (this._emitRateGradients.length > 0 && + ((this._currentEmitRateGradient = + this._emitRateGradients[0]), + (this._currentEmitRate1 = + this._currentEmitRateGradient.getFactor()), + (this._currentEmitRate2 = this._currentEmitRate1)), + this._emitRateGradients.length > 1 && + (this._currentEmitRate2 = + this._emitRateGradients[1].getFactor())), + this._startSizeGradients && + (this._startSizeGradients.length > 0 && + ((this._currentStartSizeGradient = + this._startSizeGradients[0]), + (this._currentStartSize1 = + this._currentStartSizeGradient.getFactor()), + (this._currentStartSize2 = + this._currentStartSize1)), + this._startSizeGradients.length > 1 && + (this._currentStartSize2 = + this._startSizeGradients[1].getFactor())), + this.preWarmCycles) + ) { + this.emitter instanceof Ne.a && + this.emitter.computeWorldMatrix(true); + var i = this.noiseTexture; + if (i && i.onGeneratedObservable) + i.onGeneratedObservable.addOnce(function () { + setTimeout(function () { + for (var e = 0; e < t.preWarmCycles; e++) + t.animate(true), i.render(); + }); + }); + else + for (var n = 0; n < this.preWarmCycles; n++) + this.animate(true); + } + this.beginAnimationOnStart && + this.animations && + this.animations.length > 0 && + this.getScene().beginAnimation( + this, + this.beginAnimationFrom, + this.beginAnimationTo, + this.beginAnimationLoop + ); } - , - t.BILLBOARDMODE_Y = _.a.PARTICLES_BILLBOARDMODE_Y, - t.BILLBOARDMODE_ALL = _.a.PARTICLES_BILLBOARDMODE_ALL, - t.BILLBOARDMODE_STRETCHED = _.a.PARTICLES_BILLBOARDMODE_STRETCHED, - t - }(Ma); - wa._ParseParticleSystem = Ia.Parse, - Ht.a.ShadersStore.gpuUpdateParticlesPixelShader = "#version 300 es\nvoid main() {\ndiscard;\n}\n"; - Ht.a.ShadersStore.gpuUpdateParticlesVertexShader = "#version 300 es\n#define PI 3.14159\nuniform float currentCount;\nuniform float timeDelta;\nuniform float stopFactor;\nuniform mat4 emitterWM;\nuniform vec2 lifeTime;\nuniform vec2 emitPower;\nuniform vec2 sizeRange;\nuniform vec4 scaleRange;\n#ifndef COLORGRADIENTS\nuniform vec4 color1;\nuniform vec4 color2;\n#endif\nuniform vec3 gravity;\nuniform sampler2D randomSampler;\nuniform sampler2D randomSampler2;\nuniform vec4 angleRange;\n#ifdef BOXEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\nuniform vec3 minEmitBox;\nuniform vec3 maxEmitBox;\n#endif\n#ifdef POINTEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#endif\n#ifdef HEMISPHERICEMITTER\nuniform float radius;\nuniform float radiusRange;\nuniform float directionRandomizer;\n#endif\n#ifdef SPHEREEMITTER\nuniform float radius;\nuniform float radiusRange;\n#ifdef DIRECTEDSPHEREEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CYLINDEREMITTER\nuniform float radius;\nuniform float height;\nuniform float radiusRange;\n#ifdef DIRECTEDCYLINDEREMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CONEEMITTER\nuniform vec2 radius;\nuniform float coneAngle;\nuniform vec2 height;\nuniform float directionRandomizer;\n#endif\n\nin vec3 position;\nin float age;\nin float life;\nin vec4 seed;\nin vec3 size;\n#ifndef COLORGRADIENTS\nin vec4 color;\n#endif\nin vec3 direction;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nin float angle;\n#else\nin vec2 angle;\n#endif\n#ifdef ANIMATESHEET\nin float cellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nin float cellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nin vec3 noiseCoordinates1;\nin vec3 noiseCoordinates2;\n#endif\n\nout vec3 outPosition;\nout float outAge;\nout float outLife;\nout vec4 outSeed;\nout vec3 outSize;\n#ifndef COLORGRADIENTS\nout vec4 outColor;\n#endif\nout vec3 outDirection;\n#ifndef BILLBOARD\nout vec3 outInitialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nout float outAngle;\n#else\nout vec2 outAngle;\n#endif\n#ifdef ANIMATESHEET\nout float outCellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nout float outCellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nout vec3 outNoiseCoordinates1;\nout vec3 outNoiseCoordinates2;\n#endif\n#ifdef SIZEGRADIENTS\nuniform sampler2D sizeGradientSampler;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nuniform sampler2D angularSpeedGradientSampler;\n#endif\n#ifdef VELOCITYGRADIENTS\nuniform sampler2D velocityGradientSampler;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\nuniform sampler2D limitVelocityGradientSampler;\nuniform float limitVelocityDamping;\n#endif\n#ifdef DRAGGRADIENTS\nuniform sampler2D dragGradientSampler;\n#endif\n#ifdef NOISE\nuniform vec3 noiseStrength;\nuniform sampler2D noiseSampler;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 cellInfos;\n#endif\nvec3 getRandomVec3(float offset) {\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\n}\nvec4 getRandomVec4(float offset) {\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\n}\nvoid main() {\nfloat newAge=age+timeDelta;\n\nif (newAge>=life && stopFactor != 0.) {\nvec3 position;\nvec3 direction;\n\nvec4 randoms=getRandomVec4(seed.x);\n\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\noutAge=mod(newAge,outLife);\n\noutSeed=seed;\n\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\n#else\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\n#endif\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a;\n#ifndef COLORGRADIENTS\n\noutColor=color1+(color2-color1)*randoms.b;\n#endif\n\n#ifndef ANGULARSPEEDGRADIENTS\noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#else\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#endif\n\n#ifdef POINTEMITTER\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nposition=vec3(0,0,0);\ndirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(BOXEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nposition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\ndirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(HEMISPHERICEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\ndirection=position+directionRandomizer*randoms3;\n#elif defined(SPHEREEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\n#ifdef DIRECTEDSPHEREEMITTER\ndirection=direction1+(direction2-direction1)*randoms3;\n#else\n\ndirection=position+directionRandomizer*randoms3;\n#endif\n#elif defined(CYLINDEREMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat yPos=(randoms2.x-0.5)*height;\nfloat angle=randoms2.y*PI*2.;\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\nfloat xPos=positionRadius*cos(angle);\nfloat zPos=positionRadius*sin(angle);\nposition=vec3(xPos,yPos,zPos);\n#ifdef DIRECTEDCYLINDEREMITTER\ndirection=direction1+(direction2-direction1)*randoms3;\n#else\n\nangle=angle+((randoms3.x-0.5)*PI);\ndirection=vec3(cos(angle),randoms3.y-0.5,sin(angle));\ndirection=normalize(direction);\n#endif\n#elif defined(CONEEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nfloat s=2.0*PI*randoms2.x;\n#ifdef CONEEMITTERSPAWNPOINT\nfloat h=0.00001;\n#else\nfloat h=randoms2.y*height.y;\n\nh=1.-h*h;\n#endif\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\nlRadius=lRadius*h;\nfloat randX=lRadius*sin(s);\nfloat randZ=lRadius*cos(s);\nfloat randY=h*height.x;\nposition=vec3(randX,randY,randZ);\n\nif (abs(cos(coneAngle)) == 1.0) {\ndirection=vec3(0.,1.0,0.);\n} else {\nvec3 randoms3=getRandomVec3(seed.z);\ndirection=position+directionRandomizer*randoms3;\n}\n#else\n\nposition=vec3(0.,0.,0.);\n\ndirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\n#endif\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\noutPosition=(emitterWM*vec4(position,1.)).xyz;\nvec3 initial=(emitterWM*vec4(direction,0.)).xyz;\noutDirection=initial*power;\n#ifndef BILLBOARD\noutInitialDirection=initial;\n#endif\n#ifdef ANIMATESHEET\noutCellIndex=cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=randoms.a*outLife;\n#endif\n#endif\n#ifdef NOISE\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n} else {\nfloat directionScale=timeDelta;\noutAge=newAge;\nfloat ageGradient=newAge/life;\n#ifdef VELOCITYGRADIENTS\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#ifdef DRAGGRADIENTS\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\n#endif\noutPosition=position+direction*directionScale;\noutLife=life;\noutSeed=seed;\n#ifndef COLORGRADIENTS\noutColor=color;\n#endif\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\noutSize.yz=size.yz;\n#else\noutSize=size;\n#endif\n#ifndef BILLBOARD\noutInitialDirection=initialDirection;\n#endif\nvec3 updatedDirection=direction+gravity*timeDelta;\n#ifdef LIMITVELOCITYGRADIENTS\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;\nfloat currentVelocity=length(updatedDirection);\nif (currentVelocity>limitVelocity) {\nupdatedDirection=updatedDirection*limitVelocityDamping;\n}\n#endif\noutDirection=updatedDirection;\n#ifdef NOISE\nvec3 localPosition=outPosition-emitterWM[3].xyz;\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\noutDirection=outDirection+force*timeDelta;\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\noutAngle=angle+angularSpeed*timeDelta;\n#else\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\n#endif\n#ifdef ANIMATESHEET\nfloat offsetAge=outAge;\nfloat dist=cellInfos.y-cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=cellStartOffset;\noffsetAge+=cellStartOffset;\n#endif\nfloat ratio=clamp(mod(offsetAge*cellInfos.z,life)/life,0.,1.0);\noutCellIndex=float(int(cellInfos.x+ratio*dist));\n#endif\n}\n}"; - Ht.a.IncludesShadersStore.clipPlaneFragmentDeclaration2 = "#ifdef CLIPPLANE\nin float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nin float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nin float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nin float fClipDistance4;\n#endif"; - Ht.a.ShadersStore.gpuRenderParticlesPixelShader = "#version 300 es\nuniform sampler2D textureSampler;\nin vec2 vUV;\nin vec4 vColor;\nout vec4 outFragColor;\n#include\n#include\n#include\n#include\nvoid main() {\n#include\nvec4 textureColor=texture(textureSampler,vUV);\noutFragColor=textureColor*vColor;\n#ifdef BLENDMULTIPLYMODE\nfloat alpha=vColor.a*textureColor.a;\noutFragColor.rgb=outFragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);\n#endif\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\noutFragColor=applyImageProcessing(outFragColor);\n#endif\n#endif\n}\n"; - Ht.a.IncludesShadersStore.clipPlaneVertexDeclaration2 = "#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nout float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nout float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nout float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nout float fClipDistance4;\n#endif"; - Ht.a.ShadersStore.gpuRenderParticlesVertexShader = "#version 300 es\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\nuniform vec3 worldOffset;\n\nin vec3 position;\nin float age;\nin float life;\nin vec3 size;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef BILLBOARDSTRETCHED\nin vec3 direction;\n#endif\nin float angle;\n#ifdef ANIMATESHEET\nin float cellIndex;\n#endif\nin vec2 offset;\nin vec2 uv;\nout vec2 vUV;\nout vec4 vColor;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nuniform mat4 invView;\n#endif\n#include\n#ifdef COLORGRADIENTS\nuniform sampler2D colorGradientSampler;\n#else\nuniform vec4 colorDead;\nin vec4 color;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 sheetInfos;\n#endif\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn (position+worldOffset)+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn (position+worldOffset)+alignedCorner;\n}\n#endif\nvoid main() {\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/sheetInfos.z);\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\nvec2 uvScale=sheetInfos.xy;\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=uv;\n#endif\nfloat ratio=age/life;\n#ifdef COLORGRADIENTS\nvColor=texture(colorGradientSampler,vec2(ratio,0));\n#else\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\n#endif\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\n#ifdef BILLBOARD\nvec4 rotatedCorner;\nrotatedCorner.w=0.;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=(position+worldOffset)-eyePosition;\nyaxis.y=0.;\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(worldPos,1.0));\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=(position+worldOffset)-eyePosition;\nvec3 worldPos=rotateAlign(toCamera,rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(worldPos,1.0));\n#else\n\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nvec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;\n#endif\n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=0.;\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nvec3 yaxis=normalize(initialDirection);\nvec3 worldPos=rotate(yaxis,rotatedCorner);\n\nvec4 viewPosition=view*vec4(worldPos,1.0);\n#endif\ngl_Position=projection*viewPosition;\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nvec4 worldPos=invView*viewPosition;\n#endif\n#include\n}"; - var Da = function(e) { - function t(t, i, n, r) { - void 0 === r && (r = false); - var a = e.call(this, t) || this; - a.layerMask = 268435455, - a._accumulatedCount = 0, - a._targetIndex = 0, - a._currentRenderId = -1, - a._started = false, - a._stopped = false, - a._timeDelta = 0, - a._actualFrame = 0, - a._rawTextureWidth = 256, - a.onDisposeObservable = new o.c, - a.forceDepthWrite = false, - a._preWarmDone = false, - a._scene = n || R.a.LastCreatedScene, - a._attachImageProcessingConfiguration(null), - a._engine = a._scene.getEngine(), - i.randomTextureSize || delete i.randomTextureSize; - var s = h.a({ - capacity: 5e4, - randomTextureSize: a._engine.getCaps().maxTextureSize - }, i) - , c = i; - isFinite(c) && (s.capacity = c), - a._capacity = s.capacity, - a._activeCount = s.capacity, - a._currentActiveCount = 0, - a._isAnimationSheetEnabled = r, - a._scene.particleSystems.push(a), - a._updateEffectOptions = { - attributes: ["position", "age", "life", "seed", "size", "color", "direction", "initialDirection", "angle", "cellIndex", "cellStartOffset", "noiseCoordinates1", "noiseCoordinates2"], - uniformsNames: ["currentCount", "timeDelta", "emitterWM", "lifeTime", "color1", "color2", "sizeRange", "scaleRange", "gravity", "emitPower", "direction1", "direction2", "minEmitBox", "maxEmitBox", "radius", "directionRandomizer", "height", "coneAngle", "stopFactor", "angleRange", "radiusRange", "cellInfos", "noiseStrength", "limitVelocityDamping"], - uniformBuffersNames: [], - samplers: ["randomSampler", "randomSampler2", "sizeGradientSampler", "angularSpeedGradientSampler", "velocityGradientSampler", "limitVelocityGradientSampler", "noiseSampler", "dragGradientSampler"], - defines: "", - fallbacks: null, - onCompiled: null, - onError: null, - indexParameters: null, - maxSimultaneousLights: 0, - transformFeedbackVaryings: [] + }), + (t.prototype.stop = function (e) { + void 0 === e && (e = true), + (this._stopped = true), + e && this._stopSubEmitters(); + }), + (t.prototype.reset = function () { + (this._stockParticles = []), (this._particles = []); + }), + (t.prototype._appendParticleVertex = function (e, i, n, r) { + var o = e * this._vertexBufferSize; + (this._vertexData[o++] = i.position.x + this.worldOffset.x), + (this._vertexData[o++] = + i.position.y + this.worldOffset.y), + (this._vertexData[o++] = + i.position.z + this.worldOffset.z), + (this._vertexData[o++] = i.color.r), + (this._vertexData[o++] = i.color.g), + (this._vertexData[o++] = i.color.b), + (this._vertexData[o++] = i.color.a), + (this._vertexData[o++] = i.angle), + (this._vertexData[o++] = i.scale.x * i.size), + (this._vertexData[o++] = i.scale.y * i.size), + this._isAnimationSheetEnabled && + (this._vertexData[o++] = i.cellIndex), + this._isBillboardBased + ? this.billboardMode === t.BILLBOARDMODE_STRETCHED && + ((this._vertexData[o++] = i.direction.x), + (this._vertexData[o++] = i.direction.y), + (this._vertexData[o++] = i.direction.z)) + : i._initialDirection + ? ((this._vertexData[o++] = i._initialDirection.x), + (this._vertexData[o++] = i._initialDirection.y), + (this._vertexData[o++] = i._initialDirection.z)) + : ((this._vertexData[o++] = i.direction.x), + (this._vertexData[o++] = i.direction.y), + (this._vertexData[o++] = i.direction.z)), + this._useRampGradients && + ((this._vertexData[o++] = i.remapData.x), + (this._vertexData[o++] = i.remapData.y), + (this._vertexData[o++] = i.remapData.z), + (this._vertexData[o++] = i.remapData.w)), + this._useInstancing || + (this._isAnimationSheetEnabled && + (0 === n + ? (n = this._epsilon) + : 1 === n && (n = 1 - this._epsilon), + 0 === r + ? (r = this._epsilon) + : 1 === r && (r = 1 - this._epsilon)), + (this._vertexData[o++] = n), + (this._vertexData[o++] = r)); + }), + (t.prototype._stopSubEmitters = function () { + this.activeSubSystems && + (this.activeSubSystems.forEach(function (e) { + e.stop(true); + }), + (this.activeSubSystems = new Array())); + }), + (t.prototype._removeFromRoot = function () { + if (this._rootParticleSystem) { + var e = + this._rootParticleSystem.activeSubSystems.indexOf(this); + -1 !== e && + this._rootParticleSystem.activeSubSystems.splice(e, 1), + (this._rootParticleSystem = null); + } + }), + (t.prototype._update = function (e) { + var t, + i = this; + if ( + ((this._alive = this._particles.length > 0), + this.emitter.position) + ) { + var n = this.emitter; + this._emitterWorldMatrix = n.getWorldMatrix(); + } else { + var r = this.emitter; + this._emitterWorldMatrix = a.j.Translation(r.x, r.y, r.z); + } + this.updateFunction(this._particles); + for ( + var o, + s = function () { + if (c._particles.length === c._capacity) + return "break"; + (t = c._createParticle()), c._particles.push(t); + var e = L.a.RandomRange( + c.minEmitPower, + c.maxEmitPower + ); + if ( + (c.startPositionFunction + ? c.startPositionFunction( + c._emitterWorldMatrix, + t.position, + t + ) + : c.particleEmitterType.startPositionFunction( + c._emitterWorldMatrix, + t.position, + t + ), + c.startDirectionFunction + ? c.startDirectionFunction( + c._emitterWorldMatrix, + t.direction, + t + ) + : c.particleEmitterType.startDirectionFunction( + c._emitterWorldMatrix, + t.direction, + t + ), + 0 === e + ? t._initialDirection + ? t._initialDirection.copyFrom(t.direction) + : (t._initialDirection = t.direction.clone()) + : (t._initialDirection = null), + t.direction.scaleInPlace(e), + c.targetStopDuration && + c._lifeTimeGradients && + c._lifeTimeGradients.length > 0) + ) { + var n = L.a.Clamp( + c._actualFrame / c.targetStopDuration + ); + Ee.h.GetCurrentGradient( + n, + c._lifeTimeGradients, + function (e, i) { + var r = e, + o = i, + a = r.getFactor(), + s = o.getFactor(), + c = + (n - r.gradient) / + (o.gradient - r.gradient); + t.lifeTime = L.a.Lerp(a, s, c); + } + ); + } else + t.lifeTime = L.a.RandomRange( + c.minLifeTime, + c.maxLifeTime + ); + if ( + (c._sizeGradients && 0 !== c._sizeGradients.length + ? ((t._currentSizeGradient = c._sizeGradients[0]), + (t._currentSize1 = + t._currentSizeGradient.getFactor()), + (t.size = t._currentSize1), + c._sizeGradients.length > 1 + ? (t._currentSize2 = + c._sizeGradients[1].getFactor()) + : (t._currentSize2 = t._currentSize1)) + : (t.size = L.a.RandomRange( + c.minSize, + c.maxSize + )), + t.scale.copyFromFloats( + L.a.RandomRange(c.minScaleX, c.maxScaleX), + L.a.RandomRange(c.minScaleY, c.maxScaleY) + ), + c._startSizeGradients && + c._startSizeGradients[0] && + c.targetStopDuration) + ) { + var r = c._actualFrame / c.targetStopDuration; + Ee.h.GetCurrentGradient( + r, + c._startSizeGradients, + function (e, n, r) { + e !== i._currentStartSizeGradient && + ((i._currentStartSize1 = + i._currentStartSize2), + (i._currentStartSize2 = n.getFactor()), + (i._currentStartSizeGradient = e)); + var o = L.a.Lerp( + i._currentStartSize1, + i._currentStartSize2, + r + ); + t.scale.scaleInPlace(o); + } + ); + } + c._angularSpeedGradients && + 0 !== c._angularSpeedGradients.length + ? ((t._currentAngularSpeedGradient = + c._angularSpeedGradients[0]), + (t.angularSpeed = + t._currentAngularSpeedGradient.getFactor()), + (t._currentAngularSpeed1 = t.angularSpeed), + c._angularSpeedGradients.length > 1 + ? (t._currentAngularSpeed2 = + c._angularSpeedGradients[1].getFactor()) + : (t._currentAngularSpeed2 = + t._currentAngularSpeed1)) + : (t.angularSpeed = L.a.RandomRange( + c.minAngularSpeed, + c.maxAngularSpeed + )), + (t.angle = L.a.RandomRange( + c.minInitialRotation, + c.maxInitialRotation + )), + c._velocityGradients && + c._velocityGradients.length > 0 && + ((t._currentVelocityGradient = + c._velocityGradients[0]), + (t._currentVelocity1 = + t._currentVelocityGradient.getFactor()), + c._velocityGradients.length > 1 + ? (t._currentVelocity2 = + c._velocityGradients[1].getFactor()) + : (t._currentVelocity2 = t._currentVelocity1)), + c._limitVelocityGradients && + c._limitVelocityGradients.length > 0 && + ((t._currentLimitVelocityGradient = + c._limitVelocityGradients[0]), + (t._currentLimitVelocity1 = + t._currentLimitVelocityGradient.getFactor()), + c._limitVelocityGradients.length > 1 + ? (t._currentLimitVelocity2 = + c._limitVelocityGradients[1].getFactor()) + : (t._currentLimitVelocity2 = + t._currentLimitVelocity1)), + c._dragGradients && + c._dragGradients.length > 0 && + ((t._currentDragGradient = c._dragGradients[0]), + (t._currentDrag1 = + t._currentDragGradient.getFactor()), + c._dragGradients.length > 1 + ? (t._currentDrag2 = + c._dragGradients[1].getFactor()) + : (t._currentDrag2 = t._currentDrag1)), + c._colorGradients && 0 !== c._colorGradients.length + ? ((t._currentColorGradient = + c._colorGradients[0]), + t._currentColorGradient.getColorToRef(t.color), + t._currentColor1.copyFrom(t.color), + c._colorGradients.length > 1 + ? c._colorGradients[1].getColorToRef( + t._currentColor2 + ) + : t._currentColor2.copyFrom(t.color)) + : ((o = L.a.RandomRange(0, 1)), + a.f.LerpToRef(c.color1, c.color2, o, t.color), + c.colorDead.subtractToRef( + t.color, + c._colorDiff + ), + c._colorDiff.scaleToRef( + 1 / t.lifeTime, + t.colorStep + )), + c._isAnimationSheetEnabled && + ((t._initialStartSpriteCellID = + c.startSpriteCellID), + (t._initialEndSpriteCellID = c.endSpriteCellID)), + t.direction.addInPlace(c._inheritedVelocityOffset), + c._useRampGradients && + (t.remapData = new a.y(0, 1, 0, 1)), + c.noiseTexture && + (t._randomNoiseCoordinates1 + ? (t._randomNoiseCoordinates1.copyFromFloats( + Math.random(), + Math.random(), + Math.random() + ), + t._randomNoiseCoordinates2.copyFromFloats( + Math.random(), + Math.random(), + Math.random() + )) + : ((t._randomNoiseCoordinates1 = new a.x( + Math.random(), + Math.random(), + Math.random() + )), + (t._randomNoiseCoordinates2 = new a.x( + Math.random(), + Math.random(), + Math.random() + )))), + t._inheritParticleInfoToSubEmitters(); }, - a.particleEmitterType = new Ea; - for (var u = Math.min(a._engine.getCaps().maxTextureSize, s.randomTextureSize), l = [], f = 0; f < u; ++f) - l.push(Math.random()), - l.push(Math.random()), - l.push(Math.random()), - l.push(Math.random()); - for (a._randomTexture = new We(new Float32Array(l),u,1,_.a.TEXTUREFORMAT_RGBA,a._scene,false,false,_.a.TEXTURE_NEAREST_SAMPLINGMODE,_.a.TEXTURETYPE_FLOAT), + c = this, + u = 0; + u < e && "break" !== s(); + u++ + ); + }), + (t._GetAttributeNamesOrOptions = function (e, t, i) { + void 0 === e && (e = false), + void 0 === t && (t = false), + void 0 === i && (i = false); + var n = [ + Si.b.PositionKind, + Si.b.ColorKind, + "angle", + "offset", + "size", + ]; + return ( + e && n.push("cellIndex"), + t || n.push("direction"), + i && n.push("remapData"), + n + ); + }), + (t._GetEffectCreationOptions = function (e) { + void 0 === e && (e = false); + var t = [ + "invView", + "view", + "projection", + "vClipPlane", + "vClipPlane2", + "vClipPlane3", + "vClipPlane4", + "textureMask", + "translationPivot", + "eyePosition", + ]; + return e && t.push("particlesInfos"), t; + }), + (t.prototype._getEffect = function (e) { + if (this._customEffect) return this._customEffect; + var i = []; + if ( + (this._scene.clipPlane && i.push("#define CLIPPLANE"), + this._scene.clipPlane2 && i.push("#define CLIPPLANE2"), + this._scene.clipPlane3 && i.push("#define CLIPPLANE3"), + this._scene.clipPlane4 && i.push("#define CLIPPLANE4"), + this._isAnimationSheetEnabled && + i.push("#define ANIMATESHEET"), + e === t.BLENDMODE_MULTIPLY && + i.push("#define BLENDMULTIPLYMODE"), + this._useRampGradients && i.push("#define RAMPGRADIENT"), + this._isBillboardBased) + ) + switch ( + (i.push("#define BILLBOARD"), this.billboardMode) + ) { + case t.BILLBOARDMODE_Y: + i.push("#define BILLBOARDY"); + break; + case t.BILLBOARDMODE_STRETCHED: + i.push("#define BILLBOARDSTRETCHED"); + break; + case t.BILLBOARDMODE_ALL: + } + this._imageProcessingConfiguration && + (this._imageProcessingConfiguration.prepareDefines( + this._imageProcessingConfigurationDefines + ), + i.push( + this._imageProcessingConfigurationDefines.toString() + )); + var n = i.join("\n"); + if (this._cachedDefines !== n) { + this._cachedDefines = n; + var r = t._GetAttributeNamesOrOptions( + this._isAnimationSheetEnabled, + this._isBillboardBased && + this.billboardMode !== t.BILLBOARDMODE_STRETCHED, + this._useRampGradients + ), + o = t._GetEffectCreationOptions( + this._isAnimationSheetEnabled + ), + a = ["diffuseSampler", "rampSampler"]; + yi.a && + (yi.a.PrepareUniforms( + o, + this._imageProcessingConfigurationDefines + ), + yi.a.PrepareSamplers( + a, + this._imageProcessingConfigurationDefines + )), + (this._effect = this._scene + .getEngine() + .createEffect("particles", r, o, a, n)); + } + return this._effect; + }), + (t.prototype.animate = function (e) { + var t = this; + if ((void 0 === e && (e = false), this._started)) { + if (!e) { + if (!this.isReady()) return; + if (this._currentRenderId === this._scene.getFrameId()) + return; + this._currentRenderId = this._scene.getFrameId(); + } + var i; + if ( + ((this._scaledUpdateSpeed = + this.updateSpeed * + (e + ? this.preWarmStepOffset + : this._scene.getAnimationRatio())), + this.manualEmitCount > -1) + ) + (i = this.manualEmitCount), + (this._newPartsExcess = 0), + (this.manualEmitCount = 0); + else { + var n = this.emitRate; + if ( + this._emitRateGradients && + this._emitRateGradients.length > 0 && + this.targetStopDuration + ) { + var r = this._actualFrame / this.targetStopDuration; + Ee.h.GetCurrentGradient( + r, + this._emitRateGradients, + function (e, i, r) { + e !== t._currentEmitRateGradient && + ((t._currentEmitRate1 = t._currentEmitRate2), + (t._currentEmitRate2 = i.getFactor()), + (t._currentEmitRateGradient = e)), + (n = L.a.Lerp( + t._currentEmitRate1, + t._currentEmitRate2, + r + )); + } + ); + } + (i = (n * this._scaledUpdateSpeed) >> 0), + (this._newPartsExcess += + n * this._scaledUpdateSpeed - i); + } + if ( + (this._newPartsExcess > 1 && + ((i += this._newPartsExcess >> 0), + (this._newPartsExcess -= this._newPartsExcess >> 0)), + (this._alive = false), + this._stopped + ? (i = 0) + : ((this._actualFrame += this._scaledUpdateSpeed), + this.targetStopDuration && + this._actualFrame >= this.targetStopDuration && + this.stop()), + this._update(i), + this._stopped && + (this._alive || + ((this._started = false), + this.onAnimationEnd && this.onAnimationEnd(), + this.disposeOnStop && + this._scene._toBeDisposed.push(this))), + !e) + ) { + for ( + var o = 0, a = 0; + a < this._particles.length; + a++ + ) { + var s = this._particles[a]; + this._appendParticleVertices(o, s), + (o += this._useInstancing ? 1 : 4); + } + this._vertexBuffer && + this._vertexBuffer.update(this._vertexData); + } + 0 === this.manualEmitCount && + this.disposeOnStop && + this.stop(); + } + }), + (t.prototype._appendParticleVertices = function (e, t) { + this._appendParticleVertex(e++, t, 0, 0), + this._useInstancing || + (this._appendParticleVertex(e++, t, 1, 0), + this._appendParticleVertex(e++, t, 1, 1), + this._appendParticleVertex(e++, t, 0, 1)); + }), + (t.prototype.rebuild = function () { + this._createIndexBuffer(), + this._vertexBuffer && this._vertexBuffer._rebuild(); + }), + (t.prototype.isReady = function () { + if ( + !( + this.emitter && + this._imageProcessingConfiguration.isReady() && + this.particleTexture && + this.particleTexture.isReady() + ) + ) + return false; + if (this.blendMode !== t.BLENDMODE_MULTIPLYADD) { + if (!this._getEffect(this.blendMode).isReady()) + return false; + } else { + if (!this._getEffect(t.BLENDMODE_MULTIPLY).isReady()) + return false; + if (!this._getEffect(t.BLENDMODE_ADD).isReady()) + return false; + } + return true; + }), + (t.prototype._render = function (e) { + var i = this._getEffect(e), + n = this._scene.getEngine(); + n.enableEffect(i); + var r = this._scene.getViewMatrix(); + if ( + (i.setTexture("diffuseSampler", this.particleTexture), + i.setMatrix("view", r), + i.setMatrix( + "projection", + this._scene.getProjectionMatrix() + ), + this._isAnimationSheetEnabled && this.particleTexture) + ) { + var o = this.particleTexture.getBaseSize(); + i.setFloat3( + "particlesInfos", + this.spriteCellWidth / o.width, + this.spriteCellHeight / o.height, + o.width / this.spriteCellWidth + ); + } + if ( + (i.setVector2("translationPivot", this.translationPivot), + i.setFloat4( + "textureMask", + this.textureMask.r, + this.textureMask.g, + this.textureMask.b, + this.textureMask.a + ), + this._isBillboardBased) + ) { + var a = this._scene.activeCamera; + i.setVector3("eyePosition", a.globalPosition); + } + if ( + (this._rampGradientsTexture && + i.setTexture("rampSampler", this._rampGradientsTexture), + this._scene.clipPlane || + this._scene.clipPlane2 || + this._scene.clipPlane3 || + this._scene.clipPlane4) + ) { + var s = r.clone(); + s.invert(), + i.setMatrix("invView", s), + Yn.a.BindClipPlane(i, this._scene); + } + switch ( + (n.bindBuffers(this._vertexBuffers, this._indexBuffer, i), + this._imageProcessingConfiguration && + !this._imageProcessingConfiguration + .applyByPostProcess && + this._imageProcessingConfiguration.bind(i), + e) + ) { + case t.BLENDMODE_ADD: + n.setAlphaMode(_.a.ALPHA_ADD); + break; + case t.BLENDMODE_ONEONE: + n.setAlphaMode(_.a.ALPHA_ONEONE); + break; + case t.BLENDMODE_STANDARD: + n.setAlphaMode(_.a.ALPHA_COMBINE); + break; + case t.BLENDMODE_MULTIPLY: + n.setAlphaMode(_.a.ALPHA_MULTIPLY); + } + return ( + this._useInstancing + ? n.drawArraysType( + Mr.a.TriangleFanDrawMode, + 0, + 4, + this._particles.length + ) + : n.drawElementsType( + Mr.a.TriangleFillMode, + 0, + 6 * this._particles.length + ), + this._particles.length + ); + }), + (t.prototype.render = function () { + if (!this.isReady() || !this._particles.length) return 0; + var e = this._scene.getEngine(); + e.setState(false), + this.forceDepthWrite && e.setDepthWrite(true); + var i = 0; + return ( + this.blendMode === t.BLENDMODE_MULTIPLYADD && + (i = + this._render(t.BLENDMODE_MULTIPLY) + + this._render(t.BLENDMODE_ADD)), + (i = this._render(this.blendMode)), + e.unbindInstanceAttributes(), + e.setAlphaMode(_.a.ALPHA_DISABLE), + i + ); + }), + (t.prototype.dispose = function (e) { + if ( + (void 0 === e && (e = true), + this._vertexBuffer && + (this._vertexBuffer.dispose(), + (this._vertexBuffer = null)), + this._spriteBuffer && + (this._spriteBuffer.dispose(), + (this._spriteBuffer = null)), + this._indexBuffer && + (this._scene + .getEngine() + ._releaseBuffer(this._indexBuffer), + (this._indexBuffer = null)), + e && + this.particleTexture && + (this.particleTexture.dispose(), + (this.particleTexture = null)), + e && + this.noiseTexture && + (this.noiseTexture.dispose(), + (this.noiseTexture = null)), + this._rampGradientsTexture && + (this._rampGradientsTexture.dispose(), + (this._rampGradientsTexture = null)), + this._removeFromRoot(), + this._subEmitters && this._subEmitters.length) + ) { + for (var t = 0; t < this._subEmitters.length; t++) + for ( + var i = 0, n = this._subEmitters[t]; + i < n.length; + i++ + ) + n[i].dispose(); + (this._subEmitters = []), (this.subEmitters = []); + } + this._disposeEmitterOnDispose && + this.emitter && + this.emitter.dispose && + this.emitter.dispose(true), + (t = this._scene.particleSystems.indexOf(this)) > -1 && + this._scene.particleSystems.splice(t, 1), + this._scene._activeParticleSystems.dispose(), + this.onDisposeObservable.notifyObservers(this), + this.onDisposeObservable.clear(), + this.reset(); + }), + (t.prototype.clone = function (e, i) { + var n = null, + r = null; + if (null != this.customShader) { + var o = + (r = this.customShader).shaderOptions.defines.length > 0 + ? r.shaderOptions.defines.join("\n") + : ""; + n = this._scene + .getEngine() + .createEffectForParticles( + r.shaderPath.fragmentElement, + r.shaderOptions.uniforms, + r.shaderOptions.samplers, + o + ); + } else this._customEffect && (n = this._customEffect); + var a = new t(e, this._capacity, this._scene, n); + return ( + (a.customShader = r), + M.a.DeepCopy(this, a, [ + "particles", + "customShader", + "noiseTexture", + ]), + void 0 === i && (i = this.emitter), + (a.noiseTexture = this.noiseTexture), + (a.emitter = i), + this.particleTexture && + (a.particleTexture = new je.a( + this.particleTexture.url, + this._scene + )), + this._colorGradients && + this._colorGradients.forEach(function (e) { + a.addColorGradient(e.gradient, e.color1, e.color2); + }), + this._dragGradients && + this._dragGradients.forEach(function (e) { + a.addDragGradient(e.gradient, e.factor1, e.factor2); + }), + this._angularSpeedGradients && + this._angularSpeedGradients.forEach(function (e) { + a.addAngularSpeedGradient( + e.gradient, + e.factor1, + e.factor2 + ); + }), + this._emitRateGradients && + this._emitRateGradients.forEach(function (e) { + a.addEmitRateGradient( + e.gradient, + e.factor1, + e.factor2 + ); + }), + this._lifeTimeGradients && + this._lifeTimeGradients.forEach(function (e) { + a.addLifeTimeGradient( + e.gradient, + e.factor1, + e.factor2 + ); + }), + this._limitVelocityGradients && + this._limitVelocityGradients.forEach(function (e) { + a.addLimitVelocityGradient( + e.gradient, + e.factor1, + e.factor2 + ); + }), + this._sizeGradients && + this._sizeGradients.forEach(function (e) { + a.addSizeGradient(e.gradient, e.factor1, e.factor2); + }), + this._startSizeGradients && + this._startSizeGradients.forEach(function (e) { + a.addStartSizeGradient( + e.gradient, + e.factor1, + e.factor2 + ); + }), + this._velocityGradients && + this._velocityGradients.forEach(function (e) { + a.addVelocityGradient( + e.gradient, + e.factor1, + e.factor2 + ); + }), + this._rampGradients && + this._rampGradients.forEach(function (e) { + a.addRampGradient(e.gradient, e.color); + }), + this._colorRemapGradients && + this._colorRemapGradients.forEach(function (e) { + a.addColorRemapGradient( + e.gradient, + e.factor1, + e.factor2 + ); + }), + this._alphaRemapGradients && + this._alphaRemapGradients.forEach(function (e) { + a.addAlphaRemapGradient( + e.gradient, + e.factor1, + e.factor2 + ); + }), + this.preventAutoStart || a.start(), + a + ); + }), + (t.prototype.serialize = function () { + var e = {}; + if ( + (t._Serialize(e, this), + (e.textureMask = this.textureMask.asArray()), + (e.customShader = this.customShader), + (e.preventAutoStart = this.preventAutoStart), + this.subEmitters) + ) { + (e.subEmitters = []), + this._subEmitters || + this._prepareSubEmitterInternalArray(); + for ( + var i = 0, n = this._subEmitters; + i < n.length; + i++ + ) { + for (var r = [], o = 0, a = n[i]; o < a.length; o++) { + var s = a[o]; + r.push(s.serialize()); + } + e.subEmitters.push(r); + } + } + return e; + }), + (t._Serialize = function (e, t) { + if ( + ((e.name = t.name), + (e.id = t.id), + (e.capacity = t.getCapacity()), + t.emitter.position) + ) { + var i = t.emitter; + e.emitterId = i.id; + } else { + var n = t.emitter; + e.emitter = n.asArray(); + } + t.particleEmitterType && + (e.particleEmitterType = + t.particleEmitterType.serialize()), + t.particleTexture && + ((e.textureName = t.particleTexture.name), + (e.invertY = t.particleTexture._invertY)), + F.a.AppendSerializedAnimations(t, e), + (e.beginAnimationOnStart = t.beginAnimationOnStart), + (e.beginAnimationFrom = t.beginAnimationFrom), + (e.beginAnimationTo = t.beginAnimationTo), + (e.beginAnimationLoop = t.beginAnimationLoop), + (e.startDelay = t.startDelay), + (e.renderingGroupId = t.renderingGroupId), + (e.isBillboardBased = t.isBillboardBased), + (e.billboardMode = t.billboardMode), + (e.minAngularSpeed = t.minAngularSpeed), + (e.maxAngularSpeed = t.maxAngularSpeed), + (e.minSize = t.minSize), + (e.maxSize = t.maxSize), + (e.minScaleX = t.minScaleX), + (e.maxScaleX = t.maxScaleX), + (e.minScaleY = t.minScaleY), + (e.maxScaleY = t.maxScaleY), + (e.minEmitPower = t.minEmitPower), + (e.maxEmitPower = t.maxEmitPower), + (e.minLifeTime = t.minLifeTime), + (e.maxLifeTime = t.maxLifeTime), + (e.emitRate = t.emitRate), + (e.gravity = t.gravity.asArray()), + (e.noiseStrength = t.noiseStrength.asArray()), + (e.color1 = t.color1.asArray()), + (e.color2 = t.color2.asArray()), + (e.colorDead = t.colorDead.asArray()), + (e.updateSpeed = t.updateSpeed), + (e.targetStopDuration = t.targetStopDuration), + (e.blendMode = t.blendMode), + (e.preWarmCycles = t.preWarmCycles), + (e.preWarmStepOffset = t.preWarmStepOffset), + (e.minInitialRotation = t.minInitialRotation), + (e.maxInitialRotation = t.maxInitialRotation), + (e.startSpriteCellID = t.startSpriteCellID), + (e.endSpriteCellID = t.endSpriteCellID), + (e.spriteCellChangeSpeed = t.spriteCellChangeSpeed), + (e.spriteCellWidth = t.spriteCellWidth), + (e.spriteCellHeight = t.spriteCellHeight), + (e.spriteRandomStartCell = t.spriteRandomStartCell), + (e.isAnimationSheetEnabled = t.isAnimationSheetEnabled); + var r = t.getColorGradients(); + if (r) { + e.colorGradients = []; + for (var o = 0, a = r; o < a.length; o++) { + var s = a[o], + c = { + gradient: s.gradient, + color1: s.color1.asArray(), + }; + s.color2 && (c.color2 = s.color2.asArray()), + e.colorGradients.push(c); + } + } + var u = t.getRampGradients(); + if (u) { + e.rampGradients = []; + for (var l = 0, h = u; l < h.length; l++) { + var f = h[l]; + (c = { + gradient: f.gradient, + color: f.color.asArray(), + }), + e.rampGradients.push(c); + } + e.useRampGradients = t.useRampGradients; + } + var d = t.getColorRemapGradients(); + if (d) { + e.colorRemapGradients = []; + for (var p = 0, m = d; p < m.length; p++) { + var g = m[p]; + (c = { + gradient: g.gradient, + factor1: g.factor1, + }), + void 0 !== g.factor2 && (c.factor2 = g.factor2), + e.colorRemapGradients.push(c); + } + } + var _ = t.getAlphaRemapGradients(); + if (_) { + e.alphaRemapGradients = []; + for (var v = 0, y = _; v < y.length; v++) { + var b = y[v]; + (c = { + gradient: b.gradient, + factor1: b.factor1, + }), + void 0 !== b.factor2 && (c.factor2 = b.factor2), + e.alphaRemapGradients.push(c); + } + } + var E = t.getSizeGradients(); + if (E) { + e.sizeGradients = []; + for (var T = 0, A = E; T < A.length; T++) { + var x = A[T]; + (c = { + gradient: x.gradient, + factor1: x.factor1, + }), + void 0 !== x.factor2 && (c.factor2 = x.factor2), + e.sizeGradients.push(c); + } + } + var S = t.getAngularSpeedGradients(); + if (S) { + e.angularSpeedGradients = []; + for (var C = 0, P = S; C < P.length; C++) { + var R = P[C]; + (c = { + gradient: R.gradient, + factor1: R.factor1, + }), + void 0 !== R.factor2 && (c.factor2 = R.factor2), + e.angularSpeedGradients.push(c); + } + } + var M = t.getVelocityGradients(); + if (M) { + e.velocityGradients = []; + for (var O = 0, w = M; O < w.length; O++) { + var I = w[O]; + (c = { + gradient: I.gradient, + factor1: I.factor1, + }), + void 0 !== I.factor2 && (c.factor2 = I.factor2), + e.velocityGradients.push(c); + } + } + var D = t.getDragGradients(); + if (D) { + e.dragyGradients = []; + for (var L = 0, B = D; L < B.length; L++) { + var N = B[L]; + (c = { + gradient: N.gradient, + factor1: N.factor1, + }), + void 0 !== N.factor2 && (c.factor2 = N.factor2), + e.dragGradients.push(c); + } + } + var k = t.getEmitRateGradients(); + if (k) { + e.emitRateGradients = []; + for (var U = 0, V = k; U < V.length; U++) { + var G = V[U]; + (c = { + gradient: G.gradient, + factor1: G.factor1, + }), + void 0 !== G.factor2 && (c.factor2 = G.factor2), + e.emitRateGradients.push(c); + } + } + var z = t.getStartSizeGradients(); + if (z) { + e.startSizeGradients = []; + for (var j = 0, H = z; j < H.length; j++) { + var W = H[j]; + (c = { + gradient: W.gradient, + factor1: W.factor1, + }), + void 0 !== W.factor2 && (c.factor2 = W.factor2), + e.startSizeGradients.push(c); + } + } + var X = t.getLifeTimeGradients(); + if (X) { + e.lifeTimeGradients = []; + for (var Y = 0, K = X; Y < K.length; Y++) { + var Q = K[Y]; + (c = { + gradient: Q.gradient, + factor1: Q.factor1, + }), + void 0 !== Q.factor2 && (c.factor2 = Q.factor2), + e.lifeTimeGradients.push(c); + } + } + var q = t.getLimitVelocityGradients(); + if (q) { + e.limitVelocityGradients = []; + for (var Z = 0, J = q; Z < J.length; Z++) { + var $ = J[Z]; + (c = { + gradient: $.gradient, + factor1: $.factor1, + }), + void 0 !== $.factor2 && (c.factor2 = $.factor2), + e.limitVelocityGradients.push(c); + } + e.limitVelocityDamping = t.limitVelocityDamping; + } + t.noiseTexture && + (e.noiseTexture = t.noiseTexture.serialize()); + }), + (t._Parse = function (e, t, i, n) { + if ( + (e.textureName && + ((t.particleTexture = new je.a( + n + e.textureName, + i, + false, + void 0 === e.invertY || e.invertY + )), + (t.particleTexture.name = e.textureName)), + e.emitterId || 0 === e.emitterId || void 0 !== e.emitter + ? e.emitterId + ? (t.emitter = i.getLastMeshByID(e.emitterId)) + : (t.emitter = a.x.FromArray(e.emitter)) + : (t.emitter = a.x.Zero()), + void 0 !== e.renderingGroupId && + (t.renderingGroupId = e.renderingGroupId), + void 0 !== e.isBillboardBased && + (t.isBillboardBased = e.isBillboardBased), + void 0 !== e.billboardMode && + (t.billboardMode = e.billboardMode), + e.animations) + ) { + for (var r = 0; r < e.animations.length; r++) { + var o = e.animations[r], + c = s.a.GetClass("BABYLON.Animation"); + c && t.animations.push(c.Parse(o)); + } + (t.beginAnimationOnStart = e.beginAnimationOnStart), + (t.beginAnimationFrom = e.beginAnimationFrom), + (t.beginAnimationTo = e.beginAnimationTo), + (t.beginAnimationLoop = e.beginAnimationLoop); + } + if ( + (e.autoAnimate && + i.beginAnimation( + t, + e.autoAnimateFrom, + e.autoAnimateTo, + e.autoAnimateLoop, + e.autoAnimateSpeed || 1 + ), + (t.startDelay = 0 | e.startDelay), + (t.minAngularSpeed = e.minAngularSpeed), + (t.maxAngularSpeed = e.maxAngularSpeed), + (t.minSize = e.minSize), + (t.maxSize = e.maxSize), + e.minScaleX && + ((t.minScaleX = e.minScaleX), + (t.maxScaleX = e.maxScaleX), + (t.minScaleY = e.minScaleY), + (t.maxScaleY = e.maxScaleY)), + void 0 !== e.preWarmCycles && + ((t.preWarmCycles = e.preWarmCycles), + (t.preWarmStepOffset = e.preWarmStepOffset)), + void 0 !== e.minInitialRotation && + ((t.minInitialRotation = e.minInitialRotation), + (t.maxInitialRotation = e.maxInitialRotation)), + (t.minLifeTime = e.minLifeTime), + (t.maxLifeTime = e.maxLifeTime), + (t.minEmitPower = e.minEmitPower), + (t.maxEmitPower = e.maxEmitPower), + (t.emitRate = e.emitRate), + (t.gravity = a.x.FromArray(e.gravity)), + e.noiseStrength && + (t.noiseStrength = a.x.FromArray(e.noiseStrength)), + (t.color1 = a.f.FromArray(e.color1)), + (t.color2 = a.f.FromArray(e.color2)), + (t.colorDead = a.f.FromArray(e.colorDead)), + (t.updateSpeed = e.updateSpeed), + (t.targetStopDuration = e.targetStopDuration), + (t.blendMode = e.blendMode), + e.colorGradients) + ) + for (var u = 0, l = e.colorGradients; u < l.length; u++) { + var h = l[u]; + t.addColorGradient( + h.gradient, + a.f.FromArray(h.color1), + h.color2 ? a.f.FromArray(h.color2) : void 0 + ); + } + if (e.rampGradients) { + for (var f = 0, d = e.rampGradients; f < d.length; f++) { + var p = d[f]; + t.addRampGradient(p.gradient, a.e.FromArray(p.color)); + } + t.useRampGradients = e.useRampGradients; + } + if (e.colorRemapGradients) + for ( + var m = 0, g = e.colorRemapGradients; + m < g.length; + m++ + ) { + var _ = g[m]; + t.addColorRemapGradient( + _.gradient, + void 0 !== _.factor1 ? _.factor1 : _.factor, + _.factor2 + ); + } + if (e.alphaRemapGradients) + for ( + var v = 0, y = e.alphaRemapGradients; + v < y.length; + v++ + ) { + var b = y[v]; + t.addAlphaRemapGradient( + b.gradient, + void 0 !== b.factor1 ? b.factor1 : b.factor, + b.factor2 + ); + } + if (e.sizeGradients) + for (var E = 0, T = e.sizeGradients; E < T.length; E++) { + var A = T[E]; + t.addSizeGradient( + A.gradient, + void 0 !== A.factor1 ? A.factor1 : A.factor, + A.factor2 + ); + } + if (e.sizeGradients) + for (var x = 0, S = e.sizeGradients; x < S.length; x++) + (A = S[x]), + t.addSizeGradient( + A.gradient, + void 0 !== A.factor1 ? A.factor1 : A.factor, + A.factor2 + ); + if (e.angularSpeedGradients) + for ( + var C = 0, P = e.angularSpeedGradients; + C < P.length; + C++ + ) { + var R = P[C]; + t.addAngularSpeedGradient( + R.gradient, + void 0 !== R.factor1 ? R.factor1 : R.factor, + R.factor2 + ); + } + if (e.velocityGradients) + for ( + var M = 0, O = e.velocityGradients; + M < O.length; + M++ + ) { + var w = O[M]; + t.addVelocityGradient( + w.gradient, + void 0 !== w.factor1 ? w.factor1 : w.factor, + w.factor2 + ); + } + if (e.dragGradients) + for (var I = 0, D = e.dragGradients; I < D.length; I++) { + var L = D[I]; + t.addDragGradient( + L.gradient, + void 0 !== L.factor1 ? L.factor1 : L.factor, + L.factor2 + ); + } + if (e.emitRateGradients) + for ( + var F = 0, B = e.emitRateGradients; + F < B.length; + F++ + ) { + var N = B[F]; + t.addEmitRateGradient( + N.gradient, + void 0 !== N.factor1 ? N.factor1 : N.factor, + N.factor2 + ); + } + if (e.startSizeGradients) + for ( + var k = 0, U = e.startSizeGradients; + k < U.length; + k++ + ) { + var V = U[k]; + t.addStartSizeGradient( + V.gradient, + void 0 !== V.factor1 ? V.factor1 : V.factor, + V.factor2 + ); + } + if (e.lifeTimeGradients) + for ( + var G = 0, z = e.lifeTimeGradients; + G < z.length; + G++ + ) { + var j = z[G]; + t.addLifeTimeGradient( + j.gradient, + void 0 !== j.factor1 ? j.factor1 : j.factor, + j.factor2 + ); + } + if (e.limitVelocityGradients) { + for ( + var H = 0, W = e.limitVelocityGradients; + H < W.length; + H++ + ) { + var X = W[H]; + t.addLimitVelocityGradient( + X.gradient, + void 0 !== X.factor1 ? X.factor1 : X.factor, + X.factor2 + ); + } + t.limitVelocityDamping = e.limitVelocityDamping; + } + var Y; + if ( + (e.noiseTexture && + (t.noiseTexture = So.Parse(e.noiseTexture, i, n)), + e.particleEmitterType) + ) { + switch (e.particleEmitterType.type) { + case "SphereParticleEmitter": + Y = new Pa(); + break; + case "SphereDirectedParticleEmitter": + Y = new Ra(); + break; + case "ConeEmitter": + case "ConeParticleEmitter": + Y = new Ta(); + break; + case "CylinderParticleEmitter": + Y = new Aa(); + break; + case "HemisphericParticleEmitter": + Y = new Sa(); + break; + case "BoxEmitter": + case "BoxParticleEmitter": + default: + Y = new Ea(); + } + Y.parse(e.particleEmitterType); + } else (Y = new Ea()).parse(e); + (t.particleEmitterType = Y), + (t.startSpriteCellID = e.startSpriteCellID), + (t.endSpriteCellID = e.endSpriteCellID), + (t.spriteCellWidth = e.spriteCellWidth), + (t.spriteCellHeight = e.spriteCellHeight), + (t.spriteCellChangeSpeed = e.spriteCellChangeSpeed), + (t.spriteRandomStartCell = e.spriteRandomStartCell); + }), + (t.Parse = function (e, i, n, r) { + void 0 === r && (r = false); + var o = e.name, + s = null, + c = null; + if (e.customShader) { + var u = + (c = e.customShader).shaderOptions.defines.length > 0 + ? c.shaderOptions.defines.join("\n") + : ""; + s = i + .getEngine() + .createEffectForParticles( + c.shaderPath.fragmentElement, + c.shaderOptions.uniforms, + c.shaderOptions.samplers, + u + ); + } + var l = new t( + o, + e.capacity, + i, + s, + e.isAnimationSheetEnabled + ); + if ( + ((l.customShader = c), + e.id && (l.id = e.id), + e.subEmitters) + ) { + l.subEmitters = []; + for (var h = 0, f = e.subEmitters; h < f.length; h++) { + for (var d = [], p = 0, m = f[h]; p < m.length; p++) { + var g = m[p]; + d.push(wa.Parse(g, i, n)); + } + l.subEmitters.push(d); + } + } + return ( + t._Parse(e, l, i, n), + (l.textureMask = a.f.FromArray(e.textureMask)), + e.preventAutoStart && + (l.preventAutoStart = e.preventAutoStart), + r || l.preventAutoStart || l.start(), + l + ); + }), + (t.BILLBOARDMODE_Y = _.a.PARTICLES_BILLBOARDMODE_Y), + (t.BILLBOARDMODE_ALL = _.a.PARTICLES_BILLBOARDMODE_ALL), + (t.BILLBOARDMODE_STRETCHED = + _.a.PARTICLES_BILLBOARDMODE_STRETCHED), + t + ); + })(Ma); + (wa._ParseParticleSystem = Ia.Parse), + (Ht.a.ShadersStore.gpuUpdateParticlesPixelShader = + "#version 300 es\nvoid main() {\ndiscard;\n}\n"); + Ht.a.ShadersStore.gpuUpdateParticlesVertexShader = + "#version 300 es\n#define PI 3.14159\nuniform float currentCount;\nuniform float timeDelta;\nuniform float stopFactor;\nuniform mat4 emitterWM;\nuniform vec2 lifeTime;\nuniform vec2 emitPower;\nuniform vec2 sizeRange;\nuniform vec4 scaleRange;\n#ifndef COLORGRADIENTS\nuniform vec4 color1;\nuniform vec4 color2;\n#endif\nuniform vec3 gravity;\nuniform sampler2D randomSampler;\nuniform sampler2D randomSampler2;\nuniform vec4 angleRange;\n#ifdef BOXEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\nuniform vec3 minEmitBox;\nuniform vec3 maxEmitBox;\n#endif\n#ifdef POINTEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#endif\n#ifdef HEMISPHERICEMITTER\nuniform float radius;\nuniform float radiusRange;\nuniform float directionRandomizer;\n#endif\n#ifdef SPHEREEMITTER\nuniform float radius;\nuniform float radiusRange;\n#ifdef DIRECTEDSPHEREEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CYLINDEREMITTER\nuniform float radius;\nuniform float height;\nuniform float radiusRange;\n#ifdef DIRECTEDCYLINDEREMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CONEEMITTER\nuniform vec2 radius;\nuniform float coneAngle;\nuniform vec2 height;\nuniform float directionRandomizer;\n#endif\n\nin vec3 position;\nin float age;\nin float life;\nin vec4 seed;\nin vec3 size;\n#ifndef COLORGRADIENTS\nin vec4 color;\n#endif\nin vec3 direction;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nin float angle;\n#else\nin vec2 angle;\n#endif\n#ifdef ANIMATESHEET\nin float cellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nin float cellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nin vec3 noiseCoordinates1;\nin vec3 noiseCoordinates2;\n#endif\n\nout vec3 outPosition;\nout float outAge;\nout float outLife;\nout vec4 outSeed;\nout vec3 outSize;\n#ifndef COLORGRADIENTS\nout vec4 outColor;\n#endif\nout vec3 outDirection;\n#ifndef BILLBOARD\nout vec3 outInitialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nout float outAngle;\n#else\nout vec2 outAngle;\n#endif\n#ifdef ANIMATESHEET\nout float outCellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nout float outCellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nout vec3 outNoiseCoordinates1;\nout vec3 outNoiseCoordinates2;\n#endif\n#ifdef SIZEGRADIENTS\nuniform sampler2D sizeGradientSampler;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nuniform sampler2D angularSpeedGradientSampler;\n#endif\n#ifdef VELOCITYGRADIENTS\nuniform sampler2D velocityGradientSampler;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\nuniform sampler2D limitVelocityGradientSampler;\nuniform float limitVelocityDamping;\n#endif\n#ifdef DRAGGRADIENTS\nuniform sampler2D dragGradientSampler;\n#endif\n#ifdef NOISE\nuniform vec3 noiseStrength;\nuniform sampler2D noiseSampler;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 cellInfos;\n#endif\nvec3 getRandomVec3(float offset) {\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\n}\nvec4 getRandomVec4(float offset) {\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\n}\nvoid main() {\nfloat newAge=age+timeDelta;\n\nif (newAge>=life && stopFactor != 0.) {\nvec3 position;\nvec3 direction;\n\nvec4 randoms=getRandomVec4(seed.x);\n\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\noutAge=mod(newAge,outLife);\n\noutSeed=seed;\n\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\n#else\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\n#endif\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a;\n#ifndef COLORGRADIENTS\n\noutColor=color1+(color2-color1)*randoms.b;\n#endif\n\n#ifndef ANGULARSPEEDGRADIENTS\noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#else\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#endif\n\n#ifdef POINTEMITTER\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nposition=vec3(0,0,0);\ndirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(BOXEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nposition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\ndirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(HEMISPHERICEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\ndirection=position+directionRandomizer*randoms3;\n#elif defined(SPHEREEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\n#ifdef DIRECTEDSPHEREEMITTER\ndirection=direction1+(direction2-direction1)*randoms3;\n#else\n\ndirection=position+directionRandomizer*randoms3;\n#endif\n#elif defined(CYLINDEREMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat yPos=(randoms2.x-0.5)*height;\nfloat angle=randoms2.y*PI*2.;\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\nfloat xPos=positionRadius*cos(angle);\nfloat zPos=positionRadius*sin(angle);\nposition=vec3(xPos,yPos,zPos);\n#ifdef DIRECTEDCYLINDEREMITTER\ndirection=direction1+(direction2-direction1)*randoms3;\n#else\n\nangle=angle+((randoms3.x-0.5)*PI);\ndirection=vec3(cos(angle),randoms3.y-0.5,sin(angle));\ndirection=normalize(direction);\n#endif\n#elif defined(CONEEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nfloat s=2.0*PI*randoms2.x;\n#ifdef CONEEMITTERSPAWNPOINT\nfloat h=0.00001;\n#else\nfloat h=randoms2.y*height.y;\n\nh=1.-h*h;\n#endif\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\nlRadius=lRadius*h;\nfloat randX=lRadius*sin(s);\nfloat randZ=lRadius*cos(s);\nfloat randY=h*height.x;\nposition=vec3(randX,randY,randZ);\n\nif (abs(cos(coneAngle)) == 1.0) {\ndirection=vec3(0.,1.0,0.);\n} else {\nvec3 randoms3=getRandomVec3(seed.z);\ndirection=position+directionRandomizer*randoms3;\n}\n#else\n\nposition=vec3(0.,0.,0.);\n\ndirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\n#endif\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\noutPosition=(emitterWM*vec4(position,1.)).xyz;\nvec3 initial=(emitterWM*vec4(direction,0.)).xyz;\noutDirection=initial*power;\n#ifndef BILLBOARD\noutInitialDirection=initial;\n#endif\n#ifdef ANIMATESHEET\noutCellIndex=cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=randoms.a*outLife;\n#endif\n#endif\n#ifdef NOISE\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n} else {\nfloat directionScale=timeDelta;\noutAge=newAge;\nfloat ageGradient=newAge/life;\n#ifdef VELOCITYGRADIENTS\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#ifdef DRAGGRADIENTS\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\n#endif\noutPosition=position+direction*directionScale;\noutLife=life;\noutSeed=seed;\n#ifndef COLORGRADIENTS\noutColor=color;\n#endif\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\noutSize.yz=size.yz;\n#else\noutSize=size;\n#endif\n#ifndef BILLBOARD\noutInitialDirection=initialDirection;\n#endif\nvec3 updatedDirection=direction+gravity*timeDelta;\n#ifdef LIMITVELOCITYGRADIENTS\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;\nfloat currentVelocity=length(updatedDirection);\nif (currentVelocity>limitVelocity) {\nupdatedDirection=updatedDirection*limitVelocityDamping;\n}\n#endif\noutDirection=updatedDirection;\n#ifdef NOISE\nvec3 localPosition=outPosition-emitterWM[3].xyz;\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\noutDirection=outDirection+force*timeDelta;\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\noutAngle=angle+angularSpeed*timeDelta;\n#else\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\n#endif\n#ifdef ANIMATESHEET\nfloat offsetAge=outAge;\nfloat dist=cellInfos.y-cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=cellStartOffset;\noffsetAge+=cellStartOffset;\n#endif\nfloat ratio=clamp(mod(offsetAge*cellInfos.z,life)/life,0.,1.0);\noutCellIndex=float(int(cellInfos.x+ratio*dist));\n#endif\n}\n}"; + Ht.a.IncludesShadersStore.clipPlaneFragmentDeclaration2 = + "#ifdef CLIPPLANE\nin float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nin float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nin float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nin float fClipDistance4;\n#endif"; + Ht.a.ShadersStore.gpuRenderParticlesPixelShader = + "#version 300 es\nuniform sampler2D textureSampler;\nin vec2 vUV;\nin vec4 vColor;\nout vec4 outFragColor;\n#include\n#include\n#include\n#include\nvoid main() {\n#include\nvec4 textureColor=texture(textureSampler,vUV);\noutFragColor=textureColor*vColor;\n#ifdef BLENDMULTIPLYMODE\nfloat alpha=vColor.a*textureColor.a;\noutFragColor.rgb=outFragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);\n#endif\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\noutFragColor=applyImageProcessing(outFragColor);\n#endif\n#endif\n}\n"; + Ht.a.IncludesShadersStore.clipPlaneVertexDeclaration2 = + "#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nout float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nout float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nout float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nout float fClipDistance4;\n#endif"; + Ht.a.ShadersStore.gpuRenderParticlesVertexShader = + "#version 300 es\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\nuniform vec3 worldOffset;\n\nin vec3 position;\nin float age;\nin float life;\nin vec3 size;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef BILLBOARDSTRETCHED\nin vec3 direction;\n#endif\nin float angle;\n#ifdef ANIMATESHEET\nin float cellIndex;\n#endif\nin vec2 offset;\nin vec2 uv;\nout vec2 vUV;\nout vec4 vColor;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nuniform mat4 invView;\n#endif\n#include\n#ifdef COLORGRADIENTS\nuniform sampler2D colorGradientSampler;\n#else\nuniform vec4 colorDead;\nin vec4 color;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 sheetInfos;\n#endif\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn (position+worldOffset)+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn (position+worldOffset)+alignedCorner;\n}\n#endif\nvoid main() {\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/sheetInfos.z);\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\nvec2 uvScale=sheetInfos.xy;\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=uv;\n#endif\nfloat ratio=age/life;\n#ifdef COLORGRADIENTS\nvColor=texture(colorGradientSampler,vec2(ratio,0));\n#else\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\n#endif\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\n#ifdef BILLBOARD\nvec4 rotatedCorner;\nrotatedCorner.w=0.;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=(position+worldOffset)-eyePosition;\nyaxis.y=0.;\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(worldPos,1.0));\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=(position+worldOffset)-eyePosition;\nvec3 worldPos=rotateAlign(toCamera,rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(worldPos,1.0));\n#else\n\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nvec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;\n#endif\n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=0.;\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nvec3 yaxis=normalize(initialDirection);\nvec3 worldPos=rotate(yaxis,rotatedCorner);\n\nvec4 viewPosition=view*vec4(worldPos,1.0);\n#endif\ngl_Position=projection*viewPosition;\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nvec4 worldPos=invView*viewPosition;\n#endif\n#include\n}"; + var Da = (function (e) { + function t(t, i, n, r) { + void 0 === r && (r = false); + var a = e.call(this, t) || this; + (a.layerMask = 268435455), + (a._accumulatedCount = 0), + (a._targetIndex = 0), + (a._currentRenderId = -1), + (a._started = false), + (a._stopped = false), + (a._timeDelta = 0), + (a._actualFrame = 0), + (a._rawTextureWidth = 256), + (a.onDisposeObservable = new o.c()), + (a.forceDepthWrite = false), + (a._preWarmDone = false), + (a._scene = n || R.a.LastCreatedScene), + a._attachImageProcessingConfiguration(null), + (a._engine = a._scene.getEngine()), + i.randomTextureSize || delete i.randomTextureSize; + var s = h.a( + { + capacity: 5e4, + randomTextureSize: a._engine.getCaps().maxTextureSize, + }, + i + ), + c = i; + isFinite(c) && (s.capacity = c), + (a._capacity = s.capacity), + (a._activeCount = s.capacity), + (a._currentActiveCount = 0), + (a._isAnimationSheetEnabled = r), + a._scene.particleSystems.push(a), + (a._updateEffectOptions = { + attributes: [ + "position", + "age", + "life", + "seed", + "size", + "color", + "direction", + "initialDirection", + "angle", + "cellIndex", + "cellStartOffset", + "noiseCoordinates1", + "noiseCoordinates2", + ], + uniformsNames: [ + "currentCount", + "timeDelta", + "emitterWM", + "lifeTime", + "color1", + "color2", + "sizeRange", + "scaleRange", + "gravity", + "emitPower", + "direction1", + "direction2", + "minEmitBox", + "maxEmitBox", + "radius", + "directionRandomizer", + "height", + "coneAngle", + "stopFactor", + "angleRange", + "radiusRange", + "cellInfos", + "noiseStrength", + "limitVelocityDamping", + ], + uniformBuffersNames: [], + samplers: [ + "randomSampler", + "randomSampler2", + "sizeGradientSampler", + "angularSpeedGradientSampler", + "velocityGradientSampler", + "limitVelocityGradientSampler", + "noiseSampler", + "dragGradientSampler", + ], + defines: "", + fallbacks: null, + onCompiled: null, + onError: null, + indexParameters: null, + maxSimultaneousLights: 0, + transformFeedbackVaryings: [], + }), + (a.particleEmitterType = new Ea()); + for ( + var u = Math.min( + a._engine.getCaps().maxTextureSize, + s.randomTextureSize + ), + l = [], + f = 0; + f < u; + ++f + ) + l.push(Math.random()), + l.push(Math.random()), + l.push(Math.random()), + l.push(Math.random()); + for ( + a._randomTexture = new We( + new Float32Array(l), + u, + 1, + _.a.TEXTUREFORMAT_RGBA, + a._scene, + false, + false, + _.a.TEXTURE_NEAREST_SAMPLINGMODE, + _.a.TEXTURETYPE_FLOAT + ), a._randomTexture.wrapU = je.a.WRAP_ADDRESSMODE, a._randomTexture.wrapV = je.a.WRAP_ADDRESSMODE, l = [], - f = 0; f < u; ++f) - l.push(Math.random()), - l.push(Math.random()), - l.push(Math.random()), - l.push(Math.random()); - return a._randomTexture2 = new We(new Float32Array(l),u,1,_.a.TEXTUREFORMAT_RGBA,a._scene,false,false,_.a.TEXTURE_NEAREST_SAMPLINGMODE,_.a.TEXTURETYPE_FLOAT), - a._randomTexture2.wrapU = je.a.WRAP_ADDRESSMODE, - a._randomTexture2.wrapV = je.a.WRAP_ADDRESSMODE, - a._randomTextureSize = u, - a - } - return h.d(t, e), + f = 0; + f < u; + ++f + ) + l.push(Math.random()), + l.push(Math.random()), + l.push(Math.random()), + l.push(Math.random()); + return ( + (a._randomTexture2 = new We( + new Float32Array(l), + u, + 1, + _.a.TEXTUREFORMAT_RGBA, + a._scene, + false, + false, + _.a.TEXTURE_NEAREST_SAMPLINGMODE, + _.a.TEXTURETYPE_FLOAT + )), + (a._randomTexture2.wrapU = je.a.WRAP_ADDRESSMODE), + (a._randomTexture2.wrapV = je.a.WRAP_ADDRESSMODE), + (a._randomTextureSize = u), + a + ); + } + return ( + h.d(t, e), Object.defineProperty(t, "IsSupported", { - get: function() { - return !!R.a.LastCreatedEngine && R.a.LastCreatedEngine.webGLVersion > 1 - }, - enumerable: true, - configurable: true + get: function () { + return ( + !!R.a.LastCreatedEngine && + R.a.LastCreatedEngine.webGLVersion > 1 + ); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getCapacity = function () { + return this._capacity; }), - t.prototype.getCapacity = function() { - return this._capacity - } - , Object.defineProperty(t.prototype, "activeParticleCount", { - get: function() { - return this._activeCount - }, - set: function(e) { - this._activeCount = Math.min(e, this._capacity) - }, - enumerable: true, - configurable: true + get: function () { + return this._activeCount; + }, + set: function (e) { + this._activeCount = Math.min(e, this._capacity); + }, + enumerable: true, + configurable: true, }), - t.prototype.isReady = function() { - return this._updateEffect ? !!(this.emitter && this._updateEffect.isReady() && this._imageProcessingConfiguration.isReady() && this._renderEffect.isReady() && this.particleTexture && this.particleTexture.isReady()) : (this._recreateUpdateEffect(), - this._recreateRenderEffect(), - false) - } - , - t.prototype.isStarted = function() { - return this._started - } - , - t.prototype.start = function(e) { - var t = this; - if (void 0 === e && (e = this.startDelay), - !this.targetStopDuration && this._hasTargetStopDurationDependantGradient()) - throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set"; - e ? setTimeout(function() { - t.start(0) - }, e) : (this._started = true, - this._stopped = false, - this._preWarmDone = false, - this.beginAnimationOnStart && this.animations && this.animations.length > 0 && this.getScene().beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop)) - } - , - t.prototype.stop = function() { - this._stopped = true - } - , - t.prototype.reset = function() { - this._releaseBuffers(), + (t.prototype.isReady = function () { + return this._updateEffect + ? !!( + this.emitter && + this._updateEffect.isReady() && + this._imageProcessingConfiguration.isReady() && + this._renderEffect.isReady() && + this.particleTexture && + this.particleTexture.isReady() + ) + : (this._recreateUpdateEffect(), + this._recreateRenderEffect(), + false); + }), + (t.prototype.isStarted = function () { + return this._started; + }), + (t.prototype.start = function (e) { + var t = this; + if ( + (void 0 === e && (e = this.startDelay), + !this.targetStopDuration && + this._hasTargetStopDurationDependantGradient()) + ) + throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set"; + e + ? setTimeout(function () { + t.start(0); + }, e) + : ((this._started = true), + (this._stopped = false), + (this._preWarmDone = false), + this.beginAnimationOnStart && + this.animations && + this.animations.length > 0 && + this.getScene().beginAnimation( + this, + this.beginAnimationFrom, + this.beginAnimationTo, + this.beginAnimationLoop + )); + }), + (t.prototype.stop = function () { + this._stopped = true; + }), + (t.prototype.reset = function () { + this._releaseBuffers(), this._releaseVAOs(), - this._currentActiveCount = 0, - this._targetIndex = 0 - } - , - t.prototype.getClassName = function() { - return "GPUParticleSystem" - } - , - t.prototype._removeGradientAndTexture = function(t, i, n) { - return e.prototype._removeGradientAndTexture.call(this, t, i, n), - this._releaseBuffers(), - this - } - , - t.prototype.addColorGradient = function(e, t, i) { - this._colorGradients || (this._colorGradients = []); - var n = new Ee.c; - return n.gradient = e, - n.color1 = t, - this._colorGradients.push(n), - this._colorGradients.sort(function(e, t) { - return e.gradient < t.gradient ? -1 : e.gradient > t.gradient ? 1 : 0 - }), - this._colorGradientsTexture && (this._colorGradientsTexture.dispose(), - this._colorGradientsTexture = null), - this._releaseBuffers(), - this - } - , - t.prototype.removeColorGradient = function(e) { - return this._removeGradientAndTexture(e, this._colorGradients, this._colorGradientsTexture), - this._colorGradientsTexture = null, - this - } - , - t.prototype._addFactorGradient = function(e, t, i) { - var n = new Ee.d; - n.gradient = t, - n.factor1 = i, - e.push(n), - e.sort(function(e, t) { - return e.gradient < t.gradient ? -1 : e.gradient > t.gradient ? 1 : 0 - }), - this._releaseBuffers() - } - , - t.prototype.addSizeGradient = function(e, t) { - return this._sizeGradients || (this._sizeGradients = []), - this._addFactorGradient(this._sizeGradients, e, t), - this._sizeGradientsTexture && (this._sizeGradientsTexture.dispose(), - this._sizeGradientsTexture = null), - this._releaseBuffers(), - this - } - , - t.prototype.removeSizeGradient = function(e) { - return this._removeGradientAndTexture(e, this._sizeGradients, this._sizeGradientsTexture), - this._sizeGradientsTexture = null, - this - } - , - t.prototype.addAngularSpeedGradient = function(e, t) { - return this._angularSpeedGradients || (this._angularSpeedGradients = []), - this._addFactorGradient(this._angularSpeedGradients, e, t), - this._angularSpeedGradientsTexture && (this._angularSpeedGradientsTexture.dispose(), - this._angularSpeedGradientsTexture = null), - this._releaseBuffers(), - this - } - , - t.prototype.removeAngularSpeedGradient = function(e) { - return this._removeGradientAndTexture(e, this._angularSpeedGradients, this._angularSpeedGradientsTexture), - this._angularSpeedGradientsTexture = null, - this - } - , - t.prototype.addVelocityGradient = function(e, t) { - return this._velocityGradients || (this._velocityGradients = []), - this._addFactorGradient(this._velocityGradients, e, t), - this._velocityGradientsTexture && (this._velocityGradientsTexture.dispose(), - this._velocityGradientsTexture = null), - this._releaseBuffers(), - this - } - , - t.prototype.removeVelocityGradient = function(e) { - return this._removeGradientAndTexture(e, this._velocityGradients, this._velocityGradientsTexture), - this._velocityGradientsTexture = null, - this - } - , - t.prototype.addLimitVelocityGradient = function(e, t) { - return this._limitVelocityGradients || (this._limitVelocityGradients = []), - this._addFactorGradient(this._limitVelocityGradients, e, t), - this._limitVelocityGradientsTexture && (this._limitVelocityGradientsTexture.dispose(), - this._limitVelocityGradientsTexture = null), - this._releaseBuffers(), - this - } - , - t.prototype.removeLimitVelocityGradient = function(e) { - return this._removeGradientAndTexture(e, this._limitVelocityGradients, this._limitVelocityGradientsTexture), - this._limitVelocityGradientsTexture = null, - this - } - , - t.prototype.addDragGradient = function(e, t) { - return this._dragGradients || (this._dragGradients = []), - this._addFactorGradient(this._dragGradients, e, t), - this._dragGradientsTexture && (this._dragGradientsTexture.dispose(), - this._dragGradientsTexture = null), - this._releaseBuffers(), - this - } - , - t.prototype.removeDragGradient = function(e) { - return this._removeGradientAndTexture(e, this._dragGradients, this._dragGradientsTexture), - this._dragGradientsTexture = null, - this - } - , - t.prototype.addEmitRateGradient = function(e, t, i) { - return this - } - , - t.prototype.removeEmitRateGradient = function(e) { - return this - } - , - t.prototype.addStartSizeGradient = function(e, t, i) { - return this - } - , - t.prototype.removeStartSizeGradient = function(e) { - return this - } - , - t.prototype.addColorRemapGradient = function(e, t, i) { - return this - } - , - t.prototype.removeColorRemapGradient = function() { - return this - } - , - t.prototype.addAlphaRemapGradient = function(e, t, i) { - return this - } - , - t.prototype.removeAlphaRemapGradient = function() { - return this - } - , - t.prototype.addRampGradient = function(e, t) { - return this - } - , - t.prototype.removeRampGradient = function() { - return this - } - , - t.prototype.getRampGradients = function() { - return null - } - , - Object.defineProperty(t.prototype, "useRampGradients", { - get: function() { - return false - }, - set: function(e) {}, - enumerable: true, - configurable: true + (this._currentActiveCount = 0), + (this._targetIndex = 0); }), - t.prototype.addLifeTimeGradient = function(e, t, i) { - return this - } - , - t.prototype.removeLifeTimeGradient = function(e) { - return this - } - , - t.prototype._reset = function() { - this._releaseBuffers() - } - , - t.prototype._createUpdateVAO = function(e) { - var t = {}; - t.position = e.createVertexBuffer("position", 0, 3), - t.age = e.createVertexBuffer("age", 3, 1), - t.life = e.createVertexBuffer("life", 4, 1), - t.seed = e.createVertexBuffer("seed", 5, 4), - t.size = e.createVertexBuffer("size", 9, 3); - var i = 12; - this._colorGradientsTexture || (t.color = e.createVertexBuffer("color", i, 4), - i += 4), - t.direction = e.createVertexBuffer("direction", i, 3), - i += 3, - this._isBillboardBased || (t.initialDirection = e.createVertexBuffer("initialDirection", i, 3), - i += 3), - this._angularSpeedGradientsTexture ? (t.angle = e.createVertexBuffer("angle", i, 1), - i += 1) : (t.angle = e.createVertexBuffer("angle", i, 2), - i += 2), - this._isAnimationSheetEnabled && (t.cellIndex = e.createVertexBuffer("cellIndex", i, 1), - i += 1, - this.spriteRandomStartCell && (t.cellStartOffset = e.createVertexBuffer("cellStartOffset", i, 1), - i += 1)), - this.noiseTexture && (t.noiseCoordinates1 = e.createVertexBuffer("noiseCoordinates1", i, 3), - i += 3, - t.noiseCoordinates2 = e.createVertexBuffer("noiseCoordinates2", i, 3), - i += 3); - var n = this._engine.recordVertexArrayObject(t, null, this._updateEffect); - return this._engine.bindArrayBuffer(null), - n - } - , - t.prototype._createRenderVAO = function(e, t) { - var i = {}; - i.position = e.createVertexBuffer("position", 0, 3, this._attributesStrideSize, true), - i.age = e.createVertexBuffer("age", 3, 1, this._attributesStrideSize, true), - i.life = e.createVertexBuffer("life", 4, 1, this._attributesStrideSize, true), - i.size = e.createVertexBuffer("size", 9, 3, this._attributesStrideSize, true); - var n = 12; - this._colorGradientsTexture || (i.color = e.createVertexBuffer("color", n, 4, this._attributesStrideSize, true), - n += 4), - this.billboardMode === Ia.BILLBOARDMODE_STRETCHED && (i.direction = e.createVertexBuffer("direction", n, 3, this._attributesStrideSize, true)), - n += 3, - this._isBillboardBased || (i.initialDirection = e.createVertexBuffer("initialDirection", n, 3, this._attributesStrideSize, true), - n += 3), - i.angle = e.createVertexBuffer("angle", n, 1, this._attributesStrideSize, true), - this._angularSpeedGradientsTexture ? n++ : n += 2, - this._isAnimationSheetEnabled && (i.cellIndex = e.createVertexBuffer("cellIndex", n, 1, this._attributesStrideSize, true), - n += 1, - this.spriteRandomStartCell && (i.cellStartOffset = e.createVertexBuffer("cellStartOffset", n, 1, this._attributesStrideSize, true), - n += 1)), - this.noiseTexture && (i.noiseCoordinates1 = e.createVertexBuffer("noiseCoordinates1", n, 3, this._attributesStrideSize, true), - n += 3, - i.noiseCoordinates2 = e.createVertexBuffer("noiseCoordinates2", n, 3, this._attributesStrideSize, true), - n += 3), - i.offset = t.createVertexBuffer("offset", 0, 2), - i.uv = t.createVertexBuffer("uv", 2, 2); - var r = this._engine.recordVertexArrayObject(i, null, this._renderEffect); - return this._engine.bindArrayBuffer(null), - r - } - , - t.prototype._initialize = function(e) { - if (void 0 === e && (e = false), - !this._buffer0 || e) { - var t = this._scene.getEngine() - , i = new Array; - this._attributesStrideSize = 21, - this._targetIndex = 0, - this.isBillboardBased || (this._attributesStrideSize += 3), - this._colorGradientsTexture && (this._attributesStrideSize -= 4), - this._angularSpeedGradientsTexture && (this._attributesStrideSize -= 1), - this._isAnimationSheetEnabled && (this._attributesStrideSize += 1, - this.spriteRandomStartCell && (this._attributesStrideSize += 1)), - this.noiseTexture && (this._attributesStrideSize += 6); - for (var n = 0; n < this._capacity; n++) - i.push(0), - i.push(0), - i.push(0), - i.push(0), - i.push(0), - i.push(Math.random()), - i.push(Math.random()), - i.push(Math.random()), - i.push(Math.random()), - i.push(0), - i.push(0), - i.push(0), - this._colorGradientsTexture || (i.push(0), - i.push(0), - i.push(0), - i.push(0)), - i.push(0), - i.push(0), - i.push(0), - this.isBillboardBased || (i.push(0), - i.push(0), - i.push(0)), - i.push(0), - this._angularSpeedGradientsTexture || i.push(0), - this._isAnimationSheetEnabled && (i.push(0), - this.spriteRandomStartCell && i.push(0)), - this.noiseTexture && (i.push(Math.random()), - i.push(Math.random()), - i.push(Math.random()), - i.push(Math.random()), - i.push(Math.random()), - i.push(Math.random())); - var r = new Float32Array([.5, .5, 1, 1, -.5, .5, 0, 1, -.5, -.5, 0, 0, .5, -.5, 1, 0]); - this._buffer0 = new Si.a(t,i,false,this._attributesStrideSize), - this._buffer1 = new Si.a(t,i,false,this._attributesStrideSize), - this._spriteBuffer = new Si.a(t,r,false,4), - this._updateVAO = [], - this._updateVAO.push(this._createUpdateVAO(this._buffer0)), - this._updateVAO.push(this._createUpdateVAO(this._buffer1)), - this._renderVAO = [], - this._renderVAO.push(this._createRenderVAO(this._buffer1, this._spriteBuffer)), - this._renderVAO.push(this._createRenderVAO(this._buffer0, this._spriteBuffer)), - this._sourceBuffer = this._buffer0, - this._targetBuffer = this._buffer1 - } - } - , - t.prototype._recreateUpdateEffect = function() { - var e = this.particleEmitterType ? this.particleEmitterType.getEffectDefines() : ""; - this._isBillboardBased && (e += "\n#define BILLBOARD"), - this._colorGradientsTexture && (e += "\n#define COLORGRADIENTS"), - this._sizeGradientsTexture && (e += "\n#define SIZEGRADIENTS"), - this._angularSpeedGradientsTexture && (e += "\n#define ANGULARSPEEDGRADIENTS"), - this._velocityGradientsTexture && (e += "\n#define VELOCITYGRADIENTS"), - this._limitVelocityGradientsTexture && (e += "\n#define LIMITVELOCITYGRADIENTS"), - this._dragGradientsTexture && (e += "\n#define DRAGGRADIENTS"), - this.isAnimationSheetEnabled && (e += "\n#define ANIMATESHEET", - this.spriteRandomStartCell && (e += "\n#define ANIMATESHEETRANDOMSTART")), + (t.prototype.getClassName = function () { + return "GPUParticleSystem"; + }), + (t.prototype._removeGradientAndTexture = function ( + t, + i, + n + ) { + return ( + e.prototype._removeGradientAndTexture.call( + this, + t, + i, + n + ), + this._releaseBuffers(), + this + ); + }), + (t.prototype.addColorGradient = function (e, t, i) { + this._colorGradients || (this._colorGradients = []); + var n = new Ee.c(); + return ( + (n.gradient = e), + (n.color1 = t), + this._colorGradients.push(n), + this._colorGradients.sort(function (e, t) { + return e.gradient < t.gradient + ? -1 + : e.gradient > t.gradient + ? 1 + : 0; + }), + this._colorGradientsTexture && + (this._colorGradientsTexture.dispose(), + (this._colorGradientsTexture = null)), + this._releaseBuffers(), + this + ); + }), + (t.prototype.removeColorGradient = function (e) { + return ( + this._removeGradientAndTexture( + e, + this._colorGradients, + this._colorGradientsTexture + ), + (this._colorGradientsTexture = null), + this + ); + }), + (t.prototype._addFactorGradient = function (e, t, i) { + var n = new Ee.d(); + (n.gradient = t), + (n.factor1 = i), + e.push(n), + e.sort(function (e, t) { + return e.gradient < t.gradient + ? -1 + : e.gradient > t.gradient + ? 1 + : 0; + }), + this._releaseBuffers(); + }), + (t.prototype.addSizeGradient = function (e, t) { + return ( + this._sizeGradients || (this._sizeGradients = []), + this._addFactorGradient(this._sizeGradients, e, t), + this._sizeGradientsTexture && + (this._sizeGradientsTexture.dispose(), + (this._sizeGradientsTexture = null)), + this._releaseBuffers(), + this + ); + }), + (t.prototype.removeSizeGradient = function (e) { + return ( + this._removeGradientAndTexture( + e, + this._sizeGradients, + this._sizeGradientsTexture + ), + (this._sizeGradientsTexture = null), + this + ); + }), + (t.prototype.addAngularSpeedGradient = function (e, t) { + return ( + this._angularSpeedGradients || + (this._angularSpeedGradients = []), + this._addFactorGradient( + this._angularSpeedGradients, + e, + t + ), + this._angularSpeedGradientsTexture && + (this._angularSpeedGradientsTexture.dispose(), + (this._angularSpeedGradientsTexture = null)), + this._releaseBuffers(), + this + ); + }), + (t.prototype.removeAngularSpeedGradient = function (e) { + return ( + this._removeGradientAndTexture( + e, + this._angularSpeedGradients, + this._angularSpeedGradientsTexture + ), + (this._angularSpeedGradientsTexture = null), + this + ); + }), + (t.prototype.addVelocityGradient = function (e, t) { + return ( + this._velocityGradients || + (this._velocityGradients = []), + this._addFactorGradient(this._velocityGradients, e, t), + this._velocityGradientsTexture && + (this._velocityGradientsTexture.dispose(), + (this._velocityGradientsTexture = null)), + this._releaseBuffers(), + this + ); + }), + (t.prototype.removeVelocityGradient = function (e) { + return ( + this._removeGradientAndTexture( + e, + this._velocityGradients, + this._velocityGradientsTexture + ), + (this._velocityGradientsTexture = null), + this + ); + }), + (t.prototype.addLimitVelocityGradient = function (e, t) { + return ( + this._limitVelocityGradients || + (this._limitVelocityGradients = []), + this._addFactorGradient( + this._limitVelocityGradients, + e, + t + ), + this._limitVelocityGradientsTexture && + (this._limitVelocityGradientsTexture.dispose(), + (this._limitVelocityGradientsTexture = null)), + this._releaseBuffers(), + this + ); + }), + (t.prototype.removeLimitVelocityGradient = function (e) { + return ( + this._removeGradientAndTexture( + e, + this._limitVelocityGradients, + this._limitVelocityGradientsTexture + ), + (this._limitVelocityGradientsTexture = null), + this + ); + }), + (t.prototype.addDragGradient = function (e, t) { + return ( + this._dragGradients || (this._dragGradients = []), + this._addFactorGradient(this._dragGradients, e, t), + this._dragGradientsTexture && + (this._dragGradientsTexture.dispose(), + (this._dragGradientsTexture = null)), + this._releaseBuffers(), + this + ); + }), + (t.prototype.removeDragGradient = function (e) { + return ( + this._removeGradientAndTexture( + e, + this._dragGradients, + this._dragGradientsTexture + ), + (this._dragGradientsTexture = null), + this + ); + }), + (t.prototype.addEmitRateGradient = function (e, t, i) { + return this; + }), + (t.prototype.removeEmitRateGradient = function (e) { + return this; + }), + (t.prototype.addStartSizeGradient = function (e, t, i) { + return this; + }), + (t.prototype.removeStartSizeGradient = function (e) { + return this; + }), + (t.prototype.addColorRemapGradient = function (e, t, i) { + return this; + }), + (t.prototype.removeColorRemapGradient = function () { + return this; + }), + (t.prototype.addAlphaRemapGradient = function (e, t, i) { + return this; + }), + (t.prototype.removeAlphaRemapGradient = function () { + return this; + }), + (t.prototype.addRampGradient = function (e, t) { + return this; + }), + (t.prototype.removeRampGradient = function () { + return this; + }), + (t.prototype.getRampGradients = function () { + return null; + }), + Object.defineProperty(t.prototype, "useRampGradients", { + get: function () { + return false; + }, + set: function (e) {}, + enumerable: true, + configurable: true, + }), + (t.prototype.addLifeTimeGradient = function (e, t, i) { + return this; + }), + (t.prototype.removeLifeTimeGradient = function (e) { + return this; + }), + (t.prototype._reset = function () { + this._releaseBuffers(); + }), + (t.prototype._createUpdateVAO = function (e) { + var t = {}; + (t.position = e.createVertexBuffer("position", 0, 3)), + (t.age = e.createVertexBuffer("age", 3, 1)), + (t.life = e.createVertexBuffer("life", 4, 1)), + (t.seed = e.createVertexBuffer("seed", 5, 4)), + (t.size = e.createVertexBuffer("size", 9, 3)); + var i = 12; + this._colorGradientsTexture || + ((t.color = e.createVertexBuffer("color", i, 4)), + (i += 4)), + (t.direction = e.createVertexBuffer("direction", i, 3)), + (i += 3), + this._isBillboardBased || + ((t.initialDirection = e.createVertexBuffer( + "initialDirection", + i, + 3 + )), + (i += 3)), + this._angularSpeedGradientsTexture + ? ((t.angle = e.createVertexBuffer("angle", i, 1)), + (i += 1)) + : ((t.angle = e.createVertexBuffer("angle", i, 2)), + (i += 2)), + this._isAnimationSheetEnabled && + ((t.cellIndex = e.createVertexBuffer( + "cellIndex", + i, + 1 + )), + (i += 1), + this.spriteRandomStartCell && + ((t.cellStartOffset = e.createVertexBuffer( + "cellStartOffset", + i, + 1 + )), + (i += 1))), + this.noiseTexture && + ((t.noiseCoordinates1 = e.createVertexBuffer( + "noiseCoordinates1", + i, + 3 + )), + (i += 3), + (t.noiseCoordinates2 = e.createVertexBuffer( + "noiseCoordinates2", + i, + 3 + )), + (i += 3)); + var n = this._engine.recordVertexArrayObject( + t, + null, + this._updateEffect + ); + return this._engine.bindArrayBuffer(null), n; + }), + (t.prototype._createRenderVAO = function (e, t) { + var i = {}; + (i.position = e.createVertexBuffer( + "position", + 0, + 3, + this._attributesStrideSize, + true + )), + (i.age = e.createVertexBuffer( + "age", + 3, + 1, + this._attributesStrideSize, + true + )), + (i.life = e.createVertexBuffer( + "life", + 4, + 1, + this._attributesStrideSize, + true + )), + (i.size = e.createVertexBuffer( + "size", + 9, + 3, + this._attributesStrideSize, + true + )); + var n = 12; + this._colorGradientsTexture || + ((i.color = e.createVertexBuffer( + "color", + n, + 4, + this._attributesStrideSize, + true + )), + (n += 4)), + this.billboardMode === Ia.BILLBOARDMODE_STRETCHED && + (i.direction = e.createVertexBuffer( + "direction", + n, + 3, + this._attributesStrideSize, + true + )), + (n += 3), + this._isBillboardBased || + ((i.initialDirection = e.createVertexBuffer( + "initialDirection", + n, + 3, + this._attributesStrideSize, + true + )), + (n += 3)), + (i.angle = e.createVertexBuffer( + "angle", + n, + 1, + this._attributesStrideSize, + true + )), + this._angularSpeedGradientsTexture ? n++ : (n += 2), + this._isAnimationSheetEnabled && + ((i.cellIndex = e.createVertexBuffer( + "cellIndex", + n, + 1, + this._attributesStrideSize, + true + )), + (n += 1), + this.spriteRandomStartCell && + ((i.cellStartOffset = e.createVertexBuffer( + "cellStartOffset", + n, + 1, + this._attributesStrideSize, + true + )), + (n += 1))), + this.noiseTexture && + ((i.noiseCoordinates1 = e.createVertexBuffer( + "noiseCoordinates1", + n, + 3, + this._attributesStrideSize, + true + )), + (n += 3), + (i.noiseCoordinates2 = e.createVertexBuffer( + "noiseCoordinates2", + n, + 3, + this._attributesStrideSize, + true + )), + (n += 3)), + (i.offset = t.createVertexBuffer("offset", 0, 2)), + (i.uv = t.createVertexBuffer("uv", 2, 2)); + var r = this._engine.recordVertexArrayObject( + i, + null, + this._renderEffect + ); + return this._engine.bindArrayBuffer(null), r; + }), + (t.prototype._initialize = function (e) { + if ((void 0 === e && (e = false), !this._buffer0 || e)) { + var t = this._scene.getEngine(), + i = new Array(); + (this._attributesStrideSize = 21), + (this._targetIndex = 0), + this.isBillboardBased || + (this._attributesStrideSize += 3), + this._colorGradientsTexture && + (this._attributesStrideSize -= 4), + this._angularSpeedGradientsTexture && + (this._attributesStrideSize -= 1), + this._isAnimationSheetEnabled && + ((this._attributesStrideSize += 1), + this.spriteRandomStartCell && + (this._attributesStrideSize += 1)), + this.noiseTexture && + (this._attributesStrideSize += 6); + for (var n = 0; n < this._capacity; n++) + i.push(0), + i.push(0), + i.push(0), + i.push(0), + i.push(0), + i.push(Math.random()), + i.push(Math.random()), + i.push(Math.random()), + i.push(Math.random()), + i.push(0), + i.push(0), + i.push(0), + this._colorGradientsTexture || + (i.push(0), i.push(0), i.push(0), i.push(0)), + i.push(0), + i.push(0), + i.push(0), + this.isBillboardBased || + (i.push(0), i.push(0), i.push(0)), + i.push(0), + this._angularSpeedGradientsTexture || i.push(0), + this._isAnimationSheetEnabled && + (i.push(0), + this.spriteRandomStartCell && i.push(0)), + this.noiseTexture && + (i.push(Math.random()), + i.push(Math.random()), + i.push(Math.random()), + i.push(Math.random()), + i.push(Math.random()), + i.push(Math.random())); + var r = new Float32Array([ + 0.5, 0.5, 1, 1, -0.5, 0.5, 0, 1, -0.5, -0.5, 0, 0, + 0.5, -0.5, 1, 0, + ]); + (this._buffer0 = new Si.a( + t, + i, + false, + this._attributesStrideSize + )), + (this._buffer1 = new Si.a( + t, + i, + false, + this._attributesStrideSize + )), + (this._spriteBuffer = new Si.a(t, r, false, 4)), + (this._updateVAO = []), + this._updateVAO.push( + this._createUpdateVAO(this._buffer0) + ), + this._updateVAO.push( + this._createUpdateVAO(this._buffer1) + ), + (this._renderVAO = []), + this._renderVAO.push( + this._createRenderVAO( + this._buffer1, + this._spriteBuffer + ) + ), + this._renderVAO.push( + this._createRenderVAO( + this._buffer0, + this._spriteBuffer + ) + ), + (this._sourceBuffer = this._buffer0), + (this._targetBuffer = this._buffer1); + } + }), + (t.prototype._recreateUpdateEffect = function () { + var e = this.particleEmitterType + ? this.particleEmitterType.getEffectDefines() + : ""; + this._isBillboardBased && (e += "\n#define BILLBOARD"), + this._colorGradientsTexture && + (e += "\n#define COLORGRADIENTS"), + this._sizeGradientsTexture && + (e += "\n#define SIZEGRADIENTS"), + this._angularSpeedGradientsTexture && + (e += "\n#define ANGULARSPEEDGRADIENTS"), + this._velocityGradientsTexture && + (e += "\n#define VELOCITYGRADIENTS"), + this._limitVelocityGradientsTexture && + (e += "\n#define LIMITVELOCITYGRADIENTS"), + this._dragGradientsTexture && + (e += "\n#define DRAGGRADIENTS"), + this.isAnimationSheetEnabled && + ((e += "\n#define ANIMATESHEET"), + this.spriteRandomStartCell && + (e += "\n#define ANIMATESHEETRANDOMSTART")), this.noiseTexture && (e += "\n#define NOISE"), - this._updateEffect && this._updateEffectOptions.defines === e || (this._updateEffectOptions.transformFeedbackVaryings = ["outPosition", "outAge", "outLife", "outSeed", "outSize"], - this._colorGradientsTexture || this._updateEffectOptions.transformFeedbackVaryings.push("outColor"), - this._updateEffectOptions.transformFeedbackVaryings.push("outDirection"), - this._isBillboardBased || this._updateEffectOptions.transformFeedbackVaryings.push("outInitialDirection"), - this._updateEffectOptions.transformFeedbackVaryings.push("outAngle"), - this.isAnimationSheetEnabled && (this._updateEffectOptions.transformFeedbackVaryings.push("outCellIndex"), - this.spriteRandomStartCell && this._updateEffectOptions.transformFeedbackVaryings.push("outCellStartOffset")), - this.noiseTexture && (this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates1"), - this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates2")), - this._updateEffectOptions.defines = e, - this._updateEffect = new Ht.a("gpuUpdateParticles",this._updateEffectOptions,this._scene.getEngine())) - } - , - t.prototype._recreateRenderEffect = function() { - var e = ""; - if (this._scene.clipPlane && (e = "\n#define CLIPPLANE"), + (this._updateEffect && + this._updateEffectOptions.defines === e) || + ((this._updateEffectOptions.transformFeedbackVaryings = + [ + "outPosition", + "outAge", + "outLife", + "outSeed", + "outSize", + ]), + this._colorGradientsTexture || + this._updateEffectOptions.transformFeedbackVaryings.push( + "outColor" + ), + this._updateEffectOptions.transformFeedbackVaryings.push( + "outDirection" + ), + this._isBillboardBased || + this._updateEffectOptions.transformFeedbackVaryings.push( + "outInitialDirection" + ), + this._updateEffectOptions.transformFeedbackVaryings.push( + "outAngle" + ), + this.isAnimationSheetEnabled && + (this._updateEffectOptions.transformFeedbackVaryings.push( + "outCellIndex" + ), + this.spriteRandomStartCell && + this._updateEffectOptions.transformFeedbackVaryings.push( + "outCellStartOffset" + )), + this.noiseTexture && + (this._updateEffectOptions.transformFeedbackVaryings.push( + "outNoiseCoordinates1" + ), + this._updateEffectOptions.transformFeedbackVaryings.push( + "outNoiseCoordinates2" + )), + (this._updateEffectOptions.defines = e), + (this._updateEffect = new Ht.a( + "gpuUpdateParticles", + this._updateEffectOptions, + this._scene.getEngine() + ))); + }), + (t.prototype._recreateRenderEffect = function () { + var e = ""; + if ( + (this._scene.clipPlane && (e = "\n#define CLIPPLANE"), this._scene.clipPlane2 && (e = "\n#define CLIPPLANE2"), this._scene.clipPlane3 && (e = "\n#define CLIPPLANE3"), this._scene.clipPlane4 && (e = "\n#define CLIPPLANE4"), - this.blendMode === Ia.BLENDMODE_MULTIPLY && (e = "\n#define BLENDMULTIPLYMODE"), + this.blendMode === Ia.BLENDMODE_MULTIPLY && + (e = "\n#define BLENDMULTIPLYMODE"), this._isBillboardBased) - switch (e += "\n#define BILLBOARD", - this.billboardMode) { - case Ia.BILLBOARDMODE_Y: - e += "\n#define BILLBOARDY"; - break; - case Ia.BILLBOARDMODE_STRETCHED: - e += "\n#define BILLBOARDSTRETCHED"; - break; - case Ia.BILLBOARDMODE_ALL: - } - if (this._colorGradientsTexture && (e += "\n#define COLORGRADIENTS"), - this.isAnimationSheetEnabled && (e += "\n#define ANIMATESHEET"), - this._imageProcessingConfiguration && (this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines), - e += "\n" + this._imageProcessingConfigurationDefines.toString()), - !this._renderEffect || this._renderEffect.defines !== e) { - var t = ["worldOffset", "view", "projection", "colorDead", "invView", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "sheetInfos", "translationPivot", "eyePosition"] - , i = ["textureSampler", "colorGradientSampler"]; - yi.a && (yi.a.PrepareUniforms(t, this._imageProcessingConfigurationDefines), - yi.a.PrepareSamplers(i, this._imageProcessingConfigurationDefines)), - this._renderEffect = new Ht.a("gpuRenderParticles",["position", "age", "life", "size", "color", "offset", "uv", "direction", "initialDirection", "angle", "cellIndex"],t,i,this._scene.getEngine(),e) + ) + switch ( + ((e += "\n#define BILLBOARD"), this.billboardMode) + ) { + case Ia.BILLBOARDMODE_Y: + e += "\n#define BILLBOARDY"; + break; + case Ia.BILLBOARDMODE_STRETCHED: + e += "\n#define BILLBOARDSTRETCHED"; + break; + case Ia.BILLBOARDMODE_ALL: } - } - , - t.prototype.animate = function(e) { - void 0 === e && (e = false), - this._timeDelta = this.updateSpeed * (e ? this.preWarmStepOffset : this._scene.getAnimationRatio()), - this._actualFrame += this._timeDelta, - this._stopped || this.targetStopDuration && this._actualFrame >= this.targetStopDuration && this.stop() - } - , - t.prototype._createFactorGradientTexture = function(e, t) { - var i = this[t]; - if (e && e.length && !i) { - for (var n = new Float32Array(this._rawTextureWidth), r = 0; r < this._rawTextureWidth; r++) { - var o = r / this._rawTextureWidth; - Ee.h.GetCurrentGradient(o, e, function(e, t, i) { - n[r] = L.a.Lerp(e.factor1, t.factor1, i) - }) - } - this[t] = We.CreateRTexture(n, this._rawTextureWidth, 1, this._scene, false, false, je.a.NEAREST_SAMPLINGMODE) + if ( + (this._colorGradientsTexture && + (e += "\n#define COLORGRADIENTS"), + this.isAnimationSheetEnabled && + (e += "\n#define ANIMATESHEET"), + this._imageProcessingConfiguration && + (this._imageProcessingConfiguration.prepareDefines( + this._imageProcessingConfigurationDefines + ), + (e += + "\n" + + this._imageProcessingConfigurationDefines.toString())), + !this._renderEffect || this._renderEffect.defines !== e) + ) { + var t = [ + "worldOffset", + "view", + "projection", + "colorDead", + "invView", + "vClipPlane", + "vClipPlane2", + "vClipPlane3", + "vClipPlane4", + "sheetInfos", + "translationPivot", + "eyePosition", + ], + i = ["textureSampler", "colorGradientSampler"]; + yi.a && + (yi.a.PrepareUniforms( + t, + this._imageProcessingConfigurationDefines + ), + yi.a.PrepareSamplers( + i, + this._imageProcessingConfigurationDefines + )), + (this._renderEffect = new Ht.a( + "gpuRenderParticles", + [ + "position", + "age", + "life", + "size", + "color", + "offset", + "uv", + "direction", + "initialDirection", + "angle", + "cellIndex", + ], + t, + i, + this._scene.getEngine(), + e + )); + } + }), + (t.prototype.animate = function (e) { + void 0 === e && (e = false), + (this._timeDelta = + this.updateSpeed * + (e + ? this.preWarmStepOffset + : this._scene.getAnimationRatio())), + (this._actualFrame += this._timeDelta), + this._stopped || + (this.targetStopDuration && + this._actualFrame >= this.targetStopDuration && + this.stop()); + }), + (t.prototype._createFactorGradientTexture = function ( + e, + t + ) { + var i = this[t]; + if (e && e.length && !i) { + for ( + var n = new Float32Array(this._rawTextureWidth), + r = 0; + r < this._rawTextureWidth; + r++ + ) { + var o = r / this._rawTextureWidth; + Ee.h.GetCurrentGradient(o, e, function (e, t, i) { + n[r] = L.a.Lerp(e.factor1, t.factor1, i); + }); } - } - , - t.prototype._createSizeGradientTexture = function() { - this._createFactorGradientTexture(this._sizeGradients, "_sizeGradientsTexture") - } - , - t.prototype._createAngularSpeedGradientTexture = function() { - this._createFactorGradientTexture(this._angularSpeedGradients, "_angularSpeedGradientsTexture") - } - , - t.prototype._createVelocityGradientTexture = function() { - this._createFactorGradientTexture(this._velocityGradients, "_velocityGradientsTexture") - } - , - t.prototype._createLimitVelocityGradientTexture = function() { - this._createFactorGradientTexture(this._limitVelocityGradients, "_limitVelocityGradientsTexture") - } - , - t.prototype._createDragGradientTexture = function() { - this._createFactorGradientTexture(this._dragGradients, "_dragGradientsTexture") - } - , - t.prototype._createColorGradientTexture = function() { - if (this._colorGradients && this._colorGradients.length && !this._colorGradientsTexture) { - for (var e = new Uint8Array(4 * this._rawTextureWidth), t = a.t.Color4[0], i = 0; i < this._rawTextureWidth; i++) { - var n = i / this._rawTextureWidth; - Ee.h.GetCurrentGradient(n, this._colorGradients, function(n, r, o) { - a.f.LerpToRef(n.color1, r.color1, o, t), - e[4 * i] = 255 * t.r, - e[4 * i + 1] = 255 * t.g, - e[4 * i + 2] = 255 * t.b, - e[4 * i + 3] = 255 * t.a - }) + this[t] = We.CreateRTexture( + n, + this._rawTextureWidth, + 1, + this._scene, + false, + false, + je.a.NEAREST_SAMPLINGMODE + ); + } + }), + (t.prototype._createSizeGradientTexture = function () { + this._createFactorGradientTexture( + this._sizeGradients, + "_sizeGradientsTexture" + ); + }), + (t.prototype._createAngularSpeedGradientTexture = + function () { + this._createFactorGradientTexture( + this._angularSpeedGradients, + "_angularSpeedGradientsTexture" + ); + }), + (t.prototype._createVelocityGradientTexture = function () { + this._createFactorGradientTexture( + this._velocityGradients, + "_velocityGradientsTexture" + ); + }), + (t.prototype._createLimitVelocityGradientTexture = + function () { + this._createFactorGradientTexture( + this._limitVelocityGradients, + "_limitVelocityGradientsTexture" + ); + }), + (t.prototype._createDragGradientTexture = function () { + this._createFactorGradientTexture( + this._dragGradients, + "_dragGradientsTexture" + ); + }), + (t.prototype._createColorGradientTexture = function () { + if ( + this._colorGradients && + this._colorGradients.length && + !this._colorGradientsTexture + ) { + for ( + var e = new Uint8Array(4 * this._rawTextureWidth), + t = a.t.Color4[0], + i = 0; + i < this._rawTextureWidth; + i++ + ) { + var n = i / this._rawTextureWidth; + Ee.h.GetCurrentGradient( + n, + this._colorGradients, + function (n, r, o) { + a.f.LerpToRef(n.color1, r.color1, o, t), + (e[4 * i] = 255 * t.r), + (e[4 * i + 1] = 255 * t.g), + (e[4 * i + 2] = 255 * t.b), + (e[4 * i + 3] = 255 * t.a); } - this._colorGradientsTexture = We.CreateRGBATexture(e, this._rawTextureWidth, 1, this._scene, false, false, je.a.NEAREST_SAMPLINGMODE) + ); } - } - , - t.prototype.render = function(e) { - if (void 0 === e && (e = false), - !this._started) - return 0; - if (this._createColorGradientTexture(), + this._colorGradientsTexture = We.CreateRGBATexture( + e, + this._rawTextureWidth, + 1, + this._scene, + false, + false, + je.a.NEAREST_SAMPLINGMODE + ); + } + }), + (t.prototype.render = function (e) { + if ((void 0 === e && (e = false), !this._started)) + return 0; + if ( + (this._createColorGradientTexture(), this._createSizeGradientTexture(), this._createAngularSpeedGradientTexture(), this._createVelocityGradientTexture(), @@ -87336,13487 +120069,17980 @@ and limitations under the License. this._recreateUpdateEffect(), this._recreateRenderEffect(), !this.isReady()) - return 0; - if (!e) { - if (!this._preWarmDone && this.preWarmCycles) { - for (var t = 0; t < this.preWarmCycles; t++) - this.animate(true), - this.render(true); - this._preWarmDone = true - } - if (this._currentRenderId === this._scene.getFrameId()) - return 0; - this._currentRenderId = this._scene.getFrameId() + ) + return 0; + if (!e) { + if (!this._preWarmDone && this.preWarmCycles) { + for (var t = 0; t < this.preWarmCycles; t++) + this.animate(true), this.render(true); + this._preWarmDone = true; } - if (this._initialize(), - this._accumulatedCount += this.emitRate * this._timeDelta, - this._accumulatedCount > 1) { - var i = 0 | this._accumulatedCount; - this._accumulatedCount -= i, - this._currentActiveCount = Math.min(this._activeCount, this._currentActiveCount + i) - } - if (!this._currentActiveCount) - return 0; - var n; - if (this._engine.enableEffect(this._updateEffect), + if (this._currentRenderId === this._scene.getFrameId()) + return 0; + this._currentRenderId = this._scene.getFrameId(); + } + if ( + (this._initialize(), + (this._accumulatedCount += + this.emitRate * this._timeDelta), + this._accumulatedCount > 1) + ) { + var i = 0 | this._accumulatedCount; + (this._accumulatedCount -= i), + (this._currentActiveCount = Math.min( + this._activeCount, + this._currentActiveCount + i + )); + } + if (!this._currentActiveCount) return 0; + var n; + if ( + (this._engine.enableEffect(this._updateEffect), this._engine.setState(false), - this._updateEffect.setFloat("currentCount", this._currentActiveCount), - this._updateEffect.setFloat("timeDelta", this._timeDelta), - this._updateEffect.setFloat("stopFactor", this._stopped ? 0 : 1), - this._updateEffect.setTexture("randomSampler", this._randomTexture), - this._updateEffect.setTexture("randomSampler2", this._randomTexture2), - this._updateEffect.setFloat2("lifeTime", this.minLifeTime, this.maxLifeTime), - this._updateEffect.setFloat2("emitPower", this.minEmitPower, this.maxEmitPower), - this._colorGradientsTexture || (this._updateEffect.setDirectColor4("color1", this.color1), - this._updateEffect.setDirectColor4("color2", this.color2)), - this._updateEffect.setFloat2("sizeRange", this.minSize, this.maxSize), - this._updateEffect.setFloat4("scaleRange", this.minScaleX, this.maxScaleX, this.minScaleY, this.maxScaleY), - this._updateEffect.setFloat4("angleRange", this.minAngularSpeed, this.maxAngularSpeed, this.minInitialRotation, this.maxInitialRotation), + this._updateEffect.setFloat( + "currentCount", + this._currentActiveCount + ), + this._updateEffect.setFloat( + "timeDelta", + this._timeDelta + ), + this._updateEffect.setFloat( + "stopFactor", + this._stopped ? 0 : 1 + ), + this._updateEffect.setTexture( + "randomSampler", + this._randomTexture + ), + this._updateEffect.setTexture( + "randomSampler2", + this._randomTexture2 + ), + this._updateEffect.setFloat2( + "lifeTime", + this.minLifeTime, + this.maxLifeTime + ), + this._updateEffect.setFloat2( + "emitPower", + this.minEmitPower, + this.maxEmitPower + ), + this._colorGradientsTexture || + (this._updateEffect.setDirectColor4( + "color1", + this.color1 + ), + this._updateEffect.setDirectColor4( + "color2", + this.color2 + )), + this._updateEffect.setFloat2( + "sizeRange", + this.minSize, + this.maxSize + ), + this._updateEffect.setFloat4( + "scaleRange", + this.minScaleX, + this.maxScaleX, + this.minScaleY, + this.maxScaleY + ), + this._updateEffect.setFloat4( + "angleRange", + this.minAngularSpeed, + this.maxAngularSpeed, + this.minInitialRotation, + this.maxInitialRotation + ), this._updateEffect.setVector3("gravity", this.gravity), - this._sizeGradientsTexture && this._updateEffect.setTexture("sizeGradientSampler", this._sizeGradientsTexture), - this._angularSpeedGradientsTexture && this._updateEffect.setTexture("angularSpeedGradientSampler", this._angularSpeedGradientsTexture), - this._velocityGradientsTexture && this._updateEffect.setTexture("velocityGradientSampler", this._velocityGradientsTexture), - this._limitVelocityGradientsTexture && (this._updateEffect.setTexture("limitVelocityGradientSampler", this._limitVelocityGradientsTexture), - this._updateEffect.setFloat("limitVelocityDamping", this.limitVelocityDamping)), - this._dragGradientsTexture && this._updateEffect.setTexture("dragGradientSampler", this._dragGradientsTexture), - this.particleEmitterType && this.particleEmitterType.applyToShader(this._updateEffect), - this._isAnimationSheetEnabled && this._updateEffect.setFloat3("cellInfos", this.startSpriteCellID, this.endSpriteCellID, this.spriteCellChangeSpeed), - this.noiseTexture && (this._updateEffect.setTexture("noiseSampler", this.noiseTexture), - this._updateEffect.setVector3("noiseStrength", this.noiseStrength)), + this._sizeGradientsTexture && + this._updateEffect.setTexture( + "sizeGradientSampler", + this._sizeGradientsTexture + ), + this._angularSpeedGradientsTexture && + this._updateEffect.setTexture( + "angularSpeedGradientSampler", + this._angularSpeedGradientsTexture + ), + this._velocityGradientsTexture && + this._updateEffect.setTexture( + "velocityGradientSampler", + this._velocityGradientsTexture + ), + this._limitVelocityGradientsTexture && + (this._updateEffect.setTexture( + "limitVelocityGradientSampler", + this._limitVelocityGradientsTexture + ), + this._updateEffect.setFloat( + "limitVelocityDamping", + this.limitVelocityDamping + )), + this._dragGradientsTexture && + this._updateEffect.setTexture( + "dragGradientSampler", + this._dragGradientsTexture + ), + this.particleEmitterType && + this.particleEmitterType.applyToShader( + this._updateEffect + ), + this._isAnimationSheetEnabled && + this._updateEffect.setFloat3( + "cellInfos", + this.startSpriteCellID, + this.endSpriteCellID, + this.spriteCellChangeSpeed + ), + this.noiseTexture && + (this._updateEffect.setTexture( + "noiseSampler", + this.noiseTexture + ), + this._updateEffect.setVector3( + "noiseStrength", + this.noiseStrength + )), this.emitter.position) - n = this.emitter.getWorldMatrix(); - else { - var r = this.emitter; - n = a.j.Translation(r.x, r.y, r.z) - } - if (this._updateEffect.setMatrix("emitterWM", n), - this._engine.bindVertexArrayObject(this._updateVAO[this._targetIndex], null), - this._engine.bindTransformFeedbackBuffer(this._targetBuffer.getBuffer()), + ) + n = this.emitter.getWorldMatrix(); + else { + var r = this.emitter; + n = a.j.Translation(r.x, r.y, r.z); + } + if ( + (this._updateEffect.setMatrix("emitterWM", n), + this._engine.bindVertexArrayObject( + this._updateVAO[this._targetIndex], + null + ), + this._engine.bindTransformFeedbackBuffer( + this._targetBuffer.getBuffer() + ), this._engine.setRasterizerState(false), this._engine.beginTransformFeedback(true), - this._engine.drawArraysType(Mr.a.PointListDrawMode, 0, this._currentActiveCount), + this._engine.drawArraysType( + Mr.a.PointListDrawMode, + 0, + this._currentActiveCount + ), this._engine.endTransformFeedback(), this._engine.setRasterizerState(true), this._engine.bindTransformFeedbackBuffer(null), - !e) { - this._engine.enableEffect(this._renderEffect); - var o = this._scene.getViewMatrix(); - if (this._renderEffect.setMatrix("view", o), - this._renderEffect.setMatrix("projection", this._scene.getProjectionMatrix()), - this._renderEffect.setTexture("textureSampler", this.particleTexture), - this._renderEffect.setVector2("translationPivot", this.translationPivot), - this._renderEffect.setVector3("worldOffset", this.worldOffset), - this._colorGradientsTexture ? this._renderEffect.setTexture("colorGradientSampler", this._colorGradientsTexture) : this._renderEffect.setDirectColor4("colorDead", this.colorDead), - this._isAnimationSheetEnabled && this.particleTexture) { - var s = this.particleTexture.getBaseSize(); - this._renderEffect.setFloat3("sheetInfos", this.spriteCellWidth / s.width, this.spriteCellHeight / s.height, s.width / this.spriteCellWidth) - } - if (this._isBillboardBased) { - var c = this._scene.activeCamera; - this._renderEffect.setVector3("eyePosition", c.globalPosition) - } - if (this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4) { - var u = o.clone(); - u.invert(), - this._renderEffect.setMatrix("invView", u), - Yn.a.BindClipPlane(this._renderEffect, this._scene) - } - switch (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess && this._imageProcessingConfiguration.bind(this._renderEffect), - this.blendMode) { - case Ia.BLENDMODE_ADD: - this._engine.setAlphaMode(_.a.ALPHA_ADD); - break; - case Ia.BLENDMODE_ONEONE: - this._engine.setAlphaMode(_.a.ALPHA_ONEONE); - break; - case Ia.BLENDMODE_STANDARD: - this._engine.setAlphaMode(_.a.ALPHA_COMBINE); - break; - case Ia.BLENDMODE_MULTIPLY: - this._engine.setAlphaMode(_.a.ALPHA_MULTIPLY) - } - this.forceDepthWrite && this._engine.setDepthWrite(true), - this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex], null), - this._engine.drawArraysType(Mr.a.TriangleFanDrawMode, 0, 4, this._currentActiveCount), - this._engine.setAlphaMode(_.a.ALPHA_DISABLE) + !e) + ) { + this._engine.enableEffect(this._renderEffect); + var o = this._scene.getViewMatrix(); + if ( + (this._renderEffect.setMatrix("view", o), + this._renderEffect.setMatrix( + "projection", + this._scene.getProjectionMatrix() + ), + this._renderEffect.setTexture( + "textureSampler", + this.particleTexture + ), + this._renderEffect.setVector2( + "translationPivot", + this.translationPivot + ), + this._renderEffect.setVector3( + "worldOffset", + this.worldOffset + ), + this._colorGradientsTexture + ? this._renderEffect.setTexture( + "colorGradientSampler", + this._colorGradientsTexture + ) + : this._renderEffect.setDirectColor4( + "colorDead", + this.colorDead + ), + this._isAnimationSheetEnabled && this.particleTexture) + ) { + var s = this.particleTexture.getBaseSize(); + this._renderEffect.setFloat3( + "sheetInfos", + this.spriteCellWidth / s.width, + this.spriteCellHeight / s.height, + s.width / this.spriteCellWidth + ); } - this._targetIndex++, + if (this._isBillboardBased) { + var c = this._scene.activeCamera; + this._renderEffect.setVector3( + "eyePosition", + c.globalPosition + ); + } + if ( + this._scene.clipPlane || + this._scene.clipPlane2 || + this._scene.clipPlane3 || + this._scene.clipPlane4 + ) { + var u = o.clone(); + u.invert(), + this._renderEffect.setMatrix("invView", u), + Yn.a.BindClipPlane(this._renderEffect, this._scene); + } + switch ( + (this._imageProcessingConfiguration && + !this._imageProcessingConfiguration + .applyByPostProcess && + this._imageProcessingConfiguration.bind( + this._renderEffect + ), + this.blendMode) + ) { + case Ia.BLENDMODE_ADD: + this._engine.setAlphaMode(_.a.ALPHA_ADD); + break; + case Ia.BLENDMODE_ONEONE: + this._engine.setAlphaMode(_.a.ALPHA_ONEONE); + break; + case Ia.BLENDMODE_STANDARD: + this._engine.setAlphaMode(_.a.ALPHA_COMBINE); + break; + case Ia.BLENDMODE_MULTIPLY: + this._engine.setAlphaMode(_.a.ALPHA_MULTIPLY); + } + this.forceDepthWrite && + this._engine.setDepthWrite(true), + this._engine.bindVertexArrayObject( + this._renderVAO[this._targetIndex], + null + ), + this._engine.drawArraysType( + Mr.a.TriangleFanDrawMode, + 0, + 4, + this._currentActiveCount + ), + this._engine.setAlphaMode(_.a.ALPHA_DISABLE); + } + this._targetIndex++, 2 === this._targetIndex && (this._targetIndex = 0); - var l = this._sourceBuffer; - return this._sourceBuffer = this._targetBuffer, - this._targetBuffer = l, + var l = this._sourceBuffer; + return ( + (this._sourceBuffer = this._targetBuffer), + (this._targetBuffer = l), this._currentActiveCount - } - , - t.prototype.rebuild = function() { - this._initialize(true) - } - , - t.prototype._releaseBuffers = function() { - this._buffer0 && (this._buffer0.dispose(), - this._buffer0 = null), - this._buffer1 && (this._buffer1.dispose(), - this._buffer1 = null), - this._spriteBuffer && (this._spriteBuffer.dispose(), - this._spriteBuffer = null) - } - , - t.prototype._releaseVAOs = function() { - if (this._updateVAO) { - for (var e = 0; e < this._updateVAO.length; e++) - this._engine.releaseVertexArrayObject(this._updateVAO[e]); - for (this._updateVAO = [], - e = 0; e < this._renderVAO.length; e++) - this._engine.releaseVertexArrayObject(this._renderVAO[e]); - this._renderVAO = [] - } - } - , - t.prototype.dispose = function(e) { - void 0 === e && (e = true); - var t = this._scene.particleSystems.indexOf(this); - t > -1 && this._scene.particleSystems.splice(t, 1), + ); + }), + (t.prototype.rebuild = function () { + this._initialize(true); + }), + (t.prototype._releaseBuffers = function () { + this._buffer0 && + (this._buffer0.dispose(), (this._buffer0 = null)), + this._buffer1 && + (this._buffer1.dispose(), (this._buffer1 = null)), + this._spriteBuffer && + (this._spriteBuffer.dispose(), + (this._spriteBuffer = null)); + }), + (t.prototype._releaseVAOs = function () { + if (this._updateVAO) { + for (var e = 0; e < this._updateVAO.length; e++) + this._engine.releaseVertexArrayObject( + this._updateVAO[e] + ); + for ( + this._updateVAO = [], e = 0; + e < this._renderVAO.length; + e++ + ) + this._engine.releaseVertexArrayObject( + this._renderVAO[e] + ); + this._renderVAO = []; + } + }), + (t.prototype.dispose = function (e) { + void 0 === e && (e = true); + var t = this._scene.particleSystems.indexOf(this); + t > -1 && this._scene.particleSystems.splice(t, 1), this._releaseBuffers(), this._releaseVAOs(), - this._colorGradientsTexture && (this._colorGradientsTexture.dispose(), - this._colorGradientsTexture = null), - this._sizeGradientsTexture && (this._sizeGradientsTexture.dispose(), - this._sizeGradientsTexture = null), - this._angularSpeedGradientsTexture && (this._angularSpeedGradientsTexture.dispose(), - this._angularSpeedGradientsTexture = null), - this._velocityGradientsTexture && (this._velocityGradientsTexture.dispose(), - this._velocityGradientsTexture = null), - this._limitVelocityGradientsTexture && (this._limitVelocityGradientsTexture.dispose(), - this._limitVelocityGradientsTexture = null), - this._dragGradientsTexture && (this._dragGradientsTexture.dispose(), - this._dragGradientsTexture = null), - this._randomTexture && (this._randomTexture.dispose(), - this._randomTexture = null), - this._randomTexture2 && (this._randomTexture2.dispose(), - this._randomTexture2 = null), - e && this.particleTexture && (this.particleTexture.dispose(), - this.particleTexture = null), - e && this.noiseTexture && (this.noiseTexture.dispose(), - this.noiseTexture = null), + this._colorGradientsTexture && + (this._colorGradientsTexture.dispose(), + (this._colorGradientsTexture = null)), + this._sizeGradientsTexture && + (this._sizeGradientsTexture.dispose(), + (this._sizeGradientsTexture = null)), + this._angularSpeedGradientsTexture && + (this._angularSpeedGradientsTexture.dispose(), + (this._angularSpeedGradientsTexture = null)), + this._velocityGradientsTexture && + (this._velocityGradientsTexture.dispose(), + (this._velocityGradientsTexture = null)), + this._limitVelocityGradientsTexture && + (this._limitVelocityGradientsTexture.dispose(), + (this._limitVelocityGradientsTexture = null)), + this._dragGradientsTexture && + (this._dragGradientsTexture.dispose(), + (this._dragGradientsTexture = null)), + this._randomTexture && + (this._randomTexture.dispose(), + (this._randomTexture = null)), + this._randomTexture2 && + (this._randomTexture2.dispose(), + (this._randomTexture2 = null)), + e && + this.particleTexture && + (this.particleTexture.dispose(), + (this.particleTexture = null)), + e && + this.noiseTexture && + (this.noiseTexture.dispose(), + (this.noiseTexture = null)), this.onDisposeObservable.notifyObservers(this), - this.onDisposeObservable.clear() - } - , - t.prototype.clone = function(e, i) { - var n = new t(e,{ - capacity: this._capacity, - randomTextureSize: this._randomTextureSize - },this._scene); - return M.a.DeepCopy(this, n), + this.onDisposeObservable.clear(); + }), + (t.prototype.clone = function (e, i) { + var n = new t( + e, + { + capacity: this._capacity, + randomTextureSize: this._randomTextureSize, + }, + this._scene + ); + return ( + M.a.DeepCopy(this, n), void 0 === i && (i = this.emitter), - n.emitter = i, - this.particleTexture && (n.particleTexture = new je.a(this.particleTexture.url,this._scene)), + (n.emitter = i), + this.particleTexture && + (n.particleTexture = new je.a( + this.particleTexture.url, + this._scene + )), n - } - , - t.prototype.serialize = function() { - var e = {}; - return Ia._Serialize(e, this), - e.activeParticleCount = this.activeParticleCount, + ); + }), + (t.prototype.serialize = function () { + var e = {}; + return ( + Ia._Serialize(e, this), + (e.activeParticleCount = this.activeParticleCount), e - } - , - t.Parse = function(e, i, n, r) { - void 0 === r && (r = false); - var o = new t(e.name,{ - capacity: e.capacity, - randomTextureSize: e.randomTextureSize - },i); - return e.activeParticleCount && (o.activeParticleCount = e.activeParticleCount), + ); + }), + (t.Parse = function (e, i, n, r) { + void 0 === r && (r = false); + var o = new t( + e.name, + { + capacity: e.capacity, + randomTextureSize: e.randomTextureSize, + }, + i + ); + return ( + e.activeParticleCount && + (o.activeParticleCount = e.activeParticleCount), Ia._Parse(e, o, i, n), - e.preventAutoStart && (o.preventAutoStart = e.preventAutoStart), + e.preventAutoStart && + (o.preventAutoStart = e.preventAutoStart), r || o.preventAutoStart || o.start(), o - } - , - t - }(Ma) - , La = function() { - function e() { - this.systems = new Array - } - return Object.defineProperty(e.prototype, "emitterNode", { - get: function() { - return this._emitterNode - }, - enumerable: true, - configurable: true + ); }), - e.prototype.setEmitterAsSphere = function(e, t, i) { - this._emitterNode && this._emitterNode.dispose(), - this._emitterCreationOptions = { - kind: "Sphere", - options: e, - renderingGroupId: t - }; - var n = Rn.a.CreateSphere("emitterSphere", { - diameter: e.diameter, - segments: e.segments - }, i); - n.renderingGroupId = t; - var r = new bi.a("emitterSphereMaterial",i); - r.emissiveColor = e.color, - n.material = r; - for (var o = 0, a = this.systems; o < a.length; o++) - a[o].emitter = n; - this._emitterNode = n - } - , - e.prototype.start = function(e) { - for (var t = 0, i = this.systems; t < i.length; t++) { - var n = i[t]; - e && (n.emitter = e), - n.start() - } - } - , - e.prototype.dispose = function() { - for (var e = 0, t = this.systems; e < t.length; e++) - t[e].dispose(); - this.systems = [], - this._emitterNode && (this._emitterNode.dispose(), - this._emitterNode = null) - } - , - e.prototype.serialize = function() { - for (var e = { - systems: [] - }, t = 0, i = this.systems; t < i.length; t++) { - var n = i[t]; - e.systems.push(n.serialize()) - } - return this._emitterNode && (e.emitter = this._emitterCreationOptions), + t + ); + })(Ma), + La = (function () { + function e() { + this.systems = new Array(); + } + return ( + Object.defineProperty(e.prototype, "emitterNode", { + get: function () { + return this._emitterNode; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.setEmitterAsSphere = function (e, t, i) { + this._emitterNode && this._emitterNode.dispose(), + (this._emitterCreationOptions = { + kind: "Sphere", + options: e, + renderingGroupId: t, + }); + var n = Rn.a.CreateSphere( + "emitterSphere", + { + diameter: e.diameter, + segments: e.segments, + }, + i + ); + n.renderingGroupId = t; + var r = new bi.a("emitterSphereMaterial", i); + (r.emissiveColor = e.color), (n.material = r); + for (var o = 0, a = this.systems; o < a.length; o++) + a[o].emitter = n; + this._emitterNode = n; + }), + (e.prototype.start = function (e) { + for (var t = 0, i = this.systems; t < i.length; t++) { + var n = i[t]; + e && (n.emitter = e), n.start(); + } + }), + (e.prototype.dispose = function () { + for (var e = 0, t = this.systems; e < t.length; e++) + t[e].dispose(); + (this.systems = []), + this._emitterNode && + (this._emitterNode.dispose(), + (this._emitterNode = null)); + }), + (e.prototype.serialize = function () { + for ( + var e = { + systems: [], + }, + t = 0, + i = this.systems; + t < i.length; + t++ + ) { + var n = i[t]; + e.systems.push(n.serialize()); + } + return ( + this._emitterNode && + (e.emitter = this._emitterCreationOptions), e - } - , - e.Parse = function(t, i, n) { - void 0 === n && (n = false); - var r = new e - , o = _.a.PARTICLES_BaseAssetsUrl + "/textures/"; - i = i || R.a.LastCreatedScene; - for (var s = 0, c = t.systems; s < c.length; s++) { - var u = c[s]; - r.systems.push(n ? Da.Parse(u, i, o, true) : Ia.Parse(u, i, o, true)) + ); + }), + (e.Parse = function (t, i, n) { + void 0 === n && (n = false); + var r = new e(), + o = _.a.PARTICLES_BaseAssetsUrl + "/textures/"; + i = i || R.a.LastCreatedScene; + for (var s = 0, c = t.systems; s < c.length; s++) { + var u = c[s]; + r.systems.push( + n ? Da.Parse(u, i, o, true) : Ia.Parse(u, i, o, true) + ); + } + if (t.emitter) { + var l = t.emitter.options; + switch (t.emitter.kind) { + case "Sphere": + r.setEmitterAsSphere( + { + diameter: l.diameter, + segments: l.segments, + color: a.e.FromArray(l.color), + }, + t.emitter.renderingGroupId, + i + ); } - if (t.emitter) { - var l = t.emitter.options; - switch (t.emitter.kind) { - case "Sphere": - r.setEmitterAsSphere({ - diameter: l.diameter, - segments: l.segments, - color: a.e.FromArray(l.color) - }, t.emitter.renderingGroupId, i) - } - } - return r - } - , + } + return r; + }), e - }() - , Fa = function() { - function e() {} - return e.CreateDefault = function(e, t, i, n) { - var r; - return void 0 === t && (t = 500), + ); + })(), + Fa = (function () { + function e() {} + return ( + (e.CreateDefault = function (e, t, i, n) { + var r; + return ( + void 0 === t && (t = 500), void 0 === n && (n = false), - (r = n ? new Da("default system",{ - capacity: t - },i) : new Ia("default system",t,i)).emitter = e, - r.particleTexture = new je.a("https://www.babylonjs.com/assets/Flare.png",r.getScene()), - r.createConeEmitter(.1, Math.PI / 4), - r.color1 = new a.f(1,1,1,1), - r.color2 = new a.f(1,1,1,1), - r.colorDead = new a.f(1,1,1,0), - r.minSize = .1, - r.maxSize = .1, - r.minEmitPower = 2, - r.maxEmitPower = 2, - r.updateSpeed = 1 / 60, - r.emitRate = 30, + ((r = n + ? new Da( + "default system", + { + capacity: t, + }, + i + ) + : new Ia("default system", t, i)).emitter = e), + (r.particleTexture = new je.a( + "https://www.babylonjs.com/assets/Flare.png", + r.getScene() + )), + r.createConeEmitter(0.1, Math.PI / 4), + (r.color1 = new a.f(1, 1, 1, 1)), + (r.color2 = new a.f(1, 1, 1, 1)), + (r.colorDead = new a.f(1, 1, 1, 0)), + (r.minSize = 0.1), + (r.maxSize = 0.1), + (r.minEmitPower = 2), + (r.maxEmitPower = 2), + (r.updateSpeed = 1 / 60), + (r.emitRate = 30), r - } - , - e.CreateAsync = function(t, n, r) { - void 0 === r && (r = false), + ); + }), + (e.CreateAsync = function (t, n, r) { + void 0 === r && (r = false), n || (n = R.a.LastCreatedScene); - var o = {}; - return n._addPendingData(o), - new i(function(i, a) { - if (r && !Da.IsSupported) - return n._removePendingData(o), - a("Particle system with GPU is not supported."); - Ee.h.LoadFile(e.BaseAssetsUrl + "/systems/" + t + ".json", function(e) { - n._removePendingData(o); - var t = JSON.parse(e.toString()); - return i(La.Parse(t, n, r)) - }, void 0, void 0, void 0, function() { - return n._removePendingData(o), - a("An error occured while the creation of your particle system. Check if your type '" + t + "' exists.") - }) - } - ) - } - , - e.ExportSet = function(e) { - for (var t = new La, i = 0, n = e; i < n.length; i++) { - var r = n[i]; - t.systems.push(r) - } - return t - } - , - e.BaseAssetsUrl = _.a.PARTICLES_BaseAssetsUrl, + var o = {}; + return ( + n._addPendingData(o), + new i(function (i, a) { + if (r && !Da.IsSupported) + return ( + n._removePendingData(o), + a("Particle system with GPU is not supported.") + ); + Ee.h.LoadFile( + e.BaseAssetsUrl + "/systems/" + t + ".json", + function (e) { + n._removePendingData(o); + var t = JSON.parse(e.toString()); + return i(La.Parse(t, n, r)); + }, + void 0, + void 0, + void 0, + function () { + return ( + n._removePendingData(o), + a( + "An error occured while the creation of your particle system. Check if your type '" + + t + + "' exists." + ) + ); + } + ); + }) + ); + }), + (e.ExportSet = function (e) { + for (var t = new La(), i = 0, n = e; i < n.length; i++) { + var r = n[i]; + t.systems.push(r); + } + return t; + }), + (e.BaseAssetsUrl = _.a.PARTICLES_BaseAssetsUrl), e - }(); - r.a.AddParser(Se.a.NAME_PARTICLESYSTEM, function(e, t, i, n) { - var o = r.a.GetIndividualParser(Se.a.NAME_PARTICLESYSTEM); - if (o && void 0 !== e.particleSystems && null !== e.particleSystems) - for (var a = 0, s = e.particleSystems.length; a < s; a++) { - var c = e.particleSystems[a]; - i.particleSystems.push(o(c, t, n)) - } - }), - r.a.AddIndividualParser(Se.a.NAME_PARTICLESYSTEM, function(e, t, i) { - return e.activeParticleCount ? Da.Parse(e, t, i) : Ia.Parse(e, t, i) - }), - ve.b.prototype.createEffectForParticles = function(e, t, i, n, r, o, a) { - void 0 === t && (t = []), + ); + })(); + r.a.AddParser(Se.a.NAME_PARTICLESYSTEM, function (e, t, i, n) { + var o = r.a.GetIndividualParser(Se.a.NAME_PARTICLESYSTEM); + if ( + o && + void 0 !== e.particleSystems && + null !== e.particleSystems + ) + for (var a = 0, s = e.particleSystems.length; a < s; a++) { + var c = e.particleSystems[a]; + i.particleSystems.push(o(c, t, n)); + } + }), + r.a.AddIndividualParser( + Se.a.NAME_PARTICLESYSTEM, + function (e, t, i) { + return e.activeParticleCount + ? Da.Parse(e, t, i) + : Ia.Parse(e, t, i); + } + ), + (ve.b.prototype.createEffectForParticles = function ( + e, + t, + i, + n, + r, + o, + a + ) { + void 0 === t && (t = []), void 0 === i && (i = []), void 0 === n && (n = ""); - var s = Ia._GetAttributeNamesOrOptions() - , c = Ia._GetEffectCreationOptions(); - return -1 === n.indexOf(" BILLBOARD") && (n += "\n#define BILLBOARD\n"), - -1 === i.indexOf("diffuseSampler") && i.push("diffuseSampler"), - this.createEffect({ + var s = Ia._GetAttributeNamesOrOptions(), + c = Ia._GetEffectCreationOptions(); + return ( + -1 === n.indexOf(" BILLBOARD") && + (n += "\n#define BILLBOARD\n"), + -1 === i.indexOf("diffuseSampler") && + i.push("diffuseSampler"), + this.createEffect( + { vertex: "particles", - fragmentElement: e - }, s, c.concat(t), i, n, r, o, a) - } - , - me.a.prototype.getEmittedParticleSystems = function() { - for (var e = new Array, t = 0; t < this.getScene().particleSystems.length; t++) { - var i = this.getScene().particleSystems[t]; - i.emitter === this && e.push(i) - } - return e - } - , - me.a.prototype.getHierarchyEmittedParticleSystems = function() { - var e = new Array - , t = this.getDescendants(); + fragmentElement: e, + }, + s, + c.concat(t), + i, + n, + r, + o, + a + ) + ); + }), + (me.a.prototype.getEmittedParticleSystems = function () { + for ( + var e = new Array(), t = 0; + t < this.getScene().particleSystems.length; + t++ + ) { + var i = this.getScene().particleSystems[t]; + i.emitter === this && e.push(i); + } + return e; + }), + (me.a.prototype.getHierarchyEmittedParticleSystems = + function () { + var e = new Array(), + t = this.getDescendants(); t.push(this); - for (var i = 0; i < this.getScene().particleSystems.length; i++) { - var n = this.getScene().particleSystems[i] - , r = n.emitter; - r.position && -1 !== t.indexOf(r) && e.push(n) + for ( + var i = 0; + i < this.getScene().particleSystems.length; + i++ + ) { + var n = this.getScene().particleSystems[i], + r = n.emitter; + r.position && -1 !== t.indexOf(r) && e.push(n); } - return e - } - ; - var Ba = function() { - function e(e, t, i, n, r, o, s, c) { - void 0 === c && (c = null), - this.idx = 0, - this.color = new a.f(1,1,1,1), - this.position = a.x.Zero(), - this.rotation = a.x.Zero(), - this.scaling = a.x.One(), - this.uvs = new a.y(0,0,1,1), - this.velocity = a.x.Zero(), - this.pivot = a.x.Zero(), - this.translateFromPivot = false, - this.alive = true, - this.isVisible = true, - this._pos = 0, - this._ind = 0, - this.shapeId = 0, - this.idxInShape = 0, - this._stillInvisible = false, - this._rotationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1], - this.parentId = null, - this.cullingStrategy = Ne.a.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY, - this._globalPosition = a.x.Zero(), - this.idx = e, - this._pos = t, - this._ind = i, - this._model = n, - this.shapeId = r, - this.idxInShape = o, - this._sps = s, - c && (this._modelBoundingInfo = c, - this._boundingInfo = new $i.a(c.minimum,c.maximum)) - } - return Object.defineProperty(e.prototype, "scale", { - get: function() { - return this.scaling - }, - set: function(e) { - this.scaling = e - }, - enumerable: true, - configurable: true + return e; + }); + var Ba = (function () { + function e(e, t, i, n, r, o, s, c) { + void 0 === c && (c = null), + (this.idx = 0), + (this.color = new a.f(1, 1, 1, 1)), + (this.position = a.x.Zero()), + (this.rotation = a.x.Zero()), + (this.scaling = a.x.One()), + (this.uvs = new a.y(0, 0, 1, 1)), + (this.velocity = a.x.Zero()), + (this.pivot = a.x.Zero()), + (this.translateFromPivot = false), + (this.alive = true), + (this.isVisible = true), + (this._pos = 0), + (this._ind = 0), + (this.shapeId = 0), + (this.idxInShape = 0), + (this._stillInvisible = false), + (this._rotationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1]), + (this.parentId = null), + (this.cullingStrategy = + Ne.a.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY), + (this._globalPosition = a.x.Zero()), + (this.idx = e), + (this._pos = t), + (this._ind = i), + (this._model = n), + (this.shapeId = r), + (this.idxInShape = o), + (this._sps = s), + c && + ((this._modelBoundingInfo = c), + (this._boundingInfo = new $i.a(c.minimum, c.maximum))); + } + return ( + Object.defineProperty(e.prototype, "scale", { + get: function () { + return this.scaling; + }, + set: function (e) { + this.scaling = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "quaternion", { - get: function() { - return this.rotationQuaternion - }, - set: function(e) { - this.rotationQuaternion = e - }, - enumerable: true, - configurable: true + get: function () { + return this.rotationQuaternion; + }, + set: function (e) { + this.rotationQuaternion = e; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.intersectsMesh = function (e) { + return ( + !(!this._boundingInfo || !e._boundingInfo) && + (this._sps._bSphereOnly + ? en.a.Intersects( + this._boundingInfo.boundingSphere, + e._boundingInfo.boundingSphere + ) + : this._boundingInfo.intersects( + e._boundingInfo, + false + )) + ); + }), + (e.prototype.isInFrustum = function (e) { + return ( + null !== this._boundingInfo && + this._boundingInfo.isInFrustum(e, this.cullingStrategy) + ); + }), + (e.prototype.getRotationMatrix = function (e) { + var t; + if (this.rotationQuaternion) t = this.rotationQuaternion; + else { + t = a.t.Quaternion[0]; + var i = this.rotation; + a.q.RotationYawPitchRollToRef(i.y, i.x, i.z, t); + } + t.toRotationMatrix(e); }), - e.prototype.intersectsMesh = function(e) { - return !(!this._boundingInfo || !e._boundingInfo) && (this._sps._bSphereOnly ? en.a.Intersects(this._boundingInfo.boundingSphere, e._boundingInfo.boundingSphere) : this._boundingInfo.intersects(e._boundingInfo, false)) - } - , - e.prototype.isInFrustum = function(e) { - return null !== this._boundingInfo && this._boundingInfo.isInFrustum(e, this.cullingStrategy) - } - , - e.prototype.getRotationMatrix = function(e) { - var t; - if (this.rotationQuaternion) - t = this.rotationQuaternion; - else { - t = a.t.Quaternion[0]; - var i = this.rotation; - a.q.RotationYawPitchRollToRef(i.y, i.x, i.z, t) - } - t.toRotationMatrix(e) - } - , e - }() - , Na = function(e, t, i, n, r, o) { - this._indicesLength = 0, - this.shapeID = e, - this._shape = t, - this._indicesLength = i, - this._shapeUV = n, - this._positionFunction = r, - this._vertexFunction = o - } - , ka = function() { - this.ind = 0, - this.indicesLength = 0, - this.sqDistance = 0 - } - , Ua = function(e, t) { - return t.sqDistance - e.sqDistance - } - , Va = function() { - function e(e, t, i) { - this.particles = new Array, - this.nbParticles = 0, - this.billboard = false, - this.recomputeNormals = true, - this.counter = 0, - this.vars = {}, - this._bSphereOnly = false, - this._bSphereRadiusFactor = 1, - this._positions = new Array, - this._indices = new Array, - this._normals = new Array, - this._colors = new Array, - this._uvs = new Array, - this._index = 0, - this._updatable = true, - this._pickable = false, - this._isVisibilityBoxLocked = false, - this._alwaysVisible = false, - this._depthSort = false, - this._shapeCounter = 0, - this._copy = new Ba(0,0,0,null,0,0,this), - this._color = new a.f(0,0,0,0), - this._computeParticleColor = true, - this._computeParticleTexture = true, - this._computeParticleRotation = true, - this._computeParticleVertex = false, - this._computeBoundingBox = false, - this._depthSortParticles = true, - this._mustUnrotateFixedNormals = false, - this._particlesIntersect = false, - this._needs32Bits = false, - this.name = e, - this._scene = t || R.a.LastCreatedScene, - this._camera = t.activeCamera, - this._pickable = !!i && i.isPickable, - this._depthSort = !!i && i.enableDepthSort, - this._particlesIntersect = !!i && i.particleIntersection, - this._bSphereOnly = !!i && i.boundingSphereOnly, - this._bSphereRadiusFactor = i && i.bSphereRadiusFactor ? i.bSphereRadiusFactor : 1, - i && void 0 !== i.updatable ? this._updatable = i.updatable : this._updatable = true, - this._pickable && (this.pickedParticles = []), - this._depthSort && (this.depthSortedParticles = []) - } - return e.prototype.buildMesh = function() { - if (0 === this.nbParticles) { - var e = Qo.CreateDisc("", { - radius: 1, - tessellation: 3 - }, this._scene); - this.addShape(e, 1), - e.dispose() - } - this._indices32 = this._needs32Bits ? new Uint32Array(this._indices) : new Uint16Array(this._indices), - this._positions32 = new Float32Array(this._positions), - this._uvs32 = new Float32Array(this._uvs), - this._colors32 = new Float32Array(this._colors), - this.recomputeNormals && xi.a.ComputeNormals(this._positions32, this._indices32, this._normals), - this._normals32 = new Float32Array(this._normals), - this._fixedNormal32 = new Float32Array(this._normals), - this._mustUnrotateFixedNormals && this._unrotateFixedNormals(); - var t = new xi.a; - t.indices = this._depthSort ? this._indices : this._indices32, + ); + })(), + Na = function (e, t, i, n, r, o) { + (this._indicesLength = 0), + (this.shapeID = e), + (this._shape = t), + (this._indicesLength = i), + (this._shapeUV = n), + (this._positionFunction = r), + (this._vertexFunction = o); + }, + ka = function () { + (this.ind = 0), + (this.indicesLength = 0), + (this.sqDistance = 0); + }, + Ua = function (e, t) { + return t.sqDistance - e.sqDistance; + }, + Va = (function () { + function e(e, t, i) { + (this.particles = new Array()), + (this.nbParticles = 0), + (this.billboard = false), + (this.recomputeNormals = true), + (this.counter = 0), + (this.vars = {}), + (this._bSphereOnly = false), + (this._bSphereRadiusFactor = 1), + (this._positions = new Array()), + (this._indices = new Array()), + (this._normals = new Array()), + (this._colors = new Array()), + (this._uvs = new Array()), + (this._index = 0), + (this._updatable = true), + (this._pickable = false), + (this._isVisibilityBoxLocked = false), + (this._alwaysVisible = false), + (this._depthSort = false), + (this._shapeCounter = 0), + (this._copy = new Ba(0, 0, 0, null, 0, 0, this)), + (this._color = new a.f(0, 0, 0, 0)), + (this._computeParticleColor = true), + (this._computeParticleTexture = true), + (this._computeParticleRotation = true), + (this._computeParticleVertex = false), + (this._computeBoundingBox = false), + (this._depthSortParticles = true), + (this._mustUnrotateFixedNormals = false), + (this._particlesIntersect = false), + (this._needs32Bits = false), + (this.name = e), + (this._scene = t || R.a.LastCreatedScene), + (this._camera = t.activeCamera), + (this._pickable = !!i && i.isPickable), + (this._depthSort = !!i && i.enableDepthSort), + (this._particlesIntersect = + !!i && i.particleIntersection), + (this._bSphereOnly = !!i && i.boundingSphereOnly), + (this._bSphereRadiusFactor = + i && i.bSphereRadiusFactor ? i.bSphereRadiusFactor : 1), + i && void 0 !== i.updatable + ? (this._updatable = i.updatable) + : (this._updatable = true), + this._pickable && (this.pickedParticles = []), + this._depthSort && (this.depthSortedParticles = []); + } + return ( + (e.prototype.buildMesh = function () { + if (0 === this.nbParticles) { + var e = Qo.CreateDisc( + "", + { + radius: 1, + tessellation: 3, + }, + this._scene + ); + this.addShape(e, 1), e.dispose(); + } + (this._indices32 = this._needs32Bits + ? new Uint32Array(this._indices) + : new Uint16Array(this._indices)), + (this._positions32 = new Float32Array(this._positions)), + (this._uvs32 = new Float32Array(this._uvs)), + (this._colors32 = new Float32Array(this._colors)), + this.recomputeNormals && + xi.a.ComputeNormals( + this._positions32, + this._indices32, + this._normals + ), + (this._normals32 = new Float32Array(this._normals)), + (this._fixedNormal32 = new Float32Array(this._normals)), + this._mustUnrotateFixedNormals && + this._unrotateFixedNormals(); + var t = new xi.a(); + (t.indices = this._depthSort + ? this._indices + : this._indices32), t.set(this._positions32, Si.b.PositionKind), t.set(this._normals32, Si.b.NormalKind), - this._uvs32.length > 0 && t.set(this._uvs32, Si.b.UVKind), - this._colors32.length > 0 && t.set(this._colors32, Si.b.ColorKind); - var i = new me.a(this.name,this._scene); - return t.applyToMesh(i, this._updatable), - this.mesh = i, - this.mesh.isPickable = this._pickable, + this._uvs32.length > 0 && + t.set(this._uvs32, Si.b.UVKind), + this._colors32.length > 0 && + t.set(this._colors32, Si.b.ColorKind); + var i = new me.a(this.name, this._scene); + return ( + t.applyToMesh(i, this._updatable), + (this.mesh = i), + (this.mesh.isPickable = this._pickable), this._depthSort || (this._indices = null), - this._positions = null, - this._normals = null, - this._uvs = null, - this._colors = null, + (this._positions = null), + (this._normals = null), + (this._uvs = null), + (this._colors = null), this._updatable || (this.particles.length = 0), i - } - , - e.prototype.digest = function(e, t) { - var i = t && t.facetNb || 1 - , n = t && t.number || 0 - , r = t && t.delta || 0 - , o = e.getVerticesData(Si.b.PositionKind) - , s = e.getIndices() - , c = e.getVerticesData(Si.b.UVKind) - , u = e.getVerticesData(Si.b.ColorKind) - , l = e.getVerticesData(Si.b.NormalKind) - , h = 0 - , f = s.length / 3; - n ? (n = n > f ? f : n, - i = Math.round(f / n), - r = 0) : i = i > f ? f : i; - for (var d = [], p = [], m = [], g = [], _ = a.x.Zero(), v = i; h < f; ) { - h > f - (i = v + Math.floor((1 + r) * Math.random())) && (i = f - h), - d.length = 0, - p.length = 0, - m.length = 0, - g.length = 0; - for (var y = 0, b = 3 * h; b < 3 * (h + i); b++) { - p.push(y); - var E = s[b]; - d.push(o[3 * E], o[3 * E + 1], o[3 * E + 2]), - c && m.push(c[2 * E], c[2 * E + 1]), - u && g.push(u[4 * E], u[4 * E + 1], u[4 * E + 2], u[4 * E + 3]), - y++ - } - var T, A, x = this.nbParticles, S = this._posToShape(d), C = this._uvsToShapeUV(m); - for (T = 0; T < S.length; T++) - _.addInPlace(S[T]); - for (_.scaleInPlace(1 / S.length), - T = 0; T < S.length; T++) - S[T].subtractInPlace(_); - this._particlesIntersect && (A = new $i.a(_,_)); - var P = new Na(this._shapeCounter,S,3 * i,C,null,null) - , R = this._positions.length - , M = this._indices.length; - this._meshBuilder(this._index, S, this._positions, p, this._indices, m, this._uvs, g, this._colors, l, this._normals, x, 0, null), - this._addParticle(x, R, M, P, this._shapeCounter, 0, A), - this.particles[this.nbParticles].position.addInPlace(_), - this._index += S.length, - x++, - this.nbParticles++, - this._shapeCounter++, - h += i + ); + }), + (e.prototype.digest = function (e, t) { + var i = (t && t.facetNb) || 1, + n = (t && t.number) || 0, + r = (t && t.delta) || 0, + o = e.getVerticesData(Si.b.PositionKind), + s = e.getIndices(), + c = e.getVerticesData(Si.b.UVKind), + u = e.getVerticesData(Si.b.ColorKind), + l = e.getVerticesData(Si.b.NormalKind), + h = 0, + f = s.length / 3; + n + ? ((n = n > f ? f : n), + (i = Math.round(f / n)), + (r = 0)) + : (i = i > f ? f : i); + for ( + var d = [], + p = [], + m = [], + g = [], + _ = a.x.Zero(), + v = i; + h < f; + + ) { + h > f - (i = v + Math.floor((1 + r) * Math.random())) && + (i = f - h), + (d.length = 0), + (p.length = 0), + (m.length = 0), + (g.length = 0); + for (var y = 0, b = 3 * h; b < 3 * (h + i); b++) { + p.push(y); + var E = s[b]; + d.push(o[3 * E], o[3 * E + 1], o[3 * E + 2]), + c && m.push(c[2 * E], c[2 * E + 1]), + u && + g.push( + u[4 * E], + u[4 * E + 1], + u[4 * E + 2], + u[4 * E + 3] + ), + y++; } - return this - } - , - e.prototype._unrotateFixedNormals = function() { - for (var e = 0, t = 0, i = a.t.Vector3[0], n = a.t.Quaternion[0], r = a.t.Matrix[0], o = 0; o < this.particles.length; o++) { - var s = this.particles[o] - , c = s._model._shape; - if (s.rotationQuaternion) - s.rotationQuaternion.conjugateToRef(n); - else { - var u = s.rotation; - a.q.RotationYawPitchRollToRef(u.y, u.x, u.z, n), - n.conjugateInPlace() - } - n.toRotationMatrix(r); - for (var l = 0; l < c.length; l++) - t = e + 3 * l, - a.x.TransformNormalFromFloatsToRef(this._normals32[t], this._normals32[t + 1], this._normals32[t + 2], r, i), - i.toArray(this._fixedNormal32, t); - e = t + 3 + var T, + A, + x = this.nbParticles, + S = this._posToShape(d), + C = this._uvsToShapeUV(m); + for (T = 0; T < S.length; T++) _.addInPlace(S[T]); + for ( + _.scaleInPlace(1 / S.length), T = 0; + T < S.length; + T++ + ) + S[T].subtractInPlace(_); + this._particlesIntersect && (A = new $i.a(_, _)); + var P = new Na( + this._shapeCounter, + S, + 3 * i, + C, + null, + null + ), + R = this._positions.length, + M = this._indices.length; + this._meshBuilder( + this._index, + S, + this._positions, + p, + this._indices, + m, + this._uvs, + g, + this._colors, + l, + this._normals, + x, + 0, + null + ), + this._addParticle( + x, + R, + M, + P, + this._shapeCounter, + 0, + A + ), + this.particles[this.nbParticles].position.addInPlace( + _ + ), + (this._index += S.length), + x++, + this.nbParticles++, + this._shapeCounter++, + (h += i); + } + return this; + }), + (e.prototype._unrotateFixedNormals = function () { + for ( + var e = 0, + t = 0, + i = a.t.Vector3[0], + n = a.t.Quaternion[0], + r = a.t.Matrix[0], + o = 0; + o < this.particles.length; + o++ + ) { + var s = this.particles[o], + c = s._model._shape; + if (s.rotationQuaternion) + s.rotationQuaternion.conjugateToRef(n); + else { + var u = s.rotation; + a.q.RotationYawPitchRollToRef(u.y, u.x, u.z, n), + n.conjugateInPlace(); } - } - , - e.prototype._resetCopy = function() { - var e = this._copy; - e.position.setAll(0), + n.toRotationMatrix(r); + for (var l = 0; l < c.length; l++) + (t = e + 3 * l), + a.x.TransformNormalFromFloatsToRef( + this._normals32[t], + this._normals32[t + 1], + this._normals32[t + 2], + r, + i + ), + i.toArray(this._fixedNormal32, t); + e = t + 3; + } + }), + (e.prototype._resetCopy = function () { + var e = this._copy; + e.position.setAll(0), e.rotation.setAll(0), - e.rotationQuaternion = null, + (e.rotationQuaternion = null), e.scaling.setAll(1), e.uvs.copyFromFloats(0, 0, 1, 1), - e.color = null, - e.translateFromPivot = false - } - , - e.prototype._meshBuilder = function(e, t, i, n, r, o, s, c, u, l, h, f, d, p) { - var m, g = 0, _ = 0, v = 0; - this._resetCopy(); - var y = this._copy; - p && p.positionFunction && (p.positionFunction(y, f, d), - this._mustUnrotateFixedNormals = true); - var b = a.t.Matrix[0] - , E = a.t.Vector3[0] - , T = a.t.Vector3[1] - , A = a.t.Vector3[2] - , x = a.t.Vector3[3]; - for (y.getRotationMatrix(b), - y.pivot.multiplyToRef(y.scaling, x), - y.translateFromPivot ? A.setAll(0) : A.copyFrom(x), - m = 0; m < t.length; m++) { - if (E.copyFrom(t[m]), - p && p.vertexFunction && p.vertexFunction(y, E, m), - E.multiplyInPlace(y.scaling).subtractInPlace(x), - a.x.TransformCoordinatesToRef(E, b, T), - T.addInPlace(A).addInPlace(y.position), - i.push(T.x, T.y, T.z), - o) { - var S = y.uvs; - s.push((S.z - S.x) * o[g] + S.x, (S.w - S.y) * o[g + 1] + S.y), - g += 2 - } - if (y.color) - this._color = y.color; - else { - var C = this._color; - c && void 0 !== c[_] ? (C.r = c[_], - C.g = c[_ + 1], - C.b = c[_ + 2], - C.a = c[_ + 3]) : (C.r = 1, - C.g = 1, - C.b = 1, - C.a = 1) - } - u.push(this._color.r, this._color.g, this._color.b, this._color.a), - _ += 4, - !this.recomputeNormals && l && (E.x = l[v], - E.y = l[v + 1], - E.z = l[v + 2], + (e.color = null), + (e.translateFromPivot = false); + }), + (e.prototype._meshBuilder = function ( + e, + t, + i, + n, + r, + o, + s, + c, + u, + l, + h, + f, + d, + p + ) { + var m, + g = 0, + _ = 0, + v = 0; + this._resetCopy(); + var y = this._copy; + p && + p.positionFunction && + (p.positionFunction(y, f, d), + (this._mustUnrotateFixedNormals = true)); + var b = a.t.Matrix[0], + E = a.t.Vector3[0], + T = a.t.Vector3[1], + A = a.t.Vector3[2], + x = a.t.Vector3[3]; + for ( + y.getRotationMatrix(b), + y.pivot.multiplyToRef(y.scaling, x), + y.translateFromPivot ? A.setAll(0) : A.copyFrom(x), + m = 0; + m < t.length; + m++ + ) { + if ( + (E.copyFrom(t[m]), + p && p.vertexFunction && p.vertexFunction(y, E, m), + E.multiplyInPlace(y.scaling).subtractInPlace(x), + a.x.TransformCoordinatesToRef(E, b, T), + T.addInPlace(A).addInPlace(y.position), + i.push(T.x, T.y, T.z), + o) + ) { + var S = y.uvs; + s.push( + (S.z - S.x) * o[g] + S.x, + (S.w - S.y) * o[g + 1] + S.y + ), + (g += 2); + } + if (y.color) this._color = y.color; + else { + var C = this._color; + c && void 0 !== c[_] + ? ((C.r = c[_]), + (C.g = c[_ + 1]), + (C.b = c[_ + 2]), + (C.a = c[_ + 3])) + : ((C.r = 1), (C.g = 1), (C.b = 1), (C.a = 1)); + } + u.push( + this._color.r, + this._color.g, + this._color.b, + this._color.a + ), + (_ += 4), + !this.recomputeNormals && + l && + ((E.x = l[v]), + (E.y = l[v + 1]), + (E.z = l[v + 2]), a.x.TransformNormalToRef(E, b, E), h.push(E.x, E.y, E.z), - v += 3) - } - for (m = 0; m < n.length; m++) { - var P = e + n[m]; - r.push(P), - P > 65535 && (this._needs32Bits = true) - } - if (this._pickable) { - var R = n.length / 3; - for (m = 0; m < R; m++) - this.pickedParticles.push({ - idx: f, - faceId: m - }) - } - return this._depthSort && this.depthSortedParticles.push(new ka), + (v += 3)); + } + for (m = 0; m < n.length; m++) { + var P = e + n[m]; + r.push(P), P > 65535 && (this._needs32Bits = true); + } + if (this._pickable) { + var R = n.length / 3; + for (m = 0; m < R; m++) + this.pickedParticles.push({ + idx: f, + faceId: m, + }); + } + return ( + this._depthSort && + this.depthSortedParticles.push(new ka()), y - } - , - e.prototype._posToShape = function(e) { - for (var t = [], i = 0; i < e.length; i += 3) - t.push(a.x.FromArray(e, i)); - return t - } - , - e.prototype._uvsToShapeUV = function(e) { - var t = []; - if (e) - for (var i = 0; i < e.length; i++) - t.push(e[i]); - return t - } - , - e.prototype._addParticle = function(e, t, i, n, r, o, a) { - void 0 === a && (a = null); - var s = new Ba(e,t,i,n,r,o,this,a); - return this.particles.push(s), - s - } - , - e.prototype.addShape = function(e, t, i) { - var n, r = e.getVerticesData(Si.b.PositionKind), o = e.getIndices(), a = e.getVerticesData(Si.b.UVKind), s = e.getVerticesData(Si.b.ColorKind), c = e.getVerticesData(Si.b.NormalKind); - this._particlesIntersect && (n = e.getBoundingInfo()); - for (var u, l, h = this._posToShape(r), f = this._uvsToShapeUV(a), d = i ? i.positionFunction : null, p = i ? i.vertexFunction : null, m = new Na(this._shapeCounter,h,o.length,f,d,p), g = this.nbParticles, _ = 0; _ < t; _++) { - var v = this._positions.length - , y = this._indices.length; - l = this._meshBuilder(this._index, h, this._positions, o, this._indices, a, this._uvs, s, this._colors, c, this._normals, g, _, i), - this._updatable && ((u = this._addParticle(g, v, y, m, this._shapeCounter, _, n)).position.copyFrom(l.position), + ); + }), + (e.prototype._posToShape = function (e) { + for (var t = [], i = 0; i < e.length; i += 3) + t.push(a.x.FromArray(e, i)); + return t; + }), + (e.prototype._uvsToShapeUV = function (e) { + var t = []; + if (e) for (var i = 0; i < e.length; i++) t.push(e[i]); + return t; + }), + (e.prototype._addParticle = function (e, t, i, n, r, o, a) { + void 0 === a && (a = null); + var s = new Ba(e, t, i, n, r, o, this, a); + return this.particles.push(s), s; + }), + (e.prototype.addShape = function (e, t, i) { + var n, + r = e.getVerticesData(Si.b.PositionKind), + o = e.getIndices(), + a = e.getVerticesData(Si.b.UVKind), + s = e.getVerticesData(Si.b.ColorKind), + c = e.getVerticesData(Si.b.NormalKind); + this._particlesIntersect && (n = e.getBoundingInfo()); + for ( + var u, + l, + h = this._posToShape(r), + f = this._uvsToShapeUV(a), + d = i ? i.positionFunction : null, + p = i ? i.vertexFunction : null, + m = new Na(this._shapeCounter, h, o.length, f, d, p), + g = this.nbParticles, + _ = 0; + _ < t; + _++ + ) { + var v = this._positions.length, + y = this._indices.length; + (l = this._meshBuilder( + this._index, + h, + this._positions, + o, + this._indices, + a, + this._uvs, + s, + this._colors, + c, + this._normals, + g, + _, + i + )), + this._updatable && + ((u = this._addParticle( + g, + v, + y, + m, + this._shapeCounter, + _, + n + )).position.copyFrom(l.position), u.rotation.copyFrom(l.rotation), - l.rotationQuaternion && u.rotationQuaternion && u.rotationQuaternion.copyFrom(l.rotationQuaternion), + l.rotationQuaternion && + u.rotationQuaternion && + u.rotationQuaternion.copyFrom( + l.rotationQuaternion + ), l.color && u.color && u.color.copyFrom(l.color), u.scaling.copyFrom(l.scaling), u.uvs.copyFrom(l.uvs)), - this._index += h.length, - g++ - } - return this.nbParticles += t, + (this._index += h.length), + g++; + } + return ( + (this.nbParticles += t), this._shapeCounter++, this._shapeCounter - 1 - } - , - e.prototype._rebuildParticle = function(e) { - this._resetCopy(); - var t = this._copy; - e._model._positionFunction && e._model._positionFunction(t, e.idx, e.idxInShape); - var i = a.t.Matrix[0] - , n = a.t.Vector3[0] - , r = a.t.Vector3[1] - , o = a.t.Vector3[2] - , s = a.t.Vector3[3]; - t.getRotationMatrix(i), + ); + }), + (e.prototype._rebuildParticle = function (e) { + this._resetCopy(); + var t = this._copy; + e._model._positionFunction && + e._model._positionFunction(t, e.idx, e.idxInShape); + var i = a.t.Matrix[0], + n = a.t.Vector3[0], + r = a.t.Vector3[1], + o = a.t.Vector3[2], + s = a.t.Vector3[3]; + t.getRotationMatrix(i), e.pivot.multiplyToRef(e.scaling, s), - t.translateFromPivot ? o.copyFromFloats(0, 0, 0) : o.copyFrom(s); - for (var c = e._model._shape, u = 0; u < c.length; u++) - n.copyFrom(c[u]), - e._model._vertexFunction && e._model._vertexFunction(t, n, u), - n.multiplyInPlace(t.scaling).subtractInPlace(s), - a.x.TransformCoordinatesToRef(n, i, r), - r.addInPlace(o).addInPlace(t.position).toArray(this._positions32, e._pos + 3 * u); - e.position.setAll(0), + t.translateFromPivot + ? o.copyFromFloats(0, 0, 0) + : o.copyFrom(s); + for (var c = e._model._shape, u = 0; u < c.length; u++) + n.copyFrom(c[u]), + e._model._vertexFunction && + e._model._vertexFunction(t, n, u), + n.multiplyInPlace(t.scaling).subtractInPlace(s), + a.x.TransformCoordinatesToRef(n, i, r), + r + .addInPlace(o) + .addInPlace(t.position) + .toArray(this._positions32, e._pos + 3 * u); + e.position.setAll(0), e.rotation.setAll(0), - e.rotationQuaternion = null, + (e.rotationQuaternion = null), e.scaling.setAll(1), e.uvs.setAll(0), e.pivot.setAll(0), - e.translateFromPivot = false, - e.parentId = null - } - , - e.prototype.rebuildMesh = function() { - for (var e = 0; e < this.particles.length; e++) - this._rebuildParticle(this.particles[e]); - return this.mesh.updateVerticesData(Si.b.PositionKind, this._positions32, false, false), + (e.translateFromPivot = false), + (e.parentId = null); + }), + (e.prototype.rebuildMesh = function () { + for (var e = 0; e < this.particles.length; e++) + this._rebuildParticle(this.particles[e]); + return ( + this.mesh.updateVerticesData( + Si.b.PositionKind, + this._positions32, + false, + false + ), this - } - , - e.prototype.setParticles = function(e, t, i) { - if (void 0 === e && (e = 0), + ); + }), + (e.prototype.setParticles = function (e, t, i) { + if ( + (void 0 === e && (e = 0), void 0 === t && (t = this.nbParticles - 1), void 0 === i && (i = true), !this._updatable) - return this; - this.beforeUpdateParticles(e, t, i); - var n = a.t.Matrix[0] - , r = a.t.Matrix[1] - , o = this.mesh - , s = this._colors32 - , c = this._positions32 - , u = this._normals32 - , l = this._uvs32 - , h = this._indices32 - , f = this._indices - , d = this._fixedNormal32 - , p = a.t.Vector3 - , m = p[5].copyFromFloats(1, 0, 0) - , g = p[6].copyFromFloats(0, 1, 0) - , _ = p[7].copyFromFloats(0, 0, 1) - , v = p[8].setAll(Number.MAX_VALUE) - , y = p[9].setAll(-Number.MAX_VALUE) - , b = p[10].setAll(0); - if ((this.billboard || this._depthSort) && (this.mesh.computeWorldMatrix(true), - this.mesh._worldMatrix.invertToRef(r)), - this.billboard) { - var E = p[0]; - this._camera.getDirectionToRef(a.c.Z, E), - a.x.TransformNormalToRef(E, r, _), - _.normalize(); - var T = this._camera.getViewMatrix(true); - a.x.TransformNormalFromFloatsToRef(T.m[1], T.m[5], T.m[9], r, g), - a.x.CrossToRef(g, _, m), - g.normalize(), - m.normalize() - } - this._depthSort && a.x.TransformCoordinatesToRef(this._camera.globalPosition, r, b), + ) + return this; + this.beforeUpdateParticles(e, t, i); + var n = a.t.Matrix[0], + r = a.t.Matrix[1], + o = this.mesh, + s = this._colors32, + c = this._positions32, + u = this._normals32, + l = this._uvs32, + h = this._indices32, + f = this._indices, + d = this._fixedNormal32, + p = a.t.Vector3, + m = p[5].copyFromFloats(1, 0, 0), + g = p[6].copyFromFloats(0, 1, 0), + _ = p[7].copyFromFloats(0, 0, 1), + v = p[8].setAll(Number.MAX_VALUE), + y = p[9].setAll(-Number.MAX_VALUE), + b = p[10].setAll(0); + if ( + ((this.billboard || this._depthSort) && + (this.mesh.computeWorldMatrix(true), + this.mesh._worldMatrix.invertToRef(r)), + this.billboard) + ) { + var E = p[0]; + this._camera.getDirectionToRef(a.c.Z, E), + a.x.TransformNormalToRef(E, r, _), + _.normalize(); + var T = this._camera.getViewMatrix(true); + a.x.TransformNormalFromFloatsToRef( + T.m[1], + T.m[5], + T.m[9], + r, + g + ), + a.x.CrossToRef(g, _, m), + g.normalize(), + m.normalize(); + } + this._depthSort && + a.x.TransformCoordinatesToRef( + this._camera.globalPosition, + r, + b + ), a.j.IdentityToRef(n); - var A = 0 - , x = 0 - , S = 0 - , C = 0 - , P = 0 - , R = 0 - , M = 0; - if (this.mesh.isFacetDataEnabled && (this._computeBoundingBox = true), - t = t >= this.nbParticles ? this.nbParticles - 1 : t, - this._computeBoundingBox && (0 != e || t != this.nbParticles - 1)) { - var O = this.mesh._boundingInfo; - O && (v.copyFrom(O.minimum), - y.copyFrom(O.maximum)) + var A = 0, + x = 0, + S = 0, + C = 0, + P = 0, + R = 0, + M = 0; + if ( + (this.mesh.isFacetDataEnabled && + (this._computeBoundingBox = true), + (t = t >= this.nbParticles ? this.nbParticles - 1 : t), + this._computeBoundingBox && + (0 != e || t != this.nbParticles - 1)) + ) { + var O = this.mesh._boundingInfo; + O && (v.copyFrom(O.minimum), y.copyFrom(O.maximum)); + } + var w = ((x = this.particles[e]._pos) / 3) | 0; + (C = 4 * w), (R = 2 * w); + for (var I = e; I <= t; I++) { + var D = this.particles[I]; + this.updateParticle(D); + var L = D._model._shape, + F = D._model._shapeUV, + B = D._rotationMatrix, + N = D.position, + k = D.rotation, + U = D.scaling, + V = D._globalPosition; + if (this._depthSort && this._depthSortParticles) { + var G = this.depthSortedParticles[I]; + (G.ind = D._ind), + (G.indicesLength = D._model._indicesLength), + (G.sqDistance = a.x.DistanceSquared(D.position, b)); } - var w = (x = this.particles[e]._pos) / 3 | 0; - C = 4 * w, - R = 2 * w; - for (var I = e; I <= t; I++) { - var D = this.particles[I]; - this.updateParticle(D); - var L = D._model._shape - , F = D._model._shapeUV - , B = D._rotationMatrix - , N = D.position - , k = D.rotation - , U = D.scaling - , V = D._globalPosition; - if (this._depthSort && this._depthSortParticles) { - var G = this.depthSortedParticles[I]; - G.ind = D._ind, - G.indicesLength = D._model._indicesLength, - G.sqDistance = a.x.DistanceSquared(D.position, b) + if (!D.alive || (D._stillInvisible && !D.isVisible)) + (x += 3 * (M = L.length)), (C += 4 * M), (R += 2 * M); + else { + if (D.isVisible) { + D._stillInvisible = false; + var z = p[12]; + if ( + (D.pivot.multiplyToRef(U, z), + this.billboard && ((k.x = 0), (k.y = 0)), + (this._computeParticleRotation || + this.billboard) && + D.getRotationMatrix(n), + null !== D.parentId) + ) { + var j = this.particles[D.parentId], + H = j._rotationMatrix, + W = j._globalPosition, + X = N.x * H[1] + N.y * H[4] + N.z * H[7], + Y = N.x * H[0] + N.y * H[3] + N.z * H[6], + K = N.x * H[2] + N.y * H[5] + N.z * H[8]; + if ( + ((V.x = W.x + Y), + (V.y = W.y + X), + (V.z = W.z + K), + this._computeParticleRotation || this.billboard) + ) { + var Q = n.m; + (B[0] = + Q[0] * H[0] + Q[1] * H[3] + Q[2] * H[6]), + (B[1] = + Q[0] * H[1] + Q[1] * H[4] + Q[2] * H[7]), + (B[2] = + Q[0] * H[2] + Q[1] * H[5] + Q[2] * H[8]), + (B[3] = + Q[4] * H[0] + Q[5] * H[3] + Q[6] * H[6]), + (B[4] = + Q[4] * H[1] + Q[5] * H[4] + Q[6] * H[7]), + (B[5] = + Q[4] * H[2] + Q[5] * H[5] + Q[6] * H[8]), + (B[6] = + Q[8] * H[0] + Q[9] * H[3] + Q[10] * H[6]), + (B[7] = + Q[8] * H[1] + Q[9] * H[4] + Q[10] * H[7]), + (B[8] = + Q[8] * H[2] + Q[9] * H[5] + Q[10] * H[8]); + } + } else + (V.x = N.x), + (V.y = N.y), + (V.z = N.z), + (this._computeParticleRotation || + this.billboard) && + ((Q = n.m), + (B[0] = Q[0]), + (B[1] = Q[1]), + (B[2] = Q[2]), + (B[3] = Q[4]), + (B[4] = Q[5]), + (B[5] = Q[6]), + (B[6] = Q[8]), + (B[7] = Q[9]), + (B[8] = Q[10])); + var q = p[11]; + for ( + D.translateFromPivot + ? q.setAll(0) + : q.copyFrom(z), + M = 0; + M < L.length; + M++ + ) { + (A = x + 3 * M), + (S = C + 4 * M), + (P = R + 2 * M), + (E = p[0]).copyFrom(L[M]), + this._computeParticleVertex && + this.updateParticleVertex(D, E, M); + var Z = E.x * U.x - z.x, + J = E.y * U.y - z.y, + $ = E.z * U.z - z.z; + (Y = Z * B[0] + J * B[3] + $ * B[6]), + (X = Z * B[1] + J * B[4] + $ * B[7]), + (K = Z * B[2] + J * B[5] + $ * B[8]), + (Y += q.x), + (X += q.y), + (K += q.z); + var ee = (c[A] = + V.x + m.x * Y + g.x * X + _.x * K), + te = (c[A + 1] = + V.y + m.y * Y + g.y * X + _.y * K), + ie = (c[A + 2] = + V.z + m.z * Y + g.z * X + _.z * K); + if ( + (this._computeBoundingBox && + (v.minimizeInPlaceFromFloats(ee, te, ie), + y.maximizeInPlaceFromFloats(ee, te, ie)), + !this._computeParticleVertex) + ) { + var ne = d[A], + re = d[A + 1], + oe = d[A + 2], + ae = ne * B[0] + re * B[3] + oe * B[6], + se = ne * B[1] + re * B[4] + oe * B[7], + ce = ne * B[2] + re * B[5] + oe * B[8]; + (u[A] = m.x * ae + g.x * se + _.x * ce), + (u[A + 1] = m.y * ae + g.y * se + _.y * ce), + (u[A + 2] = m.z * ae + g.z * se + _.z * ce); + } + if (this._computeParticleColor && D.color) { + var ue = D.color, + le = this._colors32; + (le[S] = ue.r), + (le[S + 1] = ue.g), + (le[S + 2] = ue.b), + (le[S + 3] = ue.a); + } + if (this._computeParticleTexture) { + var he = D.uvs; + (l[P] = F[2 * M] * (he.z - he.x) + he.x), + (l[P + 1] = + F[2 * M + 1] * (he.w - he.y) + he.y); + } } - if (!D.alive || D._stillInvisible && !D.isVisible) - x += 3 * (M = L.length), - C += 4 * M, - R += 2 * M; - else { - if (D.isVisible) { - D._stillInvisible = false; - var z = p[12]; - if (D.pivot.multiplyToRef(U, z), - this.billboard && (k.x = 0, - k.y = 0), - (this._computeParticleRotation || this.billboard) && D.getRotationMatrix(n), - null !== D.parentId) { - var j = this.particles[D.parentId] - , H = j._rotationMatrix - , W = j._globalPosition - , X = N.x * H[1] + N.y * H[4] + N.z * H[7] - , Y = N.x * H[0] + N.y * H[3] + N.z * H[6] - , K = N.x * H[2] + N.y * H[5] + N.z * H[8]; - if (V.x = W.x + Y, - V.y = W.y + X, - V.z = W.z + K, - this._computeParticleRotation || this.billboard) { - var Q = n.m; - B[0] = Q[0] * H[0] + Q[1] * H[3] + Q[2] * H[6], - B[1] = Q[0] * H[1] + Q[1] * H[4] + Q[2] * H[7], - B[2] = Q[0] * H[2] + Q[1] * H[5] + Q[2] * H[8], - B[3] = Q[4] * H[0] + Q[5] * H[3] + Q[6] * H[6], - B[4] = Q[4] * H[1] + Q[5] * H[4] + Q[6] * H[7], - B[5] = Q[4] * H[2] + Q[5] * H[5] + Q[6] * H[8], - B[6] = Q[8] * H[0] + Q[9] * H[3] + Q[10] * H[6], - B[7] = Q[8] * H[1] + Q[9] * H[4] + Q[10] * H[7], - B[8] = Q[8] * H[2] + Q[9] * H[5] + Q[10] * H[8] - } - } else - V.x = N.x, - V.y = N.y, - V.z = N.z, - (this._computeParticleRotation || this.billboard) && (Q = n.m, - B[0] = Q[0], - B[1] = Q[1], - B[2] = Q[2], - B[3] = Q[4], - B[4] = Q[5], - B[5] = Q[6], - B[6] = Q[8], - B[7] = Q[9], - B[8] = Q[10]); - var q = p[11]; - for (D.translateFromPivot ? q.setAll(0) : q.copyFrom(z), - M = 0; M < L.length; M++) { - A = x + 3 * M, - S = C + 4 * M, - P = R + 2 * M, - (E = p[0]).copyFrom(L[M]), - this._computeParticleVertex && this.updateParticleVertex(D, E, M); - var Z = E.x * U.x - z.x - , J = E.y * U.y - z.y - , $ = E.z * U.z - z.z; - Y = Z * B[0] + J * B[3] + $ * B[6], - X = Z * B[1] + J * B[4] + $ * B[7], - K = Z * B[2] + J * B[5] + $ * B[8], - Y += q.x, - X += q.y, - K += q.z; - var ee = c[A] = V.x + m.x * Y + g.x * X + _.x * K - , te = c[A + 1] = V.y + m.y * Y + g.y * X + _.y * K - , ie = c[A + 2] = V.z + m.z * Y + g.z * X + _.z * K; - if (this._computeBoundingBox && (v.minimizeInPlaceFromFloats(ee, te, ie), - y.maximizeInPlaceFromFloats(ee, te, ie)), - !this._computeParticleVertex) { - var ne = d[A] - , re = d[A + 1] - , oe = d[A + 2] - , ae = ne * B[0] + re * B[3] + oe * B[6] - , se = ne * B[1] + re * B[4] + oe * B[7] - , ce = ne * B[2] + re * B[5] + oe * B[8]; - u[A] = m.x * ae + g.x * se + _.x * ce, - u[A + 1] = m.y * ae + g.y * se + _.y * ce, - u[A + 2] = m.z * ae + g.z * se + _.z * ce - } - if (this._computeParticleColor && D.color) { - var ue = D.color - , le = this._colors32; - le[S] = ue.r, - le[S + 1] = ue.g, - le[S + 2] = ue.b, - le[S + 3] = ue.a - } - if (this._computeParticleTexture) { - var he = D.uvs; - l[P] = F[2 * M] * (he.z - he.x) + he.x, - l[P + 1] = F[2 * M + 1] * (he.w - he.y) + he.y - } - } - } else - for (D._stillInvisible = true, - M = 0; M < L.length; M++) - S = C + 4 * M, - P = R + 2 * M, - c[A = x + 3 * M] = c[A + 1] = c[A + 2] = 0, - u[A] = u[A + 1] = u[A + 2] = 0, - this._computeParticleColor && D.color && (ue = D.color, - s[S] = ue.r, - s[S + 1] = ue.g, - s[S + 2] = ue.b, - s[S + 3] = ue.a), - this._computeParticleTexture && (he = D.uvs, - l[P] = F[2 * M] * (he.z - he.x) + he.x, - l[P + 1] = F[2 * M + 1] * (he.w - he.y) + he.y); - if (this._particlesIntersect) { - var fe = D._boundingInfo - , de = fe.boundingBox - , pe = fe.boundingSphere - , me = D._modelBoundingInfo; - if (!this._bSphereOnly) { - var ge = me.boundingBox.vectors - , _e = p[1] - , ve = p[2]; - _e.setAll(Number.MAX_VALUE), - ve.setAll(-Number.MAX_VALUE); - for (var ye = 0; ye < 8; ye++) { - var be = ge[ye].x * U.x - , Ee = ge[ye].y * U.y - , Te = ge[ye].z * U.z - , Ae = (Y = be * B[0] + Ee * B[3] + Te * B[6], - X = be * B[1] + Ee * B[4] + Te * B[7], - K = be * B[2] + Ee * B[5] + Te * B[8], - N.x + m.x * Y + g.x * X + _.x * K) - , xe = N.y + m.y * Y + g.y * X + _.y * K - , Se = N.z + m.z * Y + g.z * X + _.z * K; - _e.minimizeInPlaceFromFloats(Ae, xe, Se), - ve.maximizeInPlaceFromFloats(Ae, xe, Se) - } - de.reConstruct(_e, ve, o._worldMatrix) - } - var Ce = me.minimum.multiplyToRef(U, p[1]) - , Pe = me.maximum.multiplyToRef(U, p[2]) - , Re = Pe.addToRef(Ce, p[3]).scaleInPlace(.5).addInPlace(V) - , Me = Pe.subtractToRef(Ce, p[4]).scaleInPlace(.5 * this._bSphereRadiusFactor) - , Oe = Re.subtractToRef(Me, p[1]) - , we = Re.addToRef(Me, p[2]); - pe.reConstruct(Oe, we, o._worldMatrix) - } - x = A + 3, - C = S + 4, - R = P + 2 + } else + for ( + D._stillInvisible = true, M = 0; + M < L.length; + M++ + ) + (S = C + 4 * M), + (P = R + 2 * M), + (c[(A = x + 3 * M)] = c[A + 1] = c[A + 2] = 0), + (u[A] = u[A + 1] = u[A + 2] = 0), + this._computeParticleColor && + D.color && + ((ue = D.color), + (s[S] = ue.r), + (s[S + 1] = ue.g), + (s[S + 2] = ue.b), + (s[S + 3] = ue.a)), + this._computeParticleTexture && + ((he = D.uvs), + (l[P] = F[2 * M] * (he.z - he.x) + he.x), + (l[P + 1] = + F[2 * M + 1] * (he.w - he.y) + he.y)); + if (this._particlesIntersect) { + var fe = D._boundingInfo, + de = fe.boundingBox, + pe = fe.boundingSphere, + me = D._modelBoundingInfo; + if (!this._bSphereOnly) { + var ge = me.boundingBox.vectors, + _e = p[1], + ve = p[2]; + _e.setAll(Number.MAX_VALUE), + ve.setAll(-Number.MAX_VALUE); + for (var ye = 0; ye < 8; ye++) { + var be = ge[ye].x * U.x, + Ee = ge[ye].y * U.y, + Te = ge[ye].z * U.z, + Ae = + ((Y = be * B[0] + Ee * B[3] + Te * B[6]), + (X = be * B[1] + Ee * B[4] + Te * B[7]), + (K = be * B[2] + Ee * B[5] + Te * B[8]), + N.x + m.x * Y + g.x * X + _.x * K), + xe = N.y + m.y * Y + g.y * X + _.y * K, + Se = N.z + m.z * Y + g.z * X + _.z * K; + _e.minimizeInPlaceFromFloats(Ae, xe, Se), + ve.maximizeInPlaceFromFloats(Ae, xe, Se); + } + de.reConstruct(_e, ve, o._worldMatrix); } + var Ce = me.minimum.multiplyToRef(U, p[1]), + Pe = me.maximum.multiplyToRef(U, p[2]), + Re = Pe.addToRef(Ce, p[3]) + .scaleInPlace(0.5) + .addInPlace(V), + Me = Pe.subtractToRef(Ce, p[4]).scaleInPlace( + 0.5 * this._bSphereRadiusFactor + ), + Oe = Re.subtractToRef(Me, p[1]), + we = Re.addToRef(Me, p[2]); + pe.reConstruct(Oe, we, o._worldMatrix); + } + (x = A + 3), (C = S + 4), (R = P + 2); } - if (i) { - if (this._computeParticleColor && o.updateVerticesData(Si.b.ColorKind, s, false, false), - this._computeParticleTexture && o.updateVerticesData(Si.b.UVKind, l, false, false), - o.updateVerticesData(Si.b.PositionKind, c, false, false), - !o.areNormalsFrozen || o.isFacetDataEnabled) { - if (this._computeParticleVertex || o.isFacetDataEnabled) { - var Ie = o.isFacetDataEnabled ? o.getFacetDataParameters() : null; - xi.a.ComputeNormals(c, h, u, Ie); - for (var De = 0; De < u.length; De++) - d[De] = u[De] - } - o.areNormalsFrozen || o.updateVerticesData(Si.b.NormalKind, u, false, false) - } - if (this._depthSort && this._depthSortParticles) { - var Le = this.depthSortedParticles; - Le.sort(Ua); - for (var Fe = Le.length, Be = 0, Ne = 0; Ne < Fe; Ne++) { - var ke = Le[Ne].indicesLength - , Ue = Le[Ne].ind; - for (De = 0; De < ke; De++) - h[Be] = f[Ue + De], - Be++ - } - o.updateIndices(h) - } + } + if (i) { + if ( + (this._computeParticleColor && + o.updateVerticesData( + Si.b.ColorKind, + s, + false, + false + ), + this._computeParticleTexture && + o.updateVerticesData(Si.b.UVKind, l, false, false), + o.updateVerticesData( + Si.b.PositionKind, + c, + false, + false + ), + !o.areNormalsFrozen || o.isFacetDataEnabled) + ) { + if ( + this._computeParticleVertex || + o.isFacetDataEnabled + ) { + var Ie = o.isFacetDataEnabled + ? o.getFacetDataParameters() + : null; + xi.a.ComputeNormals(c, h, u, Ie); + for (var De = 0; De < u.length; De++) d[De] = u[De]; + } + o.areNormalsFrozen || + o.updateVerticesData( + Si.b.NormalKind, + u, + false, + false + ); } - return this._computeBoundingBox && (o._boundingInfo ? o._boundingInfo.reConstruct(v, y, o._worldMatrix) : o._boundingInfo = new $i.a(v,y,o._worldMatrix)), + if (this._depthSort && this._depthSortParticles) { + var Le = this.depthSortedParticles; + Le.sort(Ua); + for ( + var Fe = Le.length, Be = 0, Ne = 0; + Ne < Fe; + Ne++ + ) { + var ke = Le[Ne].indicesLength, + Ue = Le[Ne].ind; + for (De = 0; De < ke; De++) + (h[Be] = f[Ue + De]), Be++; + } + o.updateIndices(h); + } + } + return ( + this._computeBoundingBox && + (o._boundingInfo + ? o._boundingInfo.reConstruct(v, y, o._worldMatrix) + : (o._boundingInfo = new $i.a( + v, + y, + o._worldMatrix + ))), this.afterUpdateParticles(e, t, i), this - } - , - e.prototype.dispose = function() { - this.mesh.dispose(), - this.vars = null, - this._positions = null, - this._indices = null, - this._normals = null, - this._uvs = null, - this._colors = null, - this._indices32 = null, - this._positions32 = null, - this._normals32 = null, - this._fixedNormal32 = null, - this._uvs32 = null, - this._colors32 = null, - this.pickedParticles = null - } - , - e.prototype.refreshVisibleSize = function() { - return this._isVisibilityBoxLocked || this.mesh.refreshBoundingInfo(), + ); + }), + (e.prototype.dispose = function () { + this.mesh.dispose(), + (this.vars = null), + (this._positions = null), + (this._indices = null), + (this._normals = null), + (this._uvs = null), + (this._colors = null), + (this._indices32 = null), + (this._positions32 = null), + (this._normals32 = null), + (this._fixedNormal32 = null), + (this._uvs32 = null), + (this._colors32 = null), + (this.pickedParticles = null); + }), + (e.prototype.refreshVisibleSize = function () { + return ( + this._isVisibilityBoxLocked || + this.mesh.refreshBoundingInfo(), this - } - , - e.prototype.setVisibilityBox = function(e) { - var t = e / 2; - this.mesh._boundingInfo = new $i.a(new a.x(-t,-t,-t),new a.x(t,t,t)) - } - , + ); + }), + (e.prototype.setVisibilityBox = function (e) { + var t = e / 2; + this.mesh._boundingInfo = new $i.a( + new a.x(-t, -t, -t), + new a.x(t, t, t) + ); + }), Object.defineProperty(e.prototype, "isAlwaysVisible", { - get: function() { - return this._alwaysVisible + get: function () { + return this._alwaysVisible; + }, + set: function (e) { + (this._alwaysVisible = e), + (this.mesh.alwaysSelectAsActiveMesh = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "isVisibilityBoxLocked", + { + get: function () { + return this._isVisibilityBoxLocked; }, - set: function(e) { - this._alwaysVisible = e, - this.mesh.alwaysSelectAsActiveMesh = e + set: function (e) { + (this._isVisibilityBoxLocked = e), + (this.mesh.getBoundingInfo().isLocked = e); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "isVisibilityBoxLocked", { - get: function() { - return this._isVisibilityBoxLocked + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "computeParticleRotation", + { + get: function () { + return this._computeParticleRotation; }, - set: function(e) { - this._isVisibilityBoxLocked = e, - this.mesh.getBoundingInfo().isLocked = e + set: function (e) { + this._computeParticleRotation = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "computeParticleRotation", { - get: function() { - return this._computeParticleRotation - }, - set: function(e) { - this._computeParticleRotation = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "computeParticleColor", { - get: function() { - return this._computeParticleColor + get: function () { + return this._computeParticleColor; + }, + set: function (e) { + this._computeParticleColor = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "computeParticleTexture", + { + get: function () { + return this._computeParticleTexture; }, - set: function(e) { - this._computeParticleColor = e + set: function (e) { + this._computeParticleTexture = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "computeParticleTexture", { - get: function() { - return this._computeParticleTexture + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "computeParticleVertex", + { + get: function () { + return this._computeParticleVertex; }, - set: function(e) { - this._computeParticleTexture = e + set: function (e) { + this._computeParticleVertex = e; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "computeParticleVertex", { - get: function() { - return this._computeParticleVertex - }, - set: function(e) { - this._computeParticleVertex = e - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "computeBoundingBox", { - get: function() { - return this._computeBoundingBox - }, - set: function(e) { - this._computeBoundingBox = e - }, - enumerable: true, - configurable: true + get: function () { + return this._computeBoundingBox; + }, + set: function (e) { + this._computeBoundingBox = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "depthSortParticles", { - get: function() { - return this._depthSortParticles - }, - set: function(e) { - this._depthSortParticles = e - }, - enumerable: true, - configurable: true + get: function () { + return this._depthSortParticles; + }, + set: function (e) { + this._depthSortParticles = e; + }, + enumerable: true, + configurable: true, }), - e.prototype.initParticles = function() {} - , - e.prototype.recycleParticle = function(e) { - return e - } - , - e.prototype.updateParticle = function(e) { - return e - } - , - e.prototype.updateParticleVertex = function(e, t, i) { - return t - } - , - e.prototype.beforeUpdateParticles = function(e, t, i) {} - , - e.prototype.afterUpdateParticles = function(e, t, i) {} - , + (e.prototype.initParticles = function () {}), + (e.prototype.recycleParticle = function (e) { + return e; + }), + (e.prototype.updateParticle = function (e) { + return e; + }), + (e.prototype.updateParticleVertex = function (e, t, i) { + return t; + }), + (e.prototype.beforeUpdateParticles = function (e, t, i) {}), + (e.prototype.afterUpdateParticles = function (e, t, i) {}), e - }(); - Y.a.prototype.getPhysicsEngine = function() { - return this._physicsEngine - } - , - Y.a.prototype.enablePhysics = function(e, t) { - if (void 0 === e && (e = null), - this._physicsEngine) - return true; - var i = this._getComponent(Se.a.NAME_PHYSICSENGINE); - i || (i = new ja(this), - this._addComponent(i)); - try { - return this._physicsEngine = new $r(e,t), - true - } catch (e) { - return g.a.Error(e.message), - false - } - } - , - Y.a.prototype.disablePhysicsEngine = function() { - this._physicsEngine && (this._physicsEngine.dispose(), - this._physicsEngine = null) - } - , - Y.a.prototype.isPhysicsEnabled = function() { - return void 0 !== this._physicsEngine - } - , - Y.a.prototype.deleteCompoundImpostor = function(e) { - var t = e.parts[0].mesh; - t.physicsImpostor && (t.physicsImpostor.dispose(), - t.physicsImpostor = null) - } - , - Y.a.prototype._advancePhysicsEngineStep = function(e) { - this._physicsEngine && (this.onBeforePhysicsObservable.notifyObservers(this), - this._physicsEngine._step(e / 1e3), - this.onAfterPhysicsObservable.notifyObservers(this)) - } - , - Object.defineProperty(Ne.a.prototype, "physicsImpostor", { - get: function() { - return this._physicsImpostor - }, - set: function(e) { - var t = this; - this._physicsImpostor !== e && (this._disposePhysicsObserver && this.onDisposeObservable.remove(this._disposePhysicsObserver), - this._physicsImpostor = e, - e && (this._disposePhysicsObserver = this.onDisposeObservable.add(function() { - t.physicsImpostor && (t.physicsImpostor.dispose(), - t.physicsImpostor = null) - }))) - }, - enumerable: true, - configurable: true + ); + })(); + (Y.a.prototype.getPhysicsEngine = function () { + return this._physicsEngine; + }), + (Y.a.prototype.enablePhysics = function (e, t) { + if ((void 0 === e && (e = null), this._physicsEngine)) + return true; + var i = this._getComponent(Se.a.NAME_PHYSICSENGINE); + i || ((i = new ja(this)), this._addComponent(i)); + try { + return (this._physicsEngine = new $r(e, t)), true; + } catch (e) { + return g.a.Error(e.message), false; + } }), - Ne.a.prototype.getPhysicsImpostor = function() { - return this.physicsImpostor - } - , - Ne.a.prototype.applyImpulse = function(e, t) { - return this.physicsImpostor ? (this.physicsImpostor.applyImpulse(e, t), - this) : this - } - , - Ne.a.prototype.setPhysicsLinkWith = function(e, t, i, n) { - return this.physicsImpostor && e.physicsImpostor ? (this.physicsImpostor.createJoint(e.physicsImpostor, Jr.e.HingeJoint, { - mainPivot: t, - connectedPivot: i, - nativeParams: n - }), - this) : this - } - ; - var Ga, za, ja = function() { - function e(e) { - var t = this; - this.name = Se.a.NAME_PHYSICSENGINE, - this.scene = e, - this.scene.onBeforePhysicsObservable = new o.c, - this.scene.onAfterPhysicsObservable = new o.c, - this.scene.getDeterministicFrameTime = function() { - return t.scene._physicsEngine ? 1e3 * t.scene._physicsEngine.getTimeStep() : 1e3 / 60 - } - } - return e.prototype.register = function() {} - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() { - this.scene.onBeforePhysicsObservable.clear(), - this.scene.onAfterPhysicsObservable.clear(), - this.scene._physicsEngine && this.scene.disablePhysicsEngine() - } - , - e - }(), Ha = function() { - function e(e) { - this._scene = e, - this._physicsEngine = this._scene.getPhysicsEngine(), - this._physicsEngine || g.a.Warn("Physics engine not enabled. Please enable the physics before you can use the methods.") - } - return e.prototype.applyRadialExplosionImpulse = function(e, t, i, n) { - if (!this._physicsEngine) - return g.a.Warn("Physics engine not enabled. Please enable the physics before you call this method."), - null; - var r = this._physicsEngine.getImpostors(); - if (0 === r.length) - return null; - "number" == typeof t && ((t = new Qa).radius = t, - t.strength = i || t.strength, - t.falloff = n || t.falloff); - var o = new Wa(this._scene,t) - , a = Array(); - return r.forEach(function(t) { - var i = o.getImpostorHitData(t, e); - i && (t.applyImpulse(i.force, i.contactPoint), - a.push({ - impostor: t, - hitData: i - })) - }), - o.triggerAffectedImpostorsCallback(a), - o.dispose(false), - o - } - , - e.prototype.applyRadialExplosionForce = function(e, t, i, n) { - if (!this._physicsEngine) - return g.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."), - null; - var r = this._physicsEngine.getImpostors(); - if (0 === r.length) - return null; - "number" == typeof t && ((t = new Qa).radius = t, - t.strength = i || t.strength, - t.falloff = n || t.falloff); - var o = new Wa(this._scene,t) - , a = Array(); - return r.forEach(function(t) { - var i = o.getImpostorHitData(t, e); - i && (t.applyForce(i.force, i.contactPoint), - a.push({ - impostor: t, - hitData: i - })) - }), - o.triggerAffectedImpostorsCallback(a), - o.dispose(false), - o - } - , - e.prototype.gravitationalField = function(e, t, i, n) { - if (!this._physicsEngine) - return g.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."), - null; - if (0 === this._physicsEngine.getImpostors().length) - return null; - "number" == typeof t && ((t = new Qa).radius = t, - t.strength = i || t.strength, - t.falloff = n || t.falloff); - var r = new Xa(this,this._scene,e,t); - return r.dispose(false), - r - } - , - e.prototype.updraft = function(e, t, i, n, r) { - if (!this._physicsEngine) - return g.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."), - null; - if (0 === this._physicsEngine.getImpostors().length) - return null; - "number" == typeof t && ((t = new qa).radius = t, - t.strength = i || t.strength, - t.height = n || t.height, - t.updraftMode = r || t.updraftMode); - var o = new Ya(this._scene,e,t); - return o.dispose(false), - o - } - , - e.prototype.vortex = function(e, t, i, n) { - if (!this._physicsEngine) - return g.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."), - null; - if (0 === this._physicsEngine.getImpostors().length) - return null; - "number" == typeof t && ((t = new Za).radius = t, - t.strength = i || t.strength, - t.height = n || t.height); - var r = new Ka(this._scene,e,t); - return r.dispose(false), - r - } - , - e - }(), Wa = function() { - function e(e, t) { - this._scene = e, - this._options = t, - this._dataFetched = false, - this._options = h.a({}, new Qa, this._options) - } - return e.prototype.getData = function() { - return this._dataFetched = true, + (Y.a.prototype.disablePhysicsEngine = function () { + this._physicsEngine && + (this._physicsEngine.dispose(), + (this._physicsEngine = null)); + }), + (Y.a.prototype.isPhysicsEnabled = function () { + return void 0 !== this._physicsEngine; + }), + (Y.a.prototype.deleteCompoundImpostor = function (e) { + var t = e.parts[0].mesh; + t.physicsImpostor && + (t.physicsImpostor.dispose(), (t.physicsImpostor = null)); + }), + (Y.a.prototype._advancePhysicsEngineStep = function (e) { + this._physicsEngine && + (this.onBeforePhysicsObservable.notifyObservers(this), + this._physicsEngine._step(e / 1e3), + this.onAfterPhysicsObservable.notifyObservers(this)); + }), + Object.defineProperty(Ne.a.prototype, "physicsImpostor", { + get: function () { + return this._physicsImpostor; + }, + set: function (e) { + var t = this; + this._physicsImpostor !== e && + (this._disposePhysicsObserver && + this.onDisposeObservable.remove( + this._disposePhysicsObserver + ), + (this._physicsImpostor = e), + e && + (this._disposePhysicsObserver = + this.onDisposeObservable.add(function () { + t.physicsImpostor && + (t.physicsImpostor.dispose(), + (t.physicsImpostor = null)); + }))); + }, + enumerable: true, + configurable: true, + }), + (Ne.a.prototype.getPhysicsImpostor = function () { + return this.physicsImpostor; + }), + (Ne.a.prototype.applyImpulse = function (e, t) { + return this.physicsImpostor + ? (this.physicsImpostor.applyImpulse(e, t), this) + : this; + }), + (Ne.a.prototype.setPhysicsLinkWith = function (e, t, i, n) { + return this.physicsImpostor && e.physicsImpostor + ? (this.physicsImpostor.createJoint( + e.physicsImpostor, + Jr.e.HingeJoint, { - sphere: this._sphere + mainPivot: t, + connectedPivot: i, + nativeParams: n, } - } - , - e.prototype.getImpostorHitData = function(e, t) { - if (0 === e.mass) - return null; - if (!this._intersectsWithSphere(e, t, this._options.radius)) - return null; - if ("Mesh" !== e.object.getClassName() && "InstancedMesh" !== e.object.getClassName()) - return null; - var i = e.getObjectCenter().subtract(t) - , n = new Dt.a(t,i,this._options.radius).intersectsMesh(e.object).pickedPoint; - if (!n) - return null; - var r = a.x.Distance(t, n); - if (r > this._options.radius) - return null; - var o = this._options.falloff === Ga.Constant ? this._options.strength : this._options.strength * (1 - r / this._options.radius); - return { - force: i.multiplyByFloats(o, o, o), - contactPoint: n, - distanceFromOrigin: r + ), + this) + : this; + }); + var Ga, + za, + ja = (function () { + function e(e) { + var t = this; + (this.name = Se.a.NAME_PHYSICSENGINE), + (this.scene = e), + (this.scene.onBeforePhysicsObservable = new o.c()), + (this.scene.onAfterPhysicsObservable = new o.c()), + (this.scene.getDeterministicFrameTime = function () { + return t.scene._physicsEngine + ? 1e3 * t.scene._physicsEngine.getTimeStep() + : 1e3 / 60; + }); + } + return ( + (e.prototype.register = function () {}), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () { + this.scene.onBeforePhysicsObservable.clear(), + this.scene.onAfterPhysicsObservable.clear(), + this.scene._physicsEngine && + this.scene.disablePhysicsEngine(); + }), + e + ); + })(), + Ha = (function () { + function e(e) { + (this._scene = e), + (this._physicsEngine = this._scene.getPhysicsEngine()), + this._physicsEngine || + g.a.Warn( + "Physics engine not enabled. Please enable the physics before you can use the methods." + ); + } + return ( + (e.prototype.applyRadialExplosionImpulse = function ( + e, + t, + i, + n + ) { + if (!this._physicsEngine) + return ( + g.a.Warn( + "Physics engine not enabled. Please enable the physics before you call this method." + ), + null + ); + var r = this._physicsEngine.getImpostors(); + if (0 === r.length) return null; + "number" == typeof t && + (((t = new Qa()).radius = t), + (t.strength = i || t.strength), + (t.falloff = n || t.falloff)); + var o = new Wa(this._scene, t), + a = Array(); + return ( + r.forEach(function (t) { + var i = o.getImpostorHitData(t, e); + i && + (t.applyImpulse(i.force, i.contactPoint), + a.push({ + impostor: t, + hitData: i, + })); + }), + o.triggerAffectedImpostorsCallback(a), + o.dispose(false), + o + ); + }), + (e.prototype.applyRadialExplosionForce = function ( + e, + t, + i, + n + ) { + if (!this._physicsEngine) + return ( + g.a.Warn( + "Physics engine not enabled. Please enable the physics before you call the PhysicsHelper." + ), + null + ); + var r = this._physicsEngine.getImpostors(); + if (0 === r.length) return null; + "number" == typeof t && + (((t = new Qa()).radius = t), + (t.strength = i || t.strength), + (t.falloff = n || t.falloff)); + var o = new Wa(this._scene, t), + a = Array(); + return ( + r.forEach(function (t) { + var i = o.getImpostorHitData(t, e); + i && + (t.applyForce(i.force, i.contactPoint), + a.push({ + impostor: t, + hitData: i, + })); + }), + o.triggerAffectedImpostorsCallback(a), + o.dispose(false), + o + ); + }), + (e.prototype.gravitationalField = function (e, t, i, n) { + if (!this._physicsEngine) + return ( + g.a.Warn( + "Physics engine not enabled. Please enable the physics before you call the PhysicsHelper." + ), + null + ); + if (0 === this._physicsEngine.getImpostors().length) + return null; + "number" == typeof t && + (((t = new Qa()).radius = t), + (t.strength = i || t.strength), + (t.falloff = n || t.falloff)); + var r = new Xa(this, this._scene, e, t); + return r.dispose(false), r; + }), + (e.prototype.updraft = function (e, t, i, n, r) { + if (!this._physicsEngine) + return ( + g.a.Warn( + "Physics engine not enabled. Please enable the physics before you call the PhysicsHelper." + ), + null + ); + if (0 === this._physicsEngine.getImpostors().length) + return null; + "number" == typeof t && + (((t = new qa()).radius = t), + (t.strength = i || t.strength), + (t.height = n || t.height), + (t.updraftMode = r || t.updraftMode)); + var o = new Ya(this._scene, e, t); + return o.dispose(false), o; + }), + (e.prototype.vortex = function (e, t, i, n) { + if (!this._physicsEngine) + return ( + g.a.Warn( + "Physics engine not enabled. Please enable the physics before you call the PhysicsHelper." + ), + null + ); + if (0 === this._physicsEngine.getImpostors().length) + return null; + "number" == typeof t && + (((t = new Za()).radius = t), + (t.strength = i || t.strength), + (t.height = n || t.height)); + var r = new Ka(this._scene, e, t); + return r.dispose(false), r; + }), + e + ); + })(), + Wa = (function () { + function e(e, t) { + (this._scene = e), + (this._options = t), + (this._dataFetched = false), + (this._options = h.a({}, new Qa(), this._options)); + } + return ( + (e.prototype.getData = function () { + return ( + (this._dataFetched = true), + { + sphere: this._sphere, } - } - , - e.prototype.triggerAffectedImpostorsCallback = function(e) { - this._options.affectedImpostorsCallback && this._options.affectedImpostorsCallback(e) - } - , - e.prototype.dispose = function(e) { - var t = this; - void 0 === e && (e = true), - e ? this._sphere.dispose() : setTimeout(function() { - t._dataFetched || t._sphere.dispose() - }, 0) - } - , - e.prototype._prepareSphere = function() { - this._sphere || (this._sphere = Rn.a.CreateSphere("radialExplosionEventSphere", this._options.sphere, this._scene), - this._sphere.isVisible = false) - } - , - e.prototype._intersectsWithSphere = function(e, t, i) { - var n = e.object; - return this._prepareSphere(), - this._sphere.position = t, - this._sphere.scaling = new a.x(2 * i,2 * i,2 * i), + ); + }), + (e.prototype.getImpostorHitData = function (e, t) { + if (0 === e.mass) return null; + if ( + !this._intersectsWithSphere(e, t, this._options.radius) + ) + return null; + if ( + "Mesh" !== e.object.getClassName() && + "InstancedMesh" !== e.object.getClassName() + ) + return null; + var i = e.getObjectCenter().subtract(t), + n = new Dt.a(t, i, this._options.radius).intersectsMesh( + e.object + ).pickedPoint; + if (!n) return null; + var r = a.x.Distance(t, n); + if (r > this._options.radius) return null; + var o = + this._options.falloff === Ga.Constant + ? this._options.strength + : this._options.strength * + (1 - r / this._options.radius); + return { + force: i.multiplyByFloats(o, o, o), + contactPoint: n, + distanceFromOrigin: r, + }; + }), + (e.prototype.triggerAffectedImpostorsCallback = function ( + e + ) { + this._options.affectedImpostorsCallback && + this._options.affectedImpostorsCallback(e); + }), + (e.prototype.dispose = function (e) { + var t = this; + void 0 === e && (e = true), + e + ? this._sphere.dispose() + : setTimeout(function () { + t._dataFetched || t._sphere.dispose(); + }, 0); + }), + (e.prototype._prepareSphere = function () { + this._sphere || + ((this._sphere = Rn.a.CreateSphere( + "radialExplosionEventSphere", + this._options.sphere, + this._scene + )), + (this._sphere.isVisible = false)); + }), + (e.prototype._intersectsWithSphere = function (e, t, i) { + var n = e.object; + return ( + this._prepareSphere(), + (this._sphere.position = t), + (this._sphere.scaling = new a.x(2 * i, 2 * i, 2 * i)), this._sphere._updateBoundingInfo(), this._sphere.computeWorldMatrix(true), this._sphere.intersectsMesh(n, true) - } - , - e - }(), Xa = function() { - function e(e, t, i, n) { - this._physicsHelper = e, - this._scene = t, - this._origin = i, - this._options = n, - this._dataFetched = false, - this._options = h.a({}, new Qa, this._options), - this._tickCallback = this._tick.bind(this), - this._options.strength = -1 * this._options.strength - } - return e.prototype.getData = function() { - return this._dataFetched = true, - { - sphere: this._sphere - } - } - , - e.prototype.enable = function() { - this._tickCallback.call(this), - this._scene.registerBeforeRender(this._tickCallback) - } - , - e.prototype.disable = function() { - this._scene.unregisterBeforeRender(this._tickCallback) - } - , - e.prototype.dispose = function(e) { - var t = this; - void 0 === e && (e = true), - e ? this._sphere.dispose() : setTimeout(function() { - t._dataFetched || t._sphere.dispose() - }, 0) - } - , - e.prototype._tick = function() { - if (this._sphere) - this._physicsHelper.applyRadialExplosionForce(this._origin, this._options); - else { - var e = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options); - e && (this._sphere = e.getData().sphere.clone("radialExplosionEventSphereClone")) - } - } - , - e - }(), Ya = function() { - function e(e, t, i) { - this._scene = e, - this._origin = t, - this._options = i, - this._originTop = a.x.Zero(), - this._originDirection = a.x.Zero(), - this._cylinderPosition = a.x.Zero(), - this._dataFetched = false, - this._physicsEngine = this._scene.getPhysicsEngine(), - this._options = h.a({}, new qa, this._options), - this._origin.addToRef(new a.x(0,this._options.height / 2,0), this._cylinderPosition), - this._origin.addToRef(new a.x(0,this._options.height,0), this._originTop), - this._options.updraftMode === za.Perpendicular && (this._originDirection = this._origin.subtract(this._originTop).normalize()), - this._tickCallback = this._tick.bind(this), - this._prepareCylinder() - } - return e.prototype.getData = function() { - return this._dataFetched = true, - { - cylinder: this._cylinder - } - } - , - e.prototype.enable = function() { - this._tickCallback.call(this), - this._scene.registerBeforeRender(this._tickCallback) - } - , - e.prototype.disable = function() { - this._scene.unregisterBeforeRender(this._tickCallback) - } - , - e.prototype.dispose = function(e) { - var t = this; - void 0 === e && (e = true), - this._cylinder && (e ? this._cylinder.dispose() : setTimeout(function() { - t._dataFetched || t._cylinder.dispose() - }, 0)) - } - , - e.prototype.getImpostorHitData = function(e) { - if (0 === e.mass) - return null; - if (!this._intersectsWithCylinder(e)) - return null; - var t = e.getObjectCenter(); - if (this._options.updraftMode === za.Perpendicular) - var i = this._originDirection; - else - i = t.subtract(this._originTop); - var n = a.x.Distance(this._origin, t) - , r = -1 * this._options.strength; - return { - force: i.multiplyByFloats(r, r, r), - contactPoint: t, - distanceFromOrigin: n - } - } - , - e.prototype._tick = function() { - var e = this; - this._physicsEngine.getImpostors().forEach(function(t) { - var i = e.getImpostorHitData(t); - i && t.applyForce(i.force, i.contactPoint) - }) - } - , - e.prototype._prepareCylinder = function() { - this._cylinder || (this._cylinder = Oi.a.CreateCylinder("updraftEventCylinder", { - height: this._options.height, - diameter: 2 * this._options.radius - }, this._scene), - this._cylinder.isVisible = false) - } - , - e.prototype._intersectsWithCylinder = function(e) { - var t = e.object; - return this._cylinder.position = this._cylinderPosition, - this._cylinder.intersectsMesh(t, true) - } - , - e - }(), Ka = function() { - function e(e, t, i) { - this._scene = e, - this._origin = t, - this._options = i, - this._originTop = a.x.Zero(), - this._cylinderPosition = a.x.Zero(), - this._dataFetched = false, - this._physicsEngine = this._scene.getPhysicsEngine(), - this._options = h.a({}, new Za, this._options), - this._origin.addToRef(new a.x(0,this._options.height / 2,0), this._cylinderPosition), - this._origin.addToRef(new a.x(0,this._options.height,0), this._originTop), - this._tickCallback = this._tick.bind(this), - this._prepareCylinder() - } - return e.prototype.getData = function() { - return this._dataFetched = true, - { - cylinder: this._cylinder - } - } - , - e.prototype.enable = function() { - this._tickCallback.call(this), - this._scene.registerBeforeRender(this._tickCallback) - } - , - e.prototype.disable = function() { - this._scene.unregisterBeforeRender(this._tickCallback) - } - , - e.prototype.dispose = function(e) { - var t = this; - void 0 === e && (e = true), - e ? this._cylinder.dispose() : setTimeout(function() { - t._dataFetched || t._cylinder.dispose() - }, 0) - } - , - e.prototype.getImpostorHitData = function(e) { - if (0 === e.mass) - return null; - if (!this._intersectsWithCylinder(e)) - return null; - if ("Mesh" !== e.object.getClassName() && "InstancedMesh" !== e.object.getClassName()) - return null; - var t = e.getObjectCenter() - , i = new a.x(this._origin.x,t.y,this._origin.z) - , n = t.subtract(i) - , r = new Dt.a(i,n,this._options.radius).intersectsMesh(e.object) - , o = r.pickedPoint; - if (!o) - return null; - var s = r.distance / this._options.radius - , c = o.normalize(); - if (s > this._options.centripetalForceThreshold && (c = c.negate()), - s > this._options.centripetalForceThreshold) - var u = c.x * this._options.centripetalForceMultiplier - , l = c.y * this._options.updraftForceMultiplier - , h = c.z * this._options.centripetalForceMultiplier; - else { - var f = a.x.Cross(i, t).normalize(); - u = (f.x + c.x) * this._options.centrifugalForceMultiplier, - l = this._originTop.y * this._options.updraftForceMultiplier, - h = (f.z + c.z) * this._options.centrifugalForceMultiplier - } - var d = new a.x(u,l,h); - return { - force: d = d.multiplyByFloats(this._options.strength, this._options.strength, this._options.strength), - contactPoint: t, - distanceFromOrigin: s - } - } - , - e.prototype._tick = function() { - var e = this; - this._physicsEngine.getImpostors().forEach(function(t) { - var i = e.getImpostorHitData(t); - i && t.applyForce(i.force, i.contactPoint) - }) - } - , - e.prototype._prepareCylinder = function() { - this._cylinder || (this._cylinder = Oi.a.CreateCylinder("vortexEventCylinder", { - height: this._options.height, - diameter: 2 * this._options.radius - }, this._scene), - this._cylinder.isVisible = false) - } - , - e.prototype._intersectsWithCylinder = function(e) { - var t = e.object; - return this._cylinder.position = this._cylinderPosition, - this._cylinder.intersectsMesh(t, true) - } - , - e - }(), Qa = function() { - this.radius = 5, - this.strength = 10, - this.falloff = Ga.Constant, - this.sphere = { - segments: 32, - diameter: 1 - } - }, qa = function() { - this.radius = 5, - this.strength = 10, - this.height = 10, - this.updraftMode = za.Center - }, Za = function() { - this.radius = 5, - this.strength = 10, - this.height = 10, - this.centripetalForceThreshold = .7, - this.centripetalForceMultiplier = 5, - this.centrifugalForceMultiplier = .5, - this.updraftForceMultiplier = .02 - }; - !function(e) { - e[e.Constant = 0] = "Constant", - e[e.Linear = 1] = "Linear" - }(Ga || (Ga = {})), - function(e) { - e[e.Center = 0] = "Center", - e[e.Perpendicular = 1] = "Perpendicular" - }(za || (za = {})); - Ht.a.ShadersStore.blackAndWhitePixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float degree;\nvoid main(void)\n{\nvec3 color=texture2D(textureSampler,vUV).rgb;\nfloat luminance=dot(color,vec3(0.3,0.59,0.11));\nvec3 blackAndWhite=vec3(luminance,luminance,luminance);\ngl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);\n}"; - var Ja = function(e) { - function t(t, i, n, r, o, a) { - var s = e.call(this, t, "blackAndWhite", ["degree"], null, i, n, r, o, a) || this; - return s.degree = 1, - s.onApplyObservable.add(function(e) { - e.setFloat("degree", s.degree) - }), - s - } - return h.d(t, e), - t - }(Wt) - , $a = function() { - function e(e, t, i, n) { - this._name = t, - this._singleInstance = n || true, - this._getPostProcesses = i, - this._cameras = {}, - this._indicesForCamera = {}, - this._postProcesses = {} - } - return Object.defineProperty(e.prototype, "isSupported", { - get: function() { - for (var e in this._postProcesses) - if (this._postProcesses.hasOwnProperty(e)) - for (var t = this._postProcesses[e], i = 0; i < t.length; i++) - if (!t[i].isSupported) - return false; - return true - }, - enumerable: true, - configurable: true + ); }), - e.prototype._update = function() {} - , - e.prototype._attachCameras = function(e) { - var t, i = this, n = Ee.h.MakeArray(e || this._cameras); - if (n) - for (var r = 0; r < n.length; r++) { - var o = n[r] - , a = o.name; - if (t = this._singleInstance ? 0 : a, - !this._postProcesses[t]) { - var s = this._getPostProcesses(); - s && (this._postProcesses[t] = Array.isArray(s) ? s : [s]) - } - this._indicesForCamera[a] || (this._indicesForCamera[a] = []), - this._postProcesses[t].forEach(function(e) { - var t = o.attachPostProcess(e); - i._indicesForCamera[a].push(t) - }), - this._cameras[a] || (this._cameras[a] = o) - } - } - , - e.prototype._detachCameras = function(e) { - var t = Ee.h.MakeArray(e || this._cameras); - if (t) - for (var i = 0; i < t.length; i++) { - var n = t[i] - , r = n.name - , o = this._postProcesses[this._singleInstance ? 0 : r]; - o && o.forEach(function(e) { - n.detachPostProcess(e) - }), - this._cameras[r] && (this._cameras[r] = null) - } - } - , - e.prototype._enable = function(e) { - var t = this - , i = Ee.h.MakeArray(e || this._cameras); - if (i) - for (var n = 0; n < i.length; n++) - for (var r = i[n], o = r.name, a = 0; a < this._indicesForCamera[o].length; a++) - void 0 !== r._postProcesses[this._indicesForCamera[o][a]] && null !== r._postProcesses[this._indicesForCamera[o][a]] || this._postProcesses[this._singleInstance ? 0 : o].forEach(function(e) { - i[n].attachPostProcess(e, t._indicesForCamera[o][a]) - }) - } - , - e.prototype._disable = function(e) { - var t = Ee.h.MakeArray(e || this._cameras); - if (t) - for (var i = 0; i < t.length; i++) { - var n = t[i] - , r = n.name; - this._postProcesses[this._singleInstance ? 0 : r].forEach(function(e) { - n.detachPostProcess(e) - }) - } - } - , - e.prototype.getPostProcesses = function(e) { - return this._singleInstance ? this._postProcesses[0] : e ? this._postProcesses[e.name] : null - } - , e - }(); - Ht.a.ShadersStore.extractHighlightsPixelShader = "#include\n\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float threshold;\nuniform float exposure;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nfloat luma=getLuminance(gl_FragColor.rgb*exposure);\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\n}"; - var es = function(e) { - function t(t, i, n, r, o, s, c, u) { - void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === u && (u = false); - var l = e.call(this, t, "extractHighlights", ["threshold", "exposure"], null, i, n, r, o, s, null, c, void 0, null, u) || this; - return l.threshold = .9, - l._exposure = 1, - l._inputPostProcess = null, - l.onApplyObservable.add(function(e) { - l._inputPostProcess && e.setTextureFromPostProcess("textureSampler", l._inputPostProcess), - e.setFloat("threshold", Math.pow(l.threshold, a.u)), - e.setFloat("exposure", l._exposure) - }), - l - } - return h.d(t, e), - t - }(Wt); - Ht.a.ShadersStore.bloomMergePixelShader = "uniform sampler2D textureSampler;\nuniform sampler2D bloomBlur;\nvarying vec2 vUV;\nuniform float bloomWeight;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight);\n}\n"; - var ts = function(e) { - function t(t, i, n, r, o, a, s, c, u, l, h) { - void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === h && (h = false); - var f = e.call(this, t, "bloomMerge", ["bloomWeight"], ["circleOfConfusionSampler", "blurStep0", "blurStep1", "blurStep2", "bloomBlur"], o, a, s, c, u, null, l, void 0, null, true) || this; - return f.weight = r, - f.onApplyObservable.add(function(e) { - e.setTextureFromPostProcess("textureSampler", i), - e.setTextureFromPostProcessOutput("bloomBlur", n), - e.setFloat("bloomWeight", f.weight) - }), - h || f.updateEffect(), - f - } - return h.d(t, e), - t - }(Wt) - , is = function(e) { - function t(t, i, n, r, o, s) { - void 0 === o && (o = 0), - void 0 === s && (s = false); - var c = e.call(this, t.getEngine(), "bloom", function() { - return c._effects - }, true) || this; - return c.bloomScale = i, - c._effects = [], - c._downscale = new es("highlights",1,null,je.a.BILINEAR_SAMPLINGMODE,t.getEngine(),false,o,s), - c._blurX = new Hn("horizontal blur",new a.w(1,0),10,i,null,je.a.BILINEAR_SAMPLINGMODE,t.getEngine(),false,o,void 0,s), - c._blurX.alwaysForcePOT = true, - c._blurX.autoClear = false, - c._blurY = new Hn("vertical blur",new a.w(0,1),10,i,null,je.a.BILINEAR_SAMPLINGMODE,t.getEngine(),false,o,void 0,s), - c._blurY.alwaysForcePOT = true, - c._blurY.autoClear = false, - c.kernel = r, - c._effects = [c._downscale, c._blurX, c._blurY], - c._merge = new ts("bloomMerge",c._downscale,c._blurY,n,i,null,je.a.BILINEAR_SAMPLINGMODE,t.getEngine(),false,o,s), - c._merge.autoClear = false, - c._effects.push(c._merge), - c - } - return h.d(t, e), + ); + })(), + Xa = (function () { + function e(e, t, i, n) { + (this._physicsHelper = e), + (this._scene = t), + (this._origin = i), + (this._options = n), + (this._dataFetched = false), + (this._options = h.a({}, new Qa(), this._options)), + (this._tickCallback = this._tick.bind(this)), + (this._options.strength = -1 * this._options.strength); + } + return ( + (e.prototype.getData = function () { + return ( + (this._dataFetched = true), + { + sphere: this._sphere, + } + ); + }), + (e.prototype.enable = function () { + this._tickCallback.call(this), + this._scene.registerBeforeRender(this._tickCallback); + }), + (e.prototype.disable = function () { + this._scene.unregisterBeforeRender(this._tickCallback); + }), + (e.prototype.dispose = function (e) { + var t = this; + void 0 === e && (e = true), + e + ? this._sphere.dispose() + : setTimeout(function () { + t._dataFetched || t._sphere.dispose(); + }, 0); + }), + (e.prototype._tick = function () { + if (this._sphere) + this._physicsHelper.applyRadialExplosionForce( + this._origin, + this._options + ); + else { + var e = this._physicsHelper.applyRadialExplosionForce( + this._origin, + this._options + ); + e && + (this._sphere = e + .getData() + .sphere.clone("radialExplosionEventSphereClone")); + } + }), + e + ); + })(), + Ya = (function () { + function e(e, t, i) { + (this._scene = e), + (this._origin = t), + (this._options = i), + (this._originTop = a.x.Zero()), + (this._originDirection = a.x.Zero()), + (this._cylinderPosition = a.x.Zero()), + (this._dataFetched = false), + (this._physicsEngine = this._scene.getPhysicsEngine()), + (this._options = h.a({}, new qa(), this._options)), + this._origin.addToRef( + new a.x(0, this._options.height / 2, 0), + this._cylinderPosition + ), + this._origin.addToRef( + new a.x(0, this._options.height, 0), + this._originTop + ), + this._options.updraftMode === za.Perpendicular && + (this._originDirection = this._origin + .subtract(this._originTop) + .normalize()), + (this._tickCallback = this._tick.bind(this)), + this._prepareCylinder(); + } + return ( + (e.prototype.getData = function () { + return ( + (this._dataFetched = true), + { + cylinder: this._cylinder, + } + ); + }), + (e.prototype.enable = function () { + this._tickCallback.call(this), + this._scene.registerBeforeRender(this._tickCallback); + }), + (e.prototype.disable = function () { + this._scene.unregisterBeforeRender(this._tickCallback); + }), + (e.prototype.dispose = function (e) { + var t = this; + void 0 === e && (e = true), + this._cylinder && + (e + ? this._cylinder.dispose() + : setTimeout(function () { + t._dataFetched || t._cylinder.dispose(); + }, 0)); + }), + (e.prototype.getImpostorHitData = function (e) { + if (0 === e.mass) return null; + if (!this._intersectsWithCylinder(e)) return null; + var t = e.getObjectCenter(); + if (this._options.updraftMode === za.Perpendicular) + var i = this._originDirection; + else i = t.subtract(this._originTop); + var n = a.x.Distance(this._origin, t), + r = -1 * this._options.strength; + return { + force: i.multiplyByFloats(r, r, r), + contactPoint: t, + distanceFromOrigin: n, + }; + }), + (e.prototype._tick = function () { + var e = this; + this._physicsEngine.getImpostors().forEach(function (t) { + var i = e.getImpostorHitData(t); + i && t.applyForce(i.force, i.contactPoint); + }); + }), + (e.prototype._prepareCylinder = function () { + this._cylinder || + ((this._cylinder = Oi.a.CreateCylinder( + "updraftEventCylinder", + { + height: this._options.height, + diameter: 2 * this._options.radius, + }, + this._scene + )), + (this._cylinder.isVisible = false)); + }), + (e.prototype._intersectsWithCylinder = function (e) { + var t = e.object; + return ( + (this._cylinder.position = this._cylinderPosition), + this._cylinder.intersectsMesh(t, true) + ); + }), + e + ); + })(), + Ka = (function () { + function e(e, t, i) { + (this._scene = e), + (this._origin = t), + (this._options = i), + (this._originTop = a.x.Zero()), + (this._cylinderPosition = a.x.Zero()), + (this._dataFetched = false), + (this._physicsEngine = this._scene.getPhysicsEngine()), + (this._options = h.a({}, new Za(), this._options)), + this._origin.addToRef( + new a.x(0, this._options.height / 2, 0), + this._cylinderPosition + ), + this._origin.addToRef( + new a.x(0, this._options.height, 0), + this._originTop + ), + (this._tickCallback = this._tick.bind(this)), + this._prepareCylinder(); + } + return ( + (e.prototype.getData = function () { + return ( + (this._dataFetched = true), + { + cylinder: this._cylinder, + } + ); + }), + (e.prototype.enable = function () { + this._tickCallback.call(this), + this._scene.registerBeforeRender(this._tickCallback); + }), + (e.prototype.disable = function () { + this._scene.unregisterBeforeRender(this._tickCallback); + }), + (e.prototype.dispose = function (e) { + var t = this; + void 0 === e && (e = true), + e + ? this._cylinder.dispose() + : setTimeout(function () { + t._dataFetched || t._cylinder.dispose(); + }, 0); + }), + (e.prototype.getImpostorHitData = function (e) { + if (0 === e.mass) return null; + if (!this._intersectsWithCylinder(e)) return null; + if ( + "Mesh" !== e.object.getClassName() && + "InstancedMesh" !== e.object.getClassName() + ) + return null; + var t = e.getObjectCenter(), + i = new a.x(this._origin.x, t.y, this._origin.z), + n = t.subtract(i), + r = new Dt.a(i, n, this._options.radius).intersectsMesh( + e.object + ), + o = r.pickedPoint; + if (!o) return null; + var s = r.distance / this._options.radius, + c = o.normalize(); + if ( + (s > this._options.centripetalForceThreshold && + (c = c.negate()), + s > this._options.centripetalForceThreshold) + ) + var u = c.x * this._options.centripetalForceMultiplier, + l = c.y * this._options.updraftForceMultiplier, + h = c.z * this._options.centripetalForceMultiplier; + else { + var f = a.x.Cross(i, t).normalize(); + (u = + (f.x + c.x) * + this._options.centrifugalForceMultiplier), + (l = + this._originTop.y * + this._options.updraftForceMultiplier), + (h = + (f.z + c.z) * + this._options.centrifugalForceMultiplier); + } + var d = new a.x(u, l, h); + return { + force: (d = d.multiplyByFloats( + this._options.strength, + this._options.strength, + this._options.strength + )), + contactPoint: t, + distanceFromOrigin: s, + }; + }), + (e.prototype._tick = function () { + var e = this; + this._physicsEngine.getImpostors().forEach(function (t) { + var i = e.getImpostorHitData(t); + i && t.applyForce(i.force, i.contactPoint); + }); + }), + (e.prototype._prepareCylinder = function () { + this._cylinder || + ((this._cylinder = Oi.a.CreateCylinder( + "vortexEventCylinder", + { + height: this._options.height, + diameter: 2 * this._options.radius, + }, + this._scene + )), + (this._cylinder.isVisible = false)); + }), + (e.prototype._intersectsWithCylinder = function (e) { + var t = e.object; + return ( + (this._cylinder.position = this._cylinderPosition), + this._cylinder.intersectsMesh(t, true) + ); + }), + e + ); + })(), + Qa = function () { + (this.radius = 5), + (this.strength = 10), + (this.falloff = Ga.Constant), + (this.sphere = { + segments: 32, + diameter: 1, + }); + }, + qa = function () { + (this.radius = 5), + (this.strength = 10), + (this.height = 10), + (this.updraftMode = za.Center); + }, + Za = function () { + (this.radius = 5), + (this.strength = 10), + (this.height = 10), + (this.centripetalForceThreshold = 0.7), + (this.centripetalForceMultiplier = 5), + (this.centrifugalForceMultiplier = 0.5), + (this.updraftForceMultiplier = 0.02); + }; + !(function (e) { + (e[(e.Constant = 0)] = "Constant"), + (e[(e.Linear = 1)] = "Linear"); + })(Ga || (Ga = {})), + (function (e) { + (e[(e.Center = 0)] = "Center"), + (e[(e.Perpendicular = 1)] = "Perpendicular"); + })(za || (za = {})); + Ht.a.ShadersStore.blackAndWhitePixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float degree;\nvoid main(void)\n{\nvec3 color=texture2D(textureSampler,vUV).rgb;\nfloat luminance=dot(color,vec3(0.3,0.59,0.11));\nvec3 blackAndWhite=vec3(luminance,luminance,luminance);\ngl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);\n}"; + var Ja = (function (e) { + function t(t, i, n, r, o, a) { + var s = + e.call( + this, + t, + "blackAndWhite", + ["degree"], + null, + i, + n, + r, + o, + a + ) || this; + return ( + (s.degree = 1), + s.onApplyObservable.add(function (e) { + e.setFloat("degree", s.degree); + }), + s + ); + } + return h.d(t, e), t; + })(Wt), + $a = (function () { + function e(e, t, i, n) { + (this._name = t), + (this._singleInstance = n || true), + (this._getPostProcesses = i), + (this._cameras = {}), + (this._indicesForCamera = {}), + (this._postProcesses = {}); + } + return ( + Object.defineProperty(e.prototype, "isSupported", { + get: function () { + for (var e in this._postProcesses) + if (this._postProcesses.hasOwnProperty(e)) + for ( + var t = this._postProcesses[e], i = 0; + i < t.length; + i++ + ) + if (!t[i].isSupported) return false; + return true; + }, + enumerable: true, + configurable: true, + }), + (e.prototype._update = function () {}), + (e.prototype._attachCameras = function (e) { + var t, + i = this, + n = Ee.h.MakeArray(e || this._cameras); + if (n) + for (var r = 0; r < n.length; r++) { + var o = n[r], + a = o.name; + if ( + ((t = this._singleInstance ? 0 : a), + !this._postProcesses[t]) + ) { + var s = this._getPostProcesses(); + s && + (this._postProcesses[t] = Array.isArray(s) + ? s + : [s]); + } + this._indicesForCamera[a] || + (this._indicesForCamera[a] = []), + this._postProcesses[t].forEach(function (e) { + var t = o.attachPostProcess(e); + i._indicesForCamera[a].push(t); + }), + this._cameras[a] || (this._cameras[a] = o); + } + }), + (e.prototype._detachCameras = function (e) { + var t = Ee.h.MakeArray(e || this._cameras); + if (t) + for (var i = 0; i < t.length; i++) { + var n = t[i], + r = n.name, + o = + this._postProcesses[this._singleInstance ? 0 : r]; + o && + o.forEach(function (e) { + n.detachPostProcess(e); + }), + this._cameras[r] && (this._cameras[r] = null); + } + }), + (e.prototype._enable = function (e) { + var t = this, + i = Ee.h.MakeArray(e || this._cameras); + if (i) + for (var n = 0; n < i.length; n++) + for ( + var r = i[n], o = r.name, a = 0; + a < this._indicesForCamera[o].length; + a++ + ) + (void 0 !== + r._postProcesses[this._indicesForCamera[o][a]] && + null !== + r._postProcesses[ + this._indicesForCamera[o][a] + ]) || + this._postProcesses[ + this._singleInstance ? 0 : o + ].forEach(function (e) { + i[n].attachPostProcess( + e, + t._indicesForCamera[o][a] + ); + }); + }), + (e.prototype._disable = function (e) { + var t = Ee.h.MakeArray(e || this._cameras); + if (t) + for (var i = 0; i < t.length; i++) { + var n = t[i], + r = n.name; + this._postProcesses[ + this._singleInstance ? 0 : r + ].forEach(function (e) { + n.detachPostProcess(e); + }); + } + }), + (e.prototype.getPostProcesses = function (e) { + return this._singleInstance + ? this._postProcesses[0] + : e + ? this._postProcesses[e.name] + : null; + }), + e + ); + })(); + Ht.a.ShadersStore.extractHighlightsPixelShader = + "#include\n\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float threshold;\nuniform float exposure;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nfloat luma=getLuminance(gl_FragColor.rgb*exposure);\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\n}"; + var es = (function (e) { + function t(t, i, n, r, o, s, c, u) { + void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === u && (u = false); + var l = + e.call( + this, + t, + "extractHighlights", + ["threshold", "exposure"], + null, + i, + n, + r, + o, + s, + null, + c, + void 0, + null, + u + ) || this; + return ( + (l.threshold = 0.9), + (l._exposure = 1), + (l._inputPostProcess = null), + l.onApplyObservable.add(function (e) { + l._inputPostProcess && + e.setTextureFromPostProcess( + "textureSampler", + l._inputPostProcess + ), + e.setFloat("threshold", Math.pow(l.threshold, a.u)), + e.setFloat("exposure", l._exposure); + }), + l + ); + } + return h.d(t, e), t; + })(Wt); + Ht.a.ShadersStore.bloomMergePixelShader = + "uniform sampler2D textureSampler;\nuniform sampler2D bloomBlur;\nvarying vec2 vUV;\nuniform float bloomWeight;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight);\n}\n"; + var ts = (function (e) { + function t(t, i, n, r, o, a, s, c, u, l, h) { + void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === h && (h = false); + var f = + e.call( + this, + t, + "bloomMerge", + ["bloomWeight"], + [ + "circleOfConfusionSampler", + "blurStep0", + "blurStep1", + "blurStep2", + "bloomBlur", + ], + o, + a, + s, + c, + u, + null, + l, + void 0, + null, + true + ) || this; + return ( + (f.weight = r), + f.onApplyObservable.add(function (e) { + e.setTextureFromPostProcess("textureSampler", i), + e.setTextureFromPostProcessOutput("bloomBlur", n), + e.setFloat("bloomWeight", f.weight); + }), + h || f.updateEffect(), + f + ); + } + return h.d(t, e), t; + })(Wt), + is = (function (e) { + function t(t, i, n, r, o, s) { + void 0 === o && (o = 0), void 0 === s && (s = false); + var c = + e.call( + this, + t.getEngine(), + "bloom", + function () { + return c._effects; + }, + true + ) || this; + return ( + (c.bloomScale = i), + (c._effects = []), + (c._downscale = new es( + "highlights", + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + t.getEngine(), + false, + o, + s + )), + (c._blurX = new Hn( + "horizontal blur", + new a.w(1, 0), + 10, + i, + null, + je.a.BILINEAR_SAMPLINGMODE, + t.getEngine(), + false, + o, + void 0, + s + )), + (c._blurX.alwaysForcePOT = true), + (c._blurX.autoClear = false), + (c._blurY = new Hn( + "vertical blur", + new a.w(0, 1), + 10, + i, + null, + je.a.BILINEAR_SAMPLINGMODE, + t.getEngine(), + false, + o, + void 0, + s + )), + (c._blurY.alwaysForcePOT = true), + (c._blurY.autoClear = false), + (c.kernel = r), + (c._effects = [c._downscale, c._blurX, c._blurY]), + (c._merge = new ts( + "bloomMerge", + c._downscale, + c._blurY, + n, + i, + null, + je.a.BILINEAR_SAMPLINGMODE, + t.getEngine(), + false, + o, + s + )), + (c._merge.autoClear = false), + c._effects.push(c._merge), + c + ); + } + return ( + h.d(t, e), Object.defineProperty(t.prototype, "threshold", { - get: function() { - return this._downscale.threshold - }, - set: function(e) { - this._downscale.threshold = e - }, - enumerable: true, - configurable: true + get: function () { + return this._downscale.threshold; + }, + set: function (e) { + this._downscale.threshold = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "weight", { - get: function() { - return this._merge.weight - }, - set: function(e) { - this._merge.weight = e - }, - enumerable: true, - configurable: true + get: function () { + return this._merge.weight; + }, + set: function (e) { + this._merge.weight = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "kernel", { - get: function() { - return this._blurX.kernel / this.bloomScale - }, - set: function(e) { - this._blurX.kernel = e * this.bloomScale, - this._blurY.kernel = e * this.bloomScale - }, - enumerable: true, - configurable: true + get: function () { + return this._blurX.kernel / this.bloomScale; + }, + set: function (e) { + (this._blurX.kernel = e * this.bloomScale), + (this._blurY.kernel = e * this.bloomScale); + }, + enumerable: true, + configurable: true, }), - t.prototype.disposeEffects = function(e) { - for (var t = 0; t < this._effects.length; t++) - this._effects[t].dispose(e) - } - , - t.prototype._updateEffects = function() { - for (var e = 0; e < this._effects.length; e++) - this._effects[e].updateEffect() - } - , - t.prototype._isReady = function() { - for (var e = 0; e < this._effects.length; e++) - if (!this._effects[e].isReady()) - return false; - return true - } - , - t - }($a); - Ht.a.ShadersStore.chromaticAberrationPixelShader = "\nuniform sampler2D textureSampler;\n\nuniform float chromatic_aberration;\nuniform float radialIntensity;\nuniform vec2 direction;\nuniform vec2 centerPosition;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\nvoid main(void)\n{\nvec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);\nvec2 directionOfEffect=direction;\nif(directionOfEffect.x == 0. && directionOfEffect.y == 0.){\ndirectionOfEffect=normalize(centered_screen_pos);\n}\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+centered_screen_pos.y*centered_screen_pos.y;\nfloat radius=sqrt(radius2);\nvec4 original=texture2D(textureSampler,vUV);\n\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\nfloat ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;\nfloat ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;\n\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\noriginal.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);\ngl_FragColor=original;\n}"; - var ns = function(e) { - function t(t, i, n, r, o, s, c, u, l, h) { - void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === h && (h = false); - var f = e.call(this, t, "chromaticAberration", ["chromatic_aberration", "screen_width", "screen_height", "direction", "radialIntensity", "centerPosition"], [], r, o, s, c, u, null, l, void 0, null, h) || this; - return f.aberrationAmount = 30, - f.radialIntensity = 0, - f.direction = new a.w(.707,.707), - f.centerPosition = new a.w(.5,.5), - f.onApplyObservable.add(function(e) { - e.setFloat("chromatic_aberration", f.aberrationAmount), - e.setFloat("screen_width", i), - e.setFloat("screen_height", n), - e.setFloat("radialIntensity", f.radialIntensity), - e.setFloat2("direction", f.direction.x, f.direction.y), - e.setFloat2("centerPosition", f.centerPosition.x, f.centerPosition.y) - }), - f - } - return h.d(t, e), - t - }(Wt); - Ht.a.ShadersStore.circleOfConfusionPixelShader = "\nuniform sampler2D depthSampler;\n\nvarying vec2 vUV;\n\nuniform vec2 cameraMinMaxZ;\n\nuniform float focusDistance;\nuniform float cocPrecalculation;\nvoid main(void)\n{\nfloat depth=texture2D(depthSampler,vUV).r;\nfloat pixelDistance=(cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth)*1000.0;\nfloat coc=abs(cocPrecalculation* ((focusDistance-pixelDistance)/pixelDistance));\ncoc=clamp(coc,0.0,1.0);\ngl_FragColor=vec4(coc,depth,coc,1.0);\n}\n"; - var rs = function(e) { - function t(t, i, n, r, o, a, s, c, u) { - void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === u && (u = false); - var l = e.call(this, t, "circleOfConfusion", ["cameraMinMaxZ", "focusDistance", "cocPrecalculation"], ["depthSampler"], n, r, o, a, s, null, c, void 0, null, u) || this; - return l.lensSize = 50, - l.fStop = 1.4, - l.focusDistance = 2e3, - l.focalLength = 50, - l._depthTexture = null, - l._depthTexture = i, - l.onApplyObservable.add(function(e) { - if (l._depthTexture) { - e.setTexture("depthSampler", l._depthTexture); - var t = l.lensSize / l.fStop * l.focalLength / (l.focusDistance - l.focalLength); - e.setFloat("focusDistance", l.focusDistance), - e.setFloat("cocPrecalculation", t), - e.setFloat2("cameraMinMaxZ", l._depthTexture.activeCamera.minZ, l._depthTexture.activeCamera.maxZ) - } else - g.a.Warn("No depth texture set on CircleOfConfusionPostProcess") - }), - l - } - return h.d(t, e), - Object.defineProperty(t.prototype, "depthTexture", { - set: function(e) { - this._depthTexture = e - }, - enumerable: true, - configurable: true + (t.prototype.disposeEffects = function (e) { + for (var t = 0; t < this._effects.length; t++) + this._effects[t].dispose(e); + }), + (t.prototype._updateEffects = function () { + for (var e = 0; e < this._effects.length; e++) + this._effects[e].updateEffect(); + }), + (t.prototype._isReady = function () { + for (var e = 0; e < this._effects.length; e++) + if (!this._effects[e].isReady()) return false; + return true; }), t - }(Wt); - Ht.a.ShadersStore.colorCorrectionPixelShader = "\nuniform sampler2D textureSampler;\nuniform sampler2D colorTable;\n\nvarying vec2 vUV;\n\nconst float SLICE_COUNT=16.0;\n\nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {\nfloat sliceSize=1.0/width;\nfloat slicePixelSize=sliceSize/width;\nfloat sliceInnerSize=slicePixelSize*(width-1.0);\nfloat zSlice0=min(floor(uv.z*width),width-1.0);\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\nfloat s0=xOffset+(zSlice0*sliceSize);\nfloat s1=xOffset+(zSlice1*sliceSize);\nvec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));\nvec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));\nfloat zOffset=mod(uv.z*width,1.0);\nvec4 result=mix(slice0Color,slice1Color,zOffset);\nreturn result;\n}\nvoid main(void)\n{\nvec4 screen_color=texture2D(textureSampler,vUV);\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\n}"; - var os = function(e) { - function t(t, i, n, r, o, a, s) { - var c = e.call(this, t, "colorCorrection", null, ["colorTable"], n, r, o, a, s) || this; - return c._colorTableTexture = new je.a(i,r.getScene(),true,false,je.a.TRILINEAR_SAMPLINGMODE), - c._colorTableTexture.anisotropicFilteringLevel = 1, - c._colorTableTexture.wrapU = je.a.CLAMP_ADDRESSMODE, - c._colorTableTexture.wrapV = je.a.CLAMP_ADDRESSMODE, - c.onApply = function(e) { - e.setTexture("colorTable", c._colorTableTexture) - } - , + ); + })($a); + Ht.a.ShadersStore.chromaticAberrationPixelShader = + "\nuniform sampler2D textureSampler;\n\nuniform float chromatic_aberration;\nuniform float radialIntensity;\nuniform vec2 direction;\nuniform vec2 centerPosition;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\nvoid main(void)\n{\nvec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);\nvec2 directionOfEffect=direction;\nif(directionOfEffect.x == 0. && directionOfEffect.y == 0.){\ndirectionOfEffect=normalize(centered_screen_pos);\n}\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+centered_screen_pos.y*centered_screen_pos.y;\nfloat radius=sqrt(radius2);\nvec4 original=texture2D(textureSampler,vUV);\n\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\nfloat ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;\nfloat ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;\n\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\noriginal.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);\ngl_FragColor=original;\n}"; + var ns = (function (e) { + function t(t, i, n, r, o, s, c, u, l, h) { + void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === h && (h = false); + var f = + e.call( + this, + t, + "chromaticAberration", + [ + "chromatic_aberration", + "screen_width", + "screen_height", + "direction", + "radialIntensity", + "centerPosition", + ], + [], + r, + o, + s, + c, + u, + null, + l, + void 0, + null, + h + ) || this; + return ( + (f.aberrationAmount = 30), + (f.radialIntensity = 0), + (f.direction = new a.w(0.707, 0.707)), + (f.centerPosition = new a.w(0.5, 0.5)), + f.onApplyObservable.add(function (e) { + e.setFloat("chromatic_aberration", f.aberrationAmount), + e.setFloat("screen_width", i), + e.setFloat("screen_height", n), + e.setFloat("radialIntensity", f.radialIntensity), + e.setFloat2("direction", f.direction.x, f.direction.y), + e.setFloat2( + "centerPosition", + f.centerPosition.x, + f.centerPosition.y + ); + }), + f + ); + } + return h.d(t, e), t; + })(Wt); + Ht.a.ShadersStore.circleOfConfusionPixelShader = + "\nuniform sampler2D depthSampler;\n\nvarying vec2 vUV;\n\nuniform vec2 cameraMinMaxZ;\n\nuniform float focusDistance;\nuniform float cocPrecalculation;\nvoid main(void)\n{\nfloat depth=texture2D(depthSampler,vUV).r;\nfloat pixelDistance=(cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth)*1000.0;\nfloat coc=abs(cocPrecalculation* ((focusDistance-pixelDistance)/pixelDistance));\ncoc=clamp(coc,0.0,1.0);\ngl_FragColor=vec4(coc,depth,coc,1.0);\n}\n"; + var rs = (function (e) { + function t(t, i, n, r, o, a, s, c, u) { + void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === u && (u = false); + var l = + e.call( + this, + t, + "circleOfConfusion", + ["cameraMinMaxZ", "focusDistance", "cocPrecalculation"], + ["depthSampler"], + n, + r, + o, + a, + s, + null, + c, + void 0, + null, + u + ) || this; + return ( + (l.lensSize = 50), + (l.fStop = 1.4), + (l.focusDistance = 2e3), + (l.focalLength = 50), + (l._depthTexture = null), + (l._depthTexture = i), + l.onApplyObservable.add(function (e) { + if (l._depthTexture) { + e.setTexture("depthSampler", l._depthTexture); + var t = + ((l.lensSize / l.fStop) * l.focalLength) / + (l.focusDistance - l.focalLength); + e.setFloat("focusDistance", l.focusDistance), + e.setFloat("cocPrecalculation", t), + e.setFloat2( + "cameraMinMaxZ", + l._depthTexture.activeCamera.minZ, + l._depthTexture.activeCamera.maxZ + ); + } else g.a.Warn("No depth texture set on CircleOfConfusionPostProcess"); + }), + l + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "depthTexture", { + set: function (e) { + this._depthTexture = e; + }, + enumerable: true, + configurable: true, + }), + t + ); + })(Wt); + Ht.a.ShadersStore.colorCorrectionPixelShader = + "\nuniform sampler2D textureSampler;\nuniform sampler2D colorTable;\n\nvarying vec2 vUV;\n\nconst float SLICE_COUNT=16.0;\n\nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {\nfloat sliceSize=1.0/width;\nfloat slicePixelSize=sliceSize/width;\nfloat sliceInnerSize=slicePixelSize*(width-1.0);\nfloat zSlice0=min(floor(uv.z*width),width-1.0);\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\nfloat s0=xOffset+(zSlice0*sliceSize);\nfloat s1=xOffset+(zSlice1*sliceSize);\nvec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));\nvec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));\nfloat zOffset=mod(uv.z*width,1.0);\nvec4 result=mix(slice0Color,slice1Color,zOffset);\nreturn result;\n}\nvoid main(void)\n{\nvec4 screen_color=texture2D(textureSampler,vUV);\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\n}"; + var os = (function (e) { + function t(t, i, n, r, o, a, s) { + var c = + e.call( + this, + t, + "colorCorrection", + null, + ["colorTable"], + n, + r, + o, + a, + s + ) || this; + return ( + (c._colorTableTexture = new je.a( + i, + r.getScene(), + true, + false, + je.a.TRILINEAR_SAMPLINGMODE + )), + (c._colorTableTexture.anisotropicFilteringLevel = 1), + (c._colorTableTexture.wrapU = je.a.CLAMP_ADDRESSMODE), + (c._colorTableTexture.wrapV = je.a.CLAMP_ADDRESSMODE), + (c.onApply = function (e) { + e.setTexture("colorTable", c._colorTableTexture); + }), + c + ); + } + return h.d(t, e), t; + })(Wt); + Ht.a.ShadersStore.convolutionPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform float kernel[9];\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\nfloat kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];\nif (kernelWeight<=0.0) {\nkernelWeight=1.0;\n}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\n}"; + var as = (function (e) { + function t(t, i, n, r, o, a, s, c) { + void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT); + var u = + e.call( + this, + t, + "convolution", + ["kernel", "screenSize"], + null, + n, + r, + o, + a, + s, + null, c - } - return h.d(t, e), + ) || this; + return ( + (u.kernel = i), + (u.onApply = function (e) { + e.setFloat2("screenSize", u.width, u.height), + e.setArray("kernel", u.kernel); + }), + u + ); + } + return ( + h.d(t, e), + (t.EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1]), + (t.EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0]), + (t.EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1]), + (t.SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0]), + (t.EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2]), + (t.GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0]), t - }(Wt); - Ht.a.ShadersStore.convolutionPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform float kernel[9];\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\nfloat kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];\nif (kernelWeight<=0.0) {\nkernelWeight=1.0;\n}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\n}"; - var as = function(e) { - function t(t, i, n, r, o, a, s, c) { - void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT); - var u = e.call(this, t, "convolution", ["kernel", "screenSize"], null, n, r, o, a, s, null, c) || this; - return u.kernel = i, - u.onApply = function(e) { - e.setFloat2("screenSize", u.width, u.height), - e.setArray("kernel", u.kernel) - } - , - u - } - return h.d(t, e), - t.EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1], - t.EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0], - t.EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1], - t.SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0], - t.EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2], - t.GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0], - t - }(Wt) - , ss = function(e) { - function t(t, i, n, r, o, a, s, c, u, l, h, f, d) { - void 0 === c && (c = null), - void 0 === u && (u = je.a.BILINEAR_SAMPLINGMODE), - void 0 === f && (f = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === d && (d = false); - var p = e.call(this, t, n, r, o, a, u = _.a.TEXTURE_BILINEAR_SAMPLINGMODE, l, h, f = _.a.TEXTURETYPE_UNSIGNED_INT, "#define DOF 1\r\n", d) || this; - return p.direction = n, - p.onApplyObservable.add(function(e) { - null != c && e.setTextureFromPostProcess("textureSampler", c), - e.setTextureFromPostProcessOutput("circleOfConfusionSampler", s), - i.activeCamera && e.setFloat2("cameraMinMaxZ", i.activeCamera.minZ, i.activeCamera.maxZ) - }), - p - } - return h.d(t, e), - t - }(Hn); - Ht.a.ShadersStore.depthOfFieldMergePixelShader = "uniform sampler2D textureSampler;\nvarying vec2 vUV;\nuniform sampler2D circleOfConfusionSampler;\nuniform sampler2D blurStep0;\n#if BLUR_LEVEL>0\nuniform sampler2D blurStep1;\n#endif\n#if BLUR_LEVEL>1\nuniform sampler2D blurStep2;\n#endif\nvoid main(void)\n{\nfloat coc=texture2D(circleOfConfusionSampler,vUV).r;\n#if BLUR_LEVEL == 0\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred0=texture2D(blurStep0,vUV);\ngl_FragColor=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL == 1\nif(coc<0.5){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(original,blurred1,coc/0.5);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\n}\n#endif\n#if BLUR_LEVEL == 2\nif(coc<0.33){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(original,blurred2,coc/0.33);\n}else if(coc<0.66){\nvec4 blurred1=texture2D(blurStep1,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\n}\n#endif\n}\n"; - var cs, us = function() {}, ls = function(e) { - function t(t, i, n, r, o, a, s, c, u, l, h) { - void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === h && (h = false); - var f = e.call(this, t, "depthOfFieldMerge", [], ["circleOfConfusionSampler", "blurStep0", "blurStep1", "blurStep2"], o, a, s, c, u, null, l, void 0, null, true) || this; - return f.blurSteps = r, - f.onApplyObservable.add(function(e) { - e.setTextureFromPostProcess("textureSampler", i), - e.setTextureFromPostProcessOutput("circleOfConfusionSampler", n), - r.forEach(function(t, i) { - e.setTextureFromPostProcessOutput("blurStep" + (r.length - i - 1), t) - }) - }), - h || f.updateEffect(), - f - } - return h.d(t, e), - t.prototype.updateEffect = function(t, i, n, r, o, a) { - void 0 === t && (t = null), + ); + })(Wt), + ss = (function (e) { + function t(t, i, n, r, o, a, s, c, u, l, h, f, d) { + void 0 === c && (c = null), + void 0 === u && (u = je.a.BILINEAR_SAMPLINGMODE), + void 0 === f && (f = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === d && (d = false); + var p = + e.call( + this, + t, + n, + r, + o, + a, + (u = _.a.TEXTURE_BILINEAR_SAMPLINGMODE), + l, + h, + (f = _.a.TEXTURETYPE_UNSIGNED_INT), + "#define DOF 1\r\n", + d + ) || this; + return ( + (p.direction = n), + p.onApplyObservable.add(function (e) { + null != c && + e.setTextureFromPostProcess("textureSampler", c), + e.setTextureFromPostProcessOutput( + "circleOfConfusionSampler", + s + ), + i.activeCamera && + e.setFloat2( + "cameraMinMaxZ", + i.activeCamera.minZ, + i.activeCamera.maxZ + ); + }), + p + ); + } + return h.d(t, e), t; + })(Hn); + Ht.a.ShadersStore.depthOfFieldMergePixelShader = + "uniform sampler2D textureSampler;\nvarying vec2 vUV;\nuniform sampler2D circleOfConfusionSampler;\nuniform sampler2D blurStep0;\n#if BLUR_LEVEL>0\nuniform sampler2D blurStep1;\n#endif\n#if BLUR_LEVEL>1\nuniform sampler2D blurStep2;\n#endif\nvoid main(void)\n{\nfloat coc=texture2D(circleOfConfusionSampler,vUV).r;\n#if BLUR_LEVEL == 0\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred0=texture2D(blurStep0,vUV);\ngl_FragColor=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL == 1\nif(coc<0.5){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(original,blurred1,coc/0.5);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\n}\n#endif\n#if BLUR_LEVEL == 2\nif(coc<0.33){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(original,blurred2,coc/0.33);\n}else if(coc<0.66){\nvec4 blurred1=texture2D(blurStep1,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\n}\n#endif\n}\n"; + var cs, + us = function () {}, + ls = (function (e) { + function t(t, i, n, r, o, a, s, c, u, l, h) { + void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === h && (h = false); + var f = + e.call( + this, + t, + "depthOfFieldMerge", + [], + [ + "circleOfConfusionSampler", + "blurStep0", + "blurStep1", + "blurStep2", + ], + o, + a, + s, + c, + u, + null, + l, + void 0, + null, + true + ) || this; + return ( + (f.blurSteps = r), + f.onApplyObservable.add(function (e) { + e.setTextureFromPostProcess("textureSampler", i), + e.setTextureFromPostProcessOutput( + "circleOfConfusionSampler", + n + ), + r.forEach(function (t, i) { + e.setTextureFromPostProcessOutput( + "blurStep" + (r.length - i - 1), + t + ); + }); + }), + h || f.updateEffect(), + f + ); + } + return ( + h.d(t, e), + (t.prototype.updateEffect = function (t, i, n, r, o, a) { + void 0 === t && (t = null), void 0 === i && (i = null), void 0 === n && (n = null), - t || (t = "", - t += "#define BLUR_LEVEL " + (this.blurSteps.length - 1) + "\n"), - e.prototype.updateEffect.call(this, t, i, n, r, o, a) - } - , + t || + ((t = ""), + (t += + "#define BLUR_LEVEL " + + (this.blurSteps.length - 1) + + "\n")), + e.prototype.updateEffect.call(this, t, i, n, r, o, a); + }), t - }(Wt); - !function(e) { - e[e.Low = 0] = "Low", - e[e.Medium = 1] = "Medium", - e[e.High = 2] = "High" - }(cs || (cs = {})); - var hs = function(e) { - function t(t, i, n, r, o) { - void 0 === n && (n = cs.Low), - void 0 === r && (r = 0), - void 0 === o && (o = false); - var s = e.call(this, t.getEngine(), "depth of field", function() { - return s._effects - }, true) || this; - s._effects = [], - s._circleOfConfusion = new rs("circleOfConfusion",i,1,null,je.a.BILINEAR_SAMPLINGMODE,t.getEngine(),false,r,o), - s._depthOfFieldBlurY = [], - s._depthOfFieldBlurX = []; - var c = 1 - , u = 15; - switch (n) { - case cs.High: - c = 3, - u = 51; - break; - case cs.Medium: - c = 2, - u = 31; - break; - default: - u = 15, - c = 1 - } - for (var l = u / Math.pow(2, c - 1), h = 1, f = 0; f < c; f++) { - var d = new ss("verticle blur",t,new a.w(0,1),l,h,null,s._circleOfConfusion,0 == f ? s._circleOfConfusion : null,je.a.BILINEAR_SAMPLINGMODE,t.getEngine(),false,r,o); - d.autoClear = false, - h = .75 / Math.pow(2, f); - var p = new ss("horizontal blur",t,new a.w(1,0),l,h,null,s._circleOfConfusion,null,je.a.BILINEAR_SAMPLINGMODE,t.getEngine(),false,r,o); - p.autoClear = false, - s._depthOfFieldBlurY.push(d), - s._depthOfFieldBlurX.push(p) - } - for (s._effects = [s._circleOfConfusion], - f = 0; f < s._depthOfFieldBlurX.length; f++) - s._effects.push(s._depthOfFieldBlurY[f]), - s._effects.push(s._depthOfFieldBlurX[f]); - return s._dofMerge = new ls("dofMerge",s._circleOfConfusion,s._circleOfConfusion,s._depthOfFieldBlurX,h,null,je.a.BILINEAR_SAMPLINGMODE,t.getEngine(),false,r,o), - s._dofMerge.autoClear = false, - s._effects.push(s._dofMerge), - s - } - return h.d(t, e), - Object.defineProperty(t.prototype, "focalLength", { - get: function() { - return this._circleOfConfusion.focalLength - }, - set: function(e) { - this._circleOfConfusion.focalLength = e - }, - enumerable: true, - configurable: true + ); + })(Wt); + !(function (e) { + (e[(e.Low = 0)] = "Low"), + (e[(e.Medium = 1)] = "Medium"), + (e[(e.High = 2)] = "High"); + })(cs || (cs = {})); + var hs = (function (e) { + function t(t, i, n, r, o) { + void 0 === n && (n = cs.Low), + void 0 === r && (r = 0), + void 0 === o && (o = false); + var s = + e.call( + this, + t.getEngine(), + "depth of field", + function () { + return s._effects; + }, + true + ) || this; + (s._effects = []), + (s._circleOfConfusion = new rs( + "circleOfConfusion", + i, + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + t.getEngine(), + false, + r, + o + )), + (s._depthOfFieldBlurY = []), + (s._depthOfFieldBlurX = []); + var c = 1, + u = 15; + switch (n) { + case cs.High: + (c = 3), (u = 51); + break; + case cs.Medium: + (c = 2), (u = 31); + break; + default: + (u = 15), (c = 1); + } + for ( + var l = u / Math.pow(2, c - 1), h = 1, f = 0; + f < c; + f++ + ) { + var d = new ss( + "verticle blur", + t, + new a.w(0, 1), + l, + h, + null, + s._circleOfConfusion, + 0 == f ? s._circleOfConfusion : null, + je.a.BILINEAR_SAMPLINGMODE, + t.getEngine(), + false, + r, + o + ); + (d.autoClear = false), (h = 0.75 / Math.pow(2, f)); + var p = new ss( + "horizontal blur", + t, + new a.w(1, 0), + l, + h, + null, + s._circleOfConfusion, + null, + je.a.BILINEAR_SAMPLINGMODE, + t.getEngine(), + false, + r, + o + ); + (p.autoClear = false), + s._depthOfFieldBlurY.push(d), + s._depthOfFieldBlurX.push(p); + } + for ( + s._effects = [s._circleOfConfusion], f = 0; + f < s._depthOfFieldBlurX.length; + f++ + ) + s._effects.push(s._depthOfFieldBlurY[f]), + s._effects.push(s._depthOfFieldBlurX[f]); + return ( + (s._dofMerge = new ls( + "dofMerge", + s._circleOfConfusion, + s._circleOfConfusion, + s._depthOfFieldBlurX, + h, + null, + je.a.BILINEAR_SAMPLINGMODE, + t.getEngine(), + false, + r, + o + )), + (s._dofMerge.autoClear = false), + s._effects.push(s._dofMerge), + s + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "focalLength", { + get: function () { + return this._circleOfConfusion.focalLength; + }, + set: function (e) { + this._circleOfConfusion.focalLength = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "fStop", { + get: function () { + return this._circleOfConfusion.fStop; + }, + set: function (e) { + this._circleOfConfusion.fStop = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "focusDistance", { + get: function () { + return this._circleOfConfusion.focusDistance; + }, + set: function (e) { + this._circleOfConfusion.focusDistance = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "lensSize", { + get: function () { + return this._circleOfConfusion.lensSize; + }, + set: function (e) { + this._circleOfConfusion.lensSize = e; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getClassName = function () { + return "DepthOfFieldEffect"; + }), + Object.defineProperty(t.prototype, "depthTexture", { + set: function (e) { + this._circleOfConfusion.depthTexture = e; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.disposeEffects = function (e) { + for (var t = 0; t < this._effects.length; t++) + this._effects[t].dispose(e); + }), + (t.prototype._updateEffects = function () { + for (var e = 0; e < this._effects.length; e++) + this._effects[e].updateEffect(); + }), + (t.prototype._isReady = function () { + for (var e = 0; e < this._effects.length; e++) + if (!this._effects[e].isReady()) return false; + return true; + }), + t + ); + })($a); + Ht.a.ShadersStore.displayPassPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D passSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(passSampler,vUV);\n}"; + var fs = (function (e) { + function t(t, i, n, r, o, a) { + return ( + e.call( + this, + t, + "displayPass", + ["passSampler"], + ["passSampler"], + i, + n, + r, + o, + a + ) || this + ); + } + return h.d(t, e), t; + })(Wt); + Ht.a.ShadersStore.filterPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 kernelMatrix;\nvoid main(void)\n{\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\ngl_FragColor=vec4(updatedColor,1.0);\n}"; + var ds = (function (e) { + function t(t, i, n, r, o, a, s) { + var c = + e.call( + this, + t, + "filter", + ["kernelMatrix"], + null, + n, + r, + o, + a, + s + ) || this; + return ( + (c.kernelMatrix = i), + (c.onApply = function (e) { + e.setMatrix("kernelMatrix", c.kernelMatrix); }), - Object.defineProperty(t.prototype, "fStop", { - get: function() { - return this._circleOfConfusion.fStop - }, - set: function(e) { - this._circleOfConfusion.fStop = e - }, - enumerable: true, - configurable: true + c + ); + } + return h.d(t, e), t; + })(Wt); + Ht.a.ShadersStore.fxaaPixelShader = + "uniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst float fxaaQualitySubpix=1.0;\nconst float fxaaQualityEdgeThreshold=0.166;\nconst float fxaaQualityEdgeThresholdMin=0.0833;\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){\nvec2 posM;\nposM.x=vUV.x;\nposM.y=vUV.y;\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\nfloat lumaM=FxaaLuma(rgbyM);\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\nfloat maxSM=max(lumaS,lumaM);\nfloat minSM=min(lumaS,lumaM);\nfloat maxESM=max(lumaE,maxSM);\nfloat minESM=min(lumaE,minSM);\nfloat maxWN=max(lumaN,lumaW);\nfloat minWN=min(lumaN,lumaW);\nfloat rangeMax=max(maxWN,maxESM);\nfloat rangeMin=min(minWN,minESM);\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\nfloat range=rangeMax-rangeMin;\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range=edgeVert;\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\nif (!horzSpan)\n{\nlumaN=lumaW;\n}\nif (!horzSpan)\n{\nlumaS=lumaE;\n}\nif (horzSpan)\n{\nlengthSign=texelSize.y;\n}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\nfloat gradientN=lumaN-lumaM;\nfloat gradientS=lumaS-lumaM;\nfloat lumaNN=lumaN+lumaM;\nfloat lumaSS=lumaS+lumaM;\nbool pairN=abs(gradientN)>=abs(gradientS);\nfloat gradient=max(abs(gradientN),abs(gradientS));\nif (pairN)\n{\nlengthSign=-lengthSign;\n}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\nvec2 posB;\nposB.x=posM.x;\nposB.y=posM.y;\nvec2 offNP;\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\nif (!horzSpan)\n{\nposB.x+=lengthSign*0.5;\n}\nif (horzSpan)\n{\nposB.y+=lengthSign*0.5;\n}\nvec2 posN;\nposN.x=posB.x-offNP.x*1.5;\nposN.y=posB.y-offNP.y*1.5;\nvec2 posP;\nposP.x=posB.x+offNP.x*1.5;\nposP.y=posB.y+offNP.y*1.5;\nfloat subpixD=((-2.0)*subpixC)+3.0;\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\nfloat subpixE=subpixC*subpixC;\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\nif (!pairN)\n{\nlumaNN=lumaSS;\n}\nfloat gradientScaled=gradient*1.0/4.0;\nfloat lumaMM=lumaM-lumaNN*0.5;\nfloat subpixF=subpixD*subpixE;\nbool lumaMLTZero=lumaMM<0.0;\nlumaEndN-=lumaNN*0.5;\nlumaEndP-=lumaNN*0.5;\nbool doneN=abs(lumaEndN)>=gradientScaled;\nbool doneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN)\n{\nposN.x-=offNP.x*3.0;\n}\nif (!doneN)\n{\nposN.y-=offNP.y*3.0;\n}\nbool doneNP=(!doneN) || (!doneP);\nif (!doneP)\n{\nposP.x+=offNP.x*3.0;\n}\nif (!doneP)\n{\nposP.y+=offNP.y*3.0;\n}\nif (doneNP)\n{\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\ndoneN=abs(lumaEndN)>=gradientScaled;\ndoneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) posN.x-=offNP.x*12.0;\nif (!doneN) posN.y-=offNP.y*12.0;\ndoneNP=(!doneN) || (!doneP);\nif (!doneP) posP.x+=offNP.x*12.0;\nif (!doneP) posP.y+=offNP.y*12.0;\n}\nfloat dstN=posM.x-posN.x;\nfloat dstP=posP.x-posM.x;\nif (!horzSpan)\n{\ndstN=posM.y-posN.y;\n}\nif (!horzSpan)\n{\ndstP=posP.y-posM.y;\n}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\nfloat spanLength=(dstP+dstN);\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\nfloat spanLengthRcp=1.0/spanLength;\nbool directionN=dstN -1 + ? "#define MALI 1\n" + : null; + }), + t + ); + })(Wt); + Ht.a.ShadersStore.grainPixelShader = + "#include\n\nuniform sampler2D textureSampler;\n\nuniform float intensity;\nuniform float animatedSeed;\n\nvarying vec2 vUV;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec2 seed=vUV*(animatedSeed);\nfloat grain=dither(seed,intensity);\n\nfloat lum=getLuminance(gl_FragColor.rgb);\nfloat grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;\ngl_FragColor.rgb+=grain*grainAmount;\ngl_FragColor.rgb=max(gl_FragColor.rgb,0.0);\n}"; + var ms = (function (e) { + function t(t, i, n, r, o, a, s, c) { + void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === c && (c = false); + var u = + e.call( + this, + t, + "grain", + ["intensity", "animatedSeed"], + [], + i, + n, + r, + o, + a, + null, + s, + void 0, + null, + c + ) || this; + return ( + (u.intensity = 30), + (u.animated = false), + u.onApplyObservable.add(function (e) { + e.setFloat("intensity", u.intensity), + e.setFloat( + "animatedSeed", + u.animated ? Math.random() + 1 : 1 + ); }), - Object.defineProperty(t.prototype, "lensSize", { - get: function() { - return this._circleOfConfusion.lensSize - }, - set: function(e) { - this._circleOfConfusion.lensSize = e - }, - enumerable: true, - configurable: true - }), - t.prototype.getClassName = function() { - return "DepthOfFieldEffect" + u + ); + } + return h.d(t, e), t; + })(Wt); + Ht.a.ShadersStore.highlightsPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nconst vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\nvoid main(void)\n{\nvec4 tex=texture2D(textureSampler,vUV);\nvec3 c=tex.rgb;\nfloat luma=dot(c.rgb,RGBLuminanceCoefficients);\n\n\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a);\n}"; + var gs = (function (e) { + function t(t, i, n, r, o, a, s) { + return ( + void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), + e.call( + this, + t, + "highlights", + null, + null, + i, + n, + r, + o, + a, + null, + s + ) || this + ); + } + return h.d(t, e), t; + })(Wt); + Ht.a.IncludesShadersStore.mrtFragmentDeclaration = + "#if __VERSION__>=200\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n"; + Ht.a.ShadersStore.geometryPixelShader = + "#extension GL_EXT_draw_buffers : require\nprecision highp float;\nprecision highp int;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef VELOCITY\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include[RENDER_TARGET_COUNT]\nvoid main() {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n\ngl_FragData[1]=vec4(normalize(vNormalV),1.0);\n\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPosition,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n}"; + Ht.a.ShadersStore.geometryVertexShader = + "precision highp float;\nprecision highp int;\n#include\n#include\nattribute vec3 position;\nattribute vec3 normal;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n\nuniform mat4 viewProjection;\nuniform mat4 view;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef VELOCITY\nuniform mat4 previousWorld;\nuniform mat4 previousViewProjection;\n#ifdef BONES_VELOCITY_ENABLED\n#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\nvoid main(void)\n{\n#include\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\n\nvCurrentPosition=viewProjection*finalWorld*vec4(position,1.0);\nvPreviousPosition=previousViewProjection*previousWorld*vec4(position,1.0);\n#endif\n#include\nvec4 pos=vec4(finalWorld*vec4(position,1.0));\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normal,0.0)));\nvViewPos=view*pos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(position,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(position,1.0);\n#else\nvPreviousPosition=previousViewProjection*previousWorld*vec4(position,1.0);\n#endif\n#endif\n#ifdef POSITION\nvPosition=pos.xyz/pos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"; + var _s = (function () { + function e(t, i) { + void 0 === i && (i = 1), + (this._previousTransformationMatrices = {}), + (this._previousBonesTransformationMatrices = {}), + (this.excludedSkinnedMeshesFromVelocity = []), + (this._enablePosition = false), + (this._enableVelocity = false), + (this._positionIndex = -1), + (this._velocityIndex = -1), + (this._scene = t), + (this._ratio = i), + e._SceneComponentInitialization(this._scene), + this._createRenderTargets(); + } + return ( + Object.defineProperty(e.prototype, "renderList", { + set: function (e) { + this._multiRenderTarget.renderList = e; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "isSupported", { + get: function () { + return this._multiRenderTarget.isSupported; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getTextureIndex = function (t) { + switch (t) { + case e.POSITION_TEXTURE_TYPE: + return this._positionIndex; + case e.VELOCITY_TEXTURE_TYPE: + return this._velocityIndex; + default: + return -1; } - , - Object.defineProperty(t.prototype, "depthTexture", { - set: function(e) { - this._circleOfConfusion.depthTexture = e - }, - enumerable: true, - configurable: true - }), - t.prototype.disposeEffects = function(e) { - for (var t = 0; t < this._effects.length; t++) - this._effects[t].dispose(e) - } - , - t.prototype._updateEffects = function() { - for (var e = 0; e < this._effects.length; e++) - this._effects[e].updateEffect() - } - , - t.prototype._isReady = function() { - for (var e = 0; e < this._effects.length; e++) - if (!this._effects[e].isReady()) - return false; - return true - } - , - t - }($a); - Ht.a.ShadersStore.displayPassPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D passSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(passSampler,vUV);\n}"; - var fs = function(e) { - function t(t, i, n, r, o, a) { - return e.call(this, t, "displayPass", ["passSampler"], ["passSampler"], i, n, r, o, a) || this - } - return h.d(t, e), - t - }(Wt); - Ht.a.ShadersStore.filterPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 kernelMatrix;\nvoid main(void)\n{\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\ngl_FragColor=vec4(updatedColor,1.0);\n}"; - var ds = function(e) { - function t(t, i, n, r, o, a, s) { - var c = e.call(this, t, "filter", ["kernelMatrix"], null, n, r, o, a, s) || this; - return c.kernelMatrix = i, - c.onApply = function(e) { - e.setMatrix("kernelMatrix", c.kernelMatrix) - } - , - c - } - return h.d(t, e), - t - }(Wt); - Ht.a.ShadersStore.fxaaPixelShader = "uniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst float fxaaQualitySubpix=1.0;\nconst float fxaaQualityEdgeThreshold=0.166;\nconst float fxaaQualityEdgeThresholdMin=0.0833;\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){\nvec2 posM;\nposM.x=vUV.x;\nposM.y=vUV.y;\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\nfloat lumaM=FxaaLuma(rgbyM);\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\nfloat maxSM=max(lumaS,lumaM);\nfloat minSM=min(lumaS,lumaM);\nfloat maxESM=max(lumaE,maxSM);\nfloat minESM=min(lumaE,minSM);\nfloat maxWN=max(lumaN,lumaW);\nfloat minWN=min(lumaN,lumaW);\nfloat rangeMax=max(maxWN,maxESM);\nfloat rangeMin=min(minWN,minESM);\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\nfloat range=rangeMax-rangeMin;\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range=edgeVert;\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\nif (!horzSpan)\n{\nlumaN=lumaW;\n}\nif (!horzSpan)\n{\nlumaS=lumaE;\n}\nif (horzSpan)\n{\nlengthSign=texelSize.y;\n}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\nfloat gradientN=lumaN-lumaM;\nfloat gradientS=lumaS-lumaM;\nfloat lumaNN=lumaN+lumaM;\nfloat lumaSS=lumaS+lumaM;\nbool pairN=abs(gradientN)>=abs(gradientS);\nfloat gradient=max(abs(gradientN),abs(gradientS));\nif (pairN)\n{\nlengthSign=-lengthSign;\n}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\nvec2 posB;\nposB.x=posM.x;\nposB.y=posM.y;\nvec2 offNP;\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\nif (!horzSpan)\n{\nposB.x+=lengthSign*0.5;\n}\nif (horzSpan)\n{\nposB.y+=lengthSign*0.5;\n}\nvec2 posN;\nposN.x=posB.x-offNP.x*1.5;\nposN.y=posB.y-offNP.y*1.5;\nvec2 posP;\nposP.x=posB.x+offNP.x*1.5;\nposP.y=posB.y+offNP.y*1.5;\nfloat subpixD=((-2.0)*subpixC)+3.0;\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\nfloat subpixE=subpixC*subpixC;\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\nif (!pairN)\n{\nlumaNN=lumaSS;\n}\nfloat gradientScaled=gradient*1.0/4.0;\nfloat lumaMM=lumaM-lumaNN*0.5;\nfloat subpixF=subpixD*subpixE;\nbool lumaMLTZero=lumaMM<0.0;\nlumaEndN-=lumaNN*0.5;\nlumaEndP-=lumaNN*0.5;\nbool doneN=abs(lumaEndN)>=gradientScaled;\nbool doneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN)\n{\nposN.x-=offNP.x*3.0;\n}\nif (!doneN)\n{\nposN.y-=offNP.y*3.0;\n}\nbool doneNP=(!doneN) || (!doneP);\nif (!doneP)\n{\nposP.x+=offNP.x*3.0;\n}\nif (!doneP)\n{\nposP.y+=offNP.y*3.0;\n}\nif (doneNP)\n{\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\ndoneN=abs(lumaEndN)>=gradientScaled;\ndoneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) posN.x-=offNP.x*12.0;\nif (!doneN) posN.y-=offNP.y*12.0;\ndoneNP=(!doneN) || (!doneP);\nif (!doneP) posP.x+=offNP.x*12.0;\nif (!doneP) posP.y+=offNP.y*12.0;\n}\nfloat dstN=posM.x-posN.x;\nfloat dstP=posP.x-posM.x;\nif (!horzSpan)\n{\ndstN=posM.y-posN.y;\n}\nif (!horzSpan)\n{\ndstP=posP.y-posM.y;\n}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\nfloat spanLength=(dstP+dstN);\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\nfloat spanLengthRcp=1.0/spanLength;\nbool directionN=dstN -1 ? "#define MALI 1\n" : null - } - , - t - }(Wt); - Ht.a.ShadersStore.grainPixelShader = "#include\n\nuniform sampler2D textureSampler;\n\nuniform float intensity;\nuniform float animatedSeed;\n\nvarying vec2 vUV;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec2 seed=vUV*(animatedSeed);\nfloat grain=dither(seed,intensity);\n\nfloat lum=getLuminance(gl_FragColor.rgb);\nfloat grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;\ngl_FragColor.rgb+=grain*grainAmount;\ngl_FragColor.rgb=max(gl_FragColor.rgb,0.0);\n}"; - var ms = function(e) { - function t(t, i, n, r, o, a, s, c) { - void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === c && (c = false); - var u = e.call(this, t, "grain", ["intensity", "animatedSeed"], [], i, n, r, o, a, null, s, void 0, null, c) || this; - return u.intensity = 30, - u.animated = false, - u.onApplyObservable.add(function(e) { - e.setFloat("intensity", u.intensity), - e.setFloat("animatedSeed", u.animated ? Math.random() + 1 : 1) - }), - u - } - return h.d(t, e), - t - }(Wt); - Ht.a.ShadersStore.highlightsPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nconst vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\nvoid main(void)\n{\nvec4 tex=texture2D(textureSampler,vUV);\nvec3 c=tex.rgb;\nfloat luma=dot(c.rgb,RGBLuminanceCoefficients);\n\n\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a);\n}"; - var gs = function(e) { - function t(t, i, n, r, o, a, s) { - return void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), - e.call(this, t, "highlights", null, null, i, n, r, o, a, null, s) || this - } - return h.d(t, e), - t - }(Wt); - Ht.a.IncludesShadersStore.mrtFragmentDeclaration = "#if __VERSION__>=200\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n"; - Ht.a.ShadersStore.geometryPixelShader = "#extension GL_EXT_draw_buffers : require\nprecision highp float;\nprecision highp int;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef VELOCITY\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include[RENDER_TARGET_COUNT]\nvoid main() {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n\ngl_FragData[1]=vec4(normalize(vNormalV),1.0);\n\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPosition,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n}"; - Ht.a.ShadersStore.geometryVertexShader = "precision highp float;\nprecision highp int;\n#include\n#include\nattribute vec3 position;\nattribute vec3 normal;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n\nuniform mat4 viewProjection;\nuniform mat4 view;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef VELOCITY\nuniform mat4 previousWorld;\nuniform mat4 previousViewProjection;\n#ifdef BONES_VELOCITY_ENABLED\n#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\nvoid main(void)\n{\n#include\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\n\nvCurrentPosition=viewProjection*finalWorld*vec4(position,1.0);\nvPreviousPosition=previousViewProjection*previousWorld*vec4(position,1.0);\n#endif\n#include\nvec4 pos=vec4(finalWorld*vec4(position,1.0));\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normal,0.0)));\nvViewPos=view*pos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(position,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(position,1.0);\n#else\nvPreviousPosition=previousViewProjection*previousWorld*vec4(position,1.0);\n#endif\n#endif\n#ifdef POSITION\nvPosition=pos.xyz/pos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"; - var _s = function() { - function e(t, i) { - void 0 === i && (i = 1), - this._previousTransformationMatrices = {}, - this._previousBonesTransformationMatrices = {}, - this.excludedSkinnedMeshesFromVelocity = [], - this._enablePosition = false, - this._enableVelocity = false, - this._positionIndex = -1, - this._velocityIndex = -1, - this._scene = t, - this._ratio = i, - e._SceneComponentInitialization(this._scene), - this._createRenderTargets() - } - return Object.defineProperty(e.prototype, "renderList", { - set: function(e) { - this._multiRenderTarget.renderList = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "isSupported", { - get: function() { - return this._multiRenderTarget.isSupported - }, - enumerable: true, - configurable: true - }), - e.prototype.getTextureIndex = function(t) { - switch (t) { - case e.POSITION_TEXTURE_TYPE: - return this._positionIndex; - case e.VELOCITY_TEXTURE_TYPE: - return this._velocityIndex; - default: - return -1 - } - } - , - Object.defineProperty(e.prototype, "enablePosition", { - get: function() { - return this._enablePosition - }, - set: function(e) { - this._enablePosition = e, - this.dispose(), - this._createRenderTargets() - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "enableVelocity", { - get: function() { - return this._enableVelocity - }, - set: function(e) { - this._enableVelocity = e, - e || (this._previousTransformationMatrices = {}), - this.dispose(), - this._createRenderTargets() - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "scene", { - get: function() { - return this._scene - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "ratio", { - get: function() { - return this._ratio - }, - enumerable: true, - configurable: true - }), - e.prototype.isReady = function(e, t) { - var i = e.getMaterial(); - if (i && i.disableDepthWrite) - return false; - var n = [] - , r = [Si.b.PositionKind, Si.b.NormalKind] - , o = e.getMesh(); - i && i.needAlphaTesting() && (n.push("#define ALPHATEST"), - o.isVerticesDataPresent(Si.b.UVKind) && (r.push(Si.b.UVKind), - n.push("#define UV1")), - o.isVerticesDataPresent(Si.b.UV2Kind) && (r.push(Si.b.UV2Kind), - n.push("#define UV2"))), - this._enablePosition && (n.push("#define POSITION"), - n.push("#define POSITION_INDEX " + this._positionIndex)), - this._enableVelocity && (n.push("#define VELOCITY"), + }), + Object.defineProperty(e.prototype, "enablePosition", { + get: function () { + return this._enablePosition; + }, + set: function (e) { + (this._enablePosition = e), + this.dispose(), + this._createRenderTargets(); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "enableVelocity", { + get: function () { + return this._enableVelocity; + }, + set: function (e) { + (this._enableVelocity = e), + e || (this._previousTransformationMatrices = {}), + this.dispose(), + this._createRenderTargets(); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "scene", { + get: function () { + return this._scene; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "ratio", { + get: function () { + return this._ratio; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.isReady = function (e, t) { + var i = e.getMaterial(); + if (i && i.disableDepthWrite) return false; + var n = [], + r = [Si.b.PositionKind, Si.b.NormalKind], + o = e.getMesh(); + i && + i.needAlphaTesting() && + (n.push("#define ALPHATEST"), + o.isVerticesDataPresent(Si.b.UVKind) && + (r.push(Si.b.UVKind), n.push("#define UV1")), + o.isVerticesDataPresent(Si.b.UV2Kind) && + (r.push(Si.b.UV2Kind), n.push("#define UV2"))), + this._enablePosition && + (n.push("#define POSITION"), + n.push( + "#define POSITION_INDEX " + this._positionIndex + )), + this._enableVelocity && + (n.push("#define VELOCITY"), n.push("#define VELOCITY_INDEX " + this._velocityIndex), - -1 === this.excludedSkinnedMeshesFromVelocity.indexOf(o) && n.push("#define BONES_VELOCITY_ENABLED")), - o.useBones && o.computeBonesUsingShaders ? (r.push(Si.b.MatricesIndicesKind), - r.push(Si.b.MatricesWeightsKind), - o.numBoneInfluencers > 4 && (r.push(Si.b.MatricesIndicesExtraKind), - r.push(Si.b.MatricesWeightsExtraKind)), - n.push("#define NUM_BONE_INFLUENCERS " + o.numBoneInfluencers), - n.push("#define BonesPerMesh " + (o.skeleton ? o.skeleton.bones.length + 1 : 0))) : n.push("#define NUM_BONE_INFLUENCERS 0"), - t && (n.push("#define INSTANCES"), + -1 === + this.excludedSkinnedMeshesFromVelocity.indexOf(o) && + n.push("#define BONES_VELOCITY_ENABLED")), + o.useBones && o.computeBonesUsingShaders + ? (r.push(Si.b.MatricesIndicesKind), + r.push(Si.b.MatricesWeightsKind), + o.numBoneInfluencers > 4 && + (r.push(Si.b.MatricesIndicesExtraKind), + r.push(Si.b.MatricesWeightsExtraKind)), + n.push( + "#define NUM_BONE_INFLUENCERS " + + o.numBoneInfluencers + ), + n.push( + "#define BonesPerMesh " + + (o.skeleton ? o.skeleton.bones.length + 1 : 0) + )) + : n.push("#define NUM_BONE_INFLUENCERS 0"), + t && + (n.push("#define INSTANCES"), r.push("world0"), r.push("world1"), r.push("world2"), r.push("world3")), - n.push("#define RENDER_TARGET_COUNT " + this._multiRenderTarget.textures.length); - var a = n.join("\n"); - return this._cachedDefines !== a && (this._cachedDefines = a, - this._effect = this._scene.getEngine().createEffect("geometry", r, ["world", "mBones", "viewProjection", "diffuseMatrix", "view", "previousWorld", "previousViewProjection", "mPreviousBones"], ["diffuseSampler"], a, void 0, void 0, void 0, { - buffersCount: this._enablePosition ? 3 : 2 - })), - this._effect.isReady() - } - , - e.prototype.getGBuffer = function() { - return this._multiRenderTarget - } - , - Object.defineProperty(e.prototype, "samples", { - get: function() { - return this._multiRenderTarget.samples - }, - set: function(e) { - this._multiRenderTarget.samples = e - }, - enumerable: true, - configurable: true - }), - e.prototype.dispose = function() { - this.getGBuffer().dispose() - } - , - e.prototype._createRenderTargets = function() { - var e = this - , t = this._scene.getEngine() - , i = 2; - if (this._enablePosition && (this._positionIndex = i, - i++), - this._enableVelocity && (this._velocityIndex = i, - i++), - this._multiRenderTarget = new Ao("gBuffer",{ - width: t.getRenderWidth() * this._ratio, - height: t.getRenderHeight() * this._ratio - },i,this._scene,{ - generateMipMaps: false, - generateDepthTexture: true, - defaultType: _.a.TEXTURETYPE_FLOAT - }), - this.isSupported) { - this._multiRenderTarget.wrapU = je.a.CLAMP_ADDRESSMODE, - this._multiRenderTarget.wrapV = je.a.CLAMP_ADDRESSMODE, - this._multiRenderTarget.refreshRate = 1, - this._multiRenderTarget.renderParticles = false, - this._multiRenderTarget.renderList = null, - this._multiRenderTarget.onClearObservable.add(function(e) { - e.clear(new a.f(0,0,0,1), true, true, true) - }); - var n = function(t) { - var i = t.getRenderingMesh() - , n = e._scene - , r = n.getEngine() - , o = t.getMaterial(); - if (o) { - if (e._enableVelocity && !e._previousTransformationMatrices[i.uniqueId] && (e._previousTransformationMatrices[i.uniqueId] = { - world: a.j.Identity(), - viewProjection: n.getTransformMatrix() - }, - i.skeleton)) { - var s = i.skeleton.getTransformMatrices(i); - e._previousBonesTransformationMatrices[i.uniqueId] = e._copyBonesTransformationMatrices(s, new Float32Array(s.length)) - } - r.setState(o.backFaceCulling, 0, false, n.useRightHandedSystem); - var c = i._getInstancesRenderList(t._id); - if (!c.mustReturn) { - var u = r.getCaps().instancedArrays && null !== c.visibleInstances[t._id]; - if (e.isReady(t, u)) { - if (r.enableEffect(e._effect), - i._bind(t, e._effect, Mr.a.TriangleFillMode), - e._effect.setMatrix("viewProjection", n.getTransformMatrix()), - e._effect.setMatrix("view", n.getViewMatrix()), - o && o.needAlphaTesting()) { - var l = o.getAlphaTestTexture(); - l && (e._effect.setTexture("diffuseSampler", l), - e._effect.setMatrix("diffuseMatrix", l.getTextureMatrix())) - } - i.useBones && i.computeBonesUsingShaders && i.skeleton && (e._effect.setMatrices("mBones", i.skeleton.getTransformMatrices(i)), - e._enableVelocity && e._effect.setMatrices("mPreviousBones", e._previousBonesTransformationMatrices[i.uniqueId])), - e._enableVelocity && (e._effect.setMatrix("previousWorld", e._previousTransformationMatrices[i.uniqueId].world), - e._effect.setMatrix("previousViewProjection", e._previousTransformationMatrices[i.uniqueId].viewProjection)), - i._processRendering(t, e._effect, Mr.a.TriangleFillMode, c, u, function(t, i) { - return e._effect.setMatrix("world", i) - }) - } - e._enableVelocity && (e._previousTransformationMatrices[i.uniqueId].world = i.getWorldMatrix().clone(), - e._previousTransformationMatrices[i.uniqueId].viewProjection = e._scene.getTransformMatrix().clone(), - i.skeleton && e._copyBonesTransformationMatrices(i.skeleton.getTransformMatrices(i), e._previousBonesTransformationMatrices[i.uniqueId])) - } - } - }; - this._multiRenderTarget.customRenderFunction = function(e, i, r, o) { - var a; - if (o.length) { - for (t.setColorWrite(false), - a = 0; a < o.length; a++) - n(o.data[a]); - t.setColorWrite(true) - } - for (a = 0; a < e.length; a++) - n(e.data[a]); - for (a = 0; a < i.length; a++) - n(i.data[a]) + n.push( + "#define RENDER_TARGET_COUNT " + + this._multiRenderTarget.textures.length + ); + var a = n.join("\n"); + return ( + this._cachedDefines !== a && + ((this._cachedDefines = a), + (this._effect = this._scene + .getEngine() + .createEffect( + "geometry", + r, + [ + "world", + "mBones", + "viewProjection", + "diffuseMatrix", + "view", + "previousWorld", + "previousViewProjection", + "mPreviousBones", + ], + ["diffuseSampler"], + a, + void 0, + void 0, + void 0, + { + buffersCount: this._enablePosition ? 3 : 2, } - } - } - , - e.prototype._copyBonesTransformationMatrices = function(e, t) { - for (var i = 0; i < e.length; i++) - t[i] = e[i]; - return t - } - , - e.POSITION_TEXTURE_TYPE = 1, - e.VELOCITY_TEXTURE_TYPE = 2, - e._SceneComponentInitialization = function(e) { - throw Te.a.WarnImport("GeometryBufferRendererSceneComponent") - } - , - e - }(); - Object.defineProperty(Y.a.prototype, "geometryBufferRenderer", { - get: function() { - this._geometryBufferRenderer + ))), + this._effect.isReady() + ); + }), + (e.prototype.getGBuffer = function () { + return this._multiRenderTarget; + }), + Object.defineProperty(e.prototype, "samples", { + get: function () { + return this._multiRenderTarget.samples; }, - set: function(e) { - e && e.isSupported && (this._geometryBufferRenderer = e) + set: function (e) { + this._multiRenderTarget.samples = e; }, enumerable: true, - configurable: true + configurable: true, + }), + (e.prototype.dispose = function () { + this.getGBuffer().dispose(); + }), + (e.prototype._createRenderTargets = function () { + var e = this, + t = this._scene.getEngine(), + i = 2; + if ( + (this._enablePosition && ((this._positionIndex = i), i++), + this._enableVelocity && ((this._velocityIndex = i), i++), + (this._multiRenderTarget = new Ao( + "gBuffer", + { + width: t.getRenderWidth() * this._ratio, + height: t.getRenderHeight() * this._ratio, + }, + i, + this._scene, + { + generateMipMaps: false, + generateDepthTexture: true, + defaultType: _.a.TEXTURETYPE_FLOAT, + } + )), + this.isSupported) + ) { + (this._multiRenderTarget.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._multiRenderTarget.wrapV = + je.a.CLAMP_ADDRESSMODE), + (this._multiRenderTarget.refreshRate = 1), + (this._multiRenderTarget.renderParticles = false), + (this._multiRenderTarget.renderList = null), + this._multiRenderTarget.onClearObservable.add(function ( + e + ) { + e.clear(new a.f(0, 0, 0, 1), true, true, true); + }); + var n = function (t) { + var i = t.getRenderingMesh(), + n = e._scene, + r = n.getEngine(), + o = t.getMaterial(); + if (o) { + if ( + e._enableVelocity && + !e._previousTransformationMatrices[i.uniqueId] && + ((e._previousTransformationMatrices[i.uniqueId] = { + world: a.j.Identity(), + viewProjection: n.getTransformMatrix(), + }), + i.skeleton) + ) { + var s = i.skeleton.getTransformMatrices(i); + e._previousBonesTransformationMatrices[i.uniqueId] = + e._copyBonesTransformationMatrices( + s, + new Float32Array(s.length) + ); + } + r.setState( + o.backFaceCulling, + 0, + false, + n.useRightHandedSystem + ); + var c = i._getInstancesRenderList(t._id); + if (!c.mustReturn) { + var u = + r.getCaps().instancedArrays && + null !== c.visibleInstances[t._id]; + if (e.isReady(t, u)) { + if ( + (r.enableEffect(e._effect), + i._bind(t, e._effect, Mr.a.TriangleFillMode), + e._effect.setMatrix( + "viewProjection", + n.getTransformMatrix() + ), + e._effect.setMatrix("view", n.getViewMatrix()), + o && o.needAlphaTesting()) + ) { + var l = o.getAlphaTestTexture(); + l && + (e._effect.setTexture("diffuseSampler", l), + e._effect.setMatrix( + "diffuseMatrix", + l.getTextureMatrix() + )); + } + i.useBones && + i.computeBonesUsingShaders && + i.skeleton && + (e._effect.setMatrices( + "mBones", + i.skeleton.getTransformMatrices(i) + ), + e._enableVelocity && + e._effect.setMatrices( + "mPreviousBones", + e._previousBonesTransformationMatrices[ + i.uniqueId + ] + )), + e._enableVelocity && + (e._effect.setMatrix( + "previousWorld", + e._previousTransformationMatrices[ + i.uniqueId + ].world + ), + e._effect.setMatrix( + "previousViewProjection", + e._previousTransformationMatrices[ + i.uniqueId + ].viewProjection + )), + i._processRendering( + t, + e._effect, + Mr.a.TriangleFillMode, + c, + u, + function (t, i) { + return e._effect.setMatrix("world", i); + } + ); + } + e._enableVelocity && + ((e._previousTransformationMatrices[ + i.uniqueId + ].world = i.getWorldMatrix().clone()), + (e._previousTransformationMatrices[ + i.uniqueId + ].viewProjection = e._scene + .getTransformMatrix() + .clone()), + i.skeleton && + e._copyBonesTransformationMatrices( + i.skeleton.getTransformMatrices(i), + e._previousBonesTransformationMatrices[ + i.uniqueId + ] + )); + } + } + }; + this._multiRenderTarget.customRenderFunction = function ( + e, + i, + r, + o + ) { + var a; + if (o.length) { + for (t.setColorWrite(false), a = 0; a < o.length; a++) + n(o.data[a]); + t.setColorWrite(true); + } + for (a = 0; a < e.length; a++) n(e.data[a]); + for (a = 0; a < i.length; a++) n(i.data[a]); + }; + } + }), + (e.prototype._copyBonesTransformationMatrices = function ( + e, + t + ) { + for (var i = 0; i < e.length; i++) t[i] = e[i]; + return t; + }), + (e.POSITION_TEXTURE_TYPE = 1), + (e.VELOCITY_TEXTURE_TYPE = 2), + (e._SceneComponentInitialization = function (e) { + throw Te.a.WarnImport( + "GeometryBufferRendererSceneComponent" + ); + }), + e + ); + })(); + Object.defineProperty(Y.a.prototype, "geometryBufferRenderer", { + get: function () { + this._geometryBufferRenderer; + }, + set: function (e) { + e && e.isSupported && (this._geometryBufferRenderer = e); + }, + enumerable: true, + configurable: true, + }), + (Y.a.prototype.enableGeometryBufferRenderer = function (e) { + return ( + void 0 === e && (e = 1), + this._geometryBufferRenderer + ? this._geometryBufferRenderer + : ((this._geometryBufferRenderer = new _s(this, e)), + this._geometryBufferRenderer.isSupported || + (this._geometryBufferRenderer = null), + this._geometryBufferRenderer) + ); }), - Y.a.prototype.enableGeometryBufferRenderer = function(e) { - return void 0 === e && (e = 1), - this._geometryBufferRenderer ? this._geometryBufferRenderer : (this._geometryBufferRenderer = new _s(this,e), - this._geometryBufferRenderer.isSupported || (this._geometryBufferRenderer = null), - this._geometryBufferRenderer) + (Y.a.prototype.disableGeometryBufferRenderer = function () { + this._geometryBufferRenderer && + (this._geometryBufferRenderer.dispose(), + (this._geometryBufferRenderer = null)); + }); + var vs = (function () { + function e(e) { + (this.name = Se.a.NAME_GEOMETRYBUFFERRENDERER), + (this.scene = e); } - , - Y.a.prototype.disableGeometryBufferRenderer = function() { - this._geometryBufferRenderer && (this._geometryBufferRenderer.dispose(), - this._geometryBufferRenderer = null) - } - ; - var vs = function() { - function e(e) { - this.name = Se.a.NAME_GEOMETRYBUFFERRENDERER, - this.scene = e - } - return e.prototype.register = function() { - this.scene._gatherRenderTargetsStage.registerStep(Se.a.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, this, this._gatherRenderTargets) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() {} - , - e.prototype._gatherRenderTargets = function(e) { - this.scene._geometryBufferRenderer && e.push(this.scene._geometryBufferRenderer.getGBuffer()) - } - , - e - }(); - _s._SceneComponentInitialization = function(e) { - var t = e._getComponent(Se.a.NAME_GEOMETRYBUFFERRENDERER); - t || (t = new vs(e), - e._addComponent(t)) - } - ; - Ht.a.ShadersStore.motionBlurPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D velocitySampler;\nuniform float motionStrength;\nuniform float motionScale;\nuniform vec2 screenSize;\nvoid main(void)\n{\n#ifdef GEOMETRY_SUPPORTED\nvec2 texelSize=1.0/screenSize;\nvec2 velocityColor=texture2D(velocitySampler,vUV).rg*2.0-1.0;\nvec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0));\nvelocity*=motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint samplesCount=int(clamp(speed,1.0,SAMPLES));\nvelocity=normalize(velocity)*texelSize;\nfloat hlim=float(-samplesCount)*0.5+0.5;\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i=samplesCount)\nbreak;\nvec2 offset=vUV+velocity*(hlim+float(i));\nresult+=texture2D(textureSampler,offset);\n}\ngl_FragColor=result/float(samplesCount);\ngl_FragColor.a=1.0;\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n"; - var ys = function(e) { - function t(t, i, n, r, o, s, c, u, l) { - void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === l && (l = false); - var h = e.call(this, t, "motionBlur", ["motionStrength", "motionScale", "screenSize"], ["velocitySampler"], n, r, o, s, c, "#define GEOMETRY_SUPPORTED\n#define SAMPLES 64.0", u, void 0, null, l) || this; - return h.motionStrength = 1, - h._motionBlurSamples = 32, - h._geometryBufferRenderer = i.enableGeometryBufferRenderer(), - h._geometryBufferRenderer ? (h._geometryBufferRenderer.enableVelocity = true, - h.onApply = function(e) { - if (e.setVector2("screenSize", new a.w(h.width,h.height)), + return ( + (e.prototype.register = function () { + this.scene._gatherRenderTargetsStage.registerStep( + Se.a.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, + this, + this._gatherRenderTargets + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () {}), + (e.prototype._gatherRenderTargets = function (e) { + this.scene._geometryBufferRenderer && + e.push(this.scene._geometryBufferRenderer.getGBuffer()); + }), + e + ); + })(); + _s._SceneComponentInitialization = function (e) { + var t = e._getComponent(Se.a.NAME_GEOMETRYBUFFERRENDERER); + t || ((t = new vs(e)), e._addComponent(t)); + }; + Ht.a.ShadersStore.motionBlurPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D velocitySampler;\nuniform float motionStrength;\nuniform float motionScale;\nuniform vec2 screenSize;\nvoid main(void)\n{\n#ifdef GEOMETRY_SUPPORTED\nvec2 texelSize=1.0/screenSize;\nvec2 velocityColor=texture2D(velocitySampler,vUV).rg*2.0-1.0;\nvec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0));\nvelocity*=motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint samplesCount=int(clamp(speed,1.0,SAMPLES));\nvelocity=normalize(velocity)*texelSize;\nfloat hlim=float(-samplesCount)*0.5+0.5;\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i=samplesCount)\nbreak;\nvec2 offset=vUV+velocity*(hlim+float(i));\nresult+=texture2D(textureSampler,offset);\n}\ngl_FragColor=result/float(samplesCount);\ngl_FragColor.a=1.0;\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n"; + var ys = (function (e) { + function t(t, i, n, r, o, s, c, u, l) { + void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === l && (l = false); + var h = + e.call( + this, + t, + "motionBlur", + ["motionStrength", "motionScale", "screenSize"], + ["velocitySampler"], + n, + r, + o, + s, + c, + "#define GEOMETRY_SUPPORTED\n#define SAMPLES 64.0", + u, + void 0, + null, + l + ) || this; + return ( + (h.motionStrength = 1), + (h._motionBlurSamples = 32), + (h._geometryBufferRenderer = + i.enableGeometryBufferRenderer()), + h._geometryBufferRenderer + ? ((h._geometryBufferRenderer.enableVelocity = true), + (h.onApply = function (e) { + if ( + (e.setVector2( + "screenSize", + new a.w(h.width, h.height) + ), e.setFloat("motionScale", i.getAnimationRatio()), e.setFloat("motionStrength", h.motionStrength), - h._geometryBufferRenderer) { - var t = h._geometryBufferRenderer.getTextureIndex(_s.VELOCITY_TEXTURE_TYPE); - e.setTexture("velocitySampler", h._geometryBufferRenderer.getGBuffer().textures[t]) - } - } - ) : (g.a.Warn("Multiple Render Target support needed to compute object based motion blur"), + h._geometryBufferRenderer) + ) { + var t = h._geometryBufferRenderer.getTextureIndex( + _s.VELOCITY_TEXTURE_TYPE + ); + e.setTexture( + "velocitySampler", + h._geometryBufferRenderer.getGBuffer().textures[t] + ); + } + })) + : (g.a.Warn( + "Multiple Render Target support needed to compute object based motion blur" + ), h.updateEffect()), - h - } - return h.d(t, e), - Object.defineProperty(t.prototype, "motionBlurSamples", { - get: function() { - return this._motionBlurSamples - }, - set: function(e) { - this._motionBlurSamples = e, - this._geometryBufferRenderer && this.updateEffect("#define GEOMETRY_SUPPORTED\n#define SAMPLES " + e.toFixed(1)) - }, - enumerable: true, - configurable: true - }), - t.prototype.excludeSkinnedMesh = function(e) { - this._geometryBufferRenderer && e.skeleton && this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.push(e) - } - , - t.prototype.removeExcludedSkinnedMesh = function(e) { - if (this._geometryBufferRenderer && e.skeleton) { - var t = this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.indexOf(e); - -1 !== t && this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.splice(t, 1) - } - } - , - t.prototype.dispose = function(t) { - this._geometryBufferRenderer && (this._geometryBufferRenderer._previousTransformationMatrices = {}, - this._geometryBufferRenderer._previousBonesTransformationMatrices = {}, - this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity = []), - e.prototype.dispose.call(this, t) - } - , - t - }(Wt); - Ht.a.ShadersStore.refractionPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D refractionSampler;\n\nuniform vec3 baseColor;\nuniform float depth;\nuniform float colorLevel;\nvoid main() {\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\nvec2 uv=vUV-vec2(0.5);\nvec2 offset=uv*depth*ref;\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\n}"; - var bs = function(e) { - function t(t, i, n, r, o, a, s, c, u, l) { - var h = e.call(this, t, "refraction", ["baseColor", "depth", "colorLevel"], ["refractionSampler"], a, s, c, u, l) || this; - return h.color = n, - h.depth = r, - h.colorLevel = o, - h._ownRefractionTexture = true, - h.onActivateObservable.add(function(e) { - h._refTexture = h._refTexture || new je.a(i,e.getScene()) - }), - h.onApplyObservable.add(function(e) { - e.setColor3("baseColor", h.color), - e.setFloat("depth", h.depth), - e.setFloat("colorLevel", h.colorLevel), - e.setTexture("refractionSampler", h._refTexture) - }), - h - } - return h.d(t, e), - Object.defineProperty(t.prototype, "refractionTexture", { - get: function() { - return this._refTexture - }, - set: function(e) { - this._refTexture && this._ownRefractionTexture && this._refTexture.dispose(), - this._refTexture = e, - this._ownRefractionTexture = false - }, - enumerable: true, - configurable: true - }), - t.prototype.dispose = function(t) { - this._refTexture && this._ownRefractionTexture && (this._refTexture.dispose(), - this._refTexture = null), - e.prototype.dispose.call(this, t) - } - , - t - }(Wt); - Ht.a.ShadersStore.sharpenPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform vec2 sharpnessAmounts;\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 color=texture2D(textureSampler,vUV);\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\ncolor*4.0;\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\n}"; - var Es = function(e) { - function t(t, i, n, r, o, a, s, c) { - void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), - void 0 === c && (c = false); - var u = e.call(this, t, "sharpen", ["sharpnessAmounts", "screenSize"], null, i, n, r, o, a, null, s, void 0, null, c) || this; - return u.colorAmount = 1, - u.edgeAmount = .3, - u.onApply = function(e) { - e.setFloat2("screenSize", u.width, u.height), - e.setFloat2("sharpnessAmounts", u.edgeAmount, u.colorAmount) - } - , - u - } - return h.d(t, e), - t - }(Wt) - , Ts = function() { - function e(e, t) { - this.engine = e, - this._name = t, - this._renderEffects = {}, - this._renderEffectsForIsolatedPass = new Array, - this._cameras = [] - } - return Object.defineProperty(e.prototype, "name", { - get: function() { - return this._name - }, - enumerable: true, - configurable: true - }), - e.prototype.getClassName = function() { - return "PostProcessRenderPipeline" - } - , - Object.defineProperty(e.prototype, "isSupported", { - get: function() { - for (var e in this._renderEffects) - if (this._renderEffects.hasOwnProperty(e) && !this._renderEffects[e].isSupported) - return false; - return true - }, - enumerable: true, - configurable: true - }), - e.prototype.addEffect = function(e) { - this._renderEffects[e._name] = e - } - , - e.prototype._rebuild = function() {} - , - e.prototype._enableEffect = function(e, t) { - var i = this._renderEffects[e]; - i && i._enable(Ee.h.MakeArray(t || this._cameras)) - } - , - e.prototype._disableEffect = function(e, t) { - var i = this._renderEffects[e]; - i && i._disable(Ee.h.MakeArray(t || this._cameras)) - } - , - e.prototype._attachCameras = function(e, t) { - var i = Ee.h.MakeArray(e || this._cameras); - if (i) { - var n, r = []; - for (n = 0; n < i.length; n++) { - var o = i[n] - , a = o.name; - -1 === this._cameras.indexOf(o) ? this._cameras[a] = o : t && r.push(n) - } - for (n = 0; n < r.length; n++) - e.splice(r[n], 1); - for (var s in this._renderEffects) - this._renderEffects.hasOwnProperty(s) && this._renderEffects[s]._attachCameras(i) - } - } - , - e.prototype._detachCameras = function(e) { - var t = Ee.h.MakeArray(e || this._cameras); - if (t) { - for (var i in this._renderEffects) - this._renderEffects.hasOwnProperty(i) && this._renderEffects[i]._detachCameras(t); - for (var n = 0; n < t.length; n++) - this._cameras.splice(this._cameras.indexOf(t[n]), 1) - } - } - , - e.prototype._update = function() { - for (var e in this._renderEffects) - this._renderEffects.hasOwnProperty(e) && this._renderEffects[e]._update(); - for (var t = 0; t < this._cameras.length; t++) { - var i = this._cameras[t].name; - this._renderEffectsForIsolatedPass[i] && this._renderEffectsForIsolatedPass[i]._update() - } - } - , - e.prototype._reset = function() { - this._renderEffects = {}, - this._renderEffectsForIsolatedPass = new Array - } - , - e.prototype._enableMSAAOnFirstPostProcess = function(e) { - var t = Object.keys(this._renderEffects); - if (1 === this.engine.webGLVersion) - return false; - if (t.length > 0) { - var i = this._renderEffects[t[0]].getPostProcesses(); - i && (i[0].samples = e) - } - return true - } - , - e.prototype.dispose = function() {} - , - h.c([Object(F.c)()], e.prototype, "_name", void 0), - e - }() - , As = function() { - function e() { - this._renderPipelines = {} - } - return Object.defineProperty(e.prototype, "supportedPipelines", { - get: function() { - var e = []; - for (var t in this._renderPipelines) - if (this._renderPipelines.hasOwnProperty(t)) { - var i = this._renderPipelines[t]; - i.isSupported && e.push(i) - } - return e - }, - enumerable: true, - configurable: true - }), - e.prototype.addPipeline = function(e) { - this._renderPipelines[e._name] = e - } - , - e.prototype.attachCamerasToRenderPipeline = function(e, t, i) { - void 0 === i && (i = false); - var n = this._renderPipelines[e]; - n && n._attachCameras(t, i) - } - , - e.prototype.detachCamerasFromRenderPipeline = function(e, t) { - var i = this._renderPipelines[e]; - i && i._detachCameras(t) - } - , - e.prototype.enableEffectInPipeline = function(e, t, i) { - var n = this._renderPipelines[e]; - n && n._enableEffect(t, i) - } - , - e.prototype.disableEffectInPipeline = function(e, t, i) { - var n = this._renderPipelines[e]; - n && n._disableEffect(t, i) - } - , - e.prototype.update = function() { - for (var e in this._renderPipelines) - if (this._renderPipelines.hasOwnProperty(e)) { - var t = this._renderPipelines[e]; - t.isSupported ? t._update() : (t.dispose(), - delete this._renderPipelines[e]) - } - } - , - e.prototype._rebuild = function() { - for (var e in this._renderPipelines) - this._renderPipelines.hasOwnProperty(e) && this._renderPipelines[e]._rebuild() - } - , - e.prototype.dispose = function() { - for (var e in this._renderPipelines) - this._renderPipelines.hasOwnProperty(e) && this._renderPipelines[e].dispose() - } - , - e - }(); - Object.defineProperty(Y.a.prototype, "postProcessRenderPipelineManager", { - get: function() { - if (!this._postProcessRenderPipelineManager) { - var e = this._getComponent(Se.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER); - e || (e = new xs(this), - this._addComponent(e)), - this._postProcessRenderPipelineManager = new As - } - return this._postProcessRenderPipelineManager + h + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "motionBlurSamples", { + get: function () { + return this._motionBlurSamples; + }, + set: function (e) { + (this._motionBlurSamples = e), + this._geometryBufferRenderer && + this.updateEffect( + "#define GEOMETRY_SUPPORTED\n#define SAMPLES " + + e.toFixed(1) + ); }, enumerable: true, - configurable: true - }); - var xs = function() { - function e(e) { - this.name = Se.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER, - this.scene = e + configurable: true, + }), + (t.prototype.excludeSkinnedMesh = function (e) { + this._geometryBufferRenderer && + e.skeleton && + this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.push( + e + ); + }), + (t.prototype.removeExcludedSkinnedMesh = function (e) { + if (this._geometryBufferRenderer && e.skeleton) { + var t = + this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.indexOf( + e + ); + -1 !== t && + this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.splice( + t, + 1 + ); } - return e.prototype.register = function() { - this.scene._gatherRenderTargetsStage.registerStep(Se.a.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER, this, this._gatherRenderTargets) - } - , - e.prototype.rebuild = function() { - this.scene._postProcessRenderPipelineManager && this.scene._postProcessRenderPipelineManager._rebuild() - } - , - e.prototype.dispose = function() { - this.scene._postProcessRenderPipelineManager && this.scene._postProcessRenderPipelineManager.dispose() - } - , - e.prototype._gatherRenderTargets = function() { - this.scene._postProcessRenderPipelineManager && this.scene._postProcessRenderPipelineManager.update() - } - , + }), + (t.prototype.dispose = function (t) { + this._geometryBufferRenderer && + ((this._geometryBufferRenderer._previousTransformationMatrices = + {}), + (this._geometryBufferRenderer._previousBonesTransformationMatrices = + {}), + (this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity = + [])), + e.prototype.dispose.call(this, t); + }), + t + ); + })(Wt); + Ht.a.ShadersStore.refractionPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D refractionSampler;\n\nuniform vec3 baseColor;\nuniform float depth;\nuniform float colorLevel;\nvoid main() {\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\nvec2 uv=vUV-vec2(0.5);\nvec2 offset=uv*depth*ref;\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\n}"; + var bs = (function (e) { + function t(t, i, n, r, o, a, s, c, u, l) { + var h = + e.call( + this, + t, + "refraction", + ["baseColor", "depth", "colorLevel"], + ["refractionSampler"], + a, + s, + c, + u, + l + ) || this; + return ( + (h.color = n), + (h.depth = r), + (h.colorLevel = o), + (h._ownRefractionTexture = true), + h.onActivateObservable.add(function (e) { + h._refTexture = + h._refTexture || new je.a(i, e.getScene()); + }), + h.onApplyObservable.add(function (e) { + e.setColor3("baseColor", h.color), + e.setFloat("depth", h.depth), + e.setFloat("colorLevel", h.colorLevel), + e.setTexture("refractionSampler", h._refTexture); + }), + h + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "refractionTexture", { + get: function () { + return this._refTexture; + }, + set: function (e) { + this._refTexture && + this._ownRefractionTexture && + this._refTexture.dispose(), + (this._refTexture = e), + (this._ownRefractionTexture = false); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.dispose = function (t) { + this._refTexture && + this._ownRefractionTexture && + (this._refTexture.dispose(), (this._refTexture = null)), + e.prototype.dispose.call(this, t); + }), + t + ); + })(Wt); + Ht.a.ShadersStore.sharpenPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform vec2 sharpnessAmounts;\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 color=texture2D(textureSampler,vUV);\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\ncolor*4.0;\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\n}"; + var Es = (function (e) { + function t(t, i, n, r, o, a, s, c) { + void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), + void 0 === c && (c = false); + var u = + e.call( + this, + t, + "sharpen", + ["sharpnessAmounts", "screenSize"], + null, + i, + n, + r, + o, + a, + null, + s, + void 0, + null, + c + ) || this; + return ( + (u.colorAmount = 1), + (u.edgeAmount = 0.3), + (u.onApply = function (e) { + e.setFloat2("screenSize", u.width, u.height), + e.setFloat2( + "sharpnessAmounts", + u.edgeAmount, + u.colorAmount + ); + }), + u + ); + } + return h.d(t, e), t; + })(Wt), + Ts = (function () { + function e(e, t) { + (this.engine = e), + (this._name = t), + (this._renderEffects = {}), + (this._renderEffectsForIsolatedPass = new Array()), + (this._cameras = []); + } + return ( + Object.defineProperty(e.prototype, "name", { + get: function () { + return this._name; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.getClassName = function () { + return "PostProcessRenderPipeline"; + }), + Object.defineProperty(e.prototype, "isSupported", { + get: function () { + for (var e in this._renderEffects) + if ( + this._renderEffects.hasOwnProperty(e) && + !this._renderEffects[e].isSupported + ) + return false; + return true; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.addEffect = function (e) { + this._renderEffects[e._name] = e; + }), + (e.prototype._rebuild = function () {}), + (e.prototype._enableEffect = function (e, t) { + var i = this._renderEffects[e]; + i && i._enable(Ee.h.MakeArray(t || this._cameras)); + }), + (e.prototype._disableEffect = function (e, t) { + var i = this._renderEffects[e]; + i && i._disable(Ee.h.MakeArray(t || this._cameras)); + }), + (e.prototype._attachCameras = function (e, t) { + var i = Ee.h.MakeArray(e || this._cameras); + if (i) { + var n, + r = []; + for (n = 0; n < i.length; n++) { + var o = i[n], + a = o.name; + -1 === this._cameras.indexOf(o) + ? (this._cameras[a] = o) + : t && r.push(n); + } + for (n = 0; n < r.length; n++) e.splice(r[n], 1); + for (var s in this._renderEffects) + this._renderEffects.hasOwnProperty(s) && + this._renderEffects[s]._attachCameras(i); + } + }), + (e.prototype._detachCameras = function (e) { + var t = Ee.h.MakeArray(e || this._cameras); + if (t) { + for (var i in this._renderEffects) + this._renderEffects.hasOwnProperty(i) && + this._renderEffects[i]._detachCameras(t); + for (var n = 0; n < t.length; n++) + this._cameras.splice(this._cameras.indexOf(t[n]), 1); + } + }), + (e.prototype._update = function () { + for (var e in this._renderEffects) + this._renderEffects.hasOwnProperty(e) && + this._renderEffects[e]._update(); + for (var t = 0; t < this._cameras.length; t++) { + var i = this._cameras[t].name; + this._renderEffectsForIsolatedPass[i] && + this._renderEffectsForIsolatedPass[i]._update(); + } + }), + (e.prototype._reset = function () { + (this._renderEffects = {}), + (this._renderEffectsForIsolatedPass = new Array()); + }), + (e.prototype._enableMSAAOnFirstPostProcess = function (e) { + var t = Object.keys(this._renderEffects); + if (1 === this.engine.webGLVersion) return false; + if (t.length > 0) { + var i = this._renderEffects[t[0]].getPostProcesses(); + i && (i[0].samples = e); + } + return true; + }), + (e.prototype.dispose = function () {}), + h.c([Object(F.c)()], e.prototype, "_name", void 0), e - }() - , Ss = function(e) { - function t(t, i, n, r, o) { - void 0 === t && (t = ""), - void 0 === i && (i = true), - void 0 === n && (n = R.a.LastCreatedScene), - void 0 === o && (o = true); - var a = e.call(this, n.getEngine(), t) || this; - a._camerasToBeAttached = [], - a.SharpenPostProcessId = "SharpenPostProcessEffect", - a.ImageProcessingPostProcessId = "ImageProcessingPostProcessEffect", - a.FxaaPostProcessId = "FxaaPostProcessEffect", - a.ChromaticAberrationPostProcessId = "ChromaticAberrationPostProcessEffect", - a.GrainPostProcessId = "GrainPostProcessEffect", - a._glowLayer = null, - a.animations = [], - a._imageProcessingConfigurationObserver = null, - a._sharpenEnabled = false, - a._bloomEnabled = false, - a._depthOfFieldEnabled = false, - a._depthOfFieldBlurLevel = cs.Low, - a._fxaaEnabled = false, - a._imageProcessingEnabled = true, - a._bloomScale = .5, - a._chromaticAberrationEnabled = false, - a._grainEnabled = false, - a._buildAllowed = true, - a._resizeObserver = null, - a._hardwareScaleLevel = 1, - a._bloomKernel = 64, - a._bloomWeight = .15, - a._bloomThreshold = .9, - a._samples = 1, - a._hasCleared = false, - a._prevPostProcess = null, - a._prevPrevPostProcess = null, - a._depthOfFieldSceneObserver = null, - a._cameras = r || n.cameras, - a._cameras = a._cameras.slice(), - a._camerasToBeAttached = a._cameras.slice(), - a._buildAllowed = o, - a._scene = n; - var s = a._scene.getEngine().getCaps(); - a._hdr = i && (s.textureHalfFloatRender || s.textureFloatRender), - a._hdr ? s.textureHalfFloatRender ? a._defaultPipelineTextureType = _.a.TEXTURETYPE_HALF_FLOAT : s.textureFloatRender && (a._defaultPipelineTextureType = _.a.TEXTURETYPE_FLOAT) : a._defaultPipelineTextureType = _.a.TEXTURETYPE_UNSIGNED_INT, - n.postProcessRenderPipelineManager.addPipeline(a); - var c = a._scene.getEngine(); - return a.sharpen = new Es("sharpen",1,null,je.a.BILINEAR_SAMPLINGMODE,c,false,a._defaultPipelineTextureType,true), - a._sharpenEffect = new $a(c,a.SharpenPostProcessId,function() { - return a.sharpen + ); + })(), + As = (function () { + function e() { + this._renderPipelines = {}; + } + return ( + Object.defineProperty(e.prototype, "supportedPipelines", { + get: function () { + var e = []; + for (var t in this._renderPipelines) + if (this._renderPipelines.hasOwnProperty(t)) { + var i = this._renderPipelines[t]; + i.isSupported && e.push(i); + } + return e; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.addPipeline = function (e) { + this._renderPipelines[e._name] = e; + }), + (e.prototype.attachCamerasToRenderPipeline = function ( + e, + t, + i + ) { + void 0 === i && (i = false); + var n = this._renderPipelines[e]; + n && n._attachCameras(t, i); + }), + (e.prototype.detachCamerasFromRenderPipeline = function ( + e, + t + ) { + var i = this._renderPipelines[e]; + i && i._detachCameras(t); + }), + (e.prototype.enableEffectInPipeline = function (e, t, i) { + var n = this._renderPipelines[e]; + n && n._enableEffect(t, i); + }), + (e.prototype.disableEffectInPipeline = function (e, t, i) { + var n = this._renderPipelines[e]; + n && n._disableEffect(t, i); + }), + (e.prototype.update = function () { + for (var e in this._renderPipelines) + if (this._renderPipelines.hasOwnProperty(e)) { + var t = this._renderPipelines[e]; + t.isSupported + ? t._update() + : (t.dispose(), delete this._renderPipelines[e]); } - ,true), - a.depthOfField = new hs(a._scene,null,a._depthOfFieldBlurLevel,a._defaultPipelineTextureType,true), - a.bloom = new is(a._scene,a._bloomScale,a._bloomWeight,a.bloomKernel,a._defaultPipelineTextureType,true), - a.chromaticAberration = new ns("ChromaticAberration",c.getRenderWidth(),c.getRenderHeight(),1,null,je.a.BILINEAR_SAMPLINGMODE,c,false,a._defaultPipelineTextureType,true), - a._chromaticAberrationEffect = new $a(c,a.ChromaticAberrationPostProcessId,function() { - return a.chromaticAberration - } - ,true), - a.grain = new ms("Grain",1,null,je.a.BILINEAR_SAMPLINGMODE,c,false,a._defaultPipelineTextureType,true), - a._grainEffect = new $a(c,a.GrainPostProcessId,function() { - return a.grain - } - ,true), - a._resizeObserver = c.onResizeObservable.add(function() { - a._hardwareScaleLevel = c.getHardwareScalingLevel(), - a.bloomKernel = a.bloomKernel - }), - a._imageProcessingConfigurationObserver = a._scene.imageProcessingConfiguration.onUpdateParameters.add(function() { - a.bloom._downscale._exposure = a._scene.imageProcessingConfiguration.exposure - }), - a._buildPipeline(), - a + }), + (e.prototype._rebuild = function () { + for (var e in this._renderPipelines) + this._renderPipelines.hasOwnProperty(e) && + this._renderPipelines[e]._rebuild(); + }), + (e.prototype.dispose = function () { + for (var e in this._renderPipelines) + this._renderPipelines.hasOwnProperty(e) && + this._renderPipelines[e].dispose(); + }), + e + ); + })(); + Object.defineProperty( + Y.a.prototype, + "postProcessRenderPipelineManager", + { + get: function () { + if (!this._postProcessRenderPipelineManager) { + var e = this._getComponent( + Se.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER + ); + e || ((e = new xs(this)), this._addComponent(e)), + (this._postProcessRenderPipelineManager = new As()); } - return h.d(t, e), - Object.defineProperty(t.prototype, "scene", { - get: function() { - return this._scene + return this._postProcessRenderPipelineManager; + }, + enumerable: true, + configurable: true, + } + ); + var xs = (function () { + function e(e) { + (this.name = Se.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER), + (this.scene = e); + } + return ( + (e.prototype.register = function () { + this.scene._gatherRenderTargetsStage.registerStep( + Se.a + .STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER, + this, + this._gatherRenderTargets + ); + }), + (e.prototype.rebuild = function () { + this.scene._postProcessRenderPipelineManager && + this.scene._postProcessRenderPipelineManager._rebuild(); + }), + (e.prototype.dispose = function () { + this.scene._postProcessRenderPipelineManager && + this.scene._postProcessRenderPipelineManager.dispose(); + }), + (e.prototype._gatherRenderTargets = function () { + this.scene._postProcessRenderPipelineManager && + this.scene._postProcessRenderPipelineManager.update(); + }), + e + ); + })(), + Ss = (function (e) { + function t(t, i, n, r, o) { + void 0 === t && (t = ""), + void 0 === i && (i = true), + void 0 === n && (n = R.a.LastCreatedScene), + void 0 === o && (o = true); + var a = e.call(this, n.getEngine(), t) || this; + (a._camerasToBeAttached = []), + (a.SharpenPostProcessId = "SharpenPostProcessEffect"), + (a.ImageProcessingPostProcessId = + "ImageProcessingPostProcessEffect"), + (a.FxaaPostProcessId = "FxaaPostProcessEffect"), + (a.ChromaticAberrationPostProcessId = + "ChromaticAberrationPostProcessEffect"), + (a.GrainPostProcessId = "GrainPostProcessEffect"), + (a._glowLayer = null), + (a.animations = []), + (a._imageProcessingConfigurationObserver = null), + (a._sharpenEnabled = false), + (a._bloomEnabled = false), + (a._depthOfFieldEnabled = false), + (a._depthOfFieldBlurLevel = cs.Low), + (a._fxaaEnabled = false), + (a._imageProcessingEnabled = true), + (a._bloomScale = 0.5), + (a._chromaticAberrationEnabled = false), + (a._grainEnabled = false), + (a._buildAllowed = true), + (a._resizeObserver = null), + (a._hardwareScaleLevel = 1), + (a._bloomKernel = 64), + (a._bloomWeight = 0.15), + (a._bloomThreshold = 0.9), + (a._samples = 1), + (a._hasCleared = false), + (a._prevPostProcess = null), + (a._prevPrevPostProcess = null), + (a._depthOfFieldSceneObserver = null), + (a._cameras = r || n.cameras), + (a._cameras = a._cameras.slice()), + (a._camerasToBeAttached = a._cameras.slice()), + (a._buildAllowed = o), + (a._scene = n); + var s = a._scene.getEngine().getCaps(); + (a._hdr = + i && (s.textureHalfFloatRender || s.textureFloatRender)), + a._hdr + ? s.textureHalfFloatRender + ? (a._defaultPipelineTextureType = + _.a.TEXTURETYPE_HALF_FLOAT) + : s.textureFloatRender && + (a._defaultPipelineTextureType = + _.a.TEXTURETYPE_FLOAT) + : (a._defaultPipelineTextureType = + _.a.TEXTURETYPE_UNSIGNED_INT), + n.postProcessRenderPipelineManager.addPipeline(a); + var c = a._scene.getEngine(); + return ( + (a.sharpen = new Es( + "sharpen", + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + c, + false, + a._defaultPipelineTextureType, + true + )), + (a._sharpenEffect = new $a( + c, + a.SharpenPostProcessId, + function () { + return a.sharpen; }, - enumerable: true, - configurable: true + true + )), + (a.depthOfField = new hs( + a._scene, + null, + a._depthOfFieldBlurLevel, + a._defaultPipelineTextureType, + true + )), + (a.bloom = new is( + a._scene, + a._bloomScale, + a._bloomWeight, + a.bloomKernel, + a._defaultPipelineTextureType, + true + )), + (a.chromaticAberration = new ns( + "ChromaticAberration", + c.getRenderWidth(), + c.getRenderHeight(), + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + c, + false, + a._defaultPipelineTextureType, + true + )), + (a._chromaticAberrationEffect = new $a( + c, + a.ChromaticAberrationPostProcessId, + function () { + return a.chromaticAberration; + }, + true + )), + (a.grain = new ms( + "Grain", + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + c, + false, + a._defaultPipelineTextureType, + true + )), + (a._grainEffect = new $a( + c, + a.GrainPostProcessId, + function () { + return a.grain; + }, + true + )), + (a._resizeObserver = c.onResizeObservable.add( + function () { + (a._hardwareScaleLevel = c.getHardwareScalingLevel()), + (a.bloomKernel = a.bloomKernel); + } + )), + (a._imageProcessingConfigurationObserver = + a._scene.imageProcessingConfiguration.onUpdateParameters.add( + function () { + a.bloom._downscale._exposure = + a._scene.imageProcessingConfiguration.exposure; + } + )), + a._buildPipeline(), + a + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "scene", { + get: function () { + return this._scene; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "sharpenEnabled", { - get: function() { - return this._sharpenEnabled - }, - set: function(e) { - this._sharpenEnabled !== e && (this._sharpenEnabled = e, - this._buildPipeline()) - }, - enumerable: true, - configurable: true + get: function () { + return this._sharpenEnabled; + }, + set: function (e) { + this._sharpenEnabled !== e && + ((this._sharpenEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "bloomKernel", { - get: function() { - return this._bloomKernel - }, - set: function(e) { - this._bloomKernel = e, - this.bloom.kernel = e / this._hardwareScaleLevel - }, - enumerable: true, - configurable: true + get: function () { + return this._bloomKernel; + }, + set: function (e) { + (this._bloomKernel = e), + (this.bloom.kernel = e / this._hardwareScaleLevel); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "bloomWeight", { - get: function() { - return this._bloomWeight - }, - set: function(e) { - this._bloomWeight !== e && (this.bloom.weight = e, - this._bloomWeight = e) - }, - enumerable: true, - configurable: true + get: function () { + return this._bloomWeight; + }, + set: function (e) { + this._bloomWeight !== e && + ((this.bloom.weight = e), (this._bloomWeight = e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "bloomThreshold", { - get: function() { - return this._bloomThreshold - }, - set: function(e) { - this._bloomThreshold !== e && (this.bloom.threshold = e, - this._bloomThreshold = e) - }, - enumerable: true, - configurable: true + get: function () { + return this._bloomThreshold; + }, + set: function (e) { + this._bloomThreshold !== e && + ((this.bloom.threshold = e), + (this._bloomThreshold = e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "bloomScale", { - get: function() { - return this._bloomScale - }, - set: function(e) { - this._bloomScale !== e && (this._bloomScale = e, - this._rebuildBloom(), - this._buildPipeline()) - }, - enumerable: true, - configurable: true + get: function () { + return this._bloomScale; + }, + set: function (e) { + this._bloomScale !== e && + ((this._bloomScale = e), + this._rebuildBloom(), + this._buildPipeline()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "bloomEnabled", { - get: function() { - return this._bloomEnabled - }, - set: function(e) { - this._bloomEnabled !== e && (this._bloomEnabled = e, - this._buildPipeline()) - }, - enumerable: true, - configurable: true + get: function () { + return this._bloomEnabled; + }, + set: function (e) { + this._bloomEnabled !== e && + ((this._bloomEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + (t.prototype._rebuildBloom = function () { + var e = this.bloom; + (this.bloom = new is( + this._scene, + this.bloomScale, + this._bloomWeight, + this.bloomKernel, + this._defaultPipelineTextureType, + false + )), + (this.bloom.threshold = e.threshold); + for (var t = 0; t < this._cameras.length; t++) + e.disposeEffects(this._cameras[t]); }), - t.prototype._rebuildBloom = function() { - var e = this.bloom; - this.bloom = new is(this._scene,this.bloomScale,this._bloomWeight,this.bloomKernel,this._defaultPipelineTextureType,false), - this.bloom.threshold = e.threshold; - for (var t = 0; t < this._cameras.length; t++) - e.disposeEffects(this._cameras[t]) - } - , Object.defineProperty(t.prototype, "depthOfFieldEnabled", { - get: function() { - return this._depthOfFieldEnabled + get: function () { + return this._depthOfFieldEnabled; + }, + set: function (e) { + this._depthOfFieldEnabled !== e && + ((this._depthOfFieldEnabled = e), + this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "depthOfFieldBlurLevel", + { + get: function () { + return this._depthOfFieldBlurLevel; }, - set: function(e) { - this._depthOfFieldEnabled !== e && (this._depthOfFieldEnabled = e, - this._buildPipeline()) + set: function (e) { + if (this._depthOfFieldBlurLevel !== e) { + this._depthOfFieldBlurLevel = e; + var t = this.depthOfField; + (this.depthOfField = new hs( + this._scene, + null, + this._depthOfFieldBlurLevel, + this._defaultPipelineTextureType, + false + )), + (this.depthOfField.focalLength = t.focalLength), + (this.depthOfField.focusDistance = + t.focusDistance), + (this.depthOfField.fStop = t.fStop), + (this.depthOfField.lensSize = t.lensSize); + for (var i = 0; i < this._cameras.length; i++) + t.disposeEffects(this._cameras[i]); + this._buildPipeline(); + } }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "depthOfFieldBlurLevel", { - get: function() { - return this._depthOfFieldBlurLevel - }, - set: function(e) { - if (this._depthOfFieldBlurLevel !== e) { - this._depthOfFieldBlurLevel = e; - var t = this.depthOfField; - this.depthOfField = new hs(this._scene,null,this._depthOfFieldBlurLevel,this._defaultPipelineTextureType,false), - this.depthOfField.focalLength = t.focalLength, - this.depthOfField.focusDistance = t.focusDistance, - this.depthOfField.fStop = t.fStop, - this.depthOfField.lensSize = t.lensSize; - for (var i = 0; i < this._cameras.length; i++) - t.disposeEffects(this._cameras[i]); - this._buildPipeline() - } - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "fxaaEnabled", { - get: function() { - return this._fxaaEnabled - }, - set: function(e) { - this._fxaaEnabled !== e && (this._fxaaEnabled = e, - this._buildPipeline()) - }, - enumerable: true, - configurable: true + get: function () { + return this._fxaaEnabled; + }, + set: function (e) { + this._fxaaEnabled !== e && + ((this._fxaaEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "samples", { - get: function() { - return this._samples + get: function () { + return this._samples; + }, + set: function (e) { + this._samples !== e && + ((this._samples = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "imageProcessingEnabled", + { + get: function () { + return this._imageProcessingEnabled; }, - set: function(e) { - this._samples !== e && (this._samples = e, - this._buildPipeline()) + set: function (e) { + this._imageProcessingEnabled !== e && + ((this._imageProcessingEnabled = e), + this._buildPipeline()); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "imageProcessingEnabled", { - get: function() { - return this._imageProcessingEnabled - }, - set: function(e) { - this._imageProcessingEnabled !== e && (this._imageProcessingEnabled = e, - this._buildPipeline()) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "glowLayerEnabled", { - get: function() { - return null != this._glowLayer - }, - set: function(e) { - e && !this._glowLayer ? this._glowLayer = new Ir("",this._scene) : !e && this._glowLayer && (this._glowLayer.dispose(), - this._glowLayer = null) - }, - enumerable: true, - configurable: true + get: function () { + return null != this._glowLayer; + }, + set: function (e) { + e && !this._glowLayer + ? (this._glowLayer = new Ir("", this._scene)) + : !e && + this._glowLayer && + (this._glowLayer.dispose(), + (this._glowLayer = null)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(t.prototype, "glowLayer", { - get: function() { - return this._glowLayer + get: function () { + return this._glowLayer; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "chromaticAberrationEnabled", + { + get: function () { + return this._chromaticAberrationEnabled; + }, + set: function (e) { + this._chromaticAberrationEnabled !== e && + ((this._chromaticAberrationEnabled = e), + this._buildPipeline()); }, enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "chromaticAberrationEnabled", { - get: function() { - return this._chromaticAberrationEnabled - }, - set: function(e) { - this._chromaticAberrationEnabled !== e && (this._chromaticAberrationEnabled = e, - this._buildPipeline()) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(t.prototype, "grainEnabled", { - get: function() { - return this._grainEnabled - }, - set: function(e) { - this._grainEnabled !== e && (this._grainEnabled = e, - this._buildPipeline()) - }, - enumerable: true, - configurable: true + get: function () { + return this._grainEnabled; + }, + set: function (e) { + this._grainEnabled !== e && + ((this._grainEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, }), - t.prototype.getClassName = function() { - return "DefaultRenderingPipeline" - } - , - t.prototype.prepare = function() { - var e = this._buildAllowed; - this._buildAllowed = true, + (t.prototype.getClassName = function () { + return "DefaultRenderingPipeline"; + }), + (t.prototype.prepare = function () { + var e = this._buildAllowed; + (this._buildAllowed = true), this._buildPipeline(), - this._buildAllowed = e - } - , - t.prototype._setAutoClearAndTextureSharing = function(e, t) { - void 0 === t && (t = false), - this._hasCleared ? e.autoClear = false : (e.autoClear = true, - this._scene.autoClear = false, - this._hasCleared = true), - t || (this._prevPrevPostProcess ? e.shareOutputWith(this._prevPrevPostProcess) : e.useOwnOutput(), - this._prevPostProcess && (this._prevPrevPostProcess = this._prevPostProcess), - this._prevPostProcess = e) - } - , - t.prototype._buildPipeline = function() { - var e = this; - if (this._buildAllowed) { - this._scene.autoClear = true; - var t = this._scene.getEngine(); - if (this._disposePostProcesses(), - null !== this._cameras && (this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras), - this._cameras = this._camerasToBeAttached.slice()), - this._reset(), - this._prevPostProcess = null, - this._prevPrevPostProcess = null, - this._hasCleared = false, - this.depthOfFieldEnabled) { - if (this._cameras.length > 1) { - for (var i = 0, n = this._cameras; i < n.length; i++) { - var r = n[i]; - (o = this._scene.enableDepthRenderer(r)).useOnlyInActiveCamera = true - } - this._depthOfFieldSceneObserver = this._scene.onAfterRenderTargetsRenderObservable.add(function(t) { - e._cameras.indexOf(t.activeCamera) > -1 && (e.depthOfField.depthTexture = t.enableDepthRenderer(t.activeCamera).getDepthMap()) - }) - } else { - this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver); - var o = this._scene.enableDepthRenderer(this._cameras[0]); - this.depthOfField.depthTexture = o.getDepthMap() - } - this.depthOfField._isReady() || this.depthOfField._updateEffects(), - this.addEffect(this.depthOfField), - this._setAutoClearAndTextureSharing(this.depthOfField._effects[0], true) - } else - this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver); - this.bloomEnabled && (this.bloom._isReady() || this.bloom._updateEffects(), - this.addEffect(this.bloom), - this._setAutoClearAndTextureSharing(this.bloom._effects[0], true)), - this._imageProcessingEnabled && (this.imageProcessing = new Ai("imageProcessing",1,null,je.a.BILINEAR_SAMPLINGMODE,t,false,this._defaultPipelineTextureType), - this._hdr ? (this.addEffect(new $a(t,this.ImageProcessingPostProcessId,function() { - return e.imageProcessing + (this._buildAllowed = e); + }), + (t.prototype._setAutoClearAndTextureSharing = function ( + e, + t + ) { + void 0 === t && (t = false), + this._hasCleared + ? (e.autoClear = false) + : ((e.autoClear = true), + (this._scene.autoClear = false), + (this._hasCleared = true)), + t || + (this._prevPrevPostProcess + ? e.shareOutputWith(this._prevPrevPostProcess) + : e.useOwnOutput(), + this._prevPostProcess && + (this._prevPrevPostProcess = this._prevPostProcess), + (this._prevPostProcess = e)); + }), + (t.prototype._buildPipeline = function () { + var e = this; + if (this._buildAllowed) { + this._scene.autoClear = true; + var t = this._scene.getEngine(); + if ( + (this._disposePostProcesses(), + null !== this._cameras && + (this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline( + this._name, + this._cameras + ), + (this._cameras = + this._camerasToBeAttached.slice())), + this._reset(), + (this._prevPostProcess = null), + (this._prevPrevPostProcess = null), + (this._hasCleared = false), + this.depthOfFieldEnabled) + ) { + if (this._cameras.length > 1) { + for ( + var i = 0, n = this._cameras; + i < n.length; + i++ + ) { + var r = n[i]; + (o = + this._scene.enableDepthRenderer( + r + )).useOnlyInActiveCamera = true; } - ,true)), - this._setAutoClearAndTextureSharing(this.imageProcessing)) : this._scene.imageProcessingConfiguration.applyByPostProcess = false), - this.sharpenEnabled && (this.sharpen.isReady() || this.sharpen.updateEffect(), + this._depthOfFieldSceneObserver = + this._scene.onAfterRenderTargetsRenderObservable.add( + function (t) { + e._cameras.indexOf(t.activeCamera) > -1 && + (e.depthOfField.depthTexture = t + .enableDepthRenderer(t.activeCamera) + .getDepthMap()); + } + ); + } else { + this._scene.onAfterRenderTargetsRenderObservable.remove( + this._depthOfFieldSceneObserver + ); + var o = this._scene.enableDepthRenderer( + this._cameras[0] + ); + this.depthOfField.depthTexture = o.getDepthMap(); + } + this.depthOfField._isReady() || + this.depthOfField._updateEffects(), + this.addEffect(this.depthOfField), + this._setAutoClearAndTextureSharing( + this.depthOfField._effects[0], + true + ); + } else + this._scene.onAfterRenderTargetsRenderObservable.remove( + this._depthOfFieldSceneObserver + ); + this.bloomEnabled && + (this.bloom._isReady() || this.bloom._updateEffects(), + this.addEffect(this.bloom), + this._setAutoClearAndTextureSharing( + this.bloom._effects[0], + true + )), + this._imageProcessingEnabled && + ((this.imageProcessing = new Ai( + "imageProcessing", + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + t, + false, + this._defaultPipelineTextureType + )), + this._hdr + ? (this.addEffect( + new $a( + t, + this.ImageProcessingPostProcessId, + function () { + return e.imageProcessing; + }, + true + ) + ), + this._setAutoClearAndTextureSharing( + this.imageProcessing + )) + : (this._scene.imageProcessingConfiguration.applyByPostProcess = false)), + this.sharpenEnabled && + (this.sharpen.isReady() || + this.sharpen.updateEffect(), this.addEffect(this._sharpenEffect), this._setAutoClearAndTextureSharing(this.sharpen)), - this.grainEnabled && (this.grain.isReady() || this.grain.updateEffect(), + this.grainEnabled && + (this.grain.isReady() || this.grain.updateEffect(), this.addEffect(this._grainEffect), this._setAutoClearAndTextureSharing(this.grain)), - this.chromaticAberrationEnabled && (this.chromaticAberration.isReady() || this.chromaticAberration.updateEffect(), + this.chromaticAberrationEnabled && + (this.chromaticAberration.isReady() || + this.chromaticAberration.updateEffect(), this.addEffect(this._chromaticAberrationEffect), - this._setAutoClearAndTextureSharing(this.chromaticAberration)), - this.fxaaEnabled && (this.fxaa = new ps("fxaa",1,null,je.a.BILINEAR_SAMPLINGMODE,t,false,this._defaultPipelineTextureType), - this.addEffect(new $a(t,this.FxaaPostProcessId,function() { - return e.fxaa - } - ,true)), - this._setAutoClearAndTextureSharing(this.fxaa, true)), - null !== this._cameras && this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras), - !this._enableMSAAOnFirstPostProcess(this.samples) && this.samples > 1 && g.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0") - } - } - , - t.prototype._disposePostProcesses = function(e) { - void 0 === e && (e = false); - for (var t = 0; t < this._cameras.length; t++) { - var i = this._cameras[t]; - this.imageProcessing && this.imageProcessing.dispose(i), - this.fxaa && this.fxaa.dispose(i), - e && (this.sharpen && this.sharpen.dispose(i), - this.depthOfField && (this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver), - this.depthOfField.disposeEffects(i)), + this._setAutoClearAndTextureSharing( + this.chromaticAberration + )), + this.fxaaEnabled && + ((this.fxaa = new ps( + "fxaa", + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + t, + false, + this._defaultPipelineTextureType + )), + this.addEffect( + new $a( + t, + this.FxaaPostProcessId, + function () { + return e.fxaa; + }, + true + ) + ), + this._setAutoClearAndTextureSharing( + this.fxaa, + true + )), + null !== this._cameras && + this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline( + this._name, + this._cameras + ), + !this._enableMSAAOnFirstPostProcess(this.samples) && + this.samples > 1 && + g.a.Warn( + "MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0" + ); + } + }), + (t.prototype._disposePostProcesses = function (e) { + void 0 === e && (e = false); + for (var t = 0; t < this._cameras.length; t++) { + var i = this._cameras[t]; + this.imageProcessing && this.imageProcessing.dispose(i), + this.fxaa && this.fxaa.dispose(i), + e && + (this.sharpen && this.sharpen.dispose(i), + this.depthOfField && + (this._scene.onAfterRenderTargetsRenderObservable.remove( + this._depthOfFieldSceneObserver + ), + this.depthOfField.disposeEffects(i)), this.bloom && this.bloom.disposeEffects(i), - this.chromaticAberration && this.chromaticAberration.dispose(i), + this.chromaticAberration && + this.chromaticAberration.dispose(i), this.grain && this.grain.dispose(i), - this._glowLayer && this._glowLayer.dispose()) - } - this.imageProcessing = null, - this.fxaa = null, - e && (this.sharpen = null, - this._sharpenEffect = null, - this.depthOfField = null, - this.bloom = null, - this.chromaticAberration = null, - this._chromaticAberrationEffect = null, - this.grain = null, - this._grainEffect = null, - this._glowLayer = null) - } - , - t.prototype.addCamera = function(e) { - this._camerasToBeAttached.push(e), - this._buildPipeline() - } - , - t.prototype.removeCamera = function(e) { - var t = this._camerasToBeAttached.indexOf(e); - this._camerasToBeAttached.splice(t, 1), - this._buildPipeline() - } - , - t.prototype.dispose = function() { - this._disposePostProcesses(true), - this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras), - this._scene.autoClear = true, - this._resizeObserver && (this._scene.getEngine().onResizeObservable.remove(this._resizeObserver), - this._resizeObserver = null), - this._scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigurationObserver), - e.prototype.dispose.call(this) - } - , - t.prototype.serialize = function() { - var e = F.a.Serialize(this); - return e.customType = "DefaultRenderingPipeline", - e - } - , - t.Parse = function(e, i, n) { - return F.a.Parse(function() { - return new t(e._name,e._name._hdr,i) - }, e, i, n) - } - , + this._glowLayer && this._glowLayer.dispose()); + } + (this.imageProcessing = null), + (this.fxaa = null), + e && + ((this.sharpen = null), + (this._sharpenEffect = null), + (this.depthOfField = null), + (this.bloom = null), + (this.chromaticAberration = null), + (this._chromaticAberrationEffect = null), + (this.grain = null), + (this._grainEffect = null), + (this._glowLayer = null)); + }), + (t.prototype.addCamera = function (e) { + this._camerasToBeAttached.push(e), this._buildPipeline(); + }), + (t.prototype.removeCamera = function (e) { + var t = this._camerasToBeAttached.indexOf(e); + this._camerasToBeAttached.splice(t, 1), + this._buildPipeline(); + }), + (t.prototype.dispose = function () { + this._disposePostProcesses(true), + this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline( + this._name, + this._cameras + ), + (this._scene.autoClear = true), + this._resizeObserver && + (this._scene + .getEngine() + .onResizeObservable.remove(this._resizeObserver), + (this._resizeObserver = null)), + this._scene.imageProcessingConfiguration.onUpdateParameters.remove( + this._imageProcessingConfigurationObserver + ), + e.prototype.dispose.call(this); + }), + (t.prototype.serialize = function () { + var e = F.a.Serialize(this); + return (e.customType = "DefaultRenderingPipeline"), e; + }), + (t.Parse = function (e, i, n) { + return F.a.Parse( + function () { + return new t(e._name, e._name._hdr, i); + }, + e, + i, + n + ); + }), h.c([Object(F.c)()], t.prototype, "sharpenEnabled", null), h.c([Object(F.c)()], t.prototype, "bloomKernel", null), h.c([Object(F.c)()], t.prototype, "_bloomWeight", void 0), - h.c([Object(F.c)()], t.prototype, "_bloomThreshold", void 0), + h.c( + [Object(F.c)()], + t.prototype, + "_bloomThreshold", + void 0 + ), h.c([Object(F.c)()], t.prototype, "_hdr", void 0), h.c([Object(F.c)()], t.prototype, "bloomWeight", null), h.c([Object(F.c)()], t.prototype, "bloomThreshold", null), h.c([Object(F.c)()], t.prototype, "bloomScale", null), h.c([Object(F.c)()], t.prototype, "bloomEnabled", null), - h.c([Object(F.c)()], t.prototype, "depthOfFieldEnabled", null), - h.c([Object(F.c)()], t.prototype, "depthOfFieldBlurLevel", null), + h.c( + [Object(F.c)()], + t.prototype, + "depthOfFieldEnabled", + null + ), + h.c( + [Object(F.c)()], + t.prototype, + "depthOfFieldBlurLevel", + null + ), h.c([Object(F.c)()], t.prototype, "fxaaEnabled", null), h.c([Object(F.c)()], t.prototype, "samples", null), - h.c([Object(F.c)()], t.prototype, "imageProcessingEnabled", null), + h.c( + [Object(F.c)()], + t.prototype, + "imageProcessingEnabled", + null + ), h.c([Object(F.c)()], t.prototype, "glowLayerEnabled", null), - h.c([Object(F.c)()], t.prototype, "chromaticAberrationEnabled", null), + h.c( + [Object(F.c)()], + t.prototype, + "chromaticAberrationEnabled", + null + ), h.c([Object(F.c)()], t.prototype, "grainEnabled", null), t - }(Ts); - s.a.RegisteredTypes["BABYLON.DefaultRenderingPipeline"] = Ss; - Ht.a.ShadersStore.lensHighlightsPixelShader = "\nuniform sampler2D textureSampler;\n\nuniform float gain;\nuniform float threshold;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\n\nvec4 highlightColor(vec4 color) {\nvec4 highlight=color;\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\nfloat lum_threshold;\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\nhighlight*=luminance*gain;\nhighlight.a=1.0;\nreturn highlight;\n}\nvoid main(void)\n{\nvec4 original=texture2D(textureSampler,vUV);\n\nif (gain == -1.0) {\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nreturn;\n}\nfloat w=2.0/screen_width;\nfloat h=2.0/screen_height;\nfloat weight=1.0;\n\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;\ngl_FragColor=blurred;\n\n}"; - Ht.a.ShadersStore.depthOfFieldPixelShader = "\n\n\n\n\nuniform sampler2D textureSampler;\nuniform sampler2D highlightsSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D grainSampler;\n\nuniform float grain_amount;\nuniform bool blur_noise;\nuniform float screen_width;\nuniform float screen_height;\nuniform float distortion;\nuniform bool dof_enabled;\n\nuniform float screen_distance;\nuniform float aperture;\nuniform float darken;\nuniform float edge_blur;\nuniform bool highlights;\n\nuniform float near;\nuniform float far;\n\nvarying vec2 vUV;\n\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1\n\nvec2 centered_screen_pos;\nvec2 distorted_coords;\nfloat radius2;\nfloat radius;\n\nvec2 rand(vec2 co)\n{\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\n}\n\nvec2 getDistortedCoords(vec2 coords) {\nif (distortion == 0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);\nvec2 dist_coords=vec2(0.5,0.5);\ndist_coords.x=0.5+direction.x*radius2*1.0;\ndist_coords.y=0.5+direction.y*radius2*1.0;\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\ndist_coords=mix(coords,dist_coords,dist_amount);\nreturn dist_coords;\n}\n\nfloat sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {\n\nvec2 coords=distorted_coords;\nfloat angle=rand(coords*100.0).x*TWOPI;\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\ncolor+=texture2D(textureSampler,coords)*weight;\nreturn weight;\n}\n\nfloat getBlurLevel(float size) {\nreturn min(3.0,ceil(size/1.0));\n}\n\nvec4 getBlurColor(float size) {\nvec4 col=texture2D(textureSampler,distorted_coords);\nif (size == 0.0) { return col; }\n\n\nfloat blur_level=getBlurLevel(size);\nfloat w=(size/screen_width);\nfloat h=(size/screen_height);\nfloat total_weight=1.0;\nvec2 sample_coords;\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\nif (blur_level>1.0) {\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\n}\nif (blur_level>2.0) {\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\n}\ncol/=total_weight;\n\nif (darken>0.0) {\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\n}\n\n\n\n\nreturn col;\n}\nvoid main(void)\n{\n\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\nradius=sqrt(radius2);\ndistorted_coords=getDistortedCoords(vUV);\nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height);\nfloat depth=texture2D(depthSampler,distorted_coords).r;\nfloat distance=near+(far-near)*depth;\nvec4 color=texture2D(textureSampler,vUV);\n\n\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\n\nif (dof_enabled == false || coc<0.07) { coc=0.0; }\n\nfloat edge_blur_amount=0.0;\nif (edge_blur>0.0) {\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\n}\n\nfloat blur_amount=max(edge_blur_amount,coc);\n\nif (blur_amount == 0.0) {\ngl_FragColor=texture2D(textureSampler,distorted_coords);\n}\nelse {\n\ngl_FragColor=getBlurColor(blur_amount*1.7);\n\nif (highlights) {\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\n}\nif (blur_noise) {\n\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\n}\n}\n\nif (grain_amount>0.0) {\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\n}\n}\n"; - var Cs = function(e) { - function t(t, i, n, r, o) { - void 0 === r && (r = 1); - var a = e.call(this, n.getEngine(), t) || this; - return a.LensChromaticAberrationEffect = "LensChromaticAberrationEffect", - a.HighlightsEnhancingEffect = "HighlightsEnhancingEffect", - a.LensDepthOfFieldEffect = "LensDepthOfFieldEffect", - a._pentagonBokehIsEnabled = false, - a._scene = n, - a._depthTexture = n.enableDepthRenderer().getDepthMap(), - i.grain_texture ? a._grainTexture = i.grain_texture : a._createGrainTexture(), - a._edgeBlur = i.edge_blur ? i.edge_blur : 0, - a._grainAmount = i.grain_amount ? i.grain_amount : 0, - a._chromaticAberration = i.chromatic_aberration ? i.chromatic_aberration : 0, - a._distortion = i.distortion ? i.distortion : 0, - a._highlightsGain = void 0 !== i.dof_gain ? i.dof_gain : -1, - a._highlightsThreshold = i.dof_threshold ? i.dof_threshold : 1, - a._dofDistance = void 0 !== i.dof_focus_distance ? i.dof_focus_distance : -1, - a._dofAperture = i.dof_aperture ? i.dof_aperture : 1, - a._dofDarken = i.dof_darken ? i.dof_darken : 0, - a._dofPentagon = void 0 === i.dof_pentagon || i.dof_pentagon, - a._blurNoise = void 0 === i.blur_noise || i.blur_noise, - a._createChromaticAberrationPostProcess(r), - a._createHighlightsPostProcess(r), - a._createDepthOfFieldPostProcess(r / 4), - a.addEffect(new $a(n.getEngine(),a.LensChromaticAberrationEffect,function() { - return a._chromaticAberrationPostProcess - } - ,true)), - a.addEffect(new $a(n.getEngine(),a.HighlightsEnhancingEffect,function() { - return a._highlightsPostProcess - } - ,true)), - a.addEffect(new $a(n.getEngine(),a.LensDepthOfFieldEffect,function() { - return a._depthOfFieldPostProcess - } - ,true)), - -1 === a._highlightsGain && a._disableEffect(a.HighlightsEnhancingEffect, null), - n.postProcessRenderPipelineManager.addPipeline(a), - o && n.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(t, o), - a - } - return h.d(t, e), - t.prototype.getClassName = function() { - return "LensRenderingPipeline" - } - , - Object.defineProperty(t.prototype, "scene", { - get: function() { - return this._scene + ); + })(Ts); + s.a.RegisteredTypes["BABYLON.DefaultRenderingPipeline"] = Ss; + Ht.a.ShadersStore.lensHighlightsPixelShader = + "\nuniform sampler2D textureSampler;\n\nuniform float gain;\nuniform float threshold;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\n\nvec4 highlightColor(vec4 color) {\nvec4 highlight=color;\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\nfloat lum_threshold;\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\nhighlight*=luminance*gain;\nhighlight.a=1.0;\nreturn highlight;\n}\nvoid main(void)\n{\nvec4 original=texture2D(textureSampler,vUV);\n\nif (gain == -1.0) {\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nreturn;\n}\nfloat w=2.0/screen_width;\nfloat h=2.0/screen_height;\nfloat weight=1.0;\n\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;\ngl_FragColor=blurred;\n\n}"; + Ht.a.ShadersStore.depthOfFieldPixelShader = + "\n\n\n\n\nuniform sampler2D textureSampler;\nuniform sampler2D highlightsSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D grainSampler;\n\nuniform float grain_amount;\nuniform bool blur_noise;\nuniform float screen_width;\nuniform float screen_height;\nuniform float distortion;\nuniform bool dof_enabled;\n\nuniform float screen_distance;\nuniform float aperture;\nuniform float darken;\nuniform float edge_blur;\nuniform bool highlights;\n\nuniform float near;\nuniform float far;\n\nvarying vec2 vUV;\n\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1\n\nvec2 centered_screen_pos;\nvec2 distorted_coords;\nfloat radius2;\nfloat radius;\n\nvec2 rand(vec2 co)\n{\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\n}\n\nvec2 getDistortedCoords(vec2 coords) {\nif (distortion == 0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);\nvec2 dist_coords=vec2(0.5,0.5);\ndist_coords.x=0.5+direction.x*radius2*1.0;\ndist_coords.y=0.5+direction.y*radius2*1.0;\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\ndist_coords=mix(coords,dist_coords,dist_amount);\nreturn dist_coords;\n}\n\nfloat sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {\n\nvec2 coords=distorted_coords;\nfloat angle=rand(coords*100.0).x*TWOPI;\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\ncolor+=texture2D(textureSampler,coords)*weight;\nreturn weight;\n}\n\nfloat getBlurLevel(float size) {\nreturn min(3.0,ceil(size/1.0));\n}\n\nvec4 getBlurColor(float size) {\nvec4 col=texture2D(textureSampler,distorted_coords);\nif (size == 0.0) { return col; }\n\n\nfloat blur_level=getBlurLevel(size);\nfloat w=(size/screen_width);\nfloat h=(size/screen_height);\nfloat total_weight=1.0;\nvec2 sample_coords;\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\nif (blur_level>1.0) {\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\n}\nif (blur_level>2.0) {\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\n}\ncol/=total_weight;\n\nif (darken>0.0) {\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\n}\n\n\n\n\nreturn col;\n}\nvoid main(void)\n{\n\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\nradius=sqrt(radius2);\ndistorted_coords=getDistortedCoords(vUV);\nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height);\nfloat depth=texture2D(depthSampler,distorted_coords).r;\nfloat distance=near+(far-near)*depth;\nvec4 color=texture2D(textureSampler,vUV);\n\n\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\n\nif (dof_enabled == false || coc<0.07) { coc=0.0; }\n\nfloat edge_blur_amount=0.0;\nif (edge_blur>0.0) {\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\n}\n\nfloat blur_amount=max(edge_blur_amount,coc);\n\nif (blur_amount == 0.0) {\ngl_FragColor=texture2D(textureSampler,distorted_coords);\n}\nelse {\n\ngl_FragColor=getBlurColor(blur_amount*1.7);\n\nif (highlights) {\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\n}\nif (blur_noise) {\n\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\n}\n}\n\nif (grain_amount>0.0) {\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\n}\n}\n"; + var Cs = (function (e) { + function t(t, i, n, r, o) { + void 0 === r && (r = 1); + var a = e.call(this, n.getEngine(), t) || this; + return ( + (a.LensChromaticAberrationEffect = + "LensChromaticAberrationEffect"), + (a.HighlightsEnhancingEffect = "HighlightsEnhancingEffect"), + (a.LensDepthOfFieldEffect = "LensDepthOfFieldEffect"), + (a._pentagonBokehIsEnabled = false), + (a._scene = n), + (a._depthTexture = n.enableDepthRenderer().getDepthMap()), + i.grain_texture + ? (a._grainTexture = i.grain_texture) + : a._createGrainTexture(), + (a._edgeBlur = i.edge_blur ? i.edge_blur : 0), + (a._grainAmount = i.grain_amount ? i.grain_amount : 0), + (a._chromaticAberration = i.chromatic_aberration + ? i.chromatic_aberration + : 0), + (a._distortion = i.distortion ? i.distortion : 0), + (a._highlightsGain = + void 0 !== i.dof_gain ? i.dof_gain : -1), + (a._highlightsThreshold = i.dof_threshold + ? i.dof_threshold + : 1), + (a._dofDistance = + void 0 !== i.dof_focus_distance + ? i.dof_focus_distance + : -1), + (a._dofAperture = i.dof_aperture ? i.dof_aperture : 1), + (a._dofDarken = i.dof_darken ? i.dof_darken : 0), + (a._dofPentagon = + void 0 === i.dof_pentagon || i.dof_pentagon), + (a._blurNoise = void 0 === i.blur_noise || i.blur_noise), + a._createChromaticAberrationPostProcess(r), + a._createHighlightsPostProcess(r), + a._createDepthOfFieldPostProcess(r / 4), + a.addEffect( + new $a( + n.getEngine(), + a.LensChromaticAberrationEffect, + function () { + return a._chromaticAberrationPostProcess; }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "edgeBlur", { - get: function() { - return this._edgeBlur + true + ) + ), + a.addEffect( + new $a( + n.getEngine(), + a.HighlightsEnhancingEffect, + function () { + return a._highlightsPostProcess; }, - set: function(e) { - this.setEdgeBlur(e) + true + ) + ), + a.addEffect( + new $a( + n.getEngine(), + a.LensDepthOfFieldEffect, + function () { + return a._depthOfFieldPostProcess; }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "grainAmount", { - get: function() { - return this._grainAmount - }, - set: function(e) { - this.setGrainAmount(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "chromaticAberration", { - get: function() { - return this._chromaticAberration - }, - set: function(e) { - this.setChromaticAberration(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "dofAperture", { - get: function() { - return this._dofAperture - }, - set: function(e) { - this.setAperture(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "edgeDistortion", { - get: function() { - return this._distortion - }, - set: function(e) { - this.setEdgeDistortion(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "dofDistortion", { - get: function() { - return this._dofDistance - }, - set: function(e) { - this.setFocusDistance(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "darkenOutOfFocus", { - get: function() { - return this._dofDarken - }, - set: function(e) { - this.setDarkenOutOfFocus(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "blurNoise", { - get: function() { - return this._blurNoise - }, - set: function(e) { - this._blurNoise = e - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "pentagonBokeh", { - get: function() { - return this._pentagonBokehIsEnabled - }, - set: function(e) { - e ? this.enablePentagonBokeh() : this.disablePentagonBokeh() - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "highlightsGain", { - get: function() { - return this._highlightsGain - }, - set: function(e) { - this.setHighlightsGain(e) - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "highlightsThreshold", { - get: function() { - return this._highlightsThreshold - }, - set: function(e) { - this.setHighlightsThreshold(e) - }, - enumerable: true, - configurable: true - }), - t.prototype.setEdgeBlur = function(e) { - this._edgeBlur = e - } - , - t.prototype.disableEdgeBlur = function() { - this._edgeBlur = 0 - } - , - t.prototype.setGrainAmount = function(e) { - this._grainAmount = e - } - , - t.prototype.disableGrain = function() { - this._grainAmount = 0 - } - , - t.prototype.setChromaticAberration = function(e) { - this._chromaticAberration = e - } - , - t.prototype.disableChromaticAberration = function() { - this._chromaticAberration = 0 - } - , - t.prototype.setEdgeDistortion = function(e) { - this._distortion = e - } - , - t.prototype.disableEdgeDistortion = function() { - this._distortion = 0 - } - , - t.prototype.setFocusDistance = function(e) { - this._dofDistance = e - } - , - t.prototype.disableDepthOfField = function() { - this._dofDistance = -1 - } - , - t.prototype.setAperture = function(e) { - this._dofAperture = e - } - , - t.prototype.setDarkenOutOfFocus = function(e) { - this._dofDarken = e - } - , - t.prototype.enablePentagonBokeh = function() { - this._highlightsPostProcess.updateEffect("#define PENTAGON\n"), - this._pentagonBokehIsEnabled = true - } - , - t.prototype.disablePentagonBokeh = function() { - this._pentagonBokehIsEnabled = false, - this._highlightsPostProcess.updateEffect() - } - , - t.prototype.enableNoiseBlur = function() { - this._blurNoise = true - } - , - t.prototype.disableNoiseBlur = function() { - this._blurNoise = false - } - , - t.prototype.setHighlightsGain = function(e) { - this._highlightsGain = e - } - , - t.prototype.setHighlightsThreshold = function(e) { - -1 === this._highlightsGain && (this._highlightsGain = 1), - this._highlightsThreshold = e - } - , - t.prototype.disableHighlights = function() { - this._highlightsGain = -1 - } - , - t.prototype.dispose = function(e) { - void 0 === e && (e = false), - this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras), - this._chromaticAberrationPostProcess = null, - this._highlightsPostProcess = null, - this._depthOfFieldPostProcess = null, - this._grainTexture.dispose(), - e && this._scene.disableDepthRenderer() - } - , - t.prototype._createChromaticAberrationPostProcess = function(e) { - var t = this; - this._chromaticAberrationPostProcess = new Wt("LensChromaticAberration","chromaticAberration",["chromatic_aberration", "screen_width", "screen_height", "direction", "radialIntensity", "centerPosition"],[],e,null,je.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),false), - this._chromaticAberrationPostProcess.onApply = function(e) { - e.setFloat("chromatic_aberration", t._chromaticAberration), - e.setFloat("screen_width", t._scene.getEngine().getRenderWidth()), - e.setFloat("screen_height", t._scene.getEngine().getRenderHeight()), - e.setFloat("radialIntensity", 1), - e.setFloat2("direction", 17, 17), - e.setFloat2("centerPosition", .5, .5) - } - } - , - t.prototype._createHighlightsPostProcess = function(e) { - var t = this; - this._highlightsPostProcess = new Wt("LensHighlights","lensHighlights",["gain", "threshold", "screen_width", "screen_height"],[],e,null,je.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,this._dofPentagon ? "#define PENTAGON\n" : ""), - this._highlightsPostProcess.onApply = function(e) { - e.setFloat("gain", t._highlightsGain), - e.setFloat("threshold", t._highlightsThreshold), - e.setTextureFromPostProcess("textureSampler", t._chromaticAberrationPostProcess), - e.setFloat("screen_width", t._scene.getEngine().getRenderWidth()), - e.setFloat("screen_height", t._scene.getEngine().getRenderHeight()) - } - } - , - t.prototype._createDepthOfFieldPostProcess = function(e) { - var t = this; - this._depthOfFieldPostProcess = new Wt("LensDepthOfField","depthOfField",["grain_amount", "blur_noise", "screen_width", "screen_height", "distortion", "dof_enabled", "screen_distance", "aperture", "darken", "edge_blur", "highlights", "near", "far"],["depthSampler", "grainSampler", "highlightsSampler"],e,null,je.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),false), - this._depthOfFieldPostProcess.onApply = function(e) { - e.setTexture("depthSampler", t._depthTexture), - e.setTexture("grainSampler", t._grainTexture), - e.setTextureFromPostProcess("textureSampler", t._highlightsPostProcess), - e.setTextureFromPostProcess("highlightsSampler", t._depthOfFieldPostProcess), - e.setFloat("grain_amount", t._grainAmount), - e.setBool("blur_noise", t._blurNoise), - e.setFloat("screen_width", t._scene.getEngine().getRenderWidth()), - e.setFloat("screen_height", t._scene.getEngine().getRenderHeight()), - e.setFloat("distortion", t._distortion), - e.setBool("dof_enabled", -1 !== t._dofDistance), - e.setFloat("screen_distance", 1 / (.1 - 1 / t._dofDistance)), - e.setFloat("aperture", t._dofAperture), - e.setFloat("darken", t._dofDarken), - e.setFloat("edge_blur", t._edgeBlur), - e.setBool("highlights", -1 !== t._highlightsGain), - t._scene.activeCamera && (e.setFloat("near", t._scene.activeCamera.minZ), - e.setFloat("far", t._scene.activeCamera.maxZ)) - } - } - , - t.prototype._createGrainTexture = function() { - this._grainTexture = new Ei("LensNoiseTexture",512,this._scene,false,je.a.BILINEAR_SAMPLINGMODE), - this._grainTexture.wrapU = je.a.WRAP_ADDRESSMODE, - this._grainTexture.wrapV = je.a.WRAP_ADDRESSMODE; - for (var e, t = this._grainTexture.getContext(), i = 0; i < 512; i++) - for (var n = 0; n < 512; n++) - e = Math.floor(255 * (.42, - .58, - Math.random() * (.58 - .42) + .42)), - t.fillStyle = "rgb(" + e + ", " + e + ", " + e + ")", - t.fillRect(i, n, 1, 1); - this._grainTexture.update(false) - } - , - t - }(Ts); - Ht.a.ShadersStore.ssao2PixelShader = "\nprecision highp float;\nuniform sampler2D textureSampler;\nuniform float near;\nuniform float far;\nuniform float radius;\nfloat scales[16]=float[16](\n0.1,\n0.11406250000000001,\n0.131640625,\n0.15625,\n0.187890625,\n0.2265625,\n0.272265625,\n0.325,\n0.384765625,\n0.4515625,\n0.525390625,\n0.60625,\n0.694140625,\n0.7890625,\n0.891015625,\n1.0\n);\nvarying vec2 vUV;\nfloat perspectiveDepthToViewZ( const in float invClipZ,const in float near,const in float far ) {\nreturn ( near*far )/( ( far-near )*invClipZ-far );\n}\nfloat viewZToPerspectiveDepth( const in float viewZ,const in float near,const in float far ) {\nreturn ( near*far/viewZ+far)/( far-near );\n}\nfloat viewZToOrthographicDepth( const in float viewZ,const in float near,const in float far ) {\nreturn ( viewZ+near )/( near-far );\n}\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform sampler2D normalSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float base;\nuniform float xViewport;\nuniform float yViewport;\nuniform float maxZ;\nuniform float minZAspect;\nuniform vec2 texelSize;\nuniform mat4 projection;\nvoid main()\n{\nvec3 random=texture2D(randomSampler,vUV*randTextureTiles).rgb;\nfloat depth=texture2D(textureSampler,vUV).r;\nfloat depthSign=depth/abs(depth);\ndepth=depth*depthSign;\nvec3 normal=texture2D(normalSampler,vUV).rgb;\nfloat occlusion=0.0;\nfloat correctedRadius=min(radius,minZAspect*depth/near);\nvec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);\nvec3 origin=vViewRay*depth;\nvec3 rvec=random*2.0-1.0;\nrvec.z=0.0;\n\nfloat dotProduct=dot(rvec,normal);\nrvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\nvec3 bitangent=cross(normal,tangent);\nmat3 tbn=mat3(tangent,bitangent,normal);\nfloat difference;\nfor (int i=0; i1.0 || offset.y>1.0) {\ncontinue;\n}\n\nfloat sampleDepth=abs(texture2D(textureSampler,offset.xy).r);\n\ndifference=depthSign*samplePosition.z-sampleDepth;\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\nocclusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;\n}\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor=vec4(vec3(result),1.0);\n}\n#endif\n#ifdef BILATERAL_BLUR\nuniform sampler2D depthSampler;\nuniform float outSize;\nuniform float samplerOffsets[SAMPLES];\nvec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.3846153846)*direction;\nvec2 off2=vec2(3.2307692308)*direction;\ncolor+=texture2D(image,uv)*0.2270270270;\ncolor+=texture2D(image,uv+(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv-(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv+(off2/resolution))*0.0702702703;\ncolor+=texture2D(image,uv-(off2/resolution))*0.0702702703;\nreturn color;\n}\nvec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\ncolor+=texture2D(image,uv)*0.1964825501511404;\ncolor+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;\ncolor+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;\nreturn color;\n}\nvec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\nfloat compareDepth=abs(texture2D(depthSampler,uv).r);\nfloat sampleDepth;\nfloat weight;\nfloat weightSum=30.0;\ncolor+=texture2D(image,uv)*30.0;\nsampleDepth=abs(texture2D(depthSampler,uv+(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv+(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv+(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off3/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off3/resolution))*weight;\nreturn color/weightSum;\n}\nvoid main()\n{\n#if EXPENSIVE\nfloat compareDepth=abs(texture2D(depthSampler,vUV).r);\nfloat texelsize=1.0/outSize;\nfloat result=0.0;\nfloat weightSum=0.0;\nfor (int i=0; i1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\nvec3 bitangent=cross(normal,tangent);\nmat3 tbn=mat3(tangent,bitangent,normal);\nfloat difference;\nfor (int i=0; i1.0 || offset.y>1.0) {\ncontinue;\n}\n\nfloat sampleDepth=abs(texture2D(textureSampler,offset.xy).r);\n\ndifference=depthSign*samplePosition.z-sampleDepth;\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\nocclusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;\n}\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor=vec4(vec3(result),1.0);\n}\n#endif\n#ifdef BILATERAL_BLUR\nuniform sampler2D depthSampler;\nuniform float outSize;\nuniform float samplerOffsets[SAMPLES];\nvec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.3846153846)*direction;\nvec2 off2=vec2(3.2307692308)*direction;\ncolor+=texture2D(image,uv)*0.2270270270;\ncolor+=texture2D(image,uv+(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv-(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv+(off2/resolution))*0.0702702703;\ncolor+=texture2D(image,uv-(off2/resolution))*0.0702702703;\nreturn color;\n}\nvec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\ncolor+=texture2D(image,uv)*0.1964825501511404;\ncolor+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;\ncolor+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;\nreturn color;\n}\nvec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\nfloat compareDepth=abs(texture2D(depthSampler,uv).r);\nfloat sampleDepth;\nfloat weight;\nfloat weightSum=30.0;\ncolor+=texture2D(image,uv)*30.0;\nsampleDepth=abs(texture2D(depthSampler,uv+(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv+(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv+(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off3/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off3/resolution))*weight;\nreturn color/weightSum;\n}\nvoid main()\n{\n#if EXPENSIVE\nfloat compareDepth=abs(texture2D(depthSampler,vUV).r);\nfloat texelsize=1.0/outSize;\nfloat result=0.0;\nfloat weightSum=0.0;\nfor (int i=0; i 0 + ? i._ssaoCombinePostProcess.width + : i._originalColorPostProcess.width + ), + e.setFloat("near", i._scene.activeCamera.minZ), + e.setFloat("far", i._scene.activeCamera.maxZ), + e.setFloat("radius", i.radius), + e.setTexture("depthSampler", i._depthTexture), + i._firstUpdate && + e.setArray("samplerOffsets", i._samplerOffsets)); + }), + (this._blurVPostProcess = new Wt( + "BlurV", + "ssao2", + ["outSize", "samplerOffsets", "near", "far", "radius"], + ["depthSampler"], + t, + null, + je.a.TRILINEAR_SAMPLINGMODE, + this._scene.getEngine(), + false, + "#define BILATERAL_BLUR\n#define BILATERAL_BLUR_V\n#define SAMPLES 16\n#define EXPENSIVE " + + (n ? "1" : "0") + + "\n" + )), + (this._blurVPostProcess.onApply = function (e) { + i._scene.activeCamera && + (e.setFloat( + "outSize", + i._ssaoCombinePostProcess.height > 0 + ? i._ssaoCombinePostProcess.height + : i._originalColorPostProcess.height + ), + e.setFloat("near", i._scene.activeCamera.minZ), + e.setFloat("far", i._scene.activeCamera.maxZ), + e.setFloat("radius", i.radius), + e.setTexture("depthSampler", i._depthTexture), + i._firstUpdate && + (e.setArray("samplerOffsets", i._samplerOffsets), + (i._firstUpdate = false))); + }), + (this._blurHPostProcess.samples = this.textureSamples), + (this._blurVPostProcess.samples = this.textureSamples); + }), + (t.prototype._rebuild = function () { + (this._firstUpdate = true), e.prototype._rebuild.call(this); + }), + (t.prototype._radicalInverse_VdC = function (e) { + return ( + (this._bits[0] = e), + (this._bits[0] = + ((this._bits[0] << 16) | (this._bits[0] >> 16)) >>> 0), + (this._bits[0] = + ((1431655765 & this._bits[0]) << 1) | + (((2863311530 & this._bits[0]) >>> 1) >>> 0)), + (this._bits[0] = + ((858993459 & this._bits[0]) << 2) | + (((3435973836 & this._bits[0]) >>> 2) >>> 0)), + (this._bits[0] = + ((252645135 & this._bits[0]) << 4) | + (((4042322160 & this._bits[0]) >>> 4) >>> 0)), + (this._bits[0] = + ((16711935 & this._bits[0]) << 8) | + (((4278255360 & this._bits[0]) >>> 8) >>> 0)), + 2.3283064365386963e-10 * this._bits[0] + ); + }), + (t.prototype._hammersley = function (e, t) { + return [e / t, this._radicalInverse_VdC(e)]; + }), + (t.prototype._hemisphereSample_uniform = function (e, t) { + var i = 2 * t * Math.PI, + n = 1 - (0.85 * e + 0.15), + r = Math.sqrt(1 - n * n); + return new a.x(Math.cos(i) * r, Math.sin(i) * r, n); + }), + (t.prototype._generateHemisphere = function () { + for (var e, t = this.samples, i = [], n = 0; n < t; ) { + if (t < 16) + e = this._hemisphereSample_uniform( + Math.random(), + Math.random() + ); + else { + var r = this._hammersley(n, t); + e = this._hemisphereSample_uniform(r[0], r[1]); + } + i.push(e.x, e.y, e.z), n++; } - , - t.prototype._createBlurPostProcess = function(e, t) { - var i = this; - this._samplerOffsets = []; - for (var n = this.expensiveBlur, r = -8; r < 8; r++) - this._samplerOffsets.push(2 * r + .5); - this._blurHPostProcess = new Wt("BlurH","ssao2",["outSize", "samplerOffsets", "near", "far", "radius"],["depthSampler"],e,null,je.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,"#define BILATERAL_BLUR\n#define BILATERAL_BLUR_H\n#define SAMPLES 16\n#define EXPENSIVE " + (n ? "1" : "0") + "\n"), - this._blurHPostProcess.onApply = function(e) { - i._scene.activeCamera && (e.setFloat("outSize", i._ssaoCombinePostProcess.width > 0 ? i._ssaoCombinePostProcess.width : i._originalColorPostProcess.width), - e.setFloat("near", i._scene.activeCamera.minZ), - e.setFloat("far", i._scene.activeCamera.maxZ), - e.setFloat("radius", i.radius), - e.setTexture("depthSampler", i._depthTexture), - i._firstUpdate && e.setArray("samplerOffsets", i._samplerOffsets)) - } - , - this._blurVPostProcess = new Wt("BlurV","ssao2",["outSize", "samplerOffsets", "near", "far", "radius"],["depthSampler"],t,null,je.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,"#define BILATERAL_BLUR\n#define BILATERAL_BLUR_V\n#define SAMPLES 16\n#define EXPENSIVE " + (n ? "1" : "0") + "\n"), - this._blurVPostProcess.onApply = function(e) { - i._scene.activeCamera && (e.setFloat("outSize", i._ssaoCombinePostProcess.height > 0 ? i._ssaoCombinePostProcess.height : i._originalColorPostProcess.height), - e.setFloat("near", i._scene.activeCamera.minZ), - e.setFloat("far", i._scene.activeCamera.maxZ), - e.setFloat("radius", i.radius), - e.setTexture("depthSampler", i._depthTexture), - i._firstUpdate && (e.setArray("samplerOffsets", i._samplerOffsets), - i._firstUpdate = false)) - } - , - this._blurHPostProcess.samples = this.textureSamples, - this._blurVPostProcess.samples = this.textureSamples - } - , - t.prototype._rebuild = function() { - this._firstUpdate = true, - e.prototype._rebuild.call(this) - } - , - t.prototype._radicalInverse_VdC = function(e) { - return this._bits[0] = e, - this._bits[0] = (this._bits[0] << 16 | this._bits[0] >> 16) >>> 0, - this._bits[0] = (1431655765 & this._bits[0]) << 1 | (2863311530 & this._bits[0]) >>> 1 >>> 0, - this._bits[0] = (858993459 & this._bits[0]) << 2 | (3435973836 & this._bits[0]) >>> 2 >>> 0, - this._bits[0] = (252645135 & this._bits[0]) << 4 | (4042322160 & this._bits[0]) >>> 4 >>> 0, - this._bits[0] = (16711935 & this._bits[0]) << 8 | (4278255360 & this._bits[0]) >>> 8 >>> 0, - 2.3283064365386963e-10 * this._bits[0] - } - , - t.prototype._hammersley = function(e, t) { - return [e / t, this._radicalInverse_VdC(e)] - } - , - t.prototype._hemisphereSample_uniform = function(e, t) { - var i = 2 * t * Math.PI - , n = 1 - (.85 * e + .15) - , r = Math.sqrt(1 - n * n); - return new a.x(Math.cos(i) * r,Math.sin(i) * r,n) - } - , - t.prototype._generateHemisphere = function() { - for (var e, t = this.samples, i = [], n = 0; n < t; ) { - if (t < 16) - e = this._hemisphereSample_uniform(Math.random(), Math.random()); - else { - var r = this._hammersley(n, t); - e = this._hemisphereSample_uniform(r[0], r[1]) - } - i.push(e.x, e.y, e.z), - n++ - } - return i - } - , - t.prototype._createSSAOPostProcess = function(e) { - var t = this - , i = this.samples; - this._sampleSphere = this._generateHemisphere(), - this._ssaoPostProcess = new Wt("ssao2","ssao2",["sampleSphere", "samplesFactor", "randTextureTiles", "totalStrength", "radius", "base", "range", "projection", "near", "far", "texelSize", "xViewport", "yViewport", "maxZ", "minZAspect"],["randomSampler", "normalSampler"],e,null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),false,"#define SAMPLES " + i + "\n#define SSAO"), - this._ssaoPostProcess.onApply = function(e) { - t._firstUpdate && (e.setArray3("sampleSphere", t._sampleSphere), - e.setFloat("randTextureTiles", 32)), - t._scene.activeCamera && (e.setFloat("samplesFactor", 1 / t.samples), + return i; + }), + (t.prototype._createSSAOPostProcess = function (e) { + var t = this, + i = this.samples; + (this._sampleSphere = this._generateHemisphere()), + (this._ssaoPostProcess = new Wt( + "ssao2", + "ssao2", + [ + "sampleSphere", + "samplesFactor", + "randTextureTiles", + "totalStrength", + "radius", + "base", + "range", + "projection", + "near", + "far", + "texelSize", + "xViewport", + "yViewport", + "maxZ", + "minZAspect", + ], + ["randomSampler", "normalSampler"], + e, + null, + je.a.BILINEAR_SAMPLINGMODE, + this._scene.getEngine(), + false, + "#define SAMPLES " + i + "\n#define SSAO" + )), + (this._ssaoPostProcess.onApply = function (e) { + t._firstUpdate && + (e.setArray3("sampleSphere", t._sampleSphere), + e.setFloat("randTextureTiles", 32)), + t._scene.activeCamera && + (e.setFloat("samplesFactor", 1 / t.samples), e.setFloat("totalStrength", t.totalStrength), - e.setFloat2("texelSize", 1 / t._ssaoPostProcess.width, 1 / t._ssaoPostProcess.height), + e.setFloat2( + "texelSize", + 1 / t._ssaoPostProcess.width, + 1 / t._ssaoPostProcess.height + ), e.setFloat("radius", t.radius), e.setFloat("maxZ", t.maxZ), e.setFloat("minZAspect", t.minZAspect), e.setFloat("base", t.base), e.setFloat("near", t._scene.activeCamera.minZ), e.setFloat("far", t._scene.activeCamera.maxZ), - e.setFloat("xViewport", Math.tan(t._scene.activeCamera.fov / 2) * t._scene.getEngine().getAspectRatio(t._scene.activeCamera, true)), - e.setFloat("yViewport", Math.tan(t._scene.activeCamera.fov / 2)), - e.setMatrix("projection", t._scene.getProjectionMatrix()), + e.setFloat( + "xViewport", + Math.tan(t._scene.activeCamera.fov / 2) * + t._scene + .getEngine() + .getAspectRatio(t._scene.activeCamera, true) + ), + e.setFloat( + "yViewport", + Math.tan(t._scene.activeCamera.fov / 2) + ), + e.setMatrix( + "projection", + t._scene.getProjectionMatrix() + ), e.setTexture("textureSampler", t._depthTexture), e.setTexture("normalSampler", t._normalTexture), - e.setTexture("randomSampler", t._randomTexture)) - } - , - this._ssaoPostProcess.samples = this.textureSamples - } - , - t.prototype._createSSAOCombinePostProcess = function(e) { - var t = this; - this._ssaoCombinePostProcess = new Wt("ssaoCombine","ssaoCombine",[],["originalColor", "viewport"],e,null,je.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),false), - this._ssaoCombinePostProcess.onApply = function(e) { - var i = t._scene.activeCamera.viewport; - e.setVector4("viewport", a.t.Vector4[0].copyFromFloats(i.x, i.y, i.width, i.height)), - e.setTextureFromPostProcess("originalColor", t._originalColorPostProcess) - } - , - this._ssaoCombinePostProcess.samples = this.textureSamples - } - , - t.prototype._createRandomTexture = function() { - this._randomTexture = new Ei("SSAORandomTexture",128,this._scene,false,je.a.TRILINEAR_SAMPLINGMODE), - this._randomTexture.wrapU = je.a.WRAP_ADDRESSMODE, - this._randomTexture.wrapV = je.a.WRAP_ADDRESSMODE; - for (var e = this._randomTexture.getContext(), t = function(e, t) { - return Math.random() * (t - e) + e - }, i = a.x.Zero(), n = 0; n < 128; n++) - for (var r = 0; r < 128; r++) - i.x = t(0, 1), - i.y = t(0, 1), - i.z = 0, - i.normalize(), - i.scaleInPlace(255), - i.x = Math.floor(i.x), - i.y = Math.floor(i.y), - e.fillStyle = "rgb(" + i.x + ", " + i.y + ", " + i.z + ")", - e.fillRect(n, r, 1, 1); - this._randomTexture.update(false) - } - , - t.prototype.serialize = function() { - var e = F.a.Serialize(this); - return e.customType = "SSAO2RenderingPipeline", - e - } - , - t.Parse = function(e, i, n) { - return F.a.Parse(function() { - return new t(e._name,i,e._ratio) - }, e, i, n) - } - , - h.c([Object(F.c)()], t.prototype, "totalStrength", void 0), - h.c([Object(F.c)()], t.prototype, "maxZ", void 0), - h.c([Object(F.c)()], t.prototype, "minZAspect", void 0), - h.c([Object(F.c)("samples")], t.prototype, "_samples", void 0), - h.c([Object(F.c)("textureSamples")], t.prototype, "_textureSamples", void 0), - h.c([Object(F.c)()], t.prototype, "_ratio", void 0), - h.c([Object(F.c)("expensiveBlur")], t.prototype, "_expensiveBlur", void 0), - h.c([Object(F.c)()], t.prototype, "radius", void 0), - h.c([Object(F.c)()], t.prototype, "base", void 0), - t - }(Ts); - s.a.RegisteredTypes["BABYLON.SSAO2RenderingPipeline"] = Ps; - Ht.a.ShadersStore.ssaoPixelShader = "\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float radius;\nuniform float area;\nuniform float fallOff;\nuniform float base;\nvec3 normalFromDepth(float depth,vec2 coords)\n{\nvec2 offset1=vec2(0.0,radius);\nvec2 offset2=vec2(radius,0.0);\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\nvec3 p1=vec3(offset1,depth1-depth);\nvec3 p2=vec3(offset2,depth2-depth);\nvec3 normal=cross(p1,p2);\nnormal.z=-normal.z;\nreturn normalize(normal);\n}\nvoid main()\n{\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\nfloat depth=texture2D(textureSampler,vUV).r;\nvec3 position=vec3(vUV,depth);\nvec3 normal=normalFromDepth(depth,vUV);\nfloat radiusDepth=radius/depth;\nfloat occlusion=0.0;\nvec3 ray;\nvec3 hemiRay;\nfloat occlusionDepth;\nfloat difference;\nfor (int i=0; ishadowPixelDepth)\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));\ncurrentPosition+=stepL;\n}\naccumFog/=NB_STEPS;\nvec3 color=accumFog*scatteringPower;\ngl_FragColor=vec4(color*exp(color) ,1.0);\n}\n#endif\n#if defined(VLSMERGE)\nuniform sampler2D originalSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);\n}\n#endif\n#if defined(LUMINANCE)\nuniform vec2 lumOffsets[4];\nvoid main()\n{\nfloat average=0.0;\nvec4 color=vec4(0.0);\nfloat maximum=-1e20;\nvec3 weight=vec3(0.299,0.587,0.114);\nfor (int i=0; i<4; i++)\n{\ncolor=texture2D(textureSampler,vUV+ lumOffsets[i]);\n\nfloat GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\n\n#ifdef WEIGHTED_AVERAGE\nfloat GreyValue=dot(color.rgb,weight);\n#endif\n#ifdef BRIGHTNESS\nfloat GreyValue=max(color.r,max(color.g,color.b));\n#endif\n#ifdef HSL_COMPONENT\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\n#endif\n#ifdef MAGNITUDE\nfloat GreyValue=length(color.rgb);\n#endif\nmaximum=max(maximum,GreyValue);\naverage+=(0.25*log(1e-5+GreyValue));\n}\naverage=exp(average);\ngl_FragColor=vec4(average,maximum,0.0,1.0);\n}\n#endif\n#if defined(LUMINANCE_DOWN_SAMPLE)\nuniform vec2 dsOffsets[9];\nuniform float halfDestPixelSize;\n#ifdef FINAL_DOWN_SAMPLER\nvec4 pack(float value) {\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(value*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n#endif\nvoid main()\n{\nvec4 color=vec4(0.0);\nfloat average=0.0;\nfor (int i=0; i<9; i++)\n{\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\naverage+=color.r;\n}\naverage/=9.0;\n#ifdef FINAL_DOWN_SAMPLER\ngl_FragColor=pack(average);\n#else\ngl_FragColor=vec4(average,average,0.0,1.0);\n#endif\n}\n#endif\n#if defined(HDR)\nuniform sampler2D textureAdderSampler;\nuniform float averageLuminance;\nvoid main()\n{\nvec4 color=texture2D(textureAdderSampler,vUV);\n#ifndef AUTO_EXPOSURE\nvec4 adjustedColor=color/averageLuminance;\ncolor=adjustedColor;\ncolor.a=1.0;\n#endif\ngl_FragColor=color;\n}\n#endif\n#if defined(LENS_FLARE)\n#define GHOSTS 3\nuniform sampler2D lensColorSampler;\nuniform float strength;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform vec2 resolution;\nuniform float distortionStrength;\nfloat hash(vec2 p)\n{\nfloat h=dot(p,vec2(127.1,311.7));\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\n}\nfloat noise(in vec2 p)\n{\nvec2 i=floor(p);\nvec2 f=fract(p);\nvec2 u=f*f*(3.0-2.0*f);\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\nhash(i+vec2(1.0,0.0)),u.x),\nmix(hash(i+vec2(0.0,1.0)),\nhash(i+vec2(1.0,1.0)),u.x),u.y);\n}\nfloat fbm(vec2 p)\n{\nfloat f=0.0;\nf+=0.5000*noise(p); p*=2.02;\nf+=0.2500*noise(p); p*=2.03;\nf+=0.1250*noise(p); p*=2.01;\nf+=0.0625*noise(p); p*=2.04;\nf/=0.9375;\nreturn f;\n}\nvec3 pattern(vec2 uv)\n{\nvec2 p=-1.0+2.0*uv;\nfloat p2=dot(p,p);\nfloat f=fbm(vec2(15.0*p2))/2.0;\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\nreturn (1.0-f)*vec3(r,g,b);\n}\nfloat luminance(vec3 color)\n{\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\n}\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\n{\nreturn vec4(\ntexture2D(tex,texcoord+direction*distortion.r).r,\ntexture2D(tex,texcoord+direction*distortion.g).g,\ntexture2D(tex,texcoord+direction*distortion.b).b,\n1.0\n);\n}\nvoid main(void)\n{\nvec2 uv=-vUV+vec2(1.0);\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\nvec2 texelSize=1.0/resolution;\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\nvec4 result=vec4(0.0);\nfloat ghostIndice=1.0;\nfor (int i=0; i=nSamples)\nbreak;\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\nresult+=texture2D(textureSampler,offset1);\n}\ngl_FragColor=result/float(nSamples);\n}\n#endif\n"; + var Ms = (function (e) { + function t(t, i, n, r, o) { + void 0 === r && (r = null); + var a = e.call(this, i.getEngine(), t) || this; + return ( + (a.downSampleX4PostProcess = null), + (a.brightPassPostProcess = null), + (a.blurHPostProcesses = []), + (a.blurVPostProcesses = []), + (a.textureAdderPostProcess = null), + (a.volumetricLightPostProcess = null), + (a.volumetricLightSmoothXPostProcess = null), + (a.volumetricLightSmoothYPostProcess = null), + (a.volumetricLightMergePostProces = null), + (a.volumetricLightFinalPostProcess = null), + (a.luminancePostProcess = null), + (a.luminanceDownSamplePostProcesses = []), + (a.hdrPostProcess = null), + (a.textureAdderFinalPostProcess = null), + (a.lensFlareFinalPostProcess = null), + (a.hdrFinalPostProcess = null), + (a.lensFlarePostProcess = null), + (a.lensFlareComposePostProcess = null), + (a.motionBlurPostProcess = null), + (a.depthOfFieldPostProcess = null), + (a.fxaaPostProcess = null), + (a.brightThreshold = 1), + (a.blurWidth = 512), + (a.horizontalBlur = false), + (a.lensTexture = null), + (a.volumetricLightCoefficient = 0.2), + (a.volumetricLightPower = 4), + (a.volumetricLightBlurScale = 64), + (a.sourceLight = null), + (a.hdrMinimumLuminance = 1), + (a.hdrDecreaseRate = 0.5), + (a.hdrIncreaseRate = 0.5), + (a.lensColorTexture = null), + (a.lensFlareStrength = 20), + (a.lensFlareGhostDispersal = 1.4), + (a.lensFlareHaloWidth = 0.7), + (a.lensFlareDistortionStrength = 16), + (a.lensStarTexture = null), + (a.lensFlareDirtTexture = null), + (a.depthOfFieldDistance = 10), + (a.depthOfFieldBlurWidth = 64), + (a.motionStrength = 1), + (a.animations = []), + (a._currentDepthOfFieldSource = null), + (a._fixedExposure = 1), + (a._currentExposure = 1), + (a._hdrAutoExposure = false), + (a._hdrCurrentLuminance = 1), + (a._bloomEnabled = false), + (a._depthOfFieldEnabled = false), + (a._vlsEnabled = false), + (a._lensFlareEnabled = false), + (a._hdrEnabled = false), + (a._motionBlurEnabled = false), + (a._fxaaEnabled = false), + (a._motionBlurSamples = 64), + (a._volumetricLightStepsCount = 50), + (a._samples = 1), + (a._cameras = o || []), + (a._scene = i), + (a._basePostProcess = r), + (a._ratio = n), + (a._floatTextureType = i.getEngine().getCaps() + .textureFloatRender + ? _.a.TEXTURETYPE_FLOAT + : _.a.TEXTURETYPE_HALF_FLOAT), + i.postProcessRenderPipelineManager.addPipeline(a), + a._buildPipeline(), + a + ); + } + return ( + h.d(t, e), + Object.defineProperty(t.prototype, "exposure", { + get: function () { + return this._fixedExposure; + }, + set: function (e) { + (this._fixedExposure = e), (this._currentExposure = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "hdrAutoExposure", { + get: function () { + return this._hdrAutoExposure; + }, + set: function (e) { + if (((this._hdrAutoExposure = e), this.hdrPostProcess)) { + var t = ["#define HDR"]; + e && t.push("#define AUTO_EXPOSURE"), + this.hdrPostProcess.updateEffect(t.join("\n")); + } + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "BloomEnabled", { + get: function () { + return this._bloomEnabled; + }, + set: function (e) { + this._bloomEnabled !== e && + ((this._bloomEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "DepthOfFieldEnabled", { + get: function () { + return this._depthOfFieldEnabled; + }, + set: function (e) { + this._depthOfFieldEnabled !== e && + ((this._depthOfFieldEnabled = e), + this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "LensFlareEnabled", { + get: function () { + return this._lensFlareEnabled; + }, + set: function (e) { + this._lensFlareEnabled !== e && + ((this._lensFlareEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "HDREnabled", { + get: function () { + return this._hdrEnabled; + }, + set: function (e) { + this._hdrEnabled !== e && + ((this._hdrEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "VLSEnabled", { + get: function () { + return this._vlsEnabled; + }, + set: function (e) { + if (this._vlsEnabled !== e) { + if (e && !this._scene.enableGeometryBufferRenderer()) + return void g.a.Warn( + "Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline" + ); + (this._vlsEnabled = e), this._buildPipeline(); + } + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "MotionBlurEnabled", { + get: function () { + return this._motionBlurEnabled; + }, + set: function (e) { + this._motionBlurEnabled !== e && + ((this._motionBlurEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "fxaaEnabled", { + get: function () { + return this._fxaaEnabled; + }, + set: function (e) { + this._fxaaEnabled !== e && + ((this._fxaaEnabled = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + t.prototype, + "volumetricLightStepsCount", + { + get: function () { + return this._volumetricLightStepsCount; + }, + set: function (e) { + this.volumetricLightPostProcess && + this.volumetricLightPostProcess.updateEffect( + "#define VLS\n#define NB_STEPS " + e.toFixed(1) + ), + (this._volumetricLightStepsCount = e); + }, + enumerable: true, + configurable: true, + } + ), + Object.defineProperty(t.prototype, "motionBlurSamples", { + get: function () { + return this._motionBlurSamples; + }, + set: function (e) { + this.motionBlurPostProcess && + this.motionBlurPostProcess.updateEffect( + "#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES " + + e.toFixed(1) + ), + (this._motionBlurSamples = e); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "samples", { + get: function () { + return this._samples; + }, + set: function (e) { + this._samples !== e && + ((this._samples = e), this._buildPipeline()); + }, + enumerable: true, + configurable: true, + }), + (t.prototype._buildPipeline = function () { + var e = this, + t = this._ratio, + i = this._scene; + this._disposePostProcesses(), + this._reset(), + this._basePostProcess + ? (this.originalPostProcess = this._basePostProcess) + : ((this.originalPostProcess = new Wt( + "HDRPass", + "standard", + [], + [], + t, + null, + _.a.TEXTURE_BILINEAR_SAMPLINGMODE, + i.getEngine(), + false, + "#define PASS_POST_PROCESS", + this._floatTextureType + )), + (this.originalPostProcess.onApply = function () { + e._currentDepthOfFieldSource = + e.originalPostProcess; + })), + (this._bloomEnabled || + this._vlsEnabled || + this._lensFlareEnabled || + this._depthOfFieldEnabled || + this._motionBlurEnabled) && + this.addEffect( + new $a( + i.getEngine(), + "HDRPassPostProcess", + function () { + return e.originalPostProcess; + }, + true + ) + ), + (this._currentDepthOfFieldSource = + this.originalPostProcess), + this._bloomEnabled && + (this._createDownSampleX4PostProcess(i, t / 2), this._createBrightPassPostProcess(i, t / 2), this._createBlurPostProcesses(i, t / 4, 1), this._createTextureAdderPostProcess(i, t), - this.textureAdderFinalPostProcess = new Wt("HDRDepthOfFieldSource","standard",[],[],t,null,je.a.BILINEAR_SAMPLINGMODE,i.getEngine(),false,"#define PASS_POST_PROCESS",_.a.TEXTURETYPE_UNSIGNED_INT), - this.addEffect(new $a(i.getEngine(),"HDRBaseDepthOfFieldSource",function() { - return e.textureAdderFinalPostProcess - } - ,true))), - this._vlsEnabled && (this._createVolumetricLightPostProcess(i, t), - this.volumetricLightFinalPostProcess = new Wt("HDRVLSFinal","standard",[],[],t,null,je.a.BILINEAR_SAMPLINGMODE,i.getEngine(),false,"#define PASS_POST_PROCESS",_.a.TEXTURETYPE_UNSIGNED_INT), - this.addEffect(new $a(i.getEngine(),"HDRVLSFinal",function() { - return e.volumetricLightFinalPostProcess - } - ,true))), - this._lensFlareEnabled && (this._createLensFlarePostProcess(i, t), - this.lensFlareFinalPostProcess = new Wt("HDRPostLensFlareDepthOfFieldSource","standard",[],[],t,null,je.a.BILINEAR_SAMPLINGMODE,i.getEngine(),false,"#define PASS_POST_PROCESS",_.a.TEXTURETYPE_UNSIGNED_INT), - this.addEffect(new $a(i.getEngine(),"HDRPostLensFlareDepthOfFieldSource",function() { - return e.lensFlareFinalPostProcess - } - ,true))), - this._hdrEnabled && (this._createLuminancePostProcesses(i, this._floatTextureType), + (this.textureAdderFinalPostProcess = new Wt( + "HDRDepthOfFieldSource", + "standard", + [], + [], + t, + null, + je.a.BILINEAR_SAMPLINGMODE, + i.getEngine(), + false, + "#define PASS_POST_PROCESS", + _.a.TEXTURETYPE_UNSIGNED_INT + )), + this.addEffect( + new $a( + i.getEngine(), + "HDRBaseDepthOfFieldSource", + function () { + return e.textureAdderFinalPostProcess; + }, + true + ) + )), + this._vlsEnabled && + (this._createVolumetricLightPostProcess(i, t), + (this.volumetricLightFinalPostProcess = new Wt( + "HDRVLSFinal", + "standard", + [], + [], + t, + null, + je.a.BILINEAR_SAMPLINGMODE, + i.getEngine(), + false, + "#define PASS_POST_PROCESS", + _.a.TEXTURETYPE_UNSIGNED_INT + )), + this.addEffect( + new $a( + i.getEngine(), + "HDRVLSFinal", + function () { + return e.volumetricLightFinalPostProcess; + }, + true + ) + )), + this._lensFlareEnabled && + (this._createLensFlarePostProcess(i, t), + (this.lensFlareFinalPostProcess = new Wt( + "HDRPostLensFlareDepthOfFieldSource", + "standard", + [], + [], + t, + null, + je.a.BILINEAR_SAMPLINGMODE, + i.getEngine(), + false, + "#define PASS_POST_PROCESS", + _.a.TEXTURETYPE_UNSIGNED_INT + )), + this.addEffect( + new $a( + i.getEngine(), + "HDRPostLensFlareDepthOfFieldSource", + function () { + return e.lensFlareFinalPostProcess; + }, + true + ) + )), + this._hdrEnabled && + (this._createLuminancePostProcesses( + i, + this._floatTextureType + ), this._createHdrPostProcess(i, t), - this.hdrFinalPostProcess = new Wt("HDRPostHDReDepthOfFieldSource","standard",[],[],t,null,je.a.BILINEAR_SAMPLINGMODE,i.getEngine(),false,"#define PASS_POST_PROCESS",_.a.TEXTURETYPE_UNSIGNED_INT), - this.addEffect(new $a(i.getEngine(),"HDRPostHDReDepthOfFieldSource",function() { - return e.hdrFinalPostProcess - } - ,true))), - this._depthOfFieldEnabled && (this._createBlurPostProcesses(i, t / 2, 3, "depthOfFieldBlurWidth"), + (this.hdrFinalPostProcess = new Wt( + "HDRPostHDReDepthOfFieldSource", + "standard", + [], + [], + t, + null, + je.a.BILINEAR_SAMPLINGMODE, + i.getEngine(), + false, + "#define PASS_POST_PROCESS", + _.a.TEXTURETYPE_UNSIGNED_INT + )), + this.addEffect( + new $a( + i.getEngine(), + "HDRPostHDReDepthOfFieldSource", + function () { + return e.hdrFinalPostProcess; + }, + true + ) + )), + this._depthOfFieldEnabled && + (this._createBlurPostProcesses( + i, + t / 2, + 3, + "depthOfFieldBlurWidth" + ), this._createDepthOfFieldPostProcess(i, t)), - this._motionBlurEnabled && this._createMotionBlurPostProcess(i, t), - this._fxaaEnabled && (this.fxaaPostProcess = new ps("fxaa",1,null,je.a.BILINEAR_SAMPLINGMODE,i.getEngine(),false,_.a.TEXTURETYPE_UNSIGNED_INT), - this.addEffect(new $a(i.getEngine(),"HDRFxaa",function() { - return e.fxaaPostProcess - } - ,true))), - null !== this._cameras && this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras), - !this._enableMSAAOnFirstPostProcess(this._samples) && this._samples > 1 && g.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0") - } - , - t.prototype._createDownSampleX4PostProcess = function(e, t) { - var i = this - , n = new Array(32); - this.downSampleX4PostProcess = new Wt("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define DOWN_SAMPLE_X4",_.a.TEXTURETYPE_UNSIGNED_INT), - this.downSampleX4PostProcess.onApply = function(e) { - for (var t = 0, r = i.downSampleX4PostProcess.width, o = i.downSampleX4PostProcess.height, a = -2; a < 2; a++) - for (var s = -2; s < 2; s++) - n[t] = (a + .5) * (1 / r), - n[t + 1] = (s + .5) * (1 / o), - t += 2; - e.setArray2("dsOffsets", n) - } - , - this.addEffect(new $a(e.getEngine(),"HDRDownSampleX4",function() { - return i.downSampleX4PostProcess - } - ,true)) - } - , - t.prototype._createBrightPassPostProcess = function(e, t) { - var i = this - , n = new Array(8); - this.brightPassPostProcess = new Wt("HDRBrightPass","standard",["dsOffsets", "brightThreshold"],[],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define BRIGHT_PASS",_.a.TEXTURETYPE_UNSIGNED_INT), - this.brightPassPostProcess.onApply = function(e) { - var t = 1 / i.brightPassPostProcess.width - , r = 1 / i.brightPassPostProcess.height; - n[0] = -.5 * t, - n[1] = .5 * r, - n[2] = .5 * t, - n[3] = .5 * r, - n[4] = -.5 * t, - n[5] = -.5 * r, - n[6] = .5 * t, - n[7] = -.5 * r, - e.setArray2("dsOffsets", n), - e.setFloat("brightThreshold", i.brightThreshold) - } - , - this.addEffect(new $a(e.getEngine(),"HDRBrightPass",function() { - return i.brightPassPostProcess - } - ,true)) - } - , - t.prototype._createBlurPostProcesses = function(e, t, i, n) { - var r = this; - void 0 === n && (n = "blurWidth"); - var o = e.getEngine() - , s = new Hn("HDRBlurH_" + i,new a.w(1,0),this[n],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,_.a.TEXTURETYPE_UNSIGNED_INT) - , c = new Hn("HDRBlurV_" + i,new a.w(0,1),this[n],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,_.a.TEXTURETYPE_UNSIGNED_INT); - s.onActivateObservable.add(function() { - var e = s.width / o.getRenderWidth(); - s.kernel = r[n] * e - }), - c.onActivateObservable.add(function() { - var e = c.height / o.getRenderHeight(); - c.kernel = r.horizontalBlur ? 64 * e : r[n] * e - }), - this.addEffect(new $a(e.getEngine(),"HDRBlurH" + i,function() { - return s - } - ,true)), - this.addEffect(new $a(e.getEngine(),"HDRBlurV" + i,function() { - return c - } - ,true)), - this.blurHPostProcesses.push(s), - this.blurVPostProcesses.push(c) - } - , - t.prototype._createTextureAdderPostProcess = function(e, t) { - var i = this; - this.textureAdderPostProcess = new Wt("HDRTextureAdder","standard",["exposure"],["otherSampler", "lensSampler"],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define TEXTURE_ADDER",_.a.TEXTURETYPE_UNSIGNED_INT), - this.textureAdderPostProcess.onApply = function(e) { - e.setTextureFromPostProcess("otherSampler", i._vlsEnabled ? i._currentDepthOfFieldSource : i.originalPostProcess), - e.setTexture("lensSampler", i.lensTexture), - e.setFloat("exposure", i._currentExposure), - i._currentDepthOfFieldSource = i.textureAdderFinalPostProcess - } - , - this.addEffect(new $a(e.getEngine(),"HDRTextureAdder",function() { - return i.textureAdderPostProcess - } - ,true)) - } - , - t.prototype._createVolumetricLightPostProcess = function(e, t) { - var i = this - , n = e.enableGeometryBufferRenderer(); - n.enablePosition = true; - var r = n.getGBuffer(); - this.volumetricLightPostProcess = new Wt("HDRVLS","standard",["shadowViewProjection", "cameraPosition", "sunDirection", "sunColor", "scatteringCoefficient", "scatteringPower", "depthValues"],["shadowMapSampler", "positionSampler"],t / 8,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define VLS\n#define NB_STEPS " + this._volumetricLightStepsCount.toFixed(1)); - var o = a.w.Zero(); - this.volumetricLightPostProcess.onApply = function(e) { - if (i.sourceLight && i.sourceLight.getShadowGenerator() && i._scene.activeCamera) { - var t = i.sourceLight.getShadowGenerator(); - e.setTexture("shadowMapSampler", t.getShadowMap()), - e.setTexture("positionSampler", r.textures[2]), - e.setColor3("sunColor", i.sourceLight.diffuse), - e.setVector3("sunDirection", i.sourceLight.getShadowDirection()), - e.setVector3("cameraPosition", i._scene.activeCamera.globalPosition), - e.setMatrix("shadowViewProjection", t.getTransformMatrix()), - e.setFloat("scatteringCoefficient", i.volumetricLightCoefficient), - e.setFloat("scatteringPower", i.volumetricLightPower), - o.x = i.sourceLight.getDepthMinZ(i._scene.activeCamera), - o.y = i.sourceLight.getDepthMaxZ(i._scene.activeCamera), - e.setVector2("depthValues", o) - } - } - , - this.addEffect(new $a(e.getEngine(),"HDRVLS",function() { - return i.volumetricLightPostProcess - } - ,true)), - this._createBlurPostProcesses(e, t / 4, 0, "volumetricLightBlurScale"), - this.volumetricLightMergePostProces = new Wt("HDRVLSMerge","standard",[],["originalSampler"],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define VLSMERGE"), - this.volumetricLightMergePostProces.onApply = function(e) { - e.setTextureFromPostProcess("originalSampler", i._bloomEnabled ? i.textureAdderFinalPostProcess : i.originalPostProcess), - i._currentDepthOfFieldSource = i.volumetricLightFinalPostProcess - } - , - this.addEffect(new $a(e.getEngine(),"HDRVLSMerge",function() { - return i.volumetricLightMergePostProces - } - ,true)) - } - , - t.prototype._createLuminancePostProcesses = function(e, i) { - var n = this - , r = Math.pow(3, t.LuminanceSteps); - this.luminancePostProcess = new Wt("HDRLuminance","standard",["lumOffsets"],[],{ - width: r, - height: r - },null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define LUMINANCE",i); - var o = []; - this.luminancePostProcess.onApply = function(e) { - var t = 1 / n.luminancePostProcess.width - , i = 1 / n.luminancePostProcess.height; - o[0] = -.5 * t, - o[1] = .5 * i, - o[2] = .5 * t, - o[3] = .5 * i, - o[4] = -.5 * t, - o[5] = -.5 * i, - o[6] = .5 * t, - o[7] = -.5 * i, - e.setArray2("lumOffsets", o) - } - , - this.addEffect(new $a(e.getEngine(),"HDRLuminance",function() { - return n.luminancePostProcess - } - ,true)); - for (var s = t.LuminanceSteps - 1; s >= 0; s--) { - r = Math.pow(3, s); - var c = "#define LUMINANCE_DOWN_SAMPLE\n"; - 0 === s && (c += "#define FINAL_DOWN_SAMPLER"); - var u = new Wt("HDRLuminanceDownSample" + s,"standard",["dsOffsets", "halfDestPixelSize"],[],{ - width: r, - height: r - },null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,c,i); - this.luminanceDownSamplePostProcesses.push(u) - } - var l = this.luminancePostProcess; - this.luminanceDownSamplePostProcesses.forEach(function(t, i) { - var r = new Array(18); - t.onApply = function(e) { - if (l) { - for (var o = 0, a = -1; a < 2; a++) - for (var s = -1; s < 2; s++) - r[o] = a / l.width, - r[o + 1] = s / l.height, - o += 2; - e.setArray2("dsOffsets", r), - e.setFloat("halfDestPixelSize", .5 / l.width), - l = i === n.luminanceDownSamplePostProcesses.length - 1 ? n.luminancePostProcess : t - } - } - , - i === n.luminanceDownSamplePostProcesses.length - 1 && (t.onAfterRender = function() { - var t = e.getEngine().readPixels(0, 0, 1, 1) - , i = new a.y(1 / 16581375,1 / 65025,1 / 255,1); - n._hdrCurrentLuminance = (t[0] * i.x + t[1] * i.y + t[2] * i.z + t[3] * i.w) / 100 - } - ), - n.addEffect(new $a(e.getEngine(),"HDRLuminanceDownSample" + i,function() { - return t - } - ,true)) - }) - } - , - t.prototype._createHdrPostProcess = function(e, t) { - var i = this - , n = ["#define HDR"]; - this._hdrAutoExposure && n.push("#define AUTO_EXPOSURE"), - this.hdrPostProcess = new Wt("HDR","standard",["averageLuminance"],["textureAdderSampler"],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,n.join("\n"),_.a.TEXTURETYPE_UNSIGNED_INT); - var r = 1 - , o = 0 - , a = 0; - this.hdrPostProcess.onApply = function(t) { - if (t.setTextureFromPostProcess("textureAdderSampler", i._currentDepthOfFieldSource), - o += e.getEngine().getDeltaTime(), - r < 0) - r = i._hdrCurrentLuminance; - else { - var n = (a - o) / 1e3; - i._hdrCurrentLuminance < r + i.hdrDecreaseRate * n ? r += i.hdrDecreaseRate * n : i._hdrCurrentLuminance > r - i.hdrIncreaseRate * n ? r -= i.hdrIncreaseRate * n : r = i._hdrCurrentLuminance - } - i.hdrAutoExposure ? i._currentExposure = i._fixedExposure / r : (r = L.a.Clamp(r, i.hdrMinimumLuminance, 1e20), - t.setFloat("averageLuminance", r)), - a = o, - i._currentDepthOfFieldSource = i.hdrFinalPostProcess - } - , - this.addEffect(new $a(e.getEngine(),"HDR",function() { - return i.hdrPostProcess - } - ,true)) - } - , - t.prototype._createLensFlarePostProcess = function(e, t) { - var i = this; - this.lensFlarePostProcess = new Wt("HDRLensFlare","standard",["strength", "ghostDispersal", "haloWidth", "resolution", "distortionStrength"],["lensColorSampler"],t / 2,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define LENS_FLARE",_.a.TEXTURETYPE_UNSIGNED_INT), - this.addEffect(new $a(e.getEngine(),"HDRLensFlare",function() { - return i.lensFlarePostProcess - } - ,true)), - this._createBlurPostProcesses(e, t / 4, 2), - this.lensFlareComposePostProcess = new Wt("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler", "lensDirtSampler", "lensStarSampler"],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define LENS_FLARE_COMPOSE",_.a.TEXTURETYPE_UNSIGNED_INT), - this.addEffect(new $a(e.getEngine(),"HDRLensFlareCompose",function() { - return i.lensFlareComposePostProcess - } - ,true)); - var n = new a.w(0,0); - this.lensFlarePostProcess.onApply = function(e) { - e.setTextureFromPostProcess("textureSampler", i._bloomEnabled ? i.blurHPostProcesses[0] : i.originalPostProcess), - e.setTexture("lensColorSampler", i.lensColorTexture), - e.setFloat("strength", i.lensFlareStrength), - e.setFloat("ghostDispersal", i.lensFlareGhostDispersal), - e.setFloat("haloWidth", i.lensFlareHaloWidth), - n.x = i.lensFlarePostProcess.width, - n.y = i.lensFlarePostProcess.height, - e.setVector2("resolution", n), - e.setFloat("distortionStrength", i.lensFlareDistortionStrength) - } - ; - var r = a.j.FromValues(2, 0, -1, 0, 0, 2, -1, 0, 0, 0, 1, 0, 0, 0, 0, 1) - , o = a.j.FromValues(.5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1, 0, 0, 0, 0, 1); - this.lensFlareComposePostProcess.onApply = function(e) { - if (i._scene.activeCamera) { - e.setTextureFromPostProcess("otherSampler", i._currentDepthOfFieldSource), - e.setTexture("lensDirtSampler", i.lensFlareDirtTexture), - e.setTexture("lensStarSampler", i.lensStarTexture); - var t = i._scene.activeCamera.getViewMatrix().getRow(0) - , n = i._scene.activeCamera.getViewMatrix().getRow(2) - , s = a.x.Dot(t.toVector3(), new a.x(1,0,0)) + a.x.Dot(n.toVector3(), new a.x(0,0,1)); - s *= 4; - var c = a.j.FromValues(.5 * Math.cos(s), -Math.sin(s), 0, 0, Math.sin(s), .5 * Math.cos(s), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) - , u = o.multiply(c).multiply(r); - e.setMatrix("lensStarMatrix", u), - i._currentDepthOfFieldSource = i.lensFlareFinalPostProcess - } - } - } - , - t.prototype._createDepthOfFieldPostProcess = function(e, t) { - var i = this; - this.depthOfFieldPostProcess = new Wt("HDRDepthOfField","standard",["distance"],["otherSampler", "depthSampler"],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define DEPTH_OF_FIELD",_.a.TEXTURETYPE_UNSIGNED_INT), - this.depthOfFieldPostProcess.onApply = function(e) { - e.setTextureFromPostProcess("otherSampler", i._currentDepthOfFieldSource), - e.setTexture("depthSampler", i._getDepthTexture()), - e.setFloat("distance", i.depthOfFieldDistance) - } - , - this.addEffect(new $a(e.getEngine(),"HDRDepthOfField",function() { - return i.depthOfFieldPostProcess - } - ,true)) - } - , - t.prototype._createMotionBlurPostProcess = function(e, t) { - var i = this; - this.motionBlurPostProcess = new Wt("HDRMotionBlur","standard",["inverseViewProjection", "prevViewProjection", "screenSize", "motionScale", "motionStrength"],["depthSampler"],t,null,je.a.BILINEAR_SAMPLINGMODE,e.getEngine(),false,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES " + this.motionBlurSamples.toFixed(1),_.a.TEXTURETYPE_UNSIGNED_INT); - var n = 0 - , r = a.j.Identity() - , o = a.j.Identity() - , s = a.j.Identity() - , c = a.w.Zero(); - this.motionBlurPostProcess.onApply = function(t) { - (s = e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(o), - t.setMatrix("inverseViewProjection", o), - t.setMatrix("prevViewProjection", r), - r = s, - c.x = i.motionBlurPostProcess.width, - c.y = i.motionBlurPostProcess.height, - t.setVector2("screenSize", c), - n = e.getEngine().getFps() / 60, - t.setFloat("motionScale", n), - t.setFloat("motionStrength", i.motionStrength), - t.setTexture("depthSampler", i._getDepthTexture()) - } - , - this.addEffect(new $a(e.getEngine(),"HDRMotionBlur",function() { - return i.motionBlurPostProcess - } - ,true)) - } - , - t.prototype._getDepthTexture = function() { - return this._scene.getEngine().getCaps().drawBuffersExtension ? this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0] : this._scene.enableDepthRenderer().getDepthMap() - } - , - t.prototype._disposePostProcesses = function() { - for (var e = 0; e < this._cameras.length; e++) { - var t = this._cameras[e]; - this.originalPostProcess && this.originalPostProcess.dispose(t), - this.downSampleX4PostProcess && this.downSampleX4PostProcess.dispose(t), - this.brightPassPostProcess && this.brightPassPostProcess.dispose(t), - this.textureAdderPostProcess && this.textureAdderPostProcess.dispose(t), - this.textureAdderFinalPostProcess && this.textureAdderFinalPostProcess.dispose(t), - this.volumetricLightPostProcess && this.volumetricLightPostProcess.dispose(t), - this.volumetricLightSmoothXPostProcess && this.volumetricLightSmoothXPostProcess.dispose(t), - this.volumetricLightSmoothYPostProcess && this.volumetricLightSmoothYPostProcess.dispose(t), - this.volumetricLightMergePostProces && this.volumetricLightMergePostProces.dispose(t), - this.volumetricLightFinalPostProcess && this.volumetricLightFinalPostProcess.dispose(t), - this.lensFlarePostProcess && this.lensFlarePostProcess.dispose(t), - this.lensFlareComposePostProcess && this.lensFlareComposePostProcess.dispose(t); - for (var i = 0; i < this.luminanceDownSamplePostProcesses.length; i++) - this.luminanceDownSamplePostProcesses[i].dispose(t); - for (this.luminancePostProcess && this.luminancePostProcess.dispose(t), - this.hdrPostProcess && this.hdrPostProcess.dispose(t), - this.hdrFinalPostProcess && this.hdrFinalPostProcess.dispose(t), - this.depthOfFieldPostProcess && this.depthOfFieldPostProcess.dispose(t), - this.motionBlurPostProcess && this.motionBlurPostProcess.dispose(t), - this.fxaaPostProcess && this.fxaaPostProcess.dispose(t), - i = 0; i < this.blurHPostProcesses.length; i++) - this.blurHPostProcesses[i].dispose(t); - for (i = 0; i < this.blurVPostProcesses.length; i++) - this.blurVPostProcesses[i].dispose(t) - } - this.originalPostProcess = null, - this.downSampleX4PostProcess = null, - this.brightPassPostProcess = null, - this.textureAdderPostProcess = null, - this.textureAdderFinalPostProcess = null, - this.volumetricLightPostProcess = null, - this.volumetricLightSmoothXPostProcess = null, - this.volumetricLightSmoothYPostProcess = null, - this.volumetricLightMergePostProces = null, - this.volumetricLightFinalPostProcess = null, - this.lensFlarePostProcess = null, - this.lensFlareComposePostProcess = null, - this.luminancePostProcess = null, - this.hdrPostProcess = null, - this.hdrFinalPostProcess = null, - this.depthOfFieldPostProcess = null, - this.motionBlurPostProcess = null, - this.fxaaPostProcess = null, - this.luminanceDownSamplePostProcesses = [], - this.blurHPostProcesses = [], - this.blurVPostProcesses = [] - } - , - t.prototype.dispose = function() { - this._disposePostProcesses(), - this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras), - e.prototype.dispose.call(this) - } - , - t.prototype.serialize = function() { - var e = F.a.Serialize(this); - return this.sourceLight && (e.sourceLightId = this.sourceLight.id), - e.customType = "StandardRenderingPipeline", - e - } - , - t.Parse = function(e, i, n) { - var r = F.a.Parse(function() { - return new t(e._name,i,e._ratio) - }, e, i, n); - return e.sourceLightId && (r.sourceLight = i.getLightByID(e.sourceLightId)), - r - } - , - t.LuminanceSteps = 6, - h.c([Object(F.c)()], t.prototype, "brightThreshold", void 0), - h.c([Object(F.c)()], t.prototype, "blurWidth", void 0), - h.c([Object(F.c)()], t.prototype, "horizontalBlur", void 0), - h.c([Object(F.c)()], t.prototype, "exposure", null), - h.c([Object(F.m)("lensTexture")], t.prototype, "lensTexture", void 0), - h.c([Object(F.c)()], t.prototype, "volumetricLightCoefficient", void 0), - h.c([Object(F.c)()], t.prototype, "volumetricLightPower", void 0), - h.c([Object(F.c)()], t.prototype, "volumetricLightBlurScale", void 0), - h.c([Object(F.c)()], t.prototype, "hdrMinimumLuminance", void 0), - h.c([Object(F.c)()], t.prototype, "hdrDecreaseRate", void 0), - h.c([Object(F.c)()], t.prototype, "hdrIncreaseRate", void 0), - h.c([Object(F.c)()], t.prototype, "hdrAutoExposure", null), - h.c([Object(F.m)("lensColorTexture")], t.prototype, "lensColorTexture", void 0), - h.c([Object(F.c)()], t.prototype, "lensFlareStrength", void 0), - h.c([Object(F.c)()], t.prototype, "lensFlareGhostDispersal", void 0), - h.c([Object(F.c)()], t.prototype, "lensFlareHaloWidth", void 0), - h.c([Object(F.c)()], t.prototype, "lensFlareDistortionStrength", void 0), - h.c([Object(F.m)("lensStarTexture")], t.prototype, "lensStarTexture", void 0), - h.c([Object(F.m)("lensFlareDirtTexture")], t.prototype, "lensFlareDirtTexture", void 0), - h.c([Object(F.c)()], t.prototype, "depthOfFieldDistance", void 0), - h.c([Object(F.c)()], t.prototype, "depthOfFieldBlurWidth", void 0), - h.c([Object(F.c)()], t.prototype, "motionStrength", void 0), - h.c([Object(F.c)()], t.prototype, "_ratio", void 0), - h.c([Object(F.c)()], t.prototype, "BloomEnabled", null), - h.c([Object(F.c)()], t.prototype, "DepthOfFieldEnabled", null), - h.c([Object(F.c)()], t.prototype, "LensFlareEnabled", null), - h.c([Object(F.c)()], t.prototype, "HDREnabled", null), - h.c([Object(F.c)()], t.prototype, "VLSEnabled", null), - h.c([Object(F.c)()], t.prototype, "MotionBlurEnabled", null), - h.c([Object(F.c)()], t.prototype, "fxaaEnabled", null), - h.c([Object(F.c)()], t.prototype, "volumetricLightStepsCount", null), - h.c([Object(F.c)()], t.prototype, "motionBlurSamples", null), - h.c([Object(F.c)()], t.prototype, "samples", null), + this._motionBlurEnabled && + this._createMotionBlurPostProcess(i, t), + this._fxaaEnabled && + ((this.fxaaPostProcess = new ps( + "fxaa", + 1, + null, + je.a.BILINEAR_SAMPLINGMODE, + i.getEngine(), + false, + _.a.TEXTURETYPE_UNSIGNED_INT + )), + this.addEffect( + new $a( + i.getEngine(), + "HDRFxaa", + function () { + return e.fxaaPostProcess; + }, + true + ) + )), + null !== this._cameras && + this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline( + this._name, + this._cameras + ), + !this._enableMSAAOnFirstPostProcess(this._samples) && + this._samples > 1 && + g.a.Warn( + "MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0" + ); + }), + (t.prototype._createDownSampleX4PostProcess = function ( + e, t - }(Ts); - s.a.RegisteredTypes["BABYLON.StandardRenderingPipeline"] = Ms; - var Os; - Ht.a.ShadersStore.tonemapPixelShader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;\nconst float B=0.50;\nconst float C=0.10;\nconst float D=0.20;\nconst float E=0.02;\nconst float F=0.30;\nconst float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{\nreturn dot(c,vec3(0.22,0.707,0.071));\n}\nvoid main(void)\n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb);\nfloat lumTm=lum*_ExposureAdjustment;\nfloat scale=lumTm/(1.0+lumTm);\ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nconst float ExposureBias=2.0;\nvec3 x=ExposureBias*colour;\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\nx=vec3(W,W,W);\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\ncolour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);\n}", - function(e) { - e[e.Hable = 0] = "Hable", - e[e.Reinhard = 1] = "Reinhard", - e[e.HejiDawson = 2] = "HejiDawson", - e[e.Photographic = 3] = "Photographic" - }(Os || (Os = {})); - var ws = function(e) { - function t(t, i, n, r, o, a, s) { - void 0 === o && (o = _.a.TEXTURE_BILINEAR_SAMPLINGMODE), - void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT); - var c = e.call(this, t, "tonemap", ["_ExposureAdjustment"], null, 1, r, o, a, true, null, s) || this; - c._operator = i, - c.exposureAdjustment = n; - var u = "#define "; - return c._operator === Os.Hable ? u += "HABLE_TONEMAPPING" : c._operator === Os.Reinhard ? u += "REINHARD_TONEMAPPING" : c._operator === Os.HejiDawson ? u += "OPTIMIZED_HEJIDAWSON_TONEMAPPING" : c._operator === Os.Photographic && (u += "PHOTOGRAPHIC_TONEMAPPING"), - c.updateEffect(u), - c.onApply = function(e) { - e.setFloat("_ExposureAdjustment", c.exposureAdjustment) - } - , - c - } - return h.d(t, e), - t - }(Wt); - Ht.a.ShadersStore.depthVertexShader = "\nattribute vec3 position;\n#include\n\n#include\nuniform mat4 viewProjection;\nuniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvarying float vDepthMetric;\nvoid main(void)\n{\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"; - Ht.a.ShadersStore.volumetricLightScatteringPixelShader = "uniform sampler2D textureSampler;\nuniform sampler2D lightScatteringSampler;\nuniform float decay;\nuniform float exposure;\nuniform float weight;\nuniform float density;\nuniform vec2 meshPositionOnScreen;\nvarying vec2 vUV;\nvoid main(void) {\nvec2 tc=vUV;\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\nfloat illuminationDecay=1.0;\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\nfor(int i=0; i= 0; s--) { + r = Math.pow(3, s); + var c = "#define LUMINANCE_DOWN_SAMPLE\n"; + 0 === s && (c += "#define FINAL_DOWN_SAMPLER"); + var u = new Wt( + "HDRLuminanceDownSample" + s, + "standard", + ["dsOffsets", "halfDestPixelSize"], + [], + { + width: r, + height: r, + }, + null, + je.a.BILINEAR_SAMPLINGMODE, + e.getEngine(), + false, + c, + i + ); + this.luminanceDownSamplePostProcesses.push(u); } - , - t.prototype._isReady = function(e, t) { - var i = e.getMesh(); - if (i === this.mesh && i.material) - return i.material.isReady(i); - var n = [] - , r = [Si.b.PositionKind] - , o = e.getMaterial(); - o && (o.needAlphaTesting() && n.push("#define ALPHATEST"), - i.isVerticesDataPresent(Si.b.UVKind) && (r.push(Si.b.UVKind), - n.push("#define UV1")), - i.isVerticesDataPresent(Si.b.UV2Kind) && (r.push(Si.b.UV2Kind), - n.push("#define UV2"))), - i.useBones && i.computeBonesUsingShaders ? (r.push(Si.b.MatricesIndicesKind), - r.push(Si.b.MatricesWeightsKind), - n.push("#define NUM_BONE_INFLUENCERS " + i.numBoneInfluencers), - n.push("#define BonesPerMesh " + (i.skeleton ? i.skeleton.bones.length + 1 : 0))) : n.push("#define NUM_BONE_INFLUENCERS 0"), - t && (n.push("#define INSTANCES"), + var l = this.luminancePostProcess; + this.luminanceDownSamplePostProcesses.forEach(function ( + t, + i + ) { + var r = new Array(18); + (t.onApply = function (e) { + if (l) { + for (var o = 0, a = -1; a < 2; a++) + for (var s = -1; s < 2; s++) + (r[o] = a / l.width), + (r[o + 1] = s / l.height), + (o += 2); + e.setArray2("dsOffsets", r), + e.setFloat("halfDestPixelSize", 0.5 / l.width), + (l = + i === + n.luminanceDownSamplePostProcesses.length - 1 + ? n.luminancePostProcess + : t); + } + }), + i === n.luminanceDownSamplePostProcesses.length - 1 && + (t.onAfterRender = function () { + var t = e.getEngine().readPixels(0, 0, 1, 1), + i = new a.y(1 / 16581375, 1 / 65025, 1 / 255, 1); + n._hdrCurrentLuminance = + (t[0] * i.x + + t[1] * i.y + + t[2] * i.z + + t[3] * i.w) / + 100; + }), + n.addEffect( + new $a( + e.getEngine(), + "HDRLuminanceDownSample" + i, + function () { + return t; + }, + true + ) + ); + }); + }), + (t.prototype._createHdrPostProcess = function (e, t) { + var i = this, + n = ["#define HDR"]; + this._hdrAutoExposure && n.push("#define AUTO_EXPOSURE"), + (this.hdrPostProcess = new Wt( + "HDR", + "standard", + ["averageLuminance"], + ["textureAdderSampler"], + t, + null, + je.a.BILINEAR_SAMPLINGMODE, + e.getEngine(), + false, + n.join("\n"), + _.a.TEXTURETYPE_UNSIGNED_INT + )); + var r = 1, + o = 0, + a = 0; + (this.hdrPostProcess.onApply = function (t) { + if ( + (t.setTextureFromPostProcess( + "textureAdderSampler", + i._currentDepthOfFieldSource + ), + (o += e.getEngine().getDeltaTime()), + r < 0) + ) + r = i._hdrCurrentLuminance; + else { + var n = (a - o) / 1e3; + i._hdrCurrentLuminance < r + i.hdrDecreaseRate * n + ? (r += i.hdrDecreaseRate * n) + : i._hdrCurrentLuminance > r - i.hdrIncreaseRate * n + ? (r -= i.hdrIncreaseRate * n) + : (r = i._hdrCurrentLuminance); + } + i.hdrAutoExposure + ? (i._currentExposure = i._fixedExposure / r) + : ((r = L.a.Clamp(r, i.hdrMinimumLuminance, 1e20)), + t.setFloat("averageLuminance", r)), + (a = o), + (i._currentDepthOfFieldSource = i.hdrFinalPostProcess); + }), + this.addEffect( + new $a( + e.getEngine(), + "HDR", + function () { + return i.hdrPostProcess; + }, + true + ) + ); + }), + (t.prototype._createLensFlarePostProcess = function (e, t) { + var i = this; + (this.lensFlarePostProcess = new Wt( + "HDRLensFlare", + "standard", + [ + "strength", + "ghostDispersal", + "haloWidth", + "resolution", + "distortionStrength", + ], + ["lensColorSampler"], + t / 2, + null, + je.a.BILINEAR_SAMPLINGMODE, + e.getEngine(), + false, + "#define LENS_FLARE", + _.a.TEXTURETYPE_UNSIGNED_INT + )), + this.addEffect( + new $a( + e.getEngine(), + "HDRLensFlare", + function () { + return i.lensFlarePostProcess; + }, + true + ) + ), + this._createBlurPostProcesses(e, t / 4, 2), + (this.lensFlareComposePostProcess = new Wt( + "HDRLensFlareCompose", + "standard", + ["lensStarMatrix"], + ["otherSampler", "lensDirtSampler", "lensStarSampler"], + t, + null, + je.a.BILINEAR_SAMPLINGMODE, + e.getEngine(), + false, + "#define LENS_FLARE_COMPOSE", + _.a.TEXTURETYPE_UNSIGNED_INT + )), + this.addEffect( + new $a( + e.getEngine(), + "HDRLensFlareCompose", + function () { + return i.lensFlareComposePostProcess; + }, + true + ) + ); + var n = new a.w(0, 0); + this.lensFlarePostProcess.onApply = function (e) { + e.setTextureFromPostProcess( + "textureSampler", + i._bloomEnabled + ? i.blurHPostProcesses[0] + : i.originalPostProcess + ), + e.setTexture("lensColorSampler", i.lensColorTexture), + e.setFloat("strength", i.lensFlareStrength), + e.setFloat("ghostDispersal", i.lensFlareGhostDispersal), + e.setFloat("haloWidth", i.lensFlareHaloWidth), + (n.x = i.lensFlarePostProcess.width), + (n.y = i.lensFlarePostProcess.height), + e.setVector2("resolution", n), + e.setFloat( + "distortionStrength", + i.lensFlareDistortionStrength + ); + }; + var r = a.j.FromValues( + 2, + 0, + -1, + 0, + 0, + 2, + -1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ), + o = a.j.FromValues( + 0.5, + 0, + 0.5, + 0, + 0, + 0.5, + 0.5, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ); + this.lensFlareComposePostProcess.onApply = function (e) { + if (i._scene.activeCamera) { + e.setTextureFromPostProcess( + "otherSampler", + i._currentDepthOfFieldSource + ), + e.setTexture( + "lensDirtSampler", + i.lensFlareDirtTexture + ), + e.setTexture("lensStarSampler", i.lensStarTexture); + var t = i._scene.activeCamera.getViewMatrix().getRow(0), + n = i._scene.activeCamera.getViewMatrix().getRow(2), + s = + a.x.Dot(t.toVector3(), new a.x(1, 0, 0)) + + a.x.Dot(n.toVector3(), new a.x(0, 0, 1)); + s *= 4; + var c = a.j.FromValues( + 0.5 * Math.cos(s), + -Math.sin(s), + 0, + 0, + Math.sin(s), + 0.5 * Math.cos(s), + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ), + u = o.multiply(c).multiply(r); + e.setMatrix("lensStarMatrix", u), + (i._currentDepthOfFieldSource = + i.lensFlareFinalPostProcess); + } + }; + }), + (t.prototype._createDepthOfFieldPostProcess = function ( + e, + t + ) { + var i = this; + (this.depthOfFieldPostProcess = new Wt( + "HDRDepthOfField", + "standard", + ["distance"], + ["otherSampler", "depthSampler"], + t, + null, + je.a.BILINEAR_SAMPLINGMODE, + e.getEngine(), + false, + "#define DEPTH_OF_FIELD", + _.a.TEXTURETYPE_UNSIGNED_INT + )), + (this.depthOfFieldPostProcess.onApply = function (e) { + e.setTextureFromPostProcess( + "otherSampler", + i._currentDepthOfFieldSource + ), + e.setTexture("depthSampler", i._getDepthTexture()), + e.setFloat("distance", i.depthOfFieldDistance); + }), + this.addEffect( + new $a( + e.getEngine(), + "HDRDepthOfField", + function () { + return i.depthOfFieldPostProcess; + }, + true + ) + ); + }), + (t.prototype._createMotionBlurPostProcess = function (e, t) { + var i = this; + this.motionBlurPostProcess = new Wt( + "HDRMotionBlur", + "standard", + [ + "inverseViewProjection", + "prevViewProjection", + "screenSize", + "motionScale", + "motionStrength", + ], + ["depthSampler"], + t, + null, + je.a.BILINEAR_SAMPLINGMODE, + e.getEngine(), + false, + "#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES " + + this.motionBlurSamples.toFixed(1), + _.a.TEXTURETYPE_UNSIGNED_INT + ); + var n = 0, + r = a.j.Identity(), + o = a.j.Identity(), + s = a.j.Identity(), + c = a.w.Zero(); + (this.motionBlurPostProcess.onApply = function (t) { + (s = e + .getProjectionMatrix() + .multiply(e.getViewMatrix())).invertToRef(o), + t.setMatrix("inverseViewProjection", o), + t.setMatrix("prevViewProjection", r), + (r = s), + (c.x = i.motionBlurPostProcess.width), + (c.y = i.motionBlurPostProcess.height), + t.setVector2("screenSize", c), + (n = e.getEngine().getFps() / 60), + t.setFloat("motionScale", n), + t.setFloat("motionStrength", i.motionStrength), + t.setTexture("depthSampler", i._getDepthTexture()); + }), + this.addEffect( + new $a( + e.getEngine(), + "HDRMotionBlur", + function () { + return i.motionBlurPostProcess; + }, + true + ) + ); + }), + (t.prototype._getDepthTexture = function () { + return this._scene.getEngine().getCaps() + .drawBuffersExtension + ? this._scene.enableGeometryBufferRenderer().getGBuffer() + .textures[0] + : this._scene.enableDepthRenderer().getDepthMap(); + }), + (t.prototype._disposePostProcesses = function () { + for (var e = 0; e < this._cameras.length; e++) { + var t = this._cameras[e]; + this.originalPostProcess && + this.originalPostProcess.dispose(t), + this.downSampleX4PostProcess && + this.downSampleX4PostProcess.dispose(t), + this.brightPassPostProcess && + this.brightPassPostProcess.dispose(t), + this.textureAdderPostProcess && + this.textureAdderPostProcess.dispose(t), + this.textureAdderFinalPostProcess && + this.textureAdderFinalPostProcess.dispose(t), + this.volumetricLightPostProcess && + this.volumetricLightPostProcess.dispose(t), + this.volumetricLightSmoothXPostProcess && + this.volumetricLightSmoothXPostProcess.dispose(t), + this.volumetricLightSmoothYPostProcess && + this.volumetricLightSmoothYPostProcess.dispose(t), + this.volumetricLightMergePostProces && + this.volumetricLightMergePostProces.dispose(t), + this.volumetricLightFinalPostProcess && + this.volumetricLightFinalPostProcess.dispose(t), + this.lensFlarePostProcess && + this.lensFlarePostProcess.dispose(t), + this.lensFlareComposePostProcess && + this.lensFlareComposePostProcess.dispose(t); + for ( + var i = 0; + i < this.luminanceDownSamplePostProcesses.length; + i++ + ) + this.luminanceDownSamplePostProcesses[i].dispose(t); + for ( + this.luminancePostProcess && + this.luminancePostProcess.dispose(t), + this.hdrPostProcess && this.hdrPostProcess.dispose(t), + this.hdrFinalPostProcess && + this.hdrFinalPostProcess.dispose(t), + this.depthOfFieldPostProcess && + this.depthOfFieldPostProcess.dispose(t), + this.motionBlurPostProcess && + this.motionBlurPostProcess.dispose(t), + this.fxaaPostProcess && + this.fxaaPostProcess.dispose(t), + i = 0; + i < this.blurHPostProcesses.length; + i++ + ) + this.blurHPostProcesses[i].dispose(t); + for (i = 0; i < this.blurVPostProcesses.length; i++) + this.blurVPostProcesses[i].dispose(t); + } + (this.originalPostProcess = null), + (this.downSampleX4PostProcess = null), + (this.brightPassPostProcess = null), + (this.textureAdderPostProcess = null), + (this.textureAdderFinalPostProcess = null), + (this.volumetricLightPostProcess = null), + (this.volumetricLightSmoothXPostProcess = null), + (this.volumetricLightSmoothYPostProcess = null), + (this.volumetricLightMergePostProces = null), + (this.volumetricLightFinalPostProcess = null), + (this.lensFlarePostProcess = null), + (this.lensFlareComposePostProcess = null), + (this.luminancePostProcess = null), + (this.hdrPostProcess = null), + (this.hdrFinalPostProcess = null), + (this.depthOfFieldPostProcess = null), + (this.motionBlurPostProcess = null), + (this.fxaaPostProcess = null), + (this.luminanceDownSamplePostProcesses = []), + (this.blurHPostProcesses = []), + (this.blurVPostProcesses = []); + }), + (t.prototype.dispose = function () { + this._disposePostProcesses(), + this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline( + this._name, + this._cameras + ), + e.prototype.dispose.call(this); + }), + (t.prototype.serialize = function () { + var e = F.a.Serialize(this); + return ( + this.sourceLight && + (e.sourceLightId = this.sourceLight.id), + (e.customType = "StandardRenderingPipeline"), + e + ); + }), + (t.Parse = function (e, i, n) { + var r = F.a.Parse( + function () { + return new t(e._name, i, e._ratio); + }, + e, + i, + n + ); + return ( + e.sourceLightId && + (r.sourceLight = i.getLightByID(e.sourceLightId)), + r + ); + }), + (t.LuminanceSteps = 6), + h.c([Object(F.c)()], t.prototype, "brightThreshold", void 0), + h.c([Object(F.c)()], t.prototype, "blurWidth", void 0), + h.c([Object(F.c)()], t.prototype, "horizontalBlur", void 0), + h.c([Object(F.c)()], t.prototype, "exposure", null), + h.c( + [Object(F.m)("lensTexture")], + t.prototype, + "lensTexture", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "volumetricLightCoefficient", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "volumetricLightPower", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "volumetricLightBlurScale", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "hdrMinimumLuminance", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "hdrDecreaseRate", void 0), + h.c([Object(F.c)()], t.prototype, "hdrIncreaseRate", void 0), + h.c([Object(F.c)()], t.prototype, "hdrAutoExposure", null), + h.c( + [Object(F.m)("lensColorTexture")], + t.prototype, + "lensColorTexture", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "lensFlareStrength", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "lensFlareGhostDispersal", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "lensFlareHaloWidth", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "lensFlareDistortionStrength", + void 0 + ), + h.c( + [Object(F.m)("lensStarTexture")], + t.prototype, + "lensStarTexture", + void 0 + ), + h.c( + [Object(F.m)("lensFlareDirtTexture")], + t.prototype, + "lensFlareDirtTexture", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "depthOfFieldDistance", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "depthOfFieldBlurWidth", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "motionStrength", void 0), + h.c([Object(F.c)()], t.prototype, "_ratio", void 0), + h.c([Object(F.c)()], t.prototype, "BloomEnabled", null), + h.c( + [Object(F.c)()], + t.prototype, + "DepthOfFieldEnabled", + null + ), + h.c([Object(F.c)()], t.prototype, "LensFlareEnabled", null), + h.c([Object(F.c)()], t.prototype, "HDREnabled", null), + h.c([Object(F.c)()], t.prototype, "VLSEnabled", null), + h.c([Object(F.c)()], t.prototype, "MotionBlurEnabled", null), + h.c([Object(F.c)()], t.prototype, "fxaaEnabled", null), + h.c( + [Object(F.c)()], + t.prototype, + "volumetricLightStepsCount", + null + ), + h.c([Object(F.c)()], t.prototype, "motionBlurSamples", null), + h.c([Object(F.c)()], t.prototype, "samples", null), + t + ); + })(Ts); + s.a.RegisteredTypes["BABYLON.StandardRenderingPipeline"] = Ms; + var Os; + (Ht.a.ShadersStore.tonemapPixelShader = + "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;\nconst float B=0.50;\nconst float C=0.10;\nconst float D=0.20;\nconst float E=0.02;\nconst float F=0.30;\nconst float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{\nreturn dot(c,vec3(0.22,0.707,0.071));\n}\nvoid main(void)\n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb);\nfloat lumTm=lum*_ExposureAdjustment;\nfloat scale=lumTm/(1.0+lumTm);\ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nconst float ExposureBias=2.0;\nvec3 x=ExposureBias*colour;\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\nx=vec3(W,W,W);\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\ncolour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);\n}"), + (function (e) { + (e[(e.Hable = 0)] = "Hable"), + (e[(e.Reinhard = 1)] = "Reinhard"), + (e[(e.HejiDawson = 2)] = "HejiDawson"), + (e[(e.Photographic = 3)] = "Photographic"); + })(Os || (Os = {})); + var ws = (function (e) { + function t(t, i, n, r, o, a, s) { + void 0 === o && (o = _.a.TEXTURE_BILINEAR_SAMPLINGMODE), + void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT); + var c = + e.call( + this, + t, + "tonemap", + ["_ExposureAdjustment"], + null, + 1, + r, + o, + a, + true, + null, + s + ) || this; + (c._operator = i), (c.exposureAdjustment = n); + var u = "#define "; + return ( + c._operator === Os.Hable + ? (u += "HABLE_TONEMAPPING") + : c._operator === Os.Reinhard + ? (u += "REINHARD_TONEMAPPING") + : c._operator === Os.HejiDawson + ? (u += "OPTIMIZED_HEJIDAWSON_TONEMAPPING") + : c._operator === Os.Photographic && + (u += "PHOTOGRAPHIC_TONEMAPPING"), + c.updateEffect(u), + (c.onApply = function (e) { + e.setFloat("_ExposureAdjustment", c.exposureAdjustment); + }), + c + ); + } + return h.d(t, e), t; + })(Wt); + Ht.a.ShadersStore.depthVertexShader = + "\nattribute vec3 position;\n#include\n\n#include\nuniform mat4 viewProjection;\nuniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvarying float vDepthMetric;\nvoid main(void)\n{\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"; + Ht.a.ShadersStore.volumetricLightScatteringPixelShader = + "uniform sampler2D textureSampler;\nuniform sampler2D lightScatteringSampler;\nuniform float decay;\nuniform float exposure;\nuniform float weight;\nuniform float density;\nuniform vec2 meshPositionOnScreen;\nvarying vec2 vUV;\nvoid main(void) {\nvec2 tc=vUV;\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\nfloat illuminationDecay=1.0;\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\nfor(int i=0; i 0 && -1 !== this.excludedMeshes.indexOf(e) - } - , - t.prototype._createPass = function(e, t) { - var i = this - , n = e.getEngine(); - this._volumetricLightScatteringRTT = new li("volumetricLightScatteringMap",{ - width: n.getRenderWidth() * t, - height: n.getRenderHeight() * t - },e,false,true,_.a.TEXTURETYPE_UNSIGNED_INT), - this._volumetricLightScatteringRTT.wrapU = je.a.CLAMP_ADDRESSMODE, - this._volumetricLightScatteringRTT.wrapV = je.a.CLAMP_ADDRESSMODE, - this._volumetricLightScatteringRTT.renderList = null, - this._volumetricLightScatteringRTT.renderParticles = false, - this._volumetricLightScatteringRTT.ignoreCameraViewport = true; - var r = this.getCamera(); - r ? r.customRenderTargets.push(this._volumetricLightScatteringRTT) : e.customRenderTargets.push(this._volumetricLightScatteringRTT); - var o, s = function(e) { - var t = e.getRenderingMesh(); - if (!i._meshExcluded(t)) { - var n = e.getMaterial(); - if (n) { - var r = t.getScene() - , o = r.getEngine(); - o.setState(n.backFaceCulling); - var a = t._getInstancesRenderList(e._id); - if (!a.mustReturn) { - var s = o.getCaps().instancedArrays && null !== a.visibleInstances[e._id]; - if (i._isReady(e, s)) { - var c = i._volumetricLightScatteringPass; - if (t === i.mesh && (c = e.effect ? e.effect : n.getEffect()), - o.enableEffect(c), - t._bind(e, c, Mr.a.TriangleFillMode), - t === i.mesh) - n.bind(t.getWorldMatrix(), t); - else { - if (i._volumetricLightScatteringPass.setMatrix("viewProjection", r.getTransformMatrix()), - n && n.needAlphaTesting()) { - var u = n.getAlphaTestTexture(); - i._volumetricLightScatteringPass.setTexture("diffuseSampler", u), - u && i._volumetricLightScatteringPass.setMatrix("diffuseMatrix", u.getTextureMatrix()) - } - t.useBones && t.computeBonesUsingShaders && t.skeleton && i._volumetricLightScatteringPass.setMatrices("mBones", t.skeleton.getTransformMatrices(t)) - } - t._processRendering(e, i._volumetricLightScatteringPass, Mr.a.TriangleFillMode, a, s, function(e, t) { - return c.setMatrix("world", t) - }) - } - } + var a = n.join("\n"); + return ( + this._cachedDefines !== a && + ((this._cachedDefines = a), + (this._volumetricLightScatteringPass = i + .getScene() + .getEngine() + .createEffect( + { + vertexElement: "depth", + fragmentElement: "volumetricLightScatteringPass", + }, + r, + [ + "world", + "mBones", + "viewProjection", + "diffuseMatrix", + ], + ["diffuseSampler"], + a + ))), + this._volumetricLightScatteringPass.isReady() + ); + }), + (t.prototype.setCustomMeshPosition = function (e) { + this.customMeshPosition = e; + }), + (t.prototype.getCustomMeshPosition = function () { + return this.customMeshPosition; + }), + (t.prototype.dispose = function (t) { + var i = t + .getScene() + .customRenderTargets.indexOf( + this._volumetricLightScatteringRTT + ); + -1 !== i && t.getScene().customRenderTargets.splice(i, 1), + this._volumetricLightScatteringRTT.dispose(), + e.prototype.dispose.call(this, t); + }), + (t.prototype.getPass = function () { + return this._volumetricLightScatteringRTT; + }), + (t.prototype._meshExcluded = function (e) { + return ( + this.excludedMeshes.length > 0 && + -1 !== this.excludedMeshes.indexOf(e) + ); + }), + (t.prototype._createPass = function (e, t) { + var i = this, + n = e.getEngine(); + (this._volumetricLightScatteringRTT = new li( + "volumetricLightScatteringMap", + { + width: n.getRenderWidth() * t, + height: n.getRenderHeight() * t, + }, + e, + false, + true, + _.a.TEXTURETYPE_UNSIGNED_INT + )), + (this._volumetricLightScatteringRTT.wrapU = + je.a.CLAMP_ADDRESSMODE), + (this._volumetricLightScatteringRTT.wrapV = + je.a.CLAMP_ADDRESSMODE), + (this._volumetricLightScatteringRTT.renderList = null), + (this._volumetricLightScatteringRTT.renderParticles = false), + (this._volumetricLightScatteringRTT.ignoreCameraViewport = true); + var r = this.getCamera(); + r + ? r.customRenderTargets.push( + this._volumetricLightScatteringRTT + ) + : e.customRenderTargets.push( + this._volumetricLightScatteringRTT + ); + var o, + s = function (e) { + var t = e.getRenderingMesh(); + if (!i._meshExcluded(t)) { + var n = e.getMaterial(); + if (n) { + var r = t.getScene(), + o = r.getEngine(); + o.setState(n.backFaceCulling); + var a = t._getInstancesRenderList(e._id); + if (!a.mustReturn) { + var s = + o.getCaps().instancedArrays && + null !== a.visibleInstances[e._id]; + if (i._isReady(e, s)) { + var c = i._volumetricLightScatteringPass; + if ( + (t === i.mesh && + (c = e.effect ? e.effect : n.getEffect()), + o.enableEffect(c), + t._bind(e, c, Mr.a.TriangleFillMode), + t === i.mesh) + ) + n.bind(t.getWorldMatrix(), t); + else { + if ( + (i._volumetricLightScatteringPass.setMatrix( + "viewProjection", + r.getTransformMatrix() + ), + n && n.needAlphaTesting()) + ) { + var u = n.getAlphaTestTexture(); + i._volumetricLightScatteringPass.setTexture( + "diffuseSampler", + u + ), + u && + i._volumetricLightScatteringPass.setMatrix( + "diffuseMatrix", + u.getTextureMatrix() + ); + } + t.useBones && + t.computeBonesUsingShaders && + t.skeleton && + i._volumetricLightScatteringPass.setMatrices( + "mBones", + t.skeleton.getTransformMatrices(t) + ); } + t._processRendering( + e, + i._volumetricLightScatteringPass, + Mr.a.TriangleFillMode, + a, + s, + function (e, t) { + return c.setMatrix("world", t); + } + ); + } } - }, c = new a.f(0,0,0,1); - this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function() { - o = e.clearColor, - e.clearColor = c - }), - this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function() { - e.clearColor = o - }), - this._volumetricLightScatteringRTT.customRenderFunction = function(t, i, n, r) { - var o, a = e.getEngine(); - if (r.length) { - for (a.setColorWrite(false), - o = 0; o < r.length; o++) - s(r.data[o]); - a.setColorWrite(true) - } - for (o = 0; o < t.length; o++) - s(t.data[o]); - for (o = 0; o < i.length; o++) - s(i.data[o]); - if (n.length) { - for (o = 0; o < n.length; o++) { - var c = n.data[o] - , u = c.getBoundingInfo(); - u && e.activeCamera && (c._alphaIndex = c.getMesh().alphaIndex, - c._distanceToCamera = u.boundingSphere.centerWorld.subtract(e.activeCamera.position).length()) - } - var l = n.data.slice(0, n.length); - for (l.sort(function(e, t) { - return e._alphaIndex > t._alphaIndex ? 1 : e._alphaIndex < t._alphaIndex ? -1 : e._distanceToCamera < t._distanceToCamera ? 1 : e._distanceToCamera > t._distanceToCamera ? -1 : 0 - }), - a.setAlphaMode(_.a.ALPHA_COMBINE), - o = 0; o < l.length; o++) - s(l[o]); - a.setAlphaMode(_.a.ALPHA_DISABLE) - } + } } - } - , - t.prototype._updateMeshScreenCoordinates = function(e) { - var t, i = e.getTransformMatrix(); - t = this.useCustomMeshPosition ? this.customMeshPosition : this.attachedNode ? this.attachedNode.position : this.mesh.parent ? this.mesh.getAbsolutePosition() : this.mesh.position; - var n = a.x.Project(t, a.j.Identity(), i, this._viewPort); - this._screenCoordinates.x = n.x / this._viewPort.width, - this._screenCoordinates.y = n.y / this._viewPort.height, - this.invert && (this._screenCoordinates.y = 1 - this._screenCoordinates.y) - } - , - t.CreateDefaultMesh = function(e, t) { - var i = me.a.CreatePlane(e, 1, t); - i.billboardMode = Ne.a.BILLBOARDMODE_ALL; - var n = new bi.a(e + "Material",t); - return n.emissiveColor = new a.e(1,1,1), - i.material = n, - i - } - , - h.c([Object(F.o)()], t.prototype, "customMeshPosition", void 0), - h.c([Object(F.c)()], t.prototype, "useCustomMeshPosition", void 0), - h.c([Object(F.c)()], t.prototype, "invert", void 0), - h.c([Object(F.k)()], t.prototype, "mesh", void 0), - h.c([Object(F.c)()], t.prototype, "excludedMeshes", void 0), - h.c([Object(F.c)()], t.prototype, "exposure", void 0), - h.c([Object(F.c)()], t.prototype, "decay", void 0), - h.c([Object(F.c)()], t.prototype, "weight", void 0), - h.c([Object(F.c)()], t.prototype, "density", void 0), - t - }(Wt); - n(126), + }, + c = new a.f(0, 0, 0, 1); + this._volumetricLightScatteringRTT.onBeforeRenderObservable.add( + function () { + (o = e.clearColor), (e.clearColor = c); + } + ), + this._volumetricLightScatteringRTT.onAfterRenderObservable.add( + function () { + e.clearColor = o; + } + ), + (this._volumetricLightScatteringRTT.customRenderFunction = + function (t, i, n, r) { + var o, + a = e.getEngine(); + if (r.length) { + for ( + a.setColorWrite(false), o = 0; + o < r.length; + o++ + ) + s(r.data[o]); + a.setColorWrite(true); + } + for (o = 0; o < t.length; o++) s(t.data[o]); + for (o = 0; o < i.length; o++) s(i.data[o]); + if (n.length) { + for (o = 0; o < n.length; o++) { + var c = n.data[o], + u = c.getBoundingInfo(); + u && + e.activeCamera && + ((c._alphaIndex = c.getMesh().alphaIndex), + (c._distanceToCamera = + u.boundingSphere.centerWorld + .subtract(e.activeCamera.position) + .length())); + } + var l = n.data.slice(0, n.length); + for ( + l.sort(function (e, t) { + return e._alphaIndex > t._alphaIndex + ? 1 + : e._alphaIndex < t._alphaIndex + ? -1 + : e._distanceToCamera < t._distanceToCamera + ? 1 + : e._distanceToCamera > t._distanceToCamera + ? -1 + : 0; + }), + a.setAlphaMode(_.a.ALPHA_COMBINE), + o = 0; + o < l.length; + o++ + ) + s(l[o]); + a.setAlphaMode(_.a.ALPHA_DISABLE); + } + }); + }), + (t.prototype._updateMeshScreenCoordinates = function (e) { + var t, + i = e.getTransformMatrix(); + t = this.useCustomMeshPosition + ? this.customMeshPosition + : this.attachedNode + ? this.attachedNode.position + : this.mesh.parent + ? this.mesh.getAbsolutePosition() + : this.mesh.position; + var n = a.x.Project(t, a.j.Identity(), i, this._viewPort); + (this._screenCoordinates.x = n.x / this._viewPort.width), + (this._screenCoordinates.y = n.y / this._viewPort.height), + this.invert && + (this._screenCoordinates.y = + 1 - this._screenCoordinates.y); + }), + (t.CreateDefaultMesh = function (e, t) { + var i = me.a.CreatePlane(e, 1, t); + i.billboardMode = Ne.a.BILLBOARDMODE_ALL; + var n = new bi.a(e + "Material", t); + return ( + (n.emissiveColor = new a.e(1, 1, 1)), (i.material = n), i + ); + }), + h.c( + [Object(F.o)()], + t.prototype, + "customMeshPosition", + void 0 + ), + h.c( + [Object(F.c)()], + t.prototype, + "useCustomMeshPosition", + void 0 + ), + h.c([Object(F.c)()], t.prototype, "invert", void 0), + h.c([Object(F.k)()], t.prototype, "mesh", void 0), + h.c([Object(F.c)()], t.prototype, "excludedMeshes", void 0), + h.c([Object(F.c)()], t.prototype, "exposure", void 0), + h.c([Object(F.c)()], t.prototype, "decay", void 0), + h.c([Object(F.c)()], t.prototype, "weight", void 0), + h.c([Object(F.c)()], t.prototype, "density", void 0), + t + ); + })(Wt); + n(126), n(127), Object.defineProperty(Y.a.prototype, "forceShowBoundingBoxes", { - get: function() { - return this._forceShowBoundingBoxes || false - }, - set: function(e) { - this._forceShowBoundingBoxes = e, - e && this.getBoundingBoxRenderer() - }, - enumerable: true, - configurable: true + get: function () { + return this._forceShowBoundingBoxes || false; + }, + set: function (e) { + (this._forceShowBoundingBoxes = e), + e && this.getBoundingBoxRenderer(); + }, + enumerable: true, + configurable: true, }), - Y.a.prototype.getBoundingBoxRenderer = function() { - return this._boundingBoxRenderer || (this._boundingBoxRenderer = new Ds(this)), + (Y.a.prototype.getBoundingBoxRenderer = function () { + return ( + this._boundingBoxRenderer || + (this._boundingBoxRenderer = new Ds(this)), this._boundingBoxRenderer - } - , + ); + }), Object.defineProperty(Ne.a.prototype, "showBoundingBox", { - get: function() { - return this._showBoundingBox || false - }, - set: function(e) { - this._showBoundingBox = e, - e && this.getScene().getBoundingBoxRenderer() - }, - enumerable: true, - configurable: true + get: function () { + return this._showBoundingBox || false; + }, + set: function (e) { + (this._showBoundingBox = e), + e && this.getScene().getBoundingBoxRenderer(); + }, + enumerable: true, + configurable: true, }); - var Ds = function() { - function e(e) { - this.name = Se.a.NAME_BOUNDINGBOXRENDERER, - this.frontColor = new a.e(1,1,1), - this.backColor = new a.e(.1,.1,.1), - this.showBackLines = true, - this.renderList = new jt.a(32), - this._vertexBuffers = {}, - this.scene = e, - e._addComponent(this) + var Ds = (function () { + function e(e) { + (this.name = Se.a.NAME_BOUNDINGBOXRENDERER), + (this.frontColor = new a.e(1, 1, 1)), + (this.backColor = new a.e(0.1, 0.1, 0.1)), + (this.showBackLines = true), + (this.renderList = new jt.a(32)), + (this._vertexBuffers = {}), + (this.scene = e), + e._addComponent(this); + } + return ( + (e.prototype.register = function () { + this.scene._beforeEvaluateActiveMeshStage.registerStep( + Se.a.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER, + this, + this.reset + ), + this.scene._activeMeshStage.registerStep( + Se.a.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER, + this, + this._activeMesh + ), + this.scene._evaluateSubMeshStage.registerStep( + Se.a.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER, + this, + this._evaluateSubMesh + ), + this.scene._afterRenderingGroupDrawStage.registerStep( + Se.a.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER, + this, + this.render + ); + }), + (e.prototype._evaluateSubMesh = function (e, t) { + if (e.showSubMeshesBoundingBox) { + var i = t.getBoundingInfo(); + null != i && + ((i.boundingBox._tag = e.renderingGroupId), + this.renderList.push(i.boundingBox)); } - return e.prototype.register = function() { - this.scene._beforeEvaluateActiveMeshStage.registerStep(Se.a.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER, this, this.reset), - this.scene._activeMeshStage.registerStep(Se.a.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER, this, this._activeMesh), - this.scene._evaluateSubMeshStage.registerStep(Se.a.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER, this, this._evaluateSubMesh), - this.scene._afterRenderingGroupDrawStage.registerStep(Se.a.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER, this, this.render) + }), + (e.prototype._activeMesh = function (e, t) { + if ( + e.showBoundingBox || + this.scene.forceShowBoundingBoxes + ) { + var i = e.getBoundingInfo(); + (i.boundingBox._tag = t.renderingGroupId), + this.renderList.push(i.boundingBox); } - , - e.prototype._evaluateSubMesh = function(e, t) { - if (e.showSubMeshesBoundingBox) { - var i = t.getBoundingInfo(); - null != i && (i.boundingBox._tag = e.renderingGroupId, - this.renderList.push(i.boundingBox)) + }), + (e.prototype._prepareRessources = function () { + if (!this._colorShader) { + this._colorShader = new vo.a( + "colorShader", + this.scene, + "color", + { + attributes: [Si.b.PositionKind], + uniforms: ["world", "viewProjection", "color"], } + ); + var e = this.scene.getEngine(), + t = xi.a.CreateBox({ + size: 1, + }); + (this._vertexBuffers[Si.b.PositionKind] = new Si.b( + e, + t.positions, + Si.b.PositionKind, + false + )), + this._createIndexBuffer(); } - , - e.prototype._activeMesh = function(e, t) { - if (e.showBoundingBox || this.scene.forceShowBoundingBoxes) { - var i = e.getBoundingInfo(); - i.boundingBox._tag = t.renderingGroupId, - this.renderList.push(i.boundingBox) - } - } - , - e.prototype._prepareRessources = function() { - if (!this._colorShader) { - this._colorShader = new vo.a("colorShader",this.scene,"color",{ - attributes: [Si.b.PositionKind], - uniforms: ["world", "viewProjection", "color"] - }); - var e = this.scene.getEngine() - , t = xi.a.CreateBox({ - size: 1 - }); - this._vertexBuffers[Si.b.PositionKind] = new Si.b(e,t.positions,Si.b.PositionKind,false), - this._createIndexBuffer() - } - } - , - e.prototype._createIndexBuffer = function() { - var e = this.scene.getEngine(); - this._indexBuffer = e.createIndexBuffer([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 7, 1, 6, 2, 5, 3, 4]) - } - , - e.prototype.rebuild = function() { - var e = this._vertexBuffers[Si.b.PositionKind]; - e && e._rebuild(), - this._createIndexBuffer() - } - , - e.prototype.reset = function() { - this.renderList.reset() - } - , - e.prototype.render = function(e) { - if (0 !== this.renderList.length && (this._prepareRessources(), - this._colorShader.isReady())) { - var t = this.scene.getEngine(); - t.setDepthWrite(false), - this._colorShader._preBind(); - for (var i = 0; i < this.renderList.length; i++) { - var n = this.renderList.data[i]; - if (n._tag === e) { - var r = n.minimum - , o = n.maximum.subtract(r) - , s = r.add(o.scale(.5)) - , c = a.j.Scaling(o.x, o.y, o.z).multiply(a.j.Translation(s.x, s.y, s.z)).multiply(n.getWorldMatrix()); - t.bindBuffers(this._vertexBuffers, this._indexBuffer, this._colorShader.getEffect()), - this.showBackLines && (t.setDepthFunctionToGreaterOrEqual(), - this.scene.resetCachedMaterial(), - this._colorShader.setColor4("color", this.backColor.toColor4()), - this._colorShader.bind(c), - t.drawElementsType(Mr.a.LineListDrawMode, 0, 24)), - t.setDepthFunctionToLess(), - this.scene.resetCachedMaterial(), - this._colorShader.setColor4("color", this.frontColor.toColor4()), - this._colorShader.bind(c), - t.drawElementsType(Mr.a.LineListDrawMode, 0, 24) - } - } - this._colorShader.unbind(), - t.setDepthFunctionToLessOrEqual(), - t.setDepthWrite(true) - } - } - , - e.prototype.renderOcclusionBoundingBox = function(e) { - if (this._prepareRessources(), - this._colorShader.isReady() && e._boundingInfo) { - var t = this.scene.getEngine(); - t.setDepthWrite(false), - t.setColorWrite(false), - this._colorShader._preBind(); - var i = e._boundingInfo.boundingBox - , n = i.minimum - , r = i.maximum.subtract(n) - , o = n.add(r.scale(.5)) - , s = a.j.Scaling(r.x, r.y, r.z).multiply(a.j.Translation(o.x, o.y, o.z)).multiply(i.getWorldMatrix()); - t.bindBuffers(this._vertexBuffers, this._indexBuffer, this._colorShader.getEffect()), + }), + (e.prototype._createIndexBuffer = function () { + var e = this.scene.getEngine(); + this._indexBuffer = e.createIndexBuffer([ + 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 7, 1, + 6, 2, 5, 3, 4, + ]); + }), + (e.prototype.rebuild = function () { + var e = this._vertexBuffers[Si.b.PositionKind]; + e && e._rebuild(), this._createIndexBuffer(); + }), + (e.prototype.reset = function () { + this.renderList.reset(); + }), + (e.prototype.render = function (e) { + if ( + 0 !== this.renderList.length && + (this._prepareRessources(), this._colorShader.isReady()) + ) { + var t = this.scene.getEngine(); + t.setDepthWrite(false), this._colorShader._preBind(); + for (var i = 0; i < this.renderList.length; i++) { + var n = this.renderList.data[i]; + if (n._tag === e) { + var r = n.minimum, + o = n.maximum.subtract(r), + s = r.add(o.scale(0.5)), + c = a.j + .Scaling(o.x, o.y, o.z) + .multiply(a.j.Translation(s.x, s.y, s.z)) + .multiply(n.getWorldMatrix()); + t.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + this._colorShader.getEffect() + ), + this.showBackLines && + (t.setDepthFunctionToGreaterOrEqual(), + this.scene.resetCachedMaterial(), + this._colorShader.setColor4( + "color", + this.backColor.toColor4() + ), + this._colorShader.bind(c), + t.drawElementsType(Mr.a.LineListDrawMode, 0, 24)), t.setDepthFunctionToLess(), this.scene.resetCachedMaterial(), - this._colorShader.bind(s), - t.drawElementsType(Mr.a.LineListDrawMode, 0, 24), - this._colorShader.unbind(), - t.setDepthFunctionToLessOrEqual(), - t.setDepthWrite(true), - t.setColorWrite(true) + this._colorShader.setColor4( + "color", + this.frontColor.toColor4() + ), + this._colorShader.bind(c), + t.drawElementsType(Mr.a.LineListDrawMode, 0, 24); } + } + this._colorShader.unbind(), + t.setDepthFunctionToLessOrEqual(), + t.setDepthWrite(true); } - , - e.prototype.dispose = function() { - if (this._colorShader) { - this.renderList.dispose(), - this._colorShader.dispose(); - var e = this._vertexBuffers[Si.b.PositionKind]; - e && (e.dispose(), - this._vertexBuffers[Si.b.PositionKind] = null), - this.scene.getEngine()._releaseBuffer(this._indexBuffer) + }), + (e.prototype.renderOcclusionBoundingBox = function (e) { + if ( + (this._prepareRessources(), + this._colorShader.isReady() && e._boundingInfo) + ) { + var t = this.scene.getEngine(); + t.setDepthWrite(false), + t.setColorWrite(false), + this._colorShader._preBind(); + var i = e._boundingInfo.boundingBox, + n = i.minimum, + r = i.maximum.subtract(n), + o = n.add(r.scale(0.5)), + s = a.j + .Scaling(r.x, r.y, r.z) + .multiply(a.j.Translation(o.x, o.y, o.z)) + .multiply(i.getWorldMatrix()); + t.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + this._colorShader.getEffect() + ), + t.setDepthFunctionToLess(), + this.scene.resetCachedMaterial(), + this._colorShader.bind(s), + t.drawElementsType(Mr.a.LineListDrawMode, 0, 24), + this._colorShader.unbind(), + t.setDepthFunctionToLessOrEqual(), + t.setDepthWrite(true), + t.setColorWrite(true); + } + }), + (e.prototype.dispose = function () { + if (this._colorShader) { + this.renderList.dispose(), this._colorShader.dispose(); + var e = this._vertexBuffers[Si.b.PositionKind]; + e && + (e.dispose(), + (this._vertexBuffers[Si.b.PositionKind] = null)), + this.scene + .getEngine() + ._releaseBuffer(this._indexBuffer); + } + }), + e + ); + })(); + Ht.a.ShadersStore.depthPixelShader = + "#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nvarying float vDepthMetric;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragColor=vec4(vDepthMetric,vDepthMetric*vDepthMetric,0.0,1.0);\n}"; + var Ls = (function () { + function e(t, i, n) { + var r = this; + void 0 === i && (i = _.a.TEXTURETYPE_FLOAT), + void 0 === n && (n = null), + (this.useOnlyInActiveCamera = false), + (this._scene = t), + e._SceneComponentInitialization(this._scene), + (this._camera = n); + var o = t.getEngine(); + (this._depthMap = new li( + "depthMap", + { + width: o.getRenderWidth(), + height: o.getRenderHeight(), + }, + this._scene, + false, + true, + i + )), + (this._depthMap.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._depthMap.wrapV = je.a.CLAMP_ADDRESSMODE), + (this._depthMap.refreshRate = 1), + (this._depthMap.renderParticles = false), + (this._depthMap.renderList = null), + (this._depthMap.activeCamera = this._camera), + (this._depthMap.ignoreCameraViewport = true), + (this._depthMap.useCameraPostProcesses = false), + this._depthMap.onClearObservable.add(function (e) { + e.clear(new a.f(1, 1, 1, 1), true, true, true); + }); + var s = function (e) { + var t = e.getRenderingMesh(), + i = r._scene, + n = i.getEngine(), + o = e.getMaterial(); + if (o) { + n.setState( + o.backFaceCulling, + 0, + false, + i.useRightHandedSystem + ); + var a = t._getInstancesRenderList(e._id); + if (!a.mustReturn) { + var s = + n.getCaps().instancedArrays && + null !== a.visibleInstances[e._id], + c = r._camera || i.activeCamera; + if (r.isReady(e, s) && c) { + if ( + (n.enableEffect(r._effect), + t._bind(e, r._effect, Mr.a.TriangleFillMode), + r._effect.setMatrix( + "viewProjection", + i.getTransformMatrix() + ), + r._effect.setFloat2( + "depthValues", + c.minZ, + c.minZ + c.maxZ + ), + o && o.needAlphaTesting()) + ) { + var u = o.getAlphaTestTexture(); + u && + (r._effect.setTexture("diffuseSampler", u), + r._effect.setMatrix( + "diffuseMatrix", + u.getTextureMatrix() + )); + } + t.useBones && + t.computeBonesUsingShaders && + t.skeleton && + r._effect.setMatrices( + "mBones", + t.skeleton.getTransformMatrices(t) + ), + t._processRendering( + e, + r._effect, + Mr.a.TriangleFillMode, + a, + s, + function (e, t) { + return r._effect.setMatrix("world", t); + } + ); } + } } - , - e - }(); - Ht.a.ShadersStore.depthPixelShader = "#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nvarying float vDepthMetric;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragColor=vec4(vDepthMetric,vDepthMetric*vDepthMetric,0.0,1.0);\n}"; - var Ls = function() { - function e(t, i, n) { - var r = this; - void 0 === i && (i = _.a.TEXTURETYPE_FLOAT), - void 0 === n && (n = null), - this.useOnlyInActiveCamera = false, - this._scene = t, - e._SceneComponentInitialization(this._scene), - this._camera = n; - var o = t.getEngine(); - this._depthMap = new li("depthMap",{ - width: o.getRenderWidth(), - height: o.getRenderHeight() - },this._scene,false,true,i), - this._depthMap.wrapU = je.a.CLAMP_ADDRESSMODE, - this._depthMap.wrapV = je.a.CLAMP_ADDRESSMODE, - this._depthMap.refreshRate = 1, - this._depthMap.renderParticles = false, - this._depthMap.renderList = null, - this._depthMap.activeCamera = this._camera, - this._depthMap.ignoreCameraViewport = true, - this._depthMap.useCameraPostProcesses = false, - this._depthMap.onClearObservable.add(function(e) { - e.clear(new a.f(1,1,1,1), true, true, true) - }); - var s = function(e) { - var t = e.getRenderingMesh() - , i = r._scene - , n = i.getEngine() - , o = e.getMaterial(); - if (o) { - n.setState(o.backFaceCulling, 0, false, i.useRightHandedSystem); - var a = t._getInstancesRenderList(e._id); - if (!a.mustReturn) { - var s = n.getCaps().instancedArrays && null !== a.visibleInstances[e._id] - , c = r._camera || i.activeCamera; - if (r.isReady(e, s) && c) { - if (n.enableEffect(r._effect), - t._bind(e, r._effect, Mr.a.TriangleFillMode), - r._effect.setMatrix("viewProjection", i.getTransformMatrix()), - r._effect.setFloat2("depthValues", c.minZ, c.minZ + c.maxZ), - o && o.needAlphaTesting()) { - var u = o.getAlphaTestTexture(); - u && (r._effect.setTexture("diffuseSampler", u), - r._effect.setMatrix("diffuseMatrix", u.getTextureMatrix())) - } - t.useBones && t.computeBonesUsingShaders && t.skeleton && r._effect.setMatrices("mBones", t.skeleton.getTransformMatrices(t)), - t._processRendering(e, r._effect, Mr.a.TriangleFillMode, a, s, function(e, t) { - return r._effect.setMatrix("world", t) - }) - } - } - } - }; - this._depthMap.customRenderFunction = function(e, t, i, n) { - var r; - if (n.length) { - for (o.setColorWrite(false), - r = 0; r < n.length; r++) - s(n.data[r]); - o.setColorWrite(true) - } - for (r = 0; r < e.length; r++) - s(e.data[r]); - for (r = 0; r < t.length; r++) - s(t.data[r]) - } + }; + this._depthMap.customRenderFunction = function (e, t, i, n) { + var r; + if (n.length) { + for (o.setColorWrite(false), r = 0; r < n.length; r++) + s(n.data[r]); + o.setColorWrite(true); } - return e.prototype.isReady = function(e, t) { - var i = e.getMaterial(); - if (i.disableDepthWrite) - return false; - var n = [] - , r = [Si.b.PositionKind] - , o = e.getMesh(); - i && i.needAlphaTesting() && i.getAlphaTestTexture() && (n.push("#define ALPHATEST"), - o.isVerticesDataPresent(Si.b.UVKind) && (r.push(Si.b.UVKind), - n.push("#define UV1")), - o.isVerticesDataPresent(Si.b.UV2Kind) && (r.push(Si.b.UV2Kind), - n.push("#define UV2"))), - o.useBones && o.computeBonesUsingShaders ? (r.push(Si.b.MatricesIndicesKind), - r.push(Si.b.MatricesWeightsKind), - o.numBoneInfluencers > 4 && (r.push(Si.b.MatricesIndicesExtraKind), - r.push(Si.b.MatricesWeightsExtraKind)), - n.push("#define NUM_BONE_INFLUENCERS " + o.numBoneInfluencers), - n.push("#define BonesPerMesh " + (o.skeleton ? o.skeleton.bones.length + 1 : 0))) : n.push("#define NUM_BONE_INFLUENCERS 0"), - t && (n.push("#define INSTANCES"), + for (r = 0; r < e.length; r++) s(e.data[r]); + for (r = 0; r < t.length; r++) s(t.data[r]); + }; + } + return ( + (e.prototype.isReady = function (e, t) { + var i = e.getMaterial(); + if (i.disableDepthWrite) return false; + var n = [], + r = [Si.b.PositionKind], + o = e.getMesh(); + i && + i.needAlphaTesting() && + i.getAlphaTestTexture() && + (n.push("#define ALPHATEST"), + o.isVerticesDataPresent(Si.b.UVKind) && + (r.push(Si.b.UVKind), n.push("#define UV1")), + o.isVerticesDataPresent(Si.b.UV2Kind) && + (r.push(Si.b.UV2Kind), n.push("#define UV2"))), + o.useBones && o.computeBonesUsingShaders + ? (r.push(Si.b.MatricesIndicesKind), + r.push(Si.b.MatricesWeightsKind), + o.numBoneInfluencers > 4 && + (r.push(Si.b.MatricesIndicesExtraKind), + r.push(Si.b.MatricesWeightsExtraKind)), + n.push( + "#define NUM_BONE_INFLUENCERS " + + o.numBoneInfluencers + ), + n.push( + "#define BonesPerMesh " + + (o.skeleton ? o.skeleton.bones.length + 1 : 0) + )) + : n.push("#define NUM_BONE_INFLUENCERS 0"), + t && + (n.push("#define INSTANCES"), r.push("world0"), r.push("world1"), r.push("world2"), r.push("world3")); - var a = n.join("\n"); - return this._cachedDefines !== a && (this._cachedDefines = a, - this._effect = this._scene.getEngine().createEffect("depth", r, ["world", "mBones", "viewProjection", "diffuseMatrix", "depthValues"], ["diffuseSampler"], a)), - this._effect.isReady() - } - , - e.prototype.getDepthMap = function() { - return this._depthMap - } - , - e.prototype.dispose = function() { - this._depthMap.dispose() - } - , - e._SceneComponentInitialization = function(e) { - throw Te.a.WarnImport("DepthRendererSceneComponent") - } - , - e - }(); - Y.a.prototype.enableDepthRenderer = function(e) { - if (!(e = e || this.activeCamera)) - throw "No camera available to enable depth renderer"; - if (this._depthRenderer || (this._depthRenderer = {}), - !this._depthRenderer[e.id]) { - var t = 0; - if (this.getEngine().getCaps().textureHalfFloatRender) - t = _.a.TEXTURETYPE_HALF_FLOAT; - else { - if (!this.getEngine().getCaps().textureFloatRender) - throw "Depth renderer does not support int texture type"; - t = _.a.TEXTURETYPE_FLOAT - } - this._depthRenderer[e.id] = new Ls(this,t,e) - } - return this._depthRenderer[e.id] + var a = n.join("\n"); + return ( + this._cachedDefines !== a && + ((this._cachedDefines = a), + (this._effect = this._scene + .getEngine() + .createEffect( + "depth", + r, + [ + "world", + "mBones", + "viewProjection", + "diffuseMatrix", + "depthValues", + ], + ["diffuseSampler"], + a + ))), + this._effect.isReady() + ); + }), + (e.prototype.getDepthMap = function () { + return this._depthMap; + }), + (e.prototype.dispose = function () { + this._depthMap.dispose(); + }), + (e._SceneComponentInitialization = function (e) { + throw Te.a.WarnImport("DepthRendererSceneComponent"); + }), + e + ); + })(); + (Y.a.prototype.enableDepthRenderer = function (e) { + if (!(e = e || this.activeCamera)) + throw "No camera available to enable depth renderer"; + if ( + (this._depthRenderer || (this._depthRenderer = {}), + !this._depthRenderer[e.id]) + ) { + var t = 0; + if (this.getEngine().getCaps().textureHalfFloatRender) + t = _.a.TEXTURETYPE_HALF_FLOAT; + else { + if (!this.getEngine().getCaps().textureFloatRender) + throw "Depth renderer does not support int texture type"; + t = _.a.TEXTURETYPE_FLOAT; + } + this._depthRenderer[e.id] = new Ls(this, t, e); } - , - Y.a.prototype.disableDepthRenderer = function(e) { - (e = e || this.activeCamera) && this._depthRenderer && this._depthRenderer[e.id] && (this._depthRenderer[e.id].dispose(), - delete this._depthRenderer[e.id]) + return this._depthRenderer[e.id]; + }), + (Y.a.prototype.disableDepthRenderer = function (e) { + (e = e || this.activeCamera) && + this._depthRenderer && + this._depthRenderer[e.id] && + (this._depthRenderer[e.id].dispose(), + delete this._depthRenderer[e.id]); + }); + var Fs = (function () { + function e(e) { + (this.name = Se.a.NAME_DEPTHRENDERER), (this.scene = e); } - ; - var Fs = function() { - function e(e) { - this.name = Se.a.NAME_DEPTHRENDERER, - this.scene = e - } - return e.prototype.register = function() { - this.scene._gatherRenderTargetsStage.registerStep(Se.a.STEP_GATHERRENDERTARGETS_DEPTHRENDERER, this, this._gatherRenderTargets), - this.scene._gatherActiveCameraRenderTargetsStage.registerStep(Se.a.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER, this, this._gatherActiveCameraRenderTargets) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() { - for (var e in this.scene._depthRenderer) - this.scene._depthRenderer[e].dispose() - } - , - e.prototype._gatherRenderTargets = function(e) { - if (this.scene._depthRenderer) - for (var t in this.scene._depthRenderer) { - var i = this.scene._depthRenderer[t]; - i.useOnlyInActiveCamera || e.push(i.getDepthMap()) - } - } - , - e.prototype._gatherActiveCameraRenderTargets = function(e) { - if (this.scene._depthRenderer) - for (var t in this.scene._depthRenderer) { - var i = this.scene._depthRenderer[t]; - i.useOnlyInActiveCamera && this.scene.activeCamera.id === t && e.push(i.getDepthMap()) - } - } - , - e - }(); - Ls._SceneComponentInitialization = function(e) { - var t = e._getComponent(Se.a.NAME_DEPTHRENDERER); - t || (t = new Fs(e), - e._addComponent(t)) - } - ; - Ht.a.ShadersStore.linePixelShader = "uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}"; - Ht.a.ShadersStore.lineVertexShader = "\nattribute vec3 position;\nattribute vec4 normal;\n\nuniform mat4 worldViewProjection;\nuniform float width;\nuniform float aspectRatio;\nvoid main(void) {\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n}", - Ne.a.prototype.disableEdgesRendering = function() { - return this._edgesRenderer && (this._edgesRenderer.dispose(), - this._edgesRenderer = null), + return ( + (e.prototype.register = function () { + this.scene._gatherRenderTargetsStage.registerStep( + Se.a.STEP_GATHERRENDERTARGETS_DEPTHRENDERER, + this, + this._gatherRenderTargets + ), + this.scene._gatherActiveCameraRenderTargetsStage.registerStep( + Se.a.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER, + this, + this._gatherActiveCameraRenderTargets + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () { + for (var e in this.scene._depthRenderer) + this.scene._depthRenderer[e].dispose(); + }), + (e.prototype._gatherRenderTargets = function (e) { + if (this.scene._depthRenderer) + for (var t in this.scene._depthRenderer) { + var i = this.scene._depthRenderer[t]; + i.useOnlyInActiveCamera || e.push(i.getDepthMap()); + } + }), + (e.prototype._gatherActiveCameraRenderTargets = function (e) { + if (this.scene._depthRenderer) + for (var t in this.scene._depthRenderer) { + var i = this.scene._depthRenderer[t]; + i.useOnlyInActiveCamera && + this.scene.activeCamera.id === t && + e.push(i.getDepthMap()); + } + }), + e + ); + })(); + Ls._SceneComponentInitialization = function (e) { + var t = e._getComponent(Se.a.NAME_DEPTHRENDERER); + t || ((t = new Fs(e)), e._addComponent(t)); + }; + Ht.a.ShadersStore.linePixelShader = + "uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}"; + (Ht.a.ShadersStore.lineVertexShader = + "\nattribute vec3 position;\nattribute vec4 normal;\n\nuniform mat4 worldViewProjection;\nuniform float width;\nuniform float aspectRatio;\nvoid main(void) {\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n}"), + (Ne.a.prototype.disableEdgesRendering = function () { + return ( + this._edgesRenderer && + (this._edgesRenderer.dispose(), + (this._edgesRenderer = null)), this - } - , - Ne.a.prototype.enableEdgesRendering = function(e, t) { - return void 0 === e && (e = .95), - void 0 === t && (t = false), - this.disableEdgesRendering(), - this._edgesRenderer = new Ns(this,e,t), - this - } - , - Object.defineProperty(Ne.a.prototype, "edgesRenderer", { - get: function() { - return this._edgesRenderer - }, - enumerable: true, - configurable: true + ); }), - Ko.b.prototype.enableEdgesRendering = function(e, t) { - return void 0 === e && (e = .95), + (Ne.a.prototype.enableEdgesRendering = function (e, t) { + return ( + void 0 === e && (e = 0.95), void 0 === t && (t = false), this.disableEdgesRendering(), - this._edgesRenderer = new ks(this,e,t), + (this._edgesRenderer = new Ns(this, e, t)), this - } - , - Ko.a.prototype.enableEdgesRendering = function(e, t) { - return void 0 === e && (e = .95), + ); + }), + Object.defineProperty(Ne.a.prototype, "edgesRenderer", { + get: function () { + return this._edgesRenderer; + }, + enumerable: true, + configurable: true, + }), + (Ko.b.prototype.enableEdgesRendering = function (e, t) { + return ( + void 0 === e && (e = 0.95), + void 0 === t && (t = false), + this.disableEdgesRendering(), + (this._edgesRenderer = new ks(this, e, t)), + this + ); + }), + (Ko.a.prototype.enableEdgesRendering = function (e, t) { + return ( + void 0 === e && (e = 0.95), void 0 === t && (t = false), Ko.b.prototype.enableEdgesRendering.apply(this, arguments), this - } - ; - var Bs = function() { - this.edges = new Array, - this.edgesConnectedCount = 0 - } - , Ns = function() { - function e(e, t, i, n) { - var r = this; - void 0 === t && (t = .95), - void 0 === i && (i = false), - void 0 === n && (n = true), - this.edgesWidthScalerForOrthographic = 1e3, - this.edgesWidthScalerForPerspective = 50, - this._linesPositions = new Array, - this._linesNormals = new Array, - this._linesIndices = new Array, - this._buffers = {}, - this._checkVerticesInsteadOfIndices = false, - this.isEnabled = true, - this._source = e, - this._checkVerticesInsteadOfIndices = i, - this._epsilon = t, - this._prepareRessources(), - n && this._generateEdgesLines(), - this._meshRebuildObserver = this._source.onRebuildObservable.add(function() { - r._rebuild() - }), - this._meshDisposeObserver = this._source.onDisposeObservable.add(function() { - r.dispose() - }) - } - return e.prototype._prepareRessources = function() { - this._lineShader || (this._lineShader = new vo.a("lineShader",this._source.getScene(),"line",{ + ); + }); + var Bs = function () { + (this.edges = new Array()), (this.edgesConnectedCount = 0); + }, + Ns = (function () { + function e(e, t, i, n) { + var r = this; + void 0 === t && (t = 0.95), + void 0 === i && (i = false), + void 0 === n && (n = true), + (this.edgesWidthScalerForOrthographic = 1e3), + (this.edgesWidthScalerForPerspective = 50), + (this._linesPositions = new Array()), + (this._linesNormals = new Array()), + (this._linesIndices = new Array()), + (this._buffers = {}), + (this._checkVerticesInsteadOfIndices = false), + (this.isEnabled = true), + (this._source = e), + (this._checkVerticesInsteadOfIndices = i), + (this._epsilon = t), + this._prepareRessources(), + n && this._generateEdgesLines(), + (this._meshRebuildObserver = + this._source.onRebuildObservable.add(function () { + r._rebuild(); + })), + (this._meshDisposeObserver = + this._source.onDisposeObservable.add(function () { + r.dispose(); + })); + } + return ( + (e.prototype._prepareRessources = function () { + this._lineShader || + ((this._lineShader = new vo.a( + "lineShader", + this._source.getScene(), + "line", + { attributes: ["position", "normal"], - uniforms: ["worldViewProjection", "color", "width", "aspectRatio"] - }), - this._lineShader.disableDepthWrite = true, - this._lineShader.backFaceCulling = false) - } - , - e.prototype._rebuild = function() { - var e = this._buffers[Si.b.PositionKind]; - e && e._rebuild(), + uniforms: [ + "worldViewProjection", + "color", + "width", + "aspectRatio", + ], + } + )), + (this._lineShader.disableDepthWrite = true), + (this._lineShader.backFaceCulling = false)); + }), + (e.prototype._rebuild = function () { + var e = this._buffers[Si.b.PositionKind]; + e && e._rebuild(), (e = this._buffers[Si.b.NormalKind]) && e._rebuild(); - var t = this._source.getScene().getEngine(); - this._ib = t.createIndexBuffer(this._linesIndices) - } - , - e.prototype.dispose = function() { - this._source.onRebuildObservable.remove(this._meshRebuildObserver), - this._source.onDisposeObservable.remove(this._meshDisposeObserver); - var e = this._buffers[Si.b.PositionKind]; - e && (e.dispose(), - this._buffers[Si.b.PositionKind] = null), - (e = this._buffers[Si.b.NormalKind]) && (e.dispose(), - this._buffers[Si.b.NormalKind] = null), - this._source.getScene().getEngine()._releaseBuffer(this._ib), - this._lineShader.dispose() - } - , - e.prototype._processEdgeForAdjacencies = function(e, t, i, n, r) { - return e === i && t === n || e === n && t === i ? 0 : e === n && t === r || e === r && t === n ? 1 : e === r && t === i || e === i && t === r ? 2 : -1 - } - , - e.prototype._processEdgeForAdjacenciesWithVertices = function(e, t, i, n, r) { - return e.equalsWithEpsilon(i) && t.equalsWithEpsilon(n) || e.equalsWithEpsilon(n) && t.equalsWithEpsilon(i) ? 0 : e.equalsWithEpsilon(n) && t.equalsWithEpsilon(r) || e.equalsWithEpsilon(r) && t.equalsWithEpsilon(n) ? 1 : e.equalsWithEpsilon(r) && t.equalsWithEpsilon(i) || e.equalsWithEpsilon(i) && t.equalsWithEpsilon(r) ? 2 : -1 - } - , - e.prototype._checkEdge = function(e, t, i, n, r) { - (void 0 === t || a.x.Dot(i[e], i[t]) < this._epsilon) && this.createLine(n, r, this._linesPositions.length / 3) - } - , - e.prototype.createLine = function(e, t, i) { - this._linesPositions.push(e.x, e.y, e.z, e.x, e.y, e.z, t.x, t.y, t.z, t.x, t.y, t.z), - this._linesNormals.push(t.x, t.y, t.z, -1, t.x, t.y, t.z, 1, e.x, e.y, e.z, -1, e.x, e.y, e.z, 1), - this._linesIndices.push(i, i + 1, i + 2, i, i + 2, i + 3) - } - , - e.prototype._generateEdgesLines = function() { - var e = this._source.getVerticesData(Si.b.PositionKind) - , t = this._source.getIndices(); - if (t && e) { - var i, n, r = new Array, o = new Array; - for (i = 0; i < t.length; i += 3) { - n = new Bs; - var s = t[i] - , c = t[i + 1] - , u = t[i + 2]; - n.p0 = new a.x(e[3 * s],e[3 * s + 1],e[3 * s + 2]), - n.p1 = new a.x(e[3 * c],e[3 * c + 1],e[3 * c + 2]), - n.p2 = new a.x(e[3 * u],e[3 * u + 1],e[3 * u + 2]); - var l = a.x.Cross(n.p1.subtract(n.p0), n.p2.subtract(n.p1)); - l.normalize(), - o.push(l), - r.push(n) - } - for (i = 0; i < r.length; i++) { - n = r[i]; - for (var h = i + 1; h < r.length; h++) { - var f = r[h]; - if (3 === n.edgesConnectedCount) - break; - if (3 !== f.edgesConnectedCount) - for (var d = t[3 * h], p = t[3 * h + 1], m = t[3 * h + 2], g = 0; g < 3; g++) { - var _ = 0; - if (void 0 === n.edges[g]) { - switch (g) { - case 0: - _ = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(n.p0, n.p1, f.p0, f.p1, f.p2) : this._processEdgeForAdjacencies(t[3 * i], t[3 * i + 1], d, p, m); - break; - case 1: - _ = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(n.p1, n.p2, f.p0, f.p1, f.p2) : this._processEdgeForAdjacencies(t[3 * i + 1], t[3 * i + 2], d, p, m); - break; - case 2: - _ = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(n.p2, n.p0, f.p0, f.p1, f.p2) : this._processEdgeForAdjacencies(t[3 * i + 2], t[3 * i], d, p, m) - } - if (-1 !== _ && (n.edges[g] = h, - f.edges[_] = i, - n.edgesConnectedCount++, - f.edgesConnectedCount++, - 3 === n.edgesConnectedCount)) - break - } - } + var t = this._source.getScene().getEngine(); + this._ib = t.createIndexBuffer(this._linesIndices); + }), + (e.prototype.dispose = function () { + this._source.onRebuildObservable.remove( + this._meshRebuildObserver + ), + this._source.onDisposeObservable.remove( + this._meshDisposeObserver + ); + var e = this._buffers[Si.b.PositionKind]; + e && + (e.dispose(), + (this._buffers[Si.b.PositionKind] = null)), + (e = this._buffers[Si.b.NormalKind]) && + (e.dispose(), + (this._buffers[Si.b.NormalKind] = null)), + this._source + .getScene() + .getEngine() + ._releaseBuffer(this._ib), + this._lineShader.dispose(); + }), + (e.prototype._processEdgeForAdjacencies = function ( + e, + t, + i, + n, + r + ) { + return (e === i && t === n) || (e === n && t === i) + ? 0 + : (e === n && t === r) || (e === r && t === n) + ? 1 + : (e === r && t === i) || (e === i && t === r) + ? 2 + : -1; + }), + (e.prototype._processEdgeForAdjacenciesWithVertices = + function (e, t, i, n, r) { + return (e.equalsWithEpsilon(i) && + t.equalsWithEpsilon(n)) || + (e.equalsWithEpsilon(n) && t.equalsWithEpsilon(i)) + ? 0 + : (e.equalsWithEpsilon(n) && + t.equalsWithEpsilon(r)) || + (e.equalsWithEpsilon(r) && t.equalsWithEpsilon(n)) + ? 1 + : (e.equalsWithEpsilon(r) && + t.equalsWithEpsilon(i)) || + (e.equalsWithEpsilon(i) && t.equalsWithEpsilon(r)) + ? 2 + : -1; + }), + (e.prototype._checkEdge = function (e, t, i, n, r) { + (void 0 === t || a.x.Dot(i[e], i[t]) < this._epsilon) && + this.createLine(n, r, this._linesPositions.length / 3); + }), + (e.prototype.createLine = function (e, t, i) { + this._linesPositions.push( + e.x, + e.y, + e.z, + e.x, + e.y, + e.z, + t.x, + t.y, + t.z, + t.x, + t.y, + t.z + ), + this._linesNormals.push( + t.x, + t.y, + t.z, + -1, + t.x, + t.y, + t.z, + 1, + e.x, + e.y, + e.z, + -1, + e.x, + e.y, + e.z, + 1 + ), + this._linesIndices.push( + i, + i + 1, + i + 2, + i, + i + 2, + i + 3 + ); + }), + (e.prototype._generateEdgesLines = function () { + var e = this._source.getVerticesData(Si.b.PositionKind), + t = this._source.getIndices(); + if (t && e) { + var i, + n, + r = new Array(), + o = new Array(); + for (i = 0; i < t.length; i += 3) { + n = new Bs(); + var s = t[i], + c = t[i + 1], + u = t[i + 2]; + (n.p0 = new a.x( + e[3 * s], + e[3 * s + 1], + e[3 * s + 2] + )), + (n.p1 = new a.x( + e[3 * c], + e[3 * c + 1], + e[3 * c + 2] + )), + (n.p2 = new a.x( + e[3 * u], + e[3 * u + 1], + e[3 * u + 2] + )); + var l = a.x.Cross( + n.p1.subtract(n.p0), + n.p2.subtract(n.p1) + ); + l.normalize(), o.push(l), r.push(n); + } + for (i = 0; i < r.length; i++) { + n = r[i]; + for (var h = i + 1; h < r.length; h++) { + var f = r[h]; + if (3 === n.edgesConnectedCount) break; + if (3 !== f.edgesConnectedCount) + for ( + var d = t[3 * h], + p = t[3 * h + 1], + m = t[3 * h + 2], + g = 0; + g < 3; + g++ + ) { + var _ = 0; + if (void 0 === n.edges[g]) { + switch (g) { + case 0: + _ = this._checkVerticesInsteadOfIndices + ? this._processEdgeForAdjacenciesWithVertices( + n.p0, + n.p1, + f.p0, + f.p1, + f.p2 + ) + : this._processEdgeForAdjacencies( + t[3 * i], + t[3 * i + 1], + d, + p, + m + ); + break; + case 1: + _ = this._checkVerticesInsteadOfIndices + ? this._processEdgeForAdjacenciesWithVertices( + n.p1, + n.p2, + f.p0, + f.p1, + f.p2 + ) + : this._processEdgeForAdjacencies( + t[3 * i + 1], + t[3 * i + 2], + d, + p, + m + ); + break; + case 2: + _ = this._checkVerticesInsteadOfIndices + ? this._processEdgeForAdjacenciesWithVertices( + n.p2, + n.p0, + f.p0, + f.p1, + f.p2 + ) + : this._processEdgeForAdjacencies( + t[3 * i + 2], + t[3 * i], + d, + p, + m + ); + } + if ( + -1 !== _ && + ((n.edges[g] = h), + (f.edges[_] = i), + n.edgesConnectedCount++, + f.edgesConnectedCount++, + 3 === n.edgesConnectedCount) + ) + break; } - } - for (i = 0; i < r.length; i++) { - var v = r[i]; - this._checkEdge(i, v.edges[0], o, v.p0, v.p1), - this._checkEdge(i, v.edges[1], o, v.p1, v.p2), - this._checkEdge(i, v.edges[2], o, v.p2, v.p0) - } - var y = this._source.getScene().getEngine(); - this._buffers[Si.b.PositionKind] = new Si.b(y,this._linesPositions,Si.b.PositionKind,false), - this._buffers[Si.b.NormalKind] = new Si.b(y,this._linesNormals,Si.b.NormalKind,false,false,4), - this._ib = y.createIndexBuffer(this._linesIndices), - this._indicesCount = this._linesIndices.length + } + } } - } - , - e.prototype.isReady = function() { - return this._lineShader.isReady() - } - , - e.prototype.render = function() { - var e = this._source.getScene(); - if (this.isReady() && e.activeCamera) { - var t = e.getEngine(); - this._lineShader._preBind(), - 1 !== this._source.edgesColor.a ? t.setAlphaMode(_.a.ALPHA_COMBINE) : t.setAlphaMode(_.a.ALPHA_DISABLE), - t.bindBuffers(this._buffers, this._ib, this._lineShader.getEffect()), - e.resetCachedMaterial(), - this._lineShader.setColor4("color", this._source.edgesColor), - e.activeCamera.mode === ke.a.ORTHOGRAPHIC_CAMERA ? this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForOrthographic) : this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForPerspective), - this._lineShader.setFloat("aspectRatio", t.getAspectRatio(e.activeCamera)), - this._lineShader.bind(this._source.getWorldMatrix()), - t.drawElementsType(Mr.a.TriangleFillMode, 0, this._indicesCount), - this._lineShader.unbind() + for (i = 0; i < r.length; i++) { + var v = r[i]; + this._checkEdge(i, v.edges[0], o, v.p0, v.p1), + this._checkEdge(i, v.edges[1], o, v.p1, v.p2), + this._checkEdge(i, v.edges[2], o, v.p2, v.p0); } - } - , + var y = this._source.getScene().getEngine(); + (this._buffers[Si.b.PositionKind] = new Si.b( + y, + this._linesPositions, + Si.b.PositionKind, + false + )), + (this._buffers[Si.b.NormalKind] = new Si.b( + y, + this._linesNormals, + Si.b.NormalKind, + false, + false, + 4 + )), + (this._ib = y.createIndexBuffer(this._linesIndices)), + (this._indicesCount = this._linesIndices.length); + } + }), + (e.prototype.isReady = function () { + return this._lineShader.isReady(); + }), + (e.prototype.render = function () { + var e = this._source.getScene(); + if (this.isReady() && e.activeCamera) { + var t = e.getEngine(); + this._lineShader._preBind(), + 1 !== this._source.edgesColor.a + ? t.setAlphaMode(_.a.ALPHA_COMBINE) + : t.setAlphaMode(_.a.ALPHA_DISABLE), + t.bindBuffers( + this._buffers, + this._ib, + this._lineShader.getEffect() + ), + e.resetCachedMaterial(), + this._lineShader.setColor4( + "color", + this._source.edgesColor + ), + e.activeCamera.mode === ke.a.ORTHOGRAPHIC_CAMERA + ? this._lineShader.setFloat( + "width", + this._source.edgesWidth / + this.edgesWidthScalerForOrthographic + ) + : this._lineShader.setFloat( + "width", + this._source.edgesWidth / + this.edgesWidthScalerForPerspective + ), + this._lineShader.setFloat( + "aspectRatio", + t.getAspectRatio(e.activeCamera) + ), + this._lineShader.bind(this._source.getWorldMatrix()), + t.drawElementsType( + Mr.a.TriangleFillMode, + 0, + this._indicesCount + ), + this._lineShader.unbind(); + } + }), e - }() - , ks = function(e) { - function t(t, i, n) { - void 0 === i && (i = .95), - void 0 === n && (n = false); - var r = e.call(this, t, i, n, false) || this; - return r._generateEdgesLines(), - r - } - return h.d(t, e), - t.prototype._generateEdgesLines = function() { - var e = this._source.getVerticesData(Si.b.PositionKind) - , t = this._source.getIndices(); - if (t && e) { - for (var i = a.t.Vector3[0], n = a.t.Vector3[1], r = t.length - 1, o = 0, s = 0; o < r; o += 2, - s += 4) - a.x.FromArrayToRef(e, 3 * t[o], i), - a.x.FromArrayToRef(e, 3 * t[o + 1], n), - this.createLine(i, n, s); - var c = this._source.getScene().getEngine(); - this._buffers[Si.b.PositionKind] = new Si.b(c,this._linesPositions,Si.b.PositionKind,false), - this._buffers[Si.b.NormalKind] = new Si.b(c,this._linesNormals,Si.b.NormalKind,false,false,4), - this._ib = c.createIndexBuffer(this._linesIndices), - this._indicesCount = this._linesIndices.length - } - } - , + ); + })(), + ks = (function (e) { + function t(t, i, n) { + void 0 === i && (i = 0.95), void 0 === n && (n = false); + var r = e.call(this, t, i, n, false) || this; + return r._generateEdgesLines(), r; + } + return ( + h.d(t, e), + (t.prototype._generateEdgesLines = function () { + var e = this._source.getVerticesData(Si.b.PositionKind), + t = this._source.getIndices(); + if (t && e) { + for ( + var i = a.t.Vector3[0], + n = a.t.Vector3[1], + r = t.length - 1, + o = 0, + s = 0; + o < r; + o += 2, s += 4 + ) + a.x.FromArrayToRef(e, 3 * t[o], i), + a.x.FromArrayToRef(e, 3 * t[o + 1], n), + this.createLine(i, n, s); + var c = this._source.getScene().getEngine(); + (this._buffers[Si.b.PositionKind] = new Si.b( + c, + this._linesPositions, + Si.b.PositionKind, + false + )), + (this._buffers[Si.b.NormalKind] = new Si.b( + c, + this._linesNormals, + Si.b.NormalKind, + false, + false, + 4 + )), + (this._ib = c.createIndexBuffer(this._linesIndices)), + (this._indicesCount = this._linesIndices.length); + } + }), t - }(Ns); - Ht.a.ShadersStore.outlinePixelShader = "#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include\nvoid main(void) {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include\ngl_FragColor=color;\n}"; - Ht.a.ShadersStore.outlineVertexShader = "\nattribute vec3 position;\nattribute vec3 normal;\n#include\n\nuniform float offset;\n#include\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include\nvoid main(void)\n{\nvec3 offsetPosition=position+normal*offset;\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include\n}\n", - Y.a.prototype.getOutlineRenderer = function() { - return this._outlineRenderer || (this._outlineRenderer = new Us(this)), + ); + })(Ns); + Ht.a.ShadersStore.outlinePixelShader = + "#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include\nvoid main(void) {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include\ngl_FragColor=color;\n}"; + (Ht.a.ShadersStore.outlineVertexShader = + "\nattribute vec3 position;\nattribute vec3 normal;\n#include\n\nuniform float offset;\n#include\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include\nvoid main(void)\n{\nvec3 offsetPosition=position+normal*offset;\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include\n}\n"), + (Y.a.prototype.getOutlineRenderer = function () { + return ( + this._outlineRenderer || + (this._outlineRenderer = new Us(this)), this._outlineRenderer - } - , + ); + }), Object.defineProperty(Ne.a.prototype, "renderOutline", { - get: function() { - return this._renderOutline - }, - set: function(e) { - e && this.getScene().getOutlineRenderer(), - this._renderOutline = e - }, - enumerable: true, - configurable: true + get: function () { + return this._renderOutline; + }, + set: function (e) { + e && this.getScene().getOutlineRenderer(), + (this._renderOutline = e); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(Ne.a.prototype, "renderOverlay", { - get: function() { - return this._renderOverlay - }, - set: function(e) { - e && this.getScene().getOutlineRenderer(), - this._renderOverlay = e - }, - enumerable: true, - configurable: true + get: function () { + return this._renderOverlay; + }, + set: function (e) { + e && this.getScene().getOutlineRenderer(), + (this._renderOverlay = e); + }, + enumerable: true, + configurable: true, }); - var Us = function() { - function e(e) { - this.name = Se.a.NAME_OUTLINERENDERER, - this.zOffset = 1, - this.scene = e, - this._engine = e.getEngine(), - this.scene._addComponent(this) - } - return e.prototype.register = function() { - this.scene._beforeRenderingMeshStage.registerStep(Se.a.STEP_BEFORERENDERINGMESH_OUTLINE, this, this._beforeRenderingMesh), - this.scene._afterRenderingMeshStage.registerStep(Se.a.STEP_AFTERRENDERINGMESH_OUTLINE, this, this._afterRenderingMesh) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() {} - , - e.prototype.render = function(e, t, i) { - var n = this; - void 0 === i && (i = false); - var r = this.scene - , o = r.getEngine() - , a = o.getCaps().instancedArrays && null !== t.visibleInstances[e._id] && void 0 !== t.visibleInstances[e._id]; - if (this.isReady(e, a)) { - var s = e.getRenderingMesh() - , c = e.getMaterial(); - if (c && r.activeCamera) { - if (o.enableEffect(this._effect), - c.useLogarithmicDepth && this._effect.setFloat("logarithmicDepthConstant", 2 / (Math.log(r.activeCamera.maxZ + 1) / Math.LN2)), - this._effect.setFloat("offset", i ? 0 : s.outlineWidth), - this._effect.setColor4("color", i ? s.overlayColor : s.outlineColor, i ? s.overlayAlpha : c.alpha), - this._effect.setMatrix("viewProjection", r.getTransformMatrix()), - s.useBones && s.computeBonesUsingShaders && s.skeleton && this._effect.setMatrices("mBones", s.skeleton.getTransformMatrices(s)), - s._bind(e, this._effect, Mr.a.TriangleFillMode), - c && c.needAlphaTesting()) { - var u = c.getAlphaTestTexture(); - u && (this._effect.setTexture("diffuseSampler", u), - this._effect.setMatrix("diffuseMatrix", u.getTextureMatrix())) - } - o.setZOffset(-this.zOffset), - s._processRendering(e, this._effect, Mr.a.TriangleFillMode, t, a, function(e, t) { - n._effect.setMatrix("world", t) - }), - o.setZOffset(0) - } + var Us = (function () { + function e(e) { + (this.name = Se.a.NAME_OUTLINERENDERER), + (this.zOffset = 1), + (this.scene = e), + (this._engine = e.getEngine()), + this.scene._addComponent(this); + } + return ( + (e.prototype.register = function () { + this.scene._beforeRenderingMeshStage.registerStep( + Se.a.STEP_BEFORERENDERINGMESH_OUTLINE, + this, + this._beforeRenderingMesh + ), + this.scene._afterRenderingMeshStage.registerStep( + Se.a.STEP_AFTERRENDERINGMESH_OUTLINE, + this, + this._afterRenderingMesh + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () {}), + (e.prototype.render = function (e, t, i) { + var n = this; + void 0 === i && (i = false); + var r = this.scene, + o = r.getEngine(), + a = + o.getCaps().instancedArrays && + null !== t.visibleInstances[e._id] && + void 0 !== t.visibleInstances[e._id]; + if (this.isReady(e, a)) { + var s = e.getRenderingMesh(), + c = e.getMaterial(); + if (c && r.activeCamera) { + if ( + (o.enableEffect(this._effect), + c.useLogarithmicDepth && + this._effect.setFloat( + "logarithmicDepthConstant", + 2 / + (Math.log(r.activeCamera.maxZ + 1) / Math.LN2) + ), + this._effect.setFloat( + "offset", + i ? 0 : s.outlineWidth + ), + this._effect.setColor4( + "color", + i ? s.overlayColor : s.outlineColor, + i ? s.overlayAlpha : c.alpha + ), + this._effect.setMatrix( + "viewProjection", + r.getTransformMatrix() + ), + s.useBones && + s.computeBonesUsingShaders && + s.skeleton && + this._effect.setMatrices( + "mBones", + s.skeleton.getTransformMatrices(s) + ), + s._bind(e, this._effect, Mr.a.TriangleFillMode), + c && c.needAlphaTesting()) + ) { + var u = c.getAlphaTestTexture(); + u && + (this._effect.setTexture("diffuseSampler", u), + this._effect.setMatrix( + "diffuseMatrix", + u.getTextureMatrix() + )); + } + o.setZOffset(-this.zOffset), + s._processRendering( + e, + this._effect, + Mr.a.TriangleFillMode, + t, + a, + function (e, t) { + n._effect.setMatrix("world", t); + } + ), + o.setZOffset(0); } - } - , - e.prototype.isReady = function(e, t) { - var i = [] - , n = [Si.b.PositionKind, Si.b.NormalKind] - , r = e.getMesh() - , o = e.getMaterial(); - o && (o.needAlphaTesting() && (i.push("#define ALPHATEST"), - r.isVerticesDataPresent(Si.b.UVKind) && (n.push(Si.b.UVKind), - i.push("#define UV1")), - r.isVerticesDataPresent(Si.b.UV2Kind) && (n.push(Si.b.UV2Kind), - i.push("#define UV2"))), - o.useLogarithmicDepth && i.push("#define LOGARITHMICDEPTH")), - r.useBones && r.computeBonesUsingShaders ? (n.push(Si.b.MatricesIndicesKind), - n.push(Si.b.MatricesWeightsKind), - r.numBoneInfluencers > 4 && (n.push(Si.b.MatricesIndicesExtraKind), - n.push(Si.b.MatricesWeightsExtraKind)), - i.push("#define NUM_BONE_INFLUENCERS " + r.numBoneInfluencers), - i.push("#define BonesPerMesh " + (r.skeleton ? r.skeleton.bones.length + 1 : 0))) : i.push("#define NUM_BONE_INFLUENCERS 0"), - t && (i.push("#define INSTANCES"), - n.push("world0"), - n.push("world1"), - n.push("world2"), - n.push("world3")); - var a = i.join("\n"); - return this._cachedDefines !== a && (this._cachedDefines = a, - this._effect = this.scene.getEngine().createEffect("outline", n, ["world", "mBones", "viewProjection", "diffuseMatrix", "offset", "color", "logarithmicDepthConstant"], ["diffuseSampler"], a)), + } + }), + (e.prototype.isReady = function (e, t) { + var i = [], + n = [Si.b.PositionKind, Si.b.NormalKind], + r = e.getMesh(), + o = e.getMaterial(); + o && + (o.needAlphaTesting() && + (i.push("#define ALPHATEST"), + r.isVerticesDataPresent(Si.b.UVKind) && + (n.push(Si.b.UVKind), i.push("#define UV1")), + r.isVerticesDataPresent(Si.b.UV2Kind) && + (n.push(Si.b.UV2Kind), i.push("#define UV2"))), + o.useLogarithmicDepth && + i.push("#define LOGARITHMICDEPTH")), + r.useBones && r.computeBonesUsingShaders + ? (n.push(Si.b.MatricesIndicesKind), + n.push(Si.b.MatricesWeightsKind), + r.numBoneInfluencers > 4 && + (n.push(Si.b.MatricesIndicesExtraKind), + n.push(Si.b.MatricesWeightsExtraKind)), + i.push( + "#define NUM_BONE_INFLUENCERS " + + r.numBoneInfluencers + ), + i.push( + "#define BonesPerMesh " + + (r.skeleton ? r.skeleton.bones.length + 1 : 0) + )) + : i.push("#define NUM_BONE_INFLUENCERS 0"), + t && + (i.push("#define INSTANCES"), + n.push("world0"), + n.push("world1"), + n.push("world2"), + n.push("world3")); + var a = i.join("\n"); + return ( + this._cachedDefines !== a && + ((this._cachedDefines = a), + (this._effect = this.scene + .getEngine() + .createEffect( + "outline", + n, + [ + "world", + "mBones", + "viewProjection", + "diffuseMatrix", + "offset", + "color", + "logarithmicDepthConstant", + ], + ["diffuseSampler"], + a + ))), this._effect.isReady() - } - , - e.prototype._beforeRenderingMesh = function(t, i, n) { - if (this._savedDepthWrite = this._engine.getDepthWrite(), - t.renderOutline) { - var r = i.getMaterial(); - r && r.needAlphaBlending && (this._engine.cacheStencilState(), - this._engine.setDepthWrite(false), - this._engine.setColorWrite(false), - this._engine.setStencilBuffer(true), - this._engine.setStencilOperationPass(_.a.REPLACE), - this._engine.setStencilFunction(_.a.ALWAYS), - this._engine.setStencilMask(e._StencilReference), - this._engine.setStencilFunctionReference(e._StencilReference), - this.render(i, n, true), - this._engine.setColorWrite(true), - this._engine.setStencilFunction(_.a.NOTEQUAL)), - this._engine.setDepthWrite(false), - this.render(i, n), - this._engine.setDepthWrite(this._savedDepthWrite), - r && r.needAlphaBlending && this._engine.restoreStencilState() - } - } - , - e.prototype._afterRenderingMesh = function(e, t, i) { - if (e.renderOverlay) { - var n = this._engine.getAlphaMode(); - this._engine.setAlphaMode(_.a.ALPHA_COMBINE), - this.render(t, i, true), - this._engine.setAlphaMode(n) - } - e.renderOutline && this._savedDepthWrite && (this._engine.setDepthWrite(true), + ); + }), + (e.prototype._beforeRenderingMesh = function (t, i, n) { + if ( + ((this._savedDepthWrite = this._engine.getDepthWrite()), + t.renderOutline) + ) { + var r = i.getMaterial(); + r && + r.needAlphaBlending && + (this._engine.cacheStencilState(), + this._engine.setDepthWrite(false), + this._engine.setColorWrite(false), + this._engine.setStencilBuffer(true), + this._engine.setStencilOperationPass(_.a.REPLACE), + this._engine.setStencilFunction(_.a.ALWAYS), + this._engine.setStencilMask(e._StencilReference), + this._engine.setStencilFunctionReference( + e._StencilReference + ), + this.render(i, n, true), + this._engine.setColorWrite(true), + this._engine.setStencilFunction(_.a.NOTEQUAL)), + this._engine.setDepthWrite(false), + this.render(i, n), + this._engine.setDepthWrite(this._savedDepthWrite), + r && + r.needAlphaBlending && + this._engine.restoreStencilState(); + } + }), + (e.prototype._afterRenderingMesh = function (e, t, i) { + if (e.renderOverlay) { + var n = this._engine.getAlphaMode(); + this._engine.setAlphaMode(_.a.ALPHA_COMBINE), + this.render(t, i, true), + this._engine.setAlphaMode(n); + } + e.renderOutline && + this._savedDepthWrite && + (this._engine.setDepthWrite(true), this._engine.setColorWrite(false), this.render(t, i), - this._engine.setColorWrite(true)) - } - , - e._StencilReference = 4, - e - }() - , Vs = n(109) - , Gs = function() { - function e(e, t) { - this.name = e, - this.color = new a.f(1,1,1,1), - this.width = 1, - this.height = 1, - this.angle = 0, - this.cellIndex = 0, - this.invertU = 0, - this.invertV = 0, - this.animations = new Array, - this.isPickable = false, - this._animationStarted = false, - this._loopAnimation = false, - this._fromIndex = 0, - this._toIndex = 0, - this._delay = 0, - this._direction = 1, - this._time = 0, - this.isVisible = true, - this._manager = t, - this._manager.sprites.push(this), - this.position = a.x.Zero() - } - return Object.defineProperty(e.prototype, "size", { - get: function() { - return this.width - }, - set: function(e) { - this.width = e, - this.height = e - }, - enumerable: true, - configurable: true + this._engine.setColorWrite(true)); }), - e.prototype.playAnimation = function(e, t, i, n, r) { - this._fromIndex = e, - this._toIndex = t, - this._loopAnimation = i, - this._delay = n, - this._animationStarted = true, - e < t ? this._direction = 1 : (this._direction = -1, - this._toIndex = e, - this._fromIndex = t), - this.cellIndex = e, - this._time = 0, - this._onAnimationEnd = r - } - , - e.prototype.stopAnimation = function() { - this._animationStarted = false - } - , - e.prototype._animate = function(e) { - this._animationStarted && (this._time += e, - this._time > this._delay && (this._time = this._time % this._delay, - this.cellIndex += this._direction, - (this._direction > 0 && this.cellIndex > this._toIndex || this._direction < 0 && this.cellIndex < this._fromIndex) && (this._loopAnimation ? this.cellIndex = this._direction > 0 ? this._fromIndex : this._toIndex : (this.cellIndex = this._toIndex, - this._animationStarted = false, - this._onAnimationEnd && this._onAnimationEnd(), - this.disposeWhenFinishedAnimating && this.dispose())))) - } - , - e.prototype.dispose = function() { - for (var e = 0; e < this._manager.sprites.length; e++) - this._manager.sprites[e] == this && this._manager.sprites.splice(e, 1) - } - , + (e._StencilReference = 4), e - }(); - Y.a.prototype._internalPickSprites = function(e, t, i, n) { - if (!Qi.a) - return null; - var r = null; - if (!n) { - if (!this.activeCamera) - return null; - n = this.activeCamera - } - if (this.spriteManagers.length > 0) - for (var o = 0; o < this.spriteManagers.length; o++) { - var a = this.spriteManagers[o]; - if (a.isPickable) { - var s = a.intersects(e, n, t, i); - if (s && s.hit && (i || null == r || !(s.distance >= r.distance)) && (r = s, - i)) - break - } - } - return r || new Qi.a - } - , - Y.a.prototype.pickSprite = function(e, t, i, n, r) { - return this.createPickingRayInCameraSpaceToRef(e, t, this._tempSpritePickingRay, r), - this._internalPickSprites(this._tempSpritePickingRay, i, n, r) - } - , - Y.a.prototype.pickSpriteWithRay = function(e, t, i, n) { - if (!this._tempSpritePickingRay) - return null; - if (!n) { - if (!this.activeCamera) - return null; - n = this.activeCamera - } - return Dt.a.TransformToRef(e, n.getViewMatrix(), this._tempSpritePickingRay), - this._internalPickSprites(this._tempSpritePickingRay, t, i, n) - } - , - Y.a.prototype.setPointerOverSprite = function(e) { - this._pointerOverSprite !== e && (this._pointerOverSprite && this._pointerOverSprite.actionManager && this._pointerOverSprite.actionManager.processTrigger(_.a.ACTION_OnPointerOutTrigger, l.a.CreateNewFromSprite(this._pointerOverSprite, this)), - this._pointerOverSprite = e, - this._pointerOverSprite && this._pointerOverSprite.actionManager && this._pointerOverSprite.actionManager.processTrigger(_.a.ACTION_OnPointerOverTrigger, l.a.CreateNewFromSprite(this._pointerOverSprite, this))) - } - , - Y.a.prototype.getPointerOverSprite = function() { - return this._pointerOverSprite - } - ; - var zs = function() { - function e(e) { - this.name = Se.a.NAME_SPRITE, - this.scene = e, - this.scene.spriteManagers = new Array, - this.scene._tempSpritePickingRay = Dt.a ? Dt.a.Zero() : null, - this.scene.onBeforeSpritesRenderingObservable = new o.c, - this.scene.onAfterSpritesRenderingObservable = new o.c, - this._spritePredicate = function(e) { - return !!e.actionManager && e.isPickable && e.actionManager.hasPointerTriggers - } - } - return e.prototype.register = function() { - this.scene._pointerMoveStage.registerStep(Se.a.STEP_POINTERMOVE_SPRITE, this, this._pointerMove), - this.scene._pointerDownStage.registerStep(Se.a.STEP_POINTERDOWN_SPRITE, this, this._pointerDown), - this.scene._pointerUpStage.registerStep(Se.a.STEP_POINTERUP_SPRITE, this, this._pointerUp) - } - , - e.prototype.rebuild = function() {} - , - e.prototype.dispose = function() { - this.scene.onBeforeSpritesRenderingObservable.clear(), - this.scene.onAfterSpritesRenderingObservable.clear(); - for (var e = this.scene.spriteManagers; e.length; ) - e[0].dispose() - } - , - e.prototype._pickSpriteButKeepRay = function(e, t, i, n, r) { - var o = this.scene.pickSprite(t, i, this._spritePredicate, n, r); - return o && (o.ray = e ? e.ray : null), - o - } - , - e.prototype._pointerMove = function(e, t, i, n, r) { - var o = this.scene; - return n ? o.setPointerOverSprite(null) : (i = this._pickSpriteButKeepRay(i, e, t, false, o.cameraToUseForPointers || void 0)) && i.hit && i.pickedSprite ? (o.setPointerOverSprite(i.pickedSprite), - o._pointerOverSprite && o._pointerOverSprite.actionManager && o._pointerOverSprite.actionManager.hoverCursor ? r.style.cursor = o._pointerOverSprite.actionManager.hoverCursor : r.style.cursor = o.hoverCursor) : o.setPointerOverSprite(null), - i - } - , - e.prototype._pointerDown = function(e, t, i, n) { - var r = this.scene; - if (r._pickedDownSprite = null, - r.spriteManagers.length > 0 && (i = r.pickSprite(e, t, this._spritePredicate, false, r.cameraToUseForPointers || void 0)) && i.hit && i.pickedSprite && i.pickedSprite.actionManager) { - switch (r._pickedDownSprite = i.pickedSprite, - n.button) { - case 0: - i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnLeftPickTrigger, l.a.CreateNewFromSprite(i.pickedSprite, r, n)); - break; - case 1: - i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnCenterPickTrigger, l.a.CreateNewFromSprite(i.pickedSprite, r, n)); - break; - case 2: - i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnRightPickTrigger, l.a.CreateNewFromSprite(i.pickedSprite, r, n)) - } - i.pickedSprite.actionManager && i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnPickDownTrigger, l.a.CreateNewFromSprite(i.pickedSprite, r, n)) - } - return i - } - , - e.prototype._pointerUp = function(e, t, i, n) { - var r = this.scene; - if (r.spriteManagers.length > 0) { - var o = r.pickSprite(e, t, this._spritePredicate, false, r.cameraToUseForPointers || void 0); - o && (o.hit && o.pickedSprite && o.pickedSprite.actionManager && (o.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnPickUpTrigger, l.a.CreateNewFromSprite(o.pickedSprite, r, n)), - o.pickedSprite.actionManager && (this.scene._inputManager._isPointerSwiping() || o.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnPickTrigger, l.a.CreateNewFromSprite(o.pickedSprite, r, n)))), - r._pickedDownSprite && r._pickedDownSprite.actionManager && r._pickedDownSprite !== o.pickedSprite && r._pickedDownSprite.actionManager.processTrigger(_.a.ACTION_OnPickOutTrigger, l.a.CreateNewFromSprite(r._pickedDownSprite, r, n))) - } - return i - } - , + ); + })(), + Vs = n(109), + Gs = (function () { + function e(e, t) { + (this.name = e), + (this.color = new a.f(1, 1, 1, 1)), + (this.width = 1), + (this.height = 1), + (this.angle = 0), + (this.cellIndex = 0), + (this.invertU = 0), + (this.invertV = 0), + (this.animations = new Array()), + (this.isPickable = false), + (this._animationStarted = false), + (this._loopAnimation = false), + (this._fromIndex = 0), + (this._toIndex = 0), + (this._delay = 0), + (this._direction = 1), + (this._time = 0), + (this.isVisible = true), + (this._manager = t), + this._manager.sprites.push(this), + (this.position = a.x.Zero()); + } + return ( + Object.defineProperty(e.prototype, "size", { + get: function () { + return this.width; + }, + set: function (e) { + (this.width = e), (this.height = e); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.playAnimation = function (e, t, i, n, r) { + (this._fromIndex = e), + (this._toIndex = t), + (this._loopAnimation = i), + (this._delay = n), + (this._animationStarted = true), + e < t + ? (this._direction = 1) + : ((this._direction = -1), + (this._toIndex = e), + (this._fromIndex = t)), + (this.cellIndex = e), + (this._time = 0), + (this._onAnimationEnd = r); + }), + (e.prototype.stopAnimation = function () { + this._animationStarted = false; + }), + (e.prototype._animate = function (e) { + this._animationStarted && + ((this._time += e), + this._time > this._delay && + ((this._time = this._time % this._delay), + (this.cellIndex += this._direction), + ((this._direction > 0 && + this.cellIndex > this._toIndex) || + (this._direction < 0 && + this.cellIndex < this._fromIndex)) && + (this._loopAnimation + ? (this.cellIndex = + this._direction > 0 + ? this._fromIndex + : this._toIndex) + : ((this.cellIndex = this._toIndex), + (this._animationStarted = false), + this._onAnimationEnd && this._onAnimationEnd(), + this.disposeWhenFinishedAnimating && + this.dispose())))); + }), + (e.prototype.dispose = function () { + for (var e = 0; e < this._manager.sprites.length; e++) + this._manager.sprites[e] == this && + this._manager.sprites.splice(e, 1); + }), e - }(); - Ht.a.ShadersStore.spritesPixelShader = "uniform bool alphaTest;\nvarying vec4 vColor;\n\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n\n#include\nvoid main(void) {\nvec4 color=texture2D(diffuseSampler,vUV);\nif (alphaTest)\n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include\ngl_FragColor=color;\n}"; - Ht.a.ShadersStore.spritesVertexShader = "\nattribute vec4 position;\nattribute vec4 options;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform vec2 textureInfos;\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include\nvoid main(void) {\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz;\nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=options.zw;\nvec2 uvScale=textureInfos.xy;\ncornerPos=vec2(offset.x-0.5,offset.y-0.5)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0);\n\nvColor=color;\n\nvec2 uvOffset=vec2(abs(offset.x-cellInfo.x),1.0-abs(offset.y-cellInfo.y));\nvUV=(uvOffset+cellInfo.zw)*uvScale;\n\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n}"; - var js, Hs = function() { - function e(e, t, i, n, r, a, s) { - if (void 0 === a && (a = .01), - void 0 === s && (s = je.a.TRILINEAR_SAMPLINGMODE), - this.name = e, - this.sprites = new Array, - this.renderingGroupId = 0, - this.layerMask = 268435455, - this.fogEnabled = true, - this.isPickable = false, - this.onDisposeObservable = new o.c, - this._vertexBuffers = {}, - r._getComponent(Se.a.NAME_SPRITE) || r._addComponent(new zs(r)), - this._capacity = i, - this._spriteTexture = new je.a(t,r,true,false,s), - this._spriteTexture.wrapU = je.a.CLAMP_ADDRESSMODE, - this._spriteTexture.wrapV = je.a.CLAMP_ADDRESSMODE, - n.width && n.height) - this.cellWidth = n.width, - this.cellHeight = n.height; - else { - if (void 0 === n) - return; - this.cellWidth = n, - this.cellHeight = n - } - this._epsilon = a, - this._scene = r, - this._scene.spriteManagers.push(this); - for (var c = [], u = 0, l = 0; l < i; l++) - c.push(u), - c.push(u + 1), - c.push(u + 2), - c.push(u), - c.push(u + 2), - c.push(u + 3), - u += 4; - this._indexBuffer = r.getEngine().createIndexBuffer(c), - this._vertexData = new Float32Array(16 * i * 4), - this._buffer = new Si.a(r.getEngine(),this._vertexData,true,16); - var h = this._buffer.createVertexBuffer(Si.b.PositionKind, 0, 4) - , f = this._buffer.createVertexBuffer("options", 4, 4) - , d = this._buffer.createVertexBuffer("cellInfo", 8, 4) - , p = this._buffer.createVertexBuffer(Si.b.ColorKind, 12, 4); - this._vertexBuffers[Si.b.PositionKind] = h, - this._vertexBuffers.options = f, - this._vertexBuffers.cellInfo = d, - this._vertexBuffers[Si.b.ColorKind] = p, - this._effectBase = this._scene.getEngine().createEffect("sprites", [Si.b.PositionKind, "options", "cellInfo", Si.b.ColorKind], ["view", "projection", "textureInfos", "alphaTest"], ["diffuseSampler"], ""), - this._effectFog = this._scene.getEngine().createEffect("sprites", [Si.b.PositionKind, "options", "cellInfo", Si.b.ColorKind], ["view", "projection", "textureInfos", "alphaTest", "vFogInfos", "vFogColor"], ["diffuseSampler"], "#define FOG") + ); + })(); + (Y.a.prototype._internalPickSprites = function (e, t, i, n) { + if (!Qi.a) return null; + var r = null; + if (!n) { + if (!this.activeCamera) return null; + n = this.activeCamera; + } + if (this.spriteManagers.length > 0) + for (var o = 0; o < this.spriteManagers.length; o++) { + var a = this.spriteManagers[o]; + if (a.isPickable) { + var s = a.intersects(e, n, t, i); + if ( + s && + s.hit && + (i || null == r || !(s.distance >= r.distance)) && + ((r = s), i) + ) + break; } - return Object.defineProperty(e.prototype, "onDispose", { - set: function(e) { - this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), - this._onDisposeObserver = this.onDisposeObservable.add(e) - }, - enumerable: true, - configurable: true + } + return r || new Qi.a(); + }), + (Y.a.prototype.pickSprite = function (e, t, i, n, r) { + return ( + this.createPickingRayInCameraSpaceToRef( + e, + t, + this._tempSpritePickingRay, + r + ), + this._internalPickSprites( + this._tempSpritePickingRay, + i, + n, + r + ) + ); + }), + (Y.a.prototype.pickSpriteWithRay = function (e, t, i, n) { + if (!this._tempSpritePickingRay) return null; + if (!n) { + if (!this.activeCamera) return null; + n = this.activeCamera; + } + return ( + Dt.a.TransformToRef( + e, + n.getViewMatrix(), + this._tempSpritePickingRay + ), + this._internalPickSprites( + this._tempSpritePickingRay, + t, + i, + n + ) + ); + }), + (Y.a.prototype.setPointerOverSprite = function (e) { + this._pointerOverSprite !== e && + (this._pointerOverSprite && + this._pointerOverSprite.actionManager && + this._pointerOverSprite.actionManager.processTrigger( + _.a.ACTION_OnPointerOutTrigger, + l.a.CreateNewFromSprite(this._pointerOverSprite, this) + ), + (this._pointerOverSprite = e), + this._pointerOverSprite && + this._pointerOverSprite.actionManager && + this._pointerOverSprite.actionManager.processTrigger( + _.a.ACTION_OnPointerOverTrigger, + l.a.CreateNewFromSprite(this._pointerOverSprite, this) + )); + }), + (Y.a.prototype.getPointerOverSprite = function () { + return this._pointerOverSprite; + }); + var zs = (function () { + function e(e) { + (this.name = Se.a.NAME_SPRITE), + (this.scene = e), + (this.scene.spriteManagers = new Array()), + (this.scene._tempSpritePickingRay = Dt.a + ? Dt.a.Zero() + : null), + (this.scene.onBeforeSpritesRenderingObservable = new o.c()), + (this.scene.onAfterSpritesRenderingObservable = new o.c()), + (this._spritePredicate = function (e) { + return ( + !!e.actionManager && + e.isPickable && + e.actionManager.hasPointerTriggers + ); + }); + } + return ( + (e.prototype.register = function () { + this.scene._pointerMoveStage.registerStep( + Se.a.STEP_POINTERMOVE_SPRITE, + this, + this._pointerMove + ), + this.scene._pointerDownStage.registerStep( + Se.a.STEP_POINTERDOWN_SPRITE, + this, + this._pointerDown + ), + this.scene._pointerUpStage.registerStep( + Se.a.STEP_POINTERUP_SPRITE, + this, + this._pointerUp + ); + }), + (e.prototype.rebuild = function () {}), + (e.prototype.dispose = function () { + this.scene.onBeforeSpritesRenderingObservable.clear(), + this.scene.onAfterSpritesRenderingObservable.clear(); + for (var e = this.scene.spriteManagers; e.length; ) + e[0].dispose(); + }), + (e.prototype._pickSpriteButKeepRay = function ( + e, + t, + i, + n, + r + ) { + var o = this.scene.pickSprite( + t, + i, + this._spritePredicate, + n, + r + ); + return o && (o.ray = e ? e.ray : null), o; + }), + (e.prototype._pointerMove = function (e, t, i, n, r) { + var o = this.scene; + return ( + n + ? o.setPointerOverSprite(null) + : (i = this._pickSpriteButKeepRay( + i, + e, + t, + false, + o.cameraToUseForPointers || void 0 + )) && + i.hit && + i.pickedSprite + ? (o.setPointerOverSprite(i.pickedSprite), + o._pointerOverSprite && + o._pointerOverSprite.actionManager && + o._pointerOverSprite.actionManager.hoverCursor + ? (r.style.cursor = + o._pointerOverSprite.actionManager.hoverCursor) + : (r.style.cursor = o.hoverCursor)) + : o.setPointerOverSprite(null), + i + ); + }), + (e.prototype._pointerDown = function (e, t, i, n) { + var r = this.scene; + if ( + ((r._pickedDownSprite = null), + r.spriteManagers.length > 0 && + (i = r.pickSprite( + e, + t, + this._spritePredicate, + false, + r.cameraToUseForPointers || void 0 + )) && + i.hit && + i.pickedSprite && + i.pickedSprite.actionManager) + ) { + switch ( + ((r._pickedDownSprite = i.pickedSprite), n.button) + ) { + case 0: + i.pickedSprite.actionManager.processTrigger( + _.a.ACTION_OnLeftPickTrigger, + l.a.CreateNewFromSprite(i.pickedSprite, r, n) + ); + break; + case 1: + i.pickedSprite.actionManager.processTrigger( + _.a.ACTION_OnCenterPickTrigger, + l.a.CreateNewFromSprite(i.pickedSprite, r, n) + ); + break; + case 2: + i.pickedSprite.actionManager.processTrigger( + _.a.ACTION_OnRightPickTrigger, + l.a.CreateNewFromSprite(i.pickedSprite, r, n) + ); + } + i.pickedSprite.actionManager && + i.pickedSprite.actionManager.processTrigger( + _.a.ACTION_OnPickDownTrigger, + l.a.CreateNewFromSprite(i.pickedSprite, r, n) + ); + } + return i; + }), + (e.prototype._pointerUp = function (e, t, i, n) { + var r = this.scene; + if (r.spriteManagers.length > 0) { + var o = r.pickSprite( + e, + t, + this._spritePredicate, + false, + r.cameraToUseForPointers || void 0 + ); + o && + (o.hit && + o.pickedSprite && + o.pickedSprite.actionManager && + (o.pickedSprite.actionManager.processTrigger( + _.a.ACTION_OnPickUpTrigger, + l.a.CreateNewFromSprite(o.pickedSprite, r, n) + ), + o.pickedSprite.actionManager && + (this.scene._inputManager._isPointerSwiping() || + o.pickedSprite.actionManager.processTrigger( + _.a.ACTION_OnPickTrigger, + l.a.CreateNewFromSprite(o.pickedSprite, r, n) + ))), + r._pickedDownSprite && + r._pickedDownSprite.actionManager && + r._pickedDownSprite !== o.pickedSprite && + r._pickedDownSprite.actionManager.processTrigger( + _.a.ACTION_OnPickOutTrigger, + l.a.CreateNewFromSprite(r._pickedDownSprite, r, n) + )); + } + return i; + }), + e + ); + })(); + Ht.a.ShadersStore.spritesPixelShader = + "uniform bool alphaTest;\nvarying vec4 vColor;\n\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n\n#include\nvoid main(void) {\nvec4 color=texture2D(diffuseSampler,vUV);\nif (alphaTest)\n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include\ngl_FragColor=color;\n}"; + Ht.a.ShadersStore.spritesVertexShader = + "\nattribute vec4 position;\nattribute vec4 options;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform vec2 textureInfos;\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include\nvoid main(void) {\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz;\nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=options.zw;\nvec2 uvScale=textureInfos.xy;\ncornerPos=vec2(offset.x-0.5,offset.y-0.5)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0);\n\nvColor=color;\n\nvec2 uvOffset=vec2(abs(offset.x-cellInfo.x),1.0-abs(offset.y-cellInfo.y));\nvUV=(uvOffset+cellInfo.zw)*uvScale;\n\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n}"; + var js, + Hs = (function () { + function e(e, t, i, n, r, a, s) { + if ( + (void 0 === a && (a = 0.01), + void 0 === s && (s = je.a.TRILINEAR_SAMPLINGMODE), + (this.name = e), + (this.sprites = new Array()), + (this.renderingGroupId = 0), + (this.layerMask = 268435455), + (this.fogEnabled = true), + (this.isPickable = false), + (this.onDisposeObservable = new o.c()), + (this._vertexBuffers = {}), + r._getComponent(Se.a.NAME_SPRITE) || + r._addComponent(new zs(r)), + (this._capacity = i), + (this._spriteTexture = new je.a(t, r, true, false, s)), + (this._spriteTexture.wrapU = je.a.CLAMP_ADDRESSMODE), + (this._spriteTexture.wrapV = je.a.CLAMP_ADDRESSMODE), + n.width && n.height) + ) + (this.cellWidth = n.width), (this.cellHeight = n.height); + else { + if (void 0 === n) return; + (this.cellWidth = n), (this.cellHeight = n); + } + (this._epsilon = a), + (this._scene = r), + this._scene.spriteManagers.push(this); + for (var c = [], u = 0, l = 0; l < i; l++) + c.push(u), + c.push(u + 1), + c.push(u + 2), + c.push(u), + c.push(u + 2), + c.push(u + 3), + (u += 4); + (this._indexBuffer = r.getEngine().createIndexBuffer(c)), + (this._vertexData = new Float32Array(16 * i * 4)), + (this._buffer = new Si.a( + r.getEngine(), + this._vertexData, + true, + 16 + )); + var h = this._buffer.createVertexBuffer( + Si.b.PositionKind, + 0, + 4 + ), + f = this._buffer.createVertexBuffer("options", 4, 4), + d = this._buffer.createVertexBuffer("cellInfo", 8, 4), + p = this._buffer.createVertexBuffer( + Si.b.ColorKind, + 12, + 4 + ); + (this._vertexBuffers[Si.b.PositionKind] = h), + (this._vertexBuffers.options = f), + (this._vertexBuffers.cellInfo = d), + (this._vertexBuffers[Si.b.ColorKind] = p), + (this._effectBase = this._scene + .getEngine() + .createEffect( + "sprites", + [ + Si.b.PositionKind, + "options", + "cellInfo", + Si.b.ColorKind, + ], + ["view", "projection", "textureInfos", "alphaTest"], + ["diffuseSampler"], + "" + )), + (this._effectFog = this._scene + .getEngine() + .createEffect( + "sprites", + [ + Si.b.PositionKind, + "options", + "cellInfo", + Si.b.ColorKind, + ], + [ + "view", + "projection", + "textureInfos", + "alphaTest", + "vFogInfos", + "vFogColor", + ], + ["diffuseSampler"], + "#define FOG" + )); + } + return ( + Object.defineProperty(e.prototype, "onDispose", { + set: function (e) { + this._onDisposeObserver && + this.onDisposeObservable.remove( + this._onDisposeObserver + ), + (this._onDisposeObserver = + this.onDisposeObservable.add(e)); + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "texture", { - get: function() { - return this._spriteTexture - }, - set: function(e) { - this._spriteTexture = e - }, - enumerable: true, - configurable: true + get: function () { + return this._spriteTexture; + }, + set: function (e) { + this._spriteTexture = e; + }, + enumerable: true, + configurable: true, }), - e.prototype._appendSpriteVertex = function(e, t, i, n, r) { - var o = 16 * e; - 0 === i ? i = this._epsilon : 1 === i && (i = 1 - this._epsilon), - 0 === n ? n = this._epsilon : 1 === n && (n = 1 - this._epsilon), - this._vertexData[o] = t.position.x, - this._vertexData[o + 1] = t.position.y, - this._vertexData[o + 2] = t.position.z, - this._vertexData[o + 3] = t.angle, - this._vertexData[o + 4] = t.width, - this._vertexData[o + 5] = t.height, - this._vertexData[o + 6] = i, - this._vertexData[o + 7] = n, - this._vertexData[o + 8] = t.invertU ? 1 : 0, - this._vertexData[o + 9] = t.invertV ? 1 : 0; - var a = t.cellIndex / r >> 0; - this._vertexData[o + 10] = t.cellIndex - a * r, - this._vertexData[o + 11] = a, - this._vertexData[o + 12] = t.color.r, - this._vertexData[o + 13] = t.color.g, - this._vertexData[o + 14] = t.color.b, - this._vertexData[o + 15] = t.color.a - } - , - e.prototype.intersects = function(e, t, i, n) { - for (var r = Math.min(this._capacity, this.sprites.length), o = a.x.Zero(), s = a.x.Zero(), c = Number.MAX_VALUE, u = null, l = a.x.Zero(), h = a.x.Zero(), f = t.getViewMatrix(), d = 0; d < r; d++) { - var p = this.sprites[d]; - if (p) { - if (i) { - if (!i(p)) - continue - } else if (!p.isPickable) - continue; - if (a.x.TransformCoordinatesToRef(p.position, f, h), - o.copyFromFloats(h.x - p.width / 2, h.y - p.height / 2, h.z), - s.copyFromFloats(h.x + p.width / 2, h.y + p.height / 2, h.z), - e.intersectsBoxMinMax(o, s)) { - var m = a.x.Distance(h, e.origin); - if (c > m && (c = m, - u = p, - n)) - break - } - } + (e.prototype._appendSpriteVertex = function ( + e, + t, + i, + n, + r + ) { + var o = 16 * e; + 0 === i + ? (i = this._epsilon) + : 1 === i && (i = 1 - this._epsilon), + 0 === n + ? (n = this._epsilon) + : 1 === n && (n = 1 - this._epsilon), + (this._vertexData[o] = t.position.x), + (this._vertexData[o + 1] = t.position.y), + (this._vertexData[o + 2] = t.position.z), + (this._vertexData[o + 3] = t.angle), + (this._vertexData[o + 4] = t.width), + (this._vertexData[o + 5] = t.height), + (this._vertexData[o + 6] = i), + (this._vertexData[o + 7] = n), + (this._vertexData[o + 8] = t.invertU ? 1 : 0), + (this._vertexData[o + 9] = t.invertV ? 1 : 0); + var a = (t.cellIndex / r) >> 0; + (this._vertexData[o + 10] = t.cellIndex - a * r), + (this._vertexData[o + 11] = a), + (this._vertexData[o + 12] = t.color.r), + (this._vertexData[o + 13] = t.color.g), + (this._vertexData[o + 14] = t.color.b), + (this._vertexData[o + 15] = t.color.a); + }), + (e.prototype.intersects = function (e, t, i, n) { + for ( + var r = Math.min(this._capacity, this.sprites.length), + o = a.x.Zero(), + s = a.x.Zero(), + c = Number.MAX_VALUE, + u = null, + l = a.x.Zero(), + h = a.x.Zero(), + f = t.getViewMatrix(), + d = 0; + d < r; + d++ + ) { + var p = this.sprites[d]; + if (p) { + if (i) { + if (!i(p)) continue; + } else if (!p.isPickable) continue; + if ( + (a.x.TransformCoordinatesToRef(p.position, f, h), + o.copyFromFloats( + h.x - p.width / 2, + h.y - p.height / 2, + h.z + ), + s.copyFromFloats( + h.x + p.width / 2, + h.y + p.height / 2, + h.z + ), + e.intersectsBoxMinMax(o, s)) + ) { + var m = a.x.Distance(h, e.origin); + if (c > m && ((c = m), (u = p), n)) break; + } } - if (u) { - var g = new Qi.a; - f.invertToRef(a.t.Matrix[0]), - g.hit = true, - g.pickedSprite = u, - g.distance = c; - var _ = a.t.Vector3[0]; - return _.copyFrom(e.direction), - _.normalize(), - _.scaleInPlace(c), - e.origin.addToRef(_, l), - g.pickedPoint = a.x.TransformCoordinates(l, a.t.Matrix[0]), - g + } + if (u) { + var g = new Qi.a(); + f.invertToRef(a.t.Matrix[0]), + (g.hit = true), + (g.pickedSprite = u), + (g.distance = c); + var _ = a.t.Vector3[0]; + return ( + _.copyFrom(e.direction), + _.normalize(), + _.scaleInPlace(c), + e.origin.addToRef(_, l), + (g.pickedPoint = a.x.TransformCoordinates( + l, + a.t.Matrix[0] + )), + g + ); + } + return null; + }), + (e.prototype.render = function () { + if ( + this._effectBase.isReady() && + this._effectFog.isReady() && + this._spriteTexture && + this._spriteTexture.isReady() && + this.sprites.length + ) { + for ( + var e = this._scene.getEngine(), + t = this._spriteTexture.getBaseSize(), + i = e.getDeltaTime(), + n = Math.min(this._capacity, this.sprites.length), + r = t.width / this.cellWidth, + o = 0, + a = true, + s = 0; + s < n; + s++ + ) { + var c = this.sprites[s]; + c && + c.isVisible && + ((a = false), + c._animate(i), + this._appendSpriteVertex(o++, c, 0, 0, r), + this._appendSpriteVertex(o++, c, 1, 0, r), + this._appendSpriteVertex(o++, c, 1, 1, r), + this._appendSpriteVertex(o++, c, 0, 1, r)); } - return null - } - , - e.prototype.render = function() { - if (this._effectBase.isReady() && this._effectFog.isReady() && this._spriteTexture && this._spriteTexture.isReady() && this.sprites.length) { - for (var e = this._scene.getEngine(), t = this._spriteTexture.getBaseSize(), i = e.getDeltaTime(), n = Math.min(this._capacity, this.sprites.length), r = t.width / this.cellWidth, o = 0, a = true, s = 0; s < n; s++) { - var c = this.sprites[s]; - c && c.isVisible && (a = false, - c._animate(i), - this._appendSpriteVertex(o++, c, 0, 0, r), - this._appendSpriteVertex(o++, c, 1, 0, r), - this._appendSpriteVertex(o++, c, 1, 1, r), - this._appendSpriteVertex(o++, c, 0, 1, r)) - } - if (!a) { - this._buffer.update(this._vertexData); - var u = this._effectBase; - this._scene.fogEnabled && this._scene.fogMode !== Y.a.FOGMODE_NONE && this.fogEnabled && (u = this._effectFog), - e.enableEffect(u); - var l = this._scene.getViewMatrix(); - u.setTexture("diffuseSampler", this._spriteTexture), - u.setMatrix("view", l), - u.setMatrix("projection", this._scene.getProjectionMatrix()), - u.setFloat2("textureInfos", this.cellWidth / t.width, this.cellHeight / t.height), - this._scene.fogEnabled && this._scene.fogMode !== Y.a.FOGMODE_NONE && this.fogEnabled && (u.setFloat4("vFogInfos", this._scene.fogMode, this._scene.fogStart, this._scene.fogEnd, this._scene.fogDensity), - u.setColor3("vFogColor", this._scene.fogColor)), - e.bindBuffers(this._vertexBuffers, this._indexBuffer, u), - e.setDepthFunctionToLessOrEqual(), - u.setBool("alphaTest", true), - e.setColorWrite(false), - e.drawElementsType(Mr.a.TriangleFillMode, 0, o / 4 * 6), - e.setColorWrite(true), - u.setBool("alphaTest", false), - e.setAlphaMode(_.a.ALPHA_COMBINE), - e.drawElementsType(Mr.a.TriangleFillMode, 0, o / 4 * 6), - e.setAlphaMode(_.a.ALPHA_DISABLE) - } + if (!a) { + this._buffer.update(this._vertexData); + var u = this._effectBase; + this._scene.fogEnabled && + this._scene.fogMode !== Y.a.FOGMODE_NONE && + this.fogEnabled && + (u = this._effectFog), + e.enableEffect(u); + var l = this._scene.getViewMatrix(); + u.setTexture("diffuseSampler", this._spriteTexture), + u.setMatrix("view", l), + u.setMatrix( + "projection", + this._scene.getProjectionMatrix() + ), + u.setFloat2( + "textureInfos", + this.cellWidth / t.width, + this.cellHeight / t.height + ), + this._scene.fogEnabled && + this._scene.fogMode !== Y.a.FOGMODE_NONE && + this.fogEnabled && + (u.setFloat4( + "vFogInfos", + this._scene.fogMode, + this._scene.fogStart, + this._scene.fogEnd, + this._scene.fogDensity + ), + u.setColor3("vFogColor", this._scene.fogColor)), + e.bindBuffers( + this._vertexBuffers, + this._indexBuffer, + u + ), + e.setDepthFunctionToLessOrEqual(), + u.setBool("alphaTest", true), + e.setColorWrite(false), + e.drawElementsType( + Mr.a.TriangleFillMode, + 0, + (o / 4) * 6 + ), + e.setColorWrite(true), + u.setBool("alphaTest", false), + e.setAlphaMode(_.a.ALPHA_COMBINE), + e.drawElementsType( + Mr.a.TriangleFillMode, + 0, + (o / 4) * 6 + ), + e.setAlphaMode(_.a.ALPHA_DISABLE); } - } - , - e.prototype.dispose = function() { - this._buffer && (this._buffer.dispose(), - this._buffer = null), - this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), - this._indexBuffer = null), - this._spriteTexture && (this._spriteTexture.dispose(), - this._spriteTexture = null); - var e = this._scene.spriteManagers.indexOf(this); - this._scene.spriteManagers.splice(e, 1), + } + }), + (e.prototype.dispose = function () { + this._buffer && + (this._buffer.dispose(), (this._buffer = null)), + this._indexBuffer && + (this._scene + .getEngine() + ._releaseBuffer(this._indexBuffer), + (this._indexBuffer = null)), + this._spriteTexture && + (this._spriteTexture.dispose(), + (this._spriteTexture = null)); + var e = this._scene.spriteManagers.indexOf(this); + this._scene.spriteManagers.splice(e, 1), this.onDisposeObservable.notifyObservers(this), - this.onDisposeObservable.clear() - } - , + this.onDisposeObservable.clear(); + }), e - }(), Ws = n(94), Xs = n(104); - !function(e) { - e[e.INIT = 0] = "INIT", - e[e.RUNNING = 1] = "RUNNING", - e[e.DONE = 2] = "DONE", - e[e.ERROR = 3] = "ERROR" - }(js || (js = {})); - var Ys, Ks = function() { - function e(e) { - this.name = e, - this._isCompleted = false, - this._taskState = js.INIT - } - return Object.defineProperty(e.prototype, "isCompleted", { - get: function() { - return this._isCompleted - }, - enumerable: true, - configurable: true + ); + })(), + Ws = n(94), + Xs = n(104); + !(function (e) { + (e[(e.INIT = 0)] = "INIT"), + (e[(e.RUNNING = 1)] = "RUNNING"), + (e[(e.DONE = 2)] = "DONE"), + (e[(e.ERROR = 3)] = "ERROR"); + })(js || (js = {})); + var Ys, + Ks = (function () { + function e(e) { + (this.name = e), + (this._isCompleted = false), + (this._taskState = js.INIT); + } + return ( + Object.defineProperty(e.prototype, "isCompleted", { + get: function () { + return this._isCompleted; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "taskState", { - get: function() { - return this._taskState - }, - enumerable: true, - configurable: true + get: function () { + return this._taskState; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "errorObject", { - get: function() { - return this._errorObject - }, - enumerable: true, - configurable: true + get: function () { + return this._errorObject; + }, + enumerable: true, + configurable: true, }), - e.prototype._setErrorObject = function(e, t) { - this._errorObject || (this._errorObject = { - message: e, - exception: t - }) - } - , - e.prototype.run = function(e, t, i) { - var n = this; - this._taskState = js.RUNNING, - this.runTask(e, function() { - n.onDoneCallback(t, i) - }, function(e, t) { - n.onErrorCallback(i, e, t) - }) - } - , - e.prototype.runTask = function(e, t, i) { - throw new Error("runTask is not implemented") - } - , - e.prototype.reset = function() { - this._taskState = js.INIT - } - , - e.prototype.onErrorCallback = function(e, t, i) { - this._taskState = js.ERROR, - this._errorObject = { - message: t, - exception: i - }, + (e.prototype._setErrorObject = function (e, t) { + this._errorObject || + (this._errorObject = { + message: e, + exception: t, + }); + }), + (e.prototype.run = function (e, t, i) { + var n = this; + (this._taskState = js.RUNNING), + this.runTask( + e, + function () { + n.onDoneCallback(t, i); + }, + function (e, t) { + n.onErrorCallback(i, e, t); + } + ); + }), + (e.prototype.runTask = function (e, t, i) { + throw new Error("runTask is not implemented"); + }), + (e.prototype.reset = function () { + this._taskState = js.INIT; + }), + (e.prototype.onErrorCallback = function (e, t, i) { + (this._taskState = js.ERROR), + (this._errorObject = { + message: t, + exception: i, + }), this.onError && this.onError(this, t, i), - e() - } - , - e.prototype.onDoneCallback = function(e, t) { - try { - this._taskState = js.DONE, - this._isCompleted = true, - this.onSuccess && this.onSuccess(this), - e() - } catch (e) { - this.onErrorCallback(t, "Task is done, error executing success callback(s)", e) - } - } - , + e(); + }), + (e.prototype.onDoneCallback = function (e, t) { + try { + (this._taskState = js.DONE), + (this._isCompleted = true), + this.onSuccess && this.onSuccess(this), + e(); + } catch (e) { + this.onErrorCallback( + t, + "Task is done, error executing success callback(s)", + e + ); + } + }), e - }(), Qs = function(e, t, i) { - this.remainingCount = e, - this.totalCount = t, - this.task = i - }, qs = function(e) { - function t(t, i, n, r) { - var o = e.call(this, t) || this; - return o.name = t, - o.meshesNames = i, - o.rootUrl = n, - o.sceneFilename = r, - o - } - return h.d(t, e), - t.prototype.runTask = function(e, t, i) { - var n = this; - mn.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, e, function(e, i, r, o) { - n.loadedMeshes = e, - n.loadedParticleSystems = i, - n.loadedSkeletons = r, - n.loadedAnimationGroups = o, - t() - }, null, function(e, t, n) { - i(t, n) - }) - } - , + ); + })(), + Qs = function (e, t, i) { + (this.remainingCount = e), + (this.totalCount = t), + (this.task = i); + }, + qs = (function (e) { + function t(t, i, n, r) { + var o = e.call(this, t) || this; + return ( + (o.name = t), + (o.meshesNames = i), + (o.rootUrl = n), + (o.sceneFilename = r), + o + ); + } + return ( + h.d(t, e), + (t.prototype.runTask = function (e, t, i) { + var n = this; + mn.ImportMesh( + this.meshesNames, + this.rootUrl, + this.sceneFilename, + e, + function (e, i, r, o) { + (n.loadedMeshes = e), + (n.loadedParticleSystems = i), + (n.loadedSkeletons = r), + (n.loadedAnimationGroups = o), + t(); + }, + null, + function (e, t, n) { + i(t, n); + } + ); + }), t - }(Ks), Zs = function(e) { - function t(t, i) { - var n = e.call(this, t) || this; - return n.name = t, - n.url = i, - n - } - return h.d(t, e), - t.prototype.runTask = function(e, t, i) { - var n = this; - e._loadFile(this.url, function(e) { - n.text = e, - t() - }, void 0, false, false, function(e, t) { - e && i(e.status + " " + e.statusText, t) - }) - } - , + ); + })(Ks), + Zs = (function (e) { + function t(t, i) { + var n = e.call(this, t) || this; + return (n.name = t), (n.url = i), n; + } + return ( + h.d(t, e), + (t.prototype.runTask = function (e, t, i) { + var n = this; + e._loadFile( + this.url, + function (e) { + (n.text = e), t(); + }, + void 0, + false, + false, + function (e, t) { + e && i(e.status + " " + e.statusText, t); + } + ); + }), t - }(Ks), Js = function(e) { - function t(t, i) { - var n = e.call(this, t) || this; - return n.name = t, - n.url = i, - n - } - return h.d(t, e), - t.prototype.runTask = function(e, t, i) { - var n = this; - e._loadFile(this.url, function(e) { - n.data = e, - t() - }, void 0, true, true, function(e, t) { - e && i(e.status + " " + e.statusText, t) - }) - } - , + ); + })(Ks), + Js = (function (e) { + function t(t, i) { + var n = e.call(this, t) || this; + return (n.name = t), (n.url = i), n; + } + return ( + h.d(t, e), + (t.prototype.runTask = function (e, t, i) { + var n = this; + e._loadFile( + this.url, + function (e) { + (n.data = e), t(); + }, + void 0, + true, + true, + function (e, t) { + e && i(e.status + " " + e.statusText, t); + } + ); + }), t - }(Ks), $s = function(e) { - function t(t, i) { - var n = e.call(this, t) || this; - return n.name = t, - n.url = i, - n - } - return h.d(t, e), - t.prototype.runTask = function(e, t, i) { - var n = this - , r = new Image; - Ee.h.SetCorsBehavior(this.url, r), - r.onload = function() { - n.image = r, - t() - } - , - r.onerror = function(e) { - i("Error loading image", e) - } - , - r.src = this.url - } - , + ); + })(Ks), + $s = (function (e) { + function t(t, i) { + var n = e.call(this, t) || this; + return (n.name = t), (n.url = i), n; + } + return ( + h.d(t, e), + (t.prototype.runTask = function (e, t, i) { + var n = this, + r = new Image(); + Ee.h.SetCorsBehavior(this.url, r), + (r.onload = function () { + (n.image = r), t(); + }), + (r.onerror = function (e) { + i("Error loading image", e); + }), + (r.src = this.url); + }), t - }(Ks), ec = function(e) { - function t(t, i, n, r, o) { - void 0 === o && (o = je.a.TRILINEAR_SAMPLINGMODE); - var a = e.call(this, t) || this; - return a.name = t, - a.url = i, - a.noMipmap = n, - a.invertY = r, - a.samplingMode = o, - a - } - return h.d(t, e), - t.prototype.runTask = function(e, t, i) { - this.texture = new je.a(this.url,e,this.noMipmap,this.invertY,this.samplingMode,function() { - t() + ); + })(Ks), + ec = (function (e) { + function t(t, i, n, r, o) { + void 0 === o && (o = je.a.TRILINEAR_SAMPLINGMODE); + var a = e.call(this, t) || this; + return ( + (a.name = t), + (a.url = i), + (a.noMipmap = n), + (a.invertY = r), + (a.samplingMode = o), + a + ); + } + return ( + h.d(t, e), + (t.prototype.runTask = function (e, t, i) { + this.texture = new je.a( + this.url, + e, + this.noMipmap, + this.invertY, + this.samplingMode, + function () { + t(); + }, + function (e, t) { + i(e, t); } - ,function(e, t) { - i(e, t) - } - ) - } - , + ); + }), t - }(Ks), tc = function(e) { - function t(t, i, n, r, o) { - var a = e.call(this, t) || this; - return a.name = t, - a.url = i, - a.extensions = n, - a.noMipmap = r, - a.files = o, - a - } - return h.d(t, e), - t.prototype.runTask = function(e, t, i) { - this.texture = new Xn(this.url,e,this.extensions,this.noMipmap,this.files,function() { - t() + ); + })(Ks), + tc = (function (e) { + function t(t, i, n, r, o) { + var a = e.call(this, t) || this; + return ( + (a.name = t), + (a.url = i), + (a.extensions = n), + (a.noMipmap = r), + (a.files = o), + a + ); + } + return ( + h.d(t, e), + (t.prototype.runTask = function (e, t, i) { + this.texture = new Xn( + this.url, + e, + this.extensions, + this.noMipmap, + this.files, + function () { + t(); + }, + function (e, t) { + i(e, t); } - ,function(e, t) { - i(e, t) - } - ) - } - , + ); + }), t - }(Ks), ic = function(e) { - function t(t, i, n, r, o, a, s) { - void 0 === r && (r = false), - void 0 === o && (o = true), - void 0 === a && (a = false), - void 0 === s && (s = false); - var c = e.call(this, t) || this; - return c.name = t, - c.url = i, - c.size = n, - c.noMipmap = r, - c.generateHarmonics = o, - c.gammaSpace = a, - c.reserved = s, - c - } - return h.d(t, e), - t.prototype.runTask = function(e, t, i) { - this.texture = new Kr(this.url,e,this.size,this.noMipmap,this.generateHarmonics,this.gammaSpace,this.reserved,function() { - t() + ); + })(Ks), + ic = (function (e) { + function t(t, i, n, r, o, a, s) { + void 0 === r && (r = false), + void 0 === o && (o = true), + void 0 === a && (a = false), + void 0 === s && (s = false); + var c = e.call(this, t) || this; + return ( + (c.name = t), + (c.url = i), + (c.size = n), + (c.noMipmap = r), + (c.generateHarmonics = o), + (c.gammaSpace = a), + (c.reserved = s), + c + ); + } + return ( + h.d(t, e), + (t.prototype.runTask = function (e, t, i) { + this.texture = new Kr( + this.url, + e, + this.size, + this.noMipmap, + this.generateHarmonics, + this.gammaSpace, + this.reserved, + function () { + t(); + }, + function (e, t) { + i(e, t); } - ,function(e, t) { - i(e, t) - } - ) - } - , + ); + }), t - }(Ks), nc = function(e) { - function t(t, i, n, r, o) { - void 0 === r && (r = false), - void 0 === o && (o = true); - var a = e.call(this, t) || this; - return a.name = t, - a.url = i, - a.size = n, - a.noMipmap = r, - a.gammaSpace = o, - a - } - return h.d(t, e), - t.prototype.runTask = function(e, t, i) { - this.texture = new bo(this.url,e,this.size,this.noMipmap,this.gammaSpace,function() { - t() + ); + })(Ks), + nc = (function (e) { + function t(t, i, n, r, o) { + void 0 === r && (r = false), void 0 === o && (o = true); + var a = e.call(this, t) || this; + return ( + (a.name = t), + (a.url = i), + (a.size = n), + (a.noMipmap = r), + (a.gammaSpace = o), + a + ); + } + return ( + h.d(t, e), + (t.prototype.runTask = function (e, t, i) { + this.texture = new bo( + this.url, + e, + this.size, + this.noMipmap, + this.gammaSpace, + function () { + t(); + }, + function (e, t) { + i(e, t); } - ,function(e, t) { - i(e, t) - } - ) - } - , + ); + }), t - }(Ks), rc = function() { - function e(e) { - this._isLoading = false, - this._tasks = new Array, - this._waitingTasksCount = 0, - this._totalTasksCount = 0, - this.onTaskSuccessObservable = new o.c, - this.onTaskErrorObservable = new o.c, - this.onTasksDoneObservable = new o.c, - this.onProgressObservable = new o.c, - this.useDefaultLoadingScreen = true, - this._scene = e - } - return e.prototype.addMeshTask = function(e, t, i, n) { - var r = new qs(e,t,i,n); - return this._tasks.push(r), - r - } - , - e.prototype.addTextFileTask = function(e, t) { - var i = new Zs(e,t); - return this._tasks.push(i), - i - } - , - e.prototype.addBinaryFileTask = function(e, t) { - var i = new Js(e,t); - return this._tasks.push(i), - i - } - , - e.prototype.addImageTask = function(e, t) { - var i = new $s(e,t); - return this._tasks.push(i), - i - } - , - e.prototype.addTextureTask = function(e, t, i, n, r) { - void 0 === r && (r = je.a.TRILINEAR_SAMPLINGMODE); - var o = new ec(e,t,i,n,r); - return this._tasks.push(o), - o - } - , - e.prototype.addCubeTextureTask = function(e, t, i, n, r) { - var o = new tc(e,t,i,n,r); - return this._tasks.push(o), - o - } - , - e.prototype.addHDRCubeTextureTask = function(e, t, i, n, r, o, a) { - void 0 === n && (n = false), + ); + })(Ks), + rc = (function () { + function e(e) { + (this._isLoading = false), + (this._tasks = new Array()), + (this._waitingTasksCount = 0), + (this._totalTasksCount = 0), + (this.onTaskSuccessObservable = new o.c()), + (this.onTaskErrorObservable = new o.c()), + (this.onTasksDoneObservable = new o.c()), + (this.onProgressObservable = new o.c()), + (this.useDefaultLoadingScreen = true), + (this._scene = e); + } + return ( + (e.prototype.addMeshTask = function (e, t, i, n) { + var r = new qs(e, t, i, n); + return this._tasks.push(r), r; + }), + (e.prototype.addTextFileTask = function (e, t) { + var i = new Zs(e, t); + return this._tasks.push(i), i; + }), + (e.prototype.addBinaryFileTask = function (e, t) { + var i = new Js(e, t); + return this._tasks.push(i), i; + }), + (e.prototype.addImageTask = function (e, t) { + var i = new $s(e, t); + return this._tasks.push(i), i; + }), + (e.prototype.addTextureTask = function (e, t, i, n, r) { + void 0 === r && (r = je.a.TRILINEAR_SAMPLINGMODE); + var o = new ec(e, t, i, n, r); + return this._tasks.push(o), o; + }), + (e.prototype.addCubeTextureTask = function (e, t, i, n, r) { + var o = new tc(e, t, i, n, r); + return this._tasks.push(o), o; + }), + (e.prototype.addHDRCubeTextureTask = function ( + e, + t, + i, + n, + r, + o, + a + ) { + void 0 === n && (n = false), void 0 === r && (r = true), void 0 === o && (o = false), void 0 === a && (a = false); - var s = new ic(e,t,i,n,r,o,a); - return this._tasks.push(s), - s - } - , - e.prototype.addEquiRectangularCubeTextureAssetTask = function(e, t, i, n, r) { - void 0 === n && (n = false), - void 0 === r && (r = true); - var o = new nc(e,t,i,n,r); - return this._tasks.push(o), - o - } - , - e.prototype.removeTask = function(e) { - var t = this._tasks.indexOf(e); - t > -1 && this._tasks.splice(t, 1) - } - , - e.prototype._decreaseWaitingTasksCount = function(e) { - this._waitingTasksCount--; + var s = new ic(e, t, i, n, r, o, a); + return this._tasks.push(s), s; + }), + (e.prototype.addEquiRectangularCubeTextureAssetTask = + function (e, t, i, n, r) { + void 0 === n && (n = false), void 0 === r && (r = true); + var o = new nc(e, t, i, n, r); + return this._tasks.push(o), o; + }), + (e.prototype.removeTask = function (e) { + var t = this._tasks.indexOf(e); + t > -1 && this._tasks.splice(t, 1); + }), + (e.prototype._decreaseWaitingTasksCount = function (e) { + this._waitingTasksCount--; + try { + this.onProgress && + this.onProgress( + this._waitingTasksCount, + this._totalTasksCount, + e + ), + this.onProgressObservable.notifyObservers( + new Qs( + this._waitingTasksCount, + this._totalTasksCount, + e + ) + ); + } catch (e) { + g.a.Error("Error running progress callbacks."), + console.log(e); + } + if (0 === this._waitingTasksCount) { try { - this.onProgress && this.onProgress(this._waitingTasksCount, this._totalTasksCount, e), - this.onProgressObservable.notifyObservers(new Qs(this._waitingTasksCount,this._totalTasksCount,e)) - } catch (e) { - g.a.Error("Error running progress callbacks."), - console.log(e) - } - if (0 === this._waitingTasksCount) { - try { - this.onFinish && this.onFinish(this._tasks); - for (var t = this._tasks.slice(), i = 0, n = t; i < n.length; i++) - if ((e = n[i]).taskState === js.DONE) { - var r = this._tasks.indexOf(e); - r > -1 && this._tasks.splice(r, 1) - } - this.onTasksDoneObservable.notifyObservers(this._tasks) - } catch (e) { - g.a.Error("Error running tasks-done callbacks."), - console.log(e) + this.onFinish && this.onFinish(this._tasks); + for ( + var t = this._tasks.slice(), i = 0, n = t; + i < n.length; + i++ + ) + if ((e = n[i]).taskState === js.DONE) { + var r = this._tasks.indexOf(e); + r > -1 && this._tasks.splice(r, 1); } - this._isLoading = false, - this._scene.getEngine().hideLoadingUI() + this.onTasksDoneObservable.notifyObservers( + this._tasks + ); + } catch (e) { + g.a.Error("Error running tasks-done callbacks."), + console.log(e); } - } - , - e.prototype._runTask = function(e) { - var t = this - , i = function(i, n) { - e._setErrorObject(i, n), + (this._isLoading = false), + this._scene.getEngine().hideLoadingUI(); + } + }), + (e.prototype._runTask = function (e) { + var t = this, + i = function (i, n) { + e._setErrorObject(i, n), t.onTaskError && t.onTaskError(e), t.onTaskErrorObservable.notifyObservers(e), - t._decreaseWaitingTasksCount(e) + t._decreaseWaitingTasksCount(e); }; - e.run(this._scene, function() { - try { - t.onTaskSuccess && t.onTaskSuccess(e), - t.onTaskSuccessObservable.notifyObservers(e), - t._decreaseWaitingTasksCount(e) - } catch (e) { - i("Error executing task success callbacks", e) - } - }, i) - } - , - e.prototype.reset = function() { - return this._isLoading = false, - this._tasks = new Array, - this - } - , - e.prototype.load = function() { - if (this._isLoading) - return this; - if (this._isLoading = true, - this._waitingTasksCount = this._tasks.length, - this._totalTasksCount = this._tasks.length, - 0 === this._waitingTasksCount) - return this._isLoading = false, - this.onFinish && this.onFinish(this._tasks), - this.onTasksDoneObservable.notifyObservers(this._tasks), - this; - this.useDefaultLoadingScreen && this._scene.getEngine().displayLoadingUI(); - for (var e = 0; e < this._tasks.length; e++) { - var t = this._tasks[e]; - t.taskState === js.INIT && this._runTask(t) - } - return this - } - , - e.prototype.loadAsync = function() { - var e = this; - return new i(function(t, i) { - e.onTasksDoneObservable.addOnce(function(e) { - e && e.length ? i(e) : t() - }) - } - ) - } - , - e - }(), oc = function() { - function e() { - var e = this; - this.promise = new i(function(t, i) { - e._resolve = t, - e._reject = i - } - ) - } - return Object.defineProperty(e.prototype, "resolve", { - get: function() { - return this._resolve + e.run( + this._scene, + function () { + try { + t.onTaskSuccess && t.onTaskSuccess(e), + t.onTaskSuccessObservable.notifyObservers(e), + t._decreaseWaitingTasksCount(e); + } catch (e) { + i("Error executing task success callbacks", e); + } }, - enumerable: true, - configurable: true + i + ); + }), + (e.prototype.reset = function () { + return ( + (this._isLoading = false), + (this._tasks = new Array()), + this + ); + }), + (e.prototype.load = function () { + if (this._isLoading) return this; + if ( + ((this._isLoading = true), + (this._waitingTasksCount = this._tasks.length), + (this._totalTasksCount = this._tasks.length), + 0 === this._waitingTasksCount) + ) + return ( + (this._isLoading = false), + this.onFinish && this.onFinish(this._tasks), + this.onTasksDoneObservable.notifyObservers( + this._tasks + ), + this + ); + this.useDefaultLoadingScreen && + this._scene.getEngine().displayLoadingUI(); + for (var e = 0; e < this._tasks.length; e++) { + var t = this._tasks[e]; + t.taskState === js.INIT && this._runTask(t); + } + return this; + }), + (e.prototype.loadAsync = function () { + var e = this; + return new i(function (t, i) { + e.onTasksDoneObservable.addOnce(function (e) { + e && e.length ? i(e) : t(); + }); + }); + }), + e + ); + })(), + oc = (function () { + function e() { + var e = this; + this.promise = new i(function (t, i) { + (e._resolve = t), (e._reject = i); + }); + } + return ( + Object.defineProperty(e.prototype, "resolve", { + get: function () { + return this._resolve; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "reject", { - get: function() { - return this._reject - }, - enumerable: true, - configurable: true + get: function () { + return this._reject; + }, + enumerable: true, + configurable: true, }), e - }(), ac = function() { - function e(e, t) { - this._meshesOrigins = [], - this._toCenterVectors = [], - this._scaledDirection = a.x.Zero(), - this._newPosition = a.x.Zero(), - this._centerPosition = a.x.Zero(), - this._meshes = e.slice(), - t ? this._centerMesh = t : this._setCenterMesh(); - var i = this._meshes.indexOf(this._centerMesh); - i >= 0 && this._meshes.splice(i, 1), - this._centerPosition = this._centerMesh.getAbsolutePosition().clone(); - for (var n = 0; n < this._meshes.length; n++) - if (this._meshes[n]) { - var r = this._meshes[n]; - this._meshesOrigins[n] = r.getAbsolutePosition().clone(), - this._toCenterVectors[n] = a.x.Zero(), - r._boundingInfo && this._centerMesh._boundingInfo && r._boundingInfo.boundingBox.centerWorld.subtractToRef(this._centerMesh._boundingInfo.boundingBox.centerWorld, this._toCenterVectors[n]) - } - } - return e.prototype._setCenterMesh = function() { - for (var e = a.x.Zero(), t = a.x.Zero(), i = Number.MAX_VALUE, n = 0; n < this._meshes.length; n++) - this._meshes[n] && (o = (r = this._meshes[n]).getBoundingInfo()) && t.addInPlace(o.boundingBox.centerWorld); - for (e = t.scale(1 / this._meshes.length), - n = 0; n < this._meshes.length; n++) { - var r, o; - if (this._meshes[n] && (o = (r = this._meshes[n]).getBoundingInfo())) { - var s = o.boundingBox.centerWorld.subtract(e).lengthSquared(); - s < i && (this._centerMesh = r, - i = s) - } + ); + })(), + ac = (function () { + function e(e, t) { + (this._meshesOrigins = []), + (this._toCenterVectors = []), + (this._scaledDirection = a.x.Zero()), + (this._newPosition = a.x.Zero()), + (this._centerPosition = a.x.Zero()), + (this._meshes = e.slice()), + t ? (this._centerMesh = t) : this._setCenterMesh(); + var i = this._meshes.indexOf(this._centerMesh); + i >= 0 && this._meshes.splice(i, 1), + (this._centerPosition = this._centerMesh + .getAbsolutePosition() + .clone()); + for (var n = 0; n < this._meshes.length; n++) + if (this._meshes[n]) { + var r = this._meshes[n]; + (this._meshesOrigins[n] = r + .getAbsolutePosition() + .clone()), + (this._toCenterVectors[n] = a.x.Zero()), + r._boundingInfo && + this._centerMesh._boundingInfo && + r._boundingInfo.boundingBox.centerWorld.subtractToRef( + this._centerMesh._boundingInfo.boundingBox + .centerWorld, + this._toCenterVectors[n] + ); + } + } + return ( + (e.prototype._setCenterMesh = function () { + for ( + var e = a.x.Zero(), + t = a.x.Zero(), + i = Number.MAX_VALUE, + n = 0; + n < this._meshes.length; + n++ + ) + this._meshes[n] && + (o = (r = this._meshes[n]).getBoundingInfo()) && + t.addInPlace(o.boundingBox.centerWorld); + for ( + e = t.scale(1 / this._meshes.length), n = 0; + n < this._meshes.length; + n++ + ) { + var r, o; + if ( + this._meshes[n] && + (o = (r = this._meshes[n]).getBoundingInfo()) + ) { + var s = o.boundingBox.centerWorld + .subtract(e) + .lengthSquared(); + s < i && ((this._centerMesh = r), (i = s)); } - } - , - e.prototype.getClassName = function() { - return "MeshExploder" - } - , - e.prototype.getMeshes = function() { - var e = this._meshes.slice(); - return e.unshift(this._centerMesh), - e - } - , - e.prototype.explode = function(e) { - void 0 === e && (e = 1); - for (var t = 0; t < this._meshes.length; t++) - this._meshes[t] && this._meshesOrigins[t] && this._toCenterVectors[t] && (this._toCenterVectors[t].scaleToRef(e, this._scaledDirection), - this._meshesOrigins[t].addToRef(this._scaledDirection, this._newPosition), - this._meshes[t].setAbsolutePosition(this._newPosition)); - this._centerMesh.setAbsolutePosition(this._centerPosition) - } - , - e - }(), sc = function() { - function e(e, t, i, n, r, o, a, s, c) { - this.onProcessFileCallback = function() { - return true - } - , - this._engine = e, - this._currentScene = t, - this._sceneLoadedCallback = i, - this._progressCallback = n, - this._additionalRenderLoopLogicCallback = r, - this._textureLoadingCallback = o, - this._startingProcessingFilesCallback = a, - this._onReloadCallback = s, - this._errorCallback = c - } - return Object.defineProperty(e, "FilesToLoad", { - get: function() { - return fn.a.FilesToLoad - }, - enumerable: true, - configurable: true + } }), - e.prototype.monitorElementForDragNDrop = function(e) { - var t = this; - e && (this._elementToMonitor = e, - this._dragEnterHandler = function(e) { - t.drag(e) + (e.prototype.getClassName = function () { + return "MeshExploder"; + }), + (e.prototype.getMeshes = function () { + var e = this._meshes.slice(); + return e.unshift(this._centerMesh), e; + }), + (e.prototype.explode = function (e) { + void 0 === e && (e = 1); + for (var t = 0; t < this._meshes.length; t++) + this._meshes[t] && + this._meshesOrigins[t] && + this._toCenterVectors[t] && + (this._toCenterVectors[t].scaleToRef( + e, + this._scaledDirection + ), + this._meshesOrigins[t].addToRef( + this._scaledDirection, + this._newPosition + ), + this._meshes[t].setAbsolutePosition( + this._newPosition + )); + this._centerMesh.setAbsolutePosition( + this._centerPosition + ); + }), + e + ); + })(), + sc = (function () { + function e(e, t, i, n, r, o, a, s, c) { + (this.onProcessFileCallback = function () { + return true; + }), + (this._engine = e), + (this._currentScene = t), + (this._sceneLoadedCallback = i), + (this._progressCallback = n), + (this._additionalRenderLoopLogicCallback = r), + (this._textureLoadingCallback = o), + (this._startingProcessingFilesCallback = a), + (this._onReloadCallback = s), + (this._errorCallback = c); + } + return ( + Object.defineProperty(e, "FilesToLoad", { + get: function () { + return fn.a.FilesToLoad; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.monitorElementForDragNDrop = function (e) { + var t = this; + e && + ((this._elementToMonitor = e), + (this._dragEnterHandler = function (e) { + t.drag(e); + }), + (this._dragOverHandler = function (e) { + t.drag(e); + }), + (this._dropHandler = function (e) { + t.drop(e); + }), + this._elementToMonitor.addEventListener( + "dragenter", + this._dragEnterHandler, + false + ), + this._elementToMonitor.addEventListener( + "dragover", + this._dragOverHandler, + false + ), + this._elementToMonitor.addEventListener( + "drop", + this._dropHandler, + false + )); + }), + (e.prototype.dispose = function () { + this._elementToMonitor && + (this._elementToMonitor.removeEventListener( + "dragenter", + this._dragEnterHandler + ), + this._elementToMonitor.removeEventListener( + "dragover", + this._dragOverHandler + ), + this._elementToMonitor.removeEventListener( + "drop", + this._dropHandler + )); + }), + (e.prototype.renderFunction = function () { + if ( + (this._additionalRenderLoopLogicCallback && + this._additionalRenderLoopLogicCallback(), + this._currentScene) + ) { + if (this._textureLoadingCallback) { + var e = this._currentScene.getWaitingItemsCount(); + e > 0 && this._textureLoadingCallback(e); } - , - this._dragOverHandler = function(e) { - t.drag(e) - } - , - this._dropHandler = function(e) { - t.drop(e) - } - , - this._elementToMonitor.addEventListener("dragenter", this._dragEnterHandler, false), - this._elementToMonitor.addEventListener("dragover", this._dragOverHandler, false), - this._elementToMonitor.addEventListener("drop", this._dropHandler, false)) - } - , - e.prototype.dispose = function() { - this._elementToMonitor && (this._elementToMonitor.removeEventListener("dragenter", this._dragEnterHandler), - this._elementToMonitor.removeEventListener("dragover", this._dragOverHandler), - this._elementToMonitor.removeEventListener("drop", this._dropHandler)) - } - , - e.prototype.renderFunction = function() { - if (this._additionalRenderLoopLogicCallback && this._additionalRenderLoopLogicCallback(), - this._currentScene) { - if (this._textureLoadingCallback) { - var e = this._currentScene.getWaitingItemsCount(); - e > 0 && this._textureLoadingCallback(e) - } - this._currentScene.render() - } - } - , - e.prototype.drag = function(e) { - e.stopPropagation(), - e.preventDefault() - } - , - e.prototype.drop = function(e) { - e.stopPropagation(), + this._currentScene.render(); + } + }), + (e.prototype.drag = function (e) { + e.stopPropagation(), e.preventDefault(); + }), + (e.prototype.drop = function (e) { + e.stopPropagation(), e.preventDefault(), - this.loadFiles(e) - } - , - e.prototype._traverseFolder = function(e, t, i, n) { - var r = this - , o = e.createReader() - , a = e.fullPath.replace(/^\//, "").replace(/(.+?)\/?$/, "$1/"); - o.readEntries(function(e) { - i.count += e.length; - for (var o = 0, s = e; o < s.length; o++) { - var c = s[o]; - c.isFile ? c.file(function(e) { - e.correctName = a + e.name, - t.push(e), - 0 == --i.count && n() - }) : c.isDirectory && r._traverseFolder(c, t, i, n) - } - --i.count && n() - }) - } - , - e.prototype._processFiles = function(t) { - for (var i = 0; i < t.length; i++) { - var n = t[i].correctName.toLowerCase() - , r = n.split(".").pop(); - this.onProcessFileCallback(t[i], n, r) && ("babylon" !== r && "stl" !== r && "obj" !== r && "gltf" !== r && "glb" !== r || -1 !== n.indexOf(".binary.babylon") || -1 !== n.indexOf(".incremental.babylon") || (this._sceneFileToLoad = t[i]), - e.FilesToLoad[n] = t[i]) - } - } - , - e.prototype.loadFiles = function(e) { - var t = this; - if (e && e.dataTransfer && e.dataTransfer.files && (this._filesToLoad = e.dataTransfer.files), - e && e.target && e.target.files && (this._filesToLoad = e.target.files), - this._filesToLoad && 0 !== this._filesToLoad.length && (this._startingProcessingFilesCallback && this._startingProcessingFilesCallback(this._filesToLoad), - this._filesToLoad && this._filesToLoad.length > 0)) { - for (var i = new Array, n = [], r = e.dataTransfer ? e.dataTransfer.items : null, o = 0; o < this._filesToLoad.length; o++) { - var a = this._filesToLoad[o] - , s = a.name.toLowerCase() - , c = void 0; - if (a.correctName = s, - r) { - var u = r[o]; - u.getAsEntry ? c = u.getAsEntry() : u.webkitGetAsEntry && (c = u.webkitGetAsEntry()) - } - c && c.isDirectory ? n.push(c) : i.push(a) - } - if (0 === n.length) - this._processFiles(i), - this._processReload(); - else - for (var l = { - count: n.length - }, h = 0, f = n; h < f.length; h++) { - var d = f[h]; - this._traverseFolder(d, i, l, function() { - t._processFiles(i), - 0 === l.count && t._processReload() - }) - } - } - } - , - e.prototype._processReload = function() { - this._onReloadCallback ? this._onReloadCallback(this._sceneFileToLoad) : this.reload() - } - , - e.prototype.reload = function() { - var e = this; - this._sceneFileToLoad ? (this._currentScene && (g.a.errorsCount > 0 && g.a.ClearLogCache(), - this._engine.stopRenderLoop()), - mn.LoadAsync("file:", this._sceneFileToLoad, this._engine, function(t) { - e._progressCallback && e._progressCallback(t) - }).then(function(t) { - e._currentScene && e._currentScene.dispose(), - e._currentScene = t, - e._sceneLoadedCallback && e._sceneLoadedCallback(e._sceneFileToLoad, e._currentScene), - e._currentScene.executeWhenReady(function() { - e._engine.runRenderLoop(function() { - e.renderFunction() - }) - }) - }).catch(function(t) { - e._errorCallback && e._errorCallback(e._sceneFileToLoad, e._currentScene, t.message) - })) : g.a.Error("Please provide a valid .babylon file.") - } - , - e - }(), cc = n(105), uc = n(106), lc = function() { - function e(e) { - void 0 === e && (e = 0), - this.priority = e - } - return e.prototype.getDescription = function() { - return "" - } - , - e.prototype.apply = function(e, t) { - return true - } - , - e - }(), hc = function(e) { - function t(t, i, n) { - void 0 === t && (t = 0), - void 0 === i && (i = 1024), - void 0 === n && (n = .5); - var r = e.call(this, t) || this; - return r.priority = t, - r.maximumSize = i, - r.step = n, - r - } - return h.d(t, e), - t.prototype.getDescription = function() { - return "Reducing render target texture size to " + this.maximumSize - } - , - t.prototype.apply = function(e, t) { - for (var i = true, n = 0; n < e.textures.length; n++) { - var r = e.textures[n]; - if (r.canRescale && !r.getContext) { - var o = r.getSize(); - Math.max(o.width, o.height) > this.maximumSize && (r.scale(this.step), - i = false) - } - } - return i - } - , - t - }(lc), fc = function(e) { - function t(t, i, n) { - void 0 === t && (t = 0), - void 0 === i && (i = 2), - void 0 === n && (n = .25); - var r = e.call(this, t) || this; - return r.priority = t, - r.maximumScale = i, - r.step = n, - r._currentScale = -1, - r._directionOffset = 1, - r - } - return h.d(t, e), - t.prototype.getDescription = function() { - return "Setting hardware scaling level to " + this._currentScale - } - , - t.prototype.apply = function(e, t) { - return -1 === this._currentScale && (this._currentScale = e.getEngine().getHardwareScalingLevel(), - this._currentScale > this.maximumScale && (this._directionOffset = -1)), - this._currentScale += this._directionOffset * this.step, - e.getEngine().setHardwareScalingLevel(this._currentScale), - 1 === this._directionOffset ? this._currentScale >= this.maximumScale : this._currentScale <= this.maximumScale - } - , - t - }(lc), dc = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.getDescription = function() { - return "Turning shadows on/off" - } - , - t.prototype.apply = function(e, t) { - return e.shadowsEnabled = t.isInImprovementMode, - true - } - , - t - }(lc), pc = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.getDescription = function() { - return "Turning post-processes on/off" - } - , - t.prototype.apply = function(e, t) { - return e.postProcessesEnabled = t.isInImprovementMode, - true - } - , - t - }(lc), mc = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.getDescription = function() { - return "Turning lens flares on/off" - } - , - t.prototype.apply = function(e, t) { - return e.lensFlaresEnabled = t.isInImprovementMode, - true - } - , - t - }(lc), gc = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.getDescription = function() { - return this.onGetDescription ? this.onGetDescription() : "Running user defined callback" - } - , - t.prototype.apply = function(e, t) { - return !this.onApply || this.onApply(e, t) - } - , - t - }(lc), _c = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.getDescription = function() { - return "Turning particles on/off" - } - , - t.prototype.apply = function(e, t) { - return e.particlesEnabled = t.isInImprovementMode, - true - } - , - t - }(lc), vc = function(e) { - function t() { - return null !== e && e.apply(this, arguments) || this - } - return h.d(t, e), - t.prototype.getDescription = function() { - return "Turning render targets off" - } - , - t.prototype.apply = function(e, t) { - return e.renderTargetsEnabled = t.isInImprovementMode, - true - } - , - t - }(lc), yc = function(e) { - function t() { - var t = null !== e && e.apply(this, arguments) || this; - return t._canBeMerged = function(e) { - if (!(e instanceof me.a)) - return false; - var t = e; - return !(t.isDisposed() || !t.isVisible || !t.isEnabled() || t.instances.length > 0 || t.skeleton || t.hasLODLevels) - } - , - t - } - return h.d(t, e), - Object.defineProperty(t, "UpdateSelectionTree", { - get: function() { - return t._UpdateSelectionTree - }, - set: function(e) { - t._UpdateSelectionTree = e - }, - enumerable: true, - configurable: true + this.loadFiles(e); }), - t.prototype.getDescription = function() { - return "Merging similar meshes together" - } - , - t.prototype.apply = function(e, i, n) { - for (var r = e.meshes.slice(0), o = r.length, a = 0; a < o; a++) { - var s = new Array - , c = r[a]; - if (this._canBeMerged(c)) { - s.push(c); - for (var u = a + 1; u < o; u++) { - var l = r[u]; - this._canBeMerged(l) && l.material === c.material && l.checkCollisions === c.checkCollisions && (s.push(l), - o--, - r.splice(u, 1), - u--) - } - s.length < 2 || me.a.MergeMeshes(s, void 0, true) - } + (e.prototype._traverseFolder = function (e, t, i, n) { + var r = this, + o = e.createReader(), + a = e.fullPath + .replace(/^\//, "") + .replace(/(.+?)\/?$/, "$1/"); + o.readEntries(function (e) { + i.count += e.length; + for (var o = 0, s = e; o < s.length; o++) { + var c = s[o]; + c.isFile + ? c.file(function (e) { + (e.correctName = a + e.name), + t.push(e), + 0 == --i.count && n(); + }) + : c.isDirectory && r._traverseFolder(c, t, i, n); } - var h = e; - return h.createOrUpdateSelectionOctree && (null != n ? n && h.createOrUpdateSelectionOctree() : t.UpdateSelectionTree && h.createOrUpdateSelectionOctree()), - true - } - , - t._UpdateSelectionTree = false, + --i.count && n(); + }); + }), + (e.prototype._processFiles = function (t) { + for (var i = 0; i < t.length; i++) { + var n = t[i].correctName.toLowerCase(), + r = n.split(".").pop(); + this.onProcessFileCallback(t[i], n, r) && + (("babylon" !== r && + "stl" !== r && + "obj" !== r && + "gltf" !== r && + "glb" !== r) || + -1 !== n.indexOf(".binary.babylon") || + -1 !== n.indexOf(".incremental.babylon") || + (this._sceneFileToLoad = t[i]), + (e.FilesToLoad[n] = t[i])); + } + }), + (e.prototype.loadFiles = function (e) { + var t = this; + if ( + (e && + e.dataTransfer && + e.dataTransfer.files && + (this._filesToLoad = e.dataTransfer.files), + e && + e.target && + e.target.files && + (this._filesToLoad = e.target.files), + this._filesToLoad && + 0 !== this._filesToLoad.length && + (this._startingProcessingFilesCallback && + this._startingProcessingFilesCallback( + this._filesToLoad + ), + this._filesToLoad && this._filesToLoad.length > 0)) + ) { + for ( + var i = new Array(), + n = [], + r = e.dataTransfer ? e.dataTransfer.items : null, + o = 0; + o < this._filesToLoad.length; + o++ + ) { + var a = this._filesToLoad[o], + s = a.name.toLowerCase(), + c = void 0; + if (((a.correctName = s), r)) { + var u = r[o]; + u.getAsEntry + ? (c = u.getAsEntry()) + : u.webkitGetAsEntry && + (c = u.webkitGetAsEntry()); + } + c && c.isDirectory ? n.push(c) : i.push(a); + } + if (0 === n.length) + this._processFiles(i), this._processReload(); + else + for ( + var l = { + count: n.length, + }, + h = 0, + f = n; + h < f.length; + h++ + ) { + var d = f[h]; + this._traverseFolder(d, i, l, function () { + t._processFiles(i), + 0 === l.count && t._processReload(); + }); + } + } + }), + (e.prototype._processReload = function () { + this._onReloadCallback + ? this._onReloadCallback(this._sceneFileToLoad) + : this.reload(); + }), + (e.prototype.reload = function () { + var e = this; + this._sceneFileToLoad + ? (this._currentScene && + (g.a.errorsCount > 0 && g.a.ClearLogCache(), + this._engine.stopRenderLoop()), + mn + .LoadAsync( + "file:", + this._sceneFileToLoad, + this._engine, + function (t) { + e._progressCallback && e._progressCallback(t); + } + ) + .then(function (t) { + e._currentScene && e._currentScene.dispose(), + (e._currentScene = t), + e._sceneLoadedCallback && + e._sceneLoadedCallback( + e._sceneFileToLoad, + e._currentScene + ), + e._currentScene.executeWhenReady(function () { + e._engine.runRenderLoop(function () { + e.renderFunction(); + }); + }); + }) + .catch(function (t) { + e._errorCallback && + e._errorCallback( + e._sceneFileToLoad, + e._currentScene, + t.message + ); + })) + : g.a.Error("Please provide a valid .babylon file."); + }), + e + ); + })(), + cc = n(105), + uc = n(106), + lc = (function () { + function e(e) { + void 0 === e && (e = 0), (this.priority = e); + } + return ( + (e.prototype.getDescription = function () { + return ""; + }), + (e.prototype.apply = function (e, t) { + return true; + }), + e + ); + })(), + hc = (function (e) { + function t(t, i, n) { + void 0 === t && (t = 0), + void 0 === i && (i = 1024), + void 0 === n && (n = 0.5); + var r = e.call(this, t) || this; + return ( + (r.priority = t), (r.maximumSize = i), (r.step = n), r + ); + } + return ( + h.d(t, e), + (t.prototype.getDescription = function () { + return ( + "Reducing render target texture size to " + + this.maximumSize + ); + }), + (t.prototype.apply = function (e, t) { + for (var i = true, n = 0; n < e.textures.length; n++) { + var r = e.textures[n]; + if (r.canRescale && !r.getContext) { + var o = r.getSize(); + Math.max(o.width, o.height) > this.maximumSize && + (r.scale(this.step), (i = false)); + } + } + return i; + }), t - }(lc), bc = function() { - function e(e, t) { - void 0 === e && (e = 60), - void 0 === t && (t = 2e3), - this.targetFrameRate = e, - this.trackerDuration = t, - this.optimizations = new Array - } - return e.prototype.addOptimization = function(e) { - return this.optimizations.push(e), - this - } - , - e.prototype.addCustomOptimization = function(e, t, i) { - void 0 === i && (i = 0); - var n = new gc(i); - return n.onApply = e, - n.onGetDescription = t, + ); + })(lc), + fc = (function (e) { + function t(t, i, n) { + void 0 === t && (t = 0), + void 0 === i && (i = 2), + void 0 === n && (n = 0.25); + var r = e.call(this, t) || this; + return ( + (r.priority = t), + (r.maximumScale = i), + (r.step = n), + (r._currentScale = -1), + (r._directionOffset = 1), + r + ); + } + return ( + h.d(t, e), + (t.prototype.getDescription = function () { + return ( + "Setting hardware scaling level to " + + this._currentScale + ); + }), + (t.prototype.apply = function (e, t) { + return ( + -1 === this._currentScale && + ((this._currentScale = e + .getEngine() + .getHardwareScalingLevel()), + this._currentScale > this.maximumScale && + (this._directionOffset = -1)), + (this._currentScale += + this._directionOffset * this.step), + e + .getEngine() + .setHardwareScalingLevel(this._currentScale), + 1 === this._directionOffset + ? this._currentScale >= this.maximumScale + : this._currentScale <= this.maximumScale + ); + }), + t + ); + })(lc), + dc = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.getDescription = function () { + return "Turning shadows on/off"; + }), + (t.prototype.apply = function (e, t) { + return (e.shadowsEnabled = t.isInImprovementMode), true; + }), + t + ); + })(lc), + pc = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.getDescription = function () { + return "Turning post-processes on/off"; + }), + (t.prototype.apply = function (e, t) { + return ( + (e.postProcessesEnabled = t.isInImprovementMode), true + ); + }), + t + ); + })(lc), + mc = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.getDescription = function () { + return "Turning lens flares on/off"; + }), + (t.prototype.apply = function (e, t) { + return ( + (e.lensFlaresEnabled = t.isInImprovementMode), true + ); + }), + t + ); + })(lc), + gc = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.getDescription = function () { + return this.onGetDescription + ? this.onGetDescription() + : "Running user defined callback"; + }), + (t.prototype.apply = function (e, t) { + return !this.onApply || this.onApply(e, t); + }), + t + ); + })(lc), + _c = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.getDescription = function () { + return "Turning particles on/off"; + }), + (t.prototype.apply = function (e, t) { + return (e.particlesEnabled = t.isInImprovementMode), true; + }), + t + ); + })(lc), + vc = (function (e) { + function t() { + return (null !== e && e.apply(this, arguments)) || this; + } + return ( + h.d(t, e), + (t.prototype.getDescription = function () { + return "Turning render targets off"; + }), + (t.prototype.apply = function (e, t) { + return ( + (e.renderTargetsEnabled = t.isInImprovementMode), true + ); + }), + t + ); + })(lc), + yc = (function (e) { + function t() { + var t = (null !== e && e.apply(this, arguments)) || this; + return ( + (t._canBeMerged = function (e) { + if (!(e instanceof me.a)) return false; + var t = e; + return !( + t.isDisposed() || + !t.isVisible || + !t.isEnabled() || + t.instances.length > 0 || + t.skeleton || + t.hasLODLevels + ); + }), + t + ); + } + return ( + h.d(t, e), + Object.defineProperty(t, "UpdateSelectionTree", { + get: function () { + return t._UpdateSelectionTree; + }, + set: function (e) { + t._UpdateSelectionTree = e; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getDescription = function () { + return "Merging similar meshes together"; + }), + (t.prototype.apply = function (e, i, n) { + for ( + var r = e.meshes.slice(0), o = r.length, a = 0; + a < o; + a++ + ) { + var s = new Array(), + c = r[a]; + if (this._canBeMerged(c)) { + s.push(c); + for (var u = a + 1; u < o; u++) { + var l = r[u]; + this._canBeMerged(l) && + l.material === c.material && + l.checkCollisions === c.checkCollisions && + (s.push(l), o--, r.splice(u, 1), u--); + } + s.length < 2 || me.a.MergeMeshes(s, void 0, true); + } + } + var h = e; + return ( + h.createOrUpdateSelectionOctree && + (null != n + ? n && h.createOrUpdateSelectionOctree() + : t.UpdateSelectionTree && + h.createOrUpdateSelectionOctree()), + true + ); + }), + (t._UpdateSelectionTree = false), + t + ); + })(lc), + bc = (function () { + function e(e, t) { + void 0 === e && (e = 60), + void 0 === t && (t = 2e3), + (this.targetFrameRate = e), + (this.trackerDuration = t), + (this.optimizations = new Array()); + } + return ( + (e.prototype.addOptimization = function (e) { + return this.optimizations.push(e), this; + }), + (e.prototype.addCustomOptimization = function (e, t, i) { + void 0 === i && (i = 0); + var n = new gc(i); + return ( + (n.onApply = e), + (n.onGetDescription = t), this.optimizations.push(n), this - } - , - e.LowDegradationAllowed = function(t) { - var i = new e(t) - , n = 0; - return i.addOptimization(new yc(n)), + ); + }), + (e.LowDegradationAllowed = function (t) { + var i = new e(t), + n = 0; + return ( + i.addOptimization(new yc(n)), i.addOptimization(new dc(n)), i.addOptimization(new mc(n)), n++, i.addOptimization(new pc(n)), i.addOptimization(new _c(n)), n++, - i.addOptimization(new hc(n,1024)), + i.addOptimization(new hc(n, 1024)), i - } - , - e.ModerateDegradationAllowed = function(t) { - var i = new e(t) - , n = 0; - return i.addOptimization(new yc(n)), + ); + }), + (e.ModerateDegradationAllowed = function (t) { + var i = new e(t), + n = 0; + return ( + i.addOptimization(new yc(n)), i.addOptimization(new dc(n)), i.addOptimization(new mc(n)), n++, i.addOptimization(new pc(n)), i.addOptimization(new _c(n)), n++, - i.addOptimization(new hc(n,512)), + i.addOptimization(new hc(n, 512)), n++, i.addOptimization(new vc(n)), n++, - i.addOptimization(new fc(n,2)), + i.addOptimization(new fc(n, 2)), i - } - , - e.HighDegradationAllowed = function(t) { - var i = new e(t) - , n = 0; - return i.addOptimization(new yc(n)), + ); + }), + (e.HighDegradationAllowed = function (t) { + var i = new e(t), + n = 0; + return ( + i.addOptimization(new yc(n)), i.addOptimization(new dc(n)), i.addOptimization(new mc(n)), n++, i.addOptimization(new pc(n)), i.addOptimization(new _c(n)), n++, - i.addOptimization(new hc(n,256)), + i.addOptimization(new hc(n, 256)), n++, i.addOptimization(new vc(n)), n++, - i.addOptimization(new fc(n,4)), + i.addOptimization(new fc(n, 4)), i - } - , + ); + }), e - }(), Ec = function() { - function e(e, t, i, n) { - var r = this; - if (void 0 === i && (i = true), - void 0 === n && (n = false), - this._isRunning = false, - this._currentPriorityLevel = 0, - this._targetFrameRate = 60, - this._trackerDuration = 2e3, - this._currentFrameRate = 0, - this._improvementMode = false, - this.onSuccessObservable = new o.c, - this.onNewOptimizationAppliedObservable = new o.c, - this.onFailureObservable = new o.c, - this._options = t || new bc, - this._options.targetFrameRate && (this._targetFrameRate = this._options.targetFrameRate), - this._options.trackerDuration && (this._trackerDuration = this._options.trackerDuration), - i) - for (var a = 0, s = 0, c = this._options.optimizations; s < c.length; s++) - c[s].priority = a++; - this._improvementMode = n, - this._scene = e || R.a.LastCreatedScene, - this._sceneDisposeObserver = this._scene.onDisposeObservable.add(function() { - r._sceneDisposeObserver = null, - r.dispose() - }) - } - return Object.defineProperty(e.prototype, "isInImprovementMode", { - get: function() { - return this._improvementMode - }, - enumerable: true, - configurable: true + ); + })(), + Ec = (function () { + function e(e, t, i, n) { + var r = this; + if ( + (void 0 === i && (i = true), + void 0 === n && (n = false), + (this._isRunning = false), + (this._currentPriorityLevel = 0), + (this._targetFrameRate = 60), + (this._trackerDuration = 2e3), + (this._currentFrameRate = 0), + (this._improvementMode = false), + (this.onSuccessObservable = new o.c()), + (this.onNewOptimizationAppliedObservable = new o.c()), + (this.onFailureObservable = new o.c()), + (this._options = t || new bc()), + this._options.targetFrameRate && + (this._targetFrameRate = this._options.targetFrameRate), + this._options.trackerDuration && + (this._trackerDuration = this._options.trackerDuration), + i) + ) + for ( + var a = 0, s = 0, c = this._options.optimizations; + s < c.length; + s++ + ) + c[s].priority = a++; + (this._improvementMode = n), + (this._scene = e || R.a.LastCreatedScene), + (this._sceneDisposeObserver = + this._scene.onDisposeObservable.add(function () { + (r._sceneDisposeObserver = null), r.dispose(); + })); + } + return ( + Object.defineProperty(e.prototype, "isInImprovementMode", { + get: function () { + return this._improvementMode; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "currentPriorityLevel", { - get: function() { - return this._currentPriorityLevel - }, - enumerable: true, - configurable: true + get: function () { + return this._currentPriorityLevel; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "currentFrameRate", { - get: function() { - return this._currentFrameRate - }, - enumerable: true, - configurable: true + get: function () { + return this._currentFrameRate; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "targetFrameRate", { - get: function() { - return this._targetFrameRate - }, - set: function(e) { - this._targetFrameRate = e - }, - enumerable: true, - configurable: true + get: function () { + return this._targetFrameRate; + }, + set: function (e) { + this._targetFrameRate = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "trackerDuration", { - get: function() { - return this._trackerDuration - }, - set: function(e) { - this._trackerDuration = e - }, - enumerable: true, - configurable: true + get: function () { + return this._trackerDuration; + }, + set: function (e) { + this._trackerDuration = e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "optimizations", { - get: function() { - return this._options.optimizations - }, - enumerable: true, - configurable: true + get: function () { + return this._options.optimizations; + }, + enumerable: true, + configurable: true, }), - e.prototype.stop = function() { - this._isRunning = false - } - , - e.prototype.reset = function() { - this._currentPriorityLevel = 0 - } - , - e.prototype.start = function() { - var e = this; - this._isRunning || (this._isRunning = true, - this._scene.executeWhenReady(function() { - setTimeout(function() { - e._checkCurrentState() - }, e._trackerDuration) - })) - } - , - e.prototype._checkCurrentState = function() { - var e = this; - if (this._isRunning) { - var t = this._scene - , i = this._options; - if (this._currentFrameRate = Math.round(t.getEngine().getFps()), - this._improvementMode && this._currentFrameRate <= this._targetFrameRate || !this._improvementMode && this._currentFrameRate >= this._targetFrameRate) - return this._isRunning = false, - void this.onSuccessObservable.notifyObservers(this); - for (var n = true, r = true, o = 0; o < i.optimizations.length; o++) { - var a = i.optimizations[o]; - a.priority === this._currentPriorityLevel && (r = false, - n = n && a.apply(t, this), - this.onNewOptimizationAppliedObservable.notifyObservers(a)) - } - if (r) - return this._isRunning = false, - void this.onFailureObservable.notifyObservers(this); - n && this._currentPriorityLevel++, - t.executeWhenReady(function() { - setTimeout(function() { - e._checkCurrentState() - }, e._trackerDuration) - }) + (e.prototype.stop = function () { + this._isRunning = false; + }), + (e.prototype.reset = function () { + this._currentPriorityLevel = 0; + }), + (e.prototype.start = function () { + var e = this; + this._isRunning || + ((this._isRunning = true), + this._scene.executeWhenReady(function () { + setTimeout(function () { + e._checkCurrentState(); + }, e._trackerDuration); + })); + }), + (e.prototype._checkCurrentState = function () { + var e = this; + if (this._isRunning) { + var t = this._scene, + i = this._options; + if ( + ((this._currentFrameRate = Math.round( + t.getEngine().getFps() + )), + (this._improvementMode && + this._currentFrameRate <= this._targetFrameRate) || + (!this._improvementMode && + this._currentFrameRate >= this._targetFrameRate)) + ) + return ( + (this._isRunning = false), + void this.onSuccessObservable.notifyObservers(this) + ); + for ( + var n = true, r = true, o = 0; + o < i.optimizations.length; + o++ + ) { + var a = i.optimizations[o]; + a.priority === this._currentPriorityLevel && + ((r = false), + (n = n && a.apply(t, this)), + this.onNewOptimizationAppliedObservable.notifyObservers( + a + )); } - } - , - e.prototype.dispose = function() { - this.stop(), + if (r) + return ( + (this._isRunning = false), + void this.onFailureObservable.notifyObservers(this) + ); + n && this._currentPriorityLevel++, + t.executeWhenReady(function () { + setTimeout(function () { + e._checkCurrentState(); + }, e._trackerDuration); + }); + } + }), + (e.prototype.dispose = function () { + this.stop(), this.onSuccessObservable.clear(), this.onFailureObservable.clear(), this.onNewOptimizationAppliedObservable.clear(), - this._sceneDisposeObserver && this._scene.onDisposeObservable.remove(this._sceneDisposeObserver) - } - , - e.OptimizeAsync = function(t, i, n, r) { - var o = new e(t,i || bc.ModerateDegradationAllowed(),false); - return n && o.onSuccessObservable.add(function() { - n() - }), - r && o.onFailureObservable.add(function() { - r() - }), + this._sceneDisposeObserver && + this._scene.onDisposeObservable.remove( + this._sceneDisposeObserver + ); + }), + (e.OptimizeAsync = function (t, i, n, r) { + var o = new e( + t, + i || bc.ModerateDegradationAllowed(), + false + ); + return ( + n && + o.onSuccessObservable.add(function () { + n(); + }), + r && + o.onFailureObservable.add(function () { + r(); + }), o.start(), o - } - , + ); + }), e - }(), Tc = [], Ac = function(e, t) { - Tc[e.id] || e.doNotSerialize || (t.vertexData.push(e.serializeVerticeData()), - Tc[e.id] = true) - }, xc = function(e, t) { - var i = {} - , n = e._geometry; - return n && (e.getScene().getGeometryByID(n.id) || Ac(n, t.geometries)), + ); + })(), + Tc = [], + Ac = function (e, t) { + Tc[e.id] || + e.doNotSerialize || + (t.vertexData.push(e.serializeVerticeData()), + (Tc[e.id] = true)); + }, + xc = function (e, t) { + var i = {}, + n = e._geometry; + return ( + n && + (e.getScene().getGeometryByID(n.id) || + Ac(n, t.geometries)), e.serialize && e.serialize(i), i - }, Sc = function() { - function e() {} - return e.ClearCache = function() { - Tc = [] - } - , - e.Serialize = function(t) { - var i, n, r, o = {}; - if (e.ClearCache(), - o.useDelayedTextureLoading = t.useDelayedTextureLoading, - o.autoClear = t.autoClear, - o.clearColor = t.clearColor.asArray(), - o.ambientColor = t.ambientColor.asArray(), - o.gravity = t.gravity.asArray(), - o.collisionsEnabled = t.collisionsEnabled, - t.fogMode && 0 !== t.fogMode && (o.fogMode = t.fogMode, - o.fogColor = t.fogColor.asArray(), - o.fogStart = t.fogStart, - o.fogEnd = t.fogEnd, - o.fogDensity = t.fogDensity), - t.isPhysicsEnabled()) { - var a = t.getPhysicsEngine(); - a && (o.physicsEnabled = true, - o.physicsGravity = a.gravity.asArray(), - o.physicsEngine = a.getPhysicsPluginName()) - } - t.metadata && (o.metadata = t.metadata), - o.morphTargetManagers = []; - for (var s = 0, c = t.meshes; s < c.length; s++) { - var u = (g = c[s]).morphTargetManager; - u && o.morphTargetManagers.push(u.serialize()) - } - for (o.lights = [], - i = 0; i < t.lights.length; i++) - (n = t.lights[i]).doNotSerialize || o.lights.push(n.serialize()); - for (o.cameras = [], - i = 0; i < t.cameras.length; i++) { - var l = t.cameras[i]; - l.doNotSerialize || o.cameras.push(l.serialize()) - } - if (t.activeCamera && (o.activeCameraID = t.activeCamera.id), + ); + }, + Sc = (function () { + function e() {} + return ( + (e.ClearCache = function () { + Tc = []; + }), + (e.Serialize = function (t) { + var i, + n, + r, + o = {}; + if ( + (e.ClearCache(), + (o.useDelayedTextureLoading = + t.useDelayedTextureLoading), + (o.autoClear = t.autoClear), + (o.clearColor = t.clearColor.asArray()), + (o.ambientColor = t.ambientColor.asArray()), + (o.gravity = t.gravity.asArray()), + (o.collisionsEnabled = t.collisionsEnabled), + t.fogMode && + 0 !== t.fogMode && + ((o.fogMode = t.fogMode), + (o.fogColor = t.fogColor.asArray()), + (o.fogStart = t.fogStart), + (o.fogEnd = t.fogEnd), + (o.fogDensity = t.fogDensity)), + t.isPhysicsEnabled()) + ) { + var a = t.getPhysicsEngine(); + a && + ((o.physicsEnabled = true), + (o.physicsGravity = a.gravity.asArray()), + (o.physicsEngine = a.getPhysicsPluginName())); + } + t.metadata && (o.metadata = t.metadata), + (o.morphTargetManagers = []); + for (var s = 0, c = t.meshes; s < c.length; s++) { + var u = (g = c[s]).morphTargetManager; + u && o.morphTargetManagers.push(u.serialize()); + } + for (o.lights = [], i = 0; i < t.lights.length; i++) + (n = t.lights[i]).doNotSerialize || + o.lights.push(n.serialize()); + for (o.cameras = [], i = 0; i < t.cameras.length; i++) { + var l = t.cameras[i]; + l.doNotSerialize || o.cameras.push(l.serialize()); + } + if ( + (t.activeCamera && + (o.activeCameraID = t.activeCamera.id), F.a.AppendSerializedAnimations(t, o), t.reflectionProbes && t.reflectionProbes.length > 0) - for (o.reflectionProbes = [], - i = 0; i < t.reflectionProbes.length; i++) { - var h = t.reflectionProbes[i]; - o.reflectionProbes.push(h.serialize()) - } - for (o.materials = [], - o.multiMaterials = [], - i = 0; i < t.materials.length; i++) - (r = t.materials[i]).doNotSerialize || o.materials.push(r.serialize()); - for (o.multiMaterials = [], - i = 0; i < t.multiMaterials.length; i++) { - var f = t.multiMaterials[i]; - o.multiMaterials.push(f.serialize()) + ) + for ( + o.reflectionProbes = [], i = 0; + i < t.reflectionProbes.length; + i++ + ) { + var h = t.reflectionProbes[i]; + o.reflectionProbes.push(h.serialize()); } - for (t.environmentTexture && (o.environmentTexture = t.environmentTexture.name), - o.skeletons = [], - i = 0; i < t.skeletons.length; i++) { - var d = t.skeletons[i]; - d.doNotSerialize || o.skeletons.push(d.serialize()) + for ( + o.materials = [], o.multiMaterials = [], i = 0; + i < t.materials.length; + i++ + ) + (r = t.materials[i]).doNotSerialize || + o.materials.push(r.serialize()); + for ( + o.multiMaterials = [], i = 0; + i < t.multiMaterials.length; + i++ + ) { + var f = t.multiMaterials[i]; + o.multiMaterials.push(f.serialize()); + } + for ( + t.environmentTexture && + (o.environmentTexture = t.environmentTexture.name), + o.skeletons = [], + i = 0; + i < t.skeletons.length; + i++ + ) { + var d = t.skeletons[i]; + d.doNotSerialize || o.skeletons.push(d.serialize()); + } + for ( + o.transformNodes = [], i = 0; + i < t.transformNodes.length; + i++ + ) + o.transformNodes.push(t.transformNodes[i].serialize()); + (o.geometries = {}), + (o.geometries.boxes = []), + (o.geometries.spheres = []), + (o.geometries.cylinders = []), + (o.geometries.toruses = []), + (o.geometries.grounds = []), + (o.geometries.planes = []), + (o.geometries.torusKnots = []), + (o.geometries.vertexData = []), + (Tc = []); + var p = t.getGeometries(); + for (i = 0; i < p.length; i++) { + var m = p[i]; + m.isReady() && Ac(m, o.geometries); + } + for (o.meshes = [], i = 0; i < t.meshes.length; i++) { + var g; + if ((g = t.meshes[i]) instanceof me.a) { + var v = g; + v.doNotSerialize || + (v.delayLoadState !== _.a.DELAYLOADSTATE_LOADED && + v.delayLoadState !== _.a.DELAYLOADSTATE_NONE) || + o.meshes.push(xc(v, o)); } - for (o.transformNodes = [], - i = 0; i < t.transformNodes.length; i++) - o.transformNodes.push(t.transformNodes[i].serialize()); - o.geometries = {}, - o.geometries.boxes = [], - o.geometries.spheres = [], - o.geometries.cylinders = [], - o.geometries.toruses = [], - o.geometries.grounds = [], - o.geometries.planes = [], - o.geometries.torusKnots = [], - o.geometries.vertexData = [], - Tc = []; - var p = t.getGeometries(); - for (i = 0; i < p.length; i++) { - var m = p[i]; - m.isReady() && Ac(m, o.geometries) - } - for (o.meshes = [], - i = 0; i < t.meshes.length; i++) { - var g; - if ((g = t.meshes[i])instanceof me.a) { - var v = g; - v.doNotSerialize || v.delayLoadState !== _.a.DELAYLOADSTATE_LOADED && v.delayLoadState !== _.a.DELAYLOADSTATE_NONE || o.meshes.push(xc(v, o)) - } - } - for (o.particleSystems = [], - i = 0; i < t.particleSystems.length; i++) - o.particleSystems.push(t.particleSystems[i].serialize()); - t.actionManager && (o.actions = t.actionManager.serialize("scene")); - for (var y = 0, b = t._serializableComponents; y < b.length; y++) - b[y].serialize(o); - return o - } - , - e.SerializeMesh = function(t, i, n) { - void 0 === i && (i = false), - void 0 === n && (n = false); - var r = {}; - if (e.ClearCache(), - t = t instanceof Array ? t : [t], + } + for ( + o.particleSystems = [], i = 0; + i < t.particleSystems.length; + i++ + ) + o.particleSystems.push( + t.particleSystems[i].serialize() + ); + t.actionManager && + (o.actions = t.actionManager.serialize("scene")); + for ( + var y = 0, b = t._serializableComponents; + y < b.length; + y++ + ) + b[y].serialize(o); + return o; + }), + (e.SerializeMesh = function (t, i, n) { + void 0 === i && (i = false), void 0 === n && (n = false); + var r = {}; + if ( + (e.ClearCache(), + (t = t instanceof Array ? t : [t]), i || n) - for (var o = 0; o < t.length; ++o) - n && t[o].getDescendants().forEach(function(e) { - e instanceof me.a && t.indexOf(e) < 0 && t.push(e) - }), - i && t[o].parent && t.indexOf(t[o].parent) < 0 && t.push(t[o].parent); - return t.forEach(function(e) { - !function(e, t) { - if (e.delayLoadState === _.a.DELAYLOADSTATE_LOADED || e.delayLoadState === _.a.DELAYLOADSTATE_NONE) { - if (e.material) - if (e.material instanceof Wr.a) { - if (t.multiMaterials = t.multiMaterials || [], - t.materials = t.materials || [], - !t.multiMaterials.some(function(t) { - return t.id === e.material.id - })) { - t.multiMaterials.push(e.material.serialize()); - for (var i = function(e) { - e && (t.materials.some(function(t) { - return t.id === e.id - }) || t.materials.push(e.serialize())) - }, n = 0, r = e.material.subMaterials; n < r.length; n++) - i(r[n]) - } - } else - t.materials = t.materials || [], - t.materials.some(function(t) { - return t.id === e.material.id - }) || t.materials.push(e.material.serialize()); - var o = e._geometry; - o && (t.geometries || (t.geometries = {}, - t.geometries.boxes = [], - t.geometries.spheres = [], - t.geometries.cylinders = [], - t.geometries.toruses = [], - t.geometries.grounds = [], - t.geometries.planes = [], - t.geometries.torusKnots = [], - t.geometries.vertexData = []), - Ac(o, t.geometries)), - e.skeleton && (t.skeletons = t.skeletons || [], - t.skeletons.push(e.skeleton.serialize())), - t.meshes = t.meshes || [], - t.meshes.push(xc(e, t)) - } - }(e, r) + ) + for (var o = 0; o < t.length; ++o) + n && + t[o].getDescendants().forEach(function (e) { + e instanceof me.a && + t.indexOf(e) < 0 && + t.push(e); + }), + i && + t[o].parent && + t.indexOf(t[o].parent) < 0 && + t.push(t[o].parent); + return ( + t.forEach(function (e) { + !(function (e, t) { + if ( + e.delayLoadState === _.a.DELAYLOADSTATE_LOADED || + e.delayLoadState === _.a.DELAYLOADSTATE_NONE + ) { + if (e.material) + if (e.material instanceof Wr.a) { + if ( + ((t.multiMaterials = + t.multiMaterials || []), + (t.materials = t.materials || []), + !t.multiMaterials.some(function (t) { + return t.id === e.material.id; + })) + ) { + t.multiMaterials.push( + e.material.serialize() + ); + for ( + var i = function (e) { + e && + (t.materials.some(function (t) { + return t.id === e.id; + }) || + t.materials.push(e.serialize())); + }, + n = 0, + r = e.material.subMaterials; + n < r.length; + n++ + ) + i(r[n]); + } + } else + (t.materials = t.materials || []), + t.materials.some(function (t) { + return t.id === e.material.id; + }) || + t.materials.push(e.material.serialize()); + var o = e._geometry; + o && + (t.geometries || + ((t.geometries = {}), + (t.geometries.boxes = []), + (t.geometries.spheres = []), + (t.geometries.cylinders = []), + (t.geometries.toruses = []), + (t.geometries.grounds = []), + (t.geometries.planes = []), + (t.geometries.torusKnots = []), + (t.geometries.vertexData = [])), + Ac(o, t.geometries)), + e.skeleton && + ((t.skeletons = t.skeletons || []), + t.skeletons.push(e.skeleton.serialize())), + (t.meshes = t.meshes || []), + t.meshes.push(xc(e, t)); + } + })(e, r); }), r - } - , + ); + }), e - }(), Cc = n(29), Pc = function() { - function e() {} - return e.CreateResizedCopy = function(e, t, i, n) { - void 0 === n && (n = true); - var r = e.getScene() - , o = r.getEngine() - , a = new li("resized" + e.name,{ + ); + })(), + Cc = n(29), + Pc = (function () { + function e() {} + return ( + (e.CreateResizedCopy = function (e, t, i, n) { + void 0 === n && (n = true); + var r = e.getScene(), + o = r.getEngine(), + a = new li( + "resized" + e.name, + { width: t, - height: i - },r,!e.noMipmap,true,e._texture.type,false,e.samplingMode,false); - a.wrapU = e.wrapU, - a.wrapV = e.wrapV, - a.uOffset = e.uOffset, - a.vOffset = e.vOffset, - a.uScale = e.uScale, - a.vScale = e.vScale, - a.uAng = e.uAng, - a.vAng = e.vAng, - a.wAng = e.wAng, - a.coordinatesIndex = e.coordinatesIndex, - a.level = e.level, - a.anisotropicFilteringLevel = e.anisotropicFilteringLevel, - a._texture.isReady = false, - e.wrapU = je.a.CLAMP_ADDRESSMODE, - e.wrapV = je.a.CLAMP_ADDRESSMODE; - var s = new Xt("pass",1,null,n ? je.a.BILINEAR_SAMPLINGMODE : je.a.NEAREST_SAMPLINGMODE,o,false,_.a.TEXTURETYPE_UNSIGNED_INT); - return s.getEffect().executeWhenCompiled(function() { - s.onApply = function(t) { - t.setTexture("textureSampler", e) - } - ; - var t = a.getInternalTexture(); - t && (r.postProcessManager.directRender([s], t), + height: i, + }, + r, + !e.noMipmap, + true, + e._texture.type, + false, + e.samplingMode, + false + ); + (a.wrapU = e.wrapU), + (a.wrapV = e.wrapV), + (a.uOffset = e.uOffset), + (a.vOffset = e.vOffset), + (a.uScale = e.uScale), + (a.vScale = e.vScale), + (a.uAng = e.uAng), + (a.vAng = e.vAng), + (a.wAng = e.wAng), + (a.coordinatesIndex = e.coordinatesIndex), + (a.level = e.level), + (a.anisotropicFilteringLevel = + e.anisotropicFilteringLevel), + (a._texture.isReady = false), + (e.wrapU = je.a.CLAMP_ADDRESSMODE), + (e.wrapV = je.a.CLAMP_ADDRESSMODE); + var s = new Xt( + "pass", + 1, + null, + n + ? je.a.BILINEAR_SAMPLINGMODE + : je.a.NEAREST_SAMPLINGMODE, + o, + false, + _.a.TEXTURETYPE_UNSIGNED_INT + ); + return ( + s.getEffect().executeWhenCompiled(function () { + s.onApply = function (t) { + t.setTexture("textureSampler", e); + }; + var t = a.getInternalTexture(); + t && + (r.postProcessManager.directRender([s], t), o.unBindFramebuffer(t), a.disposeFramebufferObjects(), s.dispose(), - t.isReady = true) + (t.isReady = true)); }), a - } - , - e - }(), Rc = function() { - function e(t, i) { - if (void 0 === i && (i = null), - !e.IsSupported(t)) - throw "Your browser does not support recording so far."; - var n = t.getRenderingCanvas(); - if (!n) - throw "The babylon engine must have a canvas to be recorded"; - this._canvas = n, - this._canvas.isRecording = false, - this._options = h.a({}, e._defaultOptions, i); - var r = this._canvas.captureStream(this._options.fps); - if (this._options.audioTracks) - for (var o = 0, a = this._options.audioTracks; o < a.length; o++) { - var s = a[o]; - r.addTrack(s) - } - this._mediaRecorder = new MediaRecorder(r,{ - mimeType: this._options.mimeType - }), - this._mediaRecorder.ondataavailable = this._handleDataAvailable.bind(this), - this._mediaRecorder.onerror = this._handleError.bind(this), - this._mediaRecorder.onstop = this._handleStop.bind(this) - } - return e.IsSupported = function(e) { - var t = e.getRenderingCanvas(); - return !!t && "function" == typeof t.captureStream - } - , - Object.defineProperty(e.prototype, "isRecording", { - get: function() { - return !!this._canvas && this._canvas.isRecording - }, - enumerable: true, - configurable: true + ); }), - e.prototype.stopRecording = function() { - this._canvas && this._mediaRecorder && this.isRecording && (this._canvas.isRecording = false, - this._mediaRecorder.stop()) - } - , - e.prototype.startRecording = function(e, t) { - var n = this; - if (void 0 === e && (e = "babylonjs.webm"), + e + ); + })(), + Rc = (function () { + function e(t, i) { + if ((void 0 === i && (i = null), !e.IsSupported(t))) + throw "Your browser does not support recording so far."; + var n = t.getRenderingCanvas(); + if (!n) + throw "The babylon engine must have a canvas to be recorded"; + (this._canvas = n), + (this._canvas.isRecording = false), + (this._options = h.a({}, e._defaultOptions, i)); + var r = this._canvas.captureStream(this._options.fps); + if (this._options.audioTracks) + for ( + var o = 0, a = this._options.audioTracks; + o < a.length; + o++ + ) { + var s = a[o]; + r.addTrack(s); + } + (this._mediaRecorder = new MediaRecorder(r, { + mimeType: this._options.mimeType, + })), + (this._mediaRecorder.ondataavailable = + this._handleDataAvailable.bind(this)), + (this._mediaRecorder.onerror = + this._handleError.bind(this)), + (this._mediaRecorder.onstop = + this._handleStop.bind(this)); + } + return ( + (e.IsSupported = function (e) { + var t = e.getRenderingCanvas(); + return !!t && "function" == typeof t.captureStream; + }), + Object.defineProperty(e.prototype, "isRecording", { + get: function () { + return !!this._canvas && this._canvas.isRecording; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.stopRecording = function () { + this._canvas && + this._mediaRecorder && + this.isRecording && + ((this._canvas.isRecording = false), + this._mediaRecorder.stop()); + }), + (e.prototype.startRecording = function (e, t) { + var n = this; + if ( + (void 0 === e && (e = "babylonjs.webm"), void 0 === t && (t = 7), !this._canvas || !this._mediaRecorder) - throw "Recorder has already been disposed"; - if (this.isRecording) - throw "Recording already in progress"; - return t > 0 && setTimeout(function() { - n.stopRecording() - }, 1e3 * t), - this._fileName = e, - this._recordedChunks = [], - this._resolve = null, - this._reject = null, - this._canvas.isRecording = true, - this._mediaRecorder.start(this._options.recordChunckSize), - new i(function(e, t) { - n._resolve = e, - n._reject = t - } - ) - } - , - e.prototype.dispose = function() { - this._canvas = null, - this._mediaRecorder = null, - this._recordedChunks = [], - this._fileName = null, - this._resolve = null, - this._reject = null - } - , - e.prototype._handleDataAvailable = function(e) { - e.data.size > 0 && this._recordedChunks.push(e.data) - } - , - e.prototype._handleError = function(e) { - if (this.stopRecording(), - !this._reject) - throw new e.error; - this._reject(e.error) - } - , - e.prototype._handleStop = function() { - this.stopRecording(); - var e = new Blob(this._recordedChunks); - this._resolve && this._resolve(e), + ) + throw "Recorder has already been disposed"; + if (this.isRecording) + throw "Recording already in progress"; + return ( + t > 0 && + setTimeout(function () { + n.stopRecording(); + }, 1e3 * t), + (this._fileName = e), + (this._recordedChunks = []), + (this._resolve = null), + (this._reject = null), + (this._canvas.isRecording = true), + this._mediaRecorder.start( + this._options.recordChunckSize + ), + new i(function (e, t) { + (n._resolve = e), (n._reject = t); + }) + ); + }), + (e.prototype.dispose = function () { + (this._canvas = null), + (this._mediaRecorder = null), + (this._recordedChunks = []), + (this._fileName = null), + (this._resolve = null), + (this._reject = null); + }), + (e.prototype._handleDataAvailable = function (e) { + e.data.size > 0 && this._recordedChunks.push(e.data); + }), + (e.prototype._handleError = function (e) { + if ((this.stopRecording(), !this._reject)) + throw new e.error(); + this._reject(e.error); + }), + (e.prototype._handleStop = function () { + this.stopRecording(); + var e = new Blob(this._recordedChunks); + this._resolve && this._resolve(e), window.URL.createObjectURL(e), - this._fileName && Ee.h.Download(e, this._fileName) - } - , - e._defaultOptions = { - mimeType: "video/webm", - fps: 25, - recordChunckSize: 3e3 - }, + this._fileName && Ee.h.Download(e, this._fileName); + }), + (e._defaultOptions = { + mimeType: "video/webm", + fps: 25, + recordChunckSize: 3e3, + }), e - }(), Mc = function() { - function e() {} - return e.CreateScreenshot = function(e, t, i, n, r) { - var o, a; - if (void 0 === r && (r = "image/png"), - i.precision) - o = Math.round(e.getRenderWidth() * i.precision), - a = Math.round(o / e.getAspectRatio(t)); - else if (i.width && i.height) - o = i.width, - a = i.height; - else if (i.width && !i.height) - o = i.width, - a = Math.round(o / e.getAspectRatio(t)); - else if (i.height && !i.width) - a = i.height, - o = Math.round(a * e.getAspectRatio(t)); - else { - if (isNaN(i)) - return void g.a.Error("Invalid 'size' parameter !"); - a = i, - o = i - } - Ee.h._ScreenshotCanvas || (Ee.h._ScreenshotCanvas = document.createElement("canvas")), - Ee.h._ScreenshotCanvas.width = o, - Ee.h._ScreenshotCanvas.height = a; - var s = Ee.h._ScreenshotCanvas.getContext("2d") - , c = e.getRenderWidth() / e.getRenderHeight() - , u = o - , l = u / c; - l > a && (u = (l = a) * c); - var h = Math.max(0, o - u) / 2 - , f = Math.max(0, a - l) / 2 - , d = e.getRenderingCanvas(); - s && d && s.drawImage(d, h, f, u, l), - Ee.h.EncodeScreenshotCanvasData(n, r) - } - , - e.CreateScreenshotUsingRenderTarget = function(e, t, i, n, r, o, a, s) { - var c, u; - if (void 0 === r && (r = "image/png"), + ); + })(), + Mc = (function () { + function e() {} + return ( + (e.CreateScreenshot = function (e, t, i, n, r) { + var o, a; + if ((void 0 === r && (r = "image/png"), i.precision)) + (o = Math.round(e.getRenderWidth() * i.precision)), + (a = Math.round(o / e.getAspectRatio(t))); + else if (i.width && i.height) + (o = i.width), (a = i.height); + else if (i.width && !i.height) + (o = i.width), + (a = Math.round(o / e.getAspectRatio(t))); + else if (i.height && !i.width) + (a = i.height), + (o = Math.round(a * e.getAspectRatio(t))); + else { + if (isNaN(i)) + return void g.a.Error("Invalid 'size' parameter !"); + (a = i), (o = i); + } + Ee.h._ScreenshotCanvas || + (Ee.h._ScreenshotCanvas = + document.createElement("canvas")), + (Ee.h._ScreenshotCanvas.width = o), + (Ee.h._ScreenshotCanvas.height = a); + var s = Ee.h._ScreenshotCanvas.getContext("2d"), + c = e.getRenderWidth() / e.getRenderHeight(), + u = o, + l = u / c; + l > a && (u = (l = a) * c); + var h = Math.max(0, o - u) / 2, + f = Math.max(0, a - l) / 2, + d = e.getRenderingCanvas(); + s && d && s.drawImage(d, h, f, u, l), + Ee.h.EncodeScreenshotCanvasData(n, r); + }), + (e.CreateScreenshotUsingRenderTarget = function ( + e, + t, + i, + n, + r, + o, + a, + s + ) { + var c, u; + if ( + (void 0 === r && (r = "image/png"), void 0 === o && (o = 1), void 0 === a && (a = false), i.precision) - c = Math.round(e.getRenderWidth() * i.precision), - u = Math.round(c / e.getAspectRatio(t)), - i = { - width: c, - height: u - }; - else if (i.width && i.height) - c = i.width, - u = i.height; - else if (i.width && !i.height) - c = i.width, - u = Math.round(c / e.getAspectRatio(t)), - i = { - width: c, - height: u - }; - else if (i.height && !i.width) - u = i.height, - i = { - width: c = Math.round(u * e.getAspectRatio(t)), - height: u - }; - else { - if (isNaN(i)) - return void g.a.Error("Invalid 'size' parameter !"); - u = i, - c = i - } - var l = t.getScene() - , h = null; - l.activeCamera !== t && (h = l.activeCamera, - l.activeCamera = t); - var f = e.getRenderingCanvas(); - if (f) { - var d = { - width: f.width, - height: f.height - }; - e.setSize(c, u), - l.render(); - var p = new li("screenShot",i,l,false,false,_.a.TEXTURETYPE_UNSIGNED_INT,false,je.a.NEAREST_SAMPLINGMODE); - p.renderList = null, - p.samples = o, - a && p.addPostProcess(new ps("antialiasing",1,l.activeCamera)), - p.onAfterRenderObservable.add(function() { - Ee.h.DumpFramebuffer(c, u, e, n, r, s) - }), - l.incrementRenderId(), - l.resetCachedMaterial(), - p.render(true), - p.dispose(), - h && (l.activeCamera = h), - e.setSize(d.width, d.height), - t.getProjectionMatrix(true) - } else - g.a.Error("No rendering canvas found !") - } - , + ) + (c = Math.round(e.getRenderWidth() * i.precision)), + (u = Math.round(c / e.getAspectRatio(t))), + (i = { + width: c, + height: u, + }); + else if (i.width && i.height) + (c = i.width), (u = i.height); + else if (i.width && !i.height) + (c = i.width), + (u = Math.round(c / e.getAspectRatio(t))), + (i = { + width: c, + height: u, + }); + else if (i.height && !i.width) + (u = i.height), + (i = { + width: (c = Math.round(u * e.getAspectRatio(t))), + height: u, + }); + else { + if (isNaN(i)) + return void g.a.Error("Invalid 'size' parameter !"); + (u = i), (c = i); + } + var l = t.getScene(), + h = null; + l.activeCamera !== t && + ((h = l.activeCamera), (l.activeCamera = t)); + var f = e.getRenderingCanvas(); + if (f) { + var d = { + width: f.width, + height: f.height, + }; + e.setSize(c, u), l.render(); + var p = new li( + "screenShot", + i, + l, + false, + false, + _.a.TEXTURETYPE_UNSIGNED_INT, + false, + je.a.NEAREST_SAMPLINGMODE + ); + (p.renderList = null), + (p.samples = o), + a && + p.addPostProcess( + new ps("antialiasing", 1, l.activeCamera) + ), + p.onAfterRenderObservable.add(function () { + Ee.h.DumpFramebuffer(c, u, e, n, r, s); + }), + l.incrementRenderId(), + l.resetCachedMaterial(), + p.render(true), + p.dispose(), + h && (l.activeCamera = h), + e.setSize(d.width, d.height), + t.getProjectionMatrix(true); + } else g.a.Error("No rendering canvas found !"); + }), e - }(); - Ee.h.CreateScreenshot = Mc.CreateScreenshot, - Ee.h.CreateScreenshotUsingRenderTarget = Mc.CreateScreenshotUsingRenderTarget, - function(e) { - e[e.Checkbox = 0] = "Checkbox", - e[e.Slider = 1] = "Slider", - e[e.Vector3 = 2] = "Vector3", - e[e.Quaternion = 3] = "Quaternion", - e[e.Color3 = 4] = "Color3" - }(Ys || (Ys = {})), - n.d(t, "AbstractScene", function() { - return r.a + ); + })(); + (Ee.h.CreateScreenshot = Mc.CreateScreenshot), + (Ee.h.CreateScreenshotUsingRenderTarget = + Mc.CreateScreenshotUsingRenderTarget), + (function (e) { + (e[(e.Checkbox = 0)] = "Checkbox"), + (e[(e.Slider = 1)] = "Slider"), + (e[(e.Vector3 = 2)] = "Vector3"), + (e[(e.Quaternion = 3)] = "Quaternion"), + (e[(e.Color3 = 4)] = "Color3"); + })(Ys || (Ys = {})), + n.d(t, "AbstractScene", function () { + return r.a; }), - n.d(t, "Action", function() { - return u + n.d(t, "Action", function () { + return u; }), - n.d(t, "ActionEvent", function() { - return l.a + n.d(t, "ActionEvent", function () { + return l.a; }), - n.d(t, "ActionManager", function() { - return O + n.d(t, "ActionManager", function () { + return O; }), - n.d(t, "Condition", function() { - return f + n.d(t, "Condition", function () { + return f; }), - n.d(t, "ValueCondition", function() { - return d + n.d(t, "ValueCondition", function () { + return d; }), - n.d(t, "PredicateCondition", function() { - return p + n.d(t, "PredicateCondition", function () { + return p; }), - n.d(t, "StateCondition", function() { - return m + n.d(t, "StateCondition", function () { + return m; }), - n.d(t, "SwitchBooleanAction", function() { - return v + n.d(t, "SwitchBooleanAction", function () { + return v; }), - n.d(t, "SetStateAction", function() { - return y + n.d(t, "SetStateAction", function () { + return y; }), - n.d(t, "SetValueAction", function() { - return b + n.d(t, "SetValueAction", function () { + return b; }), - n.d(t, "IncrementValueAction", function() { - return E + n.d(t, "IncrementValueAction", function () { + return E; }), - n.d(t, "PlayAnimationAction", function() { - return T + n.d(t, "PlayAnimationAction", function () { + return T; }), - n.d(t, "StopAnimationAction", function() { - return A + n.d(t, "StopAnimationAction", function () { + return A; }), - n.d(t, "DoNothingAction", function() { - return x + n.d(t, "DoNothingAction", function () { + return x; }), - n.d(t, "CombineAction", function() { - return S + n.d(t, "CombineAction", function () { + return S; }), - n.d(t, "ExecuteCodeAction", function() { - return C + n.d(t, "ExecuteCodeAction", function () { + return C; }), - n.d(t, "SetParentAction", function() { - return P + n.d(t, "SetParentAction", function () { + return P; }), - n.d(t, "PlaySoundAction", function() { - return w + n.d(t, "PlaySoundAction", function () { + return w; }), - n.d(t, "StopSoundAction", function() { - return I + n.d(t, "StopSoundAction", function () { + return I; }), - n.d(t, "InterpolateValueAction", function() { - return V + n.d(t, "InterpolateValueAction", function () { + return V; }), - n.d(t, "Animatable", function() { - return Z + n.d(t, "Animatable", function () { + return Z; }), - n.d(t, "_IAnimationState", function() { - return k + n.d(t, "_IAnimationState", function () { + return k; }), - n.d(t, "Animation", function() { - return U + n.d(t, "Animation", function () { + return U; }), - n.d(t, "TargetedAnimation", function() { - return J + n.d(t, "TargetedAnimation", function () { + return J; }), - n.d(t, "AnimationGroup", function() { - return $ + n.d(t, "AnimationGroup", function () { + return $; }), - n.d(t, "AnimationPropertiesOverride", function() { - return ee + n.d(t, "AnimationPropertiesOverride", function () { + return ee; }), - n.d(t, "EasingFunction", function() { - return te + n.d(t, "EasingFunction", function () { + return te; }), - n.d(t, "CircleEase", function() { - return ie + n.d(t, "CircleEase", function () { + return ie; }), - n.d(t, "BackEase", function() { - return ne + n.d(t, "BackEase", function () { + return ne; }), - n.d(t, "BounceEase", function() { - return re + n.d(t, "BounceEase", function () { + return re; }), - n.d(t, "CubicEase", function() { - return oe + n.d(t, "CubicEase", function () { + return oe; }), - n.d(t, "ElasticEase", function() { - return ae + n.d(t, "ElasticEase", function () { + return ae; }), - n.d(t, "ExponentialEase", function() { - return se + n.d(t, "ExponentialEase", function () { + return se; }), - n.d(t, "PowerEase", function() { - return ce + n.d(t, "PowerEase", function () { + return ce; }), - n.d(t, "QuadraticEase", function() { - return ue + n.d(t, "QuadraticEase", function () { + return ue; }), - n.d(t, "QuarticEase", function() { - return le + n.d(t, "QuarticEase", function () { + return le; }), - n.d(t, "QuinticEase", function() { - return he + n.d(t, "QuinticEase", function () { + return he; }), - n.d(t, "SineEase", function() { - return fe + n.d(t, "SineEase", function () { + return fe; }), - n.d(t, "BezierCurveEase", function() { - return de + n.d(t, "BezierCurveEase", function () { + return de; }), - n.d(t, "RuntimeAnimation", function() { - return X + n.d(t, "RuntimeAnimation", function () { + return X; }), - n.d(t, "AnimationEvent", function() { - return pe + n.d(t, "AnimationEvent", function () { + return pe; }), - n.d(t, "AnimationKeyInterpolation", function() { - return D + n.d(t, "AnimationKeyInterpolation", function () { + return D; }), - n.d(t, "AnimationRange", function() { - return B + n.d(t, "AnimationRange", function () { + return B; }), - n.d(t, "KeepAssets", function() { - return ge + n.d(t, "KeepAssets", function () { + return ge; }), - n.d(t, "AssetContainer", function() { - return _e + n.d(t, "AssetContainer", function () { + return _e; }), - n.d(t, "Analyser", function() { - return ye + n.d(t, "Analyser", function () { + return ye; }), - n.d(t, "AudioEngine", function() { - return be + n.d(t, "AudioEngine", function () { + return be; }), - n.d(t, "AudioSceneComponent", function() { - return Ce + n.d(t, "AudioSceneComponent", function () { + return Ce; }), - n.d(t, "Sound", function() { - return Ae + n.d(t, "Sound", function () { + return Ae; }), - n.d(t, "SoundTrack", function() { - return xe + n.d(t, "SoundTrack", function () { + return xe; }), - n.d(t, "WeightedSound", function() { - return Pe + n.d(t, "WeightedSound", function () { + return Pe; }), - n.d(t, "AutoRotationBehavior", function() { - return Me + n.d(t, "AutoRotationBehavior", function () { + return Me; }), - n.d(t, "BouncingBehavior", function() { - return Oe + n.d(t, "BouncingBehavior", function () { + return Oe; }), - n.d(t, "FramingBehavior", function() { - return we + n.d(t, "FramingBehavior", function () { + return we; }), - n.d(t, "AttachToBoxBehavior", function() { - return De + n.d(t, "AttachToBoxBehavior", function () { + return De; }), - n.d(t, "FadeInOutBehavior", function() { - return Le + n.d(t, "FadeInOutBehavior", function () { + return Le; }), - n.d(t, "MultiPointerScaleBehavior", function() { - return Be + n.d(t, "MultiPointerScaleBehavior", function () { + return Be; }), - n.d(t, "PointerDragBehavior", function() { - return Fe.a + n.d(t, "PointerDragBehavior", function () { + return Fe.a; }), - n.d(t, "SixDofDragBehavior", function() { - return Ve + n.d(t, "SixDofDragBehavior", function () { + return Ve; }), - n.d(t, "Bone", function() { - return q + n.d(t, "Bone", function () { + return q; }), - n.d(t, "BoneIKController", function() { - return Ge + n.d(t, "BoneIKController", function () { + return Ge; }), - n.d(t, "BoneLookController", function() { - return ze + n.d(t, "BoneLookController", function () { + return ze; }), - n.d(t, "Skeleton", function() { - return Xe + n.d(t, "Skeleton", function () { + return Xe; }), - n.d(t, "CameraInputTypes", function() { - return Ye + n.d(t, "CameraInputTypes", function () { + return Ye; }), - n.d(t, "CameraInputsManager", function() { - return Ke + n.d(t, "CameraInputsManager", function () { + return Ke; }), - n.d(t, "Camera", function() { - return ke.a + n.d(t, "Camera", function () { + return ke.a; }), - n.d(t, "TargetCamera", function() { - return Et + n.d(t, "TargetCamera", function () { + return Et; }), - n.d(t, "FreeCamera", function() { - return Tt + n.d(t, "FreeCamera", function () { + return Tt; }), - n.d(t, "FreeCameraInputsManager", function() { - return pt + n.d(t, "FreeCameraInputsManager", function () { + return pt; }), - n.d(t, "TouchCamera", function() { - return At + n.d(t, "TouchCamera", function () { + return At; }), - n.d(t, "ArcRotateCamera", function() { - return xt + n.d(t, "ArcRotateCamera", function () { + return xt; }), - n.d(t, "ArcRotateCameraInputsManager", function() { - return rt + n.d(t, "ArcRotateCameraInputsManager", function () { + return rt; }), - n.d(t, "DeviceOrientationCamera", function() { - return St + n.d(t, "DeviceOrientationCamera", function () { + return St; }), - n.d(t, "FlyCamera", function() { - return Pt + n.d(t, "FlyCamera", function () { + return Pt; }), - n.d(t, "FlyCameraInputsManager", function() { - return Ct + n.d(t, "FlyCameraInputsManager", function () { + return Ct; }), - n.d(t, "FollowCamera", function() { - return Ot + n.d(t, "FollowCamera", function () { + return Ot; }), - n.d(t, "ArcFollowCamera", function() { - return wt + n.d(t, "ArcFollowCamera", function () { + return wt; }), - n.d(t, "GamepadCamera", function() { - return zt + n.d(t, "GamepadCamera", function () { + return zt; }), - n.d(t, "UniversalCamera", function() { - return Gt + n.d(t, "UniversalCamera", function () { + return Gt; }), - n.d(t, "VirtualJoysticksCamera", function() { - return ri + n.d(t, "VirtualJoysticksCamera", function () { + return ri; }), - n.d(t, "ArcRotateCameraGamepadInput", function() { - return Je + n.d(t, "ArcRotateCameraGamepadInput", function () { + return Je; }), - n.d(t, "ArcRotateCameraKeyboardMoveInput", function() { - return et + n.d(t, "ArcRotateCameraKeyboardMoveInput", function () { + return et; }), - n.d(t, "ArcRotateCameraMouseWheelInput", function() { - return tt + n.d(t, "ArcRotateCameraMouseWheelInput", function () { + return tt; }), - n.d(t, "ArcRotateCameraPointersInput", function() { - return nt + n.d(t, "ArcRotateCameraPointersInput", function () { + return nt; }), - n.d(t, "ArcRotateCameraVRDeviceOrientationInput", function() { - return ot + n.d(t, "ArcRotateCameraVRDeviceOrientationInput", function () { + return ot; }), - n.d(t, "FlyCameraKeyboardInput", function() { - return at + n.d(t, "FlyCameraKeyboardInput", function () { + return at; }), - n.d(t, "FlyCameraMouseInput", function() { - return st + n.d(t, "FlyCameraMouseInput", function () { + return st; }), - n.d(t, "FollowCameraKeyboardMoveInput", function() { - return ct + n.d(t, "FollowCameraKeyboardMoveInput", function () { + return ct; }), - n.d(t, "FollowCameraMouseWheelInput", function() { - return ut + n.d(t, "FollowCameraMouseWheelInput", function () { + return ut; }), - n.d(t, "FollowCameraPointersInput", function() { - return lt + n.d(t, "FollowCameraPointersInput", function () { + return lt; }), - n.d(t, "FreeCameraDeviceOrientationInput", function() { - return mt + n.d(t, "FreeCameraDeviceOrientationInput", function () { + return mt; }), - n.d(t, "FreeCameraGamepadInput", function() { - return gt + n.d(t, "FreeCameraGamepadInput", function () { + return gt; }), - n.d(t, "FreeCameraKeyboardMoveInput", function() { - return ht + n.d(t, "FreeCameraKeyboardMoveInput", function () { + return ht; }), - n.d(t, "FreeCameraMouseInput", function() { - return ft + n.d(t, "FreeCameraMouseInput", function () { + return ft; }), - n.d(t, "FreeCameraTouchInput", function() { - return dt + n.d(t, "FreeCameraTouchInput", function () { + return dt; }), - n.d(t, "FreeCameraVirtualJoystickInput", function() { - return bt + n.d(t, "FreeCameraVirtualJoystickInput", function () { + return bt; }), - n.d(t, "AnaglyphArcRotateCamera", function() { - return Qt + n.d(t, "AnaglyphArcRotateCamera", function () { + return Qt; }), - n.d(t, "AnaglyphFreeCamera", function() { - return qt + n.d(t, "AnaglyphFreeCamera", function () { + return qt; }), - n.d(t, "AnaglyphGamepadCamera", function() { - return Zt + n.d(t, "AnaglyphGamepadCamera", function () { + return Zt; }), - n.d(t, "AnaglyphUniversalCamera", function() { - return Jt + n.d(t, "AnaglyphUniversalCamera", function () { + return Jt; }), - n.d(t, "StereoscopicArcRotateCamera", function() { - return ei + n.d(t, "StereoscopicArcRotateCamera", function () { + return ei; }), - n.d(t, "StereoscopicFreeCamera", function() { - return ti + n.d(t, "StereoscopicFreeCamera", function () { + return ti; }), - n.d(t, "StereoscopicGamepadCamera", function() { - return ii + n.d(t, "StereoscopicGamepadCamera", function () { + return ii; }), - n.d(t, "StereoscopicUniversalCamera", function() { - return ni + n.d(t, "StereoscopicUniversalCamera", function () { + return ni; }), - n.d(t, "VRCameraMetrics", function() { - return oi + n.d(t, "VRCameraMetrics", function () { + return oi; }), - n.d(t, "VRDeviceOrientationArcRotateCamera", function() { - return di + n.d(t, "VRDeviceOrientationArcRotateCamera", function () { + return di; }), - n.d(t, "VRDeviceOrientationFreeCamera", function() { - return pi + n.d(t, "VRDeviceOrientationFreeCamera", function () { + return pi; }), - n.d(t, "VRDeviceOrientationGamepadCamera", function() { - return mi + n.d(t, "VRDeviceOrientationGamepadCamera", function () { + return mi; }), - n.d(t, "OnAfterEnteringVRObservableEvent", function() { - return Li + n.d(t, "OnAfterEnteringVRObservableEvent", function () { + return Li; }), - n.d(t, "VRExperienceHelper", function() { - return Fi + n.d(t, "VRExperienceHelper", function () { + return Fi; }), - n.d(t, "WebVRFreeCamera", function() { - return _i + n.d(t, "WebVRFreeCamera", function () { + return _i; }), - n.d(t, "WebXRCamera", function() { - return Bi + n.d(t, "WebXRCamera", function () { + return Bi; }), - n.d(t, "WebXREnterExitUIButton", function() { - return Vi + n.d(t, "WebXREnterExitUIButton", function () { + return Vi; }), - n.d(t, "WebXREnterExitUIOptions", function() { - return Gi + n.d(t, "WebXREnterExitUIOptions", function () { + return Gi; }), - n.d(t, "WebXREnterExitUI", function() { - return zi + n.d(t, "WebXREnterExitUI", function () { + return zi; }), - n.d(t, "WebXRState", function() { - return Ri + n.d(t, "WebXRState", function () { + return Ri; }), - n.d(t, "WebXRExperienceHelper", function() { - return Ui + n.d(t, "WebXRExperienceHelper", function () { + return Ui; }), - n.d(t, "WebXRController", function() { - return ji + n.d(t, "WebXRController", function () { + return ji; }), - n.d(t, "WebXRInput", function() { - return Hi + n.d(t, "WebXRInput", function () { + return Hi; }), - n.d(t, "WebXRManagedOutputCanvas", function() { - return Wi + n.d(t, "WebXRManagedOutputCanvas", function () { + return Wi; }), - n.d(t, "WebXRSessionManager", function() { - return Ni + n.d(t, "WebXRSessionManager", function () { + return Ni; }), - n.d(t, "Collider", function() { - return Yi + n.d(t, "Collider", function () { + return Yi; }), - n.d(t, "DefaultCollisionCoordinator", function() { - return Ki + n.d(t, "DefaultCollisionCoordinator", function () { + return Ki; }), - n.d(t, "PickingInfo", function() { - return Qi.a + n.d(t, "PickingInfo", function () { + return Qi.a; }), - n.d(t, "IntersectionInfo", function() { - return qi.a + n.d(t, "IntersectionInfo", function () { + return qi.a; }), - n.d(t, "_MeshCollisionData", function() { - return Zi.a + n.d(t, "_MeshCollisionData", function () { + return Zi.a; }), - n.d(t, "BoundingBox", function() { - return Ji.a + n.d(t, "BoundingBox", function () { + return Ji.a; }), - n.d(t, "BoundingInfo", function() { - return $i.a + n.d(t, "BoundingInfo", function () { + return $i.a; }), - n.d(t, "BoundingSphere", function() { - return en.a + n.d(t, "BoundingSphere", function () { + return en.a; }), - n.d(t, "Ray", function() { - return Dt.a + n.d(t, "Ray", function () { + return Dt.a; }), - n.d(t, "Octree", function() { - return nn + n.d(t, "Octree", function () { + return nn; }), - n.d(t, "OctreeBlock", function() { - return tn + n.d(t, "OctreeBlock", function () { + return tn; }), - n.d(t, "OctreeSceneComponent", function() { - return rn + n.d(t, "OctreeSceneComponent", function () { + return rn; }), - n.d(t, "AxesViewer", function() { - return on.AxesViewer + n.d(t, "AxesViewer", function () { + return on.AxesViewer; }), - n.d(t, "BoneAxesViewer", function() { - return on.BoneAxesViewer + n.d(t, "BoneAxesViewer", function () { + return on.BoneAxesViewer; }), - n.d(t, "DebugLayer", function() { - return on.DebugLayer + n.d(t, "DebugLayer", function () { + return on.DebugLayer; }), - n.d(t, "PhysicsViewer", function() { - return on.PhysicsViewer + n.d(t, "PhysicsViewer", function () { + return on.PhysicsViewer; }), - n.d(t, "RayHelper", function() { - return on.RayHelper + n.d(t, "RayHelper", function () { + return on.RayHelper; }), - n.d(t, "SkeletonViewer", function() { - return on.SkeletonViewer + n.d(t, "SkeletonViewer", function () { + return on.SkeletonViewer; }), - n.d(t, "Constants", function() { - return _.a + n.d(t, "Constants", function () { + return _.a; }), - n.d(t, "InstancingAttributeInfo", function() { - return ve.d + n.d(t, "InstancingAttributeInfo", function () { + return ve.d; }), - n.d(t, "DepthTextureCreationOptions", function() { - return ve.a + n.d(t, "DepthTextureCreationOptions", function () { + return ve.a; }), - n.d(t, "EngineCapabilities", function() { - return ve.c + n.d(t, "EngineCapabilities", function () { + return ve.c; }), - n.d(t, "Engine", function() { - return ve.b + n.d(t, "Engine", function () { + return ve.b; }), - n.d(t, "EngineStore", function() { - return R.a + n.d(t, "EngineStore", function () { + return R.a; }), - n.d(t, "NullEngineOptions", function() { - return an.b + n.d(t, "NullEngineOptions", function () { + return an.b; }), - n.d(t, "NullEngine", function() { - return an.a + n.d(t, "NullEngine", function () { + return an.a; }), - n.d(t, "WebGLPipelineContext", function() { - return un.a + n.d(t, "WebGLPipelineContext", function () { + return un.a; }), - n.d(t, "_OcclusionDataStorage", function() { - return cn + n.d(t, "_OcclusionDataStorage", function () { + return cn; }), - n.d(t, "_forceTransformFeedbackToBundle", function() { - return true + n.d(t, "_forceTransformFeedbackToBundle", function () { + return true; }), - n.d(t, "KeyboardEventTypes", function() { - return $e.a + n.d(t, "KeyboardEventTypes", function () { + return $e.a; }), - n.d(t, "KeyboardInfo", function() { - return $e.b + n.d(t, "KeyboardInfo", function () { + return $e.b; }), - n.d(t, "KeyboardInfoPre", function() { - return $e.c + n.d(t, "KeyboardInfoPre", function () { + return $e.c; }), - n.d(t, "PointerEventTypes", function() { - return Re.a + n.d(t, "PointerEventTypes", function () { + return Re.a; }), - n.d(t, "PointerInfoBase", function() { - return Re.c + n.d(t, "PointerInfoBase", function () { + return Re.c; }), - n.d(t, "PointerInfoPre", function() { - return Re.d + n.d(t, "PointerInfoPre", function () { + return Re.d; }), - n.d(t, "PointerInfo", function() { - return Re.b + n.d(t, "PointerInfo", function () { + return Re.b; }), - n.d(t, "ClipboardEventTypes", function() { - return ln + n.d(t, "ClipboardEventTypes", function () { + return ln; }), - n.d(t, "ClipboardInfo", function() { - return hn + n.d(t, "ClipboardInfo", function () { + return hn; }), - n.d(t, "DaydreamController", function() { - return gn + n.d(t, "DaydreamController", function () { + return gn; }), - n.d(t, "GearVRController", function() { - return _n + n.d(t, "GearVRController", function () { + return _n; }), - n.d(t, "GenericController", function() { - return vn + n.d(t, "GenericController", function () { + return vn; }), - n.d(t, "OculusTouchController", function() { - return yn + n.d(t, "OculusTouchController", function () { + return yn; }), - n.d(t, "PoseEnabledControllerType", function() { - return Mt + n.d(t, "PoseEnabledControllerType", function () { + return Mt; }), - n.d(t, "PoseEnabledControllerHelper", function() { - return Bt + n.d(t, "PoseEnabledControllerHelper", function () { + return Bt; }), - n.d(t, "PoseEnabledController", function() { - return Nt + n.d(t, "PoseEnabledController", function () { + return Nt; }), - n.d(t, "ViveController", function() { - return bn + n.d(t, "ViveController", function () { + return bn; }), - n.d(t, "WebVRController", function() { - return vi + n.d(t, "WebVRController", function () { + return vi; }), - n.d(t, "WindowsMotionController", function() { - return Tn + n.d(t, "WindowsMotionController", function () { + return Tn; }), - n.d(t, "StickValues", function() { - return Qe + n.d(t, "StickValues", function () { + return Qe; }), - n.d(t, "Gamepad", function() { - return qe + n.d(t, "Gamepad", function () { + return qe; }), - n.d(t, "GenericPad", function() { - return Ze + n.d(t, "GenericPad", function () { + return Ze; }), - n.d(t, "GamepadManager", function() { - return Ut + n.d(t, "GamepadManager", function () { + return Ut; }), - n.d(t, "GamepadSystemSceneComponent", function() { - return Vt + n.d(t, "GamepadSystemSceneComponent", function () { + return Vt; }), - n.d(t, "Xbox360Button", function() { - return Lt + n.d(t, "Xbox360Button", function () { + return Lt; }), - n.d(t, "Xbox360Dpad", function() { - return Ft + n.d(t, "Xbox360Dpad", function () { + return Ft; }), - n.d(t, "Xbox360Pad", function() { - return kt + n.d(t, "Xbox360Pad", function () { + return kt; }), - n.d(t, "AxisDragGizmo", function() { - return An.a + n.d(t, "AxisDragGizmo", function () { + return An.a; }), - n.d(t, "AxisScaleGizmo", function() { - return Pn + n.d(t, "AxisScaleGizmo", function () { + return Pn; }), - n.d(t, "BoundingBoxGizmo", function() { - return On + n.d(t, "BoundingBoxGizmo", function () { + return On; }), - n.d(t, "Gizmo", function() { - return Sn.a + n.d(t, "Gizmo", function () { + return Sn.a; }), - n.d(t, "GizmoManager", function() { - return Bn + n.d(t, "GizmoManager", function () { + return Bn; }), - n.d(t, "PlaneRotationGizmo", function() { - return wn + n.d(t, "PlaneRotationGizmo", function () { + return wn; }), - n.d(t, "PositionGizmo", function() { - return Dn + n.d(t, "PositionGizmo", function () { + return Dn; }), - n.d(t, "RotationGizmo", function() { - return In + n.d(t, "RotationGizmo", function () { + return In; }), - n.d(t, "ScaleGizmo", function() { - return Fn + n.d(t, "ScaleGizmo", function () { + return Fn; }), - n.d(t, "LightGizmo", function() { - return zn + n.d(t, "LightGizmo", function () { + return zn; }), - n.d(t, "EnvironmentHelper", function() { - return er + n.d(t, "EnvironmentHelper", function () { + return er; }), - n.d(t, "PhotoDome", function() { - return ir + n.d(t, "PhotoDome", function () { + return ir; }), - n.d(t, "_forceSceneHelpersToBundle", function() { - return true + n.d(t, "_forceSceneHelpersToBundle", function () { + return true; }), - n.d(t, "VideoDome", function() { - return Cr + n.d(t, "VideoDome", function () { + return Cr; }), - n.d(t, "EngineInstrumentation", function() { - return Pr + n.d(t, "EngineInstrumentation", function () { + return Pr; }), - n.d(t, "SceneInstrumentation", function() { - return Rr + n.d(t, "SceneInstrumentation", function () { + return Rr; }), - n.d(t, "_TimeToken", function() { - return sn + n.d(t, "_TimeToken", function () { + return sn; }), - n.d(t, "EffectLayer", function() { - return Or + n.d(t, "EffectLayer", function () { + return Or; }), - n.d(t, "EffectLayerSceneComponent", function() { - return wr + n.d(t, "EffectLayerSceneComponent", function () { + return wr; }), - n.d(t, "GlowLayer", function() { - return Ir + n.d(t, "GlowLayer", function () { + return Ir; }), - n.d(t, "HighlightLayer", function() { - return Lr + n.d(t, "HighlightLayer", function () { + return Lr; }), - n.d(t, "Layer", function() { - return Br + n.d(t, "Layer", function () { + return Br; }), - n.d(t, "LayerSceneComponent", function() { - return Fr + n.d(t, "LayerSceneComponent", function () { + return Fr; }), - n.d(t, "LensFlare", function() { - return Nr + n.d(t, "LensFlare", function () { + return Nr; }), - n.d(t, "LensFlareSystem", function() { - return kr + n.d(t, "LensFlareSystem", function () { + return kr; }), - n.d(t, "LensFlareSystemSceneComponent", function() { - return Ur + n.d(t, "LensFlareSystemSceneComponent", function () { + return Ur; }), - n.d(t, "Light", function() { - return Nn.a + n.d(t, "Light", function () { + return Nn.a; }), - n.d(t, "ShadowLight", function() { - return kn + n.d(t, "ShadowLight", function () { + return kn; }), - n.d(t, "DirectionalLight", function() { - return Un + n.d(t, "DirectionalLight", function () { + return Un; }), - n.d(t, "HemisphericLight", function() { - return gi.a + n.d(t, "HemisphericLight", function () { + return gi.a; }), - n.d(t, "PointLight", function() { - return zr + n.d(t, "PointLight", function () { + return zr; }), - n.d(t, "SpotLight", function() { - return Gn + n.d(t, "SpotLight", function () { + return Gn; }), - n.d(t, "ShadowGenerator", function() { - return Vr + n.d(t, "ShadowGenerator", function () { + return Vr; }), - n.d(t, "ShadowGeneratorSceneComponent", function() { - return Gr + n.d(t, "ShadowGeneratorSceneComponent", function () { + return Gr; }), - n.d(t, "DefaultLoadingScreen", function() { - return jr + n.d(t, "DefaultLoadingScreen", function () { + return jr; }), - n.d(t, "SceneLoaderProgressEvent", function() { - return pn + n.d(t, "SceneLoaderProgressEvent", function () { + return pn; }), - n.d(t, "SceneLoader", function() { - return mn + n.d(t, "SceneLoader", function () { + return mn; }), - n.d(t, "SceneLoaderFlags", function() { - return dn.a + n.d(t, "SceneLoaderFlags", function () { + return dn.a; }), - n.d(t, "_BabylonLoaderRegistered", function() { - return true + n.d(t, "_BabylonLoaderRegistered", function () { + return true; }), - n.d(t, "ColorCurves", function() { - return fo.a + n.d(t, "ColorCurves", function () { + return fo.a; }), - n.d(t, "EffectFallbacks", function() { - return Ht.c + n.d(t, "EffectFallbacks", function () { + return Ht.c; }), - n.d(t, "EffectCreationOptions", function() { - return Ht.b + n.d(t, "EffectCreationOptions", function () { + return Ht.b; }), - n.d(t, "Effect", function() { - return Ht.a + n.d(t, "Effect", function () { + return Ht.a; }), - n.d(t, "FresnelParameters", function() { - return po + n.d(t, "FresnelParameters", function () { + return po; }), - n.d(t, "ImageProcessingConfigurationDefines", function() { - return yi.b + n.d(t, "ImageProcessingConfigurationDefines", function () { + return yi.b; }), - n.d(t, "ImageProcessingConfiguration", function() { - return yi.a + n.d(t, "ImageProcessingConfiguration", function () { + return yi.a; }), - n.d(t, "Material", function() { - return Mr.a + n.d(t, "Material", function () { + return Mr.a; }), - n.d(t, "MaterialDefines", function() { - return Kn.a + n.d(t, "MaterialDefines", function () { + return Kn.a; }), - n.d(t, "MaterialHelper", function() { - return Yn.a + n.d(t, "MaterialHelper", function () { + return Yn.a; }), - n.d(t, "MultiMaterial", function() { - return Wr.a + n.d(t, "MultiMaterial", function () { + return Wr.a; }), - n.d(t, "PushMaterial", function() { - return Qn.a + n.d(t, "PushMaterial", function () { + return Qn.a; }), - n.d(t, "ShaderMaterial", function() { - return vo.a + n.d(t, "ShaderMaterial", function () { + return vo.a; }), - n.d(t, "StandardMaterialDefines", function() { - return bi.b + n.d(t, "StandardMaterialDefines", function () { + return bi.b; }), - n.d(t, "StandardMaterial", function() { - return bi.a + n.d(t, "StandardMaterial", function () { + return bi.a; }), - n.d(t, "BaseTexture", function() { - return jn.a + n.d(t, "BaseTexture", function () { + return jn.a; }), - n.d(t, "CubeTexture", function() { - return Xn + n.d(t, "CubeTexture", function () { + return Xn; }), - n.d(t, "EquiRectangularCubeTexture", function() { - return bo + n.d(t, "EquiRectangularCubeTexture", function () { + return bo; }), - n.d(t, "HDRCubeTexture", function() { - return Kr + n.d(t, "HDRCubeTexture", function () { + return Kr; }), - n.d(t, "InternalTexture", function() { - return He.a + n.d(t, "InternalTexture", function () { + return He.a; }), - n.d(t, "MirrorTexture", function() { - return Wn + n.d(t, "MirrorTexture", function () { + return Wn; }), - n.d(t, "MultiRenderTarget", function() { - return Ao + n.d(t, "MultiRenderTarget", function () { + return Ao; }), - n.d(t, "RenderTargetTexture", function() { - return li + n.d(t, "RenderTargetTexture", function () { + return li; }), - n.d(t, "Texture", function() { - return je.a + n.d(t, "Texture", function () { + return je.a; }), - n.d(t, "UniformBuffer", function() { - return si.a + n.d(t, "UniformBuffer", function () { + return si.a; }), - n.d(t, "MaterialFlags", function() { - return qn.a + n.d(t, "MaterialFlags", function () { + return qn.a; }), - n.d(t, "BackgroundMaterial", function() { - return Jn + n.d(t, "BackgroundMaterial", function () { + return Jn; }), - n.d(t, "PBRMaterialDefines", function() { - return ur + n.d(t, "PBRMaterialDefines", function () { + return ur; }), - n.d(t, "PBRBaseMaterial", function() { - return lr + n.d(t, "PBRBaseMaterial", function () { + return lr; }), - n.d(t, "PBRBaseSimpleMaterial", function() { - return mo + n.d(t, "PBRBaseSimpleMaterial", function () { + return mo; }), - n.d(t, "PBRMaterial", function() { - return hr + n.d(t, "PBRMaterial", function () { + return hr; }), - n.d(t, "PBRMetallicRoughnessMaterial", function() { - return go + n.d(t, "PBRMetallicRoughnessMaterial", function () { + return go; }), - n.d(t, "PBRSpecularGlossinessMaterial", function() { - return _o + n.d(t, "PBRSpecularGlossinessMaterial", function () { + return _o; }), - n.d(t, "ColorGradingTexture", function() { - return yo + n.d(t, "ColorGradingTexture", function () { + return yo; }), - n.d(t, "DynamicTexture", function() { - return Ei + n.d(t, "DynamicTexture", function () { + return Ei; }), - n.d(t, "ProceduralTexture", function() { - return So + n.d(t, "ProceduralTexture", function () { + return So; }), - n.d(t, "RawCubeTexture", function() { - return Mo + n.d(t, "RawCubeTexture", function () { + return Mo; }), - n.d(t, "RawTexture", function() { - return We + n.d(t, "RawTexture", function () { + return We; }), - n.d(t, "RawTexture3D", function() { - return Oo + n.d(t, "RawTexture3D", function () { + return Oo; }), - n.d(t, "RefractionTexture", function() { - return wo + n.d(t, "RefractionTexture", function () { + return wo; }), - n.d(t, "VideoTexture", function() { - return Sr + n.d(t, "VideoTexture", function () { + return Sr; }), - n.d(t, "HtmlElementTexture", function() { - return Io + n.d(t, "HtmlElementTexture", function () { + return Io; }), - n.d(t, "_DDSTextureLoader", function() { - return br + n.d(t, "_DDSTextureLoader", function () { + return br; }), - n.d(t, "_ENVTextureLoader", function() { - return Tr + n.d(t, "_ENVTextureLoader", function () { + return Tr; }), - n.d(t, "_KTXTextureLoader", function() { - return xr + n.d(t, "_KTXTextureLoader", function () { + return xr; }), - n.d(t, "_TGATextureLoader", function() { - return To + n.d(t, "_TGATextureLoader", function () { + return To; }), - n.d(t, "CustomProceduralTexture", function() { - return Po + n.d(t, "CustomProceduralTexture", function () { + return Po; }), - n.d(t, "NoiseProceduralTexture", function() { - return Ro + n.d(t, "NoiseProceduralTexture", function () { + return Ro; }), - n.d(t, "ProceduralTextureSceneComponent", function() { - return xo + n.d(t, "ProceduralTextureSceneComponent", function () { + return xo; }), - n.d(t, "Scalar", function() { - return L.a + n.d(t, "Scalar", function () { + return L.a; }), - n.d(t, "ToGammaSpace", function() { - return a.u + n.d(t, "ToGammaSpace", function () { + return a.u; }), - n.d(t, "ToLinearSpace", function() { - return a.v + n.d(t, "ToLinearSpace", function () { + return a.v; }), - n.d(t, "Epsilon", function() { - return a.h + n.d(t, "Epsilon", function () { + return a.h; }), - n.d(t, "Color3", function() { - return a.e + n.d(t, "Color3", function () { + return a.e; }), - n.d(t, "Color4", function() { - return a.f + n.d(t, "Color4", function () { + return a.f; }), - n.d(t, "Vector2", function() { - return a.w + n.d(t, "Vector2", function () { + return a.w; }), - n.d(t, "Vector3", function() { - return a.x + n.d(t, "Vector3", function () { + return a.x; }), - n.d(t, "Vector4", function() { - return a.y + n.d(t, "Vector4", function () { + return a.y; }), - n.d(t, "Size", function() { - return a.r + n.d(t, "Size", function () { + return a.r; }), - n.d(t, "Quaternion", function() { - return a.q + n.d(t, "Quaternion", function () { + return a.q; }), - n.d(t, "Matrix", function() { - return a.j + n.d(t, "Matrix", function () { + return a.j; }), - n.d(t, "Plane", function() { - return a.n + n.d(t, "Plane", function () { + return a.n; }), - n.d(t, "Viewport", function() { - return a.z + n.d(t, "Viewport", function () { + return a.z; }), - n.d(t, "Frustum", function() { - return a.i + n.d(t, "Frustum", function () { + return a.i; }), - n.d(t, "Space", function() { - return a.s + n.d(t, "Space", function () { + return a.s; }), - n.d(t, "Axis", function() { - return a.c + n.d(t, "Axis", function () { + return a.c; }), - n.d(t, "BezierCurve", function() { - return a.d + n.d(t, "BezierCurve", function () { + return a.d; }), - n.d(t, "Orientation", function() { - return a.k + n.d(t, "Orientation", function () { + return a.k; }), - n.d(t, "Angle", function() { - return a.a + n.d(t, "Angle", function () { + return a.a; }), - n.d(t, "Arc2", function() { - return a.b + n.d(t, "Arc2", function () { + return a.b; }), - n.d(t, "Path2", function() { - return a.l + n.d(t, "Path2", function () { + return a.l; }), - n.d(t, "Path3D", function() { - return a.m + n.d(t, "Path3D", function () { + return a.m; }), - n.d(t, "Curve3", function() { - return a.g + n.d(t, "Curve3", function () { + return a.g; }), - n.d(t, "PositionNormalVertex", function() { - return a.p + n.d(t, "PositionNormalVertex", function () { + return a.p; }), - n.d(t, "PositionNormalTextureVertex", function() { - return a.o + n.d(t, "PositionNormalTextureVertex", function () { + return a.o; }), - n.d(t, "Tmp", function() { - return a.t + n.d(t, "Tmp", function () { + return a.t; }), - n.d(t, "SphericalHarmonics", function() { - return fr.a + n.d(t, "SphericalHarmonics", function () { + return fr.a; }), - n.d(t, "SphericalPolynomial", function() { - return fr.b + n.d(t, "SphericalPolynomial", function () { + return fr.b; }), - n.d(t, "AbstractMesh", function() { - return Ne.a + n.d(t, "AbstractMesh", function () { + return Ne.a; }), - n.d(t, "Buffer", function() { - return Si.a + n.d(t, "Buffer", function () { + return Si.a; }), - n.d(t, "VertexBuffer", function() { - return Si.b + n.d(t, "VertexBuffer", function () { + return Si.b; }), - n.d(t, "CSG", function() { - return Wo + n.d(t, "CSG", function () { + return Wo; }), - n.d(t, "Geometry", function() { - return Hr.a + n.d(t, "Geometry", function () { + return Hr.a; }), - n.d(t, "GroundMesh", function() { - return Ci + n.d(t, "GroundMesh", function () { + return Ci; }), - n.d(t, "TrailMesh", function() { - return Xo + n.d(t, "TrailMesh", function () { + return Xo; }), - n.d(t, "InstancedMesh", function() { - return Yo.a + n.d(t, "InstancedMesh", function () { + return Yo.a; }), - n.d(t, "LinesMesh", function() { - return Ko.b + n.d(t, "LinesMesh", function () { + return Ko.b; }), - n.d(t, "InstancedLinesMesh", function() { - return Ko.a + n.d(t, "InstancedLinesMesh", function () { + return Ko.a; }), - n.d(t, "_CreationDataStorage", function() { - return me.b + n.d(t, "_CreationDataStorage", function () { + return me.b; }), - n.d(t, "_InstancesBatch", function() { - return me.c + n.d(t, "_InstancesBatch", function () { + return me.c; }), - n.d(t, "Mesh", function() { - return me.a + n.d(t, "Mesh", function () { + return me.a; }), - n.d(t, "VertexData", function() { - return xi.a + n.d(t, "VertexData", function () { + return xi.a; }), - n.d(t, "MeshBuilder", function() { - return sa + n.d(t, "MeshBuilder", function () { + return sa; }), - n.d(t, "SimplificationSettings", function() { - return ca + n.d(t, "SimplificationSettings", function () { + return ca; }), - n.d(t, "SimplificationQueue", function() { - return ua + n.d(t, "SimplificationQueue", function () { + return ua; }), - n.d(t, "SimplificationType", function() { - return oa + n.d(t, "SimplificationType", function () { + return oa; }), - n.d(t, "SimplicationQueueSceneComponent", function() { - return ma + n.d(t, "SimplicationQueueSceneComponent", function () { + return ma; }), - n.d(t, "Polygon", function() { - return $o + n.d(t, "Polygon", function () { + return $o; }), - n.d(t, "PolygonMeshBuilder", function() { - return ea + n.d(t, "PolygonMeshBuilder", function () { + return ea; }), - n.d(t, "BaseSubMesh", function() { - return Uo.a + n.d(t, "BaseSubMesh", function () { + return Uo.a; }), - n.d(t, "SubMesh", function() { - return Uo.b + n.d(t, "SubMesh", function () { + return Uo.b; }), - n.d(t, "MeshLODLevel", function() { - return ga.a + n.d(t, "MeshLODLevel", function () { + return ga.a; }), - n.d(t, "TransformNode", function() { - return tr.a + n.d(t, "TransformNode", function () { + return tr.a; }), - n.d(t, "BoxBuilder", function() { - return xn.a + n.d(t, "BoxBuilder", function () { + return xn.a; }), - n.d(t, "SphereBuilder", function() { - return Rn.a + n.d(t, "SphereBuilder", function () { + return Rn.a; }), - n.d(t, "CylinderBuilder", function() { - return Oi.a + n.d(t, "CylinderBuilder", function () { + return Oi.a; }), - n.d(t, "LinesBuilder", function() { - return Mn.a + n.d(t, "LinesBuilder", function () { + return Mn.a; }), - n.d(t, "PlaneBuilder", function() { - return $n.a + n.d(t, "PlaneBuilder", function () { + return $n.a; }), - n.d(t, "DataBuffer", function() { - return _a.a + n.d(t, "DataBuffer", function () { + return _a.a; }), - n.d(t, "WebGLDataBuffer", function() { - return va.a + n.d(t, "WebGLDataBuffer", function () { + return va.a; }), - n.d(t, "DracoCompression", function() { - return ko + n.d(t, "DracoCompression", function () { + return ko; }), - n.d(t, "DiscBuilder", function() { - return Qo + n.d(t, "DiscBuilder", function () { + return Qo; }), - n.d(t, "RibbonBuilder", function() { - return no + n.d(t, "RibbonBuilder", function () { + return no; }), - n.d(t, "HemisphereBuilder", function() { - return Vn + n.d(t, "HemisphereBuilder", function () { + return Vn; }), - n.d(t, "TorusBuilder", function() { - return Mi + n.d(t, "TorusBuilder", function () { + return Mi; }), - n.d(t, "TorusKnotBuilder", function() { - return qo + n.d(t, "TorusKnotBuilder", function () { + return qo; }), - n.d(t, "PolygonBuilder", function() { - return ta + n.d(t, "PolygonBuilder", function () { + return ta; }), - n.d(t, "ShapeBuilder", function() { - return ro + n.d(t, "ShapeBuilder", function () { + return ro; }), - n.d(t, "LatheBuilder", function() { - return ia + n.d(t, "LatheBuilder", function () { + return ia; }), - n.d(t, "GroundBuilder", function() { - return Pi + n.d(t, "GroundBuilder", function () { + return Pi; }), - n.d(t, "TubeBuilder", function() { - return na + n.d(t, "TubeBuilder", function () { + return na; }), - n.d(t, "PolyhedronBuilder", function() { - return Ln + n.d(t, "PolyhedronBuilder", function () { + return Ln; }), - n.d(t, "IcoSphereBuilder", function() { - return ra + n.d(t, "IcoSphereBuilder", function () { + return ra; }), - n.d(t, "DecalBuilder", function() { - return aa + n.d(t, "DecalBuilder", function () { + return aa; }), - n.d(t, "MorphTarget", function() { - return Qr + n.d(t, "MorphTarget", function () { + return Qr; }), - n.d(t, "MorphTargetManager", function() { - return qr + n.d(t, "MorphTargetManager", function () { + return qr; }), - n.d(t, "Node", function() { - return N.a + n.d(t, "Node", function () { + return N.a; }), - n.d(t, "Database", function() { - return ba + n.d(t, "Database", function () { + return ba; }), - n.d(t, "BaseParticleSystem", function() { - return Ma + n.d(t, "BaseParticleSystem", function () { + return Ma; }), - n.d(t, "GPUParticleSystem", function() { - return Da + n.d(t, "GPUParticleSystem", function () { + return Da; }), - n.d(t, "Particle", function() { - return Oa + n.d(t, "Particle", function () { + return Oa; }), - n.d(t, "ParticleHelper", function() { - return Fa + n.d(t, "ParticleHelper", function () { + return Fa; }), - n.d(t, "ParticleSystem", function() { - return Ia + n.d(t, "ParticleSystem", function () { + return Ia; }), - n.d(t, "_IDoNeedToBeInTheBuild", function() { - return 42 + n.d(t, "_IDoNeedToBeInTheBuild", function () { + return 42; }), - n.d(t, "ParticleSystemSet", function() { - return La + n.d(t, "ParticleSystemSet", function () { + return La; }), - n.d(t, "SolidParticle", function() { - return Ba + n.d(t, "SolidParticle", function () { + return Ba; }), - n.d(t, "ModelShape", function() { - return Na + n.d(t, "ModelShape", function () { + return Na; }), - n.d(t, "DepthSortedParticle", function() { - return ka + n.d(t, "DepthSortedParticle", function () { + return ka; }), - n.d(t, "SolidParticleSystem", function() { - return Va + n.d(t, "SolidParticleSystem", function () { + return Va; }), - n.d(t, "SubEmitterType", function() { - return ya + n.d(t, "SubEmitterType", function () { + return ya; }), - n.d(t, "SubEmitter", function() { - return wa + n.d(t, "SubEmitter", function () { + return wa; }), - n.d(t, "BoxParticleEmitter", function() { - return Ea + n.d(t, "BoxParticleEmitter", function () { + return Ea; }), - n.d(t, "ConeParticleEmitter", function() { - return Ta + n.d(t, "ConeParticleEmitter", function () { + return Ta; }), - n.d(t, "CylinderParticleEmitter", function() { - return Aa + n.d(t, "CylinderParticleEmitter", function () { + return Aa; }), - n.d(t, "CylinderDirectedParticleEmitter", function() { - return xa + n.d(t, "CylinderDirectedParticleEmitter", function () { + return xa; }), - n.d(t, "HemisphericParticleEmitter", function() { - return Sa + n.d(t, "HemisphericParticleEmitter", function () { + return Sa; }), - n.d(t, "PointParticleEmitter", function() { - return Ca + n.d(t, "PointParticleEmitter", function () { + return Ca; }), - n.d(t, "SphereParticleEmitter", function() { - return Pa + n.d(t, "SphereParticleEmitter", function () { + return Pa; }), - n.d(t, "SphereDirectedParticleEmitter", function() { - return Ra + n.d(t, "SphereDirectedParticleEmitter", function () { + return Ra; }), - n.d(t, "PhysicsEngine", function() { - return $r + n.d(t, "PhysicsEngine", function () { + return $r; }), - n.d(t, "PhysicsEngineSceneComponent", function() { - return ja + n.d(t, "PhysicsEngineSceneComponent", function () { + return ja; }), - n.d(t, "PhysicsHelper", function() { - return Ha + n.d(t, "PhysicsHelper", function () { + return Ha; }), - n.d(t, "PhysicsRadialExplosionEventOptions", function() { - return Qa + n.d(t, "PhysicsRadialExplosionEventOptions", function () { + return Qa; }), - n.d(t, "PhysicsUpdraftEventOptions", function() { - return qa + n.d(t, "PhysicsUpdraftEventOptions", function () { + return qa; }), - n.d(t, "PhysicsVortexEventOptions", function() { - return Za + n.d(t, "PhysicsVortexEventOptions", function () { + return Za; }), - n.d(t, "PhysicsRadialImpulseFalloff", function() { - return Ga + n.d(t, "PhysicsRadialImpulseFalloff", function () { + return Ga; }), - n.d(t, "PhysicsUpdraftMode", function() { - return za + n.d(t, "PhysicsUpdraftMode", function () { + return za; }), - n.d(t, "PhysicsImpostor", function() { - return Zr.a + n.d(t, "PhysicsImpostor", function () { + return Zr.a; }), - n.d(t, "PhysicsJoint", function() { - return Jr.e + n.d(t, "PhysicsJoint", function () { + return Jr.e; }), - n.d(t, "DistanceJoint", function() { - return Jr.a + n.d(t, "DistanceJoint", function () { + return Jr.a; }), - n.d(t, "MotorEnabledJoint", function() { - return Jr.d + n.d(t, "MotorEnabledJoint", function () { + return Jr.d; }), - n.d(t, "HingeJoint", function() { - return Jr.c + n.d(t, "HingeJoint", function () { + return Jr.c; }), - n.d(t, "Hinge2Joint", function() { - return Jr.b + n.d(t, "Hinge2Joint", function () { + return Jr.b; }), - n.d(t, "CannonJSPlugin", function() { - return to + n.d(t, "CannonJSPlugin", function () { + return to; }), - n.d(t, "AmmoJSPlugin", function() { - return oo + n.d(t, "AmmoJSPlugin", function () { + return oo; }), - n.d(t, "OimoJSPlugin", function() { - return io + n.d(t, "OimoJSPlugin", function () { + return io; }), - n.d(t, "AnaglyphPostProcess", function() { - return Kt + n.d(t, "AnaglyphPostProcess", function () { + return Kt; }), - n.d(t, "BlackAndWhitePostProcess", function() { - return Ja + n.d(t, "BlackAndWhitePostProcess", function () { + return Ja; }), - n.d(t, "BloomEffect", function() { - return is + n.d(t, "BloomEffect", function () { + return is; }), - n.d(t, "BloomMergePostProcess", function() { - return ts + n.d(t, "BloomMergePostProcess", function () { + return ts; }), - n.d(t, "BlurPostProcess", function() { - return Hn + n.d(t, "BlurPostProcess", function () { + return Hn; }), - n.d(t, "ChromaticAberrationPostProcess", function() { - return ns + n.d(t, "ChromaticAberrationPostProcess", function () { + return ns; }), - n.d(t, "CircleOfConfusionPostProcess", function() { - return rs + n.d(t, "CircleOfConfusionPostProcess", function () { + return rs; }), - n.d(t, "ColorCorrectionPostProcess", function() { - return os + n.d(t, "ColorCorrectionPostProcess", function () { + return os; }), - n.d(t, "ConvolutionPostProcess", function() { - return as + n.d(t, "ConvolutionPostProcess", function () { + return as; }), - n.d(t, "DepthOfFieldBlurPostProcess", function() { - return ss + n.d(t, "DepthOfFieldBlurPostProcess", function () { + return ss; }), - n.d(t, "DepthOfFieldEffectBlurLevel", function() { - return cs + n.d(t, "DepthOfFieldEffectBlurLevel", function () { + return cs; }), - n.d(t, "DepthOfFieldEffect", function() { - return hs + n.d(t, "DepthOfFieldEffect", function () { + return hs; }), - n.d(t, "DepthOfFieldMergePostProcessOptions", function() { - return us + n.d(t, "DepthOfFieldMergePostProcessOptions", function () { + return us; }), - n.d(t, "DepthOfFieldMergePostProcess", function() { - return ls + n.d(t, "DepthOfFieldMergePostProcess", function () { + return ls; }), - n.d(t, "DisplayPassPostProcess", function() { - return fs + n.d(t, "DisplayPassPostProcess", function () { + return fs; }), - n.d(t, "ExtractHighlightsPostProcess", function() { - return es + n.d(t, "ExtractHighlightsPostProcess", function () { + return es; }), - n.d(t, "FilterPostProcess", function() { - return ds + n.d(t, "FilterPostProcess", function () { + return ds; }), - n.d(t, "FxaaPostProcess", function() { - return ps + n.d(t, "FxaaPostProcess", function () { + return ps; }), - n.d(t, "GrainPostProcess", function() { - return ms + n.d(t, "GrainPostProcess", function () { + return ms; }), - n.d(t, "HighlightsPostProcess", function() { - return gs + n.d(t, "HighlightsPostProcess", function () { + return gs; }), - n.d(t, "ImageProcessingPostProcess", function() { - return Ai + n.d(t, "ImageProcessingPostProcess", function () { + return Ai; }), - n.d(t, "MotionBlurPostProcess", function() { - return ys + n.d(t, "MotionBlurPostProcess", function () { + return ys; }), - n.d(t, "PassPostProcess", function() { - return Xt + n.d(t, "PassPostProcess", function () { + return Xt; }), - n.d(t, "PassCubePostProcess", function() { - return Yt + n.d(t, "PassCubePostProcess", function () { + return Yt; }), - n.d(t, "PostProcess", function() { - return Wt + n.d(t, "PostProcess", function () { + return Wt; }), - n.d(t, "PostProcessManager", function() { - return ci.a + n.d(t, "PostProcessManager", function () { + return ci.a; }), - n.d(t, "RefractionPostProcess", function() { - return bs + n.d(t, "RefractionPostProcess", function () { + return bs; }), - n.d(t, "SharpenPostProcess", function() { - return Es + n.d(t, "SharpenPostProcess", function () { + return Es; }), - n.d(t, "StereoscopicInterlacePostProcess", function() { - return $t + n.d(t, "StereoscopicInterlacePostProcess", function () { + return $t; }), - n.d(t, "TonemappingOperator", function() { - return Os + n.d(t, "TonemappingOperator", function () { + return Os; }), - n.d(t, "TonemapPostProcess", function() { - return ws + n.d(t, "TonemapPostProcess", function () { + return ws; }), - n.d(t, "VolumetricLightScatteringPostProcess", function() { - return Is + n.d(t, "VolumetricLightScatteringPostProcess", function () { + return Is; }), - n.d(t, "VRDistortionCorrectionPostProcess", function() { - return ai + n.d(t, "VRDistortionCorrectionPostProcess", function () { + return ai; }), - n.d(t, "VRMultiviewToSingleviewPostProcess", function() { - return fi + n.d(t, "VRMultiviewToSingleviewPostProcess", function () { + return fi; }), - n.d(t, "PostProcessRenderEffect", function() { - return $a + n.d(t, "PostProcessRenderEffect", function () { + return $a; }), - n.d(t, "PostProcessRenderPipeline", function() { - return Ts + n.d(t, "PostProcessRenderPipeline", function () { + return Ts; }), - n.d(t, "PostProcessRenderPipelineManager", function() { - return As + n.d(t, "PostProcessRenderPipelineManager", function () { + return As; }), - n.d(t, "PostProcessRenderPipelineManagerSceneComponent", function() { - return xs + n.d( + t, + "PostProcessRenderPipelineManagerSceneComponent", + function () { + return xs; + } + ), + n.d(t, "DefaultRenderingPipeline", function () { + return Ss; }), - n.d(t, "DefaultRenderingPipeline", function() { - return Ss + n.d(t, "LensRenderingPipeline", function () { + return Cs; }), - n.d(t, "LensRenderingPipeline", function() { - return Cs + n.d(t, "SSAO2RenderingPipeline", function () { + return Ps; }), - n.d(t, "SSAO2RenderingPipeline", function() { - return Ps + n.d(t, "SSAORenderingPipeline", function () { + return Rs; }), - n.d(t, "SSAORenderingPipeline", function() { - return Rs + n.d(t, "StandardRenderingPipeline", function () { + return Ms; }), - n.d(t, "StandardRenderingPipeline", function() { - return Ms + n.d(t, "ReflectionProbe", function () { + return ao; }), - n.d(t, "ReflectionProbe", function() { - return ao + n.d(t, "BoundingBoxRenderer", function () { + return Ds; }), - n.d(t, "BoundingBoxRenderer", function() { - return Ds + n.d(t, "DepthRenderer", function () { + return Ls; }), - n.d(t, "DepthRenderer", function() { - return Ls + n.d(t, "DepthRendererSceneComponent", function () { + return Fs; }), - n.d(t, "DepthRendererSceneComponent", function() { - return Fs + n.d(t, "EdgesRenderer", function () { + return Ns; }), - n.d(t, "EdgesRenderer", function() { - return Ns + n.d(t, "LineEdgesRenderer", function () { + return ks; }), - n.d(t, "LineEdgesRenderer", function() { - return ks + n.d(t, "GeometryBufferRenderer", function () { + return _s; }), - n.d(t, "GeometryBufferRenderer", function() { - return _s + n.d(t, "GeometryBufferRendererSceneComponent", function () { + return vs; }), - n.d(t, "GeometryBufferRendererSceneComponent", function() { - return vs + n.d(t, "OutlineRenderer", function () { + return Us; }), - n.d(t, "OutlineRenderer", function() { - return Us + n.d(t, "RenderingGroup", function () { + return Vs.a; }), - n.d(t, "RenderingGroup", function() { - return Vs.a + n.d(t, "RenderingGroupInfo", function () { + return ui.a; }), - n.d(t, "RenderingGroupInfo", function() { - return ui.a + n.d(t, "RenderingManager", function () { + return ui.b; }), - n.d(t, "RenderingManager", function() { - return ui.b + n.d(t, "UtilityLayerRenderer", function () { + return Cn.a; }), - n.d(t, "UtilityLayerRenderer", function() { - return Cn.a + n.d(t, "Scene", function () { + return Y.a; }), - n.d(t, "Scene", function() { - return Y.a + n.d(t, "SceneComponentConstants", function () { + return Se.a; }), - n.d(t, "SceneComponentConstants", function() { - return Se.a + n.d(t, "Stage", function () { + return Se.b; }), - n.d(t, "Stage", function() { - return Se.b + n.d(t, "Sprite", function () { + return Gs; }), - n.d(t, "Sprite", function() { - return Gs + n.d(t, "SpriteManager", function () { + return Hs; }), - n.d(t, "SpriteManager", function() { - return Hs + n.d(t, "SpriteSceneComponent", function () { + return zs; }), - n.d(t, "SpriteSceneComponent", function() { - return zs + n.d(t, "_AlphaState", function () { + return Ws.a; }), - n.d(t, "_AlphaState", function() { - return Ws.a + n.d(t, "_DepthCullingState", function () { + return Ws.b; }), - n.d(t, "_DepthCullingState", function() { - return Ws.b + n.d(t, "_StencilState", function () { + return Ws.c; }), - n.d(t, "_StencilState", function() { - return Ws.c + n.d(t, "AndOrNotEvaluator", function () { + return Xs.a; }), - n.d(t, "AndOrNotEvaluator", function() { - return Xs.a + n.d(t, "AssetTaskState", function () { + return js; }), - n.d(t, "AssetTaskState", function() { - return js + n.d(t, "AbstractAssetTask", function () { + return Ks; }), - n.d(t, "AbstractAssetTask", function() { - return Ks + n.d(t, "AssetsProgressEvent", function () { + return Qs; }), - n.d(t, "AssetsProgressEvent", function() { - return Qs + n.d(t, "MeshAssetTask", function () { + return qs; }), - n.d(t, "MeshAssetTask", function() { - return qs + n.d(t, "TextFileAssetTask", function () { + return Zs; }), - n.d(t, "TextFileAssetTask", function() { - return Zs + n.d(t, "BinaryFileAssetTask", function () { + return Js; }), - n.d(t, "BinaryFileAssetTask", function() { - return Js + n.d(t, "ImageAssetTask", function () { + return $s; }), - n.d(t, "ImageAssetTask", function() { - return $s + n.d(t, "TextureAssetTask", function () { + return ec; }), - n.d(t, "TextureAssetTask", function() { - return ec + n.d(t, "CubeTextureAssetTask", function () { + return tc; }), - n.d(t, "CubeTextureAssetTask", function() { - return tc + n.d(t, "HDRCubeTextureAssetTask", function () { + return ic; }), - n.d(t, "HDRCubeTextureAssetTask", function() { - return ic + n.d(t, "EquiRectangularCubeTextureAssetTask", function () { + return nc; }), - n.d(t, "EquiRectangularCubeTextureAssetTask", function() { - return nc + n.d(t, "AssetsManager", function () { + return rc; }), - n.d(t, "AssetsManager", function() { - return rc + n.d(t, "DDSTools", function () { + return yr; }), - n.d(t, "DDSTools", function() { - return yr + n.d(t, "expandToProperty", function () { + return F.b; }), - n.d(t, "expandToProperty", function() { - return F.b + n.d(t, "serialize", function () { + return F.c; }), - n.d(t, "serialize", function() { - return F.c + n.d(t, "serializeAsTexture", function () { + return F.m; }), - n.d(t, "serializeAsTexture", function() { - return F.m + n.d(t, "serializeAsColor3", function () { + return F.e; }), - n.d(t, "serializeAsColor3", function() { - return F.e + n.d(t, "serializeAsFresnelParameters", function () { + return F.h; }), - n.d(t, "serializeAsFresnelParameters", function() { - return F.h + n.d(t, "serializeAsVector2", function () { + return F.n; }), - n.d(t, "serializeAsVector2", function() { - return F.n + n.d(t, "serializeAsVector3", function () { + return F.o; }), - n.d(t, "serializeAsVector3", function() { - return F.o + n.d(t, "serializeAsMeshReference", function () { + return F.k; }), - n.d(t, "serializeAsMeshReference", function() { - return F.k + n.d(t, "serializeAsColorCurves", function () { + return F.g; }), - n.d(t, "serializeAsColorCurves", function() { - return F.g + n.d(t, "serializeAsColor4", function () { + return F.f; }), - n.d(t, "serializeAsColor4", function() { - return F.f + n.d(t, "serializeAsImageProcessingConfiguration", function () { + return F.i; }), - n.d(t, "serializeAsImageProcessingConfiguration", function() { - return F.i + n.d(t, "serializeAsQuaternion", function () { + return F.l; }), - n.d(t, "serializeAsQuaternion", function() { - return F.l + n.d(t, "serializeAsMatrix", function () { + return F.j; }), - n.d(t, "serializeAsMatrix", function() { - return F.j + n.d(t, "serializeAsCameraReference", function () { + return F.d; }), - n.d(t, "serializeAsCameraReference", function() { - return F.d + n.d(t, "SerializationHelper", function () { + return F.a; }), - n.d(t, "SerializationHelper", function() { - return F.a + n.d(t, "Deferred", function () { + return oc; }), - n.d(t, "Deferred", function() { - return oc + n.d(t, "EnvironmentTextureTools", function () { + return Er; }), - n.d(t, "EnvironmentTextureTools", function() { - return Er + n.d(t, "MeshExploder", function () { + return ac; }), - n.d(t, "MeshExploder", function() { - return ac + n.d(t, "FilesInput", function () { + return sc; }), - n.d(t, "FilesInput", function() { - return sc + n.d(t, "KhronosTextureContainer", function () { + return Ar; }), - n.d(t, "KhronosTextureContainer", function() { - return Ar + n.d(t, "EventState", function () { + return o.a; }), - n.d(t, "EventState", function() { - return o.a + n.d(t, "Observer", function () { + return o.d; }), - n.d(t, "Observer", function() { - return o.d + n.d(t, "MultiObserver", function () { + return o.b; }), - n.d(t, "MultiObserver", function() { - return o.b + n.d(t, "Observable", function () { + return o.c; }), - n.d(t, "Observable", function() { - return o.c + n.d(t, "PerformanceMonitor", function () { + return cc.a; }), - n.d(t, "PerformanceMonitor", function() { - return cc.a + n.d(t, "RollingAverage", function () { + return cc.b; }), - n.d(t, "RollingAverage", function() { - return cc.b + n.d(t, "PromisePolyfill", function () { + return uc.a; }), - n.d(t, "PromisePolyfill", function() { - return uc.a + n.d(t, "SceneOptimization", function () { + return lc; }), - n.d(t, "SceneOptimization", function() { - return lc + n.d(t, "TextureOptimization", function () { + return hc; }), - n.d(t, "TextureOptimization", function() { - return hc + n.d(t, "HardwareScalingOptimization", function () { + return fc; }), - n.d(t, "HardwareScalingOptimization", function() { - return fc + n.d(t, "ShadowsOptimization", function () { + return dc; }), - n.d(t, "ShadowsOptimization", function() { - return dc + n.d(t, "PostProcessesOptimization", function () { + return pc; }), - n.d(t, "PostProcessesOptimization", function() { - return pc + n.d(t, "LensFlaresOptimization", function () { + return mc; }), - n.d(t, "LensFlaresOptimization", function() { - return mc + n.d(t, "CustomOptimization", function () { + return gc; }), - n.d(t, "CustomOptimization", function() { - return gc + n.d(t, "ParticlesOptimization", function () { + return _c; }), - n.d(t, "ParticlesOptimization", function() { - return _c + n.d(t, "RenderTargetsOptimization", function () { + return vc; }), - n.d(t, "RenderTargetsOptimization", function() { - return vc + n.d(t, "MergeMeshesOptimization", function () { + return yc; }), - n.d(t, "MergeMeshesOptimization", function() { - return yc + n.d(t, "SceneOptimizerOptions", function () { + return bc; }), - n.d(t, "SceneOptimizerOptions", function() { - return bc + n.d(t, "SceneOptimizer", function () { + return Ec; }), - n.d(t, "SceneOptimizer", function() { - return Ec + n.d(t, "SceneSerializer", function () { + return Sc; }), - n.d(t, "SceneSerializer", function() { - return Sc + n.d(t, "SmartArray", function () { + return jt.a; }), - n.d(t, "SmartArray", function() { - return jt.a + n.d(t, "SmartArrayNoDuplicate", function () { + return jt.b; }), - n.d(t, "SmartArrayNoDuplicate", function() { - return jt.b + n.d(t, "StringDictionary", function () { + return vt.a; }), - n.d(t, "StringDictionary", function() { - return vt.a + n.d(t, "Tags", function () { + return Cc.a; }), - n.d(t, "Tags", function() { - return Cc.a + n.d(t, "TextureTools", function () { + return Pc; }), - n.d(t, "TextureTools", function() { - return Pc + n.d(t, "TGATools", function () { + return Eo; }), - n.d(t, "TGATools", function() { - return Eo + n.d(t, "ColorGradient", function () { + return Ee.c; }), - n.d(t, "ColorGradient", function() { - return Ee.c + n.d(t, "Color3Gradient", function () { + return Ee.b; }), - n.d(t, "Color3Gradient", function() { - return Ee.b + n.d(t, "FactorGradient", function () { + return Ee.d; }), - n.d(t, "FactorGradient", function() { - return Ee.d + n.d(t, "LoadFileError", function () { + return Ee.e; }), - n.d(t, "LoadFileError", function() { - return Ee.e + n.d(t, "RetryStrategy", function () { + return Ee.g; }), - n.d(t, "RetryStrategy", function() { - return Ee.g + n.d(t, "Tools", function () { + return Ee.h; }), - n.d(t, "Tools", function() { - return Ee.h + n.d(t, "PerfCounter", function () { + return Ee.f; }), - n.d(t, "PerfCounter", function() { - return Ee.f + n.d(t, "className", function () { + return Ee.i; }), - n.d(t, "className", function() { - return Ee.i + n.d(t, "AsyncLoop", function () { + return Ee.a; }), - n.d(t, "AsyncLoop", function() { - return Ee.a + n.d(t, "VideoRecorder", function () { + return Rc; }), - n.d(t, "VideoRecorder", function() { - return Rc + n.d(t, "JoystickAxis", function () { + return _t; }), - n.d(t, "JoystickAxis", function() { - return _t + n.d(t, "VirtualJoystick", function () { + return yt; }), - n.d(t, "VirtualJoystick", function() { - return yt + n.d(t, "WorkerPool", function () { + return Do; }), - n.d(t, "WorkerPool", function() { - return Do + n.d(t, "Logger", function () { + return g.a; }), - n.d(t, "Logger", function() { - return g.a + n.d(t, "_TypeStore", function () { + return s.a; }), - n.d(t, "_TypeStore", function() { - return s.a + n.d(t, "FilesInputStore", function () { + return fn.a; }), - n.d(t, "FilesInputStore", function() { - return fn.a + n.d(t, "DeepCopier", function () { + return M.a; }), - n.d(t, "DeepCopier", function() { - return M.a + n.d(t, "PivotTools", function () { + return Ue.a; }), - n.d(t, "PivotTools", function() { - return Ue.a + n.d(t, "PrecisionDate", function () { + return K.a; }), - n.d(t, "PrecisionDate", function() { - return K.a + n.d(t, "ScreenshotTools", function () { + return Mc; }), - n.d(t, "ScreenshotTools", function() { - return Mc + n.d(t, "WebRequest", function () { + return Co.a; }), - n.d(t, "WebRequest", function() { - return Co.a + n.d(t, "InspectableType", function () { + return Ys; }), - n.d(t, "InspectableType", function() { - return Ys + n.d(t, "CubeMapToSphericalPolynomialTools", function () { + return dr.a; }), - n.d(t, "CubeMapToSphericalPolynomialTools", function() { - return dr.a + n.d(t, "HDRTools", function () { + return Yr; }), - n.d(t, "HDRTools", function() { - return Yr - }), - n.d(t, "PanoramaToCubeMapTools", function() { - return Xr - }) - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.fogFragmentDeclaration = "#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.fogFragment = "#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.fogVertexDeclaration = "#ifdef FOG\nvarying vec3 vFogDistance;\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.morphTargetsVertexGlobalDeclaration = "#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.morphTargetsVertexDeclaration = "#ifdef MORPHTARGETS\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#endif" - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.morphTargetsVertex = "#ifdef MORPHTARGETS\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#endif" - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n + n.d(t, "PanoramaToCubeMapTools", function () { + return Xr; }); - var n = function() { - function e() {} - return e.Eval = function(t, i) { - return "true" === (t = t.match(/\([^\(\)]*\)/g) ? t.replace(/\([^\(\)]*\)/g, function(t) { - return t = t.slice(1, t.length - 1), - e._HandleParenthesisContent(t, i) - }) : e._HandleParenthesisContent(t, i)) || "false" !== t && e.Eval(t, i) - } - , - e._HandleParenthesisContent = function(t, i) { - var n; - i = i || function(e) { - return "true" === e - } - ; - var r = t.split("||"); - for (var o in r) - if (r.hasOwnProperty(o)) { - var a = e._SimplifyNegation(r[o].trim()) - , s = a.split("&&"); - if (s.length > 1) - for (var c = 0; c < s.length; ++c) { - var u = e._SimplifyNegation(s[c].trim()); - if (!(n = "true" !== u && "false" !== u ? "!" === u[0] ? !i(u.substring(1)) : i(u) : "true" === u)) { - a = "false"; - break - } - } - if (n || "true" === a) { - n = true; - break - } - n = "true" !== a && "false" !== a ? "!" === a[0] ? !i(a.substring(1)) : i(a) : "true" === a + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.fogFragmentDeclaration = + "#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.fogFragment = + "#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.fogVertexDeclaration = + "#ifdef FOG\nvarying vec3 vFogDistance;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.morphTargetsVertexGlobalDeclaration = + "#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.morphTargetsVertexDeclaration = + "#ifdef MORPHTARGETS\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.morphTargetsVertex = + "#ifdef MORPHTARGETS\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#endif"; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + (e.Eval = function (t, i) { + return ( + "true" === + (t = t.match(/\([^\(\)]*\)/g) + ? t.replace(/\([^\(\)]*\)/g, function (t) { + return ( + (t = t.slice(1, t.length - 1)), + e._HandleParenthesisContent(t, i) + ); + }) + : e._HandleParenthesisContent(t, i)) || + ("false" !== t && e.Eval(t, i)) + ); + }), + (e._HandleParenthesisContent = function (t, i) { + var n; + i = + i || + function (e) { + return "true" === e; + }; + var r = t.split("||"); + for (var o in r) + if (r.hasOwnProperty(o)) { + var a = e._SimplifyNegation(r[o].trim()), + s = a.split("&&"); + if (s.length > 1) + for (var c = 0; c < s.length; ++c) { + var u = e._SimplifyNegation(s[c].trim()); + if ( + !(n = + "true" !== u && "false" !== u + ? "!" === u[0] + ? !i(u.substring(1)) + : i(u) + : "true" === u) + ) { + a = "false"; + break; } - return n ? "true" : "false" - } - , - e._SimplifyNegation = function(e) { - return "!true" === (e = (e = e.replace(/^[\s!]+/, function(e) { - return (e = e.replace(/[\s]/g, function() { - return "" - })).length % 2 ? "!" : "" - })).trim()) ? e = "false" : "!false" === e && (e = "true"), - e - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }), - i.d(t, "b", function() { - return o + } + if (n || "true" === a) { + n = true; + break; + } + n = + "true" !== a && "false" !== a + ? "!" === a[0] + ? !i(a.substring(1)) + : i(a) + : "true" === a; + } + return n ? "true" : "false"; + }), + (e._SimplifyNegation = function (e) { + return ( + "!true" === + (e = (e = e.replace(/^[\s!]+/, function (e) { + return (e = e.replace(/[\s]/g, function () { + return ""; + })).length % 2 + ? "!" + : ""; + })).trim()) + ? (e = "false") + : "!false" === e && (e = "true"), + e + ); + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }), + i.d(t, "b", function () { + return o; }); - var n = i(47) - , r = function() { - function e(e) { - void 0 === e && (e = 30), - this._enabled = true, - this._rollingFrameTime = new o(e) - } - return e.prototype.sampleFrame = function(e) { - if (void 0 === e && (e = n.a.Now), - this._enabled) { - if (null != this._lastFrameTimeMs) { - var t = e - this._lastFrameTimeMs; - this._rollingFrameTime.add(t) - } - this._lastFrameTimeMs = e + var n = i(47), + r = (function () { + function e(e) { + void 0 === e && (e = 30), + (this._enabled = true), + (this._rollingFrameTime = new o(e)); + } + return ( + (e.prototype.sampleFrame = function (e) { + if ((void 0 === e && (e = n.a.Now), this._enabled)) { + if (null != this._lastFrameTimeMs) { + var t = e - this._lastFrameTimeMs; + this._rollingFrameTime.add(t); } - } - , + this._lastFrameTimeMs = e; + } + }), Object.defineProperty(e.prototype, "averageFrameTime", { - get: function() { - return this._rollingFrameTime.average + get: function () { + return this._rollingFrameTime.average; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "averageFrameTimeVariance", + { + get: function () { + return this._rollingFrameTime.variance; }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "averageFrameTimeVariance", { - get: function() { - return this._rollingFrameTime.variance + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "instantaneousFrameTime", + { + get: function () { + return this._rollingFrameTime.history(0); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "instantaneousFrameTime", { - get: function() { - return this._rollingFrameTime.history(0) - }, - enumerable: true, - configurable: true - }), + configurable: true, + } + ), Object.defineProperty(e.prototype, "averageFPS", { - get: function() { - return 1e3 / this._rollingFrameTime.average - }, - enumerable: true, - configurable: true + get: function () { + return 1e3 / this._rollingFrameTime.average; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "instantaneousFPS", { - get: function() { - var e = this._rollingFrameTime.history(0); - return 0 === e ? 0 : 1e3 / e - }, - enumerable: true, - configurable: true + get: function () { + var e = this._rollingFrameTime.history(0); + return 0 === e ? 0 : 1e3 / e; + }, + enumerable: true, + configurable: true, }), Object.defineProperty(e.prototype, "isSaturated", { - get: function() { - return this._rollingFrameTime.isSaturated() - }, - enumerable: true, - configurable: true + get: function () { + return this._rollingFrameTime.isSaturated(); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.enable = function () { + this._enabled = true; + }), + (e.prototype.disable = function () { + (this._enabled = false), (this._lastFrameTimeMs = null); }), - e.prototype.enable = function() { - this._enabled = true - } - , - e.prototype.disable = function() { - this._enabled = false, - this._lastFrameTimeMs = null - } - , Object.defineProperty(e.prototype, "isEnabled", { - get: function() { - return this._enabled - }, - enumerable: true, - configurable: true + get: function () { + return this._enabled; + }, + enumerable: true, + configurable: true, + }), + (e.prototype.reset = function () { + (this._lastFrameTimeMs = null), + this._rollingFrameTime.reset(); }), - e.prototype.reset = function() { - this._lastFrameTimeMs = null, - this._rollingFrameTime.reset() - } - , e - }() - , o = function() { - function e(e) { - this._samples = new Array(e), - this.reset() - } - return e.prototype.add = function(e) { - var t; - if (this.isSaturated()) { - var i = this._samples[this._pos]; - t = i - this.average, - this.average -= t / (this._sampleCount - 1), - this._m2 -= t * (i - this.average) - } else - this._sampleCount++; - t = e - this.average, - this.average += t / this._sampleCount, - this._m2 += t * (e - this.average), - this.variance = this._m2 / (this._sampleCount - 1), - this._samples[this._pos] = e, + ); + })(), + o = (function () { + function e(e) { + (this._samples = new Array(e)), this.reset(); + } + return ( + (e.prototype.add = function (e) { + var t; + if (this.isSaturated()) { + var i = this._samples[this._pos]; + (t = i - this.average), + (this.average -= t / (this._sampleCount - 1)), + (this._m2 -= t * (i - this.average)); + } else this._sampleCount++; + (t = e - this.average), + (this.average += t / this._sampleCount), + (this._m2 += t * (e - this.average)), + (this.variance = this._m2 / (this._sampleCount - 1)), + (this._samples[this._pos] = e), this._pos++, - this._pos %= this._samples.length - } - , - e.prototype.history = function(e) { - if (e >= this._sampleCount || e >= this._samples.length) - return 0; - var t = this._wrapPosition(this._pos - 1); - return this._samples[this._wrapPosition(t - e)] - } - , - e.prototype.isSaturated = function() { - return this._sampleCount >= this._samples.length - } - , - e.prototype.reset = function() { - this.average = 0, - this.variance = 0, - this._sampleCount = 0, - this._pos = 0, - this._m2 = 0 - } - , - e.prototype._wrapPosition = function(e) { - var t = this._samples.length; - return (e % t + t) % t - } - , - e - }() - } - , function(e, t, n) { - "use strict"; - n.d(t, "a", function() { - return c - }); - var r, o = n(9); - !function(e) { - e[e.Pending = 0] = "Pending", - e[e.Fulfilled = 1] = "Fulfilled", - e[e.Rejected = 2] = "Rejected" - }(r || (r = {})); - var a = function() { - this.count = 0, - this.target = 0, - this.results = [] - } - , s = function() { - function e(e) { - var t = this; - if (this._state = r.Pending, - this._children = new Array, - this._rejectWasConsumed = false, - e) - try { - e(function(e) { - t._resolve(e) - }, function(e) { - t._reject(e) - }) - } catch (e) { - this._reject(e) - } - } - return Object.defineProperty(e.prototype, "_result", { - get: function() { - return this._resultValue - }, - set: function(e) { - this._resultValue = e, - this._parent && void 0 === this._parent._result && (this._parent._result = e) - }, - enumerable: true, - configurable: true + (this._pos %= this._samples.length); }), - e.prototype.catch = function(e) { - return this.then(void 0, e) - } - , - e.prototype.then = function(t, i) { - var n = this - , a = new e; - return a._onFulfilled = t, - a._onRejected = i, + (e.prototype.history = function (e) { + if (e >= this._sampleCount || e >= this._samples.length) + return 0; + var t = this._wrapPosition(this._pos - 1); + return this._samples[this._wrapPosition(t - e)]; + }), + (e.prototype.isSaturated = function () { + return this._sampleCount >= this._samples.length; + }), + (e.prototype.reset = function () { + (this.average = 0), + (this.variance = 0), + (this._sampleCount = 0), + (this._pos = 0), + (this._m2 = 0); + }), + (e.prototype._wrapPosition = function (e) { + var t = this._samples.length; + return ((e % t) + t) % t; + }), + e + ); + })(); + }, + function (e, t, n) { + "use strict"; + n.d(t, "a", function () { + return c; + }); + var r, + o = n(9); + !(function (e) { + (e[(e.Pending = 0)] = "Pending"), + (e[(e.Fulfilled = 1)] = "Fulfilled"), + (e[(e.Rejected = 2)] = "Rejected"); + })(r || (r = {})); + var a = function () { + (this.count = 0), (this.target = 0), (this.results = []); + }, + s = (function () { + function e(e) { + var t = this; + if ( + ((this._state = r.Pending), + (this._children = new Array()), + (this._rejectWasConsumed = false), + e) + ) + try { + e( + function (e) { + t._resolve(e); + }, + function (e) { + t._reject(e); + } + ); + } catch (e) { + this._reject(e); + } + } + return ( + Object.defineProperty(e.prototype, "_result", { + get: function () { + return this._resultValue; + }, + set: function (e) { + (this._resultValue = e), + this._parent && + void 0 === this._parent._result && + (this._parent._result = e); + }, + enumerable: true, + configurable: true, + }), + (e.prototype.catch = function (e) { + return this.then(void 0, e); + }), + (e.prototype.then = function (t, i) { + var n = this, + a = new e(); + return ( + (a._onFulfilled = t), + (a._onRejected = i), this._children.push(a), - a._parent = this, - this._state !== r.Pending && o.h.SetImmediate(function() { - if (n._state === r.Fulfilled || n._rejectWasConsumed) { - var e = a._resolve(n._result); - if (null != e) - if (void 0 !== e._state) { - var t = e; - a._children.push(t), - t._parent = a, - a = t - } else - a._result = e - } else - a._reject(n._reason) - }), + (a._parent = this), + this._state !== r.Pending && + o.h.SetImmediate(function () { + if ( + n._state === r.Fulfilled || + n._rejectWasConsumed + ) { + var e = a._resolve(n._result); + if (null != e) + if (void 0 !== e._state) { + var t = e; + a._children.push(t), (t._parent = a), (a = t); + } else a._result = e; + } else a._reject(n._reason); + }), a - } - , - e.prototype._moveChildren = function(e) { - var t, i = this; - if ((t = this._children).push.apply(t, e.splice(0, e.length)), - this._children.forEach(function(e) { - e._parent = i + ); + }), + (e.prototype._moveChildren = function (e) { + var t, + i = this; + if ( + ((t = this._children).push.apply( + t, + e.splice(0, e.length) + ), + this._children.forEach(function (e) { + e._parent = i; }), this._state === r.Fulfilled) - for (var n = 0, o = this._children; n < o.length; n++) - o[n]._resolve(this._result); - else if (this._state === r.Rejected) - for (var a = 0, s = this._children; a < s.length; a++) - s[a]._reject(this._reason) - } - , - e.prototype._resolve = function(e) { - try { - this._state = r.Fulfilled; - var t = null; - if (this._onFulfilled && (t = this._onFulfilled(e)), - null != t) - if (void 0 !== t._state) { - var i = t; - i._parent = this, - i._moveChildren(this._children), - e = i._result - } else - e = t; - this._result = e; - for (var n = 0, o = this._children; n < o.length; n++) - o[n]._resolve(e); - this._children.length = 0, - delete this._onFulfilled, - delete this._onRejected - } catch (e) { - this._reject(e, true) - } - } - , - e.prototype._reject = function(e, t) { - if (void 0 === t && (t = false), - this._state = r.Rejected, - this._reason = e, + ) + for (var n = 0, o = this._children; n < o.length; n++) + o[n]._resolve(this._result); + else if (this._state === r.Rejected) + for (var a = 0, s = this._children; a < s.length; a++) + s[a]._reject(this._reason); + }), + (e.prototype._resolve = function (e) { + try { + this._state = r.Fulfilled; + var t = null; + if ( + (this._onFulfilled && (t = this._onFulfilled(e)), + null != t) + ) + if (void 0 !== t._state) { + var i = t; + (i._parent = this), + i._moveChildren(this._children), + (e = i._result); + } else e = t; + this._result = e; + for (var n = 0, o = this._children; n < o.length; n++) + o[n]._resolve(e); + (this._children.length = 0), + delete this._onFulfilled, + delete this._onRejected; + } catch (e) { + this._reject(e, true); + } + }), + (e.prototype._reject = function (e, t) { + if ( + (void 0 === t && (t = false), + (this._state = r.Rejected), + (this._reason = e), this._onRejected && !t) - try { - this._onRejected(e), - this._rejectWasConsumed = true - } catch (t) { - e = t - } - for (var i = 0, n = this._children; i < n.length; i++) { - var o = n[i]; - this._rejectWasConsumed ? o._resolve(null) : o._reject(e) + ) + try { + this._onRejected(e), (this._rejectWasConsumed = true); + } catch (t) { + e = t; } - this._children.length = 0, + for (var i = 0, n = this._children; i < n.length; i++) { + var o = n[i]; + this._rejectWasConsumed + ? o._resolve(null) + : o._reject(e); + } + (this._children.length = 0), delete this._onFulfilled, - delete this._onRejected - } - , - e.resolve = function(t) { - var i = new e; - return i._resolve(t), - i - } - , - e._RegisterForFulfillment = function(e, t, i) { - e.then(function(e) { - return t.results[i] = e, + delete this._onRejected; + }), + (e.resolve = function (t) { + var i = new e(); + return i._resolve(t), i; + }), + (e._RegisterForFulfillment = function (e, t, i) { + e.then( + function (e) { + return ( + (t.results[i] = e), t.count++, - t.count === t.target && t.rootPromise._resolve(t.results), + t.count === t.target && + t.rootPromise._resolve(t.results), null - }, function(e) { - t.rootPromise._state !== r.Rejected && t.rootPromise._reject(e) - }) - } - , - e.all = function(t) { - var i = new e - , n = new a; - if (n.target = t.length, - n.rootPromise = i, - t.length) - for (var r = 0; r < t.length; r++) - e._RegisterForFulfillment(t[r], n, r); - else - i._resolve([]); - return i - } - , - e.race = function(t) { - var i = new e; - if (t.length) - for (var n = 0, r = t; n < r.length; n++) - r[n].then(function(e) { - return i && (i._resolve(e), - i = null), - null - }, function(e) { - i && (i._reject(e), - i = null) - }); - return i - } - , + ); + }, + function (e) { + t.rootPromise._state !== r.Rejected && + t.rootPromise._reject(e); + } + ); + }), + (e.all = function (t) { + var i = new e(), + n = new a(); + if ( + ((n.target = t.length), (n.rootPromise = i), t.length) + ) + for (var r = 0; r < t.length; r++) + e._RegisterForFulfillment(t[r], n, r); + else i._resolve([]); + return i; + }), + (e.race = function (t) { + var i = new e(); + if (t.length) + for (var n = 0, r = t; n < r.length; n++) + r[n].then( + function (e) { + return i && (i._resolve(e), (i = null)), null; + }, + function (e) { + i && (i._reject(e), (i = null)); + } + ); + return i; + }), e - }() - , c = function() { - function e() {} - return e.Apply = function(e) { - void 0 === e && (e = false), - (e || void 0 === i) && (window.Promise = s) - } - , + ); + })(), + c = (function () { + function e() {} + return ( + (e.Apply = function (e) { + void 0 === e && (e = false), + (e || void 0 === i) && (window.Promise = s); + }), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function() { - function e() {} - return Object.defineProperty(e.prototype, "isAsync", { - get: function() { - return this.isParallelCompiled + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = (function () { + function e() {} + return ( + Object.defineProperty(e.prototype, "isAsync", { + get: function () { + return this.isParallelCompiled; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(e.prototype, "isReady", { + get: function () { + return ( + !!this.program && + (!this.isParallelCompiled || + this.engine._isRenderingStateCompiled(this)) + ); + }, + enumerable: true, + configurable: true, + }), + (e.prototype._handlesSpectorRebuildCallback = function (e) { + e && this.program && e(this.program); + }), + e + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return r; + }); + var n = i(0), + r = function () { + (this._checkCollisions = false), + (this._collisionMask = -1), + (this._collisionGroup = -1), + (this._collider = null), + (this._oldPositionForCollisions = new n.x(0, 0, 0)), + (this._diffPositionForCollisions = new n.x(0, 0, 0)); + }; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return a; + }); + var n = i(28), + r = i(0), + o = i(3), + a = (function () { + function e(e, t, i, r, o) { + void 0 === i && (i = null), + void 0 === r && (r = null), + void 0 === o && (o = null), + (this.index = e), + (this._opaqueSubMeshes = new n.a(256)), + (this._transparentSubMeshes = new n.a(256)), + (this._alphaTestSubMeshes = new n.a(256)), + (this._depthOnlySubMeshes = new n.a(256)), + (this._particleSystems = new n.a(256)), + (this._spriteManagers = new n.a(256)), + (this._edgesRenderers = new n.a(16)), + (this._scene = t), + (this.opaqueSortCompareFn = i), + (this.alphaTestSortCompareFn = r), + (this.transparentSortCompareFn = o); + } + return ( + Object.defineProperty(e.prototype, "opaqueSortCompareFn", { + set: function (t) { + (this._opaqueSortCompareFn = t), + (this._renderOpaque = t + ? this.renderOpaqueSorted + : e.renderUnsorted); + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty( + e.prototype, + "alphaTestSortCompareFn", + { + set: function (t) { + (this._alphaTestSortCompareFn = t), + (this._renderAlphaTest = t + ? this.renderAlphaTestSorted + : e.renderUnsorted); }, enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "isReady", { - get: function() { - return !!this.program && (!this.isParallelCompiled || this.engine._isRenderingStateCompiled(this)) + configurable: true, + } + ), + Object.defineProperty( + e.prototype, + "transparentSortCompareFn", + { + set: function (t) { + (this._transparentSortCompareFn = + t || e.defaultTransparentSortCompare), + (this._renderTransparent = + this.renderTransparentSorted); }, enumerable: true, - configurable: true - }), - e.prototype._handlesSpectorRebuildCallback = function(e) { - e && this.program && e(this.program) - } - , - e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return r - }); - var n = i(0) - , r = function() { - this._checkCollisions = false, - this._collisionMask = -1, - this._collisionGroup = -1, - this._collider = null, - this._oldPositionForCollisions = new n.x(0,0,0), - this._diffPositionForCollisions = new n.x(0,0,0) - } - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return a - }); - var n = i(28) - , r = i(0) - , o = i(3) - , a = function() { - function e(e, t, i, r, o) { - void 0 === i && (i = null), - void 0 === r && (r = null), - void 0 === o && (o = null), - this.index = e, - this._opaqueSubMeshes = new n.a(256), - this._transparentSubMeshes = new n.a(256), - this._alphaTestSubMeshes = new n.a(256), - this._depthOnlySubMeshes = new n.a(256), - this._particleSystems = new n.a(256), - this._spriteManagers = new n.a(256), - this._edgesRenderers = new n.a(16), - this._scene = t, - this.opaqueSortCompareFn = i, - this.alphaTestSortCompareFn = r, - this.transparentSortCompareFn = o - } - return Object.defineProperty(e.prototype, "opaqueSortCompareFn", { - set: function(t) { - this._opaqueSortCompareFn = t, - this._renderOpaque = t ? this.renderOpaqueSorted : e.renderUnsorted - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "alphaTestSortCompareFn", { - set: function(t) { - this._alphaTestSortCompareFn = t, - this._renderAlphaTest = t ? this.renderAlphaTestSorted : e.renderUnsorted - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(e.prototype, "transparentSortCompareFn", { - set: function(t) { - this._transparentSortCompareFn = t || e.defaultTransparentSortCompare, - this._renderTransparent = this.renderTransparentSorted - }, - enumerable: true, - configurable: true - }), - e.prototype.render = function(e, t, i, n) { - if (e) - e(this._opaqueSubMeshes, this._alphaTestSubMeshes, this._transparentSubMeshes, this._depthOnlySubMeshes); - else { - var r = this._scene.getEngine(); - 0 !== this._depthOnlySubMeshes.length && (r.setColorWrite(false), - this._renderAlphaTest(this._depthOnlySubMeshes), - r.setColorWrite(true)), - 0 !== this._opaqueSubMeshes.length && this._renderOpaque(this._opaqueSubMeshes), - 0 !== this._alphaTestSubMeshes.length && this._renderAlphaTest(this._alphaTestSubMeshes); - var a = r.getStencilBuffer(); - if (r.setStencilBuffer(false), - t && this._renderSprites(), - i && this._renderParticles(n), - this.onBeforeTransparentRendering && this.onBeforeTransparentRendering(), - 0 !== this._transparentSubMeshes.length && (this._renderTransparent(this._transparentSubMeshes), + configurable: true, + } + ), + (e.prototype.render = function (e, t, i, n) { + if (e) + e( + this._opaqueSubMeshes, + this._alphaTestSubMeshes, + this._transparentSubMeshes, + this._depthOnlySubMeshes + ); + else { + var r = this._scene.getEngine(); + 0 !== this._depthOnlySubMeshes.length && + (r.setColorWrite(false), + this._renderAlphaTest(this._depthOnlySubMeshes), + r.setColorWrite(true)), + 0 !== this._opaqueSubMeshes.length && + this._renderOpaque(this._opaqueSubMeshes), + 0 !== this._alphaTestSubMeshes.length && + this._renderAlphaTest(this._alphaTestSubMeshes); + var a = r.getStencilBuffer(); + if ( + (r.setStencilBuffer(false), + t && this._renderSprites(), + i && this._renderParticles(n), + this.onBeforeTransparentRendering && + this.onBeforeTransparentRendering(), + 0 !== this._transparentSubMeshes.length && + (this._renderTransparent( + this._transparentSubMeshes + ), r.setAlphaMode(o.a.ALPHA_DISABLE)), - r.setStencilBuffer(false), - this._edgesRenderers.length) { - for (var s = 0; s < this._edgesRenderers.length; s++) - this._edgesRenderers.data[s].render(); - r.setAlphaMode(o.a.ALPHA_DISABLE) - } - r.setStencilBuffer(a) + r.setStencilBuffer(false), + this._edgesRenderers.length) + ) { + for (var s = 0; s < this._edgesRenderers.length; s++) + this._edgesRenderers.data[s].render(); + r.setAlphaMode(o.a.ALPHA_DISABLE); } - } - , - e.prototype.renderOpaqueSorted = function(t) { - return e.renderSorted(t, this._opaqueSortCompareFn, this._scene.activeCamera, false) - } - , - e.prototype.renderAlphaTestSorted = function(t) { - return e.renderSorted(t, this._alphaTestSortCompareFn, this._scene.activeCamera, false) - } - , - e.prototype.renderTransparentSorted = function(t) { - return e.renderSorted(t, this._transparentSortCompareFn, this._scene.activeCamera, true) - } - , - e.renderSorted = function(e, t, i, n) { - for (var a, s = 0, c = i ? i.globalPosition : r.x.Zero(); s < e.length; s++) - (a = e.data[s])._alphaIndex = a.getMesh().alphaIndex, - a._distanceToCamera = a.getBoundingInfo().boundingSphere.centerWorld.subtract(c).length(); - var u = e.data.slice(0, e.length); - for (t && u.sort(t), - s = 0; s < u.length; s++) { - if (a = u[s], - n) { - var l = a.getMaterial(); - if (l && l.needDepthPrePass) { - var h = l.getScene().getEngine(); - h.setColorWrite(false), - h.setAlphaMode(o.a.ALPHA_DISABLE), - a.render(false), - h.setColorWrite(true) - } - } - a.render(n) + r.setStencilBuffer(a); + } + }), + (e.prototype.renderOpaqueSorted = function (t) { + return e.renderSorted( + t, + this._opaqueSortCompareFn, + this._scene.activeCamera, + false + ); + }), + (e.prototype.renderAlphaTestSorted = function (t) { + return e.renderSorted( + t, + this._alphaTestSortCompareFn, + this._scene.activeCamera, + false + ); + }), + (e.prototype.renderTransparentSorted = function (t) { + return e.renderSorted( + t, + this._transparentSortCompareFn, + this._scene.activeCamera, + true + ); + }), + (e.renderSorted = function (e, t, i, n) { + for ( + var a, s = 0, c = i ? i.globalPosition : r.x.Zero(); + s < e.length; + s++ + ) + ((a = e.data[s])._alphaIndex = a.getMesh().alphaIndex), + (a._distanceToCamera = a + .getBoundingInfo() + .boundingSphere.centerWorld.subtract(c) + .length()); + var u = e.data.slice(0, e.length); + for (t && u.sort(t), s = 0; s < u.length; s++) { + if (((a = u[s]), n)) { + var l = a.getMaterial(); + if (l && l.needDepthPrePass) { + var h = l.getScene().getEngine(); + h.setColorWrite(false), + h.setAlphaMode(o.a.ALPHA_DISABLE), + a.render(false), + h.setColorWrite(true); + } } - } - , - e.renderUnsorted = function(e) { - for (var t = 0; t < e.length; t++) - e.data[t].render(false) - } - , - e.defaultTransparentSortCompare = function(t, i) { - return t._alphaIndex > i._alphaIndex ? 1 : t._alphaIndex < i._alphaIndex ? -1 : e.backToFrontSortCompare(t, i) - } - , - e.backToFrontSortCompare = function(e, t) { - return e._distanceToCamera < t._distanceToCamera ? 1 : e._distanceToCamera > t._distanceToCamera ? -1 : 0 - } - , - e.frontToBackSortCompare = function(e, t) { - return e._distanceToCamera < t._distanceToCamera ? -1 : e._distanceToCamera > t._distanceToCamera ? 1 : 0 - } - , - e.prototype.prepare = function() { - this._opaqueSubMeshes.reset(), + a.render(n); + } + }), + (e.renderUnsorted = function (e) { + for (var t = 0; t < e.length; t++) + e.data[t].render(false); + }), + (e.defaultTransparentSortCompare = function (t, i) { + return t._alphaIndex > i._alphaIndex + ? 1 + : t._alphaIndex < i._alphaIndex + ? -1 + : e.backToFrontSortCompare(t, i); + }), + (e.backToFrontSortCompare = function (e, t) { + return e._distanceToCamera < t._distanceToCamera + ? 1 + : e._distanceToCamera > t._distanceToCamera + ? -1 + : 0; + }), + (e.frontToBackSortCompare = function (e, t) { + return e._distanceToCamera < t._distanceToCamera + ? -1 + : e._distanceToCamera > t._distanceToCamera + ? 1 + : 0; + }), + (e.prototype.prepare = function () { + this._opaqueSubMeshes.reset(), this._transparentSubMeshes.reset(), this._alphaTestSubMeshes.reset(), this._depthOnlySubMeshes.reset(), this._particleSystems.reset(), this._spriteManagers.reset(), - this._edgesRenderers.reset() - } - , - e.prototype.dispose = function() { - this._opaqueSubMeshes.dispose(), + this._edgesRenderers.reset(); + }), + (e.prototype.dispose = function () { + this._opaqueSubMeshes.dispose(), this._transparentSubMeshes.dispose(), this._alphaTestSubMeshes.dispose(), this._depthOnlySubMeshes.dispose(), this._particleSystems.dispose(), this._spriteManagers.dispose(), - this._edgesRenderers.dispose() - } - , - e.prototype.dispatch = function(e, t, i) { - void 0 === t && (t = e.getMesh()), + this._edgesRenderers.dispose(); + }), + (e.prototype.dispatch = function (e, t, i) { + void 0 === t && (t = e.getMesh()), void 0 === i && (i = e.getMaterial()), - null != i && (i.needAlphaBlendingForMesh(t) ? this._transparentSubMeshes.push(e) : i.needAlphaTesting() ? (i.needDepthPrePass && this._depthOnlySubMeshes.push(e), - this._alphaTestSubMeshes.push(e)) : (i.needDepthPrePass && this._depthOnlySubMeshes.push(e), - this._opaqueSubMeshes.push(e)), - t._renderingGroup = this, - t._edgesRenderer && t._edgesRenderer.isEnabled && this._edgesRenderers.push(t._edgesRenderer)) - } - , - e.prototype.dispatchSprites = function(e) { - this._spriteManagers.push(e) - } - , - e.prototype.dispatchParticles = function(e) { - this._particleSystems.push(e) - } - , - e.prototype._renderParticles = function(e) { - if (0 !== this._particleSystems.length) { - var t = this._scene.activeCamera; - this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene); - for (var i = 0; i < this._particleSystems.length; i++) { - var n = this._particleSystems.data[i]; - if (0 !== (t && t.layerMask & n.layerMask)) { - var r = n.emitter; - r.position && e && -1 === e.indexOf(r) || this._scene._activeParticles.addCount(n.render(), false) - } - } - this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene) + null != i && + (i.needAlphaBlendingForMesh(t) + ? this._transparentSubMeshes.push(e) + : i.needAlphaTesting() + ? (i.needDepthPrePass && + this._depthOnlySubMeshes.push(e), + this._alphaTestSubMeshes.push(e)) + : (i.needDepthPrePass && + this._depthOnlySubMeshes.push(e), + this._opaqueSubMeshes.push(e)), + (t._renderingGroup = this), + t._edgesRenderer && + t._edgesRenderer.isEnabled && + this._edgesRenderers.push(t._edgesRenderer)); + }), + (e.prototype.dispatchSprites = function (e) { + this._spriteManagers.push(e); + }), + (e.prototype.dispatchParticles = function (e) { + this._particleSystems.push(e); + }), + (e.prototype._renderParticles = function (e) { + if (0 !== this._particleSystems.length) { + var t = this._scene.activeCamera; + this._scene.onBeforeParticlesRenderingObservable.notifyObservers( + this._scene + ); + for (var i = 0; i < this._particleSystems.length; i++) { + var n = this._particleSystems.data[i]; + if (0 !== (t && t.layerMask & n.layerMask)) { + var r = n.emitter; + (r.position && e && -1 === e.indexOf(r)) || + this._scene._activeParticles.addCount( + n.render(), + false + ); + } } - } - , - e.prototype._renderSprites = function() { - if (this._scene.spritesEnabled && 0 !== this._spriteManagers.length) { - var e = this._scene.activeCamera; - this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene); - for (var t = 0; t < this._spriteManagers.length; t++) { - var i = this._spriteManagers.data[t]; - 0 !== (e && e.layerMask & i.layerMask) && i.render() - } - this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene) + this._scene.onAfterParticlesRenderingObservable.notifyObservers( + this._scene + ); + } + }), + (e.prototype._renderSprites = function () { + if ( + this._scene.spritesEnabled && + 0 !== this._spriteManagers.length + ) { + var e = this._scene.activeCamera; + this._scene.onBeforeSpritesRenderingObservable.notifyObservers( + this._scene + ); + for (var t = 0; t < this._spriteManagers.length; t++) { + var i = this._spriteManagers.data[t]; + 0 !== (e && e.layerMask & i.layerMask) && i.render(); } - } - , + this._scene.onAfterSpritesRenderingObservable.notifyObservers( + this._scene + ); + } + }), e - }() - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return n - }); - var n = function(e, t) { - this.distance = e, - this.mesh = t + ); + })(); + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return n; + }); + var n = function (e, t) { + (this.distance = e), (this.mesh = t); + }; + }, + function (e, t, i) { + "use strict"; + i.d(t, "a", function () { + return l; + }); + var n = i(1), + r = i(0), + o = i(6), + a = i(24), + s = i(11), + c = i(32), + u = i(42); + s.a._instancedMeshFactory = function (e, t) { + return new l(e, t); + }; + var l = (function (e) { + function t(t, i) { + var n = e.call(this, t, i.getScene()) || this; + return ( + (n._indexInSourceMeshInstanceArray = -1), + i.addInstance(n), + (n._sourceMesh = i), + n.position.copyFrom(i.position), + n.rotation.copyFrom(i.rotation), + n.scaling.copyFrom(i.scaling), + i.rotationQuaternion && + (n.rotationQuaternion = i.rotationQuaternion.clone()), + (n.infiniteDistance = i.infiniteDistance), + n.setPivotMatrix(i.getPivotMatrix()), + n.refreshBoundingInfo(), + n._syncSubMeshes(), + n + ); } - } - , function(e, t, i) { - "use strict"; - i.d(t, "a", function() { - return l - }); - var n = i(1) - , r = i(0) - , o = i(6) - , a = i(24) - , s = i(11) - , c = i(32) - , u = i(42); - s.a._instancedMeshFactory = function(e, t) { - return new l(e,t) - } - ; - var l = function(e) { - function t(t, i) { - var n = e.call(this, t, i.getScene()) || this; - return n._indexInSourceMeshInstanceArray = -1, - i.addInstance(n), - n._sourceMesh = i, - n.position.copyFrom(i.position), - n.rotation.copyFrom(i.rotation), - n.scaling.copyFrom(i.scaling), - i.rotationQuaternion && (n.rotationQuaternion = i.rotationQuaternion.clone()), - n.infiniteDistance = i.infiniteDistance, - n.setPivotMatrix(i.getPivotMatrix()), - n.refreshBoundingInfo(), - n._syncSubMeshes(), + return ( + n.d(t, e), + (t.prototype.getClassName = function () { + return "InstancedMesh"; + }), + Object.defineProperty(t.prototype, "lightSources", { + get: function () { + return this._sourceMesh._lightSources; + }, + enumerable: true, + configurable: true, + }), + (t.prototype._resyncLightSources = function () {}), + (t.prototype._resyncLighSource = function (e) {}), + (t.prototype._removeLightSource = function (e) {}), + Object.defineProperty(t.prototype, "receiveShadows", { + get: function () { + return this._sourceMesh.receiveShadows; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "material", { + get: function () { + return this._sourceMesh.material; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "visibility", { + get: function () { + return this._sourceMesh.visibility; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "skeleton", { + get: function () { + return this._sourceMesh.skeleton; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(t.prototype, "renderingGroupId", { + get: function () { + return this._sourceMesh.renderingGroupId; + }, + set: function (e) { + this._sourceMesh && + e !== this._sourceMesh.renderingGroupId && + o.a.Warn( + "Note - setting renderingGroupId of an instanced mesh has no effect on the scene" + ); + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getTotalVertices = function () { + return this._sourceMesh.getTotalVertices(); + }), + (t.prototype.getTotalIndices = function () { + return this._sourceMesh.getTotalIndices(); + }), + Object.defineProperty(t.prototype, "sourceMesh", { + get: function () { + return this._sourceMesh; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.isReady = function (e) { + return ( + void 0 === e && (e = false), + this._sourceMesh.isReady(e, true) + ); + }), + (t.prototype.getVerticesData = function (e, t) { + return this._sourceMesh.getVerticesData(e, t); + }), + (t.prototype.setVerticesData = function (e, t, i, n) { + return ( + this.sourceMesh && + this.sourceMesh.setVerticesData(e, t, i, n), + this.sourceMesh + ); + }), + (t.prototype.updateVerticesData = function (e, t, i, n) { + return ( + this.sourceMesh && + this.sourceMesh.updateVerticesData(e, t, i, n), + this.sourceMesh + ); + }), + (t.prototype.setIndices = function (e, t) { + return ( + void 0 === t && (t = null), + this.sourceMesh && this.sourceMesh.setIndices(e, t), + this.sourceMesh + ); + }), + (t.prototype.isVerticesDataPresent = function (e) { + return this._sourceMesh.isVerticesDataPresent(e); + }), + (t.prototype.getIndices = function () { + return this._sourceMesh.getIndices(); + }), + Object.defineProperty(t.prototype, "_positions", { + get: function () { + return this._sourceMesh._positions; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.refreshBoundingInfo = function (e) { + if ( + (void 0 === e && (e = false), + this._boundingInfo && this._boundingInfo.isLocked) + ) + return this; + var t = this._sourceMesh.geometry + ? this._sourceMesh.geometry.boundingBias + : null; + return ( + this._refreshBoundingInfo( + this._sourceMesh._getPositionData(e), + t + ), + this + ); + }), + (t.prototype._preActivate = function () { + return ( + this._currentLOD && this._currentLOD._preActivate(), this + ); + }), + (t.prototype._activate = function (e, t) { + if ( + (this._currentLOD && + this._currentLOD._registerInstanceForRenderId(this, e), + t) + ) { + if ( + !this._currentLOD._internalAbstractMeshDataInfo + ._isActiveIntermediate + ) + return ( + (this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = true), + true + ); + } else if ( + !this._currentLOD._internalAbstractMeshDataInfo._isActive + ) + return ( + (this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = true), + true + ); + return false; + }), + (t.prototype._postActivate = function () { + this._edgesRenderer && + this._edgesRenderer.isEnabled && + this._sourceMesh._renderingGroup && + this._sourceMesh._renderingGroup._edgesRenderers.push( + this._edgesRenderer + ); + }), + (t.prototype.getWorldMatrix = function () { + if ( + this._currentLOD && + this._currentLOD.billboardMode !== + u.a.BILLBOARDMODE_NONE && + this._currentLOD._masterMesh !== this + ) { + var t = this._currentLOD._masterMesh; + return ( + (this._currentLOD._masterMesh = this), + r.t.Matrix[0].copyFrom( + this._currentLOD.computeWorldMatrix(true) + ), + (this._currentLOD._masterMesh = t), + r.t.Matrix[0] + ); + } + return e.prototype.getWorldMatrix.call(this); + }), + Object.defineProperty(t.prototype, "isAnInstance", { + get: function () { + return true; + }, + enumerable: true, + configurable: true, + }), + (t.prototype.getLOD = function (e) { + if (!e) return this; + var t = this.getBoundingInfo(); + return ( + (this._currentLOD = this.sourceMesh.getLOD( + e, + t.boundingSphere + )), + this._currentLOD === this.sourceMesh + ? this.sourceMesh + : this._currentLOD + ); + }), + (t.prototype._syncSubMeshes = function () { + if ((this.releaseSubMeshes(), this._sourceMesh.subMeshes)) + for ( + var e = 0; + e < this._sourceMesh.subMeshes.length; + e++ + ) + this._sourceMesh.subMeshes[e].clone( + this, + this._sourceMesh + ); + return this; + }), + (t.prototype._generatePointsArray = function () { + return this._sourceMesh._generatePointsArray(); + }), + (t.prototype.clone = function (e, t, i) { + var n = this._sourceMesh.createInstance(e); + if ( + (c.a.DeepCopy( + this, + n, + ["name", "subMeshes", "uniqueId"], + [] + ), + this.refreshBoundingInfo(), + t && (n.parent = t), + !i) + ) + for (var r = 0; r < this.getScene().meshes.length; r++) { + var o = this.getScene().meshes[r]; + o.parent === this && o.clone(o.name, n); + } + return n.computeWorldMatrix(true), n; + }), + (t.prototype.dispose = function (t, i) { + void 0 === i && (i = false), + this._sourceMesh.removeInstance(this), + e.prototype.dispose.call(this, t, i); + }), + t + ); + })(a.a); + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.shadowsFragmentFunctions = + "#ifdef SHADOWS\n#ifndef SHADOWFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.0,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nif (depth>shadow)\n{\nreturn darkness;\n}\nreturn 1.0;\n}\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadow=texture2D(shadowSampler,uv).x;\n#endif\nif (shadowPixelDepth>shadow)\n{\nreturn computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff);\n}\nreturn 1.;\n}\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\n#ifndef SHADOWFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n#ifdef WEBGL2\n\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat shadow=texture2D(shadowSampler,uvDepth);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);\nconst vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n\n\n\n\n\nfloat computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\n\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn textureColor;\n}"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.bumpFragmentFunctions = + "#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#endif\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv,sampler2D textureSampler,float scale)\n{\nvec3 map=texture2D(textureSampler,uv).xyz;\nmap=map*2.0-1.0;\n#ifdef NORMALXYSCALE\nmap=normalize(map*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*map);\n}\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{\n\nuv=gl_FrontFacing ? uv : -uv;\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\n\ntangent*=tangentSpaceParams.x;\nbitangent*=tangentSpaceParams.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\n#endif\n#ifdef BUMP\n#if BUMPDIRECTUV == 1\n#define vBumpUV vMainUV1\n#elif BUMPDIRECTUV == 2\n#define vBumpUV vMainUV2\n#else\nvarying vec2 vBumpUV;\n#endif\nuniform sampler2D bumpSampler;\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\n{\nreturn perturbNormal(cotangentFrame,uv,bumpSampler,vBumpInfos.y);\n}\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\nreturn cotangent_frame(normal,p,uv,vTangentSpaceParams);\n}\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\n\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\n\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; icurrRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\n\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\n\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.bumpFragment = + "vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#else\nfloat normalScale=vBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nmat3 TBN=cotangent_frame(normalW,vPositionW,vMainUV1,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\nnormalW=normalize(mat3(normalMatrix)*normalW);\n#else\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\n#endif\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.depthPrePass = + "#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.bumpVertexDeclaration = + "#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP)\n#if defined(TANGENT) && defined(NORMAL)\nvarying mat3 vTBN;\n#endif\n#endif\n"; + }, + function (e, t, i) { + "use strict"; + i(5).a.IncludesShadersStore.bumpVertex = + "#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif"; + }, + function (e, t, i) { + "use strict"; + var n = i(5), + r = (i(95), i(89), "colorPixelShader"); + n.a.ShadersStore[r] = + "#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#else\nuniform vec4 color;\n#endif\n#include\nvoid main(void) {\n#include\n#ifdef VERTEXCOLOR\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n}"; + }, + function (e, t, i) { + "use strict"; + var n = i(5), + r = + (i(67), + i(96), + i(68), + i(69), + i(70), + i(90), + "colorVertexShader"); + n.a.ShadersStore[r] = + "\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\nuniform mat4 viewProjection;\n\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\n#include\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n}"; + }, + function (e, t, i) { + "use strict"; + (function (e) { + i.d(t, "b", function () { + return h; + }), + i.d(t, "a", function () { + return f; + }); + var n = i(1), + r = i(6), + o = i(10), + a = i(92), + s = i(26), + u = i(3), + l = i(78), + h = function () { + (this.renderWidth = 512), + (this.renderHeight = 256), + (this.textureSize = 512), + (this.deterministicLockstep = false), + (this.lockstepMaxSteps = 4); + }, + f = (function (t) { + function i(i) { + void 0 === i && (i = new h()); + var n = t.call(this, null) || this; + void 0 === i.deterministicLockstep && + (i.deterministicLockstep = false), + void 0 === i.lockstepMaxSteps && + (i.lockstepMaxSteps = 4), + (n._options = i), + (n._caps = new o.c()), + (n._caps.maxTexturesImageUnits = 16), + (n._caps.maxVertexTextureImageUnits = 16), + (n._caps.maxTextureSize = 512), + (n._caps.maxCubemapTextureSize = 512), + (n._caps.maxRenderTextureSize = 512), + (n._caps.maxVertexAttribs = 16), + (n._caps.maxVaryingVectors = 16), + (n._caps.maxFragmentUniformVectors = 16), + (n._caps.maxVertexUniformVectors = 16), + (n._caps.standardDerivatives = false), + (n._caps.astc = null), + (n._caps.s3tc = null), + (n._caps.pvrtc = null), + (n._caps.etc1 = null), + (n._caps.etc2 = null), + (n._caps.textureAnisotropicFilterExtension = null), + (n._caps.maxAnisotropy = 0), + (n._caps.uintIndices = false), + (n._caps.fragmentDepthSupported = false), + (n._caps.highPrecisionShaderSupported = true), + (n._caps.colorBufferFloat = false), + (n._caps.textureFloat = false), + (n._caps.textureFloatLinearFiltering = false), + (n._caps.textureFloatRender = false), + (n._caps.textureHalfFloat = false), + (n._caps.textureHalfFloatLinearFiltering = false), + (n._caps.textureHalfFloatRender = false), + (n._caps.textureLOD = false), + (n._caps.drawBuffersExtension = false), + (n._caps.depthTextureExtension = false), + (n._caps.vertexArrayObject = false), + (n._caps.instancedArrays = false), + r.a.Log( + "Babylon.js v" + o.b.Version + " - Null engine" + ); + var a = + "undefined" != typeof self + ? self + : void 0 !== e + ? e + : window; + return ( + "undefined" == typeof URL && + (a.URL = { + createObjectURL: function () {}, + revokeObjectURL: function () {}, + }), + "undefined" == typeof Blob && (a.Blob = function () {}), n + ); } - return n.d(t, e), - t.prototype.getClassName = function() { - return "InstancedMesh" - } - , - Object.defineProperty(t.prototype, "lightSources", { - get: function() { - return this._sourceMesh._lightSources - }, - enumerable: true, - configurable: true - }), - t.prototype._resyncLightSources = function() {} - , - t.prototype._resyncLighSource = function(e) {} - , - t.prototype._removeLightSource = function(e) {} - , - Object.defineProperty(t.prototype, "receiveShadows", { - get: function() { - return this._sourceMesh.receiveShadows - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "material", { - get: function() { - return this._sourceMesh.material - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "visibility", { - get: function() { - return this._sourceMesh.visibility - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "skeleton", { - get: function() { - return this._sourceMesh.skeleton - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(t.prototype, "renderingGroupId", { - get: function() { - return this._sourceMesh.renderingGroupId - }, - set: function(e) { - this._sourceMesh && e !== this._sourceMesh.renderingGroupId && o.a.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene") - }, - enumerable: true, - configurable: true - }), - t.prototype.getTotalVertices = function() { - return this._sourceMesh.getTotalVertices() - } - , - t.prototype.getTotalIndices = function() { - return this._sourceMesh.getTotalIndices() - } - , - Object.defineProperty(t.prototype, "sourceMesh", { - get: function() { - return this._sourceMesh - }, - enumerable: true, - configurable: true - }), - t.prototype.isReady = function(e) { - return void 0 === e && (e = false), - this._sourceMesh.isReady(e, true) - } - , - t.prototype.getVerticesData = function(e, t) { - return this._sourceMesh.getVerticesData(e, t) - } - , - t.prototype.setVerticesData = function(e, t, i, n) { - return this.sourceMesh && this.sourceMesh.setVerticesData(e, t, i, n), - this.sourceMesh - } - , - t.prototype.updateVerticesData = function(e, t, i, n) { - return this.sourceMesh && this.sourceMesh.updateVerticesData(e, t, i, n), - this.sourceMesh - } - , - t.prototype.setIndices = function(e, t) { - return void 0 === t && (t = null), - this.sourceMesh && this.sourceMesh.setIndices(e, t), - this.sourceMesh - } - , - t.prototype.isVerticesDataPresent = function(e) { - return this._sourceMesh.isVerticesDataPresent(e) - } - , - t.prototype.getIndices = function() { - return this._sourceMesh.getIndices() - } - , - Object.defineProperty(t.prototype, "_positions", { - get: function() { - return this._sourceMesh._positions - }, - enumerable: true, - configurable: true - }), - t.prototype.refreshBoundingInfo = function(e) { - if (void 0 === e && (e = false), - this._boundingInfo && this._boundingInfo.isLocked) - return this; - var t = this._sourceMesh.geometry ? this._sourceMesh.geometry.boundingBias : null; - return this._refreshBoundingInfo(this._sourceMesh._getPositionData(e), t), - this - } - , - t.prototype._preActivate = function() { - return this._currentLOD && this._currentLOD._preActivate(), - this - } - , - t.prototype._activate = function(e, t) { - if (this._currentLOD && this._currentLOD._registerInstanceForRenderId(this, e), - t) { - if (!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate) - return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = true, - true - } else if (!this._currentLOD._internalAbstractMeshDataInfo._isActive) - return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = true, - true; - return false - } - , - t.prototype._postActivate = function() { - this._edgesRenderer && this._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup && this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer) - } - , - t.prototype.getWorldMatrix = function() { - if (this._currentLOD && this._currentLOD.billboardMode !== u.a.BILLBOARDMODE_NONE && this._currentLOD._masterMesh !== this) { - var t = this._currentLOD._masterMesh; - return this._currentLOD._masterMesh = this, - r.t.Matrix[0].copyFrom(this._currentLOD.computeWorldMatrix(true)), - this._currentLOD._masterMesh = t, - r.t.Matrix[0] - } - return e.prototype.getWorldMatrix.call(this) - } - , - Object.defineProperty(t.prototype, "isAnInstance", { - get: function() { - return true - }, - enumerable: true, - configurable: true - }), - t.prototype.getLOD = function(e) { - if (!e) - return this; - var t = this.getBoundingInfo(); - return this._currentLOD = this.sourceMesh.getLOD(e, t.boundingSphere), - this._currentLOD === this.sourceMesh ? this.sourceMesh : this._currentLOD - } - , - t.prototype._syncSubMeshes = function() { - if (this.releaseSubMeshes(), - this._sourceMesh.subMeshes) - for (var e = 0; e < this._sourceMesh.subMeshes.length; e++) - this._sourceMesh.subMeshes[e].clone(this, this._sourceMesh); - return this - } - , - t.prototype._generatePointsArray = function() { - return this._sourceMesh._generatePointsArray() - } - , - t.prototype.clone = function(e, t, i) { - var n = this._sourceMesh.createInstance(e); - if (c.a.DeepCopy(this, n, ["name", "subMeshes", "uniqueId"], []), - this.refreshBoundingInfo(), - t && (n.parent = t), - !i) - for (var r = 0; r < this.getScene().meshes.length; r++) { - var o = this.getScene().meshes[r]; - o.parent === this && o.clone(o.name, n) - } - return n.computeWorldMatrix(true), - n - } - , - t.prototype.dispose = function(t, i) { - void 0 === i && (i = false), - this._sourceMesh.removeInstance(this), - e.prototype.dispose.call(this, t, i) - } - , - t - }(a.a) - } - , function(e, t, i) { - "use strict"; - i(5).a.IncludesShadersStore.shadowsFragmentFunctions = "#ifdef SHADOWS\n#ifndef SHADOWFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.0,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nif (depth>shadow)\n{\nreturn darkness;\n}\nreturn 1.0;\n}\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadow=texture2D(shadowSampler,uv).x;\n#endif\nif (shadowPixelDepth>shadow)\n{\nreturn computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff);\n}\nreturn 1.;\n}\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\n#ifndef SHADOWFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n#ifdef WEBGL2\n\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat shadow=texture2D(shadowSampler,uvDepth);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);\nconst vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n\n\n\n\n\nfloat computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i= e.worldSize - 1 || n.position[2] < 0 || n.position[2] >= e.worldSize - 1) && (e.targetedBlock = null), - 10 != n.blockID || e.addMode || (e.targetedBlock = null) - } else - e.targetedBlock = null; - t != T && (e.emit("targetBlockChanged", e.targetedBlock), - T = t) - }(this), - A("targets"), - this.emit("tick", e), - A("tick content"), - A("end"), - this.entities.tick()) : this.rendering.tick(e) + (n.blockID = e.world.getBlockID( + n.position[0], + n.position[1], + n.position[2] + )), + (t += "|" + i.blockID), + (e.targetedBlock = n), + (n.position[0] < 0 || + n.position[0] >= e.worldSize - 1 || + n.position[2] < 0 || + n.position[2] >= e.worldSize - 1) && + (e.targetedBlock = null), + 10 != n.blockID || e.addMode || (e.targetedBlock = null); + } else e.targetedBlock = null; + t != T && + (e.emit("targetBlockChanged", e.targetedBlock), (T = t)); + })(this), + A("targets"), + this.emit("tick", e), + A("tick content"), + A("end"), + this.entities.tick()) + : this.rendering.tick(e); } - } - ; - _.prototype.render = function(e) { - if (!this._paused) { - x("start"); - var t = e * this._tickRate; - (this.container.hasPointerLock || !this.container.supportsPointerLock || this._dragOutsideLock && this.inputs.state.fire) && this.cameraControls.updateForRender(), - this.emit("beforeRender", t), - x("before render"), - this.rendering.render(t), - x("render"), - this.emit("afterRender", t), - x("after render"), - x("end") - } - } - , - _.prototype.setPaused = function(e) { - this._paused = !!e, - e || (this.inputs.state.dx = this.inputs.state.dy = 0) - } - , - _.prototype.getBlock = function(e, t, i) { - return e.length ? this.world.getBlockID(e[0], e[1], e[2]) : this.world.getBlockID(e, t, i) - } - , - _.prototype.setBlock = function(e, t, i, n) { - return t.length ? this.world.setBlockID(e, t[0], t[1], t[2]) : this.world.setBlockID(e, t, i, n) - } - , - _.prototype.addBlock = function(e, t, i, n) { - return t.length ? (!this.entities.isTerrainBlocked(t[0], t[1], t[2]) || 7 == e || 17 == e || !i) && (this.world.setBlockID(e, t[0], t[1], t[2]), - true) : (!this.entities.isTerrainBlocked(t, i, n) || 7 == e || 17 == e) && (this.world.setBlockID(e, t, i, n), - true) - } - , - _.prototype.getPlayerPosition = function() { - return this.entities.getPosition(this.playerEntity) - } - , - _.prototype.getPlayerMesh = function() { - return this.entities.getMeshData(this.playerEntity).mesh - } - , - _.prototype.setPlayerEyeOffset = function(e) { - this.playerEyeOffset = e, - this.ents.getState(this.rendering.cameraTarget, this.ents.names.followsEntity).offset[1] = e - } - , - _.prototype.getPlayerEyePosition = function() { + }); + (_.prototype.render = function (e) { + if (!this._paused) { + x("start"); + var t = e * this._tickRate; + (this.container.hasPointerLock || + !this.container.supportsPointerLock || + (this._dragOutsideLock && this.inputs.state.fire)) && + this.cameraControls.updateForRender(), + this.emit("beforeRender", t), + x("before render"), + this.rendering.render(t), + x("render"), + this.emit("afterRender", t), + x("after render"), + x("end"); + } + }), + (_.prototype.setPaused = function (e) { + (this._paused = !!e), + e || (this.inputs.state.dx = this.inputs.state.dy = 0); + }), + (_.prototype.getBlock = function (e, t, i) { + return e.length + ? this.world.getBlockID(e[0], e[1], e[2]) + : this.world.getBlockID(e, t, i); + }), + (_.prototype.setBlock = function (e, t, i, n) { + return t.length + ? this.world.setBlockID(e, t[0], t[1], t[2]) + : this.world.setBlockID(e, t, i, n); + }), + (_.prototype.addBlock = function (e, t, i, n) { + return t.length + ? (!this.entities.isTerrainBlocked(t[0], t[1], t[2]) || + 7 == e || + 17 == e || + !i) && + (this.world.setBlockID(e, t[0], t[1], t[2]), true) + : (!this.entities.isTerrainBlocked(t, i, n) || 7 == e || 17 == e) && + (this.world.setBlockID(e, t, i, n), true); + }), + (_.prototype.getPlayerPosition = function () { + return this.entities.getPosition(this.playerEntity); + }), + (_.prototype.getPlayerMesh = function () { + return this.entities.getMeshData(this.playerEntity).mesh; + }), + (_.prototype.setPlayerEyeOffset = function (e) { + (this.playerEyeOffset = e), + (this.ents.getState( + this.rendering.cameraTarget, + this.ents.names.followsEntity + ).offset[1] = e); + }), + (_.prototype.getPlayerEyePosition = function () { var e = this.entities.getPosition(this.playerEntity); - return vec3Math.copy(v, e), - v[1] += this.playerEyeOffset, - v - } - ; + return vec3Math.copy(v, e), (v[1] += this.playerEyeOffset), v; + }); var v = vec3Math.create(); - _.prototype.getCameraVector = function() { - var e = this.rendering.getCameraVector(); - return vec3Math.set(y, e.x, e.y, e.z), - y - } - ; + _.prototype.getCameraVector = function () { + var e = this.rendering.getCameraVector(); + return vec3Math.set(y, e.x, e.y, e.z), y; + }; var y = vec3Math.create(); - _.prototype.pick = function(e, t, i, n) { - if (0 === i) - return null; - e = e || this.getPlayerEyePosition(), - t = t || this.getCameraVector(), - i = i || this.blockTestDistance; - var r = b.position - , o = b.normal; - if (!(n ? this._traceWorldRayCollision(e, t, i, r, o) : this._traceWorldRay(e, t, i, r, o))) - return null; - for (var a = 0; a < 3; a++) - r[a] -= .01 * o[a]; - return b - } - ; + _.prototype.pick = function (e, t, i, n) { + if (0 === i) return null; + (e = e || this.getPlayerEyePosition()), + (t = t || this.getCameraVector()), + (i = i || this.blockTestDistance); + var r = b.position, + o = b.normal; + if ( + !(n + ? this._traceWorldRayCollision(e, t, i, r, o) + : this._traceWorldRay(e, t, i, r, o)) + ) + return null; + for (var a = 0; a < 3; a++) r[a] -= 0.01 * o[a]; + return b; + }; var b = { - position: vec3Math.create(), - normal: vec3Math.create() + position: vec3Math.create(), + normal: vec3Math.create(), }; var E = { blockID: 0, position: [], normal: [], - adjacent: [] - } - , T = ""; - _.prototype.resetTargetBlock = function() { - T = "" - } - ; - var A = function(e) {} - , x = function(e) {} -} -, function(exp, t) { // cloneVec3(vec3) i = 413 - exp.exports = function(oldVec3) { - var newVec3 = new Float32Array(3); - - newVec3[0] = oldVec3[0]; - newVec3[1] = oldVec3[1]; - newVec3[2] = oldVec3[2]; - - return newVec3 - } -} -, function(exp, t, getterFunc) { // angle i = 414 - exp.exports = function(vec3_0, vec3_1) { - var vec3_0_copy = createVec3Values(vec3_0[0], vec3_0[1], vec3_0[2]); - var vec3_1_copy = createVec3Values(vec3_1[0], vec3_1[1], vec3_1[2]); + adjacent: [], + }, + T = ""; + _.prototype.resetTargetBlock = function () { + T = ""; + }; + var A = function (e) {}, + x = function (e) {}; + }, + function (exp, t) { + // cloneVec3(vec3) i = 413 + exp.exports = function (oldVec3) { + var newVec3 = new Float32Array(3); - r(vec3_0_copy, vec3_0_copy); - r(vec3_1_copy, vec3_1_copy); + newVec3[0] = oldVec3[0]; + newVec3[1] = oldVec3[1]; + newVec3[2] = oldVec3[2]; - var s = multSum(vec3_0_copy, vec3_1_copy); - return s > 1 ? 0 : Math.acos(s) + return newVec3; + }; + }, + function (exp, t, getterFunc) { + // angle i = 414 + exp.exports = function (vec3_0, vec3_1) { + var vec3_0_copy = createVec3Values(vec3_0[0], vec3_0[1], vec3_0[2]); + var vec3_1_copy = createVec3Values(vec3_1[0], vec3_1[1], vec3_1[2]); + + r(vec3_0_copy, vec3_0_copy); + r(vec3_1_copy, vec3_1_copy); + + var s = multSum(vec3_0_copy, vec3_1_copy); + return s > 1 ? 0 : Math.acos(s); }; var createVec3Values = getterFunc(175); var r = getterFunc(176); var multSum = getterFunc(177); -} -, function(exp, t) { - exp.exports = function(e, t) { - e[0] = t[0]; - e[1] = t[1]; - e[2] = t[2]; - - return e - } -} -, function(e, t) { - e.exports = function(e, t, i, n) { - return e[0] = t, - e[1] = i, - e[2] = n, + }, + function (exp, t) { + exp.exports = function (e, t) { + e[0] = t[0]; + e[1] = t[1]; + e[2] = t[2]; + + return e; + }; + }, + function (e, t) { + e.exports = function (e, t, i, n) { + return (e[0] = t), (e[1] = i), (e[2] = n), e; + }; + }, + function (e, t, i) { + e.exports = function (e, t) { + var i = e[0], + r = e[1], + o = e[2], + a = t[0], + s = t[1], + c = t[2]; + return ( + Math.abs(i - a) <= n * Math.max(1, Math.abs(i), Math.abs(a)) && + Math.abs(r - s) <= n * Math.max(1, Math.abs(r), Math.abs(s)) && + Math.abs(o - c) <= n * Math.max(1, Math.abs(o), Math.abs(c)) + ); + }; + var n = i(173); + }, + function (e, t) { + e.exports = function (e, t) { + return e[0] === t[0] && e[1] === t[1] && e[2] === t[2]; + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + return ( + (e[0] = t[0] + i[0]), (e[1] = t[1] + i[1]), (e[2] = t[2] + i[2]), e + ); + }; + }, + function (e, t, i) { + e.exports = i(178); + }, + function (e, t, i) { + e.exports = i(179); + }, + function (e, t, i) { + e.exports = i(180); + }, + function (e, t) { + e.exports = function (e, t, i) { + return ( + (e[0] = Math.min(t[0], i[0])), + (e[1] = Math.min(t[1], i[1])), + (e[2] = Math.min(t[2], i[2])), e - } -} -, function(e, t, i) { - e.exports = function(e, t) { - var i = e[0] - , r = e[1] - , o = e[2] - , a = t[0] - , s = t[1] - , c = t[2]; - return Math.abs(i - a) <= n * Math.max(1, Math.abs(i), Math.abs(a)) && Math.abs(r - s) <= n * Math.max(1, Math.abs(r), Math.abs(s)) && Math.abs(o - c) <= n * Math.max(1, Math.abs(o), Math.abs(c)) - } - ; - var n = i(173) -} -, function(e, t) { - e.exports = function(e, t) { - return e[0] === t[0] && e[1] === t[1] && e[2] === t[2] - } -} -, function(e, t) { - e.exports = function(e, t, i) { - return e[0] = t[0] + i[0], - e[1] = t[1] + i[1], - e[2] = t[2] + i[2], + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + return ( + (e[0] = Math.max(t[0], i[0])), + (e[1] = Math.max(t[1], i[1])), + (e[2] = Math.max(t[2], i[2])), e - } -} -, function(e, t, i) { - e.exports = i(178) -} -, function(e, t, i) { - e.exports = i(179) -} -, function(e, t, i) { - e.exports = i(180) -} -, function(e, t) { - e.exports = function(e, t, i) { - return e[0] = Math.min(t[0], i[0]), - e[1] = Math.min(t[1], i[1]), - e[2] = Math.min(t[2], i[2]), + ); + }; + }, + function (e, t) { + e.exports = function (e, t) { + return ( + (e[0] = Math.floor(t[0])), + (e[1] = Math.floor(t[1])), + (e[2] = Math.floor(t[2])), e - } -} -, function(e, t) { - e.exports = function(e, t, i) { - return e[0] = Math.max(t[0], i[0]), - e[1] = Math.max(t[1], i[1]), - e[2] = Math.max(t[2], i[2]), + ); + }; + }, + function (e, t) { + e.exports = function (e, t) { + return ( + (e[0] = Math.ceil(t[0])), + (e[1] = Math.ceil(t[1])), + (e[2] = Math.ceil(t[2])), e - } -} -, function(e, t) { - e.exports = function(e, t) { - return e[0] = Math.floor(t[0]), - e[1] = Math.floor(t[1]), - e[2] = Math.floor(t[2]), + ); + }; + }, + function (e, t) { + e.exports = function (e, t) { + return ( + (e[0] = Math.round(t[0])), + (e[1] = Math.round(t[1])), + (e[2] = Math.round(t[2])), e - } -} -, function(e, t) { - e.exports = function(e, t) { - return e[0] = Math.ceil(t[0]), - e[1] = Math.ceil(t[1]), - e[2] = Math.ceil(t[2]), + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + return (e[0] = t[0] * i), (e[1] = t[1] * i), (e[2] = t[2] * i), e; + }; + }, + function (e, t) { + e.exports = function (e, t, i, n) { + return ( + (e[0] = t[0] + i[0] * n), + (e[1] = t[1] + i[1] * n), + (e[2] = t[2] + i[2] * n), e - } -} -, function(e, t) { - e.exports = function(e, t) { - return e[0] = Math.round(t[0]), - e[1] = Math.round(t[1]), - e[2] = Math.round(t[2]), + ); + }; + }, + function (e, t, i) { + e.exports = i(181); + }, + function (e, t, i) { + e.exports = i(182); + }, + function (e, t, i) { + e.exports = i(183); + }, + function (e, t, i) { + e.exports = i(184); + }, + function (e, t) { + e.exports = function (e, t) { + return (e[0] = -t[0]), (e[1] = -t[1]), (e[2] = -t[2]), e; + }; + }, + function (e, t) { + e.exports = function (e, t) { + return (e[0] = 1 / t[0]), (e[1] = 1 / t[1]), (e[2] = 1 / t[2]), e; + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + var n = t[0], + r = t[1], + o = t[2], + a = i[0], + s = i[1], + c = i[2]; + return ( + (e[0] = r * c - o * s), + (e[1] = o * a - n * c), + (e[2] = n * s - r * a), e - } -} -, function(e, t) { - e.exports = function(e, t, i) { - return e[0] = t[0] * i, - e[1] = t[1] * i, - e[2] = t[2] * i, + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i, n) { + var r = t[0], + o = t[1], + a = t[2]; + return ( + (e[0] = r + n * (i[0] - r)), + (e[1] = o + n * (i[1] - o)), + (e[2] = a + n * (i[2] - a)), e - } -} -, function(e, t) { - e.exports = function(e, t, i, n) { - return e[0] = t[0] + i[0] * n, - e[1] = t[1] + i[1] * n, - e[2] = t[2] + i[2] * n, + ); + }; + }, + function (e, t) { + e.exports = function (e, t) { + t = t || 1; + var i = 2 * Math.random() * Math.PI, + n = 2 * Math.random() - 1, + r = Math.sqrt(1 - n * n) * t; + return ( + (e[0] = Math.cos(i) * r), (e[1] = Math.sin(i) * r), (e[2] = n * t), e + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + var n = t[0], + r = t[1], + o = t[2], + a = i[3] * n + i[7] * r + i[11] * o + i[15]; + return ( + (a = a || 1), + (e[0] = (i[0] * n + i[4] * r + i[8] * o + i[12]) / a), + (e[1] = (i[1] * n + i[5] * r + i[9] * o + i[13]) / a), + (e[2] = (i[2] * n + i[6] * r + i[10] * o + i[14]) / a), e - } -} -, function(e, t, i) { - e.exports = i(181) -} -, function(e, t, i) { - e.exports = i(182) -} -, function(e, t, i) { - e.exports = i(183) -} -, function(e, t, i) { - e.exports = i(184) -} -, function(e, t) { - e.exports = function(e, t) { - return e[0] = -t[0], - e[1] = -t[1], - e[2] = -t[2], + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + var n = t[0], + r = t[1], + o = t[2]; + return ( + (e[0] = n * i[0] + r * i[3] + o * i[6]), + (e[1] = n * i[1] + r * i[4] + o * i[7]), + (e[2] = n * i[2] + r * i[5] + o * i[8]), e - } -} -, function(e, t) { - e.exports = function(e, t) { - return e[0] = 1 / t[0], - e[1] = 1 / t[1], - e[2] = 1 / t[2], + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i) { + var n = t[0], + r = t[1], + o = t[2], + a = i[0], + s = i[1], + c = i[2], + u = i[3], + l = u * n + s * o - c * r, + h = u * r + c * n - a * o, + f = u * o + a * r - s * n, + d = -a * n - s * r - c * o; + return ( + (e[0] = l * u + d * -a + h * -c - f * -s), + (e[1] = h * u + d * -s + f * -a - l * -c), + (e[2] = f * u + d * -c + l * -s - h * -a), e - } -} -, function(e, t) { - e.exports = function(e, t, i) { - var n = t[0] - , r = t[1] - , o = t[2] - , a = i[0] - , s = i[1] - , c = i[2]; - return e[0] = r * c - o * s, - e[1] = o * a - n * c, - e[2] = n * s - r * a, - e - } -} -, function(e, t) { - e.exports = function(e, t, i, n) { - var r = t[0] - , o = t[1] - , a = t[2]; - return e[0] = r + n * (i[0] - r), - e[1] = o + n * (i[1] - o), - e[2] = a + n * (i[2] - a), - e - } -} -, function(e, t) { - e.exports = function(e, t) { - t = t || 1; - var i = 2 * Math.random() * Math.PI - , n = 2 * Math.random() - 1 - , r = Math.sqrt(1 - n * n) * t; - return e[0] = Math.cos(i) * r, - e[1] = Math.sin(i) * r, - e[2] = n * t, - e - } -} -, function(e, t) { - e.exports = function(e, t, i) { - var n = t[0] - , r = t[1] - , o = t[2] - , a = i[3] * n + i[7] * r + i[11] * o + i[15]; - return a = a || 1, - e[0] = (i[0] * n + i[4] * r + i[8] * o + i[12]) / a, - e[1] = (i[1] * n + i[5] * r + i[9] * o + i[13]) / a, - e[2] = (i[2] * n + i[6] * r + i[10] * o + i[14]) / a, - e - } -} -, function(e, t) { - e.exports = function(e, t, i) { - var n = t[0] - , r = t[1] - , o = t[2]; - return e[0] = n * i[0] + r * i[3] + o * i[6], - e[1] = n * i[1] + r * i[4] + o * i[7], - e[2] = n * i[2] + r * i[5] + o * i[8], - e - } -} -, function(e, t) { - e.exports = function(e, t, i) { - var n = t[0] - , r = t[1] - , o = t[2] - , a = i[0] - , s = i[1] - , c = i[2] - , u = i[3] - , l = u * n + s * o - c * r - , h = u * r + c * n - a * o - , f = u * o + a * r - s * n - , d = -a * n - s * r - c * o; - return e[0] = l * u + d * -a + h * -c - f * -s, - e[1] = h * u + d * -s + f * -a - l * -c, - e[2] = f * u + d * -c + l * -s - h * -a, - e - } -} -, function(e, t) { - e.exports = function(e, t, i, n) { - var r = i[1] - , o = i[2] - , a = t[1] - r - , s = t[2] - o - , c = Math.sin(n) - , u = Math.cos(n); - return e[0] = t[0], - e[1] = r + a * u - s * c, - e[2] = o + a * c + s * u, - e - } -} -, function(e, t) { - e.exports = function(e, t, i, n) { - var r = i[0] - , o = i[2] - , a = t[0] - r - , s = t[2] - o - , c = Math.sin(n) - , u = Math.cos(n); - return e[0] = r + s * c + a * u, - e[1] = t[1], - e[2] = o + s * u - a * c, - e - } -} -, function(e, t) { - e.exports = function(e, t, i, n) { - var r = i[0] - , o = i[1] - , a = t[0] - r - , s = t[1] - o - , c = Math.sin(n) - , u = Math.cos(n); - return e[0] = r + a * u - s * c, - e[1] = o + a * c + s * u, - e[2] = t[2], - e - } -} -, function(e, t, i) { - e.exports = function(e, t, i, r, o, a) { - var s, c; - t || (t = 3); - i || (i = 0); - c = r ? Math.min(r * t + i, e.length) : e.length; - for (s = i; s < c; s += t) - n[0] = e[s], - n[1] = e[s + 1], - n[2] = e[s + 2], - o(n, n, a), - e[s] = n[0], - e[s + 1] = n[1], - e[s + 2] = n[2]; - return e - } - ; - var n = i(174)() -} -, function(e, t) { + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i, n) { + var r = i[1], + o = i[2], + a = t[1] - r, + s = t[2] - o, + c = Math.sin(n), + u = Math.cos(n); + return ( + (e[0] = t[0]), (e[1] = r + a * u - s * c), (e[2] = o + a * c + s * u), e + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i, n) { + var r = i[0], + o = i[2], + a = t[0] - r, + s = t[2] - o, + c = Math.sin(n), + u = Math.cos(n); + return ( + (e[0] = r + s * c + a * u), (e[1] = t[1]), (e[2] = o + s * u - a * c), e + ); + }; + }, + function (e, t) { + e.exports = function (e, t, i, n) { + var r = i[0], + o = i[1], + a = t[0] - r, + s = t[1] - o, + c = Math.sin(n), + u = Math.cos(n); + return ( + (e[0] = r + a * u - s * c), (e[1] = o + a * c + s * u), (e[2] = t[2]), e + ); + }; + }, + function (e, t, i) { + e.exports = function (e, t, i, r, o, a) { + var s, c; + t || (t = 3); + i || (i = 0); + c = r ? Math.min(r * t + i, e.length) : e.length; + for (s = i; s < c; s += t) + (n[0] = e[s]), + (n[1] = e[s + 1]), + (n[2] = e[s + 2]), + o(n, n, a), + (e[s] = n[0]), + (e[s + 1] = n[1]), + (e[s + 2] = n[2]); + return e; + }; + var n = i(174)(); + }, + function (e, t) { function i(e) { - return !!e.constructor && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e) + return ( + !!e.constructor && + "function" == typeof e.constructor.isBuffer && + e.constructor.isBuffer(e) + ); } /*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - e.exports = function(e) { - return null != e && (i(e) || function(e) { - return "function" == typeof e.readFloatLE && "function" == typeof e.slice && i(e.slice(0, 0)) - }(e) || !!e._isBuffer) - } -} -, function(e, t, i) { + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + e.exports = function (e) { + return ( + null != e && + (i(e) || + (function (e) { + return ( + "function" == typeof e.readFloatLE && + "function" == typeof e.slice && + i(e.slice(0, 0)) + ); + })(e) || + !!e._isBuffer) + ); + }; + }, + function (e, t, i) { "use strict"; - var n = i(32) - , r = i(448) - , o = i(42).EventEmitter; + var n = i(32), + r = i(448), + o = i(42).EventEmitter; function a(e, t) { - var i; - t = t || {}, - this._noa = e, - this.element = t.domElement || ((i = document.createElement("div")).tabindex = 1, - i.style.position = "absolute", - i.style.left = "0px", - i.style.right = "0px", - i.style.top = "0px", - i.style.bottom = "0px", - i.style.height = "100%", - i.style.overflow = "hidden", - document.body.appendChild(i), - document.body.style.overflow = "hidden", - document.body.style.height = "100%", - i.id = "noa-container", - i), - this.canvas = function(e) { - var t = e.querySelector("canvas"); - t || ((t = document.createElement("canvas")).style.position = "absolute", - t.style.left = "0px", - t.style.top = "0px", - t.style.height = "100%", - t.style.width = "100%", - t.id = "noa-canvas", + var i; + (t = t || {}), + (this._noa = e), + (this.element = + t.domElement || + (((i = document.createElement("div")).tabindex = 1), + (i.style.position = "absolute"), + (i.style.left = "0px"), + (i.style.right = "0px"), + (i.style.top = "0px"), + (i.style.bottom = "0px"), + (i.style.height = "100%"), + (i.style.overflow = "hidden"), + document.body.appendChild(i), + (document.body.style.overflow = "hidden"), + (document.body.style.height = "100%"), + (i.id = "noa-container"), + i)), + (this.canvas = (function (e) { + var t = e.querySelector("canvas"); + t || + (((t = document.createElement("canvas")).style.position = + "absolute"), + (t.style.left = "0px"), + (t.style.top = "0px"), + (t.style.height = "100%"), + (t.style.width = "100%"), + (t.id = "noa-canvas"), e.insertBefore(t, e.firstChild)); - return t - }(this.element), - this._shell = function(e, t) { - var i = n({ - pointerLock: true, - preventDefaults: false - }, t); - i.element = e; - var o = r(i); - return o.preventDefaults = i.preventDefaults, - o - }(this.canvas, t), - this.hasPointerLock = false, - this.supportsPointerLock = false, - this.pointerInGame = false, - this.windowFocused = document.hasFocus(); - var o = this - , a = function(e) { - !function(e, t) { - var i = document.pointerLockElement || document.mozPointerLockElement || document.webkitPointerLockElement; - i ? (e.hasPointerLock = true, - e.emit("gainedPointerLock")) : (e.hasPointerLock = false, - e.emit("lostPointerLock")); - i && (e.pointerInGame = true) - }(o) + return t; + })(this.element)), + (this._shell = (function (e, t) { + var i = n( + { + pointerLock: true, + preventDefaults: false, + }, + t + ); + i.element = e; + var o = r(i); + return (o.preventDefaults = i.preventDefaults), o; + })(this.canvas, t)), + (this.hasPointerLock = false), + (this.supportsPointerLock = false), + (this.pointerInGame = false), + (this.windowFocused = document.hasFocus()); + var o = this, + a = function (e) { + !(function (e, t) { + var i = + document.pointerLockElement || + document.mozPointerLockElement || + document.webkitPointerLockElement; + i + ? ((e.hasPointerLock = true), e.emit("gainedPointerLock")) + : ((e.hasPointerLock = false), e.emit("lostPointerLock")); + i && (e.pointerInGame = true); + })(o); }; - document.addEventListener("pointerlockchange", a, false), + document.addEventListener("pointerlockchange", a, false), document.addEventListener("mozpointerlockchange", a, false), document.addEventListener("webkitpointerlockchange", a, false), - function(e) { - if ("pointerLockElement"in document || "mozPointerLockElement"in document || "webkitPointerLockElement"in document) { - e.supportsPointerLock = true; - document.addEventListener("touchmove", function t(i) { - e.supportsPointerLock = false, - document.removeEventListener(i.type, t) - }) - } - }(o), - o.element.addEventListener("mouseenter", function() { - o.pointerInGame = true + (function (e) { + if ( + "pointerLockElement" in document || + "mozPointerLockElement" in document || + "webkitPointerLockElement" in document + ) { + e.supportsPointerLock = true; + document.addEventListener("touchmove", function t(i) { + (e.supportsPointerLock = false), + document.removeEventListener(i.type, t); + }); + } + })(o), + o.element.addEventListener("mouseenter", function () { + o.pointerInGame = true; }), - o.element.addEventListener("mouseleave", function() { - o.pointerInGame = false + o.element.addEventListener("mouseleave", function () { + o.pointerInGame = false; }), - window.addEventListener("focus", function() { - o.windowFocused = true + window.addEventListener("focus", function () { + o.windowFocused = true; }), - window.addEventListener("blur", function() { - o.windowFocused = false + window.addEventListener("blur", function () { + o.windowFocused = false; }), - this._shell.on("init", function(e) { - var t = e._noa - , i = e._shell; - i.on("tick", function(e) { - t.tick(e) + this._shell.on( + "init", + function (e) { + var t = e._noa, + i = e._shell; + i.on("tick", function (e) { + t.tick(e); }), - i.on("render", function(e) { - t.render(e) - }), - i.on("resize", t.rendering.resize.bind(t.rendering)), - e.emit("DOMready") - } - .bind(null, this)) + i.on("render", function (e) { + t.render(e); + }), + i.on("resize", t.rendering.resize.bind(t.rendering)), + e.emit("DOMready"); + }.bind(null, this) + ); } - e.exports = function(e, t) { - return new a(e,t) - } - , - a.prototype = Object.create(o.prototype), - a.prototype.appendTo = function(e) { - this.element.appendChild(e) - } - , - a.prototype.setPointerLock = function(e) { - this._shell.pointerLock = !!e - } -} -, function(e, t, i) { + (e.exports = function (e, t) { + return new a(e, t); + }), + (a.prototype = Object.create(o.prototype)), + (a.prototype.appendTo = function (e) { + this.element.appendChild(e); + }), + (a.prototype.setPointerLock = function (e) { + this._shell.pointerLock = !!e; + }); + }, + function (e, t, i) { "use strict"; function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - var r = i(42).EventEmitter - , o = i(186) - , a = i(450) - , s = i(451) - , c = i(452) - , u = i(453) - , l = i(454) - , h = i(185) - , f = Math.min; + var r = i(42).EventEmitter, + o = i(186), + a = i(450), + s = i(451), + c = i(452), + u = i(453), + l = i(454), + h = i(185), + f = Math.min; i(455); - var d = i(456) - , p = i(457) - , m = function() { - var e, t, i = new Array(256); - for (e = 0; e < 256; ++e) - i[e] = "UNK"; + var d = i(456), + p = i(457), + m = (function () { + var e, + t, + i = new Array(256); + for (e = 0; e < 256; ++e) i[e] = "UNK"; for (e in s) - "<" === (t = s[e]).charAt(0) && ">" === t.charAt(t.length - 1) && (t = t.substring(1, t.length - 1)), - t = t.replace(/\s/g, "-"), - i[parseInt(e)] = t; - return i - }() - , g = u(Object.keys(c(m))); + "<" === (t = s[e]).charAt(0) && + ">" === t.charAt(t.length - 1) && + (t = t.substring(1, t.length - 1)), + (t = t.replace(/\s/g, "-")), + (i[parseInt(e)] = t); + return i; + })(), + g = u(Object.keys(c(m))); function _(e) { - return l.eq(g, e) + return l.eq(g, e); } function v(e) { - return _(m[e]) + return _(m[e]); } function y() { - r.call(this), - this._curKeyState = new Array(g.length), - this._pressCount = new Array(g.length), - this._releaseCount = new Array(g.length), - this._tickInterval = null, - this._rafHandle = null, - this._tickRate = 0, - this._lastTick = p(), - this._frameTime = 0, - this._paused = true, - this._width = 0, - this._height = 0, - this._wantFullscreen = false, - this._wantPointerLock = false, - this._fullscreenActive = false, - this._pointerLockActive = false, - this._rafFunction = C.bind(void 0, this, true), - this.preventDefaults = true, - this.stopPropagation = false; - for (var e = 0; e < g.length; ++e) - this._curKeyState[e] = false, - this._pressCount[e] = this._releaseCount[e] = 0; - this.element = null, - this.bindings = {}, - this.frameSkip = 100, - this.tickCount = 0, - this.frameCount = 0, - this.startTime = p(), - this.tickTime = this._tickRate, - this.frameTime = 10, - this.stickyFullscreen = false, - this.stickyPointerLock = false, - this.scroll = [0, 0, 0], - this.mouseX = 0, - this.mouseY = 0, - this.prevMouseX = 0, - this.prevMouseY = 0 + r.call(this), + (this._curKeyState = new Array(g.length)), + (this._pressCount = new Array(g.length)), + (this._releaseCount = new Array(g.length)), + (this._tickInterval = null), + (this._rafHandle = null), + (this._tickRate = 0), + (this._lastTick = p()), + (this._frameTime = 0), + (this._paused = true), + (this._width = 0), + (this._height = 0), + (this._wantFullscreen = false), + (this._wantPointerLock = false), + (this._fullscreenActive = false), + (this._pointerLockActive = false), + (this._rafFunction = C.bind(void 0, this, true)), + (this.preventDefaults = true), + (this.stopPropagation = false); + for (var e = 0; e < g.length; ++e) + (this._curKeyState[e] = false), + (this._pressCount[e] = this._releaseCount[e] = 0); + (this.element = null), + (this.bindings = {}), + (this.frameSkip = 100), + (this.tickCount = 0), + (this.frameCount = 0), + (this.startTime = p()), + (this.tickTime = this._tickRate), + (this.frameTime = 10), + (this.stickyFullscreen = false), + (this.stickyPointerLock = false), + (this.scroll = [0, 0, 0]), + (this.mouseX = 0), + (this.mouseY = 0), + (this.prevMouseX = 0), + (this.prevMouseY = 0); } o.inherits(y, r); var b = y.prototype; function E(e, t, i) { - if (i in t) { - for (var n = t[i], r = 0, o = 0, a = n.length; o < a; ++o) - r += e[_(n[o])]; - return r - } - var s = _(i); - return s >= 0 ? e[s] : 0 + if (i in t) { + for (var n = t[i], r = 0, o = 0, a = n.length; o < a; ++o) + r += e[_(n[o])]; + return r; + } + var s = _(i); + return s >= 0 ? e[s] : 0; } function T(e) { - var t = e.element; - e._wantFullscreen && !e._fullscreenActive && (t.requestFullscreen || t.requestFullScreen || t.webkitRequestFullscreen || t.webkitRequestFullScreen || t.mozRequestFullscreen || t.mozRequestFullScreen || function() {} + var t = e.element; + e._wantFullscreen && + !e._fullscreenActive && + ( + t.requestFullscreen || + t.requestFullScreen || + t.webkitRequestFullscreen || + t.webkitRequestFullScreen || + t.mozRequestFullscreen || + t.mozRequestFullScreen || + function () {} + ).call(t); + e._wantPointerLock && + !e._pointerLockActive && + ( + t.requestPointerLock || + t.webkitRequestPointerLock || + t.mozRequestPointerLock || + t.msRequestPointerLock || + t.oRequestPointerLock || + function () {} ).call(t); - e._wantPointerLock && !e._pointerLockActive && (t.requestPointerLock || t.webkitRequestPointerLock || t.mozRequestPointerLock || t.msRequestPointerLock || t.oRequestPointerLock || function() {} - ).call(t) } - b.keyNames = g, - b.bind = function(e) { + (b.keyNames = g), + (b.bind = function (e) { var t, i; t = e in this.bindings ? this.bindings[e] : []; for (var n = 1, r = arguments.length; n < r; ++n) - if (_(i = arguments[n]) >= 0) - t.push(i); - else if (i in this.bindings) - for (var o = this.bindings[i], a = 0; a < o.length; ++a) - t.push(o[a]); + if (_((i = arguments[n])) >= 0) t.push(i); + else if (i in this.bindings) + for (var o = this.bindings[i], a = 0; a < o.length; ++a) + t.push(o[a]); (t = u(t)).length > 0 && (this.bindings[e] = t), - this.emit("bind", e, t) - } - , - b.unbind = function(e) { - e in this.bindings && delete this.bindings[e], - this.emit("unbind", e) - } - , - b.down = function(e) { - return function(e, t, i) { - if (i in t) { - for (var n = t[i], r = 0, o = n.length; r < o; ++r) - if (e[_(n[r])]) - return true; - return false - } - var a = _(i); - return a >= 0 && e[a] - }(this._curKeyState, this.bindings, e) - } - , - b.wasDown = function(e) { - return this.down(e) || !!this.press(e) - } - , - b.up = function(e) { - return !this.down(e) - } - , - b.wasUp = function(e) { - return this.up(e) || !!this.release(e) - } - , - b.press = function(e) { - return E(this._pressCount, this.bindings, e) - } - , - b.release = function(e) { - return E(this._releaseCount, this.bindings, e) - } - , - Object.defineProperty(b, "paused", { - get: function() { - return this._paused + this.emit("bind", e, t); + }), + (b.unbind = function (e) { + e in this.bindings && delete this.bindings[e], this.emit("unbind", e); + }), + (b.down = function (e) { + return (function (e, t, i) { + if (i in t) { + for (var n = t[i], r = 0, o = n.length; r < o; ++r) + if (e[_(n[r])]) return true; + return false; + } + var a = _(i); + return a >= 0 && e[a]; + })(this._curKeyState, this.bindings, e); + }), + (b.wasDown = function (e) { + return this.down(e) || !!this.press(e); + }), + (b.up = function (e) { + return !this.down(e); + }), + (b.wasUp = function (e) { + return this.up(e) || !!this.release(e); + }), + (b.press = function (e) { + return E(this._pressCount, this.bindings, e); + }), + (b.release = function (e) { + return E(this._releaseCount, this.bindings, e); + }), + Object.defineProperty(b, "paused", { + get: function () { + return this._paused; }, - set: function(e) { - !!e !== this._paused && (this._paused ? (this._paused = false, - this._lastTick = p() - Math.floor(this._frameTime * this._tickRate), - this._tickInterval = setInterval(C, this._tickRate, this, false), - this._rafHandle = requestAnimationFrame(this._rafFunction)) : (this._paused = true, - this._frameTime = f(1, (p() - this._lastTick) / this._tickRate), - clearInterval(this._tickInterval))) - } - }); - var A = document.exitFullscreen || document.cancelFullscreen || document.cancelFullScreen || document.webkitCancelFullscreen || document.webkitCancelFullScreen || document.mozCancelFullscreen || document.mozCancelFullScreen || function() {} - ; + set: function (e) { + !!e !== this._paused && + (this._paused + ? ((this._paused = false), + (this._lastTick = + p() - Math.floor(this._frameTime * this._tickRate)), + (this._tickInterval = setInterval( + C, + this._tickRate, + this, + false + )), + (this._rafHandle = requestAnimationFrame(this._rafFunction))) + : ((this._paused = true), + (this._frameTime = f( + 1, + (p() - this._lastTick) / this._tickRate + )), + clearInterval(this._tickInterval))); + }, + }); + var A = + document.exitFullscreen || + document.cancelFullscreen || + document.cancelFullScreen || + document.webkitCancelFullscreen || + document.webkitCancelFullScreen || + document.mozCancelFullscreen || + document.mozCancelFullScreen || + function () {}; Object.defineProperty(b, "fullscreen", { - get: function() { - return this._fullscreenActive - }, - set: function(e) { - !e ? (this._wantFullscreen = false, - (document.fullscreen || document.mozFullScreen || document.webkitIsFullScreen || false) && A.call(document)) : (this._wantFullscreen = true, - T(this)); - return this._fullscreenActive - } + get: function () { + return this._fullscreenActive; + }, + set: function (e) { + !e + ? ((this._wantFullscreen = false), + (document.fullscreen || + document.mozFullScreen || + document.webkitIsFullScreen || + false) && + A.call(document)) + : ((this._wantFullscreen = true), T(this)); + return this._fullscreenActive; + }, }); - var x = document.exitPointerLock || document.webkitExitPointerLock || document.mozExitPointerLock || function() {} - ; + var x = + document.exitPointerLock || + document.webkitExitPointerLock || + document.mozExitPointerLock || + function () {}; function S(e, t, i) { - e._curKeyState[t] !== i && (i ? e._pressCount[t]++ : e._releaseCount[t]++, - e._curKeyState[t] = i) + e._curKeyState[t] !== i && + (i ? e._pressCount[t]++ : e._releaseCount[t]++, + (e._curKeyState[t] = i)); } function C(e, t) { - !function(e) { - var t, i, n, r = p() + e.frameSkip, o = e._pressCount, a = e._releaseCount, s = e._tickRate, c = g.length; - for (; !e._paused && p() >= e._lastTick + s; ) { - if (p() > r) - return void (e._lastTick = p() + s); - for (i = p(), - e.emit("tick"), - n = p(), - e.tickTime = n - i, - ++e.tickCount, - e._lastTick += s, - t = 0; t < c; ++t) - o[t] = a[t] = 0; - e._pointerLockActive ? (e.prevMouseX = e.mouseX = e.width >> 1, - e.prevMouseY = e.mouseY = e.height >> 1) : (e.prevMouseX = e.mouseX, - e.prevMouseY = e.mouseY), - e.scroll[0] = e.scroll[1] = e.scroll[2] = 0 - } - }(e), - t && function(e) { + !(function (e) { + var t, + i, + n, + r = p() + e.frameSkip, + o = e._pressCount, + a = e._releaseCount, + s = e._tickRate, + c = g.length; + for (; !e._paused && p() >= e._lastTick + s; ) { + if (p() > r) return void (e._lastTick = p() + s); + for ( + i = p(), + e.emit("tick"), + n = p(), + e.tickTime = n - i, + ++e.tickCount, + e._lastTick += s, + t = 0; + t < c; + ++t + ) + o[t] = a[t] = 0; + e._pointerLockActive + ? ((e.prevMouseX = e.mouseX = e.width >> 1), + (e.prevMouseY = e.mouseY = e.height >> 1)) + : ((e.prevMouseX = e.mouseX), (e.prevMouseY = e.mouseY)), + (e.scroll[0] = e.scroll[1] = e.scroll[2] = 0); + } + })(e), + t && + (function (e) { var t; - e._rafHandle = requestAnimationFrame(e._rafFunction), - t = e._paused ? e._frameTime : f(1, (p() - e._lastTick) / e._tickRate); + (e._rafHandle = requestAnimationFrame(e._rafFunction)), + (t = e._paused + ? e._frameTime + : f(1, (p() - e._lastTick) / e._tickRate)); ++e.frameCount; var i = p(); e.emit("render", t); var n = p(); - e.frameTime = n - i - }(e) + e.frameTime = n - i; + })(e); } function P(e, t) { - e.preventDefaults && t.preventDefault(), - e.stopPropagation && t.stopPropagation() + e.preventDefaults && t.preventDefault(), + e.stopPropagation && t.stopPropagation(); } function R(e, t) { - if (function(e) { - return document.activeElement === document.body || document.activeElement === e.element - }(e)) - if (P(e, t), - t.metaKey) - w(e, t); - else { - var i = v(t.keyCode || t.char || t.which || t.charCode); - i >= 0 && S(e, i, true) - } + if ( + (function (e) { + return ( + document.activeElement === document.body || + document.activeElement === e.element + ); + })(e) + ) + if ((P(e, t), t.metaKey)) w(e, t); + else { + var i = v(t.keyCode || t.char || t.which || t.charCode); + i >= 0 && S(e, i, true); + } } Object.defineProperty(b, "pointerLock", { - get: function() { - return this._pointerLockActive + get: function () { + return this._pointerLockActive; + }, + set: function (e) { + return ( + !!e + ? ((this._wantPointerLock = true), T(this)) + : ((this._wantPointerLock = false), x.call(document)), + this._pointerLockActive + ); + }, + }), + Object.defineProperty(b, "width", { + get: function () { + return this.element.clientWidth; }, - set: function(e) { - return !!e ? (this._wantPointerLock = true, - T(this)) : (this._wantPointerLock = false, - x.call(document)), - this._pointerLockActive - } - }), - Object.defineProperty(b, "width", { - get: function() { - return this.element.clientWidth - } - }), - Object.defineProperty(b, "height", { - get: function() { - return this.element.clientHeight - } - }); - var M = h(32).map(function(e) { - return _("mouse-" + (e + 1)) + }), + Object.defineProperty(b, "height", { + get: function () { + return this.element.clientHeight; + }, + }); + var M = h(32).map(function (e) { + return _("mouse-" + (e + 1)); }); function O(e, t) { - return P(e, t), - function(e, t) { - for (var i = 0; i < 32; ++i) - S(e, M[i], !!(t & 1 << i)) - }(e, 0), + return ( + P(e, t), + (function (e, t) { + for (var i = 0; i < 32; ++i) S(e, M[i], !!(t & (1 << i))); + })(e, 0), false + ); } function w(e, t) { - var i, n = g.length, r = e._curKeyState, o = e._releaseCount; - for (i = 0; i < n; ++i) - r[i] && ++o[i], - r[i] = false; - return false + var i, + n = g.length, + r = e._curKeyState, + o = e._releaseCount; + for (i = 0; i < n; ++i) r[i] && ++o[i], (r[i] = false); + return false; } function I() { - var e = document.createElement("div"); - return e.tabindex = 1, - e.style.position = "absolute", - e.style.left = "0px", - e.style.right = "0px", - e.style.top = "0px", - e.style.bottom = "0px", - e.style.height = "100%", - e.style.overflow = "hidden", + var e = document.createElement("div"); + return ( + (e.tabindex = 1), + (e.style.position = "absolute"), + (e.style.left = "0px"), + (e.style.right = "0px"), + (e.style.top = "0px"), + (e.style.bottom = "0px"), + (e.style.height = "100%"), + (e.style.overflow = "hidden"), document.body.appendChild(e), - document.body.style.overflow = "hidden", - document.body.style.height = "100%", + (document.body.style.overflow = "hidden"), + (document.body.style.height = "100%"), e + ); } - e.exports = function(e) { - var t = !!(e = e || {}).fullscreen - , i = t; - void 0 !== n(e.pointerLock) && (i = !!e.pointerLock); - var r = new y; - return r._tickRate = e.tickRate || 30, - r.frameSkip = e.frameSkip || 5 * (r._tickRate + 5), - r.stickyFullscreen = !!e.stickyFullscreen || !!e.sticky, - r.stickyPointerLock = !!e.stickyPointerLock || !!e.sticky, + e.exports = function (e) { + var t = !!(e = e || {}).fullscreen, + i = t; + void 0 !== n(e.pointerLock) && (i = !!e.pointerLock); + var r = new y(); + return ( + (r._tickRate = e.tickRate || 30), + (r.frameSkip = e.frameSkip || 5 * (r._tickRate + 5)), + (r.stickyFullscreen = !!e.stickyFullscreen || !!e.sticky), + (r.stickyPointerLock = !!e.stickyPointerLock || !!e.sticky), e.bindings && (r.bindings = e.bindings), - setTimeout(function() { - a(function() { - var o = e.element; - if ("string" == typeof o) { - var a = document.querySelector(o); - a || (a = document.getElementById(o)), - a || (a = document.getElementByClass(o)[0]), - a || (a = I()), - r.element = a - } else - "object" === n(o) && o ? r.element = o : r.element = "function" == typeof o ? o() : I(); - r.element.style && (r.element.style["-webkit-touch-callout"] = "none", - r.element.style["-webkit-user-select"] = "none", - r.element.style["-khtml-user-select"] = "none", - r.element.style["-moz-user-select"] = "none", - r.element.style["-ms-user-select"] = "none", - r.element.style["user-select"] = "none"), - r._width = r.element.clientWidth, - r._height = r.element.clientHeight; - var s = function(e, t) { - var i = 0 | e.element.clientWidth - , n = 0 | e.element.clientHeight; - i === e._width && n === e._height || (e._width = i, - e._height = n, - e.emit("resize", i, n)) - } - .bind(void 0, r); - "undefined" != typeof MutationObserver ? new MutationObserver(s).observe(r.element, { - attributes: true, - subtree: true - }) : r.element.addEventListener("DOMSubtreeModified", s, false), - window.addEventListener("resize", s, false), - window.addEventListener("keydown", R.bind(void 0, r), false), - window.addEventListener("keyup", function(e, t) { - P(e, t); - var i = v(t.keyCode || t.char || t.which || t.charCode); - i >= 0 && S(e, i, false) - } - .bind(void 0, r), false), - r.element.oncontextmenu = function(e, t) { - return P(e, t), + setTimeout(function () { + a(function () { + var o = e.element; + if ("string" == typeof o) { + var a = document.querySelector(o); + a || (a = document.getElementById(o)), + a || (a = document.getElementByClass(o)[0]), + a || (a = I()), + (r.element = a); + } else "object" === n(o) && o ? (r.element = o) : (r.element = "function" == typeof o ? o() : I()); + r.element.style && + ((r.element.style["-webkit-touch-callout"] = "none"), + (r.element.style["-webkit-user-select"] = "none"), + (r.element.style["-khtml-user-select"] = "none"), + (r.element.style["-moz-user-select"] = "none"), + (r.element.style["-ms-user-select"] = "none"), + (r.element.style["user-select"] = "none")), + (r._width = r.element.clientWidth), + (r._height = r.element.clientHeight); + var s = function (e, t) { + var i = 0 | e.element.clientWidth, + n = 0 | e.element.clientHeight; + (i === e._width && n === e._height) || + ((e._width = i), (e._height = n), e.emit("resize", i, n)); + }.bind(void 0, r); + "undefined" != typeof MutationObserver + ? new MutationObserver(s).observe(r.element, { + attributes: true, + subtree: true, + }) + : r.element.addEventListener("DOMSubtreeModified", s, false), + window.addEventListener("resize", s, false), + window.addEventListener("keydown", R.bind(void 0, r), false), + window.addEventListener( + "keyup", + function (e, t) { + P(e, t); + var i = v(t.keyCode || t.char || t.which || t.charCode); + i >= 0 && S(e, i, false); + }.bind(void 0, r), + false + ), + (r.element.oncontextmenu = function (e, t) { + return P(e, t), false; + }.bind(void 0, r)), + r.element.addEventListener( + "mousedown", + function (e, t) { + return P(e, t), S(e, M[t.button], true), false; + }.bind(void 0, r), + false + ), + r.element.addEventListener( + "mouseup", + function (e, t) { + return P(e, t), S(e, M[t.button], false), false; + }.bind(void 0, r), + false + ), + r.element.addEventListener( + "mousemove", + function (e, t) { + if ((P(e, t), e._pointerLockActive)) { + var i = + t.movementX || t.mozMovementX || t.webkitMovementX || 0, + n = + t.movementY || t.mozMovementY || t.webkitMovementY || 0; + (e.mouseX += i), (e.mouseY += n); + } else + (e.mouseX = t.clientX - e.element.offsetLeft), + (e.mouseY = t.clientY - e.element.offsetTop); + return false; + }.bind(void 0, r), + false + ), + r.element.addEventListener( + "mouseenter", + function (e, t) { + return ( + P(e, t), + e._pointerLockActive + ? ((e.prevMouseX = e.mouseX = e.width >> 1), + (e.prevMouseY = e.mouseY = e.height >> 1)) + : ((e.prevMouseX = e.mouseX = + t.clientX - e.element.offsetLeft), + (e.prevMouseY = e.mouseY = + t.clientY - e.element.offsetTop)), false - } - .bind(void 0, r), - r.element.addEventListener("mousedown", function(e, t) { - return P(e, t), - S(e, M[t.button], true), - false - } - .bind(void 0, r), false), - r.element.addEventListener("mouseup", function(e, t) { - return P(e, t), - S(e, M[t.button], false), - false - } - .bind(void 0, r), false), - r.element.addEventListener("mousemove", function(e, t) { - if (P(e, t), - e._pointerLockActive) { - var i = t.movementX || t.mozMovementX || t.webkitMovementX || 0 - , n = t.movementY || t.mozMovementY || t.webkitMovementY || 0; - e.mouseX += i, - e.mouseY += n - } else - e.mouseX = t.clientX - e.element.offsetLeft, - e.mouseY = t.clientY - e.element.offsetTop; - return false - } - .bind(void 0, r), false), - r.element.addEventListener("mouseenter", function(e, t) { - return P(e, t), - e._pointerLockActive ? (e.prevMouseX = e.mouseX = e.width >> 1, - e.prevMouseY = e.mouseY = e.height >> 1) : (e.prevMouseX = e.mouseX = t.clientX - e.element.offsetLeft, - e.prevMouseY = e.mouseY = t.clientY - e.element.offsetTop), - false - } - .bind(void 0, r), false); - var c = O.bind(void 0, r); - r.element.addEventListener("mouseleave", c, false), - r.element.addEventListener("mouseout", c, false), - window.addEventListener("mouseleave", c, false), - window.addEventListener("mouseout", c, false); - var u = w.bind(void 0, r); - r.element.addEventListener("blur", u, false), - r.element.addEventListener("focusout", u, false), - r.element.addEventListener("focus", u, false), - window.addEventListener("blur", u, false), - window.addEventListener("focusout", u, false), - window.addEventListener("focus", u, false), - d(r.element, function(e, t) { - P(e, t); - var i = 1; - switch (t.deltaMode) { + ); + }.bind(void 0, r), + false + ); + var c = O.bind(void 0, r); + r.element.addEventListener("mouseleave", c, false), + r.element.addEventListener("mouseout", c, false), + window.addEventListener("mouseleave", c, false), + window.addEventListener("mouseout", c, false); + var u = w.bind(void 0, r); + r.element.addEventListener("blur", u, false), + r.element.addEventListener("focusout", u, false), + r.element.addEventListener("focus", u, false), + window.addEventListener("blur", u, false), + window.addEventListener("focusout", u, false), + window.addEventListener("focus", u, false), + d( + r.element, + function (e, t) { + P(e, t); + var i = 1; + switch (t.deltaMode) { case 0: - i = 1; - break; + i = 1; + break; case 1: - i = 12; - break; + i = 12; + break; case 2: - i = e.height - } - return e.scroll[0] += t.deltaX * i, - e.scroll[1] += t.deltaY * i, - e.scroll[2] += t.deltaZ * i || 0, + i = e.height; + } + return ( + (e.scroll[0] += t.deltaX * i), + (e.scroll[1] += t.deltaY * i), + (e.scroll[2] += t.deltaZ * i || 0), false - } - .bind(void 0, r), false); - var l = function(e) { - e._fullscreenActive = document.fullscreen || document.mozFullScreen || document.webkitIsFullScreen || false, - !e.stickyFullscreen && e._fullscreenActive && (e._wantFullscreen = false) - } - .bind(void 0, r); - document.addEventListener("fullscreenchange", l, false), - document.addEventListener("mozfullscreenchange", l, false), - document.addEventListener("webkitfullscreenchange", l, false), - r.element.addEventListener("click", T.bind(void 0, r), false); - var h = function(e, t) { - e._pointerLockActive = e.element === (document.pointerLockElement || document.mozPointerLockElement || document.webkitPointerLockElement || null), - !e.stickyPointerLock && e._pointerLockActive && (e._wantPointerLock = false) - } - .bind(void 0, r); - document.addEventListener("pointerlockchange", h, false), - document.addEventListener("mozpointerlockchange", h, false), - document.addEventListener("webkitpointerlockchange", h, false), - document.addEventListener("pointerlocklost", h, false), - document.addEventListener("webkitpointerlocklost", h, false), - document.addEventListener("mozpointerlocklost", h, false), - r.fullscreen = t, - r.pointerLock = i, - r.bind("mouse-left", "mouse-1"), - r.bind("mouse-right", "mouse-3"), - r.bind("mouse-middle", "mouse-2"), - r._lastTick = p(), - r.startTime = p(), - r.paused = false, - r.emit("init") - }) + ); + }.bind(void 0, r), + false + ); + var l = function (e) { + (e._fullscreenActive = + document.fullscreen || + document.mozFullScreen || + document.webkitIsFullScreen || + false), + !e.stickyFullscreen && + e._fullscreenActive && + (e._wantFullscreen = false); + }.bind(void 0, r); + document.addEventListener("fullscreenchange", l, false), + document.addEventListener("mozfullscreenchange", l, false), + document.addEventListener("webkitfullscreenchange", l, false), + r.element.addEventListener("click", T.bind(void 0, r), false); + var h = function (e, t) { + (e._pointerLockActive = + e.element === + (document.pointerLockElement || + document.mozPointerLockElement || + document.webkitPointerLockElement || + null)), + !e.stickyPointerLock && + e._pointerLockActive && + (e._wantPointerLock = false); + }.bind(void 0, r); + document.addEventListener("pointerlockchange", h, false), + document.addEventListener("mozpointerlockchange", h, false), + document.addEventListener("webkitpointerlockchange", h, false), + document.addEventListener("pointerlocklost", h, false), + document.addEventListener("webkitpointerlocklost", h, false), + document.addEventListener("mozpointerlocklost", h, false), + (r.fullscreen = t), + (r.pointerLock = i), + r.bind("mouse-left", "mouse-1"), + r.bind("mouse-right", "mouse-3"), + r.bind("mouse-middle", "mouse-2"), + (r._lastTick = p()), + (r.startTime = p()), + (r.paused = false), + r.emit("init"); + }); }, 0), r - } -} -, function(e, t) { + ); + }; + }, + function (e, t) { function i(e) { - return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (i = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - e.exports = function(e) { - return e && "object" === i(e) && "function" == typeof e.copy && "function" == typeof e.fill && "function" == typeof e.readUInt8 - } -} -, function(e, t, i) { + e.exports = function (e) { + return ( + e && + "object" === i(e) && + "function" == typeof e.copy && + "function" == typeof e.fill && + "function" == typeof e.readUInt8 + ); + }; + }, + function (e, t, i) { var n, r, o, a, s; - e.exports = (r = [], - o = document, - a = o.documentElement.doScroll, - (s = (a ? /^loaded|^c/ : /^loaded|^i|^c/).test(o.readyState)) || o.addEventListener("DOMContentLoaded", n = function() { - for (o.removeEventListener("DOMContentLoaded", n), - s = 1; n = r.shift(); ) - n() - } - ), - function(e) { - s ? setTimeout(e, 0) : r.push(e) - } - ) -} -, function(e, t) { + e.exports = + ((r = []), + (o = document), + (a = o.documentElement.doScroll), + (s = (a ? /^loaded|^c/ : /^loaded|^i|^c/).test(o.readyState)) || + o.addEventListener( + "DOMContentLoaded", + (n = function () { + for ( + o.removeEventListener("DOMContentLoaded", n), s = 1; + (n = r.shift()); + + ) + n(); + }) + ), + function (e) { + s ? setTimeout(e, 0) : r.push(e); + }); + }, + function (e, t) { var i; function n(e, t, i) { - return t in e ? Object.defineProperty(e, t, { - value: i, - enumerable: true, - configurable: true, - writable: true - }) : e[t] = i, + return ( + t in e + ? Object.defineProperty(e, t, { + value: i, + enumerable: true, + configurable: true, + writable: true, + }) + : (e[t] = i), e + ); } - var r, o = "undefined" != typeof window ? window.navigator.userAgent : "", a = /OS X/.test(o), s = /Opera/.test(o), c = !/like Gecko/.test(o) && !s, u = e.exports = (n(i = { - 0: a ? "" : "", - 1: "", - 2: "", - 3: "", - 4: "", - 5: "", - 6: "", - 8: "", - 9: "", - 12: "", - 13: "", - 16: "", - 17: "", - 18: "", - 19: "", - 20: "", - 21: "", - 23: "", - 24: "", - 25: "", - 27: "", - 28: "", - 29: "", - 30: "", - 31: "" - }, "27", ""), - n(i, 32, ""), - n(i, 33, ""), - n(i, 34, ""), - n(i, 35, ""), - n(i, 36, ""), - n(i, 37, ""), - n(i, 38, ""), - n(i, 39, ""), - n(i, 40, ""), - n(i, 41, ""), + n(i, 42, ""), + n(i, 43, ""), + n(i, 44, ""), + n(i, 45, ""), + n(i, 46, ""), + n(i, 47, ""), + n(i, 91, ""), + n(i, 92, ""), + n(i, 93, a ? "" : ""), + n(i, 95, ""), + n(i, 106, ""), + n(i, 107, ""), + n(i, 108, ""), + n(i, 109, ""), + n(i, 111, ""), + n(i, 144, ""), + n(i, 145, ""), + n(i, 160, ""), + n(i, 161, ""), + n(i, 162, ""), + n(i, 163, ""), + n(i, 164, ""), + n(i, 165, ""), + n(i, 166, ""), + n(i, 167, ""), + n(i, 168, ""), + n(i, 169, ""), + n(i, 170, ""), + n(i, 171, ""), + n(i, 172, ""), + n(i, 173, a && c ? "-" : ""), + n(i, 174, ""), + n(i, 175, ""), + n(i, 176, ""), + n(i, 177, ""), + n(i, 178, ""), + n(i, 179, ""), + n(i, 180, ""), + n(i, 181, ""), + n(i, 182, ""), + n(i, 183, ""), + n(i, 186, ";"), + n(i, 187, "="), + n(i, 188, ","), + n(i, 189, "-"), + n(i, 190, "."), + n(i, 191, "/"), + n(i, 192, "`"), + n(i, 219, "["), + n(i, 220, "\\"), + n(i, 221, "]"), + n(i, 222, "'"), + n(i, 223, ""), + n(i, 224, ""), + n(i, 226, ""), + n(i, 229, ""), + n(i, 231, s ? "`" : ""), + n(i, 246, ""), + n(i, 247, ""), + n(i, 248, ""), + n(i, 249, ""), + n(i, 250, ""), + n(i, 251, ""), + n(i, 252, ""), + n(i, 253, ""), + n(i, 254, ""), + i)); + for (r = 58; r < 65; ++r) u[r] = String.fromCharCode(r); + for (r = 48; r < 58; ++r) u[r] = r - 48 + ""; + for (r = 65; r < 91; ++r) u[r] = String.fromCharCode(r); + for (r = 96; r < 106; ++r) u[r] = ""; + for (r = 112; r < 136; ++r) u[r] = "F" + (r - 111); + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - var t = {}; - for (var i in e) - e.hasOwnProperty(i) && (t[e[i]] = i); - return t - } -} -, function(e, t, i) { + e.exports = function (e) { + var t = {}; + for (var i in e) e.hasOwnProperty(i) && (t[e[i]] = i); + return t; + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t, i) { - return 0 === e.length ? e : t ? (i || e.sort(t), - function(e, t) { + e.exports = function (e, t, i) { + return 0 === e.length + ? e + : t + ? (i || e.sort(t), + (function (e, t) { for (var i = 1, n = e.length, r = e[0], o = e[0], a = 1; a < n; ++a) - if (o = r, - t(r = e[a], o)) { - if (a === i) { - i++; - continue - } - e[i++] = r + if (((o = r), t((r = e[a]), o))) { + if (a === i) { + i++; + continue; } - return e.length = i, - e - }(e, t)) : (i || e.sort(), - function(e) { - for (var t = 1, i = e.length, n = e[0], r = e[0], o = 1; o < i; ++o, - r = n) - if (r = n, - (n = e[o]) !== r) { - if (o === t) { - t++; - continue - } - e[t++] = n + e[i++] = r; + } + return (e.length = i), e; + })(e, t)) + : (i || e.sort(), + (function (e) { + for ( + var t = 1, i = e.length, n = e[0], r = e[0], o = 1; + o < i; + ++o, r = n + ) + if (((r = n), (n = e[o]) !== r)) { + if (o === t) { + t++; + continue; } - return e.length = t, - e - }(e)) - } -} -, function(e, t, i) { + e[t++] = n; + } + return (e.length = t), e; + })(e)); + }; + }, + function (e, t, i) { "use strict"; function n(e, t, i, n, r, o) { - var a = ["function ", e, "(a,l,h,", n.join(","), "){", o ? "" : "var i=", i ? "l-1" : "h+1", ";while(l<=h){var m=(l+h)>>>1,x=a", r ? ".get(m)" : "[m]"]; - return o ? t.indexOf("c") < 0 ? a.push(";if(x===y){return m}else if(x<=y){") : a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){") : a.push(";if(", t, "){i=m;"), + var a = [ + "function ", + e, + "(a,l,h,", + n.join(","), + "){", + o ? "" : "var i=", + i ? "l-1" : "h+1", + ";while(l<=h){var m=(l+h)>>>1,x=a", + r ? ".get(m)" : "[m]", + ]; + return ( + o + ? t.indexOf("c") < 0 + ? a.push(";if(x===y){return m}else if(x<=y){") + : a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){") + : a.push(";if(", t, "){i=m;"), i ? a.push("l=m+1}else{h=m-1}") : a.push("h=m-1}else{l=m+1}"), a.push("}"), o ? a.push("return -1};") : a.push("return i};"), a.join("") + ); } function r(e, t, i, r) { - return new Function([n("A", "x" + e + "y", t, ["y"], false, r), n("B", "x" + e + "y", t, ["y"], true, r), n("P", "c(x,y)" + e + "0", t, ["y", "c"], false, r), n("Q", "c(x,y)" + e + "0", t, ["y", "c"], true, r), "function dispatchBsearch", i, "(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch", i].join(""))() + return new Function( + [ + n("A", "x" + e + "y", t, ["y"], false, r), + n("B", "x" + e + "y", t, ["y"], true, r), + n("P", "c(x,y)" + e + "0", t, ["y", "c"], false, r), + n("Q", "c(x,y)" + e + "0", t, ["y", "c"], true, r), + "function dispatchBsearch", + i, + "(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch", + i, + ].join("") + )(); } e.exports = { - ge: r(">=", false, "GE"), - gt: r(">", false, "GT"), - lt: r("<", true, "LT"), - le: r("<=", true, "LE"), - eq: r("-", true, "EQ", true) - } -} -, function(e, t) { - for (var i = 0, n = ["ms", "moz", "webkit", "o"], r = 0; r < n.length && !window.requestAnimationFrame; ++r) - window.requestAnimationFrame = window[n[r] + "RequestAnimationFrame"], - window.cancelAnimationFrame = window[n[r] + "CancelAnimationFrame"] || window[n[r] + "CancelRequestAnimationFrame"]; - window.requestAnimationFrame || (window.requestAnimationFrame = function(e, t) { - var n = (new Date).getTime() - , r = Math.max(0, 16 - (n - i)) - , o = window.setTimeout(function() { - e(n + r) - }, r); - return i = n + r, - o - } - ), - window.cancelAnimationFrame || (window.cancelAnimationFrame = function(e) { - clearTimeout(e) - } + ge: r(">=", false, "GE"), + gt: r(">", false, "GT"), + lt: r("<", true, "LT"), + le: r("<=", true, "LE"), + eq: r("-", true, "EQ", true), + }; + }, + function (e, t) { + for ( + var i = 0, n = ["ms", "moz", "webkit", "o"], r = 0; + r < n.length && !window.requestAnimationFrame; + ++r ) -} -, function(e, t) { - var i, n, r = ""; + (window.requestAnimationFrame = window[n[r] + "RequestAnimationFrame"]), + (window.cancelAnimationFrame = + window[n[r] + "CancelAnimationFrame"] || + window[n[r] + "CancelRequestAnimationFrame"]); + window.requestAnimationFrame || + (window.requestAnimationFrame = function (e, t) { + var n = new Date().getTime(), + r = Math.max(0, 16 - (n - i)), + o = window.setTimeout(function () { + e(n + r); + }, r); + return (i = n + r), o; + }), + window.cancelAnimationFrame || + (window.cancelAnimationFrame = function (e) { + clearTimeout(e); + }); + }, + function (e, t) { + var i, + n, + r = ""; function o(e, t, o, a) { - e[i](r + t, "wheel" == n ? o : function(e) { - !e && (e = window.event); - var t = { + e[i]( + r + t, + "wheel" == n + ? o + : function (e) { + !e && (e = window.event); + var t = { originalEvent: e, target: e.target || e.srcElement, type: "wheel", deltaMode: "MozMousePixelScroll" == e.type ? 0 : 1, deltaX: 0, delatZ: 0, - preventDefault: function() { - e.preventDefault ? e.preventDefault() : e.returnValue = false - } - }; - return "mousewheel" == n ? (t.deltaY = -.025 * e.wheelDelta, - e.wheelDeltaX && (t.deltaX = -.025 * e.wheelDeltaX)) : t.deltaY = e.detail, - o(t) - } - , a || false) + preventDefault: function () { + e.preventDefault + ? e.preventDefault() + : (e.returnValue = false); + }, + }; + return ( + "mousewheel" == n + ? ((t.deltaY = -0.025 * e.wheelDelta), + e.wheelDeltaX && (t.deltaX = -0.025 * e.wheelDeltaX)) + : (t.deltaY = e.detail), + o(t) + ); + }, + a || false + ); } - window.addEventListener ? i = "addEventListener" : (i = "attachEvent", - r = "on"), - n = "onwheel"in document.createElement("div") ? "wheel" : void 0 !== document.onmousewheel ? "mousewheel" : "DOMMouseScroll", - e.exports = function(e, t, i) { + window.addEventListener + ? (i = "addEventListener") + : ((i = "attachEvent"), (r = "on")), + (n = + "onwheel" in document.createElement("div") + ? "wheel" + : void 0 !== document.onmousewheel + ? "mousewheel" + : "DOMMouseScroll"), + (e.exports = function (e, t, i) { o(e, n, t, i), - "DOMMouseScroll" == n && o(e, "MozMousePixelScroll", t, i) - } -} -, function(e, t) { + "DOMMouseScroll" == n && o(e, "MozMousePixelScroll", t, i); + }); + }, + function (e, t) { function i(e) { - return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (i = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - "object" === i(window.performance) ? window.performance.now ? e.exports = function() { - return window.performance.now() - } - : window.performance.webkitNow && (e.exports = function() { - return window.performance.webkitNow() - } - ) : Date.now ? e.exports = Date.now : e.exports = function() { - return (new Date).getTime() - } -} -, function(e, t, getterFunc) { + "object" === i(window.performance) + ? window.performance.now + ? (e.exports = function () { + return window.performance.now(); + }) + : window.performance.webkitNow && + (e.exports = function () { + return window.performance.webkitNow(); + }) + : Date.now + ? (e.exports = Date.now) + : (e.exports = function () { + return new Date().getTime(); + }); + }, + function (e, t, getterFunc) { "use strict"; var n = getterFunc(32); @@ -100826,3207 +138052,3462 @@ and limitations under the License. var s = getterFunc(43).removeUnorderedListItem; if (!BABYLON) - throw new Error("Babylon.js reference not found! Abort! Abort!"); - e.exports = function(e, t, i) { - return new h(e,t,i) - } - ; - var c = BABYLON.Vector3 - , u = BABYLON.Color3; + throw new Error("Babylon.js reference not found! Abort! Abort!"); + e.exports = function (e, t, i) { + return new h(e, t, i); + }; + var c = BABYLON.Vector3, + u = BABYLON.Color3; window.BABYLON = BABYLON; var l = { - showFPS: false, - antiAlias: true, - clearColor: [.588, .835, 1], - ambientColor: [1, 1, 1], - lightDiffuse: [1, 1, 1], - lightSpecular: [1, 1, 1], - groundLightColor: [.5, .5, .5], - initialCameraZoom: 0, - cameraZoomSpeed: .2, - cameraMaxAngle: Math.PI / 2 - .01, - useAO: true, - AOmultipliers: [.93, .8, .5], - reverseAOmultiplier: 1 + showFPS: false, + antiAlias: true, + clearColor: [0.588, 0.835, 1], + ambientColor: [1, 1, 1], + lightDiffuse: [1, 1, 1], + lightSpecular: [1, 1, 1], + groundLightColor: [0.5, 0.5, 0.5], + initialCameraZoom: 0, + cameraZoomSpeed: 0.2, + cameraMaxAngle: Math.PI / 2 - 0.01, + useAO: true, + AOmultipliers: [0.93, 0.8, 0.5], + reverseAOmultiplier: 1, }; function h(e, t, i) { - this.noa = e; - var r = n({}, l, t); - this.zoomDistance = r.initialCameraZoom, - this._currentZoom = this.zoomDistance, - this._cameraZoomSpeed = r.cameraZoomSpeed, - this._maxCamAngle = r.cameraMaxAngle, - function(e, t, i) { - if (!BABYLON) - throw new Error("BABYLON.js engine not found!"); - e._engine = new BABYLON.Engine(t,i.antiAlias,void 0,true), - e._scene = new BABYLON.Scene(e._engine); - var n = e._scene; - function r(e) { - return new u(e[0],e[1],e[2]) - } - n.detachControl(), - e._octree = new BABYLON.Octree, - e._octree.blocks = [], - n._selectionOctree = e._octree, - e._rotationHolder = new BABYLON.Mesh("rotHolder",n), - e._cameraHolder = new BABYLON.Mesh("camHolder",n), - e._camera = new BABYLON.FreeCamera("camera",new c(0,0,0),n), - e._camera.parent = e._cameraHolder, - e._camera.minZ = .01, - e._cameraHolder.visibility = false, - e._rotationHolder.visibility = false, - e._camScreen = BABYLON.Mesh.CreatePlane("camScreen", 10, n), + this.noa = e; + var r = n({}, l, t); + (this.zoomDistance = r.initialCameraZoom), + (this._currentZoom = this.zoomDistance), + (this._cameraZoomSpeed = r.cameraZoomSpeed), + (this._maxCamAngle = r.cameraMaxAngle), + (function (e, t, i) { + if (!BABYLON) throw new Error("BABYLON.js engine not found!"); + (e._engine = new BABYLON.Engine(t, i.antiAlias, void 0, true)), + (e._scene = new BABYLON.Scene(e._engine)); + var n = e._scene; + function r(e) { + return new u(e[0], e[1], e[2]); + } + n.detachControl(), + (e._octree = new BABYLON.Octree()), + (e._octree.blocks = []), + (n._selectionOctree = e._octree), + (e._rotationHolder = new BABYLON.Mesh("rotHolder", n)), + (e._cameraHolder = new BABYLON.Mesh("camHolder", n)), + (e._camera = new BABYLON.FreeCamera("camera", new c(0, 0, 0), n)), + (e._camera.parent = e._cameraHolder), + (e._camera.minZ = 0.01), + (e._cameraHolder.visibility = false), + (e._rotationHolder.visibility = false), + (e._camScreen = BABYLON.Mesh.CreatePlane("camScreen", 10, n)), e.addDynamicMesh(e._camScreen), - e._camScreen.position.z = .11, - e._camScreen.parent = e._camera, - e._camScreenMat = e.makeStandardMaterial("camscreenmat"), - e._camScreenMat.specularColor = new u(0,0,0), - e._camScreen.material = e._camScreenMat, + (e._camScreen.position.z = 0.11), + (e._camScreen.parent = e._camera), + (e._camScreenMat = e.makeStandardMaterial("camscreenmat")), + (e._camScreenMat.specularColor = new u(0, 0, 0)), + (e._camScreen.material = e._camScreenMat), e._camScreen.setEnabled(false), - e._camLocBlock = 0, - e._light = new BABYLON.HemisphericLight("light",new c(.1,1,.3),n), - n.clearColor = r(i.clearColor), - n.ambientColor = r(i.ambientColor), - e._light.diffuse = r(i.lightDiffuse), - e._light.specular = r(i.lightSpecular), - e._light.groundColor = r(i.groundLightColor), - e.flatMaterial = e.makeStandardMaterial("flatmat"), - e.flatMaterial.specularColor = BABYLON.Color3.Black() - }(this, i, r), - this._meshedChunks = {}, - this._numMeshedChunks = 0, - this.useAO = !!r.useAO, - this.aoVals = r.AOmultipliers, - this.revAoVal = r.reverseAOmultiplier, - this.meshingCutoffTime = 6, - window.scene = this._scene, - r.showFPS && function() { + (e._camLocBlock = 0), + (e._light = new BABYLON.HemisphericLight( + "light", + new c(0.1, 1, 0.3), + n + )), + (n.clearColor = r(i.clearColor)), + (n.ambientColor = r(i.ambientColor)), + (e._light.diffuse = r(i.lightDiffuse)), + (e._light.specular = r(i.lightSpecular)), + (e._light.groundColor = r(i.groundLightColor)), + (e.flatMaterial = e.makeStandardMaterial("flatmat")), + (e.flatMaterial.specularColor = BABYLON.Color3.Black()); + })(this, i, r), + (this._meshedChunks = {}), + (this._numMeshedChunks = 0), + (this.useAO = !!r.useAO), + (this.aoVals = r.AOmultipliers), + (this.revAoVal = r.reverseAOmultiplier), + (this.meshingCutoffTime = 6), + (window.scene = this._scene), + r.showFPS && + (function () { var e = document.createElement("div"); e.id = "noa_fps"; "color:white; background-color:rgba(0,0,0,0.5);", - "font:14px monospace; text-align:center;", - "min-width:2em; margin:4px;", - e.style = "position:absolute; top:0; right:0; z-index:0;color:white; background-color:rgba(0,0,0,0.5);font:14px monospace; text-align:center;min-width:2em; margin:4px;", - document.body.appendChild(e); - var t = 0 - , i = 0 - , n = performance.now() - , r = n; - E = function() { - t++; - var o = performance.now(); - if (o - r > i && (i = o - r), - r = o, - !(o - n < 1e3)) { - var a = Math.round(t / (o - n) * 1e3) - , s = Math.round(1 / i * 1e3); - e.innerHTML = a + "
" + s, - t = 0, - i = 0, - n = o - } - } - }() + "font:14px monospace; text-align:center;", + "min-width:2em; margin:4px;", + (e.style = + "position:absolute; top:0; right:0; z-index:0;color:white; background-color:rgba(0,0,0,0.5);font:14px monospace; text-align:center;min-width:2em; margin:4px;"), + document.body.appendChild(e); + var t = 0, + i = 0, + n = performance.now(), + r = n; + E = function () { + t++; + var o = performance.now(); + if ((o - r > i && (i = o - r), (r = o), !(o - n < 1e3))) { + var a = Math.round((t / (o - n)) * 1e3), + s = Math.round((1 / i) * 1e3); + (e.innerHTML = a + "
" + s), (t = 0), (i = 0), (n = o); + } + }; + })(); } - h.prototype.initScene = function() { - this.cameraTarget = this.noa.ents.createEntity(["position"]), + (h.prototype.initScene = function () { + (this.cameraTarget = this.noa.ents.createEntity(["position"])), this.noa.ents.addComponent(this.cameraTarget, "followsEntity", { - entity: this.noa.playerEntity, - offset: [0, this.noa.playerEyeOffset, 0] - }) - } - , - h.prototype.getScene = function() { - return this._scene - } - , - h.prototype.tick = function(e) {} - ; + entity: this.noa.playerEntity, + offset: [0, this.noa.playerEyeOffset, 0], + }); + }), + (h.prototype.getScene = function () { + return this._scene; + }), + (h.prototype.tick = function (e) {}); var f = 0; - h.prototype.render = function(e) { - f += e, - function(e) { - e._cameraHolder.rotation.copyFrom(e._rotationHolder.rotation); - var t = e.noa.ents.getPositionData(e.cameraTarget).renderPosition; - e._cameraHolder.position.copyFromFloats(t[0], t[1], t[2]); - var i = e.zoomDistance - , n = e._cameraZoomSpeed; - i > 0 && (i = function(e) { - m || (m = new o([0, 0, 0],[.4, .4, .4]), - g = function(t, i, n) { - return e.noa.world.getBlockSolidity(t, i, n) - } - ); - var t = e._cameraHolder.position; - vec3Math.set(_, t.x - .2, t.y - .2, t.z - .2), + (h.prototype.render = function (e) { + (f += e), + (function (e) { + e._cameraHolder.rotation.copyFrom(e._rotationHolder.rotation); + var t = e.noa.ents.getPositionData(e.cameraTarget).renderPosition; + e._cameraHolder.position.copyFromFloats(t[0], t[1], t[2]); + var i = e.zoomDistance, + n = e._cameraZoomSpeed; + i > 0 && + (i = (function (e) { + m || + ((m = new o([0, 0, 0], [0.4, 0.4, 0.4])), + (g = function (t, i, n) { + return e.noa.world.getBlockSolidity(t, i, n); + })); + var t = e._cameraHolder.position; + vec3Math.set(_, t.x - 0.2, t.y - 0.2, t.z - 0.2), m.setPosition(_); - var i = -e.zoomDistance - , n = e.getCameraVector(); - return vec3Math.set(v, i * n.x, i * n.y, i * n.z), - a(g, m, v, function(e, t, i, n) { - return true - }, true) - }(e)) < e._currentZoom && (e._currentZoom = i); - e._currentZoom += n * (i - e._currentZoom), - e._camera.position.z = -e._currentZoom; - var s = e.getCameraPosition() - , c = e.noa.world.getBlockID(Math.floor(s.x), Math.floor(s.y), Math.floor(s.z)); - !function(e, t) { - if (t === e._camLocBlock) - return; - if (0 === t || 40 === t) - e._camScreen.setEnabled(false), - e._scene.fogColor = new BABYLON.Color3(.9,.95,1), - e._scene.fogDensity = e.fogWorld, - e._scene.clearColor = e._scene.fogColor; - else { - var i = e.noa.registry.getBlockFaceMaterialAccessor() - , n = i(t, 1) - , r = e.noa.registry.getMaterialData(n) - , o = r.color - , a = r.alpha; - o && a && a < 1 && (17 == t && (e._camScreenMat.diffuseColor = new u(.8,0,0), - e._camScreenMat.alpha = .8, - e._camScreen.setEnabled(true), - e._scene.fogColor = new BABYLON.Color3(.1,0,0), - e._scene.fogDensity = e.fogLava, - e._scene.clearColor = e._scene.fogColor), - 7 != t && 41 != t || (e._camScreenMat.diffuseColor = new u(0,0,.8), - e._camScreenMat.alpha = .5, - e._camScreen.setEnabled(true), - e._scene.fogColor = new BABYLON.Color3(0,0,.1), - e._scene.fogDensity = e.fogWater, - e._scene.clearColor = e._scene.fogColor)) - } - e._camLocBlock = t - }(e, c) - }(this), + var i = -e.zoomDistance, + n = e.getCameraVector(); + return ( + vec3Math.set(v, i * n.x, i * n.y, i * n.z), + a( + g, + m, + v, + function (e, t, i, n) { + return true; + }, + true + ) + ); + })(e)) < e._currentZoom && + (e._currentZoom = i); + (e._currentZoom += n * (i - e._currentZoom)), + (e._camera.position.z = -e._currentZoom); + var s = e.getCameraPosition(), + c = e.noa.world.getBlockID( + Math.floor(s.x), + Math.floor(s.y), + Math.floor(s.z) + ); + !(function (e, t) { + if (t === e._camLocBlock) return; + if (0 === t || 40 === t) + e._camScreen.setEnabled(false), + (e._scene.fogColor = new BABYLON.Color3(0.9, 0.95, 1)), + (e._scene.fogDensity = e.fogWorld), + (e._scene.clearColor = e._scene.fogColor); + else { + var i = e.noa.registry.getBlockFaceMaterialAccessor(), + n = i(t, 1), + r = e.noa.registry.getMaterialData(n), + o = r.color, + a = r.alpha; + o && + a && + a < 1 && + (17 == t && + ((e._camScreenMat.diffuseColor = new u(0.8, 0, 0)), + (e._camScreenMat.alpha = 0.8), + e._camScreen.setEnabled(true), + (e._scene.fogColor = new BABYLON.Color3(0.1, 0, 0)), + (e._scene.fogDensity = e.fogLava), + (e._scene.clearColor = e._scene.fogColor)), + (7 != t && 41 != t) || + ((e._camScreenMat.diffuseColor = new u(0, 0, 0.8)), + (e._camScreenMat.alpha = 0.5), + e._camScreen.setEnabled(true), + (e._scene.fogColor = new BABYLON.Color3(0, 0, 0.1)), + (e._scene.fogDensity = e.fogWater), + (e._scene.clearColor = e._scene.fogColor))); + } + e._camLocBlock = t; + })(e, c); + })(this), this._engine.beginFrame(), this._scene.render(), this.noa.addMode || y(this, f), this.noa.addMode && b(this, f), E(), this._engine.endFrame(), - this.noa.version && (this.noa.version.fps = Math.round(1e3 / this._scene.getEngine().getDeltaTime()), - this.noa.version.chunkUpdates += this.noa.world._blockChanges, - this.noa.version.redraw(), - this.noa.world._blockChanges = 0), - this.noa.inputs.tick() - } - , - h.prototype.resize = function(e) { - this._engine.resize() - } - , - h.prototype.highlightBlockFace = function(e, t, i, n) { - var o = function(e) { - var t = e._highlightMesh; - if (!t) { - var i = BABYLON.Mesh.CreateBox("highlight", 1.005, e._scene) - , n = e.makeDynamicStandardMaterial("highlightMat"); - n.disableLighting = true, - n.backFaceCulling = false, - n.emissiveColor = new u(1,1,1), - n.alpha = .2, - i.material = n, - t = e._highlightMesh = i; - var r = .5 - , o = BABYLON.Mesh.CreateLines("hightlightLines", [new c(r,r,r), new c(r,-r,r), new c(-r,-r,r), new c(-r,r,r), new c(r,r,r), new c(r,r,-r), new c(r,-r,-r), new c(-r,-r,-r), new c(-r,r,-r), new c(r,r,-r), new c(r,r,r), new c(r,-r,r), new c(r,-r,-r), new c(r,r,-r), new c(r,r,r), new c(-r,r,r), new c(-r,-r,r), new c(-r,-r,-r), new c(-r,r,-r), new c(-r,r,r)], e._scene); - o.color = new u(0,0,0), - o.parent = i, - e.addDynamicMesh(t), - e.addDynamicMesh(o) - } - return t - }(this); + this.noa.version && + ((this.noa.version.fps = Math.round( + 1e3 / this._scene.getEngine().getDeltaTime() + )), + (this.noa.version.chunkUpdates += this.noa.world._blockChanges), + this.noa.version.redraw(), + (this.noa.world._blockChanges = 0)), + this.noa.inputs.tick(); + }), + (h.prototype.resize = function (e) { + this._engine.resize(); + }), + (h.prototype.highlightBlockFace = function (e, t, i, n) { + var o = (function (e) { + var t = e._highlightMesh; + if (!t) { + var i = BABYLON.Mesh.CreateBox("highlight", 1.005, e._scene), + n = e.makeDynamicStandardMaterial("highlightMat"); + (n.disableLighting = true), + (n.backFaceCulling = false), + (n.emissiveColor = new u(1, 1, 1)), + (n.alpha = 0.2), + (i.material = n), + (t = e._highlightMesh = i); + var r = 0.5, + o = BABYLON.Mesh.CreateLines( + "hightlightLines", + [ + new c(r, r, r), + new c(r, -r, r), + new c(-r, -r, r), + new c(-r, r, r), + new c(r, r, r), + new c(r, r, -r), + new c(r, -r, -r), + new c(-r, -r, -r), + new c(-r, r, -r), + new c(r, r, -r), + new c(r, r, r), + new c(r, -r, r), + new c(r, -r, -r), + new c(r, r, -r), + new c(r, r, r), + new c(-r, r, r), + new c(-r, -r, r), + new c(-r, -r, -r), + new c(-r, r, -r), + new c(-r, r, r), + ], + e._scene + ); + (o.color = new u(0, 0, 0)), + (o.parent = i), + e.addDynamicMesh(t), + e.addDynamicMesh(o); + } + return t; + })(this); if (e && !n) { - this._currentZoom, + this._currentZoom, vec3Math.distance(this.noa.getPlayerEyePosition(), t); - for (var a = 0, s = d, l = 0; l < 3; ++l) - s[l] = t[l] + .5; - o.position.copyFromFloats(s[0], s[1], s[2]), - o.setEnabled(true) - } else - o.setEnabled(false); - o = function(e) { - var t = function() { - var e = noa.rendering.getScene() - , t = .25 * Math.PI - , i = BABYLON.Mesh.CreatePlane("plane1", 1, e) - , n = BABYLON.Mesh.CreatePlane("plane2", 1, e); - i.rotation.y = t, - n.rotation.y = Math.PI + t; - var r = BABYLON.Mesh.CreatePlane("plane3", 1, e) - , o = BABYLON.Mesh.CreatePlane("plane4", 1, e); - r.rotation.y = .5 * -Math.PI + t, - o.rotation.y = .5 * Math.PI + t, - i.position = new BABYLON.Vector3(0,0,.5), - n.position = new BABYLON.Vector3(0,0,.5), - r.position = new BABYLON.Vector3(0,0,.5), - o.position = new BABYLON.Vector3(0,0,.5); - var a = BABYLON.Mesh.MergeMeshes([i, n, r, o]); - return a - } - , i = e._previewMesh; - if (!i) { - var n = BABYLON.Mesh.CreatePlane("preview0", 1, e._scene) - , r = e.makeDynamicStandardMaterial("previewMat0"); - r.diffuseTexture = new BABYLON.Texture(null,e._scene), - n.material = r; - var o = BABYLON.Mesh.CreatePlane("preview1", 1, e._scene) - , r = e.makeDynamicStandardMaterial("previewMat1"); - r.diffuseTexture = new BABYLON.Texture(null,e._scene), - o.material = r, - o.parent = n, - o.rotation.y = Math.PI, - o.position = new BABYLON.Vector3(0,0,1); - var a = BABYLON.Mesh.CreatePlane("preview2", 1, e._scene) - , r = e.makeDynamicStandardMaterial("previewMat2"); - r.diffuseTexture = new BABYLON.Texture(null,e._scene), - a.material = r, - a.parent = n, - a.rotation.y = .5 * Math.PI, - a.position = new BABYLON.Vector3(-.5,0,.5); - var s = BABYLON.Mesh.CreatePlane("preview3", 1, e._scene) - , r = e.makeDynamicStandardMaterial("previewMat3"); - r.diffuseTexture = new BABYLON.Texture(null,e._scene), - s.material = r, - s.parent = n, - s.rotation.y = -.5 * Math.PI, - s.position = new BABYLON.Vector3(.5,0,.5); - var l = BABYLON.Mesh.CreatePlane("preview4", 1, e._scene) - , r = e.makeDynamicStandardMaterial("previewMat4"); - r.diffuseTexture = new BABYLON.Texture(null,e._scene), - l.material = r, - l.parent = n, - l.rotation.x = -.5 * Math.PI, - l.rotation.y = Math.PI, - l.position = new BABYLON.Vector3(0,-.5,.5); - var h = BABYLON.Mesh.CreatePlane("preview5", 1, e._scene) - , r = e.makeDynamicStandardMaterial("previewMat5"); - r.diffuseTexture = new BABYLON.Texture(null,e._scene), - h.material = r, - h.parent = n, - h.rotation.x = .5 * Math.PI, - h.position = new BABYLON.Vector3(0,.5,.5); - var f = .5 - , d = BABYLON.Mesh.CreateLines("previewLines", [new c(f,f,f), new c(f,-f,f), new c(-f,-f,f), new c(-f,f,f), new c(f,f,f), new c(f,f,-f), new c(f,-f,-f), new c(-f,-f,-f), new c(-f,f,-f), new c(f,f,-f), new c(f,f,f), new c(f,-f,f), new c(f,-f,-f), new c(f,f,-f), new c(f,f,f), new c(-f,f,f), new c(-f,-f,f), new c(-f,-f,-f), new c(-f,f,-f), new c(-f,f,f)], e._scene); - d.color = new u(0,0,0), - d.position = new BABYLON.Vector3(0,0,.5), - d.parent = n; - var t = t(); - t.parent = n; - var r = e.makeStandardMaterial("crossMat"); - r.diffuseTexture = new BABYLON.Texture(null,e._scene), - t.material = r, - i = e._previewMesh = n, - e.addDynamicMesh(i), - e.addDynamicMesh(o), - e.addDynamicMesh(a), - e.addDynamicMesh(s), - e.addDynamicMesh(l), - e.addDynamicMesh(h), - e.addDynamicMesh(d), - e.addDynamicMesh(t) - } - return i - }(this); + for (var a = 0, s = d, l = 0; l < 3; ++l) s[l] = t[l] + 0.5; + o.position.copyFromFloats(s[0], s[1], s[2]), o.setEnabled(true); + } else o.setEnabled(false); + o = (function (e) { + var t = function () { + var e = noa.rendering.getScene(), + t = 0.25 * Math.PI, + i = BABYLON.Mesh.CreatePlane("plane1", 1, e), + n = BABYLON.Mesh.CreatePlane("plane2", 1, e); + (i.rotation.y = t), (n.rotation.y = Math.PI + t); + var r = BABYLON.Mesh.CreatePlane("plane3", 1, e), + o = BABYLON.Mesh.CreatePlane("plane4", 1, e); + (r.rotation.y = 0.5 * -Math.PI + t), + (o.rotation.y = 0.5 * Math.PI + t), + (i.position = new BABYLON.Vector3(0, 0, 0.5)), + (n.position = new BABYLON.Vector3(0, 0, 0.5)), + (r.position = new BABYLON.Vector3(0, 0, 0.5)), + (o.position = new BABYLON.Vector3(0, 0, 0.5)); + var a = BABYLON.Mesh.MergeMeshes([i, n, r, o]); + return a; + }, + i = e._previewMesh; + if (!i) { + var n = BABYLON.Mesh.CreatePlane("preview0", 1, e._scene), + r = e.makeDynamicStandardMaterial("previewMat0"); + (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), + (n.material = r); + var o = BABYLON.Mesh.CreatePlane("preview1", 1, e._scene), + r = e.makeDynamicStandardMaterial("previewMat1"); + (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), + (o.material = r), + (o.parent = n), + (o.rotation.y = Math.PI), + (o.position = new BABYLON.Vector3(0, 0, 1)); + var a = BABYLON.Mesh.CreatePlane("preview2", 1, e._scene), + r = e.makeDynamicStandardMaterial("previewMat2"); + (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), + (a.material = r), + (a.parent = n), + (a.rotation.y = 0.5 * Math.PI), + (a.position = new BABYLON.Vector3(-0.5, 0, 0.5)); + var s = BABYLON.Mesh.CreatePlane("preview3", 1, e._scene), + r = e.makeDynamicStandardMaterial("previewMat3"); + (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), + (s.material = r), + (s.parent = n), + (s.rotation.y = -0.5 * Math.PI), + (s.position = new BABYLON.Vector3(0.5, 0, 0.5)); + var l = BABYLON.Mesh.CreatePlane("preview4", 1, e._scene), + r = e.makeDynamicStandardMaterial("previewMat4"); + (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), + (l.material = r), + (l.parent = n), + (l.rotation.x = -0.5 * Math.PI), + (l.rotation.y = Math.PI), + (l.position = new BABYLON.Vector3(0, -0.5, 0.5)); + var h = BABYLON.Mesh.CreatePlane("preview5", 1, e._scene), + r = e.makeDynamicStandardMaterial("previewMat5"); + (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), + (h.material = r), + (h.parent = n), + (h.rotation.x = 0.5 * Math.PI), + (h.position = new BABYLON.Vector3(0, 0.5, 0.5)); + var f = 0.5, + d = BABYLON.Mesh.CreateLines( + "previewLines", + [ + new c(f, f, f), + new c(f, -f, f), + new c(-f, -f, f), + new c(-f, f, f), + new c(f, f, f), + new c(f, f, -f), + new c(f, -f, -f), + new c(-f, -f, -f), + new c(-f, f, -f), + new c(f, f, -f), + new c(f, f, f), + new c(f, -f, f), + new c(f, -f, -f), + new c(f, f, -f), + new c(f, f, f), + new c(-f, f, f), + new c(-f, -f, f), + new c(-f, -f, -f), + new c(-f, f, -f), + new c(-f, f, f), + ], + e._scene + ); + (d.color = new u(0, 0, 0)), + (d.position = new BABYLON.Vector3(0, 0, 0.5)), + (d.parent = n); + var t = t(); + t.parent = n; + var r = e.makeStandardMaterial("crossMat"); + (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), + (t.material = r), + (i = e._previewMesh = n), + e.addDynamicMesh(i), + e.addDynamicMesh(o), + e.addDynamicMesh(a), + e.addDynamicMesh(s), + e.addDynamicMesh(l), + e.addDynamicMesh(h), + e.addDynamicMesh(d), + e.addDynamicMesh(t); + } + return i; + })(this); if (e && n) { - for (this._currentZoom, - vec3Math.distance(this.noa.getPlayerEyePosition(), t), - a = 0, - s = d, - l = 0; l < 3; ++l) - s[l] = t[l] + .5 + (1 + a) * i[l]; - o.position.copyFromFloats(s[0], s[1], s[2] - .5), - o.setEnabled(true) - } else - o.setEnabled(false) - } - ; + for ( + this._currentZoom, + vec3Math.distance(this.noa.getPlayerEyePosition(), t), + a = 0, + s = d, + l = 0; + l < 3; + ++l + ) + s[l] = t[l] + 0.5 + (1 + a) * i[l]; + o.position.copyFromFloats(s[0], s[1], s[2] - 0.5), o.setEnabled(true); + } else o.setEnabled(false); + }); var d = vec3Math.create(); - h.prototype.getCameraVector = function() { - return c.TransformCoordinates(BABYLON.Axis.Z, this._rotationHolder.getWorldMatrix()) - } - ; + h.prototype.getCameraVector = function () { + return c.TransformCoordinates( + BABYLON.Axis.Z, + this._rotationHolder.getWorldMatrix() + ); + }; var p = c.Zero(); - h.prototype.getCameraPosition = function() { - return c.TransformCoordinates(p, this._camera.getWorldMatrix()) - } - , - h.prototype.getCameraRotation = function() { + (h.prototype.getCameraPosition = function () { + return c.TransformCoordinates(p, this._camera.getWorldMatrix()); + }), + (h.prototype.getCameraRotation = function () { var e = this._rotationHolder.rotation; - return [e.x, e.y] - } - , - h.prototype.setCameraRotation = function(e, t) { + return [e.x, e.y]; + }), + (h.prototype.setCameraRotation = function (e, t) { var i = this._rotationHolder.rotation; - i.x = Math.max(-this._maxCamAngle, Math.min(this._maxCamAngle, e)), - i.y = t - } - , - h.prototype.addDynamicMesh = function(e) { + (i.x = Math.max(-this._maxCamAngle, Math.min(this._maxCamAngle, e))), + (i.y = t); + }), + (h.prototype.addDynamicMesh = function (e) { if (!((t = this._octree.dynamicContent.indexOf(e)) >= 0)) { - this._octree.dynamicContent.push(e); - for (var t = 0; t < e.getChildren().length; t++) - this._octree.dynamicContent.push(e.getChildren()[t]), - e.getChildren()[t].useOctreeForCollisions = true; - var i = s.bind(null, this._octree.dynamicContent, e); - if (e.onDisposeObservable) - e.onDisposeObservable.add(i); - else { - var n = e.onDispose || function() {} - ; - e.onDispose = function() { - n(), - i() - } - } + this._octree.dynamicContent.push(e); + for (var t = 0; t < e.getChildren().length; t++) + this._octree.dynamicContent.push(e.getChildren()[t]), + (e.getChildren()[t].useOctreeForCollisions = true); + var i = s.bind(null, this._octree.dynamicContent, e); + if (e.onDisposeObservable) e.onDisposeObservable.add(i); + else { + var n = e.onDispose || function () {}; + e.onDispose = function () { + n(), i(); + }; + } } - } - , - h.prototype.removeDynamicMesh = function(e) { - s(this._octree.dynamicContent, e) - } - , - h.prototype.makeMeshInstance = function(e, t) { + }), + (h.prototype.removeDynamicMesh = function (e) { + s(this._octree.dynamicContent, e); + }), + (h.prototype.makeMeshInstance = function (e, t) { var i = e.createInstance(e.name + " instance" || false); - return e.billboardMode && (i.billboardMode = e.billboardMode), - t || this.addDynamicMesh(i), - e.getLOD = i.getLOD = function() { - return e - } - , - i._currentLOD = e, - t && (i.isInFrustum = function() { - return true - } - ), - i - } - , - h.prototype.makeStandardMaterial = function(e) { - var t = new BABYLON.StandardMaterial(e,this._scene); - return setTimeout(function() { - t.freeze() - }, 10), - t - } - , - h.prototype.makeDynamicStandardMaterial = function(e) { - return new BABYLON.StandardMaterial(e,this._scene) - } - , - h.prototype.prepareChunkForRendering = function(e) { - var t = e.size - , i = new c(e.x,e.y,e.z) - , n = new c(e.x + t,e.y + t,e.z + t); - e.octreeBlock = new BABYLON.OctreeBlock(i,n), - this._octree.blocks.push(e.octreeBlock), - window.chunk = e - } - , - h.prototype.disposeChunkForRendering = function(e) { - this.removeTerrainMesh(e), - s(this._octree.blocks, e.octreeBlock), - e.octreeBlock.entries.length = 0, - e.octreeBlock = null - } - , - h.prototype.addTerrainMesh = function(e, t) { - this._meshedChunks[e.id] = t, - this._numMeshedChunks++, - t.getIndices().length && e.octreeBlock.entries.push(t), - t.getChildren().map(function(t) { - e.octreeBlock.entries.push(t) - }) - } - , - h.prototype.removeTerrainMesh = function(e) { - var t = this._meshedChunks[e.id]; - t && (s(e.octreeBlock.entries, t), - t.getChildren().map(function(t) { - s(e.octreeBlock.entries, t) - }), - t.dispose(), - delete this._meshedChunks[e.id], - this._numMeshedChunks--) - } - ; - var m, g, _ = vec3Math.create(), v = vec3Math.create(); - var y = function(e, t) { - var i = e._highlightMesh; - i && (i.material.alpha = .05 + .25 * Math.abs(Math.sin(.005 * t))) - }; - var b = function(e, t) { - var i = e._previewMesh; - if (i) { - var n = .35 + .35 * Math.abs(Math.sin(.003 * t)); - i.material.alpha = n, - i._children[0].material.alpha = n, - i._children[1].material.alpha = n, - i._children[2].material.alpha = n, - i._children[3].material.alpha = n, - i._children[4].material.alpha = n, - i._children[6].material.alpha = n - } - }; - h.prototype.debug_SceneCheck = function() { - var e = this._scene.meshes - , t = this._octree.dynamicContent - , i = [] - , n = this._scene.materials - , r = []; - n.forEach(function(e) { - e.subMaterials ? e.subMaterials.forEach(function(e) { - return r.push(e) - }) : r.push(e) - }), - this._octree.blocks.forEach(function(e) { - for (var t in e.entries) - i.push(e.entries[t]) - }), - e.forEach(function(e) { - (e._isDisposed && a(e, "disposed mesh in scene"), - 0 !== e.getIndices().length) && (s(e, t, i) && a(e, "non-empty mesh missing from octree"), - e.material ? (e.material.subMaterials || [e.material]).forEach(function(e) { - s(e, n) && a(e, "mesh material not in scene") - }) : a(e, "non-empty scene mesh with no material")) - }); - var o = []; - function a(e, t) { - console.warn(e.name + " --- " + t) - } - function s(e, t, i) { - return !!e && (i ? !(t.includes(e) || i.includes(e)) : !t.includes(e)) - } - return r.forEach(function(t) { - var i = false; - e.forEach(function(e) { - e.material === t && (i = true), - e.material && e.material.subMaterials && e.material.subMaterials.includes(t) && (i = true) + return ( + e.billboardMode && (i.billboardMode = e.billboardMode), + t || this.addDynamicMesh(i), + (e.getLOD = i.getLOD = + function () { + return e; }), - i || o.push(t.name) + (i._currentLOD = e), + t && + (i.isInFrustum = function () { + return true; + }), + i + ); + }), + (h.prototype.makeStandardMaterial = function (e) { + var t = new BABYLON.StandardMaterial(e, this._scene); + return ( + setTimeout(function () { + t.freeze(); + }, 10), + t + ); + }), + (h.prototype.makeDynamicStandardMaterial = function (e) { + return new BABYLON.StandardMaterial(e, this._scene); + }), + (h.prototype.prepareChunkForRendering = function (e) { + var t = e.size, + i = new c(e.x, e.y, e.z), + n = new c(e.x + t, e.y + t, e.z + t); + (e.octreeBlock = new BABYLON.OctreeBlock(i, n)), + this._octree.blocks.push(e.octreeBlock), + (window.chunk = e); + }), + (h.prototype.disposeChunkForRendering = function (e) { + this.removeTerrainMesh(e), + s(this._octree.blocks, e.octreeBlock), + (e.octreeBlock.entries.length = 0), + (e.octreeBlock = null); + }), + (h.prototype.addTerrainMesh = function (e, t) { + (this._meshedChunks[e.id] = t), + this._numMeshedChunks++, + t.getIndices().length && e.octreeBlock.entries.push(t), + t.getChildren().map(function (t) { + e.octreeBlock.entries.push(t); + }); + }), + (h.prototype.removeTerrainMesh = function (e) { + var t = this._meshedChunks[e.id]; + t && + (s(e.octreeBlock.entries, t), + t.getChildren().map(function (t) { + s(e.octreeBlock.entries, t); + }), + t.dispose(), + delete this._meshedChunks[e.id], + this._numMeshedChunks--); + }); + var m, + g, + _ = vec3Math.create(), + v = vec3Math.create(); + var y = function (e, t) { + var i = e._highlightMesh; + i && (i.material.alpha = 0.05 + 0.25 * Math.abs(Math.sin(0.005 * t))); + }; + var b = function (e, t) { + var i = e._previewMesh; + if (i) { + var n = 0.35 + 0.35 * Math.abs(Math.sin(0.003 * t)); + (i.material.alpha = n), + (i._children[0].material.alpha = n), + (i._children[1].material.alpha = n), + (i._children[2].material.alpha = n), + (i._children[3].material.alpha = n), + (i._children[4].material.alpha = n), + (i._children[6].material.alpha = n); + } + }; + (h.prototype.debug_SceneCheck = function () { + var e = this._scene.meshes, + t = this._octree.dynamicContent, + i = [], + n = this._scene.materials, + r = []; + n.forEach(function (e) { + e.subMaterials + ? e.subMaterials.forEach(function (e) { + return r.push(e); + }) + : r.push(e); + }), + this._octree.blocks.forEach(function (e) { + for (var t in e.entries) i.push(e.entries[t]); }), - o.length && console.warn("Materials unused by any mesh: ", o.join(", ")), - t.forEach(function(t) { - s(t, e) && a(t, "octree/dynamic mesh not in scene") + e.forEach(function (e) { + (e._isDisposed && a(e, "disposed mesh in scene"), + 0 !== e.getIndices().length) && + (s(e, t, i) && a(e, "non-empty mesh missing from octree"), + e.material + ? (e.material.subMaterials || [e.material]).forEach(function (e) { + s(e, n) && a(e, "mesh material not in scene"); + }) + : a(e, "non-empty scene mesh with no material")); + }); + var o = []; + function a(e, t) { + console.warn(e.name + " --- " + t); + } + function s(e, t, i) { + return !!e && (i ? !(t.includes(e) || i.includes(e)) : !t.includes(e)); + } + return ( + r.forEach(function (t) { + var i = false; + e.forEach(function (e) { + e.material === t && (i = true), + e.material && + e.material.subMaterials && + e.material.subMaterials.includes(t) && + (i = true); + }), + i || o.push(t.name); }), - i.forEach(function(t) { - s(t, e) && a(t, "octree block mesh not in scene") + o.length && + console.warn("Materials unused by any mesh: ", o.join(", ")), + t.forEach(function (t) { + s(t, e) && a(t, "octree/dynamic mesh not in scene"); + }), + i.forEach(function (t) { + s(t, e) && a(t, "octree block mesh not in scene"); }), "done." - } - , - h.prototype.debug_MeshCount = function() { + ); + }), + (h.prototype.debug_MeshCount = function () { var e = {}; - for (var t in this._scene.meshes.forEach(function(t) { - var i = t.name || ""; - i = (i = (i = (i = i.replace(/-\d+.*/, "#")).replace(/\d+.*/, "#")).replace(/(rotHolder|camHolder|camScreen)/, "rendering use")).replace(/atlas sprite .*/, "atlas sprites"), - e[i] = e[i] || 0, - e[i]++ + for (var t in (this._scene.meshes.forEach(function (t) { + var i = t.name || ""; + (i = (i = (i = (i = i.replace(/-\d+.*/, "#")).replace( + /\d+.*/, + "#" + )).replace( + /(rotHolder|camHolder|camScreen)/, + "rendering use" + )).replace(/atlas sprite .*/, "atlas sprites")), + (e[i] = e[i] || 0), + e[i]++; }), - e) - console.log(" " + (e[t] + " ").substr(0, 7) + t) - } - ; - var E = function() {} -} -, function(e, t, i) { + e)) + console.log(" " + (e[t] + " ").substr(0, 7) + t); + }); + var E = function () {}; + }, + function (e, t, i) { "use strict"; - var n = i(32) - , r = (i(88), - i(460)) - , o = i(42).EventEmitter - , a = i(461); - e.exports = function(e, t) { - return new c(e,t) - } - ; + var n = i(32), + r = (i(88), i(460)), + o = i(42).EventEmitter, + a = i(461); + e.exports = function (e, t) { + return new c(e, t); + }; var s = { - chunkSize: 24, - chunkAddDistance: 3, - chunkRemoveDistance: 4 + chunkSize: 24, + chunkAddDistance: 3, + chunkRemoveDistance: 4, }; function c(e, t) { - this.noa = e; - var i = n(s, t); - this.userData = null, - this.playerChunkLoaded = false, - this.Chunk = a, - this.chunkSize = i.chunkSize, - this.chunkAddDistance = i.chunkAddDistance, - this.chunkRemoveDistance = i.chunkRemoveDistance, - this.chunkRemoveDistance < this.chunkAddDistance && (this.chunkRemoveDistance = this.chunkAddDistance), - this._chunkIDsToAdd = [], - this._chunkIDsToRemove = [], - this._chunkIDsInMemory = [], - this._chunkIDsToCreate = [], - this._chunkIDsToMesh = [], - this._chunkIDsToMeshFirst = [], - this._maxChunksPendingCreation = 20, - this._maxChunksPendingMeshing = 20, - this._maxProcessingPerTick = 9, - this._maxProcessingPerRender = 5, - this._blockChanges = 0; - var o = this; - e.on("beforeRender", function() { - !function(e) { - var t = performance.now() + e._maxProcessingPerRender - , i = false; - for (; !i && performance.now() < t; ) - (i = g(e, true)) || 0 - }(o) - }), - this._chunkHash = r([1024, 1024, 1024]) + this.noa = e; + var i = n(s, t); + (this.userData = null), + (this.playerChunkLoaded = false), + (this.Chunk = a), + (this.chunkSize = i.chunkSize), + (this.chunkAddDistance = i.chunkAddDistance), + (this.chunkRemoveDistance = i.chunkRemoveDistance), + this.chunkRemoveDistance < this.chunkAddDistance && + (this.chunkRemoveDistance = this.chunkAddDistance), + (this._chunkIDsToAdd = []), + (this._chunkIDsToRemove = []), + (this._chunkIDsInMemory = []), + (this._chunkIDsToCreate = []), + (this._chunkIDsToMesh = []), + (this._chunkIDsToMeshFirst = []), + (this._maxChunksPendingCreation = 20), + (this._maxChunksPendingMeshing = 20), + (this._maxProcessingPerTick = 9), + (this._maxProcessingPerRender = 5), + (this._blockChanges = 0); + var o = this; + e.on("beforeRender", function () { + !(function (e) { + var t = performance.now() + e._maxProcessingPerRender, + i = false; + for (; !i && performance.now() < t; ) (i = g(e, true)) || 0; + })(o); + }), + (this._chunkHash = r([1024, 1024, 1024])); } function u(e, t, i, n) { - var r = 0 - , o = 0 - , a = 0 - , s = true - , c = false - , u = void 0; - try { - for (var l, d = i[Symbol.iterator](); !(s = (l = d.next()).done); s = true) { - var p = l.value; - if (p.size) - p.isInvalid && r++; - else { - var m = h(p) - , g = f(e, m[0], m[1], m[2]); - g.isInvalid && r++, - g.isFull && o++, - g.isEmpty && a++ - } - } - } catch (e) { - c = true, - u = e - } finally { - try { - s || null == d.return || d.return() - } finally { - if (c) - throw u - } + var r = 0, + o = 0, + a = 0, + s = true, + c = false, + u = void 0; + try { + for ( + var l, d = i[Symbol.iterator](); + !(s = (l = d.next()).done); + s = true + ) { + var p = l.value; + if (p.size) p.isInvalid && r++; + else { + var m = h(p), + g = f(e, m[0], m[1], m[2]); + g.isInvalid && r++, g.isFull && o++, g.isEmpty && a++; + } } - var _ = (i.length + " ").substr(0, 6) - , v = n ? [", ", o, " full, ", a, " empty"].join("") : ""; - console.log(t, _, r, "invalid" + v) + } catch (e) { + (c = true), (u = e); + } finally { + try { + s || null == d.return || d.return(); + } finally { + if (c) throw u; + } + } + var _ = (i.length + " ").substr(0, 6), + v = n ? [", ", o, " full, ", a, " empty"].join("") : ""; + console.log(t, _, r, "invalid" + v); } function l(e, t, i) { - return e + "|" + t + "|" + i + return e + "|" + t + "|" + i; } function h(e) { - var t = e.split("|"); - return [parseInt(t[0]), parseInt(t[1]), parseInt(t[2])] + var t = e.split("|"); + return [parseInt(t[0]), parseInt(t[1]), parseInt(t[2])]; } function f(e, t, i, n) { - var r = p(0 | t) - , o = p(0 | i) - , a = p(0 | n); - return e._chunkHash.get(r, o, a) + var r = p(0 | t), + o = p(0 | i), + a = p(0 | n); + return e._chunkHash.get(r, o, a); } function d(e, t, i, n, r) { - var o = p(0 | t) - , a = p(0 | i) - , s = p(0 | n); - e._chunkHash.set(o, a, s, r) + var o = p(0 | t), + a = p(0 | i), + s = p(0 | n); + e._chunkHash.set(o, a, s, r); } function p(e) { - return ((0 | e) % 1024 + 1024) % 1024 + return (((0 | e) % 1024) + 1024) % 1024; } function m(e) { - var t, i, n, r, o, s = true; - if (e._chunkIDsToRemove.length) { - var c = h(e._chunkIDsToRemove.pop()); - t = e, - i = c[0], - n = c[1], - r = c[2], - o = f(t, i, n, r), - t.emit("chunkBeingRemoved", o.id, o.array, o.userData), - t.noa.rendering.disposeChunkForRendering(o), - o.dispose(), - d(t, i, n, r, 0), - b(o.id, t._chunkIDsInMemory), - b(o.id, t._chunkIDsToMesh), - b(o.id, t._chunkIDsToMeshFirst), - o.isInvalid && (t._lastPlayerChunkID = ""), - E(e, "removed"), - T("removed"), - s = false - } - if (e._chunkIDsToCreate.length >= e._maxChunksPendingCreation) - return s; - if (e._chunkIDsToMesh.length >= e._maxChunksPendingMeshing) - return s; - if (e._chunkIDsToAdd.length) { - var u = e._chunkIDsToAdd.shift(); - !function(e, t) { - var i = h(t) - , n = i[0] - , r = i[1] - , o = i[2]; - if (n < -1 || r < -1 || o < -1) - return; - if (n >= e.noa.worldSize / e.chunkSize + 1 || r > 64 / e.chunkSize || o >= e.noa.worldSize / e.chunkSize + 1) - return; - var s = e.chunkSize - , c = new a(e.noa,t,n,r,o,s); - d(e, n, r, o, c); - var u = n * s - 1 - , l = r * s - 1 - , f = o * s - 1; - y(t, e._chunkIDsToCreate), - e.emit("worldDataNeeded", t, c.array, u, l, f) - }(e, u), - T("requested"), - E(e, "requested"), - s = false - } - return s + var t, + i, + n, + r, + o, + s = true; + if (e._chunkIDsToRemove.length) { + var c = h(e._chunkIDsToRemove.pop()); + (t = e), + (i = c[0]), + (n = c[1]), + (r = c[2]), + (o = f(t, i, n, r)), + t.emit("chunkBeingRemoved", o.id, o.array, o.userData), + t.noa.rendering.disposeChunkForRendering(o), + o.dispose(), + d(t, i, n, r, 0), + b(o.id, t._chunkIDsInMemory), + b(o.id, t._chunkIDsToMesh), + b(o.id, t._chunkIDsToMeshFirst), + o.isInvalid && (t._lastPlayerChunkID = ""), + E(e, "removed"), + T("removed"), + (s = false); + } + if (e._chunkIDsToCreate.length >= e._maxChunksPendingCreation) return s; + if (e._chunkIDsToMesh.length >= e._maxChunksPendingMeshing) return s; + if (e._chunkIDsToAdd.length) { + var u = e._chunkIDsToAdd.shift(); + !(function (e, t) { + var i = h(t), + n = i[0], + r = i[1], + o = i[2]; + if (n < -1 || r < -1 || o < -1) return; + if ( + n >= e.noa.worldSize / e.chunkSize + 1 || + r > 64 / e.chunkSize || + o >= e.noa.worldSize / e.chunkSize + 1 + ) + return; + var s = e.chunkSize, + c = new a(e.noa, t, n, r, o, s); + d(e, n, r, o, c); + var u = n * s - 1, + l = r * s - 1, + f = o * s - 1; + y(t, e._chunkIDsToCreate), + e.emit("worldDataNeeded", t, c.array, u, l, f); + })(e, u), + T("requested"), + E(e, "requested"), + (s = false); + } + return s; } function g(e, t) { - var i; - if (e._chunkIDsToMeshFirst.length) - i = e._chunkIDsToMeshFirst.pop(); - else { - if (t || !e._chunkIDsToMesh.length) - return true; - i = e._chunkIDsToMesh.pop() - } - var n = h(i) - , r = f(e, n[0], n[1], n[2]); - if (!r.isInvalid) - return r.updateMeshes(), - E(e, "meshed"), - T("meshed"), - false + var i; + if (e._chunkIDsToMeshFirst.length) i = e._chunkIDsToMeshFirst.pop(); + else { + if (t || !e._chunkIDsToMesh.length) return true; + i = e._chunkIDsToMesh.pop(); + } + var n = h(i), + r = f(e, n[0], n[1], n[2]); + if (!r.isInvalid) + return r.updateMeshes(), E(e, "meshed"), T("meshed"), false; } function _(e, t, i, n, r, o, a, s) { - var c = f(e, t, i, n); - c && (c.set(r, o, a, s), + var c = f(e, t, i, n); + c && + (c.set(r, o, a, s), y(c.id, e._chunkIDsToMeshFirst), - e.emit("chunkChanged", c)) + e.emit("chunkChanged", c)); } function v(e, t) { - var i = Object.keys(t); - return i.sort(function(e, i) { - return t[e] - t[i] + var i = Object.keys(t); + return ( + i.sort(function (e, i) { + return t[e] - t[i]; }), - i.map(function(t) { - return e[t] + i.map(function (t) { + return e[t]; }) + ); } function y(e, t) { - t.indexOf(e) >= 0 || t.push(e) + t.indexOf(e) >= 0 || t.push(e); } function b(e, t) { - var i = t.indexOf(e); - i >= 0 && t.splice(i, 1) + var i = t.indexOf(e); + i >= 0 && t.splice(i, 1); } - c.prototype = Object.create(o.prototype), - c.prototype.getBlockID = function(e, t, i) { - var n = this.chunkSize - , r = Math.floor(e / n) - , o = Math.floor(t / n) - , a = Math.floor(i / n) - , s = f(this, r, o, a); - return s ? s.get(e - r * n, t - o * n, i - a * n) : 0 - } - , - c.prototype.getBlockSolidity = function(e, t, i) { - var n = this.chunkSize - , r = 0 | Math.floor(e / this.chunkSize) - , o = 0 | Math.floor(t / this.chunkSize) - , a = 0 | Math.floor(i / this.chunkSize) - , s = f(this, r, o, a); - return s ? s.getSolidityAt(e - r * n, t - o * n, i - a * n) : 0 - } - , - c.prototype.getBlockOpacity = function(e, t, i) { - return this.noa.registry._blockOpacity[this.getBlockID(e, t, i)] - } - , - c.prototype.getBlockTransparency = function(e, t, i) { - return this.noa.registry._blockTransparency[this.getBlockID(e, t, i)] - } - , - c.prototype.getBlockFluidity = function(e, t, i) { - return this.noa.registry._blockIsFluid[this.getBlockID(e, t, i)] - } - , - c.prototype.getBlockProperties = function(e, t, i) { - return this.noa.registry._blockProps[this.getBlockID(e, t, i)] - } - , - c.prototype.getBlockObjectMesh = function(e, t, i) { - var n = this.chunkSize - , r = Math.floor(e / n) - , o = Math.floor(t / n) - , a = Math.floor(i / n) - , s = f(this, r, o, a); - return s ? s.getObjectMeshAt(e - r * n, t - o * n, i - a * n) : null - } - , - c.prototype.setBlockID = function(e, t, i, n) { - var r = this.chunkSize - , o = Math.floor(t / r) - , a = Math.floor(i / r) - , s = Math.floor(n / r); - t -= o * r, - i -= a * r, - n -= s * r, - ++this._blockChanges, - function(e, t, i, n, r, o, a, s, c) { - for (var u = 0 === o ? -1 : o === r - 1 ? 1 : 0, l = 0 === a ? -1 : a === r - 1 ? 1 : 0, h = 0 === s ? -1 : s === r - 1 ? 1 : 0, f = -1; f < 2; ++f) - for (var d = -1; d < 2; ++d) - for (var p = -1; p < 2; ++p) - 0 !== f && f !== u || 0 !== d && d !== l || 0 !== p && p !== h || _(e, t + f, i + d, n + p, [r, o, -1][f + 1], [r, a, -1][d + 1], [r, s, -1][p + 1], c) - }(this, o, a, s, r, t, i, n, e) - } - , - c.prototype.isBoxUnobstructed = function(e) { - for (var t = Math.floor, i = e.base, n = e.max, r = t(i[0]), o = t(n[0]) + 1, a = t(i[1]), s = t(n[1]) + 1, c = t(i[2]), u = t(n[2]) + 1, l = r; l < o; l++) - for (var h = a; h < s; h++) - for (var f = c; f < u; f++) - if (this.getBlockSolidity(l, h, f)) - return false; - return true - } - , - c.prototype.tick = function() { + (c.prototype = Object.create(o.prototype)), + (c.prototype.getBlockID = function (e, t, i) { + var n = this.chunkSize, + r = Math.floor(e / n), + o = Math.floor(t / n), + a = Math.floor(i / n), + s = f(this, r, o, a); + return s ? s.get(e - r * n, t - o * n, i - a * n) : 0; + }), + (c.prototype.getBlockSolidity = function (e, t, i) { + var n = this.chunkSize, + r = 0 | Math.floor(e / this.chunkSize), + o = 0 | Math.floor(t / this.chunkSize), + a = 0 | Math.floor(i / this.chunkSize), + s = f(this, r, o, a); + return s ? s.getSolidityAt(e - r * n, t - o * n, i - a * n) : 0; + }), + (c.prototype.getBlockOpacity = function (e, t, i) { + return this.noa.registry._blockOpacity[this.getBlockID(e, t, i)]; + }), + (c.prototype.getBlockTransparency = function (e, t, i) { + return this.noa.registry._blockTransparency[this.getBlockID(e, t, i)]; + }), + (c.prototype.getBlockFluidity = function (e, t, i) { + return this.noa.registry._blockIsFluid[this.getBlockID(e, t, i)]; + }), + (c.prototype.getBlockProperties = function (e, t, i) { + return this.noa.registry._blockProps[this.getBlockID(e, t, i)]; + }), + (c.prototype.getBlockObjectMesh = function (e, t, i) { + var n = this.chunkSize, + r = Math.floor(e / n), + o = Math.floor(t / n), + a = Math.floor(i / n), + s = f(this, r, o, a); + return s ? s.getObjectMeshAt(e - r * n, t - o * n, i - a * n) : null; + }), + (c.prototype.setBlockID = function (e, t, i, n) { + var r = this.chunkSize, + o = Math.floor(t / r), + a = Math.floor(i / r), + s = Math.floor(n / r); + (t -= o * r), + (i -= a * r), + (n -= s * r), + ++this._blockChanges, + (function (e, t, i, n, r, o, a, s, c) { + for ( + var u = 0 === o ? -1 : o === r - 1 ? 1 : 0, + l = 0 === a ? -1 : a === r - 1 ? 1 : 0, + h = 0 === s ? -1 : s === r - 1 ? 1 : 0, + f = -1; + f < 2; + ++f + ) + for (var d = -1; d < 2; ++d) + for (var p = -1; p < 2; ++p) + (0 !== f && f !== u) || + (0 !== d && d !== l) || + (0 !== p && p !== h) || + _( + e, + t + f, + i + d, + n + p, + [r, o, -1][f + 1], + [r, a, -1][d + 1], + [r, s, -1][p + 1], + c + ); + })(this, o, a, s, r, t, i, n, e); + }), + (c.prototype.isBoxUnobstructed = function (e) { + for ( + var t = Math.floor, + i = e.base, + n = e.max, + r = t(i[0]), + o = t(n[0]) + 1, + a = t(i[1]), + s = t(n[1]) + 1, + c = t(i[2]), + u = t(n[2]) + 1, + l = r; + l < o; + l++ + ) + for (var h = a; h < s; h++) + for (var f = c; f < u; f++) + if (this.getBlockSolidity(l, h, f)) return false; + return true; + }), + (c.prototype.tick = function () { T("start"); - var e = function(e) { - var t = e.noa.getPlayerPosition() - , i = e.chunkSize - , n = Math.floor(t[0] / i) - , r = Math.floor(t[1] / i) - , o = Math.floor(t[2] / i); - return [n, r, o] - }(this) - , t = l(e[0], e[1], e[2]); - t != this._lastPlayerChunkID && (function(e, t, i, n) { - for (var r = Math.ceil(e.chunkAddDistance), o = e._chunkIDsToCreate, a = [], s = [], c = e.chunkAddDistance * e.chunkAddDistance, u = t - r; u <= t + r; ++u) - for (var h = i - r; h <= i + r; ++h) - for (var d = n - r; d <= n + r; ++d) { - var p = u - t - , m = h - i - , g = d - n - , _ = p * p + m * m + g * g; - if (!(_ > c) && !f(e, u, h, d)) { - var y = l(u, h, d); - o.indexOf(y) > -1 || (a.push(y), - s.push(_)) - } - } - e._chunkIDsToAdd = v(a, s) - }(this, e[0], e[1], e[2]), - function(e, t, i, n) { - for (var r = e.chunkRemoveDistance * e.chunkRemoveDistance, o = e._chunkIDsInMemory, a = [], s = [], c = 0; c < o.length; c++) { - var u = o[c] - , l = h(u) - , d = l[0] - t - , p = l[1] - i - , m = l[2] - n - , g = d * d + p * p + m * m; - if (g < r) { - var _ = f(e, l[0], l[1], l[2]); - if (!_.isInvalid) - continue; - g *= -1 + var e = (function (e) { + var t = e.noa.getPlayerPosition(), + i = e.chunkSize, + n = Math.floor(t[0] / i), + r = Math.floor(t[1] / i), + o = Math.floor(t[2] / i); + return [n, r, o]; + })(this), + t = l(e[0], e[1], e[2]); + t != this._lastPlayerChunkID && + ((function (e, t, i, n) { + for ( + var r = Math.ceil(e.chunkAddDistance), + o = e._chunkIDsToCreate, + a = [], + s = [], + c = e.chunkAddDistance * e.chunkAddDistance, + u = t - r; + u <= t + r; + ++u + ) + for (var h = i - r; h <= i + r; ++h) + for (var d = n - r; d <= n + r; ++d) { + var p = u - t, + m = h - i, + g = d - n, + _ = p * p + m * m + g * g; + if (!(_ > c) && !f(e, u, h, d)) { + var y = l(u, h, d); + o.indexOf(y) > -1 || (a.push(y), s.push(_)); + } } - a.push(u), - s.push(g) + e._chunkIDsToAdd = v(a, s); + })(this, e[0], e[1], e[2]), + (function (e, t, i, n) { + for ( + var r = e.chunkRemoveDistance * e.chunkRemoveDistance, + o = e._chunkIDsInMemory, + a = [], + s = [], + c = 0; + c < o.length; + c++ + ) { + var u = o[c], + l = h(u), + d = l[0] - t, + p = l[1] - i, + m = l[2] - n, + g = d * d + p * p + m * m; + if (g < r) { + var _ = f(e, l[0], l[1], l[2]); + if (!_.isInvalid) continue; + g *= -1; + } + a.push(u), s.push(g); } - e._chunkIDsToRemove = v(a, s) - }(this, e[0], e[1], e[2])), - this._lastPlayerChunkID = t, - T("build queues"), - E(this, "start"); - for (var i = performance.now() + this._maxProcessingPerTick, n = false; !n && performance.now() < i; ) - n = g(this, false), - n &= m(this); + e._chunkIDsToRemove = v(a, s); + })(this, e[0], e[1], e[2])), + (this._lastPlayerChunkID = t), + T("build queues"), + E(this, "start"); + for ( + var i = performance.now() + this._maxProcessingPerTick, n = false; + !n && performance.now() < i; + + ) + (n = g(this, false)), (n &= m(this)); E(this, "end"); - var r = f(this, e[0], e[1], e[2]) - , o = !(!r || !r.isGenerated || r.isInvalid); - this.playerChunkLoaded = o, - T("end") - } - , - c.prototype.setChunkData = function(e, t, i) { + var r = f(this, e[0], e[1], e[2]), + o = !(!r || !r.isGenerated || r.isInvalid); + (this.playerChunkLoaded = o), T("end"); + }), + (c.prototype.setChunkData = function (e, t, i) { E(this, "received"); - var n = h(e) - , r = f(this, n[0], n[1], n[2]); - r && !r.isInvalid && (r.array = t, - i && (r.userData = i), - r.initData(), - y(e, this._chunkIDsInMemory), - b(e, this._chunkIDsToCreate), - this.noa.rendering.prepareChunkForRendering(r), - y(e, this._chunkIDsToMesh), - this.emit("chunkAdded", r)) - } - , - c.prototype.invalidateAllChunks = function() { - var e = this._chunkIDsInMemory.concat(this._chunkIDsToCreate) - , t = true - , i = false - , n = void 0; + var n = h(e), + r = f(this, n[0], n[1], n[2]); + r && + !r.isInvalid && + ((r.array = t), + i && (r.userData = i), + r.initData(), + y(e, this._chunkIDsInMemory), + b(e, this._chunkIDsToCreate), + this.noa.rendering.prepareChunkForRendering(r), + y(e, this._chunkIDsToMesh), + this.emit("chunkAdded", r)); + }), + (c.prototype.invalidateAllChunks = function () { + var e = this._chunkIDsInMemory.concat(this._chunkIDsToCreate), + t = true, + i = false, + n = void 0; try { - for (var r, o = e[Symbol.iterator](); !(t = (r = o.next()).done); t = true) { - var a = h(r.value); - f(this, a[0], a[1], a[2]).isInvalid = true - } + for ( + var r, o = e[Symbol.iterator](); + !(t = (r = o.next()).done); + t = true + ) { + var a = h(r.value); + f(this, a[0], a[1], a[2]).isInvalid = true; + } } catch (e) { - i = true, - n = e + (i = true), (n = e); } finally { - try { - t || null == o.return || o.return() - } finally { - if (i) - throw n - } + try { + t || null == o.return || o.return(); + } finally { + if (i) throw n; + } } - this._lastPlayerChunkID = "" - } - , - c.prototype.report = function() { - console.log("World report - playerChunkLoaded: ", this.playerChunkLoaded), - u(this, " to add ", this._chunkIDsToAdd), - u(this, " to remove: ", this._chunkIDsToRemove), - u(this, " in memory: ", this._chunkIDsInMemory, true), - u(this, " creating: ", this._chunkIDsToCreate), - u(this, " meshing: ", this._chunkIDsToMesh) - } - ; - var E = function(e, t) {}; - var T = function(e) {} -} -, function(e, t, i) { + this._lastPlayerChunkID = ""; + }), + (c.prototype.report = function () { + console.log( + "World report - playerChunkLoaded: ", + this.playerChunkLoaded + ), + u(this, " to add ", this._chunkIDsToAdd), + u(this, " to remove: ", this._chunkIDsToRemove), + u(this, " in memory: ", this._chunkIDsInMemory, true), + u(this, " creating: ", this._chunkIDsToCreate), + u(this, " meshing: ", this._chunkIDsToMesh); + }); + var E = function (e, t) {}; + var T = function (e) {}; + }, + function (e, t, i) { "use strict"; - var n = i(88) - , r = !("undefined" == typeof Map); + var n = i(88), + r = !("undefined" == typeof Map); function o(e) { - this.length = e, - this.store = r ? new Map : {} + (this.length = e), (this.store = r ? new Map() : {}); } - r ? (o.prototype.get = function(e) { - return this.store.get(e) || 0 - } - , - o.prototype.set = function(e, t) { - return 0 === t ? this.store.delete(e) : this.store.set(e, t), - t - } - ) : (o.prototype.get = function(e) { - return this.store[e] || 0 - } - , - o.prototype.set = function(e, t) { - return 0 === t ? delete this.store[e] : this.store[e] = t, - t - } - ), - e.exports = function(e) { - for (var t = 1, i = 0; i < e.length; ++i) - t *= e[i]; - return n(new o(t), e) - } -} -, function(e, t, i) { + r + ? ((o.prototype.get = function (e) { + return this.store.get(e) || 0; + }), + (o.prototype.set = function (e, t) { + return 0 === t ? this.store.delete(e) : this.store.set(e, t), t; + })) + : ((o.prototype.get = function (e) { + return this.store[e] || 0; + }), + (o.prototype.set = function (e, t) { + return 0 === t ? delete this.store[e] : (this.store[e] = t), t; + })), + (e.exports = function (e) { + for (var t = 1, i = 0; i < e.length; ++i) t *= e[i]; + return n(new o(t), e); + }); + }, + function (e, t, i) { "use strict"; - var n = i(188) - , r = i(88); - window.ndarray = r, - e.exports = m; - var o, a, s, c, u = i(462), l = i(465), h = n.ID_MASK, f = (n.VAR_MASK, - n.SOLID_BIT), d = n.OPAQUE_BIT, p = n.OBJECT_BIT; + var n = i(188), + r = i(88); + (window.ndarray = r), (e.exports = m); + var o, + a, + s, + c, + u = i(462), + l = i(465), + h = n.ID_MASK, + f = (n.VAR_MASK, n.SOLID_BIT), + d = n.OPAQUE_BIT, + p = n.OBJECT_BIT; function m(e, t, i, n, u, h) { - this.id = t, - this.noa = e, - this.isDisposed = false, - this.isGenerated = false, - this.inInvalid = false, - this.octreeBlock = null, - this.isEmpty = false, - this.isFull = false; - var f = h + 2 - , d = new Uint16Array(f * f * f); - this.array = new r(d,[f, f, f]), - this.i = i, - this.j = n, - this.k = u, - this.size = h, - this.x = i * h, - this.y = n * h, - this.z = u * h, - this._terrainDirty = false, - this._objectsDirty = false, - function(e) { - o = e.registry._blockSolidity, - a = e.registry._blockOpacity, - s = e.registry._blockMesh, - c = e.registry._blockHandlers - }(e), + (this.id = t), + (this.noa = e), + (this.isDisposed = false), + (this.isGenerated = false), + (this.inInvalid = false), + (this.octreeBlock = null), + (this.isEmpty = false), + (this.isFull = false); + var f = h + 2, + d = new Uint16Array(f * f * f); + (this.array = new r(d, [f, f, f])), + (this.i = i), + (this.j = n), + (this.k = u), + (this.size = h), + (this.x = i * h), + (this.y = n * h), + (this.z = u * h), + (this._terrainDirty = false), + (this._objectsDirty = false), + (function (e) { + (o = e.registry._blockSolidity), + (a = e.registry._blockOpacity), + (s = e.registry._blockMesh), + (c = e.registry._blockHandlers); + })(e), y(this), - l.initChunk(this) + l.initChunk(this); } function g(e, t, i, n, r, o) { - var a = c[t]; - if (a) { - var s = a[i]; - if (s) { - var u = e.size; - n < 0 || r < 0 || o < 0 || n >= u || r >= u || o >= u || s(e.x + n, e.y + r, e.z + o) - } + var a = c[t]; + if (a) { + var s = a[i]; + if (s) { + var u = e.size; + n < 0 || + r < 0 || + o < 0 || + n >= u || + r >= u || + o >= u || + s(e.x + n, e.y + r, e.z + o); } + } } function _(e) { - return 0 !== e && (!(e & p) || !!(e & f)) + return 0 !== e && (!(e & p) || !!(e & f)); } function v(e) { - var t = e; - return o[e] && (t |= f), - a[e] && (t |= d), - s[e] && (t |= p), - t + var t = e; + return o[e] && (t |= f), a[e] && (t |= d), s[e] && (t |= p), t; } function y(e) { - var t = e.array - , i = e.size; - e._unpaddedView = t.lo(1, 1, 1).hi(i, i, i) + var t = e.array, + i = e.size; + e._unpaddedView = t.lo(1, 1, 1).hi(i, i, i); } function b(e, t, i, n, r) { - l.addObjectBlock(e, t, i, n, r), - e._objectsDirty = true + l.addObjectBlock(e, t, i, n, r), (e._objectsDirty = true); } - m.prototype.get = function(e, t, i) { - return h & this._unpaddedView.get(e, t, i) - } - , - m.prototype.getSolidityAt = function(e, t, i) { - return !!(f & this._unpaddedView.get(e, t, i)) - } - , - m.prototype.set = function(e, t, i, n) { - var r = this._unpaddedView.get(e, t, i) - , o = r & h; + (m.prototype.get = function (e, t, i) { + return h & this._unpaddedView.get(e, t, i); + }), + (m.prototype.getSolidityAt = function (e, t, i) { + return !!(f & this._unpaddedView.get(e, t, i)); + }), + (m.prototype.set = function (e, t, i, n) { + var r = this._unpaddedView.get(e, t, i), + o = r & h; if (n !== o) { - var a = v(n); - this._unpaddedView.set(e, t, i, a), - r & p && function(e, t, i, n) { - l.removeObjectBlock(e, t, i, n), - e._objectsDirty = true - }(this, e, t, i), + var a = v(n); + this._unpaddedView.set(e, t, i, a), + r & p && + (function (e, t, i, n) { + l.removeObjectBlock(e, t, i, n), (e._objectsDirty = true); + })(this, e, t, i), a & p && b(this, n, e, t, i), 0 !== a && (this.isEmpty = false), a & d || (this.isFull = false), g(this, o, "onUnset", e, t, i), g(this, n, "onSet", e, t, i), - (_(r) || _(a)) && (this._terrainDirty = true) + (_(r) || _(a)) && (this._terrainDirty = true); } - } - , - m.prototype.mesh = function(e, t, i, n, r) { - return u.meshChunk(this, e, t, i, n, r) - } - , - m.prototype.updateMeshes = function() { + }), + (m.prototype.mesh = function (e, t, i, n, r) { + return u.meshChunk(this, e, t, i, n, r); + }), + (m.prototype.updateMeshes = function () { if (this._terrainDirty) { - this.noa.rendering.removeTerrainMesh(this); - var e = this.mesh(); - e && this.noa.rendering.addTerrainMesh(this, e), - this._terrainDirty = false + this.noa.rendering.removeTerrainMesh(this); + var e = this.mesh(); + e && this.noa.rendering.addTerrainMesh(this, e), + (this._terrainDirty = false); } - this._objectsDirty && (l.buildObjectMesh(this), - this._objectsDirty = false) - } - , - m.prototype.initData = function() { + this._objectsDirty && + (l.buildObjectMesh(this), (this._objectsDirty = false)); + }), + (m.prototype.initData = function () { y(this); - for (var e = d, t = true, i = this.array, n = i.data, r = i.shape[0], o = i.stride[2], a = (this._objectMeshes, - 0); a < r; ++a) - for (var s = 0 === a || a === r - 1, c = 0; c < r; ++c) - for (var u = i.index(a, c, 0), l = s || 0 === c || c === r - 1, f = 0; f < r; ++f, - u += o) { - var m = n[u] & h; - if (0 !== m) { - var _ = 0 | v(m); - n[u] = _, - e &= _, - t = false, - l || 0 === f || f === r - 1 || (p & _ && b(this, m, a - 1, c - 1, f - 1), - g(this, m, "onLoad", a - 1, c - 1, f - 1)) - } else - e = 0 - } - this.isFull = !!(e & d), - this.isEmpty = !!t, - this._terrainDirty = !(this.isFull || this.isEmpty), - this.isGenerated = true - } - , - m.prototype.dispose = function() { - !function(e, t) { - for (var i = e._unpaddedView, n = i.data, r = i.stride[0], o = i.stride[1], a = i.stride[2], s = i.shape[0], c = i.offset, u = 0; u < s; ++u) { - for (var l = 0; l < s; ++l) { - for (var f = 0; f < s; ++f) { - var d = h & n[c]; - g(e, d, t, u, l, f), - c += a - } - c -= a * s, - c += o - } - c -= o * s, - c += r + for ( + var e = d, + t = true, + i = this.array, + n = i.data, + r = i.shape[0], + o = i.stride[2], + a = (this._objectMeshes, 0); + a < r; + ++a + ) + for (var s = 0 === a || a === r - 1, c = 0; c < r; ++c) + for ( + var u = i.index(a, c, 0), l = s || 0 === c || c === r - 1, f = 0; + f < r; + ++f, u += o + ) { + var m = n[u] & h; + if (0 !== m) { + var _ = 0 | v(m); + (n[u] = _), + (e &= _), + (t = false), + l || + 0 === f || + f === r - 1 || + (p & _ && b(this, m, a - 1, c - 1, f - 1), + g(this, m, "onLoad", a - 1, c - 1, f - 1)); + } else e = 0; } - }(this, "onUnload"), - l.disposeChunk(this), - this.array.data = null, - this.array = null, - this._unpaddedView = null, - this.isGenerated = false, - this.isDisposed = true - } -} -, function(e, t, i) { + (this.isFull = !!(e & d)), + (this.isEmpty = !!t), + (this._terrainDirty = !(this.isFull || this.isEmpty)), + (this.isGenerated = true); + }), + (m.prototype.dispose = function () { + !(function (e, t) { + for ( + var i = e._unpaddedView, + n = i.data, + r = i.stride[0], + o = i.stride[1], + a = i.stride[2], + s = i.shape[0], + c = i.offset, + u = 0; + u < s; + ++u + ) { + for (var l = 0; l < s; ++l) { + for (var f = 0; f < s; ++f) { + var d = h & n[c]; + g(e, d, t, u, l, f), (c += a); + } + (c -= a * s), (c += o); + } + (c -= o * s), (c += r); + } + })(this, "onUnload"), + l.disposeChunk(this), + (this.array.data = null), + (this.array = null), + (this._unpaddedView = null), + (this.isGenerated = false), + (this.isDisposed = true); + }); + }, + function (e, t, i) { "use strict"; - e.exports = new function() { - var e = new o - , t = new r; - this.meshChunk = function(i, n, r, o, s, c, u) { - a("start"); - var l, h = i.noa, f = [i.i * i.size, i.j * i.size, i.k * i.size], d = i.array, p = n || h.registry.getBlockFaceMaterialAccessor(), m = r || h.registry.getMaterialVertexColorAccessor(), g = void 0 === s ? h.rendering.useAO : s, _ = c || h.rendering.aoVals, v = isNaN(u) ? h.rendering.revAoVal : u, y = e.mesh(d, p, m, g, _, v, f); - return y.length && (l = t.build(i, y, o), - a("built terrain")), - a("end"), - l || null - } - } - ; + e.exports = new (function () { + var e = new o(), + t = new r(); + this.meshChunk = function (i, n, r, o, s, c, u) { + a("start"); + var l, + h = i.noa, + f = [i.i * i.size, i.j * i.size, i.k * i.size], + d = i.array, + p = n || h.registry.getBlockFaceMaterialAccessor(), + m = r || h.registry.getMaterialVertexColorAccessor(), + g = void 0 === s ? h.rendering.useAO : s, + _ = c || h.rendering.aoVals, + v = isNaN(u) ? h.rendering.revAoVal : u, + y = e.mesh(d, p, m, g, _, v, f); + return ( + y.length && ((l = t.build(i, y, o)), a("built terrain")), + a("end"), + l || null + ); + }; + })(); function n(e) { - this.id = 0 | e, - this.positions = [], - this.indices = [], - this.normals = [], - this.colors = [], - this.uvs = [] + (this.id = 0 | e), + (this.positions = []), + (this.indices = []), + (this.normals = []), + (this.colors = []), + (this.uvs = []); } function r() { - var e; - function t(e, t) { - for (var i, n = [], r = [], o = [], a = Object.keys(e), s = null, c = 0; c < a.length; ++c) { - var u = e[a[c]]; - if (t(u)) - if (n.push(u.positions.length), - r.push(u.indices.length), - o.push(u.id), - s) { - var l = s.positions.length / 3; - s.positions = s.positions.concat(u.positions), - s.normals = s.normals.concat(u.normals), - s.colors = s.colors.concat(u.colors), - s.uvs = s.uvs.concat(u.uvs); - for (var h = 0, f = u.indices.length; h < f; ++h) - s.indices.push(u.indices[h] + l); - u.dispose(), - delete e[a[c]] - } else - s = u, - i = a[c] - } - return { - mergedID: i, - vertices: n, - indices: r, - matIDs: o - } + var e; + function t(e, t) { + for ( + var i, n = [], r = [], o = [], a = Object.keys(e), s = null, c = 0; + c < a.length; + ++c + ) { + var u = e[a[c]]; + if (t(u)) + if ( + (n.push(u.positions.length), + r.push(u.indices.length), + o.push(u.id), + s) + ) { + var l = s.positions.length / 3; + (s.positions = s.positions.concat(u.positions)), + (s.normals = s.normals.concat(u.normals)), + (s.colors = s.colors.concat(u.colors)), + (s.uvs = s.uvs.concat(u.uvs)); + for (var h = 0, f = u.indices.length; h < f; ++h) + s.indices.push(u.indices[h] + l); + u.dispose(), delete e[a[c]]; + } else (s = u), (i = a[c]); } - function n(t, i, n, r, o) { - var a = e.rendering.getScene() - , s = new BABYLON.Mesh(i,a) - , c = new BABYLON.VertexData; - if (c.positions = t.positions, - c.indices = t.indices, - c.normals = t.normals, - c.colors = t.colors, - c.uvs = t.uvs, - c.applyToMesh(s), - t.dispose(), - 1 === n.length) - s.material = n[0]; + return { + mergedID: i, + vertices: n, + indices: r, + matIDs: o, + }; + } + function n(t, i, n, r, o) { + var a = e.rendering.getScene(), + s = new BABYLON.Mesh(i, a), + c = new BABYLON.VertexData(); + if ( + ((c.positions = t.positions), + (c.indices = t.indices), + (c.normals = t.normals), + (c.colors = t.colors), + (c.uvs = t.uvs), + c.applyToMesh(s), + t.dispose(), + 1 === n.length) + ) + s.material = n[0]; + else { + var u = new BABYLON.MultiMaterial("multimat " + i, a); + s.subMeshes = []; + c.positions.length, c.indices.length; + for (var l = 0, h = 0, f = 0; f < n.length; f++) { + u.subMaterials[f] = n[f]; + var d = new BABYLON.SubMesh(f, l, r[f], h, o[f], s); + (s.subMeshes[f] = d), (l += r[f]), (h += o[f]); + } + s.material = u; + } + return s; + } + (this.build = function (i, r, a) { + e = i.noa; + t(r, function (t) { + if (a) return true; + var i = e.registry.getMaterialTexture(t.id), + n = e.registry.getMaterialData(t.id).alpha; + return !(i || n < 1) && void 0; + }); + var s = t(r, function () { + return true; + }), + c = n( + r[s.mergedID], + "chunk_" + i.id, + s.matIDs.map(function (e) { + return o(e, a); + }), + s.vertices, + s.indices + ), + u = i.i * i.size, + l = i.j * i.size, + h = i.k * i.size; + return ( + (c.position.x = u), + (c.position.y = l), + (c.position.z = h), + c.freezeWorldMatrix(), + c.freezeNormals(), + c + ); + }), + (this.buildWithoutMultimats = function (i, r, a) { + e = i.noa; + t(r, function (t) { + if (a) return true; + var i = e.registry.getMaterialTexture(t.id), + n = e.registry.getMaterialData(t.id).alpha; + return !(i || n < 1) && void 0; + }); + for (var s = null, c = Object.keys(r), u = 0; u < c.length; ++u) { + var l = r[c[u]], + h = l.id, + f = o(h, a), + d = n(l, "chunk_inner_" + i.id + " " + h, [f]); + if (s) d.parent = s; else { - var u = new BABYLON.MultiMaterial("multimat " + i,a); - s.subMeshes = []; - c.positions.length, - c.indices.length; - for (var l = 0, h = 0, f = 0; f < n.length; f++) { - u.subMaterials[f] = n[f]; - var d = new BABYLON.SubMesh(f,l,r[f],h,o[f],s); - s.subMeshes[f] = d, - l += r[f], - h += o[f] - } - s.material = u + s = d; + var p = i.i * i.size, + m = i.j * i.size, + g = i.k * i.size; + (s.position.x = p), (s.position.y = m), (s.position.z = g); } - return s - } - this.build = function(i, r, a) { - e = i.noa; - t(r, function(t) { - if (a) - return true; - var i = e.registry.getMaterialTexture(t.id) - , n = e.registry.getMaterialData(t.id).alpha; - return !(i || n < 1) && void 0 - }); - var s = t(r, function() { - return true - }) - , c = n(r[s.mergedID], "chunk_" + i.id, s.matIDs.map(function(e) { - return o(e, a) - }), s.vertices, s.indices) - , u = i.i * i.size - , l = i.j * i.size - , h = i.k * i.size; - return c.position.x = u, - c.position.y = l, - c.position.z = h, - c.freezeWorldMatrix(), - c.freezeNormals(), - c - } - , - this.buildWithoutMultimats = function(i, r, a) { - e = i.noa; - t(r, function(t) { - if (a) - return true; - var i = e.registry.getMaterialTexture(t.id) - , n = e.registry.getMaterialData(t.id).alpha; - return !(i || n < 1) && void 0 - }); - for (var s = null, c = Object.keys(r), u = 0; u < c.length; ++u) { - var l = r[c[u]] - , h = l.id - , f = o(h, a) - , d = n(l, "chunk_inner_" + i.id + " " + h, [f]); - if (s) - d.parent = s; - else { - s = d; - var p = i.i * i.size - , m = i.j * i.size - , g = i.k * i.size; - s.position.x = p, - s.position.y = m, - s.position.z = g + d.freezeWorldMatrix(), d.freezeNormals(); + } + return s; + }); + var r = {}; + function o(t, n) { + if (n) return e.rendering.flatMaterial; + var o = "terrain mat " + t; + return ( + r[o] || + (r[o] = (function (t) { + var n = e.registry.getMaterialTexture(t), + r = e.registry.getMaterialData(t), + o = r.alpha; + if (!n && 1 == o) return e.rendering.flatMaterial; + var a = e.rendering.flatMaterial.clone("terrain" + t); + if (n) { + var s = e.rendering.getScene(), + c = new BABYLON.Texture( + n, + s, + true, + false, + BABYLON.Texture.NEAREST_SAMPLINGMODE + ); + if (12 == t) { + var u = i(463)(e); + c = u.texture; } - d.freezeWorldMatrix(), - d.freezeNormals() - } - return s - } - ; - var r = {}; - function o(t, n) { - if (n) - return e.rendering.flatMaterial; - var o = "terrain mat " + t; - return r[o] || (r[o] = function(t) { - var n = e.registry.getMaterialTexture(t) - , r = e.registry.getMaterialData(t) - , o = r.alpha; - if (!n && 1 == o) - return e.rendering.flatMaterial; - var a = e.rendering.flatMaterial.clone("terrain" + t); - if (n) { - var s = e.rendering.getScene() - , c = new BABYLON.Texture(n,s,true,false,BABYLON.Texture.NEAREST_SAMPLINGMODE); - if (12 == t) { - var u = i(463)(e); - c = u.texture + if (r.textureAlpha) { + if (((c.hasAlpha = true), (a.diffuseTexture = c), 36 == t)) { + if (e.waterTexture) a.diffuseTexture = e.waterTexture; + else { + var l = i(189)(e); + a.diffuseTexture = l.texture; } - if (r.textureAlpha) { - if (c.hasAlpha = true, - a.diffuseTexture = c, - 36 == t) { - if (e.waterTexture) - a.diffuseTexture = e.waterTexture; - else { - var l = i(189)(e); - a.diffuseTexture = l.texture - } - a.useAlphaFromDiffuseTexture = true - } - 34 != t && 36 != t || (a.backFaceCulling = false) - } else - a.ambientTexture = c, - 12 == t && (a.backFaceCulling = false) - } - r.alpha < 1 && (a.alpha = r.alpha); - return a - }(t)), - r[o] - } + a.useAlphaFromDiffuseTexture = true; + } + (34 != t && 36 != t) || (a.backFaceCulling = false); + } else + (a.ambientTexture = c), + 12 == t && (a.backFaceCulling = false); + } + r.alpha < 1 && (a.alpha = r.alpha); + return a; + })(t)), + r[o] + ); + } } function o() { - var e = i(188) - , t = e.ID_MASK - , r = (e.VAR_MASK, - e.SOLID_BIT) - , o = e.OPAQUE_BIT - , s = e.OBJECT_BIT - , c = new Int16Array(256) - , u = new Uint16Array(256); - function l(e, i, n, r, o, a) { - for (var s = n.shape[1], l = c, h = u, d = 0, p = n.data, m = n.index(e - 1, 0, 0), g = n.stride[0], _ = n.stride[1], v = n.stride[2], y = 0; y < s; ++y) { - var b = m; - m += v; - for (var E = 0; E < s; E++, - d++, - b += _) { - var T = p[b] - , A = p[b + g] - , x = f(T, A, E, y); - if (x) { - if (l[d] = x > 0 ? r(T & t, 2 * i) : -r(A & t, 2 * i + 1), - 0 != l[d]) { - var S = a[0] + e + x - , C = a[1] + E - , P = a[2] + y; - 1 == i && (S = a[0] + y, - C = a[1] + e + x, - P = a[2] + E), - 2 == i && (S = a[0] + E, - C = a[1] + y, - P = a[2] + e + x), - 0 == i && x > 0 && (S -= 1), - 1 == i && x > 0 && (C -= 1), - 2 == i && x > 0 && (P -= 1), - noa.getBrightness(S, C, P) < 1 && (l[d] += 512 * x) - } - if (o) { - var R = x > 0 ? e : e - 1 - , M = x > 0 ? e - 1 : e; - h[d] = o(n, R, M, E, y) - } - } - } + var e = i(188), + t = e.ID_MASK, + r = (e.VAR_MASK, e.SOLID_BIT), + o = e.OPAQUE_BIT, + s = e.OBJECT_BIT, + c = new Int16Array(256), + u = new Uint16Array(256); + function l(e, i, n, r, o, a) { + for ( + var s = n.shape[1], + l = c, + h = u, + d = 0, + p = n.data, + m = n.index(e - 1, 0, 0), + g = n.stride[0], + _ = n.stride[1], + v = n.stride[2], + y = 0; + y < s; + ++y + ) { + var b = m; + m += v; + for (var E = 0; E < s; E++, d++, b += _) { + var T = p[b], + A = p[b + g], + x = f(T, A, E, y); + if (x) { + if ( + ((l[d] = x > 0 ? r(T & t, 2 * i) : -r(A & t, 2 * i + 1)), + 0 != l[d]) + ) { + var S = a[0] + e + x, + C = a[1] + E, + P = a[2] + y; + 1 == i && ((S = a[0] + y), (C = a[1] + e + x), (P = a[2] + E)), + 2 == i && + ((S = a[0] + E), (C = a[1] + y), (P = a[2] + e + x)), + 0 == i && x > 0 && (S -= 1), + 1 == i && x > 0 && (C -= 1), + 2 == i && x > 0 && (P -= 1), + noa.getBrightness(S, C, P) < 1 && (l[d] += 512 * x); + } + if (o) { + var R = x > 0 ? e : e - 1, + M = x > 0 ? e - 1 : e; + h[d] = o(n, R, M, E, y); + } } + } } - this.mesh = function(e, t, i, n, r, o, s) { - var h, f = [], p = n && o === r[0]; - n && (h = p ? v : y); - for (var m = 0; m < 3; ++m) { - var g = (m + 1) % 3 - , _ = (m + 2) % 3 - , b = e.transpose(m, g, _).lo(1, 1, 1).hi(e.shape[m] - 2, e.shape[g] - 2, e.shape[_] - 2) - , E = b.shape[0] - 1 - , T = b.shape[1] - , A = b.shape[2]; - c.length < T * A && (c = new Int16Array(T * A), - u = new Uint16Array(T * A)); - for (var x = 0; x <= E; ++x) - l(x, m, b, t, h, s), - a("built masks"), - d(x, m, g, _, T, A, n, f, i, r, o, s), - a("build submeshes") - } - return f + } + this.mesh = function (e, t, i, n, r, o, s) { + var h, + f = [], + p = n && o === r[0]; + n && (h = p ? v : y); + for (var m = 0; m < 3; ++m) { + var g = (m + 1) % 3, + _ = (m + 2) % 3, + b = e + .transpose(m, g, _) + .lo(1, 1, 1) + .hi(e.shape[m] - 2, e.shape[g] - 2, e.shape[_] - 2), + E = b.shape[0] - 1, + T = b.shape[1], + A = b.shape[2]; + c.length < T * A && + ((c = new Int16Array(T * A)), (u = new Uint16Array(T * A))); + for (var x = 0; x <= E; ++x) + l(x, m, b, t, h, s), + a("built masks"), + d(x, m, g, _, T, A, n, f, i, r, o, s), + a("build submeshes"); } - ; - var h = i(464); - function f(e, t, i, n) { - var r = e & o - , a = t & o; - if (r && a) - return 0; - if (r) - return 1; - if (a) - return -1; - if (7 === e && 32809 === t) - return 0; - if (7 === t && 32809 === e) - return 0; - if (0 === t || t & s) - return 1; - if (0 === e || e & s) - return -1; - if (40 === t || t & s) - return 1; - if (40 === e || e & s) - return -1; - var c = 0; - return 8206 == e && (c = 1), - 8206 == t && (c = -1), - 7 == e && (c = 1), - 7 == t && (c = -1), - 7 == e && 7 == t && (c = 0), - 7 == e && 8206 == t && (c = -1), - 8206 == e && 7 == t && (c = 1), - 7 == e && 8215 == t && (c = -1), - 8215 == e && 7 == t && (c = 1), - 17 == e && 8206 == t && (c = 1), - 8206 == e && 17 == t && (c = -1), - 17 == e && 8215 == t && (c = 1), - 8215 == e && 17 == t && (c = -1), - 8206 == e && 8206 == t && (c = 1, - h(i, n) > .5 && (c = -1)), - c - } - function d(e, t, i, r, o, a, s, l, h, f, d, v) { - for (var y = 0, b = c, E = u, T = s ? p : m, A = s ? _ : g, x = 0; x < a; ++x) - for (var S = 1, C = 1, P = 0; P < o; P += S, - y += S) { - var R = b[y]; - if (R) { - var M = E[y]; - for (S = 1; S < o - P && T(y + S, b, R, E, M); ++S) - ; - e: for (C = 1; C < a - x; ++C) - for (var O = 0; O < S; ++O) { - if (!T(y + O + C * o, b, R, E, M)) - break e - } - var w = b[y]; - w >= 512 && (w -= 512), - w <= -512 && (w += 512); - var I = Math.abs(w); - l[I] || (l[I] = new n(I)); - var D = l[I] - , L = D.colors - , F = h(I); - F[0] = 1, - F[1] = 1, - F[2] = 1, - w != R && (F[0] = .6, - F[1] = .6, - F[2] = .6); - var B = A(L, F, M, f, d) - , N = 0; - (36 == I || 12 == I) && 1 == t && w > 0 && (N = .07); - var k = [0, 0, 0]; - k[t] = e, - k[i] = P, - k[r] = x; - var U = [0, 0, 0]; - U[i] = S; - var V = [0, 0, 0]; - V[r] = C; - var G = D.positions; - G.push(k[0], k[1] - N, k[2], k[0] + U[0], k[1] + U[1] - N, k[2] + U[2], k[0] + U[0] + V[0], k[1] + U[1] + V[1] - N, k[2] + U[2] + V[2], k[0] + V[0], k[1] + V[1] - N, k[2] + V[2]); - var z = R > 0 ? 1 : -1; - 2 === t ? D.uvs.push(0, C, -z * S, C, -z * S, 0, 0, 0) : D.uvs.push(0, S, 0, 0, z * C, 0, z * C, S); - var j = G.length / 3 - 4; - R < 0 ? B ? D.indices.push(j, j + 1, j + 2, j, j + 2, j + 3) : D.indices.push(j + 1, j + 2, j + 3, j, j + 1, j + 3) : B ? D.indices.push(j, j + 2, j + 1, j, j + 3, j + 2) : D.indices.push(j + 3, j + 1, j, j + 3, j + 2, j + 1); - var H = 0 === t ? z : 0 - , W = 1 === t ? z : 0 - , X = 2 === t ? z : 0; - D.normals.push(H, W, X, H, W, X, H, W, X, H, W, X); - for (var Y = 0; Y < C; ++Y) - for (var K = 0; K < S; ++K) - b[y + K + Y * o] = 0 - } else - S = 1 + return f; + }; + var h = i(464); + function f(e, t, i, n) { + var r = e & o, + a = t & o; + if (r && a) return 0; + if (r) return 1; + if (a) return -1; + if (7 === e && 32809 === t) return 0; + if (7 === t && 32809 === e) return 0; + if (0 === t || t & s) return 1; + if (0 === e || e & s) return -1; + if (40 === t || t & s) return 1; + if (40 === e || e & s) return -1; + var c = 0; + return ( + 8206 == e && (c = 1), + 8206 == t && (c = -1), + 7 == e && (c = 1), + 7 == t && (c = -1), + 7 == e && 7 == t && (c = 0), + 7 == e && 8206 == t && (c = -1), + 8206 == e && 7 == t && (c = 1), + 7 == e && 8215 == t && (c = -1), + 8215 == e && 7 == t && (c = 1), + 17 == e && 8206 == t && (c = 1), + 8206 == e && 17 == t && (c = -1), + 17 == e && 8215 == t && (c = 1), + 8215 == e && 17 == t && (c = -1), + 8206 == e && 8206 == t && ((c = 1), h(i, n) > 0.5 && (c = -1)), + c + ); + } + function d(e, t, i, r, o, a, s, l, h, f, d, v) { + for ( + var y = 0, b = c, E = u, T = s ? p : m, A = s ? _ : g, x = 0; + x < a; + ++x + ) + for (var S = 1, C = 1, P = 0; P < o; P += S, y += S) { + var R = b[y]; + if (R) { + var M = E[y]; + for (S = 1; S < o - P && T(y + S, b, R, E, M); ++S); + e: for (C = 1; C < a - x; ++C) + for (var O = 0; O < S; ++O) { + if (!T(y + O + C * o, b, R, E, M)) break e; } - } - function p(e, t, i, n, r) { - return i === t[e] && r === n[e] - } - function m(e, t, i, n, r) { - return i === t[e] - } - function g(e, t, i, n, r) { - return e.push(t[0], t[1], t[2], 1), - e.push(t[0], t[1], t[2], 1), - e.push(t[0], t[1], t[2], 1), - e.push(t[0], t[1], t[2], 1), - true - } - function _(e, t, i, n, r) { - var o = b(i, 0, 0) - , a = b(i, 1, 0) - , s = b(i, 1, 1) - , c = b(i, 0, 1); - E(e, t, o, n, r), - E(e, t, a, n, r), - E(e, t, s, n, r), - E(e, t, c, n, r); - return o === s ? c !== a || 2 == c : c !== a && o + s > c + a - } - function v(e, t, i, n, o) { - var a = 1 - , s = 1 - , c = 1 - , u = 1 - , l = r - , h = l & e.get(t, n, o); - return e.get(t, n + 1, o) & l && (++c, - ++u), - e.get(t, n - 1, o) & l && (++a, - ++s), - e.get(t, n, o + 1) & l && (++s, - ++u), - e.get(t, n, o - 1) & l && (++a, - ++c), - h ? (u = 3 == u || e.get(t, n + 1, o + 1) & l ? 3 : 2, - s = 3 == s || e.get(t, n - 1, o + 1) & l ? 3 : 2, - c = 3 == c || e.get(t, n + 1, o - 1) & l ? 3 : 2, - a = 3 == a || e.get(t, n - 1, o - 1) & l ? 3 : 2) : (1 === u && e.get(t, n + 1, o + 1) & l && (u = 2), - 1 === s && e.get(t, n - 1, o + 1) & l && (s = 2), - 1 === c && e.get(t, n + 1, o - 1) & l && (c = 2), - 1 === a && e.get(t, n - 1, o - 1) & l && (a = 2)), - u << 6 | c << 4 | s << 2 | a - } - function y(e, t, i, n, o) { - var a = 1 - , s = 1 - , c = 1 - , u = 1 - , l = r - , h = l & e.get(t, n, o); - return e.get(t, n + 1, o) & l && (++c, - ++u), - e.get(t, n - 1, o) & l && (++a, - ++s), - e.get(t, n, o + 1) & l && (++s, - ++u), - e.get(t, n, o - 1) & l && (++a, - ++c), - h ? (u = 3 == u || e.get(t, n + 1, o + 1) & l ? 3 : 2, - s = 3 == s || e.get(t, n - 1, o + 1) & l ? 3 : 2, - c = 3 == c || e.get(t, n + 1, o - 1) & l ? 3 : 2, - a = 3 == a || e.get(t, n - 1, o - 1) & l ? 3 : 2) : (1 === u && (e.get(t, n + 1, o + 1) & l ? u = 2 : e.get(i, n, o + 1) & l && e.get(i, n + 1, o) & l && e.get(i, n + 1, o + 1) & l || (u = 0)), - 1 === c && (e.get(t, n + 1, o - 1) & l ? c = 2 : e.get(i, n, o - 1) & l && e.get(i, n + 1, o) & l && e.get(i, n + 1, o - 1) & l || (c = 0)), - 1 === s && (e.get(t, n - 1, o + 1) & l ? s = 2 : e.get(i, n, o + 1) & l && e.get(i, n - 1, o) & l && e.get(i, n - 1, o + 1) & l || (s = 0)), - 1 === a && (e.get(t, n - 1, o - 1) & l ? a = 2 : e.get(i, n, o - 1) & l && e.get(i, n - 1, o) & l && e.get(i, n - 1, o - 1) & l || (a = 0))), - u << 6 | c << 4 | s << 2 | a - } - function b(e, t, i) { - return e >> (t ? i ? 6 : 4 : i ? 2 : 0) & 3 - } - function E(e, t, i, n, r) { - var o = 0 === i ? r : n[i - 1]; - e.push(t[0] * o, t[1] * o, t[2] * o, 1) - } + var w = b[y]; + w >= 512 && (w -= 512), w <= -512 && (w += 512); + var I = Math.abs(w); + l[I] || (l[I] = new n(I)); + var D = l[I], + L = D.colors, + F = h(I); + (F[0] = 1), + (F[1] = 1), + (F[2] = 1), + w != R && ((F[0] = 0.6), (F[1] = 0.6), (F[2] = 0.6)); + var B = A(L, F, M, f, d), + N = 0; + (36 == I || 12 == I) && 1 == t && w > 0 && (N = 0.07); + var k = [0, 0, 0]; + (k[t] = e), (k[i] = P), (k[r] = x); + var U = [0, 0, 0]; + U[i] = S; + var V = [0, 0, 0]; + V[r] = C; + var G = D.positions; + G.push( + k[0], + k[1] - N, + k[2], + k[0] + U[0], + k[1] + U[1] - N, + k[2] + U[2], + k[0] + U[0] + V[0], + k[1] + U[1] + V[1] - N, + k[2] + U[2] + V[2], + k[0] + V[0], + k[1] + V[1] - N, + k[2] + V[2] + ); + var z = R > 0 ? 1 : -1; + 2 === t + ? D.uvs.push(0, C, -z * S, C, -z * S, 0, 0, 0) + : D.uvs.push(0, S, 0, 0, z * C, 0, z * C, S); + var j = G.length / 3 - 4; + R < 0 + ? B + ? D.indices.push(j, j + 1, j + 2, j, j + 2, j + 3) + : D.indices.push(j + 1, j + 2, j + 3, j, j + 1, j + 3) + : B + ? D.indices.push(j, j + 2, j + 1, j, j + 3, j + 2) + : D.indices.push(j + 3, j + 1, j, j + 3, j + 2, j + 1); + var H = 0 === t ? z : 0, + W = 1 === t ? z : 0, + X = 2 === t ? z : 0; + D.normals.push(H, W, X, H, W, X, H, W, X, H, W, X); + for (var Y = 0; Y < C; ++Y) + for (var K = 0; K < S; ++K) b[y + K + Y * o] = 0; + } else S = 1; + } + } + function p(e, t, i, n, r) { + return i === t[e] && r === n[e]; + } + function m(e, t, i, n, r) { + return i === t[e]; + } + function g(e, t, i, n, r) { + return ( + e.push(t[0], t[1], t[2], 1), + e.push(t[0], t[1], t[2], 1), + e.push(t[0], t[1], t[2], 1), + e.push(t[0], t[1], t[2], 1), + true + ); + } + function _(e, t, i, n, r) { + var o = b(i, 0, 0), + a = b(i, 1, 0), + s = b(i, 1, 1), + c = b(i, 0, 1); + E(e, t, o, n, r), E(e, t, a, n, r), E(e, t, s, n, r), E(e, t, c, n, r); + return o === s ? c !== a || 2 == c : c !== a && o + s > c + a; + } + function v(e, t, i, n, o) { + var a = 1, + s = 1, + c = 1, + u = 1, + l = r, + h = l & e.get(t, n, o); + return ( + e.get(t, n + 1, o) & l && (++c, ++u), + e.get(t, n - 1, o) & l && (++a, ++s), + e.get(t, n, o + 1) & l && (++s, ++u), + e.get(t, n, o - 1) & l && (++a, ++c), + h + ? ((u = 3 == u || e.get(t, n + 1, o + 1) & l ? 3 : 2), + (s = 3 == s || e.get(t, n - 1, o + 1) & l ? 3 : 2), + (c = 3 == c || e.get(t, n + 1, o - 1) & l ? 3 : 2), + (a = 3 == a || e.get(t, n - 1, o - 1) & l ? 3 : 2)) + : (1 === u && e.get(t, n + 1, o + 1) & l && (u = 2), + 1 === s && e.get(t, n - 1, o + 1) & l && (s = 2), + 1 === c && e.get(t, n + 1, o - 1) & l && (c = 2), + 1 === a && e.get(t, n - 1, o - 1) & l && (a = 2)), + (u << 6) | (c << 4) | (s << 2) | a + ); + } + function y(e, t, i, n, o) { + var a = 1, + s = 1, + c = 1, + u = 1, + l = r, + h = l & e.get(t, n, o); + return ( + e.get(t, n + 1, o) & l && (++c, ++u), + e.get(t, n - 1, o) & l && (++a, ++s), + e.get(t, n, o + 1) & l && (++s, ++u), + e.get(t, n, o - 1) & l && (++a, ++c), + h + ? ((u = 3 == u || e.get(t, n + 1, o + 1) & l ? 3 : 2), + (s = 3 == s || e.get(t, n - 1, o + 1) & l ? 3 : 2), + (c = 3 == c || e.get(t, n + 1, o - 1) & l ? 3 : 2), + (a = 3 == a || e.get(t, n - 1, o - 1) & l ? 3 : 2)) + : (1 === u && + (e.get(t, n + 1, o + 1) & l + ? (u = 2) + : (e.get(i, n, o + 1) & l && + e.get(i, n + 1, o) & l && + e.get(i, n + 1, o + 1) & l) || + (u = 0)), + 1 === c && + (e.get(t, n + 1, o - 1) & l + ? (c = 2) + : (e.get(i, n, o - 1) & l && + e.get(i, n + 1, o) & l && + e.get(i, n + 1, o - 1) & l) || + (c = 0)), + 1 === s && + (e.get(t, n - 1, o + 1) & l + ? (s = 2) + : (e.get(i, n, o + 1) & l && + e.get(i, n - 1, o) & l && + e.get(i, n - 1, o + 1) & l) || + (s = 0)), + 1 === a && + (e.get(t, n - 1, o - 1) & l + ? (a = 2) + : (e.get(i, n, o - 1) & l && + e.get(i, n - 1, o) & l && + e.get(i, n - 1, o - 1) & l) || + (a = 0))), + (u << 6) | (c << 4) | (s << 2) | a + ); + } + function b(e, t, i) { + return (e >> (t ? (i ? 6 : 4) : i ? 2 : 0)) & 3; + } + function E(e, t, i, n, r) { + var o = 0 === i ? r : n[i - 1]; + e.push(t[0] * o, t[1] * o, t[2] * o, 1); + } } - n.prototype.dispose = function() { - this.positions = null, - this.indices = null, - this.normals = null, - this.colors = null, - this.uvs = null - } - ; - var a = function() {} -} -, function(e, t, i) { + n.prototype.dispose = function () { + (this.positions = null), + (this.indices = null), + (this.normals = null), + (this.colors = null), + (this.uvs = null); + }; + var a = function () {}; + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - return function(e) { - var t = new Float32Array(256) - , i = new Float32Array(256) - , n = new Float32Array(256) - , r = new Float32Array(256) - , o = new Uint8ClampedArray(1024) - , a = new BABYLON.DynamicTexture("lavaTexture",{ - width: 16, - height: 16 - },e.rendering._scene); - a.hasAlpha = false, - a.anisotropicFilteringLevel = 1, - a.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE), - a.wrapU = 1, - a.wrapV = 1; - var s = a.getContext() - , c = new ImageData(o,16,16) - , u = 0; - e.on("tick", function(e) { - ++u % 2 != 1 && l.redraw() - }); - var l = { - texture: a, - tick: function() {}, - redraw: function() { - l.update(), - s.clearRect(0, 0, 16, 16), - s.putImageData(c, 0, 0), - a.update() - }, - update: function() { - for (var e = 0; e < 16; e++) - for (var a = 0; a < 16; a++) { - for (var s = 0, c = 1.2 * Math.sin(a * Math.PI * 2 / 16), u = 1.2 * Math.sin(e * Math.PI * 2 / 16), l = e - 1; l <= e + 1; l++) - for (var h = a - 1; h <= a + 1; h++) { - var f = l + c & 15 - , d = h + u & 15; - s += t[f + 16 * d] - } - i[e + 16 * a] = s / 10 + (n[(e + 0 & 15) + 16 * (a + 0 & 15)] + n[(e + 1 & 15) + 16 * (a + 0 & 15)] + n[(e + 1 & 15) + 16 * (a + 1 & 15)] + n[(e + 0 & 15) + 16 * (a + 1 & 15)]) / 4 * .8, - n[e + 16 * a] += .01 * r[e + 16 * a], - n[e + 16 * a] < 0 && (n[e + 16 * a] = 0), - r[e + 16 * a] -= .06, - Math.random() < .005 && (r[e + 16 * a] = 1.5) - } - var p = i; - i = t, - t = p; - for (var m = 0; m < 256; m++) { - var s = 2 * t[m]; - s > 1 && (s = 1), - s < 0 && (s = 0); - var g = s - , _ = 100 * g + 155 - , v = g * g * 255 - , y = g * g * g * g * 128; - o[4 * m + 0] = _, - o[4 * m + 1] = v, - o[4 * m + 2] = y, - o[4 * m + 3] = 255 - } - } - }; - return l - }(e) - } -} -, function(e, t) { - var i, n, r, o, a = Math.sqrt(5), s = Math.sqrt(7), c = Math.floor; + e.exports = function (e) { + return (function (e) { + var t = new Float32Array(256), + i = new Float32Array(256), + n = new Float32Array(256), + r = new Float32Array(256), + o = new Uint8ClampedArray(1024), + a = new BABYLON.DynamicTexture( + "lavaTexture", + { + width: 16, + height: 16, + }, + e.rendering._scene + ); + (a.hasAlpha = false), + (a.anisotropicFilteringLevel = 1), + a.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE), + (a.wrapU = 1), + (a.wrapV = 1); + var s = a.getContext(), + c = new ImageData(o, 16, 16), + u = 0; + e.on("tick", function (e) { + ++u % 2 != 1 && l.redraw(); + }); + var l = { + texture: a, + tick: function () {}, + redraw: function () { + l.update(), + s.clearRect(0, 0, 16, 16), + s.putImageData(c, 0, 0), + a.update(); + }, + update: function () { + for (var e = 0; e < 16; e++) + for (var a = 0; a < 16; a++) { + for ( + var s = 0, + c = 1.2 * Math.sin((a * Math.PI * 2) / 16), + u = 1.2 * Math.sin((e * Math.PI * 2) / 16), + l = e - 1; + l <= e + 1; + l++ + ) + for (var h = a - 1; h <= a + 1; h++) { + var f = (l + c) & 15, + d = (h + u) & 15; + s += t[f + 16 * d]; + } + (i[e + 16 * a] = + s / 10 + + ((n[((e + 0) & 15) + 16 * ((a + 0) & 15)] + + n[((e + 1) & 15) + 16 * ((a + 0) & 15)] + + n[((e + 1) & 15) + 16 * ((a + 1) & 15)] + + n[((e + 0) & 15) + 16 * ((a + 1) & 15)]) / + 4) * + 0.8), + (n[e + 16 * a] += 0.01 * r[e + 16 * a]), + n[e + 16 * a] < 0 && (n[e + 16 * a] = 0), + (r[e + 16 * a] -= 0.06), + Math.random() < 0.005 && (r[e + 16 * a] = 1.5); + } + var p = i; + (i = t), (t = p); + for (var m = 0; m < 256; m++) { + var s = 2 * t[m]; + s > 1 && (s = 1), s < 0 && (s = 0); + var g = s, + _ = 100 * g + 155, + v = g * g * 255, + y = g * g * g * g * 128; + (o[4 * m + 0] = _), + (o[4 * m + 1] = v), + (o[4 * m + 2] = y), + (o[4 * m + 3] = 255); + } + }, + }; + return l; + })(e); + }; + }, + function (e, t) { + var i, + n, + r, + o, + a = Math.sqrt(5), + s = Math.sqrt(7), + c = Math.floor; function u(e) { - return e - c(e) + return e - c(e); } - e.exports = function() { - for (i = a, - n = s, - r = 0; r < arguments.length; ++r) - o = arguments[r], - i = u(i * (o + s)), - n *= o + a; - return i = u(i * n) - } -} -, function(e, t, i) { + e.exports = function () { + for (i = a, n = s, r = 0; r < arguments.length; ++r) + (o = arguments[r]), (i = u(i * (o + s))), (n *= o + a); + return (i = u(i * n)); + }; + }, + function (e, t, i) { "use strict"; var n = i(43).removeUnorderedListItem; - e.exports = new function() { - function e(e) { - for (var t = e._mergedObjectSystems; t.length; ) { - var i = t.pop(); - i.mesh && e.octreeBlock && e.octreeBlock.entries && n(e.octreeBlock.entries, i.mesh), - i.mesh && i.mesh.dispose(), - i.dispose() - } + e.exports = new (function () { + function e(e) { + for (var t = e._mergedObjectSystems; t.length; ) { + var i = t.pop(); + i.mesh && + e.octreeBlock && + e.octreeBlock.entries && + n(e.octreeBlock.entries, i.mesh), + i.mesh && i.mesh.dispose(), + i.dispose(); } - function t(e, t, i, n, r, o) { - var a = e._objectBlocks - , s = new BABYLON.SolidParticleSystem("object_sps_" + e.id,t,{ - updatable: false - }) - , c = e.noa.registry._blockHandlers - , u = e.noa.registry._blockMesh; - for (var l in i) { - var h, f = u[l], d = i[l], p = d.length, m = c[l]; - m && (h = m.onCustomMeshCreate); - s.addShape(f, p, { - positionFunction: function(e, t, i) { - var s = d[i] - , c = a[s]; - e.position.copyFromFloats(n + c.x + .5, r + c.y, o + c.z + .5), - h && h(e, n + c.x, r + c.y, o + c.z); - e.position.x -= n, - e.position.y -= r, - e.position.z -= o - } - }), - d.length = 0 - } - return s + } + function t(e, t, i, n, r, o) { + var a = e._objectBlocks, + s = new BABYLON.SolidParticleSystem("object_sps_" + e.id, t, { + updatable: false, + }), + c = e.noa.registry._blockHandlers, + u = e.noa.registry._blockMesh; + for (var l in i) { + var h, + f = u[l], + d = i[l], + p = d.length, + m = c[l]; + m && (h = m.onCustomMeshCreate); + s.addShape(f, p, { + positionFunction: function (e, t, i) { + var s = d[i], + c = a[s]; + e.position.copyFromFloats(n + c.x + 0.5, r + c.y, o + c.z + 0.5), + h && h(e, n + c.x, r + c.y, o + c.z); + (e.position.x -= n), (e.position.y -= r), (e.position.z -= o); + }, + }), + (d.length = 0); } - this.initChunk = function(e) { - e._objectBlocks = {}, - e._mergedObjectSystems = [] - } - , - this.disposeChunk = function(t) { - e(t), - t._objectBlocks = null - } - , - this.addObjectBlock = function(e, t, i, n, o) { - var a = i + "|" + n + "|" + o; - e._objectBlocks[a] = new r(t,i,n,o,null) - } - , - this.removeObjectBlock = function(e, t, i, n) { - var r = t + "|" + i + "|" + n; - e._objectBlocks[r] && delete e._objectBlocks[r] - } - , - this.buildObjectMesh = function(i) { - o("start"), - e(i); - var n = i.noa.rendering.getScene() - , r = i.noa.registry._blockMesh - , a = {}; - for (var s in i._objectBlocks) { - var c = i._objectBlocks[s] - , u = c.id - , l = r[u].material - , h = l ? n.materials.indexOf(l) : -1; - a[h] || (a[h] = {}), - a[h][u] || (a[h][u] = []), - a[h][u].push(s) - } - o("preprocess"); - var f = i.i * i.size - , d = i.j * i.size - , p = i.k * i.size; - for (var m in a) { - var g = a[m] - , _ = t(i, n, g, f, d, p); - o("made SPS"); - var v = _.buildMesh(); - o("built mesh"), - v.material = m > -1 ? n.materials[m] : null, - v.position.x = f, - v.position.y = d, - v.position.z = p, - v.freezeWorldMatrix(), - v.freezeNormals(), - i.octreeBlock.entries.push(v), - i._mergedObjectSystems.push(_) - } - o("end") - } - } - ; + return s; + } + (this.initChunk = function (e) { + (e._objectBlocks = {}), (e._mergedObjectSystems = []); + }), + (this.disposeChunk = function (t) { + e(t), (t._objectBlocks = null); + }), + (this.addObjectBlock = function (e, t, i, n, o) { + var a = i + "|" + n + "|" + o; + e._objectBlocks[a] = new r(t, i, n, o, null); + }), + (this.removeObjectBlock = function (e, t, i, n) { + var r = t + "|" + i + "|" + n; + e._objectBlocks[r] && delete e._objectBlocks[r]; + }), + (this.buildObjectMesh = function (i) { + o("start"), e(i); + var n = i.noa.rendering.getScene(), + r = i.noa.registry._blockMesh, + a = {}; + for (var s in i._objectBlocks) { + var c = i._objectBlocks[s], + u = c.id, + l = r[u].material, + h = l ? n.materials.indexOf(l) : -1; + a[h] || (a[h] = {}), a[h][u] || (a[h][u] = []), a[h][u].push(s); + } + o("preprocess"); + var f = i.i * i.size, + d = i.j * i.size, + p = i.k * i.size; + for (var m in a) { + var g = a[m], + _ = t(i, n, g, f, d, p); + o("made SPS"); + var v = _.buildMesh(); + o("built mesh"), + (v.material = m > -1 ? n.materials[m] : null), + (v.position.x = f), + (v.position.y = d), + (v.position.z = p), + v.freezeWorldMatrix(), + v.freezeNormals(), + i.octreeBlock.entries.push(v), + i._mergedObjectSystems.push(_); + } + o("end"); + }); + })(); function r(e, t, i, n) { - this.id = 0 | e, - this.x = 0 | t, - this.y = 0 | i, - this.z = 0 | n + (this.id = 0 | e), (this.x = 0 | t), (this.y = 0 | i), (this.z = 0 | n); } - var o = function() {} -} -, function(e, t, i) { + var o = function () {}; + }, + function (e, t, i) { "use strict"; - var n = i(467) - , r = i(32); - e.exports = function(e, t, i) { - return function(e, t, i) { - t = r({}, o, t); - var a = n(i, t) - , s = t.bindings; - for (var c in s) { - var u = Array.isArray(s[c]) ? s[c] : [s[c]]; - u.unshift(c), - a.bind.apply(a, u) - } - return a - }(0, t, i) - } - ; - var o = { - bindings: { - forward: "W", - left: "A", - backward: "S", - right: "D", - fire: "", - "mid-fire": "", - "alt-fire": "", - jump: "", - build: "B", - chat: "T", - fog: "F", - saveLoc: "", - loadLoc: "R", - spawnSteve: "G" + var n = i(467), + r = i(32); + e.exports = function (e, t, i) { + return (function (e, t, i) { + t = r({}, o, t); + var a = n(i, t), + s = t.bindings; + for (var c in s) { + var u = Array.isArray(s[c]) ? s[c] : [s[c]]; + u.unshift(c), a.bind.apply(a, u); } - } -} -, function(e, t, i) { + return a; + })(0, t, i); + }; + var o = { + bindings: { + forward: "W", + left: "A", + backward: "S", + right: "D", + fire: "", + "mid-fire": "", + "alt-fire": "", + jump: "", + build: "B", + chat: "T", + fog: "F", + saveLoc: "", + loadLoc: "R", + spawnSteve: "G", + }, + }; + }, + function (e, t, i) { "use strict"; - var n = i(190) - , r = i(42).EventEmitter - , o = i(468); + var n = i(190), + r = i(42).EventEmitter, + o = i(468); function a(e, t) { - this.element = e || document, - t = t || {}, - this.preventDefaults = !!t.preventDefaults, - this.stopPropagation = !!t.stopPropagation, - this.down = new r, - this.up = new r, - this.state = { - active: true, - dx: 0, - dy: 0, - scrollx: 0, - scrolly: 0, - scrollz: 0 - }, - this._keybindmap = {}, - this._keyStates = {}, - this._bindPressCounts = {}, - this.initEvents() + (this.element = e || document), + (t = t || {}), + (this.preventDefaults = !!t.preventDefaults), + (this.stopPropagation = !!t.stopPropagation), + (this.down = new r()), + (this.up = new r()), + (this.state = { + active: true, + dx: 0, + dy: 0, + scrollx: 0, + scrolly: 0, + scrollz: 0, + }), + (this._keybindmap = {}), + (this._keyStates = {}), + (this._bindPressCounts = {}), + this.initEvents(); } function s(e, t, i) { - d(i.keyCode, n[i.keyCode], t, e, i) + d(i.keyCode, n[i.keyCode], t, e, i); } function c(e, t, i) { - if (e.state.active) - return d(-1 - i.button, "", t, e, i), - false + if (e.state.active) + return ( + d(-1 - i.button, "", t, e, i), false + ); } function u(e, t) { - var i = t.movementX || t.mozMovementX || 0 - , n = t.movementY || t.mozMovementY || 0; - if (t.touches && 0 == (i | n)) { - var r = function(e) { - for (var t, i = e.changedTouches, n = 0; n < i.length; ++n) - i[n].identifier == f && (t = i[n]); - if (!t) - return [0, 0]; - var r = [t.clientX - l, t.clientY - h]; - return l = t.clientX, - h = t.clientY, - r - }(t); - i = r[0], - n = r[1] - } - e.state.dx += i, - e.state.dy += n + var i = t.movementX || t.mozMovementX || 0, + n = t.movementY || t.mozMovementY || 0; + if (t.touches && 0 == (i | n)) { + var r = (function (e) { + for (var t, i = e.changedTouches, n = 0; n < i.length; ++n) + i[n].identifier == f && (t = i[n]); + if (!t) return [0, 0]; + var r = [t.clientX - l, t.clientY - h]; + return (l = t.clientX), (h = t.clientY), r; + })(t); + (i = r[0]), (n = r[1]); + } + (e.state.dx += i), (e.state.dy += n); } - e.exports = function(e, t) { - return new a(e,t) - } - , - a.prototype.initEvents = function() { + (e.exports = function (e, t) { + return new a(e, t); + }), + (a.prototype.initEvents = function () { window.addEventListener("keydown", s.bind(void 0, this, true), false), - window.addEventListener("keyup", s.bind(void 0, this, false), false), - this.element.addEventListener("mousedown", c.bind(void 0, this, true), false), - this.element.addEventListener("mouseup", c.bind(void 0, this, false), false), - this.element.oncontextmenu = function(e) { - if (e._keybindmap[""]) - return false - } - .bind(void 0, this), - this.element.addEventListener("dragstart", c.bind(void 0, this, false), false), - this.element.addEventListener("mousemove", u.bind(void 0, this), false), - this.element.addEventListener("touchmove", u.bind(void 0, this), false), - this.element.addEventListener("touchstart", function(e, t) { - var i = t.changedTouches[0]; - l = i.clientX, - h = i.clientY, - f = i.identifier - } - .bind(void 0, this), false), - o(document, function(e, t) { - var i = 1; - switch (t.deltaMode) { - case 0: - i = 1; - break; - case 1: - i = 12; - break; - case 2: - i = e.element.clientHeight || window.innerHeight - } - return e.state.scrollx += t.deltaX * i, - e.state.scrolly += t.deltaY * i, - e.state.scrollz += t.deltaZ * i || 0, + window.addEventListener("keyup", s.bind(void 0, this, false), false), + this.element.addEventListener( + "mousedown", + c.bind(void 0, this, true), false - } - .bind(void 0, this), false) - } - , - a.prototype.bind = function(e) { + ), + this.element.addEventListener( + "mouseup", + c.bind(void 0, this, false), + false + ), + (this.element.oncontextmenu = function (e) { + if (e._keybindmap[""]) return false; + }.bind(void 0, this)), + this.element.addEventListener( + "dragstart", + c.bind(void 0, this, false), + false + ), + this.element.addEventListener( + "mousemove", + u.bind(void 0, this), + false + ), + this.element.addEventListener( + "touchmove", + u.bind(void 0, this), + false + ), + this.element.addEventListener( + "touchstart", + function (e, t) { + var i = t.changedTouches[0]; + (l = i.clientX), (h = i.clientY), (f = i.identifier); + }.bind(void 0, this), + false + ), + o( + document, + function (e, t) { + var i = 1; + switch (t.deltaMode) { + case 0: + i = 1; + break; + case 1: + i = 12; + break; + case 2: + i = e.element.clientHeight || window.innerHeight; + } + return ( + (e.state.scrollx += t.deltaX * i), + (e.state.scrolly += t.deltaY * i), + (e.state.scrollz += t.deltaZ * i || 0), + false + ); + }.bind(void 0, this), + false + ); + }), + (a.prototype.bind = function (e) { for (var t = 1; t < arguments.length; ++t) { - var i = arguments[t] - , n = this._keybindmap[i] || []; - -1 == n.indexOf(e) && n.push(e), - this._keybindmap[i] = n + var i = arguments[t], + n = this._keybindmap[i] || []; + -1 == n.indexOf(e) && n.push(e), (this._keybindmap[i] = n); } - this.state[e] = !!this.state[e] - } - , - a.prototype.unbind = function(e) { + this.state[e] = !!this.state[e]; + }), + (a.prototype.unbind = function (e) { for (var t in this._keybindmap) { - var i = this._keybindmap[t] - , n = i.indexOf(e); - n > -1 && i.splice(n, 1) + var i = this._keybindmap[t], + n = i.indexOf(e); + n > -1 && i.splice(n, 1); } - } - , - a.prototype.tick = function() { - this.state.dx = this.state.dy = 0 - } - , - a.prototype.getBoundKeys = function() { + }), + (a.prototype.tick = function () { + this.state.dx = this.state.dy = 0; + }), + (a.prototype.getBoundKeys = function () { var e = []; - for (var t in this._keybindmap) - e.push(t); - return e - } - ; - var l = 0 - , h = 0 - , f = null; + for (var t in this._keybindmap) e.push(t); + return e; + }); + var l = 0, + h = 0, + f = null; function d(e, t, i, n, r) { - var o = n._keybindmap[t]; - if (o && (n.preventDefaults && r.preventDefault(), + var o = n._keybindmap[t]; + if ( + o && + (n.preventDefaults && r.preventDefault(), n.stopPropagation && r.stopPropagation(), - n.state.active)) { - if (m(n._keyStates[e], i)) - for (var a = 0; a < o.length; ++a) - p(o[a], i, n, r); - n._keyStates[e] = i - } + n.state.active) + ) { + if (m(n._keyStates[e], i)) + for (var a = 0; a < o.length; ++a) p(o[a], i, n, r); + n._keyStates[e] = i; + } } function p(e, t, i, n) { - var r = i._bindPressCounts[e] || 0; - ((r += t ? 1 : -1) < 0 && (r = 0), - i._bindPressCounts[e] = r, - m(i.state[e], r)) && (t ? i.down : i.up).emit(e, n); - i.state[e] = !!r + var r = i._bindPressCounts[e] || 0; + ((r += t ? 1 : -1) < 0 && (r = 0), + (i._bindPressCounts[e] = r), + m(i.state[e], r)) && (t ? i.down : i.up).emit(e, n); + i.state[e] = !!r; } function m(e, t) { - return e ? !t : t + return e ? !t : t; } -} -, function(e, t) { - var i, n, r = ""; + }, + function (e, t) { + var i, + n, + r = ""; function o(e, t, o, a) { - e[i](r + t, "wheel" == n ? o : function(e) { - !e && (e = window.event); - var t = { + e[i]( + r + t, + "wheel" == n + ? o + : function (e) { + !e && (e = window.event); + var t = { originalEvent: e, target: e.target || e.srcElement, type: "wheel", deltaMode: "MozMousePixelScroll" == e.type ? 0 : 1, deltaX: 0, delatZ: 0, - preventDefault: function() { - e.preventDefault ? e.preventDefault() : e.returnValue = false - } - }; - return "mousewheel" == n ? (t.deltaY = -.025 * e.wheelDelta, - e.wheelDeltaX && (t.deltaX = -.025 * e.wheelDeltaX)) : t.deltaY = e.detail, - o(t) - } - , a || false) + preventDefault: function () { + e.preventDefault + ? e.preventDefault() + : (e.returnValue = false); + }, + }; + return ( + "mousewheel" == n + ? ((t.deltaY = -0.025 * e.wheelDelta), + e.wheelDeltaX && (t.deltaX = -0.025 * e.wheelDeltaX)) + : (t.deltaY = e.detail), + o(t) + ); + }, + a || false + ); } - window.addEventListener ? i = "addEventListener" : (i = "attachEvent", - r = "on"), - n = "onwheel"in document.createElement("div") ? "wheel" : void 0 !== document.onmousewheel ? "mousewheel" : "DOMMouseScroll", - e.exports = function(e, t, i) { + window.addEventListener + ? (i = "addEventListener") + : ((i = "attachEvent"), (r = "on")), + (n = + "onwheel" in document.createElement("div") + ? "wheel" + : void 0 !== document.onmousewheel + ? "mousewheel" + : "DOMMouseScroll"), + (e.exports = function (e, t, i) { o(e, n, t, i), - "DOMMouseScroll" == n && o(e, "MozMousePixelScroll", t, i) - } -} -, function(e, t, getterFunc) { + "DOMMouseScroll" == n && o(e, "MozMousePixelScroll", t, i); + }); + }, + function (e, t, getterFunc) { "use strict"; var n = getterFunc(470); var vec3Math = getterFunc(16); var o = getterFunc(32); - e.exports = function(e, t) { - return function(e, t) { - t = o({}, a, t); - var i = e.world - , r = n(t, function(e, t, n) { - var r = i.getBlockID(e, t, n); - return 5 != r && 6 != r && 8 != r && 15 != r && 16 != r && i.getBlockSolidity(e, t, n) - }, function(e, t, n) { - return i.getBlockFluidity(e, t, n) - }); - return r._originalTick = r.tick, - r.tick = function(t) { - this._originalTick(t), - function(e) { - for (var t = e.ents, i = t.getStatesList(t.names.physics), n = s, r = 0; r < i.length; ++r) { - var o = i[r] - , a = t.getPositionData(o.__id); - n[0] = a.width / 2, - n[1] = 0, - n[2] = n[0]; - for (var c = a.position, u = o.body.aabb.base, l = o.body.aabb.max, h = a._extents, f = 0; f < 3; f++) - c[f] = u[f] + n[f], - h[f] = u[f], - h[f + 3] = l[f] - } - }(e) + e.exports = function (e, t) { + return (function (e, t) { + t = o({}, a, t); + var i = e.world, + r = n( + t, + function (e, t, n) { + var r = i.getBlockID(e, t, n); + return ( + 5 != r && + 6 != r && + 8 != r && + 15 != r && + 16 != r && + i.getBlockSolidity(e, t, n) + ); + }, + function (e, t, n) { + return i.getBlockFluidity(e, t, n); } - , - r - }(e, t) - } - ; - var a = { - gravity: [0, -10, 0], - airFriction: .999 + ); + return ( + (r._originalTick = r.tick), + (r.tick = function (t) { + this._originalTick(t), + (function (e) { + for ( + var t = e.ents, + i = t.getStatesList(t.names.physics), + n = s, + r = 0; + r < i.length; + ++r + ) { + var o = i[r], + a = t.getPositionData(o.__id); + (n[0] = a.width / 2), (n[1] = 0), (n[2] = n[0]); + for ( + var c = a.position, + u = o.body.aabb.base, + l = o.body.aabb.max, + h = a._extents, + f = 0; + f < 3; + f++ + ) + (c[f] = u[f] + n[f]), (h[f] = u[f]), (h[f + 3] = l[f]); + } + })(e); + }), + r + ); + })(e, t); }; - var s = vec3Math.create() -} -, function(e, t, getterFunc) { + var a = { + gravity: [0, -10, 0], + airFriction: 0.999, + }; + var s = vec3Math.create(); + }, + function (e, t, getterFunc) { "use strict"; - var n = getterFunc(32) - var r = getterFunc(191) - var vec3Math = getterFunc(16) - var a = getterFunc(187) + var n = getterFunc(32); + var r = getterFunc(191); + var vec3Math = getterFunc(16); + var a = getterFunc(187); var s = getterFunc(471); - e.exports = function(e, t, i) { - return new u(e,t,i) - } - ; + e.exports = function (e, t, i) { + return new u(e, t, i); + }; var c = { - gravity: [0, -10, 0], - airFriction: .995, - minBounceImpulse: .5, - fluidDensity: 1.2, - fluidDrag: 4 + gravity: [0, -10, 0], + airFriction: 0.995, + minBounceImpulse: 0.5, + fluidDensity: 1.2, + fluidDrag: 4, }; function u(e, t, i) { - e = n({}, c, e), - this.gravity = e.gravity, - this.airFriction = e.airFriction, - this.fluidDensity = e.fluidDensity, - this.fluidDrag = e.fluidDrag, - this.minBounceImpulse = e.minBounceImpulse, - this.bodies = [], - this.testSolid = t, - this.testFluid = i + (e = n({}, c, e)), + (this.gravity = e.gravity), + (this.airFriction = e.airFriction), + (this.fluidDensity = e.fluidDensity), + (this.fluidDrag = e.fluidDrag), + (this.minBounceImpulse = e.minBounceImpulse), + (this.bodies = []), + (this.testSolid = t), + (this.testFluid = i); } - u.prototype.addBody = function(e, t, i, n, o, a) { - e = e || new r([0, 0, 0],[1, 1, 1]), + (u.prototype.addBody = function (e, t, i, n, o, a) { + (e = e || new r([0, 0, 0], [1, 1, 1])), void 0 === t && (t = 1), void 0 === i && (i = 1), void 0 === n && (n = 0), void 0 === o && (o = 1); - var c = new s(e,t,i,n,o,a); - return this.bodies.push(c), - c - } - , - u.prototype.removeBody = function(e) { + var c = new s(e, t, i, n, o, a); + return this.bodies.push(c), c; + }), + (u.prototype.removeBody = function (e) { var t = this.bodies.indexOf(e); - t < 0 || (this.bodies.splice(t, 1), - e.aabb = e.onCollide = null) - } - ; - var l = vec3Math.create() - , h = vec3Math.create() - , f = vec3Math.create() - , d = vec3Math.create() - , p = vec3Math.create() - , m = vec3Math.create() - , g = vec3Math.create(); + t < 0 || (this.bodies.splice(t, 1), (e.aabb = e.onCollide = null)); + }); + var l = vec3Math.create(), + h = vec3Math.create(), + f = vec3Math.create(), + d = vec3Math.create(), + p = vec3Math.create(), + m = vec3Math.create(), + g = vec3Math.create(); function _(e, t, i, n) { - return vec3Math.set(n, 0, 0, 0), - a(e.testSolid, t, i, function(e, t, i, r) { - n[t] = i, - r[t] = 0 + return ( + vec3Math.set(n, 0, 0, 0), + a(e.testSolid, t, i, function (e, t, i, r) { + (n[t] = i), (r[t] = 0); }) + ); } - u.prototype.tick = function(e) { - var t, i, n, r, a = S(0, vec3Math.squaredLength(this.gravity)); - for (e /= 1e3, - i = 0, - r = this.bodies.length; i < r; ++i) { - if (t = this.bodies[i], - vec3Math.copy(g, t.resting), - !x(this, t, e, a || 0 === t.gravityMultiplier)) { - if (t._sleepFrameCount--, - vec3Math.scale(h, t._forces, 1 / t.mass), - vec3Math.scaleAndAdd(h, h, this.gravity, t.gravityMultiplier), - vec3Math.scale(d, t._impulses, 1 / t.mass), - vec3Math.add(t.velocity, t.velocity, d), - vec3Math.scale(d, h, e), - vec3Math.add(t.velocity, t.velocity, d), - g[1] < 0) { - var s = e * t.friction; - vec3Math.scale(l, t.velocity, -1), - l[1] = 0; - var c = vec3Math.length(l); - c > s ? (vec3Math.scale(l, l, s / c), - vec3Math.add(t.velocity, t.velocity, l)) : t.velocity[0] = t.velocity[2] = 0 - } else - vec3Math.scale(t.velocity, t.velocity, this.airFriction); - for (vec3Math.scale(p, t.velocity, e), - vec3Math.set(t._forces, 0, 0, 0), - vec3Math.set(t._impulses, 0, 0, 0), - t.autoStep && C(v, t.aabb), - _(this, t.aabb, p, t.resting), - t.autoStep && A(this, t, v, p), - n = 0; n < 3; ++n) - m[n] = 0, - t.resting[n] && (g[n] || (m[n] = -t.velocity[n]), - t.velocity[n] = 0); - var u = vec3Math.length(m); - u > .001 && (u > this.minBounceImpulse && t.restitution && (vec3Math.scale(m, m, t.restitution * t.mass), - t.applyImpulse(m)), - t.onCollide && t.onCollide(m)); - for (var y = t.aabb, b = Math.floor((y.base[0] + y.max[0]) / 2), E = Math.floor((y.base[2] + y.max[2]) / 2), T = Math.floor(y.base[1]), P = Math.floor(y.max[1]), R = 0, M = T; M <= P && this.testFluid(b, M, E); ++M) - ++R; - if (R > 0) { - var O = (T + R - y.base[1]) / y.vec[1]; - O > 1 && (O = 1); - var w = y.vec[0] * y.vec[1] * y.vec[2] * O; - vec3Math.scale(f, this.gravity, -t.gravityMultiplier * this.fluidDensity * w), - vec3Math.scale(l, t.velocity, -this.fluidDrag * O), - vec3Math.add(f, f, l), - t.applyForce(f), - t.inFluid = true - } else - t.inFluid = false; - vec3Math.squaredLength(t.velocity) > 1e-5 && t._markActive() - } + u.prototype.tick = function (e) { + var t, + i, + n, + r, + a = S(0, vec3Math.squaredLength(this.gravity)); + for (e /= 1e3, i = 0, r = this.bodies.length; i < r; ++i) { + if ( + ((t = this.bodies[i]), + vec3Math.copy(g, t.resting), + !x(this, t, e, a || 0 === t.gravityMultiplier)) + ) { + if ( + (t._sleepFrameCount--, + vec3Math.scale(h, t._forces, 1 / t.mass), + vec3Math.scaleAndAdd(h, h, this.gravity, t.gravityMultiplier), + vec3Math.scale(d, t._impulses, 1 / t.mass), + vec3Math.add(t.velocity, t.velocity, d), + vec3Math.scale(d, h, e), + vec3Math.add(t.velocity, t.velocity, d), + g[1] < 0) + ) { + var s = e * t.friction; + vec3Math.scale(l, t.velocity, -1), (l[1] = 0); + var c = vec3Math.length(l); + c > s + ? (vec3Math.scale(l, l, s / c), + vec3Math.add(t.velocity, t.velocity, l)) + : (t.velocity[0] = t.velocity[2] = 0); + } else vec3Math.scale(t.velocity, t.velocity, this.airFriction); + for ( + vec3Math.scale(p, t.velocity, e), + vec3Math.set(t._forces, 0, 0, 0), + vec3Math.set(t._impulses, 0, 0, 0), + t.autoStep && C(v, t.aabb), + _(this, t.aabb, p, t.resting), + t.autoStep && A(this, t, v, p), + n = 0; + n < 3; + ++n + ) + (m[n] = 0), + t.resting[n] && + (g[n] || (m[n] = -t.velocity[n]), (t.velocity[n] = 0)); + var u = vec3Math.length(m); + u > 0.001 && + (u > this.minBounceImpulse && + t.restitution && + (vec3Math.scale(m, m, t.restitution * t.mass), t.applyImpulse(m)), + t.onCollide && t.onCollide(m)); + for ( + var y = t.aabb, + b = Math.floor((y.base[0] + y.max[0]) / 2), + E = Math.floor((y.base[2] + y.max[2]) / 2), + T = Math.floor(y.base[1]), + P = Math.floor(y.max[1]), + R = 0, + M = T; + M <= P && this.testFluid(b, M, E); + ++M + ) + ++R; + if (R > 0) { + var O = (T + R - y.base[1]) / y.vec[1]; + O > 1 && (O = 1); + var w = y.vec[0] * y.vec[1] * y.vec[2] * O; + vec3Math.scale( + f, + this.gravity, + -t.gravityMultiplier * this.fluidDensity * w + ), + vec3Math.scale(l, t.velocity, -this.fluidDrag * O), + vec3Math.add(f, f, l), + t.applyForce(f), + (t.inFluid = true); + } else t.inFluid = false; + vec3Math.squaredLength(t.velocity) > 1e-5 && t._markActive(); } - } - ; - var v = new r([],[]) - , y = vec3Math.create() - , b = vec3Math.create() - , E = vec3Math.create() - , T = vec3Math.create(); + } + }; + var v = new r([], []), + y = vec3Math.create(), + b = vec3Math.create(), + E = vec3Math.create(), + T = vec3Math.create(); function A(e, t, i, n) { - if (!(t.resting[1] >= 0) || t.inFluid) { - var r = 0 !== t.resting[0] - , s = 0 !== t.resting[2]; - if (r || s) { - var c = Math.abs(n[0] / n[2]); - if ((r || !(c > 4)) && (s || !(c < .25))) { - vec3Math.add(b, i.base, n); - var u = e.testSolid - , l = (a(u, i, n, function(e, t, i, n) { - if (1 !== t) - return true; - n[t] = 0 - }), - t.aabb.base[1]) - , h = Math.floor(l + 1.001) - l; - vec3Math.set(E, 0, h, 0); - var f = false; - a(u, i, E, function(e, t, i, n) { - return f = true, - true - }); - if (!f) { - vec3Math.subtract(T, b, i.base), - T[1] = 0; - _(e, i, T, y); - r && !S(i.base[0], b[0]) || s && !S(i.base[2], b[2]) || (C(t.aabb, i), - t.resting[0] = y[0], - t.resting[2] = y[2], - t.onStep && t.onStep()) - } - } + if (!(t.resting[1] >= 0) || t.inFluid) { + var r = 0 !== t.resting[0], + s = 0 !== t.resting[2]; + if (r || s) { + var c = Math.abs(n[0] / n[2]); + if ((r || !(c > 4)) && (s || !(c < 0.25))) { + vec3Math.add(b, i.base, n); + var u = e.testSolid, + l = + (a(u, i, n, function (e, t, i, n) { + if (1 !== t) return true; + n[t] = 0; + }), + t.aabb.base[1]), + h = Math.floor(l + 1.001) - l; + vec3Math.set(E, 0, h, 0); + var f = false; + a(u, i, E, function (e, t, i, n) { + return (f = true), true; + }); + if (!f) { + vec3Math.subtract(T, b, i.base), (T[1] = 0); + _(e, i, T, y); + (r && !S(i.base[0], b[0])) || + (s && !S(i.base[2], b[2])) || + (C(t.aabb, i), + (t.resting[0] = y[0]), + (t.resting[2] = y[2]), + t.onStep && t.onStep()); } + } } + } } function x(e, t, i, n) { - if (t._sleepFrameCount > 0) - return false; - if (n) - return true; - var r = false; - return vec3Math.scale(d, e.gravity, i), - a(e.testSolid, t.aabb, d, function() { - return r = true, - true - }, true), + if (t._sleepFrameCount > 0) return false; + if (n) return true; + var r = false; + return ( + vec3Math.scale(d, e.gravity, i), + a( + e.testSolid, + t.aabb, + d, + function () { + return (r = true), true; + }, + true + ), r + ); } function S(e, t) { - return Math.abs(e - t) < 1e-5 + return Math.abs(e - t) < 1e-5; } function C(e, t) { - for (var i = 0; i < 3; i++) - e.base[i] = t.base[i], - e.max[i] = t.max[i], - e.vec[i] = t.vec[i] + for (var i = 0; i < 3; i++) + (e.base[i] = t.base[i]), (e.max[i] = t.max[i]), (e.vec[i] = t.vec[i]); } -} -, function(e, t, getterFunc) { + }, + function (e, t, getterFunc) { var n = getterFunc(191); var vec3Math = getterFunc(16); - + function o(e, t, i, o, a, s, c) { - this.aabb = new n(e.base,e.vec), - this.mass = t, - this.friction = i, - this.restitution = o, - this.gravityMultiplier = a, - this.onCollide = s, - this.autoStep = !!c, - this.onStep = null, - this.velocity = vec3Math.create(), - this.resting = [false, false, false], - this.inFluid = false, - this._forces = vec3Math.create(), - this._impulses = vec3Math.create(), - this._sleepFrameCount = 10 + (this.aabb = new n(e.base, e.vec)), + (this.mass = t), + (this.friction = i), + (this.restitution = o), + (this.gravityMultiplier = a), + (this.onCollide = s), + (this.autoStep = !!c), + (this.onStep = null), + (this.velocity = vec3Math.create()), + (this.resting = [false, false, false]), + (this.inFluid = false), + (this._forces = vec3Math.create()), + (this._impulses = vec3Math.create()), + (this._sleepFrameCount = 10); } - e.exports = o, - o.prototype.setPosition = function(e) { + (e.exports = o), + (o.prototype.setPosition = function (e) { vec3Math.subtract(e, e, this.aabb.base), - this.aabb.translate(e), - this._markActive() - } - , - o.prototype.getPosition = function() { - return vec3Math.clone(this.aabb.base) - } - , - o.prototype.applyForce = function(e) { - vec3Math.add(this._forces, this._forces, e), - this._markActive() - } - , - o.prototype.applyImpulse = function(e) { - vec3Math.add(this._impulses, this._impulses, e), - this._markActive() - } - , - o.prototype._markActive = function() { - this._sleepFrameCount = 10 - } - , - o.prototype.atRestX = function() { - return this.resting[0] - } - , - o.prototype.atRestY = function() { - return this.resting[1] - } - , - o.prototype.atRestZ = function() { - return this.resting[2] - } -} -, function(e, t, i) { + this.aabb.translate(e), + this._markActive(); + }), + (o.prototype.getPosition = function () { + return vec3Math.clone(this.aabb.base); + }), + (o.prototype.applyForce = function (e) { + vec3Math.add(this._forces, this._forces, e), this._markActive(); + }), + (o.prototype.applyImpulse = function (e) { + vec3Math.add(this._impulses, this._impulses, e), this._markActive(); + }), + (o.prototype._markActive = function () { + this._sleepFrameCount = 10; + }), + (o.prototype.atRestX = function () { + return this.resting[0]; + }), + (o.prototype.atRestY = function () { + return this.resting[1]; + }), + (o.prototype.atRestZ = function () { + return this.resting[2]; + }); + }, + function (e, t, i) { "use strict"; var n = i(32); - e.exports = function(e, t) { - return new o(e,t) - } - ; + e.exports = function (e, t) { + return new o(e, t); + }; var r = { - rotationScale: 8e-4, - inverseY: false + rotationScale: 8e-4, + inverseY: false, }; function o(e, t) { - this.noa = e, - t = n({}, r, t), - this.rotationScale = t.rotationScale, - this.inverseY = t.inverseY + (this.noa = e), + (t = n({}, r, t)), + (this.rotationScale = t.rotationScale), + (this.inverseY = t.inverseY); } - o.prototype.updateForRender = function() { - var e, t, i = this.noa.inputs.state, n = this.rotationScale * i.dy * (this.inverseY ? -1 : 1), r = this.rotationScale * i.dx, o = this.noa.rendering.getCameraRotation(), s = (e = o[0] + n, - t = a, - isFinite(t) ? Math.max(Math.min(e, t), -t) : e), c = (o[1] + r) % (2 * Math.PI); - this.noa.rendering.setCameraRotation(s, c) - } - ; - var a = Math.PI / 2 - 1e-4 -} -, function(e, t, i) { + o.prototype.updateForRender = function () { + var e, + t, + i = this.noa.inputs.state, + n = this.rotationScale * i.dy * (this.inverseY ? -1 : 1), + r = this.rotationScale * i.dx, + o = this.noa.rendering.getCameraRotation(), + s = + ((e = o[0] + n), + (t = a), + isFinite(t) ? Math.max(Math.min(e, t), -t) : e), + c = (o[1] + r) % (2 * Math.PI); + this.noa.rendering.setCameraRotation(s, c); + }; + var a = Math.PI / 2 - 1e-4; + }, + function (e, t, i) { "use strict"; var n = i(32); - e.exports = function(e, t) { - return new s(e,t) - } - ; - var r, o = { - texturePath: "" - }, a = { + e.exports = function (e, t) { + return new s(e, t); + }; + var r, + o = { + texturePath: "", + }, + a = { solid: true, opaque: true, fluidDensity: 1, - viscosity: .5 - }; + viscosity: 0.5, + }; function s(e, t) { - this.noa = e; - var i = n({}, o, t); - this._texturePath = i.texturePath, - this._blockSolidity = [false], - this._blockOpacity = [false], - this._blockIsFluid = [false], - this._blockMats = [null, null, null, null, null, null], - this._blockProps = [null], - this._blockMesh = [null], - this._blockHandlers = [null], - this._matIDs = {}, - this._matData = [], - this._textures = []; - for (var r = 1; r <= 32; r++) - this.registerBlock(r); - this.registerMaterial("dirt", [.4, .3, 0], null), - this.registerBlock(1, "dirt") + this.noa = e; + var i = n({}, o, t); + (this._texturePath = i.texturePath), + (this._blockSolidity = [false]), + (this._blockOpacity = [false]), + (this._blockIsFluid = [false]), + (this._blockMats = [null, null, null, null, null, null]), + (this._blockProps = [null]), + (this._blockMesh = [null]), + (this._blockHandlers = [null]), + (this._matIDs = {}), + (this._matData = []), + (this._textures = []); + for (var r = 1; r <= 32; r++) this.registerBlock(r); + this.registerMaterial("dirt", [0.4, 0.3, 0], null), + this.registerBlock(1, "dirt"); } function c(e) { - this.onLoad = e.onLoad || null, - this.onUnload = e.onUnload || null, - this.onSet = e.onSet || null, - this.onUnset = e.onUnset || null, - this.onCustomMeshCreate = e.onCustomMeshCreate || null + (this.onLoad = e.onLoad || null), + (this.onUnload = e.onUnload || null), + (this.onSet = e.onSet || null), + (this.onUnset = e.onUnset || null), + (this.onCustomMeshCreate = e.onCustomMeshCreate || null); } function u(e, t, i) { - var n = e._matIDs[t]; - return void 0 === n && i && (n = e.registerMaterial(t)), - n + var n = e._matIDs[t]; + return void 0 === n && i && (n = e.registerMaterial(t)), n; } - s.prototype.registerBlock = function(e, t) { - t = t || {}, - a.solid = !t.fluid, - a.opaque = !t.fluid; - var i = n({}, a, t); - if (e < 1 || e > 255) - throw "Invalid block id: " + e; - e > this._blockSolidity.length && console.warn("Probably better to register block IDs in counting order without gaps!"), - this._blockSolidity[e] = !!i.solid, - this._blockOpacity[e] = !!i.opaque, - this._blockIsFluid[e] = !!i.fluid, - this._blockMesh[e] = i.blockMesh || null; - var r, o = i.material || null; - if (o) - if ("string" == typeof o) - r = [o, o, o, o, o, o]; - else if (o.length && 2 == o.length) - r = [o[1], o[1], o[0], o[0], o[1], o[1]]; - else if (o.length && 3 == o.length) - r = [o[2], o[2], o[0], o[1], o[2], o[2]]; - else { - if (!o.length || 6 != o.length) - throw "Invalid material parameter: " + o; - r = o - } - else - r = [null, null, null, null, null, null]; - for (var s = 0; s < 6; ++s) - this._blockMats[6 * e + s] = u(this, r[s], true); - this._blockProps[e] = {}, - this._blockIsFluid[e] && (this._blockProps[e].fluidDensity = i.fluidDensity, - this._blockProps[e].viscosity = i.viscosity); - var l = i.onLoad || i.onUnload || i.onSet || i.onUnset || i.onCustomMeshCreate; - return this._blockHandlers[e] = l ? new c(i) : null, - e - } - , - s.prototype.registerMaterial = function(e, t, i, n) { + (s.prototype.registerBlock = function (e, t) { + (t = t || {}), (a.solid = !t.fluid), (a.opaque = !t.fluid); + var i = n({}, a, t); + if (e < 1 || e > 255) throw "Invalid block id: " + e; + e > this._blockSolidity.length && + console.warn( + "Probably better to register block IDs in counting order without gaps!" + ), + (this._blockSolidity[e] = !!i.solid), + (this._blockOpacity[e] = !!i.opaque), + (this._blockIsFluid[e] = !!i.fluid), + (this._blockMesh[e] = i.blockMesh || null); + var r, + o = i.material || null; + if (o) + if ("string" == typeof o) r = [o, o, o, o, o, o]; + else if (o.length && 2 == o.length) + r = [o[1], o[1], o[0], o[0], o[1], o[1]]; + else if (o.length && 3 == o.length) + r = [o[2], o[2], o[0], o[1], o[2], o[2]]; + else { + if (!o.length || 6 != o.length) + throw "Invalid material parameter: " + o; + r = o; + } + else r = [null, null, null, null, null, null]; + for (var s = 0; s < 6; ++s) + this._blockMats[6 * e + s] = u(this, r[s], true); + (this._blockProps[e] = {}), + this._blockIsFluid[e] && + ((this._blockProps[e].fluidDensity = i.fluidDensity), + (this._blockProps[e].viscosity = i.viscosity)); + var l = + i.onLoad || i.onUnload || i.onSet || i.onUnset || i.onCustomMeshCreate; + return (this._blockHandlers[e] = l ? new c(i) : null), e; + }), + (s.prototype.registerMaterial = function (e, t, i, n) { var r = this._matIDs[e] || this._matData.length; this._matIDs[e] = r; var o = 1; - return t && 4 == t.length && (o = t.pop()), - this._matData[r] = { + return ( + t && 4 == t.length && (o = t.pop()), + (this._matData[r] = { color: t || [1, 1, 1], alpha: o, texture: i ? this._texturePath + i : "", - textureAlpha: !!n - }, - null != i && (this._textures[r] = new BABYLON.Texture(this._texturePath + i,this.noa.rendering._scene,false,true,BABYLON.Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST)), - r - } - , - s.prototype.getBlockSolidity = function(e) { - return this._blockSolidity[e] - } - , - s.prototype.getBlockOpacity = function(e) { - return this._blockOpacity[e] - } - , - s.prototype.getBlockFluidity = function(e) { - return this._blockIsFluid[e] - } - , - s.prototype.getBlockProps = function(e) { - return this._blockProps[e] - } - , - s.prototype.getBlockFaceMaterialAccessor = function() { + textureAlpha: !!n, + }), + null != i && + (this._textures[r] = new BABYLON.Texture( + this._texturePath + i, + this.noa.rendering._scene, + false, + true, + BABYLON.Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST + )), + r + ); + }), + (s.prototype.getBlockSolidity = function (e) { + return this._blockSolidity[e]; + }), + (s.prototype.getBlockOpacity = function (e) { + return this._blockOpacity[e]; + }), + (s.prototype.getBlockFluidity = function (e) { + return this._blockIsFluid[e]; + }), + (s.prototype.getBlockProps = function (e) { + return this._blockProps[e]; + }), + (s.prototype.getBlockFaceMaterialAccessor = function () { if (!this._storedBFMAccessor) { - var e = this._blockMats; - this._storedBFMAccessor = function(t, i) { - return e[6 * t + i] - } + var e = this._blockMats; + this._storedBFMAccessor = function (t, i) { + return e[6 * t + i]; + }; } - return this._storedBFMAccessor - } - , - s.prototype.getMaterialColor = function(e) { - return this._matData[e].color - } - , - s.prototype.getTexture = function(e) { - return this._textures[e] - } - , - s.prototype.getMaterialVertexColorAccessor = function() { + return this._storedBFMAccessor; + }), + (s.prototype.getMaterialColor = function (e) { + return this._matData[e].color; + }), + (s.prototype.getTexture = function (e) { + return this._textures[e]; + }), + (s.prototype.getMaterialVertexColorAccessor = function () { if (!r) { - var e = this._matData; - r = function(t) { - return e[t].texture ? l : e[t].color - } + var e = this._matData; + r = function (t) { + return e[t].texture ? l : e[t].color; + }; } - return r - } - ; + return r; + }); var l = [1, 1, 1]; - s.prototype.getMaterialTexture = function(e) { - return this._matData[e].texture - } - , - s.prototype.getMaterialData = function(e) { - return this._matData[e] - } -} -, function(exp, t, getterFunc) { + (s.prototype.getMaterialTexture = function (e) { + return this._matData[e].texture; + }), + (s.prototype.getMaterialData = function (e) { + return this._matData[e]; + }); + }, + function (exp, t, getterFunc) { "use strict"; var n = getterFunc(32); var r = getterFunc(87); var vec3Math = getterFunc(16); var a = getterFunc(475); - - exp.exports = function(e, t) { - return new c(e,t) - } - ; + + exp.exports = function (e, t) { + return new c(e, t); + }; var s = { - shadowDistance: 10 + shadowDistance: 10, }; function c(e, t) { - a.call(this), - this.noa = e, - t = n(s, t), - this.names = {}; - var r = t.shadowDistance; - this.names.position = this.createComponent(getterFunc(476)(e)), - this.names.physics = this.createComponent(getterFunc(477)(e)), - this.names.followsEntity = this.createComponent(getterFunc(478)(e)), - this.names.mesh = this.createComponent(getterFunc(479)(e)), - this.names.shadow = this.createComponent(getterFunc(480)(e, r)), - this.names.collideTerrain = this.createComponent(getterFunc(481)(e)), - this.names.collideEntities = this.createComponent(getterFunc(482)(e)), - this.names.every = this.createComponent(getterFunc(489)(e)), - this.names.smoothCamera = this.createComponent(getterFunc(490)(e)), - this.names.movement = this.createComponent(getterFunc(491)(e)), - this.names.receivesInputs = this.createComponent(getterFunc(492)(e)), - this.names.fadeOnZoom = this.createComponent(getterFunc(493)(e)), - this.isPlayer = function(t) { - return t === e.playerEntity - } - , - this.hasPhysics = this.getComponentAccessor(this.names.physics), - this.cameraSmoothed = this.getComponentAccessor(this.names.smoothCamera), - this.hasMesh = this.getComponentAccessor(this.names.mesh), - this.hasPosition = this.getComponentAccessor(this.names.position); - var c = this.getStateAccessor(this.names.position); - this.getPositionData = c, - this.getPosition = function(e) { - return c(e).position - } - , - this.setPosition = function(e, t, i, n) { - var r = this.getPositionData(e); - vec3Math.set(r.position, t, i, n), - r._extentsChanged = true, - this.hasPhysics(e) && l(this.getPhysicsBody(e).aabb, r) - } - ; - var u = this.getStateAccessor(this.names.physics); - this.getPhysicsBody = function(e) { - return u(e).body - } - , - this.getPhysicsInterpolation = function(e) { - return u(e).interpolatePosition - } - , - this.setPhysicsInterpolation = function(e, t) { - u(e).interpolatePosition = t - } - , - this.getMeshData = this.getStateAccessor(this.names.mesh), - this.getMovement = this.getStateAccessor(this.names.movement), - this.getCollideTerrain = this.getStateAccessor(this.names.collideTerrain), - this.getCollideEntities = this.getStateAccessor(this.names.collideEntities); - var h = this; - e.on("tick", function(e) {}), - e.on("beforeRender", function(e) { - h.render(e) + a.call(this), (this.noa = e), (t = n(s, t)), (this.names = {}); + var r = t.shadowDistance; + (this.names.position = this.createComponent(getterFunc(476)(e))), + (this.names.physics = this.createComponent(getterFunc(477)(e))), + (this.names.followsEntity = this.createComponent(getterFunc(478)(e))), + (this.names.mesh = this.createComponent(getterFunc(479)(e))), + (this.names.shadow = this.createComponent(getterFunc(480)(e, r))), + (this.names.collideTerrain = this.createComponent(getterFunc(481)(e))), + (this.names.collideEntities = this.createComponent(getterFunc(482)(e))), + (this.names.every = this.createComponent(getterFunc(489)(e))), + (this.names.smoothCamera = this.createComponent(getterFunc(490)(e))), + (this.names.movement = this.createComponent(getterFunc(491)(e))), + (this.names.receivesInputs = this.createComponent(getterFunc(492)(e))), + (this.names.fadeOnZoom = this.createComponent(getterFunc(493)(e))), + (this.isPlayer = function (t) { + return t === e.playerEntity; }), - this.createEntity() + (this.hasPhysics = this.getComponentAccessor(this.names.physics)), + (this.cameraSmoothed = this.getComponentAccessor( + this.names.smoothCamera + )), + (this.hasMesh = this.getComponentAccessor(this.names.mesh)), + (this.hasPosition = this.getComponentAccessor(this.names.position)); + var c = this.getStateAccessor(this.names.position); + (this.getPositionData = c), + (this.getPosition = function (e) { + return c(e).position; + }), + (this.setPosition = function (e, t, i, n) { + var r = this.getPositionData(e); + vec3Math.set(r.position, t, i, n), + (r._extentsChanged = true), + this.hasPhysics(e) && l(this.getPhysicsBody(e).aabb, r); + }); + var u = this.getStateAccessor(this.names.physics); + (this.getPhysicsBody = function (e) { + return u(e).body; + }), + (this.getPhysicsInterpolation = function (e) { + return u(e).interpolatePosition; + }), + (this.setPhysicsInterpolation = function (e, t) { + u(e).interpolatePosition = t; + }), + (this.getMeshData = this.getStateAccessor(this.names.mesh)), + (this.getMovement = this.getStateAccessor(this.names.movement)), + (this.getCollideTerrain = this.getStateAccessor( + this.names.collideTerrain + )), + (this.getCollideEntities = this.getStateAccessor( + this.names.collideEntities + )); + var h = this; + e.on("tick", function (e) {}), + e.on("beforeRender", function (e) { + h.render(e); + }), + this.createEntity(); } - c.prototype = Object.create(a.prototype), - c.prototype.constructor = c, - c.prototype.addComponentAgain = function(e, t, i) { + (c.prototype = Object.create(a.prototype)), + (c.prototype.constructor = c), + (c.prototype.addComponentAgain = function (e, t, i) { this.hasComponent(e, t) && this.removeComponent(e, t), - this.addComponent(e, t, i) - } - , - c.prototype.isTerrainBlocked = function(e, t, i) { + this.addComponent(e, t, i); + }), + (c.prototype.isTerrainBlocked = function (e, t, i) { var n = u; - return n.setPosition([e + .001, t + .001, i + .001]), - this.getEntitiesInAABB(n, this.names.collideTerrain).length > 0 - } - ; - var u = new r([0, 0, 0],[.998, .998, .998]); + return ( + n.setPosition([e + 0.001, t + 0.001, i + 0.001]), + this.getEntitiesInAABB(n, this.names.collideTerrain).length > 0 + ); + }); + var u = new r([0, 0, 0], [0.998, 0.998, 0.998]); function l(e, t) { - var i = t.width - , n = t.position - , r = i / 2; - vec3Math.set(e.base, n[0] - r, n[1], n[2] - r), + var i = t.width, + n = t.position, + r = i / 2; + vec3Math.set(e.base, n[0] - r, n[1], n[2] - r), vec3Math.set(e.vec, i, t.height, i), - vec3Math.add(e.max, e.base, e.vec) + vec3Math.add(e.max, e.base, e.vec); } - c.prototype.setEntitySize = function(e, t, i, n) { - if (!this.hasPosition(e)) - throw "Set size of entity without a position component"; - var r = this.getPositionData(e); - (r.width = (t + n) / 2, - r.height = i, - r._extentsChanged = true, - this.hasPhysics(e)) && l(this.getPhysicsBody(e).aabb, r) - } - , - c.prototype.getEntitiesInAABB = function(e, t) { - for (var i = [], n = this, r = t ? n.getStatesList(t).map(function(e) { - return n.getPositionData(e.__id) - }) : r = n.getStatesList(this.names.position), o = h, a = 0; a < r.length; a++) - l(o, r[a]), - e.intersects(o) && i.push(r[a].__id); - return i - } - ; - var h = new r([],[]); - c.prototype.add = function(e, t, i, n, r, a, s) { - var c = this - , u = this.createEntity() - , l = vec3Math.create(); - if (vec3Math.copy(l, e), + (c.prototype.setEntitySize = function (e, t, i, n) { + if (!this.hasPosition(e)) + throw "Set size of entity without a position component"; + var r = this.getPositionData(e); + ((r.width = (t + n) / 2), + (r.height = i), + (r._extentsChanged = true), + this.hasPhysics(e)) && l(this.getPhysicsBody(e).aabb, r); + }), + (c.prototype.getEntitiesInAABB = function (e, t) { + for ( + var i = [], + n = this, + r = t + ? n.getStatesList(t).map(function (e) { + return n.getPositionData(e.__id); + }) + : (r = n.getStatesList(this.names.position)), + o = h, + a = 0; + a < r.length; + a++ + ) + l(o, r[a]), e.intersects(o) && i.push(r[a].__id); + return i; + }); + var h = new r([], []); + c.prototype.add = function (e, t, i, n, r, a, s) { + var c = this, + u = this.createEntity(), + l = vec3Math.create(); + if ( + (vec3Math.copy(l, e), this.addComponent(u, this.names.position, { - position: l, - width: t, - height: i + position: l, + width: t, + height: i, }), - a) { - this.addComponent(u, this.names.physics); - var h = this.getPhysicsBody(u) - , f = this.names.smoothCamera; - h.onStep = function() { - c.addComponentAgain(u, f) - } - } - return n && (r || (r = vec3Math.create()), - this.addComponent(u, this.names.mesh, { + a) + ) { + this.addComponent(u, this.names.physics); + var h = this.getPhysicsBody(u), + f = this.names.smoothCamera; + h.onStep = function () { + c.addComponentAgain(u, f); + }; + } + return ( + n && + (r || (r = vec3Math.create()), + this.addComponent(u, this.names.mesh, { mesh: n, - offset: r - })), - s && this.addComponent(u, this.names.shadow, { - size: t - }), + offset: r, + })), + s && + this.addComponent(u, this.names.shadow, { + size: t, + }), u - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; e.exports = r; var n = i(186)._extend; function r() { - this.components = {}, - this.comps = this.components, - this._uid = 1, - this._data = {}, - this._systems = [], - this._renderSystems = [], - this._deferredEntityRemovals = [], - this._deferredCompRemovals = [], - this._deferredMultiCompRemovals = [] + (this.components = {}), + (this.comps = this.components), + (this._uid = 1), + (this._data = {}), + (this._systems = []), + (this._renderSystems = []), + (this._deferredEntityRemovals = []), + (this._deferredCompRemovals = []), + (this._deferredMultiCompRemovals = []); } function o(e) { - !function(e) { - for (; e._deferredEntityRemovals.length; ) { - var t = e._deferredEntityRemovals.pop(); - c(e, t) - } - }(e), + !(function (e) { + for (; e._deferredEntityRemovals.length; ) { + var t = e._deferredEntityRemovals.pop(); + c(e, t); + } + })(e), u(e), - function(e) { - for (; e._deferredMultiCompRemovals.length; ) { - var t = e._deferredMultiCompRemovals.pop(); - h(e, t.id, t.comp, t.state), - t.state = null - } - }(e) + (function (e) { + for (; e._deferredMultiCompRemovals.length; ) { + var t = e._deferredMultiCompRemovals.pop(); + h(e, t.id, t.comp, t.state), (t.state = null); + } + })(e); } function a(e) { - s || (s = true, - setTimeout(function() { - o(e), - s = false - }, 0)) + s || + ((s = true), + setTimeout(function () { + o(e), (s = false); + }, 0)); } var s = false; function c(e, t) { - for (var i = Object.keys(e._data), n = 0; n < i.length; n++) { - var r = i[n]; - e._data[r].hash[t] && e.removeComponent(t, r, true) - } + for (var i = Object.keys(e._data), n = 0; n < i.length; n++) { + var r = i[n]; + e._data[r].hash[t] && e.removeComponent(t, r, true); + } } function u(e) { - for (; e._deferredCompRemovals.length; ) { - var t = e._deferredCompRemovals.pop(); - l(e, t.id, t.comp) - } + for (; e._deferredCompRemovals.length; ) { + var t = e._deferredCompRemovals.pop(); + l(e, t.id, t.comp); + } } function l(e, t, i) { - var n = e.components[i]; - if (n) { - var r = e._data[i]; - if (r && r.hash[t]) { - if (n.onRemove) - if (n.multi) - r.hash[t].forEach(function(e) { - n.onRemove(t, e) - }); - else - n.onRemove(t, r.hash[t]); - n.multi && (r.hash[t].length = 0); - var o = r.map[t] - , a = r.list; - if (o === a.length - 1) - a.pop(); - else { - a[o] = a.pop(); - var s = a[o].__id; - r.map[s] = o - } - delete r.hash[t], - delete r.map[t] - } + var n = e.components[i]; + if (n) { + var r = e._data[i]; + if (r && r.hash[t]) { + if (n.onRemove) + if (n.multi) + r.hash[t].forEach(function (e) { + n.onRemove(t, e); + }); + else n.onRemove(t, r.hash[t]); + n.multi && (r.hash[t].length = 0); + var o = r.map[t], + a = r.list; + if (o === a.length - 1) a.pop(); + else { + a[o] = a.pop(); + var s = a[o].__id; + r.map[s] = o; + } + delete r.hash[t], delete r.map[t]; } + } } function h(e, t, i, n) { - var r = e.components[i]; - if (r) { - var o = e._data[i]; - if (o) { - var a = o.hash[t]; - if (a) { - var s = a.indexOf(n); - s < 0 || (r.onRemove && r.onRemove && r.onRemove(t, n), - a.splice(s, 1), - 0 === a.length && e.removeComponent(t, i, true)) - } - } + var r = e.components[i]; + if (r) { + var o = e._data[i]; + if (o) { + var a = o.hash[t]; + if (a) { + var s = a.indexOf(n); + s < 0 || + (r.onRemove && r.onRemove && r.onRemove(t, n), + a.splice(s, 1), + 0 === a.length && e.removeComponent(t, i, true)); + } } + } } - r.prototype.createEntity = function(e) { - var t = this._uid++; - if (e && e.length) - for (var i = 0; i < e.length; i++) - this.addComponent(t, e[i]); - return t - } - , - r.prototype.deleteEntity = function(e, t) { - return t ? c(this, e) : (this._deferredEntityRemovals.push(e), - a(this)), - this - } - , - r.prototype.createComponent = function(e) { - if (!e) - throw "Missing component definition"; + (r.prototype.createEntity = function (e) { + var t = this._uid++; + if (e && e.length) + for (var i = 0; i < e.length; i++) this.addComponent(t, e[i]); + return t; + }), + (r.prototype.deleteEntity = function (e, t) { + return ( + t ? c(this, e) : (this._deferredEntityRemovals.push(e), a(this)), this + ); + }), + (r.prototype.createComponent = function (e) { + if (!e) throw "Missing component definition"; var t = e.name; - if (!t) - throw "Component definition must have a name property."; - if ("string" != typeof t) - throw "Component name must be a string."; - if ("" === t) - throw "Component name must be a non-empty string."; - if (this._data[t]) - throw 'Component "' + t + '" already exists.'; + if (!t) throw "Component definition must have a name property."; + if ("string" != typeof t) throw "Component name must be a string."; + if ("" === t) throw "Component name must be a non-empty string."; + if (this._data[t]) throw 'Component "' + t + '" already exists.'; var i = {}; - return i.name = t, - i.state = e.state || {}, - i.onAdd = e.onAdd || null, - i.onRemove = e.onRemove || null, - i.system = e.system || null, - i.renderSystem = e.renderSystem || null, - i.multi = !!e.multi, - this.components[t] = i, - i.system && this._systems.push(t), - i.renderSystem && this._renderSystems.push(t), - this._data[t] = { + return ( + (i.name = t), + (i.state = e.state || {}), + (i.onAdd = e.onAdd || null), + (i.onRemove = e.onRemove || null), + (i.system = e.system || null), + (i.renderSystem = e.renderSystem || null), + (i.multi = !!e.multi), + (this.components[t] = i), + i.system && this._systems.push(t), + i.renderSystem && this._renderSystems.push(t), + (this._data[t] = { list: [], hash: {}, - map: {} - }, - t - } - , - r.prototype.deleteComponent = function(e) { + map: {}, + }), + t + ); + }), + (r.prototype.deleteComponent = function (e) { var t = this._data[e]; - if (!t) - throw "Unknown component: " + e + "."; + if (!t) throw "Unknown component: " + e + "."; for (var i = t.list; i.length; ) { - var n = i[i.length - 1].__id; - this.removeComponent(n, e, true) + var n = i[i.length - 1].__id; + this.removeComponent(n, e, true); } var r = this._systems.indexOf(e); - return r > -1 && this._systems.splice(r, 1), - (r = this._renderSystems.indexOf(e)) > -1 && this._renderSystems.splice(r, 1), - delete this.components[e], - delete this._data[e], - this - } - , - r.prototype.addComponent = function(e, t, i) { - var r = this.components[t] - , o = this._data[t]; - if (!o) - throw "Unknown component: " + t + "."; + return ( + r > -1 && this._systems.splice(r, 1), + (r = this._renderSystems.indexOf(e)) > -1 && + this._renderSystems.splice(r, 1), + delete this.components[e], + delete this._data[e], + this + ); + }), + (r.prototype.addComponent = function (e, t, i) { + var r = this.components[t], + o = this._data[t]; + if (!o) throw "Unknown component: " + t + "."; var a = false; - if (this._deferredCompRemovals.forEach(function(i) { - i.id === e && i.comp === t && (a = true) - }), - a && u(this), - o.hash[e] && !r.multi) - throw "Entity already has component: " + t + "."; + if ( + (this._deferredCompRemovals.forEach(function (i) { + i.id === e && i.comp === t && (a = true); + }), + a && u(this), + o.hash[e] && !r.multi) + ) + throw "Entity already has component: " + t + "."; var s = {}; - if (s.__id = e, - n(s, r.state), - n(s, i), - s.__id = e, - r.multi) { - var c = o.hash[e]; - c || (c = [], - o.hash[e] = c, + if (((s.__id = e), n(s, r.state), n(s, i), (s.__id = e), r.multi)) { + var c = o.hash[e]; + c || + ((c = []), + (o.hash[e] = c), o.list.push(c), - o.map[e] = o.list.length - 1), - c.push(s) - } else - o.hash[e] = s, - o.list.push(s), - o.map[e] = o.list.length - 1; - return r.onAdd && r.onAdd(e, s), - this - } - , - r.prototype.hasComponent = function(e, t) { + (o.map[e] = o.list.length - 1)), + c.push(s); + } else (o.hash[e] = s), o.list.push(s), (o.map[e] = o.list.length - 1); + return r.onAdd && r.onAdd(e, s), this; + }), + (r.prototype.hasComponent = function (e, t) { var i = this._data[t]; - if (!i) - throw "Unknown component: " + t + "."; - return void 0 !== i.hash[e] - } - , - r.prototype.removeComponent = function(e, t, i) { - var n = this.components[t] - , r = this._data[t]; - if (!r) - throw "Unknown component: " + t + "."; + if (!i) throw "Unknown component: " + t + "."; + return void 0 !== i.hash[e]; + }), + (r.prototype.removeComponent = function (e, t, i) { + var n = this.components[t], + r = this._data[t]; + if (!r) throw "Unknown component: " + t + "."; if (!r.hash[e]) { - if (n.multi) - return this; - throw "Entity does not have component: " + t + "." + if (n.multi) return this; + throw "Entity does not have component: " + t + "."; } - return i ? l(this, e, t) : (this._deferredCompRemovals.push({ - id: e, - comp: t - }), - a(this)), - this - } - , - r.prototype.getState = function(e, t) { + return ( + i + ? l(this, e, t) + : (this._deferredCompRemovals.push({ + id: e, + comp: t, + }), + a(this)), + this + ); + }), + (r.prototype.getState = function (e, t) { var i = this._data[t]; - if (!i) - throw "Unknown component: " + t + "."; - return i.hash[e] - } - , - r.prototype.getStateAccessor = function(e) { - if (!this._data[e]) - throw "Unknown component: " + e + "."; + if (!i) throw "Unknown component: " + t + "."; + return i.hash[e]; + }), + (r.prototype.getStateAccessor = function (e) { + if (!this._data[e]) throw "Unknown component: " + e + "."; var t = this._data[e].hash; - return function(e) { - return t[e] - } - } - , - r.prototype.getComponentAccessor = function(e) { - if (!this._data[e]) - throw "Unknown component: " + e + "."; + return function (e) { + return t[e]; + }; + }), + (r.prototype.getComponentAccessor = function (e) { + if (!this._data[e]) throw "Unknown component: " + e + "."; var t = this._data[e].hash; - return function(e) { - return void 0 !== t[e] - } - } - , - r.prototype.getStatesList = function(e) { + return function (e) { + return void 0 !== t[e]; + }; + }), + (r.prototype.getStatesList = function (e) { var t = this._data[e]; - if (!t) - throw "Unknown component: " + e + "."; - return t.list - } - , - r.prototype.tick = function(e) { + if (!t) throw "Unknown component: " + e + "."; + return t.list; + }), + (r.prototype.tick = function (e) { o(this); for (var t = this._systems, i = 0; i < t.length; ++i) { - var n = t[i] - , r = this._data[n].list; - this.components[n].system(e, r) + var n = t[i], + r = this._data[n].list; + this.components[n].system(e, r); } - return o(this), - this - } - , - r.prototype.render = function(e) { + return o(this), this; + }), + (r.prototype.render = function (e) { o(this); for (var t = this._renderSystems, i = 0; i < t.length; ++i) { - var n = t[i] - , r = this._data[n].list; - this.components[n].renderSystem(e, r) + var n = t[i], + r = this._data[n].list; + this.components[n].renderSystem(e, r); } - return o(this), - this - } - , - r.prototype.removeMultiComponent = function(e, t, i, n) { - var r = this.components[t] - , o = this._data[t]; - if (!o) - throw "Unknown component: " + t + "."; + return o(this), this; + }), + (r.prototype.removeMultiComponent = function (e, t, i, n) { + var r = this.components[t], + o = this._data[t]; + if (!o) throw "Unknown component: " + t + "."; if (!r.multi) - throw "removeMultiComponent called on non-multi component"; + throw "removeMultiComponent called on non-multi component"; var a = o.hash[e]; if (!a || !a[i]) - throw "Multicomponent " + t + " instance not found at index " + i; + throw "Multicomponent " + t + " instance not found at index " + i; var s = a[i]; - return n ? h(this, e, t, s) : this._deferredMultiCompRemovals.push({ - id: e, - comp: t, - state: s - }), - this - } -} -, function(exp, t, getterFunc) { + return ( + n + ? h(this, e, t, s) + : this._deferredMultiCompRemovals.push({ + id: e, + comp: t, + state: s, + }), + this + ); + }); + }, + function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); function r(e, t, i, n) { - var r = n / 2; - e[0] = t[0] - r, - e[1] = t[1], - e[2] = t[2] - r, - e[3] = t[0] + r, - e[4] = t[1] + i, - e[5] = t[2] + r + var r = n / 2; + (e[0] = t[0] - r), + (e[1] = t[1]), + (e[2] = t[2] - r), + (e[3] = t[0] + r), + (e[4] = t[1] + i), + (e[5] = t[2] + r); } - exp.exports = function(e) { - var t = false; - return { - name: "position", - state: { - position: null, - renderPosition: null, - width: 0, - height: 0, - _extents: null, - _extentsChanged: true - }, - onAdd: function(e, i) { - i.position ? i.position instanceof Float32Array || t || (console.warn('Better to set entity positions as instances of "gl-vec3"!'), - t = true) : i.position = vec3Math.create(), - i.renderPosition = vec3Math.create(), - vec3Math.copy(i.renderPosition, i.position), - i._extents = new Float32Array(6) - }, - onRemove: null, - system: function(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n._extentsChanged && (r(n._extents, n.position, n.height, n.width), - n._extentsChanged = false) - } - } - } - } -} -, function(exp, t, getterFunc) { + exp.exports = function (e) { + var t = false; + return { + name: "position", + state: { + position: null, + renderPosition: null, + width: 0, + height: 0, + _extents: null, + _extentsChanged: true, + }, + onAdd: function (e, i) { + i.position + ? i.position instanceof Float32Array || + t || + (console.warn( + 'Better to set entity positions as instances of "gl-vec3"!' + ), + (t = true)) + : (i.position = vec3Math.create()), + (i.renderPosition = vec3Math.create()), + vec3Math.copy(i.renderPosition, i.position), + (i._extents = new Float32Array(6)); + }, + onRemove: null, + system: function (e, t) { + for (var i = 0; i < t.length; i++) { + var n = t[i]; + n._extentsChanged && + (r(n._extents, n.position, n.height, n.width), + (n._extentsChanged = false)); + } + }, + }; + }; + }, + function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); getterFunc(87); - exp.exports = function(e) { - var t = vec3Math.create(); - return { - name: "physics", - state: { - body: null, - interpolatePosition: true - }, - onAdd: function(t, i) { - i.body = e.physics.addBody(); - var n = e.ents.getPositionData(i.__id); - e.ents.setEntitySize(i.__id, n.width, n.height, n.width) - }, - onRemove: function(t, i) { - e.physics.removeBody(i.body) - }, - system: null, - renderSystem: function(i, r) { - for (var o = -(e._tickRate - i) / 1e3, a = t, s = 0; s < r.length; ++s) { - var c = r[s] - , u = c.__id - , l = e.ents.getPositionData(u); - vec3Math.scaleAndAdd(a, l.position, c.body.velocity, o), - c.interpolatePosition && !c.body.autoStep && vec3Math.lerp(a, l.renderPosition, a, .5), - e.ents.cameraSmoothed(u) && c.body.autoStep && vec3Math.lerp(a, l.renderPosition, a, .33), - vec3Math.copy(l.renderPosition, a) - } - } - } - } -} -, function(exp, t, getterFunc) { + exp.exports = function (e) { + var t = vec3Math.create(); + return { + name: "physics", + state: { + body: null, + interpolatePosition: true, + }, + onAdd: function (t, i) { + i.body = e.physics.addBody(); + var n = e.ents.getPositionData(i.__id); + e.ents.setEntitySize(i.__id, n.width, n.height, n.width); + }, + onRemove: function (t, i) { + e.physics.removeBody(i.body); + }, + system: null, + renderSystem: function (i, r) { + for ( + var o = -(e._tickRate - i) / 1e3, a = t, s = 0; + s < r.length; + ++s + ) { + var c = r[s], + u = c.__id, + l = e.ents.getPositionData(u); + vec3Math.scaleAndAdd(a, l.position, c.body.velocity, o), + c.interpolatePosition && + !c.body.autoStep && + vec3Math.lerp(a, l.renderPosition, a, 0.5), + e.ents.cameraSmoothed(u) && + c.body.autoStep && + vec3Math.lerp(a, l.renderPosition, a, 0.33), + vec3Math.copy(l.renderPosition, a); + } + }, + }; + }; + }, + function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); - exp.exports = function(e) { - return { - name: "followsEntity", - state: { - entity: 0, - offset: null - }, - onAdd: function(e, r) { - var o = vec3Math.create(); - r.offset = r.offset ? vec3Math.copy(o, r.offset) : o, - t(r), - i(r) - }, - onRemove: null, - system: function(e, i) { - for (var n = 0; n < i.length; n++) - t(i[n]) - }, - renderSystem: function(e, t) { - for (var n = 0; n < t.length; n++) - i(t[n]) - } - }; - function t(t) { - var i = t.__id - , r = e.ents.getPositionData(i) - , o = e.ents.getPositionData(t.entity); - o ? vec3Math.add(r.position, o.position, t.offset) : e.ents.removeComponentLater(i, e.ents.names.followsEntity) - } - function i(t) { - var i = t.__id - , r = e.ents.getPositionData(i) - , o = e.ents.getPositionData(t.entity); - o ? vec3Math.add(r.renderPosition, o.renderPosition, t.offset) : e.ents.removeComponentLater(i, e.ents.names.followsEntity) - } - } -} -, function(exp, t, getterFunc) { + exp.exports = function (e) { + return { + name: "followsEntity", + state: { + entity: 0, + offset: null, + }, + onAdd: function (e, r) { + var o = vec3Math.create(); + (r.offset = r.offset ? vec3Math.copy(o, r.offset) : o), t(r), i(r); + }, + onRemove: null, + system: function (e, i) { + for (var n = 0; n < i.length; n++) t(i[n]); + }, + renderSystem: function (e, t) { + for (var n = 0; n < t.length; n++) i(t[n]); + }, + }; + function t(t) { + var i = t.__id, + r = e.ents.getPositionData(i), + o = e.ents.getPositionData(t.entity); + o + ? vec3Math.add(r.position, o.position, t.offset) + : e.ents.removeComponentLater(i, e.ents.names.followsEntity); + } + function i(t) { + var i = t.__id, + r = e.ents.getPositionData(i), + o = e.ents.getPositionData(t.entity); + o + ? vec3Math.add(r.renderPosition, o.renderPosition, t.offset) + : e.ents.removeComponentLater(i, e.ents.names.followsEntity); + } + }; + }, + function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); - exp.exports = function(e) { - return { - name: "mesh", - state: { - mesh: null, - offset: null - }, - onAdd: function(t, i) { - if (!i.mesh) - throw new Error("Mesh component added without a mesh - probably a bug!"); - e.rendering.addDynamicMesh(i.mesh), - i.offset || (i.offset = new vec3Math.create); - var r = e.ents.getPosition(t) - , o = i.mesh.position; - o.x = r[0] + i.offset[0], - o.y = r[1] + i.offset[1], - o.z = r[2] + i.offset[2] - }, - onRemove: function(e, t) { - t.mesh.dispose() - }, - system: null, - renderSystem: function(t, i) { - for (var n = 0; n < i.length; ++n) { - var r = i[n] - , o = r.__id - , a = e.ents.getPositionData(o).renderPosition - , s = a[0] + r.offset[0] - , c = a[1] + r.offset[1] - , u = a[2] + r.offset[2]; - r.mesh.position.copyFromFloats(s, c, u) - } - } - } - } -} -, function(exp, t, getterFunc) { + exp.exports = function (e) { + return { + name: "mesh", + state: { + mesh: null, + offset: null, + }, + onAdd: function (t, i) { + if (!i.mesh) + throw new Error( + "Mesh component added without a mesh - probably a bug!" + ); + e.rendering.addDynamicMesh(i.mesh), + i.offset || (i.offset = new vec3Math.create()); + var r = e.ents.getPosition(t), + o = i.mesh.position; + (o.x = r[0] + i.offset[0]), + (o.y = r[1] + i.offset[1]), + (o.z = r[2] + i.offset[2]); + }, + onRemove: function (e, t) { + t.mesh.dispose(); + }, + system: null, + renderSystem: function (t, i) { + for (var n = 0; n < i.length; ++n) { + var r = i[n], + o = r.__id, + a = e.ents.getPositionData(o).renderPosition, + s = a[0] + r.offset[0], + c = a[1] + r.offset[1], + u = a[2] + r.offset[2]; + r.mesh.position.copyFromFloats(s, c, u); + } + }, + }; + }; + }, + function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); - exp.exports = function(e, t) { - t; - var i = e.rendering.getScene() - , n = BABYLON.Mesh.CreateDisc("shadow", .75, 30, i); - return n.rotation.x = Math.PI / 2, - n.material = e.rendering.makeStandardMaterial("shadowMat"), - n.material.diffuseColor = BABYLON.Color3.Black(), - n.material.specularColor = BABYLON.Color3.Black(), - n.material.alpha = .5, + exp.exports = function (e, t) { + t; + var i = e.rendering.getScene(), + n = BABYLON.Mesh.CreateDisc("shadow", 0.75, 30, i); + return ( + (n.rotation.x = Math.PI / 2), + (n.material = e.rendering.makeStandardMaterial("shadowMat")), + (n.material.diffuseColor = BABYLON.Color3.Black()), + (n.material.specularColor = BABYLON.Color3.Black()), + (n.material.alpha = 0.5), n.setEnabled(false), i.removeMesh(n), { - name: "shadow", - state: { - mesh: null, - size: .5 - } + name: "shadow", + state: { + mesh: null, + size: 0.5, + }, } - } - ; + ); + }; vec3Math.fromValues(0, -1, 0), - vec3Math.fromValues(0, 0, 0), - vec3Math.fromValues(0, 0, 0) -} -, function(e, t, i) { + vec3Math.fromValues(0, 0, 0), + vec3Math.fromValues(0, 0, 0); + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - return { - name: "collideTerrain", - state: { - callback: null - }, - onAdd: function(t, i) { - var n = e.entities; - n.hasPhysics(t) && (n.getPhysicsBody(t).onCollide = function(i) { - var n = e.ents.getCollideTerrain(t).callback; - n && n(i, t) - } - ) - }, - onRemove: function(t, i) { - var n = e.entities; - n.hasPhysics(t) && (n.getPhysicsBody(t).onCollide = null) - }, - system: null - } - } -} -, function(e, t, i) { + e.exports = function (e) { + return { + name: "collideTerrain", + state: { + callback: null, + }, + onAdd: function (t, i) { + var n = e.entities; + n.hasPhysics(t) && + (n.getPhysicsBody(t).onCollide = function (i) { + var n = e.ents.getCollideTerrain(t).callback; + n && n(i, t); + }); + }, + onRemove: function (t, i) { + var n = e.entities; + n.hasPhysics(t) && (n.getPhysicsBody(t).onCollide = null); + }, + system: null, + }; + }; + }, + function (e, t, i) { "use strict"; var n = i(483); - e.exports = function(e) { - return { - name: "collideEntities", - state: { - collideBits: 1, - collideMask: 1, - callback: null - }, - onAdd: null, - onRemove: null, - system: function(t, i) { - for (var r = e.ents, o = [], a = 0; a < i.length; a++) { - var s = i[a].__id - , c = r.getPositionData(s); - o[a] = c._extents - } - n(o, function(e, t) { - var n = i[e] - , r = i[t]; - n.collideMask & r.collideBits && n.callback && n.callback(r.__id), - r.collideMask & n.collideBits && r.callback && r.callback(n.__id) - }) - } - } - } -} -, function(e, t, i) { + e.exports = function (e) { + return { + name: "collideEntities", + state: { + collideBits: 1, + collideMask: 1, + callback: null, + }, + onAdd: null, + onRemove: null, + system: function (t, i) { + for (var r = e.ents, o = [], a = 0; a < i.length; a++) { + var s = i[a].__id, + c = r.getPositionData(s); + o[a] = c._extents; + } + n(o, function (e, t) { + var n = i[e], + r = i[t]; + n.collideMask & r.collideBits && n.callback && n.callback(r.__id), + r.collideMask & n.collideBits && r.callback && r.callback(n.__id); + }); + }, + }; + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t, i) { - switch (arguments.length) { + e.exports = function (e, t, i) { + switch (arguments.length) { case 1: - return n = [], - u(r = e, r, l, true), - n; + return (n = []), u((r = e), r, l, true), n; case 2: - return "function" == typeof t ? u(e, e, t, true) : function(e, t) { - return n = [], - u(e, t, l, false), - n - }(e, t); + return "function" == typeof t + ? u(e, e, t, true) + : (function (e, t) { + return (n = []), u(e, t, l, false), n; + })(e, t); case 3: - return u(e, t, i, false); + return u(e, t, i, false); default: - throw new Error("box-intersect: Invalid arguments") - } - var r - } - ; - var n, r = i(125), o = i(192), a = i(486); + throw new Error("box-intersect: Invalid arguments"); + } + var r; + }; + var n, + r = i(125), + o = i(192), + a = i(486); function s(e, t) { - for (var i = 0; i < e; ++i) - if (!(t[i] <= t[i + e])) - return true; - return false + for (var i = 0; i < e; ++i) if (!(t[i] <= t[i + e])) return true; + return false; } function c(e, t, i, n) { - for (var r = 0, o = 0, a = 0, c = e.length; a < c; ++a) { - var u = e[a]; - if (!s(t, u)) { - for (var l = 0; l < 2 * t; ++l) - i[r++] = u[l]; - n[o++] = a - } + for (var r = 0, o = 0, a = 0, c = e.length; a < c; ++a) { + var u = e[a]; + if (!s(t, u)) { + for (var l = 0; l < 2 * t; ++l) i[r++] = u[l]; + n[o++] = a; } - return o + } + return o; } function u(e, t, i, n) { - var s = e.length - , u = t.length; - if (!(s <= 0 || u <= 0)) { - var l = e[0].length >>> 1; - if (!(l <= 0)) { - var h, f = r.mallocDouble(2 * l * s), d = r.mallocInt32(s); - if ((s = c(e, l, f, d)) > 0) { - if (1 === l && n) - o.init(s), - h = o.sweepComplete(l, i, 0, s, f, d, 0, s, f, d); - else { - var p = r.mallocDouble(2 * l * u) - , m = r.mallocInt32(u); - (u = c(t, l, p, m)) > 0 && (o.init(s + u), - h = 1 === l ? o.sweepBipartite(l, i, 0, s, f, d, 0, u, p, m) : a(l, i, n, s, f, d, u, p, m), - r.free(p), - r.free(m)) - } - r.free(f), - r.free(d) - } - return h + var s = e.length, + u = t.length; + if (!(s <= 0 || u <= 0)) { + var l = e[0].length >>> 1; + if (!(l <= 0)) { + var h, + f = r.mallocDouble(2 * l * s), + d = r.mallocInt32(s); + if ((s = c(e, l, f, d)) > 0) { + if (1 === l && n) + o.init(s), (h = o.sweepComplete(l, i, 0, s, f, d, 0, s, f, d)); + else { + var p = r.mallocDouble(2 * l * u), + m = r.mallocInt32(u); + (u = c(t, l, p, m)) > 0 && + (o.init(s + u), + (h = + 1 === l + ? o.sweepBipartite(l, i, 0, s, f, d, 0, u, p, m) + : a(l, i, n, s, f, d, u, p, m)), + r.free(p), + r.free(m)); } + r.free(f), r.free(d); + } + return h; } + } } function l(e, t) { - n.push([e, t]) + n.push([e, t]); } -} -, function(e, t, i) { + }, + function (e, t, i) { "use strict"; function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - e.exports = function(e, t) { - switch (void 0 === t && (t = 0), - n(e)) { + e.exports = function (e, t) { + switch ((void 0 === t && (t = 0), n(e))) { case "number": - if (e > 0) - return function(e, t) { - var i, n; - for (i = new Array(e), - n = 0; n < e; ++n) - i[n] = t; - return i - }(0 | e, t); - break; + if (e > 0) + return (function (e, t) { + var i, n; + for (i = new Array(e), n = 0; n < e; ++n) i[n] = t; + return i; + })(0 | e, t); + break; case "object": - if ("number" == typeof e.length) - return function e(t, i, n) { - var r = 0 | t[n]; - if (r <= 0) - return []; - var o, a = new Array(r); - if (n === t.length - 1) - for (o = 0; o < r; ++o) - a[o] = i; - else - for (o = 0; o < r; ++o) - a[o] = e(t, i, n + 1); - return a - }(e, t, 0) - } - return [] - } -} -, function(e, t, i) { + if ("number" == typeof e.length) + return (function e(t, i, n) { + var r = 0 | t[n]; + if (r <= 0) return []; + var o, + a = new Array(r); + if (n === t.length - 1) for (o = 0; o < r; ++o) a[o] = i; + else for (o = 0; o < r; ++o) a[o] = e(t, i, n + 1); + return a; + })(e, t, 0); + } + return []; + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t) { - t <= 4 * n ? r(0, t - 1, e) : function e(t, i, h) { - var f = (i - t + 1) / 6 | 0 - , d = t + f - , p = i - f - , m = t + i >> 1 - , g = m - f - , _ = m + f - , v = d - , y = g - , b = m - , E = _ - , T = p - , A = t + 1 - , x = i - 1 - , S = 0; - u(v, y, h) && (S = v, - v = y, - y = S); - u(E, T, h) && (S = E, - E = T, - T = S); - u(v, b, h) && (S = v, - v = b, - b = S); - u(y, b, h) && (S = y, - y = b, - b = S); - u(v, E, h) && (S = v, - v = E, - E = S); - u(b, E, h) && (S = b, - b = E, - E = S); - u(y, T, h) && (S = y, - y = T, - T = S); - u(y, b, h) && (S = y, - y = b, - b = S); - u(E, T, h) && (S = E, - E = T, - T = S); + e.exports = function (e, t) { + t <= 4 * n + ? r(0, t - 1, e) + : (function e(t, i, h) { + var f = ((i - t + 1) / 6) | 0, + d = t + f, + p = i - f, + m = (t + i) >> 1, + g = m - f, + _ = m + f, + v = d, + y = g, + b = m, + E = _, + T = p, + A = t + 1, + x = i - 1, + S = 0; + u(v, y, h) && ((S = v), (v = y), (y = S)); + u(E, T, h) && ((S = E), (E = T), (T = S)); + u(v, b, h) && ((S = v), (v = b), (b = S)); + u(y, b, h) && ((S = y), (y = b), (b = S)); + u(v, E, h) && ((S = v), (v = E), (E = S)); + u(b, E, h) && ((S = b), (b = E), (E = S)); + u(y, T, h) && ((S = y), (y = T), (T = S)); + u(y, b, h) && ((S = y), (y = b), (b = S)); + u(E, T, h) && ((S = E), (E = T), (T = S)); var C = h[2 * y]; var P = h[2 * y + 1]; var R = h[2 * E]; @@ -104038,515 +141519,604 @@ and limitations under the License. var L = 2 * m; var F = 2 * p; for (var B = 0; B < 2; ++B) { - var N = h[O + B] - , k = h[w + B] - , U = h[I + B]; - h[D + B] = N, - h[L + B] = k, - h[F + B] = U + var N = h[O + B], + k = h[w + B], + U = h[I + B]; + (h[D + B] = N), (h[L + B] = k), (h[F + B] = U); } a(g, t, h); a(_, i, h); for (var V = A; V <= x; ++V) - if (l(V, C, P, h)) - V !== A && o(V, A, h), - ++A; - else if (!l(V, R, M, h)) - for (; ; ) { - if (l(x, R, M, h)) { - l(x, C, P, h) ? (s(V, A, x, h), - ++A, - --x) : (o(V, x, h), - --x); - break - } - if (--x < V) - break - } + if (l(V, C, P, h)) V !== A && o(V, A, h), ++A; + else if (!l(V, R, M, h)) + for (;;) { + if (l(x, R, M, h)) { + l(x, C, P, h) + ? (s(V, A, x, h), ++A, --x) + : (o(V, x, h), --x); + break; + } + if (--x < V) break; + } c(t, A - 1, C, P, h); c(i, x + 1, R, M, h); A - 2 - t <= n ? r(t, A - 2, h) : e(t, A - 2, h); i - (x + 2) <= n ? r(x + 2, i, h) : e(x + 2, i, h); - x - A <= n ? r(A, x, h) : e(A, x, h) - }(0, t - 1, e) - } - ; + x - A <= n ? r(A, x, h) : e(A, x, h); + })(0, t - 1, e); + }; var n = 32; function r(e, t, i) { - for (var n = 2 * (e + 1), r = e + 1; r <= t; ++r) { - for (var o = i[n++], a = i[n++], s = r, c = n - 2; s-- > e; ) { - var u = i[c - 2] - , l = i[c - 1]; - if (u < o) - break; - if (u === o && l < a) - break; - i[c] = u, - i[c + 1] = l, - c -= 2 - } - i[c] = o, - i[c + 1] = a + for (var n = 2 * (e + 1), r = e + 1; r <= t; ++r) { + for (var o = i[n++], a = i[n++], s = r, c = n - 2; s-- > e; ) { + var u = i[c - 2], + l = i[c - 1]; + if (u < o) break; + if (u === o && l < a) break; + (i[c] = u), (i[c + 1] = l), (c -= 2); } + (i[c] = o), (i[c + 1] = a); + } } function o(e, t, i) { - t *= 2; - var n = i[e *= 2] - , r = i[e + 1]; - i[e] = i[t], - i[e + 1] = i[t + 1], - i[t] = n, - i[t + 1] = r + t *= 2; + var n = i[(e *= 2)], + r = i[e + 1]; + (i[e] = i[t]), (i[e + 1] = i[t + 1]), (i[t] = n), (i[t + 1] = r); } function a(e, t, i) { - t *= 2, - i[e *= 2] = i[t], - i[e + 1] = i[t + 1] + (t *= 2), (i[(e *= 2)] = i[t]), (i[e + 1] = i[t + 1]); } function s(e, t, i, n) { - t *= 2, - i *= 2; - var r = n[e *= 2] - , o = n[e + 1]; - n[e] = n[t], - n[e + 1] = n[t + 1], - n[t] = n[i], - n[t + 1] = n[i + 1], - n[i] = r, - n[i + 1] = o + (t *= 2), (i *= 2); + var r = n[(e *= 2)], + o = n[e + 1]; + (n[e] = n[t]), + (n[e + 1] = n[t + 1]), + (n[t] = n[i]), + (n[t + 1] = n[i + 1]), + (n[i] = r), + (n[i + 1] = o); } function c(e, t, i, n, r) { - t *= 2, - r[e *= 2] = r[t], - r[t] = i, - r[e + 1] = r[t + 1], - r[t + 1] = n + (t *= 2), + (r[(e *= 2)] = r[t]), + (r[t] = i), + (r[e + 1] = r[t + 1]), + (r[t + 1] = n); } function u(e, t, i) { - t *= 2; - var n = i[e *= 2] - , r = i[t]; - return !(n < r) && (n !== r || i[e + 1] > i[t + 1]) + t *= 2; + var n = i[(e *= 2)], + r = i[t]; + return !(n < r) && (n !== r || i[e + 1] > i[t + 1]); } function l(e, t, i, n) { - var r = n[e *= 2]; - return r < t || r === t && n[e + 1] < i + var r = n[(e *= 2)]; + return r < t || (r === t && n[e + 1] < i); } -} -, function(e, t, i) { + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t, i, o, l, P, R, M, O) { - !function(e, t) { - var i = 8 * r.log2(t + 1) * (e + 1) | 0 - , o = r.nextPow2(b * i); - T.length < o && (n.free(T), - T = n.mallocInt32(o)); - var a = r.nextPow2(E * i); - A < a && (n.free(A), - A = n.mallocDouble(a)) - }(e, o + R); - var w, I = 0, D = 2 * e; - x(I++, 0, 0, o, 0, R, i ? 16 : 0, -1 / 0, 1 / 0), + e.exports = function (e, t, i, o, l, P, R, M, O) { + !(function (e, t) { + var i = (8 * r.log2(t + 1) * (e + 1)) | 0, + o = r.nextPow2(b * i); + T.length < o && (n.free(T), (T = n.mallocInt32(o))); + var a = r.nextPow2(E * i); + A < a && (n.free(A), (A = n.mallocDouble(a))); + })(e, o + R); + var w, + I = 0, + D = 2 * e; + x(I++, 0, 0, o, 0, R, i ? 16 : 0, -1 / 0, 1 / 0), i || x(I++, 0, 0, R, 0, o, 1, -1 / 0, 1 / 0); - for (; I > 0; ) { - var L = (I -= 1) * b - , F = T[L] - , B = T[L + 1] - , N = T[L + 2] - , k = T[L + 3] - , U = T[L + 4] - , V = T[L + 5] - , G = I * E - , z = A[G] - , j = A[G + 1] - , H = 1 & V - , W = !!(16 & V) - , X = l - , Y = P - , K = M - , Q = O; - if (H && (X = M, - Y = O, - K = l, - Q = P), - !(2 & V && (N = g(e, F, B, N, X, Y, j), - B >= N) || 4 & V && (B = _(e, F, B, N, X, Y, z)) >= N)) { - var q = N - B - , Z = U - k; - if (W) { - if (e * q * (q + Z) < d) { - if (void 0 !== (w = c.scanComplete(e, F, t, B, N, X, Y, k, U, K, Q))) - return w; - continue - } - } else { - if (e * Math.min(q, Z) < h) { - if (void 0 !== (w = a(e, F, t, H, B, N, X, Y, k, U, K, Q))) - return w; - continue - } - if (e * q * Z < f) { - if (void 0 !== (w = c.scanBipartite(e, F, t, H, B, N, X, Y, k, U, K, Q))) - return w; - continue - } - } - var J = p(e, F, B, N, X, Y, z, j); - if (B < J) - if (e * (J - B) < h) { - if (void 0 !== (w = s(e, F + 1, t, B, J, X, Y, k, U, K, Q))) - return w - } else if (F === e - 2) { - if (void 0 !== (w = H ? c.sweepBipartite(e, t, k, U, K, Q, B, J, X, Y) : c.sweepBipartite(e, t, B, J, X, Y, k, U, K, Q))) - return w - } else - x(I++, F + 1, B, J, k, U, H, -1 / 0, 1 / 0), - x(I++, F + 1, k, U, B, J, 1 ^ H, -1 / 0, 1 / 0); - if (J < N) { - var $ = u(e, F, k, U, K, Q) - , ee = K[D * $ + F] - , te = m(e, F, $, U, K, Q, ee); - if (te < U && x(I++, F, J, N, te, U, (4 | H) + (W ? 16 : 0), ee, j), - k < $ && x(I++, F, J, N, k, $, (2 | H) + (W ? 16 : 0), z, ee), - $ + 1 === te) { - if (void 0 !== (w = W ? C(e, F, t, J, N, X, Y, $, K, Q[$]) : S(e, F, t, H, J, N, X, Y, $, K, Q[$]))) - return w - } else if ($ < te) { - var ie; - if (W) { - if (ie = v(e, F, J, N, X, Y, ee), - J < ie) { - var ne = m(e, F, J, ie, X, Y, ee); - if (F === e - 2) { - if (J < ne && void 0 !== (w = c.sweepComplete(e, t, J, ne, X, Y, $, te, K, Q))) - return w; - if (ne < ie && void 0 !== (w = c.sweepBipartite(e, t, ne, ie, X, Y, $, te, K, Q))) - return w - } else - J < ne && x(I++, F + 1, J, ne, $, te, 16, -1 / 0, 1 / 0), - ne < ie && (x(I++, F + 1, ne, ie, $, te, 0, -1 / 0, 1 / 0), - x(I++, F + 1, $, te, ne, ie, 1, -1 / 0, 1 / 0)) - } - } else - ie = H ? y(e, F, J, N, X, Y, ee) : v(e, F, J, N, X, Y, ee), - J < ie && (F === e - 2 ? w = H ? c.sweepBipartite(e, t, $, te, K, Q, J, ie, X, Y) : c.sweepBipartite(e, t, J, ie, X, Y, $, te, K, Q) : (x(I++, F + 1, J, ie, $, te, H, -1 / 0, 1 / 0), - x(I++, F + 1, $, te, J, ie, 1 ^ H, -1 / 0, 1 / 0))) - } - } + for (; I > 0; ) { + var L = (I -= 1) * b, + F = T[L], + B = T[L + 1], + N = T[L + 2], + k = T[L + 3], + U = T[L + 4], + V = T[L + 5], + G = I * E, + z = A[G], + j = A[G + 1], + H = 1 & V, + W = !!(16 & V), + X = l, + Y = P, + K = M, + Q = O; + if ( + (H && ((X = M), (Y = O), (K = l), (Q = P)), + !( + (2 & V && ((N = g(e, F, B, N, X, Y, j)), B >= N)) || + (4 & V && (B = _(e, F, B, N, X, Y, z)) >= N) + )) + ) { + var q = N - B, + Z = U - k; + if (W) { + if (e * q * (q + Z) < d) { + if ( + void 0 !== (w = c.scanComplete(e, F, t, B, N, X, Y, k, U, K, Q)) + ) + return w; + continue; } + } else { + if (e * Math.min(q, Z) < h) { + if (void 0 !== (w = a(e, F, t, H, B, N, X, Y, k, U, K, Q))) + return w; + continue; + } + if (e * q * Z < f) { + if ( + void 0 !== + (w = c.scanBipartite(e, F, t, H, B, N, X, Y, k, U, K, Q)) + ) + return w; + continue; + } + } + var J = p(e, F, B, N, X, Y, z, j); + if (B < J) + if (e * (J - B) < h) { + if (void 0 !== (w = s(e, F + 1, t, B, J, X, Y, k, U, K, Q))) + return w; + } else if (F === e - 2) { + if ( + void 0 !== + (w = H + ? c.sweepBipartite(e, t, k, U, K, Q, B, J, X, Y) + : c.sweepBipartite(e, t, B, J, X, Y, k, U, K, Q)) + ) + return w; + } else + x(I++, F + 1, B, J, k, U, H, -1 / 0, 1 / 0), + x(I++, F + 1, k, U, B, J, 1 ^ H, -1 / 0, 1 / 0); + if (J < N) { + var $ = u(e, F, k, U, K, Q), + ee = K[D * $ + F], + te = m(e, F, $, U, K, Q, ee); + if ( + (te < U && x(I++, F, J, N, te, U, (4 | H) + (W ? 16 : 0), ee, j), + k < $ && x(I++, F, J, N, k, $, (2 | H) + (W ? 16 : 0), z, ee), + $ + 1 === te) + ) { + if ( + void 0 !== + (w = W + ? C(e, F, t, J, N, X, Y, $, K, Q[$]) + : S(e, F, t, H, J, N, X, Y, $, K, Q[$])) + ) + return w; + } else if ($ < te) { + var ie; + if (W) { + if (((ie = v(e, F, J, N, X, Y, ee)), J < ie)) { + var ne = m(e, F, J, ie, X, Y, ee); + if (F === e - 2) { + if ( + J < ne && + void 0 !== + (w = c.sweepComplete(e, t, J, ne, X, Y, $, te, K, Q)) + ) + return w; + if ( + ne < ie && + void 0 !== + (w = c.sweepBipartite(e, t, ne, ie, X, Y, $, te, K, Q)) + ) + return w; + } else + J < ne && x(I++, F + 1, J, ne, $, te, 16, -1 / 0, 1 / 0), + ne < ie && + (x(I++, F + 1, ne, ie, $, te, 0, -1 / 0, 1 / 0), + x(I++, F + 1, $, te, ne, ie, 1, -1 / 0, 1 / 0)); + } + } else + (ie = H ? y(e, F, J, N, X, Y, ee) : v(e, F, J, N, X, Y, ee)), + J < ie && + (F === e - 2 + ? (w = H + ? c.sweepBipartite(e, t, $, te, K, Q, J, ie, X, Y) + : c.sweepBipartite(e, t, J, ie, X, Y, $, te, K, Q)) + : (x(I++, F + 1, J, ie, $, te, H, -1 / 0, 1 / 0), + x(I++, F + 1, $, te, J, ie, 1 ^ H, -1 / 0, 1 / 0))); + } + } } - } - ; - var n = i(125) - , r = i(126) - , o = i(487) - , a = o.partial - , s = o.full - , c = i(192) - , u = i(488) - , l = i(193) - , h = 128 - , f = 1 << 22 - , d = 1 << 22 - , p = l("!(lo>=p0)&&!(p1>=hi)", ["p0", "p1"]) - , m = l("lo===p0", ["p0"]) - , g = l("lo=p0)&&!(p1>=hi)", ["p0", "p1"]), + m = l("lo===p0", ["p0"]), + g = l("lo" + p + "-" + d + "){"), - e ? (A(true, false), - T.push("}else{"), - A(false, false)) : (T.push("if(" + a + "){"), - A(true, true), - T.push("}else{"), - A(true, false), - T.push("}}else{if(" + a + "){"), - A(false, true), - T.push("}else{"), - A(false, false), - T.push("}")), + var t = "bruteForce" + (e ? "Full" : "Partial"), + i = [], + E = b.slice(); + e || E.splice(3, 0, a); + var T = ["function " + t + "(" + E.join() + "){"]; + function A(t, a) { + var E = (function (e, t, i) { + var a = + "bruteForce" + + (e ? "Red" : "Blue") + + (t ? "Flip" : "") + + (i ? "Full" : ""), + E = ["function ", a, "(", b.join(), "){", "var ", s, "=2*", n, ";"], + T = + "for(var i=" + + c + + "," + + f + + "=" + + s + + "*" + + c + + ";i<" + + u + + ";++i," + + f + + "+=" + + s + + "){var x0=" + + l + + "[" + + r + + "+" + + f + + "],x1=" + + l + + "[" + + r + + "+" + + f + + "+" + + n + + "],xi=" + + h + + "[i];", + A = + "for(var j=" + + d + + "," + + _ + + "=" + + s + + "*" + + d + + ";j<" + + p + + ";++j," + + _ + + "+=" + + s + + "){var y0=" + + m + + "[" + + r + + "+" + + _ + + "]," + + (i ? "y1=" + m + "[" + r + "+" + _ + "+" + n + "]," : "") + + "yi=" + + g + + "[j];"; + return ( + e ? E.push(T, y, ":", A) : E.push(A, y, ":", T), + i + ? E.push("if(y1" + p + "-" + d + "){"), + e + ? (A(true, false), T.push("}else{"), A(false, false)) + : (T.push("if(" + a + "){"), + A(true, true), + T.push("}else{"), + A(true, false), + T.push("}}else{if(" + a + "){"), + A(false, true), + T.push("}else{"), + A(false, false), + T.push("}")), T.push("}}return " + t); - var x = i.join("") + T.join(""); - return new Function(x)() + var x = i.join("") + T.join(""); + return new Function(x)(); } - t.partial = E(false), - t.full = E(true) -} -, function(e, t, i) { + (t.partial = E(false)), (t.full = E(true)); + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t, i, a, s, c) { - if (a <= i + 1) - return i; - var u = i - , l = a - , h = a + i >>> 1 - , f = 2 * e - , d = h - , p = s[f * h + t]; - for (; u < l; ) { - if (l - u < r) { - o(e, t, u, l, s, c), - p = s[f * h + t]; - break - } - var m = l - u - , g = Math.random() * m + u | 0 - , _ = s[f * g + t] - , v = Math.random() * m + u | 0 - , y = s[f * v + t] - , b = Math.random() * m + u | 0 - , E = s[f * b + t]; - _ <= y ? E >= y ? (d = v, - p = y) : _ >= E ? (d = g, - p = _) : (d = b, - p = E) : y >= E ? (d = v, - p = y) : E >= _ ? (d = g, - p = _) : (d = b, - p = E); - for (var T = f * (l - 1), A = f * d, x = 0; x < f; ++x, - ++T, - ++A) { - var S = s[T]; - s[T] = s[A], - s[A] = S - } - var C = c[l - 1]; - c[l - 1] = c[d], - c[d] = C, - d = n(e, t, u, l - 1, s, c, p); - for (var T = f * (l - 1), A = f * d, x = 0; x < f; ++x, - ++T, - ++A) { - var S = s[T]; - s[T] = s[A], - s[A] = S - } - var C = c[l - 1]; - if (c[l - 1] = c[d], - c[d] = C, - h < d) { - for (l = d - 1; u < l && s[f * (l - 1) + t] === p; ) - l -= 1; - l += 1 - } else { - if (!(d < h)) - break; - for (u = d + 1; u < l && s[f * u + t] === p; ) - u += 1 - } + e.exports = function (e, t, i, a, s, c) { + if (a <= i + 1) return i; + var u = i, + l = a, + h = (a + i) >>> 1, + f = 2 * e, + d = h, + p = s[f * h + t]; + for (; u < l; ) { + if (l - u < r) { + o(e, t, u, l, s, c), (p = s[f * h + t]); + break; } - return n(e, t, i, h, s, c, s[f * h + t]) - } - ; - var n = i(193)("lo= y + ? ((d = v), (p = y)) + : _ >= E + ? ((d = g), (p = _)) + : ((d = b), (p = E)) + : y >= E + ? ((d = v), (p = y)) + : E >= _ + ? ((d = g), (p = _)) + : ((d = b), (p = E)); + for (var T = f * (l - 1), A = f * d, x = 0; x < f; ++x, ++T, ++A) { + var S = s[T]; + (s[T] = s[A]), (s[A] = S); + } + var C = c[l - 1]; + (c[l - 1] = c[d]), (c[d] = C), (d = n(e, t, u, l - 1, s, c, p)); + for (var T = f * (l - 1), A = f * d, x = 0; x < f; ++x, ++T, ++A) { + var S = s[T]; + (s[T] = s[A]), (s[A] = S); + } + var C = c[l - 1]; + if (((c[l - 1] = c[d]), (c[d] = C), h < d)) { + for (l = d - 1; u < l && s[f * (l - 1) + t] === p; ) l -= 1; + l += 1; + } else { + if (!(d < h)) break; + for (u = d + 1; u < l && s[f * u + t] === p; ) u += 1; + } + } + return n(e, t, i, h, s, c, s[f * h + t]); + }; + var n = i(193)("lo i && r[h + t] > u; --l, - h -= a) { - for (var f = h, d = h + a, p = 0; p < a; ++p, - ++f, - ++d) { - var m = r[f]; - r[f] = r[d], - r[d] = m - } - var g = o[l]; - o[l] = o[l - 1], - o[l - 1] = g - } - } -} -, function(e, t, i) { - "use strict"; - e.exports = function(e) { - return { - name: "every", - state: { - every: 100, - callback: null, - _ct: 0 - }, - onAdd: null, - onRemove: null, - system: function(e, t) { - for (var i = 0; i < t.length; i++) { - var n = t[i]; - n._ct += e, - n._ct > n.every && (n.callback(n.every), - n._ct -= n.every) - } - } + for (var a = 2 * e, s = a * (i + 1) + t, c = i + 1; c < n; ++c, s += a) + for ( + var u = r[s], l = c, h = a * (c - 1); + l > i && r[h + t] > u; + --l, h -= a + ) { + for (var f = h, d = h + a, p = 0; p < a; ++p, ++f, ++d) { + var m = r[f]; + (r[f] = r[d]), (r[d] = m); + } + var g = o[l]; + (o[l] = o[l - 1]), (o[l - 1] = g); } } -} -, function(e, t, i) { + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - return { - name: "smooth-camera", - state: { - time: 100.1 - }, - onAdd: null, - onRemove: null, - system: function(t, i) { - for (var n = 0; n < i.length; ++n) { - var r = i[n]; - r.time -= t, - r.time < 0 && e.ents.removeComponentLater(r.__id, "smooth-camera") - } - } - } - } -} -, function(exp, moveProperties, getterFunc) { + e.exports = function (e) { + return { + name: "every", + state: { + every: 100, + callback: null, + _ct: 0, + }, + onAdd: null, + onRemove: null, + system: function (e, t) { + for (var i = 0; i < t.length; i++) { + var n = t[i]; + (n._ct += e), + n._ct > n.every && (n.callback(n.every), (n._ct -= n.every)); + } + }, + }; + }; + }, + function (e, t, i) { + "use strict"; + e.exports = function (e) { + return { + name: "smooth-camera", + state: { + time: 100.1, + }, + onAdd: null, + onRemove: null, + system: function (t, i) { + for (var n = 0; n < i.length; ++n) { + var r = i[n]; + (r.time -= t), + r.time < 0 && + e.ents.removeComponentLater(r.__id, "smooth-camera"); + } + }, + }; + }; + }, + function (exp, moveProperties, getterFunc) { "use strict"; var vec3Math = getterFunc(16); - - exp.exports = function(e) { - return { - name: "movement", - state: { - heading: 0, - running: false, - jumping: false, - maxSpeed: 6, - moveForce: 30, - responsiveness: 15, - runningFriction: 0, - standingFriction: 50, - airMoveMult: .5, - jumpImpulse: 11, - jumpForce: 6.5, - jumpTime: 500, - airJumps: 1, - _jumpCount: 0, - _isJumping: 0, - _currjumptime: 0 - }, - onAdd: null, - onRemove: null, - system: function(t, i) { - for (var curEntity = e.entities, j = 0; j < i.length; j++) { - var moveProperties = i[j]; - jump(t, moveProperties, curEntity.getPhysicsBody(moveProperties.__id)) - } - } - } + + exp.exports = function (e) { + return { + name: "movement", + state: { + heading: 0, + running: false, + jumping: false, + maxSpeed: 6, + moveForce: 30, + responsiveness: 15, + runningFriction: 0, + standingFriction: 50, + airMoveMult: 0.5, + jumpImpulse: 11, + jumpForce: 6.5, + jumpTime: 500, + airJumps: 1, + _jumpCount: 0, + _isJumping: 0, + _currjumptime: 0, + }, + onAdd: null, + onRemove: null, + system: function (t, i) { + for (var curEntity = e.entities, j = 0; j < i.length; j++) { + var moveProperties = i[j]; + jump( + t, + moveProperties, + curEntity.getPhysicsBody(moveProperties.__id) + ); + } + }, + }; }; var mathObj0 = vec3Math.create(); @@ -104554,1995 +142124,2662 @@ and limitations under the License. var mathObj2 = vec3Math.create(); function jump(unused_var, moveProperties, physicsBody) { - var blockIdAtFoot = noa.world.getBlockID(Math.floor(physicsBody.aabb.base[0]), Math.floor(physicsBody.aabb.base[1]), Math.floor(physicsBody.aabb.base[2])); - - // block at [0, .5, 0] from feet - var blockIdAtLegs = noa.world.getBlockID(Math.floor(physicsBody.aabb.base[0]), Math.floor(physicsBody.aabb.base[1] + .5), Math.floor(physicsBody.aabb.base[2])); - - var inWater = false; - var inLava = false; + var blockIdAtFoot = noa.world.getBlockID( + Math.floor(physicsBody.aabb.base[0]), + Math.floor(physicsBody.aabb.base[1]), + Math.floor(physicsBody.aabb.base[2]) + ); - var waterId = 7; - var lavaId = 17; - var waterHackId = 41; + // block at [0, .5, 0] from feet + var blockIdAtLegs = noa.world.getBlockID( + Math.floor(physicsBody.aabb.base[0]), + Math.floor(physicsBody.aabb.base[1] + 0.5), + Math.floor(physicsBody.aabb.base[2]) + ); - var atRestY = physicsBody.atRestY() < 0; - var canJump = atRestY || moveProperties._jumpCount < moveProperties.airJumps; - physicsBody.autoStep = false; - physicsBody.gravityMultiplier = 4.2 + var inWater = false; + var inLava = false; - // if feet and legs are in water set inWater to true - inWater = !((blockIdAtFoot != waterId) && (blockIdAtFoot != waterHackId) && (blockIdAtLegs != waterId) && (blockIdAtLegs != waterHackId)); - inLava = (blockIdAtFoot == lavaId); + var waterId = 7; + var lavaId = 17; + var waterHackId = 41; - physicsBody.autoStep = ((inWater || inLava) && blockIdAtLegs == 0); - + var atRestY = physicsBody.atRestY() < 0; + var canJump = + atRestY || moveProperties._jumpCount < moveProperties.airJumps; + physicsBody.autoStep = false; + physicsBody.gravityMultiplier = 4.2; - if (inWater) - physicsBody.gravityMultiplier = 2.1; - if (inLava) - physicsBody.gravityMultiplier = 1.05; + // if feet and legs are in water set inWater to true + inWater = !( + blockIdAtFoot != waterId && + blockIdAtFoot != waterHackId && + blockIdAtLegs != waterId && + blockIdAtLegs != waterHackId + ); + inLava = blockIdAtFoot == lavaId; + physicsBody.autoStep = (inWater || inLava) && blockIdAtLegs == 0; - if (atRestY && !moveProperties.jumping || inWater || inLava) { - moveProperties._isJumping = false; - moveProperties._jumpCount = 0; - } else if (moveProperties._isJumping) { - if (moveProperties._currjumptime > 0) { - var jumpForce = moveProperties.jumpForce; + if (inWater) physicsBody.gravityMultiplier = 2.1; + if (inLava) physicsBody.gravityMultiplier = 1.05; - if(moveProperties._currjumptime < unused_var) { - jumpForce *= moveProperties._currjumptime / unused_var; - } + if ((atRestY && !moveProperties.jumping) || inWater || inLava) { + moveProperties._isJumping = false; + moveProperties._jumpCount = 0; + } else if (moveProperties._isJumping) { + if (moveProperties._currjumptime > 0) { + var jumpForce = moveProperties.jumpForce; - physicsBody.applyForce([0, jumpForce, 0]); - moveProperties._currjumptime -= unused_var; - } - } else { - if(canJump) { - moveProperties._isJumping = true; - - if(atRestY) - moveProperties._jumpCount++; - - moveProperties._currjumptime = moveProperties.jumpTime; - physicsBody.applyImpulse([0, moveProperties.jumpImpulse, 0]); - - if(!atRestY && physicsBody.velocity[1] < 0) - physicsBody.velocity[1] = 0; - } + if (moveProperties._currjumptime < unused_var) { + jumpForce *= moveProperties._currjumptime / unused_var; + } + + physicsBody.applyForce([0, jumpForce, 0]); + moveProperties._currjumptime -= unused_var; } + } else { + if (canJump) { + moveProperties._isJumping = true; - if(moveProperties.jumpWasPressed) { - if(inWater) - physicsBody.applyForce([0, 3 * moveProperties.maxSpeed, 0]); - if(inLava) - physicsBody.applyForce([0, 1.5 * moveProperties.maxSpeed, 0]) - } + if (atRestY) moveProperties._jumpCount++; - - var mo0 = mathObj0; - var mo1 = mathObj1; + moveProperties._currjumptime = moveProperties.jumpTime; + physicsBody.applyImpulse([0, moveProperties.jumpImpulse, 0]); - if (moveProperties.running) { - var maxMovSpeed = moveProperties.maxSpeed; - - if(inWater) - maxMovSpeed *= .5; - if(inLava) - maxMovSpeed *= .25; - - vec3Math.set(mo0, 0, 0, maxMovSpeed); - vec3Math.rotateY(mo0, mo0, mathObj2, moveProperties.heading); - vec3Math.subtract(mo1, mo0, physicsBody.velocity); - - mo1[1] = 0; - - var mo1Length = vec3Math.length(mo1); - vec3Math.normalize(mo1, mo1); - - if (mo1Length > 0) { - var moveForce = moveProperties.moveForce; - - if(atRestY) - moveForce *= moveProperties.airMoveMult; - - var y = moveProperties.responsiveness * mo1Length; - - if(moveForce > y) - moveForce = y; - - vec3Math.scale(mo1, mo1, moveForce); - physicsBody.applyForce(mo1); - } - - physicsBody.friction = moveProperties.runningFriction - } else - physicsBody.friction = moveProperties.standingFriction; - - - var bodyPos = physicsBody.getPosition(); - - if(bodyPos[0] <= .2) { - physicsBody.setPosition([.2, bodyPos[1], bodyPos[2]]); - physicsBody.velocity[0] = 0; - } - - if(bodyPos[0] >= noa.worldSize - 1 - .8) { - physicsBody.setPosition([noa.worldSize - 1 - .8, bodyPos[1], bodyPos[2]]); - physicsBody.velocity[0] = 0; - } - - bodyPos = physicsBody.getPosition(); - if(bodyPos[2] <= .2) { - physicsBody.setPosition([bodyPos[0], bodyPos[1], .2]); - physicsBody.velocity[2] = 0; - } - - if(bodyPos[2] >= noa.worldSize - 1 - .8) { - physicsBody.setPosition([bodyPos[0], bodyPos[1], noa.worldSize - 1 - .8]); - physicsBody.velocity[2] = 0; - } - - if(bodyPos[1] <= 0) { - physicsBody.setPosition([bodyPos[0], 0, bodyPos[2]]); + if (!atRestY && physicsBody.velocity[1] < 0) physicsBody.velocity[1] = 0; } + } + + if (moveProperties.jumpWasPressed) { + if (inWater) + physicsBody.applyForce([0, 3 * moveProperties.maxSpeed, 0]); + if (inLava) + physicsBody.applyForce([0, 1.5 * moveProperties.maxSpeed, 0]); + } + + var mo0 = mathObj0; + var mo1 = mathObj1; + + if (moveProperties.running) { + var maxMovSpeed = moveProperties.maxSpeed; + + if (inWater) maxMovSpeed *= 0.5; + if (inLava) maxMovSpeed *= 0.25; + + vec3Math.set(mo0, 0, 0, maxMovSpeed); + vec3Math.rotateY(mo0, mo0, mathObj2, moveProperties.heading); + vec3Math.subtract(mo1, mo0, physicsBody.velocity); + + mo1[1] = 0; + + var mo1Length = vec3Math.length(mo1); + vec3Math.normalize(mo1, mo1); + + if (mo1Length > 0) { + var moveForce = moveProperties.moveForce; + + if (atRestY) moveForce *= moveProperties.airMoveMult; + + var y = moveProperties.responsiveness * mo1Length; + + if (moveForce > y) moveForce = y; + + vec3Math.scale(mo1, mo1, moveForce); + physicsBody.applyForce(mo1); + } + + physicsBody.friction = moveProperties.runningFriction; + } else physicsBody.friction = moveProperties.standingFriction; + + var bodyPos = physicsBody.getPosition(); + + if (bodyPos[0] <= 0.2) { + physicsBody.setPosition([0.2, bodyPos[1], bodyPos[2]]); + physicsBody.velocity[0] = 0; + } + + if (bodyPos[0] >= noa.worldSize - 1 - 0.8) { + physicsBody.setPosition([ + noa.worldSize - 1 - 0.8, + bodyPos[1], + bodyPos[2], + ]); + physicsBody.velocity[0] = 0; + } + + bodyPos = physicsBody.getPosition(); + if (bodyPos[2] <= 0.2) { + physicsBody.setPosition([bodyPos[0], bodyPos[1], 0.2]); + physicsBody.velocity[2] = 0; + } + + if (bodyPos[2] >= noa.worldSize - 1 - 0.8) { + physicsBody.setPosition([ + bodyPos[0], + bodyPos[1], + noa.worldSize - 1 - 0.8, + ]); + physicsBody.velocity[2] = 0; + } + + if (bodyPos[1] <= 0) { + physicsBody.setPosition([bodyPos[0], 0, bodyPos[2]]); + physicsBody.velocity[1] = 0; + } } -} -, function(e, t, i) { + }, + function (e, t, i) { "use strict"; function n(e, t, i) { - e.jumping = !!t.jump, + (e.jumping = !!t.jump), e.jumping && e.jumpWasPressed && (e.jumping = false), - e.jumpWasPressed = !!t.jump; - var n = t.forward ? t.backward ? 0 : 1 : t.backward ? -1 : 0 - , r = t.right ? t.left ? 0 : 1 : t.left ? -1 : 0; - 0 == (n | r) ? e.running = false : (e.running = true, - n ? (-1 == n && (i += Math.PI), - r && (i += Math.PI / 4 * n * r)) : i += r * Math.PI / 2, - e.heading = i) + (e.jumpWasPressed = !!t.jump); + var n = t.forward ? (t.backward ? 0 : 1) : t.backward ? -1 : 0, + r = t.right ? (t.left ? 0 : 1) : t.left ? -1 : 0; + 0 == (n | r) + ? (e.running = false) + : ((e.running = true), + n + ? (-1 == n && (i += Math.PI), r && (i += (Math.PI / 4) * n * r)) + : (i += (r * Math.PI) / 2), + (e.heading = i)); } - e.exports = function(e) { - return { - name: "receivesInputs", - state: {}, - onAdd: null, - onRemove: null, - system: function(t, i) { - for (var r = e.entities, o = e.inputs.state, a = e.rendering.getCameraRotation()[1], s = 0; s < i.length; s++) { - n(r.getMovement(i[s].__id), o, a) - } - } - } - } -} -, function(e, t, i) { + e.exports = function (e) { + return { + name: "receivesInputs", + state: {}, + onAdd: null, + onRemove: null, + system: function (t, i) { + for ( + var r = e.entities, + o = e.inputs.state, + a = e.rendering.getCameraRotation()[1], + s = 0; + s < i.length; + s++ + ) { + n(r.getMovement(i[s].__id), o, a); + } + }, + }; + }; + }, + function (e, t, i) { "use strict"; function n(e, t, i, n) { - n.hasMesh(t) && ((e._showing && i < e.cutoff || !e._showing && i > e.cutoff) && (n.getMeshData(t).mesh.visibility = e._showing = i > e.cutoff)) + n.hasMesh(t) && + ((e._showing && i < e.cutoff) || (!e._showing && i > e.cutoff)) && + (n.getMeshData(t).mesh.visibility = e._showing = i > e.cutoff); } - e.exports = function(e) { - return { - name: "fadeOnZoom", - state: { - cutoff: 1.5, - _showing: true - }, - onAdd: null, - onRemove: null, - system: function(t, i) { - for (var r = e.rendering._currentZoom, o = e.entities, a = 0; a < i.length; a++) { - var s = i[a]; - n(s, s.__id, r, o) - } - } - } - } -} -, function(e, t, i) { + e.exports = function (e) { + return { + name: "fadeOnZoom", + state: { + cutoff: 1.5, + _showing: true, + }, + onAdd: null, + onRemove: null, + system: function (t, i) { + for ( + var r = e.rendering._currentZoom, o = e.entities, a = 0; + a < i.length; + a++ + ) { + var s = i[a]; + n(s, s.__id, r, o); + } + }, + }; + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t, i, n, r, o) { - var a = +t[0] - , s = +t[1] - , c = +t[2] - , u = +i[0] - , l = +i[1] - , h = +i[2] - , f = Math.sqrt(u * u + l * l + h * h); - if (0 === f) - throw new Error("Can't raycast along a zero vector"); - return function(e, t, i, n, r, o, a, s, c, u) { - for (var l = 0, h = Math.floor, f = 0 | h(t), d = 0 | h(i), p = 0 | h(n), m = r > 0 ? 1 : -1, g = o > 0 ? 1 : -1, _ = a > 0 ? 1 : -1, v = Math.abs(1 / r), y = Math.abs(1 / o), b = Math.abs(1 / a), E = v < 1 / 0 ? v * (m > 0 ? f + 1 - t : t - f) : 1 / 0, T = y < 1 / 0 ? y * (g > 0 ? d + 1 - i : i - d) : 1 / 0, A = b < 1 / 0 ? b * (_ > 0 ? p + 1 - n : n - p) : 1 / 0, x = -1; l <= s; ) { - var S = e(f, d, p); - if (S) - return c && (c[0] = t + l * r, - c[1] = i + l * o, - c[2] = n + l * a), - u && (u[0] = u[1] = u[2] = 0, - 0 === x && (u[0] = -m), - 1 === x && (u[1] = -g), - 2 === x && (u[2] = -_)), - S; - E < T ? E < A ? (f += m, - l = E, - E += v, - x = 0) : (p += _, - l = A, - A += b, - x = 2) : T < A ? (d += g, - l = T, - T += y, - x = 1) : (p += _, - l = A, - A += b, - x = 2) - } - return c && (c[0] = t + l * r, - c[1] = i + l * o, - c[2] = n + l * a), - u && (u[0] = u[1] = u[2] = 0), - 0 - }(e, a, s, c, u /= f, l /= f, h /= f, n = void 0 === n ? 64 : +n, r, o) - } -} -, function(e, t, i) { + e.exports = function (e, t, i, n, r, o) { + var a = +t[0], + s = +t[1], + c = +t[2], + u = +i[0], + l = +i[1], + h = +i[2], + f = Math.sqrt(u * u + l * l + h * h); + if (0 === f) throw new Error("Can't raycast along a zero vector"); + return (function (e, t, i, n, r, o, a, s, c, u) { + for ( + var l = 0, + h = Math.floor, + f = 0 | h(t), + d = 0 | h(i), + p = 0 | h(n), + m = r > 0 ? 1 : -1, + g = o > 0 ? 1 : -1, + _ = a > 0 ? 1 : -1, + v = Math.abs(1 / r), + y = Math.abs(1 / o), + b = Math.abs(1 / a), + E = v < 1 / 0 ? v * (m > 0 ? f + 1 - t : t - f) : 1 / 0, + T = y < 1 / 0 ? y * (g > 0 ? d + 1 - i : i - d) : 1 / 0, + A = b < 1 / 0 ? b * (_ > 0 ? p + 1 - n : n - p) : 1 / 0, + x = -1; + l <= s; + + ) { + var S = e(f, d, p); + if (S) + return ( + c && ((c[0] = t + l * r), (c[1] = i + l * o), (c[2] = n + l * a)), + u && + ((u[0] = u[1] = u[2] = 0), + 0 === x && (u[0] = -m), + 1 === x && (u[1] = -g), + 2 === x && (u[2] = -_)), + S + ); + E < T + ? E < A + ? ((f += m), (l = E), (E += v), (x = 0)) + : ((p += _), (l = A), (A += b), (x = 2)) + : T < A + ? ((d += g), (l = T), (T += y), (x = 1)) + : ((p += _), (l = A), (A += b), (x = 2)); + } + return ( + c && ((c[0] = t + l * r), (c[1] = i + l * o), (c[2] = n + l * a)), + u && (u[0] = u[1] = u[2] = 0), + 0 + ); + })( + e, + a, + s, + c, + (u /= f), + (l /= f), + (h /= f), + (n = void 0 === n ? 64 : +n), + r, + o + ); + }; + }, + function (e, t, i) { "use strict"; var n = i(496); - e.exports = function(e) { - return function(e) { - var t = e.rendering.getScene() - , i = new BABYLON.Texture("assets/textures/grass_dirt.png",t,true,false,BABYLON.Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST) - , o = (new BABYLON.Texture("assets/textures/grass.png",t,true,false), + e.exports = function (e) { + return (function (e) { + var t = e.rendering.getScene(), + i = new BABYLON.Texture( + "assets/textures/grass_dirt.png", + t, + true, + false, + BABYLON.Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST + ), + o = + (new BABYLON.Texture("assets/textures/grass.png", t, true, false), {}); - return o.debris = { - cap: 64, - g: -10, - emit: 32, - rate: 0, - tex: i, - alphas: [1, 1], - colors: [r.White(), r.White()], - sizes: [1, 1], - init: function(e) { - e.position.x = .8 * Math.random() - .4, - e.position.y = .8 * Math.random() - .4, - e.position.z = .8 * Math.random() - .4, - e.velocity.x = 4 * Math.random() - 2, - e.velocity.y = 4 * Math.random(), - e.velocity.z = 4 * Math.random() - 2, - e.size = .05 + .15 * Math.random(), - e.age = 1.5 * Math.random(), - e.lifetime = 2 - } + return ( + (o.debris = { + cap: 64, + g: -10, + emit: 32, + rate: 0, + tex: i, + alphas: [1, 1], + colors: [r.White(), r.White()], + sizes: [1, 1], + init: function (e) { + (e.position.x = 0.8 * Math.random() - 0.4), + (e.position.y = 0.8 * Math.random() - 0.4), + (e.position.z = 0.8 * Math.random() - 0.4), + (e.velocity.x = 4 * Math.random() - 2), + (e.velocity.y = 4 * Math.random()), + (e.velocity.z = 4 * Math.random() - 2), + (e.size = 0.05 + 0.15 * Math.random()), + (e.age = 1.5 * Math.random()), + (e.lifetime = 2); }, - function(i, a, s) { - var c = o[i]; - if (c) { - Math.random(), - Math.random(); - var u = new r(s,s,s) - , l = new n(c.cap,c.rate,t,u,[0, 1],[0, 1],e); - return l.gravity = c.g, - l.setAlphaRange(c.alphas[0], c.alphas[1]), - l.setColorRange(c.colors[0], c.colors[1]), - l.setSizeRange(c.sizes[0], c.sizes[1]), - l.initParticle = c.init, - l.stopOnEmpty = true, - l.setTexture(a), - c.emit && (l.emit(c.emit), - l.disposeOnEmpty = true), - e.rendering.addDynamicMesh(l.mesh), - l - } + }), + function (i, a, s) { + var c = o[i]; + if (c) { + Math.random(), Math.random(); + var u = new r(s, s, s), + l = new n(c.cap, c.rate, t, u, [0, 1], [0, 1], e); + return ( + (l.gravity = c.g), + l.setAlphaRange(c.alphas[0], c.alphas[1]), + l.setColorRange(c.colors[0], c.colors[1]), + l.setSizeRange(c.sizes[0], c.sizes[1]), + (l.initParticle = c.init), + (l.stopOnEmpty = true), + l.setTexture(a), + c.emit && (l.emit(c.emit), (l.disposeOnEmpty = true)), + e.rendering.addDynamicMesh(l.mesh), + l + ); } - }(e) - } - ; + } + ); + })(e); + }; BABYLON.Vector3; - var r = BABYLON.Color3 -} -, function(e, t) { + var r = BABYLON.Color3; + }, + function (e, t) { e.exports = a; - var i = BABYLON.Vector3 - , n = BABYLON.Color3; + var i = BABYLON.Vector3, + n = BABYLON.Color3; function r() { - this.position = i.Zero(), - this.velocity = i.Zero(), - this.size = 1, - this.age = 0, - this.lifetime = 1 + (this.position = i.Zero()), + (this.velocity = i.Zero()), + (this.size = 1), + (this.age = 0), + (this.lifetime = 1); } function o(e) { - e.position.copyFromFloats(0, 0, 0), - e.velocity.x = 5 * (Math.random() - .5), - e.velocity.y = .5 * Math.random() * 5 + 2, - e.velocity.z = 5 * (Math.random() - .5), - e.size = 1 * Math.random(), - e.age = 0, - e.lifetime = 2 + e.position.copyFromFloats(0, 0, 0), + (e.velocity.x = 5 * (Math.random() - 0.5)), + (e.velocity.y = 0.5 * Math.random() * 5 + 2), + (e.velocity.z = 5 * (Math.random() - 0.5)), + (e.size = 1 * Math.random()), + (e.age = 0), + (e.lifetime = 2); } function a(e, t, n, a, s, u, l) { - if (e || (e = 100), - isNaN(t) && (t = 0), - !n) - throw "Invalid scene passed to mesh-particle-system"; - a = a || { - r: 1, - g: 1, - b: 1, - a: 1 - }, - s = s || [0, 1], - u = u || [0, 1], - this.capacity = e, - this.rate = t, - this.mesh = new BABYLON.Mesh("MPS-mesh",n), - this.material = null, - this.texture = null, - this.gravity = -1, - this.friction = .85, - this.fps = 60, - this.disposeOnEmpty = false, - this.stopOnEmpty = false, - this.parent = null, - this.onDispose = null, - this.game = l, - this._scene = n, - this._alive = 0, - this._data = new Float32Array(e * c), - this._dummyParticle = new r, - this._color0 = new BABYLON.Color4(a.r,a.g,a.b,a.a), - this._color1 = new BABYLON.Color4(a.r,a.g,a.b,a.a), - this._updateColors = false, - this._size0 = 1, - this._size1 = 1, - this._positions = [], - this._colors = [], - this._playing = false, - this._disposed = false, - this._lastPos = i.Zero(), - this._startingThisFrame = false, - this._toEmit = 0, - this._createdOwnMaterial = false, - this._needsColorUpdate = true; - for (var h = this._positions, f = this._colors, d = [], p = [], m = (s[0], - u[1], - s[1], - u[1], - s[1], - u[0], - s[0], - u[0], - 0); m < e; m++) { - h.push(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), - d.push(4 * m, 4 * m + 1, 4 * m + 2), - d.push(4 * m, 4 * m + 2, 4 * m + 3); - var g = 1 / 16 * Math.floor(12 * Math.random()) - , _ = g + .25; - p.push(_, g, g, g, g, _, _, _); - for (var v = 0; v < 4; v++) - f.push(a.r, a.g, a.b, a.a) - } - var y = new BABYLON.VertexData; - y.positions = h, - y.indices = d, - y.uvs = p, - y.colors = f, + if ((e || (e = 100), isNaN(t) && (t = 0), !n)) + throw "Invalid scene passed to mesh-particle-system"; + (a = a || { + r: 1, + g: 1, + b: 1, + a: 1, + }), + (s = s || [0, 1]), + (u = u || [0, 1]), + (this.capacity = e), + (this.rate = t), + (this.mesh = new BABYLON.Mesh("MPS-mesh", n)), + (this.material = null), + (this.texture = null), + (this.gravity = -1), + (this.friction = 0.85), + (this.fps = 60), + (this.disposeOnEmpty = false), + (this.stopOnEmpty = false), + (this.parent = null), + (this.onDispose = null), + (this.game = l), + (this._scene = n), + (this._alive = 0), + (this._data = new Float32Array(e * c)), + (this._dummyParticle = new r()), + (this._color0 = new BABYLON.Color4(a.r, a.g, a.b, a.a)), + (this._color1 = new BABYLON.Color4(a.r, a.g, a.b, a.a)), + (this._updateColors = false), + (this._size0 = 1), + (this._size1 = 1), + (this._positions = []), + (this._colors = []), + (this._playing = false), + (this._disposed = false), + (this._lastPos = i.Zero()), + (this._startingThisFrame = false), + (this._toEmit = 0), + (this._createdOwnMaterial = false), + (this._needsColorUpdate = true); + for ( + var h = this._positions, + f = this._colors, + d = [], + p = [], + m = (s[0], u[1], s[1], u[1], s[1], u[0], s[0], u[0], 0); + m < e; + m++ + ) { + h.push(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + d.push(4 * m, 4 * m + 1, 4 * m + 2), + d.push(4 * m, 4 * m + 2, 4 * m + 3); + var g = (1 / 16) * Math.floor(12 * Math.random()), + _ = g + 0.25; + p.push(_, g, g, g, g, _, _, _); + for (var v = 0; v < 4; v++) f.push(a.r, a.g, a.b, a.a); + } + var y = new BABYLON.VertexData(); + (y.positions = h), + (y.indices = d), + (y.uvs = p), + (y.colors = f), y.applyToMesh(this.mesh, true), - this.initParticle = o; - var b = this; - this.curriedAnimate = function() { - b.animate(.001 * b._scene.getEngine().getDeltaTime()) - } + (this.initParticle = o); + var b = this; + this.curriedAnimate = function () { + b.animate(0.001 * b._scene.getEngine().getDeltaTime()); + }; } var s = a; - s.prototype.start = function() { - if (!this._playing) { - if (this._disposed) - throw new Error("Already disposed"); - this._scene.registerBeforeRender(this.curriedAnimate), - function(e) { - for (var t = e._dummyParticle, n = 0, r = new i(1 / 0,1 / 0,1 / 0), o = new i(-1 / 0,-1 / 0,-1 / 0), a = e.gravity / 2, s = 0; s < 30; ++s) { - e.initParticle(t), - l(r, o, t.position.x, t.position.y, t.position.z); - var c = t.lifetime - , u = t.position.x + c * t.velocity.x - , h = t.position.y + c * t.velocity.y + c * c * a - , f = t.position.z + c * t.velocity.z; - l(r, o, u, h, f), - n = Math.max(n, t.size) - } - r.subtractFromFloatsToRef(n, n, n, r), - o.subtractFromFloatsToRef(-n, -n, -n, o), - e.mesh._boundingInfo = new BABYLON.BoundingInfo(r,o) - }(this), - this._playing = true, - this._startingThisFrame = true - } - } - , - s.prototype.stop = function() { - this._playing && (this._scene.unregisterBeforeRender(this.curriedAnimate), - this._playing = false) - } - , - s.prototype.setTexture = function(e, t) { - t ? (this.material && this._createdOwnMaterial && this.material.dispose(false, false), - this.material = t, - this._createdOwnMaterial = false) : this.material || (this.material = new BABYLON.StandardMaterial("MPS-mat",this._scene), - this.material.specularColor = n.Black(), - this.material.emissiveColor = n.White(), - this.material.checkReadyOnlyOnce = true, - this._createdOwnMaterial = true), - this.mesh.material = this.material, - this.texture = e, - this._needsColorUpdate = true - } - , - s.prototype.setAlphaRange = function(e, t) { - this._color0.a = e, - this._color1.a = t, - this._needsColorUpdate = true - } - , - s.prototype.setColorRange = function(e, t) { - this._color0.r = e.r, - this._color0.g = e.g, - this._color0.b = e.b, - this._color1.r = t.r, - this._color1.g = t.g, - this._color1.b = t.b, - this._needsColorUpdate = true - } - , - s.prototype.setSizeRange = function(e, t) { - this._size0 = e, - this._size1 = t - } - , - s.prototype.emit = function(e) { - this.start(), - this._toEmit += e - } - , - s.prototype.dispose = function() { + (s.prototype.start = function () { + if (!this._playing) { + if (this._disposed) throw new Error("Already disposed"); + this._scene.registerBeforeRender(this.curriedAnimate), + (function (e) { + for ( + var t = e._dummyParticle, + n = 0, + r = new i(1 / 0, 1 / 0, 1 / 0), + o = new i(-1 / 0, -1 / 0, -1 / 0), + a = e.gravity / 2, + s = 0; + s < 30; + ++s + ) { + e.initParticle(t), + l(r, o, t.position.x, t.position.y, t.position.z); + var c = t.lifetime, + u = t.position.x + c * t.velocity.x, + h = t.position.y + c * t.velocity.y + c * c * a, + f = t.position.z + c * t.velocity.z; + l(r, o, u, h, f), (n = Math.max(n, t.size)); + } + r.subtractFromFloatsToRef(n, n, n, r), + o.subtractFromFloatsToRef(-n, -n, -n, o), + (e.mesh._boundingInfo = new BABYLON.BoundingInfo(r, o)); + })(this), + (this._playing = true), + (this._startingThisFrame = true); + } + }), + (s.prototype.stop = function () { + this._playing && + (this._scene.unregisterBeforeRender(this.curriedAnimate), + (this._playing = false)); + }), + (s.prototype.setTexture = function (e, t) { + t + ? (this.material && + this._createdOwnMaterial && + this.material.dispose(false, false), + (this.material = t), + (this._createdOwnMaterial = false)) + : this.material || + ((this.material = new BABYLON.StandardMaterial( + "MPS-mat", + this._scene + )), + (this.material.specularColor = n.Black()), + (this.material.emissiveColor = n.White()), + (this.material.checkReadyOnlyOnce = true), + (this._createdOwnMaterial = true)), + (this.mesh.material = this.material), + (this.texture = e), + (this._needsColorUpdate = true); + }), + (s.prototype.setAlphaRange = function (e, t) { + (this._color0.a = e), + (this._color1.a = t), + (this._needsColorUpdate = true); + }), + (s.prototype.setColorRange = function (e, t) { + (this._color0.r = e.r), + (this._color0.g = e.g), + (this._color0.b = e.b), + (this._color1.r = t.r), + (this._color1.g = t.g), + (this._color1.b = t.b), + (this._needsColorUpdate = true); + }), + (s.prototype.setSizeRange = function (e, t) { + (this._size0 = e), (this._size1 = t); + }), + (s.prototype.emit = function (e) { + this.start(), (this._toEmit += e); + }), + (s.prototype.dispose = function () { this.onDispose && this.onDispose(), - function(e) { + (function (e) { e.stop(), - e._createdOwnMaterial && (e.material.ambientTexture = null, - e.material.opacityTexture = null, - e.material.diffuseTexture = null, - e.material.dispose(false, false)); - e.material = null, - e.mesh.geometry.dispose(), - e.mesh.dispose(), - e.mesh = null, - e.texture = null, - e.curriedAnimate = null, - e.initParticle = null, - e._scene = null, - e._dummyParticle = null, - e._color0 = null, - e._color1 = null, - e._data = null, - e._positions.length = 0, - e._colors.length = 0, - e._positions = null, - e._colors = null, - e.parent = null, - e._disposed = true - }(this) - } - ; + e._createdOwnMaterial && + ((e.material.ambientTexture = null), + (e.material.opacityTexture = null), + (e.material.diffuseTexture = null), + e.material.dispose(false, false)); + (e.material = null), + e.mesh.geometry.dispose(), + e.mesh.dispose(), + (e.mesh = null), + (e.texture = null), + (e.curriedAnimate = null), + (e.initParticle = null), + (e._scene = null), + (e._dummyParticle = null), + (e._color0 = null), + (e._color1 = null), + (e._data = null), + (e._positions.length = 0), + (e._colors.length = 0), + (e._positions = null), + (e._colors = null), + (e.parent = null), + (e._disposed = true); + })(this); + }); var c = 9; function u(e, t) { - return Math.abs(e - t) < 1e-5 + return Math.abs(e - t) < 1e-5; } function l(e, t, i, n, r) { - i < e.x ? e.x = i : i > t.x && (t.x = i), - n < e.y ? e.y = n : n > t.y && (t.y = n), - r < e.z ? e.z = r : r > t.z && (t.z = r) + i < e.x ? (e.x = i) : i > t.x && (t.x = i), + n < e.y ? (e.y = n) : n > t.y && (t.y = n), + r < e.z ? (e.z = r) : r > t.z && (t.z = r); } function h(e) { - var t = e._dummyParticle; - e.initParticle(t); - var i = e._data - , n = e._alive * c; - i[n] = t.position.x, - i[n + 1] = t.position.y, - i[n + 2] = t.position.z, - i[n + 3] = t.velocity.x, - i[n + 4] = t.velocity.y, - i[n + 5] = t.velocity.z, - i[n + 6] = t.size, - i[n + 7] = t.age, - i[n + 8] = t.lifetime, - e._alive += 1 + var t = e._dummyParticle; + e.initParticle(t); + var i = e._data, + n = e._alive * c; + (i[n] = t.position.x), + (i[n + 1] = t.position.y), + (i[n + 2] = t.position.z), + (i[n + 3] = t.velocity.x), + (i[n + 4] = t.velocity.y), + (i[n + 5] = t.velocity.z), + (i[n + 6] = t.size), + (i[n + 7] = t.age), + (i[n + 8] = t.lifetime), + (e._alive += 1); } function f(e, t) { - for (var i = e._data, n = (e._alive - 1) * c, r = t * c, o = 0; o < c; ++o) - i[r + o] = i[n + o]; - e._alive -= 1 + for ( + var i = e._data, n = (e._alive - 1) * c, r = t * c, o = 0; + o < c; + ++o + ) + i[r + o] = i[n + o]; + e._alive -= 1; } function d(e) { - return 0 != e && 7 != e && 17 != e && 40 != e && 41 != e && 5 != e && 6 != e && 8 != e && 15 != e && 16 != e + return ( + 0 != e && + 7 != e && + 17 != e && + 40 != e && + 41 != e && + 5 != e && + 6 != e && + 8 != e && + 15 != e && + 16 != e + ); } - s.prototype.animate = function(e) { - this && this._needsColorUpdate && function(e) { - e._needsColorUpdate = false; - var t = e._color0 - , i = e._color1 - , r = !(u(t.a, 1) && u(t.a, i.a)) - , o = !(u(t.r, i.r) && u(t.g, i.g) && u(t.b, i.b)); - e._updateColors = r || o, - e.mesh.hasVertexAlpha = r, - e.material && (o || r ? (e.material.diffuseTexture = null, - e.material.ambientTexture = e.texture, - e.material.opacityTexture = e.texture, - e.material.diffuseColor = n.White(), - e.material.useAlphaFromDiffuseTexture = true, - e.texture && (e.texture.hasAlpha = false)) : (e.material.diffuseTexture = e.texture, - e.material.ambientTexture = null, - e.material.opacityTexture = null, - e.material.diffuseColor = new n(t.r,t.g,t.b), - e.material.useAlphaFromDiffuseTexture = false, - e.texture && (e.texture.hasAlpha = true))) - }(this), - e > .1 && (e = .1), - function(e) { - if (e.parent) { - var t = e.parent.absolutePosition; - e._startingThisFrame && (t = e.parent.getAbsolutePosition(), - e._startingThisFrame = false), - e.mesh.position.copyFrom(t) + s.prototype.animate = function (e) { + this && + this._needsColorUpdate && + (function (e) { + e._needsColorUpdate = false; + var t = e._color0, + i = e._color1, + r = !(u(t.a, 1) && u(t.a, i.a)), + o = !(u(t.r, i.r) && u(t.g, i.g) && u(t.b, i.b)); + (e._updateColors = r || o), + (e.mesh.hasVertexAlpha = r), + e.material && + (o || r + ? ((e.material.diffuseTexture = null), + (e.material.ambientTexture = e.texture), + (e.material.opacityTexture = e.texture), + (e.material.diffuseColor = n.White()), + (e.material.useAlphaFromDiffuseTexture = true), + e.texture && (e.texture.hasAlpha = false)) + : ((e.material.diffuseTexture = e.texture), + (e.material.ambientTexture = null), + (e.material.opacityTexture = null), + (e.material.diffuseColor = new n(t.r, t.g, t.b)), + (e.material.useAlphaFromDiffuseTexture = false), + e.texture && (e.texture.hasAlpha = true))); + })(this), + e > 0.1 && (e = 0.1), + (function (e) { + if (e.parent) { + var t = e.parent.absolutePosition; + e._startingThisFrame && + ((t = e.parent.getAbsolutePosition()), + (e._startingThisFrame = false)), + e.mesh.position.copyFrom(t); + } + var i = e.mesh.position.x - e._lastPos.x, + n = e.mesh.position.y - e._lastPos.y, + r = e.mesh.position.z - e._lastPos.z; + if ( + (e._lastPos.copyFrom(e.mesh.position), + Math.abs(i) + Math.abs(n) + Math.abs(r) < 0.001) + ) + return; + for (var o = e._alive, a = e._data, s = 0; s < o; s++) { + var u = s * c; + (a[u] -= i), (a[u + 1] -= n), (a[u + 2] -= r); + } + })(this), + (function (e, t) { + e._toEmit += t; + var i = Math.floor(e._toEmit); + e._toEmit -= i; + var n = e._alive + i; + n > e.capacity && (n = e.capacity); + for (; e._alive < n; ) h(e); + })(this, this.rate * e), + (function (e, t) { + for ( + var i = e.gravity * t, + n = e._data, + r = e.friction, + o = 0, + a = e.mesh.position, + s = 0; + s < e._alive; + ++s + ) { + (n[o + 4] += i), + (n[o] += n[o + 3] * t), + (n[o + 1] += n[o + 4] * t), + (n[o + 2] += n[o + 5] * t); + var u = a.x + n[o], + l = a.y + n[o + 1], + h = a.z + n[o + 2], + p = 0.5 * n[o + 6]; + if (n[o + 4] > 0) { + var m = e.game.world.getBlockID( + Math.floor(u), + Math.floor(l + p), + Math.floor(h) + ); + d(m) && ((n[o + 1] -= n[o + 4] * t), (n[o + 4] = 0)); } - var i = e.mesh.position.x - e._lastPos.x - , n = e.mesh.position.y - e._lastPos.y - , r = e.mesh.position.z - e._lastPos.z; - if (e._lastPos.copyFrom(e.mesh.position), - Math.abs(i) + Math.abs(n) + Math.abs(r) < .001) - return; - for (var o = e._alive, a = e._data, s = 0; s < o; s++) { - var u = s * c; - a[u] -= i, - a[u + 1] -= n, - a[u + 2] -= r + if (n[o + 4] < 0) { + var m = e.game.world.getBlockID( + Math.floor(u), + Math.floor(l - p), + Math.floor(h) + ); + d(m) && ((n[o + 1] -= n[o + 4] * t), (n[o + 4] = 0)); } - }(this), - function(e, t) { - e._toEmit += t; - var i = Math.floor(e._toEmit); - e._toEmit -= i; - var n = e._alive + i; - n > e.capacity && (n = e.capacity); - for (; e._alive < n; ) - h(e) - }(this, this.rate * e), - function(e, t) { - for (var i = e.gravity * t, n = e._data, r = e.friction, o = 0, a = e.mesh.position, s = 0; s < e._alive; ++s) { - n[o + 4] += i, - n[o] += n[o + 3] * t, - n[o + 1] += n[o + 4] * t, - n[o + 2] += n[o + 5] * t; - var u = a.x + n[o] - , l = a.y + n[o + 1] - , h = a.z + n[o + 2] - , p = .5 * n[o + 6]; - if (n[o + 4] > 0) { - var m = e.game.world.getBlockID(Math.floor(u), Math.floor(l + p), Math.floor(h)); - d(m) && (n[o + 1] -= n[o + 4] * t, - n[o + 4] = 0) - } - if (n[o + 4] < 0) { - var m = e.game.world.getBlockID(Math.floor(u), Math.floor(l - p), Math.floor(h)); - d(m) && (n[o + 1] -= n[o + 4] * t, - n[o + 4] = 0) - } - if (n[o + 3] > 0) { - var m = e.game.world.getBlockID(Math.floor(u + p), Math.floor(l), Math.floor(h)); - d(m) && (n[o + 0] -= n[o + 3] * t, - n[o + 3] = 0) - } - if (n[o + 3] < 0) { - var m = e.game.world.getBlockID(Math.floor(u - p), Math.floor(l), Math.floor(h)); - d(m) && (n[o + 0] -= n[o + 3] * t, - n[o + 3] = 0) - } - if (n[o + 5] > 0) { - var m = e.game.world.getBlockID(Math.floor(u), Math.floor(l), Math.floor(h + p)); - d(m) && (n[o + 2] -= n[o + 5] * t, - n[o + 5] = 0) - } - if (n[o + 5] < 0) { - var m = e.game.world.getBlockID(Math.floor(u), Math.floor(l), Math.floor(h - p)); - d(m) && (n[o + 2] -= n[o + 5] * t, - n[o + 5] = 0) - } - 0 == n[o + 4] && (n[o + 3] *= r, - n[o + 4] *= r, - n[o + 5] *= r); - var g = n[o + 7] + t; - g > n[o + 8] ? (f(e, s), - s--) : (n[o + 7] = g, - o += c) + if (n[o + 3] > 0) { + var m = e.game.world.getBlockID( + Math.floor(u + p), + Math.floor(l), + Math.floor(h) + ); + d(m) && ((n[o + 0] -= n[o + 3] * t), (n[o + 3] = 0)); } - }(this, e), - function(e) { - var t = e._positions - , n = e._data - , r = e._scene.activeCamera - , o = BABYLON.Matrix.Identity(); - BABYLON.Matrix.LookAtLHToRef(r.globalPosition, e.mesh.position, i.Up(), o), - o.m[12] = o.m[13] = o.m[14] = 0, + if (n[o + 3] < 0) { + var m = e.game.world.getBlockID( + Math.floor(u - p), + Math.floor(l), + Math.floor(h) + ); + d(m) && ((n[o + 0] -= n[o + 3] * t), (n[o + 3] = 0)); + } + if (n[o + 5] > 0) { + var m = e.game.world.getBlockID( + Math.floor(u), + Math.floor(l), + Math.floor(h + p) + ); + d(m) && ((n[o + 2] -= n[o + 5] * t), (n[o + 5] = 0)); + } + if (n[o + 5] < 0) { + var m = e.game.world.getBlockID( + Math.floor(u), + Math.floor(l), + Math.floor(h - p) + ); + d(m) && ((n[o + 2] -= n[o + 5] * t), (n[o + 5] = 0)); + } + 0 == n[o + 4] && + ((n[o + 3] *= r), (n[o + 4] *= r), (n[o + 5] *= r)); + var g = n[o + 7] + t; + g > n[o + 8] ? (f(e, s), s--) : ((n[o + 7] = g), (o += c)); + } + })(this, e), + (function (e) { + var t = e._positions, + n = e._data, + r = e._scene.activeCamera, + o = BABYLON.Matrix.Identity(); + BABYLON.Matrix.LookAtLHToRef( + r.globalPosition, + e.mesh.position, + i.Up(), + o + ), + (o.m[12] = o.m[13] = o.m[14] = 0), o.invert(); - for (var a = o.m, s = e._alive, u = e._size0, l = e._size1 - u, h = 0; h < s; h++) - for (var f = h * c, d = n[f + 7] / n[f + 8], p = n[f + 6] * (u + l * d) / 2, m = 12 * h, g = 0; g < 4; g++) { - var _ = 1 === g || 2 === g ? p : -p - , v = g > 1 ? p : -p - , y = _ * a[3] + v * a[7] + a[15]; - t[m] = n[f] + (_ * a[0] + v * a[4]) / y, - t[m + 1] = n[f + 1] + (_ * a[1] + v * a[5]) / y, - t[m + 2] = n[f + 2] + (_ * a[2] + v * a[6]) / y, - m += 3 - } - e.mesh.updateVerticesData(BABYLON.VertexBuffer.PositionKind, t, false, false) - }(this), - this._updateColors && function(e) { - for (var t = e._alive, i = e._data, n = e._colors, r = e._color0.r, o = e._color0.g, a = e._color0.b, s = e._color0.a, u = e._color1.r - r, l = e._color1.g - o, h = e._color1.b - a, f = e._color1.a - s, d = 0; d < t; d++) - for (var p = d * c, m = i[p + 7] / i[p + 8], g = r + u * m, _ = o + l * m, v = a + h * m, y = s + f * m, b = 16 * d, E = 0; E < 4; E++) - n[b] = g, - n[b + 1] = _, - n[b + 2] = v, - n[b + 3] = y, - b += 4; - e.mesh.updateVerticesData(BABYLON.VertexBuffer.ColorKind, n, false, false) - }(this), - this.mesh.subMeshes[0].indexCount = 6 * this._alive, - 0 === this._alive && 0 === this.rate && (this.disposeOnEmpty ? this.dispose() : this.stopOnEmpty && this.stop()) - } -} -, function(e, t, i) { + for ( + var a = o.m, s = e._alive, u = e._size0, l = e._size1 - u, h = 0; + h < s; + h++ + ) + for ( + var f = h * c, + d = n[f + 7] / n[f + 8], + p = (n[f + 6] * (u + l * d)) / 2, + m = 12 * h, + g = 0; + g < 4; + g++ + ) { + var _ = 1 === g || 2 === g ? p : -p, + v = g > 1 ? p : -p, + y = _ * a[3] + v * a[7] + a[15]; + (t[m] = n[f] + (_ * a[0] + v * a[4]) / y), + (t[m + 1] = n[f + 1] + (_ * a[1] + v * a[5]) / y), + (t[m + 2] = n[f + 2] + (_ * a[2] + v * a[6]) / y), + (m += 3); + } + e.mesh.updateVerticesData( + BABYLON.VertexBuffer.PositionKind, + t, + false, + false + ); + })(this), + this._updateColors && + (function (e) { + for ( + var t = e._alive, + i = e._data, + n = e._colors, + r = e._color0.r, + o = e._color0.g, + a = e._color0.b, + s = e._color0.a, + u = e._color1.r - r, + l = e._color1.g - o, + h = e._color1.b - a, + f = e._color1.a - s, + d = 0; + d < t; + d++ + ) + for ( + var p = d * c, + m = i[p + 7] / i[p + 8], + g = r + u * m, + _ = o + l * m, + v = a + h * m, + y = s + f * m, + b = 16 * d, + E = 0; + E < 4; + E++ + ) + (n[b] = g), + (n[b + 1] = _), + (n[b + 2] = v), + (n[b + 3] = y), + (b += 4); + e.mesh.updateVerticesData( + BABYLON.VertexBuffer.ColorKind, + n, + false, + false + ); + })(this), + (this.mesh.subMeshes[0].indexCount = 6 * this._alive), + 0 === this._alive && + 0 === this.rate && + (this.disposeOnEmpty + ? this.dispose() + : this.stopOnEmpty && this.stop()); + }; + }, + function (e, t, i) { "use strict"; - var n = i(498) - , r = n.Howl; + var n = i(498), + r = n.Howl; n.Howler; - e.exports = function() { - return function() { - for (var e = "assets/sounds/", t = ["grass1", "grass2", "grass3", "grass4", "gravel1", "gravel2", "gravel3", "gravel4", "stone1", "stone2", "stone3", "stone4", "wood1", "wood2", "wood3", "wood4", "calm1", "calm2", "calm3"], i = null, n = { - grass: { - file: "grass", - volume: .6, - pitch: 1 - }, - cloth: { - file: "grass", - volume: .7, - pitch: 1.2 - }, - gravel: { - file: "gravel", - volume: 1, - pitch: 1 - }, - stone: { - file: "stone", - volume: 1, - pitch: 1 - }, - metal: { - file: "stone", - volume: 1, - pitch: 2 - }, - wood: { - file: "wood", - volume: 1, - pitch: 1 - } - }, o = {}, a = 0; a < t.length; a++) { - var s = new r({ - src: [e + t[a] + ".mp3", e + t[a] + ".ogg"] - }); - o[t[a]] = s - } - var c = false - , u = { - musicOn: true, - soundOn: true, - startMusic: function() { - var e = 3e5 + 9e5 * Math.random(); - c || (e = 6e4 * Math.random()), - c = true, - setTimeout(function() { - var e = Math.floor(3 * Math.random()) + 1 - , t = (i = o["calm" + e]).play() - , n = 1; - u.musicOn || (n = 0), - i.volume(n, t), - i.on("end", function() { - u.startMusic() - }) - }, e) - }, - setMusicVolume: function(e) { - null != i && i.volume(e) - }, - play: function(e, t, i) { - if (u.soundOn) { - var r = Math.floor(4 * Math.random()) + 1 - , a = n[e] - , s = o[a.file + r] - , c = s.play() - , l = t / (.4 * Math.random() + 1) * .5; - s.volume(l, c); - var h = i / (.2 * Math.random() + .9); - s.rate(h, c) - } - } - }; - return u.startMusic(), - u - }() - } -} -, function(e, t, i) { - (function(i, n) { - var r; - function o(e) { - return (o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + e.exports = function () { + return (function () { + for ( + var e = "assets/sounds/", + t = [ + "grass1", + "grass2", + "grass3", + "grass4", + "gravel1", + "gravel2", + "gravel3", + "gravel4", + "stone1", + "stone2", + "stone3", + "stone4", + "wood1", + "wood2", + "wood3", + "wood4", + "calm1", + "calm2", + "calm3", + ], + i = null, + n = { + grass: { + file: "grass", + volume: 0.6, + pitch: 1, + }, + cloth: { + file: "grass", + volume: 0.7, + pitch: 1.2, + }, + gravel: { + file: "gravel", + volume: 1, + pitch: 1, + }, + stone: { + file: "stone", + volume: 1, + pitch: 1, + }, + metal: { + file: "stone", + volume: 1, + pitch: 2, + }, + wood: { + file: "wood", + volume: 1, + pitch: 1, + }, + }, + o = {}, + a = 0; + a < t.length; + a++ + ) { + var s = new r({ + src: [e + t[a] + ".mp3", e + t[a] + ".ogg"], + }); + o[t[a]] = s; } - /*! - * howler.js v2.0.15 - * howlerjs.com - * - * (c) 2013-2018, James Simpson of GoldFire Studios - * goldfirestudios.com - * - * MIT License - */ - /*! - * howler.js v2.0.15 - * howlerjs.com - * - * (c) 2013-2018, James Simpson of GoldFire Studios - * goldfirestudios.com - * - * MIT License - */ - !function() { - "use strict"; - var o = function() { - this.init() - }; - o.prototype = { - init: function() { - var e = this || a; - return e._counter = 1e3, - e._codecs = {}, - e._howls = [], - e._muted = false, - e._volume = 1, - e._canPlayEvent = "canplaythrough", - e._navigator = "undefined" != typeof window && window.navigator ? window.navigator : null, - e.masterGain = null, - e.noAudio = false, - e.usingWebAudio = true, - e.autoSuspend = true, - e.ctx = null, - e.mobileAutoEnable = true, - e._setup(), - e - }, - volume: function(e) { - var t = this || a; - if (e = parseFloat(e), - t.ctx || p(), - void 0 !== e && e >= 0 && e <= 1) { - if (t._volume = e, - t._muted) - return t; - t.usingWebAudio && t.masterGain.gain.setValueAtTime(e, a.ctx.currentTime); - for (var i = 0; i < t._howls.length; i++) - if (!t._howls[i]._webAudio) - for (var n = t._howls[i]._getSoundIds(), r = 0; r < n.length; r++) { - var o = t._howls[i]._soundById(n[r]); - o && o._node && (o._node.volume = o._volume * e) - } - return t - } - return t._volume - }, - mute: function(e) { - var t = this || a; - t.ctx || p(), - t._muted = e, - t.usingWebAudio && t.masterGain.gain.setValueAtTime(e ? 0 : t._volume, a.ctx.currentTime); - for (var i = 0; i < t._howls.length; i++) - if (!t._howls[i]._webAudio) - for (var n = t._howls[i]._getSoundIds(), r = 0; r < n.length; r++) { - var o = t._howls[i]._soundById(n[r]); - o && o._node && (o._node.muted = !!e || o._muted) - } - return t - }, - unload: function() { - for (var e = this || a, t = e._howls.length - 1; t >= 0; t--) - e._howls[t].unload(); - return e.usingWebAudio && e.ctx && void 0 !== e.ctx.close && (e.ctx.close(), - e.ctx = null, - p()), - e - }, - codecs: function(e) { - return (this || a)._codecs[e.replace(/^x-/, "")] - }, - _setup: function() { - var e = this || a; - if (e.state = e.ctx && e.ctx.state || "running", - e._autoSuspend(), - !e.usingWebAudio) - if ("undefined" != typeof Audio) - try { - void 0 === (new Audio).oncanplaythrough && (e._canPlayEvent = "canplay") - } catch (t) { - e.noAudio = true - } - else - e.noAudio = true; - try { - (new Audio).muted && (e.noAudio = true) - } catch (e) {} - return e.noAudio || e._setupCodecs(), - e - }, - _setupCodecs: function() { - var e = this || a - , t = null; - try { - t = "undefined" != typeof Audio ? new Audio : null - } catch (t) { - return e - } - if (!t || "function" != typeof t.canPlayType) - return e; - var i = t.canPlayType("audio/mpeg;").replace(/^no$/, "") - , n = e._navigator && e._navigator.userAgent.match(/OPR\/([0-6].)/g) - , r = n && parseInt(n[0].split("/")[1], 10) < 33; - return e._codecs = { - mp3: !(r || !i && !t.canPlayType("audio/mp3;").replace(/^no$/, "")), - mpeg: !!i, - opus: !!t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""), - ogg: !!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), - oga: !!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), - wav: !!t.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""), - aac: !!t.canPlayType("audio/aac;").replace(/^no$/, ""), - caf: !!t.canPlayType("audio/x-caf;").replace(/^no$/, ""), - m4a: !!(t.canPlayType("audio/x-m4a;") || t.canPlayType("audio/m4a;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""), - mp4: !!(t.canPlayType("audio/x-mp4;") || t.canPlayType("audio/mp4;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""), - weba: !!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), - webm: !!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), - dolby: !!t.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""), - flac: !!(t.canPlayType("audio/x-flac;") || t.canPlayType("audio/flac;")).replace(/^no$/, "") - }, - e - }, - _enableMobileAudio: function() { - var e = this || a - , t = /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi|Chrome/i.test(e._navigator && e._navigator.userAgent); - if (!e._mobileEnabled && e.ctx && t) { - e._mobileEnabled = false, - e.mobileAutoEnable = false, - e._mobileUnloaded || 44100 === e.ctx.sampleRate || (e._mobileUnloaded = true, - e.unload()), - e._scratchBuffer = e.ctx.createBuffer(1, 1, 22050); - var i = function t(i) { - a._autoResume(); - var n = e.ctx.createBufferSource(); - n.buffer = e._scratchBuffer, - n.connect(e.ctx.destination), - void 0 === n.start ? n.noteOn(0) : n.start(0), - "function" == typeof e.ctx.resume && e.ctx.resume(), - n.onended = function() { - n.disconnect(0), - e._mobileEnabled = true, - document.removeEventListener("touchstart", t, true), - document.removeEventListener("touchend", t, true), - document.removeEventListener("click", t, true); - for (var i = 0; i < e._howls.length; i++) - e._howls[i]._emit("unlock") - } - }; - return document.addEventListener("touchstart", i, true), - document.addEventListener("touchend", i, true), - document.addEventListener("click", i, true), - e - } - }, - _autoSuspend: function() { - var e = this; - if (e.autoSuspend && e.ctx && void 0 !== e.ctx.suspend && a.usingWebAudio) { - for (var t = 0; t < e._howls.length; t++) - if (e._howls[t]._webAudio) - for (var i = 0; i < e._howls[t]._sounds.length; i++) - if (!e._howls[t]._sounds[i]._paused) - return e; - return e._suspendTimer && clearTimeout(e._suspendTimer), - e._suspendTimer = setTimeout(function() { - e.autoSuspend && (e._suspendTimer = null, - e.state = "suspending", - e.ctx.suspend().then(function() { - e.state = "suspended", - e._resumeAfterSuspend && (delete e._resumeAfterSuspend, - e._autoResume()) - })) - }, 3e4), - e - } - }, - _autoResume: function() { - var e = this; - if (e.ctx && void 0 !== e.ctx.resume && a.usingWebAudio) - return "running" === e.state && e._suspendTimer ? (clearTimeout(e._suspendTimer), - e._suspendTimer = null) : "suspended" === e.state ? (e.ctx.resume().then(function() { - e.state = "running"; - for (var t = 0; t < e._howls.length; t++) - e._howls[t]._emit("resume") - }), - e._suspendTimer && (clearTimeout(e._suspendTimer), - e._suspendTimer = null)) : "suspending" === e.state && (e._resumeAfterSuspend = true), - e + var c = false, + u = { + musicOn: true, + soundOn: true, + startMusic: function () { + var e = 3e5 + 9e5 * Math.random(); + c || (e = 6e4 * Math.random()), + (c = true), + setTimeout(function () { + var e = Math.floor(3 * Math.random()) + 1, + t = (i = o["calm" + e]).play(), + n = 1; + u.musicOn || (n = 0), + i.volume(n, t), + i.on("end", function () { + u.startMusic(); + }); + }, e); + }, + setMusicVolume: function (e) { + null != i && i.volume(e); + }, + play: function (e, t, i) { + if (u.soundOn) { + var r = Math.floor(4 * Math.random()) + 1, + a = n[e], + s = o[a.file + r], + c = s.play(), + l = (t / (0.4 * Math.random() + 1)) * 0.5; + s.volume(l, c); + var h = i / (0.2 * Math.random() + 0.9); + s.rate(h, c); + } + }, + }; + return u.startMusic(), u; + })(); + }; + }, + function (e, t, i) { + (function (i, n) { + var r; + function o(e) { + return (o = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); + } + /*! + * howler.js v2.0.15 + * howlerjs.com + * + * (c) 2013-2018, James Simpson of GoldFire Studios + * goldfirestudios.com + * + * MIT License + */ + /*! + * howler.js v2.0.15 + * howlerjs.com + * + * (c) 2013-2018, James Simpson of GoldFire Studios + * goldfirestudios.com + * + * MIT License + */ + !(function () { + "use strict"; + var o = function () { + this.init(); + }; + o.prototype = { + init: function () { + var e = this || a; + return ( + (e._counter = 1e3), + (e._codecs = {}), + (e._howls = []), + (e._muted = false), + (e._volume = 1), + (e._canPlayEvent = "canplaythrough"), + (e._navigator = + "undefined" != typeof window && window.navigator + ? window.navigator + : null), + (e.masterGain = null), + (e.noAudio = false), + (e.usingWebAudio = true), + (e.autoSuspend = true), + (e.ctx = null), + (e.mobileAutoEnable = true), + e._setup(), + e + ); + }, + volume: function (e) { + var t = this || a; + if ( + ((e = parseFloat(e)), + t.ctx || p(), + void 0 !== e && e >= 0 && e <= 1) + ) { + if (((t._volume = e), t._muted)) return t; + t.usingWebAudio && + t.masterGain.gain.setValueAtTime(e, a.ctx.currentTime); + for (var i = 0; i < t._howls.length; i++) + if (!t._howls[i]._webAudio) + for ( + var n = t._howls[i]._getSoundIds(), r = 0; + r < n.length; + r++ + ) { + var o = t._howls[i]._soundById(n[r]); + o && o._node && (o._node.volume = o._volume * e); + } + return t; + } + return t._volume; + }, + mute: function (e) { + var t = this || a; + t.ctx || p(), + (t._muted = e), + t.usingWebAudio && + t.masterGain.gain.setValueAtTime( + e ? 0 : t._volume, + a.ctx.currentTime + ); + for (var i = 0; i < t._howls.length; i++) + if (!t._howls[i]._webAudio) + for ( + var n = t._howls[i]._getSoundIds(), r = 0; + r < n.length; + r++ + ) { + var o = t._howls[i]._soundById(n[r]); + o && o._node && (o._node.muted = !!e || o._muted); } - }; - var a = new o - , s = function(e) { - e.src && 0 !== e.src.length ? this.init(e) : console.error("An array of source files must be passed with any new Howl.") - }; - s.prototype = { - init: function(e) { - var t = this; - return a.ctx || p(), - t._autoplay = e.autoplay || false, - t._format = "string" != typeof e.format ? e.format : [e.format], - t._html5 = e.html5 || false, - t._muted = e.mute || false, - t._loop = e.loop || false, - t._pool = e.pool || 5, - t._preload = "boolean" != typeof e.preload || e.preload, - t._rate = e.rate || 1, - t._sprite = e.sprite || {}, - t._src = "string" != typeof e.src ? e.src : [e.src], - t._volume = void 0 !== e.volume ? e.volume : 1, - t._xhrWithCredentials = e.xhrWithCredentials || false, - t._duration = 0, - t._state = "unloaded", - t._sounds = [], - t._endTimers = {}, - t._queue = [], - t._playLock = false, - t._onend = e.onend ? [{ - fn: e.onend - }] : [], - t._onfade = e.onfade ? [{ - fn: e.onfade - }] : [], - t._onload = e.onload ? [{ - fn: e.onload - }] : [], - t._onloaderror = e.onloaderror ? [{ - fn: e.onloaderror - }] : [], - t._onplayerror = e.onplayerror ? [{ - fn: e.onplayerror - }] : [], - t._onpause = e.onpause ? [{ - fn: e.onpause - }] : [], - t._onplay = e.onplay ? [{ - fn: e.onplay - }] : [], - t._onstop = e.onstop ? [{ - fn: e.onstop - }] : [], - t._onmute = e.onmute ? [{ - fn: e.onmute - }] : [], - t._onvolume = e.onvolume ? [{ - fn: e.onvolume - }] : [], - t._onrate = e.onrate ? [{ - fn: e.onrate - }] : [], - t._onseek = e.onseek ? [{ - fn: e.onseek - }] : [], - t._onunlock = e.onunlock ? [{ - fn: e.onunlock - }] : [], - t._onresume = [], - t._webAudio = a.usingWebAudio && !t._html5, - void 0 !== a.ctx && a.ctx && a.mobileAutoEnable && a._enableMobileAudio(), - a._howls.push(t), - t._autoplay && t._queue.push({ - event: "play", - action: function() { - t.play() - } + return t; + }, + unload: function () { + for (var e = this || a, t = e._howls.length - 1; t >= 0; t--) + e._howls[t].unload(); + return ( + e.usingWebAudio && + e.ctx && + void 0 !== e.ctx.close && + (e.ctx.close(), (e.ctx = null), p()), + e + ); + }, + codecs: function (e) { + return (this || a)._codecs[e.replace(/^x-/, "")]; + }, + _setup: function () { + var e = this || a; + if ( + ((e.state = (e.ctx && e.ctx.state) || "running"), + e._autoSuspend(), + !e.usingWebAudio) + ) + if ("undefined" != typeof Audio) + try { + void 0 === new Audio().oncanplaythrough && + (e._canPlayEvent = "canplay"); + } catch (t) { + e.noAudio = true; + } + else e.noAudio = true; + try { + new Audio().muted && (e.noAudio = true); + } catch (e) {} + return e.noAudio || e._setupCodecs(), e; + }, + _setupCodecs: function () { + var e = this || a, + t = null; + try { + t = "undefined" != typeof Audio ? new Audio() : null; + } catch (t) { + return e; + } + if (!t || "function" != typeof t.canPlayType) return e; + var i = t.canPlayType("audio/mpeg;").replace(/^no$/, ""), + n = + e._navigator && e._navigator.userAgent.match(/OPR\/([0-6].)/g), + r = n && parseInt(n[0].split("/")[1], 10) < 33; + return ( + (e._codecs = { + mp3: !( + r || + (!i && !t.canPlayType("audio/mp3;").replace(/^no$/, "")) + ), + mpeg: !!i, + opus: !!t + .canPlayType('audio/ogg; codecs="opus"') + .replace(/^no$/, ""), + ogg: !!t + .canPlayType('audio/ogg; codecs="vorbis"') + .replace(/^no$/, ""), + oga: !!t + .canPlayType('audio/ogg; codecs="vorbis"') + .replace(/^no$/, ""), + wav: !!t + .canPlayType('audio/wav; codecs="1"') + .replace(/^no$/, ""), + aac: !!t.canPlayType("audio/aac;").replace(/^no$/, ""), + caf: !!t.canPlayType("audio/x-caf;").replace(/^no$/, ""), + m4a: !!( + t.canPlayType("audio/x-m4a;") || + t.canPlayType("audio/m4a;") || + t.canPlayType("audio/aac;") + ).replace(/^no$/, ""), + mp4: !!( + t.canPlayType("audio/x-mp4;") || + t.canPlayType("audio/mp4;") || + t.canPlayType("audio/aac;") + ).replace(/^no$/, ""), + weba: !!t + .canPlayType('audio/webm; codecs="vorbis"') + .replace(/^no$/, ""), + webm: !!t + .canPlayType('audio/webm; codecs="vorbis"') + .replace(/^no$/, ""), + dolby: !!t + .canPlayType('audio/mp4; codecs="ec-3"') + .replace(/^no$/, ""), + flac: !!( + t.canPlayType("audio/x-flac;") || t.canPlayType("audio/flac;") + ).replace(/^no$/, ""), + }), + e + ); + }, + _enableMobileAudio: function () { + var e = this || a, + t = + /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi|Chrome/i.test( + e._navigator && e._navigator.userAgent + ); + if (!e._mobileEnabled && e.ctx && t) { + (e._mobileEnabled = false), + (e.mobileAutoEnable = false), + e._mobileUnloaded || + 44100 === e.ctx.sampleRate || + ((e._mobileUnloaded = true), e.unload()), + (e._scratchBuffer = e.ctx.createBuffer(1, 1, 22050)); + var i = function t(i) { + a._autoResume(); + var n = e.ctx.createBufferSource(); + (n.buffer = e._scratchBuffer), + n.connect(e.ctx.destination), + void 0 === n.start ? n.noteOn(0) : n.start(0), + "function" == typeof e.ctx.resume && e.ctx.resume(), + (n.onended = function () { + n.disconnect(0), + (e._mobileEnabled = true), + document.removeEventListener("touchstart", t, true), + document.removeEventListener("touchend", t, true), + document.removeEventListener("click", t, true); + for (var i = 0; i < e._howls.length; i++) + e._howls[i]._emit("unlock"); + }); + }; + return ( + document.addEventListener("touchstart", i, true), + document.addEventListener("touchend", i, true), + document.addEventListener("click", i, true), + e + ); + } + }, + _autoSuspend: function () { + var e = this; + if ( + e.autoSuspend && + e.ctx && + void 0 !== e.ctx.suspend && + a.usingWebAudio + ) { + for (var t = 0; t < e._howls.length; t++) + if (e._howls[t]._webAudio) + for (var i = 0; i < e._howls[t]._sounds.length; i++) + if (!e._howls[t]._sounds[i]._paused) return e; + return ( + e._suspendTimer && clearTimeout(e._suspendTimer), + (e._suspendTimer = setTimeout(function () { + e.autoSuspend && + ((e._suspendTimer = null), + (e.state = "suspending"), + e.ctx.suspend().then(function () { + (e.state = "suspended"), + e._resumeAfterSuspend && + (delete e._resumeAfterSuspend, e._autoResume()); + })); + }, 3e4)), + e + ); + } + }, + _autoResume: function () { + var e = this; + if (e.ctx && void 0 !== e.ctx.resume && a.usingWebAudio) + return ( + "running" === e.state && e._suspendTimer + ? (clearTimeout(e._suspendTimer), (e._suspendTimer = null)) + : "suspended" === e.state + ? (e.ctx.resume().then(function () { + e.state = "running"; + for (var t = 0; t < e._howls.length; t++) + e._howls[t]._emit("resume"); }), - t._preload && t.load(), - t - }, - load: function() { - var e = null; - if (a.noAudio) - this._emit("loaderror", null, "No audio support."); - else { - "string" == typeof this._src && (this._src = [this._src]); - for (var t = 0; t < this._src.length; t++) { - var i, n; - if (this._format && this._format[t]) - i = this._format[t]; - else { - if ("string" != typeof (n = this._src[t])) { - this._emit("loaderror", null, "Non-string found in selected audio sources - ignoring."); - continue - } - (i = /^data:audio\/([^;,]+);/i.exec(n)) || (i = /\.([^.]+)$/.exec(n.split("?", 1)[0])), - i && (i = i[1].toLowerCase()) - } - if (i || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'), - i && a.codecs(i)) { - e = this._src[t]; - break - } - } - if (e) - return this._src = e, - this._state = "loading", - "https:" === window.location.protocol && "http:" === e.slice(0, 5) && (this._html5 = true, - this._webAudio = false), - new c(this), - this._webAudio && l(this), - this; - this._emit("loaderror", null, "No codec support for selected audio sources.") + e._suspendTimer && + (clearTimeout(e._suspendTimer), (e._suspendTimer = null))) + : "suspending" === e.state && (e._resumeAfterSuspend = true), + e + ); + }, + }; + var a = new o(), + s = function (e) { + e.src && 0 !== e.src.length + ? this.init(e) + : console.error( + "An array of source files must be passed with any new Howl." + ); + }; + s.prototype = { + init: function (e) { + var t = this; + return ( + a.ctx || p(), + (t._autoplay = e.autoplay || false), + (t._format = "string" != typeof e.format ? e.format : [e.format]), + (t._html5 = e.html5 || false), + (t._muted = e.mute || false), + (t._loop = e.loop || false), + (t._pool = e.pool || 5), + (t._preload = "boolean" != typeof e.preload || e.preload), + (t._rate = e.rate || 1), + (t._sprite = e.sprite || {}), + (t._src = "string" != typeof e.src ? e.src : [e.src]), + (t._volume = void 0 !== e.volume ? e.volume : 1), + (t._xhrWithCredentials = e.xhrWithCredentials || false), + (t._duration = 0), + (t._state = "unloaded"), + (t._sounds = []), + (t._endTimers = {}), + (t._queue = []), + (t._playLock = false), + (t._onend = e.onend + ? [ + { + fn: e.onend, + }, + ] + : []), + (t._onfade = e.onfade + ? [ + { + fn: e.onfade, + }, + ] + : []), + (t._onload = e.onload + ? [ + { + fn: e.onload, + }, + ] + : []), + (t._onloaderror = e.onloaderror + ? [ + { + fn: e.onloaderror, + }, + ] + : []), + (t._onplayerror = e.onplayerror + ? [ + { + fn: e.onplayerror, + }, + ] + : []), + (t._onpause = e.onpause + ? [ + { + fn: e.onpause, + }, + ] + : []), + (t._onplay = e.onplay + ? [ + { + fn: e.onplay, + }, + ] + : []), + (t._onstop = e.onstop + ? [ + { + fn: e.onstop, + }, + ] + : []), + (t._onmute = e.onmute + ? [ + { + fn: e.onmute, + }, + ] + : []), + (t._onvolume = e.onvolume + ? [ + { + fn: e.onvolume, + }, + ] + : []), + (t._onrate = e.onrate + ? [ + { + fn: e.onrate, + }, + ] + : []), + (t._onseek = e.onseek + ? [ + { + fn: e.onseek, + }, + ] + : []), + (t._onunlock = e.onunlock + ? [ + { + fn: e.onunlock, + }, + ] + : []), + (t._onresume = []), + (t._webAudio = a.usingWebAudio && !t._html5), + void 0 !== a.ctx && + a.ctx && + a.mobileAutoEnable && + a._enableMobileAudio(), + a._howls.push(t), + t._autoplay && + t._queue.push({ + event: "play", + action: function () { + t.play(); + }, + }), + t._preload && t.load(), + t + ); + }, + load: function () { + var e = null; + if (a.noAudio) this._emit("loaderror", null, "No audio support."); + else { + "string" == typeof this._src && (this._src = [this._src]); + for (var t = 0; t < this._src.length; t++) { + var i, n; + if (this._format && this._format[t]) i = this._format[t]; + else { + if ("string" != typeof (n = this._src[t])) { + this._emit( + "loaderror", + null, + "Non-string found in selected audio sources - ignoring." + ); + continue; + } + (i = /^data:audio\/([^;,]+);/i.exec(n)) || + (i = /\.([^.]+)$/.exec(n.split("?", 1)[0])), + i && (i = i[1].toLowerCase()); + } + if ( + (i || + console.warn( + 'No file extension was found. Consider using the "format" property or specify an extension.' + ), + i && a.codecs(i)) + ) { + e = this._src[t]; + break; + } + } + if (e) + return ( + (this._src = e), + (this._state = "loading"), + "https:" === window.location.protocol && + "http:" === e.slice(0, 5) && + ((this._html5 = true), (this._webAudio = false)), + new c(this), + this._webAudio && l(this), + this + ); + this._emit( + "loaderror", + null, + "No codec support for selected audio sources." + ); + } + }, + play: function (e, t) { + var n = this, + r = null; + if ("number" == typeof e) (r = e), (e = null); + else { + if ( + "string" == typeof e && + "loaded" === n._state && + !n._sprite[e] + ) + return null; + if (void 0 === e) { + e = "__default"; + for (var o = 0, s = 0; s < n._sounds.length; s++) + n._sounds[s]._paused && + !n._sounds[s]._ended && + (o++, (r = n._sounds[s]._id)); + 1 === o ? (e = null) : (r = null); + } + } + var c = r ? n._soundById(r) : n._inactiveSound(); + if (!c) return null; + if ( + (r && !e && (e = c._sprite || "__default"), "loaded" !== n._state) + ) { + (c._sprite = e), (c._ended = false); + var u = c._id; + return ( + n._queue.push({ + event: "play", + action: function () { + n.play(u); + }, + }), + u + ); + } + if (r && !c._paused) return t || n._loadQueue("play"), c._id; + n._webAudio && a._autoResume(); + var l = Math.max(0, c._seek > 0 ? c._seek : n._sprite[e][0] / 1e3), + h = Math.max(0, (n._sprite[e][0] + n._sprite[e][1]) / 1e3 - l), + f = (1e3 * h) / Math.abs(c._rate); + if ( + ((c._paused = false), + (c._ended = false), + (c._sprite = e), + (c._seek = l), + (c._start = n._sprite[e][0] / 1e3), + (c._stop = (n._sprite[e][0] + n._sprite[e][1]) / 1e3), + (c._loop = !(!c._loop && !n._sprite[e][2])), + !(c._seek >= c._stop)) + ) { + var d = c._node; + if (n._webAudio) { + var p = function () { + n._refreshBuffer(c); + var e = c._muted || n._muted ? 0 : c._volume; + d.gain.setValueAtTime(e, a.ctx.currentTime), + (c._playStart = a.ctx.currentTime), + void 0 === d.bufferSource.start + ? c._loop + ? d.bufferSource.noteGrainOn(0, l, 86400) + : d.bufferSource.noteGrainOn(0, l, h) + : c._loop + ? d.bufferSource.start(0, l, 86400) + : d.bufferSource.start(0, l, h), + f !== 1 / 0 && + (n._endTimers[c._id] = setTimeout( + n._ended.bind(n, c), + f + )), + t || + setTimeout(function () { + n._emit("play", c._id); + }, 0); + }; + "running" === a.state + ? p() + : (n.once("resume", p), n._clearTimer(c._id)); + } else { + var m = function () { + (d.currentTime = l), + (d.muted = c._muted || n._muted || a._muted || d.muted), + (d.volume = c._volume * a.volume()), + (d.playbackRate = c._rate); + try { + var r = d.play(); + if ( + (r && + void 0 !== i && + (r instanceof i || "function" == typeof r.then) + ? ((n._playLock = true), + r + .then(function () { + (n._playLock = false), + t || n._emit("play", c._id); + }) + .catch(function () { + (n._playLock = false), + n._emit( + "playerror", + c._id, + "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction." + ); + })) + : t || n._emit("play", c._id), + (d.playbackRate = c._rate), + d.paused) + ) + return void n._emit( + "playerror", + c._id, + "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction." + ); + "__default" !== e || c._loop + ? (n._endTimers[c._id] = setTimeout( + n._ended.bind(n, c), + f + )) + : ((n._endTimers[c._id] = function () { + n._ended(c), + d.removeEventListener( + "ended", + n._endTimers[c._id], + false + ); + }), + d.addEventListener( + "ended", + n._endTimers[c._id], + false + )); + } catch (e) { + n._emit("playerror", c._id, e); } - }, - play: function(e, t) { - var n = this - , r = null; - if ("number" == typeof e) - r = e, - e = null; - else { - if ("string" == typeof e && "loaded" === n._state && !n._sprite[e]) - return null; - if (void 0 === e) { - e = "__default"; - for (var o = 0, s = 0; s < n._sounds.length; s++) - n._sounds[s]._paused && !n._sounds[s]._ended && (o++, - r = n._sounds[s]._id); - 1 === o ? e = null : r = null - } - } - var c = r ? n._soundById(r) : n._inactiveSound(); - if (!c) - return null; - if (r && !e && (e = c._sprite || "__default"), - "loaded" !== n._state) { - c._sprite = e, - c._ended = false; - var u = c._id; - return n._queue.push({ - event: "play", - action: function() { - n.play(u) - } - }), - u - } - if (r && !c._paused) - return t || n._loadQueue("play"), - c._id; - n._webAudio && a._autoResume(); - var l = Math.max(0, c._seek > 0 ? c._seek : n._sprite[e][0] / 1e3) - , h = Math.max(0, (n._sprite[e][0] + n._sprite[e][1]) / 1e3 - l) - , f = 1e3 * h / Math.abs(c._rate); - if (c._paused = false, - c._ended = false, - c._sprite = e, - c._seek = l, - c._start = n._sprite[e][0] / 1e3, - c._stop = (n._sprite[e][0] + n._sprite[e][1]) / 1e3, - c._loop = !(!c._loop && !n._sprite[e][2]), - !(c._seek >= c._stop)) { - var d = c._node; - if (n._webAudio) { - var p = function() { - n._refreshBuffer(c); - var e = c._muted || n._muted ? 0 : c._volume; - d.gain.setValueAtTime(e, a.ctx.currentTime), - c._playStart = a.ctx.currentTime, - void 0 === d.bufferSource.start ? c._loop ? d.bufferSource.noteGrainOn(0, l, 86400) : d.bufferSource.noteGrainOn(0, l, h) : c._loop ? d.bufferSource.start(0, l, 86400) : d.bufferSource.start(0, l, h), - f !== 1 / 0 && (n._endTimers[c._id] = setTimeout(n._ended.bind(n, c), f)), - t || setTimeout(function() { - n._emit("play", c._id) - }, 0) - }; - "running" === a.state ? p() : (n.once("resume", p), - n._clearTimer(c._id)) - } else { - var m = function() { - d.currentTime = l, - d.muted = c._muted || n._muted || a._muted || d.muted, - d.volume = c._volume * a.volume(), - d.playbackRate = c._rate; - try { - var r = d.play(); - if (r && void 0 !== i && (r instanceof i || "function" == typeof r.then) ? (n._playLock = true, - r.then(function() { - n._playLock = false, - t || n._emit("play", c._id) - }).catch(function() { - n._playLock = false, - n._emit("playerror", c._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.") - })) : t || n._emit("play", c._id), - d.playbackRate = c._rate, - d.paused) - return void n._emit("playerror", c._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."); - "__default" !== e || c._loop ? n._endTimers[c._id] = setTimeout(n._ended.bind(n, c), f) : (n._endTimers[c._id] = function() { - n._ended(c), - d.removeEventListener("ended", n._endTimers[c._id], false) - } - , - d.addEventListener("ended", n._endTimers[c._id], false)) - } catch (e) { - n._emit("playerror", c._id, e) - } - } - , g = window && window.ejecta || !d.readyState && a._navigator.isCocoonJS; - if (d.readyState >= 3 || g) - m(); - else { - d.addEventListener(a._canPlayEvent, function e() { - m(), - d.removeEventListener(a._canPlayEvent, e, false) - }, false), - n._clearTimer(c._id) - } - } - return c._id - } - n._ended(c) - }, - pause: function(e) { - var t = this; - if ("loaded" !== t._state || t._playLock) - return t._queue.push({ - event: "pause", - action: function() { - t.pause(e) - } - }), - t; - for (var i = t._getSoundIds(e), n = 0; n < i.length; n++) { - t._clearTimer(i[n]); - var r = t._soundById(i[n]); - if (r && !r._paused && (r._seek = t.seek(i[n]), - r._rateSeek = 0, - r._paused = true, - t._stopFade(i[n]), - r._node)) - if (t._webAudio) { - if (!r._node.bufferSource) - continue; - void 0 === r._node.bufferSource.stop ? r._node.bufferSource.noteOff(0) : r._node.bufferSource.stop(0), - t._cleanBuffer(r._node) - } else - isNaN(r._node.duration) && r._node.duration !== 1 / 0 || r._node.pause(); - arguments[1] || t._emit("pause", r ? r._id : null) - } - return t - }, - stop: function(e, t) { - var i = this; - if ("loaded" !== i._state || i._playLock) - return i._queue.push({ - event: "stop", - action: function() { - i.stop(e) - } - }), - i; - for (var n = i._getSoundIds(e), r = 0; r < n.length; r++) { - i._clearTimer(n[r]); - var o = i._soundById(n[r]); - o && (o._seek = o._start || 0, - o._rateSeek = 0, - o._paused = true, - o._ended = true, - i._stopFade(n[r]), - o._node && (i._webAudio ? o._node.bufferSource && (void 0 === o._node.bufferSource.stop ? o._node.bufferSource.noteOff(0) : o._node.bufferSource.stop(0), - i._cleanBuffer(o._node)) : isNaN(o._node.duration) && o._node.duration !== 1 / 0 || (o._node.currentTime = o._start || 0, - o._node.pause())), - t || i._emit("stop", o._id)) - } - return i - }, - mute: function(e, t) { - var i = this; - if ("loaded" !== i._state || i._playLock) - return i._queue.push({ - event: "mute", - action: function() { - i.mute(e, t) - } - }), - i; - if (void 0 === t) { - if ("boolean" != typeof e) - return i._muted; - i._muted = e - } - for (var n = i._getSoundIds(t), r = 0; r < n.length; r++) { - var o = i._soundById(n[r]); - o && (o._muted = e, - o._interval && i._stopFade(o._id), - i._webAudio && o._node ? o._node.gain.setValueAtTime(e ? 0 : o._volume, a.ctx.currentTime) : o._node && (o._node.muted = !!a._muted || e), - i._emit("mute", o._id)) - } - return i - }, - volume: function() { - var e, t, i, n = this, r = arguments; - if (0 === r.length) - return n._volume; - if (1 === r.length || 2 === r.length && void 0 === r[1] ? n._getSoundIds().indexOf(r[0]) >= 0 ? t = parseInt(r[0], 10) : e = parseFloat(r[0]) : r.length >= 2 && (e = parseFloat(r[0]), - t = parseInt(r[1], 10)), - !(void 0 !== e && e >= 0 && e <= 1)) - return (i = t ? n._soundById(t) : n._sounds[0]) ? i._volume : 0; - if ("loaded" !== n._state || n._playLock) - return n._queue.push({ - event: "volume", - action: function() { - n.volume.apply(n, r) - } - }), - n; - void 0 === t && (n._volume = e), - t = n._getSoundIds(t); - for (var o = 0; o < t.length; o++) - (i = n._soundById(t[o])) && (i._volume = e, - r[2] || n._stopFade(t[o]), - n._webAudio && i._node && !i._muted ? i._node.gain.setValueAtTime(e, a.ctx.currentTime) : i._node && !i._muted && (i._node.volume = e * a.volume()), - n._emit("volume", i._id)); - return n - }, - fade: function(e, t, i, n) { - var r = this; - if ("loaded" !== r._state || r._playLock) - return r._queue.push({ - event: "fade", - action: function() { - r.fade(e, t, i, n) - } - }), - r; - r.volume(e, n); - for (var o = r._getSoundIds(n), s = 0; s < o.length; s++) { - var c = r._soundById(o[s]); - if (c) { - if (n || r._stopFade(o[s]), - r._webAudio && !c._muted) { - var u = a.ctx.currentTime - , l = u + i / 1e3; - c._volume = e, - c._node.gain.setValueAtTime(e, u), - c._node.gain.linearRampToValueAtTime(t, l) - } - r._startFadeInterval(c, e, t, i, o[s], void 0 === n) - } - } - return r - }, - _startFadeInterval: function(e, t, i, n, r, o) { - var a = this - , s = t - , c = i - t - , u = Math.abs(c / .01) - , l = Math.max(4, u > 0 ? n / u : n) - , h = Date.now(); - e._fadeTo = i, - e._interval = setInterval(function() { - var r = (Date.now() - h) / n; - h = Date.now(), - s += c * r, - s = Math.max(0, s), - s = Math.min(1, s), - s = Math.round(100 * s) / 100, - a._webAudio ? e._volume = s : a.volume(s, e._id, true), - o && (a._volume = s), - (i < t && s <= i || i > t && s >= i) && (clearInterval(e._interval), - e._interval = null, - e._fadeTo = null, - a.volume(i, e._id), - a._emit("fade", e._id)) - }, l) - }, - _stopFade: function(e) { - var t = this._soundById(e); - return t && t._interval && (this._webAudio && t._node.gain.cancelScheduledValues(a.ctx.currentTime), - clearInterval(t._interval), - t._interval = null, - this.volume(t._fadeTo, e), - t._fadeTo = null, - this._emit("fade", e)), - this - }, - loop: function() { - var e, t, i, n = arguments; - if (0 === n.length) - return this._loop; - if (1 === n.length) { - if ("boolean" != typeof n[0]) - return !!(i = this._soundById(parseInt(n[0], 10))) && i._loop; - e = n[0], - this._loop = e - } else - 2 === n.length && (e = n[0], - t = parseInt(n[1], 10)); - for (var r = this._getSoundIds(t), o = 0; o < r.length; o++) - (i = this._soundById(r[o])) && (i._loop = e, - this._webAudio && i._node && i._node.bufferSource && (i._node.bufferSource.loop = e, - e && (i._node.bufferSource.loopStart = i._start || 0, - i._node.bufferSource.loopEnd = i._stop))); - return this - }, - rate: function() { - var e, t, i, n = this, r = arguments; - if (0 === r.length) - t = n._sounds[0]._id; - else if (1 === r.length) { - n._getSoundIds().indexOf(r[0]) >= 0 ? t = parseInt(r[0], 10) : e = parseFloat(r[0]) - } else - 2 === r.length && (e = parseFloat(r[0]), - t = parseInt(r[1], 10)); - if ("number" != typeof e) - return (i = n._soundById(t)) ? i._rate : n._rate; - if ("loaded" !== n._state || n._playLock) - return n._queue.push({ - event: "rate", - action: function() { - n.rate.apply(n, r) - } - }), - n; - void 0 === t && (n._rate = e), - t = n._getSoundIds(t); - for (var o = 0; o < t.length; o++) - if (i = n._soundById(t[o])) { - i._rateSeek = n.seek(t[o]), - i._playStart = n._webAudio ? a.ctx.currentTime : i._playStart, - i._rate = e, - n._webAudio && i._node && i._node.bufferSource ? i._node.bufferSource.playbackRate.setValueAtTime(e, a.ctx.currentTime) : i._node && (i._node.playbackRate = e); - var s = n.seek(t[o]) - , c = 1e3 * ((n._sprite[i._sprite][0] + n._sprite[i._sprite][1]) / 1e3 - s) / Math.abs(i._rate); - !n._endTimers[t[o]] && i._paused || (n._clearTimer(t[o]), - n._endTimers[t[o]] = setTimeout(n._ended.bind(n, i), c)), - n._emit("rate", i._id) - } - return n - }, - seek: function() { - var e, t, i = this, n = arguments; - if (0 === n.length) - t = i._sounds[0]._id; - else if (1 === n.length) { - i._getSoundIds().indexOf(n[0]) >= 0 ? t = parseInt(n[0], 10) : i._sounds.length && (t = i._sounds[0]._id, - e = parseFloat(n[0])) - } else - 2 === n.length && (e = parseFloat(n[0]), - t = parseInt(n[1], 10)); - if (void 0 === t) - return i; - if ("loaded" !== i._state || i._playLock) - return i._queue.push({ - event: "seek", - action: function() { - i.seek.apply(i, n) - } - }), - i; - var r = i._soundById(t); - if (r) { - if (!("number" == typeof e && e >= 0)) { - if (i._webAudio) { - var o = i.playing(t) ? a.ctx.currentTime - r._playStart : 0 - , s = r._rateSeek ? r._rateSeek - r._seek : 0; - return r._seek + (s + o * Math.abs(r._rate)) - } - return r._node.currentTime - } - var c = i.playing(t); - c && i.pause(t, true), - r._seek = e, - r._ended = false, - i._clearTimer(t), - !i._webAudio && r._node && (r._node.currentTime = e); - var u = function() { - i._emit("seek", t), - c && i.play(t, true) - }; - if (c && !i._webAudio) { - setTimeout(function e() { - i._playLock ? setTimeout(e, 0) : u() - }, 0) - } else - u() - } - return i - }, - playing: function(e) { - if ("number" == typeof e) { - var t = this._soundById(e); - return !!t && !t._paused - } - for (var i = 0; i < this._sounds.length; i++) - if (!this._sounds[i]._paused) - return true; - return false - }, - duration: function(e) { - var t = this._duration - , i = this._soundById(e); - return i && (t = this._sprite[i._sprite][1] / 1e3), - t - }, - state: function() { - return this._state - }, - unload: function() { - for (var e = this, t = e._sounds, i = 0; i < t.length; i++) { - if (t[i]._paused || e.stop(t[i]._id), - !e._webAudio) - /MSIE |Trident\//.test(a._navigator && a._navigator.userAgent) || (t[i]._node.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"), - t[i]._node.removeEventListener("error", t[i]._errorFn, false), - t[i]._node.removeEventListener(a._canPlayEvent, t[i]._loadFn, false); - delete t[i]._node, - e._clearTimer(t[i]._id) - } - var n = a._howls.indexOf(e); - n >= 0 && a._howls.splice(n, 1); - var r = true; - for (i = 0; i < a._howls.length; i++) - if (a._howls[i]._src === e._src) { - r = false; - break - } - return u && r && delete u[e._src], - a.noAudio = false, - e._state = "unloaded", - e._sounds = [], - e = null, - null - }, - on: function(e, t, i, n) { - var r = this["_on" + e]; - return "function" == typeof t && r.push(n ? { + }, + g = + (window && window.ejecta) || + (!d.readyState && a._navigator.isCocoonJS); + if (d.readyState >= 3 || g) m(); + else { + d.addEventListener( + a._canPlayEvent, + function e() { + m(), d.removeEventListener(a._canPlayEvent, e, false); + }, + false + ), + n._clearTimer(c._id); + } + } + return c._id; + } + n._ended(c); + }, + pause: function (e) { + var t = this; + if ("loaded" !== t._state || t._playLock) + return ( + t._queue.push({ + event: "pause", + action: function () { + t.pause(e); + }, + }), + t + ); + for (var i = t._getSoundIds(e), n = 0; n < i.length; n++) { + t._clearTimer(i[n]); + var r = t._soundById(i[n]); + if ( + r && + !r._paused && + ((r._seek = t.seek(i[n])), + (r._rateSeek = 0), + (r._paused = true), + t._stopFade(i[n]), + r._node) + ) + if (t._webAudio) { + if (!r._node.bufferSource) continue; + void 0 === r._node.bufferSource.stop + ? r._node.bufferSource.noteOff(0) + : r._node.bufferSource.stop(0), + t._cleanBuffer(r._node); + } else + (isNaN(r._node.duration) && r._node.duration !== 1 / 0) || + r._node.pause(); + arguments[1] || t._emit("pause", r ? r._id : null); + } + return t; + }, + stop: function (e, t) { + var i = this; + if ("loaded" !== i._state || i._playLock) + return ( + i._queue.push({ + event: "stop", + action: function () { + i.stop(e); + }, + }), + i + ); + for (var n = i._getSoundIds(e), r = 0; r < n.length; r++) { + i._clearTimer(n[r]); + var o = i._soundById(n[r]); + o && + ((o._seek = o._start || 0), + (o._rateSeek = 0), + (o._paused = true), + (o._ended = true), + i._stopFade(n[r]), + o._node && + (i._webAudio + ? o._node.bufferSource && + (void 0 === o._node.bufferSource.stop + ? o._node.bufferSource.noteOff(0) + : o._node.bufferSource.stop(0), + i._cleanBuffer(o._node)) + : (isNaN(o._node.duration) && o._node.duration !== 1 / 0) || + ((o._node.currentTime = o._start || 0), o._node.pause())), + t || i._emit("stop", o._id)); + } + return i; + }, + mute: function (e, t) { + var i = this; + if ("loaded" !== i._state || i._playLock) + return ( + i._queue.push({ + event: "mute", + action: function () { + i.mute(e, t); + }, + }), + i + ); + if (void 0 === t) { + if ("boolean" != typeof e) return i._muted; + i._muted = e; + } + for (var n = i._getSoundIds(t), r = 0; r < n.length; r++) { + var o = i._soundById(n[r]); + o && + ((o._muted = e), + o._interval && i._stopFade(o._id), + i._webAudio && o._node + ? o._node.gain.setValueAtTime( + e ? 0 : o._volume, + a.ctx.currentTime + ) + : o._node && (o._node.muted = !!a._muted || e), + i._emit("mute", o._id)); + } + return i; + }, + volume: function () { + var e, + t, + i, + n = this, + r = arguments; + if (0 === r.length) return n._volume; + if ( + (1 === r.length || (2 === r.length && void 0 === r[1]) + ? n._getSoundIds().indexOf(r[0]) >= 0 + ? (t = parseInt(r[0], 10)) + : (e = parseFloat(r[0])) + : r.length >= 2 && + ((e = parseFloat(r[0])), (t = parseInt(r[1], 10))), + !(void 0 !== e && e >= 0 && e <= 1)) + ) + return (i = t ? n._soundById(t) : n._sounds[0]) ? i._volume : 0; + if ("loaded" !== n._state || n._playLock) + return ( + n._queue.push({ + event: "volume", + action: function () { + n.volume.apply(n, r); + }, + }), + n + ); + void 0 === t && (n._volume = e), (t = n._getSoundIds(t)); + for (var o = 0; o < t.length; o++) + (i = n._soundById(t[o])) && + ((i._volume = e), + r[2] || n._stopFade(t[o]), + n._webAudio && i._node && !i._muted + ? i._node.gain.setValueAtTime(e, a.ctx.currentTime) + : i._node && !i._muted && (i._node.volume = e * a.volume()), + n._emit("volume", i._id)); + return n; + }, + fade: function (e, t, i, n) { + var r = this; + if ("loaded" !== r._state || r._playLock) + return ( + r._queue.push({ + event: "fade", + action: function () { + r.fade(e, t, i, n); + }, + }), + r + ); + r.volume(e, n); + for (var o = r._getSoundIds(n), s = 0; s < o.length; s++) { + var c = r._soundById(o[s]); + if (c) { + if ((n || r._stopFade(o[s]), r._webAudio && !c._muted)) { + var u = a.ctx.currentTime, + l = u + i / 1e3; + (c._volume = e), + c._node.gain.setValueAtTime(e, u), + c._node.gain.linearRampToValueAtTime(t, l); + } + r._startFadeInterval(c, e, t, i, o[s], void 0 === n); + } + } + return r; + }, + _startFadeInterval: function (e, t, i, n, r, o) { + var a = this, + s = t, + c = i - t, + u = Math.abs(c / 0.01), + l = Math.max(4, u > 0 ? n / u : n), + h = Date.now(); + (e._fadeTo = i), + (e._interval = setInterval(function () { + var r = (Date.now() - h) / n; + (h = Date.now()), + (s += c * r), + (s = Math.max(0, s)), + (s = Math.min(1, s)), + (s = Math.round(100 * s) / 100), + a._webAudio ? (e._volume = s) : a.volume(s, e._id, true), + o && (a._volume = s), + ((i < t && s <= i) || (i > t && s >= i)) && + (clearInterval(e._interval), + (e._interval = null), + (e._fadeTo = null), + a.volume(i, e._id), + a._emit("fade", e._id)); + }, l)); + }, + _stopFade: function (e) { + var t = this._soundById(e); + return ( + t && + t._interval && + (this._webAudio && + t._node.gain.cancelScheduledValues(a.ctx.currentTime), + clearInterval(t._interval), + (t._interval = null), + this.volume(t._fadeTo, e), + (t._fadeTo = null), + this._emit("fade", e)), + this + ); + }, + loop: function () { + var e, + t, + i, + n = arguments; + if (0 === n.length) return this._loop; + if (1 === n.length) { + if ("boolean" != typeof n[0]) + return !!(i = this._soundById(parseInt(n[0], 10))) && i._loop; + (e = n[0]), (this._loop = e); + } else 2 === n.length && ((e = n[0]), (t = parseInt(n[1], 10))); + for (var r = this._getSoundIds(t), o = 0; o < r.length; o++) + (i = this._soundById(r[o])) && + ((i._loop = e), + this._webAudio && + i._node && + i._node.bufferSource && + ((i._node.bufferSource.loop = e), + e && + ((i._node.bufferSource.loopStart = i._start || 0), + (i._node.bufferSource.loopEnd = i._stop)))); + return this; + }, + rate: function () { + var e, + t, + i, + n = this, + r = arguments; + if (0 === r.length) t = n._sounds[0]._id; + else if (1 === r.length) { + n._getSoundIds().indexOf(r[0]) >= 0 + ? (t = parseInt(r[0], 10)) + : (e = parseFloat(r[0])); + } else + 2 === r.length && + ((e = parseFloat(r[0])), (t = parseInt(r[1], 10))); + if ("number" != typeof e) + return (i = n._soundById(t)) ? i._rate : n._rate; + if ("loaded" !== n._state || n._playLock) + return ( + n._queue.push({ + event: "rate", + action: function () { + n.rate.apply(n, r); + }, + }), + n + ); + void 0 === t && (n._rate = e), (t = n._getSoundIds(t)); + for (var o = 0; o < t.length; o++) + if ((i = n._soundById(t[o]))) { + (i._rateSeek = n.seek(t[o])), + (i._playStart = n._webAudio + ? a.ctx.currentTime + : i._playStart), + (i._rate = e), + n._webAudio && i._node && i._node.bufferSource + ? i._node.bufferSource.playbackRate.setValueAtTime( + e, + a.ctx.currentTime + ) + : i._node && (i._node.playbackRate = e); + var s = n.seek(t[o]), + c = + (1e3 * + ((n._sprite[i._sprite][0] + n._sprite[i._sprite][1]) / + 1e3 - + s)) / + Math.abs(i._rate); + (!n._endTimers[t[o]] && i._paused) || + (n._clearTimer(t[o]), + (n._endTimers[t[o]] = setTimeout(n._ended.bind(n, i), c))), + n._emit("rate", i._id); + } + return n; + }, + seek: function () { + var e, + t, + i = this, + n = arguments; + if (0 === n.length) t = i._sounds[0]._id; + else if (1 === n.length) { + i._getSoundIds().indexOf(n[0]) >= 0 + ? (t = parseInt(n[0], 10)) + : i._sounds.length && + ((t = i._sounds[0]._id), (e = parseFloat(n[0]))); + } else + 2 === n.length && + ((e = parseFloat(n[0])), (t = parseInt(n[1], 10))); + if (void 0 === t) return i; + if ("loaded" !== i._state || i._playLock) + return ( + i._queue.push({ + event: "seek", + action: function () { + i.seek.apply(i, n); + }, + }), + i + ); + var r = i._soundById(t); + if (r) { + if (!("number" == typeof e && e >= 0)) { + if (i._webAudio) { + var o = i.playing(t) ? a.ctx.currentTime - r._playStart : 0, + s = r._rateSeek ? r._rateSeek - r._seek : 0; + return r._seek + (s + o * Math.abs(r._rate)); + } + return r._node.currentTime; + } + var c = i.playing(t); + c && i.pause(t, true), + (r._seek = e), + (r._ended = false), + i._clearTimer(t), + !i._webAudio && r._node && (r._node.currentTime = e); + var u = function () { + i._emit("seek", t), c && i.play(t, true); + }; + if (c && !i._webAudio) { + setTimeout(function e() { + i._playLock ? setTimeout(e, 0) : u(); + }, 0); + } else u(); + } + return i; + }, + playing: function (e) { + if ("number" == typeof e) { + var t = this._soundById(e); + return !!t && !t._paused; + } + for (var i = 0; i < this._sounds.length; i++) + if (!this._sounds[i]._paused) return true; + return false; + }, + duration: function (e) { + var t = this._duration, + i = this._soundById(e); + return i && (t = this._sprite[i._sprite][1] / 1e3), t; + }, + state: function () { + return this._state; + }, + unload: function () { + for (var e = this, t = e._sounds, i = 0; i < t.length; i++) { + if ((t[i]._paused || e.stop(t[i]._id), !e._webAudio)) + /MSIE |Trident\//.test( + a._navigator && a._navigator.userAgent + ) || + (t[i]._node.src = + "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"), + t[i]._node.removeEventListener("error", t[i]._errorFn, false), + t[i]._node.removeEventListener( + a._canPlayEvent, + t[i]._loadFn, + false + ); + delete t[i]._node, e._clearTimer(t[i]._id); + } + var n = a._howls.indexOf(e); + n >= 0 && a._howls.splice(n, 1); + var r = true; + for (i = 0; i < a._howls.length; i++) + if (a._howls[i]._src === e._src) { + r = false; + break; + } + return ( + u && r && delete u[e._src], + (a.noAudio = false), + (e._state = "unloaded"), + (e._sounds = []), + (e = null), + null + ); + }, + on: function (e, t, i, n) { + var r = this["_on" + e]; + return ( + "function" == typeof t && + r.push( + n + ? { id: i, fn: t, - once: n - } : { + once: n, + } + : { id: i, - fn: t - }), - this - }, - off: function(e, t, i) { - var n = this["_on" + e] - , r = 0; - if ("number" == typeof t && (i = t, - t = null), - t || i) - for (r = 0; r < n.length; r++) { - var o = i === n[r].id; - if (t === n[r].fn && o || !t && o) { - n.splice(r, 1); - break - } - } - else if (e) - this["_on" + e] = []; - else { - var a = Object.keys(this); - for (r = 0; r < a.length; r++) - 0 === a[r].indexOf("_on") && Array.isArray(this[a[r]]) && (this[a[r]] = []) - } - return this - }, - once: function(e, t, i) { - return this.on(e, t, i, 1), - this - }, - _emit: function(e, t, i) { - for (var n = this["_on" + e], r = n.length - 1; r >= 0; r--) - n[r].id && n[r].id !== t && "load" !== e || (setTimeout(function(e) { - e.call(this, t, i) - } - .bind(this, n[r].fn), 0), - n[r].once && this.off(e, n[r].fn, n[r].id)); - return this._loadQueue(e), - this - }, - _loadQueue: function(e) { - if (this._queue.length > 0) { - var t = this._queue[0]; - t.event === e && (this._queue.shift(), - this._loadQueue()), - e || t.action() - } - return this - }, - _ended: function(e) { - var t = e._sprite; - if (!this._webAudio && e._node && !e._node.paused && !e._node.ended && e._node.currentTime < e._stop) - return setTimeout(this._ended.bind(this, e), 100), - this; - var i = !(!e._loop && !this._sprite[t][2]); - if (this._emit("end", e._id), - !this._webAudio && i && this.stop(e._id, true).play(e._id), - this._webAudio && i) { - this._emit("play", e._id), - e._seek = e._start || 0, - e._rateSeek = 0, - e._playStart = a.ctx.currentTime; - var n = 1e3 * (e._stop - e._start) / Math.abs(e._rate); - this._endTimers[e._id] = setTimeout(this._ended.bind(this, e), n) - } - return this._webAudio && !i && (e._paused = true, - e._ended = true, - e._seek = e._start || 0, - e._rateSeek = 0, - this._clearTimer(e._id), - this._cleanBuffer(e._node), - a._autoSuspend()), - this._webAudio || i || this.stop(e._id, true), - this - }, - _clearTimer: function(e) { - if (this._endTimers[e]) { - if ("function" != typeof this._endTimers[e]) - clearTimeout(this._endTimers[e]); - else { - var t = this._soundById(e); - t && t._node && t._node.removeEventListener("ended", this._endTimers[e], false) - } - delete this._endTimers[e] - } - return this - }, - _soundById: function(e) { - for (var t = 0; t < this._sounds.length; t++) - if (e === this._sounds[t]._id) - return this._sounds[t]; - return null - }, - _inactiveSound: function() { - this._drain(); - for (var e = 0; e < this._sounds.length; e++) - if (this._sounds[e]._ended) - return this._sounds[e].reset(); - return new c(this) - }, - _drain: function() { - var e = this._pool - , t = 0 - , i = 0; - if (!(this._sounds.length < e)) { - for (i = 0; i < this._sounds.length; i++) - this._sounds[i]._ended && t++; - for (i = this._sounds.length - 1; i >= 0; i--) { - if (t <= e) - return; - this._sounds[i]._ended && (this._webAudio && this._sounds[i]._node && this._sounds[i]._node.disconnect(0), - this._sounds.splice(i, 1), - t--) - } - } - }, - _getSoundIds: function(e) { - if (void 0 === e) { - for (var t = [], i = 0; i < this._sounds.length; i++) - t.push(this._sounds[i]._id); - return t - } - return [e] - }, - _refreshBuffer: function(e) { - return e._node.bufferSource = a.ctx.createBufferSource(), - e._node.bufferSource.buffer = u[this._src], - e._panner ? e._node.bufferSource.connect(e._panner) : e._node.bufferSource.connect(e._node), - e._node.bufferSource.loop = e._loop, - e._loop && (e._node.bufferSource.loopStart = e._start || 0, - e._node.bufferSource.loopEnd = e._stop || 0), - e._node.bufferSource.playbackRate.setValueAtTime(e._rate, a.ctx.currentTime), - this - }, - _cleanBuffer: function(e) { - if (a._scratchBuffer && e.bufferSource) { - e.bufferSource.onended = null, - e.bufferSource.disconnect(0); - try { - e.bufferSource.buffer = a._scratchBuffer - } catch (e) {} - } - return e.bufferSource = null, - this - } - }; - var c = function(e) { - this._parent = e, - this.init() - }; - c.prototype = { - init: function() { - var e = this._parent; - return this._muted = e._muted, - this._loop = e._loop, - this._volume = e._volume, - this._rate = e._rate, - this._seek = 0, - this._paused = true, - this._ended = true, - this._sprite = "__default", - this._id = ++a._counter, - e._sounds.push(this), - this.create(), - this - }, - create: function() { - var e = this._parent - , t = a._muted || this._muted || this._parent._muted ? 0 : this._volume; - return e._webAudio ? (this._node = void 0 === a.ctx.createGain ? a.ctx.createGainNode() : a.ctx.createGain(), - this._node.gain.setValueAtTime(t, a.ctx.currentTime), - this._node.paused = true, - this._node.connect(a.masterGain)) : (this._node = new Audio, - this._errorFn = this._errorListener.bind(this), - this._node.addEventListener("error", this._errorFn, false), - this._loadFn = this._loadListener.bind(this), - this._node.addEventListener(a._canPlayEvent, this._loadFn, false), - this._node.src = e._src, - this._node.preload = "auto", - this._node.volume = t * a.volume(), - this._node.load()), - this - }, - reset: function() { - var e = this._parent; - return this._muted = e._muted, - this._loop = e._loop, - this._volume = e._volume, - this._rate = e._rate, - this._seek = 0, - this._rateSeek = 0, - this._paused = true, - this._ended = true, - this._sprite = "__default", - this._id = ++a._counter, - this - }, - _errorListener: function() { - this._parent._emit("loaderror", this._id, this._node.error ? this._node.error.code : 0), - this._node.removeEventListener("error", this._errorFn, false) - }, - _loadListener: function() { - var e = this._parent; - e._duration = Math.ceil(10 * this._node.duration) / 10, - 0 === Object.keys(e._sprite).length && (e._sprite = { - __default: [0, 1e3 * e._duration] - }), - "loaded" !== e._state && (e._state = "loaded", - e._emit("load"), - e._loadQueue()), - this._node.removeEventListener(a._canPlayEvent, this._loadFn, false) - } - }; - var u = {} - , l = function(e) { - var t = e._src; - if (u[t]) - return e._duration = u[t].duration, - void d(e); - if (/^data:[^;]+;base64,/.test(t)) { - for (var i = atob(t.split(",")[1]), n = new Uint8Array(i.length), r = 0; r < i.length; ++r) - n[r] = i.charCodeAt(r); - f(n.buffer, e) - } else { - var o = new XMLHttpRequest; - o.open("GET", t, true), - o.withCredentials = e._xhrWithCredentials, - o.responseType = "arraybuffer", - o.onload = function() { - var t = (o.status + "")[0]; - "0" === t || "2" === t || "3" === t ? f(o.response, e) : e._emit("loaderror", null, "Failed loading audio file with status: " + o.status + ".") - } - , - o.onerror = function() { - e._webAudio && (e._html5 = true, - e._webAudio = false, - e._sounds = [], - delete u[t], - e.load()) - } - , - h(o) + fn: t, + } + ), + this + ); + }, + off: function (e, t, i) { + var n = this["_on" + e], + r = 0; + if (("number" == typeof t && ((i = t), (t = null)), t || i)) + for (r = 0; r < n.length; r++) { + var o = i === n[r].id; + if ((t === n[r].fn && o) || (!t && o)) { + n.splice(r, 1); + break; } + } + else if (e) this["_on" + e] = []; + else { + var a = Object.keys(this); + for (r = 0; r < a.length; r++) + 0 === a[r].indexOf("_on") && + Array.isArray(this[a[r]]) && + (this[a[r]] = []); } - , h = function(e) { - try { - e.send() - } catch (t) { - e.onerror() - } + return this; + }, + once: function (e, t, i) { + return this.on(e, t, i, 1), this; + }, + _emit: function (e, t, i) { + for (var n = this["_on" + e], r = n.length - 1; r >= 0; r--) + (n[r].id && n[r].id !== t && "load" !== e) || + (setTimeout( + function (e) { + e.call(this, t, i); + }.bind(this, n[r].fn), + 0 + ), + n[r].once && this.off(e, n[r].fn, n[r].id)); + return this._loadQueue(e), this; + }, + _loadQueue: function (e) { + if (this._queue.length > 0) { + var t = this._queue[0]; + t.event === e && (this._queue.shift(), this._loadQueue()), + e || t.action(); } - , f = function(e, t) { - var n = function() { - t._emit("loaderror", null, "Decoding audio data failed.") - } - , r = function(e) { - e && t._sounds.length > 0 ? (u[t._src] = e, - d(t, e)) : n() - }; - void 0 !== i && 1 === a.ctx.decodeAudioData.length ? a.ctx.decodeAudioData(e).then(r).catch(n) : a.ctx.decodeAudioData(e, r, n) + return this; + }, + _ended: function (e) { + var t = e._sprite; + if ( + !this._webAudio && + e._node && + !e._node.paused && + !e._node.ended && + e._node.currentTime < e._stop + ) + return setTimeout(this._ended.bind(this, e), 100), this; + var i = !(!e._loop && !this._sprite[t][2]); + if ( + (this._emit("end", e._id), + !this._webAudio && i && this.stop(e._id, true).play(e._id), + this._webAudio && i) + ) { + this._emit("play", e._id), + (e._seek = e._start || 0), + (e._rateSeek = 0), + (e._playStart = a.ctx.currentTime); + var n = (1e3 * (e._stop - e._start)) / Math.abs(e._rate); + this._endTimers[e._id] = setTimeout(this._ended.bind(this, e), n); } - , d = function(e, t) { - t && !e._duration && (e._duration = t.duration), - 0 === Object.keys(e._sprite).length && (e._sprite = { - __default: [0, 1e3 * e._duration] - }), - "loaded" !== e._state && (e._state = "loaded", - e._emit("load"), - e._loadQueue()) + return ( + this._webAudio && + !i && + ((e._paused = true), + (e._ended = true), + (e._seek = e._start || 0), + (e._rateSeek = 0), + this._clearTimer(e._id), + this._cleanBuffer(e._node), + a._autoSuspend()), + this._webAudio || i || this.stop(e._id, true), + this + ); + }, + _clearTimer: function (e) { + if (this._endTimers[e]) { + if ("function" != typeof this._endTimers[e]) + clearTimeout(this._endTimers[e]); + else { + var t = this._soundById(e); + t && + t._node && + t._node.removeEventListener( + "ended", + this._endTimers[e], + false + ); + } + delete this._endTimers[e]; } - , p = function() { - try { - "undefined" != typeof AudioContext ? a.ctx = new AudioContext : "undefined" != typeof webkitAudioContext ? a.ctx = new webkitAudioContext : a.usingWebAudio = false - } catch (e) { - a.usingWebAudio = false - } - var e = /iP(hone|od|ad)/.test(a._navigator && a._navigator.platform) - , t = a._navigator && a._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/) - , i = t ? parseInt(t[1], 10) : null; - if (e && i && i < 9) { - var n = /safari/.test(a._navigator && a._navigator.userAgent.toLowerCase()); - (a._navigator && a._navigator.standalone && !n || a._navigator && !a._navigator.standalone && !n) && (a.usingWebAudio = false) - } - a.usingWebAudio && (a.masterGain = void 0 === a.ctx.createGain ? a.ctx.createGainNode() : a.ctx.createGain(), - a.masterGain.gain.setValueAtTime(a._muted ? 0 : 1, a.ctx.currentTime), - a.masterGain.connect(a.ctx.destination)), - a._setup() - }; - void 0 === (r = function() { - return { - Howler: a, - Howl: s - } + return this; + }, + _soundById: function (e) { + for (var t = 0; t < this._sounds.length; t++) + if (e === this._sounds[t]._id) return this._sounds[t]; + return null; + }, + _inactiveSound: function () { + this._drain(); + for (var e = 0; e < this._sounds.length; e++) + if (this._sounds[e]._ended) return this._sounds[e].reset(); + return new c(this); + }, + _drain: function () { + var e = this._pool, + t = 0, + i = 0; + if (!(this._sounds.length < e)) { + for (i = 0; i < this._sounds.length; i++) + this._sounds[i]._ended && t++; + for (i = this._sounds.length - 1; i >= 0; i--) { + if (t <= e) return; + this._sounds[i]._ended && + (this._webAudio && + this._sounds[i]._node && + this._sounds[i]._node.disconnect(0), + this._sounds.splice(i, 1), + t--); + } } - .apply(t, [])) || (e.exports = r), - t.Howler = a, - t.Howl = s, - "undefined" != typeof window ? (window.HowlerGlobal = o, - window.Howler = a, - window.Howl = s, - window.Sound = c) : void 0 !== n && (n.HowlerGlobal = o, - n.Howler = a, - n.Howl = s, - n.Sound = c) - }(), - /*! - * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. - * - * howler.js v2.0.15 - * howlerjs.com - * - * (c) 2013-2018, James Simpson of GoldFire Studios - * goldfirestudios.com - * - * MIT License - */ - function() { - "use strict"; - var e; - HowlerGlobal.prototype._pos = [0, 0, 0], - HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0], - HowlerGlobal.prototype.stereo = function(e) { - if (!this.ctx || !this.ctx.listener) - return this; - for (var t = this._howls.length - 1; t >= 0; t--) - this._howls[t].stereo(e); - return this + }, + _getSoundIds: function (e) { + if (void 0 === e) { + for (var t = [], i = 0; i < this._sounds.length; i++) + t.push(this._sounds[i]._id); + return t; } - , - HowlerGlobal.prototype.pos = function(e, t, i) { - return this.ctx && this.ctx.listener ? (t = "number" != typeof t ? this._pos[1] : t, - i = "number" != typeof i ? this._pos[2] : i, - "number" != typeof e ? this._pos : (this._pos = [e, t, i], - void 0 !== this.ctx.listener.positionX ? (this.ctx.listener.positionX.setTargetAtTime(this._pos[0], Howler.ctx.currentTime, .1), - this.ctx.listener.positionY.setTargetAtTime(this._pos[1], Howler.ctx.currentTime, .1), - this.ctx.listener.positionZ.setTargetAtTime(this._pos[2], Howler.ctx.currentTime, .1)) : this.ctx.listener.setPosition(this._pos[0], this._pos[1], this._pos[2]), - this)) : this - } - , - HowlerGlobal.prototype.orientation = function(e, t, i, n, r, o) { - if (!this.ctx || !this.ctx.listener) - return this; - var a = this._orientation; - return t = "number" != typeof t ? a[1] : t, - i = "number" != typeof i ? a[2] : i, - n = "number" != typeof n ? a[3] : n, - r = "number" != typeof r ? a[4] : r, - o = "number" != typeof o ? a[5] : o, - "number" != typeof e ? a : (this._orientation = [e, t, i, n, r, o], - void 0 !== this.ctx.listener.forwardX ? (this.ctx.listener.forwardX.setTargetAtTime(e, Howler.ctx.currentTime, .1), - this.ctx.listener.forwardY.setTargetAtTime(t, Howler.ctx.currentTime, .1), - this.ctx.listener.forwardZ.setTargetAtTime(i, Howler.ctx.currentTime, .1), - this.ctx.listener.upX.setTargetAtTime(e, Howler.ctx.currentTime, .1), - this.ctx.listener.upY.setTargetAtTime(t, Howler.ctx.currentTime, .1), - this.ctx.listener.upZ.setTargetAtTime(i, Howler.ctx.currentTime, .1)) : this.ctx.listener.setOrientation(e, t, i, n, r, o), - this) - } - , - Howl.prototype.init = (e = Howl.prototype.init, - function(t) { - return this._orientation = t.orientation || [1, 0, 0], - this._stereo = t.stereo || null, - this._pos = t.pos || null, - this._pannerAttr = { - coneInnerAngle: void 0 !== t.coneInnerAngle ? t.coneInnerAngle : 360, - coneOuterAngle: void 0 !== t.coneOuterAngle ? t.coneOuterAngle : 360, - coneOuterGain: void 0 !== t.coneOuterGain ? t.coneOuterGain : 0, - distanceModel: void 0 !== t.distanceModel ? t.distanceModel : "inverse", - maxDistance: void 0 !== t.maxDistance ? t.maxDistance : 1e4, - panningModel: void 0 !== t.panningModel ? t.panningModel : "HRTF", - refDistance: void 0 !== t.refDistance ? t.refDistance : 1, - rolloffFactor: void 0 !== t.rolloffFactor ? t.rolloffFactor : 1 - }, - this._onstereo = t.onstereo ? [{ - fn: t.onstereo - }] : [], - this._onpos = t.onpos ? [{ - fn: t.onpos - }] : [], - this._onorientation = t.onorientation ? [{ - fn: t.onorientation - }] : [], - e.call(this, t) + return [e]; + }, + _refreshBuffer: function (e) { + return ( + (e._node.bufferSource = a.ctx.createBufferSource()), + (e._node.bufferSource.buffer = u[this._src]), + e._panner + ? e._node.bufferSource.connect(e._panner) + : e._node.bufferSource.connect(e._node), + (e._node.bufferSource.loop = e._loop), + e._loop && + ((e._node.bufferSource.loopStart = e._start || 0), + (e._node.bufferSource.loopEnd = e._stop || 0)), + e._node.bufferSource.playbackRate.setValueAtTime( + e._rate, + a.ctx.currentTime + ), + this + ); + }, + _cleanBuffer: function (e) { + if (a._scratchBuffer && e.bufferSource) { + (e.bufferSource.onended = null), e.bufferSource.disconnect(0); + try { + e.bufferSource.buffer = a._scratchBuffer; + } catch (e) {} } + return (e.bufferSource = null), this; + }, + }; + var c = function (e) { + (this._parent = e), this.init(); + }; + c.prototype = { + init: function () { + var e = this._parent; + return ( + (this._muted = e._muted), + (this._loop = e._loop), + (this._volume = e._volume), + (this._rate = e._rate), + (this._seek = 0), + (this._paused = true), + (this._ended = true), + (this._sprite = "__default"), + (this._id = ++a._counter), + e._sounds.push(this), + this.create(), + this + ); + }, + create: function () { + var e = this._parent, + t = + a._muted || this._muted || this._parent._muted + ? 0 + : this._volume; + return ( + e._webAudio + ? ((this._node = + void 0 === a.ctx.createGain + ? a.ctx.createGainNode() + : a.ctx.createGain()), + this._node.gain.setValueAtTime(t, a.ctx.currentTime), + (this._node.paused = true), + this._node.connect(a.masterGain)) + : ((this._node = new Audio()), + (this._errorFn = this._errorListener.bind(this)), + this._node.addEventListener("error", this._errorFn, false), + (this._loadFn = this._loadListener.bind(this)), + this._node.addEventListener( + a._canPlayEvent, + this._loadFn, + false + ), + (this._node.src = e._src), + (this._node.preload = "auto"), + (this._node.volume = t * a.volume()), + this._node.load()), + this + ); + }, + reset: function () { + var e = this._parent; + return ( + (this._muted = e._muted), + (this._loop = e._loop), + (this._volume = e._volume), + (this._rate = e._rate), + (this._seek = 0), + (this._rateSeek = 0), + (this._paused = true), + (this._ended = true), + (this._sprite = "__default"), + (this._id = ++a._counter), + this + ); + }, + _errorListener: function () { + this._parent._emit( + "loaderror", + this._id, + this._node.error ? this._node.error.code : 0 ), - Howl.prototype.stereo = function(e, i) { - var n = this; - if (!n._webAudio) - return n; - if ("loaded" !== n._state) - return n._queue.push({ - event: "stereo", - action: function() { - n.stereo(e, i) - } - }), - n; - var r = void 0 === Howler.ctx.createStereoPanner ? "spatial" : "stereo"; - if (void 0 === i) { - if ("number" != typeof e) - return n._stereo; - n._stereo = e, - n._pos = [e, 0, 0] - } - for (var o = n._getSoundIds(i), a = 0; a < o.length; a++) { - var s = n._soundById(o[a]); - if (s) { - if ("number" != typeof e) - return s._stereo; - s._stereo = e, - s._pos = [e, 0, 0], - s._node && (s._pannerAttr.panningModel = "equalpower", - s._panner && s._panner.pan || t(s, r), - "spatial" === r ? void 0 !== s._panner.positionX ? (s._panner.positionX.setValueAtTime(e, Howler.ctx.currentTime), - s._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime), - s._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime)) : s._panner.setPosition(e, 0, 0) : s._panner.pan.setValueAtTime(e, Howler.ctx.currentTime)), - n._emit("stereo", s._id) - } - } - return n + this._node.removeEventListener("error", this._errorFn, false); + }, + _loadListener: function () { + var e = this._parent; + (e._duration = Math.ceil(10 * this._node.duration) / 10), + 0 === Object.keys(e._sprite).length && + (e._sprite = { + __default: [0, 1e3 * e._duration], + }), + "loaded" !== e._state && + ((e._state = "loaded"), e._emit("load"), e._loadQueue()), + this._node.removeEventListener( + a._canPlayEvent, + this._loadFn, + false + ); + }, + }; + var u = {}, + l = function (e) { + var t = e._src; + if (u[t]) return (e._duration = u[t].duration), void d(e); + if (/^data:[^;]+;base64,/.test(t)) { + for ( + var i = atob(t.split(",")[1]), + n = new Uint8Array(i.length), + r = 0; + r < i.length; + ++r + ) + n[r] = i.charCodeAt(r); + f(n.buffer, e); + } else { + var o = new XMLHttpRequest(); + o.open("GET", t, true), + (o.withCredentials = e._xhrWithCredentials), + (o.responseType = "arraybuffer"), + (o.onload = function () { + var t = (o.status + "")[0]; + "0" === t || "2" === t || "3" === t + ? f(o.response, e) + : e._emit( + "loaderror", + null, + "Failed loading audio file with status: " + + o.status + + "." + ); + }), + (o.onerror = function () { + e._webAudio && + ((e._html5 = true), + (e._webAudio = false), + (e._sounds = []), + delete u[t], + e.load()); + }), + h(o); } - , - Howl.prototype.pos = function(e, i, n, r) { - var o = this; - if (!o._webAudio) - return o; - if ("loaded" !== o._state) - return o._queue.push({ - event: "pos", - action: function() { - o.pos(e, i, n, r) - } - }), - o; - if (i = "number" != typeof i ? 0 : i, - n = "number" != typeof n ? -.5 : n, - void 0 === r) { - if ("number" != typeof e) - return o._pos; - o._pos = [e, i, n] - } - for (var a = o._getSoundIds(r), s = 0; s < a.length; s++) { - var c = o._soundById(a[s]); - if (c) { - if ("number" != typeof e) - return c._pos; - c._pos = [e, i, n], - c._node && (c._panner && !c._panner.pan || t(c, "spatial"), - void 0 !== c._panner.positionX ? (c._panner.positionX.setValueAtTime(e, Howler.ctx.currentTime), - c._panner.positionY.setValueAtTime(i, Howler.ctx.currentTime), - c._panner.positionZ.setValueAtTime(n, Howler.ctx.currentTime)) : c._panner.setOrientation(e, i, n)), - o._emit("pos", c._id) - } - } - return o + }, + h = function (e) { + try { + e.send(); + } catch (t) { + e.onerror(); } - , - Howl.prototype.orientation = function(e, i, n, r) { - var o = this; - if (!o._webAudio) - return o; - if ("loaded" !== o._state) - return o._queue.push({ - event: "orientation", - action: function() { - o.orientation(e, i, n, r) - } - }), - o; - if (i = "number" != typeof i ? o._orientation[1] : i, - n = "number" != typeof n ? o._orientation[2] : n, - void 0 === r) { - if ("number" != typeof e) - return o._orientation; - o._orientation = [e, i, n] + }, + f = function (e, t) { + var n = function () { + t._emit("loaderror", null, "Decoding audio data failed."); + }, + r = function (e) { + e && t._sounds.length > 0 ? ((u[t._src] = e), d(t, e)) : n(); + }; + void 0 !== i && 1 === a.ctx.decodeAudioData.length + ? a.ctx.decodeAudioData(e).then(r).catch(n) + : a.ctx.decodeAudioData(e, r, n); + }, + d = function (e, t) { + t && !e._duration && (e._duration = t.duration), + 0 === Object.keys(e._sprite).length && + (e._sprite = { + __default: [0, 1e3 * e._duration], + }), + "loaded" !== e._state && + ((e._state = "loaded"), e._emit("load"), e._loadQueue()); + }, + p = function () { + try { + "undefined" != typeof AudioContext + ? (a.ctx = new AudioContext()) + : "undefined" != typeof webkitAudioContext + ? (a.ctx = new webkitAudioContext()) + : (a.usingWebAudio = false); + } catch (e) { + a.usingWebAudio = false; + } + var e = /iP(hone|od|ad)/.test( + a._navigator && a._navigator.platform + ), + t = + a._navigator && + a._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), + i = t ? parseInt(t[1], 10) : null; + if (e && i && i < 9) { + var n = /safari/.test( + a._navigator && a._navigator.userAgent.toLowerCase() + ); + ((a._navigator && a._navigator.standalone && !n) || + (a._navigator && !a._navigator.standalone && !n)) && + (a.usingWebAudio = false); + } + a.usingWebAudio && + ((a.masterGain = + void 0 === a.ctx.createGain + ? a.ctx.createGainNode() + : a.ctx.createGain()), + a.masterGain.gain.setValueAtTime( + a._muted ? 0 : 1, + a.ctx.currentTime + ), + a.masterGain.connect(a.ctx.destination)), + a._setup(); + }; + void 0 === + (r = function () { + return { + Howler: a, + Howl: s, + }; + }.apply(t, [])) || (e.exports = r), + (t.Howler = a), + (t.Howl = s), + "undefined" != typeof window + ? ((window.HowlerGlobal = o), + (window.Howler = a), + (window.Howl = s), + (window.Sound = c)) + : void 0 !== n && + ((n.HowlerGlobal = o), + (n.Howler = a), + (n.Howl = s), + (n.Sound = c)); + })(), + /*! + * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. + * + * howler.js v2.0.15 + * howlerjs.com + * + * (c) 2013-2018, James Simpson of GoldFire Studios + * goldfirestudios.com + * + * MIT License + */ + (function () { + "use strict"; + var e; + (HowlerGlobal.prototype._pos = [0, 0, 0]), + (HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0]), + (HowlerGlobal.prototype.stereo = function (e) { + if (!this.ctx || !this.ctx.listener) return this; + for (var t = this._howls.length - 1; t >= 0; t--) + this._howls[t].stereo(e); + return this; + }), + (HowlerGlobal.prototype.pos = function (e, t, i) { + return this.ctx && this.ctx.listener + ? ((t = "number" != typeof t ? this._pos[1] : t), + (i = "number" != typeof i ? this._pos[2] : i), + "number" != typeof e + ? this._pos + : ((this._pos = [e, t, i]), + void 0 !== this.ctx.listener.positionX + ? (this.ctx.listener.positionX.setTargetAtTime( + this._pos[0], + Howler.ctx.currentTime, + 0.1 + ), + this.ctx.listener.positionY.setTargetAtTime( + this._pos[1], + Howler.ctx.currentTime, + 0.1 + ), + this.ctx.listener.positionZ.setTargetAtTime( + this._pos[2], + Howler.ctx.currentTime, + 0.1 + )) + : this.ctx.listener.setPosition( + this._pos[0], + this._pos[1], + this._pos[2] + ), + this)) + : this; + }), + (HowlerGlobal.prototype.orientation = function (e, t, i, n, r, o) { + if (!this.ctx || !this.ctx.listener) return this; + var a = this._orientation; + return ( + (t = "number" != typeof t ? a[1] : t), + (i = "number" != typeof i ? a[2] : i), + (n = "number" != typeof n ? a[3] : n), + (r = "number" != typeof r ? a[4] : r), + (o = "number" != typeof o ? a[5] : o), + "number" != typeof e + ? a + : ((this._orientation = [e, t, i, n, r, o]), + void 0 !== this.ctx.listener.forwardX + ? (this.ctx.listener.forwardX.setTargetAtTime( + e, + Howler.ctx.currentTime, + 0.1 + ), + this.ctx.listener.forwardY.setTargetAtTime( + t, + Howler.ctx.currentTime, + 0.1 + ), + this.ctx.listener.forwardZ.setTargetAtTime( + i, + Howler.ctx.currentTime, + 0.1 + ), + this.ctx.listener.upX.setTargetAtTime( + e, + Howler.ctx.currentTime, + 0.1 + ), + this.ctx.listener.upY.setTargetAtTime( + t, + Howler.ctx.currentTime, + 0.1 + ), + this.ctx.listener.upZ.setTargetAtTime( + i, + Howler.ctx.currentTime, + 0.1 + )) + : this.ctx.listener.setOrientation(e, t, i, n, r, o), + this) + ); + }), + (Howl.prototype.init = + ((e = Howl.prototype.init), + function (t) { + return ( + (this._orientation = t.orientation || [1, 0, 0]), + (this._stereo = t.stereo || null), + (this._pos = t.pos || null), + (this._pannerAttr = { + coneInnerAngle: + void 0 !== t.coneInnerAngle ? t.coneInnerAngle : 360, + coneOuterAngle: + void 0 !== t.coneOuterAngle ? t.coneOuterAngle : 360, + coneOuterGain: + void 0 !== t.coneOuterGain ? t.coneOuterGain : 0, + distanceModel: + void 0 !== t.distanceModel ? t.distanceModel : "inverse", + maxDistance: void 0 !== t.maxDistance ? t.maxDistance : 1e4, + panningModel: + void 0 !== t.panningModel ? t.panningModel : "HRTF", + refDistance: void 0 !== t.refDistance ? t.refDistance : 1, + rolloffFactor: + void 0 !== t.rolloffFactor ? t.rolloffFactor : 1, + }), + (this._onstereo = t.onstereo + ? [ + { + fn: t.onstereo, + }, + ] + : []), + (this._onpos = t.onpos + ? [ + { + fn: t.onpos, + }, + ] + : []), + (this._onorientation = t.onorientation + ? [ + { + fn: t.onorientation, + }, + ] + : []), + e.call(this, t) + ); + })), + (Howl.prototype.stereo = function (e, i) { + var n = this; + if (!n._webAudio) return n; + if ("loaded" !== n._state) + return ( + n._queue.push({ + event: "stereo", + action: function () { + n.stereo(e, i); + }, + }), + n + ); + var r = + void 0 === Howler.ctx.createStereoPanner ? "spatial" : "stereo"; + if (void 0 === i) { + if ("number" != typeof e) return n._stereo; + (n._stereo = e), (n._pos = [e, 0, 0]); + } + for (var o = n._getSoundIds(i), a = 0; a < o.length; a++) { + var s = n._soundById(o[a]); + if (s) { + if ("number" != typeof e) return s._stereo; + (s._stereo = e), + (s._pos = [e, 0, 0]), + s._node && + ((s._pannerAttr.panningModel = "equalpower"), + (s._panner && s._panner.pan) || t(s, r), + "spatial" === r + ? void 0 !== s._panner.positionX + ? (s._panner.positionX.setValueAtTime( + e, + Howler.ctx.currentTime + ), + s._panner.positionY.setValueAtTime( + 0, + Howler.ctx.currentTime + ), + s._panner.positionZ.setValueAtTime( + 0, + Howler.ctx.currentTime + )) + : s._panner.setPosition(e, 0, 0) + : s._panner.pan.setValueAtTime( + e, + Howler.ctx.currentTime + )), + n._emit("stereo", s._id); } - for (var a = o._getSoundIds(r), s = 0; s < a.length; s++) { - var c = o._soundById(a[s]); - if (c) { - if ("number" != typeof e) - return c._orientation; - c._orientation = [e, i, n], - c._node && (c._panner || (c._pos || (c._pos = o._pos || [0, 0, -.5]), + } + return n; + }), + (Howl.prototype.pos = function (e, i, n, r) { + var o = this; + if (!o._webAudio) return o; + if ("loaded" !== o._state) + return ( + o._queue.push({ + event: "pos", + action: function () { + o.pos(e, i, n, r); + }, + }), + o + ); + if ( + ((i = "number" != typeof i ? 0 : i), + (n = "number" != typeof n ? -0.5 : n), + void 0 === r) + ) { + if ("number" != typeof e) return o._pos; + o._pos = [e, i, n]; + } + for (var a = o._getSoundIds(r), s = 0; s < a.length; s++) { + var c = o._soundById(a[s]); + if (c) { + if ("number" != typeof e) return c._pos; + (c._pos = [e, i, n]), + c._node && + ((c._panner && !c._panner.pan) || t(c, "spatial"), + void 0 !== c._panner.positionX + ? (c._panner.positionX.setValueAtTime( + e, + Howler.ctx.currentTime + ), + c._panner.positionY.setValueAtTime( + i, + Howler.ctx.currentTime + ), + c._panner.positionZ.setValueAtTime( + n, + Howler.ctx.currentTime + )) + : c._panner.setOrientation(e, i, n)), + o._emit("pos", c._id); + } + } + return o; + }), + (Howl.prototype.orientation = function (e, i, n, r) { + var o = this; + if (!o._webAudio) return o; + if ("loaded" !== o._state) + return ( + o._queue.push({ + event: "orientation", + action: function () { + o.orientation(e, i, n, r); + }, + }), + o + ); + if ( + ((i = "number" != typeof i ? o._orientation[1] : i), + (n = "number" != typeof n ? o._orientation[2] : n), + void 0 === r) + ) { + if ("number" != typeof e) return o._orientation; + o._orientation = [e, i, n]; + } + for (var a = o._getSoundIds(r), s = 0; s < a.length; s++) { + var c = o._soundById(a[s]); + if (c) { + if ("number" != typeof e) return c._orientation; + (c._orientation = [e, i, n]), + c._node && + (c._panner || + (c._pos || (c._pos = o._pos || [0, 0, -0.5]), t(c, "spatial")), - void 0 !== c._panner.orientationX ? (c._panner.orientationX.setValueAtTime(e, Howler.ctx.currentTime), - c._panner.orientationY.setValueAtTime(i, Howler.ctx.currentTime), - c._panner.orientationZ.setValueAtTime(n, Howler.ctx.currentTime)) : c._panner.setOrientation(e, i, n)), - o._emit("orientation", c._id) - } + void 0 !== c._panner.orientationX + ? (c._panner.orientationX.setValueAtTime( + e, + Howler.ctx.currentTime + ), + c._panner.orientationY.setValueAtTime( + i, + Howler.ctx.currentTime + ), + c._panner.orientationZ.setValueAtTime( + n, + Howler.ctx.currentTime + )) + : c._panner.setOrientation(e, i, n)), + o._emit("orientation", c._id); } - return o - } - , - Howl.prototype.pannerAttr = function() { - var e, i, n, r = arguments; - if (!this._webAudio) - return this; - if (0 === r.length) - return this._pannerAttr; - if (1 === r.length) { - if ("object" !== o(r[0])) - return (n = this._soundById(parseInt(r[0], 10))) ? n._pannerAttr : this._pannerAttr; - e = r[0], - void 0 === i && (e.pannerAttr || (e.pannerAttr = { + } + return o; + }), + (Howl.prototype.pannerAttr = function () { + var e, + i, + n, + r = arguments; + if (!this._webAudio) return this; + if (0 === r.length) return this._pannerAttr; + if (1 === r.length) { + if ("object" !== o(r[0])) + return (n = this._soundById(parseInt(r[0], 10))) + ? n._pannerAttr + : this._pannerAttr; + (e = r[0]), + void 0 === i && + (e.pannerAttr || + (e.pannerAttr = { coneInnerAngle: e.coneInnerAngle, coneOuterAngle: e.coneOuterAngle, coneOuterGain: e.coneOuterGain, @@ -106550,1393 +144787,1634 @@ and limitations under the License. maxDistance: e.maxDistance, refDistance: e.refDistance, rolloffFactor: e.rolloffFactor, - panningModel: e.panningModel - }), - this._pannerAttr = { - coneInnerAngle: void 0 !== e.pannerAttr.coneInnerAngle ? e.pannerAttr.coneInnerAngle : this._coneInnerAngle, - coneOuterAngle: void 0 !== e.pannerAttr.coneOuterAngle ? e.pannerAttr.coneOuterAngle : this._coneOuterAngle, - coneOuterGain: void 0 !== e.pannerAttr.coneOuterGain ? e.pannerAttr.coneOuterGain : this._coneOuterGain, - distanceModel: void 0 !== e.pannerAttr.distanceModel ? e.pannerAttr.distanceModel : this._distanceModel, - maxDistance: void 0 !== e.pannerAttr.maxDistance ? e.pannerAttr.maxDistance : this._maxDistance, - refDistance: void 0 !== e.pannerAttr.refDistance ? e.pannerAttr.refDistance : this._refDistance, - rolloffFactor: void 0 !== e.pannerAttr.rolloffFactor ? e.pannerAttr.rolloffFactor : this._rolloffFactor, - panningModel: void 0 !== e.pannerAttr.panningModel ? e.pannerAttr.panningModel : this._panningModel - }) - } else - 2 === r.length && (e = r[0], - i = parseInt(r[1], 10)); - for (var a = this._getSoundIds(i), s = 0; s < a.length; s++) - if (n = this._soundById(a[s])) { - var c = n._pannerAttr; - c = { - coneInnerAngle: void 0 !== e.coneInnerAngle ? e.coneInnerAngle : c.coneInnerAngle, - coneOuterAngle: void 0 !== e.coneOuterAngle ? e.coneOuterAngle : c.coneOuterAngle, - coneOuterGain: void 0 !== e.coneOuterGain ? e.coneOuterGain : c.coneOuterGain, - distanceModel: void 0 !== e.distanceModel ? e.distanceModel : c.distanceModel, - maxDistance: void 0 !== e.maxDistance ? e.maxDistance : c.maxDistance, - refDistance: void 0 !== e.refDistance ? e.refDistance : c.refDistance, - rolloffFactor: void 0 !== e.rolloffFactor ? e.rolloffFactor : c.rolloffFactor, - panningModel: void 0 !== e.panningModel ? e.panningModel : c.panningModel - }; - var u = n._panner; - u ? (u.coneInnerAngle = c.coneInnerAngle, - u.coneOuterAngle = c.coneOuterAngle, - u.coneOuterGain = c.coneOuterGain, - u.distanceModel = c.distanceModel, - u.maxDistance = c.maxDistance, - u.refDistance = c.refDistance, - u.rolloffFactor = c.rolloffFactor, - u.panningModel = c.panningModel) : (n._pos || (n._pos = this._pos || [0, 0, -.5]), - t(n, "spatial")) - } - return this - } - , - Sound.prototype.init = function(e) { - return function() { - var t = this._parent; - this._orientation = t._orientation, - this._stereo = t._stereo, - this._pos = t._pos, - this._pannerAttr = t._pannerAttr, - e.call(this), - this._stereo ? t.stereo(this._stereo) : this._pos && t.pos(this._pos[0], this._pos[1], this._pos[2], this._id) + panningModel: e.panningModel, + }), + (this._pannerAttr = { + coneInnerAngle: + void 0 !== e.pannerAttr.coneInnerAngle + ? e.pannerAttr.coneInnerAngle + : this._coneInnerAngle, + coneOuterAngle: + void 0 !== e.pannerAttr.coneOuterAngle + ? e.pannerAttr.coneOuterAngle + : this._coneOuterAngle, + coneOuterGain: + void 0 !== e.pannerAttr.coneOuterGain + ? e.pannerAttr.coneOuterGain + : this._coneOuterGain, + distanceModel: + void 0 !== e.pannerAttr.distanceModel + ? e.pannerAttr.distanceModel + : this._distanceModel, + maxDistance: + void 0 !== e.pannerAttr.maxDistance + ? e.pannerAttr.maxDistance + : this._maxDistance, + refDistance: + void 0 !== e.pannerAttr.refDistance + ? e.pannerAttr.refDistance + : this._refDistance, + rolloffFactor: + void 0 !== e.pannerAttr.rolloffFactor + ? e.pannerAttr.rolloffFactor + : this._rolloffFactor, + panningModel: + void 0 !== e.pannerAttr.panningModel + ? e.pannerAttr.panningModel + : this._panningModel, + })); + } else 2 === r.length && ((e = r[0]), (i = parseInt(r[1], 10))); + for (var a = this._getSoundIds(i), s = 0; s < a.length; s++) + if ((n = this._soundById(a[s]))) { + var c = n._pannerAttr; + c = { + coneInnerAngle: + void 0 !== e.coneInnerAngle + ? e.coneInnerAngle + : c.coneInnerAngle, + coneOuterAngle: + void 0 !== e.coneOuterAngle + ? e.coneOuterAngle + : c.coneOuterAngle, + coneOuterGain: + void 0 !== e.coneOuterGain + ? e.coneOuterGain + : c.coneOuterGain, + distanceModel: + void 0 !== e.distanceModel + ? e.distanceModel + : c.distanceModel, + maxDistance: + void 0 !== e.maxDistance ? e.maxDistance : c.maxDistance, + refDistance: + void 0 !== e.refDistance ? e.refDistance : c.refDistance, + rolloffFactor: + void 0 !== e.rolloffFactor + ? e.rolloffFactor + : c.rolloffFactor, + panningModel: + void 0 !== e.panningModel + ? e.panningModel + : c.panningModel, + }; + var u = n._panner; + u + ? ((u.coneInnerAngle = c.coneInnerAngle), + (u.coneOuterAngle = c.coneOuterAngle), + (u.coneOuterGain = c.coneOuterGain), + (u.distanceModel = c.distanceModel), + (u.maxDistance = c.maxDistance), + (u.refDistance = c.refDistance), + (u.rolloffFactor = c.rolloffFactor), + (u.panningModel = c.panningModel)) + : (n._pos || (n._pos = this._pos || [0, 0, -0.5]), + t(n, "spatial")); } - }(Sound.prototype.init), - Sound.prototype.reset = function(e) { - return function() { - var t = this._parent; - return this._orientation = t._orientation, - this._stereo = t._stereo, - this._pos = t._pos, - this._pannerAttr = t._pannerAttr, - this._stereo ? t.stereo(this._stereo) : this._pos ? t.pos(this._pos[0], this._pos[1], this._pos[2], this._id) : this._panner && (this._panner.disconnect(0), - this._panner = void 0, - t._refreshBuffer(this)), - e.call(this) - } - }(Sound.prototype.reset); - var t = function(e, t) { - "spatial" === (t = t || "spatial") ? (e._panner = Howler.ctx.createPanner(), - e._panner.coneInnerAngle = e._pannerAttr.coneInnerAngle, - e._panner.coneOuterAngle = e._pannerAttr.coneOuterAngle, - e._panner.coneOuterGain = e._pannerAttr.coneOuterGain, - e._panner.distanceModel = e._pannerAttr.distanceModel, - e._panner.maxDistance = e._pannerAttr.maxDistance, - e._panner.refDistance = e._pannerAttr.refDistance, - e._panner.rolloffFactor = e._pannerAttr.rolloffFactor, - e._panner.panningModel = e._pannerAttr.panningModel, - void 0 !== e._panner.positionX ? (e._panner.positionX.setValueAtTime(e._pos[0], Howler.ctx.currentTime), - e._panner.positionY.setValueAtTime(e._pos[1], Howler.ctx.currentTime), - e._panner.positionZ.setValueAtTime(e._pos[2], Howler.ctx.currentTime)) : e._panner.setPosition(e._pos[0], e._pos[1], e._pos[2]), - void 0 !== e._panner.orientationX ? (e._panner.orientationX.setValueAtTime(e._orientation[0], Howler.ctx.currentTime), - e._panner.orientationY.setValueAtTime(e._orientation[1], Howler.ctx.currentTime), - e._panner.orientationZ.setValueAtTime(e._orientation[2], Howler.ctx.currentTime)) : e._panner.setOrientation(e._orientation[0], e._orientation[1], e._orientation[2])) : (e._panner = Howler.ctx.createStereoPanner(), - e._panner.pan.setValueAtTime(e._stereo, Howler.ctx.currentTime)), - e._panner.connect(e._node), - e._paused || e._parent.pause(e._id, true).play(e._id, true) - } - }() - } - ).call(this, i(41), i(15)) -} -, function(e, t, i) { + return this; + }), + (Sound.prototype.init = (function (e) { + return function () { + var t = this._parent; + (this._orientation = t._orientation), + (this._stereo = t._stereo), + (this._pos = t._pos), + (this._pannerAttr = t._pannerAttr), + e.call(this), + this._stereo + ? t.stereo(this._stereo) + : this._pos && + t.pos(this._pos[0], this._pos[1], this._pos[2], this._id); + }; + })(Sound.prototype.init)), + (Sound.prototype.reset = (function (e) { + return function () { + var t = this._parent; + return ( + (this._orientation = t._orientation), + (this._stereo = t._stereo), + (this._pos = t._pos), + (this._pannerAttr = t._pannerAttr), + this._stereo + ? t.stereo(this._stereo) + : this._pos + ? t.pos(this._pos[0], this._pos[1], this._pos[2], this._id) + : this._panner && + (this._panner.disconnect(0), + (this._panner = void 0), + t._refreshBuffer(this)), + e.call(this) + ); + }; + })(Sound.prototype.reset)); + var t = function (e, t) { + "spatial" === (t = t || "spatial") + ? ((e._panner = Howler.ctx.createPanner()), + (e._panner.coneInnerAngle = e._pannerAttr.coneInnerAngle), + (e._panner.coneOuterAngle = e._pannerAttr.coneOuterAngle), + (e._panner.coneOuterGain = e._pannerAttr.coneOuterGain), + (e._panner.distanceModel = e._pannerAttr.distanceModel), + (e._panner.maxDistance = e._pannerAttr.maxDistance), + (e._panner.refDistance = e._pannerAttr.refDistance), + (e._panner.rolloffFactor = e._pannerAttr.rolloffFactor), + (e._panner.panningModel = e._pannerAttr.panningModel), + void 0 !== e._panner.positionX + ? (e._panner.positionX.setValueAtTime( + e._pos[0], + Howler.ctx.currentTime + ), + e._panner.positionY.setValueAtTime( + e._pos[1], + Howler.ctx.currentTime + ), + e._panner.positionZ.setValueAtTime( + e._pos[2], + Howler.ctx.currentTime + )) + : e._panner.setPosition(e._pos[0], e._pos[1], e._pos[2]), + void 0 !== e._panner.orientationX + ? (e._panner.orientationX.setValueAtTime( + e._orientation[0], + Howler.ctx.currentTime + ), + e._panner.orientationY.setValueAtTime( + e._orientation[1], + Howler.ctx.currentTime + ), + e._panner.orientationZ.setValueAtTime( + e._orientation[2], + Howler.ctx.currentTime + )) + : e._panner.setOrientation( + e._orientation[0], + e._orientation[1], + e._orientation[2] + )) + : ((e._panner = Howler.ctx.createStereoPanner()), + e._panner.pan.setValueAtTime( + e._stereo, + Howler.ctx.currentTime + )), + e._panner.connect(e._node), + e._paused || e._parent.pause(e._id, true).play(e._id, true); + }; + })(); + }.call(this, i(41), i(15))); + }, + function (e, t, i) { "use strict"; - e.exports = function() { - return function() { - var e = 2 - , t = window.innerWidth - , i = window.innerHeight - , n = document.createElement("canvas"); - n.width = t, - n.height = i; - var r = n.getContext("2d"); - r.imageSmoothingEnabled = false; - var o = document.getElementById("progress"); - o.appendChild(n), - o.style.width = t + "px", - o.style.height = i + "px"; - var a = document.createElement("canvas"); - a.width = 128, - a.height = 128; - var s = a.getContext("2d"); - s.imageSmoothingEnabled = false; - var c = 0 - , u = new Image; - u.onload = function() { - ++c >= 1 && (s.drawImage(this, 0, 0, 128, 128), - s.fillStyle = "rgba(0,0,0,0.7)", - s.fillRect(0, 0, 128, 128), - l = r.createPattern(a, "repeat"), - h.redraw()) - } - , - u.src = "assets/textures/dirt.png"; - var l = r.createPattern(a, "repeat") - , h = { - headline: "Generating level", - task: "", - percent: 0, - isOpen: true, - show: function() { - h.isOpen = true, - h.redraw(), - o.style.display = "block" - }, - hide: function() { - h.isOpen = false, - o.style.display = "none" - }, - tick: function() { - h.redraw() - }, - redraw: function() { - r.clearRect(0, 0, t, i), - r.fillStyle = "rgb(0,0,0)", - r.fillStyle = l, - r.fillRect(0, 0, t, i); - var n = Math.floor(.5 * i) - 25 * e - , o = Math.floor(.5 * t); - r.font = 14 * e + "px Minecraft", - r.textBaseline = "alphabetic", - r.textAlign = "center"; - var a = 2 * e; - r.fillStyle = "rgb(63,63,63)", - r.fillText(h.headline, o + a, n + a), - r.fillText(h.task, o + a, n + 50 * e + a), - r.fillStyle = "rgb(255,255,255)", - r.fillText(h.headline, o, n), - r.fillText(h.task, o, n + 50 * e), - r.fillStyle = "rgb(128,128,128)", - r.fillRect(o - 100 * e, n + 60 * e, 200 * e, 4 * e); - var s = Math.min(1, h.percent / 100); - r.fillStyle = "rgb(128,255,128)", - r.fillRect(o - 100 * e, n + 60 * e, Math.round(200 * s) * e, 4 * e) - }, - resize: function() { - if (h.isOpen) { - e = 2, - window.innerHeight < 600 && (e = 1), - t = window.innerWidth, - i = window.innerHeight, - n.width = t, - n.height = i, - o.style.width = t + "px", - o.style.height = i + "px", - r.imageSmoothingEnabled = false, - h.redraw() - } + e.exports = function () { + return (function () { + var e = 2, + t = window.innerWidth, + i = window.innerHeight, + n = document.createElement("canvas"); + (n.width = t), (n.height = i); + var r = n.getContext("2d"); + r.imageSmoothingEnabled = false; + var o = document.getElementById("progress"); + o.appendChild(n), + (o.style.width = t + "px"), + (o.style.height = i + "px"); + var a = document.createElement("canvas"); + (a.width = 128), (a.height = 128); + var s = a.getContext("2d"); + s.imageSmoothingEnabled = false; + var c = 0, + u = new Image(); + (u.onload = function () { + ++c >= 1 && + (s.drawImage(this, 0, 0, 128, 128), + (s.fillStyle = "rgba(0,0,0,0.7)"), + s.fillRect(0, 0, 128, 128), + (l = r.createPattern(a, "repeat")), + h.redraw()); + }), + (u.src = "assets/textures/dirt.png"); + var l = r.createPattern(a, "repeat"), + h = { + headline: "Generating level", + task: "", + percent: 0, + isOpen: true, + show: function () { + (h.isOpen = true), h.redraw(), (o.style.display = "block"); + }, + hide: function () { + (h.isOpen = false), (o.style.display = "none"); + }, + tick: function () { + h.redraw(); + }, + redraw: function () { + r.clearRect(0, 0, t, i), + (r.fillStyle = "rgb(0,0,0)"), + (r.fillStyle = l), + r.fillRect(0, 0, t, i); + var n = Math.floor(0.5 * i) - 25 * e, + o = Math.floor(0.5 * t); + (r.font = 14 * e + "px Minecraft"), + (r.textBaseline = "alphabetic"), + (r.textAlign = "center"); + var a = 2 * e; + (r.fillStyle = "rgb(63,63,63)"), + r.fillText(h.headline, o + a, n + a), + r.fillText(h.task, o + a, n + 50 * e + a), + (r.fillStyle = "rgb(255,255,255)"), + r.fillText(h.headline, o, n), + r.fillText(h.task, o, n + 50 * e), + (r.fillStyle = "rgb(128,128,128)"), + r.fillRect(o - 100 * e, n + 60 * e, 200 * e, 4 * e); + var s = Math.min(1, h.percent / 100); + (r.fillStyle = "rgb(128,255,128)"), + r.fillRect( + o - 100 * e, + n + 60 * e, + Math.round(200 * s) * e, + 4 * e + ); + }, + resize: function () { + if (h.isOpen) { + (e = 2), + window.innerHeight < 600 && (e = 1), + (t = window.innerWidth), + (i = window.innerHeight), + (n.width = t), + (n.height = i), + (o.style.width = t + "px"), + (o.style.height = i + "px"), + (r.imageSmoothingEnabled = false), + h.redraw(); + } + }, + }; + return h.resize(), h.hide(), h; + })(hotbar); + }; + }, + function (e, t, i) { + "use strict"; + e.exports = function (e) { + return (function (e) { + var t = 0, + i = [2, 3, 4, 9, 11, 12, 13, 14, 15], + n = 3, + r = document.createElement("canvas"); + (r.width = 184 * n), (r.height = 24 * n); + var o = r.getContext("2d"); + o.imageSmoothingEnabled = false; + var a = document.getElementById("hotbar"); + a.appendChild(r), + (a.style.width = 184 * n + "px"), + (a.style.marginLeft = -184 * n * 0.5 + "px"); + var s = 0, + c = 0, + u = function () { + ++s >= c && g.redraw(); + }, + l = new Image(); + (l.onload = u), (l.src = "assets/textures/hotbar_bg.png"); + var h = new Image(); + (h.onload = u), (h.src = "assets/textures/hotbar_selection.png"); + var f = [ + 2, 9, 3, 4, 13, 14, 8, 6, 5, 16, 15, 11, 12, 23, 22, 21, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + ], + d = []; + c = f.length + 2; + for (var p = 0; p < f.length; p++) { + var m = new Image(); + (m.onload = u), + (m.src = "assets/textures/previews/" + f[p] + ".png"), + (d[f[p]] = m); + } + e.on("tick", function (n) { + var r = noa.inputs.state.scrolly; + if (!(Math.abs(r) < 200)) { + noa.inputs.state.scrolly = 0; + var o = r > 0 ? -1 : 1, + a = t - o; + a < 0 && (a = 8), + a > 8 && (a = 0), + (t = a), + g.redraw(), + (g.currentId = i[t]), + e.emit("setPreviewBlock", g.currentId); + } + }); + var g = { + currentId: i[t], + setIndex: function (e) { + e < 0 || e > 8 || ((t = e), (this.currentId = i[t]), this.redraw()); + }, + swap: function (n, r) { + var o = r || t; + null == r && this.checkExistingSwap(n, i[o], o), + (i[o] = n), + null == r && + ((this.currentId = i[t]), e.emit("setPreviewBlock", n)), + this.redraw(); + }, + checkExistingSwap: function (e, t, n) { + for (var r = 0; r < i.length; r++) + if (r != n) { + var o = i[r]; + if (o == e) { + this.swap(t, r); + break; } + } + }, + pick: function (e) { + for (var t = false, n = 0; n < i.length; n++) { + var r = i[n]; + if (r == e) { + this.setIndex(n), (t = true); + break; + } + } + t ? this.redraw() : this.swap(e); + }, + redraw: function () { + o.clearRect(0, 0, 184 * n, 24 * n), + o.drawImage(l, 1 * n, 1 * n, 182 * n, 22 * n); + for (var e = 0; e < i.length; e++) { + var r = d[i[e]], + a = e * (20 * n) + 4 * n; + o.drawImage(r, a, 4 * n, 16 * n, 16 * n); + } + var a = t * (20 * n); + o.drawImage(h, a, 0, 24 * n, 24 * n); + }, + resize: function () { + var e = n; + (n = 3), + window.innerHeight < 600 && (n = 2), + n != e && + ((r.width = 184 * n), + (r.height = 24 * n), + (a.style.width = 184 * n + "px"), + (a.style.marginLeft = -184 * n * 0.5 + "px"), + (o.imageSmoothingEnabled = false), + g.redraw()); + }, + }; + return g.resize(), g; + })(e); + }; + }, + function (e, t, i) { + "use strict"; + e.exports = function (e) { + return (function (e) { + var t = 1, + i = false, + n = { + x: 0, + y: 0, + }, + r = { + x: 0, + y: 0, + }, + o = document.createElement("canvas"); + (o.width = 480 * t), (o.height = 300 * t); + var a = o.getContext("2d"); + a.imageSmoothingEnabled = false; + var s = document.getElementById("previewWindow"); + s.appendChild(o), + (s.style.width = 480 * t + "px"), + (s.style.height = 300 * t + "px"); + var c = 0, + u = 0, + l = function () { + ++c >= u && m.redraw(); + }, + h = [ + 2, 9, 3, 4, 13, 14, 8, 6, 5, 16, 15, 11, 12, 23, 22, 21, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + ], + f = []; + u = h.length; + for (var d = 0; d < h.length; d++) { + var p = new Image(); + (p.onload = l), + (p.src = "assets/textures/previews/" + h[d] + ".png"), + (f[d] = p); + } + var m = { + isOpen: false, + open: function () { + (i = false), + m.redraw(), + (s.style.display = "block"), + s.addEventListener("mousemove", this.mousemove, false), + document.addEventListener("mousedown", this.select, false), + document.exitPointerLock(), + (m.isOpen = true); + }, + close: function () { + (s.style.display = "none"), + s.removeEventListener("mousemove", this.mousemove), + document.removeEventListener("mousedown", this.select); + var e = document.getElementById("noa-container"); + null != e && e.requestPointerLock(), (m.isOpen = false); + }, + mousemove: function (e) { + var o = (function (e) { + var t = e.target, + i = 0, + n = 0; + for (; t && !isNaN(t.offsetLeft) && !isNaN(t.offsetTop); ) + (i += t.offsetLeft - t.scrollLeft), + (n += t.offsetTop - t.scrollTop), + (t = t.offsetParent); + return ( + (i = e.clientX - i), + (n = e.clientY - n), + { + x: i, + y: n, + } + ); + })(e), + a = o.x, + s = o.y, + c = Math.floor((a + 8 * t) / (50 * t)) - 1, + u = Math.floor((s + 32 * t) / (50 * t)) - 2; + c < 0 || c > 7 || u < 0 || u > 3 + ? i && ((i = false), (n.x = null), (n.y = null), m.redraw()) + : ((r.x = n.x), + (r.y = n.y), + (i = true), + (n.x = c), + (n.y = u), + (n.x == r.x && n.y == r.y) || m.redraw()); + }, + select: function (t) { + if ((m.close(), i)) { + var r = 8 * n.y + n.x, + o = h[r]; + e.swap(o); + } + }, + redraw: function () { + a.clearRect(0, 0, 480 * t, 300 * t), + (a.fillStyle = "rgba(0,0,0,0.6)"), + a.fillRect(0, 0, 480 * t, 300 * t), + (function (e, i, n) { + (a.font = 16 * t + "px Minecraft"), + (a.textBaseline = "alphabetic"), + (a.textAlign = "center"); + var r = 2 * t; + (a.fillStyle = "rgb(63,63,63)"), + a.fillText(e, i + r, n + r), + (a.fillStyle = "rgb(255,255,255)"), + a.fillText(e, i, n); + })("Select block", 480 * t * 0.5, 40 * t); + var e = 48 * t, + r = 82 * t, + o = null; + if (i) { + a.fillStyle = "rgba(255,255,255,0.6)"; + var s = n.x * (50 * t) + e - 10 * t, + c = n.y * (50 * t) + r - 10 * t; + a.fillRect(s, c, 52 * t, 52 * t), (o = 8 * n.y + n.x); + } + for (var s = 0, c = 0, u = 0; u < h.length; u++) { + var l = f[u], + d = 32, + p = 0; + u == o && ((d = 52), (p = 10)); + var m = s * (50 * t) + e - p * t, + g = c * (50 * t) + r - p * t; + a.drawImage(l, m, g, d * t, d * t), ++s >= 8 && (++c, (s = 0)); + } + }, + resize: function () { + var e = t; + (t = 2), + window.innerHeight < 900 && (t = 1), + t != e && + ((o.width = 480 * t), + (o.height = 300 * t), + (s.style.width = 480 * t + "px"), + (s.style.height = 300 * t + "px"), + (a.imageSmoothingEnabled = false), + m.redraw()); + }, + }; + return m.close(), m.resize(), m; + })(e); + }; + }, + function (e, t, i) { + "use strict"; + var n = i(7).default, + r = i(136).default, + o = i(190); + e.exports = function (e, t) { + return (function (e, t, i) { + var r = 2, + a = r + 1, + s = window.innerWidth, + c = window.innerHeight, + u = null, + l = Math.floor(0.5 * c) - 120 * r, + h = Math.floor(0.5 * s), + f = null, + d = false, + p = document.createElement("canvas"); + (p.width = s), (p.height = c); + var m = p.getContext("2d"); + m.imageSmoothingEnabled = false; + var g = document.getElementById("menu"); + g.appendChild(p), + (g.style.width = s + "px"), + (g.style.height = c + "px"); + var _ = new t().isWebRTCSupported, + v = new URLSearchParams(window.location.search), + y = window.location.href; + v.has("size") && v.delete("size"); + if (v.has("host")) { + y = window.location.href.split("?")[0]; + var b = v.get("host"); + v.delete("host"), v.append("join", b), (y += "?" + v.toString()); + } + document.querySelector(".js-copytextarea").value = y; + var E = new Image(); + E.src = "assets/textures/button.png"; + var T = new Image(); + T.src = "assets/textures/button_over.png"; + var A = function (e, t, i, n) { + (m.font = 12 * r + "px Minecraft"), + (m.textBaseline = "alphabetic"), + (m.textAlign = "center"); + var o = 2 * r; + (m.fillStyle = "rgb(63,63,63)"), + m.fillText(e, t + o, i + o), + (m.fillStyle = n || "rgb(255,255,255)"), + m.fillText(e, t, i); + }, + x = function (e, t, i, n) { + return { + str: e, + x: t, + y: i, + over: false, + func: n, + widthscale: 1, + key: null, + draw: function () { + var e = E; + this.over && (e = T), + m.drawImage( + e, + h + this.x * r - 0.5 * E.width * a * this.widthscale, + l + this.y * r, + E.width * a * this.widthscale, + E.height * a + ); + var t = "rgb(255,255,255)"; + this.over && (t = "rgb(255,255,160)"), + A(this.str, h + this.x * r, l + this.y * r + 19 * r, t); + }, }; - return h.resize(), - h.hide(), - h - }(hotbar) - } -} -, function(e, t, i) { - "use strict"; - e.exports = function(e) { - return function(e) { - var t = 0 - , i = [2, 3, 4, 9, 11, 12, 13, 14, 15] - , n = 3 - , r = document.createElement("canvas"); - r.width = 184 * n, - r.height = 24 * n; - var o = r.getContext("2d"); - o.imageSmoothingEnabled = false; - var a = document.getElementById("hotbar"); - a.appendChild(r), - a.style.width = 184 * n + "px", - a.style.marginLeft = -184 * n * .5 + "px"; - var s = 0 - , c = 0 - , u = function() { - ++s >= c && g.redraw() - } - , l = new Image; - l.onload = u, - l.src = "assets/textures/hotbar_bg.png"; - var h = new Image; - h.onload = u, - h.src = "assets/textures/hotbar_selection.png"; - var f = [2, 9, 3, 4, 13, 14, 8, 6, 5, 16, 15, 11, 12, 23, 22, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39] - , d = []; - c = f.length + 2; - for (var p = 0; p < f.length; p++) { - var m = new Image; - m.onload = u, - m.src = "assets/textures/previews/" + f[p] + ".png", - d[f[p]] = m - } - e.on("tick", function(n) { - var r = noa.inputs.state.scrolly; - if (!(Math.abs(r) < 200)) { - noa.inputs.state.scrolly = 0; - var o = r > 0 ? -1 : 1 - , a = t - o; - a < 0 && (a = 8), - a > 8 && (a = 0), - t = a, - g.redraw(), - g.currentId = i[t], - e.emit("setPreviewBlock", g.currentId) - } - }); - var g = { - currentId: i[t], - setIndex: function(e) { - e < 0 || e > 8 || (t = e, - this.currentId = i[t], - this.redraw()) - }, - swap: function(n, r) { - var o = r || t; - null == r && this.checkExistingSwap(n, i[o], o), - i[o] = n, - null == r && (this.currentId = i[t], - e.emit("setPreviewBlock", n)), - this.redraw() - }, - checkExistingSwap: function(e, t, n) { - for (var r = 0; r < i.length; r++) - if (r != n) { - var o = i[r]; - if (o == e) { - this.swap(t, r); - break - } - } - }, - pick: function(e) { - for (var t = false, n = 0; n < i.length; n++) { - var r = i[n]; - if (r == e) { - this.setIndex(n), - t = true; - break - } - } - t ? this.redraw() : this.swap(e) - }, - redraw: function() { - o.clearRect(0, 0, 184 * n, 24 * n), - o.drawImage(l, 1 * n, 1 * n, 182 * n, 22 * n); - for (var e = 0; e < i.length; e++) { - var r = d[i[e]] - , a = e * (20 * n) + 4 * n; - o.drawImage(r, a, 4 * n, 16 * n, 16 * n) - } - var a = t * (20 * n); - o.drawImage(h, a, 0, 24 * n, 24 * n) - }, - resize: function() { - var e = n; - n = 3, - window.innerHeight < 600 && (n = 2), - n != e && (r.width = 184 * n, - r.height = 24 * n, - a.style.width = 184 * n + "px", - a.style.marginLeft = -184 * n * .5 + "px", - o.imageSmoothingEnabled = false, - g.redraw()) - } - }; - return g.resize(), - g - }(e) - } -} -, function(e, t, i) { - "use strict"; - e.exports = function(e) { - return function(e) { - var t = 1 - , i = false - , n = { - x: 0, - y: 0 - } - , r = { - x: 0, - y: 0 - } - , o = document.createElement("canvas"); - o.width = 480 * t, - o.height = 300 * t; - var a = o.getContext("2d"); - a.imageSmoothingEnabled = false; - var s = document.getElementById("previewWindow"); - s.appendChild(o), - s.style.width = 480 * t + "px", - s.style.height = 300 * t + "px"; - var c = 0 - , u = 0 - , l = function() { - ++c >= u && m.redraw() - } - , h = [2, 9, 3, 4, 13, 14, 8, 6, 5, 16, 15, 11, 12, 23, 22, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39] - , f = []; - u = h.length; - for (var d = 0; d < h.length; d++) { - var p = new Image; - p.onload = l, - p.src = "assets/textures/previews/" + h[d] + ".png", - f[d] = p - } - var m = { - isOpen: false, - open: function() { - i = false, - m.redraw(), - s.style.display = "block", - s.addEventListener("mousemove", this.mousemove, false), - document.addEventListener("mousedown", this.select, false), - document.exitPointerLock(), - m.isOpen = true - }, - close: function() { - s.style.display = "none", - s.removeEventListener("mousemove", this.mousemove), - document.removeEventListener("mousedown", this.select); - var e = document.getElementById("noa-container"); - null != e && e.requestPointerLock(), - m.isOpen = false - }, - mousemove: function(e) { - var o = function(e) { - var t = e.target - , i = 0 - , n = 0; - for (; t && !isNaN(t.offsetLeft) && !isNaN(t.offsetTop); ) - i += t.offsetLeft - t.scrollLeft, - n += t.offsetTop - t.scrollTop, - t = t.offsetParent; - return i = e.clientX - i, - n = e.clientY - n, - { - x: i, - y: n - } - }(e) - , a = o.x - , s = o.y - , c = Math.floor((a + 8 * t) / (50 * t)) - 1 - , u = Math.floor((s + 32 * t) / (50 * t)) - 2; - c < 0 || c > 7 || u < 0 || u > 3 ? i && (i = false, - n.x = null, - n.y = null, - m.redraw()) : (r.x = n.x, - r.y = n.y, - i = true, - n.x = c, - n.y = u, - n.x == r.x && n.y == r.y || m.redraw()) - }, - select: function(t) { - if (m.close(), - i) { - var r = 8 * n.y + n.x - , o = h[r]; - e.swap(o) - } - }, - redraw: function() { - a.clearRect(0, 0, 480 * t, 300 * t), - a.fillStyle = "rgba(0,0,0,0.6)", - a.fillRect(0, 0, 480 * t, 300 * t), - function(e, i, n) { - a.font = 16 * t + "px Minecraft", - a.textBaseline = "alphabetic", - a.textAlign = "center"; - var r = 2 * t; - a.fillStyle = "rgb(63,63,63)", - a.fillText(e, i + r, n + r), - a.fillStyle = "rgb(255,255,255)", - a.fillText(e, i, n) - }("Select block", 480 * t * .5, 40 * t); - var e = 48 * t - , r = 82 * t - , o = null; - if (i) { - a.fillStyle = "rgba(255,255,255,0.6)"; - var s = n.x * (50 * t) + e - 10 * t - , c = n.y * (50 * t) + r - 10 * t; - a.fillRect(s, c, 52 * t, 52 * t), - o = 8 * n.y + n.x - } - for (var s = 0, c = 0, u = 0; u < h.length; u++) { - var l = f[u] - , d = 32 - , p = 0; - u == o && (d = 52, - p = 10); - var m = s * (50 * t) + e - p * t - , g = c * (50 * t) + r - p * t; - a.drawImage(l, m, g, d * t, d * t), - ++s >= 8 && (++c, - s = 0) - } - }, - resize: function() { - var e = t; - t = 2, - window.innerHeight < 900 && (t = 1), - t != e && (o.width = 480 * t, - o.height = 300 * t, - s.style.width = 480 * t + "px", - s.style.height = 300 * t + "px", - a.imageSmoothingEnabled = false, - m.redraw()) - } - }; - return m.close(), - m.resize(), - m - }(e) - } -} -, function(e, t, i) { - "use strict"; - var n = i(7).default - , r = i(136).default - , o = i(190); - e.exports = function(e, t) { - return function(e, t, i) { - var r = 2 - , a = r + 1 - , s = window.innerWidth - , c = window.innerHeight - , u = null - , l = Math.floor(.5 * c) - 120 * r - , h = Math.floor(.5 * s) - , f = null - , d = false - , p = document.createElement("canvas"); - p.width = s, - p.height = c; - var m = p.getContext("2d"); - m.imageSmoothingEnabled = false; - var g = document.getElementById("menu"); - g.appendChild(p), - g.style.width = s + "px", - g.style.height = c + "px"; - var _ = (new t).isWebRTCSupported - , v = new URLSearchParams(window.location.search) - , y = window.location.href; - v.has("size") && v.delete("size"); - if (v.has("host")) { - y = window.location.href.split("?")[0]; - var b = v.get("host"); - v.delete("host"), - v.append("join", b), - y += "?" + v.toString() - } - document.querySelector(".js-copytextarea").value = y; - var E = new Image; - E.src = "assets/textures/button.png"; - var T = new Image; - T.src = "assets/textures/button_over.png"; - var A = function(e, t, i, n) { - m.font = 12 * r + "px Minecraft", - m.textBaseline = "alphabetic", - m.textAlign = "center"; - var o = 2 * r; - m.fillStyle = "rgb(63,63,63)", - m.fillText(e, t + o, i + o), - m.fillStyle = n || "rgb(255,255,255)", - m.fillText(e, t, i) - } - , x = function(e, t, i, n) { - return { - str: e, - x: t, - y: i, - over: false, - func: n, - widthscale: 1, - key: null, - draw: function() { - var e = E; - this.over && (e = T), - m.drawImage(e, h + this.x * r - .5 * E.width * a * this.widthscale, l + this.y * r, E.width * a * this.widthscale, E.height * a); - var t = "rgb(255,255,255)"; - this.over && (t = "rgb(255,255,160)"), - A(this.str, h + this.x * r, l + this.y * r + 19 * r, t) - } - } - } - , S = function() { - F = B, + }, + S = function () { + (F = B), _e.redraw(), (u = null); + }, + C = function () { + null != f && (O(), (f = null)); + var t = "FAR"; + 1 == e.settings.drawDistance && (t = "NORMAL"), + 2 == e.settings.drawDistance && (t = "SHORT"), + 3 == e.settings.drawDistance && (t = "TINY"), + (q.str = "Render distance: " + t), + (F = H), + _e.redraw(), + (u = null); + }; + function P() { + var e = document.querySelector(".js-copytextarea"); + e.focus(), + e.select(), + (d = true), + _e.redraw(), + setTimeout(function () { + (d = false), _e.redraw(); + }, 250); + try { + document.execCommand("copy"); + } catch (e) {} + } + var R = function (e) { + var t = new URLSearchParams(window.location.search), + i = window.location.href.split("?")[0]; + t.has("size") ? t.set("size", e) : t.append("size", e), + t.has("join") && t.delete("join"), + n.getInstance().clearData(); + var r = 128; + "small" == e && (r = 128), + "normal" == e && (r = 256), + "huge" == e && (r = 512), + n.getInstance().setWorldSize(r), + (i += "?" + t.toString()), + (window.location.href = i); + }, + M = function () { + null != f && O(), (f = u); + var e = F[u], + t = e.str, + i = "> " + t + " <"; + (e.str = i), (e.over = true), e.draw(), w(); + }, + O = function () { + var e = F[f], + t = e.str, + i = t.substring(2, t.length - 2); + (e.str = i), e.draw(), (f = null), I(); + }, + w = function () { + document.addEventListener("keydown", D, false); + }, + I = function () { + document.removeEventListener("keydown", D); + }, + D = function (t) { + var i = o[t.keyCode]; + !(function (t) { + var i = F[f].key; + e.inputs.unbind(i), + e.inputs.bind(i, t), + (e.settings[i] = t), + e.emit("saveSettings"); + })(i), + (function (e) { + var t = F[f]; + if (null == t.key) return void O(); + var i = t.str, + n = + i.substring(2, i.length - 2).split(":")[0] + + ": " + + e.toUpperCase(); + (t.str = n), t.draw(), (f = null), I(); + })((i = L(i))); + }; + function L(e) { + var t = e.indexOf(">"); + 0 == t && (e = e.substring(1, e.length)); + var i = e.lastIndexOf("<"); + return i == e.length - 1 && (e = e.substring(0, i)), e; + } + var F = null, + B = [], + N = x("Options...", 0, 20, C); + B.push(N); + var k = x("Generate new level...", 0, 60, function () { + (F = $), _e.redraw(), (u = null); + }); + if ((B.push(k), !_ || i)) { + var U = x("Save level..", 0, 100, function () { + (F = re), _e.redraw(), (u = null); + }); + B.push(U); + var V = x("Load level..", 0, 140, function () { + (F = oe), _e.redraw(), (u = null); + }); + B.push(V); + } else { + var G = x("Copy", 0, 140, P); + B.push(G); + var z = x("Copy Hidden", 0, 100, P); + B.push(z); + } + var j = x("Back to game", 0, 230, function () { + _e.close(); + }); + B.push(j); + var H = [], + W = "ON"; + e.settings.music || (W = "OFF"); + var X = x("Music: " + W, 0, -20, function () { + e.emit("toggleMusic"); + var t = "ON"; + e.settings.music || (t = "OFF"); + (X.str = "Music: " + t), (X.over = true), _e.redraw(); + }); + H.push(X); + var W = "ON"; + e.settings.sound || (W = "OFF"); + var Y = x("Sound: " + W, 0, 20, function () { + e.emit("toggleSound"); + var t = "ON"; + e.settings.sound || (t = "OFF"); + (Y.str = "Sound: " + t), (Y.over = true), _e.redraw(); + }); + H.push(Y); + var W = "ON"; + e.settings.invert || (W = "OFF"); + var K = x("Invert mouse: " + W, 0, 60, function () { + e.emit("toggleInvertMouse"); + var t = "ON"; + e.settings.invert || (t = "OFF"); + (K.str = "Invert mouse: " + t), (K.over = true), _e.redraw(); + }); + H.push(K); + var W = "ON"; + e.settings.fps || (W = "OFF"); + var Q = x("Show FPS: " + W, 0, 100, function () { + e.emit("toggleFps"); + var t = "ON"; + e.settings.fps || (t = "OFF"); + (Q.str = "Show FPS: " + t), (Q.over = true), _e.redraw(); + }); + H.push(Q); + var q = x("Render distance: FAR", 0, 140, function () { + e.emit("cycleDrawDistance"); + var t = "FAR"; + 1 == e.settings.drawDistance && (t = "NORMAL"); + 2 == e.settings.drawDistance && (t = "SHORT"); + 3 == e.settings.drawDistance && (t = "TINY"); + (q.str = "Render distance: " + t), (q.over = true), _e.redraw(); + }); + H.push(q); + var Z = x("Controls...", 0, 200, function () { + (F = ae), _e.redraw(), (u = null); + }); + H.push(Z); + var J = x("Done", 0, 260, S); + H.push(J); + var $ = [], + ee = x("Small", 0, 50, function () { + R("small"); + }); + $.push(ee); + var te = x("Normal", 0, 100, function () { + R("normal"); + }); + $.push(te); + var ie = x("Huge", 0, 150, function () { + R("huge"); + }); + $.push(ie); + var ne = x("Cancel", 0, 200, S); + $.push(ne); + var re = [], + ne = x("Cancel", 0, 260, S); + re.push(ne); + var oe = [], + ne = x("Cancel", 0, 260, S); + oe.push(ne); + var ae = [], + se = x( + "Forward: " + L(e.settings.forward).toUpperCase(), + -115, + -20, + M + ); + ae.push(se); + var ce = x("Left: " + L(e.settings.left).toUpperCase(), 115, -20, M); + ae.push(ce); + var j = x("Back: " + L(e.settings.backward).toUpperCase(), -115, 20, M); + ae.push(j); + var ue = x("Right: " + L(e.settings.right).toUpperCase(), 115, 20, M); + ae.push(ue); + var le = x("Jump: " + L(e.settings.jump).toUpperCase(), -115, 60, M); + ae.push(le); + var he = x("Build: " + L(e.settings.build).toUpperCase(), 115, 60, M); + ae.push(he); + var fe = x("Chat: " + L(e.settings.chat).toUpperCase(), -115, 100, M); + ae.push(fe); + var de = x( + "Toggle fog: " + L(e.settings.fog).toUpperCase(), + 115, + 100, + M + ); + ae.push(de); + var pe = x( + "Save location: " + L(e.settings.saveLoc).toUpperCase(), + -115, + 140, + M + ); + ae.push(pe); + var me = x( + "Load location: " + L(e.settings.loadLoc).toUpperCase(), + 115, + 140, + M + ); + ae.push(me); + (se.widthscale = 0.7), + (ce.widthscale = 0.7), + (j.widthscale = 0.7), + (ue.widthscale = 0.7), + (le.widthscale = 0.7), + (he.widthscale = 0.7), + (fe.widthscale = 0.7), + (de.widthscale = 0.7), + (pe.widthscale = 0.7), + (me.widthscale = 0.7), + (se.key = "forward"), + (ce.key = "left"), + (j.key = "backward"), + (ue.key = "right"), + (le.key = "jump"), + (he.key = "build"), + (fe.key = "chat"), + (de.key = "fog"), + (pe.key = "saveLoc"), + (me.key = "loadLoc"); + var J = x("Done", 0, 260, C); + ae.push(J), (F = B); + var ge = "ontouchstart" in window || navigator.msMaxTouchPoints, + _e = { + isOpen: false, + mouseIsOut: false, + open: function () { + ge || + ((F = B), _e.redraw(), - u = null - } - , C = function() { - null != f && (O(), - f = null); - var t = "FAR"; - 1 == e.settings.drawDistance && (t = "NORMAL"), - 2 == e.settings.drawDistance && (t = "SHORT"), - 3 == e.settings.drawDistance && (t = "TINY"), - q.str = "Render distance: " + t, - F = H, - _e.redraw(), - u = null - }; - function P() { - var e = document.querySelector(".js-copytextarea"); - e.focus(), - e.select(), - d = true, - _e.redraw(), - setTimeout(function() { - d = false, - _e.redraw() - }, 250); - try { - document.execCommand("copy") - } catch (e) {} - } - var R = function(e) { - var t = new URLSearchParams(window.location.search) - , i = window.location.href.split("?")[0]; - t.has("size") ? t.set("size", e) : t.append("size", e), - t.has("join") && t.delete("join"), - n.getInstance().clearData(); - var r = 128; - "small" == e && (r = 128), - "normal" == e && (r = 256), - "huge" == e && (r = 512), - n.getInstance().setWorldSize(r), - i += "?" + t.toString(), - window.location.href = i - } - , M = function() { - null != f && O(), - f = u; - var e = F[u] - , t = e.str - , i = "> " + t + " <"; - e.str = i, - e.over = true, - e.draw(), - w() - } - , O = function() { - var e = F[f] - , t = e.str - , i = t.substring(2, t.length - 2); - e.str = i, - e.draw(), - f = null, - I() - } - , w = function() { - document.addEventListener("keydown", D, false) - } - , I = function() { - document.removeEventListener("keydown", D) - } - , D = function(t) { - var i = o[t.keyCode]; - !function(t) { - var i = F[f].key; - e.inputs.unbind(i), - e.inputs.bind(i, t), - e.settings[i] = t, - e.emit("saveSettings") - }(i), - function(e) { - var t = F[f]; - if (null == t.key) - return void O(); - var i = t.str - , n = i.substring(2, i.length - 2).split(":")[0] + ": " + e.toUpperCase(); - t.str = n, - t.draw(), - f = null, - I() - }(i = L(i)) - }; - function L(e) { - var t = e.indexOf(">"); - 0 == t && (e = e.substring(1, e.length)); - var i = e.lastIndexOf("<"); - return i == e.length - 1 && (e = e.substring(0, i)), - e - } - var F = null - , B = [] - , N = x("Options...", 0, 20, C); - B.push(N); - var k = x("Generate new level...", 0, 60, function() { - F = $, - _e.redraw(), - u = null - }); - if (B.push(k), - !_ || i) { - var U = x("Save level..", 0, 100, function() { - F = re, - _e.redraw(), - u = null - }); - B.push(U); - var V = x("Load level..", 0, 140, function() { - F = oe, - _e.redraw(), - u = null - }); - B.push(V) - } else { - var G = x("Copy", 0, 140, P); - B.push(G); - var z = x("Copy Hidden", 0, 100, P); - B.push(z) - } - var j = x("Back to game", 0, 230, function() { - _e.close() - }); - B.push(j); - var H = [] - , W = "ON"; - e.settings.music || (W = "OFF"); - var X = x("Music: " + W, 0, -20, function() { - e.emit("toggleMusic"); - var t = "ON"; - e.settings.music || (t = "OFF"); - X.str = "Music: " + t, - X.over = true, - _e.redraw() - }); - H.push(X); - var W = "ON"; - e.settings.sound || (W = "OFF"); - var Y = x("Sound: " + W, 0, 20, function() { - e.emit("toggleSound"); - var t = "ON"; - e.settings.sound || (t = "OFF"); - Y.str = "Sound: " + t, - Y.over = true, - _e.redraw() - }); - H.push(Y); - var W = "ON"; - e.settings.invert || (W = "OFF"); - var K = x("Invert mouse: " + W, 0, 60, function() { - e.emit("toggleInvertMouse"); - var t = "ON"; - e.settings.invert || (t = "OFF"); - K.str = "Invert mouse: " + t, - K.over = true, - _e.redraw() - }); - H.push(K); - var W = "ON"; - e.settings.fps || (W = "OFF"); - var Q = x("Show FPS: " + W, 0, 100, function() { - e.emit("toggleFps"); - var t = "ON"; - e.settings.fps || (t = "OFF"); - Q.str = "Show FPS: " + t, - Q.over = true, - _e.redraw() - }); - H.push(Q); - var q = x("Render distance: FAR", 0, 140, function() { - e.emit("cycleDrawDistance"); - var t = "FAR"; - 1 == e.settings.drawDistance && (t = "NORMAL"); - 2 == e.settings.drawDistance && (t = "SHORT"); - 3 == e.settings.drawDistance && (t = "TINY"); - q.str = "Render distance: " + t, - q.over = true, - _e.redraw() - }); - H.push(q); - var Z = x("Controls...", 0, 200, function() { - F = ae, - _e.redraw(), - u = null - }); - H.push(Z); - var J = x("Done", 0, 260, S); - H.push(J); - var $ = [] - , ee = x("Small", 0, 50, function() { - R("small") - }); - $.push(ee); - var te = x("Normal", 0, 100, function() { - R("normal") - }); - $.push(te); - var ie = x("Huge", 0, 150, function() { - R("huge") - }); - $.push(ie); - var ne = x("Cancel", 0, 200, S); - $.push(ne); - var re = [] - , ne = x("Cancel", 0, 260, S); - re.push(ne); - var oe = [] - , ne = x("Cancel", 0, 260, S); - oe.push(ne); - var ae = [] - , se = x("Forward: " + L(e.settings.forward).toUpperCase(), -115, -20, M); - ae.push(se); - var ce = x("Left: " + L(e.settings.left).toUpperCase(), 115, -20, M); - ae.push(ce); - var j = x("Back: " + L(e.settings.backward).toUpperCase(), -115, 20, M); - ae.push(j); - var ue = x("Right: " + L(e.settings.right).toUpperCase(), 115, 20, M); - ae.push(ue); - var le = x("Jump: " + L(e.settings.jump).toUpperCase(), -115, 60, M); - ae.push(le); - var he = x("Build: " + L(e.settings.build).toUpperCase(), 115, 60, M); - ae.push(he); - var fe = x("Chat: " + L(e.settings.chat).toUpperCase(), -115, 100, M); - ae.push(fe); - var de = x("Toggle fog: " + L(e.settings.fog).toUpperCase(), 115, 100, M); - ae.push(de); - var pe = x("Save location: " + L(e.settings.saveLoc).toUpperCase(), -115, 140, M); - ae.push(pe); - var me = x("Load location: " + L(e.settings.loadLoc).toUpperCase(), 115, 140, M); - ae.push(me); - se.widthscale = .7, - ce.widthscale = .7, - j.widthscale = .7, - ue.widthscale = .7, - le.widthscale = .7, - he.widthscale = .7, - fe.widthscale = .7, - de.widthscale = .7, - pe.widthscale = .7, - me.widthscale = .7, - se.key = "forward", - ce.key = "left", - j.key = "backward", - ue.key = "right", - le.key = "jump", - he.key = "build", - fe.key = "chat", - de.key = "fog", - pe.key = "saveLoc", - me.key = "loadLoc"; - var J = x("Done", 0, 260, C); - ae.push(J), - F = B; - var ge = "ontouchstart"in window || navigator.msMaxTouchPoints - , _e = { - isOpen: false, - mouseIsOut: false, - open: function() { - ge || (F = B, - _e.redraw(), - g.style.display = "block", - g.addEventListener("mousemove", this.mousemove, false), - g.addEventListener("mouseout", this.mouseout), - document.addEventListener("mousedown", this.press, false), - document.exitPointerLock(), - _e.isOpen = true, - e.inputs.state.active = false) - }, - close: function(t) { - if (!ge) { - if (null != f && (O(), - f = null), - g.style.display = "none", - g.removeEventListener("mousemove", this.mousemove), - g.removeEventListener("mouseout", this.mouseout), - document.removeEventListener("mousedown", this.press), - !t) { - var i = document.getElementById("noa-container"); - setTimeout(function() { - null == i || _e.mouseIsOut || i.requestPointerLock() - }, 200) - } - _e.isOpen = false, - e.inputs.state.active = true - } - }, - mouseout: function(e) { - _e.mouseIsOut = true - }, - mousemove: function(e) { - _e.mouseIsOut = false; - for (var t = e.layerX, i = e.layerY, n = null, o = 0; o < F.length; o++) { - var s = F[o]; - s.over = false; - var c = h + s.x * r - .5 * E.width * a - , f = l + s.y * r - , d = c + E.width * a - , p = f + E.height * a; - if (t > c && t < d && i > f && i < p) { - n = o; - break - } - } - null != n && n != u && (F[n].over = true, - _e.redraw()), - null == n && null != u && (F[u].over = false, - _e.redraw()), - u = n - }, - press: function(e) { - if (null != F[u]) { - var t = F[u].func; - null != t && t() - } - }, - redraw: function() { - m.clearRect(0, 0, s, c), - m.strokeStyle = "rgba(255,255,255,1)", - m.lineWidth = r, - m.fillStyle = "rgba(0,0,0,0.6)", - m.fillRect(0, 0, s, c); - var e = Math.floor(.5 * c) - 120 * r - , t = Math.floor(.5 * s) - , i = "Game menu"; - F == H && (i = "Options", - e -= 40 * r), - F == $ && (i = "Generate new level"), - F == re && (i = "Save level"), - F == oe && (i = "Load level"), - F == ae && (i = "Controls", - e -= 40 * r), - A(i, t, e), - F != re && F != oe || A("", t, e + 120 * r); - for (var n = 0; n < F.length; n++) - F[n].draw(); - if (F == B && _) { - var o = 300 * r - , a = 30 * r; - m.fillStyle = "rgba(0,0,0,1)", - d && (m.fillStyle = "rgba(127,127,127,1)"), - m.fillRect(.5 * s - .5 * o, .5 * c - 20 * r, o, a), - m.save(), - m.rect(.5 * s - .5 * o, .5 * c - 20 * r, o, a), - m.clip(), - A(y, t, .5 * c - 0 * r), - m.restore(), - m.strokeRect(.5 * s - .5 * o, .5 * c - 20 * r, o, a) - } - }, - resize: function() { - r = 2, - window.innerHeight < 600 && (r = 1), - a = 1.5 * r, - s = window.innerWidth, - c = window.innerHeight, - l = Math.floor(.5 * c) - 120 * r, - h = Math.floor(.5 * s), - p.width = s, - p.height = c, - g.style.width = s + "px", - g.style.height = c + "px", - m.imageSmoothingEnabled = false, - _e.isOpen && _e.redraw() + (g.style.display = "block"), + g.addEventListener("mousemove", this.mousemove, false), + g.addEventListener("mouseout", this.mouseout), + document.addEventListener("mousedown", this.press, false), + document.exitPointerLock(), + (_e.isOpen = true), + (e.inputs.state.active = false)); + }, + close: function (t) { + if (!ge) { + if ( + (null != f && (O(), (f = null)), + (g.style.display = "none"), + g.removeEventListener("mousemove", this.mousemove), + g.removeEventListener("mouseout", this.mouseout), + document.removeEventListener("mousedown", this.press), + !t) + ) { + var i = document.getElementById("noa-container"); + setTimeout(function () { + null == i || _e.mouseIsOut || i.requestPointerLock(); + }, 200); } - }; - return _e.resize(), - _e.close(), - _e - }(e, r, t) - } -} -, function(e, t, i) { - "use strict"; - e.exports = function(e) { - return function(e) { - var t = 2 - , i = document.createElement("canvas"); - i.width = 256 * t, - i.height = 34 * t; - var n = i.getContext("2d"); - n.imageSmoothingEnabled = false; - var r = document.getElementById("version"); - r.appendChild(i), - r.style.width = 256 * t + "px", - r.style.height = 34 * t + "px"; - var o = { - showFps: false, - fps: 0, - chunkUpdates: 0, - lastRedraw: 0, - redrawInterval: 1e3, - redraw: function() { - if (!(performance.now() < o.lastRedraw + o.redrawInterval)) { - o.lastRedraw = performance.now(), - n.clearRect(0, 0, 256 * t, 34 * t), - n.font = 14 * t + "px Minecraft, sans-serif", - n.textBaseline = "alphabetic", - n.textAlign = "left"; - var e = 0 * t - , i = 13 * t - , r = 2 * t; - n.fillStyle = "rgb(63,63,63)", - n.fillText("0.0.23a_01", e + r, i + r), - o.showFps && n.fillText(o.fps + " fps, " + o.chunkUpdates + " chunk updates", e + r, 2 * i + 4 * t + r), - n.fillStyle = "rgb(255,255,255)", - n.fillText("0.0.23a_01", e, i), - o.showFps && n.fillText(o.fps + " fps, " + o.chunkUpdates + " chunk updates", e, 2 * i + 4 * t), - o.chunkUpdates = 0 - } - }, - resize: function() { - var e = t; - t = 2, - window.innerHeight < 600 && (t = 1), - t != e && (i.width = 256 * t, - i.height = 34 * t, - r.style.width = 256 * t + "px", - r.style.height = 34 * t + "px", - n.imageSmoothingEnabled = false, - o.lastRedraw = 0, - o.redraw()) + (_e.isOpen = false), (e.inputs.state.active = true); + } + }, + mouseout: function (e) { + _e.mouseIsOut = true; + }, + mousemove: function (e) { + _e.mouseIsOut = false; + for ( + var t = e.layerX, i = e.layerY, n = null, o = 0; + o < F.length; + o++ + ) { + var s = F[o]; + s.over = false; + var c = h + s.x * r - 0.5 * E.width * a, + f = l + s.y * r, + d = c + E.width * a, + p = f + E.height * a; + if (t > c && t < d && i > f && i < p) { + n = o; + break; } - }; - return o.resize(), - o.redraw(), - o - }() - } -} -, function(e, t, i) { + } + null != n && n != u && ((F[n].over = true), _e.redraw()), + null == n && null != u && ((F[u].over = false), _e.redraw()), + (u = n); + }, + press: function (e) { + if (null != F[u]) { + var t = F[u].func; + null != t && t(); + } + }, + redraw: function () { + m.clearRect(0, 0, s, c), + (m.strokeStyle = "rgba(255,255,255,1)"), + (m.lineWidth = r), + (m.fillStyle = "rgba(0,0,0,0.6)"), + m.fillRect(0, 0, s, c); + var e = Math.floor(0.5 * c) - 120 * r, + t = Math.floor(0.5 * s), + i = "Game menu"; + F == H && ((i = "Options"), (e -= 40 * r)), + F == $ && (i = "Generate new level"), + F == re && (i = "Save level"), + F == oe && (i = "Load level"), + F == ae && ((i = "Controls"), (e -= 40 * r)), + A(i, t, e), + (F != re && F != oe) || A("", t, e + 120 * r); + for (var n = 0; n < F.length; n++) F[n].draw(); + if (F == B && _) { + var o = 300 * r, + a = 30 * r; + (m.fillStyle = "rgba(0,0,0,1)"), + d && (m.fillStyle = "rgba(127,127,127,1)"), + m.fillRect(0.5 * s - 0.5 * o, 0.5 * c - 20 * r, o, a), + m.save(), + m.rect(0.5 * s - 0.5 * o, 0.5 * c - 20 * r, o, a), + m.clip(), + A(y, t, 0.5 * c - 0 * r), + m.restore(), + m.strokeRect(0.5 * s - 0.5 * o, 0.5 * c - 20 * r, o, a); + } + }, + resize: function () { + (r = 2), + window.innerHeight < 600 && (r = 1), + (a = 1.5 * r), + (s = window.innerWidth), + (c = window.innerHeight), + (l = Math.floor(0.5 * c) - 120 * r), + (h = Math.floor(0.5 * s)), + (p.width = s), + (p.height = c), + (g.style.width = s + "px"), + (g.style.height = c + "px"), + (m.imageSmoothingEnabled = false), + _e.isOpen && _e.redraw(); + }, + }; + return _e.resize(), _e.close(), _e; + })(e, r, t); + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - var t = e.rendering.getScene() - , i = BABYLON.MeshBuilder.CreatePlane("plane", { + e.exports = function (e) { + return (function (e) { + var t = 2, + i = document.createElement("canvas"); + (i.width = 256 * t), (i.height = 34 * t); + var n = i.getContext("2d"); + n.imageSmoothingEnabled = false; + var r = document.getElementById("version"); + r.appendChild(i), + (r.style.width = 256 * t + "px"), + (r.style.height = 34 * t + "px"); + var o = { + showFps: false, + fps: 0, + chunkUpdates: 0, + lastRedraw: 0, + redrawInterval: 1e3, + redraw: function () { + if (!(performance.now() < o.lastRedraw + o.redrawInterval)) { + (o.lastRedraw = performance.now()), + n.clearRect(0, 0, 256 * t, 34 * t), + (n.font = 14 * t + "px Minecraft, sans-serif"), + (n.textBaseline = "alphabetic"), + (n.textAlign = "left"); + var e = 0 * t, + i = 13 * t, + r = 2 * t; + (n.fillStyle = "rgb(63,63,63)"), + n.fillText("0.0.23a_01", e + r, i + r), + o.showFps && + n.fillText( + o.fps + " fps, " + o.chunkUpdates + " chunk updates", + e + r, + 2 * i + 4 * t + r + ), + (n.fillStyle = "rgb(255,255,255)"), + n.fillText("0.0.23a_01", e, i), + o.showFps && + n.fillText( + o.fps + " fps, " + o.chunkUpdates + " chunk updates", + e, + 2 * i + 4 * t + ), + (o.chunkUpdates = 0); + } + }, + resize: function () { + var e = t; + (t = 2), + window.innerHeight < 600 && (t = 1), + t != e && + ((i.width = 256 * t), + (i.height = 34 * t), + (r.style.width = 256 * t + "px"), + (r.style.height = 34 * t + "px"), + (n.imageSmoothingEnabled = false), + (o.lastRedraw = 0), + o.redraw()); + }, + }; + return o.resize(), o.redraw(), o; + })(); + }; + }, + function (e, t, i) { + "use strict"; + e.exports = function (e) { + var t = e.rendering.getScene(), + i = BABYLON.MeshBuilder.CreatePlane( + "plane", + { height: 2e3, - width: 2e3 - }, t); - return i.material = e.rendering.makeStandardMaterial("cloudMat"), - i.material.diffuseTexture = new BABYLON.Texture("assets/textures/clouds.png",t,true,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - i.material.diffuseTexture.anisotropicFilteringLevel = 8, - i.material.emissiveColor = new BABYLON.Color3(1,1,1), - i.material.backFaceCulling = false, - i.material.disableLighting = true, - i.rotation.x = -Math.PI / 2, - i.position = new BABYLON.Vector3(0,68,0), + width: 2e3, + }, + t + ); + return ( + (i.material = e.rendering.makeStandardMaterial("cloudMat")), + (i.material.diffuseTexture = new BABYLON.Texture( + "assets/textures/clouds.png", + t, + true, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (i.material.diffuseTexture.anisotropicFilteringLevel = 8), + (i.material.emissiveColor = new BABYLON.Color3(1, 1, 1)), + (i.material.backFaceCulling = false), + (i.material.disableLighting = true), + (i.rotation.x = -Math.PI / 2), + (i.position = new BABYLON.Vector3(0, 68, 0)), e.rendering.addDynamicMesh(i), i - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - var t = BABYLON.MeshBuilder.CreatePlane("crosshair", { - height: .035, - width: .035 - }, scene); - t.material = e.rendering.makeStandardMaterial("crosshairMat"), - t.material.diffuseTexture = new BABYLON.Texture("assets/textures/crosshair.png",scene), - t.material.diffuseTexture.wrapU = BABYLON.Constants.TEXTURE_CLAMP_ADDRESSMODE, - t.material.diffuseTexture.wrapV = BABYLON.Constants.TEXTURE_CLAMP_ADDRESSMODE, - t.material.emissiveColor = new BABYLON.Color3(1,1,1), - t.material.diffuseTexture.hasAlpha = true, + e.exports = function (e) { + var t = BABYLON.MeshBuilder.CreatePlane( + "crosshair", + { + height: 0.035, + width: 0.035, + }, + scene + ); + (t.material = e.rendering.makeStandardMaterial("crosshairMat")), + (t.material.diffuseTexture = new BABYLON.Texture( + "assets/textures/crosshair.png", + scene + )), + (t.material.diffuseTexture.wrapU = + BABYLON.Constants.TEXTURE_CLAMP_ADDRESSMODE), + (t.material.diffuseTexture.wrapV = + BABYLON.Constants.TEXTURE_CLAMP_ADDRESSMODE), + (t.material.emissiveColor = new BABYLON.Color3(1, 1, 1)), + (t.material.diffuseTexture.hasAlpha = true), t.material.freeze(), - t.position = new BABYLON.Vector3(0,0,.8), - t.renderingGroupId = 2, - t.parent = scene.activeCamera, - t.alwaysSelectAsActiveMesh = true, - e.rendering.addDynamicMesh(t) - } -} -, function(e, t, i) { + (t.position = new BABYLON.Vector3(0, 0, 0.8)), + (t.renderingGroupId = 2), + (t.parent = scene.activeCamera), + (t.alwaysSelectAsActiveMesh = true), + e.rendering.addDynamicMesh(t); + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t) { - var n = function(e, t, i) { - var n, r = e.getVerticesData(BABYLON.VertexBuffer.UVKind), o = r.length; - if (1 !== t) - for (n = 0; n < o; n += 2) - r[n] *= t; - if (1 !== i) - for (n = 1; n < o; n += 2) - r[n] *= i; - e.setVerticesData(BABYLON.VertexBuffer.UVKind, r) - } - , r = 4 * e.worldSize - , o = 1 * e.worldSize + 2 * t - , a = BABYLON.MeshBuilder.CreatePlane("bedrock", { + e.exports = function (e, t) { + var n = function (e, t, i) { + var n, + r = e.getVerticesData(BABYLON.VertexBuffer.UVKind), + o = r.length; + if (1 !== t) for (n = 0; n < o; n += 2) r[n] *= t; + if (1 !== i) for (n = 1; n < o; n += 2) r[n] *= i; + e.setVerticesData(BABYLON.VertexBuffer.UVKind, r); + }, + r = 4 * e.worldSize, + o = 1 * e.worldSize + 2 * t, + a = BABYLON.MeshBuilder.CreatePlane( + "bedrock", + { height: o, - width: r - }, scene); - (u = e.rendering.flatMaterial.clone("bedrockMat")).diffuseTexture = new BABYLON.Texture("assets/textures/bedrock.png",scene,true,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - u.diffuseTexture.anisotropicFilteringLevel = 1, - u.diffuseTexture.uScale = r, - u.diffuseTexture.vScale = o, - u.diffuseColor = new BABYLON.Color3(.6,.6,.6), - a.rotation.x = Math.PI / 2, - a.position = new BABYLON.Vector3(.5 * -r - t,e.waterLevel - 1,.5 * o - t), - a.material = u, + width: r, + }, + scene + ); + ((u = e.rendering.flatMaterial.clone("bedrockMat")).diffuseTexture = + new BABYLON.Texture( + "assets/textures/bedrock.png", + scene, + true, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (u.diffuseTexture.anisotropicFilteringLevel = 1), + (u.diffuseTexture.uScale = r), + (u.diffuseTexture.vScale = o), + (u.diffuseColor = new BABYLON.Color3(0.6, 0.6, 0.6)), + (a.rotation.x = Math.PI / 2), + (a.position = new BABYLON.Vector3( + 0.5 * -r - t, + e.waterLevel - 1, + 0.5 * o - t + )), + (a.material = u), e.rendering.addDynamicMesh(a), - (c = BABYLON.MeshBuilder.CreatePlane("bedrock", { + ((c = BABYLON.MeshBuilder.CreatePlane( + "bedrock", + { height: o, - width: r - }, scene)).position = new BABYLON.Vector3(e.worldSize + .5 * r + t,e.waterLevel - 1,.5 * o - t), - c.material = u, - c.rotation.x = Math.PI / 2, + width: r, + }, + scene + )).position = new BABYLON.Vector3( + e.worldSize + 0.5 * r + t, + e.waterLevel - 1, + 0.5 * o - t + )), + (c.material = u), + (c.rotation.x = Math.PI / 2), e.rendering.addDynamicMesh(c); - var r = 9 * e.worldSize + 2 * t - , o = 4 * e.worldSize - , a = BABYLON.MeshBuilder.CreatePlane("bedrock", { + var r = 9 * e.worldSize + 2 * t, + o = 4 * e.worldSize, + a = BABYLON.MeshBuilder.CreatePlane( + "bedrock", + { height: o, - width: r - }, scene); - (u = e.rendering.flatMaterial.clone("bedrockMat")).diffuseTexture = new BABYLON.Texture("assets/textures/bedrock.png",scene,true,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - u.diffuseTexture.anisotropicFilteringLevel = 1, - u.diffuseTexture.uScale = r, - u.diffuseTexture.vScale = o, - u.diffuseColor = new BABYLON.Color3(.6,.6,.6), - a.rotation.x = Math.PI / 2, - a.position = new BABYLON.Vector3(.5 * e.worldSize,e.waterLevel - 1,.5 * -o - t), - a.material = u, + width: r, + }, + scene + ); + ((u = e.rendering.flatMaterial.clone("bedrockMat")).diffuseTexture = + new BABYLON.Texture( + "assets/textures/bedrock.png", + scene, + true, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (u.diffuseTexture.anisotropicFilteringLevel = 1), + (u.diffuseTexture.uScale = r), + (u.diffuseTexture.vScale = o), + (u.diffuseColor = new BABYLON.Color3(0.6, 0.6, 0.6)), + (a.rotation.x = Math.PI / 2), + (a.position = new BABYLON.Vector3( + 0.5 * e.worldSize, + e.waterLevel - 1, + 0.5 * -o - t + )), + (a.material = u), e.rendering.addDynamicMesh(a), - (c = BABYLON.MeshBuilder.CreatePlane("bedrock", { + ((c = BABYLON.MeshBuilder.CreatePlane( + "bedrock", + { height: o, - width: r - }, scene)).position = new BABYLON.Vector3(.5 * e.worldSize,e.waterLevel - 1,1 * e.worldSize + .5 * o + t), - c.material = u, - c.rotation.x = Math.PI / 2, + width: r, + }, + scene + )).position = new BABYLON.Vector3( + 0.5 * e.worldSize, + e.waterLevel - 1, + 1 * e.worldSize + 0.5 * o + t + )), + (c.material = u), + (c.rotation.x = Math.PI / 2), e.rendering.addDynamicMesh(c); - var r = 4 * e.worldSize - , o = 1 * e.worldSize + 2 * t - , s = i(189)(e) - , a = BABYLON.MeshBuilder.CreatePlane("water", { + var r = 4 * e.worldSize, + o = 1 * e.worldSize + 2 * t, + s = i(189)(e), + a = BABYLON.MeshBuilder.CreatePlane( + "water", + { height: o, - width: r - }, scene); - n(a, r, o), - (u = e.rendering.flatMaterial.clone("waterMat")).alpha = .85, - u.diffuseTexture = s.texture, - u.useAlphaFromDiffuseTexture = true, - u.backFaceCulling = false, - a.rotation.x = Math.PI / 2, - a.position = new BABYLON.Vector3(.5 * -r - t,e.waterLevel + 1 - .07,.5 * o - t), - a.material = u, + width: r, + }, + scene + ); + n(a, r, o), + ((u = e.rendering.flatMaterial.clone("waterMat")).alpha = 0.85), + (u.diffuseTexture = s.texture), + (u.useAlphaFromDiffuseTexture = true), + (u.backFaceCulling = false), + (a.rotation.x = Math.PI / 2), + (a.position = new BABYLON.Vector3( + 0.5 * -r - t, + e.waterLevel + 1 - 0.07, + 0.5 * o - t + )), + (a.material = u), e.rendering.addDynamicMesh(a); - var c = BABYLON.MeshBuilder.CreatePlane("water", { - height: o, - width: r - }, scene); - n(c, r, o), - c.position = new BABYLON.Vector3(e.worldSize + .5 * r + t,e.waterLevel + 1 - .07,.5 * o - t), - c.material = u, - c.rotation.x = Math.PI / 2, + var c = BABYLON.MeshBuilder.CreatePlane( + "water", + { + height: o, + width: r, + }, + scene + ); + n(c, r, o), + (c.position = new BABYLON.Vector3( + e.worldSize + 0.5 * r + t, + e.waterLevel + 1 - 0.07, + 0.5 * o - t + )), + (c.material = u), + (c.rotation.x = Math.PI / 2), e.rendering.addDynamicMesh(c); - var u, r = 9 * e.worldSize + 2 * t, o = 4 * e.worldSize, a = BABYLON.MeshBuilder.CreatePlane("water", { + var u, + r = 9 * e.worldSize + 2 * t, + o = 4 * e.worldSize, + a = BABYLON.MeshBuilder.CreatePlane( + "water", + { height: o, - width: r - }, scene); - n(a, r, o), - (u = e.rendering.flatMaterial.clone("waterMat")).alpha = .85, - u.diffuseTexture = s.texture, - u.useAlphaFromDiffuseTexture = true, - u.diffuseTexture.anisotropicFilteringLevel = 1, - u.backFaceCulling = false, - a.rotation.x = Math.PI / 2, - a.position = new BABYLON.Vector3(.5 * e.worldSize,e.waterLevel + 1 - .07,.5 * -o - t), - a.material = u, + width: r, + }, + scene + ); + n(a, r, o), + ((u = e.rendering.flatMaterial.clone("waterMat")).alpha = 0.85), + (u.diffuseTexture = s.texture), + (u.useAlphaFromDiffuseTexture = true), + (u.diffuseTexture.anisotropicFilteringLevel = 1), + (u.backFaceCulling = false), + (a.rotation.x = Math.PI / 2), + (a.position = new BABYLON.Vector3( + 0.5 * e.worldSize, + e.waterLevel + 1 - 0.07, + 0.5 * -o - t + )), + (a.material = u), e.rendering.addDynamicMesh(a); - var c = BABYLON.MeshBuilder.CreatePlane("water", { - height: o, - width: r - }, scene); - n(c, r, o), - c.position = new BABYLON.Vector3(.5 * e.worldSize,e.waterLevel + 1 - .07,1 * e.worldSize + .5 * o + t), - c.material = u, - c.rotation.x = Math.PI / 2, - e.rendering.addDynamicMesh(c) - } -} -, function(e, t, i) { + var c = BABYLON.MeshBuilder.CreatePlane( + "water", + { + height: o, + width: r, + }, + scene + ); + n(c, r, o), + (c.position = new BABYLON.Vector3( + 0.5 * e.worldSize, + e.waterLevel + 1 - 0.07, + 1 * e.worldSize + 0.5 * o + t + )), + (c.material = u), + (c.rotation.x = Math.PI / 2), + e.rendering.addDynamicMesh(c); + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - var t = e.rendering.getScene() - , i = .25 * Math.PI - , n = BABYLON.Mesh.CreatePlane("plane1", 1, t) - , r = BABYLON.Mesh.CreatePlane("plane2", 1, t); - n.rotation.y = i, - r.rotation.y = Math.PI + i; - var o = BABYLON.Mesh.CreatePlane("plane3", 1, t) - , a = BABYLON.Mesh.CreatePlane("plane4", 1, t); - return o.rotation.y = .5 * -Math.PI + i, - a.rotation.y = .5 * Math.PI + i, - n.position = new BABYLON.Vector3(0,.5,0), - r.position = new BABYLON.Vector3(0,.5,0), - o.position = new BABYLON.Vector3(0,.5,0), - a.position = new BABYLON.Vector3(0,.5,0), + e.exports = function (e) { + var t = e.rendering.getScene(), + i = 0.25 * Math.PI, + n = BABYLON.Mesh.CreatePlane("plane1", 1, t), + r = BABYLON.Mesh.CreatePlane("plane2", 1, t); + (n.rotation.y = i), (r.rotation.y = Math.PI + i); + var o = BABYLON.Mesh.CreatePlane("plane3", 1, t), + a = BABYLON.Mesh.CreatePlane("plane4", 1, t); + return ( + (o.rotation.y = 0.5 * -Math.PI + i), + (a.rotation.y = 0.5 * Math.PI + i), + (n.position = new BABYLON.Vector3(0, 0.5, 0)), + (r.position = new BABYLON.Vector3(0, 0.5, 0)), + (o.position = new BABYLON.Vector3(0, 0.5, 0)), + (a.position = new BABYLON.Vector3(0, 0.5, 0)), BABYLON.Mesh.MergeMeshes([n, r, o, a]) - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - var t = e.rendering.getScene() - , i = BABYLON.Mesh.CreatePlane("plane1", 1, t); - return i.rotation.x = .5 * -Math.PI, - i.position = new BABYLON.Vector3(0,1 - .07,0), + e.exports = function (e) { + var t = e.rendering.getScene(), + i = BABYLON.Mesh.CreatePlane("plane1", 1, t); + return ( + (i.rotation.x = 0.5 * -Math.PI), + (i.position = new BABYLON.Vector3(0, 1 - 0.07, 0)), BABYLON.Mesh.MergeMeshes([i]) - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t) { - var i = {}; - return i.setBlock = function(i) { - var n = t[i] - , r = e.registry.getBlockFaceMaterialAccessor(); - if (e.rendering._previewMesh) { - var o = r(n, 0) - , a = e.registry._matData[o]; - e.rendering._previewMesh.material.diffuseTexture = new BABYLON.Texture(a.texture,e.rendering._scene,false,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - e.rendering._previewMesh.material.diffuseTexture.hasAlpha = true; - var s = e.rendering._previewMesh._children[0] - , c = e.rendering._previewMesh._children[1] - , u = e.rendering._previewMesh._children[2] - , l = e.rendering._previewMesh._children[3] - , h = e.rendering._previewMesh._children[4]; - o = r(n, 1), - a = e.registry._matData[o], - s.material.diffuseTexture = new BABYLON.Texture(a.texture,e.rendering._scene,false,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - s.material.diffuseTexture.hasAlpha = true, - o = r(n, 4), - a = e.registry._matData[o], - c.material.diffuseTexture = new BABYLON.Texture(a.texture,e.rendering._scene,false,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - c.material.diffuseTexture.hasAlpha = true, - o = r(n, 5), - a = e.registry._matData[o], - u.material.diffuseTexture = new BABYLON.Texture(a.texture,e.rendering._scene,false,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - u.material.diffuseTexture.hasAlpha = true, - o = r(n, 2), - a = e.registry._matData[o], - h.material.diffuseTexture = new BABYLON.Texture(a.texture,e.rendering._scene,false,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - h.material.diffuseTexture.hasAlpha = true, - o = r(n, 3), - a = e.registry._matData[o], - l.material.diffuseTexture = new BABYLON.Texture(a.texture,e.rendering._scene,false,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - l.material.diffuseTexture.hasAlpha = true, - o = r(n, 1), - a = e.registry._matData[o]; - var f = e.rendering._previewMesh._children[6]; - f.material.diffuseTexture = new BABYLON.Texture(a.texture,e.rendering._scene,false,true,BABYLON.Texture.NEAREST_SAMPLINGMODE), - f.material.diffuseTexture.hasAlpha = true, - f.material.opacityTexture = f.material.diffuseTexture, - e.rendering._previewMesh.material.opacityTexture = e.rendering._previewMesh.material.diffuseTexture, - s.material.opacityTexture = s.material.diffuseTexture, - c.material.opacityTexture = c.material.diffuseTexture, - u.material.opacityTexture = u.material.diffuseTexture, - l.material.opacityTexture = l.material.diffuseTexture, - h.material.opacityTexture = h.material.diffuseTexture, - 8 == n || 5 == n || 6 == n || 15 == n || 16 == n ? (e.rendering._previewMesh.isVisible = false, - s.isVisible = false, - c.isVisible = false, - u.isVisible = false, - l.isVisible = false, - h.isVisible = false, - f.isVisible = true) : (e.rendering._previewMesh.isVisible = true, - s.isVisible = true, - c.isVisible = true, - u.isVisible = true, - l.isVisible = true, - h.isVisible = true, - f.isVisible = false) - } - } - , + e.exports = function (e, t) { + var i = {}; + return ( + (i.setBlock = function (i) { + var n = t[i], + r = e.registry.getBlockFaceMaterialAccessor(); + if (e.rendering._previewMesh) { + var o = r(n, 0), + a = e.registry._matData[o]; + (e.rendering._previewMesh.material.diffuseTexture = + new BABYLON.Texture( + a.texture, + e.rendering._scene, + false, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (e.rendering._previewMesh.material.diffuseTexture.hasAlpha = true); + var s = e.rendering._previewMesh._children[0], + c = e.rendering._previewMesh._children[1], + u = e.rendering._previewMesh._children[2], + l = e.rendering._previewMesh._children[3], + h = e.rendering._previewMesh._children[4]; + (o = r(n, 1)), + (a = e.registry._matData[o]), + (s.material.diffuseTexture = new BABYLON.Texture( + a.texture, + e.rendering._scene, + false, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (s.material.diffuseTexture.hasAlpha = true), + (o = r(n, 4)), + (a = e.registry._matData[o]), + (c.material.diffuseTexture = new BABYLON.Texture( + a.texture, + e.rendering._scene, + false, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (c.material.diffuseTexture.hasAlpha = true), + (o = r(n, 5)), + (a = e.registry._matData[o]), + (u.material.diffuseTexture = new BABYLON.Texture( + a.texture, + e.rendering._scene, + false, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (u.material.diffuseTexture.hasAlpha = true), + (o = r(n, 2)), + (a = e.registry._matData[o]), + (h.material.diffuseTexture = new BABYLON.Texture( + a.texture, + e.rendering._scene, + false, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (h.material.diffuseTexture.hasAlpha = true), + (o = r(n, 3)), + (a = e.registry._matData[o]), + (l.material.diffuseTexture = new BABYLON.Texture( + a.texture, + e.rendering._scene, + false, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (l.material.diffuseTexture.hasAlpha = true), + (o = r(n, 1)), + (a = e.registry._matData[o]); + var f = e.rendering._previewMesh._children[6]; + (f.material.diffuseTexture = new BABYLON.Texture( + a.texture, + e.rendering._scene, + false, + true, + BABYLON.Texture.NEAREST_SAMPLINGMODE + )), + (f.material.diffuseTexture.hasAlpha = true), + (f.material.opacityTexture = f.material.diffuseTexture), + (e.rendering._previewMesh.material.opacityTexture = + e.rendering._previewMesh.material.diffuseTexture), + (s.material.opacityTexture = s.material.diffuseTexture), + (c.material.opacityTexture = c.material.diffuseTexture), + (u.material.opacityTexture = u.material.diffuseTexture), + (l.material.opacityTexture = l.material.diffuseTexture), + (h.material.opacityTexture = h.material.diffuseTexture), + 8 == n || 5 == n || 6 == n || 15 == n || 16 == n + ? ((e.rendering._previewMesh.isVisible = false), + (s.isVisible = false), + (c.isVisible = false), + (u.isVisible = false), + (l.isVisible = false), + (h.isVisible = false), + (f.isVisible = true)) + : ((e.rendering._previewMesh.isVisible = true), + (s.isVisible = true), + (c.isVisible = true), + (u.isVisible = true), + (l.isVisible = true), + (h.isVisible = true), + (f.isVisible = false)); + } + }), i - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t, n, r) { - var o = i(195)(e) - , a = e.entities.add([t, n, r], .8, 1.8, o, [0, 1, 0], true, false) - , s = e.entities.getPhysicsBody(a); - s.friction = 1, - s.gravityMultiplier = 2; - var c = i(511)(e); - return c.state.id = a, - c - } -} -, function(e, t, i) { + e.exports = function (e, t, n, r) { + var o = i(195)(e), + a = e.entities.add([t, n, r], 0.8, 1.8, o, [0, 1, 0], true, false), + s = e.entities.getPhysicsBody(a); + (s.friction = 1), (s.gravityMultiplier = 2); + var c = i(511)(e); + return (c.state.id = a), c; + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e) { - return { - name: "steveAI", - state: { - id: null, - lastJump: .1, - stand_frame: "", - jump_frame: "", - direction: Math.random() * Math.PI * 2, - lifetime: 6e4, - starttime: performance.now(), - shouldRemove: false - }, - remove: function() { - e.entities.removeComponent(this.state.id, e.entities.names.mesh), - e.entities.removeComponent(this.state.id, e.entities.names.position), - e.entities.removeComponent(this.state.id, e.entities.names.physics) - }, - tick: function(t) { - var i = performance.now() - , n = this.state.id; - if (i > this.state.starttime + this.state.lifetime) - this.state.shouldRemove = true; - else { - var r = e.entities.getPhysicsBody(n) - , o = r.resting[1] < 0 - , a = (o ? this.state.stand_frame : this.state.jump_frame, - e.entities.getMeshData(n).mesh); - this.state.direction += Math.sin(1e-6 * i) * (Math.random() - .5); - var s = 3 * Math.sin(this.state.direction) - , c = 3 * Math.cos(this.state.direction); - r.applyForce([s, 0, c]), - a.animate(t); - Math.atan2(r.velocity[0], r.velocity[2]); - if (a.rotation.y = this.state.direction, - i > this.state.lastJump + 500 && o && Math.random() < .05) { - r.applyImpulse([0, 7, 0]), - this.state.lastJump = i - } - } + e.exports = function (e) { + return { + name: "steveAI", + state: { + id: null, + lastJump: 0.1, + stand_frame: "", + jump_frame: "", + direction: Math.random() * Math.PI * 2, + lifetime: 6e4, + starttime: performance.now(), + shouldRemove: false, + }, + remove: function () { + e.entities.removeComponent(this.state.id, e.entities.names.mesh), + e.entities.removeComponent( + this.state.id, + e.entities.names.position + ), + e.entities.removeComponent(this.state.id, e.entities.names.physics); + }, + tick: function (t) { + var i = performance.now(), + n = this.state.id; + if (i > this.state.starttime + this.state.lifetime) + this.state.shouldRemove = true; + else { + var r = e.entities.getPhysicsBody(n), + o = r.resting[1] < 0, + a = + (o ? this.state.stand_frame : this.state.jump_frame, + e.entities.getMeshData(n).mesh); + this.state.direction += Math.sin(1e-6 * i) * (Math.random() - 0.5); + var s = 3 * Math.sin(this.state.direction), + c = 3 * Math.cos(this.state.direction); + r.applyForce([s, 0, c]), a.animate(t); + Math.atan2(r.velocity[0], r.velocity[2]); + if ( + ((a.rotation.y = this.state.direction), + i > this.state.lastJump + 500 && o && Math.random() < 0.05) + ) { + r.applyImpulse([0, 7, 0]), (this.state.lastJump = i); } - } - } -} -, function(e, t, i) { + } + }, + }; + }; + }, + function (e, t, i) { "use strict"; - e.exports = function(e, t, n, r, o, a) { - var s = i(195)(e) - , c = e.entities.add([t, n, r], .8, 1.8, s, [0, 1, 0], true, false); - e.entities.addComponent(c, e.entities.names.collideTerrain); - var u = function(e, t) { - var i = new BABYLON.DynamicTexture(t,{ - width: 256, - height: 32 - },e.rendering._scene,true,false,BABYLON.Texture.NEAREST_SAMPLINGMODE); - i.hasAlpha = true, - i.getAlphaFromRGB = true; - var n = i.getContext(); - n.font = "24px Minecraft", - n.textBaseline = "alphabetic", - n.textAlign = "center"; - return n.fillStyle = "rgb(63,63,63)", + e.exports = function (e, t, n, r, o, a) { + var s = i(195)(e), + c = e.entities.add([t, n, r], 0.8, 1.8, s, [0, 1, 0], true, false); + e.entities.addComponent(c, e.entities.names.collideTerrain); + var u = (function (e, t) { + var i = new BABYLON.DynamicTexture( + t, + { + width: 256, + height: 32, + }, + e.rendering._scene, + true, + false, + BABYLON.Texture.NEAREST_SAMPLINGMODE + ); + (i.hasAlpha = true), (i.getAlphaFromRGB = true); + var n = i.getContext(); + (n.font = "24px Minecraft"), + (n.textBaseline = "alphabetic"), + (n.textAlign = "center"); + return ( + (n.fillStyle = "rgb(63,63,63)"), n.fillText(t, 130, 22), - n.fillStyle = "rgb(255,255,255)", + (n.fillStyle = "rgb(255,255,255)"), n.fillText(t, 128, 20), i.update(), i - }(e, o) - , l = BABYLON.MeshBuilder.CreatePlane(o, { - height: .16, - width: 1.28 - }, e.rendering._scene); - l.material = noa.rendering.makeStandardMaterial(o + "Mat"), - l.material.diffuseTexture = u, - l.parent = s, - l.material.diffuseTexture.anisotropicFilteringLevel = 0, - l.billboardMode = BABYLON.Mesh.BILLBOARDMODE_Y, - l.position = new BABYLON.Vector3(0,1.05,0), + ); + })(e, o), + l = BABYLON.MeshBuilder.CreatePlane( + o, + { + height: 0.16, + width: 1.28, + }, + e.rendering._scene + ); + (l.material = noa.rendering.makeStandardMaterial(o + "Mat")), + (l.material.diffuseTexture = u), + (l.parent = s), + (l.material.diffuseTexture.anisotropicFilteringLevel = 0), + (l.billboardMode = BABYLON.Mesh.BILLBOARDMODE_Y), + (l.position = new BABYLON.Vector3(0, 1.05, 0)), e.rendering.addDynamicMesh(l); - var h = {}; - return h.name = o, - h.id = a, - h.noa_id = c, - h.mesh = s, - h.walking = false, - h.tick = function(e) { - s.walking = h.walking, - s.animate(e) - } - , - h.setPosition = function(t, i, n) { - e.entities.setPosition(h.noa_id, t, i, n) - } - , - h.setRotation = function(e, t, i) { - s.rotation.x = e, - s.rotation.y = t, - s.rotation.z = i - } - , - h.getPosition = function() { - return e.entities.getPosition(h.noa_id) - } - , - h.getRotation = function() { - return s.rotation - } - , - h.remove = function() { - e.entities.removeComponent(h.noa_id, e.entities.names.mesh), + var h = {}; + return ( + (h.name = o), + (h.id = a), + (h.noa_id = c), + (h.mesh = s), + (h.walking = false), + (h.tick = function (e) { + (s.walking = h.walking), s.animate(e); + }), + (h.setPosition = function (t, i, n) { + e.entities.setPosition(h.noa_id, t, i, n); + }), + (h.setRotation = function (e, t, i) { + (s.rotation.x = e), (s.rotation.y = t), (s.rotation.z = i); + }), + (h.getPosition = function () { + return e.entities.getPosition(h.noa_id); + }), + (h.getRotation = function () { + return s.rotation; + }), + (h.remove = function () { + e.entities.removeComponent(h.noa_id, e.entities.names.mesh), e.entities.removeComponent(h.noa_id, e.entities.names.position), e.entities.removeComponent(h.noa_id, e.entities.names.physics), - e.entities.removeComponent(h.noa_id, e.entities.names.collideTerrain), + e.entities.removeComponent( + h.noa_id, + e.entities.names.collideTerrain + ), e.removeListener("tick", h.tick), - h = null - } - , + (h = null); + }), e.on("tick", h.tick), h - } -} -, function(e, t, i) { + ); + }; + }, + function (e, t, i) { "use strict"; - t.randomBytes = t.rng = t.pseudoRandomBytes = t.prng = i(53), - t.createHash = t.Hash = i(69), - t.createHmac = t.Hmac = i(199); - var n = i(523) - , r = Object.keys(n) - , o = ["sha1", "sha224", "sha256", "sha384", "sha512", "md5", "rmd160"].concat(r); - t.getHashes = function() { - return o - } - ; + (t.randomBytes = t.rng = t.pseudoRandomBytes = t.prng = i(53)), + (t.createHash = t.Hash = i(69)), + (t.createHmac = t.Hmac = i(199)); + var n = i(523), + r = Object.keys(n), + o = [ + "sha1", + "sha224", + "sha256", + "sha384", + "sha512", + "md5", + "rmd160", + ].concat(r); + t.getHashes = function () { + return o; + }; var a = i(202); - t.pbkdf2 = a.pbkdf2, - t.pbkdf2Sync = a.pbkdf2Sync; + (t.pbkdf2 = a.pbkdf2), (t.pbkdf2Sync = a.pbkdf2Sync); var s = i(525); - t.Cipher = s.Cipher, - t.createCipher = s.createCipher, - t.Cipheriv = s.Cipheriv, - t.createCipheriv = s.createCipheriv, - t.Decipher = s.Decipher, - t.createDecipher = s.createDecipher, - t.Decipheriv = s.Decipheriv, - t.createDecipheriv = s.createDecipheriv, - t.getCiphers = s.getCiphers, - t.listCiphers = s.listCiphers; + (t.Cipher = s.Cipher), + (t.createCipher = s.createCipher), + (t.Cipheriv = s.Cipheriv), + (t.createCipheriv = s.createCipheriv), + (t.Decipher = s.Decipher), + (t.createDecipher = s.createDecipher), + (t.Decipheriv = s.Decipheriv), + (t.createDecipheriv = s.createDecipheriv), + (t.getCiphers = s.getCiphers), + (t.listCiphers = s.listCiphers); var c = i(542); - t.DiffieHellmanGroup = c.DiffieHellmanGroup, - t.createDiffieHellmanGroup = c.createDiffieHellmanGroup, - t.getDiffieHellman = c.getDiffieHellman, - t.createDiffieHellman = c.createDiffieHellman, - t.DiffieHellman = c.DiffieHellman; + (t.DiffieHellmanGroup = c.DiffieHellmanGroup), + (t.createDiffieHellmanGroup = c.createDiffieHellmanGroup), + (t.getDiffieHellman = c.getDiffieHellman), + (t.createDiffieHellman = c.createDiffieHellman), + (t.DiffieHellman = c.DiffieHellman); var u = i(547); - t.createSign = u.createSign, - t.Sign = u.Sign, - t.createVerify = u.createVerify, - t.Verify = u.Verify, - t.createECDH = i(585); + (t.createSign = u.createSign), + (t.Sign = u.Sign), + (t.createVerify = u.createVerify), + (t.Verify = u.Verify), + (t.createECDH = i(585)); var l = i(586); - t.publicEncrypt = l.publicEncrypt, - t.privateEncrypt = l.privateEncrypt, - t.publicDecrypt = l.publicDecrypt, - t.privateDecrypt = l.privateDecrypt; + (t.publicEncrypt = l.publicEncrypt), + (t.privateEncrypt = l.privateEncrypt), + (t.publicDecrypt = l.publicDecrypt), + (t.privateDecrypt = l.privateDecrypt); var h = i(589); - t.randomFill = h.randomFill, - t.randomFillSync = h.randomFillSync, - t.createCredentials = function() { - throw new Error(["sorry, createCredentials is not implemented yet", "we accept pull requests", "https://github.com/crypto-browserify/crypto-browserify"].join("\n")) - } - , - t.constants = { + (t.randomFill = h.randomFill), + (t.randomFillSync = h.randomFillSync), + (t.createCredentials = function () { + throw new Error( + [ + "sorry, createCredentials is not implemented yet", + "we accept pull requests", + "https://github.com/crypto-browserify/crypto-browserify", + ].join("\n") + ); + }), + (t.constants = { DH_CHECK_P_NOT_SAFE_PRIME: 2, DH_CHECK_P_NOT_PRIME: 1, DH_UNABLE_TO_CHECK_GENERATOR: 4, @@ -107951,2991 +146429,3105 @@ and limitations under the License. RSA_PKCS1_PSS_PADDING: 6, POINT_CONVERSION_COMPRESSED: 2, POINT_CONVERSION_UNCOMPRESSED: 4, - POINT_CONVERSION_HYBRID: 6 - } -} -, function(e, t, i) { - e.exports = i(123) -} -, function(e, t, i) { - e.exports = i(54) -} -, function(e, t, i) { - e.exports = i(85).Transform -} -, function(e, t, i) { - e.exports = i(85).PassThrough -} -, function(e, t, i) { - var n = i(1) - , r = i(63) - , o = i(2).Buffer - , a = [1518500249, 1859775393, -1894007588, -899497514] - , s = new Array(80); + POINT_CONVERSION_HYBRID: 6, + }); + }, + function (e, t, i) { + e.exports = i(123); + }, + function (e, t, i) { + e.exports = i(54); + }, + function (e, t, i) { + e.exports = i(85).Transform; + }, + function (e, t, i) { + e.exports = i(85).PassThrough; + }, + function (e, t, i) { + var n = i(1), + r = i(63), + o = i(2).Buffer, + a = [1518500249, 1859775393, -1894007588, -899497514], + s = new Array(80); function c() { - this.init(), - this._w = s, - r.call(this, 64, 56) + this.init(), (this._w = s), r.call(this, 64, 56); } function u(e) { - return e << 30 | e >>> 2 + return (e << 30) | (e >>> 2); } function l(e, t, i, n) { - return 0 === e ? t & i | ~t & n : 2 === e ? t & i | t & n | i & n : t ^ i ^ n + return 0 === e + ? (t & i) | (~t & n) + : 2 === e + ? (t & i) | (t & n) | (i & n) + : t ^ i ^ n; } n(c, r), - c.prototype.init = function() { - return this._a = 1732584193, - this._b = 4023233417, - this._c = 2562383102, - this._d = 271733878, - this._e = 3285377520, - this - } - , - c.prototype._update = function(e) { - for (var t, i = this._w, n = 0 | this._a, r = 0 | this._b, o = 0 | this._c, s = 0 | this._d, c = 0 | this._e, h = 0; h < 16; ++h) - i[h] = e.readInt32BE(4 * h); - for (; h < 80; ++h) - i[h] = i[h - 3] ^ i[h - 8] ^ i[h - 14] ^ i[h - 16]; + (c.prototype.init = function () { + return ( + (this._a = 1732584193), + (this._b = 4023233417), + (this._c = 2562383102), + (this._d = 271733878), + (this._e = 3285377520), + this + ); + }), + (c.prototype._update = function (e) { + for ( + var t, + i = this._w, + n = 0 | this._a, + r = 0 | this._b, + o = 0 | this._c, + s = 0 | this._d, + c = 0 | this._e, + h = 0; + h < 16; + ++h + ) + i[h] = e.readInt32BE(4 * h); + for (; h < 80; ++h) i[h] = i[h - 3] ^ i[h - 8] ^ i[h - 14] ^ i[h - 16]; for (var f = 0; f < 80; ++f) { - var d = ~~(f / 20) - , p = 0 | ((t = n) << 5 | t >>> 27) + l(d, r, o, s) + c + i[f] + a[d]; - c = s, - s = o, - o = u(r), - r = n, - n = p + var d = ~~(f / 20), + p = + 0 | + ((((t = n) << 5) | (t >>> 27)) + l(d, r, o, s) + c + i[f] + a[d]); + (c = s), (s = o), (o = u(r)), (r = n), (n = p); } - this._a = n + this._a | 0, - this._b = r + this._b | 0, - this._c = o + this._c | 0, - this._d = s + this._d | 0, - this._e = c + this._e | 0 - } - , - c.prototype._hash = function() { + (this._a = (n + this._a) | 0), + (this._b = (r + this._b) | 0), + (this._c = (o + this._c) | 0), + (this._d = (s + this._d) | 0), + (this._e = (c + this._e) | 0); + }), + (c.prototype._hash = function () { var e = o.allocUnsafe(20); - return e.writeInt32BE(0 | this._a, 0), - e.writeInt32BE(0 | this._b, 4), - e.writeInt32BE(0 | this._c, 8), - e.writeInt32BE(0 | this._d, 12), - e.writeInt32BE(0 | this._e, 16), - e - } - , - e.exports = c -} -, function(e, t, i) { - var n = i(1) - , r = i(63) - , o = i(2).Buffer - , a = [1518500249, 1859775393, -1894007588, -899497514] - , s = new Array(80); + return ( + e.writeInt32BE(0 | this._a, 0), + e.writeInt32BE(0 | this._b, 4), + e.writeInt32BE(0 | this._c, 8), + e.writeInt32BE(0 | this._d, 12), + e.writeInt32BE(0 | this._e, 16), + e + ); + }), + (e.exports = c); + }, + function (e, t, i) { + var n = i(1), + r = i(63), + o = i(2).Buffer, + a = [1518500249, 1859775393, -1894007588, -899497514], + s = new Array(80); function c() { - this.init(), - this._w = s, - r.call(this, 64, 56) + this.init(), (this._w = s), r.call(this, 64, 56); } function u(e) { - return e << 5 | e >>> 27 + return (e << 5) | (e >>> 27); } function l(e) { - return e << 30 | e >>> 2 + return (e << 30) | (e >>> 2); } function h(e, t, i, n) { - return 0 === e ? t & i | ~t & n : 2 === e ? t & i | t & n | i & n : t ^ i ^ n + return 0 === e + ? (t & i) | (~t & n) + : 2 === e + ? (t & i) | (t & n) | (i & n) + : t ^ i ^ n; } n(c, r), - c.prototype.init = function() { - return this._a = 1732584193, - this._b = 4023233417, - this._c = 2562383102, - this._d = 271733878, - this._e = 3285377520, - this - } - , - c.prototype._update = function(e) { - for (var t, i = this._w, n = 0 | this._a, r = 0 | this._b, o = 0 | this._c, s = 0 | this._d, c = 0 | this._e, f = 0; f < 16; ++f) - i[f] = e.readInt32BE(4 * f); + (c.prototype.init = function () { + return ( + (this._a = 1732584193), + (this._b = 4023233417), + (this._c = 2562383102), + (this._d = 271733878), + (this._e = 3285377520), + this + ); + }), + (c.prototype._update = function (e) { + for ( + var t, + i = this._w, + n = 0 | this._a, + r = 0 | this._b, + o = 0 | this._c, + s = 0 | this._d, + c = 0 | this._e, + f = 0; + f < 16; + ++f + ) + i[f] = e.readInt32BE(4 * f); for (; f < 80; ++f) - i[f] = (t = i[f - 3] ^ i[f - 8] ^ i[f - 14] ^ i[f - 16]) << 1 | t >>> 31; + i[f] = + ((t = i[f - 3] ^ i[f - 8] ^ i[f - 14] ^ i[f - 16]) << 1) | + (t >>> 31); for (var d = 0; d < 80; ++d) { - var p = ~~(d / 20) - , m = u(n) + h(p, r, o, s) + c + i[d] + a[p] | 0; - c = s, - s = o, - o = l(r), - r = n, - n = m + var p = ~~(d / 20), + m = (u(n) + h(p, r, o, s) + c + i[d] + a[p]) | 0; + (c = s), (s = o), (o = l(r)), (r = n), (n = m); } - this._a = n + this._a | 0, - this._b = r + this._b | 0, - this._c = o + this._c | 0, - this._d = s + this._d | 0, - this._e = c + this._e | 0 - } - , - c.prototype._hash = function() { + (this._a = (n + this._a) | 0), + (this._b = (r + this._b) | 0), + (this._c = (o + this._c) | 0), + (this._d = (s + this._d) | 0), + (this._e = (c + this._e) | 0); + }), + (c.prototype._hash = function () { var e = o.allocUnsafe(20); - return e.writeInt32BE(0 | this._a, 0), - e.writeInt32BE(0 | this._b, 4), - e.writeInt32BE(0 | this._c, 8), - e.writeInt32BE(0 | this._d, 12), - e.writeInt32BE(0 | this._e, 16), - e - } - , - e.exports = c -} -, function(e, t, i) { - var n = i(1) - , r = i(197) - , o = i(63) - , a = i(2).Buffer - , s = new Array(64); + return ( + e.writeInt32BE(0 | this._a, 0), + e.writeInt32BE(0 | this._b, 4), + e.writeInt32BE(0 | this._c, 8), + e.writeInt32BE(0 | this._d, 12), + e.writeInt32BE(0 | this._e, 16), + e + ); + }), + (e.exports = c); + }, + function (e, t, i) { + var n = i(1), + r = i(197), + o = i(63), + a = i(2).Buffer, + s = new Array(64); function c() { - this.init(), - this._w = s, - o.call(this, 64, 56) + this.init(), (this._w = s), o.call(this, 64, 56); } n(c, r), - c.prototype.init = function() { - return this._a = 3238371032, - this._b = 914150663, - this._c = 812702999, - this._d = 4144912697, - this._e = 4290775857, - this._f = 1750603025, - this._g = 1694076839, - this._h = 3204075428, - this - } - , - c.prototype._hash = function() { + (c.prototype.init = function () { + return ( + (this._a = 3238371032), + (this._b = 914150663), + (this._c = 812702999), + (this._d = 4144912697), + (this._e = 4290775857), + (this._f = 1750603025), + (this._g = 1694076839), + (this._h = 3204075428), + this + ); + }), + (c.prototype._hash = function () { var e = a.allocUnsafe(28); - return e.writeInt32BE(this._a, 0), - e.writeInt32BE(this._b, 4), - e.writeInt32BE(this._c, 8), - e.writeInt32BE(this._d, 12), - e.writeInt32BE(this._e, 16), - e.writeInt32BE(this._f, 20), - e.writeInt32BE(this._g, 24), - e - } - , - e.exports = c -} -, function(e, t, i) { - var n = i(1) - , r = i(198) - , o = i(63) - , a = i(2).Buffer - , s = new Array(160); + return ( + e.writeInt32BE(this._a, 0), + e.writeInt32BE(this._b, 4), + e.writeInt32BE(this._c, 8), + e.writeInt32BE(this._d, 12), + e.writeInt32BE(this._e, 16), + e.writeInt32BE(this._f, 20), + e.writeInt32BE(this._g, 24), + e + ); + }), + (e.exports = c); + }, + function (e, t, i) { + var n = i(1), + r = i(198), + o = i(63), + a = i(2).Buffer, + s = new Array(160); function c() { - this.init(), - this._w = s, - o.call(this, 128, 112) + this.init(), (this._w = s), o.call(this, 128, 112); } n(c, r), - c.prototype.init = function() { - return this._ah = 3418070365, - this._bh = 1654270250, - this._ch = 2438529370, - this._dh = 355462360, - this._eh = 1731405415, - this._fh = 2394180231, - this._gh = 3675008525, - this._hh = 1203062813, - this._al = 3238371032, - this._bl = 914150663, - this._cl = 812702999, - this._dl = 4144912697, - this._el = 4290775857, - this._fl = 1750603025, - this._gl = 1694076839, - this._hl = 3204075428, - this - } - , - c.prototype._hash = function() { + (c.prototype.init = function () { + return ( + (this._ah = 3418070365), + (this._bh = 1654270250), + (this._ch = 2438529370), + (this._dh = 355462360), + (this._eh = 1731405415), + (this._fh = 2394180231), + (this._gh = 3675008525), + (this._hh = 1203062813), + (this._al = 3238371032), + (this._bl = 914150663), + (this._cl = 812702999), + (this._dl = 4144912697), + (this._el = 4290775857), + (this._fl = 1750603025), + (this._gl = 1694076839), + (this._hl = 3204075428), + this + ); + }), + (c.prototype._hash = function () { var e = a.allocUnsafe(48); function t(t, i, n) { - e.writeInt32BE(t, n), - e.writeInt32BE(i, n + 4) + e.writeInt32BE(t, n), e.writeInt32BE(i, n + 4); } - return t(this._ah, this._al, 0), - t(this._bh, this._bl, 8), - t(this._ch, this._cl, 16), - t(this._dh, this._dl, 24), - t(this._eh, this._el, 32), - t(this._fh, this._fl, 40), - e - } - , - e.exports = c -} -, function(e, t, i) { + return ( + t(this._ah, this._al, 0), + t(this._bh, this._bl, 8), + t(this._ch, this._cl, 16), + t(this._dh, this._dl, 24), + t(this._eh, this._el, 32), + t(this._fh, this._fl, 40), + e + ); + }), + (e.exports = c); + }, + function (e, t, i) { "use strict"; - var n = i(1) - , r = i(2).Buffer - , o = i(44) - , a = r.alloc(128) - , s = 64; + var n = i(1), + r = i(2).Buffer, + o = i(44), + a = r.alloc(128), + s = 64; function c(e, t) { - o.call(this, "digest"), + o.call(this, "digest"), "string" == typeof t && (t = r.from(t)), - this._alg = e, - this._key = t, - t.length > s ? t = e(t) : t.length < s && (t = r.concat([t, a], s)); - for (var i = this._ipad = r.allocUnsafe(s), n = this._opad = r.allocUnsafe(s), c = 0; c < s; c++) - i[c] = 54 ^ t[c], - n[c] = 92 ^ t[c]; - this._hash = [i] + (this._alg = e), + (this._key = t), + t.length > s ? (t = e(t)) : t.length < s && (t = r.concat([t, a], s)); + for ( + var i = (this._ipad = r.allocUnsafe(s)), + n = (this._opad = r.allocUnsafe(s)), + c = 0; + c < s; + c++ + ) + (i[c] = 54 ^ t[c]), (n[c] = 92 ^ t[c]); + this._hash = [i]; } n(c, o), - c.prototype._update = function(e) { - this._hash.push(e) - } - , - c.prototype._final = function() { + (c.prototype._update = function (e) { + this._hash.push(e); + }), + (c.prototype._final = function () { var e = this._alg(r.concat(this._hash)); - return this._alg(r.concat([this._opad, e])) - } - , - e.exports = c -} -, function(e, t, i) { - e.exports = i(201) -} -, function(e, t, i) { - (function(t, n, r) { - var o, a = i(203), s = i(204), c = i(205), u = i(2).Buffer, l = t.crypto && t.crypto.subtle, h = { - sha: "SHA-1", - "sha-1": "SHA-1", - sha1: "SHA-1", - sha256: "SHA-256", - "sha-256": "SHA-256", - sha384: "SHA-384", - "sha-384": "SHA-384", - "sha-512": "SHA-512", - sha512: "SHA-512" - }, f = []; - function d(e, t, i, n, r) { - return l.importKey("raw", e, { - name: "PBKDF2" - }, false, ["deriveBits"]).then(function(e) { - return l.deriveBits({ - name: "PBKDF2", - salt: t, - iterations: i, - hash: { - name: r - } - }, e, n << 3) - }).then(function(e) { - return u.from(e) - }) - } - e.exports = function(e, i, p, m, g, _) { - "function" == typeof g && (_ = g, - g = void 0); - var v = h[(g = g || "sha1").toLowerCase()]; - if (!v || "function" != typeof t.Promise) - return r.nextTick(function() { - var t; - try { - t = c(e, i, p, m, g) - } catch (e) { - return _(e) - } - _(null, t) + return this._alg(r.concat([this._opad, e])); + }), + (e.exports = c); + }, + function (e, t, i) { + e.exports = i(201); + }, + function (e, t, i) { + (function (t, n, r) { + var o, + a = i(203), + s = i(204), + c = i(205), + u = i(2).Buffer, + l = t.crypto && t.crypto.subtle, + h = { + sha: "SHA-1", + "sha-1": "SHA-1", + sha1: "SHA-1", + sha256: "SHA-256", + "sha-256": "SHA-256", + sha384: "SHA-384", + "sha-384": "SHA-384", + "sha-512": "SHA-512", + sha512: "SHA-512", + }, + f = []; + function d(e, t, i, n, r) { + return l + .importKey( + "raw", + e, + { + name: "PBKDF2", + }, + false, + ["deriveBits"] + ) + .then(function (e) { + return l.deriveBits( + { + name: "PBKDF2", + salt: t, + iterations: i, + hash: { + name: r, + }, + }, + e, + n << 3 + ); + }) + .then(function (e) { + return u.from(e); + }); + } + e.exports = function (e, i, p, m, g, _) { + "function" == typeof g && ((_ = g), (g = void 0)); + var v = h[(g = g || "sha1").toLowerCase()]; + if (!v || "function" != typeof t.Promise) + return r.nextTick(function () { + var t; + try { + t = c(e, i, p, m, g); + } catch (e) { + return _(e); + } + _(null, t); + }); + if ((a(e, i, p, m), "function" != typeof _)) + throw new Error("No callback provided to pbkdf2"); + u.isBuffer(e) || (e = u.from(e, s)), + u.isBuffer(i) || (i = u.from(i, s)), + (function (e, t) { + e.then( + function (e) { + r.nextTick(function () { + t(null, e); }); - if (a(e, i, p, m), - "function" != typeof _) - throw new Error("No callback provided to pbkdf2"); - u.isBuffer(e) || (e = u.from(e, s)), - u.isBuffer(i) || (i = u.from(i, s)), - function(e, t) { - e.then(function(e) { - r.nextTick(function() { - t(null, e) - }) - }, function(e) { - r.nextTick(function() { - t(e) - }) + }, + function (e) { + r.nextTick(function () { + t(e); + }); + } + ); + })( + (function (e) { + if (t.process && !t.process.browser) return n.resolve(false); + if (!l || !l.importKey || !l.deriveBits) return n.resolve(false); + if (void 0 !== f[e]) return f[e]; + var i = d((o = o || u.alloc(8)), o, 10, 128, e) + .then(function () { + return true; }) - }(function(e) { - if (t.process && !t.process.browser) - return n.resolve(false); - if (!l || !l.importKey || !l.deriveBits) - return n.resolve(false); - if (void 0 !== f[e]) - return f[e]; - var i = d(o = o || u.alloc(8), o, 10, 128, e).then(function() { - return true - }).catch(function() { - return false + .catch(function () { + return false; }); - return f[e] = i, - i - }(v).then(function(t) { - return t ? d(e, i, p, m, v) : c(e, i, p, m, g) - }), _) - } - } - ).call(this, i(15), i(41), i(27)) -} -, function(e, t, i) { - var n = i(526) - , r = i(132) - , o = i(133) - , a = i(541) - , s = i(90); + return (f[e] = i), i; + })(v).then(function (t) { + return t ? d(e, i, p, m, v) : c(e, i, p, m, g); + }), + _ + ); + }; + }.call(this, i(15), i(41), i(27))); + }, + function (e, t, i) { + var n = i(526), + r = i(132), + o = i(133), + a = i(541), + s = i(90); function c(e, t, i) { - if (e = e.toLowerCase(), - o[e]) - return r.createCipheriv(e, t, i); - if (a[e]) - return new n({ - key: t, - iv: i, - mode: e - }); - throw new TypeError("invalid suite type") + if (((e = e.toLowerCase()), o[e])) return r.createCipheriv(e, t, i); + if (a[e]) + return new n({ + key: t, + iv: i, + mode: e, + }); + throw new TypeError("invalid suite type"); } function u(e, t, i) { - if (e = e.toLowerCase(), - o[e]) - return r.createDecipheriv(e, t, i); - if (a[e]) - return new n({ - key: t, - iv: i, - mode: e, - decrypt: true - }); - throw new TypeError("invalid suite type") + if (((e = e.toLowerCase()), o[e])) return r.createDecipheriv(e, t, i); + if (a[e]) + return new n({ + key: t, + iv: i, + mode: e, + decrypt: true, + }); + throw new TypeError("invalid suite type"); } - t.createCipher = t.Cipher = function(e, t) { + (t.createCipher = t.Cipher = + function (e, t) { var i, n; - if (e = e.toLowerCase(), - o[e]) - i = o[e].key, - n = o[e].iv; + if (((e = e.toLowerCase()), o[e])) (i = o[e].key), (n = o[e].iv); else { - if (!a[e]) - throw new TypeError("invalid suite type"); - i = 8 * a[e].key, - n = a[e].iv + if (!a[e]) throw new TypeError("invalid suite type"); + (i = 8 * a[e].key), (n = a[e].iv); } var r = s(t, false, i, n); - return c(e, r.key, r.iv) - } - , - t.createCipheriv = t.Cipheriv = c, - t.createDecipher = t.Decipher = function(e, t) { - var i, n; - if (e = e.toLowerCase(), - o[e]) - i = o[e].key, - n = o[e].iv; - else { - if (!a[e]) - throw new TypeError("invalid suite type"); - i = 8 * a[e].key, - n = a[e].iv - } - var r = s(t, false, i, n); - return u(e, r.key, r.iv) - } - , - t.createDecipheriv = t.Decipheriv = u, - t.listCiphers = t.getCiphers = function() { - return Object.keys(a).concat(r.getCiphers()) - } -} -, function(e, t, i) { - var n = i(44) - , r = i(131) - , o = i(1) - , a = i(2).Buffer - , s = { + return c(e, r.key, r.iv); + }), + (t.createCipheriv = t.Cipheriv = c), + (t.createDecipher = t.Decipher = + function (e, t) { + var i, n; + if (((e = e.toLowerCase()), o[e])) (i = o[e].key), (n = o[e].iv); + else { + if (!a[e]) throw new TypeError("invalid suite type"); + (i = 8 * a[e].key), (n = a[e].iv); + } + var r = s(t, false, i, n); + return u(e, r.key, r.iv); + }), + (t.createDecipheriv = t.Decipheriv = u), + (t.listCiphers = t.getCiphers = + function () { + return Object.keys(a).concat(r.getCiphers()); + }); + }, + function (e, t, i) { + var n = i(44), + r = i(131), + o = i(1), + a = i(2).Buffer, + s = { "des-ede3-cbc": r.CBC.instantiate(r.EDE), "des-ede3": r.EDE, "des-ede-cbc": r.CBC.instantiate(r.EDE), "des-ede": r.EDE, "des-cbc": r.CBC.instantiate(r.DES), - "des-ecb": r.DES - }; + "des-ecb": r.DES, + }; function c(e) { - n.call(this); - var t, i = e.mode.toLowerCase(), r = s[i]; - t = e.decrypt ? "decrypt" : "encrypt"; - var o = e.key; - a.isBuffer(o) || (o = a.from(o)), - "des-ede" !== i && "des-ede-cbc" !== i || (o = a.concat([o, o.slice(0, 8)])); - var c = e.iv; - a.isBuffer(c) || (c = a.from(c)), - this._des = r.create({ - key: o, - iv: c, - type: t - }) + n.call(this); + var t, + i = e.mode.toLowerCase(), + r = s[i]; + t = e.decrypt ? "decrypt" : "encrypt"; + var o = e.key; + a.isBuffer(o) || (o = a.from(o)), + ("des-ede" !== i && "des-ede-cbc" !== i) || + (o = a.concat([o, o.slice(0, 8)])); + var c = e.iv; + a.isBuffer(c) || (c = a.from(c)), + (this._des = r.create({ + key: o, + iv: c, + type: t, + })); } - s.des = s["des-cbc"], - s.des3 = s["des-ede3-cbc"], - e.exports = c, - o(c, n), - c.prototype._update = function(e) { - return a.from(this._des.update(e)) - } - , - c.prototype._final = function() { - return a.from(this._des.final()) - } -} -, function(e, t, i) { + (s.des = s["des-cbc"]), + (s.des3 = s["des-ede3-cbc"]), + (e.exports = c), + o(c, n), + (c.prototype._update = function (e) { + return a.from(this._des.update(e)); + }), + (c.prototype._final = function () { + return a.from(this._des.final()); + }); + }, + function (e, t, i) { "use strict"; - t.readUInt32BE = function(e, t) { - return (e[0 + t] << 24 | e[1 + t] << 16 | e[2 + t] << 8 | e[3 + t]) >>> 0 - } - , - t.writeUInt32BE = function(e, t, i) { - e[0 + i] = t >>> 24, - e[1 + i] = t >>> 16 & 255, - e[2 + i] = t >>> 8 & 255, - e[3 + i] = 255 & t - } - , - t.ip = function(e, t, i, n) { + (t.readUInt32BE = function (e, t) { + return ( + ((e[0 + t] << 24) | (e[1 + t] << 16) | (e[2 + t] << 8) | e[3 + t]) >>> 0 + ); + }), + (t.writeUInt32BE = function (e, t, i) { + (e[0 + i] = t >>> 24), + (e[1 + i] = (t >>> 16) & 255), + (e[2 + i] = (t >>> 8) & 255), + (e[3 + i] = 255 & t); + }), + (t.ip = function (e, t, i, n) { for (var r = 0, o = 0, a = 6; a >= 0; a -= 2) { - for (var s = 0; s <= 24; s += 8) - r <<= 1, - r |= t >>> s + a & 1; - for (s = 0; s <= 24; s += 8) - r <<= 1, - r |= e >>> s + a & 1 + for (var s = 0; s <= 24; s += 8) + (r <<= 1), (r |= (t >>> (s + a)) & 1); + for (s = 0; s <= 24; s += 8) (r <<= 1), (r |= (e >>> (s + a)) & 1); } for (a = 6; a >= 0; a -= 2) { - for (s = 1; s <= 25; s += 8) - o <<= 1, - o |= t >>> s + a & 1; - for (s = 1; s <= 25; s += 8) - o <<= 1, - o |= e >>> s + a & 1 + for (s = 1; s <= 25; s += 8) (o <<= 1), (o |= (t >>> (s + a)) & 1); + for (s = 1; s <= 25; s += 8) (o <<= 1), (o |= (e >>> (s + a)) & 1); } - i[n + 0] = r >>> 0, - i[n + 1] = o >>> 0 - } - , - t.rip = function(e, t, i, n) { + (i[n + 0] = r >>> 0), (i[n + 1] = o >>> 0); + }), + (t.rip = function (e, t, i, n) { for (var r = 0, o = 0, a = 0; a < 4; a++) - for (var s = 24; s >= 0; s -= 8) - r <<= 1, - r |= t >>> s + a & 1, - r <<= 1, - r |= e >>> s + a & 1; + for (var s = 24; s >= 0; s -= 8) + (r <<= 1), + (r |= (t >>> (s + a)) & 1), + (r <<= 1), + (r |= (e >>> (s + a)) & 1); for (a = 4; a < 8; a++) - for (s = 24; s >= 0; s -= 8) - o <<= 1, - o |= t >>> s + a & 1, - o <<= 1, - o |= e >>> s + a & 1; - i[n + 0] = r >>> 0, - i[n + 1] = o >>> 0 - } - , - t.pc1 = function(e, t, i, n) { + for (s = 24; s >= 0; s -= 8) + (o <<= 1), + (o |= (t >>> (s + a)) & 1), + (o <<= 1), + (o |= (e >>> (s + a)) & 1); + (i[n + 0] = r >>> 0), (i[n + 1] = o >>> 0); + }), + (t.pc1 = function (e, t, i, n) { for (var r = 0, o = 0, a = 7; a >= 5; a--) { - for (var s = 0; s <= 24; s += 8) - r <<= 1, - r |= t >> s + a & 1; - for (s = 0; s <= 24; s += 8) - r <<= 1, - r |= e >> s + a & 1 + for (var s = 0; s <= 24; s += 8) (r <<= 1), (r |= (t >> (s + a)) & 1); + for (s = 0; s <= 24; s += 8) (r <<= 1), (r |= (e >> (s + a)) & 1); } - for (s = 0; s <= 24; s += 8) - r <<= 1, - r |= t >> s + a & 1; + for (s = 0; s <= 24; s += 8) (r <<= 1), (r |= (t >> (s + a)) & 1); for (a = 1; a <= 3; a++) { - for (s = 0; s <= 24; s += 8) - o <<= 1, - o |= t >> s + a & 1; - for (s = 0; s <= 24; s += 8) - o <<= 1, - o |= e >> s + a & 1 + for (s = 0; s <= 24; s += 8) (o <<= 1), (o |= (t >> (s + a)) & 1); + for (s = 0; s <= 24; s += 8) (o <<= 1), (o |= (e >> (s + a)) & 1); } - for (s = 0; s <= 24; s += 8) - o <<= 1, - o |= e >> s + a & 1; - i[n + 0] = r >>> 0, - i[n + 1] = o >>> 0 - } - , - t.r28shl = function(e, t) { - return e << t & 268435455 | e >>> 28 - t - } - ; - var n = [14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, 1, 8, 15, 26, 15, 4, 25, 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, 3, 10, 14, 6, 20, 27, 24]; - t.pc2 = function(e, t, i, r) { - for (var o = 0, a = 0, s = n.length >>> 1, c = 0; c < s; c++) - o <<= 1, - o |= e >>> n[c] & 1; - for (c = s; c < n.length; c++) - a <<= 1, - a |= t >>> n[c] & 1; - i[r + 0] = o >>> 0, - i[r + 1] = a >>> 0 - } - , - t.expand = function(e, t, i) { - var n = 0 - , r = 0; - n = (1 & e) << 5 | e >>> 27; - for (var o = 23; o >= 15; o -= 4) - n <<= 6, - n |= e >>> o & 63; - for (o = 11; o >= 3; o -= 4) - r |= e >>> o & 63, - r <<= 6; - r |= (31 & e) << 1 | e >>> 31, - t[i + 0] = n >>> 0, - t[i + 1] = r >>> 0 - } - ; - var r = [14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11]; - t.substitute = function(e, t) { - for (var i = 0, n = 0; n < 4; n++) { - i <<= 4, - i |= r[64 * n + (e >>> 18 - 6 * n & 63)] - } - for (n = 0; n < 4; n++) { - i <<= 4, - i |= r[256 + 64 * n + (t >>> 18 - 6 * n & 63)] - } - return i >>> 0 - } - ; - var o = [16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7]; - t.permute = function(e) { - for (var t = 0, i = 0; i < o.length; i++) - t <<= 1, - t |= e >>> o[i] & 1; - return t >>> 0 - } - , - t.padSplit = function(e, t, i) { - for (var n = e.toString(2); n.length < t; ) - n = "0" + n; - for (var r = [], o = 0; o < t; o += i) - r.push(n.slice(o, o + i)); - return r.join(" ") - } -} -, function(e, t, i) { + for (s = 0; s <= 24; s += 8) (o <<= 1), (o |= (e >> (s + a)) & 1); + (i[n + 0] = r >>> 0), (i[n + 1] = o >>> 0); + }), + (t.r28shl = function (e, t) { + return ((e << t) & 268435455) | (e >>> (28 - t)); + }); + var n = [ + 14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, + 1, 8, 15, 26, 15, 4, 25, 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, + 3, 10, 14, 6, 20, 27, 24, + ]; + (t.pc2 = function (e, t, i, r) { + for (var o = 0, a = 0, s = n.length >>> 1, c = 0; c < s; c++) + (o <<= 1), (o |= (e >>> n[c]) & 1); + for (c = s; c < n.length; c++) (a <<= 1), (a |= (t >>> n[c]) & 1); + (i[r + 0] = o >>> 0), (i[r + 1] = a >>> 0); + }), + (t.expand = function (e, t, i) { + var n = 0, + r = 0; + n = ((1 & e) << 5) | (e >>> 27); + for (var o = 23; o >= 15; o -= 4) (n <<= 6), (n |= (e >>> o) & 63); + for (o = 11; o >= 3; o -= 4) (r |= (e >>> o) & 63), (r <<= 6); + (r |= ((31 & e) << 1) | (e >>> 31)), + (t[i + 0] = n >>> 0), + (t[i + 1] = r >>> 0); + }); + var r = [ + 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, + 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, + 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15, + 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, + 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, + 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13, + 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, + 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, + 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, + 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, + 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, + 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, + 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, + 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15, + 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, + 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, + 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0, 14, + 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, + 0, 9, 8, 1, 13, 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, + 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0, + 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, + 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, + 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, + 0, 15, 3, 3, 5, 5, 6, 8, 11, + ]; + t.substitute = function (e, t) { + for (var i = 0, n = 0; n < 4; n++) { + (i <<= 4), (i |= r[64 * n + ((e >>> (18 - 6 * n)) & 63)]); + } + for (n = 0; n < 4; n++) { + (i <<= 4), (i |= r[256 + 64 * n + ((t >>> (18 - 6 * n)) & 63)]); + } + return i >>> 0; + }; + var o = [ + 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, + 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7, + ]; + (t.permute = function (e) { + for (var t = 0, i = 0; i < o.length; i++) + (t <<= 1), (t |= (e >>> o[i]) & 1); + return t >>> 0; + }), + (t.padSplit = function (e, t, i) { + for (var n = e.toString(2); n.length < t; ) n = "0" + n; + for (var r = [], o = 0; o < t; o += i) r.push(n.slice(o, o + i)); + return r.join(" "); + }); + }, + function (e, t, i) { "use strict"; var n = i(25); function r(e) { - this.options = e, - this.type = this.options.type, - this.blockSize = 8, + (this.options = e), + (this.type = this.options.type), + (this.blockSize = 8), this._init(), - this.buffer = new Array(this.blockSize), - this.bufferOff = 0 + (this.buffer = new Array(this.blockSize)), + (this.bufferOff = 0); } - e.exports = r, - r.prototype._init = function() {} - , - r.prototype.update = function(e) { - return 0 === e.length ? [] : "decrypt" === this.type ? this._updateDecrypt(e) : this._updateEncrypt(e) - } - , - r.prototype._buffer = function(e, t) { - for (var i = Math.min(this.buffer.length - this.bufferOff, e.length - t), n = 0; n < i; n++) - this.buffer[this.bufferOff + n] = e[t + n]; - return this.bufferOff += i, - i - } - , - r.prototype._flushBuffer = function(e, t) { - return this._update(this.buffer, 0, e, t), - this.bufferOff = 0, - this.blockSize - } - , - r.prototype._updateEncrypt = function(e) { - var t = 0 - , i = 0 - , n = (this.bufferOff + e.length) / this.blockSize | 0 - , r = new Array(n * this.blockSize); - 0 !== this.bufferOff && (t += this._buffer(e, t), - this.bufferOff === this.buffer.length && (i += this._flushBuffer(r, i))); - for (var o = e.length - (e.length - t) % this.blockSize; t < o; t += this.blockSize) - this._update(e, t, r, i), - i += this.blockSize; - for (; t < e.length; t++, - this.bufferOff++) - this.buffer[this.bufferOff] = e[t]; - return r - } - , - r.prototype._updateDecrypt = function(e) { - for (var t = 0, i = 0, n = Math.ceil((this.bufferOff + e.length) / this.blockSize) - 1, r = new Array(n * this.blockSize); n > 0; n--) - t += this._buffer(e, t), - i += this._flushBuffer(r, i); - return t += this._buffer(e, t), - r - } - , - r.prototype.final = function(e) { + (e.exports = r), + (r.prototype._init = function () {}), + (r.prototype.update = function (e) { + return 0 === e.length + ? [] + : "decrypt" === this.type + ? this._updateDecrypt(e) + : this._updateEncrypt(e); + }), + (r.prototype._buffer = function (e, t) { + for ( + var i = Math.min(this.buffer.length - this.bufferOff, e.length - t), + n = 0; + n < i; + n++ + ) + this.buffer[this.bufferOff + n] = e[t + n]; + return (this.bufferOff += i), i; + }), + (r.prototype._flushBuffer = function (e, t) { + return ( + this._update(this.buffer, 0, e, t), + (this.bufferOff = 0), + this.blockSize + ); + }), + (r.prototype._updateEncrypt = function (e) { + var t = 0, + i = 0, + n = ((this.bufferOff + e.length) / this.blockSize) | 0, + r = new Array(n * this.blockSize); + 0 !== this.bufferOff && + ((t += this._buffer(e, t)), + this.bufferOff === this.buffer.length && + (i += this._flushBuffer(r, i))); + for ( + var o = e.length - ((e.length - t) % this.blockSize); + t < o; + t += this.blockSize + ) + this._update(e, t, r, i), (i += this.blockSize); + for (; t < e.length; t++, this.bufferOff++) + this.buffer[this.bufferOff] = e[t]; + return r; + }), + (r.prototype._updateDecrypt = function (e) { + for ( + var t = 0, + i = 0, + n = Math.ceil((this.bufferOff + e.length) / this.blockSize) - 1, + r = new Array(n * this.blockSize); + n > 0; + n-- + ) + (t += this._buffer(e, t)), (i += this._flushBuffer(r, i)); + return (t += this._buffer(e, t)), r; + }), + (r.prototype.final = function (e) { var t, i; - return e && (t = this.update(e)), - i = "encrypt" === this.type ? this._finalEncrypt() : this._finalDecrypt(), - t ? t.concat(i) : i - } - , - r.prototype._pad = function(e, t) { - if (0 === t) - return false; - for (; t < e.length; ) - e[t++] = 0; - return true - } - , - r.prototype._finalEncrypt = function() { - if (!this._pad(this.buffer, this.bufferOff)) - return []; + return ( + e && (t = this.update(e)), + (i = + "encrypt" === this.type + ? this._finalEncrypt() + : this._finalDecrypt()), + t ? t.concat(i) : i + ); + }), + (r.prototype._pad = function (e, t) { + if (0 === t) return false; + for (; t < e.length; ) e[t++] = 0; + return true; + }), + (r.prototype._finalEncrypt = function () { + if (!this._pad(this.buffer, this.bufferOff)) return []; var e = new Array(this.blockSize); - return this._update(this.buffer, 0, e, 0), - e - } - , - r.prototype._unpad = function(e) { - return e - } - , - r.prototype._finalDecrypt = function() { + return this._update(this.buffer, 0, e, 0), e; + }), + (r.prototype._unpad = function (e) { + return e; + }), + (r.prototype._finalDecrypt = function () { n.equal(this.bufferOff, this.blockSize, "Not enough data to decrypt"); var e = new Array(this.blockSize); - return this._flushBuffer(e, 0), - this._unpad(e) - } -} -, function(e, t, i) { + return this._flushBuffer(e, 0), this._unpad(e); + }); + }, + function (e, t, i) { "use strict"; - var n = i(25) - , r = i(1) - , o = i(131) - , a = o.utils - , s = o.Cipher; + var n = i(25), + r = i(1), + o = i(131), + a = o.utils, + s = o.Cipher; function c() { - this.tmp = new Array(2), - this.keys = null + (this.tmp = new Array(2)), (this.keys = null); } function u(e) { - s.call(this, e); - var t = new c; - this._desState = t, - this.deriveKeys(t, e.key) + s.call(this, e); + var t = new c(); + (this._desState = t), this.deriveKeys(t, e.key); } r(u, s), - e.exports = u, - u.create = function(e) { - return new u(e) - } - ; + (e.exports = u), + (u.create = function (e) { + return new u(e); + }); var l = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1]; - u.prototype.deriveKeys = function(e, t) { - e.keys = new Array(32), + (u.prototype.deriveKeys = function (e, t) { + (e.keys = new Array(32)), n.equal(t.length, this.blockSize, "Invalid key length"); - var i = a.readUInt32BE(t, 0) - , r = a.readUInt32BE(t, 4); - a.pc1(i, r, e.tmp, 0), - i = e.tmp[0], - r = e.tmp[1]; - for (var o = 0; o < e.keys.length; o += 2) { - var s = l[o >>> 1]; - i = a.r28shl(i, s), - r = a.r28shl(r, s), - a.pc2(i, r, e.keys, o) - } - } - , - u.prototype._update = function(e, t, i, n) { - var r = this._desState - , o = a.readUInt32BE(e, t) - , s = a.readUInt32BE(e, t + 4); + var i = a.readUInt32BE(t, 0), + r = a.readUInt32BE(t, 4); + a.pc1(i, r, e.tmp, 0), (i = e.tmp[0]), (r = e.tmp[1]); + for (var o = 0; o < e.keys.length; o += 2) { + var s = l[o >>> 1]; + (i = a.r28shl(i, s)), (r = a.r28shl(r, s)), a.pc2(i, r, e.keys, o); + } + }), + (u.prototype._update = function (e, t, i, n) { + var r = this._desState, + o = a.readUInt32BE(e, t), + s = a.readUInt32BE(e, t + 4); a.ip(o, s, r.tmp, 0), - o = r.tmp[0], - s = r.tmp[1], - "encrypt" === this.type ? this._encrypt(r, o, s, r.tmp, 0) : this._decrypt(r, o, s, r.tmp, 0), - o = r.tmp[0], - s = r.tmp[1], - a.writeUInt32BE(i, o, n), - a.writeUInt32BE(i, s, n + 4) - } - , - u.prototype._pad = function(e, t) { - for (var i = e.length - t, n = t; n < e.length; n++) - e[n] = i; - return true - } - , - u.prototype._unpad = function(e) { + (o = r.tmp[0]), + (s = r.tmp[1]), + "encrypt" === this.type + ? this._encrypt(r, o, s, r.tmp, 0) + : this._decrypt(r, o, s, r.tmp, 0), + (o = r.tmp[0]), + (s = r.tmp[1]), + a.writeUInt32BE(i, o, n), + a.writeUInt32BE(i, s, n + 4); + }), + (u.prototype._pad = function (e, t) { + for (var i = e.length - t, n = t; n < e.length; n++) e[n] = i; + return true; + }), + (u.prototype._unpad = function (e) { for (var t = e[e.length - 1], i = e.length - t; i < e.length; i++) - n.equal(e[i], t); - return e.slice(0, e.length - t) - } - , - u.prototype._encrypt = function(e, t, i, n, r) { + n.equal(e[i], t); + return e.slice(0, e.length - t); + }), + (u.prototype._encrypt = function (e, t, i, n, r) { for (var o = t, s = i, c = 0; c < e.keys.length; c += 2) { - var u = e.keys[c] - , l = e.keys[c + 1]; - a.expand(s, e.tmp, 0), - u ^= e.tmp[0], - l ^= e.tmp[1]; - var h = a.substitute(u, l) - , f = s; - s = (o ^ a.permute(h)) >>> 0, - o = f + var u = e.keys[c], + l = e.keys[c + 1]; + a.expand(s, e.tmp, 0), (u ^= e.tmp[0]), (l ^= e.tmp[1]); + var h = a.substitute(u, l), + f = s; + (s = (o ^ a.permute(h)) >>> 0), (o = f); } - a.rip(s, o, n, r) - } - , - u.prototype._decrypt = function(e, t, i, n, r) { + a.rip(s, o, n, r); + }), + (u.prototype._decrypt = function (e, t, i, n, r) { for (var o = i, s = t, c = e.keys.length - 2; c >= 0; c -= 2) { - var u = e.keys[c] - , l = e.keys[c + 1]; - a.expand(o, e.tmp, 0), - u ^= e.tmp[0], - l ^= e.tmp[1]; - var h = a.substitute(u, l) - , f = o; - o = (s ^ a.permute(h)) >>> 0, - s = f + var u = e.keys[c], + l = e.keys[c + 1]; + a.expand(o, e.tmp, 0), (u ^= e.tmp[0]), (l ^= e.tmp[1]); + var h = a.substitute(u, l), + f = o; + (o = (s ^ a.permute(h)) >>> 0), (s = f); } - a.rip(o, s, n, r) - } -} -, function(e, t, i) { + a.rip(o, s, n, r); + }); + }, + function (e, t, i) { "use strict"; - var n = i(25) - , r = i(1) - , o = {}; + var n = i(25), + r = i(1), + o = {}; function a(e) { - n.equal(e.length, 8, "Invalid IV length"), - this.iv = new Array(8); - for (var t = 0; t < this.iv.length; t++) - this.iv[t] = e[t] + n.equal(e.length, 8, "Invalid IV length"), (this.iv = new Array(8)); + for (var t = 0; t < this.iv.length; t++) this.iv[t] = e[t]; } - t.instantiate = function(e) { - function t(t) { - e.call(this, t), - this._cbcInit() - } - r(t, e); - for (var i = Object.keys(o), n = 0; n < i.length; n++) { - var a = i[n]; - t.prototype[a] = o[a] - } - return t.create = function(e) { - return new t(e) - } - , + (t.instantiate = function (e) { + function t(t) { + e.call(this, t), this._cbcInit(); + } + r(t, e); + for (var i = Object.keys(o), n = 0; n < i.length; n++) { + var a = i[n]; + t.prototype[a] = o[a]; + } + return ( + (t.create = function (e) { + return new t(e); + }), t - } - , - o._cbcInit = function() { + ); + }), + (o._cbcInit = function () { var e = new a(this.options.iv); - this._cbcState = e - } - , - o._update = function(e, t, i, n) { - var r = this._cbcState - , o = this.constructor.super_.prototype - , a = r.iv; + this._cbcState = e; + }), + (o._update = function (e, t, i, n) { + var r = this._cbcState, + o = this.constructor.super_.prototype, + a = r.iv; if ("encrypt" === this.type) { - for (var s = 0; s < this.blockSize; s++) - a[s] ^= e[t + s]; - o._update.call(this, a, 0, i, n); - for (s = 0; s < this.blockSize; s++) - a[s] = i[n + s] + for (var s = 0; s < this.blockSize; s++) a[s] ^= e[t + s]; + o._update.call(this, a, 0, i, n); + for (s = 0; s < this.blockSize; s++) a[s] = i[n + s]; } else { - o._update.call(this, e, t, i, n); - for (s = 0; s < this.blockSize; s++) - i[n + s] ^= a[s]; - for (s = 0; s < this.blockSize; s++) - a[s] = e[t + s] + o._update.call(this, e, t, i, n); + for (s = 0; s < this.blockSize; s++) i[n + s] ^= a[s]; + for (s = 0; s < this.blockSize; s++) a[s] = e[t + s]; } - } -} -, function(e, t, i) { + }); + }, + function (e, t, i) { "use strict"; - var n = i(25) - , r = i(1) - , o = i(131) - , a = o.Cipher - , s = o.DES; + var n = i(25), + r = i(1), + o = i(131), + a = o.Cipher, + s = o.DES; function c(e, t) { - n.equal(t.length, 24, "Invalid key length"); - var i = t.slice(0, 8) - , r = t.slice(8, 16) - , o = t.slice(16, 24); - this.ciphers = "encrypt" === e ? [s.create({ - type: "encrypt", - key: i - }), s.create({ - type: "decrypt", - key: r - }), s.create({ - type: "encrypt", - key: o - })] : [s.create({ - type: "decrypt", - key: o - }), s.create({ - type: "encrypt", - key: r - }), s.create({ - type: "decrypt", - key: i - })] + n.equal(t.length, 24, "Invalid key length"); + var i = t.slice(0, 8), + r = t.slice(8, 16), + o = t.slice(16, 24); + this.ciphers = + "encrypt" === e + ? [ + s.create({ + type: "encrypt", + key: i, + }), + s.create({ + type: "decrypt", + key: r, + }), + s.create({ + type: "encrypt", + key: o, + }), + ] + : [ + s.create({ + type: "decrypt", + key: o, + }), + s.create({ + type: "encrypt", + key: r, + }), + s.create({ + type: "decrypt", + key: i, + }), + ]; } function u(e) { - a.call(this, e); - var t = new c(this.type,this.options.key); - this._edeState = t + a.call(this, e); + var t = new c(this.type, this.options.key); + this._edeState = t; } r(u, a), - e.exports = u, - u.create = function(e) { - return new u(e) - } - , - u.prototype._update = function(e, t, i, n) { + (e.exports = u), + (u.create = function (e) { + return new u(e); + }), + (u.prototype._update = function (e, t, i, n) { var r = this._edeState; r.ciphers[0]._update(e, t, i, n), - r.ciphers[1]._update(i, n, i, n), - r.ciphers[2]._update(i, n, i, n) - } - , - u.prototype._pad = s.prototype._pad, - u.prototype._unpad = s.prototype._unpad -} -, function(e, t, i) { - var n = i(133) - , r = i(209) - , o = i(2).Buffer - , a = i(210) - , s = i(44) - , c = i(89) - , u = i(90); + r.ciphers[1]._update(i, n, i, n), + r.ciphers[2]._update(i, n, i, n); + }), + (u.prototype._pad = s.prototype._pad), + (u.prototype._unpad = s.prototype._unpad); + }, + function (e, t, i) { + var n = i(133), + r = i(209), + o = i(2).Buffer, + a = i(210), + s = i(44), + c = i(89), + u = i(90); function l(e, t, i) { - s.call(this), - this._cache = new f, - this._cipher = new c.AES(t), - this._prev = o.from(i), - this._mode = e, - this._autopadding = true + s.call(this), + (this._cache = new f()), + (this._cipher = new c.AES(t)), + (this._prev = o.from(i)), + (this._mode = e), + (this._autopadding = true); } i(1)(l, s), - l.prototype._update = function(e) { + (l.prototype._update = function (e) { var t, i; this._cache.add(e); - for (var n = []; t = this._cache.get(); ) - i = this._mode.encrypt(this, t), - n.push(i); - return o.concat(n) - } - ; + for (var n = []; (t = this._cache.get()); ) + (i = this._mode.encrypt(this, t)), n.push(i); + return o.concat(n); + }); var h = o.alloc(16, 16); function f() { - this.cache = o.allocUnsafe(0) + this.cache = o.allocUnsafe(0); } function d(e, t, i) { - var s = n[e.toLowerCase()]; - if (!s) - throw new TypeError("invalid suite type"); - if ("string" == typeof t && (t = o.from(t)), - t.length !== s.key / 8) - throw new TypeError("invalid key length " + t.length); - if ("string" == typeof i && (i = o.from(i)), + var s = n[e.toLowerCase()]; + if (!s) throw new TypeError("invalid suite type"); + if (("string" == typeof t && (t = o.from(t)), t.length !== s.key / 8)) + throw new TypeError("invalid key length " + t.length); + if ( + ("string" == typeof i && (i = o.from(i)), "GCM" !== s.mode && i.length !== s.iv) - throw new TypeError("invalid iv length " + i.length); - return "stream" === s.type ? new a(s.module,t,i) : "auth" === s.type ? new r(s.module,t,i) : new l(s.module,t,i) + ) + throw new TypeError("invalid iv length " + i.length); + return "stream" === s.type + ? new a(s.module, t, i) + : "auth" === s.type + ? new r(s.module, t, i) + : new l(s.module, t, i); } - l.prototype._final = function() { - var e = this._cache.flush(); - if (this._autopadding) - return e = this._mode.encrypt(this, e), - this._cipher.scrub(), - e; - if (!e.equals(h)) - throw this._cipher.scrub(), - new Error("data not multiple of block length") - } - , - l.prototype.setAutoPadding = function(e) { - return this._autopadding = !!e, - this - } - , - f.prototype.add = function(e) { - this.cache = o.concat([this.cache, e]) - } - , - f.prototype.get = function() { + (l.prototype._final = function () { + var e = this._cache.flush(); + if (this._autopadding) + return (e = this._mode.encrypt(this, e)), this._cipher.scrub(), e; + if (!e.equals(h)) + throw ( + (this._cipher.scrub(), new Error("data not multiple of block length")) + ); + }), + (l.prototype.setAutoPadding = function (e) { + return (this._autopadding = !!e), this; + }), + (f.prototype.add = function (e) { + this.cache = o.concat([this.cache, e]); + }), + (f.prototype.get = function () { if (this.cache.length > 15) { - var e = this.cache.slice(0, 16); - return this.cache = this.cache.slice(16), - e + var e = this.cache.slice(0, 16); + return (this.cache = this.cache.slice(16)), e; } - return null - } - , - f.prototype.flush = function() { - for (var e = 16 - this.cache.length, t = o.allocUnsafe(e), i = -1; ++i < e; ) - t.writeUInt8(e, i); - return o.concat([this.cache, t]) - } - , - t.createCipheriv = d, - t.createCipher = function(e, t) { + return null; + }), + (f.prototype.flush = function () { + for ( + var e = 16 - this.cache.length, t = o.allocUnsafe(e), i = -1; + ++i < e; + + ) + t.writeUInt8(e, i); + return o.concat([this.cache, t]); + }), + (t.createCipheriv = d), + (t.createCipher = function (e, t) { var i = n[e.toLowerCase()]; - if (!i) - throw new TypeError("invalid suite type"); + if (!i) throw new TypeError("invalid suite type"); var r = u(t, false, i.key, i.iv); - return d(e, r.key, r.iv) - } -} -, function(e, t) { - t.encrypt = function(e, t) { - return e._cipher.encryptBlock(t) - } - , - t.decrypt = function(e, t) { - return e._cipher.decryptBlock(t) - } -} -, function(e, t, i) { + return d(e, r.key, r.iv); + }); + }, + function (e, t) { + (t.encrypt = function (e, t) { + return e._cipher.encryptBlock(t); + }), + (t.decrypt = function (e, t) { + return e._cipher.decryptBlock(t); + }); + }, + function (e, t, i) { var n = i(70); - t.encrypt = function(e, t) { - var i = n(t, e._prev); - return e._prev = e._cipher.encryptBlock(i), - e._prev - } - , - t.decrypt = function(e, t) { + (t.encrypt = function (e, t) { + var i = n(t, e._prev); + return (e._prev = e._cipher.encryptBlock(i)), e._prev; + }), + (t.decrypt = function (e, t) { var i = e._prev; e._prev = t; var r = e._cipher.decryptBlock(t); - return n(r, i) - } -} -, function(e, t, i) { - var n = i(2).Buffer - , r = i(70); + return n(r, i); + }); + }, + function (e, t, i) { + var n = i(2).Buffer, + r = i(70); function o(e, t, i) { - var o = t.length - , a = r(t, e._cache); - return e._cache = e._cache.slice(o), - e._prev = n.concat([e._prev, i ? t : a]), + var o = t.length, + a = r(t, e._cache); + return ( + (e._cache = e._cache.slice(o)), + (e._prev = n.concat([e._prev, i ? t : a])), a + ); } - t.encrypt = function(e, t, i) { - for (var r, a = n.allocUnsafe(0); t.length; ) { - if (0 === e._cache.length && (e._cache = e._cipher.encryptBlock(e._prev), - e._prev = n.allocUnsafe(0)), - !(e._cache.length <= t.length)) { - a = n.concat([a, o(e, t, i)]); - break - } - r = e._cache.length, - a = n.concat([a, o(e, t.slice(0, r), i)]), - t = t.slice(r) + t.encrypt = function (e, t, i) { + for (var r, a = n.allocUnsafe(0); t.length; ) { + if ( + (0 === e._cache.length && + ((e._cache = e._cipher.encryptBlock(e._prev)), + (e._prev = n.allocUnsafe(0))), + !(e._cache.length <= t.length)) + ) { + a = n.concat([a, o(e, t, i)]); + break; } - return a - } -} -, function(e, t, i) { + (r = e._cache.length), + (a = n.concat([a, o(e, t.slice(0, r), i)])), + (t = t.slice(r)); + } + return a; + }; + }, + function (e, t, i) { var n = i(2).Buffer; function r(e, t, i) { - var r = e._cipher.encryptBlock(e._prev)[0] ^ t; - return e._prev = n.concat([e._prev.slice(1), n.from([i ? t : r])]), - r + var r = e._cipher.encryptBlock(e._prev)[0] ^ t; + return (e._prev = n.concat([e._prev.slice(1), n.from([i ? t : r])])), r; } - t.encrypt = function(e, t, i) { - for (var o = t.length, a = n.allocUnsafe(o), s = -1; ++s < o; ) - a[s] = r(e, t[s], i); - return a - } -} -, function(e, t, i) { + t.encrypt = function (e, t, i) { + for (var o = t.length, a = n.allocUnsafe(o), s = -1; ++s < o; ) + a[s] = r(e, t[s], i); + return a; + }; + }, + function (e, t, i) { var n = i(2).Buffer; function r(e, t, i) { - for (var n, r, a = -1, s = 0; ++a < 8; ) - n = t & 1 << 7 - a ? 128 : 0, - s += (128 & (r = e._cipher.encryptBlock(e._prev)[0] ^ n)) >> a % 8, - e._prev = o(e._prev, i ? n : r); - return s + for (var n, r, a = -1, s = 0; ++a < 8; ) + (n = t & (1 << (7 - a)) ? 128 : 0), + (s += (128 & (r = e._cipher.encryptBlock(e._prev)[0] ^ n)) >> a % 8), + (e._prev = o(e._prev, i ? n : r)); + return s; } function o(e, t) { - var i = e.length - , r = -1 - , o = n.allocUnsafe(e.length); - for (e = n.concat([e, n.from([t])]); ++r < i; ) - o[r] = e[r] << 1 | e[r + 1] >> 7; - return o + var i = e.length, + r = -1, + o = n.allocUnsafe(e.length); + for (e = n.concat([e, n.from([t])]); ++r < i; ) + o[r] = (e[r] << 1) | (e[r + 1] >> 7); + return o; } - t.encrypt = function(e, t, i) { - for (var o = t.length, a = n.allocUnsafe(o), s = -1; ++s < o; ) - a[s] = r(e, t[s], i); - return a - } -} -, function(e, t, i) { - (function(e) { - var n = i(70); - function r(e) { - return e._prev = e._cipher.encryptBlock(e._prev), - e._prev - } - t.encrypt = function(t, i) { - for (; t._cache.length < i.length; ) - t._cache = e.concat([t._cache, r(t)]); - var o = t._cache.slice(0, i.length); - return t._cache = t._cache.slice(i.length), - n(i, o) - } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { - var n = i(2).Buffer - , r = n.alloc(16, 0); + t.encrypt = function (e, t, i) { + for (var o = t.length, a = n.allocUnsafe(o), s = -1; ++s < o; ) + a[s] = r(e, t[s], i); + return a; + }; + }, + function (e, t, i) { + (function (e) { + var n = i(70); + function r(e) { + return (e._prev = e._cipher.encryptBlock(e._prev)), e._prev; + } + t.encrypt = function (t, i) { + for (; t._cache.length < i.length; ) + t._cache = e.concat([t._cache, r(t)]); + var o = t._cache.slice(0, i.length); + return (t._cache = t._cache.slice(i.length)), n(i, o); + }; + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { + var n = i(2).Buffer, + r = n.alloc(16, 0); function o(e) { - var t = n.allocUnsafe(16); - return t.writeUInt32BE(e[0] >>> 0, 0), + var t = n.allocUnsafe(16); + return ( + t.writeUInt32BE(e[0] >>> 0, 0), t.writeUInt32BE(e[1] >>> 0, 4), t.writeUInt32BE(e[2] >>> 0, 8), t.writeUInt32BE(e[3] >>> 0, 12), t + ); } function a(e) { - this.h = e, - this.state = n.alloc(16, 0), - this.cache = n.allocUnsafe(0) + (this.h = e), + (this.state = n.alloc(16, 0)), + (this.cache = n.allocUnsafe(0)); } - a.prototype.ghash = function(e) { - for (var t = -1; ++t < e.length; ) - this.state[t] ^= e[t]; - this._multiply() - } - , - a.prototype._multiply = function() { - for (var e, t, i, n = [(e = this.h).readUInt32BE(0), e.readUInt32BE(4), e.readUInt32BE(8), e.readUInt32BE(12)], r = [0, 0, 0, 0], a = -1; ++a < 128; ) { - for (0 != (this.state[~~(a / 8)] & 1 << 7 - a % 8) && (r[0] ^= n[0], - r[1] ^= n[1], - r[2] ^= n[2], - r[3] ^= n[3]), - i = 0 != (1 & n[3]), - t = 3; t > 0; t--) - n[t] = n[t] >>> 1 | (1 & n[t - 1]) << 31; - n[0] = n[0] >>> 1, - i && (n[0] = n[0] ^ 225 << 24) + (a.prototype.ghash = function (e) { + for (var t = -1; ++t < e.length; ) this.state[t] ^= e[t]; + this._multiply(); + }), + (a.prototype._multiply = function () { + for ( + var e, + t, + i, + n = [ + (e = this.h).readUInt32BE(0), + e.readUInt32BE(4), + e.readUInt32BE(8), + e.readUInt32BE(12), + ], + r = [0, 0, 0, 0], + a = -1; + ++a < 128; + + ) { + for ( + 0 != (this.state[~~(a / 8)] & (1 << (7 - (a % 8)))) && + ((r[0] ^= n[0]), (r[1] ^= n[1]), (r[2] ^= n[2]), (r[3] ^= n[3])), + i = 0 != (1 & n[3]), + t = 3; + t > 0; + t-- + ) + n[t] = (n[t] >>> 1) | ((1 & n[t - 1]) << 31); + (n[0] = n[0] >>> 1), i && (n[0] = n[0] ^ (225 << 24)); } - this.state = o(r) - } - , - a.prototype.update = function(e) { + this.state = o(r); + }), + (a.prototype.update = function (e) { var t; for (this.cache = n.concat([this.cache, e]); this.cache.length >= 16; ) - t = this.cache.slice(0, 16), - this.cache = this.cache.slice(16), - this.ghash(t) - } - , - a.prototype.final = function(e, t) { - return this.cache.length && this.ghash(n.concat([this.cache, r], 16)), - this.ghash(o([0, e, 0, t])), - this.state - } - , - e.exports = a -} -, function(e, t, i) { - var n = i(209) - , r = i(2).Buffer - , o = i(133) - , a = i(210) - , s = i(44) - , c = i(89) - , u = i(90); + (t = this.cache.slice(0, 16)), + (this.cache = this.cache.slice(16)), + this.ghash(t); + }), + (a.prototype.final = function (e, t) { + return ( + this.cache.length && this.ghash(n.concat([this.cache, r], 16)), + this.ghash(o([0, e, 0, t])), + this.state + ); + }), + (e.exports = a); + }, + function (e, t, i) { + var n = i(209), + r = i(2).Buffer, + o = i(133), + a = i(210), + s = i(44), + c = i(89), + u = i(90); function l(e, t, i) { - s.call(this), - this._cache = new h, - this._last = void 0, - this._cipher = new c.AES(t), - this._prev = r.from(i), - this._mode = e, - this._autopadding = true + s.call(this), + (this._cache = new h()), + (this._last = void 0), + (this._cipher = new c.AES(t)), + (this._prev = r.from(i)), + (this._mode = e), + (this._autopadding = true); } function h() { - this.cache = r.allocUnsafe(0) + this.cache = r.allocUnsafe(0); } function f(e, t, i) { - var s = o[e.toLowerCase()]; - if (!s) - throw new TypeError("invalid suite type"); - if ("string" == typeof i && (i = r.from(i)), + var s = o[e.toLowerCase()]; + if (!s) throw new TypeError("invalid suite type"); + if ( + ("string" == typeof i && (i = r.from(i)), "GCM" !== s.mode && i.length !== s.iv) - throw new TypeError("invalid iv length " + i.length); - if ("string" == typeof t && (t = r.from(t)), - t.length !== s.key / 8) - throw new TypeError("invalid key length " + t.length); - return "stream" === s.type ? new a(s.module,t,i,true) : "auth" === s.type ? new n(s.module,t,i,true) : new l(s.module,t,i) + ) + throw new TypeError("invalid iv length " + i.length); + if (("string" == typeof t && (t = r.from(t)), t.length !== s.key / 8)) + throw new TypeError("invalid key length " + t.length); + return "stream" === s.type + ? new a(s.module, t, i, true) + : "auth" === s.type + ? new n(s.module, t, i, true) + : new l(s.module, t, i); } i(1)(l, s), - l.prototype._update = function(e) { + (l.prototype._update = function (e) { var t, i; this._cache.add(e); - for (var n = []; t = this._cache.get(this._autopadding); ) - i = this._mode.decrypt(this, t), - n.push(i); - return r.concat(n) - } - , - l.prototype._final = function() { + for (var n = []; (t = this._cache.get(this._autopadding)); ) + (i = this._mode.decrypt(this, t)), n.push(i); + return r.concat(n); + }), + (l.prototype._final = function () { var e = this._cache.flush(); if (this._autopadding) - return function(e) { - var t = e[15]; - if (t < 1 || t > 16) - throw new Error("unable to decrypt data"); - var i = -1; - for (; ++i < t; ) - if (e[i + (16 - t)] !== t) - throw new Error("unable to decrypt data"); - if (16 === t) - return; - return e.slice(0, 16 - t) - }(this._mode.decrypt(this, e)); - if (e) - throw new Error("data not multiple of block length") - } - , - l.prototype.setAutoPadding = function(e) { - return this._autopadding = !!e, - this - } - , - h.prototype.add = function(e) { - this.cache = r.concat([this.cache, e]) - } - , - h.prototype.get = function(e) { + return (function (e) { + var t = e[15]; + if (t < 1 || t > 16) throw new Error("unable to decrypt data"); + var i = -1; + for (; ++i < t; ) + if (e[i + (16 - t)] !== t) + throw new Error("unable to decrypt data"); + if (16 === t) return; + return e.slice(0, 16 - t); + })(this._mode.decrypt(this, e)); + if (e) throw new Error("data not multiple of block length"); + }), + (l.prototype.setAutoPadding = function (e) { + return (this._autopadding = !!e), this; + }), + (h.prototype.add = function (e) { + this.cache = r.concat([this.cache, e]); + }), + (h.prototype.get = function (e) { var t; if (e) { - if (this.cache.length > 16) - return t = this.cache.slice(0, 16), - this.cache = this.cache.slice(16), - t + if (this.cache.length > 16) + return ( + (t = this.cache.slice(0, 16)), + (this.cache = this.cache.slice(16)), + t + ); } else if (this.cache.length >= 16) - return t = this.cache.slice(0, 16), - this.cache = this.cache.slice(16), - t; - return null - } - , - h.prototype.flush = function() { - if (this.cache.length) - return this.cache - } - , - t.createDecipher = function(e, t) { + return ( + (t = this.cache.slice(0, 16)), + (this.cache = this.cache.slice(16)), + t + ); + return null; + }), + (h.prototype.flush = function () { + if (this.cache.length) return this.cache; + }), + (t.createDecipher = function (e, t) { var i = o[e.toLowerCase()]; - if (!i) - throw new TypeError("invalid suite type"); + if (!i) throw new TypeError("invalid suite type"); var n = u(t, false, i.key, i.iv); - return f(e, n.key, n.iv) - } - , - t.createDecipheriv = f -} -, function(e, t) { - t["des-ecb"] = { - key: 8, - iv: 0 - }, - t["des-cbc"] = t.des = { - key: 8, - iv: 8 - }, - t["des-ede3-cbc"] = t.des3 = { + return f(e, n.key, n.iv); + }), + (t.createDecipheriv = f); + }, + function (e, t) { + (t["des-ecb"] = { + key: 8, + iv: 0, + }), + (t["des-cbc"] = t.des = + { + key: 8, + iv: 8, + }), + (t["des-ede3-cbc"] = t.des3 = + { + key: 24, + iv: 8, + }), + (t["des-ede3"] = { key: 24, - iv: 8 - }, - t["des-ede3"] = { - key: 24, - iv: 0 - }, - t["des-ede-cbc"] = { + iv: 0, + }), + (t["des-ede-cbc"] = { key: 16, - iv: 8 - }, - t["des-ede"] = { + iv: 8, + }), + (t["des-ede"] = { key: 16, - iv: 0 - } -} -, function(e, t, i) { - (function(e) { - var n = i(211) - , r = i(545) - , o = i(546); - var a = { - binary: true, - hex: true, - base64: true - }; - t.DiffieHellmanGroup = t.createDiffieHellmanGroup = t.getDiffieHellman = function(t) { - var i = new e(r[t].prime,"hex") - , n = new e(r[t].gen,"hex"); - return new o(i,n) - } - , - t.createDiffieHellman = t.DiffieHellman = function t(i, r, s, c) { - return e.isBuffer(r) || void 0 === a[r] ? t(i, "binary", r, s) : (r = r || "binary", - c = c || "binary", - s = s || new e([2]), - e.isBuffer(s) || (s = new e(s,c)), - "number" == typeof i ? new o(n(i, s),s,true) : (e.isBuffer(i) || (i = new e(i,r)), - new o(i,s,true))) - } - } - ).call(this, i(9).Buffer) -} -, function(e, t) {} -, function(e, t) {} -, function(e) { + iv: 0, + }); + }, + function (e, t, i) { + (function (e) { + var n = i(211), + r = i(545), + o = i(546); + var a = { + binary: true, + hex: true, + base64: true, + }; + (t.DiffieHellmanGroup = + t.createDiffieHellmanGroup = + t.getDiffieHellman = + function (t) { + var i = new e(r[t].prime, "hex"), + n = new e(r[t].gen, "hex"); + return new o(i, n); + }), + (t.createDiffieHellman = t.DiffieHellman = + function t(i, r, s, c) { + return e.isBuffer(r) || void 0 === a[r] + ? t(i, "binary", r, s) + : ((r = r || "binary"), + (c = c || "binary"), + (s = s || new e([2])), + e.isBuffer(s) || (s = new e(s, c)), + "number" == typeof i + ? new o(n(i, s), s, true) + : (e.isBuffer(i) || (i = new e(i, r)), new o(i, s, true))); + }); + }.call(this, i(9).Buffer)); + }, + function (e, t) {}, + function (e, t) {}, + function (e) { e.exports = { - modp1: { - gen: "02", - prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff" - }, - modp2: { - gen: "02", - prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff" - }, - modp5: { - gen: "02", - prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff" - }, - modp14: { - gen: "02", - prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff" - }, - modp15: { - gen: "02", - prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff" - }, - modp16: { - gen: "02", - prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff" - }, - modp17: { - gen: "02", - prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff" - }, - modp18: { - gen: "02", - prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" - } - } -} -, function(e, t, i) { - (function(t) { - var n = i(11) - , r = new (i(212)) - , o = new n(24) - , a = new n(11) - , s = new n(10) - , c = new n(3) - , u = new n(7) - , l = i(211) - , h = i(53); - function f(e, i) { - return i = i || "utf8", - t.isBuffer(e) || (e = new t(e,i)), - this._pub = new n(e), - this - } - function d(e, i) { - return i = i || "utf8", - t.isBuffer(e) || (e = new t(e,i)), - this._priv = new n(e), - this - } - e.exports = m; - var p = {}; - function m(e, t, i) { - this.setGenerator(t), - this.__prime = new n(e), - this._prime = n.mont(this.__prime), - this._primeLen = e.length, - this._pub = void 0, - this._priv = void 0, - this._primeCode = void 0, - i ? (this.setPublicKey = f, - this.setPrivateKey = d) : this._primeCode = 8 - } - function g(e, i) { - var n = new t(e.toArray()); - return i ? n.toString(i) : n - } - Object.defineProperty(m.prototype, "verifyError", { - enumerable: true, - get: function() { - return "number" != typeof this._primeCode && (this._primeCode = function(e, t) { - var i = t.toString("hex") - , n = [i, e.toString(16)].join("_"); - if (n in p) - return p[n]; - var h, f = 0; - if (e.isEven() || !l.simpleSieve || !l.fermatTest(e) || !r.test(e)) - return f += 1, - f += "02" === i || "05" === i ? 8 : 4, - p[n] = f, - f; - switch (r.test(e.shrn(1)) || (f += 2), - i) { - case "02": - e.mod(o).cmp(a) && (f += 8); - break; - case "05": - (h = e.mod(s)).cmp(c) && h.cmp(u) && (f += 8); - break; - default: - f += 4 - } - return p[n] = f, + modp1: { + gen: "02", + prime: + "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff", + }, + modp2: { + gen: "02", + prime: + "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff", + }, + modp5: { + gen: "02", + prime: + "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff", + }, + modp14: { + gen: "02", + prime: + "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff", + }, + modp15: { + gen: "02", + prime: + "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff", + }, + modp16: { + gen: "02", + prime: + "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff", + }, + modp17: { + gen: "02", + prime: + "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff", + }, + modp18: { + gen: "02", + prime: + "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff", + }, + }; + }, + function (e, t, i) { + (function (t) { + var n = i(11), + r = new (i(212))(), + o = new n(24), + a = new n(11), + s = new n(10), + c = new n(3), + u = new n(7), + l = i(211), + h = i(53); + function f(e, i) { + return ( + (i = i || "utf8"), + t.isBuffer(e) || (e = new t(e, i)), + (this._pub = new n(e)), + this + ); + } + function d(e, i) { + return ( + (i = i || "utf8"), + t.isBuffer(e) || (e = new t(e, i)), + (this._priv = new n(e)), + this + ); + } + e.exports = m; + var p = {}; + function m(e, t, i) { + this.setGenerator(t), + (this.__prime = new n(e)), + (this._prime = n.mont(this.__prime)), + (this._primeLen = e.length), + (this._pub = void 0), + (this._priv = void 0), + (this._primeCode = void 0), + i + ? ((this.setPublicKey = f), (this.setPrivateKey = d)) + : (this._primeCode = 8); + } + function g(e, i) { + var n = new t(e.toArray()); + return i ? n.toString(i) : n; + } + Object.defineProperty(m.prototype, "verifyError", { + enumerable: true, + get: function () { + return ( + "number" != typeof this._primeCode && + (this._primeCode = (function (e, t) { + var i = t.toString("hex"), + n = [i, e.toString(16)].join("_"); + if (n in p) return p[n]; + var h, + f = 0; + if ( + e.isEven() || + !l.simpleSieve || + !l.fermatTest(e) || + !r.test(e) + ) + return ( + (f += 1), + (f += "02" === i || "05" === i ? 8 : 4), + (p[n] = f), f - }(this.__prime, this.__gen)), - this._primeCode - } - }), - m.prototype.generateKeys = function() { - return this._priv || (this._priv = new n(h(this._primeLen))), - this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(), - this.getPublicKey() - } - , - m.prototype.computeSecret = function(e) { - var i = (e = (e = new n(e)).toRed(this._prime)).redPow(this._priv).fromRed() - , r = new t(i.toArray()) - , o = this.getPrime(); - if (r.length < o.length) { - var a = new t(o.length - r.length); - a.fill(0), - r = t.concat([a, r]) - } - return r - } - , - m.prototype.getPublicKey = function(e) { - return g(this._pub, e) - } - , - m.prototype.getPrivateKey = function(e) { - return g(this._priv, e) - } - , - m.prototype.getPrime = function(e) { - return g(this.__prime, e) - } - , - m.prototype.getGenerator = function(e) { - return g(this._gen, e) - } - , - m.prototype.setGenerator = function(e, i) { - return i = i || "utf8", - t.isBuffer(e) || (e = new t(e,i)), - this.__gen = e, - this._gen = new n(e), - this - } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { - (function(t) { - var n = i(69) - , r = i(128) - , o = i(1) - , a = i(548) - , s = i(584) - , c = i(201); - function u(e) { - r.Writable.call(this); - var t = c[e]; - if (!t) - throw new Error("Unknown message digest"); - this._hashType = t.hash, - this._hash = n(t.hash), - this._tag = t.id, - this._signType = t.sign - } - function l(e) { - r.Writable.call(this); - var t = c[e]; - if (!t) - throw new Error("Unknown message digest"); - this._hash = n(t.hash), - this._tag = t.id, - this._signType = t.sign - } - function h(e) { - return new u(e) - } - function f(e) { - return new l(e) - } - Object.keys(c).forEach(function(e) { - c[e].id = new t(c[e].id,"hex"), - c[e.toLowerCase()] = c[e] - }), - o(u, r.Writable), - u.prototype._write = function(e, t, i) { - this._hash.update(e), - i() - } - , - u.prototype.update = function(e, i) { - return "string" == typeof e && (e = new t(e,i)), - this._hash.update(e), - this - } - , - u.prototype.sign = function(e, t) { - this.end(); - var i = this._hash.digest() - , n = a(i, e, this._hashType, this._signType, this._tag); - return t ? n.toString(t) : n - } - , - o(l, r.Writable), - l.prototype._write = function(e, t, i) { - this._hash.update(e), - i() - } - , - l.prototype.update = function(e, i) { - return "string" == typeof e && (e = new t(e,i)), - this._hash.update(e), - this - } - , - l.prototype.verify = function(e, i, n) { - "string" == typeof i && (i = new t(i,n)), - this.end(); - var r = this._hash.digest(); - return s(i, r, e, this._signType, this._tag) - } - , - e.exports = { - Sign: h, - Verify: f, - createSign: h, - createVerify: f - } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { - (function(t) { - var n = i(199) - , r = i(134) - , o = i(17).ec - , a = i(11) - , s = i(92) - , c = i(222); - function u(e, i, r, o) { - if ((e = new t(e.toArray())).length < i.byteLength()) { - var a = new t(i.byteLength() - e.length); - a.fill(0), - e = t.concat([a, e]) - } - var s = r.length - , c = function(e, i) { - e = (e = l(e, i)).mod(i); - var n = new t(e.toArray()); - if (n.length < i.byteLength()) { - var r = new t(i.byteLength() - n.length); - r.fill(0), - n = t.concat([r, n]) + ); + switch ((r.test(e.shrn(1)) || (f += 2), i)) { + case "02": + e.mod(o).cmp(a) && (f += 8); + break; + case "05": + (h = e.mod(s)).cmp(c) && h.cmp(u) && (f += 8); + break; + default: + f += 4; } - return n - }(r, i) - , u = new t(s); - u.fill(1); - var h = new t(s); - return h.fill(0), - h = n(o, h).update(u).update(new t([0])).update(e).update(c).digest(), - u = n(o, h).update(u).digest(), - { - k: h = n(o, h).update(u).update(new t([1])).update(e).update(c).digest(), - v: u = n(o, h).update(u).digest() + return (p[n] = f), f; + })(this.__prime, this.__gen)), + this._primeCode + ); + }, + }), + (m.prototype.generateKeys = function () { + return ( + this._priv || (this._priv = new n(h(this._primeLen))), + (this._pub = this._gen + .toRed(this._prime) + .redPow(this._priv) + .fromRed()), + this.getPublicKey() + ); + }), + (m.prototype.computeSecret = function (e) { + var i = (e = (e = new n(e)).toRed(this._prime)) + .redPow(this._priv) + .fromRed(), + r = new t(i.toArray()), + o = this.getPrime(); + if (r.length < o.length) { + var a = new t(o.length - r.length); + a.fill(0), (r = t.concat([a, r])); + } + return r; + }), + (m.prototype.getPublicKey = function (e) { + return g(this._pub, e); + }), + (m.prototype.getPrivateKey = function (e) { + return g(this._priv, e); + }), + (m.prototype.getPrime = function (e) { + return g(this.__prime, e); + }), + (m.prototype.getGenerator = function (e) { + return g(this._gen, e); + }), + (m.prototype.setGenerator = function (e, i) { + return ( + (i = i || "utf8"), + t.isBuffer(e) || (e = new t(e, i)), + (this.__gen = e), + (this._gen = new n(e)), + this + ); + }); + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { + (function (t) { + var n = i(69), + r = i(128), + o = i(1), + a = i(548), + s = i(584), + c = i(201); + function u(e) { + r.Writable.call(this); + var t = c[e]; + if (!t) throw new Error("Unknown message digest"); + (this._hashType = t.hash), + (this._hash = n(t.hash)), + (this._tag = t.id), + (this._signType = t.sign); + } + function l(e) { + r.Writable.call(this); + var t = c[e]; + if (!t) throw new Error("Unknown message digest"); + (this._hash = n(t.hash)), (this._tag = t.id), (this._signType = t.sign); + } + function h(e) { + return new u(e); + } + function f(e) { + return new l(e); + } + Object.keys(c).forEach(function (e) { + (c[e].id = new t(c[e].id, "hex")), (c[e.toLowerCase()] = c[e]); + }), + o(u, r.Writable), + (u.prototype._write = function (e, t, i) { + this._hash.update(e), i(); + }), + (u.prototype.update = function (e, i) { + return ( + "string" == typeof e && (e = new t(e, i)), + this._hash.update(e), + this + ); + }), + (u.prototype.sign = function (e, t) { + this.end(); + var i = this._hash.digest(), + n = a(i, e, this._hashType, this._signType, this._tag); + return t ? n.toString(t) : n; + }), + o(l, r.Writable), + (l.prototype._write = function (e, t, i) { + this._hash.update(e), i(); + }), + (l.prototype.update = function (e, i) { + return ( + "string" == typeof e && (e = new t(e, i)), + this._hash.update(e), + this + ); + }), + (l.prototype.verify = function (e, i, n) { + "string" == typeof i && (i = new t(i, n)), this.end(); + var r = this._hash.digest(); + return s(i, r, e, this._signType, this._tag); + }), + (e.exports = { + Sign: h, + Verify: f, + createSign: h, + createVerify: f, + }); + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { + (function (t) { + var n = i(199), + r = i(134), + o = i(17).ec, + a = i(11), + s = i(92), + c = i(222); + function u(e, i, r, o) { + if ((e = new t(e.toArray())).length < i.byteLength()) { + var a = new t(i.byteLength() - e.length); + a.fill(0), (e = t.concat([a, e])); + } + var s = r.length, + c = (function (e, i) { + e = (e = l(e, i)).mod(i); + var n = new t(e.toArray()); + if (n.length < i.byteLength()) { + var r = new t(i.byteLength() - n.length); + r.fill(0), (n = t.concat([r, n])); } + return n; + })(r, i), + u = new t(s); + u.fill(1); + var h = new t(s); + return ( + h.fill(0), + (h = n(o, h) + .update(u) + .update(new t([0])) + .update(e) + .update(c) + .digest()), + (u = n(o, h).update(u).digest()), + { + k: (h = n(o, h) + .update(u) + .update(new t([1])) + .update(e) + .update(c) + .digest()), + v: (u = n(o, h).update(u).digest()), + } + ); + } + function l(e, t) { + var i = new a(e), + n = (e.length << 3) - t.bitLength(); + return n > 0 && i.ishrn(n), i; + } + function h(e, i, r) { + var o, a; + do { + for (o = new t(0); 8 * o.length < e.bitLength(); ) + (i.v = n(r, i.k).update(i.v).digest()), (o = t.concat([o, i.v])); + (a = l(o, e)), + (i.k = n(r, i.k) + .update(i.v) + .update(new t([0])) + .digest()), + (i.v = n(r, i.k).update(i.v).digest()); + } while (-1 !== a.cmp(e)); + return a; + } + function f(e, t, i, n) { + return e.toRed(a.mont(i)).redPow(t).fromRed().mod(n); + } + (e.exports = function (e, i, n, d, p) { + var m = s(i); + if (m.curve) { + if ("ecdsa" !== d && "ecdsa/rsa" !== d) + throw new Error("wrong private key type"); + return (function (e, i) { + var n = c[i.curve.join(".")]; + if (!n) throw new Error("unknown curve " + i.curve.join(".")); + var r = new o(n).keyFromPrivate(i.privateKey).sign(e); + return new t(r.toDER()); + })(e, m); } - function l(e, t) { - var i = new a(e) - , n = (e.length << 3) - t.bitLength(); - return n > 0 && i.ishrn(n), - i + if ("dsa" === m.type) { + if ("dsa" !== d) throw new Error("wrong private key type"); + return (function (e, i, n) { + for ( + var r, + o = i.params.priv_key, + s = i.params.p, + c = i.params.q, + d = i.params.g, + p = new a(0), + m = l(e, c).mod(c), + g = false, + _ = u(o, c, e, n); + false === g; + + ) + (r = h(c, _, n)), + (p = f(d, r, s, c)), + 0 === + (g = r + .invm(c) + .imul(m.add(o.mul(p))) + .mod(c)).cmpn(0) && ((g = false), (p = new a(0))); + return (function (e, i) { + (e = e.toArray()), + (i = i.toArray()), + 128 & e[0] && (e = [0].concat(e)), + 128 & i[0] && (i = [0].concat(i)); + var n = [48, e.length + i.length + 4, 2, e.length]; + return (n = n.concat(e, [2, i.length], i)), new t(n); + })(p, g); + })(e, m, n); } - function h(e, i, r) { - var o, a; - do { - for (o = new t(0); 8 * o.length < e.bitLength(); ) - i.v = n(r, i.k).update(i.v).digest(), - o = t.concat([o, i.v]); - a = l(o, e), - i.k = n(r, i.k).update(i.v).update(new t([0])).digest(), - i.v = n(r, i.k).update(i.v).digest() - } while (-1 !== a.cmp(e));return a - } - function f(e, t, i, n) { - return e.toRed(a.mont(i)).redPow(t).fromRed().mod(n) - } - e.exports = function(e, i, n, d, p) { - var m = s(i); - if (m.curve) { - if ("ecdsa" !== d && "ecdsa/rsa" !== d) - throw new Error("wrong private key type"); - return function(e, i) { - var n = c[i.curve.join(".")]; - if (!n) - throw new Error("unknown curve " + i.curve.join(".")); - var r = new o(n).keyFromPrivate(i.privateKey).sign(e); - return new t(r.toDER()) - }(e, m) - } - if ("dsa" === m.type) { - if ("dsa" !== d) - throw new Error("wrong private key type"); - return function(e, i, n) { - for (var r, o = i.params.priv_key, s = i.params.p, c = i.params.q, d = i.params.g, p = new a(0), m = l(e, c).mod(c), g = false, _ = u(o, c, e, n); false === g; ) - r = h(c, _, n), - p = f(d, r, s, c), - 0 === (g = r.invm(c).imul(m.add(o.mul(p))).mod(c)).cmpn(0) && (g = false, - p = new a(0)); - return function(e, i) { - e = e.toArray(), - i = i.toArray(), - 128 & e[0] && (e = [0].concat(e)), - 128 & i[0] && (i = [0].concat(i)); - var n = [48, e.length + i.length + 4, 2, e.length]; - return n = n.concat(e, [2, i.length], i), - new t(n) - }(p, g) - }(e, m, n) - } - if ("rsa" !== d && "ecdsa/rsa" !== d) - throw new Error("wrong private key type"); - e = t.concat([p, e]); - for (var g = m.modulus.byteLength(), _ = [0, 1]; e.length + _.length + 1 < g; ) - _.push(255); - _.push(0); - for (var v = -1; ++v < e.length; ) - _.push(e[v]); - return r(_, m) - } - , - e.exports.getKey = u, - e.exports.makeKey = h - } - ).call(this, i(9).Buffer) -} -, function(e) { + if ("rsa" !== d && "ecdsa/rsa" !== d) + throw new Error("wrong private key type"); + e = t.concat([p, e]); + for ( + var g = m.modulus.byteLength(), _ = [0, 1]; + e.length + _.length + 1 < g; + + ) + _.push(255); + _.push(0); + for (var v = -1; ++v < e.length; ) _.push(e[v]); + return r(_, m); + }), + (e.exports.getKey = u), + (e.exports.makeKey = h); + }.call(this, i(9).Buffer)); + }, + function (e) { e.exports = { - _args: [["elliptic@6.4.1", "/Users/wenlanyang/Github/MinecraftClassic"]], - _development: true, - _from: "elliptic@6.4.1", - _id: "elliptic@6.4.1", - _inBundle: false, - _integrity: "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", - _location: "/elliptic", - _phantomChildren: {}, - _requested: { - type: "version", - registry: true, - raw: "elliptic@6.4.1", - name: "elliptic", - escapedName: "elliptic", - rawSpec: "6.4.1", - saveSpec: null, - fetchSpec: "6.4.1" - }, - _requiredBy: ["/browserify-sign", "/create-ecdh"], - _resolved: "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", - _spec: "6.4.1", - _where: "/Users/wenlanyang/Github/MinecraftClassic", - author: { - name: "Fedor Indutny", - email: "fedor@indutny.com" - }, - bugs: { - url: "https://github.com/indutny/elliptic/issues" - }, - dependencies: { - "bn.js": "^4.4.0", - brorand: "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - inherits: "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - }, - description: "EC cryptography", - devDependencies: { - brfs: "^1.4.3", - coveralls: "^2.11.3", - grunt: "^0.4.5", - "grunt-browserify": "^5.0.0", - "grunt-cli": "^1.2.0", - "grunt-contrib-connect": "^1.0.0", - "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^1.0.1", - "grunt-mocha-istanbul": "^3.0.1", - "grunt-saucelabs": "^8.6.2", - istanbul: "^0.4.2", - jscs: "^2.9.0", - jshint: "^2.6.0", - mocha: "^2.1.0" - }, - files: ["lib"], - homepage: "https://github.com/indutny/elliptic", - keywords: ["EC", "Elliptic", "curve", "Cryptography"], - license: "MIT", - main: "lib/elliptic.js", + _args: [["elliptic@6.4.1", "/Users/wenlanyang/Github/MinecraftClassic"]], + _development: true, + _from: "elliptic@6.4.1", + _id: "elliptic@6.4.1", + _inBundle: false, + _integrity: + "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + _location: "/elliptic", + _phantomChildren: {}, + _requested: { + type: "version", + registry: true, + raw: "elliptic@6.4.1", name: "elliptic", - repository: { - type: "git", - url: "git+ssh://git@github.com/indutny/elliptic.git" - }, - scripts: { - jscs: "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", - jshint: "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", - lint: "npm run jscs && npm run jshint", - test: "npm run lint && npm run unit", - unit: "istanbul test _mocha --reporter=spec test/index.js", - version: "grunt dist && git add dist/" - }, - version: "6.4.1" - } -} -, function(e, t, i) { + escapedName: "elliptic", + rawSpec: "6.4.1", + saveSpec: null, + fetchSpec: "6.4.1", + }, + _requiredBy: ["/browserify-sign", "/create-ecdh"], + _resolved: "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + _spec: "6.4.1", + _where: "/Users/wenlanyang/Github/MinecraftClassic", + author: { + name: "Fedor Indutny", + email: "fedor@indutny.com", + }, + bugs: { + url: "https://github.com/indutny/elliptic/issues", + }, + dependencies: { + "bn.js": "^4.4.0", + brorand: "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + inherits: "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0", + }, + description: "EC cryptography", + devDependencies: { + brfs: "^1.4.3", + coveralls: "^2.11.3", + grunt: "^0.4.5", + "grunt-browserify": "^5.0.0", + "grunt-cli": "^1.2.0", + "grunt-contrib-connect": "^1.0.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-uglify": "^1.0.1", + "grunt-mocha-istanbul": "^3.0.1", + "grunt-saucelabs": "^8.6.2", + istanbul: "^0.4.2", + jscs: "^2.9.0", + jshint: "^2.6.0", + mocha: "^2.1.0", + }, + files: ["lib"], + homepage: "https://github.com/indutny/elliptic", + keywords: ["EC", "Elliptic", "curve", "Cryptography"], + license: "MIT", + main: "lib/elliptic.js", + name: "elliptic", + repository: { + type: "git", + url: "git+ssh://git@github.com/indutny/elliptic.git", + }, + scripts: { + jscs: "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", + jshint: + "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", + lint: "npm run jscs && npm run jshint", + test: "npm run lint && npm run unit", + unit: "istanbul test _mocha --reporter=spec test/index.js", + version: "grunt dist && git add dist/", + }, + version: "6.4.1", + }; + }, + function (e, t, i) { "use strict"; - var n = t - , r = i(11) - , o = i(25) - , a = i(214); - n.assert = o, - n.toArray = a.toArray, - n.zero2 = a.zero2, - n.toHex = a.toHex, - n.encode = a.encode, - n.getNAF = function(e, t) { - for (var i = [], n = 1 << t + 1, r = e.clone(); r.cmpn(1) >= 0; ) { - var o; - if (r.isOdd()) { - var a = r.andln(n - 1); - o = a > (n >> 1) - 1 ? (n >> 1) - a : a, - r.isubn(o) - } else - o = 0; - i.push(o); - for (var s = 0 !== r.cmpn(0) && 0 === r.andln(n - 1) ? t + 1 : 1, c = 1; c < s; c++) - i.push(0); - r.iushrn(s) + var n = t, + r = i(11), + o = i(25), + a = i(214); + (n.assert = o), + (n.toArray = a.toArray), + (n.zero2 = a.zero2), + (n.toHex = a.toHex), + (n.encode = a.encode), + (n.getNAF = function (e, t) { + for (var i = [], n = 1 << (t + 1), r = e.clone(); r.cmpn(1) >= 0; ) { + var o; + if (r.isOdd()) { + var a = r.andln(n - 1); + (o = a > (n >> 1) - 1 ? (n >> 1) - a : a), r.isubn(o); + } else o = 0; + i.push(o); + for ( + var s = 0 !== r.cmpn(0) && 0 === r.andln(n - 1) ? t + 1 : 1, c = 1; + c < s; + c++ + ) + i.push(0); + r.iushrn(s); } - return i - } - , - n.getJSF = function(e, t) { + return i; + }), + (n.getJSF = function (e, t) { var i = [[], []]; - e = e.clone(), - t = t.clone(); + (e = e.clone()), (t = t.clone()); for (var n = 0, r = 0; e.cmpn(-n) > 0 || t.cmpn(-r) > 0; ) { - var o, a, s, c = e.andln(3) + n & 3, u = t.andln(3) + r & 3; - 3 === c && (c = -1), + var o, + a, + s, + c = (e.andln(3) + n) & 3, + u = (t.andln(3) + r) & 3; + 3 === c && (c = -1), 3 === u && (u = -1), - o = 0 == (1 & c) ? 0 : 3 != (s = e.andln(7) + n & 7) && 5 !== s || 2 !== u ? c : -c, + (o = + 0 == (1 & c) + ? 0 + : (3 != (s = (e.andln(7) + n) & 7) && 5 !== s) || 2 !== u + ? c + : -c), i[0].push(o), - a = 0 == (1 & u) ? 0 : 3 != (s = t.andln(7) + r & 7) && 5 !== s || 2 !== c ? u : -u, + (a = + 0 == (1 & u) + ? 0 + : (3 != (s = (t.andln(7) + r) & 7) && 5 !== s) || 2 !== c + ? u + : -u), i[1].push(a), 2 * n === o + 1 && (n = 1 - n), 2 * r === a + 1 && (r = 1 - r), e.iushrn(1), - t.iushrn(1) + t.iushrn(1); } - return i - } - , - n.cachedProperty = function(e, t, i) { + return i; + }), + (n.cachedProperty = function (e, t, i) { var n = "_" + t; - e.prototype[t] = function() { - return void 0 !== this[n] ? this[n] : this[n] = i.call(this) - } - } - , - n.parseBytes = function(e) { - return "string" == typeof e ? n.toArray(e, "hex") : e - } - , - n.intFromLE = function(e) { - return new r(e,"hex","le") - } -} -, function(e, t, i) { + e.prototype[t] = function () { + return void 0 !== this[n] ? this[n] : (this[n] = i.call(this)); + }; + }), + (n.parseBytes = function (e) { + return "string" == typeof e ? n.toArray(e, "hex") : e; + }), + (n.intFromLE = function (e) { + return new r(e, "hex", "le"); + }); + }, + function (e, t, i) { "use strict"; - var n = i(11) - , r = i(17).utils - , o = r.getNAF - , a = r.getJSF - , s = r.assert; + var n = i(11), + r = i(17).utils, + o = r.getNAF, + a = r.getJSF, + s = r.assert; function c(e, t) { - this.type = e, - this.p = new n(t.p,16), - this.red = t.prime ? n.red(t.prime) : n.mont(this.p), - this.zero = new n(0).toRed(this.red), - this.one = new n(1).toRed(this.red), - this.two = new n(2).toRed(this.red), - this.n = t.n && new n(t.n,16), - this.g = t.g && this.pointFromJSON(t.g, t.gRed), - this._wnafT1 = new Array(4), - this._wnafT2 = new Array(4), - this._wnafT3 = new Array(4), - this._wnafT4 = new Array(4); - var i = this.n && this.p.div(this.n); - !i || i.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = true, - this.redN = this.n.toRed(this.red)) + (this.type = e), + (this.p = new n(t.p, 16)), + (this.red = t.prime ? n.red(t.prime) : n.mont(this.p)), + (this.zero = new n(0).toRed(this.red)), + (this.one = new n(1).toRed(this.red)), + (this.two = new n(2).toRed(this.red)), + (this.n = t.n && new n(t.n, 16)), + (this.g = t.g && this.pointFromJSON(t.g, t.gRed)), + (this._wnafT1 = new Array(4)), + (this._wnafT2 = new Array(4)), + (this._wnafT3 = new Array(4)), + (this._wnafT4 = new Array(4)); + var i = this.n && this.p.div(this.n); + !i || i.cmpn(100) > 0 + ? (this.redN = null) + : ((this._maxwellTrick = true), (this.redN = this.n.toRed(this.red))); } function u(e, t) { - this.curve = e, - this.type = t, - this.precomputed = null + (this.curve = e), (this.type = t), (this.precomputed = null); } - e.exports = c, - c.prototype.point = function() { - throw new Error("Not implemented") - } - , - c.prototype.validate = function() { - throw new Error("Not implemented") - } - , - c.prototype._fixedNafMul = function(e, t) { + (e.exports = c), + (c.prototype.point = function () { + throw new Error("Not implemented"); + }), + (c.prototype.validate = function () { + throw new Error("Not implemented"); + }), + (c.prototype._fixedNafMul = function (e, t) { s(e.precomputed); - var i = e._getDoubles() - , n = o(t, 1) - , r = (1 << i.step + 1) - (i.step % 2 == 0 ? 2 : 1); + var i = e._getDoubles(), + n = o(t, 1), + r = (1 << (i.step + 1)) - (i.step % 2 == 0 ? 2 : 1); r /= 3; for (var a = [], c = 0; c < n.length; c += i.step) { - var u = 0; - for (t = c + i.step - 1; t >= c; t--) - u = (u << 1) + n[t]; - a.push(u) + var u = 0; + for (t = c + i.step - 1; t >= c; t--) u = (u << 1) + n[t]; + a.push(u); } - for (var l = this.jpoint(null, null, null), h = this.jpoint(null, null, null), f = r; f > 0; f--) { - for (c = 0; c < a.length; c++) { - (u = a[c]) === f ? h = h.mixedAdd(i.points[c]) : u === -f && (h = h.mixedAdd(i.points[c].neg())) - } - l = l.add(h) + for ( + var l = this.jpoint(null, null, null), + h = this.jpoint(null, null, null), + f = r; + f > 0; + f-- + ) { + for (c = 0; c < a.length; c++) { + (u = a[c]) === f + ? (h = h.mixedAdd(i.points[c])) + : u === -f && (h = h.mixedAdd(i.points[c].neg())); + } + l = l.add(h); } - return l.toP() - } - , - c.prototype._wnafMul = function(e, t) { - var i = 4 - , n = e._getNAFPoints(i); + return l.toP(); + }), + (c.prototype._wnafMul = function (e, t) { + var i = 4, + n = e._getNAFPoints(i); i = n.wnd; - for (var r = n.points, a = o(t, i), c = this.jpoint(null, null, null), u = a.length - 1; u >= 0; u--) { - for (t = 0; u >= 0 && 0 === a[u]; u--) - t++; - if (u >= 0 && t++, - c = c.dblp(t), - u < 0) - break; - var l = a[u]; - s(0 !== l), - c = "affine" === e.type ? l > 0 ? c.mixedAdd(r[l - 1 >> 1]) : c.mixedAdd(r[-l - 1 >> 1].neg()) : l > 0 ? c.add(r[l - 1 >> 1]) : c.add(r[-l - 1 >> 1].neg()) + for ( + var r = n.points, + a = o(t, i), + c = this.jpoint(null, null, null), + u = a.length - 1; + u >= 0; + u-- + ) { + for (t = 0; u >= 0 && 0 === a[u]; u--) t++; + if ((u >= 0 && t++, (c = c.dblp(t)), u < 0)) break; + var l = a[u]; + s(0 !== l), + (c = + "affine" === e.type + ? l > 0 + ? c.mixedAdd(r[(l - 1) >> 1]) + : c.mixedAdd(r[(-l - 1) >> 1].neg()) + : l > 0 + ? c.add(r[(l - 1) >> 1]) + : c.add(r[(-l - 1) >> 1].neg())); } - return "affine" === e.type ? c.toP() : c - } - , - c.prototype._wnafMulAdd = function(e, t, i, n, r) { - for (var s = this._wnafT1, c = this._wnafT2, u = this._wnafT3, l = 0, h = 0; h < n; h++) { - var f = (S = t[h])._getNAFPoints(e); - s[h] = f.wnd, - c[h] = f.points + return "affine" === e.type ? c.toP() : c; + }), + (c.prototype._wnafMulAdd = function (e, t, i, n, r) { + for ( + var s = this._wnafT1, + c = this._wnafT2, + u = this._wnafT3, + l = 0, + h = 0; + h < n; + h++ + ) { + var f = (S = t[h])._getNAFPoints(e); + (s[h] = f.wnd), (c[h] = f.points); } for (h = n - 1; h >= 1; h -= 2) { - var d = h - 1 - , p = h; - if (1 === s[d] && 1 === s[p]) { - var m = [t[d], null, null, t[p]]; - 0 === t[d].y.cmp(t[p].y) ? (m[1] = t[d].add(t[p]), - m[2] = t[d].toJ().mixedAdd(t[p].neg())) : 0 === t[d].y.cmp(t[p].y.redNeg()) ? (m[1] = t[d].toJ().mixedAdd(t[p]), - m[2] = t[d].add(t[p].neg())) : (m[1] = t[d].toJ().mixedAdd(t[p]), - m[2] = t[d].toJ().mixedAdd(t[p].neg())); - var g = [-3, -1, -5, -7, 0, 7, 5, 1, 3] - , _ = a(i[d], i[p]); - l = Math.max(_[0].length, l), - u[d] = new Array(l), - u[p] = new Array(l); - for (var v = 0; v < l; v++) { - var y = 0 | _[0][v] - , b = 0 | _[1][v]; - u[d][v] = g[3 * (y + 1) + (b + 1)], - u[p][v] = 0, - c[d] = m - } - } else - u[d] = o(i[d], s[d]), - u[p] = o(i[p], s[p]), - l = Math.max(u[d].length, l), - l = Math.max(u[p].length, l) + var d = h - 1, + p = h; + if (1 === s[d] && 1 === s[p]) { + var m = [t[d], null, null, t[p]]; + 0 === t[d].y.cmp(t[p].y) + ? ((m[1] = t[d].add(t[p])), + (m[2] = t[d].toJ().mixedAdd(t[p].neg()))) + : 0 === t[d].y.cmp(t[p].y.redNeg()) + ? ((m[1] = t[d].toJ().mixedAdd(t[p])), + (m[2] = t[d].add(t[p].neg()))) + : ((m[1] = t[d].toJ().mixedAdd(t[p])), + (m[2] = t[d].toJ().mixedAdd(t[p].neg()))); + var g = [-3, -1, -5, -7, 0, 7, 5, 1, 3], + _ = a(i[d], i[p]); + (l = Math.max(_[0].length, l)), + (u[d] = new Array(l)), + (u[p] = new Array(l)); + for (var v = 0; v < l; v++) { + var y = 0 | _[0][v], + b = 0 | _[1][v]; + (u[d][v] = g[3 * (y + 1) + (b + 1)]), (u[p][v] = 0), (c[d] = m); + } + } else + (u[d] = o(i[d], s[d])), + (u[p] = o(i[p], s[p])), + (l = Math.max(u[d].length, l)), + (l = Math.max(u[p].length, l)); } - var E = this.jpoint(null, null, null) - , T = this._wnafT4; + var E = this.jpoint(null, null, null), + T = this._wnafT4; for (h = l; h >= 0; h--) { - for (var A = 0; h >= 0; ) { - var x = true; - for (v = 0; v < n; v++) - T[v] = 0 | u[v][h], - 0 !== T[v] && (x = false); - if (!x) - break; - A++, - h-- - } - if (h >= 0 && A++, - E = E.dblp(A), - h < 0) - break; - for (v = 0; v < n; v++) { - var S, C = T[v]; - 0 !== C && (C > 0 ? S = c[v][C - 1 >> 1] : C < 0 && (S = c[v][-C - 1 >> 1].neg()), - E = "affine" === S.type ? E.mixedAdd(S) : E.add(S)) - } + for (var A = 0; h >= 0; ) { + var x = true; + for (v = 0; v < n; v++) + (T[v] = 0 | u[v][h]), 0 !== T[v] && (x = false); + if (!x) break; + A++, h--; + } + if ((h >= 0 && A++, (E = E.dblp(A)), h < 0)) break; + for (v = 0; v < n; v++) { + var S, + C = T[v]; + 0 !== C && + (C > 0 + ? (S = c[v][(C - 1) >> 1]) + : C < 0 && (S = c[v][(-C - 1) >> 1].neg()), + (E = "affine" === S.type ? E.mixedAdd(S) : E.add(S))); + } } - for (h = 0; h < n; h++) - c[h] = null; - return r ? E : E.toP() - } - , - c.BasePoint = u, - u.prototype.eq = function() { - throw new Error("Not implemented") - } - , - u.prototype.validate = function() { - return this.curve.validate(this) - } - , - c.prototype.decodePoint = function(e, t) { + for (h = 0; h < n; h++) c[h] = null; + return r ? E : E.toP(); + }), + (c.BasePoint = u), + (u.prototype.eq = function () { + throw new Error("Not implemented"); + }), + (u.prototype.validate = function () { + return this.curve.validate(this); + }), + (c.prototype.decodePoint = function (e, t) { e = r.toArray(e, t); var i = this.p.byteLength(); if ((4 === e[0] || 6 === e[0] || 7 === e[0]) && e.length - 1 == 2 * i) - return 6 === e[0] ? s(e[e.length - 1] % 2 == 0) : 7 === e[0] && s(e[e.length - 1] % 2 == 1), - this.point(e.slice(1, 1 + i), e.slice(1 + i, 1 + 2 * i)); + return ( + 6 === e[0] + ? s(e[e.length - 1] % 2 == 0) + : 7 === e[0] && s(e[e.length - 1] % 2 == 1), + this.point(e.slice(1, 1 + i), e.slice(1 + i, 1 + 2 * i)) + ); if ((2 === e[0] || 3 === e[0]) && e.length - 1 === i) - return this.pointFromX(e.slice(1, 1 + i), 3 === e[0]); - throw new Error("Unknown point format") - } - , - u.prototype.encodeCompressed = function(e) { - return this.encode(e, true) - } - , - u.prototype._encode = function(e) { - var t = this.curve.p.byteLength() - , i = this.getX().toArray("be", t); - return e ? [this.getY().isEven() ? 2 : 3].concat(i) : [4].concat(i, this.getY().toArray("be", t)) - } - , - u.prototype.encode = function(e, t) { - return r.encode(this._encode(t), e) - } - , - u.prototype.precompute = function(e) { - if (this.precomputed) - return this; + return this.pointFromX(e.slice(1, 1 + i), 3 === e[0]); + throw new Error("Unknown point format"); + }), + (u.prototype.encodeCompressed = function (e) { + return this.encode(e, true); + }), + (u.prototype._encode = function (e) { + var t = this.curve.p.byteLength(), + i = this.getX().toArray("be", t); + return e + ? [this.getY().isEven() ? 2 : 3].concat(i) + : [4].concat(i, this.getY().toArray("be", t)); + }), + (u.prototype.encode = function (e, t) { + return r.encode(this._encode(t), e); + }), + (u.prototype.precompute = function (e) { + if (this.precomputed) return this; var t = { - doubles: null, - naf: null, - beta: null + doubles: null, + naf: null, + beta: null, }; - return t.naf = this._getNAFPoints(8), - t.doubles = this._getDoubles(4, e), - t.beta = this._getBeta(), - this.precomputed = t, - this - } - , - u.prototype._hasDoubles = function(e) { - if (!this.precomputed) - return false; + return ( + (t.naf = this._getNAFPoints(8)), + (t.doubles = this._getDoubles(4, e)), + (t.beta = this._getBeta()), + (this.precomputed = t), + this + ); + }), + (u.prototype._hasDoubles = function (e) { + if (!this.precomputed) return false; var t = this.precomputed.doubles; - return !!t && t.points.length >= Math.ceil((e.bitLength() + 1) / t.step) - } - , - u.prototype._getDoubles = function(e, t) { + return ( + !!t && t.points.length >= Math.ceil((e.bitLength() + 1) / t.step) + ); + }), + (u.prototype._getDoubles = function (e, t) { if (this.precomputed && this.precomputed.doubles) - return this.precomputed.doubles; + return this.precomputed.doubles; for (var i = [this], n = this, r = 0; r < t; r += e) { - for (var o = 0; o < e; o++) - n = n.dbl(); - i.push(n) + for (var o = 0; o < e; o++) n = n.dbl(); + i.push(n); } return { - step: e, - points: i - } - } - , - u.prototype._getNAFPoints = function(e) { + step: e, + points: i, + }; + }), + (u.prototype._getNAFPoints = function (e) { if (this.precomputed && this.precomputed.naf) - return this.precomputed.naf; - for (var t = [this], i = (1 << e) - 1, n = 1 === i ? null : this.dbl(), r = 1; r < i; r++) - t[r] = t[r - 1].add(n); + return this.precomputed.naf; + for ( + var t = [this], + i = (1 << e) - 1, + n = 1 === i ? null : this.dbl(), + r = 1; + r < i; + r++ + ) + t[r] = t[r - 1].add(n); return { - wnd: e, - points: t - } - } - , - u.prototype._getBeta = function() { - return null - } - , - u.prototype.dblp = function(e) { - for (var t = this, i = 0; i < e; i++) - t = t.dbl(); - return t - } -} -, function(e, t, i) { + wnd: e, + points: t, + }; + }), + (u.prototype._getBeta = function () { + return null; + }), + (u.prototype.dblp = function (e) { + for (var t = this, i = 0; i < e; i++) t = t.dbl(); + return t; + }); + }, + function (e, t, i) { "use strict"; - var n = i(91) - , r = i(17) - , o = i(11) - , a = i(1) - , s = n.base - , c = r.utils.assert; + var n = i(91), + r = i(17), + o = i(11), + a = i(1), + s = n.base, + c = r.utils.assert; function u(e) { - s.call(this, "short", e), - this.a = new o(e.a,16).toRed(this.red), - this.b = new o(e.b,16).toRed(this.red), - this.tinv = this.two.redInvm(), - this.zeroA = 0 === this.a.fromRed().cmpn(0), - this.threeA = 0 === this.a.fromRed().sub(this.p).cmpn(-3), - this.endo = this._getEndomorphism(e), - this._endoWnafT1 = new Array(4), - this._endoWnafT2 = new Array(4) + s.call(this, "short", e), + (this.a = new o(e.a, 16).toRed(this.red)), + (this.b = new o(e.b, 16).toRed(this.red)), + (this.tinv = this.two.redInvm()), + (this.zeroA = 0 === this.a.fromRed().cmpn(0)), + (this.threeA = 0 === this.a.fromRed().sub(this.p).cmpn(-3)), + (this.endo = this._getEndomorphism(e)), + (this._endoWnafT1 = new Array(4)), + (this._endoWnafT2 = new Array(4)); } function l(e, t, i, n) { - s.BasePoint.call(this, e, "affine"), - null === t && null === i ? (this.x = null, - this.y = null, - this.inf = true) : (this.x = new o(t,16), - this.y = new o(i,16), - n && (this.x.forceRed(this.curve.red), - this.y.forceRed(this.curve.red)), - this.x.red || (this.x = this.x.toRed(this.curve.red)), - this.y.red || (this.y = this.y.toRed(this.curve.red)), - this.inf = false) + s.BasePoint.call(this, e, "affine"), + null === t && null === i + ? ((this.x = null), (this.y = null), (this.inf = true)) + : ((this.x = new o(t, 16)), + (this.y = new o(i, 16)), + n && + (this.x.forceRed(this.curve.red), + this.y.forceRed(this.curve.red)), + this.x.red || (this.x = this.x.toRed(this.curve.red)), + this.y.red || (this.y = this.y.toRed(this.curve.red)), + (this.inf = false)); } function h(e, t, i, n) { - s.BasePoint.call(this, e, "jacobian"), - null === t && null === i && null === n ? (this.x = this.curve.one, - this.y = this.curve.one, - this.z = new o(0)) : (this.x = new o(t,16), - this.y = new o(i,16), - this.z = new o(n,16)), + s.BasePoint.call(this, e, "jacobian"), + null === t && null === i && null === n + ? ((this.x = this.curve.one), + (this.y = this.curve.one), + (this.z = new o(0))) + : ((this.x = new o(t, 16)), + (this.y = new o(i, 16)), + (this.z = new o(n, 16))), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), - this.zOne = this.z === this.curve.one + (this.zOne = this.z === this.curve.one); } a(u, s), - e.exports = u, - u.prototype._getEndomorphism = function(e) { + (e.exports = u), + (u.prototype._getEndomorphism = function (e) { if (this.zeroA && this.g && this.n && 1 === this.p.modn(3)) { - var t, i; - if (e.beta) - t = new o(e.beta,16).toRed(this.red); - else { - var n = this._getEndoRoots(this.p); - t = (t = n[0].cmp(n[1]) < 0 ? n[0] : n[1]).toRed(this.red) - } - if (e.lambda) - i = new o(e.lambda,16); - else { - var r = this._getEndoRoots(this.n); - 0 === this.g.mul(r[0]).x.cmp(this.g.x.redMul(t)) ? i = r[0] : (i = r[1], - c(0 === this.g.mul(i).x.cmp(this.g.x.redMul(t)))) - } - return { - beta: t, - lambda: i, - basis: e.basis ? e.basis.map(function(e) { - return { - a: new o(e.a,16), - b: new o(e.b,16) - } - }) : this._getEndoBasis(i) - } + var t, i; + if (e.beta) t = new o(e.beta, 16).toRed(this.red); + else { + var n = this._getEndoRoots(this.p); + t = (t = n[0].cmp(n[1]) < 0 ? n[0] : n[1]).toRed(this.red); + } + if (e.lambda) i = new o(e.lambda, 16); + else { + var r = this._getEndoRoots(this.n); + 0 === this.g.mul(r[0]).x.cmp(this.g.x.redMul(t)) + ? (i = r[0]) + : ((i = r[1]), c(0 === this.g.mul(i).x.cmp(this.g.x.redMul(t)))); + } + return { + beta: t, + lambda: i, + basis: e.basis + ? e.basis.map(function (e) { + return { + a: new o(e.a, 16), + b: new o(e.b, 16), + }; + }) + : this._getEndoBasis(i), + }; } - } - , - u.prototype._getEndoRoots = function(e) { - var t = e === this.p ? this.red : o.mont(e) - , i = new o(2).toRed(t).redInvm() - , n = i.redNeg() - , r = new o(3).toRed(t).redNeg().redSqrt().redMul(i); - return [n.redAdd(r).fromRed(), n.redSub(r).fromRed()] - } - , - u.prototype._getEndoBasis = function(e) { - for (var t, i, n, r, a, s, c, u, l, h = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), f = e, d = this.n.clone(), p = new o(1), m = new o(0), g = new o(0), _ = new o(1), v = 0; 0 !== f.cmpn(0); ) { - var y = d.div(f); - u = d.sub(y.mul(f)), - l = g.sub(y.mul(p)); - var b = _.sub(y.mul(m)); - if (!n && u.cmp(h) < 0) - t = c.neg(), - i = p, - n = u.neg(), - r = l; - else if (n && 2 == ++v) - break; - c = u, - d = f, - f = u, - g = p, - p = l, - _ = m, - m = b + }), + (u.prototype._getEndoRoots = function (e) { + var t = e === this.p ? this.red : o.mont(e), + i = new o(2).toRed(t).redInvm(), + n = i.redNeg(), + r = new o(3).toRed(t).redNeg().redSqrt().redMul(i); + return [n.redAdd(r).fromRed(), n.redSub(r).fromRed()]; + }), + (u.prototype._getEndoBasis = function (e) { + for ( + var t, + i, + n, + r, + a, + s, + c, + u, + l, + h = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), + f = e, + d = this.n.clone(), + p = new o(1), + m = new o(0), + g = new o(0), + _ = new o(1), + v = 0; + 0 !== f.cmpn(0); + + ) { + var y = d.div(f); + (u = d.sub(y.mul(f))), (l = g.sub(y.mul(p))); + var b = _.sub(y.mul(m)); + if (!n && u.cmp(h) < 0) + (t = c.neg()), (i = p), (n = u.neg()), (r = l); + else if (n && 2 == ++v) break; + (c = u), (d = f), (f = u), (g = p), (p = l), (_ = m), (m = b); } - a = u.neg(), - s = l; + (a = u.neg()), (s = l); var E = n.sqr().add(r.sqr()); - return a.sqr().add(s.sqr()).cmp(E) >= 0 && (a = t, - s = i), - n.negative && (n = n.neg(), - r = r.neg()), - a.negative && (a = a.neg(), - s = s.neg()), - [{ - a: n, - b: r - }, { - a: a, - b: s - }] - } - , - u.prototype._endoSplit = function(e) { - var t = this.endo.basis - , i = t[0] - , n = t[1] - , r = n.b.mul(e).divRound(this.n) - , o = i.b.neg().mul(e).divRound(this.n) - , a = r.mul(i.a) - , s = o.mul(n.a) - , c = r.mul(i.b) - , u = o.mul(n.b); + return ( + a.sqr().add(s.sqr()).cmp(E) >= 0 && ((a = t), (s = i)), + n.negative && ((n = n.neg()), (r = r.neg())), + a.negative && ((a = a.neg()), (s = s.neg())), + [ + { + a: n, + b: r, + }, + { + a: a, + b: s, + }, + ] + ); + }), + (u.prototype._endoSplit = function (e) { + var t = this.endo.basis, + i = t[0], + n = t[1], + r = n.b.mul(e).divRound(this.n), + o = i.b.neg().mul(e).divRound(this.n), + a = r.mul(i.a), + s = o.mul(n.a), + c = r.mul(i.b), + u = o.mul(n.b); return { - k1: e.sub(a).sub(s), - k2: c.add(u).neg() - } - } - , - u.prototype.pointFromX = function(e, t) { - (e = new o(e,16)).red || (e = e.toRed(this.red)); - var i = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b) - , n = i.redSqrt(); + k1: e.sub(a).sub(s), + k2: c.add(u).neg(), + }; + }), + (u.prototype.pointFromX = function (e, t) { + (e = new o(e, 16)).red || (e = e.toRed(this.red)); + var i = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), + n = i.redSqrt(); if (0 !== n.redSqr().redSub(i).cmp(this.zero)) - throw new Error("invalid point"); + throw new Error("invalid point"); var r = n.fromRed().isOdd(); - return (t && !r || !t && r) && (n = n.redNeg()), - this.point(e, n) - } - , - u.prototype.validate = function(e) { - if (e.inf) - return true; - var t = e.x - , i = e.y - , n = this.a.redMul(t) - , r = t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b); - return 0 === i.redSqr().redISub(r).cmpn(0) - } - , - u.prototype._endoWnafMulAdd = function(e, t, i) { - for (var n = this._endoWnafT1, r = this._endoWnafT2, o = 0; o < e.length; o++) { - var a = this._endoSplit(t[o]) - , s = e[o] - , c = s._getBeta(); - a.k1.negative && (a.k1.ineg(), - s = s.neg(true)), - a.k2.negative && (a.k2.ineg(), - c = c.neg(true)), - n[2 * o] = s, - n[2 * o + 1] = c, - r[2 * o] = a.k1, - r[2 * o + 1] = a.k2 + return ((t && !r) || (!t && r)) && (n = n.redNeg()), this.point(e, n); + }), + (u.prototype.validate = function (e) { + if (e.inf) return true; + var t = e.x, + i = e.y, + n = this.a.redMul(t), + r = t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b); + return 0 === i.redSqr().redISub(r).cmpn(0); + }), + (u.prototype._endoWnafMulAdd = function (e, t, i) { + for ( + var n = this._endoWnafT1, r = this._endoWnafT2, o = 0; + o < e.length; + o++ + ) { + var a = this._endoSplit(t[o]), + s = e[o], + c = s._getBeta(); + a.k1.negative && (a.k1.ineg(), (s = s.neg(true))), + a.k2.negative && (a.k2.ineg(), (c = c.neg(true))), + (n[2 * o] = s), + (n[2 * o + 1] = c), + (r[2 * o] = a.k1), + (r[2 * o + 1] = a.k2); } for (var u = this._wnafMulAdd(1, n, r, 2 * o, i), l = 0; l < 2 * o; l++) - n[l] = null, - r[l] = null; - return u - } - , - a(l, s.BasePoint), - u.prototype.point = function(e, t, i) { - return new l(this,e,t,i) - } - , - u.prototype.pointFromJSON = function(e, t) { - return l.fromJSON(this, e, t) - } - , - l.prototype._getBeta = function() { + (n[l] = null), (r[l] = null); + return u; + }), + a(l, s.BasePoint), + (u.prototype.point = function (e, t, i) { + return new l(this, e, t, i); + }), + (u.prototype.pointFromJSON = function (e, t) { + return l.fromJSON(this, e, t); + }), + (l.prototype._getBeta = function () { if (this.curve.endo) { - var e = this.precomputed; - if (e && e.beta) - return e.beta; - var t = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); - if (e) { - var i = this.curve - , n = function(e) { - return i.point(e.x.redMul(i.endo.beta), e.y) - }; - e.beta = t, - t.precomputed = { - beta: null, - naf: e.naf && { - wnd: e.naf.wnd, - points: e.naf.points.map(n) - }, - doubles: e.doubles && { - step: e.doubles.step, - points: e.doubles.points.map(n) - } - } - } - return t + var e = this.precomputed; + if (e && e.beta) return e.beta; + var t = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (e) { + var i = this.curve, + n = function (e) { + return i.point(e.x.redMul(i.endo.beta), e.y); + }; + (e.beta = t), + (t.precomputed = { + beta: null, + naf: e.naf && { + wnd: e.naf.wnd, + points: e.naf.points.map(n), + }, + doubles: e.doubles && { + step: e.doubles.step, + points: e.doubles.points.map(n), + }, + }); + } + return t; } - } - , - l.prototype.toJSON = function() { - return this.precomputed ? [this.x, this.y, this.precomputed && { - doubles: this.precomputed.doubles && { - step: this.precomputed.doubles.step, - points: this.precomputed.doubles.points.slice(1) - }, - naf: this.precomputed.naf && { - wnd: this.precomputed.naf.wnd, - points: this.precomputed.naf.points.slice(1) - } - }] : [this.x, this.y] - } - , - l.fromJSON = function(e, t, i) { + }), + (l.prototype.toJSON = function () { + return this.precomputed + ? [ + this.x, + this.y, + this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1), + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1), + }, + }, + ] + : [this.x, this.y]; + }), + (l.fromJSON = function (e, t, i) { "string" == typeof t && (t = JSON.parse(t)); var n = e.point(t[0], t[1], i); - if (!t[2]) - return n; + if (!t[2]) return n; function r(t) { - return e.point(t[0], t[1], i) + return e.point(t[0], t[1], i); } var o = t[2]; - return n.precomputed = { + return ( + (n.precomputed = { beta: null, doubles: o.doubles && { - step: o.doubles.step, - points: [n].concat(o.doubles.points.map(r)) + step: o.doubles.step, + points: [n].concat(o.doubles.points.map(r)), }, naf: o.naf && { - wnd: o.naf.wnd, - points: [n].concat(o.naf.points.map(r)) - } - }, - n - } - , - l.prototype.inspect = function() { - return this.isInfinity() ? "" : "" - } - , - l.prototype.isInfinity = function() { - return this.inf - } - , - l.prototype.add = function(e) { - if (this.inf) - return e; - if (e.inf) - return this; - if (this.eq(e)) - return this.dbl(); - if (this.neg().eq(e)) - return this.curve.point(null, null); - if (0 === this.x.cmp(e.x)) - return this.curve.point(null, null); + wnd: o.naf.wnd, + points: [n].concat(o.naf.points.map(r)), + }, + }), + n + ); + }), + (l.prototype.inspect = function () { + return this.isInfinity() + ? "" + : ""; + }), + (l.prototype.isInfinity = function () { + return this.inf; + }), + (l.prototype.add = function (e) { + if (this.inf) return e; + if (e.inf) return this; + if (this.eq(e)) return this.dbl(); + if (this.neg().eq(e)) return this.curve.point(null, null); + if (0 === this.x.cmp(e.x)) return this.curve.point(null, null); var t = this.y.redSub(e.y); 0 !== t.cmpn(0) && (t = t.redMul(this.x.redSub(e.x).redInvm())); - var i = t.redSqr().redISub(this.x).redISub(e.x) - , n = t.redMul(this.x.redSub(i)).redISub(this.y); - return this.curve.point(i, n) - } - , - l.prototype.dbl = function() { - if (this.inf) - return this; + var i = t.redSqr().redISub(this.x).redISub(e.x), + n = t.redMul(this.x.redSub(i)).redISub(this.y); + return this.curve.point(i, n); + }), + (l.prototype.dbl = function () { + if (this.inf) return this; var e = this.y.redAdd(this.y); - if (0 === e.cmpn(0)) - return this.curve.point(null, null); - var t = this.curve.a - , i = this.x.redSqr() - , n = e.redInvm() - , r = i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n) - , o = r.redSqr().redISub(this.x.redAdd(this.x)) - , a = r.redMul(this.x.redSub(o)).redISub(this.y); - return this.curve.point(o, a) - } - , - l.prototype.getX = function() { - return this.x.fromRed() - } - , - l.prototype.getY = function() { - return this.y.fromRed() - } - , - l.prototype.mul = function(e) { - return e = new o(e,16), - this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e) - } - , - l.prototype.mulAdd = function(e, t, i) { - var n = [this, t] - , r = [e, i]; - return this.curve.endo ? this.curve._endoWnafMulAdd(n, r) : this.curve._wnafMulAdd(1, n, r, 2) - } - , - l.prototype.jmulAdd = function(e, t, i) { - var n = [this, t] - , r = [e, i]; - return this.curve.endo ? this.curve._endoWnafMulAdd(n, r, true) : this.curve._wnafMulAdd(1, n, r, 2, true) - } - , - l.prototype.eq = function(e) { - return this === e || this.inf === e.inf && (this.inf || 0 === this.x.cmp(e.x) && 0 === this.y.cmp(e.y)) - } - , - l.prototype.neg = function(e) { - if (this.inf) - return this; + if (0 === e.cmpn(0)) return this.curve.point(null, null); + var t = this.curve.a, + i = this.x.redSqr(), + n = e.redInvm(), + r = i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n), + o = r.redSqr().redISub(this.x.redAdd(this.x)), + a = r.redMul(this.x.redSub(o)).redISub(this.y); + return this.curve.point(o, a); + }), + (l.prototype.getX = function () { + return this.x.fromRed(); + }), + (l.prototype.getY = function () { + return this.y.fromRed(); + }), + (l.prototype.mul = function (e) { + return ( + (e = new o(e, 16)), + this._hasDoubles(e) + ? this.curve._fixedNafMul(this, e) + : this.curve.endo + ? this.curve._endoWnafMulAdd([this], [e]) + : this.curve._wnafMul(this, e) + ); + }), + (l.prototype.mulAdd = function (e, t, i) { + var n = [this, t], + r = [e, i]; + return this.curve.endo + ? this.curve._endoWnafMulAdd(n, r) + : this.curve._wnafMulAdd(1, n, r, 2); + }), + (l.prototype.jmulAdd = function (e, t, i) { + var n = [this, t], + r = [e, i]; + return this.curve.endo + ? this.curve._endoWnafMulAdd(n, r, true) + : this.curve._wnafMulAdd(1, n, r, 2, true); + }), + (l.prototype.eq = function (e) { + return ( + this === e || + (this.inf === e.inf && + (this.inf || (0 === this.x.cmp(e.x) && 0 === this.y.cmp(e.y)))) + ); + }), + (l.prototype.neg = function (e) { + if (this.inf) return this; var t = this.curve.point(this.x, this.y.redNeg()); if (e && this.precomputed) { - var i = this.precomputed - , n = function(e) { - return e.neg() + var i = this.precomputed, + n = function (e) { + return e.neg(); }; - t.precomputed = { - naf: i.naf && { - wnd: i.naf.wnd, - points: i.naf.points.map(n) - }, - doubles: i.doubles && { - step: i.doubles.step, - points: i.doubles.points.map(n) - } - } + t.precomputed = { + naf: i.naf && { + wnd: i.naf.wnd, + points: i.naf.points.map(n), + }, + doubles: i.doubles && { + step: i.doubles.step, + points: i.doubles.points.map(n), + }, + }; } - return t - } - , - l.prototype.toJ = function() { - return this.inf ? this.curve.jpoint(null, null, null) : this.curve.jpoint(this.x, this.y, this.curve.one) - } - , - a(h, s.BasePoint), - u.prototype.jpoint = function(e, t, i) { - return new h(this,e,t,i) - } - , - h.prototype.toP = function() { - if (this.isInfinity()) - return this.curve.point(null, null); - var e = this.z.redInvm() - , t = e.redSqr() - , i = this.x.redMul(t) - , n = this.y.redMul(t).redMul(e); - return this.curve.point(i, n) - } - , - h.prototype.neg = function() { - return this.curve.jpoint(this.x, this.y.redNeg(), this.z) - } - , - h.prototype.add = function(e) { - if (this.isInfinity()) - return e; - if (e.isInfinity()) - return this; - var t = e.z.redSqr() - , i = this.z.redSqr() - , n = this.x.redMul(t) - , r = e.x.redMul(i) - , o = this.y.redMul(t.redMul(e.z)) - , a = e.y.redMul(i.redMul(this.z)) - , s = n.redSub(r) - , c = o.redSub(a); + return t; + }), + (l.prototype.toJ = function () { + return this.inf + ? this.curve.jpoint(null, null, null) + : this.curve.jpoint(this.x, this.y, this.curve.one); + }), + a(h, s.BasePoint), + (u.prototype.jpoint = function (e, t, i) { + return new h(this, e, t, i); + }), + (h.prototype.toP = function () { + if (this.isInfinity()) return this.curve.point(null, null); + var e = this.z.redInvm(), + t = e.redSqr(), + i = this.x.redMul(t), + n = this.y.redMul(t).redMul(e); + return this.curve.point(i, n); + }), + (h.prototype.neg = function () { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); + }), + (h.prototype.add = function (e) { + if (this.isInfinity()) return e; + if (e.isInfinity()) return this; + var t = e.z.redSqr(), + i = this.z.redSqr(), + n = this.x.redMul(t), + r = e.x.redMul(i), + o = this.y.redMul(t.redMul(e.z)), + a = e.y.redMul(i.redMul(this.z)), + s = n.redSub(r), + c = o.redSub(a); if (0 === s.cmpn(0)) - return 0 !== c.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl(); - var u = s.redSqr() - , l = u.redMul(s) - , h = n.redMul(u) - , f = c.redSqr().redIAdd(l).redISub(h).redISub(h) - , d = c.redMul(h.redISub(f)).redISub(o.redMul(l)) - , p = this.z.redMul(e.z).redMul(s); - return this.curve.jpoint(f, d, p) - } - , - h.prototype.mixedAdd = function(e) { - if (this.isInfinity()) - return e.toJ(); - if (e.isInfinity()) - return this; - var t = this.z.redSqr() - , i = this.x - , n = e.x.redMul(t) - , r = this.y - , o = e.y.redMul(t).redMul(this.z) - , a = i.redSub(n) - , s = r.redSub(o); + return 0 !== c.cmpn(0) + ? this.curve.jpoint(null, null, null) + : this.dbl(); + var u = s.redSqr(), + l = u.redMul(s), + h = n.redMul(u), + f = c.redSqr().redIAdd(l).redISub(h).redISub(h), + d = c.redMul(h.redISub(f)).redISub(o.redMul(l)), + p = this.z.redMul(e.z).redMul(s); + return this.curve.jpoint(f, d, p); + }), + (h.prototype.mixedAdd = function (e) { + if (this.isInfinity()) return e.toJ(); + if (e.isInfinity()) return this; + var t = this.z.redSqr(), + i = this.x, + n = e.x.redMul(t), + r = this.y, + o = e.y.redMul(t).redMul(this.z), + a = i.redSub(n), + s = r.redSub(o); if (0 === a.cmpn(0)) - return 0 !== s.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl(); - var c = a.redSqr() - , u = c.redMul(a) - , l = i.redMul(c) - , h = s.redSqr().redIAdd(u).redISub(l).redISub(l) - , f = s.redMul(l.redISub(h)).redISub(r.redMul(u)) - , d = this.z.redMul(a); - return this.curve.jpoint(h, f, d) - } - , - h.prototype.dblp = function(e) { - if (0 === e) - return this; - if (this.isInfinity()) - return this; - if (!e) - return this.dbl(); + return 0 !== s.cmpn(0) + ? this.curve.jpoint(null, null, null) + : this.dbl(); + var c = a.redSqr(), + u = c.redMul(a), + l = i.redMul(c), + h = s.redSqr().redIAdd(u).redISub(l).redISub(l), + f = s.redMul(l.redISub(h)).redISub(r.redMul(u)), + d = this.z.redMul(a); + return this.curve.jpoint(h, f, d); + }), + (h.prototype.dblp = function (e) { + if (0 === e) return this; + if (this.isInfinity()) return this; + if (!e) return this.dbl(); if (this.curve.zeroA || this.curve.threeA) { - for (var t = this, i = 0; i < e; i++) - t = t.dbl(); - return t + for (var t = this, i = 0; i < e; i++) t = t.dbl(); + return t; } - var n = this.curve.a - , r = this.curve.tinv - , o = this.x - , a = this.y - , s = this.z - , c = s.redSqr().redSqr() - , u = a.redAdd(a); + var n = this.curve.a, + r = this.curve.tinv, + o = this.x, + a = this.y, + s = this.z, + c = s.redSqr().redSqr(), + u = a.redAdd(a); for (i = 0; i < e; i++) { - var l = o.redSqr() - , h = u.redSqr() - , f = h.redSqr() - , d = l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)) - , p = o.redMul(h) - , m = d.redSqr().redISub(p.redAdd(p)) - , g = p.redISub(m) - , _ = d.redMul(g); - _ = _.redIAdd(_).redISub(f); - var v = u.redMul(s); - i + 1 < e && (c = c.redMul(f)), - o = m, - s = v, - u = _ + var l = o.redSqr(), + h = u.redSqr(), + f = h.redSqr(), + d = l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)), + p = o.redMul(h), + m = d.redSqr().redISub(p.redAdd(p)), + g = p.redISub(m), + _ = d.redMul(g); + _ = _.redIAdd(_).redISub(f); + var v = u.redMul(s); + i + 1 < e && (c = c.redMul(f)), (o = m), (s = v), (u = _); } - return this.curve.jpoint(o, u.redMul(r), s) - } - , - h.prototype.dbl = function() { - return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl() - } - , - h.prototype._zeroDbl = function() { + return this.curve.jpoint(o, u.redMul(r), s); + }), + (h.prototype.dbl = function () { + return this.isInfinity() + ? this + : this.curve.zeroA + ? this._zeroDbl() + : this.curve.threeA + ? this._threeDbl() + : this._dbl(); + }), + (h.prototype._zeroDbl = function () { var e, t, i; if (this.zOne) { - var n = this.x.redSqr() - , r = this.y.redSqr() - , o = r.redSqr() - , a = this.x.redAdd(r).redSqr().redISub(n).redISub(o); - a = a.redIAdd(a); - var s = n.redAdd(n).redIAdd(n) - , c = s.redSqr().redISub(a).redISub(a) - , u = o.redIAdd(o); - u = (u = u.redIAdd(u)).redIAdd(u), - e = c, - t = s.redMul(a.redISub(c)).redISub(u), - i = this.y.redAdd(this.y) + var n = this.x.redSqr(), + r = this.y.redSqr(), + o = r.redSqr(), + a = this.x.redAdd(r).redSqr().redISub(n).redISub(o); + a = a.redIAdd(a); + var s = n.redAdd(n).redIAdd(n), + c = s.redSqr().redISub(a).redISub(a), + u = o.redIAdd(o); + (u = (u = u.redIAdd(u)).redIAdd(u)), + (e = c), + (t = s.redMul(a.redISub(c)).redISub(u)), + (i = this.y.redAdd(this.y)); } else { - var l = this.x.redSqr() - , h = this.y.redSqr() - , f = h.redSqr() - , d = this.x.redAdd(h).redSqr().redISub(l).redISub(f); - d = d.redIAdd(d); - var p = l.redAdd(l).redIAdd(l) - , m = p.redSqr() - , g = f.redIAdd(f); - g = (g = g.redIAdd(g)).redIAdd(g), - e = m.redISub(d).redISub(d), - t = p.redMul(d.redISub(e)).redISub(g), - i = (i = this.y.redMul(this.z)).redIAdd(i) + var l = this.x.redSqr(), + h = this.y.redSqr(), + f = h.redSqr(), + d = this.x.redAdd(h).redSqr().redISub(l).redISub(f); + d = d.redIAdd(d); + var p = l.redAdd(l).redIAdd(l), + m = p.redSqr(), + g = f.redIAdd(f); + (g = (g = g.redIAdd(g)).redIAdd(g)), + (e = m.redISub(d).redISub(d)), + (t = p.redMul(d.redISub(e)).redISub(g)), + (i = (i = this.y.redMul(this.z)).redIAdd(i)); } - return this.curve.jpoint(e, t, i) - } - , - h.prototype._threeDbl = function() { + return this.curve.jpoint(e, t, i); + }), + (h.prototype._threeDbl = function () { var e, t, i; if (this.zOne) { - var n = this.x.redSqr() - , r = this.y.redSqr() - , o = r.redSqr() - , a = this.x.redAdd(r).redSqr().redISub(n).redISub(o); - a = a.redIAdd(a); - var s = n.redAdd(n).redIAdd(n).redIAdd(this.curve.a) - , c = s.redSqr().redISub(a).redISub(a); - e = c; - var u = o.redIAdd(o); - u = (u = u.redIAdd(u)).redIAdd(u), - t = s.redMul(a.redISub(c)).redISub(u), - i = this.y.redAdd(this.y) + var n = this.x.redSqr(), + r = this.y.redSqr(), + o = r.redSqr(), + a = this.x.redAdd(r).redSqr().redISub(n).redISub(o); + a = a.redIAdd(a); + var s = n.redAdd(n).redIAdd(n).redIAdd(this.curve.a), + c = s.redSqr().redISub(a).redISub(a); + e = c; + var u = o.redIAdd(o); + (u = (u = u.redIAdd(u)).redIAdd(u)), + (t = s.redMul(a.redISub(c)).redISub(u)), + (i = this.y.redAdd(this.y)); } else { - var l = this.z.redSqr() - , h = this.y.redSqr() - , f = this.x.redMul(h) - , d = this.x.redSub(l).redMul(this.x.redAdd(l)); - d = d.redAdd(d).redIAdd(d); - var p = f.redIAdd(f) - , m = (p = p.redIAdd(p)).redAdd(p); - e = d.redSqr().redISub(m), - i = this.y.redAdd(this.z).redSqr().redISub(h).redISub(l); - var g = h.redSqr(); - g = (g = (g = g.redIAdd(g)).redIAdd(g)).redIAdd(g), - t = d.redMul(p.redISub(e)).redISub(g) + var l = this.z.redSqr(), + h = this.y.redSqr(), + f = this.x.redMul(h), + d = this.x.redSub(l).redMul(this.x.redAdd(l)); + d = d.redAdd(d).redIAdd(d); + var p = f.redIAdd(f), + m = (p = p.redIAdd(p)).redAdd(p); + (e = d.redSqr().redISub(m)), + (i = this.y.redAdd(this.z).redSqr().redISub(h).redISub(l)); + var g = h.redSqr(); + (g = (g = (g = g.redIAdd(g)).redIAdd(g)).redIAdd(g)), + (t = d.redMul(p.redISub(e)).redISub(g)); } - return this.curve.jpoint(e, t, i) - } - , - h.prototype._dbl = function() { - var e = this.curve.a - , t = this.x - , i = this.y - , n = this.z - , r = n.redSqr().redSqr() - , o = t.redSqr() - , a = i.redSqr() - , s = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(r)) - , c = t.redAdd(t) - , u = (c = c.redIAdd(c)).redMul(a) - , l = s.redSqr().redISub(u.redAdd(u)) - , h = u.redISub(l) - , f = a.redSqr(); + return this.curve.jpoint(e, t, i); + }), + (h.prototype._dbl = function () { + var e = this.curve.a, + t = this.x, + i = this.y, + n = this.z, + r = n.redSqr().redSqr(), + o = t.redSqr(), + a = i.redSqr(), + s = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(r)), + c = t.redAdd(t), + u = (c = c.redIAdd(c)).redMul(a), + l = s.redSqr().redISub(u.redAdd(u)), + h = u.redISub(l), + f = a.redSqr(); f = (f = (f = f.redIAdd(f)).redIAdd(f)).redIAdd(f); - var d = s.redMul(h).redISub(f) - , p = i.redAdd(i).redMul(n); - return this.curve.jpoint(l, d, p) - } - , - h.prototype.trpl = function() { - if (!this.curve.zeroA) - return this.dbl().add(this); - var e = this.x.redSqr() - , t = this.y.redSqr() - , i = this.z.redSqr() - , n = t.redSqr() - , r = e.redAdd(e).redIAdd(e) - , o = r.redSqr() - , a = this.x.redAdd(t).redSqr().redISub(e).redISub(n) - , s = (a = (a = (a = a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr() - , c = n.redIAdd(n); + var d = s.redMul(h).redISub(f), + p = i.redAdd(i).redMul(n); + return this.curve.jpoint(l, d, p); + }), + (h.prototype.trpl = function () { + if (!this.curve.zeroA) return this.dbl().add(this); + var e = this.x.redSqr(), + t = this.y.redSqr(), + i = this.z.redSqr(), + n = t.redSqr(), + r = e.redAdd(e).redIAdd(e), + o = r.redSqr(), + a = this.x.redAdd(t).redSqr().redISub(e).redISub(n), + s = (a = (a = (a = a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub( + o + )).redSqr(), + c = n.redIAdd(n); c = (c = (c = c.redIAdd(c)).redIAdd(c)).redIAdd(c); - var u = r.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(c) - , l = t.redMul(u); + var u = r.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(c), + l = t.redMul(u); l = (l = l.redIAdd(l)).redIAdd(l); var h = this.x.redMul(s).redISub(l); h = (h = h.redIAdd(h)).redIAdd(h); var f = this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s))); f = (f = (f = f.redIAdd(f)).redIAdd(f)).redIAdd(f); var d = this.z.redAdd(a).redSqr().redISub(i).redISub(s); - return this.curve.jpoint(h, f, d) - } - , - h.prototype.mul = function(e, t) { - return e = new o(e,t), - this.curve._wnafMul(this, e) - } - , - h.prototype.eq = function(e) { - if ("affine" === e.type) - return this.eq(e.toJ()); - if (this === e) - return true; - var t = this.z.redSqr() - , i = e.z.redSqr(); - if (0 !== this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)) - return false; - var n = t.redMul(this.z) - , r = i.redMul(e.z); - return 0 === this.y.redMul(r).redISub(e.y.redMul(n)).cmpn(0) - } - , - h.prototype.eqXToP = function(e) { - var t = this.z.redSqr() - , i = e.toRed(this.curve.red).redMul(t); - if (0 === this.x.cmp(i)) - return true; + return this.curve.jpoint(h, f, d); + }), + (h.prototype.mul = function (e, t) { + return (e = new o(e, t)), this.curve._wnafMul(this, e); + }), + (h.prototype.eq = function (e) { + if ("affine" === e.type) return this.eq(e.toJ()); + if (this === e) return true; + var t = this.z.redSqr(), + i = e.z.redSqr(); + if (0 !== this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)) return false; + var n = t.redMul(this.z), + r = i.redMul(e.z); + return 0 === this.y.redMul(r).redISub(e.y.redMul(n)).cmpn(0); + }), + (h.prototype.eqXToP = function (e) { + var t = this.z.redSqr(), + i = e.toRed(this.curve.red).redMul(t); + if (0 === this.x.cmp(i)) return true; for (var n = e.clone(), r = this.curve.redN.redMul(t); ; ) { - if (n.iadd(this.curve.n), - n.cmp(this.curve.p) >= 0) - return false; - if (i.redIAdd(r), - 0 === this.x.cmp(i)) - return true + if ((n.iadd(this.curve.n), n.cmp(this.curve.p) >= 0)) return false; + if ((i.redIAdd(r), 0 === this.x.cmp(i))) return true; } - } - , - h.prototype.inspect = function() { - return this.isInfinity() ? "" : "" - } - , - h.prototype.isInfinity = function() { - return 0 === this.z.cmpn(0) - } -} -, function(e, t, i) { + }), + (h.prototype.inspect = function () { + return this.isInfinity() + ? "" + : ""; + }), + (h.prototype.isInfinity = function () { + return 0 === this.z.cmpn(0); + }); + }, + function (e, t, i) { "use strict"; - var n = i(91) - , r = i(11) - , o = i(1) - , a = n.base - , s = i(17).utils; + var n = i(91), + r = i(11), + o = i(1), + a = n.base, + s = i(17).utils; function c(e) { - a.call(this, "mont", e), - this.a = new r(e.a,16).toRed(this.red), - this.b = new r(e.b,16).toRed(this.red), - this.i4 = new r(4).toRed(this.red).redInvm(), - this.two = new r(2).toRed(this.red), - this.a24 = this.i4.redMul(this.a.redAdd(this.two)) + a.call(this, "mont", e), + (this.a = new r(e.a, 16).toRed(this.red)), + (this.b = new r(e.b, 16).toRed(this.red)), + (this.i4 = new r(4).toRed(this.red).redInvm()), + (this.two = new r(2).toRed(this.red)), + (this.a24 = this.i4.redMul(this.a.redAdd(this.two))); } function u(e, t, i) { - a.BasePoint.call(this, e, "projective"), - null === t && null === i ? (this.x = this.curve.one, - this.z = this.curve.zero) : (this.x = new r(t,16), - this.z = new r(i,16), - this.x.red || (this.x = this.x.toRed(this.curve.red)), - this.z.red || (this.z = this.z.toRed(this.curve.red))) + a.BasePoint.call(this, e, "projective"), + null === t && null === i + ? ((this.x = this.curve.one), (this.z = this.curve.zero)) + : ((this.x = new r(t, 16)), + (this.z = new r(i, 16)), + this.x.red || (this.x = this.x.toRed(this.curve.red)), + this.z.red || (this.z = this.z.toRed(this.curve.red))); } o(c, a), - e.exports = c, - c.prototype.validate = function(e) { - var t = e.normalize().x - , i = t.redSqr() - , n = i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t); - return 0 === n.redSqrt().redSqr().cmp(n) - } - , - o(u, a.BasePoint), - c.prototype.decodePoint = function(e, t) { - return this.point(s.toArray(e, t), 1) - } - , - c.prototype.point = function(e, t) { - return new u(this,e,t) - } - , - c.prototype.pointFromJSON = function(e) { - return u.fromJSON(this, e) - } - , - u.prototype.precompute = function() {} - , - u.prototype._encode = function() { - return this.getX().toArray("be", this.curve.p.byteLength()) - } - , - u.fromJSON = function(e, t) { - return new u(e,t[0],t[1] || e.one) - } - , - u.prototype.inspect = function() { - return this.isInfinity() ? "" : "" - } - , - u.prototype.isInfinity = function() { - return 0 === this.z.cmpn(0) - } - , - u.prototype.dbl = function() { - var e = this.x.redAdd(this.z).redSqr() - , t = this.x.redSub(this.z).redSqr() - , i = e.redSub(t) - , n = e.redMul(t) - , r = i.redMul(t.redAdd(this.curve.a24.redMul(i))); - return this.curve.point(n, r) - } - , - u.prototype.add = function() { - throw new Error("Not supported on Montgomery curve") - } - , - u.prototype.diffAdd = function(e, t) { - var i = this.x.redAdd(this.z) - , n = this.x.redSub(this.z) - , r = e.x.redAdd(e.z) - , o = e.x.redSub(e.z).redMul(i) - , a = r.redMul(n) - , s = t.z.redMul(o.redAdd(a).redSqr()) - , c = t.x.redMul(o.redISub(a).redSqr()); - return this.curve.point(s, c) - } - , - u.prototype.mul = function(e) { - for (var t = e.clone(), i = this, n = this.curve.point(null, null), r = []; 0 !== t.cmpn(0); t.iushrn(1)) - r.push(t.andln(1)); + (e.exports = c), + (c.prototype.validate = function (e) { + var t = e.normalize().x, + i = t.redSqr(), + n = i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t); + return 0 === n.redSqrt().redSqr().cmp(n); + }), + o(u, a.BasePoint), + (c.prototype.decodePoint = function (e, t) { + return this.point(s.toArray(e, t), 1); + }), + (c.prototype.point = function (e, t) { + return new u(this, e, t); + }), + (c.prototype.pointFromJSON = function (e) { + return u.fromJSON(this, e); + }), + (u.prototype.precompute = function () {}), + (u.prototype._encode = function () { + return this.getX().toArray("be", this.curve.p.byteLength()); + }), + (u.fromJSON = function (e, t) { + return new u(e, t[0], t[1] || e.one); + }), + (u.prototype.inspect = function () { + return this.isInfinity() + ? "" + : ""; + }), + (u.prototype.isInfinity = function () { + return 0 === this.z.cmpn(0); + }), + (u.prototype.dbl = function () { + var e = this.x.redAdd(this.z).redSqr(), + t = this.x.redSub(this.z).redSqr(), + i = e.redSub(t), + n = e.redMul(t), + r = i.redMul(t.redAdd(this.curve.a24.redMul(i))); + return this.curve.point(n, r); + }), + (u.prototype.add = function () { + throw new Error("Not supported on Montgomery curve"); + }), + (u.prototype.diffAdd = function (e, t) { + var i = this.x.redAdd(this.z), + n = this.x.redSub(this.z), + r = e.x.redAdd(e.z), + o = e.x.redSub(e.z).redMul(i), + a = r.redMul(n), + s = t.z.redMul(o.redAdd(a).redSqr()), + c = t.x.redMul(o.redISub(a).redSqr()); + return this.curve.point(s, c); + }), + (u.prototype.mul = function (e) { + for ( + var t = e.clone(), i = this, n = this.curve.point(null, null), r = []; + 0 !== t.cmpn(0); + t.iushrn(1) + ) + r.push(t.andln(1)); for (var o = r.length - 1; o >= 0; o--) - 0 === r[o] ? (i = i.diffAdd(n, this), - n = n.dbl()) : (n = i.diffAdd(n, this), - i = i.dbl()); - return n - } - , - u.prototype.mulAdd = function() { - throw new Error("Not supported on Montgomery curve") - } - , - u.prototype.jumlAdd = function() { - throw new Error("Not supported on Montgomery curve") - } - , - u.prototype.eq = function(e) { - return 0 === this.getX().cmp(e.getX()) - } - , - u.prototype.normalize = function() { - return this.x = this.x.redMul(this.z.redInvm()), - this.z = this.curve.one, - this - } - , - u.prototype.getX = function() { - return this.normalize(), - this.x.fromRed() - } -} -, function(e, t, i) { + 0 === r[o] + ? ((i = i.diffAdd(n, this)), (n = n.dbl())) + : ((n = i.diffAdd(n, this)), (i = i.dbl())); + return n; + }), + (u.prototype.mulAdd = function () { + throw new Error("Not supported on Montgomery curve"); + }), + (u.prototype.jumlAdd = function () { + throw new Error("Not supported on Montgomery curve"); + }), + (u.prototype.eq = function (e) { + return 0 === this.getX().cmp(e.getX()); + }), + (u.prototype.normalize = function () { + return ( + (this.x = this.x.redMul(this.z.redInvm())), + (this.z = this.curve.one), + this + ); + }), + (u.prototype.getX = function () { + return this.normalize(), this.x.fromRed(); + }); + }, + function (e, t, i) { "use strict"; - var n = i(91) - , r = i(17) - , o = i(11) - , a = i(1) - , s = n.base - , c = r.utils.assert; + var n = i(91), + r = i(17), + o = i(11), + a = i(1), + s = n.base, + c = r.utils.assert; function u(e) { - this.twisted = 1 != (0 | e.a), - this.mOneA = this.twisted && -1 == (0 | e.a), - this.extended = this.mOneA, + (this.twisted = 1 != (0 | e.a)), + (this.mOneA = this.twisted && -1 == (0 | e.a)), + (this.extended = this.mOneA), s.call(this, "edwards", e), - this.a = new o(e.a,16).umod(this.red.m), - this.a = this.a.toRed(this.red), - this.c = new o(e.c,16).toRed(this.red), - this.c2 = this.c.redSqr(), - this.d = new o(e.d,16).toRed(this.red), - this.dd = this.d.redAdd(this.d), + (this.a = new o(e.a, 16).umod(this.red.m)), + (this.a = this.a.toRed(this.red)), + (this.c = new o(e.c, 16).toRed(this.red)), + (this.c2 = this.c.redSqr()), + (this.d = new o(e.d, 16).toRed(this.red)), + (this.dd = this.d.redAdd(this.d)), c(!this.twisted || 0 === this.c.fromRed().cmpn(1)), - this.oneC = 1 == (0 | e.c) + (this.oneC = 1 == (0 | e.c)); } function l(e, t, i, n, r) { - s.BasePoint.call(this, e, "projective"), - null === t && null === i && null === n ? (this.x = this.curve.zero, - this.y = this.curve.one, - this.z = this.curve.one, - this.t = this.curve.zero, - this.zOne = true) : (this.x = new o(t,16), - this.y = new o(i,16), - this.z = n ? new o(n,16) : this.curve.one, - this.t = r && new o(r,16), - this.x.red || (this.x = this.x.toRed(this.curve.red)), - this.y.red || (this.y = this.y.toRed(this.curve.red)), - this.z.red || (this.z = this.z.toRed(this.curve.red)), - this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), - this.zOne = this.z === this.curve.one, - this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), - this.zOne || (this.t = this.t.redMul(this.z.redInvm())))) + s.BasePoint.call(this, e, "projective"), + null === t && null === i && null === n + ? ((this.x = this.curve.zero), + (this.y = this.curve.one), + (this.z = this.curve.one), + (this.t = this.curve.zero), + (this.zOne = true)) + : ((this.x = new o(t, 16)), + (this.y = new o(i, 16)), + (this.z = n ? new o(n, 16) : this.curve.one), + (this.t = r && new o(r, 16)), + this.x.red || (this.x = this.x.toRed(this.curve.red)), + this.y.red || (this.y = this.y.toRed(this.curve.red)), + this.z.red || (this.z = this.z.toRed(this.curve.red)), + this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), + (this.zOne = this.z === this.curve.one), + this.curve.extended && + !this.t && + ((this.t = this.x.redMul(this.y)), + this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); } a(u, s), - e.exports = u, - u.prototype._mulA = function(e) { - return this.mOneA ? e.redNeg() : this.a.redMul(e) - } - , - u.prototype._mulC = function(e) { - return this.oneC ? e : this.c.redMul(e) - } - , - u.prototype.jpoint = function(e, t, i, n) { - return this.point(e, t, i, n) - } - , - u.prototype.pointFromX = function(e, t) { - (e = new o(e,16)).red || (e = e.toRed(this.red)); - var i = e.redSqr() - , n = this.c2.redSub(this.a.redMul(i)) - , r = this.one.redSub(this.c2.redMul(this.d).redMul(i)) - , a = n.redMul(r.redInvm()) - , s = a.redSqrt(); + (e.exports = u), + (u.prototype._mulA = function (e) { + return this.mOneA ? e.redNeg() : this.a.redMul(e); + }), + (u.prototype._mulC = function (e) { + return this.oneC ? e : this.c.redMul(e); + }), + (u.prototype.jpoint = function (e, t, i, n) { + return this.point(e, t, i, n); + }), + (u.prototype.pointFromX = function (e, t) { + (e = new o(e, 16)).red || (e = e.toRed(this.red)); + var i = e.redSqr(), + n = this.c2.redSub(this.a.redMul(i)), + r = this.one.redSub(this.c2.redMul(this.d).redMul(i)), + a = n.redMul(r.redInvm()), + s = a.redSqrt(); if (0 !== s.redSqr().redSub(a).cmp(this.zero)) - throw new Error("invalid point"); + throw new Error("invalid point"); var c = s.fromRed().isOdd(); - return (t && !c || !t && c) && (s = s.redNeg()), - this.point(e, s) - } - , - u.prototype.pointFromY = function(e, t) { - (e = new o(e,16)).red || (e = e.toRed(this.red)); - var i = e.redSqr() - , n = i.redSub(this.c2) - , r = i.redMul(this.d).redMul(this.c2).redSub(this.a) - , a = n.redMul(r.redInvm()); + return ((t && !c) || (!t && c)) && (s = s.redNeg()), this.point(e, s); + }), + (u.prototype.pointFromY = function (e, t) { + (e = new o(e, 16)).red || (e = e.toRed(this.red)); + var i = e.redSqr(), + n = i.redSub(this.c2), + r = i.redMul(this.d).redMul(this.c2).redSub(this.a), + a = n.redMul(r.redInvm()); if (0 === a.cmp(this.zero)) { - if (t) - throw new Error("invalid point"); - return this.point(this.zero, e) + if (t) throw new Error("invalid point"); + return this.point(this.zero, e); } var s = a.redSqrt(); if (0 !== s.redSqr().redSub(a).cmp(this.zero)) - throw new Error("invalid point"); - return s.fromRed().isOdd() !== t && (s = s.redNeg()), - this.point(s, e) - } - , - u.prototype.validate = function(e) { - if (e.isInfinity()) - return true; + throw new Error("invalid point"); + return s.fromRed().isOdd() !== t && (s = s.redNeg()), this.point(s, e); + }), + (u.prototype.validate = function (e) { + if (e.isInfinity()) return true; e.normalize(); - var t = e.x.redSqr() - , i = e.y.redSqr() - , n = t.redMul(this.a).redAdd(i) - , r = this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i))); - return 0 === n.cmp(r) - } - , - a(l, s.BasePoint), - u.prototype.pointFromJSON = function(e) { - return l.fromJSON(this, e) - } - , - u.prototype.point = function(e, t, i, n) { - return new l(this,e,t,i,n) - } - , - l.fromJSON = function(e, t) { - return new l(e,t[0],t[1],t[2]) - } - , - l.prototype.inspect = function() { - return this.isInfinity() ? "" : "" - } - , - l.prototype.isInfinity = function() { - return 0 === this.x.cmpn(0) && (0 === this.y.cmp(this.z) || this.zOne && 0 === this.y.cmp(this.curve.c)) - } - , - l.prototype._extDbl = function() { - var e = this.x.redSqr() - , t = this.y.redSqr() - , i = this.z.redSqr(); + var t = e.x.redSqr(), + i = e.y.redSqr(), + n = t.redMul(this.a).redAdd(i), + r = this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i))); + return 0 === n.cmp(r); + }), + a(l, s.BasePoint), + (u.prototype.pointFromJSON = function (e) { + return l.fromJSON(this, e); + }), + (u.prototype.point = function (e, t, i, n) { + return new l(this, e, t, i, n); + }), + (l.fromJSON = function (e, t) { + return new l(e, t[0], t[1], t[2]); + }), + (l.prototype.inspect = function () { + return this.isInfinity() + ? "" + : ""; + }), + (l.prototype.isInfinity = function () { + return ( + 0 === this.x.cmpn(0) && + (0 === this.y.cmp(this.z) || + (this.zOne && 0 === this.y.cmp(this.curve.c))) + ); + }), + (l.prototype._extDbl = function () { + var e = this.x.redSqr(), + t = this.y.redSqr(), + i = this.z.redSqr(); i = i.redIAdd(i); - var n = this.curve._mulA(e) - , r = this.x.redAdd(this.y).redSqr().redISub(e).redISub(t) - , o = n.redAdd(t) - , a = o.redSub(i) - , s = n.redSub(t) - , c = r.redMul(a) - , u = o.redMul(s) - , l = r.redMul(s) - , h = a.redMul(o); - return this.curve.point(c, u, h, l) - } - , - l.prototype._projDbl = function() { - var e, t, i, n = this.x.redAdd(this.y).redSqr(), r = this.x.redSqr(), o = this.y.redSqr(); + var n = this.curve._mulA(e), + r = this.x.redAdd(this.y).redSqr().redISub(e).redISub(t), + o = n.redAdd(t), + a = o.redSub(i), + s = n.redSub(t), + c = r.redMul(a), + u = o.redMul(s), + l = r.redMul(s), + h = a.redMul(o); + return this.curve.point(c, u, h, l); + }), + (l.prototype._projDbl = function () { + var e, + t, + i, + n = this.x.redAdd(this.y).redSqr(), + r = this.x.redSqr(), + o = this.y.redSqr(); if (this.curve.twisted) { - var a = (u = this.curve._mulA(r)).redAdd(o); - if (this.zOne) - e = n.redSub(r).redSub(o).redMul(a.redSub(this.curve.two)), - t = a.redMul(u.redSub(o)), - i = a.redSqr().redSub(a).redSub(a); - else { - var s = this.z.redSqr() - , c = a.redSub(s).redISub(s); - e = n.redSub(r).redISub(o).redMul(c), - t = a.redMul(u.redSub(o)), - i = a.redMul(c) - } + var a = (u = this.curve._mulA(r)).redAdd(o); + if (this.zOne) + (e = n.redSub(r).redSub(o).redMul(a.redSub(this.curve.two))), + (t = a.redMul(u.redSub(o))), + (i = a.redSqr().redSub(a).redSub(a)); + else { + var s = this.z.redSqr(), + c = a.redSub(s).redISub(s); + (e = n.redSub(r).redISub(o).redMul(c)), + (t = a.redMul(u.redSub(o))), + (i = a.redMul(c)); + } } else { - var u = r.redAdd(o); - s = this.curve._mulC(this.z).redSqr(), - c = u.redSub(s).redSub(s); - e = this.curve._mulC(n.redISub(u)).redMul(c), - t = this.curve._mulC(u).redMul(r.redISub(o)), - i = u.redMul(c) + var u = r.redAdd(o); + (s = this.curve._mulC(this.z).redSqr()), (c = u.redSub(s).redSub(s)); + (e = this.curve._mulC(n.redISub(u)).redMul(c)), + (t = this.curve._mulC(u).redMul(r.redISub(o))), + (i = u.redMul(c)); } - return this.curve.point(e, t, i) - } - , - l.prototype.dbl = function() { - return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl() - } - , - l.prototype._extAdd = function(e) { - var t = this.y.redSub(this.x).redMul(e.y.redSub(e.x)) - , i = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)) - , n = this.t.redMul(this.curve.dd).redMul(e.t) - , r = this.z.redMul(e.z.redAdd(e.z)) - , o = i.redSub(t) - , a = r.redSub(n) - , s = r.redAdd(n) - , c = i.redAdd(t) - , u = o.redMul(a) - , l = s.redMul(c) - , h = o.redMul(c) - , f = a.redMul(s); - return this.curve.point(u, l, f, h) - } - , - l.prototype._projAdd = function(e) { - var t, i, n = this.z.redMul(e.z), r = n.redSqr(), o = this.x.redMul(e.x), a = this.y.redMul(e.y), s = this.curve.d.redMul(o).redMul(a), c = r.redSub(s), u = r.redAdd(s), l = this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a), h = n.redMul(c).redMul(l); - return this.curve.twisted ? (t = n.redMul(u).redMul(a.redSub(this.curve._mulA(o))), - i = c.redMul(u)) : (t = n.redMul(u).redMul(a.redSub(o)), - i = this.curve._mulC(c).redMul(u)), - this.curve.point(h, t, i) - } - , - l.prototype.add = function(e) { - return this.isInfinity() ? e : e.isInfinity() ? this : this.curve.extended ? this._extAdd(e) : this._projAdd(e) - } - , - l.prototype.mul = function(e) { - return this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve._wnafMul(this, e) - } - , - l.prototype.mulAdd = function(e, t, i) { - return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, false) - } - , - l.prototype.jmulAdd = function(e, t, i) { - return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, true) - } - , - l.prototype.normalize = function() { - if (this.zOne) - return this; + return this.curve.point(e, t, i); + }), + (l.prototype.dbl = function () { + return this.isInfinity() + ? this + : this.curve.extended + ? this._extDbl() + : this._projDbl(); + }), + (l.prototype._extAdd = function (e) { + var t = this.y.redSub(this.x).redMul(e.y.redSub(e.x)), + i = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)), + n = this.t.redMul(this.curve.dd).redMul(e.t), + r = this.z.redMul(e.z.redAdd(e.z)), + o = i.redSub(t), + a = r.redSub(n), + s = r.redAdd(n), + c = i.redAdd(t), + u = o.redMul(a), + l = s.redMul(c), + h = o.redMul(c), + f = a.redMul(s); + return this.curve.point(u, l, f, h); + }), + (l.prototype._projAdd = function (e) { + var t, + i, + n = this.z.redMul(e.z), + r = n.redSqr(), + o = this.x.redMul(e.x), + a = this.y.redMul(e.y), + s = this.curve.d.redMul(o).redMul(a), + c = r.redSub(s), + u = r.redAdd(s), + l = this.x + .redAdd(this.y) + .redMul(e.x.redAdd(e.y)) + .redISub(o) + .redISub(a), + h = n.redMul(c).redMul(l); + return ( + this.curve.twisted + ? ((t = n.redMul(u).redMul(a.redSub(this.curve._mulA(o)))), + (i = c.redMul(u))) + : ((t = n.redMul(u).redMul(a.redSub(o))), + (i = this.curve._mulC(c).redMul(u))), + this.curve.point(h, t, i) + ); + }), + (l.prototype.add = function (e) { + return this.isInfinity() + ? e + : e.isInfinity() + ? this + : this.curve.extended + ? this._extAdd(e) + : this._projAdd(e); + }), + (l.prototype.mul = function (e) { + return this._hasDoubles(e) + ? this.curve._fixedNafMul(this, e) + : this.curve._wnafMul(this, e); + }), + (l.prototype.mulAdd = function (e, t, i) { + return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, false); + }), + (l.prototype.jmulAdd = function (e, t, i) { + return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, true); + }), + (l.prototype.normalize = function () { + if (this.zOne) return this; var e = this.z.redInvm(); - return this.x = this.x.redMul(e), - this.y = this.y.redMul(e), - this.t && (this.t = this.t.redMul(e)), - this.z = this.curve.one, - this.zOne = true, - this - } - , - l.prototype.neg = function() { - return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg()) - } - , - l.prototype.getX = function() { - return this.normalize(), - this.x.fromRed() - } - , - l.prototype.getY = function() { - return this.normalize(), - this.y.fromRed() - } - , - l.prototype.eq = function(e) { - return this === e || 0 === this.getX().cmp(e.getX()) && 0 === this.getY().cmp(e.getY()) - } - , - l.prototype.eqXToP = function(e) { + return ( + (this.x = this.x.redMul(e)), + (this.y = this.y.redMul(e)), + this.t && (this.t = this.t.redMul(e)), + (this.z = this.curve.one), + (this.zOne = true), + this + ); + }), + (l.prototype.neg = function () { + return this.curve.point( + this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg() + ); + }), + (l.prototype.getX = function () { + return this.normalize(), this.x.fromRed(); + }), + (l.prototype.getY = function () { + return this.normalize(), this.y.fromRed(); + }), + (l.prototype.eq = function (e) { + return ( + this === e || + (0 === this.getX().cmp(e.getX()) && 0 === this.getY().cmp(e.getY())) + ); + }), + (l.prototype.eqXToP = function (e) { var t = e.toRed(this.curve.red).redMul(this.z); - if (0 === this.x.cmp(t)) - return true; + if (0 === this.x.cmp(t)) return true; for (var i = e.clone(), n = this.curve.redN.redMul(this.z); ; ) { - if (i.iadd(this.curve.n), - i.cmp(this.curve.p) >= 0) - return false; - if (t.redIAdd(n), - 0 === this.x.cmp(t)) - return true + if ((i.iadd(this.curve.n), i.cmp(this.curve.p) >= 0)) return false; + if ((t.redIAdd(n), 0 === this.x.cmp(t))) return true; } - } - , - l.prototype.toP = l.prototype.normalize, - l.prototype.mixedAdd = l.prototype.add -} -, function(e, t, i) { + }), + (l.prototype.toP = l.prototype.normalize), + (l.prototype.mixedAdd = l.prototype.add); + }, + function (e, t, i) { "use strict"; - var n, r = t, o = i(135), a = i(17), s = a.utils.assert; + var n, + r = t, + o = i(135), + a = i(17), + s = a.utils.assert; function c(e) { - "short" === e.type ? this.curve = new a.curve.short(e) : "edwards" === e.type ? this.curve = new a.curve.edwards(e) : this.curve = new a.curve.mont(e), - this.g = this.curve.g, - this.n = this.curve.n, - this.hash = e.hash, + "short" === e.type + ? (this.curve = new a.curve.short(e)) + : "edwards" === e.type + ? (this.curve = new a.curve.edwards(e)) + : (this.curve = new a.curve.mont(e)), + (this.g = this.curve.g), + (this.n = this.curve.n), + (this.hash = e.hash), s(this.g.validate(), "Invalid curve"), - s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O") + s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } function u(e, t) { - Object.defineProperty(r, e, { - configurable: true, - enumerable: true, - get: function() { - var i = new c(t); - return Object.defineProperty(r, e, { - configurable: true, - enumerable: true, - value: i - }), - i - } - }) + Object.defineProperty(r, e, { + configurable: true, + enumerable: true, + get: function () { + var i = new c(t); + return ( + Object.defineProperty(r, e, { + configurable: true, + enumerable: true, + value: i, + }), + i + ); + }, + }); } - r.PresetCurve = c, - u("p192", { + (r.PresetCurve = c), + u("p192", { type: "short", prime: "p192", p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff", @@ -110944,9 +149536,12 @@ and limitations under the License. n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", hash: o.sha256, gRed: false, - g: ["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"] - }), - u("p224", { + g: [ + "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", + "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811", + ], + }), + u("p224", { type: "short", prime: "p224", p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001", @@ -110955,9 +149550,12 @@ and limitations under the License. n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", hash: o.sha256, gRed: false, - g: ["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"] - }), - u("p256", { + g: [ + "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", + "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34", + ], + }), + u("p256", { type: "short", prime: null, p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff", @@ -110966,9 +149564,12 @@ and limitations under the License. n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", hash: o.sha256, gRed: false, - g: ["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"] - }), - u("p384", { + g: [ + "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", + "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5", + ], + }), + u("p384", { type: "short", prime: null, p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff", @@ -110977,9 +149578,12 @@ and limitations under the License. n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", hash: o.sha384, gRed: false, - g: ["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"] - }), - u("p521", { + g: [ + "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", + "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f", + ], + }), + u("p521", { type: "short", prime: null, p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff", @@ -110988,9 +149592,12 @@ and limitations under the License. n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", hash: o.sha512, gRed: false, - g: ["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"] - }), - u("curve25519", { + g: [ + "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", + "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650", + ], + }), + u("curve25519", { type: "mont", prime: "p25519", p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", @@ -110999,9 +149606,9 @@ and limitations under the License. n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", hash: o.sha256, gRed: false, - g: ["9"] - }), - u("ed25519", { + g: ["9"], + }), + u("ed25519", { type: "edwards", prime: "p25519", p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", @@ -111011,1586 +149618,2638 @@ and limitations under the License. n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", hash: o.sha256, gRed: false, - g: ["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", "6666666666666666666666666666666666666666666666666666666666666658"] - }); + g: [ + "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", + "6666666666666666666666666666666666666666666666666666666666666658", + ], + }); try { - n = i(562) + n = i(562); } catch (e) { - n = void 0 + n = void 0; } u("secp256k1", { - type: "short", - prime: "k256", - p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", - a: "0", - b: "7", - n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", - h: "1", - hash: o.sha256, - beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", - lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", - basis: [{ - a: "3086d221a7d46bcde86c90e49284eb15", - b: "-e4437ed6010e88286f547fa90abfe4c3" - }, { - a: "114ca50f7a8e2f3f657c1108d9d44cfd8", - b: "3086d221a7d46bcde86c90e49284eb15" - }], - gRed: false, - g: ["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", n] - }) -} -, function(e, t, i) { + type: "short", + prime: "k256", + p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", + a: "0", + b: "7", + n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", + h: "1", + hash: o.sha256, + beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", + lambda: + "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", + basis: [ + { + a: "3086d221a7d46bcde86c90e49284eb15", + b: "-e4437ed6010e88286f547fa90abfe4c3", + }, + { + a: "114ca50f7a8e2f3f657c1108d9d44cfd8", + b: "3086d221a7d46bcde86c90e49284eb15", + }, + ], + gRed: false, + g: [ + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", + "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + n, + ], + }); + }, + function (e, t, i) { "use strict"; - t.sha1 = i(557), - t.sha224 = i(558), - t.sha256 = i(216), - t.sha384 = i(559), - t.sha512 = i(217) -} -, function(e, t, i) { + (t.sha1 = i(557)), + (t.sha224 = i(558)), + (t.sha256 = i(216)), + (t.sha384 = i(559)), + (t.sha512 = i(217)); + }, + function (e, t, i) { "use strict"; - var n = i(33) - , r = i(71) - , o = i(215) - , a = n.rotl32 - , s = n.sum32 - , c = n.sum32_5 - , u = o.ft_1 - , l = r.BlockHash - , h = [1518500249, 1859775393, 2400959708, 3395469782]; + var n = i(33), + r = i(71), + o = i(215), + a = n.rotl32, + s = n.sum32, + c = n.sum32_5, + u = o.ft_1, + l = r.BlockHash, + h = [1518500249, 1859775393, 2400959708, 3395469782]; function f() { - if (!(this instanceof f)) - return new f; - l.call(this), - this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], - this.W = new Array(80) + if (!(this instanceof f)) return new f(); + l.call(this), + (this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]), + (this.W = new Array(80)); } n.inherits(f, l), - e.exports = f, - f.blockSize = 512, - f.outSize = 160, - f.hmacStrength = 80, - f.padLength = 64, - f.prototype._update = function(e, t) { - for (var i = this.W, n = 0; n < 16; n++) - i[n] = e[t + n]; + (e.exports = f), + (f.blockSize = 512), + (f.outSize = 160), + (f.hmacStrength = 80), + (f.padLength = 64), + (f.prototype._update = function (e, t) { + for (var i = this.W, n = 0; n < 16; n++) i[n] = e[t + n]; for (; n < i.length; n++) - i[n] = a(i[n - 3] ^ i[n - 8] ^ i[n - 14] ^ i[n - 16], 1); - var r = this.h[0] - , o = this.h[1] - , l = this.h[2] - , f = this.h[3] - , d = this.h[4]; + i[n] = a(i[n - 3] ^ i[n - 8] ^ i[n - 14] ^ i[n - 16], 1); + var r = this.h[0], + o = this.h[1], + l = this.h[2], + f = this.h[3], + d = this.h[4]; for (n = 0; n < i.length; n++) { - var p = ~~(n / 20) - , m = c(a(r, 5), u(p, o, l, f), d, i[n], h[p]); - d = f, - f = l, - l = a(o, 30), - o = r, - r = m + var p = ~~(n / 20), + m = c(a(r, 5), u(p, o, l, f), d, i[n], h[p]); + (d = f), (f = l), (l = a(o, 30)), (o = r), (r = m); } - this.h[0] = s(this.h[0], r), - this.h[1] = s(this.h[1], o), - this.h[2] = s(this.h[2], l), - this.h[3] = s(this.h[3], f), - this.h[4] = s(this.h[4], d) - } - , - f.prototype._digest = function(e) { - return "hex" === e ? n.toHex32(this.h, "big") : n.split32(this.h, "big") - } -} -, function(e, t, i) { + (this.h[0] = s(this.h[0], r)), + (this.h[1] = s(this.h[1], o)), + (this.h[2] = s(this.h[2], l)), + (this.h[3] = s(this.h[3], f)), + (this.h[4] = s(this.h[4], d)); + }), + (f.prototype._digest = function (e) { + return "hex" === e + ? n.toHex32(this.h, "big") + : n.split32(this.h, "big"); + }); + }, + function (e, t, i) { "use strict"; - var n = i(33) - , r = i(216); + var n = i(33), + r = i(216); function o() { - if (!(this instanceof o)) - return new o; - r.call(this), - this.h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428] + if (!(this instanceof o)) return new o(); + r.call(this), + (this.h = [ + 3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, + 1694076839, 3204075428, + ]); } n.inherits(o, r), - e.exports = o, - o.blockSize = 512, - o.outSize = 224, - o.hmacStrength = 192, - o.padLength = 64, - o.prototype._digest = function(e) { - return "hex" === e ? n.toHex32(this.h.slice(0, 7), "big") : n.split32(this.h.slice(0, 7), "big") - } -} -, function(e, t, i) { + (e.exports = o), + (o.blockSize = 512), + (o.outSize = 224), + (o.hmacStrength = 192), + (o.padLength = 64), + (o.prototype._digest = function (e) { + return "hex" === e + ? n.toHex32(this.h.slice(0, 7), "big") + : n.split32(this.h.slice(0, 7), "big"); + }); + }, + function (e, t, i) { "use strict"; - var n = i(33) - , r = i(217); + var n = i(33), + r = i(217); function o() { - if (!(this instanceof o)) - return new o; - r.call(this), - this.h = [3418070365, 3238371032, 1654270250, 914150663, 2438529370, 812702999, 355462360, 4144912697, 1731405415, 4290775857, 2394180231, 1750603025, 3675008525, 1694076839, 1203062813, 3204075428] + if (!(this instanceof o)) return new o(); + r.call(this), + (this.h = [ + 3418070365, 3238371032, 1654270250, 914150663, 2438529370, 812702999, + 355462360, 4144912697, 1731405415, 4290775857, 2394180231, 1750603025, + 3675008525, 1694076839, 1203062813, 3204075428, + ]); } n.inherits(o, r), - e.exports = o, - o.blockSize = 1024, - o.outSize = 384, - o.hmacStrength = 192, - o.padLength = 128, - o.prototype._digest = function(e) { - return "hex" === e ? n.toHex32(this.h.slice(0, 12), "big") : n.split32(this.h.slice(0, 12), "big") - } -} -, function(e, t, i) { + (e.exports = o), + (o.blockSize = 1024), + (o.outSize = 384), + (o.hmacStrength = 192), + (o.padLength = 128), + (o.prototype._digest = function (e) { + return "hex" === e + ? n.toHex32(this.h.slice(0, 12), "big") + : n.split32(this.h.slice(0, 12), "big"); + }); + }, + function (e, t, i) { "use strict"; - var n = i(33) - , r = i(71) - , o = n.rotl32 - , a = n.sum32 - , s = n.sum32_3 - , c = n.sum32_4 - , u = r.BlockHash; + var n = i(33), + r = i(71), + o = n.rotl32, + a = n.sum32, + s = n.sum32_3, + c = n.sum32_4, + u = r.BlockHash; function l() { - if (!(this instanceof l)) - return new l; - u.call(this), - this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], - this.endian = "little" + if (!(this instanceof l)) return new l(); + u.call(this), + (this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]), + (this.endian = "little"); } function h(e, t, i, n) { - return e <= 15 ? t ^ i ^ n : e <= 31 ? t & i | ~t & n : e <= 47 ? (t | ~i) ^ n : e <= 63 ? t & n | i & ~n : t ^ (i | ~n) + return e <= 15 + ? t ^ i ^ n + : e <= 31 + ? (t & i) | (~t & n) + : e <= 47 + ? (t | ~i) ^ n + : e <= 63 + ? (t & n) | (i & ~n) + : t ^ (i | ~n); } function f(e) { - return e <= 15 ? 0 : e <= 31 ? 1518500249 : e <= 47 ? 1859775393 : e <= 63 ? 2400959708 : 2840853838 + return e <= 15 + ? 0 + : e <= 31 + ? 1518500249 + : e <= 47 + ? 1859775393 + : e <= 63 + ? 2400959708 + : 2840853838; } function d(e) { - return e <= 15 ? 1352829926 : e <= 31 ? 1548603684 : e <= 47 ? 1836072691 : e <= 63 ? 2053994217 : 0 + return e <= 15 + ? 1352829926 + : e <= 31 + ? 1548603684 + : e <= 47 + ? 1836072691 + : e <= 63 + ? 2053994217 + : 0; } n.inherits(l, u), - t.ripemd160 = l, - l.blockSize = 512, - l.outSize = 160, - l.hmacStrength = 192, - l.padLength = 64, - l.prototype._update = function(e, t) { - for (var i = this.h[0], n = this.h[1], r = this.h[2], u = this.h[3], l = this.h[4], v = i, y = n, b = r, E = u, T = l, A = 0; A < 80; A++) { - var x = a(o(c(i, h(A, n, r, u), e[p[A] + t], f(A)), g[A]), l); - i = l, - l = u, - u = o(r, 10), - r = n, - n = x, - x = a(o(c(v, h(79 - A, y, b, E), e[m[A] + t], d(A)), _[A]), T), - v = T, - T = E, - E = o(b, 10), - b = y, - y = x + (t.ripemd160 = l), + (l.blockSize = 512), + (l.outSize = 160), + (l.hmacStrength = 192), + (l.padLength = 64), + (l.prototype._update = function (e, t) { + for ( + var i = this.h[0], + n = this.h[1], + r = this.h[2], + u = this.h[3], + l = this.h[4], + v = i, + y = n, + b = r, + E = u, + T = l, + A = 0; + A < 80; + A++ + ) { + var x = a(o(c(i, h(A, n, r, u), e[p[A] + t], f(A)), g[A]), l); + (i = l), + (l = u), + (u = o(r, 10)), + (r = n), + (n = x), + (x = a(o(c(v, h(79 - A, y, b, E), e[m[A] + t], d(A)), _[A]), T)), + (v = T), + (T = E), + (E = o(b, 10)), + (b = y), + (y = x); } - x = s(this.h[1], r, E), - this.h[1] = s(this.h[2], u, T), - this.h[2] = s(this.h[3], l, v), - this.h[3] = s(this.h[4], i, y), - this.h[4] = s(this.h[0], n, b), - this.h[0] = x - } - , - l.prototype._digest = function(e) { - return "hex" === e ? n.toHex32(this.h, "little") : n.split32(this.h, "little") - } - ; - var p = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13] - , m = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11] - , g = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6] - , _ = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11] -} -, function(e, t, i) { + (x = s(this.h[1], r, E)), + (this.h[1] = s(this.h[2], u, T)), + (this.h[2] = s(this.h[3], l, v)), + (this.h[3] = s(this.h[4], i, y)), + (this.h[4] = s(this.h[0], n, b)), + (this.h[0] = x); + }), + (l.prototype._digest = function (e) { + return "hex" === e + ? n.toHex32(this.h, "little") + : n.split32(this.h, "little"); + }); + var p = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, + 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, + 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, + ], + m = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, + 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, + 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, + 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11, + ], + g = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, + 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, + 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, + 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6, + ], + _ = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, + 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, + 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, + 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11, + ]; + }, + function (e, t, i) { "use strict"; - var n = i(33) - , r = i(25); + var n = i(33), + r = i(25); function o(e, t, i) { - if (!(this instanceof o)) - return new o(e,t,i); - this.Hash = e, - this.blockSize = e.blockSize / 8, - this.outSize = e.outSize / 8, - this.inner = null, - this.outer = null, - this._init(n.toArray(t, i)) + if (!(this instanceof o)) return new o(e, t, i); + (this.Hash = e), + (this.blockSize = e.blockSize / 8), + (this.outSize = e.outSize / 8), + (this.inner = null), + (this.outer = null), + this._init(n.toArray(t, i)); } - e.exports = o, - o.prototype._init = function(e) { - e.length > this.blockSize && (e = (new this.Hash).update(e).digest()), - r(e.length <= this.blockSize); - for (var t = e.length; t < this.blockSize; t++) - e.push(0); - for (t = 0; t < e.length; t++) - e[t] ^= 54; - for (this.inner = (new this.Hash).update(e), - t = 0; t < e.length; t++) - e[t] ^= 106; - this.outer = (new this.Hash).update(e) - } - , - o.prototype.update = function(e, t) { - return this.inner.update(e, t), - this - } - , - o.prototype.digest = function(e) { - return this.outer.update(this.inner.digest()), - this.outer.digest(e) - } -} -, function(e, t) { + (e.exports = o), + (o.prototype._init = function (e) { + e.length > this.blockSize && (e = new this.Hash().update(e).digest()), + r(e.length <= this.blockSize); + for (var t = e.length; t < this.blockSize; t++) e.push(0); + for (t = 0; t < e.length; t++) e[t] ^= 54; + for (this.inner = new this.Hash().update(e), t = 0; t < e.length; t++) + e[t] ^= 106; + this.outer = new this.Hash().update(e); + }), + (o.prototype.update = function (e, t) { + return this.inner.update(e, t), this; + }), + (o.prototype.digest = function (e) { + return this.outer.update(this.inner.digest()), this.outer.digest(e); + }); + }, + function (e, t) { e.exports = { - doubles: { - step: 4, - points: [["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"], ["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"], ["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"], ["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"], ["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"], ["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"], ["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"], ["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"], ["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"], ["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"], ["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"], ["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"], ["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"], ["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"], ["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"], ["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"], ["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"], ["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"], ["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"], ["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"], ["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"], ["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"], ["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"], ["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"], ["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"], ["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"], ["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"], ["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"], ["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"], ["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"], ["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"], ["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"], ["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"], ["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"], ["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"], ["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"], ["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"], ["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"], ["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"], ["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"], ["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"], ["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"], ["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"], ["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"], ["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"], ["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"], ["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"], ["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"], ["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"], ["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"], ["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"], ["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"], ["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"], ["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"], ["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"], ["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"], ["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"], ["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"], ["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"], ["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"], ["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"], ["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"], ["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"], ["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"], ["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]] - }, - naf: { - wnd: 7, - points: [["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"], ["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"], ["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"], ["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"], ["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"], ["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"], ["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"], ["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"], ["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"], ["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"], ["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"], ["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"], ["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"], ["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"], ["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"], ["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"], ["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"], ["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"], ["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"], ["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"], ["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"], ["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"], ["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"], ["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"], ["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"], ["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"], ["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"], ["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"], ["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"], ["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"], ["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"], ["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"], ["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"], ["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"], ["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"], ["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"], ["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"], ["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"], ["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"], ["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"], ["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"], ["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"], ["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"], ["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"], ["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"], ["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"], ["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"], ["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"], ["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"], ["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"], ["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"], ["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"], ["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"], ["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"], ["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"], ["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"], ["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"], ["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"], ["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"], ["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"], ["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"], ["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"], ["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"], ["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"], ["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"], ["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"], ["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"], ["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"], ["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"], ["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"], ["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"], ["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"], ["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"], ["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"], ["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"], ["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"], ["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"], ["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"], ["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"], ["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"], ["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"], ["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"], ["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"], ["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"], ["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"], ["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"], ["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"], ["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"], ["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"], ["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"], ["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"], ["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"], ["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"], ["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"], ["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"], ["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"], ["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"], ["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"], ["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"], ["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"], ["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"], ["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"], ["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"], ["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"], ["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"], ["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"], ["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"], ["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"], ["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"], ["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"], ["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"], ["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"], ["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"], ["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"], ["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"], ["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"], ["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"], ["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"], ["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"], ["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"], ["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"], ["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"], ["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"], ["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"], ["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"], ["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"], ["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]] - } - } -} -, function(e, t, i) { + doubles: { + step: 4, + points: [ + [ + "e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", + "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821", + ], + [ + "8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", + "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf", + ], + [ + "175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", + "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695", + ], + [ + "363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", + "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9", + ], + [ + "8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", + "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36", + ], + [ + "723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", + "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f", + ], + [ + "eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", + "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999", + ], + [ + "100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", + "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09", + ], + [ + "e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", + "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d", + ], + [ + "feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", + "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088", + ], + [ + "da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", + "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d", + ], + [ + "53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", + "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8", + ], + [ + "8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", + "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a", + ], + [ + "385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", + "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453", + ], + [ + "6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", + "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160", + ], + [ + "3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", + "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0", + ], + [ + "85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", + "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6", + ], + [ + "948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", + "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589", + ], + [ + "6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", + "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17", + ], + [ + "e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", + "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda", + ], + [ + "e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", + "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd", + ], + [ + "213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", + "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2", + ], + [ + "4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", + "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6", + ], + [ + "fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", + "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f", + ], + [ + "76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", + "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01", + ], + [ + "c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", + "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3", + ], + [ + "d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", + "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f", + ], + [ + "b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", + "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7", + ], + [ + "e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", + "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78", + ], + [ + "a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", + "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1", + ], + [ + "90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", + "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150", + ], + [ + "8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", + "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82", + ], + [ + "e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", + "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc", + ], + [ + "8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", + "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b", + ], + [ + "e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", + "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51", + ], + [ + "b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", + "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45", + ], + [ + "d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", + "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120", + ], + [ + "324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", + "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84", + ], + [ + "4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", + "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d", + ], + [ + "9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", + "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d", + ], + [ + "6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", + "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8", + ], + [ + "a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", + "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8", + ], + [ + "7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", + "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac", + ], + [ + "928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", + "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f", + ], + [ + "85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", + "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962", + ], + [ + "ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", + "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907", + ], + [ + "827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", + "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec", + ], + [ + "eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", + "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d", + ], + [ + "e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", + "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414", + ], + [ + "1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", + "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd", + ], + [ + "146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", + "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0", + ], + [ + "fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", + "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811", + ], + [ + "da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", + "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1", + ], + [ + "a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", + "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c", + ], + [ + "174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", + "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73", + ], + [ + "959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", + "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd", + ], + [ + "d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", + "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405", + ], + [ + "64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", + "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589", + ], + [ + "8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", + "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e", + ], + [ + "13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", + "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27", + ], + [ + "bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", + "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1", + ], + [ + "8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", + "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482", + ], + [ + "8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", + "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945", + ], + [ + "dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", + "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573", + ], + [ + "f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", + "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82", + ], + ], + }, + naf: { + wnd: 7, + points: [ + [ + "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", + "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672", + ], + [ + "2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", + "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6", + ], + [ + "5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", + "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da", + ], + [ + "acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", + "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37", + ], + [ + "774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", + "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b", + ], + [ + "f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", + "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81", + ], + [ + "d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", + "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58", + ], + [ + "defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", + "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77", + ], + [ + "2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", + "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a", + ], + [ + "352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", + "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c", + ], + [ + "2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", + "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67", + ], + [ + "9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", + "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402", + ], + [ + "daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", + "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55", + ], + [ + "c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", + "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482", + ], + [ + "6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", + "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82", + ], + [ + "1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", + "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396", + ], + [ + "605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", + "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49", + ], + [ + "62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", + "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf", + ], + [ + "80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", + "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a", + ], + [ + "7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", + "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7", + ], + [ + "d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", + "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933", + ], + [ + "49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", + "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a", + ], + [ + "77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", + "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6", + ], + [ + "f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", + "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37", + ], + [ + "463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", + "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e", + ], + [ + "f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", + "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6", + ], + [ + "caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", + "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476", + ], + [ + "2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", + "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40", + ], + [ + "7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", + "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61", + ], + [ + "754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", + "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683", + ], + [ + "e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", + "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5", + ], + [ + "186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", + "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b", + ], + [ + "df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", + "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417", + ], + [ + "5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", + "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868", + ], + [ + "290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", + "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a", + ], + [ + "af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", + "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6", + ], + [ + "766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", + "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996", + ], + [ + "59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", + "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e", + ], + [ + "f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", + "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d", + ], + [ + "7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", + "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2", + ], + [ + "948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", + "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e", + ], + [ + "7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", + "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437", + ], + [ + "3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", + "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311", + ], + [ + "d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", + "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4", + ], + [ + "1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", + "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575", + ], + [ + "733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", + "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d", + ], + [ + "15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", + "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d", + ], + [ + "a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", + "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629", + ], + [ + "e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", + "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06", + ], + [ + "311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", + "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374", + ], + [ + "34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", + "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee", + ], + [ + "f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", + "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1", + ], + [ + "d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", + "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b", + ], + [ + "32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", + "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661", + ], + [ + "7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", + "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6", + ], + [ + "ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", + "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e", + ], + [ + "16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", + "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d", + ], + [ + "eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", + "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc", + ], + [ + "78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", + "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4", + ], + [ + "494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", + "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c", + ], + [ + "a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", + "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b", + ], + [ + "c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", + "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913", + ], + [ + "841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", + "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154", + ], + [ + "5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", + "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865", + ], + [ + "36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", + "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc", + ], + [ + "336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", + "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224", + ], + [ + "8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", + "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e", + ], + [ + "1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", + "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6", + ], + [ + "85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", + "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511", + ], + [ + "29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", + "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b", + ], + [ + "a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", + "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2", + ], + [ + "4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", + "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c", + ], + [ + "d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", + "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3", + ], + [ + "ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", + "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d", + ], + [ + "af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", + "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700", + ], + [ + "e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", + "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4", + ], + [ + "591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", + "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196", + ], + [ + "11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", + "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4", + ], + [ + "3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", + "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257", + ], + [ + "cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", + "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13", + ], + [ + "c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", + "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096", + ], + [ + "c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", + "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38", + ], + [ + "a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", + "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f", + ], + [ + "347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", + "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448", + ], + [ + "da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", + "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a", + ], + [ + "c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", + "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4", + ], + [ + "4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", + "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437", + ], + [ + "3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", + "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7", + ], + [ + "cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", + "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d", + ], + [ + "b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", + "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a", + ], + [ + "d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", + "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54", + ], + [ + "48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", + "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77", + ], + [ + "dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", + "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517", + ], + [ + "6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", + "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10", + ], + [ + "e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", + "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125", + ], + [ + "eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", + "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e", + ], + [ + "13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", + "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1", + ], + [ + "ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", + "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2", + ], + [ + "b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", + "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423", + ], + [ + "ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", + "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8", + ], + [ + "8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", + "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758", + ], + [ + "52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", + "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375", + ], + [ + "e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", + "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d", + ], + [ + "7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", + "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec", + ], + [ + "5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", + "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0", + ], + [ + "32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", + "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c", + ], + [ + "e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", + "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4", + ], + [ + "8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", + "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f", + ], + [ + "4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", + "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649", + ], + [ + "3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", + "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826", + ], + [ + "674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", + "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5", + ], + [ + "d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", + "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87", + ], + [ + "30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", + "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b", + ], + [ + "be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", + "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc", + ], + [ + "93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", + "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c", + ], + [ + "b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", + "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f", + ], + [ + "d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", + "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a", + ], + [ + "d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", + "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46", + ], + [ + "463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", + "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f", + ], + [ + "7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", + "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03", + ], + [ + "74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", + "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08", + ], + [ + "30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", + "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8", + ], + [ + "9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", + "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373", + ], + [ + "176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", + "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3", + ], + [ + "75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", + "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8", + ], + [ + "809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", + "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1", + ], + [ + "1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", + "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9", + ], + ], + }, + }; + }, + function (e, t, i) { "use strict"; function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - var r = i(11) - , o = i(564) - , a = i(17) - , s = a.utils.assert - , c = i(565) - , u = i(566); + var r = i(11), + o = i(564), + a = i(17), + s = a.utils.assert, + c = i(565), + u = i(566); function l(e) { - if (!(this instanceof l)) - return new l(e); - "string" == typeof e && (s(a.curves.hasOwnProperty(e), "Unknown curve " + e), - e = a.curves[e]), - e instanceof a.curves.PresetCurve && (e = { - curve: e - }), - this.curve = e.curve.curve, - this.n = this.curve.n, - this.nh = this.n.ushrn(1), - this.g = this.curve.g, - this.g = e.curve.g, + if (!(this instanceof l)) return new l(e); + "string" == typeof e && + (s(a.curves.hasOwnProperty(e), "Unknown curve " + e), + (e = a.curves[e])), + e instanceof a.curves.PresetCurve && + (e = { + curve: e, + }), + (this.curve = e.curve.curve), + (this.n = this.curve.n), + (this.nh = this.n.ushrn(1)), + (this.g = this.curve.g), + (this.g = e.curve.g), this.g.precompute(e.curve.n.bitLength() + 1), - this.hash = e.hash || e.curve.hash + (this.hash = e.hash || e.curve.hash); } - e.exports = l, - l.prototype.keyPair = function(e) { - return new c(this,e) - } - , - l.prototype.keyFromPrivate = function(e, t) { - return c.fromPrivate(this, e, t) - } - , - l.prototype.keyFromPublic = function(e, t) { - return c.fromPublic(this, e, t) - } - , - l.prototype.genKeyPair = function(e) { + (e.exports = l), + (l.prototype.keyPair = function (e) { + return new c(this, e); + }), + (l.prototype.keyFromPrivate = function (e, t) { + return c.fromPrivate(this, e, t); + }), + (l.prototype.keyFromPublic = function (e, t) { + return c.fromPublic(this, e, t); + }), + (l.prototype.genKeyPair = function (e) { e || (e = {}); - for (var t = new o({ - hash: this.hash, - pers: e.pers, - persEnc: e.persEnc || "utf8", - entropy: e.entropy || a.rand(this.hash.hmacStrength), - entropyEnc: e.entropy && e.entropyEnc || "utf8", - nonce: this.n.toArray() - }), i = this.n.byteLength(), n = this.n.sub(new r(2)); ; ) { - var s = new r(t.generate(i)); - if (!(s.cmp(n) > 0)) - return s.iaddn(1), - this.keyFromPrivate(s) + for ( + var t = new o({ + hash: this.hash, + pers: e.pers, + persEnc: e.persEnc || "utf8", + entropy: e.entropy || a.rand(this.hash.hmacStrength), + entropyEnc: (e.entropy && e.entropyEnc) || "utf8", + nonce: this.n.toArray(), + }), + i = this.n.byteLength(), + n = this.n.sub(new r(2)); + ; + + ) { + var s = new r(t.generate(i)); + if (!(s.cmp(n) > 0)) return s.iaddn(1), this.keyFromPrivate(s); } - } - , - l.prototype._truncateToN = function(e, t) { + }), + (l.prototype._truncateToN = function (e, t) { var i = 8 * e.byteLength() - this.n.bitLength(); - return i > 0 && (e = e.ushrn(i)), - !t && e.cmp(this.n) >= 0 ? e.sub(this.n) : e - } - , - l.prototype.sign = function(e, t, i, a) { - "object" === n(i) && (a = i, - i = null), - a || (a = {}), - t = this.keyFromPrivate(t, i), - e = this._truncateToN(new r(e,16)); - for (var s = this.n.byteLength(), c = t.getPrivate().toArray("be", s), l = e.toArray("be", s), h = new o({ - hash: this.hash, - entropy: c, - nonce: l, - pers: a.pers, - persEnc: a.persEnc || "utf8" - }), f = this.n.sub(new r(1)), d = 0; ; d++) { - var p = a.k ? a.k(d) : new r(h.generate(this.n.byteLength())); - if (!((p = this._truncateToN(p, true)).cmpn(1) <= 0 || p.cmp(f) >= 0)) { - var m = this.g.mul(p); - if (!m.isInfinity()) { - var g = m.getX() - , _ = g.umod(this.n); - if (0 !== _.cmpn(0)) { - var v = p.invm(this.n).mul(_.mul(t.getPrivate()).iadd(e)); - if (0 !== (v = v.umod(this.n)).cmpn(0)) { - var y = (m.getY().isOdd() ? 1 : 0) | (0 !== g.cmp(_) ? 2 : 0); - return a.canonical && v.cmp(this.nh) > 0 && (v = this.n.sub(v), - y ^= 1), - new u({ - r: _, - s: v, - recoveryParam: y - }) - } - } + return ( + i > 0 && (e = e.ushrn(i)), + !t && e.cmp(this.n) >= 0 ? e.sub(this.n) : e + ); + }), + (l.prototype.sign = function (e, t, i, a) { + "object" === n(i) && ((a = i), (i = null)), + a || (a = {}), + (t = this.keyFromPrivate(t, i)), + (e = this._truncateToN(new r(e, 16))); + for ( + var s = this.n.byteLength(), + c = t.getPrivate().toArray("be", s), + l = e.toArray("be", s), + h = new o({ + hash: this.hash, + entropy: c, + nonce: l, + pers: a.pers, + persEnc: a.persEnc || "utf8", + }), + f = this.n.sub(new r(1)), + d = 0; + ; + d++ + ) { + var p = a.k ? a.k(d) : new r(h.generate(this.n.byteLength())); + if ( + !((p = this._truncateToN(p, true)).cmpn(1) <= 0 || p.cmp(f) >= 0) + ) { + var m = this.g.mul(p); + if (!m.isInfinity()) { + var g = m.getX(), + _ = g.umod(this.n); + if (0 !== _.cmpn(0)) { + var v = p.invm(this.n).mul(_.mul(t.getPrivate()).iadd(e)); + if (0 !== (v = v.umod(this.n)).cmpn(0)) { + var y = (m.getY().isOdd() ? 1 : 0) | (0 !== g.cmp(_) ? 2 : 0); + return ( + a.canonical && + v.cmp(this.nh) > 0 && + ((v = this.n.sub(v)), (y ^= 1)), + new u({ + r: _, + s: v, + recoveryParam: y, + }) + ); } + } } + } } - } - , - l.prototype.verify = function(e, t, i, n) { - e = this._truncateToN(new r(e,16)), - i = this.keyFromPublic(i, n); - var o = (t = new u(t,"hex")).r - , a = t.s; - if (o.cmpn(1) < 0 || o.cmp(this.n) >= 0) - return false; - if (a.cmpn(1) < 0 || a.cmp(this.n) >= 0) - return false; - var s, c = a.invm(this.n), l = c.mul(e).umod(this.n), h = c.mul(o).umod(this.n); - return this.curve._maxwellTrick ? !(s = this.g.jmulAdd(l, i.getPublic(), h)).isInfinity() && s.eqXToP(o) : !(s = this.g.mulAdd(l, i.getPublic(), h)).isInfinity() && 0 === s.getX().umod(this.n).cmp(o) - } - , - l.prototype.recoverPubKey = function(e, t, i, n) { + }), + (l.prototype.verify = function (e, t, i, n) { + (e = this._truncateToN(new r(e, 16))), (i = this.keyFromPublic(i, n)); + var o = (t = new u(t, "hex")).r, + a = t.s; + if (o.cmpn(1) < 0 || o.cmp(this.n) >= 0) return false; + if (a.cmpn(1) < 0 || a.cmp(this.n) >= 0) return false; + var s, + c = a.invm(this.n), + l = c.mul(e).umod(this.n), + h = c.mul(o).umod(this.n); + return this.curve._maxwellTrick + ? !(s = this.g.jmulAdd(l, i.getPublic(), h)).isInfinity() && + s.eqXToP(o) + : !(s = this.g.mulAdd(l, i.getPublic(), h)).isInfinity() && + 0 === s.getX().umod(this.n).cmp(o); + }), + (l.prototype.recoverPubKey = function (e, t, i, n) { s((3 & i) === i, "The recovery param is more than two bits"), - t = new u(t,n); - var o = this.n - , a = new r(e) - , c = t.r - , l = t.s - , h = 1 & i - , f = i >> 1; + (t = new u(t, n)); + var o = this.n, + a = new r(e), + c = t.r, + l = t.s, + h = 1 & i, + f = i >> 1; if (c.cmp(this.curve.p.umod(this.curve.n)) >= 0 && f) - throw new Error("Unable to find sencond key candinate"); - c = f ? this.curve.pointFromX(c.add(this.curve.n), h) : this.curve.pointFromX(c, h); - var d = t.r.invm(o) - , p = o.sub(a).mul(d).umod(o) - , m = l.mul(d).umod(o); - return this.g.mulAdd(p, c, m) - } - , - l.prototype.getKeyRecoveryParam = function(e, t, i, n) { - if (null !== (t = new u(t,n)).recoveryParam) - return t.recoveryParam; + throw new Error("Unable to find sencond key candinate"); + c = f + ? this.curve.pointFromX(c.add(this.curve.n), h) + : this.curve.pointFromX(c, h); + var d = t.r.invm(o), + p = o.sub(a).mul(d).umod(o), + m = l.mul(d).umod(o); + return this.g.mulAdd(p, c, m); + }), + (l.prototype.getKeyRecoveryParam = function (e, t, i, n) { + if (null !== (t = new u(t, n)).recoveryParam) return t.recoveryParam; for (var r = 0; r < 4; r++) { - var o; - try { - o = this.recoverPubKey(e, t, r) - } catch (e) { - continue - } - if (o.eq(i)) - return r + var o; + try { + o = this.recoverPubKey(e, t, r); + } catch (e) { + continue; + } + if (o.eq(i)) return r; } - throw new Error("Unable to find valid recovery factor") - } -} -, function(e, t, i) { + throw new Error("Unable to find valid recovery factor"); + }); + }, + function (e, t, i) { "use strict"; - var n = i(135) - , r = i(214) - , o = i(25); + var n = i(135), + r = i(214), + o = i(25); function a(e) { - if (!(this instanceof a)) - return new a(e); - this.hash = e.hash, - this.predResist = !!e.predResist, - this.outLen = this.hash.outSize, - this.minEntropy = e.minEntropy || this.hash.hmacStrength, - this._reseed = null, - this.reseedInterval = null, - this.K = null, - this.V = null; - var t = r.toArray(e.entropy, e.entropyEnc || "hex") - , i = r.toArray(e.nonce, e.nonceEnc || "hex") - , n = r.toArray(e.pers, e.persEnc || "hex"); - o(t.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"), - this._init(t, i, n) + if (!(this instanceof a)) return new a(e); + (this.hash = e.hash), + (this.predResist = !!e.predResist), + (this.outLen = this.hash.outSize), + (this.minEntropy = e.minEntropy || this.hash.hmacStrength), + (this._reseed = null), + (this.reseedInterval = null), + (this.K = null), + (this.V = null); + var t = r.toArray(e.entropy, e.entropyEnc || "hex"), + i = r.toArray(e.nonce, e.nonceEnc || "hex"), + n = r.toArray(e.pers, e.persEnc || "hex"); + o( + t.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ), + this._init(t, i, n); } - e.exports = a, - a.prototype._init = function(e, t, i) { + (e.exports = a), + (a.prototype._init = function (e, t, i) { var n = e.concat(t).concat(i); - this.K = new Array(this.outLen / 8), - this.V = new Array(this.outLen / 8); + (this.K = new Array(this.outLen / 8)), + (this.V = new Array(this.outLen / 8)); for (var r = 0; r < this.V.length; r++) - this.K[r] = 0, - this.V[r] = 1; + (this.K[r] = 0), (this.V[r] = 1); this._update(n), - this._reseed = 1, - this.reseedInterval = 281474976710656 - } - , - a.prototype._hmac = function() { - return new n.hmac(this.hash,this.K) - } - , - a.prototype._update = function(e) { + (this._reseed = 1), + (this.reseedInterval = 281474976710656); + }), + (a.prototype._hmac = function () { + return new n.hmac(this.hash, this.K); + }), + (a.prototype._update = function (e) { var t = this._hmac().update(this.V).update([0]); e && (t = t.update(e)), - this.K = t.digest(), - this.V = this._hmac().update(this.V).digest(), - e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), - this.V = this._hmac().update(this.V).digest()) - } - , - a.prototype.reseed = function(e, t, i, n) { - "string" != typeof t && (n = i, - i = t, - t = null), - e = r.toArray(e, t), - i = r.toArray(i, n), - o(e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"), - this._update(e.concat(i || [])), - this._reseed = 1 - } - , - a.prototype.generate = function(e, t, i, n) { + (this.K = t.digest()), + (this.V = this._hmac().update(this.V).digest()), + e && + ((this.K = this._hmac() + .update(this.V) + .update([1]) + .update(e) + .digest()), + (this.V = this._hmac().update(this.V).digest())); + }), + (a.prototype.reseed = function (e, t, i, n) { + "string" != typeof t && ((n = i), (i = t), (t = null)), + (e = r.toArray(e, t)), + (i = r.toArray(i, n)), + o( + e.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ), + this._update(e.concat(i || [])), + (this._reseed = 1); + }), + (a.prototype.generate = function (e, t, i, n) { if (this._reseed > this.reseedInterval) - throw new Error("Reseed is required"); - "string" != typeof t && (n = i, - i = t, - t = null), - i && (i = r.toArray(i, n || "hex"), - this._update(i)); + throw new Error("Reseed is required"); + "string" != typeof t && ((n = i), (i = t), (t = null)), + i && ((i = r.toArray(i, n || "hex")), this._update(i)); for (var o = []; o.length < e; ) - this.V = this._hmac().update(this.V).digest(), - o = o.concat(this.V); + (this.V = this._hmac().update(this.V).digest()), + (o = o.concat(this.V)); var a = o.slice(0, e); - return this._update(i), - this._reseed++, - r.encode(a, t) - } -} -, function(e, t, i) { + return this._update(i), this._reseed++, r.encode(a, t); + }); + }, + function (e, t, i) { "use strict"; - var n = i(11) - , r = i(17).utils.assert; + var n = i(11), + r = i(17).utils.assert; function o(e, t) { - this.ec = e, - this.priv = null, - this.pub = null, + (this.ec = e), + (this.priv = null), + (this.pub = null), t.priv && this._importPrivate(t.priv, t.privEnc), - t.pub && this._importPublic(t.pub, t.pubEnc) + t.pub && this._importPublic(t.pub, t.pubEnc); } - e.exports = o, - o.fromPublic = function(e, t, i) { - return t instanceof o ? t : new o(e,{ - pub: t, - pubEnc: i - }) - } - , - o.fromPrivate = function(e, t, i) { - return t instanceof o ? t : new o(e,{ - priv: t, - privEnc: i - }) - } - , - o.prototype.validate = function() { + (e.exports = o), + (o.fromPublic = function (e, t, i) { + return t instanceof o + ? t + : new o(e, { + pub: t, + pubEnc: i, + }); + }), + (o.fromPrivate = function (e, t, i) { + return t instanceof o + ? t + : new o(e, { + priv: t, + privEnc: i, + }); + }), + (o.prototype.validate = function () { var e = this.getPublic(); - return e.isInfinity() ? { - result: false, - reason: "Invalid public key" - } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { - result: true, - reason: null - } : { - result: false, - reason: "Public key * N != O" - } : { - result: false, - reason: "Public key is not a point" - } - } - , - o.prototype.getPublic = function(e, t) { - return "string" == typeof e && (t = e, - e = null), - this.pub || (this.pub = this.ec.g.mul(this.priv)), - t ? this.pub.encode(t, e) : this.pub - } - , - o.prototype.getPrivate = function(e) { - return "hex" === e ? this.priv.toString(16, 2) : this.priv - } - , - o.prototype._importPrivate = function(e, t) { - this.priv = new n(e,t || 16), - this.priv = this.priv.umod(this.ec.curve.n) - } - , - o.prototype._importPublic = function(e, t) { + return e.isInfinity() + ? { + result: false, + reason: "Invalid public key", + } + : e.validate() + ? e.mul(this.ec.curve.n).isInfinity() + ? { + result: true, + reason: null, + } + : { + result: false, + reason: "Public key * N != O", + } + : { + result: false, + reason: "Public key is not a point", + }; + }), + (o.prototype.getPublic = function (e, t) { + return ( + "string" == typeof e && ((t = e), (e = null)), + this.pub || (this.pub = this.ec.g.mul(this.priv)), + t ? this.pub.encode(t, e) : this.pub + ); + }), + (o.prototype.getPrivate = function (e) { + return "hex" === e ? this.priv.toString(16, 2) : this.priv; + }), + (o.prototype._importPrivate = function (e, t) { + (this.priv = new n(e, t || 16)), + (this.priv = this.priv.umod(this.ec.curve.n)); + }), + (o.prototype._importPublic = function (e, t) { if (e.x || e.y) - return "mont" === this.ec.curve.type ? r(e.x, "Need x coordinate") : "short" !== this.ec.curve.type && "edwards" !== this.ec.curve.type || r(e.x && e.y, "Need both x and y coordinate"), - void (this.pub = this.ec.curve.point(e.x, e.y)); - this.pub = this.ec.curve.decodePoint(e, t) - } - , - o.prototype.derive = function(e) { - return e.mul(this.priv).getX() - } - , - o.prototype.sign = function(e, t, i) { - return this.ec.sign(e, this, t, i) - } - , - o.prototype.verify = function(e, t) { - return this.ec.verify(e, t, this) - } - , - o.prototype.inspect = function() { - return "" - } -} -, function(e, t, i) { + return ( + "mont" === this.ec.curve.type + ? r(e.x, "Need x coordinate") + : ("short" !== this.ec.curve.type && + "edwards" !== this.ec.curve.type) || + r(e.x && e.y, "Need both x and y coordinate"), + void (this.pub = this.ec.curve.point(e.x, e.y)) + ); + this.pub = this.ec.curve.decodePoint(e, t); + }), + (o.prototype.derive = function (e) { + return e.mul(this.priv).getX(); + }), + (o.prototype.sign = function (e, t, i) { + return this.ec.sign(e, this, t, i); + }), + (o.prototype.verify = function (e, t) { + return this.ec.verify(e, t, this); + }), + (o.prototype.inspect = function () { + return ( + "" + ); + }); + }, + function (e, t, i) { "use strict"; - var n = i(11) - , r = i(17).utils - , o = r.assert; + var n = i(11), + r = i(17).utils, + o = r.assert; function a(e, t) { - if (e instanceof a) - return e; - this._importDER(e, t) || (o(e.r && e.s, "Signature without r or s"), - this.r = new n(e.r,16), - this.s = new n(e.s,16), - void 0 === e.recoveryParam ? this.recoveryParam = null : this.recoveryParam = e.recoveryParam) + if (e instanceof a) return e; + this._importDER(e, t) || + (o(e.r && e.s, "Signature without r or s"), + (this.r = new n(e.r, 16)), + (this.s = new n(e.s, 16)), + void 0 === e.recoveryParam + ? (this.recoveryParam = null) + : (this.recoveryParam = e.recoveryParam)); } function s() { - this.place = 0 + this.place = 0; } function c(e, t) { - var i = e[t.place++]; - if (!(128 & i)) - return i; - for (var n = 15 & i, r = 0, o = 0, a = t.place; o < n; o++, - a++) - r <<= 8, - r |= e[a]; - return t.place = a, - r + var i = e[t.place++]; + if (!(128 & i)) return i; + for (var n = 15 & i, r = 0, o = 0, a = t.place; o < n; o++, a++) + (r <<= 8), (r |= e[a]); + return (t.place = a), r; } function u(e) { - for (var t = 0, i = e.length - 1; !e[t] && !(128 & e[t + 1]) && t < i; ) - t++; - return 0 === t ? e : e.slice(t) + for (var t = 0, i = e.length - 1; !e[t] && !(128 & e[t + 1]) && t < i; ) + t++; + return 0 === t ? e : e.slice(t); } function l(e, t) { - if (t < 128) - e.push(t); - else { - var i = 1 + (Math.log(t) / Math.LN2 >>> 3); - for (e.push(128 | i); --i; ) - e.push(t >>> (i << 3) & 255); - e.push(t) - } + if (t < 128) e.push(t); + else { + var i = 1 + ((Math.log(t) / Math.LN2) >>> 3); + for (e.push(128 | i); --i; ) e.push((t >>> (i << 3)) & 255); + e.push(t); + } } - e.exports = a, - a.prototype._importDER = function(e, t) { + (e.exports = a), + (a.prototype._importDER = function (e, t) { e = r.toArray(e, t); - var i = new s; - if (48 !== e[i.place++]) - return false; - if (c(e, i) + i.place !== e.length) - return false; - if (2 !== e[i.place++]) - return false; - var o = c(e, i) - , a = e.slice(i.place, o + i.place); - if (i.place += o, - 2 !== e[i.place++]) - return false; + var i = new s(); + if (48 !== e[i.place++]) return false; + if (c(e, i) + i.place !== e.length) return false; + if (2 !== e[i.place++]) return false; + var o = c(e, i), + a = e.slice(i.place, o + i.place); + if (((i.place += o), 2 !== e[i.place++])) return false; var u = c(e, i); - if (e.length !== u + i.place) - return false; + if (e.length !== u + i.place) return false; var l = e.slice(i.place, u + i.place); - return 0 === a[0] && 128 & a[1] && (a = a.slice(1)), - 0 === l[0] && 128 & l[1] && (l = l.slice(1)), - this.r = new n(a), - this.s = new n(l), - this.recoveryParam = null, - true - } - , - a.prototype.toDER = function(e) { - var t = this.r.toArray() - , i = this.s.toArray(); - for (128 & t[0] && (t = [0].concat(t)), - 128 & i[0] && (i = [0].concat(i)), - t = u(t), - i = u(i); !(i[0] || 128 & i[1]); ) - i = i.slice(1); + return ( + 0 === a[0] && 128 & a[1] && (a = a.slice(1)), + 0 === l[0] && 128 & l[1] && (l = l.slice(1)), + (this.r = new n(a)), + (this.s = new n(l)), + (this.recoveryParam = null), + true + ); + }), + (a.prototype.toDER = function (e) { + var t = this.r.toArray(), + i = this.s.toArray(); + for ( + 128 & t[0] && (t = [0].concat(t)), + 128 & i[0] && (i = [0].concat(i)), + t = u(t), + i = u(i); + !(i[0] || 128 & i[1]); + + ) + i = i.slice(1); var n = [2]; - l(n, t.length), - (n = n.concat(t)).push(2), - l(n, i.length); - var o = n.concat(i) - , a = [48]; - return l(a, o.length), - a = a.concat(o), - r.encode(a, e) - } -} -, function(e, t, i) { + l(n, t.length), (n = n.concat(t)).push(2), l(n, i.length); + var o = n.concat(i), + a = [48]; + return l(a, o.length), (a = a.concat(o)), r.encode(a, e); + }); + }, + function (e, t, i) { "use strict"; - var n = i(135) - , r = i(17) - , o = r.utils - , a = o.assert - , s = o.parseBytes - , c = i(568) - , u = i(569); + var n = i(135), + r = i(17), + o = r.utils, + a = o.assert, + s = o.parseBytes, + c = i(568), + u = i(569); function l(e) { - if (a("ed25519" === e, "only tested with ed25519 so far"), + if ( + (a("ed25519" === e, "only tested with ed25519 so far"), !(this instanceof l)) - return new l(e); - e = r.curves[e].curve; - this.curve = e, - this.g = e.g, + ) + return new l(e); + e = r.curves[e].curve; + (this.curve = e), + (this.g = e.g), this.g.precompute(e.n.bitLength() + 1), - this.pointClass = e.point().constructor, - this.encodingLength = Math.ceil(e.n.bitLength() / 8), - this.hash = n.sha512 + (this.pointClass = e.point().constructor), + (this.encodingLength = Math.ceil(e.n.bitLength() / 8)), + (this.hash = n.sha512); } - e.exports = l, - l.prototype.sign = function(e, t) { + (e.exports = l), + (l.prototype.sign = function (e, t) { e = s(e); - var i = this.keyFromSecret(t) - , n = this.hashInt(i.messagePrefix(), e) - , r = this.g.mul(n) - , o = this.encodePoint(r) - , a = this.hashInt(o, i.pubBytes(), e).mul(i.priv()) - , c = n.add(a).umod(this.curve.n); + var i = this.keyFromSecret(t), + n = this.hashInt(i.messagePrefix(), e), + r = this.g.mul(n), + o = this.encodePoint(r), + a = this.hashInt(o, i.pubBytes(), e).mul(i.priv()), + c = n.add(a).umod(this.curve.n); return this.makeSignature({ - R: r, - S: c, - Rencoded: o - }) - } - , - l.prototype.verify = function(e, t, i) { - e = s(e), - t = this.makeSignature(t); - var n = this.keyFromPublic(i) - , r = this.hashInt(t.Rencoded(), n.pubBytes(), e) - , o = this.g.mul(t.S()); - return t.R().add(n.pub().mul(r)).eq(o) - } - , - l.prototype.hashInt = function() { + R: r, + S: c, + Rencoded: o, + }); + }), + (l.prototype.verify = function (e, t, i) { + (e = s(e)), (t = this.makeSignature(t)); + var n = this.keyFromPublic(i), + r = this.hashInt(t.Rencoded(), n.pubBytes(), e), + o = this.g.mul(t.S()); + return t.R().add(n.pub().mul(r)).eq(o); + }), + (l.prototype.hashInt = function () { for (var e = this.hash(), t = 0; t < arguments.length; t++) - e.update(arguments[t]); - return o.intFromLE(e.digest()).umod(this.curve.n) - } - , - l.prototype.keyFromPublic = function(e) { - return c.fromPublic(this, e) - } - , - l.prototype.keyFromSecret = function(e) { - return c.fromSecret(this, e) - } - , - l.prototype.makeSignature = function(e) { - return e instanceof u ? e : new u(this,e) - } - , - l.prototype.encodePoint = function(e) { + e.update(arguments[t]); + return o.intFromLE(e.digest()).umod(this.curve.n); + }), + (l.prototype.keyFromPublic = function (e) { + return c.fromPublic(this, e); + }), + (l.prototype.keyFromSecret = function (e) { + return c.fromSecret(this, e); + }), + (l.prototype.makeSignature = function (e) { + return e instanceof u ? e : new u(this, e); + }), + (l.prototype.encodePoint = function (e) { var t = e.getY().toArray("le", this.encodingLength); - return t[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0, - t - } - , - l.prototype.decodePoint = function(e) { - var t = (e = o.parseBytes(e)).length - 1 - , i = e.slice(0, t).concat(-129 & e[t]) - , n = 0 != (128 & e[t]) - , r = o.intFromLE(i); - return this.curve.pointFromY(r, n) - } - , - l.prototype.encodeInt = function(e) { - return e.toArray("le", this.encodingLength) - } - , - l.prototype.decodeInt = function(e) { - return o.intFromLE(e) - } - , - l.prototype.isPoint = function(e) { - return e instanceof this.pointClass - } -} -, function(e, t, i) { + return (t[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0), t; + }), + (l.prototype.decodePoint = function (e) { + var t = (e = o.parseBytes(e)).length - 1, + i = e.slice(0, t).concat(-129 & e[t]), + n = 0 != (128 & e[t]), + r = o.intFromLE(i); + return this.curve.pointFromY(r, n); + }), + (l.prototype.encodeInt = function (e) { + return e.toArray("le", this.encodingLength); + }), + (l.prototype.decodeInt = function (e) { + return o.intFromLE(e); + }), + (l.prototype.isPoint = function (e) { + return e instanceof this.pointClass; + }); + }, + function (e, t, i) { "use strict"; - var n = i(17).utils - , r = n.assert - , o = n.parseBytes - , a = n.cachedProperty; + var n = i(17).utils, + r = n.assert, + o = n.parseBytes, + a = n.cachedProperty; function s(e, t) { - this.eddsa = e, - this._secret = o(t.secret), - e.isPoint(t.pub) ? this._pub = t.pub : this._pubBytes = o(t.pub) + (this.eddsa = e), + (this._secret = o(t.secret)), + e.isPoint(t.pub) ? (this._pub = t.pub) : (this._pubBytes = o(t.pub)); } - s.fromPublic = function(e, t) { - return t instanceof s ? t : new s(e,{ - pub: t - }) - } - , - s.fromSecret = function(e, t) { - return t instanceof s ? t : new s(e,{ - secret: t - }) - } - , - s.prototype.secret = function() { - return this._secret - } - , - a(s, "pubBytes", function() { - return this.eddsa.encodePoint(this.pub()) + (s.fromPublic = function (e, t) { + return t instanceof s + ? t + : new s(e, { + pub: t, + }); }), - a(s, "pub", function() { - return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv()) - }), - a(s, "privBytes", function() { - var e = this.eddsa - , t = this.hash() - , i = e.encodingLength - 1 - , n = t.slice(0, e.encodingLength); - return n[0] &= 248, - n[i] &= 127, - n[i] |= 64, - n - }), - a(s, "priv", function() { - return this.eddsa.decodeInt(this.privBytes()) - }), - a(s, "hash", function() { - return this.eddsa.hash().update(this.secret()).digest() - }), - a(s, "messagePrefix", function() { - return this.hash().slice(this.eddsa.encodingLength) - }), - s.prototype.sign = function(e) { - return r(this._secret, "KeyPair can only verify"), - this.eddsa.sign(e, this) - } - , - s.prototype.verify = function(e, t) { - return this.eddsa.verify(e, t, this) - } - , - s.prototype.getSecret = function(e) { - return r(this._secret, "KeyPair is public only"), - n.encode(this.secret(), e) - } - , - s.prototype.getPublic = function(e) { - return n.encode(this.pubBytes(), e) - } - , - e.exports = s -} -, function(e, t, i) { + (s.fromSecret = function (e, t) { + return t instanceof s + ? t + : new s(e, { + secret: t, + }); + }), + (s.prototype.secret = function () { + return this._secret; + }), + a(s, "pubBytes", function () { + return this.eddsa.encodePoint(this.pub()); + }), + a(s, "pub", function () { + return this._pubBytes + ? this.eddsa.decodePoint(this._pubBytes) + : this.eddsa.g.mul(this.priv()); + }), + a(s, "privBytes", function () { + var e = this.eddsa, + t = this.hash(), + i = e.encodingLength - 1, + n = t.slice(0, e.encodingLength); + return (n[0] &= 248), (n[i] &= 127), (n[i] |= 64), n; + }), + a(s, "priv", function () { + return this.eddsa.decodeInt(this.privBytes()); + }), + a(s, "hash", function () { + return this.eddsa.hash().update(this.secret()).digest(); + }), + a(s, "messagePrefix", function () { + return this.hash().slice(this.eddsa.encodingLength); + }), + (s.prototype.sign = function (e) { + return ( + r(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this) + ); + }), + (s.prototype.verify = function (e, t) { + return this.eddsa.verify(e, t, this); + }), + (s.prototype.getSecret = function (e) { + return ( + r(this._secret, "KeyPair is public only"), n.encode(this.secret(), e) + ); + }), + (s.prototype.getPublic = function (e) { + return n.encode(this.pubBytes(), e); + }), + (e.exports = s); + }, + function (e, t, i) { "use strict"; function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - var r = i(11) - , o = i(17).utils - , a = o.assert - , s = o.cachedProperty - , c = o.parseBytes; + var r = i(11), + o = i(17).utils, + a = o.assert, + s = o.cachedProperty, + c = o.parseBytes; function u(e, t) { - this.eddsa = e, + (this.eddsa = e), "object" !== n(t) && (t = c(t)), - Array.isArray(t) && (t = { + Array.isArray(t) && + (t = { R: t.slice(0, e.encodingLength), - S: t.slice(e.encodingLength) - }), + S: t.slice(e.encodingLength), + }), a(t.R && t.S, "Signature without R or S"), e.isPoint(t.R) && (this._R = t.R), t.S instanceof r && (this._S = t.S), - this._Rencoded = Array.isArray(t.R) ? t.R : t.Rencoded, - this._Sencoded = Array.isArray(t.S) ? t.S : t.Sencoded + (this._Rencoded = Array.isArray(t.R) ? t.R : t.Rencoded), + (this._Sencoded = Array.isArray(t.S) ? t.S : t.Sencoded); } - s(u, "S", function() { - return this.eddsa.decodeInt(this.Sencoded()) + s(u, "S", function () { + return this.eddsa.decodeInt(this.Sencoded()); }), - s(u, "R", function() { - return this.eddsa.decodePoint(this.Rencoded()) - }), - s(u, "Rencoded", function() { - return this.eddsa.encodePoint(this.R()) - }), - s(u, "Sencoded", function() { - return this.eddsa.encodeInt(this.S()) - }), - u.prototype.toBytes = function() { - return this.Rencoded().concat(this.Sencoded()) - } - , - u.prototype.toHex = function() { - return o.encode(this.toBytes(), "hex").toUpperCase() - } - , - e.exports = u -} -, function(e, t, i) { + s(u, "R", function () { + return this.eddsa.decodePoint(this.Rencoded()); + }), + s(u, "Rencoded", function () { + return this.eddsa.encodePoint(this.R()); + }), + s(u, "Sencoded", function () { + return this.eddsa.encodeInt(this.S()); + }), + (u.prototype.toBytes = function () { + return this.Rencoded().concat(this.Sencoded()); + }), + (u.prototype.toHex = function () { + return o.encode(this.toBytes(), "hex").toUpperCase(); + }), + (e.exports = u); + }, + function (e, t, i) { "use strict"; var n = i(72); t.certificate = i(581); - var r = n.define("RSAPrivateKey", function() { - this.seq().obj(this.key("version").int(), this.key("modulus").int(), this.key("publicExponent").int(), this.key("privateExponent").int(), this.key("prime1").int(), this.key("prime2").int(), this.key("exponent1").int(), this.key("exponent2").int(), this.key("coefficient").int()) + var r = n.define("RSAPrivateKey", function () { + this.seq().obj( + this.key("version").int(), + this.key("modulus").int(), + this.key("publicExponent").int(), + this.key("privateExponent").int(), + this.key("prime1").int(), + this.key("prime2").int(), + this.key("exponent1").int(), + this.key("exponent2").int(), + this.key("coefficient").int() + ); }); t.RSAPrivateKey = r; - var o = n.define("RSAPublicKey", function() { - this.seq().obj(this.key("modulus").int(), this.key("publicExponent").int()) + var o = n.define("RSAPublicKey", function () { + this.seq().obj( + this.key("modulus").int(), + this.key("publicExponent").int() + ); }); t.RSAPublicKey = o; - var a = n.define("SubjectPublicKeyInfo", function() { - this.seq().obj(this.key("algorithm").use(s), this.key("subjectPublicKey").bitstr()) + var a = n.define("SubjectPublicKeyInfo", function () { + this.seq().obj( + this.key("algorithm").use(s), + this.key("subjectPublicKey").bitstr() + ); }); t.PublicKey = a; - var s = n.define("AlgorithmIdentifier", function() { - this.seq().obj(this.key("algorithm").objid(), this.key("none").null_().optional(), this.key("curve").objid().optional(), this.key("params").seq().obj(this.key("p").int(), this.key("q").int(), this.key("g").int()).optional()) - }) - , c = n.define("PrivateKeyInfo", function() { - this.seq().obj(this.key("version").int(), this.key("algorithm").use(s), this.key("subjectPrivateKey").octstr()) - }); + var s = n.define("AlgorithmIdentifier", function () { + this.seq().obj( + this.key("algorithm").objid(), + this.key("none").null_().optional(), + this.key("curve").objid().optional(), + this.key("params") + .seq() + .obj(this.key("p").int(), this.key("q").int(), this.key("g").int()) + .optional() + ); + }), + c = n.define("PrivateKeyInfo", function () { + this.seq().obj( + this.key("version").int(), + this.key("algorithm").use(s), + this.key("subjectPrivateKey").octstr() + ); + }); t.PrivateKey = c; - var u = n.define("EncryptedPrivateKeyInfo", function() { - this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(), this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(), this.key("kdeparams").seq().obj(this.key("salt").octstr(), this.key("iters").int())), this.key("cipher").seq().obj(this.key("algo").objid(), this.key("iv").octstr()))), this.key("subjectPrivateKey").octstr()) + var u = n.define("EncryptedPrivateKeyInfo", function () { + this.seq().obj( + this.key("algorithm") + .seq() + .obj( + this.key("id").objid(), + this.key("decrypt") + .seq() + .obj( + this.key("kde") + .seq() + .obj( + this.key("id").objid(), + this.key("kdeparams") + .seq() + .obj(this.key("salt").octstr(), this.key("iters").int()) + ), + this.key("cipher") + .seq() + .obj(this.key("algo").objid(), this.key("iv").octstr()) + ) + ), + this.key("subjectPrivateKey").octstr() + ); }); t.EncryptedPrivateKey = u; - var l = n.define("DSAPrivateKey", function() { - this.seq().obj(this.key("version").int(), this.key("p").int(), this.key("q").int(), this.key("g").int(), this.key("pub_key").int(), this.key("priv_key").int()) + var l = n.define("DSAPrivateKey", function () { + this.seq().obj( + this.key("version").int(), + this.key("p").int(), + this.key("q").int(), + this.key("g").int(), + this.key("pub_key").int(), + this.key("priv_key").int() + ); }); - t.DSAPrivateKey = l, - t.DSAparam = n.define("DSAparam", function() { - this.int() - }); - var h = n.define("ECPrivateKey", function() { - this.seq().obj(this.key("version").int(), this.key("privateKey").octstr(), this.key("parameters").optional().explicit(0).use(f), this.key("publicKey").optional().explicit(1).bitstr()) + (t.DSAPrivateKey = l), + (t.DSAparam = n.define("DSAparam", function () { + this.int(); + })); + var h = n.define("ECPrivateKey", function () { + this.seq().obj( + this.key("version").int(), + this.key("privateKey").octstr(), + this.key("parameters").optional().explicit(0).use(f), + this.key("publicKey").optional().explicit(1).bitstr() + ); }); t.ECPrivateKey = h; - var f = n.define("ECParameters", function() { - this.choice({ - namedCurve: this.objid() - }) + var f = n.define("ECParameters", function () { + this.choice({ + namedCurve: this.objid(), + }); }); - t.signature = n.define("signature", function() { - this.seq().obj(this.key("r").int(), this.key("s").int()) - }) -} -, function(e, t, i) { - var n = i(72) - , r = i(1); + t.signature = n.define("signature", function () { + this.seq().obj(this.key("r").int(), this.key("s").int()); + }); + }, + function (e, t, i) { + var n = i(72), + r = i(1); function o(e, t) { - this.name = e, - this.body = t, - this.decoders = {}, - this.encoders = {} + (this.name = e), + (this.body = t), + (this.decoders = {}), + (this.encoders = {}); } - t.define = function(e, t) { - return new o(e,t) - } - , - o.prototype._createNamed = function(e) { + (t.define = function (e, t) { + return new o(e, t); + }), + (o.prototype._createNamed = function (e) { var t; try { - t = i(572).runInThisContext("(function " + this.name + "(entity) {\n this._initNamed(entity);\n})") + t = i(572).runInThisContext( + "(function " + + this.name + + "(entity) {\n this._initNamed(entity);\n})" + ); } catch (e) { - t = function(e) { - this._initNamed(e) - } + t = function (e) { + this._initNamed(e); + }; } - return r(t, e), - t.prototype._initNamed = function(t) { - e.call(this, t) - } - , - new t(this) - } - , - o.prototype._getDecoder = function(e) { - return e = e || "der", - this.decoders.hasOwnProperty(e) || (this.decoders[e] = this._createNamed(n.decoders[e])), - this.decoders[e] - } - , - o.prototype.decode = function(e, t, i) { - return this._getDecoder(t).decode(e, i) - } - , - o.prototype._getEncoder = function(e) { - return e = e || "der", - this.encoders.hasOwnProperty(e) || (this.encoders[e] = this._createNamed(n.encoders[e])), - this.encoders[e] - } - , - o.prototype.encode = function(e, t, i) { - return this._getEncoder(t).encode(e, i) - } -} -, function(module, exports, __webpack_require__) { + return ( + r(t, e), + (t.prototype._initNamed = function (t) { + e.call(this, t); + }), + new t(this) + ); + }), + (o.prototype._getDecoder = function (e) { + return ( + (e = e || "der"), + this.decoders.hasOwnProperty(e) || + (this.decoders[e] = this._createNamed(n.decoders[e])), + this.decoders[e] + ); + }), + (o.prototype.decode = function (e, t, i) { + return this._getDecoder(t).decode(e, i); + }), + (o.prototype._getEncoder = function (e) { + return ( + (e = e || "der"), + this.encoders.hasOwnProperty(e) || + (this.encoders[e] = this._createNamed(n.encoders[e])), + this.encoders[e] + ); + }), + (o.prototype.encode = function (e, t, i) { + return this._getEncoder(t).encode(e, i); + }); + }, + function (module, exports, __webpack_require__) { function _typeof(e) { - return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (_typeof = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - var indexOf = __webpack_require__(573) - , Object_keys = function(e) { - if (Object.keys) - return Object.keys(e); + var indexOf = __webpack_require__(573), + Object_keys = function (e) { + if (Object.keys) return Object.keys(e); var t = []; - for (var i in e) - t.push(i); - return t - } - , forEach = function(e, t) { - if (e.forEach) - return e.forEach(t); - for (var i = 0; i < e.length; i++) - t(e[i], i, e) - } - , defineProp = function() { + for (var i in e) t.push(i); + return t; + }, + forEach = function (e, t) { + if (e.forEach) return e.forEach(t); + for (var i = 0; i < e.length; i++) t(e[i], i, e); + }, + defineProp = (function () { try { - return Object.defineProperty({}, "_", {}), - function(e, t, i) { - Object.defineProperty(e, t, { - writable: true, - enumerable: false, - configurable: true, - value: i - }) + return ( + Object.defineProperty({}, "_", {}), + function (e, t, i) { + Object.defineProperty(e, t, { + writable: true, + enumerable: false, + configurable: true, + value: i, + }); } + ); } catch (e) { - return function(e, t, i) { - e[t] = i - } + return function (e, t, i) { + e[t] = i; + }; } - }() - , globals = ["Array", "Boolean", "Date", "Error", "EvalError", "Function", "Infinity", "JSON", "Math", "NaN", "Number", "Object", "RangeError", "ReferenceError", "RegExp", "String", "SyntaxError", "TypeError", "URIError", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", "eval", "isFinite", "isNaN", "parseFloat", "parseInt", "undefined", "unescape"]; + })(), + globals = [ + "Array", + "Boolean", + "Date", + "Error", + "EvalError", + "Function", + "Infinity", + "JSON", + "Math", + "NaN", + "Number", + "Object", + "RangeError", + "ReferenceError", + "RegExp", + "String", + "SyntaxError", + "TypeError", + "URIError", + "decodeURI", + "decodeURIComponent", + "encodeURI", + "encodeURIComponent", + "escape", + "eval", + "isFinite", + "isNaN", + "parseFloat", + "parseInt", + "undefined", + "unescape", + ]; function Context() {} Context.prototype = {}; - var Script = exports.Script = function(e) { - if (!(this instanceof Script)) - return new Script(e); - this.code = e - } - ; - Script.prototype.runInContext = function(e) { - if (!(e instanceof Context)) - throw new TypeError("needs a 'context' argument."); - var t = document.createElement("iframe"); - t.style || (t.style = {}), - t.style.display = "none", + var Script = (exports.Script = function (e) { + if (!(this instanceof Script)) return new Script(e); + this.code = e; + }); + (Script.prototype.runInContext = function (e) { + if (!(e instanceof Context)) + throw new TypeError("needs a 'context' argument."); + var t = document.createElement("iframe"); + t.style || (t.style = {}), + (t.style.display = "none"), document.body.appendChild(t); - var i = t.contentWindow - , n = i.eval - , r = i.execScript; - !n && r && (r.call(i, "null"), - n = i.eval), - forEach(Object_keys(e), function(t) { - i[t] = e[t] + var i = t.contentWindow, + n = i.eval, + r = i.execScript; + !n && r && (r.call(i, "null"), (n = i.eval)), + forEach(Object_keys(e), function (t) { + i[t] = e[t]; }), - forEach(globals, function(t) { - e[t] && (i[t] = e[t]) + forEach(globals, function (t) { + e[t] && (i[t] = e[t]); }); - var o = Object_keys(i) - , a = n.call(i, this.code); - return forEach(Object_keys(i), function(t) { - (t in e || -1 === indexOf(o, t)) && (e[t] = i[t]) + var o = Object_keys(i), + a = n.call(i, this.code); + return ( + forEach(Object_keys(i), function (t) { + (t in e || -1 === indexOf(o, t)) && (e[t] = i[t]); }), - forEach(globals, function(t) { - t in e || defineProp(e, t, i[t]) + forEach(globals, function (t) { + t in e || defineProp(e, t, i[t]); }), document.body.removeChild(t), a - } - , - Script.prototype.runInThisContext = function() { - return eval(this.code) - } - , - Script.prototype.runInNewContext = function(e) { - var t = Script.createContext(e) - , i = this.runInContext(t); - return forEach(Object_keys(t), function(i) { - e[i] = t[i] - }), - i - } - , - forEach(Object_keys(Script.prototype), function(e) { - exports[e] = Script[e] = function(t) { - var i = Script(t); - return i[e].apply(i, [].slice.call(arguments, 1)) - } + ); }), - exports.createScript = function(e) { - return exports.Script(e) - } - , - exports.createContext = Script.createContext = function(e) { - var t = new Context; - return "object" === _typeof(e) && forEach(Object_keys(e), function(i) { - t[i] = e[i] - }), - t - } -} -, function(e, t) { + (Script.prototype.runInThisContext = function () { + return eval(this.code); + }), + (Script.prototype.runInNewContext = function (e) { + var t = Script.createContext(e), + i = this.runInContext(t); + return ( + forEach(Object_keys(t), function (i) { + e[i] = t[i]; + }), + i + ); + }), + forEach(Object_keys(Script.prototype), function (e) { + exports[e] = Script[e] = function (t) { + var i = Script(t); + return i[e].apply(i, [].slice.call(arguments, 1)); + }; + }), + (exports.createScript = function (e) { + return exports.Script(e); + }), + (exports.createContext = Script.createContext = + function (e) { + var t = new Context(); + return ( + "object" === _typeof(e) && + forEach(Object_keys(e), function (i) { + t[i] = e[i]; + }), + t + ); + }); + }, + function (e, t) { var i = [].indexOf; - e.exports = function(e, t) { - if (i) - return e.indexOf(t); - for (var n = 0; n < e.length; ++n) - if (e[n] === t) - return n; - return -1 - } -} -, function(e, t, i) { + e.exports = function (e, t) { + if (i) return e.indexOf(t); + for (var n = 0; n < e.length; ++n) if (e[n] === t) return n; + return -1; + }; + }, + function (e, t, i) { var n = i(1); function r(e) { - this._reporterState = { - obj: null, - path: [], - options: e || {}, - errors: [] - } + this._reporterState = { + obj: null, + path: [], + options: e || {}, + errors: [], + }; } function o(e, t) { - this.path = e, - this.rethrow(t) + (this.path = e), this.rethrow(t); } - t.Reporter = r, - r.prototype.isError = function(e) { - return e instanceof o - } - , - r.prototype.save = function() { + (t.Reporter = r), + (r.prototype.isError = function (e) { + return e instanceof o; + }), + (r.prototype.save = function () { var e = this._reporterState; return { - obj: e.obj, - pathLen: e.path.length - } - } - , - r.prototype.restore = function(e) { + obj: e.obj, + pathLen: e.path.length, + }; + }), + (r.prototype.restore = function (e) { var t = this._reporterState; - t.obj = e.obj, - t.path = t.path.slice(0, e.pathLen) - } - , - r.prototype.enterKey = function(e) { - return this._reporterState.path.push(e) - } - , - r.prototype.exitKey = function(e) { + (t.obj = e.obj), (t.path = t.path.slice(0, e.pathLen)); + }), + (r.prototype.enterKey = function (e) { + return this._reporterState.path.push(e); + }), + (r.prototype.exitKey = function (e) { var t = this._reporterState; - t.path = t.path.slice(0, e - 1) - } - , - r.prototype.leaveKey = function(e, t, i) { + t.path = t.path.slice(0, e - 1); + }), + (r.prototype.leaveKey = function (e, t, i) { var n = this._reporterState; - this.exitKey(e), - null !== n.obj && (n.obj[t] = i) - } - , - r.prototype.path = function() { - return this._reporterState.path.join("/") - } - , - r.prototype.enterObject = function() { - var e = this._reporterState - , t = e.obj; - return e.obj = {}, - t - } - , - r.prototype.leaveObject = function(e) { - var t = this._reporterState - , i = t.obj; - return t.obj = e, - i - } - , - r.prototype.error = function(e) { - var t, i = this._reporterState, n = e instanceof o; - if (t = n ? e : new o(i.path.map(function(e) { - return "[" + JSON.stringify(e) + "]" - }).join(""),e.message || e,e.stack), - !i.options.partial) - throw t; - return n || i.errors.push(t), - t - } - , - r.prototype.wrapResult = function(e) { + this.exitKey(e), null !== n.obj && (n.obj[t] = i); + }), + (r.prototype.path = function () { + return this._reporterState.path.join("/"); + }), + (r.prototype.enterObject = function () { + var e = this._reporterState, + t = e.obj; + return (e.obj = {}), t; + }), + (r.prototype.leaveObject = function (e) { + var t = this._reporterState, + i = t.obj; + return (t.obj = e), i; + }), + (r.prototype.error = function (e) { + var t, + i = this._reporterState, + n = e instanceof o; + if ( + ((t = n + ? e + : new o( + i.path + .map(function (e) { + return "[" + JSON.stringify(e) + "]"; + }) + .join(""), + e.message || e, + e.stack + )), + !i.options.partial) + ) + throw t; + return n || i.errors.push(t), t; + }), + (r.prototype.wrapResult = function (e) { var t = this._reporterState; - return t.options.partial ? { - result: this.isError(e) ? null : e, - errors: t.errors - } : e - } - , - n(o, Error), - o.prototype.rethrow = function(e) { - if (this.message = e + " at: " + (this.path || "(shallow)"), - Error.captureStackTrace && Error.captureStackTrace(this, o), - !this.stack) - try { - throw new Error(this.message) - } catch (e) { - this.stack = e.stack + return t.options.partial + ? { + result: this.isError(e) ? null : e, + errors: t.errors, } - return this - } -} -, function(e, t, i) { + : e; + }), + n(o, Error), + (o.prototype.rethrow = function (e) { + if ( + ((this.message = e + " at: " + (this.path || "(shallow)")), + Error.captureStackTrace && Error.captureStackTrace(this, o), + !this.stack) + ) + try { + throw new Error(this.message); + } catch (e) { + this.stack = e.stack; + } + return this; + }); + }, + function (e, t, i) { function n(e) { - return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { - return typeof e - } - : function(e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e - } - )(e) + return (n = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (e) { + return typeof e; + } + : function (e) { + return e && + "function" == typeof Symbol && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + })(e); } - var r = i(73).Reporter - , o = i(73).EncoderBuffer - , a = i(73).DecoderBuffer - , s = i(25) - , c = ["seq", "seqof", "set", "setof", "objid", "bool", "gentime", "utctime", "null_", "enum", "int", "objDesc", "bitstr", "bmpstr", "charstr", "genstr", "graphstr", "ia5str", "iso646str", "numstr", "octstr", "printstr", "t61str", "unistr", "utf8str", "videostr"] - , u = ["key", "obj", "use", "optional", "explicit", "implicit", "def", "choice", "any", "contains"].concat(c); + var r = i(73).Reporter, + o = i(73).EncoderBuffer, + a = i(73).DecoderBuffer, + s = i(25), + c = [ + "seq", + "seqof", + "set", + "setof", + "objid", + "bool", + "gentime", + "utctime", + "null_", + "enum", + "int", + "objDesc", + "bitstr", + "bmpstr", + "charstr", + "genstr", + "graphstr", + "ia5str", + "iso646str", + "numstr", + "octstr", + "printstr", + "t61str", + "unistr", + "utf8str", + "videostr", + ], + u = [ + "key", + "obj", + "use", + "optional", + "explicit", + "implicit", + "def", + "choice", + "any", + "contains", + ].concat(c); function l(e, t) { - var i = {}; - this._baseState = i, - i.enc = e, - i.parent = t || null, - i.children = null, - i.tag = null, - i.args = null, - i.reverseArgs = null, - i.choice = null, - i.optional = false, - i.any = false, - i.obj = false, - i.use = null, - i.useDecoder = null, - i.key = null, - i.default = null, - i.explicit = null, - i.implicit = null, - i.contains = null, - i.parent || (i.children = [], - this._wrap()) + var i = {}; + (this._baseState = i), + (i.enc = e), + (i.parent = t || null), + (i.children = null), + (i.tag = null), + (i.args = null), + (i.reverseArgs = null), + (i.choice = null), + (i.optional = false), + (i.any = false), + (i.obj = false), + (i.use = null), + (i.useDecoder = null), + (i.key = null), + (i.default = null), + (i.explicit = null), + (i.implicit = null), + (i.contains = null), + i.parent || ((i.children = []), this._wrap()); } e.exports = l; - var h = ["enc", "parent", "children", "tag", "args", "reverseArgs", "choice", "optional", "any", "obj", "use", "alteredUse", "key", "default", "explicit", "implicit", "contains"]; - l.prototype.clone = function() { - var e = this._baseState - , t = {}; - h.forEach(function(i) { - t[i] = e[i] - }); - var i = new this.constructor(t.parent); - return i._baseState = t, - i - } - , - l.prototype._wrap = function() { + var h = [ + "enc", + "parent", + "children", + "tag", + "args", + "reverseArgs", + "choice", + "optional", + "any", + "obj", + "use", + "alteredUse", + "key", + "default", + "explicit", + "implicit", + "contains", + ]; + (l.prototype.clone = function () { + var e = this._baseState, + t = {}; + h.forEach(function (i) { + t[i] = e[i]; + }); + var i = new this.constructor(t.parent); + return (i._baseState = t), i; + }), + (l.prototype._wrap = function () { var e = this._baseState; - u.forEach(function(t) { - this[t] = function() { - var i = new this.constructor(this); - return e.children.push(i), - i[t].apply(i, arguments) - } - }, this) - } - , - l.prototype._init = function(e) { + u.forEach(function (t) { + this[t] = function () { + var i = new this.constructor(this); + return e.children.push(i), i[t].apply(i, arguments); + }; + }, this); + }), + (l.prototype._init = function (e) { var t = this._baseState; s(null === t.parent), - e.call(this), - t.children = t.children.filter(function(e) { - return e._baseState.parent === this - }, this), - s.equal(t.children.length, 1, "Root node can have only one child") - } - , - l.prototype._useArgs = function(e) { - var t = this._baseState - , i = e.filter(function(e) { - return e instanceof this.constructor - }, this); - e = e.filter(function(e) { - return !(e instanceof this.constructor) - }, this), - 0 !== i.length && (s(null === t.children), - t.children = i, - i.forEach(function(e) { - e._baseState.parent = this + e.call(this), + (t.children = t.children.filter(function (e) { + return e._baseState.parent === this; + }, this)), + s.equal(t.children.length, 1, "Root node can have only one child"); + }), + (l.prototype._useArgs = function (e) { + var t = this._baseState, + i = e.filter(function (e) { + return e instanceof this.constructor; + }, this); + (e = e.filter(function (e) { + return !(e instanceof this.constructor); }, this)), - 0 !== e.length && (s(null === t.args), - t.args = e, - t.reverseArgs = e.map(function(e) { - if ("object" !== n(e) || e.constructor !== Object) - return e; - var t = {}; - return Object.keys(e).forEach(function(i) { - i == (0 | i) && (i |= 0); - var n = e[i]; - t[n] = i - }), - t - })) - } - , - ["_peekTag", "_decodeTag", "_use", "_decodeStr", "_decodeObjid", "_decodeTime", "_decodeNull", "_decodeInt", "_decodeBool", "_decodeList", "_encodeComposite", "_encodeStr", "_encodeObjid", "_encodeTime", "_encodeNull", "_encodeInt", "_encodeBool"].forEach(function(e) { - l.prototype[e] = function() { - var t = this._baseState; - throw new Error(e + " not implemented for encoding: " + t.enc) - } - }), - c.forEach(function(e) { - l.prototype[e] = function() { - var t = this._baseState - , i = Array.prototype.slice.call(arguments); - return s(null === t.tag), - t.tag = e, - this._useArgs(i), - this - } - }), - l.prototype.use = function(e) { + 0 !== i.length && + (s(null === t.children), + (t.children = i), + i.forEach(function (e) { + e._baseState.parent = this; + }, this)), + 0 !== e.length && + (s(null === t.args), + (t.args = e), + (t.reverseArgs = e.map(function (e) { + if ("object" !== n(e) || e.constructor !== Object) return e; + var t = {}; + return ( + Object.keys(e).forEach(function (i) { + i == (0 | i) && (i |= 0); + var n = e[i]; + t[n] = i; + }), + t + ); + }))); + }), + [ + "_peekTag", + "_decodeTag", + "_use", + "_decodeStr", + "_decodeObjid", + "_decodeTime", + "_decodeNull", + "_decodeInt", + "_decodeBool", + "_decodeList", + "_encodeComposite", + "_encodeStr", + "_encodeObjid", + "_encodeTime", + "_encodeNull", + "_encodeInt", + "_encodeBool", + ].forEach(function (e) { + l.prototype[e] = function () { + var t = this._baseState; + throw new Error(e + " not implemented for encoding: " + t.enc); + }; + }), + c.forEach(function (e) { + l.prototype[e] = function () { + var t = this._baseState, + i = Array.prototype.slice.call(arguments); + return s(null === t.tag), (t.tag = e), this._useArgs(i), this; + }; + }), + (l.prototype.use = function (e) { s(e); var t = this._baseState; - return s(null === t.use), - t.use = e, - this - } - , - l.prototype.optional = function() { - return this._baseState.optional = true, - this - } - , - l.prototype.def = function(e) { + return s(null === t.use), (t.use = e), this; + }), + (l.prototype.optional = function () { + return (this._baseState.optional = true), this; + }), + (l.prototype.def = function (e) { var t = this._baseState; - return s(null === t.default), - t.default = e, - t.optional = true, - this - } - , - l.prototype.explicit = function(e) { + return ( + s(null === t.default), (t.default = e), (t.optional = true), this + ); + }), + (l.prototype.explicit = function (e) { var t = this._baseState; - return s(null === t.explicit && null === t.implicit), - t.explicit = e, - this - } - , - l.prototype.implicit = function(e) { + return ( + s(null === t.explicit && null === t.implicit), (t.explicit = e), this + ); + }), + (l.prototype.implicit = function (e) { var t = this._baseState; - return s(null === t.explicit && null === t.implicit), - t.implicit = e, - this - } - , - l.prototype.obj = function() { - var e = this._baseState - , t = Array.prototype.slice.call(arguments); - return e.obj = true, - 0 !== t.length && this._useArgs(t), - this - } - , - l.prototype.key = function(e) { + return ( + s(null === t.explicit && null === t.implicit), (t.implicit = e), this + ); + }), + (l.prototype.obj = function () { + var e = this._baseState, + t = Array.prototype.slice.call(arguments); + return (e.obj = true), 0 !== t.length && this._useArgs(t), this; + }), + (l.prototype.key = function (e) { var t = this._baseState; - return s(null === t.key), - t.key = e, - this - } - , - l.prototype.any = function() { - return this._baseState.any = true, - this - } - , - l.prototype.choice = function(e) { + return s(null === t.key), (t.key = e), this; + }), + (l.prototype.any = function () { + return (this._baseState.any = true), this; + }), + (l.prototype.choice = function (e) { var t = this._baseState; - return s(null === t.choice), - t.choice = e, - this._useArgs(Object.keys(e).map(function(t) { - return e[t] - })), - this - } - , - l.prototype.contains = function(e) { + return ( + s(null === t.choice), + (t.choice = e), + this._useArgs( + Object.keys(e).map(function (t) { + return e[t]; + }) + ), + this + ); + }), + (l.prototype.contains = function (e) { var t = this._baseState; - return s(null === t.use), - t.contains = e, - this - } - , - l.prototype._decode = function(e, t) { + return s(null === t.use), (t.contains = e), this; + }), + (l.prototype._decode = function (e, t) { var i = this._baseState; - if (null === i.parent) - return e.wrapResult(i.children[0]._decode(e, t)); - var n, r = i.default, o = true, s = null; - if (null !== i.key && (s = e.enterKey(i.key)), - i.optional) { - var c = null; - if (null !== i.explicit ? c = i.explicit : null !== i.implicit ? c = i.implicit : null !== i.tag && (c = i.tag), - null !== c || i.any) { - if (o = this._peekTag(e, c, i.any), - e.isError(o)) - return o - } else { - var u = e.save(); - try { - null === i.choice ? this._decodeGeneric(i.tag, e, t) : this._decodeChoice(e, t), - o = true - } catch (e) { - o = false - } - e.restore(u) - } - } - if (i.obj && o && (n = e.enterObject()), - o) { - if (null !== i.explicit) { - var l = this._decodeTag(e, i.explicit); - if (e.isError(l)) - return l; - e = l - } - var h = e.offset; - if (null === i.use && null === i.choice) { - if (i.any) - u = e.save(); - var f = this._decodeTag(e, null !== i.implicit ? i.implicit : i.tag, i.any); - if (e.isError(f)) - return f; - i.any ? r = e.raw(u) : e = f - } - if (t && t.track && null !== i.tag && t.track(e.path(), h, e.length, "tagged"), - t && t.track && null !== i.tag && t.track(e.path(), e.offset, e.length, "content"), - r = i.any ? r : null === i.choice ? this._decodeGeneric(i.tag, e, t) : this._decodeChoice(e, t), - e.isError(r)) - return r; - if (i.any || null !== i.choice || null === i.children || i.children.forEach(function(i) { - i._decode(e, t) - }), - i.contains && ("octstr" === i.tag || "bitstr" === i.tag)) { - var d = new a(r); - r = this._getUse(i.contains, e._reporterState.obj)._decode(d, t) - } - } - return i.obj && o && (r = e.leaveObject(n)), - null === i.key || null === r && true !== o ? null !== s && e.exitKey(s) : e.leaveKey(s, i.key, r), - r - } - , - l.prototype._decodeGeneric = function(e, t, i) { - var n = this._baseState; - return "seq" === e || "set" === e ? null : "seqof" === e || "setof" === e ? this._decodeList(t, e, n.args[0], i) : /str$/.test(e) ? this._decodeStr(t, e, i) : "objid" === e && n.args ? this._decodeObjid(t, n.args[0], n.args[1], i) : "objid" === e ? this._decodeObjid(t, null, null, i) : "gentime" === e || "utctime" === e ? this._decodeTime(t, e, i) : "null_" === e ? this._decodeNull(t, i) : "bool" === e ? this._decodeBool(t, i) : "objDesc" === e ? this._decodeStr(t, e, i) : "int" === e || "enum" === e ? this._decodeInt(t, n.args && n.args[0], i) : null !== n.use ? this._getUse(n.use, t._reporterState.obj)._decode(t, i) : t.error("unknown tag: " + e) - } - , - l.prototype._getUse = function(e, t) { - var i = this._baseState; - return i.useDecoder = this._use(e, t), - s(null === i.useDecoder._baseState.parent), - i.useDecoder = i.useDecoder._baseState.children[0], - i.implicit !== i.useDecoder._baseState.implicit && (i.useDecoder = i.useDecoder.clone(), - i.useDecoder._baseState.implicit = i.implicit), - i.useDecoder - } - , - l.prototype._decodeChoice = function(e, t) { - var i = this._baseState - , n = null - , r = false; - return Object.keys(i.choice).some(function(o) { - var a = e.save() - , s = i.choice[o]; + if (null === i.parent) return e.wrapResult(i.children[0]._decode(e, t)); + var n, + r = i.default, + o = true, + s = null; + if ((null !== i.key && (s = e.enterKey(i.key)), i.optional)) { + var c = null; + if ( + (null !== i.explicit + ? (c = i.explicit) + : null !== i.implicit + ? (c = i.implicit) + : null !== i.tag && (c = i.tag), + null !== c || i.any) + ) { + if (((o = this._peekTag(e, c, i.any)), e.isError(o))) return o; + } else { + var u = e.save(); try { - var c = s._decode(e, t); - if (e.isError(c)) - return false; - n = { - type: o, - value: c - }, - r = true - } catch (t) { - return e.restore(a), - false + null === i.choice + ? this._decodeGeneric(i.tag, e, t) + : this._decodeChoice(e, t), + (o = true); + } catch (e) { + o = false; } - return true - }, this), - r ? n : e.error("Choice not matched") - } - , - l.prototype._createEncoderBuffer = function(e) { - return new o(e,this.reporter) - } - , - l.prototype._encode = function(e, t, i) { + e.restore(u); + } + } + if ((i.obj && o && (n = e.enterObject()), o)) { + if (null !== i.explicit) { + var l = this._decodeTag(e, i.explicit); + if (e.isError(l)) return l; + e = l; + } + var h = e.offset; + if (null === i.use && null === i.choice) { + if (i.any) u = e.save(); + var f = this._decodeTag( + e, + null !== i.implicit ? i.implicit : i.tag, + i.any + ); + if (e.isError(f)) return f; + i.any ? (r = e.raw(u)) : (e = f); + } + if ( + (t && + t.track && + null !== i.tag && + t.track(e.path(), h, e.length, "tagged"), + t && + t.track && + null !== i.tag && + t.track(e.path(), e.offset, e.length, "content"), + (r = i.any + ? r + : null === i.choice + ? this._decodeGeneric(i.tag, e, t) + : this._decodeChoice(e, t)), + e.isError(r)) + ) + return r; + if ( + (i.any || + null !== i.choice || + null === i.children || + i.children.forEach(function (i) { + i._decode(e, t); + }), + i.contains && ("octstr" === i.tag || "bitstr" === i.tag)) + ) { + var d = new a(r); + r = this._getUse(i.contains, e._reporterState.obj)._decode(d, t); + } + } + return ( + i.obj && o && (r = e.leaveObject(n)), + null === i.key || (null === r && true !== o) + ? null !== s && e.exitKey(s) + : e.leaveKey(s, i.key, r), + r + ); + }), + (l.prototype._decodeGeneric = function (e, t, i) { + var n = this._baseState; + return "seq" === e || "set" === e + ? null + : "seqof" === e || "setof" === e + ? this._decodeList(t, e, n.args[0], i) + : /str$/.test(e) + ? this._decodeStr(t, e, i) + : "objid" === e && n.args + ? this._decodeObjid(t, n.args[0], n.args[1], i) + : "objid" === e + ? this._decodeObjid(t, null, null, i) + : "gentime" === e || "utctime" === e + ? this._decodeTime(t, e, i) + : "null_" === e + ? this._decodeNull(t, i) + : "bool" === e + ? this._decodeBool(t, i) + : "objDesc" === e + ? this._decodeStr(t, e, i) + : "int" === e || "enum" === e + ? this._decodeInt(t, n.args && n.args[0], i) + : null !== n.use + ? this._getUse(n.use, t._reporterState.obj)._decode(t, i) + : t.error("unknown tag: " + e); + }), + (l.prototype._getUse = function (e, t) { + var i = this._baseState; + return ( + (i.useDecoder = this._use(e, t)), + s(null === i.useDecoder._baseState.parent), + (i.useDecoder = i.useDecoder._baseState.children[0]), + i.implicit !== i.useDecoder._baseState.implicit && + ((i.useDecoder = i.useDecoder.clone()), + (i.useDecoder._baseState.implicit = i.implicit)), + i.useDecoder + ); + }), + (l.prototype._decodeChoice = function (e, t) { + var i = this._baseState, + n = null, + r = false; + return ( + Object.keys(i.choice).some(function (o) { + var a = e.save(), + s = i.choice[o]; + try { + var c = s._decode(e, t); + if (e.isError(c)) return false; + (n = { + type: o, + value: c, + }), + (r = true); + } catch (t) { + return e.restore(a), false; + } + return true; + }, this), + r ? n : e.error("Choice not matched") + ); + }), + (l.prototype._createEncoderBuffer = function (e) { + return new o(e, this.reporter); + }), + (l.prototype._encode = function (e, t, i) { var n = this._baseState; if (null === n.default || n.default !== e) { - var r = this._encodeValue(e, t, i); - if (void 0 !== r && !this._skipDefault(r, t, i)) - return r + var r = this._encodeValue(e, t, i); + if (void 0 !== r && !this._skipDefault(r, t, i)) return r; } - } - , - l.prototype._encodeValue = function(e, t, i) { + }), + (l.prototype._encodeValue = function (e, t, i) { var o = this._baseState; - if (null === o.parent) - return o.children[0]._encode(e, t || new r); + if (null === o.parent) return o.children[0]._encode(e, t || new r()); var a = null; - if (this.reporter = t, - o.optional && void 0 === e) { - if (null === o.default) - return; - e = o.default + if (((this.reporter = t), o.optional && void 0 === e)) { + if (null === o.default) return; + e = o.default; } - var s = null - , c = false; - if (o.any) - a = this._createEncoderBuffer(e); - else if (o.choice) - a = this._encodeChoice(e, t); + var s = null, + c = false; + if (o.any) a = this._createEncoderBuffer(e); + else if (o.choice) a = this._encodeChoice(e, t); else if (o.contains) - s = this._getUse(o.contains, i)._encode(e, t), - c = true; + (s = this._getUse(o.contains, i)._encode(e, t)), (c = true); else if (o.children) - s = o.children.map(function(i) { - if ("null_" === i._baseState.tag) - return i._encode(null, t, e); - if (null === i._baseState.key) - return t.error("Child should have a key"); - var r = t.enterKey(i._baseState.key); - if ("object" !== n(e)) - return t.error("Child expected, but input is not object"); - var o = i._encode(e[i._baseState.key], t, e); - return t.leaveKey(r), - o - }, this).filter(function(e) { - return e - }), - s = this._createEncoderBuffer(s); + (s = o.children + .map(function (i) { + if ("null_" === i._baseState.tag) return i._encode(null, t, e); + if (null === i._baseState.key) + return t.error("Child should have a key"); + var r = t.enterKey(i._baseState.key); + if ("object" !== n(e)) + return t.error("Child expected, but input is not object"); + var o = i._encode(e[i._baseState.key], t, e); + return t.leaveKey(r), o; + }, this) + .filter(function (e) { + return e; + })), + (s = this._createEncoderBuffer(s)); else if ("seqof" === o.tag || "setof" === o.tag) { - if (!o.args || 1 !== o.args.length) - return t.error("Too many args for : " + o.tag); - if (!Array.isArray(e)) - return t.error("seqof/setof, but data is not Array"); - var u = this.clone(); - u._baseState.implicit = null, - s = this._createEncoderBuffer(e.map(function(i) { + if (!o.args || 1 !== o.args.length) + return t.error("Too many args for : " + o.tag); + if (!Array.isArray(e)) + return t.error("seqof/setof, but data is not Array"); + var u = this.clone(); + (u._baseState.implicit = null), + (s = this._createEncoderBuffer( + e.map(function (i) { var n = this._baseState; - return this._getUse(n.args[0], e)._encode(i, t) - }, u)) + return this._getUse(n.args[0], e)._encode(i, t); + }, u) + )); } else - null !== o.use ? a = this._getUse(o.use, i)._encode(e, t) : (s = this._encodePrimitive(o.tag, e), - c = true); + null !== o.use + ? (a = this._getUse(o.use, i)._encode(e, t)) + : ((s = this._encodePrimitive(o.tag, e)), (c = true)); if (!o.any && null === o.choice) { - var l = null !== o.implicit ? o.implicit : o.tag - , h = null === o.implicit ? "universal" : "context"; - null === l ? null === o.use && t.error("Tag could be omitted only for .use()") : null === o.use && (a = this._encodeComposite(l, c, h, s)) + var l = null !== o.implicit ? o.implicit : o.tag, + h = null === o.implicit ? "universal" : "context"; + null === l + ? null === o.use && t.error("Tag could be omitted only for .use()") + : null === o.use && (a = this._encodeComposite(l, c, h, s)); } - return null !== o.explicit && (a = this._encodeComposite(o.explicit, false, "context", a)), - a - } - , - l.prototype._encodeChoice = function(e, t) { - var i = this._baseState - , n = i.choice[e.type]; - return n || s(false, e.type + " not found in " + JSON.stringify(Object.keys(i.choice))), - n._encode(e.value, t) - } - , - l.prototype._encodePrimitive = function(e, t) { + return ( + null !== o.explicit && + (a = this._encodeComposite(o.explicit, false, "context", a)), + a + ); + }), + (l.prototype._encodeChoice = function (e, t) { + var i = this._baseState, + n = i.choice[e.type]; + return ( + n || + s( + false, + e.type + " not found in " + JSON.stringify(Object.keys(i.choice)) + ), + n._encode(e.value, t) + ); + }), + (l.prototype._encodePrimitive = function (e, t) { var i = this._baseState; - if (/str$/.test(e)) - return this._encodeStr(t, e); + if (/str$/.test(e)) return this._encodeStr(t, e); if ("objid" === e && i.args) - return this._encodeObjid(t, i.reverseArgs[0], i.args[1]); - if ("objid" === e) - return this._encodeObjid(t, null, null); - if ("gentime" === e || "utctime" === e) - return this._encodeTime(t, e); - if ("null_" === e) - return this._encodeNull(); + return this._encodeObjid(t, i.reverseArgs[0], i.args[1]); + if ("objid" === e) return this._encodeObjid(t, null, null); + if ("gentime" === e || "utctime" === e) return this._encodeTime(t, e); + if ("null_" === e) return this._encodeNull(); if ("int" === e || "enum" === e) - return this._encodeInt(t, i.args && i.reverseArgs[0]); - if ("bool" === e) - return this._encodeBool(t); - if ("objDesc" === e) - return this._encodeStr(t, e); - throw new Error("Unsupported tag: " + e) - } - , - l.prototype._isNumstr = function(e) { - return /^[0-9 ]*$/.test(e) - } - , - l.prototype._isPrintstr = function(e) { - return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e) - } -} -, function(e, t, i) { + return this._encodeInt(t, i.args && i.reverseArgs[0]); + if ("bool" === e) return this._encodeBool(t); + if ("objDesc" === e) return this._encodeStr(t, e); + throw new Error("Unsupported tag: " + e); + }), + (l.prototype._isNumstr = function (e) { + return /^[0-9 ]*$/.test(e); + }), + (l.prototype._isPrintstr = function (e) { + return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e); + }); + }, + function (e, t, i) { var n = i(219); - t.tagClass = { - 0: "universal", - 1: "application", - 2: "context", - 3: "private" - }, - t.tagClassByName = n._reverse(t.tagClass), - t.tag = { + (t.tagClass = { + 0: "universal", + 1: "application", + 2: "context", + 3: "private", + }), + (t.tagClassByName = n._reverse(t.tagClass)), + (t.tag = { 0: "end", 1: "bool", 2: "int", @@ -112619,539 +152278,589 @@ and limitations under the License. 27: "genstr", 28: "unistr", 29: "charstr", - 30: "bmpstr" - }, - t.tagByName = n._reverse(t.tag) -} -, function(e, t, i) { + 30: "bmpstr", + }), + (t.tagByName = n._reverse(t.tag)); + }, + function (e, t, i) { var n = t; - n.der = i(220), - n.pem = i(578) -} -, function(e, t, i) { - var n = i(1) - , r = i(9).Buffer - , o = i(220); + (n.der = i(220)), (n.pem = i(578)); + }, + function (e, t, i) { + var n = i(1), + r = i(9).Buffer, + o = i(220); function a(e) { - o.call(this, e), - this.enc = "pem" + o.call(this, e), (this.enc = "pem"); } n(a, o), - e.exports = a, - a.prototype.decode = function(e, t) { - for (var i = e.toString().split(/[\r\n]+/g), n = t.label.toUpperCase(), a = /^-----(BEGIN|END) ([^-]+)-----$/, s = -1, c = -1, u = 0; u < i.length; u++) { - var l = i[u].match(a); - if (null !== l && l[2] === n) { - if (-1 !== s) { - if ("END" !== l[1]) - break; - c = u; - break - } - if ("BEGIN" !== l[1]) - break; - s = u + (e.exports = a), + (a.prototype.decode = function (e, t) { + for ( + var i = e.toString().split(/[\r\n]+/g), + n = t.label.toUpperCase(), + a = /^-----(BEGIN|END) ([^-]+)-----$/, + s = -1, + c = -1, + u = 0; + u < i.length; + u++ + ) { + var l = i[u].match(a); + if (null !== l && l[2] === n) { + if (-1 !== s) { + if ("END" !== l[1]) break; + c = u; + break; } + if ("BEGIN" !== l[1]) break; + s = u; + } } if (-1 === s || -1 === c) - throw new Error("PEM section not found for: " + n); + throw new Error("PEM section not found for: " + n); var h = i.slice(s + 1, c).join(""); h.replace(/[^a-z0-9\+\/=]+/gi, ""); - var f = new r(h,"base64"); - return o.prototype.decode.call(this, f, t) - } -} -, function(e, t, i) { + var f = new r(h, "base64"); + return o.prototype.decode.call(this, f, t); + }); + }, + function (e, t, i) { var n = t; - n.der = i(221), - n.pem = i(580) -} -, function(e, t, i) { - var n = i(1) - , r = i(221); + (n.der = i(221)), (n.pem = i(580)); + }, + function (e, t, i) { + var n = i(1), + r = i(221); function o(e) { - r.call(this, e), - this.enc = "pem" + r.call(this, e), (this.enc = "pem"); } n(o, r), - e.exports = o, - o.prototype.encode = function(e, t) { - for (var i = r.prototype.encode.call(this, e).toString("base64"), n = ["-----BEGIN " + t.label + "-----"], o = 0; o < i.length; o += 64) - n.push(i.slice(o, o + 64)); - return n.push("-----END " + t.label + "-----"), - n.join("\n") - } -} -, function(e, t, i) { + (e.exports = o), + (o.prototype.encode = function (e, t) { + for ( + var i = r.prototype.encode.call(this, e).toString("base64"), + n = ["-----BEGIN " + t.label + "-----"], + o = 0; + o < i.length; + o += 64 + ) + n.push(i.slice(o, o + 64)); + return n.push("-----END " + t.label + "-----"), n.join("\n"); + }); + }, + function (e, t, i) { "use strict"; - var n = i(72) - , r = n.define("Time", function() { + var n = i(72), + r = n.define("Time", function () { this.choice({ - utcTime: this.utctime(), - generalTime: this.gentime() - }) - }) - , o = n.define("AttributeTypeValue", function() { - this.seq().obj(this.key("type").objid(), this.key("value").any()) - }) - , a = n.define("AlgorithmIdentifier", function() { - this.seq().obj(this.key("algorithm").objid(), this.key("parameters").optional()) - }) - , s = n.define("SubjectPublicKeyInfo", function() { - this.seq().obj(this.key("algorithm").use(a), this.key("subjectPublicKey").bitstr()) - }) - , c = n.define("RelativeDistinguishedName", function() { - this.setof(o) - }) - , u = n.define("RDNSequence", function() { - this.seqof(c) - }) - , l = n.define("Name", function() { + utcTime: this.utctime(), + generalTime: this.gentime(), + }); + }), + o = n.define("AttributeTypeValue", function () { + this.seq().obj(this.key("type").objid(), this.key("value").any()); + }), + a = n.define("AlgorithmIdentifier", function () { + this.seq().obj( + this.key("algorithm").objid(), + this.key("parameters").optional() + ); + }), + s = n.define("SubjectPublicKeyInfo", function () { + this.seq().obj( + this.key("algorithm").use(a), + this.key("subjectPublicKey").bitstr() + ); + }), + c = n.define("RelativeDistinguishedName", function () { + this.setof(o); + }), + u = n.define("RDNSequence", function () { + this.seqof(c); + }), + l = n.define("Name", function () { this.choice({ - rdnSequence: this.use(u) - }) - }) - , h = n.define("Validity", function() { - this.seq().obj(this.key("notBefore").use(r), this.key("notAfter").use(r)) - }) - , f = n.define("Extension", function() { - this.seq().obj(this.key("extnID").objid(), this.key("critical").bool().def(false), this.key("extnValue").octstr()) - }) - , d = n.define("TBSCertificate", function() { - this.seq().obj(this.key("version").explicit(0).int(), this.key("serialNumber").int(), this.key("signature").use(a), this.key("issuer").use(l), this.key("validity").use(h), this.key("subject").use(l), this.key("subjectPublicKeyInfo").use(s), this.key("issuerUniqueID").implicit(1).bitstr().optional(), this.key("subjectUniqueID").implicit(2).bitstr().optional(), this.key("extensions").explicit(3).seqof(f).optional()) - }) - , p = n.define("X509Certificate", function() { - this.seq().obj(this.key("tbsCertificate").use(d), this.key("signatureAlgorithm").use(a), this.key("signatureValue").bitstr()) - }); - e.exports = p -} -, function(e) { + rdnSequence: this.use(u), + }); + }), + h = n.define("Validity", function () { + this.seq().obj( + this.key("notBefore").use(r), + this.key("notAfter").use(r) + ); + }), + f = n.define("Extension", function () { + this.seq().obj( + this.key("extnID").objid(), + this.key("critical").bool().def(false), + this.key("extnValue").octstr() + ); + }), + d = n.define("TBSCertificate", function () { + this.seq().obj( + this.key("version").explicit(0).int(), + this.key("serialNumber").int(), + this.key("signature").use(a), + this.key("issuer").use(l), + this.key("validity").use(h), + this.key("subject").use(l), + this.key("subjectPublicKeyInfo").use(s), + this.key("issuerUniqueID").implicit(1).bitstr().optional(), + this.key("subjectUniqueID").implicit(2).bitstr().optional(), + this.key("extensions").explicit(3).seqof(f).optional() + ); + }), + p = n.define("X509Certificate", function () { + this.seq().obj( + this.key("tbsCertificate").use(d), + this.key("signatureAlgorithm").use(a), + this.key("signatureValue").bitstr() + ); + }); + e.exports = p; + }, + function (e) { e.exports = { - "2.16.840.1.101.3.4.1.1": "aes-128-ecb", - "2.16.840.1.101.3.4.1.2": "aes-128-cbc", - "2.16.840.1.101.3.4.1.3": "aes-128-ofb", - "2.16.840.1.101.3.4.1.4": "aes-128-cfb", - "2.16.840.1.101.3.4.1.21": "aes-192-ecb", - "2.16.840.1.101.3.4.1.22": "aes-192-cbc", - "2.16.840.1.101.3.4.1.23": "aes-192-ofb", - "2.16.840.1.101.3.4.1.24": "aes-192-cfb", - "2.16.840.1.101.3.4.1.41": "aes-256-ecb", - "2.16.840.1.101.3.4.1.42": "aes-256-cbc", - "2.16.840.1.101.3.4.1.43": "aes-256-ofb", - "2.16.840.1.101.3.4.1.44": "aes-256-cfb" - } -} -, function(e, t, i) { - (function(t) { - var n = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m - , r = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m - , o = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m - , a = i(90) - , s = i(132); - e.exports = function(e, i) { - var c, u = e.toString(), l = u.match(n); - if (l) { - var h = "aes" + l[1] - , f = new t(l[2],"hex") - , d = new t(l[3].replace(/[\r\n]/g, ""),"base64") - , p = a(i, f.slice(0, 8), parseInt(l[1], 10)).key - , m = [] - , g = s.createDecipheriv(h, p, f); - m.push(g.update(d)), - m.push(g.final()), - c = t.concat(m) - } else { - var _ = u.match(o); - c = new t(_[2].replace(/[\r\n]/g, ""),"base64") - } - return { - tag: u.match(r)[1], - data: c - } + "2.16.840.1.101.3.4.1.1": "aes-128-ecb", + "2.16.840.1.101.3.4.1.2": "aes-128-cbc", + "2.16.840.1.101.3.4.1.3": "aes-128-ofb", + "2.16.840.1.101.3.4.1.4": "aes-128-cfb", + "2.16.840.1.101.3.4.1.21": "aes-192-ecb", + "2.16.840.1.101.3.4.1.22": "aes-192-cbc", + "2.16.840.1.101.3.4.1.23": "aes-192-ofb", + "2.16.840.1.101.3.4.1.24": "aes-192-cfb", + "2.16.840.1.101.3.4.1.41": "aes-256-ecb", + "2.16.840.1.101.3.4.1.42": "aes-256-cbc", + "2.16.840.1.101.3.4.1.43": "aes-256-ofb", + "2.16.840.1.101.3.4.1.44": "aes-256-cfb", + }; + }, + function (e, t, i) { + (function (t) { + var n = + /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m, + r = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m, + o = + /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m, + a = i(90), + s = i(132); + e.exports = function (e, i) { + var c, + u = e.toString(), + l = u.match(n); + if (l) { + var h = "aes" + l[1], + f = new t(l[2], "hex"), + d = new t(l[3].replace(/[\r\n]/g, ""), "base64"), + p = a(i, f.slice(0, 8), parseInt(l[1], 10)).key, + m = [], + g = s.createDecipheriv(h, p, f); + m.push(g.update(d)), m.push(g.final()), (c = t.concat(m)); + } else { + var _ = u.match(o); + c = new t(_[2].replace(/[\r\n]/g, ""), "base64"); } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { - (function(t) { - var n = i(11) - , r = i(17).ec - , o = i(92) - , a = i(222); - function s(e, t) { - if (e.cmpn(0) <= 0) - throw new Error("invalid sig"); - if (e.cmp(t) >= t) - throw new Error("invalid sig") - } - e.exports = function(e, i, c, u, l) { - var h = o(c); - if ("ec" === h.type) { - if ("ecdsa" !== u && "ecdsa/rsa" !== u) - throw new Error("wrong public key type"); - return function(e, t, i) { - var n = a[i.data.algorithm.curve.join(".")]; - if (!n) - throw new Error("unknown curve " + i.data.algorithm.curve.join(".")); - var o = new r(n) - , s = i.data.subjectPrivateKey.data; - return o.verify(t, e, s) - }(e, i, h) - } - if ("dsa" === h.type) { - if ("dsa" !== u) - throw new Error("wrong public key type"); - return function(e, t, i) { - var r = i.data.p - , a = i.data.q - , c = i.data.g - , u = i.data.pub_key - , l = o.signature.decode(e, "der") - , h = l.s - , f = l.r; - s(h, a), - s(f, a); - var d = n.mont(r) - , p = h.invm(a); - return 0 === c.toRed(d).redPow(new n(t).mul(p).mod(a)).fromRed().mul(u.toRed(d).redPow(f.mul(p).mod(a)).fromRed()).mod(r).mod(a).cmp(f) - }(e, i, h) - } - if ("rsa" !== u && "ecdsa/rsa" !== u) - throw new Error("wrong public key type"); - i = t.concat([l, i]); - for (var f = h.modulus.byteLength(), d = [1], p = 0; i.length + d.length + 2 < f; ) - d.push(255), - p++; - d.push(0); - for (var m = -1; ++m < i.length; ) - d.push(i[m]); - d = new t(d); - var g = n.mont(h.modulus); - e = (e = new n(e).toRed(g)).redPow(new n(h.publicExponent)), - e = new t(e.fromRed().toArray()); - var _ = p < 8 ? 1 : 0; - for (f = Math.min(e.length, d.length), - e.length !== d.length && (_ = 1), - m = -1; ++m < f; ) - _ |= e[m] ^ d[m]; - return 0 === _ - } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { - (function(t) { - var n = i(17) - , r = i(11); - e.exports = function(e) { - return new a(e) - } - ; - var o = { - secp256k1: { - name: "secp256k1", - byteLength: 32 - }, - secp224r1: { - name: "p224", - byteLength: 28 - }, - prime256v1: { - name: "p256", - byteLength: 32 - }, - prime192v1: { - name: "p192", - byteLength: 24 - }, - ed25519: { - name: "ed25519", - byteLength: 32 - }, - secp384r1: { - name: "p384", - byteLength: 48 - }, - secp521r1: { - name: "p521", - byteLength: 66 - } + return { + tag: u.match(r)[1], + data: c, }; - function a(e) { - this.curveType = o[e], - this.curveType || (this.curveType = { - name: e + }; + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { + (function (t) { + var n = i(11), + r = i(17).ec, + o = i(92), + a = i(222); + function s(e, t) { + if (e.cmpn(0) <= 0) throw new Error("invalid sig"); + if (e.cmp(t) >= t) throw new Error("invalid sig"); + } + e.exports = function (e, i, c, u, l) { + var h = o(c); + if ("ec" === h.type) { + if ("ecdsa" !== u && "ecdsa/rsa" !== u) + throw new Error("wrong public key type"); + return (function (e, t, i) { + var n = a[i.data.algorithm.curve.join(".")]; + if (!n) + throw new Error( + "unknown curve " + i.data.algorithm.curve.join(".") + ); + var o = new r(n), + s = i.data.subjectPrivateKey.data; + return o.verify(t, e, s); + })(e, i, h); + } + if ("dsa" === h.type) { + if ("dsa" !== u) throw new Error("wrong public key type"); + return (function (e, t, i) { + var r = i.data.p, + a = i.data.q, + c = i.data.g, + u = i.data.pub_key, + l = o.signature.decode(e, "der"), + h = l.s, + f = l.r; + s(h, a), s(f, a); + var d = n.mont(r), + p = h.invm(a); + return ( + 0 === + c + .toRed(d) + .redPow(new n(t).mul(p).mod(a)) + .fromRed() + .mul(u.toRed(d).redPow(f.mul(p).mod(a)).fromRed()) + .mod(r) + .mod(a) + .cmp(f) + ); + })(e, i, h); + } + if ("rsa" !== u && "ecdsa/rsa" !== u) + throw new Error("wrong public key type"); + i = t.concat([l, i]); + for ( + var f = h.modulus.byteLength(), d = [1], p = 0; + i.length + d.length + 2 < f; + + ) + d.push(255), p++; + d.push(0); + for (var m = -1; ++m < i.length; ) d.push(i[m]); + d = new t(d); + var g = n.mont(h.modulus); + (e = (e = new n(e).toRed(g)).redPow(new n(h.publicExponent))), + (e = new t(e.fromRed().toArray())); + var _ = p < 8 ? 1 : 0; + for ( + f = Math.min(e.length, d.length), + e.length !== d.length && (_ = 1), + m = -1; + ++m < f; + + ) + _ |= e[m] ^ d[m]; + return 0 === _; + }; + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { + (function (t) { + var n = i(17), + r = i(11); + e.exports = function (e) { + return new a(e); + }; + var o = { + secp256k1: { + name: "secp256k1", + byteLength: 32, + }, + secp224r1: { + name: "p224", + byteLength: 28, + }, + prime256v1: { + name: "p256", + byteLength: 32, + }, + prime192v1: { + name: "p192", + byteLength: 24, + }, + ed25519: { + name: "ed25519", + byteLength: 32, + }, + secp384r1: { + name: "p384", + byteLength: 48, + }, + secp521r1: { + name: "p521", + byteLength: 66, + }, + }; + function a(e) { + (this.curveType = o[e]), + this.curveType || + (this.curveType = { + name: e, }), - this.curve = new n.ec(this.curveType.name), - this.keys = void 0 + (this.curve = new n.ec(this.curveType.name)), + (this.keys = void 0); + } + function s(e, i, n) { + Array.isArray(e) || (e = e.toArray()); + var r = new t(e); + if (n && r.length < n) { + var o = new t(n - r.length); + o.fill(0), (r = t.concat([o, r])); } - function s(e, i, n) { - Array.isArray(e) || (e = e.toArray()); - var r = new t(e); - if (n && r.length < n) { - var o = new t(n - r.length); - o.fill(0), - r = t.concat([o, r]) - } - return i ? r.toString(i) : r - } - o.p224 = o.secp224r1, - o.p256 = o.secp256r1 = o.prime256v1, - o.p192 = o.secp192r1 = o.prime192v1, - o.p384 = o.secp384r1, - o.p521 = o.secp521r1, - a.prototype.generateKeys = function(e, t) { - return this.keys = this.curve.genKeyPair(), - this.getPublicKey(e, t) - } - , - a.prototype.computeSecret = function(e, i, n) { - return i = i || "utf8", - t.isBuffer(e) || (e = new t(e,i)), - s(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(), n, this.curveType.byteLength) - } - , - a.prototype.getPublicKey = function(e, t) { - var i = this.keys.getPublic("compressed" === t, true); - return "hybrid" === t && (i[i.length - 1] % 2 ? i[0] = 7 : i[0] = 6), + return i ? r.toString(i) : r; + } + (o.p224 = o.secp224r1), + (o.p256 = o.secp256r1 = o.prime256v1), + (o.p192 = o.secp192r1 = o.prime192v1), + (o.p384 = o.secp384r1), + (o.p521 = o.secp521r1), + (a.prototype.generateKeys = function (e, t) { + return (this.keys = this.curve.genKeyPair()), this.getPublicKey(e, t); + }), + (a.prototype.computeSecret = function (e, i, n) { + return ( + (i = i || "utf8"), + t.isBuffer(e) || (e = new t(e, i)), + s( + this.curve + .keyFromPublic(e) + .getPublic() + .mul(this.keys.getPrivate()) + .getX(), + n, + this.curveType.byteLength + ) + ); + }), + (a.prototype.getPublicKey = function (e, t) { + var i = this.keys.getPublic("compressed" === t, true); + return ( + "hybrid" === t && (i[i.length - 1] % 2 ? (i[0] = 7) : (i[0] = 6)), s(i, e) - } - , - a.prototype.getPrivateKey = function(e) { - return s(this.keys.getPrivate(), e) - } - , - a.prototype.setPublicKey = function(e, i) { - return i = i || "utf8", - t.isBuffer(e) || (e = new t(e,i)), + ); + }), + (a.prototype.getPrivateKey = function (e) { + return s(this.keys.getPrivate(), e); + }), + (a.prototype.setPublicKey = function (e, i) { + return ( + (i = i || "utf8"), + t.isBuffer(e) || (e = new t(e, i)), this.keys._importPublic(e), this - } - , - a.prototype.setPrivateKey = function(e, i) { - i = i || "utf8", - t.isBuffer(e) || (e = new t(e,i)); - var n = new r(e); - return n = n.toString(16), - this.keys = this.curve.genKeyPair(), + ); + }), + (a.prototype.setPrivateKey = function (e, i) { + (i = i || "utf8"), t.isBuffer(e) || (e = new t(e, i)); + var n = new r(e); + return ( + (n = n.toString(16)), + (this.keys = this.curve.genKeyPair()), this.keys._importPrivate(n), this - } - } - ).call(this, i(9).Buffer) -} -, function(e, t, i) { - t.publicEncrypt = i(587), - t.privateDecrypt = i(588), - t.privateEncrypt = function(e, i) { - return t.publicEncrypt(e, i, true) - } - , - t.publicDecrypt = function(e, i) { - return t.privateDecrypt(e, i, true) - } -} -, function(e, t, i) { - var n = i(92) - , r = i(53) - , o = i(69) - , a = i(223) - , s = i(224) - , c = i(11) - , u = i(225) - , l = i(134) - , h = i(2).Buffer; - e.exports = function(e, t, i) { - var f; - f = e.padding ? e.padding : i ? 1 : 4; - var d, p = n(e); - if (4 === f) - d = function(e, t) { - var i = e.modulus.byteLength() - , n = t.length - , u = o("sha1").update(h.alloc(0)).digest() - , l = u.length - , f = 2 * l; - if (n > i - f - 2) - throw new Error("message too long"); - var d = h.alloc(i - n - f - 2) - , p = i - l - 1 - , m = r(l) - , g = s(h.concat([u, d, h.alloc(1, 1), t], p), a(m, p)) - , _ = s(m, a(g, l)); - return new c(h.concat([h.alloc(1), _, g], i)) - }(p, t); - else if (1 === f) - d = function(e, t, i) { - var n, o = t.length, a = e.modulus.byteLength(); - if (o > a - 11) - throw new Error("message too long"); - n = i ? h.alloc(a - o - 3, 255) : function(e) { - var t, i = h.allocUnsafe(e), n = 0, o = r(2 * e), a = 0; - for (; n < e; ) - a === o.length && (o = r(2 * e), - a = 0), - (t = o[a++]) && (i[n++] = t); - return i - }(a - o - 3); - return new c(h.concat([h.from([0, i ? 1 : 2]), n, h.alloc(1), t], a)) - }(p, t, i); - else { - if (3 !== f) - throw new Error("unknown padding"); - if ((d = new c(t)).cmp(p.modulus) >= 0) - throw new Error("data too long for modulus") - } - return i ? l(d, p) : u(d, p) - } -} -, function(e, t, i) { - var n = i(92) - , r = i(223) - , o = i(224) - , a = i(11) - , s = i(134) - , c = i(69) - , u = i(225) - , l = i(2).Buffer; - e.exports = function(e, t, i) { - var h; - h = e.padding ? e.padding : i ? 1 : 4; - var f, d = n(e), p = d.modulus.byteLength(); - if (t.length > p || new a(t).cmp(d.modulus) >= 0) + ); + }); + }.call(this, i(9).Buffer)); + }, + function (e, t, i) { + (t.publicEncrypt = i(587)), + (t.privateDecrypt = i(588)), + (t.privateEncrypt = function (e, i) { + return t.publicEncrypt(e, i, true); + }), + (t.publicDecrypt = function (e, i) { + return t.privateDecrypt(e, i, true); + }); + }, + function (e, t, i) { + var n = i(92), + r = i(53), + o = i(69), + a = i(223), + s = i(224), + c = i(11), + u = i(225), + l = i(134), + h = i(2).Buffer; + e.exports = function (e, t, i) { + var f; + f = e.padding ? e.padding : i ? 1 : 4; + var d, + p = n(e); + if (4 === f) + d = (function (e, t) { + var i = e.modulus.byteLength(), + n = t.length, + u = o("sha1").update(h.alloc(0)).digest(), + l = u.length, + f = 2 * l; + if (n > i - f - 2) throw new Error("message too long"); + var d = h.alloc(i - n - f - 2), + p = i - l - 1, + m = r(l), + g = s(h.concat([u, d, h.alloc(1, 1), t], p), a(m, p)), + _ = s(m, a(g, l)); + return new c(h.concat([h.alloc(1), _, g], i)); + })(p, t); + else if (1 === f) + d = (function (e, t, i) { + var n, + o = t.length, + a = e.modulus.byteLength(); + if (o > a - 11) throw new Error("message too long"); + n = i + ? h.alloc(a - o - 3, 255) + : (function (e) { + var t, + i = h.allocUnsafe(e), + n = 0, + o = r(2 * e), + a = 0; + for (; n < e; ) + a === o.length && ((o = r(2 * e)), (a = 0)), + (t = o[a++]) && (i[n++] = t); + return i; + })(a - o - 3); + return new c(h.concat([h.from([0, i ? 1 : 2]), n, h.alloc(1), t], a)); + })(p, t, i); + else { + if (3 !== f) throw new Error("unknown padding"); + if ((d = new c(t)).cmp(p.modulus) >= 0) + throw new Error("data too long for modulus"); + } + return i ? l(d, p) : u(d, p); + }; + }, + function (e, t, i) { + var n = i(92), + r = i(223), + o = i(224), + a = i(11), + s = i(134), + c = i(69), + u = i(225), + l = i(2).Buffer; + e.exports = function (e, t, i) { + var h; + h = e.padding ? e.padding : i ? 1 : 4; + var f, + d = n(e), + p = d.modulus.byteLength(); + if (t.length > p || new a(t).cmp(d.modulus) >= 0) + throw new Error("decryption error"); + f = i ? u(new a(t), d) : s(t, d); + var m = l.alloc(p - f.length); + if (((f = l.concat([m, f], p)), 4 === h)) + return (function (e, t) { + var i = e.modulus.byteLength(), + n = c("sha1").update(l.alloc(0)).digest(), + a = n.length; + if (0 !== t[0]) throw new Error("decryption error"); + var s = t.slice(1, a + 1), + u = t.slice(a + 1), + h = o(s, r(u, a)), + f = o(u, r(h, i - a - 1)); + if ( + (function (e, t) { + (e = l.from(e)), (t = l.from(t)); + var i = 0, + n = e.length; + e.length !== t.length && + (i++, (n = Math.min(e.length, t.length))); + var r = -1; + for (; ++r < n; ) i += e[r] ^ t[r]; + return i; + })(n, f.slice(0, a)) + ) throw new Error("decryption error"); - f = i ? u(new a(t), d) : s(t, d); - var m = l.alloc(p - f.length); - if (f = l.concat([m, f], p), - 4 === h) - return function(e, t) { - var i = e.modulus.byteLength() - , n = c("sha1").update(l.alloc(0)).digest() - , a = n.length; - if (0 !== t[0]) - throw new Error("decryption error"); - var s = t.slice(1, a + 1) - , u = t.slice(a + 1) - , h = o(s, r(u, a)) - , f = o(u, r(h, i - a - 1)); - if (function(e, t) { - e = l.from(e), - t = l.from(t); - var i = 0 - , n = e.length; - e.length !== t.length && (i++, - n = Math.min(e.length, t.length)); - var r = -1; - for (; ++r < n; ) - i += e[r] ^ t[r]; - return i - }(n, f.slice(0, a))) - throw new Error("decryption error"); - var d = a; - for (; 0 === f[d]; ) - d++; - if (1 !== f[d++]) - throw new Error("decryption error"); - return f.slice(d) - }(d, f); - if (1 === h) - return function(e, t, i) { - var n = t.slice(0, 2) - , r = 2 - , o = 0; - for (; 0 !== t[r++]; ) - if (r >= t.length) { - o++; - break - } - var a = t.slice(2, r - 1); - ("0002" !== n.toString("hex") && !i || "0001" !== n.toString("hex") && i) && o++; - a.length < 8 && o++; - if (o) - throw new Error("decryption error"); - return t.slice(r) - }(0, f, i); - if (3 === h) - return f; - throw new Error("unknown padding") - } -} -, function(e, t, i) { - "use strict"; - (function(e, n) { - function r() { - throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11") - } - var o = i(2) - , a = i(53) - , s = o.Buffer - , c = o.kMaxLength - , u = e.crypto || e.msCrypto - , l = Math.pow(2, 32) - 1; - function h(e, t) { - if ("number" != typeof e || e != e) - throw new TypeError("offset must be a number"); - if (e > l || e < 0) - throw new TypeError("offset must be a uint32"); - if (e > c || e > t) - throw new RangeError("offset out of range") - } - function f(e, t, i) { - if ("number" != typeof e || e != e) - throw new TypeError("size must be a number"); - if (e > l || e < 0) - throw new TypeError("size must be a uint32"); - if (e + t > i || e > c) - throw new RangeError("buffer too small") - } - function d(e, t, i, r) { - if (n.browser) { - var o = e.buffer - , s = new Uint8Array(o,t,i); - return u.getRandomValues(s), - r ? void n.nextTick(function() { - r(null, e) - }) : e + var d = a; + for (; 0 === f[d]; ) d++; + if (1 !== f[d++]) throw new Error("decryption error"); + return f.slice(d); + })(d, f); + if (1 === h) + return (function (e, t, i) { + var n = t.slice(0, 2), + r = 2, + o = 0; + for (; 0 !== t[r++]; ) + if (r >= t.length) { + o++; + break; } - if (!r) - return a(i).copy(e, t), - e; - a(i, function(i, n) { - if (i) - return r(i); - n.copy(e, t), - r(null, e) - }) + var a = t.slice(2, r - 1); + (("0002" !== n.toString("hex") && !i) || + ("0001" !== n.toString("hex") && i)) && + o++; + a.length < 8 && o++; + if (o) throw new Error("decryption error"); + return t.slice(r); + })(0, f, i); + if (3 === h) return f; + throw new Error("unknown padding"); + }; + }, + function (e, t, i) { + "use strict"; + (function (e, n) { + function r() { + throw new Error( + "secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11" + ); + } + var o = i(2), + a = i(53), + s = o.Buffer, + c = o.kMaxLength, + u = e.crypto || e.msCrypto, + l = Math.pow(2, 32) - 1; + function h(e, t) { + if ("number" != typeof e || e != e) + throw new TypeError("offset must be a number"); + if (e > l || e < 0) throw new TypeError("offset must be a uint32"); + if (e > c || e > t) throw new RangeError("offset out of range"); + } + function f(e, t, i) { + if ("number" != typeof e || e != e) + throw new TypeError("size must be a number"); + if (e > l || e < 0) throw new TypeError("size must be a uint32"); + if (e + t > i || e > c) throw new RangeError("buffer too small"); + } + function d(e, t, i, r) { + if (n.browser) { + var o = e.buffer, + s = new Uint8Array(o, t, i); + return ( + u.getRandomValues(s), + r + ? void n.nextTick(function () { + r(null, e); + }) + : e + ); } - u && u.getRandomValues || !n.browser ? (t.randomFill = function(t, i, n, r) { + if (!r) return a(i).copy(e, t), e; + a(i, function (i, n) { + if (i) return r(i); + n.copy(e, t), r(null, e); + }); + } + (u && u.getRandomValues) || !n.browser + ? ((t.randomFill = function (t, i, n, r) { if (!(s.isBuffer(t) || t instanceof e.Uint8Array)) - throw new TypeError('"buf" argument must be a Buffer or Uint8Array'); - if ("function" == typeof i) - r = i, - i = 0, - n = t.length; - else if ("function" == typeof n) - r = n, - n = t.length - i; + throw new TypeError( + '"buf" argument must be a Buffer or Uint8Array' + ); + if ("function" == typeof i) (r = i), (i = 0), (n = t.length); + else if ("function" == typeof n) (r = n), (n = t.length - i); else if ("function" != typeof r) - throw new TypeError('"cb" argument must be a function'); - return h(i, t.length), - f(n, i, t.length), - d(t, i, n, r) - } - , - t.randomFillSync = function(t, i, n) { + throw new TypeError('"cb" argument must be a function'); + return h(i, t.length), f(n, i, t.length), d(t, i, n, r); + }), + (t.randomFillSync = function (t, i, n) { void 0 === i && (i = 0); if (!(s.isBuffer(t) || t instanceof e.Uint8Array)) - throw new TypeError('"buf" argument must be a Buffer or Uint8Array'); - h(i, t.length), - void 0 === n && (n = t.length - i); - return f(n, i, t.length), - d(t, i, n) - } - ) : (t.randomFill = r, - t.randomFillSync = r) - } - ).call(this, i(15), i(27)) -} + throw new TypeError( + '"buf" argument must be a Buffer or Uint8Array' + ); + h(i, t.length), void 0 === n && (n = t.length - i); + return f(n, i, t.length), d(t, i, n); + })) + : ((t.randomFill = r), (t.randomFillSync = r)); + }.call(this, i(15), i(27))); + }, ]);